From 50d22e2bb7e5f4645db6c6710ea1e1ce5d0884a9 Mon Sep 17 00:00:00 2001 From: paul <40677073+paullee0@users.noreply.github.com> Date: Mon, 10 Nov 2025 01:59:14 +0800 Subject: [PATCH] [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> --- src/Mod/BIM/ArchStairs.py | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/src/Mod/BIM/ArchStairs.py b/src/Mod/BIM/ArchStairs.py index 1d32f666c0..e64753056e 100644 --- a/src/Mod/BIM/ArchStairs.py +++ b/src/Mod/BIM/ArchStairs.py @@ -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