Version: 9.12.0
GEOMUtils Namespace Reference

Classes

struct  CompareShapes
 Sort shapes in the list by their coordinates. More...
 
class  Hatcher
 
struct  Range
 
class  Trsf2d
 
class  TrsfCurve2d
 
struct  ActionData
 Plugin action data. More...
 
struct  PluginData
 Plugin data. More...
 

Typedefs

typedef std::vector< std::string > NodeLinks
 
typedef std::map< std::string, NodeLinksLevelInfo
 
typedef std::vector< LevelInfoLevelsList
 
typedef std::map< std::string, std::pair< LevelsList, LevelsList > > TreeModel
 
typedef std::vector< RangeDistribution
 
typedef std::list< PluginDataPluginInfo
 Plugins information. More...
 

Enumerations

enum  ComparisonCondition { CC_GT , CC_GE , CC_LT , CC_LE }
 This enumeration represents comparison conditions. More...
 

Functions

Standard_EXPORT std::pair< double, double > ShapeToDouble (const TopoDS_Shape &theShape, bool isOldSorting=false)
 Compute numerical functor for the shape. More...
 
Standard_EXPORT gp_Ax3 GetPosition (const TopoDS_Shape &theShape)
 Get Local Coordinate System, corresponding to the given shape. More...
 
Standard_EXPORT gp_Vec GetVector (const TopoDS_Shape &theShape, Standard_Boolean doConsiderOrientation)
 Get vector, defined by the given edge. More...
 
Standard_EXPORT void SortShapes (TopTools_ListOfShape &SL, const Standard_Boolean isOldSorting=Standard_True)
 Sort shapes by their centers of mass, using formula X*999 + Y*99 + Z*0.9. More...
 
Standard_EXPORT TopoDS_Shape CompsolidToCompound (const TopoDS_Shape &theCompsolid)
 Convert TopoDS_COMPSOLID to TopoDS_COMPOUND. More...
 
Standard_EXPORT void AddSimpleShapes (const TopoDS_Shape &theShape, TopTools_ListOfShape &theList)
 Recursively extract all shapes from compounds and compsolids of the given shape into theList. More...
 
Standard_EXPORT bool CheckTriangulation (const TopoDS_Shape &theShape)
 Build a triangulation on theShape if it is absent. More...
 
Standard_EXPORT TopAbs_ShapeEnum GetTypeOfSimplePart (const TopoDS_Shape &theShape)
 Return type of shape for explode. In case of compound it will be a type of its first sub shape. More...
 
Standard_EXPORT TopoDS_Shape GetEdgeNearPoint (const TopoDS_Shape &theShape, const TopoDS_Vertex &thePoint)
 Find an edge of theShape, closest to thePoint. More...
 
Standard_EXPORT Standard_Boolean PreciseBoundingBox (const TopoDS_Shape &theShape, Bnd_Box &theBox)
 Compute precise bounding box of the shape based on the rough bounding box. More...
 
Standard_EXPORT Standard_Real GetMinDistanceSingular (const TopoDS_Shape &aSh1, const TopoDS_Shape &aSh2, gp_Pnt &Ptmp1, gp_Pnt &Ptmp2)
 Computes minumal distance between two shapes for singular cases (workaround for bugs 19899, 19908 and 19910 from Mantis). More...
 
Standard_EXPORT Standard_Real GetMinDistance (const TopoDS_Shape &theShape1, const TopoDS_Shape &theShape2, gp_Pnt &thePnt1, gp_Pnt &thePnt2)
 Computes minumal distance between two shapes. More...
 
Standard_EXPORT gp_Pnt ProjectPointOnFace (const gp_Pnt &thePoint, const TopoDS_Shape &theFace, double &theU, double &theV, const double theTol=1e-04)
 Computes normal projection of thePoint to theFace. More...
 
Standard_EXPORT gp_Pnt ConvertClickToPoint (int x, int y, Handle(V3d_View) theView)
 Returns the point clicked in 3D view. More...
 
Standard_EXPORT void ConvertTreeToString (const TreeModel &tree, std::string &dependencyStr)
 Convert dependency tree data to the string representation. More...
 
Standard_EXPORT void ConvertStringToTree (const std::string &dependencyStr, TreeModel &tree)
 Restore dependency tree data from the string representation. More...
 
Standard_EXPORT bool CheckShape (TopoDS_Shape &shape, bool checkGeometry=false)
 Check shape. More...
 
Standard_EXPORT bool CheckBOPArguments (const TopoDS_Shape &theShape)
 Check boolean and partition operations arguments. More...
 
Standard_EXPORT bool FixShapeTolerance (TopoDS_Shape &shape, TopAbs_ShapeEnum type, Standard_Real tolerance=Precision::Confusion(), bool checkGeometry=false)
 Limit shape tolerance to the given value. More...
 
Standard_EXPORT bool FixShapeTolerance (TopoDS_Shape &shape, Standard_Real tolerance=Precision::Confusion(), bool checkGeometry=false)
 Limit shape tolerance to the given value This is overloaded function, it behaves exactly as previous one. More...
 
Standard_EXPORT bool FixShapeTolerance (TopoDS_Shape &shape, bool checkGeometry)
 Limit shape tolerance to the given value This is overloaded function, it behaves exactly as previous one. More...
 
Standard_EXPORT bool FixShapeCurves (TopoDS_Shape &shape)
 Fix curves of the given shape. More...
 
Standard_EXPORT bool Write (const TopoDS_Shape &shape, const char *fileName)
 Write shape to the BREP file. More...
 
Standard_EXPORT TopoDS_Shape ReduceCompound (const TopoDS_Shape &shape)
 Extract single SOLID from COMPSOLID or COMPOUND. More...
 
Standard_EXPORT void MeshShape (const TopoDS_Shape shape, double deflection, bool forced=true)
 Generate triangulation for the shape. More...
 
Standard_EXPORT double DefaultDeflection ()
 Get default deflection coefficient used for triangulation. More...
 
Standard_EXPORT bool IsOpenPath (const TopoDS_Shape &theShape)
 Check if the shape is not a closed wire or edge. More...
 
Standard_EXPORT int CompareToleranceValues (const double theTolShape, const double theTolRef)
 This function compares two tolerances. More...
 
Standard_EXPORT bool IsFitCondition (const ComparisonCondition theCondition, const double theTolShape, const double theTolRef)
 Check if the comarison of tolerances fit the condition. More...
 
std::map< int, double > ComputeMeasures (std::list< TopoDS_Shape > shapes, TopAbs_ShapeEnum entity, Range &range)
 
Distribution ComputeDistribution (TopoDS_Shape shape, TopAbs_ShapeEnum entity, int intervals, Range range)
 
Distribution ComputeDistribution (std::list< TopoDS_Shape > shapes, TopAbs_ShapeEnum entity, int nbIntervals, Range range)
 
PluginInfo ReadPluginInfo ()
 

Detailed Description

This class represents a hatcher for topological faces.

This class represents a non-persistent transformation in 2D space. The transformations can be represented as follow :

 V1   V2   T       XY        XY

| a11 a12 a13 | | x | | x'| | a21 a22 a23 | | y | | y'| | 0 0 1 | | 1 | | 1 |

where {V1, V2} defines the vectorial part of the transformation and T defines the translation part of the transformation. This transformation can change the nature of the objects if it is anisotropic.

Typedef Documentation

◆ Distribution

typedef std::vector<Range> GEOMUtils::Distribution

◆ LevelInfo

typedef std::map<std::string, NodeLinks> GEOMUtils::LevelInfo

◆ LevelsList

typedef std::vector<LevelInfo> GEOMUtils::LevelsList

◆ NodeLinks

typedef std::vector<std::string> GEOMUtils::NodeLinks

◆ PluginInfo

typedef std::list<PluginData> GEOMUtils::PluginInfo

◆ TreeModel

typedef std::map<std::string,std::pair<LevelsList,LevelsList> > GEOMUtils::TreeModel

Enumeration Type Documentation

◆ ComparisonCondition

Enumerator
CC_GT 

Greater then.

CC_GE 

Greater then or equal to.

CC_LT 

Less then.

CC_LE 

Less then or equal to.

Function Documentation

◆ AddSimpleShapes()

void GEOMUtils::AddSimpleShapes ( const TopoDS_Shape &  theShape,
TopTools_ListOfShape &  theList 
)

If theShape is not compound or compsolid, theList will contain only theShape itself.

Parameters
theShapeThe shape to be exploded.
theListOutput parameter.

◆ CheckBOPArguments()

bool GEOMUtils::CheckBOPArguments ( const TopoDS_Shape &  theShape)
Parameters
theShapethe argument of an operation to be checked
Returns
true if the argument is valid for a boolean or partition operation or false otherwise

◆ CheckShape()

bool GEOMUtils::CheckShape ( TopoDS_Shape &  shape,
bool  checkGeometry = false 
)
Parameters
shapeinput shape object
checkGeometrywhen set to true, causes check of underlying geometry in addition to the topology
Returns
true if shape is valid or false otherwise

◆ CheckTriangulation()

bool GEOMUtils::CheckTriangulation ( const TopoDS_Shape &  theShape)
Parameters
theShapeThe shape to check/build triangulation on.
Return values
boolReturns false if the shape has no faces, i.e. impossible to build triangulation.

References Handle().

◆ CompareToleranceValues()

int GEOMUtils::CompareToleranceValues ( const double  theTolShape,
const double  theTolRef 
)

The shape tolerance (the first argument) is considered less than the reference tolerance (the second argument) if theTolShape < theTolRef - Tolerance(theTolRef). theTolShape is considered greater than theTolRef if theTolShape > theTolRef + Tolerance(theTolRef). Otherwise these tolerances are equal. Tolerance(theTolRef) = theTolRef*DEFAULT_TOLERANCE_TOLERANCE. But this value should not be greated than DEFAULT_MAX_TOLERANCE_TOLERANCE.

Parameters
theTolShapethe shape tolerance
theTolRefthe reference tolerance
Returns
-1 if theTolShape is less than theTolRef; 1 if theTolShape is greater than theTolRef; 0 if they are equal

References aResult, DEFAULT_MAX_TOLERANCE_TOLERANCE, and DEFAULT_TOLERANCE_TOLERANCE.

◆ CompsolidToCompound()

TopoDS_Shape GEOMUtils::CompsolidToCompound ( const TopoDS_Shape &  theCompsolid)

If the argument shape is not of type TopoDS_COMPSOLID, this method returns it as is.

Parameters
theCompsolidThe compsolid to be converted.
Return values
TopoDS_ShapeReturns the resulting compound.

◆ ComputeDistribution() [1/2]

Standard_EXPORT Distribution GEOMUtils::ComputeDistribution ( std::list< TopoDS_Shape >  shapes,
TopAbs_ShapeEnum  entity,
int  nbIntervals,
Range  range 
)

◆ ComputeDistribution() [2/2]

Standard_EXPORT Distribution GEOMUtils::ComputeDistribution ( TopoDS_Shape  shape,
TopAbs_ShapeEnum  entity,
int  intervals,
Range  range 
)

◆ ComputeMeasures()

Standard_EXPORT std::map< int, double > GEOMUtils::ComputeMeasures ( std::list< TopoDS_Shape >  shapes,
TopAbs_ShapeEnum  entity,
Range range 
)

◆ ConvertClickToPoint()

gp_Pnt GEOMUtils::ConvertClickToPoint ( int  x,
int  y,
Handle(V3d_View)  theView 
)
Parameters
xThe X coordinate in the view.
yThe Y coordinate in the view.
theViewView where the given point takes place.
Return values
gp_PntReturns the point clicked in 3D view

◆ ConvertStringToTree()

void GEOMUtils::ConvertStringToTree ( const std::string &  dependencyStr,
TreeModel tree 
)
Parameters
dependencyStrstring representation of tree data
treeoutput dependency tree data

◆ ConvertTreeToString()

void GEOMUtils::ConvertTreeToString ( const TreeModel tree,
std::string &  dependencyStr 
)
Parameters
treedependency tree data
dependencyStroutput string

◆ DefaultDeflection()

double GEOMUtils::DefaultDeflection ( )
Returns
default deflection value

◆ FixShapeCurves()

bool GEOMUtils::FixShapeCurves ( TopoDS_Shape &  shape)

The function checks each curve of the input shape in the following way:

  • compute deviation of the curve from the underlying surface in a set of points computed with the certain discretization step value
  • find maximum tolerance between computed deviation values
  • limit tolerance of the curve with the computed maximum value
Parameters
shapeshape being fixed
Returns
true if resulting shape is valid

References CheckShape().

◆ FixShapeTolerance() [1/3]

bool GEOMUtils::FixShapeTolerance ( TopoDS_Shape &  shape,
bool  checkGeometry 
)

References FixShapeTolerance().

◆ FixShapeTolerance() [2/3]

bool GEOMUtils::FixShapeTolerance ( TopoDS_Shape &  shape,
Standard_Real  tolerance = Precision::Confusion(),
bool  checkGeometry = false 
)

References FixShapeTolerance().

◆ FixShapeTolerance() [3/3]

bool GEOMUtils::FixShapeTolerance ( TopoDS_Shape &  shape,
TopAbs_ShapeEnum  type,
Standard_Real  tolerance = Precision::Confusion(),
bool  checkGeometry = false 
)
Parameters
shapeshape being fixed
typetopology type which tolerance is to be limited; TopAbs_SHAPE means all types of topology
toleranceexpected tolerance value (1e-7 by default)
checkGeometrycheck geometry validity of result
Returns
true if resulting shape is valid
Note
Resulting tolerance of the shape is not mandatory equal to requested value as it might be changed by fixshape operation in order to get valid shape where possible
By default, result only checked for topology validity; check of geometry can be done by passing true to checkGeometry parameter

References CheckShape(), and Handle().

◆ GetEdgeNearPoint()

TopoDS_Shape GEOMUtils::GetEdgeNearPoint ( const TopoDS_Shape &  theShape,
const TopoDS_Vertex &  thePoint 
)
Parameters
theShapeThe shape to explore.
thePointThe point near the required edge.
Return values
TopoDS_ShapeReturns the found edge or an empty shape if multiple edges found.

References aResult.

◆ GetMinDistance()

Standard_Real GEOMUtils::GetMinDistance ( const TopoDS_Shape &  theShape1,
const TopoDS_Shape &  theShape2,
gp_Pnt &  thePnt1,
gp_Pnt &  thePnt2 
)
Parameters
theShape1the first shape
theShape2the second shape
thePnt1the output result point on the first shape
thePnt2the output result point on the second shape
Return values
negativevalue in case of failure; otherwise the real distance.

References aResult, and GetMinDistanceSingular().

◆ GetMinDistanceSingular()

double GEOMUtils::GetMinDistanceSingular ( const TopoDS_Shape &  aSh1,
const TopoDS_Shape &  aSh2,
gp_Pnt &  Ptmp1,
gp_Pnt &  Ptmp2 
)
Parameters
aSh1the first shape
aSh2the second shape
Ptmp1the output result point on the first shape
Ptmp2the output result point on the second shape
Return values
negativevalue if it is not a singular case; actual distance for singular case.

◆ GetPosition()

gp_Ax3 GEOMUtils::GetPosition ( const TopoDS_Shape &  theShape)

Origin of the LCS is situated at the shape's center of mass. Axes of the LCS are obtained from shape's location or, if the shape is a planar face, from position of its plane.

References aResult, GetTypeOfSimplePart(), and Handle().

◆ GetTypeOfSimplePart()

TopAbs_ShapeEnum GEOMUtils::GetTypeOfSimplePart ( const TopoDS_Shape &  theShape)
Parameters
theShapeThe shape to get type of.
Return values
TopAbs_ShapeEnumReturn type of shape for explode.

◆ GetVector()

gp_Vec GEOMUtils::GetVector ( const TopoDS_Shape &  theShape,
Standard_Boolean  doConsiderOrientation 
)
Parameters
theShapeThe edge.
doConsiderOrientationIf True, take into account the edge orientation.
Note
It is recommended to use doConsiderOrientation=Standard_False, because the same edge can have different orientation depending on the way it was extracted from a shape.

References GEOM::Vertices.

◆ IsFitCondition()

bool GEOMUtils::IsFitCondition ( const ComparisonCondition  theCondition,
const double  theTolShape,
const double  theTolRef 
)

The comparison of tolerances is performed using the function CompareToleranceValues.

Parameters
theConditionthe condition
theTolShapethe shape tolerance
theTolRefthe reference tolerance
Returns
true if the shape tolerance fits the condition; false otherwise.

References CC_GE, CC_GT, CC_LE, CC_LT, and CompareToleranceValues().

◆ IsOpenPath()

bool GEOMUtils::IsOpenPath ( const TopoDS_Shape &  theShape)

This function is used for pipe creation algorithm to test if the pipe path is not closed. It returns false if theShape is a wire or an edge with coincident end vertices. Otherwise it returns true.

Parameters
theShapethe shape to be tested.
Returns
true if theShape is not a closed wire or edge.

References GEOM::Vertices.

◆ MeshShape()

void GEOMUtils::MeshShape ( const TopoDS_Shape  shape,
double  deflection,
bool  forced = true 
)
Parameters
shapeshape being meshed
deflectiondeflection coefficient to be used
forcedif true, causes generation of mesh regardless it is already present in the shape

References DefaultDeflection(), Handle(), and MAX3.

◆ PreciseBoundingBox()

Standard_Boolean GEOMUtils::PreciseBoundingBox ( const TopoDS_Shape &  theShape,
Bnd_Box &  theBox 
)
Parameters
theShapethe shape.
theBoxrough bounding box on input; precise bounding box on output.
Return values
Standard_Truein case of success; Standard_False otherwise.

References GetMinDistance().

◆ ProjectPointOnFace()

gp_Pnt GEOMUtils::ProjectPointOnFace ( const gp_Pnt &  thePoint,
const TopoDS_Shape &  theFace,
double &  theU,
double &  theV,
const double  theTol = 1e-04 
)
Parameters
thePointthe 3d point
theFacethe face shape
theUthe output U parameter of the point on the face
theVthe output V parameter of the point on the face
theTolthe tolerance value. Maximum of theTol and 1e-04 will be used for calculation.
Return values
theprojection (3d point) if found, throws an exception otherwise

References Handle().

◆ ReadPluginInfo()

◆ ReduceCompound()

TopoDS_Shape GEOMUtils::ReduceCompound ( const TopoDS_Shape &  shape)

If the argument shape is a COMPOUND or COMPSOLID and there's only single simple-shape type inside, this sub-shape is returned as a result; otherwise, the shape is not changed.

Parameters
shapecompound or compsolid being processed.
Return values
TopoDS_Shaperesulting shape

◆ ShapeToDouble()

std::pair< double, double > GEOMUtils::ShapeToDouble ( const TopoDS_Shape &  theShape,
bool  isOldSorting = false 
)

Resulting value can be used to sort out shapes according to some parameter.

Returns a pair of two values (dist, functor) where

  • dist is a some value that is computed according to the center of mass of given shape;
  • functor is a numerical functor value

The numerical functor is computed according to the shape's topological properties as follows:

  • orientation for vertices
  • length for edges and wires
  • area for faces and shells
  • volume for solids, compounds, compsolids

If isOldSorting parameter is set to true, for all cases linear properties of the shape are used (to support backward compatibility in some methods). By default, this parameter is set to false.

◆ SortShapes()

void GEOMUtils::SortShapes ( TopTools_ListOfShape &  SL,
const Standard_Boolean  isOldSorting = Standard_True 
)

◆ Write()

bool GEOMUtils::Write ( const TopoDS_Shape &  shape,
const char *  fileName 
)
Parameters
sourceshape
Returns
true if file was written or false otherwise

References Write().