There is no such functionality out of box. Two different ways can be proposed to solve your problem:
1) Write pure mesh-based algorithm to find inner and outer contours from scratch. After that it is possible to create planar faces on inner contours and create mesh on them.
2) Convert your mesh elements to the topological faces. Sew them. After these steps you can use ShapeAnalysis_FreeBounds class to find outer and inner contours. After that you can use algorithm proposed above.
Thank you for Your Answer. Can You give Sample of the code how to get outer and inner contours using ShapeAnalysis_FreeBounds class from TopoDS_Shape, or what functions from this class it need to use? Sorry i'm new in opencascad and I do not clearly understand some from it.
// Get the biggest wire from compound.
// We suppose that outerWire have the biggest AABB.
// Other wires will be considered as internal ones.
TopoDS_Shape outerContour;
double biggestAABB = -1.0;
for(TopExp_Explorer iter(wires, TopAbs_WIRE); iter.More() ; iter.Next())
{
Bnd_Box box;
BRepBndLib::Add(iter.Current(), box); // Use triangulation in this case.
Wed, 01/11/2017 - 11:49
Hello Vitaut,
There is no such functionality out of box. Two different ways can be proposed to solve your problem:
1) Write pure mesh-based algorithm to find inner and outer contours from scratch. After that it is possible to create planar faces on inner contours and create mesh on them.
2) Convert your mesh elements to the topological faces. Sew them. After these steps you can use ShapeAnalysis_FreeBounds class to find outer and inner contours. After that you can use algorithm proposed above.
br,
qa, qa.
Wed, 01/11/2017 - 14:31
Thank you for Your Answer. Can You give Sample of the code how to get outer and inner contours using ShapeAnalysis_FreeBounds class from TopoDS_Shape, or what functions from this class it need to use? Sorry i'm new in opencascad and I do not clearly understand some from it.
Thu, 01/12/2017 - 07:18
Here it is:
ShapeAnalysis_FreeBounds shapeAnalyzer(inputShape, 0.1);
const TopoDS_Compound& wires = shapeAnalyzer.GetClosedWires();
// Get the biggest wire from compound.
// We suppose that outerWire have the biggest AABB.
// Other wires will be considered as internal ones.
TopoDS_Shape outerContour;
double biggestAABB = -1.0;
for(TopExp_Explorer iter(wires, TopAbs_WIRE); iter.More() ; iter.Next())
{
Bnd_Box box;
BRepBndLib::Add(iter.Current(), box); // Use triangulation in this case.
if ( biggestAABB < box.SquareExtent() )
{
biggestAABB = box.SquareExtent();
outerContour= iter.Current();
}
}
This piece of code shows how to get outer wire from shape. All other wires are inner.
Thu, 01/12/2017 - 15:32
Thank you. I'm understand. Your Idea is cool.