1 // Copyright (C) 2007-2010 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.
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 // File: BlockFix_UnionFaces.cxx
24 // Created: Tue Dec 7 17:15:42 2004
25 // Author: Pavel DURANDIN
27 #include <BlockFix_UnionFaces.ixx>
29 #include <ShapeAnalysis_WireOrder.hxx>
30 #include <ShapeAnalysis_Edge.hxx>
32 #include <ShapeBuild_Edge.hxx>
33 #include <ShapeBuild_ReShape.hxx>
35 #include <ShapeExtend_WireData.hxx>
36 #include <ShapeExtend_CompositeSurface.hxx>
38 #include <ShapeFix_Face.hxx>
39 #include <ShapeFix_ComposeShell.hxx>
40 #include <ShapeFix_SequenceOfWireSegment.hxx>
41 #include <ShapeFix_WireSegment.hxx>
42 #include <ShapeFix_Wire.hxx>
43 #include <ShapeFix_Edge.hxx>
45 #include <IntPatch_TheIIIntOfIntersection.hxx>
47 #include <BRep_Tool.hxx>
48 #include <BRep_Builder.hxx>
49 #include <BRepTools.hxx>
50 #include <BRepTopAdaptor_TopolTool.hxx>
53 #include <TopExp_Explorer.hxx>
55 #include <TopTools_SequenceOfShape.hxx>
56 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
57 #include <TopTools_ListOfShape.hxx>
58 #include <TopTools_ListIteratorOfListOfShape.hxx>
59 #include <TopTools_MapOfShape.hxx>
60 #include <TopTools_MapIteratorOfMapOfShape.hxx>
63 #include <TopoDS_Edge.hxx>
64 #include <TopoDS_Wire.hxx>
65 #include <TopoDS_Face.hxx>
66 #include <TopoDS_Solid.hxx>
67 #include <TopoDS_Vertex.hxx>
68 #include <TopoDS_Shell.hxx>
69 #include <TopoDS_Iterator.hxx>
71 #include <TColGeom_HArray2OfSurface.hxx>
73 #include <GeomAdaptor_HSurface.hxx>
74 #include <GeomLib_IsPlanarSurface.hxx>
76 #include <Geom_Surface.hxx>
77 #include <Geom_Plane.hxx>
78 #include <Geom_OffsetSurface.hxx>
79 #include <Geom_SphericalSurface.hxx>
80 #include <Geom_CylindricalSurface.hxx>
81 #include <Geom_SurfaceOfRevolution.hxx>
82 #include <Geom_SurfaceOfLinearExtrusion.hxx>
83 #include <Geom_RectangularTrimmedSurface.hxx>
85 #include <Geom_Curve.hxx>
86 #include <Geom_Line.hxx>
87 #include <Geom_Circle.hxx>
89 #include <Geom2d_Line.hxx>
92 #include <gp_Pnt2d.hxx>
94 #include <Standard_Failure.hxx>
95 #include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
97 //=======================================================================
98 //function : BlockFix_UnionFaces
100 //=======================================================================
102 BlockFix_UnionFaces::BlockFix_UnionFaces()
103 : myTolerance(Precision::Confusion()),
109 //=======================================================================
110 //function : GetTolerance
112 //=======================================================================
114 Standard_Real& BlockFix_UnionFaces::GetTolerance()
120 //=======================================================================
121 //function : GetOptimumNbFaces
123 //=======================================================================
125 Standard_Integer& BlockFix_UnionFaces::GetOptimumNbFaces()
127 return myOptimumNbFaces;
131 //=======================================================================
132 //function : AddOrdinaryEdges
134 //=======================================================================
135 // adds edges from the shape to the sequence
136 // seams and equal edges are dropped
137 // Returns true if one of original edges dropped
138 static Standard_Boolean AddOrdinaryEdges(TopTools_SequenceOfShape& edges,
139 const TopoDS_Shape aShape,
140 Standard_Integer& anIndex)
143 TopTools_MapOfShape aNewEdges;
144 //add edges without seams
145 for(TopExp_Explorer exp(aShape,TopAbs_EDGE); exp.More(); exp.Next()) {
146 TopoDS_Shape edge = exp.Current();
147 if(aNewEdges.Contains(edge))
148 aNewEdges.Remove(edge);
153 Standard_Boolean isDropped = Standard_False;
154 //merge edges and drop seams
155 for(Standard_Integer i = 1; i <= edges.Length(); i++) {
156 TopoDS_Shape current = edges(i);
157 if(aNewEdges.Contains(current)) {
159 aNewEdges.Remove(current);
164 isDropped = Standard_True;
170 //add edges to the sequemce
171 for(TopTools_MapIteratorOfMapOfShape anIter(aNewEdges); anIter.More(); anIter.Next())
172 edges.Append(anIter.Key());
178 //=======================================================================
179 //function : ClearRts
181 //=======================================================================
182 static Handle(Geom_Surface) ClearRts(const Handle(Geom_Surface)& aSurface)
184 if(aSurface->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) {
185 Handle(Geom_RectangularTrimmedSurface) rts =
186 Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurface);
187 return rts->BasisSurface();
193 //=======================================================================
196 //=======================================================================
198 TopoDS_Shape BlockFix_UnionFaces::Perform(const TopoDS_Shape& Shape)
200 Handle(ShapeBuild_ReShape) myContext = new ShapeBuild_ReShape;
201 TopoDS_Shape aResShape = myContext->Apply(Shape);
203 // processing each solid
204 TopExp_Explorer exps;
205 for (exps.Init(Shape, TopAbs_SOLID); exps.More(); exps.Next()) {
206 TopoDS_Solid aSolid = TopoDS::Solid(exps.Current());
208 // creating map of edge faces
209 TopTools_IndexedDataMapOfShapeListOfShape aMapEdgeFaces;
210 TopExp::MapShapesAndAncestors(aSolid, TopAbs_EDGE, TopAbs_FACE, aMapEdgeFaces);
212 // map of processed shapes
213 TopTools_MapOfShape aProcessed;
215 Handle(ShapeBuild_ReShape) aContext = new ShapeBuild_ReShape;
217 Standard_Integer NbModif = 0;
218 Standard_Boolean hasFailed = Standard_False;
219 Standard_Real tol = Min(Max(Precision::Confusion(), myTolerance/10.), 0.1);
224 TopTools_MapOfShape mapF;
225 for (exp.Init(aSolid, TopAbs_FACE); exp.More(); exp.Next()) {
226 if (mapF.Add(exp.Current()))
230 bool doUnion = ((myOptimumNbFaces == 0) ||
231 ((myOptimumNbFaces > 0) && (nbf > myOptimumNbFaces)));
233 // processing each face
235 for (exp.Init(aSolid, TopAbs_FACE); exp.More() && doUnion; exp.Next()) {
236 TopoDS_Face aFace = TopoDS::Face(exp.Current().Oriented(TopAbs_FORWARD));
238 if (aProcessed.Contains(aFace))
241 Standard_Integer dummy;
242 TopTools_SequenceOfShape edges;
243 AddOrdinaryEdges(edges,aFace,dummy);
245 TopTools_SequenceOfShape faces;
248 //surface and location to construct result
249 TopLoc_Location aBaseLocation;
250 Handle(Geom_Surface) aBaseSurface = BRep_Tool::Surface(aFace,aBaseLocation);
251 aBaseSurface = ClearRts(aBaseSurface);
253 // find adjacent faces to union
255 for (i = 1; i <= edges.Length(); i++) {
256 TopoDS_Edge edge = TopoDS::Edge(edges(i));
257 if (BRep_Tool::Degenerated(edge))
260 const TopTools_ListOfShape& aList = aMapEdgeFaces.FindFromKey(edge);
261 TopTools_ListIteratorOfListOfShape anIter(aList);
262 for (; anIter.More(); anIter.Next()) {
263 TopoDS_Face anCheckedFace = TopoDS::Face(anIter.Value().Oriented(TopAbs_FORWARD));
264 if (anCheckedFace.IsSame(aFace))
267 if (aProcessed.Contains(anCheckedFace))
270 if (IsSameDomain(aFace,anCheckedFace)) {
272 if (aList.Extent() != 2) {
273 // non mainfold case is not processed
278 TopoDS_Face aMockUpFace;
280 B.MakeFace(aMockUpFace,aBaseSurface,aBaseLocation,0.);
281 MovePCurves(aMockUpFace,anCheckedFace);
283 if (AddOrdinaryEdges(edges,aMockUpFace,dummy)) {
284 // sequence edges is modified
288 faces.Append(anCheckedFace);
289 aProcessed.Add(anCheckedFace);
295 // all faces collected in the sequence. Perform union of faces
296 if (faces.Length() > 1) {
300 B.MakeFace(aResult,aBaseSurface,aBaseLocation,0);
301 Standard_Integer nbWires = 0;
304 while (edges.Length()>0) {
306 Standard_Boolean isEdge3d = Standard_False;
308 TopTools_MapOfShape aVertices;
312 TopoDS_Edge anEdge = TopoDS::Edge(edges(1));
315 isEdge3d |= !BRep_Tool::Degenerated(anEdge);
318 TopExp::Vertices(anEdge,V1,V2);
322 Standard_Boolean isNewFound = Standard_False;
324 isNewFound = Standard_False;
325 for(Standard_Integer j = 1; j <= edges.Length(); j++) {
326 anEdge = TopoDS::Edge(edges(j));
327 TopExp::Vertices(anEdge,V1,V2);
328 if(aVertices.Contains(V1) || aVertices.Contains(V2)) {
329 isEdge3d |= !BRep_Tool::Degenerated(anEdge);
335 isNewFound = Standard_True;
338 } while (isNewFound);
340 // sorting any type of edges
341 aWire = TopoDS::Wire(aContext->Apply(aWire));
343 TopoDS_Face tmpF = TopoDS::Face(aContext->Apply(faces(1).Oriented(TopAbs_FORWARD)));
344 Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire(aWire,tmpF,Precision::Confusion());
346 Standard_Boolean isDegRemoved = Standard_False;
347 if(!sfw->StatusReorder ( ShapeExtend_FAIL )) {
348 // clear degenerated edges if at least one with 3d curve exist
350 Handle(ShapeExtend_WireData) sewd = sfw->WireData();
351 for(Standard_Integer j = 1; j<=sewd->NbEdges();j++) {
352 TopoDS_Edge E = sewd->Edge(j);
353 if(BRep_Tool::Degenerated(E)) {
355 isDegRemoved = Standard_True;
362 sfw->FixDegenerated();
364 TopoDS_Wire aWireFixed = sfw->Wire();
365 aContext->Replace(aWire,aWireFixed);
366 // add resulting wire
368 B.Add(aResult,aWireFixed);
372 Handle(ShapeExtend_WireData) sbwd = sfw->WireData();
373 Standard_Integer nbEdges = sbwd->NbEdges();
374 // sort degenerated edges and create one edge instead of several ones
375 ShapeAnalysis_WireOrder sawo(Standard_False, 0);
376 ShapeAnalysis_Edge sae;
377 Standard_Integer aLastEdge = nbEdges;
378 for(Standard_Integer j = 1; j <= nbEdges; j++) {
380 //smh protection on NULL pcurve
381 Handle(Geom2d_Curve) c2d;
382 if(!sae.PCurve(sbwd->Edge(j),tmpF,c2d,f,l)) {
386 sawo.Add(c2d->Value(f).XY(),c2d->Value(l).XY());
390 // constructind one degenerative edge
391 gp_XY aStart, anEnd, tmp;
392 Standard_Integer nbFirst = sawo.Ordered(1);
393 TopoDS_Edge anOrigE = TopoDS::Edge(sbwd->Edge(nbFirst).Oriented(TopAbs_FORWARD));
395 TopoDS_Vertex aDummyV;
396 TopoDS_Edge E = sbe.CopyReplaceVertices(anOrigE,aDummyV,aDummyV);
397 sawo.XY(nbFirst,aStart,tmp);
398 sawo.XY(sawo.Ordered(aLastEdge),tmp,anEnd);
400 gp_XY aVec = anEnd-aStart;
401 Handle(Geom2d_Line) aLine = new Geom2d_Line(aStart,gp_Dir2d(anEnd-aStart));
403 B.UpdateEdge(E,aLine,tmpF,0.);
404 B.Range(E,tmpF,0.,aVec.Modulus());
405 Handle(Geom_Curve) C3d;
406 B.UpdateEdge(E,C3d,0.);
407 B.Degenerated(E,Standard_True);
415 // perform substitution of face
416 aContext->Replace(aContext->Apply(aFace),aResult);
418 ShapeFix_Face sff (aResult);
419 //Intializing by tolerances
420 sff.SetPrecision(myTolerance);
421 sff.SetMinTolerance(tol);
422 sff.SetMaxTolerance(Max(1.,myTolerance*1000.));
424 sff.FixOrientationMode() = 0;
425 //sff.FixWireMode() = 0;
426 sff.SetContext(aContext);
427 // Applying the fixes
429 if(sff.Status(ShapeExtend_FAIL))
430 hasFailed = Standard_True;
432 // breaking down to several faces
433 TopoDS_Shape theResult = aContext->Apply(aResult);
434 for (TopExp_Explorer aFaceExp (theResult,TopAbs_FACE); aFaceExp.More(); aFaceExp.Next()) {
435 TopoDS_Face aCurrent = TopoDS::Face(aFaceExp.Current().Oriented(TopAbs_FORWARD));
436 Handle(TColGeom_HArray2OfSurface) grid = new TColGeom_HArray2OfSurface ( 1, 1, 1, 1 );
437 grid->SetValue ( 1, 1, aBaseSurface );
438 Handle(ShapeExtend_CompositeSurface) G = new ShapeExtend_CompositeSurface ( grid );
439 ShapeFix_ComposeShell CompShell;
440 CompShell.Init ( G, aBaseLocation, aCurrent, ::Precision::Confusion() );//myPrecision
441 CompShell.SetContext( aContext );
443 TopTools_SequenceOfShape parts;
444 ShapeFix_SequenceOfWireSegment wires;
445 for(TopExp_Explorer W_Exp(aCurrent,TopAbs_WIRE);W_Exp.More();W_Exp.Next()) {
446 Handle(ShapeExtend_WireData) sbwd =
447 new ShapeExtend_WireData ( TopoDS::Wire(W_Exp.Current() ));
448 ShapeFix_WireSegment seg ( sbwd, TopAbs_REVERSED );
452 CompShell.DispatchWires ( parts,wires );
453 for (Standard_Integer j=1; j <= parts.Length(); j++ ) {
454 ShapeFix_Face aFixOrient(TopoDS::Face(parts(j)));
455 aFixOrient.SetContext(aContext);
456 aFixOrient.FixOrientation();
459 TopoDS_Shape CompRes;
460 if ( faces.Length() !=1 ) {
463 for ( i=1; i <= parts.Length(); i++ )
464 B.Add ( S, parts(i) );
467 else CompRes = parts(1);
469 aContext->Replace(aCurrent,CompRes);
472 // remove the remaining faces
473 for(i = 2; i <= faces.Length(); i++)
474 aContext->Remove(faces(i));
476 } // end processing each face
478 //TopoDS_Shape aResult = Shape;
479 if (NbModif > 0 && !hasFailed) {
480 TopoDS_Shape aResult = aContext->Apply(aSolid);
483 for (exp.Init(aResult,TopAbs_EDGE); exp.More(); exp.Next()) {
484 TopoDS_Edge E = TopoDS::Edge(exp.Current());
485 sfe.FixVertexTolerance (E);
486 // ptv add fix same parameter
487 sfe.FixSameParameter(E, myTolerance);
490 myContext->Replace(aSolid, aResult);
494 for (exp.Init(aSolid, TopAbs_FACE); exp.More(); exp.Next()) {
495 TopoDS_Face aFace = TopoDS::Face(exp.Current().Oriented(TopAbs_FORWARD));
496 Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire;
497 sfw->SetContext(myContext);
498 sfw->SetPrecision(myTolerance);
499 sfw->SetMinTolerance(myTolerance);
500 sfw->SetMaxTolerance(Max(1.,myTolerance*1000.));
502 for (TopoDS_Iterator iter (aFace,Standard_False); iter.More(); iter.Next()) {
503 TopoDS_Wire wire = TopoDS::Wire(iter.Value());
510 } // end processing each solid
512 aResShape = myContext->Apply(Shape);
517 //=======================================================================
518 //function : IsSameDomain
520 //=======================================================================
522 bool getCylinder (Handle(Geom_Surface)& theInSurface, gp_Cylinder& theOutCylinder)
524 bool isCylinder = false;
526 if (theInSurface->IsKind(STANDARD_TYPE(Geom_CylindricalSurface))) {
527 Handle(Geom_CylindricalSurface) aGC = Handle(Geom_CylindricalSurface)::DownCast(theInSurface);
529 theOutCylinder = aGC->Cylinder();
532 else if (theInSurface->IsKind(STANDARD_TYPE(Geom_SurfaceOfRevolution))) {
533 Handle(Geom_SurfaceOfRevolution) aRS =
534 Handle(Geom_SurfaceOfRevolution)::DownCast(theInSurface);
535 Handle(Geom_Curve) aBasis = aRS->BasisCurve();
536 if (aBasis->IsKind(STANDARD_TYPE(Geom_Line))) {
537 Handle(Geom_Line) aBasisLine = Handle(Geom_Line)::DownCast(aBasis);
538 gp_Dir aDir = aRS->Direction();
539 gp_Dir aBasisDir = aBasisLine->Position().Direction();
540 if (aBasisDir.IsParallel(aDir, Precision::Confusion())) {
541 // basis line is parallel to the revolution axis: it is a cylinder
542 gp_Pnt aLoc = aRS->Location();
543 Standard_Real aR = aBasisLine->Lin().Distance(aLoc);
544 gp_Ax3 aCylAx (aLoc, aDir);
546 theOutCylinder = gp_Cylinder(aCylAx, aR);
551 else if (theInSurface->IsKind(STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion))) {
552 Handle(Geom_SurfaceOfLinearExtrusion) aLES =
553 Handle(Geom_SurfaceOfLinearExtrusion)::DownCast(theInSurface);
554 Handle(Geom_Curve) aBasis = aLES->BasisCurve();
555 if (aBasis->IsKind(STANDARD_TYPE(Geom_Circle))) {
556 Handle(Geom_Circle) aBasisCircle = Handle(Geom_Circle)::DownCast(aBasis);
557 gp_Dir aDir = aLES->Direction();
558 gp_Dir aBasisDir = aBasisCircle->Position().Direction();
559 if (aBasisDir.IsParallel(aDir, Precision::Confusion())) {
560 // basis circle is normal to the extrusion axis: it is a cylinder
561 gp_Pnt aLoc = aBasisCircle->Location();
562 Standard_Real aR = aBasisCircle->Radius();
563 gp_Ax3 aCylAx (aLoc, aDir);
565 theOutCylinder = gp_Cylinder(aCylAx, aR);
576 Standard_Boolean BlockFix_UnionFaces::IsSameDomain(const TopoDS_Face& aFace,
577 const TopoDS_Face& aCheckedFace) const
579 //checking the same handles
580 TopLoc_Location L1, L2;
581 Handle(Geom_Surface) S1, S2;
583 S1 = BRep_Tool::Surface(aFace,L1);
584 S2 = BRep_Tool::Surface(aCheckedFace,L2);
586 if (S1 == S2 && L1 == L2)
589 // planar and cylindrical cases (IMP 20052)
590 Standard_Real aPrec = Precision::Confusion();
592 S1 = BRep_Tool::Surface(aFace);
593 S2 = BRep_Tool::Surface(aCheckedFace);
598 //Handle(Geom_OffsetSurface) aGOFS1, aGOFS2;
599 //aGOFS1 = Handle(Geom_OffsetSurface)::DownCast(S1);
600 //aGOFS2 = Handle(Geom_OffsetSurface)::DownCast(S2);
601 //if (!aGOFS1.IsNull()) S1 = aGOFS1->BasisSurface();
602 //if (!aGOFS2.IsNull()) S2 = aGOFS2->BasisSurface();
604 // case of two elementary surfaces: use OCCT tool
605 // elementary surfaces: ConicalSurface, CylindricalSurface,
606 // Plane, SphericalSurface and ToroidalSurface
607 if (S1->IsKind(STANDARD_TYPE(Geom_ElementarySurface)) &&
608 S2->IsKind(STANDARD_TYPE(Geom_ElementarySurface)))
610 Handle(GeomAdaptor_HSurface) aGA1 = new GeomAdaptor_HSurface(S1);
611 Handle(GeomAdaptor_HSurface) aGA2 = new GeomAdaptor_HSurface(S2);
613 Handle(BRepTopAdaptor_TopolTool) aTT1 = new BRepTopAdaptor_TopolTool();
614 Handle(BRepTopAdaptor_TopolTool) aTT2 = new BRepTopAdaptor_TopolTool();
617 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
620 IntPatch_TheIIIntOfIntersection anIIInt (aGA1, aTT1, aGA2, aTT2, aPrec, aPrec);
621 if (!anIIInt.IsDone() || anIIInt.IsEmpty())
624 return anIIInt.TangentFaces();
626 catch (Standard_Failure) {
631 // case of two planar surfaces:
632 // all kinds of surfaces checked, including b-spline and bezier
633 GeomLib_IsPlanarSurface aPlanarityChecker1 (S1, aPrec);
634 if (aPlanarityChecker1.IsPlanar()) {
635 GeomLib_IsPlanarSurface aPlanarityChecker2 (S2, aPrec);
636 if (aPlanarityChecker2.IsPlanar()) {
637 gp_Pln aPln1 = aPlanarityChecker1.Plan();
638 gp_Pln aPln2 = aPlanarityChecker2.Plan();
640 if (aPln1.Position().Direction().IsParallel(aPln2.Position().Direction(), aPrec) &&
641 aPln1.Distance(aPln2) < aPrec) {
647 // case of two cylindrical surfaces, at least one of which is a swept surface
648 // swept surfaces: SurfaceOfLinearExtrusion, SurfaceOfRevolution
649 if ((S1->IsKind(STANDARD_TYPE(Geom_CylindricalSurface)) ||
650 S1->IsKind(STANDARD_TYPE(Geom_SweptSurface))) &&
651 (S2->IsKind(STANDARD_TYPE(Geom_CylindricalSurface)) ||
652 S2->IsKind(STANDARD_TYPE(Geom_SweptSurface))))
654 gp_Cylinder aCyl1, aCyl2;
655 if (getCylinder(S1, aCyl1) && getCylinder(S2, aCyl2)) {
656 if (fabs(aCyl1.Radius() - aCyl2.Radius()) < aPrec) {
657 gp_Dir aDir1 = aCyl1.Position().Direction();
658 gp_Dir aDir2 = aCyl2.Position().Direction();
659 if (aDir1.IsParallel(aDir2, aPrec)) {
660 gp_Pnt aLoc1 = aCyl1.Location();
661 gp_Pnt aLoc2 = aCyl2.Location();
662 gp_Vec aVec12 (aLoc1, aLoc2);
663 if (aVec12.SquareMagnitude() < aPrec*aPrec ||
664 aVec12.IsParallel(aDir1, aPrec)) {
676 //=======================================================================
677 //function : MovePCurves
679 //=======================================================================
681 void BlockFix_UnionFaces::MovePCurves(TopoDS_Face& aTarget,
682 const TopoDS_Face& aSource) const
685 for(TopExp_Explorer wexp(aSource,TopAbs_WIRE);wexp.More();wexp.Next()) {
686 Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire(TopoDS::Wire(wexp.Current()),
687 aTarget, Precision::Confusion());
689 Standard_Boolean isReoredFailed = sfw->StatusReorder ( ShapeExtend_FAIL );
690 sfw->FixEdgeCurves();
695 sfw->FixDegenerated();
697 // remove degenerated edges from not degenerated points
698 ShapeAnalysis_Edge sae;
699 Handle(ShapeExtend_WireData) sewd = sfw->WireData();
700 for(Standard_Integer i = 1; i<=sewd->NbEdges();i++) {
701 TopoDS_Edge E = sewd->Edge(i);
702 if(BRep_Tool::Degenerated(E)&&!sae.HasPCurve(E,aTarget)) {
708 TopoDS_Wire ResWire = sfw->Wire();
709 B.Add(aTarget,ResWire);