salome_pluginsmanager.AddFunction('My plugin n°1', 'This action runs the plugin n°1', myplugin1)
salome_pluginsmanager.AddFunction('My plugin n°2', 'This action runs the plugin n°2', myplugin2)
...
-\endcode
+\endcode
The procedure is to define a function that implements the plugin, and
to declare this function to the plugins manager. The implementation
<module_name> is the name of the module in low letters).
-# The directory ~/.config/salome/Plugins for personnal end user
plugins.
--# Any path in the shell variable SALOME_PLUGIN_PATH (each path must be
+-# Any path in the shell variable SALOME_PLUGINS_PATH (each path must be
separated by a comma ":" for unix and ";" for windows). This
- variable should be set and exported before running the SALOME application.
+ variable should be set and exported before running the SALOME application.
\section S3_SALOMEPLUGINS A complete example
is capable to write if he reads the documentation and follows the
training course):
-\code
+\code
# Intialize the geompy factory with the active study
import salome
import GEOM
an action on it, for example, to select a mesh and display some information related to it.
Some important methods and objects to use are as follows:
--# context.sg.getObjectBrowser(): to connect the signal event
- `selectionChanged()` to a custom slot
+-# context.sg.getObjectBrowser(): to connect the signal event
+ `selectionChanged()` to a custom slot
-# context.salome.sg.getAllSelected(): to get the list of selected object
- in the object browser
--# objId = context.salome.sg.getSelected(0):
+ in the object browser
+-# objId = context.salome.sg.getSelected(0):
to get the first selected object in the object browser
-# salomeObj = context.salome.study.FindObjectID(objId).GetObject():
to retrieve the salome object from selection. It can be a GEOM, SMESH, or any
- other module object.
+ other module object.
If it is a mesh, then it is possible to call methods of the SMESH::SMESH_Mesh interface
on the object, for example GetShapeToMesh().
- If it is not a mesh, this call will raise an exception.
+ If it is not a mesh, this call will raise an exception.
So it is possible to write the code retrieving the shape a mesh is built on in the following way:
\code
mesh = None
variable DEMO_IS_ACTIVATED to True.
The demo examples are:
--# \b trihedron: create a trihedron and display it with fit on the size
+-# \b trihedron: create a trihedron and display it with fit on the size
-# \b tube_shapewithgui: create a geom object from parameters given by a
dialog box.
-# \b tube_meshwithgui: create a mesh object from parameters given by a
-# \b runSalomeShellSession: run a SALOME prepared shell session in a
xterm.
-# \b minmax: computes the min and max values of a control on a selected mesh.
- \note This plugin is available in the SMESH module only. To activate it, edit
+ \note This plugin is available in the SMESH module only. To activate it, edit
the file $GUI_ROOT_DIR/share/salome/plugins/gui/demo/smesh_plugins.py and turn the variable
DEMO_IS_ACTIVATED to True.