嗨,我知道一点autolisp,但现在我想学习vlisp
im目前正在使用autolisp程序计算桩号和偏移量
但抵消都是积极的。我想让程序知道偏移是在多段线的左侧还是右侧。如果点位于左侧而右侧为正,则应显示负偏移值。
这是代码(我不记得我在哪个论坛复制了这段代码,但信用卡
转到func中提到的Jeff Mishler。
- (defun c:sta-off (/ endpt ent off offpt onpt ss sta startpt)
- ;; Marker for point location on the screen
- ;; Oct. 2004 by Jeff Mishler
- (defun Xmarksthespot (x y / leglen start)
- (setq start (list x y)
- leglen (* 0.03 (getvar "viewsize"))
- )
- (grdraw (polar start (angtof "135" 1) leglen)
- (polar start (angtof "315" 1) leglen)
- 7)
- (grdraw (polar start (angtof "45" 1) leglen)
- (polar start (angtof "225" 1) leglen)
- 7)
- )
- (while (setq ss (ssget "[img=http://autodesk.i.lithium.com/i/smilies/16x16_smiley-frustrated.gif]" '((0 . "LINE,*POLYLINE,SPLINE,ARC"))))
- (setq ent (ssname ss 0))
- (setq startpt (vlax-curve-getstartpoint ent)
- endpt (vlax-curve-getendpoint ent)
- )
- (xmarksthespot (car startpt)(cadr startpt))
- (while (setq offpt (getpoint "\nOffset point: "))
- (setq onPt (vlax-curve-getclosestpointto ent offpt)
- sta (vlax-curve-getdistatpoint ent onpt)
- off (distance onpt offpt)
- )
- (princ (strcat "Station: " (rtos sta 2 2) " - Offset: " (rtos off 2 2)))
- )
- (redraw)
- )
- (princ)
- )
帮助任何人?
谢谢
Ger Aven公司 |