Salome HOME
Fix regression caused by commit 67312ab9
[modules/smesh.git] / doc / salome / gui / SMESH / input / smesh_migration.rst
1 .. _smesh_migration_page:
2
3 *****************************************************
4 Modifing Mesh Python scripts from SALOME 6 and before
5 *****************************************************
6
7 In SALOME 7.2, the Python interface for Mesh has been slightly modified to offer new functionality:
8
9
10 Scripts generated for SALOME 6 and older versions must be adapted to work in SALOME 7.2 with full functionality.
11 The compatibility mode allows old scripts to work in almost all cases, but with a warning.
12
13 * **Salome initialisation** must always be done as shown below.
14
15   (*salome_init()* can be invoked safely several times)::
16
17         import salome
18         salome.salome_init()
19
20 * **smesh initialisation** is modified.
21
22   The old mode (from dump)::
23
24         import smesh, SMESH, SALOMEDS
25         smesh.SetCurrentStudy(salome.myStudy)
26
27   The new mode::
28
29         import SMESH, SALOMEDS
30         from salome.smesh import smeshBuilder
31         smesh =  smeshBuilder.New(salome.myStudy)
32
33
34 * Of course, **from smesh import** * is **no more possible.**
35
36   You have to explicitely write *smesh.some_method()*.
37
38 * All **algorithms** have been transferred from the namespace *smesh* to the namespace *smeshBuilder*.
39
40   For instance::
41
42         MEFISTO_2D_1 = Mesh_1.Triangle(algo=smesh.MEFISTO,geom=Face_1)
43
44   is replaced by::
45
46         MEFISTO_2D_1 = Mesh_1.Triangle(algo=smeshBuilder.MEFISTO,geom=Face_1)
47
48   StdMeshers algorithms concerned are *REGULAR, PYTHON, COMPOSITE, MEFISTO, Hexa, QUADRANGLE, RADIAL_QUAD*.
49
50   SMESH Plugins provide such algorithms as: *NETGEN, NETGEN_FULL, FULL_NETGEN, NETGEN_1D2D3D, NETGEN_1D2D, NETGEN_2D, NETGEN_3D*.
51
52   If you use DISTENE plugins, you also have *BLSURF, GHS3D, GHS3DPRL, Hexotic*.
53
54 * Some **variables** were available in both namespaces *smesh* and *SMESH*. Now they are available only in namespace *SMESH*.
55
56   The dump function used only the namespace *SMESH*,
57   so, if your script was built with the help of the dump function, it should be already OK in this respect.
58
59   The most used variables concerned are:
60
61   * *NODE, EDGE, FACE, VOLUME, ALL.*
62   * *FT_xxx, geom_xxx, ADD_xxx...*
63
64   For instance::
65
66         srcFaceGroup = srcMesh.GroupOnGeom( midFace0, "src faces", smesh.FACE )
67         mesh.MakeGroup("Tetras",smesh.VOLUME,smesh.FT_ElemGeomType,"=",smesh.Geom_TETRA)
68         filter = smesh.GetFilter(smesh.FACE, smesh.FT_AspectRatio, smesh.FT_MoreThan, 6.5)
69
70   is replaced by::
71
72         srcFaceGroup = srcMesh.GroupOnGeom( midFace0, "src faces", SMESH.FACE )
73         mesh.MakeGroup("Tetras",SMESH.VOLUME,SMESH.FT_ElemGeomType,"=",SMESH.Geom_TETRA)
74         filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_AspectRatio, SMESH.FT_MoreThan, 6.5)
75
76
77 * The namespace **smesh.smesh** does not exist any more, use **smesh** instead.
78
79   For instance::
80
81         Compound1 = smesh.smesh.Concatenate([Mesh_inf.GetMesh(), Mesh_sup.GetMesh()], 0, 1, 1e-05)
82
83   is replaced by::
84
85         Compound1 = smesh.Concatenate([Mesh_inf.GetMesh(), Mesh_sup.GetMesh()], 0, 1, 1e-05)
86
87 * If you need to **import a SMESH Plugin** explicitely, keep in mind that  they are now located in separate namespaces.
88
89   For instance::
90
91         import StdMeshers
92         import NETGENPlugin
93         import BLSURFPlugin
94         import GHS3DPlugin
95         import HexoticPLUGIN
96
97   is replaced by:: 
98
99         from salome.StdMeshers import StdMeshersBuilder
100         from salome.NETGENPlugin import NETGENPluginBuilder
101         from salome.BLSURFPlugin import BLSURFPluginBuilder
102         from salome.GHS3DPlugin import GHS3DPluginBuilder
103         from salome.HexoticPLUGIN import HexoticPLUGINBuilder
104
105