Salome HOME
Merge changes from 'master' branch. V9_dev V9_0_0
authorrnv <rnv@opencascade.com>
Fri, 29 Dec 2017 13:21:45 +0000 (16:21 +0300)
committerrnv <rnv@opencascade.com>
Fri, 29 Dec 2017 13:21:45 +0000 (16:21 +0300)
31 files changed:
doc/salome/examples/blsurfdemo.py
doc/salome/examples/periodicity_prepro.py
src/BLSURFPlugin/BLSURFPluginBuilder.py
src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx
src/BLSURFPlugin/BLSURFPlugin_BLSURF.hxx
src/BLSURFPlugin/BLSURFPlugin_BLSURF_i.cxx
src/BLSURFPlugin/BLSURFPlugin_BLSURF_i.hxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx
src/BLSURFPlugin/BLSURFPlugin_i.cxx
src/GUI/BLSURFPluginGUI_Dlg.h
src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx
tests/attractor.py
tests/attractor_edge_on_border.py
tests/attractor_point_outside_face.py
tests/enforced_internal_vertex.py
tests/enforced_vertex.py
tests/multithread.py
tests/periodicity_2D_prepro.py
tests/periodicity_reflexion_2D_prepro.py
tests/periodicity_reflexion_prepro.py
tests/periodicity_with_points_2D_prepro.py
tests/prepro_intersections.py
tests/prepro_keep_gaps.py
tests/proximity.py
tests/quadrangles.py
tests/quadrangles_gradation.py
tests/remove_tiny_edges.py
tests/sphere.py

index bececef63477b66753ce663f999f083821596407..4cb045d365746868d08e007dbaa15ad5a3f35e33 100644 (file)
@@ -6,11 +6,11 @@ import salome
 salome.salome_init()
 import GEOM
 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 a box
 box = geompy.MakeBoxDXDYDZ(200., 200., 200.)
@@ -72,8 +72,8 @@ algo2d.SetEnforcedVertex(Face_1, 150, 150, 150)
 
 # Retrieve and print the list of enforced vertices defines on Face_1
 enfList = algo2d.GetEnforcedVertices(Face_1)
-print "List of enforced vertices for Face_1: "
-print enfList
+print("List of enforced vertices for Face_1: ")
+print(enfList)
 
 # compute the mesh
 cadsurfMesh.Compute()
@@ -81,8 +81,8 @@ cadsurfMesh.Compute()
 # Remove an enforced vertex and print the list
 algo2d.UnsetEnforcedVertex(Face_1, 50, 50, 50)
 enfList = algo2d.GetEnforcedVertices(Face_1)
-print "List of enforced vertices for Face_1: "
-print enfList
+print("List of enforced vertices for Face_1: ")
+print(enfList)
 
 # compute the mesh
 cadsurfMesh.Compute()
index c15afcbad1157ad3d0071ddf9a1fc686e7267dad..f901cc12defa9c3bdec2278ba5654f90f3b72bf7 100644 (file)
@@ -5,7 +5,7 @@ import math
 
 import GEOM
 from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
+geompy = geomBuilder.New()
 
 simple = False
 
@@ -90,7 +90,7 @@ geompy.addToStudyInFather(part, sources, "sources")
 
 import SMESH
 from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(salome.myStudy)
+smesh = smeshBuilder.New()
 
 Mesh = smesh.Mesh(part, "Mesh")
 
@@ -136,5 +136,5 @@ checkProjection(gr_right, left_translated)
 checkProjection(gr_back, front_translated)
 checkProjection(gr_top, bottom_translated)
 
-salome.sg.updateObjBrowser(True)
+salome.sg.updateObjBrowser()
 
index 53e2d8e9551d01cb344343c746ff8390cdb4531f..19b197b59cd5f4b9695b53792967fb41315b570f 100644 (file)
@@ -89,7 +89,7 @@ class BLSURF_Algorithm(Mesh_Algorithm):
   def __init__(self, mesh, geom=0):
     Mesh_Algorithm.__init__(self)
     if noBLSURFPlugin:
-      print "Warning: BLSURFPlugin module unavailable"
+      print("Warning: BLSURFPlugin module unavailable")
     if mesh.GetMesh().HasShapeToMesh():
       self.Create(mesh, geom, self.algoType, LIBRARY)
     else:
@@ -193,7 +193,7 @@ class BLSURF_Algorithm(Mesh_Algorithm):
   # <li>PreCAD - by pre-processing with PreCAD a CAD model</li></ul>
   def SetTopology(self, way):
     if way != PreCAD and way != FromCAD:
-      print "Warning: topology mode %d is no longer supported. Mode FromCAD is used."%way
+      print("Warning: topology mode %d is no longer supported. Mode FromCAD is used."%way)
       way = FromCAD
     self.Parameters().SetTopology(way)
     pass
@@ -747,8 +747,7 @@ class BLSURF_Algorithm(Mesh_Algorithm):
           for f in faces:
             ids.append( self.mesh.geompyD.GetSubShapeID( self.mesh.geom, f ))
         else:
-          raise TypeError, \
-            "Face of hyper-patch should be either ID or GEOM_Object, not %s" % type(face)
+          raise TypeError("Face of hyper-patch should be either ID or GEOM_Object, not %s" % type(face))
         pass
       hpl.append( ids )
       pass
@@ -767,7 +766,7 @@ class BLSURF_Algorithm(Mesh_Algorithm):
     """
     Obsolete function. Use SetMinSize.
     """
-    print "Warning: SetPhyMin is obsolete. Please use SetMinSize"
+    print("Warning: SetPhyMin is obsolete. Please use SetMinSize")
     self.SetMinSize(theVal)
     pass
 
@@ -776,7 +775,7 @@ class BLSURF_Algorithm(Mesh_Algorithm):
     """
     Obsolete function. Use SetMaxSize.
     """
-    print "Warning: SetPhyMax is obsolete. Please use SetMaxSize"
+    print("Warning: SetPhyMax is obsolete. Please use SetMaxSize")
     self.SetMaxSize(theVal)
     pass
 
@@ -785,7 +784,7 @@ class BLSURF_Algorithm(Mesh_Algorithm):
     """
     Obsolete function. Use SetAngleMesh.
     """
-    print "Warning: SetAngleMeshS is obsolete. Please use SetAngleMesh"
+    print("Warning: SetAngleMeshS is obsolete. Please use SetAngleMesh")
     self.SetAngleMesh(theVal)
     pass
 
@@ -794,7 +793,7 @@ class BLSURF_Algorithm(Mesh_Algorithm):
     """
     Obsolete function. Use SetAngleMesh.
     """
-    print "Warning: SetAngleMeshC is obsolete. Please use SetAngleMesh"
+    print("Warning: SetAngleMeshC is obsolete. Please use SetAngleMesh")
     self.SetAngleMesh(theVal)
     pass
 
@@ -803,7 +802,7 @@ class BLSURF_Algorithm(Mesh_Algorithm):
     """
     Obsolete function. Use SetMinSize.
     """
-    print "Warning: SetGeoMin is obsolete. Please use SetMinSize"
+    print("Warning: SetGeoMin is obsolete. Please use SetMinSize")
     self.SetMinSize(theVal)
     pass
 
@@ -812,7 +811,7 @@ class BLSURF_Algorithm(Mesh_Algorithm):
     """
     Obsolete function. Use SetMaxSize.
     """
-    print "Warning: SetGeoMax is obsolete. Please use SetMaxSize"
+    print("Warning: SetGeoMax is obsolete. Please use SetMaxSize")
     self.SetMaxSize(theVal)
     pass
 
index 09e3c30e20e69d19d7d6693728c0929560425206..88cd3030898dba6cced734ad08471c449ff5d8c1 100644 (file)
@@ -145,8 +145,7 @@ namespace
   static PyTypeObject PyStdOut_Type = {
     /* The ob_type field must be initialized in the module init function
      * to be portable to Windows without using C++. */
-    PyObject_HEAD_INIT(NULL)
-    0,                            /*ob_size*/
+    PyVarObject_HEAD_INIT(NULL, 0)
     "PyOut",                      /*tp_name*/
     sizeof(PyStdOut),             /*tp_basicsize*/
     0,                            /*tp_itemsize*/
@@ -241,10 +240,9 @@ bool HasSizeMapOnVertex=false;
 //=============================================================================
 
 BLSURFPlugin_BLSURF::BLSURFPlugin_BLSURF(int        hypId,
-                                         int        studyId,
                                          SMESH_Gen* gen,
                                          bool       theHasGEOM)
-  : SMESH_2D_Algo(hypId, studyId, gen)
+  : SMESH_2D_Algo(hypId, gen)
 {
   _name = theHasGEOM ? "MG-CADSurf" : "MG-CADSurf_NOGEOM";//"BLSURF";
   _shapeType = (1 << TopAbs_FACE); // 1 bit /shape type
@@ -257,13 +255,6 @@ BLSURFPlugin_BLSURF::BLSURFPlugin_BLSURF(int        hypId,
   _supportSubmeshes = true;
   _requireShape = theHasGEOM;
 
-  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);
-
   /* Initialize the Python interpreter */
   assert(Py_IsInitialized());
   PyGILState_STATE gstate;
@@ -502,19 +493,16 @@ projectionPoint getProjectionPoint(TopoDS_Face& theFace, const gp_Pnt& thePoint)
 /////////////////////////////////////////////////////////
 TopoDS_Shape BLSURFPlugin_BLSURF::entryToShape(std::string entry)
 {
-  TopoDS_Shape S;
-  if ( !entry.empty() )
-  {
-    GEOM::GEOM_Object_var aGeomObj;
-    SALOMEDS::SObject_var aSObj = myStudy->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() );
-  }
+  GEOM::GEOM_Object_var aGeomObj;
+  TopoDS_Shape S = TopoDS_Shape();
+  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 = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( aGeomObj.in() );
   return S;
 }
 
index 60c5e29cbe805857aaf72bbccaf0789110033f0b..14ff95fb913d5a945f314f86b4293ed9750e7953 100644 (file)
@@ -75,7 +75,7 @@ class TopoDS_Shape;
 
 class BLSURFPlugin_BLSURF: public SMESH_2D_Algo {
   public:
-    BLSURFPlugin_BLSURF(int hypId, int studyId, SMESH_Gen* gen, bool theHasGEOM);
+    BLSURFPlugin_BLSURF(int hypId, SMESH_Gen* gen, bool theHasGEOM);
 
     virtual ~BLSURFPlugin_BLSURF();
 
@@ -159,8 +159,6 @@ class BLSURFPlugin_BLSURF: public SMESH_2D_Algo {
       PyObject *          main_mod;
       PyObject *          main_dict;
       SMESH_MesherHelper* myHelper;
-      SALOMEDS::Study_var myStudy;
-      SMESH_Gen_i*        smeshGen_i;
 
       volatile bool _compute_canceled;
 };
index 947bf7187134092eadc0703aedf663ac93966b58..ea8a9f9d56b4ee638468191b16f81dd86097c679 100644 (file)
@@ -37,7 +37,6 @@
 //=============================================================================
 
 BLSURFPlugin_BLSURF_i::BLSURFPlugin_BLSURF_i( PortableServer::POA_ptr thePOA,
-                                              int                     theStudyId,
                                               ::SMESH_Gen*            theGenImpl,
                                               bool                    theHasGEOM )
      : SALOME::GenericObj_i( thePOA ), 
@@ -46,7 +45,6 @@ BLSURFPlugin_BLSURF_i::BLSURFPlugin_BLSURF_i( PortableServer::POA_ptr thePOA,
        SMESH_2D_Algo_i( thePOA )
 {
   myBaseImpl = new ::BLSURFPlugin_BLSURF( theGenImpl->GetANewId(),
-                                          theStudyId,
                                           theGenImpl,
                                           theHasGEOM);
 }
index 1b3b30db1c50f913c83926aaa7b4857445612d43..8c1d5707dd4e18d00ecd3c525f1a103dbc79cb17 100644 (file)
@@ -41,7 +41,6 @@ class BLSURFPlugin_BLSURF_i:
 public:
   // Constructor
   BLSURFPlugin_BLSURF_i( PortableServer::POA_ptr thePOA,
-                         int                     theStudyId,
                          ::SMESH_Gen*            theGenImpl,
                          bool                    theHasGEOM);
   // Destructor
index 4eed18794c86aa4104f26cd63f8ab379d30e0f47..5472398323d3ee6757a18fc303ead1d8e41c9f56 100644 (file)
@@ -49,8 +49,8 @@ namespace
 }
 
 //=============================================================================
-BLSURFPlugin_Hypothesis::BLSURFPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen, bool hasgeom) :
-  SMESH_Hypothesis(hypId, studyId, gen), 
+BLSURFPlugin_Hypothesis::BLSURFPlugin_Hypothesis(int hypId, SMESH_Gen * gen, bool hasgeom) :
+  SMESH_Hypothesis(hypId, gen), 
   _physicalMesh(GetDefaultPhysicalMesh()),
   _geometricMesh(GetDefaultGeometricMesh()),
   _phySize(GetDefaultPhySize()),
@@ -256,18 +256,16 @@ BLSURFPlugin_Hypothesis::BLSURFPlugin_Hypothesis(int hypId, int studyId, SMESH_G
 TopoDS_Shape BLSURFPlugin_Hypothesis::entryToShape(std::string entry)
 {
   GEOM::GEOM_Object_var aGeomObj;
-  SMESH_Gen_i* smeshGen_i = SMESH_Gen_i::GetSMESHGen();
-  SALOMEDS::Study_ptr myStudy = smeshGen_i->GetCurrentStudy();
   
   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 f44510593f155356210a2d475aba87d5480b4414..390b2f0fc72f54874f5d768fc59d580888cd5c34 100644 (file)
@@ -43,7 +43,7 @@
 class BLSURFPlugin_Hypothesis: public SMESH_Hypothesis
 {
 public:
-  BLSURFPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen, bool hasgeom);
+  BLSURFPlugin_Hypothesis(int hypId, SMESH_Gen * gen, bool hasgeom);
 
   enum Topology {
     FromCAD,
@@ -249,7 +249,7 @@ public:
  */
   
   typedef std::multimap< std::string, BLSURFPlugin_Attractor* > TAttractorMap;
-  typedef std::map< std::string, std::vector<double> > TParamsMap; //TODO Ã  finir 
+  typedef std::map< std::string, std::vector<double> > TParamsMap; //TODO ?? finir 
   
   void SetClassAttractorEntry(const std::string& entry, const std::string& att_entry, double StartSize, double EndSize, double ActionRadius, double ConstantRadius);
   std::string  GetClassAttractorEntry(const std::string& entry);
index db1eb65427b98fc70479ed3e9e44720018443c79..eacff525f777dc7351add61a0267f95fd9e09eaa 100644 (file)
@@ -47,13 +47,12 @@ using namespace std;
  */
 //=============================================================================
 BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i(PortableServer::POA_ptr thePOA,
-                                                     int                     theStudyId,
                                                      ::SMESH_Gen*            theGenImpl,
                                                      bool                    theHasGEOM) :
   SALOME::GenericObj_i(thePOA), SMESH_Hypothesis_i(thePOA)
 {
   myBaseImpl = new ::BLSURFPlugin_Hypothesis(theGenImpl->GetANewId(),
-                                             theStudyId,
+                                             
                                              theGenImpl,
                                              theHasGEOM);
 }
@@ -1776,7 +1775,7 @@ void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry, const char*
 
 //=============================================================================
 
-void BLSURFPlugin_Hypothesis_i::SetClassAttractorEntry(const char* entry, const char* att_entry, CORBA::Double StartSize, CORBA::Double EndSize, CORBA::Double ActionRadius, CORBA::Double ConstantRadius) //TODO Ã  finir
+void BLSURFPlugin_Hypothesis_i::SetClassAttractorEntry(const char* entry, const char* att_entry, CORBA::Double StartSize, CORBA::Double EndSize, CORBA::Double ActionRadius, CORBA::Double ConstantRadius) //TODO ?? finir
   throw (SALOME::SALOME_Exception)
 {
   ASSERT(myBaseImpl);
@@ -1839,7 +1838,7 @@ char* BLSURFPlugin_Hypothesis_i::GetAttractorEntry(const char* entry) throw (SAL
 
 // //=============================================================================
 // 
-// // TODO coder cette fonction (utilisée pour savoir si la valeur a changé
+// // TODO coder cette fonction (utilis??e pour savoir si la valeur a chang??
 // // A finir pour le dump
 // char* BLSURFPlugin_Hypothesis_i::GetClassAttractorEntry(const char* entry)
 //   throw (SALOME::SALOME_Exception)
@@ -2027,13 +2026,12 @@ void BLSURFPlugin_Hypothesis_i::SetAttractorGeom(GEOM::GEOM_Object_ptr theFace,
   theAttEntry  = theAttractor->GetStudyEntry();
   
   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
-  SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
   string aName;
   
   if (theFaceEntry.empty()) {
     aName = "Face_";
     aName += theFace->GetEntry();
-    SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
+    SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
     if (!theSFace->_is_nil())
       theFaceEntry = theSFace->GetID();
   }
@@ -2050,7 +2048,7 @@ void BLSURFPlugin_Hypothesis_i::SetAttractorGeom(GEOM::GEOM_Object_ptr theFace,
     if (theAttractor->GetShapeType() == GEOM::COMPOUND)
       aName = "Compound_";
     aName += theAttractor->GetEntry();
-    SALOMEDS::SObject_wrap theSAtt = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theAttractor, aName.c_str());
+    SALOMEDS::SObject_wrap theSAtt = geomGen->PublishInStudy(NULL, theAttractor, aName.c_str());
     if (!theSAtt->_is_nil())
       theAttEntry = theSAtt->GetID();
   }
@@ -2070,13 +2068,12 @@ void BLSURFPlugin_Hypothesis_i::UnsetAttractorGeom(GEOM::GEOM_Object_ptr theFace
   CORBA::String_var theAttrEntry = theAttractor->GetStudyEntry();
   
   // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
-  // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
   // string aName;
   
   // if (theFaceEntry.empty()) {
   //   aName = "Face_";
   //   aName += theFace->GetEntry();
-  //   SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
+  //   SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
   //   if (!theSFace->_is_nil())
   //     theFaceEntry = theSFace->GetID();
   // }
@@ -2468,14 +2465,13 @@ bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace,
   
   if (theFaceEntry.empty()) {
     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
-    SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
     string aName;
     if (theFace->GetShapeType() == GEOM::FACE)
       aName = "Face_";
     if (theFace->GetShapeType() == GEOM::COMPOUND)
       aName = "Compound_";
     aName += theFace->GetEntry();
-    SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
+    SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
     if (!theSFace->_is_nil())
       theFaceEntry = theSFace->GetID();
   }
@@ -2503,14 +2499,13 @@ bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr the
   
   if (theFaceEntry.empty()) {
     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
-    SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
     string aName;
     if (theFace->GetShapeType() == GEOM::FACE)
       aName = "Face_";
     if (theFace->GetShapeType() == GEOM::COMPOUND)
       aName = "Compound_";
     aName += theFace->GetEntry();
-    SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
+    SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
     if (!theSFace->_is_nil())
       theFaceEntry = theSFace->GetID();
   }
@@ -2540,7 +2535,7 @@ bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theF
   }
 
   //  GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
-  //  GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
+  //  GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations();
   //  if (CORBA::is_nil(measureOp))
   //    return false;
   //
@@ -2552,7 +2547,6 @@ bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theF
   string theVertexEntry = theVertex->GetStudyEntry();
   
   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
-  SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
   string aName;
   
   if (theFaceEntry.empty()) {
@@ -2561,7 +2555,7 @@ bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theF
     if (theFace->GetShapeType() == GEOM::COMPOUND)
       aName = "Compound_";
     aName += theFace->GetEntry();
-    SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
+    SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
     if (!theSFace->_is_nil())
       theFaceEntry = theSFace->GetID();
   }
@@ -2574,7 +2568,7 @@ bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theF
     if (theVertex->GetShapeType() == GEOM::COMPOUND)
       aName = "Compound_";
     aName += theVertex->GetEntry();
-    SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
+    SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
     if (!theSVertex->_is_nil())
       theVertexEntry = theSVertex->GetID();
   }
@@ -2605,14 +2599,13 @@ bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr
   
   if (theFaceEntry.empty()) {
     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
-    SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
     string aName;
     if (theFace->GetShapeType() == GEOM::FACE)
       aName = "Face_";
     if (theFace->GetShapeType() == GEOM::COMPOUND)
       aName = "Compound_";
     aName += theFace->GetEntry();
-    SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
+    SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
     if (!theSFace->_is_nil())
       theFaceEntry = theSFace->GetID();
   }
@@ -2642,14 +2635,13 @@ bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Objec
   
   if (theFaceEntry.empty()) {
     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
-    SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
     string aName;
     if (theFace->GetShapeType() == GEOM::FACE)
       aName = "Face_";
     if (theFace->GetShapeType() == GEOM::COMPOUND)
       aName = "Compound_";
     aName += theFace->GetEntry();
-    SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
+    SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
     if (!theSFace->_is_nil())
       theFaceEntry = theSFace->GetID();
   }
@@ -2682,7 +2674,6 @@ bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object
   string theVertexEntry = theVertex->GetStudyEntry();
   
   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
-  SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
   string aName;
   
   if (theFaceEntry.empty()) {
@@ -2691,7 +2682,7 @@ bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object
     if (theFace->GetShapeType() == GEOM::COMPOUND)
       aName = "Compound_";
     aName += theFace->GetEntry();
-    SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
+    SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
     if (!theSFace->_is_nil())
       theFaceEntry = theSFace->GetID();
   }
@@ -2704,7 +2695,7 @@ bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object
     if (theVertex->GetShapeType() == GEOM::COMPOUND)
       aName = "Compound_";
     aName += theVertex->GetEntry();
-    SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
+    SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
     if (!theSVertex->_is_nil())
       theVertexEntry = theSVertex->GetID();
   }
@@ -2735,14 +2726,13 @@ bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object
   
 //  if (theFaceEntry.empty()) {
 //    GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
-//    SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
 //    string aName;
 //    if (theFace->GetShapeType() == GEOM::FACE)
 //      aName = "Face_";
 //    if (theFace->GetShapeType() == GEOM::COMPOUND)
 //      aName = "Compound_";
 //    aName += theFace->GetEntry();
-//    SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
+//    SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
 //    if (!theSFace->_is_nil())
 //      theFaceEntry = theSFace->GetID();
 //  }
@@ -2771,14 +2761,13 @@ BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVertices(GEO
   
   if (theFaceEntry.empty()) {
     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
-    SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
     string aName;
     if (theFace->GetShapeType() == GEOM::FACE)
       aName = "Face_";
     if (theFace->GetShapeType() == GEOM::COMPOUND)
       aName = "Compound_";
     aName += theFace->GetEntry();
-    SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
+    SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
     if (!theSFace->_is_nil())
       theFaceEntry = theSFace->GetID();
   }
@@ -2804,14 +2793,13 @@ bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFac
   
   if (theFaceEntry.empty()) {
     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
-    SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
     string aName;
     if (theFace->GetShapeType() == GEOM::FACE)
       aName = "Face_";
     if (theFace->GetShapeType() == GEOM::COMPOUND)
       aName = "Compound_";
     aName += theFace->GetEntry();
-    SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
+    SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
     if (!theSFace->_is_nil())
       theFaceEntry = theSFace->GetID();
   }
@@ -2837,7 +2825,7 @@ bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr th
   }
 
   //  GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
-  //  GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
+  //  GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations();
   //  if (CORBA::is_nil(measureOp))
   //    return false;
   //
@@ -2849,7 +2837,6 @@ bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr th
   std::string theVertexEntry = theVertex->GetStudyEntry();
   
   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
-  SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
   string aName;
   
   if (theFaceEntry.empty()) {
@@ -2858,7 +2845,7 @@ bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr th
     if (theFace->GetShapeType() == GEOM::COMPOUND)
       aName = "Compound_";
     aName += theFace->GetEntry();
-    SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
+    SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
     if (!theSFace->_is_nil())
       theFaceEntry = theSFace->GetID();
   }
@@ -2871,7 +2858,7 @@ bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr th
     if (theVertex->GetShapeType() == GEOM::COMPOUND)
       aName = "Compound_";
     aName += theVertex->GetEntry();
-    SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
+    SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
     if (!theSVertex->_is_nil())
       theVertexEntry = theSVertex->GetID();
   }
@@ -2897,14 +2884,13 @@ bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theF
   
   if (theFaceEntry.empty()) {
     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
-    SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
     string aName;
     if (theFace->GetShapeType() == GEOM::FACE)
       aName = "Face_";
     if (theFace->GetShapeType() == GEOM::COMPOUND)
       aName = "Compound_";
     aName += theFace->GetEntry();
-    SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
+    SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
     if (!theSFace->_is_nil())
       theFaceEntry = theSFace->GetID();
   }
@@ -2966,7 +2952,7 @@ bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeom(GEOM::GEOM_Object_ptr theV
     if (theVertex->GetShapeType() == GEOM::COMPOUND)
       aName = "Compound_";
     aName += theVertex->GetEntry();
-    SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
+    SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
     if (!theSVertex->_is_nil())
       theVertexEntry = theSVertex->GetID();
   }
@@ -3034,7 +3020,7 @@ bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeomWithGroup(GEOM::GEOM_Object
     if (theVertex->GetShapeType() == GEOM::COMPOUND)
       aName = "Compound_";
     aName += theVertex->GetEntry();
-    SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
+    SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
     if (!theSVertex->_is_nil())
       theVertexEntry = theSVertex->GetID();
   }
@@ -3076,7 +3062,7 @@ bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr t
     if (theVertex->GetShapeType() == GEOM::COMPOUND)
       aName = "Compound_";
     aName += theVertex->GetEntry();
-    SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
+    SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
     if (!theSVertex->_is_nil())
       theVertexEntry = theSVertex->GetID();
   }
@@ -3353,7 +3339,7 @@ char* BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup()
  if (theFace->GetShapeType() == GEOM::COMPOUND)
  aName = "Compound_";
  aName += theFace->GetEntry();
- SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
+ SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
  if (!theSFace->_is_nil())
  theFaceEntry = theSFace->GetID();
  }
@@ -3493,7 +3479,6 @@ std::string BLSURFPlugin_Hypothesis_i::PublishIfNeeded(GEOM::GEOM_Object_ptr sha
   string shapeEntry = shape->GetStudyEntry();
 
   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
-  SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
   string aName;
 
   // Publish shape if needed
@@ -3501,7 +3486,7 @@ std::string BLSURFPlugin_Hypothesis_i::PublishIfNeeded(GEOM::GEOM_Object_ptr sha
     if (shape->GetShapeType() == theShapeType)
       aName = prefix;
     aName += shape->GetEntry();
-    SALOMEDS::SObject_wrap theSFace1 = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, shape, aName.c_str());
+    SALOMEDS::SObject_wrap theSFace1 = geomGen->PublishInStudy(NULL, shape, aName.c_str());
     if (!theSFace1->_is_nil())
       shapeEntry = theSFace1->GetID();
   }
index e5517d9a4b34d7b54865e18001d109535a98e3ad..7024bbf9dcb2b8af9997224e1ebbea1532ea128f 100644 (file)
@@ -44,7 +44,6 @@ class BLSURFPlugin_Hypothesis_i:
 public:
   // Constructor
   BLSURFPlugin_Hypothesis_i(PortableServer::POA_ptr thePOA,
-                            int                     theStudyId,
                             ::SMESH_Gen*            theGenImpl,
                             bool                    theHasGEOM);
   // Destructor
index 9cefe5c4cb0a3ea9d40bb31486ca3c44e6255c90..9d0296c996a1033271546fc8e03f2f846f325a82 100644 (file)
@@ -42,10 +42,9 @@ class BLSURFPlugin_Creator_i : public GenericHypothesisCreator_i
 {
   // Create a hypothesis
   virtual SMESH_Hypothesis_i* Create(PortableServer::POA_ptr thePOA,
-                                     int                     theStudyId,
                                      ::SMESH_Gen*            theGenImpl)
   {
-    return new T (thePOA, theStudyId, theGenImpl, !NOGEOM);
+    return new T (thePOA, theGenImpl, !NOGEOM);
   }
 
   // as we have 'module BLSURFPlugin' in BLSURFPlugin_Algorithm.idl
index e82becaacefb13b133a69492ea39afa6a5a6419a..b66c1fd8c68a62548f972e82c9147dc7c257de4e 100644 (file)
@@ -62,8 +62,9 @@ enum {
 // BLSURFPluginGUI_StdWidget
 //////////////////////////////////////////
 
-#include "ui_BLSURFPluginGUI_StdWidget_QTD.h"
+// WARNING: include order is important, do not swap !
 #include "BLSURFPluginGUI_HypothesisCreator.h"
+#include "ui_BLSURFPluginGUI_StdWidget_QTD.h"
 
 class BLSURFPLUGIN_GUI_EXPORT BLSURFPluginGUI_StdWidget : public QWidget, 
                                             public Ui::BLSURFPluginGUI_StdWidget_QTD
index 48cf60ceebea38686428e74f9649e8dbc6826bd3..ecd3942730b598ad46b0bc5dff72e522bf368f76 100644 (file)
@@ -225,8 +225,7 @@ namespace {
   static PyTypeObject PyStdOut_Type = {
     /* The ob_type field must be initialized in the module init function
      * to be portable to Windows without using C++. */
-    PyObject_HEAD_INIT(NULL)
-    0,                            /*ob_size*/
+    PyVarObject_HEAD_INIT(NULL, 0)
     "PyOut",                      /*tp_name*/
     sizeof(PyStdOut),             /*tp_basicsize*/
     0,                            /*tp_itemsize*/
@@ -475,9 +474,8 @@ BLSURFPluginGUI_HypothesisCreator::~BLSURFPluginGUI_HypothesisCreator()
 GeomSelectionTools* BLSURFPluginGUI_HypothesisCreator::getGeomSelectionTool() const
 {
   BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
-  _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
-  if (that->GeomToolSelected == NULL || that->GeomToolSelected->getMyStudy() != aStudy) {
-    that->GeomToolSelected = new GeomSelectionTools(aStudy);
+  if (that->GeomToolSelected == NULL) {
+    that->GeomToolSelected = new GeomSelectionTools();
   }
   return that->GeomToolSelected;
 }
@@ -1301,7 +1299,7 @@ void BLSURFPluginGUI_HypothesisCreator::onSelectEnforcedVertex() {
     myEnfVertex = myEnfVertexWdg->GetObject< GEOM::GEOM_Object >(nbSelEnfVertex-1);
     if (myEnfVertex->GetShapeType() == GEOM::VERTEX) {
       BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
-      GEOM::GEOM_IMeasureOperations_var measureOp = getGeomEngine()->GetIMeasureOperations( that->getGeomSelectionTool()->getMyStudy()->StudyId() );
+      GEOM::GEOM_IMeasureOperations_var measureOp = getGeomEngine()->GetIMeasureOperations();
       if (CORBA::is_nil(measureOp))
         return;
       
@@ -1488,7 +1486,7 @@ void BLSURFPluginGUI_HypothesisCreator::onAddEnforcedVertices()
       if ( CORBA::is_nil(getGeomEngine()))
         return;
 
-      GEOM::GEOM_IMeasureOperations_var measureOp = getGeomEngine()->GetIMeasureOperations( that->getGeomSelectionTool()->getMyStudy()->StudyId() );
+      GEOM::GEOM_IMeasureOperations_var measureOp = getGeomEngine()->GetIMeasureOperations();
       if (CORBA::is_nil(measureOp))
         return;
 
@@ -3443,10 +3441,8 @@ LightApp_SelectionMgr* BLSURFPluginGUI_HypothesisCreator::selectionMgr()
 
 CORBA::Object_var BLSURFPluginGUI_HypothesisCreator::entryToObject(QString entry)
 {
-  SMESH_Gen_i* smeshGen_i = SMESH_Gen_i::GetSMESHGen();
-  SALOMEDS::Study_var myStudy = smeshGen_i->GetCurrentStudy();
   CORBA::Object_var obj;
-  SALOMEDS::SObject_var aSObj = myStudy->FindObjectID( entry.toStdString().c_str() );
+  SALOMEDS::SObject_var aSObj = SMESH_Gen_i::getStudyServant()->FindObjectID( entry.toStdString().c_str() );
   if (!aSObj->_is_nil()) {
     obj = aSObj->GetObject();
     aSObj->UnRegister();
index fd69c4c5b8018f4897076755dbc5c3f31b51f24a..5b641499794886c7f797605203b14dcd83a8c0ab 100644 (file)
@@ -4,7 +4,6 @@ import sys
 import salome
 
 salome.salome_init()
-theStudy = salome.myStudy
 
 import  SMESH, SALOMEDS
 
@@ -24,7 +23,7 @@ import math
 import SALOMEDS
 
 
-geompy = geomBuilder.New(theStudy)
+geompy = geomBuilder.New()
 
 O = geompy.MakeVertex(0, 0, 0)
 OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
@@ -45,7 +44,7 @@ geompy.addToStudy( Circle_1, 'Circle_1' )
 
 from salome.smesh import smeshBuilder
 
-smesh = smeshBuilder.New(theStudy)
+smesh = smeshBuilder.New()
 Mesh_1 = smesh.Mesh(Face_1)
 MG_CADSurf = Mesh_1.Triangle(algo=smeshBuilder.MG_CADSurf)
 MG_CADSurf_Parameters_1 = MG_CADSurf.Parameters()
@@ -59,7 +58,7 @@ Mesh_1.Compute()
 
 min_area_without_attractor = getMinArea(Mesh_1)
 
-print "min_area_without_attractor: ", min_area_without_attractor
+print("min_area_without_attractor: ", min_area_without_attractor)
 
 MG_CADSurf_Parameters_1.SetAttractorGeom( Face_1, Circle_1, 1, 14.1421, 5, 5 )
 
@@ -67,7 +66,7 @@ Mesh_1.Compute()
 
 min_area_with_attractor = getMinArea(Mesh_1)
 
-print "min_area_with_attractor: ", min_area_with_attractor
+print("min_area_with_attractor: ", min_area_with_attractor)
 
 assert min_area_with_attractor < min_area_without_attractor
 
index c10597c72c4225e7409cce5edae789b180e5e781..cbb71b276cabd7a52e63467253e3ab04333172bd 100644 (file)
@@ -4,7 +4,6 @@ import sys
 import salome
 
 salome.salome_init()
-theStudy = salome.myStudy
 
 import  SMESH, SALOMEDS
 
@@ -24,7 +23,7 @@ import math
 import SALOMEDS
 
 
-geompy = geomBuilder.New(theStudy)
+geompy = geomBuilder.New()
 
 O = geompy.MakeVertex(0, 0, 0)
 OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
@@ -53,7 +52,7 @@ geompy.addToStudyInFather(Box_1, sub_Face_1, "Face_1")
 
 from salome.smesh import smeshBuilder
 
-smesh = smeshBuilder.New(theStudy)
+smesh = smeshBuilder.New()
 Mesh_1 = smesh.Mesh(Box_1)
 MG_CADSurf = Mesh_1.Triangle(algo=smeshBuilder.MG_CADSurf)
 MG_CADSurf_Parameters_1 = MG_CADSurf.Parameters()
@@ -67,7 +66,7 @@ Mesh_1.Compute()
 
 min_area_without_attractor = getMinArea(Mesh_1)
 
-print "min_area_without_attractor: ", min_area_without_attractor
+print("min_area_without_attractor: ", min_area_without_attractor)
 
 MG_CADSurf_Parameters_1.SetAttractorGeom( sub_Face_1, Edge_1, 1, 14.1421, 5, 5 )
 
@@ -75,7 +74,7 @@ Mesh_1.Compute()
 
 min_area_with_attractor = getMinArea(Mesh_1)
 
-print "min_area_with_attractor: ", min_area_with_attractor
+print("min_area_with_attractor: ", min_area_with_attractor)
 
 assert min_area_with_attractor < min_area_without_attractor
 
index 9513ac3c650e0106ffccad3c7bef6302afca8452..369cda2055e0c0c7e53be0d942ff1f853b2d5006 100644 (file)
@@ -4,7 +4,6 @@ import sys
 import salome
 
 salome.salome_init()
-theStudy = salome.myStudy
 
 import  SMESH, SALOMEDS
 
@@ -24,7 +23,7 @@ import math
 import SALOMEDS
 
 
-geompy = geomBuilder.New(theStudy)
+geompy = geomBuilder.New()
 
 O = geompy.MakeVertex(0, 0, 0)
 OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
@@ -71,7 +70,7 @@ geompy.addToStudyInFather(Part_1, face_2, "face_2")
 
 from salome.smesh import smeshBuilder
 
-smesh = smeshBuilder.New(theStudy)
+smesh = smeshBuilder.New()
 Mesh_1 = smesh.Mesh(Part_1)
 MG_CADSurf = Mesh_1.Triangle(algo=smeshBuilder.MG_CADSurf)
 MG_CADSurf_Parameters_1 = MG_CADSurf.Parameters()
@@ -88,7 +87,7 @@ if not ok:
 
 min_area_without_attractor = getMinArea(Mesh_1)
 
-print "min_area_without_attractor: ", min_area_without_attractor
+print("min_area_without_attractor: ", min_area_without_attractor)
 
 MG_CADSurf_Parameters_1.SetAttractorGeom( face_1, edge_vert_opp_1, 1, 14.1421, 5, 5 )
 # the attractor is not on the face. It is done on purpose to test this out of bounds case.
@@ -101,7 +100,7 @@ if not ok:
 
 min_area_with_attractor = getMinArea(Mesh_1)
 
-print "min_area_with_attractor: ", min_area_with_attractor
+print("min_area_with_attractor: ", min_area_with_attractor)
 
 assert min_area_with_attractor < min_area_without_attractor
 
index 5459def29e8e7fb5f2573ca878c4b71882dba258..574101d9e71a736c277a4d0276192d16d9ce5e90 100644 (file)
@@ -5,7 +5,7 @@ import math
 
 import GEOM
 from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
+geompy = geomBuilder.New()
 
 r = 10
 dist = 10
@@ -31,7 +31,7 @@ geompy.addToStudyInFather(box, left, "left")
 
 import SMESH
 from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(salome.myStudy)
+smesh = smeshBuilder.New()
 
 Mesh = smesh.Mesh(part, "Mesh")
 
@@ -50,5 +50,5 @@ x, y, z = Mesh.GetNodeXYZ(id_node)
 
 assert("%.2f, %.2f, %.2f"%(x, y, z) == "%.2f, %.2f, %.2f"%(dist_coin, 0, dist_coin))
 
-salome.sg.updateObjBrowser(True)
+salome.sg.updateObjBrowser()
 
index a96de400db33120837d4f35ac998d430e3991dfd..1f5470b8fdaa11c915afe77a1e72abe9dde0e5de 100644 (file)
@@ -5,7 +5,7 @@ import math
 
 import GEOM
 from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
+geompy = geomBuilder.New()
 
 dist_coin = 10.1
 
@@ -40,7 +40,7 @@ xyz7 = allEnforcedCoords[4]
 
 import SMESH
 from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(salome.myStudy)
+smesh = smeshBuilder.New()
 
 Mesh = smesh.Mesh(box, "Mesh")
 
@@ -68,4 +68,5 @@ for x,y,z in allEnforcedCoords:
         "%.2f, %.2f, %.2f != %.2f, %.2f, %.2f"%( xn, yn, zn, x,y,z )
 
 
-salome.sg.updateObjBrowser(True)
+salome.sg.updateObjBrowser()
+
index 06bf12cc3961d1bbdb1d97a587cf66b1435dfba0..7c4d67aef44443774bd5f88a59cc746f27a78438 100644 (file)
@@ -7,12 +7,11 @@ import time
 import multiprocessing
 
 salome.salome_init()
-theStudy = salome.myStudy
 
 cpu_count = multiprocessing.cpu_count()
 divider = min(4, cpu_count)/2.
 
-print "Running test on workstation with %d available cores" % cpu_count
+print ("Running test on workstation with %d available cores" % cpu_count)
 
 ###
 ### GEOM component
@@ -24,7 +23,7 @@ import math
 import SALOMEDS
 
 
-geompy = geomBuilder.New(theStudy)
+geompy = geomBuilder.New()
 
 O = geompy.MakeVertex(0, 0, 0)
 OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
@@ -44,7 +43,7 @@ geompy.addToStudy( flight_solid_brep_1, 'flight_solid.brep_1' )
 import  SMESH, SALOMEDS
 from salome.smesh import smeshBuilder
 
-smesh = smeshBuilder.New(theStudy)
+smesh = smeshBuilder.New()
 
 Mesh_1 = smesh.Mesh(flight_solid_brep_1)
 MG_CADSurf = Mesh_1.Triangle(algo=smeshBuilder.MG_CADSurf)
@@ -63,7 +62,7 @@ time1 = time.time()
 
 time_multithread = time1-time0
 
-print "Time in multi thread (%d cores): %.3s"%(cpu_count, time_multithread)
+print ("Time in multi thread (%d cores): %.3s"%(cpu_count, time_multithread))
 
 Mesh_2 = smesh.Mesh(flight_solid_brep_1)
 MG_CADSurf = Mesh_2.Triangle(algo=smeshBuilder.MG_CADSurf)
@@ -81,10 +80,10 @@ isDone = Mesh_2.Compute()
 time3 = time.time()
 
 time_singlethread = time3-time2
-print "Time in single thread (1 proc): %.3s"%(time_singlethread)
+print ("Time in single thread (1 proc): %.3s"%(time_singlethread))
 
 if cpu_count == 1:
-    print "Warning: cannot validate test - only 1 cpu core is available"
+    print ("Warning: cannot validate test - only 1 cpu core is available")
 else:
     assert time_multithread < time_singlethread/divider
 
index 0bad8e8ec950c9d883a8ccd6f323e4af65cc7462..771a0fc8b841576b2c9f44254ebf7a94d891cf4b 100644 (file)
@@ -11,7 +11,7 @@ import math
 
 import GEOM
 from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
+geompy = geomBuilder.New()
 
 O = geompy.MakeVertex(0, 0, 0)
 OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
@@ -61,7 +61,7 @@ geompy.addToStudyInFather(part, source_face, "source_face")
 
 import SMESH
 from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(salome.myStudy)
+smesh = smeshBuilder.New()
 
 Mesh = smesh.Mesh(part, "Mesh")
 
@@ -107,4 +107,4 @@ checkProjection(gr_right, left_translated)
 checkProjection(gr_top, bottom_translated)
 
 if salome.sg.hasDesktop():
-  salome.sg.updateObjBrowser(True)
+  salome.sg.updateObjBrowser()
index f8674fe978001000a99c1862a94f4bfbb482ed2e..ba6853e344d3b06e6c3564b37850fce3012ba182 100644 (file)
@@ -11,7 +11,7 @@ import math
 
 import GEOM
 from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
+geompy = geomBuilder.New()
 
 O = geompy.MakeVertex(0, 0, 0)
 OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
@@ -74,7 +74,7 @@ geompy.addToStudy(p_haut_droite, "p_haut_droite")
 
 import SMESH
 from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(salome.myStudy)
+smesh = smeshBuilder.New()
 
 Mesh = smesh.Mesh(part, "Mesh")
 
@@ -115,12 +115,12 @@ def checkProjection(gr, mesh_translated, tol=1e-7):
         non_coincident_nodes = list(set(mesh_nodes) - set(coincident_nodes))
         mesh_check.MakeGroupByIds("non_coincident_nodes", SMESH.NODE, non_coincident_nodes)
         #raise Exception("Projection failed for %s"%name)
-        print "Projection failed for %s"%name
+        print("Projection failed for %s"%name)
         
 checkProjection(gr_right, bottom_rotated)
 
-#salome.myStudyManager.SaveAs("test.hdf", salome.myStudy, 0)
+#salome.myStudy.SaveAs("test.hdf", 0, 0)
 
 if salome.sg.hasDesktop():
-  salome.sg.updateObjBrowser(True)
+  salome.sg.updateObjBrowser()
   
index 8c9d7cdad1e5163635c354cced86ac77d9c3dd3d..2eeb6e9ce19ae58e1021ca2c1014852eb3570fdf 100644 (file)
@@ -6,7 +6,7 @@ import math
 
 import GEOM
 from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
+geompy = geomBuilder.New()
 
 simple = False
 
@@ -77,7 +77,7 @@ geompy.addToStudy(p5, "p5")
 
 import SMESH
 from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(salome.myStudy)
+smesh = smeshBuilder.New()
 
 Mesh = smesh.Mesh(part, "Mesh")
 
@@ -118,5 +118,5 @@ def checkProjection(gr, mesh_translated, tol=1e-7):
         
 checkProjection(gr_front, left_rotated)
 
-salome.sg.updateObjBrowser(True)
+salome.sg.updateObjBrowser()
 
index 3dbc01dd6aa8936614858801856cc8a24f26641a..f0b12c6b88b48e7c67520f8c3840cd93f1b3d68a 100644 (file)
@@ -11,7 +11,7 @@ import math
 
 import GEOM
 from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
+geompy = geomBuilder.New()
 
 O = geompy.MakeVertex(0, 0, 0)
 OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
@@ -73,7 +73,7 @@ geompy.addToStudy(p_haut_droite, "p_haut_droite")
 
 import SMESH
 from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(salome.myStudy)
+smesh = smeshBuilder.New()
 
 Mesh = smesh.Mesh(part, "Mesh")
 
@@ -120,6 +120,6 @@ def checkProjection(gr, mesh_translated, tol=1e-7):
 checkProjection(gr_top, bottom_translated)
 
 if salome.sg.hasDesktop():
-  salome.sg.updateObjBrowser(True)
+  salome.sg.updateObjBrowser()
   
 
index 47eef3df6b88b55a976134b9d180e26afb331178..080594950a7ec55ad539760a69858d1bc8a5469f 100644 (file)
@@ -4,7 +4,6 @@ import sys
 import salome
 
 salome.salome_init()
-theStudy = salome.myStudy
 
 ###
 ### GEOM component
@@ -12,10 +11,10 @@ theStudy = salome.myStudy
 
 import GEOM
 from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
+geompy = geomBuilder.New()
 
 
-geompy.init_geom(theStudy)
+geompy.init_geom()
 
 Face_1 = geompy.MakeFaceHW(10, 10, 1)
 Translation_1 = geompy.MakeTranslation(Face_1, 10.0001, 0.0001, 0)
@@ -39,7 +38,7 @@ geompy.addToStudyInFather(Partition_1, gr_vertices, "vertices")
 
 import SMESH
 from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(salome.myStudy)
+smesh = smeshBuilder.New()
 
 
 Mesh_1 = smesh.Mesh(Partition_1)
@@ -67,4 +66,4 @@ nodesGroup = Mesh_1.MakeGroupByIds("nodes", SMESH.NODE, nodes)
 assert nodesGroup.Size() == 1, nodesGroup.GetIDs()
 
 if salome.sg.hasDesktop():
-  salome.sg.updateObjBrowser(True)
+  salome.sg.updateObjBrowser()
index 4ca8a068137e4a15c36f227ed8f1a4225647deef..242cbfb8687e4ab8c31f9eea1f21fa1eca18efb1 100644 (file)
@@ -4,7 +4,6 @@ import sys
 import salome
 
 salome.salome_init()
-theStudy = salome.myStudy
 
 ###
 ### GEOM component
@@ -12,10 +11,10 @@ theStudy = salome.myStudy
 
 import GEOM
 from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
+geompy = geomBuilder.New()
 
 
-geompy.init_geom(theStudy)
+geompy.init_geom()
 
 Face_1 = geompy.MakeFaceHW(10, 10, 1)
 Translation_1 = geompy.MakeTranslation(Face_1, 10.0001, 0.0001, 0)
@@ -39,7 +38,7 @@ geompy.addToStudyInFather(Partition_1, gr_vertices, "vertices")
 
 import SMESH
 from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(salome.myStudy)
+smesh = smeshBuilder.New()
 
 
 Mesh_1 = smesh.Mesh(Partition_1)
@@ -65,4 +64,4 @@ Mesh_1.MakeGroupByIds("nodes", SMESH.NODE, nodes)
 assert len(nodes) == 3, "We should have 3 nodes. We got %i. => The preprocessing has done something, but we did not ask him to."%len(nodes)
 
 if salome.sg.hasDesktop():
-  salome.sg.updateObjBrowser(True)
+  salome.sg.updateObjBrowser()
index a649832c8aa9490716ee154654ce806ee6251ded..5a0230fe49d8408c3c03fcbc23a2292a788d1919 100644 (file)
@@ -4,7 +4,6 @@ import sys
 import salome
 
 salome.salome_init()
-theStudy = salome.myStudy
 
 ###
 ### GEOM component
@@ -16,7 +15,7 @@ import math
 import SALOMEDS
 
 
-geompy = geomBuilder.New(theStudy)
+geompy = geomBuilder.New()
 
 # Create a box
 box = geompy.MakeBoxDXDYDZ(100, 100, 100)
@@ -50,7 +49,7 @@ geompy.addToStudyInFather(part, gr_spheres_faces, "spheres_faces")
 import  SMESH, SALOMEDS
 from salome.smesh import smeshBuilder
 
-smesh = smeshBuilder.New(theStudy)
+smesh = smeshBuilder.New()
 Mesh_1 = smesh.Mesh(part, "Mesh_part")
 BLSURF = Mesh_1.Triangle(algo=smeshBuilder.BLSURF)
 BLSURF_Parameters_1 = BLSURF.Parameters()
@@ -80,10 +79,10 @@ gr_mesh_spheres = Mesh_1.Group(gr_spheres_faces)
 # Check the minimal area of the box faces to check the proximity
 min_area, max_area = Mesh_1.GetMinMax(SMESH.FT_Area, gr_mesh_box)
 
-print "min_area: ", min_area
+print("min_area: ", min_area)
 
 if min_area > 1.5:
     raise Exception("Wrong minimal area on box. Proximity has not worked.")
 
 if salome.sg.hasDesktop():
-  salome.sg.updateObjBrowser(True)
+  salome.sg.updateObjBrowser()
index bb1e0c34f8c261a36940e536bf15c5d8c69735bb..3c5b86eac888e9a54830b2628d8640157a501702 100644 (file)
@@ -4,7 +4,6 @@ import sys
 import salome
 
 salome.salome_init()
-theStudy = salome.myStudy
 
 ###
 ### GEOM component
@@ -16,7 +15,7 @@ import math
 import SALOMEDS
 
 
-geompy = geomBuilder.New(theStudy)
+geompy = geomBuilder.New()
 
 O = geompy.MakeVertex(0, 0, 0)
 OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
@@ -42,7 +41,7 @@ from salome.smesh import smeshBuilder
 
 from salome.BLSURFPlugin import BLSURFPluginBuilder
 
-smesh = smeshBuilder.New(theStudy)
+smesh = smeshBuilder.New()
 Mesh_1 = smesh.Mesh(Partition_1)
 MG_CADSurf = Mesh_1.Triangle(algo=smeshBuilder.MG_CADSurf)
 MG_CADSurf_Parameters_1 = MG_CADSurf.Parameters()
index 264fd8f266207c5ac96787d785badbd81b773792..c11280d3a0daedba5d247220534a80dcf18f7895 100644 (file)
@@ -4,7 +4,7 @@ import salome
 
 import GEOM
 from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
+geompy = geomBuilder.New()
 
 import math
 
@@ -76,7 +76,7 @@ for i, face in enumerate(faces):
 
 import SMESH
 from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(salome.myStudy)
+smesh = smeshBuilder.New()
 
 # Test gradation with quadrangles
 Mesh_1 = smesh.Mesh(part, "Mesh")
@@ -150,6 +150,6 @@ if abs(nb_faces_2-nb_faces_2_ref) > nb_faces_tolerance:
   raise Exception("Number of faces of Mesh_2 incorrect")
 
 if salome.sg.hasDesktop():
-  salome.sg.updateObjBrowser(True)
+  salome.sg.updateObjBrowser()
 
 
index 0b61607876df3b08d9aefbf585d57c27ea2fe647..9bb6904dbe9517ed1b9f3788cfa80c7e1c223502 100644 (file)
@@ -4,7 +4,7 @@ import salome
 
 import GEOM
 from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
+geompy = geomBuilder.New()
 
 import math
 
@@ -64,7 +64,7 @@ for i, face in enumerate(faces):
 
 import SMESH
 from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(salome.myStudy)
+smesh = smeshBuilder.New()
 
 Mesh = smesh.Mesh(part, "Mesh")
 
@@ -100,10 +100,10 @@ for elem in elems:
 min_length = min(edges_length)
 x1, y1, z1 = Mesh.GetNodeXYZ(node)
 
-print min_length
+print(min_length)
 
 if min_length<tiny_edge_length:
     raise Exception("Small edge has not been removed")
 
 if salome.sg.hasDesktop():
-  salome.sg.updateObjBrowser(True)
+  salome.sg.updateObjBrowser()
index ac4b96d9a67230bd824ce39934bf6bf23a926c75..8734c63d126b2545f72f4c2bdd71b224c14d166c 100644 (file)
@@ -4,7 +4,6 @@ import sys
 import salome
 
 salome.salome_init()
-theStudy = salome.myStudy
 
 ###
 ### GEOM component
@@ -12,10 +11,10 @@ theStudy = salome.myStudy
 
 import GEOM
 from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
+geompy = geomBuilder.New()
 
 
-geompy.init_geom(theStudy)
+geompy.init_geom()
 
 sphere = geompy.MakeSphereR(10)
 geompy.addToStudy( sphere, 'sphere' )
@@ -26,7 +25,7 @@ geompy.addToStudy( sphere, 'sphere' )
 
 import SMESH
 from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(salome.myStudy)
+smesh = smeshBuilder.New()
 
 
 Mesh_1 = smesh.Mesh(sphere)
@@ -50,7 +49,7 @@ try:
     if not ok:
         raise Exception("Error when computing volume mesh")
 except AttributeError:
-    print "Warning: Cannot build volume mesh: MG-Tetra plugin seems to be unavailable"
+    print("Warning: Cannot build volume mesh: MG-Tetra plugin seems to be unavailable")
 
 if salome.sg.hasDesktop():
-  salome.sg.updateObjBrowser(True)
+  salome.sg.updateObjBrowser()