Salome HOME
SALOME_TESTS/Grids/smesh/mesh_Projection_2D_00/A0
[modules/smesh.git] / src / SMESH_SWIG / StdMeshersBuilder.py
index 265a9801b0d449a0407a00e15ab24267808313f1..1e9c735332a99c79bbfadde90cb2a50c2a3eeb7f 100644 (file)
@@ -1,9 +1,9 @@
-# Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2014  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.
+# 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
@@ -1400,18 +1400,17 @@ class StdMeshersBuilder_Cartesian_3D(Mesh_Algorithm):
     #    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 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 UseExisting if ==true - searches for the existing hypothesis created with
-    #                     the same parameters, else (default) - creates a new one
-    def SetGrid(self, xGridDef, yGridDef, zGridDef, sizeThreshold=4.0, UseExisting=False):
+    #         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):
         if not self.hyp:
             compFun = lambda hyp, args: False
             self.hyp = self.Hypothesis("CartesianParameters3D",
                                        [xGridDef, yGridDef, zGridDef, sizeThreshold],
-                                       UseExisting=UseExisting, CompareMethod=compFun)
+                                       UseExisting=False, CompareMethod=compFun)
         if not self.mesh.IsUsedHypothesis( self.hyp, self.geom ):
             self.mesh.AddHypothesis( self.hyp, self.geom )
 
@@ -1427,6 +1426,7 @@ class StdMeshersBuilder_Cartesian_3D(Mesh_Algorithm):
             else:
                 self.hyp.SetGridSpacing( gridDef[0], gridDef[1], axis )
         self.hyp.SetSizeThreshold( sizeThreshold )
+        self.hyp.SetToAddEdges( implEdges )
         return self.hyp
 
     ## Defines custom directions of axes of the grid
@@ -1470,15 +1470,17 @@ class StdMeshersBuilder_Cartesian_3D(Mesh_Algorithm):
     #  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
-    #         3 components of coordinates.
+    #         a vertex or 3 components of coordinates.
     #  @param toUnset defines whether the fixed point is defined or removed.
     def SetFixedPoint( self, p, toUnset=False ):
-        import SMESH
+        import SMESH, GEOM
         if toUnset:
             if not self.hyp: return
             p = SMESH.PointStruct(0,0,0)
-        if hasattr( p, "__getitem__" ):
+        elif hasattr( p, "__getitem__" ):
             p = SMESH.PointStruct( p[0],p[1],p[2] )
+        elif isinstance( p, GEOM._objref_GEOM_Object ):
+            p = self.mesh.smeshpyD.GetPointStruct( p )
         if not self.hyp:
             self.hyp = self.Hypothesis("CartesianParameters3D")
         if not self.mesh.IsUsedHypothesis( self.hyp, self.geom ):