;;说明:返回曲线长度
(defun curlen(ent / obj)
(vl-load-com)
(setq obj (vlax-ename->vla-object ent))
(vlax-curve-getdistatparam obj (vlax-curve-getendparam obj))
)
;;说明:拾取曲线并打印曲线长度
(defun c:curlen(/ len obj)
(vl-load-com)
(setq obj (vlax-ename->vla-object (car (entsel))))
(setq len (vlax-curve-getdistatparam obj (vlax-curve-getendparam obj)))
(princ (strcat "\n曲线长度为:" (rtos len) "!"))
(prin1)
)