Salome HOME
PAL20544 4x: problems with Concatenate().
[modules/smesh.git] / src / SMESH_SWIG / smeshDC.py
index 3f77b5cb078b2330febf0c436028402ce8a5cd14..4b6ab7036490b82d2d7c28935ffbea1abd8d123d 100644 (file)
@@ -112,6 +112,8 @@ except ImportError:
 REGULAR    = 1
 PYTHON     = 2
 COMPOSITE  = 3
+SOLE       = 0
+SIMPLE     = 1
 
 MEFISTO       = 3
 NETGEN        = 4
@@ -172,6 +174,10 @@ def GetName(obj):
 
 ## Sets a name to the object
 def SetName(obj, name):
+    if isinstance( obj, Mesh ):
+        obj = obj.GetMesh()
+    elif isinstance( obj, Mesh_Algorithm ):
+        obj = obj.GetAlgorithm()
     ior  = salome.orb.object_to_string(obj)
     sobj = salome.myStudy.FindObjectIOR(ior)
     if not sobj is None:
@@ -205,6 +211,8 @@ def TreatHypoStatus(status, hypName, geomName, isAlgo):
         reason = "it is hidden by an algorithm of an upper dimension, which generates elements of all dimensions"
     elif status == HYP_HIDING_ALGO:
         reason = "it hides algorithms of lower dimensions by generating elements of all dimensions"
+    elif status == HYP_NEED_SHAPE:
+        reason = "Algorithm can't work without shape"
     else:
         return
     hypName = '"' + hypName + '"'
@@ -229,9 +237,7 @@ class smeshDC(SMESH._objref_SMESH_Gen):
     ## Sets the current study and Geometry component
     #  @ingroup l1_auxiliary
     def init_smesh(self,theStudy,geompyD):
-        self.geompyD=geompyD
-        self.SetGeomEngine(geompyD)
-        self.SetCurrentStudy(theStudy)
+        self.SetCurrentStudy(theStudy,geompyD)
 
     ## Creates an empty Mesh. This mesh can have an underlying geometry.
     #  @param obj the Geometrical object on which the mesh is built. If not defined,
@@ -322,8 +328,14 @@ class smeshDC(SMESH._objref_SMESH_Gen):
 
     ## Sets the current study
     #  @ingroup l1_auxiliary
-    def SetCurrentStudy( self, theStudy ):
+    def SetCurrentStudy( self, theStudy, geompyD = None ):
         #self.SetCurrentStudy(theStudy)
+       if not geompyD:
+           import geompy
+           geompyD = geompy.geom
+           pass
+        self.geompyD=geompyD
+        self.SetGeomEngine(geompyD)
         SMESH._objref_SMESH_Gen.SetCurrentStudy(self,theStudy)
 
     ## Gets the current study
@@ -359,6 +371,24 @@ class smeshDC(SMESH._objref_SMESH_Gen):
         aMesh = Mesh(self, self.geompyD, aSmeshMesh)
         return aMesh
 
+    ## Concatenate the given meshes into one mesh.
+    #  @return an instance of Mesh class
+    #  @param meshes the meshes 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 aremerged
+    #  @param mergeTolerance tolerance for merging nodes
+    #  @param allGroups forces creation of groups of all elements
+    def Concatenate( self, meshes, uniteIdenticalGroups,
+                     mergeNodesAndElements = False, mergeTolerance = 1e-5, allGroups = False):
+        if allGroups:
+            aSmeshMesh = SMESH._objref_SMESH_Gen.ConcatenateWithGroups(
+                self,meshes,uniteIdenticalGroups,mergeNodesAndElements,mergeTolerance)
+        else:
+            aSmeshMesh = SMESH._objref_SMESH_Gen.Concatenate(
+                self,meshes,uniteIdenticalGroups,mergeNodesAndElements,mergeTolerance)
+        aMesh = Mesh(self, self.geompyD, aSmeshMesh)
+        return aMesh
+
     ## From SMESH_Gen interface
     #  @return the list of integer values
     #  @ingroup l1_auxiliary
@@ -574,6 +604,9 @@ class Mesh:
         elif obj != 0:
             SetName(self.mesh, GetName(obj))
 
+        if not self.geom:
+            self.geom = self.mesh.GetShapeToMesh()
+
         self.editor = self.mesh.GetMeshEditor()
 
     ## Initializes the Mesh object from an instance of SMESH_Mesh interface
@@ -823,8 +856,7 @@ class Mesh:
     def Compute(self, geom=0):
         if geom == 0 or not isinstance(geom, geompyDC.GEOM._objref_GEOM_Object):
             if self.geom == 0:
-                print "Compute impossible: mesh is not constructed on geom shape."
-                return 0
+                geom = self.mesh.GetShapeToMesh()
             else:
                 geom = self.geom
         ok = False
@@ -886,8 +918,18 @@ class Mesh:
             pass
         return ok
 
+    ## Removes all nodes and elements
+    #  @ingroup l2_construct
+    def Clear(self):
+        self.mesh.Clear()
+        if salome.sg.hasDesktop():
+            smeshgui = salome.ImportComponentGUI("SMESH")
+            smeshgui.Init(salome.myStudyId)
+            smeshgui.SetMeshIcon( salome.ObjectToID( self.mesh ), False, True )
+            salome.sg.updateObjBrowser(1)
+
     ## Computes a tetrahedral mesh using AutomaticLength + MEFISTO + NETGEN
-    #  The parameter \a fineness [0,-1] defines mesh fineness
+    #  @param fineness [0,-1] defines mesh fineness
     #  @return True or False
     #  @ingroup l3_algos_basic
     def AutomaticTetrahedralization(self, fineness=0):
@@ -904,7 +946,7 @@ class Mesh:
         return self.Compute()
 
     ## Computes an hexahedral mesh using AutomaticLength + Quadrangle + Hexahedron
-    #  The parameter \a fineness [0,-1] defines mesh fineness
+    #  @param fineness [0,-1] defines mesh fineness
     #  @return True or False
     #  @ingroup l3_algos_basic
     def AutomaticHexahedralization(self, fineness=0):
@@ -931,6 +973,8 @@ class Mesh:
             pass
         if not geom:
             geom = self.geom
+            if not geom:
+                geom = self.mesh.GetShapeToMesh()
             pass
         status = self.mesh.AddHypothesis(geom, hyp)
         isAlgo = hyp._narrow( SMESH_Algo )
@@ -3169,11 +3213,10 @@ class Mesh_Triangle(Mesh_Algorithm):
         if self.algoType == MEFISTO or self.algoType == NETGEN_2D:
             hyp = self.Hypothesis("MaxElementArea", [area], UseExisting=UseExisting,
                                   CompareMethod=self.CompareMaxElementArea)
-            hyp.SetMaxElementArea(area)
-            return hyp
         elif self.algoType == NETGEN:
-            print "Netgen 1D-2D algo doesn't support this hypothesis"
-            return None
+            hyp = self.Parameters(SIMPLE)
+        hyp.SetMaxElementArea(area)
+        return hyp
 
     ## Checks if the given "MaxElementArea" hypothesis has the same parameters as the given arguments
     def CompareMaxElementArea(self, hyp, args):
@@ -3189,132 +3232,104 @@ class Mesh_Triangle(Mesh_Algorithm):
             hyp = self.Hypothesis("LengthFromEdges", UseExisting=1, CompareMethod=self.CompareEqualHyp)
             return hyp
         elif self.algoType == NETGEN:
-            print "Netgen 1D-2D algo doesn't support this hypothesis"
-            return None
+            hyp = self.Parameters(SIMPLE)
+            hyp.LengthFromEdges()
+            return hyp
 
-    ## Sets a way to define size of mesh elements to generate
-    #  @param thePhysicalMesh is: DefaultSize or Custom
-    #  Parameter of BLSURF algo
+    ## Sets a way to define size of mesh elements to generate.
+    #  @param thePhysicalMesh is: DefaultSize or Custom.
     #  @ingroup l3_hypos_blsurf
     def SetPhysicalMesh(self, thePhysicalMesh=DefaultSize):
-        if self.params == 0:
-            self.Parameters()
-        self.params.SetPhysicalMesh(thePhysicalMesh)
+        # Parameter of BLSURF algo
+        self.Parameters().SetPhysicalMesh(thePhysicalMesh)
 
-    ## Sets size of mesh elements to generate
-    #  Parameter of BLSURF algo
+    ## Sets size of mesh elements to generate.
     #  @ingroup l3_hypos_blsurf
     def SetPhySize(self, theVal):
-        if self.params == 0:
-            self.Parameters()
-        self.params.SetPhySize(theVal)
+        # Parameter of BLSURF algo
+        self.Parameters().SetPhySize(theVal)
 
-    ## Sets lower boundary of mesh element size (PhySize)
-    #  Parameter of BLSURF algo
+    ## Sets lower boundary of mesh element size (PhySize).
     #  @ingroup l3_hypos_blsurf
     def SetPhyMin(self, theVal=-1):
-        if self.params == 0:
-            self.Parameters()
-        self.params.SetPhyMin(theVal)
+        #  Parameter of BLSURF algo
+        self.Parameters().SetPhyMin(theVal)
 
-    ## Sets upper boundary of mesh element size (PhySize)
-    #  Parameter of BLSURF algo
+    ## Sets upper boundary of mesh element size (PhySize).
     #  @ingroup l3_hypos_blsurf
     def SetPhyMax(self, theVal=-1):
-        if self.params == 0:
-            self.Parameters()
-        self.params.SetPhyMax(theVal)
+        #  Parameter of BLSURF algo
+        self.Parameters().SetPhyMax(theVal)
 
-    ## Sets a way to define maximum angular deflection of mesh from CAD model
+    ## Sets a way to define maximum angular deflection of mesh from CAD model.
     #  @param theGeometricMesh is: DefaultGeom or Custom
-    #  Parameter of BLSURF algo
     #  @ingroup l3_hypos_blsurf
     def SetGeometricMesh(self, theGeometricMesh=0):
-        if self.params == 0:
-            self.Parameters()
-        if self.params.GetPhysicalMesh() == 0: theGeometricMesh = 1
+        #  Parameter of BLSURF algo
+        if self.Parameters().GetPhysicalMesh() == 0: theGeometricMesh = 1
         self.params.SetGeometricMesh(theGeometricMesh)
 
-    ## Sets angular deflection (in degrees) of a mesh face from CAD surface
-    #  Parameter of BLSURF algo
+    ## Sets angular deflection (in degrees) of a mesh face from CAD surface.
     #  @ingroup l3_hypos_blsurf
     def SetAngleMeshS(self, theVal=_angleMeshS):
-        if self.params == 0:
-            self.Parameters()
-        if self.params.GetGeometricMesh() == 0: theVal = self._angleMeshS
+        #  Parameter of BLSURF algo
+        if self.Parameters().GetGeometricMesh() == 0: theVal = self._angleMeshS
         self.params.SetAngleMeshS(theVal)
 
-    ## Sets angular deflection (in degrees) of a mesh edge from CAD curve
-    #  Parameter of BLSURF algo
+    ## Sets angular deflection (in degrees) of a mesh edge from CAD curve.
     #  @ingroup l3_hypos_blsurf
     def SetAngleMeshC(self, theVal=_angleMeshS):
-        if self.params == 0:
-            self.Parameters()
-        if self.params.GetGeometricMesh() == 0: theVal = self._angleMeshS
+        #  Parameter of BLSURF algo
+        if self.Parameters().GetGeometricMesh() == 0: theVal = self._angleMeshS
         self.params.SetAngleMeshC(theVal)
 
-    ## Sets lower boundary of mesh element size computed to respect angular deflection
-    #  Parameter of BLSURF algo
+    ## Sets lower boundary of mesh element size computed to respect angular deflection.
     #  @ingroup l3_hypos_blsurf
     def SetGeoMin(self, theVal=-1):
-        if self.params == 0:
-            self.Parameters()
-        self.params.SetGeoMin(theVal)
+        #  Parameter of BLSURF algo
+        self.Parameters().SetGeoMin(theVal)
 
-    ## Sets upper boundary of mesh element size computed to respect angular deflection
-    #  Parameter of BLSURF algo
+    ## Sets upper boundary of mesh element size computed to respect angular deflection.
     #  @ingroup l3_hypos_blsurf
     def SetGeoMax(self, theVal=-1):
-        if self.params == 0:
-            self.Parameters()
-        self.params.SetGeoMax(theVal)
+        #  Parameter of BLSURF algo
+        self.Parameters().SetGeoMax(theVal)
 
-    ## Sets maximal allowed ratio between the lengths of two adjacent edges
-    #  Parameter of BLSURF algo
+    ## Sets maximal allowed ratio between the lengths of two adjacent edges.
     #  @ingroup l3_hypos_blsurf
     def SetGradation(self, theVal=_gradation):
-        if self.params == 0:
-            self.Parameters()
-        if self.params.GetGeometricMesh() == 0: theVal = self._gradation
+        #  Parameter of BLSURF algo
+        if self.Parameters().GetGeometricMesh() == 0: theVal = self._gradation
         self.params.SetGradation(theVal)
 
-    ## Sets topology usage way defining how mesh conformity is assured:
-    # FromCAD, PreProcess or PreProcessPlus
-    # FromCAD - mesh conformity is assured by conformity of a shape
-    # PreProcess or PreProcessPlus - by pre-processing a CAD model
-    #  Parameter of BLSURF algo
+    ## Sets topology usage way.
+    # @param way defines how mesh conformity is assured <ul>
+    # <li>FromCAD - mesh conformity is assured by conformity of a shape</li>
+    # <li>PreProcess or PreProcessPlus - by pre-processing a CAD model</li></ul>
     #  @ingroup l3_hypos_blsurf
     def SetTopology(self, way):
-        if self.params == 0:
-            self.Parameters()
-        self.params.SetTopology(way)
+        #  Parameter of BLSURF algo
+        self.Parameters().SetTopology(way)
 
-    ## To respect geometrical edges or not
-    #  Parameter of BLSURF algo
+    ## To respect geometrical edges or not.
     #  @ingroup l3_hypos_blsurf
     def SetDecimesh(self, toIgnoreEdges=False):
-        if self.params == 0:
-            self.Parameters()
-        self.params.SetDecimesh(toIgnoreEdges)
+        #  Parameter of BLSURF algo
+        self.Parameters().SetDecimesh(toIgnoreEdges)
 
     ## Sets verbosity level in the range 0 to 100.
-    #  Parameter of BLSURF algo
     #  @ingroup l3_hypos_blsurf
     def SetVerbosity(self, level):
-        if self.params == 0:
-            self.Parameters()
-        self.params.SetVerbosity(level)
+        #  Parameter of BLSURF algo
+        self.Parameters().SetVerbosity(level)
 
-    ## Sets advanced option value
-    #  Parameter of BLSURF algo
+    ## Sets advanced option value.
     #  @ingroup l3_hypos_blsurf
-    def SetOptionValue(self, optionName, value):
-        if self.params == 0:
-            self.Parameters()
-        self.params.SetOptionValue(optionName,level)
+    def SetOptionValue(self, optionName, level):
+        #  Parameter of BLSURF algo
+        self.Parameters().SetOptionValue(optionName,level)
 
-    ## Sets QuadAllowed flag
-    #
+    ## Sets QuadAllowed flag.
     #  Only for algoType == NETGEN || NETGEN_2D || BLSURF
     #  @ingroup l3_hypos_netgen l3_hypos_blsurf
     def SetQuadAllowed(self, toAllow=True):
@@ -3329,34 +3344,37 @@ class Mesh_Triangle(Mesh_Algorithm):
                     pass
                 pass
             return
-        if self.params == 0:
-            self.Parameters()
-        if self.params:
+        if self.Parameters():
             self.params.SetQuadAllowed(toAllow)
             return
 
-    ## Defines "Netgen 2D Parameters" hypothesis
+    ## Defines hypothesis having several parameters
     #
-    #  Only for algoType == NETGEN
     #  @ingroup l3_hypos_netgen
-    def Parameters(self):
+    def Parameters(self, which=SOLE):
         if self.params:
             return self.params
         if self.algoType == NETGEN:
-            self.params = self.Hypothesis("NETGEN_Parameters_2D", [],
-                                          "libNETGENEngine.so", UseExisting=0)
+            if which == SIMPLE:
+                self.params = self.Hypothesis("NETGEN_SimpleParameters_2D", [],
+                                              "libNETGENEngine.so", UseExisting=0)
+            else:
+                self.params = self.Hypothesis("NETGEN_Parameters_2D", [],
+                                              "libNETGENEngine.so", UseExisting=0)
             return self.params
         elif self.algoType == MEFISTO:
-            print "Mefisto algo doesn't support NETGEN_Parameters_2D hypothesis"
+            print "Mefisto algo support no multi-parameter hypothesis"
             return None
         elif self.algoType == NETGEN_2D:
-            print "NETGEN_2D_ONLY algo doesn't support 'NETGEN_Parameters_2D' hypothesis"
+            print "NETGEN_2D_ONLY algo support no multi-parameter hypothesis"
             print "NETGEN_2D_ONLY uses 'MaxElementArea' and 'LengthFromEdges' ones"
             return None
         elif self.algoType == BLSURF:
             self.params = self.Hypothesis("BLSURF_Parameters", [],
                                           "libBLSURFEngine.so", UseExisting=0)
             return self.params
+        else:
+            print "Mesh_Triangle with algo type %s does not have such a parameter, check algo type"%self.algoType
         return None
 
     ## Sets MaxSize
@@ -3364,9 +3382,7 @@ class Mesh_Triangle(Mesh_Algorithm):
     #  Only for algoType == NETGEN
     #  @ingroup l3_hypos_netgen
     def SetMaxSize(self, theSize):
-        if self.params == 0:
-            self.Parameters()
-        if self.params is not None:
+        if self.Parameters():
             self.params.SetMaxSize(theSize)
 
     ## Sets SecondOrder flag
@@ -3374,9 +3390,7 @@ class Mesh_Triangle(Mesh_Algorithm):
     #  Only for algoType == NETGEN
     #  @ingroup l3_hypos_netgen
     def SetSecondOrder(self, theVal):
-        if self.params == 0:
-            self.Parameters()
-        if self.params is not None:
+        if self.Parameters():
             self.params.SetSecondOrder(theVal)
 
     ## Sets Optimize flag
@@ -3384,9 +3398,7 @@ class Mesh_Triangle(Mesh_Algorithm):
     #  Only for algoType == NETGEN
     #  @ingroup l3_hypos_netgen
     def SetOptimize(self, theVal):
-        if self.params == 0:
-            self.Parameters()
-        if self.params is not None:
+        if self.Parameters():
             self.params.SetOptimize(theVal)
 
     ## Sets Fineness
@@ -3396,9 +3408,7 @@ class Mesh_Triangle(Mesh_Algorithm):
     #  Only for algoType == NETGEN
     #  @ingroup l3_hypos_netgen
     def SetFineness(self, theFineness):
-        if self.params == 0:
-            self.Parameters()
-        if self.params is not None:
+        if self.Parameters():
             self.params.SetFineness(theFineness)
 
     ## Sets GrowthRate
@@ -3406,9 +3416,7 @@ class Mesh_Triangle(Mesh_Algorithm):
     #  Only for algoType == NETGEN
     #  @ingroup l3_hypos_netgen
     def SetGrowthRate(self, theRate):
-        if self.params == 0:
-            self.Parameters()
-        if self.params is not None:
+        if self.Parameters():
             self.params.SetGrowthRate(theRate)
 
     ## Sets NbSegPerEdge
@@ -3416,9 +3424,7 @@ class Mesh_Triangle(Mesh_Algorithm):
     #  Only for algoType == NETGEN
     #  @ingroup l3_hypos_netgen
     def SetNbSegPerEdge(self, theVal):
-        if self.params == 0:
-            self.Parameters()
-        if self.params is not None:
+        if self.Parameters():
             self.params.SetNbSegPerEdge(theVal)
 
     ## Sets NbSegPerRadius
@@ -3426,11 +3432,23 @@ class Mesh_Triangle(Mesh_Algorithm):
     #  Only for algoType == NETGEN
     #  @ingroup l3_hypos_netgen
     def SetNbSegPerRadius(self, theVal):
-        if self.params == 0:
-            self.Parameters()
-        if self.params is not None:
+        if self.Parameters():
             self.params.SetNbSegPerRadius(theVal)
 
+    ## Sets number of segments overriding value set by SetLocalLength()
+    #
+    #  Only for algoType == NETGEN
+    #  @ingroup l3_hypos_netgen
+    def SetNumberOfSegments(self, theVal):
+        self.Parameters(SIMPLE).SetNumberOfSegments(theVal)
+
+    ## Sets number of segments overriding value set by SetNumberOfSegments()
+    #
+    #  Only for algoType == NETGEN
+    #  @ingroup l3_hypos_netgen
+    def SetLocalLength(self, theVal):
+        self.Parameters(SIMPLE).SetLocalLength(theVal)
+
     pass
 
 
@@ -3457,6 +3475,16 @@ class Mesh_Quadrangle(Mesh_Algorithm):
                               CompareMethod=self.CompareEqualHyp)
         return hyp
 
+    ## Defines "TrianglePreference" hypothesis, forcing construction
+    #  of triangles in the refinement area if the number of nodes
+    #  on the opposite edges is not the same
+    #
+    #  @ingroup l3_hypos_additi
+    def TrianglePreference(self):
+        hyp = self.Hypothesis("TrianglePreference", UseExisting=1,
+                              CompareMethod=self.CompareEqualHyp)
+        return hyp
+
 # Public class: Mesh_Tetrahedron
 # ------------------------------
 
@@ -3495,53 +3523,58 @@ class Mesh_Tetrahedron(Mesh_Algorithm):
     #                   the same parameters, else (default) - creates a new one
     #  @ingroup l3_hypos_maxvol
     def MaxElementVolume(self, vol, UseExisting=0):
-        hyp = self.Hypothesis("MaxElementVolume", [vol], UseExisting=UseExisting,
-                              CompareMethod=self.CompareMaxElementVolume)
-        hyp.SetMaxElementVolume(vol)
-        return hyp
+        if self.algoType == NETGEN:
+            hyp = self.Hypothesis("MaxElementVolume", [vol], UseExisting=UseExisting,
+                                  CompareMethod=self.CompareMaxElementVolume)
+            hyp.SetMaxElementVolume(vol)
+            return hyp
+        elif self.algoType == FULL_NETGEN:
+            self.Parameters(SIMPLE).SetMaxElementVolume(vol)
+        return None
 
     ## Checks if the given "MaxElementVolume" hypothesis has the same parameters as the given arguments
     def CompareMaxElementVolume(self, hyp, args):
         return IsEqual(hyp.GetMaxElementVolume(), args[0])
 
-    ## Defines "Netgen 3D Parameters" hypothesis
+    ## Defines hypothesis having several parameters
+    #
     #  @ingroup l3_hypos_netgen
-    def Parameters(self):
-        if (self.algoType == FULL_NETGEN):
-            self.params = self.Hypothesis("NETGEN_Parameters", [],
-                                          "libNETGENEngine.so", UseExisting=0)
+    def Parameters(self, which=SOLE):
+        if self.params:
+            return self.params
+        if self.algoType == FULL_NETGEN:
+            if which == SIMPLE:
+                self.params = self.Hypothesis("NETGEN_SimpleParameters_3D", [],
+                                              "libNETGENEngine.so", UseExisting=0)
+            else:
+                self.params = self.Hypothesis("NETGEN_Parameters", [],
+                                              "libNETGENEngine.so", UseExisting=0)
             return self.params
-        if (self.algoType == GHS3D):
+        if self.algoType == GHS3D:
             self.params = self.Hypothesis("GHS3D_Parameters", [],
                                           "libGHS3DEngine.so", UseExisting=0)
             return self.params
         
-        print "Algo doesn't support this hypothesis"
+        print "Algo supports no multi-parameter hypothesis"
         return None
 
     ## Sets MaxSize
     #  Parameter of FULL_NETGEN
     #  @ingroup l3_hypos_netgen
     def SetMaxSize(self, theSize):
-        if self.params == 0:
-            self.Parameters()
-        self.params.SetMaxSize(theSize)
+        self.Parameters().SetMaxSize(theSize)
 
     ## Sets SecondOrder flag
     #  Parameter of FULL_NETGEN
     #  @ingroup l3_hypos_netgen
     def SetSecondOrder(self, theVal):
-        if self.params == 0:
-            self.Parameters()
-        self.params.SetSecondOrder(theVal)
+        self.Parameters().SetSecondOrder(theVal)
 
     ## Sets Optimize flag
     #  Parameter of FULL_NETGEN
     #  @ingroup l3_hypos_netgen
     def SetOptimize(self, theVal):
-        if self.params == 0:
-            self.Parameters()
-        self.params.SetOptimize(theVal)
+        self.Parameters().SetOptimize(theVal)
 
     ## Sets Fineness
     #  @param theFineness is:
@@ -3549,114 +3582,129 @@ class Mesh_Tetrahedron(Mesh_Algorithm):
     #  Parameter of FULL_NETGEN
     #  @ingroup l3_hypos_netgen
     def SetFineness(self, theFineness):
-        if self.params == 0:
-            self.Parameters()
-        self.params.SetFineness(theFineness)
+        self.Parameters().SetFineness(theFineness)
 
     ## Sets GrowthRate
     #  Parameter of FULL_NETGEN
     #  @ingroup l3_hypos_netgen
     def SetGrowthRate(self, theRate):
-        if self.params == 0:
-            self.Parameters()
-        self.params.SetGrowthRate(theRate)
+        self.Parameters().SetGrowthRate(theRate)
 
     ## Sets NbSegPerEdge
     #  Parameter of FULL_NETGEN
     #  @ingroup l3_hypos_netgen
     def SetNbSegPerEdge(self, theVal):
-        if self.params == 0:
-            self.Parameters()
-        self.params.SetNbSegPerEdge(theVal)
+        self.Parameters().SetNbSegPerEdge(theVal)
 
     ## Sets NbSegPerRadius
     #  Parameter of FULL_NETGEN
     #  @ingroup l3_hypos_netgen
     def SetNbSegPerRadius(self, theVal):
-        if self.params == 0:
-            self.Parameters()
-        self.params.SetNbSegPerRadius(theVal)
+        self.Parameters().SetNbSegPerRadius(theVal)
+
+    ## Sets number of segments overriding value set by SetLocalLength()
+    #  Only for algoType == NETGEN_FULL
+    #  @ingroup l3_hypos_netgen
+    def SetNumberOfSegments(self, theVal):
+        self.Parameters(SIMPLE).SetNumberOfSegments(theVal)
+
+    ## Sets number of segments overriding value set by SetNumberOfSegments()
+    #  Only for algoType == NETGEN_FULL
+    #  @ingroup l3_hypos_netgen
+    def SetLocalLength(self, theVal):
+        self.Parameters(SIMPLE).SetLocalLength(theVal)
+
+    ## Defines "MaxElementArea" parameter of NETGEN_SimpleParameters_3D hypothesis.
+    #  Overrides value set by LengthFromEdges()
+    #  Only for algoType == NETGEN_FULL
+    #  @ingroup l3_hypos_netgen
+    def MaxElementArea(self, area):
+        self.Parameters(SIMPLE).SetMaxElementArea(area)
+
+    ## Defines "LengthFromEdges" parameter of NETGEN_SimpleParameters_3D hypothesis
+    #  Overrides value set by MaxElementArea()
+    #  Only for algoType == NETGEN_FULL
+    #  @ingroup l3_hypos_netgen
+    def LengthFromEdges(self):
+        self.Parameters(SIMPLE).LengthFromEdges()
+
+    ## Defines "LengthFromFaces" parameter of NETGEN_SimpleParameters_3D hypothesis
+    #  Overrides value set by MaxElementVolume()
+    #  Only for algoType == NETGEN_FULL
+    #  @ingroup l3_hypos_netgen
+    def LengthFromFaces(self):
+        self.Parameters(SIMPLE).LengthFromFaces()
 
     ## To mesh "holes" in a solid or not. Default is to mesh.
-    #  Parameter of GHS3D
     #  @ingroup l3_hypos_ghs3dh
     def SetToMeshHoles(self, toMesh):
-        if self.params == 0: self.Parameters()
-        self.params.SetToMeshHoles(toMesh)
+        #  Parameter of GHS3D
+        self.Parameters().SetToMeshHoles(toMesh)
 
     ## Set Optimization level:
     #   None_Optimization, Light_Optimization, Medium_Optimization, Strong_Optimization.
     #  Default is Medium_Optimization
-    #  Parameter of GHS3D
     #  @ingroup l3_hypos_ghs3dh
     def SetOptimizationLevel(self, level):
-        if self.params == 0: self.Parameters()
-        self.params.SetOptimizationLevel(level)
+        #  Parameter of GHS3D
+        self.Parameters().SetOptimizationLevel(level)
 
     ## Maximal size of memory to be used by the algorithm (in Megabytes).
-    #  Advanced parameter of GHS3D
     #  @ingroup l3_hypos_ghs3dh
     def SetMaximumMemory(self, MB):
-        if self.params == 0: self.Parameters()
-        self.params.SetMaximumMemory(MB)
+        #  Advanced parameter of GHS3D
+        self.Parameters().SetMaximumMemory(MB)
 
     ## Initial size of memory to be used by the algorithm (in Megabytes) in
-    #  automatic memory adjustment mode
-    #  Advanced parameter of GHS3D
+    #  automatic memory adjustment mode.
     #  @ingroup l3_hypos_ghs3dh
     def SetInitialMemory(self, MB):
-        if self.params == 0: self.Parameters()
-        self.params.SetInitialMemory(MB)
+        #  Advanced parameter of GHS3D
+        self.Parameters().SetInitialMemory(MB)
 
-    ## Path to working directory
-    #  Advanced parameter of GHS3D
+    ## Path to working directory.
     #  @ingroup l3_hypos_ghs3dh
     def SetWorkingDirectory(self, path):
-        if self.params == 0: self.Parameters()
-        self.params.SetWorkingDirectory(path)
+        #  Advanced parameter of GHS3D
+        self.Parameters().SetWorkingDirectory(path)
 
-    ## To keep working files or remove them. Log file remains in case of errors anyway
-    #  Advanced parameter of GHS3D
+    ## To keep working files or remove them. Log file remains in case of errors anyway.
     #  @ingroup l3_hypos_ghs3dh
     def SetKeepFiles(self, toKeep):
-        if self.params == 0: self.Parameters()
-        self.params.SetKeepFiles(toKeep)
+        #  Advanced parameter of GHS3D
+        self.Parameters().SetKeepFiles(toKeep)
 
-    ## To set verbose level [0-10]
-    #  0 - no standard output,
-    #  2 - prints the data, quality statistics of the skin and final meshes and
+    ## To set verbose level [0-10]. <ul>
+    #<li> 0 - no standard output,
+    #<li> 2 - prints the data, quality statistics of the skin and final meshes and
     #     indicates when the final mesh is being saved. In addition the software
     #     gives indication regarding the CPU time.
-    # 10 - same as 2 plus the main steps in the computation, quality statistics
+    #<li>10 - same as 2 plus the main steps in the computation, quality statistics
     #     histogram of the skin mesh, quality statistics histogram together with
-    #     the characteristics of the final mesh.
-    #  Advanced parameter of GHS3D
+    #     the characteristics of the final mesh.</ul>
     #  @ingroup l3_hypos_ghs3dh
     def SetVerboseLevel(self, level):
-        if self.params == 0: self.Parameters()
-        self.params.SetVerboseLevel(level)
+        #  Advanced parameter of GHS3D
+        self.Parameters().SetVerboseLevel(level)
 
-    ## To create new nodes
-    #  Advanced parameter of GHS3D
+    ## To create new nodes.
     #  @ingroup l3_hypos_ghs3dh
     def SetToCreateNewNodes(self, toCreate):
-        if self.params == 0: self.Parameters()
-        self.params.SetToCreateNewNodes(toCreate)
+        #  Advanced parameter of GHS3D
+        self.Parameters().SetToCreateNewNodes(toCreate)
 
     ## To use boundary recovery version which tries to create mesh on a very poor
-    #  quality surface mesh
-    #  Advanced parameter of GHS3D
+    #  quality surface mesh.
     #  @ingroup l3_hypos_ghs3dh
     def SetToUseBoundaryRecoveryVersion(self, toUse):
-        if self.params == 0: self.Parameters()
-        self.params.SetToUseBoundaryRecoveryVersion(toUse)
+        #  Advanced parameter of GHS3D
+        self.Parameters().SetToUseBoundaryRecoveryVersion(toUse)
 
-    ## To set hidden/undocumented/advanced options
-    #  Advanced parameter of GHS3D
+    ## Sets command line option as text. 
     #  @ingroup l3_hypos_ghs3dh
     def SetTextOption(self, option):
-        if self.params == 0: self.Parameters()
-        self.params.SetTextOption(option)
+        #  Advanced parameter of GHS3D
+        self.Parameters().SetTextOption(option)
 
 # Public class: Mesh_Hexahedron
 # ------------------------------