Automatic Shell Recognition Mode by Polygon Mesh
The C3D B-Shaper automatic conversion interface is represented by two functions: ConvertMeshToShell() and ConvertCollectionToShell().
The method
MbResultType ConvertMeshToShell( MbMesh & mesh,
MbFaceShell *& shell,
const MbMeshProcessorValues & params = MbMeshProcessorValues() );
performs shell creation in the boundary representation (B-Rep), corresponding to the model specified by the polygonal mesh. The module algorithm automatically recognizes and reconstructs the faces corresponding to elementary surfaces (plane, cylinder, cone, sphere, torus), revolution surfaces or NURBS surfaces.
The method input parameters are:
mesh – polygonal mesh of the model;
params – conversion settings.
The output parameter of the method is shell – the constructed shell.
If the algorithm works successfully, the method returns rt_Success, otherwise the method returns an error code from the MbResultType enumeration.
The method is declared in the action_b_shaper.h file.
The conversion settings include the recognition tolerance value, i.e. the maximum allowable distance from the vertices of the polygonal mesh within the boundaries of this segment to the recognized surface. This tolerance can be absolute or relative: when using relative tolerance, the deviation of the faces of the body from the mesh is checked with respect to the size of the model. Also, the user has the option of switching recognition modes, which allows controlling the types of surfaces during reconstruction. These parameters are in the fields of the MbMeshProcessorValues class, which contains:
useRelativeTolerance – relative tolerance flag;
tolerance – recognition tolerance;
surfReconstructMode – surface recognition mode, from the enumeration:
srm_All – build all surfaces;
srm_NoGrids – do not build surfaces based on triangulation;
srm_CanonicOnly – build only elementary surfaces;
srm_Default – default mode.
The method
MbResultType ConvertCollectionToShell( MbCollection & collection,
MbFaceShel *& shell,
const MbMeshProcessorValues & params = MbMeshProcessorValues() );
performs shell creation in the boundary representation (B-Rep) corresponding to the collection of elements containing the polygonal mesh. The module algorithm automatically recognizes and reconstructs the faces corresponding to elementary surfaces (plane, cylinder, cone, sphere, torus).
The method input parameters are:
collection – collection of elements containing the polygonal mesh;
params – conversion settings.
The output parameter of the method is shell – the constructed shell.
If the algorithm works successfully, the method returns rt_Success, otherwise the method returns an error code from the MbResultType enumeration.
The method is declared in the action_b_shaper.h file.
The test application builds the shell in the boundary representation using the menu command «Create→Solid→Based on a mesh→Convert to the solid with surface recognition».