smesh/doc/salome/gui/SMESH/input/smesh_migration.rst

106 lines
3.3 KiB
ReStructuredText
Raw Normal View History

2017-12-08 19:09:48 +05:00
.. _smesh_migration_page:
2018-06-14 16:56:19 +05:00
******************************************************
Modifying Mesh Python scripts from SALOME 6 and before
******************************************************
2017-12-08 19:09:48 +05:00
In SALOME 7.2, the Python interface for Mesh has been slightly modified to offer new functionality:
Scripts generated for SALOME 6 and older versions must be adapted to work in SALOME 7.2 with full functionality.
The compatibility mode allows old scripts to work in almost all cases, but with a warning.
2018-05-25 22:04:48 +05:00
* **Salome initialisation** must always be done as shown below.
2017-12-08 19:09:48 +05:00
2018-05-25 22:04:48 +05:00
(*salome_init()* can be invoked safely several times)::
2017-12-08 19:09:48 +05:00
import salome
salome.salome_init()
2018-05-25 22:04:48 +05:00
* **smesh initialisation** is modified.
The old mode (from dump)::
2017-12-08 19:09:48 +05:00
import smesh, SMESH, SALOMEDS
smesh.SetCurrentStudy(salome.myStudy)
2018-05-25 22:04:48 +05:00
The new mode::
2017-12-08 19:09:48 +05:00
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
2018-06-14 16:56:19 +05:00
smesh = smeshBuilder.New()
2017-12-08 19:09:48 +05:00
2018-05-25 22:04:48 +05:00
* Of course, **from smesh import** * is **no more possible.**
2017-12-08 19:09:48 +05:00
2018-06-14 16:56:19 +05:00
You have to explicitly write *smesh.some_method()*.
2017-12-08 19:09:48 +05:00
2018-05-25 22:04:48 +05:00
* All **algorithms** have been transferred from the namespace *smesh* to the namespace *smeshBuilder*.
2017-12-08 19:09:48 +05:00
2018-05-25 22:04:48 +05:00
For instance::
2017-12-08 19:09:48 +05:00
MEFISTO_2D_1 = Mesh_1.Triangle(algo=smesh.MEFISTO,geom=Face_1)
2018-05-25 22:04:48 +05:00
is replaced by::
2017-12-08 19:09:48 +05:00
MEFISTO_2D_1 = Mesh_1.Triangle(algo=smeshBuilder.MEFISTO,geom=Face_1)
2018-05-25 22:04:48 +05:00
StdMeshers algorithms concerned are *REGULAR, PYTHON, COMPOSITE, MEFISTO, Hexa, QUADRANGLE, RADIAL_QUAD*.
2017-12-08 19:09:48 +05:00
2018-05-25 22:04:48 +05:00
SMESH Plugins provide such algorithms as: *NETGEN, NETGEN_FULL, FULL_NETGEN, NETGEN_1D2D3D, NETGEN_1D2D, NETGEN_2D, NETGEN_3D*.
2017-12-08 19:09:48 +05:00
2018-05-25 22:04:48 +05:00
If you use DISTENE plugins, you also have *BLSURF, GHS3D, GHS3DPRL, Hexotic*.
2017-12-08 19:09:48 +05:00
2018-05-25 22:04:48 +05:00
* Some **variables** were available in both namespaces *smesh* and *SMESH*. Now they are available only in namespace *SMESH*.
2017-12-08 19:09:48 +05:00
2018-05-25 22:04:48 +05:00
The dump function used only the namespace *SMESH*,
so, if your script was built with the help of the dump function, it should be already OK in this respect.
2017-12-08 19:09:48 +05:00
2018-05-25 22:04:48 +05:00
The most used variables concerned are:
2017-12-08 19:09:48 +05:00
2018-05-25 22:04:48 +05:00
* *NODE, EDGE, FACE, VOLUME, ALL.*
* *FT_xxx, geom_xxx, ADD_xxx...*
2017-12-08 19:09:48 +05:00
2018-05-25 22:04:48 +05:00
For instance::
2017-12-08 19:09:48 +05:00
srcFaceGroup = srcMesh.GroupOnGeom( midFace0, "src faces", smesh.FACE )
mesh.MakeGroup("Tetras",smesh.VOLUME,smesh.FT_ElemGeomType,"=",smesh.Geom_TETRA)
filter = smesh.GetFilter(smesh.FACE, smesh.FT_AspectRatio, smesh.FT_MoreThan, 6.5)
2018-05-25 22:04:48 +05:00
is replaced by::
2017-12-08 19:09:48 +05:00
srcFaceGroup = srcMesh.GroupOnGeom( midFace0, "src faces", SMESH.FACE )
mesh.MakeGroup("Tetras",SMESH.VOLUME,SMESH.FT_ElemGeomType,"=",SMESH.Geom_TETRA)
filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_AspectRatio, SMESH.FT_MoreThan, 6.5)
2018-05-25 22:04:48 +05:00
* The namespace **smesh.smesh** does not exist any more, use **smesh** instead.
For instance::
2017-12-08 19:09:48 +05:00
Compound1 = smesh.smesh.Concatenate([Mesh_inf.GetMesh(), Mesh_sup.GetMesh()], 0, 1, 1e-05)
2018-05-25 22:04:48 +05:00
is replaced by::
2017-12-08 19:09:48 +05:00
Compound1 = smesh.Concatenate([Mesh_inf.GetMesh(), Mesh_sup.GetMesh()], 0, 1, 1e-05)
* If you need to **import a SMESH Plugin** explicitly, keep in mind that they are now located in separate namespaces.
2017-12-08 19:09:48 +05:00
2018-05-25 22:04:48 +05:00
For instance::
2017-12-08 19:09:48 +05:00
import StdMeshers
import NETGENPlugin
import BLSURFPlugin
import GHS3DPlugin
import HexoticPLUGIN
2018-05-25 22:04:48 +05:00
is replaced by::
2017-12-08 19:09:48 +05:00
from salome.StdMeshers import StdMeshersBuilder
from salome.NETGENPlugin import NETGENPluginBuilder
from salome.BLSURFPlugin import BLSURFPluginBuilder
from salome.GHS3DPlugin import GHS3DPluginBuilder
from salome.HexoticPLUGIN import HexoticPLUGINBuilder