Commit | Line | Data |
---|---|---|
b311480e | 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 | |
5 | // | |
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. | |
10 | // | |
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. | |
13 | // | |
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. | |
20 | ||
7fd59977 | 21 | |
22 | ||
23 | #include <BRepFeat_MakeDPrism.ixx> | |
24 | ||
25 | #include <BRepFeat.hxx> | |
26 | #include <LocOpe.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> | |
32 | ||
33 | #include <gp_Vec.hxx> | |
34 | #include <gp_Pnt.hxx> | |
35 | #include <gp_Pnt2d.hxx> | |
36 | #include <gp_Pln.hxx> | |
37 | ||
38 | #include <Precision.hxx> | |
39 | ||
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> | |
49 | ||
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> | |
56 | ||
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 | |
64 | ||
65 | #include <BRepLib_MakeFace.hxx> | |
66 | ||
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> | |
78 | #include <TopoDS.hxx> | |
79 | ||
80 | #include <Standard_ConstructionError.hxx> | |
81 | ||
82 | #include <TopExp.hxx> | |
83 | ||
84 | #include <BRepFeat.hxx> | |
85 | #include <TopAbs.hxx> | |
86 | ||
87 | #ifdef DEB | |
1d0a9d4d | 88 | extern Standard_Boolean BRepFeat_GettraceFEAT(); |
7fd59977 | 89 | #endif |
90 | ||
91 | static void MajMap(const TopoDS_Shape&, | |
92 | const LocOpe_DPrism&, | |
93 | TopTools_DataMapOfShapeListOfShape&, // myMap | |
94 | TopoDS_Shape&, // myFShape | |
95 | TopoDS_Shape&); // myLShape | |
96 | ||
97 | ||
98 | static void SetGluedFaces(const TopoDS_Face& theSkface, | |
99 | const TopoDS_Shape& theSbase, | |
100 | const TopoDS_Shape& thePbase, | |
101 | const TopTools_DataMapOfShapeListOfShape& theSlmap, | |
102 | LocOpe_DPrism&, | |
103 | TopTools_DataMapOfShapeShape&); | |
104 | ||
105 | #ifdef DEB | |
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); | |
112 | #endif | |
113 | ||
114 | static Standard_Real HeightMax(const TopoDS_Shape& theSbase, | |
115 | const TopoDS_Face& theSkface, | |
116 | const TopoDS_Shape& theSFrom, | |
117 | const TopoDS_Shape& theSUntil); | |
118 | ||
119 | static Standard_Integer SensOfPrism(const Handle(Geom_Curve) C, | |
120 | const TopoDS_Shape& Until); | |
121 | ||
122 | static Handle(Geom_Curve) TestCurve(const TopoDS_Face&); | |
123 | ||
124 | static Standard_Boolean ToFuse(const TopoDS_Face& , | |
125 | const TopoDS_Face&); | |
126 | ||
127 | ||
128 | ||
129 | //======================================================================= | |
130 | //function : Init | |
131 | //purpose : | |
132 | //======================================================================= | |
133 | ||
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) | |
140 | ||
141 | { | |
142 | #ifdef DEB | |
143 | Standard_Boolean trc = BRepFeat_GettraceFEAT(); | |
144 | if (trc) cout << "BRepFeat_MakeDPrism::Init" << endl; | |
145 | #endif | |
146 | mySkface = Skface; | |
147 | SketchFaceValid(); | |
148 | mySbase = Sbase; | |
149 | BasisShapeValid(); | |
150 | myPbase = Pbase; | |
151 | mySlface.Clear(); | |
152 | if(Mode == 0) { | |
153 | myFuse = Standard_False; | |
154 | myJustFeat = Standard_False; | |
155 | } | |
156 | else if(Mode == 1) { | |
157 | myFuse = Standard_True; | |
158 | myJustFeat = Standard_False; | |
159 | } | |
160 | else if(Mode == 2) { | |
161 | myFuse = Standard_True; | |
162 | myJustFeat = Standard_True; | |
163 | } | |
164 | else { | |
165 | } | |
166 | myModify = Modify; | |
167 | myJustGluer = Standard_False; | |
168 | ||
169 | ||
170 | //-------------- ifv | |
171 | //mySkface.Nullify(); | |
172 | //-------------- ifv | |
173 | ||
174 | myShape.Nullify(); | |
175 | myMap.Clear(); | |
176 | myFShape.Nullify(); | |
177 | myLShape.Nullify(); | |
178 | myTopEdges.Clear(); | |
179 | myLatEdges.Clear(); | |
180 | TopExp_Explorer exp; | |
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()); | |
185 | } | |
186 | myAngle = Angle; | |
187 | #ifdef DEB | |
188 | if (trc) { | |
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; | |
194 | } | |
195 | #endif | |
196 | } | |
197 | ||
198 | ||
199 | //======================================================================= | |
200 | //function : Add | |
0d969553 | 201 | //purpose : add sliding faces and edges |
7fd59977 | 202 | //======================================================================= |
203 | ||
204 | void BRepFeat_MakeDPrism::Add(const TopoDS_Edge& E, | |
205 | const TopoDS_Face& F) | |
206 | { | |
207 | #ifdef DEB | |
208 | Standard_Boolean trc = BRepFeat_GettraceFEAT(); | |
209 | if (trc) cout << "BRepFeat_MakeDPrism::Add(Edge,face)" << endl; | |
210 | #endif | |
211 | TopExp_Explorer exp; | |
212 | for (exp.Init(mySbase,TopAbs_FACE);exp.More();exp.Next()) { | |
213 | if (exp.Current().IsSame(F)) { | |
214 | break; | |
215 | } | |
216 | } | |
217 | if (!exp.More()) { | |
218 | Standard_ConstructionError::Raise(); | |
219 | } | |
220 | ||
221 | for (exp.Init(myPbase,TopAbs_EDGE);exp.More();exp.Next()) { | |
222 | if (exp.Current().IsSame(E)) { | |
223 | break; | |
224 | } | |
225 | } | |
226 | if (!exp.More()) { | |
227 | Standard_ConstructionError::Raise(); | |
228 | } | |
229 | ||
230 | if (!mySlface.IsBound(F)) { | |
231 | TopTools_ListOfShape thelist; | |
232 | mySlface.Bind(F, thelist); | |
233 | } | |
234 | TopTools_ListIteratorOfListOfShape itl(mySlface(F)); | |
235 | for (; itl.More();itl.Next()) { | |
236 | if (itl.Value().IsSame(E)) { | |
237 | break; | |
238 | } | |
239 | } | |
240 | if (!itl.More()) { | |
241 | mySlface(F).Append(E); | |
242 | } | |
243 | } | |
244 | ||
245 | ||
246 | //======================================================================= | |
247 | //function : Perform | |
0d969553 | 248 | //purpose : feature of Height |
7fd59977 | 249 | //======================================================================= |
250 | ||
251 | void BRepFeat_MakeDPrism::Perform(const Standard_Real Height) | |
252 | { | |
253 | #ifdef DEB | |
254 | Standard_Boolean trc = BRepFeat_GettraceFEAT(); | |
255 | if (trc) cout << "BRepFeat_MakeDPrism::Perform(Height)" << endl; | |
256 | #endif | |
257 | mySFrom.Nullify(); | |
258 | ShapeFromValid(); | |
259 | mySUntil.Nullify(); | |
260 | ShapeUntilValid(); | |
261 | myGluedF.Clear(); | |
262 | myPerfSelection = BRepFeat_NoSelection; | |
263 | PerfSelectionValid(); | |
264 | ||
265 | Standard_Real theheight = Height/cos(myAngle); | |
266 | // myPbase.Orientation(TopAbs_FORWARD); | |
267 | ||
268 | LocOpe_DPrism theDPrism(myPbase,theheight,myAngle); | |
269 | TopoDS_Shape VraiDPrism = theDPrism.Shape(); | |
270 | ||
271 | MajMap(myPbase,theDPrism,myMap,myFShape,myLShape); | |
272 | ||
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()); | |
278 | exp.Next(); | |
279 | if(exp.More()) { | |
280 | NotDone(); | |
281 | myStatusError = BRepFeat_InvFirstShape; | |
282 | return; | |
283 | } | |
284 | ||
285 | TopoDS_Face FFace; | |
286 | ||
287 | Standard_Boolean found = Standard_False; | |
288 | ||
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; | |
298 | break; | |
299 | } | |
300 | } | |
301 | if(found) break; | |
302 | } | |
303 | } | |
304 | ||
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); | |
311 | break; | |
312 | } | |
313 | } | |
314 | } | |
315 | ||
0d969553 | 316 | // management of gluing faces |
7fd59977 | 317 | |
318 | //SetGluedFaces(mySkface, mySbase, theBase, mySlface, theDPrism, myGluedF); | |
319 | GluedFacesValid(); | |
320 | // VerifGluedFaces(mySkface, theBase, myBCurve, myCurves, theDPrism, myGluedF); | |
321 | ||
0d969553 | 322 | if(!myGluedF.IsEmpty()) { // case gluing |
7fd59977 | 323 | myJustGluer = Standard_True; |
324 | theDPrism.Curves(myCurves); | |
325 | myBCurve = theDPrism.BarycCurve(); | |
326 | GlobalPerform(); | |
327 | } | |
328 | ||
0d969553 | 329 | // if there is no gluing -> call topological operations |
7fd59977 | 330 | if(!myJustGluer) { |
331 | if(myFuse == 1) { | |
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); | |
337 | myShape = f.Shape(); | |
338 | UpdateDescendants(f, myShape, Standard_False); | |
339 | //modified by NIZNHY-PKV Thu Mar 21 17:32:23 2002 t | |
340 | Done(); | |
341 | } | |
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); | |
348 | myShape = c.Shape(); | |
349 | UpdateDescendants(c, myShape, Standard_False); | |
350 | //modified by NIZNHY-PKV Thu Mar 21 17:33:00 2002 t | |
351 | Done(); | |
352 | } | |
353 | else { | |
354 | myShape = myGShape; | |
355 | Done(); | |
356 | } | |
357 | } | |
358 | } | |
359 | ||
360 | //======================================================================= | |
361 | //function : Perform | |
0d969553 | 362 | //purpose : feature limited by the shape Until |
7fd59977 | 363 | //======================================================================= |
364 | ||
365 | void BRepFeat_MakeDPrism::Perform(const TopoDS_Shape& Until) | |
366 | { | |
367 | #ifdef DEB | |
368 | Standard_Boolean trc = BRepFeat_GettraceFEAT(); | |
369 | if (trc) cout << "BRepFeat_MakeDPrism::Perform(Until)" << endl; | |
370 | #endif | |
371 | if (Until.IsNull()) { | |
372 | Standard_ConstructionError::Raise(); | |
373 | } | |
374 | TopExp_Explorer exp(Until, TopAbs_FACE); | |
375 | if (!exp.More()) { | |
376 | Standard_ConstructionError::Raise(); | |
377 | } | |
378 | // myPbase.Orientation(TopAbs_FORWARD); | |
379 | ||
380 | myGluedF.Clear(); | |
381 | myPerfSelection = BRepFeat_SelectionU; | |
382 | PerfSelectionValid(); | |
383 | mySFrom.Nullify(); | |
384 | ShapeFromValid(); | |
385 | mySUntil = Until; | |
386 | Standard_Boolean Trf = TransformShapeFU(1); | |
387 | ShapeUntilValid(); | |
388 | Handle(Geom_Curve) C = TestCurve(myPbase); | |
389 | Standard_Integer sens = SensOfPrism(C, mySUntil); | |
390 | ||
391 | BRep_Builder bB; | |
392 | Standard_Real Height = | |
393 | sens*HeightMax(mySbase, mySkface, mySFrom, mySUntil); | |
394 | LocOpe_DPrism theDPrism(myPbase,Height,myAngle); | |
395 | TopoDS_Shape VraiDPrism = theDPrism.Shape(); | |
396 | if(!Trf) { | |
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()); | |
403 | exp.Next(); | |
404 | if(exp.More()) { | |
405 | NotDone(); | |
406 | myStatusError = BRepFeat_InvFirstShape; | |
407 | return; | |
408 | } | |
409 | ||
410 | //SetGluedFaces(mySkface, mySbase, theBase, mySlface, theDPrism, myGluedF); | |
411 | GluedFacesValid(); | |
412 | // VerifGluedFaces(mySkface, theBase, myBCurve, myCurves, theDPrism, myGluedF); | |
413 | ||
414 | ||
415 | theDPrism.Curves(myCurves); | |
416 | myBCurve = theDPrism.BarycCurve(); | |
417 | GlobalPerform(); | |
418 | } | |
419 | else { | |
420 | MajMap(myPbase,theDPrism,myMap,myFShape,myLShape); | |
421 | Handle(Geom_Curve) C1; | |
422 | if(sens == -1) { | |
423 | C1 = C->Reversed(); | |
424 | } | |
425 | else { | |
426 | C1 = C; | |
427 | } | |
428 | ||
429 | TColGeom_SequenceOfCurve scur; | |
430 | scur.Clear(); | |
431 | scur.Append(C1); | |
432 | LocOpe_CSIntersector ASI(mySUntil); | |
433 | ASI.Perform(scur); | |
434 | TopAbs_Orientation Or; | |
435 | if (ASI.IsDone() && ASI.NbPoints(1) >=1) { | |
436 | if (myFuse == 1) { | |
437 | Or = ASI.Point(1,1).Orientation(); | |
438 | } | |
439 | else { | |
440 | Or = ASI.Point(1,ASI.NbPoints(1)).Orientation(); | |
441 | } | |
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(); | |
445 | TopoDS_Shape Comp; | |
446 | bB.MakeCompound(TopoDS::Compound(Comp)); | |
447 | TopoDS_Solid S = BRepFeat::Tool(mySUntil, FUntil, Or); | |
448 | if (!S.IsNull()) bB.Add(Comp,S); | |
449 | ||
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 | |
456 | ||
457 | TopExp_Explorer ex(trP.Shape(), TopAbs_SOLID); | |
458 | TopoDS_Shape Cutsh = ex.Current(); | |
459 | if(myFuse == 1) { | |
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); | |
465 | myShape = f.Shape(); | |
466 | UpdateDescendants(f, myShape, Standard_False); | |
467 | //modified by NIZNHY-PKV Thu Mar 21 17:34:13 2002 t | |
468 | Done(); | |
469 | } | |
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); | |
476 | myShape = c.Shape(); | |
477 | UpdateDescendants(c, myShape, Standard_False); | |
478 | //modified by NIZNHY-PKV Thu Mar 21 17:34:59 2002 t | |
479 | Done(); | |
480 | } | |
481 | else { | |
482 | myShape = Cutsh; | |
483 | Done(); | |
484 | } | |
485 | } | |
486 | } | |
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)); | |
494 | } | |
495 | } | |
496 | } | |
497 | ||
498 | ||
499 | //======================================================================= | |
500 | //function : Perform | |
0d969553 | 501 | //purpose : feature limited by two shapes |
7fd59977 | 502 | //======================================================================= |
503 | ||
504 | void BRepFeat_MakeDPrism::Perform(const TopoDS_Shape& From, | |
505 | const TopoDS_Shape& Until) | |
506 | { | |
507 | #ifdef DEB | |
508 | Standard_Boolean trc = BRepFeat_GettraceFEAT(); | |
509 | if (trc) cout << "BRepFeat_MakeDPrism::Perform(From,Until)" << endl; | |
510 | #endif | |
511 | if (From.IsNull() || Until.IsNull()) { | |
512 | Standard_ConstructionError::Raise(); | |
513 | } | |
514 | ||
515 | if (!mySkface.IsNull()) { | |
516 | if (From.IsSame(mySkface)) { | |
517 | myJustGluer = Standard_True; | |
518 | Perform(Until); | |
519 | if (myJustGluer) return; | |
520 | } | |
521 | else if (Until.IsSame(mySkface)) { | |
522 | myJustGluer = Standard_True; | |
523 | Perform(From); | |
524 | if (myJustGluer) return; | |
525 | } | |
526 | } | |
527 | // myPbase.Orientation(TopAbs_FORWARD); | |
528 | ||
529 | myGluedF.Clear(); | |
530 | myPerfSelection = BRepFeat_SelectionFU; | |
531 | PerfSelectionValid(); | |
532 | ||
533 | TopExp_Explorer exp(From, TopAbs_FACE); | |
534 | if (!exp.More()) { | |
535 | Standard_ConstructionError::Raise(); | |
536 | } | |
537 | exp.Init(Until, TopAbs_FACE); | |
538 | if (!exp.More()) { | |
539 | Standard_ConstructionError::Raise(); | |
540 | } | |
541 | mySFrom = From; | |
542 | Standard_Boolean Trff = TransformShapeFU(0); | |
543 | ShapeFromValid(); | |
544 | mySUntil = Until; | |
545 | Standard_Boolean Trfu = TransformShapeFU(1); | |
546 | ShapeUntilValid(); | |
547 | if(Trfu != Trff) { | |
548 | NotDone(); | |
549 | myStatusError = BRepFeat_IncTypes; | |
550 | return; | |
551 | } | |
552 | Handle(Geom_Curve) C = TestCurve(myPbase); | |
553 | Standard_Integer sens; | |
554 | if(From.IsSame(Until)) { | |
555 | sens = 1; | |
556 | } | |
557 | else { | |
558 | sens = SensOfPrism(C, mySUntil); | |
559 | } | |
560 | ||
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(); | |
565 | ||
566 | ||
567 | if(!Trff) { | |
568 | MajMap(myPbase,theDPrism,myMap,myFShape,myLShape); | |
569 | ||
0d969553 | 570 | // Make systematically dprism |
7fd59977 | 571 | myGShape = VraiDPrism; |
572 | GeneratedShapeValid(); | |
573 | ||
0d969553 | 574 | // management of gluing faces |
7fd59977 | 575 | //SetGluedFaces(TopoDS_Face(), // on ne veut pas binder mySkface |
576 | // mySbase, myPbase, mySlface, theDPrism, myGluedF); | |
577 | GluedFacesValid(); | |
578 | theDPrism.Curves(myCurves); | |
579 | myBCurve = theDPrism.BarycCurve(); | |
580 | ||
0d969553 | 581 | // topologic reconstruction |
7fd59977 | 582 | GlobalPerform(); |
583 | } | |
584 | else { | |
0d969553 | 585 | // management of descendants |
7fd59977 | 586 | MajMap(myPbase,theDPrism,myMap,myFShape,myLShape); |
587 | Handle(Geom_Curve) C1; | |
588 | if(sens == -1) { | |
589 | C1 = C->Reversed(); | |
590 | } | |
591 | else { | |
592 | C1 = C; | |
593 | } | |
594 | TColGeom_SequenceOfCurve scur; | |
595 | scur.Clear(); | |
596 | scur.Append(C1); | |
597 | LocOpe_CSIntersector ASI1(mySUntil); | |
598 | LocOpe_CSIntersector ASI2(mySFrom); | |
599 | ASI1.Perform(scur); | |
600 | ASI2.Perform(scur); | |
601 | TopAbs_Orientation OrU, OrF; | |
602 | TopoDS_Face FFrom, FUntil; | |
0d969553 | 603 | //direction of dprism |
7fd59977 | 604 | if (ASI1.IsDone() && ASI1.NbPoints(1) >=1) { |
605 | if (myFuse == 1) { | |
606 | OrU = ASI1.Point(1,1).Orientation(); | |
607 | } | |
608 | else { | |
609 | OrU = ASI1.Point(1,ASI1.NbPoints(1)).Orientation(); | |
610 | } | |
611 | // Standard_Real prm = ASI1.Point(1,1).Parameter(); | |
612 | // if(prm < 0) OrU = TopAbs::Reverse(OrU); | |
613 | FUntil = ASI1.Point(1,1).Face(); | |
614 | } | |
615 | else { | |
616 | NotDone(); | |
617 | myStatusError = BRepFeat_NoIntersectU; | |
618 | return; | |
619 | } | |
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(); | |
625 | } | |
626 | else { | |
627 | NotDone(); | |
628 | myStatusError = BRepFeat_NoIntersectF; | |
629 | return; | |
630 | } | |
631 | TopoDS_Shape Comp; | |
632 | BRep_Builder B; | |
633 | B.MakeCompound(TopoDS::Compound(Comp)); | |
634 | TopoDS_Solid S = BRepFeat::Tool(mySUntil, FUntil, OrU); | |
635 | if (!S.IsNull()) B.Add(Comp,S); | |
636 | else { | |
637 | NotDone(); | |
638 | myStatusError = BRepFeat_NullToolU; | |
639 | return; | |
640 | } | |
641 | TopoDS_Solid SS = BRepFeat::Tool(mySFrom, FFrom, OrF); | |
642 | if (!SS.IsNull()) B.Add(Comp,SS); | |
643 | else { | |
644 | NotDone(); | |
645 | myStatusError = BRepFeat_NullToolF; | |
646 | return; | |
647 | } | |
648 | ||
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 | |
653 | ||
654 | if(myFuse == 1) { | |
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()); | |
660 | myShape = f.Shape(); | |
661 | UpdateDescendants(f, myShape, Standard_False); | |
662 | //modified by NIZNHY-PKV Thu Mar 21 17:36:33 2002 t | |
663 | Done(); | |
664 | } | |
665 | // | |
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()); | |
672 | myShape = c.Shape(); | |
673 | UpdateDescendants(c, myShape, Standard_False); | |
674 | //modified by NIZNHY-PKV Thu Mar 21 17:37:49 2002 t | |
675 | Done(); | |
676 | } | |
677 | else { | |
678 | myShape = trP.Shape(); | |
679 | Done(); | |
680 | } | |
681 | } | |
682 | } | |
683 | ||
684 | ||
685 | //======================================================================= | |
686 | //function : Perform | |
687 | //purpose : feature semi-infinie | |
688 | //======================================================================= | |
689 | ||
690 | void BRepFeat_MakeDPrism::PerformUntilEnd() | |
691 | { | |
692 | #ifdef DEB | |
693 | Standard_Boolean trc = BRepFeat_GettraceFEAT(); | |
694 | if (trc) cout << "BRepFeat_MakeDPrism::PerformUntilEnd()" << endl; | |
695 | #endif | |
696 | myPerfSelection = BRepFeat_SelectionSh; | |
697 | PerfSelectionValid(); | |
698 | myGluedF.Clear(); | |
699 | mySUntil.Nullify(); | |
700 | ShapeUntilValid(); | |
701 | mySFrom.Nullify(); | |
702 | ShapeFromValid(); | |
703 | Standard_Real Height = HeightMax(mySbase, mySkface, mySFrom, mySUntil); | |
704 | // myPbase.Orientation(TopAbs_FORWARD); | |
705 | ||
706 | LocOpe_DPrism theDPrism(myPbase, Height, myAngle); | |
707 | TopoDS_Shape VraiDPrism = theDPrism.Shape(); | |
708 | ||
709 | MajMap(myPbase,theDPrism,myMap,myFShape,myLShape); | |
710 | ||
711 | myGShape = VraiDPrism; | |
712 | GeneratedShapeValid(); | |
713 | GluedFacesValid(); | |
714 | theDPrism.Curves(myCurves); | |
715 | myBCurve = theDPrism.BarycCurve(); | |
716 | GlobalPerform(); | |
717 | } | |
718 | ||
719 | //======================================================================= | |
720 | //function : PerformFromEnd | |
0d969553 | 721 | //purpose : feature semiinfinite limited by the shape Until from the other side |
7fd59977 | 722 | //======================================================================= |
723 | ||
724 | void BRepFeat_MakeDPrism::PerformFromEnd(const TopoDS_Shape& Until) | |
725 | { | |
726 | #ifdef DEB | |
727 | Standard_Boolean trc = BRepFeat_GettraceFEAT(); | |
728 | if (trc) cout << "BRepFeat_MakeDPrism::PerformFromEnd(From,Until)" << endl; | |
729 | #endif | |
730 | if (Until.IsNull()) { | |
731 | Standard_ConstructionError::Raise(); | |
732 | } | |
733 | if (!mySkface.IsNull() && Until.IsSame(mySkface)) { | |
734 | PerformUntilEnd(); | |
735 | return; | |
736 | } | |
737 | TopExp_Explorer exp; | |
738 | exp.Init(Until, TopAbs_FACE); | |
739 | if (!exp.More()) { | |
740 | Standard_ConstructionError::Raise(); | |
741 | } | |
742 | // myPbase.Orientation(TopAbs_FORWARD); | |
743 | myPerfSelection = BRepFeat_SelectionShU; | |
744 | PerfSelectionValid(); | |
745 | mySFrom.Nullify(); | |
746 | ShapeFromValid(); | |
747 | mySUntil = Until; | |
748 | Standard_Boolean Trf = TransformShapeFU(1); | |
749 | ShapeUntilValid(); | |
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); | |
754 | ||
755 | LocOpe_DPrism theDPrism(myPbase, Height, Height, myAngle); | |
756 | TopoDS_Shape VraiDPrism = theDPrism.Shape(); | |
757 | if(VraiDPrism.IsNull()) { | |
758 | NotDone(); | |
759 | myStatusError = BRepFeat_NullRealTool; | |
760 | return; | |
761 | } | |
762 | ||
0d969553 | 763 | if(!Trf) { // case finite face |
7fd59977 | 764 | MajMap(myPbase,theDPrism,myMap,myFShape,myLShape); |
765 | myGShape = VraiDPrism; | |
766 | GeneratedShapeValid(); | |
767 | myGluedF.Clear(); | |
768 | GluedFacesValid(); | |
769 | theDPrism.Curves(myCurves); | |
770 | myBCurve = theDPrism.BarycCurve(); | |
771 | GlobalPerform(); | |
772 | } | |
0d969553 | 773 | else { // case support |
7fd59977 | 774 | MajMap(myPbase,theDPrism,myMap,myFShape,myLShape); |
775 | Handle(Geom_Curve) C2; | |
776 | if(sens == -1) { | |
777 | C2 = C->Reversed(); | |
778 | } | |
779 | else { | |
780 | C2 = C; | |
781 | } | |
782 | TColGeom_SequenceOfCurve scur; | |
783 | scur.Clear(); | |
784 | scur.Append(C2); | |
785 | LocOpe_CSIntersector ASI1(mySUntil); | |
786 | LocOpe_CSIntersector ASI2(mySbase); | |
787 | ASI1.Perform(scur); | |
788 | ASI2.Perform(scur); | |
7fd59977 | 789 | TopAbs_Orientation OrU = TopAbs_FORWARD, OrF = TopAbs_FORWARD; |
7fd59977 | 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(); | |
796 | } | |
797 | ||
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); | |
810 | } | |
811 | } | |
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(); | |
817 | } | |
1c72dff6 | 818 | BRepLib_MakeFace fac(S, Precision::Confusion()); |
7fd59977 | 819 | mySFrom = fac.Face(); |
820 | Trf = TransformShapeFU(0); | |
821 | // FFrom = TopoDS::Face(mySFrom); | |
822 | } | |
823 | ||
824 | TopoDS_Shape Comp; | |
825 | BRep_Builder B; | |
826 | B.MakeCompound(TopoDS::Compound(Comp)); | |
827 | TopoDS_Solid Sol = BRepFeat::Tool(mySUntil, FUntil, OrU); | |
828 | if (!Sol.IsNull()) B.Add(Comp,Sol); | |
829 | else { | |
830 | NotDone(); | |
831 | myStatusError = BRepFeat_NullToolU; | |
832 | return; | |
833 | } | |
834 | ||
835 | TopoDS_Solid Sol1 = BRepFeat::Tool(mySFrom, FFrom, OrF); | |
836 | if (!Sol1.IsNull()) B.Add(Comp,Sol1); | |
837 | else { | |
838 | NotDone(); | |
839 | myStatusError = BRepFeat_NullToolF; | |
840 | return; | |
841 | } | |
842 | ||
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 | |
847 | if(myFuse == 1) { | |
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()); | |
853 | myShape = f.Shape(); | |
854 | UpdateDescendants(f, myShape, Standard_False); | |
855 | //modified by NIZNHY-PKV Thu Mar 21 17:40:07 2002 t | |
856 | Done(); | |
857 | } | |
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()); | |
864 | myShape = c.Shape(); | |
865 | UpdateDescendants(c, myShape, Standard_False); | |
866 | //modified by NIZNHY-PKV Thu Mar 21 17:40:44 2002 t | |
867 | Done(); | |
868 | } | |
869 | else { | |
870 | myShape = trP.Shape(); | |
871 | Done(); | |
872 | } | |
873 | } | |
874 | } | |
875 | ||
876 | ||
877 | ||
878 | //======================================================================= | |
879 | //function : PerformThruAll | |
0d969553 | 880 | //purpose : feature throughout the entire initial shape |
7fd59977 | 881 | //======================================================================= |
882 | ||
883 | void BRepFeat_MakeDPrism::PerformThruAll() | |
884 | { | |
885 | #ifdef DEB | |
886 | Standard_Boolean trc = BRepFeat_GettraceFEAT(); | |
887 | if (trc) cout << "BRepFeat_MakeDPrism::PerformThruAll()" << endl; | |
888 | #endif | |
889 | mySUntil.Nullify(); | |
890 | ShapeUntilValid(); | |
891 | mySFrom.Nullify(); | |
892 | ShapeFromValid(); | |
893 | if(myFuse == 0) { | |
894 | myPerfSelection = BRepFeat_NoSelection; | |
895 | } | |
896 | else { | |
897 | myPerfSelection = BRepFeat_SelectionSh; | |
898 | } | |
899 | ||
900 | PerfSelectionValid(); | |
901 | // myPbase.Orientation(TopAbs_FORWARD); | |
902 | myGluedF.Clear(); | |
903 | GluedFacesValid(); | |
904 | ||
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); | |
909 | ||
910 | myGShape = VraiDPrism; | |
911 | GeneratedShapeValid(); | |
912 | ||
913 | if(myFuse == 0) { | |
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 | |
918 | if (c.IsDone()) { | |
919 | myShape = c.Shape(); | |
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 | |
924 | Done(); | |
925 | } | |
926 | } | |
927 | else { | |
928 | theDPrism.Curves(myCurves); | |
929 | myBCurve = theDPrism.BarycCurve(); | |
930 | GlobalPerform(); | |
931 | } | |
932 | } | |
933 | ||
934 | ||
935 | //======================================================================= | |
936 | //function : PerformUntilHeight | |
0d969553 | 937 | //purpose : feature until the shape is of the given height |
7fd59977 | 938 | //======================================================================= |
939 | ||
940 | void BRepFeat_MakeDPrism::PerformUntilHeight(const TopoDS_Shape& Until, | |
941 | const Standard_Real Height) | |
942 | { | |
943 | #ifdef DEB | |
944 | Standard_Boolean trc = BRepFeat_GettraceFEAT(); | |
945 | if (trc) cout << "BRepFeat_MakeDPrism::PerformUntilHeight(Until,Height)" << endl; | |
946 | #endif | |
947 | if (Until.IsNull()) { | |
948 | Perform(Height); | |
949 | } | |
950 | if(Height == 0) { | |
951 | Perform(Until); | |
952 | } | |
953 | TopExp_Explorer exp(Until, TopAbs_FACE); | |
954 | if (!exp.More()) { | |
955 | Standard_ConstructionError::Raise(); | |
956 | } | |
957 | // myPbase.Orientation(TopAbs_FORWARD); | |
958 | myGluedF.Clear(); | |
959 | myPerfSelection = BRepFeat_NoSelection; | |
960 | PerfSelectionValid(); | |
961 | mySFrom.Nullify(); | |
962 | ShapeFromValid(); | |
963 | mySUntil = Until; | |
964 | Standard_Boolean Trf = TransformShapeFU(1); | |
965 | ShapeUntilValid(); | |
966 | Handle(Geom_Curve) C = TestCurve(myPbase); | |
967 | Standard_Integer sens = SensOfPrism(C, mySUntil); | |
968 | ||
969 | LocOpe_DPrism theDPrism(myPbase,sens*Height,myAngle); | |
970 | TopoDS_Shape VraiDPrism = theDPrism.Shape(); | |
971 | ||
0d969553 | 972 | if(!Trf) { // case face finished |
7fd59977 | 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()); | |
979 | exp.Next(); | |
980 | if(exp.More()) { | |
981 | NotDone(); | |
982 | myStatusError = BRepFeat_InvFirstShape; | |
983 | return; | |
984 | } | |
985 | ||
986 | //SetGluedFaces(mySkface, mySbase, theBase, mySlface, theDPrism, myGluedF); | |
987 | GluedFacesValid(); | |
988 | // VerifGluedFaces(mySkface, theBase, myBCurve, myCurves, theDPrism, myGluedF); | |
989 | ||
990 | theDPrism.Curves(myCurves); | |
991 | myBCurve = theDPrism.BarycCurve(); | |
992 | GlobalPerform(); | |
993 | } | |
0d969553 | 994 | else { // case support |
7fd59977 | 995 | MajMap(myPbase,theDPrism,myMap,myFShape,myLShape); |
996 | Handle(Geom_Curve) C1; | |
997 | if(sens == -1) { | |
998 | C1 = C->Reversed(); | |
999 | } | |
1000 | else { | |
1001 | C1 = C; | |
1002 | } | |
1003 | TColGeom_SequenceOfCurve scur; | |
1004 | scur.Clear(); | |
1005 | scur.Append(C1); | |
1006 | LocOpe_CSIntersector ASI(mySUntil); | |
1007 | ASI.Perform(scur); | |
1008 | TopAbs_Orientation Or; | |
1009 | if (ASI.IsDone() && ASI.NbPoints(1) >=1) { | |
1010 | if (myFuse == 1) { | |
1011 | Or = ASI.Point(1,1).Orientation(); | |
1012 | } | |
1013 | else { | |
1014 | Or = ASI.Point(1,ASI.NbPoints(1)).Orientation(); | |
1015 | } | |
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(); | |
1019 | TopoDS_Shape Comp; | |
1020 | BRep_Builder B; | |
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 | |
1028 | if(myFuse == 1) { | |
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 | |
1037 | Done(); | |
1038 | } | |
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 | |
1048 | Done(); | |
1049 | } | |
1050 | else { | |
1051 | myShape = trP.Shape(); | |
1052 | Done(); | |
1053 | } | |
1054 | } | |
1055 | } | |
1056 | } | |
1057 | ||
1058 | ||
1059 | //======================================================================= | |
1060 | //function : Curves | |
0d969553 | 1061 | //purpose : curves parallel to the axis of the prism |
7fd59977 | 1062 | //======================================================================= |
1063 | ||
1064 | void BRepFeat_MakeDPrism::Curves(TColGeom_SequenceOfCurve& scur) | |
1065 | { | |
1066 | scur = myCurves; | |
1067 | } | |
1068 | ||
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) | |
1076 | { | |
1077 | #ifdef DEB | |
1078 | Standard_Boolean trc = BRepFeat_GettraceFEAT(); | |
1079 | if (trc) cout << "BRepFeat_MakeDPrism::BossEdges (integer)" << endl; | |
1080 | #endif | |
1081 | TopTools_ListOfShape theLastShape; | |
1082 | theLastShape.Clear(); | |
1083 | if (signature == 1 || signature == -1) { | |
1084 | theLastShape = FirstShape(); | |
1085 | } | |
1086 | else if (signature == 2 || signature == -2) { | |
1087 | theLastShape = LastShape(); | |
1088 | } | |
1089 | else { | |
1090 | return; | |
1091 | } | |
1092 | ||
1093 | // Edges Top | |
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); | |
1101 | } | |
1102 | } | |
1103 | ||
1104 | // Edges Bottom | |
1105 | if (signature < 0) { | |
0d969553 | 1106 | // Attention check if TgtEdges is important |
7fd59977 | 1107 | myLatEdges = NewEdges(); |
1108 | } | |
1109 | else if (signature > 0) { | |
1110 | if ( !myShape.IsNull() ) { | |
1111 | TopTools_MapOfShape MapE; | |
1112 | Standard_Boolean Found; | |
1113 | ||
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); | |
1131 | ||
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)) { | |
1138 | MapE.Remove(E3); } | |
1139 | else { | |
1140 | MapE.Add(E3);} | |
1141 | } | |
1142 | } | |
1143 | } | |
1144 | } | |
1145 | } | |
1146 | } | |
1147 | } | |
1148 | ||
1149 | TopTools_ListIteratorOfListOfShape it(myTopEdges); | |
1150 | for (;it.More() ; it.Next()) { | |
1151 | if (MapE.Contains(it.Value())) {MapE.Remove(it.Value()); } | |
1152 | } | |
1153 | ||
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()); | |
1158 | } | |
1159 | } | |
1160 | } | |
1161 | } | |
1162 | ||
1163 | ||
1164 | ||
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 () | |
1170 | { | |
1171 | return myTopEdges; | |
1172 | } | |
1173 | ||
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 () | |
1179 | { | |
1180 | return myLatEdges; | |
1181 | } | |
1182 | ||
1183 | //======================================================================= | |
1184 | //function : BarycCurve | |
1185 | //purpose : passe par le centre de masses de la primitive | |
1186 | //======================================================================= | |
1187 | ||
1188 | Handle(Geom_Curve) BRepFeat_MakeDPrism::BarycCurve() | |
1189 | { | |
1190 | return myBCurve; | |
1191 | } | |
1192 | ||
1193 | ||
1194 | //======================================================================= | |
1195 | //function : HeightMax | |
0d969553 | 1196 | //purpose : Calculate the height of the prism following the parameters of the bounding box |
7fd59977 | 1197 | //======================================================================= |
1198 | ||
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 | |
1203 | { | |
1204 | Bnd_Box Box; | |
1205 | BRepBndLib::Add(theSbase,Box); | |
1206 | BRepBndLib::Add(theSkface,Box); | |
1207 | if(!theSFrom.IsNull()) { | |
1208 | BRepBndLib::Add(theSFrom,Box); | |
1209 | } | |
1210 | if(!theSUntil.IsNull()) { | |
1211 | BRepBndLib::Add(theSUntil,Box); | |
1212 | } | |
1213 | Standard_Real c[6]; | |
1214 | ||
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]; | |
1220 | // } | |
1221 | // Standard_Real Height = abs(2.*(parmax - parmin)); | |
1222 | // return(2.*Height); | |
1223 | //#ifndef DEB | |
1224 | Standard_Real par = Max( Max( fabs(c[1] - c[0]), fabs(c[3] - c[2]) ), fabs(c[5] - c[4]) ); | |
1225 | //#else | |
1226 | // Standard_Real par = Max( Max( abs(c[1] - c[0]), abs(c[3] - c[2]) ), abs(c[5] - c[4]) ); | |
1227 | //#endif | |
1228 | #ifdef DEB | |
1229 | cout << "Height = > " << par << endl; | |
1230 | #endif | |
1231 | return par; | |
1232 | } | |
1233 | ||
1234 | ||
1235 | ||
1236 | ||
1237 | ||
1238 | //======================================================================= | |
1239 | //function : SensOfPrism | |
0d969553 | 1240 | //purpose : determine the direction of prism generation |
7fd59977 | 1241 | //======================================================================= |
1242 | Standard_Integer SensOfPrism(const Handle(Geom_Curve) C, | |
1243 | const TopoDS_Shape& Until) | |
1244 | { | |
1245 | LocOpe_CSIntersector ASI1(Until); | |
1246 | TColGeom_SequenceOfCurve scur; | |
1247 | scur.Append(C); | |
1248 | ASI1.Perform(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.) { | |
1255 | sens = -1; | |
1256 | } | |
1257 | } | |
1258 | else if(BRepFeat::ParametricBarycenter(Until,C) < 0) { | |
1259 | sens = -1; | |
1260 | } | |
1261 | else {} | |
1262 | return sens; | |
1263 | } | |
1264 | ||
1265 | ||
1266 | //======================================================================= | |
1267 | //function : SetGluedFaces | |
1268 | //purpose : | |
1269 | //======================================================================= | |
1270 | ||
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) | |
1277 | { | |
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); | |
1283 | break; | |
1284 | } | |
1285 | } | |
1286 | } | |
1287 | else { | |
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); | |
1294 | break; | |
1295 | } | |
1296 | } | |
1297 | } | |
1298 | } | |
1299 | ||
0d969553 | 1300 | // Sliding |
7fd59977 | 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) { | |
1309 | #ifdef DEB | |
1310 | Standard_Boolean trc = BRepFeat_GettraceFEAT(); | |
1311 | if (trc) cout << " BRepFeat_MakeDPrism : Pb SetGluedFace" << endl; | |
1312 | #endif | |
1313 | } | |
1314 | theMap.Bind(gfac.First(),fac); | |
1315 | } | |
1316 | } | |
1317 | } | |
1318 | } | |
1319 | ||
1320 | ||
1321 | //======================================================================= | |
1322 | //function : VerifGluedFaces | |
0d969553 Y |
1323 | //purpose : Checking intersection Tool/theSkface = thePbase |
1324 | // if yes -> OK if no -> case without gluing | |
7fd59977 | 1325 | //======================================================================= |
1326 | #ifdef DEB | |
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) | |
1333 | { | |
1334 | Standard_Boolean GluedFaces = Standard_True; | |
1335 | TopoDS_Shape VraiDPrism = theDPrism.Shape(); | |
1336 | ||
1337 | TColGeom_SequenceOfCurve scur; | |
1338 | theDPrism.Curves(theCurves); | |
1339 | theBCurve = theDPrism.BarycCurve(); | |
1340 | scur.Clear(); | |
1341 | scur.Append(theBCurve); | |
1342 | LocOpe_CSIntersector ASI(theSkface); | |
1343 | ASI.Perform(scur); | |
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(); | |
1347 | TopoDS_Shape Comp; | |
1348 | BRep_Builder B; | |
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; | |
1366 | } | |
1367 | if (ex2.More()) break; | |
1368 | } | |
1369 | if (ex1.More()) continue; | |
1370 | GluedFaces = Standard_False; | |
1371 | break; | |
1372 | } | |
1373 | if (!GluedFaces) { | |
1374 | #ifdef DEB | |
1375 | Standard_Boolean trc = BRepFeat_GettraceFEAT(); | |
0d969553 | 1376 | if (trc) cout << " Intersection DPrism/skface : no gluing" << endl; |
7fd59977 | 1377 | #endif |
1378 | theMap.Clear(); | |
1379 | } | |
1380 | } | |
1381 | } | |
1382 | #endif | |
1383 | ||
1384 | //======================================================================= | |
1385 | //function : MajMap | |
1386 | //purpose : | |
1387 | //======================================================================= | |
1388 | ||
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 | |
1394 | { | |
1395 | TopExp_Explorer exp; | |
1396 | if(!theP.FirstShape().IsNull()) { | |
1397 | exp.Init(theP.FirstShape(),TopAbs_WIRE); | |
1398 | if (exp.More()) { | |
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()); | |
1404 | } | |
1405 | } | |
1406 | } | |
1407 | ||
1408 | if(!theP.LastShape().IsNull()) { | |
1409 | exp.Init(theP.LastShape(),TopAbs_WIRE); | |
1410 | if (exp.More()) { | |
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()); | |
1416 | } | |
1417 | } | |
1418 | } | |
1419 | ||
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); | |
1426 | } | |
1427 | } | |
1428 | } | |
1429 | ||
1430 | ||
1431 | //======================================================================= | |
1432 | //function : MajMap | |
1433 | //purpose : | |
1434 | //======================================================================= | |
1435 | ||
1436 | static Handle(Geom_Curve) TestCurve(const TopoDS_Face& Base) | |
1437 | { | |
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(); | |
1444 | } | |
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(); | |
1450 | } | |
1451 | Handle (Geom_Plane) P = Handle(Geom_Plane)::DownCast(s); | |
1452 | if(P.IsNull()) { | |
1453 | Handle(Geom_Curve) toto; | |
1454 | return toto; | |
1455 | } | |
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); | |
1460 | return theLin; | |
1461 | } | |
1462 | ||
1463 | ||
1464 | ||
1465 | ||
1466 | ||
1467 | //======================================================================= | |
1468 | //function : ToFuse | |
1469 | //purpose : | |
1470 | //======================================================================= | |
1471 | ||
1472 | Standard_Boolean ToFuse(const TopoDS_Face& F1, | |
1473 | const TopoDS_Face& F2) | |
1474 | { | |
1475 | if (F1.IsNull() || F2.IsNull()) { | |
1476 | return Standard_False; | |
1477 | } | |
1478 | ||
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(); | |
1484 | ||
1485 | S1 = BRep_Tool::Surface(F1,loc1); | |
1486 | S2 = BRep_Tool::Surface(F2,loc2); | |
1487 | ||
1488 | typS1 = S1->DynamicType(); | |
1489 | typS2 = S2->DynamicType(); | |
1490 | ||
1491 | if (typS1 == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) { | |
1492 | S1 = (*((Handle(Geom_RectangularTrimmedSurface)*)&S1))->BasisSurface(); | |
1493 | typS1 = S1->DynamicType(); | |
1494 | } | |
1495 | ||
1496 | if (typS2 == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) { | |
1497 | S2 = (*((Handle(Geom_RectangularTrimmedSurface)*)&S2))->BasisSurface(); | |
1498 | typS2 = S2->DynamicType(); | |
1499 | } | |
1500 | ||
1501 | if (typS1 != typS2) { | |
1502 | return Standard_False; | |
1503 | } | |
1504 | ||
1505 | ||
1506 | Standard_Boolean ValRet = Standard_False; | |
1507 | if (typS1 == STANDARD_TYPE(Geom_Plane)) { | |
0d969553 | 1508 | S1 = BRep_Tool::Surface(F1); // to apply the location. |
7fd59977 | 1509 | S2 = BRep_Tool::Surface(F2); |
1510 | gp_Pln pl1( (*((Handle(Geom_Plane)*)&S1))->Pln()); | |
1511 | gp_Pln pl2( (*((Handle(Geom_Plane)*)&S2))->Pln()); | |
1512 | ||
1513 | if (pl1.Position().IsCoplanar(pl2.Position(),tollin,tolang)) { | |
1514 | ValRet = Standard_True; | |
1515 | } | |
1516 | } | |
1517 | ||
1518 | return ValRet; | |
1519 | } | |
1520 | ||
1521 | ||
1522 | ||
1523 | ||
1524 | ||
1525 | ||
1526 | ||
1527 | ||
1528 | ||
1529 |