From bd8239d6834341cc8a6ff61bb82826de442d5c8a Mon Sep 17 00:00:00 2001 From: prascle Date: Mon, 25 Feb 2013 10:21:39 +0000 Subject: [PATCH] PR: fix dump and compatibility with previous scripts --- resources/StdMeshers.xml | 12 ++++++------ src/SMESH_I/SMESH_DumpPython.cxx | 9 +++++---- src/SMESH_SWIG/Makefile.am | 2 +- src/SMESH_SWIG/smesh.py | 4 ++-- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/resources/StdMeshers.xml b/resources/StdMeshers.xml index 2375a485b..ddbeb3114 100644 --- a/resources/StdMeshers.xml +++ b/resources/StdMeshers.xml @@ -227,7 +227,7 @@ output ="EDGE" dim ="1"> - CompositeSegment_1D=Segment(algo=smeshDC.COMPOSITE) + CompositeSegment_1D=Segment(algo=smeshBuilder.COMPOSITE) LocalLength=LocalLength(SetLength(), ,SetPrecision()) MaxLength=MaxSize(SetLength()) Arithmetic1D=Arithmetic1D(SetStartLength(),SetEndLength(),SetReversedEdges()) @@ -244,7 +244,7 @@ output="EDGE" dim="1"> - Python_1D=Segment(algo=smeshDC.PYTHON) + Python_1D=Segment(algo=smeshBuilder.PYTHON) PythonSplit1D=PythonSplit1D(SetNumberOfSegments(),SetPythonLog10RatioFunction()) @@ -258,7 +258,7 @@ output ="TRIA" dim ="2"> - MEFISTO_2D=Triangle(algo=smeshDC.MEFISTO) + MEFISTO_2D=Triangle(algo=smeshBuilder.MEFISTO) LengthFromEdges=LengthFromEdges() MaxElementArea=MaxElementArea(SetMaxElementArea()) ViscousLayers2D=ViscousLayers2D(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetIgnoreEdges()) @@ -274,7 +274,7 @@ output ="QUAD" dim ="2"> - Quadrangle_2D=Quadrangle(algo=smeshDC.QUADRANGLE) + Quadrangle_2D=Quadrangle(algo=smeshBuilder.QUADRANGLE) QuadrangleParams=QuadrangleParameters(SetQuadType(),SetTriaVertex()) ViscousLayers2D=ViscousLayers2D(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetIgnoreEdges()) @@ -288,7 +288,7 @@ opt-hypos="ViscousLayers" dim ="3"> - Hexa_3D=Hexahedron(algo=smeshDC.Hexa) + Hexa_3D=Hexahedron(algo=smeshBuilder.Hexa) ViscousLayers=ViscousLayers(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetIgnoreFaces()) @@ -419,7 +419,7 @@ output ="QUAD,TRIA" dim ="2"> - RadialQuadrangle_1D2D=Quadrangle(algo=smeshDC.RADIAL_QUAD) + RadialQuadrangle_1D2D=Quadrangle(algo=smeshBuilder.RADIAL_QUAD) NumberOfLayers2D=NumberOfLayers(SetNumberOfLayers()) diff --git a/src/SMESH_I/SMESH_DumpPython.cxx b/src/SMESH_I/SMESH_DumpPython.cxx index 200ed9ec3..101c9ac51 100644 --- a/src/SMESH_I/SMESH_DumpPython.cxx +++ b/src/SMESH_I/SMESH_DumpPython.cxx @@ -831,9 +831,9 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl aScript += helper + "aFilterManager = " + aSMESHGen + ".CreateFilterManager()\n\t"; aScript += helper + "aMeasurements = " + aSMESHGen + ".CreateMeasurements()\n\t"; if ( isPublished ) - aScript += aSMESHGen + " = smeshDC.smeshInstance(theStudy)"; + aScript += aSMESHGen + " = smeshBuilder.New(theStudy)"; else - aScript += aSMESHGen + " = smeshDC.smeshInstance(None)"; + aScript += aSMESHGen + " = smeshBuilder.New(None)"; // import python files corresponding to plugins set moduleNameSet; @@ -842,7 +842,7 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl string moduleName = hyp_creator->second->GetModuleName(); bool newModule = moduleNameSet.insert( moduleName ).second; if ( newModule ) - aScript += helper + "\n\t" + "import " + (char*) moduleName.c_str(); + aScript += helper + "\n\t" + "from salome." + (char*) moduleName.c_str() + " import " + (char*) moduleName.c_str() +"Builder"; } // Dump trace of restored study @@ -963,7 +963,8 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl TCollection_AsciiString initPart = "import "; if ( isMultiFile ) initPart += helper + "salome, "; - initPart += " smeshDC, SMESH, SALOMEDS\n"; + initPart += " SMESH, SALOMEDS\n"; + initPart += "from salome.smesh import smeshBuilder\n"; if ( importGeom && isMultiFile ) { initPart += ("\n## import GEOM dump file ## \n" diff --git a/src/SMESH_SWIG/Makefile.am b/src/SMESH_SWIG/Makefile.am index 562d47e1e..3c09b3e96 100644 --- a/src/SMESH_SWIG/Makefile.am +++ b/src/SMESH_SWIG/Makefile.am @@ -27,6 +27,7 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am # Scripts to be installed. dist_salomescript_PYTHON = \ + smesh.py \ batchmode_smesh.py \ batchmode_mefisto.py \ ex00_all.py \ @@ -97,7 +98,6 @@ dist_salomescript_PYTHON = \ mypkgpythondir = $(salomepythondir)/salome/smesh mypkgpython_PYTHON = \ - smesh.py \ smeshBuilder.py \ smesh_algorithm.py diff --git a/src/SMESH_SWIG/smesh.py b/src/SMESH_SWIG/smesh.py index b3b24f537..e51fe36f2 100644 --- a/src/SMESH_SWIG/smesh.py +++ b/src/SMESH_SWIG/smesh.py @@ -32,7 +32,7 @@ import salome from salome import * -from salome.geom import geompy +import geompy import SMESH, SALOMEDS from salome.smesh import smeshBuilder #from smeshBuilder import * @@ -49,7 +49,7 @@ except: # load plugins and add dynamically generated methods to Mesh class, # the same for for global variables declared by plug-ins -from smeshBuilder import Mesh, algoCreator +from salome.smesh.smeshBuilder import Mesh, algoCreator for pluginName in os.environ[ "SMESH_MeshersList" ].split( ":" ): # print "pluginName: ", pluginName -- 2.39.2