1 // Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #include <GEOMImpl_ShapeDriver.hxx>
25 #include <GEOMImpl_IIsoline.hxx>
26 #include <GEOMImpl_IShapes.hxx>
27 #include <GEOMImpl_IVector.hxx>
28 #include <GEOMImpl_Types.hxx>
29 #include <GEOMImpl_Block6Explorer.hxx>
31 #include <GEOM_Function.hxx>
32 #include <GEOMUtils_Hatcher.hxx>
35 #include <ShapeFix_Wire.hxx>
36 #include <ShapeFix_Edge.hxx>
37 #include <ShapeFix_Shape.hxx>
39 #include <BRep_Builder.hxx>
40 #include <BRep_Tool.hxx>
41 #include <BRepAdaptor_Curve.hxx>
42 #include <BRepAlgo_FaceRestrictor.hxx>
43 #include <BRepBuilderAPI_Copy.hxx>
44 #include <BRepBuilderAPI_Sewing.hxx>
45 #include <BRepBuilderAPI_MakeWire.hxx>
46 #include <BRepBuilderAPI_MakeEdge.hxx>
47 #include <BRepCheck.hxx>
48 #include <BRepCheck_Analyzer.hxx>
49 #include <BRepCheck_Shell.hxx>
50 #include <BRepClass3d_SolidClassifier.hxx>
51 #include <BRepLib.hxx>
52 #include <BRepLib_MakeEdge.hxx>
53 #include <BRepTools_WireExplorer.hxx>
55 #include <ShapeAnalysis.hxx>
56 #include <ShapeAnalysis_FreeBounds.hxx>
60 #include <TopExp_Explorer.hxx>
62 #include <TopoDS_Shape.hxx>
63 #include <TopoDS_Edge.hxx>
64 #include <TopoDS_Wire.hxx>
65 #include <TopoDS_Shell.hxx>
66 #include <TopoDS_Solid.hxx>
67 #include <TopoDS_Compound.hxx>
68 #include <TopoDS_Iterator.hxx>
70 #include <TopTools_MapOfShape.hxx>
71 #include <TopTools_HSequenceOfShape.hxx>
75 #include <GCPnts_AbscissaPoint.hxx>
77 #include <Geom_TrimmedCurve.hxx>
78 #include <Geom_Surface.hxx>
79 #include <GeomAbs_CurveType.hxx>
80 #include <GeomConvert_CompCurveToBSplineCurve.hxx>
81 #include <GeomConvert.hxx>
82 #include <GeomLProp.hxx>
84 #include <TColStd_SequenceOfReal.hxx>
85 #include <TColStd_HSequenceOfTransient.hxx>
86 #include <TColStd_Array1OfReal.hxx>
87 #include <TColGeom_SequenceOfCurve.hxx>
88 #include <TColGeom_Array1OfBSplineCurve.hxx>
89 #include <TColGeom_HArray1OfBSplineCurve.hxx>
91 #include <Precision.hxx>
93 #include <Standard_NullObject.hxx>
94 #include <Standard_TypeMismatch.hxx>
95 #include <Standard_ConstructionError.hxx>
97 //modified by NIZNHY-PKV Wed Dec 28 13:48:20 2011f
99 // void KeepEdgesOrder(const Handle(TopTools_HSequenceOfShape)& aEdges,
100 // const Handle(TopTools_HSequenceOfShape)& aWires);
101 //modified by NIZNHY-PKV Wed Dec 28 13:48:23 2011t
103 //=======================================================================
106 //=======================================================================
107 const Standard_GUID& GEOMImpl_ShapeDriver::GetID()
109 static Standard_GUID aShapeDriver("FF1BBB54-5D14-4df2-980B-3A668264EA16");
114 //=======================================================================
115 //function : GEOMImpl_ShapeDriver
117 //=======================================================================
118 GEOMImpl_ShapeDriver::GEOMImpl_ShapeDriver()
122 //=======================================================================
125 //=======================================================================
126 Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
128 if (Label().IsNull()) return 0;
129 Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
131 GEOMImpl_IShapes aCI (aFunction);
132 Standard_Integer aType = aFunction->GetType();
135 TCollection_AsciiString aWarning;
139 if (aType == WIRE_EDGES) {
140 Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
142 Standard_Real aTolerance = aCI.GetTolerance();
143 if (aTolerance < Precision::Confusion())
144 aTolerance = Precision::Confusion();
146 aShape = MakeWireFromEdges(aShapes, aTolerance);
148 else if (aType == FACE_WIRE) {
149 Handle(GEOM_Function) aRefBase = aCI.GetBase();
150 TopoDS_Shape aShapeBase = aRefBase->GetValue();
151 if (aShapeBase.IsNull()) Standard_NullObject::Raise("Argument Shape is null");
153 if (aShapeBase.ShapeType() == TopAbs_WIRE) {
154 W = TopoDS::Wire(aShapeBase);
155 // check the wire is closed
156 TopoDS_Vertex aV1, aV2;
157 TopExp::Vertices(W, aV1, aV2);
158 if ( !aV1.IsNull() && !aV2.IsNull() && aV1.IsSame(aV2) )
159 aShapeBase.Closed(true);
161 Standard_NullObject::Raise
162 ("Shape for face construction is not closed");
164 else if (aShapeBase.ShapeType() == TopAbs_EDGE && aShapeBase.Closed()) {
165 BRepBuilderAPI_MakeWire MW;
166 MW.Add(TopoDS::Edge(aShapeBase));
168 Standard_ConstructionError::Raise("Wire construction failed");
173 Standard_NullObject::Raise
174 ("Shape for face construction is neither a wire nor a closed edge");
176 aWarning = GEOMImpl_Block6Explorer::MakeFace(W, aCI.GetIsPlanar(), aShape);
177 if (aShape.IsNull()) {
178 Standard_ConstructionError::Raise("Face construction failed");
181 else if (aType == FACE_WIRES) {
182 // Try to build a face from a set of wires and edges
185 Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
186 int nbshapes = aShapes->Length();
188 Standard_ConstructionError::Raise("No wires or edges given");
191 // 1. Extract all edges from the given arguments
192 TopTools_MapOfShape aMapEdges;
193 Handle(TopTools_HSequenceOfShape) aSeqEdgesIn = new TopTools_HSequenceOfShape;
195 for (ind = 1; ind <= nbshapes; ind++) {
196 Handle(GEOM_Function) aRefSh_i = Handle(GEOM_Function)::DownCast(aShapes->Value(ind));
197 TopoDS_Shape aSh_i = aRefSh_i->GetValue();
199 TopExp_Explorer anExpE_i (aSh_i, TopAbs_EDGE);
200 for (; anExpE_i.More(); anExpE_i.Next()) {
201 if (aMapEdges.Add(anExpE_i.Current())) {
202 aSeqEdgesIn->Append(anExpE_i.Current());
207 // 2. Connect edges to wires of maximum length
208 Handle(TopTools_HSequenceOfShape) aSeqWiresOut;
209 ShapeAnalysis_FreeBounds::ConnectEdgesToWires(aSeqEdgesIn, Precision::Confusion(),
210 /*shared*/Standard_False, aSeqWiresOut);
211 //modified by NIZNHY-PKV Wed Dec 28 13:46:55 2011f
212 //KeepEdgesOrder(aSeqEdgesIn, aSeqWiresOut);
213 //modified by NIZNHY-PKV Wed Dec 28 13:46:59 2011t
215 // 3. Separate closed wires
216 Handle(TopTools_HSequenceOfShape) aSeqClosedWires = new TopTools_HSequenceOfShape;
217 Handle(TopTools_HSequenceOfShape) aSeqOpenWires = new TopTools_HSequenceOfShape;
218 for (ind = 1; ind <= aSeqWiresOut->Length(); ind++) {
219 if (aSeqWiresOut->Value(ind).Closed())
220 aSeqClosedWires->Append(aSeqWiresOut->Value(ind));
222 aSeqOpenWires->Append(aSeqWiresOut->Value(ind));
225 if (aSeqClosedWires->Length() < 1) {
226 Standard_ConstructionError::Raise
227 ("There is no closed contour can be built from the given arguments");
230 // 4. Build a face / list of faces from all the obtained closed wires
234 TopoDS_Wire aW1 = TopoDS::Wire(aSeqClosedWires->Value(1));
235 aWarning = GEOMImpl_Block6Explorer::MakeFace(aW1, aCI.GetIsPlanar(), aFFace);
236 if (aFFace.IsNull()) {
237 Standard_ConstructionError::Raise("Face construction failed");
240 // 4.b. Add other wires
241 if (aSeqClosedWires->Length() == 1) {
246 BRep_Builder aBuilder;
247 aBuilder.MakeCompound(C);
248 BRepAlgo_FaceRestrictor FR;
250 TopAbs_Orientation OriF = aFFace.Orientation();
251 TopoDS_Shape aLocalS = aFFace.Oriented(TopAbs_FORWARD);
252 FR.Init(TopoDS::Face(aLocalS), Standard_False, Standard_True);
254 for (ind = 1; ind <= aSeqClosedWires->Length(); ind++) {
255 TopoDS_Wire aW = TopoDS::Wire(aSeqClosedWires->Value(ind));
264 for (; FR.More(); FR.Next()) {
265 aFace = FR.Current().Oriented(OriF);
266 aBuilder.Add(C, aFace);
277 // 5. Add all open wires to the result
278 if (aSeqOpenWires->Length() > 0) {
279 //Standard_ConstructionError::Raise("There are some open wires");
281 BRep_Builder aBuilder;
282 if (aSeqClosedWires->Length() == 1) {
283 aBuilder.MakeCompound(C);
284 aBuilder.Add(C, aShape);
287 C = TopoDS::Compound(aShape);
290 for (ind = 1; ind <= aSeqOpenWires->Length(); ind++) {
291 aBuilder.Add(C, aSeqOpenWires->Value(ind));
297 else if (aType == SHELL_FACES) {
298 Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
299 unsigned int ind, nbshapes = aShapes->Length();
302 BRepBuilderAPI_Sewing aSewing (Precision::Confusion()*10.0);
303 for (ind = 1; ind <= nbshapes; ind++) {
304 Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aShapes->Value(ind));
305 TopoDS_Shape aShape_i = aRefShape->GetValue();
306 if (aShape_i.IsNull()) {
307 Standard_NullObject::Raise("Face for shell construction is null");
309 aSewing.Add(aShape_i);
314 TopoDS_Shape sh = aSewing.SewedShape();
316 if (sh.ShapeType()==TopAbs_FACE && nbshapes==1) {
317 // case for creation of shell from one face - PAL12722 (skl 26.06.2006)
324 //TopExp_Explorer exp (aSewing.SewedShape(), TopAbs_SHELL);
325 TopExp_Explorer exp (sh, TopAbs_SHELL);
326 Standard_Integer ish = 0;
327 for (; exp.More(); exp.Next()) {
328 aShape = exp.Current();
333 // try the case of one face (Mantis issue 0021809)
334 TopExp_Explorer expF (sh, TopAbs_FACE);
335 Standard_Integer ifa = 0;
336 for (; expF.More(); expF.Next()) {
337 aShape = expF.Current();
348 aShape = aSewing.SewedShape();
354 else if (aType == SOLID_SHELL) {
355 Handle(GEOM_Function) aRefShell = aCI.GetBase();
356 TopoDS_Shape aShapeShell = aRefShell->GetValue();
357 if (!aShapeShell.IsNull() && aShapeShell.ShapeType() == TopAbs_COMPOUND) {
358 TopoDS_Iterator It (aShapeShell, Standard_True, Standard_True);
359 if (It.More()) aShapeShell = It.Value();
361 if (aShapeShell.IsNull() || aShapeShell.ShapeType() != TopAbs_SHELL) {
362 Standard_NullObject::Raise("Shape for solid construction is null or not a shell");
365 BRepCheck_Shell chkShell(TopoDS::Shell(aShapeShell));
366 if (chkShell.Closed() == BRepCheck_NotClosed) return 0;
370 B.Add(Sol, aShapeShell);
371 BRepClass3d_SolidClassifier SC (Sol);
372 SC.PerformInfinitePoint(Precision::Confusion());
373 if (SC.State() == TopAbs_IN) {
375 B.Add(Sol, aShapeShell.Reversed());
381 else if (aType == SOLID_SHELLS) {
382 Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
383 unsigned int ind, nbshapes = aShapes->Length();
384 Standard_Integer ish = 0;
389 for (ind = 1; ind <= nbshapes; ind++) {
390 Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aShapes->Value(ind));
391 TopoDS_Shape aShapeShell = aRefShape->GetValue();
392 if (aShapeShell.IsNull()) {
393 Standard_NullObject::Raise("Shell for solid construction is null");
395 if (aShapeShell.ShapeType() == TopAbs_COMPOUND) {
396 TopoDS_Iterator It (aShapeShell, Standard_True, Standard_True);
397 if (It.More()) aShapeShell = It.Value();
399 if (aShapeShell.ShapeType() == TopAbs_SHELL) {
400 B.Add(Sol, aShapeShell);
404 if (ish == 0) return 0;
405 BRepClass3d_SolidClassifier SC (Sol);
406 SC.PerformInfinitePoint(Precision::Confusion());
407 if (SC.State() == TopAbs_IN)
408 aShape = Sol.Reversed();
412 else if (aType == COMPOUND_SHAPES) {
413 Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
414 unsigned int ind, nbshapes = aShapes->Length();
419 for (ind = 1; ind <= nbshapes; ind++) {
420 Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aShapes->Value(ind));
421 TopoDS_Shape aShape_i = aRefShape->GetValue();
422 if (aShape_i.IsNull()) {
423 Standard_NullObject::Raise("Shape for compound construction is null");
432 else if (aType == REVERSE_ORIENTATION) {
433 Handle(GEOM_Function) aRefShape = aCI.GetBase();
434 TopoDS_Shape aShape_i = aRefShape->GetValue();
435 if (aShape_i.IsNull()) {
436 Standard_NullObject::Raise("Shape for reverse is null");
439 BRepBuilderAPI_Copy Copy(aShape_i);
440 if( Copy.IsDone() ) {
441 TopoDS_Shape tds = Copy.Shape();
443 Standard_ConstructionError::Raise("Orientation aborted : Can not reverse the shape");
446 if( tds.Orientation() == TopAbs_FORWARD)
447 tds.Orientation(TopAbs_REVERSED);
449 tds.Orientation(TopAbs_FORWARD);
455 else if (aType == EDGE_WIRE) {
456 Handle(GEOM_Function) aRefBase = aCI.GetBase();
457 TopoDS_Shape aWire = aRefBase->GetValue();
458 Standard_Real LinTol = aCI.GetTolerance();
459 Standard_Real AngTol = aCI.GetAngularTolerance();
460 if (aWire.IsNull()) Standard_NullObject::Raise("Argument Wire is null");
462 aShape = MakeEdgeFromWire(aWire, LinTol, AngTol);
464 else if (aType == EDGE_CURVE_LENGTH) {
465 GEOMImpl_IVector aVI (aFunction);
468 Handle(GEOM_Function) aRefCurve = aVI.GetPoint1();
469 if (aRefCurve.IsNull()) Standard_NullObject::Raise("Argument Curve is null");
470 TopoDS_Shape aRefShape1 = aRefCurve->GetValue();
471 if (aRefShape1.ShapeType() != TopAbs_EDGE) {
472 Standard_TypeMismatch::Raise
473 ("Edge On Curve creation aborted : curve shape is not an edge");
475 TopoDS_Edge aRefEdge = TopoDS::Edge(aRefShape1);
476 TopoDS_Vertex V1, V2;
477 TopExp::Vertices(aRefEdge, V1, V2, Standard_True);
480 TopoDS_Vertex aRefVertex;
481 Handle(GEOM_Function) aRefPoint = aVI.GetPoint2();
482 if (aRefPoint.IsNull()) {
486 TopoDS_Shape aRefShape2 = aRefPoint->GetValue();
487 if (aRefShape2.ShapeType() != TopAbs_VERTEX) {
488 Standard_TypeMismatch::Raise
489 ("Edge On Curve creation aborted : start point shape is not a vertex");
491 aRefVertex = TopoDS::Vertex(aRefShape2);
493 gp_Pnt aRefPnt = BRep_Tool::Pnt(aRefVertex);
496 Standard_Real aLength = aVI.GetParameter();
497 //Standard_Real aCurveLength = IntTools::Length(aRefEdge);
498 //if (aLength > aCurveLength) {
499 // Standard_ConstructionError::Raise
500 // ("Edge On Curve creation aborted : given length is greater than edges length");
502 if (fabs(aLength) < Precision::Confusion()) {
503 Standard_ConstructionError::Raise
504 ("Edge On Curve creation aborted : given length is smaller than Precision::Confusion()");
508 Standard_Real UFirst, ULast;
509 Handle(Geom_Curve) EdgeCurve = BRep_Tool::Curve(aRefEdge, UFirst, ULast);
510 Handle(Geom_Curve) ReOrientedCurve = EdgeCurve;
512 Standard_Real dU = ULast - UFirst;
513 Standard_Real par1 = UFirst + 0.1 * dU;
514 Standard_Real par2 = ULast - 0.1 * dU;
516 gp_Pnt P1 = EdgeCurve->Value(par1);
517 gp_Pnt P2 = EdgeCurve->Value(par2);
519 if (aRefPnt.SquareDistance(P2) < aRefPnt.SquareDistance(P1)) {
520 ReOrientedCurve = EdgeCurve->Reversed();
521 UFirst = EdgeCurve->ReversedParameter(ULast);
524 // Get the point by length
525 GeomAdaptor_Curve AdapCurve = GeomAdaptor_Curve(ReOrientedCurve);
526 GCPnts_AbscissaPoint anAbsPnt (AdapCurve, aLength, UFirst);
527 Standard_Real aParam = anAbsPnt.Parameter();
529 if (AdapCurve.IsClosed() && aLength < 0.0) {
530 Standard_Real aTmp = aParam;
535 BRepBuilderAPI_MakeEdge aME (ReOrientedCurve, UFirst, aParam);
537 aShape = aME.Shape();
538 } else if (aType == SHAPE_ISOLINE) {
539 GEOMImpl_IIsoline aII (aFunction);
540 Handle(GEOM_Function) aRefFace = aII.GetFace();
541 TopoDS_Shape aShapeFace = aRefFace->GetValue();
543 if (aShapeFace.ShapeType() == TopAbs_FACE) {
544 TopoDS_Face aFace = TopoDS::Face(aShapeFace);
545 bool isUIso = aII.GetIsUIso();
546 Standard_Real aParam = aII.GetParameter();
547 Standard_Real U1,U2,V1,V2;
549 // Construct a real geometric parameter.
550 aFace.Orientation(TopAbs_FORWARD);
551 ShapeAnalysis::GetFaceUVBounds(aFace,U1,U2,V1,V2);
554 aParam = U1 + (U2 - U1)*aParam;
556 aParam = V1 + (V2 - V1)*aParam;
559 aShape = MakeIsoline(aFace, isUIso, aParam);
561 Standard_NullObject::Raise
562 ("Shape for isoline construction is not a face");
568 if (aShape.IsNull()) return 0;
570 // Check shape validity
571 BRepCheck_Analyzer ana (aShape, false);
572 if (!ana.IsValid()) {
573 //Standard_ConstructionError::Raise("Algorithm have produced an invalid shape result");
574 // For Mantis issue 0021772: EDF 2336 GEOM: Non valid face created from two circles
575 Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape (aShape);
577 aShape = aSfs->Shape();
580 aFunction->SetValue(aShape);
582 log.SetTouched(Label());
584 if (!aWarning.IsEmpty())
585 Standard_Failure::Raise(aWarning.ToCString());
590 TopoDS_Wire GEOMImpl_ShapeDriver::MakeWireFromEdges(const Handle(TColStd_HSequenceOfTransient)& theEdgesFuncs,
591 const Standard_Real theTolerance)
599 for (unsigned int ind = 1; ind <= theEdgesFuncs->Length(); ind++) {
600 Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(theEdgesFuncs->Value(ind));
601 TopoDS_Shape aShape_i = aRefShape->GetValue();
602 if (aShape_i.IsNull()) {
603 Standard_NullObject::Raise("Shape for wire construction is null");
605 if (aShape_i.ShapeType() == TopAbs_EDGE || aShape_i.ShapeType() == TopAbs_WIRE) {
606 TopExp_Explorer exp (aShape_i, TopAbs_EDGE);
607 for (; exp.More(); exp.Next())
608 B.Add(aWire, TopoDS::Edge(exp.Current()));
610 Standard_TypeMismatch::Raise
611 ("Shape for wire construction is neither an edge nor a wire");
616 Handle(ShapeFix_Wire) aFW = new ShapeFix_Wire;
620 if (aFW->StatusReorder(ShapeExtend_FAIL1)) {
621 Standard_ConstructionError::Raise("Wire construction failed: several loops detected");
623 else if (aFW->StatusReorder(ShapeExtend_FAIL)) {
624 Standard_ConstructionError::Raise("Wire construction failed");
629 // IMP 0019766: Building a Wire from unconnected edges by introducing a tolerance
630 aFW->ClosedWireMode() = Standard_False;
631 aFW->FixConnected(theTolerance);
632 if (aFW->StatusConnected(ShapeExtend_FAIL)) {
633 Standard_ConstructionError::Raise("Wire construction failed: cannot build connected wire");
636 if (aFW->StatusConnected(ShapeExtend_DONE3)) {
637 // Confused with <prec> but not Analyzer.Precision(), set the same
638 aFW->FixGapsByRangesMode() = Standard_True;
639 if (aFW->FixGaps3d()) {
640 Handle(ShapeExtend_WireData) sbwd = aFW->WireData();
641 Handle(ShapeFix_Edge) aFe = new ShapeFix_Edge;
642 for (Standard_Integer iedge = 1; iedge <= sbwd->NbEdges(); iedge++) {
643 TopoDS_Edge aEdge = TopoDS::Edge(sbwd->Edge(iedge));
644 aFe->FixVertexTolerance(aEdge);
645 aFe->FixSameParameter(aEdge);
648 else if (aFW->StatusGaps3d(ShapeExtend_FAIL)) {
649 Standard_ConstructionError::Raise("Wire construction failed: cannot fix 3d gaps");
652 aWire = aFW->WireAPIMake();
657 TopoDS_Edge GEOMImpl_ShapeDriver::MakeEdgeFromWire(const TopoDS_Shape& aWire,
658 const Standard_Real LinTol,
659 const Standard_Real AngTol)
663 BRepLib::BuildCurves3d(aWire);
664 Handle(ShapeFix_Shape) Fixer = new ShapeFix_Shape(aWire);
665 Fixer->SetPrecision(LinTol);
666 Fixer->SetMaxTolerance(LinTol);
668 TopoDS_Wire theWire = TopoDS::Wire(Fixer->Shape());
670 TColGeom_SequenceOfCurve CurveSeq;
671 TopTools_SequenceOfShape LocSeq;
672 TColStd_SequenceOfReal FparSeq;
673 TColStd_SequenceOfReal LparSeq;
674 TColStd_SequenceOfReal TolSeq;
675 GeomAbs_CurveType CurType;
676 TopoDS_Vertex FirstVertex, LastVertex;
678 BRepTools_WireExplorer wexp(theWire) ;
679 for (; wexp.More(); wexp.Next())
681 TopoDS_Edge anEdge = wexp.Current();
682 Standard_Real fpar, lpar;
683 TopLoc_Location aLoc;
684 Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aLoc, fpar, lpar);
688 BRepAdaptor_Curve BAcurve(anEdge);
689 GeomAbs_CurveType aType = BAcurve.GetType();
691 Handle(Geom_Curve) aBasisCurve = BAcurve.Curve().Curve();
693 if (aBasisCurve->IsPeriodic())
694 ElCLib::AdjustPeriodic(aBasisCurve->FirstParameter(), aBasisCurve->LastParameter(),
695 Precision::PConfusion(), fpar, lpar);
697 if (CurveSeq.IsEmpty())
699 CurveSeq.Append(aCurve);
700 TopoDS_Shape aLocShape;
701 aLocShape.Location(aLoc);
702 aLocShape.Orientation(wexp.Orientation());
703 LocSeq.Append(aLocShape);
704 FparSeq.Append(fpar);
705 LparSeq.Append(lpar);
707 FirstVertex = wexp.CurrentVertex();
711 Standard_Boolean Done = Standard_False;
712 Standard_Real NewFpar, NewLpar;
713 GeomAdaptor_Curve GAprevcurve(CurveSeq.Last());
714 TopoDS_Vertex CurVertex = wexp.CurrentVertex();
715 TopoDS_Vertex CurFirstVer = TopExp::FirstVertex(anEdge);
716 TopAbs_Orientation ConnectByOrigin = (CurVertex.IsSame(CurFirstVer))? TopAbs_FORWARD : TopAbs_REVERSED;
717 if (aCurve == CurveSeq.Last())
721 if (aBasisCurve->IsPeriodic())
723 if (NewLpar < NewFpar)
724 NewLpar += aBasisCurve->Period();
725 if (ConnectByOrigin == TopAbs_FORWARD)
726 ElCLib::AdjustPeriodic(FparSeq.Last(),
727 FparSeq.Last() + aBasisCurve->Period(),
728 Precision::PConfusion(), NewFpar, NewLpar);
730 ElCLib::AdjustPeriodic(FparSeq.Last() - aBasisCurve->Period(),
732 Precision::PConfusion(), NewFpar, NewLpar);
734 Done = Standard_True;
736 else if (aType == CurType &&
737 aType != GeomAbs_BezierCurve &&
738 aType != GeomAbs_BSplineCurve &&
739 aType != GeomAbs_OtherCurve)
745 gp_Lin aLine = BAcurve.Line();
746 gp_Lin PrevLine = GAprevcurve.Line();
747 if (aLine.Contains(PrevLine.Location(), LinTol) &&
748 aLine.Direction().IsParallel(PrevLine.Direction(), AngTol))
750 gp_Pnt P1 = ElCLib::Value(fpar, aLine);
751 gp_Pnt P2 = ElCLib::Value(lpar, aLine);
752 NewFpar = ElCLib::Parameter(PrevLine, P1);
753 NewLpar = ElCLib::Parameter(PrevLine, P2);
754 if (NewLpar < NewFpar)
756 Standard_Real MemNewFpar = NewFpar;
758 NewLpar = MemNewFpar;
759 ConnectByOrigin = TopAbs::Reverse(ConnectByOrigin);
761 Done = Standard_True;
767 gp_Circ aCircle = BAcurve.Circle();
768 gp_Circ PrevCircle = GAprevcurve.Circle();
769 if (aCircle.Location().Distance(PrevCircle.Location()) <= LinTol &&
770 Abs(aCircle.Radius() - PrevCircle.Radius()) <= LinTol &&
771 aCircle.Axis().IsParallel(PrevCircle.Axis(), AngTol))
773 if (aCircle.Axis().Direction() * PrevCircle.Axis().Direction() < 0.)
775 Standard_Real memfpar = fpar;
778 ConnectByOrigin = TopAbs::Reverse(ConnectByOrigin);
780 gp_Pnt P1 = ElCLib::Value(fpar, aCircle);
781 gp_Pnt P2 = ElCLib::Value(lpar, aCircle);
782 NewFpar = ElCLib::Parameter(PrevCircle, P1);
783 NewLpar = ElCLib::Parameter(PrevCircle, P2);
784 if (NewLpar < NewFpar)
786 //Standard_Real MemNewFpar = NewFpar, MemNewLpar = NewLpar;
787 if (ConnectByOrigin == TopAbs_FORWARD)
788 ElCLib::AdjustPeriodic(FparSeq.Last(),
789 FparSeq.Last() + 2.*M_PI,
790 Precision::PConfusion(), NewFpar, NewLpar);
792 ElCLib::AdjustPeriodic(FparSeq.Last() - 2.*M_PI,
794 Precision::PConfusion(), NewFpar, NewLpar);
795 Done = Standard_True;
799 case GeomAbs_Ellipse:
801 gp_Elips anEllipse = BAcurve.Ellipse();
802 gp_Elips PrevEllipse = GAprevcurve.Ellipse();
803 if (anEllipse.Focus1().Distance(PrevEllipse.Focus1()) <= LinTol &&
804 anEllipse.Focus2().Distance(PrevEllipse.Focus2()) <= LinTol &&
805 Abs(anEllipse.MajorRadius() - PrevEllipse.MajorRadius()) <= LinTol &&
806 Abs(anEllipse.MinorRadius() - PrevEllipse.MinorRadius()) <= LinTol &&
807 anEllipse.Axis().IsParallel(PrevEllipse.Axis(), AngTol))
809 if (anEllipse.Axis().Direction() * PrevEllipse.Axis().Direction() < 0.)
811 Standard_Real memfpar = fpar;
814 ConnectByOrigin = TopAbs::Reverse(ConnectByOrigin);
816 gp_Pnt P1 = ElCLib::Value(fpar, anEllipse);
817 gp_Pnt P2 = ElCLib::Value(lpar, anEllipse);
818 NewFpar = ElCLib::Parameter(PrevEllipse, P1);
819 NewLpar = ElCLib::Parameter(PrevEllipse, P2);
820 if (NewLpar < NewFpar)
822 if (ConnectByOrigin == TopAbs_FORWARD)
823 ElCLib::AdjustPeriodic(FparSeq.Last(),
824 FparSeq.Last() + 2.*M_PI,
825 Precision::PConfusion(), NewFpar, NewLpar);
827 ElCLib::AdjustPeriodic(FparSeq.Last() - 2.*M_PI,
829 Precision::PConfusion(), NewFpar, NewLpar);
830 Done = Standard_True;
834 case GeomAbs_Hyperbola:
836 gp_Hypr aHypr = BAcurve.Hyperbola();
837 gp_Hypr PrevHypr = GAprevcurve.Hyperbola();
838 if (aHypr.Focus1().Distance(PrevHypr.Focus1()) <= LinTol &&
839 aHypr.Focus2().Distance(PrevHypr.Focus2()) <= LinTol &&
840 Abs(aHypr.MajorRadius() - PrevHypr.MajorRadius()) <= LinTol &&
841 Abs(aHypr.MinorRadius() - PrevHypr.MinorRadius()) <= LinTol &&
842 aHypr.Axis().IsParallel(PrevHypr.Axis(), AngTol))
844 gp_Pnt P1 = ElCLib::Value(fpar, aHypr);
845 gp_Pnt P2 = ElCLib::Value(lpar, aHypr);
846 NewFpar = ElCLib::Parameter(PrevHypr, P1);
847 NewLpar = ElCLib::Parameter(PrevHypr, P2);
848 if (NewLpar < NewFpar)
850 Standard_Real MemNewFpar = NewFpar;
852 NewLpar = MemNewFpar;
853 ConnectByOrigin = TopAbs::Reverse(ConnectByOrigin);
855 Done = Standard_True;
859 case GeomAbs_Parabola:
861 gp_Parab aParab = BAcurve.Parabola();
862 gp_Parab PrevParab = GAprevcurve.Parabola();
863 if (aParab.Location().Distance(PrevParab.Location()) <= LinTol &&
864 aParab.Focus().Distance(PrevParab.Focus()) <= LinTol &&
865 Abs(aParab.Focal() - PrevParab.Focal()) <= LinTol &&
866 aParab.Axis().IsParallel(PrevParab.Axis(), AngTol))
868 gp_Pnt P1 = ElCLib::Value(fpar, aParab);
869 gp_Pnt P2 = ElCLib::Value(lpar, aParab);
870 NewFpar = ElCLib::Parameter(PrevParab, P1);
871 NewLpar = ElCLib::Parameter(PrevParab, P2);
872 if (NewLpar < NewFpar)
874 Standard_Real MemNewFpar = NewFpar;
876 NewLpar = MemNewFpar;
877 ConnectByOrigin = TopAbs::Reverse(ConnectByOrigin);
879 Done = Standard_True;
883 } //end of switch (aType)
884 } // end of else if (aType == CurType && ...
887 if (NewFpar < FparSeq.Last())
888 FparSeq(FparSeq.Length()) = NewFpar;
890 LparSeq(LparSeq.Length()) = NewLpar;
894 CurveSeq.Append(aCurve);
895 TopoDS_Shape aLocShape;
896 aLocShape.Location(aLoc);
897 aLocShape.Orientation(wexp.Orientation());
898 LocSeq.Append(aLocShape);
899 FparSeq.Append(fpar);
900 LparSeq.Append(lpar);
901 TolSeq.Append(BRep_Tool::Tolerance(CurVertex));
904 } // end of else (CurveSeq.IsEmpty()) -> not first time
905 } // end for (; wexp.More(); wexp.Next())
907 LastVertex = wexp.CurrentVertex();
908 TolSeq.Append(BRep_Tool::Tolerance(LastVertex));
910 FirstVertex.Orientation(TopAbs_FORWARD);
911 LastVertex.Orientation(TopAbs_REVERSED);
913 if (!CurveSeq.IsEmpty())
915 Standard_Integer nb_curve = CurveSeq.Length(); //number of curves
916 TColGeom_Array1OfBSplineCurve tab(0,nb_curve-1); //array of the curves
917 TColStd_Array1OfReal tabtolvertex(0,nb_curve-1); //(0,nb_curve-2); //array of the tolerances
923 for (i = 1; i <= nb_curve; i++)
925 if (CurveSeq(i)->IsInstance(STANDARD_TYPE(Geom_TrimmedCurve)))
926 CurveSeq(i) = (*((Handle(Geom_TrimmedCurve)*)&(CurveSeq(i))))->BasisCurve();
928 Handle(Geom_TrimmedCurve) aTrCurve = new Geom_TrimmedCurve(CurveSeq(i), FparSeq(i), LparSeq(i));
929 tab(i-1) = GeomConvert::CurveToBSplineCurve(aTrCurve);
930 tab(i-1)->Transform(LocSeq(i).Location().Transformation());
931 GeomConvert::C0BSplineToC1BSplineCurve(tab(i-1), Precision::Confusion());
932 if (LocSeq(i).Orientation() == TopAbs_REVERSED)
936 //char* name = new char[100];
937 //sprintf(name, "c%d", i);
938 //DrawTrSurf::Set(name, tab(i-1));
941 tabtolvertex(i-2) = TolSeq(i-1);
942 } // end for (i = 1; i <= nb_curve; i++)
943 tabtolvertex(nb_curve-1) = TolSeq(TolSeq.Length());
945 Standard_Boolean closed_flag = Standard_False;
946 Standard_Real closed_tolerance = 0.;
947 if (FirstVertex.IsSame(LastVertex) &&
948 GeomLProp::Continuity(tab(0), tab(nb_curve-1),
949 tab(0)->FirstParameter(),
950 tab(nb_curve-1)->LastParameter(),
951 Standard_False, Standard_False, LinTol, AngTol) >= GeomAbs_G1)
953 closed_flag = Standard_True ;
954 closed_tolerance = BRep_Tool::Tolerance(FirstVertex);
957 Handle(TColGeom_HArray1OfBSplineCurve) concatcurve; //array of the concatenated curves
958 Handle(TColStd_HArray1OfInteger) ArrayOfIndices; //array of the remining Vertex
959 GeomConvert::ConcatC1(tab,
964 closed_tolerance); //C1 concatenation
966 if (concatcurve->Length() > 1)
968 GeomConvert_CompCurveToBSplineCurve Concat(concatcurve->Value(concatcurve->Lower()));
970 for (i = concatcurve->Lower()+1; i <= concatcurve->Upper(); i++)
971 Concat.Add( concatcurve->Value(i), LinTol, Standard_True );
973 concatcurve->SetValue(concatcurve->Lower(), Concat.BSplineCurve());
975 // rnc : prevents the driver from building an edge without C1 continuity
976 if (concatcurve->Value(concatcurve->Lower())->Continuity()==GeomAbs_C0){
977 Standard_ConstructionError::Raise("Construction aborted : The given Wire has sharp bends between some Edges, no valid Edge can be built");
980 Standard_Boolean isValidEndVtx = Standard_True;
983 // Check if closed curve is reordered.
984 Handle(Geom_Curve) aCurve = concatcurve->Value(concatcurve->Lower());
985 Standard_Real aFPar = aCurve->FirstParameter();
987 gp_Pnt aPntVtx = BRep_Tool::Pnt(FirstVertex);
988 Standard_Real aTolVtx = BRep_Tool::Tolerance(FirstVertex);
990 aCurve->D0(aFPar, aPFirst);
992 if (!aPFirst.IsEqual(aPntVtx, aTolVtx)) {
993 // The curve is reordered. Find the new first and last vertices.
994 TopTools_IndexedMapOfShape aMapVtx;
995 TopExp::MapShapes(theWire, TopAbs_VERTEX, aMapVtx);
997 const Standard_Integer aNbVtx = aMapVtx.Extent();
998 Standard_Integer iVtx;
1000 for (iVtx = 1; iVtx <= aNbVtx; iVtx++) {
1001 const TopoDS_Vertex aVtx = TopoDS::Vertex(aMapVtx.FindKey(iVtx));
1002 const gp_Pnt aPnt = BRep_Tool::Pnt(aVtx);
1003 const Standard_Real aTol = BRep_Tool::Tolerance(aVtx);
1005 if (aPFirst.IsEqual(aPnt, aTol)) {
1006 // The coinsident vertex is found.
1009 FirstVertex.Orientation(TopAbs_FORWARD);
1010 LastVertex.Orientation(TopAbs_REVERSED);
1015 if (iVtx > aNbVtx) {
1016 // It is necessary to create new vertices.
1017 isValidEndVtx = Standard_False;
1022 if (isValidEndVtx) {
1023 ResEdge = BRepLib_MakeEdge(concatcurve->Value(concatcurve->Lower()),
1024 FirstVertex, LastVertex,
1025 concatcurve->Value(concatcurve->Lower())->FirstParameter(),
1026 concatcurve->Value(concatcurve->Lower())->LastParameter());
1028 ResEdge = BRepLib_MakeEdge(concatcurve->Value(concatcurve->Lower()),
1029 concatcurve->Value(concatcurve->Lower())->FirstParameter(),
1030 concatcurve->Value(concatcurve->Lower())->LastParameter());
1035 if (CurveSeq(1)->IsInstance(STANDARD_TYPE(Geom_TrimmedCurve)))
1036 CurveSeq(1) = (*((Handle(Geom_TrimmedCurve)*)&(CurveSeq(1))))->BasisCurve();
1038 Handle(Geom_Curve) aNewCurve =
1039 Handle(Geom_Curve)::DownCast(CurveSeq(1)->Copy());
1041 aNewCurve->Transform(LocSeq(1).Location().Transformation());
1043 if (LocSeq(1).Orientation() == TopAbs_REVERSED) {
1044 const TopoDS_Vertex aVtxTmp = FirstVertex;
1046 FirstVertex = LastVertex;
1047 LastVertex = aVtxTmp;
1048 FirstVertex.Orientation(TopAbs_FORWARD);
1049 LastVertex.Orientation(TopAbs_REVERSED);
1052 ResEdge = BRepLib_MakeEdge(aNewCurve,
1053 FirstVertex, LastVertex,
1054 FparSeq(1), LparSeq(1));
1056 if (LocSeq(1).Orientation() == TopAbs_REVERSED) {
1065 //=============================================================================
1067 * \brief Returns an isoline for a face.
1069 //=============================================================================
1071 TopoDS_Shape GEOMImpl_ShapeDriver::MakeIsoline
1072 (const TopoDS_Face &theFace,
1074 const double theParameter) const
1076 TopoDS_Shape aResult;
1077 GEOMUtils_Hatcher aHatcher(theFace);
1078 const GeomAbs_IsoType aType = (IsUIso ? GeomAbs_IsoU : GeomAbs_IsoV);
1080 aHatcher.Init(aType, theParameter);
1083 if (!aHatcher.IsDone()) {
1084 Standard_ConstructionError::Raise("MakeIsoline : Hatcher failure");
1087 const Handle(TColStd_HArray1OfInteger) &anIndices =
1088 (IsUIso ? aHatcher.GetUIndices() : aHatcher.GetVIndices());
1090 if (anIndices.IsNull()) {
1091 Standard_ConstructionError::Raise("MakeIsoline : Null hatching indices");
1094 const Standard_Integer anIsoInd = anIndices->Lower();
1095 const Standard_Integer aHatchingIndex = anIndices->Value(anIsoInd);
1097 if (aHatchingIndex == 0) {
1098 Standard_ConstructionError::Raise("MakeIsoline : Invalid hatching index");
1101 const Standard_Integer aNbDomains =
1102 aHatcher.GetNbDomains(aHatchingIndex);
1104 if (aNbDomains < 0) {
1105 Standard_ConstructionError::Raise("MakeIsoline : Invalid number of domains");
1108 // The hatching is performed successfully. Create the 3d Curve.
1109 Handle(Geom_Surface) aSurface = BRep_Tool::Surface(theFace);
1110 Handle(Geom_Curve) anIsoCurve = (IsUIso ?
1111 aSurface->UIso(theParameter) : aSurface->VIso(theParameter));
1112 Handle(Geom2d_Curve) aPIsoCurve =
1113 aHatcher.GetHatching(aHatchingIndex);
1114 const Standard_Real aTol = Precision::Confusion();
1115 Standard_Integer anIDom = 1;
1118 BRep_Builder aBuilder;
1119 Standard_Integer aNbEdges = 0;
1121 for (; anIDom <= aNbDomains; anIDom++) {
1122 if (aHatcher.GetDomain(aHatchingIndex, anIDom, aV1, aV2)) {
1123 // Check first and last parameters.
1124 if (!aHatcher.IsDomainInfinite(aHatchingIndex, anIDom)) {
1126 TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge(anIsoCurve, aV1, aV2);
1128 // Update it with a parametric curve on face.
1129 aBuilder.UpdateEdge(anEdge, aPIsoCurve, theFace, aTol);
1133 // Result is a compond.
1134 if (aNbEdges == 2) {
1135 // Create a new compound.
1136 TopoDS_Compound aCompound;
1138 aBuilder.MakeCompound(aCompound);
1139 aBuilder.Add(aCompound, aResult);
1140 aResult = aCompound;
1143 // Add an edge to the compound.
1144 aBuilder.Add(aResult, anEdge);
1146 // Result is the edge.
1153 if (aNbEdges == 0) {
1154 Standard_ConstructionError::Raise("MakeIsoline : Empty result");
1160 //================================================================================
1162 * \brief Returns a name of creation operation and names and values of creation parameters
1164 //================================================================================
1166 bool GEOMImpl_ShapeDriver::
1167 GetCreationInformation(std::string& theOperationName,
1168 std::vector<GEOM_Param>& theParams)
1170 if (Label().IsNull()) return 0;
1171 Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label());
1173 GEOMImpl_IShapes aCI( function );
1174 Standard_Integer aType = function->GetType();
1178 theOperationName = "WIRE";
1179 AddParam( theParams, "Wires/edges", aCI.GetShapes() );
1180 AddParam( theParams, "Tolerance", aCI.GetTolerance() );
1183 theOperationName = "FACE";
1184 AddParam( theParams, "Wire/edge", aCI.GetBase() );
1185 AddParam( theParams, "Is planar wanted", aCI.GetIsPlanar() );
1188 theOperationName = "FACE";
1189 AddParam( theParams, "Wires/edges", aCI.GetShapes() );
1190 AddParam( theParams, "Is planar wanted", aCI.GetIsPlanar() );
1193 theOperationName = "SHELL";
1194 AddParam( theParams, "Objects", aCI.GetShapes() );
1198 theOperationName = "SOLID";
1199 AddParam( theParams, "Objects", aCI.GetShapes() );
1201 case COMPOUND_SHAPES:
1202 theOperationName = "COMPOUND";
1203 AddParam( theParams, "Objects", aCI.GetShapes() );
1206 theOperationName = "EDGE";
1207 AddParam( theParams, "Wire", aCI.GetBase() );
1208 AddParam( theParams, "Linear Tolerance", aCI.GetTolerance() );
1209 AddParam( theParams, "Angular Tolerance", aCI.GetAngularTolerance() );
1211 case EDGE_CURVE_LENGTH:
1212 theOperationName = "EDGE";
1214 GEOMImpl_IVector aCI( function );
1215 AddParam( theParams, "Edge", aCI.GetPoint1() );
1216 AddParam( theParams, "Start point", aCI.GetPoint2() );
1217 AddParam( theParams, "Length", aCI.GetParameter() );
1220 case SHAPES_ON_SHAPE:
1222 theOperationName = "GetShapesOnShapeAsCompound";
1223 Handle(TColStd_HSequenceOfTransient) shapes = aCI.GetShapes();
1224 if ( !shapes.IsNull() && shapes->Length() > 0 )
1225 AddParam( theParams, "Check shape", shapes->Value(1) );
1226 if ( !shapes.IsNull() && shapes->Length() > 1 )
1227 AddParam( theParams, "Shape", shapes->Value(2) );
1228 AddParam( theParams, "Shape type", TopAbs_ShapeEnum( aCI.GetSubShapeType() ));
1229 AddParam( theParams, "State", TopAbs_State((int) aCI.GetTolerance() ));
1234 GEOMImpl_IIsoline aII (function);
1236 theOperationName = "ISOLINE";
1237 AddParam(theParams, "Face", aII.GetFace());
1238 AddParam(theParams, "Isoline type", (aII.GetIsUIso() ? "U" : "V"));
1239 AddParam(theParams, "Parameter", aII.GetParameter());
1249 IMPLEMENT_STANDARD_HANDLE (GEOMImpl_ShapeDriver,GEOM_BaseDriver);
1250 IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_ShapeDriver,GEOM_BaseDriver);
1252 //modified by NIZNHY-PKV Wed Dec 28 13:48:31 2011f
1253 #include <TopoDS_Iterator.hxx>
1254 #include <TopTools_HSequenceOfShape.hxx>
1255 #include <ShapeAnalysis_FreeBounds.hxx>
1256 #include <TopTools_MapOfShape.hxx>
1257 #include <TopTools_MapOfOrientedShape.hxx>
1258 #include <BRep_Builder.hxx>
1259 #include <TopoDS_Wire.hxx>
1261 //=======================================================================
1262 //function : KeepEdgesOrder
1264 //=======================================================================
1266 void KeepEdgesOrder(const Handle(TopTools_HSequenceOfShape)& aEdges,
1267 const Handle(TopTools_HSequenceOfShape)& aWires)
1269 Standard_Integer aNbWires, aNbEdges;
1271 if (aEdges.IsNull()) {
1275 if (aWires.IsNull()) {
1279 aNbEdges=aEdges->Length();
1280 aNbWires=aWires->Length();
1281 if (!aNbEdges || !aNbWires) {
1285 Standard_Boolean bClosed;
1286 Standard_Integer i, j;
1288 TopoDS_Iterator aIt;
1290 TopTools_MapOfOrientedShape aMEx;
1292 for (i=1; i<=aNbWires; ++i) {
1293 const TopoDS_Shape& aWx=aWires->Value(i);
1296 aIt.Initialize (aWx);
1297 for (; aIt.More(); aIt.Next()) {
1298 const TopoDS_Shape& aEx=aIt.Value();
1303 for (j=1; j<=aNbEdges; ++j) {
1304 const TopoDS_Shape& aE=aEdges->Value(j);
1305 if (aMEx.Contains(aE)) {
1310 bClosed=aWx.Closed();
1311 aWy.Closed(bClosed);
1313 aWires->Append(aWy);
1314 }// for (i=1; i<=aNbWires; ++i) {
1316 aWires->Remove(1, aNbWires);
1319 //modified by NIZNHY-PKV Wed Dec 28 13:48:34 2011t