Salome HOME
Fix problems with the OpenGL clipping planes.
[modules/smesh.git] / src / SMESH_SWIG / smeshBuilder.py
index 41791ff77611d844e72f8d7aaaab4d50ac6ce65e..fb80a5abeb7590efb65f55191f196afbbed354f7 100644 (file)
@@ -93,6 +93,16 @@ import SALOME
 import SALOMEDS
 import os
 
+class MeshMeta(type):
+    def __instancecheck__(cls, inst):
+        """Implement isinstance(inst, cls)."""
+        return any(cls.__subclasscheck__(c)
+                   for c in {type(inst), inst.__class__})
+
+    def __subclasscheck__(cls, sub):
+        """Implement issubclass(sub, cls)."""
+        return type.__subclasscheck__(cls, sub) or (cls.__name__ == sub.__name__ and cls.__module__ == sub.__module__)
+
 ## @addtogroup l1_auxiliary
 ## @{
 
@@ -1144,6 +1154,7 @@ def New( study, instance=None):
 #  new nodes and elements and by changing the existing entities), to get information
 #  about a mesh and to export a mesh into different formats.
 class Mesh:
+    __metaclass__ = MeshMeta
 
     geom = 0
     mesh = 0
@@ -1901,7 +1912,7 @@ class Mesh:
     def RemoveGroupWithContents(self, group):
         self.mesh.RemoveGroupWithContents(group)
 
-    ## Gets the list of groups existing in the mesh
+    ## Gets the list of groups existing in the mesh in the order of creation (starting from the oldest one)
     #  @return a sequence of SMESH_GroupBase
     #  @ingroup l2_grps_create
     def GetGroups(self):
@@ -3076,14 +3087,20 @@ class Mesh:
             pass
         # axis
         if isinstance( startHexPoint, geomBuilder.GEOM._objref_GEOM_Object):
-            startHexPoint = self.geompyD.PointCoordinates( startHexPoint )
+            startHexPoint = self.smeshpyD.GetPointStruct( startHexPoint )
+        elif isinstance( startHexPoint, list ):
+            startHexPoint = SMESH.PointStruct( startHexPoint[0],
+                                               startHexPoint[1],
+                                               startHexPoint[2])
         if isinstance( facetNormal, geomBuilder.GEOM._objref_GEOM_Object):
-            facetNormal = self.geompyD.VectorCoordinates( facetNormal )
-        axis = SMESH.AxisStruct( startHexPoint[0], startHexPoint[1], startHexPoint[2],
-                                 facetNormal[0],   facetNormal[1],   facetNormal[2])
-        self.mesh.SetParameters( axis.parameters )
+            facetNormal = self.smeshpyD.GetDirStruct( facetNormal )
+        elif isinstance( facetNormal, list ):
+            facetNormal = self.smeshpyD.MakeDirStruct( facetNormal[0],
+                                                       facetNormal[1],
+                                                       facetNormal[2])
+        self.mesh.SetParameters( startHexPoint.parameters + facetNormal.PS.parameters )
 
-        self.editor.SplitHexahedraIntoPrisms(elems, method, axis, allDomains)
+        self.editor.SplitHexahedraIntoPrisms(elems, startHexPoint, facetNormal, method, allDomains)
 
     ## Splits quadrangle faces near triangular facets of volumes
     #
@@ -4590,7 +4607,7 @@ class Mesh:
         return self._valueFromFunctor(SMESH.FT_Skew, elemId)
 
     pass # end of Mesh class
-    
+
 ## Helper class for wrapping of SMESH.SMESH_Pattern CORBA class
 #
 class Pattern(SMESH._objref_SMESH_Pattern):