Add Property 'Width of Landing'; set width of different 'edge' of a Landing

Discussion:
https://forum.freecadweb.org/viewtopic.php?f=23&t=29358&start=80#p257963
https://forum.freecadweb.org/viewtopic.php?f=22&t=29709
This commit is contained in:
paullee
2018-09-28 06:23:22 +08:00
committed by Yorik van Havre
parent e605d5f4bf
commit 56378b5be8

View File

@@ -327,6 +327,9 @@ class _Stairs(ArchComponent.Component):
if not "Align" in pl:
obj.addProperty("App::PropertyEnumeration","Align","Stairs",QT_TRANSLATE_NOOP("App::Property","The alignment of these stairs on their baseline, if applicable"))
obj.Align = ['Left','Right','Center']
# TODO - To be combined into Width when PropertyLengthList is available
if not "WidthOfLanding" in pl:
obj.addProperty("App::PropertyFloatList","WidthOfLanding","Stairs",QT_TRANSLATE_NOOP("App::Property","The width of a Landing (2nd edge and after - 1st edge follow Width property"))
# steps properties
if not "NumberOfSteps" in pl:
@@ -594,9 +597,18 @@ class _Stairs(ArchComponent.Component):
vLength.append(Vector(v[i].x,v[i].y,v[i].z)) # TODO vLength in this f() is 3d
# TODO obj.Width[i].Value for different 'edges' / 'sections' of the landing
netWidth = obj.Width.Value - offsetHLeft.Value - offsetHRight.Value #2*offsetH
netWidthI = 0
print (i)
if i > 0:
try:
if obj.WidthOfLanding[i-1] > 0: # Float has no .Value
netWidthI = obj.WidthOfLanding[i-1] - offsetHLeft.Value - offsetHRight.Value #2*offsetH
except:
pass
if netWidthI == 0:
netWidthI = obj.Width.Value - offsetHLeft.Value - offsetHRight.Value #2*offsetH
vWidth.append(DraftVecUtils.scaleTo(vLength[i].cross(Vector(0,0,1)),netWidth))
vWidth.append(DraftVecUtils.scaleTo(vLength[i].cross(Vector(0,0,1)),netWidthI))
vBase.append(edges[i].Vertexes[0].Point)
vBase[i] = self.vbaseFollowLastSement(obj, vBase[i])
@@ -1065,6 +1077,7 @@ class _Stairs(ArchComponent.Component):
p3 = p2.add(DraftVecUtils.scaleTo(vLength,obj.LandingDepth.Value))
else:
p3 = p2.add(DraftVecUtils.scaleTo(vLength,obj.Width.Value))
if obj.Flight in ["HalfTurnLeft", "HalfTurnRight"]:
if (obj.Align == "Left" and obj.Flight == "HalfTurnLeft") or (obj.Align == "Right" and obj.Flight == "HalfTurnRight"):
p3r = p2