BRepAlgoAPI_Section problem

Hi all,
When I use BRepAlgoAPI_Section to section an complex shape with a
plane I find more than one curve(maybe open or closed curve) as
an one object.
How can I gain to the access this curves separately.
Thanks alot.

Hi,

i think you obtain compound object. Try to explore the result shape with TopExp_Explorer :

BRepAlgoAPI_Section SectionAlgo(...);
...

TopoDS_Shape compound = SectionAlgo.Shape();
TopExp_Explorer exp;
for (exp.Init(compound, TopAbs_EDGE) ; exp.More() ; exp.Next())
{
...
}

Markus's picture

Hi,

I have the same problem. But how do I know when one of the result wire's ends and another one starts?
The only thing I know is that my result shape has 57 egdes, but I don't know how to get the number of different wires they represent.

Thanks for any help!
Markus

Patrik Mueller's picture

Hi Markus,

you can use the explorer with TopAbs_WIRE. Than yu have just to iterate the resulting wires!

Greets,

Patrik

David Egan's picture

I am not sure that the result has the edges in Wires - for sure it did not used to. Here is what I copied from the Constructor.

"Construction of section lines between two shapes.

For this Boolean operation, each face of the first shape is intersected by each face of the second shape. The resulting intersection edges are brought together into a compound object, but not chained or grouped into wires."

I normally build the wires as follows for example. There are other member functions to sort the wires into Open and closed etc. Hope this maybe helpful

Handle(TopTools_HSequenceOfShape) Edges = new TopTools_HSequenceOfShape();
Handle(TopTools_HSequenceOfShape) Wires = new TopTools_HSequenceOfShape();
for(Exo.Init(SectionShape,TopAbs_EDGE);Exo.More();Exo.Next())
{
Edges->Append(TopoDS::Edge(Exo.Current()));
}
ShapeAnalysis_FreeBounds::ConnectEdgesToWires( Edges,m_GlobalTolerance ,false,Wires);

TopoDS_Wire FirstWireInList = TopoDS::Wire(Wires->Value(1)); // Wires is a sequence of wires

Markus's picture

Hello David,

thank you, that sound like a great idea and I will test it tomorrow.

Markus

Markus's picture

Hi Patrik,

unfortunately that is not possible. The result shapes contains only edges, so I have to build my wires by myself. Does anyone has a idea how to separate the edges that belong to a specific wire?

Thanks!
Markus