Files
modeling-app/rust/kcl-lib/e2e/executor/inputs/i_shape.kcl
Adam Chalmers aea82e004a 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.
2025-03-07 22:07:16 -06:00

54 lines
2.5 KiB
Plaintext

let d_wrist_circumference = [22.8, 10.7, 16.4, 18.5]
let width = d_wrist_circumference[0] + d_wrist_circumference[1] + d_wrist_circumference[2] + d_wrist_circumference[3]
let length = 120.0
let hand_thickness = 24.0
let corner_radius = 5.0
// At first I thought this was going to be symmetric,
// but I measured intentionally to not be symmetric,
// because your wrist isn't a perfect cylindrical surface
let brace_base = startSketchOn(XY)
|> startProfileAt([corner_radius, 0], %)
|> line(end = [width - corner_radius, 0.0])
|> tangentialArcToRelative([corner_radius, corner_radius], %)
|> yLine(length = 25.0 - corner_radius)
|> tangentialArcToRelative([-corner_radius, corner_radius], %)
|> xLine(length = -(d_wrist_circumference[0] - (corner_radius * 2)))
|> tangentialArcToRelative([-corner_radius, corner_radius], %)
|> yLine(length = length - 25.0 - 23.0 - (corner_radius * 2))
|> tangentialArcToRelative([corner_radius, corner_radius], %)
|> xLine(length = 15.0 - (corner_radius * 2))
|> tangentialArcToRelative([corner_radius, corner_radius], %)
|> yLine(length = 23.0 - corner_radius)
|> tangentialArcToRelative([-corner_radius, corner_radius], %)
|> xLine(length = -(hand_thickness + 15.0 + 15.0 - (corner_radius * 2)))
|> tangentialArcToRelative([-corner_radius, -corner_radius], %)
|> yLine(length = -(23.0 - corner_radius))
|> tangentialArcToRelative([corner_radius, -corner_radius], %)
|> xLine(length = 15.0 - (corner_radius * 2))
|> tangentialArcToRelative([corner_radius, -corner_radius], %)
|> yLine(length = -(length - 25.0 - 23.0 - (corner_radius * 2)))
|> tangentialArcToRelative([-corner_radius, -corner_radius], %)
|> xLine(length = -(d_wrist_circumference[1] + d_wrist_circumference[2] + d_wrist_circumference[3] - hand_thickness - corner_radius))
|> tangentialArcToRelative([-corner_radius, -corner_radius], %)
|> yLine(length = -(25.0 - corner_radius))
|> tangentialArcToRelative([corner_radius, -corner_radius], %)
|> close()
let inner = startSketchOn(XY)
|> startProfileAt([0, 0], %)
|> xLine(length = 1.0)
|> tangentialArcToRelative([corner_radius, corner_radius], %)
|> yLine(length = 25.0 - (corner_radius * 2))
|> tangentialArcToRelative([-corner_radius, corner_radius], %)
|> xLine(length = -1.0)
|> tangentialArcToRelative([-corner_radius, -corner_radius], %)
|> yLine(length = -(25.0 - (corner_radius * 2)))
|> tangentialArcToRelative([corner_radius, -corner_radius], %)
|> close()
let final = brace_base
|> hole(inner, %)
|> extrude(length = 3.0)