PR: update documentation for script migration

This commit is contained in:
prascle 2013-04-11 15:16:14 +00:00
parent 231074d905
commit 74c2e02ab1
6 changed files with 125 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

View File

@ -9,6 +9,10 @@ where all package functionality is separated in groups by purpose.
\n Also you can find any function in the \ref geomBuilder
"linear documentation for geomBuilder.py".
\n With SALOME 7.2, the Python interface for Geometry has been slightly modified to offer new functionality,
\n You may have to modify your scripts generated with SALOME 6 or older versions.
\n Please see <li>\ref geompy_migration_page</li>
\n
\anchor tui_sample_geom_script
<br><h2>GEOM Python script example</h2>

View File

@ -0,0 +1,51 @@
/*!
\page geompy_migration_page Modifing Python scripts from SALOME 6 and before
\n With SALOME 7.2, the Python interface for Geometry has been slightly modified to offer new functionality:
<ul>
<li>\subpage tui_execution_distribution_page</li>
<li>\subpage tui_auto_completion_documentation_page</li>
</ul>
\n Scripts generated for SALOME 6 and older versions must be adapted to work in SALOME 7.2 with all functionality.
\n A compatibility mode allows old scripts to work in almost all cases, but with a warning.
<b>Salome initialisation must always be done as shown below</b>
\n (<em>salome_init()</em> can be invoked safely several times):
\code
import salome
salome.salome_init()
\endcode
<b>Geometry initialisation is modified.</b>
\n old mode:
\code
import geompy
geompy.init_geom(theStudy)
\endcode
new mode:
\code
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
\endcode
<b> Of course, <em>from geompy import *</em> is no more possible.</b>
\n You have to explicitely write <em>geompy.some_method()</em>.
\n <b>Some variables are no longer in namespace <em>geompy.GEOM</em> but in namespace <em>GEOM</em>.</b>
\n All the occurences of <em>geompy.GEOM.</em> can be replaced by <em>GEOM.</em>.
\n For instance:
\code
param_polyline = geompy.MakeCurveParametric("t", "sin(t)", "cos(t)", 0., 100., 100, geompy.GEOM.Polyline, theNewMethod=True)
\endcode
is replaced by:
\code
param_polyline = geompy.MakeCurveParametric("t", "sin(t)", "cos(t)", 0., 100., 100, GEOM.Polyline, theNewMethod=True)
\endcode
*/

View File

@ -0,0 +1,24 @@
/*!
\page tui_auto_completion_documentation_page Auto completion and interactive documentation in edition.
Some IDE (Integrated Development Environment) provide automatic completion and documentation
while editing a Python Script.
\n
For instance, with PyDev in Eclipse, we can have:
\n
\image html eclipse1.png
\n
<center><b>auto documentation under cursor</b></center>
\n
\image html eclipse2.png
\n
<center><b>auto completion with documentation</b></center>
\n
TODO: provide example of SALOME and eclipse configuration
*/

View File

@ -0,0 +1,46 @@
/*!
\page tui_execution_distribution_page Distribute Geometry script execution.
\n Several kinds of studies require distributed geometry and mesh calculations.
For instance, in some parametric studies, we need to compute a lot of geometries
and associated meshes in parallel on a cluster.
These studies are defined with a YACS Schema in which geometry and meshing
are done in distributed Python nodes running on distributed SALOME Containers.
We need to instantiate GEOM and SMESH Engines on these containers.
The standard way of geometry initialization in a Python script is:
\code
import salome
salome.salome_init()
from salome.geom import geomBuilder
geompy = geomBuilder.New(theStudy)
\endcode
With this initialization, the geometry engine runs in the default container,
embedded in the SALOME Graphical User Interface process
(see YACS documentation for concepts).
To select another engine than the default “FactoryServer”,
the CORBA engine can be given as an optional parameter of the method New.
For instance:
\code
from salome.geom import geomBuilder
lcc = salome.lcc
engineGeom = lcc.FindOrLoadComponent("myServer", "GEOM")
geompy = geomBuilder.New(theStudy, engineGeom)
\endcode
Or, within a Distributed Python Node of a YACS Schema, where the container
is already provided in the Python context of the node, with <em>my_container</em>:
\code
from salome.geom import geomBuilder
my_container.load_component_Library("GEOM")
engineGeom = my_container.create_component_instance("GEOM", 0)
geompy = geomBuilder.New(theStudy, engineGeom)
\endcode
*/