Replace objects with BlockInstances

Hi all,

I received a file having bunch of same objects (groupped polysurfaces) copied several times with individual orientations. That increased file size to GB. I am able to select easily all these objects with SelVolume script. Is there any automatic way to convert these groupped objects to a specific blockinstance with target orientation?

Thank you advance

Hi @yigit What about something like this:

It’s not a python script - but I don’t think you can use those new ā€˜Rhino’ components like the Block Definition and Block Instance through the python script component? I had asked something similar in Using ModelBlockDefintion within Python Script? but didn’t receive any responses. I assume that means ā€œNoā€ ? Would be awesome if it was possible though.

@ed.p.may

example.gh (27.2 KB)

each group becomes a blockinstance ?
or each object, a single polysurface - inside a group becomes an instance of the same blockdefinition ?

or - the blockdefinition consists of a single polysurface of multiple ?

there is no automatic way to do it, but it can be scripted / programmed.
The amount of work depends wether a single case / file should be solved only once or a more general tool is needed.

what does the geometry offer to identify its orientation ?
you have a sample file with a few future-blocks ?
a screenshot of the overall GB-task ?

kind regards -tom

I am with Tom on this one. I expect determining orientation will be the most difficult part of the process. If a plane can be created for each set of objects, then replacing them with Block instances is not too terrible.

1 Like

Hi,

Here is the screenshot of the file. Yellow and Green (closed polysurface) are the same objects with different orientation. My aim is to convert these objects to BlockInstances. Example file is also attached.

Test.3dm (754.5 KB)

If your object us Brep:

Find for example largest-surface face, reparametrise it; at prm 0,0 find isocurves and construct tangents for u and v isocrve; and determine normal at same surface; crete plane by using these vectors (tangents and normal); do the same for all breps - construct such ā€œbrep-planeā€; orient brep from ā€œbrep-planeā€ to xy plane; compare breps; equal breps can be changes to one block instance; remap blocks back to ā€œbrep-planeā€ positions

Early exit conditions: only brep with the same brep face count and brep edged count will be compared…