- // first wire
- Handle(GEOM_Function) aRefWire = Handle(GEOM_Function)::DownCast(aShapes->Value(1));
- TopoDS_Shape aWire = aRefWire->GetValue();
- if (aWire.IsNull() || aWire.ShapeType() != TopAbs_WIRE) {
- Standard_NullObject::Raise("Shape for face construction is null or not a wire");
+ // 2. Connect edges to wires of maximum length
+ Handle(TopTools_HSequenceOfShape) aSeqWiresOut;
+ ShapeAnalysis_FreeBounds::ConnectEdgesToWires(aSeqEdgesIn, Precision::Confusion(),
+ /*shared*/Standard_False, aSeqWiresOut);
+
+ // 3. Separate closed wires
+ Handle(TopTools_HSequenceOfShape) aSeqClosedWires = new TopTools_HSequenceOfShape;
+ Handle(TopTools_HSequenceOfShape) aSeqOpenWires = new TopTools_HSequenceOfShape;
+ for (ind = 1; ind <= aSeqWiresOut->Length(); ind++) {
+ if (aSeqWiresOut->Value(ind).Closed())
+ aSeqClosedWires->Append(aSeqWiresOut->Value(ind));
+ else
+ aSeqOpenWires->Append(aSeqWiresOut->Value(ind));