Salome HOME
Merge V9_dev branch into master SHAPER_V9_1_0RC1
authorrnv <rnv@opencascade.com>
Thu, 7 Jun 2018 12:36:44 +0000 (15:36 +0300)
committerrnv <rnv@opencascade.com>
Thu, 14 Jun 2018 11:49:15 +0000 (14:49 +0300)
16 files changed:
doc/salome/examples/hexoticdemo.py
doc/salome/examples/hexoticdemo_vl.py
doc/salome/examples/hexoticsubdom1.py
doc/salome/examples/hexoticsubdom2.py
doc/salome/examples/hexoticsubdom3.py
doc/salome/examples/hexoticsubdom4.py
src/GUI/HexoticPluginGUI_HypothesisCreator.cxx
src/HexoticPlugin/HexoticPLUGINBuilder.py
src/HexoticPlugin/HexoticPlugin_Hexotic.cxx
src/HexoticPlugin/HexoticPlugin_Hexotic.hxx
src/HexoticPlugin/HexoticPlugin_Hexotic_i.cxx
src/HexoticPlugin/HexoticPlugin_Hexotic_i.hxx
src/HexoticPlugin/HexoticPlugin_Hypothesis.cxx
src/HexoticPlugin/HexoticPlugin_Hypothesis.hxx
src/HexoticPlugin/HexoticPlugin_Hypothesis_i.cxx
src/HexoticPlugin/HexoticPlugin_Hypothesis_i.hxx

index f346bb803a80183056e103f81078d3642e422194..f221c72c6f706e234749caf62e17ae6d2c0226fb 100644 (file)
@@ -21,10 +21,10 @@ import salome
 salome.salome_init()
 
 from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
+geompy = geomBuilder.New()
 
 from salome.smesh import smeshBuilder
-smesh =  smeshBuilder.New(salome.myStudy)
+smesh =  smeshBuilder.New()
 
 
 # create a sphere
index 2ae8e11cb759007932eaaad9e60ac877993b20c4..c28dc83639cc9ab89893128649b20668b3757ff9 100644 (file)
 
 import salome
 salome.salome_init()
-theStudy = salome.myStudy
 
 from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
+geompy = geomBuilder.New()
 
 import SMESH, SALOMEDS
 from salome.smesh import smeshBuilder
-smesh =  smeshBuilder.New(salome.myStudy)
+smesh =  smeshBuilder.New()
 
 # Create geometry
 Box_1 = geompy.MakeBoxDXDYDZ(50, 50, 50)
index 8781911393d14d79f0627d59931498acec96943f..28f5b650af0c17385ccde635e651c9bbd92929c4 100644 (file)
@@ -21,11 +21,11 @@ import salome
 salome.salome_init()
 
 from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
+geompy = geomBuilder.New()
 
 import SMESH, SALOMEDS
 from salome.smesh import smeshBuilder
-smesh =  smeshBuilder.New(salome.myStudy)
+smesh =  smeshBuilder.New()
 
 
 # Create geometry: a box cut by a holed sphere
@@ -51,7 +51,7 @@ aFilter2 = smesh.GetFilterFromCriteria([smesh.GetCriterion(SMESH.VOLUME,SMESH.FT
 aFilter3 = smesh.GetFilter(SMESH.VOLUME,SMESH.FT_BelongToGeom,'=',Sphere_1, SMESH.FT_LogicalNOT)
 
 # Create mesh of Cut_2 with sd mode 1
-print "Create mesh of Cut_2 with sd mode 1"
+print("Create mesh of Cut_2 with sd mode 1")
 Mesh_mghexa_sd1 = smesh.Mesh(Cut_2, "Mesh_mghexa_sd1")
 
 # Create the 2D algo: MG-CADSurf with geometrical mesh
index 500270ae6633e0b5b0baf1e649773b12395f584a..62a82bbfb01696989a7626bc9de6397b20db226c 100644 (file)
@@ -21,11 +21,11 @@ import salome
 salome.salome_init()
 
 from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
+geompy = geomBuilder.New()
 
 import SMESH, SALOMEDS
 from salome.smesh import smeshBuilder
-smesh =  smeshBuilder.New(salome.myStudy)
+smesh =  smeshBuilder.New()
 
 # Create geometry: a box cut by a holed sphere
 Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
@@ -50,7 +50,7 @@ aFilter2 = smesh.GetFilterFromCriteria([smesh.GetCriterion(SMESH.VOLUME,SMESH.FT
 aFilter3 = smesh.GetFilter(SMESH.VOLUME,SMESH.FT_BelongToGeom,'=',Sphere_1, SMESH.FT_LogicalNOT)
 
 # Create mesh of Cut_2 with sd mode 2
-print "Create mesh of Cut_2 with sd mode 2"
+print("Create mesh of Cut_2 with sd mode 2")
 Mesh_mghexa_sd2 = smesh.Mesh(Cut_2, "Mesh_mghexa_sd2")
 
 # Create the 2D algo: MG-CADSurf with geometrical mesh
index ef7cc20328eaf4a08b77a735388ff6963d75e2f6..ae1a151f67c49ce012f3c104154b7091c3d111ff 100644 (file)
@@ -21,11 +21,11 @@ import salome
 salome.salome_init()
 
 from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
+geompy = geomBuilder.New()
 
 import SMESH, SALOMEDS
 from salome.smesh import smeshBuilder
-smesh =  smeshBuilder.New(salome.myStudy)
+smesh =  smeshBuilder.New()
 
 # Create geometry: a box cut by a holed sphere
 Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
@@ -50,7 +50,7 @@ aFilter2 = smesh.GetFilterFromCriteria([smesh.GetCriterion(SMESH.VOLUME,SMESH.FT
 aFilter3 = smesh.GetFilter(SMESH.VOLUME,SMESH.FT_BelongToGeom,'=',Sphere_1, SMESH.FT_LogicalNOT)
 
 # Create mesh of Cut_2 with sd mode 3
-print "Create mesh of Cut_2 with sd mode 3"
+print("Create mesh of Cut_2 with sd mode 3")
 Mesh_mghexa_sd3 = smesh.Mesh(Cut_2, "Mesh_mghexa_sd3")
 
 # Create the 2D algo: MG-CADSurf with geometrical mesh
index 8683d378eec3fc0831e57a313bc1c6ad4e5750a0..ee3bb5fbc9a3613c059d3a0dfef96a53e179e994 100644 (file)
@@ -21,10 +21,10 @@ import salome
 salome.salome_init()
 
 from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
+geompy = geomBuilder.New()
 
 from salome.smesh import smeshBuilder
-smesh =  smeshBuilder.New(salome.myStudy)
+smesh =  smeshBuilder.New()
 
 # Create geometry: a box cut by a plane
 Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
index be6ab02145adf8a2f80d9feb34d3820b8f13310d..3eee367dc6827644c03d397bc6ec03bf4f84365e 100644 (file)
@@ -741,10 +741,8 @@ bool HexoticPluginGUI_HypothesisCreator::readSizeMapsFromWidgets( HexoticHypothe
 
 GEOM::GEOM_Object_var HexoticPluginGUI_HypothesisCreator::entryToObject( std::string entry) const
 {
-  SMESH_Gen_i* smeshGen_i = SMESH_Gen_i::GetSMESHGen();
-  SALOMEDS::Study_var myStudy = smeshGen_i->GetCurrentStudy();
   GEOM::GEOM_Object_var aGeomObj;
-  SALOMEDS::SObject_var aSObj = myStudy->FindObjectID( entry.c_str() );
+   SALOMEDS::SObject_var aSObj = SMESH_Gen_i::getStudyServant()->FindObjectID( entry.c_str() );
   if (!aSObj->_is_nil()) {
     CORBA::Object_var obj = aSObj->GetObject();
     aGeomObj = GEOM::GEOM_Object::_narrow(obj);
index 7fd42cead0a8bb5f027e9851159de80cd5c30a1a..684f63876ac496f953d7648effd7618dc9bddbd5 100644 (file)
@@ -70,7 +70,7 @@ class Hexotic_Algorithm(Mesh_Algorithm):
     #              if it is @c 0 (default), the algorithm is assigned to the main shape
     def __init__(self, mesh, geom=0):
         Mesh_Algorithm.__init__(self)
-        if noHexoticPlugin: print "Warning: HexoticPlugin module unavailable"
+        if noHexoticPlugin: print("Warning: HexoticPlugin module unavailable")
         self.Create(mesh, geom, MG_Hexa, "libHexoticEngine.so")
         self.params = None
         pass
@@ -100,7 +100,7 @@ class Hexotic_Algorithm(Mesh_Algorithm):
     def SetSizeMap(self, theObject, theSize):
         AssureGeomPublished( self.mesh, theObject )
         if theSize <= 0:
-          raise ValueError, "The size must be > 0"
+          raise ValueError("The size must be > 0")
         self.Parameters().SetSizeMap(theObject, theSize)
         return self.Parameters()
       
@@ -125,7 +125,7 @@ class Hexotic_Algorithm(Mesh_Algorithm):
     #  @param quad not documented
     #  @return hypothesis object
     def MinMaxQuad(self, min=3, max=8, quad=True):
-        print "WARNING: Function MinMaxQuad is deprecated, use SetMinMaxHexes instead"
+        print("WARNING: Function MinMaxQuad is deprecated, use SetMinMaxHexes instead")
         return self.SetMinMaxHexes(min, max)
       
     ## Defines "ViscousLayers" hypothesis to give MG-Hexa parameters
index cb539c6053d1a4d50dbd45e2545fe4b54c9abcfe..a761f1fd341d9e2fe215ef01a9771aaeab3963ce 100644 (file)
@@ -91,8 +91,8 @@ static void removeFile( const TCollection_AsciiString& fileName )
  */
 //=============================================================================
 
-HexoticPlugin_Hexotic::HexoticPlugin_Hexotic(int hypId, int studyId, SMESH_Gen* gen)
-  : SMESH_3D_Algo(hypId, studyId, gen)
+HexoticPlugin_Hexotic::HexoticPlugin_Hexotic(int hypId, SMESH_Gen* gen)
+  : SMESH_3D_Algo(hypId, gen)
 {
   MESSAGE("HexoticPlugin_Hexotic::HexoticPlugin_Hexotic");
   _name = "MG-Hexa";
@@ -108,15 +108,6 @@ HexoticPlugin_Hexotic::HexoticPlugin_Hexotic(int hypId, int studyId, SMESH_Gen*
 #endif
   _computeCanceled = false;
   
-  // Copy of what is done in BLSURFPLugin TODO : share the code
-  smeshGen_i = SMESH_Gen_i::GetSMESHGen();
-  CORBA::Object_var anObject = smeshGen_i->GetNS()->Resolve("/myStudyManager");
-  SALOMEDS::StudyManager_var aStudyMgr = SALOMEDS::StudyManager::_narrow(anObject);
-  
-  myStudy = NULL;
-  myStudy = aStudyMgr->GetStudyByID(_studyId);
-  if ( !myStudy->_is_nil() )
-    MESSAGE("myStudy->StudyId() = " << myStudy->StudyId());
 }
 
 //=============================================================================
@@ -909,18 +900,17 @@ std::string HexoticPlugin_Hexotic::getHexoticCommand(const TCollection_AsciiStri
 TopoDS_Shape HexoticPlugin_Hexotic::entryToShape(std::string entry)
 {
   MESSAGE("HexoticPlugin_Hexotic::entryToShape "<<entry );
-  if ( myStudy->_is_nil() )
-    throw SALOME_Exception("MG-Hexa plugin can't work w/o publishing in the study");
+
   GEOM::GEOM_Object_var aGeomObj;
   TopoDS_Shape S = TopoDS_Shape();
-  SALOMEDS::SObject_var aSObj = myStudy->FindObjectID( entry.c_str() );
+  SALOMEDS::SObject_var aSObj = SMESH_Gen_i::getStudyServant()->FindObjectID( entry.c_str() );
   if (!aSObj->_is_nil()) {
     CORBA::Object_var obj = aSObj->GetObject();
     aGeomObj = GEOM::GEOM_Object::_narrow(obj);
     aSObj->UnRegister();
   }
   if ( !aGeomObj->_is_nil() )
-    S = smeshGen_i->GeomObjectToShape( aGeomObj.in() );
+    S = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( aGeomObj.in() );
   return S;
 }
 
index a0b94b7a6cd8b4d6a7292303f0bda29bf4d3f945..065d8aef3512bbcf65d0451072964c7d2c679431 100644 (file)
@@ -53,7 +53,7 @@ class MG_Hexotic_API;
 class HEXOTICPLUGIN_EXPORT HexoticPlugin_Hexotic: public SMESH_3D_Algo
 {
 public:
-  HexoticPlugin_Hexotic(int hypId, int studyId, SMESH_Gen* gen);
+  HexoticPlugin_Hexotic(int hypId, SMESH_Gen* gen);
   virtual ~HexoticPlugin_Hexotic();
 
 #ifdef WITH_BLSURFPLUGIN
@@ -122,10 +122,6 @@ private:
   const BLSURFPlugin_Hypothesis* _blsurfHypo;
 #endif
 
-
-  SALOMEDS::Study_var myStudy;
-  SMESH_Gen_i*        smeshGen_i;
-
 };
 
 #endif
index 17b28410ef4d92b9a5eab8cbd5bb248e34651df5..15c514cf9b9e2696f7c78db6f9224e714bbd0829 100644 (file)
@@ -38,7 +38,6 @@
 //=============================================================================
 
 HexoticPlugin_Hexotic_i::HexoticPlugin_Hexotic_i( PortableServer::POA_ptr thePOA,
-                                                  int                     theStudyId,
                                                   ::SMESH_Gen*            theGenImpl )
      : SALOME::GenericObj_i( thePOA ), 
        SMESH_Hypothesis_i( thePOA ), 
@@ -47,7 +46,6 @@ HexoticPlugin_Hexotic_i::HexoticPlugin_Hexotic_i( PortableServer::POA_ptr thePOA
 {
   MESSAGE( "HexoticPlugin_Hexotic_i::HexoticPlugin_Hexotic_i" );
   myBaseImpl = new ::HexoticPlugin_Hexotic( theGenImpl->GetANewId(),
-                                            theStudyId,
                                             theGenImpl );
 }
 
index 34236ebc5677d8e03e62008c90588a643edf5081..bf9cdcf79ec136681ed5221484a5bc1d6c213a43 100644 (file)
@@ -42,7 +42,6 @@ class HEXOTICPLUGIN_EXPORT HexoticPlugin_Hexotic_i:
 public:
   // Constructor
   HexoticPlugin_Hexotic_i (PortableServer::POA_ptr thePOA,
-                           int                     theStudyId,
                            ::SMESH_Gen*            theGenImpl );
   // Destructor
   virtual ~HexoticPlugin_Hexotic_i();
index 2891afdd040cdb072ffdae03071f5e2989ab1227..1c36c2dedd62b4066c12a1536506dfc428deef4e 100644 (file)
@@ -32,9 +32,8 @@
  *  
  */
 //=============================================================================
-HexoticPlugin_Hypothesis::HexoticPlugin_Hypothesis (int hypId, int studyId,
-                                                    SMESH_Gen* gen)
-  : SMESH_Hypothesis(hypId, studyId, gen),
+HexoticPlugin_Hypothesis::HexoticPlugin_Hypothesis (int hypId, SMESH_Gen* gen)
+  : SMESH_Hypothesis(hypId, gen),
     _hexesMinLevel( GetDefaultHexesMinLevel() ),
     _hexesMaxLevel( GetDefaultHexesMaxLevel() ),
     _minSize( GetDefaultMinSize() ),
index 3c70d9efeb46adf308626b7f1c9e3496252a7e06..d9b20ba0c768bb2ab8a775f156639e57cb057a67 100644 (file)
@@ -51,7 +51,7 @@ class HEXOTICPLUGIN_EXPORT HexoticPlugin_Hypothesis: public SMESH_Hypothesis
 {
 public:
 
-  HexoticPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen* gen);
+  HexoticPlugin_Hypothesis(int hypId, SMESH_Gen* gen);
 
   static const char* GetHypType() { return "MG-Hexa Parameters"; }
 
index 48ac1b3e73b700a9c9b957a40e1fd14c804090b6..d94fb994eaf220696dc5111c26f6454223b4b7d7 100644 (file)
 //=============================================================================
 HexoticPlugin_Hypothesis_i::
 HexoticPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA,
-                           int                     theStudyId,
-                           ::SMESH_Gen*            theGenImpl)
+                            ::SMESH_Gen*            theGenImpl)
   : SALOME::GenericObj_i( thePOA ), 
     SMESH_Hypothesis_i( thePOA )
 {
   MESSAGE( "HexoticPlugin_Hypothesis_i::HexoticPlugin_Hypothesis_i" );
   myBaseImpl = new ::HexoticPlugin_Hypothesis (theGenImpl->GetANewId(),
-                                              theStudyId,
-                                              theGenImpl);
+                                               theGenImpl);
 }
 
 //=============================================================================
index cd625583992277ce1b8103ef38c9287f5c88c51e..8f6c8184f98efb4836c9760f4e76df0ff2bebd7f 100644 (file)
@@ -42,8 +42,7 @@ class HEXOTICPLUGIN_EXPORT HexoticPlugin_Hypothesis_i:
  public:
   // Constructor
   HexoticPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA,
-                             int                     theStudyId,
-                             ::SMESH_Gen*            theGenImpl);
+                              ::SMESH_Gen*            theGenImpl);
   // Destructor
   virtual ~HexoticPlugin_Hypothesis_i();