Convert multiple blocks to groups

Hello,

I am using Rhino + Vray for archiviz. I often have to handle Rhino models that were exported from archicad.
The problem is: almost all archicad elements export as block definitions. It becomes very difficult to assign material to a color, I have to manually _explode and _group each block one by one, to be able to apply my materials according to the color of the objects.

Is there a script or a plug in that could convert all the block to groups?

I found this thread but I don’t know how to use it and it was made in 2010…

I also tried to import the model as IFC using geometrygym, but the results are not perfect and there are some errors with boolean differences between walls and roofs.

Thank you for your help, it would be a game changer for me!

Marie

1 Like

Hi Marie - - here is a very quick and dirty script that should get you what I think you want - nothing fancy here, nested blocks are not in nested groups, you don’t get to name the groups - all possible but… the easy way first.

CheapBlocksToGroups.py (507 Bytes)

To use the Python script use RunPythonScript, or a macro:

_-RunPythonScript "Full path to py file inside double-quotes"

-Pascal

Hello Pascal,

Thank you for your answer. I tried what you sent me but I think my initial request wasn’t so clear.
I would like to select all blocks in the file, and have them exploded and converted to groups individually.
Basically I don’t want to have block instances anymore in the scene, but groups instead.

What I currently do
I select one block instance
I explode it
I group it

And I repreat the process for all the blocks, one by one.

I am lookign for a script that would do that series of command for each block individually.

Marie

Hi Marie,

the script Pascal made does exactly that, if I look at it. What is the result you are getting?
If possible, send a sample file.

Hello Gijs,
I just open a new file and made three blocks out of three boxes. then I ran the script and selected my blocks instances, I pressed enter and skipped the “Press Enter to make a group with one object. Press Enter when done” by pressing enter.
I still have my three blocks by the end of the command.

I don’t want to have blocks anymore but only groups.

Thank you for looking into my request. I really appreciate.

Best,

Marie

Hi @Marie2 I tested this again, and the script works here as intended.

I created 3 boxes, made 3 blocks out of it. after running the script each block is one extrusion. If I block the 3 blocks into one block, after running the script, I get 1 group with 3 extrusions.

Hi @Marie2,

Do you mean that if you look at the properties for each item on screen it is described as a block and not as a group?

Or do you mean that you still see blocks in the Block Manager?

If the former, then please create a file with blocked objects, make a copy of the file and run Pascal’s script on it, then post the two files as ‘before’ and ‘after’.

If the latter then check the count for each block in the block manager and it should be zero because all block instances have been converted to groups. However, while Pascal’s script converts the instances, it doesn’t delete the underlying block geometry. That geometry is not on the drawing canvas (it’s tucked away in a hidden table) and shouldn’t be an issue.

Hello Jeremy,

It’s the former option. I still get three block instances
Here are the two files. before and after running the script

Is it because I don’t have the latest version of RHino? I am using 7RS18

3 boxes.3dm (70.6 KB)
file after running the script.3dm (71.6 KB)

Hi Marie,

I notice your Rhino is probably French rather than English so it may be simply that it isn’t finding the commands. Try this version instead, which caters for non-English commands:
CheapBlocksToGroups2.py (509 Bytes)

HTH
Jeremy

@jeremy5 Fantastic, it worked.

I did turn my preferences to english before running the script but apparently it wasn’t enough. Your new script works perfect now

Thank you to you three for your help @pascal @Gijs

1 Like

thanks @jeremy5 :slight_smile:

1 Like

If you ever need to run a script on a non-english Rhino then, if it calls a Rhino command, just preface the command name with an underscore (if you open your script in the python editor you can see the two places where I did that).

We perhaps took longer than we should have to see the issue, but that’s really your fault for being so fluent in English that we didn’t make the connection! :wink:

Regards
Jeremy

1 Like

Merci. It’s nice of you to say. I’ll try to squeeze in more french words in my texts next time. :slight_smile:

1 Like