From cf4b329610f8c3ae4b77edd0449153bca117efa3 Mon Sep 17 00:00:00 2001 From: mpa Date: Tue, 19 Nov 2013 11:13:19 +0000 Subject: [PATCH] - Modifing Geometry and Mesh Python scripts from SALOME 6 and before --- src/SalomeApp/pluginsdemo/salome_plugins.py | 18 +++++++++++++----- src/SalomeApp/pluginsdemo/trihedron.py | 6 ++++-- src/SalomeApp/pluginsdemo/tubebuilder.py | 5 +++-- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/SalomeApp/pluginsdemo/salome_plugins.py b/src/SalomeApp/pluginsdemo/salome_plugins.py index 52894c81c..b6e27185c 100755 --- a/src/SalomeApp/pluginsdemo/salome_plugins.py +++ b/src/SalomeApp/pluginsdemo/salome_plugins.py @@ -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) diff --git a/src/SalomeApp/pluginsdemo/trihedron.py b/src/SalomeApp/pluginsdemo/trihedron.py index e7e66c66a..575f51c18 100644 --- a/src/SalomeApp/pluginsdemo/trihedron.py +++ b/src/SalomeApp/pluginsdemo/trihedron.py @@ -22,9 +22,11 @@ # # 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) diff --git a/src/SalomeApp/pluginsdemo/tubebuilder.py b/src/SalomeApp/pluginsdemo/tubebuilder.py index be8a01f8e..0a94cfa68 100644 --- a/src/SalomeApp/pluginsdemo/tubebuilder.py +++ b/src/SalomeApp/pluginsdemo/tubebuilder.py @@ -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) -- 2.39.2