Jump to content

Exploding Nested Blocks by partial name


asapella

Recommended Posts

Hi everyone glad to be in this amazing forum.

Straight to the point:

is there a way to explode the nested blocks in a drawing that contain a a common word in their name?

In our case we have a lot of blocks exported from vectorworks whose name was substitute with -group-xxx-y, is there a way to run a routine similar to exnest but that would explode only the nested blocks with that similar name?

Thanks for any help:)

Link to comment
Share on other sites

Thanks samifox

the exnest works fine but it explodes all the nested block.

The intention is to explode only the nested blocks that have the same partial name -group- while preserving the nested blocks named differently.

Link to comment
Share on other sites

Modify Lee's Code in the following way:

 

 

;; by Lee Mac; 4th Sep 2012 at 08:00 am.
(defun c:exnest ( )
   (vlax-for blk (vla-get-blocks (LM:acdoc))
       (if (and
               (= :vlax-false (vla-get-isxref blk))
               (= :vlax-false (vla-get-islayout blk))
           )
           (vlax-for obj blk
               (if (and
                       (= "AcDbBlockReference" (vla-get-objectname obj))
                       ;;==================
                       [color=red](wcmatch (vla-get-name obj) "*GROUP*")[/color] ;; Add This Line Here
                       ;;================
                       (null (vl-catch-all-error-p (vl-catch-all-apply 'vla-explode (list obj))))
                   )
                   (vl-catch-all-apply 'vla-delete (list obj))
               )
           )
       )
   )
   (command "_.-purge" "_B" "*" "_N")
   (vla-regen (LM:acdoc) acallviewports)
   (princ)
)
;; Active Document  -  Lee Mac
;; Returns the VLA Active Document Object
(defun LM:acdoc nil
   (eval (list 'defun 'LM:acdoc 'nil (vla-get-activedocument (vlax-get-acad-object))))
   (LM:acdoc)
)

Link to comment
Share on other sites

Thank you very much pkenewell, you are the best.

That was it.

It meant the world not to have to go through all the freaking blocks.

 

Peace and respect to all the pro sharing their great knowledge on this forum:excited:

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...