AutoLISP计算所选图元总长度
2011-05-24 20:44 精诚所至 金石为开 阅读(607) 评论(0) 收藏 举报AutoLISP计算所选图元总长度,代码如下。
(defun c:cd ()
(vl-load-com)
(setq len 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 temp (vlax-curve-getdistatparam
curve
(vlax-curve-getendparam curve)
)
)
(setq len (+ len temp))
(setq n (1+ n))
)
(print (strcat "总长度: " (rtos len 2 5)))
(princ)
)
代码完。
明经通道的源码,选中单个图元就是计算单个图元的长度。
 
                
            
         
                     
                    
                 
                    
                 浙公网安备 33010602011771号
浙公网安备 33010602011771号