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:
@ -8,7 +8,7 @@ const FEATURE_TREE_EXAMPLE_CODE = `export fn timesFive(x) {
|
||||
export fn triangle() {
|
||||
return startSketchOn('XZ')
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> xLine(10, %)
|
||||
|> xLine(length = 10)
|
||||
|> line(end = [-10, -5])
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
@ -28,7 +28,7 @@ plane001 = offsetPlane('XY', offset = 10)
|
||||
sketch002 = startSketchOn(plane001)
|
||||
|> startProfileAt([-20, 0], %)
|
||||
|> line(end = [5, -15])
|
||||
|> xLine(-10, %)
|
||||
|> xLine(length = -10)
|
||||
|> line(endAbsolute = [-40, 0])
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
@ -402,7 +402,7 @@ test.describe('Feature Tree pane', () => {
|
||||
sketch001 = startSketchOn(plane001)
|
||||
profile001 = circle(sketch001, center = [0, 20], radius = 12)
|
||||
profile002 = startProfileAt([0, 7.25], sketch001)
|
||||
|> xLine(13.3, %)
|
||||
|> xLine(length = 13.3)
|
||||
profile003 = startProfileAt([0, -4.93], sketch001)
|
||||
|> line(endAbsolute = [-5.56, 0])`
|
||||
await context.folderSetupFn(async (dir) => {
|
||||
|
||||
Reference in New Issue
Block a user