[ArchStairs] Improve Stairs Creation and ensureBase

Refer to discussion at -
https://github.com/FreeCAD/FreeCAD/pull/18864
https://github.com/FreeCAD/FreeCAD/pull/18651
https://github.com/FreeCAD/FreeCAD/issues/16409

Like Wall, Stairs should do without Base. Base validity tested in execute() prevented the desired and documented behaviour.

With this improvement, EnsureBase() is now only to be run when there is Base. If there is no Base, or Base is not valid, Stairs would be created as declared.
This commit is contained in:
Paul Lee
2025-01-05 11:47:19 +08:00
committed by Yorik van Havre
parent e15285ae41
commit 23284cd08d
3 changed files with 16 additions and 15 deletions

View File

@@ -832,7 +832,6 @@ def makeStairs(baseobj=None,length=None,width=None,height=None,steps=None,name=N
stair.Label = label
ArchStairs._Stairs(stair)
stairs.append(stair)
stairs[0].Label = label
i = 1
else:
i = 0
@@ -841,17 +840,12 @@ def makeStairs(baseobj=None,length=None,width=None,height=None,steps=None,name=N
stair.Label = label
ArchStairs._Stairs(stair)
stairs.append(stair)
stairs[i].Label = label
stairs[i].Base = baseobjI
if len(baseobjI.Shape.Edges) > 1:
stepsI = 1 #'landing' if 'multi-edges' currently
elif steps:
if steps:
stepsI = steps
else:
stepsI = 20
setProperty(stairs[i],None,width,height,stepsI)
if i > 1:
additions.append(stairs[i])
stairs[i].LastSegment = stairs[i-1]