# -*- coding: utf-8 -*-
#
-# Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2023 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
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"
## This class is the base class for all structural element parts. It should
# not be instantiated directly (consider it as an "abstract" class).
-# \param studyId (integer) the ID of the study in which the part is created.
# \param groupName (string) the name of the underlying geometrical primitive
# in the study.
# \param groupGeomObj (GEOM object) the underlying geometrical primitive.
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.
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
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:
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
"""
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
mindim, value)
## Build the geometric shapes and the markers corresponding to the
- # structural element part in the study \em studyId.
+ # structural element part in the study.
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()
DEFAULT_NAME = "Beam"
- def __init__(self, studyId, groupName, groupGeomObj, parameters,
+ def __init__(self, groupName, groupGeomObj, parameters,
name = DEFAULT_NAME, color = None):
- StructuralElementPart.__init__(self, studyId, groupName, groupGeomObj,
+ StructuralElementPart.__init__(self, groupName, groupGeomObj,
parameters, name, color)
self._orientation = orientation.Orientation1D()
"""
- def __init__(self, studyId, groupName, groupGeomObj, parameters,
+ def __init__(self, groupName, groupGeomObj, parameters,
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
- Beam.__init__(self, studyId, groupName, groupGeomObj, parameters,
+ Beam.__init__(self, groupName, groupGeomObj, parameters,
name, color)
self.R1 = self._getParameter(["R1", "R"])
"""
- def __init__(self, studyId, groupName, groupGeomObj, parameters,
+ def __init__(self, groupName, groupGeomObj, parameters,
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
- Beam.__init__(self, studyId, groupName, groupGeomObj, parameters,
+ Beam.__init__(self, groupName, groupGeomObj, parameters,
name, color)
self.HY1 = self._getParameter(["HY1", "HY", "H1", "H"])
several different names.
"""
for name in nameList:
- if parametersDict.has_key(name):
+ if name in parametersDict:
return parametersDict[name]
return default
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)
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
- RectangularBeam.__init__(self, studyId, groupName, groupGeomObj, parameters,
+ RectangularBeam.__init__(self, groupName, groupGeomObj, parameters,
name, color)
## This class is an "abstract" class for all 2D structural element parts. It
DEFAULT_NAME = "StructuralElementPart2D"
- def __init__(self, studyId, groupName, groupGeomObj, parameters,
+ def __init__(self, groupName, groupGeomObj, parameters,
name = DEFAULT_NAME):
- StructuralElementPart.__init__(self, studyId, groupName, groupGeomObj,
+ StructuralElementPart.__init__(self, groupName, groupGeomObj,
parameters, name)
self._orientation = orientation.Orientation2D(
self._getParameter(["angleAlpha"]),
DEFAULT_NAME = "ThickShell"
- def __init__(self, studyId, groupName, groupGeomObj, parameters,
+ def __init__(self, groupName, groupGeomObj, parameters,
name = DEFAULT_NAME):
- StructuralElementPart2D.__init__(self, studyId, groupName,
+ StructuralElementPart2D.__init__(self, groupName,
groupGeomObj, parameters, name)
self.thickness = self._getParameter(["Epais"])
logger.debug(repr(self))
DEFAULT_NAME = "Grid"
- def __init__(self, studyId, groupName, groupGeomObj, parameters,
+ def __init__(self, groupName, groupGeomObj, parameters,
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"])
## Alias for class GeneralBeam.
# \ingroup parts
-def VisuPoutreGenerale(studyId, groupName, groupGeomObj, parameters,
+def VisuPoutreGenerale(groupName, groupGeomObj, parameters,
name = "POUTRE"):
"""
Alias for class :class:`GeneralBeam`.
"""
- return GeneralBeam(studyId, groupName, groupGeomObj, parameters, name)
+ return GeneralBeam(groupName, groupGeomObj, parameters, name)
## Alias for class CircularBeam.
# \ingroup parts
-def VisuPoutreCercle(studyId, groupName, groupGeomObj, parameters,
+def VisuPoutreCercle(groupName, groupGeomObj, parameters,
name = "POUTRE"):
"""
Alias for class :class:`CircularBeam`.
"""
- return CircularBeam(studyId, groupName, groupGeomObj, parameters, name)
+ return CircularBeam(groupName, groupGeomObj, parameters, name)
## Alias for class RectangularBeam.
# \ingroup parts
-def VisuPoutreRectangle(studyId, groupName, groupGeomObj, parameters,
+def VisuPoutreRectangle(groupName, groupGeomObj, parameters,
name = "POUTRE"):
"""
Alias for class :class:`RectangularBeam`.
"""
- return RectangularBeam(studyId, groupName, groupGeomObj, parameters, name)
+ return RectangularBeam(groupName, groupGeomObj, parameters, name)
## Alias for class GeneralBeam.
# \ingroup parts
-def VisuBarreGenerale(studyId, groupName, groupGeomObj, parameters,
+def VisuBarreGenerale(groupName, groupGeomObj, parameters,
name = "BARRE"):
"""
Alias for class :class:`GeneralBeam`.
"""
- return GeneralBeam(studyId, groupName, groupGeomObj, parameters, name,
+ return GeneralBeam(groupName, groupGeomObj, parameters, name,
color = ORANGE)
## Alias for class RectangularBeam.
# \ingroup parts
-def VisuBarreRectangle(studyId, groupName, groupGeomObj, parameters,
+def VisuBarreRectangle(groupName, groupGeomObj, parameters,
name = "BARRE"):
"""
Alias for class :class:`RectangularBeam`.
"""
- return RectangularBeam(studyId, groupName, groupGeomObj, parameters, name,
+ return RectangularBeam(groupName, groupGeomObj, parameters, name,
color = ORANGE)
## Alias for class CircularBeam.
# \ingroup parts
-def VisuBarreCercle(studyId, groupName, groupGeomObj, parameters,
+def VisuBarreCercle(groupName, groupGeomObj, parameters,
name = "BARRE"):
"""
Alias for class :class:`CircularBeam`.
"""
- return CircularBeam(studyId, groupName, groupGeomObj, parameters, name,
+ return CircularBeam(groupName, groupGeomObj, parameters, name,
color = ORANGE)
## Alias for class CircularBeam.
# \ingroup parts
-def VisuCable(studyId, groupName, groupGeomObj, parameters, name = "CABLE"):
+def VisuCable(groupName, groupGeomObj, parameters, name = "CABLE"):
"""
Alias for class :class:`CircularBeam`.
"""
- return CircularBeam(studyId, groupName, groupGeomObj, parameters, name,
+ return CircularBeam(groupName, groupGeomObj, parameters, name,
color = PURPLE)
## Alias for class ThickShell.
# \ingroup parts
-def VisuCoque(studyId, groupName, groupGeomObj, parameters, name = "COQUE"):
+def VisuCoque(groupName, groupGeomObj, parameters, name = "COQUE"):
"""
Alias for class :class:`ThickShell`.
"""
- return ThickShell(studyId, groupName, groupGeomObj, parameters, name)
+ return ThickShell(groupName, groupGeomObj, parameters, name)
## Alias for class Grid.
# \ingroup parts
-def VisuGrille(studyId, groupName, groupGeomObj, parameters, name = "GRILLE"):
+def VisuGrille(groupName, groupGeomObj, parameters, name = "GRILLE"):
"""
Alias for class :class:`Grid`.
"""
- return Grid(studyId, groupName, groupGeomObj, parameters, name)
+ return Grid(groupName, groupGeomObj, parameters, name)