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