• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

transform blocks into groups by simultaneous explosion blocks

  • Thread starter Thread starter Mano63
  • Start date Start date

Mano63

Guest
Good evening to all,

I attach a lisp that helps me create groups by exploding blocks. I'm looking for someone's help to get a similar command that allows a single selection for the explosion of blocks and the contextual creation of groups that include the same objects as the previous blocks.
thanks to who will help me
 

Attachments

Code:
(defun c:b2g(/ sel count n obj selb name handle)
(prompt "\nseleziona blocchi da esplodere: ")
(setq sel (ssget (list 0 "insert"))))
(command "._undo" "_begin")
(setq count 0)
(repeat (sslength sel)
(sssname sel count)
(setq obj (vlax-ename->vla-object n))
(setq name (vlax-get-property obj 'effectivename))
(setq handle (vlax-get-property obj 'handle))
(setq selb (fnexplode2sel n))
;(command "._-group" "_create" (strcat name "-" handle) "" selb "") ; create grouppo con nome+handle
(command "._-group" "_create" "*" (strcat "explode: " name) selb") ; creates gruppo senza nome con descrizione
(setq count (1+ count))
)
(command "._undo" "_in")
)

esplode entita n e ritorna gruppo di selezione
(defun fnexplode2sel(n/sel qaflag order)
(setq order (getvar "draworderctl"))
(setq qaflag (getvar "qaflags"))
(setvar "draworderctl" 0)
(setvar "qaflags" 1)
(command "_explode" n "")
(setvar "qaflags" qaflag)
(setvar "draworderctl" order)
(ssget "_p")
)
you can choose whether to use the creation of the group without name or with block name + handle.
handle I used it to make the name of the unique group.
fnexplode2sel function explodes the entity and returns the selection group.

Hi.
 
Great!
both the command and rpor66.
works very well: for now I have tried with 4 blocks, shortly I will try with 200-250 (usually work with these quantities).
I do not have the need to name groups (which normally consist of 10-12 different types and contain data fields with size of lengths and areas that banally identify me types), but (excuse ignorance) for any future needs I would like to understand how to make the group choice with/without name: what it means "block + handle"?
Thank you again!
 
Just put the ; on the line and eliminate it on the other.
;(command "._-group" "_create" (strcat name "-" handle) "" selb "), creates group with name+handle
(command "._-group" "_create" "*" (strcat "explode: " name) selb "), creates group without name with description

handle is the unique identifier of each entity present in the dwg; specifically, it serves to assign the block name to the group and in the case of 2 equal blocks, handle allows to have unique group names.

Hi.
 
Okay, I'll keep in mind. Surely you gave me an extra point to get me out on how this option might come in handy.
I'll test it tomorrow.
Thank you.
Good evening
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top