I have this tree and there are thousands of leaves. Each leaf is a simple quad. If I create a block instance out of one them, is there a way to somehow select the others and replace them with block instances ?
Would this reduce the file size from 145Mb ? Is it worth it ?
Depending how many leaves there are, if the file size because of them is 145MB then probably a lot; I would guess even if you succeed with replacing them with blocks, Rhino will get a huge performance hit due to a number of individual objects (blocks)… (replacing identical meshes with block could be probably scripted but also depends how the mesh is built)
Is your goal reducing the file size or performance?
A few things to try:
join all the leaves into one mesh (if not done already - the file size could get a bit smaller)
after joning, try ReduceMesh on the leaves, sometimes even with 75% reduction you may not see much difference…
you can try to make the tree a block and externalize it (export to a separate file) and then insert as linked - this will get rid of the heavy tree geometry from the main file.
Yup. I think you are right.
Overall not worth the time and effort. I’ll either use a tree generator, or do the scene in Blender; use their particle system to grow the leaves procedurally.
For such cases I’d have the leaves all placed and textured, and when done I’d select all leaves (nothing else), use _ExtractRenderMesh, delete all original leaves, select all leave meshes and _Join them all into one disjoint mesh. There, only one object!
@nathanletwory Any way to select only these guys (leaves) but not all the twigs ? The leaves are simple quads, but I see they vary slightly in size and rotation. (If all tree is welded into one blob it goes down to 28Mb)
If I explode it yes, but then how do I select only leaves but not twigs ?
Would be nice if the original OBJ had the leaves in a separate group. It didn’t.
import scriptcontext as sc
import Rhino
Rhino.RhinoApp.RunScript("_SelNone", False)
meshobjects = [ob for ob in sc.doc.Objects if isinstance(ob, Rhino.DocObjects.MeshObject)]
for meshobject in meshobjects:
m = meshobject.Geometry
if m.Vertices.Count == 4:
meshobject.Select(True)