1 #######################################################################################
2 # File : PluginMeshers.txt
3 # Author : Julia DOROVSKIKH
6 #######################################################################################
8 # How to add your own mesher (as a set of hypotheses and algorithms) to the application
10 #######################################################################################
12 1. Create mesher plugin package, e.g. MyMesher.
14 2. Create XML file to describe all algorithms and hypotheses, provided by plugin package
15 (see SMESH_SRC/resources/SMESH_Meshers.xml for example).
17 <meshers-group name="MyName"
18 resources="MyResourceKey"
19 server-lib="libMyServerLib.so"
20 gui-lib="libMyClientLib.so">
22 <hypothesis type="MyHypType1"
23 label-id="My beautiful hypothesis name"
24 icon-id="my_hypo_1_icon.png"/>
27 <algorithm type="MyAlgType1"
28 label-id="My beautiful algorithm name"
29 icon-id="my_algo_1_icon.png"/>
33 Attributes of <meshers-group> tag:
35 - value of <name> attribute is used to collect hypotheses/algoritms in groups;
36 you can also use this attribute for short description of your mesher plugin
38 - value of <resources> attribute (MyResourceKey) is used to access resources
39 (messages and icons) from GUI (see paragraphs 4.2 and 5);
40 currently it should coincide with the name of plugin package; this limitation
41 will be eliminated in the further development.
43 - value of <server-lib> attribute describes the name of your mesher's
44 server plugin library (See paragraph 3)
46 - value of <gui-lib> attribute describes the name of your mesher's
47 client plugin library (See paragraph 4)
49 Attributes of <hypothesis/algorithm> tag:
51 - value of <type> attribute is an unique name of the hypothesis/algorithm
53 * It is a value of _name field of your hypothesis class
54 (see paragraph 3, implementation of constructor of
55 StdMeshers_LocalLength class: _name = "LocalLength")
57 * It is a key to each certain hypothesis class
58 (see paragraph 3, implementation of "GetHypothesisCreator()" method in StdMeshers_i.cxx)
60 * It is a key to each certain hypothesis GUI
61 (see paragraph 4, implementation of "StdMeshersGUI_HypothesisCreator::CreateHypothesis()"
62 and "StdMeshersGUI_HypothesisCreator::EditHypothesis()" methods in StdMeshersGUI.cxx)
64 * It is a key to each certain hypothesis icon in Object Browser
67 - value of <label-id> attribute is displayed in the GUI in the list
68 of available hypotheses/algorithms ("Create Hypothesis/Algorithm" dialog)
70 - value of <icon-id> attribute is a name of icon file, which is displayed in GUI
71 in the list of available hypotheses/algorithms ("Create Hypothesis/Algorithm" dialog)
73 Note: All attributes values are accessible in your GUI via HypothesisData class
76 Note: The environment variable SMESH_MeshersList contains the list of plugins names,
77 separated by colon (":") symbol, e.g.:
79 setenv SMESH_MeshersList StdMeshers:NETGENPlugin
81 Please, pay attention that StdMeshers should also be included into this environment variable,
82 if you want to use standard hypotheses/algorithms, provided with SMESH module.
84 The SALOME automatically locates XML files, searching them in the following directories:
86 ${<PLUGINNAME>_ROOT_DIR}/share/salome/resources/<plugin>
87 ${SALOME_<PluginName>Resources}
88 ${HOME}/.salome/resources
89 ${KERNEL_ROOT_DIR}/share/salome/resources/kernel
91 where <PluginName> is a name of each mesher plugin package
93 3. Build server plugin library <libMyServerLib.so>.
95 3.1. Define interface to your hypotheses and algorithms.
97 Example: SMESH_SRC/idl/SMESH_BasicHypothesis.idl
98 NETGENPLUGIN_SRC/src/NETGENPlugin_Algorithm.idl
100 3.2. Implement functionality of your hypotheses and algorithms.
101 Inherit corresponding classes from SMESH.
103 Example: SMESH_SRC/src/StdMeshers/StdMeshers_*
104 NETGENPLUGIN_SRC/src/NETGENPlugin_NETGEN_3D
106 3.3. Implement interface to your hypotheses and algorithms.
107 Inherit corresponding classes from SMESH_I.
109 Example: SMESH_SRC/src/StdMeshers_I/SMESH_*_i
110 NETGENPLUGIN_SRC/src/NETGENPlugin_NETGEN_3D_i
112 3.4. Implement being exported method.
114 GenericHypothesisCreator_i* GetHypothesisCreator (const char* aHypType)
116 <aHypType> is a value of <type> attribute in the XML-description file
118 Example: SMESH_SRC/src/StdMeshers_I/StdMeshers_i.cxx
119 NETGENPLUGIN_SRC/src/NETGENPlugin_i.cxx
121 4. Build client (GUI) plugin library <libMyClientLib.so>.
122 This step is required only if your hypotheses/algorithms need specific GUI for their construction.
124 4.1. Implement the required GUI (e.g. construction dialog boxes).
126 Example: SMESH_SRC/src/StdMeshersGUI/StdMeshersGUI_*Dlg
128 Note: all data from XML-description files is accessible in your GUI via HypothesisData class
129 (mySMESHGUI->GetHypothesisData (aHypType),
130 see SMESHGUI_Hypotheses.h for HypothesisData definition)
132 4.2. Provide icons and messages for your GUI.
134 4.2.1. Implement resource files
135 MyResourceKey_icons.po and MyResourceKey_msg_en.po
137 Example: SMESH_SRC/src/StdMeshersGUI/StdMeshers_*.po
138 NETGENPLUGIN_SRC/src/NETGENPlugin_icons.po
140 Note: ICON_SMESH_TREE_HYPO_MyHypType1 is ID of icon for Object Browser
141 for hypothesis with type="MyHypType1".
143 ICON_SMESH_TREE_ALGO_MyAlgType1 is ID of icon for Object Browser
144 for algorithm with type="MyAlgType1".
146 See paragraph 2 for definition of MyResourceKey, MyHypType1, MyAlgType1.
148 4.2.2. Define environment variable SALOME_<MyResourceKey>Resources to point to the
149 directory where resources are situated.
151 Example: setenv SALOME_StdMeshersResources ${SMESH_ROOT_DIR}/share/salome/resources/smesh
153 4.3. Implement your Hypothesis Creator and being exported method
155 SMESHGUI_GenericHypothesisCreator* GetHypothesisCreator
156 (QString aHypType, QString aServerLibName, SMESHGUI* aSMESHGUI)
158 <aHypType> is to pass a value of <type> attribute in XML-description file;
159 <aServerLibName> is to pass a value of <server-lib> attribute in XML-description file.
161 Example: SMESH_SRC/src/StdMeshersGUI/StdMeshersGUI.cxx
163 5. If your hypotheses/algorithms do not need specific GUI,
164 but you want to provide icons for object browser, see 4.2 paragrath
166 6. Setup your SALOME environment.
168 6.1. Add your plugin to the LD_LIBRARY_PATH, PYTHONPATH (and maybe PATH) environment variables, e.g.:
170 setenv PATH <path-to-my-plugin>/bin/salome:${PATH}
171 setenv LD_LIBRARY_PATH <path-to-my-plugin>/lib/salome:${LD_LIBRARY_PATH}
172 setenv PYTHONPATH <path-to-my-plugin>/lib/python2.2/site-packages/salome:${PYTHONPATH}
174 6.2. Set mesher plugin resources environment variable (see 4.2.2 paragraph)
176 Note: If you use runSalome.py script from KERNEL package to launch SALOME, you may not to set
177 environment variables, because this script sets them itself. All what you should do is
178 to add <plugin> section to your ${HOME}/.salome/salome.launch file for SMESH module section:
183 <module name="SMESH">
184 <plugin name="MyMesher"/>