1 // File: BRepFeat_MakeDPrism.cxx
2 // Created: Tue Sep 3 11:18:26 1996
3 // Author: Olga KOULECHOVA
6 #include <BRepFeat_MakeDPrism.ixx>
8 #include <BRepFeat.hxx>
10 #include <LocOpe_CSIntersector.hxx>
11 #include <TColGeom_SequenceOfCurve.hxx>
12 #include <LocOpe_DPrism.hxx>
13 #include <LocOpe_SequenceOfLin.hxx>
14 #include <LocOpe_PntFace.hxx>
18 #include <gp_Pnt2d.hxx>
21 #include <Precision.hxx>
23 #include <Geom_Surface.hxx>
24 #include <Geom_Curve.hxx>
25 #include <Geom_Line.hxx>
26 #include <Geom2d_Curve.hxx>
27 #include <Geom_Plane.hxx>
28 #include <Geom_RectangularTrimmedSurface.hxx>
29 #include <TColgp_SequenceOfPnt.hxx>
30 #include <TColGeom_SequenceOfCurve.hxx>
31 #include <Bnd_Box.hxx>
33 #include <BRepBndLib.hxx>
34 #include <BRep_Builder.hxx>
35 #include <BRep_Tool.hxx>
36 #include <BRepTools.hxx>
37 #include <BRepPrimAPI_MakeBox.hxx>
38 #include <BRepLib.hxx>
40 #include <BRepAlgo.hxx>
41 //modified by NIZNHY-PKV Thu Mar 21 17:49:46 2002 f
42 //#include <BRepAlgo_Cut.hxx>
43 //#include <BRepAlgo_Fuse.hxx>
44 #include <BRepAlgoAPI_Cut.hxx>
45 #include <BRepAlgoAPI_Fuse.hxx>
46 //modified by NIZNHY-PKV Thu Mar 21 17:50:04 2002 t
48 #include <BRepLib_MakeFace.hxx>
50 #include <TopExp_Explorer.hxx>
51 #include <TopTools_MapOfShape.hxx>
52 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
53 #include <TopTools_ListIteratorOfListOfShape.hxx>
54 #include <TopTools_MapIteratorOfMapOfShape.hxx>
55 #include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
56 #include <TopoDS_Solid.hxx>
57 #include <TopoDS_Compound.hxx>
58 #include <TopoDS_Shell.hxx>
59 #include <TopoDS_Shape.hxx>
60 #include <TopoDS_Face.hxx>
63 #include <Standard_ConstructionError.hxx>
67 #include <BRepFeat.hxx>
71 Standard_IMPORT Standard_Boolean BRepFeat_GettraceFEAT();
74 static void MajMap(const TopoDS_Shape&,
76 TopTools_DataMapOfShapeListOfShape&, // myMap
77 TopoDS_Shape&, // myFShape
78 TopoDS_Shape&); // myLShape
81 static void SetGluedFaces(const TopoDS_Face& theSkface,
82 const TopoDS_Shape& theSbase,
83 const TopoDS_Shape& thePbase,
84 const TopTools_DataMapOfShapeListOfShape& theSlmap,
86 TopTools_DataMapOfShapeShape&);
89 static void VerifGluedFaces(const TopoDS_Face& theSkface,
90 const TopoDS_Shape& thePbase,
91 Handle(Geom_Curve)& theBCurve,
92 TColGeom_SequenceOfCurve& theCurves,
93 LocOpe_DPrism& theDPrism,
94 TopTools_DataMapOfShapeShape& theMap);
97 static Standard_Real HeightMax(const TopoDS_Shape& theSbase,
98 const TopoDS_Face& theSkface,
99 const TopoDS_Shape& theSFrom,
100 const TopoDS_Shape& theSUntil);
102 static Standard_Integer SensOfPrism(const Handle(Geom_Curve) C,
103 const TopoDS_Shape& Until);
105 static Handle(Geom_Curve) TestCurve(const TopoDS_Face&);
107 static Standard_Boolean ToFuse(const TopoDS_Face& ,
112 //=======================================================================
115 //=======================================================================
117 void BRepFeat_MakeDPrism::Init(const TopoDS_Shape& Sbase,
118 const TopoDS_Face& Pbase,
119 const TopoDS_Face& Skface,
120 const Standard_Real Angle,
121 const Standard_Integer Mode,
122 const Standard_Boolean Modify)
126 Standard_Boolean trc = BRepFeat_GettraceFEAT();
127 if (trc) cout << "BRepFeat_MakeDPrism::Init" << endl;
136 myFuse = Standard_False;
137 myJustFeat = Standard_False;
140 myFuse = Standard_True;
141 myJustFeat = Standard_False;
144 myFuse = Standard_True;
145 myJustFeat = Standard_True;
150 myJustGluer = Standard_False;
154 //mySkface.Nullify();
164 for (exp.Init(mySbase,TopAbs_FACE);exp.More();exp.Next()) {
165 TopTools_ListOfShape thelist;
166 myMap.Bind(exp.Current(), thelist);
167 myMap(exp.Current()).Append(exp.Current());
172 if (myJustFeat) cout << " Just Feature" << endl;
173 if (myFuse) cout << " Fuse" << endl;
174 if (!myFuse) cout << " Cut" << endl;
175 if (!myModify) cout << " Modify = 0" << endl;
176 // cout <<" Angle = " << myAngle << endl;
182 //=======================================================================
184 //purpose : add faces et edges de glissement
185 //=======================================================================
187 void BRepFeat_MakeDPrism::Add(const TopoDS_Edge& E,
188 const TopoDS_Face& F)
191 Standard_Boolean trc = BRepFeat_GettraceFEAT();
192 if (trc) cout << "BRepFeat_MakeDPrism::Add(Edge,face)" << endl;
195 for (exp.Init(mySbase,TopAbs_FACE);exp.More();exp.Next()) {
196 if (exp.Current().IsSame(F)) {
201 Standard_ConstructionError::Raise();
204 for (exp.Init(myPbase,TopAbs_EDGE);exp.More();exp.Next()) {
205 if (exp.Current().IsSame(E)) {
210 Standard_ConstructionError::Raise();
213 if (!mySlface.IsBound(F)) {
214 TopTools_ListOfShape thelist;
215 mySlface.Bind(F, thelist);
217 TopTools_ListIteratorOfListOfShape itl(mySlface(F));
218 for (; itl.More();itl.Next()) {
219 if (itl.Value().IsSame(E)) {
224 mySlface(F).Append(E);
229 //=======================================================================
231 //purpose : feature de la hauteur Height
232 //=======================================================================
234 void BRepFeat_MakeDPrism::Perform(const Standard_Real Height)
237 Standard_Boolean trc = BRepFeat_GettraceFEAT();
238 if (trc) cout << "BRepFeat_MakeDPrism::Perform(Height)" << endl;
245 myPerfSelection = BRepFeat_NoSelection;
246 PerfSelectionValid();
248 Standard_Real theheight = Height/cos(myAngle);
249 // myPbase.Orientation(TopAbs_FORWARD);
251 LocOpe_DPrism theDPrism(myPbase,theheight,myAngle);
252 TopoDS_Shape VraiDPrism = theDPrism.Shape();
254 MajMap(myPbase,theDPrism,myMap,myFShape,myLShape);
256 myGShape = VraiDPrism;
257 GeneratedShapeValid();
258 TopoDS_Shape Base = theDPrism.FirstShape();
259 TopExp_Explorer exp(Base, TopAbs_FACE);
260 TopoDS_Face theBase = TopoDS::Face(exp.Current());
264 myStatusError = BRepFeat_InvFirstShape;
270 Standard_Boolean found = Standard_False;
272 if(!mySkface.IsNull() || !mySlface.IsEmpty()) {
273 if(myLShape.ShapeType() == TopAbs_WIRE) {
274 TopExp_Explorer ex1(VraiDPrism, TopAbs_FACE);
275 for(; ex1.More(); ex1.Next()) {
276 TopExp_Explorer ex2(ex1.Current(), TopAbs_WIRE);
277 for(; ex2.More(); ex2.Next()) {
278 if(ex2.Current().IsSame(myLShape)) {
279 FFace = TopoDS::Face(ex1.Current());
280 found = Standard_True;
288 TopExp_Explorer exp(mySbase, TopAbs_FACE);
289 for(; exp.More(); exp.Next()) {
290 const TopoDS_Face& ff = TopoDS::Face(exp.Current());
291 if(ToFuse(ff, FFace)) {
292 TopTools_DataMapOfShapeListOfShape sl;
293 //SetGluedFaces(ff, mySbase, FFace, sl, theDPrism, myGluedF);
299 // gestion des faces de collage
301 //SetGluedFaces(mySkface, mySbase, theBase, mySlface, theDPrism, myGluedF);
303 // VerifGluedFaces(mySkface, theBase, myBCurve, myCurves, theDPrism, myGluedF);
305 if(!myGluedF.IsEmpty()) { // cas collage
306 myJustGluer = Standard_True;
307 theDPrism.Curves(myCurves);
308 myBCurve = theDPrism.BarycCurve();
312 // si il n'y a pas de collage -> appel des ope topo
315 //modified by NIZNHY-PKV Thu Mar 21 17:32:17 2002 f
316 //BRepAlgo_Fuse f(mySbase, myGShape);
317 //myShape = f.Shape();
318 //UpdateDescendants(f.Builder(), myShape, Standard_False);
319 BRepAlgoAPI_Fuse f(mySbase, myGShape);
321 UpdateDescendants(f, myShape, Standard_False);
322 //modified by NIZNHY-PKV Thu Mar 21 17:32:23 2002 t
325 else if(myFuse == 0) {
326 //modified by NIZNHY-PKV Thu Mar 21 17:32:57 2002 f
327 //BRepAlgo_Cut c(mySbase, myGShape);
328 //myShape = c.Shape();
329 //UpdateDescendants(c.Builder(), myShape, Standard_False);
330 BRepAlgoAPI_Cut c(mySbase, myGShape);
332 UpdateDescendants(c, myShape, Standard_False);
333 //modified by NIZNHY-PKV Thu Mar 21 17:33:00 2002 t
343 //=======================================================================
345 //purpose : feature limitee par le shape Until
346 //=======================================================================
348 void BRepFeat_MakeDPrism::Perform(const TopoDS_Shape& Until)
351 Standard_Boolean trc = BRepFeat_GettraceFEAT();
352 if (trc) cout << "BRepFeat_MakeDPrism::Perform(Until)" << endl;
354 if (Until.IsNull()) {
355 Standard_ConstructionError::Raise();
357 TopExp_Explorer exp(Until, TopAbs_FACE);
359 Standard_ConstructionError::Raise();
361 // myPbase.Orientation(TopAbs_FORWARD);
364 myPerfSelection = BRepFeat_SelectionU;
365 PerfSelectionValid();
369 Standard_Boolean Trf = TransformShapeFU(1);
371 Handle(Geom_Curve) C = TestCurve(myPbase);
372 Standard_Integer sens = SensOfPrism(C, mySUntil);
375 Standard_Real Height =
376 sens*HeightMax(mySbase, mySkface, mySFrom, mySUntil);
377 LocOpe_DPrism theDPrism(myPbase,Height,myAngle);
378 TopoDS_Shape VraiDPrism = theDPrism.Shape();
380 MajMap(myPbase,theDPrism,myMap,myFShape,myLShape);
381 myGShape = VraiDPrism;
382 GeneratedShapeValid();
383 TopoDS_Shape Base = theDPrism.FirstShape();
384 exp.Init(Base, TopAbs_FACE);
385 TopoDS_Face theBase = TopoDS::Face(exp.Current());
389 myStatusError = BRepFeat_InvFirstShape;
393 //SetGluedFaces(mySkface, mySbase, theBase, mySlface, theDPrism, myGluedF);
395 // VerifGluedFaces(mySkface, theBase, myBCurve, myCurves, theDPrism, myGluedF);
398 theDPrism.Curves(myCurves);
399 myBCurve = theDPrism.BarycCurve();
403 MajMap(myPbase,theDPrism,myMap,myFShape,myLShape);
404 Handle(Geom_Curve) C1;
412 TColGeom_SequenceOfCurve scur;
415 LocOpe_CSIntersector ASI(mySUntil);
417 TopAbs_Orientation Or;
418 if (ASI.IsDone() && ASI.NbPoints(1) >=1) {
420 Or = ASI.Point(1,1).Orientation();
423 Or = ASI.Point(1,ASI.NbPoints(1)).Orientation();
425 // Standard_Real prm = ASI.Point(1,1).Parameter();
426 // if(prm < 0) Or = TopAbs::Reverse(Or);
427 TopoDS_Face FUntil = ASI.Point(1,1).Face();
429 bB.MakeCompound(TopoDS::Compound(Comp));
430 TopoDS_Solid S = BRepFeat::Tool(mySUntil, FUntil, Or);
431 if (!S.IsNull()) bB.Add(Comp,S);
433 //modified by NIZNHY-PKV Thu Mar 21 17:33:27 2002
434 //BRepAlgo_Cut trP(VraiDPrism,Comp);
435 //UpdateDescendants(trP.Builder(),trP.Shape(), Standard_False);
436 BRepAlgoAPI_Cut trP(VraiDPrism,Comp);
437 UpdateDescendants(trP, trP.Shape(), Standard_False);
438 //modified by NIZNHY-PKV Thu Mar 21 17:33:32 2002 t
440 TopExp_Explorer ex(trP.Shape(), TopAbs_SOLID);
441 TopoDS_Shape Cutsh = ex.Current();
443 //modified by NIZNHY-PKV Thu Mar 21 17:34:09 2002 f
444 //BRepAlgo_Fuse f(mySbase, Cutsh);
445 //myShape = f.Shape();
446 //UpdateDescendants(f.Builder(), myShape, Standard_False);
447 BRepAlgoAPI_Fuse f(mySbase, Cutsh);
449 UpdateDescendants(f, myShape, Standard_False);
450 //modified by NIZNHY-PKV Thu Mar 21 17:34:13 2002 t
453 else if(myFuse == 0) {
454 //modified by NIZNHY-PKV Thu Mar 21 17:34:56 2002 f
455 //BRepAlgo_Cut c(mySbase, Cutsh);
456 //myShape = c.Shape();
457 //UpdateDescendants(c.Builder(), myShape, Standard_False);
458 BRepAlgoAPI_Cut c(mySbase, Cutsh);
460 UpdateDescendants(c, myShape, Standard_False);
461 //modified by NIZNHY-PKV Thu Mar 21 17:34:59 2002 t
470 TopTools_ListIteratorOfListOfShape ited(myNewEdges);
471 for (; ited.More();ited.Next()) {
472 const TopoDS_Edge& ledg=TopoDS::Edge(ited.Value());
473 if (!BRepAlgo::IsValid(ledg)) {
474 bB.SameRange(ledg, Standard_False);
475 bB.SameParameter(ledg, Standard_False);
476 BRepLib::SameParameter(ledg, BRep_Tool::Tolerance(ledg));
482 //=======================================================================
484 //purpose : feature limitee par les deux shapes
485 //=======================================================================
487 void BRepFeat_MakeDPrism::Perform(const TopoDS_Shape& From,
488 const TopoDS_Shape& Until)
491 Standard_Boolean trc = BRepFeat_GettraceFEAT();
492 if (trc) cout << "BRepFeat_MakeDPrism::Perform(From,Until)" << endl;
494 if (From.IsNull() || Until.IsNull()) {
495 Standard_ConstructionError::Raise();
498 if (!mySkface.IsNull()) {
499 if (From.IsSame(mySkface)) {
500 myJustGluer = Standard_True;
502 if (myJustGluer) return;
504 else if (Until.IsSame(mySkface)) {
505 myJustGluer = Standard_True;
507 if (myJustGluer) return;
510 // myPbase.Orientation(TopAbs_FORWARD);
513 myPerfSelection = BRepFeat_SelectionFU;
514 PerfSelectionValid();
516 TopExp_Explorer exp(From, TopAbs_FACE);
518 Standard_ConstructionError::Raise();
520 exp.Init(Until, TopAbs_FACE);
522 Standard_ConstructionError::Raise();
525 Standard_Boolean Trff = TransformShapeFU(0);
528 Standard_Boolean Trfu = TransformShapeFU(1);
532 myStatusError = BRepFeat_IncTypes;
535 Handle(Geom_Curve) C = TestCurve(myPbase);
536 Standard_Integer sens;
537 if(From.IsSame(Until)) {
541 sens = SensOfPrism(C, mySUntil);
544 Standard_Real Height =
545 sens*HeightMax(mySbase, myPbase, mySFrom, mySUntil);
546 LocOpe_DPrism theDPrism(myPbase, Height, Height, myAngle);
547 TopoDS_Shape VraiDPrism = theDPrism.Shape();
551 MajMap(myPbase,theDPrism,myMap,myFShape,myLShape);
553 // On fait systematiquement le dprism
554 myGShape = VraiDPrism;
555 GeneratedShapeValid();
557 // gestion des faces de collage
558 //SetGluedFaces(TopoDS_Face(), // on ne veut pas binder mySkface
559 // mySbase, myPbase, mySlface, theDPrism, myGluedF);
561 theDPrism.Curves(myCurves);
562 myBCurve = theDPrism.BarycCurve();
564 // reconstruction topologique
568 // gestion des descendants
569 MajMap(myPbase,theDPrism,myMap,myFShape,myLShape);
570 Handle(Geom_Curve) C1;
577 TColGeom_SequenceOfCurve scur;
580 LocOpe_CSIntersector ASI1(mySUntil);
581 LocOpe_CSIntersector ASI2(mySFrom);
584 TopAbs_Orientation OrU, OrF;
585 TopoDS_Face FFrom, FUntil;
587 if (ASI1.IsDone() && ASI1.NbPoints(1) >=1) {
589 OrU = ASI1.Point(1,1).Orientation();
592 OrU = ASI1.Point(1,ASI1.NbPoints(1)).Orientation();
594 // Standard_Real prm = ASI1.Point(1,1).Parameter();
595 // if(prm < 0) OrU = TopAbs::Reverse(OrU);
596 FUntil = ASI1.Point(1,1).Face();
600 myStatusError = BRepFeat_NoIntersectU;
603 if (ASI2.IsDone() && ASI2.NbPoints(1) >=1) {
604 OrF = ASI2.Point(1,1).Orientation();
605 // Standard_Real prm = ASI2.Point(1,1).Parameter();
606 OrF = TopAbs::Reverse(OrF);
607 FFrom = ASI2.Point(1,1).Face();
611 myStatusError = BRepFeat_NoIntersectF;
616 B.MakeCompound(TopoDS::Compound(Comp));
617 TopoDS_Solid S = BRepFeat::Tool(mySUntil, FUntil, OrU);
618 if (!S.IsNull()) B.Add(Comp,S);
621 myStatusError = BRepFeat_NullToolU;
624 TopoDS_Solid SS = BRepFeat::Tool(mySFrom, FFrom, OrF);
625 if (!SS.IsNull()) B.Add(Comp,SS);
628 myStatusError = BRepFeat_NullToolF;
632 //modified by NIZNHY-PKV Thu Mar 21 17:35:48 2002 f
633 //BRepAlgo_Cut trP(VraiDPrism,Comp);
634 BRepAlgoAPI_Cut trP(VraiDPrism,Comp);
635 //modified by NIZNHY-PKV Thu Mar 21 17:35:59 2002 t
638 //modified by NIZNHY-PKV Thu Mar 21 17:36:06 2002 f
639 //BRepAlgo_Fuse f(mySbase, trP.Shape());
640 //myShape = f.Shape();
641 //UpdateDescendants(f.Builder(), myShape, Standard_False);
642 BRepAlgoAPI_Fuse f(mySbase, trP.Shape());
644 UpdateDescendants(f, myShape, Standard_False);
645 //modified by NIZNHY-PKV Thu Mar 21 17:36:33 2002 t
649 else if(myFuse == 0) {
650 //modified by NIZNHY-PKV Thu Mar 21 17:37:16 2002 f
651 //BRepAlgo_Cut c(mySbase, trP.Shape());
652 //myShape = c.Shape();
653 //UpdateDescendants(c.Builder(), myShape, Standard_False);
654 BRepAlgoAPI_Cut c(mySbase, trP.Shape());
656 UpdateDescendants(c, myShape, Standard_False);
657 //modified by NIZNHY-PKV Thu Mar 21 17:37:49 2002 t
661 myShape = trP.Shape();
668 //=======================================================================
670 //purpose : feature semi-infinie
671 //=======================================================================
673 void BRepFeat_MakeDPrism::PerformUntilEnd()
676 Standard_Boolean trc = BRepFeat_GettraceFEAT();
677 if (trc) cout << "BRepFeat_MakeDPrism::PerformUntilEnd()" << endl;
679 myPerfSelection = BRepFeat_SelectionSh;
680 PerfSelectionValid();
686 Standard_Real Height = HeightMax(mySbase, mySkface, mySFrom, mySUntil);
687 // myPbase.Orientation(TopAbs_FORWARD);
689 LocOpe_DPrism theDPrism(myPbase, Height, myAngle);
690 TopoDS_Shape VraiDPrism = theDPrism.Shape();
692 MajMap(myPbase,theDPrism,myMap,myFShape,myLShape);
694 myGShape = VraiDPrism;
695 GeneratedShapeValid();
697 theDPrism.Curves(myCurves);
698 myBCurve = theDPrism.BarycCurve();
702 //=======================================================================
703 //function : PerformFromEnd
704 //purpose : feature mi-infinie limitee par le shape Until de l'autre cote
705 //=======================================================================
707 void BRepFeat_MakeDPrism::PerformFromEnd(const TopoDS_Shape& Until)
710 Standard_Boolean trc = BRepFeat_GettraceFEAT();
711 if (trc) cout << "BRepFeat_MakeDPrism::PerformFromEnd(From,Until)" << endl;
713 if (Until.IsNull()) {
714 Standard_ConstructionError::Raise();
716 if (!mySkface.IsNull() && Until.IsSame(mySkface)) {
721 exp.Init(Until, TopAbs_FACE);
723 Standard_ConstructionError::Raise();
725 // myPbase.Orientation(TopAbs_FORWARD);
726 myPerfSelection = BRepFeat_SelectionShU;
727 PerfSelectionValid();
731 Standard_Boolean Trf = TransformShapeFU(1);
733 Handle(Geom_Curve) C = TestCurve(myPbase);
734 Standard_Integer sens = SensOfPrism(C, mySUntil);
735 Standard_Real Height =
736 sens*HeightMax(mySbase, mySkface, mySFrom, mySUntil);
738 LocOpe_DPrism theDPrism(myPbase, Height, Height, myAngle);
739 TopoDS_Shape VraiDPrism = theDPrism.Shape();
740 if(VraiDPrism.IsNull()) {
742 myStatusError = BRepFeat_NullRealTool;
746 if(!Trf) { // cas face finie
747 MajMap(myPbase,theDPrism,myMap,myFShape,myLShape);
748 myGShape = VraiDPrism;
749 GeneratedShapeValid();
752 theDPrism.Curves(myCurves);
753 myBCurve = theDPrism.BarycCurve();
756 else { // cas support
757 MajMap(myPbase,theDPrism,myMap,myFShape,myLShape);
758 Handle(Geom_Curve) C2;
765 TColGeom_SequenceOfCurve scur;
768 LocOpe_CSIntersector ASI1(mySUntil);
769 LocOpe_CSIntersector ASI2(mySbase);
773 TopAbs_Orientation OrU = TopAbs_FORWARD, OrF = TopAbs_FORWARD;
775 TopAbs_Orientation OrU, OrF;
777 TopoDS_Face FUntil, FFrom;
778 if (ASI1.IsDone() && ASI1.NbPoints(1) >=1) {
779 OrU = ASI1.Point(1,1).Orientation();
780 Standard_Real prm = ASI1.Point(1,1).Parameter();
781 if(prm < 0) OrU = TopAbs::Reverse(OrU);
782 FUntil = ASI1.Point(1,1).Face();
785 if (ASI2.IsDone() && ASI2.NbPoints(1) >=1) {
786 Standard_Integer jj = ASI2.NbPoints(1);
787 Standard_Real prm = ASI2.Point(1,1).Parameter();
788 FFrom = ASI2.Point(1, 1).Face();
789 OrF = ASI2.Point(1,1).Orientation();
790 OrF = TopAbs::Reverse(OrF);
791 for(Standard_Integer iii = 1; iii <= jj; iii++) {
792 if(ASI2.Point(1,iii).Parameter() < prm) {
793 prm = ASI2.Point(1,iii).Parameter();
794 FFrom = ASI2.Point(1, iii).Face();
795 OrF = ASI2.Point(1,iii).Orientation();
796 OrF = TopAbs::Reverse(OrF);
799 Handle(Geom_Surface) S = BRep_Tool::Surface(FFrom);
800 if (S->DynamicType() ==
801 STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
802 S = Handle(Geom_RectangularTrimmedSurface)::
803 DownCast(S)->BasisSurface();
805 BRepLib_MakeFace fac(S, Precision::Confusion());
806 mySFrom = fac.Face();
807 Trf = TransformShapeFU(0);
808 // FFrom = TopoDS::Face(mySFrom);
813 B.MakeCompound(TopoDS::Compound(Comp));
814 TopoDS_Solid Sol = BRepFeat::Tool(mySUntil, FUntil, OrU);
815 if (!Sol.IsNull()) B.Add(Comp,Sol);
818 myStatusError = BRepFeat_NullToolU;
822 TopoDS_Solid Sol1 = BRepFeat::Tool(mySFrom, FFrom, OrF);
823 if (!Sol1.IsNull()) B.Add(Comp,Sol1);
826 myStatusError = BRepFeat_NullToolF;
830 //modified by NIZNHY-PKV Thu Mar 21 17:38:33 2002 f
831 //BRepAlgo_Cut trP(VraiDPrism,Comp);
832 BRepAlgoAPI_Cut trP(VraiDPrism,Comp);
833 //modified by NIZNHY-PKV Thu Mar 21 17:38:37 2002 t
835 //modified by NIZNHY-PKV Thu Mar 21 17:40:03 2002 f
836 //BRepAlgo_Fuse f(mySbase, trP.Shape());
837 //myShape = f.Shape();
838 //UpdateDescendants(f.Builder(), myShape, Standard_False);
839 BRepAlgoAPI_Fuse f(mySbase, trP.Shape());
841 UpdateDescendants(f, myShape, Standard_False);
842 //modified by NIZNHY-PKV Thu Mar 21 17:40:07 2002 t
845 else if(myFuse == 0) {
846 //modified by NIZNHY-PKV Thu Mar 21 17:40:33 2002 t
847 //BRepAlgo_Cut c(mySbase, trP.Shape());
848 //myShape = c.Shape();
849 //UpdateDescendants(c.Builder(), myShape, Standard_False);
850 BRepAlgoAPI_Cut c(mySbase, trP.Shape());
852 UpdateDescendants(c, myShape, Standard_False);
853 //modified by NIZNHY-PKV Thu Mar 21 17:40:44 2002 t
857 myShape = trP.Shape();
865 //=======================================================================
866 //function : PerformThruAll
867 //purpose : feature a travers tout le shape initial
868 //=======================================================================
870 void BRepFeat_MakeDPrism::PerformThruAll()
873 Standard_Boolean trc = BRepFeat_GettraceFEAT();
874 if (trc) cout << "BRepFeat_MakeDPrism::PerformThruAll()" << endl;
881 myPerfSelection = BRepFeat_NoSelection;
884 myPerfSelection = BRepFeat_SelectionSh;
887 PerfSelectionValid();
888 // myPbase.Orientation(TopAbs_FORWARD);
892 Standard_Real Height = HeightMax(mySbase, mySkface, mySFrom, mySUntil);
893 LocOpe_DPrism theDPrism(myPbase, Height, Height, myAngle);
894 TopoDS_Shape VraiDPrism = theDPrism.Shape();
895 MajMap(myPbase,theDPrism,myMap,myFShape,myLShape);
897 myGShape = VraiDPrism;
898 GeneratedShapeValid();
901 //modified by NIZNHY-PKV Thu Mar 21 17:46:16 2002 f
902 //BRepAlgo_Cut c(mySbase, myGShape);
903 BRepAlgoAPI_Cut c(mySbase, myGShape);
904 //modified by NIZNHY-PKV Thu Mar 21 17:46:26 2002 t
907 //modified by NIZNHY-PKV Thu Mar 21 17:46:39 2002 f
908 //UpdateDescendants(c.Builder(), myShape, Standard_False);
909 UpdateDescendants(c, myShape, Standard_False);
910 //modified by NIZNHY-PKV Thu Mar 21 17:46:43 2002 t
915 theDPrism.Curves(myCurves);
916 myBCurve = theDPrism.BarycCurve();
922 //=======================================================================
923 //function : PerformUntilHeight
924 //purpose : feature jusqu'un shape de la hauteur donnee
925 //=======================================================================
927 void BRepFeat_MakeDPrism::PerformUntilHeight(const TopoDS_Shape& Until,
928 const Standard_Real Height)
931 Standard_Boolean trc = BRepFeat_GettraceFEAT();
932 if (trc) cout << "BRepFeat_MakeDPrism::PerformUntilHeight(Until,Height)" << endl;
934 if (Until.IsNull()) {
940 TopExp_Explorer exp(Until, TopAbs_FACE);
942 Standard_ConstructionError::Raise();
944 // myPbase.Orientation(TopAbs_FORWARD);
946 myPerfSelection = BRepFeat_NoSelection;
947 PerfSelectionValid();
951 Standard_Boolean Trf = TransformShapeFU(1);
953 Handle(Geom_Curve) C = TestCurve(myPbase);
954 Standard_Integer sens = SensOfPrism(C, mySUntil);
956 LocOpe_DPrism theDPrism(myPbase,sens*Height,myAngle);
957 TopoDS_Shape VraiDPrism = theDPrism.Shape();
959 if(!Trf) { // cas face finie
960 MajMap(myPbase,theDPrism,myMap,myFShape,myLShape);
961 myGShape = VraiDPrism;
962 GeneratedShapeValid();
963 TopoDS_Shape Base = theDPrism.FirstShape();
964 exp.Init(Base, TopAbs_FACE);
965 TopoDS_Face theBase = TopoDS::Face(exp.Current());
969 myStatusError = BRepFeat_InvFirstShape;
973 //SetGluedFaces(mySkface, mySbase, theBase, mySlface, theDPrism, myGluedF);
975 // VerifGluedFaces(mySkface, theBase, myBCurve, myCurves, theDPrism, myGluedF);
977 theDPrism.Curves(myCurves);
978 myBCurve = theDPrism.BarycCurve();
981 else { // cas support
982 MajMap(myPbase,theDPrism,myMap,myFShape,myLShape);
983 Handle(Geom_Curve) C1;
990 TColGeom_SequenceOfCurve scur;
993 LocOpe_CSIntersector ASI(mySUntil);
995 TopAbs_Orientation Or;
996 if (ASI.IsDone() && ASI.NbPoints(1) >=1) {
998 Or = ASI.Point(1,1).Orientation();
1001 Or = ASI.Point(1,ASI.NbPoints(1)).Orientation();
1003 // Standard_Real prm = ASI.Point(1,1).Parameter();
1004 // if(prm < 0) Or = TopAbs::Reverse(Or);
1005 TopoDS_Face FUntil = ASI.Point(1,1).Face();
1008 B.MakeCompound(TopoDS::Compound(Comp));
1009 TopoDS_Solid S = BRepFeat::Tool(mySUntil, FUntil, Or);
1010 if (!S.IsNull()) B.Add(Comp,S);
1011 //modified by NIZNHY-PKV Thu Mar 21 17:47:14 2002 f
1012 //BRepAlgo_Cut trP(VraiDPrism,Comp);
1013 BRepAlgoAPI_Cut trP(VraiDPrism,Comp);
1014 //modified by NIZNHY-PKV Thu Mar 21 17:47:21 2002 t
1016 //modified by NIZNHY-PKV Thu Mar 21 17:47:42 2002 f
1017 //BRepAlgo_Fuse f(mySbase, trP.Shape());
1018 //myShape = f.Shape();
1019 //UpdateDescendants(f.Builder(), myShape, Standard_False);
1020 BRepAlgoAPI_Fuse f(mySbase, trP.Shape());
1021 myShape = f.Shape();
1022 UpdateDescendants(f, myShape, Standard_False);
1023 //modified by NIZNHY-PKV Thu Mar 21 17:47:49 2002 t
1026 else if(myFuse == 0) {
1027 //modified by NIZNHY-PKV Thu Mar 21 17:48:18 2002 f
1028 //BRepAlgo_Cut c(mySbase, trP.Shape());
1029 //myShape = c.Shape();
1030 //UpdateDescendants(c.Builder(), myShape, Standard_False);
1031 BRepAlgoAPI_Cut c(mySbase, trP.Shape());
1032 myShape = c.Shape();
1033 UpdateDescendants(c, myShape, Standard_False);
1034 //modified by NIZNHY-PKV Thu Mar 21 17:48:26 2002 t
1038 myShape = trP.Shape();
1046 //=======================================================================
1048 //purpose : courbes paralleles a l'axe du prism
1049 //=======================================================================
1051 void BRepFeat_MakeDPrism::Curves(TColGeom_SequenceOfCurve& scur)
1056 //============================================================================
1057 // function : BRepFeat_BossEgdes
1058 // purpose: Determination of TopEdges and LatEdges.
1059 // sig = 1 -> TopEdges = FirstShape of the DPrism
1060 // sig = 2 -> TOpEdges = LastShape of the DPrism
1061 //============================================================================
1062 void BRepFeat_MakeDPrism::BossEdges (const Standard_Integer signature)
1065 Standard_Boolean trc = BRepFeat_GettraceFEAT();
1066 if (trc) cout << "BRepFeat_MakeDPrism::BossEdges (integer)" << endl;
1068 TopTools_ListOfShape theLastShape;
1069 theLastShape.Clear();
1070 if (signature == 1 || signature == -1) {
1071 theLastShape = FirstShape();
1073 else if (signature == 2 || signature == -2) {
1074 theLastShape = LastShape();
1081 TopTools_ListIteratorOfListOfShape itLS;
1082 TopExp_Explorer ExpE;
1083 for (itLS.Initialize(theLastShape);itLS.More();itLS.Next()) {
1084 const TopoDS_Face& FF = TopoDS::Face(itLS.Value());
1085 for (ExpE.Init(FF,TopAbs_EDGE);ExpE.More();ExpE.Next()) {
1086 const TopoDS_Edge& EE = TopoDS::Edge(ExpE.Current());
1087 myTopEdges.Append(EE);
1092 if (signature < 0) {
1093 // Attention voir si TgtEdges est important
1094 myLatEdges = NewEdges();
1096 else if (signature > 0) {
1097 if ( !myShape.IsNull() ) {
1098 TopTools_MapOfShape MapE;
1099 Standard_Boolean Found;
1101 TopExp_Explorer ExpF;
1102 for (ExpF.Init(myShape,TopAbs_FACE);ExpF.More();ExpF.Next()) {
1103 Found = Standard_False;
1104 const TopoDS_Face& FF = TopoDS::Face(ExpF.Current());
1105 for (itLS.Initialize(theLastShape);itLS.More();itLS.Next()) {
1106 const TopoDS_Face& TopFace = TopoDS::Face(itLS.Value());
1107 if (!FF.IsSame(TopFace)) {
1108 TopExp_Explorer ExpE;
1109 for (ExpE.Init(FF,TopAbs_EDGE);ExpE.More() && !Found ;ExpE.Next()) {
1110 const TopoDS_Edge& E1 = TopoDS::Edge(ExpE.Current());
1111 TopoDS_Vertex V1,V2;
1112 TopExp::Vertices (E1,V1,V2);
1113 TopTools_ListIteratorOfListOfShape it(myTopEdges);
1114 for (;it.More() && !Found ; it.Next()) {
1115 TopoDS_Edge E2 = TopoDS::Edge(it.Value());
1116 TopoDS_Vertex VT1,VT2;
1117 TopExp::Vertices (E2,VT1,VT2);
1119 if (V1.IsSame(VT1) || V1.IsSame(VT2) || V2.IsSame(VT1) || V2.IsSame(VT2)) {
1120 Found = Standard_True;
1121 TopExp_Explorer ExpE2;
1122 for (ExpE2.Init(FF,TopAbs_EDGE);ExpE2.More();ExpE2.Next()) {
1123 const TopoDS_Edge& E3 = TopoDS::Edge(ExpE2.Current());
1124 if (MapE.Contains(E3)) {
1136 TopTools_ListIteratorOfListOfShape it(myTopEdges);
1137 for (;it.More() ; it.Next()) {
1138 if (MapE.Contains(it.Value())) {MapE.Remove(it.Value()); }
1141 TopTools_MapIteratorOfMapOfShape itMap;
1142 for (itMap.Initialize(MapE);itMap.More();itMap.Next()) {
1143 if (!BRep_Tool::Degenerated(TopoDS::Edge(itMap.Key())))
1144 myLatEdges.Append(itMap.Key());
1152 //============================================================================
1153 // function : BRepFeat_TopEgdes
1154 // Purpose: Returns the list of TopoDS Edges of the top of the boss
1155 //============================================================================
1156 const TopTools_ListOfShape& BRepFeat_MakeDPrism::TopEdges ()
1161 //============================================================================
1162 // function : BRepFeat_LatEgdes
1163 // Purpose: Returns the list of TopoDS Edges of the top of the boss
1164 //============================================================================
1165 const TopTools_ListOfShape& BRepFeat_MakeDPrism::LatEdges ()
1170 //=======================================================================
1171 //function : BarycCurve
1172 //purpose : passe par le centre de masses de la primitive
1173 //=======================================================================
1175 Handle(Geom_Curve) BRepFeat_MakeDPrism::BarycCurve()
1181 //=======================================================================
1182 //function : HeightMax
1183 //purpose : Calcul de la hauteur du prisme selon les parametres d`une boite englobante
1184 //=======================================================================
1186 static Standard_Real HeightMax(const TopoDS_Shape& theSbase, // shape initial
1187 const TopoDS_Face& theSkface, // face de sketch
1188 const TopoDS_Shape& theSFrom, // shape from
1189 const TopoDS_Shape& theSUntil) // shape until
1192 BRepBndLib::Add(theSbase,Box);
1193 BRepBndLib::Add(theSkface,Box);
1194 if(!theSFrom.IsNull()) {
1195 BRepBndLib::Add(theSFrom,Box);
1197 if(!theSUntil.IsNull()) {
1198 BRepBndLib::Add(theSUntil,Box);
1202 Box.Get(c[0],c[2],c[4],c[1],c[3],c[5]);
1203 // Standard_Real parmin=c[0], parmax = c[0];
1204 // for(Standard_Integer i = 0 ; i < 6; i++) {
1205 // if(c[i] > parmax) parmax = c[i];
1206 // if(c[i] < parmin ) parmin = c[i];
1208 // Standard_Real Height = abs(2.*(parmax - parmin));
1209 // return(2.*Height);
1211 Standard_Real par = Max( Max( fabs(c[1] - c[0]), fabs(c[3] - c[2]) ), fabs(c[5] - c[4]) );
1213 // Standard_Real par = Max( Max( abs(c[1] - c[0]), abs(c[3] - c[2]) ), abs(c[5] - c[4]) );
1216 cout << "Height = > " << par << endl;
1225 //=======================================================================
1226 //function : SensOfPrism
1227 //purpose : determiner la direction de generation du prism
1228 //=======================================================================
1229 Standard_Integer SensOfPrism(const Handle(Geom_Curve) C,
1230 const TopoDS_Shape& Until)
1232 LocOpe_CSIntersector ASI1(Until);
1233 TColGeom_SequenceOfCurve scur;
1236 Standard_Integer sens = 1;
1237 if(ASI1.IsDone() && ASI1.NbPoints(1) >= 1) {
1238 Standard_Integer nb = ASI1.NbPoints(1);
1239 Standard_Real prm1 = ASI1.Point(1, 1).Parameter();
1240 Standard_Real prm2 = ASI1.Point(1, nb).Parameter();
1241 if(prm1 < 0. && prm2 < 0.) {
1245 else if(BRepFeat::ParametricBarycenter(Until,C) < 0) {
1253 //=======================================================================
1254 //function : SetGluedFaces
1256 //=======================================================================
1258 static void SetGluedFaces(const TopoDS_Face& theSkface,
1259 const TopoDS_Shape& theSbase,
1260 const TopoDS_Shape& thePbase,
1261 const TopTools_DataMapOfShapeListOfShape& theSlmap,
1262 LocOpe_DPrism& theDPrism,
1263 TopTools_DataMapOfShapeShape& theMap)
1265 TopExp_Explorer exp;
1266 if (!theSkface.IsNull() && thePbase.ShapeType() == TopAbs_FACE) {
1267 for (exp.Init(theSbase,TopAbs_FACE); exp.More(); exp.Next()) {
1268 if (exp.Current().IsSame(theSkface)) {
1269 theMap.Bind(thePbase,theSkface);
1275 TopExp_Explorer exp2;
1276 for (exp.Init(thePbase,TopAbs_FACE);exp.More();exp.Next()) {
1277 const TopoDS_Face& fac = TopoDS::Face(exp.Current());
1278 for (exp2.Init(theSbase,TopAbs_FACE);exp2.More();exp2.Next()) {
1279 if (exp2.Current().IsSame(fac)) {
1280 theMap.Bind(fac,fac);
1288 TopTools_DataMapIteratorOfDataMapOfShapeListOfShape itm(theSlmap);
1289 if(!theSlmap.IsEmpty()) {
1290 for (; itm.More(); itm.Next()) {
1291 const TopoDS_Face& fac = TopoDS::Face(itm.Key());
1292 const TopTools_ListOfShape& ledg = itm.Value();
1293 for (TopTools_ListIteratorOfListOfShape it(ledg); it.More(); it.Next()) {
1294 const TopTools_ListOfShape& gfac = theDPrism.Shapes(it.Value());
1295 if (gfac.Extent() != 1) {
1297 Standard_Boolean trc = BRepFeat_GettraceFEAT();
1298 if (trc) cout << " BRepFeat_MakeDPrism : Pb SetGluedFace" << endl;
1301 theMap.Bind(gfac.First(),fac);
1308 //=======================================================================
1309 //function : VerifGluedFaces
1310 //purpose : Verification intersection Outil/theSkface = thePbase
1311 // Si oui -> OK si non -> cas sans collage
1312 //=======================================================================
1314 static void VerifGluedFaces(const TopoDS_Face& theSkface,
1315 const TopoDS_Shape& thePbase,
1316 Handle(Geom_Curve)& theBCurve,
1317 TColGeom_SequenceOfCurve& theCurves,
1318 LocOpe_DPrism& theDPrism,
1319 TopTools_DataMapOfShapeShape& theMap)
1321 Standard_Boolean GluedFaces = Standard_True;
1322 TopoDS_Shape VraiDPrism = theDPrism.Shape();
1324 TColGeom_SequenceOfCurve scur;
1325 theDPrism.Curves(theCurves);
1326 theBCurve = theDPrism.BarycCurve();
1328 scur.Append(theBCurve);
1329 LocOpe_CSIntersector ASI(theSkface);
1331 if (ASI.IsDone() && ASI.NbPoints(1) >=1) {
1332 TopAbs_Orientation Or = ASI.Point(1,1).Orientation();
1333 TopoDS_Face FSk = ASI.Point(1,1).Face();
1336 B.MakeCompound(TopoDS::Compound(Comp));
1337 TopoDS_Solid S = BRepFeat::Tool(theSkface, FSk, Or);
1338 if (!S.IsNull()) B.Add(Comp,S);
1339 //modified by NIZNHY-PKV Thu Mar 21 17:48:45 2002 f
1340 //BRepAlgo_Cut trP(VraiDPrism,Comp);
1341 BRepAlgoAPI_Cut trP(VraiDPrism,Comp);
1342 //modified by NIZNHY-PKV Thu Mar 21 17:48:49 2002 t
1343 TopoDS_Shape Cutsh = trP.Shape();
1344 TopExp_Explorer ex(Cutsh, TopAbs_SOLID);
1345 for(; ex.More(); ex.Next()) {
1346 TopExp_Explorer ex1(ex.Current(), TopAbs_FACE);
1347 for(; ex1.More(); ex1.Next()) {
1348 const TopoDS_Face& fac1 = TopoDS::Face(ex1.Current());
1349 TopExp_Explorer ex2(thePbase, TopAbs_FACE);
1350 for(; ex2.More(); ex2.Next()) {
1351 const TopoDS_Face& fac2 = TopoDS::Face(ex2.Current());
1352 if(fac1.IsSame(fac2)) break;
1354 if (ex2.More()) break;
1356 if (ex1.More()) continue;
1357 GluedFaces = Standard_False;
1362 Standard_Boolean trc = BRepFeat_GettraceFEAT();
1363 if (trc) cout << " Intersection DPrism/skface : pas de collage" << endl;
1371 //=======================================================================
1374 //=======================================================================
1376 static void MajMap(const TopoDS_Shape& theB,
1377 const LocOpe_DPrism& theP,
1378 TopTools_DataMapOfShapeListOfShape& theMap, // myMap
1379 TopoDS_Shape& theFShape, // myFShape
1380 TopoDS_Shape& theLShape) // myLShape
1382 TopExp_Explorer exp;
1383 if(!theP.FirstShape().IsNull()) {
1384 exp.Init(theP.FirstShape(),TopAbs_WIRE);
1386 theFShape = exp.Current();
1387 TopTools_ListOfShape thelist;
1388 theMap.Bind(theFShape, thelist);
1389 for (exp.Init(theP.FirstShape(),TopAbs_FACE);exp.More();exp.Next()) {
1390 theMap(theFShape).Append(exp.Current());
1395 if(!theP.LastShape().IsNull()) {
1396 exp.Init(theP.LastShape(),TopAbs_WIRE);
1398 theLShape = exp.Current();
1399 TopTools_ListOfShape thelist1;
1400 theMap.Bind(theLShape, thelist1);
1401 for (exp.Init(theP.LastShape(),TopAbs_FACE);exp.More();exp.Next()) {
1402 theMap(theLShape).Append(exp.Current());
1407 for (exp.Init(theB,TopAbs_EDGE); exp.More(); exp.Next()) {
1408 if (!theMap.IsBound(exp.Current())) {
1409 const TopoDS_Edge& edg = TopoDS::Edge(exp.Current());
1410 TopTools_ListOfShape thelist2;
1411 theMap.Bind(edg, thelist2);
1412 theMap(edg) = theP.Shapes(edg);
1418 //=======================================================================
1421 //=======================================================================
1423 static Handle(Geom_Curve) TestCurve(const TopoDS_Face& Base)
1425 gp_Pnt bar(0., 0., 0.);
1426 TColgp_SequenceOfPnt spt;
1427 LocOpe::SampleEdges(Base,spt);
1428 for (Standard_Integer jj=1;jj<=spt.Length(); jj++) {
1429 const gp_Pnt& pvt = spt(jj);
1430 bar.ChangeCoord() += pvt.XYZ();
1432 bar.ChangeCoord().Divide(spt.Length());
1433 Handle(Geom_Surface) s = BRep_Tool::Surface(Base);
1434 if (s->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
1435 s = Handle(Geom_RectangularTrimmedSurface)::
1436 DownCast(s)->BasisSurface();
1438 Handle (Geom_Plane) P = Handle(Geom_Plane)::DownCast(s);
1440 Handle(Geom_Curve) toto;
1443 gp_Pln pp = P->Pln();
1444 gp_Dir Normale(pp.Position().XDirection()^pp.Position().YDirection());
1445 gp_Ax1 theAx(bar, Normale);
1446 Handle(Geom_Line) theLin = new Geom_Line(theAx);
1454 //=======================================================================
1457 //=======================================================================
1459 Standard_Boolean ToFuse(const TopoDS_Face& F1,
1460 const TopoDS_Face& F2)
1462 if (F1.IsNull() || F2.IsNull()) {
1463 return Standard_False;
1466 Handle(Geom_Surface) S1,S2;
1467 TopLoc_Location loc1, loc2;
1468 Handle(Standard_Type) typS1,typS2;
1469 const Standard_Real tollin = Precision::Confusion();
1470 const Standard_Real tolang = Precision::Angular();
1472 S1 = BRep_Tool::Surface(F1,loc1);
1473 S2 = BRep_Tool::Surface(F2,loc2);
1475 typS1 = S1->DynamicType();
1476 typS2 = S2->DynamicType();
1478 if (typS1 == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
1479 S1 = (*((Handle(Geom_RectangularTrimmedSurface)*)&S1))->BasisSurface();
1480 typS1 = S1->DynamicType();
1483 if (typS2 == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
1484 S2 = (*((Handle(Geom_RectangularTrimmedSurface)*)&S2))->BasisSurface();
1485 typS2 = S2->DynamicType();
1488 if (typS1 != typS2) {
1489 return Standard_False;
1493 Standard_Boolean ValRet = Standard_False;
1494 if (typS1 == STANDARD_TYPE(Geom_Plane)) {
1495 S1 = BRep_Tool::Surface(F1); // pour appliquer la location.
1496 S2 = BRep_Tool::Surface(F2);
1497 gp_Pln pl1( (*((Handle(Geom_Plane)*)&S1))->Pln());
1498 gp_Pln pl2( (*((Handle(Geom_Plane)*)&S2))->Pln());
1500 if (pl1.Position().IsCoplanar(pl2.Position(),tollin,tolang)) {
1501 ValRet = Standard_True;