Salome HOME
Update patch for OCCT - add fix for issue 22187 (OCC23903)
[tools/install.git] / config_files / patches / OCCT-6.5.5.patch
1 diff --git a/src/BOPTools/BOPTools_Tools3D_1.cxx b/src/BOPTools/BOPTools_Tools3D_1.cxx
2 index e235c47..9913925 100755
3 --- a/src/BOPTools/BOPTools_Tools3D_1.cxx
4 +++ b/src/BOPTools/BOPTools_Tools3D_1.cxx
5 @@ -26,36 +26,73 @@
6  #include <gp_Pnt2d.hxx>
7  #include <gp_Vec2d.hxx>
8  #include <gp_Dir2d.hxx>
9 -
10  #include <gp_Dir.hxx>
11  #include <gp_Vec.hxx>
12  
13 +#include <Poly_Triangulation.hxx>
14 +
15  #include <Geom2d_Curve.hxx>
16 +#include <Geom2d_Line.hxx>
17 +
18  #include <Geom_Curve.hxx>
19  #include <Geom_Surface.hxx>
20  
21  #include <GeomAdaptor_Surface.hxx>
22  #include <GeomAPI_ProjectPointOnSurf.hxx>
23  
24 +#include <Geom2dHatch_Hatcher.hxx>
25 +#include <HatchGen_Domain.hxx>
26 +
27  #include <BRepTools.hxx>
28  #include <BRepClass3d_SolidClassifier.hxx>
29  
30  #include <BRep_Tool.hxx>
31  #include <BRepAdaptor_Surface.hxx>
32  
33 -#include <TopTools_ListIteratorOfListOfShape.hxx>
34 +
35  #include <TopExp_Explorer.hxx>
36  #include <TopoDS.hxx>
37 +#include <TopoDS_Iterator.hxx>
38 +
39  #include <TopTools_ListOfShape.hxx>
40 +#include <TopTools_IndexedMapOfShape.hxx>
41 +#include <TopTools_ListIteratorOfListOfShape.hxx>
42 +
43 +#include <BRep_TVertex.hxx>
44 +#include <BRep_ListIteratorOfListOfPointRepresentation.hxx>
45 +#include <BRep_PointRepresentation.hxx>
46 +#include <BRep_TEdge.hxx>
47 +#include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
48 +#include <BRep_CurveRepresentation.hxx>
49 +#include <BRep_TFace.hxx>
50 +#include <BRep_Builder.hxx>
51  
52  #include <BOPTools_Tools2D.hxx>
53  
54 -static Standard_Boolean CheckPointInside(BRepClass3d_SolidClassifier& aSolidClassifier,
55 -                                         const gp_Pnt& aP3d,
56 -                                         const Standard_Real aTolerance,
57 -                                         const Handle(IntTools_Context)& theContext,
58 -                                         TopAbs_State& aState,
59 -                                         Standard_Boolean& bFoundInFacePoint);
60 +#include <IntTools_Tools.hxx>
61 +
62 +
63 +static 
64 +  Standard_Boolean HasGeometry(const TopoDS_Shape& aS);
65 +
66 +static
67 +  void Add(const TopoDS_Shape& aS,
68 +          TopTools_IndexedMapOfShape& myShapes, 
69 +          Standard_Boolean& bHasGeometry);
70 +
71 +static 
72 +  Standard_Boolean CheckPointInside(BRepClass3d_SolidClassifier& aSolidClassifier,
73 +                                   const gp_Pnt& aP3d,
74 +                                   const Standard_Real aTolerance,
75 +                                   const Handle(IntTools_Context)& theContext,
76 +                                   TopAbs_State& aState,
77 +                                   Standard_Boolean& bFoundInFacePoint);
78 +static
79 +  Standard_Integer PntInFace(const TopoDS_Face& aF,
80 +                            const Handle(IntTools_Context)& theContext,
81 +                            gp_Pnt& theP,
82 +                            gp_Pnt2d& theP2D);
83 +
84  
85  //=======================================================================
86  //function : GetApproxNormalToFaceOnEdge
87 @@ -135,10 +172,8 @@ void BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (const TopoDS_Edge& aE,
88        aFTol=aETol;
89      }
90    }
91 -  //modified by NIZNHY-PKV Thu Mar 19 14:15:15 2009f
92    if( aETol > 1.e-5 || aFTol > 1.e-5 ) {
93    //if( aETol > 1.e-5 && aFTol > 1.e-5 ) {
94 -    //modified by NIZNHY-PKV Thu Mar 19 14:15:24 2009t
95      //pkv/103/D7
96      if(aTS!=GeomAbs_Sphere) {
97        gp_Vec2d transVec( aDP );
98 @@ -627,25 +662,7 @@ void BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (const TopoDS_Edge& aE,
99  } 
100  
101  
102 -#include <TopTools_IndexedMapOfShape.hxx>
103 -#include <TopoDS_Iterator.hxx>
104 -#include <BRep_TVertex.hxx>
105 -#include <BRep_ListIteratorOfListOfPointRepresentation.hxx>
106 -#include <BRep_PointRepresentation.hxx>
107 -#include <BRep_TEdge.hxx>
108 -#include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
109 -#include <BRep_CurveRepresentation.hxx>
110 -#include <BRep_TFace.hxx>
111 -#include <Poly_Triangulation.hxx>
112 -#include <BRep_Builder.hxx>
113 -
114 -static 
115 -  Standard_Boolean HasGeometry(const TopoDS_Shape& aS);
116  
117 -static
118 -  void Add(const TopoDS_Shape& aS,
119 -          TopTools_IndexedMapOfShape& myShapes, 
120 -          Standard_Boolean& bHasGeometry);
121  
122  //=======================================================================
123  //function : IsEmptyShape
124 @@ -975,7 +992,7 @@ Standard_Boolean BOPTools_Tools3D::ComputeFaceState(const TopoDS_Face&  theFace,
125    return Standard_True;
126  }
127  
128 -//modified by NIZNHY-PKV Thu Sep 22 10:55:14 2011f
129 +
130  // ===========================================================================================
131  // function: CheckSameDomainFaceInside
132  // purpose: Check if distance between several points of theFace1 and
133 @@ -986,7 +1003,7 @@ Standard_Boolean BOPTools_Tools3D::CheckSameDomainFaceInside(const TopoDS_Face&
134                                                              const Handle(IntTools_Context)& theContext) 
135  {
136    Standard_Boolean bFoundON, bPointInFace; 
137 -  Standard_Integer nbpoints, i, j;
138 +  Standard_Integer nbpoints, i, j, iErr;
139    Standard_Real umin, umax, vmin, vmax, aTol, adeltau, adeltav, U, V, U2, V2, aD, aTolE;
140    gp_Pnt2d aP2D;
141    gp_Pnt aP3D; 
142 @@ -1037,9 +1054,35 @@ Standard_Boolean BOPTools_Tools3D::CheckSameDomainFaceInside(const TopoDS_Face&
143        }
144      }
145    }
146 +  //
147 +  if (bFoundON) {
148 +    return bFoundON;
149 +  }
150 +  //
151 +  iErr=PntInFace(theFace1, theContext, aP3D, aP2D);
152 +  if (iErr) {
153 +    return bFoundON;
154 +  }
155 +  //
156 +  aProjector.Perform(aP3D);
157 +  if(aProjector.IsDone()) {
158 +    aD=aProjector.LowerDistance();
159 +    if(aD > aTol) {
160 +      return bFoundON;
161 +    }
162 +    // 
163 +    aProjector.LowerDistanceParameters(U2, V2);
164 +    aP2D.SetCoord(U2, V2);
165 +    //
166 +    bPointInFace=theContext->IsPointInFace(theFace2, aP2D);
167 +    if (bPointInFace) {
168 +      bFoundON = Standard_True;
169 +    }
170 +  }
171 +  //
172    return bFoundON;
173  }
174 -//modified by NIZNHY-PKV Thu Sep 22 10:55:19 2011t
175 +
176  
177  // ===========================================================================================
178  // function: CheckPointInside
179 @@ -1089,3 +1132,88 @@ Standard_Boolean CheckPointInside(BRepClass3d_SolidClassifier& aSolidClassifier,
180  
181    return bFoundValidPoint;
182  }
183 +
184 +//=======================================================================
185 +//function : PntInFace
186 +//purpose  :
187 +//=======================================================================
188 +Standard_Integer PntInFace(const TopoDS_Face& aF,
189 +                          const Handle(IntTools_Context)& aCtx,
190 +                          gp_Pnt& theP,
191 +                          gp_Pnt2d& theP2D)
192 +{
193 +  Standard_Boolean bIsDone, bHasFirstPoint, bHasSecondPoint;
194 +  Standard_Integer iErr, aIx, aNbDomains, i;
195 +  Standard_Real aUMin, aUMax, aVMin, aVMax;
196 +  Standard_Real aVx, aUx, aV1, aV2;
197 +  gp_Dir2d aD2D (0., 1.);
198 +  gp_Pnt2d aP2D;
199 +  gp_Pnt aPx;
200 +  Handle(Geom2d_Line) aL2D;
201 +  Handle(Geom_Surface) aS;
202 +  //
203 +  iErr=0;
204 +  //
205 +  aS=BRep_Tool::Surface(aF);
206 +  BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax);
207 +  //
208 +  // 1
209 +  aUx=IntTools_Tools::IntermediatePoint(aUMin, aUMax);
210 +  aP2D.SetCoord(aUx, 0.);
211 +  aL2D=new Geom2d_Line (aP2D, aD2D);
212 +  Geom2dAdaptor_Curve aHCur(aL2D);
213 +  //
214 +  Geom2dHatch_Hatcher& aHatcher=aCtx->Hatcher(aF);
215 +  aIx=aHatcher.AddHatching(aHCur) ;
216 +  //
217 +  // 2.
218 +  aHatcher.Trim();
219 +  bIsDone=aHatcher.TrimDone(aIx);
220 +  if (!bIsDone) {
221 +    aHatcher.RemHatching(aIx);
222 +    iErr=3;
223 +    return iErr;
224 +  }
225 +  //
226 +  aHatcher.ComputeDomains(aIx);
227 +  bIsDone=aHatcher.IsDone(aIx);
228 +  if (!bIsDone) {
229 +    aHatcher.RemHatching(aIx);
230 +    iErr=4;
231 +    return iErr;
232 +  }
233 +  //
234 +  // 3.
235 +  aNbDomains=aHatcher.NbDomains(aIx);
236 +  for (i=1; i<=aNbDomains; ++i) {
237 +    const HatchGen_Domain& aDomain=aHatcher.Domain (aIx, i) ;
238 +    bHasFirstPoint=aDomain.HasFirstPoint();
239 +    if (!bHasFirstPoint) {
240 +      iErr=5;
241 +      break;
242 +    }
243 +    //
244 +    aV1=aDomain.FirstPoint().Parameter();
245 +    //
246 +    bHasSecondPoint=aDomain.HasSecondPoint();
247 +    if (!bHasSecondPoint) {
248 +      aHatcher.RemHatching(aIx);
249 +      iErr=6;
250 +      break;
251 +    }
252 +    //
253 +    aV2=aDomain.SecondPoint().Parameter();
254 +    aVx=IntTools_Tools::IntermediatePoint(aV1, aV2);
255 +    break;
256 +  }
257 +  //
258 +  if (!iErr) {
259 +    aS->D0(aUx, aVx, aPx);
260 +    //
261 +    theP2D.SetCoord(aUx, aVx);
262 +    theP=aPx;
263 +    //
264 +  }
265 +  aHatcher.RemHatching(aIx);
266 +  return iErr;
267 +}
268 diff --git a/src/BRepFill/BRepFill_Pipe.cxx b/src/BRepFill/BRepFill_Pipe.cxx
269 index 7eda5c1..63e3824 100755
270 --- a/src/BRepFill/BRepFill_Pipe.cxx
271 +++ b/src/BRepFill/BRepFill_Pipe.cxx
272 @@ -823,13 +823,7 @@ TopoDS_Shape BRepFill_Pipe::ShareFaces
273        anExp.Init(myFaces->Value(ii, jj), TopAbs_EDGE);
274    
275        for (; anExp.More(); anExp.Next()) {
276 -        if (aMapBndEdgeIndex.IsBound(anExp.Current())) {
277 -          // This is not boundary edge. Remove it.
278 -          aMapBndEdgeIndex.UnBind(anExp.Current());
279 -        } else {
280 -          // Add boundary edge.
281 -          aMapBndEdgeIndex.Bind(anExp.Current(), ii);
282 -        }
283 +        aMapBndEdgeIndex.Bind(anExp.Current(), ii);
284        }
285      }
286  
287 diff --git a/src/BRepFill/BRepFill_Sweep.cxx b/src/BRepFill/BRepFill_Sweep.cxx
288 index f9ceeca..d1fbf4b 100755
289 --- a/src/BRepFill/BRepFill_Sweep.cxx
290 +++ b/src/BRepFill/BRepFill_Sweep.cxx
291 @@ -2042,143 +2042,141 @@ BRepFill_Sweep::BRepFill_Sweep(const Handle(BRepFill_SectionLaw)& Section,
292    Standard_Boolean exuv, singu, singv;
293    Handle(Geom_Surface) S;
294  
295 -  if (! vclose) {
296 -    // (2.0) return preexisting Edges and vertices
297 -    TopoDS_Edge E;
298 -    if (! FirstShape.IsNull() && (IFirst==1)) {
299 -      mySec->Init(FirstShape);
300 -      for (isec=1; isec<=NbLaw; isec++) {
301 -       E = mySec->CurrentEdge();
302 -       VEdge(isec, 1) = E;
303 -        if (E.Orientation() == TopAbs_REVERSED)
304 -          Vertex(isec+1, 1) = TopExp::FirstVertex(E);
305 -        else 
306 -          Vertex(isec+1, 1) =  TopExp::LastVertex(E);
307 -       UpdateVertex(IFirst-1, isec+1, 
308 -                    TabErr(isec, 1), Vi(1),  Vertex(isec+1, 1));
309 -       }
310 -      if (VEdge(1, 1).Orientation() == TopAbs_REVERSED)
311 -       Vertex(1, 1) =  TopExp::LastVertex(TopoDS::Edge(VEdge(1, 1)));
312 -      else
313 -       Vertex(1, 1) = TopExp::FirstVertex(TopoDS::Edge(VEdge(1, 1)));
314 -      UpdateVertex(IFirst-1, 1, 
315 -                  TabErr(1, 1), Vi(1),  Vertex(1, 1));
316 -    }
317 -    else { // Otherwise construct vertices
318 -      Standard_Real u, v, aux;
319 -      Standard_Boolean ureverse;
320 -      for (isec=1; isec<=NbLaw+1; isec++) {
321 -       // Return data
322 -       if (isec >NbLaw) {
323 -         S = TabS(NbLaw, 1);
324 -         ureverse = UReverse(NbLaw, 1);
325 -         exuv = ExchUV(NbLaw, 1);
326 -       }
327 -       else  {
328 -         S = TabS(isec, 1);
329 -         ureverse = UReverse(isec, 1);
330 -         exuv = ExchUV(isec, 1);
331 -       }
332 -       S->Bounds(UFirst, ULast, VFirst, VLast);
333 -
334 -       // Choice of parameters
335 -       if (ureverse) {
336 -         if (exuv) {
337 -           aux = VFirst; VFirst = VLast; VLast = aux;    
338 -         }
339 -         else {
340 -           aux = UFirst; UFirst = ULast; ULast = aux;
341 -         }
342 -       }
343 -       if (isec!= NbLaw+1) {
344 -         u = UFirst;
345 -         v = VFirst;
346 -       }
347 -       else {
348 -         if (exuv) {
349 -           u = UFirst;
350 -           v = VLast;
351 -         }
352 -         else {
353 -           u = ULast;
354 -           v = VFirst;
355 -         }
356 -       }
357 -
358 -       // construction of vertices
359 -       B.MakeVertex(TopoDS::Vertex(Vertex(isec, 1)), 
360 -                    S->Value(u,v), 
361 -                    mySec->VertexTol(isec-1,Vi(1)));
362 +  // (2.0) return preexisting Edges and vertices
363 +  TopoDS_Edge E;
364 +  if (! FirstShape.IsNull() && (IFirst==1)) {
365 +    mySec->Init(FirstShape);
366 +    for (isec=1; isec<=NbLaw; isec++) {
367 +      E = mySec->CurrentEdge();
368 +      VEdge(isec, 1) = E;
369 +      if (E.Orientation() == TopAbs_REVERSED)
370 +        Vertex(isec+1, 1) = TopExp::FirstVertex(E);
371 +      else 
372 +        Vertex(isec+1, 1) =  TopExp::LastVertex(E);
373 +      UpdateVertex(IFirst-1, isec+1, 
374 +                   TabErr(isec, 1), Vi(1),  Vertex(isec+1, 1));
375 +    }
376 +    if (VEdge(1, 1).Orientation() == TopAbs_REVERSED)
377 +      Vertex(1, 1) =  TopExp::LastVertex(TopoDS::Edge(VEdge(1, 1)));
378 +    else
379 +      Vertex(1, 1) = TopExp::FirstVertex(TopoDS::Edge(VEdge(1, 1)));
380 +    UpdateVertex(IFirst-1, 1, 
381 +                 TabErr(1, 1), Vi(1),  Vertex(1, 1));
382 +  }
383 +  else { // Otherwise construct vertices
384 +    Standard_Real u, v, aux;
385 +    Standard_Boolean ureverse;
386 +    for (isec=1; isec<=NbLaw+1; isec++) {
387 +      // Return data
388 +      if (isec >NbLaw) {
389 +        S = TabS(NbLaw, 1);
390 +        ureverse = UReverse(NbLaw, 1);
391 +        exuv = ExchUV(NbLaw, 1);
392        }
393 -   }
394 +      else {
395 +        S = TabS(isec, 1);
396 +        ureverse = UReverse(isec, 1);
397 +        exuv = ExchUV(isec, 1);
398 +      }
399 +      S->Bounds(UFirst, ULast, VFirst, VLast);
400  
401 -    if (! LastShape.IsNull() && (ILast==myLoc->NbLaw()+1) ) {
402 -      mySec->Init(LastShape);
403 -      for (isec=1; isec<=NbLaw; isec++) {
404 -       E = mySec->CurrentEdge();
405 -       VEdge(isec, NbPath+1) = E;
406 -       if (E.Orientation() == TopAbs_REVERSED)
407 -          Vertex(isec+1, NbPath+1) = TopExp::FirstVertex(E);
408 -       else 
409 -         Vertex(isec+1, NbPath+1) = TopExp::LastVertex(E);
410 -       UpdateVertex(ILast-1, isec+1, TabErr(isec, NbPath), 
411 -                    Vi(NbPath+1),  Vertex(isec+1, NbPath+1));
412 +      // Choice of parameters
413 +      if (ureverse) {
414 +        if (exuv) {
415 +          aux = VFirst; VFirst = VLast; VLast = aux;     
416 +        }
417 +        else {
418 +          aux = UFirst; UFirst = ULast; ULast = aux;
419 +        }
420 +      }
421 +      if (isec!= NbLaw+1) {
422 +        u = UFirst;
423 +        v = VFirst;
424 +      }
425 +      else {
426 +        if (exuv) {
427 +          u = UFirst;
428 +          v = VLast;
429 +        }
430 +        else {
431 +          u = ULast;
432 +          v = VFirst;
433 +        }
434        }
435 -      if (VEdge(1,  NbPath+1).Orientation() == TopAbs_REVERSED)
436 -       Vertex(1,  NbPath+1) =  
437 -         TopExp::LastVertex(TopoDS::Edge(VEdge(1,  NbPath+1)));
438 -      else
439 -       Vertex(1,  NbPath+1) = 
440 -         TopExp::FirstVertex(TopoDS::Edge(VEdge(1, NbPath+1)));
441 -      UpdateVertex(ILast-1, 1, 
442 -                  TabErr(1, NbPath), Vi(NbPath+1),  Vertex(1, NbPath+1 ));
443 -    }    
444 -    else {
445 -      Standard_Real u, v, aux;
446 -      Standard_Boolean ureverse;
447 -      for (isec=1; isec<=NbLaw+1; isec++) {
448 -       // Return data
449 -       if (isec >NbLaw) {
450 -         S = TabS(NbLaw, NbPath);
451 -         ureverse = UReverse(NbLaw, NbPath);
452 -         exuv = ExchUV(NbLaw, NbPath);
453 -       }
454 -       else  {
455 -         S = TabS(isec, NbPath);
456 -         ureverse = UReverse(isec, NbPath);
457 -         exuv = ExchUV(isec, NbPath);
458 -       }
459 -       S->Bounds(UFirst, ULast, VFirst, VLast);
460  
461 -       // Choice of parametres
462 -       if (ureverse) {
463 -         if (exuv) {
464 -           aux = VFirst; VFirst = VLast; VLast = aux;    
465 -         }
466 -         else {
467 -           aux = UFirst; UFirst = ULast; ULast = aux;
468 -         }
469 -       }
470 -       if (isec == NbLaw+1) {
471 -         u = ULast;
472 -         v = VLast;
473 -       }
474 -       else {
475 -         if (exuv) {
476 -           u = ULast;
477 -           v = VFirst;
478 -         }
479 -         else {
480 -           u = UFirst;
481 -           v = VLast;
482 -         }
483 -       }
484 +      // construction of vertices
485 +      B.MakeVertex(TopoDS::Vertex(Vertex(isec, 1)), 
486 +                   S->Value(u,v), 
487 +                   mySec->VertexTol(isec-1,Vi(1)));
488 +    }
489 +  }
490  
491 -       // construction of vertex
492 -       B.MakeVertex(TopoDS::Vertex(Vertex(isec, NbPath+1)), 
493 -                    S->Value(u,v), 
494 -                    mySec->VertexTol(isec-1, Vi(NbPath+1)));
495 +  if (! LastShape.IsNull() && (ILast==myLoc->NbLaw()+1) ) {
496 +    mySec->Init(LastShape);
497 +    for (isec=1; isec<=NbLaw; isec++) {
498 +      E = mySec->CurrentEdge();
499 +      VEdge(isec, NbPath+1) = E;
500 +      if (E.Orientation() == TopAbs_REVERSED)
501 +        Vertex(isec+1, NbPath+1) = TopExp::FirstVertex(E);
502 +      else 
503 +        Vertex(isec+1, NbPath+1) = TopExp::LastVertex(E);
504 +      UpdateVertex(ILast-1, isec+1, TabErr(isec, NbPath), 
505 +                   Vi(NbPath+1),  Vertex(isec+1, NbPath+1));
506 +    }
507 +    if (VEdge(1,  NbPath+1).Orientation() == TopAbs_REVERSED)
508 +      Vertex(1,  NbPath+1) =  
509 +        TopExp::LastVertex(TopoDS::Edge(VEdge(1,  NbPath+1)));
510 +    else
511 +      Vertex(1,  NbPath+1) = 
512 +        TopExp::FirstVertex(TopoDS::Edge(VEdge(1, NbPath+1)));
513 +    UpdateVertex(ILast-1, 1, 
514 +                 TabErr(1, NbPath), Vi(NbPath+1),  Vertex(1, NbPath+1 ));
515 +  }    
516 +  else {
517 +    Standard_Real u, v, aux;
518 +    Standard_Boolean ureverse;
519 +    for (isec=1; isec<=NbLaw+1; isec++) {
520 +      // Return data
521 +      if (isec >NbLaw) {
522 +        S = TabS(NbLaw, NbPath);
523 +        ureverse = UReverse(NbLaw, NbPath);
524 +        exuv = ExchUV(NbLaw, NbPath);
525        }
526 +      else {
527 +        S = TabS(isec, NbPath);
528 +        ureverse = UReverse(isec, NbPath);
529 +        exuv = ExchUV(isec, NbPath);
530 +      }
531 +      S->Bounds(UFirst, ULast, VFirst, VLast);
532 +
533 +      // Choice of parametres
534 +      if (ureverse) {
535 +        if (exuv) {
536 +          aux = VFirst; VFirst = VLast; VLast = aux;     
537 +        }
538 +        else {
539 +          aux = UFirst; UFirst = ULast; ULast = aux;
540 +        }
541 +      }
542 +      if (isec == NbLaw+1) {
543 +        u = ULast;
544 +        v = VLast;
545 +      }
546 +      else {
547 +        if (exuv) {
548 +          u = ULast;
549 +          v = VFirst;
550 +        }
551 +        else {
552 +          u = UFirst;
553 +          v = VLast;
554 +        }
555 +      }
556 +
557 +      // construction of vertex
558 +      B.MakeVertex(TopoDS::Vertex(Vertex(isec, NbPath+1)), 
559 +                   S->Value(u,v), 
560 +                   mySec->VertexTol(isec-1, Vi(NbPath+1)));
561      }
562    }
563  
564 diff --git a/src/Draft/Draft_Modification.cxx b/src/Draft/Draft_Modification.cxx
565 index e72fe8d..6033694 100755
566 --- a/src/Draft/Draft_Modification.cxx
567 +++ b/src/Draft/Draft_Modification.cxx
568 @@ -58,6 +58,7 @@
569  #include <Precision.hxx>
570  
571  #include <BRep_Builder.hxx>
572 +#include <BRepTools.hxx>
573  
574  //=======================================================================
575  //function : Draft_Modification
576 @@ -422,23 +423,34 @@ Standard_Boolean Draft_Modification::NewCurve2d(const TopoDS_Edge& E,
577               (typs == STANDARD_TYPE(Geom_ConicalSurface));
578  
579    if ( JeRecadre) {
580 -    gp_Pnt2d PF,PL;
581 -    BRep_Tool::UVPoints(E,F,PF,PL);
582 -    gp_Pnt2d NewPF = C->Value(Fp);
583 -    gp_Vec2d vectra(2.*M_PI,0.);
584 -
585 -    if (NewPF.Translated(vectra).SquareDistance(PF) 
586 -       < NewPF.SquareDistance(PF)) {
587 -      C->Translate(vectra);
588 -      
589 +    Standard_Boolean bTranslate;
590 +    Standard_Real aD2, aT1, aT2;
591 +    gp_Pnt2d  PF, NewPF, aP2DT;
592 +    gp_Vec2d aV2DT, vectra(2.*M_PI,0.);
593 +    Handle(Geom2d_Curve) aC2DE;
594 +    //
595 +    aC2DE=BRep_Tool::CurveOnSurface(E, F, aT1, aT2);
596 +    //
597 +    PF=aC2DE->Value(0.5*(aT1+aT2));
598 +    //
599 +    NewPF=C->Value(0.5*(Fp+Lp));
600 +    //
601 +    aD2=NewPF.SquareDistance(PF);
602 +    //
603 +    bTranslate=Standard_False;
604 +    if (NewPF.Translated(vectra).SquareDistance(PF) < aD2) {
605 +      aV2DT=vectra;
606 +      bTranslate=!bTranslate; //True
607      }
608 -    else if (NewPF.Translated(-vectra).SquareDistance(PF) 
609 -            < NewPF.SquareDistance(PF)) {
610 -      C->Translate(-vectra);
611 -      
612 +    else if (NewPF.Translated(-vectra).SquareDistance(PF) < aD2) {
613 +      aV2DT=-vectra;
614 +      bTranslate=!bTranslate; //True
615 +    }
616 +    //
617 +    if (bTranslate) {
618 +      C->Translate(aV2DT);
619      }
620    }
621 -
622    return Standard_True;
623  }
624  
625 diff --git a/src/IntTools/IntTools_LineConstructor.cxx b/src/IntTools/IntTools_LineConstructor.cxx
626 index b88f063..984530e 100755
627 --- a/src/IntTools/IntTools_LineConstructor.cxx
628 +++ b/src/IntTools/IntTools_LineConstructor.cxx
629 @@ -735,6 +735,7 @@ void IntTools_LineConstructor::TreatCircle(const Handle(IntPatch_Line)& aLine,
630      return;
631    }
632    //----------------------------------------
633 +  Standard_Boolean bFound;
634    Standard_Integer aNbVtx, aNbVtxWas, i;
635    Standard_Real aTolPC, aT, aT1, aT2, aTmid, aTwoPI, aTolPC1;
636    Standard_Real aU1, aV1, aU2, aV2;
637 @@ -747,6 +748,7 @@ void IntTools_LineConstructor::TreatCircle(const Handle(IntPatch_Line)& aLine,
638    aTwoPI=M_PI+M_PI;
639    aTolPC=Precision::PConfusion();
640    aNbVtxWas=GeomInt_LineTool::NbVertex(aLine);
641 +  
642    aNbVtx=aNbVtxWas+2;
643    //-------------------------------------2
644    aTS1=myHS1->GetType();
645 @@ -761,7 +763,7 @@ void IntTools_LineConstructor::TreatCircle(const Handle(IntPatch_Line)& aLine,
646    pVtx=new IntTools_RealWithFlag [aNbVtx];
647    //
648    pVtx[0].SetValue(0.);
649 -  pVtx[1].SetValue(2.*M_PI);
650 +  pVtx[1].SetValue(aTwoPI);
651    //
652    for(i=1; i<=aNbVtxWas; ++i) {
653      aT=GeomInt_LineTool::Vertex(aLine, i).ParameterOnLine();
654 @@ -775,6 +777,27 @@ void IntTools_LineConstructor::TreatCircle(const Handle(IntPatch_Line)& aLine,
655    //
656    RejectDuplicates(aNbVtx, pVtx, aTolPC);
657    //
658 +  if ((aType==IntPatch_Circle || aType==IntPatch_Ellipse)&& aNbVtx>2) { // zz
659 +    bFound=Standard_False;
660 +    for(i=1; i<=aNbVtxWas; ++i) {
661 +      aT=GeomInt_LineTool::Vertex(aLine, i).ParameterOnLine();
662 +      if (fabs(aT) < aTolPC1 || fabs(aT-aTwoPI) < aTolPC1) {
663 +       bFound=!bFound;
664 +       break;
665 +      }
666 +    }
667 +    if (!bFound) {
668 +      aT=pVtx[1].Value()+aTwoPI;
669 +      pVtx[aNbVtx-1].SetValue(aT);
670 +      //
671 +      for(i=0; i<aNbVtx; ++i) { 
672 +       aT=pVtx[i+1].Value();
673 +       pVtx[i].SetValue(aT);
674 +      }
675 +      --aNbVtx;
676 +    }
677 +  }
678 +  //
679    for(i=0; i<aNbVtx-1; ++i) { 
680      aT1=pVtx[i].Value();
681      aT2=pVtx[i+1].Value();
682 diff --git a/tests/boolean/bopcommon_complex/C5 b/tests/boolean/bopcommon_complex/C5
683 old mode 100644
684 new mode 100755
685 index c174e8b..d2cd9ea
686 --- a/tests/boolean/bopcommon_complex/C5
687 +++ b/tests/boolean/bopcommon_complex/C5
688 @@ -1,3 +1,7 @@
689 +puts "TODO ?OCC23823 All: An exception was caught"
690 +puts "TODO ?OCC23823 All: \\*\\* Exception \\*\\*"
691 +puts "TODO ?OCC23823 All: TEST INCOMPLETE"
692 +
693  cpulimit 3600
694  restore [locate_data_file BUC60937.brep] sh
695  explode sh
696 diff --git a/tests/boolean/bopcommon_complex/C9 b/tests/boolean/bopcommon_complex/C9
697 old mode 100644
698 new mode 100755
699 index c174e8b..d2cd9ea
700 --- a/tests/boolean/bopcommon_complex/C9
701 +++ b/tests/boolean/bopcommon_complex/C9
702 @@ -1,3 +1,7 @@
703 +puts "TODO ?OCC23823 All: An exception was caught"
704 +puts "TODO ?OCC23823 All: \\*\\* Exception \\*\\*"
705 +puts "TODO ?OCC23823 All: TEST INCOMPLETE"
706 +
707  cpulimit 3600
708  restore [locate_data_file BUC60937.brep] sh
709  explode sh
710 diff --git a/tests/boolean/bopcommon_complex/D5 b/tests/boolean/bopcommon_complex/D5
711 old mode 100644
712 new mode 100755
713 index f899d4c..4b50e24
714 --- a/tests/boolean/bopcommon_complex/D5
715 +++ b/tests/boolean/bopcommon_complex/D5
716 @@ -1,3 +1,7 @@
717 +puts "TODO ?OCC23823 All: An exception was caught"
718 +puts "TODO ?OCC23823 All: \\*\\* Exception \\*\\*"
719 +puts "TODO ?OCC23823 All: TEST INCOMPLETE"
720 +
721  cpulimit 3600
722  restore [locate_data_file BUC60936.brep] sh
723  explode sh
724 diff --git a/tests/bugs/modalg/bug23823 b/tests/bugs/modalg/bug23823
725 new file mode 100755
726 index 0000000..bd6183d
727 --- /dev/null
728 +++ b/tests/bugs/modalg/bug23823
729 @@ -0,0 +1,39 @@
730 +puts "============"
731 +puts "OCC23823"
732 +puts "============"
733 +puts ""
734 +#######################################################################
735 +# The result of section operation contains redundant vertex.
736 +#######################################################################
737 +
738 +set BugNumber OCC23823
739 +
740 +restore [locate_data_file bug23823_SAS_MAT_rota.brep] b1
741 +restore [locate_data_file bug23823_cylindre_ext.brep] b2
742 +
743 +explode b1 f
744 +explode b2 f
745 +
746 +copy b1_3 b1
747 +copy b2_1 b2
748 +
749 +bop b1 b2
750 +bopsection result
751 +
752 +set nb_v_good 2
753 +set nb_e_good 1
754 +set nb_w_good 0
755 +set nb_f_good 0
756 +set nb_sh_good 0
757 +set nb_sol_good 0
758 +set nb_compsol_good 0
759 +set nb_compound_good  1
760 +set nb_shape_good 4
761 +
762 +set nb_info [nbshapes result]
763 +
764 +# Service parameters
765 +set mass -0.1
766 +set m -0.1
767 +
768 +set 2dviewer 1
769 diff --git a/tests/bugs/modalg/bug23826 b/tests/bugs/modalg/bug23826
770 new file mode 100755
771 index 0000000..197df57
772 --- /dev/null
773 +++ b/tests/bugs/modalg/bug23826
774 @@ -0,0 +1,17 @@
775 +puts "============"
776 +puts "CR23826"
777 +puts "============"
778 +puts ""
779 +#########################################################
780 +## Boolean Common between two soids fails
781 +#########################################################
782 +
783 +restore [locate_data_file bug23826_Carte.brep] b1
784 +restore [locate_data_file bug23826_Use140.brep] b2
785 +
786 +bop b1 b2
787 +bopcommon result
788 +
789 +set square 6.51574
790 +
791 +set 2dviewer 1
792 diff --git a/tests/bugs/modalg/bug23903 b/tests/bugs/modalg/bug23903
793 new file mode 100644
794 index 0000000..f5c3f76
795 --- /dev/null
796 +++ b/tests/bugs/modalg/bug23903
797 @@ -0,0 +1,21 @@
798 +puts "========"
799 +puts "OCC23903"
800 +puts "========"
801 +########################################################
802 +# Invalid result of pipe operation on closed path
803 +########################################################
804 +
805 +restore [locate_data_file bug23903_base.brep] sh
806 +restore [locate_data_file bug23903_path.brep] w
807 +pipe result w sh
808 +set info [explode result f]
809 +set checklen [llength $info]
810 +
811 +if { $checklen != 3 } {
812 +    puts "Error : The shape doesn't contain 3 faces"
813 +} else {
814 +    puts "OK : The shape contains 3 faces"
815 +}
816 +
817 +set 2dviewer 0
818 +
819 diff --git a/tests/draft/angle/E5 b/tests/draft/angle/E5
820 old mode 100644
821 new mode 100755
822 index c6077e5..153e19a
823 --- a/tests/draft/angle/E5
824 +++ b/tests/draft/angle/E5
825 @@ -1,5 +1,6 @@
826  #C2----------------------------------------------
827  puts "TODO #23211 Debian40: Error: The tolerance of result shape is too big"
828 +puts "TODO ?OCC23823 All:Faulty shapes in variables faulty_1 to faulty_"
829  
830  plane p 0 0 0 1 0 0 0 0 -1
831  pcone p p 15 18 20
832 diff --git a/tests/offset/shape_type_a/A4 b/tests/offset/shape_type_a/A4
833 old mode 100644
834 new mode 100755
835 index f44934c..d45c329
836 --- a/tests/offset/shape_type_a/A4
837 +++ b/tests/offset/shape_type_a/A4
838 @@ -1,3 +1,7 @@
839 +
840 +puts "TODO ?OCC23823 ALL:Error : The offset is not valid. The volume is"
841 +puts "TODO ?OCC23823 ALL:Error : The volume"
842 +
843  #old file ofs9
844  
845  restore [locate_data_file CHE_bb9.rle] s
846 diff --git a/src/Draw/Draw_Window.cxx b/src/Draw/Draw_Window.cxx
847 index 03a6a78..b4e27df 100755
848 --- a/src/Draw/Draw_Window.cxx
849 +++ b/src/Draw/Draw_Window.cxx
850 @@ -84,7 +84,11 @@ defaultPrompt:
851        errChannel = Tcl_GetStdChannel(TCL_STDERR);
852        if (code != TCL_OK) {
853          if (errChannel) {
854 +#if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 5)))
855 +          Tcl_Write(errChannel, Tcl_GetStringResult(Interp), -1);
856 +#else
857            Tcl_Write(errChannel, Interp->result, -1);
858 +#endif
859            Tcl_Write(errChannel, "\n", 1);
860          }
861          Tcl_AddErrorInfo(Interp,
862 @@ -1055,7 +1059,11 @@ Standard_Boolean Init_Appli()
863    mainWindow =
864    Tk_MainWindow(interp) ;
865    if (mainWindow == NULL) {
866 +#if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 5)))
867 +    fprintf(stderr, "%s\n", Tcl_GetStringResult(interp));
868 +#else
869      fprintf(stderr, "%s\n", interp->result);
870 +#endif
871      exit(1);
872    }
873    Tk_Name(mainWindow) =
874 @@ -2061,7 +2069,11 @@ static DWORD WINAPI tkLoop(VOID)
875        Standard_Integer res = Tk_Init (interp);
876        if (res != TCL_OK)
877        {
878 +#if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 5)))
879 +        cout << "tkLoop: error in Tk initialization. Tcl reported: " << Tcl_GetStringResult(interp) << endl;
880 +#else
881          cout << "tkLoop: error in Tk initialization. Tcl reported: " << interp->result << endl;
882 +#endif
883        }
884      }
885      catch (Standard_Failure)
886 @@ -2072,7 +2084,11 @@ static DWORD WINAPI tkLoop(VOID)
887      mainWindow = Tk_MainWindow (interp);
888      if (mainWindow == NULL)
889      {
890 +#if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 5)))
891 +      fprintf (stderr, "%s\n", Tcl_GetStringResult(interp));
892 +#else
893        fprintf (stderr, "%s\n", interp->result);
894 +#endif
895        cout << "tkLoop: Tk_MainWindow() returned NULL. Exiting...\n";
896        Tcl_Exit (0);
897      }