I’m importing blocks from Rhino files and want to convert the geometry inside the nested components to groups. I’ve been looking at various topics in this forum and using the Ruby Console I was able to create a group with the instances of the parent component. My new group is not exactly at the same place like the original geometry and contains three components and I can’t figure out how to explode the components before the group is created. Ideally the imported component is being deleted after the new group is created.
Deleting the newly created group crashes Sketchup.
This file is imported into Sketchup. In Rhino it contains three blocks. When imported in Sketchup, the result is a component with three components.
hex.skp (7.6 KB)
Edit: There are two scenarios to be exact. One would be a file with blocks, the other would be a file with a few surfaces. The file with a number of surfaces is also imported as a component, however not nested. In that case the script would only have to explode the component and create a group for every surface.
Here’s my code so far:
model=Sketchup.active_model ent=model.active_entities cdef=model.definitions inst=cdef.instances group=model.entities.add_group(inst)
I have been using Python every now and then in Rhino / Grasshopper but I have no experience in Ruby scripting so I’d appreciate someone helping me.