Salome HOME
Avoid installing redundant files
[modules/geom.git] / src / GEOM_PY / structelem / parts.py
index 63c9819be6d5a95c1a7d2ecdb9cc293f83c1c146..1a3a4c8585f7d4d79b69eefa3824cecb1dfd4744 100644 (file)
@@ -1,11 +1,11 @@
 # -*- coding: utf-8 -*-
 #
 # -*- coding: utf-8 -*-
 #
-# Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2021  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
 #
 # 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
 #
 # This library is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 #
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 #
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
+
+## \defgroup parts parts
+#  \{ 
+#  \details
+#  This module defines the different structural element parts. It is used to
+#  build the geometric shapes of the structural elements. It should not be used
+#  directly in the general case. Structural elements should be created by the
+#  \ref structelem.StructuralElementManager "salome.geom.structelem.StructuralElementManager".
+#  \}
+
 """
 This module defines the different structural element parts. It is used to
 build the geometric shapes of the structural elements. It should not be used
 """
 This module defines the different structural element parts. It is used to
 build the geometric shapes of the structural elements. It should not be used
@@ -35,7 +45,7 @@ from salome.kernel import termcolor
 logger = Logger("salome.geom.structelem.parts", color = termcolor.RED)
 from salome.geom.geomtools import getGeompy
 
 logger = Logger("salome.geom.structelem.parts", color = termcolor.RED)
 from salome.geom.geomtools import getGeompy
 
-import orientation
+from . import orientation
 
 # Filling for the beams
 FULL = "FULL"
 
 # Filling for the beams
 FULL = "FULL"
@@ -56,7 +66,9 @@ LIGHT_RED = SALOMEDS.Color(1.0, 0.5, 0.5)
 PURPLE = SALOMEDS.Color(170.0/255.0, 85.0/255.0, 1.0)
 ORANGE = SALOMEDS.Color(1.0, 170.0/255.0, 0.0)
 
 PURPLE = SALOMEDS.Color(170.0/255.0, 85.0/255.0, 1.0)
 ORANGE = SALOMEDS.Color(1.0, 170.0/255.0, 0.0)
 
-
+## This exception is raised when an invalid parameter is used to build a
+#  structural element part.
+#  \ingroup parts
 class InvalidParameterError(Exception):
     """
     This exception is raised when an invalid parameter is used to build a
 class InvalidParameterError(Exception):
     """
     This exception is raised when an invalid parameter is used to build a
@@ -74,7 +86,10 @@ class InvalidParameterError(Exception):
                                             self.expression, self.value,
                                             self.groupName)
 
                                             self.expression, self.value,
                                             self.groupName)
 
-
+## This class enables the use of sub-shapes in sets or as dictionary keys.
+#  It implements __eq__ and __hash__ methods so that sub-shapes with the same
+#  CORBA object \em mainShape and the same \em id are considered equal.
+#  \ingroup parts
 class SubShapeID:
     """
     This class enables the use of sub-shapes in sets or as dictionary keys.
 class SubShapeID:
     """
     This class enables the use of sub-shapes in sets or as dictionary keys.
@@ -86,6 +101,8 @@ class SubShapeID:
         self._mainShape = mainShape
         self._id = id
 
         self._mainShape = mainShape
         self._id = id
 
+    ## Return the sub-shape (GEOM object). \em geom is a pseudo-geompy object
+    #  used to find the geometrical object.
     def getObj(self, geom):
         """
         Return the sub-shape (GEOM object). `geom` is a pseudo-geompy object
     def getObj(self, geom):
         """
         Return the sub-shape (GEOM object). `geom` is a pseudo-geompy object
@@ -100,15 +117,20 @@ class SubShapeID:
     def __hash__(self):
         return self._mainShape._hash(2147483647) ^ self._id
 
     def __hash__(self):
         return self._mainShape._hash(2147483647) ^ self._id
 
-
+## This class is the base class for all structural element parts. It should
+#  not be instantiated directly (consider it as an "abstract" class).
+#  \param groupName (string) the name of the underlying geometrical primitive 
+#  in the study.
+#  \param groupGeomObj (GEOM object) the underlying geometrical primitive.
+#  \param parameters (dictionary) parameters defining the structural element (see
+#  subclasses for details).
+#  \param name (string) name to use for the created object in the study.
+#  \ingroup parts
 class StructuralElementPart:
     """
     This class is the base class for all structural element parts. It should
     not be instantiated directly (consider it as an "abstract" class).
 
 class StructuralElementPart:
     """
     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  groupName: string
     :param groupName: the name of the underlying geometrical primitive in the
                       study.
@@ -127,7 +149,7 @@ class StructuralElementPart:
     
     DEFAULT_NAME = "StructElemPart"
 
     
     DEFAULT_NAME = "StructElemPart"
 
-    def __init__(self, studyId, groupName, groupGeomObj, parameters,
+    def __init__(self, groupName, groupGeomObj, parameters,
                  name = DEFAULT_NAME, color = None):
         self._parameters = parameters
         self.groupName = groupName
                  name = DEFAULT_NAME, color = None):
         self._parameters = parameters
         self.groupName = groupName
@@ -135,7 +157,7 @@ class StructuralElementPart:
         self._orientation = None
         self._paramUserName = {}
         self.name = name
         self._orientation = None
         self._paramUserName = {}
         self.name = name
-        self.geom = getGeompy(studyId)
+        self.geom = getGeompy()
         self.baseShapesSet = set()
         self.isMainShape = (groupGeomObj.GetType() != 37) # See geompyDC.ShapeIdToType for type codes
         if not self.isMainShape:
         self.baseShapesSet = set()
         self.isMainShape = (groupGeomObj.GetType() != 37) # See geompyDC.ShapeIdToType for type codes
         if not self.isMainShape:
@@ -148,6 +170,9 @@ class StructuralElementPart:
         if self.color is None:
             self.color = self._groupGeomObj.GetColor()
 
         if self.color is None:
             self.color = self._groupGeomObj.GetColor()
 
+    ## 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.
     def _getParameter(self, nameList, default = None):
         """
         This method finds the value of a parameter in the parameters
     def _getParameter(self, nameList, default = None):
         """
         This method finds the value of a parameter in the parameters
@@ -157,16 +182,17 @@ class StructuralElementPart:
         if len(nameList) > 0:
             paramName = nameList[0]
         for name in nameList:
         if len(nameList) > 0:
             paramName = nameList[0]
         for name in nameList:
-            if self._parameters.has_key(name):
+            if name in self._parameters:
                 self._paramUserName[paramName] = name
                 return self._parameters[name]
         return default
 
                 self._paramUserName[paramName] = name
                 return self._parameters[name]
         return default
 
+    ## This method finds the user name for a parameter.
     def _getParamUserName(self, paramName):
         """
         This method finds the user name for a parameter.
         """
     def _getParamUserName(self, paramName):
         """
         This method finds the user name for a parameter.
         """
-        if self._paramUserName.has_key(paramName):
+        if paramName in self._paramUserName:
             return self._paramUserName[paramName]
         else:
             return paramName
             return self._paramUserName[paramName]
         else:
             return paramName
@@ -183,6 +209,9 @@ class StructuralElementPart:
         return '%s("%s", %s)' % (self.__class__.__name__, self.groupName,
                                  reprdict)
 
         return '%s("%s", %s)' % (self.__class__.__name__, self.groupName,
                                  reprdict)
 
+    ## Add orientation information to the structural element part. See class
+    #  \ref Orientation1D "salome.geom.structelem.orientation.Orientation1D" 
+    #  for the description of the parameters.
     def addOrientation(self, orientParams):
         """
         Add orientation information to the structural element part. See class
     def addOrientation(self, orientParams):
         """
         Add orientation information to the structural element part. See class
@@ -191,6 +220,8 @@ class StructuralElementPart:
         """
         self._orientation.addParams(orientParams)
 
         """
         self._orientation.addParams(orientParams)
 
+    ## This method checks that some parameters or some expressions involving
+    #  those parameters are greater than a minimum value.
     def _checkSize(self, value, mindim, expression):
         """
         This method checks that some parameters or some expressions involving
     def _checkSize(self, value, mindim, expression):
         """
         This method checks that some parameters or some expressions involving
@@ -200,10 +231,12 @@ class StructuralElementPart:
             raise InvalidParameterError(self.groupName, expression,
                                         mindim, value)
 
             raise InvalidParameterError(self.groupName, expression,
                                         mindim, value)
 
+    ## Build the geometric shapes and the markers corresponding to the
+    #  structural element part in the study.
     def build(self):
         """
         Build the geometric shapes and the markers corresponding to the
     def build(self):
         """
         Build the geometric shapes and the markers corresponding to the
-        structural element part in the study `studyId`.
+        structural element part in the study.
         """
         shape = self._buildPart()
         markers = self._buildMarkers()
         """
         shape = self._buildPart()
         markers = self._buildMarkers()
@@ -212,6 +245,8 @@ class StructuralElementPart:
             marker.SetColor(self.color)
         return (shape, markers)
 
             marker.SetColor(self.color)
         return (shape, markers)
 
+    ## This abstract method must be implemented in subclasses and should
+    #  create the geometrical shape(s) of the structural element part.
     def _buildPart(self):
         """
         This abstract method must be implemented in subclasses and should
     def _buildPart(self):
         """
         This abstract method must be implemented in subclasses and should
@@ -222,6 +257,9 @@ class StructuralElementPart:
                                   "StructuralElementPart subclasses)." %
                                   self.__class__.__name__)
 
                                   "StructuralElementPart subclasses)." %
                                   self.__class__.__name__)
 
+    ## This abstract method must be implemented in subclasses and should
+    #  create the markers defining the orientation of the structural element
+    #  part.
     def _buildMarkers(self):
         """
         This abstract method must be implemented in subclasses and should
     def _buildMarkers(self):
         """
         This abstract method must be implemented in subclasses and should
@@ -233,6 +271,7 @@ class StructuralElementPart:
                                   "StructuralElementPart subclasses)." %
                                   self.__class__.__name__)
 
                                   "StructuralElementPart subclasses)." %
                                   self.__class__.__name__)
 
+    ## Find and return the base sub-shapes in the structural element part.
     def _getSubShapes(self, minDim = MIN_LENGTH_FOR_EXTRUSION):
         """
         Find and return the base sub-shapes in the structural element part.
     def _getSubShapes(self, minDim = MIN_LENGTH_FOR_EXTRUSION):
         """
         Find and return the base sub-shapes in the structural element part.
@@ -252,7 +291,10 @@ class StructuralElementPart:
                 subShapes.append(subShape)
         return subShapes
 
                 subShapes.append(subShape)
         return subShapes
 
-
+## This class is an "abstract" class for all 1D structural element parts. It
+#  should not be instantiated directly. See class StructuralElementPart 
+#  for the description of the parameters.
+#  \ingroup parts
 class Beam(StructuralElementPart):
     """
     This class is an "abstract" class for all 1D structural element parts. It
 class Beam(StructuralElementPart):
     """
     This class is an "abstract" class for all 1D structural element parts. It
@@ -262,12 +304,15 @@ class Beam(StructuralElementPart):
 
     DEFAULT_NAME = "Beam"
 
 
     DEFAULT_NAME = "Beam"
 
-    def __init__(self, studyId, groupName, groupGeomObj, parameters,
+    def __init__(self, groupName, groupGeomObj, parameters,
                  name = DEFAULT_NAME, color = None):
                  name = DEFAULT_NAME, color = None):
-        StructuralElementPart.__init__(self, studyId, groupName, groupGeomObj,
+        StructuralElementPart.__init__(self, groupName, groupGeomObj,
                                        parameters, name, color)
         self._orientation = orientation.Orientation1D()
 
                                        parameters, name, color)
         self._orientation = orientation.Orientation1D()
 
+    ## This method checks if a 1D object is "reversed", i.e. if its
+    #  orientation is different than the orientation of the underlying OCC
+    #  object.
     def _isReversed(self, path):
         """
         This method checks if a 1D object is "reversed", i.e. if its
     def _isReversed(self, path):
         """
         This method checks if a 1D object is "reversed", i.e. if its
@@ -280,6 +325,9 @@ class Beam(StructuralElementPart):
         dist = self.geom.MinDistance(p1, p2)
         return dist > length / 2
 
         dist = self.geom.MinDistance(p1, p2)
         return dist > length / 2
 
+    ## Get a vertex and the corresponding tangent on a wire by parameter.
+    #  This method takes into account the "real" orientation of the wire
+    #  (i.e. the orientation of the underlying OCC object).
     def _getVertexAndTangentOnOrientedWire(self, path, param):
         """
         Get a vertex and the corresponding tangent on a wire by parameter.
     def _getVertexAndTangentOnOrientedWire(self, path, param):
         """
         Get a vertex and the corresponding tangent on a wire by parameter.
@@ -298,6 +346,8 @@ class Beam(StructuralElementPart):
             tangent = self.geom.MakeTangentOnCurve(path, param)
         return (vertex, tangent)
 
             tangent = self.geom.MakeTangentOnCurve(path, param)
         return (vertex, tangent)
 
+    ## Create a solid by the extrusion of section \em wire1 to section \em wire2
+    #  along \em path.
     def _makeSolidPipeFromWires(self, wire1, wire2, point1, point2, path):
         """
         Create a solid by the extrusion of section `wire1` to section `wire2`
     def _makeSolidPipeFromWires(self, wire1, wire2, point1, point2, path):
         """
         Create a solid by the extrusion of section `wire1` to section `wire2`
@@ -307,11 +357,13 @@ class Beam(StructuralElementPart):
         face2 = self.geom.MakeFace(wire2, True)
         shell = self.geom.MakePipeWithDifferentSections([wire1, wire2],
                                                         [point1, point2],
         face2 = self.geom.MakeFace(wire2, True)
         shell = self.geom.MakePipeWithDifferentSections([wire1, wire2],
                                                         [point1, point2],
-                                                        path, False, False)
+                                                        path, False, False,
+                                                        False)
         closedShell = self.geom.MakeShell([face1, face2, shell])
         solid = self.geom.MakeSolid([closedShell])
         return solid
 
         closedShell = self.geom.MakeShell([face1, face2, shell])
         solid = self.geom.MakeSolid([closedShell])
         return solid
 
+    ## Build the structural element part.
     def _buildPart(self):
         """
         Build the structural element part.
     def _buildPart(self):
         """
         Build the structural element part.
@@ -351,6 +403,7 @@ class Beam(StructuralElementPart):
         else:
             return self.geom.MakeCompound(listPipes)
 
         else:
             return self.geom.MakeCompound(listPipes)
 
+    ## Build the markers defining the orientation of the structural element part.
     def _buildMarkers(self):
         """
         Build the markers defining the orientation of the structural element
     def _buildMarkers(self):
         """
         Build the markers defining the orientation of the structural element
@@ -367,6 +420,18 @@ class Beam(StructuralElementPart):
         return listMarkers
 
 
         return listMarkers
 
 
+## This class defines a beam with a circular section. It can be full or
+#  hollow, and its radius and thickness can vary from one end of the beam to
+#  the other. The valid parameters for circular beams are:
+#  - "R1" or "R": radius at the first end of the beam.
+#  - "R2" or "R": radius at the other end of the beam.
+#  - "EP1" or "EP" (optional): thickness at the first end of the beam.
+#    If not specified or equal to 0, the beam is considered full.
+#  - "EP2" or "EP" (optional): thickness at the other end of the beam.
+#  If not specified or equal to 0, the beam is considered full.
+#
+#  See class StructuralElementPart for the description of the other parameters.
+#  \ingroup parts
 class CircularBeam(Beam):
     """
     This class defines a beam with a circular section. It can be full or
 class CircularBeam(Beam):
     """
     This class defines a beam with a circular section. It can be full or
@@ -385,15 +450,15 @@ class CircularBeam(Beam):
 
     """
 
 
     """
 
-    def __init__(self, studyId, groupName, groupGeomObj, parameters,
+    def __init__(self, groupName, groupGeomObj, parameters,
                  name = Beam.DEFAULT_NAME, color = None):
         if color is None:
                  name = Beam.DEFAULT_NAME, color = None):
         if color is None:
-            if parameters.has_key("R1"): # variable section
+            if "R1" in parameters: # variable section
                 color = LIGHT_RED
             else:                       # constant section
                 color = RED
 
                 color = LIGHT_RED
             else:                       # constant section
                 color = RED
 
-        Beam.__init__(self, studyId, groupName, groupGeomObj, parameters,
+        Beam.__init__(self, groupName, groupGeomObj, parameters,
                       name, color)
 
         self.R1 = self._getParameter(["R1", "R"])
                       name, color)
 
         self.R1 = self._getParameter(["R1", "R"])
@@ -428,6 +493,7 @@ class CircularBeam(Beam):
                             "%s - %s" % (self._getParamUserName("R2"),
                                          self._getParamUserName("EP2")))
 
                             "%s - %s" % (self._getParamUserName("R2"),
                                          self._getParamUserName("EP2")))
 
+    ## Create the circular sections used to build the pipe.
     def _makeSectionWires(self, fPoint, fNormal, lPoint, lNormal):
         """
         Create the circular sections used to build the pipe.
     def _makeSectionWires(self, fPoint, fNormal, lPoint, lNormal):
         """
         Create the circular sections used to build the pipe.
@@ -446,6 +512,28 @@ class CircularBeam(Beam):
         return (outerCircle1, innerCircle1, outerCircle2, innerCircle2)
 
 
         return (outerCircle1, innerCircle1, outerCircle2, innerCircle2)
 
 
+## This class defines a beam with a rectangular section. It can be full or
+#  hollow, and its dimensions can vary from one end of the beam to the other.
+#  The valid parameters for rectangular beams are:
+#  - "HY1", "HY", "H1" or "H": width at the first end of the beam.
+#  - "HZ1", "HZ", "H1" or "H": height at the first end of the beam.
+#  - "HY2", "HY", "H2" or "H": width at the other end of the beam.
+#  - "HZ2", "HZ", "H2" or "H": height at the other end of the beam.
+#  - "EPY1", "EPY", "EP1" or "EP" (optional): thickness in the width
+#    direction at the first end of the beam. If not specified or equal to 0,
+#    the beam is considered full.
+#  - "EPZ1", "EPZ", "EP1" or "EP" (optional): thickness in the height
+#    direction at the first end of the beam. If not specified or equal to 0,
+#    the beam is considered full.
+#  - "EPY2", "EPY", "EP2" or "EP" (optional): thickness in the width
+#    direction at the other end of the beam. If not specified or equal to 0,
+#    the beam is considered full.
+#  - "EPZ2", "EPZ", "EP2" or "EP" (optional): thickness in the height
+#    direction at the other end of the beam. If not specified or equal to 0,
+#    the beam is considered full.
+#
+#   See class StructuralElementPart for the description of the other parameters.
+#  \ingroup parts
 class RectangularBeam(Beam):
     """
     This class defines a beam with a rectangular section. It can be full or
 class RectangularBeam(Beam):
     """
     This class defines a beam with a rectangular section. It can be full or
@@ -474,15 +562,15 @@ class RectangularBeam(Beam):
 
     """
 
 
     """
 
-    def __init__(self, studyId, groupName, groupGeomObj, parameters,
+    def __init__(self, groupName, groupGeomObj, parameters,
                  name = Beam.DEFAULT_NAME, color = None):
         if color is None:
                  name = Beam.DEFAULT_NAME, color = None):
         if color is None:
-            if parameters.has_key("HY1") or parameters.has_key("H1"):
+            if "HY1" in parameters or "H1" in parameters:
                 color = LIGHT_BLUE # variable section
             else:                  # constant section
                 color = BLUE
 
                 color = LIGHT_BLUE # variable section
             else:                  # constant section
                 color = BLUE
 
-        Beam.__init__(self, studyId, groupName, groupGeomObj, parameters,
+        Beam.__init__(self, groupName, groupGeomObj, parameters,
                       name, color)
 
         self.HY1 = self._getParameter(["HY1", "HY", "H1", "H"])
                       name, color)
 
         self.HY1 = self._getParameter(["HY1", "HY", "H1", "H"])
@@ -539,6 +627,7 @@ class RectangularBeam(Beam):
                             "%s - 2 * %s" % (self._getParamUserName("HZ2"),
                                              self._getParamUserName("EPZ2")))
 
                             "%s - 2 * %s" % (self._getParamUserName("HZ2"),
                                              self._getParamUserName("EPZ2")))
 
+    ## Create a rectangle in the specified plane.
     def _makeRectangle(self, HY, HZ, lcs):
         """
         Create a rectangle in the specified plane.
     def _makeRectangle(self, HY, HZ, lcs):
         """
         Create a rectangle in the specified plane.
@@ -553,6 +642,7 @@ class RectangularBeam(Beam):
         sketch = self.geom.MakeSketcherOnPlane(sketchStr, lcs)
         return sketch
 
         sketch = self.geom.MakeSketcherOnPlane(sketchStr, lcs)
         return sketch
 
+    ## Create one side of the rectangular sections used to build the pipe.
     def _makeSectionRectangles(self, point, vecX, HY, HZ, EPY, EPZ):
         """
         Create one side of the rectangular sections used to build the pipe.
     def _makeSectionRectangles(self, point, vecX, HY, HZ, EPY, EPZ):
         """
         Create one side of the rectangular sections used to build the pipe.
@@ -568,6 +658,7 @@ class RectangularBeam(Beam):
             innerRect = None
         return (outerRect, innerRect)
 
             innerRect = None
         return (outerRect, innerRect)
 
+    ## Create the rectangular sections used to build the pipe.
     def _makeSectionWires(self, fPoint, fNormal, lPoint, lNormal):
         """
         Create the rectangular sections used to build the pipe.
     def _makeSectionWires(self, fPoint, fNormal, lPoint, lNormal):
         """
         Create the rectangular sections used to build the pipe.
@@ -581,6 +672,10 @@ class RectangularBeam(Beam):
         return (outerRect1, innerRect1, outerRect2, innerRect2)
 
 
         return (outerRect1, innerRect1, outerRect2, innerRect2)
 
 
+## 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.
+#  \ingroup parts
 def getParameterInDict(nameList, parametersDict, default = None):
     """
     This method finds the value of a parameter in the parameters
 def getParameterInDict(nameList, parametersDict, default = None):
     """
     This method finds the value of a parameter in the parameters
@@ -588,11 +683,19 @@ def getParameterInDict(nameList, parametersDict, default = None):
     several different names.
     """
     for name in nameList:
     several different names.
     """
     for name in nameList:
-        if parametersDict.has_key(name):
+        if name in parametersDict:
             return parametersDict[name]
     return default
 
             return parametersDict[name]
     return default
 
-
+## This class defines a beam with a generic section. It is represented as a
+#  full rectangular beam with the following parameters:
+#  - HY1 = sqrt(12 * IZ1 / A1)
+#  - HZ1 = sqrt(12 * IY1 / A1)
+#  - HY2 = sqrt(12 * IZ2 / A2)
+#  - HZ2 = sqrt(12 * IY2 / A2)
+#    
+#  See StructuralElementPart for the description of the other parameters.
+#  \ingroup parts
 class GeneralBeam(RectangularBeam):
     """
     This class defines a beam with a generic section. It is represented as a
 class GeneralBeam(RectangularBeam):
     """
     This class defines a beam with a generic section. It is represented as a
@@ -607,7 +710,7 @@ class GeneralBeam(RectangularBeam):
     parameters.
     """
 
     parameters.
     """
 
-    def __init__(self, studyId, groupName, groupGeomObj, parameters,
+    def __init__(self, groupName, groupGeomObj, parameters,
                  name = Beam.DEFAULT_NAME, color = None):
         self.IY1 = getParameterInDict(["IY1", "IY"], parameters)
         self.IZ1 = getParameterInDict(["IZ1", "IZ"], parameters)
                  name = Beam.DEFAULT_NAME, color = None):
         self.IY1 = getParameterInDict(["IY1", "IY"], parameters)
         self.IZ1 = getParameterInDict(["IZ1", "IZ"], parameters)
@@ -621,15 +724,18 @@ class GeneralBeam(RectangularBeam):
         parameters["HZ2"] = math.sqrt(12 * self.IY2 / self.A2)
 
         if color is None:
         parameters["HZ2"] = math.sqrt(12 * self.IY2 / self.A2)
 
         if color is None:
-            if parameters.has_key("IY1"): # variable section
+            if "IY1" in parameters: # variable section
                 color = LIGHT_GREEN
             else:                         # constant section
                 color = GREEN
 
                 color = LIGHT_GREEN
             else:                         # constant section
                 color = GREEN
 
-        RectangularBeam.__init__(self, studyId, groupName, groupGeomObj, parameters,
+        RectangularBeam.__init__(self, groupName, groupGeomObj, parameters,
                                  name, color)
 
                                  name, color)
 
-
+## This class is an "abstract" class for all 2D structural element parts. It
+#  should not be instantiated directly. 
+#  See class StructuralElementPart for the description of the parameters.
+#  \ingroup parts
 class StructuralElementPart2D(StructuralElementPart):
     """
     This class is an "abstract" class for all 2D structural element parts. It
 class StructuralElementPart2D(StructuralElementPart):
     """
     This class is an "abstract" class for all 2D structural element parts. It
@@ -639,9 +745,9 @@ class StructuralElementPart2D(StructuralElementPart):
 
     DEFAULT_NAME = "StructuralElementPart2D"
 
 
     DEFAULT_NAME = "StructuralElementPart2D"
 
-    def __init__(self, studyId, groupName, groupGeomObj, parameters,
+    def __init__(self, groupName, groupGeomObj, parameters,
                  name = DEFAULT_NAME):
                  name = DEFAULT_NAME):
-        StructuralElementPart.__init__(self, studyId, groupName, groupGeomObj,
+        StructuralElementPart.__init__(self, groupName, groupGeomObj,
                                        parameters, name)
         self._orientation = orientation.Orientation2D(
                                         self._getParameter(["angleAlpha"]),
                                        parameters, name)
         self._orientation = orientation.Orientation2D(
                                         self._getParameter(["angleAlpha"]),
@@ -649,6 +755,7 @@ class StructuralElementPart2D(StructuralElementPart):
                                         self._getParameter(["Vecteur"]))
         self.offset = self._getParameter(["Excentre"], 0.0)
 
                                         self._getParameter(["Vecteur"]))
         self.offset = self._getParameter(["Excentre"], 0.0)
 
+    ## Create a copy of a face at a given offset.
     def _makeFaceOffset(self, face, offset, epsilon = 1e-6):
         """
         Create a copy of a face at a given offset.
     def _makeFaceOffset(self, face, offset, epsilon = 1e-6):
         """
         Create a copy of a face at a given offset.
@@ -663,6 +770,8 @@ class StructuralElementPart2D(StructuralElementPart):
                                           self.geom.ShapeType["FACE"])
             return faces[0]
 
                                           self.geom.ShapeType["FACE"])
             return faces[0]
 
+    ## Build the markers for the structural element part with a given offset
+    #  from the base face.
     def _buildMarkersWithOffset(self, offset):
         """
         Build the markers for the structural element part with a given offset
     def _buildMarkersWithOffset(self, offset):
         """
         Build the markers for the structural element part with a given offset
@@ -678,20 +787,29 @@ class StructuralElementPart2D(StructuralElementPart):
                                           self.geom.ShapeType["FACE"])
             for face in faces:
                 offsetFace = self._makeFaceOffset(face, offset)
                                           self.geom.ShapeType["FACE"])
             for face in faces:
                 offsetFace = self._makeFaceOffset(face, offset)
-                # get tangent plane on surface by parameters
+                # get the center of the face and the normal at the center
                 center = self.geom.MakeVertexOnSurface(offsetFace,
                                                        uParam, vParam)
                 center = self.geom.MakeVertexOnSurface(offsetFace,
                                                        uParam, vParam)
-                tangPlane = self.geom.MakeTangentPlaneOnFace(offsetFace,
-                                                             uParam, vParam,
-                                                             1.0)
-                normal = self.geom.GetNormal(tangPlane)
+                normal = self.geom.GetNormal(offsetFace, center)
                 marker = self._orientation.buildMarker(self.geom,
                                                        center, normal)
                 listMarkers.append(marker)
 
         return listMarkers
 
                 marker = self._orientation.buildMarker(self.geom,
                                                        center, normal)
                 listMarkers.append(marker)
 
         return listMarkers
 
-
+## This class defines a shell with a given thickness. It can be shifted from
+#  the base face. The valid parameters for thick shells are:
+#  - "Epais": thickness of the shell.
+#  - "Excentre": offset of the shell from the base face.
+#  - "angleAlpha": angle used to build the markers (see class
+#    \ref orientation.Orientation2D "salome.geom.structelem.orientation.Orientation2D")
+#  - "angleBeta": angle used to build the markers (see class
+#    \ref orientation.Orientation2D "salome.geom.structelem.orientation.Orientation2D")
+#  - "Vecteur": vector used instead of the angles to build the markers (see
+#    \ref orientation.Orientation2D "salome.geom.structelem.orientation.Orientation2D")
+#
+#    See class StructuralElementPart for the description of the other parameters.
+#  \ingroup parts
 class ThickShell(StructuralElementPart2D):
     """
     This class defines a shell with a given thickness. It can be shifted from
 class ThickShell(StructuralElementPart2D):
     """
     This class defines a shell with a given thickness. It can be shifted from
@@ -712,13 +830,14 @@ class ThickShell(StructuralElementPart2D):
 
     DEFAULT_NAME = "ThickShell"
 
 
     DEFAULT_NAME = "ThickShell"
 
-    def __init__(self, studyId, groupName, groupGeomObj, parameters,
+    def __init__(self, groupName, groupGeomObj, parameters,
                  name = DEFAULT_NAME):
                  name = DEFAULT_NAME):
-        StructuralElementPart2D.__init__(self, studyId, groupName,
+        StructuralElementPart2D.__init__(self, groupName,
                                          groupGeomObj, parameters, name)
         self.thickness = self._getParameter(["Epais"])
         logger.debug(repr(self))
 
                                          groupGeomObj, parameters, name)
         self.thickness = self._getParameter(["Epais"])
         logger.debug(repr(self))
 
+    ## Create the geometrical shapes corresponding to the thick shell.
     def _buildPart(self):
         """
         Create the geometrical shapes corresponding to the thick shell.
     def _buildPart(self):
         """
         Create the geometrical shapes corresponding to the thick shell.
@@ -740,6 +859,8 @@ class ThickShell(StructuralElementPart2D):
         else:
             return self.geom.MakeCompound(listSolids)
 
         else:
             return self.geom.MakeCompound(listSolids)
 
+    ## Create the geometrical shapes corresponding to the thick shell for a
+    #  given face.
     def _buildThickShellForFace(self, face):
         """
         Create the geometrical shapes corresponding to the thick shell for a
     def _buildThickShellForFace(self, face):
         """
         Create the geometrical shapes corresponding to the thick shell for a
@@ -775,6 +896,7 @@ class ThickShell(StructuralElementPart2D):
         resultSolid = self.geom.MakeSolid([resultShell])
         return resultSolid
 
         resultSolid = self.geom.MakeSolid([resultShell])
         return resultSolid
 
+    ## Remove the side edge in a cylinder.
     def _removeCylinderExtraEdge(self, wires):
         """
         Remove the side edge in a cylinder.
     def _removeCylinderExtraEdge(self, wires):
         """
         Remove the side edge in a cylinder.
@@ -787,6 +909,7 @@ class ThickShell(StructuralElementPart2D):
                     result.append(edge)
         return result
 
                     result.append(edge)
         return result
 
+    ## Build the markers defining the orientation of the thick shell.
     def _buildMarkers(self):
         """
         Build the markers defining the orientation of the thick shell.
     def _buildMarkers(self):
         """
         Build the markers defining the orientation of the thick shell.
@@ -794,7 +917,31 @@ class ThickShell(StructuralElementPart2D):
         return self._buildMarkersWithOffset(self.offset +
                                             self.thickness / 2.0)
 
         return self._buildMarkersWithOffset(self.offset +
                                             self.thickness / 2.0)
 
-
+## This class defines a grid. A grid is represented by a 2D face patterned
+#  with small lines in the main direction of the grid frame. The valid
+#  parameters for grids are:
+#  - "Excentre": offset of the grid from the base face.
+#  - "angleAlpha": angle used to build the markers (see class
+#    \ref orientation.Orientation2D "salome.geom.structelem.orientation.Orientation2D")
+#  - "angleBeta": angle used to build the markers (see class
+#    \ref orientation.Orientation2D "salome.geom.structelem.orientation.Orientation2D")
+#  - "Vecteur": vector used instead of the angles to build the markers (see
+#    \ref orientation.Orientation2D "salome.geom.structelem.orientation.Orientation2D")
+#  - "origAxeX": X coordinate of the origin of the axis used to determine the
+#    orientation of the frame in the case of a cylindrical grid.
+#  - "origAxeY": Y coordinate of the origin of the axis used to determine the
+#    orientation of the frame in the case of a cylindrical grid.
+#  - "origAxeZ": Z coordinate of the origin of the axis used to determine the
+#    orientation of the frame in the case of a cylindrical grid.
+#  - "axeX": X coordinate of the axis used to determine the orientation of
+#    the frame in the case of a cylindrical grid.
+#  - "axeY": Y coordinate of the axis used to determine the orientation of
+#    the frame in the case of a cylindrical grid.
+#  - "axeZ": Z coordinate of the axis used to determine the orientation of
+#    the frame in the case of a cylindrical grid.
+#
+#    See class StructuralElementPart for the description of the other parameters.
+#  \ingroup parts
 class Grid(StructuralElementPart2D):
     """
     This class defines a grid. A grid is represented by a 2D face patterned
 class Grid(StructuralElementPart2D):
     """
     This class defines a grid. A grid is represented by a 2D face patterned
@@ -827,9 +974,9 @@ class Grid(StructuralElementPart2D):
 
     DEFAULT_NAME = "Grid"
 
 
     DEFAULT_NAME = "Grid"
 
-    def __init__(self, studyId, groupName, groupGeomObj, parameters,
+    def __init__(self, groupName, groupGeomObj, parameters,
                  name = DEFAULT_NAME):
                  name = DEFAULT_NAME):
-        StructuralElementPart2D.__init__(self, studyId, groupName,
+        StructuralElementPart2D.__init__(self, groupName,
                                          groupGeomObj, parameters, name)
         self.xr = self._getParameter(["origAxeX"])
         self.yr = self._getParameter(["origAxeY"])
                                          groupGeomObj, parameters, name)
         self.xr = self._getParameter(["origAxeX"])
         self.yr = self._getParameter(["origAxeY"])
@@ -839,6 +986,7 @@ class Grid(StructuralElementPart2D):
         self.vz = self._getParameter(["axeZ"])
         logger.debug(repr(self))
 
         self.vz = self._getParameter(["axeZ"])
         logger.debug(repr(self))
 
+    ## Create the geometrical shapes representing the grid.
     def _buildPart(self):
         """
         Create the geometrical shapes representing the grid.
     def _buildPart(self):
         """
         Create the geometrical shapes representing the grid.
@@ -867,6 +1015,8 @@ class Grid(StructuralElementPart2D):
         else:
             return self.geom.MakeCompound(listGridShapes)
 
         else:
             return self.geom.MakeCompound(listGridShapes)
 
+    ## Create the geometrical shapes representing the grid for a given
+    #  non-cylindrical face.
     def _buildGridForNormalFace(self, face):
         """
         Create the geometrical shapes representing the grid for a given
     def _buildGridForNormalFace(self, face):
         """
         Create the geometrical shapes representing the grid for a given
@@ -902,6 +1052,8 @@ class Grid(StructuralElementPart2D):
         grid = self.geom.MakeCompound(gridList)
         return grid
 
         grid = self.geom.MakeCompound(gridList)
         return grid
 
+    ## Create the geometrical shapes representing the grid for a given
+    #  cylindrical face.
     def _buildGridForCylinderFace(self, face):
         """
         Create the geometrical shapes representing the grid for a given
     def _buildGridForCylinderFace(self, face):
         """
         Create the geometrical shapes representing the grid for a given
@@ -941,73 +1093,91 @@ class Grid(StructuralElementPart2D):
         grid = self.geom.MakeCompound(gridList)
         return grid
 
         grid = self.geom.MakeCompound(gridList)
         return grid
 
+    ## Create the markers defining the orientation of the grid.
     def _buildMarkers(self):
         """
         Create the markers defining the orientation of the grid.
         """
         return self._buildMarkersWithOffset(self.offset)
 
     def _buildMarkers(self):
         """
         Create the markers defining the orientation of the grid.
         """
         return self._buildMarkersWithOffset(self.offset)
 
-
-def VisuPoutreGenerale(studyId, groupName, groupGeomObj, parameters,
+## Alias for class GeneralBeam.
+#  \ingroup parts
+def VisuPoutreGenerale(groupName, groupGeomObj, parameters,
                        name = "POUTRE"):
     """
     Alias for class :class:`GeneralBeam`.
     """
                        name = "POUTRE"):
     """
     Alias for class :class:`GeneralBeam`.
     """
-    return GeneralBeam(studyId, groupName, groupGeomObj, parameters, name)
+    return GeneralBeam(groupName, groupGeomObj, parameters, name)
 
 
-def VisuPoutreCercle(studyId, groupName, groupGeomObj, parameters,
+## Alias for class CircularBeam.
+#  \ingroup parts
+def VisuPoutreCercle(groupName, groupGeomObj, parameters,
                      name = "POUTRE"):
     """
     Alias for class :class:`CircularBeam`.
     """
                      name = "POUTRE"):
     """
     Alias for class :class:`CircularBeam`.
     """
-    return CircularBeam(studyId, groupName, groupGeomObj, parameters, name)
-  
-def VisuPoutreRectangle(studyId, groupName, groupGeomObj, parameters,
+    return CircularBeam(groupName, groupGeomObj, parameters, name)
+
+## Alias for class RectangularBeam. 
+#  \ingroup parts
+def VisuPoutreRectangle(groupName, groupGeomObj, parameters,
                         name = "POUTRE"):
     """
     Alias for class :class:`RectangularBeam`.
     """
                         name = "POUTRE"):
     """
     Alias for class :class:`RectangularBeam`.
     """
-    return RectangularBeam(studyId, groupName, groupGeomObj, parameters, name)
-  
-def VisuBarreGenerale(studyId, groupName, groupGeomObj, parameters,
+    return RectangularBeam(groupName, groupGeomObj, parameters, name)
+
+## Alias for class GeneralBeam.  
+#  \ingroup parts
+def VisuBarreGenerale(groupName, groupGeomObj, parameters,
                       name = "BARRE"):
     """
     Alias for class :class:`GeneralBeam`.
     """
                       name = "BARRE"):
     """
     Alias for class :class:`GeneralBeam`.
     """
-    return GeneralBeam(studyId, groupName, groupGeomObj, parameters, name,
+    return GeneralBeam(groupName, groupGeomObj, parameters, name,
                        color = ORANGE)
                        color = ORANGE)
-      
-def VisuBarreRectangle(studyId, groupName, groupGeomObj, parameters,
+
+## Alias for class RectangularBeam.      
+#  \ingroup parts
+def VisuBarreRectangle(groupName, groupGeomObj, parameters,
                        name = "BARRE"):
     """
     Alias for class :class:`RectangularBeam`.
     """
                        name = "BARRE"):
     """
     Alias for class :class:`RectangularBeam`.
     """
-    return RectangularBeam(studyId, groupName, groupGeomObj, parameters, name,
+    return RectangularBeam(groupName, groupGeomObj, parameters, name,
                            color = ORANGE)
 
                            color = ORANGE)
 
-def VisuBarreCercle(studyId, groupName, groupGeomObj, parameters,
+## Alias for class CircularBeam.
+#  \ingroup parts
+def VisuBarreCercle(groupName, groupGeomObj, parameters,
                     name = "BARRE"):
     """
     Alias for class :class:`CircularBeam`.
     """
                     name = "BARRE"):
     """
     Alias for class :class:`CircularBeam`.
     """
-    return CircularBeam(studyId, groupName, groupGeomObj, parameters, name,
+    return CircularBeam(groupName, groupGeomObj, parameters, name,
                         color = ORANGE)
 
                         color = ORANGE)
 
-def VisuCable(studyId, groupName, groupGeomObj, parameters, name = "CABLE"):
+## Alias for class CircularBeam.
+#  \ingroup parts
+def VisuCable(groupName, groupGeomObj, parameters, name = "CABLE"):
     """
     Alias for class :class:`CircularBeam`.
     """
     """
     Alias for class :class:`CircularBeam`.
     """
-    return CircularBeam(studyId, groupName, groupGeomObj, parameters, name,
+    return CircularBeam(groupName, groupGeomObj, parameters, name,
                         color = PURPLE)
 
                         color = PURPLE)
 
-def VisuCoque(studyId, groupName, groupGeomObj, parameters, name = "COQUE"):
+## Alias for class ThickShell.
+#  \ingroup parts
+def VisuCoque(groupName, groupGeomObj, parameters, name = "COQUE"):
     """
     Alias for class :class:`ThickShell`.
     """
     """
     Alias for class :class:`ThickShell`.
     """
-    return ThickShell(studyId, groupName, groupGeomObj, parameters, name)
-  
-def VisuGrille(studyId, groupName, groupGeomObj, parameters, name = "GRILLE"):
+    return ThickShell(groupName, groupGeomObj, parameters, name)
+
+## Alias for class Grid.
+#  \ingroup parts
+def VisuGrille(groupName, groupGeomObj, parameters, name = "GRILLE"):
     """
     Alias for class :class:`Grid`.
     """
     """
     Alias for class :class:`Grid`.
     """
-    return Grid(studyId, groupName, groupGeomObj, parameters, name)
+    return Grid(groupName, groupGeomObj, parameters, name)