Explode block instances while keeping their original layers

I have a geometry imported from archicad. Thousands of block instances orginized by layers. After using Explode or ExplodeBlock cmd all the geometry moves to a current layer.
Obviously I can explode all the stuff layer by layer but I’m sure there should be a smarter way to do it.

When I import a file from AutoCAD, and use explode on the blocks they keep their respective layers. But I do notice that the layer in AutoCAD when it is a block, is different then the object layer when it is removed from that block reference. Perhaps the blocks are on separate layers, but as individual objects they were all on the same layer?
There is also a Explodeblock command as oppose to explode.
Not sure any of this information will be helpful.

Hi Max- this plug-in might help - give it a try, and let us know - Save, then drag and drop the rhp file onto Rhino to add

ExplodeBlocksToLayers

ExplodeBlocksToLayers.rhp (10.5 KB)

does that do anything useful?

-Pascal

Hi Pascal!
Not exactly. It creates a sub-layer for every single block instance. For example if I use ExplodelocksToLayers to explode my imported concert hall geometry I end up with more then a thousand sub-layers under the parent layer ‘SEATS’ then another hundred layers under ‘WALLS’ layer etc.

This plugin would be very useful if it had an option not to create sub-layers but simply put all exploded geometry on their parent block layer.

1 Like

Hi Max - so, only dig down once (or a user set number), so to speak, and not consider sorting nested blocks any further, is that correct?

-Pascal

Hi Pascal.

Thanks for your feedback
Ideally I would just want to have an option for Explode and ExplodeBlock commands OutputLayer=Input/Current. The same functionality as with Duplicate Edge.

As for digging down I personally need only one step because there’s no nested blocks coming from archicad.
Sorting nested blocks by sub-layers may be a reasonable idea but at the moment plug-in creates sub-layers for every piece of geometry not just for nested blocks.

1 Like

Yeah, this was created for sorting out STEP and SolidWorks files so they could be worked on more easily, not particularly for architectural models. Can you send me, via private message, a simple example with an incoming file and then the way you’d like it arranged when we’re all done? thanks,

@archimax Max, please have a try with this one -

ExplodeBlocksToLayers.rhp (13 KB)

I added an option to keep the layering simpler. I’m not sure what else I might have broken. Delete the old rhp, with Rhino closed, then save and drag/drop this one onto a new Rhino…

-Pascal

Hi Pascal!
Works fine, thank you.
The only minor bug I’ve noticed it doesn’t explode blocks with curves.

OK, I’ll check that…
@archimax, I made a couple of changes - unrelated though to your comment, I think - as far as I can see it works on blocks that are curves - if you find that is not the case, can you send me an example?

ExplodeBlocksToLayers.rhp (13 KB)

thanks,

-Pascal

Hi Pascal, thank you for the tool, also missed here.

-Micha

Yes, thanks Pascal!
I’ve used it a few times now over the past few days and the only thing that I miss from the one that I had many years ago is an automated randomization of layer colors… :stuck_out_tongue:

1 Like

Hi @pascal,

your ExplodeBlocksToLayers is a great tool, which I have recommended my customer. Thank you.

They used it very successfully, but now with big files 50 MBytes, the script doesn’t work anymore in Rhino 5 for Windows (64-Bit), PC has 16 GB RAM.

The script produces a runtime-error, see here:

What could the customer do?

Thanks

Michael
www.flexiCAD.com

Hi Michael - Strange… I don’t know… I’ll take a look at the script. I also have a Python version which I can send you (I think I made one) but I have to run out to a class right now - email me directly and I’ll see if I can help sort it out.

-Pascal

Hi Pascal,

is there also a script which works oppostite: that it makes a block from all objects in a layer, with the name of that layer?
so for example: there are five layers, 1, 2, 3 ,4 and 5. then you run the script and you get 5 blocks named 1, 2, 3, 4 and 5.
each block contains the objects from the same layer.

this will be very helpfull to work with models which are made in Rhino (which I do) and to get them organized in Solidworks. (which many of my clients work with)

looking forward for your reply,
Albert

1 Like

Hi Baasab,

You can do it with a simple grasshopper script (attached).
Elefront needs to be installed.MakeBlocksFromLayers_01.gh (11.0 KB)

Hi Archimax,

Thanks a lot! However I’m new to grasshopper.
I am this far:
[/uploads/default/original/3X/f/9/f91a08d7729e5ef71dfff29e1cb62c959c7f6bfe.jpg]
Correct me if I’m wrong, but I think I need to fill in the layers names in the yellow box? Is there a way to get them in in one go?

I hope you can help me a bit further with this.

groet,

Albert

[cid:image001.jpg@01D28785.22BEB790]
T. +31(0)6 20 505 290
F. +31(0)8 77 846 652
www.compromiss.nlhttp://www.compromiss.nl/

You can also try the following script:
LayersToBlocks.py (616 Bytes)

Gets all objects on each layer and creates a block, deletes the objects and inserts the block instance on same layer. Ignores locked or off layers. All block origins are world 0.

HTH, --Mitch

Hi Albert,

Yes you can get all layers at once by typing * in the yellow box. But this way you need to reconstruct the tree (structure you data) before creating the blocks. See a modified sript. MakeBlockFromAllLayers_01.gh (7.4 KB)

Please be aware that you need to remove all blocks before running this script again.
Otherwise you can recreate the definition with Human instead of Elefront (Human is another useful plugin you need to download from Food4rhino) and use “overwrite” option in human’s “define block” component.

Hi Archimax,

I am now this far:
[/uploads/default/original/3X/a/f/afb92685c2075de1f4708425be85ee2481d42896.jpg]
I imported Human as wel.
What do I need to do with the red box? The * is already in the yellow box, but there appears no layers in it.

groet,

Albert

[cid:image001.jpg@01D28785.22BEB790]
T. +31(0)6 20 505 290
F. +31(0)8 77 846 652
www.compromiss.nlhttp://www.compromiss.nl/

What does it say in the small baloon in upper right corner of the red component?
You can also try if it works in a new file with some basic geometry. Just to see if it works there.