Cross-posting from a thread originally in Rhino for Windows:
Could someone show me how I would write a script to select the “densest” meshes:
- Start with nothing selected
- Loop over all visible meshes in the scene
- For each mesh, compute its bounding-box volume (or perhaps some other parameter like surface area), and the number of triangles/faces/vertices it contains
- For the current mesh compute the “density” as the ratio of the number of tris/faces/verts to the volume/surface are.
- If that density ratio is above a certain given parameter, select the mesh, otherwise don’t select it.
- At the end, report the number of selected meshes.
So, this would operate a lot like the Select->Select Small Objects tool (which is great, by the way). It would be an extension/generalization of that sort of functionality that I could customize to my needs. Generally speaking, the meshes that benefit most from ReduceMesh tend to be the smallest and/or have the most tris/faces/verts to begin with.
I don’t know exactly how scripting works in Rhino, but I would prefer if this ran without the need for any add-on plugins (like grasshopper), which would have to be purchased separately. Python would be perfect.
Edit: I now know that Grasshopper comes with Rhino, so that would be fine too.