1 // Copyright (C) 2007-2008 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
22 // File: BlockFix_UnionFaces.cxx
23 // Created: Tue Dec 7 17:15:42 2004
24 // Author: Pavel DURANDIN
26 #include <BlockFix_UnionFaces.ixx>
28 #include <ShapeAnalysis_WireOrder.hxx>
29 #include <ShapeAnalysis_Edge.hxx>
31 #include <ShapeBuild_Edge.hxx>
32 #include <ShapeBuild_ReShape.hxx>
34 #include <ShapeExtend_WireData.hxx>
35 #include <ShapeExtend_CompositeSurface.hxx>
37 #include <ShapeFix_Face.hxx>
38 #include <ShapeFix_ComposeShell.hxx>
39 #include <ShapeFix_SequenceOfWireSegment.hxx>
40 #include <ShapeFix_WireSegment.hxx>
41 #include <ShapeFix_Wire.hxx>
42 #include <ShapeFix_Edge.hxx>
44 #include <IntPatch_TheIIIntOfIntersection.hxx>
46 #include <BRep_Tool.hxx>
47 #include <BRep_Builder.hxx>
48 #include <BRepTools.hxx>
49 #include <BRepTopAdaptor_TopolTool.hxx>
52 #include <TopExp_Explorer.hxx>
54 #include <TopTools_SequenceOfShape.hxx>
55 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
56 #include <TopTools_ListOfShape.hxx>
57 #include <TopTools_ListIteratorOfListOfShape.hxx>
58 #include <TopTools_MapOfShape.hxx>
59 #include <TopTools_MapIteratorOfMapOfShape.hxx>
62 #include <TopoDS_Edge.hxx>
63 #include <TopoDS_Wire.hxx>
64 #include <TopoDS_Face.hxx>
65 #include <TopoDS_Solid.hxx>
66 #include <TopoDS_Vertex.hxx>
67 #include <TopoDS_Shell.hxx>
68 #include <TopoDS_Iterator.hxx>
70 #include <TColGeom_HArray2OfSurface.hxx>
72 #include <GeomAdaptor_HSurface.hxx>
73 #include <GeomLib_IsPlanarSurface.hxx>
75 #include <Geom_Surface.hxx>
76 #include <Geom_Plane.hxx>
77 #include <Geom_OffsetSurface.hxx>
78 #include <Geom_SphericalSurface.hxx>
79 #include <Geom_CylindricalSurface.hxx>
80 #include <Geom_SurfaceOfRevolution.hxx>
81 #include <Geom_SurfaceOfLinearExtrusion.hxx>
82 #include <Geom_RectangularTrimmedSurface.hxx>
84 #include <Geom_Curve.hxx>
85 #include <Geom_Line.hxx>
86 #include <Geom_Circle.hxx>
88 #include <Geom2d_Line.hxx>
91 #include <gp_Pnt2d.hxx>
93 #include <Standard_Failure.hxx>
94 #include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
96 //=======================================================================
97 //function : BlockFix_UnionFaces
99 //=======================================================================
101 BlockFix_UnionFaces::BlockFix_UnionFaces()
102 : myTolerance(Precision::Confusion()),
108 //=======================================================================
109 //function : GetTolerance
111 //=======================================================================
113 Standard_Real& BlockFix_UnionFaces::GetTolerance()
119 //=======================================================================
120 //function : GetOptimumNbFaces
122 //=======================================================================
124 Standard_Integer& BlockFix_UnionFaces::GetOptimumNbFaces()
126 return myOptimumNbFaces;
130 //=======================================================================
131 //function : AddOrdinaryEdges
133 //=======================================================================
134 // adds edges from the shape to the sequence
135 // seams and equal edges are dropped
136 // Returns true if one of original edges dropped
137 static Standard_Boolean AddOrdinaryEdges(TopTools_SequenceOfShape& edges,
138 const TopoDS_Shape aShape,
139 Standard_Integer& anIndex)
142 TopTools_MapOfShape aNewEdges;
143 //add edges without seams
144 for(TopExp_Explorer exp(aShape,TopAbs_EDGE); exp.More(); exp.Next()) {
145 TopoDS_Shape edge = exp.Current();
146 if(aNewEdges.Contains(edge))
147 aNewEdges.Remove(edge);
152 Standard_Boolean isDropped = Standard_False;
153 //merge edges and drop seams
154 for(Standard_Integer i = 1; i <= edges.Length(); i++) {
155 TopoDS_Shape current = edges(i);
156 if(aNewEdges.Contains(current)) {
158 aNewEdges.Remove(current);
163 isDropped = Standard_True;
169 //add edges to the sequemce
170 for(TopTools_MapIteratorOfMapOfShape anIter(aNewEdges); anIter.More(); anIter.Next())
171 edges.Append(anIter.Key());
177 //=======================================================================
178 //function : ClearRts
180 //=======================================================================
181 static Handle(Geom_Surface) ClearRts(const Handle(Geom_Surface)& aSurface)
183 if(aSurface->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) {
184 Handle(Geom_RectangularTrimmedSurface) rts =
185 Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurface);
186 return rts->BasisSurface();
192 //=======================================================================
195 //=======================================================================
197 TopoDS_Shape BlockFix_UnionFaces::Perform(const TopoDS_Shape& Shape)
199 Handle(ShapeBuild_ReShape) myContext = new ShapeBuild_ReShape;
200 TopoDS_Shape aResShape = myContext->Apply(Shape);
202 // processing each solid
203 TopExp_Explorer exps;
204 for (exps.Init(Shape, TopAbs_SOLID); exps.More(); exps.Next()) {
205 TopoDS_Solid aSolid = TopoDS::Solid(exps.Current());
207 // creating map of edge faces
208 TopTools_IndexedDataMapOfShapeListOfShape aMapEdgeFaces;
209 TopExp::MapShapesAndAncestors(aSolid, TopAbs_EDGE, TopAbs_FACE, aMapEdgeFaces);
211 // map of processed shapes
212 TopTools_MapOfShape aProcessed;
214 Handle(ShapeBuild_ReShape) aContext = new ShapeBuild_ReShape;
216 Standard_Integer NbModif = 0;
217 Standard_Boolean hasFailed = Standard_False;
218 Standard_Real tol = Min(Max(Precision::Confusion(), myTolerance/10.), 0.1);
223 TopTools_MapOfShape mapF;
224 for (exp.Init(aSolid, TopAbs_FACE); exp.More(); exp.Next()) {
225 if (mapF.Add(exp.Current()))
229 bool doUnion = ((myOptimumNbFaces == 0) ||
230 ((myOptimumNbFaces > 0) && (nbf > myOptimumNbFaces)));
232 // processing each face
234 for (exp.Init(aSolid, TopAbs_FACE); exp.More() && doUnion; exp.Next()) {
235 TopoDS_Face aFace = TopoDS::Face(exp.Current().Oriented(TopAbs_FORWARD));
237 if (aProcessed.Contains(aFace))
240 Standard_Integer dummy;
241 TopTools_SequenceOfShape edges;
242 AddOrdinaryEdges(edges,aFace,dummy);
244 TopTools_SequenceOfShape faces;
247 //surface and location to construct result
248 TopLoc_Location aBaseLocation;
249 Handle(Geom_Surface) aBaseSurface = BRep_Tool::Surface(aFace,aBaseLocation);
250 aBaseSurface = ClearRts(aBaseSurface);
252 // find adjacent faces to union
254 for (i = 1; i <= edges.Length(); i++) {
255 TopoDS_Edge edge = TopoDS::Edge(edges(i));
256 if (BRep_Tool::Degenerated(edge))
259 const TopTools_ListOfShape& aList = aMapEdgeFaces.FindFromKey(edge);
260 TopTools_ListIteratorOfListOfShape anIter(aList);
261 for (; anIter.More(); anIter.Next()) {
262 TopoDS_Face anCheckedFace = TopoDS::Face(anIter.Value().Oriented(TopAbs_FORWARD));
263 if (anCheckedFace.IsSame(aFace))
266 if (aProcessed.Contains(anCheckedFace))
269 if (IsSameDomain(aFace,anCheckedFace)) {
271 if (aList.Extent() != 2) {
272 // non mainfold case is not processed
277 TopoDS_Face aMockUpFace;
279 B.MakeFace(aMockUpFace,aBaseSurface,aBaseLocation,0.);
280 MovePCurves(aMockUpFace,anCheckedFace);
282 if (AddOrdinaryEdges(edges,aMockUpFace,dummy)) {
283 // sequence edges is modified
287 faces.Append(anCheckedFace);
288 aProcessed.Add(anCheckedFace);
294 // all faces collected in the sequence. Perform union of faces
295 if (faces.Length() > 1) {
299 B.MakeFace(aResult,aBaseSurface,aBaseLocation,0);
300 Standard_Integer nbWires = 0;
303 while (edges.Length()>0) {
305 Standard_Boolean isEdge3d = Standard_False;
307 TopTools_MapOfShape aVertices;
311 TopoDS_Edge anEdge = TopoDS::Edge(edges(1));
314 isEdge3d |= !BRep_Tool::Degenerated(anEdge);
317 TopExp::Vertices(anEdge,V1,V2);
321 Standard_Boolean isNewFound = Standard_False;
323 isNewFound = Standard_False;
324 for(Standard_Integer j = 1; j <= edges.Length(); j++) {
325 anEdge = TopoDS::Edge(edges(j));
326 TopExp::Vertices(anEdge,V1,V2);
327 if(aVertices.Contains(V1) || aVertices.Contains(V2)) {
328 isEdge3d |= !BRep_Tool::Degenerated(anEdge);
334 isNewFound = Standard_True;
337 } while (isNewFound);
339 // sorting any type of edges
340 aWire = TopoDS::Wire(aContext->Apply(aWire));
342 TopoDS_Face tmpF = TopoDS::Face(aContext->Apply(faces(1).Oriented(TopAbs_FORWARD)));
343 Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire(aWire,tmpF,Precision::Confusion());
345 Standard_Boolean isDegRemoved = Standard_False;
346 if(!sfw->StatusReorder ( ShapeExtend_FAIL )) {
347 // clear degenerated edges if at least one with 3d curve exist
349 Handle(ShapeExtend_WireData) sewd = sfw->WireData();
350 for(Standard_Integer j = 1; j<=sewd->NbEdges();j++) {
351 TopoDS_Edge E = sewd->Edge(j);
352 if(BRep_Tool::Degenerated(E)) {
354 isDegRemoved = Standard_True;
361 sfw->FixDegenerated();
363 TopoDS_Wire aWireFixed = sfw->Wire();
364 aContext->Replace(aWire,aWireFixed);
365 // add resulting wire
367 B.Add(aResult,aWireFixed);
371 Handle(ShapeExtend_WireData) sbwd = sfw->WireData();
372 Standard_Integer nbEdges = sbwd->NbEdges();
373 // sort degenerated edges and create one edge instead of several ones
374 ShapeAnalysis_WireOrder sawo(Standard_False, 0);
375 ShapeAnalysis_Edge sae;
376 Standard_Integer aLastEdge = nbEdges;
377 for(Standard_Integer j = 1; j <= nbEdges; j++) {
379 //smh protection on NULL pcurve
380 Handle(Geom2d_Curve) c2d;
381 if(!sae.PCurve(sbwd->Edge(j),tmpF,c2d,f,l)) {
385 sawo.Add(c2d->Value(f).XY(),c2d->Value(l).XY());
389 // constructind one degenerative edge
390 gp_XY aStart, anEnd, tmp;
391 Standard_Integer nbFirst = sawo.Ordered(1);
392 TopoDS_Edge anOrigE = TopoDS::Edge(sbwd->Edge(nbFirst).Oriented(TopAbs_FORWARD));
394 TopoDS_Vertex aDummyV;
395 TopoDS_Edge E = sbe.CopyReplaceVertices(anOrigE,aDummyV,aDummyV);
396 sawo.XY(nbFirst,aStart,tmp);
397 sawo.XY(sawo.Ordered(aLastEdge),tmp,anEnd);
399 gp_XY aVec = anEnd-aStart;
400 Handle(Geom2d_Line) aLine = new Geom2d_Line(aStart,gp_Dir2d(anEnd-aStart));
402 B.UpdateEdge(E,aLine,tmpF,0.);
403 B.Range(E,tmpF,0.,aVec.Modulus());
404 Handle(Geom_Curve) C3d;
405 B.UpdateEdge(E,C3d,0.);
406 B.Degenerated(E,Standard_True);
414 // perform substitution of face
415 aContext->Replace(aContext->Apply(aFace),aResult);
417 ShapeFix_Face sff (aResult);
418 //Intializing by tolerances
419 sff.SetPrecision(myTolerance);
420 sff.SetMinTolerance(tol);
421 sff.SetMaxTolerance(Max(1.,myTolerance*1000.));
423 sff.FixOrientationMode() = 0;
424 //sff.FixWireMode() = 0;
425 sff.SetContext(aContext);
426 // Applying the fixes
428 if(sff.Status(ShapeExtend_FAIL))
429 hasFailed = Standard_True;
431 // breaking down to several faces
432 TopoDS_Shape theResult = aContext->Apply(aResult);
433 for (TopExp_Explorer aFaceExp (theResult,TopAbs_FACE); aFaceExp.More(); aFaceExp.Next()) {
434 TopoDS_Face aCurrent = TopoDS::Face(aFaceExp.Current().Oriented(TopAbs_FORWARD));
435 Handle(TColGeom_HArray2OfSurface) grid = new TColGeom_HArray2OfSurface ( 1, 1, 1, 1 );
436 grid->SetValue ( 1, 1, aBaseSurface );
437 Handle(ShapeExtend_CompositeSurface) G = new ShapeExtend_CompositeSurface ( grid );
438 ShapeFix_ComposeShell CompShell;
439 CompShell.Init ( G, aBaseLocation, aCurrent, ::Precision::Confusion() );//myPrecision
440 CompShell.SetContext( aContext );
442 TopTools_SequenceOfShape parts;
443 ShapeFix_SequenceOfWireSegment wires;
444 for(TopExp_Explorer W_Exp(aCurrent,TopAbs_WIRE);W_Exp.More();W_Exp.Next()) {
445 Handle(ShapeExtend_WireData) sbwd =
446 new ShapeExtend_WireData ( TopoDS::Wire(W_Exp.Current() ));
447 ShapeFix_WireSegment seg ( sbwd, TopAbs_REVERSED );
451 CompShell.DispatchWires ( parts,wires );
452 for (Standard_Integer j=1; j <= parts.Length(); j++ ) {
453 ShapeFix_Face aFixOrient(TopoDS::Face(parts(j)));
454 aFixOrient.SetContext(aContext);
455 aFixOrient.FixOrientation();
458 TopoDS_Shape CompRes;
459 if ( faces.Length() !=1 ) {
462 for ( i=1; i <= parts.Length(); i++ )
463 B.Add ( S, parts(i) );
466 else CompRes = parts(1);
468 aContext->Replace(aCurrent,CompRes);
471 // remove the remaining faces
472 for(i = 2; i <= faces.Length(); i++)
473 aContext->Remove(faces(i));
475 } // end processing each face
477 //TopoDS_Shape aResult = Shape;
478 if (NbModif > 0 && !hasFailed) {
479 TopoDS_Shape aResult = aContext->Apply(aSolid);
482 for (exp.Init(aResult,TopAbs_EDGE); exp.More(); exp.Next()) {
483 TopoDS_Edge E = TopoDS::Edge(exp.Current());
484 sfe.FixVertexTolerance (E);
485 // ptv add fix same parameter
486 sfe.FixSameParameter(E, myTolerance);
489 myContext->Replace(aSolid, aResult);
493 for (exp.Init(aSolid, TopAbs_FACE); exp.More(); exp.Next()) {
494 TopoDS_Face aFace = TopoDS::Face(exp.Current().Oriented(TopAbs_FORWARD));
495 Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire;
496 sfw->SetContext(myContext);
497 sfw->SetPrecision(myTolerance);
498 sfw->SetMinTolerance(myTolerance);
499 sfw->SetMaxTolerance(Max(1.,myTolerance*1000.));
501 for (TopoDS_Iterator iter (aFace,Standard_False); iter.More(); iter.Next()) {
502 TopoDS_Wire wire = TopoDS::Wire(iter.Value());
509 } // end processing each solid
511 aResShape = myContext->Apply(Shape);
516 //=======================================================================
517 //function : IsSameDomain
519 //=======================================================================
521 bool getCylinder (Handle(Geom_Surface)& theInSurface, gp_Cylinder& theOutCylinder)
523 bool isCylinder = false;
525 if (theInSurface->IsKind(STANDARD_TYPE(Geom_CylindricalSurface))) {
526 Handle(Geom_CylindricalSurface) aGC = Handle(Geom_CylindricalSurface)::DownCast(theInSurface);
528 theOutCylinder = aGC->Cylinder();
531 else if (theInSurface->IsKind(STANDARD_TYPE(Geom_SurfaceOfRevolution))) {
532 Handle(Geom_SurfaceOfRevolution) aRS =
533 Handle(Geom_SurfaceOfRevolution)::DownCast(theInSurface);
534 Handle(Geom_Curve) aBasis = aRS->BasisCurve();
535 if (aBasis->IsKind(STANDARD_TYPE(Geom_Line))) {
536 Handle(Geom_Line) aBasisLine = Handle(Geom_Line)::DownCast(aBasis);
537 gp_Dir aDir = aRS->Direction();
538 gp_Dir aBasisDir = aBasisLine->Position().Direction();
539 if (aBasisDir.IsParallel(aDir, Precision::Confusion())) {
540 // basis line is parallel to the revolution axis: it is a cylinder
541 gp_Pnt aLoc = aRS->Location();
542 Standard_Real aR = aBasisLine->Lin().Distance(aLoc);
543 gp_Ax3 aCylAx (aLoc, aDir);
545 theOutCylinder = gp_Cylinder(aCylAx, aR);
550 else if (theInSurface->IsKind(STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion))) {
551 Handle(Geom_SurfaceOfLinearExtrusion) aLES =
552 Handle(Geom_SurfaceOfLinearExtrusion)::DownCast(theInSurface);
553 Handle(Geom_Curve) aBasis = aLES->BasisCurve();
554 if (aBasis->IsKind(STANDARD_TYPE(Geom_Circle))) {
555 Handle(Geom_Circle) aBasisCircle = Handle(Geom_Circle)::DownCast(aBasis);
556 gp_Dir aDir = aLES->Direction();
557 gp_Dir aBasisDir = aBasisCircle->Position().Direction();
558 if (aBasisDir.IsParallel(aDir, Precision::Confusion())) {
559 // basis circle is normal to the extrusion axis: it is a cylinder
560 gp_Pnt aLoc = aBasisCircle->Location();
561 Standard_Real aR = aBasisCircle->Radius();
562 gp_Ax3 aCylAx (aLoc, aDir);
564 theOutCylinder = gp_Cylinder(aCylAx, aR);
575 Standard_Boolean BlockFix_UnionFaces::IsSameDomain(const TopoDS_Face& aFace,
576 const TopoDS_Face& aCheckedFace) const
578 //checking the same handles
579 TopLoc_Location L1, L2;
580 Handle(Geom_Surface) S1, S2;
582 S1 = BRep_Tool::Surface(aFace,L1);
583 S2 = BRep_Tool::Surface(aCheckedFace,L2);
585 if (S1 == S2 && L1 == L2)
588 // planar and cylindrical cases (IMP 20052)
589 Standard_Real aPrec = Precision::Confusion();
591 S1 = BRep_Tool::Surface(aFace);
592 S2 = BRep_Tool::Surface(aCheckedFace);
597 //Handle(Geom_OffsetSurface) aGOFS1, aGOFS2;
598 //aGOFS1 = Handle(Geom_OffsetSurface)::DownCast(S1);
599 //aGOFS2 = Handle(Geom_OffsetSurface)::DownCast(S2);
600 //if (!aGOFS1.IsNull()) S1 = aGOFS1->BasisSurface();
601 //if (!aGOFS2.IsNull()) S2 = aGOFS2->BasisSurface();
603 // case of two elementary surfaces: use OCCT tool
604 // elementary surfaces: ConicalSurface, CylindricalSurface,
605 // Plane, SphericalSurface and ToroidalSurface
606 if (S1->IsKind(STANDARD_TYPE(Geom_ElementarySurface)) &&
607 S2->IsKind(STANDARD_TYPE(Geom_ElementarySurface)))
609 Handle(GeomAdaptor_HSurface) aGA1 = new GeomAdaptor_HSurface(S1);
610 Handle(GeomAdaptor_HSurface) aGA2 = new GeomAdaptor_HSurface(S2);
612 Handle(BRepTopAdaptor_TopolTool) aTT1 = new BRepTopAdaptor_TopolTool();
613 Handle(BRepTopAdaptor_TopolTool) aTT2 = new BRepTopAdaptor_TopolTool();
616 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
619 IntPatch_TheIIIntOfIntersection anIIInt (aGA1, aTT1, aGA2, aTT2, aPrec, aPrec);
620 if (!anIIInt.IsDone() || anIIInt.IsEmpty())
623 return anIIInt.TangentFaces();
625 catch (Standard_Failure) {
630 // case of two planar surfaces:
631 // all kinds of surfaces checked, including b-spline and bezier
632 GeomLib_IsPlanarSurface aPlanarityChecker1 (S1, aPrec);
633 if (aPlanarityChecker1.IsPlanar()) {
634 GeomLib_IsPlanarSurface aPlanarityChecker2 (S2, aPrec);
635 if (aPlanarityChecker2.IsPlanar()) {
636 gp_Pln aPln1 = aPlanarityChecker1.Plan();
637 gp_Pln aPln2 = aPlanarityChecker2.Plan();
639 if (aPln1.Position().Direction().IsParallel(aPln2.Position().Direction(), aPrec) &&
640 aPln1.Distance(aPln2) < aPrec) {
646 // case of two cylindrical surfaces, at least one of which is a swept surface
647 // swept surfaces: SurfaceOfLinearExtrusion, SurfaceOfRevolution
648 if ((S1->IsKind(STANDARD_TYPE(Geom_CylindricalSurface)) ||
649 S1->IsKind(STANDARD_TYPE(Geom_SweptSurface))) &&
650 (S2->IsKind(STANDARD_TYPE(Geom_CylindricalSurface)) ||
651 S2->IsKind(STANDARD_TYPE(Geom_SweptSurface))))
653 gp_Cylinder aCyl1, aCyl2;
654 if (getCylinder(S1, aCyl1) && getCylinder(S2, aCyl2)) {
655 if (fabs(aCyl1.Radius() - aCyl2.Radius()) < aPrec) {
656 gp_Dir aDir1 = aCyl1.Position().Direction();
657 gp_Dir aDir2 = aCyl2.Position().Direction();
658 if (aDir1.IsParallel(aDir2, aPrec)) {
659 gp_Pnt aLoc1 = aCyl1.Location();
660 gp_Pnt aLoc2 = aCyl2.Location();
661 gp_Vec aVec12 (aLoc1, aLoc2);
662 if (aVec12.SquareMagnitude() < aPrec*aPrec ||
663 aVec12.IsParallel(aDir1, aPrec)) {
675 //=======================================================================
676 //function : MovePCurves
678 //=======================================================================
680 void BlockFix_UnionFaces::MovePCurves(TopoDS_Face& aTarget,
681 const TopoDS_Face& aSource) const
684 for(TopExp_Explorer wexp(aSource,TopAbs_WIRE);wexp.More();wexp.Next()) {
685 Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire(TopoDS::Wire(wexp.Current()),
686 aTarget, Precision::Confusion());
688 Standard_Boolean isReoredFailed = sfw->StatusReorder ( ShapeExtend_FAIL );
689 sfw->FixEdgeCurves();
694 sfw->FixDegenerated();
696 // remove degenerated edges from not degenerated points
697 ShapeAnalysis_Edge sae;
698 Handle(ShapeExtend_WireData) sewd = sfw->WireData();
699 for(Standard_Integer i = 1; i<=sewd->NbEdges();i++) {
700 TopoDS_Edge E = sewd->Edge(i);
701 if(BRep_Tool::Degenerated(E)&&!sae.HasPCurve(E,aTarget)) {
707 TopoDS_Wire ResWire = sfw->Wire();
708 B.Add(aTarget,ResWire);