ChristopherM Posted May 18, 2017 Posted May 18, 2017 Hi Tried to look for something like the topic says but only found topics that explodes everything. And I want to explode ONLY the blocks that are inside a block and then keeping the main block that is placed. I have hundreds blocks and some of them are inside a block so something automatic would be nice Thank for the help CM Quote
SLW210 Posted May 19, 2017 Posted May 19, 2017 I have moved your thread to the AutoLISP, Visual LISP & DCL Forum. Quote
Lee Mac Posted May 19, 2017 Posted May 19, 2017 See here: http://www.cadtutor.net/forum/showthread.php?72399-Explode-nested-blocks-only&p=636640&viewfull=1#post636640 Quote
Grrr Posted May 19, 2017 Posted May 19, 2017 See here:http://www.cadtutor.net/forum/showthread.php?72399-Explode-nested-blocks-only&p=636640&viewfull=1#post636640 Nice one, expected recursion I had fun trying the iterative way: (defun C:test ( / o n L b) (defun Bdef->SubentsL ( nm / e L ) (setq e (cdr (assoc -2 (entget (tblobjname "BLOCK" nm))))) (while e (setq L (cons e L)) (setq e (entnext e))) L ) (and (setq n (car (entsel "\nSelect block to \"flatten\": "))) (setq n (vlax-ename->vla-object n)) (setq n (vla-get-EffectiveName n)) (progn (while (vl-some (function (lambda (x / o) (and (= "INSERT" (cdr (assoc 0 x))) (setq L (cons (cdr (assoc 2 x)) L)) (setq o (vlax-ename->vla-object (cdr (assoc -1 x)))) (vlax-write-enabled-p o) (not (vl-catch-all-error-p (vl-catch-all-apply 'vla-Explode (list o)))) (not (vla-Delete o)) ) ) ) (mapcar 'entget (Bdef->SubentsL n)) ) ); while (and (= "Yes" (progn (initget "Yes No") (cond ((getkword "\nAttempt to purge the SubBlocks? [Yes/No] <Yes>: ")) ("Yes")))) (setq b (vla-get-Blocks (vla-get-ActiveDocument (vlax-get-acad-object)))) (foreach x L (vl-catch-all-apply 'vla-Delete (list (vla-item b x))) ) ); and ); progn ); and (princ) ); defun Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.