I need a c++ sdk function to reduce mesh just like reducemesh command do,but I can’t find this funciton
in c++ sdk .

See rhinoSdkMeshUtilities.h

  RhinoReduceMesh reduces mesh polygon count.

  mesh                 - Triangular mesh to be reduced
  iDesiredPolygonCount - Target polygon count
  bAllowDistortion     - If true mesh appearance is not changed even if the target polygon count is not reached
  iAccuracy            - Integer from 1 to 10 telling how accurate reduction algorithm to use. Greater number gives
                         more accurate results.
  bNormalizeMeshSize   - If true mesh is fitted to an axis aligned unit cube until reduction is complete
  pProgressContext     - Null or a pointer to a CRhinoReduceMeshProgressContext object. Provides progress information to caller.
  pStrProblemOut       - Null or a pointer to an ON_wString object. Reports possible problems.
  pFaceTagArray        - Null or a pointer to an ON_SimpleArray<int> object with element count equal to mesh face count.
                         Each element is a user defined tag for the mesh face with the same index. Can be used to identify
                         mesh faces before and after calling RhinoReduceMesh.

  True if mesh is successfully reduced and false if mesh could not be reduced for some reason. If return value is false
  then pStrProblemOut may have information what went wrong.
bool RhinoReduceMesh(ON_Mesh & mesh,
                     int iDesiredPolygonCount,
                     bool bAllowDistortion = true,
                     int iAccuracy = 10,
                     bool bNormalizeMeshSize = true,
                     CRhinoReduceMeshProgressContext * pProgressContext = 0,
                     ON_wString * pStrProblemOut = 0,
                     ON_SimpleArray<int> * pFaceTagArray = 0);

thanks .
I have a mesh with 2000000 faces,and I need using RhinoReduceMesh function to reduce
the face to 20000.
but this will using long time
so I need get the progress just like rhino’s windows hints.
how can I get it using c++ sdk function?

Please look in rhinoSdkApp.h for functions with StatusBarProgressMeter in them.


I can really recommend this utility

to search header files for information. That is what I use all the time.

And, of course, you need to derive a class from CRhinoReduceMeshProgressContext and pass in a pointer to an object of that type to get the callbacks.

1 Like