Integration of OCCT 6.5.0 from SVN
[occt.git] / src / BRepFeat / BRepFeat_MakeRevolutionForm.cxx
CommitLineData
7fd59977 1// File: BRepFeat_MakeRevolutionForm.cxx
2// Created: Tue Oct 14 16:15:49 1997
3// Author: Olga KOULECHOVA
4// <opt@cleox.paris1.matra-dtv.fr>
5
6
7#include <BRepFeat_MakeRevolutionForm.ixx>
8
9#include <BRepFeat.hxx>
10
11#include <LocOpe.hxx>
12#include <LocOpe_Builder.hxx>
13#include <LocOpe_RevolutionForm.hxx>
14#include <LocOpe_CSIntersector.hxx>
15#include <LocOpe_PntFace.hxx>
16#include <LocOpe_Gluer.hxx>
17#include <LocOpe_FindEdges.hxx>
18
19#include <gp_Vec.hxx>
20#include <gp_Ax1.hxx>
21#include <gp_Pln.hxx>
22#include <gp_Lin.hxx>
23#include <gp_Pnt.hxx>
24
25#include <gp_Vec2d.hxx>
26#include <gp_Pnt2d.hxx>
27
28#include <Geom_Curve.hxx>
29
30#include <Geom2d_Curve.hxx>
31#include <Geom2d_Line.hxx>
32
33#include <Geom_Line.hxx>
34#include <Geom_Circle.hxx>
35#include <Geom_Plane.hxx>
36#include <Geom_Surface.hxx>
37#include <Geom_CylindricalSurface.hxx>
38#include <Geom_ConicalSurface.hxx>
39#include <Geom_ToroidalSurface.hxx>
40#include <Geom_RectangularTrimmedSurface.hxx>
41
42#include <Geom_TrimmedCurve.hxx>
43#include <GeomProjLib.hxx>
44
45#include <Geom2dAPI_InterCurveCurve.hxx>
46#include <Geom2dAPI_ExtremaCurveCurve.hxx>
47#include <Geom2d_Curve.hxx>
48#include <Geom2d_Curve.hxx>
49
50
51#include <GeomAPI.hxx>
52#include <GeomAPI_ProjectPointOnCurve.hxx>
53
54#include <TColgp_SequenceOfPnt.hxx>
55
56#include <TColGeom_SequenceOfCurve.hxx>
57
58#include <TColStd_Array1OfReal.hxx>
59#include <IntRes2d_IntersectionPoint.hxx>
60
61#include <BRepTools_WireExplorer.hxx>
62
63#include <BRep_Tool.hxx>
64#include <BRep_Builder.hxx>
65
66#include <TopExp_Explorer.hxx>
67#include <TopExp.hxx>
68
69#include <TopTools_MapOfShape.hxx>
70#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
71#include <TopTools_ListOfShape.hxx>
72#include <TopTools_ListIteratorOfListOfShape.hxx>
73#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
74#include <TopTools_MapIteratorOfMapOfShape.hxx>
75#include <TopOpeBRepBuild_HBuilder.hxx>
76#include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
77
78#include <TColgp_Array1OfPnt.hxx>
79
80#include <TColGeom_Array1OfCurve.hxx>
81
82#include <TopoDS.hxx>
83#include <TopoDS_Shape.hxx>
84#include <TopoDS_Face.hxx>
85
86#include <BRepLib_MakeVertex.hxx>
87#include <BRepLib_MakeEdge.hxx>
88#include <BRepLib_MakeFace.hxx>
89
90#include <BRepTools.hxx>
91
92#include <BRepPrimAPI_MakeBox.hxx>
93#include <BRepBuilderAPI_MakeFace.hxx>
94
95#include <BRepAlgo.hxx>
96
97//modified by NIZNHY-PKV Fri Mar 22 16:56:15 2002
98//#include <BRepAlgo_Cut.hxx>
99//#include <BRepAlgo_Section.hxx>
100//#include <BRepAlgo_Common.hxx>
101#include <BRepAlgoAPI_Cut.hxx>
102#include <BRepAlgoAPI_Section.hxx>
103#include <BRepAlgoAPI_Common.hxx>
104//modified by NIZNHY-PKV Fri Mar 22 16:56:17 2002 t
105
106#include <BRepBuilderAPI_Transform.hxx>
107#include <BRepExtrema_ExtPC.hxx>
108#include <BRepExtrema_ExtCF.hxx>
109
110#include <BRepTools_Modifier.hxx>
111#include <BRepTools_TrsfModification.hxx>
112
113#include <BRepTopAdaptor_FClass2d.hxx>
114
115#include <Standard_ConstructionError.hxx>
116
117#include <Precision.hxx>
118
119
120#include <ElCLib.hxx>
121#include <ElSLib.hxx>
122#include <CSLib.hxx>
123
124#include <GeomLProp_CLProps.hxx>
125
126#ifdef DEB
127Standard_IMPORT Standard_Boolean BRepFeat_GettraceFEAT();
128Standard_IMPORT Standard_Boolean BRepFeat_GettraceFEATRIB();
129#endif
130
131static void MajMap(const TopoDS_Shape&, // base
132 const LocOpe_RevolutionForm&,
133 TopTools_DataMapOfShapeListOfShape&, // myMap
134 TopoDS_Shape&, // myFShape
135 TopoDS_Shape&); // myLShape
136
137static void SetGluedFaces(const TopTools_DataMapOfShapeListOfShape& theSlmap,
138 LocOpe_RevolutionForm&,
139 const TopTools_DataMapOfShapeListOfShape& SlidingMap,
140 TopTools_DataMapOfShapeShape&);
141
142//=======================================================================
143//function : Init
144//purpose :
145//=======================================================================
146
147void BRepFeat_MakeRevolutionForm::Init(const TopoDS_Shape& Sbase,
148 const TopoDS_Wire& W,
149 const Handle(Geom_Plane)& Plane,
150 const gp_Ax1& Axis,
151 const Standard_Real H1,
152 const Standard_Real H2,
153 const Standard_Integer Mode,
154 Standard_Boolean& Modify)
155{
156#ifdef DEB
157 Standard_Boolean trc = BRepFeat_GettraceFEAT();
158 if (trc) cout << "BRepFeat_MakeRevolutionForm::Init" << endl;
159#endif
160 Standard_Boolean RevolRib = Standard_True;
161 Done();
162
163// modify = 0 si on ne veut pas faire de glissement
164// = 1 si on veut essayer de faire un glissement
165 Standard_Boolean Sliding = Modify;
166
167 myAxe = Axis;
168 Handle(Geom_Line) Line = new Geom_Line(Axis);
169 Standard_Real LineFirst, LineLast;
170
171 LocOpe_CSIntersector ASI(Sbase);
172 TColGeom_SequenceOfCurve scur;
173 scur.Clear();
174 scur.Append(Line);
175 ASI.Perform(scur);
176 if(ASI.IsDone() && ASI.NbPoints(1) >= 2) {
177 LineLast = ASI.Point(1, ASI.NbPoints(1)).Parameter();
178 LineFirst = ASI.Point(1, 1).Parameter();
179 }
180 else {
181 LineFirst = RealFirst();
182 LineLast = RealLast();
183 }
184
185 Handle(Geom2d_Curve) ln2d = GeomAPI::To2d(Line, Plane->Pln());
186
187 TopExp_Explorer exx;
188 Standard_Real Rad = RealLast();
189
190 exx.Init(W, TopAbs_EDGE);
191 for(; exx.More(); exx.Next()) {
192 const TopoDS_Edge& e = TopoDS::Edge(exx.Current());
193 Standard_Real f, l;
194 Handle(Geom_Curve) c = BRep_Tool::Curve(e, f, l);
195 Handle(Geom2d_Curve) c2d = GeomAPI::To2d(c, Plane->Pln());
196 Geom2dAPI_ExtremaCurveCurve extr(ln2d, c2d, LineFirst, LineLast,f,l);
197 Quantity_Length L = RealLast();
198 if(extr.NbExtrema() >= 1) {
199 L = extr.LowerDistance();
200 }
201 gp_Pnt p1 = c->Value(f);
202 gp_Pnt p2 = c->Value(l);
203 GeomAPI_ProjectPointOnCurve proj1(p1, Line);
204 GeomAPI_ProjectPointOnCurve proj2(p2, Line);
205 if(proj1.NbPoints() < 1 || proj2.NbPoints() < 1) {
206#ifdef DEB
207 if (trc) cout << " No projection points" << endl;
208#endif
209 myStatusError = BRepFeat_NoProjPt;
210 NotDone();
211 return;
212 }
213 Standard_Real par1 = proj1.Distance(1);
214 Standard_Real par2 = proj2.Distance(1);
215 Standard_Real Par = Min(par1, par2);
216 if(Par<L) L = Par;
217 if(L<Rad && L > 0.) Rad = L;
218 }
219
220 Standard_Real height = Min(H1, H2);
221
222 if(Rad <= height) Rad = height + 0.01*height;
223
224 myAngle1 = asin(H1/Rad) + PI/10.;
225 myAngle2 = asin(H2/Rad) + PI/10.;
226
227 if((myAngle1 - PI/2) > Precision::Confusion())
228 myAngle1 = PI/2;
229 if((myAngle2 - PI/2) > Precision::Confusion())
230 myAngle2 = PI/2;
231
232 mySkface.Nullify();
233 myPbase.Nullify();
234
235 if(Mode == 0)
236 myFuse = Standard_False;
237 else // if(Mode == 1)
238 myFuse = Standard_True;
239#ifdef DEB
240 if (trc) {
241 if (myFuse) cout << " Fuse" << endl;
242 if (!myFuse) cout << " Cut" << endl;
243 }
244#endif
245
246// ---Determination Tolerance : tolerance max sur les parametres
247 myTol = Precision::Confusion();
248
249 exx.Init(W, TopAbs_VERTEX);
250 for(; exx.More(); exx.Next()) {
251 const Standard_Real& tol = BRep_Tool::
252 Tolerance(TopoDS::Vertex(exx.Current()));
253 if(tol > myTol) myTol = tol;
254 }
255
256 exx.Init(Sbase, TopAbs_VERTEX);
257 for(; exx.More(); exx.Next()) {
258 const Standard_Real& tol = BRep_Tool::
259 Tolerance(TopoDS::Vertex(exx.Current()));
260 if(tol > myTol) myTol = tol;
261 }
262
263 TopoDS_Shape aLocalShape = W.Oriented(TopAbs_FORWARD);
264 myWire = TopoDS::Wire(aLocalShape);
265// myWire = TopoDS::Wire(W.Oriented(TopAbs_FORWARD));
266 myPln = Plane;
267 myHeight1 = H1;
268 myHeight2 = H2;
269
270 mySbase = Sbase;
271 mySlface.Clear();
272 myShape.Nullify();
273 myMap.Clear();
274 myFShape.Nullify();
275 myLShape.Nullify();
276
277// ---Calcul boite englobante
278 BRep_Builder BB;
279
280 TopTools_ListOfShape theList;
281
282 TopoDS_Shape U;
283 U.Nullify();
284 gp_Pnt FirstCorner, LastCorner;
285 Standard_Real bnd = HeightMax(mySbase, U, FirstCorner, LastCorner);
286 myBnd = bnd;
287
288 BRepPrimAPI_MakeBox Bndbox(FirstCorner, LastCorner);
289 TopoDS_Solid BndBox = Bndbox.Solid();
290
291
292// ---Construction de la face plan de travail (section boite englobante)
293 BRepLib_MakeFace PlaneF(myPln->Pln(), -6.*myBnd,
294 6.*myBnd, -6.*myBnd, 6.*myBnd);
295 TopoDS_Face PlaneFace = TopoDS::Face(PlaneF.Shape());
296
297 //modified by NIZNHY-PKV Fri Mar 22 16:52:26 2002 f
298 //BRepAlgo_Common PlaneS(BndBox, PlaneFace);
299 BRepAlgoAPI_Common PlaneS(BndBox, PlaneFace);
300 //modified by NIZNHY-PKV Fri Mar 22 16:52:31 2002 t
301 TopExp_Explorer EXP;
302 TopoDS_Shape PlaneSect = PlaneS.Shape();
303 EXP.Init(PlaneSect, TopAbs_WIRE);
304 TopoDS_Wire www = TopoDS::Wire(EXP.Current());
305 BRepLib_MakeFace Bndface(myPln->Pln(), www, Standard_True);
306 TopoDS_Face BndFace = TopoDS::Face(Bndface.Shape());
307
308
309// ---Recherche des faces d'appui de la nervure
310 TopoDS_Edge FirstEdge, LastEdge;
311 TopoDS_Face FirstFace, LastFace;
312 TopoDS_Vertex FirstVertex, LastVertex;
313
314 Standard_Boolean OnFirstFace = Standard_False;
315 Standard_Boolean OnLastFace = Standard_False;
316 Standard_Boolean PtOnFirstEdge = Standard_False;
317 Standard_Boolean PtOnLastEdge = Standard_False;
318 TopoDS_Edge OnFirstEdge, OnLastEdge;
319 OnFirstEdge.Nullify();
320 OnLastEdge.Nullify();
321
322 Standard_Boolean Data = ExtremeFaces(RevolRib, myBnd, myPln, FirstEdge, LastEdge,
323 FirstFace, LastFace, FirstVertex,
324 LastVertex, OnFirstFace, OnLastFace,
325 PtOnFirstEdge, PtOnLastEdge,
326 OnFirstEdge, OnLastEdge);
327
328 if(!Data) {
329#ifdef DEB
330 if (trc) cout << " No Extreme faces" << endl;
331#endif
332 myStatusError = BRepFeat_NoExtFace;
333 NotDone();
334 return;
335 }
336
337
338// ---Point detrompeur pour le cote du wire a remplir - cote matiere
339 gp_Pnt CheckPnt = CheckPoint(FirstEdge, bnd/10., myPln);
340
341// Standard_Real f, l;
342
343// ---Controle glissement valable
344// Plein de cas ou on sort du glissement
345 Standard_Integer Concavite = 3; // a priori le profile n'est pas concave
346
347 myFirstPnt = BRep_Tool::Pnt(FirstVertex);
348 myLastPnt = BRep_Tool::Pnt(LastVertex);
349
350// SliList : liste des faces concernees par la nervure
351 TopTools_ListOfShape SliList;
352 SliList.Append(FirstFace);
353
354 if(Sliding) { // glissement
355#ifdef DEB
356 if (trc) cout << " Sliding" << endl;
357#endif
358 Handle(Geom_Surface) s = BRep_Tool::Surface(FirstFace);
359 if (s->DynamicType() ==
360 STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
361 s = Handle(Geom_RectangularTrimmedSurface)::
362 DownCast(s)->BasisSurface();
363 }
364 if(s->DynamicType() != STANDARD_TYPE(Geom_Plane) &&
365 s->DynamicType() != STANDARD_TYPE(Geom_CylindricalSurface) &&
366 s->DynamicType() != STANDARD_TYPE(Geom_ConicalSurface) &&
367 s->DynamicType() != STANDARD_TYPE(Geom_ToroidalSurface))
368 Sliding = Standard_False;
369 }
370
371 if(Sliding) { // glissement
372 Handle(Geom_Surface) ss = BRep_Tool::Surface(LastFace);
373 if (ss->DynamicType() ==
374 STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
375 ss = Handle(Geom_RectangularTrimmedSurface)::
376 DownCast(ss)->BasisSurface();
377 }
378 if(ss->DynamicType() != STANDARD_TYPE(Geom_Plane) &&
379 ss->DynamicType() != STANDARD_TYPE(Geom_CylindricalSurface) &&
380 ss->DynamicType() != STANDARD_TYPE(Geom_ConicalSurface) &&
381 ss->DynamicType() != STANDARD_TYPE(Geom_ToroidalSurface))
382 Sliding = Standard_False;
383 }
384
385// Controle uniquement points de depart et d'arrivee
386// -> pas de controle au milieu - a ameliorer
387// Si on faisait un controle entre Surface et sgement entre les 2 points limite
388// -> tres cher - a ameliorer
389 //gp_Pnt FirstCenter, LastCenter;
390 gp_Circ FirstCircle, LastCircle;
391 Handle(Geom_Curve) FirstCrv, LastCrv;
392
393 if(Sliding) { // glissement
394 GeomAPI_ProjectPointOnCurve proj(myFirstPnt, Line);
395 if(proj.NbPoints() < 1) {
396#ifdef DEB
397 if (trc) cout << " No First Point projection" << endl;
398#endif
399 myStatusError = BRepFeat_NoProjPt;
400 NotDone();
401 return;
402 }
403 Standard_Real FirstRayon = proj.Distance(1);
404 gp_Pnt FirstCenter = proj.Point(1);
405
406 GeomAPI_ProjectPointOnCurve proj1(myLastPnt, Line);
407 if(proj.NbPoints() < 1) {
408#ifdef DEB
409 if (trc) cout << " No Last Point projection" << endl;
410#endif
411 myStatusError = BRepFeat_NoProjPt;
412 NotDone();
413 return;
414 }
415 Standard_Real LastRayon = proj1.Distance(1);
416 gp_Pnt LastCenter = proj1.Point(1);
417
418 gp_Vec axv(myAxe.Direction());
419 gp_Ax2 ax2(FirstCenter, axv);
420 gp_Ax2 ax2p(LastCenter, axv);
421 gp_Circ theFC(ax2, FirstRayon);
422 gp_Circ theLC(ax2p, LastRayon);
423
424 gp_Pnt RFirstPnt1 = myFirstPnt.Rotated(myAxe, myAngle1);
425 gp_Pnt RLastPnt1 = myLastPnt.Rotated(myAxe, myAngle1);
426 gp_Pnt RFirstPnt2 = myFirstPnt.Rotated(myAxe, -myAngle2);
427 gp_Pnt RLastPnt2 = myLastPnt.Rotated(myAxe, -myAngle2);
428
429 BRep_Builder Bu;
430 TopoDS_Vertex v1, v2, v3, v4;
431 Bu.MakeVertex(v1, RFirstPnt2, Precision::Confusion());
432 Bu.MakeVertex(v2, RFirstPnt1, Precision::Confusion());
433 Bu.MakeVertex(v3, RLastPnt2, Precision::Confusion());
434 Bu.MakeVertex(v4, RLastPnt1, Precision::Confusion());
435
436 BRepLib_MakeEdge ee1(theFC, v1, v2);
437 BRepLib_MakeEdge ee2(theLC, v3, v4);
438
439 if(Sliding && !PtOnFirstEdge) {
440 BRepExtrema_ExtCF ext1(TopoDS::Edge(ee1.Shape()), FirstFace);
441#ifdef DEB
442 Standard_Integer nb =
443#endif
444 ext1.NbExt();
445#ifdef DEB
446 Standard_Real dist =
447#endif
448 ext1.SquareDistance(1);
449 if(ext1.NbExt() < 1 || ext1.SquareDistance(1) > Precision::Confusion() * Precision::Confusion())
450 Sliding = Standard_False;
451 }
452 if(Sliding && !PtOnLastEdge) {
453 BRepExtrema_ExtCF ext2(ee2, LastFace); // ExtCF : courbes et surfaces
454 if(ext2.NbExt() < 1 || ext2.SquareDistance(1) > Precision::Confusion() * Precision::Confusion())
455 Sliding = Standard_False;
456 }
457 if(Sliding && PtOnFirstEdge) {
458 Standard_Real f, l;
459 FirstCrv = BRep_Tool::Curve(OnFirstEdge, f, l);
460 if(FirstCrv->DynamicType() != STANDARD_TYPE(Geom_Circle))
461 Sliding = Standard_False;
462 else {
463 Handle(Geom_Circle) C1 = Handle(Geom_Circle)::DownCast(FirstCrv);
464 gp_Circ Circ = C1->Circ();
465 FirstCircle = Circ;
466 gp_Ax1 circax = FirstCircle.Axis();
467 if(!circax.IsCoaxial(myAxe, Precision::Confusion(),
468 Precision::Confusion()))
469 Sliding = Standard_False;
470 else {
471//#ifndef DEB
472 if(fabs(FirstCircle.Radius()-FirstRayon) >=
473//#else
474// if(abs(FirstCircle.Radius()-FirstRayon) >=
475//#endif
476 Precision::Confusion())
477 Sliding = Standard_False;
478 }
479 }
480 }
481
482 if(Sliding && PtOnLastEdge) {
483 Standard_Real f, l;
484 LastCrv = BRep_Tool::Curve(OnLastEdge, f, l);
485 if(LastCrv->DynamicType() != STANDARD_TYPE(Geom_Circle))
486 Sliding = Standard_False;
487 else {
488 Handle(Geom_Circle) C1 = Handle(Geom_Circle)::DownCast(LastCrv);
489 gp_Circ Circ = C1->Circ();
490 LastCircle = Circ;
491 gp_Ax1 circax = LastCircle.Axis();
492 if(!circax.IsCoaxial(myAxe, Precision::Confusion(),
493 Precision::Confusion()))
494 Sliding = Standard_False;
495 else {
496 Standard_Real rad = LastCircle.Radius();
497//#ifndef DEB
498 if(fabs(rad - LastRayon) >= Precision::Confusion()) {
499//#else
500// if(abs(rad - LastRayon) >= Precision::Confusion()) {
501//#endif
502 Sliding = Standard_False;
503 }
504 }
505 }
506 }
507 }
508
509
510// On construit un gros profil qui va jusqu`a la boite englobante
511// -> par tangence avec premier et dernier edge du Wire
512// -> par normales aux faces d'appui : statistiquement meilleur
513// On intersecte le tout pour trouver le profil final
514
515
516// ---cas de glissement : construction de la face profil
517 if(Sliding) {
518#ifdef DEB
519 if (trc) cout << " still Sliding" << endl;
520#endif
521 TopoDS_Face Prof;
522 Standard_Boolean ProfileOK;
523 ProfileOK = SlidingProfile(Prof,RevolRib,myTol,Concavite,myPln,BndFace,CheckPnt,
524 FirstFace,LastFace,FirstVertex,LastVertex,
525 FirstEdge,LastEdge);
526
527 if (!ProfileOK) {
528#ifdef DEB
529 cout << "Not computable" << endl;
530 if (trc) cout << "Face profile not computable" << endl;
531#endif
532 myStatusError = BRepFeat_NoFaceProf;
533 NotDone();
534 return;
535 }
536
537
538// ---Propagation sur les faces du shape initial
539// pour trouver les faces concernees par la nervure
540 Standard_Boolean falseside = Standard_True;
541 Sliding = Propagate(SliList, Prof, myFirstPnt, myLastPnt, falseside);
542// Controle si on a ce qu`il faut pour avoir la matiere du bon cote
543 if(falseside == Standard_False) {
544#ifdef DEB
545 cout << " Verify plane and wire orientation" << endl;
546#endif
547 myStatusError = BRepFeat_FalseSide;
548 NotDone();
549 return;
550 }
551 }
552
553
554// ---Generation du profile de base de la nervure
555
556 TopoDS_Wire w;
557 BB.MakeWire(w);
558 TopoDS_Edge thePreviousEdge;
559 TopoDS_Vertex theFV;
560 thePreviousEdge.Nullify();
561
562// compteur du nombre d`edges pour remplir la map
563 Standard_Integer counter = 1;
564
565// ---cas de glissement
566 if(Sliding && !myListOfEdges.IsEmpty()) {
567 BRepTools_WireExplorer EX1(myWire);
568 for(; EX1.More(); EX1.Next()) {
569 const TopoDS_Edge& E = EX1.Current();
570 if(!myLFMap.IsBound(E)) {
571 TopTools_ListOfShape theTmpList;
572 myLFMap.Bind(E, theTmpList);
573 }
574 if(E.IsSame(FirstEdge)) {
575 Standard_Real f, l;
576 Handle(Geom_Curve) cc = BRep_Tool::Curve(E, f, l);
577 gp_Pnt pt;
578 if(!FirstEdge.IsSame(LastEdge)) {
579 pt = BRep_Tool::Pnt(TopExp::LastVertex(E,Standard_True));
580 }
581 else {
582 pt = myLastPnt;
583 Standard_Real fpar = IntPar(cc, myFirstPnt);
584 Standard_Real lpar = IntPar(cc, pt);
585 Handle(Geom_Curve) ccc;
586 if(fpar > lpar) {
587 ccc = Handle(Geom_Curve)::DownCast(cc->Reversed());
588 cc = ccc;
589 }
590 }
591 TopoDS_Edge ee1;
592 if(thePreviousEdge.IsNull()) {
593 BRepLib_MakeVertex v1(myFirstPnt);
594 BRepLib_MakeVertex v2(pt);
595 BRepLib_MakeEdge e(cc, v1, v2);
596 ee1 = TopoDS::Edge(e.Shape());
597 }
598 else {
599 const TopoDS_Vertex& v1 = TopExp::LastVertex(thePreviousEdge,Standard_True);
600 BRepLib_MakeVertex v2(pt);
601
602 BRepLib_MakeEdge e(cc, v1, v2);
603 ee1 = TopoDS::Edge(e.Shape());
604 }
605 TopoDS_Shape aLocalShape = ee1.Oriented(E.Orientation());
606 ee1 = TopoDS::Edge(aLocalShape);
607// ee1 = TopoDS::Edge(ee1.Oriented(E.Orientation()));
608 if(counter == 1) theFV = TopExp::FirstVertex(ee1,Standard_True);
609 myLFMap(E).Append(ee1);
610 BB.Add(w, ee1);
611 thePreviousEdge = ee1;
612 counter++;
613 EX1.Next();
614 break;
615 }
616 }
617
618// Cas plusieurs edges
619 if(!FirstEdge.IsSame(LastEdge)) {
620 for(; EX1.More(); EX1.Next()) {
621 const TopoDS_Edge& E = EX1.Current();
622 if(!myLFMap.IsBound(E)) {
623 TopTools_ListOfShape thelist1;
624 myLFMap.Bind(E, thelist1);
625 }
626 theList.Append(E);
627 Standard_Real f, l;
628 if(!E.IsSame(LastEdge)) {
629 Handle(Geom_Curve) ccc = BRep_Tool::Curve(E, f, l);
630 TopoDS_Vertex v1, v2;
631 if(!thePreviousEdge.IsNull()) {
632 v1 = TopExp::LastVertex(thePreviousEdge,Standard_True);
633 v2 = TopExp::LastVertex(E,Standard_True);
634 }
635 else {
636// v1 = TopExp::LastVertex(E,Standard_True);
637 v1 = TopExp::FirstVertex(E,Standard_True);
638 v2 = TopExp::LastVertex(E,Standard_True);
639 }
640 BRepLib_MakeEdge E1(ccc, v1, v2);
641 TopoDS_Edge E11 = TopoDS::Edge(E1.Shape());
642 TopoDS_Shape aLocalShape = E11.Oriented(E.Orientation());
643 E11 = TopoDS::Edge(aLocalShape);
644// E11 = TopoDS::Edge(E11.Oriented(E.Orientation()));
645 thePreviousEdge = E11;
646 myLFMap(E).Append(E11);
647 BB.Add(w, E11);
648 if(counter == 1) theFV = TopExp::FirstVertex(E11,Standard_True);
649 counter++;
650 }
651 else {
652 Standard_Real f, l;
653 Handle(Geom_Curve) cc = BRep_Tool::Curve(E, f, l);
654 gp_Pnt pf = BRep_Tool::Pnt(TopExp::FirstVertex(E,Standard_True));
655 gp_Pnt pl = myLastPnt;
656 TopoDS_Edge ee;
657 if(thePreviousEdge.IsNull()) {
658 BRepLib_MakeEdge e(cc, pf , pl);
659 ee = TopoDS::Edge(e.Shape());
660 }
661 else {
662 const TopoDS_Vertex& v1 = TopExp::LastVertex(thePreviousEdge,Standard_True);
663 BRepLib_MakeVertex v2(pl);
664 BRepLib_MakeEdge e(cc, v1, v2);
665 ee = TopoDS::Edge(e.Shape());
666 }
667 TopoDS_Shape aLocalShape = ee.Oriented(E.Orientation());
668 ee = TopoDS::Edge(aLocalShape);
669// ee = TopoDS::Edge(ee.Oriented(E.Orientation()));
670 BB.Add(w, ee);
671 myLFMap(E).Append(ee);
672 if(counter == 1) theFV = TopExp::FirstVertex(ee,Standard_True);
673 thePreviousEdge = ee;
674 counter++;
675 break;
676 }
677 }
678 }
679
680 TopTools_ListIteratorOfListOfShape it(myListOfEdges);
681 Standard_Boolean FirstOK = Standard_False;
682 Standard_Boolean LastOK = Standard_False;
683
684 gp_Pnt theLastPnt = myLastPnt;
685 Standard_Integer sens = 0;
686 TopoDS_Edge theEdge, theLEdge, theFEdge;
687 Standard_Integer counter1 = counter;
688 TopTools_ListOfShape NewListOfEdges;
689 NewListOfEdges.Clear();
690 while (!FirstOK) {
691 const TopoDS_Edge& edg = TopoDS::Edge(it.Value());
692 gp_Pnt fp, lp;
693 Standard_Real f, l;
694 Handle(Geom_Curve) ccc = BRep_Tool::Curve(edg, f, l);
695 Handle(Geom_TrimmedCurve) cc = new Geom_TrimmedCurve(ccc, f, l);
696 if ( edg.Orientation() == TopAbs_REVERSED) cc->Reverse();
697
698 fp = cc->Value(cc->FirstParameter());
699 lp = cc->Value(cc->LastParameter());
700 Standard_Real dist = fp.Distance(theLastPnt);
701 if(dist <= myTol) {
702 sens = 1;
703 LastOK = Standard_True;
704 }
705 else {
706 dist = lp.Distance(theLastPnt);
707 if(dist <= myTol) {
708 sens = 2;
709 LastOK = Standard_True;
710 cc->Reverse();
711 }
712 }
713 Standard_Integer FirstFlag = 0;
714 if(sens==1 && lp.Distance(myFirstPnt) <= myTol) {
715 FirstOK = Standard_True;
716 FirstFlag = 1;
717 }
718 else if(sens==2 && fp.Distance(myFirstPnt) <= myTol) {
719 FirstOK = Standard_True;
720 FirstFlag = 2;
721 }
722
723 if (LastOK) {
724 TopoDS_Edge eeee;
725 Standard_Real fpar = cc->FirstParameter();
726 Standard_Real lpar = cc->LastParameter();
727 if(!FirstOK) {
728 if(thePreviousEdge.IsNull()) {
729 BRepLib_MakeEdge e(cc, fpar, lpar);
730 eeee = TopoDS::Edge(e.Shape());
731 }
732 else {
733 const TopoDS_Vertex& v1 = TopExp::LastVertex(thePreviousEdge,Standard_True);
734 BRepLib_MakeVertex v2(cc->Value(lpar));
735 BRepLib_MakeEdge e(cc, v1, v2);
736 eeee = TopoDS::Edge(e.Shape());
737 }
738 }
739 else {
740 if(thePreviousEdge.IsNull()) {
741 BRepLib_MakeVertex v1(cc->Value(fpar));
742 BRepLib_MakeEdge e(cc, v1, theFV);
743 eeee = TopoDS::Edge(e.Shape());
744 }
745 else {
746 const TopoDS_Vertex& v1 = TopExp::LastVertex(thePreviousEdge,Standard_True);
747 BRepLib_MakeEdge e(cc, v1, theFV);
748 eeee = TopoDS::Edge(e.Shape());
749 }
750 }
751
752 thePreviousEdge = eeee;
753 BB.Add(w, eeee);
754 if(counter == 1) theFV = TopExp::FirstVertex(eeee,Standard_True);
755 counter1++;
756 NewListOfEdges.Append(edg);
757 theEdge = eeee;
758#ifdef DEB
759 Standard_Real dist1 =
760#endif
761 theLastPnt.Distance(myLastPnt);
762 if(dist <= myTol)
763 theFEdge = edg;
764 theLastPnt = BRep_Tool::Pnt(TopExp::LastVertex(theEdge,Standard_True));
765 }
766
767 if(FirstFlag == 1) {
768 theLEdge = edg;
769 }
770 else if(FirstFlag == 2) {
771 theLEdge = theEdge;
772 }
773
774 if(LastOK) {
775 it.Initialize(myListOfEdges);
776 LastOK = Standard_False;
777 }
778 else if(it.More()) it.Next();
779 else {
780 Sliding = Standard_False;
781 break;
782 }
783 sens = 0;
784 }
785
786
787 TopTools_DataMapOfShapeListOfShape SlidMap;
788 SlidMap.Clear();
789
790 if(Sliding && counter1 > counter) {
791 TopTools_ListIteratorOfListOfShape it;
792 TopTools_DataMapIteratorOfDataMapOfShapeListOfShape itm;
793 TopExp_Explorer EX2(w, TopAbs_EDGE);
794 Standard_Integer ii = 0;
795 for(; EX2.More(); EX2.Next()) {
796 const TopoDS_Edge& E = TopoDS::Edge(EX2.Current());
797 ii++;
798 if(ii >= counter && ii <= counter1) {
799 it.Initialize(NewListOfEdges);
800 Standard_Integer jj = 0;
801 for(; it.More(); it.Next()) {
802 const TopoDS_Edge& e2 = TopoDS::Edge(it.Value());
803 jj++;
804 if(jj== (ii - counter +1)) {
805 itm.Initialize(mySlface);
806 for(; itm.More(); itm.Next()) {
807 const TopoDS_Face& fac = TopoDS::Face(itm.Key());
808 const TopTools_ListOfShape& ledg = itm.Value();
809 TopTools_ListIteratorOfListOfShape itedg(ledg);
810 //Standard_Integer iiii = 0;
811 for(; itedg.More(); itedg.Next()) {
812 const TopoDS_Edge& e1 = TopoDS::Edge(itedg.Value());
813 if(e1.IsSame(e2)){
814 if(!SlidMap.IsBound(fac)) {
815 TopTools_ListOfShape thelist2;
816 SlidMap.Bind(fac, thelist2);
817 }
818 SlidMap(fac).Append(E);
819 }
820 }
821 }
822 }
823 }
824 }
825 }
826 }
827
828 mySlface.Clear();
829 mySlface = SlidMap;
830 }
831
832// ---Arguments de LocOpe_LinearForm : arguments du prism
833// glissement
834 if(Sliding) {
835 TopoDS_Face F;
836 BB.MakeFace(F, myPln, myTol);
837 BB.Add(F, w);
838 mySkface = F;
839 myPbase = mySkface;
840 mySUntil.Nullify();
841 }
842
843
844// ---Cas sans glissement : construction de la face profil
845 if(!Sliding) {
846#ifdef DEB
847 if (trc) {
848 if (Modify) cout << " Sliding failure" << endl;
849 cout << " no Sliding" << endl;
850 }
851#endif
852 TopExp_Explorer explo1(BndFace, TopAbs_WIRE);
853 TopoDS_Wire WWW = TopoDS::Wire(explo1.Current());
854 BRepTools_WireExplorer explo(WWW);
855 BRep_Builder Bu;
856 TopoDS_Wire Wiwiwi;
857 Bu.MakeWire(Wiwiwi);
858 TopoDS_Vertex NewV1, NewV2, LastV, v;
859 NewV1.Nullify(); NewV2.Nullify(); LastV.Nullify();
860
861 for(; explo.More(); explo.Next()) {
862 const TopoDS_Edge& e = TopoDS::Edge(explo.Current());
863 TopoDS_Vertex v1 = TopExp::FirstVertex(e,Standard_True);
864 TopoDS_Vertex v2 = TopExp::LastVertex(e,Standard_True);
865
866 Standard_Real f, l;//, t;
867 Handle(Geom_Curve) ln = BRep_Tool::Curve(e, f, l);
868// Handle(Geom_Curve) lln = BRep_Tool::Curve(e, f, l);
869// Handle(Geom_Curve) ln;
870// if(e.Orientation() == TopAbs_REVERSED) {
871// ln = Handle(Geom_Curve)::DownCast(lln->Reversed());
872// v = v1; v1 = v2; v2= v;
873// f = IntPar(ln, BRep_Tool::Pnt(v1));
874// l = IntPar(ln, BRep_Tool::Pnt(v2));
875// }
876// else ln = lln;
877
878 Handle(Geom2d_Curve) l2d = GeomAPI::To2d(ln, Plane->Pln());
879 Geom2dAPI_InterCurveCurve intcc(l2d, ln2d, Precision::Confusion());
880 TopoDS_Vertex VV; VV.Nullify();
881 TopoDS_Edge ee1, ee2;
882
883 if(intcc.NbPoints() > 0) {
884 gp_Pnt2d P = intcc.Point(1);
885 gp_Pnt point;
886 myPln->D0(P.X(), P.Y(), point);
887 Standard_Real par = IntPar(ln, point);
888 if(f <= par && l >= par) {
889 Bu.MakeVertex(VV, point, Precision::Confusion());
890 }
891 }
892
893 if(VV.IsNull() && NewV1.IsNull()) continue;
894
895 if(!VV.IsNull() && NewV1.IsNull()) {
896 NewV1 = VV;
897 LastV = v2;
898 BRepLib_MakeEdge ee1(NewV1, LastV);
899 Bu.Add(Wiwiwi, ee1);
900 continue;
901 }
902
903 if(VV.IsNull() && !NewV1.IsNull()) {
904 BRepLib_MakeEdge ee1(LastV, v2);
905 LastV = v2;
906 Bu.Add(Wiwiwi, e);
907 continue;
908 }
909
910 if(!VV.IsNull() && !NewV1.IsNull()) {
911 NewV2 = VV;
912 BRepLib_MakeEdge ee1(LastV, NewV2);
913 LastV = NewV2;
914 Bu.Add(Wiwiwi, ee1);
915 BRepLib_MakeEdge ee2(LastV, NewV1);
916 Bu.Add(Wiwiwi, ee2);
917 break;
918 }
919 }
920
921 BRepLib_MakeFace newbndface(myPln->Pln(), Wiwiwi, Standard_True);
922 TopoDS_Face NewBndFace = TopoDS::Face(newbndface.Shape());
923
924 BRepTopAdaptor_FClass2d Cl(NewBndFace, Precision::Confusion());
925 Standard_Real paru, parv;
926 ElSLib::Parameters(myPln->Pln(), CheckPnt, paru, parv);
927 gp_Pnt2d checkpnt2d(paru, parv);
928 if(Cl.Perform(checkpnt2d, Standard_True) == TopAbs_OUT) {
929 //modified by NIZNHY-PKV Fri Mar 22 16:52:52 2002 f
930 //BRepAlgo_Cut c(BndFace, NewBndFace);
931 BRepAlgoAPI_Cut c(BndFace, NewBndFace);
932 //modified by NIZNHY-PKV Fri Mar 22 16:52:57 2002 t
933 TopExp_Explorer exp(c.Shape(), TopAbs_WIRE);
934 const TopoDS_Wire& w = TopoDS::Wire(exp.Current());
935 // akm 13/02/02 : we know the plane. Why not to use it?
936 // BRepLib_MakeFace ff(w);
937 BRepLib_MakeFace ff(myPln->Pln(), w, Standard_True);
938 NewBndFace = TopoDS::Face(ff.Shape());
939 }
940
941
942 if(!BRepAlgo::IsValid(NewBndFace)) {
943#ifdef DEB
944 cout << "Invalid new bounding face" << endl;
945#endif
946 myStatusError = BRepFeat_InvShape;
947 NotDone();
948 return;
949 }
950
951 BndFace = NewBndFace;
952
953
954 TopoDS_Face Prof;
955 Standard_Boolean ProfileOK;
956 ProfileOK = NoSlidingProfile(Prof,RevolRib,myTol,Concavite,myPln,
957 bnd,BndFace,CheckPnt,
958 FirstFace,LastFace,FirstVertex,LastVertex,
959 FirstEdge,LastEdge,OnFirstFace,OnLastFace);
960
961 if (!ProfileOK) {
962#ifdef DEB
963 cout << "Not computable" << endl;
964 if (trc) cout << " Face profile not computable" << endl;
965#endif
966 myStatusError = BRepFeat_NoFaceProf;
967 NotDone();
968 return;
969 }
970
971
972// ---Propagation sur les faces du shape initial
973// pour trouver les faces concernees par la nervure
974 Standard_Boolean falseside = Standard_True;
975 Propagate(SliList, Prof, myFirstPnt, myLastPnt, falseside);
976// Controle si on a ce qu`il faut pour avoir la matiere du bon cote
977 if(falseside == Standard_False) {
978#ifdef DEB
979 cout << " Verify plane and wire orientation" << endl;
980#endif
981 myStatusError = BRepFeat_FalseSide;
982 NotDone();
983 return;
984 }
985
986 mySlface.Clear();
987
988 TopTools_ListIteratorOfListOfShape it;
989 it.Initialize(SliList);
990
991 TopoDS_Shape comp;
992
993 BRep_Builder BB;
994 BB.MakeShell(TopoDS::Shell(comp));
995
996 for(; it.More(); it.Next()) {
997 BB.Add(comp, it.Value());
998 }
999
1000 mySUntil = comp;
1001
1002 mySkface = Prof;
1003 myPbase = Prof;
1004 }
1005
1006 mySliding = Sliding;
1007
1008 TopExp_Explorer exp;
1009 for ( exp.Init(mySbase,TopAbs_FACE);exp.More();exp.Next()) {
1010 TopTools_ListOfShape thelist3;
1011 myMap.Bind(exp.Current(), thelist3);
1012 myMap(exp.Current()).Append(exp.Current());
1013 }
1014}
1015
1016
1017
1018//=======================================================================
1019//function : Add
1020//purpose : add elements de collage
1021//=======================================================================
1022
1023void BRepFeat_MakeRevolutionForm::Add(const TopoDS_Edge& E,
1024 const TopoDS_Face& F)
1025{
1026#ifdef DEB
1027 Standard_Boolean trc = BRepFeat_GettraceFEAT();
1028 if (trc) cout << "BRepFeat_MakeRevolutionForm::Add" << endl;
1029#endif
1030 if(mySlface.IsEmpty()) {
1031 TopExp_Explorer exp;
1032 for (exp.Init(mySbase,TopAbs_FACE);exp.More();exp.Next()) {
1033 if (exp.Current().IsSame(F)) {
1034 break;
1035 }
1036 }
1037 if (!exp.More()) {
1038 Standard_ConstructionError::Raise();
1039 }
1040
1041 if (!mySlface.IsBound(F)) {
1042 TopTools_ListOfShape thelist;
1043 mySlface.Bind(F, thelist);
1044 }
1045 TopTools_ListIteratorOfListOfShape itl(mySlface(F));
1046 for (; itl.More();itl.Next()) {
1047 if (itl.Value().IsSame(E)) {
1048 break;
1049 }
1050 }
1051 if (!itl.More()) {
1052 mySlface(F).Append(E);
1053 }
1054 }
1055}
1056
1057
1058
1059//=======================================================================
1060//function : Perform
1061//purpose : construction
1062//=======================================================================
1063
1064void BRepFeat_MakeRevolutionForm::Perform()
1065{
1066#ifdef DEB
1067 Standard_Boolean trc = BRepFeat_GettraceFEAT();
1068 if (trc) cout << "BRepFeat_MakeRevolutionForm::Perform()" << endl;
1069#endif
1070 if(mySbase.IsNull() || mySkface.IsNull() || myPbase.IsNull()) {
1071#ifdef DEB
1072 if (trc) cout << " Fields not initialized" << endl;
1073#endif
1074 myStatusError = BRepFeat_NotInitialized;
1075 NotDone();
1076 return;
1077 }
1078
1079 gp_Pnt Pt;
1080
1081 TopExp_Explorer exx(myPbase, TopAbs_VERTEX);
1082 for(; exx.More(); exx.Next()) {
1083 const TopoDS_Vertex& vv = TopoDS::Vertex(exx.Current());
1084 if(!vv.IsNull()) {
1085 Pt = BRep_Tool::Pnt(vv);
1086 break;
1087 }
1088 }
1089
1090 if(myAngle2 != 0) {
1091 gp_Trsf T;
1092 T.SetRotation(myAxe, -myAngle2);
1093 BRepBuilderAPI_Transform trsf(T);
1094 trsf.Perform(myPbase, Standard_False);
1095 TopoDS_Face Pbase = TopoDS::Face(trsf.Shape());
1096 TopTools_DataMapIteratorOfDataMapOfShapeListOfShape iter(myLFMap);
1097 for(; iter.More(); iter.Next()) {
1098 const TopoDS_Shape& e1 = iter.Value().First();
1099 TopExp_Explorer ex1(myPbase, TopAbs_EDGE);
1100 TopExp_Explorer ex2(Pbase, TopAbs_EDGE);
1101 for(; ex1.More(); ex1.Next()) {
1102 if(ex1.Current().IsSame(e1)) {
1103 myLFMap(iter.Key()).Clear();
1104 myLFMap(iter.Key()).Append(ex2.Current());
1105 }
1106 ex2.Next();
1107 }
1108 }
1109
1110 TopTools_DataMapIteratorOfDataMapOfShapeListOfShape iter1(mySlface);
1111 for(; iter1.More(); iter1.Next()) {
1112 const TopoDS_Shape& f1 = iter1.Key();
1113 const TopoDS_Shape& e1 = iter1.Value().First();
1114 TopExp_Explorer ex1(myPbase, TopAbs_EDGE);
1115 TopExp_Explorer ex2(Pbase, TopAbs_EDGE);
1116 for(; ex1.More(); ex1.Next()) {
1117 const TopoDS_Shape& E1 = ex1.Current();
1118 const TopoDS_Shape& E2 = ex2.Current();
1119 if(E1.IsSame(e1)) {
1120 mySlface(f1).Clear();
1121 mySlface(f1).Append(E2);
1122 }
1123 ex2.Next();
1124 }
1125 }
1126 myPbase = Pbase;
1127 trsf.Perform(mySkface, Standard_False);
1128// flo : verif si il faut bien reaffecter le champ mySkface
1129// TopoDS_Face mySkface = TopoDS::Face(trsf.Shape());
1130 mySkface = TopoDS::Face(trsf.Shape());
1131 }
1132
1133 LocOpe_RevolutionForm theForm;
1134 theForm.Perform(myPbase, myAxe, (myAngle1+myAngle2));
1135 TopoDS_Shape VraiForm = theForm.Shape(); // la primitive non-coupe
1136
1137// gestion de descendants
1138 MajMap(myPbase,theForm,myMap,myFShape,myLShape);
1139
1140 myGluedF.Clear();
1141
1142
1143
1144 gp_Pln Pln0 = myPln->Pln();
1145 BRepLib_MakeFace f(Pln0);
1146
1147
1148 gp_Vec vec1 = myHeight1*Normal(f, Pt);
1149 gp_Vec vec2 = -myHeight2*Normal(f, Pt);
1150
1151 gp_Pln Pln1 = Pln0.Translated(vec1);
1152 gp_Pln Pln2 = Pln0.Translated(vec2);
1153
1154 BRepLib_MakeFace ff1(Pln1);
1155 BRepLib_MakeFace ff2(Pln2);
1156 TopoDS_Face f1 = TopoDS::Face(ff1.Shape());
1157 TopoDS_Face f2 = TopoDS::Face(ff2.Shape());
1158 BRepFeat::FaceUntil(mySbase, f1);
1159 BRepFeat::FaceUntil(mySbase, f2);
1160
1161 LocOpe_CSIntersector ASI1(f1);
1162 LocOpe_CSIntersector ASI2(f2);
1163
1164 Handle(Geom_Line) normale = new Geom_Line(Pt, vec1);
1165 TColGeom_SequenceOfCurve scur;
1166 scur.Append(normale);
1167
1168 ASI1.Perform(scur);
1169 ASI2.Perform(scur);
1170
1171 if(!ASI1.IsDone() || !ASI2.IsDone() ||
1172 ASI1.NbPoints(1) != 1 || ASI2.NbPoints(1) != 1) {
1173#ifdef DEB
1174 if (trc) cout << " Intersection failure" << endl;
1175#endif
1176 myStatusError = BRepFeat_BadIntersect;
1177 NotDone();
1178 return;
1179 }
1180
1181 TopAbs_Orientation Ori1 = ASI1.Point(1,1).Orientation();
1182 TopAbs_Orientation Ori2 = TopAbs::Reverse(ASI2.Point(1,1).Orientation());
1183 TopoDS_Face FF1 = ASI1.Point(1,1).Face();
1184 TopoDS_Face FF2 = ASI2.Point(1,1).Face();
1185
1186 TopoDS_Shape Comp;
1187 BRep_Builder B;
1188 B.MakeCompound(TopoDS::Compound(Comp));
1189 TopoDS_Solid S1 = BRepFeat::Tool(f1,FF1,Ori1);
1190 TopoDS_Solid S2 = BRepFeat::Tool(f2,FF2,Ori2);
1191 if (!S1.IsNull()) B.Add(Comp,S1);
1192 if (!S2.IsNull()) B.Add(Comp,S2);
1193
1194 //modified by NIZNHY-PKV Fri Mar 22 16:53:20 2002 f
1195 //BRepAlgo_Cut trP(VraiForm,Comp);
1196 BRepAlgoAPI_Cut trP(VraiForm,Comp);
1197 //modified by NIZNHY-PKV Fri Mar 22 16:53:23 2002 t
1198 // coupe de la nervure par deux plans parallels
1199 TopTools_DataMapOfShapeListOfShape SlidingMap;
1200
1201// gestion de descendants
1202
1203 TopTools_DataMapIteratorOfDataMapOfShapeListOfShape it1;
1204 it1.Initialize(myMap);
1205 for(; it1.More(); it1.Next()) {
1206 const TopoDS_Shape& orig = it1.Key();
1207 if(it1.Value().IsEmpty()) continue;
1208 const TopoDS_Shape& sh = it1.Value().First();
1209 exx.Init(VraiForm, TopAbs_FACE);
1210 for(; exx.More(); exx.Next()) {
1211 const TopoDS_Face& fac = TopoDS::Face(exx.Current());
1212 TopExp_Explorer exx1(fac, TopAbs_WIRE);
1213 const TopoDS_Wire& thew = TopoDS::Wire(exx1.Current());
1214 if(thew.IsSame(myFShape)) {
1215 const TopTools_ListOfShape& desfaces = trP.Modified(f2);
1216 myMap(myFShape) = desfaces;
1217 continue;
1218 }
1219 else if(thew.IsSame(myLShape)) {
1220 const TopTools_ListOfShape& desfaces = trP.Modified(f1);
1221 myMap(myLShape) = desfaces;
1222 continue;
1223 }
1224 if(fac.IsSame(sh)) {
1225 if (trP.IsDeleted(fac)) {
1226 }
1227 else {
1228 const TopTools_ListOfShape& desfaces = trP.Modified(fac);
1229 if(!desfaces.IsEmpty()) {
1230 myMap(orig).Clear();
1231 myMap(orig) = trP.Modified(fac);
1232 }
1233 }
1234 }
1235 }
1236 }
1237
1238 exx.Init(VraiForm, TopAbs_FACE);
1239 for(; exx.More(); exx.Next()) {
1240 const TopoDS_Face& fac = TopoDS::Face(exx.Current());
1241 TopTools_ListOfShape thelist;
1242 SlidingMap.Bind(fac, thelist);
1243 if (trP.IsDeleted(fac)) {
1244 }
1245 else {
1246 const TopTools_ListOfShape& desfaces = trP.Modified(fac);
1247 if(!desfaces.IsEmpty())
1248 SlidingMap(fac) = desfaces;
1249 else
1250 SlidingMap(fac).Append(fac);
1251 }
1252 }
1253
1254
1255// gestion des faces de glissement
1256 SetGluedFaces(mySlface, theForm, SlidingMap, myGluedF);
1257
1258 VraiForm = trP.Shape(); // primitive coupee
1259
1260 if(!myGluedF.IsEmpty())
1261 myPerfSelection = BRepFeat_NoSelection;
1262 else
1263 myPerfSelection = BRepFeat_SelectionSh;
1264
1265 exx.Init(myPbase, TopAbs_EDGE);
1266 for(; exx.More(); exx.Next()) {
1267 const TopoDS_Edge& e = TopoDS::Edge(exx.Current());
1268 if(!myMap.IsBound(e)) {
1269#ifdef DEB
1270 if (trc) cout << " Sliding face not in Base shape" << endl;
1271#endif
1272 myStatusError = BRepFeat_IncSlidFace;
1273 NotDone();
1274 return;
1275 }
1276 }
1277
1278 myGShape = VraiForm;
1279
1280 if(!myGluedF.IsEmpty() && !mySUntil.IsNull()) {
1281#ifdef DEB
1282 cout << "The case is not computable" << endl;
1283 if (trc) cout << " Glued faces not empty and Until shape not null" << endl;
1284#endif
1285 myStatusError = BRepFeat_InvShape;
1286 NotDone();
1287 return;
1288 }
1289
1290 LFPerform(); // reconstruction topologique
1291}
1292
1293
1294//=======================================================================
1295//function : Propagate
1296//purpose : propagation sur les faces du shape inital, rechrche des faces
1297// concernees par la nervure
1298//=======================================================================
1299
1300Standard_Boolean BRepFeat_MakeRevolutionForm::Propagate(TopTools_ListOfShape& SliList,
1301 const TopoDS_Face& fac,
1302 const gp_Pnt& Firstpnt,
1303 const gp_Pnt& Lastpnt,
1304 Standard_Boolean& falseside)
1305{
1306#ifdef DEB
1307 Standard_Boolean trc = BRepFeat_GettraceFEATRIB();
1308 if (trc) cout << "BRepFeat_MakeRevolutionForm::Propagate" << endl;
1309#endif
1310 gp_Pnt Firstpoint = Firstpnt;
1311 gp_Pnt Lastpoint = Lastpnt;
1312
1313 Standard_Boolean result = Standard_True;
1314 TopoDS_Face CurrentFace, saveFace;
1315 CurrentFace = TopoDS::Face(SliList.First());
1316 saveFace = CurrentFace;
1317 // BRepBuilderAPI_MakeFace fac(myPln);
1318 Standard_Boolean LastOK = Standard_False, FirstOK= Standard_False;
1319 TopoDS_Vertex v1, v2, v3, v4, Vert;
1320 //modified by NIZNHY-PKV Fri Mar 22 16:54:09 2002 f
1321 //BRepAlgo_Section sect (fac, CurrentFace, Standard_False);
1322 BRepAlgoAPI_Section sect (fac, CurrentFace, Standard_False);
1323 //modified by NIZNHY-PKV Fri Mar 22 16:54:14 2002 t
1324 sect.Approximation(Standard_True);
1325 sect.Build();
1326 TopExp_Explorer Ex;
1327 TopoDS_Edge e, e1;
1328 gp_Pnt FP, LP;
1329 Standard_Integer ii = 0;
1330 for (Ex.Init(sect.Shape(), TopAbs_EDGE); Ex.More(); Ex.Next()) {
1331 ii++;
1332 if(ii==1){
1333 e = TopoDS::Edge(Ex.Current());
1334 }
1335 else if (ii > 1) {
1336 e1 = TopoDS::Edge(Ex.Current());
1337 break;
1338 }
1339 }
1340 if(e.IsNull()) {
1341 falseside = Standard_False;
1342 return Standard_False;
1343 }
1344 //
1345 //modified by NIZNHY-PKV Tue Apr 2 15:08:23 2002 f
1346 if(!e1.IsNull()) {
1347 Standard_Real aTolV1, aTolV2;
1348 myListOfEdges.Clear();
1349 TopTools_ListOfShape thelist;
1350 mySlface.Bind(CurrentFace, thelist);
1351 mySlface(CurrentFace).Append(e1);
1352
1353 myListOfEdges.Append(e1);
1354
1355 v1 = TopExp::FirstVertex(e1,Standard_True);
1356 v2 = TopExp::LastVertex (e1,Standard_True);
1357
1358 FP = BRep_Tool::Pnt(v1);
1359 LP = BRep_Tool::Pnt(v2);
1360
1361 aTolV1=BRep_Tool::Tolerance(v1);
1362 aTolV2=BRep_Tool::Tolerance(v2);
1363
1364 if(FP.Distance(Firstpoint) <= aTolV1 ||
1365 FP.Distance(Lastpoint) <= aTolV1) {
1366 FirstOK = Standard_True;
1367 }
1368 if(LP.Distance(Firstpoint)<= aTolV2 ||
1369 LP.Distance(Lastpoint) <= aTolV2) {
1370 LastOK = Standard_True;
1371 }
1372
1373 if(LastOK && FirstOK) {
1374 return result;
1375 }
1376
1377 else {
1378 myListOfEdges.Clear();
1379 }
1380 }
1381 //modified by NIZNHY-PKV Tue Apr 2 15:08:26 2002 t
1382 //
1383 if(!e1.IsNull()) {
1384 myListOfEdges.Clear();
1385 TopTools_ListOfShape thelist1;
1386 mySlface.Bind(CurrentFace, thelist1);
1387 mySlface(CurrentFace).Append(e);
1388
1389 myListOfEdges.Append(e);
1390
1391// mySlface.Bind(CurrentFace,TopTools_ListOfShape());
1392 mySlface(CurrentFace).Append(e1);
1393// myListOfEdges.Append(e1);
1394
1395 v1 = TopExp::FirstVertex(e,Standard_True);
1396 v2 = TopExp::LastVertex(e,Standard_True);
1397 v3 = TopExp::FirstVertex(e1,Standard_True);
1398 v4 = TopExp::LastVertex(e1,Standard_True);
1399 gp_Pnt p1, p2, p3, p4;
1400 p1 = BRep_Tool::Pnt(v1); FP = p1;
1401 p2 = BRep_Tool::Pnt(v2); LP = p2;
1402 p3 = BRep_Tool::Pnt(v3);
1403 p4 = BRep_Tool::Pnt(v4);
1404 if(p1.Distance(Firstpoint) <= BRep_Tool::Tolerance(v1)) {
1405 if(p3.Distance(Lastpoint) <= BRep_Tool::Tolerance(v3)) {
1406 FirstOK = Standard_True;
1407 Lastpoint = p4;
1408 }
1409 else if(p4.Distance(Lastpoint) <= BRep_Tool::Tolerance(v4)) {
1410 FirstOK = Standard_True;
1411 Lastpoint = p3;
1412 }
1413 else {
1414 e1.Nullify();
1415 }
1416 }
1417 else if(p1.Distance(Lastpoint) <= BRep_Tool::Tolerance(v1)) {
1418 if(p3.Distance(Firstpoint) <= BRep_Tool::Tolerance(v3)) {
1419 FirstOK = Standard_True;
1420 Firstpoint = p4;
1421 }
1422 else if(p4.Distance(Firstpoint) <= BRep_Tool::Tolerance(v4)) {
1423 FirstOK = Standard_True;
1424 Firstpoint = p3;
1425 }
1426 else {
1427 e1.Nullify();
1428 }
1429 }
1430 else if(p2.Distance(Firstpoint) <= BRep_Tool::Tolerance(v2)) {
1431 if(p3.Distance(Lastpoint) <= BRep_Tool::Tolerance(v3)) {
1432 LastOK = Standard_True;
1433 Lastpoint = p4;
1434 }
1435 else if(p4.Distance(Lastpoint) <= BRep_Tool::Tolerance(v4)) {
1436 LastOK = Standard_True;
1437 Lastpoint = p3;
1438 }
1439 else {
1440 e1.Nullify();
1441 }
1442 }
1443 else if(p2.Distance(Lastpoint) <= BRep_Tool::Tolerance(v2)) {
1444 if(p3.Distance(Firstpoint) <= BRep_Tool::Tolerance(v3)) {
1445 LastOK = Standard_True;
1446 Firstpoint = p4;
1447 }
1448 else if(p4.Distance(Firstpoint) <= BRep_Tool::Tolerance(v4)) {
1449 LastOK = Standard_True;
1450 Firstpoint = p3;
1451 }
1452 else {
1453 e1.Nullify();
1454 }
1455 }
1456 else {
1457 e1.Nullify();
1458 }
1459 }
1460 if(e1.IsNull()) {
1461 //Standard_Real f, l;
1462
1463 myListOfEdges.Clear();
1464 TopTools_ListOfShape thelist2;
1465 mySlface.Bind(CurrentFace, thelist2);
1466 mySlface(CurrentFace).Append(e);
1467
1468 myListOfEdges.Append(e);
1469
1470 v1 = TopExp::FirstVertex(e,Standard_True);
1471 v2 = TopExp::LastVertex(e,Standard_True);
1472
1473 FP = BRep_Tool::Pnt(v1);
1474 LP = BRep_Tool::Pnt(v2);
1475
1476 if(FP.Distance(Firstpoint) <= BRep_Tool::Tolerance(v1)
1477 || FP.Distance(Lastpoint) <= BRep_Tool::Tolerance(v1)) {
1478 FirstOK = Standard_True;
1479 }
1480 if(LP.Distance(Firstpoint) <= BRep_Tool::Tolerance(v2)
1481 || LP.Distance(Lastpoint) <= BRep_Tool::Tolerance(v2)) {
1482 LastOK = Standard_True;
1483 }
1484
1485 if(LastOK && FirstOK) {
1486 return result;
1487 }
1488 }
1489
1490 TopTools_IndexedDataMapOfShapeListOfShape mapedges;
1491 TopExp::MapShapesAndAncestors(mySbase, TopAbs_EDGE, TopAbs_FACE, mapedges);
1492 TopExp_Explorer ex;
1493 TopoDS_Edge FirstEdge;
1494
1495 TopoDS_Vertex Vprevious; Vprevious.Nullify();
1496 TopoDS_Vertex Vpreprevious; Vpreprevious.Nullify();
1497
1498 while(!FirstOK) {
1499 // retrouver l'edge connexe a v1:
1500 gp_Pnt pt;
1501 if(!v1.IsNull()) pt= BRep_Tool::Pnt(v1);
1502 gp_Pnt ptprev;
1503 if(!Vprevious.IsNull()) ptprev = BRep_Tool::Pnt(Vprevious);
1504 gp_Pnt ptpreprev;
1505 if(!Vpreprevious.IsNull()) ptpreprev = BRep_Tool::Pnt(Vpreprevious);
1506
1507 if((!Vprevious.IsNull() && ptprev.Distance(pt) <= myTol) ||
1508 (!Vpreprevious.IsNull() && ptpreprev.Distance(pt) <= myTol)) {
1509 falseside = Standard_False;
1510 return Standard_False;
1511 }
1512
1513 for (ex.Init(CurrentFace, TopAbs_EDGE); ex.More(); ex.Next()) {
1514 const TopoDS_Edge& e = TopoDS::Edge(ex.Current());
1515
1516 BRepExtrema_ExtPC projF(v1, e);
1517
1518 if(projF.IsDone() && projF.NbExt() >=1) {
1519 Standard_Real dist2min = RealLast();
1520 Standard_Integer index = 0;
1521 for (Standard_Integer sol =1 ; sol <= projF.NbExt(); sol++) {
1522 if (projF.SquareDistance(sol) <= dist2min) {
1523 index = sol;
1524 dist2min = projF.SquareDistance(sol);
1525 }
1526 }
1527 if (index != 0) {
1528 if (dist2min <= BRep_Tool::Tolerance(e) * BRep_Tool::Tolerance(e)) {
1529 FirstEdge = e;
1530 break;
1531 }
1532 }
1533 }
1534 }
1535
1536 const TopTools_ListOfShape& L = mapedges.FindFromKey(FirstEdge);
1537 TopTools_ListIteratorOfListOfShape It(L);
1538
1539 for (; It.More(); It.Next()) {
1540 const TopoDS_Face& FF = TopoDS::Face(It.Value());
1541 if (!FF.IsSame(CurrentFace)) {
1542 CurrentFace = FF;
1543 break;
1544 }
1545 }
1546
1547 //modified by NIZNHY-PKV Fri Mar 22 16:54:28 2002 f
1548 //BRepAlgo_Section sectf (fac, CurrentFace, Standard_False);
1549 BRepAlgoAPI_Section sectf (fac, CurrentFace, Standard_False);
1550 //modified by NIZNHY-PKV Fri Mar 22 16:54:33 2002 t
1551 sectf.Approximation(Standard_True);
1552 sectf.Build();
1553
1554 TopoDS_Edge edg1;
1555 for (Ex.Init(sectf.Shape(), TopAbs_EDGE); Ex.More(); Ex.Next()) {
1556 edg1 = TopoDS::Edge(Ex.Current());
1557 gp_Pnt ppp1 = BRep_Tool::Pnt(TopExp::FirstVertex(edg1,Standard_True));
1558 gp_Pnt ppp2 = BRep_Tool::Pnt(TopExp::LastVertex(edg1,Standard_True));
1559 if(ppp1.Distance(BRep_Tool::Pnt(v1)) <= BRep_Tool::Tolerance(v1) ||
1560 ppp2.Distance(BRep_Tool::Pnt(v1)) <= BRep_Tool::Tolerance(v1))
1561 break;
1562 }
1563
1564 TopTools_ListOfShape thelist3;
1565 mySlface.Bind(CurrentFace, thelist3);
1566 mySlface(CurrentFace).Append(edg1);
1567 myListOfEdges.Append(edg1);
1568
1569 if (!edg1.IsNull()) SliList.Prepend(CurrentFace);
1570 else return Standard_False;
1571
1572 Vert = TopExp::FirstVertex(edg1,Standard_True);
1573 gp_Pnt PP = BRep_Tool::Pnt(Vert);
1574 FP = BRep_Tool::Pnt(v1);
1575 Standard_Real tol = BRep_Tool::Tolerance(edg1);
1576 Standard_Real tol1 = BRep_Tool::Tolerance(v1);
1577 if(tol1 > tol) tol = tol1;
1578 Standard_Real dist = PP.Distance(FP);
1579 if (dist <= tol) {
1580 Vpreprevious = Vprevious;
1581 Vprevious = v1;
1582 v1 = TopExp::LastVertex(edg1,Standard_True);
1583 }
1584 else {
1585 Vpreprevious = Vprevious;
1586 Vprevious = v1;
1587 v1 = Vert;
1588 }
1589
1590 FP = BRep_Tool::Pnt(v1);
1591
1592 if(FP.Distance(Firstpoint) <= BRep_Tool::Tolerance(v1)
1593 || FP.Distance(Lastpoint) <= BRep_Tool::Tolerance(v1)) {
1594 FirstOK = Standard_True;
1595 }
1596 }
1597
1598 CurrentFace = saveFace;
1599 Vprevious.Nullify();
1600 Vpreprevious.Nullify();
1601
1602 while(!LastOK) {
1603 // retrouver l'edge connexe a v2:
1604 gp_Pnt pt;
1605 if(!v2.IsNull()) pt= BRep_Tool::Pnt(v2);
1606 gp_Pnt ptprev;
1607 if(!Vprevious.IsNull()) ptprev = BRep_Tool::Pnt(Vprevious);
1608 gp_Pnt ptpreprev;
1609 if(!Vpreprevious.IsNull()) ptpreprev = BRep_Tool::Pnt(Vpreprevious);
1610
1611 if((!Vprevious.IsNull() && ptprev.Distance(pt) <= myTol) ||
1612 (!Vpreprevious.IsNull() && ptpreprev.Distance(pt) <= myTol)) {
1613 falseside = Standard_False;
1614 return Standard_False;
1615 }
1616
1617 for (ex.Init(CurrentFace, TopAbs_EDGE); ex.More(); ex.Next()) {
1618 const TopoDS_Edge& e = TopoDS::Edge(ex.Current());
1619 BRepExtrema_ExtPC projF(v2, e);
1620
1621 if(projF.IsDone() && projF.NbExt() >=1) {
1622 Standard_Real dist2min = RealLast();
1623 Standard_Integer index = 0;
1624 for (Standard_Integer sol =1 ; sol <= projF.NbExt(); sol++) {
1625 if (projF.SquareDistance(sol) <= dist2min) {
1626 index = sol;
1627 dist2min = projF.SquareDistance(sol);
1628 }
1629 }
1630 if (index != 0) {
1631 if (dist2min <= BRep_Tool::Tolerance(e) * BRep_Tool::Tolerance(e)) {
1632 FirstEdge = e;
1633 break;
1634 }
1635 }
1636 }
1637 }
1638
1639 const TopTools_ListOfShape& L = mapedges.FindFromKey(FirstEdge);
1640 TopTools_ListIteratorOfListOfShape It(L);
1641
1642 for (; It.More(); It.Next()) {
1643 const TopoDS_Face& FF = TopoDS::Face(It.Value());
1644 if (!FF.IsSame(CurrentFace)) {
1645 CurrentFace = FF;
1646 break;
1647 }
1648 }
1649
1650 ii = 0;
1651
1652 //modified by NIZNHY-PKV Fri Mar 22 16:54:45 2002 f
1653 //BRepAlgo_Section sectf (fac, CurrentFace, Standard_False);
1654 BRepAlgoAPI_Section sectf (fac, CurrentFace, Standard_False);
1655 //modified by NIZNHY-PKV Fri Mar 22 16:54:52 2002 t
1656 sectf.Approximation(Standard_True);
1657 sectf.Build();
1658
1659 TopoDS_Edge edg2;
1660 for (Ex.Init(sectf.Shape(), TopAbs_EDGE); Ex.More(); Ex.Next()) {
1661 edg2 = TopoDS::Edge(Ex.Current());
1662 gp_Pnt ppp1 = BRep_Tool::Pnt(TopExp::FirstVertex(edg2,Standard_True));
1663 gp_Pnt ppp2 = BRep_Tool::Pnt(TopExp::LastVertex(edg2,Standard_True));
1664 if(ppp1.Distance(BRep_Tool::Pnt(v2)) <= BRep_Tool::Tolerance(v2) ||
1665 ppp2.Distance(BRep_Tool::Pnt(v2)) <= BRep_Tool::Tolerance(v2))
1666 break;
1667 }
1668 TopTools_ListOfShape thelist4;
1669 mySlface.Bind(CurrentFace, thelist4);
1670 mySlface(CurrentFace).Append(edg2);
1671 myListOfEdges.Append(edg2);
1672
1673 if (!edg2.IsNull()) SliList.Append(CurrentFace);
1674 else return Standard_False;
1675
1676 Vert = TopExp::FirstVertex(edg2,Standard_True);
1677 gp_Pnt PP = BRep_Tool::Pnt(Vert);
1678 FP = BRep_Tool::Pnt(v2);
1679 if (PP.Distance(FP)<= BRep_Tool::Tolerance(v2)) {
1680 Vpreprevious = Vprevious;
1681 Vprevious = v2;
1682 v2 = TopExp::LastVertex(edg2,Standard_True);
1683 }
1684 else {
1685 v2 = Vert;
1686 }
1687 FP = BRep_Tool::Pnt(v2);
1688
1689
1690 if(FP.Distance(Firstpoint) <= BRep_Tool::Tolerance(v2)
1691 || FP.Distance(Lastpoint) <= BRep_Tool::Tolerance(v2)) {
1692 LastOK = Standard_True;
1693 }
1694 }
1695 if(!e1.IsNull()) myListOfEdges.Append(e1);
1696 return result;
1697
1698}
1699
1700
1701//=======================================================================
1702//function : MajMap
1703//purpose : gestion de descendants
1704//=======================================================================
1705
1706static void MajMap(const TopoDS_Shape& theB,
1707 const LocOpe_RevolutionForm& theP,
1708 TopTools_DataMapOfShapeListOfShape& theMap, // myMap
1709 TopoDS_Shape& theFShape, // myFShape
1710 TopoDS_Shape& theLShape) // myLShape
1711{
1712 TopExp_Explorer exp(theP.FirstShape(),TopAbs_WIRE);
1713 if (exp.More()) {
1714 theFShape = exp.Current();
1715 TopTools_ListOfShape thelist;
1716 theMap.Bind(theFShape, thelist);
1717 for (exp.Init(theP.FirstShape(),TopAbs_FACE);exp.More();exp.Next()) {
1718 const TopoDS_Shape& sh = exp.Current();
1719 theMap(theFShape).Append(sh);
1720 }
1721 }
1722
1723 exp.Init(theP.LastShape(),TopAbs_WIRE);
1724 if (exp.More()) {
1725 theLShape = exp.Current();
1726 TopTools_ListOfShape thelist1;
1727 theMap.Bind(theLShape, thelist1);
1728 for (exp.Init(theP.LastShape(),TopAbs_FACE);exp.More();exp.Next()) {
1729 const TopoDS_Shape& sh = exp.Current();
1730 theMap(theLShape).Append(sh);
1731 }
1732 }
1733
1734 for (exp.Init(theB,TopAbs_EDGE); exp.More(); exp.Next()) {
1735 if (!theMap.IsBound(exp.Current())) {
1736#ifdef DEB
1737 const TopoDS_Edge& e =
1738#endif
1739 TopoDS::Edge(exp.Current());
1740 TopTools_ListOfShape thelist2;
1741 theMap.Bind(exp.Current(), thelist2);
1742 theMap(exp.Current()) = theP.Shapes(exp.Current());
1743 }
1744 }
1745}
1746
1747
1748 //=======================================================================
1749//function : SetGluedFaces
1750//purpose : gestion des faces de glissement
1751//=======================================================================
1752
1753static void SetGluedFaces(const TopTools_DataMapOfShapeListOfShape& theSlmap,
1754 LocOpe_RevolutionForm& thePrism,
1755 const TopTools_DataMapOfShapeListOfShape& SlidingMap,
1756 TopTools_DataMapOfShapeShape& theMap)
1757{
1758 // Glissements
1759 TopTools_DataMapIteratorOfDataMapOfShapeListOfShape itm(theSlmap);
1760 if(!theSlmap.IsEmpty()) {
1761 for (; itm.More(); itm.Next()) {
1762 const TopoDS_Face& fac = TopoDS::Face(itm.Key());
1763 const TopTools_ListOfShape& ledg = itm.Value();
1764 TopTools_ListIteratorOfListOfShape it;
1765 for (it.Initialize(ledg); it.More(); it.Next()) {
1766 const TopTools_ListOfShape& gfac = thePrism.Shapes(it.Value());
1767 if (gfac.Extent() != 1) {
1768#ifdef DEB
1769 cout << "Pb SetGluedFace" << endl;
1770#endif
1771 }
1772 TopTools_DataMapIteratorOfDataMapOfShapeListOfShape iterm(SlidingMap);
1773 for(; iterm.More(); iterm.Next()) {
1774 const TopoDS_Face& ff = TopoDS::Face(iterm.Key());
1775 const TopTools_ListOfShape& lfaces = iterm.Value();
1776 if(lfaces.IsEmpty()) continue;
1777 const TopoDS_Face& fff = TopoDS::Face(lfaces.First());
1778 if(gfac.First().IsSame(ff)) theMap.Bind(fff,fac);
1779 }
1780 }
1781 }
1782 }
1783}
1784