From c29074906584bb5aaaa2b466a0674aca1f9b1d76 Mon Sep 17 00:00:00 2001 From: mpa Date: Tue, 19 Nov 2013 10:59:37 +0000 Subject: [PATCH] - Modifing Geometry and Mesh Python scripts from SALOME 6 and before --- doc/salome/gui/input/using_pluginsmanager.doc | 17 ++++++---- src/SalomeApp/pluginsdemo/minmax_plugin.py | 32 ++++++++++--------- 2 files changed, 27 insertions(+), 22 deletions(-) diff --git a/doc/salome/gui/input/using_pluginsmanager.doc b/doc/salome/gui/input/using_pluginsmanager.doc index c8e5ec6c0..8d9214828 100644 --- a/doc/salome/gui/input/using_pluginsmanager.doc +++ b/doc/salome/gui/input/using_pluginsmanager.doc @@ -98,8 +98,9 @@ training course): \code # Intialize the geompy factory with the active study import salome -import geompy -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) @@ -108,10 +109,10 @@ Vz = geompy.MakeVectorDXDYDZ(0, 0, 10) origin = geompy.MakeVertex(0, 0, 0) # Register the objects in the active study -geompy.addToStudy( Vx, "Vx" )) -geompy.addToStudy( Vy, "Vy" )) -geompy.addToStudy( Vz, "Vz" )) -geompy.addToStudy( origin, "origin" )) +geompy.addToStudy( Vx, "Vx" ) +geompy.addToStudy( Vy, "Vy" ) +geompy.addToStudy( Vz, "Vz" ) +geompy.addToStudy( origin, "origin" ) \endcode The job consists in creating the file salome_plugins.py as follows: @@ -119,7 +120,9 @@ The job consists in creating the file salome_plugins.py as follows: \code import salome_pluginsmanager def trihedron(context): - import geompy + import GEOM + from salome.geom import geomBuilder + geompy = geomBuilder.New(salome.myStudy) # Intialize the geompy factory with the active study activeStudy = context.study geompy.init_geom(activeStudy) diff --git a/src/SalomeApp/pluginsdemo/minmax_plugin.py b/src/SalomeApp/pluginsdemo/minmax_plugin.py index cf8f96e7e..15e601152 100644 --- a/src/SalomeApp/pluginsdemo/minmax_plugin.py +++ b/src/SalomeApp/pluginsdemo/minmax_plugin.py @@ -33,23 +33,25 @@ def minmax(context): from minmax_dialog import Ui_Dialog import salome - import smesh + import SMESH + from salome.smesh import smeshBuilder + smesh = smeshBuilder.New(salome.myStudy) controls_dict = { - "Aspect Ratio 3D" : smesh.FT_AspectRatio3D, - "Volume" : smesh.FT_Volume3D, - "Element Diameter 3D" : smesh.FT_MaxElementLength3D, - "Length 2D" : smesh.FT_Length2D, - "MultiConnection 2D" : smesh.FT_MultiConnection2D, - "Area" : smesh.FT_Area, - "Taper" : smesh.FT_Taper, - "Aspect Ratio" : smesh.FT_AspectRatio, - "Minimum Angle" : smesh.FT_MinimumAngle, - "Warping" : smesh.FT_Warping, - "Skew" : smesh.FT_Skew, - "Element Diameter 2D" : smesh.FT_MaxElementLength2D, - "Length" : smesh.FT_Length, - "MultiConnection" : smesh.FT_MultiConnection, + "Aspect Ratio 3D" : SMESH.FT_AspectRatio3D, + "Volume" : SMESH.FT_Volume3D, + "Element Diameter 3D" : SMESH.FT_MaxElementLength3D, + "Length 2D" : SMESH.FT_Length2D, + "MultiConnection 2D" : SMESH.FT_MultiConnection2D, + "Area" : SMESH.FT_Area, + "Taper" : SMESH.FT_Taper, + "Aspect Ratio" : SMESH.FT_AspectRatio, + "Minimum Angle" : SMESH.FT_MinimumAngle, + "Warping" : SMESH.FT_Warping, + "Skew" : SMESH.FT_Skew, + "Element Diameter 2D" : SMESH.FT_MaxElementLength2D, + "Length" : SMESH.FT_Length, + "MultiConnection" : SMESH.FT_MultiConnection, } controls_3d = [ -- 2.30.2