KCL: Convert x/y lines to use keyword arguments (#5615)

Previously, `xLine`, `xLineTo`, `yLine` and `yLineTo` used positional arguments. Now:

- `xLineTo` and `yLineTo` have been removed
- `xLine` and `yLine` both use keyword arguments:
  - `length`, optional (i.e. a relative distance along the X or Y axis)
  - `endAbsolute` optional (i.e. an absolute point along the X or Y axis)
  - `tag` optional
- Exactly one of `length` or `endAbsolute` must be given. Not both, not neither.

For example:

```
// Old way
|> xLine(6.04, %)
|> yLineTo(20, %, $base)

// New way
|> xLine(length = 6.04)
|> yLine(endAbsolute = 20, tag = $base)
```

This also improves some of the general-purpose keyword arguments code in modeling app's TS codebase.
This commit is contained in:
Adam Chalmers
2025-03-07 22:07:16 -06:00
committed by GitHub
parent bc3a0e3896
commit aea82e004a
289 changed files with 65906 additions and 67955 deletions

View File

@ -11,20 +11,20 @@ const length001 = slateWidthHalf - radius
const length002 = depth + minClampingDistance
const sketch001 = startSketchOn('XZ')
|> startProfileAt([0, depth - templateGap], %)
|> xLine(length001, %, $seg01)
|> xLine(length = length001, tag = $seg01)
|> arc({
angleEnd: 0,
angleStart: 90,
radius: radius - templateGap
}, %)
|> yLineTo(-templateGap * 2 - (templateDiameter / 2), %, $seg05)
|> xLineTo(slateWidthHalf + templateThickness, %, $seg04)
|> yLine(-length002, %, $seg03)
|> xLineTo(0, %, $seg02)
|> xLine(-segLen(seg02, %), %)
|> yLine(segLen(seg03, %), %)
|> xLine(segLen(seg04, %), %)
|> yLine(segLen(seg05, %), %)
|> yLine(endAbsolute = -templateGap * 2 - (templateDiameter / 2), tag = $seg05)
|> xLine(endAbsolute = slateWidthHalf + templateThickness, tag = $seg04)
|> yLine(length = -length002, tag = $seg03)
|> xLine(endAbsolute = 0, tag = $seg02)
|> xLine(length = -segLen(seg02, %))
|> yLine(length = segLen(seg03, %))
|> xLine(length = segLen(seg04, %))
|> yLine(length = segLen(seg05, %))
|> arc({
angleEnd: 90,
angleStart: 180,
@ -38,7 +38,7 @@ const sketch002 = startSketchOn(extrude001, 'START')
-slateWidthHalf,
-templateGap * 2 - (templateDiameter / 2)
], %)
|> xLine(-7, %, $rectangleSegmentA001)
|> xLine(length = -7, tag = $rectangleSegmentA001)
|> angledLine([
segAng(rectangleSegmentA001, %) + 90,
minClampingDistance
@ -55,7 +55,7 @@ const sketch003 = startSketchOn(extrude001, 'START')
slateWidthHalf,
-templateGap * 2 - (templateDiameter / 2)
], %)
|> xLine(7, %, $rectangleSegmentA002)
|> xLine(length = 7, tag = $rectangleSegmentA002)
|> angledLine([
segAng(rectangleSegmentA002, %) - 90,
minClampingDistance