Salome HOME
0020695: EDF 1076 GEOM: Add a new shape in GEOM: T-shape
[modules/geom.git] / src / GEOMImpl / GEOMImpl_I3DPrimOperations.cxx
index ffa7b4d3fd3297e2af21c36b6ffd0914403ae957..29de3fb75b2f4444e78cf23d999c1b1bbf97556e 100644 (file)
@@ -18,7 +18,7 @@
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
+
 #include <Standard_Stream.hxx>
 
 #include <GEOMImpl_I3DPrimOperations.hxx>
@@ -61,7 +61,6 @@
 #include <GEOMImpl_IPrism.hxx>
 #include <GEOMImpl_IPipe.hxx>
 #include <GEOMImpl_IRevolution.hxx>
-#include <GEOMImpl_IShapes.hxx>
 #include <GEOMImpl_IFilling.hxx>
 #include <GEOMImpl_IThruSections.hxx>
 #include <GEOMImpl_IPipeDiffSect.hxx>
@@ -256,7 +255,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFaceHW (double theH, double
  */
 //=============================================================================
 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFaceObjHW (Handle(GEOM_Object) theObj,
-                                                              double theH, double theW)
+                                                               double theH, double theW)
 {
   SetErrorCode(KO);
 
@@ -371,8 +370,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeDiskPntVecR
  */
 //=============================================================================
 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeDiskThreePnt (Handle(GEOM_Object) thePnt1,
-                                                                 Handle(GEOM_Object) thePnt2,
-                                                                 Handle(GEOM_Object) thePnt3)
+                                                                  Handle(GEOM_Object) thePnt2,
+                                                                  Handle(GEOM_Object) thePnt3)
 {
   SetErrorCode(KO);
 
@@ -980,8 +979,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismVecH (Handle(GEOM_Objec
  */
 //=============================================================================
 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismVecH2Ways (Handle(GEOM_Object) theBase,
-                                                                   Handle(GEOM_Object) theVec,
-                                                                   double theH)
+                                                                    Handle(GEOM_Object) theVec,
+                                                                    double theH)
 {
   SetErrorCode(KO);
 
@@ -1447,59 +1446,6 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeRevolutionAxisAngle2Ways
   return aRevolution;
 }
 
-//=============================================================================
-/*!
- *  MakeSolidShell
- */
-//=============================================================================
-Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeSolidShell (Handle(GEOM_Object) theShell)
-{
-  SetErrorCode(KO);
-
-  if (theShell.IsNull()) return NULL;
-
-  //Add a new Solid object
-  Handle(GEOM_Object) aSolid = GetEngine()->AddObject(GetDocID(), GEOM_SOLID);
-
-  //Add a new Solid function for creation a solid from a shell
-  Handle(GEOM_Function) aFunction =
-    aSolid->AddFunction(GEOMImpl_ShapeDriver::GetID(), SOLID_SHELL);
-  if (aFunction.IsNull()) return NULL;
-
-  //Check if the function is set correctly
-  if (aFunction->GetDriverGUID() != GEOMImpl_ShapeDriver::GetID()) return NULL;
-
-  GEOMImpl_IShapes aCI (aFunction);
-
-  Handle(GEOM_Function) aRefShell = theShell->GetLastFunction();
-
-  if (aRefShell.IsNull()) return NULL;
-
-  aCI.SetBase(aRefShell);
-
-  //Compute the Solid value
-  try {
-#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
-    OCC_CATCH_SIGNALS;
-#endif
-    if (!GetSolver()->ComputeFunction(aFunction)) {
-      SetErrorCode("Solid driver failed");
-      return NULL;
-    }
-  }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
-    return NULL;
-  }
-
-  //Make a Python command
-  GEOM::TPythonDump(aFunction) << aSolid << " = geompy.MakeSolid(" << theShell << ")";
-
-  SetErrorCode(OK);
-  return aSolid;
-}
-
 //=============================================================================
 /*!
  *  MakeFilling
@@ -1507,7 +1453,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeSolidShell (Handle(GEOM_Obje
 //=============================================================================
 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFilling
        (Handle(GEOM_Object) theShape, int theMinDeg, int theMaxDeg,
-        double theTol2D, double theTol3D, int theNbIter, bool isApprox)
+        double theTol2D, double theTol3D, int theNbIter,
+        int theMethod, bool isApprox)
 {
   SetErrorCode(KO);
 
@@ -1536,6 +1483,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFilling
   aFI.SetTol3D(theTol3D);
   aFI.SetNbIter(theNbIter);
   aFI.SetApprox(isApprox);
+  aFI.SetMethod(theMethod);
 
   //Compute the Solid value
   try {
@@ -1559,10 +1507,13 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFilling
   //Make a Python command
   GEOM::TPythonDump pd (aFunction);
   pd << aFilling << " = geompy.MakeFilling("
-    << theShape << ", " << theMinDeg << ", " << theMaxDeg << ", "
-      << theTol2D << ", " << theTol3D << ", " << theNbIter;
+     << theShape << ", " << theMinDeg << ", " << theMaxDeg << ", "
+     << theTol2D << ", " << theTol3D << ", " << theNbIter  << ", ";
+  if( theMethod==1 ) pd << "GEOM.FOM_UseOri"; 
+  else if( theMethod==2 ) pd << "GEOM.FOM_AutoCorrect";
+  else pd << "GEOM.FOM_Default";
   if(isApprox)
-    pd << ", " << isApprox;
+    pd << ", " << isApprox ;
   pd << ")";
 
   SetErrorCode(OK);
@@ -1575,10 +1526,10 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFilling
  */
 //=============================================================================
 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeThruSections(
-                                               const Handle(TColStd_HSequenceOfTransient)& theSeqSections,
-                                               bool theModeSolid,
-                                               double thePreci,
-                                               bool theRuled)
+                                                const Handle(TColStd_HSequenceOfTransient)& theSeqSections,
+                                                bool theModeSolid,
+                                                double thePreci,
+                                                bool theRuled)
 {
   Handle(GEOM_Object) anObj;
   SetErrorCode(KO);
@@ -1660,7 +1611,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeThruSections(
     if(!aSectObj.IsNull()) {
       pyDump<< aSectObj;
       if(i < nbObj)
-       pyDump<<", ";
+        pyDump<<", ";
     }
   }
   
@@ -1679,11 +1630,11 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeThruSections(
  */
 //=============================================================================
 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeWithDifferentSections(
-               const Handle(TColStd_HSequenceOfTransient)& theBases,
-               const Handle(TColStd_HSequenceOfTransient)& theLocations,
-               const Handle(GEOM_Object)& thePath,
-               bool theWithContact,
-               bool theWithCorrections)
+                const Handle(TColStd_HSequenceOfTransient)& theBases,
+                const Handle(TColStd_HSequenceOfTransient)& theLocations,
+                const Handle(GEOM_Object)& thePath,
+                bool theWithContact,
+                bool theWithCorrections)
 {
   Handle(GEOM_Object) anObj;
   SetErrorCode(KO);
@@ -1734,14 +1685,14 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeWithDifferentSections(
     {
       Handle(Standard_Transient) anItemLoc = theLocations->Value(i);
       if(anItemLoc.IsNull())
-       continue;
+        continue;
     
       Handle(GEOM_Object) aLoc = Handle(GEOM_Object)::DownCast(anItemLoc);
       if(aLoc.IsNull())
-       continue;
+        continue;
       Handle(GEOM_Function) aRefLoc = aLoc->GetLastFunction();
       if(aRefLoc.IsNull())
-       continue;
+        continue;
       aSeqLocs->Append(aRefLoc);
     }
     aSeqBases->Append(aRefBase);
@@ -1786,7 +1737,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeWithDifferentSections(
     if(!anObj.IsNull()) {
       pyDump<< anObj;
       if(i < nbBases)
-       pyDump<<", ";
+        pyDump<<", ";
     }
     
   }
@@ -1803,7 +1754,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeWithDifferentSections(
     if(!anObj.IsNull()) {
       pyDump<< anObj;
       if(i < nbLocs)
-       pyDump<<", ";
+        pyDump<<", ";
     }
   }  
 
@@ -1822,12 +1773,12 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeWithDifferentSections(
  */
 //=============================================================================
 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeWithShellSections(
-               const Handle(TColStd_HSequenceOfTransient)& theBases,
-               const Handle(TColStd_HSequenceOfTransient)& theSubBases,
-               const Handle(TColStd_HSequenceOfTransient)& theLocations,
-               const Handle(GEOM_Object)& thePath,
-               bool theWithContact,
-               bool theWithCorrections)
+                const Handle(TColStd_HSequenceOfTransient)& theBases,
+                const Handle(TColStd_HSequenceOfTransient)& theSubBases,
+                const Handle(TColStd_HSequenceOfTransient)& theLocations,
+                const Handle(GEOM_Object)& thePath,
+                bool theWithContact,
+                bool theWithCorrections)
 {
   Handle(GEOM_Object) anObj;
   SetErrorCode(KO);
@@ -1882,26 +1833,26 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeWithShellSections(
     if( nbSubBases >= nbBases ) {
       Handle(Standard_Transient) aSubItem = theSubBases->Value(i);
       if(aSubItem.IsNull())
-       continue;
+        continue;
       Handle(GEOM_Object) aSubBase = Handle(GEOM_Object)::DownCast(aSubItem);
       if(aSubBase.IsNull())
-       continue;
+        continue;
       Handle(GEOM_Function) aRefSubBase = aSubBase->GetLastFunction();
       if(aRefSubBase.IsNull())
-       continue;
+        continue;
       aSeqSubBases->Append(aRefSubBase);
     }
 
     if(nbLocs) {
       Handle(Standard_Transient) anItemLoc = theLocations->Value(i);
       if(anItemLoc.IsNull())
-       continue;
+        continue;
       Handle(GEOM_Object) aLoc = Handle(GEOM_Object)::DownCast(anItemLoc);
       if(aLoc.IsNull())
-       continue;
+        continue;
       Handle(GEOM_Function) aRefLoc = aLoc->GetLastFunction();
       if(aRefLoc.IsNull())
-       continue;
+        continue;
       aSeqLocs->Append(aRefLoc);
     }
 
@@ -1948,7 +1899,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeWithShellSections(
     if(!anObj.IsNull()) {
       pyDump<< anObj;
       if(i < nbBases)
-       pyDump<<", ";
+        pyDump<<", ";
     }
     
   }
@@ -1965,7 +1916,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeWithShellSections(
     if(!anObj.IsNull()) {
       pyDump<< anObj;
       if(i < nbBases)
-       pyDump<<", ";
+        pyDump<<", ";
     }
     
   }
@@ -1982,7 +1933,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeWithShellSections(
     if(!anObj.IsNull()) {
       pyDump<< anObj;
       if(i < nbLocs)
-       pyDump<<", ";
+        pyDump<<", ";
     }
   }  
 
@@ -2000,8 +1951,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeWithShellSections(
  */
 //=============================================================================
 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeShellsWithoutPath(
-               const Handle(TColStd_HSequenceOfTransient)& theBases,
-               const Handle(TColStd_HSequenceOfTransient)& theLocations)
+                const Handle(TColStd_HSequenceOfTransient)& theBases,
+                const Handle(TColStd_HSequenceOfTransient)& theLocations)
 {
   Handle(GEOM_Object) anObj;
   SetErrorCode(KO);
@@ -2048,13 +1999,13 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeShellsWithoutPath(
     if(nbLocs) {
       Handle(Standard_Transient) anItemLoc = theLocations->Value(i);
       if(anItemLoc.IsNull())
-       continue;
+        continue;
       Handle(GEOM_Object) aLoc = Handle(GEOM_Object)::DownCast(anItemLoc);
       if(aLoc.IsNull())
-       continue;
+        continue;
       Handle(GEOM_Function) aRefLoc = aLoc->GetLastFunction();
       if(aRefLoc.IsNull())
-       continue;
+        continue;
       aSeqLocs->Append(aRefLoc);
     }
 
@@ -2097,7 +2048,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeShellsWithoutPath(
     if(!anObj.IsNull()) {
       pyDump<< anObj;
       if(i < nbBases)
-       pyDump<<", ";
+        pyDump<<", ";
     }
     
   }
@@ -2114,7 +2065,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeShellsWithoutPath(
     if(!anObj.IsNull()) {
       pyDump<< anObj;
       if(i < nbLocs)
-       pyDump<<", ";
+        pyDump<<", ";
     }
   }  
 
@@ -2132,8 +2083,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeShellsWithoutPath(
  */
 //=============================================================================
 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeBiNormalAlongVector (Handle(GEOM_Object) theBase,
-                                                                            Handle(GEOM_Object) thePath,
-                                                                            Handle(GEOM_Object) theVec)
+                                                                             Handle(GEOM_Object) thePath,
+                                                                             Handle(GEOM_Object) theVec)
 {
   SetErrorCode(KO);