- ;;;By Alin 19/9/2004
- (defun c:getarea (/ reglst elast area enext oldEcho)
- (setq oldEcho (getvar "CMDECHO"))
- (setvar "CMDECHO" 0)
- (setq elast (entlast)
- area 0.0
- )
- (princ "\n选择内部点:")
- (command "bpoly" "a" "o" "r" "")
- (while (> (getvar "CMDACTIVE") 0)
- (command pause)
- )
- (if (entnext elast)
- (progn
- (setq enext elast)
- (while (setq enext (entnext enext))
- (setq
- area
- (+ area (vla-get-area (vlax-ename->vla-object enext)))
- )
- (setq reglst (cons enext reglst))
- )
- (foreach reg reglst (entdel reg))
- (alert (strcat "总面积:" (rtos area 2 2)))
- )
- (princ "\n没有选择到内部点。")
- )
- (setvar "CMDECHO" cmdEcho)
- (princ)
- )
|