]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
- Modifing Geometry and Mesh Python scripts from SALOME 6 and before
authormpa <mpa@opencascade.com>
Tue, 19 Nov 2013 11:13:19 +0000 (11:13 +0000)
committermpa <mpa@opencascade.com>
Tue, 19 Nov 2013 11:13:19 +0000 (11:13 +0000)
src/SalomeApp/pluginsdemo/salome_plugins.py
src/SalomeApp/pluginsdemo/trihedron.py
src/SalomeApp/pluginsdemo/tubebuilder.py

index 52894c81c9b6d2287963fc4f1665b4b0725ae7a4..b6e27185c86a7d3e34ded7130e4c35f7e756f28d 100755 (executable)
@@ -26,7 +26,13 @@ DEMO_IS_ACTIVATED = False
 if DEMO_IS_ACTIVATED:
   # Check that GEOM and SMESH modules are present
   try:
-    import geompy, smesh
+    import GEOM
+    from salome.geom import geomBuilder
+    geompy = geomBuilder.New(salome.myStudy)
+    
+    import SMESH, SALOMEDS
+    from salome.smesh import smeshBuilder
+    smesh =  smeshBuilder.New(salome.myStudy)
   except:
     DEMO_IS_ACTIVATED = False
 
@@ -38,11 +44,12 @@ if DEMO_IS_ACTIVATED:
   import salome
 
   def trihedron(context):
-      import geompy
+      import GEOM
+      from salome.geom import geomBuilder
 
       # Intialize the geompy factory with the active study
       activeStudy = context.study
-      geompy.init_geom(activeStudy)
+      geompy = geomBuilder.New(activeStudy)
 
       # Create the objects
       Vx = geompy.MakeVectorDXDYDZ(10, 0, 0)
@@ -65,11 +72,12 @@ if DEMO_IS_ACTIVATED:
   # -------------------------------------------------------------------------
   # Example 1 bis: creation of basic objects and automatic display
   def trihedron_withdisplay(context):
-      import geompy
+      import GEOM
+      from salome.geom import geomBuilder
 
       # Intialize the geompy factory with the active study
       activeStudy = context.study
-      geompy.init_geom(activeStudy)
+      geompy = geomBuilder.New(activeStudy)
 
       # Create the objects
       Vx = geompy.MakeVectorDXDYDZ(10, 0, 0)
index e7e66c66aa30164b5efccb6727318aa2c62dbb58..575f51c18770e50b03598afdf85a3c5a054edd58 100644 (file)
 #
 
 # Intialize the geompy factory with the active study
-import geompy
 import salome
-geompy.init_geom(salome.myStudy)
+
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
 
 # Create the objects
 Vx = geompy.MakeVectorDXDYDZ(10, 0, 0)
index be8a01f8e79dfcda419e7931fd5aefa98607ed17..0a94cfa683280f236d4d36dc64fc3dafd8ef669e 100644 (file)
@@ -65,9 +65,10 @@ def createGeometryWithPartition(study, radius=DEFAULT_RADIUS, length=DEFAULT_LEN
 def createMesh(study, shape):
     '''This function creates the mesh of the specified shape on the specified study'''
     print "TUBE: creating the mesh ..."
-    import smesh
+    import SMESH
+    from salome.smesh import smeshBuilder
+    smesh = smeshBuilder.New(study)
 
-    smesh.SetCurrentStudy(study)
     mesh = smesh.Mesh(shape)
     Regular_1D = mesh.Segment()
     Nb_Segments = Regular_1D.NumberOfSegments(10)