Sel large meshes?

Is there any way to ask Rhino to select meshes over a certain poly-count?

I’m dealing with some bloated maya files and it would be great to select meshes over a certain size so I can run ReduceMesh on them to bring them down.

You can use this script:

# Select meshes with minimum polygon count
# by Nathan 'jesterKing' Letwory

import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino
import clr

def SelectMeshesByMinimumPolygonCount():
  polygoncount_ref = clr.Reference[int]()
  polygoncount_ref.Value = 1000
  rc = Rhino.Input.RhinoGet.GetInteger("Minimum polygon count", True, polygoncount_ref)
  if rc != Rhino.Commands.Result.Success: return 1
  selected_count = 0

  for o in sc.doc.Objects:
    if isinstance(o, Rhino.DocObjects.MeshObject):
      if o.Geometry.Faces.Count >= polygoncount_ref.Value and not o.IsSelected(False):
        selected_count += 1
  mesh = "mesh" if selected_count==1 else "meshes"
  print selected_count, mesh, "added to selection."
  return 0

if __name__ == "__main__":
  SelectMeshesByMinimumPolygonCount() (880 Bytes)

1 Like

Hi, I think a suitable way is to import the meshes to Grasshopper and dispatch them :slight_smile:

That script is INSANE!
Thank you so much! You’ve made my week!!!

Feel free to adapt the script to automatically do the mesh reducing as you see fit (: