a Wire from several curves

Hi,

I am reading ACIS-SAT file which has a loop like attached image.
Loop has two half ellipses and two periodic b-spline curve and half ellipse and b-spline curve meet at pt1 and pt2.
when i get a wire by using my code to create a wire, two periodic b-spline curves are missing.
i expected three wires.
is there a way to fix this problem?

my code
Handle(TopTools_HSequenceOfShape) Edges = new TopTools_HSequenceOfShape();
for(list::iterator itr = aEdgeList.begin();itr != aEdgeList.end();++itr)
{
Edges->Append(*itr);
}

Handle(TopTools_HSequenceOfShape) Wires = new TopTools_HSequenceOfShape(); //Will hold the wires found
ShapeAnalysis_FreeBounds::ConnectEdgesToWires(Edges,Precision::Confusion(),Standard_False,Wires); //Wonderful tool?
for(int w=1; wLength();w++)
{ //For each wire
TopoDS_Wire Wire = TopoDS::Wire(Wires->Value(w));
if(Wire.Closed())
TRACE(" Wire %ld is Closed\n",w);
else
TRACE(" Wire %ld is Open\n",w);

{
Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire;
sfw->Load(Wire);
sfw->Perform();
/// Reorder edges is very important
sfw->FixReorder();
sfw->SetMaxTolerance(toler);
///////////////////////////////////
sfw->ClosedWireMode() = Standard_True;
sfw->FixConnected(1.e-7);
sfw->FixClosed(1.e-7);

BRepBuilderAPI_MakeWire aMakeWire;
for (int i = 1; i NbEdges(); i++)
{
TopoDS_Edge Edge = sfw->WireData()->Edge(i);
FTol.SetTolerance(Edge, toler, TopAbs_VERTEX);
aMakeWire.Add(Edge);
}
Wires->ChangeValue(w) = aMakeWire.Wire();
}
}

Handle(TopTools_HSequenceOfShape) outWires = new TopTools_HSequenceOfShape();
ShapeAnalysis_FreeBounds::ConnectWiresToWires(Wires ,1.e-7,Standard_True, outWires);
TopoDS_Wire aWire = TopoDS::Wire(outWires->Value(1));

Attachments: 
zbaekhk's picture

my mistake~~~ return type was wrong in my code
my code returns sucessfully 3 wires.

thanks