Deprecated GetRenderMeshes method in v8

Hi,

In the Rhinocommon doc, it appears that the Rhino.DocObjects.RhinoObject.GetRenderMeshes method will be deprected in v8:

Which method should be used instead?

Thanks in advance for your feedback :slight_smile:

You should be able to use https://developer.rhino3d.com/api/rhinocommon/rhino.docobjects.rhinoobject/getmeshes

Hi @nathanletwory,

Thanks for your quick response.
OK, I’ll take a look to the GetMeshes method.

However, I have still a few questions:

  1. with the GetRenderMeshes method, there was the option to create the mesh in case it does not exist. I assume that with the proposed RhinoObject.GetMeshes, we will need to manually create the render mesh if it does not exist?
    What is the method to compute the render mesh?

  2. GetMeshes get a MeshType as parameter: what is the diference between the render mesh and the preview mesh?


    The ‘default mesh’ seems also not so clear to me.

  3. Is there a particular reason the GetRenderMeshes method get deprecated?

Thanks!

@andy will be able to explain better than I can.

I’m also very interested in this one here! Love the ability to automatically generate render meshes if they don’t exist.

There’s CreateMeshes for creating them: https://developer.rhino3d.com/api/rhinocommon/rhino.docobjects.rhinoobject/createmeshes

1 Like

Currently trying this code, but I get nothing out. The old GetRenderMeshes returns the meshes. Am I using the function wrongly?

private void RunScript(Guid ID, ref object msh)
    {
        Rhino.Geometry.MeshType meshType = Rhino.Geometry.MeshType.Render;
        Rhino.Geometry.MeshingParameters meshSetting = Rhino.Geometry.MeshingParameters.FastRenderMesh;
        Rhino.DocObjects.RhinoObject obj = Rhino.RhinoDoc.ActiveDoc.Objects.FindId(ID);

        if (obj != null)
        {
            Rhino.Geometry.Mesh[] meshes = obj.GetMeshes(meshType);
            if (meshes == null || meshes.Length == 0)
            {
                obj.CreateMeshes(meshType, meshSetting, false);
                meshes = obj.GetMeshes(meshType); 
            }

            msh = meshes;
        }
        else
        {
            msh = null;
        }
    }