根据选取曲线生成同长度Line,恳求出手相助!
具体要求同图片所示,恳求大家帮忙解决下!感谢!!(defun C:TT (/ CURVE TLEN SS N SUMLEN pt1 pt2)
(vl-load-com)
(setq SUMLEN 0)
(setq SS (ssget '((0 . "CIRCLE,ELLIPSE,LINE,*POLYLINE,SPLINE,ARC"))))
(setq N 0)
(repeat (sslength SS)
(setq CURVE (vlax-ename->vla-object (ssname SS N)))
(setq TLEN (vlax-curve-getdistatparam
CURVE
(vlax-curve-getendparam CURVE)
)
)
(setq SUMLEN (+ SUMLEN TLEN))
(setq N (1+ N))
)
(setq pt1 (getpoint "\n指定直线起点:")
pt2 (list (+ (car pt1) SUMLEN) (cadr pt1)))
(command "_.line" pt1 pt2 "")
(princ "\n总长度=============================== 【" )
(princ (rtos SUMLEN 2 3)) (princ "】")
(princ)
) (defun C:TEST (/ E PP)
(while
(not (and
(setq E (entsel "\n选择曲线: "))
(progn
(setq E(car E)
PP (vl-catch-all-apply 'vlax-curve-getEndParam (list E))
)
(if (vl-catch-all-error-p PP)
(not (princ "无效的对象。"))
T
)
)
)
)
)
(if (setq P (getpoint "\n指定直线放置点: "))
(entmake (list '(0 . "LINE")
(cons 10 (setq P (trans P 1 0)))
(cons 11 (cons (+ (vlax-curve-getDistAtParam E PP) (car P))
(cdr P)
)
)
)
)
)
(princ)
) 刚回家上网看到二位的热心回复,感谢caoyin版感谢言社长老师,都挺好用,完全预期。再次感谢!!!
把言社长老师设为最佳答案,caoyin版没意见吧!
wangxf888 发表于 2021-3-13 20:57
刚回家上网看到二位的热心回复,感谢caoyin版感谢言社长老师,都挺好用,完全预期。再次感谢!!!
把言 ...
:lol:victory:
页:
[1]