Salome HOME
PR: fix dump and compatibility with previous scripts
authorprascle <prascle>
Mon, 25 Feb 2013 10:21:39 +0000 (10:21 +0000)
committerprascle <prascle>
Mon, 25 Feb 2013 10:21:39 +0000 (10:21 +0000)
resources/StdMeshers.xml
src/SMESH_I/SMESH_DumpPython.cxx
src/SMESH_SWIG/Makefile.am
src/SMESH_SWIG/smesh.py

index 2375a485b89b19c621fc6aa53fe25d346abd4e54..ddbeb31148e25cef33cff8956af8ed9e439f1078 100644 (file)
                output   ="EDGE"
                dim      ="1">
       <python-wrap>
-        <algo>CompositeSegment_1D=Segment(algo=smeshDC.COMPOSITE)</algo>
+        <algo>CompositeSegment_1D=Segment(algo=smeshBuilder.COMPOSITE)</algo>
         <hypo>LocalLength=LocalLength(SetLength(), ,SetPrecision())</hypo>
         <hypo>MaxLength=MaxSize(SetLength())</hypo>
         <hypo>Arithmetic1D=Arithmetic1D(SetStartLength(),SetEndLength(),SetReversedEdges())</hypo>
                output="EDGE"
                dim="1">
       <python-wrap>
-        <algo>Python_1D=Segment(algo=smeshDC.PYTHON)</algo>
+        <algo>Python_1D=Segment(algo=smeshBuilder.PYTHON)</algo>
         <hypo>PythonSplit1D=PythonSplit1D(SetNumberOfSegments(),SetPythonLog10RatioFunction())</hypo>
       </python-wrap>
     </algorithm>
                output    ="TRIA"
                dim       ="2">
       <python-wrap>
-        <algo>MEFISTO_2D=Triangle(algo=smeshDC.MEFISTO)</algo>
+        <algo>MEFISTO_2D=Triangle(algo=smeshBuilder.MEFISTO)</algo>
         <hypo>LengthFromEdges=LengthFromEdges()</hypo>
         <hypo>MaxElementArea=MaxElementArea(SetMaxElementArea())</hypo>
         <hypo>ViscousLayers2D=ViscousLayers2D(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetIgnoreEdges())</hypo>
                output   ="QUAD"
                dim      ="2">
       <python-wrap>
-        <algo>Quadrangle_2D=Quadrangle(algo=smeshDC.QUADRANGLE)</algo>
+        <algo>Quadrangle_2D=Quadrangle(algo=smeshBuilder.QUADRANGLE)</algo>
         <hypo>QuadrangleParams=QuadrangleParameters(SetQuadType(),SetTriaVertex())</hypo>
         <hypo>ViscousLayers2D=ViscousLayers2D(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetIgnoreEdges())</hypo>
       </python-wrap>
                opt-hypos="ViscousLayers"
                dim      ="3">
       <python-wrap>
-        <algo>Hexa_3D=Hexahedron(algo=smeshDC.Hexa)</algo>
+        <algo>Hexa_3D=Hexahedron(algo=smeshBuilder.Hexa)</algo>
         <hypo>ViscousLayers=ViscousLayers(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetIgnoreFaces())</hypo>
       </python-wrap>
     </algorithm>
                output  ="QUAD,TRIA"
                dim     ="2">
       <python-wrap>
-        <algo>RadialQuadrangle_1D2D=Quadrangle(algo=smeshDC.RADIAL_QUAD)</algo>
+        <algo>RadialQuadrangle_1D2D=Quadrangle(algo=smeshBuilder.RADIAL_QUAD)</algo>
         <hypo>NumberOfLayers2D=NumberOfLayers(SetNumberOfLayers())</hypo>
       </python-wrap>
     </algorithm>
index 200ed9ec34adebbb356d5d885f5fa5a7af607515..101c9ac51aae15c6de4ed03b91a1cec699409601 100644 (file)
@@ -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<string> 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"
index 562d47e1ed218086b0c14cdcb3657a08f2b234a9..3c09b3e96dd979e0bb0c69dc1dce94bd30de7e8f 100644 (file)
@@ -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
        
index b3b24f537966980ee6fe88f134c6ef412fc82c45..e51fe36f2d5325c4506f1bf3fe535734ad2f05dd 100644 (file)
@@ -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