From: prascle Date: Thu, 11 Apr 2013 15:16:14 +0000 (+0000) Subject: PR: update documentation for script migration X-Git-Tag: V7_2_0~13 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=74c2e02ab17e41c38dcb91ad0e1319419f397408;p=modules%2Fgeom.git PR: update documentation for script migration --- diff --git a/doc/salome/gui/GEOM/images/eclipse1.png b/doc/salome/gui/GEOM/images/eclipse1.png new file mode 100644 index 000000000..b96d3285e Binary files /dev/null and b/doc/salome/gui/GEOM/images/eclipse1.png differ diff --git a/doc/salome/gui/GEOM/images/eclipse2.png b/doc/salome/gui/GEOM/images/eclipse2.png new file mode 100644 index 000000000..70e5e96b6 Binary files /dev/null and b/doc/salome/gui/GEOM/images/eclipse2.png differ diff --git a/doc/salome/gui/GEOM/input/geompy.doc b/doc/salome/gui/GEOM/input/geompy.doc index 569afa259..e5d3bcf0a 100644 --- a/doc/salome/gui/GEOM/input/geompy.doc +++ b/doc/salome/gui/GEOM/input/geompy.doc @@ -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
  • \ref geompy_migration_page
  • + \n \anchor tui_sample_geom_script

    GEOM Python script example

    diff --git a/doc/salome/gui/GEOM/input/geompy_migration.doc b/doc/salome/gui/GEOM/input/geompy_migration.doc new file mode 100644 index 000000000..d0af5c85e --- /dev/null +++ b/doc/salome/gui/GEOM/input/geompy_migration.doc @@ -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: + + + +\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. + +Salome initialisation must always be done as shown below +\n (salome_init() can be invoked safely several times): +\code +import salome +salome.salome_init() +\endcode + +Geometry initialisation is modified. +\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 + + + Of course, from geompy import * is no more possible. +\n You have to explicitely write geompy.some_method(). + +\n Some variables are no longer in namespace geompy.GEOM but in namespace GEOM. +\n All the occurences of geompy.GEOM. can be replaced by GEOM.. +\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 + + +*/ diff --git a/doc/salome/gui/GEOM/input/tui_auto_completion_documentation.doc b/doc/salome/gui/GEOM/input/tui_auto_completion_documentation.doc new file mode 100644 index 000000000..bc816366d --- /dev/null +++ b/doc/salome/gui/GEOM/input/tui_auto_completion_documentation.doc @@ -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 +
    auto documentation under cursor
    + + +\n +\image html eclipse2.png +\n +
    auto completion with documentation
    + +\n +TODO: provide example of SALOME and eclipse configuration + +*/ diff --git a/doc/salome/gui/GEOM/input/tui_execution_distribution.doc b/doc/salome/gui/GEOM/input/tui_execution_distribution.doc new file mode 100644 index 000000000..4d36e4efb --- /dev/null +++ b/doc/salome/gui/GEOM/input/tui_execution_distribution.doc @@ -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 my_container: +\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 + + +*/