为啥加getdist无效
本帖最后由 梦想家-DING 于 2023-3-26 15:42 编辑为啥加getdist无效,是哪里没整对吗(defun c:nn (/ curve tlen ss n sumlen zg)
(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 zg (getdist"\n->拖动距离高度:"))
(setvar "textsize" zg)
(entmakex
(list '(0 . "text") (cons 1 (strcat "线长度: " (rtos sumlen 2 2)"mm" )) (cons 10 (getpoint "\n点击指定文本位置:")) (cons 40 5))
)
(princ)
)
(cons 40 5)改成(cons 40 zg) 本帖最后由 xyp1964 于 2023-3-26 23:49 编辑
(defun c:tt ()
(if (setq ss (ssget '((0 . "circle,ellipse,line,*polyline,spline,arc"))))
(progn
(setq ll 0
n0
zg (getdist "\n->拖动距离高度: ")
p0 (getpoint "\n点击指定文本位置: ")
)
(or zg (setq zg 30))
(repeat (sslength ss)
(setq s1 (vlax-ename->vla-object (ssname ss n))
l1 (vlax-curve-getdistatparam s1 (vlax-curve-getendparam s1))
ll (+ ll l1)
n (1+ n)
)
)
(setvar "textsize" zg)
(setq tx (strcat "线长度: " (rtos ll 2 2) "mm"))
(entmakex(list '(0 . "text")(cons 1 tx)(cons 10 p0)(cons 40 zg)))
)
)
(princ)
)
页:
[1]