Open CASCADE, the 3D modelling kernel
3D modeling & numerical simulation

Search the Forums
See All Topics

Wrong result with ShapeAnalysis_FreeBounds and ShapeAnalysis_FreeBoundData

Wrong result with ShapeAnalysis_FreeBounds and ShapeAnalysis_FreeBoundData
Game Milky 2012/08/17 12:51

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()<< "Area: "<<Area<<endl<<"Perimeter: "<<Perimeter<<endl<<"Ratio: "<<Ratio<<endl<<"Width: "<<Width<<endl;

     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!

Latest news
  • Open CASCADE CAD Assistant for iOS platform is available!
  • Open CASCADE Technology 6.9.0 is available for download!
  • JT Assistant for Android

  • © OPEN CASCADE 2000 - 2015  |  Search  |  Contacts   |  Site map