I have an IGES file exported from SolidWorks and am extracting the curves from the edges of the model with an eye to getting the wireframe representation. I use the following code to get the shape from the IGES file:
Standard_Integer status = reader.ReadFile(pExchangeData->m_filename.c_str());
if (status != IFSelect_RetDone) return status;
TopoDS_Shape aShape = reader.OneShape();
That seems to work fine. I next mess with the shape a bit to try to get everything sewn nicely, so that I'm only getting one curve per shared edge:
aShape = fixer.Shape();
ShapeFix_Wireframe fixerWire (aShape);
fixerWire.ModeDropSmallEdges() = Standard_True;
aShape = fixerWire.Shape();
BRepBuilderAPI_Sewing sew (iid.m_tol);
aShape = sew.SewedShape();
for (Ex.Init(aShape,TopAbs_EDGE); iid.m_importCurves && Ex.More(); Ex.Next())
int numEdgesAfter = myMap.Extent();
for ( ;mi.More(); mi.Next())
TopoDS_Edge edge (TopoDS::Edge (mi.Key()));
// More stuff...
Here iid.m_tol is a tolerance value (for this example, it's .01).
This particular part is a rectangular block out of which rectangular, circular, triangular, and spline-shaped bosses have been cut. The code above does great on everything but the spline-shaped boss (that is, there are no duplicate edges, and I can extract the wireframe curves perfectly). However, the spline curves are behaving very oddly; they turn into what seem to be 63 identical copies of the same spline curve.
Does anything I'm doing above look obviously wrong? Is there a better way to get what I'm trying to get, one curve for every shared edge in the model?