]> SALOME platform Git repositories - modules/geom.git/blobdiff - src/AdvancedEngine/AdvancedEngine_IOperations.cxx
Salome HOME
Typo-fix by Kunda
[modules/geom.git] / src / AdvancedEngine / AdvancedEngine_IOperations.cxx
index 2e8db2e20a5bfd6a8d58225ee2eb87ef3a03b3c5..1641097db0e5cf5ed9ef55fa599ef290a2358b03 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 #include "AdvancedEngine_SmoothingSurfaceDriver.hxx"
 #include "AdvancedEngine_ISmoothingSurface.hxx"
 
-#include <Basics_OCCTVersion.hxx>
-
 #include <utilities.h>
 #include <OpUtil.hxx>
 #include <Utils_ExceptHandlers.hxx>
 
-#include "GEOM_Function.hxx"
-#include "GEOM_PythonDump.hxx"
-#include "GEOMUtils.hxx"
-#include "GEOMAlgo_Splitter.hxx"
-#include "GEOMAlgo_FinderShapeOn1.hxx"
-
-#include "GEOMImpl_Gen.hxx"
-#include "GEOMImpl_Types.hxx"
-
-#include "GEOMImpl_IBasicOperations.hxx"
-#include "GEOMImpl_IBooleanOperations.hxx"
-#include "GEOMImpl_IShapesOperations.hxx"
-#include "GEOMImpl_ITransformOperations.hxx"
-#include "GEOMImpl_IBlocksOperations.hxx"
-#include "GEOMImpl_I3DPrimOperations.hxx"
-#include "GEOMImpl_ILocalOperations.hxx"
-#include "GEOMImpl_IHealingOperations.hxx"
-#include "GEOMImpl_IGroupOperations.hxx"
-#include "GEOMImpl_GlueDriver.hxx"
+#include <GEOM_Function.hxx>
+#include <GEOM_PythonDump.hxx>
+#include <GEOMUtils.hxx>
+#include <GEOMAlgo_ClsfSurf.hxx>
+#include <GEOMAlgo_FinderShapeOn2.hxx>
+#include <GEOMAlgo_Splitter.hxx>
+
+#include <GEOMImpl_Gen.hxx>
+#include <GEOMImpl_Types.hxx>
+
+#include <GEOMImpl_IBasicOperations.hxx>
+#include <GEOMImpl_IBooleanOperations.hxx>
+#include <GEOMImpl_IShapesOperations.hxx>
+#include <GEOMImpl_ITransformOperations.hxx>
+#include <GEOMImpl_IBlocksOperations.hxx>
+#include <GEOMImpl_I3DPrimOperations.hxx>
+#include <GEOMImpl_ILocalOperations.hxx>
+#include <GEOMImpl_IHealingOperations.hxx>
+#include <GEOMImpl_IGroupOperations.hxx>
+#include <GEOMImpl_GlueDriver.hxx>
 
 #include <TDF_Tool.hxx>
 #include <TFunction_DriverTable.hxx>
 #include <TFunction_Driver.hxx>
-#include <TFunction_Logbook.hxx>
 #include <TNaming_CopyShape.hxx>
 
 #include <TopExp.hxx>
@@ -286,8 +284,6 @@ bool AdvancedEngine_IOperations::MakeGroups(Handle(GEOM_Object) theShape, int sh
     return false;
   }
 
-  gp_Trsf aTrsfInv = aTrsf.Inverted();
-
 //   int expectedGroups = 0;
 //   if (shapeType == TSHAPE_BASIC)
 //     if (Abs(theR2+theW2-theR1-theW1) <= Precision::Approximation())
@@ -622,6 +618,7 @@ bool AdvancedEngine_IOperations::MakeGroups(Handle(GEOM_Object) theShape, int sh
     if (aGroup.IsNull())
       continue;
 
+    gp_Trsf aTrsfInv = aTrsf.Inverted();
     TopoDS_Shape aGroupShape = aGroup->GetValue();
     BRepBuilderAPI_Transform aTransformationShapeInv (aGroupShape, aTrsfInv, Standard_False);
     TopoDS_Shape aGroupShapeTrsfInv = aTransformationShapeInv.Shape();
@@ -811,15 +808,17 @@ bool AdvancedEngine_IOperations::MakeGroups(Handle(GEOM_Object) theShape, int sh
 //=============================================================================
 bool AdvancedEngine_IOperations::GetFacesOnSurf
                      (const TopoDS_Shape &theShape,
-                      const Handle_Geom_Surface& theSurface,
+                      const Handle(Geom_Surface)& theSurface,
                       const Standard_Real theTolerance,
                       TopTools_ListOfShape &theFaces)
 {
-  GEOMAlgo_FinderShapeOn1 aFinder;
+  GEOMAlgo_FinderShapeOn2   aFinder;
+  Handle(GEOMAlgo_ClsfSurf) aClsfSurf = new GEOMAlgo_ClsfSurf;
 
+  aClsfSurf->SetSurface(theSurface);
   aFinder.SetShape(theShape);
   aFinder.SetTolerance(theTolerance);
-  aFinder.SetSurface(theSurface);
+  aFinder.SetClsf(aClsfSurf);
   aFinder.SetShapeType(TopAbs_FACE);
   aFinder.SetState(GEOMAlgo_ST_ON);
 
@@ -828,7 +827,7 @@ bool AdvancedEngine_IOperations::GetFacesOnSurf
   // Default value=3
   aFinder.SetNbPntsMin(3);
   // Sets the maximal number of inner points for edges or faces.
-  // It is usefull for the cases when this number is very big (e.g =2000) to improve
+  // It is useful for the cases when this number is very big (e.g =2000) to improve
   // the performance. If this value =0, all inner points will be taken into account.
   // Default value=0
   aFinder.SetNbPntsMax(100);
@@ -836,7 +835,7 @@ bool AdvancedEngine_IOperations::GetFacesOnSurf
 
   // Interprete results
   Standard_Integer iErr = aFinder.ErrorStatus();
-  // the detailed description of error codes is in GEOMAlgo_FinderShapeOn1.cxx
+  // the detailed description of error codes is in GEOMAlgo_FinderShapeOn2.cxx
   if (iErr) {
     MESSAGE(" iErr : " << iErr);
     TCollection_AsciiString aMsg (" iErr : ");
@@ -845,7 +844,7 @@ bool AdvancedEngine_IOperations::GetFacesOnSurf
     return false;
   }
   Standard_Integer iWrn = aFinder.WarningStatus();
-  // the detailed description of warning codes is in GEOMAlgo_FinderShapeOn1.cxx
+  // the detailed description of warning codes is in GEOMAlgo_FinderShapeOn2.cxx
   if (iWrn) {
     MESSAGE(" *** iWrn : " << iWrn);
   }
@@ -1471,70 +1470,16 @@ bool AdvancedEngine_IOperations::MakePipeTShapePartition(Handle(GEOM_Object) the
       face_t->GetLastFunction()->SetDescription("");
       theShapes.push_back(face_t);
 
-      gp_Pnt aP2 = BRep_Tool::Pnt(TopoDS::Vertex(P2->GetValue()));
-      gp_Pnt aP5 = BRep_Tool::Pnt(TopoDS::Vertex(vi1->GetValue()));
-      double deltaZ = aP2.Z() - aP5.Z();
-      //         std::cerr << "Creating new point from vi1 with deltaZ = " << deltaZ << std::endl;
-      Handle(GEOM_Object) P5bis = myTransformOperations->TranslateDXDYDZCopy(vi1, 0, 0, deltaZ);
-      if (P5bis.IsNull()) {
-        SetErrorCode("Impossible to translate vertex");
-        return false;
-      }
-      P5bis->GetLastFunction()->SetDescription("");
-
-      gp_Pnt aP4 = BRep_Tool::Pnt(TopoDS::Vertex(P4->GetValue()));
-      gp_Pnt aP6 = BRep_Tool::Pnt(TopoDS::Vertex(vi2->GetValue()));
-      deltaZ = aP4.Z() - aP6.Z();
-      //         std::cerr << "Creating new point from vi2 with deltaZ = " << deltaZ << std::endl;
-      Handle(GEOM_Object) P6bis = myTransformOperations->TranslateDXDYDZCopy(vi2, 0, 0, deltaZ);
-      if (P6bis.IsNull()) {
-        SetErrorCode("Impossible to translate vertex");
-        return false;
-      }
-      P6bis->GetLastFunction()->SetDescription("");
-
-      //         std::cerr << "Creating new line 1 from 2 previous points" << std::endl;
-      Handle(GEOM_Object) Cote_3 = myBasicOperations->MakeLineTwoPnt(P5bis, P2);
-      if (Cote_3.IsNull()) {
-        SetErrorCode("Impossible to build edge in thickness");
-        return false;
-      }
-      Cote_3->GetLastFunction()->SetDescription("");
+      // Create a prism from edge_chan_inc
+      Handle(GEOM_Object) aPrismDir = myBasicOperations->MakeVectorDXDYDZ(1., 1., 0.);
 
-      //         std::cerr << "Creating new line 2 from 2 previous points" << std::endl;
-      Handle(GEOM_Object) Cote_4 = myBasicOperations->MakeLineTwoPnt(P6bis, P4);
-      if (Cote_4.IsNull()) {
-        SetErrorCode("Impossible to build edge in thickness");
+      if (aPrismDir.IsNull()) {
+        SetErrorCode("Impossible to build Prism direction");
         return false;
       }
-      Cote_4->GetLastFunction()->SetDescription("");
+      aPrismDir->GetLastFunction()->SetDescription("");
+      face_t2 = my3DPrimOperations->MakePrismVecH(edge_chan_inc, aPrismDir, theR2 + theW2);
 
-      //         std::cerr << "Creating new line 3 from 2 previous points" << std::endl;
-      Handle(GEOM_Object) Cote_5 = myBasicOperations->MakeLineTwoPnt(P5bis, P6bis);
-      if (Cote_4.IsNull()) {
-        SetErrorCode("Impossible to build edge in thickness");
-        return false;
-      }
-      Cote_5->GetLastFunction()->SetDescription("");
-
-      //std::list<Handle(GEOM_Object)> edgeList2;
-      //edgeList2.push_back(edge_chan_inc);
-      //edgeList2.push_back(Cote_3);
-      //edgeList2.push_back(Cote_5);
-      //edgeList2.push_back(Cote_4);
-      //         std::cerr << "Creating wire 2" << std::endl;
-      //wire_t2 = myShapesOperations->MakeWire(edgeList2, 1e-7);
-      //if (wire_t2.IsNull()) {
-      //  SetErrorCode("Impossible to build wire");
-      //  return false;
-      //}
-      //wire_t2->GetLastFunction()->SetDescription("");
-      //         std::cerr << "Creating face 2" << std::endl;
-      //face_t2 = myShapesOperations->MakeFace(wire_t2, false);
-
-      // Mantis issue 0021682
-      face_t2 = my3DPrimOperations->MakePrismVecH(edge_chan_inc, Cote_4, - (theR2 + theW2));
-      //face_t2 = my3DPrimOperations->MakePrismVecH(edge_chan_inc, Cote_4, - 2.0*theR2);
       if (face_t2.IsNull()) {
         SetErrorCode("Impossible to build face");
         return false;
@@ -1606,9 +1551,8 @@ bool AdvancedEngine_IOperations::MakePipeTShapePartition(Handle(GEOM_Object) the
     TopoDS_Shape aShape = Te3->GetValue();
     theShape->GetLastFunction()->SetValue(aShape);
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return false;
   }
 
@@ -1888,7 +1832,7 @@ TopoDS_Shape AdvancedEngine_IOperations::MakeThicknessReduction (gp_Ax2 theAxes,
     StdFail_NotDone::Raise("Cannot build cones of thickness reduction");
   BRepAlgoAPI_Cut cut1 (ConeExt.Shape(), ConeInt.Shape());
   if (!cut1.IsDone())
-    StdFail_NotDone::Raise("Coudn't build transition part of thickness reduction");
+    StdFail_NotDone::Raise("Couldn't build transition part of thickness reduction");
   TopoDS_Shape aReduction = cut1.Shape();
 
   // Build the thin part, if required
@@ -1902,7 +1846,7 @@ TopoDS_Shape AdvancedEngine_IOperations::MakeThicknessReduction (gp_Ax2 theAxes,
       StdFail_NotDone::Raise("Cannot build cylinders of thickness reduction");
     BRepAlgoAPI_Cut cut2 (CExt.Shape(), CInt.Shape());
     if (!cut2.IsDone())
-      StdFail_NotDone::Raise("Coudn't build thin part of thickness reduction");
+      StdFail_NotDone::Raise("Couldn't build thin part of thickness reduction");
     aThinPart = cut2.Shape();
   }
 
@@ -2017,9 +1961,8 @@ Handle(TColStd_HSequenceOfTransient)
       aFunction->SetValue(aResShape);
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -2041,9 +1984,8 @@ Handle(TColStd_HSequenceOfTransient)
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -2179,9 +2121,8 @@ AdvancedEngine_IOperations::MakePipeTShapeWithPosition
       aFunction->SetValue(aResShape);
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -2212,9 +2153,8 @@ AdvancedEngine_IOperations::MakePipeTShapeWithPosition
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -2322,9 +2262,8 @@ AdvancedEngine_IOperations::MakePipeTShapeChamfer
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -2375,9 +2314,8 @@ AdvancedEngine_IOperations::MakePipeTShapeChamfer
   try {
     aChamfer = myLocalOperations->MakeChamferEdges(aShape, theW, theH, theEdges);
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
   if (aChamfer.IsNull()) {
@@ -2411,9 +2349,8 @@ AdvancedEngine_IOperations::MakePipeTShapeChamfer
       aFunction->SetValue(aResShape);
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -2435,9 +2372,8 @@ AdvancedEngine_IOperations::MakePipeTShapeChamfer
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -2557,9 +2493,8 @@ AdvancedEngine_IOperations::MakePipeTShapeChamferWithPosition
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -2608,9 +2543,8 @@ AdvancedEngine_IOperations::MakePipeTShapeChamferWithPosition
   try {
     aChamfer = myLocalOperations->MakeChamferEdges(aShape, theW, theH, theEdges);
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
   if (aChamfer.IsNull()) {
@@ -2644,9 +2578,8 @@ AdvancedEngine_IOperations::MakePipeTShapeChamferWithPosition
       aFunction->SetValue(aResShape);
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -2674,9 +2607,8 @@ AdvancedEngine_IOperations::MakePipeTShapeChamferWithPosition
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -2782,9 +2714,8 @@ AdvancedEngine_IOperations::MakePipeTShapeFillet
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -2834,9 +2765,8 @@ AdvancedEngine_IOperations::MakePipeTShapeFillet
   try {
     aFillet = myLocalOperations->MakeFilletEdges(aShape, theRF, theEdges);
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
   if (aFillet.IsNull()) {
@@ -2896,9 +2826,8 @@ AdvancedEngine_IOperations::MakePipeTShapeFillet
       aFunction->SetValue(aResShape);
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -2920,9 +2849,8 @@ AdvancedEngine_IOperations::MakePipeTShapeFillet
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -3039,9 +2967,8 @@ AdvancedEngine_IOperations::MakePipeTShapeFilletWithPosition
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -3091,9 +3018,8 @@ AdvancedEngine_IOperations::MakePipeTShapeFilletWithPosition
   try {
     aFillet = myLocalOperations->MakeFilletEdges(aShape, theRF, theEdges);
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
   if (aFillet.IsNull()) {
@@ -3152,9 +3078,8 @@ AdvancedEngine_IOperations::MakePipeTShapeFilletWithPosition
       aFunction->SetValue(aResShape);
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -3182,9 +3107,8 @@ AdvancedEngine_IOperations::MakePipeTShapeFilletWithPosition
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -3278,9 +3202,8 @@ Handle(GEOM_Object) AdvancedEngine_IOperations::MakeDividedDisk (double theR, do
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
   
@@ -3353,9 +3276,8 @@ Handle(GEOM_Object) AdvancedEngine_IOperations::MakeDividedDiskPntVecR (Handle(G
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
   
@@ -3479,9 +3401,8 @@ Handle(GEOM_Object) AdvancedEngine_IOperations::MakeSmoothingSurface (std::list<
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }