I need a really fast mesh extraction and this seems not to be a suitable way for my needs even with the DefaultFastMeshParameters. I assume a mesh is created for rendering purpose for each object of the document but also the dp.drawbrep method for temporary objects in the conduit seems to be more than 10x faster (am I wrong?) than the mesh extraction above. I guess somewhere in the SDK library must be a faster way to get a mesh, even if coarser. Anybody has a hint?
When Rhino needs to draw a Brep, that are in the document, in some kind of shaded display, it just retrieves the render mesh that is cached on the Brep using ON_Brep::GetMesh.
If the Brep is newly added to the document, or it does not have a cached render mesh, then one is created as needed using ON_Brep::CreateMesh. This mesh is cached on the Brep for quick retrieval.
If you are creating Breps on the fly and want to draw them in a shaded way, then you really don’t have any choice but to create them using ON_Brep::CreateMesh.
The ON_Brep::GetMesh method totally helps. I have also noticed that for a temporary object I can get rendering mesh if I call before the CRhinoDisplayPipeline::DrawBrep in a conduit. This might be the workaround I needed because the two methods seem to be together faster than ON_Brep::CreateMesh method. Am I forgetting something which may cause a delay in this way?
Is there any way to get Brep render mesh from .NET OpenNURBS 6, similar to what you do in the example from c++? I can’t find any GetMesh method there.
If you are working from within a RhinoCommon plug-in and you have a Rhino Brep object, then you can use RhinoObject.GetMeshes.
If you just have a Brep, or you are using Rhino3dmIo, then you’ll need to iterate through the Brep’s faces and accumulate the meshes from each individual face using BrepFace.GetMesh.
also, is it possible to get a mesh from a brep that is coarser than the rendering mesh?
One way I see is to modify the mesh parameters when using the ON_Brep::CreateMesh, but I do not know if it is safe and if I would always get something satisfactory.
Furthermore, I am wondering if there are some factors that affect the size of the rendering mesh (e.g. zoom out or different units of measurement).
Thanks in advance,
ON_Brep::CreateMesh does not specifically create a render mesh (although you could use it for that purpose if you wanted). Rather, it is creating a mesh based on the input meshing parameters you provide. What effects the size of the resulting mesh is the parameters you provide as input.
I was thinking that maybe it is possible to change something in the viewport parameters (?) which could affect the chached mesh created with CRhinoDisplayPipeline::DrawShadedBrep.
Also, I would be gratefeul if you had a tip on how to get a coarse mesh without losing the control on the outcome (getting a really ugly mesh).