Author Topic: Bexplode block that contain other block  (Read 2055 times)

0 Members and 1 Guest are viewing this topic.

Zykl0

  • Guest
Bexplode block that contain other block
« on: September 08, 2011, 10:43:46 AM »
Hello!

Is there any lisp routine around that is able to explode every block in my drawing that contain other block?  (i dont need block inside block, like bound x-ref's)

Thank you very much  :-P

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Bexplode block that contain other block
« Reply #1 on: September 08, 2011, 11:59:46 AM »
This will return a list of Block names which contain other (nested) blocks:

Code: [Select]
(defun _GetNestedNames ( doc / name lst )
    (vlax-for block (vla-get-blocks doc)
        (setq name  (vla-get-name block))
        (if (eq :vlax-false (vla-get-islayout block))
            (vlax-for obj block
                (if
                    (and
                        (not (member name lst))
                        (eq "AcDbBlockReference" (vla-get-objectname obj))
                    )
                    (setq lst (cons name lst))
                )
            )
        )
    )
    lst
)

Supply it with the VLA Document Object of the drawing you want to query:

Code: [Select]
(_GetNestedNames (vla-get-activedocument (vlax-get-acad-object)))
From there you can construct a relevant SelectionSet filter list and collect a SelectionSet of those blocks which need to be exploded.

Zykl0

  • Guest
Re: Bexplode block that contain other block
« Reply #2 on: September 22, 2011, 05:23:44 PM »
Hey thank you Lee,

I cannot make it work im not used with these kind of code...

how do i call it inside autocad ? i can work with .lsp file and loading the command with shortcut name in the command prompt.

how do i make it work ?

i might push my luck, but something i could load and use instantly would be much appreciated :)

i only need a new command that explode block containing other block.

I recently got CAD from architect containing around 400 x-ref that i need to merge inside drawing and explode every block containing other block... i'm about to lose my nerf  :oops:


Thank you

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Bexplode block that contain other block
« Reply #3 on: September 22, 2011, 07:12:53 PM »
i might push my luck, but something i could load and use instantly would be much appreciated :)

i only need a new command that explode block containing other block.

Perhaps you might want to consider hiring a programmer then  :-)