+ 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] )
+ elif isinstance( xAxis, GEOM._objref_GEOM_Object ):
+ xAxis = self.mesh.smeshpyD.GetDirStruct( xAxis )
+ if hasattr( yAxis, "__getitem__" ):
+ yAxis = self.mesh.smeshpyD.MakeDirStruct( yAxis[0],yAxis[1],yAxis[2] )
+ elif isinstance( yAxis, GEOM._objref_GEOM_Object ):
+ yAxis = self.mesh.smeshpyD.GetDirStruct( yAxis )
+ if hasattr( zAxis, "__getitem__" ):
+ zAxis = self.mesh.smeshpyD.MakeDirStruct( zAxis[0],zAxis[1],zAxis[2] )
+ elif isinstance( zAxis, GEOM._objref_GEOM_Object ):
+ zAxis = self.mesh.smeshpyD.GetDirStruct( zAxis )
+ if not self.hyp:
+ self.hyp = self.Hypothesis("CartesianParameters3D")
+ if not self.mesh.IsUsedHypothesis( self.hyp, self.geom ):
+ self.mesh.AddHypothesis( self.hyp, self.geom )
+ self.hyp.SetAxesDirs( xAxis, yAxis, zAxis )
+ return self.hyp
+
+ 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.mesh.AddHypothesis( self.hyp, self.geom )
+ x,y,z = self.hyp.ComputeOptimalAxesDirs( self.geom, isOrthogonal )
+ self.hyp.SetAxesDirs( x,y,z )
+ return self.hyp
+
+ 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
+ p = SMESH.PointStruct(0,0,0)
+ 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 ):
+ self.mesh.AddHypothesis( self.hyp, self.geom )
+ self.hyp.SetFixedPoint( p, toUnset )
+ return self.hyp
+
+