[ArchStairs] Fix StringerOverlap with Base at Angle (#25167)

* [ArchStairs] Fix StringerOverlap Base at Angle

Github Issue Discussion
- https://github.com/FreeCAD/FreeCAD/issues/24321#issuecomment-3492459309

"... error when Stringer Overlap is set above certain threshold combined with a non-baseless stair which does not have orthogonal direction - this means that the base line or sketch is rotated to a degree, which is not 0, 90, 180 or 270 degrees."

Further
Fix #24321

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
paul
2025-11-10 01:59:14 +08:00
committed by GitHub
parent 9e7b5f6444
commit 50d22e2bb7

View File

@@ -2003,7 +2003,28 @@ class _Stairs(ArchComponent.Component):
.multiply(numOfSteps - 1)
.add(Vector(0, 0, -vTreadThickness.Length + stringerOverlap))
)
# Shapes of Stringer at Different Cases
#
# p1
# ∕│
#
# / │
#
# / │
#
# / │ p1a -------┐ p1b
#
#
# │ p1c
# / /
# / / / / p1a __________ p1b
# / / /
# / / /
# / / /
p1 = vBase.add(l1).add(h1)
# TODO: Why not use vBasedAligned but align again?
p1 = self.align(p1, align, vWidth)
overlapDiff = (float(hgt) / numOfSteps + vTreadThickness.Length) - stringerOverlap
strOverlapMax = (structureThickness / vLength.Length) * hyp
@@ -2014,18 +2035,21 @@ class _Stairs(ArchComponent.Component):
lProfile.append(p1.add(Vector(0, 0, -strOverlapMax)))
else:
if (strOverlapMax + overlapDiff) > 0: # overlapDiff is -ve
vLenDiffP1b = (vLength.Length / vHeight.Length) * overlapDiff
vLenDiffP1a = (vLength.Length / vHeight.Length) * overlapDiff
vLenDiffP1c = (structureThickness / vLength.Length) * hyp
p1b = p1.add(Vector(0, 0, overlapDiff)) # overlapDiff is -ve
p1a = p1b.add(Vector(vLenDiffP1b, 0, 0))
v1a = DraftVecUtils.scaleTo(vLength, vLenDiffP1a)
p1a = p1b.add(v1a)
p1c = p1.add(Vector(0, 0, -vLenDiffP1c))
lProfile.append(p1a)
lProfile.append(p1b)
lProfile.append(p1c)
else:
vLenDiffP1a = (vLength.Length / vHeight.Length) * (overlapDiff)
p1a = p1.add(Vector(vLenDiffP1a, 0, overlapDiff))
p1b = p1a.add(Vector(strucHorLen, 0, 0))
v1a = DraftVecUtils.scaleTo(vLength, vLenDiffP1a)
p1a = p1.add(Vector(0, 0, overlapDiff)).add(v1a)
v1b = DraftVecUtils.scaleTo(vLength, strucHorLen)
p1b = p1a.add(v1b)
lProfile.append(p1a)
lProfile.append(p1b)
h3 = lProfile[-1].z - vBase.z