Back to index

salome-geom  6.5.0
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
GEOM_PY.structelem.orientation.Orientation1D Class Reference

List of all members.

Public Member Functions

def __init__
def __repr__
def addParams
def buildMarker
def getVecYZ

Public Attributes

 geom

Private Member Functions

def _getDefaultVecYZ

Private Attributes

 _vectorYCoords
 _angle

Detailed Description

This class is used to compute the orientation of 1D elements and to build
the corresponding markers.

Definition at line 33 of file orientation.py.


Constructor & Destructor Documentation

Definition at line 39 of file orientation.py.

00039 
00040     def __init__(self):
00041         self.geom = None
00042         self._vectorYCoords = None
00043         self._angle = 0.0


Member Function Documentation

Definition at line 44 of file orientation.py.

00044 
00045     def __repr__(self):
00046         reprdict = self.__dict__.copy()
00047         del reprdict["geom"]
00048         return '%s(%s)' % (self.__class__.__name__, reprdict)

def GEOM_PY.structelem.orientation.Orientation1D._getDefaultVecYZ (   self,
  center,
  vecX 
) [private]
Get the vectors Y and Z for the default LCS, that use the main
direction of the 1D object as the local X axis and the global Z axis
to determine the local Z axis.

Definition at line 83 of file orientation.py.

00083 
00084     def _getDefaultVecYZ(self, center, vecX):
00085         """
00086         Get the vectors Y and Z for the default LCS, that use the main
00087         direction of the 1D object as the local X axis and the global Z axis
00088         to determine the local Z axis.
00089         """
00090         xPoint = self.geom.MakeTranslationVector(center, vecX)
00091         givenVecZ = self.geom.MakeVectorDXDYDZ(0.0, 0.0, 1.0)
00092         angle = self.geom.GetAngleRadians(vecX, givenVecZ)
00093         if abs(angle) < 1e-7 or abs(angle - math.pi) < 1e-7:
00094             logger.warning("Beam X axis is colinear to absolute Z axis. "
00095                            "Absolute X axis will be used to determine "
00096                            "local Z axis.")
00097             givenVecZ = self.geom.MakeVectorDXDYDZ(1.0, 0.0, 0.0)
00098         zPoint = self.geom.MakeTranslationVector(center, givenVecZ)
00099         locPlaneZX = self.geom.MakePlaneThreePnt(center, zPoint, xPoint, 1.0)
00100         locY = self.geom.GetNormal(locPlaneZX)
00101         yPoint = self.geom.MakeTranslationVector(center, locY)
00102         locPlaneXY = self.geom.MakePlaneThreePnt(center, xPoint, yPoint, 1.0)
00103         locZ = self.geom.GetNormal(locPlaneXY)
00104         return (locY, locZ)

Here is the caller graph for this function:

Add orientation parameters. `params` is a dictionary containing one or
several orientation parameters. The valid parameters are:

* "VECT_Y": Triplet defining the local Y axis (the X axis is the
  main direction of the 1D element).
* "ANGL_VRIL": Angle of rotation along the X axis to define the local
  coordinate system.

The parameters can be specified several times. In this case, only the
first "VECT_Y" is taken into account, and the values of "ANGL_VRIL"
are added to obtain the total rotation angle.

Definition at line 49 of file orientation.py.

00049 
00050     def addParams(self, params):
00051         """
00052         Add orientation parameters. `params` is a dictionary containing one or
00053         several orientation parameters. The valid parameters are:
00054 
00055         * "VECT_Y": Triplet defining the local Y axis (the X axis is the
00056           main direction of the 1D element).
00057         * "ANGL_VRIL": Angle of rotation along the X axis to define the local
00058           coordinate system.
00059         
00060         The parameters can be specified several times. In this case, only the
00061         first "VECT_Y" is taken into account, and the values of "ANGL_VRIL"
00062         are added to obtain the total rotation angle.
00063         """
00064         mydict = params.copy()
00065         if mydict.has_key("VECT_Y"):
00066             newVecCoords = mydict.pop("VECT_Y")
00067             if self._vectorYCoords is None:
00068                 logger.debug("Setting orientation vector Y to %s" %
00069                              str(newVecCoords))
00070                 self._vectorYCoords = newVecCoords
00071             else:
00072                 logger.warning('Orientation parameter "VECT_Y" is specified '
00073                                'several times for the same mesh group, vector'
00074                                ' %s will be used' % str(self._vectorYCoords))
00075         if mydict.has_key("ANGL_VRIL"):
00076             newAngle = mydict.pop("ANGL_VRIL")
00077             self._angle += newAngle
00078             logger.debug("Adding angle %f to orientation, new angle is %f." %
00079                          (newAngle, self._angle))
00080         if len(mydict) > 0:
00081             logger.warning("Invalid orientation parameter(s) (ignored): %s" %
00082                            str(mydict))

def GEOM_PY.structelem.orientation.Orientation1D.buildMarker (   self,
  geom,
  center,
  vecX 
)
Create a marker with origin `center` and X axis `vecX`. `geom` is the
pseudo-geompy object used to build the geometric shapes.

Definition at line 105 of file orientation.py.

00105 
00106     def buildMarker(self, geom, center, vecX):
00107         """
00108         Create a marker with origin `center` and X axis `vecX`. `geom` is the
00109         pseudo-geompy object used to build the geometric shapes.
00110         """
00111         (locY, locZ) = self.getVecYZ(geom, center, vecX)
00112         marker = geom.MakeMarkerPntTwoVec(center, vecX, locY)
00113         return marker

Here is the call graph for this function:

def GEOM_PY.structelem.orientation.Orientation1D.getVecYZ (   self,
  geom,
  center,
  vecX 
)
Get the vectors Y and Z for the LCS with origin `center` and X axis
`vecX`. `geom` is the pseudo-geompy object used to build the geometric
shapes.

Definition at line 114 of file orientation.py.

00114 
00115     def getVecYZ(self, geom, center, vecX):
00116         """
00117         Get the vectors Y and Z for the LCS with origin `center` and X axis
00118         `vecX`. `geom` is the pseudo-geompy object used to build the geometric
00119         shapes.
00120         """
00121         self.geom = geom
00122         locY = None
00123         locZ = None
00124         if self._vectorYCoords is None:
00125             (locY, locZ) = self._getDefaultVecYZ(center, vecX)
00126         else:
00127             xPoint = self.geom.MakeTranslationVector(center, vecX)
00128             givenLocY = self.geom.MakeVectorDXDYDZ(self._vectorYCoords[0],
00129                                                    self._vectorYCoords[1],
00130                                                    self._vectorYCoords[2])
00131             angle = self.geom.GetAngleRadians(vecX, givenLocY)
00132             if abs(angle) < 1e-7 or abs(angle - math.pi) < 1e-7:
00133                 logger.warning("Vector Y is colinear to the beam X axis, "
00134                                "using default LCS.")
00135                 (locY, locZ) = self._getDefaultVecYZ(center, vecX)
00136             else:
00137                 yPoint = self.geom.MakeTranslationVector(center, givenLocY)
00138                 locPlaneXY = self.geom.MakePlaneThreePnt(center, xPoint,
00139                                                          yPoint, 1.0)
00140                 locZ = self.geom.GetNormal(locPlaneXY)
00141                 zPoint = self.geom.MakeTranslationVector(center, locZ)
00142                 locPlaneZX = self.geom.MakePlaneThreePnt(center, zPoint,
00143                                                          xPoint, 1.0)
00144                 locY = self.geom.GetNormal(locPlaneZX)
00145 
00146         if self._angle != 0.0:
00147             angleRad = math.radians(self._angle)
00148             locY = self.geom.Rotate(locY, vecX, angleRad)
00149             locZ = self.geom.Rotate(locZ, vecX, angleRad)
00150 
00151         return (locY, locZ)
00152 

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 42 of file orientation.py.

Definition at line 41 of file orientation.py.

Definition at line 40 of file orientation.py.


The documentation for this class was generated from the following file: