From 47bdf12d63a58cdd17b3a709d8f7d13071780cf1 Mon Sep 17 00:00:00 2001 From: mpa Date: Tue, 19 Nov 2013 12:03:24 +0000 Subject: [PATCH] - Modifing Geometry and Mesh Python scripts from SALOME 6 and before --- src/SMESH_PY/smeshstudytools.py | 20 +++++++++++++------- src/SMESH_SWIG/SMESH_mechanic.py | 2 +- src/SMESH_SWIG/SMESH_reg.py | 2 +- src/SMESH_SWIG/StdMeshersBuilder.py | 2 +- src/SMESH_SWIG/batchmode_mefisto.py | 2 +- src/SMESH_SWIG/ex30_groupsOp.py | 2 +- src/SMESH_SWIG/ex31_dimGroup.py | 2 +- 7 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/SMESH_PY/smeshstudytools.py b/src/SMESH_PY/smeshstudytools.py index 7b83e570e..4a2a9c692 100644 --- a/src/SMESH_PY/smeshstudytools.py +++ b/src/SMESH_PY/smeshstudytools.py @@ -97,8 +97,10 @@ class SMeshStudyTools: ''' if entry is None: return None - import smesh - smesh.SetCurrentStudy(self.editor.study) + import SMESH + from salome.smesh import smeshBuilder + smesh = smeshBuilder.New(self.editor.study) + meshObject=smesh.IDToObject(entry) return meshObject @@ -153,13 +155,17 @@ class SMeshStudyTools: def TEST_createBoxMesh(): theStudy = helper.getActiveStudy() - import geompy - geompy.init_geom(theStudy) + import GEOM + from salome.geom import geomBuilder + geompy = geomBuilder.New(theStudy) + box = geompy.MakeBoxDXDYDZ(200, 200, 200) - import smesh, SMESH, SALOMEDS - smesh.SetCurrentStudy(theStudy) - import StdMeshers + import SMESH, SALOMEDS + from salome.smesh import smeshBuilder + smesh = smeshBuilder.New(theStudy) + + from salome.StdMeshers import StdMeshersBuilder boxmesh = smesh.Mesh(box) Regular_1D = boxmesh.Segment() Nb_Segments_1 = Regular_1D.NumberOfSegments(15) diff --git a/src/SMESH_SWIG/SMESH_mechanic.py b/src/SMESH_SWIG/SMESH_mechanic.py index d7835f437..784ccd373 100644 --- a/src/SMESH_SWIG/SMESH_mechanic.py +++ b/src/SMESH_SWIG/SMESH_mechanic.py @@ -37,7 +37,7 @@ import SMESH, SALOMEDS from salome.smesh import smeshBuilder smesh = smeshBuilder.New(salome.myStudy) -import StdMeshers +from salome.StdMeshers import StdMeshersBuilder # ---------------------------- GEOM -------------------------------------- diff --git a/src/SMESH_SWIG/SMESH_reg.py b/src/SMESH_SWIG/SMESH_reg.py index 36fc4b897..2880748b2 100644 --- a/src/SMESH_SWIG/SMESH_reg.py +++ b/src/SMESH_SWIG/SMESH_reg.py @@ -34,7 +34,7 @@ import SMESH, SALOMEDS from salome.smesh import smeshBuilder smesh = smeshBuilder.New(salome.myStudy) -import StdMeshers +from salome.StdMeshers import StdMeshersBuilder # ---- define a box diff --git a/src/SMESH_SWIG/StdMeshersBuilder.py b/src/SMESH_SWIG/StdMeshersBuilder.py index 32d2724f9..886706024 100644 --- a/src/SMESH_SWIG/StdMeshersBuilder.py +++ b/src/SMESH_SWIG/StdMeshersBuilder.py @@ -26,7 +26,7 @@ from salome.smesh.smeshBuilder import AssureGeomPublished, IsEqual, ParseParamet from salome.smesh.smeshBuilder import GetName, TreatHypoStatus from salome.smesh.smeshBuilder import Mesh -import StdMeshers +from salome.StdMeshers import StdMeshersBuilder #---------------------------- # Mesh algo type identifiers diff --git a/src/SMESH_SWIG/batchmode_mefisto.py b/src/SMESH_SWIG/batchmode_mefisto.py index b13abe69d..608edbd83 100644 --- a/src/SMESH_SWIG/batchmode_mefisto.py +++ b/src/SMESH_SWIG/batchmode_mefisto.py @@ -27,7 +27,7 @@ import re import batchmode_salome import batchmode_geompy import batchmode_smesh -import StdMeshers +from salome.StdMeshers import StdMeshersBuilder smesh = batchmode_smesh.smesh smesh.SetCurrentStudy(batchmode_salome.myStudy) diff --git a/src/SMESH_SWIG/ex30_groupsOp.py b/src/SMESH_SWIG/ex30_groupsOp.py index eea4f5535..5cae0b029 100755 --- a/src/SMESH_SWIG/ex30_groupsOp.py +++ b/src/SMESH_SWIG/ex30_groupsOp.py @@ -34,7 +34,7 @@ Face_1 = geompy.MakeFaceHW(100, 100, 1) geompy.addToStudy( Face_1, "Face_1" ) smesh.SetCurrentStudy(salome.myStudy) -import StdMeshers +from salome.StdMeshers import StdMeshersBuilder pattern = smesh.GetPattern() Mesh_1 = smesh.Mesh(Face_1) Regular_1D = Mesh_1.Segment() diff --git a/src/SMESH_SWIG/ex31_dimGroup.py b/src/SMESH_SWIG/ex31_dimGroup.py index 3b1a480f7..65830faac 100755 --- a/src/SMESH_SWIG/ex31_dimGroup.py +++ b/src/SMESH_SWIG/ex31_dimGroup.py @@ -34,7 +34,7 @@ Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200) geompy.addToStudy( Box_1, "Box_1" ) smesh.SetCurrentStudy(salome.myStudy) -import StdMeshers +from salome.StdMeshers import StdMeshersBuilder Mesh_1 = smesh.Mesh(Box_1) Regular_1D = Mesh_1.Segment() Nb_Segments_1 = Regular_1D.NumberOfSegments(10) -- 2.39.2