Version: 8.3.0
 All Classes Namespaces Files Functions Variables Groups Pages
Modifying Geometry Python scripts from SALOME 6 and before


In SALOME 7.2, the Python interface for Geometry has been slightly modified to offer new functionality:


Scripts generated for SALOME 6 and older versions must be adapted to work in SALOME 7.2 with full functionality.
The compatibility mode allows old scripts to work in almost all cases, but with a warning.

Salome initialisation must always be done as shown below
(salome_init() can be invoked safely several times):

import salome
salome.salome_init()

Geometry initialisation is modified.
the old mode:

import geompy
geompy.init_geom(theStudy)


the new mode:

import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)

Of course, from geompy import * is no more possible.
You have to explicitely write geompy.some_method().


Some variables have been transferred from the namespace geompy.GEOM to the namespace GEOM.
All occurrences of geompy.GEOM. can be replaced by GEOM..
For instance:

param_polyline = geompy.MakeCurveParametric("t", "sin(t)", "cos(t)", 0., 100., 100, geompy.GEOM.Polyline, theNewMethod=True)

is replaced by:

param_polyline = geompy.MakeCurveParametric("t", "sin(t)", "cos(t)", 0., 100., 100, GEOM.Polyline, theNewMethod=True)