万一哪一天用得上,自己好找一点,故放在这里
- (defun t1t1t1 (e / A B EB EN L NAME OBJ)
- (setq en (entget e))
- (setq name (cdr (assoc 2 en)))
- (setq eb (TBLOBJNAME "Block" name))
- (while (setq eb (entnext eb))
- ;;如果不是*TEXT,ATTDEF ,求包围盒
- (setq name (cdr (assoc 0 (entget eb))))
- (if (not (wcmatch name "*TEXT,ATTDEF"))
- (progn
- (setq obj (vlax-ename->vla-object eb))
- (vla-GetBoundingBox obj 'a 'b)
- (setq a (safearray-value a))
- (setq b (safearray-value b))
- (setq L (cons a L))
- (setq L (cons b L))
- )
- )
- )
- ;;如果L存在,求包围盒
- (if L
- (list
- (apply 'mapcar (cons 'min L))
- (apply 'mapcar (cons 'max L))
- )
- )
- )
- ;;选择块
- (defun C:t1 (/ A B E L OBJ)
- (setq e (car (entsel)))
- ;;此块的外围盒
- (setq obj (vlax-ename->vla-object e))
- (vla-GetBoundingBox obj 'a 'b)
- (setq a (safearray-value a))
- (setq b (safearray-value b))
- (princ (list a b))
- ;;块最小包围盒
- (princ (t1t1t1 e))
- (princ)
- )
|