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:
1 myMesh_ref = salome.IDToObject( ID )
4 myMesh = smesh.Mesh(myMesh_ref)
or
1 myMesh_ref = salome.myStudy.FindObjectByPath(
"/Mesh/myMesh").GetObject()
3 myMesh = smesh.Mesh(myMesh_ref)
or
2 from salome.gui
import helper
3 myMesh_ref = helper.getSObjectSelected()[0].GetObject()
4 myMesh = smesh.Mesh(myMesh_ref)
All the methods documented in these pages can then be used on myMesh
- 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.