; TIP770.LSP MXX.LSP Multiple Explode (c)1992, Paul Mutschler
(defun C:exp (/ SS1 SS2 A L I R ENT1 L1 RR)
(setvar "cmdecho" 0)
(setq SS1 (ssget))
(initget "Y N")
(setq RR (getkword"\nExplode all selected blocks? (Y/N) "))
(if(= RR "N") (progn
(setq A (strcase (getstring"\nEnter Block Name: ")))
(setq SS2 (ssadd))
(setq L (sslength SS1))
(setq I 0)
(repeat L
(setq N (entget (ssname SS1 I)))
(if (and (= (cdr (assoc 0 N)) "INSERT")
(= (cdr (assoc 2 N)) A))
(ssadd (cdr (assoc -1 N)) SS2)
);if
(setq I (+ 1 I))
);repeat
(setq L1 (sslength SS2))
(setq R 0)
(repeat L1
(setq ENT1 (ssname SS2 R))
(command "explode" ENT1)
(setq R (+ 1 R))
);repeat
(princ)
);progn
(progn
(setq SS2 (ssadd))
(setq L (sslength SS1))
(setq I 0)
(repeat L
(setq N (entget (ssname SS1 I)))
(if (= (cdr (assoc 0 N)) "INSERT")
(ssadd (cdr (assoc -1 N)) SS2)
)
(setq I (+ 1 I))
);repeat
(setq L1 (sslength SS2))
(setq R 0)
(repeat L1
(setq ENT1 (ssname SS2 R))
(command "explode" ENT1)
(setq R (+ 1 R))
);repeat
(princ)
);progn
);if
);end
(c:exp)

Advertisements