Back to index

salome-geom  6.5.0
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Private Attributes
GEOM_PY.structelem.parts.StructuralElementPart Class Reference
Inheritance diagram for GEOM_PY.structelem.parts.StructuralElementPart:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def __init__
def __repr__
def addOrientation
def build

Public Attributes

 groupName
 name
 geom
 baseShapesSet
 isMainShape
 color

Static Public Attributes

string DEFAULT_NAME = "StructElemPart"

Private Member Functions

def _getParameter
def _getParamUserName
def _checkSize
def _buildPart
def _buildMarkers
def _getSubShapes

Private Attributes

 _parameters
 _groupGeomObj
 _orientation
 _paramUserName

Detailed Description

This class is the base class for all structural element parts. It should
not be instantiated directly (consider it as an "abstract" class).

:type  studyId: integer
:param studyId: the ID of the study in which the part is created.

:type  groupName: string
:param groupName: the name of the underlying geometrical primitive in the
                  study.

:type  groupGeomObj: GEOM object
:param groupGeomObj: the underlying geometrical primitive.

:type  parameters: dictionary
:param parameters: parameters defining the structural element (see
                   subclasses for details).

:type  name: string
:param name: name to use for the created object in the study.

Definition at line 104 of file parts.py.


Constructor & Destructor Documentation

def GEOM_PY.structelem.parts.StructuralElementPart.__init__ (   self,
  studyId,
  groupName,
  groupGeomObj,
  parameters,
  name = DEFAULT_NAME,
  color = None 
)

Reimplemented in GEOM_PY.structelem.parts.GeneralBeam, GEOM_PY.structelem.parts.RectangularBeam, GEOM_PY.structelem.parts.CircularBeam, and GEOM_PY.structelem.parts.Beam.

Definition at line 131 of file parts.py.

00131 
00132                  name = DEFAULT_NAME, color = None):
00133         self._parameters = parameters
00134         self.groupName = groupName
00135         self._groupGeomObj = groupGeomObj
00136         self._orientation = None
00137         self._paramUserName = {}
00138         self.name = name
00139         self.geom = getGeompy(studyId)
00140         self.baseShapesSet = set()
00141         self.isMainShape = groupGeomObj.IsMainShape()
00142         if not self.isMainShape:
00143             mainShape = self.geom.GetMainShape(groupGeomObj)
00144             listIDs = self.geom.GetObjectIDs(groupGeomObj)
00145             if mainShape is not None and listIDs is not None:
00146                 for id in listIDs:
00147                     self.baseShapesSet.add(SubShapeID(mainShape, id))
00148         self.color = color
00149         if self.color is None:
00150             self.color = self._groupGeomObj.GetColor()


Member Function Documentation

Definition at line 174 of file parts.py.

00174 
00175     def __repr__(self):
00176         reprdict = self.__dict__.copy()
00177         del reprdict["_parameters"]
00178         del reprdict["groupName"]
00179         del reprdict["_groupGeomObj"]
00180         del reprdict["_paramUserName"]
00181         del reprdict["name"]
00182         del reprdict["geom"]
00183         del reprdict["baseShapesSet"]
00184         return '%s("%s", %s)' % (self.__class__.__name__, self.groupName,
00185                                  reprdict)

This abstract method must be implemented in subclasses and should
create the markers defining the orientation of the structural element
part.

Reimplemented in GEOM_PY.structelem.parts.Grid, GEOM_PY.structelem.parts.ThickShell, and GEOM_PY.structelem.parts.Beam.

Definition at line 225 of file parts.py.

00225 
00226     def _buildMarkers(self):
00227         """
00228         This abstract method must be implemented in subclasses and should
00229         create the markers defining the orientation of the structural element
00230         part.
00231         """
00232         raise NotImplementedError("Method _buildMarker not implemented in "
00233                                   "class %s (it must be implemented in "
00234                                   "StructuralElementPart subclasses)." %
00235                                   self.__class__.__name__)

Here is the caller graph for this function:

This abstract method must be implemented in subclasses and should
create the geometrical shape(s) of the structural element part.

Reimplemented in GEOM_PY.structelem.parts.Grid, GEOM_PY.structelem.parts.ThickShell, and GEOM_PY.structelem.parts.Beam.

Definition at line 215 of file parts.py.

00215 
00216     def _buildPart(self):
00217         """
00218         This abstract method must be implemented in subclasses and should
00219         create the geometrical shape(s) of the structural element part.
00220         """
00221         raise NotImplementedError("Method _buildPart not implemented in class"
00222                                   " %s (it must be implemented in "
00223                                   "StructuralElementPart subclasses)." %
00224                                   self.__class__.__name__)

Here is the caller graph for this function:

def GEOM_PY.structelem.parts.StructuralElementPart._checkSize (   self,
  value,
  mindim,
  expression 
) [private]
This method checks that some parameters or some expressions involving
those parameters are greater than a minimum value.

Definition at line 194 of file parts.py.

00194 
00195     def _checkSize(self, value, mindim, expression):
00196         """
00197         This method checks that some parameters or some expressions involving
00198         those parameters are greater than a minimum value.
00199         """
00200         if value < mindim:
00201             raise InvalidParameterError(self.groupName, expression,
00202                                         mindim, value)

def GEOM_PY.structelem.parts.StructuralElementPart._getParameter (   self,
  nameList,
  default = None 
) [private]
This method finds the value of a parameter in the parameters
dictionary. The argument is a list because some parameters can have
several different names.

Definition at line 151 of file parts.py.

00151 
00152     def _getParameter(self, nameList, default = None):
00153         """
00154         This method finds the value of a parameter in the parameters
00155         dictionary. The argument is a list because some parameters can have
00156         several different names.
00157         """
00158         if len(nameList) > 0:
00159             paramName = nameList[0]
00160         for name in nameList:
00161             if self._parameters.has_key(name):
00162                 self._paramUserName[paramName] = name
00163                 return self._parameters[name]
00164         return default

def GEOM_PY.structelem.parts.StructuralElementPart._getParamUserName (   self,
  paramName 
) [private]
This method finds the user name for a parameter.

Definition at line 165 of file parts.py.

00165 
00166     def _getParamUserName(self, paramName):
00167         """
00168         This method finds the user name for a parameter.
00169         """
00170         if self._paramUserName.has_key(paramName):
00171             return self._paramUserName[paramName]
00172         else:
00173             return paramName

Find and return the base sub-shapes in the structural element part.

Definition at line 236 of file parts.py.

00236 
00237     def _getSubShapes(self, minDim = MIN_LENGTH_FOR_EXTRUSION):
00238         """
00239         Find and return the base sub-shapes in the structural element part.
00240         """
00241         if self.isMainShape:
00242             return [self._groupGeomObj]
00243         subShapes = []
00244         for subShapeID in self.baseShapesSet:
00245             subShape = subShapeID.getObj(self.geom)
00246             length = self.geom.BasicProperties(subShape)[0]
00247             if length < minDim:
00248                 logger.warning("Length too short (%s - ID %s, length = %g), "
00249                                "subshape will not be used in structural "
00250                                "element" % (self.groupName, subShapeID._id,
00251                                             length))
00252             else:
00253                 subShapes.append(subShape)
00254         return subShapes
00255 

Here is the caller graph for this function:

Add orientation information to the structural element part. See class
:class:`~salome.geom.structelem.orientation.Orientation1D` for the description
of the parameters.

Definition at line 186 of file parts.py.

00186 
00187     def addOrientation(self, orientParams):
00188         """
00189         Add orientation information to the structural element part. See class
00190         :class:`~salome.geom.structelem.orientation.Orientation1D` for the description
00191         of the parameters.
00192         """
00193         self._orientation.addParams(orientParams)

Build the geometric shapes and the markers corresponding to the
structural element part in the study `studyId`.

Definition at line 203 of file parts.py.

00203 
00204     def build(self):
00205         """
00206         Build the geometric shapes and the markers corresponding to the
00207         structural element part in the study `studyId`.
00208         """
00209         shape = self._buildPart()
00210         markers = self._buildMarkers()
00211         shape.SetColor(self.color)
00212         for marker in markers:
00213             marker.SetColor(self.color)
00214         return (shape, markers)

Here is the call graph for this function:


Member Data Documentation

Definition at line 134 of file parts.py.

Definition at line 132 of file parts.py.

Definition at line 136 of file parts.py.

Definition at line 139 of file parts.py.

Definition at line 147 of file parts.py.

Definition at line 138 of file parts.py.

Definition at line 133 of file parts.py.

Definition at line 140 of file parts.py.

Definition at line 137 of file parts.py.


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