]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
TODO : Move myStudy from GEOM to KERNEL
authorAnthony Geay <anthony.geay@edf.fr>
Wed, 13 Jan 2021 15:45:47 +0000 (16:45 +0100)
committerAnthony Geay <anthony.geay@edf.fr>
Wed, 13 Jan 2021 15:45:47 +0000 (16:45 +0100)
src/GEOM_SWIG/CMakeLists.txt
src/GEOM_SWIG/GeomHelper.cxx
src/GEOM_SWIG/GeomHelper.h
src/GEOM_SWIG/GeomHelper.i
src/GEOM_SWIG/geomBuilder.py

index d3c4aeb3cb048a8c1b2aeb01a22e70e20c8b465c..e506f9020c2dcb186cc0b7cac59a8c535809e537 100644 (file)
@@ -141,7 +141,7 @@ IF(${CMAKE_VERSION} VERSION_LESS "3.8.0")
 ELSE()
   SWIG_ADD_LIBRARY(GeomHelper LANGUAGE python SOURCES ${GeomHelper_SOURCES})
 ENDIF()
-SWIG_LINK_LIBRARIES(GeomHelper ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} GEOMEngine )
+SWIG_LINK_LIBRARIES(GeomHelper ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} GEOMEngine ${KERNEL_SalomeKernelHelpers} ${KERNEL_SalomeDS} )
 install(TARGETS _GeomHelper DESTINATION ${SALOME_INSTALL_LIBS})
 install(FILES ${GeomHelper_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
 SALOME_INSTALL_SCRIPTS("${_swig_SCRIPTS}"  ${SALOME_INSTALL_BINS} EXTRA_DPYS "${SWIG_MODULE_GeomHelper_REAL_NAME}")
index f68bb062ff22d12844fb09d3c2081af68ff5a580..25b717079c7127526ef93a1d573d3e8861045cab 100644 (file)
@@ -21,6 +21,8 @@
 
 #include "GEOM_Gen_i.hh"
 #include "SALOME_Container_i.hxx"
+#include "SALOME_KernelServices.hxx"
+#include "SALOMEDS_Study_i.hxx"
 
 #include <cstring>
 
@@ -50,3 +52,11 @@ std::string BuildGEOMInstance()
     CORBA::String_var ior = orb->object_to_string(zeRef);
     return std::string(ior.in());
 }
+
+std::string GetSessionInstance()
+{
+    SALOMEDS::Study_var study = KERNEL::getStudyServantSA();
+    CORBA::ORB_ptr orb = KERNEL::getORB();
+    CORBA::String_var ior = orb->object_to_string(study);
+    return std::string(ior.in());
+}
index 09bb194222f5348c3a15b71083b3da158ce74580..0224e0c1fee7338c92f6951fdee3c74420c8867d 100644 (file)
@@ -20,3 +20,4 @@
 #include <string>
 
 std::string BuildGEOMInstance();
+std::string GetSessionInstance();
\ No newline at end of file
index 64d70cad9558997bedbb296750bae1d16c82f682..735be9c2da95b704478b287b819ff157db826c63 100644 (file)
 %inline
 {
   std::string BuildGEOMInstance();
+  std::string GetSessionInstance();
 }
+%pythoncode %{
+
+def myStudy():
+  import SALOMEDS
+  import CORBA
+  orb=CORBA.ORB_init([''])
+  return orb.string_to_object(GetSessionInstance())
+
+%}
\ No newline at end of file
index 95e3952cba53f53395cbb7ae38f123c3c3c77661..2e256ddb9305388ed3382b1bd73ebe3f0730e976 100644 (file)
@@ -837,7 +837,8 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
         ## @addtogroup l1_geomBuilder_auxiliary
         ## @{
         def init_geom(self):
-            self.myStudy = salome.myStudy
+            import GeomHelper
+            self.myStudy = GeomHelper.myStudy()
             self.myBuilder = self.myStudy.NewBuilder()
 
             # load data from the study file, if necessary