CAD Exchanger SDK
cadex::ModelAlgo_BRepMesher Class Reference

Computes a polygonal representation from a B-Rep one. More...

Public Types

typedef ModelAlgo_BRepMesherParameters ParametersType
 Defines a mesher parameters type.
 

Public Member Functions

 ModelAlgo_BRepMesher ()
 Constructor. More...
 
 ModelAlgo_BRepMesher (const ModelAlgo_BRepMesherParameters &theParameters)
 Constructor. More...
 
const ModelAlgo_BRepMesherParametersParameters () const
 Returns parameters.
 
ModelAlgo_BRepMesherParametersParameters ()
 Returns parameters.
 
void Compute (const ModelData_Model &theModel, bool theEnforceAddition=false) const
 Computes polygonal representations for all parts in the model. More...
 
void Compute (const ModelData_SceneGraphElement &theElement, bool theEnforceAddition=false) const
 Computes polygonal representations for all parts under the graph element. More...
 
ModelData_PolyRepresentation Compute (const ModelData_BRepRepresentation &theBRep, bool theComputeImmediately=true) const
 Computes polygonal representation for a B-Rep representation. More...
 
ModelData_PolyShapeList Compute (const ModelData_Body &theBody) const
 Computes polygonal representation for a B-Rep body. More...
 
ModelData_PolyShapeList Compute (const ModelData_Body &theBody, const ModelData_BRepRepresentation &theContext) const
 Computes polygonal representation for a B-Rep body. More...
 
ModelData_PolyShapeList Compute (const ModelData_Body &theBody, std::shared_ptr< Mesh_SMDS > &theMeshDS) const
 Computes polygonal representation for a B-Rep body. More...
 
ModelData_PolyShapeList Compute (const ModelData_Body &theBody, const ModelData_BRepRepresentation &theContext, std::shared_ptr< Mesh_SMDS > &theMeshDS) const
 Computes polygonal representation for a B-Rep body. More...
 
Base_ProgressStatusProgressStatus () const
 Returns a progress status.
 
const std::shared_ptr< internal::ModelAlgo_BRepMesherImpl > & Impl () const
 Returns an implementation object.
 

Protected Attributes

std::shared_ptr< internal::ModelAlgo_BRepMesherImpl > myImpl
 Internal implementation object.
 

Detailed Description

Computes a polygonal representation from a B-Rep one.

A mesher can operate on an entire model, a subtree of a scene graph element, or a particular B-Rep body.

The mesher can generate either a visualization or a computational mesh depending on parameters specified in the ModelAlgo_BRepMesherParameters object set with the Parameters() method. By default, only a visualization mesh is generated.

The following examples demonstrate typical scenarios of using a mesher.

Example 1 - generation of polygonal representations using the visualization mesher for all the parts with B-Rep representation which do not have polygonal representation:

ModelData_Model aModel = ...;
aMesher.Compute (aModel);

Example 2 - generation of a computational mesh for a particular body:

MeshAlgo_NetgenFactory aFactory;
ModelAlgo_BRepMesherParameters aParam;
aParam.ComputationalMeshAlgo() = aFactory;
ModelData_Part aPart = ...;
ModelData_BRepRepresentation aBRep = aPart.BRepRepresentation();
if (aBRep) {
const ModelData_BodyList& aList = aBRep.Get();
for (size_t i = 0; i < aList.Size(); ++i) {
const ModelData_Body& aBody = aList[i];
ModelAlgo_BRepMesher aMesher (aParam);
ModelData_PolyShapeList aPolyList = aMesher.Compute (aBody);
//explore aPolyList...
}
}
See also
The B-Rep mesher, Visualization mesher, Computational meshers.
Examples:
meshing/main.cxx, modelexplorer/main.cxx, and progressindicator/main.cxx.

Constructor & Destructor Documentation

◆ ModelAlgo_BRepMesher() [1/2]

cadex::ModelAlgo_BRepMesher::ModelAlgo_BRepMesher ( )

Constructor.

Creates a visualization mesher with default parameters.

See also
ModelAlgo_BRepMesherParameters.

◆ ModelAlgo_BRepMesher() [2/2]

cadex::ModelAlgo_BRepMesher::ModelAlgo_BRepMesher ( const ModelAlgo_BRepMesherParameters theParameters)

Constructor.

Creates a mesher with specified parameters.

See also
Parameters().

Member Function Documentation

◆ Compute() [1/7]

void cadex::ModelAlgo_BRepMesher::Compute ( const ModelData_Model theModel,
bool  theEnforceAddition = false 
) const

Computes polygonal representations for all parts in the model.

If a part has a B-Rep representation but does not have a polygonal one or if theEnforceAddition is true then the computed polygonal representation will be added to the part (via ModelData_BRepTriangulationProvider).

If theEnforceAddition is false and the part already has a polygonal representation then the part will be skipped.

Examples:
meshing/main.cxx, and progressindicator/main.cxx.

◆ Compute() [2/7]

void cadex::ModelAlgo_BRepMesher::Compute ( const ModelData_SceneGraphElement theElement,
bool  theEnforceAddition = false 
) const

Computes polygonal representations for all parts under the graph element.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

If a part has a B-Rep representation but does not have a polygonal one or if theEnforceAddition is true then the computed polygonal representation will be added to the part (via ModelData_BRepTriangulationProvider).

If theEnforceAddition is false and the part already has a polygonal representation then the part will be skipped.

◆ Compute() [3/7]

ModelData_PolyRepresentation cadex::ModelAlgo_BRepMesher::Compute ( const ModelData_BRepRepresentation theBRep,
bool  theComputeImmediately = true 
) const

Computes polygonal representation for a B-Rep representation.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Returns an object of ModelData_PolyRepresentation created with theBRep, Parameters() and theComputeImmediately. The method provided only for convenience.

See also
ModelData_PolyRepresentation constructor.

◆ Compute() [4/7]

ModelData_PolyShapeList cadex::ModelAlgo_BRepMesher::Compute ( const ModelData_Body theBody) const

Computes polygonal representation for a B-Rep body.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Returns a created list of vertex set.

Unlike the overloaded Compute() accepting ModelData_BRepRepresentation context this one only generates mesh geometry without colors and other attributes.

◆ Compute() [5/7]

ModelData_PolyShapeList cadex::ModelAlgo_BRepMesher::Compute ( const ModelData_Body theBody,
const ModelData_BRepRepresentation theContext 
) const

Computes polygonal representation for a B-Rep body.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

theContext specifies a B-Rep representation the body belongs to. This context information can be used to generate color and other attribute information registered in the context.

Returns a created list of vertex set.

◆ Compute() [6/7]

ModelData_PolyShapeList cadex::ModelAlgo_BRepMesher::Compute ( const ModelData_Body theBody,
std::shared_ptr< Mesh_SMDS > &  theMeshDS 
) const

Computes polygonal representation for a B-Rep body.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

theContext specifies a B-Rep representation the body belongs to. This context information can be used to generate color and other attribute information registered in the context.

This method should only be used when using a computational mesher and when the opaque object theMeshDS is used to further access Netgen-specific extensions.

Returns a created list of vertex set.

◆ Compute() [7/7]

ModelData_PolyShapeList cadex::ModelAlgo_BRepMesher::Compute ( const ModelData_Body theBody,
const ModelData_BRepRepresentation theContext,
std::shared_ptr< Mesh_SMDS > &  theMeshDS 
) const

Computes polygonal representation for a B-Rep body.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

This method should only be used when using a computational mesher and when the opaque object theMeshDS is used to further access Netgen-specific extensions.

theContext specifies a B-Rep representation the body belongs to. This context information can be used to generate color and other attribute information registered in the context.

Returns a created list of vertex set.