- 积分
- 31712
- 明经币
- 个
- 注册时间
- 2005-5-16
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2022-6-26 13:11:33
|
显示全部楼层
;;; 功能: 计算多个选择对象的总面积
(defun c:ZMJ (/ olderr oldcmdecho errexit undox restore ss1 nr en tot_area)
(vl-load-com)
(defun errexit (s)
(restore)
)
(defun undox ()
(command "._undo" "_E")
(setvar "cmdecho" oldcmdecho)
(setq *error* olderr)
(princ)
)
(setq olderr *error*
restore undox
*error* errexit
)
(setq oldcmdecho (getvar "cmdecho"))
(setvar "cmdecho" 0)
(command "._UNDO" "_BE")
(if (setq ss1 (ssget '((0 . "POLYLINE,LWPOLYLINE,CIRCLE,ELLIPSE,SPLINE,REGION"))))
(progn
(setq tot_area 0.0)
(repeat (setq nr (sslength ss1))
(setq nr (1- nr))
(setq en (ssname ss1 nr))
(setq tot_area (+ tot_area (vlax-curve-getArea ent)))
)
(princ "\n总面积 = ")
(princ tot_area)
)
)
(restore)
)
|
|