]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
Merge V9_dev branch into master
authorrnv <rnv@opencascade.com>
Thu, 14 Jun 2018 11:56:19 +0000 (14:56 +0300)
committerrnv <rnv@opencascade.com>
Thu, 14 Jun 2018 11:56:19 +0000 (14:56 +0300)
104 files changed:
1  2 
CMakeLists.txt
doc/salome/examples/defining_hypotheses_ex13.py
doc/salome/gui/SMESH/collect_mesh_methods.py
doc/salome/gui/SMESH/input/smesh_migration.rst
doc/salome/gui/SMESH/merge_mesh_class.py
idl/SMESH_Mesh.idl
src/DriverMED/CMakeLists.txt
src/DriverMED/DriverMED_Family.cxx
src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx
src/DriverMED/DriverMED_W_Field.cxx
src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx
src/DriverMED/DriverMED_W_SMESHDS_Mesh.h
src/SMESH/CMakeLists.txt
src/SMESH/SMESH_Algo.cxx
src/SMESH/SMESH_Algo.hxx
src/SMESH/SMESH_Gen.cxx
src/SMESH/SMESH_Hypothesis.hxx
src/SMESH/SMESH_Mesh.cxx
src/SMESHClient/CMakeLists.txt
src/SMESHGUI/CMakeLists.txt
src/SMESHGUI/SMESHGUI.cxx
src/SMESHGUI/SMESHGUI_Add0DElemsOnAllNodesDlg.cxx
src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx
src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.cxx
src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx
src/SMESHGUI/SMESHGUI_ClippingDlg.cxx
src/SMESHGUI/SMESHGUI_ComputeDlg.cxx
src/SMESHGUI/SMESHGUI_ConvToQuadOp.cxx
src/SMESHGUI/SMESHGUI_CopyMeshDlg.cxx
src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx
src/SMESHGUI/SMESHGUI_DeleteGroupDlg.cxx
src/SMESHGUI/SMESHGUI_DisplayEntitiesDlg.cxx
src/SMESHGUI/SMESHGUI_DuplicateNodesDlg.cxx
src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx
src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx
src/SMESHGUI/SMESHGUI_FilterDlg.cxx
src/SMESHGUI/SMESHGUI_FindElemByPointDlg.cxx
src/SMESHGUI/SMESHGUI_GroupDlg.cxx
src/SMESHGUI/SMESHGUI_GroupOnShapeDlg.cxx
src/SMESHGUI/SMESHGUI_GroupOpDlg.cxx
src/SMESHGUI/SMESHGUI_Hypotheses.cxx
src/SMESHGUI/SMESHGUI_Make2DFrom3DOp.cxx
src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx
src/SMESHGUI/SMESHGUI_MergeDlg.cxx
src/SMESHGUI/SMESHGUI_MeshInfo.cxx
src/SMESHGUI/SMESHGUI_MeshOp.cxx
src/SMESHGUI/SMESHGUI_MeshOrderOp.cxx
src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx
src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx
src/SMESHGUI/SMESHGUI_NodesDlg.cxx
src/SMESHGUI/SMESHGUI_OffsetDlg.cxx
src/SMESHGUI/SMESHGUI_Operation.h
src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx
src/SMESHGUI/SMESHGUI_RemoveNodesDlg.cxx
src/SMESHGUI/SMESHGUI_RenumberingDlg.cxx
src/SMESHGUI/SMESHGUI_ReorientFacesDlg.cxx
src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx
src/SMESHGUI/SMESHGUI_RotationDlg.cxx
src/SMESHGUI/SMESHGUI_ScaleDlg.cxx
src/SMESHGUI/SMESHGUI_Selection.cxx
src/SMESHGUI/SMESHGUI_SelectionOp.cxx
src/SMESHGUI/SMESHGUI_SewingDlg.cxx
src/SMESHGUI/SMESHGUI_SingleEditDlg.cxx
src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx
src/SMESHGUI/SMESHGUI_SplitBiQuad.cxx
src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx
src/SMESHGUI/SMESHGUI_TranslationDlg.cxx
src/SMESHGUI/SMESHGUI_VTKUtils.cxx
src/SMESHGUI/SMESHGUI_VTKUtils.h
src/SMESHGUI/SMESH_msg_en.ts
src/SMESHGUI/SMESH_msg_fr.ts
src/SMESHGUI/SMESH_msg_ja.ts
src/SMESH_I/CMakeLists.txt
src/SMESH_I/SMESH_2smeshpy.cxx
src/SMESH_I/SMESH_Gen_i.cxx
src/SMESH_I/SMESH_Gen_i.hxx
src/SMESH_I/SMESH_Gen_i_1.cxx
src/SMESH_I/SMESH_MeshEditor_i.cxx
src/SMESH_I/SMESH_Mesh_i.cxx
src/SMESH_I/SMESH_PreMeshInfo.cxx
src/SMESH_I/SMESH_PythonDump.hxx
src/SMESH_SWIG/StdMeshersBuilder.py
src/SMESH_SWIG/smeshBuilder.py
src/SMESH_SWIG/smesh_algorithm.py
src/SMESH_SWIG_WITHIHM/CMakeLists.txt
src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx
src/SMESH_SWIG_WITHIHM/libSMESH_Swig.h
src/SMESH_SWIG_WITHIHM/libSMESH_Swig.i
src/StdMeshers/StdMeshers_Cartesian_3D.cxx
src/StdMeshers/StdMeshers_HexaFromSkin_3D.cxx
src/StdMeshers/StdMeshers_Import_1D2D.cxx
src/StdMeshers/StdMeshers_MEFISTO_2D.cxx
src/StdMeshers/StdMeshers_Prism_3D.cxx
src/StdMeshers/StdMeshers_Projection_1D2D.cxx
src/StdMeshers/StdMeshers_Projection_2D.cxx
src/StdMeshers/StdMeshers_Projection_3D.cxx
src/StdMeshers/StdMeshers_Quadrangle_2D.cxx
src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.cxx
src/StdMeshers/StdMeshers_ViscousLayers.cxx
src/StdMeshers/StdMeshers_ViscousLayers2D.cxx
src/StdMeshersGUI/CMakeLists.txt
src/Tools/MGCleanerPlug/MGCleanerMonPlugDialog.py
src/Tools/MacMesh/MacMesh/PublishGroups.py
src/Tools/padder/spadderpy/gui/plugindialog.py

diff --combined CMakeLists.txt
index a3cadb23203abb854b97b721b9fe32e695d43929,b207ae53e6f982c57d1ec91f96db9a366da3fd14..8e28516e7e2930582de7ae892174f1d31b715047
@@@ -19,8 -19,6 +19,8 @@@
  CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR)
  PROJECT(SalomeSMESH C CXX)
  
 +INCLUDE(CMakeDependentOption)
 +
  # Ensure a proper linker behavior:
  CMAKE_POLICY(SET CMP0003 NEW)
  IF(WIN32)
@@@ -33,7 -31,7 +33,7 @@@ ENDIF(WIN32
  STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
  
  SET(${PROJECT_NAME_UC}_MAJOR_VERSION 8)
 -SET(${PROJECT_NAME_UC}_MINOR_VERSION 4)
 +SET(${PROJECT_NAME_UC}_MINOR_VERSION 5)
  SET(${PROJECT_NAME_UC}_PATCH_VERSION 0)
  SET(${PROJECT_NAME_UC}_VERSION
    ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})
@@@ -80,8 -78,6 +80,8 @@@ OPTION(SALOME_BUILD_GUI            "Ena
  OPTION(SALOME_SMESH_USE_CGNS       "Enable import/export to CGNS format" OFF)
  OPTION(SALOME_SMESH_USE_TBB        "Enable parallel computation" OFF)
  OPTION(SALOME_SMESH_DYNLOAD_LOCAL  "Load plug-ins' symbols locally (Linux only)" ON)
 +CMAKE_DEPENDENT_OPTION(SALOME_SMESH_BUILD_FRENCH_DOC "Generate SALOME SMESH French documentation" OFF
 +                       "SALOME_BUILD_DOC" OFF)
  
  IF(SALOME_SMESH_DYNLOAD_LOCAL)
    ADD_DEFINITIONS(-DDYNLOAD_LOCAL)
@@@ -132,7 -128,6 +132,7 @@@ IF(SALOME_BUILD_TESTS
  ENDIF()
  IF(SALOME_BUILD_DOC)
    FIND_PACKAGE(SalomeDoxygen)
 +  SET(Sphinx_EXTENSIONS sphinxcontrib.napoleon)
    FIND_PACKAGE(SalomeSphinx)
    SALOME_LOG_OPTIONAL_PACKAGE(Doxygen SALOME_BUILD_DOC)
    SALOME_LOG_OPTIONAL_PACKAGE(Sphinx SALOME_BUILD_DOC)
@@@ -196,7 -191,7 +196,7 @@@ ENDIF(EXISTS ${GEOM_ROOT_DIR}
  # VTK is obligatiry for the SMESH
  FIND_PACKAGE(SalomeVTK REQUIRED)
  
 -FIND_PACKAGE(SalomeCAS REQUIRED) 
 +FIND_PACKAGE(SalomeOpenCASCADE REQUIRED) 
  
  IF(SALOME_SMESH_USE_CGNS)
    FIND_PACKAGE(SalomeCGNS)
@@@ -306,7 -301,7 +306,7 @@@ INCLUDE(CMakePackageConfigHelpers
  # They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup"
  SET(_${PROJECT_NAME}_exposed_targets 
    SMESHControls MeshDriver MeshDriverDAT MeshDriverGMF MeshDriverMED
-   MeshDriverSTL MeshDriverUNV MEDWrapperBase MEDWrapper MEDWrapper_V2_2
+   MeshDriverSTL MeshDriverUNV MEDWrapper
    SMDS SMESHimpl SMESHEngine SMESHClient SMESHDS
    SMESHUtils StdMeshers StdMeshersEngine MeshJobManagerEngine
    SPADDERPluginTesterEngine SalomeIDLSMESH SalomeIDLSPADDER
index 5fa5e53442f2c836f2b1f160362caaa368320e42,0bcdcf60a2bc2b777cf8576d8c4fdcf2f743b0fd..e952460016a7f4ef6d1eb14a414693ad1dd05d8d
@@@ -4,11 -4,11 +4,11 @@@ import salom
  salome.salome_init()
  import GEOM
  from salome.geom import geomBuilder
- geompy = geomBuilder.New(salome.myStudy)
+ geompy = geomBuilder.New()
  
  import SMESH, SALOMEDS
  from salome.smesh import smeshBuilder
- smesh =  smeshBuilder.New(salome.myStudy)
+ smesh =  smeshBuilder.New()
  
  # Create face from the wire and add to study
  Face = geompy.MakeSketcher("Sketcher:F 0 0:TT 20 0:R 90:C 20 90:WF", [0, 0, 0, 1, 0, 0, 0, 0, 1])
@@@ -25,18 -25,15 +25,18 @@@ radial_Quad_algo = mesh.Quadrangle(algo
  
  # The Radial Quadrange algorithm can work without any hypothesis
  # In this case it uses "Default Nb of Segments" preferences parameter to discretize edges
 +# So by default there will be 15 segments in both radial and circular directions
  mesh.Compute()
  
  # The Radial Quadrange uses global or local 1d hypotheses if it does
  # not have its own hypotheses.
  # Define global hypotheses to discretize radial edges and a local one for circular edge
 +# So that there will be 5 radial layers and 10 circular segments
  global_Nb_Segments = mesh.Segment().NumberOfSegments(5)
  local_Nb_Segments  = mesh.Segment(circle).NumberOfSegments(10)
  mesh.Compute()
  
  # Define own parameters of Radial Quadrange algorithm
 +# The number of radial layers will be 4
  radial_Quad_algo.NumberOfLayers( 4 )
  mesh.Compute()
index a76c6164cbb094ccdd2250006cfbcd85d8c75ef1,542c5d7fdb3985b6296f7c5ae41d0a83947b800d..99457030cadf117e8f93bf95da567a33a5f7d44c
@@@ -1,5 -1,4 +1,4 @@@
- #!/usr/bin/env python
- #  -*- coding: iso-8859-1 -*-
+ #!/usr/bin/env python3
  # Copyright (C) 2012-2016  CEA/DEN, EDF R&D, OPEN CASCADE
  #
  # This library is free software; you can redistribute it and/or
@@@ -31,7 -30,7 +30,7 @@@
  # class.
  # 
  # This script is intended for internal usage - only
- # for generatation of the extra developer documentation for
+ # for generation of the extra developer documentation for
  # the meshing plug-in(s).
  # 
  # Usage:
  # variables are set properly; otherwise the script will fail.
  #
  ################################################################################
+ import inspect
  import sys
  
 -def main(plugin_name, dummymeshhelp = True, output_file = "smeshBuilder.py"):
 +def main(plugin_name, dummymeshhelp = True, output_file = "smeshBuilder.py", format = "doxygen"):
      plugin_module_name  = plugin_name + "Builder"
      plugin_module       = "salome.%s.%s" % (plugin_name, plugin_module_name)
      try:
-         exec( "from salome.smesh.smeshBuilder import *")
-         exec( "import %s" % plugin_module )
-         exec( "mod = %s" % plugin_module )
+         exec("from salome.smesh.smeshBuilder import *", globals())
+         exec("import %s" % plugin_module, globals())
+         exec("mod = %s" % plugin_module , globals())
          methods = {}
          for attr in dir( mod ):
              if attr.startswith( '_' ): continue
              algo = getattr( mod, attr )
-             if type( algo ).__name__ == 'classobj' and hasattr( algo, "meshMethod" ):
+             if inspect.isclass(algo) and hasattr(algo, "meshMethod"):
                  method = getattr( algo, "meshMethod" )
                  if method not in methods: methods[ method ] = []
                  methods[ method ].append( algo )
          if methods:
              output = []
              if dummymeshhelp:
-               if format == "doxygen":
 -                output.append( "## @package smeshBuilder" )
 -                output.append( "#  Documentation of the methods dynamically added by the " + plugin_name + " meshing plug-in to the Mesh class." )
 -                output.append( "" )
++                if format == "doxygen":
 +                    output.append( "## @package smeshBuilder" )
 +                    output.append( "#  Documentation of the methods dynamically added by the " + plugin_name + " meshing plug-in to the Mesh class." )
 +                    output.append( "" )
 +                elif format == "sphinx":
 +                    output.append( '"""' )
 +                    output.append( 'Documentation of the methods dynamically added by the ' + plugin_name + ' meshing plug-in to the Mesh class.' )
 +                    output.append( '"""' )
 +                    output.append( '' )
                  pass
 -            output.append( "## This class allows defining and managing a mesh." )
 -            output.append( "#" )
 +            if format == "doxygen":
 +                output.append( "## This class allows defining and managing a mesh." )
 +                output.append( "#" )
 +            elif format == "sphinx":
 +                output.append( "class Mesh:" )
 +                output.append( '    """' )
 +                output.append( '    This class allows defining and managing a mesh.' )
 +                output.append( '    ' )
              if dummymeshhelp:
                  # Add dummy Mesh help
                  # This is supposed to be done when generating documentation for meshing plug-ins
 -                output.append( "#  @note The documentation below does not provide complete description of class @b %Mesh" )
 -                output.append( "#  from @b smeshBuilder package. This documentation provides only information about" )
 -                output.append( "#  the methods dynamically added to the %Mesh class by the " + plugin_name + " plugin" )
 -                output.append( "#  For more details on the %Mesh class, please refer to the SALOME %Mesh module" )
 -                output.append( "#  documentation." )
 +                if format == "doxygen":
-                   output.append( "#  @note The documentation below does not provide complete description of class @b %Mesh" )
++                    output.append( "#  @note The documentation below does not provide complete description of class @b %Mesh" )
 +                    output.append( "#  from @b smeshBuilder package. This documentation provides only information about" )
 +                    output.append( "#  the methods dynamically added to the %Mesh class by the " + plugin_name + " plugin" )
 +                    output.append( "#  For more details on the %Mesh class, please refer to the SALOME %Mesh module" )
 +                    output.append( "#  documentation." )
 +                elif format == "sphinx":
 +                    output.append( '    The documentation below does not provide complete description of class @b %Mesh' )
 +                    output.append( '    from @b smeshBuilder package. This documentation provides only information about' )
 +                    output.append( '    the methods dynamically added to the %Mesh class by the " + plugin_name + " plugin' )
 +                    output.append( '    For more details on the %Mesh class, please refer to the SALOME %Mesh module' )
 +                    output.append( '    documentation.' )
 +                    output.append( '    """' )
 +                    output.append( '    ' )
                  pass
              else:
                  # Extend documentation for Mesh class with information about dynamically added methods.
                  # This is supposed to be done only when building documentation for SMESH module
 -                output.append( "#  @note Some methods are dynamically added to the @b %Mesh class in runtime by meshing " )
 -                output.append( "#  plug-in modules. If you fail to find help on some methods in the documentation of SMESH module, " )
 -                output.append( "#  try to look into the documentation for the meshing plug-ins." )
 +                if format ==  "doxygen":
 +                    output.append( "#  @note Some methods are dynamically added to the @b %Mesh class in runtime by meshing " )
-                   output.append( "#  plug-in modules. If you fail to find help on some methods in the documentation of SMESH module, " )
-                   output.append( "#  try to look into the documentation for the meshing plug-ins." )
-               elif format == "sphinx":
++                    output.append( "#  plug-in modules. If you fail to find help on some methods in the documentation of SMESH module, " )
++                    output.append( "#  try to look into the documentation for the meshing plug-ins." )
++                elif format == "sphinx":
 +                    output.append( "    Note:")
 +                    output.append( "        Some methods are dynamically added to the @b %Mesh class in runtime by meshing " )
-                   output.append( "        plug-in modules. If you fail to find help on some methods in the documentation of SMESH module, " )
-                   output.append( "        try to look into the documentation for the meshing plug-ins." )
++                    output.append( "        plug-in modules. If you fail to find help on some methods in the documentation of SMESH module, " )
++                    output.append( "        try to look into the documentation for the meshing plug-ins." )
 +                    output.append( '    """' )
 +                    output.append( '    ' )
                  pass
 -            output.append( "class Mesh:" )
 +            if format == "doxygen":
 +                output.append( "class Mesh:" )
              for method in methods:
                  docHelper = ""
                  for algo in methods[ method ]:
                      if docHelper: break
                      pass
                  if not docHelper: docHelper = "Creates new algorithm."
 -                output.append( "  ## %s" % docHelper )
 -                output.append( "  #" )
 -                output.append( "  #  This method is dynamically added to %Mesh class by the meshing plug-in(s). " )
 -                output.append( "  #" )
 -                output.append( "  #  If the optional @a geom_shape parameter is not set, this algorithm is global (applied to whole mesh)." )
 -                output.append( "  #  Otherwise, this algorithm defines a submesh based on @a geom_shape subshape." )
 -                output.append( "  #  @param algo_type type of algorithm to be created; allowed values are specified by classes implemented by plug-in (see below)" )
 -                output.append( "  #  @param geom_shape if defined, the subshape to be meshed (GEOM_Object)" )
 -                output.append( "  #  @return An instance of Mesh_Algorithm sub-class according to the specified @a algo_type, see " )
 -                output.append( "  #  %s" % ", ".join( [ "%s.%s" % ( plugin_module_name, algo.__name__ ) for algo in methods[ method ] ] ) )
 -                output.append( "  def %s(algo_type, geom_shape=0):" % method )
 -                output.append( "    pass" )
 +                if format == "doxygen":
 +                    output.append( " ## %s" % docHelper )
 +                    output.append( " #" )
 +                    output.append( " #  This method is dynamically added to %Mesh class by the meshing plug-in(s). " )
 +                    output.append( " #" )
 +                    output.append( " #  If the optional @a geom_shape parameter is not set, this algorithm is global (applied to whole mesh)." )
 +                    output.append( " #  Otherwise, this algorithm defines a submesh based on @a geom_shape subshape." )
 +                    output.append( " #  @param algo_type type of algorithm to be created; allowed values are specified by classes implemented by plug-in" )
 +                    output.append( " #  @param geom_shape if defined, the subshape to be meshed (GEOM_Object)" )
 +                    output.append( " #  @return An instance of Mesh_Algorithm sub-class according to the specified @a algo_type, see " )
 +                    output.append( " #  %s" % ", ".join( [ "%s.%s" % ( plugin_module_name, algo.__name__ ) for algo in methods[ method ] ] ) )
 +                    output.append( " def %s(algo_type, geom_shape=0):" % method )
 +                    output.append( "   pass" )
 +                elif format == "sphinx":
 +                    output.append( '    def %s(algo_type, geom_shape=0):' % method )
 +                    output.append( '        """' )
 +                    output.append( '        %s' % docHelper )
 +                    output.append( '        ' )
 +                    output.append( '        This method is dynamically added to :class:`Mesh <smeshBuilder.Mesh>` class by the meshing plug-in(s). ' )
 +                    output.append( '        ' )
 +                    output.append( '        If the optional *geom_shape* parameter is not set, this algorithm is global (applied to whole mesh).' )
 +                    output.append( '        Otherwise, this algorithm defines a submesh based on *geom_shape* subshape.' )
 +                    output.append( '        ' )
 +                    output.append( '        Parameters:' )
 +                    output.append( '            algo_type: type of algorithm to be created; allowed values are specified by classes implemented by plug-in' )
 +                    output.append( '            geom_shape (GEOM_Object): if defined, the subshape to be meshed' )
 +                    output.append( '        ' )
 +                    output.append( '        Returns:')
 +                    output.append( '            An instance of Mesh_Algorithm sub-class according to the specified *algo_type*, see ' )
 +                    output.append( '            %s' % ", ".join( [ ":class:`~%s.%s`" % ( plugin_module_name, algo.__name__ ) for algo in methods[ method ] ] ) )
 +                    output.append( '        """' )
 +                    output.append( '        pass' )
                  pass
-             f = open(output_file, "w")
-             for line in output: f.write( line + "\n" )
-             f.close()
+             with open(output_file, "w", encoding='utf8') as f:
+                 f.write('\n'.join(output))
              pass
          pass
-     except Exception, e:
-         print e
+     except Exception as e:
+         print(e)
          pass
      pass
      
  if __name__ == "__main__":
-     import optparse
-     parser = optparse.OptionParser(usage="%prog [options] plugin")
+     import argparse
+     parser = argparse.ArgumentParser()
      h  = "Output file (smesh.py by default)"
-     parser.add_option("-o", "--output", dest="output",
-                       action="store", default=None, metavar="file",
+     parser.add_argument("-o", "--output", dest="output",
+                       action="store", default='smesh.py', metavar="file",
                        help=h)
      h  = "If this option is True, dummy help for Mesh class is added. "
      h += "This option should be False (default) when building documentation for SMESH module "
      h += "and True when building documentation for meshing plug-ins."
-     parser.add_option("-d", "--dummy-mesh-help", dest="dummymeshhelp",
+     parser.add_argument("-d", "--dummy-mesh-help", dest="dummymeshhelp",
                        action="store_true", default=False,
                        help=h)
 -    parser.add_argument("plugin", help='Name of plugin')
 +    h = "Format of the documentation strings in the output file. Possible values are: "
 +    h+= "'doxygen' - documentation strings are generated in the doxygen format, before a method defenition."
 +    h+= "'sphinx' - documentation strings are generated in the sphinx format, after a method defenition."
-     parser.add_option("-f", "--format", dest="format",
++    parser.add_argument("-f", "--format", dest="format",
 +                      action="store", default="doxygen", help=h)
 +
-     (options, args) = parser.parse_args()
++    parser.add_argument("plugin_name")
++
++
+     args = parser.parse_args()
  
-     if len( args ) < 1: sys.exit("Plugin name is not specified")
-     main( args[0], options.dummymeshhelp, options.output, options.format )
 -    main( args.plugin, args.dummymeshhelp, args.output )
++    if args.plugin_name is None : sys.exit("Plugin name is not specified")
++    main( args.plugin_name, args.dummymeshhelp, args.output, args.format )
      pass
index 5a2202486c227ca283c9222df3ff27723e4114b3,0000000000000000000000000000000000000000..59487da2f476e6bcd3cf75176aeac43d140462c5
mode 100644,000000..100644
--- /dev/null
@@@ -1,105 -1,0 +1,105 @@@
- *****************************************************
- Modifing Mesh Python scripts from SALOME 6 and before
- *****************************************************
 +.. _smesh_migration_page:
 +
-       smesh =  smeshBuilder.New(salome.myStudy)
++******************************************************
++Modifying Mesh Python scripts from SALOME 6 and before
++******************************************************
 +
 +In SALOME 7.2, the Python interface for Mesh 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()
 +
 +* **smesh initialisation** is modified.
 +
 +  The old mode (from dump)::
 +
 +      import smesh, SMESH, SALOMEDS
 +      smesh.SetCurrentStudy(salome.myStudy)
 +
 +  The new mode::
 +
 +      import SMESH, SALOMEDS
 +      from salome.smesh import smeshBuilder
-   You have to explicitely write *smesh.some_method()*.
++      smesh =  smeshBuilder.New()
 +
 +
 +* Of course, **from smesh import** * is **no more possible.**
 +
- * If you need to **import a SMESH Plugin** explicitely, keep in mind that  they are now located in separate namespaces.
++  You have to explicitly write *smesh.some_method()*.
 +
 +* All **algorithms** have been transferred from the namespace *smesh* to the namespace *smeshBuilder*.
 +
 +  For instance::
 +
 +      MEFISTO_2D_1 = Mesh_1.Triangle(algo=smesh.MEFISTO,geom=Face_1)
 +
 +  is replaced by::
 +
 +      MEFISTO_2D_1 = Mesh_1.Triangle(algo=smeshBuilder.MEFISTO,geom=Face_1)
 +
 +  StdMeshers algorithms concerned are *REGULAR, PYTHON, COMPOSITE, MEFISTO, Hexa, QUADRANGLE, RADIAL_QUAD*.
 +
 +  SMESH Plugins provide such algorithms as: *NETGEN, NETGEN_FULL, FULL_NETGEN, NETGEN_1D2D3D, NETGEN_1D2D, NETGEN_2D, NETGEN_3D*.
 +
 +  If you use DISTENE plugins, you also have *BLSURF, GHS3D, GHS3DPRL, Hexotic*.
 +
 +* Some **variables** were available in both namespaces *smesh* and *SMESH*. Now they are available only in namespace *SMESH*.
 +
 +  The dump function used only the namespace *SMESH*,
 +  so, if your script was built with the help of the dump function, it should be already OK in this respect.
 +
 +  The most used variables concerned are:
 +
 +  * *NODE, EDGE, FACE, VOLUME, ALL.*
 +  * *FT_xxx, geom_xxx, ADD_xxx...*
 +
 +  For instance::
 +
 +      srcFaceGroup = srcMesh.GroupOnGeom( midFace0, "src faces", smesh.FACE )
 +      mesh.MakeGroup("Tetras",smesh.VOLUME,smesh.FT_ElemGeomType,"=",smesh.Geom_TETRA)
 +      filter = smesh.GetFilter(smesh.FACE, smesh.FT_AspectRatio, smesh.FT_MoreThan, 6.5)
 +
 +  is replaced by::
 +
 +      srcFaceGroup = srcMesh.GroupOnGeom( midFace0, "src faces", SMESH.FACE )
 +      mesh.MakeGroup("Tetras",SMESH.VOLUME,SMESH.FT_ElemGeomType,"=",SMESH.Geom_TETRA)
 +      filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_AspectRatio, SMESH.FT_MoreThan, 6.5)
 +
 +
 +* The namespace **smesh.smesh** does not exist any more, use **smesh** instead.
 +
 +  For instance::
 +
 +      Compound1 = smesh.smesh.Concatenate([Mesh_inf.GetMesh(), Mesh_sup.GetMesh()], 0, 1, 1e-05)
 +
 +  is replaced by::
 +
 +      Compound1 = smesh.Concatenate([Mesh_inf.GetMesh(), Mesh_sup.GetMesh()], 0, 1, 1e-05)
 +
++* If you need to **import a SMESH Plugin** explicitly, keep in mind that  they are now located in separate namespaces.
 +
 +  For instance::
 +
 +      import StdMeshers
 +      import NETGENPlugin
 +      import BLSURFPlugin
 +      import GHS3DPlugin
 +      import HexoticPLUGIN
 +
 +  is replaced by:: 
 +
 +      from salome.StdMeshers import StdMeshersBuilder
 +      from salome.NETGENPlugin import NETGENPluginBuilder
 +      from salome.BLSURFPlugin import BLSURFPluginBuilder
 +      from salome.GHS3DPlugin import GHS3DPluginBuilder
 +      from salome.HexoticPLUGIN import HexoticPLUGINBuilder
 +
 +
index dd9806b52d344ce344d9cedf98dc32b15694167d,0000000000000000000000000000000000000000..19ce22fc53eee04bf97d9b3536b9777843830fd3
mode 100644,000000..100644
--- /dev/null
@@@ -1,59 -1,0 +1,59 @@@
-     except Exception, e:
-         print e
 +import inspect
 +import sys
 +from types import FunctionType
 +import copy
 +
 +ORIGIN_MODULE_SUFFIX = "_origin"
 +DYNAMIC_MODULE_SUFFIX = "_dynamic"
 +
 +
 +def main(module_name, output_file = "smeshBuilder.py"):
 +    oringin_module_name = module_name + ORIGIN_MODULE_SUFFIX
 +    dynamic_module_name = module_name + DYNAMIC_MODULE_SUFFIX
 +    try:
 +        exec( "import %s" % oringin_module_name )
 +        exec( "origin_module = %s" % oringin_module_name )
 +        origin_module_lines = inspect.getsourcelines( origin_module )[0]
 +        origin_meshClass_lines = inspect.getsourcelines(origin_module.Mesh)[0]
 +        origin_module_text = "".join( origin_module_lines )
 +        origin_meshClass_text = "".join( origin_meshClass_lines )
 +        
 +        exec( "import %s" % dynamic_module_name )
 +        exec( "dynanmic_module = %s" % dynamic_module_name )
 +        dynanmic_meshClass = dynanmic_module.Mesh
 +    
 +        new_meshClass_lines = copy.copy(origin_meshClass_lines)
 +        # remove end of class 'pass'
 +        if new_meshClass_lines[-1].find("pass") > 0:
 +            new_meshClass_lines.pop()
 +            
 +        dynanmic_meshClass_methods = [x for x, y in dynanmic_meshClass.__dict__.items() if type(y) == FunctionType]
 +        for method in dynanmic_meshClass_methods:
 +            exec( "method_lines = inspect.getsourcelines(dynanmic_module.Mesh.%s)[0]"  % method)
 +            new_meshClass_lines+=method_lines
 +            pass
 +        new_meshClass_text = "".join( new_meshClass_lines )            
 +
 +        f = open( output_file, "w" )
 +        
 +        f.write( origin_module_text.replace( origin_meshClass_text, new_meshClass_text) )
 +        f.close()        
++    except Exception as e:
++        print(e)
 +        pass
 +    pass
 +
 +
 +if __name__ == "__main__":
 +    import optparse
 +    parser = optparse.OptionParser(usage="%prog [options] modulename")
 +    h  = "Output file (smeshBuilder.py by default)"
 +    parser.add_option("-o", "--output", dest="output",
 +                      action="store", default="smeshBuilder.py", metavar="file",
 +                      help=h)
 +
 +    (options, args) = parser.parse_args()
 +
 +    if len( args ) < 1: sys.exit("Module name is not specified")
 +    main( args[0], options.output )
 +    pass
diff --combined idl/SMESH_Mesh.idl
index 66f5faa6f79d30b9aaa2bfbcbffc5473d16cb0de,69c41d4d64a49f314ea73ef9f558ab4ef02afbb1..3e8e2ca2e40ad38299387ef2037f558090a93edf
@@@ -206,7 -206,7 +206,7 @@@ module SMES
    {
      HYP_OK,
      HYP_MISSING,      // algo misses a hypothesis
 -    HYP_CONCURENT,    // several applicable hypotheses
 +    HYP_CONCURRENT,   // several applicable hypotheses
      HYP_BAD_PARAMETER,// hypothesis has a bad parameter value
      HYP_HIDDEN_ALGO,  // an algo is hidden by an upper dim algo generating all-dim elements
      HYP_HIDING_ALGO,  // an algo hides lower dim algos by generating all-dim elements
      DRS_FAIL            // general failure (exception etc.)
    };
  
-   /*!
-    * Enumeration for ExportToMED*()
-    * MED_V2_1 and MED_V2_2 are here for compatibility and mean respectively obsolete and MED_LATEST.
-    * MED_MINOR_0 to MED_MINOR_9 are use to specify the minor version used by MEDfichier
-    * to write MED files (major version cannot be changed).
-    * This allows backward compatibility from a newer version of SALOME to an older one:
-    * for instance, a MESH produced in SALOME 8.4 (med 3.3) can be written in med 3.2 format
-    * to be read in SALOME 8.3.
-    */
-   enum MED_VERSION
-   {
-     MED_V2_1,
-     MED_V2_2,
-     MED_LATEST,
-     MED_MINOR_0,
-     MED_MINOR_1,
-     MED_MINOR_2,
-     MED_MINOR_3,
-     MED_MINOR_4,
-     MED_MINOR_5,
-     MED_MINOR_6,
-     MED_MINOR_7,
-     MED_MINOR_8,
-     MED_MINOR_9
-   };
    /*! 
     * \brief A structure containing information about MED file
     */
    typedef sequence<SMESH_subMesh>     submesh_array;
    typedef sequence<submesh_array>     submesh_array_array;
  
-   interface SMESH_Mesh : SALOME::GenericObj, SMESH_IDSource
+   interface SMESH_Mesh : SMESH_IDSource
    {
      /*!
       * Return true if there is a geometry to be meshed
       */
      long GetId();
  
-     /*!
-      * Get the study Id
-      */
-     long GetStudyId();
      /*!
       * Obtain instance of SMESH_MeshEditor
       */
      boolean HasDuplicatedGroupNamesMED();
  
      /*!
-      * Export Mesh to a MED Format file
+      * Export a Mesh to MED file.
       * @params
-      * - file : name of the MED file
+      * - fileName : name of the MED file
       * - auto_groups : boolean parameter for creating/not creating
       *                 the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
       *                 the typical use is auto_groups=false.
-      * - version : defines the version of format of MED file, that will be created
       * - overwrite : boolean parameter for overwriting/not overwriting the file, if it exists
       * - autoDimension : if @c true, a space dimension of a MED mesh can be either
       *         - 1D if all mesh nodes lie on OX coordinate axis, or
       *         - 3D in the rest cases.
       *         If @a autoDimension is @c false, the space dimension is always 3.
       */
-     void ExportToMEDX( in string      file, 
-                        in boolean     auto_groups, 
-                        in MED_VERSION version, 
-                        in boolean     overwrite,
-                        in boolean     autoDimension) raises (SALOME::SALOME_Exception);
+     void ExportMED( in string      fileName, 
+                   in boolean     auto_groups, 
+                   in boolean     overwrite,
+                   in boolean     autoDimension) raises (SALOME::SALOME_Exception);
  
      /*!
       * Export a [part of] Mesh into a MED file
       * @params
       * - meshPart : a part of mesh to store
-      * - file : name of the MED file
-      * - version : define the version of format of MED file, that will be created
+      * - fileName : name of the MED file
       * - overwrite : boolean parameter for overwriting/not overwriting the file, if it exists
       * - autoDimension : if @c True, a space dimension for export is defined by mesh 
       *                 configuration; for example a planar mesh lying on XOY plane
       *         - 's' stands for _solids_ field.
       */
      void ExportPartToMED( in SMESH_IDSource     meshPart,
-                           in string             file,
+                           in string             fileName,
                            in boolean            auto_groups,
-                           in MED_VERSION        version,
                            in boolean            overwrite,
                            in boolean            autoDimension,
                            in GEOM::ListOfFields fields,
                            in string             geomAssocFields ) raises (SALOME::SALOME_Exception);
  
-     /*!
-      * Export Mesh to a MED Format file
-      * Works, just the same as ExportToMEDX, with overwrite parameter equal to true.
-      * The method is kept in order to support old functionality
-      */
-     void ExportToMED( in string file, in boolean auto_groups, in MED_VERSION theVersion )
-       raises (SALOME::SALOME_Exception);
-     /*!
-      * Export Mesh to MED_LATEST MED format
-      * Works, just the same as ExportToMEDX with MED_VERSION parameter equal to MED_LATEST
-      * and overwrite parameter equal to true
-      * The method is kept in order to support old functionality
-      */
-     void ExportMED( in string file, in boolean auto_groups )
-       raises (SALOME::SALOME_Exception);
      /*!
       * Export Mesh to SAUV formatted file
       * Write a temporary med file and use med2sauv
      void ExportSAUV( in string file, in boolean auto_groups )
        raises (SALOME::SALOME_Exception);
  
-     /*!
-      * Return string representation of a MED file version comprising nbDigits
-      */
-     string GetVersionString(in MED_VERSION version, in short nbDigits);
      /*!
       * Export Mesh to different Formats
       * (UNV supported version is I-DEAS 10)
      string_array GetLastParameters();
    };
  
-   interface SMESH_subMesh : SALOME::GenericObj, SMESH_IDSource
+   interface SMESH_subMesh : SMESH_IDSource
    {
      /*!
       *
index 6ddace44d857a6bbe7e66671fe5a9eb357039b86,ce7b79ae452489bb2979179ea678da907ef87d3f..af3e0f22dddc334c70f31029018724824cbef584
  INCLUDE_DIRECTORIES(
    ${HDF5_INCLUDE_DIRS}
    ${KERNEL_INCLUDE_DIRS}
 -  ${CAS_INCLUDE_DIRS}
 +  ${OpenCASCADE_INCLUDE_DIR}
    ${VTK_INCLUDE_DIRS}
    ${Boost_INCLUDE_DIRS}
-   ${PROJECT_SOURCE_DIR}/src/MEDWrapper/Base
-   ${PROJECT_SOURCE_DIR}/src/MEDWrapper/Factory
+   ${PROJECT_SOURCE_DIR}/src/MEDWrapper
    ${PROJECT_SOURCE_DIR}/src/Driver
    ${PROJECT_SOURCE_DIR}/src/SMDS
    ${PROJECT_SOURCE_DIR}/src/SMESHUtils
@@@ -36,7 -35,7 +35,7 @@@
  # additional preprocessor / compiler flags
  ADD_DEFINITIONS(
    ${HDF5_DEFINITIONS}
 -  ${CAS_DEFINITIONS}
 +  ${OpenCASCADE_DEFINITIONS}
    ${BOOST_DEFINITIONS}
  )
  
@@@ -45,8 -44,6 +44,6 @@@ SET(_link_LIBRARIE
    ${Boost_LIBRARIES}
    MeshDriver
    MEDWrapper
-   MEDWrapperBase
-   MEDWrapper_V2_2
  )
  
  SET(_link_LIBRARIES_bin
index a31488e4aabfe6b0287371869bf63df76c9dd874,b758617e988e1f4a67cf7e878daafffdbb94bdb6..1acc37831e2b1c69f63bbb2dbe0f811795e0003b
@@@ -383,11 -383,7 +383,7 @@@ DriverMED_Family::GetFamilyInfo(const M
    }
    string aValue = aStr.str();
    // PAL19785,0019867 - med forbids whitespace to be the last char in the name
-   int maxSize;
-   //if ( theWrapper->GetVersion() == MED::eV2_1 )
-   //  maxSize = MED::GetNOMLength<MED::eV2_1>();
-   //else
-     maxSize = MED::GetNOMLength<MED::eV2_2>();
+   int maxSize = MED::GetNOMLength();
    int lastCharPos = min( maxSize, (int) aValue.size() ) - 1;
    while ( isspace( aValue[ lastCharPos ] ))
      aValue.resize( lastCharPos-- );
@@@ -574,21 -570,3 +570,21 @@@ void DriverMED_Family::Split (DriverMED
      common->myType = myType;
    }
  }
 +
 +//================================================================================
 +/*!
 + * \brief Return a number of elements of a given type
 + */
 +//================================================================================
 +
 +size_t DriverMED_Family::NbElements( SMDSAbs_ElementType theType ) const
 +{
 +  if ( myTypes.size() < 2 )
 +    return myElements.size();
 +
 +  int nb = 0;
 +  for ( ElementsSet::iterator e = myElements.begin(); e != myElements.end(); ++e )
 +    nb += ( theType == (*e)->GetType() );
 +
 +  return nb;
 +}
index 14a648c8a1843b5dc6fe80d6d232ba3840e6842d,b8d73352b99bac97cfa98667350f9a222664f265..a1a5cfcc7106b8b358d78c1f272cd51747da9d31
@@@ -110,7 -110,7 +110,7 @@@ Driver_Mesh::Status DriverMED_R_SMESHDS
  #endif
      myFamilies.clear();
      if(MYDEBUG) MESSAGE("Perform - myFile : "<<myFile);
-     PWrapper aMed = CrWrapper(myFile,true);
+     PWrapper aMed = CrWrapperR(myFile);
  
      aResult = DRS_EMPTY;
      TInt aNbMeshes = aMed->GetNbMeshes();
              if ( anIsElemNum && !aBallInfo->myElemNum->empty() )
                maxID = *std::max_element( aBallInfo->myElemNum->begin(),
                                           aBallInfo->myElemNum->end() );
 -            myMesh->getGrid()->AllocateDiameters( maxID ); // performance optimization
 +            myMesh->GetGrid()->AllocateDiameters( maxID ); // performance optimization
  
              // create balls
              SMDS_MeshElement* anElement;
      aResult = addMessage( "Unknown exception", /*isFatal=*/true );
    }
  #endif
 -  if (myMesh)
 -    myMesh->compactMesh();
  
    // Mantis issue 0020483
    if (aResult == DRS_OK && isDescConn) {
@@@ -1056,7 -1058,7 +1056,7 @@@ list<string> DriverMED_R_SMESHDS_Mesh::
    try {
      if(MYDEBUG) MESSAGE("GetMeshNames - myFile : " << myFile);
      theStatus = DRS_OK;
-     PWrapper aMed = CrWrapper(myFile);
+     PWrapper aMed = CrWrapperR(myFile);
  
      if (TInt aNbMeshes = aMed->GetNbMeshes()) {
        for (int iMesh = 0; iMesh < aNbMeshes; iMesh++) {
@@@ -1135,14 -1137,6 +1135,14 @@@ void DriverMED_R_SMESHDS_Mesh::GetGroup
  
    if (( famVecPtr = myGroups2FamiliesMap.ChangeSeek( aGroupName )))
    {
 +    size_t groupSize = 0;
 +    for ( size_t i = 0; i < famVecPtr->size(); ++i )
 +    {
 +      DriverMED_FamilyPtr aFamily = (*famVecPtr)[i];
 +      groupSize += aFamily->NbElements( theGroup->GetType() );
 +    }
 +    theGroup->SMDSGroup().Reserve( groupSize );
 +
      for ( size_t i = 0; i < famVecPtr->size(); ++i )
      {
        DriverMED_FamilyPtr aFamily = (*famVecPtr)[i];
index 8317ae96b4cbe1ea23e76303f96db593a3035f7c,d0e89a2b9a1865cd8746f60b8d65c6bbac075a1a..bdd191a4deae7bd3ad03115e51bf38bcd89d21f9
@@@ -33,6 -33,7 +33,6 @@@
  #include "MED_Wrapper.hxx"
  #include "SMDS_IteratorOnIterators.hxx"
  #include "SMDS_MeshElement.hxx"
 -#include "SMDS_PolyhedralVolumeOfNodes.hxx"
  #include "SMDS_SetIterator.hxx"
  #include "SMESHDS_Mesh.hxx"
  
@@@ -100,7 -101,7 +100,7 @@@ bool DriverMED_W_Field::Set(SMESHDS_Mes
      for ( int iG = 0; iG < SMDSEntity_Last; ++iG )
      {
        SMDSAbs_EntityType  geom = (SMDSAbs_EntityType) iG;
 -      SMDSAbs_ElementType t = SMDS_MeshCell::toSmdsType( geom );
 +      SMDSAbs_ElementType    t = SMDS_MeshCell::ElemType( geom );
        if ( t != _elemType ) continue;
  
        nbElems = mesh->GetMeshInfo().NbElements( geom );
@@@ -253,7 -254,7 +253,7 @@@ Driver_Mesh::Status DriverMED_W_Field::
    if ( !myMesh )
      return addMessage("Supporting mesh not set", /*isFatal=*/true );
  
-   MED::PWrapper medFile = MED::CrWrapper( myFile, MED::eV2_2 );
+   MED::PWrapper medFile = MED::CrWrapperW( myFile );
    MED::PMeshInfo meshInfo;
    if ( myMeshId > 0 )
    {
index c33517ca0c009f8f13e9f290388df08dad7d73c3,55e80fbfd4cf52e54a3add0f87a80d873f0738d7..6ac446156c3ad6954eba9cfc716b069e57b54db8
@@@ -31,7 -31,9 +31,7 @@@
  #include "MED_Factory.hxx"
  #include "MED_Utilities.hxx"
  #include "SMDS_IteratorOnIterators.hxx"
 -#include "SMDS_MeshElement.hxx"
  #include "SMDS_MeshNode.hxx"
 -#include "SMDS_PolyhedralVolumeOfNodes.hxx"
  #include "SMDS_SetIterator.hxx"
  #include "SMESHDS_Mesh.hxx"
  
@@@ -50,7 -52,6 +50,6 @@@ using namespace MED
  
  
  DriverMED_W_SMESHDS_Mesh::DriverMED_W_SMESHDS_Mesh():
-   myMedVersion(MED::eV2_2),
    myAllSubMeshes (false),
    myDoGroupOfNodes (false),
    myDoGroupOfEdges (false),
    myDoAllInGroups(false)
  {}
  
- void DriverMED_W_SMESHDS_Mesh::SetFile(const std::string& theFileName, 
-                                        MED::EVersion      theId)
- {
-   Driver_SMESHDS_Mesh::SetFile(theFileName);
-   myMedVersion = theId;
-   //MESSAGE("myMedVersion:"<<myMedVersion);
- }
  void DriverMED_W_SMESHDS_Mesh::SetFile(const std::string& theFileName)
  {
    Driver_SMESHDS_Mesh::SetFile(theFileName);
  }
  
- /*!
-  * MED version is either the latest available, or with an inferior minor,
-  * to ensure backward compatibility on writing med files.
-  */
- string DriverMED_W_SMESHDS_Mesh::GetVersionString(const MED::EVersion theVersion, int theNbDigits)
- {
-   TInt majeur, mineur, release;
-   majeur =  mineur = release = 0;
-   MED::GetVersionRelease<eV2_2>(majeur, mineur, release);
-   TInt imposedMineur = mineur;
-   switch( theVersion ) {
-     case MED::eV2_1     :
-     case MED::eV2_2     :
-     case MED::eLATEST   : break;
-     case MED::eMINOR_0  : imposedMineur = 0; break;
-     case MED::eMINOR_1  : imposedMineur = 1; break;
-     case MED::eMINOR_2  : imposedMineur = 2; break;
-     case MED::eMINOR_3  : imposedMineur = 3; break;
-     case MED::eMINOR_4  : imposedMineur = 4; break;
-     case MED::eMINOR_5  : imposedMineur = 5; break;
-     case MED::eMINOR_6  : imposedMineur = 6; break;
-     case MED::eMINOR_7  : imposedMineur = 7; break;
-     case MED::eMINOR_8  : imposedMineur = 8; break;
-     case MED::eMINOR_9  : imposedMineur = 9; break;
-     case MED::eVUnknown : imposedMineur = mineur; break;
-   }
-   if (imposedMineur > mineur)
-     imposedMineur = mineur;
-   ostringstream name;
-   if ( theNbDigits > 0 )
-     name << majeur;
-   if ( theNbDigits > 1 )
-     name << "." << imposedMineur;
-   if ( theNbDigits > 2 )
-     name << "." << release;
-   return name.str();
- }
  void DriverMED_W_SMESHDS_Mesh::AddGroup(SMESHDS_GroupBase* theGroup)
  {
    myGroups.push_back(theGroup);
@@@ -358,6 -313,10 +311,6 @@@ namespac
  Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
  {
    Status aResult = DRS_OK;
 -  if (myMesh->hasConstructionEdges() || myMesh->hasConstructionFaces()) {
 -    INFOS("SMDS_MESH with hasConstructionEdges() or hasConstructionFaces() do not supports!!!");
 -    return DRS_FAIL;
 -  }
    try {
      //MESSAGE("Perform - myFile : "<<myFile);
  
            const SMDS_MeshNode* aNode = aNodesIter->next();
            aBounds[0] = min(aBounds[0],aNode->X());
            aBounds[1] = max(aBounds[1],aNode->X());
 -          
 +
            aBounds[2] = min(aBounds[2],aNode->Y());
            aBounds[3] = max(aBounds[3],aNode->Y());
  
          }
        }
  
 -      SMDS_NodeIteratorPtr aNodesIter = myMesh->nodesIterator(/*idInceasingOrder=*/true);
 +      SMDS_NodeIteratorPtr aNodesIter = myMesh->nodesIterator();
        switch ( aSpaceDimension ) {
        case 3:
          aCoordHelperPtr.reset(new TCoordHelper(aNodesIter,aXYZGetCoord,aXYZName));
          break;
        }
      }
-     //MESSAGE("myMedVersion:"<<myMedVersion);
-     MED::PWrapper myMed = CrWrapper(myFile,myMedVersion);
+     MED::PWrapper myMed = CrWrapperW(myFile);
      PMeshInfo aMeshInfo = myMed->CrMeshInfo(aMeshDimension,aSpaceDimension,aMeshName);
      //MESSAGE("Add - aMeshName : "<<aMeshName<<"; "<<aMeshInfo->GetName());
      myMed->SetMeshInfo(aMeshInfo);
  
        // Treat POLYEDREs
        // ----------------
 -      else if (aElemTypeData->_geomType == ePOLYEDRE )
 +      else if ( aElemTypeData->_geomType == ePOLYEDRE )
        {
          elemIterator = myMesh->elementGeomIterator( SMDSGeom_POLYHEDRA );
  
            // Count nb of nodes
            while ( elemIterator->more() ) {
              const SMDS_MeshElement*  anElem = elemIterator->next();
 -            const SMDS_VtkVolume *aPolyedre = dynamic_cast<const SMDS_VtkVolume*>(anElem);
 -            if ( !aPolyedre ) continue;
 -            nbPolyhedronNodes += aPolyedre->NbNodes();
 -            nbPolyhedronFaces += aPolyedre->NbFaces();
 +            nbPolyhedronNodes += anElem->NbNodes();
 +            nbPolyhedronFaces += anElem->NbFaces();
              if ( ++iElem == aElemTypeData->_nbElems )
                break;
            }
            TInt iFace = 0, iNode = 0;
            while ( elemIterator->more() )
            {
 -            const SMDS_MeshElement*  anElem = elemIterator->next();
 -            const SMDS_VtkVolume *aPolyedre = dynamic_cast<const SMDS_VtkVolume*>(anElem);
 +            const SMDS_MeshElement* anElem = elemIterator->next();
 +            const SMDS_MeshVolume *aPolyedre = myMesh->DownCast< SMDS_MeshVolume >( anElem );
              if ( !aPolyedre ) continue;
              // index
              TInt aNbFaces = aPolyedre->NbFaces();
index 9c24099b47116a9d0845a59c5cadd9b9b4dea5c4,fb45dc1b2fec150204943c4d2458ebf17960fbad..4b63d3cc6e9518eb7d5dec105c0147301a027c79
@@@ -40,7 -40,6 +40,7 @@@
  class SMESHDS_Mesh;
  class SMESHDS_GroupBase;
  class SMESHDS_SubMesh;
 +class SMDS_MeshElement;
  
  class MESHDRIVERMED_EXPORT DriverMED_W_SMESHDS_Mesh: public Driver_SMESHDS_Mesh
  {
  
    DriverMED_W_SMESHDS_Mesh();
  
-   virtual void SetFile(const std::string& theFileName);
-   void SetFile(const std::string& theFileName, MED::EVersion theId);
+   void SetFile(const std::string& theFileName);
    void SetAutoDimension(bool toFindOutDimension) { myAutoDimension = toFindOutDimension; }
  
-   static std::string GetVersionString(const MED::EVersion theVersion, int theNbDigits=2);
    void AddGroupOfNodes();
    void AddGroupOfEdges();
    void AddGroupOfFaces();
@@@ -78,7 -74,6 +75,6 @@@
  
   private:
  
-   MED::EVersion myMedVersion;
    std::list<SMESHDS_GroupBase*> myGroups;
    bool myAllSubMeshes;
    std::vector<SMESHDS_SubMesh*> mySubMeshes;
diff --combined src/SMESH/CMakeLists.txt
index 21f4ebf5e726966923a1dedb1b3fa7a55729eae3,e96f78f1ba598b8c2d62f05e4432deff4240a5bf..3e41c626a54e45ada33fe715206ec5b9fcb31061
  INCLUDE_DIRECTORIES(
    ${KERNEL_INCLUDE_DIRS}
    ${GEOM_INCLUDE_DIRS}
 -  ${CAS_INCLUDE_DIRS}
 +  ${OpenCASCADE_INCLUDE_DIR}
    ${VTK_INCLUDE_DIRS}
    ${Boost_INCLUDE_DIRS}
    ${HDF5_INCLUDE_DIRS}
 +  ${TBB_INCLUDE_DIRS}
    ${PROJECT_SOURCE_DIR}/src/Controls
-   ${PROJECT_SOURCE_DIR}/src/MEDWrapper/Base
+   ${PROJECT_SOURCE_DIR}/src/MEDWrapper
    ${PROJECT_SOURCE_DIR}/src/Driver
    ${PROJECT_SOURCE_DIR}/src/DriverDAT
    ${PROJECT_SOURCE_DIR}/src/DriverMED
@@@ -43,7 -42,7 +43,7 @@@
  
  # additional preprocessor / compiler flags
  ADD_DEFINITIONS(
 -  ${CAS_DEFINITIONS}
 +  ${OpenCASCADE_DEFINITIONS}
    ${BOOST_DEFINITIONS}
  )
  
@@@ -54,9 -53,10 +54,9 @@@ ENDIF(SALOME_SMESH_USE_CGNS
  
  # libraries to link to
  SET(_link_LIBRARIES
 -  ${CAS_TKShHealing}
 -  ${CAS_TKPrim}
 -  ${CAS_TKG2d}
 -  ${CAS_TKCDF}
 +  ${OpenCASCADE_ModelingAlgorithms_LIBRARIES}
 +  ${OpenCASCADE_ModelingData_LIBRARIES}
 +  ${OpenCASCADE_ApplicationFramework_LIBRARIES}
    ${GEOM_NMTTools}
    ${GEOM_GEOMUtils}
    ${Boost_LIBRARIES}
diff --combined src/SMESH/SMESH_Algo.cxx
index d0ee85cb8fe61a136f752405ef01baf5f721d9ee,febb8e0406d718825c8cdb1b2620bcc9c54c0c17..62f77de4a75ac8c4172f2db900c6ff92722346d4
@@@ -173,8 -173,8 +173,8 @@@ const SMESH_Algo::Features& SMESH_Algo:
   */
  //=============================================================================
  
- SMESH_Algo::SMESH_Algo (int hypId, int studyId, SMESH_Gen * gen)
-   : SMESH_Hypothesis(hypId, studyId, gen)
+ SMESH_Algo::SMESH_Algo (int hypId, SMESH_Gen * gen)
+   : SMESH_Hypothesis(hypId, gen)
  {
    _compatibleAllHypFilter = _compatibleNoAuxHypFilter = NULL;
    _onlyUnaryInput = _requireDiscreteBoundary = _requireShape = true;
@@@ -202,26 -202,26 +202,26 @@@ SMESH_Algo::~SMESH_Algo(
   */
  //=============================================================================
  
- SMESH_0D_Algo::SMESH_0D_Algo(int hypId, int studyId, SMESH_Gen* gen)
-   : SMESH_Algo(hypId, studyId, gen)
+ SMESH_0D_Algo::SMESH_0D_Algo(int hypId, SMESH_Gen* gen)
+   : SMESH_Algo(hypId, gen)
  {
    _shapeType = (1 << TopAbs_VERTEX);
    _type = ALGO_0D;
  }
- SMESH_1D_Algo::SMESH_1D_Algo(int hypId, int studyId, SMESH_Gen* gen)
-   : SMESH_Algo(hypId, studyId, gen)
+ SMESH_1D_Algo::SMESH_1D_Algo(int hypId, SMESH_Gen* gen)
+   : SMESH_Algo(hypId, gen)
  {
    _shapeType = (1 << TopAbs_EDGE);
    _type = ALGO_1D;
  }
- SMESH_2D_Algo::SMESH_2D_Algo(int hypId, int studyId, SMESH_Gen* gen)
-   : SMESH_Algo(hypId, studyId, gen)
+ SMESH_2D_Algo::SMESH_2D_Algo(int hypId, SMESH_Gen* gen)
+   : SMESH_Algo(hypId, gen)
  {
    _shapeType = (1 << TopAbs_FACE);
    _type = ALGO_2D;
  }
- SMESH_3D_Algo::SMESH_3D_Algo(int hypId, int studyId, SMESH_Gen* gen)
-   : SMESH_Algo(hypId, studyId, gen)
+ SMESH_3D_Algo::SMESH_3D_Algo(int hypId, SMESH_Gen* gen)
+   : SMESH_Algo(hypId, gen)
  {
    _shapeType = (1 << TopAbs_SOLID);
    _type = ALGO_3D;
@@@ -358,9 -358,12 +358,9 @@@ bool SMESH_Algo::GetNodeParamOnEdge(con
      SMDS_NodeIteratorPtr nIt = eSubMesh->GetNodes();
      while ( nIt->more() )
      {
 -      const SMDS_MeshNode* node = nIt->next();
 -      const SMDS_PositionPtr& pos = node->GetPosition();
 -      if ( pos->GetTypeOfPosition() != SMDS_TOP_EDGE )
 +      SMDS_EdgePositionPtr epos = nIt->next()->GetPosition();
 +      if ( !epos )
          return false;
 -      const SMDS_EdgePosition* epos =
 -        static_cast<const SMDS_EdgePosition*>(node->GetPosition());
        if ( !paramSet.insert( epos->GetUParameter() ).second )
          return false; // equal parameters
      }
@@@ -421,9 -424,11 +421,9 @@@ bool SMESH_Algo::GetSortedNodesOnEdge(c
        const SMDS_MeshNode* node = nIt->next();
        if ( ignoreMediumNodes && SMESH_MesherHelper::IsMedium( node, typeToCheck ))
          continue;
 -      const SMDS_PositionPtr& pos = node->GetPosition();
 -      if ( pos->GetTypeOfPosition() != SMDS_TOP_EDGE )
 +      SMDS_EdgePositionPtr epos = node->GetPosition();
 +      if ( ! epos )
          return false;
 -      const SMDS_EdgePosition* epos =
 -        static_cast<const SMDS_EdgePosition*>(node->GetPosition());
        theNodes.insert( theNodes.end(), make_pair( epos->GetUParameter(), node ));
        ++nbNodes;
      }
@@@ -909,12 -914,7 +909,12 @@@ bool SMESH_Algo::error(SMESH_ComputeErr
    if ( error ) {
      _error   = error->myName;
      _comment = error->myComment;
 -    _badInputElements = error->myBadElements;
 +    if ( error->HasBadElems() )
 +    {
 +      SMESH_BadInputElements* badElems = static_cast<SMESH_BadInputElements*>( error.get() );
 +      _badInputElements = badElems->GetElements();
 +      _mesh             = badElems->GetMesh();
 +    }
      return error->IsOK();
    }
    return true;
  
  SMESH_ComputeErrorPtr SMESH_Algo::GetComputeError() const
  {
 -  SMESH_ComputeErrorPtr err = SMESH_ComputeError::New( _error, _comment, this );
 -  // hope this method is called by only SMESH_subMesh after this->Compute()
 -  err->myBadElements.splice( err->myBadElements.end(),
 -                             (list<const SMDS_MeshElement*>&) _badInputElements );
 -  return err;
 +  if ( !_badInputElements.empty() && _mesh )
 +  {
 +    SMESH_BadInputElements* err = new SMESH_BadInputElements( _mesh, _error, _comment, this );
 +    // hope this method is called by only SMESH_subMesh after this->Compute()
 +    err->myBadElements.splice( err->myBadElements.end(),
 +                               (list<const SMDS_MeshElement*>&) _badInputElements );
 +    return SMESH_ComputeErrorPtr( err );
 +  }
 +  return SMESH_ComputeError::New( _error, _comment, this );
  }
  
  //================================================================================
@@@ -954,7 -950,6 +954,7 @@@ void SMESH_Algo::InitComputeError(
      if ( (*elem)->GetID() < 1 )
        delete *elem;
    _badInputElements.clear();
 +  _mesh = 0;
  
    _computeCanceled = false;
    _progressTic     = 0;
@@@ -1248,7 -1243,7 +1248,7 @@@ bool SMESH_2D_Algo::FixInternalNodes(co
        gp_Pnt p = S->Value( uv.Coord(1), uv.Coord(2));
        const SMDS_MeshNode* n = nodeRows[iRow][iCol];
        meshDS->MoveNode( n, p.X(), p.Y(), p.Z() );
 -      if ( SMDS_FacePosition* pos = dynamic_cast< SMDS_FacePosition*>( n->GetPosition() ))
 +      if ( SMDS_FacePositionPtr pos = n->GetPosition() )
          pos->SetParameters( uv.Coord(1), uv.Coord(2) );
      }
    }
diff --combined src/SMESH/SMESH_Algo.hxx
index cceb370ef09e4d21a407ca9b1b00da7fc0a4d92c,03154a989fcee01691d6d04984c20881bcefef37..c0075a88e310f18c9ddaeb4fddbf3d66ed21e60e
@@@ -102,10 -102,9 +102,9 @@@ class SMESH_EXPORT SMESH_Algo : public 
    /*!
     * \brief Creates algorithm
      * \param hypId - algorithm ID
-     * \param studyId - study ID
      * \param gen - SMESH_Gen
     */
-   SMESH_Algo(int hypId, int studyId, SMESH_Gen * gen);
+   SMESH_Algo(int hypId, SMESH_Gen * gen);
  
    /*!
     * \brief Destructor
@@@ -462,7 -461,6 +461,7 @@@ protected
    int         _error;    //!< SMESH_ComputeErrorName or anything algo specific
    std::string _comment;  //!< any text explaining what is wrong in Compute()
    std::list<const SMDS_MeshElement*> _badInputElements; //!< to explain COMPERR_BAD_INPUT_MESH
 +  const SMDS_Mesh* _mesh; //!< mesh being computed, needed to create SMESH_BadInputElements
  
    volatile bool _computeCanceled; //!< is set to True while computing to stop it
  
  class SMESH_EXPORT SMESH_0D_Algo: public SMESH_Algo
  {
  public:
-   SMESH_0D_Algo(int hypId, int studyId,  SMESH_Gen* gen);
+   SMESH_0D_Algo(int hypId, SMESH_Gen* gen);
  };
  
  class SMESH_EXPORT SMESH_1D_Algo: public SMESH_Algo
  {
  public:
-   SMESH_1D_Algo(int hypId, int studyId,  SMESH_Gen* gen);
+   SMESH_1D_Algo(int hypId, SMESH_Gen* gen);
  };
  
  class SMESH_EXPORT SMESH_2D_Algo: public SMESH_Algo
  {
  public:
-   SMESH_2D_Algo(int hypId, int studyId, SMESH_Gen* gen);
+   SMESH_2D_Algo(int hypId, SMESH_Gen* gen);
    /*!
     * \brief Method in which an algorithm generating a structured mesh
     *        fixes positions of in-face nodes after there movement
  class SMESH_EXPORT SMESH_3D_Algo: public SMESH_Algo
  {
  public:
-   SMESH_3D_Algo(int hypId, int studyId, SMESH_Gen* gen);
+   SMESH_3D_Algo(int hypId, SMESH_Gen* gen);
  };
  
  #endif
diff --combined src/SMESH/SMESH_Gen.cxx
index f87162e45de947a63c8c93497a4f68bead3d03e5,36e454366a4165396b8da07ba93724a5e0eb7ee6..71365d197c7130c754c794dd116d5c9f1f616570
@@@ -54,6 -54,9 +54,6 @@@
  
  using namespace std;
  
 -//#include <vtkDebugLeaks.h>
 -
 -
  //=============================================================================
  /*!
   *  Constructor
  
  SMESH_Gen::SMESH_Gen()
  {
+   _studyContext = new StudyContextStruct;
+   _studyContext->myDocument = new SMESHDS_Document();
    _localId = 0;
    _hypId   = 0;
    _segmentation = _nbSegments = 10;
 -  SMDS_Mesh::_meshList.clear();
    _compute_canceled = false;
 -  //vtkDebugLeaks::SetExitError(0);
  }
  
  namespace
  
  SMESH_Gen::~SMESH_Gen()
  {
-   std::map < int, StudyContextStruct * >::iterator i_sc = _mapStudyContext.begin();
-   for ( ; i_sc != _mapStudyContext.end(); ++i_sc )
-   {
-     StudyContextStruct* context = i_sc->second;
-     std::map < int, SMESH_Hypothesis * >::iterator i_hyp = context->mapHypothesis.begin();
-     for ( ; i_hyp != context->mapHypothesis.end(); ++i_hyp )
+     std::map < int, SMESH_Hypothesis * >::iterator i_hyp = _studyContext->mapHypothesis.begin();
+     for ( ; i_hyp != _studyContext->mapHypothesis.end(); ++i_hyp )
      {
        if ( _Hyp* h = static_cast< _Hyp*>( i_hyp->second ))
          h->NullifyGen();
      }
-     delete context->myDocument;
-     delete context;
-   }
+   delete _studyContext->myDocument;
+   delete _studyContext;
  }
  
  //=============================================================================
   */
  //=============================================================================
  
- SMESH_Mesh* SMESH_Gen::CreateMesh(int theStudyId, bool theIsEmbeddedMode)
+ SMESH_Mesh* SMESH_Gen::CreateMesh(bool theIsEmbeddedMode)
    throw(SALOME_Exception)
  {
    Unexpect aCatch(SalomeException);
  
-   // Get studyContext, create it if it doesn't exist, with a SMESHDS_Document
-   StudyContextStruct *aStudyContext = GetStudyContext(theStudyId);
    // create a new SMESH_mesh object
    SMESH_Mesh *aMesh = new SMESH_Mesh(_localId++,
-                                      theStudyId,
                                       this,
                                       theIsEmbeddedMode,
-                                      aStudyContext->myDocument);
-   aStudyContext->mapMesh[_localId-1] = aMesh;
+                                      _studyContext->myDocument);
+   _studyContext->mapMesh[_localId-1] = aMesh;
  
    return aMesh;
  }
@@@ -402,10 -400,8 +395,10 @@@ bool SMESH_Gen::Compute(SMESH_Mesh 
    }
  
    if ( aCompactMesh )
 -    aMesh.GetMeshDS()->compactMesh();
 -
 +  {
 +    aMesh.GetMeshDS()->Modified();
 +    aMesh.GetMeshDS()->CompactMesh();
 +  }
    return ret;
  }
  
@@@ -672,7 -668,7 +665,7 @@@ static bool checkConformIgnoredAlgos(SM
            checkConform = false; // no more check conformity
            INFOS( "ERROR: Local <" << algo->GetName() <<
                  "> would produce not conform mesh: "
 -                "<Not Conform Mesh Allowed> hypotesis is missing");
 +                "<Not Conform Mesh Allowed> hypothesis is missing");
            theErrors.push_back( SMESH_Gen::TAlgoStateError() );
            theErrors.back().Set( SMESH_Hypothesis::HYP_NOTCONFORM, algo, false );
          }
@@@ -1146,17 -1142,9 +1139,9 @@@ SMESH_Algo *SMESH_Gen::GetAlgo(SMESH_su
   */
  //=============================================================================
  
- StudyContextStruct *SMESH_Gen::GetStudyContext(int studyId)
+ StudyContextStruct *SMESH_Gen::GetStudyContext()
  {
-   // Get studyContext, create it if it doesn't exist, with a SMESHDS_Document
-   if (_mapStudyContext.find(studyId) == _mapStudyContext.end())
-   {
-     _mapStudyContext[studyId] = new StudyContextStruct;
-     _mapStudyContext[studyId]->myDocument = new SMESHDS_Document(studyId);
-   }
-   StudyContextStruct *myStudyContext = _mapStudyContext[studyId];
-   return myStudyContext;
+   return _studyContext;
  }
  
  //================================================================================
index 539543e45deec1370a5dbc9d03d82fb29cfcf09f,9aef12133684fe6e27e10459cb5b33711c8a10c8..9bf01b9c66527ad4b2fbca483f8f042a650d15d1
@@@ -51,7 -51,7 +51,7 @@@ public
    {
      HYP_OK = 0,
      HYP_MISSING,      // algo misses a hypothesis
 -    HYP_CONCURENT,    // several applicable hypotheses assigned to father shapes
 +    HYP_CONCURRENT,   // several applicable hypotheses assigned to father shapes
      HYP_BAD_PARAMETER,// hypothesis has a bad parameter value
      HYP_HIDDEN_ALGO,  // an algo is hidden by an upper dim algo generating all-dim elements
      HYP_HIDING_ALGO,  // an algo hides lower dim algos by generating all-dim elements
    static bool IsStatusFatal(Hypothesis_Status theStatus)
    { return theStatus >= HYP_UNKNOWN_FATAL; }
  
-   SMESH_Hypothesis(int hypId, int studyId, SMESH_Gen* gen);
+   SMESH_Hypothesis(int hypId, SMESH_Gen* gen);
    virtual ~SMESH_Hypothesis();
    virtual int GetDim() const;
-   int         GetStudyId() const;
    SMESH_Gen*  GetGen() const { return (SMESH_Gen*) _gen; }
    virtual int GetShapeType() const;
    virtual const char* GetLibName() const;
  
  protected:
    SMESH_Gen* _gen;
-   int        _studyId;
    int        _shapeType;
    int        _param_algo_dim; // to be set at descendant hypothesis constructor
  
diff --combined src/SMESH/SMESH_Mesh.cxx
index 1dcdd53595ecb66ff5fa662adf984135cb596b6b,9c9491da224806d2dfe5d3e9edd3d4e63f47098f..b9b510451fd360af423f2185336421aa3c2ba9bb
@@@ -106,7 -106,6 +106,6 @@@ class SMESH_Mesh::SubMeshHolder : publi
  //=============================================================================
  
  SMESH_Mesh::SMESH_Mesh(int               theLocalId, 
-                        int               theStudyId, 
                         SMESH_Gen*        theGen,
                         bool              theIsEmbeddedMode,
                         SMESHDS_Document* theDocument):
  {
    if(MYDEBUG) MESSAGE("SMESH_Mesh::SMESH_Mesh(int localId)");
    _id            = theLocalId;
-   _studyId       = theStudyId;
    _gen           = theGen;
    _myDocument    = theDocument;
    _myMeshDS      = theDocument->NewMesh(theIsEmbeddedMode,theLocalId);
  
  SMESH_Mesh::SMESH_Mesh():
    _id(-1),
-   _studyId(-1),
    _groupId( 0 ),
    _nbSubShapes( 0 ),
    _isShapeToMesh( false ),
@@@ -208,7 -205,7 +205,7 @@@ SMESH_Mesh::~SMESH_Mesh(
    // remove self from studyContext
    if ( _gen )
    {
-     StudyContextStruct * studyContext = _gen->GetStudyContext( _studyId );
+     StudyContextStruct * studyContext = _gen->GetStudyContext();
      studyContext->mapMesh.erase( _id );
    }
    if ( _myDocument )
@@@ -248,7 -245,7 +245,7 @@@ SMESH_Mesh* SMESH_Mesh::FindMesh( int m
    if ( _id == meshId )
      return (SMESH_Mesh*) this;
  
-   if ( StudyContextStruct *aStudyContext = _gen->GetStudyContext( _studyId ))
+   if ( StudyContextStruct *aStudyContext = _gen->GetStudyContext())
    {
      std::map < int, SMESH_Mesh * >::iterator i_m = aStudyContext->mapMesh.find( meshId );
      if ( i_m != aStudyContext->mapMesh.end() )
@@@ -450,7 -447,7 +447,7 @@@ void SMESH_Mesh::Clear(
  
  void SMESH_Mesh::ClearSubMesh(const int theShapeId)
  {
 -  // clear sub-meshes; get ready to re-compute as a side-effect 
 +  // clear sub-meshes; get ready to re-compute as a side-effect
    if ( SMESH_subMesh *sm = GetSubMeshContaining( theShapeId ) )
    {
      SMESH_subMeshIteratorPtr smIt = sm->getDependsOnIterator(/*includeSelf=*/true,
      while ( smIt->more() )
      {
        sm = smIt->next();
 -      TopAbs_ShapeEnum shapeType = sm->GetSubShape().ShapeType();      
 +      TopAbs_ShapeEnum shapeType = sm->GetSubShape().ShapeType();
        if ( shapeType == TopAbs_VERTEX || shapeType < TopAbs_SOLID )
          // all other shapes depends on vertices so they are already cleaned
          sm->ComputeStateEngine( SMESH_subMesh::CLEAN );
  
  //=======================================================================
  //function : UNVToMesh
 -//purpose  : 
 +//purpose  :
  //=======================================================================
  
  int SMESH_Mesh::UNVToMesh(const char* theFileName)
    myReader.SetMeshId(-1);
    myReader.Perform();
  
 -  if ( SMDS_MeshGroup* aGroup = (SMDS_MeshGroup*) myReader.GetGroup() )
 +  TGroupNamesMap& aGroupNames = myReader.GetGroupNamesMap();
 +  TGroupNamesMap::iterator gr2names;
 +  int anId = 1 + ( _mapGroup.empty() ? 0 : _mapGroup.rbegin()->first );
 +  for ( gr2names = aGroupNames.begin(); gr2names != aGroupNames.end(); ++gr2names )
    {
 -    TGroupNamesMap aGroupNames = myReader.GetGroupNamesMap();
 -    aGroup->InitSubGroupsIterator();
 -    while (aGroup->MoreSubGroups())
 -    {
 -      SMDS_MeshGroup* aSubGroup = (SMDS_MeshGroup*) aGroup->NextSubGroup();
 -      string aName = aGroupNames[aSubGroup];
 -      int aId;
 -      if ( SMESH_Group* aSMESHGroup = AddGroup( aSubGroup->GetType(), aName.c_str(), aId ))
 -      {
 -        SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>( aSMESHGroup->GetGroupDS() );
 -        if ( aGroupDS ) {
 -          aGroupDS->SetStoreName(aName.c_str());
 -          aSubGroup->InitIterator();
 -          const SMDS_MeshElement* aElement = 0;
 -          while ( aSubGroup->More() )
 -            if (( aElement = aSubGroup->Next() ))
 -              aGroupDS->SMDSGroup().Add( aElement );
 -
 -          if (aElement)
 -            aGroupDS->SetType( aElement->GetType() );
 -        }
 -      }
 -    }
 +    SMDS_MeshGroup*   aGroup = gr2names->first;
 +    const std::string& aName = gr2names->second;
 +    SMESHDS_Group* aGroupDS = new SMESHDS_Group( anId++, _myMeshDS, aGroup->GetType() );
 +    aGroupDS->SMDSGroup() = std::move( *aGroup );
 +    aGroupDS->SetStoreName( aName.c_str() );
 +    AddGroup( aGroupDS );
    }
 +
    return 1;
  }
  
@@@ -538,16 -548,12 +535,16 @@@ int SMESH_Mesh::MEDToMesh(const char* t
        }
      }
    }
 +
 +  _myMeshDS->Modified();
 +  _myMeshDS->CompactMesh();
 +
    return (int) status;
  }
  
  //=======================================================================
  //function : STLToMesh
 -//purpose  : 
 +//purpose  :
  //=======================================================================
  
  std::string SMESH_Mesh::STLToMesh(const char* theFileName)
@@@ -652,7 -658,7 +649,7 @@@ SMESH_Mesh::AddHypothesis(const TopoDS_
      string hypName = anHyp->GetName();
      if ( hypName == "NotConformAllowed" )
      {
 -      if(MYDEBUG) MESSAGE( "Hypotesis <NotConformAllowed> can be only global" );
 +      if(MYDEBUG) MESSAGE( "Hypothesis <NotConformAllowed> can be only global" );
        return SMESH_Hypothesis::HYP_INCOMPATIBLE;
      }
    }
      }
  
      // check concurrent hypotheses on ancestors
 -    if (ret < SMESH_Hypothesis::HYP_CONCURENT && !isGlobalHyp )
 +    if (ret < SMESH_Hypothesis::HYP_CONCURRENT && !isGlobalHyp )
      {
        SMESH_subMeshIteratorPtr smIt = subMesh->getDependsOnIterator(false,false);
        while ( smIt->more() ) {
          SMESH_subMesh* sm = smIt->next();
 -        if ( sm->IsApplicableHypotesis( anHyp )) {
 -          ret2 = sm->CheckConcurentHypothesis( anHyp->GetType() );
 +        if ( sm->IsApplicableHypothesis( anHyp )) {
 +          ret2 = sm->CheckConcurrentHypothesis( anHyp->GetType() );
            if (ret2 > ret) {
              ret = ret2;
              break;
@@@ -725,7 -731,7 +722,7 @@@ SMESH_Mesh::RemoveHypothesis(const Topo
    Unexpect aCatch(SalomeException);
    if(MYDEBUG) MESSAGE("SMESH_Mesh::RemoveHypothesis");
  
-   StudyContextStruct *sc = _gen->GetStudyContext(_studyId);
+   StudyContextStruct *sc = _gen->GetStudyContext();
    if (sc->mapHypothesis.find(anHypId) == sc->mapHypothesis.end())
      throw SALOME_Exception(LOCALIZED("hypothesis does not exist"));
  
    SMESH_Hypothesis::Hypothesis_Status ret = subMesh->AlgoStateEngine(event, anHyp);
  
    // there may appear concurrent hyps that were covered by the removed hyp
 -  if (ret < SMESH_Hypothesis::HYP_CONCURENT &&
 -      subMesh->IsApplicableHypotesis( anHyp ) &&
 -      subMesh->CheckConcurentHypothesis( anHyp->GetType() ) != SMESH_Hypothesis::HYP_OK)
 -    ret = SMESH_Hypothesis::HYP_CONCURENT;
 +  if (ret < SMESH_Hypothesis::HYP_CONCURRENT &&
 +      subMesh->IsApplicableHypothesis( anHyp ) &&
 +      subMesh->CheckConcurrentHypothesis( anHyp->GetType() ) != SMESH_Hypothesis::HYP_OK)
 +    ret = SMESH_Hypothesis::HYP_CONCURRENT;
  
    // sub-shapes
    if (!SMESH_Hypothesis::IsStatusFatal(ret) &&
        ret = ret2;
  
      // check concurrent hypotheses on ancestors
 -    if (ret < SMESH_Hypothesis::HYP_CONCURENT && !IsMainShape( aSubShape ) )
 +    if (ret < SMESH_Hypothesis::HYP_CONCURRENT && !IsMainShape( aSubShape ) )
      {
        SMESH_subMeshIteratorPtr smIt = subMesh->getDependsOnIterator(false,false);
        while ( smIt->more() ) {
          SMESH_subMesh* sm = smIt->next();
 -        if ( sm->IsApplicableHypotesis( anHyp )) {
 -          ret2 = sm->CheckConcurentHypothesis( anHyp->GetType() );
 +        if ( sm->IsApplicableHypothesis( anHyp )) {
 +          ret2 = sm->CheckConcurrentHypothesis( anHyp->GetType() );
            if (ret2 > ret) {
              ret = ret2;
              break;
@@@ -986,7 -992,7 +983,7 @@@ int SMESH_Mesh::GetHypotheses(const SME
  
  SMESH_Hypothesis * SMESH_Mesh::GetHypothesis(const int anHypId) const
  {
-   StudyContextStruct *sc = _gen->GetStudyContext(_studyId);
+   StudyContextStruct *sc = _gen->GetStudyContext();
    if (sc->mapHypothesis.find(anHypId) == sc->mapHypothesis.end())
      return NULL;
  
@@@ -1160,7 -1166,7 +1157,7 @@@ bool SMESH_Mesh::IsUsedHypothesis(SMESH
    SMESH_Hypothesis* hyp = static_cast<SMESH_Hypothesis*>(anHyp);
  
    // check if anHyp can be used to mesh aSubMesh
 -  if ( !aSubMesh || !aSubMesh->IsApplicableHypotesis( hyp ))
 +  if ( !aSubMesh || !aSubMesh->IsApplicableHypothesis( hyp ))
      return false;
  
    SMESH_Algo *algo = aSubMesh->GetAlgo();
@@@ -1223,7 -1229,7 +1220,7 @@@ void SMESH_Mesh::NotifySubMeshesHypothe
      {
        const TopoDS_Shape & aSubShape = aSubMesh->GetSubShape();
  
 -      if (( aSubMesh->IsApplicableHypotesis( hyp )) &&
 +      if (( aSubMesh->IsApplicableHypothesis( hyp )) &&
            ( algo = aSubMesh->GetAlgo() )            &&
            ( compatibleHypoKind = algo->GetCompatibleHypoFilter( !hyp->IsAuxiliary() )) &&
            ( compatibleHypoKind->IsOk( hyp, aSubShape )))
@@@ -1370,7 -1376,6 +1367,6 @@@ bool SMESH_Mesh::HasDuplicatedGroupName
   *  \param [in] theAutoGroups - boolean parameter for creating/not creating
   *              the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
   *              the typical use is auto_groups=false.
-  *  \param [in] theVersion - defines the version of format of MED file, that will be created
   *  \param [in] meshPart - mesh data to export
   *  \param [in] theAutoDimension - if \c true, a space dimension of a MED mesh can be either
       *         - 1D if all mesh nodes lie on OX coordinate axis, or
  void SMESH_Mesh::ExportMED(const char *        file, 
                             const char*         theMeshName, 
                             bool                theAutoGroups,
-                            int                 theVersion,
                             const SMESHDS_Mesh* meshPart,
                             bool                theAutoDimension,
                             bool                theAddODOnVertices,
    SMESH_TRY;
  
    DriverMED_W_SMESHDS_Mesh myWriter;
-   myWriter.SetFile         ( file, MED::EVersion(theVersion) );
+   myWriter.SetFile         ( file );
    myWriter.SetMesh         ( meshPart ? (SMESHDS_Mesh*) meshPart : _myMeshDS   );
    myWriter.SetAutoDimension( theAutoDimension );
    myWriter.AddODOnVertices ( theAddODOnVertices );
@@@ -1467,19 -1471,19 +1462,19 @@@ void SMESH_Mesh::ExportSAUV(const char 
  #ifdef WIN32
    cmd = "%PYTHONBIN% ";
  #else
-   cmd = "python ";
+   cmd = "python3 ";
  #endif
    cmd += "-c \"";
    cmd += "from medutilities import my_remove ; my_remove(r'" + medfilename + "')";
    cmd += "\"";
    system(cmd.c_str());
-   ExportMED(medfilename.c_str(), theMeshName, theAutoGroups, /*theVersion=*/1,
+   ExportMED(medfilename.c_str(), theMeshName, theAutoGroups,
              /*meshPart=*/NULL, /*theAutoDimension=*/false, /*theAddODOnVertices=*/false,
              /*theAllElemsToGroup=*/true ); // theAllElemsToGroup is for PAL0023413
  #ifdef WIN32
    cmd = "%PYTHONBIN% ";
  #else
-   cmd = "python ";
+   cmd = "python3 ";
  #endif
    cmd += "-c \"";
    cmd += "from medutilities import convert ; convert(r'" + medfilename + "', 'MED', 'GIBI', 1, r'" + file + "')";
  #ifdef WIN32
    cmd = "%PYTHONBIN% ";
  #else
-   cmd = "python ";
+   cmd = "python3 ";
  #endif
    cmd += "-c \"";
    cmd += "from medutilities import my_remove ; my_remove(r'" + medfilename + "')";
index e8c582ffe5833712cdc966ef41b580e05823ccd8,6dcea0662cb37fadfacc1dea2a646a99bc70324c..d31762a53350eeac0a7da7a385d4bbd40cc0e16c
@@@ -25,7 -25,7 +25,7 @@@ INCLUDE_DIRECTORIES
    ${GEOM_INCLUDE_DIRS}
    ${Boost_INCLUDE_DIRS}
    ${VTK_INCLUDE_DIRS}
 -  ${CAS_INCLUDE_DIRS}
 +  ${OpenCASCADE_INCLUDE_DIR}
    ${OMNIORB_INCLUDE_DIR}
    ${PROJECT_SOURCE_DIR}/src/Controls
    ${PROJECT_SOURCE_DIR}/src/Driver
@@@ -43,7 -43,7 +43,7 @@@
  # additional preprocessor / compiler flags
  ADD_DEFINITIONS(
    ${OMNIORB_DEFINITIONS}
 -  ${CAS_DEFINITIONS}
 +  ${OpenCASCADE_DEFINITIONS}
    ${BOOST_DEFINITIONS}
  )
  
@@@ -64,15 -64,13 +64,13 @@@ SET(_link_LIBRARIE
    ${KERNEL_SALOMELocalTrace}
    ${GEOM_NMTDS}
    ${GEOM_SalomeIDLGEOM}  
 -  ${CAS_KERNEL}
 +  ${OpenCASCADE_KERNEL}
    SalomeIDLSMESH
    SMDS
    SMESHimpl
    SMESHDS
    SMESHControls
    MEDWrapper
-   MEDWrapperBase
-   MEDWrapper_V2_2
  )
  
  # --- headers ---
index 92e170356fd810cbeac69db7f3ff6a59477e8fc1,a06cac1571ce8964d8841ed66d46cacb0182cd00..258033585a049cc6c69990c3755613dd0da04486
@@@ -25,7 -25,7 +25,7 @@@ INCLUDE_DIRECTORIES
    ${QT_INCLUDES}
    ${VTK_INCLUDE_DIRS}
    ${OGL_INCLUDE_DIRS}
 -  ${CAS_INCLUDE_DIRS}
 +  ${OpenCASCADE_INCLUDE_DIR}
    ${PYTHON_INCLUDE_DIRS}
    ${KERNEL_INCLUDE_DIRS}
    ${GUI_INCLUDE_DIRS}
    ${PROJECT_SOURCE_DIR}/src/SMESHUtils
    ${PROJECT_SOURCE_DIR}/src/Controls
    ${PROJECT_SOURCE_DIR}/src/SMESHClient
-   ${PROJECT_SOURCE_DIR}/src/MEDWrapper/Base
+   ${PROJECT_SOURCE_DIR}/src/MEDWrapper
    ${PROJECT_BINARY_DIR}
    ${PROJECT_BINARY_DIR}/idl
  )
  
  # additional preprocessor / compiler flags
  ADD_DEFINITIONS(
 -  ${CAS_DEFINITIONS}
 +  ${OpenCASCADE_DEFINITIONS}
    ${BOOST_DEFINITIONS}
    ${OMNIORB_DEFINITIONS}
  )
@@@ -61,7 -61,7 +61,7 @@@ ENDIF(WIN32
  
  # libraries to link to
  SET(_link_LIBRARIES
 -  ${CAS_TKV3d}
 +  ${OpenCASCADE_Visualization_LIBRARIES}
    ${GUI_SalomePrs}
    ${GUI_suit}
    ${GUI_SUITApp}
@@@ -111,7 -111,6 +111,7 @@@ SET(_moc_HEADER
    SMESHGUI_RotationDlg.h
    SMESHGUI_TranslationDlg.h
    SMESHGUI_ScaleDlg.h
 +  SMESHGUI_OffsetDlg.h
    SMESHGUI_SymmetryDlg.h
    SMESHGUI_SewingDlg.h
    SMESHGUI_DuplicateNodesDlg.h
    SMESHGUI_FieldSelectorWdg.h
    SMESHGUI_DisplayEntitiesDlg.h
    SMESHGUI_SplitBiQuad.h
--  SMESHGUI_PreVisualObj.h
    SMESHGUI_IdPreview.h
  )
  
@@@ -207,7 -206,6 +206,7 @@@ SET(_other_SOURCE
    SMESHGUI_RotationDlg.cxx
    SMESHGUI_TranslationDlg.cxx
    SMESHGUI_ScaleDlg.cxx
 +  SMESHGUI_OffsetDlg.cxx
    SMESHGUI_SymmetryDlg.cxx
    SMESHGUI_SewingDlg.cxx
    SMESHGUI_DuplicateNodesDlg.cxx
index d3d701490518fa8c5dd5154da41c5ab8d86c198a,2e698c6ded5431d7b3d2393f6b807129692e2667..73dee46ef1a8b731d07bcc703899e65ae025f3ec
@@@ -74,7 -74,6 +74,7 @@@
  #include "SMESHGUI_RevolutionDlg.h"
  #include "SMESHGUI_RotationDlg.h"
  #include "SMESHGUI_ScaleDlg.h"
 +#include "SMESHGUI_OffsetDlg.h"
  #include "SMESHGUI_Selection.h"
  #include "SMESHGUI_SewingDlg.h"
  #include "SMESHGUI_SingleEditDlg.h"
@@@ -196,7 -195,7 +196,7 @@@ namespac
  
    void ExportMeshToFile(int theCommandID);
  
-   void SetDisplayMode(int theCommandID, SMESHGUI_StudyId2MarkerMap& theMarkerMap);
+   void SetDisplayMode(int theCommandID, VTK::MarkerMap& theMarkerMap);
  
    void SetDisplayEntity(int theCommandID);
  
      }
      else if ( theCommandID == SMESHOp::OpImportSAUV ||
                theCommandID == SMESHOp::OpPopupImportSAUV ) {
-       filter.append( QObject::tr( "SAUV files (*.sauv*)" ) );
-       filter.append( QObject::tr( "All files (*)" ) );
+       filter.append( QObject::tr( "SAUV_FILES_FILTER" ) + " (*.sauv *.sauve)" );
+       filter.append( QObject::tr( "ALL_FILES_FILTER" ) + " (*)" );
      }
      else if ( theCommandID == SMESHOp::OpImportGMF ||
                theCommandID == SMESHOp::OpPopupImportGMF ) {
      if ( filenames.count() > 0 )
      {
        SUIT_OverrideCursor wc;
-       _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+       _PTR(Study) aStudy = SMESH::getStudy();
  
        QStringList errors;
        QStringList anEntryList;
  
      // Get parameters of export operation
  
-     QString            aFilename;
-     SMESH::MED_VERSION aFormat = SMESH::MED_LATEST;
+     QString aFilename;
      // Init the parameters with the default values
      bool aIsASCII_STL   = true;
      bool toCreateGroups = false;
      }
      else if ( isMED || isSAUV ) // Export to MED or SAUV
      {
-       QMap<QString, SMESH::MED_VERSION> aFilterMap;
+       QStringList filters;
        if ( isMED ) {
-         QString v22 (aMesh->GetVersionString(SMESH::MED_V2_2, 2));
-         aFilterMap.insert( QObject::tr( "MED_VX_FILES_FILTER" ).arg( v22 ) + " (*.med)", SMESH::MED_V2_2 );
-         int minor = v22.split(".").last().toInt();
-         int vv= int(SMESH::MED_MINOR_0); // add all minor from 0 to current
-         for (int ii=0; ii<minor; ii++)
-           {
-             QString vs = aMesh->GetVersionString(SMESH::MED_VERSION(vv), 2);
-             aFilterMap.insert( QObject::tr( "MED_VX_FILES_FILTER" ).arg( vs ) + " (*.med)",  SMESH::MED_VERSION(vv));
-             vv = vv +1;
-           }
+         filters << QObject::tr( "MED_FILES_FILTER" ) + " (*.med)";
        }
        else { // isSAUV
-         aFilterMap.insert("All files (*)", SMESH::MED_V2_1 );
-         aFilterMap.insert("SAUV files (*.sauv)", SMESH::MED_V2_2 );
-         aFilterMap.insert("SAUV files (*.sauve)", SMESH::MED_V2_1 );
+         filters << QObject::tr( "SAUV_FILES_FILTER" ) + " (*.sauv *.sauve)";
        }
  
-       QStringList filters;
-       QString aDefaultFilter;
-       QMap<QString, SMESH::MED_VERSION>::const_iterator it = aFilterMap.begin();
-       for ( ; it != aFilterMap.end(); ++it ) {
-         filters.push_back( it.key() );
-         if (it.value() == SMESH::MED_V2_2)
-           aDefaultFilter = it.key();
-       }
        QStringList checkBoxes;
        checkBoxes << QObject::tr("SMESH_AUTO_GROUPS") << QObject::tr("SMESH_AUTO_DIM");
  
          new SalomeApp_CheckFileDlg ( SMESHGUI::desktop(), false, checkBoxes, true, true, wdgList );
        fd->setWindowTitle( aTitle );
        fd->setNameFilters( filters );
-       fd->selectNameFilter( aDefaultFilter );
        fd->SetChecked( toCreateGroups, 0 );
        fd->SetChecked( toFindOutDim,   1 );
        if ( !anInitialPath.isEmpty() )
            aFilename = QString::null;
            break;
          }
-         aFormat = aFilterMap[fd->selectedNameFilter()];
          toOverwrite = fv->isOverwrite();
          is_ok = true;
          if ( !aFilename.isEmpty() ) {
-           // med-2.1 does not support poly elements
-           if ( aFormat==SMESH::MED_V2_1 )
-             for( aMeshIter = aMeshList.begin(); aMeshIter != aMeshList.end(); aMeshIter++ ) {
-               SMESH::SMESH_IDSource_var aMeshItem = (*aMeshIter).first;
-               SMESH::long_array_var nbElems = aMeshItem->GetMeshInfo();
-               if ( nbElems[ SMESH::Entity_Polygon   ] + nbElems[ SMESH::Entity_Quad_Polygon   ] +
-                    nbElems[ SMESH::Entity_Polyhedra ] + nbElems[ SMESH::Entity_Quad_Polyhedra ])
-               {
-                 int aRet = SUIT_MessageBox::warning(SMESHGUI::desktop(),
-                                                     QObject::tr("SMESH_WRN_WARNING"),
-                                                     QObject::tr("SMESH_EXPORT_MED_V2_1").arg((*aMeshIter).second),
-                                                     QObject::tr("SMESH_BUT_YES"),
-                                                     QObject::tr("SMESH_BUT_NO"), 0, 1);
-                 if (aRet != 0) {
-                   is_ok = false;
-                   break;
-                 }
-               }
-             }
            if( !toOverwrite ) {
              // can't append to an existing using other format
-             SMESH::MED_VERSION aVersion = aFormat; //SMESH::MED_V2_1;
-             bool isVersionOk = SMESHGUI::GetSMESHGen()->GetMEDVersion( aFilename.toUtf8().constData(), aVersion );
-             if( !isVersionOk || aVersion != aFormat ) {
+             bool isVersionOk = SMESHGUI::GetSMESHGen()->CheckCompatibility( aFilename.toUtf8().constData() );
+             if ( !isVersionOk ) {
                int aRet = SUIT_MessageBox::warning(SMESHGUI::desktop(),
                                                    QObject::tr("SMESH_WRN_WARNING"),
                                                    QObject::tr("SMESH_EXPORT_MED_VERSION_COLLISION").arg(aFilename),
              const QString&            geoAssFields = aFieldList[ aMeshIndex ].second;
              const bool                   hasFields = ( fields.length() || !geoAssFields.isEmpty() );
              if ( !hasFields && aMeshOrGroup->_is_equivalent( aMeshItem ))
-               aMeshItem->ExportToMEDX( aFilename.toUtf8().data(), toCreateGroups,
-                                        aFormat, toOverwrite && aMeshIndex == 0, toFindOutDim );
+               aMeshItem->ExportMED( aFilename.toUtf8().data(), toCreateGroups,
+                                     toOverwrite && aMeshIndex == 0, toFindOutDim );
              else
                aMeshItem->ExportPartToMED( aMeshOrGroup, aFilename.toUtf8().data(), toCreateGroups,
-                                           aFormat, toOverwrite && aMeshIndex == 0, toFindOutDim,
+                                           toOverwrite && aMeshIndex == 0, toFindOutDim,
                                            fields, geoAssFields.toLatin1().data() );
            }
          }
        if ( selected.Extent() )
        {
          Handle(SALOME_InteractiveObject) anIObject = selected.First();
-         _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+         _PTR(Study) aStudy = SMESH::getStudy();
          _PTR(SObject) aSObj = aStudy->FindObjectID(anIObject->getEntry());
          if (aSObj) {
            if ( aStudy->GetUseCaseBuilder()->SortChildren( aSObj, true/*AscendingOrder*/ ) ) {
      }
    }
  
-   void SetDisplayMode(int theCommandID, SMESHGUI_StudyId2MarkerMap& theMarkerMap)
+   void SetDisplayMode(int theCommandID, VTK::MarkerMap& theMarkerMap)
    {
      SALOME_ListIO selected;
      SalomeApp_Application* app =
        return;
      }
  
-     _PTR(Study) aStudy = appStudy->studyDS();
      aSel->selectedObjects( selected );
  
      if ( selected.Extent() >= 1 )
              break;
          }
  
-         SMESHGUI_PropertiesDlg dlg( theMarkerMap[ aStudy->StudyId() ], SMESHGUI::desktop() );
+         SMESHGUI_PropertiesDlg dlg( theMarkerMap, SMESHGUI::desktop() );
          // nodes: color, marker
          dlg.setNodeColor( nodeColor );
          if( markerType != VTK::MT_USER )
            orientation3d    = dlg.orientation3d();
            shrinkCoef       = dlg.shrinkCoef() / 100.;
  
-           // store point markers map that might be changed by the user
-           theMarkerMap[ aStudy->StudyId() ] = dlg.customMarkers();
+           // store point markers that might be changed by the user
+           theMarkerMap = dlg.customMarkers();
  
            // set properties from dialog box to the presentations
            SALOME_ListIteratorOfListIO It( selected );
                anActor->SetMarkerStd( markerType, markerScale );
              }
              else {
-               const VTK::MarkerMap& markerMap = theMarkerMap[ aStudy->StudyId() ];
-               VTK::MarkerMap::const_iterator iter = markerMap.find( markerId );
-               if ( iter != markerMap.end() )
+               VTK::MarkerMap::const_iterator iter = theMarkerMap.find( markerId );
+               if ( iter != theMarkerMap.end() )
                  anActor->SetMarkerTexture( markerId, iter->second.second );
              }
              // volumes: normal color, reversed color (delta)
      ActionControl.Bind( SMESHOp::OpOverConstrainedVolume, SMESH_Actor::eOverConstrainedVolume );
      ActionControl.Bind( SMESHOp::OpEqualVolume,           SMESH_Actor::eCoincidentElems3D );
  
 -    return theReversed ? ActionControl.Find2( theID ) : ActionControl.Find1( theID );
 +    if ( theReversed )
 +      return ActionControl.IsBound2( theID ) ? ActionControl.Find2( theID ) : 0;
 +    return   ActionControl.IsBound1( theID ) ? ActionControl.Find1( theID ) : 0;
    }
  
    void Control( int theCommandID )
    {
      SMESH_Actor::eControl aControl = SMESH_Actor::eControl( ActionToControl( theCommandID ));
-     _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+     _PTR(Study) aStudy = SMESH::getStudy();
  
      SALOME_ListIO selected;
      if ( LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr() )
              if ( !anIDSrc->_is_nil() ) {
                SMESH_Actor *anActor = SMESH::FindActorByEntry( anIO->getEntry());
                if (( !anActor && selected.Extent() == 1 ) &&
-                   ( anActor = SMESH::CreateActor( aStudy, anIO->getEntry() )))
+                   ( anActor = SMESH::CreateActor( anIO->getEntry() )))
                {
                  anActor->SetControlMode( aControl );
                  SMESH::DisplayActor( SMESH::GetCurrentVtkView(), anActor );
  
    QString CheckTypeObject(const Handle(SALOME_InteractiveObject) & theIO)
    {
-     _PTR(Study)  aStudy = SMESH::GetActiveStudyDocument();
+     _PTR(Study)  aStudy = SMESH::getStudy();
      _PTR(SObject) aSObj = aStudy->FindObjectID(theIO->getEntry());
      if (aSObj) {
        _PTR(SComponent) aSComp = aSObj->GetFatherComponent();
@@@ -1848,7 -1800,7 +1803,7 @@@ void SMESHGUI::OnEditDelete(
    LightApp_SelectionMgr* aSel = SMESHGUI::selectionMgr();
    SALOME_ListIO selected; aSel->selectedObjects( selected, QString::null, false );
  
-   _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+   _PTR(Study) aStudy = SMESH::getStudy();
    _PTR(StudyBuilder) aStudyBuilder = aStudy->NewBuilder();
    _PTR(GenericAttribute) anAttr;
    _PTR(AttributeIOR) anIOR;
    int objectCount = 0;
    QString aNameList;
    QString aParentComponent = QString::null;
 -  Handle(SALOME_InteractiveObject) anIO;
 +  
    for( SALOME_ListIteratorOfListIO anIt( selected ); anIt.More(); anIt.Next() )
    {
 -    anIO = anIt.Value();
 -    QString cur = anIO->getComponentDataType();
 -    _PTR(SObject) aSO = aStudy->FindObjectID(anIO->getEntry());
 +    Handle(SALOME_InteractiveObject) anIO = anIt.Value();
 +    if ( anIO.IsNull() ) continue;
 +    
 +    QString father = "unknown";
 +
 +    _PTR(SObject) aSO = aStudy->FindObjectID( anIO->getEntry() );
      if (aSO) {
 +      father = QString::fromStdString( aSO->GetFatherComponent()->ComponentDataType() );
        // check if object is reference
        _PTR(SObject) aRefSObj;
        aNameList.append("\n    - ");
        if ( aSO->ReferencedObject( aRefSObj ) ) {
          QString aRefName = QString::fromStdString ( aRefSObj->GetName() );
          aNameList.append( aRefName );
 -        cur = QString::fromStdString ( aRefSObj->GetFatherComponent()->ComponentDataType() );
 +        father = QString::fromStdString ( aRefSObj->GetFatherComponent()->ComponentDataType() );
        }
        else
          aNameList.append(anIO->getName());
      }
  
      if( aParentComponent.isNull() )
 -      aParentComponent = cur;
 -    else if( !aParentComponent.isEmpty() && aParentComponent!=cur )
 +      aParentComponent = father;
 +    else if( !aParentComponent.isEmpty() && aParentComponent!=father )
        aParentComponent = "";
    }
  
@@@ -2240,17 -2188,6 +2195,6 @@@ SMESHGUI* SMESHGUI::GetSMESHGUI(
      smeshMod = dynamic_cast<SMESHGUI*>( module );
    }
  
-   if ( smeshMod && smeshMod->application() && smeshMod->application()->activeStudy() )
-   {
-     SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( smeshMod->application()->activeStudy() );
-     if ( study )
-     {
-       _PTR(Study) aStudy = study->studyDS();
-       if ( aStudy )
-         GetSMESHGen()->SetCurrentStudy( _CAST(Study,aStudy)->GetStudy() );
-     }
-   }
    return smeshMod;
  }
  
@@@ -2423,36 -2360,27 +2367,27 @@@ bool SMESHGUI::DefineDlgPosition(QWidge
    return true;
  }
  
- //=============================================================================
  /*!
-  *
-  */
- //=============================================================================
- static int isStudyLocked(_PTR(Study) theStudy){
-   return theStudy->GetProperties()->IsLocked();
- }
- static bool checkLock(_PTR(Study) theStudy) {
-   if (isStudyLocked(theStudy)) {
-     SUIT_MessageBox::warning( SMESHGUI::desktop(),
-                               QObject::tr("WRN_WARNING"),
-                               QObject::tr("WRN_STUDY_LOCKED") );
+  * \brief Verifies whether study of operation is locked
+   * \param theMess - specifies whether message box must be shown if study is locked
+   * \return State of study.
+ *
+ * Verifies whether study of operation is locked. If second parameter is TRUE and study
+ * is locked when corresponding message box appears
+ */
+ bool SMESHGUI::isStudyLocked( bool theMessage )
+ {
+   if ( SMESH::getStudy()->GetProperties()->IsLocked() )
+   {
+     if ( theMessage )
+       SUIT_MessageBox::warning( SMESHGUI::desktop(),
+                                 QObject::tr( "WRN_WARNING" ),
+                                 QObject::tr( "WRN_STUDY_LOCKED" ) );
      return true;
    }
    return false;
  }
  
- //=======================================================================
- //function : CheckActiveStudyLocked
- //purpose  :
- //=======================================================================
- bool SMESHGUI::isActiveStudyLocked()
- {
-   _PTR(Study) aStudy = activeStudy()->studyDS();
-   return checkLock( aStudy );
- }
  //=============================================================================
  /*!
   *
@@@ -2464,15 -2392,10 +2399,10 @@@ bool SMESHGUI::OnGUIEvent( int theComma
    if( !anApp )
      return false;
  
-   _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); //Document OCAF de l'etude active
    SUIT_ResourceMgr* mgr = resourceMgr();
    if( !mgr )
      return false;
  
-   if (CORBA::is_nil(GetSMESHGen()->GetCurrentStudy())) {
-     GetSMESHGen()->SetCurrentStudy(_CAST(Study,aStudy)->GetStudy());
-   }
    SUIT_ViewWindow* view = application()->desktop()->activeWindow();
    SVTK_ViewWindow* vtkwnd = dynamic_cast<SVTK_ViewWindow*>( view );
  
  
    switch (theCommandID) {
    case SMESHOp::OpDelete:
-     if(checkLock(aStudy)) break;
+     if(isStudyLocked()) break;
      OnEditDelete();
      break;
    case SMESHOp::OpImportDAT:
    case SMESHOp::OpPopupImportSAUV:
    case SMESHOp::OpPopupImportGMF:
      {
-       if(checkLock(aStudy)) break;
+       if(isStudyLocked()) break;
        ::ImportMeshesFromFile(GetSMESHGen(),theCommandID);
        break;
      }
  
    case SMESHOp::OpUpdate:
      {
-       if(checkLock(aStudy)) break;
+       if(isStudyLocked()) break;
        SUIT_OverrideCursor wc;
        try {
          OCC_CATCH_SIGNALS;
          }
  
          // PAL13338 + PAL15161 -->
-         if ( ( theCommandID==SMESHOp::OpShow || theCommandID==SMESHOp::OpShowOnly ) && !checkLock(aStudy)) {
+         if ( ( theCommandID==SMESHOp::OpShow || theCommandID==SMESHOp::OpShowOnly ) && !isStudyLocked()) {
            SMESH::UpdateView();
            SMESHGUI::GetSMESHGUI()->EmitSignalVisibilityChanged();
          }
  
    case SMESHOp::OpNode:
      {
-       if(checkLock(aStudy)) break;
+       if(isStudyLocked()) break;
  
        if ( vtkwnd ) {
          EmitSignalDeactivateDialog();
      break;
    case SMESHOp::OpCopyMesh:
      {
-       if (checkLock(aStudy)) break;
+       if (isStudyLocked()) break;
        EmitSignalDeactivateDialog();
        ( new SMESHGUI_CopyMeshDlg( this ) )->show();
      }
      break;
    case SMESHOp::OpBuildCompoundMesh:
      {
-       if (checkLock(aStudy)) break;
+       if (isStudyLocked()) break;
        EmitSignalDeactivateDialog();
        ( new SMESHGUI_BuildCompoundDlg( this ) )->show();
      }
          break;
        }
  
-       if ( checkLock( aStudy ) )
+       if ( isStudyLocked() )
          break;
  
        /*Standard_Boolean aRes;
          break;
        }
  
-       if ( checkLock( aStudy ) )
+       if ( isStudyLocked() )
          break;
  
        EmitSignalDeactivateDialog();
      }
    case SMESHOp::OpSmoothing:
      {
-       if(checkLock(aStudy)) break;
+       if(isStudyLocked()) break;
        if( vtkwnd ) {
          EmitSignalDeactivateDialog();
          ( new SMESHGUI_SmoothingDlg( this ) )->show();
      }
    case SMESHOp::OpExtrusion:
      {
-       if (checkLock(aStudy)) break;
+       if (isStudyLocked()) break;
        if (vtkwnd) {
          EmitSignalDeactivateDialog();
          ( new SMESHGUI_ExtrusionDlg ( this ) )->show();
      }
    case SMESHOp::OpExtrusionAlongAPath:
      {
-       if (checkLock(aStudy)) break;
+       if (isStudyLocked()) break;
        if (vtkwnd) {
          EmitSignalDeactivateDialog();
          ( new SMESHGUI_ExtrusionAlongPathDlg( this ) )->show();
      }
    case SMESHOp::OpRevolution:
      {
-       if(checkLock(aStudy)) break;
+       if(isStudyLocked()) break;
        if( vtkwnd ) {
          EmitSignalDeactivateDialog();
          ( new SMESHGUI_RevolutionDlg( this ) )->show();
      }
    case SMESHOp::OpPatternMapping:
      {
-       if ( checkLock( aStudy ) )
+       if ( isStudyLocked() )
          break;
        if ( vtkwnd )
        {
          break;
        }
  
-       if(checkLock(aStudy)) break;
+       if(isStudyLocked()) break;
        EmitSignalDeactivateDialog();
        SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_nil();
  
          break;
        }
  
-       if(checkLock(aStudy)) break;
+       if(isStudyLocked()) break;
        EmitSignalDeactivateDialog();
  
        LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
          // check if submesh is selected
          Handle(SALOME_InteractiveObject) IObject = selected.First();
          if (IObject->hasEntry()) {
-           _PTR(SObject) aSObj = aStudy->FindObjectID(IObject->getEntry());
+           _PTR(SObject) aSObj = SMESH::getStudy()->FindObjectID(IObject->getEntry());
            if( aSObj ) {
              SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( SMESH::SObjectToObject( aSObj ) );
              if (!aSubMesh->_is_nil()) {
          break;
        }
  
-       if(checkLock(aStudy)) break;
+       if(isStudyLocked()) break;
        EmitSignalDeactivateDialog();
  
        LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
  
    case SMESHOp::OpAddElemGroupPopup:     // Add elements to group
      {
-       if(checkLock(aStudy)) break;
+       if(isStudyLocked()) break;
        if (myState == 800) {
          SMESHGUI_GroupDlg *aDlg = (SMESHGUI_GroupDlg*) myActiveDialogBox;
          if (aDlg) aDlg->onAdd();
  
    case SMESHOp::OpRemoveElemGroupPopup:  // Remove elements from group
      {
-       if(checkLock(aStudy)) break;
+       if(isStudyLocked()) break;
        if (myState == 800) {
          SMESHGUI_GroupDlg *aDlg = (SMESHGUI_GroupDlg*) myActiveDialogBox;
          if (aDlg) aDlg->onRemove();
          break;
        }
  
-       if(checkLock(aStudy)) break;
+       if(isStudyLocked()) break;
        EmitSignalDeactivateDialog();
  
        LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
          break;
        }
  
-       if ( checkLock( aStudy ) )
+       if ( isStudyLocked() )
          break;
  
        EmitSignalDeactivateDialog();
  
      case SMESHOp::OpGroupUnderlyingElem: // Create groups of entities from existing groups of superior dimensions
      {
-       if ( checkLock( aStudy ) )
+       if ( isStudyLocked() )
          break;
  
        EmitSignalDeactivateDialog();
          break;
        }
  
-       if ( checkLock( aStudy ) )
+       if ( isStudyLocked() )
          break;
  
        EmitSignalDeactivateDialog();
  
    case SMESHOp::OpEditHypothesis:
      {
-       if(checkLock(aStudy)) break;
+       if(isStudyLocked()) break;
  
        LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
        SALOME_ListIO selected;
      }
    case SMESHOp::OpUnassign:                      // REMOVE HYPOTHESIS / ALGORITHMS
      {
-       if(checkLock(aStudy)) break;
+       if(isStudyLocked()) break;
        SUIT_OverrideCursor wc;
  
        LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
    case SMESHOp::OpPyramid:
    case SMESHOp::OpHexagonalPrism:
      {
-       if(checkLock(aStudy)) break;
+       if(isStudyLocked()) break;
        if ( vtkwnd ) {
          EmitSignalDeactivateDialog();
          SMDSAbs_EntityType type = SMDSEntity_Edge;
      }
    case SMESHOp::OpPolyhedron:
      {
-       if(checkLock(aStudy)) break;
+       if(isStudyLocked()) break;
        if ( vtkwnd ) {
          EmitSignalDeactivateDialog();
          ( new SMESHGUI_CreatePolyhedralVolumeDlg( this ) )->show();
    case SMESHOp::OpQuadraticHexahedron:
    case SMESHOp::OpTriQuadraticHexahedron:
      {
-       if(checkLock(aStudy)) break;
+       if(isStudyLocked()) break;
        if ( vtkwnd ) {
          EmitSignalDeactivateDialog();
          SMDSAbs_EntityType type = SMDSEntity_Last;
      }
    case SMESHOp::OpRemoveNodes:
      {
-       if(checkLock(aStudy)) break;
+       if(isStudyLocked()) break;
        if ( vtkwnd ) {
          EmitSignalDeactivateDialog();
          ( new SMESHGUI_RemoveNodesDlg( this ) )->show();
      }
    case SMESHOp::OpRemoveElements:                                    // REMOVES ELEMENTS
      {
-       if(checkLock(aStudy)) break;
+       if(isStudyLocked()) break;
        if( vtkwnd ) {
          EmitSignalDeactivateDialog();
          ( new SMESHGUI_RemoveElementsDlg( this ) )->show();
      }
    case SMESHOp::OpClearMesh: {
  
-     if(checkLock(aStudy)) break;
+     if(isStudyLocked()) break;
  
      SALOME_ListIO selected;
      if( LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr() )
          SMESH::ModifiedMesh( aMeshSObj, false, true);
          // hide groups and submeshes
          _PTR(ChildIterator) anIter =
-           SMESH::GetActiveStudyDocument()->NewChildIterator( aMeshSObj );
+           SMESH::getStudy()->NewChildIterator( aMeshSObj );
          for ( anIter->InitEx(true); anIter->More(); anIter->Next() )
          {
            _PTR(SObject) so = anIter->Value();
    }
    case SMESHOp::OpRemoveOrphanNodes:
      {
-       if(checkLock(aStudy)) break;
+       if(isStudyLocked()) break;
        SALOME_ListIO selected;
        if( LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr() )
          aSel->selectedObjects( selected );
      }
    case SMESHOp::OpRenumberingNodes:
      {
-       if(checkLock(aStudy)) break;
+       if(isStudyLocked()) break;
        if( vtkwnd ) {
          EmitSignalDeactivateDialog();
          ( new SMESHGUI_RenumberingDlg( this, 0 ) )->show();
      }
    case SMESHOp::OpRenumberingElements:
      {
-       if(checkLock(aStudy)) break;
+       if(isStudyLocked()) break;
        if ( vtkwnd ) {
          EmitSignalDeactivateDialog();
          ( new SMESHGUI_RenumberingDlg( this, 1 ) )->show();
      }
    case SMESHOp::OpTranslation:
      {
-       if(checkLock(aStudy)) break;
+       if(isStudyLocked()) break;
        if ( vtkwnd ) {
          EmitSignalDeactivateDialog();
          ( new SMESHGUI_TranslationDlg( this ) )->show();
      }
    case SMESHOp::OpRotation:
      {
-       if(checkLock(aStudy)) break;
+       if(isStudyLocked()) break;
        if( vtkwnd ) {
          EmitSignalDeactivateDialog();
          ( new SMESHGUI_RotationDlg( this ) )->show();
      }
    case SMESHOp::OpSymmetry:
      {
-       if(checkLock(aStudy)) break;
+       if(isStudyLocked()) break;
        if(vtkwnd) {
          EmitSignalDeactivateDialog();
          ( new SMESHGUI_SymmetryDlg( this ) )->show();
      }
    case SMESHOp::OpScale:
      {
-       if(checkLock(aStudy)) break;
+       if(isStudyLocked()) break;
        if ( vtkwnd ) {
          EmitSignalDeactivateDialog();
          ( new SMESHGUI_ScaleDlg( this ) )->show();
        break;
      }
  
-       if(checkLock(aStudy)) break;
 +  case SMESHOp::OpOffset:
 +    {
++      if(isStudyLocked()) break;
 +      if ( vtkwnd ) {
 +        EmitSignalDeactivateDialog();
 +        ( new SMESHGUI_OffsetDlg( this ) )->show();
 +      }
 +      else {
 +        SUIT_MessageBox::warning(SMESHGUI::desktop(),
 +                                 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
 +      }
 +      break;
 +    }
 +
    case SMESHOp::OpSewing:
      {
-       if(checkLock(aStudy)) break;
+       if(isStudyLocked()) break;
        if(vtkwnd) {
          EmitSignalDeactivateDialog();
          ( new SMESHGUI_SewingDlg( this ) )->show();
      }
    case SMESHOp::OpMergeNodes:
      {
-       if(checkLock(aStudy)) break;
+       if(isStudyLocked()) break;
        if(vtkwnd) {
          EmitSignalDeactivateDialog();
          ( new SMESHGUI_MergeDlg( this, 0 ) )->show();
      }
    case SMESHOp::OpMergeElements:
      {
-       if (checkLock(aStudy)) break;
+       if (isStudyLocked()) break;
        if (vtkwnd) {
          EmitSignalDeactivateDialog();
          ( new SMESHGUI_MergeDlg( this, 1 ) )->show();
  
    case SMESHOp::OpDuplicateNodes:
      {
-       if(checkLock(aStudy)) break;
+       if(isStudyLocked()) break;
        if ( vtkwnd ) {
          EmitSignalDeactivateDialog();
          ( new SMESHGUI_DuplicateNodesDlg( this ) )->show();
@@@ -4005,7 -3914,6 +3935,7 @@@ void SMESHGUI::initialize( CAM_Applicat
    createSMESHAction( SMESHOp::OpRotation,               "ROT",             "ICON_DLG_MESH_ROTATION" );
    createSMESHAction( SMESHOp::OpSymmetry,               "SYM",             "ICON_SMESH_SYMMETRY_PLANE" );
    createSMESHAction( SMESHOp::OpScale,                  "SCALE",           "ICON_DLG_MESH_SCALE" );
 +  createSMESHAction( SMESHOp::OpOffset,                 "OFFSET",          "ICON_DLG_MESH_OFFSET" );
    createSMESHAction( SMESHOp::OpSewing,                 "SEW",             "ICON_SMESH_SEWING_FREEBORDERS" );
    createSMESHAction( SMESHOp::OpMergeNodes,             "MERGE",           "ICON_SMESH_MERGE_NODES" );
    createSMESHAction( SMESHOp::OpMergeElements,          "MERGE_ELEMENTS",  "ICON_DLG_MERGE_ELEMENTS" );
    //createMenu( SMESHOp::OpRenumberingNodes,    renumId, -1 );
    //createMenu( SMESHOp::OpRenumberingElements, renumId, -1 );
  
 +  createMenu( SMESHOp::OpMergeNodes,     transfId, -1 );
 +  createMenu( SMESHOp::OpMergeElements,  transfId, -1 );
    createMenu( SMESHOp::OpTranslation,    transfId, -1 );
    createMenu( SMESHOp::OpRotation,       transfId, -1 );
    createMenu( SMESHOp::OpSymmetry,       transfId, -1 );
    createMenu( SMESHOp::OpScale,          transfId, -1 );
 +  createMenu( SMESHOp::OpOffset,         transfId, -1 );
    createMenu( SMESHOp::OpSewing,         transfId, -1 );
 -  createMenu( SMESHOp::OpMergeNodes,     transfId, -1 );
 -  createMenu( SMESHOp::OpMergeElements,  transfId, -1 );
    createMenu( SMESHOp::OpDuplicateNodes, transfId, -1 );
  
 +  createMenu( SMESHOp::OpConvertMeshToQuadratic, modifyId, -1 );
 +  createMenu( SMESHOp::OpCreateBoundaryElements, modifyId, -1 );
 +  createMenu( SMESHOp::OpExtrusion,              modifyId, -1 );
 +  createMenu( SMESHOp::OpExtrusionAlongAPath,    modifyId, -1 );
 +  createMenu( SMESHOp::OpRevolution,             modifyId, -1 );
 +  createMenu( SMESHOp::OpOrientation,            modifyId, -1 );
 +  createMenu( SMESHOp::OpReorientFaces,          modifyId, -1 );
    createMenu( SMESHOp::OpMoveNode,               modifyId, -1 );
    createMenu( SMESHOp::OpDiagonalInversion,      modifyId, -1 );
    createMenu( SMESHOp::OpUnionOfTwoTriangle,     modifyId, -1 );
 -  createMenu( SMESHOp::OpOrientation,            modifyId, -1 );
 -  createMenu( SMESHOp::OpReorientFaces,          modifyId, -1 );
    createMenu( SMESHOp::OpUnionOfTriangles,       modifyId, -1 );
    createMenu( SMESHOp::OpCuttingOfQuadrangles,   modifyId, -1 );
    createMenu( SMESHOp::OpSplitVolumes,           modifyId, -1 );
    createMenu( SMESHOp::OpSplitBiQuadratic,       modifyId, -1 );
    createMenu( SMESHOp::OpSmoothing,              modifyId, -1 );
 -  createMenu( SMESHOp::OpExtrusion,              modifyId, -1 );
 -  createMenu( SMESHOp::OpExtrusionAlongAPath ,   modifyId, -1 );
 -  createMenu( SMESHOp::OpRevolution,             modifyId, -1 );
    createMenu( SMESHOp::OpPatternMapping,         modifyId, -1 );
 -  createMenu( SMESHOp::OpConvertMeshToQuadratic, modifyId, -1 );
 -  createMenu( SMESHOp::OpCreateBoundaryElements, modifyId, -1 );
  
    createMenu( SMESHOp::OpMinimumDistance,  measureId,   -1 );
    createMenu( SMESHOp::OpBoundingBox,      measureId,   -1 );
    //createTool( SMESHOp::OpRenumberingNodes,    renumbTb );
    //createTool( SMESHOp::OpRenumberingElements, renumbTb );
  
 +  createTool( SMESHOp::OpMergeNodes,     transformTb );
 +  createTool( SMESHOp::OpMergeElements,  transformTb );
    createTool( SMESHOp::OpTranslation,    transformTb );
    createTool( SMESHOp::OpRotation,       transformTb );
    createTool( SMESHOp::OpSymmetry,       transformTb );
    createTool( SMESHOp::OpScale,          transformTb );
 +  createTool( SMESHOp::OpOffset,         transformTb );
    createTool( SMESHOp::OpSewing,         transformTb );
 -  createTool( SMESHOp::OpMergeNodes,     transformTb );
 -  createTool( SMESHOp::OpMergeElements,  transformTb );
    createTool( SMESHOp::OpDuplicateNodes, transformTb );
  
 +  createTool( SMESHOp::OpConvertMeshToQuadratic, modifyTb );
 +  createTool( SMESHOp::OpCreateBoundaryElements, modifyTb );
 +  createTool( SMESHOp::OpExtrusion,              modifyTb );
 +  createTool( SMESHOp::OpExtrusionAlongAPath,    modifyTb );
 +  createTool( SMESHOp::OpRevolution,             modifyTb );
 +  createTool( SMESHOp::OpOrientation,            modifyTb );
 +  createTool( SMESHOp::OpReorientFaces,          modifyTb );
    createTool( SMESHOp::OpMoveNode,               modifyTb );
    createTool( SMESHOp::OpDiagonalInversion,      modifyTb );
    createTool( SMESHOp::OpUnionOfTwoTriangle,     modifyTb );
 -  createTool( SMESHOp::OpOrientation,            modifyTb );
 -  createTool( SMESHOp::OpReorientFaces,          modifyTb );
    createTool( SMESHOp::OpUnionOfTriangles,       modifyTb );
    createTool( SMESHOp::OpCuttingOfQuadrangles,   modifyTb );
    createTool( SMESHOp::OpSplitVolumes,           modifyTb );
    createTool( SMESHOp::OpSplitBiQuadratic,       modifyTb );
    createTool( SMESHOp::OpSmoothing,              modifyTb );
 -  createTool( SMESHOp::OpExtrusion,              modifyTb );
 -  createTool( SMESHOp::OpExtrusionAlongAPath,    modifyTb );
 -  createTool( SMESHOp::OpRevolution,             modifyTb );
    createTool( SMESHOp::OpPatternMapping,         modifyTb );
 -  createTool( SMESHOp::OpConvertMeshToQuadratic, modifyTb );
 -  createTool( SMESHOp::OpCreateBoundaryElements, modifyTb );
  
    createTool( SMESHOp::OpMinimumDistance, measuremTb );
  
@@@ -4909,11 -4815,7 +4839,7 @@@ bool SMESHGUI::activateModule( SUIT_Stu
    action(SMESHOp::OpDelete)->setEnabled(true); // Delete: Key_Delete
  
    //  0020210. Make SMESH_Gen update meshes at switching GEOM->SMESH
-   GetSMESHGen()->SetCurrentStudy(SALOMEDS::Study::_nil());
-   if ( SalomeApp_Study* s = dynamic_cast<SalomeApp_Study*>( study )) {
-     if ( _PTR(Study) aStudy = s->studyDS() )
-       GetSMESHGen()->SetCurrentStudy( _CAST(Study,aStudy)->GetStudy() );
-   }
+   GetSMESHGen()->UpdateStudy();
  
    // get all view currently opened in the study and connect their signals  to
    // the corresponding slots of the class.
@@@ -4946,7 -4848,7 +4872,7 @@@ void SMESHGUI::studyClosed( SUIT_Study
  {
    if( !s )
      return;
-   SMESH::RemoveVisuData( s->id() );
+   SMESH::RemoveVisuData();
    SalomeApp_Module::studyClosed( s );
  }
  
@@@ -4962,16 -4864,11 +4888,11 @@@ void SMESHGUI::OnGUIEvent(
  
  SMESH::SMESH_Gen_var SMESHGUI::GetSMESHGen()
  {
-   _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); //Document OCAF de l'etude active
    if ( CORBA::is_nil( myComponentSMESH ) )
-     {
-       SMESHGUI aGUI; //SRN BugID: IPAL9186: Create an instance of SMESHGUI to initialize myComponentSMESH
-       if ( aStudy )
-         aGUI.myComponentSMESH->SetCurrentStudy(_CAST(Study,aStudy)->GetStudy());
-       return aGUI.myComponentSMESH;
-     }
-   if ( aStudy )
-     myComponentSMESH->SetCurrentStudy(_CAST(Study,aStudy)->GetStudy());
+   {
+     SMESHGUI aGUI; //SRN BugID: IPAL9186: Create an instance of SMESHGUI to initialize myComponentSMESH
+     return aGUI.myComponentSMESH;
+   }
    return myComponentSMESH;
  }
  
@@@ -5681,8 -5578,7 +5602,7 @@@ LightApp_Operation* SMESHGUI::createOpe
  
  void SMESHGUI::switchToOperation(int id)
  {
-   if ( _PTR(Study) aStudy = SMESH::GetActiveStudyDocument() )
-     activeStudy()->abortAllOperations();
+   activeStudy()->abortAllOperations();
    startOperation( id );
  }
  
@@@ -5775,12 -5671,11 +5695,11 @@@ void SMESHGUI::storeVisualParameters (i
                                                               savePoint);
    _PTR(IParameters) ip = ClientFactory::getIParameters(ap);
  
-   // store map of custom markers
-   const VTK::MarkerMap& aMarkerMap = myMarkerMap[ studyDS->StudyId() ];
-   if( !aMarkerMap.empty() )
+   // store custom markers
+   if( !myMarkerMap.empty() )
    {
-     VTK::MarkerMap::const_iterator anIter = aMarkerMap.begin();
-     for( ; anIter != aMarkerMap.end(); anIter++ )
+     VTK::MarkerMap::const_iterator anIter = myMarkerMap.begin();
+     for( ; anIter != myMarkerMap.end(); anIter++ )
      {
        int anId = anIter->first;
        VTK::MarkerData aMarkerData = anIter->second;
@@@ -6128,8 -6023,7 +6047,7 @@@ void SMESHGUI::restoreVisualParameters 
                                                               savePoint);
    _PTR(IParameters) ip = ClientFactory::getIParameters(ap);
  
-   // restore map of custom markers and map of clipping planes
-   VTK::MarkerMap& aMarkerMap = myMarkerMap[ studyDS->StudyId() ];
+   // restore custom markers and map of clipping planes
    TPlaneDataMap aPlaneDataMap;
  
    std::vector<std::string> properties = ip->getProperties();
            aMarkerTexture.push_back( aChar.digitValue() );
        }
  
-       aMarkerMap[ anId ] = VTK::MarkerData( aMarkerFileName, aMarkerTexture );
+       myMarkerMap[ anId ] = VTK::MarkerData( aMarkerFileName, aMarkerTexture );
      }
      else if( aPropertyType == "ClippingPlane" )
      {
                      aSmeshActor->SetMarkerStd( (VTK::MarkerType)aParam1, (VTK::MarkerScale)aParam2 );
                    }
                    else if( data[0] == "custom" ) {
-                     VTK::MarkerMap::const_iterator markerIt = aMarkerMap.find( aParam1 );
-                     if( markerIt != aMarkerMap.end() ) {
+                     VTK::MarkerMap::const_iterator markerIt = myMarkerMap.find( aParam1 );
+                     if( markerIt != myMarkerMap.end() ) {
                        VTK::MarkerData aMarkerData = markerIt->second;
                        aSmeshActor->SetMarkerTexture( aParam1, aMarkerData.second );
                      }
@@@ -7109,7 -7003,7 +7027,7 @@@ bool SMESHGUI::renameAllowed( const QSt
      return false;
  
    // check type to prevent renaming of inappropriate objects
-   int aType = SMESHGUI_Selection::type(qPrintable(entry), SMESH::GetActiveStudyDocument());
+   int aType = SMESHGUI_Selection::type(qPrintable(entry));
    if (aType == SMESH::MESH || aType == SMESH::GROUP ||
        aType == SMESH::SUBMESH || aType == SMESH::SUBMESH_COMPOUND ||
        aType == SMESH::SUBMESH_SOLID || aType == SMESH::SUBMESH_FACE ||
@@@ -7156,7 -7050,7 +7074,7 @@@ bool SMESHGUI::renameObject( const QStr
      if ( obj->FindAttribute(anAttr, "AttributeName") ) {
        aName = anAttr;
        // check type to prevent renaming of inappropriate objects
-       int aType = SMESHGUI_Selection::type( qPrintable(entry), SMESH::GetActiveStudyDocument() );
+       int aType = SMESHGUI_Selection::type( qPrintable(entry));
        if (aType == SMESH::MESH || aType == SMESH::GROUP ||
            aType == SMESH::SUBMESH || aType == SMESH::SUBMESH_COMPOUND ||
            aType == SMESH::SUBMESH_SOLID || aType == SMESH::SUBMESH_FACE ||
index 753f96fd42a9bee58a2b45639a5410c34a430b91,a015b4181e1bdd6b9b04185f0d633b1ea2023cfc..c97769b31ecd2a2a38a620b69e24fc6b3b6f2210
@@@ -222,7 -222,7 +222,7 @@@ SMESHGUI_Add0DElemsOnAllNodesOp::SMESHG
     myDlg( new SMESHGUI_Add0DElemsOnAllNodesDlg ),
     myFilterDlg( 0 )
  {
 -  myHelpFileName = "adding_nodes_and_elements_page.html#adding_0delems_on_all_nodes_anchor";
 +  myHelpFileName = "adding_nodes_and_elements.html#adding-0delems-on-all-nodes-anchor";
  
    connect( myDlg,              SIGNAL( selTypeChanged(int) ), SLOT( onSelTypeChange(int)));
    connect( myDlg->myFilterBtn, SIGNAL( clicked()),            SLOT( onSetFilter() ));
@@@ -310,8 -310,7 +310,7 @@@ void SMESHGUI_Add0DElemsOnAllNodesOp::s
      _PTR(SObject) group0DRoot;
      if ( meshSO && meshSO->FindSubObject( SMESH::Tag_0DElementsGroups, group0DRoot ))
      {
-       _PTR(Study)              aStudy = SMESH::GetActiveStudyDocument();
-       _PTR(ChildIterator) group0DIter = aStudy->NewChildIterator( group0DRoot );
+       _PTR(ChildIterator) group0DIter = SMESH::getStudy()->NewChildIterator( group0DRoot );
        for ( ; group0DIter->More(); group0DIter->Next() )
        {
          _PTR(SObject) groupSO = group0DIter->Value();
index 4eca00d107082869d070884b4b461f8440c145d3,aea995c8823cd43610f476b0bde02abcaff123e4..642244cc69cd237b2b80d86145af953e98313cdc
@@@ -40,7 -40,7 +40,7 @@@
  #include <SMESH_FaceOrientationFilter.h>
  #include <SMDS_Mesh.hxx>
  
 -// SALOME GUI inclues
 +// SALOME GUI includes
  #include <SUIT_Desktop.h>
  #include <SUIT_Session.h>
  #include <SUIT_ResourceMgr.h>
@@@ -56,7 -56,7 +56,7 @@@
  #include <Qtx.h>
  
  
 -// IDL incldues
 +// IDL includes
  #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
  
  // OCCT includes
@@@ -307,68 -307,68 +307,68 @@@ SMESHGUI_AddMeshElementDlg::SMESHGUI_Ad
      myNbNodes = 1;
      myElementType = SMDSAbs_0DElement;
      elemName = "ELEM0D";
 -    myHelpFileName = "adding_nodes_and_elements_page.html#adding_0delems_anchor";
 +    myHelpFileName = "adding_nodes_and_elements.html#adding-0delems-anchor";
      break;
    case SMDSEntity_Ball:
      myNbNodes = 1;
      myElementType = SMDSAbs_Ball;
      elemName = "BALL";
 -    myHelpFileName = "adding_nodes_and_elements_page.html#adding_ball_anchor";
 +    myHelpFileName = "adding_nodes_and_elements.html#adding-balls-anchor";
      break;
    case SMDSEntity_Edge:
      myNbNodes = 2;
      myElementType = SMDSAbs_Edge;
      elemName = "EDGE";
 -    myHelpFileName = "adding_nodes_and_elements_page.html#adding_edges_anchor";
 +    myHelpFileName = "adding_nodes_and_elements.html#adding-edges-anchor";
      break;
    case SMDSEntity_Triangle:
      myNbNodes = 3;
      elemName = "TRIANGLE";
      myElementType = SMDSAbs_Face;
 -    myHelpFileName = "adding_nodes_and_elements_page.html#adding_triangles_anchor";
 +    myHelpFileName = "adding_nodes_and_elements.html#adding-triangles-anchor";
      break;
    case SMDSEntity_Quadrangle:
      myNbNodes = 4;
      myElementType = SMDSAbs_Face;
      elemName = "QUADRANGLE";
 -    myHelpFileName = "adding_nodes_and_elements_page.html#adding_quadrangles_anchor";
 +    myHelpFileName = "adding_nodes_and_elements.html#adding-quadrangles-anchor";
      break;
    case SMDSEntity_Polygon:
      myNbNodes = 0;
      myElementType = SMDSAbs_Face;
      elemName = "POLYGON";
      myIsPoly = true;
 -    myHelpFileName = "adding_nodes_and_elements_page.html#adding_polygons_anchor";
 +    myHelpFileName = "adding_nodes_and_elements.html#adding-polygons-anchor";
      break;
    case SMDSEntity_Tetra:
      myNbNodes = 4;
      elemName = "TETRAS";
 -    myHelpFileName = "adding_nodes_and_elements_page.html#adding_tetrahedrons_anchor";
 +    myHelpFileName = "adding_nodes_and_elements.html#adding-tetrahedrons-anchor";
      break;
    case SMDSEntity_Pyramid:
      myNbNodes = 5;
      elemName = "PYRAMID";
 -    myHelpFileName = "adding_nodes_and_elements_page.html#adding_pyramids_anchor";
 +    myHelpFileName = "adding_nodes_and_elements.html#adding-pyramids-anchor";
      break;
    case SMDSEntity_Hexa:
      myNbNodes = 8;
      elemName = "HEXAS";
 -    myHelpFileName = "adding_nodes_and_elements_page.html#adding_hexahedrons_anchor";
 +    myHelpFileName = "adding_nodes_and_elements.html#adding-hexahedrons-anchor";
      break;
    case SMDSEntity_Penta:
      myNbNodes = 6;
      elemName = "PENTA";
 -    myHelpFileName = "adding_nodes_and_elements_page.html#adding_pentahedrons_anchor";
 +    myHelpFileName = "adding_nodes_and_elements.html#adding-pentahedrons-anchor";
      break;
    case SMDSEntity_Hexagonal_Prism:
      myNbNodes = 12;
      elemName = "OCTA";
 -    myHelpFileName = "adding_nodes_and_elements_page.html#adding_octahedrons_anchor";
 +    myHelpFileName = "adding_nodes_and_elements.html#adding-octahedrons-anchor";
      break;
    default:
      myNbNodes = 2;
      elemName = "EDGE";
 -    myHelpFileName = "adding_nodes_and_elements_page.html#adding_edges_anchor";
 +    myHelpFileName = "adding_nodes_and_elements.html#adding-edges-anchor";
    }
  
    QString iconName      = tr(QString("ICON_DLG_%1").arg(elemName).toLatin1().data());
@@@ -549,7 -549,7 +549,7 @@@ void SMESHGUI_AddMeshElementDlg::ClickO
    if( !isValid() )
      return;
  
-   if (myNbOkNodes && !mySMESHGUI->isActiveStudyLocked()) {
+   if (myNbOkNodes && !SMESHGUI::isStudyLocked()) {
      myBusy = true;
      QStringList aListId = myEditCurrentArgument->text().split(" ", QString::SkipEmptyParts);
      SMESH::long_array_var anArrayOfIndices = new SMESH::long_array;
@@@ -777,7 -777,7 +777,7 @@@ void SMESHGUI_AddMeshElementDlg::onText
  
    mySimulation->SetVisibility(false);
  
 -  // hilight entered nodes
 +  // highlight entered nodes
    SMDS_Mesh* aMesh = 0;
    if (myActor)
      aMesh = myActor->GetObject()->GetMesh();
index 8d3db666c52f99f3e5503b9462a40edacb50d0ab,0c8b92b1926e5d4352171a811a57153fe59cd393..d6fe5d426dcd5dc1d83281ee41bb11cc01ee2075
@@@ -546,67 -546,67 +546,67 @@@ void SMESHGUI_AddQuadraticElementDlg::I
    case SMDSEntity_Quad_Edge:
      aNumRows = 1;
      myNbCorners = 2;
 -    myHelpFileName = "adding_quadratic_elements_page.html#?"; //Adding_edges
 +    myHelpFileName = "adding_quadratic_elements.html#?"; //Adding_edges
      break;
    case SMDSEntity_Quad_Triangle:
      aNumRows = 3;
      myNbCorners = 3;
 -    myHelpFileName = "adding_quadratic_elements_page.html#?"; //Adding_triangles
 +    myHelpFileName = "adding_quadratic_elements.html#?"; //Adding_triangles
      break;
    case SMDSEntity_BiQuad_Triangle:
      aNumRows = 3;
      myNbCorners = 3;
      myNbCenterNodes = 1;
 -    myHelpFileName = "adding_quadratic_elements_page.html#?"; //Adding_triangles
 +    myHelpFileName = "adding_quadratic_elements.html#?"; //Adding_triangles
      break;
    case SMDSEntity_Quad_Quadrangle:
      aNumRows = 4;
      myNbCorners = 4;
 -    myHelpFileName = "adding_quadratic_elements_page.html#?"; //Adding_quadrangles
 +    myHelpFileName = "adding_quadratic_elements.html#?"; //Adding_quadrangles
      break;
    case SMDSEntity_BiQuad_Quadrangle:
      aNumRows = 4;
      myNbCorners = 4;
      myNbCenterNodes = 1;
 -    myHelpFileName = "adding_quadratic_elements_page.html#?"; //Adding_quadrangles
 +    myHelpFileName = "adding_quadratic_elements.html#?"; //Adding_quadrangles
      break;
    case SMDSEntity_Quad_Polygon:
      aNumRows = 5;
      myNbCorners = 0; // no limit
 -    myHelpFileName = "adding_quadratic_elements_page.html#?"; //Adding_polygons
 +    myHelpFileName = "adding_quadratic_elements.html#?"; //Adding_polygons
      break;
    case SMDSEntity_Quad_Tetra:
      aNumRows = 6;
      myNbCorners = 4;
 -    myHelpFileName = "adding_quadratic_elements_page.html#?"; //Adding_tetrahedrons
 +    myHelpFileName = "adding_quadratic_elements.html#?"; //Adding_tetrahedrons
      break;
    case SMDSEntity_Quad_Pyramid:
      aNumRows = 8;
      myNbCorners = 5;
 -    myHelpFileName = "adding_quadratic_elements_page.html#?"; //Adding_pyramids
 +    myHelpFileName = "adding_quadratic_elements.html#?"; //Adding_pyramids
      break;
    case SMDSEntity_Quad_Penta:
      aNumRows = 9;
      myNbCorners = 6;
 -    myHelpFileName = "adding_quadratic_elements_page.html#?"; //Adding_pentahedrons
 +    myHelpFileName = "adding_quadratic_elements.html#?"; //Adding_pentahedrons
      break;
    case SMDSEntity_BiQuad_Penta:
      aNumRows = 9;
      myNbCorners = 6;
      myNbMidFaceNodes = 3;
 -    myHelpFileName = "adding_quadratic_elements_page.html#?"; //Adding_pentahedrons
 +    myHelpFileName = "adding_quadratic_elements.html#?"; //Adding_pentahedrons
      break;
    case SMDSEntity_Quad_Hexa:
      aNumRows = 12;
      myNbCorners = 8;
 -    myHelpFileName = "adding_quadratic_elements_page.html#?"; //Adding_hexahedrons
 +    myHelpFileName = "adding_quadratic_elements.html#?"; //Adding_hexahedrons
      break;
    case SMDSEntity_TriQuad_Hexa:
      aNumRows = 12;
      myNbCorners = 8;
      myNbMidFaceNodes = 6;
      myNbCenterNodes = 1;
 -    myHelpFileName = "adding_quadratic_elements_page.html#?"; //Adding_hexahedrons
 +    myHelpFileName = "adding_quadratic_elements.html#?"; //Adding_hexahedrons
      break;
    default:;
    }
@@@ -695,7 -695,7 +695,7 @@@ bool SMESHGUI_AddQuadraticElementDlg::C
    if( !isValid() )
      return false;
  
-   if ( mySMESHGUI->isActiveStudyLocked() || myBusy || !IsValid() )
+   if ( SMESHGUI::isStudyLocked() || myBusy || !IsValid() )
      return false;
  
    BusyLocker lock( myBusy );
@@@ -977,7 -977,7 +977,7 @@@ void SMESHGUI_AddQuadraticElementDlg::o
  
    mySimulation->SetVisibility(false);
  
 -  // hilight entered nodes
 +  // highlight entered nodes
    SMDS_Mesh* aMesh = 0;
    if (myActor)
      aMesh = myActor->GetObject()->GetMesh();
index 4477dee8a45003f8b880166abf2571824cf85c16,0cd63352b9c86ce79a25a0f6561459fda6ef0c86..1791c6b3a019bcd6826094ed8f59d6dcf16ba082
@@@ -179,7 -179,7 +179,7 @@@ SMESHGUI_BuildCompoundDlg::SMESHGUI_Bui
    aTopLayout->addWidget(GroupArgs);
    aTopLayout->addWidget(GroupButtons);
  
 -  myHelpFileName = "building_compounds_page.html";
 +  myHelpFileName = "building_compounds.html";
  
    Init(); // Initialisations
  }
@@@ -250,10 -250,7 +250,7 @@@ QString SMESHGUI_BuildCompoundDlg::GetD
    QString aName = "";
  
    // collect all object names of SMESH component
-   SalomeApp_Study* appStudy =
-     dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
-   if ( !appStudy ) return aName;
-   _PTR(Study) aStudy = appStudy->studyDS();
+   _PTR(Study) aStudy = SMESH::getStudy();
  
    std::set<std::string> aSet;
    _PTR(SComponent) aMeshCompo (aStudy->FindComponent("SMESH"));
  //=================================================================================
  bool SMESHGUI_BuildCompoundDlg::ClickOnApply()
  {
-   if (mySMESHGUI->isActiveStudyLocked())
+   if (SMESHGUI::isStudyLocked())
      return false;
  
    if (!isValid())
        SMESH::UpdateView();
  
        _PTR(SObject) aSO = SMESH::FindSObject(aMesh.in());
-       if ( SMESH_Actor* anActor = SMESH::CreateActor(aSO->GetStudy(), aSO->GetID().c_str()) ) {
+       if ( SMESH_Actor* anActor = SMESH::CreateActor( aSO->GetID().c_str()) ) {
          SMESH::DisplayActor(SMESH::GetActiveWindow(), anActor);
          SMESH::UpdateView();
        }
index 57ef81746648126217e11be46eaf568696829a23,55a87509d6480b73bd28f60640a6244d00e53c2f..18aede561ad2457ed2965a9348177aa63d491b1c
@@@ -552,7 -552,7 +552,7 @@@ SMESHGUI_ClippingDlg::SMESHGUI_Clipping
  
    myIsSelectPlane = false;
  
 -  myHelpFileName = "clipping_page.html";
 +  myHelpFileName = "clipping.html";
  
    // signals and slots connections :
    connect( ComboBoxPlanes, SIGNAL( activated( int ) ), this, SLOT( onSelectPlane( int ) ) );
@@@ -1068,11 -1068,7 +1068,7 @@@ void SMESHGUI_ClippingDlg::updateActorL
  {
    ActorList->clear();
  
-   SalomeApp_Study* anAppStudy = SMESHGUI::activeStudy();
-   if( !anAppStudy )
-     return;
-   _PTR(Study) aStudy = anAppStudy->studyDS();
+   _PTR(Study) aStudy = SMESH::getStudy();
    if( !aStudy )
      return;
  
index 3ec02dc23b90447095cdd151d795cd35dd8a4dea,3c3363d6fdbb23533da667858396eb0739f8db29..e4b23363e053429e8052ec490e72aca4cd42a12d
@@@ -379,9 -379,7 +379,7 @@@ namespace SMES
      _PTR(SObject) so = SMESH::FindSObject(aMainShape);
      if ( subShapeID == 1 || !so )
        return so;
-     _PTR(ChildIterator) it;
-     if (_PTR(Study) study = SMESH::GetActiveStudyDocument())
-       it =  study->NewChildIterator(so);
+     _PTR(ChildIterator) it = SMESH::getStudy()->NewChildIterator(so);
      _PTR(SObject) subSO;
      if ( it ) {
        for ( it->InitEx(true); !subSO && it->More(); it->Next() ) {
@@@ -659,7 -657,7 +657,7 @@@ SMESHGUI_BaseComputeOp::SMESHGUI_BaseCo
    myBadMeshDisplayer = 0;
  
    //myHelpFileName = "/files/about_meshes.htm"; // V3
 -  myHelpFileName = "about_meshes_page.html"; // V4
 +  myHelpFileName = "about_meshes.html"; // V4
  }
  
  SMESH::SMESH_Mesh_ptr SMESHGUI_BaseComputeOp::getMesh()
@@@ -927,7 -925,7 +925,7 @@@ void SMESHGUI_BaseComputeOp::computeMes
  
      // NPAL16631: if ( !memoryLack )
      {
-       _PTR(SObject) sobj = SMESH::GetActiveStudyDocument()->FindObjectID(myIObject->getEntry());
+       _PTR(SObject) sobj = SMESH::getStudy()->FindObjectID(myIObject->getEntry());
        SMESH::ModifiedMesh( sobj,
                             !computeFailed && aHypErrors.isEmpty(),
                             myMesh->NbNodes() == 0);
                {
                  toDisplay = true;
                  SMESH_Actor *anActor = SMESH::FindActorByObject( aMesh );
-                 if ( !anActor ) anActor = SMESH::CreateActor( (*anIter).second->GetStudy(),
-                                                               (*anIter).second->GetID().c_str(),
+                 if ( !anActor ) anActor = SMESH::CreateActor( (*anIter).second->GetID().c_str(),
                                                                /*clearLog =*/ true );
                  if ( anActor ) // actor is not created for an empty mesh
                  {
@@@ -1267,7 -1264,6 +1264,6 @@@ void SMESHGUI_BaseComputeOp::stopOperat
  void SMESHGUI_BaseComputeOp::onPublishShape()
  {
    GEOM::GEOM_Gen_var      geomGen = SMESH::GetGEOMGen();
-   SALOMEDS::Study_var       study = SMESHGUI::GetSMESHGen()->GetCurrentStudy();
    GEOM::GEOM_Object_var meshShape = myMesh->GetShapeToMesh();
  
    QStringList entryList;
        if ( !SMESH::getSubShapeSO( 1, myMainShape )) // the main shape not published
        {
          QString name = GEOMBase::GetDefaultName( SMESH::shapeTypeName( myMainShape, "MAIN_SHAPE" ));
-         SALOMEDS::SObject_wrap so = geomGen->AddInStudy( study, myMainShape,
+         SALOMEDS::SObject_wrap so = geomGen->AddInStudy( myMainShape,
                                                           name.toLatin1().data(),
                                                           GEOM::GEOM_Object::_nil());
          // look for myMainShape in the table
          if ( curSub == 1 ) continue;
        }
        QString name = GEOMBase::GetDefaultName( SMESH::shapeTypeName( shape, "ERROR_SHAPE" ));
-       SALOMEDS::SObject_wrap so = geomGen->AddInStudy( study, shape,
+       SALOMEDS::SObject_wrap so = geomGen->AddInStudy( shape,
                                                         name.toLatin1().data(), myMainShape);
        if ( !so->_is_nil() ) {
          CORBA::String_var name  = so->GetName();
@@@ -1533,7 -1529,7 +1529,7 @@@ QTableWidget* SMESHGUI_BaseComputeOp::t
  SMESHGUI_ComputeOp::SMESHGUI_ComputeOp()
   : SMESHGUI_BaseComputeOp()
  {
 -  myHelpFileName = "constructing_meshes_page.html#compute_anchor";
 +  myHelpFileName = "constructing_meshes.html#compute-anchor";
  }
  
  
@@@ -1643,7 -1639,7 +1639,7 @@@ LightApp_Dialog* SMESHGUI_PrecomputeOp:
  
  void SMESHGUI_PrecomputeOp::startOperation()
  {
 -  myHelpFileName = "constructing_meshes_page.html#preview_anchor"; // other anchor onCompute()
 +  myHelpFileName = "constructing_meshes.html#preview-anchor"; // other anchor onCompute()
  
    if ( !myDlg )
    {
@@@ -1743,7 -1739,7 +1739,7 @@@ void SMESHGUI_PrecomputeOp::initDialog(
    QList<int> modes;
  
    QMap<int, int> modeMap;
-   _PTR(SObject)  pMesh = studyDS()->FindObjectID( myIObject->getEntry() );
+   _PTR(SObject)  pMesh = SMESH::getStudy()->FindObjectID( myIObject->getEntry() );
    getAssignedAlgos( pMesh, modeMap );
    if ( modeMap.contains( SMESH::DIM_3D ) )
    {
@@@ -1786,8 -1782,7 +1782,7 @@@ void SMESHGUI_PrecomputeOp::getAssigned
    int aPart = SMESH::Tag_RefOnAppliedAlgorithms;
    if ( theMesh->FindSubObject( aPart, aHypFolder ))
    {
-     _PTR(ChildIterator) anIter =
-       SMESH::GetActiveStudyDocument()->NewChildIterator( aHypFolder );
+     _PTR(ChildIterator) anIter = SMESH::getStudy()->NewChildIterator( aHypFolder );
      for ( ; anIter->More(); anIter->Next() )
      {
        _PTR(SObject) anObj = anIter->Value();
      if ( !theMesh->FindSubObject( aPart, aHypFolder ))
        continue;
  
-     _PTR(ChildIterator) anIter =
-       SMESH::GetActiveStudyDocument()->NewChildIterator( aHypFolder );
+     _PTR(ChildIterator) anIter = SMESH::getStudy()->NewChildIterator( aHypFolder );
      for ( anIter->InitEx(true); anIter->More(); anIter->Next() )
      {
        _PTR(SObject) anObj = anIter->Value();
@@@ -1882,7 -1876,7 +1876,7 @@@ void SMESHGUI_PrecomputeOp::onCompute(
      myOrderMgr->SetMeshOrder();
    myMapShapeId.clear();
    myActiveDlg = computeDlg();
 -  myHelpFileName = "constructing_meshes_page.html#compute_anchor";
 +  myHelpFileName = "constructing_meshes.html#compute-anchor";
    computeMesh();
  }
  
@@@ -1994,7 -1988,7 +1988,7 @@@ void SMESHGUI_PrecomputeOp::onPreview(
      {
        computeFailed = false;
        myPreviewDisplayer->SetData( previewRes );
 -      // append shape indeces with computed mesh entities
 +      // append shape indices with computed mesh entities
        for ( int i = 0, n = aShapesId->length(); i < n; i++ )
          myMapShapeId[ aShapesId[ i ] ] = 0;
      }
@@@ -2148,7 -2142,7 +2142,7 @@@ SMESHGUI_MeshOrderBox* SMESHGUI_Precomp
  SMESHGUI_EvaluateOp::SMESHGUI_EvaluateOp()
   : SMESHGUI_BaseComputeOp()
  {
 -  myHelpFileName = "constructing_meshes_page.html#evaluate_anchor";
 +  myHelpFileName = "constructing_meshes.html#evaluate-anchor";
  }
  
  
index fe0bb7d7ec5cbd3816613993ac150116d3de2377,2e25f2c5220487ab2e325a2f6f285e495929579e..4d2b01e0b12bccb85bf9d61568f71142e58aac0b
@@@ -101,7 -101,7 +101,7 @@@ void SMESHGUI_ConvToQuadOp::startOperat
    }
    connect( myDlg, SIGNAL( onClicked( int ) ), SLOT( ConnectRadioButtons( int ) ) );
  
 -  myHelpFileName = "convert_to_from_quadratic_mesh_page.html";
 +  myHelpFileName = "convert_to_from_quadratic_mesh.html";
  
    SMESHGUI_SelectionOp::startOperation();
  
@@@ -129,7 -129,7 +129,7 @@@ void SMESHGUI_ConvToQuadOp::selectionDo
    try
    {
      QString anObjEntry = myDlg->selectedObject( 0 );
-     _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() );
+     _PTR(SObject) pObj = SMESH::getStudy()->FindObjectID( anObjEntry.toLatin1().data() );
      if ( !pObj ) return;
  
      SMESH::SMESH_IDSource_var idSource = 
@@@ -204,7 -204,7 +204,7 @@@ bool SMESHGUI_ConvToQuadOp::onApply(
    QString aMess;
  
    QString anObjEntry = myDlg->selectedObject( 0 );
-   _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() );
+   _PTR(SObject) pObj = SMESH::getStudy()->FindObjectID( anObjEntry.toLatin1().data() );
    if ( !pObj )
    {
      dlg()->show();
@@@ -383,7 -383,7 +383,7 @@@ SMESHGUI_ConvToQuadOp::DestinationMesh
  void SMESHGUI_ConvToQuadOp::ConnectRadioButtons( int id )
  {
    QString anObjEntry = myDlg->selectedObject( 0 );
-   _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() );
+   _PTR(SObject) pObj = SMESH::getStudy()->FindObjectID( anObjEntry.toLatin1().data() );
    if ( !pObj ) return;
  
    SMESH::SMESH_IDSource_var idSource = 
index 2f38c9a3f825cb0f7a26e0b2f9ac3033f6088ae5,b6609fcff170f51dbd081d3852524135d9223d89..f1d45f3880c65b01a6894ebb35f9fad11443c43e
@@@ -218,7 -218,7 +218,7 @@@ SMESHGUI_CopyMeshDlg::SMESHGUI_CopyMesh
    // Selection filter
    myIdSourceFilter = new SMESH_TypeFilter( SMESH::IDSOURCE );
  
 -  myHelpFileName = "copy_mesh_page.html";
 +  myHelpFileName = "copy_mesh.html";
  
    Init();
  
@@@ -303,7 -303,7 +303,7 @@@ void SMESHGUI_CopyMeshDlg::Init (bool R
  
  bool SMESHGUI_CopyMeshDlg::ClickOnApply()
  {
-   if (mySMESHGUI->isActiveStudyLocked())
+   if (SMESHGUI::isStudyLocked())
      return false;
  
    if( !isValid() )
@@@ -452,7 -452,7 +452,7 @@@ void SMESHGUI_CopyMeshDlg::onTextChang
    buttonOk->setEnabled(false);
    buttonApply->setEnabled(false);
  
 -  // hilight entered elements
 +  // highlight entered elements
    SMDS_Mesh* aMesh = 0;
    if (myActor)
      aMesh = myActor->GetObject()->GetMesh();
index 2b9575f6db1fb484c7d3887f2b89d8fb6ae2afe9,38f64d2ad93ae9a334323a1e19e2e3a7ec0c6bde..37b0745e35e42c4f3d79240f669fc4c8ed533fb4
@@@ -302,7 -302,7 +302,7 @@@ SMESHGUI_CreatePolyhedralVolumeDlg::SME
   
    mySMESHGUI->SetActiveDialogBox( (QDialog*)this );
  
 -  myHelpFileName = "adding_nodes_and_elements_page.html#adding_polyhedrons_anchor";
 +  myHelpFileName = "adding_nodes_and_elements.html#adding-polyhedrons-anchor";
    
    Init();
  }
@@@ -448,7 -448,7 +448,7 @@@ void SMESHGUI_CreatePolyhedralVolumeDlg
    if( !isValid() )
      return;
  
-   if ( myNbOkElements>0 && !mySMESHGUI->isActiveStudyLocked())
+   if ( myNbOkElements>0 && !SMESHGUI::isStudyLocked())
      {
        if(checkEditLine(false) == -1) {return;}
        busy = true;
@@@ -717,7 -717,7 +717,7 @@@ void SMESHGUI_CreatePolyhedralVolumeDlg
          buttonOk->setEnabled( false );
          buttonApply->setEnabled( false );
        
 -        // check entered ids of faces and hilight them
 +        // check entered ids of faces and highlight them
          QStringList aListId;
          if ( aMesh ) {
            TColStd_MapOfInteger newIndices;
index 830fe1dcb4b4d4127a187e21648f85875394a902,6f589a9a0e42c5bd7568036fab40709e6c3f8bc9..e308e3043609ad9825ed85a660d4df6e3d525832
@@@ -90,7 -90,7 +90,7 @@@ SMESHGUI_DeleteGroupDlg::SMESHGUI_Delet
    aDlgLay->addWidget(aMainFrame);
    aDlgLay->addWidget(aBtnFrame);
  
 -  myHelpFileName = "deleting_groups_page.html";
 +  myHelpFileName = "deleting_groups.html";
  
    Init();
  }
@@@ -194,7 -194,7 +194,7 @@@ bool SMESHGUI_DeleteGroupDlg::isValid(
      return false;
    }
  
-   return !mySMESHGUI->isActiveStudyLocked();
+   return !SMESHGUI::isStudyLocked();
  }
  
  //=================================================================================
@@@ -315,7 -315,7 +315,7 @@@ void SMESHGUI_DeleteGroupDlg::onSelecti
  
  //=================================================================================
  // function : onDeactivate()
 -// purpose  : SLOT called when dialog must be deativated
 +// purpose  : SLOT called when dialog must be deactivated
  //=================================================================================
  void SMESHGUI_DeleteGroupDlg::onDeactivate()
  {
index 9760d8d52fca37fe4e2971807f36ca41d39b0bfc,fd673c22a2ba68d98f2ef6549fd71bf674f77987..808f6e219aa2363567b318f675fb8f79ed81500c
@@@ -220,7 -220,7 +220,7 @@@ void SMESHGUI_DisplayEntitiesDlg::onCha
  void SMESHGUI_DisplayEntitiesDlg::onHelp()
  {
    LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
 -  app->onHelpContextModule( "SMESH", "display_entity_page.html" );
 +  app->onHelpContextModule( "SMESH", "display_entity.html" );
  }
  
  /*!
@@@ -233,8 -233,7 +233,7 @@@ void SMESHGUI_DisplayEntitiesDlg::onOk(
    const char* entry = myIObject->getEntry();
    
    if ( !myActor ) {
-     myActor = SMESH::CreateActor(SMESH::GetActiveStudyDocument(), 
-                                  entry, true);
+     myActor = SMESH::CreateActor(entry, true);
    }
  
    if( myEntityMode != myActor->GetEntityMode() ) {
index 9e3c4487c6efe0aaae996dc8d874f60ebc94002b,383c936857b0565912a7c94e6420ad71fe703751..d288a5b1d5d23ee964c21cd9d593ef116058c53a
@@@ -402,7 -402,7 +402,7 @@@ void SMESHGUI_DuplicateNodesDlg::onCons
  */
  bool SMESHGUI_DuplicateNodesDlg::onApply()
  {
-   if ( mySMESHGUI->isActiveStudyLocked() || !isValid() )
+   if ( SMESHGUI::isStudyLocked() || !isValid() )
      return false;
  
    BusyLocker lock( myBusy );
@@@ -688,7 -688,7 +688,7 @@@ bool SMESHGUI_DuplicateNodesDlg::isVali
  }
  
  /*!
 -  \brief SLOT called when dialog shoud be deativated.
 +  \brief SLOT called when dialog should be deactivated.
  */
  void SMESHGUI_DuplicateNodesDlg::onDeactivate()
  {
  */
  void SMESHGUI_DuplicateNodesDlg::onGenerate()
  {
-   if ( mySMESHGUI->isActiveStudyLocked() )
+   if ( SMESHGUI::isStudyLocked() )
      return;
  
    SUIT_OverrideCursor aWaitCursor;
index 2eb89e327725ec78f9ec939ac88e3bbcdfe0ae90,417d1f803f4a813800dca173f6df50f98a9948aa..a49334d9800c2971e4ab29bd853581cfcf45fd71
@@@ -289,7 -289,7 +289,7 @@@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGU
  
    myPathMeshFilter = new SMESH_TypeFilter(SMESH::MESHorSUBMESH);
  
 -  myHelpFileName = "extrusion_along_path_page.html";
 +  myHelpFileName = "extrusion_along_path.html";
  
    Init();
  
@@@ -394,7 -394,7 +394,7 @@@ void SMESHGUI_ExtrusionAlongPathDlg::Ch
  //=================================================================================
  bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply()
  {
-   if (mySMESHGUI->isActiveStudyLocked())
+   if (SMESHGUI::isStudyLocked())
      return false;
  
    if ( !SelectorWdg->IsAnythingSelected() || myPath->_is_nil() )
index 0491cfef92d410b15b730e703e856bf80e7f283b,7a37a17158400f98af2d3fad2914c06d2a20197e..b2aa6bd4534258d9505430dede8ce4564af2727f
@@@ -337,7 -337,7 +337,7 @@@ void SMESHGUI_3TypesSelector::onTextCha
  
    myBusy = true;
  
 -  // hilight entered elements/nodes
 +  // highlight entered elements/nodes
  
    myIDSource[ iType ]->length( 0 );
  
@@@ -819,7 -819,7 +819,7 @@@ SMESHGUI_ExtrusionDlg::SMESHGUI_Extrusi
  
    mySMESHGUI->SetActiveDialogBox(this);
  
 -  myHelpFileName = "extrusion_page.html";
 +  myHelpFileName = "extrusion.html";
  
    Init();
  
@@@ -1092,7 -1092,7 +1092,7 @@@ void SMESHGUI_ExtrusionDlg::ClickOnRadi
  
  bool SMESHGUI_ExtrusionDlg::ClickOnApply()
  {
-   if (mySMESHGUI->isActiveStudyLocked())
+   if (SMESHGUI::isStudyLocked())
      return false;
  
    if (!isValid())
@@@ -1289,7 -1289,7 +1289,7 @@@ void SMESHGUI_ExtrusionDlg::ClickOnHelp
  #endif
      SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
                               tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
 -                             arg(app->resourceMgr()->stringValue("ExternalBrowser", 
 +                             arg(app->resourceMgr()->stringValue("ExternalBrowser",
                                                                   platform)).
                               arg(myHelpFileName));
    }
@@@ -1323,7 -1323,7 +1323,7 @@@ void SMESHGUI_ExtrusionDlg::SelectionIn
        return;
  
      const SMDS_MeshFace* face =
 -      dynamic_cast<const SMDS_MeshFace*>(aMesh->FindElement(aMapIndex(1)));
 +      aMesh->DownCast< SMDS_MeshFace >(aMesh->FindElement(aMapIndex(1)));
      if (!face)
        return;
  
index 4f935f03a06ad6b29a853daab8780b577951ebaa,d0f3a6512b620fd47c8dee5249af031c30cbd371..567ba381f2cf2dc599b4923ca9a405ffa1d15896
@@@ -1369,8 -1369,7 +1369,7 @@@ void SMESHGUI_FilterTable::SetCriterio
    {
      if ( strlen( theCriterion.ThresholdID ) > 0 ) // shape ID -> name
      {
-       _PTR(SObject) sobj =
-         SMESH::GetActiveStudyDocument()->FindObjectID( theCriterion.ThresholdID.in() );
+       _PTR(SObject) sobj = SMESH::getStudy()->FindObjectID( theCriterion.ThresholdID.in() );
        if ( !sobj )
          aTable->item( theRow, 2 )->setText( QString( theCriterion.ThresholdID ) );
        else
@@@ -2741,7 -2740,7 +2740,7 @@@ void SMESHGUI_FilterDlg::construct (con
  
    aDlgLay->setStretchFactor(myMainFrame, 1);
  
 -  myHelpFileName = "selection_filter_library_page.html";
 +  myHelpFileName = "selection_filter_library.html";
  
    Init(myTypes);
  }
@@@ -3073,7 -3072,7 +3072,7 @@@ void SMESHGUI_FilterDlg::onHelp(
  
  //=======================================================================
  // name    : SMESHGUI_FilterDlg::onDeactivate
 -// Purpose : SLOT called when dialog must be deativated
 +// Purpose : SLOT called when dialog must be deactivated
  //=======================================================================
  void SMESHGUI_FilterDlg::onDeactivate()
  {
@@@ -3199,8 -3198,7 +3198,7 @@@ bool SMESHGUI_FilterDlg::isValid() cons
        QString aName;
        myTable->GetThreshold(i, aName);
  
-       std::vector<_PTR(SObject)> aList =
-         SMESH::GetActiveStudyDocument()->FindObjectByName(aName.toLatin1().constData(), "GEOM");
+       std::vector<_PTR(SObject)> aList = SMESH::getStudy()->FindObjectByName(aName.toLatin1().constData(), "GEOM");
        if (aList.size() == 0) {
          SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
                                       tr("BAD_SHAPE_NAME").arg(aName));
index c36493da638c9b8ad0065ff7bb277950cb954125,a23d80aa330af5e6685a294cc48c8add33c50edd..f3c23cfb59b16c551d25e0500e6930c7f1f22297
@@@ -240,7 -240,7 +240,7 @@@ SMESHGUI_FindElemByPointOp::SMESHGUI_Fi
    mySimulation = 0;
    mySMESHGUI = 0;
    myDlg = new SMESHGUI_FindElemByPointDlg;
 -  myHelpFileName = "find_element_by_point_page.html";
 +  myHelpFileName = "find_element_by_point.html";
  
    QList<SUIT_SelectionFilter*> filters;
    filters.append( new SMESH_TypeFilter( SMESH::MESH ) );
@@@ -346,7 -346,7 +346,7 @@@ void SMESHGUI_FindElemByPointOp::onClos
  }
  //================================================================================
  /*!
 - * \brief hilight found selected elements
 + * \brief highlight found selected elements
   */
  //================================================================================
  
@@@ -495,7 -495,7 +495,7 @@@ void SMESHGUI_FindElemByPointOp::onSele
      if (aList.Extent() == 1 && aList.First()->hasEntry())
      {
        Handle(SALOME_InteractiveObject) anIO = aList.First();
-       _PTR(SObject) pObj = studyDS()->FindObjectID(anIO->getEntry());
+       _PTR(SObject) pObj = SMESH::getStudy()->FindObjectID(anIO->getEntry());
        CORBA::Object_var anObj = SMESH::IObjectToObject( anIO );
        newMeshEntry = anIO->getEntry();
        SMESH::SMESH_IDSource_var aMeshOrPart = SMESH::SMESH_IDSource::_narrow(anObj);
index 7b9f4974f9ad6f7d6a569f1c207dfe5423c7f8f9,dc1a29fa3b5c42cf4c09a45bd8222090c01842d6..9a0d91656d17eb576dc8981fbfa746044eac57d8
@@@ -192,7 -192,7 +192,7 @@@ void SMESHGUI_GroupDlg::initDialog( boo
    QPixmap image0( SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap( "SMESH", tr( "ICON_SELECT" ) ) );
  
    setWindowTitle( create ? tr( "SMESH_CREATE_GROUP_TITLE" ) : tr( "SMESH_EDIT_GROUP_TITLE" ) );
 -  myHelpFileName = create ? "creating_groups_page.html" : "editing_groups_page.html";
 +  myHelpFileName = create ? "creating_groups.html" : "editing_groups.html";
  
    setSizeGripEnabled( true);
  
@@@ -498,10 -498,7 +498,7 @@@ QString SMESHGUI_GroupDlg::GetDefaultNa
    QString aName = "";
  
    // collect all object names of SMESH component
-   SalomeApp_Study* appStudy =
-     dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
-   if ( !appStudy ) return aName;
-   _PTR(Study) aStudy = appStudy->studyDS();
+   _PTR(Study) aStudy = SMESH::getStudy();
  
    std::set<std::string> aSet;
    _PTR(SComponent) aMeshCompo (aStudy->FindComponent( "SMESH" ));
  void  SMESHGUI_GroupDlg::setDefaultName() const
  {
    QString aResName;
-   _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
    int i=1;
    QString aPrefix ="Group_";
    _PTR(SObject) anObj;
    do
    {
      aResName = aPrefix + QString::number( i++ );
-     anObj = aStudy->FindObject( SMESH::toUtf8(aResName) );
+     anObj = SMESH::getStudy()->FindObject( SMESH::toUtf8(aResName) );
    }
    while ( anObj );
    myName->setText(aResName); 
@@@ -664,7 -660,7 +660,7 @@@ void SMESHGUI_GroupDlg::init (SMESH::SM
    else if ( grpType == 1 ) // group on geom
    {
      QString aShapeName( "" );
-     _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+     _PTR(Study) aStudy = SMESH::getStudy();
      GEOM::GEOM_Object_var aGroupShape = myGroupOnGeom->GetShape();
      if (!aGroupShape->_is_nil())
      {
@@@ -915,7 -911,7 +911,7 @@@ void SMESHGUI_GroupDlg::setSelectionMod
  //=================================================================================
  bool SMESHGUI_GroupDlg::onApply()
  {
-   if (mySMESHGUI->isActiveStudyLocked())
+   if (SMESHGUI::isStudyLocked())
      return false;
  
    if (myName->text().trimmed().isEmpty())
        if (myMesh->_is_nil() || !myGeomObjects->length())
          return false;
  
-       _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+       _PTR(Study) aStudy = SMESH::getStudy();
  
        if (myGeomObjects->length() == 1) {
          myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType,
  
          // create a geometry group
          GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
-         _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
  
-         if (geomGen->_is_nil() || !aStudy)
+         if (geomGen->_is_nil())
            return false;
  
-         GEOM::GEOM_IGroupOperations_wrap op = geomGen->GetIGroupOperations(aStudy->StudyId());
+         GEOM::GEOM_IGroupOperations_wrap op = geomGen->GetIGroupOperations();
          if (op->_is_nil())
            return false;
  
            QString aNewGeomGroupName ( "Auto_group_for_" );
            aNewGeomGroupName += myName->text();
            SALOMEDS::SObject_var aNewGroupSO =
-             geomGen->AddInStudy(aSMESHGen->GetCurrentStudy(), aGroupVar,
+             geomGen->AddInStudy(aGroupVar,
                                  SMESH::toUtf8(aNewGeomGroupName), aMeshShape);
          }
  
              anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B, delta ); break;          
              break;
            }
 -          // update a visible group accoding to a changed contents
 +          // update a visible group according to a changed contents
            if ( !isConversion && anActor->GetVisibility() )
            {
              SMESH::Update( anIO, true );
@@@ -1412,13 -1407,12 +1407,12 @@@ void SMESHGUI_GroupDlg::onObjectSelecti
            continue;
  
          // Check if group constructed on the same shape as a mesh or on its child
-         _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
  
          // The main shape of the group
          GEOM::GEOM_Object_var aGroupMainShape;
          if (aGeomGroup->GetType() == 37) {
            GEOM::GEOM_IGroupOperations_wrap anOp =
-             SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
+             SMESH::GetGEOMGen()->GetIGroupOperations();
            aGroupMainShape = anOp->GetMainShape(aGeomGroup);
            // aGroupMainShape is an existing servant => GEOM_Object_var not GEOM_Object_wrap
          }
            aGroupMainShape = aGeomGroup;
            aGroupMainShape->Register();
          }
-         _PTR(SObject) aGroupMainShapeSO = aStudy->FindObjectID( entry.in() );
 +        CORBA::String_var entry = aGroupMainShape->GetStudyEntry();
 -          SMESH::getStudy()->FindObjectID(aGroupMainShape->GetStudyEntry());
+         _PTR(SObject) aGroupMainShapeSO =
++          SMESH::getStudy()->FindObjectID( entry.in() );
  
          _PTR(SObject) anObj, aRef;
          bool isRefOrSubShape = false;
  
        myGeomObjects->length(i);
        if ( i == 0 )
 -        {
 -          myIsBusy = false;
 -          return;
 -        }
 +      {
 +        myIsBusy = false;
 +        return;
 +      }
  
        aNbSel = i;
      }
@@@ -2006,9 -2000,8 +2001,8 @@@ void SMESHGUI_GroupDlg::onAdd(
      onListSelectionChanged();
  
    } else if (myCurrentLineEdit == myGeomGroupLine && myGeomObjects->length() == 1) {
-     _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
      GEOM::GEOM_IGroupOperations_wrap aGroupOp =
-       SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
+       SMESH::GetGEOMGen()->GetIGroupOperations();
  
      SMESH::ElementType aGroupType = SMESH::ALL;
      switch(aGroupOp->GetType(myGeomObjects[0])) {
  
      if (aGroupType == aType) {
        _PTR(SObject) aGroupSO =
-         //aStudy->FindObjectIOR(aStudy->ConvertObjectToIOR(myGeomGroup));
-         aStudy->FindObjectID(myGeomObjects[0]->GetStudyEntry());
+         //SMESH::getStudy()->FindObjectIOR(SMESH::getStudy()->ConvertObjectToIOR(myGeomGroup));
+         SMESH::getStudy()->FindObjectID(myGeomObjects[0]->GetStudyEntry());
        // Construct filter
        SMESH::FilterManager_var aFilterMgr = SMESH::GetFilterManager();
        SMESH::Filter_var aFilter = aFilterMgr->CreateFilter();
@@@ -2310,7 -2303,7 +2304,7 @@@ void SMESHGUI_GroupDlg::onHelp(
  
  //=================================================================================
  // function : SMESHGUI_GroupDlg::onDeactivate
 -// purpose  : SLOT called when dialog must be deativated
 +// purpose  : SLOT called when dialog must be deactivated
  //=================================================================================
  void SMESHGUI_GroupDlg::onDeactivate()
  {
@@@ -2453,9 -2446,8 +2447,8 @@@ void SMESHGUI_GroupDlg::onPublishShapeB
      GEOM::GEOM_Object_var aGeomVar = myShapeByMeshOp->GetShape();
      if ( !aGeomVar->_is_nil() )
      {
-       CORBA::String_var ID = aGeomVar->GetStudyEntry();
-       _PTR(Study)   aStudy = SMESH::GetActiveStudyDocument();
-       if ( _PTR(SObject) aGeomSO = aStudy->FindObjectID( ID.in() )) {
+       QString ID = aGeomVar->GetStudyEntry();
+       if ( _PTR(SObject) aGeomSO = SMESH::getStudy()->FindObjectID( ID.toLatin1().data() )) {
          SALOME_ListIO anIOList;
          Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject
            ( aGeomSO->GetID().c_str(), "SMESH", aGeomSO->GetName().c_str() );
index 3a4fc2c2d3f3f8f17a590952bcacca696c264f96,3c32b743eea5fa8d1accec0b353cc8044b23e2a5..263e6e368612a8478ad0a757340e4b68fa665b1c
@@@ -134,7 -134,7 +134,7 @@@ SMESHGUI_GroupOnShapeDlg::~SMESHGUI_Gro
  
  //================================================================================
  /*!
 - * \brief slot to enable/diable [Apply]
 + * \brief slot to enable/disable [Apply]
   */
  //================================================================================
  
@@@ -180,7 -180,7 +180,7 @@@ SMESHGUI_GroupOnShapeOp::SMESHGUI_Group
    : SMESHGUI_SelectionOp(ActorSelection),
      myDlg( 0 )
  {
 -  myHelpFileName = "create_groups_from_geometry_page.html";
 +  myHelpFileName = "create_groups_from_geometry.html";
  }
  
  SMESHGUI_GroupOnShapeOp::~SMESHGUI_GroupOnShapeOp()
@@@ -220,13 -220,12 +220,12 @@@ static SMESH::ElementType elementType(G
      case GEOM::COMPOUND: break;
      default:             return SMESH::ALL;
      }
-     _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
      GEOM::GEOM_IShapesOperations_wrap aShapeOp =
-       SMESH::GetGEOMGen()->GetIShapesOperations(aStudy->StudyId());
+       SMESH::GetGEOMGen()->GetIShapesOperations();
  
      if ( geom->GetType() == 37 ) { // geom group
        GEOM::GEOM_IGroupOperations_wrap aGroupOp =
-         SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
+         SMESH::GetGEOMGen()->GetIGroupOperations();
        if ( !aGroupOp->_is_nil() ) {
          // mainShape is an existing servant => GEOM_Object_var not GEOM_Object_wrap
          GEOM::GEOM_Object_var mainShape = aGroupOp->GetMainShape( geom );
@@@ -297,11 -296,11 +296,11 @@@ bool SMESHGUI_GroupOnShapeOp::onApply(
  {
    SUIT_OverrideCursor aWaitCursor;
  
-   if (isStudyLocked())
+   if (SMESHGUI::isStudyLocked())
      return false;
  
    // study
-   _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+   _PTR(Study) aStudy = SMESH::getStudy();
    if ( !aStudy ) return false;
  
    // mesh
@@@ -461,7 -460,7 +460,7 @@@ void SMESHGUI_GroupOnShapeOp::selection
    QStringList goodNames, goodIds;
    if (nbSelected > 0) {
      // study
-     if (_PTR(Study) aStudy = SMESH::GetActiveStudyDocument()) {
+     if (_PTR(Study) aStudy = SMESH::getStudy()) {
        // mesh
        if (_PTR(SObject)  meshSO = aStudy->FindObjectID( myMeshID.toLatin1().data() )) {
          // shape to mesh
      myNodeGeoIDs = goodIds;
    }
  
 -  // enable/diable Apply, which can change at selection
 +  // enable/disable Apply, which can change at selection
    myDlg->updateButtons();
  }
index 83c67e4a473b25ee34161a5088e4246034cd33aa,b4084b6655b391f4cf23e1a6d91dbff3b7e09e78..f74cd803cbf3ea1fb266c5e94e49e1683446c6ba
@@@ -482,7 -482,7 +482,7 @@@ void SMESHGUI_GroupOpDlg::setVisible( b
  }
  
  /*!
 -  \brief SLOT called when dialog must be deativated
 +  \brief SLOT called when dialog must be deactivated
  */
  void SMESHGUI_GroupOpDlg::onDeactivate()
  {
@@@ -596,7 -596,7 +596,7 @@@ SMESHGUI_UnionGroupsDlg::SMESHGUI_Union
  : SMESHGUI_GroupOpDlg( theModule )
  {
    setWindowTitle(tr("UNION_OF_GROUPS"));
 -  setHelpFileName( "using_operations_on_groups_page.html#union_anchor" );
 +  setHelpFileName( "using_operations_on_groups.html#union-anchor" );
  
    QGroupBox* anArgGrp = getArgGrp();
    myListWg = new QListWidget( anArgGrp );
@@@ -629,7 -629,7 +629,7 @@@ void SMESHGUI_UnionGroupsDlg::reset(
  */
  bool SMESHGUI_UnionGroupsDlg::onApply()
  {
-   if ( getSMESHGUI()->isActiveStudyLocked())
+   if ( SMESHGUI::isStudyLocked())
      return false;
  
    // Verify validity of group name
@@@ -705,7 -705,7 +705,7 @@@ SMESHGUI_IntersectGroupsDlg::SMESHGUI_I
  : SMESHGUI_GroupOpDlg( theModule )
  {
    setWindowTitle(tr("INTERSECTION_OF_GROUPS"));
 -  setHelpFileName( "using_operations_on_groups_page.html#intersection_anchor" );
 +  setHelpFileName( "using_operations_on_groups.html#intersection-anchor" );
  
    QGroupBox* anArgGrp = getArgGrp();
    myListWg = new QListWidget( anArgGrp );
@@@ -738,7 -738,7 +738,7 @@@ void SMESHGUI_IntersectGroupsDlg::reset
  */
  bool SMESHGUI_IntersectGroupsDlg::onApply()
  {
-   if ( getSMESHGUI()->isActiveStudyLocked())
+   if ( SMESHGUI::isStudyLocked())
      return false;
  
    // Verify validity of group name
@@@ -814,7 -814,7 +814,7 @@@ SMESHGUI_CutGroupsDlg::SMESHGUI_CutGrou
  : SMESHGUI_GroupOpDlg( theModule )
  {
    setWindowTitle(tr("CUT_OF_GROUPS"));
 -  setHelpFileName( "using_operations_on_groups_page.html#cut_anchor" );
 +  setHelpFileName( "using_operations_on_groups.html#cut-anchor" );
  
    QGroupBox* anArgGrp = getArgGrp();
  
@@@ -898,7 -898,7 +898,7 @@@ void SMESHGUI_CutGroupsDlg::reset(
  */
  bool SMESHGUI_CutGroupsDlg::onApply()
  {
-   if ( getSMESHGUI()->isActiveStudyLocked())
+   if ( SMESHGUI::isStudyLocked())
      return false;
  
    // Verify validity of group name
@@@ -996,7 -996,7 +996,7 @@@ SMESHGUI_DimGroupDlg::SMESHGUI_DimGroup
    : SMESHGUI_GroupOpDlg( theModule )
  {
    setWindowTitle( tr( "CREATE_GROUP_OF_UNDERLYING_ELEMS" ) );
 -  setHelpFileName( "group_of_underlying_elements_page.html" );
 +  setHelpFileName( "group_of_underlying_elements.html" );
  
    QGroupBox* anArgGrp = getArgGrp();
  
@@@ -1088,7 -1088,7 +1088,7 @@@ void SMESHGUI_DimGroupDlg::setElementTy
  */
  bool SMESHGUI_DimGroupDlg::onApply()
  {
-   if ( getSMESHGUI()->isActiveStudyLocked())
+   if ( SMESHGUI::isStudyLocked())
      return false;
  
    // Verify validity of group name
index f0130520042656880c67722f36340307a52e11ec,bbb79cfe37e233e780e26c3fdc47f52d0e42e886..b00ac68d7f51508f4d0718035857194e5fa91185
@@@ -213,7 -213,7 +213,7 @@@ QFrame* SMESHGUI_GenericHypothesisCreat
        case QVariant::String:
          {
            if((*anIt).isVariable) {
-             _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+             _PTR(Study) aStudy = SMESH::getStudy();
              QString aVar = (*anIt).myValue.toString();
              if(aStudy->IsInteger(aVar.toLatin1().constData())){
                SalomeApp_IntSpinBox* sb = new SalomeApp_IntSpinBox( GroupC1 );
@@@ -298,7 -298,7 +298,7 @@@ void SMESHGUI_GenericHypothesisCreator:
    {
      //remove just created hypothesis
      _PTR(SObject) aHypSObject = SMESH::FindSObject( myHypo );
-     _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+     _PTR(Study) aStudy = SMESH::getStudy();
      if( aStudy && !aStudy->GetProperties()->IsLocked() )
      {
        _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
@@@ -583,53 -583,53 +583,53 @@@ QString SMESHGUI_GenericHypothesisCreat
    QString aHypType = hypType();
    QString aHelpFileName = "";
    if ( aHypType == "LocalLength" )
 -    aHelpFileName = "a1d_meshing_hypo_page.html#average_length_anchor";
 +    aHelpFileName = "1d_meshing_hypo.html#average-length-anchor";
    else if ( aHypType == "MaxLength" )
 -    aHelpFileName = "a1d_meshing_hypo_page.html#max_length_anchor";
 +    aHelpFileName = "1d_meshing_hypo.html#max-length-anchor";
    else if ( aHypType == "Arithmetic1D")
 -    aHelpFileName = "a1d_meshing_hypo_page.html#arithmetic_1d_anchor";
 +    aHelpFileName = "1d_meshing_hypo.html#arithmetic-1d-anchor";
    else if ( aHypType == "GeometricProgression")
 -    aHelpFileName = "a1d_meshing_hypo_page.html#geometric_1d_anchor";
 +    aHelpFileName = "1d_meshing_hypo.html#geometric-1d-anchor";
    else if ( aHypType == "FixedPoints1D")
 -    aHelpFileName = "a1d_meshing_hypo_page.html#fixed_points_1d_anchor";
 +    aHelpFileName = "1d_meshing_hypo.html#fixed-points-1d-anchor";
    else if ( aHypType == "MaxElementArea")
 -    aHelpFileName = "a2d_meshing_hypo_page.html#max_element_area_anchor";
 +    aHelpFileName = "2d_meshing_hypo.html#max-element-area-anchor";
    else if ( aHypType == "MaxElementVolume")
 -    aHelpFileName = "max_element_volume_hypo_page.html";
 +    aHelpFileName = "max_element_volume_hypo.html";
    else if ( aHypType == "StartEndLength")
 -    aHelpFileName = "a1d_meshing_hypo_page.html#start_and_end_length_anchor";
 +    aHelpFileName = "1d_meshing_hypo.html#start-and-end-length-anchor";
    else if ( aHypType == "Deflection1D")
 -    aHelpFileName = "a1d_meshing_hypo_page.html#deflection_1d_anchor";
 +    aHelpFileName = "1d_meshing_hypo.html#deflection-1d-anchor";
    else if ( aHypType == "Adaptive1D")
 -    aHelpFileName = "a1d_meshing_hypo_page.html#adaptive_1d_anchor";
 +    aHelpFileName = "1d_meshing_hypo.html#adaptive-1d-anchor";
    else if ( aHypType == "AutomaticLength")
 -    aHelpFileName = "a1d_meshing_hypo_page.html#automatic_length_anchor";
 +    aHelpFileName = "1d_meshing_hypo.html#automatic-length-anchor";
    else if ( aHypType == "NumberOfSegments")
 -    aHelpFileName = "a1d_meshing_hypo_page.html#number_of_segments_anchor";
 +    aHelpFileName = "1d_meshing_hypo.html#number-of-segments-anchor";
    else if ( aHypType == "ProjectionSource1D")
 -    aHelpFileName = "projection_algos_page.html";
 +    aHelpFileName = "projection_algos.html";
    else if ( aHypType == "ProjectionSource2D")
 -    aHelpFileName = "projection_algos_page.html";
 +    aHelpFileName = "projection_algos.html";
    else if ( aHypType == "ProjectionSource3D")
 -    aHelpFileName = "projection_algos_page.html";
 +    aHelpFileName = "projection_algos.html";
    else if ( aHypType == "NumberOfLayers")
 -    aHelpFileName = "radial_prism_algo_page.html";
 +    aHelpFileName = "radial_prism_algo.html";
    else if ( aHypType == "NumberOfLayers2D")
 -    aHelpFileName = "radial_quadrangle_1D2D_algo_page.html";
 +    aHelpFileName = "radial_quadrangle_1D2D_algo.html";
    else if ( aHypType == "LayerDistribution")
 -    aHelpFileName = "radial_prism_algo_page.html";
 +    aHelpFileName = "radial_prism_algo.html";
    else if ( aHypType == "LayerDistribution2D")
 -    aHelpFileName = "radial_quadrangle_1D2D_algo_page.html";
 +    aHelpFileName = "radial_quadrangle_1D2D_algo.html";
    else if ( aHypType == "SegmentLengthAroundVertex")
 -    aHelpFileName = "segments_around_vertex_algo_page.html";
 +    aHelpFileName = "segments_around_vertex_algo.html";
    else if ( aHypType == "QuadrangleParams")
 -    aHelpFileName = "a2d_meshing_hypo_page.html#hypo_quad_params_anchor";
 +    aHelpFileName = "2d_meshing_hypo.html#hypo-quad-params-anchor";
    else if ( aHypType == "ViscousLayers")
 -    aHelpFileName = "additional_hypo_page.html#viscous_layers_anchor";
 +    aHelpFileName = "additional_hypo.html#viscous-layers-anchor";
    else if ( aHypType == "ViscousLayers2D")
 -    aHelpFileName = "additional_hypo_page.html#viscous_layers_anchor";
 +    aHelpFileName = "additional_hypo.html#viscous-layers-anchor";
    else if ( aHypType == "ImportSource1D" || aHypType == "ImportSource2D")
 -    aHelpFileName = "import_algos_page.html";
 +    aHelpFileName = "use_existing_algos.html";
    return aHelpFileName;
  }
  
index 45362c9c009c5ece3c1ef4ed550075cd83254ac3,73c54eb1ca251a616187e101b1ebc48490b97ea8..54918c0f6e92c88f6eaf7108fbf66c919916be76
@@@ -238,7 -238,7 +238,7 @@@ void SMESHGUI_Make2DFrom3DOp::startOper
    if( !myDlg )
      myDlg = new SMESHGUI_Make2DFrom3DDlg( desktop() );
  
 -  myHelpFileName = "make_2dmesh_from_3d_page.html";
 +  myHelpFileName = "make_2dmesh_from_3d.html";
  
    SMESHGUI_SelectionOp::startOperation();
  
@@@ -302,8 -302,7 +302,7 @@@ void SMESHGUI_Make2DFrom3DOp::selection
        bool isMesh = true;
        for ( int i = 0; i < ids.count() && isMesh; ++i )
        {
-         _PTR(SObject) sobj =
-           SMESHGUI::activeStudy()->studyDS()->FindObjectID( ids[i].toLatin1().constData() );
+         _PTR(SObject) sobj = SMESH::getStudy()->FindObjectID( ids[i].toLatin1().constData() );
          mySrcMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( sobj );  
          //isMesh = !mySrcMesh->_is_nil(); // EAP - it's sometimes necessary to copy to a new mesh
        }
@@@ -356,7 -355,7 +355,7 @@@ bool SMESHGUI_Make2DFrom3DOp::isValid( 
      for ( int i = 0; i < entries.count(); ++i )
      {
        SMESH::SMESH_GroupBase_var grp;
-       if ( _PTR(SObject) sobj = SMESHGUI::activeStudy()->studyDS()->FindObjectID( entries[i].toLatin1().constData() ))
+       if ( _PTR(SObject) sobj = SMESH::getStudy()->FindObjectID( entries[i].toLatin1().constData() ))
          grp = SMESH::SObjectToInterface<SMESH::SMESH_GroupBase>( sobj );
        if ( grp->_is_nil() ) {
          msg = tr( "SMESH_NOT_ONLY_GROUPS" );
    for ( int i = 0; i < entries.count(); ++i )
    {
      SMESH::SMESH_IDSource_var idSource;
-     if ( _PTR(SObject) sobj = SMESHGUI::activeStudy()->studyDS()->FindObjectID( entries[i].toLatin1().constData() ))
+     if ( _PTR(SObject) sobj = SMESH::getStudy()->FindObjectID( entries[i].toLatin1().constData() ))
        idSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( sobj );
      if ( !idSource->_is_nil() ) {
        SMESH::array_of_ElementType_var types = idSource->GetTypes();
@@@ -428,8 -427,7 +427,7 @@@ bool SMESHGUI_Make2DFrom3DOp::compute2D
        groups->length( entries.count() );
        for ( int i = 0; i < entries.count(); ++i )
        {
-         _PTR(SObject) sobj =
-           SMESHGUI::activeStudy()->studyDS()->FindObjectID( entries[i].toLatin1().constData() );
+         _PTR(SObject) sobj = SMESH::getStudy()->FindObjectID( entries[i].toLatin1().constData() );
          SMESH::SMESH_IDSource_var grp = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( sobj );  
          SMESH::array_of_ElementType_var types = grp->GetTypes();
          if ( types->length() < 1 || types[0] != goodType )
  
  bool SMESHGUI_Make2DFrom3DOp::onApply()
  {
-   if ( isStudyLocked() )
+   if ( SMESHGUI::isStudyLocked() )
      return false;
  
    QString msg;
index 23f08e3740c11d7d615fbd2ec2ffcc6008d12dff,cd5a89ff5c3de644c2369612222b06d3cde59c82..bc3fd0723d7b19cbc6834966bbcf5adcd6152315
@@@ -355,7 -355,7 +355,7 @@@ SMESHGUI_MakeNodeAtPointOp::SMESHGUI_Ma
    mySMESHGUI = 0;
    myDlg = new SMESHGUI_MakeNodeAtPointDlg;
    myFilter = 0;
 -  myHelpFileName = "mesh_through_point_page.html";
 +  myHelpFileName = "mesh_through_point.html";
  
    myNoPreview = false;
    myUpdateDestination = false;
@@@ -493,7 -493,7 +493,7 @@@ void SMESHGUI_MakeNodeAtPointOp::stopOp
  
  bool SMESHGUI_MakeNodeAtPointOp::onApply()
  {
-   if( isStudyLocked() )
+   if( SMESHGUI::isStudyLocked() )
      return false;
  
    if ( !myMeshActor ) {
index d81c2284900d0fdc5f81f56ca51e32e5792f6c93,d25b65970ef32240d3939f6cc4d85ac96475330e..6bba06313aced59eb31f9ac401b664c94b0062f1
@@@ -462,9 -462,9 +462,9 @@@ void SMESHGUI_MergeDlg::Init(
    updateControls();
    
    if ( myAction == MERGE_NODES )
 -    myHelpFileName = "merging_nodes_page.html";
 +    myHelpFileName = "merging_nodes.html";
    else
 -    myHelpFileName = "merging_elements_page.html";
 +    myHelpFileName = "merging_elements.html";
  }
  
  //=================================================================================
@@@ -511,7 -511,7 +511,7 @@@ void SMESHGUI_MergeDlg::FindGravityCent
  //=================================================================================
  bool SMESHGUI_MergeDlg::ClickOnApply()
  {
-   if (mySMESHGUI->isActiveStudyLocked() || myMesh->_is_nil())
+   if (SMESHGUI::isStudyLocked() || myMesh->_is_nil())
      return false;
  
    try {
index 49864ab329a0e249d3a129ca90c424b20f4b4d37,780ea97f8f8c044079c0689500d003a5f04367f3..f69cc76b86181ba9c644097a27dfeab2a816a983
@@@ -1121,7 -1121,7 +1121,7 @@@ SMESHGUI_ElemInfo::XYZ SMESHGUI_ElemInf
  */
  SMESHGUI_ElemInfo::XYZ SMESHGUI_ElemInfo::normal( const SMDS_MeshElement* element )
  {
 -  gp_XYZ n = SMESH::getNormale( dynamic_cast<const SMDS_MeshFace*>( element ));
 +  gp_XYZ n = SMESH::getNormale( SMDS_Mesh::DownCast<SMDS_MeshFace>( element ));
    return XYZ(n.X(), n.Y(), n.Z());
  }
  
@@@ -1397,7 -1397,7 +1397,7 @@@ void SMESHGUI_SimpleElemInfo::informati
          if ( e->GetEntityType() > SMDSEntity_0D && e->GetEntityType() < SMDSEntity_Ball ) {
            myInfo->append( QString( "<b>%1?</b> %2" ).arg( SMESHGUI_ElemInfo::tr( "QUADRATIC" )).arg( e->IsQuadratic() ? SMESHGUI_ElemInfo::tr( "YES" ) : SMESHGUI_ElemInfo::tr( "NO" )) );
          }
 -        if ( const SMDS_BallElement* ball = dynamic_cast<const SMDS_BallElement*>( e )) {
 +        if ( const SMDS_BallElement* ball = SMDS_Mesh::DownCast<SMDS_BallElement>( e )) {
            // Ball diameter
            myInfo->append( QString( "<b>%1:</b> %2" ).arg( SMESHGUI_ElemInfo::tr( "BALL_DIAMETER" )).arg( ball->GetDiameter() ));
          }
@@@ -1915,7 -1915,7 +1915,7 @@@ void SMESHGUI_TreeElemInfo::information
          case SMDSEntity_Polyhedra:
          case SMDSEntity_Quad_Polyhedra:
            gtype = SMESHGUI_ElemInfo::tr( "POLYHEDRON" ); break;
 -        default: 
 +        default:
            break;
          }
          if ( !gtype.isEmpty() ) {
            quadItem->setText( 0, SMESHGUI_ElemInfo::tr( "QUADRATIC" ));
            quadItem->setText( 1, e->IsQuadratic() ? SMESHGUI_ElemInfo::tr( "YES" ) : SMESHGUI_ElemInfo::tr( "NO" ));
          }
 -        if ( const SMDS_BallElement* ball = dynamic_cast<const SMDS_BallElement*>( e )) {
 +        if ( const SMDS_BallElement* ball = SMDS_Mesh::DownCast< SMDS_BallElement >( e )) {
            // ball diameter
            QTreeWidgetItem* diamItem = createItem( elemItem, Bold );
            diamItem->setText( 0, SMESHGUI_ElemInfo::tr( "BALL_DIAMETER" ));
            }
          }
          else {
 -          const SMDS_VtkVolume* aVtkVolume = dynamic_cast<const SMDS_VtkVolume*>(e);
 -          SMDS_ElemIteratorPtr nodeIt = aVtkVolume->uniqueNodesIterator();
 +          SMDS_NodeIteratorPtr nodeIt = e->nodeIterator();
 +          std::set< const SMDS_MeshNode* > addedNodes;
            QList<const SMDS_MeshElement*> uniqueNodes;
 -          while ( nodeIt->more() )
 -            uniqueNodes.append( nodeIt->next() );
 -
 +          while ( nodeIt->more() ) {
 +            const SMDS_MeshNode* node = nodeIt->next();
 +            if ( addedNodes.insert( node ).second )
 +              uniqueNodes.append( nodeIt->next() );
 +          }
            SMDS_VolumeTool vtool( e );
            const int nbFaces = vtool.NbFaces();
            for( int face_id = 0; face_id < nbFaces; face_id++ ) {
              faceItem->setExpanded( true );
  
              const SMDS_MeshNode** aNodeIds = vtool.GetFaceNodes( face_id );
 -            const int nbNodes = vtool.NbFaceNodes( face_id );
 +            const int              nbNodes = vtool.NbFaceNodes ( face_id );
              for( int node_id = 0; node_id < nbNodes; node_id++ ) {
                const SMDS_MeshNode* node = aNodeIds[node_id];
 -              nodeInfo( node, uniqueNodes.indexOf(node) + 1, aVtkVolume->NbUniqueNodes(), faceItem );
 +              nodeInfo( node, uniqueNodes.indexOf(node) + 1, uniqueNodes.size(), faceItem );
              }
            }
          }
          afunctor->SetMesh( actor()->GetObject()->GetMesh() );
          QTreeWidgetItem* minEdgeItem = createItem( cntrItem, Bold );
          minEdgeItem->setText( 0, tr( "MIN_ELEM_EDGE" ));
 -        minEdgeItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id )) );
 +        SMESH::Controls::TSequenceOfXYZ points;
 +        afunctor->GetPoints( e, points ); // "non-standard" way, to make it work for all elem types
 +        minEdgeItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( points )) );
  
          // gravity center
          XYZ gc = gravityCenter( e );
@@@ -2377,7 -2373,7 +2377,7 @@@ void SMESHGUI_TreeElemInfo::saveInfo( Q
  */
  
  /*!
 -  \brief Contructor
 +  \brief Constructor
  */
  GrpComputor::GrpComputor( SMESH::SMESH_GroupBase_ptr grp,
                            QTreeWidgetItem*           item,
@@@ -3118,8 -3114,8 +3118,8 @@@ void SMESHGUI_MeshInfoDlg::updateSelect
  void SMESHGUI_MeshInfoDlg::help()
  {
    SMESH::ShowHelpFile( ( myTabWidget->currentIndex() == BaseInfo || myTabWidget->currentIndex() == AddInfo ) ?
 -                       "mesh_infos_page.html#advanced_mesh_infos_anchor" : 
 -                       "mesh_infos_page.html#mesh_element_info_anchor" );
 +                       "mesh_infos.html#advanced-mesh-infos-anchor" : 
 +                       "mesh_infos.html#mesh-element-info-anchor" );
  }
  
  /*!
@@@ -3249,12 -3245,6 +3249,6 @@@ void SMESHGUI_MeshInfoDlg::showItemInfo
  
  void SMESHGUI_MeshInfoDlg::dump()
  {
-   SUIT_Application* app = SUIT_Session::session()->activeApplication();
-   if ( !app ) return;
-   SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study *>( app->activeStudy() );
-   if ( !appStudy ) return;
-   _PTR( Study ) aStudy = appStudy->studyDS();
    QStringList aFilters;
    aFilters.append( tr( "TEXT_FILES" ));
  
@@@ -4006,12 -3996,6 +4000,6 @@@ void SMESHGUI_CtrlInfoDlg::deactivate(
   */
  void SMESHGUI_CtrlInfoDlg::dump()
  {
-   SUIT_Application* app = SUIT_Session::session()->activeApplication();
-   if ( !app ) return;
-   SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study *>( app->activeStudy() );
-   if ( !appStudy ) return;
-   _PTR( Study ) aStudy = appStudy->studyDS();
    QStringList aFilters;
    aFilters.append( tr( "TEXT_FILES" ));
  
   */
  void SMESHGUI_CtrlInfoDlg::help()
  {
 -  SMESH::ShowHelpFile("mesh_infos_page.html#mesh_quality_info_anchor");
 +  SMESH::ShowHelpFile("mesh_infos.html#mesh_quality_info_anchor");
  }
index d70e1a38991d1b721c36fda8c92f882ad9049e54,f9f5ab83ab4fe362ec1f26df2d76926d30d3a309..66a205082e97472f6db20cee6d8beb5afd948147
@@@ -133,7 -133,7 +133,7 @@@ LightApp_Dialog* SMESHGUI_MeshOp::dlg(
  //================================================================================
  bool SMESHGUI_MeshOp::onApply()
  {
-   if (isStudyLocked())
+   if (SMESHGUI::isStudyLocked())
      return false;
  
    QString aMess;
@@@ -218,16 -218,16 +218,16 @@@ void SMESHGUI_MeshOp::startOperation(
      connect( myDlg, SIGNAL( geomSelectionByMesh( bool )), SLOT( onGeomSelectionByMesh( bool )));
      connect( myDlg, SIGNAL( selectMeshType( const int, const int ) ), SLOT( onAlgoSetByMeshType( const int, const int)));
      if ( myToCreate ) {
 -      if ( myIsMesh ) myHelpFileName = "constructing_meshes_page.html";
 -      else            myHelpFileName = "constructing_submeshes_page.html";
 +      if ( myIsMesh ) myHelpFileName = "constructing_meshes.html";
 +      else            myHelpFileName = "constructing_submeshes.html";
      }
      else {
 -      myHelpFileName = "editing_meshes_page.html";
 +      myHelpFileName = "editing_meshes.html";
      }
    }
    SMESHGUI_SelectionOp::startOperation();
    // iterate through dimensions and get available algorithms, set them to the dialog
-   _PTR(SComponent) aFather = SMESH::GetActiveStudyDocument()->FindComponent( "SMESH" );
+   _PTR(SComponent) aFather = SMESH::getStudy()->FindComponent( "SMESH" );
    for ( int i = SMESH::DIM_0D; i <= SMESH::DIM_3D; i++ )
    {
      SMESHGUI_MeshTab* aTab = myDlg->tab( i );
@@@ -329,7 -329,7 +329,7 @@@ bool SMESHGUI_MeshOp::isSubshapeOk() co
  
    // mesh
    QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
-   _PTR(SObject) pMesh = studyDS()->FindObjectID( aMeshEntry.toLatin1().data() );
+   _PTR(SObject) pMesh = SMESH::getStudy()->FindObjectID( aMeshEntry.toLatin1().data() );
    if (!pMesh) return false;
  
    SMESH::SMESH_Mesh_var mesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( pMesh );
  
    if (aGEOMs.count() > 0) {
      GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
-     _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
-     if (geomGen->_is_nil() || !aStudy) return false;
+     if (geomGen->_is_nil()) return false;
  
-     GEOM::GEOM_IGroupOperations_wrap op = geomGen->GetIGroupOperations(aStudy->StudyId());
+     GEOM::GEOM_IGroupOperations_wrap op = geomGen->GetIGroupOperations();
      if (op->_is_nil()) return false;
  
      // check all selected shapes
      QStringList::const_iterator aSubShapesIter = aGEOMs.begin();
      for ( ; aSubShapesIter != aGEOMs.end(); aSubShapesIter++) {
        QString aSubGeomEntry = (*aSubShapesIter);
-       _PTR(SObject) pSubGeom = studyDS()->FindObjectID(aSubGeomEntry.toLatin1().data());
+       _PTR(SObject) pSubGeom = SMESH::getStudy()->FindObjectID(aSubGeomEntry.toLatin1().data());
        if (!pSubGeom) return false;
  
        GEOM::GEOM_Object_var aSubGeomVar =
        if ( aSubGeomVar->GetShapeType() == GEOM::COMPOUND )
        {
          // is aSubGeomVar a compound of sub-shapes?
-         GEOM::GEOM_IShapesOperations_wrap sop = geomGen->GetIShapesOperations(aStudy->StudyId());
+         GEOM::GEOM_IShapesOperations_wrap sop = geomGen->GetIShapesOperations();
          if (sop->_is_nil()) return false;
          GEOM::ListOfLong_var ids = sop->GetAllSubShapesIDs( aSubGeomVar,
                                                              GEOM::SHAPE,/*sorted=*/false);
@@@ -417,7 -416,7 +416,7 @@@ char* SMESHGUI_MeshOp::isSubmeshIgnored
  
      QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
      QString aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
-     _PTR(SObject) pMesh = studyDS()->FindObjectID( aMeshEntry.toLatin1().data() );
+     _PTR(SObject) pMesh = SMESH::getStudy()->FindObjectID( aMeshEntry.toLatin1().data() );
      if ( pMesh ) {
  
        QStringList algoNames;
        }
  
  //       GEOM::GEOM_Object_var geom;
- //       if (_PTR(SObject) pGeom = studyDS()->FindObjectID( aGeomEntry.toLatin1().data() ))
+ //       if (_PTR(SObject) pGeom = SMESH::getStudy()->FindObjectID( aGeomEntry.toLatin1().data() ))
  //         geom = SMESH::SObjectToInterface<GEOM::GEOM_Object>( pGeom );
  
  //       if ( !geom->_is_nil() && geom->GetShapeType() >= GEOM::FACE ) { // WIRE, EDGE as well
@@@ -462,8 -461,8 +461,8 @@@ _PTR(SObject) SMESHGUI_MeshOp::getSubme
  {
    QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
    QString aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
-   _PTR(SObject) pMesh = studyDS()->FindObjectID( aMeshEntry.toLatin1().data() );
-   _PTR(SObject) pGeom = studyDS()->FindObjectID( aGeomEntry.toLatin1().data() );
+   _PTR(SObject) pMesh = SMESH::getStudy()->FindObjectID( aMeshEntry.toLatin1().data() );
+   _PTR(SObject) pGeom = SMESH::getStudy()->FindObjectID( aGeomEntry.toLatin1().data() );
    if ( pMesh && pGeom ) {
      GEOM::GEOM_Object_var geom = SMESH::SObjectToInterface<GEOM::GEOM_Object>( pGeom );
      if ( !geom->_is_nil() ) {
        }
        _PTR(GenericAttribute) anAttr;
        _PTR(SObject) aSubmeshRoot;
-       _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+       _PTR(Study) aStudy = SMESH::getStudy();
        if ( pMesh->FindSubObject( tag, aSubmeshRoot ) )
        {
          _PTR(ChildIterator) smIter = aStudy->NewChildIterator( aSubmeshRoot );
@@@ -523,7 -522,7 +522,7 @@@ void SMESHGUI_MeshOp::selectionDone(
  
      //Check geometry for mesh
      QString anObjEntry = myDlg->selectedObject(SMESHGUI_MeshDlg::Obj);
-     _PTR(SObject) pObj = studyDS()->FindObjectID(anObjEntry.toLatin1().data());
+     _PTR(SObject) pObj = SMESH::getStudy()->FindObjectID(anObjEntry.toLatin1().data());
      if (pObj)
      {
        SMESH::SMESH_Mesh_var aMeshVar =
          int iSubSh = 0;
          for ( ; aSubShapesIter != aGEOMs.end(); aSubShapesIter++, iSubSh++) {
            QString aSubGeomEntry = (*aSubShapesIter);
-           _PTR(SObject) pSubGeom = studyDS()->FindObjectID(aSubGeomEntry.toLatin1().data());
+           _PTR(SObject) pSubGeom = SMESH::getStudy()->FindObjectID(aSubGeomEntry.toLatin1().data());
           
            if( pSubGeom ) { 
              SALOMEDS_SObject* sobj = _CAST(SObject,pSubGeom);
        } else {
          // get geometry by selected sub-mesh
          QString anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
-         _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() );
+         _PTR(SObject) pObj = SMESH::getStudy()->FindObjectID( anObjEntry.toLatin1().data() );
          GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj );
          if (!aGeomVar->_is_nil()) {
            aSeq->length(1);
          // enable/disable popup for choice of geom selection way
          bool enable = false;
          QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
-         if ( _PTR(SObject) pMesh = studyDS()->FindObjectID( aMeshEntry.toLatin1().data() )) {
+         if ( _PTR(SObject) pMesh = SMESH::getStudy()->FindObjectID( aMeshEntry.toLatin1().data() )) {
            SMESH::SMESH_Mesh_var mesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( pMesh );
            if ( !mesh->_is_nil() ) {
              //rnv: issue 21056: EDF 1608 SMESH: Dialog Box "Create Sub Mesh": focus should automatically switch to geometry
              QString aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
-             _PTR(SObject) pGeom = studyDS()->FindObjectID( aGeomEntry.toLatin1().data() );
+             _PTR(SObject) pGeom = SMESH::getStudy()->FindObjectID( aGeomEntry.toLatin1().data() );
              if ( !pGeom || GEOM::GEOM_Object::_narrow( _CAST( SObject,pGeom )->GetObject() )->_is_nil() )
                myDlg->activateObject(SMESHGUI_MeshDlg::Geom);
              enable = ( shapeDim > 1 ) && ( mesh->NbEdges() > 0 );
@@@ -774,7 -773,7 +773,7 @@@ bool SMESHGUI_MeshOp::isValid( QString
    {
      QString aMeshEntry = myDlg->selectedObject
        ( myToCreate ? SMESHGUI_MeshDlg::Mesh : SMESHGUI_MeshDlg::Obj );
-     if ( _PTR(SObject) pMesh = studyDS()->FindObjectID( aMeshEntry.toLatin1().data() )) {
+     if ( _PTR(SObject) pMesh = SMESH::getStudy()->FindObjectID( aMeshEntry.toLatin1().data() )) {
        SMESH::SMESH_Mesh_var mesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( pMesh );
        if ( !mesh->_is_nil() && CORBA::is_nil( mesh->GetShapeToMesh() )) {
          theMess = tr( "IMPORTED_MESH" );
        }
        return true;
      }
-     _PTR(SObject) pGeom = studyDS()->FindObjectID( aGeomEntry.toLatin1().data() );
+     _PTR(SObject) pGeom = SMESH::getStudy()->FindObjectID( aGeomEntry.toLatin1().data() );
      if ( !pGeom || GEOM::GEOM_Object::_narrow( _CAST( SObject,pGeom )->GetObject() )->_is_nil() )
      {
        theMess = tr( "GEOMETRY_OBJECT_IS_NULL" );
          theMess = tr( "MESH_IS_NOT_DEFINED" );
          return false;
        }
-       _PTR(SObject) pMesh = studyDS()->FindObjectID( aMeshEntry.toLatin1().data() );
+       _PTR(SObject) pMesh = SMESH::getStudy()->FindObjectID( aMeshEntry.toLatin1().data() );
        if ( !pMesh || SMESH::SMESH_Mesh::_narrow( _CAST( SObject,pMesh )->GetObject() )->_is_nil() )
        {
          theMess = tr( "MESH_IS_NULL" );
@@@ -946,7 -945,7 +945,7 @@@ void SMESHGUI_MeshOp::availableHyps( co
    QString aCurrentGeomToSelect;
    if ( !theMeshType.isEmpty() ) {
      aCurrentGeomToSelect = myDlg->selectedObject( myToCreate ? SMESHGUI_MeshDlg::Geom : SMESHGUI_MeshDlg::Obj );
-     if ( _PTR(SObject) so = studyDS()->FindObjectID( aCurrentGeomToSelect.toLatin1().data() )) {
+     if ( _PTR(SObject) so = SMESH::getStudy()->FindObjectID( aCurrentGeomToSelect.toLatin1().data() )) {
        aGeomVar = SMESH::GetGeom( so );
      }
     if ( aCurrentGeomToSelect != myLastGeomToSelect )
@@@ -1050,8 -1049,7 +1049,7 @@@ void SMESHGUI_MeshOp::existingHyps( con
  
    if ( theFather->FindSubObject( aPart, aHypRoot ) )
    {
-     _PTR(ChildIterator) anIter =
-       SMESH::GetActiveStudyDocument()->NewChildIterator( aHypRoot );
+     _PTR(ChildIterator) anIter = SMESH::getStudy()->NewChildIterator( aHypRoot );
      for ( ; anIter->More(); anIter->Next() )
      {
        _PTR(SObject) anObj = anIter->Value();
@@@ -1122,14 -1120,14 +1120,14 @@@ SMESHGUI_MeshOp::getInitParamsHypothesi
    {
      anEntry = myDlg->selectedObject
        ( myToCreate ? SMESHGUI_MeshDlg::Mesh : SMESHGUI_MeshDlg::Obj );
-     if ( _PTR(SObject) pObj = studyDS()->FindObjectID( anEntry.toLatin1().data() ))
+     if ( _PTR(SObject) pObj = SMESH::getStudy()->FindObjectID( anEntry.toLatin1().data() ))
      {
        CORBA::Object_ptr Obj = _CAST( SObject,pObj )->GetObject();
        if ( myToCreate ) // mesh and geom may be selected
        {
          aMeshVar = SMESH::SMESH_Mesh::_narrow( Obj );
          anEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
-         if ( _PTR(SObject) pGeom = studyDS()->FindObjectID( anEntry.toLatin1().data() ))
+         if ( _PTR(SObject) pGeom = SMESH::getStudy()->FindObjectID( anEntry.toLatin1().data() ))
            aGeomVar= GEOM::GEOM_Object::_narrow( _CAST( SObject,pGeom )->GetObject() );
        }
        else // edition: sub-mesh may be selected
      if ( !myToCreate ) // mesh to edit can be selected
      {
        anEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
-       if ( _PTR(SObject) pMesh = studyDS()->FindObjectID( anEntry.toLatin1().data() ))
+       if ( _PTR(SObject) pMesh = SMESH::getStudy()->FindObjectID( anEntry.toLatin1().data() ))
        {
          aMeshVar = SMESH::SMESH_Mesh::_narrow( _CAST( SObject,pMesh )->GetObject() );
          if ( !aMeshVar->_is_nil() )
      }
      if ( aGeomVar->_is_nil() ) {
        anEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
-       if ( _PTR(SObject) pGeom = studyDS()->FindObjectID( anEntry.toLatin1().data() ))
+       if ( _PTR(SObject) pGeom = SMESH::getStudy()->FindObjectID( anEntry.toLatin1().data() ))
        {
          aGeomVar= GEOM::GEOM_Object::_narrow( _CAST( SObject,pGeom )->GetObject() );
        }
@@@ -1199,13 -1197,13 +1197,13 @@@ void SMESHGUI_MeshOp::initHypCreator( S
      aMeshEntry = aGeomEntry;
  
    if ( aMeshEntry != aGeomEntry ) { // Get Geom object from Mesh of a sub-mesh being edited
-     _PTR(SObject) pObj = studyDS()->FindObjectID( aMeshEntry.toLatin1().data() );
+     _PTR(SObject) pObj = SMESH::getStudy()->FindObjectID( aMeshEntry.toLatin1().data() );
      GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj );
      aMeshEntry = ( aGeomVar->_is_nil() ) ? QString() : SMESH::toQStr( aGeomVar->GetStudyEntry() );
    }
  
    if ( aMeshEntry == "" && aGeomEntry == "" ) { // get geom of an object being edited
-     _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() );
+     _PTR(SObject) pObj = SMESH::getStudy()->FindObjectID( anObjEntry.toLatin1().data() );
      bool isMesh;
      GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj, &isMesh );
      if ( !aGeomVar->_is_nil() )
  
    if ( anObjEntry != "" && aGeomEntry != "" && aMeshEntry == "" ) {
      // take geometry from submesh being created
-     _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() );
+     _PTR(SObject) pObj = SMESH::getStudy()->FindObjectID( anObjEntry.toLatin1().data() );
      if ( pObj ) {
        // if current object is sub-mesh
        SMESH::SMESH_subMesh_var aSubMeshVar =
@@@ -1396,7 -1394,7 +1394,7 @@@ void SMESHGUI_MeshOp::onHypoCreated( in
      myDlg->setEnabled( true );
    }
  
-   _PTR(SComponent) aFather = SMESH::GetActiveStudyDocument()->FindComponent("SMESH");
+   _PTR(SComponent) aFather = SMESH::getStudy()->FindComponent("SMESH");
  
    int nbHyp = myExistingHyps[myDim][myType].count();
    HypothesisData* algoData = hypData( myDim, Algo, currentHyp( myDim, Algo ));
@@@ -1610,7 -1608,7 +1608,7 @@@ void SMESHGUI_MeshOp::onAlgoSelected( c
  
    // set hypotheses corresponding to the found algorithms
  
-   _PTR(SObject) pObj = SMESH::GetActiveStudyDocument()->FindComponent("SMESH");
+   _PTR(SObject) pObj = SMESH::getStudy()->FindComponent("SMESH");
  
    for ( int dim = SMESH::DIM_0D; dim <= SMESH::DIM_3D; dim++ )
    {
@@@ -1829,7 -1827,7 +1827,7 @@@ bool SMESHGUI_MeshOp::createMesh( QStri
    for ( int i = 0; it!=aList.end(); it++, ++i )
    {
      QString aGeomEntry = *it;
-     _PTR(SObject) pGeom = studyDS()->FindObjectID( aGeomEntry.toLatin1().data() );
+     _PTR(SObject) pGeom = SMESH::getStudy()->FindObjectID( aGeomEntry.toLatin1().data() );
      GEOM::GEOM_Object_var aGeomVar =
        GEOM::GEOM_Object::_narrow( _CAST( SObject,pGeom )->GetObject() );
  
@@@ -1896,7 -1894,7 +1894,7 @@@ bool SMESHGUI_MeshOp::createSubMesh( QS
  
    // get mesh object
    QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
-   _PTR(SObject) pMesh = studyDS()->FindObjectID( aMeshEntry.toLatin1().data() );
+   _PTR(SObject) pMesh = SMESH::getStudy()->FindObjectID( aMeshEntry.toLatin1().data() );
    SMESH::SMESH_Mesh_var aMeshVar =
      SMESH::SMESH_Mesh::_narrow( _CAST( SObject,pMesh )->GetObject() );
    if (aMeshVar->_is_nil())
    {
      //QString aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
      QString aGeomEntry = aGEOMs.first();
-     _PTR(SObject) pGeom = studyDS()->FindObjectID( aGeomEntry.toLatin1().data() );
+     _PTR(SObject) pGeom = SMESH::getStudy()->FindObjectID( aGeomEntry.toLatin1().data() );
      aGeomVar = GEOM::GEOM_Object::_narrow( _CAST( SObject,pGeom )->GetObject() );
    }
    else if (aGEOMs.count() > 1)
    {
      // create a GEOM group
      GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
-     _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
-     if (!geomGen->_is_nil() && aStudy) {
+     if (!geomGen->_is_nil()) {
        GEOM::GEOM_IGroupOperations_wrap op =
-         geomGen->GetIGroupOperations(aStudy->StudyId());
+         geomGen->GetIGroupOperations();
        if (!op->_is_nil()) {
          // check and add all selected GEOM objects: they must be
          // a sub-shapes of the main GEOM and must be of one type
          QStringList::const_iterator aSubShapesIter = aGEOMs.begin();
          for ( ; aSubShapesIter != aGEOMs.end(); aSubShapesIter++, iSubSh++) {
            QString aSubGeomEntry = (*aSubShapesIter);
-           _PTR(SObject) pSubGeom = studyDS()->FindObjectID(aSubGeomEntry.toLatin1().data());
+           _PTR(SObject) pSubGeom = SMESH::getStudy()->FindObjectID(aSubGeomEntry.toLatin1().data());
            GEOM::GEOM_Object_var aSubGeomVar =
              GEOM::GEOM_Object::_narrow(_CAST(SObject,pSubGeom)->GetObject());
            TopAbs_ShapeEnum aSubShapeType = (TopAbs_ShapeEnum)aSubGeomVar->GetShapeType();
            // publish the GEOM group in study
            QString aNewGeomGroupName ("Auto_group_for_");
            aNewGeomGroupName += aName;
-           SALOMEDS::Study_var aStudyVar = _CAST(Study, aStudy)->GetStudy();
            SALOMEDS::SObject_wrap aNewGroupSO =
-             geomGen->AddInStudy( aStudyVar, aGeomVar,
+             geomGen->AddInStudy( aGeomVar,
                                   aNewGeomGroupName.toLatin1().data(), mainGeom);
          }
        }
@@@ -2117,7 -2113,7 +2113,7 @@@ void SMESHGUI_MeshOp::setDefaultName( c
  {
    QString aResName;
  
-   _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+   _PTR(Study) aStudy = SMESH::getStudy();
    int i = 1;
  
    QString aPrefix = thePrefix;
@@@ -2158,7 -2154,7 +2154,7 @@@ SMESH::SMESH_Hypothesis_var SMESHGUI_Me
    QString aHypName = dataList[ aHypIndex ]->TypeName;
  
    // get existing algorithms
-   _PTR(SObject) pObj = SMESH::GetActiveStudyDocument()->FindComponent("SMESH");
+   _PTR(SObject) pObj = SMESH::getStudy()->FindComponent("SMESH");
    QStringList tmp;
    existingHyps( theDim, Algo, pObj, tmp, myExistingHyps[ theDim ][ Algo ]);
  
          delete aCreator;
        }
        QStringList tmpList;
-       _PTR(SComponent) aFather = SMESH::GetActiveStudyDocument()->FindComponent( "SMESH" );
+       _PTR(SComponent) aFather = SMESH::getStudy()->FindComponent( "SMESH" );
        existingHyps( theDim, Algo, aFather, tmpList, myExistingHyps[ theDim ][ Algo ] );
      }
  
  void SMESHGUI_MeshOp::readMesh()
  {
    QString anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
-   _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() );
+   _PTR(SObject) pObj = SMESH::getStudy()->FindObjectID( anObjEntry.toLatin1().data() );
    if ( !pObj )
      return;
  
@@@ -2399,7 -2395,7 +2395,7 @@@ bool SMESHGUI_MeshOp::editMeshOrSubMesh
      return false;
  
    QString anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
-   _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() );
+   _PTR(SObject) pObj = SMESH::getStudy()->FindObjectID( anObjEntry.toLatin1().data() );
    if ( !pObj )
      return false;
  
@@@ -2582,7 -2578,7 +2578,7 @@@ void SMESHGUI_MeshOp::onGeomSelectionBy
      }
      // set mesh object to SMESHGUI_ShapeByMeshOp and start it
      QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
-     if ( _PTR(SObject) pMesh = studyDS()->FindObjectID( aMeshEntry.toLatin1().data() )) {
+     if ( _PTR(SObject) pMesh = SMESH::getStudy()->FindObjectID( aMeshEntry.toLatin1().data() )) {
        SMESH::SMESH_Mesh_var aMeshVar =
          SMESH::SMESH_Mesh::_narrow( _CAST( SObject,pMesh )->GetObject() );
        if ( !aMeshVar->_is_nil() ) {
@@@ -2611,7 -2607,7 +2607,7 @@@ void SMESHGUI_MeshOp::onPublishShapeByM
      if ( !aGeomVar->_is_nil() )
      {
        QString ID = SMESH::toQStr( aGeomVar->GetStudyEntry() );
-       if ( _PTR(SObject) aGeomSO = studyDS()->FindObjectID( ID.toLatin1().data() )) {
+       if ( _PTR(SObject) aGeomSO = SMESH::getStudy()->FindObjectID( ID.toLatin1().data() )) {
          selectObject( aGeomSO );
          selectionDone();
        }
index 34aaa5b00bfed5a04ce2f5dcba922ba42278575c,cab1695a5f155c89bccdd0734724236020e5582e..2b4d02c9271c73189e3045467da7949b026999b9
@@@ -52,7 -52,7 +52,7 @@@ SMESHGUI_MeshOrderOp::SMESHGUI_MeshOrde
  {
    myDlg = new SMESHGUI_MeshOrderDlg( desktop() );
    
 -  myHelpFileName = "constructing_meshes_page.html#mesh_order_anchor";
 +  myHelpFileName = "constructing_meshes.html#mesh-order-anchor";
  }
  
  //================================================================================
@@@ -120,7 -120,7 +120,7 @@@ void SMESHGUI_MeshOrderOp::initDialog(
    if ( !myMgr->GetMeshOrder() ) {
      SUIT_MessageBox::information(desktop(),
                               tr("SMESH_INFORMATION"),
 -                             tr("SMESH_NO_CONCURENT_MESH"));
 +                             tr("SMESH_NO_CONCURRENT_MESH"));
      
      onCancel();
      return;
@@@ -199,7 -199,7 +199,7 @@@ void SMESHGUI_MeshOrderMgr::SetMesh(SME
  
  //================================================================================
  /*!
 - * \brief Check for concurents between submesh objects
 + * \brief Check for concurrents between submesh objects
   */
  //================================================================================
  
@@@ -211,7 -211,7 +211,7 @@@ bool SMESHGUI_MeshOrderMgr::GetMeshOrde
  
  //================================================================================
  /*!
 - * \brief Check for concurents between submesh objects
 + * \brief Check for concurrents between submesh objects
   */
  //================================================================================
  
@@@ -280,7 -280,7 +280,7 @@@ bool SMESHGUI_MeshOrderMgr::SetMeshOrde
    if (theListListIds.isEmpty() || myMesh->_is_nil())
      return false;
  
-   _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+   _PTR(Study) aStudy = SMESH::getStudy();
    _PTR(SObject) aMeshSObj = SMESH::FindSObject(myMesh);
    if ( !aStudy || !aMeshSObj )
      return false;
      }
    }
  
 -  // is it enought to set modifid attribute on root mesh objects only?
 -  //  it is seems that modifaction flag will be set on child submeshes 
 +  // is it enough to set modified attribute on root mesh objects only?
 +  //  it is seems that modifcation flag will be set on child submeshes 
    //  automatically  (see SMESH::ModifiedMesh for details)
    SMESH::ModifiedMesh( aMeshSObj, false, false );
  
index 2ff82955f21c08879022ade7695a2847d77c9ac4,8b0bd227c3e17d9b62df382b7feb1a28691f5deb..fb9c60a25cf182100bc4622bbd5072640fbe7f6f
@@@ -129,7 -129,7 +129,7 @@@ SMESHGUI_MeshPatternDlg::SMESHGUI_MeshP
  
    mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
  
 -  myHelpFileName = "pattern_mapping_page.html";
 +  myHelpFileName = "pattern_mapping.html";
  
    Init();
  }
@@@ -504,7 -504,7 +504,7 @@@ bool SMESHGUI_MeshPatternDlg::onApply(
          _PTR(SObject) aSO = SMESH::FindSObject(myMesh.in());
          SMESH_Actor* anActor = SMESH::FindActorByEntry(aSO->GetID().c_str());
          if (!anActor) {
-           anActor = SMESH::CreateActor(aSO->GetStudy(), aSO->GetID().c_str());
+           anActor = SMESH::CreateActor(aSO->GetID().c_str());
            if (anActor) {
              SMESH::DisplayActor(SMESH::GetActiveWindow(), anActor);
              SMESH::FitAll();
@@@ -723,7 -723,7 +723,7 @@@ void SMESHGUI_MeshPatternDlg::resetSelI
  
  //=======================================================================
  // name    : SMESHGUI_MeshPatternDlg::onDeactivate
 -// Purpose : SLOT called when dialog must be deativated
 +// Purpose : SLOT called when dialog must be deactivated
  //=======================================================================
  void SMESHGUI_MeshPatternDlg::onDeactivate()
  {
@@@ -1400,7 -1400,7 +1400,7 @@@ void SMESHGUI_MeshPatternDlg::onTextCha
      activateSelection();
    }
  
 -  // hilight entered elements/nodes
 +  // highlight entered elements/nodes
    SMDS_Mesh* aMesh = 0;
    SMESH_Actor* anActor = SMESH::FindActorByObject(myMesh);
    if (anActor)
index 2899a0348586a9f7ccff37dddb1f7145164aa87e,2c0ae0edabc67f19ed5b0d01a0f46d75bb4e1355..09a7c6055a2087915a89b3660f91e6f03d133b5e
@@@ -600,7 -600,7 +600,7 @@@ void SMESHGUI_MultiEditDlg::onSelection
  
  //=======================================================================
  // name    : SMESHGUI_MultiEditDlg::onDeactivate
 -// Purpose : SLOT called when dialog must be deativated
 +// Purpose : SLOT called when dialog must be deactivated
  //=======================================================================
  void SMESHGUI_MultiEditDlg::onDeactivate()
  {
@@@ -883,7 -883,7 +883,7 @@@ void SMESHGUI_MultiEditDlg::onListSelec
      if (myListBox->item(i)->isSelected())
      {
        int anId = myListBox->item(i)->text().toInt();
 -      if (anObj->GetElemVTKId(anId) >= 0) // avoid exception in hilight
 +      if (anObj->GetElemVTKId(anId) >= 0) // avoid exception in highlight
          anIndexes.Add(anId);
      }
    }
@@@ -995,7 -995,7 +995,7 @@@ void SMESHGUI_MultiEditDlg::setSelectio
  //=======================================================================
  bool SMESHGUI_MultiEditDlg::onApply()
  {
-   if (mySMESHGUI->isActiveStudyLocked())
+   if (SMESHGUI::isStudyLocked())
      return false;
    if (!isValid(true))
      return false;
@@@ -1093,7 -1093,7 +1093,7 @@@ SMESHGUI_ChangeOrientationDl
    SMESHGUI_MultiEditDlg(theModule, SMESH::FaceFilter, true)
  {
    setWindowTitle(tr("CAPTION"));
 -  myHelpFileName = "changing_orientation_of_elements_page.html";
 +  myHelpFileName = "changing_orientation_of_elements.html";
  }
  
  SMESHGUI_ChangeOrientationDlg::~SMESHGUI_ChangeOrientationDlg()
@@@ -1161,7 -1161,7 +1161,7 @@@ SMESHGUI_UnionOfTrianglesDl
    myPreviewCheckBox->setChecked(false);
    onDisplaySimulation(false);
  
 -  myHelpFileName = "uniting_set_of_triangles_page.html";
 +  myHelpFileName = "uniting_set_of_triangles.html";
  }
  
  SMESHGUI_UnionOfTrianglesDlg::~SMESHGUI_UnionOfTrianglesDlg()
@@@ -1289,7 -1289,7 +1289,7 @@@ SMESHGUI_CuttingOfQuadsDl
    connect(myComboBoxFunctor, SIGNAL(activated(int)),       this, SLOT(onPreviewChk()));
    connect(this,              SIGNAL(ListContensChanged()), this, SLOT(onPreviewChk()));
  
 -  myHelpFileName = "cutting_quadrangles_page.html";
 +  myHelpFileName = "cutting_quadrangles.html";
  }
  
  SMESHGUI_CuttingOfQuadsDlg::~SMESHGUI_CuttingOfQuadsDlg()
@@@ -1551,7 -1551,7 +1551,7 @@@ SMESHGUI_SplitVolumesDlg::SMESHGUI_Spli
    : SMESHGUI_MultiEditDlg(theModule, SMESH::VolumeFilter, /*the3d2d=*/true, /*doInit=*/false)
  {
    setWindowTitle(tr("CAPTION"));
 -  myHelpFileName = "split_to_tetra_page.html";
 +  myHelpFileName = "split_to_tetra.html";
    myEntityType = 1;
    myCellSize = -1.;
  
        gb->setTitle( tr("TARGET_ELEM_TYPE"));
    }
  
 -  myToAllChk->setChecked( true ); //aplly to the whole mesh by default
 +  myToAllChk->setChecked( true ); //apply to the whole mesh by default
  
    bool hasHexa = true;//myMesh->_is_nil() ? false : myMesh->NbHexas();
    if ( hasHexa )
index 9eec99fbf5ab7d3231aec01b0c42017aeb013a37,5f2f2d9219df22fafb0819ace97a245f5cbe1ff5..3a2d3308cf06fa7f83de4d86bf823f68627e7dab
@@@ -102,9 -102,7 +102,7 @@@ namespace SMES
        SMESH::SMESH_MeshEditor_var aMeshEditor = theMesh->GetMeshEditor();
        theMesh->SetParameters( theParameters.join(":").toLatin1().constData() );
        aNodeId = aMeshEditor->AddNode( x, y, z );
-       _PTR(Study) aStudy = GetActiveStudyDocument();
-       CORBA::Long anId = aStudy->StudyId();
-       if (TVisualObjPtr aVisualObj = SMESH::GetVisualObj( anId, aSobj->GetID().c_str() ) ) {
+       if (TVisualObjPtr aVisualObj = SMESH::GetVisualObj( aSobj->GetID().c_str() ) ) {
          aVisualObj->Update( true );
        }
      } 
@@@ -331,7 -329,7 +329,7 @@@ SMESHGUI_NodesDlg::SMESHGUI_NodesDlg( S
    SMESHGUI_NodesDlgLayout->addWidget( GroupGroups );
    SMESHGUI_NodesDlgLayout->addWidget( GroupButtons );
  
 -  myHelpFileName = "adding_nodes_and_elements_page.html#adding_nodes_anchor";
 +  myHelpFileName = "adding_nodes_and_elements.html#adding-nodes-anchor";
  
    /* Initialisation and display */
    Init();
@@@ -423,7 -421,7 +421,7 @@@ void SMESHGUI_NodesDlg::ClickOnOk(
  //=================================================================================
  bool SMESHGUI_NodesDlg::ClickOnApply()
  {
-   if ( mySMESHGUI->isActiveStudyLocked() )
+   if ( SMESHGUI::isStudyLocked() )
      return false;
  
    if ( myMesh->_is_nil() ) {
index b7ded794cb7fdfb5993b85c195010a4b476c701d,0000000000000000000000000000000000000000..111a8410f431a6572a11d3179ad90e8e5a312235
mode 100644,000000..100644
--- /dev/null
@@@ -1,937 -1,0 +1,937 @@@
-   if (mySMESHGUI->isActiveStudyLocked())
 +// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
 +//
 +// This library is free software; you can redistribute it and/or
 +// modify it under the terms of the GNU Lesser General Public
 +// License as published by the Free Software Foundation; either
 +// version 2.1 of the License, or (at your option) any later version.
 +//
 +// This library is distributed in the hope that it will be useful,
 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 +// Lesser General Public License for more details.
 +//
 +// You should have received a copy of the GNU Lesser General Public
 +// License along with this library; if not, write to the Free Software
 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 +//
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 +//
 +//  File   : SMESHGUI_OffsetDlg.cxx
 +
 +//  SMESH includes
 +
 +#include "SMESHGUI_OffsetDlg.h"
 +
 +#include "SMESHGUI.h"
 +#include "SMESHGUI_SpinBox.h"
 +#include "SMESHGUI_Utils.h"
 +#include "SMESHGUI_VTKUtils.h"
 +#include "SMESHGUI_MeshUtils.h"
 +#include "SMESHGUI_IdValidator.h"
 +#include "SMESHGUI_FilterDlg.h"
 +#include "SMESHGUI_MeshEditPreview.h"
 +
 +#include <SMESH_Actor.h>
 +#include <SMESH_TypeFilter.hxx>
 +#include <SMESH_LogicalFilter.hxx>
 +#include <SMDS_Mesh.hxx>
 +
 +// SALOME GUI includes
 +#include <LightApp_Application.h>
 +#include <LightApp_SelectionMgr.h>
 +#include <SALOME_ListIO.hxx>
 +#include <SUIT_Desktop.h>
 +#include <SUIT_MessageBox.h>
 +#include <SUIT_OverrideCursor.h>
 +#include <SUIT_ResourceMgr.h>
 +#include <SUIT_Session.h>
 +#include <SVTK_ViewModel.h>
 +#include <SVTK_ViewWindow.h>
 +#include <SalomeApp_Tools.h>
 +
 +// SALOME KERNEL includes
 +#include <SALOMEDSClient.hxx>
 +#include <SALOMEDSClient_SObject.hxx>
 +
 +// OCCT includes
 +#include <TColStd_MapOfInteger.hxx>
 +
 +// Qt includes
 +#include <QApplication>
 +#include <QButtonGroup>
 +#include <QGroupBox>
 +#include <QLabel>
 +#include <QLineEdit>
 +#include <QPushButton>
 +#include <QRadioButton>
 +#include <QCheckBox>
 +#include <QHBoxLayout>
 +#include <QVBoxLayout>
 +#include <QGridLayout>
 +#include <QSpinBox>
 +#include <QKeyEvent>
 +
 +// IDL includes
 +#include <SALOMEconfig.h>
 +#include CORBA_SERVER_HEADER(SMESH_Group)
 +#include CORBA_SERVER_HEADER(SMESH_MeshEditor)
 +
 +enum { MOVE_ELEMS_BUTTON = 0, COPY_ELEMS_BUTTON, MAKE_MESH_BUTTON }; //!< action type
 +
 +/*!
 +  \class BusyLocker
 +  \brief Simple 'busy state' flag locker.
 +  \internal
 +*/
 +class BusyLocker
 +{
 +public:
 +  //! Constructor. Sets passed boolean flag to \c true.
 +  BusyLocker( bool& busy ) : myBusy( busy ) { myBusy = true; }
 +  //! Destructor. Clear external boolean flag passed as parameter to the constructor to \c false.
 +  ~BusyLocker() { myBusy = false; }
 +private:
 +  bool& myBusy; //! External 'busy state' boolean flag
 +};
 +
 +#define SPACING 6
 +#define MARGIN  11
 +
 +//=================================================================================
 +// class    : SMESHGUI_OffsetDlg()
 +// purpose  :
 +//=================================================================================
 +SMESHGUI_OffsetDlg::SMESHGUI_OffsetDlg( SMESHGUI* theModule ) :
 +  SMESHGUI_MultiPreviewDlg( theModule ),
 +  mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
 +  myFilterDlg(0)
 +{
 +  QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_MESH_OFFSET")));
 +  QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
 +
 +  setModal(false);
 +  setAttribute(Qt::WA_DeleteOnClose, true);
 +  setWindowTitle(tr("SMESH_OFFSET_TITLE"));
 +  setSizeGripEnabled(true);
 +
 +  QVBoxLayout* dlgLayout = new QVBoxLayout(this);
 +  dlgLayout->setSpacing(SPACING);
 +  dlgLayout->setMargin(MARGIN);
 +
 +  /***************************************************************/
 +  ConstructorsBox = new QGroupBox(tr("SMESH_OFFSET"), this);
 +  QHBoxLayout* ConstructorsBoxLayout = new QHBoxLayout(ConstructorsBox);
 +  ConstructorsBoxLayout->setSpacing(SPACING);
 +  ConstructorsBoxLayout->setMargin(MARGIN);
 +
 +  QRadioButton* RadioButton1= new QRadioButton(ConstructorsBox);
 +  RadioButton1->setIcon(image0);
 +
 +  ConstructorsBoxLayout->addWidget(RadioButton1);
 +
 +  /***************************************************************/
 +  GroupArguments = new QGroupBox(tr("SMESH_ARGUMENTS"), this);
 +  QGridLayout* GroupArgumentsLayout = new QGridLayout(GroupArguments);
 +  GroupArgumentsLayout->setSpacing(SPACING);
 +  GroupArgumentsLayout->setMargin(MARGIN);
 +
 +  myIdValidator = new SMESHGUI_IdValidator(this);
 +
 +  // Controls for elements selection
 +  TextLabelElements = new QLabel(tr("SMESH_ID_ELEMENTS"), GroupArguments);
 +  // SelectElementsButton = new QPushButton(GroupArguments);
 +  // SelectElementsButton->setIcon(image1);
 +  LineEditElements = new QLineEdit(GroupArguments);
 +  LineEditElements->setValidator(myIdValidator);
 +  LineEditElements->setMaxLength(-1);
 +  myFilterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
 +  connect(myFilterBtn,   SIGNAL(clicked()), this, SLOT(setFilters()));
 +
 +  // Control for the whole mesh selection
 +  CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments);
 +
 +  // offset
 +  QLabel* TextLabel1 = new QLabel(tr("OFFSET_VALUE"), GroupArguments);
 +  SpinBox = new SMESHGUI_SpinBox(GroupArguments);
 +
 +
 +  // switch of action type
 +  ActionBox = new QGroupBox(GroupArguments);
 +  ActionGroup = new QButtonGroup(GroupArguments);
 +  QVBoxLayout* ActionBoxLayout = new QVBoxLayout(ActionBox);
 +  ActionBoxLayout->addSpacing(SPACING);
 +  ActionBoxLayout->setMargin(MARGIN);
 +
 +  QRadioButton* aMoveElements = new QRadioButton(tr("SMESH_MOVE_ELEMENTS"), ActionBox);
 +  QRadioButton* aCopyElements = new QRadioButton(tr("SMESH_COPY_ELEMENTS"), ActionBox);
 +  QRadioButton* aCreateMesh   = new QRadioButton(tr("SMESH_CREATE_MESH"),   ActionBox);
 +
 +  ActionBoxLayout->addWidget(aMoveElements);
 +  ActionBoxLayout->addWidget(aCopyElements);
 +  ActionBoxLayout->addWidget(aCreateMesh);
 +  ActionGroup->addButton(aMoveElements, MOVE_ELEMS_BUTTON);
 +  ActionGroup->addButton(aCopyElements, COPY_ELEMS_BUTTON);
 +  ActionGroup->addButton(aCreateMesh,   MAKE_MESH_BUTTON);
 +
 +  // CheckBox for groups generation
 +  MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
 +  MakeGroupsCheck->setChecked(false);
 +
 +  // Name of a mesh to create
 +  LineEditNewMesh = new QLineEdit(GroupArguments);
 +
 +  //Preview check box
 +  myPreviewCheckBox = new QCheckBox(tr("PREVIEW"), GroupArguments);
 +
 +  // layout
 +  GroupArgumentsLayout->addWidget(TextLabelElements,    0, 0);
 +  //GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
 +  GroupArgumentsLayout->addWidget(LineEditElements,     0, 2, 1, 5);
 +  GroupArgumentsLayout->addWidget(myFilterBtn,          0, 7);
 +  GroupArgumentsLayout->addWidget(CheckBoxMesh,         1, 0, 1, 8);
 +  GroupArgumentsLayout->addWidget(TextLabel1,           2, 0);
 +  GroupArgumentsLayout->addWidget(SpinBox,              2, 3);
 +  GroupArgumentsLayout->addWidget(ActionBox,            3, 0, 3, 4);
 +  GroupArgumentsLayout->addWidget(MakeGroupsCheck,      4, 5, 1, 4);
 +  GroupArgumentsLayout->addWidget(LineEditNewMesh,      5, 5, 1, 4);
 +  GroupArgumentsLayout->addWidget(myPreviewCheckBox,    6, 0);
 +
 +  /***************************************************************/
 +  GroupButtons = new QGroupBox(this);
 +  QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons);
 +  GroupButtonsLayout->setSpacing(SPACING);
 +  GroupButtonsLayout->setMargin(MARGIN);
 +
 +  buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons);
 +  buttonOk->setAutoDefault(true);
 +  buttonOk->setDefault(true);
 +  buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
 +  buttonApply->setAutoDefault(true);
 +  buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons);
 +  buttonCancel->setAutoDefault(true);
 +  buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons);
 +  buttonHelp->setAutoDefault(true);
 +
 +  GroupButtonsLayout->addWidget(buttonOk);
 +  GroupButtonsLayout->addSpacing(10);
 +  GroupButtonsLayout->addWidget(buttonApply);
 +  GroupButtonsLayout->addSpacing(10);
 +  GroupButtonsLayout->addStretch();
 +  GroupButtonsLayout->addWidget(buttonCancel);
 +  GroupButtonsLayout->addWidget(buttonHelp);
 +
 +  /***************************************************************/
 +  dlgLayout->addWidget(ConstructorsBox);
 +  dlgLayout->addWidget(GroupArguments);
 +  dlgLayout->addWidget(GroupButtons);
 +
 +  /* Initialisations */
 +  SpinBox->RangeStepAndValidator(COORD_MIN, COORD_MAX, 1.0, "length_precision");
 +
 +  RadioButton1->setChecked(true);
 +
 +  mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
 +
 +  mySMESHGUI->SetActiveDialogBox((QDialog*)this);
 +
 +  // Costruction of the logical filter
 +  SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (SMESH::MESHorSUBMESH);
 +  SMESH_TypeFilter* aSmeshGroupFilter    = new SMESH_TypeFilter (SMESH::GROUP);
 +
 +  QList<SUIT_SelectionFilter*> aListOfFilters;
 +  if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter);
 +  if (aSmeshGroupFilter)    aListOfFilters.append(aSmeshGroupFilter);
 +
 +  myMeshOrSubMeshOrGroupFilter =
 +    new SMESH_LogicalFilter(aListOfFilters, SMESH_LogicalFilter::LO_OR);
 +
 +  myHelpFileName = "Offset_page.html";
 +
 +  Init();
 +
 +  /* signals and slots connections */
 +  connect(buttonOk,     SIGNAL(clicked()), this, SLOT(ClickOnOk()));
 +  connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
 +  connect(buttonApply,  SIGNAL(clicked()), this, SLOT(ClickOnApply()));
 +  connect(buttonHelp,   SIGNAL(clicked()), this, SLOT(ClickOnHelp()));
 +
 +  //connect(SelectElementsButton, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument()));
 +
 +  connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
 +  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()),   this, SLOT(SelectionIntoArgument()));
 +  /* to close dialog if study change */
 +  connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()),      this, SLOT(reject()));
 +  connect(mySMESHGUI, SIGNAL(SignalActivatedViewManager()), this, SLOT(onOpenView()));
 +  connect(mySMESHGUI, SIGNAL(SignalCloseView()),            this, SLOT(onCloseView()));
 +
 +  connect(LineEditElements, SIGNAL(textChanged(const QString&)),    SLOT(onTextChange(const QString&)));
 +  connect(CheckBoxMesh,     SIGNAL(toggled(bool)),                  SLOT(onSelectMesh(bool)));
 +  connect(ActionGroup,      SIGNAL(buttonClicked(int)),             SLOT(onActionClicked(int)));
 +
 +  connect(SpinBox,  SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
 +
 +  //To Connect preview check box
 +  connectPreviewControl();
 +
 +  SelectionIntoArgument();
 +  onActionClicked(MOVE_ELEMS_BUTTON);
 +}
 +
 +//=================================================================================
 +// function : ~SMESHGUI_OffsetDlg()
 +// purpose  : Destroys the object and frees any allocated resources
 +//=================================================================================
 +SMESHGUI_OffsetDlg::~SMESHGUI_OffsetDlg()
 +{
 +  if ( myFilterDlg ) {
 +    myFilterDlg->setParent( 0 );
 +    delete myFilterDlg;
 +    myFilterDlg = 0;
 +  }
 +}
 +
 +//=================================================================================
 +// function : Init()
 +// purpose  :
 +//=================================================================================
 +void SMESHGUI_OffsetDlg::Init (bool ResetControls)
 +{
 +  myBusy = false;
 +  myObjects.clear();
 +  myObjectsNames.clear();
 +  myMeshes.clear();
 +
 +  LineEditElements->clear();
 +  myElementsId = "";
 +  myNbOkElements = 0;
 +
 +  buttonOk->setEnabled(false);
 +  buttonApply->setEnabled(false);
 +
 +  myActor = 0;
 +
 +  if (ResetControls)
 +  {
 +    SpinBox->SetValue(1.0);
 +    myPreviewCheckBox->setChecked(false);
 +    onDisplaySimulation(false);
 +
 +    ActionGroup->button( MOVE_ELEMS_BUTTON )->setChecked(true);
 +    CheckBoxMesh->setChecked(true);
 +    onSelectMesh(true);
 +  }
 +}
 +
 +//=================================================================================
 +// function : ClickOnApply()
 +// purpose  :
 +//=================================================================================
 +bool SMESHGUI_OffsetDlg::ClickOnApply()
 +{
++  if (mySMESHGUI->isStudyLocked())
 +    return false;
 +
 +  if( !isValid() )
 +    return false;
 +
 +  SUIT_OverrideCursor aWaitCursor;
 +
 +  if (myNbOkElements)
 +  {
 +    QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
 +
 +    SMESH::long_array_var anElementsId = new SMESH::long_array;
 +    anElementsId->length(aListElementsId.count());
 +    for (int i = 0; i < aListElementsId.count(); i++)
 +      anElementsId[i] = aListElementsId[i].toInt();
 +
 +    double offsetValue = SpinBox->value();
 +
 +    QStringList aParameters;
 +    aParameters << SpinBox->text();
 +
 +    int actionButton = ActionGroup->checkedId();
 +    bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() );
 +    SMESH::ListOfGroups_var groups;
 +    SMESH::SMESH_Mesh_var mesh;
 +    QStringList anEntryList;
 +    try
 +    {
 +      switch ( actionButton ) {
 +
 +      case MOVE_ELEMS_BUTTON:
 +        if ( CheckBoxMesh->isChecked() )
 +          for ( int i = 0; i < myObjects.count(); i++ ) {
 +            SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[i]->GetMeshEditor();
 +            myMeshes[i]->SetParameters( aParameters.join( ":" ).toLatin1().constData() );
 +            mesh = aMeshEditor->Offset( myObjects[i], offsetValue, true, "", groups.out() );
 +          }
 +        else {
 +          SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor();
 +          SMESH::IDSource_wrap src = aMeshEditor->MakeIDSource(anElementsId, SMESH::FACE);
 +          myMeshes[0]->SetParameters( aParameters.join( ":" ).toLatin1().constData() );
 +          mesh = aMeshEditor->Offset( src, offsetValue, true, "", groups.out() );
 +        }
 +        break;
 +
 +      case COPY_ELEMS_BUTTON:
 +        if ( CheckBoxMesh->isChecked() )
 +          for ( int i = 0; i < myObjects.count(); i++ ) {
 +            SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[i]->GetMeshEditor();
 +            myMeshes[i]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
 +            mesh = aMeshEditor->Offset( myObjects[i], offsetValue, makeGroups, "", groups.out() );
 +          }
 +        else {
 +          SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor();
 +          SMESH::IDSource_wrap src = aMeshEditor->MakeIDSource(anElementsId, SMESH::FACE );
 +          myMeshes[0]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
 +          mesh = aMeshEditor->Offset( src, offsetValue, makeGroups, "", groups.out() );
 +        }
 +        break;
 +
 +      case MAKE_MESH_BUTTON: {
 +        SMESH::SMESH_Mesh_var mesh;
 +        if ( CheckBoxMesh->isChecked() ) {
 +          for ( int i = 0; i < myObjects.count(); i++ ) {
 +            QString aName =
 +              SMESH::UniqueMeshName( LineEditNewMesh->text().replace( "*", myObjectsNames[i] ));
 +            SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[i]->GetMeshEditor();
 +            myMeshes[i]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
 +            mesh = aMeshEditor->Offset( myObjects[i], offsetValue, makeGroups,
 +                                        aName.toLatin1().data(), groups.out() );
 +            if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ))
 +              anEntryList.append( aSObject->GetID().c_str() );
 +          }
 +        }
 +        else {
 +          SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor();
 +          myMeshes[0]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
 +          SMESH::IDSource_wrap src = aMeshEditor->MakeIDSource(anElementsId, SMESH::FACE );
 +          mesh = aMeshEditor->Offset( src, offsetValue, makeGroups,
 +                                      LineEditNewMesh->text().toLatin1().data(), groups.out() );
 +          if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) )
 +            anEntryList.append( aSObject->GetID().c_str() );
 +        }
 +        break;
 +      }
 +      }
 +    }
 +    catch ( const SALOME::SALOME_Exception& S_ex ) {
 +      SalomeApp_Tools::QtCatchCorbaException( S_ex );
 +    }
 +    catch (...) {
 +    }
 +
 +    for ( int i = 0; i < myObjects.count(); i++ ) {
 +      SMESH_Actor* actor = SMESH::FindActorByObject( myObjects[i] );
 +      if ( actor ) SMESH::Update( actor->getIO(), true );
 +    }
 +
 +    if ( makeGroups || actionButton == MAKE_MESH_BUTTON )
 +    {
 +      mySMESHGUI->updateObjBrowser(true); // new groups may appear
 +      if( LightApp_Application* anApp =
 +          dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
 +        anApp->browseObjects( anEntryList, isApplyAndClose() );
 +    }
 +    if ( !isApplyAndClose() )
 +    {
 +      Init(false);
 +      SelectionIntoArgument();
 +    }
 +    SMESHGUI::Modified();
 +  }
 +
 +  return true;
 +}
 +
 +//=================================================================================
 +// function : ClickOnOk()
 +// purpose  :
 +//=================================================================================
 +void SMESHGUI_OffsetDlg::ClickOnOk()
 +{
 +  setIsApplyAndClose( true );
 +  if( ClickOnApply() )
 +    reject();
 +}
 +
 +//=================================================================================
 +// function : reject()
 +// purpose  :
 +//=================================================================================
 +void SMESHGUI_OffsetDlg::reject()
 +{
 +  disconnect(mySelectionMgr, 0, this, 0);
 +  mySelectionMgr->clearFilters();
 +  if (SMESH::GetCurrentVtkView()) {
 +    SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters
 +    SMESH::SetPointRepresentation(false);
 +  }
 +  if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
 +    aViewWindow->SetSelectionMode( ActorSelection );
 +  mySMESHGUI->ResetState();
 +  QDialog::reject();
 +}
 +
 +//=================================================================================
 +// function : onOpenView()
 +// purpose  :
 +//=================================================================================
 +void SMESHGUI_OffsetDlg::onOpenView()
 +{
 +  if ( mySelector ) {
 +    SMESH::SetPointRepresentation(false);
 +  }
 +  else {
 +    mySelector = SMESH::GetViewWindow( mySMESHGUI )->GetSelector();
 +    ActivateThisDialog();
 +  }
 +}
 +
 +//=================================================================================
 +// function : onCloseView()
 +// purpose  :
 +//=================================================================================
 +void SMESHGUI_OffsetDlg::onCloseView()
 +{
 +  DeactivateActiveDialog();
 +  mySelector = 0;
 +}
 +
 +//=================================================================================
 +// function : ClickOnHelp()
 +// purpose  :
 +//=================================================================================
 +void SMESHGUI_OffsetDlg::ClickOnHelp()
 +{
 +  LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
 +  if (app)
 +    app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
 +  else {
 +    QString platform;
 +#ifdef WIN32
 +    platform = "winapplication";
 +#else
 +    platform = "application";
 +#endif
 +    SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
 +                             tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
 +                             arg(app->resourceMgr()->stringValue("ExternalBrowser",
 +                                                                 platform)).
 +                             arg(myHelpFileName));
 +  }
 +}
 +
 +//=======================================================================
 +// function : onTextChange()
 +// purpose  :
 +//=======================================================================
 +
 +void SMESHGUI_OffsetDlg::onTextChange (const QString& theNewText)
 +{
 +  if (myBusy) return;
 +  BusyLocker lock( myBusy );
 +
 +  myNbOkElements = 0;
 +
 +  buttonOk->setEnabled(false);
 +  buttonApply->setEnabled(false);
 +
 +  // highlight entered elements
 +  SMDS_Mesh* aMesh = 0;
 +  if (myActor)
 +    aMesh = myActor->GetObject()->GetMesh();
 +
 +  if (aMesh) {
 +    Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
 +
 +    TColStd_MapOfInteger newIndices;
 +
 +    QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
 +    for (int i = 0; i < aListId.count(); i++)
 +    {
 +      if ( const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt()))
 +        newIndices.Add( e->GetID() );
 +      myNbOkElements++;
 +    }
 +
 +    mySelector->AddOrRemoveIndex( anIO, newIndices, false );
 +    if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
 +      aViewWindow->highlight( anIO, true, true );
 +
 +    myElementsId = theNewText;
 +  }
 +
 +  if (myNbOkElements) {
 +    buttonOk->setEnabled(true);
 +    buttonApply->setEnabled(true);
 +  }
 +}
 +
 +//=================================================================================
 +// function : SelectionIntoArgument()
 +// purpose  : Called when selection as changed or other case
 +//=================================================================================
 +void SMESHGUI_OffsetDlg::SelectionIntoArgument()
 +{
 +  if (myBusy) return;
 +  if (myFilterDlg && myFilterDlg->isVisible()) return; // filter dlg active
 +
 +  BusyLocker lock( myBusy );
 +
 +  // clear
 +  myActor = 0;
 +  QString aString = "";
 +  onDisplaySimulation(false);
 +
 +  LineEditElements->setText(aString);
 +  myNbOkElements = 0;
 +  buttonOk->setEnabled(false);
 +  buttonApply->setEnabled(false);
 +
 +  if (!GroupButtons->isEnabled()) // inactive
 +    return;
 +
 +  // get selected mesh
 +  SALOME_ListIO aList;
 +  mySelectionMgr->selectedObjects(aList);
 +
 +  int nbSel = aList.Extent();
 +  if (nbSel < 1)
 +    return;
 +
 +  myElementsId = "";
 +  myObjects.clear();
 +  myObjectsNames.clear();
 +  myMeshes.clear();
 +
 +  for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() )
 +  {
 +    Handle(SALOME_InteractiveObject) IO = it.Value();
 +    SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO( IO );
 +    if ( aMesh->_is_nil() || aMesh->NbFaces() == 0 )
 +      return;
 +
 +    myActor = SMESH::FindActorByObject( aMesh );
 +    if ( !myActor )
 +      myActor = SMESH::FindActorByEntry( IO->getEntry() );
 +
 +    SMESH::SMESH_IDSource_var idSrc = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO );
 +    if ( _PTR(SObject) obj = SMESH::FindSObject( idSrc ))
 +    {
 +      std::string name = obj->GetName();
 +      if ( !name.empty() )
 +      {
 +        myObjects << idSrc;
 +        myObjectsNames << name.c_str();
 +        myMeshes << aMesh;
 +      }
 +    }
 +  }
 +
 +  // MakeGroups is available if there are groups and "Copy"
 +  int aNbGroups = 0;
 +  for ( int i = 0; i < myMeshes.count(); i++ )
 +    aNbGroups += myMeshes[i]->NbGroups();
 +
 +  if ( aNbGroups == 0 ) {
 +    MakeGroupsCheck->setChecked(false);
 +    MakeGroupsCheck->setEnabled(false);
 +  }
 +  else if ( ActionGroup->checkedId() != MOVE_ELEMS_BUTTON ) {
 +    MakeGroupsCheck->setEnabled(true);
 +  }
 +
 +  if (CheckBoxMesh->isChecked()) {
 +    if (myMeshes.isEmpty())
 +      return;
 +    SMESH::GetNameOfSelectedIObjects( mySelectionMgr, aString );
 +  }
 +  else {
 +    int aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, aList.First(), aString);
 +    myElementsId = aString;
 +    if (aNbUnits < 1)
 +      return;
 +  }
 +
 +  myNbOkElements = true;
 +  
 +  LineEditElements->setText(aString);
 +  LineEditElements->repaint();
 +  LineEditElements->setEnabled(false); // to fully update lineedit IPAL 19809
 +  LineEditElements->setEnabled(true);
 +  setNewMeshName();
 +
 +  buttonOk->setEnabled(true);
 +  buttonApply->setEnabled(true);
 +
 +  onDisplaySimulation(true);
 +}
 +
 +//=================================================================================
 +// function : DeactivateActiveDialog()
 +// purpose  :
 +//=================================================================================
 +
 +void SMESHGUI_OffsetDlg::DeactivateActiveDialog()
 +{
 +  if (ConstructorsBox->isEnabled())
 +  {
 +    ConstructorsBox->setEnabled(false);
 +    GroupArguments->setEnabled(false);
 +    GroupButtons->setEnabled(false);
 +    mySMESHGUI->ResetState();
 +    mySMESHGUI->SetActiveDialogBox(0);
 +  }
 +}
 +
 +//=================================================================================
 +// function : ActivateThisDialog()
 +// purpose  :
 +//=================================================================================
 +
 +void SMESHGUI_OffsetDlg::ActivateThisDialog()
 +{
 +  /* Emit a signal to deactivate the active dialog */
 +  mySMESHGUI->EmitSignalDeactivateDialog();
 +  ConstructorsBox->setEnabled(true);
 +  GroupArguments->setEnabled(true);
 +  GroupButtons->setEnabled(true);
 +
 +  mySMESHGUI->SetActiveDialogBox((QDialog*)this);
 +
 +  if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
 +    aViewWindow->SetSelectionMode( CellSelection );
 +
 +  SelectionIntoArgument();
 +}
 +
 +//=================================================================================
 +// function : enterEvent()
 +// purpose  :
 +//=================================================================================
 +
 +void SMESHGUI_OffsetDlg::enterEvent (QEvent*)
 +{
 +  if (!ConstructorsBox->isEnabled()) {
 +    SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI );
 +    if ( aViewWindow && !mySelector) {
 +      mySelector = aViewWindow->GetSelector();
 +    }
 +    ActivateThisDialog();
 +  }
 +}
 +
 +//=======================================================================
 +//function : onSelectMesh
 +//purpose  :
 +//=======================================================================
 +
 +void SMESHGUI_OffsetDlg::onSelectMesh (bool toSelectMesh)
 +{
 +  if (toSelectMesh)
 +    TextLabelElements->setText(tr("SMESH_NAME"));
 +  else
 +    TextLabelElements->setText(tr("SMESH_ID_ELEMENTS"));
 +  myFilterBtn->setEnabled(!toSelectMesh);
 +
 +  mySelectionMgr->clearFilters();
 +  SMESH::SetPointRepresentation(false);
 +
 +  if (toSelectMesh)
 +  {
 +    if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
 +      aViewWindow->SetSelectionMode( ActorSelection );
 +    mySelectionMgr->installFilter( myMeshOrSubMeshOrGroupFilter );
 +    LineEditElements->setReadOnly( true );
 +    LineEditElements->setValidator( 0 );
 +  }
 +  else
 +  {
 +    if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
 +      aViewWindow->SetSelectionMode( FaceSelection );
 +    LineEditElements->setReadOnly( false );
 +    LineEditElements->setValidator( myIdValidator );
 +    onTextChange(LineEditElements->text());
 +    hidePreview();
 +  }
 +
 +  SelectionIntoArgument();
 +}
 +
 +//=======================================================================
 +//function : onActionClicked
 +//purpose  : slot called when an action type changed
 +//=======================================================================
 +
 +void SMESHGUI_OffsetDlg::onActionClicked(int button)
 +{
 +  int aNbGroups = 0;
 +  for ( int i = 0; i < myMeshes.count(); i++ )
 +    aNbGroups += myMeshes[i]->NbGroups();
 +
 +  switch ( button ) {
 +  case MOVE_ELEMS_BUTTON:
 +    MakeGroupsCheck->setEnabled(false);
 +    LineEditNewMesh->setEnabled(false);
 +    break;
 +  case COPY_ELEMS_BUTTON:
 +    LineEditNewMesh->setEnabled(false);
 +    MakeGroupsCheck->setText( tr("SMESH_MAKE_GROUPS"));
 +    MakeGroupsCheck->setEnabled( myMeshes.isEmpty() || aNbGroups > 0 );
 +    break;
 +  case MAKE_MESH_BUTTON:
 +    LineEditNewMesh->setEnabled(true);
 +    MakeGroupsCheck->setText( tr("SMESH_COPY_GROUPS"));
 +    MakeGroupsCheck->setEnabled( myMeshes.isEmpty() || aNbGroups > 0 );
 +    break;
 +  }
 +  setNewMeshName();
 +  //toDisplaySimulation();
 +}
 +
 +//=======================================================================
 +//function : setNewMeshName
 +//purpose  : update contents of LineEditNewMesh
 +//=======================================================================
 +
 +void SMESHGUI_OffsetDlg::setNewMeshName()
 +{
 +  LineEditNewMesh->setText("");
 +  if ( LineEditNewMesh->isEnabled() && !myMeshes.isEmpty() ) {
 +    QString name;
 +    if ( CheckBoxMesh->isChecked() ) {
 +      name = myObjects.count() > 1 ? "*" : LineEditElements->text();
 +    }
 +    else {
 +      _PTR(SObject) meshSO = SMESH::FindSObject( myMeshes[0] );
 +      name = meshSO->GetName().c_str();
 +    }
 +    if ( !name.isEmpty() )
 +      LineEditNewMesh->setText( SMESH::UniqueMeshName( name, "Offset"));
 +  }
 +}
 +
 +//=================================================================================
 +// function : keyPressEvent()
 +// purpose  :
 +//=================================================================================
 +
 +void SMESHGUI_OffsetDlg::keyPressEvent( QKeyEvent* e )
 +{
 +  QDialog::keyPressEvent( e );
 +  if ( e->isAccepted() )
 +    return;
 +
 +  if ( e->key() == Qt::Key_F1 ) {
 +    e->accept();
 +    ClickOnHelp();
 +  }
 +}
 +
 +//=================================================================================
 +// function : setFilters()
 +// purpose  : SLOT. Called when "Filter" button pressed.
 +//=================================================================================
 +
 +void SMESHGUI_OffsetDlg::setFilters()
 +{
 +  if ( myMeshes.isEmpty() ) {
 +    SUIT_MessageBox::critical(this, tr("SMESH_ERROR"), tr("NO_MESH_SELECTED"));
 +    return;
 +  }
 +  if ( !myFilterDlg ) {
 +    myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL );
 +    connect(myFilterDlg, SIGNAL(Accepted()), SLOT(onFilterAccepted()));
 +  }
 +
 +  myFilterDlg->Init( SMESH::FACE );
 +  myFilterDlg->SetSelection();
 +  myFilterDlg->SetMesh( myMeshes[0] );
 +  myFilterDlg->SetSourceWg( LineEditElements );
 +
 +  myFilterDlg->show();
 +}
 +
 +//=======================================================================
 +// name    : onFilterAccepted()
 +// Purpose : SLOT. Called when Filter dlg closed with OK button.
 +//           Activate [Apply] if no Actor is available
 +//=======================================================================
 +
 +void SMESHGUI_OffsetDlg::onFilterAccepted()
 +{
 +  if ( myMeshes.length() > 0 && !buttonOk->isEnabled() )
 +  {
 +    myElementsId = LineEditElements->text();
 +    QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
 +    myNbOkElements = aListElementsId.count();
 +    buttonOk->setEnabled   ( myNbOkElements );
 +    buttonApply->setEnabled( myNbOkElements );
 +  }
 +}
 +
 +//=================================================================================
 +// function : isValid
 +// purpose  :
 +//=================================================================================
 +
 +bool SMESHGUI_OffsetDlg::isValid()
 +{
 +  return true;
 +}
 +
 +//=================================================================================
 +// function : onDisplaySimulation
 +// purpose  : Show/Hide preview
 +//=================================================================================
 +void SMESHGUI_OffsetDlg::onDisplaySimulation( bool toDisplayPreview )
 +{
 +  SUIT_OverrideCursor aWaitCursor;
 +
 +  if (myPreviewCheckBox->isChecked() && toDisplayPreview)
 +  {
 +    if ( myNbOkElements && isValid() )
 +    {
 +      double offsetValue = SpinBox->value();
 +
 +      SMESH::ListOfGroups_var groups;
 +      SMESH::SMESH_Mesh_var mesh;
 +
 +      try
 +      {
 +        QList<SMESH::MeshPreviewStruct_var> aMeshPreviewStruct;
 +
 +        if ( CheckBoxMesh->isChecked())
 +          for ( int i = 0; i < myObjects.count(); i++ )
 +          {
 +            SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[i]->GetMeshEditPreviewer();
 +            mesh = aMeshEditor->Offset( myObjects[i], offsetValue, false, "", groups.out() );
 +            aMeshPreviewStruct << aMeshEditor->GetPreviewData();
 +          }
 +        else
 +        {
 +          SMESH::long_array_var anElementsId = new SMESH::long_array;
 +          QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
 +          anElementsId->length(aListElementsId.count());
 +          for (int i = 0; i < aListElementsId.count(); i++)
 +            anElementsId[i] = aListElementsId[i].toInt();
 +
 +          SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditPreviewer();
 +          SMESH::IDSource_wrap src = aMeshEditor->MakeIDSource(anElementsId, SMESH::FACE);
 +          mesh = aMeshEditor->Offset( src, offsetValue, false, "", groups.out() );
 +          aMeshPreviewStruct << aMeshEditor->GetPreviewData();
 +        }
 +        setSimulationPreview(aMeshPreviewStruct);
 +
 +      } catch (...) {
 +        hidePreview();
 +      }
 +    } else {
 +      hidePreview();
 +    }
 +  } else {
 +    hidePreview();
 +  }
 +}
index 12b10e83baf6a673f056bb94981cef92500043eb,3f3e891517cef6a322a7bbeaf952723df9874d9d..0ddbff46dd3be180a3473c9b88492af13b710665
@@@ -20,7 -20,7 +20,7 @@@
  // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
 -// SMESH SMDS : implementaion of Salome mesh data structure
 +// SMESH SMDS : implementation of Salome mesh data structure
  // File   : SMESHGUI_Operation.h
  // Author : Sergey LITONIN, Open CASCADE S.A.S.
  //
@@@ -65,9 -65,6 +65,6 @@@ protected
    virtual void      setDialogActive( const bool );
  
    SMESHGUI*         getSMESHGUI() const;
-   bool              isStudyLocked( const bool = true ) const;
-   _PTR(Study)       studyDS() const;
    
    virtual bool      isValid( SUIT_Operation* ) const;
  
index 9df86e1039d795f775881406d2fdbcd8a50e04e7,620996d18f42eb585650ddd95a902ab52e592a83..48206643adffa8476fb0c7856f7d4b757b87c0a3
@@@ -162,7 -162,7 +162,7 @@@ SMESHGUI_RemoveElementsDl
    SMESHGUI_RemoveElementsDlgLayout->addWidget(GroupC1);
    SMESHGUI_RemoveElementsDlgLayout->addWidget(GroupButtons);
  
 -  myHelpFileName = "removing_nodes_and_elements_page.html#removing_elements_anchor";
 +  myHelpFileName = "removing_nodes_and_elements.html#removing-elements-anchor";
  
    Init(); /* Initialisations */
  }
@@@ -223,7 -223,7 +223,7 @@@ void SMESHGUI_RemoveElementsDlg::Init(
  //=================================================================================
  void SMESHGUI_RemoveElementsDlg::ClickOnApply()
  {
-   if (mySMESHGUI->isActiveStudyLocked())
+   if (SMESHGUI::isStudyLocked())
      return;
  
    if (myNbOkElements)
  
      } catch (const SALOME::SALOME_Exception& S_ex) {
        SalomeApp_Tools::QtCatchCorbaException(S_ex);
 -      myEditCurrentArgument->clear();
 -    } catch (...){
 -      myEditCurrentArgument->clear();
 +    } catch (...) {
      }
  
 +    myEditCurrentArgument->clear();
      if (aResult) {
 -      myEditCurrentArgument->clear();
        mySelector->ClearIndex();
 -      SMESH::UpdateView();
 +      SMESH::UpdateView( /*withChildrenOfSelected=*/true );
        SMESHGUI::Modified();
      }
    }
@@@ -343,7 -345,7 +343,7 @@@ void SMESHGUI_RemoveElementsDlg::onText
  
    myNbOkElements = 0;
  
 -  // hilight entered elements
 +  // highlight entered elements
    if(myActor){
      if(SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh()){
        Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
index 976272ed7e2a2a4b1bc48621d14e98cc41b1b45a,a94f4b488077fa5241bd3bbcef3ddc4703d7c4ff..adef42a6c3e28478a1ca72adecdb6be9e6e1235c
@@@ -162,7 -162,7 +162,7 @@@ SMESHGUI_RemoveNodesDl
    SMESHGUI_RemoveNodesDlgLayout->addWidget(GroupC1);
    SMESHGUI_RemoveNodesDlgLayout->addWidget(GroupButtons);
  
 -  myHelpFileName = "removing_nodes_and_elements_page.html#removing_nodes_anchor";
 +  myHelpFileName = "removing_nodes_and_elements.html#removing-nodes-anchor";
  
    Init(); /* Initialisations */
  }
@@@ -229,7 -229,7 +229,7 @@@ void SMESHGUI_RemoveNodesDlg::Init(
  //=================================================================================
  void SMESHGUI_RemoveNodesDlg::ClickOnApply()
  {
-   if (mySMESHGUI->isActiveStudyLocked())
+   if (SMESHGUI::isStudyLocked())
      return;
  
    if (myNbOkNodes) {
@@@ -351,7 -351,7 +351,7 @@@ void SMESHGUI_RemoveNodesDlg::onTextCha
  
    myNbOkNodes = 0;
  
 -  // hilight entered nodes
 +  // highlight entered nodes
    if(myActor){
      if(SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh()){
        Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
index 26176aeb25ff3ed45833caa1c35ef2008b6b307a,9f21446747fc566a90f5c7e7eb7e2dee94b7dc5e..aafe585222e58ac40e6c3b45fab53b264feccd1f
@@@ -99,8 -99,8 +99,8 @@@ SMESHGUI_RenumberingDlg::SMESHGUI_Renum
                                      tr("SMESH_ELEMENTS"), 
                                      this);
    myHelpFileName = unit == 0 ? 
 -    "renumbering_nodes_and_elements_page.html#renumbering_nodes_anchor" :
 -    "renumbering_nodes_and_elements_page.html#renumbering_elements_anchor";
 +    "renumbering_nodes_and_elements.html#renumbering-nodes-anchor" :
 +    "renumbering_nodes_and_elements.html#renumbering-elements-anchor";
  
    QButtonGroup* ButtonGroup = new QButtonGroup(this);
    QHBoxLayout* GroupConstructorsLayout = new QHBoxLayout(GroupConstructors);
@@@ -210,7 -210,7 +210,7 @@@ void SMESHGUI_RenumberingDlg::Init(
  //=================================================================================
  void SMESHGUI_RenumberingDlg::ClickOnApply()
  {
-   if (mySMESHGUI->isActiveStudyLocked())
+   if (SMESHGUI::isStudyLocked())
      return;
  
    if (!myMesh->_is_nil()) {
index 7498a784e57be927e8700f721df338a8af693f80,f6f72edb2bc5f549b42e0299baa375aadc0dc956..b09abbaf4e171430dcab12f5b3d0882472f5ca60
@@@ -331,7 -331,7 +331,7 @@@ SMESHGUI_ReorientFacesOp::SMESHGUI_Reor
    :SMESHGUI_SelectionOp( ActorSelection )
  {
    //myVectorPreview = 0;
 -  myHelpFileName = "reorient_faces_page.html";
 +  myHelpFileName = "reorient_faces.html";
  
    myDlg = new SMESHGUI_ReorientFacesDlg;
    myDlg->constructorChange( CONSTRUCTOR_POINT );
@@@ -638,7 -638,7 +638,7 @@@ void SMESHGUI_ReorientFacesOp::onTextCh
  
  bool SMESHGUI_ReorientFacesOp::onApply()
  {
-   if( isStudyLocked() )
+   if( SMESHGUI::isStudyLocked() )
      return false;
  
    QString msg;
@@@ -728,7 -728,7 +728,7 @@@ bool SMESHGUI_ReorientFacesOp::isValid
  {
    // check object
    QString objectEntry = myDlg->selectedObject( EObject );
-   _PTR(SObject) pSObject = studyDS()->FindObjectID( objectEntry.toLatin1().data() );
+   _PTR(SObject) pSObject = SMESH::getStudy()->FindObjectID( objectEntry.toLatin1().data() );
    myObject = SMESH::SMESH_IDSource::_narrow( _CAST( SObject,pSObject )->GetObject() );
    if ( myObject->_is_nil() )
    {
    if ( myDlg->myConstructorGrp->checkedId() == CONSTRUCTOR_VOLUME )
    {
      objectEntry = myDlg->selectedObject( EVolumes );
-     _PTR(SObject) pSObject = studyDS()->FindObjectID( objectEntry.toLatin1().data() );
+     _PTR(SObject) pSObject = SMESH::getStudy()->FindObjectID( objectEntry.toLatin1().data() );
      myVolumeObj = SMESH::SObjectToInterface< SMESH::SMESH_IDSource>( pSObject );
      if ( myVolumeObj->_is_nil() )
      {
index 9e7554e1e3ffb9e2e6b4010f742b4d0c9523c17f,f23c6d2f652688145b890e611b82b215925d306c..034c854caed5464edb4af06a0a798ecded22162a
@@@ -261,7 -261,7 +261,7 @@@ SMESHGUI_RevolutionDlg::SMESHGUI_Revolu
  
    mySMESHGUI->SetActiveDialogBox((QDialog*)this);
  
 -  myHelpFileName = "revolution_page.html";
 +  myHelpFileName = "revolution.html";
  
    Init();
  
@@@ -392,7 -392,7 +392,7 @@@ bool SMESHGUI_RevolutionDlg::isValid(
  //=================================================================================
  bool SMESHGUI_RevolutionDlg::ClickOnApply()
  {
-   if (mySMESHGUI->isActiveStudyLocked())
+   if (SMESHGUI::isStudyLocked())
      return false;
  
    if (!isValid())
@@@ -641,7 -641,7 +641,7 @@@ void SMESHGUI_RevolutionDlg::SelectionI
      else if ( isFaceSelected )
      {
        const SMDS_MeshFace* face =
 -        dynamic_cast<const SMDS_MeshFace*>(aMesh->FindElement(aMapIndex(1)));
 +        SMDS_Mesh::DownCast<SMDS_MeshFace>( aMesh->FindElement( aMapIndex( 1 )));
        if (!face)
          return;
        gp_XYZ aNormale = SMESH::getNormale(face);
index a55c56f97601c19721d0a0ece87fb458bd05ffeb,291d908ddbb5686d539621f604c7126ee0fde7aa..50e40b3f3573f451f8f9ac9e076da65686044727
@@@ -287,7 -287,7 +287,7 @@@ SMESHGUI_RotationDlg::SMESHGUI_Rotation
    myMeshOrSubMeshOrGroupFilter =
      new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR);
  
 -  myHelpFileName = "rotation_page.html";
 +  myHelpFileName = "rotation.html";
  
    Init();
  
@@@ -400,7 -400,7 +400,7 @@@ void SMESHGUI_RotationDlg::Init (bool R
  //=================================================================================
  bool SMESHGUI_RotationDlg::ClickOnApply()
  {
-   if (mySMESHGUI->isActiveStudyLocked())
+   if (SMESHGUI::isStudyLocked())
      return false;
  
    if( !isValid() )
@@@ -635,7 -635,7 +635,7 @@@ void SMESHGUI_RotationDlg::onTextChang
    buttonOk->setEnabled(false);
    buttonApply->setEnabled(false);
  
 -  // hilight entered elements
 +  // highlight entered elements
    SMDS_Mesh* aMesh = 0;
    if (myActor)
      aMesh = myActor->GetObject()->GetMesh();
index b36a950682ad25e0e53e07f31af66fc46b423cef,001ee7d9440a02acbd4667a707abe59ec48c3fb6..87310c71b6925568e56ba5d906c36f1274f0edd9
@@@ -291,7 -291,7 +291,7 @@@ SMESHGUI_ScaleDlg::SMESHGUI_ScaleDlg( S
    myMeshOrSubMeshOrGroupFilter =
      new SMESH_LogicalFilter(aListOfFilters, SMESH_LogicalFilter::LO_OR);
  
 -  myHelpFileName = "scale_page.html";
 +  myHelpFileName = "scale.html";
  
    Init();
  
@@@ -439,7 -439,7 +439,7 @@@ void SMESHGUI_ScaleDlg::ConstructorsCli
  //=================================================================================
  bool SMESHGUI_ScaleDlg::ClickOnApply()
  {
-   if (mySMESHGUI->isActiveStudyLocked())
+   if (SMESHGUI::isStudyLocked())
      return false;
  
    if( !isValid() )
@@@ -674,7 -674,7 +674,7 @@@ void SMESHGUI_ScaleDlg::onTextChange (c
    buttonOk->setEnabled(false);
    buttonApply->setEnabled(false);
  
 -  // hilight entered elements
 +  // highlight entered elements
    SMDS_Mesh* aMesh = 0;
    if (myActor)
      aMesh = myActor->GetObject()->GetMesh();
index 8d8f46a271026143d9028e70674a38fb1173e5d4,a8704b8b977b460cc353abfa742720cccf13130d..b04d9fabe143d50e04e03c752f86a3d54bb2d3f4
@@@ -40,7 -40,7 +40,7 @@@
  #include <SMESH_ScalarBarActor.h>
  
  // SALOME GUI includes
- #include <SalomeApp_Study.h>
+ #include <SalomeApp_Application.h>
  #include <LightApp_VTKSelector.h>
  #include <SVTK_ViewWindow.h>
  
@@@ -75,15 -75,10 +75,10 @@@ void SMESHGUI_Selection::init( const QS
  {
    LightApp_Selection::init( client, mgr );
  
-   if( mgr && study() )
+   if( mgr )
    {
-     SalomeApp_Study* aSStudy = dynamic_cast<SalomeApp_Study*>(study());
-     if (!aSStudy)
-       return;
-     _PTR(Study) aStudy = aSStudy->studyDS();
      for( int i=0, n=count(); i<n; i++ ) {
-       myTypes.append( typeName( type( entry( i ), aStudy ) ) );
+       myTypes.append( typeName( type( entry( i ) ) ) );
        myControls.append( controlMode( i ) );
      }
    }
@@@ -203,8 -198,8 +198,8 @@@ QList<QVariant> SMESHGUI_Selection::ele
    {
      if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] != "Unknown" )
      {
-       _PTR(SObject) sobj = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
-       CORBA::Object_var obj = SMESH::SObjectToObject( sobj, SMESH::GetActiveStudyDocument() );
+       _PTR(SObject) sobj = SMESH::getStudy()->FindObjectID( entry( ind ).toLatin1().data() );
+       CORBA::Object_var obj = SMESH::SObjectToObject( sobj );
        SMESH::SMESH_IDSource_var idSrc = SMESH::SMESH_IDSource::_narrow( obj );
        if ( !CORBA::is_nil( idSrc ) )
        {
@@@ -268,7 -263,7 +263,7 @@@ QString SMESHGUI_Selection::displayMode
  
  bool SMESHGUI_Selection::isQuadratic( int ind ) const
  {
-   _PTR(SObject) so = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
+   _PTR(SObject) so = SMESH::getStudy()->FindObjectID( entry( ind ).toLatin1().data() );
    if ( !so )
      return false;
    SMESH::SMESH_IDSource_var idSource =  SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( so );
@@@ -389,7 -384,6 +384,7 @@@ QString SMESHGUI_Selection::controlMode
      case SMESH_Actor::eCoincidentElems1D:     mode = "eCoincidentElems1D";     break;
      case SMESH_Actor::eCoincidentElems2D:     mode = "eCoincidentElems2D";     break;
      case SMESH_Actor::eCoincidentElems3D:     mode = "eCoincidentElems3D";     break;
 +    case SMESH_Actor::eCustomControl:         mode = "eCustomControl";         break;
      default:break;
      }
    }
@@@ -471,11 -465,14 +466,14 @@@ bool SMESHGUI_Selection::isAutoColor( i
  {
    if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] != "Unknown" )
    {
-     _PTR(SObject) sobj = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
-     CORBA::Object_var      obj = SMESH::SObjectToObject( sobj, SMESH::GetActiveStudyDocument() );
-     SMESH::SMESH_Mesh_var mesh = SMESH::SMESH_Mesh::_narrow( obj );
-     if ( !CORBA::is_nil( mesh ) )
-       return mesh->GetAutoColor();
+     _PTR(SObject) sobj = SMESH::getStudy()->FindObjectID( entry( ind ).toLatin1().data() );
+     CORBA::Object_var obj = SMESH::SObjectToObject( sobj );
+     if ( !CORBA::is_nil( obj ) ) {
+       SMESH::SMESH_Mesh_var mesh = SMESH::SMESH_Mesh::_narrow( obj );
+       if ( !CORBA::is_nil( mesh ) )
+         return mesh->GetAutoColor();
+     }
    }
    return false;
  }
@@@ -489,8 -486,8 +487,8 @@@ int SMESHGUI_Selection::numberOfNodes( 
  {
    if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] != "Unknown" )
    {
-     _PTR(SObject) sobj = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
-     CORBA::Object_var obj = SMESH::SObjectToObject( sobj, SMESH::GetActiveStudyDocument() );
+     _PTR(SObject) sobj = SMESH::getStudy()->FindObjectID( entry( ind ).toLatin1().data() );
+     CORBA::Object_var obj = SMESH::SObjectToObject( sobj );
  
      if ( !CORBA::is_nil( obj ) ) {
        SMESH::SMESH_Mesh_var mesh = SMESH::SMESH_Mesh::_narrow( obj );
@@@ -520,8 -517,8 +518,8 @@@ int SMESHGUI_Selection::dim( int ind ) 
    int dim = -1;
    if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] != "Unknown" )
    {
-     _PTR(SObject) sobj = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
-     CORBA::Object_var obj = SMESH::SObjectToObject( sobj, SMESH::GetActiveStudyDocument() );
+     _PTR(SObject) sobj = SMESH::getStudy()->FindObjectID( entry( ind ).toLatin1().data() );
+     CORBA::Object_var obj = SMESH::SObjectToObject( sobj );
  
      if ( !CORBA::is_nil( obj ) ) {
        SMESH::SMESH_IDSource_var idSrc = SMESH::SMESH_IDSource::_narrow( obj );
@@@ -555,7 -552,7 +553,7 @@@ bool SMESHGUI_Selection::isComputable( 
                                                myTypes[ind].startsWith("Mesh " )))
    {
      QMap<int,int> modeMap;
-     _PTR(SObject) meshSO = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
+     _PTR(SObject) meshSO = SMESH::getStudy()->FindObjectID( entry( ind ).toLatin1().data() );
  
      _PTR(SComponent) component = meshSO->GetFatherComponent();
      if ( meshSO->Depth() - component->Depth() > 1 ) // sub-mesh, get a mesh
@@@ -581,7 -578,7 +579,7 @@@ bool SMESHGUI_Selection::isPreComputabl
      if ( maxDim < 2 ) // we can preview 1D or 2D
      {
        QMap<int,int> modeMap;
-       _PTR(SObject) pMesh = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
+       _PTR(SObject) pMesh = SMESH::getStudy()->FindObjectID( entry( ind ).toLatin1().data() );
        SMESHGUI_PrecomputeOp::getAssignedAlgos( pMesh, modeMap );
        if ( modeMap.size() > 1 )
          return (( modeMap.contains( SMESH::DIM_3D )) ||
@@@ -600,7 -597,7 +598,7 @@@ bool SMESHGUI_Selection::hasGeomReferen
  {
    if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] != "Unknown" )
    {
-     _PTR(SObject) so = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
+     _PTR(SObject) so = SMESH::getStudy()->FindObjectID( entry( ind ).toLatin1().data() );
      GEOM::GEOM_Object_var shape = SMESH::GetShapeOnMeshOrSubMesh( so );
      return !shape->_is_nil();
    }
@@@ -617,7 -614,7 +615,7 @@@ bool SMESHGUI_Selection::isEditableHyp
    bool isEditable = true;
    if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] == "Hypothesis" )
    {
-     _PTR(SObject) so = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
+     _PTR(SObject) so = SMESH::getStudy()->FindObjectID( entry( ind ).toLatin1().data() );
      SMESH::SMESH_Hypothesis_var hyp = SMESH::SObjectToInterface<SMESH::SMESH_Hypothesis>( so );
      if ( !hyp->_is_nil() )
      {
@@@ -654,9 -651,9 +652,9 @@@ bool SMESHGUI_Selection::hasChildren( i
  {
    if ( ind >= 0 )
    {
-     _PTR(SObject) sobj = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
+     _PTR(SObject) sobj = SMESH::getStudy()->FindObjectID( entry( ind ).toLatin1().data() );
      if ( sobj ) 
-       return SMESH::GetActiveStudyDocument()->GetUseCaseBuilder()->HasChildren( sobj );
+       return SMESH::getStudy()->GetUseCaseBuilder()->HasChildren( sobj );
    }
    return false;
  }
@@@ -671,9 -668,10 +669,10 @@@ int SMESHGUI_Selection::nbChildren( in
    int nb = 0;
    if ( ind >= 0 )
    {
-     _PTR(SObject) sobj = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
-     if ( sobj && sobj->GetStudy()->GetUseCaseBuilder()->IsUseCaseNode( sobj ) ) {
-       _PTR(UseCaseIterator) it = sobj->GetStudy()->GetUseCaseBuilder()->GetUseCaseIterator( sobj ); 
+     _PTR(Study) study = SMESH::getStudy();
+     _PTR(SObject) sobj = study->FindObjectID( entry( ind ).toLatin1().data() );
+     if ( sobj && study->GetUseCaseBuilder()->IsUseCaseNode( sobj ) ) {
+       _PTR(UseCaseIterator) it = study->GetUseCaseBuilder()->GetUseCaseIterator( sobj );
        for ( it->Init( false ); it->More(); it->Next() ) nb++;
      }
    }
@@@ -695,10 -693,10 +694,10 @@@ bool SMESHGUI_Selection::isContainer( i
  //purpose  : 
  //=======================================================================
  
- int SMESHGUI_Selection::type( const QString& entry, _PTR(Study) study )
+ int SMESHGUI_Selection::type( const QString& entry )
  {
    int res = -1;
-   _PTR(SObject) obj = study->FindObjectID( entry.toLatin1().data() );
+   _PTR(SObject) obj = SalomeApp_Application::getStudy()->FindObjectID( entry.toLatin1().data() );
    if ( obj ) {
      _PTR(SObject) ref;
      if ( obj->ReferencedObject( ref ) )
@@@ -794,7 -792,7 +793,7 @@@ QString SMESHGUI_Selection::typeName( c
  bool SMESHGUI_Selection::isImported( const int ind ) const
  {
    bool res = false;
-   _PTR(SObject) sobj = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().constData() );
+   _PTR(SObject) sobj = SMESH::getStudy()->FindObjectID( entry( ind ).toLatin1().constData() );
    if ( sobj )
    {
      SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( SMESH::SObjectToObject( sobj ) );
@@@ -824,7 -822,7 +823,7 @@@ int SMESHGUI_Selection::guiState(
  
  QString SMESHGUI_Selection::groupType( int ind ) const
  {
-   _PTR(SObject) sobj = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().constData() );
+   _PTR(SObject) sobj = SMESH::getStudy()->FindObjectID( entry( ind ).toLatin1().constData() );
    if ( sobj )
    {
      SMESH::SMESH_Group_var g = SMESH::SObjectToInterface<SMESH::SMESH_Group>( sobj );
index 2d69e85974dfa74cb1f82f4c27f535ddfe94e100,ed560b87ee5400108f0be8733d2db59ea87be068..e57e65c7711bedca692cd47332a097e093a75e7b
@@@ -250,11 -250,11 +250,11 @@@ void SMESHGUI_SelectionOp::setSelection
  // Purpose : Highlight object in 3d viewer
  //=======================================================================
  void SMESHGUI_SelectionOp::highlight( const Handle( SALOME_InteractiveObject )& obj,
 -                                      const bool hilight, const bool immediately )
 +                                      const bool highlight, const bool immediately )
  {
    SVTK_ViewWindow* wnd = viewWindow();
    if( wnd )
 -    wnd->highlight( obj, hilight, immediately );
 +    wnd->highlight( obj, highlight, immediately );
  }
  
  //=======================================================================
@@@ -295,36 -295,28 +295,28 @@@ SVTK_Selector* SMESHGUI_SelectionOp::se
  //=======================================================================
  int SMESHGUI_SelectionOp::typeById( const QString& str, const EntityType objtype ) const
  {
-   SalomeApp_Study* _study = dynamic_cast<SalomeApp_Study*>( study() );
-   if( !_study )
-     return -1;
-   _PTR( Study ) st = _study->studyDS();
+   _PTR(Study) aStudy = SMESH::getStudy();
  
    int res = -1;
    if( objtype == Object )
    {
-     SalomeApp_Study* _study = dynamic_cast<SalomeApp_Study*>( study() );
-     if( _study )
+     int t = SMESHGUI_Selection::type( str );
+     if( t<0 )
      {
-       int t = SMESHGUI_Selection::type( str, _study->studyDS() );
-       if( t<0 )
+       //try to get GEOM type
+       _PTR( SObject ) sobj = aStudy->FindObjectID( str.toLatin1().data() );
+       if( sobj )
        {
-         //try to get GEOM type
-         _PTR( SObject ) sobj = st->FindObjectID( str.toLatin1().data() );
-         if( sobj )
-         {
-           GEOM::GEOM_Object_var obj = GEOM::GEOM_Object::_narrow(
-             dynamic_cast<SALOMEDS_SObject*>( sobj.get() )->GetObject() );
-           if( !CORBA::is_nil( obj ) )
-             // as decoding of type id is not realized in LightApp_Dialog,
-             //make all GEOM objects have same type id
-             res = SMESHGUI_Dialog::prefix( "GEOM" );// + obj->GetType();
-         }
+         GEOM::GEOM_Object_var obj = GEOM::GEOM_Object::_narrow(
+           dynamic_cast<SALOMEDS_SObject*>( sobj.get() )->GetObject() );
+         if( !CORBA::is_nil( obj ) )
+           // as decoding of type id is not realized in LightApp_Dialog,
+           //make all GEOM objects have same type id
+           res = SMESHGUI_Dialog::prefix( "GEOM" );// + obj->GetType();
        }
-       else
-         res = SMESHGUI_Dialog::prefix( "SMESH" ) + t;
      }
+     else
+       res = SMESHGUI_Dialog::prefix( "SMESH" ) + t;
    }
    else
    {
      int id = _id.toInt( &ok );
      if( ok )
      {
-       _PTR( SObject ) sobj = st->FindObjectID( entry.toLatin1().data() );
+       _PTR( SObject ) sobj = aStudy->FindObjectID( entry.toLatin1().data() );
        SMESH::SMESH_Mesh_var mesh = SMESH::SMESH_Mesh::_narrow( 
          dynamic_cast<SALOMEDS_SObject*>( sobj.get() )->GetObject() );
        SMESH::SMESH_subMesh_var submesh = SMESH::SMESH_subMesh::_narrow( 
@@@ -422,13 -414,9 +414,9 @@@ void SMESHGUI_SelectionOp::selected( QS
        QString id = anIt.Value()->getEntry();
        ids.append( id );
        types.append( typeById( id, Object ) );
-       SalomeApp_Study* _study = dynamic_cast<SalomeApp_Study*>( study() );
-       if( _study )
-       {
-         _PTR(SObject) obj = _study->studyDS()->FindObjectID( anIt.Value()->getEntry() );
-         if( obj )
-           names.append( QString( obj->GetName().c_str() ).trimmed() );
-       }
+       _PTR(SObject) obj = SMESH::getStudy()->FindObjectID( anIt.Value()->getEntry() );
+       if( obj )
+         names.append( QString( obj->GetName().c_str() ).trimmed() );
      }
    }
  }
index 519d207cdebfbfe635acace9cce936621d256351,27dfe06e75e49695312599ab83ce2a0f6bf61e3e..cc27ffed285889363d6e8416d03fd65096833ccd
@@@ -452,7 -452,7 +452,7 @@@ SMESHGUI_SewingDlg::SMESHGUI_SewingDlg
  
    mySMESHGUI->SetActiveDialogBox((QDialog*)this);
  
 -  myHelpFileName = "sewing_meshes_page.html";
 +  myHelpFileName = "sewing_meshes.html";
  
    myActor = 0;
    myStoredEntityMode = 0;
@@@ -1293,7 -1293,7 +1293,7 @@@ void SMESHGUI_SewingDlg::onSwapClicked(
  //=================================================================================
  bool SMESHGUI_SewingDlg::ClickOnApply()
  {
-   if (mySMESHGUI->isActiveStudyLocked())
+   if (SMESHGUI::isStudyLocked())
      return false;
  
    bool aResult = false;
@@@ -1532,7 -1532,7 +1532,7 @@@ void SMESHGUI_SewingDlg::onTextChange (
    else if (send == LineEdit6)
      myOk6 = false;
  
 -  // hilight entered elements/nodes
 +  // highlight entered elements/nodes
    SMDS_Mesh* aMesh = 0;
  
    if (myActor)
index 51af3fd9faba84d690ab69ab1d450b3831ec35c4,b3c14cb521d8dff03ad77b1cb5e2352dbc985e7c..8afb333c113d4073456b955a6bd495eb59dd8454
@@@ -341,7 -341,7 +341,7 @@@ void SMESHGUI_SingleEditDlg::onTextChan
    myOkBtn->setEnabled(false);
    myApplyBtn->setEnabled(false);
  
 -  // hilight entered edge
 +  // highlight entered edge
    if(myActor){
      if(SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh()){
        Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
@@@ -439,7 -439,7 +439,7 @@@ void SMESHGUI_SingleEditDlg::onSelectio
  
  //=======================================================================
  // name    : onDeactivate()
 -// Purpose : SLOT called when dialog must be deativated
 +// Purpose : SLOT called when dialog must be deactivated
  //=======================================================================
  void SMESHGUI_SingleEditDlg::onDeactivate()
  {
@@@ -493,7 -493,7 +493,7 @@@ void SMESHGUI_SingleEditDlg::enterEven
  //=================================================================================
  bool SMESHGUI_SingleEditDlg::onApply()
  {
-   if (mySMESHGUI->isActiveStudyLocked())
+   if (SMESHGUI::isStudyLocked())
      return false;
    // verify validity of input data
    if (!isValid(true))
@@@ -560,7 -560,7 +560,7 @@@ SMESHGUI_TrianglesInversionDl
  : SMESHGUI_SingleEditDlg(theModule)
  {
    setWindowTitle(tr("CAPTION"));
 -  myHelpFileName = "diagonal_inversion_of_elements_page.html";
 +  myHelpFileName = "diagonal_inversion_of_elements.html";
  }
  
  SMESHGUI_TrianglesInversionDlg::~SMESHGUI_TrianglesInversionDlg()
@@@ -584,7 -584,7 +584,7 @@@ SMESHGUI_UnionOfTwoTrianglesDl
  : SMESHGUI_SingleEditDlg(theModule)
  {
    setWindowTitle(tr("CAPTION"));
 -  myHelpFileName = "uniting_two_triangles_page.html";
 +  myHelpFileName = "uniting_two_triangles.html";
  }
  
  SMESHGUI_UnionOfTwoTrianglesDlg::~SMESHGUI_UnionOfTwoTrianglesDlg()
index f9e2d61eb27ee38653c2bdbc3ce2d79b5d77a988,3f79c3292f28fee5482d190a51deff9a976d0e4f..f79817a8cda1eeefd120d971975128aa06afb2aa
@@@ -268,7 -268,7 +268,7 @@@ SMESHGUI_SmoothingDlg::SMESHGUI_Smoothi
    myMeshOrSubMeshOrGroupFilter =
      new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR);
  
 -  myHelpFileName = "smoothing_page.html";
 +  myHelpFileName = "smoothing.html";
  
    Init();
  
@@@ -341,7 -341,7 +341,7 @@@ void SMESHGUI_SmoothingDlg::Init(
  //=================================================================================
  bool SMESHGUI_SmoothingDlg::ClickOnApply()
  {
-   if (mySMESHGUI->isActiveStudyLocked())
+   if (SMESHGUI::isStudyLocked())
      return false;
  
    if (!isValid())
@@@ -518,7 -518,7 +518,7 @@@ void SMESHGUI_SmoothingDlg::onTextChang
    buttonOk->setEnabled(false);
    buttonApply->setEnabled(false);
  
 -  // hilight entered elements/nodes
 +  // highlight entered elements/nodes
    SMDS_Mesh* aMesh = myActor ? myActor->GetObject()->GetMesh() : 0;
    QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
  
index 33bf3c69d342bfd14bc862ddd04b995952ab3723,75e03affbc832b5109a83cc0ef97f0fda2c7384f..d7b8a1a910534aff5ccdf843667919a2cc763e91
@@@ -125,7 -125,7 +125,7 @@@ void SMESHGUI_SplitBiQuadOp::startOpera
    {
      myDlg = new SMESHGUI_SplitBiQuadDlg();
    }
 -  myHelpFileName = "split_biquad_to_linear_page.html";
 +  myHelpFileName = "split_biquad_to_linear.html";
  
    SMESHGUI_SelectionOp::startOperation();
  
@@@ -202,7 -202,7 +202,7 @@@ bool SMESHGUI_SplitBiQuadOp::onApply(
    int nbObj = 0;
    for ( int i = 0; i < entries.count() ; ++i )
    {
-     _PTR(SObject) pObj = studyDS()->FindObjectID( entries[i].toLatin1().data() );
+     _PTR(SObject) pObj = SMESH::getStudy()->FindObjectID( entries[i].toLatin1().data() );
      SMESH::SMESH_IDSource_var obj = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( pObj );
      if( !CORBA::is_nil( obj ))
      {
index 433a11dd1fc12843b816bb57ec8bac76ad1b457e,f994189fd2df0932fe2c40f7dd43e79c54e070ec..c7e65a36df4d0b91e9b37b94cad52fb3ed5db1ce
@@@ -289,7 -289,7 +289,7 @@@ SMESHGUI_SymmetryDlg::SMESHGUI_Symmetry
    myMeshOrSubMeshOrGroupFilter =
      new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR);
  
 -  myHelpFileName = "symmetry_page.html";
 +  myHelpFileName = "symmetry.html";
  
    Init();
  
@@@ -474,7 -474,7 +474,7 @@@ void SMESHGUI_SymmetryDlg::Constructors
  //=================================================================================
  bool SMESHGUI_SymmetryDlg::ClickOnApply()
  {
-   if (mySMESHGUI->isActiveStudyLocked())
+   if (SMESHGUI::isStudyLocked())
      return false;
  
    if( !isValid() )
@@@ -693,7 -693,7 +693,7 @@@ void SMESHGUI_SymmetryDlg::onTextChang
    buttonOk->setEnabled(false);
    buttonApply->setEnabled(false);
  
 -  // hilight entered elements
 +  // highlight entered elements
    SMDS_Mesh* aMesh = 0;
    if (myActor)
      aMesh = myActor->GetObject()->GetMesh();
index c488f6462d83f6e5e7eb5bf5eb72ac47343e7463,21342aebd88abef9f96f027c89ac26ab713ecb64..e162e6ae299af2c7797917811b7f21d6a35e445f
@@@ -295,7 -295,7 +295,7 @@@ SMESHGUI_TranslationDlg::SMESHGUI_Trans
    myMeshOrSubMeshOrGroupFilter =
      new SMESH_LogicalFilter(aListOfFilters, SMESH_LogicalFilter::LO_OR);
  
 -  myHelpFileName = "translation_page.html";
 +  myHelpFileName = "translation.html";
  
    Init();
  
@@@ -475,7 -475,7 +475,7 @@@ void SMESHGUI_TranslationDlg::Construct
  //=================================================================================
  bool SMESHGUI_TranslationDlg::ClickOnApply()
  {
-   if (mySMESHGUI->isActiveStudyLocked())
+   if (SMESHGUI::isStudyLocked())
      return false;
  
    if( !isValid() )
@@@ -705,7 -705,7 +705,7 @@@ void SMESHGUI_TranslationDlg::onTextCha
    buttonOk->setEnabled(false);
    buttonApply->setEnabled(false);
  
 -  // hilight entered elements
 +  // highlight entered elements
    SMDS_Mesh* aMesh = 0;
    if (myActor)
      aMesh = myActor->GetObject()->GetMesh();
index ef9fb3896b5d62ad099ba9ba85fc9cc163ace889,eac67620e4a542e269441013450f698dad1d8e94..98549bdc8e0a1ab74ef3ff47a1f17cd1474758ad
@@@ -76,7 -76,7 +76,7 @@@
  
  namespace SMESH
  {
-   typedef std::map<TKeyOfVisualObj,TVisualObjPtr> TVisualObjCont;
+   typedef std::map<std::string,TVisualObjPtr> TVisualObjCont;
    static TVisualObjCont VISUAL_OBJ_CONT;
  
    //=============================================================================
        }
      }
      
-     if (aViewManager ) {
-       int aStudyId = aViewManager->study()->id();
-       TVisualObjCont::key_type aKey(aStudyId,theEntry);
-       TVisualObjCont::iterator anIter = VISUAL_OBJ_CONT.find(aKey);
-       if(anIter != VISUAL_OBJ_CONT.end()) {
-         // for unknown reason, object destructor is not called, so clear object manually
-         anIter->second->GetUnstructuredGrid()->SetCells(0,0,0,0,0);
-         anIter->second->GetUnstructuredGrid()->SetPoints(0);
-       }
-       VISUAL_OBJ_CONT.erase(aKey);
+     TVisualObjCont::iterator anIter = VISUAL_OBJ_CONT.find(theEntry);
+     if(anIter != VISUAL_OBJ_CONT.end()) {
+       // for unknown reason, object destructor is not called, so clear object manually
+       anIter->second->GetUnstructuredGrid()->SetCells(0,0,0,0,0);
+       anIter->second->GetUnstructuredGrid()->SetPoints(0);
      }
+     VISUAL_OBJ_CONT.erase(theEntry);
  
      if(actorRemoved)
        aStudy->setVisibilityState(theEntry, Qtx::HiddenState);
     */
    //================================================================================
  
-   void RemoveVisuData(int studyID)
+   void RemoveVisuData()
    {
      SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>
        ( SUIT_Session::session()->activeApplication() );
      ViewManagerList viewMgrs = app->viewManagers();
      for ( int iM = 0; iM < viewMgrs.count(); ++iM ) {
        SUIT_ViewManager* aViewManager = viewMgrs.at( iM );
-       if ( aViewManager && aViewManager->getType() == SVTK_Viewer::Type() &&
-            aViewManager->study()->id() == studyID ) {
+       if ( aViewManager && aViewManager->getType() == SVTK_Viewer::Type() ) {
          QVector<SUIT_ViewWindow*> views = aViewManager->getViews();
          for ( int iV = 0; iV < views.count(); ++iV ) {
            if(SVTK_ViewWindow* vtkWnd = GetVtkViewWindow(views[iV])) {
      }
      TVisualObjCont::iterator anIter = VISUAL_OBJ_CONT.begin();
      for ( ; anIter != VISUAL_OBJ_CONT.end(); ) {
-       int curId = anIter->first.first;
-       if ( curId == studyID ) {
-         // for unknown reason, object destructor is not called, so clear object manually
-         anIter->second->GetUnstructuredGrid()->SetCells(0,0,0,0,0);
-         anIter->second->GetUnstructuredGrid()->SetPoints(0);
-         VISUAL_OBJ_CONT.erase( anIter++ ); // anIter++ returns a copy of self before incrementing
-       }
-       else {
-         anIter++;
-       }
+       // for unknown reason, object destructor is not called, so clear object manually
+       anIter->second->GetUnstructuredGrid()->SetCells(0,0,0,0,0);
+       anIter->second->GetUnstructuredGrid()->SetPoints(0);
+       VISUAL_OBJ_CONT.erase( anIter++ ); // anIter++ returns a copy of self before incrementing
      }
    }
  
     */
    //================================================================================
  
-   TVisualObjPtr GetVisualObj(int theStudyId, const char* theEntry, bool nulData){
+   TVisualObjPtr GetVisualObj(const char* theEntry, bool nulData){
      TVisualObjPtr aVisualObj;
-     TVisualObjCont::key_type aKey(theStudyId,theEntry);
      try{
        OCC_CATCH_SIGNALS;
-       TVisualObjCont::iterator anIter = VISUAL_OBJ_CONT.find(aKey);
+       TVisualObjCont::iterator anIter = VISUAL_OBJ_CONT.find(theEntry);
        if(anIter != VISUAL_OBJ_CONT.end()){
          aVisualObj = anIter->second;
        }else{
          SalomeApp_Application* app =
            dynamic_cast<SalomeApp_Application*>( SMESHGUI::activeStudy()->application() );
-         _PTR(Study) aStudy = SMESHGUI::activeStudy()->studyDS();
+         _PTR(Study) aStudy = SMESH::getStudy();
          _PTR(SObject) aSObj = aStudy->FindObjectID(theEntry);
          if(aSObj){
            _PTR(GenericAttribute) anAttr;
                SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow(anObj);
                if(!aMesh->_is_nil()){
                  aVisualObj.reset(new SMESH_MeshObj(aMesh));
-                 TVisualObjCont::value_type aValue(aKey,aVisualObj);
+                 TVisualObjCont::value_type aValue(theEntry,aVisualObj);
                  VISUAL_OBJ_CONT.insert(aValue);
                }
                //Try narrow to SMESH_Group interface
                  aFatherSObj = aFatherSObj->GetFather();
                  if(!aFatherSObj) return aVisualObj;
                  CORBA::String_var anEntry = aFatherSObj->GetID().c_str();
-                 TVisualObjPtr aVisObj = GetVisualObj(theStudyId,anEntry.in());
+                 TVisualObjPtr aVisObj = GetVisualObj(anEntry.in());
                  if(SMESH_MeshObj* aMeshObj = dynamic_cast<SMESH_MeshObj*>(aVisObj.get())){
                    aVisualObj.reset(new SMESH_GroupObj(aGroup,aMeshObj));
-                   TVisualObjCont::value_type aValue(aKey,aVisualObj);
+                   TVisualObjCont::value_type aValue(theEntry,aVisualObj);
                    VISUAL_OBJ_CONT.insert(aValue);
                  }
                }
                  aFatherSObj = aFatherSObj->GetFather();
                  if(!aFatherSObj) return aVisualObj;
                  CORBA::String_var anEntry = aFatherSObj->GetID().c_str();
-                 TVisualObjPtr aVisObj = GetVisualObj(theStudyId,anEntry.in());
+                 TVisualObjPtr aVisObj = GetVisualObj(anEntry.in());
                  if(SMESH_MeshObj* aMeshObj = dynamic_cast<SMESH_MeshObj*>(aVisObj.get())){
                    aVisualObj.reset(new SMESH_subMeshObj(aSubMesh,aMeshObj));
-                   TVisualObjCont::value_type aValue(aKey,aVisualObj);
+                   TVisualObjCont::value_type aValue(theEntry,aVisualObj);
                    VISUAL_OBJ_CONT.insert(aValue);
                  }
                }
        return NULL;
  
      if(!CORBA::is_nil(theObject)){
-       _PTR(Study) aStudy = GetActiveStudyDocument();
+       _PTR(Study) aStudy = getStudy();
        CORBA::String_var anIOR = app->orb()->object_to_string( theObject );
        _PTR(SObject) aSObject = aStudy->FindObjectIOR(anIOR.in());
        if(aSObject){
    }
  
  
-   SMESH_Actor* CreateActor(_PTR(Study) theStudy,
-                            const char* theEntry,
+   SMESH_Actor* CreateActor(const char* theEntry,
                             int theIsClear)
    {
      SMESH_Actor *anActor = NULL;
-     CORBA::Long anId = theStudy->StudyId();
-     if(TVisualObjPtr aVisualObj = GetVisualObj(anId,theEntry)){
-       _PTR(SObject) aSObj = theStudy->FindObjectID(theEntry);
+     if(TVisualObjPtr aVisualObj = GetVisualObj(theEntry)){
+       _PTR(SObject) aSObj = getStudy()->FindObjectID(theEntry);
        if(aSObj){
          _PTR(GenericAttribute) anAttr;
          if(aSObj->FindAttribute(anAttr,"AttributeName")){
          Handle(SALOME_InteractiveObject) anIO = theActor->getIO();
          if(anIO->hasEntry()){
            std::string anEntry = anIO->getEntry();
-           SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( vtkWnd->getViewManager()->study() );
-           int aStudyId = aStudy->id();
-           TVisualObjCont::key_type aKey(aStudyId,anEntry);
-           VISUAL_OBJ_CONT.erase(aKey);
+           VISUAL_OBJ_CONT.erase(anEntry);
          }
        }
        theActor->Delete();
              {
                //MESSAGE("---");
                SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(theWnd->getViewManager()->study());
-               _PTR(Study) aDocument = aStudy->studyDS();
-               // Pass non-visual objects (hypotheses, etc.), return true in this case
-               CORBA::Long anId = aDocument->StudyId();
                TVisualObjPtr aVisualObj;
-               if ( (aVisualObj = GetVisualObj(anId,theEntry)) && aVisualObj->IsValid())
+               if ( (aVisualObj = GetVisualObj(theEntry)) && aVisualObj->IsValid())
                {
-                 if ((anActor = CreateActor(aDocument,theEntry,true))) {
+                 if ((anActor = CreateActor(theEntry,true))) {
                    bool needFitAll = noSmeshActors(theWnd); // fit for the first object only
                    DisplayActor(theWnd,anActor);
                    anActor->SetVisibility(true);
      return false;
    }
  
 -  void UpdateView(){
 +  void UpdateView( bool withChildrenOfSelected )
 +  {
      if ( SVTK_ViewWindow* aWnd = SMESH::GetCurrentVtkView()) {
        LightApp_SelectionMgr* mgr = SMESHGUI::selectionMgr();
        SALOME_ListIO selected; mgr->selectedObjects( selected );
  
 -      if( selected.Extent() == 0){
 +      if ( selected.Extent() == 0 ) {
          vtkRenderer* aRenderer = aWnd->getRenderer();
          VTK::ActorCollectionCopy aCopy(aRenderer->GetActors());
          vtkActorCollection *aCollection = aCopy.GetActors();
                  break; // avoid multiple warinings if visu failed
            }
          }
 -      }else{
 +      }
 +      else
 +      {
          SALOME_ListIteratorOfListIO anIter( selected );
 -        for( ; anIter.More(); anIter.Next()){
 +        for( ; anIter.More(); anIter.Next())
 +        {
            Handle(SALOME_InteractiveObject) anIO = anIter.Value();
 -          if ( !Update(anIO,true) )
 +          if ( !Update( anIO, true ))
              break; // avoid multiple warinings if visu failed
 +
 +          if ( withChildrenOfSelected ) // update all visible children
 +          {
 +            QString aFatherID = anIO->getEntry();
 +            vtkRenderer* aRenderer = aWnd->getRenderer();
 +            VTK::ActorCollectionCopy aCopy(aRenderer->GetActors());
 +            vtkActorCollection *aCollection = aCopy.GetActors();
 +            aCollection->InitTraversal();
 +            while ( vtkActor *anAct = aCollection->GetNextActor() ) {
 +              if ( SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>( anAct )) {
 +                if ( anActor->hasIO() && anActor->GetVisibility() )
 +                {
 +                  QString aChildID = anActor->getIO()->getEntry();
 +                  if ( aChildID.size() > aFatherID.size() &&
 +                       aChildID.startsWith( aFatherID ))
 +                    if ( ! Update( anActor->getIO(), true ))
 +                      break;
 +                }
 +              }
 +            }
 +          }
          }
        }
        RepaintCurrentView();
    bool Update(const Handle(SALOME_InteractiveObject)& theIO, bool theDisplay)
    {
      //MESSAGE("Update");
-     _PTR(Study) aStudy = GetActiveStudyDocument();
-     CORBA::Long anId = aStudy->StudyId();
-     if ( TVisualObjPtr aVisualObj = SMESH::GetVisualObj(anId,theIO->getEntry())) {
+     if ( TVisualObjPtr aVisualObj = SMESH::GetVisualObj(theIO->getEntry())) {
        if ( theDisplay )
          UpdateView(SMESH::eDisplay,theIO->getEntry());
        return true;
    bool UpdateNulData(const Handle(SALOME_InteractiveObject)& theIO, bool theDisplay)
    {
      //MESSAGE("UpdateNulData");
-     _PTR(Study) aStudy = GetActiveStudyDocument();
-     CORBA::Long anId = aStudy->StudyId();
-     if ( TVisualObjPtr aVisualObj = SMESH::GetVisualObj(anId,theIO->getEntry(), true)) {
+     if ( TVisualObjPtr aVisualObj = SMESH::GetVisualObj(theIO->getEntry(), true)) {
        if ( theDisplay )
          UpdateView(SMESH::eDisplay,theIO->getEntry());
        return true;
index 0f47edb71a08bb88c5c8bf3d255415205083333c,217b1995da5f4190a58477e14c7f1a980f62e1a3..48c0d5993cda91495bd68a8e676ffce2da0bcaff
@@@ -63,10 -63,9 +63,9 @@@ class vtkActor
  namespace SMESH
  {
    //----------------------------------------------------------------------------
-   typedef std::pair<int,std::string> TKeyOfVisualObj;
    
  SMESHGUI_EXPORT
-   TVisualObjPtr GetVisualObj( int, const char*, bool nulData =false );
+   TVisualObjPtr GetVisualObj( const char*, bool nulData =false );
  SMESHGUI_EXPORT
    void OnVisuException(); // PAL16631
  
@@@ -103,13 -102,13 +102,13 @@@ SMESHGUI_EXPOR
  
    //----------------------------------------------------------------------------
  SMESHGUI_EXPORT  
-   SMESH_Actor* CreateActor( _PTR(Study), const char*, int = false );
+   SMESH_Actor* CreateActor( const char*, int = false );
  SMESHGUI_EXPORT
    void DisplayActor( SUIT_ViewWindow*, SMESH_Actor* );
  SMESHGUI_EXPORT
    void RemoveActor( SUIT_ViewWindow*, SMESH_Actor* );
  SMESHGUI_EXPORT
-   void RemoveVisuData( int );
+   void RemoveVisuData();
  
    //----------------------------------------------------------------------------
    enum EDisplaing { eDisplayAll, eDisplay, eDisplayOnly, eErase, eEraseAll };
@@@ -120,7 -119,7 +119,7 @@@ SMESHGUI_EXPOR
    bool UpdateView( EDisplaing, const char* = "" );
  
  SMESHGUI_EXPORT
 -  void UpdateView();
 +  void UpdateView( bool withChildrenOfSelected = false );
  
  SMESHGUI_EXPORT
    bool UpdateNulData( const Handle(SALOME_InteractiveObject)& theIO, bool theDisplay);
index f36fa04c73407e4dfb3cdac33b23121bf1192587,dba59dba77b8aa6c4b013400b0cff0b805bd4d80..8af2e2d7c7618fae7dafcd522fa2516c987a1e77
          <source>MED_FILES_FILTER</source>
          <translation>MED files</translation>
      </message>
+     <message>
+         <source>SAUV_FILES_FILTER</source>
+         <translation>SAUV files</translation>
+     </message>
      <message>
          <source>IDEAS_FILES_FILTER</source>
          <translation>IDEAS files</translation>
          <source>TEXT_FILES_FILTER</source>
          <translation>TXT files</translation>
      </message>
-     <message>
-         <source>MED_VX_FILES_FILTER</source>
-         <translation>MED %1 files</translation>
-     </message>
      <message>
          <source>STL_FILES_FILTER</source>
          <translation>STL files</translation>
          <source>MEN_SCALE</source>
          <translation>Scale Transform</translation>
      </message>
 +    <message>
 +        <source>MEN_OFFSET</source>
 +        <translation>Offset</translation>
 +    </message>
      <message>
          <source>MEN_DUPLICATE_NODES</source>
          <translation>Duplicate Nodes or/and Elements</translation>
@@@ -1796,13 -1792,6 +1796,6 @@@ Do you want to continue?</translation
          <source>SMESH_EXPORT_ONLY_GPOUP</source>
          <translation>You are going to export the group without its mesh.
  Do you want to continue?</translation>
-     </message>
-     <message>
-         <source>SMESH_EXPORT_MED_V2_1</source>
-         <translation>During export mesh with name - &quot;%1&quot; to MED 2.1
- polygons and polyhedrons elements will be missed
- For correct export use MED 2.2
- Are you sure want to export to MED 2.1?</translation>
      </message>
      <message>
          <source>SMESH_EXPORT_MED_VERSION_COLLISION</source>
@@@ -1930,7 -1919,7 +1923,7 @@@ add the exported data to its contents?<
          <translation>Hexahedrons</translation>
      </message>
      <message>
 -        <source>SMESH_HILIGHT_COLOR</source>
 +        <source>SMESH_HIGHLIGHT_COLOR</source>
          <translation>Highlight Color</translation>
      </message>
      <message>
@@@ -3558,10 -3547,6 +3551,10 @@@ Use Display Entity menu command to sho
          <source>STB_SCALE</source>
          <translation>Scale Transform</translation>
      </message>
 +    <message>
 +        <source>STB_OFFSET</source>
 +        <translation>Offset</translation>
 +    </message>
      <message>
          <source>STB_DUPLICATE_NODES</source>
          <translation>Duplicate Nodes or/and Elements</translation>
          <source>TOP_SCALE</source>
          <translation>Scale Transform</translation>
      </message>
 +    <message>
 +        <source>TOP_OFFSET</source>
 +        <translation>Offset</translation>
 +    </message>
      <message>
          <source>TOP_DUPLICATE_NODES</source>
          <translation>Duplicate Nodes or/and Elements</translation>
@@@ -4521,21 -4502,6 +4514,21 @@@ It can&apos;t be deleted </translation
          <translation>Export Fields</translation>
      </message>
  </context>
 +<context>
 +    <name>SMESHGUI_OffsetDlg</name>
 +    <message>
 +        <source>SMESH_OFFSET_TITLE</source>
 +        <translation>Offset</translation>
 +    </message>
 +    <message>
 +        <source>SMESH_OFFSET</source>
 +        <translation>Offset</translation>
 +    </message>
 +    <message>
 +        <source>OFFSET_VALUE</source>
 +        <translation>Offset Value</translation>
 +    </message>
 +</context>
  <context>
      <name>SMESHGUI_AddMeshElementDlg</name>
      <message>
@@@ -7107,7 -7073,7 +7100,7 @@@ It is impossible to read point coordina
      <name>SMESHGUI_MeshOrderOp</name>
      <message>
          <source>SMESH_NO_CONCURENT_MESH</source>
 -        <translation>No concurent sub-meshes detected</translation>
 +        <translation>No concurrent sub-meshes detected</translation>
      </message>
  </context>
  <context>
index 80ba636651aee3b05e8e867640a737411406bad6,5418e81c646357078c34d5dc30388a0d6640e71e..b26fe665c624a1d0e86736364749205b7d50bd3f
          <source>MED_FILES_FILTER</source>
          <translation>Fichiers MED</translation>
      </message>
+     <message>
+         <source>SAUV_FILES_FILTER</source>
+         <translation>Fichiers SAUV</translation>
+     </message>
      <message>
          <source>IDEAS_FILES_FILTER</source>
          <translation>Fichiers IDEAS</translation>
          <source>TEXT_FILES_FILTER</source>
          <translation>Fichiers TXT</translation>
      </message>
-     <message>
-         <source>MED_VX_FILES_FILTER</source>
-         <translation>Fichiers MED %1</translation>
-     </message>
      <message>
          <source>STL_FILES_FILTER</source>
          <translation>Fichiers STL</translation>
@@@ -1776,13 -1776,6 +1776,6 @@@ Voulez-vous continuer ?</translation
          <source>SMESH_EXPORT_ONLY_GPOUP</source>
          <translation>Vous allez export le groupe sans son maillage.
  Voulez-vous continuer ?</translation>
-     </message>
-     <message>
-         <source>SMESH_EXPORT_MED_V2_1</source>
-         <translation>Les éléments polygonaux et polyèdriques seront omis 
- dans le cas d&apos;exportation du maillage &quot;%1&quot; à MED 2.1
- Utilisez MED 2.2 pour l&apos;exportation correcte.
- Voulez-vous effectuer l&apos;exportation à MED 2.1 ?</translation>
      </message>
      <message>
          <source>SMESH_EXPORT_MED_VERSION_COLLISION</source>
@@@ -1910,7 -1903,7 +1903,7 @@@ les données exportées ?</translation
          <translation>Hexaèdres</translation>
      </message>
      <message>
 -        <source>SMESH_HILIGHT_COLOR</source>
 +        <source>SMESH_HIGHLIGHT_COLOR</source>
          <translation>Couleur de sélection</translation>
      </message>
      <message>
index 22e77aa5401bd61828e586ed9a4657924fdb6c58,5ea6dbe1d8291aaa21ed2434984cc894b92b6a08..c266cb993585fd281c4bea12543bcb1648828165
        <source>MED_FILES_FILTER</source>
        <translation>MEDファイル</translation>
      </message>
+     <message>
+         <source>SAUV_FILES_FILTER</source>
+         <translation>SAUVファイル</translation>
+     </message>
      <message>
        <source>IDEAS_FILES_FILTER</source>
        <translation>IDEAS ファイル</translation>
        <source>TEXT_FILES_FILTER</source>
        <translation>TXT ファイル</translation>
      </message>
-     <message>
-       <source>MED_VX_FILES_FILTER</source>
-       <translation>ファイル MED %1</translation>
-     </message>
      <message>
        <source>STL_FILES_FILTER</source>
        <translation>STL ファイル</translation>
        <source>SMESH_EXPORT_ONLY_GPOUP</source>
        <translation>そのメッシュなしでグループのエクスポートをしようとしています。続行しますか?</translation>
      </message>
-     <message>
-       <source>SMESH_EXPORT_MED_V2_1</source>
-       <translation>多角形、多面体要素は正しいエクスポート用 MED 2.1 MED 2.2 にメッシュ '%' のエクスポートの場合省略されます。MED 2.1 をエクスポートしますか。</translation>
-     </message>
      <message>
        <source>SMESH_EXPORT_MED_VERSION_COLLISION</source>
        <translation>ファイル「%1」MED バージョンは知られていないか、選択したバージョンと一致しません。ファイルを上書きしますか。</translation>
        <translation>六面体</translation>
      </message>
      <message>
 -      <source>SMESH_HILIGHT_COLOR</source>
 +      <source>SMESH_HIGHLIGHT_COLOR</source>
        <translation>選択色</translation>
      </message>
      <message>
index 8be022d98111b985d975528e72c0c9e7bd551188,2bb789ab37364c982d7d8cf051976bd86163597b..b5183dbe7b14c9c54ad8ce8b211bc582686bb724
@@@ -21,7 -21,7 +21,7 @@@
  # additional include directories
  INCLUDE_DIRECTORIES(
    ${OMNIORB_INCLUDE_DIR}
 -  ${CAS_INCLUDE_DIRS}
 +  ${OpenCASCADE_INCLUDE_DIR}
    ${HDF5_INCLUDE_DIRS}
    ${VTK_INCLUDE_DIRS}
    ${Boost_INCLUDE_DIRS}
@@@ -31,8 -31,7 +31,7 @@@
    ${PROJECT_SOURCE_DIR}/src/Controls
    ${PROJECT_SOURCE_DIR}/src/SMDS
    ${PROJECT_SOURCE_DIR}/src/SMESHDS
-   ${PROJECT_SOURCE_DIR}/src/MEDWrapper/Base
-   ${PROJECT_SOURCE_DIR}/src/MEDWrapper/Factory
+   ${PROJECT_SOURCE_DIR}/src/MEDWrapper
    ${PROJECT_SOURCE_DIR}/src/Driver
    ${PROJECT_SOURCE_DIR}/src/DriverMED
    ${PROJECT_SOURCE_DIR}/src/DriverCGNS
@@@ -45,7 -44,7 +44,7 @@@
  # additional preprocessor / compiler flags
  ADD_DEFINITIONS(
    ${OMNIORB_DEFINITIONS}
 -  ${CAS_DEFINITIONS}
 +  ${OpenCASCADE_DEFINITIONS}
    ${BOOST_DEFINITIONS}
  )
  
@@@ -70,10 -69,12 +69,11 @@@ SET(_link_LIBRARIE
    ${KERNEL_SalomeGenericObj}
    ${KERNEL_SalomeIDLKERNEL}
    ${KERNEL_SALOMELocalTrace}
 -  ${CAS_TKCDF}
 -  ${CAS_TKBO}
 -  ${CAS_TKShHealing}
+   ${KERNEL_SalomeKernelHelpers}
 +  ${OpenCASCADE_ApplicationFramework_LIBRARIES}
 +  ${OpenCASCADE_ModelingAlgorithms_LIBRARIES}
    ${GEOM_GEOMClient}
 -  ${GEOM_SalomeIDLGEOM}  
 +  ${GEOM_SalomeIDLGEOM}
    SalomeIDLSMESH
    SMESHimpl
    SMDS
@@@ -114,7 -115,7 +114,7 @@@ SET(SMESHEngine_HEADER
  SET(SMESHEngine_SOURCES
    SMESH_Gen_i.cxx
    SMESH_Gen_i_1.cxx
-   SMESH_DumpPython.cxx
+   SMESH_PythonDump.cxx
    SMESH_Mesh_i.cxx
    SMESH_subMesh_i.cxx
    SMESH_MeshEditor_i.cxx
index b0d415b411fb7525867e8c2d07889e59572b6b08,aed61ba95ee2c267a97bd70cdadc7996e7f0d6bd..28b641e3a4f74a15bd8b2c51b3adc47dfe76f510
@@@ -185,7 -185,7 +185,7 @@@ namespace 
      _AString comment;
  
      _pyID obj = cmd->GetObject();
-     if ( obj.Search( "print " ) == 1 )
+     if ( obj.Search( "print(" ) == 1 )
        return; // print statement
  
      if ( !obj.IsEmpty() && obj.Value( obj.Length() ) == ')' )
        }
      }
    }
+   bool _FilterArg( const _AString& theArg  )
+   {
+     static std::list<_AString> filteredArgs;
+     static bool initialized = false;
+     if ( !initialized ) {
+       initialized = true;
+       filteredArgs.push_back( "SMESH.MED_V2_1" );
+       filteredArgs.push_back( "SMESH.MED_V2_2" );
+     }  
+     return std::find( filteredArgs.begin(), filteredArgs.end(), theArg ) != filteredArgs.end();
+   }
  }
  
  //================================================================================
@@@ -464,7 -476,6 +476,6 @@@ SMESH_2smeshpy::ConvertScript(std::list
                                Resource_DataMapOfAsciiStringAsciiString& theEntry2AccessorMethod,
                                Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
                                std::set< TCollection_AsciiString >&      theRemovedObjIDs,
-                               SALOMEDS::Study_ptr&                      theStudy,
                                const bool                                theToKeepAllCommands)
  {
    std::list< TCollection_AsciiString >::iterator lineIt;
    theGen = new _pyGen( theEntry2AccessorMethod,
                         theObjectNames,
                         theRemovedObjIDs,
-                        theStudy,
                         theToKeepAllCommands );
  
    for ( lineIt = theScriptLines.begin(); lineIt != theScriptLines.end(); ++lineIt )
    set<_pyID> createdObjects;
    createdObjects.insert( "smeshBuilder" );
    createdObjects.insert( "smesh" );
-   createdObjects.insert( "theStudy" );
    for ( cmd = theGen->GetCommands().begin(); cmd != theGen->GetCommands().end(); ++cmd )
    {
  #ifdef DUMP_CONVERSION
  _pyGen::_pyGen(Resource_DataMapOfAsciiStringAsciiString& theEntry2AccessorMethod,
                 Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
                 std::set< TCollection_AsciiString >&      theRemovedObjIDs,
-                SALOMEDS::Study_ptr&                      theStudy,
                 const bool                                theToKeepAllCommands)
    : _pyObject( new _pyCommand( "", 0 )),
      myNbCommands( 0 ),
      myRemovedObjIDs( theRemovedObjIDs ),
      myNbFilters( 0 ),
      myToKeepAllCommands( theToKeepAllCommands ),
-     myStudy( SALOMEDS::Study::_duplicate( theStudy )),
      myGeomIDNb(0), myGeomIDIndex(-1)
  {
    // make that GetID() to return TPythonDump::SMESHGenName()
    GetCreationCmd()->GetString() += "=";
  
    // Find 1st digit of study entry by which a GEOM object differs from a SMESH object
-   if ( !theObjectNames.IsEmpty() && !CORBA::is_nil( theStudy ))
+   if ( !theObjectNames.IsEmpty() )
    {
      // find a GEOM entry
      _pyID geomID;
-     SALOMEDS::SComponent_wrap geomComp = theStudy->FindComponent("GEOM");
+     SALOMEDS::SComponent_wrap geomComp = SMESH_Gen_i::getStudyServant()->FindComponent("GEOM");
      if ( geomComp->_is_nil() ) return;
      CORBA::String_var entry = geomComp->GetID();
      geomID = entry.in();
@@@ -691,7 -698,7 +698,7 @@@ Handle(_pyCommand) _pyGen::AddCommand( 
        _AString newCmd = indent + tab + ( aCommand->GetString().ToCString() + indent.Length() );
        _AString pasCmd = indent + tab + "pass"; // to keep valid if newCmd is erased
        _AString excStr = indent + "except:";
-       _AString msgStr = indent + "\tprint '"; msgStr += method + "() failed. Invalid file name?'";
+       _AString msgStr = indent + "\tprint('"; msgStr += method + "() failed. Invalid file name?')";
  
        myCommands.insert( --myCommands.end(), new _pyCommand( tryStr, myNbCommands ));
        aCommand->Clear();
@@@ -1105,7 -1112,7 +1112,7 @@@ void _pyGen::Process( const Handle(_pyC
    static TStringSet smeshpyMethods;
    if ( smeshpyMethods.empty() ) {
      const char * names[] =
-       { "SetEmbeddedMode","IsEmbeddedMode","SetCurrentStudy","GetCurrentStudy",
+       { "SetEmbeddedMode","IsEmbeddedMode","UpdateStudy","GetStudy",
          "GetPattern","GetSubShapesId",
          "" }; // <- mark of array end
      smeshpyMethods.Insert( names );
@@@ -1677,7 -1684,7 +1684,7 @@@ bool _pyGen::IsNotPublished(const _pyID
    // either the SMESH object is not in study or it is a GEOM object
    if ( IsGeomObject( theObjID ))
    {
-     SALOMEDS::SObject_wrap so = myStudy->FindObjectID( theObjID.ToCString() );
+     SALOMEDS::SObject_wrap so = SMESH_Gen_i::getStudyServant()->FindObjectID( theObjID.ToCString() );
      if ( so->_is_nil() ) return true;
      CORBA::Object_var obj = so->GetObject();
      return CORBA::is_nil( obj );
@@@ -1980,16 -1987,26 +1987,26 @@@ void _pyMesh::Process( const Handle(_py
    // ----------------------------------------------------------------------
    else if ( theCommand->MethodStartsFrom( "Export" ))
    {
-     if ( method == "ExportToMED" ||  // ExportToMED()  --> ExportMED()
-          method == "ExportToMEDX" )  // ExportToMEDX() --> ExportMED()
+     if ( method == "ExportToMED"  || // ExportToMED()  --> ExportMED()
+          method == "ExportToMEDX" || // ExportToMEDX() --> ExportMED()
+          method == "ExportMED" )
      {
        theCommand->SetMethod( "ExportMED" );
-       if ( theCommand->GetNbArgs() == 5 )
+       // filter out deprecated version parameter
+       vector< _AString > args;
+       for ( int i = 1; i <= theCommand->GetNbArgs(); i++ ) {
+         if ( !_FilterArg( theCommand->GetArg( i ) ) )
+           args.push_back( theCommand->GetArg( i ) );
+       }
+       theCommand->RemoveArgs();
+       for ( uint i = 0; i < args.size(); i++ )
+         theCommand->SetArg( i+1, args[i] );
+       if ( theCommand->GetNbArgs() == 4 )
        {
          // ExportToMEDX(...,autoDimension) -> ExportToMEDX(...,meshPart=None,autoDimension)
-         _AString autoDimension = theCommand->GetArg( 5 );
-         theCommand->SetArg( 5, "None" );
-         theCommand->SetArg( 6, autoDimension );
+         _AString autoDimension = theCommand->GetArg( 4 );
+         theCommand->SetArg( 4, "None" );
+         theCommand->SetArg( 5, autoDimension );
        }
      }
      else if ( method == "ExportCGNS" )
        TCollection_AsciiString newMethod = method;
        newMethod.Remove( /*where=*/7, /*howmany=*/6 );
        theCommand->SetMethod( newMethod );
+       // filter out deprecated version parameter
+       vector< _AString > args;
+       for ( int i = 1; i <= theCommand->GetNbArgs(); i++ ) {
+         if ( !_FilterArg( theCommand->GetArg( i ) ) )
+           args.push_back( theCommand->GetArg( i ) );
+       }
+       theCommand->RemoveArgs();
+       for ( uint i = 0; i < args.size(); i++ )
+         theCommand->SetArg( i+1, args[i] );
        // make the 1st arg be the last one (or last but three for ExportMED())
        _pyID partID = theCommand->GetArg( 1 );
        int nbArgs = theCommand->GetNbArgs() - 3 * (newMethod == "ExportMED");
@@@ -2126,7 -2152,7 +2152,7 @@@ bool _pyMesh::NeedMeshAccess( const Han
      const char * names[] =
        { "ExportDAT","ExportUNV","ExportSTL","ExportSAUV", "RemoveGroup","RemoveGroupWithContents",
          "GetGroups","UnionGroups","IntersectGroups","CutGroups","CreateDimGroup","GetLog","GetId",
-         "ClearLog","GetStudyId","HasDuplicatedGroupNamesMED","GetMEDMesh","NbNodes","NbElements",
+         "ClearLog","HasDuplicatedGroupNamesMED","GetMEDMesh","NbNodes","NbElements",
          "NbEdges","NbEdgesOfOrder","NbFaces","NbFacesOfOrder","NbTriangles",
          "NbTrianglesOfOrder","NbQuadrangles","NbQuadranglesOfOrder","NbPolygons","NbVolumes",
          "NbVolumesOfOrder","NbTetras","NbTetrasOfOrder","NbHexas","NbHexasOfOrder",
@@@ -5056,7 -5082,7 +5082,7 @@@ bool _pyStringFamily::Add( const char* 
  
      _strings.erase( itLess, ++itMore );
    }
 -  else // to few string to make a family fot them
 +  else // too few string to make a family for them
    {
      _strings.insert( itStr, str );
    }
@@@ -5130,7 -5156,7 +5156,7 @@@ int _pyStringFamily::isIn( const char* 
        if (( len = itSub->isIn( str + itSub->_prefix.Length() )) >= 0 )
          return itSub->_prefix.Length() + len;
      }
 -    else if ( cmp > 0 )
 +    else if ( cmp < 0 )
        break;
    }
    if ( !_strings.empty() )
index ea45c41ce356f2b2070925e3f1c829db0c7f5353,bdf44dc4908d288304aa161f28a143cf7f080d9c..25f0c2c7faa0c680b485a26728beeae876271157
@@@ -85,6 -85,7 +85,6 @@@
  #include "MED_Factory.hxx"
  #include "SMDS_EdgePosition.hxx"
  #include "SMDS_FacePosition.hxx"
 -#include "SMDS_PolyhedralVolumeOfNodes.hxx"
  #include "SMDS_SetIterator.hxx"
  #include "SMDS_SpacePosition.hxx"
  #include "SMDS_VertexPosition.hxx"
  
  #include <map>
  #include <fstream>
+ #include <sstream>
  #include <cstdio>
  #include <cstdlib>
  
@@@ -177,23 -179,7 +178,23 @@@ PortableServer::ServantBase_var SMESH_G
      PortableServer::Servant aServant = GetPOA()->reference_to_servant( theObject );
      return aServant;
    }
 -  catch (...) {
 +  catch (PortableServer::POA::ObjectNotActive &ex)
 +  {
 +    INFOS("GetServant: ObjectNotActive");
 +    return NULL;
 +  }
 +  catch (PortableServer::POA::WrongAdapter &ex)
 +  {
 +    INFOS("GetServant: WrongAdapter: OK when several servants used to build several mesh in parallel...");
 +    return NULL;
 +  }
 +  catch (PortableServer::POA::WrongPolicy &ex)
 +  {
 +    INFOS("GetServant: WrongPolicy");
 +    return NULL;
 +  }
 +  catch (...)
 +  {
      INFOS( "GetServant - Unknown exception was caught!!!" );
      return NULL;
    }
@@@ -313,7 -299,10 +314,10 @@@ SMESH_Gen_i::SMESH_Gen_i( CORBA::ORB_pt
    _thisObj = this ;
    _id = myPoa->activate_object( _thisObj );
  
+   myStudyContext = new StudyContext;
    myIsEmbeddedMode = false;
+   myIsEnablePublish = true;
    myShapeReader = NULL;  // shape reader
    mySMESHGen = this;
    myIsHistoricalPythonDump = true;
@@@ -371,11 -360,8 +375,8 @@@ SMESH_Gen_i::~SMESH_Gen_i(
    myHypCreatorMap.clear();
  
    // Clear study contexts data
-   map<int, StudyContext*>::iterator it;
-   for ( it = myStudyContextMap.begin(); it != myStudyContextMap.end(); ++it ) {
-     delete it->second;
-   }
-   myStudyContextMap.clear();
+   delete myStudyContext;
    // delete shape reader
    if ( myShapeReader )
      delete myShapeReader;
@@@ -500,7 -486,7 +501,7 @@@ SMESH::SMESH_Hypothesis_ptr SMESH_Gen_i
      getHypothesisCreator(theHypName, theLibName, aPlatformLibName);
  
    // create a new hypothesis object, store its ref. in studyContext
-   myHypothesis_i = aCreator->Create(myPoa, GetCurrentStudyID(), &myGen);
+   myHypothesis_i = aCreator->Create(myPoa, &myGen);
    if (myHypothesis_i)
    {
      myHypothesis_i->SetLibName( aPlatformLibName.c_str() ); // for persistency assurance
@@@ -532,10 -518,10 +533,10 @@@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::crea
    // Get or create the GEOM_Client instance
    try {
      // create a new mesh object servant, store it in a map in study context
-     SMESH_Mesh_i* meshServant = new SMESH_Mesh_i( GetPOA(), this, GetCurrentStudyID() );
+     SMESH_Mesh_i* meshServant = new SMESH_Mesh_i( GetPOA(), this );
      // create a new mesh object
      if(MYDEBUG) MESSAGE("myIsEmbeddedMode " << myIsEmbeddedMode);
-     meshServant->SetImpl( myGen.CreateMesh( GetCurrentStudyID(), myIsEmbeddedMode ));
+     meshServant->SetImpl( myGen.CreateMesh( myIsEmbeddedMode ));
  
      // activate the CORBA servant of Mesh
      SMESH::SMESH_Mesh_var mesh = SMESH::SMESH_Mesh::_narrow( meshServant->_this() );
@@@ -629,85 -615,74 +630,74 @@@ CORBA::Boolean SMESH_Gen_i::IsEmbeddedM
  
  //=============================================================================
  /*!
-  *  SMESH_Gen_i::SetCurrentStudy
+  *  SMESH_Gen_i::SetEnablePublish
   *
-  *  Set current study
+  *  Set enable publishing in the study
   */
  //=============================================================================
- void SMESH_Gen_i::SetCurrentStudy( SALOMEDS::Study_ptr theStudy )
+ void SMESH_Gen_i::SetEnablePublish( CORBA::Boolean theIsEnablePublish )
  {
-   setCurrentStudy( theStudy );
+   myIsEnablePublish = theIsEnablePublish;
  }
  
- void SMESH_Gen_i::setCurrentStudy( SALOMEDS::Study_ptr theStudy,
-                                    bool                theStudyIsBeingClosed)
+ //=============================================================================
+ /*!
+  *  SMESH_Gen_i::IsEnablePublish
+  *
+  *  Check enable publishing
+  */
+ //=============================================================================
+ CORBA::Boolean SMESH_Gen_i::IsEnablePublish()
  {
-   int curStudyId = GetCurrentStudyID();
-   MESSAGE("curStudyId " << curStudyId);
-   myCurrentStudy = SALOMEDS::Study::_duplicate( theStudy );
-   // create study context, if it doesn't exist and set current study
-   int studyId = GetCurrentStudyID();
-   MESSAGE("studyId " << studyId);
-   if ( myStudyContextMap.find( studyId ) == myStudyContextMap.end() )
-     myStudyContextMap[ studyId ] = new StudyContext;
-   // myCurrentStudy may be nil
-   if ( !theStudyIsBeingClosed && !CORBA::is_nil( myCurrentStudy ) ) {
-     SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
-     SALOMEDS::SComponent_wrap GEOM_var = myCurrentStudy->FindComponent( "GEOM" );
-     if( !GEOM_var->_is_nil() )
-       aStudyBuilder->LoadWith( GEOM_var, GetGeomEngine() );
-     // NPAL16168, issue 0020210
-     // Let meshes update their data depending on GEOM groups that could change
-     if ( curStudyId != studyId )
-     {
-       MESSAGE("curStudyId " << curStudyId << " studyId " << studyId);
-       CORBA::String_var compDataType = ComponentDataType();
-       SALOMEDS::SComponent_wrap me = myCurrentStudy->FindComponent( compDataType.in() );
-       if ( !me->_is_nil() ) {
-         SALOMEDS::ChildIterator_wrap anIter = myCurrentStudy->NewChildIterator( me );
-         for ( ; anIter->More(); anIter->Next() ) {
-           SALOMEDS::SObject_wrap so = anIter->Value();
-           CORBA::Object_var     ior = SObjectToObject( so );
-           if ( SMESH_Mesh_i*   mesh = SMESH::DownCast<SMESH_Mesh_i*>( ior ))
-             mesh->CheckGeomModif();
-         }
-       }
-     }
-   }
+   return myIsEnablePublish;
  }
  
  //=============================================================================
  /*!
-  *  SMESH_Gen_i::GetCurrentStudy
+  *  SMESH_Gen_i::UpdateStudy
   *
-  *  Get current study
+  *  Update study (needed at switching GEOM->SMESH)
   */
  //=============================================================================
  
SALOMEDS::Study_ptr SMESH_Gen_i::GetCurrentStudy()
void SMESH_Gen_i::UpdateStudy()
  {
-   if(MYDEBUG) MESSAGE( "SMESH_Gen_i::GetCurrentStudy: study Id = " << GetCurrentStudyID() );
-   if ( GetCurrentStudyID() < 0 )
-     return SALOMEDS::Study::_nil();
-   return SALOMEDS::Study::_duplicate( myCurrentStudy );
+   if ( !myStudyContext )
+     myStudyContext = new StudyContext;
+   SALOMEDS::Study_var aStudy = getStudyServant();
+   if ( !CORBA::is_nil( aStudy ) ) {
+     SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
+     SALOMEDS::SComponent_wrap GEOM_var = aStudy->FindComponent( "GEOM" );
+     if( !GEOM_var->_is_nil() )
+       aStudyBuilder->LoadWith( GEOM_var, GetGeomEngine() );
+     // NPAL16168, issue 0020210
+     // Let meshes update their data depending on GEOM groups that could change
+     CORBA::String_var compDataType = ComponentDataType();
+     SALOMEDS::SComponent_wrap me = aStudy->FindComponent( compDataType.in() );
+     if ( !me->_is_nil() ) {
+       SALOMEDS::ChildIterator_wrap anIter = aStudy->NewChildIterator( me );
+       for ( ; anIter->More(); anIter->Next() ) {
+         SALOMEDS::SObject_wrap so = anIter->Value();
+         CORBA::Object_var     ior = SObjectToObject( so );
+         if ( SMESH_Mesh_i*   mesh = SMESH::DownCast<SMESH_Mesh_i*>( ior ))
+           mesh->CheckGeomModif();
+       }
+     }
+   }
  }
  
  //=============================================================================
  /*!
-  *  SMESH_Gen_i::GetCurrentStudyContext
+  *  SMESH_Gen_i::GetStudyContext
   *
-  *  Get current study context
+  *  Get study context
   */
  //=============================================================================
- StudyContext* SMESH_Gen_i::GetCurrentStudyContext()
+ StudyContext* SMESH_Gen_i::GetStudyContext()
  {
-   if ( !CORBA::is_nil( myCurrentStudy ) &&
-        myStudyContextMap.find( GetCurrentStudyID() ) != myStudyContextMap.end() )
-     return myStudyContextMap[ myCurrentStudy->StudyId() ];
-   else
-     return 0;
+   return myStudyContext;
  }
  
  //=============================================================================
@@@ -728,7 -703,7 +718,7 @@@ SMESH::SMESH_Hypothesis_ptr SMESH_Gen_i
  
    // Publish hypothesis/algorithm in the study
    if ( CanPublishInStudy( hyp ) ) {
-     SALOMEDS::SObject_wrap aSO = PublishHypothesis( myCurrentStudy, hyp );
+     SALOMEDS::SObject_wrap aSO = PublishHypothesis( hyp );
      if ( !aSO->_is_nil() ) {
        // Update Python script
        TPythonDump() << aSO << " = " << this << ".CreateHypothesis('"
@@@ -853,12 -828,12 +843,12 @@@ CORBA::Boolean SMESH_Gen_i::GetSoleSubM
                                                      SMESH::SMESH_Mesh_out       theMesh,
                                                      GEOM::GEOM_Object_out       theShape)
  {
-   if ( GetCurrentStudyID() < 0 || CORBA::is_nil( theHyp ))
+   if ( CORBA::is_nil( theHyp ))
      return false;
  
    // get Mesh component SO
    CORBA::String_var compDataType = ComponentDataType();
-   SALOMEDS::SComponent_wrap comp = myCurrentStudy->FindComponent( compDataType.in() );
+   SALOMEDS::SComponent_wrap comp = getStudyServant()->FindComponent( compDataType.in() );
    if ( CORBA::is_nil( comp ))
      return false;
  
    SMESH::SMESH_Mesh_var foundMesh;
    TopoDS_Shape          foundShape;
    bool                  isSole = true;
-   SALOMEDS::ChildIterator_wrap meshIter = myCurrentStudy->NewChildIterator( comp );
+   SALOMEDS::ChildIterator_wrap meshIter = getStudyServant()->NewChildIterator( comp );
    for ( ; meshIter->More() && isSole; meshIter->Next() )
    {
      SALOMEDS::SObject_wrap curSO = meshIter->Value();
@@@ -1072,9 -1047,9 +1062,9 @@@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::Crea
  
    // publish mesh in the study
    if ( CanPublishInStudy( mesh ) ) {
-     SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
+     SALOMEDS::StudyBuilder_var aStudyBuilder = getStudyServant()->NewBuilder();
      aStudyBuilder->NewCommand();  // There is a transaction
-     SALOMEDS::SObject_wrap aSO = PublishMesh( myCurrentStudy, mesh.in() );
+     SALOMEDS::SObject_wrap aSO = PublishMesh( mesh.in() );
      aStudyBuilder->CommitCommand();
      if ( !aSO->_is_nil() ) {
        // Update Python script
@@@ -1103,9 -1078,9 +1093,9 @@@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::Crea
  
    // publish mesh in the study
    if ( CanPublishInStudy( mesh ) ) {
-     SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
+     SALOMEDS::StudyBuilder_var aStudyBuilder = getStudyServant()->NewBuilder();
      aStudyBuilder->NewCommand();  // There is a transaction
-     SALOMEDS::SObject_wrap aSO = PublishMesh( myCurrentStudy, mesh.in() );
+     SALOMEDS::SObject_wrap aSO = PublishMesh( mesh.in() );
      aStudyBuilder->CommitCommand();
      if ( !aSO->_is_nil() ) {
        // Update Python script
@@@ -1158,9 -1133,9 +1148,9 @@@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::Crea
    string aFileName;
    // publish mesh in the study
    if ( CanPublishInStudy( aMesh ) ) {
-     SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
+     SALOMEDS::StudyBuilder_var aStudyBuilder = getStudyServant()->NewBuilder();
      aStudyBuilder->NewCommand();  // There is a transaction
-     SALOMEDS::SObject_wrap aSO = PublishMesh( myCurrentStudy, aMesh.in(), aFileName.c_str() );
+     SALOMEDS::SObject_wrap aSO = PublishMesh( aMesh.in(), aFileName.c_str() );
      aStudyBuilder->CommitCommand();
      if ( !aSO->_is_nil() ) {
        // Update Python script
@@@ -1216,11 -1191,9 +1206,9 @@@ SMESH::mesh_array* SMESH_Gen_i::CreateM
  
    if (theStatus == SMESH::DRS_OK) {
      SALOMEDS::StudyBuilder_var aStudyBuilder;
-     if ( GetCurrentStudyID() > -1 )
-     {
-       aStudyBuilder = myCurrentStudy->NewBuilder();
-       aStudyBuilder->NewCommand();  // There is a transaction
-     }
+     aStudyBuilder = getStudyServant()->NewBuilder();
+     aStudyBuilder->NewCommand();  // There is a transaction
      aResult->length( aNames.size() );
      int i = 0;
  
          // little trick: for MED file theFileName and theFileNameForPython are the same, but they are different for SAUV
          // - as names of meshes are stored in MED file, we use them for data publishing
          // - as mesh name is not stored in UNV file, we use file name as name of mesh when publishing data
-         aSO = PublishMesh( myCurrentStudy, mesh.in(), ( theFileName == theFileNameForPython ) ? (*it).c_str() : aFileName.c_str() );
+         aSO = PublishMesh( mesh.in(), ( theFileName == theFileNameForPython ) ? (*it).c_str() : aFileName.c_str() );
  
        // Python Dump
        if ( !aSO->_is_nil() ) {
@@@ -1306,7 -1279,7 +1294,7 @@@ SMESH::mesh_array* SMESH_Gen_i::CreateM
  #ifdef WIN32
    cmd = "%PYTHONBIN% ";
  #else
-   cmd = "python ";
+   cmd = "python3 ";
  #endif
    cmd += "-c \"";
    cmd += "from medutilities import convert ; convert(r'" + sauvfilename + "', 'GIBI', 'MED', 1, r'" + medfilename + "')";
  #ifdef WIN32
    cmd = "%PYTHONBIN% ";
  #else
-   cmd = "python ";
+   cmd = "python3 ";
  #endif
    cmd += "-c \"";
    cmd += "from medutilities import my_remove ; my_remove(r'" + medfilename + "')";
@@@ -1350,10 -1323,9 +1338,9 @@@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::Crea
  #endif
    // publish mesh in the study
    if ( CanPublishInStudy( aMesh ) ) {
-     SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
+     SALOMEDS::StudyBuilder_var aStudyBuilder = getStudyServant()->NewBuilder();
      aStudyBuilder->NewCommand();  // There is a transaction
-     SALOMEDS::SObject_wrap aSO = PublishInStudy
-       ( myCurrentStudy, SALOMEDS::SObject::_nil(), aMesh.in(), aFileName.c_str() );
+     SALOMEDS::SObject_wrap aSO = PublishInStudy( SALOMEDS::SObject::_nil(), aMesh.in(), aFileName.c_str() );
      aStudyBuilder->CommitCommand();
      if ( !aSO->_is_nil() ) {
        // Update Python script
@@@ -1401,7 -1373,7 +1388,7 @@@ SMESH::mesh_array* SMESH_Gen_i::CreateM
  
      if (theStatus == SMESH::DRS_OK)
      {
-       SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
+       SALOMEDS::StudyBuilder_var aStudyBuilder = getStudyServant()->NewBuilder();
        aStudyBuilder->NewCommand();  // There is a transaction
  
        int i = 0;
          // publish mesh in the study
          SALOMEDS::SObject_wrap aSO;
          if ( CanPublishInStudy( mesh ) )
-           aSO = PublishMesh( myCurrentStudy, mesh.in(), meshName.c_str() );
+           aSO = PublishMesh( mesh.in(), meshName.c_str() );
  
          // Python Dump
          if ( !aSO->_is_nil() ) {
@@@ -1479,10 -1451,9 +1466,9 @@@ SMESH_Gen_i::CreateMeshesFromGMF( cons
  #endif
    // publish mesh in the study
    if ( CanPublishInStudy( aMesh ) ) {
-     SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
+     SALOMEDS::StudyBuilder_var aStudyBuilder = getStudyServant()->NewBuilder();
      aStudyBuilder->NewCommand();  // There is a transaction
-     SALOMEDS::SObject_wrap aSO = PublishInStudy
-       ( myCurrentStudy, SALOMEDS::SObject::_nil(), aMesh.in(), aFileName.c_str() );
+     SALOMEDS::SObject_wrap aSO = PublishInStudy( SALOMEDS::SObject::_nil(), aMesh.in(), aFileName.c_str() );
      aStudyBuilder->CommitCommand();
      if ( !aSO->_is_nil() ) {
        // Update Python script
@@@ -1549,16 -1520,17 +1535,17 @@@ CORBA::Boolean SMESH_Gen_i::IsReadyToCo
  SALOMEDS::SObject_ptr SMESH_Gen_i::GetAlgoSO(const ::SMESH_Algo* algo)
  {
    if ( algo ) {
-     if ( !myCurrentStudy->_is_nil() ) {
+   SALOMEDS::Study_var aStudy = getStudyServant();
+     if ( !aStudy->_is_nil() ) {
        // find algo in the study
        CORBA::String_var compDataType  = ComponentDataType();
-       SALOMEDS::SComponent_wrap father = myCurrentStudy->FindComponent( compDataType.in() );
+       SALOMEDS::SComponent_wrap father = aStudy->FindComponent( compDataType.in() );
        if ( !father->_is_nil() ) {
-         SALOMEDS::ChildIterator_wrap itBig = myCurrentStudy->NewChildIterator( father );
+         SALOMEDS::ChildIterator_wrap itBig = aStudy->NewChildIterator( father );
          for ( ; itBig->More(); itBig->Next() ) {
            SALOMEDS::SObject_wrap gotBranch = itBig->Value();
            if ( gotBranch->Tag() == GetAlgorithmsRootTag() ) {
-             SALOMEDS::ChildIterator_wrap algoIt = myCurrentStudy->NewChildIterator( gotBranch );
+             SALOMEDS::ChildIterator_wrap algoIt = aStudy->NewChildIterator( gotBranch );
              for ( ; algoIt->More(); algoIt->Next() ) {
                SALOMEDS::SObject_wrap algoSO = algoIt->Value();
                CORBA::Object_var     algoIOR = SObjectToObject( algoSO );
@@@ -1638,7 -1610,7 +1625,7 @@@ SMESH::compute_error_array* SMESH_Gen_i
            else {
              errStruct.algoName = error->myAlgo->GetName();
            }
 -          errStruct.hasBadMesh = !error->myBadElements.empty();
 +          errStruct.hasBadMesh = error->HasBadElems();
          }
        }
        error_array->length( nbErr );
@@@ -1680,7 -1652,7 +1667,7 @@@ SMESH_Gen_i::GetBadInputElements( SMESH
        {
          // compute error
          SMESH_ComputeErrorPtr error = sm->GetComputeError();
 -        if ( error && !error->myBadElements.empty())
 +        if ( error && error->HasBadElems() )
          {
            typedef map<const SMDS_MeshElement*, int > TNode2LocalIDMap;
            typedef TNode2LocalIDMap::iterator         TNodeLocalID;
            list< TNodeLocalID > connectivity;
            int i, nbElements = 0, nbConnNodes = 0;
  
 -          list<const SMDS_MeshElement*>::iterator elemIt  = error->myBadElements.begin();
 -          list<const SMDS_MeshElement*>::iterator elemEnd = error->myBadElements.end();
 +          const list<const SMDS_MeshElement*>& badElems =
 +            static_cast<SMESH_BadInputElements*>( error.get() )->myBadElements;
 +          list<const SMDS_MeshElement*>::const_iterator elemIt  = badElems.begin();
 +          list<const SMDS_MeshElement*>::const_iterator elemEnd = badElems.end();
            for ( ; elemIt != elemEnd; ++elemIt, ++nbElements )
            {
              SMDS_ElemIteratorPtr nIt = (*elemIt)->nodesIterator();
            }
            // fill element types
            result->elementTypes.length( nbElements );
 -          for ( i = 0, elemIt = error->myBadElements.begin(); i <nbElements; ++i, ++elemIt )
 +          for ( i = 0, elemIt = badElems.begin(); i <nbElements; ++i, ++elemIt )
            {
              const SMDS_MeshElement* elem = *elemIt;
              result->elementTypes[i].SMDS_ElementType = (SMESH::ElementType) elem->GetType();
@@@ -2296,16 -2266,16 +2283,16 @@@ SMESH_Gen_i::GetGeometryByMeshElement( 
      GEOM::GEOM_Gen_ptr    geomGen   = GetGeomEngine();
  
      // try to find the corresponding SObject
-     SALOMEDS::SObject_wrap SObj = ObjectToSObject( myCurrentStudy, geom.in() );
+     SALOMEDS::SObject_wrap SObj = ObjectToSObject( geom.in() );
      if ( SObj->_is_nil() ) // submesh can be not found even if published
      {
        // try to find published submesh
        GEOM::ListOfLong_var list = geom->GetSubShapeIndices();
        if ( !geom->IsMainShape() && list->length() == 1 ) {
-         SALOMEDS::SObject_wrap mainSO = ObjectToSObject( myCurrentStudy, mainShape );
+         SALOMEDS::SObject_wrap mainSO = ObjectToSObject( mainShape );
          SALOMEDS::ChildIterator_wrap it;
          if ( !mainSO->_is_nil() ) {
-           it = myCurrentStudy->NewChildIterator( mainSO );
+           it = getStudyServant()->NewChildIterator( mainSO );
          }
          if ( !it->_is_nil() ) {
            for ( it->InitEx(true); it->More(); it->Next() ) {
        }
      }
      if ( SObj->_is_nil() ) // publish a new subshape
-       SObj = geomGen->AddInStudy( myCurrentStudy, geom, theGeomName, mainShape );
+       SObj = geomGen->AddInStudy( geom, theGeomName, mainShape );
  
      // return only published geometry
      if ( !SObj->_is_nil() ) {
@@@ -2373,10 -2343,10 +2360,10 @@@ SMESH_Gen_i::FindGeometryByMeshElement
          GEOM::GEOM_Object_var geom = ShapeToGeomObject( meshDS->IndexToShape( shapeID ));
          if ( geom->_is_nil() ) {
            // try to find a published sub-shape
-           SALOMEDS::SObject_wrap mainSO = ObjectToSObject( myCurrentStudy, mainShape );
+           SALOMEDS::SObject_wrap mainSO = ObjectToSObject( mainShape );
            SALOMEDS::ChildIterator_wrap it;
            if ( !mainSO->_is_nil() ) {
-             it = myCurrentStudy->NewChildIterator( mainSO );
+             it = getStudyServant()->NewChildIterator( mainSO );
            }
            if ( !it->_is_nil() ) {
              for ( it->InitEx(true); it->More(); it->Next() ) {
          }
          if ( geom->_is_nil() ) {
            // explode
-           GEOM::GEOM_IShapesOperations_wrap op =
-             geomGen->GetIShapesOperations( GetCurrentStudyID() );
+           GEOM::GEOM_IShapesOperations_wrap op = geomGen->GetIShapesOperations();
            if ( !op->_is_nil() )
              geom = op->GetSubShape( mainShape, shapeID );
          }
@@@ -2474,240 -2443,281 +2460,240 @@@ SMESH_Gen_i::ConcatenateCommon(const SM
                                 CORBA::Boolean                theCommonGroups)
    throw ( SALOME::SALOME_Exception )
  {
 -  typedef list<SMESH::SMESH_Group_var> TListOfNewGroups;
 -  typedef map< pair<string, SMESH::ElementType>, TListOfNewGroups > TGroupsMap;
 -
 -  TPythonDump* pPythonDump = new TPythonDump;
 -  TPythonDump& aPythonDump = *pPythonDump; // prevent dump of called methods
 +  std::unique_ptr< TPythonDump > pPythonDump( new TPythonDump );
 +  TPythonDump& pythonDump = *pPythonDump; // prevent dump of called methods
  
    // create mesh
 -  SMESH::SMESH_Mesh_var aNewMesh = CreateEmptyMesh();
 -
 -  if ( aNewMesh->_is_nil() )
 -    return aNewMesh._retn();
 +  SMESH::SMESH_Mesh_var newMesh = CreateEmptyMesh();
 +  SMESH_Mesh_i*         newImpl = SMESH::DownCast<SMESH_Mesh_i*>( newMesh );
 +  if ( !newImpl ) return newMesh._retn();
  
 -  SMESH_Mesh_i* aNewImpl = SMESH::DownCast<SMESH_Mesh_i*>( aNewMesh );
 -  if ( !aNewImpl )
 -    return aNewMesh._retn();
 +  ::SMESH_Mesh&   locMesh = newImpl->GetImpl();
 +  SMESHDS_Mesh* newMeshDS = locMesh.GetMeshDS();
  
 -  ::SMESH_Mesh& aLocMesh = aNewImpl->GetImpl();
 -  SMESHDS_Mesh* aNewMeshDS = aLocMesh.GetMeshDS();
 +  typedef std::list<SMESH::SMESH_Group_var>          TListOfNewGroups;
 +  typedef std::pair<string, SMESH::ElementType >     TNameAndType;
 +  typedef std::map< TNameAndType, TListOfNewGroups > TGroupsMap;
 +  TGroupsMap       groupsMap;
 +  TListOfNewGroups listOfNewGroups;
  
 -  TGroupsMap aGroupsMap;
 -  TListOfNewGroups aListOfNewGroups;
 -  ::SMESH_MeshEditor aNewEditor(&aLocMesh);
 -  SMESH::ListOfGroups_var aListOfGroups;
 -
 -  ::SMESH_MeshEditor::ElemFeatures  elemType;
 -  std::vector<const SMDS_MeshNode*> aNodesArray;
 +  ::SMESH_MeshEditor               newEditor( &locMesh );
 +  ::SMESH_MeshEditor::ElemFeatures elemType;
  
    // loop on sub-meshes
 -  for ( CORBA::ULong i = 0; i < theMeshesArray.length(); i++)
 +  for ( CORBA::ULong i = 0; i < theMeshesArray.length(); i++ )
    {
      if ( CORBA::is_nil( theMeshesArray[i] )) continue;
 -    SMESH::SMESH_Mesh_var anInitMesh = theMeshesArray[i]->GetMesh();
 -    if ( anInitMesh->_is_nil() ) continue;
 -    SMESH_Mesh_i* anInitImpl = SMESH::DownCast<SMESH_Mesh_i*>( anInitMesh );
 -    if ( !anInitImpl ) continue;
 -    anInitImpl->Load();
 -
 -    //::SMESH_Mesh& aInitLocMesh = anInitImpl->GetImpl();
 -    //SMESHDS_Mesh* anInitMeshDS = aInitLocMesh.GetMeshDS();
 +    SMESH::SMESH_Mesh_var initMesh = theMeshesArray[i]->GetMesh();
 +    SMESH_Mesh_i*         initImpl = SMESH::DownCast<SMESH_Mesh_i*>( initMesh );
 +    if ( !initImpl ) continue;
 +    initImpl->Load();
 +
 +    // assure that IDs increments by one during iteration
 +    ::SMESH_Mesh& initLocMesh = initImpl->GetImpl();
 +    SMESHDS_Mesh*  initMeshDS = initLocMesh.GetMeshDS();
 +    if ( initMeshDS->MaxNodeID()    > initMeshDS->NbNodes() ||
 +         initMeshDS->MaxElementID() > initMeshDS->NbElements() )
 +    {
 +      initMeshDS->Modified();
 +      initMeshDS->CompactMesh();
 +    }
  
      // remember nb of elements before filling in
 -    SMESH::long_array_var prevState =  aNewMesh->GetNbElementsByType();
 +    SMESH::long_array_var prevState =  newMesh->GetNbElementsByType();
  
 -    typedef std::map<const SMDS_MeshElement*, const SMDS_MeshElement*, TIDCompare > TEEMap;
 -    TEEMap elemsMap, nodesMap;
 +    // copy nodes
 +
 +    std::vector< const SMDS_MeshElement* > newNodes( initMeshDS->NbNodes() + 1, 0 );
 +    SMDS_ElemIteratorPtr elemIt = initImpl->GetElements( theMeshesArray[i], SMESH::NODE );
 +    while ( elemIt->more() )
 +    {
 +      SMESH_NodeXYZ node = elemIt->next();
 +      newNodes[ node->GetID() ] = newMeshDS->AddNode( node.X(), node.Y(), node.Z() );
 +    }
  
 -    // loop on elements of a sub-mesh
 -    SMDS_ElemIteratorPtr itElems = anInitImpl->GetElements( theMeshesArray[i], SMESH::ALL );
 -    const SMDS_MeshElement* anElem;
 -    const SMDS_MeshElement* aNewElem;
 -    const SMDS_MeshNode*    aNode;
 -    const SMDS_MeshNode*    aNewNode;
 -    int anElemNbNodes;
 +    // copy elements
  
 -    while ( itElems->more() )
 +    std::vector< const SMDS_MeshElement* > newElems( initMeshDS->NbElements() + 1, 0 );
 +    elemIt = initImpl->GetElements( theMeshesArray[i], SMESH::ALL );
 +    while ( elemIt->more() )
      {
 -      anElem = itElems->next();
 -      anElemNbNodes = anElem->NbNodes();
 -      aNodesArray.resize( anElemNbNodes );
 +      const SMDS_MeshElement* elem = elemIt->next();
 +      elemType.myNodes.resize( elem->NbNodes() );
  
 -      // loop on nodes of an element
 -      SMDS_ElemIteratorPtr itNodes = anElem->nodesIterator();
 +      SMDS_NodeIteratorPtr itNodes = elem->nodeIterator();
        for ( int k = 0; itNodes->more(); k++)
        {
 -        aNode = static_cast<const SMDS_MeshNode*>( itNodes->next() );
 -        TEEMap::iterator n2nnIt = nodesMap.find( aNode );
 -        if ( n2nnIt == nodesMap.end() )
 -        {
 -          aNewNode = aNewMeshDS->AddNode(aNode->X(), aNode->Y(), aNode->Z());
 -          nodesMap.insert( make_pair( aNode, aNewNode ));
 -        }
 -        else
 -        {
 -          aNewNode = static_cast<const SMDS_MeshNode*>( n2nnIt->second );
 -        }
 -        aNodesArray[k] = aNewNode;
 +        const SMDS_MeshNode* node = itNodes->next();
 +        elemType.myNodes[ k ] = static_cast< const SMDS_MeshNode*> ( newNodes[ node->GetID() ]);
        }
  
        // creates a corresponding element on existent nodes in new mesh
 -      if ( anElem->GetType() == SMDSAbs_Node )
 -        aNewElem = 0;
 -      else
 -        aNewElem =
 -          aNewEditor.AddElement( aNodesArray, elemType.Init( anElem, /*basicOnly=*/false ));
 -
 -      if ( aNewElem )
 -        elemsMap.insert( make_pair( anElem, aNewElem ));
 -
 -    } //elems loop
 -
 -    aNewEditor.ClearLastCreated(); // forget the history
 +      newElems[ elem->GetID() ] =
 +        newEditor.AddElement( elemType.myNodes, elemType.Init( elem, /*basicOnly=*/false ));
 +    }
 +    newEditor.ClearLastCreated(); // forget the history
  
  
      // create groups of just added elements
 -    SMESH::SMESH_Group_var aNewGroup;
 -    SMESH::ElementType aGroupType;
 +    SMESH::SMESH_Group_var newGroup;
 +    SMESH::ElementType     groupType;
      if ( theCommonGroups )
      {
 -      SMESH::long_array_var curState = aNewMesh->GetNbElementsByType();
 +      // type names
 +      const char* typeNames[] = { "All","Nodes","Edges","Faces","Volumes","0DElems","Balls" };
 +      { // check of typeNames: compilation failure mains that NB_ELEMENT_TYPES changed:
 +        const int nbNames = sizeof(typeNames) / sizeof(const char*);
 +        int _assert[( nbNames == SMESH::NB_ELEMENT_TYPES ) ? 2 : -1 ]; _assert[0]=_assert[1]=0;
 +      }
 +
 +      SMESH::long_array_var curState = newMesh->GetNbElementsByType();
  
 -      for( aGroupType = SMESH::NODE;
 -           aGroupType < SMESH::NB_ELEMENT_TYPES;
 -           aGroupType = (SMESH::ElementType)( aGroupType + 1 ))
 +      for( groupType = SMESH::NODE;
 +           groupType < SMESH::NB_ELEMENT_TYPES;
 +           groupType = (SMESH::ElementType)( groupType + 1 ))
        {
 -        if ( curState[ aGroupType ] <= prevState[ aGroupType ])
 -          continue;
 +        if ( curState[ groupType ] <= prevState[ groupType ])
 +          continue; // no elements of groupType added from the i-th mesh
  
          // make a group name
 -        const char* typeNames[] = { "All","Nodes","Edges","Faces","Volumes","0DElems","Balls" };
 -        { // check of typeNames: compilation failure mains that NB_ELEMENT_TYPES changed:
 -          const int nbNames = sizeof(typeNames) / sizeof(const char*);
 -          int _assert[( nbNames == SMESH::NB_ELEMENT_TYPES ) ? 2 : -1 ]; _assert[0]=_assert[1]=0;
 -        }
 -        string groupName = "Gr";
 -        SALOMEDS::SObject_wrap aMeshSObj = ObjectToSObject( theMeshesArray[i] );
 -        if ( aMeshSObj ) {
 -          CORBA::String_var name = aMeshSObj->GetName();
 +        std::string groupName = "Gr";
-         SALOMEDS::SObject_wrap meshSO = ObjectToSObject( myCurrentStudy, theMeshesArray[i] );
++        SALOMEDS::SObject_wrap meshSO = ObjectToSObject( theMeshesArray[i] );
 +        if ( meshSO ) {
 +          CORBA::String_var name = meshSO->GetName();
            groupName += name;
          }
          groupName += "_";
 -        groupName += typeNames[ aGroupType ];
 +        groupName += typeNames[ groupType ];
  
          // make and fill a group
 -        TEEMap & e2neMap = ( aGroupType == SMESH::NODE ) ? nodesMap : elemsMap;
 -        aNewGroup = aNewImpl->CreateGroup( aGroupType, groupName.c_str() );
 -        if ( SMESH_Group_i* grp_i = SMESH::DownCast<SMESH_Group_i*>( aNewGroup ))
 +        newGroup = newImpl->CreateGroup( groupType, groupName.c_str() );
 +        std::vector< const SMDS_MeshElement* > & elemVec =
 +          ( groupType == SMESH::NODE ) ? newNodes : newElems;
 +        if ( SMESH_Group_i* grp_i = SMESH::DownCast<SMESH_Group_i*>( newGroup ))
          {
            if ( SMESHDS_Group* grpDS = dynamic_cast<SMESHDS_Group*>( grp_i->GetGroupDS() ))
            {
 -            TEEMap::iterator e2neIt = e2neMap.begin();
 -            for ( ; e2neIt != e2neMap.end(); ++e2neIt )
 +            for ( size_t j = 0; j < elemVec.size(); ++j )
              {
 -              aNewElem = e2neIt->second;
 -              if ( aNewElem->GetType() == grpDS->GetType() )
 -              {
 -                grpDS->Add( aNewElem );
 -
 -                if ( prevState[ aGroupType ]++ >= curState[ aGroupType ] )
 -                  break;
 -              }
 +              if ( elemVec[j] && elemVec[j]->GetType() == grpDS->GetType() )
 +                grpDS->Add( elemVec[j] );
              }
            }
          }
 -        aListOfNewGroups.clear();
 -        aListOfNewGroups.push_back(aNewGroup);
 -        aGroupsMap.insert(make_pair( make_pair(groupName, aGroupType), aListOfNewGroups ));
 +        listOfNewGroups.clear();
 +        listOfNewGroups.push_back( newGroup );
 +        groupsMap.insert( std::make_pair( TNameAndType( groupName, groupType ),
 +                                          listOfNewGroups ));
        }
      }
  
 -    if ( SMESH_Mesh_i* anSrcImpl = SMESH::DownCast<SMESH_Mesh_i*>( theMeshesArray[i] ))
 +    if ( SMESH_Mesh_i* initImpl = SMESH::DownCast<SMESH_Mesh_i*>( theMeshesArray[i] ))
      {
 -      // copy orphan nodes
 -      if ( anSrcImpl->NbNodes() > (int)nodesMap.size() )
 -      {
 -        SMDS_ElemIteratorPtr itNodes = anInitImpl->GetElements( theMeshesArray[i], SMESH::NODE );
 -        while ( itNodes->more() )
 -        {
 -          const SMDS_MeshNode* aNode = static_cast< const SMDS_MeshNode* >( itNodes->next() );
 -          if ( aNode->NbInverseElements() == 0 )
 -          {
 -            aNewNode = aNewMeshDS->AddNode(aNode->X(), aNode->Y(), aNode->Z());
 -            nodesMap.insert( make_pair( aNode, aNewNode ));
 -          }
 -        }
 -      }
 -
        // copy groups
  
 -      SMESH::SMESH_GroupBase_ptr aGroup;
 -      CORBA::String_var aGroupName;
 -      SMESH::long_array_var anNewIDs = new SMESH::long_array();
 +      SMESH::SMESH_GroupBase_ptr group;
 +      CORBA::String_var          groupName;
 +      SMESH::long_array_var newIDs = new SMESH::long_array();
  
        // loop on groups of a source mesh
 -      aListOfGroups = anSrcImpl->GetGroups();
 -      for ( CORBA::ULong iG = 0; iG < aListOfGroups->length(); iG++ )
 +      SMESH::ListOfGroups_var listOfGroups = initImpl->GetGroups();
 +      for ( CORBA::ULong iG = 0; iG < listOfGroups->length(); iG++ )
        {
 -        aGroup = aListOfGroups[iG];
 -        aGroupType = aGroup->GetType();
 -        aGroupName = aGroup->GetName();
 -        string aName = aGroupName.in();
 +        group     = listOfGroups[iG];
 +        groupType = group->GetType();
 +        groupName = group->GetName();
 +        std::string name = groupName.in();
  
          // convert a list of IDs
 -        anNewIDs->length( aGroup->Size() );
 -        TEEMap & e2neMap = ( aGroupType == SMESH::NODE ) ? nodesMap : elemsMap;
 -        SMDS_ElemIteratorPtr itGrElems = anSrcImpl->GetElements( aGroup, SMESH::ALL );
 -        int iElem = 0;
 +        newIDs->length( group->Size() );
 +        std::vector< const SMDS_MeshElement* > & elemVec =
 +          ( groupType == SMESH::NODE ) ? newNodes : newElems;
 +        SMDS_ElemIteratorPtr itGrElems = initImpl->GetElements( group, SMESH::ALL );
 +        int nbElems = 0;
          while ( itGrElems->more() )
          {
 -          anElem = itGrElems->next();
 -          TEEMap::iterator e2neIt = e2neMap.find( anElem );
 -          if ( e2neIt != e2neMap.end() )
 -            anNewIDs[ iElem++ ] = e2neIt->second->GetID();
 +          const SMDS_MeshElement*    elem = itGrElems->next();
 +          const SMDS_MeshElement* newElem = elemVec[ elem->GetID() ];
 +          if ( newElem )
 +            newIDs[ nbElems++ ] = newElem->GetID();
          }
 -        anNewIDs->length( iElem );
 +        newIDs->length( nbElems );
  
 -        // check a current group name and type don't have identical ones in final mesh
 -        aListOfNewGroups.clear();
 -        TGroupsMap::iterator anIter = aGroupsMap.find( make_pair( aName, aGroupType ));
 -        if ( anIter == aGroupsMap.end() ) {
 +        // check that a current group name and type don't have identical ones in final mesh
 +        listOfNewGroups.clear();
 +        TNameAndType nameAndType( name, groupType );
 +        TGroupsMap::iterator anIter = groupsMap.find( nameAndType );
 +        if ( anIter == groupsMap.end() )
 +        {
            // add a new group in the mesh
 -          aNewGroup = aNewImpl->CreateGroup( aGroupType, aGroupName.in() );
 -          // add elements into new group
 -          aNewGroup->Add( anNewIDs );
 +          newGroup = newImpl->CreateGroup( groupType, groupName.in() );
 +          newGroup->Add( newIDs );
  
 -          aListOfNewGroups.push_back(aNewGroup);
 -          aGroupsMap.insert(make_pair( make_pair(aName, aGroupType), aListOfNewGroups ));
 +          listOfNewGroups.push_back( newGroup );
 +          groupsMap.insert( std::make_pair( nameAndType, listOfNewGroups ));
          }
 -
 -        else if ( theUniteIdenticalGroups ) {
 +        else if ( theUniteIdenticalGroups )
 +        {
            // unite identical groups
            TListOfNewGroups& aNewGroups = anIter->second;
 -          aNewGroups.front()->Add( anNewIDs );
 +          aNewGroups.front()->Add( newIDs );
          }
 -
 -        else {
 +        else
 +        {
            // rename identical groups
 -          aNewGroup = aNewImpl->CreateGroup(aGroupType, aGroupName.in());
 -          aNewGroup->Add( anNewIDs );
 +          newGroup = newImpl->CreateGroup( groupType, groupName );
 +          newGroup->Add( newIDs );
  
 -          TListOfNewGroups& aNewGroups = anIter->second;
 -          string aNewGroupName;
 -          if (aNewGroups.size() == 1) {
 -            aNewGroupName = aName + "_1";
 -            aNewGroups.front()->SetName(aNewGroupName.c_str());
 +          TListOfNewGroups& newGroups = anIter->second;
 +          std::string newGroupName;
 +          if ( newGroups.size() == 1 )
 +          {
 +            newGroupName = name + "_1";
 +            newGroups.front()->SetName( newGroupName.c_str() );
            }
 -          char aGroupNum[128];
 -          sprintf(aGroupNum, "%u", (unsigned int)aNewGroups.size()+1);
 -          aNewGroupName = aName + "_" + string(aGroupNum);
 -          aNewGroup->SetName(aNewGroupName.c_str());
 -          aNewGroups.push_back(aNewGroup);
 +          newGroupName = name + "_" + SMESH_Comment( newGroups.size() + 1 );
 +          newGroup->SetName( newGroupName.c_str() );
 +          newGroups.push_back( newGroup );
          }
 -      } //groups loop
 +      } // loop on groups
      } // if an IDSource is a mesh
    } //meshes loop
  
 -  if (theMergeNodesAndElements) // merge nodes
 +  if ( theMergeNodesAndElements ) // merge nodes
    {
 -    TIDSortedNodeSet aMeshNodes; // no input nodes
 -    SMESH_MeshEditor::TListOfListOfNodes aGroupsOfNodes;
 -    aNewEditor.FindCoincidentNodes( aMeshNodes, theMergeTolerance, aGroupsOfNodes,
 -                                    /*SeparateCornersAndMedium=*/ false );
 -    aNewEditor.MergeNodes( aGroupsOfNodes );
 +    TIDSortedNodeSet meshNodes; // no input nodes == treat all
 +    SMESH_MeshEditor::TListOfListOfNodes groupsOfNodes;
 +    newEditor.FindCoincidentNodes( meshNodes, theMergeTolerance, groupsOfNodes,
 +                                   /*SeparateCornersAndMedium=*/ false );
 +    newEditor.MergeNodes( groupsOfNodes );
      // merge elements
 -    aNewEditor.MergeEqualElements();
 +    newEditor.MergeEqualElements();
    }
  
    // Update Python script
 -  aPythonDump << aNewMesh << " = " << this << "."
 -              << ( theCommonGroups ? "ConcatenateWithGroups" : "Concatenate" )
 -              << "([";
 -  for ( CORBA::ULong i = 0; i < theMeshesArray.length(); i++) {
 -    if (i > 0) aPythonDump << ", ";
 -    aPythonDump << theMeshesArray[i];
 -  }
 -  aPythonDump << "], ";
 -  aPythonDump << theUniteIdenticalGroups << ", "
 -              << theMergeNodesAndElements << ", "
 -              << TVar( theMergeTolerance ) << ")";
 +  pythonDump << newMesh << " = " << this
 +             << "." << ( theCommonGroups ? "ConcatenateWithGroups" : "Concatenate" ) << "("
 +             << theMeshesArray << ", "
 +             << theUniteIdenticalGroups << ", "
 +             << theMergeNodesAndElements << ", "
 +             << TVar( theMergeTolerance ) << ")";
  
 -  delete pPythonDump; // enable python dump from GetGroups()
 +  pPythonDump.reset(); // enable python dump from GetGroups()
  
    // 0020577: EDF 1164 SMESH: Bad dump of concatenate with create common groups
 -  if ( !aNewMesh->_is_nil() )
 +  if ( !newMesh->_is_nil() )
    {
 -    SMESH::ListOfGroups_var groups = aNewMesh->GetGroups();
 +    SMESH::ListOfGroups_var groups = newMesh->GetGroups();
    }
  
    // IPAL21468 Change icon of compound because it need not be computed.
-   SALOMEDS::SObject_wrap meshSO = ObjectToSObject( myCurrentStudy, newMesh );
 -  SALOMEDS::SObject_wrap aMeshSObj = ObjectToSObject( aNewMesh );
 -  SetPixMap( aMeshSObj, "ICON_SMESH_TREE_MESH" );
++  SALOMEDS::SObject_wrap meshSO = ObjectToSObject( newMesh );
 +  SetPixMap( meshSO, "ICON_SMESH_TREE_MESH" );
  
 -  if (aNewMeshDS)
 -    aNewMeshDS->Modified();
 +  newMeshDS->Modified();
  
 -  return aNewMesh._retn();
 +  return newMesh._retn();
  }
  
  //================================================================================
@@@ -2748,7 -2758,7 +2734,7 @@@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::Copy
    SMESH_Mesh_i*       newMesh_i = SMESH::DownCast<SMESH_Mesh_i*>( newMesh );
    if ( !newMesh_i )
      THROW_SALOME_CORBA_EXCEPTION( "can't create a mesh", SALOME::INTERNAL_ERROR );
-   SALOMEDS::SObject_wrap meshSO = ObjectToSObject(myCurrentStudy, newMesh );
+   SALOMEDS::SObject_wrap meshSO = ObjectToSObject( newMesh );
    if ( !meshSO->_is_nil() )
    {
      SetName( meshSO, meshName, "Mesh" );
    return newMesh._retn();
  }
  
+ //================================================================================
+ /*!
+  * \brief Get version of MED format being used.
+  */
+ //================================================================================
+ char* SMESH_Gen_i::GetMEDFileVersion()
+ {
+   MED::TInt majeur, mineur, release;
+   majeur =  mineur = release = 0;
+   MED::GetVersionRelease(majeur, mineur, release);
+   std::ostringstream version;
+   version << majeur << "." << mineur << "." << release;
+   return CORBA::string_dup( version.str().c_str() );
+ }
  //================================================================================
  /*!
   *  SMESH_Gen_i::GetMEDVersion
   *  Get MED version of the file by its name
   */
  //================================================================================
- CORBA::Boolean SMESH_Gen_i::GetMEDVersion(const char* theFileName,
-                                           SMESH::MED_VERSION& theVersion)
+ char* SMESH_Gen_i::GetMEDVersion(const char* theFileName)
  {
-   theVersion = SMESH::MED_V2_1;
-   MED::EVersion aVersion = MED::GetVersionId( theFileName );
-   switch( aVersion ) {
-     case MED::eV2_1     : theVersion = SMESH::MED_V2_1;    return true;
-     case MED::eV2_2     : theVersion = SMESH::MED_V2_2;    return true;
-     case MED::eLATEST   : theVersion = SMESH::MED_LATEST;  return true;
-     case MED::eMINOR_0  : theVersion = SMESH::MED_MINOR_0; return true;
-     case MED::eMINOR_1  : theVersion = SMESH::MED_MINOR_1; return true;
-     case MED::eMINOR_2  : theVersion = SMESH::MED_MINOR_2; return true;
-     case MED::eMINOR_3  : theVersion = SMESH::MED_MINOR_3; return true;
-     case MED::eMINOR_4  : theVersion = SMESH::MED_MINOR_4; return true;
-     case MED::eMINOR_5  : theVersion = SMESH::MED_MINOR_5; return true;
-     case MED::eMINOR_6  : theVersion = SMESH::MED_MINOR_6; return true;
-     case MED::eMINOR_7  : theVersion = SMESH::MED_MINOR_7; return true;
-     case MED::eMINOR_8  : theVersion = SMESH::MED_MINOR_8; return true;
-     case MED::eMINOR_9  : theVersion = SMESH::MED_MINOR_9; return true;
-     case MED::eVUnknown : return false;
-   }
-   return false;
+   std::string version = MED::GetMEDVersion( theFileName );
+   return CORBA::string_dup( version.c_str() );
+ }
+ //================================================================================
+ /*!
+  *  SMESH_Gen_i::CheckCompatibility
+  *
+  *  Check compatibility of file with MED format being used.
+  */
+ //================================================================================
+ CORBA::Boolean SMESH_Gen_i::CheckCompatibility(const char* theFileName)
+ {
+   return MED::CheckCompatibility( theFileName );
  }
  
  //================================================================================
  SMESH::string_array* SMESH_Gen_i::GetMeshNames(const char* theFileName)
  {
    SMESH::string_array_var aResult = new SMESH::string_array();
-   MED::PWrapper aMed = MED::CrWrapper( theFileName );
+   MED::PWrapper aMed = MED::CrWrapperR( theFileName );
    MED::TErr anErr;
    MED::TInt aNbMeshes = aMed->GetNbMeshes( &anErr );
    if( anErr >= 0 ) {
@@@ -3004,16 -3024,13 +3000,13 @@@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( S
                                        const char*              theURL,
                                        bool                     isMultiFile )
  {
-   //  ASSERT( theComponent->GetStudy()->StudyId() == myCurrentStudy->StudyId() )
-   // san -- in case <myCurrentStudy> differs from theComponent's study,
-   // use that of the component
-   if ( theComponent->GetStudy()->StudyId() != GetCurrentStudyID() )
-     SetCurrentStudy( theComponent->GetStudy() );
+   if (!myStudyContext)
+     UpdateStudy();
  
    // Store study contents as a set of python commands
-   SavePython(myCurrentStudy);
+   SavePython();
  
-   StudyContext* myStudyContext = GetCurrentStudyContext();
+   SALOMEDS::Study_var aStudy = getStudyServant();
  
    // Declare a byte stream
    SALOMEDS::TMPFile_var aStreamFile;
      ( isMultiFile ) ? TCollection_AsciiString( ( char* )theURL ) : ( char* )SALOMEDS_Tool::GetTmpDir().c_str();
  
    // Create a sequence of files processed
-   SALOMEDS::ListOfFileNames_var aFileSeq = new SALOMEDS::ListOfFileNames;
-   aFileSeq->length( NUM_TMP_FILES );
+   SALOMEDS_Tool::ListOfFiles aFileSeq;
+   aFileSeq.reserve( NUM_TMP_FILES );
  
    TCollection_AsciiString aStudyName( "" );
    if ( isMultiFile )
-     aStudyName = ( (char*)SALOMEDS_Tool::GetNameFromPath( myCurrentStudy->URL() ).c_str() );
+     aStudyName = ( (char*)SALOMEDS_Tool::GetNameFromPath( Kernel_Utils::encode(aStudy->URL()) ).c_str() );
  
    // Set names of temporary files
    TCollection_AsciiString filename =
      aStudyName + TCollection_AsciiString( "_SMESH.hdf" );        // for SMESH data itself
    TCollection_AsciiString meshfile =
      aStudyName + TCollection_AsciiString( "_SMESH_Mesh.med" );   // for mesh data to be stored in MED file
-   aFileSeq[ 0 ] = CORBA::string_dup( filename.ToCString() );
-   aFileSeq[ 1 ] = CORBA::string_dup( meshfile.ToCString() );
+   aFileSeq.push_back(CORBA::string_dup( filename.ToCString() ));
+   aFileSeq.push_back(CORBA::string_dup( meshfile.ToCString() ));
    filename = tmpDir + filename;
    meshfile = tmpDir + meshfile;
  
    // SetStoreName() to groups before storing hypotheses to let them refer to
    // groups using "store name", which is "Group <group_persistent_id>"
    {
-     SALOMEDS::ChildIterator_wrap itBig = myCurrentStudy->NewChildIterator( theComponent );
+     SALOMEDS::ChildIterator_wrap itBig = aStudy->NewChildIterator( theComponent );
      for ( ; itBig->More(); itBig->Next() ) {
        SALOMEDS::SObject_wrap gotBranch = itBig->Value();
        if ( gotBranch->Tag() > GetAlgorithmsRootTag() ) {
    aFile->CreateOnDisk();
  
    // --> iterator for top-level objects
-   SALOMEDS::ChildIterator_wrap itBig = myCurrentStudy->NewChildIterator( theComponent );
+   SALOMEDS::ChildIterator_wrap itBig = aStudy->NewChildIterator( theComponent );
    for ( ; itBig->More(); itBig->Next() ) {
      SALOMEDS::SObject_wrap gotBranch = itBig->Value();
  
        aTopGroup->CreateOnDisk();
  
        // iterator for all hypotheses
-       SALOMEDS::ChildIterator_wrap it = myCurrentStudy->NewChildIterator( gotBranch );
+       SALOMEDS::ChildIterator_wrap it = aStudy->NewChildIterator( gotBranch );
        for ( ; it->More(); it->Next() ) {
          SALOMEDS::SObject_wrap mySObject = it->Value();
          CORBA::Object_var anObject = SObjectToObject( mySObject );
            if ( !myHyp->_is_nil() ) {
              SMESH_Hypothesis_i* myImpl = dynamic_cast<SMESH_Hypothesis_i*>( GetServant( myHyp ).in() );
              if ( myImpl ) {
 -              string hypname = string( myHyp->GetName() );
 -              string libname = string( myHyp->GetLibName() );
 +              CORBA::String_var hn = myHyp->GetName(), ln = myHyp->GetLibName();
 +              std::string hypname = hn.in();
 +              std::string libname = ln.in();
                // BUG SWP13062
                // Needs for save crossplatform libname, i.e. parth of name ( ".dll" for
                // WIN32 and ".so" for X-system) must be deleted
                // PAL17753 (Regression: missing hypothesis in restored study)
                // "lib" also should be removed from the beginning
                //if( libname_len > 3 )
 -                //libname.resize( libname_len - 3 );
 +              //libname.resize( libname_len - 3 );
                if( libname_len > 6 )
                  libname = libname.substr( 3, libname_len - 3 - 3 );
  #endif
 -              CORBA::String_var objStr = GetORB()->object_to_string( anObject );
 -              int    id      = myStudyContext->findId( string( objStr.in() ) );
 -              string hypdata = string( myImpl->SaveTo() );
 +              CORBA::String_var  objStr = GetORB()->object_to_string( anObject );
 +              CORBA::String_var hypdata = myImpl->SaveTo();
 +              int                    id = myStudyContext->findId( string( objStr.in() ));
  
                // for each hypothesis create HDF group basing on its id
                char hypGrpName[30];
                aDataset->WriteOnDisk( ( char* )( libname.c_str() ) );
                aDataset->CloseOnDisk();
                // --> persistent data of hypothesis
 -              aSize[ 0 ] = hypdata.length() + 1;
 +              aSize[ 0 ] = strlen( hypdata.in() ) + 1;
                aDataset = new HDFdataset( "Data", aGroup, HDF_STRING, aSize, 1 );
                aDataset->CreateOnDisk();
 -              aDataset->WriteOnDisk( ( char* )( hypdata.c_str() ) );
 +              aDataset->WriteOnDisk( ( char* )( hypdata.in() ) );
                aDataset->CloseOnDisk();
                // close hypothesis HDF group
                aGroup->CloseOnDisk();
        aTopGroup->CreateOnDisk();
  
        // iterator for all algorithms
-       SALOMEDS::ChildIterator_wrap it = myCurrentStudy->NewChildIterator( gotBranch );
+       SALOMEDS::ChildIterator_wrap it = aStudy->NewChildIterator( gotBranch );
        for ( ; it->More(); it->Next() ) {
          SALOMEDS::SObject_wrap mySObject = it->Value();
          CORBA::Object_var anObject = SObjectToObject( mySObject );
            if ( !myHyp->_is_nil() ) {
              SMESH_Hypothesis_i* myImpl = dynamic_cast<SMESH_Hypothesis_i*>( GetServant( myHyp ).in() );
              if ( myImpl ) {
 -              string hypname = string( myHyp->GetName() );
 -              string libname = string( myHyp->GetLibName() );
 +              CORBA::String_var hn = myHyp->GetName(), ln = myHyp->GetLibName();
 +              std::string hypname = hn.in();
 +              std::string libname = ln.in();
                // BUG SWP13062
                // Needs for save crossplatform libname, i.e. parth of name ( ".dll" for
                // WIN32 and ".so" for X-system) must be deleted
                // PAL17753 (Regression: missing hypothesis in restored study)
                // "lib" also should be removed from the beginning
                //if( libname_len > 3 )
 -                //libname.resize( libname_len - 3 );
 +              //libname.resize( libname_len - 3 );
                if( libname_len > 6 )
                  libname = libname.substr( 3, libname_len - 3 - 3 );
  #endif
 -              CORBA::String_var objStr = GetORB()->object_to_string( anObject );
 -              int    id      = myStudyContext->findId( string( objStr.in() ) );
 -              string hypdata = string( myImpl->SaveTo() );
 +              CORBA::String_var  objStr = GetORB()->object_to_string( anObject );
 +              CORBA::String_var hypdata = myImpl->SaveTo();
 +              int                    id = myStudyContext->findId( string( objStr.in() ) );
  
                // for each algorithm create HDF group basing on its id
                char hypGrpName[30];
                aDataset->WriteOnDisk( ( char* )( libname.c_str() ) );
                aDataset->CloseOnDisk();
                // --> persistent data of algorithm
 -              aSize[0] = hypdata.length() + 1;
 +              aSize[0] = strlen( hypdata.in() ) + 1;
                aDataset = new HDFdataset( "Data", aGroup, HDF_STRING, aSize, 1 );
                aDataset->CreateOnDisk();
 -              aDataset->WriteOnDisk( ( char* )( hypdata.c_str() ) );
 +              aDataset->WriteOnDisk( ( char* )( hypdata.in() ));
                aDataset->CloseOnDisk();
                // close algorithm HDF group
                aGroup->CloseOnDisk();
                SALOMEDS::SObject_wrap myShape;
                bool ok = myRef->ReferencedObject( myShape.inout() );
                if ( ok ) {
 -                shapeRefFound = (! CORBA::is_nil( myShape->GetObject() ));
 -                string myRefOnObject = myShape->GetID();
 -                if ( shapeRefFound && myRefOnObject.length() > 0 ) {
 -                  aSize[ 0 ] = myRefOnObject.length() + 1;
 +                CORBA::Object_var shapeObj = myShape->GetObject();
 +                shapeRefFound = (! CORBA::is_nil( shapeObj ));
 +                CORBA::String_var myRefOnObject = myShape->GetID();
 +                if ( shapeRefFound && myRefOnObject.in()[0] ) {
 +                  aSize[ 0 ] = strlen( myRefOnObject.in() ) + 1;
                    aDataset = new HDFdataset( "Ref on shape", aTopGroup, HDF_STRING, aSize, 1 );
                    aDataset->CreateOnDisk();
 -                  aDataset->WriteOnDisk( ( char* )( myRefOnObject.c_str() ) );
 +                  aDataset->WriteOnDisk( ( char* )( myRefOnObject.in() ) );
                    aDataset->CloseOnDisk();
                  }
                }
              // write applied hypotheses if exist
              SALOMEDS::SObject_wrap myHypBranch;
              found = gotBranch->FindSubObject( GetRefOnAppliedHypothesisTag(), myHypBranch.inout() );
 -            if ( found && !shapeRefFound && hasShape) { // remove applied hyps
 +            if ( found && !shapeRefFound && hasShape ) { // remove applied hyps
-               myCurrentStudy->NewBuilder()->RemoveObjectWithChildren( myHypBranch );
+               aStudy->NewBuilder()->RemoveObjectWithChildren( myHypBranch );
              }
              if ( found && (shapeRefFound || !hasShape) ) {
                aGroup = new HDFgroup( "Applied Hypotheses", aTopGroup );
                aGroup->CreateOnDisk();
  
-               SALOMEDS::ChildIterator_wrap it = myCurrentStudy->NewChildIterator( myHypBranch );
+               SALOMEDS::ChildIterator_wrap it = aStudy->NewChildIterator( myHypBranch );
                int hypNb = 0;
                for ( ; it->More(); it->Next() ) {
                  SALOMEDS::SObject_wrap mySObject = it->Value();
              found = gotBranch->FindSubObject( GetRefOnAppliedAlgorithmsTag(),
                                                myAlgoBranch.inout() );
              if ( found && !shapeRefFound && hasShape) { // remove applied algos
-               myCurrentStudy->NewBuilder()->RemoveObjectWithChildren( myAlgoBranch );
+               aStudy->NewBuilder()->RemoveObjectWithChildren( myAlgoBranch );
              }
              if ( found && (shapeRefFound || !hasShape)) {
                aGroup = new HDFgroup( "Applied Algorithms", aTopGroup );
                aGroup->CreateOnDisk();
  
-               SALOMEDS::ChildIterator_wrap it = myCurrentStudy->NewChildIterator( myAlgoBranch );
+               SALOMEDS::ChildIterator_wrap it = aStudy->NewChildIterator( myAlgoBranch );
                int algoNb = 0;
                for ( ; it->More(); it->Next() ) {
                  SALOMEDS::SObject_wrap mySObject = it->Value();
                {
                  bool hasShapeRef = false;
                  SALOMEDS::ChildIterator_wrap itSM =
-                   myCurrentStudy->NewChildIterator( mySubmeshBranch );
+                   aStudy->NewChildIterator( mySubmeshBranch );
                  for ( ; itSM->More(); itSM->Next() ) {
                    SALOMEDS::SObject_wrap mySubRef, myShape, mySObject = itSM->Value();
                    if ( mySObject->FindSubObject( GetRefOnShapeTag(), mySubRef.inout() ))
                          }
                        }
                      }
-                     myCurrentStudy->NewBuilder()->RemoveObjectWithChildren( mySObject );
+                     aStudy->NewBuilder()->RemoveObjectWithChildren( mySObject );
                    }
                  } // loop on submeshes of a type
                  if ( !shapeRefFound || !hasShapeRef ) { // remove the whole submeshes branch
-                   myCurrentStudy->NewBuilder()->RemoveObjectWithChildren( mySubmeshBranch );
+                   aStudy->NewBuilder()->RemoveObjectWithChildren( mySubmeshBranch );
                    found = false;
                  }
                }  // end check if there is shape reference in submeshes
                  aGroup->CreateOnDisk();
  
                  // iterator for all submeshes of given type
-                 SALOMEDS::ChildIterator_wrap itSM = myCurrentStudy->NewChildIterator( mySubmeshBranch );
+                 SALOMEDS::ChildIterator_wrap itSM = aStudy->NewChildIterator( mySubmeshBranch );
                  for ( ; itSM->More(); itSM->Next() ) {
                    SALOMEDS::SObject_wrap mySObject = itSM->Value();
                    CORBA::Object_var anSubObject = SObjectToObject( mySObject );
                        aSubSubGroup = new HDFgroup( "Applied Hypotheses", aSubGroup );
                        aSubSubGroup->CreateOnDisk();
  
-                       SALOMEDS::ChildIterator_wrap it = myCurrentStudy->NewChildIterator( mySubHypBranch );
+                       SALOMEDS::ChildIterator_wrap it = aStudy->NewChildIterator( mySubHypBranch );
                        int hypNb = 0;
                        for ( ; it->More(); it->Next() ) {
                          SALOMEDS::SObject_wrap mySubSObject = it->Value();
                        aSubSubGroup->CreateOnDisk();
  
                        SALOMEDS::ChildIterator_wrap it =
-                         myCurrentStudy->NewChildIterator( mySubAlgoBranch );
+                         aStudy->NewChildIterator( mySubAlgoBranch );
                        int algoNb = 0;
                        for ( ; it->More(); it->Next() ) {
                          SALOMEDS::SObject_wrap mySubSObject = it->Value();
                  aGroup = new HDFgroup( name_group, aTopGroup );
                  aGroup->CreateOnDisk();
  
-                 SALOMEDS::ChildIterator_wrap it = myCurrentStudy->NewChildIterator( myGroupsBranch );
+                 SALOMEDS::ChildIterator_wrap it = aStudy->NewChildIterator( myGroupsBranch );
                  for ( ; it->More(); it->Next() ) {
                    SALOMEDS::SObject_wrap mySObject = it->Value();
                    CORBA::Object_var aSubObject = SObjectToObject( mySObject );
  
                      // For each group, create a dataset named "Group <group_persistent_id>"
                      // and store the group's user name into it
 -                    const char* grpName = aGrpBaseDS->GetStoreName();
 -                    char* aUserName = myGroupImpl->GetName();
 +                    const char*         grpName = aGrpBaseDS->GetStoreName();
 +                    CORBA::String_var aUserName = myGroupImpl->GetName();
                      aSize[ 0 ] = strlen( aUserName ) + 1;
  
                      aDataset = new HDFdataset( grpName, aGroup, HDF_STRING, aSize, 1 );
                            mySubRef->ReferencedObject( myShape.inout() ) &&
                            !CORBA::is_nil( myShape->GetObject() ))
                        {
 -                        string myRefOnObject = myShape->GetID();
 -                        if ( myRefOnObject.length() > 0 ) {
 +                        CORBA::String_var myRefOnObject = myShape->GetID();
 +                        if ( myRefOnObject.in()[0] ) {
                            char aRefName[ 30 ];
                            sprintf( aRefName, "Ref on shape %d", anId);
 -                          aSize[ 0 ] = myRefOnObject.length() + 1;
 +                          aSize[ 0 ] = strlen( myRefOnObject.in() ) + 1;
                            aDataset = new HDFdataset(aRefName, aGroup, HDF_STRING, aSize, 1);
                            aDataset->CreateOnDisk();
 -                          aDataset->WriteOnDisk( ( char* )( myRefOnObject.c_str() ) );
 +                          aDataset->WriteOnDisk( ( char* )( myRefOnObject.in() ));
                            aDataset->CloseOnDisk();
                          }
                        }
                        // Position
                        const SMDS_PositionPtr pos = node->GetPosition();
                        if ( onFace ) { // on FACE
 -                        const SMDS_FacePosition* fPos =
 -                          dynamic_cast<const SMDS_FacePosition*>( pos );
 +                        SMDS_FacePositionPtr fPos = pos;
                          if ( fPos ) {
                            aUPos[ iNode ] = fPos->GetUParameter();
                            aVPos[ iNode ] = fPos->GetVParameter();
                            nbNodes--;
                        }
                        else { // on EDGE
 -                        const SMDS_EdgePosition* ePos =
 -                          dynamic_cast<const SMDS_EdgePosition*>( pos );
 +                        SMDS_EdgePositionPtr ePos = pos;
                          if ( ePos ) {
                            aUPos[ iNode ] = ePos->GetUParameter();
                            iNode++;
    delete aFile;
  
    // Convert temporary files to stream
-   aStreamFile = SALOMEDS_Tool::PutFilesToStream( tmpDir.ToCString(), aFileSeq.in(), isMultiFile );
+   aStreamFile = SALOMEDS_Tool::PutFilesToStream( tmpDir.ToCString(), aFileSeq, isMultiFile );
  
    // Remove temporary files and directory
    if ( !isMultiFile )
-     SALOMEDS_Tool::RemoveTemporaryFiles( tmpDir.ToCString(), aFileSeq.in(), true );
+     SALOMEDS_Tool::RemoveTemporaryFiles( tmpDir.ToCString(), aFileSeq, true );
  
    return aStreamFile._retn();
  }
@@@ -3991,11 -4007,7 +3984,7 @@@ void SMESH_Gen_i::loadGeomData( SALOMED
    if ( theCompRoot->_is_nil() )
      return;
  
-   SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow( theCompRoot->GetStudy() );
-   if ( aStudy->_is_nil() )
-     return;
-   SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
+   SALOMEDS::StudyBuilder_var aStudyBuilder = getStudyServant()->NewBuilder();
    aStudyBuilder->LoadWith( theCompRoot, GetGeomEngine() );
  }
  
@@@ -4012,30 -4024,27 +4001,27 @@@ bool SMESH_Gen_i::Load( SALOMEDS::SComp
                          const char*              theURL,
                          bool                     isMultiFile )
  {
-   if ( theComponent->GetStudy()->StudyId() != GetCurrentStudyID() )
-     SetCurrentStudy( theComponent->GetStudy() );
+   if (!myStudyContext)
+     UpdateStudy();
+   SALOMEDS::Study_var aStudy = getStudyServant();
    /*  if( !theComponent->_is_nil() )
        {
-       //SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow( theComponent->GetStudy() );
-       if( !myCurrentStudy->FindComponent( "GEOM" )->_is_nil() )
-       loadGeomData( myCurrentStudy->FindComponent( "GEOM" ) );
+       if( !aStudy->FindComponent( "GEOM" )->_is_nil() )
+       loadGeomData( aStudy->FindComponent( "GEOM" ) );
        }*/
  
-   StudyContext* myStudyContext = GetCurrentStudyContext();
    // Get temporary files location
    TCollection_AsciiString tmpDir =
      ( char* )( isMultiFile ? theURL : SALOMEDS_Tool::GetTmpDir().c_str() );
  
    // Convert the stream into sequence of files to process
-   SALOMEDS::ListOfFileNames_var aFileSeq = SALOMEDS_Tool::PutStreamToFiles( theStream,
-                                                                             tmpDir.ToCString(),
-                                                                             isMultiFile );
+   SALOMEDS_Tool::ListOfFiles aFileSeq = SALOMEDS_Tool::PutStreamToFiles( theStream,
+                                                                          tmpDir.ToCString(),
+                                                                          isMultiFile );
    TCollection_AsciiString aStudyName( "" );
    if ( isMultiFile ) {
-     CORBA::String_var url = myCurrentStudy->URL();
-     aStudyName = (char*)SALOMEDS_Tool::GetNameFromPath( url.in() ).c_str();
+     CORBA::WString_var url = aStudy->URL();
+     aStudyName = (char*)SALOMEDS_Tool::GetNameFromPath( Kernel_Utils::encode(url.in()) ).c_str();
    }
    // Set names of temporary files
    TCollection_AsciiString filename = tmpDir + aStudyName + "_SMESH.hdf";
              aDataset->ReadFromDisk( refFromFile );
              aDataset->CloseOnDisk();
              if ( strlen( refFromFile ) > 0 ) {
-               SALOMEDS::SObject_wrap shapeSO = myCurrentStudy->FindObjectID( refFromFile );
+               SALOMEDS::SObject_wrap shapeSO = aStudy->FindObjectID( refFromFile );
  
                // Make sure GEOM data are loaded first
                //loadGeomData( shapeSO->GetFatherComponent() );
              aDataset->ReadFromDisk( refFromFile );
              aDataset->CloseOnDisk();
              // san - it is impossible to recover applied algorithms using their entries within Load() method
-             //SALOMEDS::SObject_wrap hypSO = myCurrentStudy->FindObjectID( refFromFile );
+             //SALOMEDS::SObject_wrap hypSO = aStudy->FindObjectID( refFromFile );
              //CORBA::Object_var hypObject = SObjectToObject( hypSO );
              int id = atoi( refFromFile );
              delete [] refFromFile;
              aDataset->ReadFromDisk( refFromFile );
              aDataset->CloseOnDisk();
              // san - it is impossible to recover applied hypotheses using their entries within Load() method
-             //SALOMEDS::SObject_wrap hypSO = myCurrentStudy->FindObjectID( refFromFile );
+             //SALOMEDS::SObject_wrap hypSO = myStudy->FindObjectID( refFromFile );
              //CORBA::Object_var hypObject = SObjectToObject( hypSO );
              int id = atoi( refFromFile );
              delete [] refFromFile;
                  aDataset->ReadFromDisk( refFromFile );
                  aDataset->CloseOnDisk();
                  if ( strlen( refFromFile ) > 0 ) {
-                   SALOMEDS::SObject_wrap subShapeSO = myCurrentStudy->FindObjectID( refFromFile );
+                   SALOMEDS::SObject_wrap subShapeSO = aStudy->FindObjectID( refFromFile );
                    CORBA::Object_var subShapeObject = SObjectToObject( subShapeSO );
                    if ( !CORBA::is_nil( subShapeObject ) ) {
                      aSubShapeObject = GEOM::GEOM_Object::_narrow( subShapeObject );
                      myStudyContext->mapOldToNew( subid, newSubId );
                    }
                  }
 +                delete [] refFromFile;
                }
  
                if ( aSubMesh->_is_nil() )
                            myNewMeshImpl->addHypothesis( aSubShapeObject, anHyp );
                        }
                      }
 +                    delete [] refFromFile;
                    }
                  }
                  // close "applied algorithms" HDF group
                            myNewMeshImpl->addHypothesis( aSubShapeObject, anHyp );
                        }
                      }
 +                    delete [] refFromFile;
                    }
                  }
                  // close "APPLIED HYPOTHESES" hdf group
                  aDataset->ReadFromDisk( refFromFile );
                  aDataset->CloseOnDisk();
                  if ( strlen( refFromFile ) > 0 ) {
-                   SALOMEDS::SObject_wrap shapeSO = myCurrentStudy->FindObjectID( refFromFile );
+                   SALOMEDS::SObject_wrap shapeSO = aStudy->FindObjectID( refFromFile );
                    CORBA::Object_var shapeObject = SObjectToObject( shapeSO );
                    if ( !CORBA::is_nil( shapeObject ) ) {
                      aShapeObject = GEOM::GEOM_Object::_narrow( shapeObject );
                        aShape = GeomObjectToShape( aShapeObject );
                    }
                  }
 +                delete [] refFromFile;
                }
                // Try to read a filter of SMESH_GroupOnFilter
                SMESH::Filter_var filter;
                    predicate = SMESH_GroupOnFilter_i::GetPredicate( filter );
                    filters.push_back( filter );
                  }
 +                delete [] persistStr;
                }
  
                // Create group servant
                SMESH::ElementType type = (SMESH::ElementType)(ii - GetNodeGroupsTag() + 1);
                SMESH::SMESH_GroupBase_var aNewGroup = SMESH::SMESH_GroupBase::_duplicate
                  ( myNewMeshImpl->createGroup( type, nameFromFile, aShape, predicate ) );
 +              delete [] nameFromFile;
                // Obtain a SMESHDS_Group object
                if ( aNewGroup->_is_nil() )
                  continue;
                  aDataset->CloseOnDisk();
                  Quantity_Color aColor( anRGB[0], anRGB[1], anRGB[2], Quantity_TOC_RGB );
                  aGroupBaseDS->SetColor( aColor );
 +                delete [] anRGB;
                }
              }
            }
        }
  
        // read Sub-Mesh ORDER if any
 -      if( aTopGroup->ExistInternalObject( "Mesh Order" ) ) {
 +      if ( aTopGroup->ExistInternalObject( "Mesh Order" )) {
          aDataset = new HDFdataset( "Mesh Order", aTopGroup );
          aDataset->OpenOnDisk();
          size = aDataset->GetSize();
              anOrderIds.back().push_back(smIDs[ i ]);
  
          myNewMeshImpl->GetImpl().SetMeshOrder( anOrderIds );
 +        delete [] smIDs;
        }
      } // loop on meshes
  
      SMESH_File meshFile( meshfile.ToCString() );
      if ( !meshFile ) // no meshfile exists
      {
-       SALOMEDS_Tool::RemoveTemporaryFiles( tmpDir.ToCString(), aFileSeq.in(), true );
+       SALOMEDS_Tool::RemoveTemporaryFiles( tmpDir.ToCString(), aFileSeq, true );
      }
      else
      {
  
    // creation of tree nodes for all data objects in the study
    // to support tree representation customization and drag-n-drop:
-   SALOMEDS::Study_var                    study = theComponent->GetStudy();
-   SALOMEDS::UseCaseBuilder_wrap useCaseBuilder = study->GetUseCaseBuilder();
+   SALOMEDS::UseCaseBuilder_wrap useCaseBuilder = aStudy->GetUseCaseBuilder();
    if ( !useCaseBuilder->IsUseCaseNode( theComponent ) ) {
      useCaseBuilder->SetRootCurrent();
      useCaseBuilder->Append( theComponent ); // component object is added as the top level item
-     SALOMEDS::ChildIterator_wrap it = study->NewChildIterator( theComponent );
+     SALOMEDS::ChildIterator_wrap it = aStudy->NewChildIterator( theComponent );
      for (it->InitEx(true); it->More(); it->Next()) {
        useCaseBuilder->AppendTo( it->Value()->GetFather(), it->Value() );
      }
@@@ -4942,22 -4942,13 +4927,13 @@@ void SMESH_Gen_i::Close( SALOMEDS::SCom
  {
    if(MYDEBUG) MESSAGE( "SMESH_Gen_i::Close" );
  
-   // set correct current study
-   SALOMEDS::Study_var study = theComponent->GetStudy();
-   if ( study->StudyId() != GetCurrentStudyID())
-     setCurrentStudy( study, /*IsBeingClosed=*/true );
    // Clear study contexts data
-   int studyId = GetCurrentStudyID();
-   if ( myStudyContextMap.find( studyId ) != myStudyContextMap.end() ) {
-     delete myStudyContextMap[ studyId ];
-     myStudyContextMap.erase( studyId );
-   }
+   delete myStudyContext;
+   myStudyContext = 0;
  
    // remove the tmp files meshes are loaded from
    SMESH_PreMeshInfo::RemoveStudyFiles_TMP_METHOD( theComponent );
  
-   myCurrentStudy = SALOMEDS::Study::_nil();
    return;
  }
  
@@@ -4990,7 -4981,6 +4966,6 @@@ char* SMESH_Gen_i::IORToLocalPersistent
                                             CORBA::Boolean        /*isASCII*/ )
  {
    if(MYDEBUG) MESSAGE( "SMESH_Gen_i::IORToLocalPersistentID" );
-   StudyContext* myStudyContext = GetCurrentStudyContext();
  
    if ( myStudyContext && strcmp( IORString, "" ) != 0 ) {
      int anId = myStudyContext->findId( IORString );
@@@ -5018,7 -5008,6 +4993,6 @@@ char* SMESH_Gen_i::LocalPersistentIDToI
                                             CORBA::Boolean        /*isASCII*/ )
  {
    if(MYDEBUG) MESSAGE( "SMESH_Gen_i::LocalPersistentIDToIOR(): id = " << aLocalPersistentID );
-   StudyContext* myStudyContext = GetCurrentStudyContext();
  
    if ( myStudyContext && strcmp( aLocalPersistentID, "" ) != 0 ) {
      int anId = atoi( aLocalPersistentID );
  
  int SMESH_Gen_i::RegisterObject(CORBA::Object_ptr theObject)
  {
-   StudyContext* myStudyContext = GetCurrentStudyContext();
    if ( myStudyContext && !CORBA::is_nil( theObject )) {
      CORBA::String_var iorString = GetORB()->object_to_string( theObject );
      return myStudyContext->addObject( string( iorString.in() ) );
  
  CORBA::Long SMESH_Gen_i::GetObjectId(CORBA::Object_ptr theObject)
  {
-   StudyContext* myStudyContext = GetCurrentStudyContext();
    if ( myStudyContext && !CORBA::is_nil( theObject )) {
      string iorString = GetORB()->object_to_string( theObject );
      return myStudyContext->findId( iorString );
@@@ -5072,18 -5059,13 +5044,13 @@@ void SMESH_Gen_i::SetName(const char* t
  {
    if ( theIOR && strcmp( theIOR, "" ) ) {
      CORBA::Object_var anObject = GetORB()->string_to_object( theIOR );
-     SALOMEDS::SObject_wrap aSO = ObjectToSObject( myCurrentStudy, anObject );
+     SALOMEDS::SObject_wrap aSO = ObjectToSObject( anObject );
      if ( !aSO->_is_nil() ) {
        SetName( aSO, theName );
      }
    }
  }
  
- int SMESH_Gen_i::GetCurrentStudyID()
- {
-   return myCurrentStudy->_is_nil() || myCurrentStudy->_non_existent() ? -1 : myCurrentStudy->StudyId();
- }
  // Version information
  char* SMESH_Gen_i::getVersion()
  {
@@@ -5105,9 -5087,8 +5072,8 @@@ void SMESH_Gen_i::Move( const SMESH::so
  {
    if ( CORBA::is_nil( where ) ) return;
  
-   SALOMEDS::Study_var study = where->GetStudy();
-   SALOMEDS::StudyBuilder_var studyBuilder = study->NewBuilder();
-   SALOMEDS::UseCaseBuilder_var useCaseBuilder = study->GetUseCaseBuilder();
+   SALOMEDS::StudyBuilder_var studyBuilder = getStudyServant()->NewBuilder();
+   SALOMEDS::UseCaseBuilder_var useCaseBuilder = getStudyServant()->GetUseCaseBuilder();
    SALOMEDS::SComponent_var father = where->GetFatherComponent();
    std::string dataType = father->ComponentDataType();
    if ( dataType != "SMESH" ) return; // not a SMESH component
index 7f3765e8da804950228a2ccc700adb6dda331a9a,a0667465611147aab0f9b9af9bea00c3f6201736..1cc0ae4aa44d5172994d06c617c222c5d1064b1a
@@@ -117,7 -117,10 +117,7 @@@ private
    // get next free object identifier
    int getNextId()
    {
 -    int id = 1;
 -    while( mapIdToIOR.IsBound( id ) )
 -      id++;
 -    return id;
 +    return mapIdToIOR.Extent() + 1;
    }
  
    TInt2StringMap mapIdToIOR; // persistent-to-transient map
@@@ -149,8 -152,9 +149,9 @@@ public
    // Get CORBA object corresponding to the SALOMEDS::SObject
    static CORBA::Object_var SObjectToObject( SALOMEDS::SObject_ptr theSObject );
    // Get the SALOMEDS::SObject corresponding to a CORBA object
-   static SALOMEDS::SObject_ptr ObjectToSObject(SALOMEDS::Study_ptr theStudy,
-                                                CORBA::Object_ptr   theObject);
+   static SALOMEDS::SObject_ptr ObjectToSObject(CORBA::Object_ptr theObject);
+   // Get the SALOMEDS::Study from naming service
+   static SALOMEDS::Study_ptr getStudyServant();
    // Get GEOM Object corresponding to TopoDS_Shape
    GEOM::GEOM_Object_ptr ShapeToGeomObject (const TopoDS_Shape& theShape );
    // Get TopoDS_Shape corresponding to GEOM_Object
    //GEOM::GEOM_Gen_ptr SetGeomEngine( const char* containerLoc );
    void SetGeomEngine( GEOM::GEOM_Gen_ptr geomcompo );
  
-   // Set current study
+   // Set embedded mode
    void SetEmbeddedMode( CORBA::Boolean theMode );
-   // Get current study
+   // Check embedded mode
    CORBA::Boolean IsEmbeddedMode();
  
-   // Set current study
-   void SetCurrentStudy( SALOMEDS::Study_ptr theStudy );
-   // Get current study
-   SALOMEDS::Study_ptr GetCurrentStudy();
+   // Set enable publishing in the study
+   void SetEnablePublish( CORBA::Boolean theIsEnablePublish );
+   // Check enable publishing
+   CORBA::Boolean IsEnablePublish();
+   // Update study
+   void UpdateStudy();
  
    // Create hypothesis/algorothm of given type
    SMESH::SMESH_Hypothesis_ptr CreateHypothesis (const char* theHypType,
                                                CORBA::Double                 mergeTolerance)
      throw ( SALOME::SALOME_Exception );
  
+   // Get version of MED format being used.
+   char* GetMEDFileVersion();
    // Get MED version of the file by its name
-   CORBA::Boolean GetMEDVersion(const char* theFileName,
-                                SMESH::MED_VERSION& theVersion);
+   char* GetMEDVersion(const char* theFileName);
+   // Check compatibility of file with MED format being used.
+   CORBA::Boolean CheckCompatibility(const char* theFileName);
  
    // Get names of meshes defined in file with the specified name
    SMESH::string_array* GetMeshNames(const char* theFileName);
    // Returns true if object can be published in the study
    bool CanPublishInStudy( CORBA::Object_ptr theIOR );
    // Publish object in the study
-   SALOMEDS::SObject_ptr PublishInStudy( SALOMEDS::Study_ptr   theStudy,
-                                         SALOMEDS::SObject_ptr theSObject,
+   SALOMEDS::SObject_ptr PublishInStudy( SALOMEDS::SObject_ptr theSObject,
                                          CORBA::Object_ptr     theObject,
                                          const char*           theName )
      throw ( SALOME::SALOME_Exception );
    // Dump python
    // ============
  
-   virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
-                                        CORBA::Boolean isPublished,
+   virtual Engines::TMPFile* DumpPython(CORBA::Boolean isPublished,
                                         CORBA::Boolean isMultiFile,
                                         CORBA::Boolean& isValidScript);
  
-   void AddToPythonScript (int theStudyID, const TCollection_AsciiString& theString);
+   void AddToPythonScript (const TCollection_AsciiString& theString);
  
-   void RemoveLastFromPythonScript (int theStudyID);
+   void RemoveLastFromPythonScript();
  
-   void SavePython (SALOMEDS::Study_ptr theStudy);
+   void SavePython();
  
-   TCollection_AsciiString DumpPython_impl (SALOMEDS::Study_ptr theStudy,
-                                            Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
+   TCollection_AsciiString DumpPython_impl (Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
                                             Resource_DataMapOfAsciiStringAsciiString& theNames,
                                             bool isPublished,
                                             bool isMultiFile,
                                             bool& aValidScript,
                                             TCollection_AsciiString& theSavedTrace);
  
-   TCollection_AsciiString GetNewPythonLines (int theStudyID);
+   TCollection_AsciiString GetNewPythonLines();
  
-   void CleanPythonTrace (int theStudyID);
+   void CleanPythonTrace();
  
    // *****************************************
    // Internal methods
@@@ -514,33 -524,26 +521,26 @@@ public
    static long GetBallElementsGroupsTag();
  
    // publishing methods
-   SALOMEDS::SComponent_ptr PublishComponent(SALOMEDS::Study_ptr theStudy);
-   SALOMEDS::SObject_ptr PublishMesh (SALOMEDS::Study_ptr   theStudy,
-                                      SMESH::SMESH_Mesh_ptr theMesh,
+   SALOMEDS::SComponent_ptr PublishComponent();
+   SALOMEDS::SObject_ptr PublishMesh (SMESH::SMESH_Mesh_ptr theMesh,
                                       const char*           theName = 0);
-   SALOMEDS::SObject_ptr PublishHypothesis (SALOMEDS::Study_ptr         theStudy,
-                                            SMESH::SMESH_Hypothesis_ptr theHyp,
+   SALOMEDS::SObject_ptr PublishHypothesis (SMESH::SMESH_Hypothesis_ptr theHyp,
                                             const char*                 theName = 0);
-   SALOMEDS::SObject_ptr PublishSubMesh (SALOMEDS::Study_ptr      theStudy,
-                                         SMESH::SMESH_Mesh_ptr    theMesh,
+   SALOMEDS::SObject_ptr PublishSubMesh (SMESH::SMESH_Mesh_ptr    theMesh,
                                          SMESH::SMESH_subMesh_ptr theSubMesh,
                                          GEOM::GEOM_Object_ptr    theShapeObject,
                                          const char*              theName = 0);
-   SALOMEDS::SObject_ptr PublishGroup (SALOMEDS::Study_ptr    theStudy,
-                                       SMESH::SMESH_Mesh_ptr  theMesh,
+   SALOMEDS::SObject_ptr PublishGroup (SMESH::SMESH_Mesh_ptr  theMesh,
                                        SMESH::SMESH_GroupBase_ptr theGroup,
                                        GEOM::GEOM_Object_ptr  theShapeObject,
                                        const char*            theName = 0);
-   bool AddHypothesisToShape(SALOMEDS::Study_ptr         theStudy,
-                             SMESH::SMESH_Mesh_ptr       theMesh,
+   bool AddHypothesisToShape(SMESH::SMESH_Mesh_ptr       theMesh,
                              GEOM::GEOM_Object_ptr       theShapeObject,
                              SMESH::SMESH_Hypothesis_ptr theHyp);
-   bool RemoveHypothesisFromShape(SALOMEDS::Study_ptr         theStudy,
-                                  SMESH::SMESH_Mesh_ptr       theMesh,
+   bool RemoveHypothesisFromShape(SMESH::SMESH_Mesh_ptr       theMesh,
                                   GEOM::GEOM_Object_ptr       theShapeObject,
                                   SMESH::SMESH_Hypothesis_ptr theHyp);
-   SALOMEDS::SObject_ptr GetMeshOrSubmeshByShape (SALOMEDS::Study_ptr   theStudy,
-                                                  SMESH::SMESH_Mesh_ptr theMesh,
+   SALOMEDS::SObject_ptr GetMeshOrSubmeshByShape (SMESH::SMESH_Mesh_ptr theMesh,
                                                   GEOM::GEOM_Object_ptr theShape);
    static void SetName(SALOMEDS::SObject_ptr theSObject,
                        const char*           theName,
                          const char*           thePixMap);
  
    //  Get study context
-   StudyContext* GetCurrentStudyContext();
+   StudyContext* GetStudyContext();
  
    // Register an object in a StudyContext; return object id
    int RegisterObject(CORBA::Object_ptr theObject);
    template<class TInterface>
      typename TInterface::_var_type GetObjectByOldId( const int oldID )
    {
-     if ( StudyContext* myStudyContext = GetCurrentStudyContext() ) {
+     if ( myStudyContext ) {
        std::string ior = myStudyContext->getIORbyOldId( oldID );
        if ( !ior.empty() )
          return TInterface::_narrow(GetORB()->string_to_object( ior.c_str() ));
      return TInterface::_nil();
    }
  
-   // Get current study ID
-   int GetCurrentStudyID();
    /*!
     * \brief Find SObject for an algo
     */
@@@ -648,9 -648,6 +645,6 @@@ private
                                                  const char* theCommandNameForPython,
                                                  const char* theFileNameForPython);
  
-   void setCurrentStudy( SALOMEDS::Study_ptr theStudy,
-                         bool                theStudyIsBeingClosed=false);
    std::vector<long> _GetInside(SMESH::SMESH_IDSource_ptr meshPart,
                                 SMESH::ElementType     theElemType,
                                 TopoDS_Shape& aShape,
@@@ -668,11 -665,11 +662,11 @@@ private
    // hypotheses managing
    std::map<std::string, GenericHypothesisCreator_i*> myHypCreatorMap;
  
-   std::map<int, StudyContext*>   myStudyContextMap;  // Map of study context objects
+   StudyContext*                  myStudyContext;  // study context
  
    GEOM_Client*                   myShapeReader;      // Shape reader
-   SALOMEDS::Study_var            myCurrentStudy;     // Current study
    CORBA::Boolean                 myIsEmbeddedMode;   // Current mode
+   CORBA::Boolean                 myIsEnablePublish;  // Enable publishing
  
    // Default color of groups
    std::string myDefaultGroupColor;
    bool myToForgetMeshDataOnHypModif;
  
    // Dump Python: trace of API methods calls
-   std::map < int, Handle(TColStd_HSequenceOfAsciiString) > myPythonScripts;
-   bool                                                     myIsHistoricalPythonDump;
-   std::vector< int >                                       myLastParamIndex;
-   std::vector< std::string >                               myLastParameters;
-   std::string                                              myLastObj;
+   Handle(TColStd_HSequenceOfAsciiString) myPythonScript;
+   bool                                   myIsHistoricalPythonDump;
+   std::vector< int >                     myLastParamIndex;
+   std::vector< std::string >             myLastParameters;
+   std::string                            myLastObj;
  };
  
  
index 047907e64d036b446425f1f208401cc19444d3ef,6b3da78a1efcc5e3c0909a379c9bd534f64de8b7..e1499f8a7ccc4e05c2221cb710382efe092d0c7f
@@@ -40,6 -40,7 +40,7 @@@
  #include <Utils_ExceptHandlers.hxx>
  #include <SALOMEDS_wrap.hxx>
  #include <SALOMEDS_Attributes_wrap.hxx>
+ #include <SALOME_KernelServices.hxx>
  
  #include <TCollection_AsciiString.hxx>
  #include <TopoDS_Solid.hxx>
@@@ -162,10 -163,11 +163,11 @@@ long SMESH_Gen_i::GetBallElementsGroups
  
  bool SMESH_Gen_i::CanPublishInStudy(CORBA::Object_ptr theIOR)
  {
-   if(MYDEBUG) MESSAGE("CanPublishInStudy - "<<!CORBA::is_nil(myCurrentStudy));
-   if( GetCurrentStudyID() < 0 )
-     return false;
+   if(MYDEBUG) MESSAGE("CanPublishInStudy - "<<!CORBA::is_nil(getStudyServant()));
    
+   if( !myIsEnablePublish )
+     return false;
    SMESH::SMESH_Mesh_var aMesh       = SMESH::SMESH_Mesh::_narrow(theIOR);
    if( !aMesh->_is_nil() )
      return true;
  //purpose  : Put a result into a SALOMEDS::SObject_wrap or call UnRegister()!
  //=======================================================================
  
- SALOMEDS::SObject_ptr SMESH_Gen_i::ObjectToSObject(SALOMEDS::Study_ptr theStudy,
-                                                    CORBA::Object_ptr   theObject)
+ SALOMEDS::SObject_ptr SMESH_Gen_i::ObjectToSObject(CORBA::Object_ptr theObject)
  {
    SALOMEDS::SObject_wrap aSO;
-   if ( !CORBA::is_nil( theStudy ) && !CORBA::is_nil( theObject ))
+   if ( !CORBA::is_nil( theObject ))
    {
      CORBA::String_var objStr = SMESH_Gen_i::GetORB()->object_to_string( theObject );
-     aSO = theStudy->FindObjectIOR( objStr.in() );
+     aSO = getStudyServant()->FindObjectIOR( objStr.in() );
    }
    return aSO._retn();
  }
  
+ //=======================================================================
+ //function : GetStudyPtr
+ //purpose  : Get study from naming service
+ //=======================================================================
+ SALOMEDS::Study_ptr SMESH_Gen_i::getStudyServant()
+ {
+   return SALOMEDS::Study::_duplicate(KERNEL::getStudyServant());
+ }
  //=======================================================================
  //function : objectToServant
  //purpose  : 
@@@ -255,14 -265,14 +265,14 @@@ TopoDS_Shape SMESH_Gen_i::GeomObjectToS
  //purpose  : 
  //=======================================================================
  
- static SALOMEDS::SObject_ptr publish(SALOMEDS::Study_ptr   theStudy,
-                                      CORBA::Object_ptr     theIOR,
+ static SALOMEDS::SObject_ptr publish(CORBA::Object_ptr     theIOR,
                                       SALOMEDS::SObject_ptr theFatherObject,
                                       const int             theTag = 0,
                                       const char*           thePixMap = 0,
                                       const bool            theSelectable = true)
  {
-   SALOMEDS::SObject_wrap SO = SMESH_Gen_i::ObjectToSObject( theStudy, theIOR );
+   SALOMEDS::Study_var theStudy = SMESH_Gen_i::getStudyServant();
+   SALOMEDS::SObject_wrap SO = SMESH_Gen_i::ObjectToSObject( theIOR );
    SALOMEDS::StudyBuilder_var     aStudyBuilder = theStudy->NewBuilder();
    SALOMEDS::UseCaseBuilder_wrap useCaseBuilder = theStudy->GetUseCaseBuilder();
    bool isNewSO = false, isInUseCaseTree = false;
      if ( !sameIOR )
      {
        iorAttr->SetValue( objStr.in() );
 -      // UnRegister() !!!
 -      SALOME::GenericObj_var genObj = SALOME::GenericObj::_narrow( theIOR );
 -      if ( !genObj->_is_nil() )
 -        genObj->UnRegister();
 +      // UnRegister() !!! --> No: random problems when meshing in parallel (yacs foreach) in distributed python scripts
 +//      SALOME::GenericObj_var genObj = SALOME::GenericObj::_narrow( theIOR );
 +//      if ( !genObj->_is_nil() )
 +//        genObj->UnRegister();
      }
    }
  
@@@ -356,8 -366,7 +366,7 @@@ void SMESH_Gen_i::SetName(SALOMEDS::SOb
                            const char*           theDefaultName)
  {
    if ( !theSObject->_is_nil() ) {
-     SALOMEDS::Study_var               aStudy = theSObject->GetStudy();
-     SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
+     SALOMEDS::StudyBuilder_var aStudyBuilder = getStudyServant()->NewBuilder();
      SALOMEDS::GenericAttribute_wrap   anAttr =
        aStudyBuilder->FindOrCreateAttribute( theSObject, "AttributeName" );
      SALOMEDS::AttributeName_wrap aNameAttr = anAttr;
@@@ -389,8 -398,7 +398,7 @@@ void SMESH_Gen_i::SetPixMap(SALOMEDS::S
  {
    if ( !theSObject->_is_nil() && thePixMap && strlen( thePixMap ))
    {
-     SALOMEDS::Study_var               aStudy = theSObject->GetStudy();
-     SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
+     SALOMEDS::StudyBuilder_var aStudyBuilder = getStudyServant()->NewBuilder();
      SALOMEDS::GenericAttribute_wrap anAttr =
        aStudyBuilder->FindOrCreateAttribute( theSObject, "AttributePixMap" );
      SALOMEDS::AttributePixMap_wrap aPMAttr = anAttr;
  //purpose  : 
  //=======================================================================
  
- static void addReference (SALOMEDS::Study_ptr   theStudy,
-                           SALOMEDS::SObject_ptr theSObject,
+ static void addReference (SALOMEDS::SObject_ptr theSObject,
                            CORBA::Object_ptr     theToObject,
                            int                   theTag = 0)
  {
-   SALOMEDS::SObject_wrap aToObjSO = SMESH_Gen_i::ObjectToSObject( theStudy, theToObject );
+   SALOMEDS::Study_var aStudy = SMESH_Gen_i::getStudyServant();
+   SALOMEDS::SObject_wrap aToObjSO = SMESH_Gen_i::ObjectToSObject( theToObject );
    if ( !aToObjSO->_is_nil() && !theSObject->_is_nil() ) {
-     SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
+     SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
      SALOMEDS::SObject_wrap aReferenceSO;
      if ( !theTag ) {
        // check if the reference to theToObject already exists
        // and find a free label for the reference object
        bool isReferred = false;
        int tag = 1;
-       SALOMEDS::ChildIterator_wrap anIter = theStudy->NewChildIterator( theSObject );
+       SALOMEDS::ChildIterator_wrap anIter = aStudy->NewChildIterator( theSObject );
        for ( ; !isReferred && anIter->More(); anIter->Next(), ++tag ) {
          SALOMEDS::SObject_wrap curSO = anIter->Value();
          if ( curSO->ReferencedObject( aReferenceSO.inout() )) {
  
      // add reference to the use case tree
      // (to support tree representation customization and drag-n-drop)
-     SALOMEDS::UseCaseBuilder_wrap  useCaseBuilder = theStudy->GetUseCaseBuilder();
+     SALOMEDS::UseCaseBuilder_wrap  useCaseBuilder = aStudy->GetUseCaseBuilder();
      SALOMEDS::UseCaseIterator_wrap    useCaseIter = useCaseBuilder->GetUseCaseIterator(theSObject);
      for ( ; useCaseIter->More(); useCaseIter->Next() )
      {
   */
  //=============================================================================
  
- SALOMEDS::SObject_ptr SMESH_Gen_i::PublishInStudy(SALOMEDS::Study_ptr   theStudy,
-                                                   SALOMEDS::SObject_ptr theSObject,
+ SALOMEDS::SObject_ptr SMESH_Gen_i::PublishInStudy(SALOMEDS::SObject_ptr theSObject,
                                                    CORBA::Object_ptr     theIOR,
                                                    const char*           theName)
       throw (SALOME::SALOME_Exception)
  {
    Unexpect aCatch(SALOME_SalomeException);
    SALOMEDS::SObject_wrap aSO;
-   if ( CORBA::is_nil( theStudy ) || CORBA::is_nil( theIOR ))
+   if ( CORBA::is_nil( theIOR ))
      return aSO._retn();
    if(MYDEBUG) MESSAGE("PublishInStudy");
  
    // Publishing a mesh
    SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( theIOR );
    if( !aMesh->_is_nil() )
-     aSO = PublishMesh( theStudy, aMesh, theName );
+     aSO = PublishMesh( aMesh, theName );
  
    // Publishing a sub-mesh
    SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( theIOR );
    if( aSO->_is_nil() && !aSubMesh->_is_nil() ) {
      GEOM::GEOM_Object_var aShapeObject = aSubMesh->GetSubShape();
      aMesh = aSubMesh->GetFather();
-     aSO = PublishSubMesh( theStudy, aMesh, aSubMesh, aShapeObject, theName );
+     aSO = PublishSubMesh( aMesh, aSubMesh, aShapeObject, theName );
    }
  
    // Publishing a hypothesis or algorithm
    SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( theIOR );
    if ( aSO->_is_nil() && !aHyp->_is_nil() )
-     aSO = PublishHypothesis( theStudy, aHyp, theName );
 -    aSO = PublishHypothesis( aHyp );
++    aSO = PublishHypothesis( aHyp, theName );
  
    // Publishing a group
    SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(theIOR);
    if ( aSO->_is_nil() && !aGroup->_is_nil() ) {
      GEOM::GEOM_Object_var aShapeObject;
      aMesh = aGroup->GetMesh();
-     aSO = PublishGroup( theStudy, aMesh, aGroup, aShapeObject, theName );
+     aSO = PublishGroup( aMesh, aGroup, aShapeObject, theName );
    }
    if(MYDEBUG) MESSAGE("PublishInStudy_END");
  
  //purpose  : 
  //=======================================================================
  
- SALOMEDS::SComponent_ptr SMESH_Gen_i::PublishComponent(SALOMEDS::Study_ptr theStudy)
+ SALOMEDS::SComponent_ptr SMESH_Gen_i::PublishComponent()
  {
-   if ( CORBA::is_nil( theStudy ))
-     return SALOMEDS::SComponent::_nil();
    if(MYDEBUG) MESSAGE("PublishComponent");
  
-   SALOMEDS::StudyBuilder_var    aStudyBuilder  = theStudy->NewBuilder(); 
-   SALOMEDS::UseCaseBuilder_wrap useCaseBuilder = theStudy->GetUseCaseBuilder();
+   SALOMEDS::StudyBuilder_var    aStudyBuilder  = getStudyServant()->NewBuilder();
+   SALOMEDS::UseCaseBuilder_wrap useCaseBuilder = getStudyServant()->GetUseCaseBuilder();
  
    CORBA::String_var   compDataType = ComponentDataType();
-   SALOMEDS::SComponent_wrap father = theStudy->FindComponent( compDataType.in() );
+   SALOMEDS::SComponent_wrap father = getStudyServant()->FindComponent( compDataType.in() );
    if ( !CORBA::is_nil( father ) ) {
      // check that the component is added to the use case browser
      if ( !useCaseBuilder->IsUseCaseNode( father ) ) {
  //purpose  : 
  //=======================================================================
  
- SALOMEDS::SObject_ptr SMESH_Gen_i::PublishMesh (SALOMEDS::Study_ptr   theStudy,
-                                                 SMESH::SMESH_Mesh_ptr theMesh,
+ SALOMEDS::SObject_ptr SMESH_Gen_i::PublishMesh (SMESH::SMESH_Mesh_ptr theMesh,
                                                  const char*           theName)
  {
-   if ( CORBA::is_nil( theStudy ) ||
-        CORBA::is_nil( theMesh ))
+   if ( CORBA::is_nil( theMesh ))
      return SALOMEDS::SComponent::_nil();
    if(MYDEBUG) MESSAGE("PublishMesh--IN");
  
    // find or publish a mesh
  
-   SALOMEDS::SObject_wrap aMeshSO = ObjectToSObject( theStudy, theMesh );
+   SALOMEDS::SObject_wrap aMeshSO = ObjectToSObject( theMesh );
    if ( aMeshSO->_is_nil() )
    {
-     SALOMEDS::SComponent_wrap father = PublishComponent( theStudy );
+     SALOMEDS::SComponent_wrap father = PublishComponent();
      if ( father->_is_nil() )
        return aMeshSO._retn();
  
      else
        aTag++;
  
-     aMeshSO = publish (theStudy, theMesh, father, aTag, "ICON_SMESH_TREE_MESH_WARN" );
+     aMeshSO = publish ( theMesh, father, aTag, "ICON_SMESH_TREE_MESH_WARN" );
      if ( aMeshSO->_is_nil() )
        return aMeshSO._retn();
    }
  
    GEOM::GEOM_Object_var aShapeObject = theMesh->GetShapeToMesh();
    if ( !CORBA::is_nil( aShapeObject )) {
-     addReference( theStudy, aMeshSO, aShapeObject, GetRefOnShapeTag() );
+     addReference( aMeshSO, aShapeObject, GetRefOnShapeTag() );
  
      // Publish global hypotheses
  
      for ( CORBA::ULong i = 0; i < hypList->length(); i++ )
      {
        SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( hypList[ i ]);
-       SALOMEDS::SObject_wrap so = PublishHypothesis( theStudy, aHyp );
-       AddHypothesisToShape( theStudy, theMesh, aShapeObject, aHyp );
+       SALOMEDS::SObject_wrap so = PublishHypothesis( aHyp );
+       AddHypothesisToShape( theMesh, aShapeObject, aHyp );
      }
    }
  
      SMESH::SMESH_subMesh_ptr aSubMesh = (*subIt).second->_this();
      if ( !CORBA::is_nil( aSubMesh )) {
        aShapeObject = aSubMesh->GetSubShape();
-       SALOMEDS::SObject_wrap( PublishSubMesh( theStudy, theMesh, aSubMesh, aShapeObject ));
+       SALOMEDS::SObject_wrap( PublishSubMesh( theMesh, aSubMesh, aShapeObject ));
      }
    }
  
        SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( aGroup );
        if ( !aGeomGroup->_is_nil() )
          aShapeObj = aGeomGroup->GetShape();
-       SALOMEDS::SObject_wrap( PublishGroup( theStudy, theMesh, aGroup, aShapeObj ));
+       SALOMEDS::SObject_wrap( PublishGroup( theMesh, aGroup, aShapeObj ));
      }
    }
  
  //purpose  : 
  //=======================================================================
  
- SALOMEDS::SObject_ptr SMESH_Gen_i::PublishSubMesh (SALOMEDS::Study_ptr      theStudy,
-                                                    SMESH::SMESH_Mesh_ptr    theMesh,
+ SALOMEDS::SObject_ptr SMESH_Gen_i::PublishSubMesh (SMESH::SMESH_Mesh_ptr    theMesh,
                                                     SMESH::SMESH_subMesh_ptr theSubMesh,
                                                     GEOM::GEOM_Object_ptr    theShapeObject,
                                                     const char*              theName)
  {
-   if (theStudy->_is_nil() || theMesh->_is_nil() ||
-       theSubMesh->_is_nil() || theShapeObject->_is_nil() )
+   if ( theMesh->_is_nil() || theSubMesh->_is_nil() || theShapeObject->_is_nil() )
      return SALOMEDS::SObject::_nil();
  
-   SALOMEDS::SObject_wrap aSubMeshSO = ObjectToSObject( theStudy, theSubMesh );
+   SALOMEDS::SObject_wrap aSubMeshSO = ObjectToSObject( theSubMesh );
    if ( aSubMeshSO->_is_nil() )
    {
-     SALOMEDS::SObject_wrap aMeshSO = ObjectToSObject( theStudy, theMesh );
+     SALOMEDS::SObject_wrap aMeshSO = ObjectToSObject( theMesh );
      if ( aMeshSO->_is_nil() ) {
-       aMeshSO = PublishMesh( theStudy, theMesh );
+       aMeshSO = PublishMesh( theMesh );
        if ( aMeshSO->_is_nil())
          return SALOMEDS::SObject::_nil();
      }
      }
  
      // Find or create submesh root
-     SALOMEDS::SObject_wrap aRootSO = publish (theStudy, CORBA::Object::_nil(),
-                                              aMeshSO, aRootTag, 0, false );
+     SALOMEDS::SObject_wrap aRootSO = publish ( CORBA::Object::_nil(),
+                                                aMeshSO, aRootTag, 0, false );
      if ( aRootSO->_is_nil() )
        return aSubMeshSO._retn();
  
      SMESH::array_of_ElementType_var elemTypes = theSubMesh->GetTypes();
      const int isEmpty = ( elemTypes->length() == 0 );
      const char* pm[2] = { "ICON_SMESH_TREE_MESH", "ICON_SMESH_TREE_MESH_WARN" };
-     aSubMeshSO = publish (theStudy, theSubMesh, aRootSO, 0, pm[isEmpty] );
+     aSubMeshSO = publish ( theSubMesh, aRootSO, 0, pm[isEmpty] );
      if ( aSubMeshSO->_is_nil() )
        return aSubMeshSO._retn();
    }
  
    // Add reference to theShapeObject
  
-   addReference( theStudy, aSubMeshSO, theShapeObject, 1 );
+   addReference( aSubMeshSO, theShapeObject, 1 );
  
    // Publish hypothesis
  
    SMESH::ListOfHypothesis_var hypList = theMesh->GetHypothesisList( theShapeObject );
    for ( CORBA::ULong i = 0; i < hypList->length(); i++ ) {
      SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( hypList[ i ]);
-     SALOMEDS::SObject_wrap so = PublishHypothesis( theStudy, aHyp );
-     AddHypothesisToShape( theStudy, theMesh, theShapeObject, aHyp );
+     SALOMEDS::SObject_wrap so = PublishHypothesis( aHyp );
+     AddHypothesisToShape( theMesh, theShapeObject, aHyp );
    }
  
    return aSubMeshSO._retn();
  //purpose  : 
  //=======================================================================
  
- SALOMEDS::SObject_ptr SMESH_Gen_i::PublishGroup (SALOMEDS::Study_ptr    theStudy,
-                                                  SMESH::SMESH_Mesh_ptr  theMesh,
+ SALOMEDS::SObject_ptr SMESH_Gen_i::PublishGroup (SMESH::SMESH_Mesh_ptr  theMesh,
                                                   SMESH::SMESH_GroupBase_ptr theGroup,
                                                   GEOM::GEOM_Object_ptr  theShapeObject,
                                                   const char*            theName)
  {
-   if (theStudy->_is_nil() || theMesh->_is_nil() || theGroup->_is_nil() )
+   if (theMesh->_is_nil() || theGroup->_is_nil() )
      return SALOMEDS::SObject::_nil();
  
-   SALOMEDS::SObject_wrap aGroupSO = ObjectToSObject( theStudy, theGroup );
+   SALOMEDS::SObject_wrap aGroupSO = ObjectToSObject( theGroup );
    if ( aGroupSO->_is_nil() )
    {
-     SALOMEDS::SObject_wrap aMeshSO = ObjectToSObject( theStudy, theMesh );
+     SALOMEDS::SObject_wrap aMeshSO = ObjectToSObject( theMesh );
      if ( aMeshSO->_is_nil() ) {
-       aMeshSO = PublishInStudy( theStudy, SALOMEDS::SObject::_nil(), theMesh, "");
+       aMeshSO = PublishInStudy( SALOMEDS::SObject::_nil(), theMesh, "");
        if ( aMeshSO->_is_nil())
          return SALOMEDS::SObject::_nil();
      }
        long aRootTag = GetNodeGroupsTag() + aType - 1;
  
        // Find or create groups root
-       SALOMEDS::SObject_wrap aRootSO = publish (theStudy, CORBA::Object::_nil(),
-                                                aMeshSO, aRootTag, 0, false );
+       SALOMEDS::SObject_wrap aRootSO = publish ( CORBA::Object::_nil(),
+                                                  aMeshSO, aRootTag, 0, false );
        if ( aRootSO->_is_nil() ) return SALOMEDS::SObject::_nil();
  
        if ( aType < sizeof(aRootNames)/sizeof(char*) )
              isEmpty = ( allElemTypes[i] != theGroup->GetType() );
          }
        }
-       aGroupSO = publish (theStudy, theGroup, aRootSO, 0, pm[isEmpty].c_str() );
+       aGroupSO = publish ( theGroup, aRootSO, 0, pm[isEmpty].c_str() );
      }
      if ( aGroupSO->_is_nil() )
        return aGroupSO._retn();
  
    //Add reference to geometry
    if ( !theShapeObject->_is_nil() )
-     addReference( theStudy, aGroupSO, theShapeObject, 1 );
+     addReference( aGroupSO, theShapeObject, 1 );
  
    return aGroupSO._retn();
  }
  //=======================================================================
  
  SALOMEDS::SObject_ptr
-   SMESH_Gen_i::PublishHypothesis (SALOMEDS::Study_ptr         theStudy,
-                                   SMESH::SMESH_Hypothesis_ptr theHyp,
+   SMESH_Gen_i::PublishHypothesis (SMESH::SMESH_Hypothesis_ptr theHyp,
                                    const char*                 theName)
  {
    if(MYDEBUG) MESSAGE("PublishHypothesis")
-   if (theStudy->_is_nil() || theHyp->_is_nil())
+   if (theHyp->_is_nil())
      return SALOMEDS::SObject::_nil();
  
    CORBA::String_var hypType = theHyp->GetName();
  
-   SALOMEDS::SObject_wrap aHypSO = ObjectToSObject( theStudy, theHyp );
+   SALOMEDS::SObject_wrap aHypSO = ObjectToSObject( theHyp );
    if ( aHypSO->_is_nil() )
    {
-     SALOMEDS::SComponent_wrap father = PublishComponent( theStudy );
+     SALOMEDS::SComponent_wrap father = PublishComponent();
      if ( father->_is_nil() )
        return aHypSO._retn();
  
      bool isAlgo = ( !SMESH::SMESH_Algo::_narrow( theHyp )->_is_nil() );
      int aRootTag = isAlgo ? GetAlgorithmsRootTag() : GetHypothesisRootTag();
      SALOMEDS::SObject_wrap aRootSO =
-       publish (theStudy, CORBA::Object::_nil(),father, aRootTag,
+       publish (CORBA::Object::_nil(),father, aRootTag,
                 isAlgo ? "ICON_SMESH_TREE_ALGO" : "ICON_SMESH_TREE_HYPO", false);
      SetName( aRootSO, isAlgo ?  "Algorithms" : "Hypotheses" );
  
      string pluginName = myHypCreatorMap[ hypType.in() ]->GetModuleName();
      if ( pluginName != "StdMeshers" )
        aPmName = pluginName + "::" + aPmName;
-     aHypSO = publish( theStudy, theHyp, aRootSO, 0, aPmName.c_str() );
+     aHypSO = publish( theHyp, aRootSO, 0, aPmName.c_str() );
    }
  
    SetName( aHypSO, theName, hypType.in() );
  //=======================================================================
  
  SALOMEDS::SObject_ptr
-   SMESH_Gen_i::GetMeshOrSubmeshByShape (SALOMEDS::Study_ptr   theStudy,
-                                         SMESH::SMESH_Mesh_ptr theMesh,
+   SMESH_Gen_i::GetMeshOrSubmeshByShape (SMESH::SMESH_Mesh_ptr theMesh,
                                          GEOM::GEOM_Object_ptr theShape)
  {
    if(MYDEBUG) MESSAGE("GetMeshOrSubmeshByShape")
    if ( !aShape.IsNull() && mesh_i && mesh_i->GetImpl().GetMeshDS() ) {
      SMESHDS_Mesh* meshDS = mesh_i->GetImpl().GetMeshDS();
      if ( aShape.IsSame( meshDS->ShapeToMesh() ))
-       aMeshOrSubMesh = ObjectToSObject( theStudy, theMesh );
+       aMeshOrSubMesh = ObjectToSObject( theMesh );
      else {
        int shapeID = meshDS->ShapeToIndex( aShape );
        SMESH::SMESH_subMesh_var aSubMesh = mesh_i->getSubMesh(shapeID);
        if ( !aSubMesh->_is_nil() )
-         aMeshOrSubMesh = ObjectToSObject( theStudy, aSubMesh );
+         aMeshOrSubMesh = ObjectToSObject( aSubMesh );
      }
    }
    if(MYDEBUG) MESSAGE("GetMeshOrSubmeshByShape--END")
  //purpose  : 
  //=======================================================================
  
- bool SMESH_Gen_i::AddHypothesisToShape(SALOMEDS::Study_ptr         theStudy,
-                                        SMESH::SMESH_Mesh_ptr       theMesh,
+ bool SMESH_Gen_i::AddHypothesisToShape(SMESH::SMESH_Mesh_ptr       theMesh,
                                         GEOM::GEOM_Object_ptr       theShape,
                                         SMESH::SMESH_Hypothesis_ptr theHyp)
  {
    if(MYDEBUG) MESSAGE("AddHypothesisToShape")
-   if (theStudy->_is_nil() || theMesh->_is_nil() ||
+   if (theMesh->_is_nil() ||
        theHyp->_is_nil() || (theShape->_is_nil()
                              && theMesh->HasShapeToMesh()) )
      return false;
  
-   SALOMEDS::SObject_wrap aMeshSO = ObjectToSObject( theStudy, theMesh );
+   SALOMEDS::SObject_wrap aMeshSO = ObjectToSObject( theMesh );
    if ( aMeshSO->_is_nil() )
-     aMeshSO = PublishMesh( theStudy, theMesh );
-   SALOMEDS::SObject_wrap aHypSO = PublishHypothesis( theStudy, theHyp );
+     aMeshSO = PublishMesh( theMesh );
+   SALOMEDS::SObject_wrap aHypSO = PublishHypothesis( theHyp );
    if ( aMeshSO->_is_nil() || aHypSO->_is_nil())
      return false;
  
    // Find a mesh or submesh referring to theShape
    SALOMEDS::SObject_wrap aMeshOrSubMesh =
-     GetMeshOrSubmeshByShape( theStudy, theMesh, theShape );
+     GetMeshOrSubmeshByShape( theMesh, theShape );
    if ( aMeshOrSubMesh->_is_nil() )
    {
      // publish submesh
        SMESHDS_Mesh* meshDS = mesh_i->GetImpl().GetMeshDS();
        int shapeID = meshDS->ShapeToIndex( aShape );
        SMESH::SMESH_subMesh_var aSubMesh = mesh_i->getSubMesh(shapeID);
-       aMeshOrSubMesh = PublishSubMesh( theStudy, theMesh, aSubMesh, theShape );
+       aMeshOrSubMesh = PublishSubMesh( theMesh, aSubMesh, theShape );
      }
      if ( aMeshOrSubMesh->_is_nil() )
        return false;
    //Find or Create Applied Hypothesis root
    bool aIsAlgo = !SMESH::SMESH_Algo::_narrow( theHyp )->_is_nil();
    SALOMEDS::SObject_wrap AHR =
-     publish (theStudy, CORBA::Object::_nil(), aMeshOrSubMesh,
+     publish (CORBA::Object::_nil(), aMeshOrSubMesh,
               aIsAlgo ? GetRefOnAppliedAlgorithmsTag() : GetRefOnAppliedHypothesisTag(),
               aIsAlgo ? "ICON_SMESH_TREE_ALGO" : "ICON_SMESH_TREE_HYPO", false);
    SetName( AHR, aIsAlgo ? "Applied algorithms" : "Applied hypotheses" );
  
-   addReference( theStudy, AHR, theHyp );
+   addReference( AHR, theHyp );
  
    if(MYDEBUG) MESSAGE("AddHypothesisToShape--END")
    return true;
  //purpose  : 
  //=======================================================================
  
- bool SMESH_Gen_i::RemoveHypothesisFromShape(SALOMEDS::Study_ptr         theStudy,
-                                             SMESH::SMESH_Mesh_ptr       theMesh,
+ bool SMESH_Gen_i::RemoveHypothesisFromShape(SMESH::SMESH_Mesh_ptr       theMesh,
                                              GEOM::GEOM_Object_ptr       theShape,
                                              SMESH::SMESH_Hypothesis_ptr theHyp)
  {
-   if (theStudy->_is_nil() || theMesh->_is_nil() ||
+   if (theMesh->_is_nil() ||
        theHyp->_is_nil() || (theShape->_is_nil()
                              && theMesh->HasShapeToMesh()))
      return false;
  
-   SALOMEDS::SObject_wrap aHypSO = ObjectToSObject( theStudy, theHyp );
+   SALOMEDS::SObject_wrap aHypSO = ObjectToSObject( theHyp );
    if ( aHypSO->_is_nil() )
      return false;
  
  
    // Find a mesh or sub-mesh referring to theShape
    SALOMEDS::SObject_wrap aMeshOrSubMesh =
-     GetMeshOrSubmeshByShape( theStudy, theMesh, theShape );
+     GetMeshOrSubmeshByShape( theMesh, theShape );
    if ( aMeshOrSubMesh->_is_nil() )
      return false;
  
    // Find and remove a reference to aHypSO
    SALOMEDS::SObject_wrap aRef, anObj;
-   SALOMEDS::ChildIterator_wrap it = theStudy->NewChildIterator( aMeshOrSubMesh );
+   SALOMEDS::ChildIterator_wrap it = getStudyServant()->NewChildIterator( aMeshOrSubMesh );
    bool found = false;
    for ( it->InitEx( true ); ( it->More() && !found ); it->Next() ) {
      anObj = it->Value();
      }
      if ( found )
      {
-       SALOMEDS::StudyBuilder_var builder = theStudy->NewBuilder();
+       SALOMEDS::StudyBuilder_var builder = getStudyServant()->NewBuilder();
        builder->RemoveObject( anObj );
      }
    }
  
  void SMESH_Gen_i::UpdateParameters(CORBA::Object_ptr theObject, const char* theParameters)
  {
-   SALOMEDS::Study_var aStudy = GetCurrentStudy();
-   if ( aStudy->_is_nil() )
-     return;
    // find variable names within theParameters
  
    myLastObj.clear();
    myLastParameters.clear();
    myLastParamIndex.clear(); /* vector holding indices of virables within the string
 -                               of all varibles used for theObject */ 
 +                               of all variables used for theObject */ 
    int nbVars = 0;
    int pos = 0, prevPos = 0, len = strlen( theParameters );
    if ( len == 0 ) return;
        if ( prevPos < pos )
        {
          string val( theParameters + prevPos, theParameters + pos );
-         if ( !aStudy->IsVariable( val.c_str() ))
+         if ( !getStudyServant()->IsVariable( val.c_str() ))
            val.clear();
          myLastParameters.push_back( val );
          nbVars += (! myLastParameters.back().empty() );
      return;
  
    // store
 -  // (1) variable names in the string of all varibles used for theObject and
 +  // (1) variable names in the string of all variables used for theObject and
    // (2) indices of found variables in myLastParamIndex.
  
    // remember theObject
-   SALOMEDS::SObject_wrap aSObj =  ObjectToSObject(aStudy,theObject);
+   SALOMEDS::SObject_wrap aSObj =  ObjectToSObject(theObject);
    if ( aSObj->_is_nil() )
      return;
    CORBA::String_var anObjEntry = aSObj->GetID();
    myLastObj = anObjEntry.in();
  
    // get a string of variable names
-   SALOMEDS::StudyBuilder_var   aStudyBuilder = aStudy->NewBuilder();
+   SALOMEDS::StudyBuilder_var   aStudyBuilder = getStudyServant()->NewBuilder();
    SALOMEDS::GenericAttribute_wrap     anAttr =
      aStudyBuilder->FindOrCreateAttribute( aSObj, "AttributeString" );
    SALOMEDS::AttributeString_wrap aStringAttr = anAttr;
  std::vector< std::string > SMESH_Gen_i::GetAllParameters(const std::string& theObjectEntry) const
  {
    std::vector< std::string > varNames;
-   if ( myCurrentStudy->_is_nil() )
-     return varNames;
  
-   SALOMEDS::SObject_wrap aSObj = myCurrentStudy->FindObjectID( theObjectEntry.c_str() );
-   if ( myCurrentStudy->_is_nil() )
-     return varNames;
+   SALOMEDS::SObject_wrap aSObj = getStudyServant()->FindObjectID( theObjectEntry.c_str() );
  
    // get a string of variable names
-   SALOMEDS::StudyBuilder_var   aStudyBuilder = myCurrentStudy->NewBuilder();
+   SALOMEDS::StudyBuilder_var   aStudyBuilder = getStudyServant()->NewBuilder();
    SALOMEDS::GenericAttribute_wrap     anAttr =
      aStudyBuilder->FindOrCreateAttribute( aSObj, "AttributeString" );
    SALOMEDS::AttributeString_wrap aStringAttr = anAttr;
  //   //const char* aParameters = theParameters;
  // //   const char* aParameters = CORBA::string_dup(theParameters);
  //   TCollection_AsciiString anInputParams;
- //   SALOMEDS::Study_var aStudy = GetCurrentStudy();
+ //   SALOMEDS::Study_var aStudy = getStudyServant();
  //   if( !aStudy->_is_nil() ) {
  // //     SALOMEDS::ListOfListOfStrings_var aSections = aStudy->ParseVariables(theParameters);
  // //     for(int j=0;j<aSections->length();j++) {
@@@ -1232,7 -1220,7 +1220,7 @@@ char* SMESH_Gen_i::GetParameters(CORBA:
  {
    CORBA::String_var aResult("");
  
-   SALOMEDS::SObject_wrap aSObj = ObjectToSObject( myCurrentStudy, theObject );
+   SALOMEDS::SObject_wrap aSObj = ObjectToSObject( theObject );
    if ( !aSObj->_is_nil() )
    {
      SALOMEDS::GenericAttribute_wrap attr;
index 2bd6040631cc82ee6d8b3811d0b2031cb73743fe,4f8809f99951434c43091235847d92b1b40eabe4..9007b1b95ea9a575ce3e66558e3ae09058278e50
@@@ -42,6 -42,7 +42,6 @@@
  #include "SMDS_Mesh0DElement.hxx"
  #include "SMDS_MeshFace.hxx"
  #include "SMDS_MeshVolume.hxx"
 -#include "SMDS_PolyhedralVolumeOfNodes.hxx"
  #include "SMDS_SetIterator.hxx"
  #include "SMDS_VolumeTool.hxx"
  #include "SMESHDS_Group.hxx"
@@@ -101,7 -102,7 +101,7 @@@ namespace MeshEditor_I 
      SMDSAbs_ElementType myPreviewType; // type to show
      //!< Constructor
      TPreviewMesh(SMDSAbs_ElementType previewElements = SMDSAbs_All) {
-       _isShapeToMesh = (_id =_studyId = 0);
+       _isShapeToMesh = (_id = 0);
        _myMeshDS  = new SMESHDS_Mesh( _id, true );
        myPreviewType = previewElements;
      }
      }
      void Remove( SMDSAbs_ElementType type )
      {
 -      SMDS_ElemIteratorPtr eIt = GetMeshDS()->elementsIterator( type );
 +      Remove( GetMeshDS()->elementsIterator( type ));
 +    }
 +    void Remove( SMDS_ElemIteratorPtr eIt )
 +    {
        while ( eIt->more() )
          GetMeshDS()->RemoveFreeElement( eIt->next(), /*sm=*/0, /*fromGroups=*/false );
      }
@@@ -524,18 -522,16 +524,18 @@@ SMESH::MeshPreviewStruct* SMESH_MeshEdi
    SMESH_TRY;
    const bool hasBadElems = ( getEditor().GetError() && getEditor().GetError()->HasBadElems() );
  
 -  if ( myIsPreviewMode || hasBadElems ) { // --- MeshPreviewStruct filling ---
 -
 +  if ( myIsPreviewMode || hasBadElems )
 +  {
      list<int> aNodesConnectivity;
      typedef map<int, int> TNodesMap;
      TNodesMap nodesMap;
  
      SMESHDS_Mesh* aMeshDS;
 -    std::auto_ptr< SMESH_MeshPartDS > aMeshPartDS;
 +    std::unique_ptr< SMESH_MeshPartDS > aMeshPartDS;
      if ( hasBadElems ) {
 -      aMeshPartDS.reset( new SMESH_MeshPartDS( getEditor().GetError()->myBadElements ));
 +      const list<const SMDS_MeshElement*>& badElems =
 +        static_cast<SMESH_BadInputElements*>( getEditor().GetError().get() )->myBadElements;
 +      aMeshPartDS.reset( new SMESH_MeshPartDS( badElems ));
        aMeshDS = aMeshPartDS.get();
      }
      else {
@@@ -619,9 -615,9 +619,9 @@@ SMESH::long_array* SMESH_MeshEditor_i::
    SMESH::long_array_var myLastCreatedNodes = new SMESH::long_array();
  
    const SMESH_SequenceOfElemPtr& aSeq = getEditor().GetLastCreatedNodes();
 -  myLastCreatedNodes->length( aSeq.Length() );
 -  for (int i = 1; i <= aSeq.Length(); i++)
 -    myLastCreatedNodes[i-1] = aSeq.Value(i)->GetID();
 +  myLastCreatedNodes->length( aSeq.size() );
 +  for ( size_t i = 0; i < aSeq.size(); i++)
 +    myLastCreatedNodes[i] = aSeq[i]->GetID();
  
    return myLastCreatedNodes._retn();
    SMESH_CATCH( SMESH::throwCorbaException );
@@@ -642,9 -638,9 +642,9 @@@ SMESH::long_array* SMESH_MeshEditor_i::
    SMESH::long_array_var myLastCreatedElems = new SMESH::long_array();
  
    const SMESH_SequenceOfElemPtr& aSeq = getEditor().GetLastCreatedElems();
 -  myLastCreatedElems->length( aSeq.Length() );
 -  for ( int i = 1; i <= aSeq.Length(); i++ )
 -    myLastCreatedElems[i-1] = aSeq.Value(i)->GetID();
 +  myLastCreatedElems->length( aSeq.size() );
 +  for ( size_t i = 0; i < aSeq.size(); i++ )
 +    myLastCreatedElems[i] = aSeq[i]->GetID();
  
    return myLastCreatedElems._retn();
    SMESH_CATCH( SMESH::throwCorbaException );
@@@ -681,7 -677,7 +681,7 @@@ SMESH::ComputeError* SMESH_MeshEditor_i
      errOut->code       = -( errIn->myName < 0 ? errIn->myName + 1: errIn->myName ); // -1 -> 0
      errOut->comment    = errIn->myComment.c_str();
      errOut->subShapeID = -1;
 -    errOut->hasBadMesh = !errIn->myBadElements.empty();
 +    errOut->hasBadMesh = errIn->HasBadElems();
    }
    else
    {
@@@ -4018,84 -4014,6 +4018,84 @@@ SMESH_MeshEditor_i::ScaleMakeMesh(SMESH
    return mesh._retn();
  }
  
 +//================================================================================
 +/*!
 + * \brief Make an offset mesh from a source 2D mesh
 + *  \param [inout] theObject - source mesh. New elements are added to this mesh
 + *         if \a theMeshName is empty.
 + *  \param [in] theValue - offset value
 + *  \param [in] theCopyGroups - to generate groups
 + *  \param [in] theMeshName - optional name of a new mesh
 + *  \param [out] theGroups - new groups
 + *  \return SMESH::SMESH_Mesh_ptr - the modified mesh
 + */
 +//================================================================================
 +
 +SMESH::SMESH_Mesh_ptr SMESH_MeshEditor_i::Offset( SMESH::SMESH_IDSource_ptr theObject,
 +                                                  CORBA::Double             theValue,
 +                                                  CORBA::Boolean            theCopyGroups,
 +                                                  const char*               theMeshName,
 +                                                  SMESH::ListOfGroups_out   theGroups)
 +  throw (SALOME::SALOME_Exception)
 +{
 +  SMESH_TRY;
 +  initData();
 +
 +  SMESHDS_Mesh* aMeshDS = getMeshDS();
 +
 +  SMESH::SMESH_Mesh_var         mesh_var;
 +  ::SMESH_MeshEditor::PGroupIDs groupIds;
 +
 +  TPythonDump pyDump;
 +
 +  TIDSortedElemSet elements, copyElements;
 +  if ( idSourceToSet( theObject, aMeshDS, elements, SMDSAbs_Face,
 +                      /*emptyIfIsMesh=*/ !myIsPreviewMode ))
 +  {
 +    // mesh to modify
 +    SMESH_Mesh* tgtMesh = 0;
 +    if ( myIsPreviewMode )
 +    {
 +      TPreviewMesh * tmpMesh = getPreviewMesh();
 +      tgtMesh = tmpMesh;
 +      tmpMesh->Copy( elements, copyElements );
 +      theCopyGroups = false;
 +    }
 +    else
 +    {
 +      mesh_var =
 +        *theMeshName ? makeMesh( theMeshName ) : SMESH::SMESH_Mesh::_duplicate( myMesh_i->_this() );
 +      SMESH_Mesh_i* mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh_var );
 +      tgtMesh = & mesh_i->GetImpl();
 +    }
 +    groupIds = getEditor().Offset( elements, theValue, tgtMesh, theCopyGroups, !myIsPreviewMode );
 +
 +    tgtMesh->GetMeshDS()->Modified();
 +  }
 +
 +  if ( myIsPreviewMode )
 +  {
 +    getPreviewMesh()->Remove( SMESHUtils::elemSetIterator( copyElements ));
 +  }
 +  else
 +  {
 +    theGroups = theCopyGroups ? getGroups( groupIds.get() ) : new SMESH::ListOfGroups;
 +
 +    // result of Offset() is a tuple (mesh, groups)
 +    if ( mesh_var->_is_nil() ) pyDump << myMesh_i->_this() << ", ";
 +    else                       pyDump << mesh_var          << ", ";
 +    pyDump << theGroups << " = "
 +           << this << ".Offset( "
 +           << theValue << ", "
 +           << theCopyGroups << ", "
 +           << "'" << theMeshName<< "')";
 +  }
 +
 +  return mesh_var._retn();
 +
 +  SMESH_CATCH( SMESH::throwCorbaException );
 +  return SMESH::SMESH_Mesh::_nil();
 +}
  
  //=======================================================================
  //function : findCoincidentNodes
@@@ -4795,7 -4713,8 +4795,7 @@@ void SMESH_MeshEditor_i::FillHole(cons
      getEditor().ClearLastCreated();
      SMESH_SequenceOfElemPtr& aSeq =
        const_cast<SMESH_SequenceOfElemPtr&>( getEditor().GetLastCreatedElems() );
 -    for ( size_t i = 0; i < newFaces.size(); ++i )
 -      aSeq.Append( newFaces[i] );
 +    aSeq.swap( newFaces );
  
      TPythonDump() << this << ".FillHole( SMESH.FreeBorder(" << theHole.nodeIDs << " ))";
    }
@@@ -5476,8 -5395,7 +5476,7 @@@ SMESH::SMESH_Mesh_ptr SMESH_MeshEditor_
  {
    SMESH_Gen_i*              gen = SMESH_Gen_i::GetSMESHGen();
    SMESH::SMESH_Mesh_var    mesh = gen->CreateEmptyMesh();
-   SALOMEDS::Study_var     study = gen->GetCurrentStudy();
-   SALOMEDS::SObject_wrap meshSO = gen->ObjectToSObject( study, mesh );
+   SALOMEDS::SObject_wrap meshSO = gen->ObjectToSObject( mesh );
    gen->SetName( meshSO, theMeshName, "Mesh" );
    gen->SetPixMap( meshSO, "ICON_SMESH_TREE_MESH_IMPORTED");
  
@@@ -5610,7 -5528,7 +5609,7 @@@ bool SMESH_MeshEditor_i::idSourceToSet(
   * \param theElements - container of elements to duplicate.
   * \param theGroupName - a name of group to contain the generated elements.
   *                    If a group with such a name already exists, the new elements
 - *                    are added to the existng group, else a new group is created.
 + *                    are added to the existing group, else a new group is created.
   *                    If \a theGroupName is empty, new elements are not added 
   *                    in any group.
   * \return a group where the new elements are added. NULL if theGroupName == "".
@@@ -5635,11 -5553,11 +5634,11 @@@ SMESH_MeshEditor_i::DoubleElements(SMES
    {
      getEditor().DoubleElements( elems );
  
 -    if ( strlen( theGroupName ) && !getEditor().GetLastCreatedElems().IsEmpty() )
 +    if ( strlen( theGroupName ) && !getEditor().GetLastCreatedElems().empty() )
      {
        // group type
        SMESH::ElementType type =
 -        SMESH::ElementType( getEditor().GetLastCreatedElems().Value(1)->GetType() );
 +        SMESH::ElementType( getEditor().GetLastCreatedElems()[0]->GetType() );
        // find existing group
        SMESH::ListOfGroups_var groups = myMesh_i->GetGroups();
        for ( size_t i = 0; i < groups->length(); ++i )
        {
          SMESHDS_Group* groupDS = static_cast< SMESHDS_Group* >( group_i->GetGroupDS() );
          const SMESH_SequenceOfElemPtr& aSeq = getEditor().GetLastCreatedElems();
 -        for ( int i = 1; i <= aSeq.Length(); i++ )
 -          groupDS->SMDSGroup().Add( aSeq(i) );
 +        for ( size_t i = 0; i < aSeq.size(); i++ )
 +          groupDS->SMDSGroup().Add( aSeq[i] );
        }
      }
    }
@@@ -6151,14 -6069,14 +6150,14 @@@ SMESH_MeshEditor_i::DoubleNodeElemGroup
      // Create group with newly created elements
      CORBA::String_var elemGroupName = theElems->GetName();
      std::string aNewName = generateGroupName( std::string(elemGroupName.in()) + "_double");
 -    if ( !getEditor().GetLastCreatedElems().IsEmpty() && theElemGroupNeeded )
 +    if ( !getEditor().GetLastCreatedElems().empty() && theElemGroupNeeded )
      {
        SMESH::long_array_var anIds = GetLastCreatedElems();
        SMESH::ElementType aGroupType = myMesh_i->GetElementType(anIds[0], true);
        aNewElemGroup = myMesh_i->CreateGroup(aGroupType, aNewName.c_str());
        aNewElemGroup->Add(anIds);
      }
 -    if ( !getEditor().GetLastCreatedNodes().IsEmpty() && theNodeGroupNeeded )
 +    if ( !getEditor().GetLastCreatedNodes().empty() && theNodeGroupNeeded )
      {
        SMESH::long_array_var anIds = GetLastCreatedNodes();
        aNewNodeGroup = myMesh_i->CreateGroup(SMESH::NODE, aNewName.c_str());
@@@ -6383,14 -6301,14 +6382,14 @@@ SMESH_MeshEditor_i::DoubleNodeElemGroup
      // Create group with newly created elements
      CORBA::String_var elemGroupName = theElems[0]->GetName();
      std::string aNewName = generateGroupName( std::string(elemGroupName.in()) + "_double");
 -    if ( !getEditor().GetLastCreatedElems().IsEmpty() && theElemGroupNeeded )
 +    if ( !getEditor().GetLastCreatedElems().empty() && theElemGroupNeeded )
      {
        SMESH::long_array_var anIds = GetLastCreatedElems();
        SMESH::ElementType aGroupType = myMesh_i->GetElementType(anIds[0], true);
        aNewElemGroup = myMesh_i->CreateGroup(aGroupType, aNewName.c_str());
        aNewElemGroup->Add(anIds);
      }
 -    if ( !getEditor().GetLastCreatedNodes().IsEmpty() && theNodeGroupNeeded )
 +    if ( !getEditor().GetLastCreatedNodes().empty() && theNodeGroupNeeded )
      {
        SMESH::long_array_var anIds = GetLastCreatedNodes();
        aNewNodeGroup = myMesh_i->CreateGroup(SMESH::NODE, aNewName.c_str());
@@@ -6964,7 -6882,7 +6963,7 @@@ CORBA::Long SMESH_MeshEditor_i::MakeBou
    // group of boundary elements
    SMESH_Group* smesh_group = 0;
    SMDSAbs_ElementType elemType = (dim == SMESH::BND_2DFROM3D) ? SMDSAbs_Volume : SMDSAbs_Face;
 -  if ( strlen(groupName) )
 +  if ( strlen( groupName ))
    {
      SMESH::ElementType groupType = SMESH::ElementType( int(elemType)-1 );
      group_var = mesh_i->CreateGroup( groupType, groupName );
index 615546bea9a273128a526c06da0503165e89c2f6,a38dd896f89afe2660bf15b49ef60e6f300c3472..d8ddcf6b92565a157ba7488ca01e8ad8b143c7f2
  #include "DriverMED_W_Field.h"
  #include "DriverMED_W_SMESHDS_Mesh.h"
  #include "MED_Factory.hxx"
 +#include "SMDS_LinearEdge.hxx"
  #include "SMDS_EdgePosition.hxx"
  #include "SMDS_ElemIterator.hxx"
  #include "SMDS_FacePosition.hxx"
  #include "SMDS_IteratorOnIterators.hxx"
  #include "SMDS_MeshGroup.hxx"
  #include "SMDS_SetIterator.hxx"
 +#include "SMDS_StdIterator.hxx"
  #include "SMDS_VolumeTool.hxx"
  #include "SMESHDS_Command.hxx"
  #include "SMESHDS_CommandType.hxx"
@@@ -106,14 -104,12 +106,12 @@@ int SMESH_Mesh_i::_idGenerator = 0
  //=============================================================================
  
  SMESH_Mesh_i::SMESH_Mesh_i( PortableServer::POA_ptr thePOA,
-                             SMESH_Gen_i*            gen_i,
-                             CORBA::Long             studyId )
+                             SMESH_Gen_i*            gen_i )
  : SALOME::GenericObj_i( thePOA )
  {
    _impl          = NULL;
    _gen_i         = gen_i;
    _id            = _idGenerator++;
-   _studyId       = studyId;
    _editor        = NULL;
    _previewEditor = NULL;
    _preMeshInfo   = NULL;
@@@ -160,7 -156,7 +158,7 @@@ SMESH_Mesh_i::~SMESH_Mesh_i(
    }
    _mapHypo.clear();
  
 -  // clear cashed shapes if no more meshes remain; (the cash is blame,
 +  // clear cached shapes if no more meshes remain; (the cache is blame,
    // together with publishing, of spent time increasing in issue 22874)
    if ( _impl->NbMeshes() == 1 )
      _gen_i->GetShapeReader()->ClearClientBuffer();
@@@ -241,9 -237,7 +239,7 @@@ GEOM::GEOM_Object_ptr SMESH_Mesh_i::Get
          for ( ; data != _geomGroupData.end(); ++data )
            if ( data->_smeshObject->_is_equivalent( _this() ))
            {
-             SALOMEDS::Study_var study = _gen_i->GetCurrentStudy();
-             if ( study->_is_nil() ) break;
-             SALOMEDS::SObject_wrap so = study->FindObjectID( data->_groupEntry.c_str() );
+             SALOMEDS::SObject_wrap so = SMESH_Gen_i::getStudyServant()->FindObjectID( data->_groupEntry.c_str() );
              CORBA::Object_var     obj = _gen_i->SObjectToObject( so );
              aShapeObj = GEOM::GEOM_Object::_narrow( obj );
              break;
@@@ -408,8 -402,8 +404,8 @@@ SMESH_Mesh_i::ImportMEDFile( const char
    CreateGroupServants();
  
    int major, minor, release;
-   if( !MED::getMEDVersion( theFileName, major, minor, release ) )
-     major = minor = release = -1;
+   major = minor = release = 0;
+   MED::GetMEDVersion(theFileName, major, minor, release);
    _medFileInfo           = new SMESH::MedFileInfo();
    _medFileInfo->fileName = theFileName;
    _medFileInfo->fileSize = 0;
@@@ -449,19 -443,6 +445,6 @@@ SMESH::DriverMED_ReadStatus SMESH_Mesh_
    return ConvertDriverMEDReadStatus(status);
  }
  
- //================================================================================
- /*!
-  * \brief Return string representation of a MED file version comprising nbDigits
-  */
- //================================================================================
- char* SMESH_Mesh_i::GetVersionString(SMESH::MED_VERSION version, CORBA::Short nbDigits)
- {
-   string ver = DriverMED_W_SMESHDS_Mesh::GetVersionString(MED::EVersion(version),
-                                                           nbDigits);
-   return CORBA::string_dup( ver.c_str() );
- }
  //=============================================================================
  /*!
   *  ImportUNVFile
@@@ -501,8 -482,7 +484,7 @@@ int SMESH_Mesh_i::ImportSTLFile( const 
    std::string name = _impl->STLToMesh( theFileName );
    if ( !name.empty() )
    {
-     SALOMEDS::Study_var     study = _gen_i->GetCurrentStudy();
-     SALOMEDS::SObject_wrap meshSO = _gen_i->ObjectToSObject( study, _this() );
+     SALOMEDS::SObject_wrap meshSO = _gen_i->ObjectToSObject( _this() );
      _gen_i->SetName( meshSO, name.c_str() );
    }
  
@@@ -566,7 -546,7 +548,7 @@@ SMESH::Hypothesis_Status SMESH_Mesh_i::
    switch (theStatus) {
    RETURNCASE( HYP_OK            );
    RETURNCASE( HYP_MISSING       );
 -  RETURNCASE( HYP_CONCURENT     );
 +  RETURNCASE( HYP_CONCURRENT    );
    RETURNCASE( HYP_BAD_PARAMETER );
    RETURNCASE( HYP_HIDDEN_ALGO   );
    RETURNCASE( HYP_HIDING_ALGO   );
@@@ -611,8 -591,7 +593,7 @@@ SMESH_Mesh_i::AddHypothesis(GEOM::GEOM_
    SMESH::SMESH_Mesh_var mesh( _this() );
    if ( !SMESH_Hypothesis::IsStatusFatal(status) )
    {
-     SALOMEDS::Study_var study = _gen_i->GetCurrentStudy();
-     _gen_i->AddHypothesisToShape( study, mesh, aSubShape, anHyp );
+     _gen_i->AddHypothesisToShape( mesh, aSubShape, anHyp );
    }
    if(MYDEBUG) MESSAGE( " AddHypothesis(): status = " << status );
  
@@@ -697,8 -676,7 +678,7 @@@ SMESH::Hypothesis_Status SMESH_Mesh_i::
  
    if ( !SMESH_Hypothesis::IsStatusFatal(status) )
    {
-     SALOMEDS::Study_var study = _gen_i->GetCurrentStudy();
-     _gen_i->RemoveHypothesisFromShape( study, mesh, aSubShape, anHyp );
+     _gen_i->RemoveHypothesisFromShape( mesh, aSubShape, anHyp );
    }
    // Update Python script
    if(_impl->HasShapeToMesh())
@@@ -868,9 -846,8 +848,8 @@@ SMESH::SMESH_subMesh_ptr SMESH_Mesh_i::
        subMesh = createSubMesh( aSubShape );
      if ( _gen_i->CanPublishInStudy( subMesh ))
      {
-       SALOMEDS::Study_var study = _gen_i->GetCurrentStudy();
        SALOMEDS::SObject_wrap aSO =
-         _gen_i->PublishSubMesh( study, aMesh, subMesh, aSubShape, theName );
+         _gen_i->PublishSubMesh( aMesh, subMesh, aSubShape, theName );
        if ( !aSO->_is_nil()) {
          // Update Python script
          TPythonDump() << aSO << " = " << aMesh << ".GetSubMesh( "
@@@ -899,28 -876,25 +878,25 @@@ void SMESH_Mesh_i::RemoveSubMesh( SMESH
      return;
  
    GEOM::GEOM_Object_var aSubShape;
-   SALOMEDS::Study_var aStudy = _gen_i->GetCurrentStudy();
-   if ( !aStudy->_is_nil() )  {
-     // Remove submesh's SObject
-     SALOMEDS::SObject_wrap anSO = _gen_i->ObjectToSObject( aStudy, theSubMesh );
-     if ( !anSO->_is_nil() ) {
-       long aTag = SMESH_Gen_i::GetRefOnShapeTag();
-       SALOMEDS::SObject_wrap anObj, aRef;
-       if ( anSO->FindSubObject( aTag, anObj.inout() ) &&
-            anObj->ReferencedObject( aRef.inout() ))
-       {
-         CORBA::Object_var obj = aRef->GetObject();
-         aSubShape = GEOM::GEOM_Object::_narrow( obj );
-       }
-       // if ( aSubShape->_is_nil() ) // not published shape (IPAL13617)
-       //   aSubShape = theSubMesh->GetSubShape();
+   // Remove submesh's SObject
+   SALOMEDS::SObject_wrap anSO = _gen_i->ObjectToSObject( theSubMesh );
+   if ( !anSO->_is_nil() ) {
+     long aTag = SMESH_Gen_i::GetRefOnShapeTag();
+     SALOMEDS::SObject_wrap anObj, aRef;
+     if ( anSO->FindSubObject( aTag, anObj.inout() ) &&
+          anObj->ReferencedObject( aRef.inout() ))
+     {
+       CORBA::Object_var obj = aRef->GetObject();
+       aSubShape = GEOM::GEOM_Object::_narrow( obj );
+     }
+     // if ( aSubShape->_is_nil() ) // not published shape (IPAL13617)
+     //   aSubShape = theSubMesh->GetSubShape();
  
-       SALOMEDS::StudyBuilder_var builder = aStudy->NewBuilder();
-       builder->RemoveObjectWithChildren( anSO );
+     SALOMEDS::StudyBuilder_var builder = SMESH_Gen_i::getStudyServant()->NewBuilder();
+     builder->RemoveObjectWithChildren( anSO );
  
-       // Update Python script
-       TPythonDump() << SMESH::SMESH_Mesh_var( _this() ) << ".RemoveSubMesh( " << anSO << " )";
-     }
+     // Update Python script
+     TPythonDump() << SMESH::SMESH_Mesh_var( _this() ) << ".RemoveSubMesh( " << anSO << " )";
    }
  
    if ( removeSubMesh( theSubMesh, aSubShape.in() ))
@@@ -950,9 -924,8 +926,8 @@@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::Cr
    if ( _gen_i->CanPublishInStudy( aNewGroup ) )
    {
      SMESH::SMESH_Mesh_var mesh = _this();
-     SALOMEDS::Study_var  study = _gen_i->GetCurrentStudy();
      SALOMEDS::SObject_wrap aSO =
-       _gen_i->PublishGroup( study, mesh, aNewGroup, GEOM::GEOM_Object::_nil(), theName);
+       _gen_i->PublishGroup( mesh, aNewGroup, GEOM::GEOM_Object::_nil(), theName);
      if ( !aSO->_is_nil())
        // Update Python script
        TPythonDump() << aSO << " = " << mesh << ".CreateGroup( "
@@@ -987,9 -960,8 +962,8 @@@ SMESH_Mesh_i::CreateGroupFromGEOM (SMES
      if ( _gen_i->CanPublishInStudy( aNewGroup ) )
      {
        SMESH::SMESH_Mesh_var mesh = _this();
-       SALOMEDS::Study_var  study = _gen_i->GetCurrentStudy();
        SALOMEDS::SObject_wrap aSO =
-         _gen_i->PublishGroup( study, mesh, aNewGroup, theGeomObj, theName );
+         _gen_i->PublishGroup( mesh, aNewGroup, theGeomObj, theName );
        if ( !aSO->_is_nil())
          TPythonDump() << aSO << " = " << mesh << ".CreateGroupFromGEOM( "
                        << theElemType << ", '" << theName << "', " << theGeomObj << " )";
@@@ -1036,9 -1008,8 +1010,8 @@@ SMESH_Mesh_i::CreateGroupFromFilter(SME
    if ( _gen_i->CanPublishInStudy( aNewGroup ) )
    {
      SMESH::SMESH_Mesh_var mesh = _this();
-     SALOMEDS::Study_var  study = _gen_i->GetCurrentStudy();
      SALOMEDS::SObject_wrap aSO =
-       _gen_i->PublishGroup( study, mesh, aNewGroup, GEOM::GEOM_Object::_nil(), theName );
+       _gen_i->PublishGroup( mesh, aNewGroup, GEOM::GEOM_Object::_nil(), theName );
  
      if ( !aSO->_is_nil())
        pd << aSO << " = " << mesh << ".CreateGroupFromFilter( "
@@@ -1065,19 -1036,15 +1038,15 @@@ void SMESH_Mesh_i::RemoveGroup( SMESH::
    if ( !aGroup )
      return;
  
-   SALOMEDS::Study_var aStudy = _gen_i->GetCurrentStudy();
-   if ( !aStudy->_is_nil() )
+   SALOMEDS::SObject_wrap aGroupSO = _gen_i->ObjectToSObject( theGroup );
+   if ( !aGroupSO->_is_nil() )
    {
-     SALOMEDS::SObject_wrap aGroupSO = _gen_i->ObjectToSObject( aStudy, theGroup );
-     if ( !aGroupSO->_is_nil() )
-     {
-       // Update Python script
-       TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".RemoveGroup( " << aGroupSO << " )";
+     // Update Python script
+     TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".RemoveGroup( " << aGroupSO << " )";
  
-       // Remove group's SObject
-       SALOMEDS::StudyBuilder_var builder = aStudy->NewBuilder();
-       builder->RemoveObjectWithChildren( aGroupSO );
-     }
+     // Remove group's SObject
+     SALOMEDS::StudyBuilder_var builder = SMESH_Gen_i::getStudyServant()->NewBuilder();
+     builder->RemoveObjectWithChildren( aGroupSO );
    }
    aGroup->Modified(/*removed=*/true); // notify dependent Filter with FT_BelongToMeshGroup criterion
  
@@@ -1104,8 -1071,7 +1073,8 @@@ void SMESH_Mesh_i::RemoveGroupWithConte
      return;
  
    vector<int> nodeIds; // to remove nodes becoming free
 -  if ( !theGroup->IsEmpty() )
 +  bool isNodal = ( theGroup->GetType() == SMESH::NODE );
 +  if ( !isNodal && !theGroup->IsEmpty() )
    {
      CORBA::Long elemID = theGroup->GetID( 1 );
      int nbElemNodes = GetElemNbNodes( elemID );
        nodeIds.reserve( theGroup->Size() * nbElemNodes );
    }
  
 -  // Remove contents
 +  // Retrieve contents
    SMESH::SMESH_IDSource_var idSrc = SMESH::SMESH_IDSource::_narrow( theGroup );
    SMDS_ElemIteratorPtr     elemIt = GetElements( idSrc, theGroup->GetType() );
 -  while ( elemIt->more() )
 -  {
 -    const SMDS_MeshElement* e = elemIt->next();
 +  SMDS_StdIterator< const SMDS_MeshElement*, SMDS_ElemIteratorPtr > elemBeg( elemIt ), elemEnd;
 +  std::vector< const SMDS_MeshElement* > elems( theGroup->Size() );
 +  elems.assign( elemBeg, elemEnd );
  
 -    SMDS_ElemIteratorPtr nIt = e->nodesIterator();
 -    while ( nIt->more() )
 -      nodeIds.push_back( nIt->next()->GetID() );
 +  TPythonDump pyDump; // Suppress dump from RemoveGroup()
  
 -    _impl->GetMeshDS()->RemoveElement( e );
 +  // Remove group
 +  RemoveGroup( theGroup );
 +
 +  // Remove contents
 +  for ( size_t i = 0; i < elems.size(); ++i )
 +  {
 +    // if ( !_impl->GetMeshDS()->Contains( elems[i] ))
 +    //   continue;
 +    if ( !isNodal )
 +    {
 +      for ( SMDS_ElemIteratorPtr nIt = elems[i]->nodesIterator(); nIt->more(); )
 +        nodeIds.push_back( nIt->next()->GetID() );
 +
 +      _impl->GetMeshDS()->RemoveFreeElement( elems[i], /*sm=*/0 );
 +    }
 +    else
 +    {
 +      _impl->GetMeshDS()->RemoveElement( elems[i] );
 +    }
    }
  
    // Remove free nodes
 -  if ( theGroup->GetType() != SMESH::NODE )
 -    for ( size_t i = 0 ; i < nodeIds.size(); ++i )
 -      if ( const SMDS_MeshNode* n = _impl->GetMeshDS()->FindNode( nodeIds[i] ))
 -        if ( n->NbInverseElements() == 0 )
 -          _impl->GetMeshDS()->RemoveFreeNode( n, /*sm=*/0 );
 -
 -  TPythonDump pyDump; // Suppress dump from RemoveGroup()
 +  for ( size_t i = 0 ; i < nodeIds.size(); ++i )
 +    if ( const SMDS_MeshNode* n = _impl->GetMeshDS()->FindNode( nodeIds[i] ))
 +      if ( n->NbInverseElements() == 0 )
 +        _impl->GetMeshDS()->RemoveFreeNode( n, /*sm=*/0 );
  
    // Update Python script (theGroup must be alive for this)
    pyDump << SMESH::SMESH_Mesh_var(_this())
           << ".RemoveGroupWithContents( " << theGroup << " )";
  
 -  // Remove group
 -  RemoveGroup( theGroup );
 -
    SMESH_CATCH( SMESH::throwCorbaException );
  }
  
@@@ -1849,14 -1805,13 +1818,13 @@@ void SMESH_Mesh_i::addGeomGroupData(GEO
    if ( CORBA::is_nil( theGeomObj ) || theGeomObj->GetType() != GEOM_GROUP )
      return;
    // group SO
-   SALOMEDS::Study_var    study   = _gen_i->GetCurrentStudy();
-   SALOMEDS::SObject_wrap groupSO = _gen_i->ObjectToSObject( study, theGeomObj );
+   SALOMEDS::SObject_wrap groupSO = _gen_i->ObjectToSObject( theGeomObj );
    if ( groupSO->_is_nil() )
      return;
    // group indices
    GEOM::GEOM_Gen_var geomGen = _gen_i->GetGeomEngine();
    GEOM::GEOM_IGroupOperations_wrap groupOp =
-     geomGen->GetIGroupOperations( _gen_i->GetCurrentStudyID() );
+     geomGen->GetIGroupOperations();
    GEOM::ListOfLong_var ids = groupOp->GetObjects( theGeomObj );
  
    // store data
@@@ -1904,9 -1859,7 +1872,7 @@@ TopoDS_Shape SMESH_Mesh_i::newGroupShap
    TopoDS_Shape newShape;
  
    // get geom group
-   SALOMEDS::Study_var study = _gen_i->GetCurrentStudy();
-   if ( study->_is_nil() ) return newShape; // means "not changed"
-   SALOMEDS::SObject_wrap groupSO = study->FindObjectID( groupData._groupEntry.c_str() );
+   SALOMEDS::SObject_wrap groupSO = SMESH_Gen_i::getStudyServant()->FindObjectID( groupData._groupEntry.c_str() );
    if ( !groupSO->_is_nil() )
    {
      CORBA::Object_var groupObj = _gen_i->SObjectToObject( groupSO );
      set<int> curIndices;
      GEOM::GEOM_Gen_var geomGen = _gen_i->GetGeomEngine();
      GEOM::GEOM_IGroupOperations_wrap groupOp =
-       geomGen->GetIGroupOperations( _gen_i->GetCurrentStudyID() );
+       geomGen->GetIGroupOperations();
      GEOM::ListOfLong_var   ids = groupOp->GetObjects( geomGroup );
      for ( CORBA::ULong i = 0; i < ids->length(); ++i )
        curIndices.insert( ids[i] );
@@@ -1982,9 -1935,6 +1948,6 @@@ void SMESH_Mesh_i::CheckGeomModif(
  {
    if ( !_impl->HasShapeToMesh() ) return;
  
-   SALOMEDS::Study_var study = _gen_i->GetCurrentStudy();
-   if ( study->_is_nil() ) return;
    GEOM::GEOM_Object_var mainGO = _gen_i->ShapeToGeomObject( _impl->GetShapeToMesh() );
    //if ( mainGO->_is_nil() ) return;
  
@@@ -2131,9 -2081,6 +2094,6 @@@ void SMESH_Mesh_i::CheckGeomGroupModif(
  {
    if ( !_impl->HasShapeToMesh() ) return;
  
-   SALOMEDS::Study_var study = _gen_i->GetCurrentStudy();
-   if ( study->_is_nil() ) return;
    CORBA::Long nbEntities = NbNodes() + NbElements();
  
    // Check if group contents changed
          if ( _mapGroups.find( oldID ) == _mapGroups.end() )
            continue;
          // get group name
-         SALOMEDS::SObject_wrap groupSO = _gen_i->ObjectToSObject( study,_mapGroups[oldID] );
+         SALOMEDS::SObject_wrap groupSO = _gen_i->ObjectToSObject( _mapGroups[oldID] );
          CORBA::String_var      name    = groupSO->GetName();
          // update
          SMESH_GroupBase_i*  group_i    = SMESH::DownCast<SMESH_GroupBase_i*>(_mapGroups[oldID] );
    if ( newNbEntities != nbEntities )
    {
      // Add all SObjects with icons to soToUpdateIcons
-     soToUpdateIcons.push_back( _gen_i->ObjectToSObject( study, _this() )); // mesh
+     soToUpdateIcons.push_back( _gen_i->ObjectToSObject( _this() )); // mesh
  
      for (map<int, SMESH::SMESH_subMesh_ptr>::iterator i_sm = _mapSubMeshIor.begin();
           i_sm != _mapSubMeshIor.end(); ++i_sm ) // submeshes
-       soToUpdateIcons.push_back( _gen_i->ObjectToSObject( study, i_sm->second ));
+       soToUpdateIcons.push_back( _gen_i->ObjectToSObject( i_sm->second ));
  
      for ( map<int, SMESH::SMESH_GroupBase_ptr>::iterator i_gr = _mapGroups.begin();
            i_gr != _mapGroups.end(); ++i_gr ) // groups
-       soToUpdateIcons.push_back( _gen_i->ObjectToSObject( study, i_gr->second ));
+       soToUpdateIcons.push_back( _gen_i->ObjectToSObject( i_gr->second ));
    }
  
    list< SALOMEDS::SObject_wrap >::iterator so = soToUpdateIcons.begin();
@@@ -2395,10 -2342,10 +2355,10 @@@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::Co
  
    SALOMEDS::StudyBuilder_var builder;
    SALOMEDS::SObject_wrap     aGroupSO;
-   SALOMEDS::Study_var        aStudy = _gen_i->GetCurrentStudy();
+   SALOMEDS::Study_var        aStudy = SMESH_Gen_i::getStudyServant();
    if ( !aStudy->_is_nil() ) {
      builder  = aStudy->NewBuilder();
-     aGroupSO = _gen_i->ObjectToSObject( aStudy, theGroup );
+     aGroupSO = _gen_i->ObjectToSObject( theGroup );
      if ( !aGroupSO->_is_nil() )
      {
        // remove reference to geometry
@@@ -2565,7 -2512,7 +2525,7 @@@ SMESH::SMESH_GroupBase_ptr SMESH_Mesh_i
                                                        const SMESH_PredicatePtr& thePredicate )
  {
    std::string newName;
 -  if ( !theName || strlen( theName ) == 0 )
 +  if ( !theName || !theName[0] )
    {
      std::set< std::string > presentNames;
      std::map<int, SMESH::SMESH_GroupBase_ptr>::const_iterator i_gr = _mapGroups.begin();
@@@ -2719,17 -2666,6 +2679,6 @@@ CORBA::Long SMESH_Mesh_i::GetId()throw(
    return _id;
  }
  
- //=============================================================================
- /*!
-  *
-  */
- //=============================================================================
- CORBA::Long SMESH_Mesh_i::GetStudyId()throw(SALOME::SALOME_Exception)
- {
-   return _studyId;
- }
  //=============================================================================
  namespace
  {
@@@ -2989,9 -2925,9 +2938,9 @@@ string SMESH_Mesh_i::prepareMeshNameAnd
    // Perform Export
    PrepareForWriting(file, overwrite);
    string aMeshName = "Mesh";
-   SALOMEDS::Study_var aStudy = _gen_i->GetCurrentStudy();
+   SALOMEDS::Study_var aStudy = SMESH_Gen_i::getStudyServant();
    if ( !aStudy->_is_nil() ) {
-     SALOMEDS::SObject_wrap aMeshSO = _gen_i->ObjectToSObject( aStudy, _this() );
+     SALOMEDS::SObject_wrap aMeshSO = _gen_i->ObjectToSObject(  _this() );
      if ( !aMeshSO->_is_nil() ) {
        CORBA::String_var name = aMeshSO->GetName();
        aMeshName = name;
  
  //================================================================================
  /*!
-  * \brief Export to med file
+  * \brief Export to MED file
   */
  //================================================================================
  
- void SMESH_Mesh_i::ExportToMEDX (const char*        file,
-                                  CORBA::Boolean     auto_groups,
-                                  SMESH::MED_VERSION theVersion,
-                                  CORBA::Boolean     overwrite,
-                                  CORBA::Boolean     autoDimension)
+ void SMESH_Mesh_i::ExportMED(const char*        file,
+                              CORBA::Boolean     auto_groups,
+                              CORBA::Boolean     overwrite,
+                              CORBA::Boolean     autoDimension)
    throw(SALOME::SALOME_Exception)
  {
    //MESSAGE("SMESH::MED_VERSION:"<< theVersion);
      _preMeshInfo->FullLoadFromFile();
  
    string aMeshName = prepareMeshNameAndGroups(file, overwrite);
-   _impl->ExportMED( file, aMeshName.c_str(), auto_groups, theVersion, 0, autoDimension );
+   _impl->ExportMED( file, aMeshName.c_str(), auto_groups, 0, autoDimension );
  
-   TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".ExportToMEDX( r'"
+   TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".ExportMED( r'"
                  << file << "', " << auto_groups << ", "
-                 << theVersion << ", " << overwrite << ", "
+                 << overwrite << ", "
                  << autoDimension << " )";
  
    SMESH_CATCH( SMESH::throwCorbaException );
  }
  
- //================================================================================
- /*!
-  * \brief Export a mesh to a med file
-  */
- //================================================================================
- void SMESH_Mesh_i::ExportToMED (const char*        file,
-                                 CORBA::Boolean     auto_groups,
-                                 SMESH::MED_VERSION theVersion)
-   throw(SALOME::SALOME_Exception)
- {
-   //MESSAGE("SMESH::MED_VERSION:"<< theVersion);
-   ExportToMEDX(file,auto_groups,theVersion,true);
- }
- //================================================================================
- /*!
-  * \brief Export a mesh to a med file
-  */
- //================================================================================
- void SMESH_Mesh_i::ExportMED (const char* file,
-                               CORBA::Boolean auto_groups)
-   throw(SALOME::SALOME_Exception)
- {
-   //MESSAGE("SMESH::MED_VERSION:"<< SMESH::MED_LATEST);
-   ExportToMEDX(file,auto_groups,SMESH::MED_LATEST,true);
- }
  //================================================================================
  /*!
   * \brief Export a mesh to a SAUV file
@@@ -3167,8 -3073,7 +3086,7 @@@ void SMESH_Mesh_i::ExportSTL (const cha
                  << ".ExportSTL( r'" << file << "', " << isascii << " )";
  
    CORBA::String_var name;
-   SALOMEDS::Study_var study = _gen_i->GetCurrentStudy();
-   SALOMEDS::SObject_wrap so = _gen_i->ObjectToSObject( study, _this() );
+   SALOMEDS::SObject_wrap so = _gen_i->ObjectToSObject( _this() );
    if ( !so->_is_nil() )
      name = so->GetName();
  
  void SMESH_Mesh_i::ExportPartToMED(SMESH::SMESH_IDSource_ptr meshPart,
                                     const char*               file,
                                     CORBA::Boolean            auto_groups,
-                                    SMESH::MED_VERSION        version,
                                     CORBA::Boolean            overwrite,
                                     CORBA::Boolean            autoDimension,
                                     const GEOM::ListOfFields& fields,
    {
      aMeshName = prepareMeshNameAndGroups(file, overwrite);
      _impl->ExportMED( file, aMeshName.c_str(), auto_groups,
-                       version, 0, autoDimension, /*addODOnVertices=*/have0dField);
+                       0, autoDimension, /*addODOnVertices=*/have0dField);
      meshDS = _impl->GetMeshDS();
    }
    else
  
      PrepareForWriting(file, overwrite);
  
-     SALOMEDS::Study_var aStudy = _gen_i->GetCurrentStudy();
-     if ( !aStudy->_is_nil() ) {
-       SALOMEDS::SObject_wrap SO = _gen_i->ObjectToSObject( aStudy, meshPart );
-       if ( !SO->_is_nil() ) {
-         CORBA::String_var name = SO->GetName();
-         aMeshName = name;
-       }
+     SALOMEDS::SObject_wrap SO = _gen_i->ObjectToSObject( meshPart );
+     if ( !SO->_is_nil() ) {
+       CORBA::String_var name = SO->GetName();
+       aMeshName = name;
      }
      SMESH_MeshPartDS* partDS = new SMESH_MeshPartDS( meshPart );
      _impl->ExportMED( file, aMeshName.c_str(), auto_groups,
-                       version, partDS, autoDimension, /*addODOnVertices=*/have0dField);
+                       partDS, autoDimension, /*addODOnVertices=*/have0dField);
      meshDS = tmpDSDeleter._obj = partDS;
    }
  
    }
    TPythonDump() << _this() << ".ExportPartToMED( "
                  << meshPart << ", r'" << file << "', "
-                 << auto_groups << ", " << version << ", " << overwrite << ", "
+                 << auto_groups << ", " << overwrite << ", "
                  << autoDimension << ", " << goList
                  << ", '" << ( geomAssocFields ? geomAssocFields : "" ) << "'" << " )";
  
@@@ -3624,8 -3526,7 +3539,7 @@@ void SMESH_Mesh_i::ExportPartToSTL(::SM
    PrepareForWriting(file);
  
    CORBA::String_var name;
-   SALOMEDS::Study_var study = _gen_i->GetCurrentStudy();
-   SALOMEDS::SObject_wrap so = _gen_i->ObjectToSObject( study, meshPart );
+   SALOMEDS::SObject_wrap so = _gen_i->ObjectToSObject( meshPart );
    if ( !so->_is_nil() )
      name = so->GetName();
  
@@@ -3656,8 -3557,7 +3570,7 @@@ void SMESH_Mesh_i::ExportCGNS(::SMESH::
    PrepareForWriting(file,overwrite);
  
    std::string meshName("");
-   SALOMEDS::Study_var study = _gen_i->GetCurrentStudy();
-   SALOMEDS::SObject_wrap so = _gen_i->ObjectToSObject( study, meshPart );
+   SALOMEDS::SObject_wrap so = _gen_i->ObjectToSObject( meshPart );
    if ( !so->_is_nil() )
    {
      CORBA::String_var name = so->GetName();
@@@ -4112,14 -4012,14 +4025,14 @@@ SMESH::long_array* SMESH_Mesh_i::GetNod
      _preMeshInfo->FullLoadFromFile();
  
    SMESH::long_array_var aResult = new SMESH::long_array();
 -  SMESHDS_Mesh* aSMESHDS_Mesh = _impl->GetMeshDS();
 +  SMESHDS_Mesh* aMeshDS = _impl->GetMeshDS();
  
 -  if ( aSMESHDS_Mesh == NULL )
 +  if ( aMeshDS == NULL )
      return aResult._retn();
  
    long nbNodes = NbNodes();
    aResult->length( nbNodes );
 -  SMDS_NodeIteratorPtr anIt = aSMESHDS_Mesh->nodesIterator(/*idInceasingOrder=*/true);
 +  SMDS_NodeIteratorPtr anIt = aMeshDS->nodesIterator();
    for ( int i = 0, n = nbNodes; i < n && anIt->more(); i++ )
      aResult[i] = anIt->next()->GetID();
  
@@@ -4339,12 -4239,12 +4252,12 @@@ SMESH::double_array* SMESH_Mesh_i::GetN
      _preMeshInfo->FullLoadFromFile();
  
    SMESH::double_array_var aResult = new SMESH::double_array();
 -  SMESHDS_Mesh* aSMESHDS_Mesh = _impl->GetMeshDS();
 -  if ( aSMESHDS_Mesh == NULL )
 +  SMESHDS_Mesh* aMeshDS = _impl->GetMeshDS();
 +  if ( aMeshDS == NULL )
      return aResult._retn();
  
    // find node
 -  const SMDS_MeshNode* aNode = aSMESHDS_Mesh->FindNode(id);
 +  const SMDS_MeshNode* aNode = aMeshDS->FindNode(id);
    if(!aNode)
      return aResult._retn();
  
@@@ -4370,12 -4270,12 +4283,12 @@@ SMESH::long_array* SMESH_Mesh_i::GetNod
      _preMeshInfo->FullLoadFromFile();
  
    SMESH::long_array_var aResult = new SMESH::long_array();
 -  SMESHDS_Mesh* aSMESHDS_Mesh = _impl->GetMeshDS();
 -  if ( aSMESHDS_Mesh == NULL )
 +  SMESHDS_Mesh* aMeshDS = _impl->GetMeshDS();
 +  if ( aMeshDS == NULL )
      return aResult._retn();
  
    // find node
 -  const SMDS_MeshNode* aNode = aSMESHDS_Mesh->FindNode(id);
 +  const SMDS_MeshNode* aNode = aMeshDS->FindNode(id);
    if(!aNode)
      return aResult._retn();
  
@@@ -4417,16 -4317,17 +4330,16 @@@ SMESH::NodePosition* SMESH_Mesh_i::GetN
        case SMDS_TOP_EDGE:
          aNodePosition->shapeType = GEOM::EDGE;
          aNodePosition->params.length(1);
 -        aNodePosition->params[0] =
 -          static_cast<SMDS_EdgePosition*>( pos )->GetUParameter();
 +        aNodePosition->params[0] = SMDS_EdgePositionPtr( pos )->GetUParameter();
          break;
 -      case SMDS_TOP_FACE:
 +      case SMDS_TOP_FACE: {
 +        SMDS_FacePositionPtr fPos = pos;
          aNodePosition->shapeType = GEOM::FACE;
          aNodePosition->params.length(2);
 -        aNodePosition->params[0] =
 -          static_cast<SMDS_FacePosition*>( pos )->GetUParameter();
 -        aNodePosition->params[1] =
 -          static_cast<SMDS_FacePosition*>( pos )->GetVParameter();
 +        aNodePosition->params[0] = fPos->GetUParameter();
 +        aNodePosition->params[1] = fPos->GetVParameter();
          break;
 +      }
        case SMDS_TOP_VERTEX:
          aNodePosition->shapeType = GEOM::VERTEX;
          break;
@@@ -4501,12 -4402,12 +4414,12 @@@ CORBA::Long SMESH_Mesh_i::GetShapeID(co
    if ( _preMeshInfo )
      _preMeshInfo->FullLoadFromFile();
  
 -  SMESHDS_Mesh* aSMESHDS_Mesh = _impl->GetMeshDS();
 -  if ( aSMESHDS_Mesh == NULL )
 +  SMESHDS_Mesh* aMeshDS = _impl->GetMeshDS();
 +  if ( aMeshDS == NULL )
      return -1;
  
    // try to find node
 -  const SMDS_MeshNode* aNode = aSMESHDS_Mesh->FindNode(id);
 +  const SMDS_MeshNode* aNode = aMeshDS->FindNode(id);
    if(aNode) {
      return aNode->getshapeId();
    }
@@@ -4528,12 -4429,12 +4441,12 @@@ CORBA::Long SMESH_Mesh_i::GetShapeIDFor
    if ( _preMeshInfo )
      _preMeshInfo->FullLoadFromFile();
  
 -  SMESHDS_Mesh* aSMESHDS_Mesh = _impl->GetMeshDS();
 -  if ( aSMESHDS_Mesh == NULL )
 +  SMESHDS_Mesh* aMeshDS = _impl->GetMeshDS();
 +  if ( aMeshDS == NULL )
      return -1;
  
    // try to find element
 -  const SMDS_MeshElement* elem = aSMESHDS_Mesh->FindElement(id);
 +  const SMDS_MeshElement* elem = aMeshDS->FindElement(id);
    if(!elem)
      return -1;
  
@@@ -4558,10 -4459,10 +4471,10 @@@ CORBA::Long SMESH_Mesh_i::GetElemNbNode
    if ( _preMeshInfo )
      _preMeshInfo->FullLoadFromFile();
  
 -  SMESHDS_Mesh* aSMESHDS_Mesh = _impl->GetMeshDS();
 -  if ( aSMESHDS_Mesh == NULL ) return -1;
 +  SMESHDS_Mesh* aMeshDS = _impl->GetMeshDS();
 +  if ( aMeshDS == NULL ) return -1;
    // try to find element
 -  const SMDS_MeshElement* elem = aSMESHDS_Mesh->FindElement(id);
 +  const SMDS_MeshElement* elem = aMeshDS->FindElement(id);
    if(!elem) return -1;
    return elem->NbNodes();
  }
@@@ -4580,9 -4481,9 +4493,9 @@@ CORBA::Long SMESH_Mesh_i::GetElemNode(c
    if ( _preMeshInfo )
      _preMeshInfo->FullLoadFromFile();
  
 -  SMESHDS_Mesh* aSMESHDS_Mesh = _impl->GetMeshDS();
 -  if ( aSMESHDS_Mesh == NULL ) return -1;
 -  const SMDS_MeshElement* elem = aSMESHDS_Mesh->FindElement(id);
 +  SMESHDS_Mesh* aMeshDS = _impl->GetMeshDS();
 +  if ( aMeshDS == NULL ) return -1;
 +  const SMDS_MeshElement* elem = aMeshDS->FindElement(id);
    if(!elem) return -1;
    if( index>=elem->NbNodes() || index<0 ) return -1;
    return elem->GetNode(index)->GetID();
@@@ -4600,9 -4501,9 +4513,9 @@@ SMESH::long_array* SMESH_Mesh_i::GetEle
      _preMeshInfo->FullLoadFromFile();
  
    SMESH::long_array_var aResult = new SMESH::long_array();
 -  if ( SMESHDS_Mesh* aSMESHDS_Mesh = _impl->GetMeshDS() )
 +  if ( SMESHDS_Mesh* aMeshDS = _impl->GetMeshDS() )
    {
 -    if ( const SMDS_MeshElement* elem = aSMESHDS_Mesh->FindElement(id) )
 +    if ( const SMDS_MeshElement* elem = aMeshDS->FindElement(id) )
      {
        aResult->length( elem->NbNodes() );
        for ( int i = 0; i < elem->NbNodes(); ++i )
@@@ -4624,13 -4525,13 +4537,13 @@@ CORBA::Boolean SMESH_Mesh_i::IsMediumNo
    if ( _preMeshInfo )
      _preMeshInfo->FullLoadFromFile();
  
 -  SMESHDS_Mesh* aSMESHDS_Mesh = _impl->GetMeshDS();
 -  if ( aSMESHDS_Mesh == NULL ) return false;
 +  SMESHDS_Mesh* aMeshDS = _impl->GetMeshDS();
 +  if ( aMeshDS == NULL ) return false;
    // try to find node
 -  const SMDS_MeshNode* aNode = aSMESHDS_Mesh->FindNode(idn);
 +  const SMDS_MeshNode* aNode = aMeshDS->FindNode(idn);
    if(!aNode) return false;
    // try to find element
 -  const SMDS_MeshElement* elem = aSMESHDS_Mesh->FindElement(ide);
 +  const SMDS_MeshElement* elem = aMeshDS->FindElement(ide);
    if(!elem) return false;
  
    return elem->IsMediumNode(aNode);
@@@ -4650,11 -4551,11 +4563,11 @@@ CORBA::Boolean SMESH_Mesh_i::IsMediumNo
    if ( _preMeshInfo )
      _preMeshInfo->FullLoadFromFile();
  
 -  SMESHDS_Mesh* aSMESHDS_Mesh = _impl->GetMeshDS();
 -  if ( aSMESHDS_Mesh == NULL ) return false;
 +  SMESHDS_Mesh* aMeshDS = _impl->GetMeshDS();
 +  if ( aMeshDS == NULL ) return false;
  
    // try to find node
 -  const SMDS_MeshNode* aNode = aSMESHDS_Mesh->FindNode(idn);
 +  const SMDS_MeshNode* aNode = aMeshDS->FindNode(idn);
    if(!aNode) return false;
  
    SMESH_MesherHelper aHelper( *(_impl) );
@@@ -4680,9 -4581,9 +4593,9 @@@ CORBA::Long SMESH_Mesh_i::ElemNbEdges(c
    if ( _preMeshInfo )
      _preMeshInfo->FullLoadFromFile();
  
 -  SMESHDS_Mesh* aSMESHDS_Mesh = _impl->GetMeshDS();
 -  if ( aSMESHDS_Mesh == NULL ) return -1;
 -  const SMDS_MeshElement* elem = aSMESHDS_Mesh->FindElement(id);
 +  SMESHDS_Mesh* aMeshDS = _impl->GetMeshDS();
 +  if ( aMeshDS == NULL ) return -1;
 +  const SMDS_MeshElement* elem = aMeshDS->FindElement(id);
    if(!elem) return -1;
    return elem->NbEdges();
  }
@@@ -4699,9 -4600,9 +4612,9 @@@ CORBA::Long SMESH_Mesh_i::ElemNbFaces(c
    if ( _preMeshInfo )
      _preMeshInfo->FullLoadFromFile();
  
 -  SMESHDS_Mesh* aSMESHDS_Mesh = _impl->GetMeshDS();
 -  if ( aSMESHDS_Mesh == NULL ) return -1;
 -  const SMDS_MeshElement* elem = aSMESHDS_Mesh->FindElement(id);
 +  SMESHDS_Mesh* aMeshDS = _impl->GetMeshDS();
 +  if ( aMeshDS == NULL ) return -1;
 +  const SMDS_MeshElement* elem = aMeshDS->FindElement(id);
    if(!elem) return -1;
    return elem->NbFaces();
  }
@@@ -4718,9 -4619,9 +4631,9 @@@ SMESH::long_array* SMESH_Mesh_i::GetEle
      _preMeshInfo->FullLoadFromFile();
  
    SMESH::long_array_var aResult = new SMESH::long_array();
 -  if ( SMESHDS_Mesh* aSMESHDS_Mesh = _impl->GetMeshDS() )
 +  if ( SMESHDS_Mesh* aMeshDS = _impl->GetMeshDS() )
    {
 -    if ( const SMDS_MeshElement* elem = aSMESHDS_Mesh->FindElement(elemId) )
 +    if ( const SMDS_MeshElement* elem = aMeshDS->FindElement(elemId) )
      {
        SMDS_VolumeTool vtool( elem );
        if ( faceIndex < vtool.NbFaces() )
@@@ -4831,9 -4732,9 +4744,9 @@@ CORBA::Boolean SMESH_Mesh_i::IsPoly(con
    if ( _preMeshInfo )
      _preMeshInfo->FullLoadFromFile();
  
 -  SMESHDS_Mesh* aSMESHDS_Mesh = _impl->GetMeshDS();
 -  if ( aSMESHDS_Mesh == NULL ) return false;
 -  const SMDS_MeshElement* elem = aSMESHDS_Mesh->FindElement(id);
 +  SMESHDS_Mesh* aMeshDS = _impl->GetMeshDS();
 +  if ( aMeshDS == NULL ) return false;
 +  const SMDS_MeshElement* elem = aMeshDS->FindElement(id);
    if(!elem) return false;
    return elem->IsPoly();
  }
@@@ -4850,9 -4751,9 +4763,9 @@@ CORBA::Boolean SMESH_Mesh_i::IsQuadrati
    if ( _preMeshInfo )
      _preMeshInfo->FullLoadFromFile();
  
 -  SMESHDS_Mesh* aSMESHDS_Mesh = _impl->GetMeshDS();
 -  if ( aSMESHDS_Mesh == NULL ) return false;
 -  const SMDS_MeshElement* elem = aSMESHDS_Mesh->FindElement(id);
 +  SMESHDS_Mesh* aMeshDS = _impl->GetMeshDS();
 +  if ( aMeshDS == NULL ) return false;
 +  const SMDS_MeshElement* elem = aMeshDS->FindElement(id);
    if(!elem) return false;
    return elem->IsQuadratic();
  }
@@@ -4869,7 -4770,7 +4782,7 @@@ CORBA::Double SMESH_Mesh_i::GetBallDiam
      _preMeshInfo->FullLoadFromFile();
  
    if ( const SMDS_BallElement* ball =
 -       dynamic_cast<const SMDS_BallElement*>( _impl->GetMeshDS()->FindElement( id )))
 +       SMDS_Mesh::DownCast<SMDS_BallElement>( _impl->GetMeshDS()->FindElement( id )))
      return ball->GetDiameter();
  
    return 0;
@@@ -4887,11 -4788,11 +4800,11 @@@ SMESH::double_array* SMESH_Mesh_i::Bary
      _preMeshInfo->FullLoadFromFile();
  
    SMESH::double_array_var aResult = new SMESH::double_array();
 -  SMESHDS_Mesh* aSMESHDS_Mesh = _impl->GetMeshDS();
 -  if ( aSMESHDS_Mesh == NULL )
 +  SMESHDS_Mesh* aMeshDS = _impl->GetMeshDS();
 +  if ( aMeshDS == NULL )
      return aResult._retn();
  
 -  const SMDS_MeshElement* elem = aSMESHDS_Mesh->FindElement(id);
 +  const SMDS_MeshElement* elem = aMeshDS->FindElement(id);
    if(!elem)
      return aResult._retn();
  
@@@ -4951,14 -4852,12 +4864,14 @@@ SMESH_Mesh_i::MakeGroupsOfBadInputEleme
    {
      // compute error
      SMESH_ComputeErrorPtr error = sm->GetComputeError();
 -    if ( error && !error->myBadElements.empty())
 +    if ( error && error->HasBadElems() )
      {
        // sort bad elements by type
        vector< const SMDS_MeshElement* > elemsByType[ SMDSAbs_NbElementTypes ];
 -      list<const SMDS_MeshElement*>::iterator elemIt  = error->myBadElements.begin();
 -      list<const SMDS_MeshElement*>::iterator elemEnd = error->myBadElements.end();
 +      const list<const SMDS_MeshElement*>& badElems =
 +        static_cast<SMESH_BadInputElements*>( error.get() )->myBadElements;
 +      list<const SMDS_MeshElement*>::const_iterator elemIt  = badElems.begin();
 +      list<const SMDS_MeshElement*>::const_iterator elemEnd = badElems.end();
        for ( ; elemIt != elemEnd; ++elemIt )
        {
          const SMDS_MeshElement* elem = *elemIt;
          groups[ ++iG ] = createGroup( SMESH::ElementType(i), theGroupName );
          if ( _gen_i->CanPublishInStudy( groups[ iG ] ))
          {
-           SALOMEDS::Study_var  study = _gen_i->GetCurrentStudy();
            SMESH::SMESH_Mesh_var mesh = _this();
            SALOMEDS::SObject_wrap aSO =
-             _gen_i->PublishGroup( study, mesh, groups[ iG ],
+             _gen_i->PublishGroup( mesh, groups[ iG ],
                                   GEOM::GEOM_Object::_nil(), theGroupName);
          }
          SMESH_GroupBase_i* grp_i = SMESH::DownCast< SMESH_GroupBase_i* >( groups[ iG ]);
  
  void SMESH_Mesh_i::CreateGroupServants()
  {
-   SALOMEDS::Study_var  aStudy = _gen_i->GetCurrentStudy();
    SMESH::SMESH_Mesh_var aMesh = _this();
  
    set<int> addedIDs;
      else        { nextId = 0; } // avoid "unused variable" warning in release mode
  
      // publishing the groups in the study
-     if ( !aStudy->_is_nil() ) {
-       GEOM::GEOM_Object_var shapeVar = _gen_i->ShapeToGeomObject( shape );
-       _gen_i->PublishGroup( aStudy, aMesh, groupVar, shapeVar, group->GetName());
-     }
+     GEOM::GEOM_Object_var shapeVar = _gen_i->ShapeToGeomObject( shape );
+     _gen_i->PublishGroup( aMesh, groupVar, shapeVar, group->GetName());
    }
    if ( !addedIDs.empty() )
    {
@@@ -5133,10 -5028,6 +5042,6 @@@ void SMESH_Mesh_i::checkGroupNames(
    int nbGrp = NbGroups();
    if ( !nbGrp )
      return;
-   SALOMEDS::Study_var aStudy = _gen_i->GetCurrentStudy();
-   if ( aStudy->_is_nil() )
-     return; // nothing to do
    
    SMESH::ListOfGroups* grpList = 0;
    // avoid dump of "GetGroups"
      SMESH::SMESH_GroupBase_ptr aGrp = (*grpList)[ gIndx ];
      if ( !aGrp )
        continue;
-     SALOMEDS::SObject_wrap aGrpSO = _gen_i->ObjectToSObject( aStudy, aGrp );
+     SALOMEDS::SObject_wrap aGrpSO = _gen_i->ObjectToSObject( aGrp );
      if ( aGrpSO->_is_nil() )
        continue;
      // correct name of the mesh group if necessary
@@@ -5193,15 -5084,12 +5098,12 @@@ SMESH::string_array* SMESH_Mesh_i::GetL
    SMESH_Gen_i *gen = SMESH_Gen_i::GetSMESHGen();
    if(gen) {
      CORBA::String_var aParameters = GetParameters();
-     SALOMEDS::Study_var    aStudy = gen->GetCurrentStudy();
-     if ( !aStudy->_is_nil()) {
-       SALOMEDS::ListOfListOfStrings_var aSections = aStudy->ParseVariables(aParameters); 
-       if ( aSections->length() > 0 ) {
-         SALOMEDS::ListOfStrings aVars = aSections[ aSections->length() - 1 ];
-         aResult->length( aVars.length() );
-         for ( CORBA::ULong i = 0;i < aVars.length(); i++ )
-           aResult[i] = CORBA::string_dup( aVars[i] );
-       }
+     SALOMEDS::ListOfListOfStrings_var aSections = SMESH_Gen_i::getStudyServant()->ParseVariables(aParameters);
+     if ( aSections->length() > 0 ) {
+       SALOMEDS::ListOfStrings aVars = aSections[ aSections->length() - 1 ];
+       aResult->length( aVars.length() );
+       for ( CORBA::ULong i = 0;i < aVars.length(); i++ )
+         aResult[i] = CORBA::string_dup( aVars[i] );
      }
    }
    return aResult._retn();
@@@ -5327,7 -5215,7 +5229,7 @@@ SALOMEDS::TMPFile* SMESH_Mesh_i::GetVtk
  {
    SALOMEDS::TMPFile_var SeqFile;
    if ( SMESHDS_Mesh* aMeshDS = _impl->GetMeshDS() ) {
 -    SMDS_UnstructuredGrid* aGrid = aMeshDS->getGrid();
 +    SMDS_UnstructuredGrid* aGrid = aMeshDS->GetGrid();
      if(aGrid) {
        vtkUnstructuredGridWriter* aWriter = vtkUnstructuredGridWriter::New();
        aWriter->WriteToOutputStringOn();
@@@ -5464,7 -5352,7 +5366,7 @@@ namespace /* Iterators used in SMESH_Me
      {
        const SMDS_MeshElement* res = _node;
        _node = 0;
 -      while (( _elemIter->more() || _nodeIter->more() ) && !_node )
 +      while ( !_node && ( _elemIter->more() || _nodeIter->more() ))
        {
          if ( _nodeIter->more() )
          {
@@@ -6126,24 -6014,6 +6028,24 @@@ void SMESH_Mesh_i::convertMeshOrder (co
    }
  }
  
 +namespace // utils used by SMESH_MeshPartDS
 +{
 +  /*!
 +   * \brief Class used to access to protected data of SMDS_MeshInfo
 +   */
 +  struct TMeshInfo : public SMDS_MeshInfo
 +  {
 +    void Add(const SMDS_MeshElement* e) { SMDS_MeshInfo::addWithPoly( e ); }
 +  };
 +  /*!
 +   * \brief Element holing its ID only
 +   */
 +  struct TElemID : public SMDS_LinearEdge
 +  {
 +    TElemID(int ID) : SMDS_LinearEdge(0,0) { setID( ID ); }
 +  };
 +}
 +
  //================================================================================
  //
  // Implementation of SMESH_MeshPartDS
@@@ -6250,7 -6120,7 +6152,7 @@@ SMDS_ElemIteratorPtr SMESH_MeshPartDS::
      SMDS_MeshElement::GeomFilter
      > TIter;
  
 -  SMDSAbs_ElementType type = SMDS_MeshCell::toSmdsType( geomType );
 +  SMDSAbs_ElementType type = SMDS_MeshCell::ElemType( geomType );
  
    return SMDS_ElemIteratorPtr( new TIter( _elements[type].begin(),
                                            _elements[type].end(),
@@@ -6268,7 -6138,7 +6170,7 @@@ SMDS_ElemIteratorPtr SMESH_MeshPartDS::
      SMDS_MeshElement::EntityFilter
      > TIter;
  
 -  SMDSAbs_ElementType type = SMDS_MeshCell::toSmdsType( entity );
 +  SMDSAbs_ElementType type = SMDS_MeshCell::ElemType( entity );
  
    return SMDS_ElemIteratorPtr( new TIter( _elements[type].begin(),
                                            _elements[type].end(),
@@@ -6295,10 -6165,10 +6197,10 @@@ SMDS_ElemIteratorPtr SMESH_MeshPartDS::
  }
  // -------------------------------------------------------------------------------------
  #define _GET_ITER_DEFINE( iterType, methName, elem, elemType)                       \
 -  iterType SMESH_MeshPartDS::methName( bool idInceasingOrder) const                 \
 +  iterType SMESH_MeshPartDS::methName() const                 \
    {                                                                                 \
      typedef SMDS_SetIterator<const elem*, TIDSortedElemSet::const_iterator > TIter; \
 -    return _meshDS ? _meshDS->methName(idInceasingOrder) : iterType                 \
 +    return _meshDS ? _meshDS->methName() : iterType                 \
        ( new TIter( _elements[elemType].begin(), _elements[elemType].end() ));       \
    }
  // -------------------------------------------------------------------------------------
index 38c13009cc5bfc1dffbce082c3a746fedc897753,7db67ae582d658b8b00bc540f60bd3625cedcf09..886f4a6d1cfa34de335b7b94ead6c435fc20d77b
@@@ -63,8 -63,8 +63,8 @@@ namespac
  {
    enum {  GroupOnFilter_OutOfDate = -1 };
  
-   // a map to count not yet loaded meshes 
-   static std::map< int, int > theStudyIDToMeshCounter;
+   // count not yet loaded meshes
+   static int theMeshCounter = 0;
  
    //================================================================================
    /*!
@@@ -74,9 -74,7 +74,7 @@@
  
    void meshInfoLoaded( SMESH_Mesh_i* mesh )
    {
-     std::map< int, int >::iterator id2counter =
-       theStudyIDToMeshCounter.insert( std::make_pair( (int) mesh->GetStudyId(), 0 )).first;
-     id2counter->second++;
+     theMeshCounter++;
    }
    //================================================================================
    /*!
                           std::string   medFile,
                           std::string   hdfFile)
    {
-     if ( --theStudyIDToMeshCounter[ (int) mesh->GetStudyId() ] == 0 )
+     if ( --theMeshCounter == 0 )
      {
        std::string tmpDir = SALOMEDS_Tool::GetDirFromPath( hdfFile );
  
-       SALOMEDS::ListOfFileNames_var aFiles = new SALOMEDS::ListOfFileNames;
-       aFiles->length(2);
+       SALOMEDS_Tool::ListOfFiles aFiles;
+       aFiles.reserve(2);
        medFile = SALOMEDS_Tool::GetNameFromPath( medFile ) + ".med";
        hdfFile = SALOMEDS_Tool::GetNameFromPath( hdfFile ) + ".hdf";
-       aFiles[0] = medFile.c_str();
-       aFiles[1] = hdfFile.c_str();
+       aFiles.push_back(medFile.c_str());
+       aFiles.push_back(hdfFile.c_str());
  
-       SALOMEDS_Tool::RemoveTemporaryFiles( tmpDir.c_str(), aFiles.in(), true );
+       SALOMEDS_Tool::RemoveTemporaryFiles( tmpDir.c_str(), aFiles, true );
      }
    }
  
      SignalToGUI( SMESH_Mesh_i* mesh )
      {
        SMESH_Gen_i* gen = SMESH_Gen_i::GetSMESHGen();
-       SALOMEDS::Study_var study = gen->GetCurrentStudy();
-       if ( !study->_is_nil() && study->StudyId() == mesh->GetStudyId() )
+       SALOMEDS::SObject_wrap meshSO = gen->ObjectToSObject( mesh->_this() );
+       CORBA::Object_var        obj = gen->GetNS()->Resolve( "/Kernel/Session" );
+       _session = SALOME::Session::_narrow( obj );
+       if ( !meshSO->_is_nil() && !_session->_is_nil() )
        {
-         SALOMEDS::SObject_wrap meshSO = gen->ObjectToSObject(study, mesh->_this() );
-         CORBA::Object_var        obj = gen->GetNS()->Resolve( "/Kernel/Session" );
-         _session = SALOME::Session::_narrow( obj );
-         if ( !meshSO->_is_nil() && !_session->_is_nil() )
-         {
-           CORBA::String_var meshEntry = meshSO->GetID();
-           _messagePrefix = "SMESH/mesh_loading/";
-           _messagePrefix += meshEntry.in();
+         CORBA::String_var meshEntry = meshSO->GetID();
+         _messagePrefix = "SMESH/mesh_loading/";
+         _messagePrefix += meshEntry.in();
  
-           std::string msgToGUI = _messagePrefix + "/";
-           msgToGUI += SMESH_Comment( mesh->NbNodes() );
-           msgToGUI += "/";
-           msgToGUI += SMESH_Comment( mesh->NbElements() );
+         std::string msgToGUI = _messagePrefix + "/";
+         msgToGUI += SMESH_Comment( mesh->NbNodes() );
+         msgToGUI += "/";
+         msgToGUI += SMESH_Comment( mesh->NbElements() );
  
-           _session->emitMessageOneWay( msgToGUI.c_str());
-         }
+         _session->emitMessageOneWay( msgToGUI.c_str());
        }
      }
      void sendStop()
@@@ -479,10 -474,7 +474,7 @@@ bool SMESH_PreMeshInfo::readMeshInfo(
  {
    _isInfoOk = true;
  
-   MED::PWrapper aMed = MED::CrWrapper(_medFileName,true);
-   // if ( aMed->GetVersion() != MED::eV2_2 )
-   //   return false;
+   MED::PWrapper aMed = MED::CrWrapperR(_medFileName);
    MED::PMeshInfo medMeshInfo = aMed->CrMeshInfo(3,3,SMESH_Comment( _meshID ));
  
    // read nb nodes
@@@ -535,7 -527,7 +527,7 @@@ void SMESH_PreMeshInfo::readGroupInfo(
  
    map< int, vector< SMESH_PreMeshInfo* > > famId2grInfo;
  
-   MED::PWrapper aMed = MED::CrWrapper(_medFileName,false);
+   MED::PWrapper aMed = MED::CrWrapperR(_medFileName);
    MED::PMeshInfo medMeshInfo = aMed->CrMeshInfo(3,3,SMESH_Comment( _meshID ));
  
    // read families to fill in famId2grInfo
@@@ -958,7 -950,7 +950,7 @@@ void SMESH_PreMeshInfo::readSubMeshes(D
              if ( isNode ) {
                SMDS_PositionPtr pos = aPositionCreator.MakePosition( smType[ smID ]);
                SMDS_MeshNode* node = const_cast<SMDS_MeshNode*>( static_cast<const SMDS_MeshNode*>( elem ));
 -              node->SetPosition( pos );
 +              node->SetPosition( pos, sm->GetID() );
                sm->AddNode( node );
              } else {
                sm->AddElement( elem );
              // -- Most probably a bad study was saved when there were
              // not fixed bugs in SMDS_MeshInfo
              if ( aPos->GetTypeOfPosition() == SMDS_TOP_FACE ) {
 -              SMDS_FacePosition* fPos = const_cast<SMDS_FacePosition*>
 -                ( static_cast<const SMDS_FacePosition*>( aPos ));
 +              SMDS_FacePositionPtr fPos = aPos;
                fPos->SetUParameter( aUPos[ iNode ]);
                fPos->SetVParameter( aVPos[ iNode ]);
              }
            else {
              // ASSERT( aPos->GetTypeOfPosition() == SMDS_TOP_EDGE );-- issue 20182
              if ( aPos->GetTypeOfPosition() == SMDS_TOP_EDGE ) {
 -              SMDS_EdgePosition* fPos = const_cast<SMDS_EdgePosition*>
 -                ( static_cast<const SMDS_EdgePosition*>( aPos ));
 -              fPos->SetUParameter( aUPos[ iNode ]);
 +              SMDS_EdgePositionPtr ePos = aPos;
 +              ePos->SetUParameter( aUPos[ iNode ]);
              }
            }
          }
@@@ -1237,10 -1231,9 +1229,9 @@@ bool SMESH_PreMeshInfo::IsMeshInfoCorre
  
  void SMESH_PreMeshInfo::RemoveStudyFiles_TMP_METHOD(SALOMEDS::SComponent_ptr smeshComp)
  {
-   SALOMEDS::Study_var study = smeshComp->GetStudy();
-   if ( theStudyIDToMeshCounter[ (int) study->StudyId() ] > 0 )
+   if ( theMeshCounter > 0 )
    {
-     SALOMEDS::ChildIterator_wrap itBig = study->NewChildIterator( smeshComp );
+     SALOMEDS::ChildIterator_wrap itBig = SMESH_Gen_i::getStudyServant()->NewChildIterator( smeshComp );
      for ( ; itBig->More(); itBig->Next() ) {
        SALOMEDS::SObject_wrap gotBranch = itBig->Value();
        CORBA::Object_var       anObject = SMESH_Gen_i::SObjectToObject( gotBranch );
index b5977f56bedbfa736b8af839595d219dde4861d0,4c488220be2211f2711c0d51989684b6c7aa13d2..793e4a4a18071b4fcc431fcdf015280df15908ef
@@@ -69,7 -69,6 +69,6 @@@ public
                  Resource_DataMapOfAsciiStringAsciiString& theEntry2AccessorMethod,
                  Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
                  std::set< TCollection_AsciiString >&      theRemovedObjIDs,
-                 SALOMEDS::Study_ptr&                      theStudy,
                  const bool                                theHistoricalDump);
  
    /*!
@@@ -90,7 -89,7 +89,7 @@@ namespace SMES
  
    // ===========================================================================================
    /*!
 -   * \brief Object used to make TPythonDump know that its held value can be a varible
 +   * \brief Object used to make TPythonDump know that its held value can be a variable
     *
     * TPythonDump substitute TVar with names of notebook variables if any.
     */
      TPythonDump&
      operator<<(SMESH_MeshEditor_i* theArg);
  
-     TPythonDump&
-     operator<<(SMESH::MED_VERSION theArg);
      TPythonDump&
      operator<<(const SMESH::AxisStruct & theAxis);
  
index 180ba86be86b4ba9f09a50cbd21c213529235be5,1d3d393d7aed30ef3c3affa262bcb665bcc6854d..48356cac7ee00d4773c136cd5cf1ba085b0a08e3
@@@ -17,9 -17,9 +17,9 @@@
  # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  #
  
 -##
 -# @package StdMeshersBuilder
 -# Python API for the standard meshing plug-in module.
 +"""
 +Python API for the standard meshing plug-in module.
 +"""
  
  LIBRARY = "libStdMeshersEngine.so"
  
@@@ -30,50 -30,24 +30,50 @@@ import StdMesher
  # Mesh algo type identifiers
  #----------------------------
  
 -## Algorithm type: Regular 1D algorithm, see StdMeshersBuilder_Segment
  REGULAR     = "Regular_1D"
 -## Algorithm type: Python 1D algorithm, see StdMeshersBuilder_Segment_Python
 +"""
 +Algorithm type: Regular 1D algorithm, see :class:`~StdMeshersBuilder.StdMeshersBuilder_Segment`
 +"""
 +
  PYTHON      = "Python_1D"
 -## Algorithm type: Composite segment 1D algorithm, see StdMeshersBuilder_CompositeSegment
 +"""
 +Algorithm type: Python 1D algorithm, see :class:`~StdMeshersBuilder.StdMeshersBuilder_Segment_Python`
 +"""
 +
  COMPOSITE   = "CompositeSegment_1D"
 -## Algorithm type: Triangle MEFISTO 2D algorithm, see StdMeshersBuilder_Triangle_MEFISTO
 +"""
 +
 +Algorithm type: Composite segment 1D algorithm, see :class:`~StdMeshersBuilder.StdMeshersBuilder_CompositeSegment`
 +"""
  MEFISTO     = "MEFISTO_2D"
 -## Algorithm type: Hexahedron 3D (i-j-k) algorithm, see StdMeshersBuilder_Hexahedron
 +"""
 +Algorithm type: Triangle MEFISTO 2D algorithm, see :class:`~StdMeshersBuilder.StdMeshersBuilder_Triangle_MEFISTO`
 +"""
 +
  Hexa        = "Hexa_3D"
 -## Algorithm type: Quadrangle 2D algorithm, see StdMeshersBuilder_Quadrangle
 +"""
 +Algorithm type: Hexahedron 3D (i-j-k) algorithm, see :class:`~StdMeshersBuilder.StdMeshersBuilder_Hexahedron`
 +"""
 +
  QUADRANGLE  = "Quadrangle_2D"
 -## Algorithm type: Radial Quadrangle 1D-2D algorithm, see StdMeshersBuilder_RadialQuadrangle1D2D
 +"""
 +Algorithm type: Quadrangle 2D algorithm, see :class:`~StdMeshersBuilder.StdMeshersBuilder_Quadrangle`
 +"""
 +
  RADIAL_QUAD = "RadialQuadrangle_1D2D"
 -## Algorithm type: Quadrangle (Medial Axis Projection) 1D-2D algorithm, see StdMeshersBuilder_QuadMA_1D2D
 +"""
 +Algorithm type: Radial Quadrangle 1D-2D algorithm, see :class:`~StdMeshersBuilder.StdMeshersBuilder_RadialQuadrangle1D2D`
 +"""
 +
  QUAD_MA_PROJ = "QuadFromMedialAxis_1D2D"
 -## Algorithm type: Polygon Per Face 2D algorithm, see StdMeshersBuilder_PolygonPerFace
 +"""
 +Algorithm type: Quadrangle (Medial Axis Projection) 1D-2D algorithm, see :class:`~StdMeshersBuilder.StdMeshersBuilder_QuadMA_1D2D`
 +"""
 +
  POLYGON     = "PolygonPerFace_2D"
 +"""
 +Algorithm type: Polygon Per Face 2D algorithm, see :class:`~StdMeshersBuilder.StdMeshersBuilder_PolygonPerFace`
 +"""
  
  # import items of enums
  for e in StdMeshers.QuadType._items: exec('%s = StdMeshers.%s'%(e,e))
@@@ -83,69 -57,52 +83,69 @@@ for e in StdMeshers.VLExtrusionMethod._
  # Algorithms
  #----------------------
  
 -## Defines segment 1D algorithm for edges discretization.
 -#
 -#  It can be created by calling smeshBuilder.Mesh.Segment(geom=0)
 -#
 -#  @ingroup l3_algos_basic
  class StdMeshersBuilder_Segment(Mesh_Algorithm):
 -
 -    ## name of the dynamic method in smeshBuilder.Mesh class
 -    #  @internal
 +    """
 +    Defines segment 1D algorithm for edges discretization.
 +    
 +    It can be created by calling smeshBuilder.Mesh.Segment(geom=0)
 +    """
 +    
 +    
      meshMethod = "Segment"
 -    ## type of algorithm used with helper function in smeshBuilder.Mesh class
 -    #  @internal
 +    """
 +    name of the dynamic method in smeshBuilder.Mesh class
 +    """
 +
      algoType   = REGULAR
 -    ## flag pointing whether this algorithm should be used by default in dynamic method
 -    #  of smeshBuilder.Mesh class
 -    #  @internal
 +    """
 +    type of algorithm used with helper function in smeshBuilder.Mesh class
 +    """
 +
      isDefault  = True
 -    ## doc string of the method
 -    #  @internal
 +    """
 +    flag pointing whether this algorithm should be used by default in dynamic method
 +    of smeshBuilder.Mesh class    
 +    """
 +
      docHelper  = "Creates segment 1D algorithm for edges"
 +    """
 +    doc string of the method
 +    """
  
 -    ## Private constructor.
 -    #  @param mesh parent mesh object algorithm is assigned to
 -    #  @param geom geometry (shape/sub-shape) algorithm is assigned to;
 -    #              if it is @c 0 (default), the algorithm is assigned to the main shape
      def __init__(self, mesh, geom=0):
 +        """
 +        Private constructor.
 +        Parameters:
 +            mesh: parent mesh object algorithm is assigned to
 +            geom: geometry (shape/sub-shape) algorithm is assigned to;
 +                if it is :code:`0` (default), the algorithm is assigned to the main shape
 +        """
          Mesh_Algorithm.__init__(self)
          self.Create(mesh, geom, self.algoType)
          pass
  
 -    ## Defines "LocalLength" hypothesis to cut an edge in several segments with the same length
 -    #  @param l for the length of segments that cut an edge
 -    #  @param UseExisting if ==true - searches for an  existing hypothesis created with
 -    #                    the same parameters, else (default) - creates a new one
 -    #  @param p precision, used for calculation of the number of segments.
 -    #           The precision should be a positive, meaningful value within the range [0,1].
 -    #           In general, the number of segments is calculated with the formula:
 -    #           nb = ceil((edge_length / l) - p)
 -    #           Function ceil rounds its argument to the higher integer.
 -    #           So, p=0 means rounding of (edge_length / l) to the higher integer,
 -    #               p=0.5 means rounding of (edge_length / l) to the nearest integer,
 -    #               p=1 means rounding of (edge_length / l) to the lower integer.
 -    #           Default value is 1e-07.
 -    #  @return an instance of StdMeshers_LocalLength hypothesis
 -    #  @ingroup l3_hypos_1dhyps
      def LocalLength(self, l, UseExisting=0, p=1e-07):
 +        """
 +        Defines "LocalLength" hypothesis to cut an edge in several segments with the same length
 +        
 +        Parameters:
 +            l : for the length of segments that cut an edge
 +            UseExisting : if == true - searches for an  existing hypothesis created with
 +                the same parameters, else (default) - creates a new one
 +            p : precision, used for calculation of the number of segments.
 +                The precision should be a positive, meaningful value within the range [0,1].
 +                In general, the number of segments is calculated with the formula:
 +                nb = ceil((edge_length / l) - p)
 +                Function ceil rounds its argument to the higher integer.
 +                So, p=0 means rounding of (edge_length / l) to the higher integer,
 +                p=0.5 means rounding of (edge_length / l) to the nearest integer,
 +                p=1 means rounding of (edge_length / l) to the lower integer.
 +                Default value is 1e-07.
 +                
 +        Returns: 
 +            an instance of StdMeshers_LocalLength hypothesis
 +        """
 +
          from salome.smesh.smeshBuilder import IsEqual
          comFun=lambda hyp, args: IsEqual(hyp.GetLength(), args[0]) and IsEqual(hyp.GetPrecision(), args[1])
          hyp = self.Hypothesis("LocalLength", [l,p], UseExisting=UseExisting, CompareMethod=comFun)
          hyp.SetPrecision(p)
          return hyp
  
 -    ## Defines "MaxSize" hypothesis to cut an edge into segments not longer than given value
 -    #  @param length is optional maximal allowed length of segment, if it is omitted
 -    #                the preestimated length is used that depends on geometry size
 -    #  @param UseExisting if ==true - searches for an existing hypothesis created with
 -    #                     the same parameters, else (default) - creates a new one
 -    #  @return an instance of StdMeshers_MaxLength hypothesis
 -    #  @ingroup l3_hypos_1dhyps
      def MaxSize(self, length=0.0, UseExisting=0):
 +        """
 +        Defines "MaxSize" hypothesis to cut an edge into segments not longer than given value
 +
 +        Parameters:
 +            length : is optional maximal allowed length of segment, if it is omitted
 +                the preestimated length is used that depends on geometry size
 +            UseExisting : if ==true - searches for an existing hypothesis created with
 +                the same parameters, else (default) - creates a new one
 +        
 +        Returns:
 +            an instance of StdMeshers_MaxLength hypothesis
 +        """
 +    
 +
          hyp = self.Hypothesis("MaxLength", [length], UseExisting=UseExisting)
          if length > 0.0:
              # set given length
          hyp.SetUsePreestimatedLength( length == 0.0 )
          return hyp
  
 -    ## Defines "NumberOfSegments" hypothesis to cut an edge in a fixed number of segments
 -    #  @param n for the number of segments that cut an edge
 -    #  @param s for the scale factor (optional)
 -    #  @param reversedEdges is a list of edges to mesh using reversed orientation.
 -    #                       A list item can also be a tuple (edge, 1st_vertex_of_edge)
 -    #  @param UseExisting if ==true - searches for an existing hypothesis created with
 -    #                     the same parameters, else (default) - create a new one
 -    #  @return an instance of StdMeshers_NumberOfSegments hypothesis
 -    #  @ingroup l3_hypos_1dhyps
      def NumberOfSegments(self, n, s=[], reversedEdges=[], UseExisting=0):
-       Defines "NumberOfSegments" hypothesis to cut an edge in a fixed number of segments
 +        """
-                   A list item can also be a tuple (edge, 1st_vertex_of_edge)
++        Defines "NumberOfSegments" hypothesis to cut an edge in a fixed number of segments
 +
 +        Parameters:
 +            n: for the number of segments that cut an edge
 +            s: for the scale factor (optional)
 +            reversedEdges: is a list of edges to mesh using reversed orientation.
-                   the same parameters, else (default) - create a new one
++                    A list item can also be a tuple (edge, 1st_vertex_of_edge)
 +            UseExisting: if ==true - searches for an existing hypothesis created with
-           an instance of StdMeshers_NumberOfSegments hypothesis
++                    the same parameters, else (default) - create a new one
 +    
 +        Returns: 
-       
++            an instance of StdMeshers_NumberOfSegments hypothesis
 +        """
 +    
++        
          if not isinstance(reversedEdges,list): #old version script, before adding reversedEdges
              reversedEdges, UseExisting = [], reversedEdges
          entry = self.MainShapeEntry()
          hyp.SetObjectEntry( entry )
          return hyp
  
 -    ## Private method
 -    #  
 -    #  Checks if the given "NumberOfSegments" hypothesis has the same parameters as the given arguments
      def _compareNumberOfSegments(self, hyp, args):
-       Private method
-       Checks if the given "NumberOfSegments" hypothesis has the same parameters as the given arguments
 +        """
++        Private method
++        Checks if the given "NumberOfSegments" hypothesis has the same parameters as the given arguments
 +        """
          if hyp.GetNumberOfSegments() == args[0]:
              if len(args) == 3:
                  if hyp.GetReversedEdges() == args[1]:
                                  return True
          return False
  
 -    ## Defines "Adaptive" hypothesis to cut an edge into segments keeping segment size
 -    #  within the given range and considering (1) deflection of segments from the edge
 -    #  and (2) distance from segments to closest edges and faces to have segment length
 -    #  not longer than two times shortest distances to edges and faces.
 -    #  @param minSize defines the minimal allowed segment length
 -    #  @param maxSize defines the maximal allowed segment length
 -    #  @param deflection defines the maximal allowed distance from a segment to an edge
 -    #  @param UseExisting if ==true - searches for an existing hypothesis created with
 -    #                     the same parameters, else (default) - creates a new one
 -    #  @return an instance of StdMeshers_Adaptive1D hypothesis
 -    #  @ingroup l3_hypos_1dhyps
      def Adaptive(self, minSize, maxSize, deflection, UseExisting=False):
-       
 +        """
 +        Defines "Adaptive" hypothesis to cut an edge into segments keeping segment size
 +        within the given range and considering (1) deflection of segments from the edge
 +        and (2) distance from segments to closest edges and faces to have segment length
 +        not longer than two times shortest distances to edges and faces.
 +
 +        Parameters:
 +            minSize: defines the minimal allowed segment length
 +            maxSize: defines the maximal allowed segment length
 +            deflection: defines the maximal allowed distance from a segment to an edge
 +            UseExisting: if ==true - searches for an existing hypothesis created with
 +                the same parameters, else (default) - creates a new one
 +
 +        Returns:
 +            an instance of StdMeshers_Adaptive1D hypothesis
 +        """
++        
          from salome.smesh.smeshBuilder import IsEqual
          compFun = lambda hyp, args: ( IsEqual(hyp.GetMinSize(), args[0]) and \
                                        IsEqual(hyp.GetMaxSize(), args[1]) and \
          hyp.SetDeflection(deflection)
          return hyp
  
 -    ## Defines "Arithmetic1D" hypothesis to cut an edge in several segments with a length
 -    #  that changes in arithmetic progression
 -    #  @param start defines the length of the first segment
 -    #  @param end   defines the length of the last  segment
 -    #  @param reversedEdges is a list of edges to mesh using reversed orientation.
 -    #                       A list item can also be a tuple (edge, 1st_vertex_of_edge)
 -    #  @param UseExisting if ==true - searches for an existing hypothesis created with
 -    #                     the same parameters, else (default) - creates a new one
 -    #  @return an instance of StdMeshers_Arithmetic1D hypothesis
 -    #  @ingroup l3_hypos_1dhyps
      def Arithmetic1D(self, start, end, reversedEdges=[], UseExisting=0):
-       """
-       Defines "Arithmetic1D" hypothesis to cut an edge in several segments with a length
-               that changes in arithmetic progression
-       Parameters:
-           start: defines the length of the first segment
-           end:   defines the length of the last  segment
-           reversedEdges: is a list of edges to mesh using reversed orientation.
-               A list item can also be a tuple (edge, 1st_vertex_of_edge)
-           UseExisting: if ==true - searches for an existing hypothesis created with
-               the same parameters, else (default) - creates a new one
-       Returns:
-               an instance of StdMeshers_Arithmetic1D hypothesis
-       """
++        """
++        Defines "Arithmetic1D" hypothesis to cut an edge in several segments with a length
++                that changes in arithmetic progression
++
++        Parameters:
++            start: defines the length of the first segment
++            end:   defines the length of the last  segment
++            reversedEdges: is a list of edges to mesh using reversed orientation.
++                A list item can also be a tuple (edge, 1st_vertex_of_edge)
++            UseExisting: if ==true - searches for an existing hypothesis created with
++                the same parameters, else (default) - creates a new one
++
++        Returns:
++                an instance of StdMeshers_Arithmetic1D hypothesis
++        """
 +        
          if not isinstance(reversedEdges,list): #old version script, before adding reversedEdges
              reversedEdges, UseExisting = [], reversedEdges
          reversedEdgeInd = self.ReversedEdgeIndices(reversedEdges)
          hyp.SetObjectEntry( entry )
          return hyp
  
 -    ## Defines "GeometricProgression" hypothesis to cut an edge in several
 -    #  segments with a length that changes in Geometric progression
 -    #  @param start defines the length of the first segment
 -    #  @param ratio defines the common ratio of the geometric progression
 -    #  @param reversedEdges is a list of edges to mesh using reversed orientation.
 -    #                       A list item can also be a tuple (edge, 1st_vertex_of_edge)
 -    #  @param UseExisting if ==true - searches for an existing hypothesis created with
 -    #                     the same parameters, else (default) - creates a new one
 -    #  @return an instance of StdMeshers_Geometric1D hypothesis
 -    #  @ingroup l3_hypos_1dhyps
      def GeometricProgression(self, start, ratio, reversedEdges=[], UseExisting=0):
-       """
-           Defines "GeometricProgression" hypothesis to cut an edge in several
-               segments with a length that changes in Geometric progression
-           Parameters:
-               start: defines the length of the first segment
-               ratio: defines the common ratio of the geometric progression
-               reversedEdges: is a list of edges to mesh using reversed orientation.
-                   A list item can also be a tuple (edge, 1st_vertex_of_edge)
-               UseExisting: if ==true - searches for an existing hypothesis created with
-                   the same parameters, else (default) - creates a new one
-           Returns:
-               an instance of StdMeshers_Geometric1D hypothesis
-       """
++        """
++            Defines "GeometricProgression" hypothesis to cut an edge in several
++                segments with a length that changes in Geometric progression
++
++            Parameters:
++                start: defines the length of the first segment
++                ratio: defines the common ratio of the geometric progression
++                reversedEdges: is a list of edges to mesh using reversed orientation.
++                    A list item can also be a tuple (edge, 1st_vertex_of_edge)
++                UseExisting: if ==true - searches for an existing hypothesis created with
++                    the same parameters, else (default) - creates a new one
++
++            Returns:
++                an instance of StdMeshers_Geometric1D hypothesis
++        """
 +        
          reversedEdgeInd = self.ReversedEdgeIndices(reversedEdges)
          entry = self.MainShapeEntry()
          from salome.smesh.smeshBuilder import IsEqual
          hyp.SetObjectEntry( entry )
          return hyp
  
 -    ## Defines "FixedPoints1D" hypothesis to cut an edge using parameter
 -    # on curve from 0 to 1 (additionally it is neecessary to check
 -    # orientation of edges and create list of reversed edges if it is
 -    # needed) and sets numbers of segments between given points (default
 -    # values are 1)
 -    #  @param points defines the list of parameters on curve
 -    #  @param nbSegs defines the list of numbers of segments
 -    #  @param reversedEdges is a list of edges to mesh using reversed orientation.
 -    #                       A list item can also be a tuple (edge, 1st_vertex_of_edge)
 -    #  @param UseExisting if ==true - searches for an existing hypothesis created with
 -    #                     the same parameters, else (default) - creates a new one
 -    #  @return an instance of StdMeshers_FixedPoints1D hypothesis
 -    #  @ingroup l3_hypos_1dhyps
      def FixedPoints1D(self, points, nbSegs=[1], reversedEdges=[], UseExisting=0):
-       Defines "FixedPoints1D" hypothesis to cut an edge using parameter
-               on curve from 0 to 1 (additionally it is neecessary to check
-               orientation of edges and create list of reversed edges if it is
-               needed) and sets numbers of segments between given points (default
-               values are 1)
-       Parameters:
-           points: defines the list of parameters on curve
-           nbSegs: defines the list of numbers of segments
-           reversedEdges: is a list of edges to mesh using reversed orientation.
-               A list item can also be a tuple (edge, 1st_vertex_of_edge)
-           UseExisting: if ==true - searches for an existing hypothesis created with
-               the same parameters, else (default) - creates a new one
-       Returns:
-               an instance of StdMeshers_FixedPoints1D hypothesis
-       """
 +        """
++        Defines "FixedPoints1D" hypothesis to cut an edge using parameter
++                on curve from 0 to 1 (additionally it is neecessary to check
++                orientation of edges and create list of reversed edges if it is
++                needed) and sets numbers of segments between given points (default
++                values are 1)
++
++        Parameters:
++            points: defines the list of parameters on curve
++            nbSegs: defines the list of numbers of segments
++            reversedEdges: is a list of edges to mesh using reversed orientation.
++                A list item can also be a tuple (edge, 1st_vertex_of_edge)
++            UseExisting: if ==true - searches for an existing hypothesis created with
++                the same parameters, else (default) - creates a new one
++
++        Returns:
++                an instance of StdMeshers_FixedPoints1D hypothesis
++        """
 +        
          if not isinstance(reversedEdges,list): #old version script, before adding reversedEdges
              reversedEdges, UseExisting = [], reversedEdges
          reversedEdgeInd = self.ReversedEdgeIndices(reversedEdges)
          hyp.SetObjectEntry(entry)
          return hyp
  
 -    ## Defines "StartEndLength" hypothesis to cut an edge in several segments with increasing geometric length
 -    #  @param start defines the length of the first segment
 -    #  @param end   defines the length of the last  segment
 -    #  @param reversedEdges is a list of edges to mesh using reversed orientation.
 -    #                       A list item can also be a tuple (edge, 1st_vertex_of_edge)
 -    #  @param UseExisting if ==true - searches for an existing hypothesis created with
 -    #                     the same parameters, else (default) - creates a new one
 -    #  @return an instance of StdMeshers_StartEndLength hypothesis
 -    #  @ingroup l3_hypos_1dhyps
      def StartEndLength(self, start, end, reversedEdges=[], UseExisting=0):
-       
 +        """
 +        Defines "StartEndLength" hypothesis to cut an edge in several segments with increasing geometric length
 +
 +        Parameters:
 +            start: defines the length of the first segment
 +            end:   defines the length of the last  segment
 +            reversedEdges: is a list of edges to mesh using reversed orientation.
 +                A list item can also be a tuple (edge, 1st_vertex_of_edge)
 +            UseExisting: if ==true - searches for an existing hypothesis created with
 +                the same parameters, else (default) - creates a new one
 +
 +        Returns:
 +            an instance of StdMeshers_StartEndLength hypothesis
 +        """
++        
          if not isinstance(reversedEdges,list): #old version script, before adding reversedEdges
              reversedEdges, UseExisting = [], reversedEdges
          reversedEdgeInd = self.ReversedEdgeIndices(reversedEdges)
          hyp.SetObjectEntry( entry )
          return hyp
  
 -    ## Defines "Deflection1D" hypothesis
 -    #  @param d for the deflection
 -    #  @param UseExisting if ==true - searches for an existing hypothesis created with
 -    #                     the same parameters, else (default) - create a new one
 -    #  @ingroup l3_hypos_1dhyps
      def Deflection1D(self, d, UseExisting=0):
-       """
-       Defines "Deflection1D" hypothesis
++        """
++        Defines "Deflection1D" hypothesis
 +
-       Parameters:
++        Parameters:
 +            d: for the deflection
 +            UseExisting: if ==true - searches for an existing hypothesis created with
 +                the same parameters, else (default) - create a new one
-       """
++        """
 +        
          from salome.smesh.smeshBuilder import IsEqual
          compFun = lambda hyp, args: IsEqual(hyp.GetDeflection(), args[0])
          hyp = self.Hypothesis("Deflection1D", [d], UseExisting=UseExisting, CompareMethod=compFun)
          hyp.SetDeflection(d)
          return hyp
  
 -    ## Defines "Propagation" hypothesis that propagates 1D hypotheses
 -    #  from an edge where this hypothesis is assigned to
 -    #  on all other edges that are at the opposite side in case of quadrangular faces
 -    #  This hypothesis should be assigned to an edge to propagate a hypothesis from.
 -    #  @ingroup l3_hypos_additi
      def Propagation(self):
-       """
-       Defines "Propagation" hypothesis that propagates 1D hypotheses
-               from an edge where this hypothesis is assigned to
-               on all other edges that are at the opposite side in case of quadrangular faces
-               This hypothesis should be assigned to an edge to propagate a hypothesis from.
-       """
++        """
++        Defines "Propagation" hypothesis that propagates 1D hypotheses
++                from an edge where this hypothesis is assigned to
++                on all other edges that are at the opposite side in case of quadrangular faces
++                This hypothesis should be assigned to an edge to propagate a hypothesis from.
++        """
 +        
          return self.Hypothesis("Propagation", UseExisting=1, CompareMethod=self.CompareEqualHyp)
  
 -    ## Defines "Propagation of Node Distribution" hypothesis that propagates
 -    #  distribution of nodes from an edge where this hypothesis is assigned to,
 -    #  to opposite edges of quadrangular faces, so that number of segments on all these
 -    #  edges will be the same, as well as relations between segment lengths. 
 -    #  @ingroup l3_hypos_additi
      def PropagationOfDistribution(self):
-       """
-       Defines "Propagation of Node Distribution" hypothesis that propagates
-               distribution of nodes from an edge where this hypothesis is assigned to,
-               to opposite edges of quadrangular faces, so that number of segments on all these
-               edges will be the same, as well as relations between segment lengths. 
-       """
++        """
++        Defines "Propagation of Node Distribution" hypothesis that propagates
++                distribution of nodes from an edge where this hypothesis is assigned to,
++                to opposite edges of quadrangular faces, so that number of segments on all these
++                edges will be the same, as well as relations between segment lengths. 
++        """
 +        
          return self.Hypothesis("PropagOfDistribution", UseExisting=1,
                                 CompareMethod=self.CompareEqualHyp)
  
 -    ## Defines "AutomaticLength" hypothesis
 -    #  @param fineness for the fineness [0-1]
 -    #  @param UseExisting if ==true - searches for an existing hypothesis created with the
 -    #                     same parameters, else (default) - create a new one
 -    #  @ingroup l3_hypos_1dhyps
      def AutomaticLength(self, fineness=0, UseExisting=0):
-       """
-       Defines "AutomaticLength" hypothesis
-       Parameters:
-           fineness: for the fineness [0-1]
-           UseExisting: if ==true - searches for an existing hypothesis created with the
-               same parameters, else (default) - create a new one
-       """
++        """
++        Defines "AutomaticLength" hypothesis
++
++        Parameters:
++            fineness: for the fineness [0-1]
++            UseExisting: if ==true - searches for an existing hypothesis created with the
++                same parameters, else (default) - create a new one
++        """
 +        
          from salome.smesh.smeshBuilder import IsEqual
          compFun = lambda hyp, args: IsEqual(hyp.GetFineness(), args[0])
          hyp = self.Hypothesis("AutomaticLength",[fineness],UseExisting=UseExisting,
          hyp.SetFineness( fineness )
          return hyp
  
 -    ## Defines "SegmentLengthAroundVertex" hypothesis
 -    #  @param length for the segment length
 -    #  @param vertex for the length localization: the vertex index [0,1] | vertex object.
 -    #         Any other integer value means that the hypothesis will be set on the
 -    #         whole 1D shape, where Mesh_Segment algorithm is assigned.
 -    #  @param UseExisting if ==true - searches for an  existing hypothesis created with
 -    #                   the same parameters, else (default) - creates a new one
 -    #  @ingroup l3_algos_segmarv
      def LengthNearVertex(self, length, vertex=0, UseExisting=0):
-       """
-       Defines "SegmentLengthAroundVertex" hypothesis
-       Parameters:
-           length: for the segment length
-           vertex: for the length localization: the vertex index [0,1] | vertex object.
-               Any other integer value means that the hypothesis will be set on the
-               whole 1D shape, where Mesh_Segment algorithm is assigned.
-           UseExisting: if ==true - searches for an  existing hypothesis created with
-               the same parameters, else (default) - creates a new one
-       """
++        """
++        Defines "SegmentLengthAroundVertex" hypothesis
++
++        Parameters:
++            length: for the segment length
++            vertex: for the length localization: the vertex index [0,1] | vertex object.
++                Any other integer value means that the hypothesis will be set on the
++                whole 1D shape, where Mesh_Segment algorithm is assigned.
++            UseExisting: if ==true - searches for an  existing hypothesis created with
++                the same parameters, else (default) - creates a new one
++        """
 +        
          import types
          store_geom = self.geom
-         if type(vertex) is types.IntType:
+         if isinstance(vertex, int):
              if vertex == 0 or vertex == 1:
                  from salome.geom import geomBuilder
                  vertex = self.mesh.geompyD.ExtractShapes(self.geom, geomBuilder.geomBuilder.ShapeType["VERTEX"],True)[vertex]
          # 0D algorithm
          if self.geom is None:
              self.geom = store_geom
-             raise RuntimeError, "Attempt to create SegmentAroundVertex_0D algorithm on None shape"
+             raise RuntimeError("Attempt to create SegmentAroundVertex_0D algorithm on None shape")
          from salome.smesh.smeshBuilder import AssureGeomPublished, GetName, TreatHypoStatus
          AssureGeomPublished( self.mesh, self.geom )
          name = GetName(self.geom)
          hyp.SetLength( length )
          return hyp
  
 -    ## Defines "QuadraticMesh" hypothesis, forcing construction of quadratic edges.
 -    #  If the 2D mesher sees that all boundary edges are quadratic,
 -    #  it generates quadratic faces, else it generates linear faces using
 -    #  medium nodes as if they are vertices.
 -    #  The 3D mesher generates quadratic volumes only if all boundary faces
 -    #  are quadratic, else it fails.
 -    #
 -    #  @ingroup l3_hypos_additi
      def QuadraticMesh(self):
-       """
-       Defines "QuadraticMesh" hypothesis, forcing construction of quadratic edges.
-       If the 2D mesher sees that all boundary edges are quadratic,
-       it generates quadratic faces, else it generates linear faces using
-       medium nodes as if they are vertices.
-       The 3D mesher generates quadratic volumes only if all boundary faces
-       are quadratic, else it fails.
-       """
-       
++        """
++        Defines "QuadraticMesh" hypothesis, forcing construction of quadratic edges.
++        If the 2D mesher sees that all boundary edges are quadratic,
++        it generates quadratic faces, else it generates linear faces using
++        medium nodes as if they are vertices.
++        The 3D mesher generates quadratic volumes only if all boundary faces
++        are quadratic, else it fails.
++        """
++        
          hyp = self.Hypothesis("QuadraticMesh", UseExisting=1, CompareMethod=self.CompareEqualHyp)
          return hyp
  
      pass # end of StdMeshersBuilder_Segment class
  
 -## Segment 1D algorithm for discretization of a set of adjacent edges as one edge.
 -#
 -#  It is created by calling smeshBuilder.Mesh.Segment(smeshBuilder.COMPOSITE,geom=0)
 -#
 -#  @ingroup l3_algos_basic
  class StdMeshersBuilder_CompositeSegment(StdMeshersBuilder_Segment):
 +    """
 +    Segment 1D algorithm for discretization of a set of adjacent edges as one edge.
 +
 +    It is created by calling smeshBuilder.Mesh.Segment(smeshBuilder.COMPOSITE,geom=0)
 +    """
 +    
  
 -    ## name of the dynamic method in smeshBuilder.Mesh class
 -    #  @internal
      meshMethod = "Segment"
 -    ## type of algorithm used with helper function in smeshBuilder.Mesh class
 -    #  @internal
 +    """
 +    name of the dynamic method in smeshBuilder.Mesh class
 +    """
 +
      algoType   = COMPOSITE
 -    ## flag pointing whether this algorithm should be used by default in dynamic method
 -    #  of smeshBuilder.Mesh class
 -    #  @internal
 +    """
 +    type of algorithm used with helper function in smeshBuilder.Mesh class
 +    """
 +
      isDefault  = False
 -    ## doc string of the method
 -    #  @internal
 +    """
 +    flag pointing whether this algorithm should be used by default in dynamic method
 +        of smeshBuilder.Mesh class
 +    """
 +
      docHelper  = "Creates segment 1D algorithm for edges"
 +    """
 +    doc string of the method
 +    """
  
 -    ## Private constructor.
 -    #  @param mesh parent mesh object algorithm is assigned to
 -    #  @param geom geometry (shape/sub-shape) algorithm is assigned to;
 -    #              if it is @c 0 (default), the algorithm is assigned to the main shape
      def __init__(self, mesh, geom=0):
 +        """
 +        Private constructor.
 +
 +        Parameters:
 +            mesh: parent mesh object algorithm is assigned to
 +            geom: geometry (shape/sub-shape) algorithm is assigned to;
 +                if it is :code:`0` (default), the algorithm is assigned to the main shape
 +        """
          self.Create(mesh, geom, self.algoType)
          pass
  
      pass # end of StdMeshersBuilder_CompositeSegment class
  
 -## Defines a segment 1D algorithm for discretization of edges with Python function
 -#
 -#  It is created by calling smeshBuilder.Mesh.Segment(smeshBuilder.PYTHON,geom=0)
 -#
 -#  @ingroup l3_algos_basic
  class StdMeshersBuilder_Segment_Python(Mesh_Algorithm):
-       It is created by calling smeshBuilder.Mesh.Segment(smeshBuilder.PYTHON,geom=0)
 +    """
 +    Defines a segment 1D algorithm for discretization of edges with Python function
++        It is created by calling smeshBuilder.Mesh.Segment(smeshBuilder.PYTHON,geom=0)
 +    """
 +    
  
 -    ## name of the dynamic method in smeshBuilder.Mesh class
 -    #  @internal
      meshMethod = "Segment"
 -    ## type of algorithm used with helper function in smeshBuilder.Mesh class
 -    #  @internal
 +    """
 +    name of the dynamic method in smeshBuilder.Mesh class
 +    """
      algoType   = PYTHON
 -    ## doc string of the method
 -    #  @internal
 +    """
 +    type of algorithm used with helper function in smeshBuilder.Mesh class
 +    """
      docHelper  = "Creates segment 1D algorithm for edges"
 +    """
 +    doc string of the method
 +    """
  
 -    ## Private constructor.
 -    #  @param mesh parent mesh object algorithm is assigned to
 -    #  @param geom geometry (shape/sub-shape) algorithm is assigned to;
 -    #              if it is @c 0 (default), the algorithm is assigned to the main shape
      def __init__(self, mesh, geom=0):
 +        """
 +        Private constructor.
 +
 +        Parameters:
 +            mesh: parent mesh object algorithm is assigned to
 +            geom: geometry (shape/sub-shape) algorithm is assigned to;
 +                if it is :code:`0` (default), the algorithm is assigned to the main shape
 +        """
          import Python1dPlugin
          self.Create(mesh, geom, self.algoType, "libPython1dEngine.so")
          pass
  
 -    ## Defines "PythonSplit1D" hypothesis
 -    #  @param n for the number of segments that cut an edge
 -    #  @param func for the python function that calculates the length of all segments
 -    #  @param UseExisting if ==true - searches for the existing hypothesis created with
 -    #                     the same parameters, else (default) - creates a new one
 -    #  @ingroup l3_hypos_1dhyps
      def PythonSplit1D(self, n, func, UseExisting=0):
 +        """
 +        Defines "PythonSplit1D" hypothesis
 +
 +        Parameters:
 +            n: for the number of segments that cut an edge
 +            func: for the python function that calculates the length of all segments
 +            UseExisting: if ==true - searches for the existing hypothesis created with
 +                the same parameters, else (default) - creates a new one
 +        """
 +        
          compFun = lambda hyp, args: False
          hyp = self.Hypothesis("PythonSplit1D", [n], "libPython1dEngine.so",
                                UseExisting=UseExisting, CompareMethod=compFun)
  
      pass # end of StdMeshersBuilder_Segment_Python class
  
 -## Triangle MEFISTO 2D algorithm
 -#
 -#  It is created by calling smeshBuilder.Mesh.Triangle(smeshBuilder.MEFISTO,geom=0)
 -#
 -#  @ingroup l3_algos_basic
  class StdMeshersBuilder_Triangle_MEFISTO(Mesh_Algorithm):
 +    """
 +    Triangle MEFISTO 2D algorithm
 +    It is created by calling smeshBuilder.Mesh.Triangle(smeshBuilder.MEFISTO,geom=0)
 +    """
 +    
  
 -    ## name of the dynamic method in smeshBuilder.Mesh class
 -    #  @internal
      meshMethod = "Triangle"
 -    ## type of algorithm used with helper function in smeshBuilder.Mesh class
 -    #  @internal
 +    """
 +    name of the dynamic method in smeshBuilder.Mesh class
 +    """
      algoType   = MEFISTO
 -    ## flag pointing whether this algorithm should be used by default in dynamic method
 -    #  of smeshBuilder.Mesh class
 -    #  @internal
 +    """
 +    type of algorithm used with helper function in smeshBuilder.Mesh class
 +    """
      isDefault  = True
 -    ## doc string of the method
 -    #  @internal
 +    """
 +    flag pointing whether this algorithm should be used by default in dynamic method
 +        of smeshBuilder.Mesh class
 +    """
      docHelper  = "Creates triangle 2D algorithm for faces"
 +    """
 +    doc string of the method
 +    """
  
 -    ## Private constructor.
 -    #  @param mesh parent mesh object algorithm is assigned to
 -    #  @param geom geometry (shape/sub-shape) algorithm is assigned to;
 -    #              if it is @c 0 (default), the algorithm is assigned to the main shape
      def __init__(self, mesh, geom=0):
 +        """
 +        Private constructor.
 +
 +        Parameters:
 +            mesh: parent mesh object algorithm is assigned to
 +            geom: geometry (shape/sub-shape) algorithm is assigned to;
 +                if it is :code:`0` (default), the algorithm is assigned to the main shape
 +        """
          Mesh_Algorithm.__init__(self)
          self.Create(mesh, geom, self.algoType)
          pass
  
 -    ## Defines "MaxElementArea" hypothesis basing on the definition of the maximum area of each triangle
 -    #  @param area for the maximum area of each triangle
 -    #  @param UseExisting if ==true - searches for an  existing hypothesis created with the
 -    #                     same parameters, else (default) - creates a new one
 -    #
 -    #  @ingroup l3_hypos_2dhyps
      def MaxElementArea(self, area, UseExisting=0):
 +        """
 +        Defines "MaxElementArea" hypothesis basing on the definition of the maximum area of each triangle
 +
 +        Parameters:
 +            area: for the maximum area of each triangle
 +            UseExisting: if ==true - searches for an  existing hypothesis created with the
 +                same parameters, else (default) - creates a new one
 +        """
 +        
          from salome.smesh.smeshBuilder import IsEqual
          comparator = lambda hyp, args: IsEqual(hyp.GetMaxElementArea(), args[0])
          hyp = self.Hypothesis("MaxElementArea", [area], UseExisting=UseExisting,
          hyp.SetMaxElementArea(area)
          return hyp
  
 -    ## Defines "LengthFromEdges" hypothesis to build triangles
 -    #  based on the length of the edges taken from the wire
 -    #
 -    #  @ingroup l3_hypos_2dhyps
      def LengthFromEdges(self):
 +        """
 +        Defines "LengthFromEdges" hypothesis to build triangles
 +            based on the length of the edges taken from the wire
 +        """
 +        
          hyp = self.Hypothesis("LengthFromEdges", UseExisting=1, CompareMethod=self.CompareEqualHyp)
          return hyp
  
      pass # end of StdMeshersBuilder_Triangle_MEFISTO class
  
 -## Defines a quadrangle 2D algorithm
 -# 
 -#  It is created by calling smeshBuilder.Mesh.Quadrangle(geom=0)
 -#
 -#  @ingroup l3_algos_basic
  class StdMeshersBuilder_Quadrangle(Mesh_Algorithm):
 +    """
 +    Defines a quadrangle 2D algorithm
 +    It is created by calling smeshBuilder.Mesh.Quadrangle(geom=0)
 +    """
 +    
  
 -    ## name of the dynamic method in smeshBuilder.Mesh class
 -    #  @internal
      meshMethod = "Quadrangle"
 -    ## type of algorithm used with helper function in smeshBuilder.Mesh class
 -    #  @internal
 +    """
 +    name of the dynamic method in smeshBuilder.Mesh class
 +    """
      algoType   = QUADRANGLE
 -    ## flag pointing whether this algorithm should be used by default in dynamic method
 -    #  of smeshBuilder.Mesh class
 -    #  @internal
 +    """
 +    type of algorithm used with helper function in smeshBuilder.Mesh class
 +    """
      isDefault  = True
 -    ## doc string of the method
 -    #  @internal
 +    """
 +    flag pointing whether this algorithm should be used by default in dynamic method
 +        of smeshBuilder.Mesh class
 +    """
      docHelper  = "Creates quadrangle 2D algorithm for faces"
 -    ## hypothesis associated with algorithm
 -    #  @internal
 +    """
 +    doc string of the method
 +    """
      params     = 0
 +    """
 +    hypothesis associated with algorithm
 +    """
  
 -    ## Private constructor.
 -    #  @param mesh parent mesh object algorithm is assigned to
 -    #  @param geom geometry (shape/sub-shape) algorithm is assigned to;
 -    #              if it is @c 0 (default), the algorithm is assigned to the main shape
      def __init__(self, mesh, geom=0):
 +        """
 +        Private constructor.
 +
 +        Parameters:
 +            mesh: parent mesh object algorithm is assigned to
 +            geom: geometry (shape/sub-shape) algorithm is assigned to;
 +                if it is :code:`0` (default), the algorithm is assigned to the main shape
 +        """
          Mesh_Algorithm.__init__(self)
          self.Create(mesh, geom, self.algoType)
          pass
  
 -    ## Defines "QuadrangleParameters" hypothesis
 -    #  @param quadType defines the algorithm of transition between differently descretized
 -    #                  sides of a geometrical face:
 -    #  - QUAD_STANDARD - both triangles and quadrangles are possible in the transition
 -    #                    area along the finer meshed sides.
 -    #  - QUAD_TRIANGLE_PREF - only triangles are built in the transition area along the
 -    #                    finer meshed sides.
 -    #  - QUAD_QUADRANGLE_PREF - only quadrangles are built in the transition area along
 -    #                    the finer meshed sides, iff the total quantity of segments on
 -    #                    all four sides of the face is even (divisible by 2).
 -    #  - QUAD_QUADRANGLE_PREF_REVERSED - same as QUAD_QUADRANGLE_PREF but the transition
 -    #                    area is located along the coarser meshed sides.
 -    #  - QUAD_REDUCED - only quadrangles are built and the transition between the sides
 -    #                    is made gradually, layer by layer. This type has a limitation on
 -    #                    the number of segments: one pair of opposite sides must have the
 -    #                    same number of segments, the other pair must have an even difference
 -    #                    between the numbers of segments on the sides.
 -    #  @param triangleVertex: vertex of a trilateral geometrical face, around which triangles
 -    #                    will be created while other elements will be quadrangles.
 -    #                    Vertex can be either a GEOM_Object or a vertex ID within the
 -    #                    shape to mesh
 -    #  @param enfVertices: list of shapes defining positions where nodes (enforced nodes)
 -    #                    must be created by the mesher. Shapes can be of any type,
 -    #                    vertices of given shapes define positions of enforced nodes.
 -    #                    Only vertices successfully projected to the face are used.
 -    #  @param enfPoints: list of points giving positions of enforced nodes.
 -    #                    Point can be defined either as SMESH.PointStruct's
 -    #                    ([SMESH.PointStruct(x1,y1,z1), SMESH.PointStruct(x2,y2,z2),...])
 -    #                    or triples of values ([[x1,y1,z1], [x2,y2,z2], ...]).
 -    #                    In the case if the defined QuadrangleParameters() refer to a sole face,
 -    #                    all given points must lie on this face, else the mesher fails.
 -    #  @param UseExisting: if \c True - searches for the existing hypothesis created with
 -    #                    the same parameters, else (default) - creates a new one
 -    #  @ingroup l3_hypos_quad
      def QuadrangleParameters(self, quadType=StdMeshers.QUAD_STANDARD, triangleVertex=0,
                               enfVertices=[],enfPoints=[],UseExisting=0):
 +        """
 +        Defines "QuadrangleParameters" hypothesis
 +            quadType defines the algorithm of transition between differently descretized
 +            sides of a geometrical face:
 +
 +            - QUAD_STANDARD - both triangles and quadrangles are possible in the transition
 +                area along the finer meshed sides.
 +            - QUAD_TRIANGLE_PREF - only triangles are built in the transition area along the
 +                finer meshed sides.
 +            - QUAD_QUADRANGLE_PREF - only quadrangles are built in the transition area along
 +                the finer meshed sides, iff the total quantity of segments on
 +                all four sides of the face is even (divisible by 2).
 +            - QUAD_QUADRANGLE_PREF_REVERSED - same as QUAD_QUADRANGLE_PREF but the transition
 +                area is located along the coarser meshed sides.
 +            - QUAD_REDUCED - only quadrangles are built and the transition between the sides
 +                is made gradually, layer by layer. This type has a limitation on
 +                the number of segments: one pair of opposite sides must have the
 +                same number of segments, the other pair must have an even difference
 +                between the numbers of segments on the sides.
 +
 +        Parameters:
 +            triangleVertex: vertex of a trilateral geometrical face, around which triangles
 +                will be created while other elements will be quadrangles.
 +                Vertex can be either a GEOM_Object or a vertex ID within the
 +                shape to mesh
 +            enfVertices: list of shapes defining positions where nodes (enforced nodes)
 +                must be created by the mesher. Shapes can be of any type,
 +                vertices of given shapes define positions of enforced nodes.
 +                Only vertices successfully projected to the face are used.
 +            enfPoints: list of points giving positions of enforced nodes.
 +                Point can be defined either as SMESH.PointStruct's
 +                ([SMESH.PointStruct(x1,y1,z1), SMESH.PointStruct(x2,y2,z2),...])
 +                or triples of values ([[x1,y1,z1], [x2,y2,z2], ...]).
 +                In the case if the defined QuadrangleParameters() refer to a sole face,
 +                all given points must lie on this face, else the mesher fails.
 +            UseExisting: if *True* - searches for the existing hypothesis created with
 +                the same parameters, else (default) - creates a new one
 +        """
 +        
 +
          import GEOM, SMESH
          vertexID = triangleVertex
          if isinstance( triangleVertex, GEOM._objref_GEOM_Object ):
          self.params.SetEnforcedNodes( enfVertices, pStructs )
          return self.params
  
 -    ## Defines "QuadrangleParams" hypothesis with a type of quadrangulation that only
 -    #   quadrangles are built in the transition area along the finer meshed sides,
 -    #   iff the total quantity of segments on all four sides of the face is even.
 -    #  @param reversed if True, transition area is located along the coarser meshed sides.
 -    #  @param UseExisting: if ==true - searches for the existing hypothesis created with
 -    #                  the same parameters, else (default) - creates a new one
 -    #  @ingroup l3_hypos_quad
      def QuadranglePreference(self, reversed=False, UseExisting=0):
-       Parameters:
 +        """
 +        Defines "QuadrangleParams" hypothesis with a type of quadrangulation that only
 +            quadrangles are built in the transition area along the finer meshed sides,
 +            if the total quantity of segments on all four sides of the face is even.
 +
-       
++        Parameters:
 +            reversed: if True, transition area is located along the coarser meshed sides.
 +        UseExisting: if ==true - searches for the existing hypothesis created with
 +            the same parameters, else (default) - creates a new one
 +        """
++        
          if reversed:
              return self.QuadrangleParameters(QUAD_QUADRANGLE_PREF_REVERSED,UseExisting=UseExisting)
          return self.QuadrangleParameters(QUAD_QUADRANGLE_PREF,UseExisting=UseExisting)
  
 -    ## Defines "QuadrangleParams" hypothesis with a type of quadrangulation that only
 -    #   triangles are built in the transition area along the finer meshed sides.
 -    #  @param UseExisting: if ==true - searches for the existing hypothesis created with
 -    #                  the same parameters, else (default) - creates a new one
 -    #  @ingroup l3_hypos_quad
      def TrianglePreference(self, UseExisting=0):
 +        """
 +        Defines "QuadrangleParams" hypothesis with a type of quadrangulation that only
 +            triangles are built in the transition area along the finer meshed sides.
 +
 +        Parameters:
 +            UseExisting: if ==true - searches for the existing hypothesis created with
 +                the same parameters, else (default) - creates a new one
 +        """
 +    
          return self.QuadrangleParameters(QUAD_TRIANGLE_PREF,UseExisting=UseExisting)
  
 -    ## Defines "QuadrangleParams" hypothesis with a type of quadrangulation that only
 -    #   quadrangles are built and the transition between the sides is made gradually,
 -    #   layer by layer. This type has a limitation on the number of segments: one pair
 -    #   of opposite sides must have the same number of segments, the other pair must
 -    #   have an even difference between the numbers of segments on the sides.
 -    #  @param UseExisting: if ==true - searches for the existing hypothesis created with
 -    #                  the same parameters, else (default) - creates a new one
 -    #  @ingroup l3_hypos_quad
      def Reduced(self, UseExisting=0):
 +        """
 +        Defines "QuadrangleParams" hypothesis with a type of quadrangulation that only
 +            quadrangles are built and the transition between the sides is made gradually,
 +            layer by layer. This type has a limitation on the number of segments: one pair
 +            of opposite sides must have the same number of segments, the other pair must
 +            have an even difference between the numbers of segments on the sides.
 +
 +        Parameters:
 +            UseExisting: if ==true - searches for the existing hypothesis created with
 +                the same parameters, else (default) - creates a new one
 +        """
 +        
          return self.QuadrangleParameters(QUAD_REDUCED,UseExisting=UseExisting)
  
 -    ## Defines "QuadrangleParams" hypothesis with QUAD_STANDARD type of quadrangulation
 -    #  @param vertex: vertex of a trilateral geometrical face, around which triangles
 -    #                 will be created while other elements will be quadrangles.
 -    #                 Vertex can be either a GEOM_Object or a vertex ID within the
 -    #                 shape to mesh
 -    #  @param UseExisting: if ==true - searches for the existing hypothesis created with
 -    #                   the same parameters, else (default) - creates a new one
 -    #  @ingroup l3_hypos_quad
      def TriangleVertex(self, vertex, UseExisting=0):
 +        """
 +        Defines "QuadrangleParams" hypothesis with QUAD_STANDARD type of quadrangulation
 +
 +        Parameters:
 +            vertex: vertex of a trilateral geometrical face, around which triangles
 +                will be created while other elements will be quadrangles.
 +                Vertex can be either a GEOM_Object or a vertex ID within the
 +                shape to mesh
 +             UseExisting: if ==true - searches for the existing hypothesis created with
 +                the same parameters, else (default) - creates a new one
 +        """
 +        
          return self.QuadrangleParameters(QUAD_STANDARD,vertex,UseExisting)
  
      pass # end of StdMeshersBuilder_Quadrangle class
  
 -## Defines a hexahedron 3D algorithm
 -# 
 -#  It is created by calling smeshBuilder.Mesh.Hexahedron(geom=0)
 -#
 -#  @ingroup l3_algos_basic
  class StdMeshersBuilder_Hexahedron(Mesh_Algorithm):
 +    """
 +    Defines a hexahedron 3D algorithm
 +    It is created by calling smeshBuilder.Mesh.Hexahedron(geom=0)
 +    """
 +    
  
 -    ## name of the dynamic method in smeshBuilder.Mesh class
 -    #  @internal
      meshMethod = "Hexahedron"
 -    ## type of algorithm used with helper function in smeshBuilder.Mesh class
 -    #  @internal
 +    """
 +    name of the dynamic method in smeshBuilder.Mesh class
 +    """
      algoType   = Hexa
 -    ## flag pointing whether this algorithm should be used by default in dynamic method
 -    #  of smeshBuilder.Mesh class
 -    #  @internal
 +    """
 +    type of algorithm used with helper function in smeshBuilder.Mesh class
 +    """
      isDefault  = True
 -    ## doc string of the method
 -    #  @internal
 +    """
 +    flag pointing whether this algorithm should be used by default in dynamic method
 +        of smeshBuilder.Mesh class
 +    """
      docHelper  = "Creates hexahedron 3D algorithm for volumes"
 +    """
 +    doc string of the method
 +    """
  
 -    ## Private constructor.
 -    #  @param mesh parent mesh object algorithm is assigned to
 -    #  @param geom geometry (shape/sub-shape) algorithm is assigned to;
 -    #              if it is @c 0 (default), the algorithm is assigned to the main shape
      def __init__(self, mesh, geom=0):
 +        """
 +        Private constructor.
 +
 +        Parameters:
 +            mesh: parent mesh object algorithm is assigned to
 +            geom: geometry (shape/sub-shape) algorithm is assigned to;
 +                if it is :code:`0` (default), the algorithm is assigned to the main shape
 +        """
          Mesh_Algorithm.__init__(self)
          self.Create(mesh, geom, Hexa)
          pass
  
      pass # end of StdMeshersBuilder_Hexahedron class
  
 -## Defines a projection 1D algorithm
 -#  
 -#  It is created by calling smeshBuilder.Mesh.Projection1D(geom=0)
 -#
 -#  @ingroup l3_algos_proj
  class StdMeshersBuilder_Projection1D(Mesh_Algorithm):
 +    """
 +    Defines a projection 1D algorithm
 +    It is created by calling smeshBuilder.Mesh.Projection1D(geom=0)
 +    """
 +    
  
 -    ## name of the dynamic method in smeshBuilder.Mesh class
 -    #  @internal
      meshMethod = "Projection1D"
 -    ## type of algorithm used with helper function in smeshBuilder.Mesh class
 -    #  @internal
 +    """
 +    name of the dynamic method in smeshBuilder.Mesh class
 +    """
      algoType   = "Projection_1D"
 -    ## flag pointing whether this algorithm should be used by default in dynamic method
 -    #  of smeshBuilder.Mesh class
 -    #  @internal
 +    """
 +    type of algorithm used with helper function in smeshBuilder.Mesh class
 +    """
      isDefault  = True
 -    ## doc string of the method
 -    #  @internal
 +    """
 +    flag pointing whether this algorithm should be used by default in dynamic method
 +        of smeshBuilder.Mesh class
 +    """
      docHelper  = "Creates projection 1D algorithm for edges"
 -
 -    ## Private constructor.
 -    #  @param mesh parent mesh object algorithm is assigned to
 -    #  @param geom geometry (shape/sub-shape) algorithm is assigned to;
 -    #              if it is @c 0 (default), the algorithm is assigned to the main shape
 +    """
 +    doc string of the method
 +    """
      def __init__(self, mesh, geom=0):
 +        """
 +        Private constructor.
 +
 +        Parameters:
 +            mesh: parent mesh object algorithm is assigned to
 +            geom: geometry (shape/sub-shape) algorithm is assigned to;
 +                if it is :code:`0` (default), the algorithm is assigned to the main shape
 +        """
          Mesh_Algorithm.__init__(self)
          self.Create(mesh, geom, self.algoType)
          pass
  
 -    ## Defines "Source Edge" hypothesis, specifying a meshed edge, from where
 -    #  a mesh pattern is taken, and, optionally, the association of vertices
 -    #  between the source edge and a target edge (to which a hypothesis is assigned)
 -    #  @param edge from which nodes distribution is taken
 -    #  @param mesh from which nodes distribution is taken (optional)
 -    #  @param srcV a vertex of \a edge to associate with \a tgtV (optional)
 -    #  @param tgtV a vertex of \a the edge to which the algorithm is assigned,
 -    #  to associate with \a srcV (optional)
 -    #  @param UseExisting if ==true - searches for the existing hypothesis created with
 -    #                     the same parameters, else (default) - creates a new one
      def SourceEdge(self, edge, mesh=None, srcV=None, tgtV=None, UseExisting=0):
 +        """
 +        Defines "Source Edge" hypothesis, specifying a meshed edge, from where
 +            a mesh pattern is taken, and, optionally, the association of vertices
 +            between the source edge and a target edge (to which a hypothesis is assigned)
 +
 +        Parameters:
 +            edge: from which nodes distribution is taken
 +            mesh: from which nodes distribution is taken (optional)
 +            srcV: a vertex of *edge* to associate with *tgtV* (optional)
 +            tgtV: a vertex of *the edge* to which the algorithm is assigned, to associate with *srcV* (optional)
 +            UseExisting: if ==true - searches for the existing hypothesis created with
 +                the same parameters, else (default) - creates a new one
 +        """
          from salome.smesh.smeshBuilder import AssureGeomPublished, Mesh
          AssureGeomPublished( self.mesh, edge )
          AssureGeomPublished( self.mesh, srcV )
  
      pass # end of StdMeshersBuilder_Projection1D class
  
 -## Defines a projection 2D algorithm
 -#  
 -#  It is created by calling smeshBuilder.Mesh.Projection2D(geom=0)
 -#
 -#  @ingroup l3_algos_proj
  class StdMeshersBuilder_Projection2D(Mesh_Algorithm):
 +    """
 +    Defines a projection 2D algorithm
 +    It is created by calling smeshBuilder.Mesh.Projection2D(geom=0)
 +    """
 +    
  
 -    ## name of the dynamic method in smeshBuilder.Mesh class
 -    #  @internal
      meshMethod = "Projection2D"
 -    ## type of algorithm used with helper function in smeshBuilder.Mesh class
 -    #  @internal
 +    """
 +    name of the dynamic method in smeshBuilder.Mesh class
 +    """
      algoType   = "Projection_2D"
 -    ## flag pointing whether this algorithm should be used by default in dynamic method
 -    #  of smeshBuilder.Mesh class
 -    #  @internal
 +    """
 +    type of algorithm used with helper function in smeshBuilder.Mesh class
 +    """
      isDefault  = True
 -    ## doc string of the method
 -    #  @internal
 +    """
 +    flag pointing whether this algorithm should be used by default in dynamic method
 +        of smeshBuilder.Mesh class
 +    """
      docHelper  = "Creates projection 2D algorithm for faces"
 +    """
 +    doc string of the method
 +    """
  
 -    ## Private constructor.
 -    #  @param mesh parent mesh object algorithm is assigned to
 -    #  @param geom geometry (shape/sub-shape) algorithm is assigned to;
 -    #              if it is @c 0 (default), the algorithm is assigned to the main shape
      def __init__(self, mesh, geom=0):
 +        """
 +        Private constructor.
 +
 +        Parameters:
 +            mesh: parent mesh object algorithm is assigned to
 +            geom: geometry (shape/sub-shape) algorithm is assigned to;
 +            if it is :code:`0` (default), the algorithm is assigned to the main shape
 +        """
          Mesh_Algorithm.__init__(self)
          self.Create(mesh, geom, self.algoType)
          pass
  
 -    ## Defines "Source Face" hypothesis, specifying a meshed face, from where
 -    #  a mesh pattern is taken, and, optionally, the association of vertices
 -    #  between the source face and the target face (to which a hypothesis is assigned)
 -    #  @param face from which the mesh pattern is taken
 -    #  @param mesh from which the mesh pattern is taken (optional)
 -    #  @param srcV1 a vertex of \a face to associate with \a tgtV1 (optional)
 -    #  @param tgtV1 a vertex of \a the face to which the algorithm is assigned,
 -    #               to associate with \a srcV1 (optional)
 -    #  @param srcV2 a vertex of \a face to associate with \a tgtV1 (optional)
 -    #  @param tgtV2 a vertex of \a the face to which the algorithm is assigned,
 -    #               to associate with \a srcV2 (optional)
 -    #  @param UseExisting if ==true - forces the search for the existing hypothesis created with
 -    #                     the same parameters, else (default) - forces the creation a new one
 -    #
 -    #  Note: all association vertices must belong to one edge of a face
 +
      def SourceFace(self, face, mesh=None, srcV1=None, tgtV1=None,
                     srcV2=None, tgtV2=None, UseExisting=0):
 +        """
 +        Defines "Source Face" hypothesis, specifying a meshed face, from where
 +            a mesh pattern is taken, and, optionally, the association of vertices
 +            between the source face and the target face (to which a hypothesis is assigned)
 +
 +        Parameters:
 +            face: from which the mesh pattern is taken
 +            mesh: from which the mesh pattern is taken (optional)
 +            srcV1: a vertex of *face* to associate with *tgtV1* (optional)
 +            tgtV1: a vertex of *the face* to which the algorithm is assigned, to associate with *srcV1* (optional)
 +            srcV2: a vertex of *face* to associate with *tgtV1* (optional)
 +            tgtV2: a vertex of *the face* to which the algorithm is assigned, to associate with *srcV2* (optional)
 +            UseExisting: if ==true - forces the search for the existing hypothesis created with
 +                he same parameters, else (default) - forces the creation a new one
 +
 +        Note: 
 +            all association vertices must belong to one edge of a face
 +        """
          from salome.smesh.smeshBuilder import Mesh
          if isinstance(mesh, Mesh):
              mesh = mesh.GetMesh()
  
      pass # end of StdMeshersBuilder_Projection2D class
  
 -## Defines a projection 1D-2D algorithm
 -#  
 -#  It is created by calling smeshBuilder.Mesh.Projection1D2D(geom=0)
 -#
 -#  @ingroup l3_algos_proj
  class StdMeshersBuilder_Projection1D2D(StdMeshersBuilder_Projection2D):
 +    """
 +    Defines a projection 1D-2D algorithm
 +    It is created by calling smeshBuilder.Mesh.Projection1D2D(geom=0)
 +    """
 +    
  
 -    ## name of the dynamic method in smeshBuilder.Mesh class
 -    #  @internal
      meshMethod = "Projection1D2D"
 -    ## type of algorithm used with helper function in smeshBuilder.Mesh class
 -    #  @internal
 +    """
 +    name of the dynamic method in smeshBuilder.Mesh class
 +    """
      algoType   = "Projection_1D2D"
 -    ## doc string of the method
 -    #  @internal
 +    """
 +    type of algorithm used with helper function in smeshBuilder.Mesh class
 +    """
      docHelper  = "Creates projection 1D-2D algorithm for faces"
 +    """
 +    doc string of the method
 +    """
  
 -    ## Private constructor.
 -    #  @param mesh parent mesh object algorithm is assigned to
 -    #  @param geom geometry (shape/sub-shape) algorithm is assigned to;
 -    #              if it is @c 0 (default), the algorithm is assigned to the main shape
      def __init__(self, mesh, geom=0):
 +        """
 +        Private constructor.
 +
 +        Parameters:
 +            mesh: parent mesh object algorithm is assigned to
 +            geom: geometry (shape/sub-shape) algorithm is assigned to;
 +                if it is :code:`0` (default), the algorithm is assigned to the main shape
 +        """
          StdMeshersBuilder_Projection2D.__init__(self, mesh, geom)
          pass
  
      pass # end of StdMeshersBuilder_Projection1D2D class
  
 -## Defines a projection 3D algorithm
 -# 
 -#  It is created by calling smeshBuilder.Mesh.Projection3D(geom=0)
 -#
 -#  @ingroup l3_algos_proj
  class StdMeshersBuilder_Projection3D(Mesh_Algorithm):
 +    """
 +    Defines a projection 3D algorithm
 +    It is created by calling smeshBuilder.Mesh.Projection3D(geom=0)
 +    """
 +    
  
 -    ## name of the dynamic method in smeshBuilder.Mesh class
 -    #  @internal
      meshMethod = "Projection3D"
 -    ## type of algorithm used with helper function in smeshBuilder.Mesh class
 -    #  @internal
 +    """
 +    name of the dynamic method in smeshBuilder.Mesh class
 +    """
      algoType   = "Projection_3D"
 -    ## doc string of the method
 -    #  @internal
 +    """
 +    type of algorithm used with helper function in smeshBuilder.Mesh class
 +    """
      docHelper  = "Creates projection 3D algorithm for volumes"
 +    """
 +    doc string of the method
 +    """
  
 -    ## Private constructor.
 -    #  @param mesh parent mesh object algorithm is assigned to
 -    #  @param geom geometry (shape/sub-shape) algorithm is assigned to;
 -    #              if it is @c 0 (default), the algorithm is assigned to the main shape
      def __init__(self, mesh, geom=0):
 +        """
 +        Private constructor.
 +
 +        Parameters:
 +            mesh: parent mesh object algorithm is assigned to
 +            geom" geometry (shape/sub-shape) algorithm is assigned to;
 +                if it is :code:`0` (default), the algorithm is assigned to the main shape
 +        """
          Mesh_Algorithm.__init__(self)
          self.Create(mesh, geom, self.algoType)
          pass
  
 -    ## Defines the "Source Shape 3D" hypothesis, specifying a meshed solid, from where
 -    #  the mesh pattern is taken, and, optionally, the  association of vertices
 -    #  between the source and the target solid  (to which a hipothesis is assigned)
 -    #  @param solid from where the mesh pattern is taken
 -    #  @param mesh from where the mesh pattern is taken (optional)
 -    #  @param srcV1 a vertex of \a solid to associate with \a tgtV1 (optional)
 -    #  @param tgtV1 a vertex of \a the solid where the algorithm is assigned,
 -    #  to associate with \a srcV1 (optional)
 -    #  @param srcV2 a vertex of \a solid to associate with \a tgtV1 (optional)
 -    #  @param tgtV2 a vertex of \a the solid to which the algorithm is assigned,
 -    #  to associate with \a srcV2 (optional)
 -    #  @param UseExisting - if ==true - searches for the existing hypothesis created with
 -    #                     the same parameters, else (default) - creates a new one
 -    #
 -    #  Note: association vertices must belong to one edge of a solid
      def SourceShape3D(self, solid, mesh=0, srcV1=0, tgtV1=0,
                        srcV2=0, tgtV2=0, UseExisting=0):
 +        """
 +        Defines the "Source Shape 3D" hypothesis, specifying a meshed solid, from where
 +            the mesh pattern is taken, and, optionally, the  association of vertices
 +            between the source and the target solid  (to which a hipothesis is assigned)
 +
 +        Parameters:
 +            solid: from where the mesh pattern is taken
 +            mesh: from where the mesh pattern is taken (optional)
 +            srcV1: a vertex of *solid* to associate with *tgtV1* (optional)
 +            tgtV1: a vertex of *the solid* where the algorithm is assigned, to associate with *srcV1* (optional)
 +            srcV2: a vertex of *solid* to associate with *tgtV1* (optional)
 +            tgtV2: a vertex of *the solid* to which the algorithm is assigned,to associate with *srcV2* (optional)
 +            UseExisting: if ==true - searches for the existing hypothesis created with
 +                    the same parameters, else (default) - creates a new one
 +
 +        Note: 
 +            association vertices must belong to one edge of a solid
 +        """
          for geom in [ solid, srcV1, tgtV1, srcV2, tgtV2 ]:
              from salome.smesh.smeshBuilder import AssureGeomPublished
              AssureGeomPublished( self.mesh, geom )
  
      pass # end of StdMeshersBuilder_Projection3D class
  
 -## Defines a Prism 3D algorithm, which is either "Extrusion 3D" or "Radial Prism"
 -#  depending on geometry
 -# 
 -#  It is created by calling smeshBuilder.Mesh.Prism(geom=0)
 -#
 -#  @ingroup l3_algos_3dextr
  class StdMeshersBuilder_Prism3D(Mesh_Algorithm):
 +    """
 +    Defines a Prism 3D algorithm, which is either "Extrusion 3D" or "Radial Prism" depending on geometry
 +    It is created by calling smeshBuilder.Mesh.Prism(geom=0)
 +    """
 +    
  
 -    ## name of the dynamic method in smeshBuilder.Mesh class
 -    #  @internal
      meshMethod = "Prism"
 -    ## type of algorithm used with helper function in smeshBuilder.Mesh class
 -    #  @internal
 +    """
 +    name of the dynamic method in smeshBuilder.Mesh class
 +    """
      algoType   = "Prism_3D"
 -    ## doc string of the method
 -    #  @internal
 +    """
 +    type of algorithm used with helper function in smeshBuilder.Mesh class
 +    """
      docHelper  = "Creates prism 3D algorithm for volumes"
 -    ## flag pointing whether this algorithm should be used by default in dynamic method
 -    #  of smeshBuilder.Mesh class
 -    #  @internal
 +    """
 +    doc string of the method
 +    """
      isDefault  = True
 +    """
 +    flag pointing whether this algorithm should be used by default in dynamic method
 +        of smeshBuilder.Mesh class
 +    """
  
 -    ## Private constructor.
 -    #  @param mesh parent mesh object algorithm is assigned to
 -    #  @param geom geometry (shape/sub-shape) algorithm is assigned to;
 -    #              if it is @c 0 (default), the algorithm is assigned to the main shape
      def __init__(self, mesh, geom=0):
 +        """
 +        Private constructor.
 +
 +        Parameters:
 +            mesh: parent mesh object algorithm is assigned to
 +            geom: geometry (shape/sub-shape) algorithm is assigned to;
 +                if it is :code:`0` (default), the algorithm is assigned to the main shape
 +        """
          Mesh_Algorithm.__init__(self)
          
          shape = geom
              pass
          pass
  
 -    ## Return 3D hypothesis holding the 1D one
      def Get3DHypothesis(self):
 +        """
 +        Returns: 
 +            3D hypothesis holding the 1D one
 +        """
          if self.algoType != "RadialPrism_3D":
-             print "Prism_3D algorithm doesn't support any hypothesis"
+             print("Prism_3D algorithm doesn't support any hypothesis")
              return None
          return self.distribHyp
  
 -    ## Private method creating a 1D hypothesis and storing it in the LayerDistribution
 -    #  hypothesis. Returns the created hypothesis
      def OwnHypothesis(self, hypType, args=[], so="libStdMeshersEngine.so"):
 +        """
 +        Private method creating a 1D hypothesis and storing it in the LayerDistribution
 +            hypothesis. 
 +
 +        Returns:
 +            the created hypothesis
 +        """
          if self.algoType != "RadialPrism_3D":
-             print "Prism_3D algorithm doesn't support any hypothesis"
+             print("Prism_3D algorithm doesn't support any hypothesis")
              return None
          if not self.nbLayers is None:
              self.mesh.GetMesh().RemoveHypothesis( self.geom, self.nbLayers )
              self.mesh.GetMesh().AddHypothesis( self.geom, self.distribHyp )
-         study = self.mesh.smeshpyD.GetCurrentStudy() # prevents publishing own 1D hypothesis
-         self.mesh.smeshpyD.SetCurrentStudy( None )
+         self.mesh.smeshpyD.SetEnablePublish( False ) # prevents publishing own 1D hypothesis
          hyp = self.mesh.smeshpyD.CreateHypothesis(hypType, so)
-         self.mesh.smeshpyD.SetCurrentStudy( study ) # enables publishing
+         self.mesh.smeshpyD.SetEnablePublish( True ) # enables publishing
          if not self.distribHyp:
              self.distribHyp = self.Hypothesis("LayerDistribution", UseExisting=0)
          self.distribHyp.SetLayerDistribution( hyp )
          return hyp
  
 -    ## Defines "NumberOfLayers" hypothesis, specifying the number of layers of
 -    #  prisms to build between the inner and outer shells
 -    #  @param n number of layers
 -    #  @param UseExisting if ==true - searches for the existing hypothesis created with
 -    #                     the same parameters, else (default) - creates a new one
      def NumberOfLayers(self, n, UseExisting=0):
 +        """
 +        Defines "NumberOfLayers" hypothesis, specifying the number of layers of
 +            prisms to build between the inner and outer shells
 +
 +        Parameters:
 +            n: number of layers
 +            UseExisting: if ==true - searches for the existing hypothesis created with
 +                the same parameters, else (default) - creates a new one
 +        """
          if self.algoType != "RadialPrism_3D":
-             print "Prism_3D algorithm doesn't support any hypothesis"
+             print("Prism_3D algorithm doesn't support any hypothesis")
              return None
          self.mesh.RemoveHypothesis( self.distribHyp, self.geom )
          from salome.smesh.smeshBuilder import IsEqual
          self.nbLayers.SetNumberOfLayers( n )
          return self.nbLayers
  
 -    ## Defines "LocalLength" hypothesis, specifying the segment length
 -    #  to build between the inner and the outer shells
 -    #  @param l the length of segments
 -    #  @param p the precision of rounding
      def LocalLength(self, l, p=1e-07):
 +        """
 +        Defines "LocalLength" hypothesis, specifying the segment length
 +            to build between the inner and the outer shells
 +
 +        Parameters:
 +            l: the length of segments
 +            p: the precision of rounding
 +        """
          if self.algoType != "RadialPrism_3D":
-             print "Prism_3D algorithm doesn't support any hypothesis"
+             print("Prism_3D algorithm doesn't support any hypothesis")
              return None
          hyp = self.OwnHypothesis("LocalLength", [l,p])
          hyp.SetLength(l)
          hyp.SetPrecision(p)
          return hyp
  
 -    ## Defines "NumberOfSegments" hypothesis, specifying the number of layers of
 -    #  prisms to build between the inner and the outer shells.
 -    #  @param n the number of layers
 -    #  @param s the scale factor (optional)
      def NumberOfSegments(self, n, s=[]):
 +        """
 +        Defines "NumberOfSegments" hypothesis, specifying the number of layers of
 +            prisms to build between the inner and the outer shells.
 +
 +        Parameters:
 +            n: the number of layers
 +            s: the scale factor (optional)
 +        """
          if self.algoType != "RadialPrism_3D":
-             print "Prism_3D algorithm doesn't support any hypothesis"
+             print("Prism_3D algorithm doesn't support any hypothesis")
              return None
          if not s:
              hyp = self.OwnHypothesis("NumberOfSegments", [n])
          hyp.SetNumberOfSegments(n)
          return hyp
  
 -    ## Defines "Arithmetic1D" hypothesis, specifying the distribution of segments
 -    #  to build between the inner and the outer shells with a length that changes
 -    #  in arithmetic progression
 -    #  @param start  the length of the first segment
 -    #  @param end    the length of the last  segment
      def Arithmetic1D(self, start, end ):
 +        """
 +        Defines "Arithmetic1D" hypothesis, specifying the distribution of segments
 +            to build between the inner and the outer shells with a length that changes
 +            in arithmetic progression
 +
 +        Parameters:
 +            start:  the length of the first segment
 +            end:    the length of the last  segment
 +        """
          if self.algoType != "RadialPrism_3D":
-             print "Prism_3D algorithm doesn't support any hypothesis"
+             print("Prism_3D algorithm doesn't support any hypothesis")
              return None
          hyp = self.OwnHypothesis("Arithmetic1D", [start, end])
          hyp.SetLength(start, 1)
          hyp.SetLength(end  , 0)
          return hyp
  
 -    ## Defines "GeometricProgression" hypothesis, specifying the distribution of segments
 -    #  to build between the inner and the outer shells with a length that changes
 -    #  in Geometric progression
 -    #  @param start  the length of the first segment
 -    #  @param ratio  the common ratio of the geometric progression
      def GeometricProgression(self, start, ratio ):
 +        """
 +        Defines "GeometricProgression" hypothesis, specifying the distribution of segments
 +            to build between the inner and the outer shells with a length that changes
 +            in Geometric progression
 +
 +        Parameters:
 +            start:  the length of the first segment
 +            ratio:  the common ratio of the geometric progression
 +        """
          if self.algoType != "RadialPrism_3D":
-             print "Prism_3D algorithm doesn't support any hypothesis"
+             print("Prism_3D algorithm doesn't support any hypothesis")
              return None
          hyp = self.OwnHypothesis("GeometricProgression", [start, ratio])
          hyp.SetStartLength( start )
          hyp.SetCommonRatio( ratio )
          return hyp
  
 -    ## Defines "StartEndLength" hypothesis, specifying distribution of segments
 -    #  to build between the inner and the outer shells as geometric length increasing
 -    #  @param start for the length of the first segment
 -    #  @param end   for the length of the last  segment
      def StartEndLength(self, start, end):
 +        """
 +        Defines "StartEndLength" hypothesis, specifying distribution of segments
 +            to build between the inner and the outer shells as geometric length increasing
 +
 +        Parameters:
 +            start: for the length of the first segment
 +        end:   for the length of the last  segment
 +        """
          if self.algoType != "RadialPrism_3D":
-             print "Prism_3D algorithm doesn't support any hypothesis"
+             print("Prism_3D algorithm doesn't support any hypothesis")
              return None
          hyp = self.OwnHypothesis("StartEndLength", [start, end])
          hyp.SetLength(start, 1)
          hyp.SetLength(end  , 0)
          return hyp
  
 -    ## Defines "AutomaticLength" hypothesis, specifying the number of segments
 -    #  to build between the inner and outer shells
 -    #  @param fineness defines the quality of the mesh within the range [0-1]
      def AutomaticLength(self, fineness=0):
 +        """
 +        Defines "AutomaticLength" hypothesis, specifying the number of segments
 +            to build between the inner and outer shells
 +
 +        Parameters:
 +            fineness: defines the quality of the mesh within the range [0-1]
 +        """
          if self.algoType != "RadialPrism_3D":
-             print "Prism_3D algorithm doesn't support any hypothesis"
+             print("Prism_3D algorithm doesn't support any hypothesis")
              return None
          hyp = self.OwnHypothesis("AutomaticLength")
          hyp.SetFineness( fineness )
  
      pass # end of StdMeshersBuilder_Prism3D class
  
 -## Defines Radial Prism 3D algorithm
 -# 
 -#  It is created by calling smeshBuilder.Mesh.Prism(geom=0)
 -#
 -#  @ingroup l3_algos_3dextr
  class StdMeshersBuilder_RadialPrism3D(StdMeshersBuilder_Prism3D):
 +    """
 +    Defines Radial Prism 3D algorithm
 +    It is created by calling smeshBuilder.Mesh.Prism(geom=0)
 +    """
 +    
  
 -    ## name of the dynamic method in smeshBuilder.Mesh class
 -    #  @internal
      meshMethod = "Prism"
 -    ## type of algorithm used with helper function in smeshBuilder.Mesh class
 -    #  @internal
 +    """
 +    name of the dynamic method in smeshBuilder.Mesh class
 +    """
      algoType   = "RadialPrism_3D"
 -    ## doc string of the method
 -    #  @internal
 +    """
 +    type of algorithm used with helper function in smeshBuilder.Mesh class
 +    """
      docHelper  = "Creates Raial Prism 3D algorithm for volumes"
 +    """
 +    doc string of the method
 +    """
  
 -    ## Private constructor.
 -    #  @param mesh parent mesh object algorithm is assigned to
 -    #  @param geom geometry (shape/sub-shape) algorithm is assigned to;
 -    #              if it is @c 0 (default), the algorithm is assigned to the main shape
      def __init__(self, mesh, geom=0):
 +        """
 +        Private constructor.
 +
 +        Parameters:
 +            mesh: parent mesh object algorithm is assigned to
 +            geom: geometry (shape/sub-shape) algorithm is assigned to;
 +            if it is :code:`0` (default), the algorithm is assigned to the main shape
 +        """
          Mesh_Algorithm.__init__(self)
          
          shape = geom
          self.nbLayers = None
          return
  
 -## Base class for algorithms supporting radial distribution hypotheses
 -# 
  class StdMeshersBuilder_RadialAlgorithm(Mesh_Algorithm):
 +    """
 +    Base class for algorithms supporting radial distribution hypotheses
 +    """ 
  
      def __init__(self):
          Mesh_Algorithm.__init__(self)
          self.nbLayers = None
          pass
  
 -    ## Return 2D hypothesis holding the 1D one
      def Get2DHypothesis(self):
 +        """
 +        Returns:
 +            2D hypothesis holding the 1D one
 +        """
          if not self.distribHyp:
              self.distribHyp = self.Hypothesis("LayerDistribution2D", UseExisting=0)
          return self.distribHyp
  
 -    ## Private method creating a 1D hypothesis and storing it in the LayerDistribution
 -    #  hypothesis. Returns the created hypothesis
      def OwnHypothesis(self, hypType, args=[], so="libStdMeshersEngine.so"):
 +        """
 +        Private method creating a 1D hypothesis and storing it in the LayerDistribution
 +            hypothesis. 
 +
 +        Returns: 
 +            the created hypothesis
 +        """
          if self.nbLayers:
              self.mesh.GetMesh().RemoveHypothesis( self.geom, self.nbLayers )
          if self.distribHyp is None:
              self.distribHyp = self.Hypothesis("LayerDistribution2D", UseExisting=0)
          else:
              self.mesh.GetMesh().AddHypothesis( self.geom, self.distribHyp )
-         study = self.mesh.smeshpyD.GetCurrentStudy() # prevents publishing own 1D hypothesis
-         self.mesh.smeshpyD.SetCurrentStudy( None )
+         self.mesh.smeshpyD.SetEnablePublish( False )
          hyp = self.mesh.smeshpyD.CreateHypothesis(hypType, so)
-         self.mesh.smeshpyD.SetCurrentStudy( study ) # enables publishing
+         self.mesh.smeshpyD.SetEnablePublish( True )
          self.distribHyp.SetLayerDistribution( hyp )
          return hyp
  
 -    ## Defines "NumberOfLayers" hypothesis, specifying the number of layers
 -    #  @param n number of layers
 -    #  @param UseExisting if ==true - searches for the existing hypothesis created with
 -    #                     the same parameters, else (default) - creates a new one
      def NumberOfLayers(self, n, UseExisting=0):
 +        """
 +        Defines "NumberOfLayers" hypothesis, specifying the number of layers
 +
 +        Parameters:
 +            n: number of layers
 +            UseExisting: if ==true - searches for the existing hypothesis created with
 +                the same parameters, else (default) - creates a new one
 +        """
          if self.distribHyp:
              self.mesh.GetMesh().RemoveHypothesis( self.geom, self.distribHyp )
          from salome.smesh.smeshBuilder import IsEqual
          self.nbLayers.SetNumberOfLayers( n )
          return self.nbLayers
  
 -    ## Defines "LocalLength" hypothesis, specifying the segment length
 -    #  @param l the length of segments
 -    #  @param p the precision of rounding
      def LocalLength(self, l, p=1e-07):
 +        """
 +        Defines "LocalLength" hypothesis, specifying the segment length
 +
 +        Parameters:
 +            l: the length of segments
 +            p: the precision of rounding
 +        """
          hyp = self.OwnHypothesis("LocalLength", [l,p])
          hyp.SetLength(l)
          hyp.SetPrecision(p)
          return hyp
  
 -    ## Defines "NumberOfSegments" hypothesis, specifying the number of layers
 -    #  @param n the number of layers
 -    #  @param s the scale factor (optional)
      def NumberOfSegments(self, n, s=[]):
 +        """
 +        Defines "NumberOfSegments" hypothesis, specifying the number of layers
 +
 +        Parameters:
 +            n: the number of layers
 +            s: the scale factor (optional)
 +        """
          if s == []:
              hyp = self.OwnHypothesis("NumberOfSegments", [n])
          else:
          hyp.SetNumberOfSegments(n)
          return hyp
  
 -    ## Defines "Arithmetic1D" hypothesis, specifying the distribution of segments
 -    #  with a length that changes in arithmetic progression
 -    #  @param start  the length of the first segment
 -    #  @param end    the length of the last  segment
      def Arithmetic1D(self, start, end ):
 +        """
 +        Defines "Arithmetic1D" hypothesis, specifying the distribution of segments
 +            with a length that changes in arithmetic progression
 +
 +        Parameters:
 +            start:  the length of the first segment
 +            end:    the length of the last  segment
 +        """
          hyp = self.OwnHypothesis("Arithmetic1D", [start, end])
          hyp.SetLength(start, 1)
          hyp.SetLength(end  , 0)
          return hyp
  
 -    ## Defines "GeometricProgression" hypothesis, specifying the distribution of segments
 -    #  with a length that changes in Geometric progression
 -    #  @param start  the length of the first segment
 -    #  @param ratio  the common ratio of the geometric progression
      def GeometricProgression(self, start, ratio ):
 +        """
 +        Defines "GeometricProgression" hypothesis, specifying the distribution of segments
 +            with a length that changes in Geometric progression
 +
 +        Parameters:
 +            start:  the length of the first segment
 +            ratio:  the common ratio of the geometric progression
 +        """
          hyp = self.OwnHypothesis("GeometricProgression", [start, ratio])
          hyp.SetStartLength( start )
          hyp.SetCommonRatio( ratio )
          return hyp
  
 -    ## Defines "StartEndLength" hypothesis, specifying distribution of segments
 -    #  as geometric length increasing
 -    #  @param start for the length of the first segment
 -    #  @param end   for the length of the last  segment
      def StartEndLength(self, start, end):
 +        """
 +        Defines "StartEndLength" hypothesis, specifying distribution of segments
 +            as geometric length increasing
 +
 +        Parameters:
 +            start: for the length of the first segment
 +            end:   for the length of the last  segment
 +        """
          hyp = self.OwnHypothesis("StartEndLength", [start, end])
          hyp.SetLength(start, 1)
          hyp.SetLength(end  , 0)
          return hyp
  
 -    ## Defines "AutomaticLength" hypothesis, specifying the number of segments
 -    #  @param fineness defines the quality of the mesh within the range [0-1]
      def AutomaticLength(self, fineness=0):
 +        """
 +        Defines "AutomaticLength" hypothesis, specifying the number of segments
 +
 +        Parameters:
 +            fineness: defines the quality of the mesh within the range [0-1]
 +        """
          hyp = self.OwnHypothesis("AutomaticLength")
          hyp.SetFineness( fineness )
          return hyp
  
      pass # end of StdMeshersBuilder_RadialQuadrangle1D2D class
  
 -## Defines a Radial Quadrangle 1D-2D algorithm
 -# 
 -#  It is created by calling smeshBuilder.Mesh.Quadrangle(smeshBuilder.RADIAL_QUAD,geom=0)
 -#
 -#  @ingroup l2_algos_radialq
  class StdMeshersBuilder_RadialQuadrangle1D2D(StdMeshersBuilder_RadialAlgorithm):
 +    """
 +    Defines a Radial Quadrangle 1D-2D algorithm 
 +    It is created by calling smeshBuilder.Mesh.Quadrangle(smeshBuilder.RADIAL_QUAD,geom=0)
 +    """
  
 -    ## name of the dynamic method in smeshBuilder.Mesh class
 -    #  @internal
      meshMethod = "Quadrangle"
 -    ## type of algorithm used with helper function in smeshBuilder.Mesh class
 -    #  @internal
 +    """
 +    name of the dynamic method in smeshBuilder.Mesh class
 +    """
      algoType   = RADIAL_QUAD
 -    ## doc string of the method
 -    #  @internal
 +    """
 +    type of algorithm used with helper function in smeshBuilder.Mesh class
 +    """
      docHelper  = "Creates quadrangle 1D-2D algorithm for faces having a shape of disk or a disk segment"
 +    """
 +    doc string of the method
 +    """
  
 -    ## Private constructor.
 -    #  @param mesh parent mesh object algorithm is assigned to
 -    #  @param geom geometry (shape/sub-shape) algorithm is assigned to;
 -    #              if it is @c 0 (default), the algorithm is assigned to the main shape
      def __init__(self, mesh, geom=0):
 +        """
 +        Private constructor.
 +
 +        Parameters:
 +            mesh: parent mesh object algorithm is assigned to
 +            geom: geometry (shape/sub-shape) algorithm is assigned to;
 +                if it is :code:`0` (default), the algorithm is assigned to the main shape
 +        """
          StdMeshersBuilder_RadialAlgorithm.__init__(self)
          self.Create(mesh, geom, self.algoType)
  
          pass
  
  
 -## Defines a Quadrangle (Medial Axis Projection) 1D-2D algorithm
 -# 
 -#  It is created by calling smeshBuilder.Mesh.Quadrangle(smeshBuilder.QUAD_MA_PROJ,geom=0)
 -#
 -#  @ingroup l2_algos_quad_ma
  class StdMeshersBuilder_QuadMA_1D2D(StdMeshersBuilder_RadialAlgorithm):
 +    """
 +    Defines a Quadrangle (Medial Axis Projection) 1D-2D algorithm 
 +    It is created by calling smeshBuilder.Mesh.Quadrangle(smeshBuilder.QUAD_MA_PROJ,geom=0)
 +    """
  
 -    ## name of the dynamic method in smeshBuilder.Mesh class
 -    #  @internal
      meshMethod = "Quadrangle"
 -    ## type of algorithm used with helper function in smeshBuilder.Mesh class
 -    #  @internal
 +    """
 +    name of the dynamic method in smeshBuilder.Mesh class
 +    """
      algoType   = QUAD_MA_PROJ
 -    ## doc string of the method
 -    #  @internal
 +    """
 +    type of algorithm used with helper function in smeshBuilder.Mesh class
 +    """
      docHelper  = "Creates quadrangle 1D-2D algorithm for faces"
 +    """
 +    doc string of the method
 +    """
  
 -    ## Private constructor.
 -    #  @param mesh parent mesh object algorithm is assigned to
 -    #  @param geom geometry (shape/sub-shape) algorithm is assigned to;
 -    #              if it is @c 0 (default), the algorithm is assigned to the main shape
      def __init__(self, mesh, geom=0):
 +        """
 +        Private constructor.
 +
 +        Parameters:
 +            mesh: parent mesh object algorithm is assigned to
 +            geom: geometry (shape/sub-shape) algorithm is assigned to;
 +                if it is :code:`0` (default), the algorithm is assigned to the main shape
 +        """
          StdMeshersBuilder_RadialAlgorithm.__init__(self)
          self.Create(mesh, geom, self.algoType)
          pass
  
      pass
  
 -## Defines a Polygon Per Face 2D algorithm
 -# 
 -#  It is created by calling smeshBuilder.Mesh.Polygon(geom=0)
 -#
 -#  @ingroup l2_algos_quad_ma
  class StdMeshersBuilder_PolygonPerFace(Mesh_Algorithm):
 +    """ Defines a Polygon Per Face 2D algorithm 
 +        It is created by calling smeshBuilder.Mesh.Polygon(geom=0)
 +    """
  
 -    ## name of the dynamic method in smeshBuilder.Mesh class
 -    #  @internal
      meshMethod = "Polygon"
 -    ## type of algorithm used with helper function in smeshBuilder.Mesh class
 -    #  @internal
 +    """
 +    name of the dynamic method in smeshBuilder.Mesh class
 +    """
      algoType   = POLYGON
 -    ## flag pointing whether this algorithm should be used by default in dynamic method
 -    #  of smeshBuilder.Mesh class
 -    #  @internal
 +    """
 +    type of algorithm used with helper function in smeshBuilder.Mesh class
 +    """
      isDefault  = True
 -    ## doc string of the method
 -    #  @internal
 +    """
 +    flag pointing whether this algorithm should be used by default in dynamic method
 +        of smeshBuilder.Mesh class
 +    """
      docHelper  = "Creates polygon 2D algorithm for faces"
 +    """
 +    doc string of the method
 +    """
  
 -    ## Private constructor.
 -    #  @param mesh parent mesh object algorithm is assigned to
 -    #  @param geom geometry (shape/sub-shape) algorithm is assigned to;
 -    #              if it is @c 0 (default), the algorithm is assigned to the main shape
      def __init__(self, mesh, geom=0):
 +        """
 +        Private constructor.
 +
 +        Parameters:
 +            mesh: parent mesh object algorithm is assigned to
 +            geom: geometry (shape/sub-shape) algorithm is assigned to;
 +                if it is :code:`0` (default), the algorithm is assigned to the main shape
 +        """
          Mesh_Algorithm.__init__(self)
          self.Create(mesh, geom, self.algoType)
          pass
  
      pass
  
 -## Defines a Use Existing Elements 1D algorithm
 -#
 -#  It is created by calling smeshBuilder.Mesh.UseExisting1DElements(geom=0)
 -#
 -#  @ingroup l3_algos_basic
  class StdMeshersBuilder_UseExistingElements_1D(Mesh_Algorithm):
 +    """ Defines a Use Existing Elements 1D algorithm
 +
 +    It is created by calling smeshBuilder.Mesh.UseExisting1DElements(geom=0)
 +    """
 +    
  
 -    ## name of the dynamic method in smeshBuilder.Mesh class
 -    #  @internal
      meshMethod = "UseExisting1DElements"
 -    ## type of algorithm used with helper function in smeshBuilder.Mesh class
 -    #  @internal
 +    """
 +    name of the dynamic method in smeshBuilder.Mesh class
 +    """
      algoType   = "Import_1D"
 -    ## flag pointing whether this algorithm should be used by default in dynamic method
 -    #  of smeshBuilder.Mesh class
 -    #  @internal
 +    """
 +    type of algorithm used with helper function in smeshBuilder.Mesh class
 +    """
      isDefault  = True
 -    ## doc string of the method
 -    #  @internal
 +    """
 +    flag pointing whether this algorithm should be used by default in dynamic method
 +        of smeshBuilder.Mesh class
 +    """
      docHelper  = "Creates 1D algorithm for edges with reusing of existing mesh elements"
 +    """
 +    doc string of the method
 +    """
  
 -    ## Private constructor.
 -    #  @param mesh parent mesh object algorithm is assigned to
 -    #  @param geom geometry (shape/sub-shape) algorithm is assigned to;
 -    #              if it is @c 0 (default), the algorithm is assigned to the main shape
      def __init__(self, mesh, geom=0):
 +        """
 +        Private constructor.
 +
 +        Parameters:
 +            mesh: parent mesh object algorithm is assigned to
 +            geom: geometry (shape/sub-shape) algorithm is assigned to;
 +                if it is :code:`0` (default), the algorithm is assigned to the main shape
 +        """
          Mesh_Algorithm.__init__(self)
          self.Create(mesh, geom, self.algoType)
          pass
  
 -    ## Defines "Source edges" hypothesis, specifying groups of edges to import
 -    #  @param groups list of groups of edges
 -    #  @param toCopyMesh if True, the whole mesh \a groups belong to is imported
 -    #  @param toCopyGroups if True, all groups of the mesh \a groups belong to are imported
 -    #  @param UseExisting if ==true - searches for the existing hypothesis created with
 -    #                     the same parameters, else (default) - creates a new one
      def SourceEdges(self, groups, toCopyMesh=False, toCopyGroups=False, UseExisting=False):
 +        """
 +        Defines "Source edges" hypothesis, specifying groups of edges to import
 +
 +        Parameters:
 +            groups: list of groups of edges
 +            toCopyMesh: if True, the whole mesh *groups* belong to is imported
 +            toCopyGroups: if True, all groups of the mesh *groups* belong to are imported
 +            UseExisting: if ==true - searches for the existing hypothesis created with
 +                the same parameters, else (default) - creates a new one
 +        """
          for group in groups:
              from salome.smesh.smeshBuilder import AssureGeomPublished
              AssureGeomPublished( self.mesh, group )
  
      pass # end of StdMeshersBuilder_UseExistingElements_1D class
  
 -## Defines a Use Existing Elements 1D-2D algorithm
 -#
 -#  It is created by calling smeshBuilder.Mesh.UseExisting2DElements(geom=0)
 -#
 -#  @ingroup l3_algos_basic
  class StdMeshersBuilder_UseExistingElements_1D2D(Mesh_Algorithm):
 +    """ Defines a Use Existing Elements 1D-2D algorithm
 +
 +    It is created by calling smeshBuilder.Mesh.UseExisting2DElements(geom=0)
 +    """
 +    
  
 -    ## name of the dynamic method in smeshBuilder.Mesh class
 -    #  @internal
      meshMethod = "UseExisting2DElements"
 -    ## type of algorithm used with helper function in smeshBuilder.Mesh class
 -    #  @internal
 +    """
 +    name of the dynamic method in smeshBuilder.Mesh class
 +    """
      algoType   = "Import_1D2D"
 -    ## flag pointing whether this algorithm should be used by default in dynamic method
 -    #  of smeshBuilder.Mesh class
 -    #  @internal
 +    """
 +    type of algorithm used with helper function in smeshBuilder.Mesh class
 +    """
      isDefault  = True
 -    ## doc string of the method
 -    #  @internal
 +    """
 +    flag pointing whether this algorithm should be used by default in dynamic method
 +        of smeshBuilder.Mesh class
 +    """
      docHelper  = "Creates 1D-2D algorithm for faces with reusing of existing mesh elements"
 +    """
 +    doc string of the method
 +    """
  
 -    ## Private constructor.
 -    #  @param mesh parent mesh object algorithm is assigned to
 -    #  @param geom geometry (shape/sub-shape) algorithm is assigned to;
 -    #              if it is @c 0 (default), the algorithm is assigned to the main shape
      def __init__(self, mesh, geom=0):
 +        """
 +        Private constructor.
 +
 +        Parameters:
 +            mesh: parent mesh object algorithm is assigned to
 +            geom: geometry (shape/sub-shape) algorithm is assigned to;
 +                if it is :code:`0` (default), the algorithm is assigned to the main shape
 +        """
          Mesh_Algorithm.__init__(self)
          self.Create(mesh, geom, self.algoType)
          pass
  
 -    ## Defines "Source faces" hypothesis, specifying groups of faces to import
 -    #  @param groups list of groups of faces
 -    #  @param toCopyMesh if True, the whole mesh \a groups belong to is imported
 -    #  @param toCopyGroups if True, all groups of the mesh \a groups belong to are imported
 -    #  @param UseExisting if ==true - searches for the existing hypothesis created with
 -    #                     the same parameters, else (default) - creates a new one
      def SourceFaces(self, groups, toCopyMesh=False, toCopyGroups=False, UseExisting=False):
 +        """
 +        Defines "Source faces" hypothesis, specifying groups of faces to import
 +
 +        Parameters:
 +            groups: list of groups of faces
 +            toCopyMesh: if True, the whole mesh *groups* belong to is imported
 +            toCopyGroups: if True, all groups of the mesh *groups* belong to are imported
 +            UseExisting: if ==true - searches for the existing hypothesis created with
 +                the same parameters, else (default) - creates a new one
 +        """
          import SMESH
          compFun = lambda hyp, args: ( hyp.GetSourceFaces() == args[0] and \
                                        hyp.GetCopySourceMesh() == args[1], args[2] )
  
      pass # end of StdMeshersBuilder_UseExistingElements_1D2D class
  
 -## Defines a Body Fitting 3D algorithm
 -#
 -#  It is created by calling smeshBuilder.Mesh.BodyFitted(geom=0)
 -#
 -#  @ingroup l3_algos_basic
  class StdMeshersBuilder_Cartesian_3D(Mesh_Algorithm):
 +    """ Defines a Body Fitting 3D algorithm
 +
 +    It is created by calling smeshBuilder.Mesh.BodyFitted(geom=0)
 +    """
 +    
  
 -    ## name of the dynamic method in smeshBuilder.Mesh class
 -    #  @internal
      meshMethod = "BodyFitted"
 -    ## type of algorithm used with helper function in smeshBuilder.Mesh class
 -    #  @internal
 +    """
 +    name of the dynamic method in smeshBuilder.Mesh class
 +    """
      algoType   = "Cartesian_3D"
 -    ## flag pointing whether this algorithm should be used by default in dynamic method
 -    #  of smeshBuilder.Mesh class
 -    #  @internal
 +    """
 +    type of algorithm used with helper function in smeshBuilder.Mesh class
 +    """
      isDefault  = True
 -    ## doc string of the method
 -    #  @internal
 +    """
 +    flag pointing whether this algorithm should be used by default in dynamic method
 +        of smeshBuilder.Mesh class
 +    """
      docHelper  = "Creates Body Fitting 3D algorithm for volumes"
 +    """
 +    doc string of the method
 +    """
  
 -    ## Private constructor.
 -    #  @param mesh parent mesh object algorithm is assigned to
 -    #  @param geom geometry (shape/sub-shape) algorithm is assigned to;
 -    #              if it is @c 0 (default), the algorithm is assigned to the main shape
      def __init__(self, mesh, geom=0):
 +        """
 +        Private constructor.
 +
 +        Parameters:
 +            mesh: parent mesh object algorithm is assigned to
 +            geom: geometry (shape/sub-shape) algorithm is assigned to;
 +                if it is :code:`0` (default), the algorithm is assigned to the main shape
 +        """
          self.Create(mesh, geom, self.algoType)
          self.hyp = None
          pass
  
 -    ## Defines "Body Fitting parameters" hypothesis
 -    #  @param xGridDef is definition of the grid along the X asix.
 -    #  It can be in either of two following forms:
 -    #  - Explicit coordinates of nodes, e.g. [-1.5, 0.0, 3.1] or range( -100,200,10)
 -    #  - Functions f(t) defining grid spacing at each point on grid axis. If there are
 -    #    several functions, they must be accompanied by relative coordinates of
 -    #    points dividing the whole shape into ranges where the functions apply; points
 -    #    coodrinates should vary within (0.0, 1.0) range. Parameter \a t of the spacing
 -    #    function f(t) varies from 0.0 to 1.0 within a shape range. 
 -    #    Examples:
 -    #    - "10.5" - defines a grid with a constant spacing
 -    #    - [["1", "1+10*t", "11"] [0.1, 0.6]] - defines different spacing in 3 ranges.
 -    #  @param yGridDef defines the grid along the Y asix the same way as \a xGridDef does.
 -    #  @param zGridDef defines the grid along the Z asix the same way as \a xGridDef does.
 -    #  @param sizeThreshold (> 1.0) defines a minimal size of a polyhedron so that
 -    #         a polyhedron of size less than hexSize/sizeThreshold is not created.
 -    #  @param implEdges enables implementation of geometrical edges into the mesh.
      def SetGrid(self, xGridDef, yGridDef, zGridDef, sizeThreshold=4.0, implEdges=False):
 +        """
 +        Defines "Body Fitting parameters" hypothesis
 +
 +        Parameters:
 +            xGridDef: is definition of the grid along the X asix.
 +                It can be in either of two following forms:
 +
 +                    - Explicit coordinates of nodes, e.g. [-1.5, 0.0, 3.1] or range( -100,200,10)
 +                    - Functions f(t) defining grid spacing at each point on grid axis. If there are
 +                        several functions, they must be accompanied by relative coordinates of
 +                        points dividing the whole shape into ranges where the functions apply; points
 +                        coodrinates should vary within (0.0, 1.0) range. Parameter *t* of the spacing
 +                        function f(t) varies from 0.0 to 1.0 within a shape range. 
 +
 +        Examples:
 +            "10.5" - defines a grid with a constant spacing
 +            [["1", "1+10*t", "11"] [0.1, 0.6]] - defines different spacing in 3 ranges.
 +
 +        Parameters:
 +            yGridDef: defines the grid along the Y asix the same way as *xGridDef* does.
 +            zGridDef: defines the grid along the Z asix the same way as *xGridDef* does.
 +            sizeThreshold: (> 1.0) defines a minimal size of a polyhedron so that
 +                a polyhedron of size less than hexSize/sizeThreshold is not created.
 +            implEdges: enables implementation of geometrical edges into the mesh.
 +        """
          if not self.hyp:
              compFun = lambda hyp, args: False
              self.hyp = self.Hypothesis("CartesianParameters3D",
              self.mesh.AddHypothesis( self.hyp, self.geom )
  
          for axis, gridDef in enumerate( [xGridDef, yGridDef, zGridDef] ):
-             if not gridDef: raise ValueError, "Empty grid definition"
+             if not gridDef: raise ValueError("Empty grid definition")
              if isinstance( gridDef, str ):
                  self.hyp.SetGridSpacing( [gridDef], [], axis )
              elif isinstance( gridDef[0], str ):
          self.hyp.SetToAddEdges( implEdges )
          return self.hyp
  
 -    ## Defines custom directions of axes of the grid
 -    #  @param xAxis either SMESH.DirStruct or a vector, or 3 vector components
 -    #  @param yAxis either SMESH.DirStruct or a vector, or 3 vector components
 -    #  @param zAxis either SMESH.DirStruct or a vector, or 3 vector components
      def SetAxesDirs( self, xAxis, yAxis, zAxis ):
 +        """
 +        Defines custom directions of axes of the grid
 +
 +        Parameters:
 +            xAxis: either SMESH.DirStruct or a vector, or 3 vector components
 +            yAxis: either SMESH.DirStruct or a vector, or 3 vector components
 +            zAxis: either SMESH.DirStruct or a vector, or 3 vector components
 +        """
          import GEOM
          if hasattr( xAxis, "__getitem__" ):
              xAxis = self.mesh.smeshpyD.MakeDirStruct( xAxis[0],xAxis[1],xAxis[2] )
          self.hyp.SetAxesDirs( xAxis, yAxis, zAxis )
          return self.hyp
  
 -    ## Automatically defines directions of axes of the grid at which
 -    #  a number of generated hexahedra is maximal
 -    #  @param isOrthogonal defines whether the axes mush be orthogonal
      def SetOptimalAxesDirs(self, isOrthogonal=True):
 +        """
 +        Automatically defines directions of axes of the grid at which
 +            a number of generated hexahedra is maximal
 +
 +        Parameters:
 +            isOrthogonal: defines whether the axes mush be orthogonal
 +        """
          if not self.hyp:
              self.hyp = self.Hypothesis("CartesianParameters3D")
          if not self.mesh.IsUsedHypothesis( self.hyp, self.geom ):
          self.hyp.SetAxesDirs( x,y,z )
          return self.hyp
  
 -    ## Sets/unsets a fixed point. The algorithm makes a plane of the grid pass
 -    #  through the fixed point in each direction at which the grid is defined
 -    #  by spacing
 -    #  @param p coordinates of the fixed point. Either SMESH.PointStruct or
 -    #         a vertex or 3 components of coordinates.
 -    #  @param toUnset defines whether the fixed point is defined or removed.
      def SetFixedPoint( self, p, toUnset=False ):
 +        """
 +        Sets/unsets a fixed point. The algorithm makes a plane of the grid pass
 +            through the fixed point in each direction at which the grid is defined
 +            by spacing
 +
 +        Parameters:
 +            p: coordinates of the fixed point. Either SMESH.PointStruct or
 +                a vertex or 3 components of coordinates.
 +            toUnset: defines whether the fixed point is defined or removed.
 +        """
          import SMESH, GEOM
          if toUnset:
              if not self.hyp: return
  
      pass # end of StdMeshersBuilder_Cartesian_3D class
  
 -## Defines a stub 1D algorithm, which enables "manual" creation of nodes and
 -#  segments usable by 2D algorithms
 -#
 -#  It is created by calling smeshBuilder.Mesh.UseExistingSegments(geom=0)
 -#
 -#  @ingroup l3_algos_basic
  class StdMeshersBuilder_UseExisting_1D(Mesh_Algorithm):
 +    """ Defines a stub 1D algorithm, which enables "manual" creation of nodes and
 +        segments usable by 2D algorithms
 +
 +    It is created by calling smeshBuilder.Mesh.UseExistingSegments(geom=0)
 +    """
 +
  
 -    ## name of the dynamic method in smeshBuilder.Mesh class
 -    #  @internal
      meshMethod = "UseExistingSegments"
 -    ## type of algorithm used with helper function in smeshBuilder.Mesh class
 -    #  @internal
 +    """
 +    name of the dynamic method in smeshBuilder.Mesh class
 +    """
      algoType   = "UseExisting_1D"
 -    ## doc string of the method
 -    #  @internal
 +    """
 +    type of algorithm used with helper function in smeshBuilder.Mesh class
 +    """
      docHelper  = "Creates 1D algorithm allowing batch meshing of edges"
 +    """
 +    doc string of the method
 +    """
  
 -    ## Private constructor.
 -    #  @param mesh parent mesh object algorithm is assigned to
 -    #  @param geom geometry (shape/sub-shape) algorithm is assigned to;
 -    #              if it is @c 0 (default), the algorithm is assigned to the main shape
      def __init__(self, mesh, geom=0):
 +        """
 +        Private constructor.
 +
 +        Parameters:
 +            mesh: parent mesh object algorithm is assigned to
 +            geom: geometry (shape/sub-shape) algorithm is assigned to;
 +                if it is :code:`0` (default), the algorithm is assigned to the main shape
 +        """
          self.Create(mesh, geom, self.algoType)
          pass
  
      pass # end of StdMeshersBuilder_UseExisting_1D class
  
 -## Defines a stub 2D algorithm, which enables "manual" creation of nodes and
 -#  faces usable by 3D algorithms
 -#
 -#  It is created by calling smeshBuilder.Mesh.UseExistingFaces(geom=0)
 -#
 -#  @ingroup l3_algos_basic
  class StdMeshersBuilder_UseExisting_2D(Mesh_Algorithm):
 +    """ Defines a stub 2D algorithm, which enables "manual" creation of nodes and
 +    faces usable by 3D algorithms
 +
 +    It is created by calling smeshBuilder.Mesh.UseExistingFaces(geom=0)
 +    """
 +    
  
 -    ## name of the dynamic method in smeshBuilder.Mesh class
 -    #  @internal
      meshMethod = "UseExistingFaces"
 -    ## type of algorithm used with helper function in smeshBuilder.Mesh class
 -    #  @internal
 +    """
 +    name of the dynamic method in smeshBuilder.Mesh class
 +    """
      algoType   = "UseExisting_2D"
 -    ## doc string of the method
 -    #  @internal
 +    """
 +    type of algorithm used with helper function in smeshBuilder.Mesh class
 +    """
      docHelper  = "Creates 2D algorithm allowing batch meshing of faces"
 +    """
 +    doc string of the method
 +    """
  
 -    ## Private constructor.
 -    #  @param mesh parent mesh object algorithm is assigned to
 -    #  @param geom geometry (shape/sub-shape) algorithm is assigned to;
 -    #              if it is @c 0 (default), the algorithm is assigned to the main shape
      def __init__(self, mesh, geom=0):
 +        """
 +        Private constructor.
 +
 +        Parameters:
 +            mesh: parent mesh object algorithm is assigned to
 +            geom: geometry (shape/sub-shape) algorithm is assigned to;
 +            if it is :code:`0` (default), the algorithm is assigned to the main shape
 +        """
          self.Create(mesh, geom, self.algoType)
          pass
  
index 05710d64c2853f408ab41c40654f6194f17a92d2,d1e2f3bb23584320f531ab0386672fb146f5d52f..841dacbdbcb34855381dbc8aa0a4befdbac8e414
  #  Author : Francis KLOSS, OCC
  #  Module : SMESH
  
 -## @package smeshBuilder
 -#  Python API for SALOME %Mesh module
 -
 -## @defgroup l1_auxiliary Auxiliary methods and structures
 -## @defgroup l1_creating  Creating meshes
 -## @{
 -##   @defgroup l2_impexp     Importing and exporting meshes
 -##   @{
 -##     @details
 -##     These are methods of class \ref smeshBuilder.smeshBuilder "smeshBuilder"
 -##   @}
 -##   @defgroup l2_construct  Constructing meshes
 -##   @defgroup l2_algorithms Defining Algorithms
 -##   @{
 -##     @defgroup l3_algos_basic   Basic meshing algorithms
 -##     @defgroup l3_algos_proj    Projection Algorithms
 -##     @defgroup l3_algos_segmarv Segments around Vertex
 -##     @defgroup l3_algos_3dextr  3D extrusion meshing algorithm
 -
 -##   @}
 -##   @defgroup l2_hypotheses Defining hypotheses
 -##   @{
 -##     @defgroup l3_hypos_1dhyps 1D Meshing Hypotheses
 -##     @defgroup l3_hypos_2dhyps 2D Meshing Hypotheses
 -##     @defgroup l3_hypos_maxvol Max Element Volume hypothesis
 -##     @defgroup l3_hypos_quad Quadrangle Parameters hypothesis
 -##     @defgroup l3_hypos_additi Additional Hypotheses
 -
 -##   @}
 -##   @defgroup l2_submeshes Constructing sub-meshes
 -##   @defgroup l2_editing   Editing Meshes
 -
 -## @}
 -## @defgroup l1_meshinfo  Mesh Information
 -## @defgroup l1_controls  Quality controls and Filtering
 -## @defgroup l1_grouping  Grouping elements
 -## @{
 -##   @defgroup l2_grps_create Creating groups
 -##   @defgroup l2_grps_operon Using operations on groups
 -##   @defgroup l2_grps_delete Deleting Groups
 -
 -## @}
 -## @defgroup l1_modifying Modifying meshes
 -## @{
 -##   @defgroup l2_modif_add      Adding nodes and elements
 -##   @defgroup l2_modif_del      Removing nodes and elements
 -##   @defgroup l2_modif_edit     Modifying nodes and elements
 -##   @defgroup l2_modif_renumber Renumbering nodes and elements
 -##   @defgroup l2_modif_trsf     Transforming meshes (Translation, Rotation, Symmetry, Sewing, Merging)
 -##   @defgroup l2_modif_unitetri Uniting triangles
 -##   @defgroup l2_modif_cutquadr Cutting elements
 -##   @defgroup l2_modif_changori Changing orientation of elements
 -##   @defgroup l2_modif_smooth   Smoothing
 -##   @defgroup l2_modif_extrurev Extrusion and Revolution
 -##   @defgroup l2_modif_tofromqu Convert to/from Quadratic Mesh
 -##   @defgroup l2_modif_duplicat Duplication of nodes and elements (to emulate cracks)
 -
 -## @}
 -## @defgroup l1_measurements Measurements
 -
  import salome
  from salome.geom import geomBuilder
  
  import SMESH # This is necessary for back compatibility
+ import omniORB                                   # back compatibility
+ SMESH.MED_V2_1 = omniORB.EnumItem("MED_V2_1", 0) # back compatibility
+ SMESH.MED_V2_2 = omniORB.EnumItem("MED_V2_2", 1) # back compatibility
  from   SMESH import *
  from   salome.smesh.smesh_algorithm import Mesh_Algorithm
  
  import SALOME
  import SALOMEDS
  import os
+ import inspect
+ # In case the omniORBpy EnumItem class does not fully support Python 3
+ # (for instance in version 4.2.1-2), the comparison ordering methods must be
+ # defined
+ #
+ try:
+     SMESH.Entity_Triangle < SMESH.Entity_Quadrangle
+ except TypeError:
+     def enumitem_eq(self, other):
+         try:
+             if isinstance(other, omniORB.EnumItem):
+                 if other._parent_id == self._parent_id:
+                     return self._v == other._v
+                 else:
+                     return self._parent_id == other._parent_id
+             else:
+                 return id(self) == id(other)
+         except:
+             return id(self) == id(other)
+     def enumitem_lt(self, other):
+         try:
+             if isinstance(other, omniORB.EnumItem):
+                 if other._parent_id == self._parent_id:
+                     return self._v < other._v
+                 else:
+                     return self._parent_id < other._parent_id
+             else:
+                 return id(self) < id(other)
+         except:
+             return id(self) < id(other)
+     def enumitem_le(self, other):
+         try:
+             if isinstance(other, omniORB.EnumItem):
+                 if other._parent_id == self._parent_id:
+                     return self._v <= other._v
+                 else:
+                     return self._parent_id <= other._parent_id
+             else:
+                 return id(self) <= id(other)
+         except:
+             return id(self) <= id(other)
+     def enumitem_gt(self, other):
+         try:
+             if isinstance(other, omniORB.EnumItem):
+                 if other._parent_id == self._parent_id:
+                     return self._v > other._v
+                 else:
+                     return self._parent_id > other._parent_id
+             else:
+                 return id(self) > id(other)
+         except:
+             return id(self) > id(other)
+     def enumitem_ge(self, other):
+         try:
+             if isinstance(other, omniORB.EnumItem):
+                 if other._parent_id == self._parent_id:
+                     return self._v >= other._v
+                 else:
+                     return self._parent_id >= other._parent_id
+             else:
+                 return id(self) >= id(other)
+         except:
+             return id(self) >= id(other)
+     omniORB.EnumItem.__eq__ = enumitem_eq
+     omniORB.EnumItem.__lt__ = enumitem_lt
+     omniORB.EnumItem.__le__ = enumitem_le
+     omniORB.EnumItem.__gt__ = enumitem_gt
+     omniORB.EnumItem.__ge__ = enumitem_ge
  
 -## Private class used to workaround a problem that sometimes isinstance(m, Mesh) returns False
 -#
  class MeshMeta(type):
 +    """Private class used to workaround a problem that sometimes isinstance(m, Mesh) returns False
 +    """
      def __instancecheck__(cls, inst):
          """Implement isinstance(inst, cls)."""
          return any(cls.__subclasscheck__(c)
          """Implement issubclass(sub, cls)."""
          return type.__subclasscheck__(cls, sub) or (cls.__name__ == sub.__name__ and cls.__module__ == sub.__module__)
  
 -## @addtogroup l1_auxiliary
 -## @{
 -
 -## Convert an angle from degrees to radians
  def DegreesToRadians(AngleInDegrees):
 +    """Convert an angle from degrees to radians
 +    """
      from math import pi
      return AngleInDegrees * pi / 180.0
  
@@@ -54,16 -195,14 +133,16 @@@ notebook = salome_notebook.noteboo
  # Salome notebook variable separator
  var_separator = ":"
  
 -## Return list of variable values from salome notebook.
 -#  The last argument, if is callable, is used to modify values got from notebook
  def ParseParameters(*args):
 +    """
 +    Return list of variable values from salome notebook.
 +    The last argument, if is callable, is used to modify values got from notebook
 +    """
      Result = []
      Parameters = ""
      hasVariables = False
      varModifFun=None
-     if args and callable( args[-1] ):
+     if args and callable(args[-1]):
          args, varModifFun = args[:-1], args[-1]
      for parameter in args:
  
          if isinstance(parameter,str):
              # check if there is an inexistent variable name
              if not notebook.isVariable(parameter):
-                 raise ValueError, "Variable with name '" + parameter + "' doesn't exist!!!"
+                 raise ValueError("Variable with name '" + parameter + "' doesn't exist!!!")
              parameter = notebook.get(parameter)
              hasVariables = True
              if varModifFun:
      Result.append( hasVariables )
      return Result
  
 -## Parse parameters while converting variables to radians
  def ParseAngles(*args):
 +    """
 +    Parse parameters while converting variables to radians
 +    """
      return ParseParameters( *( args + (DegreesToRadians, )))
  
 -## Substitute PointStruct.__init__() to create SMESH.PointStruct using notebook variables.
 -#  Parameters are stored in PointStruct.parameters attribute
  def __initPointStruct(point,*args):
 +    """
 +    Substitute PointStruct.__init__() to create SMESH.PointStruct using notebook variables.
 +    Parameters are stored in PointStruct.parameters attribute
 +    """
      point.x, point.y, point.z, point.parameters,hasVars = ParseParameters(*args)
      pass
  SMESH.PointStruct.__init__ = __initPointStruct
  
 -## Substitute AxisStruct.__init__() to create SMESH.AxisStruct using notebook variables.
 -#  Parameters are stored in AxisStruct.parameters attribute
  def __initAxisStruct(ax,*args):
 +    """
 +    Substitute AxisStruct.__init__() to create SMESH.AxisStruct using notebook variables.
 +    Parameters are stored in AxisStruct.parameters attribute
 +    """
      if len( args ) != 6:
-         raise RuntimeError,\
-               "Bad nb args (%s) passed in SMESH.AxisStruct(x,y,z,dx,dy,dz)"%(len( args ))
+         raise RuntimeError("Bad nb args (%s) passed in SMESH.AxisStruct(x,y,z,dx,dy,dz)"%(len( args )))
      ax.x, ax.y, ax.z, ax.vx, ax.vy, ax.vz, ax.parameters,hasVars = ParseParameters(*args)
      pass
  SMESH.AxisStruct.__init__ = __initAxisStruct
  
  smeshPrecisionConfusion = 1.e-07
 -## Compare real values using smeshPrecisionConfusion as tolerance
  def IsEqual(val1, val2, tol=smeshPrecisionConfusion):
 +    """Compare real values using smeshPrecisionConfusion as tolerance
 +    """
      if abs(val1 - val2) < tol:
          return True
      return False
  
  NO_NAME = "NoName"
  
 -## Return object name
  def GetName(obj):
 +    """
 +    Return a name of an object
 +    
 +    Returns:
 +        object name
 +    """
      if obj:
          # object not null
          if isinstance(obj, SALOMEDS._objref_SObject):
          except:
              ior = None
          if ior:
-             # CORBA object
-             studies = salome.myStudyManager.GetOpenStudies()
-             for sname in studies:
-                 s = salome.myStudyManager.GetStudyByName(sname)
-                 if not s: continue
-                 sobj = s.FindObjectIOR(ior)
-                 if not sobj: continue
+             sobj = salome.myStudy.FindObjectIOR(ior)
+             if sobj:
                  return sobj.GetName()
              if hasattr(obj, "GetName"):
                  # unknown CORBA object, having GetName() method
              # unknown non-CORBA object, having GetName() method
              return obj.GetName()
          pass
-     raise RuntimeError, "Null or invalid object"
+     raise RuntimeError("Null or invalid object")
  
 -## Print error message if a hypothesis was not assigned.
  def TreatHypoStatus(status, hypName, geomName, isAlgo, mesh):
 +    """
 +    Print error message if a hypothesis was not assigned.
 +    """
      if isAlgo:
          hypType = "algorithm"
      else:
          pass
      reason = ""
      if hasattr( status, "__getitem__" ):
-         status,reason = status[0],status[1]
-     if status == HYP_UNKNOWN_FATAL :
+         status, reason = status[0], status[1]
+     if status == HYP_UNKNOWN_FATAL:
          reason = "for unknown reason"
-     elif status == HYP_INCOMPATIBLE :
+     elif status == HYP_INCOMPATIBLE:
          reason = "this hypothesis mismatches the algorithm"
-     elif status == HYP_NOTCONFORM :
+     elif status == HYP_NOTCONFORM:
          reason = "a non-conform mesh would be built"
-     elif status == HYP_ALREADY_EXIST :
+     elif status == HYP_ALREADY_EXIST:
          if isAlgo: return # it does not influence anything
          reason = hypType + " of the same dimension is already assigned to this shape"
-     elif status == HYP_BAD_DIM :
+     elif status == HYP_BAD_DIM:
          reason = hypType + " mismatches the shape"
 -    elif status == HYP_CONCURENT:
 +    elif status == HYP_CONCURRENT :
          reason = "there are concurrent hypotheses on sub-shapes"
-     elif status == HYP_BAD_SUBSHAPE :
+     elif status == HYP_BAD_SUBSHAPE:
          reason = "the shape is neither the main one, nor its sub-shape, nor a valid group"
      elif status == HYP_BAD_GEOMETRY:
          reason = "the algorithm is not applicable to this geometry"
              if meshName and meshName != NO_NAME:
                  where = '"%s" shape in "%s" mesh ' % ( geomName, meshName )
      if status < HYP_UNKNOWN_FATAL and where:
-         print '"%s" was assigned to %s but %s' %( hypName, where, reason )
+         print('"%s" was assigned to %s but %s' %( hypName, where, reason ))
      elif where:
-         print '"%s" was not assigned to %s : %s' %( hypName, where, reason )
+         print('"%s" was not assigned to %s : %s' %( hypName, where, reason ))
      else:
-         print '"%s" was not assigned : %s' %( hypName, reason )
+         print('"%s" was not assigned : %s' %( hypName, reason ))
          pass
  
 -## Private method. Add geom (sub-shape of the main shape) into the study if not yet there
  def AssureGeomPublished(mesh, geom, name=''):
 +    """
 +    Private method. Add geom (sub-shape of the main shape) into the study if not yet there
 +    """
      if not isinstance( geom, geomBuilder.GEOM._objref_GEOM_Object ):
          return
-     if not geom.GetStudyEntry() and \
-            mesh.smeshpyD.GetCurrentStudy():
-         ## set the study
-         studyID = mesh.smeshpyD.GetCurrentStudy()._get_StudyId()
-         if studyID != mesh.geompyD.myStudyId:
-             mesh.geompyD.init_geom( mesh.smeshpyD.GetCurrentStudy())
+     if not geom.GetStudyEntry():
          ## get a name
          if not name and geom.GetShapeType() != geomBuilder.GEOM.COMPOUND:
              # for all groups SubShapeName() return "Compound_-1"
          mesh.geompyD.addToStudyInFather( mesh.geom, geom, name )
      return
  
 -## Return the first vertex of a geometrical edge by ignoring orientation
  def FirstVertexOnCurve(mesh, edge):
 +    """
 +    Returns:
 +        the first vertex of a geometrical edge by ignoring orientation
 +    """
      vv = mesh.geompyD.SubShapeAll( edge, geomBuilder.geomBuilder.ShapeType["VERTEX"])
      if not vv:
-         raise TypeError, "Given object has no vertices"
+         raise TypeError("Given object has no vertices")
      if len( vv ) == 1: return vv[0]
      v0   = mesh.geompyD.MakeVertexOnCurve(edge,0.)
      xyz  = mesh.geompyD.PointCoordinates( v0 ) # coords of the first vertex
      else:
          return vv[1]
  
 -## Return a long value from enumeration
 -def EnumToLong(theItem):
 -    return theItem._v
 -
 -# end of l1_auxiliary
 -## @}
 -
 -
 -# Warning: smeshInst is a singleton
  smeshInst = None
 +"""
 +Warning:
 +    smeshInst is a singleton
 +"""
  engine = None
  doLcc = False
  created = False
  
- class smeshBuilder(object, SMESH._objref_SMESH_Gen):
 -## This class allows to create, load or manipulate meshes.
 -#  It has a set of methods to create, load or copy meshes, to combine several meshes, etc.
 -#  It also has methods to get infos and measure meshes.
 -class smeshBuilder(SMESH._objref_SMESH_Gen):
++class smeshBuilder( SMESH._objref_SMESH_Gen, object ):
 +    """
 +    This class allows to create, load or manipulate meshes.
 +    It has a set of methods to create, load or copy meshes, to combine several meshes, etc.
 +    It also has methods to get infos and measure meshes.
 +    """
  
      # MirrorType enumeration
      POINT = SMESH_MeshEditor.POINT
      PrecisionConfusion = smeshPrecisionConfusion
  
      # TopAbs_State enumeration
-     [TopAbs_IN, TopAbs_OUT, TopAbs_ON, TopAbs_UNKNOWN] = range(4)
+     [TopAbs_IN, TopAbs_OUT, TopAbs_ON, TopAbs_UNKNOWN] = list(range(4))
  
      # Methods of splitting a hexahedron into tetrahedra
      Hex_5Tet, Hex_6Tet, Hex_24Tet, Hex_2Prisms, Hex_4Prisms = 1, 2, 3, 1, 2
  
-     def __new__(cls):
+     def __new__(cls, *args):
          global engine
          global smeshInst
          global doLcc
--        #print "==== __new__", engine, smeshInst, doLcc
++        #print("==== __new__", engine, smeshInst, doLcc)
  
          if smeshInst is None:
              # smesh engine is either retrieved from engine, or created
                      # FindOrLoadComponent called:
                      # 1. CORBA resolution of server
                      # 2. the __new__ method is called again
--                    #print "==== smeshInst = lcc.FindOrLoadComponent ", engine, smeshInst, doLcc
++                    #print("==== smeshInst = lcc.FindOrLoadComponent ", engine, smeshInst, doLcc)
                      smeshInst = salome.lcc.FindOrLoadComponent( "FactoryServer", "SMESH" )
              else:
                  # FindOrLoadComponent not called
                  if smeshInst is None:
                      # smeshBuilder instance is created from lcc.FindOrLoadComponent
--                    #print "==== smeshInst = super(smeshBuilder,cls).__new__(cls) ", engine, smeshInst, doLcc
++                    #print("==== smeshInst = super(smeshBuilder,cls).__new__(cls) ", engine, smeshInst, doLcc)
                      smeshInst = super(smeshBuilder,cls).__new__(cls)
                  else:
                      # smesh engine not created: existing engine found
--                    #print "==== existing ", engine, smeshInst, doLcc
++                    #print("==== existing ", engine, smeshInst, doLcc)
                      pass
--            #print "====1 ", smeshInst
++            #print("====1 ", smeshInst)
              return smeshInst
  
--        #print "====2 ", smeshInst
++        #print("====2 ", smeshInst)
          return smeshInst
  
-     def __init__(self):
+     def __init__(self, *args):
          global created
--        #print "--------------- smeshbuilder __init__ ---", created
++        #print("--------------- smeshbuilder __init__ ---", created)
          if not created:
-           created = True
-           SMESH._objref_SMESH_Gen.__init__(self)
+             created = True
+             SMESH._objref_SMESH_Gen.__init__(self, *args)
 -    ## Dump component to the Python script
 -    #  This method overrides IDL function to allow default values for the parameters.
 -    #  @ingroup l1_auxiliary
 -    def DumpPython(self, theIsPublished=True, theIsMultiFile=True):
 -        return SMESH._objref_SMESH_Gen.DumpPython(self, theIsPublished, theIsMultiFile)
 -
 -    ## Set mode of DumpPython(), \a historical or \a snapshot.
 -    #  In the \a historical mode, the Python Dump script includes all commands
 -    #  performed by SMESH engine. In the \a snapshot mode, commands
 -    #  relating to objects removed from the Study are excluded from the script
 -    #  as well as commands not influencing the current state of meshes
 -    #  @ingroup l1_auxiliary
 +
 +    def DumpPython(self, theStudy, theIsPublished=True, theIsMultiFile=True):
 +        """
 +        Dump component to the Python script.
 +        This method overrides IDL function to allow default values for the parameters.
 +        """
 +
 +        return SMESH._objref_SMESH_Gen.DumpPython(self, theStudy, theIsPublished, theIsMultiFile)
 +
      def SetDumpPythonHistorical(self, isHistorical):
 +        """
 +        Set mode of DumpPython(), *historical* or *snapshot*.
 +        In the *historical* mode, the Python Dump script includes all commands
 +        performed by SMESH engine. In the *snapshot* mode, commands
 +        relating to objects removed from the Study are excluded from the script
 +        as well as commands not influencing the current state of meshes
 +        """
 +
          if isHistorical: val = "true"
          else:            val = "false"
          SMESH._objref_SMESH_Gen.SetOption(self, "historical_python_dump", val)
  
-     def init_smesh(self,theStudy,geompyD = None):
-         """
-         Set the current study and Geometry component
 -    ## Set Geometry component
 -    #  @ingroup l1_auxiliary
 -    def init_smesh(self,isPublished = True,geompyD = None):
 -        #print "init_smesh"
++    def init_smesh(self,geompyD = None):
 +        """
-         #print "init_smesh"
-         self.SetCurrentStudy(theStudy,geompyD)
-         if theStudy:
-             global notebook
-             notebook.myStudy = theStudy
++        Set Geometry component
++        """    
++        #print("init_smesh")
+         self.UpdateStudy(geompyD)
 -        if isPublished:
 -            global notebook
 -            notebook.myStudy = salome.myStudy
 -
 -    ## Create a mesh. This can be either an empty mesh, possibly having an underlying geometry,
 -    #  or a mesh wrapping a CORBA mesh given as a parameter.
 -    #  @param obj either (1) a CORBA mesh (SMESH._objref_SMESH_Mesh) got e.g. by calling
 -    #         salome.myStudy.FindObjectID("0:1:2:3").GetObject() or
 -    #         (2) a Geometrical object for meshing or
 -    #         (3) none.
 -    #  @param name the name for the new mesh.
 -    #  @return an instance of Mesh class.
 -    #  @ingroup l2_construct
++        notebook.myStudy = salome.myStudy
 +
      def Mesh(self, obj=0, name=0):
 +        """
 +        Create a mesh. This mesh can be either 
 +
 +        * an empty mesh not bound to geometry, if *obj* == 0
 +        * an empty mesh bound to geometry, if *obj* is GEOM.GEOM_Object
 +        * a mesh wrapping a :class:`CORBA mesh <SMESH.SMESH_Mesh>` given as *obj* parameter.
 +
 +        Parameters:
 +            obj: either 
 +
 +                   1. a :class:`CORBA mesh <SMESH.SMESH_Mesh>` got by calling e.g.
 +                      ::
 +
 +                        salome.myStudy.FindObjectID("0:1:2:3").GetObject() 
 +
 +                   2. a geometrical object for meshing
 +                   3. none.
 +            name: the name for the new mesh.
 +
 +        Returns:
 +            an instance of class :class:`Mesh`.
 +        """
 +
          if isinstance(obj,str):
              obj,name = name,obj
--        return Mesh(self,self.geompyD,obj,name)
++        return Mesh(self, self.geompyD, obj, name)
 +
 +    def EnumToLong(self,theItem):
 +        """
 +        Return a long value from enumeration
 +        """
 +
 +        return theItem._v
  
 -    ## Return a string representation of the color.
 -    #  To be used with filters.
 -    #  @param c color value (SALOMEDS.Color)
 -    #  @ingroup l1_auxiliary
      def ColorToString(self,c):
 +        """
 +        Convert SALOMEDS.Color to string.
 +        To be used with filters.
 +
 +        Parameters:
 +            c: color value (SALOMEDS.Color)
 +
 +        Returns:
 +            a string representation of the color.
 +        """
 +
          val = ""
          if isinstance(c, SALOMEDS.Color):
              val = "%s;%s;%s" % (c.R, c.G, c.B)
          elif isinstance(c, str):
              val = c
          else:
-             raise ValueError, "Color value should be of string or SALOMEDS.Color type"
+             raise ValueError("Color value should be of string or SALOMEDS.Color type")
          return val
  
 -    ## Get PointStruct from vertex
 -    #  @param theVertex a GEOM object(vertex)
 -    #  @return SMESH.PointStruct
 -    #  @ingroup l1_auxiliary
      def GetPointStruct(self,theVertex):
 +        """
 +        Get :class:`SMESH.PointStruct` from vertex
 +
 +        Parameters:
 +                theVertex (GEOM.GEOM_Object): vertex
 +
 +        Returns:
 +                :class:`SMESH.PointStruct`
 +        """
 +
          [x, y, z] = self.geompyD.PointCoordinates(theVertex)
          return PointStruct(x,y,z)
  
 -    ## Get DirStruct from vector
 -    #  @param theVector a GEOM object(vector)
 -    #  @return SMESH.DirStruct
 -    #  @ingroup l1_auxiliary
      def GetDirStruct(self,theVector):
 +        """
 +        Get :class:`SMESH.DirStruct` from vector
 +
 +        Parameters:
 +                theVector (GEOM.GEOM_Object): vector
 +
 +        Returns:
 +                :class:`SMESH.DirStruct`
 +        """
 +
          vertices = self.geompyD.SubShapeAll( theVector, geomBuilder.geomBuilder.ShapeType["VERTEX"] )
          if(len(vertices) != 2):
-             print "Error: vector object is incorrect."
+             print("Error: vector object is incorrect.")
              return None
          p1 = self.geompyD.PointCoordinates(vertices[0])
          p2 = self.geompyD.PointCoordinates(vertices[1])
          dirst = DirStruct(pnt)
          return dirst
  
 -    ## Make DirStruct from a triplet
 -    #  @param x,y,z vector components
 -    #  @return SMESH.DirStruct
 -    #  @ingroup l1_auxiliary
      def MakeDirStruct(self,x,y,z):
 +        """
 +        Make :class:`SMESH.DirStruct` from a triplet of floats
 +
 +        Parameters:
 +                x,y,z (float): vector components
 +
 +        Returns:
 +                :class:`SMESH.DirStruct`
 +        """
 +
          pnt = PointStruct(x,y,z)
          return DirStruct(pnt)
  
 -    ## Get AxisStruct from object
 -    #  @param theObj a GEOM object (line or plane)
 -    #  @return SMESH.AxisStruct
 -    #  @ingroup l1_auxiliary
      def GetAxisStruct(self,theObj):
 +        """
 +        Get :class:`SMESH.AxisStruct` from a geometrical object
 +
 +        Parameters:
 +            theObj (GEOM.GEOM_Object): line or plane
 +
 +        Returns:
 +            :class:`SMESH.AxisStruct`
 +        """
          import GEOM
          edges = self.geompyD.SubShapeAll( theObj, geomBuilder.geomBuilder.ShapeType["EDGE"] )
          axis = None
      # From SMESH_Gen interface:
      # ------------------------
  
 -    ## Set the given name to the object
 -    #  @param obj the object to rename
 -    #  @param name a new object name
 -    #  @ingroup l1_auxiliary
      def SetName(self, obj, name):
 +        """
 +        Set the given name to an object
 +
 +        Parameters:
 +                obj: the object to rename
 +                name: a new object name
 +        """
 +
          if isinstance( obj, Mesh ):
              obj = obj.GetMesh()
          elif isinstance( obj, Mesh_Algorithm ):
          ior  = salome.orb.object_to_string(obj)
          SMESH._objref_SMESH_Gen.SetName(self, ior, name)
  
 -    ## Set the current mode
 -    #  @ingroup l1_auxiliary
      def SetEmbeddedMode( self,theMode ):
 +        """
 +        Set the current mode
 +        """
 +
          SMESH._objref_SMESH_Gen.SetEmbeddedMode(self,theMode)
  
 -    ## Get the current mode
 -    #  @ingroup l1_auxiliary
      def IsEmbeddedMode(self):
 +        """
 +        Get the current mode
 +        """
 +
          return SMESH._objref_SMESH_Gen.IsEmbeddedMode(self)
 -    
 -    ## Update the current study. Calling UpdateStudy() allows to 
 -    #  update meshes at switching GEOM->SMESH
 -    #  @ingroup l1_auxiliary
 +
-     def SetCurrentStudy( self, theStudy, geompyD = None ):
-         """
-         Set the current study. Calling SetCurrentStudy( None ) allows to
-         switch **off** automatic pubilishing in the Study of mesh objects.
-         """
-         if not geompyD:
+     def UpdateStudy( self, geompyD = None  ):
++      """
++        Update the current study. Calling UpdateStudy() allows to 
++      update meshes at switching GEOM->SMESH
++      """
+         #self.UpdateStudy()
 -        if not geompyD:
++      if not geompyD:
              from salome.geom import geomBuilder
              geompyD = geomBuilder.geom
              pass
--        self.geompyD=geompyD
--        self.SetGeomEngine(geompyD)
-         SMESH._objref_SMESH_Gen.SetCurrentStudy(self,theStudy)
-         global notebook
-         if theStudy:
-             notebook = salome_notebook.NoteBook( theStudy )
-         else:
-             notebook = salome_notebook.NoteBook( salome_notebook.PseudoStudyForNoteBook() )
-         if theStudy:
-             sb = theStudy.NewBuilder()
-             sc = theStudy.FindComponent("SMESH")
-             if sc: sb.LoadWith(sc, self)
-             pass
 -        SMESH._objref_SMESH_Gen.UpdateStudy(self)
 -        sb = salome.myStudy.NewBuilder()
 -        sc = salome.myStudy.FindComponent("SMESH")
 -        if sc: sb.LoadWith(sc, self)
--        pass
-     def GetCurrentStudy(self):
-         """
-         Get the current study
-         """
 -        
 -    ## Sets enable publishing in the study. Calling SetEnablePublish( false ) allows to
 -    #  switch OFF publishing in the Study of mesh objects.
 -    #  @ingroup l1_auxiliary
++      self.geompyD=geompyD
++      self.SetGeomEngine(geompyD)
++      SMESH._objref_SMESH_Gen.UpdateStudy(self)
++      sb = salome.myStudy.NewBuilder()
++      sc = salome.myStudy.FindComponent("SMESH")
++      if sc:
++            sb.LoadWith(sc, self)
++      pass
++    
+     def SetEnablePublish( self, theIsEnablePublish ):
++      """
++        Sets enable publishing in the study. Calling SetEnablePublish( false ) allows to
++      switch OFF publishing in the Study of mesh objects.
++      """
+         #self.SetEnablePublish(theIsEnablePublish)
 -        SMESH._objref_SMESH_Gen.SetEnablePublish(self,theIsEnablePublish)
 -        global notebook
 -        notebook = salome_notebook.NoteBook( theIsEnablePublish )
++      SMESH._objref_SMESH_Gen.SetEnablePublish(self,theIsEnablePublish)
++      global notebook
++      notebook = salome_notebook.NoteBook( theIsEnablePublish )
 +
-         return SMESH._objref_SMESH_Gen.GetCurrentStudy(self)
  
 -    ## Create a Mesh object importing data from the given UNV file
 -    #  @return an instance of Mesh class
 -    #  @ingroup l2_impexp
      def CreateMeshesFromUNV( self,theFileName ):
 +        """
 +        Create a Mesh object importing data from the given UNV file
 +
 +        Returns:
 +                an instance of class :class:`Mesh`
 +        """
 +
          aSmeshMesh = SMESH._objref_SMESH_Gen.CreateMeshesFromUNV(self,theFileName)
          aMesh = Mesh(self, self.geompyD, aSmeshMesh)
          return aMesh
  
 -    ## Create a Mesh object(s) importing data from the given MED file
 -    #  @return a tuple ( list of Mesh class instances, SMESH.DriverMED_ReadStatus )
 -    #  @ingroup l2_impexp
      def CreateMeshesFromMED( self,theFileName ):
 +        """
 +        Create a Mesh object(s) importing data from the given MED file
 +
 +        Returns:
 +                a tuple ( list of class :class:`Mesh` instances, 
 +                :class:`SMESH.DriverMED_ReadStatus` )
 +        """
 +
          aSmeshMeshes, aStatus = SMESH._objref_SMESH_Gen.CreateMeshesFromMED(self,theFileName)
          aMeshes = [ Mesh(self, self.geompyD, m) for m in aSmeshMeshes ]
          return aMeshes, aStatus
  
 -    ## Create a Mesh object(s) importing data from the given SAUV file
 -    #  @return a tuple ( list of Mesh class instances, SMESH.DriverMED_ReadStatus )
 -    #  @ingroup l2_impexp
      def CreateMeshesFromSAUV( self,theFileName ):
 +        """
 +        Create a Mesh object(s) importing data from the given SAUV file
 +
 +        Returns:
 +                a tuple ( list of class :class:`Mesh` instances, :class:`SMESH.DriverMED_ReadStatus` )
 +        """
 +
          aSmeshMeshes, aStatus = SMESH._objref_SMESH_Gen.CreateMeshesFromSAUV(self,theFileName)
          aMeshes = [ Mesh(self, self.geompyD, m) for m in aSmeshMeshes ]
          return aMeshes, aStatus
  
 -    ## Create a Mesh object importing data from the given STL file
 -    #  @return an instance of Mesh class
 -    #  @ingroup l2_impexp
      def CreateMeshesFromSTL( self, theFileName ):
 +        """
 +        Create a Mesh object importing data from the given STL file
 +
 +        Returns:
 +                an instance of class :class:`Mesh`
 +        """
 +
          aSmeshMesh = SMESH._objref_SMESH_Gen.CreateMeshesFromSTL(self,theFileName)
          aMesh = Mesh(self, self.geompyD, aSmeshMesh)
          return aMesh
  
 -    ## Create Mesh objects importing data from the given CGNS file
 -    #  @return a tuple ( list of Mesh class instances, SMESH.DriverMED_ReadStatus )
 -    #  @ingroup l2_impexp
      def CreateMeshesFromCGNS( self, theFileName ):
 +        """
 +        Create Mesh objects importing data from the given CGNS file
 +
 +        Returns:
 +                a tuple ( list of class :class:`Mesh` instances, :class:`SMESH.DriverMED_ReadStatus` )
 +        """
 +
          aSmeshMeshes, aStatus = SMESH._objref_SMESH_Gen.CreateMeshesFromCGNS(self,theFileName)
          aMeshes = [ Mesh(self, self.geompyD, m) for m in aSmeshMeshes ]
          return aMeshes, aStatus
  
 -    ## Create a Mesh object importing data from the given GMF file.
 -    #  GMF files must have .mesh extension for the ASCII format and .meshb for
 -    #  the binary format.
 -    #  @return [ an instance of Mesh class, SMESH.ComputeError ]
 -    #  @ingroup l2_impexp
      def CreateMeshesFromGMF( self, theFileName ):
 +        """
 +        Create a Mesh object importing data from the given GMF file.
 +        GMF files must have .mesh extension for the ASCII format and .meshb for
 +        the binary format.
 +
 +        Returns:
 +                ( an instance of class :class:`Mesh`, :class:`SMESH.ComputeError` )
 +        """
 +
          aSmeshMesh, error = SMESH._objref_SMESH_Gen.CreateMeshesFromGMF(self,
                                                                          theFileName,
                                                                          True)
-         if error.comment: print "*** CreateMeshesFromGMF() errors:\n", error.comment
+         if error.comment: print("*** CreateMeshesFromGMF() errors:\n", error.comment)
          return Mesh(self, self.geompyD, aSmeshMesh), error
  
 -    ## Concatenate the given meshes into one mesh. All groups of input meshes will be
 -    #  present in the new mesh.
 -    #  @param meshes the meshes, sub-meshes and groups to combine into one mesh
 -    #  @param uniteIdenticalGroups if true, groups with same names are united, else they are renamed
 -    #  @param mergeNodesAndElements if true, equal nodes and elements are merged
 -    #  @param mergeTolerance tolerance for merging nodes
 -    #  @param allGroups forces creation of groups corresponding to every input mesh
 -    #  @param name name of a new mesh
 -    #  @return an instance of Mesh class
 -    #  @ingroup l1_creating
      def Concatenate( self, meshes, uniteIdenticalGroups,
                       mergeNodesAndElements = False, mergeTolerance = 1e-5, allGroups = False,
                       name = ""):
 +        """
 +        Concatenate the given meshes into one mesh. All groups of input meshes will be
 +        present in the new mesh.
 +
 +        Parameters:
 +                meshes: :class:`meshes, sub-meshes, groups or filters <SMESH.SMESH_IDSource>` to combine into one mesh
 +                uniteIdenticalGroups: if True, groups with same names are united, else they are renamed
 +                mergeNodesAndElements: if True, equal nodes and elements are merged
 +                mergeTolerance: tolerance for merging nodes
 +                allGroups: forces creation of groups corresponding to every input mesh
 +                name: name of a new mesh
 +
 +        Returns:
 +                an instance of class :class:`Mesh`
 +        """
 +
          if not meshes: return None
          for i,m in enumerate(meshes):
              if isinstance(m, Mesh):
          aMesh = Mesh(self, self.geompyD, aSmeshMesh, name=name)
          return aMesh
  
 -    ## Create a mesh by copying a part of another mesh.
 -    #  @param meshPart a part of mesh to copy, either a Mesh, a sub-mesh or a group;
 -    #                  to copy nodes or elements not contained in any mesh object,
 -    #                  pass result of Mesh.GetIDSource( list_of_ids, type ) as meshPart
 -    #  @param meshName a name of the new mesh
 -    #  @param toCopyGroups to create in the new mesh groups the copied elements belongs to
 -    #  @param toKeepIDs to preserve order of the copied elements or not
 -    #  @return an instance of Mesh class
 -    #  @ingroup l1_creating
      def CopyMesh( self, meshPart, meshName, toCopyGroups=False, toKeepIDs=False):
 +        """
 +        Create a mesh by copying a part of another mesh.
 +
 +        Parameters:
 +                meshPart: a part of mesh to copy, either 
 +                        :class:`mesh, sub-mesh, group or filter <SMESH.SMESH_IDSource>`.
 +                        To copy nodes or elements not forming any mesh object,
 +                        pass result of :meth:`Mesh.GetIDSource` as *meshPart*
 +                meshName: a name of the new mesh
 +                toCopyGroups: to create in the new mesh groups the copied elements belongs to
 +                toKeepIDs: to preserve order of the copied elements or not
 +
 +        Returns:
 +                an instance of class :class:`Mesh`
 +        """
 +
          if (isinstance( meshPart, Mesh )):
              meshPart = meshPart.GetMesh()
          mesh = SMESH._objref_SMESH_Gen.CopyMesh( self,meshPart,meshName,toCopyGroups,toKeepIDs )
          return Mesh(self, self.geompyD, mesh)
  
 -    ## Return IDs of sub-shapes
 -    #  @return the list of integer values
 -    #  @ingroup l1_auxiliary
      def GetSubShapesId( self, theMainObject, theListOfSubObjects ):
 +        """
 +        Return IDs of sub-shapes
 +
 +        Parameters:
 +                theMainObject (GEOM.GEOM_Object): a shape
 +                theListOfSubObjects: sub-shapes (list of GEOM.GEOM_Object)
 +        Returns:
 +                the list of integer values
 +        """
 +
          return SMESH._objref_SMESH_Gen.GetSubShapesId(self,theMainObject, theListOfSubObjects)
  
 -    ## Create a pattern mapper.
 -    #  @return an instance of SMESH_Pattern
 -    #
 -    #  <a href="../tui_modifying_meshes_page.html#tui_pattern_mapping">Example of Patterns usage</a>
 -    #  @ingroup l1_modifying
      def GetPattern(self):
 +        """
 +        Create a pattern mapper.
 +
 +        Returns:
 +                an instance of :class:`SMESH.SMESH_Pattern`
 +
 +        :ref:`Example of Patterns usage <tui_pattern_mapping>`
 +        """
 +
          return SMESH._objref_SMESH_Gen.GetPattern(self)
  
 -    ## Set number of segments per diagonal of boundary box of geometry, by which
 -    #  default segment length of appropriate 1D hypotheses is defined in GUI.
 -    #  Default value is 10.
 -    #  @ingroup l1_auxiliary
      def SetBoundaryBoxSegmentation(self, nbSegments):
 +        """
 +        Set number of segments per diagonal of boundary box of geometry, by which
 +        default segment length of appropriate 1D hypotheses is defined in GUI.
 +        Default value is 10.
 +        """
 +
          SMESH._objref_SMESH_Gen.SetBoundaryBoxSegmentation(self,nbSegments)
  
      # Filtering. Auxiliary functions:
      # ------------------------------
  
 -    ## Create an empty criterion
 -    #  @return SMESH.Filter.Criterion
 -    #  @ingroup l1_controls
      def GetEmptyCriterion(self):
 -        Type = EnumToLong(FT_Undefined)
 -        Compare = EnumToLong(FT_Undefined)
 +        """
 +        Create an empty criterion
 +
 +        Returns:
 +                :class:`SMESH.Filter.Criterion`
 +        """
 +
 +        Type = self.EnumToLong(FT_Undefined)
 +        Compare = self.EnumToLong(FT_Undefined)
          Threshold = 0
          ThresholdStr = ""
          ThresholdID = ""
 -        UnaryOp = EnumToLong(FT_Undefined)
 -        BinaryOp = EnumToLong(FT_Undefined)
 +        UnaryOp = self.EnumToLong(FT_Undefined)
 +        BinaryOp = self.EnumToLong(FT_Undefined)
          Tolerance = 1e-07
          TypeOfElement = ALL
          Precision = -1 ##@1e-07
          return Filter.Criterion(Type, Compare, Threshold, ThresholdStr, ThresholdID,
                                  UnaryOp, BinaryOp, Tolerance, TypeOfElement, Precision)
  
 -    ## Create a criterion by the given parameters
 -    #  \n Criterion structures allow to define complex filters by combining them with logical operations (AND / OR) (see example below)
 -    #  @param elementType the type of elements(SMESH.NODE, SMESH.EDGE, SMESH.FACE, SMESH.VOLUME)
 -    #  @param CritType the type of criterion (SMESH.FT_Taper, SMESH.FT_Area, etc.)
 -    #          Type SMESH.FunctorType._items in the Python Console to see all values.
 -    #          Note that the items starting from FT_LessThan are not suitable for CritType.
 -    #  @param Compare  belongs to {SMESH.FT_LessThan, SMESH.FT_MoreThan, SMESH.FT_EqualTo}
 -    #  @param Threshold the threshold value (range of ids as string, shape, numeric)
 -    #  @param UnaryOp  SMESH.FT_LogicalNOT or SMESH.FT_Undefined
 -    #  @param BinaryOp a binary logical operation SMESH.FT_LogicalAND, SMESH.FT_LogicalOR or
 -    #                  SMESH.FT_Undefined
 -    #  @param Tolerance the tolerance used by SMESH.FT_BelongToGeom, SMESH.FT_BelongToSurface,
 -    #         SMESH.FT_LyingOnGeom, SMESH.FT_CoplanarFaces criteria
 -    #  @return SMESH.Filter.Criterion
 -    #
 -    #  <a href="../tui_filters_page.html#combining_filters">Example of Criteria usage</a>
 -    #  @ingroup l1_controls
      def GetCriterion(self,elementType,
                       CritType,
                       Compare = FT_EqualTo,
                       UnaryOp=FT_Undefined,
                       BinaryOp=FT_Undefined,
                       Tolerance=1e-07):
 +        """
 +        Create a criterion by the given parameters
 +        Criterion structures allow to define complex filters by combining them with logical operations (AND / OR) (see example below)
 +
 +        Parameters:
 +                elementType: the :class:`type of elements <SMESH.ElementType>` (SMESH.NODE, SMESH.EDGE, SMESH.FACE, SMESH.VOLUME)
 +                CritType: the type of criterion :class:`SMESH.FunctorType` (SMESH.FT_Taper, SMESH.FT_Area, etc.).
 +                        Note that the items starting from FT_LessThan are not suitable for *CritType*.
 +                Compare:  belongs to {SMESH.FT_LessThan, SMESH.FT_MoreThan, SMESH.FT_EqualTo}
 +                Threshold: the threshold value (range of ids as string, shape, numeric)
 +                UnaryOp:  SMESH.FT_LogicalNOT or SMESH.FT_Undefined
 +                BinaryOp: a binary logical operation SMESH.FT_LogicalAND, SMESH.FT_LogicalOR or
 +                        SMESH.FT_Undefined
 +                Tolerance: the tolerance used by SMESH.FT_BelongToGeom, SMESH.FT_BelongToSurface,
 +                        SMESH.FT_LyingOnGeom, SMESH.FT_CoplanarFaces criteria
 +
 +        Returns:
 +                :class:`SMESH.Filter.Criterion`
 +
 +        Example: :ref:`combining_filters`
 +        """
 +
          if not CritType in SMESH.FunctorType._items:
-             raise TypeError, "CritType should be of SMESH.FunctorType"
+             raise TypeError("CritType should be of SMESH.FunctorType")
          aCriterion               = self.GetEmptyCriterion()
          aCriterion.TypeOfElement = elementType
 -        aCriterion.Type          = EnumToLong(CritType)
 +        aCriterion.Type          = self.EnumToLong(CritType)
          aCriterion.Tolerance     = Tolerance
  
          aThreshold = Threshold
  
          if Compare in [FT_LessThan, FT_MoreThan, FT_EqualTo]:
 -            aCriterion.Compare = EnumToLong(Compare)
 +            aCriterion.Compare = self.EnumToLong(Compare)
          elif Compare == "=" or Compare == "==":
 -            aCriterion.Compare = EnumToLong(FT_EqualTo)
 +            aCriterion.Compare = self.EnumToLong(FT_EqualTo)
          elif Compare == "<":
 -            aCriterion.Compare = EnumToLong(FT_LessThan)
 +            aCriterion.Compare = self.EnumToLong(FT_LessThan)
          elif Compare == ">":
 -            aCriterion.Compare = EnumToLong(FT_MoreThan)
 +            aCriterion.Compare = self.EnumToLong(FT_MoreThan)
          elif Compare != FT_Undefined:
 -            aCriterion.Compare = EnumToLong(FT_EqualTo)
 +            aCriterion.Compare = self.EnumToLong(FT_EqualTo)
              aThreshold = Compare
  
          if CritType in [FT_BelongToGeom,     FT_BelongToPlane, FT_BelongToGenSurface,
              elif isinstance( aThreshold, str ):
                  aCriterion.ThresholdStr = aThreshold
              else:
-                 raise TypeError, "The Threshold should be a shape."
+                 raise TypeError("The Threshold should be a shape.")
              if isinstance(UnaryOp,float):
                  aCriterion.Tolerance = UnaryOp
                  UnaryOp = FT_Undefined
              # Check that Threshold is a group
              if isinstance(aThreshold, SMESH._objref_SMESH_GroupBase):
                  if aThreshold.GetType() != elementType:
-                     raise ValueError, "Group type mismatches Element type"
+                     raise ValueError("Group type mismatches Element type")
                  aCriterion.ThresholdStr = aThreshold.GetName()
                  aCriterion.ThresholdID  = salome.orb.object_to_string( aThreshold )
-                 study = self.GetCurrentStudy()
+                 study = salome.myStudy
                  if study:
                      so = study.FindObjectIOR( aCriterion.ThresholdID )
                      if so:
                          if entry:
                              aCriterion.ThresholdID = entry
              else:
-                 raise TypeError, "The Threshold should be a Mesh Group"
+                 raise TypeError("The Threshold should be a Mesh Group")
          elif CritType == FT_RangeOfIds:
              # Check that Threshold is string
              if isinstance(aThreshold, str):
                  aCriterion.ThresholdStr = aThreshold
              else:
-                 raise TypeError, "The Threshold should be a string."
+                 raise TypeError("The Threshold should be a string.")
          elif CritType == FT_CoplanarFaces:
              # Check the Threshold
              if isinstance(aThreshold, int):
              elif isinstance(aThreshold, str):
                  ID = int(aThreshold)
                  if ID < 1:
-                     raise ValueError, "Invalid ID of mesh face: '%s'"%aThreshold
+                     raise ValueError("Invalid ID of mesh face: '%s'"%aThreshold)
                  aCriterion.ThresholdID = aThreshold
              else:
-                 raise TypeError,\
-                       "The Threshold should be an ID of mesh face and not '%s'"%aThreshold
+                 raise TypeError("The Threshold should be an ID of mesh face and not '%s'"%aThreshold)
          elif CritType == FT_ConnectedElements:
              # Check the Threshold
              if isinstance(aThreshold, geomBuilder.GEOM._objref_GEOM_Object): # shape
                  aCriterion.Threshold = aThreshold
              elif isinstance(aThreshold, list): # 3 point coordinates
                  if len( aThreshold ) < 3:
-                     raise ValueError, "too few point coordinates, must be 3"
+                     raise ValueError("too few point coordinates, must be 3")
                  aCriterion.ThresholdStr = " ".join( [str(c) for c in aThreshold[:3]] )
              elif isinstance(aThreshold, str):
                  if aThreshold.isdigit():
                  else:
                      aCriterion.ThresholdStr = aThreshold # hope that it's point coordinates
              else:
-                 raise TypeError,\
-                       "The Threshold should either a VERTEX, or a node ID, "\
-                       "or a list of point coordinates and not '%s'"%aThreshold
+                 raise TypeError("The Threshold should either a VERTEX, or a node ID, "\
+                       "or a list of point coordinates and not '%s'"%aThreshold)
          elif CritType == FT_ElemGeomType:
              # Check the Threshold
              try:
 -                aCriterion.Threshold = EnumToLong(aThreshold)
 +                aCriterion.Threshold = self.EnumToLong(aThreshold)
                  assert( aThreshold in SMESH.GeometryType._items )
              except:
                  if isinstance(aThreshold, int):
                      aCriterion.Threshold = aThreshold
                  else:
-                     raise TypeError, "The Threshold should be an integer or SMESH.GeometryType."
+                     raise TypeError("The Threshold should be an integer or SMESH.GeometryType.")
                  pass
              pass
          elif CritType == FT_EntityType:
              # Check the Threshold
              try:
 -                aCriterion.Threshold = EnumToLong(aThreshold)
 +                aCriterion.Threshold = self.EnumToLong(aThreshold)
                  assert( aThreshold in SMESH.EntityType._items )
              except:
                  if isinstance(aThreshold, int):
                      aCriterion.Threshold = aThreshold
                  else:
-                     raise TypeError, "The Threshold should be an integer or SMESH.EntityType."
+                     raise TypeError("The Threshold should be an integer or SMESH.EntityType.")
                  pass
              pass
  
              try:
                  aCriterion.ThresholdStr = self.ColorToString(aThreshold)
              except:
-                 raise TypeError, "The threshold value should be of SALOMEDS.Color type"
+                 raise TypeError("The threshold value should be of SALOMEDS.Color type")
              pass
          elif CritType in [FT_FreeBorders, FT_FreeEdges, FT_FreeNodes, FT_FreeFaces,
                            FT_LinearOrQuadratic, FT_BadOrientedVolume,
                            FT_EqualNodes,FT_EqualEdges,FT_EqualFaces,FT_EqualVolumes ]:
              # At this point the Threshold is unnecessary
              if aThreshold ==  FT_LogicalNOT:
 -                aCriterion.UnaryOp = EnumToLong(FT_LogicalNOT)
 +                aCriterion.UnaryOp = self.EnumToLong(FT_LogicalNOT)
              elif aThreshold in [FT_LogicalAND, FT_LogicalOR]:
                  aCriterion.BinaryOp = aThreshold
          else:
                  aThreshold = float(aThreshold)
                  aCriterion.Threshold = aThreshold
              except:
-                 raise TypeError, "The Threshold should be a number."
+                 raise TypeError("The Threshold should be a number.")
                  return None
  
          if Threshold ==  FT_LogicalNOT or UnaryOp ==  FT_LogicalNOT:
 -            aCriterion.UnaryOp = EnumToLong(FT_LogicalNOT)
 +            aCriterion.UnaryOp = self.EnumToLong(FT_LogicalNOT)
  
          if Threshold in [FT_LogicalAND, FT_LogicalOR]:
 -            aCriterion.BinaryOp = EnumToLong(Threshold)
 +            aCriterion.BinaryOp = self.EnumToLong(Threshold)
  
          if UnaryOp in [FT_LogicalAND, FT_LogicalOR]:
 -            aCriterion.BinaryOp = EnumToLong(UnaryOp)
 +            aCriterion.BinaryOp = self.EnumToLong(UnaryOp)
  
          if BinaryOp in [FT_LogicalAND, FT_LogicalOR]:
 -            aCriterion.BinaryOp = EnumToLong(BinaryOp)
 +            aCriterion.BinaryOp = self.EnumToLong(BinaryOp)
  
          return aCriterion
  
 -    ## Create a filter with the given parameters
 -    #  @param elementType the type of elements (SMESH.NODE, SMESH.EDGE, SMESH.FACE, SMESH.VOLUME)
 -    #  @param CritType the type of criterion (SMESH.FT_Taper, SMESH.FT_Area, etc.)
 -    #          Type SMESH.FunctorType._items in the Python Console to see all values.
 -    #          Note that the items starting from FT_LessThan are not suitable for CritType.
 -    #  @param Compare  belongs to {SMESH.FT_LessThan, SMESH.FT_MoreThan, SMESH.FT_EqualTo}
 -    #  @param Threshold the threshold value (range of ids as string, shape, numeric)
 -    #  @param UnaryOp  SMESH.FT_LogicalNOT or SMESH.FT_Undefined
 -    #  @param Tolerance the tolerance used by SMESH.FT_BelongToGeom, SMESH.FT_BelongToSurface,
 -    #         SMESH.FT_LyingOnGeom, SMESH.FT_CoplanarFaces and SMESH.FT_EqualNodes criteria
 -    #  @param mesh the mesh to initialize the filter with
 -    #  @return SMESH_Filter
 -    #
 -    #  <a href="../tui_filters_page.html#tui_filters">Example of Filters usage</a>
 -    #  @ingroup l1_controls
      def GetFilter(self,elementType,
                    CritType=FT_Undefined,
                    Compare=FT_EqualTo,
                    UnaryOp=FT_Undefined,
                    Tolerance=1e-07,
                    mesh=None):
 +        """
 +        Create a filter with the given parameters
 +
 +        Parameters:
 +                elementType: the :class:`type of elements <SMESH.ElementType>` (SMESH.NODE, SMESH.EDGE, SMESH.FACE, SMESH.VOLUME)
 +                CritType: the :class:`type of criterion <SMESH.FunctorType>` (SMESH.FT_Taper, SMESH.FT_Area, etc.).
 +                        Note that the items starting from FT_LessThan are not suitable for CritType.
 +                Compare: belongs to {SMESH.FT_LessThan, SMESH.FT_MoreThan, SMESH.FT_EqualTo}
 +                Threshold: the threshold value (range of ids as string, shape, numeric)
 +                UnaryOp:  SMESH.FT_LogicalNOT or SMESH.FT_Undefined
 +                Tolerance: the tolerance used by SMESH.FT_BelongToGeom, SMESH.FT_BelongToSurface,
 +                        SMESH.FT_LyingOnGeom, SMESH.FT_CoplanarFaces and SMESH.FT_EqualNodes criteria
 +                mesh: the mesh to initialize the filter with
 +
 +        Returns:
 +                :class:`SMESH.Filter`
 +
 +        Examples:
 +               See :doc:`Filters usage examples <tui_filters>`
 +        """
 +
          aCriterion = self.GetCriterion(elementType, CritType, Compare, Threshold, UnaryOp, FT_Undefined,Tolerance)
          aFilterMgr = self.CreateFilterManager()
          aFilter = aFilterMgr.CreateFilter()
          aFilterMgr.UnRegister()
          return aFilter
  
 -    ## Create a filter from criteria
 -    #  @param criteria a list of criteria
 -    #  @param binOp binary operator used when binary operator of criteria is undefined
 -    #  @return SMESH_Filter
 -    #
 -    #  <a href="../tui_filters_page.html#tui_filters">Example of Filters usage</a>
 -    #  @ingroup l1_controls
      def GetFilterFromCriteria(self,criteria, binOp=SMESH.FT_LogicalAND):
 +        """
 +        Create a filter from criteria
 +
 +        Parameters:
 +                criteria: a list of :class:`SMESH.Filter.Criterion`
 +                binOp: binary operator used when binary operator of criteria is undefined
 +
 +        Returns:
 +                :class:`SMESH.Filter`
 +
 +        Examples:
 +               See :doc:`Filters usage examples <tui_filters>`
 +        """
 +
          for i in range( len( criteria ) - 1 ):
 -            if criteria[i].BinaryOp == EnumToLong( SMESH.FT_Undefined ):
 -                criteria[i].BinaryOp = EnumToLong( binOp )
 +            if criteria[i].BinaryOp == self.EnumToLong( SMESH.FT_Undefined ):
 +                criteria[i].BinaryOp = self.EnumToLong( binOp )
          aFilterMgr = self.CreateFilterManager()
          aFilter = aFilterMgr.CreateFilter()
          aFilter.SetCriteria(criteria)
          aFilterMgr.UnRegister()
          return aFilter
  
 -    ## Create a numerical functor by its type
 -    #  @param theCriterion functor type - an item of SMESH.FunctorType enumeration.
 -    #          Type SMESH.FunctorType._items in the Python Console to see all items.
 -    #          Note that not all items correspond to numerical functors.
 -    #  @return SMESH_NumericalFunctor
 -    #  @ingroup l1_controls
      def GetFunctor(self,theCriterion):
 +        """
 +        Create a numerical functor by its type
 +
 +        Parameters:
 +                theCriterion (SMESH.FunctorType): functor type.
 +                        Note that not all items correspond to numerical functors.
 +
 +        Returns:
 +                :class:`SMESH.NumericalFunctor`
 +        """
 +
          if isinstance( theCriterion, SMESH._objref_NumericalFunctor ):
              return theCriterion
          aFilterMgr = self.CreateFilterManager()
          elif theCriterion == FT_BallDiameter:
              functor = aFilterMgr.CreateBallDiameter()
          else:
-             print "Error: given parameter is not numerical functor type."
+             print("Error: given parameter is not numerical functor type.")
          aFilterMgr.UnRegister()
          return functor
  
 -    ## Create hypothesis
 -    #  @param theHType mesh hypothesis type (string)
 -    #  @param theLibName mesh plug-in library name
 -    #  @return created hypothesis instance
      def CreateHypothesis(self, theHType, theLibName="libStdMeshersEngine.so"):
 +        """
 +        Create hypothesis
 +
 +        Parameters:
 +                theHType (string): mesh hypothesis type
 +                theLibName (string): mesh plug-in library name
 +
 +        Returns:
 +                created hypothesis instance
 +        """
          hyp = SMESH._objref_SMESH_Gen.CreateHypothesis(self, theHType, theLibName )
  
          if isinstance( hyp, SMESH._objref_SMESH_Algo ):
              return hyp
  
          # wrap hypothesis methods
 -        #print "HYPOTHESIS", theHType
          for meth_name in dir( hyp.__class__ ):
              if not meth_name.startswith("Get") and \
                 not meth_name in dir ( SMESH._objref_SMESH_Hypothesis ):
  
          return hyp
  
 -    ## Get the mesh statistic
 -    #  @return dictionary "element type" - "count of elements"
 -    #  @ingroup l1_meshinfo
      def GetMeshInfo(self, obj):
 +        """
 +        Get the mesh statistic.
 +        Use :meth:`smeshBuilder.EnumToLong` to get an integer from 
 +        an item of :class:`SMESH.EntityType`.
 +
 +        Returns:
 +                dictionary { :class:`SMESH.EntityType` - "count of elements" }
 +        """
 +
          if isinstance( obj, Mesh ):
              obj = obj.GetMesh()
          d = {}
          if hasattr(obj, "GetMeshInfo"):
              values = obj.GetMeshInfo()
 -            for i in range(EnumToLong(SMESH.Entity_Last)):
 +            for i in range(SMESH.Entity_Last._v):
                  if i < len(values): d[SMESH.EntityType._item(i)]=values[i]
              pass
          return d
  
 -    ## Get minimum distance between two objects
 -    #
 -    #  If @a src2 is None, and @a id2 = 0, distance from @a src1 / @a id1 to the origin is computed.
 -    #  If @a src2 is None, and @a id2 != 0, it is assumed that both @a id1 and @a id2 belong to @a src1.
 -    #
 -    #  @param src1 first source object
 -    #  @param src2 second source object
 -    #  @param id1 node/element id from the first source
 -    #  @param id2 node/element id from the second (or first) source
 -    #  @param isElem1 @c True if @a id1 is element id, @c False if it is node id
 -    #  @param isElem2 @c True if @a id2 is element id, @c False if it is node id
 -    #  @return minimum distance value
 -    #  @sa GetMinDistance()
 -    #  @ingroup l1_measurements
      def MinDistance(self, src1, src2=None, id1=0, id2=0, isElem1=False, isElem2=False):
 +        """
 +        Get minimum distance between two objects
 +
 +        * If *src2* is None, and *id2* = 0, distance from *src1* / *id1* to the origin is computed.
 +        * If *src2* is None, and *id2* != 0, it is assumed that both *id1* and *id2* belong to *src1*.
 +
 +        Parameters:
 +                src1 (SMESH.SMESH_IDSource): first source object
 +                src2 (SMESH.SMESH_IDSource): second source object
 +                id1 (int): node/element id from the first source
 +                id2 (int): node/element id from the second (or first) source
 +                isElem1 (boolean): *True* if *id1* is element id, *False* if it is node id
 +                isElem2 (boolean): *True* if *id2* is element id, *False* if it is node id
 +
 +        Returns:
 +                minimum distance value
 +
 +        See also: 
 +                :meth:`GetMinDistance`
 +        """
 +
          result = self.GetMinDistance(src1, src2, id1, id2, isElem1, isElem2)
          if result is None:
              result = 0.0
              result = result.value
          return result
  
 -    ## Get measure structure specifying minimum distance data between two objects
 -    #
 -    #  If @a src2 is None, and @a id2 = 0, distance from @a src1 / @a id1 to the origin is computed.
 -    #  If @a src2 is None, and @a id2 != 0, it is assumed that both @a id1 and @a id2 belong to @a src1.
 -    #
 -    #  @param src1 first source object
 -    #  @param src2 second source object
 -    #  @param id1 node/element id from the first source
 -    #  @param id2 node/element id from the second (or first) source
 -    #  @param isElem1 @c True if @a id1 is element id, @c False if it is node id
 -    #  @param isElem2 @c True if @a id2 is element id, @c False if it is node id
 -    #  @return Measure structure or None if input data is invalid
 -    #  @sa MinDistance()
 -    #  @ingroup l1_measurements
      def GetMinDistance(self, src1, src2=None, id1=0, id2=0, isElem1=False, isElem2=False):
 +        """
 +        Get :class:`SMESH.Measure` structure specifying minimum distance data between two objects
 +
 +        * If *src2* is None, and *id2*  = 0, distance from *src1* / *id1* to the origin is computed.
 +        * If *src2* is None, and *id2* != 0, it is assumed that both *id1* and *id2* belong to *src1*.
 +
 +        Parameters:
 +                src1 (SMESH.SMESH_IDSource): first source object
 +                src2 (SMESH.SMESH_IDSource): second source object
 +                id1 (int): node/element id from the first source
 +                id2 (int): node/element id from the second (or first) source
 +                isElem1 (boolean): *True* if **id1** is element id, *False* if it is node id
 +                isElem2 (boolean): *True* if **id2** is element id, *False* if it is node id
 +
 +        Returns:
 +                :class:`SMESH.Measure` structure or None if input data is invalid
 +        See also: 
 +                :meth:`MinDistance`
 +        """
 +
          if isinstance(src1, Mesh): src1 = src1.mesh
          if isinstance(src2, Mesh): src2 = src2.mesh
          if src2 is None and id2 != 0: src2 = src1
          result = aMeasurements.MinDistance(src1, src2)
          return result
  
 -    ## Get bounding box of the specified object(s)
 -    #  @param objects single source object or list of source objects
 -    #  @return tuple of six values (minX, minY, minZ, maxX, maxY, maxZ)
 -    #  @sa GetBoundingBox()
 -    #  @ingroup l1_measurements
      def BoundingBox(self, objects):
 +        """
 +        Get bounding box of the specified object(s)
 +
 +        Parameters:
 +                objects (SMESH.SMESH_IDSource): single source object or list of source objects
 +
 +        Returns:
 +                tuple of six values (minX, minY, minZ, maxX, maxY, maxZ)
 +
 +        See also: 
 +               :meth:`GetBoundingBox`
 +        """
 +
          result = self.GetBoundingBox(objects)
          if result is None:
              result = (0.0,)*6
              result = (result.minX, result.minY, result.minZ, result.maxX, result.maxY, result.maxZ)
          return result
  
 -    ## Get measure structure specifying bounding box data of the specified object(s)
 -    #  @param objects single source object or list of source objects
 -    #  @return Measure structure
 -    #  @sa BoundingBox()
 -    #  @ingroup l1_measurements
      def GetBoundingBox(self, objects):
 +        """
 +        Get :class:`SMESH.Measure` structure specifying bounding box data of the specified object(s)
 +
 +        Parameters:
 +                objects (SMESH.SMESH_IDSource): single source object or list of source objects
 +
 +        Returns:
 +                :class:`SMESH.Measure` structure
 +
 +        See also: 
 +                :meth:`BoundingBox`
 +        """
 +
          if isinstance(objects, tuple):
              objects = list(objects)
          if not isinstance(objects, list):
          aMeasurements.UnRegister()
          return result
  
 -    ## Get sum of lengths of all 1D elements in the mesh object.
 -    #  @param obj mesh, submesh or group
 -    #  @return sum of lengths of all 1D elements
 -    #  @ingroup l1_measurements
      def GetLength(self, obj):
 +        """
 +        Get sum of lengths of all 1D elements in the mesh object.
 +
 +        Parameters:
 +                obj: :class:`mesh, sub-mesh, group or filter <SMESH.SMESH_IDSource>`
 +
 +        Returns:
 +                sum of lengths of all 1D elements
 +        """
 +
          if isinstance(obj, Mesh): obj = obj.mesh
          if isinstance(obj, Mesh_Algorithm): obj = obj.GetSubMesh()
          aMeasurements = self.CreateMeasurements()
          aMeasurements.UnRegister()
          return value
  
 -    ## Get sum of areas of all 2D elements in the mesh object.
 -    #  @param obj mesh, submesh or group
 -    #  @return sum of areas of all 2D elements
 -    #  @ingroup l1_measurements
      def GetArea(self, obj):
 +        """
 +        Get sum of areas of all 2D elements in the mesh object.
 +
 +        Parameters:
 +                obj: :class:`mesh, sub-mesh, group or filter <SMESH.SMESH_IDSource>`
 +
 +        Returns:
 +                sum of areas of all 2D elements
 +        """
 +
          if isinstance(obj, Mesh): obj = obj.mesh
          if isinstance(obj, Mesh_Algorithm): obj = obj.GetSubMesh()
          aMeasurements = self.CreateMeasurements()
          aMeasurements.UnRegister()
          return value
  
 -    ## Get sum of volumes of all 3D elements in the mesh object.
 -    #  @param obj mesh, submesh or group
 -    #  @return sum of volumes of all 3D elements
 -    #  @ingroup l1_measurements
      def GetVolume(self, obj):
 +        """
 +        Get sum of volumes of all 3D elements in the mesh object.
 +
 +        Parameters:
 +                obj: :class:`mesh, sub-mesh, group or filter <SMESH.SMESH_IDSource>`
 +
 +        Returns:
 +                sum of volumes of all 3D elements
 +        """
 +
          if isinstance(obj, Mesh): obj = obj.mesh
          if isinstance(obj, Mesh_Algorithm): obj = obj.GetSubMesh()
          aMeasurements = self.CreateMeasurements()
          aMeasurements.UnRegister()
          return value
  
 -    ## Get gravity center of all nodes of the mesh object.
 -    #  @param obj mesh, submesh or group
 -    #  @return three components of the gravity center: x,y,z
 -    #  @ingroup l1_measurements
      def GetGravityCenter(self, obj):
 +        """
 +        Get gravity center of all nodes of the mesh object.
 +        
 +        Parameters:            
 +                obj: :class:`mesh, sub-mesh, group or filter <SMESH.SMESH_IDSource>`
 +
 +        Returns:        
 +            Three components of the gravity center (x,y,z)
 +        """
          if isinstance(obj, Mesh): obj = obj.mesh
          if isinstance(obj, Mesh_Algorithm): obj = obj.GetSubMesh()
          aMeasurements = self.CreateMeasurements()
      pass # end of class smeshBuilder
  
  import omniORB
 -#Registering the new proxy for SMESH_Gen
  omniORB.registerObjref(SMESH._objref_SMESH_Gen._NP_RepositoryId, smeshBuilder)
 +"""Registering the new proxy for SMESH.SMESH_Gen"""
  
 -## Create a new smeshBuilder instance.The smeshBuilder class provides the Python
 -#  interface to create or load meshes.
 -#
 -#  Typical use is:
 -#  \code
 -#    import salome
 -#    salome.salome_init()
 -#    from salome.smesh import smeshBuilder
 -#    smesh = smeshBuilder.New()
 -#  \endcode
 -#  @param  isPublished If False, the notebool will not be used.
 -#  @param  instance  CORBA proxy of SMESH Engine. If None, the default Engine is used.
 -#  @return smeshBuilder instance
 -
 -def New( isPublished = True, instance=None):
 +
- def New( study, instance=None, instanceGeom=None):
++def New( instance=None, instanceGeom=None):
      """
 -    Create a new smeshBuilder instance.The smeshBuilder class provides the Python
 +    Create a new smeshBuilder instance. The smeshBuilder class provides the Python
      interface to create or load meshes.
  
-     Typical use is::
+     Typical use is:
 +
          import salome
          salome.salome_init()
          from salome.smesh import smeshBuilder
-         smesh = smeshBuilder.New(salome.myStudy)
+         smesh = smeshBuilder.New()
  
      Parameters:
-         study:         SALOME study, generally obtained by salome.myStudy.
-         instance:      CORBA proxy of SMESH Engine. If None, the default Engine is used.
-         instanceGeom:  CORBA proxy of GEOM  Engine. If None, the default Engine is used.
+         isPublished If False, the notebool will not be used.
+         instance  CORBA proxy of SMESH Engine. If None, the default Engine is used.
      Returns:
 -        smeshBuilder instance
 +        :class:`smeshBuilder` instance
      """
      global engine
      global smeshInst
      global doLcc
      engine = instance
      if engine is None:
-       doLcc = True
+         doLcc = True
      smeshInst = smeshBuilder()
      assert isinstance(smeshInst,smeshBuilder), "Smesh engine class is %s but should be smeshBuilder.smeshBuilder. Import salome.smesh.smeshBuilder before creating the instance."%smeshInst.__class__
-     smeshInst.init_smesh(study, instanceGeom)
 -    smeshInst.init_smesh(isPublished)
++    smeshInst.init_smesh(instanceGeom)
      return smeshInst
  
  
  # Public class: Mesh
  # ==================
  
- class Mesh:
 -## This class allows defining and managing a mesh.
 -#  It has a set of methods to build a mesh on the given geometry, including the definition of sub-meshes.
 -#  It also has methods to define groups of mesh elements, to modify a mesh (by addition of
 -#  new nodes and elements and by changing the existing entities), to get information
 -#  about a mesh and to export a mesh in different formats.
 -class Mesh(metaclass=MeshMeta):
++
++class Mesh(metaclass = MeshMeta):
 +    """
 +    This class allows defining and managing a mesh.
 +    It has a set of methods to build a mesh on the given geometry, including the definition of sub-meshes.
 +    It also has methods to define groups of mesh elements, to modify a mesh (by addition of
 +    new nodes and elements and by changing the existing entities), to get information
 +    about a mesh and to export a mesh in different formats.
-     """
-     __metaclass__ = MeshMeta
++    """    
 +
      geom = 0
      mesh = 0
      editor = 0
  
 -    ## Constructor
 -    #
 -    #  Create a mesh on the shape \a obj (or an empty mesh if \a obj is equal to 0) and
 -    #  sets the GUI name of this mesh to \a name.
 -    #  @param smeshpyD an instance of smeshBuilder class
 -    #  @param geompyD an instance of geomBuilder class
 -    #  @param obj Shape to be meshed or SMESH_Mesh object
 -    #  @param name Study name of the mesh
 -    #  @ingroup l2_construct
      def __init__(self, smeshpyD, geompyD, obj=0, name=0):
-         self.smeshpyD=smeshpyD
-         self.geompyD=geompyD
++
 +        """
 +        Constructor
 +
 +        Create a mesh on the shape *obj* (or an empty mesh if *obj* is equal to 0) and
 +        sets the GUI name of this mesh to *name*.
 +
 +        Parameters:
 +                smeshpyD: an instance of smeshBuilder class
 +                geompyD: an instance of geomBuilder class
 +                obj: Shape to be meshed or :class:`SMESH.SMESH_Mesh` object
 +                name: Study name of the mesh
 +        """
 +
+         self.smeshpyD = smeshpyD
+         self.geompyD = geompyD
          if obj is None:
              obj = 0
          objHasName = False
                  self.geom = obj
                  objHasName = True
                  # publish geom of mesh (issue 0021122)
-                 if not self.geom.GetStudyEntry() and smeshpyD.GetCurrentStudy():
+                 if not self.geom.GetStudyEntry():
                      objHasName = False
-                     studyID = smeshpyD.GetCurrentStudy()._get_StudyId()
-                     if studyID != geompyD.myStudyId:
-                         geompyD.init_geom( smeshpyD.GetCurrentStudy())
-                         pass
+                     geompyD.init_geom()
                      if name:
                          geo_name = name + " shape"
                      else:
              self.geom = self.mesh.GetShapeToMesh()
  
          self.editor   = self.mesh.GetMeshEditor()
 -        self.functors = [None] * EnumToLong(SMESH.FT_Undefined)
 +        self.functors = [None] * SMESH.FT_Undefined._v
  
          # set self to algoCreator's
          for attrName in dir(self):
              pass
          pass
  
 -    ## Destructor. Clean-up resources
      def __del__(self):
 +        """
 +        Destructor. Clean-up resources
 +        """
          if self.mesh:
              #self.mesh.UnRegister()
              pass
          pass
  
 -    ## Initialize the Mesh object from an instance of SMESH_Mesh interface
 -    #  @param theMesh a SMESH_Mesh object
 -    #  @ingroup l2_construct
      def SetMesh(self, theMesh):
 +        """
 +        Initialize the Mesh object from an instance of :class:`SMESH.SMESH_Mesh` interface
 +
 +        Parameters:
 +                theMesh: a :class:`SMESH.SMESH_Mesh` object
 +        """
 +
 +
          # do not call Register() as this prevents mesh servant deletion at closing study
          #if self.mesh: self.mesh.UnRegister()
          self.mesh = theMesh
              self.geom = self.mesh.GetShapeToMesh()
          pass
  
 -    ## Return the mesh, that is an instance of SMESH_Mesh interface
 -    #  @return a SMESH_Mesh object
 -    #  @ingroup l2_construct
      def GetMesh(self):
 +        """
 +        Return the mesh, that is an encapsulated instance of :class:`SMESH.SMESH_Mesh` interface
 +
 +        Returns:
 +                a :class:`SMESH.SMESH_Mesh` object
 +        """
 +
          return self.mesh
  
 -    ## Get the name of the mesh
 -    #  @return the name of the mesh as a string
 -    #  @ingroup l2_construct
      def GetName(self):
 +        """
 +        Get the name of the mesh
 +
 +        Returns:
 +                the name of the mesh as a string
 +        """
 +
          name = GetName(self.GetMesh())
          return name
  
 -    ## Set a name to the mesh
 -    #  @param name a new name of the mesh
 -    #  @ingroup l2_construct
      def SetName(self, name):
 +        """
 +        Set a name to the mesh
 +
 +        Parameters:
 +                name: a new name of the mesh
 +        """
 +
          self.smeshpyD.SetName(self.GetMesh(), name)
  
 -    ## Get a sub-mesh object associated to a \a geom geometrical object.
 -    #  @param geom a geometrical object (shape)
 -    #  @param name a name for the sub-mesh in the Object Browser
 -    #  @return an object of type SMESH.SMESH_subMesh, representing a part of mesh,
 -    #          which lies on the given shape
 -    #
 -    #  The sub-mesh object gives access to the IDs of nodes and elements.
 -    #  The sub-mesh object has the following methods:
 -    #  - SMESH.SMESH_subMesh.GetNumberOfElements()
 -    #  - SMESH.SMESH_subMesh.GetNumberOfNodes( all )
 -    #  - SMESH.SMESH_subMesh.GetElementsId()
 -    #  - SMESH.SMESH_subMesh.GetElementsByType( ElementType )
 -    #  - SMESH.SMESH_subMesh.GetNodesId()
 -    #  - SMESH.SMESH_subMesh.GetSubShape()
 -    #  - SMESH.SMESH_subMesh.GetFather()
 -    #  - SMESH.SMESH_subMesh.GetId()
 -    #  @note A sub-mesh is implicitly created when a sub-shape is specified at
 -    #  creating an algorithm, for example: <code>algo1D = mesh.Segment(geom=Edge_1) </code>
 -    #  creates a sub-mesh on @c Edge_1 and assign Wire Discretization algorithm to it.
 -    #  The created sub-mesh can be retrieved from the algorithm:
 -    #  <code>submesh = algo1D.GetSubMesh()</code>
 -    #  @ingroup l2_submeshes
      def GetSubMesh(self, geom, name):
 +        """
 +        Get a sub-mesh object associated to a *geom* geometrical object.
 +
 +        Parameters:
 +                geom: a geometrical object (shape)
 +                name: a name for the sub-mesh in the Object Browser
 +
 +        Returns:
 +                an object of type :class:`SMESH.SMESH_subMesh`, representing a part of mesh,
 +                which lies on the given shape
 +
 +        Note:
 +                A sub-mesh is implicitly created when a sub-shape is specified at
 +                creating an algorithm, for example::
 +
 +                   algo1D = mesh.Segment(geom=Edge_1)
 +
 +                creates a sub-mesh on *Edge_1* and assign Wire Discretization algorithm to it.
 +                The created sub-mesh can be retrieved from the algorithm::
 +
 +                   submesh = algo1D.GetSubMesh()
 +        """
 +
          AssureGeomPublished( self, geom, name )
          submesh = self.mesh.GetSubMesh( geom, name )
          return submesh
  
 -    ## Return the shape associated to the mesh
 -    #  @return a GEOM_Object
 -    #  @ingroup l2_construct
      def GetShape(self):
 +        """
 +        Return the shape associated to the mesh
 +
 +        Returns:
 +                a GEOM_Object
 +        """
 +
          return self.geom
  
 -    ## Associate the given shape to the mesh (entails the recreation of the mesh)
 -    #  @param geom the shape to be meshed (GEOM_Object)
 -    #  @ingroup l2_construct
      def SetShape(self, geom):
 +        """
 +        Associate the given shape to the mesh (entails the recreation of the mesh)
 +
 +        Parameters:
 +                geom: the shape to be meshed (GEOM_Object)
 +        """
 +
          self.mesh = self.smeshpyD.CreateMesh(geom)
  
 -    ## Load mesh from the study after opening the study
      def Load(self):
 +        """
 +        Load mesh from the study after opening the study
 +        """
          self.mesh.Load()
  
 -    ## Return true if the hypotheses are defined well
 -    #  @param theSubObject a sub-shape of a mesh shape
 -    #  @return True or False
 -    #  @ingroup l2_construct
      def IsReadyToCompute(self, theSubObject):
 +        """
 +        Return true if the hypotheses are defined well
 +
 +        Parameters:
 +                theSubObject: a sub-shape of a mesh shape
 +
 +        Returns:
 +                True or False
 +        """
 +
          return self.smeshpyD.IsReadyToCompute(self.mesh, theSubObject)
  
 -    ## Return errors of hypotheses definition.
 -    #  The list of errors is empty if everything is OK.
 -    #  @param theSubObject a sub-shape of a mesh shape
 -    #  @return a list of errors
 -    #  @ingroup l2_construct
      def GetAlgoState(self, theSubObject):
 +        """
 +        Return errors of hypotheses definition.
 +        The list of errors is empty if everything is OK.
 +
 +        Parameters:
 +                theSubObject: a sub-shape of a mesh shape
 +
 +        Returns:
 +                a list of errors
 +        """
 +
          return self.smeshpyD.GetAlgoState(self.mesh, theSubObject)
  
 -    ## Return a geometrical object on which the given element was built.
 -    #  The returned geometrical object, if not nil, is either found in the
 -    #  study or published by this method with the given name
 -    #  @param theElementID the id of the mesh element
 -    #  @param theGeomName the user-defined name of the geometrical object
 -    #  @return GEOM::GEOM_Object instance
 -    #  @ingroup l1_meshinfo
      def GetGeometryByMeshElement(self, theElementID, theGeomName):
 +        """
 +        Return a geometrical object on which the given element was built.
 +        The returned geometrical object, if not nil, is either found in the
 +        study or published by this method with the given name
 +
 +        Parameters:
 +            theElementID: the id of the mesh element
 +            theGeomName: the user-defined name of the geometrical object
 +
 +        Returns:
 +            GEOM.GEOM_Object instance
 +        """
 +
          return self.smeshpyD.GetGeometryByMeshElement( self.mesh, theElementID, theGeomName )
  
 -    ## Return the mesh dimension depending on the dimension of the underlying shape
 -    #  or, if the mesh is not based on any shape, basing on deimension of elements
 -    #  @return mesh dimension as an integer value [0,3]
 -    #  @ingroup l1_meshinfo
      def MeshDimension(self):
 +        """
 +        Return the mesh dimension depending on the dimension of the underlying shape
 +        or, if the mesh is not based on any shape, basing on deimension of elements
 +
 +        Returns:
 +                mesh dimension as an integer value [0,3]
 +        """
 +
          if self.mesh.HasShapeToMesh():
              shells = self.geompyD.SubShapeAllIDs( self.geom, self.geompyD.ShapeType["SOLID"] )
              if len( shells ) > 0 :
              if self.NbEdges()   > 0: return 1
          return 0
  
 -    ## Evaluate size of prospective mesh on a shape
 -    #  @return a list where i-th element is a number of elements of i-th SMESH.EntityType
 -    #  To know predicted number of e.g. edges, inquire it this way
 -    #  Evaluate()[ EnumToLong( Entity_Edge )]
 -    #  @ingroup l2_construct
      def Evaluate(self, geom=0):
 +        """
 +        Evaluate size of prospective mesh on a shape
 +
 +        Returns:
 +                a list where i-th element is a number of elements of i-th :class:`SMESH.EntityType`.
 +                To know predicted number of e.g. edges, inquire it this way::
 +
 +                   Evaluate()[ smesh.EnumToLong( SMESH.Entity_Edge )]
 +        """
 +
          if geom == 0 or not isinstance(geom, geomBuilder.GEOM._objref_GEOM_Object):
              if self.geom == 0:
                  geom = self.mesh.GetShapeToMesh()
          return self.smeshpyD.Evaluate(self.mesh, geom)
  
  
 -    ## Compute the mesh and return the status of the computation
 -    #  @param geom geomtrical shape on which mesh data should be computed
 -    #  @param discardModifs if True and the mesh has been edited since
 -    #         a last total re-compute and that may prevent successful partial re-compute,
 -    #         then the mesh is cleaned before Compute()
 -    #  @param refresh if @c True, Object browser is automatically updated (when running in GUI)
 -    #  @return True or False
 -    #  @ingroup l2_construct
      def Compute(self, geom=0, discardModifs=False, refresh=False):
 +        """
 +        Compute the mesh and return the status of the computation
 +
 +        Parameters:
 +                geom: geomtrical shape on which mesh data should be computed
 +                discardModifs: if True and the mesh has been edited since
 +                        a last total re-compute and that may prevent successful partial re-compute,
 +                        then the mesh is cleaned before Compute()
 +                refresh: if *True*, Object Browser is automatically updated (when running in GUI)
 +
 +        Returns:
 +                True or False
 +        """
 +
          if geom == 0 or not isinstance(geom, geomBuilder.GEOM._objref_GEOM_Object):
              if self.geom == 0:
                  geom = self.mesh.GetShapeToMesh()
              if discardModifs and self.mesh.HasModificationsToDiscard(): # issue 0020693
                  self.mesh.Clear()
              ok = self.smeshpyD.Compute(self.mesh, geom)
-         except SALOME.SALOME_Exception, ex:
-             print "Mesh computation failed, exception caught:"
-             print "    ", ex.details.text
+         except SALOME.SALOME_Exception as ex:
+             print("Mesh computation failed, exception caught:")
+             print("    ", ex.details.text)
          except:
              import traceback
-             print "Mesh computation failed, exception caught:"
+             print("Mesh computation failed, exception caught:")
              traceback.print_exc()
          if True:#not ok:
              allReasons = ""
                  else:  msg += " has not been computed"
                  if allReasons != "": msg += ":"
                  else:                msg += "."
-                 print msg
-                 print allReasons
+                 print(msg)
+                 print(allReasons)
              pass
-         if salome.sg.hasDesktop() and self.mesh.GetStudyId() >= 0:
+         if salome.sg.hasDesktop():
              if not isinstance( refresh, list): # not a call from subMesh.Compute()
                  smeshgui = salome.ImportComponentGUI("SMESH")
-                 smeshgui.Init(self.mesh.GetStudyId())
+                 smeshgui.Init()
                  smeshgui.SetMeshIcon( salome.ObjectToID( self.mesh ), ok, (self.NbNodes()==0) )
-                 if refresh: salome.sg.updateObjBrowser(True)
+                 if refresh: salome.sg.updateObjBrowser()
  
          return ok
  
 -    ## Return a list of error messages (SMESH.ComputeError) of the last Compute()
 -    #  @ingroup l2_construct
      def GetComputeErrors(self, shape=0 ):
 +        """
 +        Return a list of error messages (:class:`SMESH.ComputeError`) of the last :meth:`Compute`
 +        """
 +
          if shape == 0:
              shape = self.mesh.GetShapeToMesh()
          return self.smeshpyD.GetComputeErrors( self.mesh, shape )
  
 -    ## Return a name of a sub-shape by its ID
 -    #  @param subShapeID a unique ID of a sub-shape
 -    #  @return a string describing the sub-shape; possible variants:
 -    #  - "Face_12"    (published sub-shape)
 -    #  - FACE #3      (not published sub-shape)
 -    #  - sub-shape #3 (invalid sub-shape ID)
 -    #  - #3           (error in this function)
 -    #  @ingroup l1_auxiliary
      def GetSubShapeName(self, subShapeID ):
 +        """
 +        Return a name of a sub-shape by its ID.
 +        Possible variants (for *subShapeID* == 3):
 +
 +                - **"Face_12"** - published sub-shape
 +                - **FACE #3** - not published sub-shape
 +                - **sub-shape #3** - invalid sub-shape ID
 +                - **#3** - error in this function
 +
 +        Parameters:
 +                subShapeID: a unique ID of a sub-shape
 +
 +        Returns:
 +                a string describing the sub-shape
 +
 +        """
 +
          if not self.mesh.HasShapeToMesh():
              return ""
          try:
              shapeText = ""
              mainIOR  = salome.orb.object_to_string( self.GetShape() )
-             for sname in salome.myStudyManager.GetOpenStudies():
-                 s = salome.myStudyManager.GetStudyByName(sname)
-                 if not s: continue
-                 mainSO = s.FindObjectIOR(mainIOR)
-                 if not mainSO: continue
+             s = salome.myStudy
+             mainSO = s.FindObjectIOR(mainIOR)
+             if mainSO:
                  if subShapeID == 1:
                      shapeText = '"%s"' % mainSO.GetName()
                  subIt = s.NewChildIterator(mainSO)
                          continue
                      if ids == subShapeID:
                          shapeText = '"%s"' % subSO.GetName()
-                         break
              if not shapeText:
                  shape = self.geompyD.GetSubShape( self.GetShape(), [subShapeID])
                  if shape:
              shapeText = "#%s" % (subShapeID)
          return shapeText
  
 -    ## Return a list of sub-shapes meshing of which failed, grouped into GEOM groups by
 -    #  error of an algorithm
 -    #  @param publish if @c True, the returned groups will be published in the study
 -    #  @return a list of GEOM groups each named after a failed algorithm
 -    #  @ingroup l2_construct
      def GetFailedShapes(self, publish=False):
 +        """
 +        Return a list of sub-shapes meshing of which failed, grouped into GEOM groups by
 +        error of an algorithm
 +
 +        Parameters:
 +                publish: if *True*, the returned groups will be published in the study
 +
 +        Returns:
 +                a list of GEOM groups each named after a failed algorithm
 +        """
 +
  
          algo2shapes = {}
          computeErrors = self.smeshpyD.GetComputeErrors( self.mesh, self.GetShape() )
              pass
  
          groups = []
-         for algoName, shapes in algo2shapes.items():
+         for algoName, shapes in list(algo2shapes.items()):
              while shapes:
 -                groupType = EnumToLong( shapes[0].GetShapeType() )
 +                groupType = self.smeshpyD.EnumToLong( shapes[0].GetShapeType() )
                  otherTypeShapes = []
                  sameTypeShapes  = []
                  group = self.geompyD.CreateGroup( self.geom, groupType )
                  self.geompyD.addToStudyInFather( self.geom, group, group.GetName() )
          return groups
  
 -    ## Return sub-mesh objects list in meshing order
 -    #  @return list of lists of sub-meshes
 -    #  @ingroup l2_construct
      def GetMeshOrder(self):
 +        """
 +        Return sub-mesh objects list in meshing order
 +
 +        Returns:
 +                list of lists of :class:`sub-meshes <SMESH.SMESH_subMesh>`
 +        """
 +
          return self.mesh.GetMeshOrder()
  
 -    ## Set order in which concurrent sub-meshes should be meshed
 -    #  @param submeshes list of lists of sub-meshes
 -    #  @ingroup l2_construct
      def SetMeshOrder(self, submeshes):
 +        """
 +        Set order in which concurrent sub-meshes should be meshed
 +
 +        Parameters:
 +                submeshes: list of lists of :class:`sub-meshes <SMESH.SMESH_subMesh>`
 +        """
 +
          return self.mesh.SetMeshOrder(submeshes)
  
 -    ## Remove all nodes and elements generated on geometry. Imported elements remain.
 -    #  @param refresh if @c True, Object browser is automatically updated (when running in GUI)
 -    #  @ingroup l2_construct
      def Clear(self, refresh=False):
 +        """
 +        Remove all nodes and elements generated on geometry. Imported elements remain.
 +
 +        Parameters:
 +                refresh: if *True*, Object browser is automatically updated (when running in GUI)
 +        """
 +
          self.mesh.Clear()
-         if ( salome.sg.hasDesktop() and
-              salome.myStudyManager.GetStudyByID( self.mesh.GetStudyId() ) ):
+         if ( salome.sg.hasDesktop() ):
              smeshgui = salome.ImportComponentGUI("SMESH")
-             smeshgui.Init(self.mesh.GetStudyId())
+             smeshgui.Init()
              smeshgui.SetMeshIcon( salome.ObjectToID( self.mesh ), False, True )
-             if refresh: salome.sg.updateObjBrowser(True)
+             if refresh: salome.sg.updateObjBrowser()
  
 -    ## Remove all nodes and elements of indicated shape
 -    #  @param refresh if @c True, Object browser is automatically updated (when running in GUI)
 -    #  @param geomId the ID of a sub-shape to remove elements on
 -    #  @ingroup l2_submeshes
      def ClearSubMesh(self, geomId, refresh=False):
 +        """
 +        Remove all nodes and elements of indicated shape
 +
 +        Parameters:
 +                geomId: the ID of a sub-shape to remove elements on
 +                refresh: if *True*, Object browser is automatically updated (when running in GUI)
 +        """
 +
          self.mesh.ClearSubMesh(geomId)
          if salome.sg.hasDesktop():
              smeshgui = salome.ImportComponentGUI("SMESH")
-             smeshgui.Init(self.mesh.GetStudyId())
+             smeshgui.Init()
              smeshgui.SetMeshIcon( salome.ObjectToID( self.mesh ), False, True )
-             if refresh: salome.sg.updateObjBrowser(True)
+             if refresh: salome.sg.updateObjBrowser()
  
 -    ## Compute a tetrahedral mesh using AutomaticLength + MEFISTO + Tetrahedron
 -    #  @param fineness [0.0,1.0] defines mesh fineness
 -    #  @return True or False
 -    #  @ingroup l3_algos_basic
      def AutomaticTetrahedralization(self, fineness=0):
 +        """
 +        Compute a tetrahedral mesh using AutomaticLength + MEFISTO + Tetrahedron
 +
 +        Parameters:
 +                fineness: [0.0,1.0] defines mesh fineness
 +
 +        Returns:
 +                True or False
 +        """
 +
          dim = self.MeshDimension()
          # assign hypotheses
          self.RemoveGlobalHypotheses()
              pass
          return self.Compute()
  
 -    ## Compute an hexahedral mesh using AutomaticLength + Quadrangle + Hexahedron
 -    #  @param fineness [0.0, 1.0] defines mesh fineness
 -    #  @return True or False
 -    #  @ingroup l3_algos_basic
      def AutomaticHexahedralization(self, fineness=0):
 +        """
 +        Compute an hexahedral mesh using AutomaticLength + Quadrangle + Hexahedron
 +
 +        Parameters:
 +                fineness: [0.0, 1.0] defines mesh fineness
 +
 +        Returns:
 +                True or False
 +        """
 +
          dim = self.MeshDimension()
          # assign the hypotheses
          self.RemoveGlobalHypotheses()
              pass
          return self.Compute()
  
 -    ## Assign a hypothesis
 -    #  @param hyp a hypothesis to assign
 -    #  @param geom a subhape of mesh geometry
 -    #  @return SMESH.Hypothesis_Status
 -    #  @ingroup l2_editing
      def AddHypothesis(self, hyp, geom=0):
 +        """
 +        Assign a hypothesis
 +
 +        Parameters:
 +                hyp: a hypothesis to assign
 +                geom: a subhape of mesh geometry
 +
 +        Returns:
 +                :class:`SMESH.Hypothesis_Status`
 +        """
 +
          if isinstance( hyp, geomBuilder.GEOM._objref_GEOM_Object ):
              hyp, geom = geom, hyp
          if isinstance( hyp, Mesh_Algorithm ):
              AssureGeomPublished( self, geom, "shape for %s" % hyp.GetName())
              status = self.mesh.AddHypothesis(geom, hyp)
          else:
-             status = HYP_BAD_GEOMETRY,""
+             status = HYP_BAD_GEOMETRY, ""
          hyp_name = GetName( hyp )
          geom_name = ""
          if geom:
          TreatHypoStatus( status, hyp_name, geom_name, isAlgo, self )
          return status
  
 -    ## Return True if an algorithm of hypothesis is assigned to a given shape
 -    #  @param hyp a hypothesis to check
 -    #  @param geom a subhape of mesh geometry
 -    #  @return True of False
 -    #  @ingroup l2_editing
      def IsUsedHypothesis(self, hyp, geom):
 +        """
 +        Return True if an algorithm or hypothesis is assigned to a given shape
 +
 +        Parameters:
 +                hyp: an algorithm or hypothesis to check
 +                geom: a subhape of mesh geometry
 +
 +        Returns:
 +                True of False
 +        """
 +
          if not hyp: # or not geom
              return False
          if isinstance( hyp, Mesh_Algorithm ):
                  return True
          return False
  
 -    ## Unassign a hypothesis
 -    #  @param hyp a hypothesis to unassign
 -    #  @param geom a sub-shape of mesh geometry
 -    #  @return SMESH.Hypothesis_Status
 -    #  @ingroup l2_editing
      def RemoveHypothesis(self, hyp, geom=0):
 +        """
 +        Unassign a hypothesis
 +
 +        Parameters:
 +                hyp (SMESH.SMESH_Hypothesis): a hypothesis to unassign
 +                geom (GEOM.GEOM_Object): a sub-shape of mesh geometry
 +
 +        Returns:
 +                :class:`SMESH.Hypothesis_Status`
 +        """
 +
          if not hyp:
              return None
          if isinstance( hyp, Mesh_Algorithm ):
              return self.mesh.RemoveHypothesis( shape, hyp )
          hypName = GetName( hyp )
          geoName = GetName( shape )
-         print "WARNING: RemoveHypothesis() failed as '%s' is not assigned to '%s' shape" % ( hypName, geoName )
+         print("WARNING: RemoveHypothesis() failed as '%s' is not assigned to '%s' shape" % ( hypName, geoName ))
          return None
  
 -    ## Get the list of hypotheses added on a geometry
 -    #  @param geom a sub-shape of mesh geometry
 -    #  @return the sequence of SMESH_Hypothesis
 -    #  @ingroup l2_editing
      def GetHypothesisList(self, geom):
 +        """
 +        Get the list of hypotheses added on a geometry
 +
 +        Parameters:
 +                geom (GEOM.GEOM_Object): a sub-shape of mesh geometry
 +
 +        Returns:
 +                the sequence of :class:`SMESH.SMESH_Hypothesis`
 +        """
 +
          return self.mesh.GetHypothesisList( geom )
  
 -    ## Remove all global hypotheses
 -    #  @ingroup l2_editing
      def RemoveGlobalHypotheses(self):
 +        """
 +        Remove all global hypotheses
 +        """
 +
          current_hyps = self.mesh.GetHypothesisList( self.geom )
          for hyp in current_hyps:
              self.mesh.RemoveHypothesis( self.geom, hyp )
              pass
          pass
--
-     def ExportMED(self, f, auto_groups=0, version=MED_V2_2,
-                   overwrite=1, meshPart=None, autoDimension=True, fields=[], geomAssocFields=''):
 -    ## Export the mesh in a file in MED format
 -    ## allowing to overwrite the file if it exists or add the exported data to its contents
 -    #  @param fileName is the file name
 -    #  @param auto_groups boolean parameter for creating/not creating
 -    #  the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
 -    #  the typical use is auto_groups=False.
 -    #  @param overwrite boolean parameter for overwriting/not overwriting the file
 -    #  @param meshPart a part of mesh (group, sub-mesh) to export instead of the mesh
 -    #  @param autoDimension if @c True (default), a space dimension of a MED mesh can be either
 -    #         - 1D if all mesh nodes lie on OX coordinate axis, or
 -    #         - 2D if all mesh nodes lie on XOY coordinate plane, or
 -    #         - 3D in the rest cases.<br>
 -    #         If @a autoDimension is @c False, the space dimension is always 3.
 -    #  @param fields list of GEOM fields defined on the shape to mesh.
 -    #  @param geomAssocFields each character of this string means a need to export a
 -    #         corresponding field; correspondence between fields and characters is following:
 -    #         - 'v' stands for "_vertices _" field;
 -    #         - 'e' stands for "_edges _" field;
 -    #         - 'f' stands for "_faces _" field;
 -    #         - 's' stands for "_solids _" field.
 -    #  @ingroup l2_impexp
+     def ExportMED(self, *args, **kwargs):
 +        """
 +        Export the mesh in a file in MED format
 +        allowing to overwrite the file if it exists or add the exported data to its contents
 +
 +        Parameters:
-                 f: is the file name
-                 auto_groups: boolean parameter for creating/not creating
-                         the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
-                         the typical use is auto_groups=False.
-                 version: MED format version (MED_V2_1 or MED_V2_2,
-                         the latter meaning any current version). The parameter is
-                         obsolete since MED_V2_1 is no longer supported.
-                 overwrite: boolean parameter for overwriting/not overwriting the file
-                 meshPart: a part of mesh (:class:`sub-mesh, group or filter <SMESH.SMESH_IDSource>`) to export instead of the mesh
-                 autoDimension: if *True* (default), a space dimension of a MED mesh can be either
-                         - 1D if all mesh nodes lie on OX coordinate axis, or
-                         - 2D if all mesh nodes lie on XOY coordinate plane, or
-                         - 3D in the rest cases.
++                fileName: is the file name
++                auto_groups (boolean): parameter for creating/not creating
++                       the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
++                       the typical use is auto_groups=False.
++                overwrite (boolean): parameter for overwriting/not overwriting the file
++                meshPart: a part of mesh (group, sub-mesh) to export instead of the mesh
++                autoDimension if @c True (default), a space dimension of a MED mesh can be either
++                       - 1D if all mesh nodes lie on OX coordinate axis, or
++                       - 2D if all mesh nodes lie on XOY coordinate plane, or
++                       - 3D in the rest cases.
 +                        If *autoDimension* is *False*, the space dimension is always 3.
 +                fields: list of GEOM fields defined on the shape to mesh.
 +                geomAssocFields: each character of this string means a need to export a 
 +                        corresponding field; correspondence between fields and characters is following:
 +                        - 'v' stands for "_vertices _" field;
 +                        - 'e' stands for "_edges _" field;
 +                        - 'f' stands for "_faces _" field;
 +                        - 's' stands for "_solids _" field.
 +        """
+         # process positional arguments
+         args = [i for i in args if i not in [SMESH.MED_V2_1, SMESH.MED_V2_2]] # backward compatibility
+         fileName        = args[0]
+         auto_groups     = args[1] if len(args) > 1 else False
+         overwrite       = args[2] if len(args) > 2 else True
+         meshPart        = args[3] if len(args) > 3 else None
+         autoDimension   = args[4] if len(args) > 4 else True
+         fields          = args[5] if len(args) > 5 else []
+         geomAssocFields = args[6] if len(args) > 6 else ''
+         # process keywords arguments
+         auto_groups     = kwargs.get("auto_groups", auto_groups)
+         overwrite       = kwargs.get("overwrite", overwrite)
+         meshPart        = kwargs.get("meshPart", meshPart)
+         autoDimension   = kwargs.get("autoDimension", autoDimension)
+         fields          = kwargs.get("fields", fields)
+         geomAssocFields = kwargs.get("geomAssocFields", geomAssocFields)
+         # invoke engine's function
          if meshPart or fields or geomAssocFields:
              unRegister = genObjUnRegister()
              if isinstance( meshPart, list ):
                  meshPart = self.GetIDSource( meshPart, SMESH.ALL )
                  unRegister.set( meshPart )
-             self.mesh.ExportPartToMED( meshPart, f, auto_groups, version, overwrite, autoDimension,
+             self.mesh.ExportPartToMED( meshPart, fileName, auto_groups, overwrite, autoDimension,
                                         fields, geomAssocFields)
          else:
-             self.mesh.ExportToMEDX(f, auto_groups, version, overwrite, autoDimension)
+             self.mesh.ExportMED(fileName, auto_groups, overwrite, autoDimension)
  
 -    ## Export the mesh in a file in SAUV format
 -    #  @param f is the file name
 -    #  @param auto_groups boolean parameter for creating/not creating
 -    #  the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
 -    #  the typical use is auto_groups=false.
 -    #  @ingroup l2_impexp
      def ExportSAUV(self, f, auto_groups=0):
 +        """
 +        Export the mesh in a file in SAUV format
 +
 +
 +        Parameters:
 +                f: is the file name
 +                auto_groups: boolean parameter for creating/not creating
 +                        the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
 +                        the typical use is auto_groups=False.
 +        """
 +
          self.mesh.ExportSAUV(f, auto_groups)
  
 -    ## Export the mesh in a file in DAT format
 -    #  @param f the file name
 -    #  @param meshPart a part of mesh (group, sub-mesh) to export instead of the mesh
 -    #  @ingroup l2_impexp
      def ExportDAT(self, f, meshPart=None):
 +        """
 +        Export the mesh in a file in DAT format
 +
 +        Parameters:
 +                f: the file name
 +                meshPart: a part of mesh (:class:`sub-mesh, group or filter <SMESH.SMESH_IDSource>`) to export instead of the mesh
 +        """
 +
          if meshPart:
              unRegister = genObjUnRegister()
              if isinstance( meshPart, list ):
          else:
              self.mesh.ExportDAT(f)
  
 -    ## Export the mesh in a file in UNV format
 -    #  @param f the file name
 -    #  @param meshPart a part of mesh (group, sub-mesh) to export instead of the mesh
 -    #  @ingroup l2_impexp
      def ExportUNV(self, f, meshPart=None):
 +        """
 +        Export the mesh in a file in UNV format
 +
 +        Parameters:
 +                f: the file name
 +                meshPart: a part of mesh (:class:`sub-mesh, group or filter <SMESH.SMESH_IDSource>`) to export instead of the mesh
 +        """
 +
          if meshPart:
              unRegister = genObjUnRegister()
              if isinstance( meshPart, list ):
          else:
              self.mesh.ExportUNV(f)
  
 -    ## Export the mesh in a file in STL format
 -    #  @param f the file name
 -    #  @param ascii defines the file encoding
 -    #  @param meshPart a part of mesh (group, sub-mesh) to export instead of the mesh
 -    #  @ingroup l2_impexp
      def ExportSTL(self, f, ascii=1, meshPart=None):
 +        """
 +        Export the mesh in a file in STL format
 +
 +        Parameters:
 +                f: the file name
 +                ascii: defines the file encoding
 +                meshPart: a part of mesh (:class:`sub-mesh, group or filter <SMESH.SMESH_IDSource>`) to export instead of the mesh
 +        """
 +
          if meshPart:
              unRegister = genObjUnRegister()
              if isinstance( meshPart, list ):
          else:
              self.mesh.ExportSTL(f, ascii)
  
 -    ## Export the mesh in a file in CGNS format
 -    #  @param f is the file name
 -    #  @param overwrite boolean parameter for overwriting/not overwriting the file
 -    #  @param meshPart a part of mesh (group, sub-mesh) to export instead of the mesh
 -    #  @param groupElemsByType if true all elements of same entity type are exported at ones,
 -    #         else elements are exported in order of their IDs which can cause creation
 -    #         of multiple cgns sections
 -    #  @ingroup l2_impexp
      def ExportCGNS(self, f, overwrite=1, meshPart=None, groupElemsByType=False):
 +        """
 +        Export the mesh in a file in CGNS format
 +
 +        Parameters:
 +                f: is the file name
 +                overwrite: boolean parameter for overwriting/not overwriting the file
 +                meshPart: a part of mesh (:class:`sub-mesh, group or filter <SMESH.SMESH_IDSource>`) to export instead of the mesh
 +                groupElemsByType: if True all elements of same entity type are exported at ones,
 +                        else elements are exported in order of their IDs which can cause creation
 +                        of multiple cgns sections
 +        """
 +
          unRegister = genObjUnRegister()
          if isinstance( meshPart, list ):
              meshPart = self.GetIDSource( meshPart, SMESH.ALL )
              meshPart = self.mesh
          self.mesh.ExportCGNS(meshPart, f, overwrite, groupElemsByType)
  
 -    ## Export the mesh in a file in GMF format.
 -    #  GMF files must have .mesh extension for the ASCII format and .meshb for
 -    #  the bynary format. Other extensions are not allowed.
 -    #  @param f is the file name
 -    #  @param meshPart a part of mesh (group, sub-mesh) to export instead of the mesh
 -    #  @ingroup l2_impexp
      def ExportGMF(self, f, meshPart=None):
 +        """
 +        Export the mesh in a file in GMF format.
 +        GMF files must have .mesh extension for the ASCII format and .meshb for
 +        the bynary format. Other extensions are not allowed.
 +
 +        Parameters:
 +                f: is the file name
 +                meshPart: a part of mesh (:class:`sub-mesh, group or filter <SMESH.SMESH_IDSource>`) to export instead of the mesh
 +        """
 +
          unRegister = genObjUnRegister()
          if isinstance( meshPart, list ):
              meshPart = self.GetIDSource( meshPart, SMESH.ALL )
              meshPart = self.mesh
          self.mesh.ExportGMF(meshPart, f, True)
  
-     def ExportToMED(self, f, version=MED_V2_2, opt=0, overwrite=1, autoDimension=True):
 -    ## Deprecated, used only for compatibility! Please, use ExportMED() method instead.
 -    #  Export the mesh in a file in MED format
 -    #  allowing to overwrite the file if it exists or add the exported data to its contents
 -    #  @param fileName the file name
 -    #  @param opt boolean parameter for creating/not creating
 -    #         the groups Group_On_All_Nodes, Group_On_All_Faces, ...
 -    #  @param overwrite boolean parameter for overwriting/not overwriting the file
 -    #  @param autoDimension if @c True (default), a space dimension of a MED mesh can be either
 -    #         - 1D if all mesh nodes lie on OX coordinate axis, or
 -    #         - 2D if all mesh nodes lie on XOY coordinate plane, or
 -    #         - 3D in the rest cases.<br>
 -    #         If @a autoDimension is @c False, the space dimension is always 3.
 -    #  @ingroup l2_impexp
+     def ExportToMED(self, *args, **kwargs):
 +        """
 +        Deprecated, used only for compatibility! Please, use :meth:`ExportMED` method instead.
 +        Export the mesh in a file in MED format
 +        allowing to overwrite the file if it exists or add the exported data to its contents
 +
 +        Parameters:
-                 f: the file name
-                 version: MED format version (MED_V2_1 or MED_V2_2,
-                         the latter meaning any current version). The parameter is
-                         obsolete since MED_V2_1 is no longer supported.
-                 opt: boolean parameter for creating/not creating
++                fileName: the file name
++                opt (boolean): parameter for creating/not creating
 +                        the groups Group_On_All_Nodes, Group_On_All_Faces, ...
 +                overwrite: boolean parameter for overwriting/not overwriting the file
 +                autoDimension: if *True* (default), a space dimension of a MED mesh can be either
 +
 +                        - 1D if all mesh nodes lie on OX coordinate axis, or
 +                        - 2D if all mesh nodes lie on XOY coordinate plane, or
 +                        - 3D in the rest cases.
 +
 +                        If **autoDimension** is *False*, the space dimension is always 3.
 +        """
++    
+         print("WARNING: ExportToMED() is deprecated, use ExportMED() instead")
+         # process positional arguments
+         args = [i for i in args if i not in [SMESH.MED_V2_1, SMESH.MED_V2_2]] # backward compatibility
+         fileName      = args[0]
+         auto_groups   = args[1] if len(args) > 1 else False
+         overwrite     = args[2] if len(args) > 2 else True
+         autoDimension = args[3] if len(args) > 3 else True
+         # process keywords arguments
+         auto_groups   = kwargs.get("opt", auto_groups)         # old keyword name
+         auto_groups   = kwargs.get("auto_groups", auto_groups) # new keyword name
+         overwrite     = kwargs.get("overwrite", overwrite)
+         autoDimension = kwargs.get("autoDimension", autoDimension)
+         # invoke engine's function
+         self.mesh.ExportMED(fileName, auto_groups, overwrite, autoDimension)
 -    ## Deprecated, used only for compatibility! Please, use ExportMED() method instead.
 -    #  Export the mesh in a file in MED format
 -    #  allowing to overwrite the file if it exists or add the exported data to its contents
 -    #  @param fileName the file name
 -    #  @param opt boolean parameter for creating/not creating
 -    #         the groups Group_On_All_Nodes, Group_On_All_Faces, ...
 -    #  @param overwrite boolean parameter for overwriting/not overwriting the file
 -    #  @param autoDimension if @c True (default), a space dimension of a MED mesh can be either
 -    #         - 1D if all mesh nodes lie on OX coordinate axis, or
 -    #         - 2D if all mesh nodes lie on XOY coordinate plane, or
 -    #         - 3D in the rest cases.<br>
 -    #         If @a autoDimension is @c False, the space dimension is always 3.
 -    #  @ingroup l2_impexp
+     def ExportToMEDX(self, *args, **kwargs):
++        """
++        Deprecated, used only for compatibility! Please, use ExportMED() method instead.
++        Export the mesh in a file in MED format
++
++        Parameters:
++                fileName: the file name
++                opt (boolean): parameter for creating/not creating
++                        the groups Group_On_All_Nodes, Group_On_All_Faces, ...
++                overwrite: boolean parameter for overwriting/not overwriting the file
++                autoDimension: if *True* (default), a space dimension of a MED mesh can be either
 +
-         self.mesh.ExportToMEDX(f, opt, version, overwrite, autoDimension)
++                        - 1D if all mesh nodes lie on OX coordinate axis, or
++                        - 2D if all mesh nodes lie on XOY coordinate plane, or
++                        - 3D in the rest cases.
++
++                        If **autoDimension** is *False*, the space dimension is always 3.
++              """
++
+         print("WARNING: ExportToMEDX() is deprecated, use ExportMED() instead")
+         # process positional arguments
+         args = [i for i in args if i not in [SMESH.MED_V2_1, SMESH.MED_V2_2]] # backward compatibility
+         fileName      = args[0]
+         auto_groups   = args[1] if len(args) > 1 else False
+         overwrite     = args[2] if len(args) > 2 else True
+         autoDimension = args[3] if len(args) > 3 else True
+         # process keywords arguments
+         auto_groups   = kwargs.get("auto_groups", auto_groups)
+         overwrite     = kwargs.get("overwrite", overwrite)
+         autoDimension = kwargs.get("autoDimension", autoDimension)
+         # invoke engine's function
+         self.mesh.ExportMED(fileName, auto_groups, overwrite, autoDimension)
  
      # Operations with groups:
      # ----------------------
--
 -    ## Create an empty mesh group
 -    #  @param elementType the type of elements in the group; either of
 -    #         (SMESH.NODE, SMESH.EDGE, SMESH.FACE, SMESH.VOLUME)
 -    #  @param name the name of the mesh group
 -    #  @return SMESH_Group
 -    #  @ingroup l2_grps_create
      def CreateEmptyGroup(self, elementType, name):
 +        """
 +        Create an empty mesh group
 +
 +        Parameters:
 +                elementType: the :class:`type <SMESH.ElementType>` of elements in the group; 
 +                        either of (SMESH.NODE, SMESH.EDGE, SMESH.FACE, SMESH.VOLUME)
 +                name: the name of the mesh group
 +
 +        Returns:
 +                :class:`SMESH.SMESH_Group`
 +        """
 +
          return self.mesh.CreateGroup(elementType, name)
  
 -    ## Create a mesh group based on the geometric object \a grp
 -    #  and gives a \a name, \n if this parameter is not defined
 -    #  the name is the same as the geometric group name \n
 -    #  Note: Works like GroupOnGeom().
 -    #  @param grp  a geometric group, a vertex, an edge, a face or a solid
 -    #  @param name the name of the mesh group
 -    #  @return SMESH_GroupOnGeom
 -    #  @ingroup l2_grps_create
      def Group(self, grp, name=""):
 +        """
 +        Create a mesh group based on the geometric object *grp*
 +        and give it a *name*.
 +        If *name* is not defined the name of the geometric group is used
 +
 +        Note:
 +                Works like :meth:`GroupOnGeom`.
 +
 +        Parameters:
 +                grp:  a geometric group, a vertex, an edge, a face or a solid
 +                name: the name of the mesh group
 +
 +        Returns:
 +                :class:`SMESH.SMESH_GroupOnGeom`
 +        """
 +
          return self.GroupOnGeom(grp, name)
  
 -    ## Create a mesh group based on the geometrical object \a grp
 -    #  and gives a \a name, \n if this parameter is not defined
 -    #  the name is the same as the geometrical group name
 -    #  @param grp  a geometrical group, a vertex, an edge, a face or a solid
 -    #  @param name the name of the mesh group
 -    #  @param typ  the type of elements in the group; either of
 -    #         (SMESH.NODE, SMESH.EDGE, SMESH.FACE, SMESH.VOLUME). If not set, it is
 -    #         automatically detected by the type of the geometry
 -    #  @return SMESH_GroupOnGeom
 -    #  @ingroup l2_grps_create
      def GroupOnGeom(self, grp, name="", typ=None):
 +        """
 +        Create a mesh group based on the geometrical object *grp*
 +        and gives a *name*.
 +        if *name* is not defined the name of the geometric group is used
 +
 +        Parameters:
 +                grp:  a geometrical group, a vertex, an edge, a face or a solid
 +                name: the name of the mesh group
 +                typ:  the type of elements in the group; either of
 +                        (SMESH.NODE, SMESH.EDGE, SMESH.FACE, SMESH.VOLUME). If not set, it is
 +                        automatically detected by the type of the geometry
 +
 +        Returns:
 +                :class:`SMESH.SMESH_GroupOnGeom`
 +        """
 +
          AssureGeomPublished( self, grp, name )
          if name == "":
              name = grp.GetName()
              typ = self._groupTypeFromShape( grp )
          return self.mesh.CreateGroupFromGEOM(typ, name, grp)
  
 -    ## Pivate method to get a type of group on geometry
      def _groupTypeFromShape( self, shape ):
 +        """
 +        Pivate method to get a type of group on geometry
 +        """
          tgeo = str(shape.GetShapeType())
          if tgeo == "VERTEX":
              typ = NODE
          elif tgeo == "COMPOUND":
              sub = self.geompyD.SubShapeAll( shape, self.geompyD.ShapeType["SHAPE"])
              if not sub:
-                 raise ValueError,"_groupTypeFromShape(): empty geometric group or compound '%s'" % GetName(shape)
+                 raise ValueError("_groupTypeFromShape(): empty geometric group or compound '%s'" % GetName(shape))
              return self._groupTypeFromShape( sub[0] )
          else:
-             raise ValueError, \
-                   "_groupTypeFromShape(): invalid geometry '%s'" % GetName(shape)
+             raise ValueError("_groupTypeFromShape(): invalid geometry '%s'" % GetName(shape))
          return typ
  
 -    ## Create a mesh group with given \a name based on the \a filter which
 -    ## is a special type of group dynamically updating it's contents during
 -    ## mesh modification
 -    #  @param typ  the type of elements in the group; either of
 -    #         (SMESH.NODE, SMESH.EDGE, SMESH.FACE, SMESH.VOLUME).
 -    #  @param name the name of the mesh group
 -    #  @param filter the filter defining group contents
 -    #  @return SMESH_GroupOnFilter
 -    #  @ingroup l2_grps_create
      def GroupOnFilter(self, typ, name, filter):
 +        """
 +        Create a mesh group with given *name* based on the *filter* which
 +        is a special type of group dynamically updating it's contents during
 +        mesh modification
 +
 +        Parameters:
 +                typ: the type of elements in the group; either of
 +                        (SMESH.NODE, SMESH.EDGE, SMESH.FACE, SMESH.VOLUME).
 +                name: the name of the mesh group
 +                filter (SMESH.Filter): the filter defining group contents
 +
 +        Returns:
 +                :class:`SMESH.SMESH_GroupOnFilter`
 +        """
 +
          return self.mesh.CreateGroupFromFilter(typ, name, filter)
  
 -    ## Create a mesh group by the given ids of elements
 -    #  @param groupName the name of the mesh group
 -    #  @param elementType the type of elements in the group; either of
 -    #         (SMESH.NODE, SMESH.EDGE, SMESH.FACE, SMESH.VOLUME).
 -    #  @param elemIDs either the list of ids, group, sub-mesh, or filter
 -    #  @return SMESH_Group
 -    #  @ingroup l2_grps_create
      def MakeGroupByIds(self, groupName, elementType, elemIDs):
 +        """
 +        Create a mesh group by the given ids of elements
 +
 +        Parameters:
 +                groupName: the name of the mesh group
 +                elementType: the type of elements in the group; either of
 +                        (SMESH.NODE, SMESH.EDGE, SMESH.FACE, SMESH.VOLUME).
 +                elemIDs: either the list of ids, :class:`mesh, sub-mesh, group or filter <SMESH.SMESH_IDSource>`
 +
 +        Returns:
 +                :class:`SMESH.SMESH_Group`
 +        """
 +
          group = self.mesh.CreateGroup(elementType, groupName)
          if isinstance( elemIDs, Mesh ):
              elemIDs = elemIDs.GetMesh()
              group.Add(elemIDs)
          return group
  
 -    ## Create a mesh group by the given conditions
 -    #  @param groupName the name of the mesh group
 -    #  @param elementType the type of elements(SMESH.NODE, SMESH.EDGE, SMESH.FACE, SMESH.VOLUME)
 -    #  @param CritType the type of criterion (SMESH.FT_Taper, SMESH.FT_Area, etc.)
 -    #          Type SMESH.FunctorType._items in the Python Console to see all values.
 -    #          Note that the items starting from FT_LessThan are not suitable for CritType.
 -    #  @param Compare  belongs to {SMESH.FT_LessThan, SMESH.FT_MoreThan, SMESH.FT_EqualTo}
 -    #  @param Threshold the threshold value (range of ids as string, shape, numeric)
 -    #  @param UnaryOp  SMESH.FT_LogicalNOT or SMESH.FT_Undefined
 -    #  @param Tolerance the tolerance used by SMESH.FT_BelongToGeom, SMESH.FT_BelongToSurface,
 -    #         SMESH.FT_LyingOnGeom, SMESH.FT_CoplanarFaces criteria
 -    #  @return SMESH_GroupOnFilter
 -    #  @ingroup l2_grps_create
      def MakeGroup(self,
                    groupName,
                    elementType,
                    Threshold="",
                    UnaryOp=FT_Undefined,
                    Tolerance=1e-07):
 +        """
 +        Create a mesh group by the given conditions
 +
 +        Parameters:
 +                groupName: the name of the mesh group
 +                elementType (SMESH.ElementType): the type of elements (SMESH.NODE, SMESH.EDGE, SMESH.FACE, SMESH.VOLUME)
 +                CritType (SMESH.FunctorType): the type of criterion (SMESH.FT_Taper, SMESH.FT_Area, etc.).
 +                        Note that the items starting from FT_LessThan are not suitable for CritType.
 +                Compare (SMESH.FunctorType): belongs to {SMESH.FT_LessThan, SMESH.FT_MoreThan, SMESH.FT_EqualTo}
 +                Threshold: the threshold value (range of ids as string, shape, numeric, depending on *CritType*)
 +                UnaryOp (SMESH.FunctorType):  SMESH.FT_LogicalNOT or SMESH.FT_Undefined
 +                Tolerance (float): the tolerance used by SMESH.FT_BelongToGeom, SMESH.FT_BelongToSurface,
 +                        SMESH.FT_LyingOnGeom, SMESH.FT_CoplanarFaces criteria
 +
 +        Returns:
 +                :class:`SMESH.SMESH_GroupOnFilter`
 +        """
 +
          aCriterion = self.smeshpyD.GetCriterion(elementType, CritType, Compare, Threshold, UnaryOp, FT_Undefined,Tolerance)
          group = self.MakeGroupByCriterion(groupName, aCriterion)
          return group
  
 -    ## Create a mesh group by the given criterion
 -    #  @param groupName the name of the mesh group
 -    #  @param Criterion the instance of Criterion class
 -    #  @return SMESH_GroupOnFilter
 -    #  @ingroup l2_grps_create
      def MakeGroupByCriterion(self, groupName, Criterion):
 +        """
 +        Create a mesh group by the given criterion
 +
 +        Parameters:
 +                groupName: the name of the mesh group
 +                Criterion: the instance of :class:`SMESH.Filter.Criterion` class
 +
 +        Returns:
 +                :class:`SMESH.SMESH_GroupOnFilter`
 +
 +        See Also:
 +                :meth:`smeshBuilder.GetCriterion`
 +        """
 +
          return self.MakeGroupByCriteria( groupName, [Criterion] )
  
 -    ## Create a mesh group by the given criteria (list of criteria)
 -    #  @param groupName the name of the mesh group
 -    #  @param theCriteria the list of criteria
 -    #  @param binOp binary operator used when binary operator of criteria is undefined
 -    #  @return SMESH_GroupOnFilter
 -    #  @ingroup l2_grps_create
      def MakeGroupByCriteria(self, groupName, theCriteria, binOp=SMESH.FT_LogicalAND):
 +        """
 +        Create a mesh group by the given criteria (list of :class:`SMESH.Filter.Criterion`)
 +
 +        Parameters:
 +                groupName: the name of the mesh group
 +                theCriteria: the list of :class:`SMESH.Filter.Criterion`
 +                binOp: binary operator (SMESH.FT_LogicalAND or SMESH.FT_LogicalOR ) used when binary operator of criteria is undefined
 +
 +        Returns:
 +                :class:`SMESH.SMESH_GroupOnFilter`
 +
 +        See Also:
 +                :meth:`smeshBuilder.GetCriterion`
 +        """
 +
          aFilter = self.smeshpyD.GetFilterFromCriteria( theCriteria, binOp )
          group = self.MakeGroupByFilter(groupName, aFilter)
          return group
  
 -    ## Create a mesh group by the given filter
 -    #  @param groupName the name of the mesh group
 -    #  @param theFilter the instance of Filter class
 -    #  @return SMESH_GroupOnFilter
 -    #  @ingroup l2_grps_create
      def MakeGroupByFilter(self, groupName, theFilter):
 -        #group = self.CreateEmptyGroup(theFilter.GetElementType(), groupName)
 -        #theFilter.SetMesh( self.mesh )
 -        #group.AddFrom( theFilter )
 +        """
 +        Create a mesh group by the given filter
 +
 +        Parameters:
 +                groupName (string): the name of the mesh group
 +                theFilter (SMESH.Filter): the filter
 +
 +        Returns:
 +                :class:`SMESH.SMESH_GroupOnFilter`
 +
 +        See Also:
 +                :meth:`smeshBuilder.GetFilter`
 +        """
 +
 +        #group = self.CreateEmptyGroup(theFilter.GetElementType(), groupName)
 +        #theFilter.SetMesh( self.mesh )
 +        #group.AddFrom( theFilter )
          group = self.GroupOnFilter( theFilter.GetElementType(), groupName, theFilter )
          return group
  
 -    ## Remove a group
 -    #  @ingroup l2_grps_delete
      def RemoveGroup(self, group):
 +        """
 +        Remove a group
 +
 +        Parameters:
 +                group (SMESH.SMESH_GroupBase): group to remove
 +        """
 +
          self.mesh.RemoveGroup(group)
  
 -    ## Remove a group with its contents
 -    #  @ingroup l2_grps_delete
      def RemoveGroupWithContents(self, group):
 +        """
 +        Remove a group with its contents
 +
 +        Parameters:
 +                group (SMESH.SMESH_GroupBase): group to remove
 +        """
 +
          self.mesh.RemoveGroupWithContents(group)
  
 -    ## Get the list of groups existing in the mesh in the order
 -    #  of creation (starting from the oldest one)
 -    #  @param elemType type of elements the groups contain; either of
 -    #         (SMESH.ALL, SMESH.NODE, SMESH.EDGE, SMESH.FACE, SMESH.VOLUME);
 -    #         by default groups of elements of all types are returned
 -    #  @return a sequence of SMESH_GroupBase
 -    #  @ingroup l2_grps_create
      def GetGroups(self, elemType = SMESH.ALL):
 +        """
 +        Get the list of groups existing in the mesh in the order
 +        of creation (starting from the oldest one)
 +
 +        Parameters:
 +                elemType (SMESH.ElementType): type of elements the groups contain;
 +                        by default groups of elements of all types are returned
 +
 +        Returns:
 +                a sequence of :class:`SMESH.SMESH_GroupBase`
 +        """
 +
          groups = self.mesh.GetGroups()
          if elemType == SMESH.ALL:
              return groups
              pass
          return typedGroups
  
 -    ## Get the number of groups existing in the mesh
 -    #  @return the quantity of groups as an integer value
 -    #  @ingroup l2_grps_create
      def NbGroups(self):
 +        """
 +        Get the number of groups existing in the mesh
 +
 +        Returns:
 +                the quantity of groups as an integer value
 +        """
 +
          return self.mesh.NbGroups()
  
 -    ## Get the list of names of groups existing in the mesh
 -    #  @return list of strings
 -    #  @ingroup l2_grps_create
      def GetGroupNames(self):
 +        """
 +        Get the list of names of groups existing in the mesh
 +
 +        Returns:
 +                list of strings
 +        """
 +
          groups = self.GetGroups()
          names = []
          for group in groups:
              names.append(group.GetName())
          return names
  
 -    ## Find groups by name and type
 -    #  @param name name of the group of interest
 -    #  @param elemType type of elements the groups contain; either of
 -    #         (SMESH.ALL, SMESH.NODE, SMESH.EDGE, SMESH.FACE, SMESH.VOLUME);
 -    #         by default one group of any type of elements is returned
 -    #         if elemType == SMESH.ALL then all groups of any type are returned
 -    #  @return a list of SMESH_GroupBase's
 -    #  @ingroup l2_grps_create
      def GetGroupByName(self, name, elemType = None):
 +        """
 +        Find groups by name and type
 +
 +        Parameters:
 +                name (string): name of the group of interest
 +                elemType (SMESH.ElementType): type of elements the groups contain;
 +                        by default one group of any type is returned;
 +                        if elemType == SMESH.ALL then all groups of any type are returned
 +
 +        Returns:
 +                a list of :class:`SMESH.SMESH_GroupBase`
 +        """
 +
          groups = []
          for group in self.GetGroups():
              if group.GetName() == name:
                      groups.append( group )
          return groups
  
 -    ## Produce a union of two groups.
 -    #  A new group is created. All mesh elements that are
 -    #  present in the initial groups are added to the new one
 -    #  @return an instance of SMESH_Group
 -    #  @ingroup l2_grps_operon
      def UnionGroups(self, group1, group2, name):
 +        """
 +        Produce a union of two groups.
 +        A new group is created. All mesh elements that are
 +        present in the initial groups are added to the new one
 +
 +        Parameters:
 +           group1 (SMESH.SMESH_GroupBase): a group
 +           group2 (SMESH.SMESH_GroupBase): another group
 +
 +        Returns:
 +                instance of :class:`SMESH.SMESH_Group`
 +        """
 +
          return self.mesh.UnionGroups(group1, group2, name)
  
 -    ## Produce a union list of groups.
 -    #  New group is created. All mesh elements that are present in
 -    #  initial groups are added to the new one
 -    #  @return an instance of SMESH_Group
 -    #  @ingroup l2_grps_operon
      def UnionListOfGroups(self, groups, name):
 +        """
 +        Produce a union list of groups.
 +        New group is created. All mesh elements that are present in
 +        initial groups are added to the new one
 +
 +        Parameters:
 +           groups: list of :class:`SMESH.SMESH_GroupBase`
 +
 +        Returns:
 +                instance of :class:`SMESH.SMESH_Group`
 +        """
          return self.mesh.UnionListOfGroups(groups, name)
  
 -    ## Prodice an intersection of two groups.
 -    #  A new group is created. All mesh elements that are common
 -    #  for the two initial groups are added to the new one.
 -    #  @return an instance of SMESH_Group
 -    #  @ingroup l2_grps_operon
      def IntersectGroups(self, group1, group2, name):
 +        """
 +        Prodice an intersection of two groups.
 +        A new group is created. All mesh elements that are common
 +        for the two initial groups are added to the new one.
 +
 +        Parameters:
 +           group1 (SMESH.SMESH_GroupBase): a group
 +           group2 (SMESH.SMESH_GroupBase): another group
 +
 +        Returns:
 +                instance of :class:`SMESH.SMESH_Group`
 +        """
 +
          return self.mesh.IntersectGroups(group1, group2, name)
  
 -    ## Produce an intersection of groups.
 -    #  New group is created. All mesh elements that are present in all
 -    #  initial groups simultaneously are added to the new one
 -    #  @return an instance of SMESH_Group
 -    #  @ingroup l2_grps_operon
      def IntersectListOfGroups(self, groups, name):
 +        """
 +        Produce an intersection of groups.
 +        New group is created. All mesh elements that are present in all
 +        initial groups simultaneously are added to the new one
 +
 +        Parameters:
 +           groups: a list of :class:`SMESH.SMESH_GroupBase`
 +
 +        Returns:
 +                instance of :class:`SMESH.SMESH_Group`
 +        """
          return self.mesh.IntersectListOfGroups(groups, name)
  
 -    ## Produce a cut of two groups.
 -    #  A new group is created. All mesh elements that are present in
 -    #  the main group but are not present in the tool group are added to the new one
 -    #  @return an instance of SMESH_Group
 -    #  @ingroup l2_grps_operon
      def CutGroups(self, main_group, tool_group, name):
 +        """
 +        Produce a cut of two groups.
 +        A new group is created. All mesh elements that are present in
 +        the main group but are not present in the tool group are added to the new one
 +
 +        Parameters:
 +           main_group (SMESH.SMESH_GroupBase): a group to cut from
 +           tool_group (SMESH.SMESH_GroupBase): a group to cut by
 +
 +        Returns:
 +                an instance of :class:`SMESH.SMESH_Group`
 +        """
 +
          return self.mesh.CutGroups(main_group, tool_group, name)
  
 -    ## Produce a cut of groups.
 -    #  A new group is created. All mesh elements that are present in main groups
 -    #  but do not present in tool groups are added to the new one
 -    #  @return an instance of SMESH_Group
 -    #  @ingroup l2_grps_operon
      def CutListOfGroups(self, main_groups, tool_groups, name):
 +        """
 +        Produce a cut of groups.
 +        A new group is created. All mesh elements that are present in main groups
 +        but do not present in tool groups are added to the new one
 +
 +        Parameters:
 +           main_group: groups to cut from  (list of :class:`SMESH.SMESH_GroupBase`)
 +           tool_group: groups to cut by    (list of :class:`SMESH.SMESH_GroupBase`)
 +
 +        Returns:
 +                an instance of :class:`SMESH.SMESH_Group`
 +        """
 +
          return self.mesh.CutListOfGroups(main_groups, tool_groups, name)
  
 -    ##
 -    #  Create a standalone group of entities basing on nodes of other groups.
 -    #  \param groups - list of reference groups, sub-meshes or filters, of any type.
 -    #  \param elemType - a type of elements to include to the new group; either of
 -    #         (SMESH.NODE, SMESH.EDGE, SMESH.FACE, SMESH.VOLUME).
 -    #  \param name - a name of the new group.
 -    #  \param nbCommonNodes - a criterion of inclusion of an element to the new group
 -    #         basing on number of element nodes common with reference \a groups.
 -    #         Meaning of possible values are:
 -    #         - SMESH.ALL_NODES - include if all nodes are common,
 -    #         - SMESH.MAIN - include if all corner nodes are common (meaningful for a quadratic mesh),
 -    #         - SMESH.AT_LEAST_ONE - include if one or more node is common,
 -    #         - SMEHS.MAJORITY - include if half of nodes or more are common.
 -    #  \param underlyingOnly - if \c True (default), an element is included to the
 -    #         new group provided that it is based on nodes of an element of \a groups;
 -    #         in this case the reference \a groups are supposed to be of higher dimension
 -    #         than \a elemType, which can be useful for example to get all faces lying on
 -    #         volumes of the reference \a groups.
 -    #  @return an instance of SMESH_Group
 -    #  @ingroup l2_grps_operon
      def CreateDimGroup(self, groups, elemType, name,
                         nbCommonNodes = SMESH.ALL_NODES, underlyingOnly = True):
 +        """
 +        Create a standalone group of entities basing on nodes of other groups.
 +
 +        Parameters:
 +                groups: list of reference :class:`sub-meshes, groups or filters <SMESH.SMESH_IDSource>`, of any type.
 +                elemType: a type of elements to include to the new group; either of
 +                        (SMESH.NODE, SMESH.EDGE, SMESH.FACE, SMESH.VOLUME).
 +                name: a name of the new group.
 +                nbCommonNodes: a criterion of inclusion of an element to the new group
 +                        basing on number of element nodes common with reference *groups*.
 +                        Meaning of possible values are:
 +
 +                                - SMESH.ALL_NODES - include if all nodes are common,
 +                                - SMESH.MAIN - include if all corner nodes are common (meaningful for a quadratic mesh),
 +                                - SMESH.AT_LEAST_ONE - include if one or more node is common,
 +                                - SMEHS.MAJORITY - include if half of nodes or more are common.
 +                underlyingOnly: if *True* (default), an element is included to the
 +                        new group provided that it is based on nodes of an element of *groups*;
 +                        in this case the reference *groups* are supposed to be of higher dimension
 +                        than *elemType*, which can be useful for example to get all faces lying on
 +                        volumes of the reference *groups*.
 +
 +        Returns:
 +                an instance of :class:`SMESH.SMESH_Group`
 +        """
 +
          if isinstance( groups, SMESH._objref_SMESH_IDSource ):
              groups = [groups]
          return self.mesh.CreateDimGroup(groups, elemType, name, nbCommonNodes, underlyingOnly)
  
  
 -    ## Convert group on geom into standalone group
 -    #  @ingroup l2_grps_operon
      def ConvertToStandalone(self, group):
 +        """
 +        Convert group on geom into standalone group
 +        """
 +
          return self.mesh.ConvertToStandalone(group)
  
      # Get some info about mesh:
      # ------------------------
  
 -    ## Return the log of nodes and elements added or removed
 -    #  since the previous clear of the log.
 -    #  @param clearAfterGet log is emptied after Get (safe if concurrents access)
 -    #  @return list of log_block structures:
 -    #                                        commandType
 -    #                                        number
 -    #                                        coords
 -    #                                        indexes
 -    #  @ingroup l1_auxiliary
      def GetLog(self, clearAfterGet):
 +        """
 +        Return the log of nodes and elements added or removed
 +        since the previous clear of the log.
 +
 +        Parameters:
 +                clearAfterGet: log is emptied after Get (safe if concurrents access)
 +
 +        Returns:
 +                list of SMESH.log_block structures { commandType, number, coords, indexes }
 +        """
 +
          return self.mesh.GetLog(clearAfterGet)
  
 -    ## Clear the log of nodes and elements added or removed since the previous
 -    #  clear. Must be used immediately after GetLog if clearAfterGet is false.
 -    #  @ingroup l1_auxiliary
      def ClearLog(self):
 +        """
 +        Clear the log of nodes and elements added or removed since the previous
 +        clear. Must be used immediately after :meth:`GetLog` if clearAfterGet is false.
 +        """
 +
          self.mesh.ClearLog()
  
 -    ## Toggle auto color mode on the object.
 -    #  @param theAutoColor the flag which toggles auto color mode.
 -    #
 -    #  If switched on, a default color of a new group in Create Group dialog is chosen randomly.
 -    #  @ingroup l1_grouping
      def SetAutoColor(self, theAutoColor):
 +        """
 +        Toggle auto color mode on the object.
 +        If switched on, a default color of a new group in Create Group dialog is chosen randomly.
 +
 +        Parameters:
 +                theAutoColor (boolean): the flag which toggles auto color mode.
 +        """
 +
          self.mesh.SetAutoColor(theAutoColor)
  
 -    ## Get flag of object auto color mode.
 -    #  @return True or False
 -    #  @ingroup l1_grouping
      def GetAutoColor(self):
 +        """
 +        Get flag of object auto color mode.
 +
 +        Returns:
 +                True or False
 +        """
 +
          return self.mesh.GetAutoColor()
  
 -    ## Get the internal ID
 -    #  @return integer value, which is the internal Id of the mesh
 -    #  @ingroup l1_auxiliary
      def GetId(self):
 +        """
 +        Get the internal ID
 +
 +        Returns:
 +            integer value, which is the internal Id of the mesh
 +        """
 +
          return self.mesh.GetId()
  
-     def GetStudyId(self):
-         """
-         Get the study Id
-         Returns:
-             integer value, which is the study Id of the mesh
-         """
-         return self.mesh.GetStudyId()
 -    ## Check the group names for duplications.
 -    #  Consider the maximum group name length stored in MED file.
 -    #  @return True or False
 -    #  @ingroup l1_grouping
      def HasDuplicatedGroupNamesMED(self):
 +        """
 +        Check the group names for duplications.
 +        Consider the maximum group name length stored in MED file.
 +
 +        Returns:
 +            True or False
 +        """
 +
          return self.mesh.HasDuplicatedGroupNamesMED()
  
 -    ## Obtain the mesh editor tool
 -    #  @return an instance of SMESH_MeshEditor
 -    #  @ingroup l1_modifying
      def GetMeshEditor(self):
 +        """
 +        Obtain the mesh editor tool
 +
 +        Returns:
 +            an instance of :class:`SMESH.SMESH_MeshEditor`
 +        """
 +
          return self.editor
  
 -    ## Wrap a list of IDs of elements or nodes into SMESH_IDSource which
 -    #  can be passed as argument to a method accepting mesh, group or sub-mesh
 -    #  @param ids list of IDs
 -    #  @param elemType type of elements; this parameter is used to distinguish
 -    #         IDs of nodes from IDs of elements; by default ids are treated as
 -    #         IDs of elements; use SMESH.NODE if ids are IDs of nodes.
 -    #  @return an instance of SMESH_IDSource
 -    #  @warning call UnRegister() for the returned object as soon as it is no more useful:
 -    #          idSrc = mesh.GetIDSource( [1,3,5], SMESH.NODE )
 -    #          mesh.DoSomething( idSrc )
 -    #          idSrc.UnRegister()
 -    #  @ingroup l1_auxiliary
      def GetIDSource(self, ids, elemType = SMESH.ALL):
 +        """
 +        Wrap a list of IDs of elements or nodes into :class:`SMESH.SMESH_IDSource` which
 +        can be passed as argument to a method accepting :class:`mesh, sub-mesh, group or filter <SMESH.SMESH_IDSource>`
 +
 +        Parameters:
 +                ids: list of IDs
 +                elemType: type of elements; this parameter is used to distinguish
 +                        IDs of nodes from IDs of elements; by default ids are treated as
 +                        IDs of elements; use SMESH.NODE if ids are IDs of nodes.
 +
 +        Returns:
 +            an instance of :class:`SMESH.SMESH_IDSource`
 +
 +        Warning:
 +                call UnRegister() for the returned object as soon as it is no more useful::
 +
 +                        idSrc = mesh.GetIDSource( [1,3,5], SMESH.NODE )
 +                        mesh.DoSomething( idSrc )
 +                        idSrc.UnRegister()
 +        """
 +
          if isinstance( ids, int ):
              ids = [ids]
          return self.editor.MakeIDSource(ids, elemType)
      # Get information about mesh contents:
      # ------------------------------------
  
 -    ## Get the mesh statistic
 -    #  @return dictionary type element - count of elements
 -    #  @ingroup l1_meshinfo
      def GetMeshInfo(self, obj = None):
 +        """
 +        Get the mesh statistic.
 +        Use :meth:`smeshBuilder.EnumToLong` to get an integer from 
 +        an item of :class:`SMESH.EntityType`.
 +
 +        Returns:
 +                dictionary { :class:`SMESH.EntityType` - "count of elements" }
 +        """
 +
          if not obj: obj = self.mesh
          return self.smeshpyD.GetMeshInfo(obj)
  
 -    ## Return the number of nodes in the mesh
 -    #  @return an integer value
 -    #  @ingroup l1_meshinfo
      def NbNodes(self):
 +        """
 +        Return the number of nodes in the mesh
 +
 +        Returns:
 +            an integer value
 +        """
 +
          return self.mesh.NbNodes()
  
 -    ## Return the number of elements in the mesh
 -    #  @return an integer value
 -    #  @ingroup l1_meshinfo
      def NbElements(self):
 +        """
 +        Return the number of elements in the mesh
 +
 +        Returns:
 +            an integer value
 +        """
 +
          return self.mesh.NbElements()
  
 -    ## Return the number of 0d elements in the mesh
 -    #  @return an integer value
 -    #  @ingroup l1_meshinfo
      def Nb0DElements(self):
 +        """
 +        Return the number of 0d elements in the mesh
 +
 +        Returns:
 +            an integer value
 +        """
 +
          return self.mesh.Nb0DElements()
  
 -    ## Return the number of ball discrete elements in the mesh
 -    #  @return an integer value
 -    #  @ingroup l1_meshinfo
      def NbBalls(self):
 +        """
 +        Return the number of ball discrete elements in the mesh
 +
 +        Returns:
 +            an integer value
 +        """
 +
          return self.mesh.NbBalls()
  
 -    ## Return the number of edges in the mesh
 -    #  @return an integer value
 -    #  @ingroup l1_meshinfo
      def NbEdges(self):
 +        """
 +        Return the number of edges in the mesh
 +
 +        Returns:
 +            an integer value
 +        """
 +
          return self.mesh.NbEdges()
  
 -    ## Return the number of edges with the given order in the mesh
 -    #  @param elementOrder the order of elements:
 -    #         SMESH.ORDER_ANY, SMESH.ORDER_LINEAR or SMESH.ORDER_QUADRATIC
 -    #  @return an integer value
 -    #  @ingroup l1_meshinfo
      def NbEdgesOfOrder(self, elementOrder):
 +        """
 +        Return the number of edges with the given order in the mesh
 +
 +        Parameters:
 +                elementOrder: the order of elements
 +                     (SMESH.ORDER_ANY, SMESH.ORDER_LINEAR or SMESH.ORDER_QUADRATIC)
 +
 +        Returns:
 +            an integer value
 +        """
 +
          return self.mesh.NbEdgesOfOrder(elementOrder)
  
 -    ## Return the number of faces in the mesh
 -    #  @return an integer value
 -    #  @ingroup l1_meshinfo
      def NbFaces(self):
 +        """
 +        Return the number of faces in the mesh
 +
 +        Returns:
 +            an integer value
 +        """
 +
          return self.mesh.NbFaces()
  
 -    ## Return the number of faces with the given order in the mesh
 -    #  @param elementOrder the order of elements:
 -    #         SMESH.ORDER_ANY, SMESH.ORDER_LINEAR or SMESH.ORDER_QUADRATIC
 -    #  @return an integer value
 -    #  @ingroup l1_meshinfo
      def NbFacesOfOrder(self, elementOrder):
 +        """
 +        Return the number of faces with the given order in the mesh
 +
 +        Parameters:
 +                elementOrder: the order of elements
 +                        (SMESH.ORDER_ANY, SMESH.ORDER_LINEAR or SMESH.ORDER_QUADRATIC)
 +
 +        Returns:
 +            an integer value
 +        """
 +
          return self.mesh.NbFacesOfOrder(elementOrder)
  
 -    ## Return the number of triangles in the mesh
 -    #  @return an integer value
 -    #  @ingroup l1_meshinfo
      def NbTriangles(self):
 +        """
 +        Return the number of triangles in the mesh
 +
 +        Returns:
 +            an integer value
 +        """
 +
          return self.mesh.NbTriangles()
  
 -    ## Return the number of triangles with the given order in the mesh
 -    #  @param elementOrder is the order of elements:
 -    #         SMESH.ORDER_ANY, SMESH.ORDER_LINEAR or SMESH.ORDER_QUADRATIC
 -    #  @return an integer value
 -    #  @ingroup l1_meshinfo
      def NbTrianglesOfOrder(self, elementOrder):
 +        """
 +        Return the number of triangles with the given order in the mesh
 +
 +        Parameters:
 +                elementOrder: is the order of elements
 +                        (SMESH.ORDER_ANY, SMESH.ORDER_LINEAR or SMESH.ORDER_QUADRATIC)
 +
 +        Returns:
 +            an integer value
 +        """
 +
          return self.mesh.NbTrianglesOfOrder(elementOrder)
  
 -    ## Return the number of biquadratic triangles in the mesh
 -    #  @return an integer value
 -    #  @ingroup l1_meshinfo
      def NbBiQuadTriangles(self):
 +        """
 +        Return the number of biquadratic triangles in the mesh
 +
 +        Returns:
 +            an integer value
 +        """
 +
          return self.mesh.NbBiQuadTriangles()
  
 -    ## Return the number of quadrangles in the mesh
 -    #  @return an integer value
 -    #  @ingroup l1_meshinfo
      def NbQuadrangles(self):
 +        """
 +        Return the number of quadrangles in the mesh
 +
 +        Returns:
 +            an integer value
 +        """
 +
          return self.mesh.NbQuadrangles()
  
 -    ## Return the number of quadrangles with the given order in the mesh
 -    #  @param elementOrder the order of elements:
 -    #         SMESH.ORDER_ANY, SMESH.ORDER_LINEAR or SMESH.ORDER_QUADRATIC
 -    #  @return an integer value
 -    #  @ingroup l1_meshinfo
      def NbQuadranglesOfOrder(self, elementOrder):
 +        """
 +        Return the number of quadrangles with the given order in the mesh
 +
 +        Parameters:
 +                elementOrder: the order of elements
 +                        (SMESH.ORDER_ANY, SMESH.ORDER_LINEAR or SMESH.ORDER_QUADRATIC)
 +
 +        Returns:
 +            an integer value
 +        """
 +
          return self.mesh.NbQuadranglesOfOrder(elementOrder)
  
 -    ## Return the number of biquadratic quadrangles in the mesh
 -    #  @return an integer value
 -    #  @ingroup l1_meshinfo
      def NbBiQuadQuadrangles(self):
 +        """
 +        Return the number of biquadratic quadrangles in the mesh
 +
 +        Returns:
 +            an integer value
 +        """
 +
          return self.mesh.NbBiQuadQuadrangles()
  
 -    ## Return the number of polygons of given order in the mesh
 -    #  @param elementOrder the order of elements:
 -    #         SMESH.ORDER_ANY, SMESH.ORDER_LINEAR or SMESH.ORDER_QUADRATIC
 -    #  @return an integer value
 -    #  @ingroup l1_meshinfo
      def NbPolygons(self, elementOrder = SMESH.ORDER_ANY):
 +        """
 +        Return the number of polygons of given order in the mesh
 +
 +        Parameters:
 +                elementOrder: the order of elements
 +                        (SMESH.ORDER_ANY, SMESH.ORDER_LINEAR or SMESH.ORDER_QUADRATIC)
 +
 +        Returns:
 +            an integer value
 +        """
 +
          return self.mesh.NbPolygonsOfOrder(elementOrder)
  
 -    ## Return the number of volumes in the mesh
 -    #  @return an integer value
 -    #  @ingroup l1_meshinfo
      def NbVolumes(self):
 +        """
 +        Return the number of volumes in the mesh
 +
 +        Returns:
 +            an integer value
 +        """
 +
          return self.mesh.NbVolumes()
  
 -    ## Return the number of volumes with the given order in the mesh
 -    #  @param elementOrder  the order of elements:
 -    #         SMESH.ORDER_ANY, SMESH.ORDER_LINEAR or SMESH.ORDER_QUADRATIC
 -    #  @return an integer value
 -    #  @ingroup l1_meshinfo
 +
      def NbVolumesOfOrder(self, elementOrder):
 +        """
 +        Return the number of volumes with the given order in the mesh
 +
 +        Parameters:
 +                elementOrder:  the order of elements
 +                    (SMESH.ORDER_ANY, SMESH.ORDER_LINEAR or SMESH.ORDER_QUADRATIC)
 +
 +        Returns:
 +            an integer value
 +        """
 +
          return self.mesh.NbVolumesOfOrder(elementOrder)
  
 -    ## Return the number of tetrahedrons in the mesh
 -    #  @return an integer value
 -    #  @ingroup l1_meshinfo
      def NbTetras(self):
 +        """
 +        Return the number of tetrahedrons in the mesh
 +
 +        Returns:
 +            an integer value
 +        """
 +
          return self.mesh.NbTetras()
  
 -    ## Return the number of tetrahedrons with the given order in the mesh
 -    #  @param elementOrder  the order of elements:
 -    #         SMESH.ORDER_ANY, SMESH.ORDER_LINEAR or SMESH.ORDER_QUADRATIC
 -    #  @return an integer value
 -    #  @ingroup l1_meshinfo
      def NbTetrasOfOrder(self, elementOrder):
 +        """
 +        Return the number of tetrahedrons with the given order in the mesh
 +
 +        Parameters:
 +                elementOrder:  the order of elements
 +                        (SMESH.ORDER_ANY, SMESH.ORDER_LINEAR or SMESH.ORDER_QUADRATIC)
 +
 +        Returns:
 +            an integer value
 +        """
 +
          return self.mesh.NbTetrasOfOrder(elementOrder)
  
 -    ## Return the number of hexahedrons in the mesh
 -    #  @return an integer value
 -    #  @ingroup l1_meshinfo
      def NbHexas(self):
 +        """
 +        Return the number of hexahedrons in the mesh
 +
 +        Returns:
 +            an integer value
 +        """
 +
          return self.mesh.NbHexas()
  
 -    ## Return the number of hexahedrons with the given order in the mesh
 -    #  @param elementOrder  the order of elements:
 -    #         SMESH.ORDER_ANY, SMESH.ORDER_LINEAR or SMESH.ORDER_QUADRATIC
 -    #  @return an integer value
 -    #  @ingroup l1_meshinfo
      def NbHexasOfOrder(self, elementOrder):
 +        """
 +        Return the number of hexahedrons with the given order in the mesh
 +
 +        Parameters:
 +                elementOrder:  the order of elements
 +                        (SMESH.ORDER_ANY, SMESH.ORDER_LINEAR or SMESH.ORDER_QUADRATIC)
 +
 +        Returns:
 +            an integer value
 +        """
 +
          return self.mesh.NbHexasOfOrder(elementOrder)
  
 -    ## Return the number of triquadratic hexahedrons in the mesh
 -    #  @return an integer value
 -    #  @ingroup l1_meshinfo
      def NbTriQuadraticHexas(self):
 +        """
 +        Return the number of triquadratic hexahedrons in the mesh
 +
 +        Returns:
 +            an integer value
 +        """
 +
          return self.mesh.NbTriQuadraticHexas()
  
 -    ## Return the number of pyramids in the mesh
 -    #  @return an integer value
 -    #  @ingroup l1_meshinfo
      def NbPyramids(self):
 +        """
 +        Return the number of pyramids in the mesh
 +
 +        Returns:
 +            an integer value
 +        """
 +
          return self.mesh.NbPyramids()
  
 -    ## Return the number of pyramids with the given order in the mesh
 -    #  @param elementOrder  the order of elements:
 -    #         SMESH.ORDER_ANY, SMESH.ORDER_LINEAR or SMESH.ORDER_QUADRATIC
 -    #  @return an integer value
 -    #  @ingroup l1_meshinfo
      def NbPyramidsOfOrder(self, elementOrder):
 +        """
 +        Return the number of pyramids with the given order in the mesh
 +
 +        Parameters:
 +                elementOrder:  the order of elements
 +                        (SMESH.ORDER_ANY, SMESH.ORDER_LINEAR or SMESH.ORDER_QUADRATIC)
 +
 +        Returns:
 +            an integer value
 +        """
 +
          return self.mesh.NbPyramidsOfOrder(elementOrder)
  
 -    ## Return the number of prisms in the mesh
 -    #  @return an integer value
 -    #  @ingroup l1_meshinfo
      def NbPrisms(self):
 +        """
 +        Return the number of prisms in the mesh
 +
 +        Returns:
 +            an integer value
 +        """
 +
          return self.mesh.NbPrisms()
  
 -    ## Return the number of prisms with the given order in the mesh
 -    #  @param elementOrder  the order of elements:
 -    #         SMESH.ORDER_ANY, SMESH.ORDER_LINEAR or SMESH.ORDER_QUADRATIC
 -    #  @return an integer value
 -    #  @ingroup l1_meshinfo
      def NbPrismsOfOrder(self, elementOrder):
 +        """
 +        Return the number of prisms with the given order in the mesh
 +
 +        Parameters:
 +                elementOrder:  the order of elements
 +                        (SMESH.ORDER_ANY, SMESH.ORDER_LINEAR or SMESH.ORDER_QUADRATIC)
 +
 +        Returns:
 +            an integer value
 +        """
 +
          return self.mesh.NbPrismsOfOrder(elementOrder)
  
 -    ## Return the number of hexagonal prisms in the mesh
 -    #  @return an integer value
 -    #  @ingroup l1_meshinfo
      def NbHexagonalPrisms(self):
 +        """
 +        Return the number of hexagonal prisms in the mesh
 +
 +        Returns:
 +            an integer value
 +        """
 +
          return self.mesh.NbHexagonalPrisms()
  
 -    ## Return the number of polyhedrons in the mesh
 -    #  @return an integer value
 -    #  @ingroup l1_meshinfo
      def NbPolyhedrons(self):
 +        """
 +        Return the number of polyhedrons in the mesh
 +
 +        Returns:
 +            an integer value
 +        """
 +
          return self.mesh.NbPolyhedrons()
  
 -    ## Return the number of submeshes in the mesh
 -    #  @return an integer value
 -    #  @ingroup l1_meshinfo
      def NbSubMesh(self):
 +        """
 +        Return the number of submeshes in the mesh
 +
 +        Returns:
 +            an integer value
 +        """
 +
          return self.mesh.NbSubMesh()
  
 -    ## Return the list of mesh elements IDs
 -    #  @return the list of integer values
 -    #  @ingroup l1_meshinfo
      def GetElementsId(self):
 +        """
 +        Return the list of all mesh elements IDs
 +
 +        Returns:
 +            the list of integer values
 +
 +        See Also:
 +            :meth:`GetElementsByType`
 +        """
 +
          return self.mesh.GetElementsId()
  
 -    ## Return the list of IDs of mesh elements with the given type
 -    #  @param elementType  the required type of elements, either of
 -    #         (SMESH.NODE, SMESH.EDGE, SMESH.FACE or SMESH.VOLUME)
 -    #  @return list of integer values
 -    #  @ingroup l1_meshinfo
      def GetElementsByType(self, elementType):
 +        """
 +        Return the list of IDs of mesh elements with the given type
 +
 +        Parameters:
 +                elementType (SMESH.ElementType):  the required type of elements
 +
 +        Returns:
 +            list of integer values
 +        """
 +
          return self.mesh.GetElementsByType(elementType)
  
 -    ## Return the list of mesh nodes IDs
 -    #  @return the list of integer values
 -    #  @ingroup l1_meshinfo
      def GetNodesId(self):
 +        """
 +        Return the list of mesh nodes IDs
 +
 +        Returns:
 +            the list of integer values
 +        """
 +
          return self.mesh.GetNodesId()
  
      # Get the information about mesh elements:
      # ------------------------------------
  
 -    ## Return the type of mesh element
 -    #  @return the value from SMESH::ElementType enumeration
 -    #          Type SMESH.ElementType._items in the Python Console to see all possible values.
 -    #  @ingroup l1_meshinfo
      def GetElementType(self, id, iselem=True):
 +        """
 +        Return the type of mesh element or node
 +
 +        Returns:
 +            the value from :class:`SMESH.ElementType` enumeration. 
 +            Return SMESH.ALL if element or node with the given ID does not exist
 +        """
 +
          return self.mesh.GetElementType(id, iselem)
  
 -    ## Return the geometric type of mesh element
 -    #  @return the value from SMESH::EntityType enumeration
 -    #          Type SMESH.EntityType._items in the Python Console to see all possible values.
 -    #  @ingroup l1_meshinfo
      def GetElementGeomType(self, id):
 +        """
 +        Return the geometric type of mesh element
 +
 +        Returns:
 +            the value from :class:`SMESH.EntityType` enumeration.
 +        """
 +
          return self.mesh.GetElementGeomType(id)
  
 -    ## Return the shape type of mesh element
 -    #  @return the value from SMESH::GeometryType enumeration.
 -    #          Type SMESH.GeometryType._items in the Python Console to see all possible values.
 -    #  @ingroup l1_meshinfo
      def GetElementShape(self, id):
 +        """
 +        Return the shape type of mesh element
 +
 +        Returns:
 +            the value from :class:`SMESH.GeometryType` enumeration.
 +        """
 +
          return self.mesh.GetElementShape(id)
  
 -    ## Return the list of submesh elements IDs
 -    #  @param Shape a geom object(sub-shape)
 -    #         Shape must be the sub-shape of a ShapeToMesh()
 -    #  @return the list of integer values
 -    #  @ingroup l1_meshinfo
      def GetSubMeshElementsId(self, Shape):
 +        """
 +        Return the list of sub-mesh elements IDs
 +
 +        Parameters:
 +                Shape (GEOM.GEOM_Object): a geom object (sub-shape).
 +                       *Shape* must be the sub-shape of the :meth:`main shape <GetShape>`
 +
 +        Returns:
 +            list of integer values
 +        """
 +
          if isinstance( Shape, geomBuilder.GEOM._objref_GEOM_Object):
              ShapeID = self.geompyD.GetSubShapeID( self.geom, Shape )
          else:
              ShapeID = Shape
          return self.mesh.GetSubMeshElementsId(ShapeID)
  
 -    ## Return the list of submesh nodes IDs
 -    #  @param Shape a geom object(sub-shape)
 -    #         Shape must be the sub-shape of a ShapeToMesh()
 -    #  @param all If true, gives all nodes of submesh elements, otherwise gives only submesh nodes
 -    #  @return the list of integer values
 -    #  @ingroup l1_meshinfo
      def GetSubMeshNodesId(self, Shape, all):
 +        """
 +        Return the list of sub-mesh nodes IDs
 +
 +        Parameters:
 +                Shape: a geom object (sub-shape).
 +                       *Shape* must be the sub-shape of a :meth:`GetShape`
 +                all: If True, gives all nodes of sub-mesh elements, otherwise gives only sub-mesh nodes
 +
 +        Returns:
 +            list of integer values
 +        """
 +
          if isinstance( Shape, geomBuilder.GEOM._objref_GEOM_Object):
              ShapeID = self.geompyD.GetSubShapeID( self.geom, Shape )
          else:
              ShapeID = Shape
          return self.mesh.GetSubMeshNodesId(ShapeID, all)
  
 -    ## Return type of elements on given shape
 -    #  @param Shape a geom object(sub-shape)
 -    #         Shape must be a sub-shape of a ShapeToMesh()
 -    #  @return element type
 -    #  @ingroup l1_meshinfo
      def GetSubMeshElementType(self, Shape):
 +        """
 +        Return type of elements on given shape
 +
 +        Parameters:
 +                Shape: a geom object (sub-shape).
 +                       *Shape* must be a sub-shape of a ShapeToMesh()
 +
 +        Returns:
 +            :class:`SMESH.ElementType`
 +        """
 +
          if isinstance( Shape, geomBuilder.GEOM._objref_GEOM_Object):
              ShapeID = self.geompyD.GetSubShapeID( self.geom, Shape )
          else:
              ShapeID = Shape
          return self.mesh.GetSubMeshElementType(ShapeID)
  
 -    ## Get the mesh description
 -    #  @return string value
 -    #  @ingroup l1_meshinfo
      def Dump(self):
 +        """
 +        Get the mesh description
 +
 +        Returns:
 +            string value
 +        """
 +
          return self.mesh.Dump()
  
  
      # Get the information about nodes and elements of a mesh by its IDs:
      # -----------------------------------------------------------
  
 -    ## Get XYZ coordinates of a node
 -    #  \n If there is no nodes for the given ID - return an empty list
 -    #  @return a list of double precision values
 -    #  @ingroup l1_meshinfo
      def GetNodeXYZ(self, id):
 +        """
 +        Get XYZ coordinates of a node.
 +        If there is no node for the given ID - return an empty list
 +
 +        Returns:
 +            list of float values
 +        """
 +
          return self.mesh.GetNodeXYZ(id)
  
 -    ## Return list of IDs of inverse elements for the given node
 -    #  \n If there is no node for the given ID - return an empty list
 -    #  @return a list of integer values
 -    #  @ingroup l1_meshinfo
      def GetNodeInverseElements(self, id):
 +        """
 +        Return list of IDs of inverse elements for the given node.
 +        If there is no node for the given ID - return an empty list
 +
 +        Returns:
 +            list of integer values
 +        """
 +
          return self.mesh.GetNodeInverseElements(id)
  
 -    ## Return the position of a node on the shape
 -    #  @return SMESH::NodePosition
 -    #  @ingroup l1_meshinfo
      def GetNodePosition(self,NodeID):
 +        """
 +        Return the position of a node on the shape
 +
 +        Returns:
 +            :class:`SMESH.NodePosition`
 +        """
 +
          return self.mesh.GetNodePosition(NodeID)
  
 -    ## Return the position of an element on the shape
 -    #  @return SMESH::ElementPosition
 -    #  @ingroup l1_meshinfo
      def GetElementPosition(self,ElemID):
 +        """
 +        Return the position of an element on the shape
 +
 +        Returns:
 +            :class:`SMESH.ElementPosition`
 +        """
 +
          return self.mesh.GetElementPosition(ElemID)
  
 -    ## Return the ID of the shape, on which the given node was generated.
 -    #  @return an integer value > 0 or -1 if there is no node for the given
 -    #          ID or the node is not assigned to any geometry
 -    #  @ingroup l1_meshinfo
      def GetShapeID(self, id):
 +        """
 +        Return the ID of the shape, on which the given node was generated.
 +
 +        Returns:
 +            an integer value > 0 or -1 if there is no node for the given
 +            ID or the node is not assigned to any geometry
 +        """
 +
          return self.mesh.GetShapeID(id)
  
 -    ## Return the ID of the shape, on which the given element was generated.
 -    #  @return an integer value > 0 or -1 if there is no element for the given
 -    #          ID or the element is not assigned to any geometry
 -    #  @ingroup l1_meshinfo
      def GetShapeIDForElem(self,id):
 +        """
 +        Return the ID of the shape, on which the given element was generated.
 +
 +        Returns:
 +            an integer value > 0 or -1 if there is no element for the given
 +            ID or the element is not assigned to any geometry
 +        """
 +
          return self.mesh.GetShapeIDForElem(id)
  
 -    ## Return the number of nodes of the given element
 -    #  @return an integer value > 0 or -1 if there is no element for the given ID
 -    #  @ingroup l1_meshinfo
      def GetElemNbNodes(self, id):
 +        """
 +        Return the number of nodes of the given element
 +
 +        Returns:
 +            an integer value > 0 or -1 if there is no element for the given ID
 +        """
 +
          return self.mesh.GetElemNbNodes(id)
  
 -    ## Return the node ID the given (zero based) index for the given element
 -    #  \n If there is no element for the given ID - return -1
 -    #  \n If there is no node for the given index - return -2
 -    #  @return an integer value
 -    #  @ingroup l1_meshinfo
      def GetElemNode(self, id, index):
 +        """
 +        Return the node ID the given (zero based) index for the given element.
 +
 +        * If there is no element for the given ID - return -1.
 +        * If there is no node for the given index - return -2.
 +
 +        Parameters:
 +            id (int): element ID
 +            index (int): node index within the element
 +
 +        Returns:
 +            an integer value (ID)
 +
 +        See Also:
 +            :meth:`GetElemNodes`
 +        """
 +
          return self.mesh.GetElemNode(id, index)
  
 -    ## Return the IDs of nodes of the given element
 -    #  @return a list of integer values
 -    #  @ingroup l1_meshinfo
      def GetElemNodes(self, id):
 +        """
 +        Return the IDs of nodes of the given element
 +
 +        Returns:
 +            a list of integer values
 +        """
 +
          return self.mesh.GetElemNodes(id)
  
 -    ## Return true if the given node is the medium node in the given quadratic element
 -    #  @ingroup l1_meshinfo
      def IsMediumNode(self, elementID, nodeID):
 +        """
 +        Return true if the given node is the medium node in the given quadratic element
 +        """
 +
          return self.mesh.IsMediumNode(elementID, nodeID)
  
 -    ## Return true if the given node is the medium node in one of quadratic elements
 -    #  @param nodeID ID of the node
 -    #  @param elementType  the type of elements to check a state of the node, either of
 -    #         (SMESH.ALL, SMESH.NODE, SMESH.EDGE, SMESH.FACE or SMESH.VOLUME)
 -    #  @ingroup l1_meshinfo
      def IsMediumNodeOfAnyElem(self, nodeID, elementType = SMESH.ALL ):
 +        """
 +        Return true if the given node is the medium node in one of quadratic elements
 +
 +        Parameters:
 +                nodeID: ID of the node
 +                elementType:  the type of elements to check a state of the node, either of
 +                        (SMESH.ALL, SMESH.NODE, SMESH.EDGE, SMESH.FACE or SMESH.VOLUME)
 +        """
 +
          return self.mesh.IsMediumNodeOfAnyElem(nodeID, elementType)
  
 -    ## Return the number of edges for the given element
 -    #  @ingroup l1_meshinfo
      def ElemNbEdges(self, id):
 +        """
 +        Return the number of edges for the given element
 +        """
 +
          return self.mesh.ElemNbEdges(id)
  
 -    ## Return the number of faces for the given element
 -    #  @ingroup l1_meshinfo
      def ElemNbFaces(self, id):
 +        """
 +        Return the number of faces for the given element
 +        """
 +
          return self.mesh.ElemNbFaces(id)
  
 -    ## Return nodes of given face (counted from zero) for given volumic element.
 -    #  @ingroup l1_meshinfo
      def GetElemFaceNodes(self,elemId, faceIndex):
 +        """
 +        Return nodes of given face (counted from zero) for given volumic element.
 +        """
 +
          return self.mesh.GetElemFaceNodes(elemId, faceIndex)
  
 -    ## Return three components of normal of given mesh face
 -    #  (or an empty array in KO case)
 -    #  @ingroup l1_meshinfo
      def GetFaceNormal(self, faceId, normalized=False):
 +        """
 +        Return three components of normal of given mesh face
 +        (or an empty array in KO case)
 +        """
 +
          return self.mesh.GetFaceNormal(faceId,normalized)
  
 -    ## Return an element based on all given nodes.
 -    #  @ingroup l1_meshinfo
      def FindElementByNodes(self, nodes):
 +        """
 +        Return an element based on all given nodes.
 +        """
 +
          return self.mesh.FindElementByNodes(nodes)
  
 -    ## Return elements including all given nodes.
 -    #  @ingroup l1_meshinfo
      def GetElementsByNodes(self, nodes, elemType=SMESH.ALL):
 +        """
 +        Return elements including all given nodes.
 +        """
 +
          return self.mesh.GetElementsByNodes( nodes, elemType )
  
 -    ## Return true if the given element is a polygon
 -    #  @ingroup l1_meshinfo
      def IsPoly(self, id):
 +        """
 +        Return true if the given element is a polygon
 +        """
 +
          return self.mesh.IsPoly(id)
  
 -    ## Return true if the given element is quadratic
 -    #  @ingroup l1_meshinfo
      def IsQuadratic(self, id):
 +        """
 +        Return true if the given element is quadratic
 +        """
 +
          return self.mesh.IsQuadratic(id)
  
 -    ## Return diameter of a ball discrete element or zero in case of an invalid \a id
 -    #  @ingroup l1_meshinfo
      def GetBallDiameter(self, id):
 +        """
 +        Return diameter of a ball discrete element or zero in case of an invalid *id*
 +        """
 +
          return self.mesh.GetBallDiameter(id)
  
 -    ## Return XYZ coordinates of the barycenter of the given element
 -    #  \n If there is no element for the given ID - return an empty list
 -    #  @return a list of three double values
 -    #  @ingroup l1_meshinfo
      def BaryCenter(self, id):
 +        """
 +        Return XYZ coordinates of the barycenter of the given element.
 +        If there is no element for the given ID - return an empty list
 +
 +        Returns:
 +            a list of three double values
 +        """
 +
          return self.mesh.BaryCenter(id)
  
 -    ## Pass mesh elements through the given filter and return IDs of fitting elements
 -    #  @param theFilter SMESH_Filter
 -    #  @return a list of ids
 -    #  @ingroup l1_controls
      def GetIdsFromFilter(self, theFilter):
 +        """
 +        Pass mesh elements through the given filter and return IDs of fitting elements
 +
 +        Parameters:
 +                theFilter: :class:`SMESH.Filter`
 +
 +        Returns:
 +            a list of ids
 +
 +        See Also:
 +            :meth:`SMESH.Filter.GetIDs`
 +        """
 +
          theFilter.SetMesh( self.mesh )
          return theFilter.GetIDs()
  
      # Get mesh measurements information:
      # ------------------------------------
  
 -    ## Verify whether a 2D mesh element has free edges (edges connected to one face only)\n
 -    #  Return a list of special structures (borders).
 -    #  @return a list of SMESH.FreeEdges.Border structure: edge id and ids of two its nodes.
 -    #  @ingroup l1_measurements
      def GetFreeBorders(self):
 +        """
 +        Verify whether a 2D mesh element has free edges (edges connected to one face only).
 +        Return a list of special structures (borders).
 +
 +        Returns:
 +            a list of :class:`SMESH.FreeEdges.Border`
 +        """
 +
          aFilterMgr = self.smeshpyD.CreateFilterManager()
          aPredicate = aFilterMgr.CreateFreeEdges()
          aPredicate.SetMesh(self.mesh)
          aFilterMgr.UnRegister()
          return aBorders
  
 -    ## Get minimum distance between two nodes, elements or distance to the origin
 -    #  @param id1 first node/element id
 -    #  @param id2 second node/element id (if 0, distance from @a id1 to the origin is computed)
 -    #  @param isElem1 @c True if @a id1 is element id, @c False if it is node id
 -    #  @param isElem2 @c True if @a id2 is element id, @c False if it is node id
 -    #  @return minimum distance value
 -    #  @sa GetMinDistance()
 -    #  @ingroup l1_measurements
      def MinDistance(self, id1, id2=0, isElem1=False, isElem2=False):
 +        """
 +        Get minimum distance between two nodes, elements or distance to the origin
 +
 +        Parameters:
 +                id1: first node/element id
 +                id2: second node/element id (if 0, distance from *id1* to the origin is computed)
 +                isElem1: *True* if *id1* is element id, *False* if it is node id
 +                isElem2: *True* if *id2* is element id, *False* if it is node id
 +
 +        Returns:
 +            minimum distance value **GetMinDistance()**
 +        """
 +
          aMeasure = self.GetMinDistance(id1, id2, isElem1, isElem2)
          return aMeasure.value
  
 -    ## Get measure structure specifying minimum distance data between two objects
 -    #  @param id1 first node/element id
 -    #  @param id2 second node/element id (if 0, distance from @a id1 to the origin is computed)
 -    #  @param isElem1 @c True if @a id1 is element id, @c False if it is node id
 -    #  @param isElem2 @c True if @a id2 is element id, @c False if it is node id
 -    #  @return Measure structure
 -    #  @sa MinDistance()
 -    #  @ingroup l1_measurements
      def GetMinDistance(self, id1, id2=0, isElem1=False, isElem2=False):
 +        """
 +        Get :class:`SMESH.Measure` structure specifying minimum distance data between two objects
 +
 +        Parameters:
 +                id1: first node/element id
 +                id2: second node/element id (if 0, distance from *id1* to the origin is computed)
 +                isElem1: *True* if *id1* is element id, *False* if it is node id
 +                isElem2: *True* if *id2* is element id, *False* if it is node id
 +
 +        Returns:
 +            :class:`SMESH.Measure` structure
 +        See Also:
 +            :meth:`MinDistance`
 +        """
 +
          if isElem1:
              id1 = self.editor.MakeIDSource([id1], SMESH.FACE)
          else:
          genObjUnRegister([aMeasurements,id1, id2])
          return aMeasure
  
 -    ## Get bounding box of the specified object(s)
 -    #  @param objects single source object or list of source objects or list of nodes/elements IDs
 -    #  @param isElem if @a objects is a list of IDs, @c True value in this parameters specifies that @a objects are elements,
 -    #  @c False specifies that @a objects are nodes
 -    #  @return tuple of six values (minX, minY, minZ, maxX, maxY, maxZ)
 -    #  @sa GetBoundingBox()
 -    #  @ingroup l1_measurements
      def BoundingBox(self, objects=None, isElem=False):
 +        """
 +        Get bounding box of the specified object(s)
 +
 +        Parameters:
 +                objects: single :class:`source object <SMESH.SMESH_IDSource>` or list of source objects or list of nodes/elements IDs
 +                isElem: if *objects* is a list of IDs, *True* value in this parameters specifies that *objects* are elements,
 +                        *False* specifies that *objects* are nodes
 +
 +        Returns:
 +            tuple of six values (minX, minY, minZ, maxX, maxY, maxZ)
 +
 +        See Also: 
 +            :meth:`GetBoundingBox()`
 +        """
 +
          result = self.GetBoundingBox(objects, isElem)
          if result is None:
              result = (0.0,)*6
              result = (result.minX, result.minY, result.minZ, result.maxX, result.maxY, result.maxZ)
          return result
  
 -    ## Get measure structure specifying bounding box data of the specified object(s)
 -    #  @param IDs single source object or list of source objects or list of nodes/elements IDs
 -    #  @param isElem if @a IDs is a list of IDs, @c True value in this parameters specifies that @a objects are elements,
 -    #  @c False specifies that @a objects are nodes
 -    #  @return Measure structure
 -    #  @sa BoundingBox()
 -    #  @ingroup l1_measurements
 -    def GetBoundingBox(self, IDs=None, isElem=False):
 -        if IDs is None:
 -            IDs = [self.mesh]
 -        elif isinstance(IDs, tuple):
 -            IDs = list(IDs)
 -        if not isinstance(IDs, list):
 -            IDs = [IDs]
 -        if len(IDs) > 0 and isinstance(IDs[0], int):
 -            IDs = [IDs]
 +    def GetBoundingBox(self, objects=None, isElem=False):
 +        """
 +        Get :class:`SMESH.Measure` structure specifying bounding box data of the specified object(s)
 +
 +        Parameters:
 +                objects: single :class:`source object <SMESH.SMESH_IDSource>` or list of source objects or list of nodes/elements IDs
 +                isElem: if *objects* is a list of IDs, True means that *objects* are elements,
 +                        False means that *objects* are nodes
 +
 +        Returns:
 +            :class:`SMESH.Measure` structure
 +
 +        See Also: 
 +            :meth:`BoundingBox()`
 +        """
 +
 +        if objects is None:
 +            objects = [self.mesh]
 +        elif isinstance(objects, tuple):
 +            objects = list(objects)
 +        if not isinstance(objects, list):
 +            objects = [objects]
 +        if len(objects) > 0 and isinstance(objects[0], int):
 +            objects = [objects]
          srclist = []
          unRegister = genObjUnRegister()
 -        for o in IDs:
 +        for o in objects:
              if isinstance(o, Mesh):
                  srclist.append(o.mesh)
              elif hasattr(o, "_narrow"):
      # Mesh edition (SMESH_MeshEditor functionality):
      # ---------------------------------------------
  
 -    ## Remove the elements from the mesh by ids
 -    #  @param IDsOfElements is a list of ids of elements to remove
 -    #  @return True or False
 -    #  @ingroup l2_modif_del
      def RemoveElements(self, IDsOfElements):
 +        """
 +        Remove the elements from the mesh by ids
 +
 +        Parameters:
 +                IDsOfElements: is a list of ids of elements to remove
 +
 +        Returns:
 +            True or False
 +        """
 +
          return self.editor.RemoveElements(IDsOfElements)
  
 -    ## Remove nodes from mesh by ids
 -    #  @param IDsOfNodes is a list of ids of nodes to remove
 -    #  @return True or False
 -    #  @ingroup l2_modif_del
      def RemoveNodes(self, IDsOfNodes):
 +        """
 +        Remove nodes from mesh by ids
 +
 +        Parameters:
 +                IDsOfNodes: is a list of ids of nodes to remove
 +
 +        Returns:
 +            True or False
 +        """
 +
          return self.editor.RemoveNodes(IDsOfNodes)
  
 -    ## Remove all orphan (free) nodes from mesh
 -    #  @return number of the removed nodes
 -    #  @ingroup l2_modif_del
      def RemoveOrphanNodes(self):
 +        """
 +        Remove all orphan (free) nodes from mesh
 +
 +        Returns:
 +            number of the removed nodes
 +        """
 +
          return self.editor.RemoveOrphanNodes()
  
 -    ## Add a node to the mesh by coordinates
 -    #  @return Id of the new node
 -    #  @ingroup l2_modif_add
      def AddNode(self, x, y, z):
 +        """
 +        Add a node to the mesh by coordinates
 +
 +        Returns:
 +            ID of the new node
 +        """
 +
          x,y,z,Parameters,hasVars = ParseParameters(x,y,z)
          if hasVars: self.mesh.SetParameters(Parameters)
          return self.editor.AddNode( x, y, z)
  
 -    ## Create a 0D element on a node with given number.
 -    #  @param IDOfNode the ID of node for creation of the element.
 -    #  @param DuplicateElements to add one more 0D element to a node or not
 -    #  @return the Id of the new 0D element
 -    #  @ingroup l2_modif_add
      def Add0DElement( self, IDOfNode, DuplicateElements=True ):
 +        """
 +        Create a 0D element on a node with given number.
 +
 +        Parameters:
 +                IDOfNode: the ID of node for creation of the element.
 +                DuplicateElements: to add one more 0D element to a node or not
 +
 +        Returns:
 +            ID of the new 0D element
 +        """
 +
          return self.editor.Add0DElement( IDOfNode, DuplicateElements )
  
 -    ## Create 0D elements on all nodes of the given elements except those
 -    #  nodes on which a 0D element already exists.
 -    #  @param theObject an object on whose nodes 0D elements will be created.
 -    #         It can be mesh, sub-mesh, group, list of element IDs or a holder
 -    #         of nodes IDs created by calling mesh.GetIDSource( nodes, SMESH.NODE )
 -    #  @param theGroupName optional name of a group to add 0D elements created
 -    #         and/or found on nodes of \a theObject.
 -    #  @param DuplicateElements to add one more 0D element to a node or not
 -    #  @return an object (a new group or a temporary SMESH_IDSource) holding
 -    #          IDs of new and/or found 0D elements. IDs of 0D elements
 -    #          can be retrieved from the returned object by calling GetIDs()
 -    #  @ingroup l2_modif_add
      def Add0DElementsToAllNodes(self, theObject, theGroupName="", DuplicateElements=False):
 +        """
 +        Create 0D elements on all nodes of the given elements except those
 +        nodes on which a 0D element already exists.
 +
 +        Parameters:
 +                theObject: an object on whose nodes 0D elements will be created.
 +                        It can be list of element IDs, :class:`mesh, sub-mesh, group or filter <SMESH.SMESH_IDSource>`
 +                theGroupName: optional name of a group to add 0D elements created
 +                        and/or found on nodes of *theObject*.
 +                DuplicateElements: to add one more 0D element to a node or not
 +
 +        Returns:
 +            an object (a new group or a temporary :class:`SMESH.SMESH_IDSource`) holding
 +            IDs of new and/or found 0D elements. IDs of 0D elements
 +            can be retrieved from the returned object by 
 +            calling :meth:`GetIDs() <SMESH.SMESH_IDSource.GetIDs>`
 +        """
 +
          unRegister = genObjUnRegister()
          if isinstance( theObject, Mesh ):
              theObject = theObject.GetMesh()
              unRegister.set( theObject )
          return self.editor.Create0DElementsOnAllNodes( theObject, theGroupName, DuplicateElements )
  
 -    ## Create a ball element on a node with given ID.
 -    #  @param IDOfNode the ID of node for creation of the element.
 -    #  @param diameter the bal diameter.
 -    #  @return the Id of the new ball element
 -    #  @ingroup l2_modif_add
      def AddBall(self, IDOfNode, diameter):
 +        """
 +        Create a ball element on a node with given ID.
 +
 +        Parameters:
 +                IDOfNode: the ID of node for creation of the element.
 +                diameter: the bal diameter.
 +
 +        Returns:
 +            ID of the new ball element
 +        """
 +
          return self.editor.AddBall( IDOfNode, diameter )
  
 -    ## Create a linear or quadratic edge (this is determined
 -    #  by the number of given nodes).
 -    #  @param IDsOfNodes the list of node IDs for creation of the element.
 -    #  The order of nodes in this list should correspond to the description
 -    #  of MED. \n This description is located by the following link:
 -    #  http://www.code-aster.org/outils/med/html/modele_de_donnees.html#3.
 -    #  @return the Id of the new edge
 -    #  @ingroup l2_modif_add
      def AddEdge(self, IDsOfNodes):
 +        """
 +        Create a linear or quadratic edge (this is determined
 +        by the number of given nodes).
 +
 +        Parameters:
 +                IDsOfNodes: list of node IDs for creation of the element.
 +                        The order of nodes in this list should correspond to
 +                        the :ref:`connectivity convention <connectivity_page>`.
 +
 +        Returns:
 +            ID of the new edge
 +        """
 +
          return self.editor.AddEdge(IDsOfNodes)
  
 -    ## Create a linear or quadratic face (this is determined
 -    #  by the number of given nodes).
 -    #  @param IDsOfNodes the list of node IDs for creation of the element.
 -    #  The order of nodes in this list should correspond to the description
 -    #  of MED. \n This description is located by the following link:
 -    #  http://www.code-aster.org/outils/med/html/modele_de_donnees.html#3.
 -    #  @return the Id of the new face
 -    #  @ingroup l2_modif_add
      def AddFace(self, IDsOfNodes):
 +        """
 +        Create a linear or quadratic face (this is determined
 +        by the number of given nodes).
 +
 +        Parameters:
 +                IDsOfNodes: list of node IDs for creation of the element.
 +                        The order of nodes in this list should correspond to
 +                        the :ref:`connectivity convention <connectivity_page>`.
 +
 +        Returns:
 +            ID of the new face
 +        """
 +
          return self.editor.AddFace(IDsOfNodes)
  
 -    ## Add a polygonal face to the mesh by the list of node IDs
 -    #  @param IdsOfNodes the list of node IDs for creation of the element.
 -    #  @return the Id of the new face
 -    #  @ingroup l2_modif_add
      def AddPolygonalFace(self, IdsOfNodes):
 +        """
 +        Add a polygonal face defined by a list of node IDs
 +
 +        Parameters:
 +                IdsOfNodes: the list of node IDs for creation of the element.
 +
 +        Returns:
 +            ID of the new face
 +        """
 +
          return self.editor.AddPolygonalFace(IdsOfNodes)
  
 -    ## Add a quadratic polygonal face to the mesh by the list of node IDs
 -    #  @param IdsOfNodes the list of node IDs for creation of the element;
 -    #         corner nodes follow first.
 -    #  @return the Id of the new face
 -    #  @ingroup l2_modif_add
      def AddQuadPolygonalFace(self, IdsOfNodes):
 +        """
 +        Add a quadratic polygonal face defined by a list of node IDs
 +
 +        Parameters:
 +                IdsOfNodes: the list of node IDs for creation of the element;
 +                        corner nodes follow first.
 +
 +        Returns:
 +            ID of the new face
 +        """
 +
          return self.editor.AddQuadPolygonalFace(IdsOfNodes)
  
 -    ## Create both simple and quadratic volume (this is determined
 -    #  by the number of given nodes).
 -    #  @param IDsOfNodes the list of node IDs for creation of the element.
 -    #  The order of nodes in this list should correspond to the description
 -    #  of MED. \n This description is located by the following link:
 -    #  http://www.code-aster.org/outils/med/html/modele_de_donnees.html#3.
 -    #  @return the Id of the new volumic element
 -    #  @ingroup l2_modif_add
      def AddVolume(self, IDsOfNodes):
 +        """
 +        Create both simple and quadratic volume (this is determined
 +        by the number of given nodes).
 +
 +        Parameters:
 +                IDsOfNodes: list of node IDs for creation of the element.
 +                        The order of nodes in this list should correspond to
 +                        the :ref:`connectivity convention <connectivity_page>`.
 +
 +        Returns:
 +            ID of the new volumic element
 +        """
 +
          return self.editor.AddVolume(IDsOfNodes)
  
 -    ## Create a volume of many faces, giving nodes for each face.
 -    #  @param IdsOfNodes the list of node IDs for volume creation face by face.
 -    #  @param Quantities the list of integer values, Quantities[i]
 -    #         gives the quantity of nodes in face number i.
 -    #  @return the Id of the new volumic element
 -    #  @ingroup l2_modif_add
      def AddPolyhedralVolume (self, IdsOfNodes, Quantities):
 +        """
 +        Create a volume of many faces, giving nodes for each face.
 +
 +        Parameters:
 +                IdsOfNodes: list of node IDs for volume creation, face by face.
 +                Quantities: list of integer values, Quantities[i]
 +                        gives the quantity of nodes in face number i.
 +
 +        Returns:
 +            ID of the new volumic element
 +        """
 +
          return self.editor.AddPolyhedralVolume(IdsOfNodes, Quantities)
  
 -    ## Create a volume of many faces, giving the IDs of the existing faces.
 -    #  @param IdsOfFaces the list of face IDs for volume creation.
 -    #
 -    #  Note:  The created volume will refer only to the nodes
 -    #         of the given faces, not to the faces themselves.
 -    #  @return the Id of the new volumic element
 -    #  @ingroup l2_modif_add
      def AddPolyhedralVolumeByFaces (self, IdsOfFaces):
 +        """
 +        Create a volume of many faces, giving the IDs of the existing faces.
 +
 +        Note:
 +                The created volume will refer only to the nodes
 +                of the given faces, not to the faces themselves.
 +
 +        Parameters:
 +                IdsOfFaces: the list of face IDs for volume creation.
 +
 +        Returns:
 +            ID of the new volumic element
 +        """
 +
          return self.editor.AddPolyhedralVolumeByFaces(IdsOfFaces)
  
  
 -    ## @brief Binds a node to a vertex
 -    #  @param NodeID a node ID
 -    #  @param Vertex a vertex or vertex ID
 -    #  @return True if succeed else raises an exception
 -    #  @ingroup l2_modif_add
      def SetNodeOnVertex(self, NodeID, Vertex):
 +        """
 +        Binds a node to a vertex
 +
 +        Parameters:
 +                NodeID: a node ID
 +                Vertex: a vertex (GEOM.GEOM_Object) or vertex ID
 +
 +        Returns:
 +            True if succeed else raises an exception
 +        """
 +
          if ( isinstance( Vertex, geomBuilder.GEOM._objref_GEOM_Object)):
              VertexID = self.geompyD.GetSubShapeID( self.geom, Vertex )
          else:
              VertexID = Vertex
          try:
              self.editor.SetNodeOnVertex(NodeID, VertexID)
-         except SALOME.SALOME_Exception, inst:
-             raise ValueError, inst.details.text
+         except SALOME.SALOME_Exception as inst:
+             raise ValueError(inst.details.text)
          return True
  
  
 -    ## @brief Stores the node position on an edge
 -    #  @param NodeID a node ID
 -    #  @param Edge an edge or edge ID
 -    #  @param paramOnEdge a parameter on the edge where the node is located
 -    #  @return True if succeed else raises an exception
 -    #  @ingroup l2_modif_add
      def SetNodeOnEdge(self, NodeID, Edge, paramOnEdge):
 +        """
 +        Stores the node position on an edge
 +
 +        Parameters:
 +                NodeID: a node ID
 +                Edge: an edge (GEOM.GEOM_Object) or edge ID
 +                paramOnEdge: a parameter on the edge where the node is located
 +
 +        Returns:
 +            True if succeed else raises an exception
 +        """
 +
          if ( isinstance( Edge, geomBuilder.GEOM._objref_GEOM_Object)):
              EdgeID = self.geompyD.GetSubShapeID( self.geom, Edge )
          else:
              EdgeID = Edge
          try:
              self.editor.SetNodeOnEdge(NodeID, EdgeID, paramOnEdge)
-         except SALOME.SALOME_Exception, inst:
-             raise ValueError, inst.details.text
+         except SALOME.SALOME_Exception as inst:
+             raise ValueError(inst.details.text)
          return True
  
 -    ## @brief Stores node position on a face
 -    #  @param NodeID a node ID
 -    #  @param Face a face or face ID
 -    #  @param u U parameter on the face where the node is located
 -    #  @param v V parameter on the face where the node is located
 -    #  @return True if succeed else raises an exception
 -    #  @ingroup l2_modif_add
      def SetNodeOnFace(self, NodeID, Face, u, v):
 +        """
 +        Stores node position on a face
 +
 +        Parameters:
 +                NodeID: a node ID
 +                Face: a face (GEOM.GEOM_Object) or face ID
 +                u: U parameter on the face where the node is located
 +                v: V parameter on the face where the node is located
 +
 +        Returns:
 +            True if succeed else raises an exception
 +        """
 +
          if ( isinstance( Face, geomBuilder.GEOM._objref_GEOM_Object)):
              FaceID = self.geompyD.GetSubShapeID( self.geom, Face )
          else:
              FaceID = Face
          try:
              self.editor.SetNodeOnFace(NodeID, FaceID, u, v)
-         except SALOME.SALOME_Exception, inst:
-             raise ValueError, inst.details.text
+         except SALOME.SALOME_Exception as inst:
+             raise ValueError(inst.details.text)
          return True
  
 -    ## @brief Binds a node to a solid
 -    #  @param NodeID a node ID
 -    #  @param Solid  a solid or solid ID
 -    #  @return True if succeed else raises an exception
 -    #  @ingroup l2_modif_add
      def SetNodeInVolume(self, NodeID, Solid):
 +        """
 +        Binds a node to a solid
 +
 +        Parameters:
 +                NodeID: a node ID
 +                Solid:  a solid (GEOM.GEOM_Object) or solid ID
 +
 +        Returns:
 +            True if succeed else raises an exception
 +        """
 +
          if ( isinstance( Solid, geomBuilder.GEOM._objref_GEOM_Object)):
              SolidID = self.geompyD.GetSubShapeID( self.geom, Solid )
          else:
              SolidID = Solid
          try:
              self.editor.SetNodeInVolume(NodeID, SolidID)
-         except SALOME.SALOME_Exception, inst:
-             raise ValueError, inst.details.text
+         except SALOME.SALOME_Exception as inst:
+             raise ValueError(inst.details.text)
          return True
  
 -    ## @brief Bind an element to a shape
 -    #  @param ElementID an element ID
 -    #  @param Shape a shape or shape ID
 -    #  @return True if succeed else raises an exception
 -    #  @ingroup l2_modif_add
      def SetMeshElementOnShape(self, ElementID, Shape):
 +        """
 +        Bind an element to a shape
 +
 +        Parameters:
 +                ElementID: an element ID
 +                Shape: a shape (GEOM.GEOM_Object) or shape ID
 +
 +        Returns:
 +            True if succeed else raises an exception
 +        """
 +
          if ( isinstance( Shape, geomBuilder.GEOM._objref_GEOM_Object)):
              ShapeID = self.geompyD.GetSubShapeID( self.geom, Shape )
          else:
              ShapeID = Shape
          try:
              self.editor.SetMeshElementOnShape(ElementID, ShapeID)
-         except SALOME.SALOME_Exception, inst:
-             raise ValueError, inst.details.text
+         except SALOME.SALOME_Exception as inst:
+             raise ValueError(inst.details.text)
          return True
  
  
 -    ## Move the node with the given id
 -    #  @param NodeID the id of the node
 -    #  @param x  a new X coordinate
 -    #  @param y  a new Y coordinate
 -    #  @param z  a new Z coordinate
 -    #  @return True if succeed else False
 -    #  @ingroup l2_modif_edit
      def MoveNode(self, NodeID, x, y, z):
 +        """
 +        Move the node with the given id
 +
 +        Parameters:
 +                NodeID: the id of the node
 +                x:  a new X coordinate
 +                y:  a new Y coordinate
 +                z:  a new Z coordinate
 +
 +        Returns:
 +            True if succeed else False
 +        """
 +
          x,y,z,Parameters,hasVars = ParseParameters(x,y,z)
          if hasVars: self.mesh.SetParameters(Parameters)
          return self.editor.MoveNode(NodeID, x, y, z)
  
 -    ## Find the node closest to a point and moves it to a point location
 -    #  @param x  the X coordinate of a point
 -    #  @param y  the Y coordinate of a point
 -    #  @param z  the Z coordinate of a point
 -    #  @param NodeID if specified (>0), the node with this ID is moved,
 -    #  otherwise, the node closest to point (@a x,@a y,@a z) is moved
 -    #  @return the ID of a node
 -    #  @ingroup l2_modif_edit
 -    def MoveClosestNodeToPoint(self, x, y, z, NodeID):
 +    def MoveClosestNodeToPoint(self, x, y, z, NodeID):
 +        """
 +        Find the node closest to a point and moves it to a point location
 +
 +        Parameters:
 +                x:  the X coordinate of a point
 +                y:  the Y coordinate of a point
 +                z:  the Z coordinate of a point
 +                NodeID: if specified (>0), the node with this ID is moved,
 +                        otherwise, the node closest to point (*x*, *y*, *z*) is moved
 +
 +        Returns:
 +            the ID of a moved node
 +        """
 +
          x,y,z,Parameters,hasVars = ParseParameters(x,y,z)
          if hasVars: self.mesh.SetParameters(Parameters)
          return self.editor.MoveClosestNodeToPoint(x, y, z, NodeID)
  
 -    ## Find the node closest to a point
 -    #  @param x  the X coordinate of a point
 -    #  @param y  the Y coordinate of a point
 -    #  @param z  the Z coordinate of a point
 -    #  @return the ID of a node
 -    #  @ingroup l1_meshinfo
      def FindNodeClosestTo(self, x, y, z):
 +        """
 +        Find the node closest to a point
 +
 +        Parameters:
 +                x:  the X coordinate of a point
 +                y:  the Y coordinate of a point
 +                z:  the Z coordinate of a point
 +
 +        Returns:
 +            the ID of a node
 +        """
 +
          #preview = self.mesh.GetMeshEditPreviewer()
          #return preview.MoveClosestNodeToPoint(x, y, z, -1)
          return self.editor.FindNodeClosestTo(x, y, z)
  
 -    ## Find the elements where a point lays IN or ON
 -    #  @param x  the X coordinate of a point
 -    #  @param y  the Y coordinate of a point
 -    #  @param z  the Z coordinate of a point
 -    #  @param elementType type of elements to find; either of
 -    #         (SMESH.NODE, SMESH.EDGE, SMESH.FACE, SMESH.VOLUME); SMESH.ALL type
 -    #         means elements of any type excluding nodes, discrete and 0D elements.
 -    #  @param meshPart a part of mesh (group, sub-mesh) to search within
 -    #  @return list of IDs of found elements
 -    #  @ingroup l1_meshinfo
      def FindElementsByPoint(self, x, y, z, elementType = SMESH.ALL, meshPart=None):
 +        """
 +        Find the elements where a point lays IN or ON
 +
 +        Parameters:
 +                x,y,z (float): coordinates of the point
 +                elementType (SMESH.ElementType): type of elements to find; SMESH.ALL type
 +                        means elements of any type excluding nodes, discrete and 0D elements.
 +                meshPart: a part of mesh (:class:`sub-mesh, group or filter <SMESH.SMESH_IDSource>`) to search within
 +
 +        Returns:
 +            list of IDs of found elements
 +        """
          if meshPart:
              return self.editor.FindAmongElementsByPoint( meshPart, x, y, z, elementType );
          else:
              return self.editor.FindElementsByPoint(x, y, z, elementType)
  
 -    ## Return point state in a closed 2D mesh in terms of TopAbs_State enumeration:
 -    #  0-IN, 1-OUT, 2-ON, 3-UNKNOWN
 -    #  UNKNOWN state means that either mesh is wrong or the analysis fails.
 -    #  @ingroup l1_meshinfo
      def GetPointState(self, x, y, z):
 +        """
 +        Return point state in a closed 2D mesh in terms of TopAbs_State enumeration:
 +        0-IN, 1-OUT, 2-ON, 3-UNKNOWN.
 +        UNKNOWN state means that either mesh is wrong or the analysis fails.
 +        """
 +
          return self.editor.GetPointState(x, y, z)
  
 -    ## Check if a 2D mesh is manifold
 -    #  @ingroup l1_controls
      def IsManifold(self):
 +        """
 +        Check if a 2D mesh is manifold
 +        """
 +
          return self.editor.IsManifold()
  
 -    ## Check if orientation of 2D elements is coherent
 -    #  @ingroup l1_controls
      def IsCoherentOrientation2D(self):
 +        """
 +        Check if orientation of 2D elements is coherent
 +        """
 +
          return self.editor.IsCoherentOrientation2D()
  
 -    ## Find the node closest to a point and moves it to a point location
 -    #  @param x  the X coordinate of a point
 -    #  @param y  the Y coordinate of a point
 -    #  @param z  the Z coordinate of a point
 -    #  @return the ID of a moved node
 -    #  @ingroup l2_modif_edit
      def MeshToPassThroughAPoint(self, x, y, z):
 +        """
 +        Find the node closest to a point and moves it to a point location
 +
 +        Parameters:
 +                x:  the X coordinate of a point
 +                y:  the Y coordinate of a point
 +                z:  the Z coordinate of a point
 +
 +        Returns:
 +            the ID of a moved node
 +        """
 +
          return self.editor.MoveClosestNodeToPoint(x, y, z, -1)
  
 -    ## Replace two neighbour triangles sharing Node1-Node2 link
 -    #  with the triangles built on the same 4 nodes but having other common link.
 -    #  @param NodeID1  the ID of the first node
 -    #  @param NodeID2  the ID of the second node
 -    #  @return false if proper faces were not found
 -    #  @ingroup l2_modif_cutquadr
      def InverseDiag(self, NodeID1, NodeID2):
 +        """
 +        Replace two neighbour triangles sharing Node1-Node2 link
 +        with the triangles built on the same 4 nodes but having other common link.
 +
 +        Parameters:
 +                NodeID1:  the ID of the first node
 +                NodeID2:  the ID of the second node
 +
 +        Returns:
 +            False if proper faces were not found
 +        """
          return self.editor.InverseDiag(NodeID1, NodeID2)
  
 -    ## Replace two neighbour triangles sharing Node1-Node2 link
 -    #  with a quadrangle built on the same 4 nodes.
 -    #  @param NodeID1  the ID of the first node
 -    #  @param NodeID2  the ID of the second node
 -    #  @return false if proper faces were not found
 -    #  @ingroup l2_modif_unitetri
      def DeleteDiag(self, NodeID1, NodeID2):
 +        """
 +        Replace two neighbour triangles sharing *Node1-Node2* link
 +        with a quadrangle built on the same 4 nodes.
 +
 +        Parameters:
 +                NodeID1: ID of the first node
 +                NodeID2: ID of the second node
 +
 +        Returns:
 +            False if proper faces were not found
 +        """
 +
          return self.editor.DeleteDiag(NodeID1, NodeID2)
  
 -    ## Reorient elements by ids
 -    #  @param IDsOfElements if undefined reorients all mesh elements
 -    #  @return True if succeed else False
 -    #  @ingroup l2_modif_changori
      def Reorient(self, IDsOfElements=None):
 +        """
 +        Reorient elements by ids
 +
 +        Parameters:
 +                IDsOfElements: if undefined reorients all mesh elements
 +
 +        Returns:
 +            True if succeed else False
 +        """
 +
          if IDsOfElements == None:
              IDsOfElements = self.GetElementsId()
          return self.editor.Reorient(IDsOfElements)
  
 -    ## Reorient all elements of the object
 -    #  @param theObject mesh, submesh or group
 -    #  @return True if succeed else False
 -    #  @ingroup l2_modif_changori
      def ReorientObject(self, theObject):
 +        """
 +        Reorient all elements of the object
 +
 +        Parameters:
 +                theObject: :class:`mesh, sub-mesh, group or filter <SMESH.SMESH_IDSource>`
 +
 +        Returns:
 +            True if succeed else False
 +        """
 +
          if ( isinstance( theObject, Mesh )):
              theObject = theObject.GetMesh()
          return self.editor.ReorientObject(theObject)
  
 -    ## Reorient faces contained in \a the2DObject.
 -    #  @param the2DObject is a mesh, sub-mesh, group or list of IDs of 2D elements
 -    #  @param theDirection is a desired direction of normal of \a theFace.
 -    #         It can be either a GEOM vector or a list of coordinates [x,y,z].
 -    #  @param theFaceOrPoint defines a face of \a the2DObject whose normal will be
 -    #         compared with theDirection. It can be either ID of face or a point
 -    #         by which the face will be found. The point can be given as either
 -    #         a GEOM vertex or a list of point coordinates.
 -    #  @return number of reoriented faces
 -    #  @ingroup l2_modif_changori
      def Reorient2D(self, the2DObject, theDirection, theFaceOrPoint ):
 +        """
 +        Reorient faces contained in *the2DObject*.
 +
 +        Parameters:
 +                the2DObject: is a :class:`mesh, sub-mesh, group or filter <SMESH.SMESH_IDSource>` or list of IDs of 2D elements
 +                theDirection: is a desired direction of normal of *theFace*.
 +                        It can be either a GEOM vector or a list of coordinates [x,y,z].
 +                theFaceOrPoint: defines a face of *the2DObject* whose normal will be
 +                        compared with theDirection. It can be either ID of face or a point
 +                        by which the face will be found. The point can be given as either
 +                        a GEOM vertex or a list of point coordinates.
 +
 +        Returns:
 +            number of reoriented faces
 +        """
 +
          unRegister = genObjUnRegister()
          # check the2DObject
          if isinstance( the2DObject, Mesh ):
              theFace = -1
          return self.editor.Reorient2D( the2DObject, theDirection, theFace, thePoint )
  
 -    ## Reorient faces according to adjacent volumes.
 -    #  @param the2DObject is a mesh, sub-mesh, group or list of
 -    #         either IDs of faces or face groups.
 -    #  @param the3DObject is a mesh, sub-mesh, group or list of IDs of volumes.
 -    #  @param theOutsideNormal to orient faces to have their normals
 -    #         pointing either \a outside or \a inside the adjacent volumes.
 -    #  @return number of reoriented faces.
 -    #  @ingroup l2_modif_changori
      def Reorient2DBy3D(self, the2DObject, the3DObject, theOutsideNormal=True ):
 +        """
 +        Reorient faces according to adjacent volumes.
 +
 +        Parameters:
 +                the2DObject: is a :class:`mesh, sub-mesh, group, filter <SMESH.SMESH_IDSource>` or list of
 +                        either IDs of faces or face groups.
 +                the3DObject: is a :class:`mesh, sub-mesh, group, filter <SMESH.SMESH_IDSource>` or list of IDs of volumes.
 +                theOutsideNormal: to orient faces to have their normals
 +                        pointing either *outside* or *inside* the adjacent volumes.
 +
 +        Returns:
 +            number of reoriented faces.
 +        """
 +
          unRegister = genObjUnRegister()
          # check the2DObject
          if not isinstance( the2DObject, list ):
              unRegister.set( the3DObject )
          return self.editor.Reorient2DBy3D( the2DObject, the3DObject, theOutsideNormal )
  
 -    ## Fuse the neighbouring triangles into quadrangles.
 -    #  @param IDsOfElements The triangles to be fused.
 -    #  @param theCriterion  a numerical functor, in terms of enum SMESH.FunctorType, used to
 -    #          applied to possible quadrangles to choose a neighbour to fuse with.
 -    #          Type SMESH.FunctorType._items in the Python Console to see all items.
 -    #          Note that not all items correspond to numerical functors.
 -    #  @param MaxAngle      is the maximum angle between element normals at which the fusion
 -    #          is still performed; theMaxAngle is measured in radians.
 -    #          Also it could be a name of variable which defines angle in degrees.
 -    #  @return TRUE in case of success, FALSE otherwise.
 -    #  @ingroup l2_modif_unitetri
      def TriToQuad(self, IDsOfElements, theCriterion, MaxAngle):
 +        """
 +        Fuse the neighbouring triangles into quadrangles.
 +
 +        Parameters:
 +                IDsOfElements: The triangles to be fused.
 +                theCriterion:  a numerical functor, in terms of enum :class:`SMESH.FunctorType`, used to
 +                        applied to possible quadrangles to choose a neighbour to fuse with.
 +                        Note that not all items of :class:`SMESH.FunctorType` corresponds
 +                        to numerical functors.
 +                MaxAngle: is the maximum angle between element normals at which the fusion
 +                        is still performed; theMaxAngle is measured in radians.
 +                        Also it could be a name of variable which defines angle in degrees.
 +
 +        Returns:
 +            True in case of success, False otherwise.
 +        """
 +
          MaxAngle,Parameters,hasVars = ParseAngles(MaxAngle)
          self.mesh.SetParameters(Parameters)
          if not IDsOfElements:
          Functor = self.smeshpyD.GetFunctor(theCriterion)
          return self.editor.TriToQuad(IDsOfElements, Functor, MaxAngle)
  
 -    ## Fuse the neighbouring triangles of the object into quadrangles
 -    #  @param theObject is mesh, submesh or group
 -    #  @param theCriterion is a numerical functor, in terms of enum SMESH.FunctorType,
 -    #          applied to possible quadrangles to choose a neighbour to fuse with.
 -    #          Type SMESH.FunctorType._items in the Python Console to see all items.
 -    #          Note that not all items correspond to numerical functors.
 -    #  @param MaxAngle   a max angle between element normals at which the fusion
 -    #          is still performed; theMaxAngle is measured in radians.
 -    #  @return TRUE in case of success, FALSE otherwise.
 -    #  @ingroup l2_modif_unitetri
      def TriToQuadObject (self, theObject, theCriterion, MaxAngle):
 +        """
 +        Fuse the neighbouring triangles of the object into quadrangles
 +
 +        Parameters:
 +                theObject: is :class:`mesh, sub-mesh, group or filter <SMESH.SMESH_IDSource>`
 +                theCriterion: is a numerical functor, in terms of enum :class:`SMESH.FunctorType`,
 +                        applied to possible quadrangles to choose a neighbour to fuse with.
 +                        Note that not all items of :class:`SMESH.FunctorType` corresponds
 +                        to numerical functors.
 +                MaxAngle: a max angle between element normals at which the fusion
 +                        is still performed; theMaxAngle is measured in radians.
 +
 +        Returns:
 +            True in case of success, False otherwise.
 +        """
 +
          MaxAngle,Parameters,hasVars = ParseAngles(MaxAngle)
          self.mesh.SetParameters(Parameters)
          if isinstance( theObject, Mesh ):
          Functor = self.smeshpyD.GetFunctor(theCriterion)
          return self.editor.TriToQuadObject(theObject, Functor, MaxAngle)
  
 -    ## Split quadrangles into triangles.
 -    #  @param IDsOfElements the faces to be split.
 -    #  @param theCriterion is a numerical functor, in terms of enum SMESH.FunctorType, used to
 -    #         choose a diagonal for splitting. If @a theCriterion is None, which is a default
 -    #         value, then quadrangles will be split by the smallest diagonal.
 -    #         Type SMESH.FunctorType._items in the Python Console to see all items.
 -    #         Note that not all items correspond to numerical functors.
 -    #  @return TRUE in case of success, FALSE otherwise.
 -    #  @ingroup l2_modif_cutquadr
      def QuadToTri (self, IDsOfElements, theCriterion = None):
 +        """
 +        Split quadrangles into triangles.
 +
 +        Parameters:
 +                IDsOfElements: the faces to be splitted.
 +                theCriterion: is a numerical functor, in terms of enum :class:`SMESH.FunctorType`, used to
 +                        choose a diagonal for splitting. If *theCriterion* is None, which is a default
 +                        value, then quadrangles will be split by the smallest diagonal.
 +                        Note that not all items of :class:`SMESH.FunctorType` corresponds
 +                        to numerical functors.
 +
 +        Returns:
 +            True in case of success, False otherwise.
 +        """
          if IDsOfElements == []:
              IDsOfElements = self.GetElementsId()
          if theCriterion is None:
          Functor = self.smeshpyD.GetFunctor(theCriterion)
          return self.editor.QuadToTri(IDsOfElements, Functor)
  
 -    ## Split quadrangles into triangles.
 -    #  @param theObject the object from which the list of elements is taken,
 -    #         this is mesh, submesh or group
 -    #  @param theCriterion is a numerical functor, in terms of enum SMESH.FunctorType, used to
 -    #         choose a diagonal for splitting. If @a theCriterion is None, which is a default
 -    #         value, then quadrangles will be split by the smallest diagonal.
 -    #         Type SMESH.FunctorType._items in the Python Console to see all items.
 -    #         Note that not all items correspond to numerical functors.
 -    #  @return TRUE in case of success, FALSE otherwise.
 -    #  @ingroup l2_modif_cutquadr
      def QuadToTriObject (self, theObject, theCriterion = None):
 +        """
 +        Split quadrangles into triangles.
 +
 +        Parameters:
 +                theObject: the object from which the list of elements is taken,
 +                        this is :class:`mesh, sub-mesh, group or filter <SMESH.SMESH_IDSource>`
 +                theCriterion: is a numerical functor, in terms of enum :class:`SMESH.FunctorType`, used to
 +                        choose a diagonal for splitting. If *theCriterion* is None, which is a default
 +                        value, then quadrangles will be split by the smallest diagonal.
 +                        Note that not all items of :class:`SMESH.FunctorType` corresponds
 +                        to numerical functors.
 +
 +        Returns:
 +            True in case of success, False otherwise.
 +        """
          if ( isinstance( theObject, Mesh )):
              theObject = theObject.GetMesh()
          if theCriterion is None:
          Functor = self.smeshpyD.GetFunctor(theCriterion)
          return self.editor.QuadToTriObject(theObject, Functor)
  
 -    ## Split each of given quadrangles into 4 triangles. A node is added at the center of
 -    #  a quadrangle.
 -    #  @param theElements the faces to be split. This can be either mesh, sub-mesh,
 -    #         group or a list of face IDs. By default all quadrangles are split
 -    #  @ingroup l2_modif_cutquadr
      def QuadTo4Tri (self, theElements=[]):
 +        """
 +        Split each of given quadrangles into 4 triangles. A node is added at the center of
 +        a quadrangle.
 +
 +        Parameters:
 +                theElements: the faces to be splitted. This can be either 
 +                        :class:`mesh, sub-mesh, group, filter <SMESH.SMESH_IDSource>`
 +                        or a list of face IDs. By default all quadrangles are split
 +        """
          unRegister = genObjUnRegister()
          if isinstance( theElements, Mesh ):
              theElements = theElements.mesh
              unRegister.set( theElements )
          return self.editor.QuadTo4Tri( theElements )
  
 -    ## Split quadrangles into triangles.
 -    #  @param IDsOfElements the faces to be split
 -    #  @param Diag13        is used to choose a diagonal for splitting.
 -    #  @return TRUE in case of success, FALSE otherwise.
 -    #  @ingroup l2_modif_cutquadr
      def SplitQuad (self, IDsOfElements, Diag13):
 +        """
 +        Split quadrangles into triangles.
 +
 +        Parameters:
 +                IDsOfElements: the faces to be splitted
 +                Diag13:        is used to choose a diagonal for splitting.
 +
 +        Returns:
 +            True in case of success, False otherwise.
 +        """
          if IDsOfElements == []:
              IDsOfElements = self.GetElementsId()
          return self.editor.SplitQuad(IDsOfElements, Diag13)
  
 -    ## Split quadrangles into triangles.
 -    #  @param theObject the object from which the list of elements is taken,
 -    #         this is mesh, submesh or group
 -    #  @param Diag13    is used to choose a diagonal for splitting.
 -    #  @return TRUE in case of success, FALSE otherwise.
 -    #  @ingroup l2_modif_cutquadr
      def SplitQuadObject (self, theObject, Diag13):
 +        """
 +        Split quadrangles into triangles.
 +
 +        Parameters:
 +                theObject: the object from which the list of elements is taken,
 +                        this is :class:`mesh, sub-mesh, group or filter <SMESH.SMESH_IDSource>`
 +                Diag13:    is used to choose a diagonal for splitting.
 +
 +        Returns:
 +            True in case of success, False otherwise.
 +        """
          if ( isinstance( theObject, Mesh )):
              theObject = theObject.GetMesh()
          return self.editor.SplitQuadObject(theObject, Diag13)
  
 -    ## Find a better splitting of the given quadrangle.
 -    #  @param IDOfQuad   the ID of the quadrangle to be split.
 -    #  @param theCriterion  is a numerical functor, in terms of enum SMESH.FunctorType, used to
 -    #         choose a diagonal for splitting.
 -    #         Type SMESH.FunctorType._items in the Python Console to see all items.
 -    #         Note that not all items correspond to numerical functors.
 -    #  @return 1 if 1-3 diagonal is better, 2 if 2-4
 -    #          diagonal is better, 0 if error occurs.
 -    #  @ingroup l2_modif_cutquadr
      def BestSplit (self, IDOfQuad, theCriterion):
 +        """
 +        Find a better splitting of the given quadrangle.
 +
 +        Parameters:
 +                IDOfQuad:   the ID of the quadrangle to be splitted.
 +                theCriterion:  is a numerical functor, in terms of enum :class:`SMESH.FunctorType`, used to
 +                        choose a diagonal for splitting.
 +                        Note that not all items of :class:`SMESH.FunctorType` corresponds
 +                        to numerical functors.
 +
 +        Returns:
 +            * 1 if 1-3 diagonal is better, 
 +            * 2 if 2-4 diagonal is better, 
 +            * 0 if error occurs.
 +        """
          return self.editor.BestSplit(IDOfQuad, self.smeshpyD.GetFunctor(theCriterion))
  
 -    ## Split volumic elements into tetrahedrons
 -    #  @param elems either a list of elements or a mesh or a group or a submesh or a filter
 -    #  @param method  flags passing splitting method:
 -    #         smesh.Hex_5Tet, smesh.Hex_6Tet, smesh.Hex_24Tet.
 -    #         smesh.Hex_5Tet - to split the hexahedron into 5 tetrahedrons, etc.
 -    #  @ingroup l2_modif_cutquadr
      def SplitVolumesIntoTetra(self, elems, method=smeshBuilder.Hex_5Tet ):
 +        """
 +        Split volumic elements into tetrahedrons
 +
 +        Parameters:
 +                elems: either a list of elements or a :class:`mesh, sub-mesh, group or filter <SMESH.SMESH_IDSource>`
 +                method:  flags passing splitting method:
 +                        smesh.Hex_5Tet, smesh.Hex_6Tet, smesh.Hex_24Tet.
 +                        smesh.Hex_5Tet - to split the hexahedron into 5 tetrahedrons, etc.
 +        """
          unRegister = genObjUnRegister()
          if isinstance( elems, Mesh ):
              elems = elems.GetMesh()
          self.editor.SplitVolumesIntoTetra(elems, method)
          return
  
 -    ## Split bi-quadratic elements into linear ones without creation of additional nodes:
 -    #   - bi-quadratic triangle will be split into 3 linear quadrangles;
 -    #   - bi-quadratic quadrangle will be split into 4 linear quadrangles;
 -    #   - tri-quadratic hexahedron will be split into 8 linear hexahedra.
 -    #   Quadratic elements of lower dimension  adjacent to the split bi-quadratic element
 -    #   will be split in order to keep the mesh conformal.
 -    #  @param elems - elements to split: sub-meshes, groups, filters or element IDs;
 -    #         if None (default), all bi-quadratic elements will be split
 -    #  @ingroup l2_modif_cutquadr
      def SplitBiQuadraticIntoLinear(self, elems=None):
 +        """
 +        Split bi-quadratic elements into linear ones without creation of additional nodes:
 +
 +            - bi-quadratic triangle will be split into 3 linear quadrangles;
 +            - bi-quadratic quadrangle will be split into 4 linear quadrangles;
 +            - tri-quadratic hexahedron will be split into 8 linear hexahedra.
 +
 +        Quadratic elements of lower dimension  adjacent to the split bi-quadratic element
 +        will be split in order to keep the mesh conformal.
 +
 +        Parameters:
 +            elems: elements to split\: :class:`mesh, sub-mesh, group, filter <SMESH.SMESH_IDSource>` or element IDs;
 +                if None (default), all bi-quadratic elements will be split
 +        """
          unRegister = genObjUnRegister()
          if elems and isinstance( elems, list ) and isinstance( elems[0], int ):
              elems = self.editor.MakeIDSource(elems, SMESH.ALL)
              elems = [elems]
          self.editor.SplitBiQuadraticIntoLinear( elems )
  
 -    ## Split hexahedra into prisms
 -    #  @param elems either a list of elements or a mesh or a group or a submesh or a filter
 -    #  @param startHexPoint a point used to find a hexahedron for which @a facetNormal
 -    #         gives a normal vector defining facets to split into triangles.
 -    #         @a startHexPoint can be either a triple of coordinates or a vertex.
 -    #  @param facetNormal a normal to a facet to split into triangles of a
 -    #         hexahedron found by @a startHexPoint.
 -    #         @a facetNormal can be either a triple of coordinates or an edge.
 -    #  @param method  flags passing splitting method: smesh.Hex_2Prisms, smesh.Hex_4Prisms.
 -    #         smesh.Hex_2Prisms - to split the hexahedron into 2 prisms, etc.
 -    #  @param allDomains if @c False, only hexahedra adjacent to one closest
 -    #         to @a startHexPoint are split, else @a startHexPoint
 -    #         is used to find the facet to split in all domains present in @a elems.
 -    #  @ingroup l2_modif_cutquadr
      def SplitHexahedraIntoPrisms(self, elems, startHexPoint, facetNormal,
                                   method=smeshBuilder.Hex_2Prisms, allDomains=False ):
 +        """
 +        Split hexahedra into prisms
 +
 +        Parameters:
 +                elems: either a list of elements or a :class:`mesh, sub-mesh, group or filter <SMESH.SMESH_IDSource>`
 +                startHexPoint: a point used to find a hexahedron for which *facetNormal*
 +                        gives a normal vector defining facets to split into triangles.
 +                        *startHexPoint* can be either a triple of coordinates or a vertex.
 +                facetNormal: a normal to a facet to split into triangles of a
 +                        hexahedron found by *startHexPoint*.
 +                        *facetNormal* can be either a triple of coordinates or an edge.
 +                method:  flags passing splitting method: smesh.Hex_2Prisms, smesh.Hex_4Prisms.
 +                        smesh.Hex_2Prisms - to split the hexahedron into 2 prisms, etc.
 +                allDomains: if :code:`False`, only hexahedra adjacent to one closest
 +                        to *startHexPoint* are split, else *startHexPoint*
 +                        is used to find the facet to split in all domains present in *elems*.
 +        """
          # IDSource
          unRegister = genObjUnRegister()
          if isinstance( elems, Mesh ):
  
          self.editor.SplitHexahedraIntoPrisms(elems, startHexPoint, facetNormal, method, allDomains)
  
 -    ## Split quadrangle faces near triangular facets of volumes
 -    #
 -    #  @ingroup l2_modif_cutquadr
      def SplitQuadsNearTriangularFacets(self):
 +        """
 +        Split quadrangle faces near triangular facets of volumes
 +        """
          faces_array = self.GetElementsByType(SMESH.FACE)
          for face_id in faces_array:
              if self.GetElemNbNodes(face_id) == 4: # quadrangle
                                          isVolumeFound = True
                                          self.SplitQuad([face_id], True) # diagonal 1-3
  
 -    ## @brief Splits hexahedrons into tetrahedrons.
 -    #
 -    #  This operation uses pattern mapping functionality for splitting.
 -    #  @param theObject the object from which the list of hexahedrons is taken; this is mesh, submesh or group.
 -    #  @param theNode000,theNode001 within the range [0,7]; gives the orientation of the
 -    #         pattern relatively each hexahedron: the (0,0,0) key-point of the pattern
 -    #         will be mapped into <VAR>theNode000</VAR>-th node of each volume, the (0,0,1)
 -    #         key-point will be mapped into <VAR>theNode001</VAR>-th node of each volume.
 -    #         The (0,0,0) key-point of the used pattern corresponds to a non-split corner.
 -    #  @return TRUE in case of success, FALSE otherwise.
 -    #  @ingroup l2_modif_cutquadr
      def SplitHexaToTetras (self, theObject, theNode000, theNode001):
 -        # Pattern:     5.---------.6
 -        #              /|#*      /|
 -        #             / | #*    / |
 -        #            /  |  # * /  |
 -        #           /   |   # /*  |
 -        # (0,0,1) 4.---------.7 * |
 -        #          |#*  |1   | # *|
 -        #          | # *.----|---#.2
 -        #          |  #/ *   |   /
 -        #          |  /#  *  |  /
 -        #          | /   # * | /
 -        #          |/      #*|/
 -        # (0,0,0) 0.---------.3
 +        """
 +        Split hexahedrons into tetrahedrons.
 +
 +        This operation uses :doc:`pattern_mapping` functionality for splitting.
 +
 +        Parameters:
 +                theObject: the object from which the list of hexahedrons is taken; 
 +                        this is :class:`mesh, sub-mesh, group or filter <SMESH.SMESH_IDSource>`
 +                theNode000,theNode001: within the range [0,7]; gives the orientation of the
 +                        pattern relatively each hexahedron: the (0,0,0) key-point of the pattern
 +                        will be mapped into *theNode000*-th node of each volume, the (0,0,1)
 +                        key-point will be mapped into *theNode001*-th node of each volume.
 +                        The (0,0,0) key-point of the used pattern corresponds to a non-split corner.
 +
 +        Returns:
 +            True in case of success, False otherwise.
 +        """
 +#    Pattern:
 +#                     5.---------.6
 +#                    /|#*      /|
 +#                   / | #*    / |
 +#                  /  |  # * /  |
 +#                 /   |   # /*  |
 +#       (0,0,1) 4.---------.7 * |
 +#                |#*  |1   | # *|
 +#                | # *.----|---#.2
 +#                |  #/ *   |   /
 +#                |  /#  *  |  /
 +#                | /   # * | /
 +#                |/      #*|/
 +#        (0,0,0) 0.---------.3
          pattern_tetra = "!!! Nb of points: \n 8 \n\
          !!! Points: \n\
          0 0 0  !- 0 \n\
          pattern = self.smeshpyD.GetPattern()
          isDone  = pattern.LoadFromFile(pattern_tetra)
          if not isDone:
-             print 'Pattern.LoadFromFile :', pattern.GetErrorCode()
+             print('Pattern.LoadFromFile :', pattern.GetErrorCode())
              return isDone
  
          pattern.ApplyToHexahedrons(self.mesh, theObject.GetIDs(), theNode000, theNode001)
          isDone = pattern.MakeMesh(self.mesh, False, False)
-         if not isDone: print 'Pattern.MakeMesh :', pattern.GetErrorCode()
+         if not isDone: print('Pattern.MakeMesh :', pattern.GetErrorCode())
  
          # split quafrangle faces near triangular facets of volumes
          self.SplitQuadsNearTriangularFacets()
  
          return isDone
  
 -    ## @brief Split hexahedrons into prisms.
 -    #
 -    #  Uses the pattern mapping functionality for splitting.
 -    #  @param theObject the object (mesh, submesh or group) from where the list of hexahedrons is taken;
 -    #  @param theNode000,theNode001 (within the range [0,7]) gives the orientation of the
 -    #         pattern relatively each hexahedron: keypoint (0,0,0) of the pattern
 -    #         will be mapped into the <VAR>theNode000</VAR>-th node of each volume, keypoint (0,0,1)
 -    #         will be mapped into the <VAR>theNode001</VAR>-th node of each volume.
 -    #         Edge (0,0,0)-(0,0,1) of used pattern connects two not split corners.
 -    #  @return TRUE in case of success, FALSE otherwise.
 -    #  @ingroup l2_modif_cutquadr
      def SplitHexaToPrisms (self, theObject, theNode000, theNode001):
 -        # Pattern:     5.---------.6
 -        #              /|#       /|
 -        #             / | #     / |
 -        #            /  |  #   /  |
 -        #           /   |   # /   |
 -        # (0,0,1) 4.---------.7   |
 -        #          |    |    |    |
 -        #          |   1.----|----.2
 -        #          |   / *   |   /
 -        #          |  /   *  |  /
 -        #          | /     * | /
 -        #          |/       *|/
 -        # (0,0,0) 0.---------.3
 +        """
 +        Split hexahedrons into prisms.
 +
 +        Uses the :doc:`pattern_mapping` functionality for splitting.
 +
 +        Parameters:
 +                theObject: the object (:class:`mesh, sub-mesh, group or filter <SMESH.SMESH_IDSource>`) from where the list of hexahedrons is taken;
 +                theNode000,theNode001: (within the range [0,7]) gives the orientation of the
 +                        pattern relatively each hexahedron: keypoint (0,0,0) of the pattern
 +                        will be mapped into the *theNode000* -th node of each volume, keypoint (0,0,1)
 +                        will be mapped into the *theNode001* -th node of each volume.
 +                        Edge (0,0,0)-(0,0,1) of used pattern connects two not split corners.
 +
 +        Returns:
 +            True in case of success, False otherwise.
 +        """
 +#        Pattern:     5.---------.6
 +#                     /|#       /|
 +#                    / | #     / |
 +#                   /  |  #   /  |
 +#                  /   |   # /   |
 +#        (0,0,1) 4.---------.7   |
 +#                 |    |    |    |
 +#                 |   1.----|----.2
 +#                 |   / *   |   /
 +#                 |  /   *  |  /
 +#                 | /     * | /
 +#                 |/       *|/
 +#        (0,0,0) 0.---------.3
          pattern_prism = "!!! Nb of points: \n 8 \n\
          !!! Points: \n\
          0 0 0  !- 0 \n\
          pattern = self.smeshpyD.GetPattern()
          isDone  = pattern.LoadFromFile(pattern_prism)
          if not isDone:
-             print 'Pattern.LoadFromFile :', pattern.GetErrorCode()
+             print('Pattern.LoadFromFile :', pattern.GetErrorCode())
              return isDone
  
          pattern.ApplyToHexahedrons(self.mesh, theObject.GetIDs(), theNode000, theNode001)
          isDone = pattern.MakeMesh(self.mesh, False, False)
-         if not isDone: print 'Pattern.MakeMesh :', pattern.GetErrorCode()
+         if not isDone: print('Pattern.MakeMesh :', pattern.GetErrorCode())
  
          # Split quafrangle faces near triangular facets of volumes
          self.SplitQuadsNearTriangularFacets()
  
          return isDone
  
 -    ## Smooth elements
 -    #  @param IDsOfElements the list if ids of elements to smooth
 -    #  @param IDsOfFixedNodes the list of ids of fixed nodes.
 -    #  Note that nodes built on edges and boundary nodes are always fixed.
 -    #  @param MaxNbOfIterations the maximum number of iterations
 -    #  @param MaxAspectRatio varies in range [1.0, inf]
 -    #  @param Method is either Laplacian (smesh.LAPLACIAN_SMOOTH)
 -    #         or Centroidal (smesh.CENTROIDAL_SMOOTH)
 -    #  @return TRUE in case of success, FALSE otherwise.
 -    #  @ingroup l2_modif_smooth
      def Smooth(self, IDsOfElements, IDsOfFixedNodes,
                 MaxNbOfIterations, MaxAspectRatio, Method):
 +        """
 +        Smooth elements
 +
 +        Parameters:
 +                IDsOfElements: the list if ids of elements to smooth
 +                IDsOfFixedNodes: the list of ids of fixed nodes.
 +                        Note that nodes built on edges and boundary nodes are always fixed.
 +                MaxNbOfIterations: the maximum number of iterations
 +                MaxAspectRatio: varies in range [1.0, inf]
 +                Method: is either Laplacian (smesh.LAPLACIAN_SMOOTH)
 +                        or Centroidal (smesh.CENTROIDAL_SMOOTH)
 +
 +        Returns:
 +            True in case of success, False otherwise.
 +        """
 +
          if IDsOfElements == []:
              IDsOfElements = self.GetElementsId()
          MaxNbOfIterations,MaxAspectRatio,Parameters,hasVars = ParseParameters(MaxNbOfIterations,MaxAspectRatio)
          return self.editor.Smooth(IDsOfElements, IDsOfFixedNodes,
                                    MaxNbOfIterations, MaxAspectRatio, Method)
  
 -    ## Smooth elements which belong to the given object
 -    #  @param theObject the object to smooth
 -    #  @param IDsOfFixedNodes the list of ids of fixed nodes.
 -    #  Note that nodes built on edges and boundary nodes are always fixed.
 -    #  @param MaxNbOfIterations the maximum number of iterations
 -    #  @param MaxAspectRatio varies in range [1.0, inf]
 -    #  @param Method is either Laplacian (smesh.LAPLACIAN_SMOOTH)
 -    #         or Centroidal (smesh.CENTROIDAL_SMOOTH)
 -    #  @return TRUE in case of success, FALSE otherwise.
 -    #  @ingroup l2_modif_smooth
      def SmoothObject(self, theObject, IDsOfFixedNodes,
                       MaxNbOfIterations, MaxAspectRatio, Method):
 +        """
 +        Smooth elements which belong to the given object
 +
 +        Parameters:
 +                theObject: the object to smooth
 +                IDsOfFixedNodes: the list of ids of fixed nodes.
 +                        Note that nodes built on edges and boundary nodes are always fixed.
 +                MaxNbOfIterations: the maximum number of iterations
 +                MaxAspectRatio: varies in range [1.0, inf]
 +                Method: is either Laplacian (smesh.LAPLACIAN_SMOOTH)
 +                        or Centroidal (smesh.CENTROIDAL_SMOOTH)
 +
 +        Returns:
 +            True in case of success, False otherwise.
 +        """
 +
          if ( isinstance( theObject, Mesh )):
              theObject = theObject.GetMesh()
          return self.editor.SmoothObject(theObject, IDsOfFixedNodes,
                                          MaxNbOfIterations, MaxAspectRatio, Method)
  
 -    ## Parametrically smooth the given elements
 -    #  @param IDsOfElements the list if ids of elements to smooth
 -    #  @param IDsOfFixedNodes the list of ids of fixed nodes.
 -    #  Note that nodes built on edges and boundary nodes are always fixed.
 -    #  @param MaxNbOfIterations the maximum number of iterations
 -    #  @param MaxAspectRatio varies in range [1.0, inf]
 -    #  @param Method is either Laplacian (smesh.LAPLACIAN_SMOOTH)
 -    #         or Centroidal (smesh.CENTROIDAL_SMOOTH)
 -    #  @return TRUE in case of success, FALSE otherwise.
 -    #  @ingroup l2_modif_smooth
      def SmoothParametric(self, IDsOfElements, IDsOfFixedNodes,
                           MaxNbOfIterations, MaxAspectRatio, Method):
 +        """
 +        Parametrically smooth the given elements
 +
 +        Parameters:
 +                IDsOfElements: the list if ids of elements to smooth
 +                IDsOfFixedNodes: the list of ids of fixed nodes.
 +                        Note that nodes built on edges and boundary nodes are always fixed.
 +                MaxNbOfIterations: the maximum number of iterations
 +                MaxAspectRatio: varies in range [1.0, inf]
 +                Method: is either Laplacian (smesh.LAPLACIAN_SMOOTH)
 +                        or Centroidal (smesh.CENTROIDAL_SMOOTH)
 +
 +        Returns:
 +            True in case of success, False otherwise.
 +        """
 +
          if IDsOfElements == []:
              IDsOfElements = self.GetElementsId()
          MaxNbOfIterations,MaxAspectRatio,Parameters,hasVars = ParseParameters(MaxNbOfIterations,MaxAspectRatio)
          return self.editor.SmoothParametric(IDsOfElements, IDsOfFixedNodes,
                                              MaxNbOfIterations, MaxAspectRatio, Method)
  
 -    ## Parametrically smooth the elements which belong to the given object
 -    #  @param theObject the object to smooth
 -    #  @param IDsOfFixedNodes the list of ids of fixed nodes.
 -    #  Note that nodes built on edges and boundary nodes are always fixed.
 -    #  @param MaxNbOfIterations the maximum number of iterations
 -    #  @param MaxAspectRatio varies in range [1.0, inf]
 -    #  @param Method is either Laplacian (smesh.LAPLACIAN_SMOOTH)
 -    #         or Centroidal (smesh.CENTROIDAL_SMOOTH)
 -    #  @return TRUE in case of success, FALSE otherwise.
 -    #  @ingroup l2_modif_smooth
      def SmoothParametricObject(self, theObject, IDsOfFixedNodes,
                                 MaxNbOfIterations, MaxAspectRatio, Method):
 +        """
 +        Parametrically smooth the elements which belong to the given object
 +
 +        Parameters:
 +                theObject: the object to smooth
 +                IDsOfFixedNodes: the list of ids of fixed nodes.
 +                        Note that nodes built on edges and boundary nodes are always fixed.
 +                MaxNbOfIterations: the maximum number of iterations
 +                MaxAspectRatio: varies in range [1.0, inf]
 +                Method: is either Laplacian (smesh.LAPLACIAN_SMOOTH)
 +                        or Centroidal (smesh.CENTROIDAL_SMOOTH)
 +
 +        Returns:
 +            True in case of success, False otherwise.
 +        """
 +
          if ( isinstance( theObject, Mesh )):
              theObject = theObject.GetMesh()
          return self.editor.SmoothParametricObject(theObject, IDsOfFixedNodes,
                                                    MaxNbOfIterations, MaxAspectRatio, Method)
  
 -    ## Convert the mesh to quadratic or bi-quadratic, deletes old elements, replacing
 -    #  them with quadratic with the same id.
 -    #  @param theForce3d new node creation method:
 -    #         0 - the medium node lies at the geometrical entity from which the mesh element is built
 -    #         1 - the medium node lies at the middle of the line segments connecting two nodes of a mesh element
 -    #  @param theSubMesh a group or a sub-mesh to convert; WARNING: in this case the mesh can become not conformal
 -    #  @param theToBiQuad If True, converts the mesh to bi-quadratic
 -    #  @return SMESH.ComputeError which can hold a warning
 -    #  @ingroup l2_modif_tofromqu
      def ConvertToQuadratic(self, theForce3d=False, theSubMesh=None, theToBiQuad=False):
 +        """
 +        Convert the mesh to quadratic or bi-quadratic, deletes old elements, replacing
 +        them with quadratic with the same id.
 +
 +        Parameters:
 +                theForce3d: method of new node creation:
 +
 +                  * False - the medium node lies at the geometrical entity from which the mesh element is built
 +                  * True - the medium node lies at the middle of the line segments connecting two nodes of a mesh element
 +                theSubMesh: a :class:`sub-mesh, group or filter <SMESH.SMESH_IDSource>` to convert
 +                theToBiQuad: If True, converts the mesh to bi-quadratic
 +
 +        Returns:
 +            :class:`SMESH.ComputeError` which can hold a warning
 +
 +        Warning:
 +            If *theSubMesh* is provided, the mesh can become non-conformal
 +        """
 +
          if isinstance( theSubMesh, Mesh ):
              theSubMesh = theSubMesh.mesh
          if theToBiQuad:
                  self.editor.ConvertToQuadratic(theForce3d)
          error = self.editor.GetLastError()
          if error and error.comment:
-             print error.comment
+             print(error.comment)
          return error
  
 -    ## Convert the mesh from quadratic to ordinary,
 -    #  deletes old quadratic elements, \n replacing
 -    #  them with ordinary mesh elements with the same id.
 -    #  @param theSubMesh a group or a sub-mesh to convert; WARNING: in this case the mesh can become not conformal
 -    #  @ingroup l2_modif_tofromqu
      def ConvertFromQuadratic(self, theSubMesh=None):
 +        """
 +        Convert the mesh from quadratic to ordinary,
 +        deletes old quadratic elements,
 +        replacing them with ordinary mesh elements with the same id.
 +
 +        Parameters:
 +            theSubMesh: a :class:`sub-mesh, group or filter <SMESH.SMESH_IDSource>` to convert
 +
 +        Warning:
 +            If *theSubMesh* is provided, the mesh can become non-conformal
 +        """
 +
          if theSubMesh:
              self.editor.ConvertFromQuadraticObject(theSubMesh)
          else:
              return self.editor.ConvertFromQuadratic()
  
 -    ## Create 2D mesh as skin on boundary faces of a 3D mesh
 -    #  @return TRUE if operation has been completed successfully, FALSE otherwise
 -    #  @ingroup l2_modif_add
      def Make2DMeshFrom3D(self):
 +        """
 +        Create 2D mesh as skin on boundary faces of a 3D mesh
 +
 +        Returns:
 +            True if operation has been completed successfully, False otherwise
 +        """
 +
          return self.editor.Make2DMeshFrom3D()
  
 -    ## Create missing boundary elements
 -    #  @param elements - elements whose boundary is to be checked:
 -    #                    mesh, group, sub-mesh or list of elements
 -    #   if elements is mesh, it must be the mesh whose MakeBoundaryMesh() is called
 -    #  @param dimension - defines type of boundary elements to create, either of
 -    #                     { SMESH.BND_2DFROM3D, SMESH.BND_1DFROM3D, SMESH.BND_1DFROM2D }
 -    #    SMESH.BND_1DFROM3D create mesh edges on all borders of free facets of 3D cells
 -    #  @param groupName - a name of group to store created boundary elements in,
 -    #                     "" means not to create the group
 -    #  @param meshName - a name of new mesh to store created boundary elements in,
 -    #                     "" means not to create the new mesh
 -    #  @param toCopyElements - if true, the checked elements will be copied into
 -    #     the new mesh else only boundary elements will be copied into the new mesh
 -    #  @param toCopyExistingBondary - if true, not only new but also pre-existing
 -    #     boundary elements will be copied into the new mesh
 -    #  @return tuple (mesh, group) where boundary elements were added to
 -    #  @ingroup l2_modif_add
      def MakeBoundaryMesh(self, elements, dimension=SMESH.BND_2DFROM3D, groupName="", meshName="",
                           toCopyElements=False, toCopyExistingBondary=False):
 +        """
 +        Create missing boundary elements
 +
 +        Parameters:
 +                elements: elements whose boundary is to be checked:
 +                        :class:`mesh, sub-mesh, group, filter <SMESH.SMESH_IDSource>` or list of elements.
 +                        If *elements* is mesh, it must be the mesh whose MakeBoundaryMesh() is called
 +                dimension: defines type of boundary elements to create, either of
 +                        { SMESH.BND_2DFROM3D, SMESH.BND_1DFROM3D, SMESH.BND_1DFROM2D }.
 +                        SMESH.BND_1DFROM3D create mesh edges on all borders of free facets of 3D cells
 +                groupName: a name of group to store created boundary elements in,
 +                        "" means not to create the group
 +                meshName: a name of new mesh to store created boundary elements in,
 +                        "" means not to create the new mesh
 +                toCopyElements: if True, the checked elements will be copied into
 +                        the new mesh else only boundary elements will be copied into the new mesh
 +                toCopyExistingBondary: if True, not only new but also pre-existing
 +                        boundary elements will be copied into the new mesh
 +
 +        Returns:
 +            tuple (:class:`Mesh`, :class:`group <SMESH.SMESH_Group>`) where boundary elements were added to
 +        """
 +
          unRegister = genObjUnRegister()
          if isinstance( elements, Mesh ):
              elements = elements.GetMesh()
          if mesh: mesh = self.smeshpyD.Mesh(mesh)
          return mesh, group
  
 -    ##
 -    # @brief Create missing boundary elements around either the whole mesh or
 -    #    groups of elements
 -    #  @param dimension - defines type of boundary elements to create, either of
 -    #                     { SMESH.BND_2DFROM3D, SMESH.BND_1DFROM3D, SMESH.BND_1DFROM2D }
 -    #  @param groupName - a name of group to store all boundary elements in,
 -    #    "" means not to create the group
 -    #  @param meshName - a name of a new mesh, which is a copy of the initial
 -    #    mesh + created boundary elements; "" means not to create the new mesh
 -    #  @param toCopyAll - if true, the whole initial mesh will be copied into
 -    #    the new mesh else only boundary elements will be copied into the new mesh
 -    #  @param groups - groups of elements to make boundary around
 -    #  @retval tuple( long, mesh, groups )
 -    #                 long - number of added boundary elements
 -    #                 mesh - the mesh where elements were added to
 -    #                 group - the group of boundary elements or None
 -    #
 -    #  @ingroup l2_modif_add
      def MakeBoundaryElements(self, dimension=SMESH.BND_2DFROM3D, groupName="", meshName="",
                               toCopyAll=False, groups=[]):
 +        """
 +        Create missing boundary elements around either the whole mesh or
 +        groups of elements
 +
 +        Parameters:
 +                dimension: defines type of boundary elements to create, either of
 +                        { SMESH.BND_2DFROM3D, SMESH.BND_1DFROM3D, SMESH.BND_1DFROM2D }
 +                groupName: a name of group to store all boundary elements in,
 +                        "" means not to create the group
 +                meshName: a name of a new mesh, which is a copy of the initial
 +                        mesh + created boundary elements; "" means not to create the new mesh
 +                toCopyAll: if True, the whole initial mesh will be copied into
 +                        the new mesh else only boundary elements will be copied into the new mesh
 +                groups: list of :class:`sub-meshes, groups or filters <SMESH.SMESH_IDSource>` of elements to make boundary around
 +
 +        Returns:
 +                tuple( long, mesh, groups )
 +                       - long - number of added boundary elements
 +                       - mesh - the :class:`Mesh` where elements were added to
 +                       - group - the :class:`group <SMESH.SMESH_Group>` of boundary elements or None
 +        """
 +
          nb, mesh, group = self.editor.MakeBoundaryElements(dimension,groupName,meshName,
                                                             toCopyAll,groups)
          if mesh: mesh = self.smeshpyD.Mesh(mesh)
          return nb, mesh, group
  
 -    ## Renumber mesh nodes (Obsolete, does nothing)
 -    #  @ingroup l2_modif_renumber
      def RenumberNodes(self):
 +        """
 +        Renumber mesh nodes to remove unused node IDs
 +        """
          self.editor.RenumberNodes()
  
 -    ## Renumber mesh elements (Obsole, does nothing)
 -    #  @ingroup l2_modif_renumber
      def RenumberElements(self):
 +        """
 +        Renumber mesh elements to remove unused element IDs
 +        """
          self.editor.RenumberElements()
  
 -    ## Private method converting \a arg into a list of SMESH_IdSource's
      def _getIdSourceList(self, arg, idType, unRegister):
 +        """
 +        Private method converting *arg* into a list of :class:`SMESH.SMESH_IDSource`
 +        """
          if arg and isinstance( arg, list ):
              if isinstance( arg[0], int ):
                  arg = self.GetIDSource( arg, idType )
              arg = [arg]
          return arg
  
 -    ## Generate new elements by rotation of the given elements and nodes around the axis
 -    #  @param nodes - nodes to revolve: a list including ids, groups, sub-meshes or a mesh
 -    #  @param edges - edges to revolve: a list including ids, groups, sub-meshes or a mesh
 -    #  @param faces - faces to revolve: a list including ids, groups, sub-meshes or a mesh
 -    #  @param Axis the axis of rotation: AxisStruct, line (geom object) or [x,y,z,dx,dy,dz]
 -    #  @param AngleInRadians the angle of Rotation (in radians) or a name of variable
 -    #         which defines angle in degrees
 -    #  @param NbOfSteps the number of steps
 -    #  @param Tolerance tolerance
 -    #  @param MakeGroups forces the generation of new groups from existing ones
 -    #  @param TotalAngle gives meaning of AngleInRadians: if True then it is an angular size
 -    #                    of all steps, else - size of each step
 -    #  @return the list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
 -    #  @ingroup l2_modif_extrurev
      def RotationSweepObjects(self, nodes, edges, faces, Axis, AngleInRadians, NbOfSteps, Tolerance,
                               MakeGroups=False, TotalAngle=False):
 +        """
 +        Generate new elements by rotation of the given elements and nodes around the axis
 +
 +        Parameters:
 +                nodes: nodes to revolve: a list including ids, :class:`a mesh, sub-meshes, groups or filters <SMESH.SMESH_IDSource>`
 +                edges: edges to revolve: a list including ids, :class:`a mesh, sub-meshes, groups or filters <SMESH.SMESH_IDSource>`
 +                faces: faces to revolve: a list including ids, :class:`a mesh, sub-meshes, groups or filters <SMESH.SMESH_IDSource>`
 +                Axis: the axis of rotation: :class:`SMESH.AxisStruct`, line (geom object) or [x,y,z,dx,dy,dz]
 +                AngleInRadians: the angle of Rotation (in radians) or a name of variable
 +                        which defines angle in degrees
 +                NbOfSteps: the number of steps
 +                Tolerance: tolerance
 +                MakeGroups: forces the generation of new groups from existing ones
 +                TotalAngle: gives meaning of AngleInRadians: if True then it is an angular size
 +                        of all steps, else - size of each step
 +
 +        Returns:
 +            the list of created :class:`groups <SMESH.SMESH_GroupBase>` if *MakeGroups* == True, empty list otherwise
 +        """
 +
          unRegister = genObjUnRegister()
          nodes = self._getIdSourceList( nodes, SMESH.NODE, unRegister )
          edges = self._getIdSourceList( edges, SMESH.EDGE, unRegister )
                                                   Axis, AngleInRadians,
                                                   NbOfSteps, Tolerance, MakeGroups)
  
 -    ## Generate new elements by rotation of the elements around the axis
 -    #  @param IDsOfElements the list of ids of elements to sweep
 -    #  @param Axis the axis of rotation, AxisStruct or line(geom object)
 -    #  @param AngleInRadians the angle of Rotation (in radians) or a name of variable which defines angle in degrees
 -    #  @param NbOfSteps the number of steps
 -    #  @param Tolerance tolerance
 -    #  @param MakeGroups forces the generation of new groups from existing ones
 -    #  @param TotalAngle gives meaning of AngleInRadians: if True then it is an angular size
 -    #                    of all steps, else - size of each step
 -    #  @return the list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
 -    #  @ingroup l2_modif_extrurev
      def RotationSweep(self, IDsOfElements, Axis, AngleInRadians, NbOfSteps, Tolerance,
                        MakeGroups=False, TotalAngle=False):
 +        """
 +        Generate new elements by rotation of the elements around the axis
 +
 +        Parameters:
 +            IDsOfElements: the list of ids of elements to sweep
 +            Axis: the axis of rotation, :class:`SMESH.AxisStruct` or line(geom object)
 +            AngleInRadians: the angle of Rotation (in radians) or a name of variable which defines angle in degrees
 +            NbOfSteps: the number of steps
 +            Tolerance: tolerance
 +            MakeGroups: forces the generation of new groups from existing ones
 +            TotalAngle: gives meaning of AngleInRadians: if True then it is an angular size
 +                of all steps, else - size of each step
 +
 +        Returns:
 +            the list of created :class:`groups <SMESH.SMESH_GroupBase>` if *MakeGroups* == True, empty list otherwise
 +        """
 +
          return self.RotationSweepObjects([], IDsOfElements, IDsOfElements, Axis,
                                           AngleInRadians, NbOfSteps, Tolerance,
                                           MakeGroups, TotalAngle)
  
 -    ## Generate new elements by rotation of the elements of object around the axis
 -    #  @param theObject object which elements should be sweeped.
 -    #                   It can be a mesh, a sub mesh or a group.
 -    #  @param Axis the axis of rotation, AxisStruct or line(geom object)
 -    #  @param AngleInRadians the angle of Rotation
 -    #  @param NbOfSteps number of steps
 -    #  @param Tolerance tolerance
 -    #  @param MakeGroups forces the generation of new groups from existing ones
 -    #  @param TotalAngle gives meaning of AngleInRadians: if True then it is an angular size
 -    #                    of all steps, else - size of each step
 -    #  @return the list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
 -    #  @ingroup l2_modif_extrurev
      def RotationSweepObject(self, theObject, Axis, AngleInRadians, NbOfSteps, Tolerance,
                              MakeGroups=False, TotalAngle=False):
 +        """
 +        Generate new elements by rotation of the elements of object around the axis
 +        theObject object which elements should be sweeped.
 +        It can be a mesh, a sub mesh or a group.
 +
 +        Parameters:
 +            Axis: the axis of rotation, :class:`SMESH.AxisStruct` or line(geom object)
 +            AngleInRadians: the angle of Rotation
 +            NbOfSteps: number of steps
 +            Tolerance: tolerance
 +            MakeGroups: forces the generation of new groups from existing ones
 +            TotalAngle: gives meaning of AngleInRadians: if True then it is an angular size
 +                of all steps, else - size of each step
 +
 +        Returns:
 +            the list of created :class:`groups <SMESH.SMESH_GroupBase>` if *MakeGroups* == True, empty list otherwise
 +        """
 +
          return self.RotationSweepObjects( [], theObject, theObject, Axis,
                                            AngleInRadians, NbOfSteps, Tolerance,
                                            MakeGroups, TotalAngle )
  
 -    ## Generate new elements by rotation of the elements of object around the axis
 -    #  @param theObject object which elements should be sweeped.
 -    #                   It can be a mesh, a sub mesh or a group.
 -    #  @param Axis the axis of rotation, AxisStruct or line(geom object)
 -    #  @param AngleInRadians the angle of Rotation
 -    #  @param NbOfSteps number of steps
 -    #  @param Tolerance tolerance
 -    #  @param MakeGroups forces the generation of new groups from existing ones
 -    #  @param TotalAngle gives meaning of AngleInRadians: if True then it is an angular size
 -    #                    of all steps, else - size of each step
 -    #  @return the list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
 -    #  @ingroup l2_modif_extrurev
      def RotationSweepObject1D(self, theObject, Axis, AngleInRadians, NbOfSteps, Tolerance,
                                MakeGroups=False, TotalAngle=False):
 +        """
 +        Generate new elements by rotation of the elements of object around the axis
 +        theObject object which elements should be sweeped.
 +        It can be a mesh, a sub mesh or a group.
 +
 +        Parameters:
 +            Axis: the axis of rotation, :class:`SMESH.AxisStruct` or line(geom object)
 +            AngleInRadians: the angle of Rotation
 +            NbOfSteps: number of steps
 +            Tolerance: tolerance
 +            MakeGroups: forces the generation of new groups from existing ones
 +            TotalAngle: gives meaning of AngleInRadians: if True then it is an angular size
 +                of all steps, else - size of each step
 +
 +        Returns:
 +            the list of created :class:`groups <SMESH.SMESH_GroupBase>` if *MakeGroups* == True, 
 +            empty list otherwise
 +        """
 +
          return self.RotationSweepObjects([],theObject,[], Axis,
                                           AngleInRadians, NbOfSteps, Tolerance,
                                           MakeGroups, TotalAngle)
  
 -    ## Generate new elements by rotation of the elements of object around the axis
 -    #  @param theObject object which elements should be sweeped.
 -    #                   It can be a mesh, a sub mesh or a group.
 -    #  @param Axis the axis of rotation, AxisStruct or line(geom object)
 -    #  @param AngleInRadians the angle of Rotation
 -    #  @param NbOfSteps number of steps
 -    #  @param Tolerance tolerance
 -    #  @param MakeGroups forces the generation of new groups from existing ones
 -    #  @param TotalAngle gives meaning of AngleInRadians: if True then it is an angular size
 -    #                    of all steps, else - size of each step
 -    #  @return the list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
 -    #  @ingroup l2_modif_extrurev
      def RotationSweepObject2D(self, theObject, Axis, AngleInRadians, NbOfSteps, Tolerance,
                                MakeGroups=False, TotalAngle=False):
 +        """
 +        Generate new elements by rotation of the elements of object around the axis
 +        theObject object which elements should be sweeped.
 +        It can be a mesh, a sub mesh or a group.
 +
 +        Parameters:
 +            Axis: the axis of rotation, :class:`SMESH.AxisStruct` or line(geom object)
 +            AngleInRadians: the angle of Rotation
 +            NbOfSteps: number of steps
 +            Tolerance: tolerance
 +            MakeGroups: forces the generation of new groups from existing ones
 +            TotalAngle: gives meaning of AngleInRadians: if True then it is an angular size
 +                of all steps, else - size of each step
 +
 +        Returns:
 +            the list of created :class:`groups <SMESH.SMESH_GroupBase>` if *MakeGroups* == True, empty list otherwise
 +        """
 +
          return self.RotationSweepObjects([],[],theObject, Axis, AngleInRadians,
                                           NbOfSteps, Tolerance, MakeGroups, TotalAngle)
  
 -    ## Generate new elements by extrusion of the given elements and nodes
 -    #  @param nodes nodes to extrude: a list including ids, groups, sub-meshes or a mesh
 -    #  @param edges edges to extrude: a list including ids, groups, sub-meshes or a mesh
 -    #  @param faces faces to extrude: a list including ids, groups, sub-meshes or a mesh
 -    #  @param StepVector vector or DirStruct or 3 vector components, defining
 -    #         the direction and value of extrusion for one step (the total extrusion
 -    #         length will be NbOfSteps * ||StepVector||)
 -    #  @param NbOfSteps the number of steps
 -    #  @param MakeGroups forces the generation of new groups from existing ones
 -    #  @param scaleFactors optional scale factors to apply during extrusion
 -    #  @param linearVariation if @c True, scaleFactors are spread over all @a scaleFactors,
 -    #         else scaleFactors[i] is applied to nodes at the i-th extrusion step
 -    #  @param basePoint optional scaling center; if not provided, a gravity center of
 -    #         nodes and elements being extruded is used as the scaling center.
 -    #         It can be either
 -    #         - a list of tree components of the point or
 -    #         - a node ID or
 -    #         - a GEOM point
 -    #  @return the list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
 -    #  @ingroup l2_modif_extrurev
 -    #  @ref tui_extrusion example
      def ExtrusionSweepObjects(self, nodes, edges, faces, StepVector, NbOfSteps, MakeGroups=False,
                                scaleFactors=[], linearVariation=False, basePoint=[] ):
 +        """
 +        Generate new elements by extrusion of the given elements and nodes
 +
 +        Parameters:
 +            nodes: nodes to extrude: a list including ids, :class:`a mesh, sub-meshes, groups or filters <SMESH.SMESH_IDSource>`
 +            edges: edges to extrude: a list including ids, :class:`a mesh, sub-meshes, groups or filters <SMESH.SMESH_IDSource>`
 +            faces: faces to extrude: a list including ids, :class:`a mesh, sub-meshes, groups or filters <SMESH.SMESH_IDSource>`
 +            StepVector: vector or :class:`SMESH.DirStruct` or 3 vector components, defining
 +                the direction and value of extrusion for one step (the total extrusion
 +                length will be NbOfSteps * ||StepVector||)
 +            NbOfSteps: the number of steps
 +            MakeGroups: forces the generation of new groups from existing ones
 +            scaleFactors: optional scale factors to apply during extrusion
 +            linearVariation: if *True*, scaleFactors are spread over all *scaleFactors*,
 +                else scaleFactors[i] is applied to nodes at the i-th extrusion step
 +            basePoint: optional scaling center; if not provided, a gravity center of
 +                nodes and elements being extruded is used as the scaling center.
 +                It can be either
 +
 +                        - a list of tree components of the point or
 +                        - a node ID or
 +                        - a GEOM point
 +        Returns:
 +            the list of created :class:`groups <SMESH.SMESH_GroupBase>` if *MakeGroups* == True, empty list otherwise
 +
 +        Example: :ref:`tui_extrusion`
 +        """
          unRegister = genObjUnRegister()
          nodes = self._getIdSourceList( nodes, SMESH.NODE, unRegister )
          edges = self._getIdSourceList( edges, SMESH.EDGE, unRegister )
          if isinstance( basePoint, int):
              xyz = self.GetNodeXYZ( basePoint )
              if not xyz:
-                 raise RuntimeError, "Invalid node ID: %s" % basePoint
+                 raise RuntimeError("Invalid node ID: %s" % basePoint)
              basePoint = xyz
          if isinstance( basePoint, geomBuilder.GEOM._objref_GEOM_Object ):
              basePoint = self.geompyD.PointCoordinates( basePoint )
                                                    MakeGroups)
  
  
 -    ## Generate new elements by extrusion of the elements with given ids
 -    #  @param IDsOfElements the list of ids of elements or nodes for extrusion
 -    #  @param StepVector vector or DirStruct or 3 vector components, defining
 -    #         the direction and value of extrusion for one step (the total extrusion
 -    #         length will be NbOfSteps * ||StepVector||)
 -    #  @param NbOfSteps the number of steps
 -    #  @param MakeGroups forces the generation of new groups from existing ones
 -    #  @param IsNodes is True if elements with given ids are nodes
 -    #  @return the list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
 -    #  @ingroup l2_modif_extrurev
 -    #  @ref tui_extrusion example
      def ExtrusionSweep(self, IDsOfElements, StepVector, NbOfSteps, MakeGroups=False, IsNodes = False):
 +        """
 +        Generate new elements by extrusion of the elements with given ids
 +
 +        Parameters:
 +            IDsOfElements: the list of ids of elements or nodes for extrusion
 +            StepVector: vector or :class:`SMESH.DirStruct` or 3 vector components, defining
 +                the direction and value of extrusion for one step (the total extrusion
 +                length will be NbOfSteps * ||StepVector||)
 +            NbOfSteps: the number of steps
 +            MakeGroups: forces the generation of new groups from existing ones
 +            IsNodes: is True if elements with given ids are nodes
 +
 +        Returns:
 +            the list of created :class:`groups <SMESH.SMESH_GroupBase>` if *MakeGroups* == True, empty list otherwise
 +
 +        Example: :ref:`tui_extrusion`
 +        """
          n,e,f = [],[],[]
          if IsNodes: n = IDsOfElements
          else      : e,f, = IDsOfElements,IDsOfElements
          return self.ExtrusionSweepObjects(n,e,f, StepVector, NbOfSteps, MakeGroups)
  
 -    ## Generate new elements by extrusion along the normal to a discretized surface or wire
 -    #  @param Elements elements to extrude - a list including ids, groups, sub-meshes or a mesh.
 -    #         Only faces can be extruded so far. A sub-mesh should be a sub-mesh on geom faces.
 -    #  @param StepSize length of one extrusion step (the total extrusion
 -    #         length will be \a NbOfSteps * \a StepSize ).
 -    #  @param NbOfSteps number of extrusion steps.
 -    #  @param ByAverageNormal if True each node is translated by \a StepSize
 -    #         along the average of the normal vectors to the faces sharing the node;
 -    #         else each node is translated along the same average normal till
 -    #         intersection with the plane got by translation of the face sharing
 -    #         the node along its own normal by \a StepSize.
 -    #  @param UseInputElemsOnly to use only \a Elements when computing extrusion direction
 -    #         for every node of \a Elements.
 -    #  @param MakeGroups forces generation of new groups from existing ones.
 -    #  @param Dim dimension of elements to extrude: 2 - faces or 1 - edges. Extrusion of edges
 -    #         is not yet implemented. This parameter is used if \a Elements contains
 -    #         both faces and edges, i.e. \a Elements is a Mesh.
 -    #  @return the list of created groups (SMESH_GroupBase) if \a MakeGroups=True,
 -    #          empty list otherwise.
 -    #  @ingroup l2_modif_extrurev
 -    #  @ref tui_extrusion example
      def ExtrusionByNormal(self, Elements, StepSize, NbOfSteps,
                            ByAverageNormal=False, UseInputElemsOnly=True, MakeGroups=False, Dim = 2):
 +        """
 +        Generate new elements by extrusion along the normal to a discretized surface or wire
 +
 +        Parameters:
 +            Elements: elements to extrude - a list including ids, :class:`a mesh, sub-meshes, groups or filters <SMESH.SMESH_IDSource>`.
 +                Only faces can be extruded so far. A sub-mesh should be a sub-mesh on geom faces.
 +            StepSize: length of one extrusion step (the total extrusion
 +                length will be *NbOfSteps* *StepSize*).
 +            NbOfSteps: number of extrusion steps.
 +            ByAverageNormal: if True each node is translated by *StepSize*
 +                along the average of the normal vectors to the faces sharing the node;
 +                else each node is translated along the same average normal till
 +                intersection with the plane got by translation of the face sharing
 +                the node along its own normal by *StepSize*.
 +            UseInputElemsOnly: to use only *Elements* when computing extrusion direction
 +                for every node of *Elements*.
 +            MakeGroups: forces generation of new groups from existing ones.
 +            Dim: dimension of elements to extrude: 2 - faces or 1 - edges. Extrusion of edges
 +                is not yet implemented. This parameter is used if *Elements* contains
 +                both faces and edges, i.e. *Elements* is a Mesh.
 +
 +        Returns:
 +            the list of created :class:`groups <SMESH.SMESH_GroupBase>` if *MakeGroups* == True,
 +            empty list otherwise.
 +        Example: :ref:`tui_extrusion`
 +        """
 +
          unRegister = genObjUnRegister()
          if isinstance( Elements, Mesh ):
              Elements = [ Elements.GetMesh() ]
          if isinstance( Elements, list ):
              if not Elements:
-                 raise RuntimeError, "Elements empty!"
+                 raise RuntimeError("Elements empty!")
              if isinstance( Elements[0], int ):
                  Elements = self.GetIDSource( Elements, SMESH.ALL )
                  unRegister.set( Elements )
          return self.editor.ExtrusionByNormal(Elements, StepSize, NbOfSteps,
                                               ByAverageNormal, UseInputElemsOnly, MakeGroups, Dim)
  
 -    ## Generate new elements by extrusion of the elements or nodes which belong to the object
 -    #  @param theObject the object whose elements or nodes should be processed.
 -    #                   It can be a mesh, a sub-mesh or a group.
 -    #  @param StepVector vector or DirStruct or 3 vector components, defining
 -    #         the direction and value of extrusion for one step (the total extrusion
 -    #         length will be NbOfSteps * ||StepVector||)
 -    #  @param NbOfSteps the number of steps
 -    #  @param MakeGroups forces the generation of new groups from existing ones
 -    #  @param IsNodes is True if elements to extrude are nodes
 -    #  @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
 -    #  @ingroup l2_modif_extrurev
 -    #  @ref tui_extrusion example
      def ExtrusionSweepObject(self, theObject, StepVector, NbOfSteps, MakeGroups=False, IsNodes=False):
 +        """
 +        Generate new elements by extrusion of the elements or nodes which belong to the object
 +
 +        Parameters:
 +            theObject: the object whose elements or nodes should be processed.
 +                It can be a :class:`mesh, sub-mesh, group or filter <SMESH.SMESH_IDSource>`.
 +            StepVector: vector or :class:`SMESH.DirStruct` or 3 vector components, defining
 +                the direction and value of extrusion for one step (the total extrusion
 +                length will be NbOfSteps * ||StepVector||)
 +            NbOfSteps: the number of steps
 +            MakeGroups: forces the generation of new groups from existing ones
 +            IsNodes: is True if elements to extrude are nodes
 +
 +        Returns:
 +            list of created :class:`groups <SMESH.SMESH_GroupBase>` if *MakeGroups* == True, empty list otherwise
 +        Example: :ref:`tui_extrusion`
 +        """
 +
          n,e,f = [],[],[]
          if IsNodes: n    = theObject
          else      : e,f, = theObject,theObject
          return self.ExtrusionSweepObjects(n,e,f, StepVector, NbOfSteps, MakeGroups)
  
 -    ## Generate new elements by extrusion of edges which belong to the object
 -    #  @param theObject object whose 1D elements should be processed.
 -    #                   It can be a mesh, a sub-mesh or a group.
 -    #  @param StepVector vector or DirStruct or 3 vector components, defining
 -    #         the direction and value of extrusion for one step (the total extrusion
 -    #         length will be NbOfSteps * ||StepVector||)
 -    #  @param NbOfSteps the number of steps
 -    #  @param MakeGroups to generate new groups from existing ones
 -    #  @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
 -    #  @ingroup l2_modif_extrurev
 -    #  @ref tui_extrusion example
      def ExtrusionSweepObject1D(self, theObject, StepVector, NbOfSteps, MakeGroups=False):
 +        """
 +        Generate new elements by extrusion of edges which belong to the object
 +
 +        Parameters:
 +            theObject: object whose 1D elements should be processed.
 +                It can be a :class:`mesh, sub-mesh, group or filter <SMESH.SMESH_IDSource>`.
 +            StepVector: vector or :class:`SMESH.DirStruct` or 3 vector components, defining
 +                the direction and value of extrusion for one step (the total extrusion
 +                length will be NbOfSteps * ||StepVector||)
 +            NbOfSteps: the number of steps
 +            MakeGroups: to generate new groups from existing ones
 +
 +        Returns:
 +            list of created :class:`groups <SMESH.SMESH_GroupBase>` if *MakeGroups* == True, empty list otherwise
 +        Example: :ref:`tui_extrusion`
 +        """
 +
          return self.ExtrusionSweepObjects([],theObject,[], StepVector, NbOfSteps, MakeGroups)
  
 -    ## Generate new elements by extrusion of faces which belong to the object
 -    #  @param theObject object whose 2D elements should be processed.
 -    #                   It can be a mesh, a sub-mesh or a group.
 -    #  @param StepVector vector or DirStruct or 3 vector components, defining
 -    #         the direction and value of extrusion for one step (the total extrusion
 -    #         length will be NbOfSteps * ||StepVector||)
 -    #  @param NbOfSteps the number of steps
 -    #  @param MakeGroups forces the generation of new groups from existing ones
 -    #  @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
 -    #  @ingroup l2_modif_extrurev
 -    #  @ref tui_extrusion example
      def ExtrusionSweepObject2D(self, theObject, StepVector, NbOfSteps, MakeGroups=False):
 +        """
 +        Generate new elements by extrusion of faces which belong to the object
 +
 +        Parameters:
 +            theObject: object whose 2D elements should be processed.
 +                It can be a :class:`mesh, sub-mesh, group or filter <SMESH.SMESH_IDSource>`.
 +            StepVector: vector or :class:`SMESH.DirStruct` or 3 vector components, defining
 +                the direction and value of extrusion for one step (the total extrusion
 +                length will be NbOfSteps * ||StepVector||)
 +            NbOfSteps: the number of steps
 +            MakeGroups: forces the generation of new groups from existing ones
 +
 +        Returns:
 +            list of created :class:`groups <SMESH.SMESH_GroupBase>` if *MakeGroups* == True, empty list otherwise
 +        Example: :ref:`tui_extrusion`
 +        """
 +
          return self.ExtrusionSweepObjects([],[],theObject, StepVector, NbOfSteps, MakeGroups)
  
 -    ## Generate new elements by extrusion of the elements with given ids
 -    #  @param IDsOfElements is ids of elements
 -    #  @param StepVector vector or DirStruct or 3 vector components, defining
 -    #         the direction and value of extrusion for one step (the total extrusion
 -    #         length will be NbOfSteps * ||StepVector||)
 -    #  @param NbOfSteps the number of steps
 -    #  @param ExtrFlags sets flags for extrusion
 -    #  @param SewTolerance uses for comparing locations of nodes if flag
 -    #         EXTRUSION_FLAG_SEW is set
 -    #  @param MakeGroups forces the generation of new groups from existing ones
 -    #  @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
 -    #  @ingroup l2_modif_extrurev
      def AdvancedExtrusion(self, IDsOfElements, StepVector, NbOfSteps,
                            ExtrFlags, SewTolerance, MakeGroups=False):
 +        """
 +        Generate new elements by extrusion of the elements with given ids
 +
 +        Parameters:
 +            IDsOfElements: is ids of elements
 +            StepVector: vector or :class:`SMESH.DirStruct` or 3 vector components, defining
 +                the direction and value of extrusion for one step (the total extrusion
 +                length will be NbOfSteps * ||StepVector||)
 +            NbOfSteps: the number of steps
 +            ExtrFlags: sets flags for extrusion
 +            SewTolerance: uses for comparing locations of nodes if flag
 +                EXTRUSION_FLAG_SEW is set
 +            MakeGroups: forces the generation of new groups from existing ones
 +
 +        Returns:
 +            list of created :class:`groups <SMESH.SMESH_GroupBase>` if *MakeGroups* == True, empty list otherwise
 +        """
 +
          if isinstance( StepVector, geomBuilder.GEOM._objref_GEOM_Object):
              StepVector = self.smeshpyD.GetDirStruct(StepVector)
          if isinstance( StepVector, list ):
          return self.editor.AdvancedExtrusion(IDsOfElements, StepVector, NbOfSteps,
                                               ExtrFlags, SewTolerance, MakeGroups)
  
 -    ## Generate new elements by extrusion of the given elements and nodes along the path.
 -    #  The path of extrusion must be a meshed edge.
 -    #  @param Nodes nodes to extrude: a list including ids, groups, sub-meshes or a mesh
 -    #  @param Edges edges to extrude: a list including ids, groups, sub-meshes or a mesh
 -    #  @param Faces faces to extrude: a list including ids, groups, sub-meshes or a mesh
 -    #  @param PathMesh 1D mesh or 1D sub-mesh, along which proceeds the extrusion
 -    #  @param PathShape shape (edge) defines the sub-mesh of PathMesh if PathMesh
 -    #         contains not only path segments, else it can be None
 -    #  @param NodeStart the first or the last node on the path. Defines the direction of extrusion
 -    #  @param HasAngles allows the shape to be rotated around the path
 -    #                   to get the resulting mesh in a helical fashion
 -    #  @param Angles list of angles
 -    #  @param LinearVariation forces the computation of rotation angles as linear
 -    #                         variation of the given Angles along path steps
 -    #  @param HasRefPoint allows using the reference point
 -    #  @param RefPoint the point around which the shape is rotated (the mass center of the
 -    #         shape by default). The User can specify any point as the Reference Point.
 -    #  @param MakeGroups forces the generation of new groups from existing ones
 -    #  @return list of created groups (SMESH_GroupBase) and SMESH::Extrusion_Error
 -    #  @ingroup l2_modif_extrurev
 -    #  @ref tui_extrusion_along_path example
      def ExtrusionAlongPathObjects(self, Nodes, Edges, Faces, PathMesh, PathShape=None,
                                    NodeStart=1, HasAngles=False, Angles=[], LinearVariation=False,
                                    HasRefPoint=False, RefPoint=[0,0,0], MakeGroups=False):
 +        """
 +        Generate new elements by extrusion of the given elements and nodes along the path.
 +        The path of extrusion must be a meshed edge.
 +
 +        Parameters:
 +            Nodes: nodes to extrude: a list including ids, :class:`a mesh, sub-meshes, groups or filters <SMESH.SMESH_IDSource>`
 +            Edges: edges to extrude: a list including ids, :class:`a mesh, sub-meshes, groups or filters <SMESH.SMESH_IDSource>`
 +            Faces: faces to extrude: a list including ids, :class:`a mesh, sub-meshes, groups or filters <SMESH.SMESH_IDSource>`
 +            PathMesh: 1D mesh or 1D sub-mesh, along which proceeds the extrusion
 +            PathShape: shape (edge) defines the sub-mesh of PathMesh if PathMesh
 +                contains not only path segments, else it can be None
 +            NodeStart: the first or the last node on the path. Defines the direction of extrusion
 +            HasAngles: allows the shape to be rotated around the path
 +                to get the resulting mesh in a helical fashion
 +            Angles: list of angles
 +            LinearVariation: forces the computation of rotation angles as linear
 +                variation of the given Angles along path steps
 +            HasRefPoint: allows using the reference point
 +            RefPoint: the reference point around which the shape is rotated (the mass center of the
 +                shape by default). The User can specify any point as the Reference Point. 
 +                *RefPoint* can be either GEOM Vertex, [x,y,z] or :class:`SMESH.PointStruct`
 +            MakeGroups: forces the generation of new groups from existing ones
 +
 +        Returns:
 +            list of created :class:`groups <SMESH.SMESH_GroupBase>` and 
 +            :class:`error code <SMESH.SMESH_MeshEditor.Extrusion_Error>`
 +        Example: :ref:`tui_extrusion_along_path`
 +        """
 +
          unRegister = genObjUnRegister()
          Nodes = self._getIdSourceList( Nodes, SMESH.NODE, unRegister )
          Edges = self._getIdSourceList( Edges, SMESH.EDGE, unRegister )
                                                       HasAngles, Angles, LinearVariation,
                                                       HasRefPoint, RefPoint, MakeGroups)
  
 -    ## Generate new elements by extrusion of the given elements
 -    #  The path of extrusion must be a meshed edge.
 -    #  @param Base mesh or group, or sub-mesh, or list of ids of elements for extrusion
 -    #  @param Path - 1D mesh or 1D sub-mesh, along which proceeds the extrusion
 -    #  @param NodeStart the start node from Path. Defines the direction of extrusion
 -    #  @param HasAngles allows the shape to be rotated around the path
 -    #                   to get the resulting mesh in a helical fashion
 -    #  @param Angles list of angles in radians
 -    #  @param LinearVariation forces the computation of rotation angles as linear
 -    #                         variation of the given Angles along path steps
 -    #  @param HasRefPoint allows using the reference point
 -    #  @param RefPoint the point around which the elements are rotated (the mass
 -    #         center of the elements by default).
 -    #         The User can specify any point as the Reference Point.
 -    #         RefPoint can be either GEOM Vertex, [x,y,z] or SMESH.PointStruct
 -    #  @param MakeGroups forces the generation of new groups from existing ones
 -    #  @param ElemType type of elements for extrusion (if param Base is a mesh)
 -    #  @return list of created groups (SMESH_GroupBase) and SMESH::Extrusion_Error if MakeGroups=True,
 -    #          only SMESH::Extrusion_Error otherwise
 -    #  @ingroup l2_modif_extrurev
 -    #  @ref tui_extrusion_along_path example
      def ExtrusionAlongPathX(self, Base, Path, NodeStart,
                              HasAngles=False, Angles=[], LinearVariation=False,
                              HasRefPoint=False, RefPoint=[0,0,0], MakeGroups=False,
                              ElemType=SMESH.FACE):
 +        """
 +        Generate new elements by extrusion of the given elements.
 +        The path of extrusion must be a meshed edge.
 +
 +        Parameters:
 +            Base: :class:`mesh, sub-mesh, group, filter <SMESH.SMESH_IDSource>`, or list of ids of elements for extrusion
 +            Path: 1D mesh or 1D sub-mesh, along which proceeds the extrusion
 +            NodeStart: the start node from Path. Defines the direction of extrusion
 +            HasAngles: allows the shape to be rotated around the path
 +                to get the resulting mesh in a helical fashion
 +            Angles: list of angles in radians
 +            LinearVariation: forces the computation of rotation angles as linear
 +                variation of the given Angles along path steps
 +            HasRefPoint: allows using the reference point
 +            RefPoint: the reference point around which the elements are rotated (the mass
 +                center of the elements by default).
 +                The User can specify any point as the Reference Point.
 +                *RefPoint* can be either GEOM Vertex, [x,y,z] or :class:`SMESH.PointStruct`
 +            MakeGroups: forces the generation of new groups from existing ones
 +            ElemType: type of elements for extrusion (if param Base is a mesh)
 +
 +        Returns:
 +            list of created :class:`groups <SMESH.SMESH_GroupBase>` and
 +            :class:`error code <SMESH.SMESH_MeshEditor.Extrusion_Error>`
 +            if *MakeGroups* == True, only :class:`error code <SMESH.SMESH_MeshEditor.Extrusion_Error>`
 +            otherwise
 +        Example: :ref:`tui_extrusion_along_path`
 +        """
 +
          n,e,f = [],[],[]
          if ElemType == SMESH.NODE: n = Base
          if ElemType == SMESH.EDGE: e = Base
          if MakeGroups: return gr,er
          return er
  
 -    ## Generate new elements by extrusion of the given elements
 -    #  The path of extrusion must be a meshed edge.
 -    #  @param IDsOfElements ids of elements
 -    #  @param PathMesh mesh containing a 1D sub-mesh on the edge, along which proceeds the extrusion
 -    #  @param PathShape shape(edge) defines the sub-mesh for the path
 -    #  @param NodeStart the first or the last node on the edge. Defines the direction of extrusion
 -    #  @param HasAngles allows the shape to be rotated around the path
 -    #                   to get the resulting mesh in a helical fashion
 -    #  @param Angles list of angles in radians
 -    #  @param HasRefPoint allows using the reference point
 -    #  @param RefPoint the point around which the shape is rotated (the mass center of the shape by default).
 -    #         The User can specify any point as the Reference Point.
 -    #  @param MakeGroups forces the generation of new groups from existing ones
 -    #  @param LinearVariation forces the computation of rotation angles as linear
 -    #                         variation of the given Angles along path steps
 -    #  @return list of created groups (SMESH_GroupBase) and SMESH::Extrusion_Error if MakeGroups=True,
 -    #          only SMESH::Extrusion_Error otherwise
 -    #  @ingroup l2_modif_extrurev
 -    #  @ref tui_extrusion_along_path example
      def ExtrusionAlongPath(self, IDsOfElements, PathMesh, PathShape, NodeStart,
                             HasAngles=False, Angles=[], HasRefPoint=False, RefPoint=[],
                             MakeGroups=False, LinearVariation=False):
 +        """
 +        Generate new elements by extrusion of the given elements.
 +        The path of extrusion must be a meshed edge.
 +
 +        Parameters:
 +            IDsOfElements: ids of elements
 +            PathMesh: mesh containing a 1D sub-mesh on the edge, along which proceeds the extrusion
 +            PathShape: shape (edge) defines the sub-mesh for the path
 +            NodeStart: the first or the last node on the edge. Defines the direction of extrusion
 +            HasAngles: allows the shape to be rotated around the path
 +                to get the resulting mesh in a helical fashion
 +            Angles: list of angles in radians
 +            HasRefPoint: allows using the reference point
 +            RefPoint: the reference point around which the shape is rotated (the mass center of the shape by default).
 +                The User can specify any point as the Reference Point.
 +                *RefPoint* can be either GEOM Vertex, [x,y,z] or :class:`SMESH.PointStruct`
 +            MakeGroups: forces the generation of new groups from existing ones
 +            LinearVariation: forces the computation of rotation angles as linear
 +                variation of the given Angles along path steps
 +
 +        Returns:
 +            list of created :class:`groups <SMESH.SMESH_GroupBase>` and
 +            :class:`error code <SMESH.SMESH_MeshEditor.Extrusion_Error>`
 +            if *MakeGroups* == True, only :class:`error code <SMESH.SMESH_MeshEditor.Extrusion_Error>` otherwise
 +        Example: :ref:`tui_extrusion_along_path`
 +        """
 +
          n,e,f = [],IDsOfElements,IDsOfElements
          gr,er = self.ExtrusionAlongPathObjects(n,e,f, PathMesh, PathShape,
                                                 NodeStart, HasAngles, Angles,
          if MakeGroups: return gr,er
          return er
  
 -    ## Generate new elements by extrusion of the elements which belong to the object
 -    #  The path of extrusion must be a meshed edge.
 -    #  @param theObject the object whose elements should be processed.
 -    #                   It can be a mesh, a sub-mesh or a group.
 -    #  @param PathMesh mesh containing a 1D sub-mesh on the edge, along which the extrusion proceeds
 -    #  @param PathShape shape(edge) defines the sub-mesh for the path
 -    #  @param NodeStart the first or the last node on the edge. Defines the direction of extrusion
 -    #  @param HasAngles allows the shape to be rotated around the path
 -    #                   to get the resulting mesh in a helical fashion
 -    #  @param Angles list of angles
 -    #  @param HasRefPoint allows using the reference point
 -    #  @param RefPoint the point around which the shape is rotated (the mass center of the shape by default).
 -    #         The User can specify any point as the Reference Point.
 -    #  @param MakeGroups forces the generation of new groups from existing ones
 -    #  @param LinearVariation forces the computation of rotation angles as linear
 -    #                         variation of the given Angles along path steps
 -    #  @return list of created groups (SMESH_GroupBase) and SMESH::Extrusion_Error if MakeGroups=True,
 -    #          only SMESH::Extrusion_Error otherwise
 -    #  @ingroup l2_modif_extrurev
 -    #  @ref tui_extrusion_along_path example
      def ExtrusionAlongPathObject(self, theObject, PathMesh, PathShape, NodeStart,
                                   HasAngles=False, Angles=[], HasRefPoint=False, RefPoint=[],
                                   MakeGroups=False, LinearVariation=False):
 +        """
 +        Generate new elements by extrusion of the elements which belong to the object.
 +        The path of extrusion must be a meshed edge.
 +
 +        Parameters:
 +            theObject: the object whose elements should be processed.
 +                It can be a :class:`mesh, sub-mesh, group or filter <SMESH.SMESH_IDSource>`.
 +            PathMesh: mesh containing a 1D sub-mesh on the edge, along which the extrusion proceeds
 +            PathShape: shape (edge) defines the sub-mesh for the path
 +            NodeStart: the first or the last node on the edge. Defines the direction of extrusion
 +            HasAngles: allows the shape to be rotated around the path
 +                to get the resulting mesh in a helical fashion
 +            Angles: list of angles
 +            HasRefPoint: allows using the reference point
 +            RefPoint: the reference point around which the shape is rotated (the mass center of the shape by default).
 +                The User can specify any point as the Reference Point.
 +                *RefPoint* can be either GEOM Vertex, [x,y,z] or :class:`SMESH.PointStruct`
 +            MakeGroups: forces the generation of new groups from existing ones
 +            LinearVariation: forces the computation of rotation angles as linear
 +                variation of the given Angles along path steps
 +
 +        Returns:
 +            list of created :class:`groups <SMESH.SMESH_GroupBase>` and 
 +            :class:`error code <SMESH.SMESH_MeshEditor.Extrusion_Error>` if *MakeGroups* == True,
 +            only :class:`error code <SMESH.SMESH_MeshEditor.Extrusion_Error>` otherwise
 +        Example: :ref:`tui_extrusion_along_path`
 +        """
 +
          n,e,f = [],theObject,theObject
          gr,er = self.ExtrusionAlongPathObjects(n,e,f, PathMesh, PathShape, NodeStart,
                                                 HasAngles, Angles, LinearVariation,
          if MakeGroups: return gr,er
          return er
  
 -    ## Generate new elements by extrusion of mesh segments which belong to the object
 -    #  The path of extrusion must be a meshed edge.
 -    #  @param theObject the object whose 1D elements should be processed.
 -    #                   It can be a mesh, a sub-mesh or a group.
 -    #  @param PathMesh mesh containing a 1D sub-mesh on the edge, along which the extrusion proceeds
 -    #  @param PathShape shape(edge) defines the sub-mesh for the path
 -    #  @param NodeStart the first or the last node on the edge. Defines the direction of extrusion
 -    #  @param HasAngles allows the shape to be rotated around the path
 -    #                   to get the resulting mesh in a helical fashion
 -    #  @param Angles list of angles
 -    #  @param HasRefPoint allows using the reference point
 -    #  @param RefPoint the point around which the shape is rotated (the mass center of the shape by default).
 -    #         The User can specify any point as the Reference Point.
 -    #  @param MakeGroups forces the generation of new groups from existing ones
 -    #  @param LinearVariation forces the computation of rotation angles as linear
 -    #                         variation of the given Angles along path steps
 -    #  @return list of created groups (SMESH_GroupBase) and SMESH::Extrusion_Error if MakeGroups=True,
 -    #          only SMESH::Extrusion_Error otherwise
 -    #  @ingroup l2_modif_extrurev
 -    #  @ref tui_extrusion_along_path example
      def ExtrusionAlongPathObject1D(self, theObject, PathMesh, PathShape, NodeStart,
                                     HasAngles=False, Angles=[], HasRefPoint=False, RefPoint=[],
                                     MakeGroups=False, LinearVariation=False):
 +        """
 +        Generate new elements by extrusion of mesh segments which belong to the object.
 +        The path of extrusion must be a meshed edge.
 +
 +        Parameters:
 +            theObject: the object whose 1D elements should be processed.
 +                It can be a :class:`mesh, sub-mesh, group or filter <SMESH.SMESH_IDSource>`.
 +            PathMesh: mesh containing a 1D sub-mesh on the edge, along which the extrusion proceeds
 +            PathShape: shape (edge) defines the sub-mesh for the path
 +            NodeStart: the first or the last node on the edge. Defines the direction of extrusion
 +            HasAngles: allows the shape to be rotated around the path
 +                to get the resulting mesh in a helical fashion
 +            Angles: list of angles
 +            HasRefPoint: allows using the reference point
 +            RefPoint:  the reference point around which the shape is rotated (the mass center of the shape by default).
 +                The User can specify any point as the Reference Point.
 +                *RefPoint* can be either GEOM Vertex, [x,y,z] or :class:`SMESH.PointStruct`
 +            MakeGroups: forces the generation of new groups from existing ones
 +            LinearVariation: forces the computation of rotation angles as linear
 +                variation of the given Angles along path steps
 +
 +        Returns:
 +            list of created :class:`groups <SMESH.SMESH_GroupBase>` and 
 +            :class:`error code <SMESH.SMESH_MeshEditor.Extrusion_Error>` if *MakeGroups* == True,
 +            only :class:`error code <SMESH.SMESH_MeshEditor.Extrusion_Error>` otherwise
 +        Example: :ref:`tui_extrusion_along_path`
 +        """
 +
          n,e,f = [],theObject,[]
          gr,er = self.ExtrusionAlongPathObjects(n,e,f, PathMesh, PathShape, NodeStart,
                                                 HasAngles, Angles, LinearVariation,
          if MakeGroups: return gr,er
          return er
  
 -    ## Generate new elements by extrusion of faces which belong to the object
 -    #  The path of extrusion must be a meshed edge.
 -    #  @param theObject the object whose 2D elements should be processed.
 -    #                   It can be a mesh, a sub-mesh or a group.
 -    #  @param PathMesh mesh containing a 1D sub-mesh on the edge, along which the extrusion proceeds
 -    #  @param PathShape shape(edge) defines the sub-mesh for the path
 -    #  @param NodeStart the first or the last node on the edge. Defines the direction of extrusion
 -    #  @param HasAngles allows the shape to be rotated around the path
 -    #                   to get the resulting mesh in a helical fashion
 -    #  @param Angles list of angles
 -    #  @param HasRefPoint allows using the reference point
 -    #  @param RefPoint the point around which the shape is rotated (the mass center of the shape by default).
 -    #         The User can specify any point as the Reference Point.
 -    #  @param MakeGroups forces the generation of new groups from existing ones
 -    #  @param LinearVariation forces the computation of rotation angles as linear
 -    #                         variation of the given Angles along path steps
 -    #  @return list of created groups (SMESH_GroupBase) and SMESH::Extrusion_Error if MakeGroups=True,
 -    #          only SMESH::Extrusion_Error otherwise
 -    #  @ingroup l2_modif_extrurev
 -    #  @ref tui_extrusion_along_path example
      def ExtrusionAlongPathObject2D(self, theObject, PathMesh, PathShape, NodeStart,
                                     HasAngles=False, Angles=[], HasRefPoint=False, RefPoint=[],
                                     MakeGroups=False, LinearVariation=False):
 +        """
 +        Generate new elements by extrusion of faces which belong to the object.
 +        The path of extrusion must be a meshed edge.
 +
 +        Parameters:
 +            theObject: the object whose 2D elements should be processed.
 +                It can be a :class:`mesh, sub-mesh, group or filter <SMESH.SMESH_IDSource>`.
 +            PathMesh: mesh containing a 1D sub-mesh on the edge, along which the extrusion proceeds
 +            PathShape: shape (edge) defines the sub-mesh for the path
 +            NodeStart: the first or the last node on the edge. Defines the direction of extrusion
 +            HasAngles: allows the shape to be rotated around the path
 +                to get the resulting mesh in a helical fashion
 +            Angles: list of angles
 +            HasRefPoint: allows using the reference point
 +            RefPoint: the reference point around which the shape is rotated (the mass center of the shape by default).
 +                The User can specify any point as the Reference Point.
 +                *RefPoint* can be either GEOM Vertex, [x,y,z] or :class:`SMESH.PointStruct`
 +            MakeGroups: forces the generation of new groups from existing ones
 +            LinearVariation: forces the computation of rotation angles as linear
 +                variation of the given Angles along path steps
 +
 +        Returns:
 +            list of created :class:`groups <SMESH.SMESH_GroupBase>` and 
 +            :class:`error code <SMESH.SMESH_MeshEditor.Extrusion_Error>` if *MakeGroups* == True,
 +            only :class:`error code <SMESH.SMESH_MeshEditor.Extrusion_Error>` otherwise
 +        Example: :ref:`tui_extrusion_along_path`
 +        """
 +
          n,e,f = [],[],theObject
          gr,er = self.ExtrusionAlongPathObjects(n,e,f, PathMesh, PathShape, NodeStart,
                                                 HasAngles, Angles, LinearVariation,
          if MakeGroups: return gr,er
          return er
  
 -    ## Create a symmetrical copy of mesh elements
 -    #  @param IDsOfElements list of elements ids
 -    #  @param Mirror is AxisStruct or geom object(point, line, plane)
 -    #  @param theMirrorType smeshBuilder.POINT, smeshBuilder.AXIS or smeshBuilder.PLANE
 -    #         If the Mirror is a geom object this parameter is unnecessary
 -    #  @param Copy allows to copy element (Copy is 1) or to replace with its mirroring (Copy is 0)
 -    #  @param MakeGroups forces the generation of new groups from existing ones (if Copy)
 -    #  @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
 -    #  @ingroup l2_modif_trsf
      def Mirror(self, IDsOfElements, Mirror, theMirrorType=None, Copy=0, MakeGroups=False):
 +        """
 +        Create a symmetrical copy of mesh elements
 +
 +        Parameters:
 +            IDsOfElements: list of elements ids
 +            Mirror: is :class:`SMESH.AxisStruct` or geom object (point, line, plane)
 +            theMirrorType: smeshBuilder.POINT, smeshBuilder.AXIS or smeshBuilder.PLANE.
 +                If the *Mirror* is a geom object this parameter is unnecessary
 +            Copy: allows to copy element (Copy is 1) or to replace with its mirroring (Copy is 0)
 +            MakeGroups: forces the generation of new groups from existing ones (if Copy)
 +
 +        Returns:
 +            list of created :class:`groups <SMESH.SMESH_GroupBase>` if *MakeGroups* == True, empty list otherwise
 +        """
 +
          if IDsOfElements == []:
              IDsOfElements = self.GetElementsId()
          if ( isinstance( Mirror, geomBuilder.GEOM._objref_GEOM_Object)):
          self.editor.Mirror(IDsOfElements, Mirror, theMirrorType, Copy)
          return []
  
 -    ## Create a new mesh by a symmetrical copy of mesh elements
 -    #  @param IDsOfElements the list of elements ids
 -    #  @param Mirror is AxisStruct or geom object (point, line, plane)
 -    #  @param theMirrorType smeshBuilder.POINT, smeshBuilder.AXIS or smeshBuilder.PLANE
 -    #         If the Mirror is a geom object this parameter is unnecessary
 -    #  @param MakeGroups to generate new groups from existing ones
 -    #  @param NewMeshName a name of the new mesh to create
 -    #  @return instance of Mesh class
 -    #  @ingroup l2_modif_trsf
      def MirrorMakeMesh(self, IDsOfElements, Mirror, theMirrorType=0, MakeGroups=0, NewMeshName=""):
 +        """
 +        Create a new mesh by a symmetrical copy of mesh elements
 +
 +        Parameters:
 +            IDsOfElements: the list of elements ids
 +            Mirror: is :class:`SMESH.AxisStruct` or geom object (point, line, plane)
 +            theMirrorType: smeshBuilder.POINT, smeshBuilder.AXIS or smeshBuilder.PLANE.
 +                If the *Mirror* is a geom object this parameter is unnecessary
 +            MakeGroups: to generate new groups from existing ones
 +            NewMeshName: a name of the new mesh to create
 +
 +        Returns:
 +            instance of class :class:`Mesh`
 +        """
 +
          if IDsOfElements == []:
              IDsOfElements = self.GetElementsId()
          if ( isinstance( Mirror, geomBuilder.GEOM._objref_GEOM_Object)):
                                            MakeGroups, NewMeshName)
          return Mesh(self.smeshpyD,self.geompyD,mesh)
  
 -    ## Create a symmetrical copy of the object
 -    #  @param theObject mesh, submesh or group
 -    #  @param Mirror AxisStruct or geom object (point, line, plane)
 -    #  @param theMirrorType smeshBuilder.POINT, smeshBuilder.AXIS or smeshBuilder.PLANE
 -    #         If the Mirror is a geom object this parameter is unnecessary
 -    #  @param Copy allows copying the element (Copy is 1) or replacing it with its mirror (Copy is 0)
 -    #  @param MakeGroups forces the generation of new groups from existing ones (if Copy)
 -    #  @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
 -    #  @ingroup l2_modif_trsf
      def MirrorObject (self, theObject, Mirror, theMirrorType=None, Copy=0, MakeGroups=False):
 +        """
 +        Create a symmetrical copy of the object
 +
 +        Parameters:
 +            theObject: :class:`mesh, sub-mesh, group or filter <SMESH.SMESH_IDSource>`
 +            Mirror: :class:`SMESH.AxisStruct` or geom object (point, line, plane)
 +            theMirrorType: smeshBuilder.POINT, smeshBuilder.AXIS or smeshBuilder.PLANE.
 +                If the *Mirror* is a geom object this parameter is unnecessary
 +            Copy: allows copying the element (Copy==True) or replacing it with its mirror (Copy==False)
 +            MakeGroups: forces the generation of new groups from existing ones (if Copy)
 +
 +        Returns:
 +            list of created :class:`groups <SMESH.SMESH_GroupBase>` if *MakeGroups* == True, empty list otherwise
 +        """
 +
          if ( isinstance( theObject, Mesh )):
              theObject = theObject.GetMesh()
          if ( isinstance( Mirror, geomBuilder.GEOM._objref_GEOM_Object)):
          self.editor.MirrorObject(theObject, Mirror, theMirrorType, Copy)
          return []
  
 -    ## Create a new mesh by a symmetrical copy of the object
 -    #  @param theObject mesh, submesh or group
 -    #  @param Mirror AxisStruct or geom object (point, line, plane)
 -    #  @param theMirrorType smeshBuilder.POINT, smeshBuilder.AXIS or smeshBuilder.PLANE
 -    #         If the Mirror is a geom object this parameter is unnecessary
 -    #  @param MakeGroups forces the generation of new groups from existing ones
 -    #  @param NewMeshName the name of the new mesh to create
 -    #  @return instance of Mesh class
 -    #  @ingroup l2_modif_trsf
      def MirrorObjectMakeMesh (self, theObject, Mirror, theMirrorType=0,MakeGroups=0,NewMeshName=""):
 +        """
 +        Create a new mesh by a symmetrical copy of the object
 +
 +        Parameters:
 +            theObject: :class:`mesh, sub-mesh, group or filter <SMESH.SMESH_IDSource>`
 +            Mirror: :class:`SMESH.AxisStruct` or geom object (point, line, plane)
 +            theMirrorType: smeshBuilder.POINT, smeshBuilder.AXIS or smeshBuilder.PLANE.
 +                If the *Mirror* is a geom object this parameter is unnecessary
 +            MakeGroups: forces the generation of new groups from existing ones
 +            NewMeshName: the name of the new mesh to create
 +
 +        Returns:
 +            instance of class :class:`Mesh`
 +        """
 +
          if ( isinstance( theObject, Mesh )):
              theObject = theObject.GetMesh()
          if ( isinstance( Mirror, geomBuilder.GEOM._objref_GEOM_Object)):
                                                  MakeGroups, NewMeshName)
          return Mesh( self.smeshpyD,self.geompyD,mesh )
  
 -    ## Translate the elements
 -    #  @param IDsOfElements list of elements ids
 -    #  @param Vector the direction of translation (DirStruct or vector or 3 vector components)
 -    #  @param Copy allows copying the translated elements
 -    #  @param MakeGroups forces the generation of new groups from existing ones (if Copy)
 -    #  @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
 -    #  @ingroup l2_modif_trsf
      def Translate(self, IDsOfElements, Vector, Copy, MakeGroups=False):
 +        """
 +        Translate the elements
 +
 +        Parameters:
 +            IDsOfElements: list of elements ids
 +            Vector: the direction of translation (:class:`SMESH.DirStruct` or vector or 3 vector components)
 +            Copy: allows copying the translated elements
 +            MakeGroups: forces the generation of new groups from existing ones (if Copy)
 +
 +        Returns:
 +            list of created :class:`groups <SMESH.SMESH_GroupBase>` if *MakeGroups* == True, empty list otherwise
 +        """
 +
          if IDsOfElements == []:
              IDsOfElements = self.GetElementsId()
          if ( isinstance( Vector, geomBuilder.GEOM._objref_GEOM_Object)):
          self.editor.Translate(IDsOfElements, Vector, Copy)
          return []
  
 -    ## Create a new mesh of translated elements
 -    #  @param IDsOfElements list of elements ids
 -    #  @param Vector the direction of translation (DirStruct or vector or 3 vector components)
 -    #  @param MakeGroups forces the generation of new groups from existing ones
 -    #  @param NewMeshName the name of the newly created mesh
 -    #  @return instance of Mesh class
 -    #  @ingroup l2_modif_trsf
      def TranslateMakeMesh(self, IDsOfElements, Vector, MakeGroups=False, NewMeshName=""):
 +        """
 +        Create a new mesh of translated elements
 +
 +        Parameters:
 +            IDsOfElements: list of elements ids
 +            Vector: the direction of translation (:class:`SMESH.DirStruct` or vector or 3 vector components)
 +            MakeGroups: forces the generation of new groups from existing ones
 +            NewMeshName: the name of the newly created mesh
 +
 +        Returns:
 +            instance of class :class:`Mesh`
 +        """
 +
          if IDsOfElements == []:
              IDsOfElements = self.GetElementsId()
          if ( isinstance( Vector, geomBuilder.GEOM._objref_GEOM_Object)):
          mesh = self.editor.TranslateMakeMesh(IDsOfElements, Vector, MakeGroups, NewMeshName)
          return Mesh ( self.smeshpyD, self.geompyD, mesh )
  
 -    ## Translate the object
 -    #  @param theObject the object to translate (mesh, submesh, or group)
 -    #  @param Vector direction of translation (DirStruct or geom vector or 3 vector components)
 -    #  @param Copy allows copying the translated elements
 -    #  @param MakeGroups forces the generation of new groups from existing ones (if Copy)
 -    #  @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
 -    #  @ingroup l2_modif_trsf
      def TranslateObject(self, theObject, Vector, Copy, MakeGroups=False):
 +        """
 +        Translate the object
 +
 +        Parameters:
 +            theObject: the object to translate (:class:`mesh, sub-mesh, group or filter <SMESH.SMESH_IDSource>`)
 +            Vector: direction of translation (:class:`SMESH.DirStruct` or geom vector or 3 vector components)
 +            Copy: allows copying the translated elements
 +            MakeGroups: forces the generation of new groups from existing ones (if Copy)
 +
 +        Returns:
 +            list of created :class:`groups <SMESH.SMESH_GroupBase>` if *MakeGroups* == True, empty list otherwise
 +        """
 +
          if ( isinstance( theObject, Mesh )):
              theObject = theObject.GetMesh()
          if ( isinstance( Vector, geomBuilder.GEOM._objref_GEOM_Object)):
          self.editor.TranslateObject(theObject, Vector, Copy)
          return []
  
 -    ## Create a new mesh from the translated object
 -    #  @param theObject the object to translate (mesh, submesh, or group)
 -    #  @param Vector the direction of translation (DirStruct or geom vector or 3 vector components)
 -    #  @param MakeGroups forces the generation of new groups from existing ones
 -    #  @param NewMeshName the name of the newly created mesh
 -    #  @return instance of Mesh class
 -    #  @ingroup l2_modif_trsf
      def TranslateObjectMakeMesh(self, theObject, Vector, MakeGroups=False, NewMeshName=""):
 +        """
 +        Create a new mesh from the translated object
 +
 +        Parameters:
 +            theObject: the object to translate (:class:`mesh, sub-mesh, group or filter <SMESH.SMESH_IDSource>`)
 +            Vector: the direction of translation (:class:`SMESH.DirStruct` or geom vector or 3 vector components)
 +            MakeGroups: forces the generation of new groups from existing ones
 +            NewMeshName: the name of the newly created mesh
 +
 +        Returns:
 +            instance of class :class:`Mesh`
 +        """
 +
          if isinstance( theObject, Mesh ):
              theObject = theObject.GetMesh()
          if isinstance( Vector, geomBuilder.GEOM._objref_GEOM_Object ):
  
  
  
 -    ## Scale the object
 -    #  @param theObject - the object to translate (mesh, submesh, or group)
 -    #  @param thePoint - base point for scale (SMESH.PointStruct or list of 3 coordinates)
 -    #  @param theScaleFact - list of 1-3 scale factors for axises
 -    #  @param Copy - allows copying the translated elements
 -    #  @param MakeGroups - forces the generation of new groups from existing
 -    #                      ones (if Copy)
 -    #  @return list of created groups (SMESH_GroupBase) if MakeGroups=True,
 -    #          empty list otherwise
      def Scale(self, theObject, thePoint, theScaleFact, Copy, MakeGroups=False):
 +        """
 +        Scale the object
 +
 +        Parameters:
 +            theObject: the object to translate (:class:`mesh, sub-mesh, group or filter <SMESH.SMESH_IDSource>`)
 +            thePoint: base point for scale (:class:`SMESH.PointStruct` or list of 3 coordinates)
 +            theScaleFact: list of 1-3 scale factors for axises
 +            Copy: allows copying the translated elements
 +            MakeGroups: forces the generation of new groups from existing
 +                ones (if Copy)
 +
 +        Returns:
 +            list of created :class:`groups <SMESH.SMESH_GroupBase>` if *MakeGroups* == True,
 +            empty list otherwise
 +        """
          unRegister = genObjUnRegister()
          if ( isinstance( theObject, Mesh )):
              theObject = theObject.GetMesh()
          if ( isinstance( thePoint, list )):
              thePoint = PointStruct( thePoint[0], thePoint[1], thePoint[2] )
          if ( isinstance( theScaleFact, float )):
-              theScaleFact = [theScaleFact]
+             theScaleFact = [theScaleFact]
          if ( isinstance( theScaleFact, int )):
-              theScaleFact = [ float(theScaleFact)]
+             theScaleFact = [ float(theScaleFact)]
  
          self.mesh.SetParameters(thePoint.parameters)
  
          self.editor.Scale(theObject, thePoint, theScaleFact, Copy)
          return []
  
 -    ## Create a new mesh from the translated object
 -    #  @param theObject - the object to translate (mesh, submesh, or group)
 -    #  @param thePoint - base point for scale (SMESH.PointStruct or list of 3 coordinates)
 -    #  @param theScaleFact - list of 1-3 scale factors for axises
 -    #  @param MakeGroups - forces the generation of new groups from existing ones
 -    #  @param NewMeshName - the name of the newly created mesh
 -    #  @return instance of Mesh class
      def ScaleMakeMesh(self, theObject, thePoint, theScaleFact, MakeGroups=False, NewMeshName=""):
 +        """
 +        Create a new mesh from the translated object
 +
 +        Parameters:
 +            theObject: the object to translate (:class:`mesh, sub-mesh, group or filter <SMESH.SMESH_IDSource>`)
 +            thePoint: base point for scale (:class:`SMESH.PointStruct` or list of 3 coordinates)
 +            theScaleFact: list of 1-3 scale factors for axises
 +            MakeGroups: forces the generation of new groups from existing ones
 +            NewMeshName: the name of the newly created mesh
 +
 +        Returns:
 +            instance of class :class:`Mesh`
 +        """
          unRegister = genObjUnRegister()
          if (isinstance(theObject, Mesh)):
              theObject = theObject.GetMesh()
          if ( isinstance( thePoint, list )):
              thePoint = PointStruct( thePoint[0], thePoint[1], thePoint[2] )
          if ( isinstance( theScaleFact, float )):
-              theScaleFact = [theScaleFact]
+             theScaleFact = [theScaleFact]
          if ( isinstance( theScaleFact, int )):
-              theScaleFact = [ float(theScaleFact)]
+             theScaleFact = [ float(theScaleFact)]
  
          self.mesh.SetParameters(thePoint.parameters)
          mesh = self.editor.ScaleMakeMesh(theObject, thePoint, theScaleFact,
  
  
  
 -    ## Rotate the elements
 -    #  @param IDsOfElements list of elements ids
 -    #  @param Axis the axis of rotation (AxisStruct or geom line)
 -    #  @param AngleInRadians the angle of rotation (in radians) or a name of variable which defines angle in degrees
 -    #  @param Copy allows copying the rotated elements
 -    #  @param MakeGroups forces the generation of new groups from existing ones (if Copy)
 -    #  @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
 -    #  @ingroup l2_modif_trsf
      def Rotate (self, IDsOfElements, Axis, AngleInRadians, Copy, MakeGroups=False):
 +        """
 +        Rotate the elements
 +
 +        Parameters:
 +            IDsOfElements: list of elements ids
 +            Axis: the axis of rotation (:class:`SMESH.AxisStruct` or geom line)
 +            AngleInRadians: the angle of rotation (in radians) or a name of variable which defines angle in degrees
 +            Copy: allows copying the rotated elements
 +            MakeGroups: forces the generation of new groups from existing ones (if Copy)
 +
 +        Returns:
 +            list of created :class:`groups <SMESH.SMESH_GroupBase>` if *MakeGroups* == True, empty list otherwise
 +        """
 +
 +
          if IDsOfElements == []:
              IDsOfElements = self.GetElementsId()
          if ( isinstance( Axis, geomBuilder.GEOM._objref_GEOM_Object)):
          self.editor.Rotate(IDsOfElements, Axis, AngleInRadians, Copy)
          return []
  
 -    ## Create a new mesh of rotated elements
 -    #  @param IDsOfElements list of element ids
 -    #  @param Axis the axis of rotation (AxisStruct or geom line)
 -    #  @param AngleInRadians the angle of rotation (in radians) or a name of variable which defines angle in degrees
 -    #  @param MakeGroups forces the generation of new groups from existing ones
 -    #  @param NewMeshName the name of the newly created mesh
 -    #  @return instance of Mesh class
 -    #  @ingroup l2_modif_trsf
      def RotateMakeMesh (self, IDsOfElements, Axis, AngleInRadians, MakeGroups=0, NewMeshName=""):
 +        """
 +        Create a new mesh of rotated elements
 +
 +        Parameters:
 +            IDsOfElements: list of element ids
 +            Axis: the axis of rotation (:class:`SMESH.AxisStruct` or geom line)
 +            AngleInRadians: the angle of rotation (in radians) or a name of variable which defines angle in degrees
 +            MakeGroups: forces the generation of new groups from existing ones
 +            NewMeshName: the name of the newly created mesh
 +
 +        Returns:
 +            instance of class :class:`Mesh`
 +        """
 +
          if IDsOfElements == []:
              IDsOfElements = self.GetElementsId()
          if ( isinstance( Axis, geomBuilder.GEOM._objref_GEOM_Object)):
                                            MakeGroups, NewMeshName)
          return Mesh( self.smeshpyD, self.geompyD, mesh )
  
 -    ## Rotate the object
 -    #  @param theObject the object to rotate( mesh, submesh, or group)
 -    #  @param Axis the axis of rotation (AxisStruct or geom line)
 -    #  @param AngleInRadians the angle of rotation (in radians) or a name of variable which defines angle in degrees
 -    #  @param Copy allows copying the rotated elements
 -    #  @param MakeGroups forces the generation of new groups from existing ones (if Copy)
 -    #  @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
 -    #  @ingroup l2_modif_trsf
      def RotateObject (self, theObject, Axis, AngleInRadians, Copy, MakeGroups=False):
 +        """
 +        Rotate the object
 +
 +        Parameters:
 +            theObject: the object to rotate (:class:`mesh, sub-mesh, group or filter <SMESH.SMESH_IDSource>`)
 +            Axis: the axis of rotation (:class:`SMESH.AxisStruct` or geom line)
 +            AngleInRadians: the angle of rotation (in radians) or a name of variable which defines angle in degrees
 +            Copy: allows copying the rotated elements
 +            MakeGroups: forces the generation of new groups from existing ones (if Copy)
 +
 +        Returns:
 +            list of created :class:`groups <SMESH.SMESH_GroupBase>` if MakeGroups==True, empty list otherwise
 +        """
 +
          if (isinstance(theObject, Mesh)):
              theObject = theObject.GetMesh()
          if (isinstance(Axis, geomBuilder.GEOM._objref_GEOM_Object)):
          self.editor.RotateObject(theObject, Axis, AngleInRadians, Copy)
          return []
  
 -    ## Create a new mesh from the rotated object
 -    #  @param theObject the object to rotate (mesh, submesh, or group)
 -    #  @param Axis the axis of rotation (AxisStruct or geom line)
 -    #  @param AngleInRadians the angle of rotation (in radians)  or a name of variable which defines angle in degrees
 -    #  @param MakeGroups forces the generation of new groups from existing ones
 -    #  @param NewMeshName the name of the newly created mesh
 -    #  @return instance of Mesh class
 -    #  @ingroup l2_modif_trsf
      def RotateObjectMakeMesh(self, theObject, Axis, AngleInRadians, MakeGroups=0,NewMeshName=""):
 +        """
 +        Create a new mesh from the rotated object
 +
 +        Parameters:
 +            theObject: the object to rotate (:class:`mesh, sub-mesh, group or filter <SMESH.SMESH_IDSource>`)
 +            Axis: the axis of rotation (:class:`SMESH.AxisStruct` or geom line)
 +            AngleInRadians: the angle of rotation (in radians)  or a name of variable which defines angle in degrees
 +            MakeGroups: forces the generation of new groups from existing ones
 +            NewMeshName: the name of the newly created mesh
 +
 +        Returns:
 +            instance of class :class:`Mesh`
 +        """
 +
          if (isinstance( theObject, Mesh )):
              theObject = theObject.GetMesh()
          if (isinstance(Axis, geomBuilder.GEOM._objref_GEOM_Object)):
          self.mesh.SetParameters(Parameters)
          return Mesh( self.smeshpyD, self.geompyD, mesh )
  
 -    ## Find groups of adjacent nodes within Tolerance.
 -    #  @param Tolerance the value of tolerance
 -    #  @param SeparateCornerAndMediumNodes if @c True, in quadratic mesh puts
 -    #         corner and medium nodes in separate groups thus preventing
 -    #         their further merge.
 -    #  @return the list of groups of nodes IDs (e.g. [[1,12,13],[4,25]])
 -    #  @ingroup l2_modif_trsf
 +    def Offset(self, theObject, Value, MakeGroups=False, CopyElements=False, NewMeshName=''):
 +        """
 +        Create an offset mesh from the given 2D object
 +
 +        Parameters:
 +            theObject (SMESH.SMESH_IDSource): the source object (mesh, sub-mesh, group or filter)
 +            theValue (float): signed offset size
 +            MakeGroups (boolean): forces the generation of new groups from existing ones
 +            CopyElements (boolean): if *NewMeshName* is empty, True means to keep original elements, 
 +                          False means to remove original elements.
 +            NewMeshName (string): the name of a mesh to create. If empty, offset elements are added to this mesh
 +
 +        Returns:
 +            A tuple (:class:`Mesh`, list of :class:`groups <SMESH.SMESH_Group>`)
 +        """
 +
 +        if isinstance( theObject, Mesh ):
 +            theObject = theObject.GetMesh()
 +        theValue,Parameters,hasVars = ParseParameters(Value)
 +        mesh_groups = self.editor.Offset(theObject, Value, MakeGroups, CopyElements, NewMeshName)
 +        self.mesh.SetParameters(Parameters)
 +        # if mesh_groups[0]:
 +        #     return Mesh( self.smeshpyD, self.geompyD, mesh_groups[0] ), mesh_groups[1]
 +        return mesh_groups
 +
      def FindCoincidentNodes (self, Tolerance, SeparateCornerAndMediumNodes=False):
 +        """
 +        Find groups of adjacent nodes within Tolerance.
 +
 +        Parameters:
 +            Tolerance (float): the value of tolerance
 +            SeparateCornerAndMediumNodes (boolean): if *True*, in quadratic mesh puts
 +                corner and medium nodes in separate groups thus preventing
 +                their further merge.
 +
 +        Returns:
 +            the list of groups of nodes IDs (e.g. [[1,12,13],[4,25]])
 +        """
 +
          return self.editor.FindCoincidentNodes( Tolerance, SeparateCornerAndMediumNodes )
  
 -    ## Find groups of ajacent nodes within Tolerance.
 -    #  @param Tolerance the value of tolerance
 -    #  @param SubMeshOrGroup SubMesh, Group or Filter
 -    #  @param exceptNodes list of either SubMeshes, Groups or node IDs to exclude from search
 -    #  @param SeparateCornerAndMediumNodes if @c True, in quadratic mesh puts
 -    #         corner and medium nodes in separate groups thus preventing
 -    #         their further merge.
 -    #  @return the list of groups of nodes IDs (e.g. [[1,12,13],[4,25]])
 -    #  @ingroup l2_modif_trsf
      def FindCoincidentNodesOnPart (self, SubMeshOrGroup, Tolerance,
                                     exceptNodes=[], SeparateCornerAndMediumNodes=False):
 +        """
 +        Find groups of ajacent nodes within Tolerance.
 +
 +        Parameters:
 +            Tolerance: the value of tolerance
 +            SubMeshOrGroup: :class:`sub-mesh, group or filter <SMESH.SMESH_IDSource>`
 +            exceptNodes: list of either SubMeshes, Groups or node IDs to exclude from search
 +            SeparateCornerAndMediumNodes: if *True*, in quadratic mesh puts
 +                corner and medium nodes in separate groups thus preventing
 +                their further merge.
 +
 +        Returns:
 +            the list of groups of nodes IDs (e.g. [[1,12,13],[4,25]])
 +        """
 +
          unRegister = genObjUnRegister()
          if (isinstance( SubMeshOrGroup, Mesh )):
              SubMeshOrGroup = SubMeshOrGroup.GetMesh()
          return self.editor.FindCoincidentNodesOnPartBut(SubMeshOrGroup, Tolerance,
                                                          exceptNodes, SeparateCornerAndMediumNodes)
  
 -    ## Merge nodes
 -    #  @param GroupsOfNodes a list of groups of nodes IDs for merging
 -    #         (e.g. [[1,12,13],[25,4]], then nodes 12, 13 and 4 will be removed and replaced
 -    #         by nodes 1 and 25 correspondingly in all elements and groups
 -    #  @param NodesToKeep nodes to keep in the mesh: a list of groups, sub-meshes or node IDs.
 -    #         If @a NodesToKeep does not include a node to keep for some group to merge,
 -    #         then the first node in the group is kept.
 -    #  @param AvoidMakingHoles prevent merging nodes which cause removal of elements becoming
 -    #         invalid
 -    #  @ingroup l2_modif_trsf
      def MergeNodes (self, GroupsOfNodes, NodesToKeep=[], AvoidMakingHoles=False):
 -        # NodesToKeep are converted to SMESH_IDSource in meshEditor.MergeNodes()
 +        """
 +        Merge nodes
 +
 +        Parameters:
 +            GroupsOfNodes: a list of groups of nodes IDs for merging.
 +                E.g. [[1,12,13],[25,4]] means that nodes 12, 13 and 4 will be removed and replaced
 +                in all elements and groups by nodes 1 and 25 correspondingly
 +            NodesToKeep: nodes to keep in the mesh: a list of groups, sub-meshes or node IDs.
 +                If *NodesToKeep* does not include a node to keep for some group to merge,
 +                then the first node in the group is kept.
 +            AvoidMakingHoles: prevent merging nodes which cause removal of elements becoming
 +                invalid
 +        """
 +        # NodesToKeep are converted to SMESH.SMESH_IDSource in meshEditor.MergeNodes()
          self.editor.MergeNodes( GroupsOfNodes, NodesToKeep, AvoidMakingHoles )
  
 -    ## Find the elements built on the same nodes.
 -    #  @param MeshOrSubMeshOrGroup Mesh or SubMesh, or Group of elements for searching
 -    #  @return the list of groups of equal elements IDs (e.g. [[1,12,13],[4,25]])
 -    #  @ingroup l2_modif_trsf
      def FindEqualElements (self, MeshOrSubMeshOrGroup=None):
 +        """
 +        Find the elements built on the same nodes.
 +
 +        Parameters:
 +            MeshOrSubMeshOrGroup: :class:`mesh, sub-mesh, group or filter <SMESH.SMESH_IDSource>`
 +
 +        Returns:
 +            the list of groups of equal elements IDs (e.g. [[1,12,13],[4,25]])
 +        """
 +
          if not MeshOrSubMeshOrGroup:
              MeshOrSubMeshOrGroup=self.mesh
          elif isinstance( MeshOrSubMeshOrGroup, Mesh ):
              MeshOrSubMeshOrGroup = MeshOrSubMeshOrGroup.GetMesh()
          return self.editor.FindEqualElements( MeshOrSubMeshOrGroup )
  
 -    ## Merge elements in each given group.
 -    #  @param GroupsOfElementsID a list of groups of elements IDs for merging
 -    #        (e.g. [[1,12,13],[25,4]], then elements 12, 13 and 4 will be removed and
 -    #        replaced by elements 1 and 25 in all groups)
 -    #  @ingroup l2_modif_trsf
      def MergeElements(self, GroupsOfElementsID):
 +        """
 +        Merge elements in each given group.
 +
 +        Parameters:
 +            GroupsOfElementsID: a list of groups (lists) of elements IDs for merging
 +                (e.g. [[1,12,13],[25,4]] means that elements 12, 13 and 4 will be removed and
 +                replaced in all groups by elements 1 and 25)
 +        """
 +
          self.editor.MergeElements(GroupsOfElementsID)
  
 -    ## Leave one element and remove all other elements built on the same nodes.
 -    #  @ingroup l2_modif_trsf
      def MergeEqualElements(self):
 +        """
 +        Leave one element and remove all other elements built on the same nodes.
 +        """
 +
          self.editor.MergeEqualElements()
  
 -    ## Returns all or only closed free borders
 -    #  @return list of SMESH.FreeBorder's
 -    #  @ingroup l2_modif_trsf
      def FindFreeBorders(self, ClosedOnly=True):
 +        """
 +        Returns all or only closed free borders
 +
 +        Returns:
 +            list of SMESH.FreeBorder's
 +        """
 +
          return self.editor.FindFreeBorders( ClosedOnly )
  
 -    ## Fill with 2D elements a hole defined by a SMESH.FreeBorder.
 -    #  @param FreeBorder either a SMESH.FreeBorder or a list on node IDs. These nodes
 -    #         must describe all sequential nodes of the hole border. The first and the last
 -    #         nodes must be the same. Use FindFreeBorders() to get nodes of holes.
 -    #  @ingroup l2_modif_trsf
      def FillHole(self, holeNodes):
 +        """
 +        Fill with 2D elements a hole defined by a SMESH.FreeBorder.
 +
 +        Parameters:
 +            FreeBorder: either a SMESH.FreeBorder or a list on node IDs. These nodes
 +                must describe all sequential nodes of the hole border. The first and the last
 +                nodes must be the same. Use :meth:`FindFreeBorders` to get nodes of holes.
 +        """
 +
 +
          if holeNodes and isinstance( holeNodes, list ) and isinstance( holeNodes[0], int ):
              holeNodes = SMESH.FreeBorder(nodeIDs=holeNodes)
          if not isinstance( holeNodes, SMESH.FreeBorder ):
-             raise TypeError, "holeNodes must be either SMESH.FreeBorder or list of integer and not %s" % holeNodes
+             raise TypeError("holeNodes must be either SMESH.FreeBorder or list of integer and not %s" % holeNodes)
          self.editor.FillHole( holeNodes )
  
 -    ## Return groups of FreeBorder's coincident within the given tolerance.
 -    #  @param tolerance the tolerance. If the tolerance <= 0.0 then one tenth of an average
 -    #         size of elements adjacent to free borders being compared is used.
 -    #  @return SMESH.CoincidentFreeBorders structure
 -    #  @ingroup l2_modif_trsf
      def FindCoincidentFreeBorders (self, tolerance=0.):
 +        """
 +        Return groups of FreeBorder's coincident within the given tolerance.
 +
 +        Parameters:
 +            tolerance: the tolerance. If the tolerance <= 0.0 then one tenth of an average
 +                size of elements adjacent to free borders being compared is used.
 +
 +        Returns:
 +            SMESH.CoincidentFreeBorders structure
 +        """
 +
          return self.editor.FindCoincidentFreeBorders( tolerance )
  
 -    ## Sew FreeBorder's of each group
 -    #  @param freeBorders either a SMESH.CoincidentFreeBorders structure or a list of lists
 -    #         where each enclosed list contains node IDs of a group of coincident free
 -    #         borders such that each consequent triple of IDs within a group describes
 -    #         a free border in a usual way: n1, n2, nLast - i.e. 1st node, 2nd node and
 -    #         last node of a border.
 -    #         For example [[1, 2, 10, 20, 21, 40], [11, 12, 15, 55, 54, 41]] describes two
 -    #         groups of coincident free borders, each group including two borders.
 -    #  @param createPolygons if @c True faces adjacent to free borders are converted to
 -    #         polygons if a node of opposite border falls on a face edge, else such
 -    #         faces are split into several ones.
 -    #  @param createPolyhedra if @c True volumes adjacent to free borders are converted to
 -    #         polyhedra if a node of opposite border falls on a volume edge, else such
 -    #         volumes, if any, remain intact and the mesh becomes non-conformal.
 -    #  @return a number of successfully sewed groups
 -    #  @ingroup l2_modif_trsf
      def SewCoincidentFreeBorders (self, freeBorders, createPolygons=False, createPolyhedra=False):
 +        """
 +        Sew FreeBorder's of each group
 +
 +        Parameters:
 +            freeBorders: either a SMESH.CoincidentFreeBorders structure or a list of lists
 +                where each enclosed list contains node IDs of a group of coincident free
 +                borders such that each consequent triple of IDs within a group describes
 +                a free border in a usual way: n1, n2, nLast - i.e. 1st node, 2nd node and
 +                last node of a border.
 +                For example [[1, 2, 10, 20, 21, 40], [11, 12, 15, 55, 54, 41]] describes two
 +                groups of coincident free borders, each group including two borders.
 +            createPolygons: if :code:`True` faces adjacent to free borders are converted to
 +                polygons if a node of opposite border falls on a face edge, else such
 +                faces are split into several ones.
 +            createPolyhedra: if :code:`True` volumes adjacent to free borders are converted to
 +                polyhedra if a node of opposite border falls on a volume edge, else such
 +                volumes, if any, remain intact and the mesh becomes non-conformal.
 +
 +        Returns:
 +            a number of successfully sewed groups
 +        """
 +
          if freeBorders and isinstance( freeBorders, list ):
              # construct SMESH.CoincidentFreeBorders
              if isinstance( freeBorders[0], int ):
              coincidentGroups = []
              for nodeList in freeBorders:
                  if not nodeList or len( nodeList ) % 3:
-                     raise ValueError, "Wrong number of nodes in this group: %s" % nodeList
+                     raise ValueError("Wrong number of nodes in this group: %s" % nodeList)
                  group = []
                  while nodeList:
                      group.append  ( SMESH.FreeBorderPart( len(borders), 0, 1, 2 ))
  
          return self.editor.SewCoincidentFreeBorders( freeBorders, createPolygons, createPolyhedra )
  
 -    ## Sew free borders
 -    #  @return SMESH::Sew_Error
 -    #  @ingroup l2_modif_trsf
      def SewFreeBorders (self, FirstNodeID1, SecondNodeID1, LastNodeID1,
                          FirstNodeID2, SecondNodeID2, LastNodeID2,
                          CreatePolygons, CreatePolyedrs):
 +        """
 +        Sew free borders
 +
 +        Returns:
 +            :class:`error code <SMESH.SMESH_MeshEditor.Sew_Error>`
 +        """
 +
          return self.editor.SewFreeBorders(FirstNodeID1, SecondNodeID1, LastNodeID1,
                                            FirstNodeID2, SecondNodeID2, LastNodeID2,
                                            CreatePolygons, CreatePolyedrs)
  
 -    ## Sew conform free borders
 -    #  @return SMESH::Sew_Error
 -    #  @ingroup l2_modif_trsf
      def SewConformFreeBorders (self, FirstNodeID1, SecondNodeID1, LastNodeID1,
                                 FirstNodeID2, SecondNodeID2):
 +        """
 +        Sew conform free borders
 +
 +        Returns:
 +            :class:`error code <SMESH.SMESH_MeshEditor.Sew_Error>`
 +        """
 +
          return self.editor.SewConformFreeBorders(FirstNodeID1, SecondNodeID1, LastNodeID1,
                                                   FirstNodeID2, SecondNodeID2)
  
 -    ## Sew border to side
 -    #  @return SMESH::Sew_Error
 -    #  @ingroup l2_modif_trsf
      def SewBorderToSide (self, FirstNodeIDOnFreeBorder, SecondNodeIDOnFreeBorder, LastNodeIDOnFreeBorder,
                           FirstNodeIDOnSide, LastNodeIDOnSide, CreatePolygons, CreatePolyedrs):
 +        """
 +        Sew border to side
 +
 +        Returns:
 +            :class:`error code <SMESH.SMESH_MeshEditor.Sew_Error>`
 +        """
 +
          return self.editor.SewBorderToSide(FirstNodeIDOnFreeBorder, SecondNodeIDOnFreeBorder, LastNodeIDOnFreeBorder,
                                             FirstNodeIDOnSide, LastNodeIDOnSide, CreatePolygons, CreatePolyedrs)
  
 -    ## Sew two sides of a mesh. The nodes belonging to Side1 are
 -    #  merged with the nodes of elements of Side2.
 -    #  The number of elements in theSide1 and in theSide2 must be
 -    #  equal and they should have similar nodal connectivity.
 -    #  The nodes to merge should belong to side borders and
 -    #  the first node should be linked to the second.
 -    #  @return SMESH::Sew_Error
 -    #  @ingroup l2_modif_trsf
      def SewSideElements (self, IDsOfSide1Elements, IDsOfSide2Elements,
                           NodeID1OfSide1ToMerge, NodeID1OfSide2ToMerge,
                           NodeID2OfSide1ToMerge, NodeID2OfSide2ToMerge):
 +        """
 +        Sew two sides of a mesh. The nodes belonging to Side1 are
 +        merged with the nodes of elements of Side2.
 +        The number of elements in theSide1 and in theSide2 must be
 +        equal and they should have similar nodal connectivity.
 +        The nodes to merge should belong to side borders and
 +        the first node should be linked to the second.
 +
 +        Returns:
 +            :class:`error code <SMESH.SMESH_MeshEditor.Sew_Error>`
 +        """
 +
          return self.editor.SewSideElements(IDsOfSide1Elements, IDsOfSide2Elements,
                                             NodeID1OfSide1ToMerge, NodeID1OfSide2ToMerge,
                                             NodeID2OfSide1ToMerge, NodeID2OfSide2ToMerge)
  
 -    ## Set new nodes for the given element.
 -    #  @param ide the element id
 -    #  @param newIDs nodes ids
 -    #  @return If the number of nodes does not correspond to the type of element - return false
 -    #  @ingroup l2_modif_edit
      def ChangeElemNodes(self, ide, newIDs):
 +        """
 +        Set new nodes for the given element.
 +
 +        Parameters:
 +            ide: the element ID
 +            newIDs: nodes IDs
 +
 +        Returns:
 +            False if the number of nodes does not correspond to the type of element
 +        """
 +
          return self.editor.ChangeElemNodes(ide, newIDs)
  
 -    ## If during the last operation of MeshEditor some nodes were
 -    #  created, this method return the list of their IDs, \n
 -    #  if new nodes were not created - return empty list
 -    #  @return the list of integer values (can be empty)
 -    #  @ingroup l2_modif_add
      def GetLastCreatedNodes(self):
 +        """
 +        If during the last operation of :class:`SMESH.SMESH_MeshEditor` some nodes were
 +        created, this method return the list of their IDs.
 +        If new nodes were not created - return empty list
 +
 +        Returns:
 +            the list of integer values (can be empty)
 +        """
 +
          return self.editor.GetLastCreatedNodes()
  
 -    ## If during the last operation of MeshEditor some elements were
 -    #  created this method return the list of their IDs, \n
 -    #  if new elements were not created - return empty list
 -    #  @return the list of integer values (can be empty)
 -    #  @ingroup l2_modif_add
      def GetLastCreatedElems(self):
 +        """
 +        If during the last operation of :class:`SMESH.SMESH_MeshEditor` some elements were
 +        created this method return the list of their IDs.
 +        If new elements were not created - return empty list
 +
 +        Returns:
 +            the list of integer values (can be empty)
 +        """
 +
          return self.editor.GetLastCreatedElems()
  
 -    ## Forget what nodes and elements were created by the last mesh edition operation
 -    #  @ingroup l2_modif_add
      def ClearLastCreated(self):
 +        """
 +        Forget what nodes and elements were created by the last mesh edition operation
 +        """
 +
          self.editor.ClearLastCreated()
  
 -    ## Create duplicates of given elements, i.e. create new elements based on the
 -    #  same nodes as the given ones.
 -    #  @param theElements - container of elements to duplicate. It can be a Mesh,
 -    #         sub-mesh, group, filter or a list of element IDs. If \a theElements is
 -    #         a Mesh, elements of highest dimension are duplicated
 -    #  @param theGroupName - a name of group to contain the generated elements.
 -    #                    If a group with such a name already exists, the new elements
 -    #                    are added to the existng group, else a new group is created.
 -    #                    If \a theGroupName is empty, new elements are not added
 -    #                    in any group.
 -    # @return a group where the new elements are added. None if theGroupName == "".
 -    #  @ingroup l2_modif_duplicat
      def DoubleElements(self, theElements, theGroupName=""):
 +        """
 +        Create duplicates of given elements, i.e. create new elements based on the
 +        same nodes as the given ones.
 +
 +        Parameters:
 +            theElements: container of elements to duplicate. It can be a
 +                :class:`mesh, sub-mesh, group, filter <SMESH.SMESH_IDSource>` 
 +                or a list of element IDs. If *theElements* is
 +                a :class:`Mesh`, elements of highest dimension are duplicated
 +            theGroupName: a name of group to contain the generated elements.
 +                If a group with such a name already exists, the new elements
 +                are added to the existng group, else a new group is created.
 +                If *theGroupName* is empty, new elements are not added
 +                in any group.
 +
 +        Returns:
 +                a :class:`group <SMESH.SMESH_Group>` where the new elements are added. 
 +                None if *theGroupName* == "".
 +        """
 +
          unRegister = genObjUnRegister()
          if isinstance( theElements, Mesh ):
              theElements = theElements.mesh
              unRegister.set( theElements )
          return self.editor.DoubleElements(theElements, theGroupName)
  
 -    ## Create a hole in a mesh by doubling the nodes of some particular elements
 -    #  @param theNodes identifiers of nodes to be doubled
 -    #  @param theModifiedElems identifiers of elements to be updated by the new (doubled)
 -    #         nodes. If list of element identifiers is empty then nodes are doubled but
 -    #         they not assigned to elements
 -    #  @return TRUE if operation has been completed successfully, FALSE otherwise
 -    #  @ingroup l2_modif_duplicat
      def DoubleNodes(self, theNodes, theModifiedElems):
 +        """
 +        Create a hole in a mesh by doubling the nodes of some particular elements
 +
 +        Parameters:
 +            theNodes: IDs of nodes to be doubled
 +            theModifiedElems: IDs of elements to be updated by the new (doubled)
 +                nodes. If list of element identifiers is empty then nodes are doubled but
 +                they not assigned to elements
 +
 +        Returns:
 +            True if operation has been completed successfully, False otherwise
 +        """
 +
          return self.editor.DoubleNodes(theNodes, theModifiedElems)
  
 -    ## Create a hole in a mesh by doubling the nodes of some particular elements
 -    #  This method provided for convenience works as DoubleNodes() described above.
 -    #  @param theNodeId identifiers of node to be doubled
 -    #  @param theModifiedElems identifiers of elements to be updated
 -    #  @return TRUE if operation has been completed successfully, FALSE otherwise
 -    #  @ingroup l2_modif_duplicat
      def DoubleNode(self, theNodeId, theModifiedElems):
 +        """
 +        Create a hole in a mesh by doubling the nodes of some particular elements.
 +        This method provided for convenience works as :meth:`DoubleNodes`.
 +
 +        Parameters:
 +            theNodeId: IDs of node to double
 +            theModifiedElems: IDs of elements to update
 +
 +        Returns:
 +            True if operation has been completed successfully, False otherwise
 +        """
 +
          return self.editor.DoubleNode(theNodeId, theModifiedElems)
  
 -    ## Create a hole in a mesh by doubling the nodes of some particular elements
 -    #  This method provided for convenience works as DoubleNodes() described above.
 -    #  @param theNodes group of nodes to be doubled
 -    #  @param theModifiedElems group of elements to be updated.
 -    #  @param theMakeGroup forces the generation of a group containing new nodes.
 -    #  @return TRUE or a created group if operation has been completed successfully,
 -    #          FALSE or None otherwise
 -    #  @ingroup l2_modif_duplicat
      def DoubleNodeGroup(self, theNodes, theModifiedElems, theMakeGroup=False):
 +        """
 +        Create a hole in a mesh by doubling the nodes of some particular elements.
 +        This method provided for convenience works as :meth:`DoubleNodes`.
 +
 +        Parameters:
 +            theNodes: group of nodes to double.
 +            theModifiedElems: group of elements to update.
 +            theMakeGroup: forces the generation of a group containing new nodes.
 +
 +        Returns:
 +            True or a created group if operation has been completed successfully,
 +            False or None otherwise
 +        """
 +
          if theMakeGroup:
              return self.editor.DoubleNodeGroupNew(theNodes, theModifiedElems)
          return self.editor.DoubleNodeGroup(theNodes, theModifiedElems)
  
 -    ## Create a hole in a mesh by doubling the nodes of some particular elements
 -    #  This method provided for convenience works as DoubleNodes() described above.
 -    #  @param theNodes list of groups of nodes to be doubled
 -    #  @param theModifiedElems list of groups of elements to be updated.
 -    #  @param theMakeGroup forces the generation of a group containing new nodes.
 -    #  @return TRUE if operation has been completed successfully, FALSE otherwise
 -    #  @ingroup l2_modif_duplicat
      def DoubleNodeGroups(self, theNodes, theModifiedElems, theMakeGroup=False):
 +        """
 +        Create a hole in a mesh by doubling the nodes of some particular elements.
 +        This method provided for convenience works as :meth:`DoubleNodes`.
 +
 +        Parameters:
 +            theNodes: list of groups of nodes to double.
 +            theModifiedElems: list of groups of elements to update.
 +            theMakeGroup: forces the generation of a group containing new nodes.
 +
 +        Returns:
 +            True if operation has been completed successfully, False otherwise
 +        """
 +
          if theMakeGroup:
              return self.editor.DoubleNodeGroupsNew(theNodes, theModifiedElems)
          return self.editor.DoubleNodeGroups(theNodes, theModifiedElems)
  
 -    ## Create a hole in a mesh by doubling the nodes of some particular elements
 -    #  @param theElems - the list of elements (edges or faces) to be replicated
 -    #         The nodes for duplication could be found from these elements
 -    #  @param theNodesNot - list of nodes to NOT replicate
 -    #  @param theAffectedElems - the list of elements (cells and edges) to which the
 -    #         replicated nodes should be associated to.
 -    #  @return TRUE if operation has been completed successfully, FALSE otherwise
 -    #  @ingroup l2_modif_duplicat
      def DoubleNodeElem(self, theElems, theNodesNot, theAffectedElems):
 +        """
 +        Create a hole in a mesh by doubling the nodes of some particular elements
 +
 +        Parameters:
 +            theElems: the list of elements (edges or faces) to replicate.
 +                The nodes for duplication could be found from these elements
 +            theNodesNot: list of nodes NOT to replicate
 +            theAffectedElems: the list of elements (cells and edges) to which the
 +                replicated nodes should be associated to
 +
 +        Returns:
 +            True if operation has been completed successfully, False otherwise
 +        """
 +
          return self.editor.DoubleNodeElem(theElems, theNodesNot, theAffectedElems)
  
 -    ## Create a hole in a mesh by doubling the nodes of some particular elements
 -    #  @param theElems - the list of elements (edges or faces) to be replicated
 -    #         The nodes for duplication could be found from these elements
 -    #  @param theNodesNot - list of nodes to NOT replicate
 -    #  @param theShape - shape to detect affected elements (element which geometric center
 -    #         located on or inside shape).
 -    #         The replicated nodes should be associated to affected elements.
 -    #  @return TRUE if operation has been completed successfully, FALSE otherwise
 -    #  @ingroup l2_modif_duplicat
      def DoubleNodeElemInRegion(self, theElems, theNodesNot, theShape):
 +        """
 +        Create a hole in a mesh by doubling the nodes of some particular elements
 +
 +        Parameters:
 +            theElems: the list of elements (edges or faces) to replicate.
 +                The nodes for duplication could be found from these elements
 +            theNodesNot: list of nodes NOT to replicate
 +            theShape: shape to detect affected elements (element which geometric center
 +                located on or inside shape).
 +                The replicated nodes should be associated to affected elements.
 +
 +        Returns:
 +            True if operation has been completed successfully, False otherwise
 +        """
 +
          return self.editor.DoubleNodeElemInRegion(theElems, theNodesNot, theShape)
  
 -    ## Create a hole in a mesh by doubling the nodes of some particular elements
 -    #  This method provided for convenience works as DoubleNodes() described above.
 -    #  @param theElems - group of of elements (edges or faces) to be replicated
 -    #  @param theNodesNot - group of nodes not to replicated
 -    #  @param theAffectedElems - group of elements to which the replicated nodes
 -    #         should be associated to.
 -    #  @param theMakeGroup forces the generation of a group containing new elements.
 -    #  @param theMakeNodeGroup forces the generation of a group containing new nodes.
 -    #  @return TRUE or created groups (one or two) if operation has been completed successfully,
 -    #          FALSE or None otherwise
 -    #  @ingroup l2_modif_duplicat
      def DoubleNodeElemGroup(self, theElems, theNodesNot, theAffectedElems,
                               theMakeGroup=False, theMakeNodeGroup=False):
 +        """
 +        Create a hole in a mesh by doubling the nodes of some particular elements.
 +        This method provided for convenience works as :meth:`DoubleNodes`.
 +
 +        Parameters:
 +            theElems: group of of elements (edges or faces) to replicate.
 +            theNodesNot: group of nodes NOT to replicate.
 +            theAffectedElems: group of elements to which the replicated nodes
 +                should be associated to.
 +            theMakeGroup: forces the generation of a group containing new elements.
 +            theMakeNodeGroup: forces the generation of a group containing new nodes.
 +
 +        Returns:
 +            True or created groups (one or two) if operation has been completed successfully,
 +            False or None otherwise
 +        """
 +
          if theMakeGroup or theMakeNodeGroup:
              twoGroups = self.editor.DoubleNodeElemGroup2New(theElems, theNodesNot,
                                                              theAffectedElems,
                  return twoGroups[ int(theMakeNodeGroup) ]
          return self.editor.DoubleNodeElemGroup(theElems, theNodesNot, theAffectedElems)
  
 -    ## Create a hole in a mesh by doubling the nodes of some particular elements
 -    #  This method provided for convenience works as DoubleNodes() described above.
 -    #  @param theElems - group of of elements (edges or faces) to be replicated
 -    #  @param theNodesNot - group of nodes not to replicated
 -    #  @param theShape - shape to detect affected elements (element which geometric center
 -    #         located on or inside shape).
 -    #         The replicated nodes should be associated to affected elements.
 -    #  @ingroup l2_modif_duplicat
      def DoubleNodeElemGroupInRegion(self, theElems, theNodesNot, theShape):
 +        """
 +        Create a hole in a mesh by doubling the nodes of some particular elements.
 +        This method provided for convenience works as :meth:`DoubleNodes`.
 +
 +        Parameters:
 +            theElems: group of of elements (edges or faces) to replicate
 +            theNodesNot: group of nodes not to replicate
 +            theShape: shape to detect affected elements (element which geometric center
 +                located on or inside shape).
 +                The replicated nodes should be associated to affected elements
 +        """
 +
          return self.editor.DoubleNodeElemGroupInRegion(theElems, theNodesNot, theShape)
  
 -    ## Create a hole in a mesh by doubling the nodes of some particular elements
 -    #  This method provided for convenience works as DoubleNodes() described above.
 -    #  @param theElems - list of groups of elements (edges or faces) to be replicated
 -    #  @param theNodesNot - list of groups of nodes not to replicated
 -    #  @param theAffectedElems - group of elements to which the replicated nodes
 -    #         should be associated to.
 -    #  @param theMakeGroup forces the generation of a group containing new elements.
 -    #  @param theMakeNodeGroup forces the generation of a group containing new nodes.
 -    #  @return TRUE or created groups (one or two) if operation has been completed successfully,
 -    #          FALSE or None otherwise
 -    #  @ingroup l2_modif_duplicat
      def DoubleNodeElemGroups(self, theElems, theNodesNot, theAffectedElems,
                               theMakeGroup=False, theMakeNodeGroup=False):
 +        """
 +        Create a hole in a mesh by doubling the nodes of some particular elements.
 +        This method provided for convenience works as :meth:`DoubleNodes`.
 +
 +        Parameters:
 +            theElems: list of groups of elements (edges or faces) to replicate
 +            theNodesNot: list of groups of nodes NOT to replicate
 +            theAffectedElems: group of elements to which the replicated nodes
 +                should be associated to
 +            theMakeGroup: forces generation of a group containing new elements.
 +            theMakeNodeGroup: forces generation of a group containing new nodes
 +
 +        Returns:
 +            True or created groups (one or two) if operation has been completed successfully,
 +            False or None otherwise
 +        """
 +
          if theMakeGroup or theMakeNodeGroup:
              twoGroups = self.editor.DoubleNodeElemGroups2New(theElems, theNodesNot,
                                                               theAffectedElems,
                  return twoGroups[ int(theMakeNodeGroup) ]
          return self.editor.DoubleNodeElemGroups(theElems, theNodesNot, theAffectedElems)
  
 -    ## Create a hole in a mesh by doubling the nodes of some particular elements
 -    #  This method provided for convenience works as DoubleNodes() described above.
 -    #  @param theElems - list of groups of elements (edges or faces) to be replicated
 -    #  @param theNodesNot - list of groups of nodes not to replicated
 -    #  @param theShape - shape to detect affected elements (element which geometric center
 -    #         located on or inside shape).
 -    #         The replicated nodes should be associated to affected elements.
 -    #  @return TRUE if operation has been completed successfully, FALSE otherwise
 -    #  @ingroup l2_modif_duplicat
      def DoubleNodeElemGroupsInRegion(self, theElems, theNodesNot, theShape):
 +        """
 +        Create a hole in a mesh by doubling the nodes of some particular elements.
 +        This method provided for convenience works as :meth:`DoubleNodes`.
 +
 +        Parameters:
 +            theElems: list of groups of elements (edges or faces) to replicate
 +            theNodesNot: list of groups of nodes NOT to replicate
 +            theShape: shape to detect affected elements (element which geometric center
 +                located on or inside shape).
 +                The replicated nodes should be associated to affected elements
 +
 +        Returns:
 +            True if operation has been completed successfully, False otherwise
 +        """
 +
          return self.editor.DoubleNodeElemGroupsInRegion(theElems, theNodesNot, theShape)
  
 -    ## Identify the elements that will be affected by node duplication (actual duplication is not performed.
 -    #  This method is the first step of DoubleNodeElemGroupsInRegion.
 -    #  @param theElems - list of groups of nodes or elements (edges or faces) to be replicated
 -    #  @param theNodesNot - list of groups of nodes not to replicated
 -    #  @param theShape - shape to detect affected elements (element which geometric center
 -    #         located on or inside shape).
 -    #         The replicated nodes should be associated to affected elements.
 -    #  @return groups of affected elements in order: volumes, faces, edges
 -    #  @ingroup l2_modif_duplicat
      def AffectedElemGroupsInRegion(self, theElems, theNodesNot, theShape):
 +        """
 +        Identify the elements that will be affected by node duplication (actual duplication is not performed).
 +        This method is the first step of :meth:`DoubleNodeElemGroupsInRegion`.
 +
 +        Parameters:
 +            theElems: list of groups of nodes or elements (edges or faces) to replicate
 +            theNodesNot: list of groups of nodes NOT to replicate
 +            theShape: shape to detect affected elements (element which geometric center
 +                located on or inside shape).
 +                The replicated nodes should be associated to affected elements
 +
 +        Returns:
 +            groups of affected elements in order: volumes, faces, edges
 +        """
 +
          return self.editor.AffectedElemGroupsInRegion(theElems, theNodesNot, theShape)
  
 -    ## Double nodes on shared faces between groups of volumes and create flat elements on demand.
 -    #  The list of groups must describe a partition of the mesh volumes.
 -    #  The nodes of the internal faces at the boundaries of the groups are doubled.
 -    #  In option, the internal faces are replaced by flat elements.
 -    #  Triangles are transformed in prisms, and quadrangles in hexahedrons.
 -    #  @param theDomains - list of groups of volumes
 -    #  @param createJointElems - if TRUE, create the elements
 -    #  @param onAllBoundaries - if TRUE, the nodes and elements are also created on
 -    #         the boundary between \a theDomains and the rest mesh
 -    #  @return TRUE if operation has been completed successfully, FALSE otherwise
 -    #  @ingroup l2_modif_duplicat
      def DoubleNodesOnGroupBoundaries(self, theDomains, createJointElems, onAllBoundaries=False ):
++
 +        """
 +        Double nodes on shared faces between groups of volumes and create flat elements on demand.
 +        The list of groups must describe a partition of the mesh volumes.
 +        The nodes of the internal faces at the boundaries of the groups are doubled.
 +        In option, the internal faces are replaced by flat elements.
 +        Triangles are transformed to prisms, and quadrangles to hexahedrons.
 +
 +        Parameters:
 +            theDomains: list of groups of volumes
 +            createJointElems: if True, create the elements
 +            onAllBoundaries: if True, the nodes and elements are also created on
 +                the boundary between *theDomains* and the rest mesh
 +
 +        Returns:
 +            True if operation has been completed successfully, False otherwise
 +        """
 +
          return self.editor.DoubleNodesOnGroupBoundaries( theDomains, createJointElems, onAllBoundaries )
  
 -    ## Double nodes on some external faces and create flat elements.
 -    #  Flat elements are mainly used by some types of mechanic calculations.
 -    #
 -    #  Each group of the list must be constituted of faces.
 -    #  Triangles are transformed in prisms, and quadrangles in hexahedrons.
 -    #  @param theGroupsOfFaces - list of groups of faces
 -    #  @return TRUE if operation has been completed successfully, FALSE otherwise
 -    #  @ingroup l2_modif_duplicat
      def CreateFlatElementsOnFacesGroups(self, theGroupsOfFaces ):
 +        """
 +        Double nodes on some external faces and create flat elements.
 +        Flat elements are mainly used by some types of mechanic calculations.
 +
 +        Each group of the list must be constituted of faces.
 +        Triangles are transformed in prisms, and quadrangles in hexahedrons.
 +
 +        Parameters:
 +            theGroupsOfFaces: list of groups of faces
 +
 +        Returns:
 +            True if operation has been completed successfully, False otherwise
 +        """
 +
          return self.editor.CreateFlatElementsOnFacesGroups( theGroupsOfFaces )
  
 -    ## identify all the elements around a geom shape, get the faces delimiting the hole
 -    #
      def CreateHoleSkin(self, radius, theShape, groupName, theNodesCoords):
 +        """
 +        Identify all the elements around a geom shape, get the faces delimiting the hole
 +        """
          return self.editor.CreateHoleSkin( radius, theShape, groupName, theNodesCoords )
  
 -    ## Create a polyline consisting of 1D mesh elements each lying on a 2D element of
 -    #  the initial mesh. Positions of new nodes are found by cutting the mesh by the
 -    #  plane passing through pairs of points specified by each PolySegment structure.
 -    #  If there are several paths connecting a pair of points, the shortest path is
 -    #  selected by the module. Position of the cutting plane is defined by the two
 -    #  points and an optional vector lying on the plane specified by a PolySegment.
 -    #  By default the vector is defined by Mesh module as following. A middle point
 -    #  of the two given points is computed. The middle point is projected to the mesh.
 -    #  The vector goes from the middle point to the projection point. In case of planar
 -    #  mesh, the vector is normal to the mesh.
 -    #  @param segments - PolySegment's defining positions of cutting planes.
 -    #         Return the used vector which goes from the middle point to its projection.
 -    #  @param groupName - optional name of a group where created mesh segments will
 -    #         be added.
 -    #  @ingroup l2_modif_duplicat
      def MakePolyLine(self, segments, groupName='', isPreview=False ):
 +        """    
 +        Create a polyline consisting of 1D mesh elements each lying on a 2D element of
 +        the initial mesh. Positions of new nodes are found by cutting the mesh by the
 +        plane passing through pairs of points specified by each :class:`SMESH.PolySegment` structure.
 +        If there are several paths connecting a pair of points, the shortest path is
 +        selected by the module. Position of the cutting plane is defined by the two
 +        points and an optional vector lying on the plane specified by a PolySegment.
 +        By default the vector is defined by Mesh module as following. A middle point
 +        of the two given points is computed. The middle point is projected to the mesh.
 +        The vector goes from the middle point to the projection point. In case of planar
 +        mesh, the vector is normal to the mesh.
 +
 +        *segments* [i].vector returns the used vector which goes from the middle point to its projection.
 +
 +        Parameters:        
 +            segments: list of :class:`SMESH.PolySegment` defining positions of cutting planes.
 +            groupName: optional name of a group where created mesh segments will be added.
 +            
 +        """    
          editor = self.editor
          if isPreview:
              editor = self.mesh.GetMeshEditPreviewer()
              return editor.GetPreviewData()
          return None        
  
 -    ## Return a cached numerical functor by its type.
 -    #  @param theCriterion functor type - an item of SMESH.FunctorType enumeration.
 -    #          Type SMESH.FunctorType._items in the Python Console to see all items.
 -    #          Note that not all items correspond to numerical functors.
 -    #  @return SMESH_NumericalFunctor. The functor is already initialized
 -    #          with a mesh
 -    #  @ingroup l1_measurements
      def GetFunctor(self, funcType ):
 +        """
 +        Return a cached numerical functor by its type.
 +
 +        Parameters:
 +            funcType: functor type: an item of :class:`SMESH.FunctorType` enumeration.
 +                Note that not all items correspond to numerical functors.
 +
 +        Returns:
 +            :class:`SMESH.NumericalFunctor`. The functor is already initialized with a mesh
 +        """
 +
          fn = self.functors[ funcType._v ]
          if not fn:
              fn = self.smeshpyD.GetFunctor(funcType)
              fn.SetMesh(self.mesh)
 -            self.functors[ EnumToLong(funcType) ] = fn
 +            self.functors[ funcType._v ] = fn
          return fn
  
 -    ## Return value of a functor for a given element
 -    #  @param funcType an item of SMESH.FunctorType enum
 -    #         Type "SMESH.FunctorType._items" in the Python Console to see all items.
 -    #  @param elemId element or node ID
 -    #  @param isElem @a elemId is ID of element or node
 -    #  @return the functor value or zero in case of invalid arguments
 -    #  @ingroup l1_measurements
      def FunctorValue(self, funcType, elemId, isElem=True):
 +        """
 +        Return value of a functor for a given element
 +
 +        Parameters:
 +            funcType: an item of :class:`SMESH.FunctorType` enum.
 +            elemId: element or node ID
 +            isElem: *elemId* is ID of element or node
 +
 +        Returns:
 +            the functor value or zero in case of invalid arguments
 +        """
 +
          fn = self.GetFunctor( funcType )
          if fn.GetElementType() == self.GetElementType(elemId, isElem):
              val = fn.GetValue(elemId)
              val = 0
          return val
  
 -    ## Get length of 1D element or sum of lengths of all 1D mesh elements
 -    #  @param elemId mesh element ID (if not defined - sum of length of all 1D elements will be calculated)
 -    #  @return element's length value if \a elemId is specified or sum of all 1D mesh elements' lengths otherwise
 -    #  @ingroup l1_measurements
      def GetLength(self, elemId=None):
 +        """
 +        Get length of 1D element or sum of lengths of all 1D mesh elements
 +
 +        Parameters:
 +            elemId: mesh element ID (if not defined - sum of length of all 1D elements will be calculated)
 +
 +        Returns:
 +            element's length value if *elemId* is specified or sum of all 1D mesh elements' lengths otherwise
 +        """
 +
          length = 0
          if elemId == None:
              length = self.smeshpyD.GetLength(self)
              length = self.FunctorValue(SMESH.FT_Length, elemId)
          return length
  
 -    ## Get area of 2D element or sum of areas of all 2D mesh elements
 -    #  @param elemId mesh element ID (if not defined - sum of areas of all 2D elements will be calculated)
 -    #  @return element's area value if \a elemId is specified or sum of all 2D mesh elements' areas otherwise
 -    #  @ingroup l1_measurements
      def GetArea(self, elemId=None):
 +        """
 +        Get area of 2D element or sum of areas of all 2D mesh elements
 +        elemId mesh element ID (if not defined - sum of areas of all 2D elements will be calculated)
 +
 +        Returns:
 +            element's area value if *elemId* is specified or sum of all 2D mesh elements' areas otherwise
 +        """
 +
          area = 0
          if elemId == None:
              area = self.smeshpyD.GetArea(self)
              area = self.FunctorValue(SMESH.FT_Area, elemId)
          return area
  
 -    ## Get volume of 3D element or sum of volumes of all 3D mesh elements
 -    #  @param elemId mesh element ID (if not defined - sum of volumes of all 3D elements will be calculated)
 -    #  @return element's volume value if \a elemId is specified or sum of all 3D mesh elements' volumes otherwise
 -    #  @ingroup l1_measurements
      def GetVolume(self, elemId=None):
 +        """
 +        Get volume of 3D element or sum of volumes of all 3D mesh elements
 +
 +        Parameters:
 +            elemId: mesh element ID (if not defined - sum of volumes of all 3D elements will be calculated)
 +
 +        Returns:
 +            element's volume value if *elemId* is specified or sum of all 3D mesh elements' volumes otherwise
 +        """
 +
          volume = 0
          if elemId == None:
              volume = self.smeshpyD.GetVolume(self)
              volume = self.FunctorValue(SMESH.FT_Volume3D, elemId)
          return volume
  
 -    ## Get maximum element length.
 -    #  @param elemId mesh element ID
 -    #  @return element's maximum length value
 -    #  @ingroup l1_measurements
      def GetMaxElementLength(self, elemId):
 +        """
 +        Get maximum element length.
 +
 +        Parameters:
 +            elemId: mesh element ID
 +
 +        Returns:
 +            element's maximum length value
 +        """
 +
          if self.GetElementType(elemId, True) == SMESH.VOLUME:
              ftype = SMESH.FT_MaxElementLength3D
          else:
              ftype = SMESH.FT_MaxElementLength2D
          return self.FunctorValue(ftype, elemId)
  
 -    ## Get aspect ratio of 2D or 3D element.
 -    #  @param elemId mesh element ID
 -    #  @return element's aspect ratio value
 -    #  @ingroup l1_measurements
      def GetAspectRatio(self, elemId):
 +        """
 +        Get aspect ratio of 2D or 3D element.
 +
 +        Parameters:
 +            elemId: mesh element ID
 +
 +        Returns:
 +            element's aspect ratio value
 +        """
 +
          if self.GetElementType(elemId, True) == SMESH.VOLUME:
              ftype = SMESH.FT_AspectRatio3D
          else:
              ftype = SMESH.FT_AspectRatio
          return self.FunctorValue(ftype, elemId)
  
 -    ## Get warping angle of 2D element.
 -    #  @param elemId mesh element ID
 -    #  @return element's warping angle value
 -    #  @ingroup l1_measurements
      def GetWarping(self, elemId):
 +        """
 +        Get warping angle of 2D element.
 +
 +        Parameters:
 +            elemId: mesh element ID
 +
 +        Returns:
 +            element's warping angle value
 +        """
 +
          return self.FunctorValue(SMESH.FT_Warping, elemId)
  
 -    ## Get minimum angle of 2D element.
 -    #  @param elemId mesh element ID
 -    #  @return element's minimum angle value
 -    #  @ingroup l1_measurements
      def GetMinimumAngle(self, elemId):
 +        """
 +        Get minimum angle of 2D element.
 +
 +        Parameters:
 +            elemId: mesh element ID
 +
 +        Returns:
 +            element's minimum angle value
 +        """
 +
          return self.FunctorValue(SMESH.FT_MinimumAngle, elemId)
  
 -    ## Get taper of 2D element.
 -    #  @param elemId mesh element ID
 -    #  @return element's taper value
 -    #  @ingroup l1_measurements
      def GetTaper(self, elemId):
 +        """
 +        Get taper of 2D element.
 +
 +        Parameters:
 +            elemId: mesh element ID
 +
 +        Returns:
 +            element's taper value
 +        """
 +
          return self.FunctorValue(SMESH.FT_Taper, elemId)
  
 -    ## Get skew of 2D element.
 -    #  @param elemId mesh element ID
 -    #  @return element's skew value
 -    #  @ingroup l1_measurements
      def GetSkew(self, elemId):
 +        """
 +        Get skew of 2D element.
 +
 +        Parameters:
 +            elemId: mesh element ID
 +
 +        Returns:
 +            element's skew value
 +        """
 +
          return self.FunctorValue(SMESH.FT_Skew, elemId)
  
 -    ## Return minimal and maximal value of a given functor.
 -    #  @param funType a functor type, an item of SMESH.FunctorType enum
 -    #         (one of SMESH.FunctorType._items)
 -    #  @param meshPart a part of mesh (group, sub-mesh) to treat
 -    #  @return tuple (min,max)
 -    #  @ingroup l1_measurements
      def GetMinMax(self, funType, meshPart=None):
 +        """
 +        Return minimal and maximal value of a given functor.
 +
 +        Parameters:
 +            funType (SMESH.FunctorType): a functor type.
 +                  Note that not all items of :class:`SMESH.FunctorType` corresponds
 +                  to numerical functors.
 +            meshPart: a part of mesh (:class:`sub-mesh, group or filter <SMESH.SMESH_IDSource>`) to treat
 +
 +        Returns:
 +            tuple (min,max)
 +        """
 +
          unRegister = genObjUnRegister()
          if isinstance( meshPart, list ):
              meshPart = self.GetIDSource( meshPart, SMESH.ALL )
      pass # end of Mesh class
  
  
 -## Private class used to compensate change of CORBA API of SMESH_Mesh for backward compatibility
 -#  with old dump scripts which call SMESH_Mesh directly and not via smeshBuilder.Mesh
 -#
  class meshProxy(SMESH._objref_SMESH_Mesh):
 -    def __init__(self, *args):
 -        SMESH._objref_SMESH_Mesh.__init__(self, *args)
 +    """
 +    Private class used to compensate change of CORBA API of SMESH_Mesh for backward compatibility
 +    with old dump scripts which call SMESH_Mesh directly and not via smeshBuilder.Mesh
 +    """
-     def __init__(self):
-         SMESH._objref_SMESH_Mesh.__init__(self)
++    def __init__(self,*args):
++        SMESH._objref_SMESH_Mesh.__init__(self,*args)
      def __deepcopy__(self, memo=None):
-         new = self.__class__()
+         new = self.__class__(self)
          return new
      def CreateDimGroup(self,*args): # 2 args added: nbCommonNodes, underlyingOnly
          if len( args ) == 3:
              args += SMESH.ALL_NODES, True
-         return SMESH._objref_SMESH_Mesh.CreateDimGroup( self, *args )
+         return SMESH._objref_SMESH_Mesh.CreateDimGroup(self, *args)
+     def ExportToMEDX(self, *args): # function removed
+         print("WARNING: ExportToMEDX() is deprecated, use ExportMED() instead")
+         args = [i for i in args if i not in [SMESH.MED_V2_1, SMESH.MED_V2_2]]
+         SMESH._objref_SMESH_Mesh.ExportMED(self, *args)
+     def ExportToMED(self, *args): # function removed
+         print("WARNING: ExportToMED() is deprecated, use ExportMED() instead")
+         args = [i for i in args if i not in [SMESH.MED_V2_1, SMESH.MED_V2_2]]
+         while len(args) < 4:  # !!!! nb of parameters for ExportToMED IDL's method
+             args.append(True)
+         SMESH._objref_SMESH_Mesh.ExportMED(self, *args)
+     def ExportPartToMED(self, *args): # 'version' parameter removed
+         args = [i for i in args if i not in [SMESH.MED_V2_1, SMESH.MED_V2_2]]
+         SMESH._objref_SMESH_Mesh.ExportPartToMED(self, *args)
+     def ExportMED(self, *args): # signature of method changed
+         args = [i for i in args if i not in [SMESH.MED_V2_1, SMESH.MED_V2_2]]
+         while len(args) < 4:  # !!!! nb of parameters for ExportToMED IDL's method
+             args.append(True)
+         SMESH._objref_SMESH_Mesh.ExportMED(self, *args)
      pass
  omniORB.registerObjref(SMESH._objref_SMESH_Mesh._NP_RepositoryId, meshProxy)
  
  
 -## Private class wrapping SMESH.SMESH_SubMesh in order to add Compute()
 -#
  class submeshProxy(SMESH._objref_SMESH_subMesh):
 -    def __init__(self, *args):
 -        SMESH._objref_SMESH_subMesh.__init__(self, *args)
++
 +    """
 +    Private class wrapping SMESH.SMESH_SubMesh in order to add Compute()
 +    """
-     def __init__(self):
-         SMESH._objref_SMESH_subMesh.__init__(self)
++    def __init__(self,*args):
++        SMESH._objref_SMESH_subMesh.__init__(self,*args)
          self.mesh = None
      def __deepcopy__(self, memo=None):
-         new = self.__class__()
+         new = self.__class__(self)
          return new
  
 -    ## Compute the sub-mesh and return the status of the computation
 -    #  @param refresh if @c True, Object browser is automatically updated (when running in GUI)
 -    #  @return True or False
 -    #
 -    #  This is a method of SMESH.SMESH_submesh that can be obtained via Mesh.GetSubMesh() or
 -    #  @ref smesh_algorithm.Mesh_Algorithm.GetSubMesh() "Mesh_Algorithm.GetSubMesh()".
 -    #  @ingroup l2_submeshes
      def Compute(self,refresh=False):
 +        """
 +        Compute the sub-mesh and return the status of the computation
 +
 +        Parameters:
 +            refresh: if *True*, Object Browser is automatically updated (when running in GUI)
 +
 +        Returns:
 +            True or False
 +
 +        This is a method of SMESH.SMESH_submesh that can be obtained via Mesh.GetSubMesh() or
 +        :meth:`smeshBuilder.Mesh.GetSubMesh`.
 +        """
 +
          if not self.mesh:
              self.mesh = Mesh( smeshBuilder(), None, self.GetMesh())
  
          ok = self.mesh.Compute( self.GetSubShape(),refresh=[] )
  
-         if salome.sg.hasDesktop() and self.mesh.GetStudyId() >= 0:
+         if salome.sg.hasDesktop():
              smeshgui = salome.ImportComponentGUI("SMESH")
-             smeshgui.Init(self.mesh.GetStudyId())
+             smeshgui.Init()
              smeshgui.SetMeshIcon( salome.ObjectToID( self ), ok, (self.GetNumberOfElements()==0) )
-             if refresh: salome.sg.updateObjBrowser(True)
+             if refresh: salome.sg.updateObjBrowser()
              pass
  
          return ok
  omniORB.registerObjref(SMESH._objref_SMESH_subMesh._NP_RepositoryId, submeshProxy)
  
  
 -## Private class used to compensate change of CORBA API of SMESH_MeshEditor for backward
 -#  compatibility with old dump scripts which call SMESH_MeshEditor directly and not via
 -#  smeshBuilder.Mesh
 -#
  class meshEditor(SMESH._objref_SMESH_MeshEditor):
 -    def __init__(self, *args):
 -        SMESH._objref_SMESH_MeshEditor.__init__(self, *args)
 +    """
 +    Private class used to compensate change of CORBA API of SMESH_MeshEditor for backward
 +    compatibility with old dump scripts which call SMESH_MeshEditor directly and not via
 +    smeshBuilder.Mesh
 +    """
-     def __init__(self):
-         SMESH._objref_SMESH_MeshEditor.__init__(self)
++    def __init__(self,*args):
++        SMESH._objref_SMESH_MeshEditor.__init__( self, *args)
          self.mesh = None
      def __getattr__(self, name ): # method called if an attribute not found
          if not self.mesh:         # look for name() method in Mesh class
              return getattr( self.mesh, name )
          if name == "ExtrusionAlongPathObjX":
              return getattr( self.mesh, "ExtrusionAlongPathX" ) # other method name
-         print "meshEditor: attribute '%s' NOT FOUND" % name
+         print("meshEditor: attribute '%s' NOT FOUND" % name)
          return None
      def __deepcopy__(self, memo=None):
-         new = self.__class__()
+         new = self.__class__(self)
          return new
      def FindCoincidentNodes(self,*args): # a 2nd arg added (SeparateCornerAndMediumNodes)
          if len( args ) == 1: args += False,
      pass
  omniORB.registerObjref(SMESH._objref_SMESH_MeshEditor._NP_RepositoryId, meshEditor)
  
 -## Private class wrapping SMESH.SMESH_Pattern CORBA class in order to treat Notebook
 -#  variables in some methods
 -#
  class Pattern(SMESH._objref_SMESH_Pattern):
 +    """
 +    Private class wrapping SMESH.SMESH_Pattern CORBA class in order to treat Notebook
 +    variables in some methods
 +    """
  
      def LoadFromFile(self, patternTextOrFile ):
          text = patternTextOrFile
              mesh = mesh.GetMesh()
          return SMESH._objref_SMESH_Pattern.MakeMesh( self, mesh, CreatePolygons, CreatePolyhedra )
  
 -# Registering the new proxy for Pattern
  omniORB.registerObjref(SMESH._objref_SMESH_Pattern._NP_RepositoryId, Pattern)
 +"""
 +Registering the new proxy for Pattern
 +"""
  
 -## Private class used to bind methods creating algorithms to the class Mesh
 -#
  class algoCreator:
 +    """
 +    Private class used to bind methods creating algorithms to the class Mesh
 +    """
 +
      def __init__(self, method):
          self.mesh = None
          self.defaultAlgoType = ""
          self.algoTypeToClass = {}
          self.method = method
  
 -    # Store a python class of algorithm
      def add(self, algoClass):
-         if type( algoClass ).__name__ == 'classobj' and \
 +        """
 +        Store a python class of algorithm
 +        """
 -           hasattr(algoClass, "algoType"):
+         if inspect.isclass(algoClass) and \
 +           hasattr( algoClass, "algoType"):
              self.algoTypeToClass[ algoClass.algoType ] = algoClass
              if not self.defaultAlgoType and \
                 hasattr( algoClass, "isDefault") and algoClass.isDefault:
                  self.defaultAlgoType = algoClass.algoType
--            #print "Add",algoClass.algoType, "dflt",self.defaultAlgoType
++            #print("Add",algoClass.algoType, "dflt",self.defaultAlgoType)
  
 -    # Create a copy of self and assign mesh to the copy
      def copy(self, mesh):
 +        """
 +        Create a copy of self and assign mesh to the copy
 +        """
 +
          other = algoCreator( self.method )
          other.defaultAlgoType = self.defaultAlgoType
          other.algoTypeToClass = self.algoTypeToClass
          other.mesh = mesh
          return other
  
 -    # Create an instance of algorithm
      def __call__(self,algo="",geom=0,*args):
 +        """
 +        Create an instance of algorithm
 +        """
          algoType = ""
          shape = 0
          if isinstance( algo, str ):
              algoType = self.defaultAlgoType
          if not algoType and self.algoTypeToClass:
              algoType = sorted( self.algoTypeToClass.keys() )[0]
-         if self.algoTypeToClass.has_key( algoType ):
-             #print "Create algo",algoType
+         if algoType in self.algoTypeToClass:
 -            #print "Create algo",algoType
++            #print("Create algo",algoType)
              return self.algoTypeToClass[ algoType ]( self.mesh, shape )
-         raise RuntimeError, "No class found for algo type %s" % algoType
+         raise RuntimeError( "No class found for algo type %s" % algoType)
          return None
  
 -## Private class used to substitute and store variable parameters of hypotheses.
 -#
  class hypMethodWrapper:
 +    """
 +    Private class used to substitute and store variable parameters of hypotheses.
 +    """
 +
      def __init__(self, hyp, method):
          self.hyp    = hyp
          self.method = method
--        #print "REBIND:", method.__name__
++        #print("REBIND:", method.__name__)
          return
  
 -    # call a method of hypothesis with calling SetVarParameter() before
      def __call__(self,*args):
 +        """
 +        call a method of hypothesis with calling SetVarParameter() before
 +        """
 +
          if not args:
              return self.method( self.hyp, *args ) # hypothesis method with no args
  
--        #print "MethWrapper.__call__",self.method.__name__, args
++        #print("MethWrapper.__call__", self.method.__name__, args)
          try:
              parsed = ParseParameters(*args)     # replace variables with their values
              self.hyp.SetVarParameter( parsed[-2], self.method.__name__ )
          except omniORB.CORBA.BAD_PARAM: # raised by hypothesis method call
              # maybe there is a replaced string arg which is not variable
              result = self.method( self.hyp, *args )
-         except ValueError, detail: # raised by ParseParameters()
+         except ValueError as detail: # raised by ParseParameters()
              try:
                  result = self.method( self.hyp, *args )
              except omniORB.CORBA.BAD_PARAM:
-                 raise ValueError, detail # wrong variable name
+                 raise ValueError(detail) # wrong variable name
  
          return result
      pass
  
 -## A helper class that calls UnRegister() of SALOME.GenericObj'es stored in it
 -#
  class genObjUnRegister:
 +    """
 +    A helper class that calls UnRegister() of SALOME.GenericObj'es stored in it
 +    """
  
      def __init__(self, genObj=None):
          self.genObjList = []
              if genObj and hasattr( genObj, "UnRegister" ):
                  genObj.UnRegister()
  
 -
 -## Bind methods creating mesher plug-ins to the Mesh class
 -#
  for pluginName in os.environ[ "SMESH_MeshersList" ].split( ":" ):
 -    #
 -    #print "pluginName: ", pluginName
 +    """
 +    Bind methods creating mesher plug-ins to the Mesh class
 +    """
 +
-     # print "pluginName: ", pluginName
++    # print("pluginName: ", pluginName)
      pluginBuilderName = pluginName + "Builder"
      try:
          exec( "from salome.%s.%s import *" % (pluginName, pluginBuilderName))
-     except Exception, e:
+     except Exception as e:
          from salome_utils import verbose
-         if verbose(): print "Exception while loading %s: %s" % ( pluginBuilderName, e )
+         if verbose(): print("Exception while loading %s: %s" % ( pluginBuilderName, e ))
          continue
      exec( "from salome.%s import %s" % (pluginName, pluginBuilderName))
      plugin = eval( pluginBuilderName )
-     # print "  plugin:" , str(plugin)
 -    #print "  plugin:" , str(plugin)
++    # print("  plugin:" , str(plugin))
  
      # add methods creating algorithms to Mesh
      for k in dir( plugin ):
          if k[0] == '_': continue
          algo = getattr( plugin, k )
-         # print "             algo:", str(algo)
-         if type( algo ).__name__ == 'classobj' and hasattr( algo, "meshMethod" ):
-             # print "                     meshMethod:" , str(algo.meshMethod)
 -        #print "             algo:", str(algo)
++        #print("             algo:", str(algo))
+         if inspect.isclass(algo) and hasattr(algo, "meshMethod"):
 -            #print "                     meshMethod:" , str(algo.meshMethod)
++            #print("                     meshMethod:" , str(algo.meshMethod))
              if not hasattr( Mesh, algo.meshMethod ):
                  setattr( Mesh, algo.meshMethod, algoCreator( algo.meshMethod ))
                  pass
 -            getattr( Mesh, algo.meshMethod ).add( algo )
 +            _mmethod = getattr( Mesh, algo.meshMethod )
 +            if hasattr(  _mmethod, "add" ):
 +                _mmethod.add(algo)
              pass
          pass
      pass
index 172dcca74e2a3f9de4b7dcfbcc50a8c697454fae,92999bf2e2c5a8c861352cf1f177a79c5b45185d..b8c12430e22f397a0e8d6e7fa6b1f9afabd788bd
@@@ -25,64 -25,52 +25,64 @@@ import salom
  from salome.geom import geomBuilder
  import SMESH, StdMeshers
  
 -## The base class to define meshing algorithms
 -#
 -#  @note This class should not be used directly, it is supposed to be sub-classed
 -#  for implementing Python API for specific meshing algorithms
 -#
 -#  For each meshing algorithm, a python class inheriting from class %Mesh_Algorithm
 -#  should be defined. This descendant class should have two attributes defining the way
 -#  it is created by class Mesh (see e.g. class @ref StdMeshersBuilder.StdMeshersBuilder_Segment "StdMeshersBuilder_Segment"
 -#  in StdMeshersBuilder package):
 -#  - @c meshMethod attribute defines name of method of class smesh.Mesh by calling which the
 -#    python class of algorithm is created; this method is dynamically added to the smesh.Mesh class
 -#    in runtime. For example, if in @c class MyPlugin_Algorithm this attribute is defined as
 -#    @code
 -#    meshMethod = "MyAlgorithm"
 -#    @endcode
 -#    then an instance of @c MyPlugin_Algorithm can be created by the direct invocation of the function
 -#    of smesh.Mesh class:
 -#    @code
 -#    my_algo = mesh.MyAlgorithm()
 -#    @endcode
 -#  - @c algoType defines type of algorithm and is used mostly to discriminate
 -#    algorithms that are created by the same method of class smesh.Mesh. For example, if this attribute
 -#    is specified in @c MyPlugin_Algorithm class as
 -#    @code
 -#    algoType = "MyPLUGIN"
 -#    @endcode
 -#    then it's creation code can be:
 -#    @code
 -#    my_algo = mesh.MyAlgorithm(algo="MyPLUGIN")
 -#    @endcode
 -#  @ingroup l2_algorithms
  class Mesh_Algorithm:
-       This class should not be used directly, it is supposed to be sub-classed
 +    """
 +    The base class to define meshing algorithms
 +
 +    Note:
-       - :code:`meshMethod` attribute defines name of method of class smesh.Mesh by calling which the
-               python class of algorithm is created; this method is dynamically added to the smesh.Mesh class
-               in runtime. For example, if in :code:`class MyPlugin_Algorithm` this attribute is defined as
-               ::
++        This class should not be used directly, it is supposed to be sub-classed
 +    for implementing Python API for specific meshing algorithms
 +
 +    For each meshing algorithm, a python class inheriting from class %Mesh_Algorithm
 +    should be defined. This descendant class should have two attributes defining the way
 +    it is created by class Mesh (see e.g. class :class:`~StdMeshersBuilder.StdMeshersBuilder_Segment`
 +    in StdMeshersBuilder package):
 +
-                       meshMethod = "MyAlgorithm"
++        - :code:`meshMethod` attribute defines name of method of class smesh.Mesh by calling which the
++                python class of algorithm is created; this method is dynamically added to the smesh.Mesh class
++                in runtime. For example, if in :code:`class MyPlugin_Algorithm` this attribute is defined as
++                ::
 +
-               then an instance of :code:`MyPlugin_Algorithm` can be created by the direct invocation of the function
-               of smesh.Mesh class:
-               ::
++                        meshMethod = "MyAlgorithm"
 +
-                       my_algo = mesh.MyAlgorithm()
++                then an instance of :code:`MyPlugin_Algorithm` can be created by the direct invocation of the function
++                of smesh.Mesh class:
++                ::
 +    
-       - :code:`algoType` defines type of algorithm and is used mostly to discriminate
-               algorithms that are created by the same method of class smesh.Mesh. For example, if this attribute
-               is specified in :code:`MyPlugin_Algorithm` class as
-               ::
++                        my_algo = mesh.MyAlgorithm()
 +    
-                       algoType = "MyPLUGIN"
++        - :code:`algoType` defines type of algorithm and is used mostly to discriminate
++                algorithms that are created by the same method of class smesh.Mesh. For example, if this attribute
++                is specified in :code:`MyPlugin_Algorithm` class as
++                ::
 +    
-               then it's creation code can be:
-               ::
++                        algoType = "MyPLUGIN"
 +
-                       my_algo = mesh.MyAlgorithm(algo="MyPLUGIN")
++                then it's creation code can be:
++                ::
 +
++                        my_algo = mesh.MyAlgorithm(algo="MyPLUGIN")
 +    """
 +    
      
 -    ## Private constructor
      def __init__(self):
-       """
-       Private constuctor
-       """
++        """
++        Private constuctor
++        """
          self.mesh = None
          self.geom = None
          self.subm = None
          self.algo = None
          pass
  
 -    ## Finds a hypothesis in the study by its type name and parameters.
 -    #  Finds only the hypotheses created in smeshpyD engine.
 -    #  @return SMESH.SMESH_Hypothesis
      def FindHypothesis (self, hypname, args, CompareMethod, smeshpyD):
-       """
-       Finds a hypothesis in the study by its type name and parameters.
-       Finds only the hypotheses created in smeshpyD engine.
-       Returns: 
-               SMESH.SMESH_Hypothesis
-       """
-         study = smeshpyD.GetCurrentStudy()
++        """
++        Finds a hypothesis in the study by its type name and parameters.
++        Finds only the hypotheses created in smeshpyD engine.
++        Returns: 
++                SMESH.SMESH_Hypothesis
++        """
+         study = salome.myStudy
          if not study: return None
          #to do: find component by smeshpyD object, not by its data type
          scomp = study.FindComponent(smeshpyD.ComponentDataType())
              pass
          return None
  
 -    ## Finds the algorithm in the study by its type name.
 -    #  Finds only the algorithms, which have been created in smeshpyD engine.
 -    #  @return SMESH.SMESH_Algo
      def FindAlgorithm (self, algoname, smeshpyD):
-       """
-       Finds the algorithm in the study by its type name.
-       Finds only the algorithms, which have been created in smeshpyD engine.
-       Returns:
-               SMESH.SMESH_Algo
-       """
-         study = smeshpyD.GetCurrentStudy()
++        """
++        Finds the algorithm in the study by its type name.
++        Finds only the algorithms, which have been created in smeshpyD engine.
++
++        Returns:
++                SMESH.SMESH_Algo
++        """
+         study = salome.myStudy
          if not study: return None
          #to do: find component by smeshpyD object, not by its data type
          scomp = study.FindComponent(smeshpyD.ComponentDataType())
              pass
          return None
  
 -    ## If the algorithm is global, returns 0; \n
 -    #  else returns the submesh associated to this algorithm.
      def GetSubMesh(self):
-       """
-       If the algorithm is global, returns 0; 
-       else returns the submesh associated to this algorithm.
-       """
++        """
++        If the algorithm is global, returns 0; 
++        else returns the submesh associated to this algorithm.
++        """
          return self.subm
  
 -    ## Returns the wrapped mesher.
      def GetAlgorithm(self):
-       """
-       Returns the wrapped mesher.
-       """
++        """
++        Returns the wrapped mesher.
++        """
          return self.algo
  
 -    ## Gets the list of hypothesis that can be used with this algorithm
      def GetCompatibleHypothesis(self):
-       """
-       Gets the list of hypothesis that can be used with this algorithm
-       """
++        """
++        Gets the list of hypothesis that can be used with this algorithm
++        """
          mylist = []
          if self.algo:
              mylist = self.algo.GetCompatibleHypothesis()
          return mylist
  
 -    ## Gets the name of the algorithm
      def GetName(self):
-       """
-       Gets the name of the algorithm
-       """
++        """
++        Gets the name of the algorithm
++        """
          from salome.smesh.smeshBuilder import GetName
          return GetName(self.algo)
  
 -    ## Sets the name to the algorithm
      def SetName(self, name):
-       """
-       Sets the name to the algorithm
-       """
++        """
++        Sets the name to the algorithm
++        """
          self.mesh.smeshpyD.SetName(self.algo, name)
  
 -    ## Gets the id of the algorithm
      def GetId(self):
-       """
-       Gets the id of the algorithm
-       """
++        """
++        Gets the id of the algorithm
++        """
          return self.algo.GetId()
  
 -    ## Private method.
      def Create(self, mesh, geom, hypo, so="libStdMeshersEngine.so"):
-       """
-       Private method.
-       """
++        """
++        Private method.
++        """
          if geom is None and mesh.mesh.HasShapeToMesh():
-             raise RuntimeError, "Attempt to create " + hypo + " algorithm on None shape"
+             raise RuntimeError("Attempt to create " + hypo + " algorithm on None shape")
          algo = self.FindAlgorithm(hypo, mesh.smeshpyD)
          if algo is None:
              algo = mesh.smeshpyD.CreateHypothesis(hypo, so)
          self.Assign(algo, mesh, geom)
          return self.algo
  
 -    ## Private method
      def Assign(self, algo, mesh, geom):
-       """
-       Private method
-       """
++        """
++        Private method
++        """
          from salome.smesh.smeshBuilder import AssureGeomPublished, TreatHypoStatus, GetName
          if geom is None and mesh.mesh.HasShapeToMesh():
-             raise RuntimeError, "Attempt to create " + algo + " algorithm on None shape"
+             raise RuntimeError("Attempt to create " + algo + " algorithm on None shape")
          self.mesh = mesh
          if not geom or geom.IsSame( mesh.geom ):
              self.geom = mesh.geom
          return
  
      def CompareHyp (self, hyp, args):
-         print "CompareHyp is not implemented for ", self.__class__.__name__, ":", hyp.GetName()
+         print("CompareHyp is not implemented for ", self.__class__.__name__, ":", hyp.GetName())
          return False
  
      def CompareEqualHyp (self, hyp, args):
          return True
  
 -    ## Private method
      def Hypothesis (self, hyp, args=[], so="libStdMeshersEngine.so",
                      UseExisting=0, CompareMethod="", toAdd=True):
-       """
-       Private method
-       """
++        """
++        Private method
++        """
          from salome.smesh.smeshBuilder import TreatHypoStatus, GetName
          hypo = None
          if UseExisting:
              TreatHypoStatus( status, GetName(hypo), geomName, 0, self.mesh )
          return hypo
  
 -    ## Returns entry of the shape to mesh in the study
      def MainShapeEntry(self):
-       """
-       Returns entry of the shape to mesh in the study
-       """
++        """
++        Returns entry of the shape to mesh in the study
++        """
          if not self.mesh or not self.mesh.GetMesh(): return ""
          if not self.mesh.GetMesh().HasShapeToMesh(): return ""
          shape = self.mesh.GetShape()
          return shape.GetStudyEntry()
  
 -    ## Defines "ViscousLayers" hypothesis to give parameters of layers of prisms to build
 -    #  near mesh boundary. This hypothesis can be used by several 3D algorithms:
 -    #  NETGEN 3D, MG-Tetra, Hexahedron(i,j,k)
 -    #  @param thickness total thickness of layers of prisms
 -    #  @param numberOfLayers number of layers of prisms
 -    #  @param stretchFactor factor (>1.0) of growth of layer thickness towards inside of mesh
 -    #  @param faces list of geometrical faces (or their ids).
 -    #         Viscous layers are either generated on these faces or not, depending on
 -    #         the value of \a isFacesToIgnore parameter.
 -    #  @param isFacesToIgnore if \c True, the Viscous layers are not generated on the
 -    #         faces specified by the previous parameter (\a faces).
 -    #  @param extrMethod extrusion method defines how position of new nodes are found during
 -    #         prism construction and how creation of distorted and intersecting prisms is
 -    #         prevented. Possible values are:
 -    #       - StdMeshers.SURF_OFFSET_SMOOTH (default) method extrudes nodes along normal
 -    #         to underlying geometrical surface. Smoothing of internal surface of
 -    #         element layers can be used to avoid creation of invalid prisms.
 -    #       - StdMeshers.FACE_OFFSET method extrudes nodes along average normal of
 -    #         surrounding mesh faces till intersection with a neighbor mesh face
 -    #         translated along its own normal by the layers thickness. Thickness
 -    #         of layers can be limited to avoid creation of invalid prisms.
 -    #       - StdMeshers.NODE_OFFSET method extrudes nodes along average normal of
 -    #         surrounding mesh faces by the layers thickness. Thickness of
 -    #         layers can be limited to avoid creation of invalid prisms.
 -    #  @ingroup l3_hypos_additi
      def ViscousLayers(self, thickness, numberOfLayers, stretchFactor,
                        faces=[], isFacesToIgnore=True, extrMethod=StdMeshers.SURF_OFFSET_SMOOTH ):
-       """
-       Defines "ViscousLayers" hypothesis to give parameters of layers of prisms to build
-       near mesh boundary. This hypothesis can be used by several 3D algorithms:
-       NETGEN 3D, MG-Tetra, Hexahedron(i,j,k)
-       Parameters:
-               thickness: total thickness of layers of prisms
-               numberOfLayers: number of layers of prisms
-               stretchFactor: factor (>1.0) of growth of layer thickness towards inside of mesh
-               faces: list of geometrical faces (or their ids).
-                       Viscous layers are either generated on these faces or not, depending on
-                       the value of **isFacesToIgnore** parameter.
-               isFacesToIgnore: if *True*, the Viscous layers are not generated on the
-                       faces specified by the previous parameter (**faces**).
-               extrMethod: extrusion method defines how position of new nodes are found during
-                       prism construction and how creation of distorted and intersecting prisms is
-                       prevented. Possible values are:
-                       - StdMeshers.SURF_OFFSET_SMOOTH (default) method extrudes nodes along normal
-                               to underlying geometrical surface. Smoothing of internal surface of
-                               element layers can be used to avoid creation of invalid prisms.
-                       - StdMeshers.FACE_OFFSET method extrudes nodes along average normal of
-                               surrounding mesh faces till intersection with a neighbor mesh face
-                               translated along its own normal by the layers thickness. Thickness
-                               of layers can be limited to avoid creation of invalid prisms.
-                       - StdMeshers.NODE_OFFSET method extrudes nodes along average normal of
-                               surrounding mesh faces by the layers thickness. Thickness of
-                               layers can be limited to avoid creation of invalid prisms.
-       """
++        """
++        Defines "ViscousLayers" hypothesis to give parameters of layers of prisms to build
++        near mesh boundary. This hypothesis can be used by several 3D algorithms:
++        NETGEN 3D, MG-Tetra, Hexahedron(i,j,k)
++
++        Parameters:
++                thickness: total thickness of layers of prisms
++                numberOfLayers: number of layers of prisms
++                stretchFactor: factor (>1.0) of growth of layer thickness towards inside of mesh
++                faces: list of geometrical faces (or their ids).
++                        Viscous layers are either generated on these faces or not, depending on
++                        the value of **isFacesToIgnore** parameter.
++                isFacesToIgnore: if *True*, the Viscous layers are not generated on the
++                        faces specified by the previous parameter (**faces**).
++                extrMethod: extrusion method defines how position of new nodes are found during
++                        prism construction and how creation of distorted and intersecting prisms is
++                        prevented. Possible values are:
++
++                        - StdMeshers.SURF_OFFSET_SMOOTH (default) method extrudes nodes along normal
++                                to underlying geometrical surface. Smoothing of internal surface of
++                                element layers can be used to avoid creation of invalid prisms.
++                        - StdMeshers.FACE_OFFSET method extrudes nodes along average normal of
++                                surrounding mesh faces till intersection with a neighbor mesh face
++                                translated along its own normal by the layers thickness. Thickness
++                                of layers can be limited to avoid creation of invalid prisms.
++                        - StdMeshers.NODE_OFFSET method extrudes nodes along average normal of
++                                surrounding mesh faces by the layers thickness. Thickness of
++                                layers can be limited to avoid creation of invalid prisms.
++        """
 +        
          if not isinstance(self.algo, SMESH._objref_SMESH_3D_Algo):
-             raise TypeError, "ViscousLayers are supported by 3D algorithms only"
+             raise TypeError("ViscousLayers are supported by 3D algorithms only")
          if not "ViscousLayers" in self.GetCompatibleHypothesis():
-             raise TypeError, "ViscousLayers are not supported by %s"%self.algo.GetName()
+             raise TypeError("ViscousLayers are not supported by %s"%self.algo.GetName())
          if faces and isinstance( faces, geomBuilder.GEOM._objref_GEOM_Object ):
              faces = [ faces ]
          if faces and isinstance( faces[0], geomBuilder.GEOM._objref_GEOM_Object ):
          self.mesh.AddHypothesis( hyp, self.geom )
          return hyp
  
 -    ## Defines "ViscousLayers2D" hypothesis to give parameters of layers of quadrilateral
 -    #  elements to build near mesh boundary. This hypothesis can be used by several 2D algorithms:
 -    #  NETGEN 2D, NETGEN 1D-2D, Quadrangle (mapping), MEFISTO, MG-CADSurf
 -    #  @param thickness total thickness of layers of quadrilaterals
 -    #  @param numberOfLayers number of layers
 -    #  @param stretchFactor factor (>1.0) of growth of layer thickness towards inside of mesh
 -    #  @param edges list of geometrical edges (or their ids).
 -    #         Viscous layers are either generated on these edges or not, depending on
 -    #         the value of \a isEdgesToIgnore parameter.
 -    #  @param isEdgesToIgnore if \c True, the Viscous layers are not generated on the
 -    #         edges specified by the previous parameter (\a edges).
 -    #  @ingroup l3_hypos_additi
      def ViscousLayers2D(self, thickness, numberOfLayers, stretchFactor,
                          edges=[], isEdgesToIgnore=True ):
-       """
-       Defines "ViscousLayers2D" hypothesis to give parameters of layers of quadrilateral
-       elements to build near mesh boundary. This hypothesis can be used by several 2D algorithms:
-       NETGEN 2D, NETGEN 1D-2D, Quadrangle (mapping), MEFISTO, MG-CADSurf
-       Parameters:
-               thickness: total thickness of layers of quadrilaterals
-               numberOfLayers: number of layers
-               stretchFactor: factor (>1.0) of growth of layer thickness towards inside of mesh
-               edges: list of geometrical edges (or their ids).
-                       Viscous layers are either generated on these edges or not, depending on
-                       the value of **isEdgesToIgnore** parameter.
-               isEdgesToIgnore: if *True*, the Viscous layers are not generated on the
-                       edges specified by the previous parameter (**edges**).
-       """
++        """
++        Defines "ViscousLayers2D" hypothesis to give parameters of layers of quadrilateral
++        elements to build near mesh boundary. This hypothesis can be used by several 2D algorithms:
++        NETGEN 2D, NETGEN 1D-2D, Quadrangle (mapping), MEFISTO, MG-CADSurf
++
++        Parameters:
++                thickness: total thickness of layers of quadrilaterals
++                numberOfLayers: number of layers
++                stretchFactor: factor (>1.0) of growth of layer thickness towards inside of mesh
++                edges: list of geometrical edges (or their ids).
++                        Viscous layers are either generated on these edges or not, depending on
++                        the value of **isEdgesToIgnore** parameter.
++                isEdgesToIgnore: if *True*, the Viscous layers are not generated on the
++                        edges specified by the previous parameter (**edges**).
++        """
 +        
          if not isinstance(self.algo, SMESH._objref_SMESH_2D_Algo):
-             raise TypeError, "ViscousLayers2D are supported by 2D algorithms only"
+             raise TypeError("ViscousLayers2D are supported by 2D algorithms only")
          if not "ViscousLayers2D" in self.GetCompatibleHypothesis():
-             raise TypeError, "ViscousLayers2D are not supported by %s"%self.algo.GetName()
+             raise TypeError("ViscousLayers2D are not supported by %s"%self.algo.GetName())
          if edges and not isinstance( edges, list ) and not isinstance( edges, tuple ):
              edges = [edges]
          if edges and isinstance( edges[0], geomBuilder.GEOM._objref_GEOM_Object ):
          self.mesh.AddHypothesis( hyp, self.geom )
          return hyp
  
 -    ## Transform a list of either edges or tuples (edge, 1st_vertex_of_edge)
 -    #  into a list acceptable to SetReversedEdges() of some 1D hypotheses
 -    #  @ingroup l3_hypos_1dhyps
      def ReversedEdgeIndices(self, reverseList):
-       """
-       Transform a list of either edges or tuples (edge, 1st_vertex_of_edge)
-       into a list acceptable to SetReversedEdges() of some 1D hypotheses
-       """
++        """
++        Transform a list of either edges or tuples (edge, 1st_vertex_of_edge)
++        into a list acceptable to SetReversedEdges() of some 1D hypotheses
++        """
 +        
          from salome.smesh.smeshBuilder import FirstVertexOnCurve
          resList = []
          geompy = self.mesh.geompyD
              if isinstance( i, int ):
                  s = geompy.SubShapes(self.mesh.geom, [i])[0]
                  if s.GetShapeType() != geomBuilder.GEOM.EDGE:
-                     raise TypeError, "Not EDGE index given"
+                     raise TypeError("Not EDGE index given")
                  resList.append( i )
              elif isinstance( i, geomBuilder.GEOM._objref_GEOM_Object ):
                  if i.GetShapeType() != geomBuilder.GEOM.EDGE:
-                     raise TypeError, "Not an EDGE given"
+                     raise TypeError("Not an EDGE given")
                  resList.append( geompy.GetSubShapeID(self.mesh.geom, i ))
              elif len( i ) > 1:
                  e = i[0]
                  v = i[1]
                  if not isinstance( e, geomBuilder.GEOM._objref_GEOM_Object ) or \
                     not isinstance( v, geomBuilder.GEOM._objref_GEOM_Object ):
-                     raise TypeError, "A list item must be a tuple (edge, 1st_vertex_of_edge)"
+                     raise TypeError("A list item must be a tuple (edge, 1st_vertex_of_edge)")
                  if v.GetShapeType() == geomBuilder.GEOM.EDGE and \
                     e.GetShapeType() == geomBuilder.GEOM.VERTEX:
                      v,e = e,v
                  if e.GetShapeType() != geomBuilder.GEOM.EDGE or \
                     v.GetShapeType() != geomBuilder.GEOM.VERTEX:
-                     raise TypeError, "A list item must be a tuple (edge, 1st_vertex_of_edge)"
+                     raise TypeError("A list item must be a tuple (edge, 1st_vertex_of_edge)")
                  vFirst = FirstVertexOnCurve( self.mesh, e )
                  tol    = geompy.Tolerance( vFirst )[-1]
                  if geompy.MinDistance( v, vFirst ) > 1.5*tol:
                      resList.append( geompy.GetSubShapeID(self.mesh.geom, e ))
              else:
-                 raise TypeError, "Item must be either an edge or tuple (edge, 1st_vertex_of_edge)"
+                 raise TypeError("Item must be either an edge or tuple (edge, 1st_vertex_of_edge)")
          return resList
  
index 5fe3f3256004fe77c4786b0863d7c92e62e2c8f7,253ff7528b74ff635f49edd0bff2bbf0924f3306..9b52ec3bf4216b535654a12bf0b134bebfa8a967
@@@ -24,7 -24,7 +24,7 @@@ INCLUDE(${SWIG_USE_FILE}
  INCLUDE_DIRECTORIES(
    ${QT_INCLUDES}
    ${PYTHON_INCLUDE_DIRS}
 -  ${CAS_INCLUDE_DIRS}
 +  ${OpenCASCADE_INCLUDE_DIR}
    ${VTK_INCLUDE_DIRS}
    ${OGL_INCLUDE_DIRS}
    ${KERNEL_INCLUDE_DIRS}
@@@ -43,7 -43,7 +43,7 @@@
  
  # additional preprocessor / compiler flags
  ADD_DEFINITIONS(
 -  ${CAS_DEFINITIONS}
 +  ${OpenCASCADE_DEFINITIONS}
    ${OMNIORB_DEFINITIONS}
    ${PYTHON_DEFINITIONS}
  )
@@@ -52,6 -52,7 +52,7 @@@
  SET(_link_LIBRARIES
    ${KERNEL_SalomeGenericObj}
    ${KERNEL_SALOMELocalTrace}
+   ${KERNEL_SalomeKernelHelpers}
    ${GUI_CAM}
    ${GUI_suit}
    ${GUI_qtx}
@@@ -84,7 -85,7 +85,7 @@@ SET_DIRECTORY_PROPERTIES(PROPERTIES INC
  
  # swig flags
  SET_SOURCE_FILES_PROPERTIES(libSMESH_Swig.i PROPERTIES CPLUSPLUS ON)
- SET_SOURCE_FILES_PROPERTIES(libSMESH_Swig.i PROPERTIES SWIG_DEFINITIONS "-shadow")
+ SET_SOURCE_FILES_PROPERTIES(libSMESH_Swig.i PROPERTIES SWIG_FLAGS "-py3")
  SET_SOURCE_FILES_PROPERTIES(libSMESH_swig_wrap.cpp PROPERTIES COMPILE_FLAGS "-DHAVE_CONFIG_H")
  
  # --- scripts ---
index 99a36989769693b8e6696b03b2ea30a7a88a5fc9,a5a5dfe01e4cb991ecee9e37fb3a0f610e8e767f..e33be0832b5da788eca00d87adb5f6801fea479f
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
 +// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CADE
  //
  // This library is free software; you can redistribute it and/or
  // modify it under the terms of the GNU Lesser General Public
  // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
 -// SMESH SMESH : GUI for SMESH component
 -// File   : libSMESH_Swig.cxx
 -// Author : Nicolas REJNERI, Open CASCADE S.A.S.
 -// SMESH includes
 -//
 +/////////////////////////////////////////////////////////////////
 +/// \package libSMESH_Swig
 +/// \brief Python API for %SMESH GUI.
 +///
 +/// See SMESH_Swig class for %SMESH GUI Python API.
 +///
 +/// \par Note about publishing of mesh objects in the study
 +///
 +/// Mesh objects are automatically published in the study. It is
 +/// not needed to specify a target SALOMEDS object (SObject) or
 +/// even name (%SMESH engine will will default name if it is not
 +/// specified).
 +/// So, normally functions of %SMESH GUI Python API like
 +///   AddNewMesh
 +///   AddNewHypothesis
 +///   AddNewAlgorithms
 +///   etc.
 +/// may only be needed to be called in case if mesh objects are
 +/// created when no active study is set to %SMESH component.
 +/// In this case, mentioned functions can be used to forcibly
 +/// publish existing objects in the currrently active study.
 +///
 +/// Note that if there are no open study, these methods will do
 +/// nothing.
 +///
 +/// \par Note about selection
 +///
 +/// In SALOME, selection is automatically synchronlized between
 +/// all GUI elements (like Object browser, view windows, etc).
 +/// This means that any changes to selection applied with
 +/// select() methods, will automatically apply to all view
 +/// windows, taking into account selection modes switched in
 +/// each particular view window (e.g. if you select edges, while
 +/// in some view window Face selection mode is switched on,
 +/// selection will not be immediately applied to this view
 +/// window.
 +/////////////////////////////////////////////////////////////////
 +
  #include "libSMESH_Swig.h"
  
  #include <SVTK_Selector.h>
@@@ -69,7 -36,7 +69,7 @@@
  #include <Utils_ORB_INIT.hxx>
  #include <Utils_SINGLETON.hxx>
  #include <SALOMEDSClient_ClientFactory.hxx>
 -#include <SALOME_KernelServices.hxx>
 +#include <SALOMEDS_Study.hxx>
  
  #include <utilities.h>
  
@@@ -79,7 -46,7 +79,7 @@@
  #include <SALOME_Prs.h>
  #include <SUIT_ViewWindow.h>
  #include <SVTK_ViewWindow.h>
 -#include <VTKViewer_ViewModel.h>
 +#include <SVTK_ViewModel.h>
  #include <SALOME_Event.h>
  #include <SalomeApp_Application.h>
  #include <LightApp_SelectionMgr.h>
  #include <vtkActorCollection.h>
  #include <vtkRenderer.h>
  
 -static CORBA::ORB_var anORB;
 -
  namespace
  {
 -  //---------------------------------------------------------------
 -  inline
 -  CORBA::Object_var
 -  StringToObject(const std::string& theIOR)
 +  ///////////////////////////////////////////////////////////////
 +  /// \internal
 +  /// \brief Print deprecation warning to termninal.
 +  /// \param function Interface function's name.
 +  /// \param replacement Replacement (new) function's name
 +  ///        (if there's any).
 +  ///////////////////////////////////////////////////////////////
 +  void deprecated(const char* function, const char* replacement = 0)
    {
 -    return anORB->string_to_object(theIOR.c_str());
 +    if ( replacement )
 +      printf("libSMESH_Swig: method '%s' is deprecated; use '%s' instead.\n", function, replacement);
 +    else
 +      printf("libSMESH_Swig: method '%s' is deprecated.\n", function);
    }
  
 +  ///////////////////////////////////////////////////////////////
 +  /// \internal
 +  /// \brief Get CORBA object by its IOR.
 +  /// \param ior Object's IOR.
 +  /// \return CORBA object (nil object if it isn't found).
 +  ///////////////////////////////////////////////////////////////
 +  CORBA::Object_var string2object(const std::string& ior)
 +  {
 +    return SalomeApp_Application::orb()->string_to_object(ior.c_str());
 +  }
  
 -  //---------------------------------------------------------------
 -  inline
 -  SALOMEDS::SObject_var
 -  GetDomainRoot(const SALOMEDS::SComponent_var& theSComponentMesh,
 -                const SALOMEDS::StudyBuilder_var& theStudyBuilder,
 -                CORBA::Long theDomainRootTag,
 -                const QString& theName,
 -                const QString& thePixmap)
 +  ///////////////////////////////////////////////////////////////
 +  /// \internal
 +  /// \brief Get study object by its study UID or IOR.
-   /// \param studyId Study UID.
 +  /// \param uid Object's study UID or IOR.
 +  /// \return Pointer to study object (null object if it isn't
 +  ///         found).
 +  ///////////////////////////////////////////////////////////////
-   _PTR(SObject) uid2object(int studyId, const std::string& uid)
++  _PTR(SObject) uid2object(const std::string& uid)
    {
 -    SALOMEDS::SObject_var aDomainRoot;
 -    if (!theSComponentMesh->FindSubObject(theDomainRootTag,aDomainRoot)) {
 -      aDomainRoot = theStudyBuilder->NewObjectToTag(theSComponentMesh,theDomainRootTag);
 -      SALOMEDS::GenericAttribute_var anAttr = theStudyBuilder->FindOrCreateAttribute(aDomainRoot,"AttributeName");
 -      SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
 -      aName->SetValue(theName.toLatin1().data());
 -      aName->UnRegister();
 -      anAttr = theStudyBuilder->FindOrCreateAttribute(aDomainRoot,"AttributePixMap");
 -      SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
 -      aPixmap->SetPixMap(thePixmap.toLatin1().data());
 -      aPixmap->UnRegister();
 -      anAttr = theStudyBuilder->FindOrCreateAttribute(aDomainRoot,"AttributeSelectable");
 -      SALOMEDS::AttributeSelectable_var aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr);
 -      aSelAttr->SetSelectable(false);
 -      aSelAttr->UnRegister();
 +    _PTR(SObject) sobject;
-     if ( studyId > 0 )
 +    {
-       _PTR(Study) study = SalomeApp_Application::studyMgr()->GetStudyByID( studyId );
++      _PTR(Study) study = SMESH::getStudy();
 +      if ( study )
 +      {
 +      sobject = study->FindObjectID( uid );
 +      if ( !sobject )
 +        sobject = study->FindObjectIOR( uid );
 +      }
      }
 -
 -    return aDomainRoot;
 +    return sobject;
    }
  
 -
 -  //---------------------------------------------------------------
 -  inline
 -  SALOMEDS::SObject_var
 -  GetHypothesisRoot(const SALOMEDS::SComponent_var& theSComponentMesh,
 -                    const SALOMEDS::StudyBuilder_var& theStudyBuilder)
 +  ///////////////////////////////////////////////////////////////
 +  /// \internal
 +  /// \brief Get view window by its identifier.
 +  /// \param uid Window's identifier.
 +  /// \return Pointer to the view window (0 if it isn't found).
 +  ///////////////////////////////////////////////////////////////
 +  SALOME_View* uid2wnd(int uid, bool create = false)
    {
 -    return GetDomainRoot(theSComponentMesh,
 -                         theStudyBuilder,
 -                         SMESH::Tag_HypothesisRoot,
 -                         QObject::tr("SMESH_MEN_HYPOTHESIS"),
 -                         "ICON_SMESH_TREE_HYPO");
 -  }
 +    SALOME_View* window = 0;
  
 +    SUIT_Session* session = SUIT_Session::session();
 +    SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
 +    if ( app )
 +    {
 +      if ( uid )
 +      {
 +      ViewManagerList vms = app->viewManagers();
 +      for ( int i = 0; i < vms.count() && !window; i++ )
 +      {
 +        SUIT_ViewManager* vm = vms[i];
 +        QVector<SUIT_ViewWindow*> vws = vm->getViews();
 +        for ( int j = 0; j < vws.count() && !window; j++)
 +        {
 +          SUIT_ViewWindow* vw = vws[0];
 +          if ( uid == vw->getId() )
 +            window = dynamic_cast<SALOME_View*>( vm->getViewModel() );
 +        }
 +      }
 +      }
 +      else
 +      {
 +      SUIT_ViewManager* vm = app->getViewManager( SVTK_Viewer::Type(), create );
 +      if ( vm )
 +      { 
 +        window = dynamic_cast<SALOME_View*>( vm->getViewModel() );
 +      }
 +      }
 +    }
 +    return window;
 +  }
  
 -  //---------------------------------------------------------------
 -  inline
 -  SALOMEDS::SObject_var
 -  GetAlgorithmsRoot(const SALOMEDS::SComponent_var& theSComponentMesh,
 -                    const SALOMEDS::StudyBuilder_var& theStudyBuilder)
 +  ///////////////////////////////////////////////////////////////
 +  /// \internal
 +  /// \brief Get all view windows.
 +  /// \return List of view windows.
 +  ///////////////////////////////////////////////////////////////
 +  QList<SALOME_View*> windows()
    {
 -    return GetDomainRoot(theSComponentMesh,
 -                         theStudyBuilder,
 -                         SMESH::Tag_AlgorithmsRoot,
 -                         QObject::tr("SMESH_MEN_ALGORITHMS"),
 -                         "ICON_SMESH_TREE_ALGO");
 +    QList<SALOME_View*> views;
 +    SUIT_Session* session = SUIT_Session::session();
 +    SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
 +    if ( app )
 +    {
 +      ViewManagerList vms = app->viewManagers();
 +      foreach( SUIT_ViewManager* vm, vms )
 +      {
 +        if ( vm && vm->getType() == SVTK_Viewer::Type() )
 +      {
 +          SALOME_View* view = dynamic_cast<SALOME_View*>( vm->getViewModel() );
 +          if ( view )
 +          views << view;
 +      }
 +      }
 +    }
 +    return views;
    }
  
 -
 -  //---------------------------------------------------------------
 -  inline
 -  SALOMEDS::SObject_var
 -  AddToDomain(const std::string&                theIOR,
 -              const SALOMEDS::SComponent_var&   theSComponentMesh,
 -              const SALOMEDS::StudyBuilder_var& theStudyBuilder,
 -              CORBA::Long                       theDomainRootTag,
 -              const QString&                    theDomainName,
 -              const QString&                    theDomainPixmap)
 +  ///////////////////////////////////////////////////////////////
 +  /// \internal
 +  /// \brief Get mesh actor from view.
 +  /// \param view Pointer to the view window.
 +  /// \param uid Mesh object's study UID.
 +  /// \return Mesh actor (0 if it isn't found).
 +  ///////////////////////////////////////////////////////////////
 +  SMESH_Actor* actorFromView(SALOME_View* view, const char* uid)
    {
 -    SALOMEDS::SObject_var aDomain = GetDomainRoot(theSComponentMesh,
 -                                                  theStudyBuilder,
 -                                                  SMESH::Tag_AlgorithmsRoot,
 -                                                  theDomainName,
 -                                                  theDomainPixmap);
 -    // Add New Hypothesis
 -    SALOMEDS::SObject_var aSObject = theStudyBuilder->NewObject(aDomain);
 -    aDomain->UnRegister();
 -    SALOMEDS::GenericAttribute_var anAttr = theStudyBuilder->FindOrCreateAttribute(aSObject,"AttributePixMap");
 -    SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
 -    CORBA::Object_var anObject = StringToObject(theIOR);
 -    SMESH::SMESH_Hypothesis_var aDomainItem = SMESH::SMESH_Hypothesis::_narrow(anObject.in());
 -    CORBA::String_var aType = aDomainItem->GetName();
 -    QString aPixmapName = theDomainPixmap + "_" + aType.in();
 -    aPixmap->SetPixMap(aPixmapName.toLatin1().data());
 -    aPixmap->UnRegister();
 -    anAttr = theStudyBuilder->FindOrCreateAttribute(aSObject,"AttributeIOR");
 -    SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
 -    anIOR->SetValue(theIOR.c_str());
 -    anIOR->UnRegister();
 -
 -    return aSObject;
 +    SMESH_Actor* actor = 0;
 +    SVTK_Viewer* model = dynamic_cast<SVTK_Viewer*>( view );
 +    if ( model )
 +    {
 +      SUIT_ViewWindow* vw = model->getViewManager()->getActiveView();
 +      if ( vw )
 +      {
 +        actor = SMESH::FindActorByEntry( vw, uid );
 +      }
 +    }
 +    return actor;
    }
  
 -
 -  //---------------------------------------------------------------
 -  SALOMEDS::SObject_var
 -  AddHypothesis(const std::string& theIOR,
 -                const SALOMEDS::SComponent_var& theSComponentMesh,
 -                const SALOMEDS::StudyBuilder_var& theStudyBuilder)
 +  ///////////////////////////////////////////////////////////////
 +  /// \internal
 +  /// \brief Get mesh object's visual properties.
 +  /// \param view Pointer to the view window.
 +  /// \param uid Mesh object's study UID.
 +  /// \return Properties data structure.
 +  ///////////////////////////////////////////////////////////////
 +  Properties properties(SALOME_View* view, const char* uid)
    {
 -    return AddToDomain(theIOR,
 -                       theSComponentMesh,
 -                       theStudyBuilder,
 -                       SMESH::Tag_HypothesisRoot,
 -                       QObject::tr("SMESH_MEN_HYPOTHESIS"),
 -                       "ICON_SMESH_TREE_HYPO");
 +    Properties props;
 +    SMESH_Actor* actor = actorFromView( view, uid );
 +    if ( actor )
 +    {
 +      actor->GetNodeColor( props.nodeColor.r,
 +                         props.nodeColor.g,
 +                         props.nodeColor.b );
 +      props.markerType = actor->GetMarkerType();
 +      props.markerScale = actor->GetMarkerScale();
 +      
 +      actor->GetEdgeColor( props.edgeColor.r,
 +                         props.edgeColor.g,
 +                         props.edgeColor.b );
 +      props.edgeWidth = qMax( (int)actor->GetLineWidth(), 1 );
 +      
 +      actor->GetSufaceColor( props.surfaceColor.r,
 +                           props.surfaceColor.g,
 +                           props.surfaceColor.b,
 +                           props.surfaceColor.delta );
 +      
 +      actor->GetVolumeColor( props.volumeColor.r,
 +                           props.volumeColor.g,
 +                           props.volumeColor.b,
 +                           props.volumeColor.delta );
 +      
 +      actor->Get0DColor( props.elem0dColor.r,
 +                       props.elem0dColor.g,
 +                       props.elem0dColor.b );
 +      props.elem0dSize = qMax( (int)actor->Get0DSize(), 1 );
 +      
 +      actor->GetBallColor( props.ballColor.r,
 +                         props.ballColor.g,
 +                         props.ballColor.b );
 +      props.ballScale = qMax( actor->GetBallScale(), 1e-2 );
 +      
 +      actor->GetOutlineColor( props.outlineColor.r,
 +                            props.outlineColor.g,
 +                            props.outlineColor.b );
 +      props.outlineWidth = qMax( (int)actor->GetOutlineWidth(), 1 );
 +      
 +      actor->GetFacesOrientationColor( props.orientationColor.r,
 +                                     props.orientationColor.g,
 +                                     props.orientationColor.b );
 +      props.orientationScale = actor->GetFacesOrientationScale();
 +      props.orientation3d = actor->GetFacesOrientation3DVectors();
 +      
 +      props.shrinkFactor = actor->GetShrinkFactor();
 +      
 +      props.opacity = actor->GetOpacity();
 +    }
 +    return props;
    }
  
 -
 -  //---------------------------------------------------------------
 -  SALOMEDS::SObject_var
 -  AddAlgorithms(const std::string& theIOR,
 -                const SALOMEDS::SComponent_var& theSComponentMesh,
 -                const SALOMEDS::StudyBuilder_var& theStudyBuilder)
 +  ///////////////////////////////////////////////////////////////
 +  /// \internal
 +  /// \brief Set mesh object's visual properties.
 +  /// \param view Pointer to the view window.
 +  /// \param uid Mesh object's study UID.
 +  /// \param props Properties data structure.
 +  ///////////////////////////////////////////////////////////////
 +  void setProperties(SALOME_View* view, const char* uid, const Properties& props)
    {
 -    return AddToDomain(theIOR,
 -                       theSComponentMesh,
 -                       theStudyBuilder,
 -                       SMESH::Tag_AlgorithmsRoot,
 -                       QObject::tr("SMESH_MEN_ALGORITHMS"),
 -                       "ICON_SMESH_TREE_ALGO");
 +    SMESH_Actor* actor = actorFromView( view, uid );
 +    if ( actor )
 +    {
 +      actor->SetNodeColor( props.nodeColor.r,
 +                         props.nodeColor.g,
 +                         props.nodeColor.b );
 +      if ( props.markerType != VTK::MT_USER )
 +      actor->SetMarkerStd( props.markerType, props.markerScale );
 +      
 +      actor->SetEdgeColor( props.edgeColor.r,
 +                         props.edgeColor.g,
 +                         props.edgeColor.b );
 +      actor->SetLineWidth( qMax( (double)props.edgeWidth, 1. ) );
 +      
 +      actor->SetSufaceColor( props.surfaceColor.r,
 +                           props.surfaceColor.g,
 +                           props.surfaceColor.b,
 +                           props.surfaceColor.delta );
 +      
 +      actor->SetVolumeColor( props.volumeColor.r,
 +                           props.volumeColor.g,
 +                           props.volumeColor.b,
 +                           props.volumeColor.delta );
 +      
 +      actor->Set0DColor( props.elem0dColor.r,
 +                       props.elem0dColor.g,
 +                       props.elem0dColor.b );
 +      actor->Set0DSize( qMax( (double)props.elem0dSize, 1. ) );
 +      
 +      actor->SetBallColor( props.ballColor.r,
 +                         props.ballColor.g,
 +                         props.ballColor.b );
 +      actor->SetBallScale( qMax( props.ballScale, 1e-2 ) );
 +      
 +      actor->SetOutlineColor( props.outlineColor.r,
 +                            props.outlineColor.g,
 +                            props.outlineColor.b );
 +      actor->SetOutlineWidth( qMax( (double)props.outlineWidth, 1. ) );
 +      
 +      actor->SetFacesOrientationColor( props.orientationColor.r,
 +                                     props.orientationColor.g,
 +                                     props.orientationColor.b );
 +      actor->SetFacesOrientationScale( props.orientationScale );
 +      actor->SetFacesOrientation3DVectors( props.orientation3d );
 +      
 +      actor->SetShrinkFactor( props.shrinkFactor );
 +      
 +      actor->SetOpacity( props.opacity );
 +      
 +      view->Repaint();
 +    }
    }
-   : myCachedStudyId( 0 )
 +} // end of anonymous namespace
 +
 +/////////////////////////////////////////////////////////////////
 +/// \enum EntityMode
 +/// \brief Enumeration for mesh entities.
 +/// \var EntityMode Entity0d
 +/// \brief 0D elements.
 +/// \var EntityMode EntityEdges
 +/// \brief Edges.
 +/// \var EntityMode EntityFaces
 +/// \brief Faces.
 +/// \var EntityMode EntityVolumes
 +/// \brief Volumes.
 +/// \var EntityMode EntityBalls
 +/// \brief Ball elements.
 +/// \var EntityMode EntityAll
 +/// \brief All elements.
 +/////////////////////////////////////////////////////////////////
 +
 +/////////////////////////////////////////////////////////////////
 +/// \enum SelectionMode
 +/// \brief Selection mode.
 +/// \var SelectionMode Undefined
 +/// \brief Undefined selection mode.
 +/// \var SelectionMode Node
 +/// \brief Selection of mesh nodes.
 +/// \var SelectionMode Cell
 +/// \brief Selection of any mesh cells.
 +/// \var SelectionMode EdgeOfCell
 +/// \brief Selection of pseudo-edges specified by couple of nodes.
 +/// \var SelectionMode Edge
 +/// \brief Selection of edges.
 +/// \var SelectionMode Face
 +/// \brief Selection of faces.
 +/// \var SelectionMode Volume
 +/// \brief Selection of volumes
 +/// \var SelectionMode Actor
 +/// \brief Selection of whole actors (meshes, sub-meshes, groups).
 +/// \var SelectionMode Elem0D
 +/// \brief Selection of 0D elements.
 +/// \var SelectionMode Ball
 +/// \brief Selection of ball ellements.
 +/////////////////////////////////////////////////////////////////
 +
 +/////////////////////////////////////////////////////////////////
 +/// \enum DisplayMode
 +/// \brief Display mode.
 +/// \var DisplayMode UndefinedMode
 +/// \brief Undefined display mode.
 +/// \var DisplayMode PointMode
 +/// \brief Point representation.
 +/// \var DisplayMode EdgeMode
 +/// \brief Wireframe representation.
 +/// \var DisplayMode SurfaceMode
 +/// \brief Surface representation.
 +/////////////////////////////////////////////////////////////////
 +
 +/////////////////////////////////////////////////////////////////
 +/// \struct ColorData
 +/// \brief Color data, in RGBf format.
 +/// \var ColorData::r
 +/// \brief Red color's component (0.0:1.0).
 +/// \var ColorData::g
 +/// \brief Green color's component (0.0:1.0).
 +/// \var ColorData::b
 +/// \brief Blue color's component (0.0:1.0).
 +/////////////////////////////////////////////////////////////////
 +
 +/////////////////////////////////////////////////////////////////
 +/// \brief Constructor.
 +/////////////////////////////////////////////////////////////////
 +ColorData::ColorData()
 +  : r( 0 ), g( 0 ), b( 0 )
 +{}
 +
 +/////////////////////////////////////////////////////////////////
 +/// \struct BicolorData
 +/// \brief Bi-color data, in RGBf format.
 +/// \var BicolorData::r
 +/// \brief Red color's component (0.0:1.0).
 +/// \var BicolorData::g
 +/// \brief Green color's component (0.0:1.0).
 +/// \var BicolorData::b
 +/// \brief Blue color's component (0.0:1.0).
 +/// \var BicolorData::delta
 +/// \brief Shift for backface color (-100:100).
 +/////////////////////////////////////////////////////////////////
 +
 +/////////////////////////////////////////////////////////////////
 +/// \brief Constructor.
 +/////////////////////////////////////////////////////////////////
 +BicolorData::BicolorData()
 +  : r( 0 ), g( 0 ), b( 0 ), delta( 0 )
 +{}
 +
 +/////////////////////////////////////////////////////////////////
 +/// \struct Properties
 +/// \brief Mesh object presentation's properties.
 +/// \var Properties::nodeColor
 +/// \brief Node color.
 +/// \var Properties::markerType
 +/// \brief Node standard marker type.
 +/// \var Properties::markerScale
 +/// \brief Node scale factor.
 +/// \var Properties::edgeColor
 +/// \brief Edges color.
 +/// \var Properties::edgeWidth
 +/// \brief Edges width.
 +/// \var Properties::surfaceColor
 +/// \brief Faces color.
 +/// \var Properties::volumeColor
 +/// \brief Volumes color.
 +/// \var Properties::elem0dColor
 +/// \brief 0D elements color.
 +/// \var Properties::elem0dSize
 +/// \brief 0D elements size.
 +/// \var Properties::ballColor
 +/// \brief Ball elements color.
 +/// \var Properties::ballScale
 +/// \brief Ball elements scale factor.
 +/// \var Properties::outlineColor
 +/// \brief Outlines color.
 +/// \var Properties::outlineWidth
 +/// \brief Outlines width.
 +/// \var Properties::orientationColor
 +/// \brief Face orientation vectors color.
 +/// \var Properties::orientationScale
 +/// \brief Face orientation vectors scale factor.
 +/// \var Properties::orientation3d
 +/// \brief Face orientation vectors 3d flag.
 +/// \var Properties::shrinkFactor
 +/// \brief Shrink coefficient.
 +/// \var Properties::opacity
 +/// \brief Opacity.
 +/////////////////////////////////////////////////////////////////
 +
 +/////////////////////////////////////////////////////////////////
 +/// \brief Constructor.
 +/////////////////////////////////////////////////////////////////
 +Properties::Properties()
 +  : markerType( VTK::MT_NONE ), markerScale( VTK::MS_NONE ),
 +    edgeWidth( 1 ), elem0dSize( 1 ), ballScale( 1 ), outlineWidth( 1 ),
 +    orientationScale( 0 ), orientation3d( false ), shrinkFactor( 0 ),
 +    opacity( 1 )
 +{}
 +
 +/////////////////////////////////////////////////////////////////
 +/// \typedef nodeColorStruct
 +/// \deprecated Use ColorData instead.
 +/// \typedef edgeColorStruct
 +/// \deprecated Use ColorData instead.
 +/// \typedef surfaceColorStruct
 +/// \deprecated Use BicolorData instead.
 +/// \typedef volumeColorStruct
 +/// \deprecated Use BicolorData instead.
 +/// \typedef actorAspect
 +/// \deprecated Use Properties instead.
 +/////////////////////////////////////////////////////////////////
 +
 +/////////////////////////////////////////////////////////////////
 +/// \class SMESH_Swig
 +/// \brief %SMESH GUI Python interface.
 +/////////////////////////////////////////////////////////////////
 +
 +/////////////////////////////////////////////////////////////////
 +/// \brief Constructor.
 +/////////////////////////////////////////////////////////////////
 +SMESH_Swig::SMESH_Swig()
 +{
 +  init();
 +}
  
 +/////////////////////////////////////////////////////////////////
 +/// \brief Destructor.
 +/////////////////////////////////////////////////////////////////
 +SMESH_Swig::~SMESH_Swig()
 +{
 +}
  
 -  //---------------------------------------------------------------
 -  void
 -  SetDomain(const char*                       theMeshOrSubMeshEntry,
 -            const char*                       theDomainEntry,
 -            const SALOMEDS::StudyBuilder_var& theStudyBuilder,
 -            long                              theRefOnAppliedDomainTag,
 -            const QString&                    theAppliedDomainMEN,
 -            const QString&                    theAppliedDomainICON)
 +/////////////////////////////////////////////////////////////////
 +/// \internal
 +/// \brief Initialize interface.
 +/////////////////////////////////////////////////////////////////
 +void SMESH_Swig::init()
 +{
 +  class TInitEvent: public SALOME_Event
    {
 -    SALOMEDS::SObject_var aMeshOrSubMeshSO = KERNEL::getStudyServant()->FindObjectID(theMeshOrSubMeshEntry);
 -    SALOMEDS::SObject_var    aHypothesisSO = KERNEL::getStudyServant()->FindObjectID(theDomainEntry);
 +  public:
 +    TInitEvent() {}
 +    virtual void Execute()
 +    {
 +      SUIT_Session* session = SUIT_Session::session();
 +      SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
  
 -    if(!aMeshOrSubMeshSO->_is_nil() && !aHypothesisSO->_is_nil()){
 -      //Find or Create Applied Hypothesis root
 -      SALOMEDS::SObject_var anAppliedDomainSO;
 -      if( !aMeshOrSubMeshSO->FindSubObject( theRefOnAppliedDomainTag, anAppliedDomainSO ))
 -      {
 -        anAppliedDomainSO = theStudyBuilder->NewObjectToTag(aMeshOrSubMeshSO,theRefOnAppliedDomainTag);
 -        SALOMEDS::GenericAttribute_var anAttr =
 -          theStudyBuilder->FindOrCreateAttribute(anAppliedDomainSO,"AttributeName");
 -        SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
 -        aName->SetValue(theAppliedDomainMEN.toLatin1().data());
 -        aName->UnRegister();
 -        anAttr = theStudyBuilder->FindOrCreateAttribute(anAppliedDomainSO,"AttributeSelectable");
 -        SALOMEDS::AttributeSelectable_var aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr);
 -        aSelAttr->SetSelectable(false);
 -        aSelAttr->UnRegister();
 -        anAttr = theStudyBuilder->FindOrCreateAttribute(anAppliedDomainSO,"AttributePixMap");
 -        SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
 -        aPixmap->SetPixMap(theAppliedDomainICON.toLatin1().data());
 -        aPixmap->UnRegister();
 -      }
 -      SALOMEDS::SObject_var aSObject = theStudyBuilder->NewObject(anAppliedDomainSO);
 -      theStudyBuilder->Addreference(aSObject,aHypothesisSO);
 -      aSObject->UnRegister();
 -      anAppliedDomainSO->UnRegister();
 +      if ( !SMESHGUI::GetSMESHGUI() )
 +      app->loadModule( "Mesh" );
      }
 -    if ( !aMeshOrSubMeshSO->_is_nil() ) aMeshOrSubMeshSO->UnRegister();
 -    if ( !aHypothesisSO->_is_nil())     aHypothesisSO->UnRegister();
 -  }
 +  };
  
-   // set current study
-   std::vector<std::string> studies = SalomeApp_Application::studyMgr()->GetOpenStudies();
-   if ( studies.size() > 0 )
-   {
-     _PTR(Study) study = SalomeApp_Application::studyMgr()->GetStudyByName( studies[0] );
-     int studyId = study->StudyId();
-     if ( myCachedStudyId != studyId )
-     {
-       myCachedStudyId = studyId;
-       SMESHGUI::GetSMESHGen()->SetCurrentStudy( _CAST(Study, study)->GetStudy() );
-     }
-   }
-   else
-   {
-     myCachedStudyId = 0;
-   }
 +  // load SMESH GUI if it's not yet loaded
 +  ProcessVoidEvent( new TInitEvent() );
++  SMESHGUI::GetSMESHGen()->UpdateStudy();
 +}
  
 -  //---------------------------------------------------------------
 -  void
 -  SetHypothesis(const char*                       theMeshOrSubMeshEntry,
 -                const char*                       theDomainEntry,
 -                const SALOMEDS::StudyBuilder_var& theStudyBuilder)
 -  {
 -    SetDomain(theMeshOrSubMeshEntry,
 -              theDomainEntry,
 -              theStudyBuilder,
 -              SMESH::Tag_RefOnAppliedHypothesis,
 -              QObject::tr("SMESH_MEN_APPLIED_HYPOTHESIS"),
 -              "ICON_SMESH_TREE_HYPO");
 -  }
 +/////////////////////////////////////////////////////////////////
 +/// \brief Publish object.
 +/// \param ior IOR of the mesh object to publish.
 +/// \param name Study name of the object; if not given,
 +///             name is assigned automatically.
 +/// \return UID of the data object.
 +/////////////////////////////////////////////////////////////////
 +const char* SMESH_Swig::publish(const char* ior, const char* name)
 +{
 +  init();
  
-   if ( myCachedStudyId > 0 )
-   {
-     _PTR(Study) study = SalomeApp_Application::studyMgr()->GetStudyByID( myCachedStudyId );
-     CORBA::Object_var object = string2object( ior );
-     if ( study && !CORBA::is_nil( object ) )
 +  std::string uid;
-       SMESHGUI::GetSMESHGen()->PublishInStudy( _CAST(Study, study)->GetStudy(),
-                                                SALOMEDS::SObject::_nil(),
++  CORBA::Object_var object = string2object( ior );
++  if ( !CORBA::is_nil( object ) )
 +    {
 +      SALOMEDS::SObject_var sobject =
-       {
-       uid = sobject->GetID();
-       }
++      SMESHGUI::GetSMESHGen()->PublishInStudy( SALOMEDS::SObject::_nil(),
 +                                               object.in(),
 +                                               name );
 +      if ( !CORBA::is_nil( sobject ) )
-   }
++      {
++        uid = sobject->GetID();
++      }
 +      sobject->UnRegister();
 +    }
  
 -  //---------------------------------------------------------------
 -  void
 -  SetAlgorithms(const char*                       theMeshOrSubMeshEntry,
 -                const char*                       theDomainEntry,
 -                const SALOMEDS::StudyBuilder_var& theStudyBuilder)
 -  {
 -    SetDomain(theMeshOrSubMeshEntry,
 -              theDomainEntry,
 -              theStudyBuilder,
 -              SMESH::Tag_RefOnAppliedAlgorithms,
 -              QObject::tr("SMESH_MEN_APPLIED_ALGORIHTMS"),
 -              "ICON_SMESH_TREE_ALGO");
 -  }
 +  return strdup( uid.c_str() );
  }
  
 +/////////////////////////////////////////////////////////////////
 +/// \brief Set new study name of given object.
 +/// \param uid Object's study UID or IOR.
 +/// \param name New name of the object.
 +/////////////////////////////////////////////////////////////////
 +void SMESH_Swig::rename(const char* uid, const char* name)
 +{
 +  init();
  
-   _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
 -//===============================================================
 -SMESH_Swig::SMESH_Swig()
++  _PTR(SObject) sobject = uid2object( uid );
 +  if ( sobject )
 +    sobject->SetAttrString( "AttributeName", name );
 +}
 +
 +/////////////////////////////////////////////////////////////////
 +/// \brief Display mesh object.
 +/// \param uid Object's study UID or IOR.
 +/// \param viewUid View window UID (0 means currently active view
 +///                window; if there's no view, it is created).
 +///                Default: 0.
 +/// \param updateViewer "Update view" flag. Default: \c true.
 +/////////////////////////////////////////////////////////////////
 +void SMESH_Swig::display(const char* uid, int viewUid, bool updateViewer)
  {
 -  class TEvent: public SALOME_Event
 +  class TDisplayEvent: public SALOME_Event
    {
 -    CORBA::ORB_var& myORB;
 +  private:
 +    const char* myUid;
 +    int myViewUid;
 +    bool myIsUpdate;
    public:
 +    TDisplayEvent(const char* uid, int viewUid, bool updateViewer)
 +      : myUid( uid ), myViewUid( viewUid ), myIsUpdate( updateViewer ) {}
 +    virtual void Execute()
 +    {
 +      SALOME_View* view = uid2wnd( myViewUid, true ); // create view if it's not present
 +      if ( view )
 +      LightApp_Displayer::FindDisplayer( "Mesh", true )->Display( myUid, myIsUpdate, view );
 +    }
 +  };
 +
 +  init();
  
-   _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
 -    TEvent(CORBA::ORB_var& theORB):
 -      myORB(theORB)
 -    {}
++  _PTR(SObject) sobject = uid2object( uid );
 +  if ( sobject )
 +    ProcessVoidEvent( new TDisplayEvent( sobject->GetID().c_str(), viewUid, updateViewer ) );
 +}
  
 -    virtual
 -    void
 -    Execute()
 +/////////////////////////////////////////////////////////////////
 +/// \brief Erase mesh object.
 +/// \param uid Object's study UID or IOR.
 +/// \param viewUid View window UID (0 means currently active view
 +///                window); -1 means "all view windows".
 +///                Default: 0.
 +/// \param updateViewer "Update view" flag. Default: \c true.
 +/////////////////////////////////////////////////////////////////
 +void SMESH_Swig::erase(const char* uid, int viewUid, bool updateViewer)
 +{
 +  class TEraseEvent: public SALOME_Event
 +  {
 +  private:
 +    const char* myUid;
 +    int myViewUid;
 +    bool myIsUpdate;
 +  public:
 +    TEraseEvent(const char* uid, int viewUid, bool updateViewer)
 +      : myUid( uid ), myViewUid( viewUid ), myIsUpdate( updateViewer ) {}
 +    virtual void Execute()
      {
 -      try {
 -        ORB_INIT &anORBInit = *SINGLETON_<ORB_INIT>::Instance();
 -        ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
 -        myORB = anORBInit( 0, 0 );
 -      } catch (...) {
 -        INFOS("internal error : orb not found");
 +      if ( myViewUid == -1 )
 +      {
 +      QList<SALOME_View*> views = windows();
 +      foreach( SALOME_View* view, views )
 +        LightApp_Displayer::FindDisplayer( "Mesh", true )->Erase( myUid, true, myIsUpdate, view );
 +      }
 +      else
 +      {
 +      SALOME_View* view = uid2wnd( myViewUid );
 +      if ( view )
 +        LightApp_Displayer::FindDisplayer( "Mesh", true )->Erase( myUid, true, myIsUpdate, view );
        }
      }
    };
  
 -  //MESSAGE("Constructeur");
 -
 -  if(CORBA::is_nil(anORB))
 -    ProcessVoidEvent(new TEvent(anORB));
 +  init();
  
-   _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
 -  ASSERT(!CORBA::is_nil(anORB));
++  _PTR(SObject) sobject = uid2object( uid );
 +  if ( sobject )
 +    ProcessVoidEvent( new TEraseEvent( sobject->GetID().c_str(), viewUid, updateViewer ) );
  }
  
 -
 -//===============================================================
 -void
 -SMESH_Swig::Init()
 +/////////////////////////////////////////////////////////////////
 +/// \brief Update mesh object.
 +/// \param uid Object's study UID or IOR.
 +/////////////////////////////////////////////////////////////////
 +void SMESH_Swig::update(const char* uid)
  {
 -  class TEvent: public SALOME_Event
 +  class TUpdateEvent: public SALOME_Event
    {
 -    SALOMEDS::StudyBuilder_var& myStudyBuilder;
 -    SALOMEDS::SComponent_var&   mySComponentMesh;
 +  private:
 +    const char* myUid;
    public:
 -    TEvent(SALOMEDS::StudyBuilder_var& theStudyBuilder,
 -           SALOMEDS::SComponent_var&   theSComponentMesh):
 -      myStudyBuilder  (theStudyBuilder),
 -      mySComponentMesh(theSComponentMesh)
 -    {}
 -
 -    ~TEvent()
 +    TUpdateEvent( const char* uid ) : myUid( uid ) {}
 +    virtual void Execute()
      {
 -      if ( !mySComponentMesh->_is_nil() ) mySComponentMesh->UnRegister();
 +      Handle(SALOME_InteractiveObject) io = 
 +      new SALOME_InteractiveObject( myUid, "SMESH", "" );
 +      SMESH::Update( io, true );
      }
 +  };
  
 -    virtual
 -    void
 -    Execute()
 -    {
 -      SUIT_Session* aSession          = SUIT_Session::session();
 -      SUIT_Application* anApplication = aSession->activeApplication();
 -      SalomeApp_Application* anApp    = dynamic_cast<SalomeApp_Application*>(anApplication);
 -
 -      SALOMEDS::Study_var aStudy = KERNEL::getStudyServant();
 +  init();
  
-   _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
 -      SMESH::SMESH_Gen_var aSMESHGen = SMESHGUI::GetSMESHGen();
++  _PTR(SObject) sobject = uid2object( uid );
 +  if ( sobject )
 +    ProcessVoidEvent( new TUpdateEvent( uid ) );
 +}
  
 -      myStudyBuilder = aStudy->NewBuilder();
 +/////////////////////////////////////////////////////////////////
 +/// \internal
 +class TGetPropsEvent: public SALOME_Event
 +{
 +public:
 +  typedef Properties TResult;
 +  TResult myResult;
 +  const char* myUid;
 +  int myViewUid;
  
 -      SALOMEDS::GenericAttribute_var anAttr;
 -      SALOMEDS::AttributeName_var    aName;
 -      SALOMEDS::AttributePixMap_var  aPixmap;
 +  TGetPropsEvent( const char* uid, int viewUid )
 +    : myUid( uid ), myViewUid( viewUid ) {}
  
 -      SALOMEDS::SComponent_var aSComponent = aStudy->FindComponent("SMESH");
 -      if ( aSComponent->_is_nil() )
 -      {
 -        bool aLocked = aStudy->GetProperties()->IsLocked();
 -        if (aLocked)
 -          aStudy->GetProperties()->SetLocked(false);
 -
 -        SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI();
 -        //SRN: BugID IPAL9186, load a SMESH gui if it hasn't been loaded
 -        if (!aSMESHGUI) {
 -          CAM_Module* aModule = anApp->module("Mesh");
 -          if(!aModule)
 -            aModule = anApp->loadModule("Mesh");
 -          aSMESHGUI = dynamic_cast<SMESHGUI*>(aModule);
 -        } //SRN: BugID IPAL9186: end of a fix
 -
 -        aSComponent = myStudyBuilder->NewComponent("SMESH");
 -
 -        anAttr = myStudyBuilder->FindOrCreateAttribute(aSComponent,"AttributeName");
 -        aName  = SALOMEDS::AttributeName::_narrow(anAttr);
 -        aName->SetValue(aSMESHGUI->moduleName().toLatin1().data());
 -        aName->UnRegister();
 -
 -        anAttr = myStudyBuilder->FindOrCreateAttribute(aSComponent,"AttributePixMap");
 -        aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
 -        aPixmap->SetPixMap( "ICON_OBJBROWSER_SMESH" );
 -        aPixmap->UnRegister();
 -
 -        SALOMEDS::UseCaseBuilder_var useCaseBuilder = KERNEL::getStudyServant()->GetUseCaseBuilder();
 -        useCaseBuilder->SetRootCurrent();
 -        useCaseBuilder->Append( aSComponent.in() );
 -  
 -        myStudyBuilder->DefineComponentInstance(aSComponent,aSMESHGen);
 -        if (aLocked)
 -          KERNEL::getStudyServant()->GetProperties()->SetLocked(true);
 -      }
 +  virtual void Execute()
 +  {
 +    SALOME_View* view = uid2wnd( myViewUid );
 +    myResult = properties( view, myUid );
 +  }
 +};
  
 -      mySComponentMesh = SALOMEDS::SComponent::_narrow(aSComponent);
 +/////////////////////////////////////////////////////////////////
 +/// \brief Get mesh object's visual properties.
 +/// \param uid Mesh object's study UID or IOR.
 +/// \param viewUid View window UID (0 means currently active view
 +///                window); Default: 0.
 +/// \return Properties data structure.
 +/////////////////////////////////////////////////////////////////
 +Properties SMESH_Swig::properties(const char* uid, int viewUid)
 +{
 +  Properties props;
  
 -      qApp->processEvents(); // Workaround for bug 12662
 -    }
 -  };
 +  init();
  
-   _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
 -  //MESSAGE("Init");
++  _PTR(SObject) sobject = uid2object( uid );
 +  if ( sobject )
 +    props = ProcessEvent( new TGetPropsEvent( sobject->GetID().c_str(), viewUid ) );
  
 -  ProcessVoidEvent(new TEvent(myStudyBuilder,
 -                              mySComponentMesh));
 +  return props;
  }
  
 +/////////////////////////////////////////////////////////////////
 +/// \internal
 +/////////////////////////////////////////////////////////////////
 +class TSetPropsEvent: public SALOME_Event
 +{
 +public:
 +  const char* myUid;
 +  Properties myProps;
 +  int myViewUid;
  
 -//===============================================================
 -SMESH_Swig::~SMESH_Swig()
 +  TSetPropsEvent( const char* uid, const Properties& props, int viewUid )
 +    : myUid( uid ), myProps( props), myViewUid( viewUid ) {}
 +
 +  virtual void Execute()
 +  {
 +    if ( myViewUid == -1 )
 +    {
 +      QList<SALOME_View*> views = windows();
 +      foreach( SALOME_View* view, views )
 +      {
 +      setProperties( view, myUid, myProps );
 +      }
 +    }
 +    else
 +    {
 +      SALOME_View* view = uid2wnd( myViewUid );
 +      setProperties( view, myUid, myProps );
 +    }
 +  }
 +};
 +
 +/////////////////////////////////////////////////////////////////
 +/// \brief Set mesh object's visual properties.
 +/// \param uid Mesh object's study UID or IOR.
 +/// \param props Properties data structure.
 +/// \param viewUid View window UID (0 means currently active view
 +///                window); Default: 0.
 +/////////////////////////////////////////////////////////////////
 +void SMESH_Swig::setProperties(const char* uid, const Properties& props, int viewUid)
  {
 -  //MESSAGE("Destructeur");
 -}
 +  init();
  
-   _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
++  _PTR(SObject) sobject = uid2object( uid );
 +  if ( sobject )
 +    ProcessVoidEvent( new TSetPropsEvent( sobject->GetID().c_str(), props, viewUid ) );
 +}
  
 -//===============================================================
 -const char* SMESH_Swig::AddNewMesh(const char* theIOR)
 +/////////////////////////////////////////////////////////////////
 +/// \internal
 +/////////////////////////////////////////////////////////////////
 +class TGetNodeNumberingEvent: public SALOME_Event
  {
 +public:
 +  typedef bool TResult;
 +  TResult myResult;
 +  const char* myUid;
 +  int myViewUid;
 +
 +  TGetNodeNumberingEvent( const char* uid, int viewUid )
 +    : myResult( false ), myUid( uid ), myViewUid( viewUid ) {}
  
 -  // VSR: added temporarily - to be removed - objects are published automatically by engine
 -  SALOMEDS::SObject_var aSObject = KERNEL::getStudyServant()->FindObjectIOR(theIOR);
 -  if (aSObject->_is_nil())
 +  virtual void Execute()
    {
 -    //Find or Create Hypothesis root
 -    SALOMEDS::SObject_var hroot = GetHypothesisRoot(mySComponentMesh,myStudyBuilder);
 -    SALOMEDS::SObject_var aroot = GetAlgorithmsRoot(mySComponentMesh,myStudyBuilder);
 -    hroot->UnRegister();
 -    aroot->UnRegister();
 -
 -    // Add New Mesh
 -    aSObject = myStudyBuilder->NewObject(mySComponentMesh);
 -    SALOMEDS::GenericAttribute_var anAttr = myStudyBuilder->FindOrCreateAttribute(aSObject,"AttributePixMap");
 -    SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
 -    aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH" );
 -    aPixmap->UnRegister();
 -
 -    anAttr = myStudyBuilder->FindOrCreateAttribute(aSObject, "AttributeIOR");
 -    SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
 -    anIOR->SetValue(theIOR);
 -    anIOR->UnRegister();
 +    SALOME_View* view = uid2wnd( myViewUid );
 +    SMESH_Actor* actor = actorFromView( view, myUid );
 +    if ( actor )
 +      myResult = actor->GetPointsLabeled();
    }
 +};
 +
 +/////////////////////////////////////////////////////////////////
 +/// \brief Check if nodes numbering is switched on.
 +/// \param uid Mesh object's study UID or IOR.
 +/// \param viewUid View window UID (0 means currently active view
 +///                window); Default: 0.
 +/// \return \c true if nodes numbering is switched on;
 +///         \c false otherwise.
 +/////////////////////////////////////////////////////////////////
 +bool SMESH_Swig::nodesNumbering(const char* uid, int viewUid)
 +{
 +  bool numbering = false;
 +
 +  init();
  
-   _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
 -  CORBA::String_var anEntry = aSObject->GetID();
 -  aSObject->UnRegister();
++  _PTR(SObject) sobject = uid2object( uid );
 +  if ( sobject )
 +    numbering = ProcessEvent( new TGetNodeNumberingEvent( sobject->GetID().c_str(), viewUid ) );
  
 -  return anEntry._retn();
 +  return numbering;
  }
  
 +/////////////////////////////////////////////////////////////////
 +/// \internal
 +/////////////////////////////////////////////////////////////////
 +class TSetNodeNumberingEvent: public SALOME_Event
 +{
 +public:
 +  const char* myUid;
 +  bool myNumbering;
 +  int myViewUid;
 +
 +  TSetNodeNumberingEvent( const char* uid, bool numbering, int viewUid )
 +    : myUid( uid ), myNumbering( numbering ), myViewUid( viewUid ) {}
 +
 +  virtual void Execute()
 +  {
 +    SALOME_View* view = uid2wnd( myViewUid );
 +    SMESH_Actor* actor = actorFromView( view, myUid );
 +    if ( actor )
 +    {
 +      actor->SetPointsLabeled( myNumbering );
 +      if ( view )
 +      view->Repaint();
 +    }
 +  }
 +};
  
 -//===============================================================
 -const char* SMESH_Swig::AddNewHypothesis(const char* theIOR)
 +/////////////////////////////////////////////////////////////////
 +/// \brief Switch nodes numbering on/off.
 +/// \param uid Mesh object's study UID or IOR.
 +/// \param numbering \c true to switch nodes numbering on;
 +///                  \c false otherwise.
 +/// \param viewUid View window UID (0 means currently active view
 +///                window); Default: 0.
 +/////////////////////////////////////////////////////////////////
 +void SMESH_Swig::setNodesNumbering(const char* uid, bool numbering, int viewUid)
  {
 -  SALOMEDS::SObject_var aSObject = ::AddHypothesis(theIOR,
 -                                                   mySComponentMesh,
 -                                                   myStudyBuilder);
 -  CORBA::String_var anEntry = aSObject->GetID();
 -  aSObject->UnRegister();
 +  init();
  
-   _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
 -  return anEntry._retn();
++  _PTR(SObject) sobject = uid2object( uid );
 +  if ( sobject )
 +    ProcessVoidEvent( new TSetNodeNumberingEvent( sobject->GetID().c_str(), numbering, viewUid ) );
  }
  
 +/////////////////////////////////////////////////////////////////
 +/// \internal
 +/////////////////////////////////////////////////////////////////
 +class TGetElementNumberingEvent: public SALOME_Event
 +{
 +public:
 +  typedef bool TResult;
 +  TResult myResult;
 +  const char* myUid;
 +  int myViewUid;
  
 -//===============================================================
 -const char* SMESH_Swig::AddNewAlgorithms(const char* theIOR)
 +  TGetElementNumberingEvent( const char* uid, int viewUid )
 +    : myResult( false ), myUid( uid ), myViewUid( viewUid ) {}
 +
 +  virtual void Execute()
 +  {
 +    SALOME_View* view = uid2wnd( myViewUid );
 +    SMESH_Actor* actor = actorFromView( view, myUid );
 +    if ( actor )
 +      myResult = actor->GetCellsLabeled();
 +  }
 +};
 +
 +/////////////////////////////////////////////////////////////////
 +/// \brief Check if elements numbering is switched on.
 +/// \param uid Mesh object's study UID or IOR.
 +/// \param viewUid View window UID (0 means currently active view
 +///                window); Default: 0.
 +/// \return \c true if elements numbering is switched on;
 +///         \c false otherwise.
 +/////////////////////////////////////////////////////////////////
 +bool SMESH_Swig::elementsNumbering(const char* uid, int viewUid)
  {
 -  SALOMEDS::SObject_var aSObject = ::AddAlgorithms(theIOR,
 -                                                   mySComponentMesh,
 -                                                   myStudyBuilder);
 -  CORBA::String_var anEntry = aSObject->GetID();
 -  aSObject->UnRegister();
 +  bool numbering = false;
  
 -  return anEntry._retn();
 -}
 +  init();
 +
-   _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
++  _PTR(SObject) sobject = uid2object( uid );
 +  if ( sobject )
 +    numbering = ProcessEvent( new TGetElementNumberingEvent( sobject->GetID().c_str(), viewUid ) );
  
 +  return numbering;
 +}
  
 -//===============================================================
 -void SMESH_Swig::SetShape(const char* theShapeEntry,
 -                          const char* theMeshEntry)
 +/////////////////////////////////////////////////////////////////
 +/// \internal
 +/////////////////////////////////////////////////////////////////
 +class TSetElementNumberingEvent: public SALOME_Event
  {
 -  SALOMEDS::SObject_var aGeomShapeSO = KERNEL::getStudyServant()->FindObjectID( theShapeEntry );
 -  SALOMEDS::SObject_var      aMeshSO = KERNEL::getStudyServant()->FindObjectID( theMeshEntry );
 +public:
 +  const char* myUid;
 +  bool myNumbering;
 +  int myViewUid;
 +
 +  TSetElementNumberingEvent( const char* uid, bool numbering, int viewUid )
 +    : myUid( uid ), myNumbering( numbering ), myViewUid( viewUid ) {}
  
 -  if(!aMeshSO->_is_nil() && !aGeomShapeSO->_is_nil()){
 -    SALOMEDS::SObject_var aSObject = myStudyBuilder->NewObjectToTag(aMeshSO, SMESH::Tag_RefOnShape);
 -    myStudyBuilder->Addreference(aSObject,aGeomShapeSO);
 -    aSObject->UnRegister();
 +  virtual void Execute()
 +  {
 +    SALOME_View* view = uid2wnd( myViewUid );
 +    SMESH_Actor* actor = actorFromView( view, myUid );
 +    if ( actor )
 +    {
 +      actor->SetCellsLabeled( myNumbering );
 +      if ( view )
 +      view->Repaint();
 +    }
    }
 -  if ( !aMeshSO->_is_nil() )      aMeshSO->UnRegister();
 -  if ( !aGeomShapeSO->_is_nil() ) aGeomShapeSO->UnRegister();
 +};
 +
 +/////////////////////////////////////////////////////////////////
 +/// \brief Switch elements numbering on/off.
 +/// \param uid Mesh object's study UID or IOR.
 +/// \param numbering \c true to switch elements numbering on;
 +///                  \c false otherwise.
 +/// \param viewUid View window UID (0 means currently active view
 +///                window); Default: 0.
 +/////////////////////////////////////////////////////////////////
 +void SMESH_Swig::setElementsNumbering(const char* uid, bool numbering, int viewUid)
 +{
 +  init();
 +
-   _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
++  _PTR(SObject) sobject = uid2object( uid );
 +  if ( sobject )
 +    ProcessVoidEvent( new TSetElementNumberingEvent( sobject->GetID().c_str(), numbering, viewUid ) );
  }
  
 +/////////////////////////////////////////////////////////////////
 +/// \internal
 +/////////////////////////////////////////////////////////////////
 +class TGetDisplayModeEvent: public SALOME_Event
 +{
 +public:
 +  typedef DisplayMode TResult;
 +  TResult myResult;
 +  const char* myUid;
 +  int myViewUid;
 +
 +  TGetDisplayModeEvent( const char* uid, int viewUid )
 +    : myResult( UndefinedMode ), myUid( uid ), myViewUid( viewUid ) {}
  
 -//===============================================================
 -void SMESH_Swig::SetHypothesis(const char* theMeshOrSubMeshEntry,
 -                               const char* theDomainEntry)
 +  virtual void Execute()
 +  {
 +    SALOME_View* view = uid2wnd( myViewUid );
 +    SMESH_Actor* actor = actorFromView( view, myUid );
 +    if ( actor )
 +      myResult = (DisplayMode)actor->GetRepresentation();
 +  }
 +};
 +
 +/////////////////////////////////////////////////////////////////
 +/// \brief Get mesh object's display mode.
 +/// \param uid Mesh object's study UID or IOR.
 +/// \param viewUid View window UID (0 means currently active view
 +///                window); Default: 0.
 +/// \return Display mode (UndefinedMode if actor isn't found).
 +/////////////////////////////////////////////////////////////////
 +DisplayMode SMESH_Swig::displayMode(const char* uid, int viewUid)
  {
 -  ::SetHypothesis(theMeshOrSubMeshEntry,
 -                  theDomainEntry,
 -                  myStudyBuilder);
 +  DisplayMode mode = UndefinedMode;
 +
 +  init();
 +
-   _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
++  _PTR(SObject) sobject = uid2object( uid );
 +  if ( sobject )
 +    mode = ProcessEvent( new TGetDisplayModeEvent( sobject->GetID().c_str(), viewUid ) );
 +
 +  return mode;
  }
  
 +/////////////////////////////////////////////////////////////////
 +/// \internal
 +/////////////////////////////////////////////////////////////////
 +class TSetDisplayModeEvent: public SALOME_Event
 +{
 +public:
 +  const char* myUid;
 +  DisplayMode myMode;
 +  int myViewUid;
 +
 +  TSetDisplayModeEvent( const char* uid, DisplayMode mode, int viewUid )
 +    : myUid( uid ), myMode( mode), myViewUid( viewUid ) {}
 +
 +  virtual void Execute()
 +  {
 +    SALOME_View* view = uid2wnd( myViewUid );
 +    SMESH_Actor* actor = actorFromView( view, myUid );
 +    if ( actor && myMode != UndefinedMode )
 +    {
 +      actor->SetRepresentation( myMode );
 +      if ( view )
 +      view->Repaint();
 +    }
 +  }
 +};
  
 -//===============================================================
 -void SMESH_Swig::SetAlgorithms(const char* theMeshOrSubMeshEntry,
 -                               const char* theDomainEntry)
 +/////////////////////////////////////////////////////////////////
 +/// \brief Set mesh object's display mode.
 +/// \param uid Mesh object's study UID or IOR.
 +/// \param mode Display mode.
 +/// \param viewUid View window UID (0 means currently active view
 +///                window); Default: 0.
 +/////////////////////////////////////////////////////////////////
 +void SMESH_Swig::setDisplayMode(const char* uid, DisplayMode mode, int viewUid)
  {
 -  ::SetAlgorithms(theMeshOrSubMeshEntry,
 -                  theDomainEntry,
 -                  myStudyBuilder);
 +  init();
 +
-   _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
++  _PTR(SObject) sobject = uid2object( uid );
 +  if ( sobject )
 +    ProcessVoidEvent( new TSetDisplayModeEvent( sobject->GetID().c_str(), mode, viewUid ) );
  }
  
 +/////////////////////////////////////////////////////////////////
 +/// \internal
 +/////////////////////////////////////////////////////////////////
 +class TGetShrinkModeEvent: public SALOME_Event
 +{
 +public:
 +  typedef bool TResult;
 +  TResult myResult;
 +  const char* myUid;
 +  int myViewUid;
  
 -//===============================================================
 -void
 -SMESH_Swig::UnSetHypothesis(const char* theDomainEntry)
 +  TGetShrinkModeEvent( const char* uid, int viewUid )
 +    : myResult( false ), myUid( uid ), myViewUid( viewUid ) {}
 +
 +  virtual void Execute()
 +  {
 +    SALOME_View* view = uid2wnd( myViewUid );
 +    SMESH_Actor* actor = actorFromView( view, myUid );
 +    if ( actor )
 +      myResult = actor->IsShrunk();
 +  }
 +};
 +
 +/////////////////////////////////////////////////////////////////
 +/// \brief Check if shrink mode is switched on.
 +/// \param uid Mesh object's study UID or IOR.
 +/// \param viewUid View window UID (0 means currently active view
 +///                window); Default: 0.
 +/// \return \c true if shrink mode is switched on;
 +///         \c false otherwise.
 +/////////////////////////////////////////////////////////////////
 +bool SMESH_Swig::shrinkMode(const char* uid, int viewUid)
  {
 -  SALOMEDS::SObject_var aDomainSO = KERNEL::getStudyServant()->FindObjectID(theDomainEntry);
 -  if(!aDomainSO->_is_nil())
 -    myStudyBuilder->RemoveObject(aDomainSO);
 +  bool shrinkMode = false;
 +
 +  init();
 +
-   _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
++  _PTR(SObject) sobject = uid2object( uid );
 +  if ( sobject )
 +    shrinkMode = ProcessEvent( new TGetShrinkModeEvent( sobject->GetID().c_str(), viewUid ) );
 +
 +  return shrinkMode;
  }
  
 -const char* SMESH_Swig::AddSubMesh(const char* theMeshEntry,
 -                                   const char* theSubMeshIOR,
 -                                   int theShapeType)
 -{
 -  SALOMEDS::SObject_var aMeshSO = KERNEL::getStudyServant()->FindObjectID(theMeshEntry);
 -  if(!aMeshSO->_is_nil()) {
 -    long aShapeTag;
 -    QString aSubMeshName;
 -    switch(theShapeType) {
 -    case TopAbs_SOLID:
 -      aShapeTag    = SMESH::Tag_SubMeshOnSolid;
 -      aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnSolid");
 -      break;
 -    case TopAbs_FACE:
 -      aShapeTag    = SMESH::Tag_SubMeshOnFace;
 -      aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnFace");
 -      break;
 -    case TopAbs_EDGE:
 -      aShapeTag    = SMESH::Tag_SubMeshOnEdge;
 -      aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnEdge");
 -      break;
 -    case TopAbs_VERTEX:
 -      aShapeTag    = SMESH::Tag_SubMeshOnVertex;
 -      aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnVertex");
 -      break;
 -    default:
 -      aShapeTag    = SMESH::Tag_SubMeshOnCompound;
 -      aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnCompound");
 -    }
 +/////////////////////////////////////////////////////////////////
 +/// \internal
 +/////////////////////////////////////////////////////////////////
 +class TSetShrinkModeEvent: public SALOME_Event
 +{
 +public:
 +  const char* myUid;
 +  bool myShrink;
 +  int myViewUid;
 +
 +  TSetShrinkModeEvent( const char* uid, bool shrink, int viewUid )
 +    : myUid( uid ), myShrink( shrink ), myViewUid( viewUid ) {}
  
 -    SALOMEDS::GenericAttribute_var anAttr;
 -    SALOMEDS::SObject_var aSubMeshesRoot;
 -    if ( !aMeshSO->FindSubObject( aShapeTag, aSubMeshesRoot ) )
 +  virtual void Execute()
 +  {
 +    SALOME_View* view = uid2wnd( myViewUid );
 +    SMESH_Actor* actor = actorFromView( view, myUid );
 +    if ( actor )
      {
 -      aSubMeshesRoot = myStudyBuilder->NewObjectToTag(aMeshSO,aShapeTag);
 -      anAttr = myStudyBuilder->FindOrCreateAttribute(aSubMeshesRoot,"AttributeName");
 -      SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
 -      aName->SetValue(aSubMeshName.toLatin1().data());
 -      aName->UnRegister();
 -      anAttr = myStudyBuilder->FindOrCreateAttribute(aSubMeshesRoot,"AttributeSelectable");
 -      SALOMEDS::AttributeSelectable_var aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr);
 -      aSelAttr->SetSelectable(false);
 -      aSelAttr->UnRegister();
 +      if ( myShrink )
 +      actor->SetShrink();
 +      else
 +      actor->UnShrink();
 +      if ( view )
 +      view->Repaint();
      }
 -    aSubMeshesRoot->UnRegister();
 -    aMeshSO->UnRegister();
 +  }
 +};
  
 -    SALOMEDS::SObject_var aSObject = myStudyBuilder->NewObject(aSubMeshesRoot);
 -    anAttr = myStudyBuilder->FindOrCreateAttribute(aSObject,"AttributeIOR");
 -    SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
 -    anIOR->SetValue(theSubMeshIOR);
 -    anIOR->UnRegister();
 +/////////////////////////////////////////////////////////////////
 +/// \brief Switch shrink mode on/off.
 +/// \param uid Mesh object's study UID or IOR.
 +/// \param shrink \c true to switch shrink mode on;
 +///               \c false otherwise.
 +/// \param viewUid View window UID (0 means currently active view
 +///                window); Default: 0.
 +/////////////////////////////////////////////////////////////////
 +void SMESH_Swig::setShrinkMode(const char* uid, bool shrink, int viewUid)
 +{
 +  init();
  
-   _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
 -    CORBA::String_var aString = aSObject->GetID();
 -    aSObject->UnRegister();
++  _PTR(SObject) sobject = uid2object( uid );
 +  if ( sobject )
 +    ProcessVoidEvent( new TSetShrinkModeEvent( sobject->GetID().c_str(), shrink, viewUid ) );
 +}
  
 -    return aString._retn();
 +/////////////////////////////////////////////////////////////////
 +/// \internal
 +/////////////////////////////////////////////////////////////////
 +class TGetOpacityEvent: public SALOME_Event
 +{
 +public:
 +  typedef double TResult;
 +  TResult myResult;
 +  const char* myUid;
 +  int myViewUid;
 +
 +  TGetOpacityEvent( const char* uid, int viewUid )
 +    : myResult( 0 ), myUid( uid ), myViewUid( viewUid ) {}
 +
 +  virtual void Execute()
 +  {
 +    SALOME_View* view = uid2wnd( myViewUid );
 +    SMESH_Actor* actor = actorFromView( view, myUid );
 +    if ( actor )
 +      myResult = actor->GetOpacity();
    }
 +};
 +
 +/////////////////////////////////////////////////////////////////
 +/// \brief Get mesh object's opacity.
 +/// \param uid Mesh object's study UID or IOR.
 +/// \param viewUid View window UID (0 means currently active view
 +///                window); Default: 0.
 +/// \return Opacity value.
 +/////////////////////////////////////////////////////////////////
 +double SMESH_Swig::opacity(const char* uid, int viewUid)
 +{
 +  double opacity = 0;
 +
 +  init();
  
-   _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
 -  return "";
++  _PTR(SObject) sobject = uid2object( uid );
 +  if ( sobject )
 +    opacity = ProcessEvent( new TGetOpacityEvent( sobject->GetID().c_str(), viewUid ) );
 +
 +  return opacity;
  }
  
 -const char* SMESH_Swig::AddSubMeshOnShape(const char* theMeshEntry,
 -                                          const char* theGeomShapeEntry,
 -                                          const char* theSubMeshIOR,
 -                                          int         ShapeType)
 +/////////////////////////////////////////////////////////////////
 +/// \internal
 +/////////////////////////////////////////////////////////////////
 +class TSetOpacityEvent: public SALOME_Event
  {
 -  SALOMEDS::SObject_var aGeomShapeSO = KERNEL::getStudyServant()->FindObjectID(theGeomShapeEntry);
 -  if(!aGeomShapeSO->_is_nil())
 +public:
 +  const char* myUid;
 +  double myOpacity;
 +  int myViewUid;
 +
 +  TSetOpacityEvent( const char* uid, double opacity, int viewUid )
 +    : myUid( uid ), myOpacity( opacity ), myViewUid( viewUid ) {}
 +
 +  virtual void Execute()
    {
 -    const char *       aSubMeshEntry = AddSubMesh(theMeshEntry,theSubMeshIOR,ShapeType);
 -    SALOMEDS::SObject_var aSubMeshSO = KERNEL::getStudyServant()->FindObjectID(aSubMeshEntry);
 -    if ( !aSubMeshSO->_is_nil()) {
 -      SetShape( theGeomShapeEntry, aSubMeshEntry );
 -      CORBA::String_var aString = aSubMeshSO->GetID();
 -      aSubMeshSO->UnRegister();
 -      return aString._retn();
 +    SALOME_View* view = uid2wnd( myViewUid );
 +    SMESH_Actor* actor = actorFromView( view, myUid );
 +    if ( actor )
 +    {
 +      actor->SetOpacity( myOpacity );
 +      if ( view )
 +      view->Repaint();
      }
 -    aGeomShapeSO->UnRegister();
    }
 +};
  
 -  return "";
 -}
 +/////////////////////////////////////////////////////////////////
 +/// \brief Set mesh object's opacity.
 +/// \param uid Mesh object's study UID or IOR.
 +/// \param opacity Opacity value.
 +/// \param viewUid View window UID (0 means currently active view
 +///                window); Default: 0.
 +/////////////////////////////////////////////////////////////////
 +void SMESH_Swig::setOpacity(const char* uid, double opacity, int viewUid)
 +{
 +  init();
  
-   _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
 -/*!
 -  \brief Gets window with specified identifier
 -  \internal
 -  \param id window identifier
 -  \return pointer on the window
 -*/
 -
 -SUIT_ViewWindow* getWnd( const int id )
 -{
 -  SUIT_ViewWindow* resWnd = 0;
 -  SUIT_Session* aSession          = SUIT_Session::session();
 -  SUIT_Application* anApplication = aSession->activeApplication();
 -  SalomeApp_Application* app    = dynamic_cast<SalomeApp_Application*>(anApplication);
 -  if ( app ) {
 -    ViewManagerList vmlist = app->viewManagers();
 -    foreach( SUIT_ViewManager* vm, vmlist ) {
 -      QVector<SUIT_ViewWindow*> vwlist = vm->getViews();
 -      foreach ( SUIT_ViewWindow* vw, vwlist ) {
 -        if ( id == vw->getId() ) {
 -          resWnd = vw;
 -          break;
 -        }
 -      }
 -    }
 -  }
 -  return resWnd;
++  _PTR(SObject) sobject = uid2object( uid );
 +  if ( sobject )
 +    ProcessVoidEvent( new TSetOpacityEvent( sobject->GetID().c_str(), opacity, viewUid ) );
  }
  
 -class TGetActorAspect: public SALOME_Event
 +/////////////////////////////////////////////////////////////////
 +/// \internal
 +/////////////////////////////////////////////////////////////////
 +class TGetOrientationEvent: public SALOME_Event
  {
  public:
 -  typedef actorAspect TResult;
 +  typedef bool TResult;
    TResult myResult;
 -  const char* _entry;
 -  int _wid;
 -  TGetActorAspect( const char* Mesh_Entry, int viewId )
 +  const char* myUid;
 +  int myViewUid;
 +
 +  TGetOrientationEvent( const char* uid, int viewUid )
 +    : myResult( false ), myUid( uid ), myViewUid( viewUid ) {}
 +
 +  virtual void Execute()
    {
 -    _entry = Mesh_Entry;
 -    _wid = viewId;
 +    SALOME_View* view = uid2wnd( myViewUid );
 +    SMESH_Actor* actor = actorFromView( view, myUid );
 +    if ( actor )
 +      myResult = actor->GetFacesOriented();
    }
 -  virtual void Execute()
 -    {
 -      SMESH_Actor* anActor;
 -      if (_wid)
 -        {
 -          SUIT_ViewWindow* w = getWnd(_wid);
 -          anActor = SMESH::FindActorByEntry( w, _entry );
 -        }
 -      else
 -        anActor = SMESH::FindActorByEntry( _entry );
 -      if ( !anActor )
 -        {
 -          MESSAGE("GetActorAspect: no actor corresponding to: " << _entry);
 -          return;
 -        }
 -      anActor->GetSufaceColor(myResult.surfaceColor.r,
 -                              myResult.surfaceColor.g,
 -                              myResult.surfaceColor.b,
 -                              myResult.surfaceColor.delta);
 -      anActor->GetVolumeColor(myResult.volumeColor.r,
 -                              myResult.volumeColor.g,
 -                              myResult.volumeColor.b,
 -                              myResult.volumeColor.delta);
 -      anActor->GetEdgeColor(myResult.edgeColor.r,
 -                            myResult.edgeColor.g,
 -                            myResult.edgeColor.b);
 -      anActor->GetNodeColor(myResult.nodeColor.r,
 -                            myResult.nodeColor.g,
 -                            myResult.nodeColor.b);
 -      myResult.opacity= anActor->GetOpacity();
 -      MESSAGE("opacity: " << myResult.opacity);
 -    }
  };
  
 -actorAspect SMESH_Swig::GetActorAspect( const char* Mesh_Entry, int viewId )
 +/////////////////////////////////////////////////////////////////
 +/// \brief Check if faces orientation vectors are shown.
 +/// \param uid Mesh object's study UID or IOR.
 +/// \param viewUid View window UID (0 means currently active view
 +///                window); Default: 0.
 +/// \return \c true if faces orientation vectors are shown;
 +///         \c false otherwise.
 +/////////////////////////////////////////////////////////////////
 +bool SMESH_Swig::isOrientationShown(const char* uid, int viewUid)
  {
 -  return ProcessEvent(new TGetActorAspect( Mesh_Entry, viewId));
 +  bool shown = false;
 +
 +  init();
 +
-   _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
++  _PTR(SObject) sobject = uid2object( uid );
 +  if ( sobject )
 +    shown = ProcessEvent( new TGetOrientationEvent( sobject->GetID().c_str(), viewUid ) );
 +
 +  return shown;
  }
  
 -void SMESH_Swig::SetActorAspect( const actorAspect& actorPres, const char* Mesh_Entry, int viewId )
 +/////////////////////////////////////////////////////////////////
 +/// \internal
 +/////////////////////////////////////////////////////////////////
 +class TSetOrientationEvent: public SALOME_Event
  {
 -  class TSetActorAspect: public SALOME_Event
 +public:
 +  const char* myUid;
 +  bool myShown;
 +  int myViewUid;
 +
 +  TSetOrientationEvent( const char* uid, bool shown, int viewUid )
 +    : myUid( uid ), myShown( shown ), myViewUid( viewUid ) {}
 +
 +  virtual void Execute()
    {
 -  public:
 -    const char* _entry;
 -    actorAspect _actorPres;
 -    int _wid;
 -    TSetActorAspect(const actorAspect& actorPres, const char* Mesh_Entry, int viewId )
 +    SALOME_View* view = uid2wnd( myViewUid );
 +    SMESH_Actor* actor = actorFromView( view, myUid );
 +    if ( actor )
      {
 -      _entry = Mesh_Entry;
 -      _actorPres = actorPres;
 -      _wid = viewId;
 +      actor->SetFacesOriented( myShown );
 +      if ( view )
 +      view->Repaint();
      }
 -    virtual void Execute()
 -    {
 -      SMESH_Actor* anActor;
 -      if (_wid)
 -        {
 -          SUIT_ViewWindow* w = getWnd(_wid);
 -          anActor = SMESH::FindActorByEntry( w, _entry );
 -        }
 -      else
 -        anActor = SMESH::FindActorByEntry( _entry );
 -      if ( !anActor )
 -        {
 -          MESSAGE("SetActorAspect: no actor corresponding to: " << _entry);
 -          return;
 -        }
 -      anActor->SetSufaceColor(_actorPres.surfaceColor.r,
 -                              _actorPres.surfaceColor.g,
 -                              _actorPres.surfaceColor.b,
 -                              _actorPres.surfaceColor.delta);
 -      anActor->SetVolumeColor(_actorPres.volumeColor.r,
 -                              _actorPres.volumeColor.g,
 -                              _actorPres.volumeColor.b,
 -                              _actorPres.volumeColor.delta);
 -      anActor->SetEdgeColor(_actorPres.edgeColor.r,
 -                            _actorPres.edgeColor.g,
 -                            _actorPres.edgeColor.b);
 -      anActor->SetNodeColor(_actorPres.nodeColor.r,
 -                            _actorPres.nodeColor.g,
 -                            _actorPres.nodeColor.b);
 -      anActor->SetOpacity(_actorPres.opacity);
 -      if (_wid)
 -        {
 -          SUIT_ViewWindow* w = getWnd(_wid);
 -          w->repaint();
 -        }
 -      else
 -        {
 -          SUIT_Session* aSession          = SUIT_Session::session();
 -          SUIT_Application* anApplication = aSession->activeApplication();
 -          SalomeApp_Application* anApp    = dynamic_cast<SalomeApp_Application*>(anApplication);
 -          SUIT_ViewManager* vman          = anApp->getViewManager(VTKViewer_Viewer::Type(),true);
 -          vman->getActiveView()->repaint();
 -        }
 -    }
 -  };
 +  }
 +};
 +
 +/////////////////////////////////////////////////////////////////
 +/// \brief Show/hide faces orientation vectors.
 +/// \param uid Mesh object's study UID or IOR.
 +/// \param shown \c true to show faces orientation vectors;
 +///              \c false otherwise.
 +/// \param viewUid View window UID (0 means currently active view
 +///                window); Default: 0.
 +/////////////////////////////////////////////////////////////////
 +void SMESH_Swig::setOrientationShown(const char* uid, bool shown, int viewUid)
 +{
 +  init();
  
-   _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
 -  ProcessVoidEvent(new TSetActorAspect(actorPres, Mesh_Entry, viewId));
++  _PTR(SObject) sobject = uid2object( uid );
 +  if ( sobject )
 +    ProcessVoidEvent( new TSetOrientationEvent( sobject->GetID().c_str(), shown, viewUid ) );
  }
  
 -void SMESH_Swig::CreateAndDisplayActor( const char* Mesh_Entry )
 +/////////////////////////////////////////////////////////////////
 +/// \internal
 +/////////////////////////////////////////////////////////////////
 +class TGetEntitiesEvent: public SALOME_Event
  {
 -  //  SMESH_Actor* Mesh = smeshGUI->ReadScript(aM);
 -  class TEvent: public SALOME_Event
 +public:
 +  typedef int TResult;
 +  TResult myResult;
 +  const char* myUid;
 +  int myViewUid;
 +
 +  TGetEntitiesEvent( const char* uid, int viewUid )
 +    : myResult( EntityNone ), myUid( uid ), myViewUid( viewUid ) {}
 +
 +  virtual void Execute()
    {
 -  private:
 -    const char* _entry;
 -  public:
 -    TEvent(const char* Mesh_Entry) {
 -      _entry = Mesh_Entry;
 -    }
 -    virtual void Execute() {
 -      //SMESH::UpdateView(SMESH::eDisplay, _entry);
 -      SUIT_Session* aSession          = SUIT_Session::session();
 -      SUIT_Application* anApplication = aSession->activeApplication();
 -      SalomeApp_Application* anApp    = dynamic_cast<SalomeApp_Application*>(anApplication);
 -      /*SUIT_ViewManager* vman        = */anApp->getViewManager(VTKViewer_Viewer::Type(),true);
 -      SMESHGUI_Displayer* aDisp       = new SMESHGUI_Displayer(anApp);
 -      aDisp->Display(_entry,1);
 -    }
 -  };
 +    SALOME_View* view = uid2wnd( myViewUid );
 +    SMESH_Actor* actor = actorFromView( view, myUid );
 +    if ( actor )
 +      myResult = actor->GetEntityMode();
 +  }
 +};
 +
 +/////////////////////////////////////////////////////////////////
 +/// \brief Get mesh object's visible entities.
 +/// \param uid Mesh object's study UID or IOR.
 +/// \param viewUid View window UID (0 means currently active view
 +///                window); Default: 0.
 +/// \return Enumerator describing entities being visible.
 +/////////////////////////////////////////////////////////////////
 +int SMESH_Swig::entitiesShown(const char* uid, int viewUid)
 +{
 +  int entities = EntityNone;
 +
 +  init();
  
-   _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
 -  ProcessVoidEvent(new TEvent(Mesh_Entry));
++  _PTR(SObject) sobject = uid2object( uid );
 +  if ( sobject )
 +    entities = ProcessEvent( new TGetEntitiesEvent( sobject->GetID().c_str(), viewUid ) );
 +
 +  return entities;
  }
  
 -void SMESH_Swig::EraseActor( const char* Mesh_Entry, const bool allViewers )
 +/////////////////////////////////////////////////////////////////
 +/// \internal
 +/////////////////////////////////////////////////////////////////
 +class TSetEntitiesEvent: public SALOME_Event
  {
 -  class TEvent: public SALOME_Event
 +public:
 +  const char* myUid;
 +  int myEntities;
 +  int myViewUid;
 +
 +  TSetEntitiesEvent( const char* uid, int entities, int viewUid )
 +    : myUid( uid ), myEntities( entities ), myViewUid( viewUid ) {}
 +
 +  virtual void Execute()
    {
 -  private:
 -    const char* _entry;
 -    bool        _allViewers;
 -  public:
 -    TEvent(const char* Mesh_Entry, const bool allViewers ) {
 -      _entry = Mesh_Entry;
 -      _allViewers = allViewers;
 -    }
 -    virtual void Execute() {
 -      SUIT_Session* aSession          = SUIT_Session::session();
 -      SUIT_Application* anApplication = aSession->activeApplication();
 -      SalomeApp_Application* anApp    = dynamic_cast<SalomeApp_Application*>(anApplication);
 -      SMESHGUI_Displayer* aDisp       = new SMESHGUI_Displayer(anApp);
 -      ViewManagerList aManagers;
 -      if ( !_allViewers ) {
 -        aManagers << anApp->activeViewManager();
 -      }
 -      else {
 -        aManagers = anApp->viewManagers();
 -      }
 -      foreach( SUIT_ViewManager* aMgr, aManagers ) {
 -        if ( aMgr && aMgr->getType() == VTKViewer_Viewer::Type() ) {
 -          SALOME_View* aSalomeView = dynamic_cast<SALOME_View*>(aMgr->getViewModel());
 -          if (aSalomeView) {
 -            aDisp->Erase(_entry,true, true, aSalomeView);
 -          }
 -        }
 -      }
 +    SALOME_View* view = uid2wnd( myViewUid );
 +    SMESH_Actor* actor = actorFromView( view, myUid );
 +    if ( actor )
 +    {
 +      actor->SetEntityMode( myEntities );
 +      if ( view )
 +      view->Repaint();
      }
 -  };
 +  }
 +};
  
 -  ProcessVoidEvent(new TEvent(Mesh_Entry, allViewers));
 +/////////////////////////////////////////////////////////////////
 +/// \brief Set mesh object's visible entities.
 +/// \param uid Mesh object's study UID or IOR.
 +/// \param entities Enumerator describing entities to be shown.
 +/// \param viewUid View window UID (0 means currently active view
 +///                window); Default: 0.
 +/////////////////////////////////////////////////////////////////
 +void SMESH_Swig::setEntitiesShown(const char* uid, int entities, int viewUid)
 +{
 +  init();
 +
-   _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
++  _PTR(SObject) sobject = uid2object( uid );
 +  if ( sobject )
 +    ProcessVoidEvent( new TSetEntitiesEvent( sobject->GetID().c_str(), entities, viewUid ) );
  }
  
 -void SMESH_Swig::UpdateActor( const char* Mesh_Entry ) {
 -  class TEvent: public SALOME_Event
 +/////////////////////////////////////////////////////////////////
 +/// \brief Check if given mesh object's entity is shown.
 +/// \param uid Mesh object's study UID or IOR.
 +/// \param entity Mesh entity.
 +/// \param viewUid View window UID (0 means currently active view
 +///                window); Default: 0.
 +/// \return \c true if entity is shown; \c false otherwise.
 +/////////////////////////////////////////////////////////////////
 +bool SMESH_Swig::isEntityShown(const char* uid, EntityMode entity, int viewUid)
 +{
 +  bool shown = false;
 +
 +  init();
 +
-   _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
++  _PTR(SObject) sobject = uid2object( uid );
 +  if ( sobject )
    {
 -  private:
 -    const char* _entry;
 -  public:
 -    TEvent( const char* Mesh_Entry ) {
 -      _entry = Mesh_Entry;
 -    }
 -    virtual void Execute() {
 -      Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject
 -        ( _entry, "SMESH", "" );
 -      SMESH::Update( anIO, true );
 -    }
 -  };
 +    int entities = ProcessEvent( new TGetEntitiesEvent( sobject->GetID().c_str(), viewUid ) );
 +    shown = (bool)( entities & entity );
 +  }
  
 -  ProcessVoidEvent( new TEvent(Mesh_Entry) );
 +  return shown;
  }
  
 -void SMESH_Swig::SetName(const char* theEntry,
 -                         const char* theName)
 -{
 -  SALOMEDS::SObject_var aSObject = KERNEL::getStudyServant()->FindObjectID(theEntry);
 -  SALOMEDS::GenericAttribute_var anAttr;
 -  SALOMEDS::AttributeName_var aName;
 -  if(!aSObject->_is_nil()){
 -    anAttr = myStudyBuilder->FindOrCreateAttribute(aSObject,"AttributeName");
 -    aName = SALOMEDS::AttributeName::_narrow(anAttr);
 -    aName->SetValue(theName);
 -    aName->UnRegister();
 -    aSObject->UnRegister();
 +/////////////////////////////////////////////////////////////////
 +/// \brief Show/hide entity for given mesh object.
 +/// \param uid Mesh object's study UID or IOR.
 +/// \param entity Mesh entity.
 +/// \param show Visibility status.
 +/// \param viewUid View window UID (0 means currently active view
 +///                window); Default: 0.
 +/////////////////////////////////////////////////////////////////
 +void SMESH_Swig::setEntityShown(const char* uid, EntityMode entity, bool show, int viewUid)
 +{
 +  init();
 +
-   _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
++  _PTR(SObject) sobject = uid2object( uid );
 +  if ( sobject )
 +  {
 +    int entities = ProcessEvent( new TGetEntitiesEvent( sobject->GetID().c_str(), viewUid ) );
 +    if ( show )
 +      entities |= entity;
 +    else
 +      entities &= ~entity;
 +    ProcessVoidEvent( new TSetEntitiesEvent( sobject->GetID().c_str(), entities, viewUid ) );
    }
  }
  
 -//================================================================================
 -/*!
 - * \brief Set mesh icon according to compute status
 -  * \param Mesh_Entry - entry of a mesh
 -  * \param isComputed - is mesh computed or not
 - */
 -//================================================================================
 +/////////////////////////////////////////////////////////////////
 +/// \brief Initialize %SMESH GUI Python interface.
 +/// \deprecated Interface is initialized automatically.
- /// \param studyID Study UID (not used).
 +/////////////////////////////////////////////////////////////////
- void SMESH_Swig::Init(int /*studyID*/)
++void SMESH_Swig::Init()
 +{
 +  deprecated("SMESH_Swig::Init");
 +  // does nothing; initialization is done automatically.
 +}
  
 -void SMESH_Swig::SetMeshIcon(const char* theMeshEntry,
 -                             const bool  theIsComputed,
 -                             const bool  isEmpty)
 +/////////////////////////////////////////////////////////////////
 +/// \brief Publish mesh in the active study.
 +/// \deprecated Publishing is done automatically.
 +/// \param ior IOR of the mesh.
 +/// \param name Name of the mesh (optional).
 +/// \return UID of the data object.
 +/////////////////////////////////////////////////////////////////
 +const char* SMESH_Swig::AddNewMesh(const char* ior, const char* name)
  {
 -  class TEvent: public SALOME_Event
 -  {
 -    std::string         myMeshEntry;
 -    bool                myIsComputed, myIsEmpty;
 -  public:
 -    TEvent(const std::string&         theMeshEntry,
 -           const bool                 theIsComputed,
 -           const bool                 isEmpty):
 -      myMeshEntry (theMeshEntry),
 -      myIsComputed(theIsComputed),
 -      myIsEmpty   (isEmpty)
 -    {}
 -
 -    virtual
 -    void
 -    Execute()
 -    {
 -      SALOMEDS::SObject_ptr aMeshSO = KERNEL::getStudyServant()->FindObjectID(myMeshEntry.c_str());
 -      if(_PTR(SObject) aMesh = ClientFactory::SObject(aMeshSO))
 -        SMESH::ModifiedMesh(aMesh,myIsComputed,myIsEmpty);
 -      // aMeshSO->UnRegister();  ~aMesh() already called UnRegister()!
 -    }
 -  };
 +  deprecated("SMESH_Swig::AddNewMesh", "SMESH_Swig::publish");
 +  return publish( ior, name );
 +}
 +
 +/////////////////////////////////////////////////////////////////
 +/// \brief Publish hypothesis in the active study.
 +/// \deprecated Publishing is done automatically.
 +/// \param ior IOR of the hypothesis.
 +/// \param name Name of the hypothesis (optional).
 +/// \return UID of the data object.
 +/////////////////////////////////////////////////////////////////
 +const char* SMESH_Swig::AddNewHypothesis(const char* ior, const char* name)
 +{
 +  deprecated("SMESH_Swig::AddNewHypothesis", "SMESH_Swig::publish");
 +  return publish( ior, name );
 +}
 +
 +/////////////////////////////////////////////////////////////////
 +/// \brief Publish algorithm in the active study.
 +/// \deprecated Publishing is done automatically.
 +/// \param ior IOR of the algorithm.
 +/// \param name Name of the algorithm (optional).
 +/// \return UID of the data object.
 +/////////////////////////////////////////////////////////////////
 +const char* SMESH_Swig::AddNewAlgorithm(const char* ior, const char* name)
 +{
 +  deprecated("SMESH_Swig::AddNewAlgorithm", "SMESH_Swig::publish");
 +  return publish( ior, name );
 +}
 +
 +/////////////////////////////////////////////////////////////////
 +/// \deprecated Publishing is done automatically.
 +/// \deprecated Synonim of AddNewAlgorithm().
 +/// \param ior IOR of the algorithm.
 +/// \param name Name of the algorithm (optional).
 +/// \return UID of the data object.
 +/////////////////////////////////////////////////////////////////
 +const char* SMESH_Swig::AddNewAlgorithms(const char* ior, const char* name)
 +{
 +  deprecated("SMESH_Swig::AddNewAlgorithms", "SMESH_Swig::publish");
 +  return publish( ior, name );
 +}
 +
 +/////////////////////////////////////////////////////////////////
 +/// \brief Add reference on a shape for mesh in a study.
 +/// \deprecated Publishing is done automatically.
 +/// \param shapeUid GEOM shape's study UID (not used).
 +/// \param meshUid Mesh's study UID (not used).
 +/////////////////////////////////////////////////////////////////
 +void SMESH_Swig::SetShape(const char* /*shapeUid*/, const char* /*meshUid*/)
 +{
 +  deprecated("SMESH_Swig::SetShape", "SMESH_Swig::publish");
 +  // does nothing: publishing is done automatically
 +}
 +
 +/////////////////////////////////////////////////////////////////
 +/// \brief Assign hypothesis to mesh or sub-mesh.
 +/// \deprecated Publishing is done automatically.
 +/// \param meshUid Mesh's or sub-mesh's study UID (not used).
 +/// \param hypoUID Hypothesis's study UID (not used).
 +/////////////////////////////////////////////////////////////////
 +void SMESH_Swig::SetHypothesis(const char* /*meshUid*/, const char* /*hypoUID*/)
 +{
 +  deprecated("SMESH_Swig::SetHypothesis", "SMESH_Swig::publish");
 +  // does nothing: publishing is done automatically
 +}
 +
 +/////////////////////////////////////////////////////////////////
 +/// \brief Assign algorithm to mesh or sub-mesh.
 +/// \deprecated Publishing is done automatically.
 +/// \param meshUid Mesh's or sub-mesh's study UID (not used).
 +/// \param algoUID Algorithm's study UID (not used).
 +/////////////////////////////////////////////////////////////////
 +void SMESH_Swig::SetAlgorithms(const char* /*meshUid*/, const char* /*algoUID*/)
 +{
 +  deprecated("SMESH_Swig::SetAlgorithms", "SMESH_Swig::publish");
 +  // does nothing: publishing is done automatically
 +}
 +
 +/////////////////////////////////////////////////////////////////
 +/// \brief Anassign hypothesis or algorithm from mesh or sub-mesh.
 +/// \deprecated Unpublishing is done automatically.
 +/// \param uid Hypothesis's or algorithm's study UID (not used).
 +/////////////////////////////////////////////////////////////////
 +void SMESH_Swig::UnSetHypothesis(const char* /*uid*/)
 +{
 +  deprecated("SMESH_Swig::UnSetHypothesis");
 +  // does nothing: unpublishing is done automatically
 +}
 +
 +/////////////////////////////////////////////////////////////////
 +/// \brief Publish sub-mesh in the active study.
 +/// \deprecated Publishing is done automatically.
 +/// \param meshUid Parent mesh's study UID (not used).
 +/// \param ior IOR of the sub-mesh.
 +/// \param shapeType GEOM shape's type (not used).
 +/// \param name Name of the sub-mesh (optional).
 +/// \return UID of the data object.
 +/////////////////////////////////////////////////////////////////
 +const char* SMESH_Swig::AddSubMesh(const char* /*meshUid*/,
 +                                   const char* ior,
 +                                   int /*shapeType*/,
 +                                 const char* name)
 +{
 +  deprecated("SMESH_Swig::AddSubMesh", "SMESH_Swig::publish");
 +  return publish( ior, name );
 +}
 +
 +/////////////////////////////////////////////////////////////////
 +/// \brief Publish sub-mesh in the active study.
 +/// \deprecated Publishing is done automatically.
 +/// \param meshUid Parent mesh's study UID (not used).
 +/// \param shapeUid GEOM shape's study UID (not used).
 +/// \param ior IOR of the sub-mesh.
 +/// \param shapeType GEOM shape's type (not used).
 +/// \param name Name of the sub-mesh (optional).
 +/// \return UID of the data object.
 +/////////////////////////////////////////////////////////////////
 +const char* SMESH_Swig::AddSubMeshOnShape(const char* /*meshUid*/,
 +                                          const char* /*shapeUid*/,
 +                                          const char* ior,
 +                                          int /*shapeType*/,
 +                                        const char* name)
 +{
 +  deprecated("SMESH_Swig::AddSubMeshOnShape", "SMESH_Swig::publish");
 +  return publish( ior, name );
 +}
  
 -  ProcessVoidEvent(new TEvent(theMeshEntry,
 -                              theIsComputed,
 -                              isEmpty));
 +/////////////////////////////////////////////////////////////////
 +/// \brief Set new study name of given object.
 +/// \deprecated Use rename() method.
 +/// \param uid Object's study UID or IOR.
 +/// \param name New name of the object.
 +/////////////////////////////////////////////////////////////////
 +void SMESH_Swig::SetName(const char* uid, const char* name)
 +{
 +  deprecated("SMESH_Swig::SetName", "SMESH_Swig::rename");
 +  rename( uid, name );
  }
  
 -/*!
 -  \brief Helper class for selection event.
 -*/
 +/////////////////////////////////////////////////////////////////
 +/// \brief Set mesh icon according to compute status
 +/// \deprecated Publishing is done automatically.
 +/// \param meshUid Mesh's study UID (not used).
 +/// \param isComputed Flag pointing that mesh is computed or no
 +///        (not used).
 +/// \param isEmpty Flag pointing that mesh is empty or no
 +///        (not used).
 +/////////////////////////////////////////////////////////////////
 +void SMESH_Swig::SetMeshIcon(const char* /*meshUid*/,
 +                             const bool /*isComputed*/,
 +                             const bool /*isEmpty*/)
 +{
 +  deprecated("SMESH_Swig::SetMeshIcon", "SMESH_Swig::publish");
 +  // does nothing: publishing is done automatically
 +}
 +
 +/////////////////////////////////////////////////////////////////
 +/// Display mesh in the currently active view window.
 +/// \deprecated Use display() method.
 +/// \param meshUid Mesh's study UID.
 +/////////////////////////////////////////////////////////////////
 +void SMESH_Swig::CreateAndDisplayActor(const char* meshUid)
 +{
 +  deprecated("SMESH_Swig::CreateAndDisplayActor", "SMESH_Swig::display");
 +  display( meshUid );
 +}
 +
 +/////////////////////////////////////////////////////////////////
 +/// Erase mesh in the view window(s).
 +/// \deprecated Use erase() method.
 +/// \param meshUid Mesh's study UID.
 +/// \param allViewers If \c true, mesh is removed from all views.
 +///                   Default: \c false.
 +/////////////////////////////////////////////////////////////////
 +void SMESH_Swig::EraseActor(const char* meshUid, const bool allViewers)
 +{
 +  deprecated("SMESH_Swig::EraseActor", "SMESH_Swig::erase");
 +  erase( meshUid, allViewers ? -1 : 0 );
 +}
 +
 +/////////////////////////////////////////////////////////////////
 +/// Update mesh object.
 +/// \deprecated Use update() method.
 +/// \param meshUid Mesh's study UID.
 +/////////////////////////////////////////////////////////////////
 +void SMESH_Swig::UpdateActor(const char* meshUid)
 +{
 +  deprecated("SMESH_Swig::UpdateActor", "SMESH_Swig::update");
 +  update( meshUid );
 +}
 +
 +/////////////////////////////////////////////////////////////////
 +/// Get mesh object's properties.
 +/// \deprecated Use properties() method.
 +/// \param meshUid Mesh's study UID.
 +/// \param viewUid View window UID (0 means currently active view
 +///                window). Default: 0.
 +/////////////////////////////////////////////////////////////////
 +actorAspect SMESH_Swig::GetActorAspect(const char* meshUid, int viewUid)
 +{
 +  deprecated("SMESH_Swig::GetActorAspect", "SMESH_Swig::properties");
 +  return properties( meshUid, viewUid );
 +}
 +
 +/////////////////////////////////////////////////////////////////
 +/// Set mesh object's properties.
 +/// \deprecated Use setProperties() method.
 +/// \param meshUid Mesh's study UID.
 +/// \param viewUid View window UID (0 means currently active view
 +///                window). Default: 0.
 +/////////////////////////////////////////////////////////////////
 +void SMESH_Swig::SetActorAspect(const actorAspect& aspect, const char* meshUid, int viewUid)
 +{
 +  deprecated("SMESH_Swig::SetActorAspect", "SMESH_Swig::setProperties");
 +  setProperties( meshUid, aspect, viewUid );
 +}
 +
 +/////////////////////////////////////////////////////////////////
 +/// \internal
 +/////////////////////////////////////////////////////////////////
  class TSelectListEvent: public SALOME_Event
  {
 -  const char*       myId;
 -  std::vector<int>  myIdsList;
 -  bool              myIsAppend;
 +  const char* myUid;
 +  std::vector<int> myIds;
 +  bool myIsAppend;
  
  public:
 -  TSelectListEvent(const char* id, std::vector<int> ids, bool append) :
 -    myId(id),
 -    myIdsList(ids),
 -    myIsAppend(append)
 +  TSelectListEvent(const char* uid, std::vector<int> ids, bool append)
 +    : myUid( uid ), myIds( ids ), myIsAppend( append )
    {}
 +
    virtual void Execute()
    {
 -    
      LightApp_SelectionMgr* selMgr = 0;
 -    SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
 -    if( anApp )
 -      selMgr = dynamic_cast<LightApp_SelectionMgr*>( anApp->selectionMgr() );
 +    SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
 +    if ( app )
 +      selMgr = dynamic_cast<LightApp_SelectionMgr*>( app->selectionMgr() );
  
 -    if( !selMgr )
 +    if ( !selMgr )
        return;
      
      selMgr->clearFilters();
  
 -    SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow();
 -    if(!aViewWindow)
 +    SVTK_ViewWindow* vw = SMESH::GetViewWindow();
 +    if ( !vw )
        return;
  
 -    SMESH_Actor* anActor = SMESH::FindActorByEntry( myId );
 +    SMESH_Actor* actor = SMESH::FindActorByEntry( myUid );
      
 -    if (!anActor || !anActor->hasIO())
 +    if ( !actor || !actor->hasIO() )
        return;
      
 -    Handle(SALOME_InteractiveObject) anIO = anActor->getIO();
 -    SALOME_ListIO aList;
 -    aList.Append(anIO);
 -    selMgr->setSelectedObjects(aList, false);
 +    Handle(SALOME_InteractiveObject) io = actor->getIO();
 +    SALOME_ListIO ios;
 +    ios.Append( io );
 +    selMgr->setSelectedObjects( ios, false );
  
 -    if ( aViewWindow->SelectionMode() ==  ActorSelection ) {
 +    if ( vw->SelectionMode() == ActorSelection )
        return;
 -    }
          
 -    TColStd_MapOfInteger aMap;
 -    std::vector<int>::const_iterator anIter;
 -    for (anIter = myIdsList.begin(); anIter != myIdsList.end(); ++anIter) {
 -      aMap.Add(*anIter);
 +    TColStd_MapOfInteger idMap;
 +    std::vector<int>::const_iterator it;
 +    for ( it = myIds.begin(); it != myIds.end(); ++it )
 +    {
 +      idMap.Add( *it );
      }
  
      // Set new selection
 -    SVTK_Selector* aSelector  = aViewWindow->GetSelector();
 -    aSelector->AddOrRemoveIndex(anIO, aMap, myIsAppend);
 -    aViewWindow->highlight( anIO, true, true );
 -    aViewWindow->GetInteractor()->onEmitSelectionChanged();
 +    SVTK_Selector* selector = vw->GetSelector();
 +    selector->AddOrRemoveIndex( io, idMap, myIsAppend );
 +    vw->highlight( io, true, true );
 +    vw->GetInteractor()->onEmitSelectionChanged();
    }
  };
  
 -/*!
 -  \brief Select the elements on the mesh, sub-mesh or group.
 -  \param id object entry
 -  \param ids list of the element ids
 -  \param mode selection mode
 -*/
 -void SMESH_Swig::select( const char* id, std::vector<int> ids, bool append ) {
 -  ProcessVoidEvent( new TSelectListEvent( id, ids, append ) );
 +/////////////////////////////////////////////////////////////////
 +/// \brief Select elements of the mesh, sub-mesh or group.
 +/// \param uid Mesh object's study UID or IOR.
 +/// \param ids List of mesh elements.
 +/// \param append If \c true, elements are added to current
 +///               selection; otherwise, previous selection is
 +///               cleared.
 +/////////////////////////////////////////////////////////////////
 +void SMESH_Swig::select(const char* uid, std::vector<int> ids, bool append)
 +{
 +  init();
 +
-   _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
++  _PTR(SObject) sobject = uid2object( uid );
 +  if ( sobject )
 +    ProcessVoidEvent( new TSelectListEvent( sobject->GetID().c_str(), ids, append ) );
  }
    
 -/*!
 -  \brief Select the elements on the mesh, sub-mesh or group.
 -  \param id object entry
 -  \param id id of the element
 -  \param mode selection mode
 -*/
 -void SMESH_Swig::select( const char* id, int id1, bool append ) {
 +/////////////////////////////////////////////////////////////////
 +/// \brief Select element of the mesh, sub-mesh or group.
 +/// \param uid Mesh object's study UID or IOR.
 +/// \param id Mesh element.
 +/// \param append If \c true, element is added to current
 +///               selection; otherwise, previous selection is
 +///               cleared.
 +/////////////////////////////////////////////////////////////////
 +void SMESH_Swig::select(const char* uid, int id, bool append)
 +{
 +  init();
 +
    std::vector<int> ids;
 -  ids.push_back( id1 );
 -  ProcessVoidEvent( new TSelectListEvent( id, ids, append ) );
 +  ids.push_back( id );
 +
-   _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
++  _PTR(SObject) sobject = uid2object( uid );
 +  if ( sobject )
 +    ProcessVoidEvent( new TSelectListEvent( sobject->GetID().c_str(), ids, append ) );
  }
  
 -/*!
 -  \brief Helper class for selection edges of cell event
 -*/
 +/////////////////////////////////////////////////////////////////
 +/// \internal
 +/////////////////////////////////////////////////////////////////
  class TSelectListOfPairEvent: public SALOME_Event
  {
 -  const char*                        myId;
 -  std::vector<std::pair<int, int> >  myIdsList;
 -  bool                               myIsAppend;
 +  const char* myUid;
 +  std::vector<std::pair<int, int> > myIds;
 +  bool myIsAppend;
  
  public:
 -  TSelectListOfPairEvent(const char* id, std::vector<std::pair<int, int> > ids, bool append) :
 -    myId(id),
 -    myIdsList(ids),
 -    myIsAppend(append)
 +  TSelectListOfPairEvent(const char* uid, std::vector<std::pair<int, int> > ids, bool append)
 +    : myUid( uid ), myIds( ids ), myIsAppend( append )
    {}
 +
    virtual void Execute()
    {
 -    
      LightApp_SelectionMgr* selMgr = 0;
 -    SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
 -    if( anApp )
 -      selMgr = dynamic_cast<LightApp_SelectionMgr*>( anApp->selectionMgr() );
 +    SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
 +    if ( app )
 +      selMgr = dynamic_cast<LightApp_SelectionMgr*>( app->selectionMgr() );
  
 -    if( !selMgr )
 +    if ( !selMgr )
        return;
      
      selMgr->clearFilters();
  
 -    SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow();
 -    if(!aViewWindow)
 +    SVTK_ViewWindow* vw = SMESH::GetViewWindow();
 +    if ( !vw )
        return;
  
 -    SMESH_Actor* anActor = SMESH::FindActorByEntry( myId );
 +    SMESH_Actor* actor = SMESH::FindActorByEntry( myUid );
      
 -    if (!anActor || !anActor->hasIO())
 +    if ( !actor || !actor->hasIO() )
        return;
      
 -    Handle(SALOME_InteractiveObject) anIO = anActor->getIO();
 -    SALOME_ListIO aList;
 -    aList.Append(anIO);
 -    selMgr->setSelectedObjects(aList, false);
 +    Handle(SALOME_InteractiveObject) io = actor->getIO();
 +    SALOME_ListIO ios;
 +    ios.Append( io );
 +    selMgr->setSelectedObjects( ios, false );
  
 -    if ( aViewWindow->SelectionMode() !=  EdgeOfCellSelection ) {
 +    if ( vw->SelectionMode() != EdgeOfCellSelection )
        return;
 -    }
          
 -    SVTK_IndexedMapOfIds aMap;
 -    std::vector<std::pair<int, int> >::const_iterator anIter;
 -    for (anIter = myIdsList.begin(); anIter != myIdsList.end(); ++anIter) {
 -      std::vector<int> aCompositeId;
 -      aCompositeId.push_back((*anIter).first);
 -      aCompositeId.push_back((*anIter).second);
 -      aMap.Add(aCompositeId);
 +    SVTK_IndexedMapOfIds idMap;
 +    std::vector<std::pair<int, int> >::const_iterator it;
 +    for ( it = myIds.begin(); it != myIds.end(); ++it )
 +    {
 +      std::vector<int> pair;
 +      pair.push_back( (*it).first );
 +      pair.push_back( (*it).second );
 +      idMap.Add( pair );
      }
  
      // Set new selection
 -    SVTK_Selector* aSelector  = aViewWindow->GetSelector();
 -    aSelector->AddOrRemoveCompositeIndex(anIO, aMap, myIsAppend);
 -    aViewWindow->highlight( anIO, true, true );
 -    aViewWindow->GetInteractor()->onEmitSelectionChanged();
 +    SVTK_Selector* selector = vw->GetSelector();
 +    selector->AddOrRemoveCompositeIndex( io, idMap, myIsAppend );
 +    vw->highlight( io, true, true );
 +    vw->GetInteractor()->onEmitSelectionChanged();
    }
  };
  
 -/*!
 -  \brief Select the elements on the mesh, sub-mesh or group.
 -  \param id object entry
 -  \param ids list of the element ids
 -  \param mode selection mode
 -*/
 -void SMESH_Swig::select( const char* id, std::vector<std::pair<int,int> > ids, bool append ) {
 -  ProcessVoidEvent( new TSelectListOfPairEvent( id, ids, append ) );
 +/////////////////////////////////////////////////////////////////
 +/// \brief Select pseudo-edges (specified by two nodes)
 +///        of the mesh, sub-mesh or group.
 +/// \param uid Mesh object's study UID or IOR.
 +/// \param ids List of pairs containing two nodes IDs.
 +/// \param append If \c true, pseudo-edges are added to current
 +///               selection; otherwise, previous selection is
 +///               cleared.
 +/////////////////////////////////////////////////////////////////
 +void SMESH_Swig::select(const char* uid, std::vector<std::pair<int,int> > ids, bool append)
 +{
 +  init();
 +
-   _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
++  _PTR(SObject) sobject = uid2object( uid );
 +  if ( sobject )
 +    ProcessVoidEvent( new TSelectListOfPairEvent( sobject->GetID().c_str(), ids, append ) );
  }
  
 -class TGetSelectionModeEvent : public SALOME_Event
 +/////////////////////////////////////////////////////////////////
 +/// \internal
 +/////////////////////////////////////////////////////////////////
 +class TGetSelectionModeEvent: public SALOME_Event
  {
  public:
    typedef SelectionMode TResult;
    TResult myResult;
 -  TGetSelectionModeEvent() : myResult( Undefined ) {}
 +  int myViewUid;
 +
 +  TGetSelectionModeEvent( int viewUid ) :
 +    myResult( Undefined ), myViewUid( viewUid ) {}
 +
    virtual void Execute()
    {
 -    SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( );
 -    if(!aViewWindow)
 -      return;
 -    
 -    myResult = (SelectionMode) aViewWindow->SelectionMode();
 +    SVTK_Viewer* model = dynamic_cast<SVTK_Viewer*>( uid2wnd( myViewUid ) );
 +    if ( model )
 +    {
 +      SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>( model->getViewManager()->getActiveView() );
 +      if ( vw )
 +      myResult = (SelectionMode)vw->SelectionMode();
 +    }
    }
  };
  
 -/*!
 -  \brief Get selection mode of the active VTK View window.
 -*/
 -SelectionMode SMESH_Swig::getSelectionMode() {
 -  return ProcessEvent( new TGetSelectionModeEvent() );
 +/////////////////////////////////////////////////////////////////
 +/// \brief Get selection mode of view window.
 +/// \param viewUid View window UID (0 means currently active view
 +///                window); Default: 0.
 +/// \return Current selection mode.
 +/////////////////////////////////////////////////////////////////
 +SelectionMode SMESH_Swig::getSelectionMode(int viewUid)
 +{
 +  init();
 +  return ProcessEvent( new TGetSelectionModeEvent( viewUid ) );
  }
  
 -
 -/*!
 - * Event to set selection mode
 -*/
 -class TSetSelectionModeEvent : public SALOME_Event
 +/////////////////////////////////////////////////////////////////
 +/// \internal
 +/////////////////////////////////////////////////////////////////
 +class TSetSelectionModeEvent: public SALOME_Event
  {
    SelectionMode mySelectionMode;
 +  int myViewUid;
  
  public:
 -
 -  TSetSelectionModeEvent(const SelectionMode selectionMode) :
 -    mySelectionMode(selectionMode) 
 +  TSetSelectionModeEvent( const SelectionMode selectionMode, int viewUid )
 +    : mySelectionMode( selectionMode ), myViewUid( viewUid )
    {}
  
    virtual void Execute()
    {
 -    SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow();
 -    if(!aViewWindow)
 -      return;
 -
 -    Selection_Mode prevMode = aViewWindow->SelectionMode();
 -    bool changePointRepresentation = ( prevMode == NodeSelection && mySelectionMode != Node ) ||
 -      (prevMode != NodeSelection && mySelectionMode == Node);
 -      
 -    if( changePointRepresentation ) {
 -      vtkRenderer *aRenderer = aViewWindow->getRenderer();
 -      VTK::ActorCollectionCopy aCopy(aRenderer->GetActors());
 -      vtkActorCollection *aCollection = aCopy.GetActors();
 -      aCollection->InitTraversal();
 -      while(vtkActor *anAct = aCollection->GetNextActor()){
 -      if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
 -        if(anActor->GetVisibility()){
 -          anActor->SetPointRepresentation(mySelectionMode == Node);
 +    SVTK_Viewer* model = dynamic_cast<SVTK_Viewer*>( uid2wnd( myViewUid ) );
 +    if ( model )
 +    {
 +      SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>( model->getViewManager()->getActiveView() );
 +      if ( vw )
 +      {
 +      SelectionMode previousMode = (SelectionMode)vw->SelectionMode();
 +      bool switchPointMode = ( previousMode == Node && mySelectionMode != Node ) ||
 +        ( previousMode != Node && mySelectionMode == Node );
 +      if ( switchPointMode )
 +      {
 +        vtkRenderer* renderer = vw->getRenderer();
 +        VTK::ActorCollectionCopy actors( renderer->GetActors() );
 +        vtkActorCollection* collection = actors.GetActors();
 +        collection->InitTraversal();
 +        while ( vtkActor* vtkActor = collection->GetNextActor() )
 +        {
 +          if ( SMESH_Actor* actor = dynamic_cast<SMESH_Actor*>( vtkActor ) )
 +          {
 +            if ( actor->GetVisibility() )
 +              actor->SetPointRepresentation( mySelectionMode == Node );
 +          }
          }
        }
 +      vw->SetSelectionMode( mySelectionMode );
        }
      }
 -    aViewWindow->SetSelectionMode(mySelectionMode);
    }
  };
  
 -void SMESH_Swig::setSelectionMode(SelectionMode selectionMode){
 -  ProcessVoidEvent( new TSetSelectionModeEvent( selectionMode ) ); 
 +/////////////////////////////////////////////////////////////////
 +/// \brief Set selection mode to view window.
 +/// \param viewUid View window UID (0 means currently active view
 +///                window); Default: 0.
 +/// \param mode Selection mode.
 +/////////////////////////////////////////////////////////////////
 +void SMESH_Swig::setSelectionMode(SelectionMode mode, int viewUid)
 +{
 +  init();
 +  ProcessVoidEvent( new TSetSelectionModeEvent( mode, viewUid ) ); 
  }
  
 -class TGetSelectedEvent : public SALOME_Event
 +/////////////////////////////////////////////////////////////////
 +/// \internal
 +/////////////////////////////////////////////////////////////////
 +class TGetSelectedEvent: public SALOME_Event
  {
  public:
    typedef std::vector<int> TResult;
    TResult myResult;
 -  const char* myId;
 +  const char* myUid;
    
 -  TGetSelectedEvent( const char* id) : 
 -    myResult( std::vector<int>() ),
 -    myId(id)
 -  {}
 +  TGetSelectedEvent( const char* uid )
 +    : myUid( uid ) {}
    
    virtual void Execute()
    {
 -    SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow();
 -    if( !aViewWindow )
 +    SVTK_ViewWindow* vw = SMESH::GetViewWindow();
 +    if ( !vw )
        return;
  
 -    SVTK_Selector* aSelector  = aViewWindow->GetSelector();    
 -    if( !aSelector )
 +    SVTK_Selector* selector = vw->GetSelector();    
 +    if ( !selector )
        return;
  
 -    SMESH_Actor* anActor = SMESH::FindActorByEntry( myId );
 -    
 -    if ( !anActor || !anActor->hasIO() )
 +    SMESH_Actor* actor = SMESH::FindActorByEntry( myUid );
 +    if ( !actor || !actor->hasIO() )
        return;
  
 -    TColStd_IndexedMapOfInteger aMapIndex;
 -    aSelector->GetIndex(anActor->getIO(),aMapIndex);
 +    TColStd_IndexedMapOfInteger idMap;
 +    selector->GetIndex( actor->getIO(), idMap );
  
 -    for( int i = 1; i <= aMapIndex.Extent(); i++ )
 -      myResult.push_back( aMapIndex( i ) );
 +    for ( int i = 1; i <= idMap.Extent(); i++ )
 +      myResult.push_back( idMap( i ) );
    }
  };
  
 -std::vector<int> SMESH_Swig::getSelected( const char* Mesh_Entry ) {
 -  return ProcessEvent( new TGetSelectedEvent(Mesh_Entry) );
 +/////////////////////////////////////////////////////////////////
 +/// \brief Get selected elements of the mesh, sub-mesh or group.
 +/// \param uid Mesh object's study UID or IOR.
 +/// \return List of selected mesh elements.
 +/////////////////////////////////////////////////////////////////
 +std::vector<int> SMESH_Swig::getSelected(const char* uid)
 +{
 +  std::vector<int> ids;
 +
 +  init();
 +
-   _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
++  _PTR(SObject) sobject = uid2object( uid );
 +  if ( sobject )
 +    ids = ProcessEvent( new TGetSelectedEvent( sobject->GetID().c_str() ) );
 +
 +  return ids;
  }
  
 +/////////////////////////////////////////////////////////////////
 +/// \internal
 +/////////////////////////////////////////////////////////////////
  class TGetSelectedPairEvent : public SALOME_Event
  {
  public:
    typedef std::vector<std::pair<int, int> > TResult;
    TResult myResult;
 -  const char* myId;
 +  const char* myUid;
    
 -  TGetSelectedPairEvent( const char* id) : 
 -    myResult( std::vector<std::pair<int,int> >() ),
 -    myId(id)
 -  {}
 +  TGetSelectedPairEvent( const char* uid )
 +    :  myUid( uid ) {}
    
    virtual void Execute()
    {
 -    SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow();
 -    if( !aViewWindow )
 +    SVTK_ViewWindow* vw = SMESH::GetViewWindow();
 +    if ( !vw )
        return;
  
 -    if(aViewWindow->SelectionMode() != EdgeOfCellSelection )
 +    if ( vw->SelectionMode() != EdgeOfCellSelection )
        return;
  
 -    SVTK_Selector* aSelector  = aViewWindow->GetSelector();    
 -    if( !aSelector )
 +    SVTK_Selector* selector = vw->GetSelector();    
 +    if ( !selector )
        return;
  
 -    SMESH_Actor* anActor = SMESH::FindActorByEntry( myId );
 -    
 -    if ( !anActor || !anActor->hasIO() )
 +    SMESH_Actor* actor = SMESH::FindActorByEntry( myUid );
 +    if ( !actor || !actor->hasIO() )
        return;
  
 -    SVTK_IndexedMapOfIds aMapIndex;
 -    aSelector->GetCompositeIndex(anActor->getIO(),aMapIndex);
 +    SVTK_IndexedMapOfIds idMap;
 +    selector->GetCompositeIndex( actor->getIO(), idMap );
  
 -    for( int i = 1; i <= aMapIndex.Extent(); i++ )
 -      myResult.push_back( std::make_pair<int,int>( (int)aMapIndex( i )[0], (int)aMapIndex( i )[1]) );
 +    for ( int i = 1; i <= idMap.Extent(); i++ )
 +      myResult.push_back( std::make_pair<int,int>( (int)idMap( i )[0], (int)idMap( i )[1]) );
    }
  };
  
 -std::vector<std::pair<int,int> > SMESH_Swig::getSelectedEdgeOfCell( const char* Mesh_Entry ) {
 -  return ProcessEvent( new TGetSelectedPairEvent(Mesh_Entry) );
 -}
 +/////////////////////////////////////////////////////////////////
 +/// \brief Get selected pseudo-edges (specified by two nodes)
 +///        of the mesh, sub-mesh or group.
 +/// \param uid Mesh object's study UID or IOR.
 +/// \param ids List of pairs containing two nodes IDs.
 +/// \param append If \c true, pseudo-edges are added to current
 +///               selection; otherwise, previous selection is
 +///               cleared.
 +/////////////////////////////////////////////////////////////////
 +std::vector<std::pair<int,int> > SMESH_Swig::getSelectedEdgeOfCell(const char* uid)
 +{
 +  std::vector<std::pair<int,int> > pairs;
  
-   _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
 +  init();
 +
++  _PTR(SObject) sobject = uid2object( uid );
 +  if ( sobject )
 +    pairs = ProcessEvent( new TGetSelectedPairEvent( sobject->GetID().c_str() ) );
 +
 +  return pairs;
 +}
index 24482f280655ba4bd23b2ab2804f6019334dceac,fa564efa402ea2ba3e08771af5afe4f11eac62fb..89307c0966befa7afb591217c7d42cc4bb308791
  // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
 -// SMESH SMESH : GUI for SMESH component
 -// File   : libSMESH_Swig.h
 -// Author : Nicolas REJNERI, Open CASCADE S.A.S.
 -//
  #ifndef LIBSMESH_SWIG_H
  #define LIBSMESH_SWIG_H
  
  #ifdef WIN32
  #if defined SMESH_SWIG_EXPORTS || defined _libSMESH_Swig_EXPORTS
 -  #define SMESH_SWIG_EXPORT __declspec( dllexport )
 +  #define SMESH_SWIG_EXPORT __declspec(dllexport)
   #else
 -  #define SMESH_SWIG_EXPORT __declspec( dllimport )
 +  #define SMESH_SWIG_EXPORT __declspec(dllimport)
   #endif
  #else
   #define SMESH_SWIG_EXPORT
  #endif
  
 -// IDL includes
 -#include <SALOMEconfig.h>
 -#include CORBA_SERVER_HEADER(SALOMEDS)
 -
 -//std includes
 -#include <vector>
 -#include <utility>
 -
 -#include <SVTK_Selection.h>
 -
  #include <SVTK_Selection.h>
 +#include <vector>
  
 +// See SMESH_Actor.h
  typedef enum
 -  {
 -    Undefined  = -1,
 -    Node       = NodeSelection,
 -    Cell       = CellSelection,
 -    EdgeOfCell = EdgeOfCellSelection,
 -    Edge       = EdgeSelection,
 -    Face       = FaceSelection,
 -    Volume     = VolumeSelection,
 -    Actor      = ActorSelection,
 -    Elem0D     = Elem0DSelection,
 -    Ball       = BallSelection
 -  } SelectionMode;
 -
 -typedef struct
  {
 -  double r, g, b;
 -  int delta;
 -} surfaceColorStruct;
 -
 -typedef struct
 +  EntityNone    = 0x00,
 +  Entity0d      = 0x01,   // SMESH_Actor::e0DElements
 +  EntityEdges   = 0x02,   // SMESH_Actor::eEdges
 +  EntityFaces   = 0x04,   // SMESH_Actor::eFaces
 +  EntityVolumes = 0x08,   // SMESH_Actor::eVolumes
 +  EntityBalls   = 0x10,   // SMESH_Actor::eBallElem
 +  EntityAll     = 0xff    // SMESH_Actor::eAllEntity
 +} EntityMode;
 +
 +// See SVTK_Selection.h
 +typedef enum
  {
 -  double r, g, b;
 -  int delta;
 -} volumeColorStruct;
 +  Undefined  = -1,
 +  Node       = NodeSelection,
 +  Cell       = CellSelection,
 +  EdgeOfCell = EdgeOfCellSelection,
 +  Edge       = EdgeSelection,
 +  Face       = FaceSelection,
 +  Volume     = VolumeSelection,
 +  Actor      = ActorSelection,
 +  Elem0D     = Elem0DSelection,
 +  Ball       = BallSelection
 +} SelectionMode;
 +
 +// See SMESH_Actor.h
 +typedef enum
 +{
 +  UndefinedMode = -1,
 +  PointMode = 0,      // SMESH_Actor::ePoint
 +  EdgeMode,           // SMESH_Actor::eEdge
 +  SurfaceMode         // SMESH_Actor::eSurface
 +} DisplayMode;
  
 -typedef struct
 +struct ColorData
  {
    double r, g, b;
 -} edgeColorStruct;
 +public:
 +  ColorData();
 +};
  
 -typedef struct
 +struct BicolorData
  {
    double r, g, b;
 -} nodeColorStruct;
 +  int delta;
 +public:
 +  BicolorData();
 +};
  
 -struct actorAspect
 +struct Properties
  {
 -  surfaceColorStruct surfaceColor;
 -  volumeColorStruct volumeColor;
 -  edgeColorStruct edgeColor;
 -  nodeColorStruct nodeColor;
 +  ColorData nodeColor;
 +  int markerType;
 +  int markerScale;
 +
 +  ColorData edgeColor;
 +  int edgeWidth;
 +
 +  BicolorData surfaceColor;
 +  BicolorData volumeColor;
 +
 +  ColorData elem0dColor;
 +  int elem0dSize;
 +
 +  ColorData ballColor;
 +  double ballScale;
 +
 +  ColorData outlineColor;
 +  int outlineWidth;
 +
 +  ColorData orientationColor;
 +  double orientationScale;
 +  bool orientation3d;
 +
 +  double shrinkFactor;
    double opacity;
 +
 +public:
 +  Properties();
  };
  
 +typedef ColorData nodeColorStruct; // deprecated
 +typedef ColorData edgeColorStruct; // deprecated
 +typedef BicolorData surfaceColorStruct; // deprecated
 +typedef BicolorData volumeColorStruct; // deprecated
 +typedef Properties actorAspect; // deprecated
 +
  class SMESH_SWIG_EXPORT SMESH_Swig
  {
  public:
    SMESH_Swig();
    ~SMESH_Swig();
-   
 -    
 -  void                       Init();
 -  const char*                AddNewMesh( const char* );
 -  const char*                AddNewHypothesis( const char* );
 -  const char*                AddNewAlgorithms( const char* );
 +  // Initialization =============================================
-   
-   void                       Init(int); // deprecated
++
++  void                       Init(); // deprecated
 +
 +  // Publishing =================================================
 +
 +  const char* publish(const char*, const char* = 0);
 +  void rename(const char*, const char*);
  
 -  void                       SetShape( const char*, const char* );
 +  const char* AddNewMesh(const char*, const char* = 0); // deprecated
 +  const char* AddNewHypothesis(const char*, const char* = 0); // deprecated
 +  const char* AddNewAlgorithm(const char*, const char* = 0); // deprecated
 +  const char* AddNewAlgorithms(const char*, const char* = 0); // deprecated
  
 -  void                       SetHypothesis( const char*, const char* );
 -  void                       SetAlgorithms( const char*, const char* );
 +  void SetShape(const char*, const char*); // deprecated
  
 -  void                       UnSetHypothesis( const char* );
 +  void SetHypothesis(const char*, const char*); // deprecated
 +  void SetAlgorithms(const char*, const char*); // deprecated
  
 -  const char*                AddSubMesh( const char*, const char*, int );
 -  const char*                AddSubMeshOnShape( const char*, const char*, const char*, int );
 +  void UnSetHypothesis(const char*); // deprecated
  
 -  void                       CreateAndDisplayActor( const char* );
 +  const char* AddSubMesh(const char*, const char*, int, const char* = 0); // deprecated
 +  const char* AddSubMeshOnShape(const char*, const char*, const char*, int, const char* = 0); // deprecated
  
 -  void                       SetName( const char*, const char* );
 +  void SetName(const char*, const char*); // deprecated
  
 -  void                       EraseActor( const char*, const bool allViewers = false );
 +  void SetMeshIcon(const char*, const bool, const bool); // deprecated
  
 -  void                       UpdateActor( const char* Mesh_Entry );
 +  // Visualization  =============================================
  
 -  /*!
 -   * \brief Set mesh icon according to compute status
 -    * \param Mesh_Entry - entry of a mesh
 -    * \param isComputed - is mesh computed or not
 -   */
 -  void                       SetMeshIcon( const char*, const bool, const bool );
 +  void display(const char*, int = 0, bool = true);
 +  void erase(const char*, int = 0, bool = true);
 +  void update(const char*);
  
 -  actorAspect                GetActorAspect(const char* Mesh_Entry, int viewId = 0 );
 -  void                       SetActorAspect( const actorAspect& actorPres, const char* Mesh_Entry, int viewId = 0  );
 +  Properties properties(const char*, int = 0);
 +  void setProperties(const char*, const Properties&, int = 0);
  
 -  void setSelectionMode( SelectionMode selectionMode );
 -  std::vector<int> getSelected( const char* Mesh_Entry );
 -  std::vector<std::pair<int, int> > getSelectedEdgeOfCell( const char* Mesh_Entry );
 +  bool nodesNumbering(const char*, int = 0);
 +  void setNodesNumbering(const char*, bool, int = 0);
 +  bool elementsNumbering(const char*, int = 0);
 +  void setElementsNumbering(const char*, bool, int = 0);
  
 -  // --------------------- for the test purposes -----------------------
 -  SelectionMode getSelectionMode();
 -  void select( const char *id, std::vector<int> ids, bool append = false );
 -  void select( const char *id, int id1, bool append = false );
 -  void select( const char *id, std::vector<std::pair<int,int> >, bool apend = false );
 +  DisplayMode displayMode(const char*, int = 0);
 +  void setDisplayMode(const char*, DisplayMode, int = 0);
 +
 +  bool shrinkMode(const char*, int = 0);
 +  void setShrinkMode(const char*, bool, int = 0);
 +
 +  double opacity(const char*, int = 0);
 +  void setOpacity(const char*, double, int = 0);
 +
 +  bool isOrientationShown(const char*, int = 0);
 +  void setOrientationShown(const char*, bool, int = 0);
 +
 +  int entitiesShown(const char*, int = 0);
 +  void setEntitiesShown(const char*, int, int = 0);
 +  bool isEntityShown(const char*, EntityMode, int = 0);
 +  void setEntityShown(const char*, EntityMode, bool, int = 0);
 +
 +  void CreateAndDisplayActor(const char*); // deprecated
 +  void EraseActor(const char*, const bool = false); // deprecated
 +  void UpdateActor(const char* Mesh_Entry); // deprecated
 +
 +  actorAspect GetActorAspect(const char*, int = 0); // deprecated
 +  void SetActorAspect(const actorAspect&, const char*, int = 0); // deprecated
 +
 +  // Selection  =================================================
 +
 +  SelectionMode getSelectionMode(int = 0);
 +  void setSelectionMode(SelectionMode, int = 0);
 +  std::vector<int> getSelected(const char*);
 +  std::vector<std::pair<int, int> > getSelectedEdgeOfCell(const char*);
 +
 +  void select(const char*, std::vector<int>, bool = false);
 +  void select(const char*, int, bool = false);
 +  void select(const char*, std::vector<std::pair<int,int> >, bool = false);
  
  private:
 -  SALOMEDS::StudyBuilder_var myStudyBuilder;
 -  SALOMEDS::SComponent_var   mySComponentMesh;
 +  void init();
 +
- private:
-   int myCachedStudyId;
  };
  
  #endif // LIBSMESH_SWIG_H
index 0978eb6bf81db93859e2ddb77385c960dc49adf5,e261ade1dbca6e59ba15791f4e8f868a1e6475a0..a1aebc00a34b7dc3465cf8eabf7aeb664b72dcf7
  // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
 -// SMESH SMESHGUI : GUI for SMESH component
 -// File   : libSMESH_Swig.i
 -// Author : Nicolas REJNERI, Open CASCADE S.A.S.
 -//
  %module libSMESH_Swig
  
  %{
@@@ -34,7 -38,7 +34,7 @@@
      // Py_END_ALLOW_THREADS
      ~PyAllowThreadsGuard() { PyEval_RestoreThread(_save); }
    private:
 -    PyThreadState *_save;
 +    PyThreadState_save;
    };
  
    PyAllowThreadsGuard guard;
  %include "std_vector.i"
  %include "std_pair.i"
  
 -namespace std {
 -  
 -    %template(VectorInt) vector<int>;
 -    %template() std::pair<int,int>;
 -    %template(PairVector) std::vector<std::pair<int,int> >;
 +namespace std
 +{
 +  %template(VectorInt) vector<int>;
 +  %template() std::pair<int,int>;
 +  %template(PairVector) std::vector<std::pair<int,int> >;
  };
  
 -
 -/* Selection mode enumeration (corresponds to constants from the SALOME_Selection.h) */
 +// See SMESH_Actor.h
 +typedef enum
 +{
 +  EntityNone    = 0x00,
 +  Entity0d      = 0x01,   // SMESH_Actor::e0DElements
 +  EntityEdges   = 0x02,   // SMESH_Actor::eEdges
 +  EntityFaces   = 0x04,   // SMESH_Actor::eFaces
 +  EntityVolumes = 0x08,   // SMESH_Actor::eVolumes
 +  EntityBalls   = 0x10,   // SMESH_Actor::eBallElem
 +  EntityAll     = 0xff    // SMESH_Actor::eAllEntity
 +} EntityMode;
 +
 +// See SVTK_Selection.h
  enum SelectionMode
 -  {
 -    Undefined = -1,
 -    Node = 0,
 -    Cell,
 -    EdgeOfCell,
 -    Edge,
 -    Face,
 -    Volume,
 -    Actor,
 -    Elem0D,
 -    Ball
 -  };
 -
 -typedef struct
  {
 -  double r, g, b;
 -  int delta;
 -} surfaceColorStruct;
 +  Undefined = -1,
 +  Node = 0,       // NodeSelection
 +  Cell,           // CellSelection
 +  EdgeOfCell,     // EdgeOfCellSelection
 +  Edge,           // EdgeSelection
 +  Face,           // FaceSelection
 +  Volume,         // VolumeSelection
 +  Actor,          // ActorSelection
 +  Elem0D,         // Elem0DSelection
 +  Ball            // BallSelection
 +};
  
 -typedef struct
 +// See SMESH_Actor.h
 +enum DisplayMode
  {
 -  double r, g, b;
 -  int delta;
 -} volumeColorStruct;
 +  UndefinedMode = -1,
 +  PointMode = 0,      // SMESH_Actor::ePoint
 +  EdgeMode,           // SMESH_Actor::eEdge
 +  SurfaceMode         // SMESH_Actor::eSurface
 +};
  
 -typedef struct
 +struct ColorData
  {
    double r, g, b;
 -} edgeColorStruct;
 +};
  
 -typedef struct
 +struct BicolorData
  {
    double r, g, b;
 -} nodeColorStruct;
 +  int delta;
 +};
  
 -struct actorAspect
 +struct Properties
  {
 -  surfaceColorStruct surfaceColor;
 -  volumeColorStruct volumeColor;
 -  edgeColorStruct edgeColor;
 -  nodeColorStruct nodeColor;
 +  ColorData nodeColor;
 +  int markerType;
 +  int markerScale;
 +
 +  ColorData edgeColor;
 +  int edgeWidth;
 +
 +  BicolorData surfaceColor;
 +  BicolorData volumeColor;
 +
 +  ColorData elem0dColor;
 +  int elem0dSize;
 +
 +  ColorData ballColor;
 +  double ballScale;
 +
 +  ColorData outlineColor;
 +  int outlineWidth;
 +
 +  ColorData orientationColor;
 +  double orientationScale;
 +  bool orientation3d;
 +
 +  double shrinkFactor;
    double opacity;
  };
  
 +typedef ColorData nodeColorStruct; // deprecated
 +typedef ColorData edgeColorStruct; // deprecated
 +typedef BicolorData surfaceColorStruct; // deprecated
 +typedef BicolorData volumeColorStruct; // deprecated
 +typedef Properties actorAspect; // deprecated
 +
  class SMESH_Swig
  {
 - public:
 +public:
    SMESH_Swig();
    ~SMESH_Swig();
  
 -  void Init();
 -  const char* AddNewMesh(const char* IOR);
 -  const char* AddNewHypothesis(const char* IOR);
 -  const char* AddNewAlgorithms(const char* IOR);
 +  // Initialization =============================================
 +
-   void Init(int); // deprecated
++  void Init(); // deprecated
 +
 +  // Publishing =================================================
 +  
 +  const char* publish(const char*, const char* = 0);
 +  void rename(const char*, const char*);
 +
 +  const char* AddNewMesh(const char*, const char* = 0); // deprecated
 +  const char* AddNewHypothesis(const char*, const char* = 0); // deprecated
 +  const char* AddNewAlgorithms(const char*, const char* = 0); // deprecated
 +  const char* AddNewAlgorithm(const char*, const char* = 0); // deprecated
 +
 +  void SetShape(const char*, const char*); // deprecated
 +
 +  void SetHypothesis(const char*, const char*); // deprecated
 +  void SetAlgorithms(const char*, const char*); // deprecated
 +
 +  void UnSetHypothesis(const char*); // deprecated
 +
 +  const char* AddSubMesh(const char*, const char*, int, const char* = 0); // deprecated
 +  const char* AddSubMeshOnShape (const char*, const char*, const char*, int, const char* = 0); // deprecated
 +
 +  void SetName(const char*, const char*); // deprecated
 +
 +  void SetMeshIcon(const char*, const bool, const bool); // deprecated
 +
 +  // Visualization  =============================================
 +
 +  void display(const char*, int = 0, bool = true);
 +  void erase(const char*, int = 0, bool = true);
 +  void update(const char*);
 +
 +  Properties properties(const char*, int = 0);
 +  void setProperties(const char*, const Properties&, int = 0);
  
 -  void SetShape(const char* ShapeEntry, const char* MeshEntry);
 +  bool nodesNumbering(const char*, int = 0);
 +  void setNodesNumbering(const char*, bool, int = 0);
 +  bool elementsNumbering(const char*, int = 0);
 +  void setElementsNumbering(const char*, bool, int = 0);
  
 -  void SetHypothesis(const char* Mesh_Or_SubMesh_Entry, const char* Hypothesis_Entry);
 -  void SetAlgorithms(const char* Mesh_Or_SubMesh_Entry, const char* Algorithms_Entry);
 +  DisplayMode displayMode(const char*, int = 0);
 +  void setDisplayMode(const char*, DisplayMode, int = 0);
  
 -  void UnSetHypothesis(const char* Applied_Hypothesis_Entry );
 +  bool shrinkMode(const char*, int = 0);
 +  void setShrinkMode(const char*, bool, int = 0);
  
 -  const char* AddSubMesh (const char* Mesh_Entry, const char* SM_IOR, int ST);
 -  const char* AddSubMeshOnShape (const char* Mesh_Entry, const char* GeomShape_Entry, const char* SM_IOR, int ST);
 +  double opacity(const char*, int = 0);
 +  void setOpacity(const char*, double, int = 0);
  
 -  void SetName(const char* Entry, const char* Name);
 +  bool isOrientationShown(const char*, int = 0);
 +  void setOrientationShown(const char*, bool, int = 0);
  
 -  void SetMeshIcon(const char* Mesh_Entry, const bool isComputed, const bool isEmpty);
 +  int entitiesShown(const char*, int = 0);
 +  void setEntitiesShown(const char*, int, int = 0);
 +  bool isEntityShown(const char*, EntityMode, int = 0);
 +  void setEntityShown(const char*, EntityMode, bool, int = 0);
  
 -  void CreateAndDisplayActor( const char* Mesh_Entry );
 -  void EraseActor( const char* Mesh_Entry, const bool allViewers = false );
 -  void UpdateActor( const char* Mesh_Entry );
 +  void CreateAndDisplayActor(const char*); // deprecated
 +  void EraseActor(const char*, const bool = false); // deprecated
 +  void UpdateActor(const char*); // deprecated
  
 -  void setSelectionMode( SelectionMode selectionMode);
 -  std::vector<int> getSelected( const char* Mesh_Entry );
 -  std::vector<std::pair<int,int> > getSelectedEdgeOfCell( const char* Mesh_Entry );
 +  actorAspect GetActorAspect(const char*, int = 0); // deprecated
 +  void SetActorAspect(const actorAspect&, const char*, int = 0); // deprecated
  
 -  actorAspect GetActorAspect(const char* Mesh_Entry, int viewId = 0 );
 -  void SetActorAspect( const actorAspect& actorPres, const char* Mesh_Entry, int viewId = 0 );
 +  // Selection  =================================================
  
 -  void setSelectionMode( SelectionMode selectionMode);
 -  std::vector<int> getSelected( const char* Mesh_Entry );
 +  SelectionMode getSelectionMode(int = 0);
 +  void setSelectionMode(SelectionMode, int = 0);
  
 -  // --------------------- for the test purposes -----------------------
 -  SelectionMode  getSelectionMode();
 -  void select( const char *id, std::vector<int> ids, bool append = false );
 -  void select( const char *id, int id1, bool append = false );
 -  void select( const char *id, std::vector<std::pair<int,int> >, bool apend = false );
 +  std::vector<int> getSelected(const char*);
 +  std::vector<std::pair<int,int> > getSelectedEdgeOfCell(const char*);
  
 +  void select(const char*, std::vector<int>, bool = false);
 +  void select(const char*, int, bool = false);
 +  void select(const char*, std::vector<std::pair<int,int> >, bool = false);
  };
index b9c2e393fbb0705525dafded7f630970be85ee6c,1a0b026ecc74d0cc7d402dd1d687fe1df9be56b3..2ca7990d5315633d08c839689bb3cb365cafcd1e
@@@ -107,8 -107,8 +107,8 @@@ using namespace std
   */
  //=============================================================================
  
- StdMeshers_Cartesian_3D::StdMeshers_Cartesian_3D(int hypId, int studyId, SMESH_Gen * gen)
-   :SMESH_3D_Algo(hypId, studyId, gen)
+ StdMeshers_Cartesian_3D::StdMeshers_Cartesian_3D(int hypId, SMESH_Gen * gen)
+   :SMESH_3D_Algo(hypId, gen)
  {
    _name = "Cartesian_3D";
    _shapeType = (1 << TopAbs_SOLID);       // 1 bit /shape type
@@@ -2613,34 -2613,34 +2613,34 @@@ namespac
    {
      enum { X = 1, Y = 2, Z = 4 }; // == 001, 010, 100
      int nbFacets = 0;
 -    int vertex = 0, egdeMask = 0;
 +    int vertex = 0, edgeMask = 0;
  
      if ( Abs( _grid->_coords[0][ _i   ] - ip->_uvw[0] ) < _grid->_tol ) {
        facets[ nbFacets++ ] = SMESH_Block::ID_F0yz;
 -      egdeMask |= X;
 +      edgeMask |= X;
      }
      else if ( Abs( _grid->_coords[0][ _i+1 ] - ip->_uvw[0] ) < _grid->_tol ) {
        facets[ nbFacets++ ] = SMESH_Block::ID_F1yz;
        vertex   |= X;
 -      egdeMask |= X;
 +      edgeMask |= X;
      }
      if ( Abs( _grid->_coords[1][ _j   ] - ip->_uvw[1] ) < _grid->_tol ) {
        facets[ nbFacets++ ] = SMESH_Block::ID_Fx0z;
 -      egdeMask |= Y;
 +      edgeMask |= Y;
      }
      else if ( Abs( _grid->_coords[1][ _j+1 ] - ip->_uvw[1] ) < _grid->_tol ) {
        facets[ nbFacets++ ] = SMESH_Block::ID_Fx1z;
        vertex   |= Y;
 -      egdeMask |= Y;
 +      edgeMask |= Y;
      }
      if ( Abs( _grid->_coords[2][ _k   ] - ip->_uvw[2] ) < _grid->_tol ) {
        facets[ nbFacets++ ] = SMESH_Block::ID_Fxy0;
 -      egdeMask |= Z;
 +      edgeMask |= Z;
      }
      else if ( Abs( _grid->_coords[2][ _k+1 ] - ip->_uvw[2] ) < _grid->_tol ) {
        facets[ nbFacets++ ] = SMESH_Block::ID_Fxy1;
        vertex   |= Z;
 -      egdeMask |= Z;
 +      edgeMask |= Z;
      }
  
      switch ( nbFacets )
          { SMESH_Block::ID_Ex00, 0, SMESH_Block::ID_Ex10, 0,
            SMESH_Block::ID_Ex01, 0, SMESH_Block::ID_Ex11 }
        };
 -      switch ( egdeMask ) {
 +      switch ( edgeMask ) {
        case X | Y: sub = edge[ 0 ][ vertex ]; break;
        case X | Z: sub = edge[ 1 ][ vertex ]; break;
        default:    sub = edge[ 2 ][ vertex ];
@@@ -3619,7 -3619,7 +3619,7 @@@ bool StdMeshers_Cartesian_3D::Compute(S
          for ( ; solidExp.More() && volIt->more(); solidExp.Next() )
          {
            const SMDS_MeshElement* vol = volIt->next();
 -          sm1->RemoveElement( vol, /*isElemDeleted=*/false );
 +          sm1->RemoveElement( vol );
            meshDS->SetMeshElementOnShape( vol, solidExp.Current() );
          }
        }
index 403de38f6e22f4b259b0bec2d962dda786b1e81d,0cd90264c4dcd0a2d5592caa0ba1934693775a13..3ac20b8eabd27dca8508e6575a6897c2cfac9e71
@@@ -386,7 -386,7 +386,7 @@@ namespac
  
      // Find a node at any block corner
  
 -    SMDS_NodeIteratorPtr nIt = meshDS->nodesIterator(/*idInceasingOrder=*/true);
 +    SMDS_NodeIteratorPtr nIt = meshDS->nodesIterator();
      if ( !nIt->more() ) return error("Empty mesh");
  
      const SMDS_MeshNode* nCorner = 0;
  //purpose  : 
  //=======================================================================
  
- StdMeshers_HexaFromSkin_3D::StdMeshers_HexaFromSkin_3D(int hypId, int studyId, SMESH_Gen* gen)
-   :SMESH_3D_Algo(hypId, studyId, gen)
+ StdMeshers_HexaFromSkin_3D::StdMeshers_HexaFromSkin_3D(int hypId, SMESH_Gen* gen)
+   :SMESH_3D_Algo(hypId, gen)
  {
    _name = "HexaFromSkin_3D";
  }
index b5da1cd52f00bfad5478104d9436fc16a6dc6acb,ef13ad41877bb0ec7d704278cc71b4cbeaed40c1..f0d4925c82cbdad6c6a7a5d59a41926880b16409
@@@ -96,8 -96,8 +96,8 @@@ namespac
   */
  //=============================================================================
  
- StdMeshers_Import_1D2D::StdMeshers_Import_1D2D(int hypId, int studyId, SMESH_Gen * gen)
-   :SMESH_2D_Algo(hypId, studyId, gen), _sourceHyp(0)
+ StdMeshers_Import_1D2D::StdMeshers_Import_1D2D(int hypId, SMESH_Gen * gen)
+   :SMESH_2D_Algo(hypId, gen), _sourceHyp(0)
  {
    _name = "Import_1D2D";
    _shapeType = (1 << TopAbs_FACE);
@@@ -581,7 -581,7 +581,7 @@@ bool StdMeshers_Import_1D2D::Compute(SM
                  if ( Abs(u-f) < 2 * faceTol || Abs(u-l) < 2 * faceTol )
                    // duplicated node on vertex
                    return error("Source elements overlap one another");
 -                tgtFaceSM->RemoveNode( n, /*isNodeDeleted=*/false );
 +                tgtFaceSM->RemoveNode( n );
                  tgtMesh->SetNodeOnEdge( n, edges[iE], u );
                  break;
                }
  
            TopoDS_Edge geomEdge = TopoDS::Edge(bndShapes.back());
            helper.CheckNodeU( geomEdge, link._medium, u, projTol, /*force=*/true );
 -          tgtFaceSM->RemoveNode( link._medium, /*isNodeDeleted=*/false );
 +          tgtFaceSM->RemoveNode( link._medium );
            tgtMesh->SetNodeOnEdge( (SMDS_MeshNode*)link._medium, geomEdge, u );
          }
          else
            seamHelper.AddEdge( node1, node2 );
            if ( node2->getshapeId() == helper.GetSubShapeID() )
            {
 -            tgtFaceSM->RemoveNode( node2, /*isNodeDeleted=*/false );
 +            tgtFaceSM->RemoveNode( node2 );
              tgtMesh->SetNodeOnEdge( const_cast<SMDS_MeshNode*>( node2 ), seamEdge, n2->first );
            }
          }
index 4ea62de3e713f647726c06759061bbf5a421ff9f,bbc594b163c9e2a3de4670ff8c6e8aabd4783a9d..c8a755eb2bb608cf2b33e3dd368d209d50145d51
@@@ -79,8 -79,8 +79,8 @@@ using namespace std
   */
  //=============================================================================
  
- StdMeshers_MEFISTO_2D::StdMeshers_MEFISTO_2D(int hypId, int studyId, SMESH_Gen * gen):
-   SMESH_2D_Algo(hypId, studyId, gen)
+ StdMeshers_MEFISTO_2D::StdMeshers_MEFISTO_2D(int hypId, SMESH_Gen * gen):
+   SMESH_2D_Algo(hypId, gen)
  {
    _name = "MEFISTO_2D";
    _shapeType = (1 << TopAbs_FACE);
@@@ -516,7 -516,8 +516,7 @@@ static bool fixCommonVertexUV (R2 
          // check if node is medium
          if ( theCreateQuadratic && SMESH_MesherHelper::IsMedium( node, SMDSAbs_Edge ))
            continue;
 -        const SMDS_EdgePosition* epos =
 -          static_cast<const SMDS_EdgePosition*>(node->GetPosition());
 +        SMDS_EdgePositionPtr epos = node->GetPosition();
          double u = epos->GetUParameter();
          if ( u < umin )
            umin = u;
    }
    R2 uv0, uv1, uv2;
    uv0.x = thisUV.X();   uv0.y = thisUV.Y();
 -  uv1.x = nextUV.X();   uv1.y = nextUV.Y(); 
 +  uv1.x = nextUV.X();   uv1.y = nextUV.Y();
    uv2.x = thisUV.X();   uv2.y = thisUV.Y();
  
 -  uv1.x *= theScaleX;   uv1.y *= theScaleY; 
 +  uv1.x *= theScaleX;   uv1.y *= theScaleY;
  
    if ( fixOverlappedLinkUV( uv0, uv1, uv2 ))
    {
index 80cdc5edd68542ab14ebe5a018093bfc91dded10,68535a2192dcf80b7858c11bfca16228962c354b..a6e7b0f620ab6cf1c62694f2de4afc26e1bb44d0
@@@ -96,15 -96,14 +96,14 @@@ namespace 
     */
    struct TQuadrangleAlgo : public StdMeshers_Quadrangle_2D
    {
-     TQuadrangleAlgo(int studyId, SMESH_Gen* gen)
-       : StdMeshers_Quadrangle_2D( gen->GetANewId(), studyId, gen)
+     TQuadrangleAlgo(SMESH_Gen* gen)
+       : StdMeshers_Quadrangle_2D( gen->GetANewId(), gen)
      {
      }
      static StdMeshers_Quadrangle_2D* instance( SMESH_Algo*         fatherAlgo,
                                                 SMESH_MesherHelper* helper=0)
      {
-       static TQuadrangleAlgo* algo = new TQuadrangleAlgo( fatherAlgo->GetStudyId(),
-                                                           fatherAlgo->GetGen() );
+       static TQuadrangleAlgo* algo = new TQuadrangleAlgo( fatherAlgo->GetGen() );
        if ( helper &&
             algo->myProxyMesh &&
             algo->myProxyMesh->GetMesh() != helper->GetMesh() )
    {
      StdMeshers_ProjectionSource1D myHyp;
  
-     TProjction1dAlgo(int studyId, SMESH_Gen* gen)
-       : StdMeshers_Projection_1D( gen->GetANewId(), studyId, gen),
-         myHyp( gen->GetANewId(), studyId, gen)
+     TProjction1dAlgo(SMESH_Gen* gen)
+       : StdMeshers_Projection_1D( gen->GetANewId(), gen),
+         myHyp( gen->GetANewId(), gen)
      {
        StdMeshers_Projection_1D::_sourceHypo = & myHyp;
      }
      static TProjction1dAlgo* instance( SMESH_Algo* fatherAlgo )
      {
-       static TProjction1dAlgo* algo = new TProjction1dAlgo( fatherAlgo->GetStudyId(),
-                                                             fatherAlgo->GetGen() );
+       static TProjction1dAlgo* algo = new TProjction1dAlgo( fatherAlgo->GetGen() );
        return algo;
      }
    };
    {
      StdMeshers_ProjectionSource2D myHyp;
  
-     TProjction2dAlgo(int studyId, SMESH_Gen* gen)
-       : StdMeshers_Projection_1D2D( gen->GetANewId(), studyId, gen),
-         myHyp( gen->GetANewId(), studyId, gen)
+     TProjction2dAlgo(SMESH_Gen* gen)
+       : StdMeshers_Projection_1D2D( gen->GetANewId(), gen),
+         myHyp( gen->GetANewId(), gen)
      {
        StdMeshers_Projection_2D::_sourceHypo = & myHyp;
      }
      static TProjction2dAlgo* instance( SMESH_Algo* fatherAlgo )
      {
-       static TProjction2dAlgo* algo = new TProjction2dAlgo( fatherAlgo->GetStudyId(),
-                                                             fatherAlgo->GetGen() );
+       static TProjction2dAlgo* algo = new TProjction2dAlgo( fatherAlgo->GetGen() );
        return algo;
      }
      const NSProjUtils::TNodeNodeMap& GetNodesMap()
  //purpose  : 
  //=======================================================================
  
- StdMeshers_Prism_3D::StdMeshers_Prism_3D(int hypId, int studyId, SMESH_Gen* gen)
-   :SMESH_3D_Algo(hypId, studyId, gen)
+ StdMeshers_Prism_3D::StdMeshers_Prism_3D(int hypId, SMESH_Gen* gen)
+   :SMESH_3D_Algo(hypId, gen)
  {
    _name                    = "Prism_3D";
    _shapeType               = (1 << TopAbs_SOLID); // 1 bit per shape type
@@@ -1170,11 -1167,6 +1167,11 @@@ bool StdMeshers_Prism_3D::compute(cons
    if ( !assocOrProjBottom2Top( bottomToTopTrsf, thePrism ) ) // it also fills myBotToColumnMap
      return false;
  
 +  // If all "vertical" EDGEs are straight, then all nodes of an internal node column
 +  // are located on a line connecting the top node and the bottom node.
 +  bool isStrightColunm = allVerticalEdgesStraight( thePrism );
 +  if ( isStrightColunm )
 +    myUseBlock = false;
  
    // Create nodes inside the block
  
  
      myHelper->SetElementsOnShape( true );
  
 -    // If all "vertical" EDGEs are straight, then all nodes of an internal node column
 -    // are located on a line connecting the top node and the bottom node.
 -    bool isStrightColunm = allVerticalEdgesStraight( thePrism );
      if ( !isStrightColunm )
      {
        double tol = getSweepTolerance( thePrism );
@@@ -1800,8 -1795,9 +1797,8 @@@ bool StdMeshers_Prism_3D::computeWalls(
        if ( myHelper->GetIsQuadratic() )
        {
          // fill myHelper with medium nodes built by quadAlgo
 -        SMDS_ElemIteratorPtr fIt = fSM->GetSubMeshDS()->GetElements();
 -        while ( fIt->more() )
 -          myHelper->AddTLinks( dynamic_cast<const SMDS_MeshFace*>( fIt->next() ));
 +        for ( SMDS_ElemIteratorPtr fIt = fSM->GetSubMeshDS()->GetElements(); fIt->more(); )
 +          myHelper->AddTLinks( SMDS_Mesh::DownCast<SMDS_MeshFace>( fIt->next() ));
        }
      }
    }
@@@ -4848,7 -4844,7 +4845,7 @@@ TPCurveOnHorFaceAdaptor::TPCurveOnHorFa
          }
          if ( !C2d.IsNull() )
          {
 -          double u = static_cast< const SMDS_EdgePosition* >( n->GetPosition() )->GetUParameter();
 +          double u = SMDS_EdgePositionPtr( n->GetPosition() )->GetUParameter();
            if ( f <= u && u <= l )
            {
              uv = C2d->Value( u ).XY();
index ae15730cdaea772582799431007ff623522f2603,607efdfa64ce7894535018ebb4e31feb132f7ff7..fcc6f413fed446c546064d2c9f7f8766652bd35b
@@@ -93,8 -93,8 +93,8 @@@ namespac
  //purpose  : 
  //=======================================================================
  
- StdMeshers_Projection_1D2D::StdMeshers_Projection_1D2D(int hypId, int studyId, SMESH_Gen* gen)
-   :StdMeshers_Projection_2D(hypId, studyId, gen)
+ StdMeshers_Projection_1D2D::StdMeshers_Projection_1D2D(int hypId, SMESH_Gen* gen)
+   :StdMeshers_Projection_2D(hypId, gen)
  {
    _name = "Projection_1D2D";
    _requireDiscreteBoundary = false;
@@@ -140,7 -140,7 +140,7 @@@ bool StdMeshers_Projection_1D2D::Comput
      {
        const SMDS_MeshElement* f = fIt->next();
        //if ( !f->IsQuadratic() ) continue;
 -      nodes.assign( SMDS_MeshElement::iterator( f->interlacedNodesElemIterator() ),
 +      nodes.assign( SMDS_MeshElement::iterator( f->interlacedNodesIterator() ),
                      SMDS_MeshElement::iterator() );
        nodes.push_back( nodes[0] );
        for ( size_t i = 2; i < nodes.size(); i += 2 )
          if ( idType.second == TopAbs_EDGE &&
               idType.first  != nodes[i-1]->getshapeId() )
          {
 -          faceSubMesh->RemoveNode( nodes[i-1], /*isDeleted=*/false );
 -          meshDS->SetNodeOnEdge( (SMDS_MeshNode*) nodes[i-1], idType.first );
 +          faceSubMesh->RemoveNode( nodes[i-1] );
 +          meshDS->SetNodeOnEdge( nodes[i-1], idType.first );
            posFixer.SetSubShape( idType.first );
            posFixer.CheckNodeU( TopoDS::Edge( posFixer.GetSubShape() ),
                                 nodes[i-1], dummyU=0., tol, /*force=*/true );
index 68ae8ea47ab88aecafeb96edb8de92a096058ffc,a41c5ac6d2f77d9d3ba3ecac675b1d91beef9bab..d9b01603c42160118aaa1db7c60c4b548712a94d
@@@ -85,8 -85,8 +85,8 @@@ namespace TAssocTool = StdMeshers_Proje
  //purpose  : 
  //=======================================================================
  
- StdMeshers_Projection_2D::StdMeshers_Projection_2D(int hypId, int studyId, SMESH_Gen* gen)
-   :SMESH_2D_Algo(hypId, studyId, gen)
+ StdMeshers_Projection_2D::StdMeshers_Projection_2D(int hypId, SMESH_Gen* gen)
+   :SMESH_2D_Algo(hypId, gen)
  {
    _name = "Projection_2D";
    _compatibleHypothesis.push_back("ProjectionSource2D");
@@@ -371,7 -371,8 +371,7 @@@ namespace 
          if ( node->GetPosition()->GetTypeOfPosition() != SMDS_TOP_EDGE )
            RETURN_BAD_RESULT("Bad node position type: node " << node->GetID() <<
                              " pos type " << node->GetPosition()->GetTypeOfPosition());
 -        const SMDS_EdgePosition* pos =
 -          static_cast<const SMDS_EdgePosition*>(node->GetPosition());
 +        SMDS_EdgePositionPtr pos = node->GetPosition();
          u2nodes.insert( make_pair( pos->GetUParameter(), node ));
          seamNodes.insert( node );
        }
@@@ -1586,7 -1587,8 +1586,7 @@@ bool StdMeshers_Projection_2D::Compute(
            break;
          }
          case  SMDS_TOP_EDGE:   {
 -          const SMDS_EdgePosition* pos =
 -            static_cast<const SMDS_EdgePosition*>(node->GetPosition());
 +          SMDS_EdgePositionPtr pos = node->GetPosition();
            pos2nodes.insert( make_pair( pos->GetUParameter(), node ));
            break;
          }
index 4284c1b360d6a99eed50e0f1e37c3d8f23d7e780,ea0fbfccd3ae9282e4a01fda25037304c80e3eb7..20b4efd8c213654c8a59b839979cb5818cec9fbd
@@@ -31,6 -31,7 +31,6 @@@
  
  #include "StdMeshers_ProjectionUtils.hxx"
  
 -#include "SMDS_PolyhedralVolumeOfNodes.hxx"
  #include "SMDS_VolumeTool.hxx"
  #include "SMESHDS_Hypothesis.hxx"
  #include "SMESHDS_Mesh.hxx"
@@@ -64,8 -65,8 +64,8 @@@ using namespace std
  //purpose  : 
  //=======================================================================
  
- StdMeshers_Projection_3D::StdMeshers_Projection_3D(int hypId, int studyId, SMESH_Gen* gen)
-   :SMESH_3D_Algo(hypId, studyId, gen)
+ StdMeshers_Projection_3D::StdMeshers_Projection_3D(int hypId, SMESH_Gen* gen)
+   :SMESH_3D_Algo(hypId, gen)
  {
    _name = "Projection_3D";
    _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID);  // 1 bit per shape type
@@@ -407,7 -408,8 +407,7 @@@ bool StdMeshers_Projection_3D::Compute(
                                   nodes[6],
                                   nodes[7], id, force3d); break;
      default: // polyhedron
 -      const SMDS_VtkVolume * poly =
 -        dynamic_cast<const SMDS_VtkVolume*>( srcVol );
 +      const SMDS_MeshVolume * poly = tgtMeshDS->DownCast<SMDS_MeshVolume>( srcVol );
        if ( !poly )
          RETURN_BAD_RESULT("Unexpected volume type");
        if ( !poly->IsPoly())
index a9d275cfbc15723f8b14709e60e7440f0082d04e,b8a2ee5a81a172497b45ce48c15aac96f156bc3f..df0bb001ab6e938be5bf9e400e27db408d5effb3
  #include "Utils_ExceptHandlers.hxx"
  
  #include <boost/container/flat_set.hpp>
 +#include <boost/intrusive/circular_list_algorithms.hpp>
  
  typedef NCollection_Array2<const SMDS_MeshNode*> StdMeshers_Array2OfNode;
  
 -typedef gp_XY gp_UV;
 +typedef gp_XY         gp_UV;
  typedef SMESH_Comment TComm;
  
  using namespace std;
@@@ -80,9 -79,9 +80,9 @@@
   */
  //=============================================================================
  
- StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D (int hypId, int studyId,
+ StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D (int hypId,
                                                      SMESH_Gen* gen)
-   : SMESH_2D_Algo(hypId, studyId, gen),
+   : SMESH_2D_Algo(hypId, gen),
      myQuadranglePreference(false),
      myTrianglePreference(false),
      myTriaVertexID(-1),
@@@ -643,11 -642,9 +643,11 @@@ bool StdMeshers_Quadrangle_2D::computeQ
                SMESH_ComputeErrorPtr& err = aMesh.GetSubMesh( aFace )->GetComputeError();
                if ( !err || err->IsOK() || err->myName < COMPERR_WARNING )
                {
 -                err.reset( new SMESH_ComputeError( COMPERR_WARNING,
 -                                                   "Bad quality quad created"));
 -                err->myBadElements.push_back( face );
 +                SMESH_BadInputElements* badElems =
 +                  new SMESH_BadInputElements( meshDS, COMPERR_WARNING,
 +                                              "Bad quality quad created");
 +                badElems->add( face );
 +                err.reset( badElems );
                }
              }
              --i;
                SMESH_ComputeErrorPtr& err = aMesh.GetSubMesh( aFace )->GetComputeError();
                if ( !err || err->IsOK() || err->myName < COMPERR_WARNING )
                {
 -                err.reset( new SMESH_ComputeError( COMPERR_WARNING,
 -                                                   "Bad quality quad created"));
 -                err->myBadElements.push_back( face );
 +                SMESH_BadInputElements* badElems =
 +                  new SMESH_BadInputElements( meshDS, COMPERR_WARNING,
 +                                              "Bad quality quad created");
 +                badElems->add( face );
 +                err.reset( badElems );
                }
              }
              --i;
@@@ -1025,454 -1020,30 +1025,454 @@@ bool StdMeshers_Quadrangle_2D::IsApplic
    return ( toCheckAll && nbFoundFaces != 0 );
  }
  
 +namespace
 +{
 +  //================================================================================
 +  /*!
 +   * \brief Return true if only two given edges meat at their common vertex
 +   */
 +  //================================================================================
 +
 +  bool twoEdgesMeatAtVertex(const TopoDS_Edge& e1,
 +                            const TopoDS_Edge& e2,
 +                            SMESH_Mesh &       mesh)
 +  {
 +    TopoDS_Vertex v;
 +    if (!TopExp::CommonVertex(e1, e2, v))
 +      return false;
 +    TopTools_ListIteratorOfListOfShape ancestIt(mesh.GetAncestors(v));
 +    for (; ancestIt.More() ; ancestIt.Next())
 +      if (ancestIt.Value().ShapeType() == TopAbs_EDGE)
 +        if (!e1.IsSame(ancestIt.Value()) && !e2.IsSame(ancestIt.Value()))
 +          return false;
 +    return true;
 +  }
 +
 +  //--------------------------------------------------------------------------------
 +  /*!
 +   * \brief EDGE of a FACE
 +   */
 +  struct Edge
 +  {
 +    TopoDS_Edge   myEdge;
 +    TopoDS_Vertex my1stVertex;
 +    int           myIndex;
 +    double        myAngle;      // angle at my1stVertex
 +    int           myNbSegments; // discretization
 +    Edge*         myPrev;       // preceding EDGE
 +    Edge*         myNext;       // next EDGE
 +
 +    // traits used by boost::intrusive::circular_list_algorithms
 +    typedef Edge         node;
 +    typedef Edge *       node_ptr;
 +    typedef const Edge * const_node_ptr;
 +    static node_ptr get_next(const_node_ptr n)             {  return n->myNext;  }
 +    static void     set_next(node_ptr n, node_ptr next)    {  n->myNext = next;  }
 +    static node_ptr get_previous(const_node_ptr n)         {  return n->myPrev;  }
 +    static void     set_previous(node_ptr n, node_ptr prev){  n->myPrev = prev;  }
 +  };
 +
 +  //--------------------------------------------------------------------------------
 +  /*!
 +   * \brief Four sides of a quadrangle evaluating its quality
 +   */
 +  struct QuadQuality
 +  {
 +    typedef std::set< QuadQuality, QuadQuality > set;
 +
 +    Edge*  myCornerE[4];
 +    int    myNbSeg  [4];
 +
 +    // quality criteria to minimize
 +    int    myOppDiff;
 +    double myQuartDiff;
 +    double mySumAngle;
 +
 +    // Compute quality criateria and add self to the set of variants
 +    //
 +    void AddSelf( QuadQuality::set& theVariants )
 +    {
 +      if ( myCornerE[2] == myCornerE[1] || // exclude invalid variants
 +           myCornerE[2] == myCornerE[3] ||
 +           myCornerE[0] == myCornerE[3] )
 +        return;
 +
 +      // count nb segments between corners
 +      mySumAngle = 0;
 +      double totNbSeg = 0;
 +      for ( int i1 = 3, i2 = 0; i2 < 4; i1 = i2++ )
 +      {
 +        myNbSeg[ i1 ] = 0;
 +        for ( Edge* e = myCornerE[ i1 ]; e != myCornerE[ i2 ]; e = e->myNext )
 +          myNbSeg[ i1 ] += e->myNbSegments;
 +        mySumAngle -= myCornerE[ i1 ]->myAngle / M_PI; // [-1,1]
 +        totNbSeg += myNbSeg[ i1 ];
 +      }
 +
 +      myOppDiff = ( Abs( myNbSeg[0] - myNbSeg[2] ) +
 +                    Abs( myNbSeg[1] - myNbSeg[3] ));
 +
 +      double nbSideIdeal = totNbSeg / 4.;
 +      myQuartDiff = -( Min( Min( myNbSeg[0], myNbSeg[1] ),
 +                            Min( myNbSeg[2], myNbSeg[3] )) / nbSideIdeal );
 +
 +      theVariants.insert( *this );
 +
 +#ifndef _DEBUG_
 +      if ( theVariants.size() > 1 ) // erase a worse variant
 +        theVariants.erase( ++theVariants.begin() );
 +#endif
 +    };
 +
 +    // first criterion - equality of nbSeg of opposite sides
 +    int    crit1() const { return myOppDiff; }
 +
 +    // second criterion - equality of nbSeg of adjacent sides and sharpness of angles
 +    double crit2() const { return myQuartDiff + mySumAngle; }
 +
 +    bool operator () ( const QuadQuality& q1, const QuadQuality& q2) const
 +    {
 +      if ( q1.crit1() < q2.crit1() )
 +        return true;
 +      if ( q1.crit1() > q2.crit1() )
 +        return false;
 +      return q1.crit2() < q2.crit2();
 +    }
 +  };
 +
 +  //================================================================================
 +  /*!
 +   * \brief Unite EDGEs to get a required number of sides
 +   *  \param [in] theNbCorners - the required number of sides
 +   *  \param [in] theConsiderMesh - to considered only meshed VERTEXes
 +   *  \param [in] theFaceSide - the FACE EDGEs
 +   *  \param [out] theVertices - the found corner vertices
 +   */
 +  //================================================================================
 +
 +  void uniteEdges( const int                   theNbCorners,
 +                   const bool                  theConsiderMesh,
 +                   const StdMeshers_FaceSide&  theFaceSide,
 +                   const TopoDS_Shape&         theBaseVertex,
 +                   std::vector<TopoDS_Vertex>& theVertices,
 +                   bool&                       theHaveConcaveVertices)
 +  {
 +    // form a circular list of EDGEs
 +    std::vector< Edge > edges( theFaceSide.NbEdges() );
 +    boost::intrusive::circular_list_algorithms< Edge > circularList;
 +    circularList.init_header( &edges[0] );
 +    edges[0].myEdge       = theFaceSide.Edge( 0 );
 +    edges[0].myIndex      = 0;
 +    edges[0].myNbSegments = 0;
 +    for ( int i = 1; i < theFaceSide.NbEdges(); ++i )
 +    {
 +      edges[ i ].myEdge       = theFaceSide.Edge( i );
 +      edges[ i ].myIndex      = i;
 +      edges[ i ].myNbSegments = 0;
 +      circularList.link_after( &edges[ i-1 ], &edges[ i ] );
 +    }
 +    // remove degenerated edges
 +    int nbEdges = edges.size();
 +    Edge* edge0 = &edges[0];
 +    for ( size_t i = 0; i < edges.size(); ++i )
 +      if ( SMESH_Algo::isDegenerated( edges[i].myEdge ))
 +      {
 +        edge0 = circularList.unlink( &edges[i] );
 +        --nbEdges;
 +      }
 +
 +    // sort edges by angle
 +    std::multimap< double, Edge* > edgeByAngle;
 +    int i, iBase = -1, nbConvexAngles = 0, nbSharpAngles = 0;
 +    const double angTol     = 5. / 180 * M_PI;
 +    const double sharpAngle = 0.5 * M_PI - angTol;
 +    Edge* e = edge0;
 +    for ( i = 0; i < nbEdges; ++i, e = e->myNext )
 +    {
 +      e->my1stVertex = SMESH_MesherHelper::IthVertex( 0, e->myEdge );
 +      if ( e->my1stVertex.IsSame( theBaseVertex ))
 +        iBase = e->myIndex;
 +
 +      e->myAngle = -2 * M_PI;
 +      if ( !theConsiderMesh || theFaceSide.VertexNode( e->myIndex ))
 +      {
 +        e->myAngle = SMESH_MesherHelper::GetAngle( e->myPrev->myEdge, e->myEdge,
 +                                                   theFaceSide.Face(), e->my1stVertex );
 +        if ( e->myAngle > 2 * M_PI ) // GetAngle() failed
 +          e->myAngle *= -1.;
 +      }
 +      edgeByAngle.insert( std::make_pair( e->myAngle, e ));
 +      nbConvexAngles += ( e->myAngle > angTol );
 +      nbSharpAngles  += ( e->myAngle > sharpAngle );
 +    }
 +
 +    theHaveConcaveVertices = ( nbConvexAngles < nbEdges );
 +
 +    if ((int) theVertices.size() == theNbCorners )
 +      return;
 +
 +    theVertices.clear();
 +
 +    if ( !theConsiderMesh || theNbCorners < 4 ||
 +         nbConvexAngles <= theNbCorners ||
 +         nbSharpAngles  == theNbCorners )
 +    {
 +      if ( nbEdges == theNbCorners ) // return all vertices
 +      {
 +        for ( e = edge0; (int) theVertices.size() < theNbCorners; e = e->myNext )
 +          theVertices.push_back( e->my1stVertex );
 +        return;
 +      }
 +
 +      // return corners with maximal angles
 +
 +      std::set< int > cornerIndices;
 +      if ( iBase != -1 )
 +        cornerIndices.insert( iBase );
 +
 +      std::multimap< double, Edge* >::reverse_iterator a2e = edgeByAngle.rbegin();
 +      for (; (int) cornerIndices.size() < theNbCorners; ++a2e )
 +        cornerIndices.insert( a2e->second->myIndex );
 +
 +      std::set< int >::iterator i = cornerIndices.begin();
 +      for ( ; i != cornerIndices.end(); ++i )
 +        theVertices.push_back( edges[ *i ].my1stVertex );
 +
 +      return;
 +    }
 +
 +    // get nb of segments
 +    int totNbSeg = 0; // tatal nb segments
 +    std::vector<const SMDS_MeshNode*> nodes;
 +    for ( i = 0, e = edge0; i < nbEdges; ++i, e = e->myNext )
 +    {
 +      nodes.clear();
 +      theFaceSide.GetEdgeNodes( e->myIndex, nodes, /*addVertex=*/true, true );
 +      if ( nodes.size() == 2 && nodes[0] == nodes[1] ) // all nodes merged
 +      {
 +        e->myAngle = -1; // to remove
 +      }
 +      else
 +      {
 +        e->myNbSegments += nodes.size() - 1;
 +        totNbSeg        += nodes.size() - 1;
 +      }
 +
 +      // join with the previous edge those edges with concave angles
 +      if ( e->myAngle <= 0 )
 +      {
 +        e->myPrev->myNbSegments += e->myNbSegments;
 +        e = circularList.unlink( e )->myPrev;
 +        --nbEdges;
 +        --i;
 +      }
 +    }
 +
 +    if ( edge0->myNext->myPrev != edge0 ) // edge0 removed, find another edge0
 +      for ( size_t i = 0; i < edges.size(); ++i )
 +        if ( edges[i].myNext->myPrev == & edges[i] )
 +        {
 +          edge0 = &edges[i];
 +          break;
 +        }
 +
 +
 +    // sort different variants by quality
 +
 +    QuadQuality::set quadVariants;
 +
 +    // find index of a corner most opposite to corner of edge0
 +    int iOpposite0, nbHalf = 0;
 +    for ( e = edge0; nbHalf <= totNbSeg / 2; e = e->myNext )
 +      nbHalf += e->myNbSegments;
 +    iOpposite0 = e->myIndex;
 +
 +    // compose different variants of quadrangles
 +    QuadQuality quad;
 +    for ( ; edge0->myIndex != iOpposite0; edge0 = edge0->myNext )
 +    {
 +      quad.myCornerE[ 0 ] = edge0;
 +
 +      // find opposite corner 2
 +      for ( nbHalf = 0, e = edge0; nbHalf < totNbSeg / 2; e = e->myNext )
 +        nbHalf += e->myNbSegments;
 +      if ( e == edge0->myNext ) // no space for corner 1
 +        e = e->myNext;
 +      quad.myCornerE[ 2 ] = e;
 +
 +      bool moreVariants2 = ( totNbSeg % 2 || nbHalf != totNbSeg / 2 );
 +
 +      // enumerate different variants of corners 1 and 3
 +      for ( Edge* e1 = edge0->myNext; e1 != quad.myCornerE[ 2 ]; e1 = e1->myNext )
 +      {
 +        quad.myCornerE[ 1 ] = e1;
 +
 +        // find opposite corner 3
 +        for ( nbHalf = 0, e = e1; nbHalf < totNbSeg / 2; e = e->myNext )
 +          nbHalf += e->myNbSegments;
 +        if ( e == quad.myCornerE[ 2 ] )
 +          e = e->myNext;
 +        quad.myCornerE[ 3 ] = e;
 +
 +        bool moreVariants3 = ( totNbSeg % 2 || nbHalf != totNbSeg / 2 );
 +
 +        quad.AddSelf( quadVariants );
 +
 +        // another variants
 +        if ( moreVariants2 )
 +        {
 +          quad.myCornerE[ 2 ] = quad.myCornerE[ 2 ]->myPrev;
 +          quad.AddSelf( quadVariants );
 +          quad.myCornerE[ 2 ] = quad.myCornerE[ 2 ]->myNext;
 +        }
 +        if ( moreVariants3 )
 +        {
 +          quad.myCornerE[ 3 ] = quad.myCornerE[ 3 ]->myPrev;
 +          quad.AddSelf( quadVariants );
 +
 +          if ( moreVariants2 )
 +          {
 +            quad.myCornerE[ 2 ] = quad.myCornerE[ 2 ]->myPrev;
 +            quad.AddSelf( quadVariants );
 +            quad.myCornerE[ 2 ] = quad.myCornerE[ 2 ]->myNext;
 +          }
 +        }
 +      }
 +    }
 +
 +    const QuadQuality& bestQuad = *quadVariants.begin();
 +    theVertices.resize( 4 );
 +    theVertices[ 0 ] = bestQuad.myCornerE[ 0 ]->my1stVertex;
 +    theVertices[ 1 ] = bestQuad.myCornerE[ 1 ]->my1stVertex;
 +    theVertices[ 2 ] = bestQuad.myCornerE[ 2 ]->my1stVertex;
 +    theVertices[ 3 ] = bestQuad.myCornerE[ 3 ]->my1stVertex;
 +
 +    return;
 +  }
 +
 +} // namespace
 +
  //================================================================================
  /*!
 - * \brief Return true if only two given edges meat at their common vertex
 + * \brief Finds vertices at the most sharp face corners
 + *  \param [in] theFace - the FACE
 + *  \param [in,out] theWire - the ordered edges of the face. It can be modified to
 + *         have the first VERTEX of the first EDGE in \a vertices
 + *  \param [out] theVertices - the found corner vertices in the order corresponding to
 + *         the order of EDGEs in \a theWire
 + *  \param [out] theNbDegenEdges - nb of degenerated EDGEs in theFace
 + *  \param [in] theConsiderMesh - if \c true, only meshed VERTEXes are considered
 + *         as possible corners
 + *  \return int - number of quad sides found: 0, 3 or 4
   */
  //================================================================================
  
 -static bool twoEdgesMeatAtVertex(const TopoDS_Edge& e1,
 -                                 const TopoDS_Edge& e2,
 -                                 SMESH_Mesh &       mesh)
 +int StdMeshers_Quadrangle_2D::getCorners(const TopoDS_Face&          theFace,
 +                                         SMESH_Mesh &                theMesh,
 +                                         std::list<TopoDS_Edge>&     theWire,
 +                                         std::vector<TopoDS_Vertex>& theVertices,
 +                                         int &                       theNbDegenEdges,
 +                                         const bool                  theConsiderMesh)
  {
 -  TopoDS_Vertex v;
 -  if (!TopExp::CommonVertex(e1, e2, v))
 -    return false;
 -  TopTools_ListIteratorOfListOfShape ancestIt(mesh.GetAncestors(v));
 -  for (; ancestIt.More() ; ancestIt.Next())
 -    if (ancestIt.Value().ShapeType() == TopAbs_EDGE)
 -      if (!e1.IsSame(ancestIt.Value()) && !e2.IsSame(ancestIt.Value()))
 -        return false;
 -  return true;
 +  theNbDegenEdges = 0;
 +
 +  SMESH_MesherHelper helper( theMesh );
 +  if ( myHelper )
 +    helper.CopySubShapeInfo( *myHelper );
 +
 +  StdMeshers_FaceSide faceSide( theFace, theWire, &theMesh,
 +                                /*isFwd=*/true, /*skipMedium=*/true, &helper );
 +
 +  // count degenerated EDGEs and possible corner VERTEXes
 +  for ( int iE = 0; iE < faceSide.NbEdges(); ++iE )
 +  {
 +    if ( SMESH_Algo::isDegenerated( faceSide.Edge( iE )))
 +      ++theNbDegenEdges;
 +    else if ( !theConsiderMesh || faceSide.VertexNode( iE ))
 +      theVertices.push_back( faceSide.FirstVertex( iE ));
 +  }
 +
 +  // find out required nb of corners (3 or 4)
 +  int nbCorners = 4;
 +  TopoDS_Shape triaVertex = helper.GetMeshDS()->IndexToShape( myTriaVertexID );
 +  if ( !triaVertex.IsNull() &&
 +       triaVertex.ShapeType() == TopAbs_VERTEX &&
 +       helper.IsSubShape( triaVertex, theFace ) &&
 +       theVertices.size() != 4 )
 +    nbCorners = 3;
 +  else
 +    triaVertex.Nullify();
 +
 +  // check nb of available EDGEs
 +  if ( faceSide.NbEdges() < nbCorners )
 +    return error(COMPERR_BAD_SHAPE,
 +                 TComm("Face must have 4 sides but not ") << faceSide.NbEdges() );
 +
 +  if ( theConsiderMesh )
 +  {
 +    const int nbSegments = Max( faceSide.NbPoints()-1, faceSide.NbSegments() );
 +    if ( nbSegments < nbCorners )
 +      return error(COMPERR_BAD_INPUT_MESH, TComm("Too few boundary nodes: ") << nbSegments);
 +  }
 +
 +  if ( nbCorners == 3 )
 +  {
 +    if ( theVertices.size() < 3 )
 +      return error(COMPERR_BAD_SHAPE,
 +                   TComm("Face must have 3 meshed sides but not ") << theVertices.size() );
 +  }
 +  else // triaVertex not defined or invalid
 +  {
 +    if ( theVertices.size() == 3 && theNbDegenEdges == 0 )
 +    {
 +      if ( myTriaVertexID < 1 )
 +        return error(COMPERR_BAD_PARMETERS,
 +                     "No Base vertex provided for a trilateral geometrical face");
 +
 +      TComm comment("Invalid Base vertex: ");
 +      comment << myTriaVertexID << ", which is not in [ ";
 +      comment << helper.GetMeshDS()->ShapeToIndex( faceSide.FirstVertex(0) ) << ", ";
 +      comment << helper.GetMeshDS()->ShapeToIndex( faceSide.FirstVertex(1) ) << ", ";
 +      comment << helper.GetMeshDS()->ShapeToIndex( faceSide.FirstVertex(2) ) << " ]";
 +      return error(COMPERR_BAD_PARMETERS, comment );
 +    }
 +    if ( theVertices.size() + theNbDegenEdges < 4 )
 +      return error(COMPERR_BAD_SHAPE,
 +                   TComm("Face must have 4 meshed sides but not ") << theVertices.size() );
 +  }
 +
 +  myCheckOri = false;
 +  if ( theVertices.size() > 3 )
 +  {
 +    uniteEdges( nbCorners, theConsiderMesh, faceSide, triaVertex, theVertices, myCheckOri );
 +  }
 +
 +  if ( nbCorners == 3 && !triaVertex.IsSame( theVertices[0] ))
 +  {
 +    // make theVertices begin from triaVertex
 +    for ( size_t i = 0; i < theVertices.size(); ++i )
 +      if ( triaVertex.IsSame( theVertices[i] ))
 +      {
 +        theVertices.erase( theVertices.begin(), theVertices.begin() + i );
 +        break;
 +      }
 +      else
 +      {
 +        theVertices.push_back( theVertices[i] );
 +      }
 +  }
 +
 +  // make theWire begin from the 1st corner vertex
 +  while ( !theVertices[0].IsSame( helper.IthVertex( 0, theWire.front() )) ||
 +          SMESH_Algo::isDegenerated( theWire.front() ))
 +    theWire.splice( theWire.end(), theWire, theWire.begin() );
 +
 +  return nbCorners;
  }
  
  //=============================================================================
  /*!
 - *  
 + *
   */
  //=============================================================================
  
@@@ -4672,11 -4243,9 +4672,11 @@@ bool StdMeshers_Quadrangle_2D::check(
    {
      SMESH_subMesh* fSM = myHelper->GetMesh()->GetSubMesh( geomFace );
      SMESH_ComputeErrorPtr& err = fSM->GetComputeError();
 -    err.reset ( new SMESH_ComputeError( COMPERR_ALGO_FAILED,
 -                                        "Inverted elements generated"));
 -    err->myBadElements.swap( badFaces );
 +    SMESH_BadInputElements* badElems =
 +      new SMESH_BadInputElements( meshDS, COMPERR_ALGO_FAILED,
 +                                  "Inverted elements generated");
 +    badElems->myBadElements.swap( badFaces );
 +    err.reset( badElems );
  
      return !isOK;
    }
    return isOK;
  }
  
 -//================================================================================
 -/*!
 - * \brief Finds vertices at the most sharp face corners
 - *  \param [in] theFace - the FACE
 - *  \param [in,out] theWire - the ordered edges of the face. It can be modified to
 - *         have the first VERTEX of the first EDGE in \a vertices
 - *  \param [out] theVertices - the found corner vertices in the order corresponding to
 - *         the order of EDGEs in \a theWire
 - *  \param [out] theNbDegenEdges - nb of degenerated EDGEs in theFace
 - *  \param [in] theConsiderMesh - if \c true, only meshed VERTEXes are considered
 - *         as possible corners
 - *  \return int - number of quad sides found: 0, 3 or 4
 - */
 -//================================================================================
 -
 -int StdMeshers_Quadrangle_2D::getCorners(const TopoDS_Face&          theFace,
 -                                         SMESH_Mesh &                theMesh,
 -                                         std::list<TopoDS_Edge>&     theWire,
 -                                         std::vector<TopoDS_Vertex>& theVertices,
 -                                         int &                       theNbDegenEdges,
 -                                         const bool                  theConsiderMesh)
 -{
 -  theNbDegenEdges = 0;
 -
 -  SMESH_MesherHelper helper( theMesh );
 -  if ( myHelper )
 -    helper.CopySubShapeInfo( *myHelper );
 -  StdMeshers_FaceSide faceSide( theFace, theWire, &theMesh,
 -                                /*isFwd=*/true, /*skipMedium=*/true, &helper );
 -
 -  // sort theVertices by angle
 -  multimap<double, TopoDS_Vertex> vertexByAngle;
 -  TopTools_DataMapOfShapeReal     angleByVertex;
 -  TopoDS_Edge prevE = theWire.back();
 -  if ( SMESH_Algo::isDegenerated( prevE ))
 -  {
 -    list<TopoDS_Edge>::reverse_iterator edge = ++theWire.rbegin();
 -    while ( SMESH_Algo::isDegenerated( *edge ) /*|| helper.IsRealSeam( *edge )*/)
 -      ++edge;
 -    if ( edge == theWire.rend() )
 -      return false;
 -    prevE = *edge;
 -  }
 -  list<TopoDS_Edge>::iterator edge = theWire.begin();
 -  for ( int iE = 0; edge != theWire.end(); ++edge, ++iE )
 -  {
 -    if ( SMESH_Algo::isDegenerated( *edge ) /*|| helper.IsRealSeam( *edge )*/)
 -    {
 -      ++theNbDegenEdges;
 -      continue;
 -    }
 -    if ( !theConsiderMesh || faceSide.VertexNode( iE ))
 -    {
 -      TopoDS_Vertex v = helper.IthVertex( 0, *edge );
 -      double    angle = helper.GetAngle( prevE, *edge, theFace, v );
 -      vertexByAngle.insert( make_pair( angle, v ));
 -      angleByVertex.Bind( v, angle );
 -    }
 -    prevE = *edge;
 -  }
 -
 -  // find out required nb of corners (3 or 4)
 -  int nbCorners = 4;
 -  TopoDS_Shape triaVertex = helper.GetMeshDS()->IndexToShape( myTriaVertexID );
 -  if ( !triaVertex.IsNull() &&
 -       triaVertex.ShapeType() == TopAbs_VERTEX &&
 -       helper.IsSubShape( triaVertex, theFace ) &&
 -       ( vertexByAngle.size() != 4 || vertexByAngle.begin()->first < 5 * M_PI/180. ))
 -    nbCorners = 3;
 -  else
 -    triaVertex.Nullify();
 -
 -  // check nb of available corners
 -  if ( faceSide.NbEdges() < nbCorners )
 -    return error(COMPERR_BAD_SHAPE,
 -                 TComm("Face must have 4 sides but not ") << faceSide.NbEdges() );
 -
 -  if ( theConsiderMesh )
 -  {
 -    const int nbSegments = Max( faceSide.NbPoints()-1, faceSide.NbSegments() );
 -    if ( nbSegments < nbCorners )
 -      return error(COMPERR_BAD_INPUT_MESH, TComm("Too few boundary nodes: ") << nbSegments);
 -  }
 -
 -  if ( nbCorners == 3 )
 -  {
 -    if ( vertexByAngle.size() < 3 )
 -      return error(COMPERR_BAD_SHAPE,
 -                   TComm("Face must have 3 sides but not ") << vertexByAngle.size() );
 -  }
 -  else
 -  {
 -    if ( vertexByAngle.size() == 3 && theNbDegenEdges == 0 )
 -    {
 -      if ( myTriaVertexID < 1 )
 -        return error(COMPERR_BAD_PARMETERS,
 -                     "No Base vertex provided for a trilateral geometrical face");
 -        
 -      TComm comment("Invalid Base vertex: ");
 -      comment << myTriaVertexID << " its ID is not among [ ";
 -      multimap<double, TopoDS_Vertex>::iterator a2v = vertexByAngle.begin();
 -      comment << helper.GetMeshDS()->ShapeToIndex( a2v->second ) << ", "; a2v++;
 -      comment << helper.GetMeshDS()->ShapeToIndex( a2v->second ) << ", "; a2v++;
 -      comment << helper.GetMeshDS()->ShapeToIndex( a2v->second ) << " ]";
 -      return error(COMPERR_BAD_PARMETERS, comment );
 -    }
 -    if ( vertexByAngle.size() + ( theNbDegenEdges > 0 ) < 4 &&
 -         vertexByAngle.size() + theNbDegenEdges != 4 )
 -      return error(COMPERR_BAD_SHAPE,
 -                   TComm("Face must have 4 sides but not ") << vertexByAngle.size() );
 -  }
 -
 -  // put all corner vertices in a map
 -  TopTools_MapOfShape vMap;
 -  if ( nbCorners == 3 )
 -    vMap.Add( triaVertex );
 -  multimap<double, TopoDS_Vertex>::reverse_iterator a2v = vertexByAngle.rbegin();
 -  for ( int iC = 0; a2v != vertexByAngle.rend() && iC < nbCorners; ++a2v, ++iC )
 -    vMap.Add( (*a2v).second );
 -
 -  // check if there are possible variations in choosing corners
 -  bool haveVariants = false;
 -  if ((int) vertexByAngle.size() > nbCorners )
 -  {
 -    double lostAngle = a2v->first;
 -    double lastAngle = ( --a2v, a2v->first );
 -    haveVariants  = ( lostAngle * 1.1 >= lastAngle );
 -  }
 -
 -  const double angleTol = 5.* M_PI/180;
 -  myCheckOri = ( (int)vertexByAngle.size() > nbCorners ||
 -                 vertexByAngle.begin()->first < angleTol );
 -
 -  // make theWire begin from a corner vertex or triaVertex
 -  if ( nbCorners == 3 )
 -    while ( !triaVertex.IsSame( ( helper.IthVertex( 0, theWire.front() ))) ||
 -            SMESH_Algo::isDegenerated( theWire.front() ))
 -      theWire.splice( theWire.end(), theWire, theWire.begin() );
 -  else
 -    while ( !vMap.Contains( helper.IthVertex( 0, theWire.front() )) ||
 -            SMESH_Algo::isDegenerated( theWire.front() ))
 -      theWire.splice( theWire.end(), theWire, theWire.begin() );
 -
 -  // fill the result vector and prepare for its refinement
 -  theVertices.clear();
 -  vector< double >      angles;
 -  vector< TopoDS_Edge > edgeVec;
 -  vector< int >         cornerInd, nbSeg;
 -  int nbSegTot = 0;
 -  angles .reserve( vertexByAngle.size() );
 -  edgeVec.reserve( vertexByAngle.size() );
 -  nbSeg  .reserve( vertexByAngle.size() );
 -  cornerInd.reserve( nbCorners );
 -  for ( edge = theWire.begin(); edge != theWire.end(); ++edge )
 -  {
 -    if ( SMESH_Algo::isDegenerated( *edge ))
 -      continue;
 -    TopoDS_Vertex v = helper.IthVertex( 0, *edge );
 -    bool   isCorner = vMap.Contains( v );
 -    if ( isCorner )
 -    {
 -      theVertices.push_back( v );
 -      cornerInd.push_back( angles.size() );
 -    }
 -    angles .push_back( angleByVertex.IsBound( v ) ? angleByVertex( v ) : -M_PI );
 -    edgeVec.push_back( *edge );
 -    if ( theConsiderMesh && haveVariants )
 -    {
 -      if ( SMESHDS_SubMesh* sm = helper.GetMeshDS()->MeshElements( *edge ))
 -        nbSeg.push_back( sm->NbNodes() + 1 );
 -      else
 -        nbSeg.push_back( 0 );
 -      nbSegTot += nbSeg.back();
 -    }
 -  }
 -
 -  // refine the result vector - make sides equal by length if
 -  // there are several equal angles
 -  if ( haveVariants )
 -  {
 -    if ( nbCorners == 3 )
 -      angles[0] = 2 * M_PI; // not to move the base triangle VERTEX
 -
 -    // here we refer to VERTEX'es and EDGEs by indices in angles and edgeVec vectors
 -    typedef int TGeoIndex;
 -
 -    // for each vertex find a vertex till which there are nbSegHalf segments
 -    const int nbSegHalf = ( nbSegTot % 2 || nbCorners == 3 ) ? 0 : nbSegTot / 2;
 -    vector< TGeoIndex > halfDivider( angles.size(), -1 );
 -    int nbHalfDividers = 0;
 -    if ( nbSegHalf )
 -    {
 -      // get min angle of corners
 -      double minAngle = 10.;
 -      for ( size_t iC = 0; iC < cornerInd.size(); ++iC )
 -        minAngle = Min( minAngle, angles[ cornerInd[ iC ]]);
 -
 -      // find halfDivider's
 -      for ( TGeoIndex iV1 = 0; iV1 < TGeoIndex( angles.size() ); ++iV1 )
 -      {
 -        int nbSegs = 0;
 -        TGeoIndex iV2 = iV1;
 -        do {
 -          nbSegs += nbSeg[ iV2 ];
 -          iV2 = helper.WrapIndex( iV2 + 1, nbSeg.size() );
 -        } while ( nbSegs < nbSegHalf );
 -
 -        if ( nbSegs == nbSegHalf &&
 -             angles[ iV1 ] + angleTol >= minAngle &&
 -             angles[ iV2 ] + angleTol >= minAngle )
 -        {
 -          halfDivider[ iV1 ] = iV2;
 -          ++nbHalfDividers;
 -        }
 -      }
 -    }
 -
 -    set< TGeoIndex > refinedCorners, treatedCorners;
 -    for ( size_t iC = 0; iC < cornerInd.size(); ++iC )
 -    {
 -      TGeoIndex iV = cornerInd[iC];
 -      if ( !treatedCorners.insert( iV ).second )
 -        continue;
 -      list< TGeoIndex > equVerts; // inds of vertices that can become corners
 -      equVerts.push_back( iV );
 -      int nbC[2] = { 0, 0 };
 -      // find equal angles backward and forward from the iV-th corner vertex
 -      for ( int isFwd = 0; isFwd < 2; ++isFwd )
 -      {
 -        int           dV = isFwd ? +1 : -1;
 -        int       iCNext = helper.WrapIndex( iC + dV, cornerInd.size() );
 -        TGeoIndex iVNext = helper.WrapIndex( iV + dV, angles.size() );
 -        while ( iVNext != iV )
 -        {
 -          bool equal = Abs( angles[iV] - angles[iVNext] ) < angleTol;
 -          if ( equal )
 -            equVerts.insert( isFwd ? equVerts.end() : equVerts.begin(), iVNext );
 -          if ( iVNext == cornerInd[ iCNext ])
 -          {
 -            if ( !equal )
 -            {
 -              if ( angles[iV] < angles[iVNext] )
 -                refinedCorners.insert( iVNext );
 -              break;
 -            }
 -            nbC[ isFwd ]++;
 -            treatedCorners.insert( cornerInd[ iCNext ] );
 -            iCNext = helper.WrapIndex( iCNext + dV, cornerInd.size() );
 -          }
 -          iVNext = helper.WrapIndex( iVNext + dV, angles.size() );
 -        }
 -        if ( iVNext == iV )
 -          break; // all angles equal
 -      }
 -
 -      const bool allCornersSame = ( nbC[0] == 3 );
 -      if ( allCornersSame && nbHalfDividers > 0 )
 -      {
 -        // select two halfDivider's as corners
 -        TGeoIndex hd1, hd2 = -1;
 -        size_t iC2;
 -        for ( iC2 = 0; iC2 < cornerInd.size() && hd2 < 0; ++iC2 )
 -        {
 -          hd1 = cornerInd[ iC2 ];
 -          hd2 = halfDivider[ hd1 ];
 -          if ( std::find( equVerts.begin(), equVerts.end(), hd2 ) == equVerts.end() )
 -            hd2 = -1; // hd2-th vertex can't become a corner
 -          else
 -            break;
 -        }
 -        if ( hd2 >= 0 )
 -        {
 -          angles[ hd1 ] = 2 * M_PI; // make hd1-th vertex no more "equal"
 -          angles[ hd2 ] = 2 * M_PI;
 -          refinedCorners.insert( hd1 );
 -          refinedCorners.insert( hd2 );
 -          treatedCorners = refinedCorners;
 -          // update cornerInd
 -          equVerts.push_front( equVerts.back() );
 -          equVerts.push_back( equVerts.front() );
 -          list< TGeoIndex >::iterator hdPos =
 -            std::find( equVerts.begin(), equVerts.end(), hd2 );
 -          if ( hdPos == equVerts.end() ) break;
 -          cornerInd[ helper.WrapIndex( iC2 + 0, cornerInd.size()) ] = hd1;
 -          cornerInd[ helper.WrapIndex( iC2 + 1, cornerInd.size()) ] = *( --hdPos );
 -          cornerInd[ helper.WrapIndex( iC2 + 2, cornerInd.size()) ] = hd2;
 -          cornerInd[ helper.WrapIndex( iC2 + 3, cornerInd.size()) ] = *( ++hdPos, ++hdPos );
 -
 -          theVertices[ 0 ] = helper.IthVertex( 0, edgeVec[ cornerInd[0] ]);
 -          theVertices[ 1 ] = helper.IthVertex( 0, edgeVec[ cornerInd[1] ]);
 -          theVertices[ 2 ] = helper.IthVertex( 0, edgeVec[ cornerInd[2] ]);
 -          theVertices[ 3 ] = helper.IthVertex( 0, edgeVec[ cornerInd[3] ]);
 -          iC = -1;
 -          continue;
 -        }
 -      }
 -
 -      // move corners to make sides equal by length
 -      int nbEqualV  = equVerts.size();
 -      int nbExcessV = nbEqualV - ( 1 + nbC[0] + nbC[1] );
 -      if ( nbExcessV > 0 ) // there are nbExcessV vertices that can become corners
 -      {
 -        // calculate normalized length of each "side" enclosed between neighbor equVerts
 -        vector< double > accuLength;
 -        double totalLen = 0;
 -        vector< TGeoIndex > evVec( equVerts.begin(), equVerts.end() );
 -        size_t      iEV = 0;
 -        TGeoIndex    iE = cornerInd[ helper.WrapIndex( iC - nbC[0] - 1, cornerInd.size() )];
 -        TGeoIndex iEEnd = cornerInd[ helper.WrapIndex( iC + nbC[1] + 1, cornerInd.size() )];
 -        while ((int) accuLength.size() < nbEqualV + int( !allCornersSame ) )
 -        {
 -          // accumulate length of edges before iEV-th equal vertex
 -          accuLength.push_back( totalLen );
 -          do {
 -            accuLength.back() += SMESH_Algo::EdgeLength( edgeVec[ iE ]);
 -            iE = helper.WrapIndex( iE + 1, edgeVec.size());
 -            if ( iEV < evVec.size() && iE == evVec[ iEV ] ) {
 -              iEV++;
 -              break; // equal vertex reached
 -            }
 -          }
 -          while( iE != iEEnd );
 -          totalLen = accuLength.back();
 -        }
 -        accuLength.resize( equVerts.size() );
 -        for ( size_t iS = 0; iS < accuLength.size(); ++iS )
 -          accuLength[ iS ] /= totalLen;
 -
 -        // find equVerts most close to the ideal sub-division of all sides
 -        int iBestEV = 0;
 -        int iCorner = helper.WrapIndex( iC - nbC[0], cornerInd.size() );
 -        int nbSides = Min( nbCorners, 2 + nbC[0] + nbC[1] );
 -        for ( int iS = 1; iS < nbSides; ++iS, ++iBestEV )
 -        {
 -          double idealLen = iS / double( nbSides );
 -          double d, bestDist = 2.;
 -          for ( iEV = iBestEV; iEV < accuLength.size(); ++iEV )
 -          {
 -            d = Abs( idealLen - accuLength[ iEV ]);
 -
 -            // take into account presence of a corresponding halfDivider
 -            const double cornerWgt = 0.5  / nbSides;
 -            const double vertexWgt = 0.25 / nbSides;
 -            TGeoIndex hd = halfDivider[ evVec[ iEV ]];
 -            if ( hd < 0 )
 -              d += vertexWgt;
 -            else if( refinedCorners.count( hd ))
 -              d -= cornerWgt;
 -            else
 -              d -= vertexWgt;
 -
 -            // choose vertex with the best d
 -            if ( d < bestDist )
 -            {
 -              bestDist = d;
 -              iBestEV  = iEV;
 -            }
 -          }
 -          if ( iBestEV > iS-1 + nbExcessV )
 -            iBestEV = iS-1 + nbExcessV;
 -          theVertices[ iCorner ] = helper.IthVertex( 0, edgeVec[ evVec[ iBestEV ]]);
 -          cornerInd  [ iCorner ] = evVec[ iBestEV ];
 -          refinedCorners.insert( evVec[ iBestEV ]);
 -          iCorner = helper.WrapIndex( iCorner + 1, cornerInd.size() );
 -        }
 -
 -      } // if ( nbExcessV > 0 )
 -      else
 -      {
 -        refinedCorners.insert( cornerInd[ iC ]);
 -      }
 -    } // loop on cornerInd
 -
 -    // make theWire begin from the cornerInd[0]-th EDGE
 -    while ( !theWire.front().IsSame( edgeVec[ cornerInd[0] ]))
 -      theWire.splice( theWire.begin(), theWire, --theWire.end() );
 -
 -  } // if ( haveVariants )
 -
 -  return nbCorners;
 -}
 -
  //================================================================================
  /*!
   * \brief Constructor of a side of quad
index 8d165c8e5f836ed11efaeb23afc630987a1a860e,56e73fc770a85e139cb9a5c8e914f5447e696657..82de8c6bbac814b92bbdaaa3cbe5df389e8db2e7
@@@ -74,9 -74,8 +74,8 @@@ using namespace std
  //=======================================================================
  
  StdMeshers_RadialQuadrangle_1D2D::StdMeshers_RadialQuadrangle_1D2D(int        hypId,
-                                                                    int        studyId,
                                                                     SMESH_Gen* gen)
-   :StdMeshers_Quadrangle_2D( hypId, studyId, gen )
+   :StdMeshers_Quadrangle_2D( hypId, gen )
  {
    _name = "RadialQuadrangle_1D2D";
    _shapeType = (1 << TopAbs_FACE);        // 1 bit per shape type
@@@ -631,7 -630,7 +630,7 @@@ public
      const int myID = -1001;
      TNodeDistributor* myHyp = dynamic_cast<TNodeDistributor*>( aMesh.GetHypothesis( myID ));
      if ( !myHyp )
-       myHyp = new TNodeDistributor( myID, 0, aMesh.GetGen() );
+       myHyp = new TNodeDistributor( myID, aMesh.GetGen() );
      return myHyp;
    }
    // -----------------------------------------------------------------------------
      return true;
    }
    // -----------------------------------------------------------------------------
 -  //! Make mesh on an adge using assigned 1d hyp or default nb of segments
 +  //! Make mesh on an edge using assigned 1d hyp or default nb of segments
    bool ComputeCircularEdge( SMESH_Mesh&                   aMesh,
                              const StdMeshers_FaceSidePtr& aSide )
    {
      return ok;
    }
    // -----------------------------------------------------------------------------
 -  //! Make mesh on an adge using assigned 1d hyp or default nb of segments
 +  //! Make mesh on an edge using assigned 1d hyp or default nb of segments
    bool EvaluateCircularEdge(SMESH_Mesh&                  aMesh,
                              const StdMeshers_FaceSidePtr aSide,
                              MapShapeNbElems&             aResMap)
    }
  protected:
    // -----------------------------------------------------------------------------
-   TNodeDistributor( int hypId, int studyId, SMESH_Gen* gen)
-     : StdMeshers_Regular_1D( hypId, studyId, gen)
+   TNodeDistributor( int hypId, SMESH_Gen* gen)
+     : StdMeshers_Regular_1D( hypId, gen)
    {
    }
    // -----------------------------------------------------------------------------
index 72cdff35f606d09c861ff43f409bcac402f22ddf,475a7cef1d7f469029920d90fde530ecf9bbce53..fd68c0b2f242a0efa4606c71c165840cfebe969e
@@@ -27,7 -27,6 +27,7 @@@
  #include "SMDS_FaceOfNodes.hxx"
  #include "SMDS_FacePosition.hxx"
  #include "SMDS_MeshNode.hxx"
 +#include "SMDS_PolygonalFaceOfNodes.hxx"
  #include "SMDS_SetIterator.hxx"
  #include "SMESHDS_Group.hxx"
  #include "SMESHDS_Hypothesis.hxx"
@@@ -94,7 -93,6 +94,7 @@@
  #include <list>
  #include <queue>
  #include <string>
 +#include <unordered_map>
  
  #ifdef _DEBUG_
  #define __myDEBUG
@@@ -662,8 -660,7 +662,8 @@@ namespace VISCOUS_3
      vector< _EdgesOnShape* > _eosConcaVer; // edges at concave VERTEXes of a FACE
      vector< _EdgesOnShape* > _eosC1; // to smooth together several C1 continues shapes
  
 -    vector< gp_XYZ >         _faceNormals; // if _shape is FACE
 +    typedef std::unordered_map< const SMDS_MeshElement*, gp_XYZ > TFace2NormMap;
 +    TFace2NormMap            _faceNormals; // if _shape is FACE
      vector< _EdgesOnShape* > _faceEOS; // to get _faceNormals of adjacent FACEs
  
      Handle(ShapeAnalysis_Surface) _offsetSurf;
     * We can't use SMDS_FaceOfNodes since it's impossible to set it's ID which is
     * needed because SMESH_ElementSearcher internaly uses set of elements sorted by ID
     */
 -  struct _TmpMeshFace : public SMDS_MeshElement
 +  struct _TmpMeshFace : public SMDS_PolygonalFaceOfNodes
    {
 -    vector<const SMDS_MeshNode* > _nn;
 +    const SMDS_MeshElement* _srcFace;
 +
      _TmpMeshFace( const vector<const SMDS_MeshNode*>& nodes,
 -                  int id, int faceID=-1, int idInFace=-1):
 -      SMDS_MeshElement(id), _nn(nodes) { setShapeId(faceID); setIdInShape(idInFace); }
 -    virtual const SMDS_MeshNode* GetNode(const int ind) const { return _nn[ind]; }
 -    virtual SMDSAbs_ElementType  GetType() const              { return SMDSAbs_Face; }
 -    virtual vtkIdType GetVtkType() const                      { return -1; }
 -    virtual SMDSAbs_EntityType   GetEntityType() const        { return SMDSEntity_Last; }
 -    virtual SMDSAbs_GeometryType GetGeomType() const
 -    { return _nn.size() == 3 ? SMDSGeom_TRIANGLE : SMDSGeom_QUADRANGLE; }
 -    virtual SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType) const
 -    { return SMDS_ElemIteratorPtr( new SMDS_NodeVectorElemIterator( _nn.begin(), _nn.end()));}
 +                  int                                 ID,
 +                  int                                 faceID=-1,
 +                  const SMDS_MeshElement*             srcFace=0 ):
 +      SMDS_PolygonalFaceOfNodes(nodes), _srcFace( srcFace ) { setID( ID ); setShapeID( faceID ); }
 +    virtual SMDSAbs_EntityType  GetEntityType() const
 +    { return _srcFace ? _srcFace->GetEntityType() : SMDSEntity_Quadrangle; }
 +    virtual SMDSAbs_GeometryType GetGeomType()  const
 +    { return _srcFace ? _srcFace->GetGeomType() : SMDSGeom_QUADRANGLE; }
    };
    //--------------------------------------------------------------------------------
    /*!
 -   * \brief Class of temporary mesh face storing _LayerEdge it's based on
 +   * \brief Class of temporary mesh quadrangle face storing _LayerEdge it's based on
     */
    struct _TmpMeshFaceOnEdge : public _TmpMeshFace
    {
      _TmpMeshFaceOnEdge( _LayerEdge* le1, _LayerEdge* le2, int ID ):
        _TmpMeshFace( vector<const SMDS_MeshNode*>(4), ID ), _le1(le1), _le2(le2)
      {
 -      _nn[0]=_le1->_nodes[0];
 -      _nn[1]=_le1->_nodes.back();
 -      _nn[2]=_le2->_nodes.back();
 -      _nn[3]=_le2->_nodes[0];
 +      myNodes[0]=_le1->_nodes[0];
 +      myNodes[1]=_le1->_nodes.back();
 +      myNodes[2]=_le2->_nodes.back();
 +      myNodes[3]=_le2->_nodes[0];
 +    }
 +    const SMDS_MeshNode* n( size_t i ) const
 +    {
 +      return myNodes[ i ];
      }
      gp_XYZ GetDir() const // return average direction of _LayerEdge's, normal to EDGE
      {
 -      SMESH_TNodeXYZ p0s( _nn[0] );
 -      SMESH_TNodeXYZ p0t( _nn[1] );
 -      SMESH_TNodeXYZ p1t( _nn[2] );
 -      SMESH_TNodeXYZ p1s( _nn[3] );
 +      SMESH_TNodeXYZ p0s( myNodes[0] );
 +      SMESH_TNodeXYZ p0t( myNodes[1] );
 +      SMESH_TNodeXYZ p1t( myNodes[2] );
 +      SMESH_TNodeXYZ p1s( myNodes[3] );
        gp_XYZ  v0 = p0t - p0s;
        gp_XYZ  v1 = p1t - p1s;
        gp_XYZ v01 = p1s - p0s;
      }
      gp_XYZ GetDir(_LayerEdge* le1, _LayerEdge* le2) // return average direction of _LayerEdge's
      {
 -      _nn[0]=le1->_nodes[0];
 -      _nn[1]=le1->_nodes.back();
 -      _nn[2]=le2->_nodes.back();
 -      _nn[3]=le2->_nodes[0];
 +      myNodes[0]=le1->_nodes[0];
 +      myNodes[1]=le1->_nodes.back();
 +      myNodes[2]=le2->_nodes.back();
 +      myNodes[3]=le2->_nodes[0];
        return GetDir();
      }
    };
  //================================================================================
  // StdMeshers_ViscousLayers hypothesis
  //
- StdMeshers_ViscousLayers::StdMeshers_ViscousLayers(int hypId, int studyId, SMESH_Gen* gen)
-   :SMESH_Hypothesis(hypId, studyId, gen),
+ StdMeshers_ViscousLayers::StdMeshers_ViscousLayers(int hypId, SMESH_Gen* gen)
+   :SMESH_Hypothesis(hypId, gen),
     _isToIgnoreShapes(1), _nbLayers(1), _thickness(1), _stretchFactor(1),
     _method( SURF_OFFSET_SMOOTH )
  {
@@@ -1694,8 -1688,8 +1694,8 @@@ namespace VISCOUS_3
        py = _pyStream = new ofstream(fname);
        *py << "import SMESH" << endl
            << "from salome.smesh import smeshBuilder" << endl
-           << "smesh  = smeshBuilder.New(salome.myStudy)" << endl
-           << "meshSO = smesh.GetCurrentStudy().FindObjectID('0:1:2:" << tag <<"')" << endl
+           << "smesh  = smeshBuilder.New()" << endl
+           << "meshSO = salome.myStudy.FindObjectID('0:1:2:" << tag <<"')" << endl
            << "mesh   = smesh.Mesh( meshSO.GetObject() )"<<endl;
        theNbPyFunc = 0;
      }
@@@ -2647,7 -2641,7 +2647,7 @@@ bool _ViscousBuilder::makeLayer(_SolidD
  
        // create a temporary face
        const SMDS_MeshElement* newFace =
 -        new _TmpMeshFace( newNodes, --_tmpFaceID, face->getshapeId(), face->getIdInShape() );
 +        new _TmpMeshFace( newNodes, --_tmpFaceID, face->GetShapeID(), face );
        proxySub->AddElement( newFace );
  
        // compute inflation step size by min size of element on a convex surface
@@@ -3319,18 -3313,19 +3319,18 @@@ void _ViscousBuilder::setShapeData( _Ed
      {
        SMESHDS_SubMesh* smDS = sm->GetSubMeshDS();
        if ( !smDS ) return;
 -      eos._faceNormals.resize( smDS->NbElements() );
 +      eos._faceNormals.reserve( smDS->NbElements() );
  
 +      double oriFactor = helper.IsReversedSubMesh( TopoDS::Face( eos._shape )) ? 1.: -1.;
        SMDS_ElemIteratorPtr eIt = smDS->GetElements();
 -      for ( int iF = 0; eIt->more(); ++iF )
 +      for ( ; eIt->more(); )
        {
          const SMDS_MeshElement* face = eIt->next();
 -        if ( !SMESH_MeshAlgos::FaceNormal( face, eos._faceNormals[iF], /*normalized=*/true ))
 -          eos._faceNormals[iF].SetCoord( 0,0,0 );
 +        gp_XYZ&                 norm = eos._faceNormals[face];
 +        if ( !SMESH_MeshAlgos::FaceNormal( face, norm, /*normalized=*/true ))
 +          norm.SetCoord( 0,0,0 );
 +        norm *= oriFactor;
        }
 -
 -      if ( !helper.IsReversedSubMesh( TopoDS::Face( eos._shape )))
 -        for ( size_t iF = 0; iF < eos._faceNormals.size(); ++iF )
 -          eos._faceNormals[iF].Reverse();
      }
      else // find EOS of adjacent FACEs
      {
  bool _EdgesOnShape::GetNormal( const SMDS_MeshElement* face, gp_Vec& norm )
  {
    bool ok = false;
 -  const _EdgesOnShape* eos = 0;
 +  _EdgesOnShape* eos = 0;
  
    if ( face->getshapeId() == _shapeID )
    {
    }
  
    if (( eos ) &&
 -      ( ok = ( face->getIdInShape() < (int) eos->_faceNormals.size() )))
 +      ( ok = ( eos->_faceNormals.count( face ) )))
    {
 -    norm = eos->_faceNormals[ face->getIdInShape() ];
 +    norm = eos->_faceNormals[ face ];
    }
    else if ( !eos )
    {
@@@ -3610,7 -3605,7 +3610,7 @@@ bool _ViscousBuilder::setEdgeData(_Laye
    {
      const SMDS_MeshNode* tgtNode = edge._nodes.back();
      if ( SMESHDS_SubMesh* sm = getMeshDS()->MeshElements( data._solid ))
 -      sm->RemoveNode( tgtNode , /*isNodeDeleted=*/false );
 +      sm->RemoveNode( tgtNode );
  
      // set initial position which is parameters on _sWOL in this case
      if ( eos.SWOLType() == TopAbs_EDGE )
@@@ -5112,13 -5107,14 +5112,13 @@@ bool _ViscousBuilder::smoothAndCheck(_S
            eos._edges[i]->Set( _LayerEdge::INTERSECTED ); // not to intersect
            eos._edges[i]->Block( data );                  // not to inflate
  
 -          if ( _EdgesOnShape* eof = data.GetShapeEdges( intFace->getshapeId() ))
 +          //if ( _EdgesOnShape* eof = data.GetShapeEdges( intFace->getshapeId() ))
            {
              // block _LayerEdge's, on top of which intFace is
              if ( const _TmpMeshFace* f = dynamic_cast< const _TmpMeshFace*>( intFace ))
              {
 -              const SMDS_MeshElement* srcFace =
 -                eof->_subMesh->GetSubMeshDS()->GetElement( f->getIdInShape() );
 -              SMDS_ElemIteratorPtr nIt = srcFace->nodesIterator();
 +              const SMDS_MeshElement* srcFace = f->_srcFace;
 +              SMDS_ElemIteratorPtr        nIt = srcFace->nodesIterator();
                while ( nIt->more() )
                {
                  const SMDS_MeshNode* srcNode = static_cast<const SMDS_MeshNode*>( nIt->next() );
@@@ -5785,7 -5781,7 +5785,7 @@@ bool _Smoother1D::smoothAnalyticEdge( _
            tgtNode->setXYZ( newPos.X(), newPos.Y(), newPos.Z() );
            dumpMove( tgtNode );
  
 -          SMDS_FacePosition* pos = static_cast<SMDS_FacePosition*>( tgtNode->GetPosition() );
 +          SMDS_FacePositionPtr pos = tgtNode->GetPosition();
            pos->SetUParameter( newUV.X() );
            pos->SetVParameter( newUV.Y() );
  
          tgtNode->setXYZ( newPos.X(), newPos.Y(), newPos.Z() );
          dumpMove( tgtNode );
  
 -        SMDS_FacePosition* pos = static_cast<SMDS_FacePosition*>( tgtNode->GetPosition() );
 +        SMDS_FacePositionPtr pos = tgtNode->GetPosition();
          pos->SetUParameter( newUV.X() );
          pos->SetVParameter( newUV.Y() );
  
@@@ -6505,10 -6501,10 +6505,10 @@@ void _SolidData::PrepareEdgesToSmoothOn
      {
        edge->Set( _LayerEdge::SMOOTHED_C1 );
        isCurved = true;
 -      SMDS_FacePosition* fPos = dynamic_cast<SMDS_FacePosition*>( edge->_nodes[0]->GetPosition() );
 +      SMDS_FacePositionPtr fPos = edge->_nodes[0]->GetPosition();
        if ( !fPos )
          for ( size_t iS = 0; iS < edge->_simplices.size()  &&  !fPos; ++iS )
 -          fPos = dynamic_cast<SMDS_FacePosition*>( edge->_simplices[iS]._nPrev->GetPosition() );
 +          fPos = edge->_simplices[iS]._nPrev->GetPosition();
        if ( fPos )
          edge->_curvature->_uv.SetCoord( fPos->GetUParameter(), fPos->GetVParameter() );
      }
@@@ -6805,9 -6801,9 +6805,9 @@@ void _ViscousBuilder::findCollisionEdge
                ( f->_le2->IsOnEdge() && f->_le2->_2neibors->include( edge )))  continue;
          }
          dist1 = dist2 = Precision::Infinite();
 -        if ( !edge->SegTriaInter( lastSegment, f->_nn[0], f->_nn[1], f->_nn[2], dist1, eps ))
 +        if ( !edge->SegTriaInter( lastSegment, f->n(0), f->n(1), f->n(2), dist1, eps ))
            dist1 = Precision::Infinite();
 -        if ( !edge->SegTriaInter( lastSegment, f->_nn[3], f->_nn[2], f->_nn[0], dist2, eps ))
 +        if ( !edge->SegTriaInter( lastSegment, f->n(3), f->n(2), f->n(0), dist2, eps ))
            dist2 = Precision::Infinite();
          if (( dist1 > segLen ) && ( dist2 > segLen ))
            continue;
          if ( edge->IsOnEdge() )
          {
            // skip perpendicular EDGEs
 -          gp_Vec fSegDir  = SMESH_TNodeXYZ( f->_nn[0] ) - SMESH_TNodeXYZ( f->_nn[3] );
 +          gp_Vec fSegDir  = SMESH_TNodeXYZ( f->n(0) ) - SMESH_TNodeXYZ( f->n(3) );
            bool isParallel = ( isLessAngle( eSegDir0, fSegDir, angle45 ) ||
                                isLessAngle( eSegDir1, fSegDir, angle45 ) ||
                                isLessAngle( eSegDir0, fSegDir.Reversed(), angle45 ) ||
@@@ -8251,7 -8247,7 +8251,7 @@@ void _LayerEdge::MoveNearConcaVer( cons
      prevPosV = surface.Value( prevPosV.X(), prevPosV.Y() ).XYZ();
    }
  
 -  SMDS_FacePosition* fPos;
 +  SMDS_FacePositionPtr fPos;
    //double r = 1. - Min( 0.9, step / 10. );
    for ( set< _LayerEdge* >::iterator e = edges.begin(); e != edges.end(); ++e )
    {
  
      // set _curvature to make edgeF updated by putOnOffsetSurface()
      if ( !edgeF->_curvature )
 -      if (( fPos = dynamic_cast<SMDS_FacePosition*>( edgeF->_nodes[0]->GetPosition() )))
 +      if (( fPos = edgeF->_nodes[0]->GetPosition() ))
        {
          edgeF->_curvature = new _Curvature;
          edgeF->_curvature->_r = 0;
@@@ -8775,7 -8771,7 +8775,7 @@@ void _LayerEdge::ChooseSmooFunction( co
        }
      }
  
 -    // // this coice is done only if ( !concaveVertices.empty() ) for Grids/smesh/bugs_19/X1
 +    // // this choice is done only if ( !concaveVertices.empty() ) for Grids/smesh/bugs_19/X1
      // // where the nodes are smoothed too far along a sphere thus creating
      // // inverted _simplices
      // double dist[theNbSmooFuns];
@@@ -9486,7 -9482,7 +9486,7 @@@ void _LayerEdge::SetNewLength( double l
        _pos.back().SetCoord( u, 0, 0 );
        if ( _nodes.size() > 1 && uvOK )
        {
 -        SMDS_EdgePosition* pos = static_cast<SMDS_EdgePosition*>( n->GetPosition() );
 +        SMDS_EdgePositionPtr pos = n->GetPosition();
          pos->SetUParameter( u );
        }
      }
        _pos.back().SetCoord( uv.X(), uv.Y(), 0 );
        if ( _nodes.size() > 1 && uvOK )
        {
 -        SMDS_FacePosition* pos = static_cast<SMDS_FacePosition*>( n->GetPosition() );
 +        SMDS_FacePositionPtr pos = n->GetPosition();
          pos->SetUParameter( uv.X() );
          pos->SetVParameter( uv.Y() );
        }
@@@ -9614,7 -9610,7 +9614,7 @@@ void _LayerEdge::InvalidateStep( size_
        TopLoc_Location loc;
        if ( eos.SWOLType() == TopAbs_EDGE )
        {
 -        SMDS_EdgePosition* pos = static_cast<SMDS_EdgePosition*>( n->GetPosition() );
 +        SMDS_EdgePositionPtr pos = n->GetPosition();
          pos->SetUParameter( nXYZ.X() );
          double f,l;
          Handle(Geom_Curve) curve = BRep_Tool::Curve( TopoDS::Edge( eos._sWOL ), loc, f,l);
        }
        else
        {
 -        SMDS_FacePosition* pos = static_cast<SMDS_FacePosition*>( n->GetPosition() );
 +        SMDS_FacePositionPtr pos = n->GetPosition();
          pos->SetUParameter( nXYZ.X() );
          pos->SetVParameter( nXYZ.Y() );
          Handle(Geom_Surface) surface = BRep_Tool::Surface( TopoDS::Face(eos._sWOL), loc );
@@@ -9987,12 -9983,12 +9987,12 @@@ bool _ViscousBuilder::refine(_SolidData
          SMDS_PositionPtr  lastPos = tgtNode->GetPosition();
          if ( isOnEdge )
          {
 -          SMDS_EdgePosition* epos = static_cast<SMDS_EdgePosition*>( lastPos );
 +          SMDS_EdgePositionPtr epos = lastPos;
            epos->SetUParameter( otherTgtPos.X() );
          }
          else
          {
 -          SMDS_FacePosition* fpos = static_cast<SMDS_FacePosition*>( lastPos );
 +          SMDS_FacePositionPtr fpos = lastPos;
            fpos->SetUParameter( otherTgtPos.X() );
            fpos->SetVParameter( otherTgtPos.Y() );
          }
                  u = helper.GetNodeU( geomEdge, node );
                pos = curve->Value( u ).Transformed(loc);
  
 -              SMDS_EdgePosition* epos = static_cast<SMDS_EdgePosition*>( node->GetPosition() );
 +              SMDS_EdgePositionPtr epos = node->GetPosition();
                epos->SetUParameter( u );
              }
              else
                  uv = helper.GetNodeUV( geomFace, node );
                pos = surface->Value( uv );
  
 -              SMDS_FacePosition* fpos = static_cast<SMDS_FacePosition*>( node->GetPosition() );
 +              SMDS_FacePositionPtr fpos = node->GetPosition();
                fpos->SetUParameter( uv.X() );
                fpos->SetVParameter( uv.Y() );
              }
      SMESH_ComputeErrorPtr& err = _mesh->GetSubMesh( data._solid )->GetComputeError();
      if ( !err || err->IsOK() )
      {
 -      err.reset( new SMESH_ComputeError( COMPERR_WARNING,
 -                                         "Bad quality volumes created" ));
 -      err->myBadElements.insert( err->myBadElements.end(),
 -                                 degenVols.begin(),degenVols.end() );
 +      SMESH_BadInputElements* badElems =
 +        new SMESH_BadInputElements( getMeshDS(), COMPERR_WARNING, "Bad quality volumes created" );
 +      badElems->myBadElements.insert( badElems->myBadElements.end(),
 +                                      degenVols.begin(),degenVols.end() );
 +      err.reset( badElems );
      }
    }
  
@@@ -10683,14 -10678,14 +10683,14 @@@ bool _ViscousBuilder::shrink(_SolidData
                 edge->Is( _LayerEdge::SHRUNK )) continue;
            if ( subEOS[iS]->SWOLType() == TopAbs_FACE )
            {
 -            SMDS_FacePosition* pos = static_cast<SMDS_FacePosition*>( tgtNode->GetPosition() );
 +            SMDS_FacePositionPtr pos = tgtNode->GetPosition();
              pos->SetUParameter( edge->_pos[0].X() );
              pos->SetVParameter( edge->_pos[0].Y() );
              p = surface->Value( edge->_pos[0].X(), edge->_pos[0].Y() );
            }
            else
            {
 -            SMDS_EdgePosition* pos = static_cast<SMDS_EdgePosition*>( tgtNode->GetPosition() );
 +            SMDS_EdgePositionPtr pos = tgtNode->GetPosition();
              pos->SetUParameter( edge->_pos[0].Coord( U_TGT ));
              p = BRepAdaptor_Curve( TopoDS::Edge( subEOS[iS]->_sWOL )).Value( pos->GetUParameter() );
            }
@@@ -10885,7 -10880,7 +10885,7 @@@ bool _ViscousBuilder::prepareEdgeToShri
      edge._pos[0].SetCoord( tgtUV.X(), tgtUV.Y(), 0 );
  
      // set UV of source node to target node
 -    SMDS_FacePosition* pos = static_cast<SMDS_FacePosition*>( tgtNode->GetPosition() );
 +    SMDS_FacePositionPtr pos = tgtNode->GetPosition();
      pos->SetUParameter( srcUV.X() );
      pos->SetVParameter( srcUV.Y() );
    }
      edge._simplices[0]._nPrev = n2;
  
      // set U of source node to the target node
 -    SMDS_EdgePosition* pos = static_cast<SMDS_EdgePosition*>( tgtNode->GetPosition() );
 +    SMDS_EdgePositionPtr pos = tgtNode->GetPosition();
      pos->SetUParameter( uSrc );
    }
    return true;
@@@ -10968,7 -10963,7 +10968,7 @@@ void _ViscousBuilder::restoreNoShrink( 
        TopLoc_Location loc;
        Handle(Geom_Curve) curve = BRep_Tool::Curve( TopoDS::Edge( S ), loc, f, l );
        if ( curve.IsNull() ) return;
 -      SMDS_EdgePosition* ePos = static_cast<SMDS_EdgePosition*>( srcNode->GetPosition() );
 +      SMDS_EdgePositionPtr ePos = srcNode->GetPosition();
        p = curve->Value( ePos->GetUParameter() );
        break;
      }
@@@ -11194,7 -11189,7 +11194,7 @@@ bool _LayerEdge::SetNewLength2d( Handle
      {
        return true;
      }
 -    SMDS_FacePosition* pos = static_cast<SMDS_FacePosition*>( tgtNode->GetPosition() );
 +    SMDS_FacePositionPtr pos = tgtNode->GetPosition();
      pos->SetUParameter( newUV.X() );
      pos->SetVParameter( newUV.Y() );
  
    {
      const TopoDS_Edge&      E = TopoDS::Edge( eos._sWOL );
      const SMDS_MeshNode*   n2 = _simplices[0]._nPrev;
 -    SMDS_EdgePosition* tgtPos = static_cast<SMDS_EdgePosition*>( tgtNode->GetPosition() );
 +    SMDS_EdgePositionPtr tgtPos = tgtNode->GetPosition();
  
      const double u2     = helper.GetNodeU( E, n2, tgtNode );
      const double uSrc   = _pos[0].Coord( U_SRC );
@@@ -11328,7 -11323,7 +11328,7 @@@ bool _SmoothNode::Smooth(int
      return false;
    }
  
 -  SMDS_FacePosition* pos = static_cast<SMDS_FacePosition*>( _node->GetPosition() );
 +  SMDS_FacePositionPtr pos = _node->GetPosition();
    pos->SetUParameter( newPos.X() );
    pos->SetVParameter( newPos.Y() );
  
@@@ -11555,7 -11550,7 +11555,7 @@@ void _Shrinker1D::Compute(bool set3D, S
        if ( !discret.IsDone() )
          return throw SALOME_Exception(LOCALIZED("GCPnts_AbscissaPoint failed"));
        double u = discret.Parameter();
 -      SMDS_EdgePosition* pos = static_cast<SMDS_EdgePosition*>( _nodes[i]->GetPosition() );
 +      SMDS_EdgePositionPtr pos = _nodes[i]->GetPosition();
        pos->SetUParameter( u );
        gp_Pnt p = C->Value( u );
        const_cast< SMDS_MeshNode*>( _nodes[i] )->setXYZ( p.X(), p.Y(), p.Z() );
      {
        if ( !_nodes[i] ) continue;
        double u = f * ( 1-_normPar[i] ) + l * _normPar[i];
 -      SMDS_EdgePosition* pos = static_cast<SMDS_EdgePosition*>( _nodes[i]->GetPosition() );
 +      SMDS_EdgePositionPtr pos = _nodes[i]->GetPosition();
        pos->SetUParameter( u );
      }
    }
@@@ -11591,7 -11586,7 +11591,7 @@@ void _Shrinker1D::RestoreParams(
      for ( size_t i = 0; i < _nodes.size(); ++i )
      {
        if ( !_nodes[i] ) continue;
 -      SMDS_EdgePosition* pos = static_cast<SMDS_EdgePosition*>( _nodes[i]->GetPosition() );
 +      SMDS_EdgePositionPtr pos = _nodes[i]->GetPosition();
        pos->SetUParameter( _initU[i] );
      }
    _done = false;
index 98a30fa229535cb0a2f6ff35011cf9df48fa9323,7c8ebe7767b2d1ab32201f942d59331424984392..f759c4ba08470ebbb0680321be638682213de6f1
@@@ -110,7 -110,7 +110,7 @@@ namespace VISCOUS_2
      // Proxy sub-mesh of an EDGE. It contains nodes in _uvPtStructVec.
      struct _EdgeSubMesh : public SMESH_ProxyMesh::SubMesh
      {
 -      _EdgeSubMesh(int index=0): SubMesh(index) {}
 +      _EdgeSubMesh(const SMDS_Mesh* mesh, int index=0): SubMesh(mesh,index) {}
        //virtual int NbElements() const { return _elements.size()+1; }
        virtual int NbNodes() const { return Max( 0, _uvPtStructVec.size()-2 ); }
        void SetUVPtStructVec(UVPtStructVec& vec) { _uvPtStructVec.swap( vec ); }
      };
      _ProxyMeshOfFace(const SMESH_Mesh& mesh): SMESH_ProxyMesh(mesh) {}
      _EdgeSubMesh* GetEdgeSubMesh(int ID) { return (_EdgeSubMesh*) getProxySubMesh(ID); }
 -    virtual SubMesh* newSubmesh(int index=0) const { return new _EdgeSubMesh(index); }
 +    virtual SubMesh* newSubmesh(int index=0) const { return new _EdgeSubMesh( GetMeshDS(), index); }
    };
    //--------------------------------------------------------------------------------
    /*!
  //================================================================================
  // StdMeshers_ViscousLayers hypothesis
  //
- StdMeshers_ViscousLayers2D::StdMeshers_ViscousLayers2D(int hypId, int studyId, SMESH_Gen* gen)
-   :StdMeshers_ViscousLayers(hypId, studyId, gen)
+ StdMeshers_ViscousLayers2D::StdMeshers_ViscousLayers2D(int hypId, SMESH_Gen* gen)
+   :StdMeshers_ViscousLayers(hypId, gen)
  {
    _name = StdMeshers_ViscousLayers2D::GetHypType();
    _param_algo_dim = -2; // auxiliary hyp used by 2D algos
@@@ -600,7 -600,7 +600,7 @@@ StdMeshers_ViscousLayers2D::CheckHypoth
  // --------------------------------------------------------------------------------
  void StdMeshers_ViscousLayers2D::RestoreListeners() const
  {
-   StudyContextStruct* sc = _gen->GetStudyContext( _studyId );
+   StudyContextStruct* sc = _gen->GetStudyContext();
    std::map < int, SMESH_Mesh * >::iterator i_smesh = sc->mapMesh.begin();
    for ( ; i_smesh != sc->mapMesh.end(); ++i_smesh )
    {
@@@ -1998,7 -1998,7 +1998,7 @@@ bool _ViscousBuilder2D::shrink(
          throw SALOME_Exception(SMESH_Comment("ViscousBuilder2D: not SMDS_TOP_EDGE node position: ")
                                 << oldNode->GetPosition()->GetTypeOfPosition()
                                 << " of node " << oldNode->GetID());
 -      SMDS_EdgePosition* pos = static_cast<SMDS_EdgePosition*>( oldNode->GetPosition() );
 +      SMDS_EdgePositionPtr pos = oldNode->GetPosition();
        pos->SetUParameter( nodeDataVec[iP].param );
  
        gp_Pnt newP = curve.Value( nodeDataVec[iP].param );
index 999891b5b3ddc1031be6e7aeb01c9b62a6eb5021,74f46994099a8ac3218d37f78b573dc25040009e..e71e0c7795b435c4f5332b12bbe5aa16a6cea191
@@@ -24,7 -24,7 +24,7 @@@ INCLUDE(UseQtExt
  INCLUDE_DIRECTORIES(
    ${QT_INCLUDES}
    ${VTK_INCLUDE_DIRS}
 -  ${CAS_INCLUDE_DIRS}
 +  ${OpenCASCADE_INCLUDE_DIR}
    ${PYTHON_INCLUDE_DIRS}
    ${KERNEL_INCLUDE_DIRS}
    ${GUI_INCLUDE_DIRS}
@@@ -48,7 -48,7 +48,7 @@@
  
  # additional preprocessor / compiler flags
  ADD_DEFINITIONS(
 -  ${CAS_DEFINITIONS}
 +  ${OpenCASCADE_DEFINITIONS}
    ${BOOST_DEFINITIONS}
    ${OMNIORB_DEFINITIONS}
    ${QWT_DEFINITIONS}
  # libraries to link to
  SET(_link_LIBRARIES
    ${GUI_SalomeApp}
 -  ${CAS_TKernel}
 -  ${CAS_TKBO}
 -  ${CAS_TKAdvTools}
 +  ${OpenCASCADE_FoundationClasses_LIBRARIES}
 +  ${OpenCASCADE_ModelingAlgorithms_LIBRARIES}
    ${QWT_LIBRARY}
    SalomeIDLSMESH
    SMESHFiltersSelection
+   SMESHEngine
    SMESH
    SMESHObject
  )
index 60f9dc8b7328277ab7df0f6281c7593f0a4fcf6e,5bcb15973aa114edd49d4ba192061fedf7e54e85..21216e96e2d10bb644e9b557c3b542bcb42fa3f6
@@@ -157,13 -157,12 +157,12 @@@ class MGCleanerMonPlugDialog(Ui_MGClean
      import SMESH
      from salome.kernel import studyedit
      from salome.smesh import smeshBuilder
-     smesh = smeshBuilder.New(salome.myStudy)
+     smesh = smeshBuilder.New()
      
      if not os.path.isfile(self.fichierOut):
        QMessageBox.warning(self, "Compute", "Result file "+self.fichierOut+" not found")
  
-     maStudy=studyedit.getActiveStudy()
-     smesh.SetCurrentStudy(maStudy)
+     maStudy=salome.myStudy
      (outputMesh, status) = smesh.CreateMeshesFromGMF(self.fichierOut)
      name=str(self.LE_MeshSmesh.text())
      initialMeshFile=None
      newLink=monStudyBuilder.NewObject(SOMesh)
      monStudyBuilder.Addreference(newLink, newStudyIter)
  
-     if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(False)
+     if salome.sg.hasDesktop(): salome.sg.updateObjBrowser()
      self.num+=1
      return True
  
      #myStudy.IsStudyLocked()
      myComponent = myStudy.FindComponent(name)
      if myComponent == None:
-       print "myComponent not found, create"
+       print("myComponent not found, create")
        myComponent = myBuilder.NewComponent(name)
      AName = myBuilder.FindOrCreateAttribute(myComponent, "AttributeName")
      AName.SetValue(name)
      ACmt = myBuilder.FindOrCreateAttribute(myObject, "AttributeComment")
      ACmt.SetValue(datai)
  
-     if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(False)
+     if salome.sg.hasDesktop(): salome.sg.updateObjBrowser()
      self.num += 1
-     if verbose: print("save %s in Object Browser done: %s\n%s" % (name, myObject.GetID(), datai))
+     if verbose: print(("save %s in Object Browser done: %s\n%s" % (name, myObject.GetID(), datai)))
      return True
  
    def PBSaveHypPressed(self):
      QMessageBox.warning(self, "Save", "waiting for fix: Object Browser will not display hypothesis")
      
      if verbose: print("save hypothesis in Object Browser")
-     smesh = smeshBuilder.New(salome.myStudy)
+     smesh = smeshBuilder.New()
  
-     maStudy=studyedit.getActiveStudy()
-     smesh.SetCurrentStudy(maStudy)
+     maStudy=salome.myStudy
  
      self.editor = studyedit.getStudyEditor()
      moduleEntry=self.editor.findOrCreateComponent("SMESH","SMESH")
      notebook.set("MGCleaner_%i" % self.num, data)
      """
  
-     if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(False)
+     if salome.sg.hasDesktop(): salome.sg.updateObjBrowser()
      self.num += 1
-     if verbose: print("save %s in Object Browser done:\n%s" % (name, data))
+     if verbose: print(("save %s in Object Browser done:\n%s" % (name, data)))
      return True
  
    def SP_toStr(self, widget):
      if fd.exec_():
        infile = fd.selectedFiles()[0]
        self.LE_MeshFile.setText(infile)
-       self.fichierIn=unicode(infile).encode("latin-1")
+       self.fichierIn=str(infile).encode("latin-1")
        self.MeshIn=""
        self.LE_MeshSmesh.setText("")
  
      if fd.exec_():
        infile = fd.selectedFiles()[0]
        self.LE_ParamsFile.setText(infile)
-       self.paramsFile=unicode(infile).encode("latin-1")
+       self.paramsFile=str(infile).encode("latin-1")
  
    def meshFileNameChanged(self):
      self.fichierIn=str(self.LE_MeshFile.text())
      from salome.smesh.smeshstudytools import SMeshStudyTools
      from salome.gui import helper as guihelper
      from salome.smesh import smeshBuilder
-     smesh = smeshBuilder.New(salome.myStudy)
+     smesh = smeshBuilder.New()
  
      mySObject, myEntry = guihelper.getSObjectSelected()
      if CORBA.is_nil(mySObject) or mySObject==None:
        self.commande+=" --resolution_length " + self.SP_toStr(self.SP_ResolutionLength)
      self.commande+=" --folding_angle " + str(self.SP_FoldingAngle.value())
      if self.CB_RemeshPlanes.isChecked(): #no remesh default
 -      self.commande+=" --remesh_planes"
 +      self.commande+=" --remesh_planes yes"
      if not self.CB_ComputedOverlapDistance.isChecked(): #computed default
        self.commande+=" --overlap_distance " + self.SP_toStr(self.SP_OverlapDistance)
      self.commande+=" --overlap_angle " + str(self.SP_OverlapAngle.value())
-     if verbose: print("INFO: MGCCleaner command:\n  %s" % self.commande)
+     if verbose: print(("INFO: MGCCleaner command:\n  %s" % self.commande))
      return True
  
    def clean(self):
@@@ -642,7 -640,7 +640,7 @@@ def TEST_standalone()
    import SMESH
    from salome.kernel import studyedit
    salome.salome_init()
-   maStudy=studyedit.getActiveStudy()
+   maStudy=salome.myStudy
    #etc...a mano...
  
  #
index 185f666c0493a1511d0064fd86fdb22587539eb1,7b768d84f78b32a0a72669cf0bc2647e140ddcf8..304724e4897dc6c779e07c72654f25419a6c3c8d
  # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  #
  
- # 
+ #
  import SMESH
  import math
  import Config
  
  from salome.geom import geomBuilder
- geompy = geomBuilder.New( Config.theStudy )
+ geompy = geomBuilder.New()
  
  from salome.smesh import smeshBuilder
- smesh = smeshBuilder.New( Config.theStudy )
+ smesh = smeshBuilder.New()
  
  ##########################################################################################################
  
  def PublishGroups ():
 -        TempNames = []
 -        for MacroObj in Config.ListObj :
 -            if group in MacroObj.GroupNames :
 -                Occurences = IndexMultiOcc(MacroObj.GroupNames, group)
 -                for Occ in Occurences :
 -                    TempGEOList += MacroObj.GetBorder(Occ)
 -        GroupGEO.append(geompy.MakeCompound(TempGEOList))
 -        geompy.addToStudyInFather(FinalCompound,GroupGEO[-1],'GR_'+group)
 -
 -        # Mesh groups definition
 -        Criterion = smesh.GetCriterion(SMESH.EDGE, SMESH.FT_BelongToGeom,'=',GroupGEO[-1],Tolerance=1e-06)
 -        #Criterion = smesh.Filter.Criterion(18,39,0,'GR_'+group,'GR_'+group,39,39,1e-06,smesh.EDGE,7)
 -        MeshCompound.MakeGroupByCriterion(group,Criterion)
 -
 -    StudyBuilder = Config.theStudy.NewBuilder()
 -    for MeshObj in TempMESHList:
 -        SO = Config.theStudy.FindObjectIOR(Config.theStudy.ConvertObjectToIOR(MeshObj))
 -        if SO is not None: StudyBuilder.RemoveObjectWithChildren(SO)
 -
 -    return MeshCompound
+     aFilterManager = smesh.CreateFilterManager()
+     # Building geometric and mesh compounds and  groups ##############################################
+     if Config.debug : print("Searching for geometric groups and publishing final compound")
+     TempGEOList = []
+     TempMESHList = []
+     for MacroObj in Config.ListObj :
+         TempGEOList += MacroObj.GeoChildren
+         TempMESHList += MacroObj.Mesh
+     FinalCompound = geompy.MakeCompound(TempGEOList)
+     geompy.addToStudy (FinalCompound,Config.StudyName)
+     MeshCompound = smesh.Concatenate(TempMESHList, 1, 1, 1e-5)
+     MeshCompound.SetName(Config.StudyName)
+     GroupGEO = []
+     for group in Config.Groups :
+         # Geometric groups definition
+         TempGEOList = []
 +        aFilterManager = smesh.CreateFilterManager()
  
-         if Config.debug : print "Searching for geometric groups and publishing final compound"
 +        # Building geometric and mesh compounds and  groups ##############################################
++        if Config.debug : print("Searching for geometric groups and publishing final compound")
 +        
 +        TempGEOList = []
 +        TempMESHList = []
 +        
 +        for MacroObj in Config.ListObj : 
 +                TempGEOList += MacroObj.GeoChildren
 +                TempMESHList += MacroObj.Mesh
 +                
 +        FinalCompound = geompy.MakeCompound(TempGEOList)
 +        geompy.addToStudy (FinalCompound,Config.StudyName)
 +        MeshCompound = smesh.Concatenate(TempMESHList, 1, 1, 1e-5)
 +        MeshCompound.SetName(Config.StudyName)
 +        
 +        GroupGEO = []
 +        for group in Config.Groups :
 +        
 +                # Geometric groups definition
 +                TempGEOList = []
 +                TempNames = []
 +                for MacroObj in Config.ListObj :
 +                        if group in MacroObj.GroupNames :
 +                                Occurrences = IndexMultiOcc(MacroObj.GroupNames, group)
 +                                for Occ in Occurrences :
 +                                        TempGEOList += MacroObj.GetBorder(Occ)
 +                GroupGEO.append(geompy.MakeCompound(TempGEOList))
 +                geompy.addToStudyInFather(FinalCompound,GroupGEO[-1],'GR_'+group)
 +                
 +                # Mesh groups definition
 +                Criterion = smesh.GetCriterion(SMESH.EDGE, SMESH.FT_BelongToGeom,'=',GroupGEO[-1],Tolerance=1e-06)
 +                #Criterion = smesh.Filter.Criterion(18,39,0,'GR_'+group,'GR_'+group,39,39,1e-06,smesh.EDGE,7)
 +                MeshCompound.MakeGroupByCriterion(group,Criterion)
 +        
 +        StudyBuilder = Config.theStudy.NewBuilder()
 +        for MeshObj in TempMESHList:
 +                SO = Config.theStudy.FindObjectIOR(Config.theStudy.ConvertObjectToIOR(MeshObj))
 +                if SO is not None: StudyBuilder.RemoveObjectWithChildren(SO)
 +        
 +        return MeshCompound        
 +                
  
  def IndexMultiOcc (Array,Element) :
-         """
-         This function returns the occurrences indices of Element in Array.
-         As opposed to Array.index(Element) method, this allows determining      
-         multiple entries rather than just the first one!
-         """
-         Output = []
-         try : Array.index(Element)
-         except ValueError : print "No more occurrences"
-         else : Output.append(Array.index(Element))
-                 
-         if not(Output == [-1]) and len(Array) > 1 :
-                 for index, ArrElem in enumerate(Array[Output[0]+1:]) :
-                         if ArrElem is Element : Output.append(index+Output[0]+1)
-                  
-         return Output
-             
+     """
+     This function returns the occurrences indices of Element in Array.
+     As opposed to Array.index(Element) method, this allows determining
+     multiple entries rather than just the first one!
+     """
+     Output = []
+     try : Array.index(Element)
+     except ValueError : print("No more occurrences")
+     else : Output.append(Array.index(Element))
+     if not(Output == [-1]) and len(Array) > 1 :
+         for index, ArrElem in enumerate(Array[Output[0]+1:]) :
+             if ArrElem is Element : Output.append(index+Output[0]+1)
+     return Output
  def Publish (ObjToPublish):
-       for i,GeoObj in enumerate(ObjToPublish) : geompy.addToStudy(GeoObj,"Sub_"+str(i))
-         
+     for i,GeoObj in enumerate(ObjToPublish) : geompy.addToStudy(GeoObj,"Sub_"+str(i))
  def RevolveMesh(MainMesh,**args):
          """
          This function permits to revolute and scale a 2D mesh while transforming the edge
          ################################################################################       
          if 'Center' in args : CenterCoor = [float(Coor) for Coor in args['Center']]
          else : 
-                 print "\nThe coordinates of the center of revolution were not given\nThe origin is used by default."
+                 print("\nThe coordinates of the center of revolution were not given\nThe origin is used by default.")
                  CenterCoor = [0.,0.,0.]
          
          if 'Direction' in args : Direction = [float(Dir) for Dir in args['Direction']]
          else :
-                 print "\nThe axis vector of revolution was not given\nThe x-axis is used by default."
+                 print("\nThe axis vector of revolution was not given\nThe x-axis is used by default.")
                  Direction = [1.,0.,0.]
          
          if 'AngleDeg' in args : Angle = float(args['AngleDeg'])*math.pi/180.
          elif 'AngleRad' in args : Angle = float(args['AngleRad'])
          else :
-                 print "\nThe revolution angle was not given\nAn angle of 10 degrees is used by default."
+                 print("\nThe revolution angle was not given\nAn angle of 10 degrees is used by default.")
                  Angle = 10.*math.pi/180.
                  
          if 'Scale' in args : Scale = float(args['Scale'])
@@@ -185,12 -185,12 +207,12 @@@ def ExtrudeMesh(MainMesh,**args)
          ################################################################################              
          if 'Distance' in args : Distance = float(args['Distance'])
          else :
-                 print "\nThe extrusion distance was not given\nA default value of 1 is used."
+                 print("\nThe extrusion distance was not given\nA default value of 1 is used.")
                  Distance = 1.
                  
          if 'Direction' in args : Direction = NormalizeVector([float(Dir) for Dir in args['Direction']],Distance)
          else :
-                 print "\nThe extrusion vector of revolution was not given\nThe z-axis is used by default."
+                 print("\nThe extrusion vector of revolution was not given\nThe z-axis is used by default.")
                  Direction = NormalizeVector([0.,0.,1.],Distance)
                                  
          if 'Scale' in args : Scale = float(args['Scale'])
       
                 
  def NormalizeVector (V,Norm):
-         """
-         This function returns a normalized vector (magnitude = Norm), parallel to the entered one
-         """
-         V = [float(Coor) for Coor in V]
-         Norm = float(Norm)
-         MagV = math.sqrt(V[0]*V[0]+V[1]*V[1]+V[2]*V[2])
-         return [Coor*Norm/MagV for Coor in V]
-   
+     """
+     This function returns a normalized vector (magnitude = Norm), parallel to the entered one
+     """
+     V = [float(Coor) for Coor in V]
+     Norm = float(Norm)
+     MagV = math.sqrt(V[0]*V[0]+V[1]*V[1]+V[2]*V[2])
+     return [Coor*Norm/MagV for Coor in V]
index 4d2a631294155c5bd5b9feb596ed6b029d56a9e2,44796efa5ebb8141d713ad7996aa6d945d6ee0de..cb14896ab3aa3f7194ab4efa53a0e962cd8afb7d
  
  from qtsalome import QDialog, QIcon, Qt
  
- from plugindialog_ui import Ui_PluginDialog
- from inputdialog import InputDialog, INPUTDATA_KEY_FILES, INPUTDATA_KEY_PARAM
- from inputdialog import PARAM_KEY_NBITER, PARAM_KEY_RMAXRMIN
- from inputdata import InputData
+ from salome.smesh.spadder.gui.plugindialog_ui import Ui_PluginDialog
+ from salome.smesh.spadder.gui.inputdialog import InputDialog, INPUTDATA_KEY_FILES, INPUTDATA_KEY_PARAM
+ from salome.smesh.spadder.gui.inputdialog import PARAM_KEY_NBITER, PARAM_KEY_RMAXRMIN
+ from salome.smesh.spadder.gui.inputdata import InputData
  # __GBO__: uncomment this line and comment the previous one to use the
  # demo input dialog instead of the real one.
  #from demoinputdialog import InputDialog
@@@ -38,7 -38,7 +38,7 @@@ from salome.kernel.uiexception import A
  from omniORB import CORBA
  import SMESH
  from salome.smesh import smeshBuilder
- smesh = smeshBuilder.New(salome.myStudy)
+ smesh = smeshBuilder.New()
  import MESHJOB
  
  gui_states = ["CAN_SELECT", "CAN_COMPUTE", "CAN_REFRESH", "CAN_PUBLISH"]
@@@ -87,7 -87,7 +87,7 @@@ class PluginDialog(QDialog)
          self.__ui.btnClear.setIcon(icon)
  
          # Then, we can connect the slot to there associated button event
-       self.__ui.btnInput.clicked.connect( self.onInput )
+         self.__ui.btnInput.clicked.connect( self.onInput )
          self.__ui.btnCompute.clicked.connect( self.onCompute )
          self.__ui.btnRefresh.clicked.connect( self.onRefresh )
          self.__ui.btnPublish.clicked.connect( self.onPublish )
  
      def setupJobManager(self):
          '''
 -        This function configures the jobmanager by transmiting the
 +        This function configures the jobmanager by transmitting the
          parameters required for a local execution and a remote
          execution. The choice between "local" and "remote" is done at
 -        the initialize step, by specifing the name of the resource to
 +        the initialize step, by specifying the name of the resource to
          be used.
          '''
          # We first
                  self.__inputDialog.windowFlags() | Qt.WindowStaysOnTopHint)
              # The signal inputValidated emitted from inputDialog is
              # connected to the slot function onProcessInput:
-           self.__inputDialog.inputValidated.connect( self.onProcessInput )
+             self.__inputDialog.inputValidated.connect( self.onProcessInput )
  
          else:
              self.__ui.frameInput.setVisible(True)
          servant. Note that the component is loaded on first demand,
          and then the reference is recycled.
          """
-         if self.__dict__.has_key("__jobManager") and self.__jobManager is not None:
+         if "__jobManager" in self.__dict__ and self.__jobManager is not None:
              return self.__jobManager
  
          # WARN: we first have to update the SALOME components catalog
          name. This returns the filename.
          '''
          filename=str("/tmp/padder_inputfile_"+meshName+".med")
-         meshObject.ExportToMEDX( filename, 0, SMESH.MED_V2_2, 1, 1 )
+         meshObject.ExportMED(filename, False, True, True)
          return filename
  
      def clear(self):
          # And to create a list of the additional parameters.
          # WARN: the CORBA interface requires string values.
          meshJobParameterList=[]
-         for inputParameterKey in self.__dictInputParameters.keys():
+         for inputParameterKey in self.__dictInputParameters:
              value = self.__dictInputParameters[inputParameterKey]
              parameter = MESHJOB.MeshJobParameter(name=inputParameterKey,value=str(value))
              meshJobParameterList.append(parameter)
          medfilename = os.path.join(meshJobResults.results_dirname,
                                     meshJobResults.outputmesh_filename)
  
-         smesh.SetCurrentStudy(studyedit.getActiveStudy())
+         smesh.UpdateStudy()
          ([outputMesh], status) = smesh.CreateMeshesFromMED(medfilename)
  
          # By convention, the name of the output mesh in the study is
          meshname = 'padder_'+str(self.__jobid)
          smesh.SetName(outputMesh.GetMesh(), meshname)
          if salome.sg.hasDesktop():
-             salome.sg.updateObjBrowser(False)
+             salome.sg.updateObjBrowser()
  
          self.__ui.lblStatusBar.setText("Publication OK")
          self.__setGuiState(["CAN_SELECT"])
@@@ -417,6 -417,3 +417,3 @@@ def TEST_PluginDialog()
  
  if __name__ == "__main__":
      TEST_PluginDialog()