Hide menu
cadex::ModelCheck_BRepChecker Class Reference

Provides an interface to perform various checks to BRep shape. More...

Classes

class  Options
 Holds options for checker tools. More...
 
struct  Tool
 Tools flags. More...
 

Public Types

typedef Options OptionsType
 
typedef cadex::internal::cadex_vector< std::shared_ptr< ModelCheck_BaseProblem > >::type ProblemsContainerType
 Type of container for problems.
 
typedef cadex::internal::cadex_vector< TopoDS_Shape >::type ShapesContainerType
 Type of container for shapes.
 
typedef std::pair< TopoDS_Shape, std::shared_ptr< ModelCheck_BaseProblem > > ShapeWithProblemType
 Type of pair: shape and it's problem.
 
typedef cadex::internal::cadex_multimap< ModelCheck_ProblemType, ShapeWithProblemType >::type ProbTypeShapesMapType
 Type of map, where key is a type of problem and value is a list of all shapes with such problem.
 
typedef std::shared_ptr< internal::ModelCheck_BRepCheckerImpl > ImplType
 

Public Member Functions

 ModelCheck_BRepChecker ()
 Constructor.
 
 ModelCheck_BRepChecker (const OptionsType &theOptions)
 Constructor.
 
OptionsTypeSetOptions ()
 Returns an internal Options object.
 
void SetOptions (const OptionsType &theOptions)
 Sets an Options object.
 
const OptionsTypeOptions () const
 Returns an internal Options object.
 
bool Check (const TopoDS_Shape &theShape)
 Performs check on the given shape. More...
 
bool HasProblems () const
 Returns true if last checked shape has problems and false otherwise.
 
ShapesContainerType ProblematicShapes () const
 Returns all subshapes which has problems.
 
const ProblemsContainerTypeProblems (const TopoDS_Shape &theShape) const
 Returns problems of the given subshape.
 
const ProbTypeShapesMapTypeProblems (ModelCheck_ErrorLevel theLevel) const
 Returns problems of the given level. More...
 
size_t NumberOfProblems (const TopoDS_Shape &theShape) const
 Returns number of problems for the given subshape.
 
size_t NumberOfProblems (ModelCheck_ErrorLevel theLevel) const
 Returns number of problems for the given level.
 
const TopoDS_Shape & Shape () const
 Returns the last checked shape.
 
size_t FindID (const TopoDS_Shape &theShape) const
 Returns the ID of subshape.
 
const TopoDS_Shape & FindShape (size_t theID) const
 Returns the shape with given ID.
 
const Base_ProgressStatusProgressStatus () const
 Returns progress status.
 
Base_ProgressStatusProgressStatus ()
 Returns progress status.
 
const ImplType & Impl () const
 

Protected Attributes

ImplType myImpl
 

Detailed Description

Provides an interface to perform various checks to BRep shape.

Usage example:

typedef ModelCheck_BRepChecker::Tool Tool;
aChecker.SetOptions()
.Tools (Tool::Intersection | Tool::Tolerance) // select tools
.ToleranceControlPoints (11) // tune
.UseSameParam (true); // options
TopoDS_Shape aShape; // some real shape
aChecker.Check (aShape);
// Go through all shapes with problems.
ModelCheck_BRepChecker::ShapesContainerType aProblematicShapes = aChecker.ProblematicShapes();
for (auto it = aProblematicShapes.cbegin(), end = aProblematicShapes.cend(); it != end; ++it) {
const TopoDS_Shape& aShape = *it;
const ModelCheck_BRepChecker::ProblemsContainerType& aProblems = aChecker.Problems (aShape);
for (auto it2 = aProblems.cbegin(), end2 = aProblems.cend(); it2 != end2; ++it2) {
const std::shared_ptr <ModelCheck_BaseProblem>& aProblem = *it2;
// Inspect problem. Consider using ModelCheck_ProblemVisitor.
}
}
// Generate an .xml report.
ModelCheck_XmlReportGenerator aGen ("D:/report.xml");
aGen.Generate (aChecker);
aGen.Dump();
Warning
Heterogeneous compounds (the ones which consists of shapes of different types) are not supported.
Examples
modeling/assembly/main.cxx.

Member Function Documentation

◆ Check()

bool cadex::ModelCheck_BRepChecker::Check ( const TopoDS_Shape &  theShape)

Performs check on the given shape.

One checker can be safely applied to a set of shapes (e.g. in loop). The options will remain same and all internal data will be reinitialized to work with new shape.

Examples
modeling/assembly/main.cxx.

◆ Problems()

const ModelCheck_BRepChecker::ProbTypeShapesMapType & cadex::ModelCheck_BRepChecker::Problems ( ModelCheck_ErrorLevel  theLevel) const

Returns problems of the given level.

This is an another approach to get all collected problems from checker. A simple example on how to use this method:

aChecker.Problems (ModelCheck_EL_Warning2); // all problems of Warning2 level
auto it = aProblemsByLevel.begin();
auto end = aProblemsByLevel.end();
while (it != end) { // Iterate the groups of shapes with same problem type.
ModelCheck_ErrorCode aProblemType = it->first;
auto aLastIter = aProblemsByLevel.upper_bound (aProblemType);
while (it != aLastIter) { // Iterate the pairs of shapes with their problems.
const TopoDS_Shape& aShape = it->second.first;
const std::shared_ptr <ModelCheck_BaseProblem>& aProblem = it->second.second;
// Inspect the shape and problem. Consider using ModelCheck_ProblemVisitor.
++it;
}
}
Definition: ModelCheck_BRepChecker.hxx:54
cadex::internal::cadex_multimap< ModelCheck_ProblemType, ShapeWithProblemType >::type ProbTypeShapesMapType
Type of map, where key is a type of problem and value is a list of all shapes with such problem.
Definition: ModelCheck_BRepChecker.hxx:142
ModelCheck_BRepChecker()
Constructor.
Definition: ModelCheck_BRepChecker.cxx:919
cadex::internal::cadex_vector< std::shared_ptr< ModelCheck_BaseProblem > >::type ProblemsContainerType
Type of container for problems.
Definition: ModelCheck_BRepChecker.hxx:138
Definition: ModelCheck_BRepChecker.hxx:51
cadex::internal::cadex_vector< TopoDS_Shape >::type ShapesContainerType
Type of container for shapes.
Definition: ModelCheck_BRepChecker.hxx:139