1 // Created on: 1996-09-03
2 // Created by: Olga KOULECHOVA
3 // Copyright (c) 1996-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
23 #include <BRepFeat_MakeDPrism.ixx>
25 #include <BRepFeat.hxx>
27 #include <LocOpe_CSIntersector.hxx>
28 #include <TColGeom_SequenceOfCurve.hxx>
29 #include <LocOpe_DPrism.hxx>
30 #include <LocOpe_SequenceOfLin.hxx>
31 #include <LocOpe_PntFace.hxx>
35 #include <gp_Pnt2d.hxx>
38 #include <Precision.hxx>
40 #include <Geom_Surface.hxx>
41 #include <Geom_Curve.hxx>
42 #include <Geom_Line.hxx>
43 #include <Geom2d_Curve.hxx>
44 #include <Geom_Plane.hxx>
45 #include <Geom_RectangularTrimmedSurface.hxx>
46 #include <TColgp_SequenceOfPnt.hxx>
47 #include <TColGeom_SequenceOfCurve.hxx>
48 #include <Bnd_Box.hxx>
50 #include <BRepBndLib.hxx>
51 #include <BRep_Builder.hxx>
52 #include <BRep_Tool.hxx>
53 #include <BRepTools.hxx>
54 #include <BRepPrimAPI_MakeBox.hxx>
55 #include <BRepLib.hxx>
57 #include <BRepAlgo.hxx>
58 //modified by NIZNHY-PKV Thu Mar 21 17:49:46 2002 f
59 //#include <BRepAlgo_Cut.hxx>
60 //#include <BRepAlgo_Fuse.hxx>
61 #include <BRepAlgoAPI_Cut.hxx>
62 #include <BRepAlgoAPI_Fuse.hxx>
63 //modified by NIZNHY-PKV Thu Mar 21 17:50:04 2002 t
65 #include <BRepLib_MakeFace.hxx>
67 #include <TopExp_Explorer.hxx>
68 #include <TopTools_MapOfShape.hxx>
69 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
70 #include <TopTools_ListIteratorOfListOfShape.hxx>
71 #include <TopTools_MapIteratorOfMapOfShape.hxx>
72 #include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
73 #include <TopoDS_Solid.hxx>
74 #include <TopoDS_Compound.hxx>
75 #include <TopoDS_Shell.hxx>
76 #include <TopoDS_Shape.hxx>
77 #include <TopoDS_Face.hxx>
80 #include <Standard_ConstructionError.hxx>
84 #include <BRepFeat.hxx>
88 extern Standard_Boolean BRepFeat_GettraceFEAT();
91 static void MajMap(const TopoDS_Shape&,
93 TopTools_DataMapOfShapeListOfShape&, // myMap
94 TopoDS_Shape&, // myFShape
95 TopoDS_Shape&); // myLShape
98 static void SetGluedFaces(const TopoDS_Face& theSkface,
99 const TopoDS_Shape& theSbase,
100 const TopoDS_Shape& thePbase,
101 const TopTools_DataMapOfShapeListOfShape& theSlmap,
103 TopTools_DataMapOfShapeShape&);
106 static void VerifGluedFaces(const TopoDS_Face& theSkface,
107 const TopoDS_Shape& thePbase,
108 Handle(Geom_Curve)& theBCurve,
109 TColGeom_SequenceOfCurve& theCurves,
110 LocOpe_DPrism& theDPrism,
111 TopTools_DataMapOfShapeShape& theMap);
114 static Standard_Real HeightMax(const TopoDS_Shape& theSbase,
115 const TopoDS_Face& theSkface,
116 const TopoDS_Shape& theSFrom,
117 const TopoDS_Shape& theSUntil);
119 static Standard_Integer SensOfPrism(const Handle(Geom_Curve) C,
120 const TopoDS_Shape& Until);
122 static Handle(Geom_Curve) TestCurve(const TopoDS_Face&);
124 static Standard_Boolean ToFuse(const TopoDS_Face& ,
129 //=======================================================================
132 //=======================================================================
134 void BRepFeat_MakeDPrism::Init(const TopoDS_Shape& Sbase,
135 const TopoDS_Face& Pbase,
136 const TopoDS_Face& Skface,
137 const Standard_Real Angle,
138 const Standard_Integer Mode,
139 const Standard_Boolean Modify)
143 Standard_Boolean trc = BRepFeat_GettraceFEAT();
144 if (trc) cout << "BRepFeat_MakeDPrism::Init" << endl;
153 myFuse = Standard_False;
154 myJustFeat = Standard_False;
157 myFuse = Standard_True;
158 myJustFeat = Standard_False;
161 myFuse = Standard_True;
162 myJustFeat = Standard_True;
167 myJustGluer = Standard_False;
171 //mySkface.Nullify();
181 for (exp.Init(mySbase,TopAbs_FACE);exp.More();exp.Next()) {
182 TopTools_ListOfShape thelist;
183 myMap.Bind(exp.Current(), thelist);
184 myMap(exp.Current()).Append(exp.Current());
189 if (myJustFeat) cout << " Just Feature" << endl;
190 if (myFuse) cout << " Fuse" << endl;
191 if (!myFuse) cout << " Cut" << endl;
192 if (!myModify) cout << " Modify = 0" << endl;
193 // cout <<" Angle = " << myAngle << endl;
199 //=======================================================================
201 //purpose : add sliding faces and edges
202 //=======================================================================
204 void BRepFeat_MakeDPrism::Add(const TopoDS_Edge& E,
205 const TopoDS_Face& F)
208 Standard_Boolean trc = BRepFeat_GettraceFEAT();
209 if (trc) cout << "BRepFeat_MakeDPrism::Add(Edge,face)" << endl;
212 for (exp.Init(mySbase,TopAbs_FACE);exp.More();exp.Next()) {
213 if (exp.Current().IsSame(F)) {
218 Standard_ConstructionError::Raise();
221 for (exp.Init(myPbase,TopAbs_EDGE);exp.More();exp.Next()) {
222 if (exp.Current().IsSame(E)) {
227 Standard_ConstructionError::Raise();
230 if (!mySlface.IsBound(F)) {
231 TopTools_ListOfShape thelist;
232 mySlface.Bind(F, thelist);
234 TopTools_ListIteratorOfListOfShape itl(mySlface(F));
235 for (; itl.More();itl.Next()) {
236 if (itl.Value().IsSame(E)) {
241 mySlface(F).Append(E);
246 //=======================================================================
248 //purpose : feature of Height
249 //=======================================================================
251 void BRepFeat_MakeDPrism::Perform(const Standard_Real Height)
254 Standard_Boolean trc = BRepFeat_GettraceFEAT();
255 if (trc) cout << "BRepFeat_MakeDPrism::Perform(Height)" << endl;
262 myPerfSelection = BRepFeat_NoSelection;
263 PerfSelectionValid();
265 Standard_Real theheight = Height/cos(myAngle);
266 // myPbase.Orientation(TopAbs_FORWARD);
268 LocOpe_DPrism theDPrism(myPbase,theheight,myAngle);
269 TopoDS_Shape VraiDPrism = theDPrism.Shape();
271 MajMap(myPbase,theDPrism,myMap,myFShape,myLShape);
273 myGShape = VraiDPrism;
274 GeneratedShapeValid();
275 TopoDS_Shape Base = theDPrism.FirstShape();
276 TopExp_Explorer exp(Base, TopAbs_FACE);
277 TopoDS_Face theBase = TopoDS::Face(exp.Current());
281 myStatusError = BRepFeat_InvFirstShape;
287 Standard_Boolean found = Standard_False;
289 if(!mySkface.IsNull() || !mySlface.IsEmpty()) {
290 if(myLShape.ShapeType() == TopAbs_WIRE) {
291 TopExp_Explorer ex1(VraiDPrism, TopAbs_FACE);
292 for(; ex1.More(); ex1.Next()) {
293 TopExp_Explorer ex2(ex1.Current(), TopAbs_WIRE);
294 for(; ex2.More(); ex2.Next()) {
295 if(ex2.Current().IsSame(myLShape)) {
296 FFace = TopoDS::Face(ex1.Current());
297 found = Standard_True;
305 TopExp_Explorer exp(mySbase, TopAbs_FACE);
306 for(; exp.More(); exp.Next()) {
307 const TopoDS_Face& ff = TopoDS::Face(exp.Current());
308 if(ToFuse(ff, FFace)) {
309 TopTools_DataMapOfShapeListOfShape sl;
310 //SetGluedFaces(ff, mySbase, FFace, sl, theDPrism, myGluedF);
316 // management of gluing faces
318 //SetGluedFaces(mySkface, mySbase, theBase, mySlface, theDPrism, myGluedF);
320 // VerifGluedFaces(mySkface, theBase, myBCurve, myCurves, theDPrism, myGluedF);
322 if(!myGluedF.IsEmpty()) { // case gluing
323 myJustGluer = Standard_True;
324 theDPrism.Curves(myCurves);
325 myBCurve = theDPrism.BarycCurve();
329 // if there is no gluing -> call topological operations
332 //modified by NIZNHY-PKV Thu Mar 21 17:32:17 2002 f
333 //BRepAlgo_Fuse f(mySbase, myGShape);
334 //myShape = f.Shape();
335 //UpdateDescendants(f.Builder(), myShape, Standard_False);
336 BRepAlgoAPI_Fuse f(mySbase, myGShape);
338 UpdateDescendants(f, myShape, Standard_False);
339 //modified by NIZNHY-PKV Thu Mar 21 17:32:23 2002 t
342 else if(myFuse == 0) {
343 //modified by NIZNHY-PKV Thu Mar 21 17:32:57 2002 f
344 //BRepAlgo_Cut c(mySbase, myGShape);
345 //myShape = c.Shape();
346 //UpdateDescendants(c.Builder(), myShape, Standard_False);
347 BRepAlgoAPI_Cut c(mySbase, myGShape);
349 UpdateDescendants(c, myShape, Standard_False);
350 //modified by NIZNHY-PKV Thu Mar 21 17:33:00 2002 t
360 //=======================================================================
362 //purpose : feature limited by the shape Until
363 //=======================================================================
365 void BRepFeat_MakeDPrism::Perform(const TopoDS_Shape& Until)
368 Standard_Boolean trc = BRepFeat_GettraceFEAT();
369 if (trc) cout << "BRepFeat_MakeDPrism::Perform(Until)" << endl;
371 if (Until.IsNull()) {
372 Standard_ConstructionError::Raise();
374 TopExp_Explorer exp(Until, TopAbs_FACE);
376 Standard_ConstructionError::Raise();
378 // myPbase.Orientation(TopAbs_FORWARD);
381 myPerfSelection = BRepFeat_SelectionU;
382 PerfSelectionValid();
386 Standard_Boolean Trf = TransformShapeFU(1);
388 Handle(Geom_Curve) C = TestCurve(myPbase);
389 Standard_Integer sens = SensOfPrism(C, mySUntil);
392 Standard_Real Height =
393 sens*HeightMax(mySbase, mySkface, mySFrom, mySUntil);
394 LocOpe_DPrism theDPrism(myPbase,Height,myAngle);
395 TopoDS_Shape VraiDPrism = theDPrism.Shape();
397 MajMap(myPbase,theDPrism,myMap,myFShape,myLShape);
398 myGShape = VraiDPrism;
399 GeneratedShapeValid();
400 TopoDS_Shape Base = theDPrism.FirstShape();
401 exp.Init(Base, TopAbs_FACE);
402 TopoDS_Face theBase = TopoDS::Face(exp.Current());
406 myStatusError = BRepFeat_InvFirstShape;
410 //SetGluedFaces(mySkface, mySbase, theBase, mySlface, theDPrism, myGluedF);
412 // VerifGluedFaces(mySkface, theBase, myBCurve, myCurves, theDPrism, myGluedF);
415 theDPrism.Curves(myCurves);
416 myBCurve = theDPrism.BarycCurve();
420 MajMap(myPbase,theDPrism,myMap,myFShape,myLShape);
421 Handle(Geom_Curve) C1;
429 TColGeom_SequenceOfCurve scur;
432 LocOpe_CSIntersector ASI(mySUntil);
434 TopAbs_Orientation Or;
435 if (ASI.IsDone() && ASI.NbPoints(1) >=1) {
437 Or = ASI.Point(1,1).Orientation();
440 Or = ASI.Point(1,ASI.NbPoints(1)).Orientation();
442 // Standard_Real prm = ASI.Point(1,1).Parameter();
443 // if(prm < 0) Or = TopAbs::Reverse(Or);
444 TopoDS_Face FUntil = ASI.Point(1,1).Face();
446 bB.MakeCompound(TopoDS::Compound(Comp));
447 TopoDS_Solid S = BRepFeat::Tool(mySUntil, FUntil, Or);
448 if (!S.IsNull()) bB.Add(Comp,S);
450 //modified by NIZNHY-PKV Thu Mar 21 17:33:27 2002
451 //BRepAlgo_Cut trP(VraiDPrism,Comp);
452 //UpdateDescendants(trP.Builder(),trP.Shape(), Standard_False);
453 BRepAlgoAPI_Cut trP(VraiDPrism,Comp);
454 UpdateDescendants(trP, trP.Shape(), Standard_False);
455 //modified by NIZNHY-PKV Thu Mar 21 17:33:32 2002 t
457 TopExp_Explorer ex(trP.Shape(), TopAbs_SOLID);
458 TopoDS_Shape Cutsh = ex.Current();
460 //modified by NIZNHY-PKV Thu Mar 21 17:34:09 2002 f
461 //BRepAlgo_Fuse f(mySbase, Cutsh);
462 //myShape = f.Shape();
463 //UpdateDescendants(f.Builder(), myShape, Standard_False);
464 BRepAlgoAPI_Fuse f(mySbase, Cutsh);
466 UpdateDescendants(f, myShape, Standard_False);
467 //modified by NIZNHY-PKV Thu Mar 21 17:34:13 2002 t
470 else if(myFuse == 0) {
471 //modified by NIZNHY-PKV Thu Mar 21 17:34:56 2002 f
472 //BRepAlgo_Cut c(mySbase, Cutsh);
473 //myShape = c.Shape();
474 //UpdateDescendants(c.Builder(), myShape, Standard_False);
475 BRepAlgoAPI_Cut c(mySbase, Cutsh);
477 UpdateDescendants(c, myShape, Standard_False);
478 //modified by NIZNHY-PKV Thu Mar 21 17:34:59 2002 t
487 TopTools_ListIteratorOfListOfShape ited(myNewEdges);
488 for (; ited.More();ited.Next()) {
489 const TopoDS_Edge& ledg=TopoDS::Edge(ited.Value());
490 if (!BRepAlgo::IsValid(ledg)) {
491 bB.SameRange(ledg, Standard_False);
492 bB.SameParameter(ledg, Standard_False);
493 BRepLib::SameParameter(ledg, BRep_Tool::Tolerance(ledg));
499 //=======================================================================
501 //purpose : feature limited by two shapes
502 //=======================================================================
504 void BRepFeat_MakeDPrism::Perform(const TopoDS_Shape& From,
505 const TopoDS_Shape& Until)
508 Standard_Boolean trc = BRepFeat_GettraceFEAT();
509 if (trc) cout << "BRepFeat_MakeDPrism::Perform(From,Until)" << endl;
511 if (From.IsNull() || Until.IsNull()) {
512 Standard_ConstructionError::Raise();
515 if (!mySkface.IsNull()) {
516 if (From.IsSame(mySkface)) {
517 myJustGluer = Standard_True;
519 if (myJustGluer) return;
521 else if (Until.IsSame(mySkface)) {
522 myJustGluer = Standard_True;
524 if (myJustGluer) return;
527 // myPbase.Orientation(TopAbs_FORWARD);
530 myPerfSelection = BRepFeat_SelectionFU;
531 PerfSelectionValid();
533 TopExp_Explorer exp(From, TopAbs_FACE);
535 Standard_ConstructionError::Raise();
537 exp.Init(Until, TopAbs_FACE);
539 Standard_ConstructionError::Raise();
542 Standard_Boolean Trff = TransformShapeFU(0);
545 Standard_Boolean Trfu = TransformShapeFU(1);
549 myStatusError = BRepFeat_IncTypes;
552 Handle(Geom_Curve) C = TestCurve(myPbase);
553 Standard_Integer sens;
554 if(From.IsSame(Until)) {
558 sens = SensOfPrism(C, mySUntil);
561 Standard_Real Height =
562 sens*HeightMax(mySbase, myPbase, mySFrom, mySUntil);
563 LocOpe_DPrism theDPrism(myPbase, Height, Height, myAngle);
564 TopoDS_Shape VraiDPrism = theDPrism.Shape();
568 MajMap(myPbase,theDPrism,myMap,myFShape,myLShape);
570 // Make systematically dprism
571 myGShape = VraiDPrism;
572 GeneratedShapeValid();
574 // management of gluing faces
575 //SetGluedFaces(TopoDS_Face(), // on ne veut pas binder mySkface
576 // mySbase, myPbase, mySlface, theDPrism, myGluedF);
578 theDPrism.Curves(myCurves);
579 myBCurve = theDPrism.BarycCurve();
581 // topologic reconstruction
585 // management of descendants
586 MajMap(myPbase,theDPrism,myMap,myFShape,myLShape);
587 Handle(Geom_Curve) C1;
594 TColGeom_SequenceOfCurve scur;
597 LocOpe_CSIntersector ASI1(mySUntil);
598 LocOpe_CSIntersector ASI2(mySFrom);
601 TopAbs_Orientation OrU, OrF;
602 TopoDS_Face FFrom, FUntil;
603 //direction of dprism
604 if (ASI1.IsDone() && ASI1.NbPoints(1) >=1) {
606 OrU = ASI1.Point(1,1).Orientation();
609 OrU = ASI1.Point(1,ASI1.NbPoints(1)).Orientation();
611 // Standard_Real prm = ASI1.Point(1,1).Parameter();
612 // if(prm < 0) OrU = TopAbs::Reverse(OrU);
613 FUntil = ASI1.Point(1,1).Face();
617 myStatusError = BRepFeat_NoIntersectU;
620 if (ASI2.IsDone() && ASI2.NbPoints(1) >=1) {
621 OrF = ASI2.Point(1,1).Orientation();
622 // Standard_Real prm = ASI2.Point(1,1).Parameter();
623 OrF = TopAbs::Reverse(OrF);
624 FFrom = ASI2.Point(1,1).Face();
628 myStatusError = BRepFeat_NoIntersectF;
633 B.MakeCompound(TopoDS::Compound(Comp));
634 TopoDS_Solid S = BRepFeat::Tool(mySUntil, FUntil, OrU);
635 if (!S.IsNull()) B.Add(Comp,S);
638 myStatusError = BRepFeat_NullToolU;
641 TopoDS_Solid SS = BRepFeat::Tool(mySFrom, FFrom, OrF);
642 if (!SS.IsNull()) B.Add(Comp,SS);
645 myStatusError = BRepFeat_NullToolF;
649 //modified by NIZNHY-PKV Thu Mar 21 17:35:48 2002 f
650 //BRepAlgo_Cut trP(VraiDPrism,Comp);
651 BRepAlgoAPI_Cut trP(VraiDPrism,Comp);
652 //modified by NIZNHY-PKV Thu Mar 21 17:35:59 2002 t
655 //modified by NIZNHY-PKV Thu Mar 21 17:36:06 2002 f
656 //BRepAlgo_Fuse f(mySbase, trP.Shape());
657 //myShape = f.Shape();
658 //UpdateDescendants(f.Builder(), myShape, Standard_False);
659 BRepAlgoAPI_Fuse f(mySbase, trP.Shape());
661 UpdateDescendants(f, myShape, Standard_False);
662 //modified by NIZNHY-PKV Thu Mar 21 17:36:33 2002 t
666 else if(myFuse == 0) {
667 //modified by NIZNHY-PKV Thu Mar 21 17:37:16 2002 f
668 //BRepAlgo_Cut c(mySbase, trP.Shape());
669 //myShape = c.Shape();
670 //UpdateDescendants(c.Builder(), myShape, Standard_False);
671 BRepAlgoAPI_Cut c(mySbase, trP.Shape());
673 UpdateDescendants(c, myShape, Standard_False);
674 //modified by NIZNHY-PKV Thu Mar 21 17:37:49 2002 t
678 myShape = trP.Shape();
685 //=======================================================================
687 //purpose : feature semi-infinie
688 //=======================================================================
690 void BRepFeat_MakeDPrism::PerformUntilEnd()
693 Standard_Boolean trc = BRepFeat_GettraceFEAT();
694 if (trc) cout << "BRepFeat_MakeDPrism::PerformUntilEnd()" << endl;
696 myPerfSelection = BRepFeat_SelectionSh;
697 PerfSelectionValid();
703 Standard_Real Height = HeightMax(mySbase, mySkface, mySFrom, mySUntil);
704 // myPbase.Orientation(TopAbs_FORWARD);
706 LocOpe_DPrism theDPrism(myPbase, Height, myAngle);
707 TopoDS_Shape VraiDPrism = theDPrism.Shape();
709 MajMap(myPbase,theDPrism,myMap,myFShape,myLShape);
711 myGShape = VraiDPrism;
712 GeneratedShapeValid();
714 theDPrism.Curves(myCurves);
715 myBCurve = theDPrism.BarycCurve();
719 //=======================================================================
720 //function : PerformFromEnd
721 //purpose : feature semiinfinite limited by the shape Until from the other side
722 //=======================================================================
724 void BRepFeat_MakeDPrism::PerformFromEnd(const TopoDS_Shape& Until)
727 Standard_Boolean trc = BRepFeat_GettraceFEAT();
728 if (trc) cout << "BRepFeat_MakeDPrism::PerformFromEnd(From,Until)" << endl;
730 if (Until.IsNull()) {
731 Standard_ConstructionError::Raise();
733 if (!mySkface.IsNull() && Until.IsSame(mySkface)) {
738 exp.Init(Until, TopAbs_FACE);
740 Standard_ConstructionError::Raise();
742 // myPbase.Orientation(TopAbs_FORWARD);
743 myPerfSelection = BRepFeat_SelectionShU;
744 PerfSelectionValid();
748 Standard_Boolean Trf = TransformShapeFU(1);
750 Handle(Geom_Curve) C = TestCurve(myPbase);
751 Standard_Integer sens = SensOfPrism(C, mySUntil);
752 Standard_Real Height =
753 sens*HeightMax(mySbase, mySkface, mySFrom, mySUntil);
755 LocOpe_DPrism theDPrism(myPbase, Height, Height, myAngle);
756 TopoDS_Shape VraiDPrism = theDPrism.Shape();
757 if(VraiDPrism.IsNull()) {
759 myStatusError = BRepFeat_NullRealTool;
763 if(!Trf) { // case finite face
764 MajMap(myPbase,theDPrism,myMap,myFShape,myLShape);
765 myGShape = VraiDPrism;
766 GeneratedShapeValid();
769 theDPrism.Curves(myCurves);
770 myBCurve = theDPrism.BarycCurve();
773 else { // case support
774 MajMap(myPbase,theDPrism,myMap,myFShape,myLShape);
775 Handle(Geom_Curve) C2;
782 TColGeom_SequenceOfCurve scur;
785 LocOpe_CSIntersector ASI1(mySUntil);
786 LocOpe_CSIntersector ASI2(mySbase);
789 TopAbs_Orientation OrU = TopAbs_FORWARD, OrF = TopAbs_FORWARD;
790 TopoDS_Face FUntil, FFrom;
791 if (ASI1.IsDone() && ASI1.NbPoints(1) >=1) {
792 OrU = ASI1.Point(1,1).Orientation();
793 Standard_Real prm = ASI1.Point(1,1).Parameter();
794 if(prm < 0) OrU = TopAbs::Reverse(OrU);
795 FUntil = ASI1.Point(1,1).Face();
798 if (ASI2.IsDone() && ASI2.NbPoints(1) >=1) {
799 Standard_Integer jj = ASI2.NbPoints(1);
800 Standard_Real prm = ASI2.Point(1,1).Parameter();
801 FFrom = ASI2.Point(1, 1).Face();
802 OrF = ASI2.Point(1,1).Orientation();
803 OrF = TopAbs::Reverse(OrF);
804 for(Standard_Integer iii = 1; iii <= jj; iii++) {
805 if(ASI2.Point(1,iii).Parameter() < prm) {
806 prm = ASI2.Point(1,iii).Parameter();
807 FFrom = ASI2.Point(1, iii).Face();
808 OrF = ASI2.Point(1,iii).Orientation();
809 OrF = TopAbs::Reverse(OrF);
812 Handle(Geom_Surface) S = BRep_Tool::Surface(FFrom);
813 if (S->DynamicType() ==
814 STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
815 S = Handle(Geom_RectangularTrimmedSurface)::
816 DownCast(S)->BasisSurface();
818 BRepLib_MakeFace fac(S, Precision::Confusion());
819 mySFrom = fac.Face();
820 Trf = TransformShapeFU(0);
821 // FFrom = TopoDS::Face(mySFrom);
826 B.MakeCompound(TopoDS::Compound(Comp));
827 TopoDS_Solid Sol = BRepFeat::Tool(mySUntil, FUntil, OrU);
828 if (!Sol.IsNull()) B.Add(Comp,Sol);
831 myStatusError = BRepFeat_NullToolU;
835 TopoDS_Solid Sol1 = BRepFeat::Tool(mySFrom, FFrom, OrF);
836 if (!Sol1.IsNull()) B.Add(Comp,Sol1);
839 myStatusError = BRepFeat_NullToolF;
843 //modified by NIZNHY-PKV Thu Mar 21 17:38:33 2002 f
844 //BRepAlgo_Cut trP(VraiDPrism,Comp);
845 BRepAlgoAPI_Cut trP(VraiDPrism,Comp);
846 //modified by NIZNHY-PKV Thu Mar 21 17:38:37 2002 t
848 //modified by NIZNHY-PKV Thu Mar 21 17:40:03 2002 f
849 //BRepAlgo_Fuse f(mySbase, trP.Shape());
850 //myShape = f.Shape();
851 //UpdateDescendants(f.Builder(), myShape, Standard_False);
852 BRepAlgoAPI_Fuse f(mySbase, trP.Shape());
854 UpdateDescendants(f, myShape, Standard_False);
855 //modified by NIZNHY-PKV Thu Mar 21 17:40:07 2002 t
858 else if(myFuse == 0) {
859 //modified by NIZNHY-PKV Thu Mar 21 17:40:33 2002 t
860 //BRepAlgo_Cut c(mySbase, trP.Shape());
861 //myShape = c.Shape();
862 //UpdateDescendants(c.Builder(), myShape, Standard_False);
863 BRepAlgoAPI_Cut c(mySbase, trP.Shape());
865 UpdateDescendants(c, myShape, Standard_False);
866 //modified by NIZNHY-PKV Thu Mar 21 17:40:44 2002 t
870 myShape = trP.Shape();
878 //=======================================================================
879 //function : PerformThruAll
880 //purpose : feature throughout the entire initial shape
881 //=======================================================================
883 void BRepFeat_MakeDPrism::PerformThruAll()
886 Standard_Boolean trc = BRepFeat_GettraceFEAT();
887 if (trc) cout << "BRepFeat_MakeDPrism::PerformThruAll()" << endl;
894 myPerfSelection = BRepFeat_NoSelection;
897 myPerfSelection = BRepFeat_SelectionSh;
900 PerfSelectionValid();
901 // myPbase.Orientation(TopAbs_FORWARD);
905 Standard_Real Height = HeightMax(mySbase, mySkface, mySFrom, mySUntil);
906 LocOpe_DPrism theDPrism(myPbase, Height, Height, myAngle);
907 TopoDS_Shape VraiDPrism = theDPrism.Shape();
908 MajMap(myPbase,theDPrism,myMap,myFShape,myLShape);
910 myGShape = VraiDPrism;
911 GeneratedShapeValid();
914 //modified by NIZNHY-PKV Thu Mar 21 17:46:16 2002 f
915 //BRepAlgo_Cut c(mySbase, myGShape);
916 BRepAlgoAPI_Cut c(mySbase, myGShape);
917 //modified by NIZNHY-PKV Thu Mar 21 17:46:26 2002 t
920 //modified by NIZNHY-PKV Thu Mar 21 17:46:39 2002 f
921 //UpdateDescendants(c.Builder(), myShape, Standard_False);
922 UpdateDescendants(c, myShape, Standard_False);
923 //modified by NIZNHY-PKV Thu Mar 21 17:46:43 2002 t
928 theDPrism.Curves(myCurves);
929 myBCurve = theDPrism.BarycCurve();
935 //=======================================================================
936 //function : PerformUntilHeight
937 //purpose : feature until the shape is of the given height
938 //=======================================================================
940 void BRepFeat_MakeDPrism::PerformUntilHeight(const TopoDS_Shape& Until,
941 const Standard_Real Height)
944 Standard_Boolean trc = BRepFeat_GettraceFEAT();
945 if (trc) cout << "BRepFeat_MakeDPrism::PerformUntilHeight(Until,Height)" << endl;
947 if (Until.IsNull()) {
953 TopExp_Explorer exp(Until, TopAbs_FACE);
955 Standard_ConstructionError::Raise();
957 // myPbase.Orientation(TopAbs_FORWARD);
959 myPerfSelection = BRepFeat_NoSelection;
960 PerfSelectionValid();
964 Standard_Boolean Trf = TransformShapeFU(1);
966 Handle(Geom_Curve) C = TestCurve(myPbase);
967 Standard_Integer sens = SensOfPrism(C, mySUntil);
969 LocOpe_DPrism theDPrism(myPbase,sens*Height,myAngle);
970 TopoDS_Shape VraiDPrism = theDPrism.Shape();
972 if(!Trf) { // case face finished
973 MajMap(myPbase,theDPrism,myMap,myFShape,myLShape);
974 myGShape = VraiDPrism;
975 GeneratedShapeValid();
976 TopoDS_Shape Base = theDPrism.FirstShape();
977 exp.Init(Base, TopAbs_FACE);
978 TopoDS_Face theBase = TopoDS::Face(exp.Current());
982 myStatusError = BRepFeat_InvFirstShape;
986 //SetGluedFaces(mySkface, mySbase, theBase, mySlface, theDPrism, myGluedF);
988 // VerifGluedFaces(mySkface, theBase, myBCurve, myCurves, theDPrism, myGluedF);
990 theDPrism.Curves(myCurves);
991 myBCurve = theDPrism.BarycCurve();
994 else { // case support
995 MajMap(myPbase,theDPrism,myMap,myFShape,myLShape);
996 Handle(Geom_Curve) C1;
1003 TColGeom_SequenceOfCurve scur;
1006 LocOpe_CSIntersector ASI(mySUntil);
1008 TopAbs_Orientation Or;
1009 if (ASI.IsDone() && ASI.NbPoints(1) >=1) {
1011 Or = ASI.Point(1,1).Orientation();
1014 Or = ASI.Point(1,ASI.NbPoints(1)).Orientation();
1016 // Standard_Real prm = ASI.Point(1,1).Parameter();
1017 // if(prm < 0) Or = TopAbs::Reverse(Or);
1018 TopoDS_Face FUntil = ASI.Point(1,1).Face();
1021 B.MakeCompound(TopoDS::Compound(Comp));
1022 TopoDS_Solid S = BRepFeat::Tool(mySUntil, FUntil, Or);
1023 if (!S.IsNull()) B.Add(Comp,S);
1024 //modified by NIZNHY-PKV Thu Mar 21 17:47:14 2002 f
1025 //BRepAlgo_Cut trP(VraiDPrism,Comp);
1026 BRepAlgoAPI_Cut trP(VraiDPrism,Comp);
1027 //modified by NIZNHY-PKV Thu Mar 21 17:47:21 2002 t
1029 //modified by NIZNHY-PKV Thu Mar 21 17:47:42 2002 f
1030 //BRepAlgo_Fuse f(mySbase, trP.Shape());
1031 //myShape = f.Shape();
1032 //UpdateDescendants(f.Builder(), myShape, Standard_False);
1033 BRepAlgoAPI_Fuse f(mySbase, trP.Shape());
1034 myShape = f.Shape();
1035 UpdateDescendants(f, myShape, Standard_False);
1036 //modified by NIZNHY-PKV Thu Mar 21 17:47:49 2002 t
1039 else if(myFuse == 0) {
1040 //modified by NIZNHY-PKV Thu Mar 21 17:48:18 2002 f
1041 //BRepAlgo_Cut c(mySbase, trP.Shape());
1042 //myShape = c.Shape();
1043 //UpdateDescendants(c.Builder(), myShape, Standard_False);
1044 BRepAlgoAPI_Cut c(mySbase, trP.Shape());
1045 myShape = c.Shape();
1046 UpdateDescendants(c, myShape, Standard_False);
1047 //modified by NIZNHY-PKV Thu Mar 21 17:48:26 2002 t
1051 myShape = trP.Shape();
1059 //=======================================================================
1061 //purpose : curves parallel to the axis of the prism
1062 //=======================================================================
1064 void BRepFeat_MakeDPrism::Curves(TColGeom_SequenceOfCurve& scur)
1069 //============================================================================
1070 // function : BRepFeat_BossEgdes
1071 // purpose: Determination of TopEdges and LatEdges.
1072 // sig = 1 -> TopEdges = FirstShape of the DPrism
1073 // sig = 2 -> TOpEdges = LastShape of the DPrism
1074 //============================================================================
1075 void BRepFeat_MakeDPrism::BossEdges (const Standard_Integer signature)
1078 Standard_Boolean trc = BRepFeat_GettraceFEAT();
1079 if (trc) cout << "BRepFeat_MakeDPrism::BossEdges (integer)" << endl;
1081 TopTools_ListOfShape theLastShape;
1082 theLastShape.Clear();
1083 if (signature == 1 || signature == -1) {
1084 theLastShape = FirstShape();
1086 else if (signature == 2 || signature == -2) {
1087 theLastShape = LastShape();
1094 TopTools_ListIteratorOfListOfShape itLS;
1095 TopExp_Explorer ExpE;
1096 for (itLS.Initialize(theLastShape);itLS.More();itLS.Next()) {
1097 const TopoDS_Face& FF = TopoDS::Face(itLS.Value());
1098 for (ExpE.Init(FF,TopAbs_EDGE);ExpE.More();ExpE.Next()) {
1099 const TopoDS_Edge& EE = TopoDS::Edge(ExpE.Current());
1100 myTopEdges.Append(EE);
1105 if (signature < 0) {
1106 // Attention check if TgtEdges is important
1107 myLatEdges = NewEdges();
1109 else if (signature > 0) {
1110 if ( !myShape.IsNull() ) {
1111 TopTools_MapOfShape MapE;
1112 Standard_Boolean Found;
1114 TopExp_Explorer ExpF;
1115 for (ExpF.Init(myShape,TopAbs_FACE);ExpF.More();ExpF.Next()) {
1116 Found = Standard_False;
1117 const TopoDS_Face& FF = TopoDS::Face(ExpF.Current());
1118 for (itLS.Initialize(theLastShape);itLS.More();itLS.Next()) {
1119 const TopoDS_Face& TopFace = TopoDS::Face(itLS.Value());
1120 if (!FF.IsSame(TopFace)) {
1121 TopExp_Explorer ExpE;
1122 for (ExpE.Init(FF,TopAbs_EDGE);ExpE.More() && !Found ;ExpE.Next()) {
1123 const TopoDS_Edge& E1 = TopoDS::Edge(ExpE.Current());
1124 TopoDS_Vertex V1,V2;
1125 TopExp::Vertices (E1,V1,V2);
1126 TopTools_ListIteratorOfListOfShape it(myTopEdges);
1127 for (;it.More() && !Found ; it.Next()) {
1128 TopoDS_Edge E2 = TopoDS::Edge(it.Value());
1129 TopoDS_Vertex VT1,VT2;
1130 TopExp::Vertices (E2,VT1,VT2);
1132 if (V1.IsSame(VT1) || V1.IsSame(VT2) || V2.IsSame(VT1) || V2.IsSame(VT2)) {
1133 Found = Standard_True;
1134 TopExp_Explorer ExpE2;
1135 for (ExpE2.Init(FF,TopAbs_EDGE);ExpE2.More();ExpE2.Next()) {
1136 const TopoDS_Edge& E3 = TopoDS::Edge(ExpE2.Current());
1137 if (MapE.Contains(E3)) {
1149 TopTools_ListIteratorOfListOfShape it(myTopEdges);
1150 for (;it.More() ; it.Next()) {
1151 if (MapE.Contains(it.Value())) {MapE.Remove(it.Value()); }
1154 TopTools_MapIteratorOfMapOfShape itMap;
1155 for (itMap.Initialize(MapE);itMap.More();itMap.Next()) {
1156 if (!BRep_Tool::Degenerated(TopoDS::Edge(itMap.Key())))
1157 myLatEdges.Append(itMap.Key());
1165 //============================================================================
1166 // function : BRepFeat_TopEgdes
1167 // Purpose: Returns the list of TopoDS Edges of the top of the boss
1168 //============================================================================
1169 const TopTools_ListOfShape& BRepFeat_MakeDPrism::TopEdges ()
1174 //============================================================================
1175 // function : BRepFeat_LatEgdes
1176 // Purpose: Returns the list of TopoDS Edges of the top of the boss
1177 //============================================================================
1178 const TopTools_ListOfShape& BRepFeat_MakeDPrism::LatEdges ()
1183 //=======================================================================
1184 //function : BarycCurve
1185 //purpose : passe par le centre de masses de la primitive
1186 //=======================================================================
1188 Handle(Geom_Curve) BRepFeat_MakeDPrism::BarycCurve()
1194 //=======================================================================
1195 //function : HeightMax
1196 //purpose : Calculate the height of the prism following the parameters of the bounding box
1197 //=======================================================================
1199 static Standard_Real HeightMax(const TopoDS_Shape& theSbase, // shape initial
1200 const TopoDS_Face& theSkface, // face de sketch
1201 const TopoDS_Shape& theSFrom, // shape from
1202 const TopoDS_Shape& theSUntil) // shape until
1205 BRepBndLib::Add(theSbase,Box);
1206 BRepBndLib::Add(theSkface,Box);
1207 if(!theSFrom.IsNull()) {
1208 BRepBndLib::Add(theSFrom,Box);
1210 if(!theSUntil.IsNull()) {
1211 BRepBndLib::Add(theSUntil,Box);
1215 Box.Get(c[0],c[2],c[4],c[1],c[3],c[5]);
1216 // Standard_Real parmin=c[0], parmax = c[0];
1217 // for(Standard_Integer i = 0 ; i < 6; i++) {
1218 // if(c[i] > parmax) parmax = c[i];
1219 // if(c[i] < parmin ) parmin = c[i];
1221 // Standard_Real Height = abs(2.*(parmax - parmin));
1222 // return(2.*Height);
1224 Standard_Real par = Max( Max( fabs(c[1] - c[0]), fabs(c[3] - c[2]) ), fabs(c[5] - c[4]) );
1226 // Standard_Real par = Max( Max( abs(c[1] - c[0]), abs(c[3] - c[2]) ), abs(c[5] - c[4]) );
1229 cout << "Height = > " << par << endl;
1238 //=======================================================================
1239 //function : SensOfPrism
1240 //purpose : determine the direction of prism generation
1241 //=======================================================================
1242 Standard_Integer SensOfPrism(const Handle(Geom_Curve) C,
1243 const TopoDS_Shape& Until)
1245 LocOpe_CSIntersector ASI1(Until);
1246 TColGeom_SequenceOfCurve scur;
1249 Standard_Integer sens = 1;
1250 if(ASI1.IsDone() && ASI1.NbPoints(1) >= 1) {
1251 Standard_Integer nb = ASI1.NbPoints(1);
1252 Standard_Real prm1 = ASI1.Point(1, 1).Parameter();
1253 Standard_Real prm2 = ASI1.Point(1, nb).Parameter();
1254 if(prm1 < 0. && prm2 < 0.) {
1258 else if(BRepFeat::ParametricBarycenter(Until,C) < 0) {
1266 //=======================================================================
1267 //function : SetGluedFaces
1269 //=======================================================================
1271 static void SetGluedFaces(const TopoDS_Face& theSkface,
1272 const TopoDS_Shape& theSbase,
1273 const TopoDS_Shape& thePbase,
1274 const TopTools_DataMapOfShapeListOfShape& theSlmap,
1275 LocOpe_DPrism& theDPrism,
1276 TopTools_DataMapOfShapeShape& theMap)
1278 TopExp_Explorer exp;
1279 if (!theSkface.IsNull() && thePbase.ShapeType() == TopAbs_FACE) {
1280 for (exp.Init(theSbase,TopAbs_FACE); exp.More(); exp.Next()) {
1281 if (exp.Current().IsSame(theSkface)) {
1282 theMap.Bind(thePbase,theSkface);
1288 TopExp_Explorer exp2;
1289 for (exp.Init(thePbase,TopAbs_FACE);exp.More();exp.Next()) {
1290 const TopoDS_Face& fac = TopoDS::Face(exp.Current());
1291 for (exp2.Init(theSbase,TopAbs_FACE);exp2.More();exp2.Next()) {
1292 if (exp2.Current().IsSame(fac)) {
1293 theMap.Bind(fac,fac);
1301 TopTools_DataMapIteratorOfDataMapOfShapeListOfShape itm(theSlmap);
1302 if(!theSlmap.IsEmpty()) {
1303 for (; itm.More(); itm.Next()) {
1304 const TopoDS_Face& fac = TopoDS::Face(itm.Key());
1305 const TopTools_ListOfShape& ledg = itm.Value();
1306 for (TopTools_ListIteratorOfListOfShape it(ledg); it.More(); it.Next()) {
1307 const TopTools_ListOfShape& gfac = theDPrism.Shapes(it.Value());
1308 if (gfac.Extent() != 1) {
1310 Standard_Boolean trc = BRepFeat_GettraceFEAT();
1311 if (trc) cout << " BRepFeat_MakeDPrism : Pb SetGluedFace" << endl;
1314 theMap.Bind(gfac.First(),fac);
1321 //=======================================================================
1322 //function : VerifGluedFaces
1323 //purpose : Checking intersection Tool/theSkface = thePbase
1324 // if yes -> OK if no -> case without gluing
1325 //=======================================================================
1327 static void VerifGluedFaces(const TopoDS_Face& theSkface,
1328 const TopoDS_Shape& thePbase,
1329 Handle(Geom_Curve)& theBCurve,
1330 TColGeom_SequenceOfCurve& theCurves,
1331 LocOpe_DPrism& theDPrism,
1332 TopTools_DataMapOfShapeShape& theMap)
1334 Standard_Boolean GluedFaces = Standard_True;
1335 TopoDS_Shape VraiDPrism = theDPrism.Shape();
1337 TColGeom_SequenceOfCurve scur;
1338 theDPrism.Curves(theCurves);
1339 theBCurve = theDPrism.BarycCurve();
1341 scur.Append(theBCurve);
1342 LocOpe_CSIntersector ASI(theSkface);
1344 if (ASI.IsDone() && ASI.NbPoints(1) >=1) {
1345 TopAbs_Orientation Or = ASI.Point(1,1).Orientation();
1346 TopoDS_Face FSk = ASI.Point(1,1).Face();
1349 B.MakeCompound(TopoDS::Compound(Comp));
1350 TopoDS_Solid S = BRepFeat::Tool(theSkface, FSk, Or);
1351 if (!S.IsNull()) B.Add(Comp,S);
1352 //modified by NIZNHY-PKV Thu Mar 21 17:48:45 2002 f
1353 //BRepAlgo_Cut trP(VraiDPrism,Comp);
1354 BRepAlgoAPI_Cut trP(VraiDPrism,Comp);
1355 //modified by NIZNHY-PKV Thu Mar 21 17:48:49 2002 t
1356 TopoDS_Shape Cutsh = trP.Shape();
1357 TopExp_Explorer ex(Cutsh, TopAbs_SOLID);
1358 for(; ex.More(); ex.Next()) {
1359 TopExp_Explorer ex1(ex.Current(), TopAbs_FACE);
1360 for(; ex1.More(); ex1.Next()) {
1361 const TopoDS_Face& fac1 = TopoDS::Face(ex1.Current());
1362 TopExp_Explorer ex2(thePbase, TopAbs_FACE);
1363 for(; ex2.More(); ex2.Next()) {
1364 const TopoDS_Face& fac2 = TopoDS::Face(ex2.Current());
1365 if(fac1.IsSame(fac2)) break;
1367 if (ex2.More()) break;
1369 if (ex1.More()) continue;
1370 GluedFaces = Standard_False;
1375 Standard_Boolean trc = BRepFeat_GettraceFEAT();
1376 if (trc) cout << " Intersection DPrism/skface : no gluing" << endl;
1384 //=======================================================================
1387 //=======================================================================
1389 static void MajMap(const TopoDS_Shape& theB,
1390 const LocOpe_DPrism& theP,
1391 TopTools_DataMapOfShapeListOfShape& theMap, // myMap
1392 TopoDS_Shape& theFShape, // myFShape
1393 TopoDS_Shape& theLShape) // myLShape
1395 TopExp_Explorer exp;
1396 if(!theP.FirstShape().IsNull()) {
1397 exp.Init(theP.FirstShape(),TopAbs_WIRE);
1399 theFShape = exp.Current();
1400 TopTools_ListOfShape thelist;
1401 theMap.Bind(theFShape, thelist);
1402 for (exp.Init(theP.FirstShape(),TopAbs_FACE);exp.More();exp.Next()) {
1403 theMap(theFShape).Append(exp.Current());
1408 if(!theP.LastShape().IsNull()) {
1409 exp.Init(theP.LastShape(),TopAbs_WIRE);
1411 theLShape = exp.Current();
1412 TopTools_ListOfShape thelist1;
1413 theMap.Bind(theLShape, thelist1);
1414 for (exp.Init(theP.LastShape(),TopAbs_FACE);exp.More();exp.Next()) {
1415 theMap(theLShape).Append(exp.Current());
1420 for (exp.Init(theB,TopAbs_EDGE); exp.More(); exp.Next()) {
1421 if (!theMap.IsBound(exp.Current())) {
1422 const TopoDS_Edge& edg = TopoDS::Edge(exp.Current());
1423 TopTools_ListOfShape thelist2;
1424 theMap.Bind(edg, thelist2);
1425 theMap(edg) = theP.Shapes(edg);
1431 //=======================================================================
1434 //=======================================================================
1436 static Handle(Geom_Curve) TestCurve(const TopoDS_Face& Base)
1438 gp_Pnt bar(0., 0., 0.);
1439 TColgp_SequenceOfPnt spt;
1440 LocOpe::SampleEdges(Base,spt);
1441 for (Standard_Integer jj=1;jj<=spt.Length(); jj++) {
1442 const gp_Pnt& pvt = spt(jj);
1443 bar.ChangeCoord() += pvt.XYZ();
1445 bar.ChangeCoord().Divide(spt.Length());
1446 Handle(Geom_Surface) s = BRep_Tool::Surface(Base);
1447 if (s->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
1448 s = Handle(Geom_RectangularTrimmedSurface)::
1449 DownCast(s)->BasisSurface();
1451 Handle (Geom_Plane) P = Handle(Geom_Plane)::DownCast(s);
1453 Handle(Geom_Curve) toto;
1456 gp_Pln pp = P->Pln();
1457 gp_Dir Normale(pp.Position().XDirection()^pp.Position().YDirection());
1458 gp_Ax1 theAx(bar, Normale);
1459 Handle(Geom_Line) theLin = new Geom_Line(theAx);
1467 //=======================================================================
1470 //=======================================================================
1472 Standard_Boolean ToFuse(const TopoDS_Face& F1,
1473 const TopoDS_Face& F2)
1475 if (F1.IsNull() || F2.IsNull()) {
1476 return Standard_False;
1479 Handle(Geom_Surface) S1,S2;
1480 TopLoc_Location loc1, loc2;
1481 Handle(Standard_Type) typS1,typS2;
1482 const Standard_Real tollin = Precision::Confusion();
1483 const Standard_Real tolang = Precision::Angular();
1485 S1 = BRep_Tool::Surface(F1,loc1);
1486 S2 = BRep_Tool::Surface(F2,loc2);
1488 typS1 = S1->DynamicType();
1489 typS2 = S2->DynamicType();
1491 if (typS1 == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
1492 S1 = (*((Handle(Geom_RectangularTrimmedSurface)*)&S1))->BasisSurface();
1493 typS1 = S1->DynamicType();
1496 if (typS2 == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
1497 S2 = (*((Handle(Geom_RectangularTrimmedSurface)*)&S2))->BasisSurface();
1498 typS2 = S2->DynamicType();
1501 if (typS1 != typS2) {
1502 return Standard_False;
1506 Standard_Boolean ValRet = Standard_False;
1507 if (typS1 == STANDARD_TYPE(Geom_Plane)) {
1508 S1 = BRep_Tool::Surface(F1); // to apply the location.
1509 S2 = BRep_Tool::Surface(F2);
1510 gp_Pln pl1( (*((Handle(Geom_Plane)*)&S1))->Pln());
1511 gp_Pln pl2( (*((Handle(Geom_Plane)*)&S2))->Pln());
1513 if (pl1.Position().IsCoplanar(pl2.Position(),tollin,tolang)) {
1514 ValRet = Standard_True;