- (defun c:tt ()
- (defun dxf (code e) (cdr (assoc code (entget e))))
- (defun mimx (s1 / p1 p9)
- (vla-getboundingbox (vlax-ename->vla-object s1) 'p1 'p9)
- (list (vlax-safearray->list p1) (vlax-safearray->list p9))
- )
- (defun mid (p1 p2)
- (mapcar '(lambda (x y) (* (+ x y) 0.5)) p1 p2)
- )
- (if (setq ss (ssget '((0 . "TEXT") (1 . "~*[~`--9]*"))))
- (progn
- (setq lst (vl-remove-if-not '(lambda (x) (equal (type (cadr x)) 'ENAME)) (ssnamex ss))
- lst (mapcar '(lambda (x) (list (DXF 1 x) x)) (mapcar 'cadr lst))
- lst (vl-sort lst '(lambda (x y) (< (distof (car x)) (distof (car y)))))
- s1 (cadar lst)
- s2 (cadr (last lst))
- pn1 (mimx s1)
- pn2 (mimx s2)
- pc1 (mid (car pn1) (setq p9 (cadr pn1)))
- pc2 (mid (car pn2) (setq p9a (cadr pn2)))
- )
- (setvar 'cecolor "1")
- (command "circle" pc1 p9)
- (setq s1 (entlast))
- (setvar 'cecolor "3")
- (command "circle" pc2 p9a)
- (setq s2 (entlast))
- )
- )
- (princ)
- )
|