[Arch] Fix makeStairs Move & Addition Behaviour Consistency

Consistent Addition

1. Additions are hidden by onChanged()
2. makeStairs() previously made 1st segment of a Complex Stairs went to Base and the rest segments went to Additions
3. For consistency in grouping and visibility, all segments in go to Additions with this commit

Consistent Move With Host

1. A Complex Stairs has multiple segment (in Additions) and railings (in RailingLeft/Right), they should move togther.
2. All segments and Railing set MoveWithHost to True upon creation, and thus move together, regardless system setting default with this commit

Other Associated Inconsistency

    Other visibility default behaviour as discussed in https://forum.freecad.org/viewtopic.php?p=844965#p844920 would be added in subsequent PR

Last associated PR/commits :
This commit is contained in:
Paul Lee
2025-09-04 00:29:42 +08:00
committed by Yorik van Havre
parent 5642620281
commit b10fa7fb34

View File

@@ -1490,12 +1490,29 @@ def makeStairs(baseobj=None, length=None, width=None, height=None, steps=None, n
else:
stepsI = 20
setProperty(stairs[i], None, width, height, stepsI)
if i > 1:
if lenSelection > 1: # More than 1 segment
# All semgments in a complex stairs moved together by default
# regardless MoveWithHost setting in system setting
stair.MoveWithHost = True
# All segment goes to Additions (rather than previously 1st segment
# went to Base) - for consistent in MoveWithHost behaviour
if i > 0:
additions.append(stairs[i])
stairs[i].LastSegment = stairs[i - 1]
else:
if len(stairs) > 1: # i.e. length >1, have a 'master' staircase created
stairs[0].Base = stairs[1]
if i > 1:
stairs[i].LastSegment = stairs[i - 1]
#else:
# Below made '1st segment' of a complex stairs went to Base
# Remarked below out, 2025.8.31.
# Seems no other Arch object create an Arch object as its Base
# and use a 'master' Arch(Stairs) object like Stairs. Base is
# not moved together with host upon onChanged(), unlike
# behaviour in objects of Additions.
#
#if len(stairs) > 1: # i.e. length >1, have a 'master' staircase created
# stairs[0].Base = stairs[1]
i += 1
if lenSelection > 1:
stairs[0].Additions = additions
@@ -1554,6 +1571,9 @@ def makeRailing(stairs):
baseobj=None, diameter=0, length=0, placement=None,
name=translate("Arch", "Railing")
)
# All semgments in a complex stairs moved together by default
# regardless Move With Host setting in system setting
lrRail.MoveWithHost = True
if outlineLRAll:
setattr(stair, stairRailingLR, lrRail)
break