@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.
myGeomerty.GetMeshes(MeshType.Render)
@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?
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 @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.
Thank you @dale 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 https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_DocObjects_RhinoObject_GetRenderPrimitiveList_1.htm
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.
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.
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.
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. I found somewhere that i should use serial number of object but I’m not sure how should i incorporate this into my code.
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…