- (defun c:TT ( / *error* sol_ el sol n newrel sol1 interf sol_interf ss )
- (vl-load-com)
- (defun *error* ( msg )
- (vla-endundomark (vla-get-activedocument (vlax-get-acad-object)))
- (if msg (prompt msg))
- (princ)
- )
- (vla-startundomark (vla-get-activedocument (vlax-get-acad-object)))
- (if (and
- (princ "\nSelect 3D SOLIDS")
- (progn
- (while (or (null sol_) (< (sslength sol_) 2))
- (setq sol_ (ssget "_:L" '((0 . "3DSOLID"))))
- (cond
- ( (null sol_) (prompt "\nEmpty sel. set... Try selecting again...") )
- ( (< (sslength sol_) 2) (prompt "\nSelected one 3D SOLID, please select more... Try selecting again...") )
- )
- )
- t
- )
- )
- (progn
- (setq el (entlast))
- (repeat (setq n (sslength sol_))
- (setq sol (cons (ssname sol_ (setq n (1- n))) sol))
- )
- (if (vl-catch-all-error-p (vl-catch-all-apply 'vla-checkinterference (list (vlax-ename->vla-object (car sol)) (vlax-ename->vla-object (cadr sol)) :vlax-true)))
- (setq newrel t)
- (if (not (eq el (entlast)))
- (entdel (entlast))
- )
- )
- (setq sol1 sol)
- (setq interf 0)
- (if newrel
- (progn
- (mapcar
- '(lambda (a)
- (mapcar
- '(lambda (b)
- (if (vla-CheckInterference (vlax-ename->vla-object a) (vlax-ename->vla-object b) :vlax-true 'test)
- (progn
- (setq sol_interf (cons a sol_interf))
- (setq sol_interf (cons b sol_interf))
- (entdel (entlast))
- (setq interf (1+ interf))
- )
- )
- )
- (setq sol1 (cdr sol1))
- )
- )
- (reverse (cdr (reverse sol)))
- )
- )
- (progn
- (mapcar
- '(lambda (a)
- (mapcar
- '(lambda (b)
- (if (vla-CheckInterference (vlax-ename->vla-object a) (vlax-ename->vla-object b) :vlax-true)
- (progn
- (setq sol_interf (cons a sol_interf))
- (setq sol_interf (cons b sol_interf))
- (entdel (entlast))
- (setq interf (1+ interf))
- )
- )
- )
- (setq sol1 (cdr sol1))
- )
- )
- (reverse (cdr (reverse sol)))
- )
- )
- )
- (setq ss (ssadd))
- (foreach ent sol_interf (ssadd ent ss))
- (sssetfirst nil ss)
- (princ
- (strcat
- "\nNumber of 3D SOLIDS : " (itoa (sslength ss))
- " - Number of interferences : "(itoa interf)
- )
- )
- )
- )
- (vla-endundomark (vla-get-activedocument (vlax-get-acad-object)))
- (princ)
- )
|