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();