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