For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings


Need to speed up your development?
Have a look at our:

Samples & Tools


Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Wrong result with ShapeAnalysis_FreeBounds and ShapeAnalysis_FreeBoundData

Game Milky's picture

Dear Supervisors and users;

I face a problem using ShapeAnalysis_FreeBounds and ShapeAnalysis_FreeBoundData. Basically i want to identify freebound, open and closed wires in my sewedshape file. In addition i want to identify whether the freebound is internal or external (hole). And to calculate the area and perimeter of those freebound wires, i try to use these libraries as follow. I don't know if it would be from coding or something else. Any suggestion helps!

Here is the code

Standard_Real SewTolerance = 10e-3;

//Tolerance for sewing
Standard_Boolean SplitClosed = Standard_False;
Standard_Boolean SplitOpen = Standard_True;
//in case of analysis of possible free boundaries
//ShapeAnalysis_FreeBounds safb (shape, SewTolerance, SplitClosed, SplitOpen);
//in case of analysis of existing free bounds
ShapeAnalysis_FreeBounds safb (shape, SplitClosed, SplitOpen);
//getting the results
TopoDS_Compound ClosedWires = safb.GetClosedWires();
//Returns a compound of closed free bounds
TopoDS_Compound OpenWires = safb.GetClosedWires();
//Returns a compound of open free bounds
//Explore to possible wires
TopExp_Explorer exp;
for(exp.Init(ClosedWires, TopAbs_WIRE); exp.More(); exp.Next())
TopoDS_Wire hole = TopoDS::Wire(exp.Current());
ShapeAnalysis_FreeBoundData Analyzer(hole);
Standard_Real Area =Analyzer.Area();
Standard_Real Perimeter =Analyzer.Perimeter();
Standard_Real Ratio =Analyzer.Ratio();
Standard_Real Width =Analyzer.Width();

qDebug() }

for(exp.Init(OpenWires, TopAbs_WIRE); exp.More(); exp.Next())
TopoDS_Wire OuterBound= TopoDS::Wire(exp.Current());

The result:

Area: -1
Perimeter: -1
Ratio: -1
Width: -1

What does, this mean?
Any help and /or suggestions!