GetMeshes after modifiers like rounded edges or displacement?

@dale @nathanletwory I wonder if there is any possibility to get render meshes after modifiers cause with this line of code i get only ‘base mesh’ without modifiers.


@pascal i marked Dale and Nathan but i know some of you have holidays now so would you mind tag someone who can check this in a reasonable time?


Maybe this will point you in the right direction where to look:


Hi @Willem! Well i had hope it would work but i see that there’s huge difference between v5 and v6 rhinocommon render namespace and i suppose modifiers are only accessible on newest rhinocommon. However it is somehow weird cause i know softening and displacements were picked by render plugins on v5 - but those plugs were written in c++ so maybe thats the reason… Could someone confirm this?

Hi @D-W,

Use Rhino.GetRenderMeshes.

– Dale

Hi @dale are you sure? I tried this but i still got meshes without modiffiers perhaps im typing sth wrong? To be clear i get meshes without softening and displacement on both V5 and V6.

@dale Here is code which i have:

        var renderMeshes = Rhino.DocObjects.RhinoObject.GetRenderMeshes(pickedObjects, true, true);

        foreach (var renderMesh in renderMeshes)
                Mesh[] meshParts = renderMesh.Object().GetMeshes(MeshType.Render);

                foreach (var mesh in meshParts)

Sigh…I see that.

– Dale

Thank you @dale :slight_smile: I wonder now how i should handle this in v5 but reflection here won’t be necessary when in v6 it will be with modifiers it will just load as it should. Am i right?

@D-W As a temporary (very temporary) workaround, while we figure out why the expected method doen’t work properly, you can try
This is dependent on the RDK, so only Rhino 5 and Rhino 6 for Windows. Also in Rhino 6, it has been marked Obsolete, so it shouldn’t be considered a long term solution. I’ve used this successfully to extract the ‘render’ meshes from objects with modifiers.

@fraguada this should suit my needs for now but would you mind to show example of usage ? I tried but i always get null with:

Mesh[] meshParts = pickedObject.GetRenderPrimitiveList(new Rhino.DocObjects.ViewportInfo(Rhino.RhinoDoc.ActiveDoc.Views.ActiveView.ActiveViewport), false).ToMeshArray();

Hi @D-W,

Here is a sample in Python:

import Rhino
import rhinoscriptsyntax as rs
import scriptcontext as sc

obj_id = rs.GetObject("Select object")
obj = rs.coercerhinoobject(obj_id)
vpi = Rhino.DocObjects.ViewportInfo(sc.doc.Views.ActiveView.MainViewport)
primatives = obj.GetRenderPrimitiveList(vpi, False)
if primatives:
    meshes = primatives.ToMeshArray()
    for m in meshes:

– Dale

Hi @dale, thanks but i still get nothing ? I’m picking surface with displacement and i method returns null all the time.

In Rhinocommon i need to construct new viewport info object cause DocObjects.ViewportInfo isn’t static method but theres no difference if i call
.ActiveView.ActiveViewport or ActiveDoc.Views.ActiveView.MainViewport

Would you mind trying this in rhinocommon ? I hope it is just my fault here - i want to append those meshes later but theres nothing to append cause instead of Mesh[] i get always null from this method.

Hmm weird sometimes it get those meshes sometimes not… not sure why yet but one thing here is for sure not the way it should - bounding box also don’t get box from proper mesh with modifier but only sized like the original geometry. :wink:

Yep the way around is to get bbox from mesh created by GetRenderPrimitiveList however still not sure here why it is sometimes null - should i earlier create meshes for those objects or they are calculated inside?

Oh now i see it works only for nurbs not meshes when rhino object is extracted render mesh for eg. it will return null always.

HI @dale,

This code works in Rhino 6 with the attached file.

protected override Result RunCommand(RhinoDoc doc, RunMode mode)
  var go = new GetObject();
  go.SetCommandPrompt("Select object");
  go.GeometryFilter = ObjectType.Surface | ObjectType.PolysrfFilter;
  go.SubObjectSelect = false;
  if (go.CommandResult() != Result.Success)
    return go.CommandResult();

  var rh_object = go.Object(0).Object();
  if (null == rh_object)
    return Result.Failure;

  var view = doc.Views.ActiveView;
  if (null == view)
    return Result.Failure;

  var viewport_info = new ViewportInfo(view.ActiveViewport);
  var display_pipeline_attributes = view.DisplayPipeline.DisplayPipelineAttributes;
  // Uncomment if in Rhino 5
  // var primitive_list = rh_object.GetRenderPrimitiveList(viewport_info, false);
  var primitive_list = rh_object.GetRenderPrimitiveList(viewport_info, display_pipeline_attributes);
  if (null != primitive_list)
    var meshes = primitive_list.ToMeshArray();
    foreach (var mesh in meshes)

  return Result.Success;

test.3dm (71.7 KB)

– Dale

Actually commented piece of code works good in v6 :wink:

@dale @fraguada Unfortunately no matter what on a flat surface (Command: _Plane 0 -> 100-> 100) without modifiers i get always null…

That makes sense. If a surface or polysurface has no modifiers applied, then the rh_object.GetRenderPrimitiveList would be null. I thought you were trying to get the mesh of an object that had modifiers applied to it?

@fraguada yes sure but i never know if user will take object with or without it so i just wrote fallback to standard getMeshes if GetRenderPrimitiveList is null. btw. is there any handler (event) fired up when such things are changing? It would be great if i could know later if picked object has changed to update properly viewport to that.

Hi @D-W, you can find out from the object description. Displacement, ShutLining, EdgeSoftening leave their trails (PlugIn-Name, description, UserData ID).


@clement i thought rather about event that notifies that object has changed at all no matter what it is like position rotation scale modifier - hmm or rather that geometry has changed cause i don’t need objects name for eg. :smiley: I found somewhere that i should use serial number of object but I’m not sure how should i incorporate this into my code.

@dale @fraguada Guys why this has been moved to v7?

I don’t know still how to proceed with this even if i force:

                var vp = new Rhino.Display.RhinoViewport();
                vp.DisplayMode.ShadedPipelineRequired = true;
                var vpi = new ViewportInfo(vp);
                obj.CreateMeshes(MeshType.Render, obj.GetRenderMeshParameters(), false);
                var primitiveList = obj.GetRenderPrimitiveList(vpi, false);

it won’t get displacement even if it is receiving custom mesh itself but all z values are 0.

I’m just trying exactly do what ExtractRenderMesh command do - at least i can go nasty calling indeed comand from code pick the mesh and delete it but thats not the way how it should be done.

The most annoying thing is that it sometimes work and sometimes not…