mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-15 10:08:35 +05:00
Fixed structural elements with rectangular section (bug PAL 1826)
This commit is contained in:
parent
f27f0ec5d5
commit
346dbd8b2f
Binary file not shown.
Before Width: | Height: | Size: 168 KiB After Width: | Height: | Size: 140 KiB |
@ -80,11 +80,11 @@ class Orientation1D:
|
|||||||
logger.warning("Invalid orientation parameter(s) (ignored): %s" %
|
logger.warning("Invalid orientation parameter(s) (ignored): %s" %
|
||||||
str(mydict))
|
str(mydict))
|
||||||
|
|
||||||
def _buildDefaultMarker(self, center, vecX):
|
def _getDefaultVecYZ(self, center, vecX):
|
||||||
"""
|
"""
|
||||||
Create the default marker, that use the main direction of the 1D
|
Get the vectors Y and Z for the default LCS, that use the main
|
||||||
object as the local X axis and the global Z axis to determine the
|
direction of the 1D object as the local X axis and the global Z axis
|
||||||
local Z axis.
|
to determine the local Z axis.
|
||||||
"""
|
"""
|
||||||
xPoint = self.geom.MakeTranslationVector(center, vecX)
|
xPoint = self.geom.MakeTranslationVector(center, vecX)
|
||||||
givenVecZ = self.geom.MakeVectorDXDYDZ(0.0, 0.0, 1.0)
|
givenVecZ = self.geom.MakeVectorDXDYDZ(0.0, 0.0, 1.0)
|
||||||
@ -97,18 +97,31 @@ class Orientation1D:
|
|||||||
zPoint = self.geom.MakeTranslationVector(center, givenVecZ)
|
zPoint = self.geom.MakeTranslationVector(center, givenVecZ)
|
||||||
locPlaneZX = self.geom.MakePlaneThreePnt(center, zPoint, xPoint, 1.0)
|
locPlaneZX = self.geom.MakePlaneThreePnt(center, zPoint, xPoint, 1.0)
|
||||||
locY = self.geom.GetNormal(locPlaneZX)
|
locY = self.geom.GetNormal(locPlaneZX)
|
||||||
marker = self.geom.MakeMarkerPntTwoVec(center,vecX,locY)
|
yPoint = self.geom.MakeTranslationVector(center, locY)
|
||||||
return marker
|
locPlaneXY = self.geom.MakePlaneThreePnt(center, xPoint, yPoint, 1.0)
|
||||||
|
locZ = self.geom.GetNormal(locPlaneXY)
|
||||||
|
return (locY, locZ)
|
||||||
|
|
||||||
def buildMarker(self, geom, center, vecX):
|
def buildMarker(self, geom, center, vecX):
|
||||||
"""
|
"""
|
||||||
Create a marker with origin `center` and X axis `vecX`. `geom` is the
|
Create a marker with origin `center` and X axis `vecX`. `geom` is the
|
||||||
pseudo-geompy object used to build the geometric shapes.
|
pseudo-geompy object used to build the geometric shapes.
|
||||||
"""
|
"""
|
||||||
|
(locY, locZ) = self.getVecYZ(geom, center, vecX)
|
||||||
|
marker = geom.MakeMarkerPntTwoVec(center, vecX, locY)
|
||||||
|
return marker
|
||||||
|
|
||||||
|
def 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.
|
||||||
|
"""
|
||||||
self.geom = geom
|
self.geom = geom
|
||||||
marker = None
|
locY = None
|
||||||
|
locZ = None
|
||||||
if self._vectorYCoords is None:
|
if self._vectorYCoords is None:
|
||||||
marker = self._buildDefaultMarker(center, vecX)
|
(locY, locZ) = self._getDefaultVecYZ(center, vecX)
|
||||||
else:
|
else:
|
||||||
xPoint = self.geom.MakeTranslationVector(center, vecX)
|
xPoint = self.geom.MakeTranslationVector(center, vecX)
|
||||||
givenLocY = self.geom.MakeVectorDXDYDZ(self._vectorYCoords[0],
|
givenLocY = self.geom.MakeVectorDXDYDZ(self._vectorYCoords[0],
|
||||||
@ -118,7 +131,7 @@ class Orientation1D:
|
|||||||
if abs(angle) < 1e-7 or abs(angle - math.pi) < 1e-7:
|
if abs(angle) < 1e-7 or abs(angle - math.pi) < 1e-7:
|
||||||
logger.warning("Vector Y is colinear to the beam X axis, "
|
logger.warning("Vector Y is colinear to the beam X axis, "
|
||||||
"using default LCS.")
|
"using default LCS.")
|
||||||
marker = self._buildDefaultMarker(center, vecX)
|
(locY, locZ) = self._getDefaultVecYZ(center, vecX)
|
||||||
else:
|
else:
|
||||||
yPoint = self.geom.MakeTranslationVector(center, givenLocY)
|
yPoint = self.geom.MakeTranslationVector(center, givenLocY)
|
||||||
locPlaneXY = self.geom.MakePlaneThreePnt(center, xPoint,
|
locPlaneXY = self.geom.MakePlaneThreePnt(center, xPoint,
|
||||||
@ -128,13 +141,13 @@ class Orientation1D:
|
|||||||
locPlaneZX = self.geom.MakePlaneThreePnt(center, zPoint,
|
locPlaneZX = self.geom.MakePlaneThreePnt(center, zPoint,
|
||||||
xPoint, 1.0)
|
xPoint, 1.0)
|
||||||
locY = self.geom.GetNormal(locPlaneZX)
|
locY = self.geom.GetNormal(locPlaneZX)
|
||||||
marker = self.geom.MakeMarkerPntTwoVec(center,vecX,locY)
|
|
||||||
|
|
||||||
if self._angle != 0.0:
|
if self._angle != 0.0:
|
||||||
angleRad = math.radians(self._angle)
|
angleRad = math.radians(self._angle)
|
||||||
marker = self.geom.Rotate(marker, vecX, angleRad)
|
locY = self.geom.Rotate(locY, vecX, angleRad)
|
||||||
|
locZ = self.geom.Rotate(locZ, vecX, angleRad)
|
||||||
|
|
||||||
return marker
|
return (locY, locZ)
|
||||||
|
|
||||||
|
|
||||||
class Orientation2D:
|
class Orientation2D:
|
||||||
|
@ -530,39 +530,45 @@ class RectangularBeam(Beam):
|
|||||||
"%s - 2 * %s" % (self._getParamUserName("HZ2"),
|
"%s - 2 * %s" % (self._getParamUserName("HZ2"),
|
||||||
self._getParamUserName("EPZ2")))
|
self._getParamUserName("EPZ2")))
|
||||||
|
|
||||||
def _makeRectangle(self, HY, HZ, planeSect):
|
def _makeRectangle(self, HY, HZ, lcs):
|
||||||
"""
|
"""
|
||||||
Create a rectangle in the specified plane.
|
Create a rectangle in the specified plane.
|
||||||
"""
|
"""
|
||||||
halfHY = HY / 2.0
|
halfHY = HY / 2.0
|
||||||
halfHZ = HZ / 2.0
|
halfHZ = HZ / 2.0
|
||||||
sketchStr = "Sketcher:F %g" % (-halfHZ) + " %g" % (-halfHY) + ":"
|
sketchStr = "Sketcher:F %g %g:" % (-halfHY, -halfHZ)
|
||||||
sketchStr += "TT %g" % (halfHZ) + " %g" % (-halfHY) + ":"
|
sketchStr += "TT %g %g:" % (halfHY, -halfHZ)
|
||||||
sketchStr += "TT %g" % (halfHZ) + " %g" % (halfHY) + ":"
|
sketchStr += "TT %g %g:" % (halfHY, halfHZ)
|
||||||
sketchStr += "TT %g" % (-halfHZ) + " %g" % (halfHY) + ":WW"
|
sketchStr += "TT %g %g:WW" % (-halfHY, halfHZ)
|
||||||
logger.debug('Drawing rectangle: "%s"' % sketchStr)
|
logger.debug('Drawing rectangle: "%s"' % sketchStr)
|
||||||
sketch = self.geom.MakeSketcherOnPlane(sketchStr, planeSect)
|
sketch = self.geom.MakeSketcherOnPlane(sketchStr, lcs)
|
||||||
return sketch
|
return sketch
|
||||||
|
|
||||||
|
def _makeSectionRectangles(self, point, vecX, HY, HZ, EPY, EPZ):
|
||||||
|
"""
|
||||||
|
Create one side of the rectangular sections used to build the pipe.
|
||||||
|
"""
|
||||||
|
(vecY, vecZ) = self._orientation.getVecYZ(self.geom, point, vecX)
|
||||||
|
lcs = self.geom.MakeMarkerPntTwoVec(point, vecY, vecZ)
|
||||||
|
outerRect = self._makeRectangle(HY, HZ, lcs)
|
||||||
|
if self.filling == HOLLOW:
|
||||||
|
innerRect = self._makeRectangle(HY - 2.0 * EPY,
|
||||||
|
HZ - 2.0 * EPZ,
|
||||||
|
lcs)
|
||||||
|
else:
|
||||||
|
innerRect = None
|
||||||
|
return (outerRect, innerRect)
|
||||||
|
|
||||||
def _makeSectionWires(self, fPoint, fNormal, lPoint, lNormal):
|
def _makeSectionWires(self, fPoint, fNormal, lPoint, lNormal):
|
||||||
"""
|
"""
|
||||||
Create the rectangular sections used to build the pipe.
|
Create the rectangular sections used to build the pipe.
|
||||||
"""
|
"""
|
||||||
planeSect1 = self.geom.MakePlane(fPoint, fNormal, 1.0)
|
(outerRect1, innerRect1) = \
|
||||||
outerRect1 = self._makeRectangle(self.HY1, self.HZ1, planeSect1)
|
self._makeSectionRectangles(fPoint, fNormal, self.HY1, self.HZ1,
|
||||||
planeSect2 = self.geom.MakePlane(lPoint, lNormal, 1.0)
|
self.EPY1, self.EPZ1)
|
||||||
outerRect2 = self._makeRectangle(self.HY2, self.HZ2, planeSect2)
|
(outerRect2, innerRect2) = \
|
||||||
if self.filling == HOLLOW:
|
self._makeSectionRectangles(lPoint, lNormal, self.HY2, self.HZ2,
|
||||||
innerRect1 = self._makeRectangle(self.HY1 - 2 * self.EPY1,
|
self.EPY2, self.EPZ2)
|
||||||
self.HZ1 - 2 * self.EPZ1,
|
|
||||||
planeSect1)
|
|
||||||
innerRect2 = self._makeRectangle(self.HY2 - 2 * self.EPY2,
|
|
||||||
self.HZ2 - 2 * self.EPZ2,
|
|
||||||
planeSect2)
|
|
||||||
else:
|
|
||||||
innerRect1 = None
|
|
||||||
innerRect2 = None
|
|
||||||
|
|
||||||
return (outerRect1, innerRect1, outerRect2, innerRect2)
|
return (outerRect1, innerRect1, outerRect2, innerRect2)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user