Duplication of spline edges

Hi everyone,

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:

IGESControl_Reader reader;
Standard_Integer status = reader.ReadFile(pExchangeData->m_filename.c_str());
if (status != IFSelect_RetDone) return status;
reader.TransferRoots();
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:

ShapeFix_Shape fixer(aShape);
fixer.SetMaxTolerance (iid.m_tol);
fixer.Perform();
aShape = fixer.Shape();

ShapeFix_Wireframe fixerWire (aShape);
fixerWire.SetMaxTolerance (iid.m_tol);
fixerWire.ModeDropSmallEdges() = Standard_True;
fixerWire.FixSmallEdges();
fixerWire.FixWireGaps();
aShape = fixerWire.Shape();

BRepBuilderAPI_Sewing sew (iid.m_tol);
sew.Add(aShape);
sew.Perform();
aShape = sew.SewedShape();

TopTools_MapOfShape myMap;
TopExp_Explorer Ex;
for (Ex.Init(aShape,TopAbs_EDGE); iid.m_importCurves && Ex.More(); Ex.Next())
{
myMap.Add (Ex.Current());
}
int numEdgesAfter = myMap.Extent();
TopTools_MapIteratorOfMapOfShape mi(myMap);
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?

Thanks!

esherbro's picture

Anyone have any ideas on this one?