how to get edges from TopoDS_Wire

if we have a TopoDS_Wire how can we access and count edges from it.

Paul Jimenez's picture

TopExp_Explorer

Vidhyan's picture

TopExp_Explorer Ex1,Ex2;

for (Ex1.Init(ResultShape,TopAbs_WIRE); Ex1.More(); Ex1.Next())
{
for (Ex2.Init(Ex1.Current(),TopAbs_EDGE); Ex2.More(); Ex2.Next())
{
TopoDS_Edge l_edge = TopoDS::Edge(Ex2.Current());
}
}

Marco Matt's picture

BRepTools_WireExplorer

Divya's picture

I use BRepTools_WireExplorer which says :

If a wire is not closed returns only a segment of edges which
length depends on started in exploration edge. If wire has
singularities (for example, loops) WireExplorer can return not all
edges in a wire. it depends on type of singularity.
what is type of singularity?

The wires I obtain from ConnectEdgesToWires(,,,Wires) is a set of open,closed wires.
Is the problem because of this?? how else can I access edges from each wire in "Wires"?Tried TopExplorer also which displays wires but doent access its edges.
please do reply!

David Egan's picture

For a Handle(TopTools_HSequenceOfShape) such as Wires or ClosedWires ,this is a handle to an array of shapes. The number of shapes in the array is the member function ::Length()
such as
Standard_Integer nbWires =ClosedWires->Length();
and get the wires for example like this...

for(int i=0;iValue(i+1));
..... do something clever
}
Hope this helps