Explode blocks By Name

Explode blocks By Name

Shilpa_Dhawan
Participant Participant
1,025 Views
22 Replies
Message 1 of 23

Explode blocks By Name

Shilpa_Dhawan
Participant
Participant

How do i have the ability to explode a Block by using the Name of the block and not by selecting it. Is there a setting i can change? 

 

For example, for command LayDel i can either select the element on the layer or name the layer in the command line. I want that similar ability to explode my blocks. I want to name the blocks in order to add them to a script.

0 Likes
Accepted solutions (1)
1,026 Views
22 Replies
Replies (22)
Message 2 of 23

imadHabash
Mentor
Mentor

Hi,

You can use QSELECT command or SELECTSIMILAR (SEttings) command for selecting by name then you can explode them.

 

 

Imad Habash

EESignature

0 Likes
Message 3 of 23

Shilpa_Dhawan
Participant
Participant

But that also uses mouse clicks.

0 Likes
Message 4 of 23

imadHabash
Mentor
Mentor

Those two commands will search to find all blocks by name.

Imad Habash

EESignature

0 Likes
Message 5 of 23

cadffm
Consultant
Consultant

Hi,

 

For non dynamic Blocks, use SSX

 

For dynBlocks, you need a 3rd party tool,

Sebastian

0 Likes
Message 6 of 23

Shilpa_Dhawan
Participant
Participant

Lets say the Block name is 'ABC' 

 

Can you tell me precisely what needs to be done, please? 

I have used both Qselect and SelectSimilar but never together and never without using my mouse for selection. SO i have no idea what to type here. 

 

Thanks.

0 Likes
Message 7 of 23

imadHabash
Mentor
Mentor

As much as i understand the issue .... Click on below image

 

qseexp.gif

Imad Habash

EESignature

0 Likes
Message 8 of 23

Shilpa_Dhawan
Participant
Participant

HAHA, thank you for the graphics. 

But my problem is that - i cannot / DONT WANT to use mouse clicks to select 'names' under Properties. You used your mouse. I cannot add mouse clicks in my script. 

 

I want an option like this ideally - 

Explode Select Block or [Name]

 

 

0 Likes
Message 9 of 23

Moshe-A
Mentor
Mentor

@Shilpa_Dhawan ,

 

the comparison to laydel is not totally right. laydel erase everything on that layer and do layer purge.

on case of block,  there is possibility it has multiple references, do you want to explode them all? than purge it?

 

Moshe

 

0 Likes
Message 10 of 23

Shilpa_Dhawan
Participant
Participant

I absolutely understand that Laydel is totally different. 

I just wanted to specify what option i wanted. 

 

And no, the blocks i want to explode do not have multiple reference. There is only 1 'ABC' block that i want to explode.

 

-s

0 Likes
Message 11 of 23

Moshe-A
Mentor
Mentor

But block can have a long name to key don't you think picking it with the mouse is more simple?

0 Likes
Message 12 of 23

Shilpa_Dhawan
Participant
Participant

Its not what i want, its what i need to do in order to write a script.

0 Likes
Message 13 of 23

Moshe-A
Mentor
Mentor

you have an autolisp program but you do not know how to catch block by name? then show us what you already have.

 

0 Likes
Message 14 of 23

Moshe-A
Mentor
Mentor

@Shilpa_Dhawan ,

 

the following call select all abc block references in model space without any pause and return selection set (type PICKSET)

does that help?

 

Moshe

 

 

(setq ss (ssget "_x" '((0 . "insert") (2 . "abc") (410 . "Model")))

 

0 Likes
Message 15 of 23

Shilpa_Dhawan
Participant
Participant

I do not have a lisp, i'm writing a lowly script like a normy. I'm a beginner at this. 

0 Likes
Message 16 of 23

Moshe-A
Mentor
Mentor

then share us with all your idea cause having only a command to explode block by name is not logic.

 

0 Likes
Message 17 of 23

pendean
Community Legend
Community Legend

@Shilpa_Dhawan That's the problem around here sometimes, folks are skimming your post for key words and replying to that one instead of trying to help.

 

You want...

1) a variation of EXPLODE command

2) that presents a dialog box with a list of all the block names in your DWG file

3) for you to select one of more from that list

4) then click OK to explode each.

pendean_1-1742308090299.png

 

Yes?

 

0 Likes
Message 18 of 23

Shilpa_Dhawan
Participant
Participant

I cant. its company work product. I cant share. 

But i can tell you that - 

i wrote a script to change the layers inside a block, managed that with bedit, simple, so far. Now i want to explode it. So that when its exploded the contents are of that final layer. Everythings is good except the explosion bit. 

 

 

0 Likes
Message 19 of 23

cadffm
Consultant
Consultant

You got an answer, but i miss your reply..

You can use ssx or the line of lisp - for non dynamic Blocks

 

If there can be more than one reference you need a detail more to explode your blockreferences, for for one (non dynamic) blockref only - you have two valid answeres.

 

Run ssx or the ssget line first, then

run explode for object selection use "P" for Previous.

 

 

Sebastian

0 Likes
Message 20 of 23

cadffm
Consultant
Consultant
Accepted solution

(if (setq ss (ssget "_X" (list'(0 . "INSERT")'(2 . "ABC")(cons 410 (getvar 'CTAB))))) ; Sample for selection inserts only
    (foreach i (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))(command "_.EXPLODE" i))
)

 

Try it (directly in your commandline or in your .scr file)

Sebastian

0 Likes