Sorting entity

I have ad IGES file that contains arcs and lines.
Each element is connected, at least to another one... the result is a kind of path made by these elements.
I tried to import these elements, and I got elements of type TopoDS_Edge.
Now, what's the simplest way to order these elements?

Thank's in andvance.

Arjan Schouten's picture

Hi Cristian,

If you need the underlaying geometry, you could use BRepAdaptor_Curve to see if your edge is an arc, circle, line etc. Maybe you can use ShapeAnalysis_FreeBounds::ConnectEdgesToWires to connect them to one wire, never used it myself though.

Kind Regards,

Arjan

Brambilla Cristian's picture

With the BRepAdaptor_Curve I can retrieve points of the underlying geometry? For example,
if my edge is a line, I can retrieve start and end point?

I try to explain better.
I would to retrieve geometry of each edge and, respectively, IGESGeom_CircularArc for arcs and IGESGeom_Line for lines. Once I have these structures, I can evaluate start and end point of each geometry and sort the whole structure.

I can do that?

Arjan Schouten's picture

Yes you can,

pseudo code

BRepAdaptor_Curve Adaptor;

foreach edge in edges
Adaptor.Initialize(yourEdge);

GeomAbs_CurveType curveType = Adaptor.GetType();

switch(curveType)
case line : gp_Lin = Adaptor.Line();
case circle : gp_Circ = Adaptor.Circle();

look in the BRepAdaptor_Curve documentation for details

Regards Arjan

Brambilla Cristian's picture

Hi Arjan, thank you for your answers!
That was exactly what I need.

Regards, Cristian