Salome HOME
Merge branch 'V8_4_BR'
[modules/smesh.git] / doc / salome / gui / SMESH / input / tui_work_on_objects_from_gui.rst
1
2 .. _tui_work_on_objects_from_gui: 
3
4 ***************************************
5 How to work with objects from the GUI ?
6 ***************************************
7
8 It is sometimes useful to work alternatively in the GUI of SALOME and in the Python Console. To fetch an object from the TUI simply type:
9
10 .. code-block:: python
11    :linenos:
12
13         myMesh_ref = salome.IDToObject( ID )
14         # were ID is a string looking like "0:1:2:3" that appears in the Object Browser in the Entry column.
15         # ( If hidden, show it by right clicking and checking the checkbox Entry )
16         myMesh = smesh.Mesh(myMesh_ref)
17
18 or 
19
20 .. code-block:: python
21    :linenos:
22
23         myMesh_ref = salome.myStudy.FindObjectByPath("/Mesh/myMesh").GetObject() 
24         #'/Mesh/myMesh' is a path to the desired object in the Object Browser
25         myMesh = smesh.Mesh(myMesh_ref)
26
27 or 
28
29 .. code-block:: python
30    :linenos:
31
32         # get a selected mesh
33         from salome.gui import helper
34         myMesh_ref = helper.getSObjectSelected()[0].GetObject() 
35         myMesh = smesh.Mesh(myMesh_ref)
36
37 All the methods documented in these pages can then be used on myMesh
38
39 .. note:: The first statement only gives you access to a reference to the object created via the GUI. But the methods available on this reference are not exactly the same as those documented in these help pages. This Python API is meant to be used on smesh.Mesh instances. That's why you'll have to create such an instance with the second statement. 
40
41