0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / BRepFeat / BRepFeat_MakeLinearForm.cxx
CommitLineData
b311480e 1// Created on: 1997-04-14
2// Created by: Olga KOULECHOVA
3// Copyright (c) 1997-1999 Matra Datavision
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 7//
d5f74e42 8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
7fd59977 16
7fd59977 17
42cf5bc1 18#include <BRep_Builder.hxx>
19#include <BRep_Tool.hxx>
20#include <BRepAlgoAPI_Common.hxx>
21#include <BRepAlgoAPI_Section.hxx>
22#include <BRepBuilderAPI.hxx>
23#include <BRepBuilderAPI_MakeFace.hxx>
24#include <BRepBuilderAPI_Transform.hxx>
25#include <BRepExtrema_ExtCF.hxx>
26#include <BRepExtrema_ExtPC.hxx>
27#include <BRepExtrema_ExtPF.hxx>
7fd59977 28#include <BRepFeat.hxx>
42cf5bc1 29#include <BRepFeat_MakeLinearForm.hxx>
30#include <BRepLib_MakeEdge.hxx>
31#include <BRepLib_MakeFace.hxx>
32#include <BRepLib_MakeVertex.hxx>
33#include <BRepLib_MakeWire.hxx>
34#include <BRepPrimAPI_MakeBox.hxx>
35#include <BRepTools.hxx>
36#include <BRepTools_Modifier.hxx>
37#include <BRepTools_TrsfModification.hxx>
38#include <BRepTools_WireExplorer.hxx>
7fd59977 39#include <Geom2d_Curve.hxx>
40#include <Geom2d_Line.hxx>
42cf5bc1 41#include <Geom_Curve.hxx>
7fd59977 42#include <Geom_CylindricalSurface.hxx>
42cf5bc1 43#include <Geom_Plane.hxx>
7fd59977 44#include <Geom_RectangularTrimmedSurface.hxx>
42cf5bc1 45#include <Geom_Surface.hxx>
7fd59977 46#include <Geom_TrimmedCurve.hxx>
42cf5bc1 47#include <GeomLProp_CLProps.hxx>
7fd59977 48#include <GeomProjLib.hxx>
42cf5bc1 49#include <gp_Dir.hxx>
50#include <gp_Lin.hxx>
51#include <gp_Pln.hxx>
52#include <gp_Pnt.hxx>
53#include <gp_Pnt2d.hxx>
54#include <gp_Vec.hxx>
55#include <gp_Vec2d.hxx>
56#include <IntRes2d_IntersectionPoint.hxx>
57#include <LocOpe.hxx>
58#include <LocOpe_FindEdges.hxx>
59#include <LocOpe_Gluer.hxx>
60#include <LocOpe_LinearForm.hxx>
61#include <Precision.hxx>
62#include <Standard_ConstructionError.hxx>
63#include <TColGeom_Array1OfCurve.hxx>
64#include <TColgp_Array1OfPnt.hxx>
7fd59977 65#include <TColgp_SequenceOfPnt.hxx>
7fd59977 66#include <TColStd_Array1OfReal.hxx>
7fd59977 67#include <TopExp.hxx>
42cf5bc1 68#include <TopExp_Explorer.hxx>
69#include <TopoDS.hxx>
70#include <TopoDS_Edge.hxx>
71#include <TopoDS_Face.hxx>
72#include <TopoDS_Shape.hxx>
73#include <TopoDS_Wire.hxx>
74#include <TopOpeBRepBuild_HBuilder.hxx>
75#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
76#include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
7fd59977 77#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
7fd59977 78#include <TopTools_ListIteratorOfListOfShape.hxx>
42cf5bc1 79#include <TopTools_ListOfShape.hxx>
7fd59977 80#include <TopTools_MapIteratorOfMapOfShape.hxx>
42cf5bc1 81#include <TopTools_MapOfShape.hxx>
7fd59977 82
83//modified by NIZNHY-PKV Fri Mar 22 16:51:33 2002 f
84//#include <BRepAlgo_Section.hxx>
85//#include <BRepAlgo_Common.hxx>
7fd59977 86//modified by NIZNHY-PKV Fri Mar 22 16:51:35 2002 t
7fd59977 87//#include <DbgTools.hxx>
0797d9d3 88#ifdef OCCT_DEBUG
1d0a9d4d 89extern Standard_Boolean BRepFeat_GettraceFEAT();
90extern Standard_Boolean BRepFeat_GettraceFEATRIB();
7fd59977 91#endif
92
93static void MajMap(const TopoDS_Shape&, // base
94 const LocOpe_LinearForm&,
95 TopTools_DataMapOfShapeListOfShape&, // myMap
96 TopoDS_Shape&, // myFShape
97 TopoDS_Shape&); // myLShape
98
99static void SetGluedFaces(const TopTools_DataMapOfShapeListOfShape& theSlmap,
100 LocOpe_LinearForm&,
101 TopTools_DataMapOfShapeShape&);
102
103//=======================================================================
104//function : Init
105//purpose :
106//=======================================================================
107
108void BRepFeat_MakeLinearForm::Init(const TopoDS_Shape& Sbase,
109 const TopoDS_Wire& W,
110 const Handle(Geom_Plane)& Plane,
111 const gp_Vec& Direc,
112 const gp_Vec& Direc1,
113 const Standard_Integer Mode,
114 const Standard_Boolean Modify)
115{
0797d9d3 116#ifdef OCCT_DEBUG
7fd59977 117 Standard_Boolean trc = BRepFeat_GettraceFEAT();
118 if (trc) cout << "BRepFeat_MakeLinearForm::Init" << endl;
119#endif
120 Standard_Boolean RevolRib = Standard_False;
121 Done();
122 myGenerated.Clear();
123
0d969553
Y
124// modify = 0 if there is no intention to make sliding
125// = 1 if one tries to make sliding
7fd59977 126 Standard_Boolean Sliding = Modify;
127 myLFMap.Clear();
128
129 myShape.Nullify();
130 myMap.Clear();
131 myFShape.Nullify();
132 myLShape.Nullify();
133 mySbase = Sbase;
134 mySkface.Nullify();
135 myPbase.Nullify();
136
137 myGShape.Nullify();
138 mySUntil.Nullify();
139 myListOfEdges.Clear();
140 mySlface.Clear();
141
142 TopoDS_Shape aLocalShape = W.Oriented(TopAbs_FORWARD);
143 myWire = TopoDS::Wire(aLocalShape);
144// myWire = TopoDS::Wire(W.Oriented(TopAbs_FORWARD));
145 myDir = Direc;
146 myDir1 = Direc1;
147 myPln = Plane;
148
149 if(Mode == 0)
150 myFuse = Standard_False;
151 else // if(Mode == 1)
152 myFuse = Standard_True;
0797d9d3 153#ifdef OCCT_DEBUG
7fd59977 154 if (trc) {
155 if (myFuse) cout << " Fuse" << endl;
156 if (!myFuse) cout << " Cut" << endl;
157 }
158#endif
159
160
0d969553 161// ---Determine Tolerance : max tolerance on parameters
7fd59977 162 myTol = Precision::Confusion();
163
164 TopExp_Explorer exx;
165 exx.Init(myWire, TopAbs_VERTEX);
166 for(; exx.More(); exx.Next()) {
167 const Standard_Real& tol = BRep_Tool::
168 Tolerance(TopoDS::Vertex(exx.Current()));
169 if(tol > myTol) myTol = tol;
170 }
171
172 exx.Init(Sbase, TopAbs_VERTEX);
173 for(; exx.More(); exx.Next()) {
174 const Standard_Real& tol = BRep_Tool::
175 Tolerance(TopoDS::Vertex(exx.Current()));
176 if(tol > myTol) myTol = tol;
177 }
178
0d969553
Y
179// ---Control of directions
180// the wire should be in the rib
7fd59977 181 gp_Vec nulldir(0, 0, 0);
182 if(!myDir1.IsEqual(nulldir, myTol, myTol)) {
183 Standard_Real ang = myDir1.Angle(myDir);
c6541a0c 184 if(ang != M_PI) {
0797d9d3 185#ifdef OCCT_DEBUG
7fd59977 186 if (trc) cout << " Directions must be opposite" << endl;
187#endif
188 myStatusError = BRepFeat_BadDirect;
189 NotDone();
190 return;
191 }
192 }
193 else {
194
195// Rib is centre in the middle of translation
0797d9d3 196#ifdef OCCT_DEBUG
7fd59977 197 if (trc) cout << " Rib is centre" << endl;
198#endif
199 const gp_Vec& DirTranslation = (Direc + Direc1) * 0.5;
200 gp_Trsf T;
201 T.SetTranslation(DirTranslation);
202 BRepBuilderAPI_Transform trf(T);
203 trf.Perform(myWire);
204 myWire = TopoDS::Wire(trf.Shape());
205 myDir = Direc - DirTranslation;
206 myDir1 = Direc1 - DirTranslation;
207 myPln->Transform(T);
208 }
209
0d969553 210// ---Calculate bounding box
7fd59977 211 BRep_Builder BB;
212
213 TopTools_ListOfShape theList;
214
215 TopoDS_Shape U;
216 U.Nullify();
217 gp_Pnt FirstCorner, LastCorner;
218 Standard_Real bnd = HeightMax(mySbase, U, FirstCorner, LastCorner);
219 myBnd = bnd;
220
221 BRepPrimAPI_MakeBox Bndbox(FirstCorner, LastCorner);
222 TopoDS_Solid BndBox = Bndbox.Solid();
223
224
0d969553 225// ---Construction of the face workplane (section bounding box)
7fd59977 226 BRepLib_MakeFace PlaneF(myPln->Pln(), -6.*myBnd,
227 6.*myBnd, -6.*myBnd, 6.*myBnd);
228 TopoDS_Face PlaneFace = TopoDS::Face(PlaneF.Shape());
229
230 //modified by NIZNHY-PKV Fri Mar 22 16:49:28 2002 f
231 //BRepAlgo_Common PlaneS(BndBox, PlaneFace);
232 BRepAlgoAPI_Common PlaneS(BndBox, PlaneFace);
233 //modified by NIZNHY-PKV Fri Mar 22 16:49:39 2002 t
234 TopExp_Explorer EXP;
235 TopoDS_Shape PlaneSect = PlaneS.Shape();
236 EXP.Init(PlaneSect, TopAbs_WIRE);
237 TopoDS_Wire www = TopoDS::Wire(EXP.Current());
238 BRepLib_MakeFace Bndface(myPln->Pln(), www, Standard_True);
239 TopoDS_Face BndFace = TopoDS::Face(Bndface.Shape());
240
241
0d969553 242// ---Find support faces of the rib
7fd59977 243 TopoDS_Edge FirstEdge, LastEdge;
244 TopoDS_Face FirstFace, LastFace;
245 TopoDS_Vertex FirstVertex, LastVertex;
246
247 Standard_Boolean OnFirstFace = Standard_False;
248 Standard_Boolean OnLastFace = Standard_False;
249 Standard_Boolean PtOnFirstEdge = Standard_False;
250 Standard_Boolean PtOnLastEdge = Standard_False;
251 TopoDS_Edge OnFirstEdge, OnLastEdge;
252 OnFirstEdge.Nullify();
253 OnLastEdge.Nullify();
254
255 Standard_Boolean Data = ExtremeFaces(RevolRib, myBnd, myPln, FirstEdge, LastEdge,
256 FirstFace, LastFace, FirstVertex,
257 LastVertex, OnFirstFace, OnLastFace,
258 PtOnFirstEdge, PtOnLastEdge,
259 OnFirstEdge, OnLastEdge);
260
261 if(!Data) {
0797d9d3 262#ifdef OCCT_DEBUG
7fd59977 263 if (trc) cout << " No Extreme faces" << endl;
264#endif
265 myStatusError = BRepFeat_NoExtFace;
266 NotDone();
267 return;
268 }
269
270
0d969553 271// ---Proofing Point for the side of the wire to be filled - side material
7fd59977 272 gp_Pnt CheckPnt = CheckPoint(FirstEdge, bnd/10., myPln);
273
274// Standard_Real f, l;
275
0d969553
Y
276// ---Control sliding valuable
277// Many cases when the sliding is abandoned
278 Standard_Integer Concavite = 3; // a priori the profile is not concave
7fd59977 279
280 myFirstPnt = BRep_Tool::Pnt(FirstVertex);
281 myLastPnt = BRep_Tool::Pnt(LastVertex);
282
0d969553 283// SliList : list of faces concerned by the rib
7fd59977 284 TopTools_ListOfShape SliList;
285 SliList.Append(FirstFace);
286
0d969553 287 if(Sliding) { // sliding
0797d9d3 288#ifdef OCCT_DEBUG
7fd59977 289 if (trc) cout << " Sliding" << endl;
290#endif
bcf50875 291 Sliding = Standard_False;
7fd59977 292 Handle(Geom_Surface) s = BRep_Tool::Surface(FirstFace);
293 if (s->DynamicType() ==
294 STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
295 s = Handle(Geom_RectangularTrimmedSurface)::
296 DownCast(s)->BasisSurface();
297 }
298 if(s->DynamicType() == STANDARD_TYPE(Geom_Plane) ||
299 s->DynamicType() == STANDARD_TYPE(Geom_CylindricalSurface)) {
0d969553 300// if plane or cylinder : sliding is possible
7fd59977 301 Sliding = Standard_True;
302 }
303 }
304
0d969553
Y
305// Control only start and end points
306// -> no control at the middle - improve
307// Controle between Surface and segment between 2 limit points
308// is too expensive - improve
7fd59977 309 if(Sliding) {
310 gp_Pnt p1(myFirstPnt.X()+myDir.X(),myFirstPnt.Y()+myDir.Y(),
311 myFirstPnt.Z()+myDir.Z());
312 BRepLib_MakeEdge ee1(myFirstPnt, p1);
313 BRepExtrema_ExtCF ext1(ee1, FirstFace);
314 if(ext1.NbExt() == 1 && ext1.SquareDistance(1)<=BRep_Tool::Tolerance(FirstFace) * BRep_Tool::Tolerance(FirstFace)) {
315 gp_Pnt p2(myLastPnt.X()+myDir.X(),myLastPnt.Y()+myDir.Y(),
316 myLastPnt.Z()+myDir.Z());
317 BRepLib_MakeEdge ee2(myLastPnt, p2);
0d969553 318 BRepExtrema_ExtCF ext2(ee2, LastFace); // ExtCF : curves and surfaces
7fd59977 319 if(ext2.NbExt() == 1 && ext2.SquareDistance(1)<=BRep_Tool::Tolerance(LastFace) * BRep_Tool::Tolerance(LastFace)) {
320 Sliding = Standard_True;
321 }
322 else {
323 Sliding = Standard_False;
324 }
325 }
326 else {
327 Sliding = Standard_False;
328 }
329 }
330
331 if(!myDir1.IsEqual(nulldir, Precision::Confusion(), Precision::Confusion())) {
332 if(Sliding) {
333 gp_Pnt p1(myFirstPnt.X()+myDir1.X(),myFirstPnt.Y()+myDir1.Y(),
334 myFirstPnt.Z()+myDir1.Z());
335 BRepLib_MakeEdge ee1(myFirstPnt, p1);
336 BRepExtrema_ExtCF ext1(ee1, FirstFace);
337 if(ext1.NbExt() == 1 && ext1.SquareDistance(1)<=BRep_Tool::Tolerance(FirstFace) * BRep_Tool::Tolerance(FirstFace)) {
338 gp_Pnt p2(myLastPnt.X()+myDir1.X(),myLastPnt.Y()+myDir1.Y(),
339 myLastPnt.Z()+myDir1.Z());
340 BRepLib_MakeEdge ee2(myLastPnt, p2);
341 BRepExtrema_ExtCF ext2(ee2, LastFace);
342 if(ext2.NbExt() == 1 && ext2.SquareDistance(1)<=BRep_Tool::Tolerance(LastFace) * BRep_Tool::Tolerance(LastFace)) {
343 Sliding = Standard_True;
344 }
345 else {
346 Sliding = Standard_False;
347 }
348 }
349 else {
350 Sliding = Standard_False;
351 }
352 }
353 }
354
355
0d969553
Y
356// Construct a great profile that goes till the bounding box
357// -> by tangency with the first and the last edge of the Wire
358// -> by normals to the support faces : statistically better
359// Intersect everything to find the final profile
7fd59977 360
361
0d969553 362// ---case of sliding : construction of the profile face
7fd59977 363 if(Sliding) {
0797d9d3 364#ifdef OCCT_DEBUG
7fd59977 365 if (trc) cout << " still Sliding" << endl;
366#endif
367 TopoDS_Face Prof;
368 Standard_Boolean ProfileOK;
369 ProfileOK = SlidingProfile(Prof,RevolRib,myTol,Concavite,myPln,BndFace,CheckPnt,
370 FirstFace,LastFace,FirstVertex,LastVertex,
371 FirstEdge,LastEdge);
372
373 if (!ProfileOK) {
0797d9d3 374#ifdef OCCT_DEBUG
63c629aa 375 if (trc)
376 {
377 cout << "Not computable" << endl;
378 cout << "Face profile not computable" << endl;
379 }
7fd59977 380#endif
381 myStatusError = BRepFeat_NoFaceProf;
382 NotDone();
383 return;
384 }
385
386
0d969553
Y
387// ---Propagation on faces of the initial shape
388// to find the faces concerned by the rib
7fd59977 389 Standard_Boolean falseside = Standard_True;
390 Sliding = Propagate(SliList, Prof, myFirstPnt, myLastPnt, falseside);
0d969553 391// Control if there is everything required to have the material at the proper side
7fd59977 392 if(falseside == Standard_False) {
0797d9d3 393#ifdef OCCT_DEBUG
7fd59977 394 cout << "Verify plane and wire orientation" << endl;
395#endif
396 myStatusError = BRepFeat_FalseSide;
397 NotDone();
398 return;
399 }
400 }
401
402
0d969553 403// ---Generation of the base of the rib profile
7fd59977 404
405 TopoDS_Wire w;
406 BB.MakeWire(w);
407 TopoDS_Edge thePreviousEdge;
408 TopoDS_Vertex theFV;
409 thePreviousEdge.Nullify();
410
0d969553 411// calculate the number of edges to fill the map
7fd59977 412 Standard_Integer counter = 1;
413
0d969553 414// ---case of sliding
7fd59977 415 if(Sliding && !myListOfEdges.IsEmpty()) {
416 BRepTools_WireExplorer EX1(myWire);
417 for(; EX1.More(); EX1.Next()) {
418 const TopoDS_Edge& E = EX1.Current();
419 if(!myLFMap.IsBound(E)) {
420 TopTools_ListOfShape theTmpList;
421 myLFMap.Bind(E, theTmpList );
422 }
423 if(E.IsSame(FirstEdge)) {
424 Standard_Real f, l;
425 Handle(Geom_Curve) cc = BRep_Tool::Curve(E, f, l);
426 cc = new Geom_TrimmedCurve(cc, f, l);
427 gp_Pnt pt;
428 if(!FirstEdge.IsSame(LastEdge)) {
429 pt = BRep_Tool::Pnt(TopExp::LastVertex(E,Standard_True));
430 }
431 else {
432 pt = myLastPnt;
433 Standard_Real fpar = IntPar(cc, myFirstPnt);
434 Standard_Real lpar = IntPar(cc, pt);
435 Handle(Geom_Curve) ccc;
436 if(fpar > lpar) {
437 ccc = Handle(Geom_Curve)::DownCast(cc->Reversed());
438 cc = ccc;
439 }
440 }
441 TopoDS_Edge ee1;
442 if(thePreviousEdge.IsNull()) {
443 BRepLib_MakeVertex v1(myFirstPnt);
444 BRepLib_MakeVertex v2(pt);
445 BRepLib_MakeEdge e(cc, v1, v2);
446 ee1 = TopoDS::Edge(e.Shape());
447 }
448 else {
449 const TopoDS_Vertex& v1 = TopExp::LastVertex(thePreviousEdge,Standard_True);
450 BRepLib_MakeVertex v2(pt);
451
452 BRepLib_MakeEdge e(cc, v1, v2);
453 ee1 = TopoDS::Edge(e.Shape());
454 }
455 TopoDS_Shape aLocalShape = ee1.Oriented(E.Orientation());
456 ee1 = TopoDS::Edge(aLocalShape);
457// ee1 = TopoDS::Edge(ee1.Oriented(E.Orientation()));
458 if(counter == 1) theFV = TopExp::FirstVertex(ee1,Standard_True);
459 myLFMap(E).Append(ee1);
460 BB.Add(w, ee1);
461 thePreviousEdge = ee1;
462 counter++;
463 EX1.Next();
464 break;
465 }
466 }
467
0d969553 468// Case of several edges
7fd59977 469 if(!FirstEdge.IsSame(LastEdge)) {
470 for(; EX1.More(); EX1.Next()) {
471 const TopoDS_Edge& E = EX1.Current();
472 if(!myLFMap.IsBound(E)) {
473 TopTools_ListOfShape thelist1;
474 myLFMap.Bind(E, thelist1);
475 }
476 theList.Append(E);
477 Standard_Real f, l;
478 if(!E.IsSame(LastEdge)) {
479 Handle(Geom_Curve) ccc = BRep_Tool::Curve(E, f, l);
480 TopoDS_Vertex v1, v2;
481 if(!thePreviousEdge.IsNull()) {
482 v1 = TopExp::LastVertex(thePreviousEdge,Standard_True);
483 v2 = TopExp::LastVertex(E,Standard_True);
484 }
485 else {
486// v1 = TopExp::LastVertex(E,Standard_True);
487 v1 = TopExp::FirstVertex(E,Standard_True);
488 v2 = TopExp::LastVertex(E,Standard_True);
489 }
490 BRepLib_MakeEdge E1(ccc, v1, v2);
491 TopoDS_Edge E11 = TopoDS::Edge(E1.Shape());
492 TopoDS_Shape aLocalShape = E11.Oriented(E.Orientation());
493 E11 = TopoDS::Edge(aLocalShape);
494// E11 = TopoDS::Edge(E11.Oriented(E.Orientation()));
495 thePreviousEdge = E11;
496 myLFMap(E).Append(E11);
497 BB.Add(w, E11);
498 if(counter == 1) theFV = TopExp::FirstVertex(E11,Standard_True);
499 counter++;
500 }
501 else {
502 Standard_Real f, l;
503 Handle(Geom_Curve) cc = BRep_Tool::Curve(E, f, l);
504 gp_Pnt pf = BRep_Tool::Pnt(TopExp::FirstVertex(E,Standard_True));
505 gp_Pnt pl = myLastPnt;
506 TopoDS_Edge ee;
507 if(thePreviousEdge.IsNull()) {
508 BRepLib_MakeEdge e(cc, pf , pl);
509 ee = TopoDS::Edge(e.Shape());
510 }
511 else {
512 const TopoDS_Vertex& v1 = TopExp::LastVertex(thePreviousEdge,Standard_True);
513 BRepLib_MakeVertex v2(pl);
514 BRepLib_MakeEdge e(cc, v1, v2);
515 ee = TopoDS::Edge(e.Shape());
516 }
517 TopoDS_Shape aLocalShape = ee.Oriented(E.Orientation());
518 ee = TopoDS::Edge(aLocalShape);
519// ee = TopoDS::Edge(ee.Oriented(E.Orientation()));
520 BB.Add(w, ee);
521 myLFMap(E).Append(ee);
522 if(counter == 1) theFV = TopExp::FirstVertex(ee,Standard_True);
523 thePreviousEdge = ee;
524 counter++;
525 break;
526 }
527 }
528 }
529
530 TopTools_ListIteratorOfListOfShape it(myListOfEdges);
531 Standard_Boolean FirstOK = Standard_False;
532 Standard_Boolean LastOK = Standard_False;
533
534 gp_Pnt theLastPnt = myLastPnt;
535 Standard_Integer sens = 0;
536 TopoDS_Edge theEdge, theLEdge, theFEdge;
537 Standard_Integer counter1 = counter;
538 TopTools_ListOfShape NewListOfEdges;
539 NewListOfEdges.Clear();
540 while (!FirstOK) {
541 const TopoDS_Edge& edg = TopoDS::Edge(it.Value());
542 gp_Pnt fp, lp;
543 Standard_Real f, l;
544 Handle(Geom_Curve) ccc = BRep_Tool::Curve(edg, f, l);
545 Handle(Geom_TrimmedCurve) cc = new Geom_TrimmedCurve(ccc, f, l);
546 if ( edg.Orientation() == TopAbs_REVERSED) cc->Reverse();
547
548 fp = cc->Value(cc->FirstParameter());
549 lp = cc->Value(cc->LastParameter());
550 Standard_Real dist = fp.Distance(theLastPnt);
551 if(dist <= myTol) {
552 sens = 1;
553 LastOK = Standard_True;
554 }
555 else {
556 dist = lp.Distance(theLastPnt);
557 if(dist <= myTol) {
558 sens = 2;
559 LastOK = Standard_True;
560 cc->Reverse();
561 }
562 }
563 Standard_Integer FirstFlag = 0;
564 if(sens==1 && lp.Distance(myFirstPnt) <= myTol) {
565 FirstOK = Standard_True;
566 FirstFlag = 1;
567 }
568 else if(sens==2 && fp.Distance(myFirstPnt) <= myTol) {
569 FirstOK = Standard_True;
570 FirstFlag = 2;
571 }
572
573 if (LastOK) {
574 TopoDS_Edge eeee;
575 Standard_Real fpar = cc->FirstParameter();
576 Standard_Real lpar = cc->LastParameter();
577 if(!FirstOK) {
578 if(thePreviousEdge.IsNull()) {
579 BRepLib_MakeEdge e(cc, fpar, lpar);
580 eeee = TopoDS::Edge(e.Shape());
581 }
582 else {
583 const TopoDS_Vertex& v1 = TopExp::LastVertex(thePreviousEdge,Standard_True);
584 BB.UpdateVertex(v1, dist);
585 BRepLib_MakeVertex v2(cc->Value(lpar));
586 TopoDS_Vertex nv=v2.Vertex();
587 BRepLib_MakeEdge e(cc, v1, nv);
588 eeee = TopoDS::Edge(e.Shape());
589 }
590 }
591 else {
592 if(thePreviousEdge.IsNull()) {
593 BRepLib_MakeVertex v1(cc->Value(fpar));
594 BRepLib_MakeEdge e(cc, v1, theFV);
595 eeee = TopoDS::Edge(e.Shape());
596 }
597 else {
598 const TopoDS_Vertex& v1 = TopExp::LastVertex(thePreviousEdge,Standard_True);
599 BRepLib_MakeEdge e(cc, v1, theFV);
600 eeee = TopoDS::Edge(e.Shape());
601 }
602 }
603
604 thePreviousEdge = eeee;
605 BB.Add(w, eeee);
606 if(counter == 1) theFV = TopExp::FirstVertex(eeee,Standard_True);
607 counter1++;
608 NewListOfEdges.Append(edg);
609 theEdge = eeee;
7fd59977 610
611 if(dist <= myTol)
612 theFEdge = edg;
613 theLastPnt = BRep_Tool::Pnt(TopExp::LastVertex(theEdge,Standard_True));
614 }
615
616 if(FirstFlag == 1) {
617 theLEdge = edg;
618 }
619 else if(FirstFlag == 2) {
620 theLEdge = theEdge;
621 }
622
623 if(LastOK) {
624 myListOfEdges.Remove(it);
625 it.Initialize(myListOfEdges);
626 LastOK = Standard_False;
627 }
628 else if(it.More()) it.Next();
629 else {
630 Sliding = Standard_False;
631 break;
632 }
633 sens = 0;
634 }
635
636
637 TopTools_DataMapOfShapeListOfShape SlidMap;
638 SlidMap.Clear();
639
640 if(Sliding && counter1 > counter) {
641 TopTools_ListIteratorOfListOfShape it;
642 TopTools_DataMapIteratorOfDataMapOfShapeListOfShape itm;
643 TopExp_Explorer EX2(w, TopAbs_EDGE);
644 Standard_Integer ii = 0;
645 for(; EX2.More(); EX2.Next()) {
646 const TopoDS_Edge& E = TopoDS::Edge(EX2.Current());
647 ii++;
648 if(ii >= counter && ii <= counter1) {
649 it.Initialize(NewListOfEdges);
650 Standard_Integer jj = 0;
651 for(; it.More(); it.Next()) {
652 const TopoDS_Edge& e2 = TopoDS::Edge(it.Value());
653 jj++;
654 if(jj== (ii - counter +1)) {
655 itm.Initialize(mySlface);
656 for(; itm.More(); itm.Next()) {
657 const TopoDS_Face& fac = TopoDS::Face(itm.Key());
658 const TopTools_ListOfShape& ledg = itm.Value();
659 TopTools_ListIteratorOfListOfShape itedg(ledg);
660 //Standard_Integer iiii = 0;
661 for(; itedg.More(); itedg.Next()) {
662 const TopoDS_Edge& e1 = TopoDS::Edge(itedg.Value());
663 if(e1.IsSame(e2)){
664 if(!SlidMap.IsBound(fac)) {
665 TopTools_ListOfShape thelist2;
666 SlidMap.Bind(fac, thelist2);
667 }
668 SlidMap(fac).Append(E);
669 }
670 }
671 }
672 }
673 }
674 }
675 }
676 }
677
678 mySlface.Clear();
679 mySlface = SlidMap;
680 }
681
0d969553 682// ---Arguments of LocOpe_LinearForm : arguments of the prism sliding
7fd59977 683 if(Sliding) {
684 TopoDS_Face F;
685 BB.MakeFace(F, myPln, myTol);
ab860031 686 w.Closed (BRep_Tool::IsClosed (w));
7fd59977 687 BB.Add(F, w);
688// BRepLib_MakeFace F(myPln->Pln(),w, Standard_True);
689 mySkface = F;
690 myPbase = mySkface;
691 mySUntil.Nullify();
692 }
693
694
0d969553 695// ---Case without sliding : construction of the profile face
7fd59977 696 if(!Sliding) {
0797d9d3 697#ifdef OCCT_DEBUG
7fd59977 698 if (trc) {
699 if (Modify) cout << " Sliding failure" << endl;
700 cout << " no Sliding" << endl;
701 }
702#endif
703 TopoDS_Face Prof;
704 Standard_Boolean ProfileOK;
705 ProfileOK = NoSlidingProfile(Prof,RevolRib,myTol,Concavite,myPln,
706 bnd,BndFace,CheckPnt,
707 FirstFace,LastFace,FirstVertex,LastVertex,
708 FirstEdge,LastEdge,OnFirstFace,OnLastFace);
709
710 if (!ProfileOK) {
0797d9d3 711#ifdef OCCT_DEBUG
63c629aa 712 if (trc)
713 {
714 cout << "Not computable" << endl;
715 cout << " Face profile not computable" << endl;
716 }
7fd59977 717#endif
718 myStatusError = BRepFeat_NoFaceProf;
719 NotDone();
720 return;
721 }
722
723
0d969553
Y
724// ---Propagation on faces of the initial shape
725// to find the faces concerned by the rib
7fd59977 726 Standard_Boolean falseside = Standard_True;
727 Propagate(SliList, Prof, myFirstPnt, myLastPnt, falseside);
0d969553 728// Control if there is everything required to have the material at the proper side
7fd59977 729 if(falseside == Standard_False) {
0797d9d3 730#ifdef OCCT_DEBUG
7fd59977 731 cout << "Verify plane and wire orientation" << endl;
732#endif
733 myStatusError = BRepFeat_FalseSide;
734 NotDone();
735 return;
736 }
737
738 mySlface.Clear();
739
740 TopTools_ListIteratorOfListOfShape it;
741 it.Initialize(SliList);
742
743 TopoDS_Shape comp;
744
745 BRep_Builder BB;
746 BB.MakeShell(TopoDS::Shell(comp));
747
748 for(; it.More(); it.Next()) {
749 BB.Add(comp, it.Value());
750 }
ab860031 751 comp.Closed (BRep_Tool::IsClosed (comp));
7fd59977 752
753 mySUntil = comp;
754
755 mySkface = Prof;
756 myPbase = Prof;
757 }
758
759 mySliding = Sliding;
760
761 TopExp_Explorer exp;
762 for (exp.Init(mySbase,TopAbs_FACE);exp.More();exp.Next()) {
763 TopTools_ListOfShape thelist3;
764 myMap.Bind(exp.Current(), thelist3);
765 myMap(exp.Current()).Append(exp.Current());
766 }
767}
768
769
770//=======================================================================
771//function : Add
772//purpose : add des element de collage
773//=======================================================================
774
775void BRepFeat_MakeLinearForm::Add(const TopoDS_Edge& E,
776 const TopoDS_Face& F)
777{
0797d9d3 778#ifdef OCCT_DEBUG
7fd59977 779 Standard_Boolean trc = BRepFeat_GettraceFEAT();
780 if (trc) cout << "BRepFeat_MakeLinearForm::Add" << endl;
781#endif
782 if(mySlface.IsEmpty()) {
783 TopExp_Explorer exp;
784 for (exp.Init(mySbase,TopAbs_FACE);exp.More();exp.Next()) {
785 if (exp.Current().IsSame(F)) {
786 break;
787 }
788 }
789 if (!exp.More()) {
790 Standard_ConstructionError::Raise();
791 }
792
793 if (!mySlface.IsBound(F)) {
794 TopTools_ListOfShape thelist;
795 mySlface.Bind(F, thelist);
796 }
797 TopTools_ListIteratorOfListOfShape itl(mySlface(F));
798 for (; itl.More();itl.Next()) {
799 if (itl.Value().IsSame(E)) {
800 break;
801 }
802 }
803 if (!itl.More()) {
804 mySlface(F).Append(E);
805 }
806 }
807}
808
809
810
811//=======================================================================
812//function : Perform
0d969553 813//purpose : construction of rib from a profile and the initial shape
7fd59977 814//=======================================================================
815
816void BRepFeat_MakeLinearForm::Perform()
817{
0797d9d3 818#ifdef OCCT_DEBUG
7fd59977 819 Standard_Boolean trc = BRepFeat_GettraceFEAT();
820 if (trc) cout << "BRepFeat_MakeLinearForm::Perform()" << endl;
821#endif
822 if(mySbase.IsNull() || mySkface.IsNull() || myPbase.IsNull()) {
0797d9d3 823#ifdef OCCT_DEBUG
7fd59977 824 if (trc) cout << " Fields not initialized" << endl;
825#endif
826 myStatusError = BRepFeat_NotInitialized;
827 NotDone();
828 return;
829 }
830
831 gp_Vec nulldir(0, 0, 0);
832
833 Standard_Real Length = myDir.Magnitude() + myDir1.Magnitude();
834
835 myGluedF.Clear();
836
837 if(!mySUntil.IsNull())
838 myPerfSelection = BRepFeat_SelectionU;
839 else
840 myPerfSelection = BRepFeat_NoSelection;
841
842 gp_Dir dir(myDir);
843 gp_Vec V = Length*dir;
844
845 LocOpe_LinearForm theForm;
846
847 if(myDir1.IsEqual(nulldir, Precision::Confusion(), Precision::Confusion()))
848 theForm.Perform(myPbase, V, myFirstPnt, myLastPnt);
849 else
850 theForm.Perform(myPbase, V, myDir1, myFirstPnt, myLastPnt);
851
0d969553 852 TopoDS_Shape VraiForm = theForm.Shape(); // primitive of the rib
7fd59977 853
854 myFacesForDraft.Append(theForm.FirstShape());
855 myFacesForDraft.Append(theForm.LastShape());
0d969553 856 MajMap(myPbase,theForm,myMap,myFShape,myLShape); // management of descendants
7fd59977 857
858 TopExp_Explorer exx(myPbase, TopAbs_EDGE);
859 for(; exx.More(); exx.Next()) {
860 const TopoDS_Edge& e = TopoDS::Edge(exx.Current());
861 if(!myMap.IsBound(e)) {
0797d9d3 862#ifdef OCCT_DEBUG
7fd59977 863 if (trc) cout << " Sliding face not in Base shape" << endl;
864#endif
865 myStatusError = BRepFeat_IncSlidFace;
866 NotDone();
867 return;
868 }
869 }
870
871 myGShape = VraiForm;
0d969553 872 SetGluedFaces(mySlface, theForm, myGluedF); // management of sliding faces
7fd59977 873
874 if(!myGluedF.IsEmpty() && !mySUntil.IsNull()) {
0797d9d3 875#ifdef OCCT_DEBUG
63c629aa 876 if (trc)
877 {
878 cout << "The case is not computable" << endl;
879 cout << " Glued faces not empty and Until shape not null" << endl;
880 }
7fd59977 881#endif
882 myStatusError = BRepFeat_InvShape;
883 NotDone();
884 return;
885 }
886
887 LFPerform();
888
889/*
890
891 TopExp_Explorer expr(mySbase, TopAbs_FACE);
892 char nom1[20], nom2[20];
893 Standard_Integer ii = 0;
894 for(; expr.More(); expr.Next()) {
895 ii++;
896 sprintf(nom1, "faceinitial_%d", ii);
897 DBRep::Set(nom1, expr.Current());
898 Standard_Integer jj = 0;
899 const TopTools_ListOfShape& list = Modified(expr.Current());
900 TopTools_ListIteratorOfListOfShape ite(list);
901 for(; ite.More(); ite.Next()) {
902 jj++;
903 sprintf(nom2, "facemodifie_%d_%d", ii, jj);
904 DBRep::Set(nom2, ite.Value());
905 }
906 }
907
908 expr.Init(myWire, TopAbs_EDGE);
909 ii=0;
910 for(; expr.More(); expr.Next()) {
911 ii++;
912 sprintf(nom1, "edgeinitial_%d", ii);
913 DBRep::Set(nom1, expr.Current());
914 Standard_Integer jj = 0;
915 const TopTools_ListOfShape& genf = Generated(expr.Current());
916 TopTools_ListIteratorOfListOfShape ite(genf);
917 for(; ite.More(); ite.Next()) {
918 jj++;
919 sprintf(nom2, "egdegeneree_%d_%d", ii, jj);
920 DBRep::Set(nom2, ite.Value());
921 }
922 }
923*/
924}
925
926//=======================================================================
927//function : Propagate
0d969553
Y
928//purpose : propagation on faces of the initial shape, find
929// faces concerned by the rib
7fd59977 930//=======================================================================
931 Standard_Boolean BRepFeat_MakeLinearForm::Propagate(TopTools_ListOfShape& SliList,
932 const TopoDS_Face& fac,
933 const gp_Pnt& Firstpnt,
934 const gp_Pnt& Lastpnt,
935 Standard_Boolean& falseside)
936{
0797d9d3 937#ifdef OCCT_DEBUG
7fd59977 938 Standard_Boolean trc = BRepFeat_GettraceFEATRIB();
939 if (trc) cout << "BRepFeat_MakeLinearForm::Propagate" << endl;
940#endif
941 gp_Pnt Firstpoint = Firstpnt;
942 gp_Pnt Lastpoint = Lastpnt;
943
944 Standard_Boolean result = Standard_True;
945 TopoDS_Face CurrentFace, saveFace;
946 CurrentFace = TopoDS::Face(SliList.First());
947 saveFace = CurrentFace;
948
949 Standard_Boolean LastOK = Standard_False, FirstOK= Standard_False;
950 Standard_Boolean v1OK = Standard_False, v2OK= Standard_False;
951 TopoDS_Vertex v1, v2, v3, v4, ve1, ve2;
952
953 //modified by NIZNHY-PKV Fri Mar 22 16:50:24 2002 f
954 //BRepAlgo_Section sect (fac, CurrentFace, Standard_False);
955 BRepAlgoAPI_Section sect (fac, CurrentFace, Standard_False);
956 //modified by NIZNHY-PKV Fri Mar 22 16:50:32 2002 t
957
958 sect.Approximation(Standard_True);
959 sect.Build();
960
961 TopExp_Explorer Ex;
962 TopoDS_Edge eb, ec;
963 gp_Pnt p1, p2;
7fd59977 964 Standard_Real t1 = 0., t2 = 0.;
7fd59977 965 Standard_Boolean c1f, c2f, c1l, c2l;
966
967 for (Ex.Init(sect.Shape(), TopAbs_EDGE); Ex.More(); Ex.Next()) {
968 ec = TopoDS::Edge(Ex.Current());
969 v1 = TopExp::FirstVertex(ec,Standard_True);
970 v2 = TopExp::LastVertex(ec,Standard_True);
971 p1 = BRep_Tool::Pnt(v1);
972 p2 = BRep_Tool::Pnt(v2);
973 t1 = BRep_Tool::Tolerance(v1);
974 t2 = BRep_Tool::Tolerance(v2);
975 c1f = p1.Distance(Firstpoint)<=t1;
976 c2f = p2.Distance(Firstpoint)<=t2;
977 c1l = p1.Distance(Lastpoint)<=t1;
978 c2l = p2.Distance(Lastpoint)<=t2;
979 if (c1f || c2f || c1l|| c2l) {
980 eb = ec;
981 if (c1f || c1l) v1OK=Standard_True;
982 if (c2f || c2l) v2OK=Standard_True;
983 if (c1f || c2f) FirstOK=Standard_True;
984 if (c1l || c2l) LastOK=Standard_True;
985 break;
986 }
987 }
988
989 if(eb.IsNull()) {
990 falseside = Standard_False;
991 return Standard_False;
992 }
993 TopTools_ListOfShape thelist;
994 mySlface.Bind(CurrentFace, thelist);
995 mySlface(CurrentFace).Append(eb);
996
997 myListOfEdges.Clear();
998 myListOfEdges.Append(eb);
999
0d969553 1000 // two points are on the same face.
7fd59977 1001 if(LastOK && FirstOK) {
1002 return result;
1003 }
1004
1005 TopTools_IndexedDataMapOfShapeListOfShape mapedges;
1006 TopExp::MapShapesAndAncestors(mySbase, TopAbs_EDGE, TopAbs_FACE, mapedges);
1007 TopExp_Explorer ex;
1008 TopoDS_Edge FirstEdge;
1009 BRep_Builder BB;
1010
1011 TopoDS_Vertex Vprevious;
1012 gp_Pnt ptprev;
96a95605 1013 Standard_Real dp;
7fd59977 1014
1015 while (!(LastOK && FirstOK)) {
1016 if (v1OK) {
1017 Vprevious=v2;
1018 ptprev=p2;
7fd59977 1019 }
1020 else {
1021 Vprevious=v1;
1022 ptprev=p1;
7fd59977 1023 }
1024
0d969553 1025 // find edge connected to v1 or v2:
7fd59977 1026 for (ex.Init(CurrentFace, TopAbs_EDGE); ex.More(); ex.Next()) {
1027 const TopoDS_Edge& rfe = TopoDS::Edge(ex.Current());
1028
1029 BRepExtrema_ExtPC projF(Vprevious, rfe);
1030
1031 if(projF.IsDone() && projF.NbExt() >=1) {
1032 Standard_Real dist2min = RealLast();
1033 Standard_Integer index = 0;
1034 for (Standard_Integer sol =1 ; sol <= projF.NbExt(); sol++) {
1035 if (projF.SquareDistance(sol) <= dist2min) {
1036 index = sol;
1037 dist2min = projF.SquareDistance(sol);
1038 }
1039 }
1040 if (index != 0) {
1041 if (dist2min <= BRep_Tool::Tolerance(rfe) * BRep_Tool::Tolerance(rfe)) {
1042 FirstEdge = rfe;
0d969553
Y
1043 // If the edge is not perpendicular to the plane of the rib
1044 // it is required to set Sliding(result) to false.
7fd59977 1045 if (result) {
1046 result=Standard_False;
1047 ve1 = TopExp::FirstVertex(rfe,Standard_True);
1048 ve2 = TopExp::LastVertex(rfe,Standard_True);
1049 BRepExtrema_ExtPF perp(ve1, fac);
1050 if (perp.IsDone()) {
1051 gp_Pnt pe1=perp.Point(1);
1052 perp.Perform(ve2, fac);
1053 if (perp.IsDone()) {
1054 gp_Pnt pe2=perp.Point(1);
1055 if (pe1.Distance(pe2)<=BRep_Tool::Tolerance(rfe))
1056 result=Standard_True;
1057 }
1058 }
1059 }
1060 break;
1061 }
1062 }
1063 }
1064 }
1065
1066 const TopTools_ListOfShape& L = mapedges.FindFromKey(FirstEdge);
1067 TopTools_ListIteratorOfListOfShape It(L);
1068
1069 for (; It.More(); It.Next()) {
1070 const TopoDS_Face& FF = TopoDS::Face(It.Value());
1071 if (!FF.IsSame(CurrentFace)) {
1072 CurrentFace = FF;
1073 break;
1074 }
1075 }
1076
1077 //modified by NIZNHY-PKV Fri Mar 22 16:50:53 2002 f
1078 //BRepAlgo_Section sectf (fac, CurrentFace, Standard_False);
1079 BRepAlgoAPI_Section sectf (fac, CurrentFace, Standard_False);
1080 //modified by NIZNHY-PKV Fri Mar 22 16:51:03 2002 t
1081 sectf.Approximation(Standard_True);
1082 sectf.Build();
1083
1084 TopoDS_Edge edg1;
1085 for (Ex.Init(sectf.Shape(), TopAbs_EDGE); Ex.More(); Ex.Next()) {
1086 edg1 = TopoDS::Edge(Ex.Current());
1087 v1=TopExp::FirstVertex(edg1,Standard_True);
1088 v2=TopExp::LastVertex(edg1,Standard_True);
1089 t1 = BRep_Tool::Tolerance(v1);
1090 t2 = BRep_Tool::Tolerance(v2);
1091 p1 = BRep_Tool::Pnt(v1);
1092 p2 = BRep_Tool::Pnt(v2);
1093 v1OK = p1.Distance(ptprev)<=t1;
1094 v2OK = p2.Distance(ptprev)<=t2;
1095 if (v1OK || v2OK) break;
1096 }
1097
1098 if (v1OK) {
1099 if (!FirstOK) {
1100 dp = p2.Distance(Firstpoint);
1101 if(dp <= 2*t2) {
1102 FirstOK = Standard_True;
1103 BB.UpdateVertex(v2, dp);
1104 }
1105 }
1106 if (!LastOK) {
1107 dp = p2.Distance(Lastpoint);
1108 if(dp <= 2*t2) {
1109 LastOK = Standard_True;
1110 BB.UpdateVertex(v2, dp);
1111 }
1112 }
1113 }
1114 else if (v2OK) {
1115 if (!FirstOK) {
1116 dp = p1.Distance(Firstpoint);
1117 if(dp <= 2*t1) {
1118 FirstOK = Standard_True;
1119 BB.UpdateVertex(v1, dp);
1120 }
1121 }
1122 if (!LastOK) {
1123 dp = p1.Distance(Lastpoint);
1124 if(dp <= 2*t1) {
1125 LastOK = Standard_True;
1126 BB.UpdateVertex(v1, dp);
1127 }
1128 }
1129 }
1130 else {
0d969553 1131 // end by chaining the section
7fd59977 1132 return Standard_False;
1133 }
7fd59977 1134 TopTools_ListOfShape thelist1;
7fd59977 1135 mySlface.Bind(CurrentFace, thelist1);
1136 mySlface(CurrentFace).Append(edg1);
1137 myListOfEdges.Append(edg1);
1138 }
1139
1140 return result;
1141
1142}
1143
1144//=======================================================================
1145//function : MajMap
0d969553 1146//purpose : management of descendants
7fd59977 1147//=======================================================================
1148
1149static void MajMap(const TopoDS_Shape& theB,
1150 const LocOpe_LinearForm& theP,
1151 TopTools_DataMapOfShapeListOfShape& theMap, // myMap
1152 TopoDS_Shape& theFShape, // myFShape
1153 TopoDS_Shape& theLShape) // myLShape
1154{
1155 TopExp_Explorer exp(theP.FirstShape(),TopAbs_WIRE);
1156 if (exp.More()) {
1157 theFShape = exp.Current();
1158 TopTools_ListOfShape thelist;
1159 theMap.Bind(theFShape, thelist);
1160 for (exp.Init(theP.FirstShape(),TopAbs_FACE);exp.More();exp.Next()) {
1161 theMap(theFShape).Append(exp.Current());
1162 }
1163 }
1164
1165 exp.Init(theP.LastShape(),TopAbs_WIRE);
1166 if (exp.More()) {
1167 theLShape = exp.Current();
1168 TopTools_ListOfShape thelist1;
1169 theMap.Bind(theLShape, thelist1);
1170 for (exp.Init(theP.LastShape(),TopAbs_FACE);exp.More();exp.Next()) {
1171 theMap(theLShape).Append(exp.Current());
1172 }
1173 }
1174
1175 for (exp.Init(theB,TopAbs_EDGE); exp.More(); exp.Next()) {
1176 if (!theMap.IsBound(exp.Current())) {
7fd59977 1177 TopTools_ListOfShape thelist2;
1178 theMap.Bind(exp.Current(), thelist2);
1179 theMap(exp.Current()) = theP.Shapes(exp.Current());
1180 }
1181 }
1182}
1183
1184//=======================================================================
1185//function : SetGluedFaces
0d969553 1186//purpose : management of faces of gluing
7fd59977 1187//=======================================================================
1188
1189static void SetGluedFaces(const TopTools_DataMapOfShapeListOfShape& theSlmap,
1190 LocOpe_LinearForm& thePrism,
1191 TopTools_DataMapOfShapeShape& theMap)
1192{
0d969553 1193 // Slidings
7fd59977 1194 TopTools_DataMapIteratorOfDataMapOfShapeListOfShape itm(theSlmap);
1195 if(!theSlmap.IsEmpty()) {
1196 for (; itm.More(); itm.Next()) {
1197 const TopoDS_Face& fac = TopoDS::Face(itm.Key());
1198 const TopTools_ListOfShape& ledg = itm.Value();
1199 TopTools_ListIteratorOfListOfShape it;
1200 for (it.Initialize(ledg); it.More(); it.Next()) {
1201 const TopTools_ListOfShape& gfac = thePrism.Shapes(it.Value());
1202 if (gfac.Extent() != 1) {
0797d9d3 1203#ifdef OCCT_DEBUG
7fd59977 1204 cout << "Pb SetGluedFace" << endl;
1205#endif
1206 }
1207 theMap.Bind(gfac.First(),fac);
1208 }
1209 }
1210 }
1211}
1212