试试下面这个: (defun c:test(/ curve tlen ss n sumlen) (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)) ) (alert (strcat "\n总长度: " (rtos sumlen 2 3) (princ "m"))) (princ) ) |