- 积分
- 1024
- 明经币
- 个
- 注册时间
- 2008-6-29
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2012-6-20 15:16:01
|
显示全部楼层
;;;-----------------------------------------------------
;;;程序名:zz.LSP
;;;功 能:计算线段和多义线的长度
;;;-----------------------------------------------------
(princ "\n程序:统计线段长度 命令:zz")
(defun C:zz (/ 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))
)
(princ (strcat "\n共选择 " (itoa (sslength SS)) " 条线段,线段总长:" (rtos SUMLEN 2 0) "毫米。"))
(princ)
) |
|