How to get X-Y coordinates for each IGES entity after IGES import....

Dear all,
I want to import IGES file in my MFC based application. I have used 'IGESControl_Reader' class for this purpose. I am getting shape in
'TopoDS_Shape' object. But how do I extract actual geometrical co-ordinates of each IGES entity? Can anybody guide me in this matter?
Thanks in advance.

Regards,
Manoj Chordia.

Rob Bachrach's picture

Conceptually, this is a huge question. The complexity of the answer depends on what you need and expect from the IGES file. I will try to get you started, assuming you are looking primarily for edge information (ie. curves).

First, traverse all the edges in your shape using TopExp_Explorer:
TopExp_Explorer ex;
for (ex.Init(compound, TopAbs_EDGE); ex.More(); ex.Next()) {
TopoDS_Edge edge = TopoDS::Edge(ex.Current());
...(see below)
}

Then, for each edge, you can extract the parameters with BRep_Tool::Curve.
Standard_Real fFirst, fLast;
Handle(Geom_Curve) curve = BRep_Tool::Curve(edge, fFirst, fLast);

Finally, you can extract the necessary information based on the curve type (if you need to get this level of detail).
Handle(Standard_Type) type = curve->DynamicType();
if (type == STANDARD_TYPE(Geom_Line)) {
Handle(Geom_Line) line = Handle(Geom_Line)::DownCast(curve);
... (process the line)
}

I hope this helps.