你的意思是不是要求所选的线段总长度 下面是求出所选定的线的总长度之和源码 (defun C:cdtj (/ 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)) ) (print (strcat "总长度: " (rtos SUMLEN 2 5))) (princ) ) |