From 56378b5be84a7188df411d8d476ff29305a2afef Mon Sep 17 00:00:00 2001 From: paullee Date: Fri, 28 Sep 2018 06:23:22 +0800 Subject: [PATCH] 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 --- src/Mod/Arch/ArchStairs.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/Mod/Arch/ArchStairs.py b/src/Mod/Arch/ArchStairs.py index 9107a9a956..c74743c093 100644 --- a/src/Mod/Arch/ArchStairs.py +++ b/src/Mod/Arch/ArchStairs.py @@ -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