AutoLISP自动标注圆,弧,直线,多段线长度,代码如下。
(defun c:test()
(setvar "cmdecho" 0)
(setq en (entsel "\n选取圆、线、弧、多义线计算长度:"))
(while en
(setq en (car en))
(command "lengthen" en "")
(setq dd (getvar "perimeter"))
(princ (strcat "\n长度=" (rtos dd 2)))
(setq pt (getpoint "\n文字位置点:"))
(setq old_hh (getvar "textsize"))
(setq str_hh (strcat "\n高度<" (rtos old_hh 2) ">:"))
(setq hh (getdist pt str_hh))
(if (null hh) (setq hh old_hh))
(command "text" pt hh 0 (strcat "长度=" (rtos dd 2)))
(setq en (entsel "\n选取圆、线、弧、多义线计算长度:"))
)
(prin1)
)
代码完。