- (princ "\n统计面积:TA 统计长度并标注:TAT")
- (defun c:TA(/ ss tarea obj k l)
- (setvar "cmdecho" 0)
- (if (setq ss (ssget))
- (progn
- (vl-load-com)
- (setq l (sslength ss) k 0 tarea 0 )
- (repeat l
- (setq ename (ssname ss k))
- (setq obj (vlax-ename->vla-object ename))
- (if (vlax-property-available-p obj "area")
- (setq tarea (+ (vlax-get-property obj 'area) tarea))
- )
- (setq k (1+ k))
- )
- (setq tarea (/ tarea 1000000))
- (princ (strcat "\n共选择 " (itoa l) " 个对象 | 总面积: " (rtos tarea 2 2)))
- )
- (princ "\n未选择对象")
- )
- (setvar "cmdecho" 1)
- (prin1)
- )
- (defun c:TAT(/ ss tarea obj k l)
- (setvar "cmdecho" 0)
- (if (setq ss (ssget))
- (progn
- (vl-load-com)
- (setq l (sslength ss) k 0 tarea 0 )
- (repeat l
- (setq ename (ssname ss k))
- (setq obj (vlax-ename->vla-object ename))
- (if (vlax-property-available-p obj "area")
- (setq tarea (+ (vlax-get-property obj 'area) tarea))
- )
- (setq k (1+ k))
- )
- (setq tarea (/ tarea 1000000))
- (princ (strcat "\n共选择 " (itoa l) " 个对象 | 总面积: " (rtos tarea 2 2)))
- (command "text" (getpoint "\n选取文字插入点") "" "" (rtos tarea 2 2))
- )
- (princ "\n未选择对象")
- )
- (setvar "cmdecho" 1)
- (prin1)
- )
TAT注意设置textsize |