What's the fastest way to get all Meshes?

Hi,
I need the meshes of all objects (hidden and locked too) to run an analysis, and I’m wondering what the fastest way to get them all is.

I tried RhinoObject.GetRenderMeshes(IEnumerable<RhinoObject>, etc, etc) but it only returns meshes which are visible.

I was hoping for RhinoObject.MeshObjects() (any of the 3 versions), but it’s really, really slow - it writes a line to the console for each object meshed. This turns what was a 0.5second operation into an 80+second operation for 21000 individual objects (or 20s for 14000 objects). Can this output be disabled somehow?

Is there any other way to get the meshes quickly aside from iterating through each of the RhinoObjects passed to those previous methods?

What’s the best way to get user input MeshingParameters if I can’t use RhinoObject.MeshObjects? I’m in Rhino6, so sadly the RhinoGet.GetMeshParameters isn’t available to me.

Thanks everyone.

Hi @Daniel_Beckmann,

Sorry, no.

This way doesn’t display the message:

protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
  var filter = ObjectType.Mesh 
    | ObjectType.Brep 
    | ObjectType.Extrusion 
    | ObjectType.SubD;

  var settings = new ObjectEnumeratorSettings
  {
    NormalObjects = true,
    LockedObjects = true,
    HiddenObjects = true,
    ActiveObjects = true,
    ReferenceObjects = true,
    ObjectTypeFilter = filter
  };

  var rh_objects = doc.Objects.FindByFilter(settings);
  if (null == rh_objects || 0 == rh_objects.Length)
    return Result.Nothing;

  foreach (var rh_obj in rh_objects)
  {
    var obj_mesh = new Mesh();
    var meshes = rh_obj.GetMeshes(MeshType.Render);
    if (meshes.Length > 0)
    {
      foreach (var m in meshes)
        obj_mesh.Append(m);
    }
    else
    {
      var mesh_params = rh_obj.GetRenderMeshParameters();
      if (rh_obj.CreateMeshes(MeshType.Render, mesh_params, false) > 0)
      {
        meshes = rh_obj.GetMeshes(Rhino.Geometry.MeshType.Render);
        if (meshes.Length > 0)
        {
          foreach (var m in meshes)
            obj_mesh.Append(m);
        }
      }
    }

    if (obj_mesh.IsValid)
      doc.Objects.AddMesh(obj_mesh);
  }

  doc.Views.Redraw();

  return Result.Success;
}

– Dale

Thanks @dale for confirming.

2 posts were split to a new topic: GetMeshes question