Support = in record initialisation (#4519)

Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
Nick Cameron
2024-11-25 09:21:55 +13:00
committed by GitHub
parent f760a77b14
commit 66f6b741c4
164 changed files with 6126 additions and 6059 deletions

View File

@ -36,9 +36,9 @@ myAngle = -120
sketch001 = startSketchOn('XZ') sketch001 = startSketchOn('XZ')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line([8, 0], %) |> line([8, 0], %)
|> angledLine({ angle: abs(myAngle), length: 5 }, %) |> angledLine({ angle = abs(myAngle), length = 5 }, %)
|> line([-5, 0], %) |> line([-5, 0], %)
|> angledLine({ angle: myAngle, length: 5 }, %) |> angledLine({ angle = myAngle, length = 5 }, %)
|> close(%) |> close(%)
baseExtrusion = extrude(5, sketch001) baseExtrusion = extrude(5, sketch001)

View File

@ -34,8 +34,8 @@ acos(num: number) -> number
sketch001 = startSketchOn('XZ') sketch001 = startSketchOn('XZ')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ |> angledLine({
angle: toDegrees(acos(0.5)), angle = toDegrees(acos(0.5)),
length: 10 length = 10
}, %) }, %)
|> line([5, 0], %) |> line([5, 0], %)
|> lineTo([12, 0], %) |> lineTo([12, 0], %)

View File

@ -33,8 +33,8 @@ sketch001 = startSketchOn('XZ')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line([1, 2], %, $seg01) |> line([1, 2], %, $seg01)
|> angledLine({ |> angledLine({
angle: angleToMatchLengthY(seg01, 15, %), angle = angleToMatchLengthY(seg01, 15, %),
length: 5 length = 5
}, %) }, %)
|> yLineTo(0, %) |> yLineTo(0, %)
|> close(%) |> close(%)

View File

@ -32,7 +32,7 @@ angledLine(data: AngledLineData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
exampleSketch = startSketchOn('XZ') exampleSketch = startSketchOn('XZ')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> yLineTo(15, %) |> yLineTo(15, %)
|> angledLine({ angle: 30, length: 15 }, %) |> angledLine({ angle = 30, length = 15 }, %)
|> line([8, -10], %) |> line([8, -10], %)
|> yLineTo(0, %) |> yLineTo(0, %)
|> close(%) |> close(%)

View File

@ -31,8 +31,8 @@ angledLineOfXLength(data: AngledLineData, sketch: Sketch, tag?: TagDeclarator) -
```js ```js
sketch001 = startSketchOn('XZ') sketch001 = startSketchOn('XZ')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLineOfXLength({ angle: 45, length: 10 }, %, $edge1) |> angledLineOfXLength({ angle = 45, length = 10 }, %, $edge1)
|> angledLineOfXLength({ angle: -15, length: 20 }, %, $edge2) |> angledLineOfXLength({ angle = -15, length = 20 }, %, $edge2)
|> line([0, -5], %) |> line([0, -5], %)
|> close(%, $edge3) |> close(%, $edge3)

View File

@ -32,9 +32,9 @@ angledLineOfYLength(data: AngledLineData, sketch: Sketch, tag?: TagDeclarator) -
exampleSketch = startSketchOn('XZ') exampleSketch = startSketchOn('XZ')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line([10, 0], %) |> line([10, 0], %)
|> angledLineOfYLength({ angle: 45, length: 10 }, %) |> angledLineOfYLength({ angle = 45, length = 10 }, %)
|> line([0, 10], %) |> line([0, 10], %)
|> angledLineOfYLength({ angle: 135, length: 10 }, %) |> angledLineOfYLength({ angle = 135, length = 10 }, %)
|> line([-10, 0], %) |> line([-10, 0], %)
|> line([0, -30], %) |> line([0, -30], %)

View File

@ -35,9 +35,9 @@ exampleSketch = startSketchOn('XZ')
|> lineTo([-10, 10], %, $lineToIntersect) |> lineTo([-10, 10], %, $lineToIntersect)
|> lineTo([0, 20], %) |> lineTo([0, 20], %)
|> angledLineThatIntersects({ |> angledLineThatIntersects({
angle: 80, angle = 80,
intersectTag: lineToIntersect, intersectTag = lineToIntersect,
offset: 10 offset = 10
}, %) }, %)
|> close(%) |> close(%)

View File

@ -31,7 +31,7 @@ angledLineToX(data: AngledLineToData, sketch: Sketch, tag?: TagDeclarator) -> Sk
```js ```js
exampleSketch = startSketchOn('XZ') exampleSketch = startSketchOn('XZ')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLineToX({ angle: 30, to: 10 }, %) |> angledLineToX({ angle = 30, to = 10 }, %)
|> line([0, 10], %) |> line([0, 10], %)
|> line([-10, 0], %) |> line([-10, 0], %)
|> close(%) |> close(%)

View File

@ -31,9 +31,9 @@ angledLineToY(data: AngledLineToData, sketch: Sketch, tag?: TagDeclarator) -> Sk
```js ```js
exampleSketch = startSketchOn('XZ') exampleSketch = startSketchOn('XZ')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLineToY({ angle: 60, to: 20 }, %) |> angledLineToY({ angle = 60, to = 20 }, %)
|> line([-20, 0], %) |> line([-20, 0], %)
|> angledLineToY({ angle: 70, to: 10 }, %) |> angledLineToY({ angle = 70, to = 10 }, %)
|> close(%) |> close(%)
example = extrude(10, exampleSketch) example = extrude(10, exampleSketch)

View File

@ -35,9 +35,9 @@ exampleSketch = startSketchOn('XZ')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line([10, 0], %) |> line([10, 0], %)
|> arc({ |> arc({
angleStart: 0, angleStart = 0,
angleEnd: 280, angleEnd = 280,
radius: 16 radius = 16
}, %) }, %)
|> close(%) |> close(%)
example = extrude(10, exampleSketch) example = extrude(10, exampleSketch)

View File

@ -31,7 +31,7 @@ arcTo(data: ArcToData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
```js ```js
exampleSketch = startSketchOn('XZ') exampleSketch = startSketchOn('XZ')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> arcTo({ end: [10, 0], interior: [5, 5] }, %) |> arcTo({ end = [10, 0], interior = [5, 5] }, %)
|> close(%) |> close(%)
example = extrude(10, exampleSketch) example = extrude(10, exampleSketch)
``` ```

View File

@ -34,8 +34,8 @@ asin(num: number) -> number
sketch001 = startSketchOn('XZ') sketch001 = startSketchOn('XZ')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ |> angledLine({
angle: toDegrees(asin(0.5)), angle = toDegrees(asin(0.5)),
length: 20 length = 20
}, %) }, %)
|> yLineTo(0, %) |> yLineTo(0, %)
|> close(%) |> close(%)

View File

@ -34,8 +34,8 @@ atan(num: number) -> number
sketch001 = startSketchOn('XZ') sketch001 = startSketchOn('XZ')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ |> angledLine({
angle: toDegrees(atan(1.25)), angle = toDegrees(atan(1.25)),
length: 20 length = 20
}, %) }, %)
|> yLineTo(0, %) |> yLineTo(0, %)
|> close(%) |> close(%)

View File

@ -33,9 +33,9 @@ exampleSketch = startSketchOn('XZ')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line([0, 10], %) |> line([0, 10], %)
|> bezierCurve({ |> bezierCurve({
to: [10, 10], to = [10, 10],
control1: [5, 0], control1 = [5, 0],
control2: [5, 10] control2 = [5, 10]
}, %) }, %)
|> lineTo([10, 0], %) |> lineTo([10, 0], %)
|> close(%) |> close(%)

View File

@ -44,8 +44,8 @@ mountingPlateSketch = startSketchOn("XY")
mountingPlate = extrude(thickness, mountingPlateSketch) mountingPlate = extrude(thickness, mountingPlateSketch)
|> chamfer({ |> chamfer({
length: chamferLength, length = chamferLength,
tags: [ tags = [
getNextAdjacentEdge(edge1), getNextAdjacentEdge(edge1),
getNextAdjacentEdge(edge2), getNextAdjacentEdge(edge2),
getNextAdjacentEdge(edge3), getNextAdjacentEdge(edge3),
@ -72,8 +72,8 @@ part001 = cube([0, 0], 20)
|> close(%, $line1) |> close(%, $line1)
|> extrude(20, %) |> extrude(20, %)
|> chamfer({ |> chamfer({
length: 10, length = 10,
tags: [getOppositeEdge(line1)] tags = [getOppositeEdge(line1)]
}, %, $chamfer1) // We tag the chamfer to reference it later. }, %, $chamfer1) // We tag the chamfer to reference it later.
sketch001 = startSketchOn(part001, chamfer1) sketch001 = startSketchOn(part001, chamfer1)

View File

@ -30,7 +30,7 @@ circle(data: CircleData, sketch_surface_or_group: SketchOrSurface, tag?: TagDecl
```js ```js
exampleSketch = startSketchOn("-XZ") exampleSketch = startSketchOn("-XZ")
|> circle({ center: [0, 0], radius: 10 }, %) |> circle({ center = [0, 0], radius = 10 }, %)
example = extrude(5, exampleSketch) example = extrude(5, exampleSketch)
``` ```
@ -44,7 +44,7 @@ exampleSketch = startSketchOn("XZ")
|> line([0, 30], %) |> line([0, 30], %)
|> line([-30, 0], %) |> line([-30, 0], %)
|> close(%) |> close(%)
|> hole(circle({ center: [0, 15], radius: 5 }, %), %) |> hole(circle({ center = [0, 15], radius = 5 }, %), %)
example = extrude(5, exampleSketch) example = extrude(5, exampleSketch)
``` ```

View File

@ -34,8 +34,8 @@ cos(num: number) -> number
exampleSketch = startSketchOn("XZ") exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ |> angledLine({
angle: 30, angle = 30,
length: 3 / cos(toRadians(30)) length = 3 / cos(toRadians(30))
}, %) }, %)
|> yLineTo(0, %) |> yLineTo(0, %)
|> close(%) |> close(%)

View File

@ -28,7 +28,7 @@ e() -> number
```js ```js
exampleSketch = startSketchOn("XZ") exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ angle: 30, length: 2 * e() ^ 2 }, %) |> angledLine({ angle = 30, length = 2 * e() ^ 2 }, %)
|> yLineTo(0, %) |> yLineTo(0, %)
|> close(%) |> close(%)

View File

@ -32,16 +32,16 @@ example = startSketchOn('XZ')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line([10, 0], %) |> line([10, 0], %)
|> arc({ |> arc({
angleStart: 120, angleStart = 120,
angleEnd: 0, angleEnd = 0,
radius: 5 radius = 5
}, %) }, %)
|> line([5, 0], %) |> line([5, 0], %)
|> line([0, 10], %) |> line([0, 10], %)
|> bezierCurve({ |> bezierCurve({
control1: [-10, 0], control1 = [-10, 0],
control2: [2, 10], control2 = [2, 10],
to: [-5, 10] to = [-5, 10]
}, %) }, %)
|> line([-5, -2], %) |> line([-5, -2], %)
|> close(%) |> close(%)
@ -54,16 +54,16 @@ example = startSketchOn('XZ')
exampleSketch = startSketchOn('XZ') exampleSketch = startSketchOn('XZ')
|> startProfileAt([-10, 0], %) |> startProfileAt([-10, 0], %)
|> arc({ |> arc({
angleStart: 120, angleStart = 120,
angleEnd: -60, angleEnd = -60,
radius: 5 radius = 5
}, %) }, %)
|> line([10, 0], %) |> line([10, 0], %)
|> line([5, 0], %) |> line([5, 0], %)
|> bezierCurve({ |> bezierCurve({
control1: [-3, 0], control1 = [-3, 0],
control2: [2, 10], control2 = [2, 10],
to: [-5, 10] to = [-5, 10]
}, %) }, %)
|> line([-4, 10], %) |> line([-4, 10], %)
|> line([-5, -2], %) |> line([-5, -2], %)

View File

@ -43,8 +43,8 @@ mountingPlateSketch = startSketchOn("XY")
mountingPlate = extrude(thickness, mountingPlateSketch) mountingPlate = extrude(thickness, mountingPlateSketch)
|> fillet({ |> fillet({
radius: filletRadius, radius = filletRadius,
tags: [ tags = [
getNextAdjacentEdge(edge1), getNextAdjacentEdge(edge1),
getNextAdjacentEdge(edge2), getNextAdjacentEdge(edge2),
getNextAdjacentEdge(edge3), getNextAdjacentEdge(edge3),
@ -70,9 +70,9 @@ mountingPlateSketch = startSketchOn("XY")
mountingPlate = extrude(thickness, mountingPlateSketch) mountingPlate = extrude(thickness, mountingPlateSketch)
|> fillet({ |> fillet({
radius: filletRadius, radius = filletRadius,
tolerance: 0.000001, tolerance = 0.000001,
tags: [ tags = [
getNextAdjacentEdge(edge1), getNextAdjacentEdge(edge1),
getNextAdjacentEdge(edge2), getNextAdjacentEdge(edge2),
getNextAdjacentEdge(edge3), getNextAdjacentEdge(edge3),

View File

@ -30,16 +30,16 @@ getNextAdjacentEdge(tag: TagIdentifier) -> Uuid
exampleSketch = startSketchOn('XZ') exampleSketch = startSketchOn('XZ')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line([10, 0], %) |> line([10, 0], %)
|> angledLine({ angle: 60, length: 10 }, %) |> angledLine({ angle = 60, length = 10 }, %)
|> angledLine({ angle: 120, length: 10 }, %) |> angledLine({ angle = 120, length = 10 }, %)
|> line([-10, 0], %) |> line([-10, 0], %)
|> angledLine({ angle: 240, length: 10 }, %, $referenceEdge) |> angledLine({ angle = 240, length = 10 }, %, $referenceEdge)
|> close(%) |> close(%)
example = extrude(5, exampleSketch) example = extrude(5, exampleSketch)
|> fillet({ |> fillet({
radius: 3, radius = 3,
tags: [getNextAdjacentEdge(referenceEdge)] tags = [getNextAdjacentEdge(referenceEdge)]
}, %) }, %)
``` ```

View File

@ -30,16 +30,16 @@ getOppositeEdge(tag: TagIdentifier) -> Uuid
exampleSketch = startSketchOn('XZ') exampleSketch = startSketchOn('XZ')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line([10, 0], %) |> line([10, 0], %)
|> angledLine({ angle: 60, length: 10 }, %) |> angledLine({ angle = 60, length = 10 }, %)
|> angledLine({ angle: 120, length: 10 }, %) |> angledLine({ angle = 120, length = 10 }, %)
|> line([-10, 0], %) |> line([-10, 0], %)
|> angledLine({ angle: 240, length: 10 }, %, $referenceEdge) |> angledLine({ angle = 240, length = 10 }, %, $referenceEdge)
|> close(%) |> close(%)
example = extrude(5, exampleSketch) example = extrude(5, exampleSketch)
|> fillet({ |> fillet({
radius: 3, radius = 3,
tags: [getOppositeEdge(referenceEdge)] tags = [getOppositeEdge(referenceEdge)]
}, %) }, %)
``` ```

View File

@ -30,16 +30,16 @@ getPreviousAdjacentEdge(tag: TagIdentifier) -> Uuid
exampleSketch = startSketchOn('XZ') exampleSketch = startSketchOn('XZ')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line([10, 0], %) |> line([10, 0], %)
|> angledLine({ angle: 60, length: 10 }, %) |> angledLine({ angle = 60, length = 10 }, %)
|> angledLine({ angle: 120, length: 10 }, %) |> angledLine({ angle = 120, length = 10 }, %)
|> line([-10, 0], %) |> line([-10, 0], %)
|> angledLine({ angle: 240, length: 10 }, %, $referenceEdge) |> angledLine({ angle = 240, length = 10 }, %, $referenceEdge)
|> close(%) |> close(%)
example = extrude(5, exampleSketch) example = extrude(5, exampleSketch)
|> fillet({ |> fillet({
radius: 3, radius = 3,
tags: [getPreviousAdjacentEdge(referenceEdge)] tags = [getPreviousAdjacentEdge(referenceEdge)]
}, %) }, %)
``` ```

View File

@ -29,12 +29,12 @@ helix(data: HelixData, solid: Solid) -> Solid
```js ```js
part001 = startSketchOn('XY') part001 = startSketchOn('XY')
|> circle({ center: [5, 5], radius: 10 }, %) |> circle({ center = [5, 5], radius = 10 }, %)
|> extrude(10, %) |> extrude(10, %)
|> helix({ |> helix({
angleStart: 0, angleStart = 0,
ccw: true, ccw = true,
revolutions: 16 revolutions = 16
}, %) }, %)
``` ```

View File

@ -34,8 +34,8 @@ exampleSketch = startSketchOn('XY')
|> line([5, 0], %) |> line([5, 0], %)
|> line([0, -5], %) |> line([0, -5], %)
|> close(%) |> close(%)
|> hole(circle({ center: [1, 1], radius: .25 }, %), %) |> hole(circle({ center = [1, 1], radius = .25 }, %), %)
|> hole(circle({ center: [1, 4], radius: .25 }, %), %) |> hole(circle({ center = [1, 4], radius = .25 }, %), %)
example = extrude(1, exampleSketch) example = extrude(1, exampleSketch)
``` ```
@ -54,7 +54,7 @@ fn squareHoleSketch = () => {
} }
exampleSketch = startSketchOn('-XZ') exampleSketch = startSketchOn('-XZ')
|> circle({ center: [0, 0], radius: 3 }, %) |> circle({ center = [0, 0], radius = 3 }, %)
|> hole(squareHoleSketch(), %) |> hole(squareHoleSketch(), %)
example = extrude(1, exampleSketch) example = extrude(1, exampleSketch)
``` ```

View File

@ -68,15 +68,15 @@ case = startSketchOn('-XZ')
thing1 = startSketchOn(case, 'end') thing1 = startSketchOn(case, 'end')
|> circle({ |> circle({
center: [-size / 2, -size / 2], center = [-size / 2, -size / 2],
radius: 25 radius = 25
}, %) }, %)
|> extrude(50, %) |> extrude(50, %)
thing2 = startSketchOn(case, 'end') thing2 = startSketchOn(case, 'end')
|> circle({ |> circle({
center: [size / 2, -size / 2], center = [size / 2, -size / 2],
radius: 25 radius = 25
}, %) }, %)
|> extrude(50, %) |> extrude(50, %)

File diff suppressed because one or more lines are too long

View File

@ -37,10 +37,10 @@ n = int(ceil(5 / 2))
assertEqual(n, 3, 0.0001, "5/2 = 2.5, rounded up makes 3") assertEqual(n, 3, 0.0001, "5/2 = 2.5, rounded up makes 3")
// Draw n cylinders. // Draw n cylinders.
startSketchOn('XZ') startSketchOn('XZ')
|> circle({ center: [0, 0], radius: 2 }, %) |> circle({ center = [0, 0], radius = 2 }, %)
|> extrude(5, %) |> extrude(5, %)
|> patternTransform(n, (id) => { |> patternTransform(n, (id) => {
return { translate: [4 * id, 0, 0] } return { translate = [4 * id, 0, 0] }
}, %) }, %)
``` ```

View File

@ -60,10 +60,10 @@ squareSketch = startSketchOn('XY')
|> close(%) |> close(%)
circleSketch0 = startSketchOn(offsetPlane('XY', 75)) circleSketch0 = startSketchOn(offsetPlane('XY', 75))
|> circle({ center: [0, 100], radius: 50 }, %) |> circle({ center = [0, 100], radius = 50 }, %)
circleSketch1 = startSketchOn(offsetPlane('XY', 150)) circleSketch1 = startSketchOn(offsetPlane('XY', 150))
|> circle({ center: [0, 100], radius: 20 }, %) |> circle({ center = [0, 100], radius = 20 }, %)
loft([ loft([
squareSketch, squareSketch,
@ -85,10 +85,10 @@ squareSketch = startSketchOn('XY')
|> close(%) |> close(%)
circleSketch0 = startSketchOn(offsetPlane('XY', 75)) circleSketch0 = startSketchOn(offsetPlane('XY', 75))
|> circle({ center: [0, 100], radius: 50 }, %) |> circle({ center = [0, 100], radius = 50 }, %)
circleSketch1 = startSketchOn(offsetPlane('XY', 150)) circleSketch1 = startSketchOn(offsetPlane('XY', 150))
|> circle({ center: [0, 100], radius: 20 }, %) |> circle({ center = [0, 100], radius = 20 }, %)
loft([ loft([
squareSketch, squareSketch,
@ -97,17 +97,17 @@ loft([
], { ], {
// This can be set to override the automatically determined // This can be set to override the automatically determined
// topological base curve, which is usually the first section encountered. // topological base curve, which is usually the first section encountered.
baseCurveIndex: 0, baseCurveIndex = 0,
// Attempt to approximate rational curves (such as arcs) using a bezier. // Attempt to approximate rational curves (such as arcs) using a bezier.
// This will remove banding around interpolations between arcs and non-arcs. // This will remove banding around interpolations between arcs and non-arcs.
// It may produce errors in other scenarios Over time, this field won't be necessary. // It may produce errors in other scenarios Over time, this field won't be necessary.
bezApproximateRational: false, bezApproximateRational = false,
// Tolerance for the loft operation. // Tolerance for the loft operation.
tolerance: 0.000001, tolerance = 0.000001,
// Degree of the interpolation. Must be greater than zero. // Degree of the interpolation. Must be greater than zero.
// For example, use 2 for quadratic, or 3 for cubic interpolation in // For example, use 2 for quadratic, or 3 for cubic interpolation in
// the V direction. This defaults to 2, if not specified. // the V direction. This defaults to 2, if not specified.
vDegree: 2 vDegree = 2
}) })
``` ```

View File

@ -31,7 +31,7 @@ map(array: [KclValue], map_fn: FunctionParam) -> [KclValue]
r = 10 // radius r = 10 // radius
fn drawCircle = (id) => { fn drawCircle = (id) => {
return startSketchOn("XY") return startSketchOn("XY")
|> circle({ center: [id * 2 * r, 0], radius: r }, %) |> circle({ center = [id * 2 * r, 0], radius = r }, %)
} }
// Call `drawCircle`, passing in each element of the array. // Call `drawCircle`, passing in each element of the array.
@ -47,7 +47,7 @@ r = 10 // radius
// Call `map`, using an anonymous function instead of a named one. // Call `map`, using an anonymous function instead of a named one.
circles = map([1..3], (id) => { circles = map([1..3], (id) => {
return startSketchOn("XY") return startSketchOn("XY")
|> circle({ center: [id * 2 * r, 0], radius: r }, %) |> circle({ center = [id * 2 * r, 0], radius = r }, %)
}) })
``` ```

View File

@ -34,8 +34,8 @@ max(args: [number]) -> number
exampleSketch = startSketchOn("XZ") exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ |> angledLine({
angle: 70, angle = 70,
length: max(15, 31, 4, 13, 22) length = max(15, 31, 4, 13, 22)
}, %) }, %)
|> line([20, 0], %) |> line([20, 0], %)
|> close(%) |> close(%)

View File

@ -34,8 +34,8 @@ min(args: [number]) -> number
exampleSketch = startSketchOn("XZ") exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ |> angledLine({
angle: 70, angle = 70,
length: min(15, 31, 4, 13, 22) length = min(15, 31, 4, 13, 22)
}, %) }, %)
|> line([20, 0], %) |> line([20, 0], %)
|> close(%) |> close(%)

View File

@ -41,7 +41,7 @@ sketch001 = startSketchOn('XZ')
|> line([-8, -3], %) |> line([-8, -3], %)
|> line([9, -1], %) |> line([9, -1], %)
|> line([-19, -0], %) |> line([-19, -0], %)
|> mirror2d({ axis: 'Y' }, %) |> mirror2d({ axis = 'Y' }, %)
example = extrude(10, sketch001) example = extrude(10, sketch001)
``` ```
@ -54,7 +54,7 @@ sketch001 = startSketchOn('XZ')
|> startProfileAt([0, 8.5], %) |> startProfileAt([0, 8.5], %)
|> line([20, -8.5], %) |> line([20, -8.5], %)
|> line([-20, -8.5], %) |> line([-20, -8.5], %)
|> mirror2d({ axis: 'Y' }, %) |> mirror2d({ axis = 'Y' }, %)
example = extrude(10, sketch001) example = extrude(10, sketch001)
``` ```
@ -71,7 +71,7 @@ sketch001 = startSketchOn('XZ')
|> startProfileAt([0, 8.5], %) |> startProfileAt([0, 8.5], %)
|> line([20, -8.5], %) |> line([20, -8.5], %)
|> line([-20, -8.5], %) |> line([-20, -8.5], %)
|> mirror2d({ axis: edge001 }, %) |> mirror2d({ axis = edge001 }, %)
example = extrude(10, sketch001) example = extrude(10, sketch001)
``` ```
@ -85,8 +85,11 @@ sketch001 = startSketchOn('XZ')
|> line([20, -8.5], %) |> line([20, -8.5], %)
|> line([-20, -8.5], %) |> line([-20, -8.5], %)
|> mirror2d({ |> mirror2d({
axis: { axis = {
custom: { axis: [0.0, 1.0], origin: [0.0, 0.0] } custom = {
axis = [0.0, 1.0],
origin = [0.0, 0.0]
}
} }
}, %) }, %)

View File

@ -38,7 +38,7 @@ squareSketch = startSketchOn('XY')
|> close(%) |> close(%)
circleSketch = startSketchOn(offsetPlane('XY', 150)) circleSketch = startSketchOn(offsetPlane('XY', 150))
|> circle({ center: [0, 100], radius: 50 }, %) |> circle({ center = [0, 100], radius = 50 }, %)
loft([squareSketch, circleSketch]) loft([squareSketch, circleSketch])
``` ```
@ -56,7 +56,7 @@ squareSketch = startSketchOn('XZ')
|> close(%) |> close(%)
circleSketch = startSketchOn(offsetPlane('XZ', 150)) circleSketch = startSketchOn(offsetPlane('XZ', 150))
|> circle({ center: [0, 100], radius: 50 }, %) |> circle({ center = [0, 100], radius = 50 }, %)
loft([squareSketch, circleSketch]) loft([squareSketch, circleSketch])
``` ```
@ -74,7 +74,7 @@ squareSketch = startSketchOn('YZ')
|> close(%) |> close(%)
circleSketch = startSketchOn(offsetPlane('YZ', 150)) circleSketch = startSketchOn(offsetPlane('YZ', 150))
|> circle({ center: [0, 100], radius: 50 }, %) |> circle({ center = [0, 100], radius = 50 }, %)
loft([squareSketch, circleSketch]) loft([squareSketch, circleSketch])
``` ```
@ -92,7 +92,7 @@ squareSketch = startSketchOn('-XZ')
|> close(%) |> close(%)
circleSketch = startSketchOn(offsetPlane('-XZ', -150)) circleSketch = startSketchOn(offsetPlane('-XZ', -150))
|> circle({ center: [0, 100], radius: 50 }, %) |> circle({ center = [0, 100], radius = 50 }, %)
loft([squareSketch, circleSketch]) loft([squareSketch, circleSketch])
``` ```
@ -103,7 +103,7 @@ loft([squareSketch, circleSketch])
// A circle on the XY plane // A circle on the XY plane
startSketchOn("XY") startSketchOn("XY")
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> circle({ radius: 10, center: [0, 0] }, %) |> circle({ radius = 10, center = [0, 0] }, %)
// Triangle on the plane 4 units above // Triangle on the plane 4 units above
startSketchOn(offsetPlane("XY", 4)) startSketchOn(offsetPlane("XY", 4))

View File

@ -35,10 +35,10 @@ exampleSketch = startSketchOn('XZ')
|> line([0, -5], %) |> line([0, -5], %)
|> close(%) |> close(%)
|> patternCircular2d({ |> patternCircular2d({
center: [0, 0], center = [0, 0],
instances: 13, instances = 13,
arcDegrees: 360, arcDegrees = 360,
rotateDuplicates: true rotateDuplicates = true
}, %) }, %)
example = extrude(1, exampleSketch) example = extrude(1, exampleSketch)

View File

@ -29,15 +29,15 @@ patternCircular3d(data: CircularPattern3dData, solid_set: SolidSet) -> [Solid]
```js ```js
exampleSketch = startSketchOn('XZ') exampleSketch = startSketchOn('XZ')
|> circle({ center: [0, 0], radius: 1 }, %) |> circle({ center = [0, 0], radius = 1 }, %)
example = extrude(-5, exampleSketch) example = extrude(-5, exampleSketch)
|> patternCircular3d({ |> patternCircular3d({
axis: [1, -1, 0], axis = [1, -1, 0],
center: [10, -20, 0], center = [10, -20, 0],
instances: 11, instances = 11,
arcDegrees: 360, arcDegrees = 360,
rotateDuplicates: true rotateDuplicates = true
}, %) }, %)
``` ```

View File

@ -29,11 +29,11 @@ patternLinear2d(data: LinearPattern2dData, sketch_set: SketchSet) -> [Sketch]
```js ```js
exampleSketch = startSketchOn('XZ') exampleSketch = startSketchOn('XZ')
|> circle({ center: [0, 0], radius: 1 }, %) |> circle({ center = [0, 0], radius = 1 }, %)
|> patternLinear2d({ |> patternLinear2d({
axis: [1, 0], axis = [1, 0],
instances: 7, instances = 7,
distance: 4 distance = 4
}, %) }, %)
example = extrude(1, exampleSketch) example = extrude(1, exampleSketch)

View File

@ -37,9 +37,9 @@ exampleSketch = startSketchOn('XZ')
example = extrude(1, exampleSketch) example = extrude(1, exampleSketch)
|> patternLinear3d({ |> patternLinear3d({
axis: [1, 0, 1], axis = [1, 0, 1],
instances: 7, instances = 7,
distance: 6 distance = 6
}, %) }, %)
``` ```

View File

@ -57,12 +57,12 @@ patternTransform(total_instances: u32, transform_function: FunctionParam, solid_
```js ```js
// Each instance will be shifted along the X axis. // Each instance will be shifted along the X axis.
fn transform = (id) => { fn transform = (id) => {
return { translate: [4 * id, 0, 0] } return { translate = [4 * id, 0, 0] }
} }
// Sketch 4 cylinders. // Sketch 4 cylinders.
sketch001 = startSketchOn('XZ') sketch001 = startSketchOn('XZ')
|> circle({ center: [0, 0], radius: 2 }, %) |> circle({ center = [0, 0], radius = 2 }, %)
|> extrude(5, %) |> extrude(5, %)
|> patternTransform(4, transform, %) |> patternTransform(4, transform, %)
``` ```
@ -74,11 +74,11 @@ sketch001 = startSketchOn('XZ')
// with a gap between the original (at x = 0) and the first replica // with a gap between the original (at x = 0) and the first replica
// (at x = 8). This is because `id` starts at 1. // (at x = 8). This is because `id` starts at 1.
fn transform = (id) => { fn transform = (id) => {
return { translate: [4 * (1 + id), 0, 0] } return { translate = [4 * (1 + id), 0, 0] }
} }
sketch001 = startSketchOn('XZ') sketch001 = startSketchOn('XZ')
|> circle({ center: [0, 0], radius: 2 }, %) |> circle({ center = [0, 0], radius = 2 }, %)
|> extrude(5, %) |> extrude(5, %)
|> patternTransform(4, transform, %) |> patternTransform(4, transform, %)
``` ```
@ -108,11 +108,11 @@ width = 20
fn transform = (i) => { fn transform = (i) => {
return { return {
// Move down each time. // Move down each time.
translate: [0, 0, -i * width], translate = [0, 0, -i * width],
// Make the cube longer, wider and flatter each time. // Make the cube longer, wider and flatter each time.
scale: [pow(1.1, i), pow(1.1, i), pow(0.9, i)], scale = [pow(1.1, i), pow(1.1, i), pow(0.9, i)],
// Turn by 15 degrees each time. // Turn by 15 degrees each time.
rotation: { angle: 15 * i, origin: "local" } rotation = { angle = 15 * i, origin = "local" }
} }
} }
@ -144,11 +144,11 @@ fn cube = (length, center) => {
width = 20 width = 20
fn transform = (i) => { fn transform = (i) => {
return { return {
translate: [0, 0, -i * width], translate = [0, 0, -i * width],
rotation: { rotation = {
angle: 90 * i, angle = 90 * i,
// Rotate around the overall scene's origin. // Rotate around the overall scene's origin.
origin: "global" origin = "global"
} }
} }
} }
@ -168,15 +168,15 @@ t = 0.005 // taper factor [0-1)
fn transform = (replicaId) => { fn transform = (replicaId) => {
scale = r * abs(1 - (t * replicaId)) * (5 + cos(replicaId / 8)) scale = r * abs(1 - (t * replicaId)) * (5 + cos(replicaId / 8))
return { return {
translate: [0, 0, replicaId * 10], translate = [0, 0, replicaId * 10],
scale: [scale, scale, 0] scale = [scale, scale, 0]
} }
} }
// Each layer is just a pretty thin cylinder. // Each layer is just a pretty thin cylinder.
fn layer = () => { fn layer = () => {
return startSketchOn("XY") return startSketchOn("XY")
// or some other plane idk // or some other plane idk
|> circle({ center: [0, 0], radius: 1 }, %, $tag1) |> circle({ center = [0, 0], radius = 1 }, %, $tag1)
|> extrude(h, %) |> extrude(h, %)
} }
// The vase is 100 layers tall. // The vase is 100 layers tall.
@ -191,16 +191,16 @@ vase = layer()
fn transform = (i) => { fn transform = (i) => {
// Transform functions can return multiple transforms. They'll be applied in order. // Transform functions can return multiple transforms. They'll be applied in order.
return [ return [
{ translate: [30 * i, 0, 0] }, { translate = [30 * i, 0, 0] },
{ rotation: { angle: 45 * i } } { rotation = { angle = 45 * i } }
] ]
} }
startSketchAt([0, 0]) startSketchAt([0, 0])
|> polygon({ |> polygon({
radius: 10, radius = 10,
numSides: 4, numSides = 4,
center: [0, 0], center = [0, 0],
inscribed: false inscribed = false
}, %) }, %)
|> extrude(4, %) |> extrude(4, %)
|> patternTransform(3, transform, %) |> patternTransform(3, transform, %)

View File

@ -31,12 +31,12 @@ patternTransform2d(total_instances: u32, transform_function: FunctionParam, soli
```js ```js
// Each instance will be shifted along the X axis. // Each instance will be shifted along the X axis.
fn transform = (id) => { fn transform = (id) => {
return { translate: [4 * id, 0] } return { translate = [4 * id, 0] }
} }
// Sketch 4 circles. // Sketch 4 circles.
sketch001 = startSketchOn('XZ') sketch001 = startSketchOn('XZ')
|> circle({ center: [0, 0], radius: 2 }, %) |> circle({ center = [0, 0], radius = 2 }, %)
|> patternTransform2d(4, transform, %) |> patternTransform2d(4, transform, %)
``` ```

View File

@ -30,8 +30,8 @@ circumference = 70
exampleSketch = startSketchOn("XZ") exampleSketch = startSketchOn("XZ")
|> circle({ |> circle({
center: [0, 0], center = [0, 0],
radius: circumference / (2 * pi()) radius = circumference / (2 * pi())
}, %) }, %)
example = extrude(5, exampleSketch) example = extrude(5, exampleSketch)

View File

@ -29,7 +29,7 @@ polar(data: PolarCoordsData) -> [number]
```js ```js
exampleSketch = startSketchOn('XZ') exampleSketch = startSketchOn('XZ')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line(polar({ angle: 30, length: 5 }), %, $thing) |> line(polar({ angle = 30, length = 5 }), %, $thing)
|> line([0, 5], %) |> line([0, 5], %)
|> line([segEndX(thing), 0], %) |> line([segEndX(thing), 0], %)
|> line([-20, 10], %) |> line([-20, 10], %)

View File

@ -32,10 +32,10 @@ polygon(data: PolygonData, sketch_surface_or_group: SketchOrSurface, tag?: TagDe
// Create a regular hexagon inscribed in a circle of radius 10 // Create a regular hexagon inscribed in a circle of radius 10
hex = startSketchOn('XY') hex = startSketchOn('XY')
|> polygon({ |> polygon({
radius: 10, radius = 10,
numSides: 6, numSides = 6,
center: [0, 0], center = [0, 0],
inscribed: true inscribed = true
}, %) }, %)
example = extrude(5, hex) example = extrude(5, hex)
@ -47,10 +47,10 @@ example = extrude(5, hex)
// Create a square circumscribed around a circle of radius 5 // Create a square circumscribed around a circle of radius 5
square = startSketchOn('XY') square = startSketchOn('XY')
|> polygon({ |> polygon({
radius: 5.0, radius = 5.0,
numSides: 4, numSides = 4,
center: [10, 10], center = [10, 10],
inscribed: false inscribed = false
}, %) }, %)
example = extrude(5, square) example = extrude(5, square)
``` ```

View File

@ -34,7 +34,7 @@ pow(num: number, pow: number) -> number
```js ```js
exampleSketch = startSketchOn("XZ") exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ angle: 50, length: pow(5, 2) }, %) |> angledLine({ angle = 50, length = pow(5, 2) }, %)
|> yLineTo(0, %) |> yLineTo(0, %)
|> close(%) |> close(%)

View File

@ -29,10 +29,10 @@ profileStart(sketch: Sketch) -> [number]
```js ```js
sketch001 = startSketchOn('XY') sketch001 = startSketchOn('XY')
|> startProfileAt([5, 2], %) |> startProfileAt([5, 2], %)
|> angledLine({ angle: 120, length: 50 }, %, $seg01) |> angledLine({ angle = 120, length = 50 }, %, $seg01)
|> angledLine({ |> angledLine({
angle: segAng(seg01) + 120, angle = segAng(seg01) + 120,
length: 50 length = 50
}, %) }, %)
|> lineTo(profileStart(%), %) |> lineTo(profileStart(%), %)
|> close(%) |> close(%)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -38,7 +38,10 @@ cube = startSketchAt([0, 0])
fn cylinder = (radius, tag) => { fn cylinder = (radius, tag) => {
return startSketchAt([0, 0]) return startSketchAt([0, 0])
|> circle({ radius: radius, center: segEnd(tag) }, %) |> circle({
radius = radius,
center = segEnd(tag)
}, %)
|> extrude(radius, %) |> extrude(radius, %)
} }

View File

@ -29,9 +29,9 @@ segLen(tag: TagIdentifier) -> number
```js ```js
exampleSketch = startSketchOn("XZ") exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ angle: 60, length: 10 }, %, $thing) |> angledLine({ angle = 60, length = 10 }, %, $thing)
|> tangentialArc({ offset: -120, radius: 5 }, %) |> tangentialArc({ offset = -120, radius = 5 }, %)
|> angledLine({ angle: -60, length: segLen(thing) }, %) |> angledLine({ angle = -60, length = segLen(thing) }, %)
|> close(%) |> close(%)
example = extrude(5, exampleSketch) example = extrude(5, exampleSketch)

View File

@ -39,8 +39,8 @@ cube = startSketchAt([0, 0])
fn cylinder = (radius, tag) => { fn cylinder = (radius, tag) => {
return startSketchAt([0, 0]) return startSketchAt([0, 0])
|> circle({ |> circle({
radius: radius, radius = radius,
center: segStart(tag) center = segStart(tag)
}, %) }, %)
|> extrude(radius, %) |> extrude(radius, %)
} }

File diff suppressed because one or more lines are too long

View File

@ -34,8 +34,8 @@ sin(num: number) -> number
exampleSketch = startSketchOn("XZ") exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ |> angledLine({
angle: 50, angle = 50,
length: 15 / sin(toDegrees(135)) length = 15 / sin(toDegrees(135))
}, %) }, %)
|> yLineTo(0, %) |> yLineTo(0, %)
|> close(%) |> close(%)

View File

@ -33,7 +33,7 @@ sqrt(num: number) -> number
```js ```js
exampleSketch = startSketchOn("XZ") exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ angle: 50, length: sqrt(2500) }, %) |> angledLine({ angle = 50, length = sqrt(2500) }, %)
|> yLineTo(0, %) |> yLineTo(0, %)
|> close(%) |> close(%)

View File

@ -101,7 +101,7 @@ exampleSketch = startSketchOn('XY')
|> line([-2, 0], %) |> line([-2, 0], %)
|> close(%) |> close(%)
example = revolve({ axis: 'y', angle: 180 }, exampleSketch) example = revolve({ axis = 'y', angle = 180 }, exampleSketch)
exampleSketch002 = startSketchOn(example, 'end') exampleSketch002 = startSketchOn(example, 'end')
|> startProfileAt([4.5, -5], %) |> startProfileAt([4.5, -5], %)
@ -117,11 +117,11 @@ example002 = extrude(5, exampleSketch002)
```js ```js
a1 = startSketchOn({ a1 = startSketchOn({
plane: { plane = {
origin: { x: 0, y: 0, z: 0 }, origin = { x = 0, y = 0, z = 0 },
xAxis: { x: 1, y: 0, z: 0 }, xAxis = { x = 1, y = 0, z = 0 },
yAxis: { x: 0, y: 1, z: 0 }, yAxis = { x = 0, y = 1, z = 0 },
zAxis: { x: 0, y: 0, z: 1 } zAxis = { x = 0, y = 0, z = 1 }
} }
}) })
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)

View File

@ -33,7 +33,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"myAngle = -120\n\nsketch001 = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line([8, 0], %)\n |> angledLine({ angle: abs(myAngle), length: 5 }, %)\n |> line([-5, 0], %)\n |> angledLine({ angle: myAngle, length: 5 }, %)\n |> close(%)\n\nbaseExtrusion = extrude(5, sketch001)" "myAngle = -120\n\nsketch001 = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line([8, 0], %)\n |> angledLine({ angle = abs(myAngle), length = 5 }, %)\n |> line([-5, 0], %)\n |> angledLine({ angle = myAngle, length = 5 }, %)\n |> close(%)\n\nbaseExtrusion = extrude(5, sketch001)"
] ]
}, },
{ {
@ -70,7 +70,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"sketch001 = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> angledLine({\n angle: toDegrees(acos(0.5)),\n length: 10\n }, %)\n |> line([5, 0], %)\n |> lineTo([12, 0], %)\n |> close(%)\n\nextrude001 = extrude(5, sketch001)" "sketch001 = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> angledLine({\n angle = toDegrees(acos(0.5)),\n length = 10\n }, %)\n |> line([5, 0], %)\n |> lineTo([12, 0], %)\n |> close(%)\n\nextrude001 = extrude(5, sketch001)"
] ]
}, },
{ {
@ -6300,7 +6300,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"sketch001 = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line([1, 2], %, $seg01)\n |> angledLine({\n angle: angleToMatchLengthY(seg01, 15, %),\n length: 5\n }, %)\n |> yLineTo(0, %)\n |> close(%)\n\nextrusion = extrude(5, sketch001)" "sketch001 = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line([1, 2], %, $seg01)\n |> angledLine({\n angle = angleToMatchLengthY(seg01, 15, %),\n length = 5\n }, %)\n |> yLineTo(0, %)\n |> close(%)\n\nextrusion = extrude(5, sketch001)"
] ]
}, },
{ {
@ -10403,7 +10403,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> yLineTo(15, %)\n |> angledLine({ angle: 30, length: 15 }, %)\n |> line([8, -10], %)\n |> yLineTo(0, %)\n |> close(%)\n\nexample = extrude(10, exampleSketch)" "exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> yLineTo(15, %)\n |> angledLine({ angle = 30, length = 15 }, %)\n |> line([8, -10], %)\n |> yLineTo(0, %)\n |> close(%)\n\nexample = extrude(10, exampleSketch)"
] ]
}, },
{ {
@ -14506,7 +14506,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"sketch001 = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> angledLineOfXLength({ angle: 45, length: 10 }, %, $edge1)\n |> angledLineOfXLength({ angle: -15, length: 20 }, %, $edge2)\n |> line([0, -5], %)\n |> close(%, $edge3)\n\nextrusion = extrude(10, sketch001)" "sketch001 = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> angledLineOfXLength({ angle = 45, length = 10 }, %, $edge1)\n |> angledLineOfXLength({ angle = -15, length = 20 }, %, $edge2)\n |> line([0, -5], %)\n |> close(%, $edge3)\n\nextrusion = extrude(10, sketch001)"
] ]
}, },
{ {
@ -18609,7 +18609,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line([10, 0], %)\n |> angledLineOfYLength({ angle: 45, length: 10 }, %)\n |> line([0, 10], %)\n |> angledLineOfYLength({ angle: 135, length: 10 }, %)\n |> line([-10, 0], %)\n |> line([0, -30], %)\n\nexample = extrude(10, exampleSketch)" "exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line([10, 0], %)\n |> angledLineOfYLength({ angle = 45, length = 10 }, %)\n |> line([0, 10], %)\n |> angledLineOfYLength({ angle = 135, length = 10 }, %)\n |> line([-10, 0], %)\n |> line([0, -30], %)\n\nexample = extrude(10, exampleSketch)"
] ]
}, },
{ {
@ -23573,7 +23573,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> lineTo([5, 10], %)\n |> lineTo([-10, 10], %, $lineToIntersect)\n |> lineTo([0, 20], %)\n |> angledLineThatIntersects({\n angle: 80,\n intersectTag: lineToIntersect,\n offset: 10\n }, %)\n |> close(%)\n\nexample = extrude(10, exampleSketch)" "exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> lineTo([5, 10], %)\n |> lineTo([-10, 10], %, $lineToIntersect)\n |> lineTo([0, 20], %)\n |> angledLineThatIntersects({\n angle = 80,\n intersectTag = lineToIntersect,\n offset = 10\n }, %)\n |> close(%)\n\nexample = extrude(10, exampleSketch)"
] ]
}, },
{ {
@ -27661,7 +27661,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> angledLineToX({ angle: 30, to: 10 }, %)\n |> line([0, 10], %)\n |> line([-10, 0], %)\n |> close(%)\n\nexample = extrude(10, exampleSketch)" "exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> angledLineToX({ angle = 30, to = 10 }, %)\n |> line([0, 10], %)\n |> line([-10, 0], %)\n |> close(%)\n\nexample = extrude(10, exampleSketch)"
] ]
}, },
{ {
@ -31749,7 +31749,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> angledLineToY({ angle: 60, to: 20 }, %)\n |> line([-20, 0], %)\n |> angledLineToY({ angle: 70, to: 10 }, %)\n |> close(%)\n\nexample = extrude(10, exampleSketch)" "exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> angledLineToY({ angle = 60, to = 20 }, %)\n |> line([-20, 0], %)\n |> angledLineToY({ angle = 70, to = 10 }, %)\n |> close(%)\n\nexample = extrude(10, exampleSketch)"
] ]
}, },
{ {
@ -35888,7 +35888,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line([10, 0], %)\n |> arc({\n angleStart: 0,\n angleEnd: 280,\n radius: 16\n }, %)\n |> close(%)\nexample = extrude(10, exampleSketch)" "exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line([10, 0], %)\n |> arc({\n angleStart = 0,\n angleEnd = 280,\n radius = 16\n }, %)\n |> close(%)\nexample = extrude(10, exampleSketch)"
] ]
}, },
{ {
@ -39986,7 +39986,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> arcTo({ end: [10, 0], interior: [5, 5] }, %)\n |> close(%)\nexample = extrude(10, exampleSketch)" "exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> arcTo({ end = [10, 0], interior = [5, 5] }, %)\n |> close(%)\nexample = extrude(10, exampleSketch)"
] ]
}, },
{ {
@ -40023,7 +40023,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"sketch001 = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> angledLine({\n angle: toDegrees(asin(0.5)),\n length: 20\n }, %)\n |> yLineTo(0, %)\n |> close(%)\n\nextrude001 = extrude(5, sketch001)" "sketch001 = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> angledLine({\n angle = toDegrees(asin(0.5)),\n length = 20\n }, %)\n |> yLineTo(0, %)\n |> close(%)\n\nextrude001 = extrude(5, sketch001)"
] ]
}, },
{ {
@ -40389,7 +40389,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"sketch001 = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> angledLine({\n angle: toDegrees(atan(1.25)),\n length: 20\n }, %)\n |> yLineTo(0, %)\n |> close(%)\n\nextrude001 = extrude(5, sketch001)" "sketch001 = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> angledLine({\n angle = toDegrees(atan(1.25)),\n length = 20\n }, %)\n |> yLineTo(0, %)\n |> close(%)\n\nextrude001 = extrude(5, sketch001)"
] ]
}, },
{ {
@ -44498,7 +44498,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line([0, 10], %)\n |> bezierCurve({\n to: [10, 10],\n control1: [5, 0],\n control2: [5, 10]\n }, %)\n |> lineTo([10, 0], %)\n |> close(%)\n\nexample = extrude(10, exampleSketch)" "exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line([0, 10], %)\n |> bezierCurve({\n to = [10, 10],\n control1 = [5, 0],\n control2 = [5, 10]\n }, %)\n |> lineTo([10, 0], %)\n |> close(%)\n\nexample = extrude(10, exampleSketch)"
] ]
}, },
{ {
@ -49564,8 +49564,8 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"// Chamfer a mounting plate.\nwidth = 20\nlength = 10\nthickness = 1\nchamferLength = 2\n\nmountingPlateSketch = startSketchOn(\"XY\")\n |> startProfileAt([-width / 2, -length / 2], %)\n |> lineTo([width / 2, -length / 2], %, $edge1)\n |> lineTo([width / 2, length / 2], %, $edge2)\n |> lineTo([-width / 2, length / 2], %, $edge3)\n |> close(%, $edge4)\n\nmountingPlate = extrude(thickness, mountingPlateSketch)\n |> chamfer({\n length: chamferLength,\n tags: [\n getNextAdjacentEdge(edge1),\n getNextAdjacentEdge(edge2),\n getNextAdjacentEdge(edge3),\n getNextAdjacentEdge(edge4)\n ]\n }, %)", "// Chamfer a mounting plate.\nwidth = 20\nlength = 10\nthickness = 1\nchamferLength = 2\n\nmountingPlateSketch = startSketchOn(\"XY\")\n |> startProfileAt([-width / 2, -length / 2], %)\n |> lineTo([width / 2, -length / 2], %, $edge1)\n |> lineTo([width / 2, length / 2], %, $edge2)\n |> lineTo([-width / 2, length / 2], %, $edge3)\n |> close(%, $edge4)\n\nmountingPlate = extrude(thickness, mountingPlateSketch)\n |> chamfer({\n length = chamferLength,\n tags = [\n getNextAdjacentEdge(edge1),\n getNextAdjacentEdge(edge2),\n getNextAdjacentEdge(edge3),\n getNextAdjacentEdge(edge4)\n ]\n }, %)",
"// Sketch on the face of a chamfer.\nfn cube = (pos, scale) => {\n sg = startSketchOn('XY')\n |> startProfileAt(pos, %)\n |> line([0, scale], %)\n |> line([scale, 0], %)\n |> line([0, -scale], %)\n\n return sg\n}\n\npart001 = cube([0, 0], 20)\n |> close(%, $line1)\n |> extrude(20, %)\n |> chamfer({\n length: 10,\n tags: [getOppositeEdge(line1)]\n }, %, $chamfer1) // We tag the chamfer to reference it later.\n\nsketch001 = startSketchOn(part001, chamfer1)\n |> startProfileAt([10, 10], %)\n |> line([2, 0], %)\n |> line([0, 2], %)\n |> line([-2, 0], %)\n |> lineTo([profileStartX(%), profileStartY(%)], %)\n |> close(%)\n |> extrude(10, %)" "// Sketch on the face of a chamfer.\nfn cube = (pos, scale) => {\n sg = startSketchOn('XY')\n |> startProfileAt(pos, %)\n |> line([0, scale], %)\n |> line([scale, 0], %)\n |> line([0, -scale], %)\n\n return sg\n}\n\npart001 = cube([0, 0], 20)\n |> close(%, $line1)\n |> extrude(20, %)\n |> chamfer({\n length = 10,\n tags = [getOppositeEdge(line1)]\n }, %, $chamfer1) // We tag the chamfer to reference it later.\n\nsketch001 = startSketchOn(part001, chamfer1)\n |> startProfileAt([10, 10], %)\n |> line([2, 0], %)\n |> line([0, 2], %)\n |> line([-2, 0], %)\n |> lineTo([profileStartX(%), profileStartY(%)], %)\n |> close(%)\n |> extrude(10, %)"
] ]
}, },
{ {
@ -53614,8 +53614,8 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"exampleSketch = startSketchOn(\"-XZ\")\n |> circle({ center: [0, 0], radius: 10 }, %)\n\nexample = extrude(5, exampleSketch)", "exampleSketch = startSketchOn(\"-XZ\")\n |> circle({ center = [0, 0], radius = 10 }, %)\n\nexample = extrude(5, exampleSketch)",
"exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([-15, 0], %)\n |> line([30, 0], %)\n |> line([0, 30], %)\n |> line([-30, 0], %)\n |> close(%)\n |> hole(circle({ center: [0, 15], radius: 5 }, %), %)\n\nexample = extrude(5, exampleSketch)" "exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([-15, 0], %)\n |> line([30, 0], %)\n |> line([0, 30], %)\n |> line([-30, 0], %)\n |> close(%)\n |> hole(circle({ center = [0, 15], radius = 5 }, %), %)\n\nexample = extrude(5, exampleSketch)"
] ]
}, },
{ {
@ -57739,7 +57739,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({\n angle: 30,\n length: 3 / cos(toRadians(30))\n }, %)\n |> yLineTo(0, %)\n |> close(%)\n\nexample = extrude(5, exampleSketch)" "exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({\n angle = 30,\n length = 3 / cos(toRadians(30))\n }, %)\n |> yLineTo(0, %)\n |> close(%)\n\nexample = extrude(5, exampleSketch)"
] ]
}, },
{ {
@ -57764,7 +57764,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({ angle: 30, length: 2 * e() ^ 2 }, %)\n |> yLineTo(0, %)\n |> close(%)\n\nexample = extrude(10, exampleSketch)" "exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({ angle = 30, length = 2 * e() ^ 2 }, %)\n |> yLineTo(0, %)\n |> close(%)\n\nexample = extrude(10, exampleSketch)"
] ]
}, },
{ {
@ -60591,8 +60591,8 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"example = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line([10, 0], %)\n |> arc({\n angleStart: 120,\n angleEnd: 0,\n radius: 5\n }, %)\n |> line([5, 0], %)\n |> line([0, 10], %)\n |> bezierCurve({\n control1: [-10, 0],\n control2: [2, 10],\n to: [-5, 10]\n }, %)\n |> line([-5, -2], %)\n |> close(%)\n |> extrude(10, %)", "example = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line([10, 0], %)\n |> arc({\n angleStart = 120,\n angleEnd = 0,\n radius = 5\n }, %)\n |> line([5, 0], %)\n |> line([0, 10], %)\n |> bezierCurve({\n control1 = [-10, 0],\n control2 = [2, 10],\n to = [-5, 10]\n }, %)\n |> line([-5, -2], %)\n |> close(%)\n |> extrude(10, %)",
"exampleSketch = startSketchOn('XZ')\n |> startProfileAt([-10, 0], %)\n |> arc({\n angleStart: 120,\n angleEnd: -60,\n radius: 5\n }, %)\n |> line([10, 0], %)\n |> line([5, 0], %)\n |> bezierCurve({\n control1: [-3, 0],\n control2: [2, 10],\n to: [-5, 10]\n }, %)\n |> line([-4, 10], %)\n |> line([-5, -2], %)\n |> close(%)\n\nexample = extrude(10, exampleSketch)" "exampleSketch = startSketchOn('XZ')\n |> startProfileAt([-10, 0], %)\n |> arc({\n angleStart = 120,\n angleEnd = -60,\n radius = 5\n }, %)\n |> line([10, 0], %)\n |> line([5, 0], %)\n |> bezierCurve({\n control1 = [-3, 0],\n control2 = [2, 10],\n to = [-5, 10]\n }, %)\n |> line([-4, 10], %)\n |> line([-5, -2], %)\n |> close(%)\n\nexample = extrude(10, exampleSketch)"
] ]
}, },
{ {
@ -65628,8 +65628,8 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"width = 20\nlength = 10\nthickness = 1\nfilletRadius = 2\n\nmountingPlateSketch = startSketchOn(\"XY\")\n |> startProfileAt([-width / 2, -length / 2], %)\n |> lineTo([width / 2, -length / 2], %, $edge1)\n |> lineTo([width / 2, length / 2], %, $edge2)\n |> lineTo([-width / 2, length / 2], %, $edge3)\n |> close(%, $edge4)\n\nmountingPlate = extrude(thickness, mountingPlateSketch)\n |> fillet({\n radius: filletRadius,\n tags: [\n getNextAdjacentEdge(edge1),\n getNextAdjacentEdge(edge2),\n getNextAdjacentEdge(edge3),\n getNextAdjacentEdge(edge4)\n ]\n }, %)", "width = 20\nlength = 10\nthickness = 1\nfilletRadius = 2\n\nmountingPlateSketch = startSketchOn(\"XY\")\n |> startProfileAt([-width / 2, -length / 2], %)\n |> lineTo([width / 2, -length / 2], %, $edge1)\n |> lineTo([width / 2, length / 2], %, $edge2)\n |> lineTo([-width / 2, length / 2], %, $edge3)\n |> close(%, $edge4)\n\nmountingPlate = extrude(thickness, mountingPlateSketch)\n |> fillet({\n radius = filletRadius,\n tags = [\n getNextAdjacentEdge(edge1),\n getNextAdjacentEdge(edge2),\n getNextAdjacentEdge(edge3),\n getNextAdjacentEdge(edge4)\n ]\n }, %)",
"width = 20\nlength = 10\nthickness = 1\nfilletRadius = 1\n\nmountingPlateSketch = startSketchOn(\"XY\")\n |> startProfileAt([-width / 2, -length / 2], %)\n |> lineTo([width / 2, -length / 2], %, $edge1)\n |> lineTo([width / 2, length / 2], %, $edge2)\n |> lineTo([-width / 2, length / 2], %, $edge3)\n |> close(%, $edge4)\n\nmountingPlate = extrude(thickness, mountingPlateSketch)\n |> fillet({\n radius: filletRadius,\n tolerance: 0.000001,\n tags: [\n getNextAdjacentEdge(edge1),\n getNextAdjacentEdge(edge2),\n getNextAdjacentEdge(edge3),\n getNextAdjacentEdge(edge4)\n ]\n }, %)" "width = 20\nlength = 10\nthickness = 1\nfilletRadius = 1\n\nmountingPlateSketch = startSketchOn(\"XY\")\n |> startProfileAt([-width / 2, -length / 2], %)\n |> lineTo([width / 2, -length / 2], %, $edge1)\n |> lineTo([width / 2, length / 2], %, $edge2)\n |> lineTo([-width / 2, length / 2], %, $edge3)\n |> close(%, $edge4)\n\nmountingPlate = extrude(thickness, mountingPlateSketch)\n |> fillet({\n radius = filletRadius,\n tolerance = 0.000001,\n tags = [\n getNextAdjacentEdge(edge1),\n getNextAdjacentEdge(edge2),\n getNextAdjacentEdge(edge3),\n getNextAdjacentEdge(edge4)\n ]\n }, %)"
] ]
}, },
{ {
@ -66589,7 +66589,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line([10, 0], %)\n |> angledLine({ angle: 60, length: 10 }, %)\n |> angledLine({ angle: 120, length: 10 }, %)\n |> line([-10, 0], %)\n |> angledLine({ angle: 240, length: 10 }, %, $referenceEdge)\n |> close(%)\n\nexample = extrude(5, exampleSketch)\n |> fillet({\n radius: 3,\n tags: [getNextAdjacentEdge(referenceEdge)]\n }, %)" "exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line([10, 0], %)\n |> angledLine({ angle = 60, length = 10 }, %)\n |> angledLine({ angle = 120, length = 10 }, %)\n |> line([-10, 0], %)\n |> angledLine({ angle = 240, length = 10 }, %, $referenceEdge)\n |> close(%)\n\nexample = extrude(5, exampleSketch)\n |> fillet({\n radius = 3,\n tags = [getNextAdjacentEdge(referenceEdge)]\n }, %)"
] ]
}, },
{ {
@ -67487,7 +67487,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line([10, 0], %)\n |> angledLine({ angle: 60, length: 10 }, %)\n |> angledLine({ angle: 120, length: 10 }, %)\n |> line([-10, 0], %)\n |> angledLine({ angle: 240, length: 10 }, %, $referenceEdge)\n |> close(%)\n\nexample = extrude(5, exampleSketch)\n |> fillet({\n radius: 3,\n tags: [getOppositeEdge(referenceEdge)]\n }, %)" "exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line([10, 0], %)\n |> angledLine({ angle = 60, length = 10 }, %)\n |> angledLine({ angle = 120, length = 10 }, %)\n |> line([-10, 0], %)\n |> angledLine({ angle = 240, length = 10 }, %, $referenceEdge)\n |> close(%)\n\nexample = extrude(5, exampleSketch)\n |> fillet({\n radius = 3,\n tags = [getOppositeEdge(referenceEdge)]\n }, %)"
] ]
}, },
{ {
@ -68385,7 +68385,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line([10, 0], %)\n |> angledLine({ angle: 60, length: 10 }, %)\n |> angledLine({ angle: 120, length: 10 }, %)\n |> line([-10, 0], %)\n |> angledLine({ angle: 240, length: 10 }, %, $referenceEdge)\n |> close(%)\n\nexample = extrude(5, exampleSketch)\n |> fillet({\n radius: 3,\n tags: [getPreviousAdjacentEdge(referenceEdge)]\n }, %)" "exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line([10, 0], %)\n |> angledLine({ angle = 60, length = 10 }, %)\n |> angledLine({ angle = 120, length = 10 }, %)\n |> line([-10, 0], %)\n |> angledLine({ angle = 240, length = 10 }, %, $referenceEdge)\n |> close(%)\n\nexample = extrude(5, exampleSketch)\n |> fillet({\n radius = 3,\n tags = [getPreviousAdjacentEdge(referenceEdge)]\n }, %)"
] ]
}, },
{ {
@ -71184,7 +71184,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"part001 = startSketchOn('XY')\n |> circle({ center: [5, 5], radius: 10 }, %)\n |> extrude(10, %)\n |> helix({\n angleStart: 0,\n ccw: true,\n revolutions: 16\n }, %)" "part001 = startSketchOn('XY')\n |> circle({ center = [5, 5], radius = 10 }, %)\n |> extrude(10, %)\n |> helix({\n angleStart = 0,\n ccw = true,\n revolutions = 16\n }, %)"
] ]
}, },
{ {
@ -75324,8 +75324,8 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"exampleSketch = startSketchOn('XY')\n |> startProfileAt([0, 0], %)\n |> line([0, 5], %)\n |> line([5, 0], %)\n |> line([0, -5], %)\n |> close(%)\n |> hole(circle({ center: [1, 1], radius: .25 }, %), %)\n |> hole(circle({ center: [1, 4], radius: .25 }, %), %)\n\nexample = extrude(1, exampleSketch)", "exampleSketch = startSketchOn('XY')\n |> startProfileAt([0, 0], %)\n |> line([0, 5], %)\n |> line([5, 0], %)\n |> line([0, -5], %)\n |> close(%)\n |> hole(circle({ center = [1, 1], radius = .25 }, %), %)\n |> hole(circle({ center = [1, 4], radius = .25 }, %), %)\n\nexample = extrude(1, exampleSketch)",
"fn squareHoleSketch = () => {\n squareSketch = startSketchOn('-XZ')\n |> startProfileAt([-1, -1], %)\n |> line([2, 0], %)\n |> line([0, 2], %)\n |> line([-2, 0], %)\n |> close(%)\n return squareSketch\n}\n\nexampleSketch = startSketchOn('-XZ')\n |> circle({ center: [0, 0], radius: 3 }, %)\n |> hole(squareHoleSketch(), %)\nexample = extrude(1, exampleSketch)" "fn squareHoleSketch = () => {\n squareSketch = startSketchOn('-XZ')\n |> startProfileAt([-1, -1], %)\n |> line([2, 0], %)\n |> line([0, 2], %)\n |> line([-2, 0], %)\n |> close(%)\n return squareSketch\n}\n\nexampleSketch = startSketchOn('-XZ')\n |> circle({ center = [0, 0], radius = 3 }, %)\n |> hole(squareHoleSketch(), %)\nexample = extrude(1, exampleSketch)"
] ]
}, },
{ {
@ -78099,7 +78099,7 @@
"examples": [ "examples": [
"// Hollow a basic sketch.\nfirstSketch = startSketchOn('XY')\n |> startProfileAt([-12, 12], %)\n |> line([24, 0], %)\n |> line([0, -24], %)\n |> line([-24, 0], %)\n |> close(%)\n |> extrude(6, %)\n |> hollow(0.25, %)", "// Hollow a basic sketch.\nfirstSketch = startSketchOn('XY')\n |> startProfileAt([-12, 12], %)\n |> line([24, 0], %)\n |> line([0, -24], %)\n |> line([-24, 0], %)\n |> close(%)\n |> extrude(6, %)\n |> hollow(0.25, %)",
"// Hollow a basic sketch.\nfirstSketch = startSketchOn('-XZ')\n |> startProfileAt([-12, 12], %)\n |> line([24, 0], %)\n |> line([0, -24], %)\n |> line([-24, 0], %)\n |> close(%)\n |> extrude(6, %)\n |> hollow(0.5, %)", "// Hollow a basic sketch.\nfirstSketch = startSketchOn('-XZ')\n |> startProfileAt([-12, 12], %)\n |> line([24, 0], %)\n |> line([0, -24], %)\n |> line([-24, 0], %)\n |> close(%)\n |> extrude(6, %)\n |> hollow(0.5, %)",
"// Hollow a sketch on face object.\nsize = 100\ncase = startSketchOn('-XZ')\n |> startProfileAt([-size, -size], %)\n |> line([2 * size, 0], %)\n |> line([0, 2 * size], %)\n |> tangentialArcTo([-size, size], %)\n |> close(%)\n |> extrude(65, %)\n\nthing1 = startSketchOn(case, 'end')\n |> circle({\n center: [-size / 2, -size / 2],\n radius: 25\n }, %)\n |> extrude(50, %)\n\nthing2 = startSketchOn(case, 'end')\n |> circle({\n center: [size / 2, -size / 2],\n radius: 25\n }, %)\n |> extrude(50, %)\n\nhollow(0.5, case)" "// Hollow a sketch on face object.\nsize = 100\ncase = startSketchOn('-XZ')\n |> startProfileAt([-size, -size], %)\n |> line([2 * size, 0], %)\n |> line([0, 2 * size], %)\n |> tangentialArcTo([-size, size], %)\n |> close(%)\n |> extrude(65, %)\n\nthing1 = startSketchOn(case, 'end')\n |> circle({\n center = [-size / 2, -size / 2],\n radius = 25\n }, %)\n |> extrude(50, %)\n\nthing2 = startSketchOn(case, 'end')\n |> circle({\n center = [size / 2, -size / 2],\n radius = 25\n }, %)\n |> extrude(50, %)\n\nhollow(0.5, case)"
] ]
}, },
{ {
@ -78506,7 +78506,7 @@
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"model = import(\"tests/inputs/cube.obj\")", "model = import(\"tests/inputs/cube.obj\")",
"model = import(\"tests/inputs/cube.obj\", { format: \"obj\", units: \"m\" })", "model = import(\"tests/inputs/cube.obj\", { format = \"obj\", units = \"m\" })",
"model = import(\"tests/inputs/cube.gltf\")", "model = import(\"tests/inputs/cube.gltf\")",
"model = import(\"tests/inputs/cube.sldprt\")", "model = import(\"tests/inputs/cube.sldprt\")",
"model = import(\"tests/inputs/cube.step\")", "model = import(\"tests/inputs/cube.step\")",
@ -78572,7 +78572,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"n = int(ceil(5 / 2))\nassertEqual(n, 3, 0.0001, \"5/2 = 2.5, rounded up makes 3\")\n// Draw n cylinders.\nstartSketchOn('XZ')\n |> circle({ center: [0, 0], radius: 2 }, %)\n |> extrude(5, %)\n |> patternTransform(n, (id) => {\n return { translate: [4 * id, 0, 0] }\n }, %)" "n = int(ceil(5 / 2))\nassertEqual(n, 3, 0.0001, \"5/2 = 2.5, rounded up makes 3\")\n// Draw n cylinders.\nstartSketchOn('XZ')\n |> circle({ center = [0, 0], radius = 2 }, %)\n |> extrude(5, %)\n |> patternTransform(n, (id) => {\n return { translate = [4 * id, 0, 0] }\n }, %)"
] ]
}, },
{ {
@ -93742,8 +93742,8 @@
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"// Loft a square and a triangle.\nsquareSketch = startSketchOn('XY')\n |> startProfileAt([-100, 200], %)\n |> line([200, 0], %)\n |> line([0, -200], %)\n |> line([-200, 0], %)\n |> lineTo([profileStartX(%), profileStartY(%)], %)\n |> close(%)\n\ntriangleSketch = startSketchOn(offsetPlane('XY', 75))\n |> startProfileAt([0, 125], %)\n |> line([-15, -30], %)\n |> line([30, 0], %)\n |> lineTo([profileStartX(%), profileStartY(%)], %)\n |> close(%)\n\nloft([squareSketch, triangleSketch])", "// Loft a square and a triangle.\nsquareSketch = startSketchOn('XY')\n |> startProfileAt([-100, 200], %)\n |> line([200, 0], %)\n |> line([0, -200], %)\n |> line([-200, 0], %)\n |> lineTo([profileStartX(%), profileStartY(%)], %)\n |> close(%)\n\ntriangleSketch = startSketchOn(offsetPlane('XY', 75))\n |> startProfileAt([0, 125], %)\n |> line([-15, -30], %)\n |> line([30, 0], %)\n |> lineTo([profileStartX(%), profileStartY(%)], %)\n |> close(%)\n\nloft([squareSketch, triangleSketch])",
"// Loft a square, a circle, and another circle.\nsquareSketch = startSketchOn('XY')\n |> startProfileAt([-100, 200], %)\n |> line([200, 0], %)\n |> line([0, -200], %)\n |> line([-200, 0], %)\n |> lineTo([profileStartX(%), profileStartY(%)], %)\n |> close(%)\n\ncircleSketch0 = startSketchOn(offsetPlane('XY', 75))\n |> circle({ center: [0, 100], radius: 50 }, %)\n\ncircleSketch1 = startSketchOn(offsetPlane('XY', 150))\n |> circle({ center: [0, 100], radius: 20 }, %)\n\nloft([\n squareSketch,\n circleSketch0,\n circleSketch1\n])", "// Loft a square, a circle, and another circle.\nsquareSketch = startSketchOn('XY')\n |> startProfileAt([-100, 200], %)\n |> line([200, 0], %)\n |> line([0, -200], %)\n |> line([-200, 0], %)\n |> lineTo([profileStartX(%), profileStartY(%)], %)\n |> close(%)\n\ncircleSketch0 = startSketchOn(offsetPlane('XY', 75))\n |> circle({ center = [0, 100], radius = 50 }, %)\n\ncircleSketch1 = startSketchOn(offsetPlane('XY', 150))\n |> circle({ center = [0, 100], radius = 20 }, %)\n\nloft([\n squareSketch,\n circleSketch0,\n circleSketch1\n])",
"// Loft a square, a circle, and another circle with options.\nsquareSketch = startSketchOn('XY')\n |> startProfileAt([-100, 200], %)\n |> line([200, 0], %)\n |> line([0, -200], %)\n |> line([-200, 0], %)\n |> lineTo([profileStartX(%), profileStartY(%)], %)\n |> close(%)\n\ncircleSketch0 = startSketchOn(offsetPlane('XY', 75))\n |> circle({ center: [0, 100], radius: 50 }, %)\n\ncircleSketch1 = startSketchOn(offsetPlane('XY', 150))\n |> circle({ center: [0, 100], radius: 20 }, %)\n\nloft([\n squareSketch,\n circleSketch0,\n circleSketch1\n], {\n // This can be set to override the automatically determined\n // topological base curve, which is usually the first section encountered.\n baseCurveIndex: 0,\n // Attempt to approximate rational curves (such as arcs) using a bezier.\n // This will remove banding around interpolations between arcs and non-arcs.\n // It may produce errors in other scenarios Over time, this field won't be necessary.\n bezApproximateRational: false,\n // Tolerance for the loft operation.\n tolerance: 0.000001,\n // Degree of the interpolation. Must be greater than zero.\n // For example, use 2 for quadratic, or 3 for cubic interpolation in\n // the V direction. This defaults to 2, if not specified.\n vDegree: 2\n})" "// Loft a square, a circle, and another circle with options.\nsquareSketch = startSketchOn('XY')\n |> startProfileAt([-100, 200], %)\n |> line([200, 0], %)\n |> line([0, -200], %)\n |> line([-200, 0], %)\n |> lineTo([profileStartX(%), profileStartY(%)], %)\n |> close(%)\n\ncircleSketch0 = startSketchOn(offsetPlane('XY', 75))\n |> circle({ center = [0, 100], radius = 50 }, %)\n\ncircleSketch1 = startSketchOn(offsetPlane('XY', 150))\n |> circle({ center = [0, 100], radius = 20 }, %)\n\nloft([\n squareSketch,\n circleSketch0,\n circleSketch1\n], {\n // This can be set to override the automatically determined\n // topological base curve, which is usually the first section encountered.\n baseCurveIndex = 0,\n // Attempt to approximate rational curves (such as arcs) using a bezier.\n // This will remove banding around interpolations between arcs and non-arcs.\n // It may produce errors in other scenarios Over time, this field won't be necessary.\n bezApproximateRational = false,\n // Tolerance for the loft operation.\n tolerance = 0.000001,\n // Degree of the interpolation. Must be greater than zero.\n // For example, use 2 for quadratic, or 3 for cubic interpolation in\n // the V direction. This defaults to 2, if not specified.\n vDegree = 2\n})"
] ]
}, },
{ {
@ -105822,8 +105822,8 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"r = 10 // radius\nfn drawCircle = (id) => {\n return startSketchOn(\"XY\")\n |> circle({ center: [id * 2 * r, 0], radius: r }, %)\n}\n\n// Call `drawCircle`, passing in each element of the array.\n// The outputs from each `drawCircle` form a new array,\n// which is the return value from `map`.\ncircles = map([1..3], drawCircle)", "r = 10 // radius\nfn drawCircle = (id) => {\n return startSketchOn(\"XY\")\n |> circle({ center = [id * 2 * r, 0], radius = r }, %)\n}\n\n// Call `drawCircle`, passing in each element of the array.\n// The outputs from each `drawCircle` form a new array,\n// which is the return value from `map`.\ncircles = map([1..3], drawCircle)",
"r = 10 // radius\n// Call `map`, using an anonymous function instead of a named one.\ncircles = map([1..3], (id) => {\n return startSketchOn(\"XY\")\n |> circle({ center: [id * 2 * r, 0], radius: r }, %)\n})" "r = 10 // radius\n// Call `map`, using an anonymous function instead of a named one.\ncircles = map([1..3], (id) => {\n return startSketchOn(\"XY\")\n |> circle({ center = [id * 2 * r, 0], radius = r }, %)\n})"
] ]
}, },
{ {
@ -105863,7 +105863,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({\n angle: 70,\n length: max(15, 31, 4, 13, 22)\n }, %)\n |> line([20, 0], %)\n |> close(%)\n\nexample = extrude(5, exampleSketch)" "exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({\n angle = 70,\n length = max(15, 31, 4, 13, 22)\n }, %)\n |> line([20, 0], %)\n |> close(%)\n\nexample = extrude(5, exampleSketch)"
] ]
}, },
{ {
@ -105903,7 +105903,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({\n angle: 70,\n length: min(15, 31, 4, 13, 22)\n }, %)\n |> line([20, 0], %)\n |> close(%)\n\nexample = extrude(5, exampleSketch)" "exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({\n angle = 70,\n length = min(15, 31, 4, 13, 22)\n }, %)\n |> line([20, 0], %)\n |> close(%)\n\nexample = extrude(5, exampleSketch)"
] ]
}, },
{ {
@ -109740,10 +109740,10 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"// Mirror an un-closed sketch across the Y axis.\nsketch001 = startSketchOn('XZ')\n |> startProfileAt([0, 10], %)\n |> line([15, 0], %)\n |> line([-7, -3], %)\n |> line([9, -1], %)\n |> line([-8, -5], %)\n |> line([9, -3], %)\n |> line([-8, -3], %)\n |> line([9, -1], %)\n |> line([-19, -0], %)\n |> mirror2d({ axis: 'Y' }, %)\n\nexample = extrude(10, sketch001)", "// Mirror an un-closed sketch across the Y axis.\nsketch001 = startSketchOn('XZ')\n |> startProfileAt([0, 10], %)\n |> line([15, 0], %)\n |> line([-7, -3], %)\n |> line([9, -1], %)\n |> line([-8, -5], %)\n |> line([9, -3], %)\n |> line([-8, -3], %)\n |> line([9, -1], %)\n |> line([-19, -0], %)\n |> mirror2d({ axis = 'Y' }, %)\n\nexample = extrude(10, sketch001)",
"// Mirror a un-closed sketch across the Y axis.\nsketch001 = startSketchOn('XZ')\n |> startProfileAt([0, 8.5], %)\n |> line([20, -8.5], %)\n |> line([-20, -8.5], %)\n |> mirror2d({ axis: 'Y' }, %)\n\nexample = extrude(10, sketch001)", "// Mirror a un-closed sketch across the Y axis.\nsketch001 = startSketchOn('XZ')\n |> startProfileAt([0, 8.5], %)\n |> line([20, -8.5], %)\n |> line([-20, -8.5], %)\n |> mirror2d({ axis = 'Y' }, %)\n\nexample = extrude(10, sketch001)",
"// Mirror a un-closed sketch across an edge.\nhelper001 = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line([0, 10], %, $edge001)\n\nsketch001 = startSketchOn('XZ')\n |> startProfileAt([0, 8.5], %)\n |> line([20, -8.5], %)\n |> line([-20, -8.5], %)\n |> mirror2d({ axis: edge001 }, %)\n\nexample = extrude(10, sketch001)", "// Mirror a un-closed sketch across an edge.\nhelper001 = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line([0, 10], %, $edge001)\n\nsketch001 = startSketchOn('XZ')\n |> startProfileAt([0, 8.5], %)\n |> line([20, -8.5], %)\n |> line([-20, -8.5], %)\n |> mirror2d({ axis = edge001 }, %)\n\nexample = extrude(10, sketch001)",
"// Mirror an un-closed sketch across a custom axis.\nsketch001 = startSketchOn('XZ')\n |> startProfileAt([0, 8.5], %)\n |> line([20, -8.5], %)\n |> line([-20, -8.5], %)\n |> mirror2d({\n axis: {\n custom: { axis: [0.0, 1.0], origin: [0.0, 0.0] }\n }\n }, %)\n\nexample = extrude(10, sketch001)" "// Mirror an un-closed sketch across a custom axis.\nsketch001 = startSketchOn('XZ')\n |> startProfileAt([0, 8.5], %)\n |> line([20, -8.5], %)\n |> line([-20, -8.5], %)\n |> mirror2d({\n axis = {\n custom = {\n axis = [0.0, 1.0],\n origin = [0.0, 0.0]\n }\n }\n }, %)\n\nexample = extrude(10, sketch001)"
] ]
}, },
{ {
@ -109985,11 +109985,11 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"// Loft a square and a circle on the `XY` plane using offset.\nsquareSketch = startSketchOn('XY')\n |> startProfileAt([-100, 200], %)\n |> line([200, 0], %)\n |> line([0, -200], %)\n |> line([-200, 0], %)\n |> lineTo([profileStartX(%), profileStartY(%)], %)\n |> close(%)\n\ncircleSketch = startSketchOn(offsetPlane('XY', 150))\n |> circle({ center: [0, 100], radius: 50 }, %)\n\nloft([squareSketch, circleSketch])", "// Loft a square and a circle on the `XY` plane using offset.\nsquareSketch = startSketchOn('XY')\n |> startProfileAt([-100, 200], %)\n |> line([200, 0], %)\n |> line([0, -200], %)\n |> line([-200, 0], %)\n |> lineTo([profileStartX(%), profileStartY(%)], %)\n |> close(%)\n\ncircleSketch = startSketchOn(offsetPlane('XY', 150))\n |> circle({ center = [0, 100], radius = 50 }, %)\n\nloft([squareSketch, circleSketch])",
"// Loft a square and a circle on the `XZ` plane using offset.\nsquareSketch = startSketchOn('XZ')\n |> startProfileAt([-100, 200], %)\n |> line([200, 0], %)\n |> line([0, -200], %)\n |> line([-200, 0], %)\n |> lineTo([profileStartX(%), profileStartY(%)], %)\n |> close(%)\n\ncircleSketch = startSketchOn(offsetPlane('XZ', 150))\n |> circle({ center: [0, 100], radius: 50 }, %)\n\nloft([squareSketch, circleSketch])", "// Loft a square and a circle on the `XZ` plane using offset.\nsquareSketch = startSketchOn('XZ')\n |> startProfileAt([-100, 200], %)\n |> line([200, 0], %)\n |> line([0, -200], %)\n |> line([-200, 0], %)\n |> lineTo([profileStartX(%), profileStartY(%)], %)\n |> close(%)\n\ncircleSketch = startSketchOn(offsetPlane('XZ', 150))\n |> circle({ center = [0, 100], radius = 50 }, %)\n\nloft([squareSketch, circleSketch])",
"// Loft a square and a circle on the `YZ` plane using offset.\nsquareSketch = startSketchOn('YZ')\n |> startProfileAt([-100, 200], %)\n |> line([200, 0], %)\n |> line([0, -200], %)\n |> line([-200, 0], %)\n |> lineTo([profileStartX(%), profileStartY(%)], %)\n |> close(%)\n\ncircleSketch = startSketchOn(offsetPlane('YZ', 150))\n |> circle({ center: [0, 100], radius: 50 }, %)\n\nloft([squareSketch, circleSketch])", "// Loft a square and a circle on the `YZ` plane using offset.\nsquareSketch = startSketchOn('YZ')\n |> startProfileAt([-100, 200], %)\n |> line([200, 0], %)\n |> line([0, -200], %)\n |> line([-200, 0], %)\n |> lineTo([profileStartX(%), profileStartY(%)], %)\n |> close(%)\n\ncircleSketch = startSketchOn(offsetPlane('YZ', 150))\n |> circle({ center = [0, 100], radius = 50 }, %)\n\nloft([squareSketch, circleSketch])",
"// Loft a square and a circle on the `-XZ` plane using offset.\nsquareSketch = startSketchOn('-XZ')\n |> startProfileAt([-100, 200], %)\n |> line([200, 0], %)\n |> line([0, -200], %)\n |> line([-200, 0], %)\n |> lineTo([profileStartX(%), profileStartY(%)], %)\n |> close(%)\n\ncircleSketch = startSketchOn(offsetPlane('-XZ', -150))\n |> circle({ center: [0, 100], radius: 50 }, %)\n\nloft([squareSketch, circleSketch])", "// Loft a square and a circle on the `-XZ` plane using offset.\nsquareSketch = startSketchOn('-XZ')\n |> startProfileAt([-100, 200], %)\n |> line([200, 0], %)\n |> line([0, -200], %)\n |> line([-200, 0], %)\n |> lineTo([profileStartX(%), profileStartY(%)], %)\n |> close(%)\n\ncircleSketch = startSketchOn(offsetPlane('-XZ', -150))\n |> circle({ center = [0, 100], radius = 50 }, %)\n\nloft([squareSketch, circleSketch])",
"// A circle on the XY plane\nstartSketchOn(\"XY\")\n |> startProfileAt([0, 0], %)\n |> circle({ radius: 10, center: [0, 0] }, %)\n\n// Triangle on the plane 4 units above\nstartSketchOn(offsetPlane(\"XY\", 4))\n |> startProfileAt([0, 0], %)\n |> line([10, 0], %)\n |> line([0, 10], %)\n |> close(%)" "// A circle on the XY plane\nstartSketchOn(\"XY\")\n |> startProfileAt([0, 0], %)\n |> circle({ radius = 10, center = [0, 0] }, %)\n\n// Triangle on the plane 4 units above\nstartSketchOn(offsetPlane(\"XY\", 4))\n |> startProfileAt([0, 0], %)\n |> line([10, 0], %)\n |> line([0, 10], %)\n |> close(%)"
] ]
}, },
{ {
@ -112773,7 +112773,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"exampleSketch = startSketchOn('XZ')\n |> startProfileAt([.5, 25], %)\n |> line([0, 5], %)\n |> line([-1, 0], %)\n |> line([0, -5], %)\n |> close(%)\n |> patternCircular2d({\n center: [0, 0],\n instances: 13,\n arcDegrees: 360,\n rotateDuplicates: true\n }, %)\n\nexample = extrude(1, exampleSketch)" "exampleSketch = startSketchOn('XZ')\n |> startProfileAt([.5, 25], %)\n |> line([0, 5], %)\n |> line([-1, 0], %)\n |> line([0, -5], %)\n |> close(%)\n |> patternCircular2d({\n center = [0, 0],\n instances = 13,\n arcDegrees = 360,\n rotateDuplicates = true\n }, %)\n\nexample = extrude(1, exampleSketch)"
] ]
}, },
{ {
@ -115577,7 +115577,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"exampleSketch = startSketchOn('XZ')\n |> circle({ center: [0, 0], radius: 1 }, %)\n\nexample = extrude(-5, exampleSketch)\n |> patternCircular3d({\n axis: [1, -1, 0],\n center: [10, -20, 0],\n instances: 11,\n arcDegrees: 360,\n rotateDuplicates: true\n }, %)" "exampleSketch = startSketchOn('XZ')\n |> circle({ center = [0, 0], radius = 1 }, %)\n\nexample = extrude(-5, exampleSketch)\n |> patternCircular3d({\n axis = [1, -1, 0],\n center = [10, -20, 0],\n instances = 11,\n arcDegrees = 360,\n rotateDuplicates = true\n }, %)"
] ]
}, },
{ {
@ -118356,7 +118356,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"exampleSketch = startSketchOn('XZ')\n |> circle({ center: [0, 0], radius: 1 }, %)\n |> patternLinear2d({\n axis: [1, 0],\n instances: 7,\n distance: 4\n }, %)\n\nexample = extrude(1, exampleSketch)" "exampleSketch = startSketchOn('XZ')\n |> circle({ center = [0, 0], radius = 1 }, %)\n |> patternLinear2d({\n axis = [1, 0],\n instances = 7,\n distance = 4\n }, %)\n\nexample = extrude(1, exampleSketch)"
] ]
}, },
{ {
@ -121144,7 +121144,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line([0, 2], %)\n |> line([3, 1], %)\n |> line([0, -4], %)\n |> close(%)\n\nexample = extrude(1, exampleSketch)\n |> patternLinear3d({\n axis: [1, 0, 1],\n instances: 7,\n distance: 6\n }, %)" "exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line([0, 2], %)\n |> line([3, 1], %)\n |> line([0, -4], %)\n |> close(%)\n\nexample = extrude(1, exampleSketch)\n |> patternLinear3d({\n axis = [1, 0, 1],\n instances = 7,\n distance = 6\n }, %)"
] ]
}, },
{ {
@ -123901,12 +123901,12 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"// Each instance will be shifted along the X axis.\nfn transform = (id) => {\n return { translate: [4 * id, 0, 0] }\n}\n\n// Sketch 4 cylinders.\nsketch001 = startSketchOn('XZ')\n |> circle({ center: [0, 0], radius: 2 }, %)\n |> extrude(5, %)\n |> patternTransform(4, transform, %)", "// Each instance will be shifted along the X axis.\nfn transform = (id) => {\n return { translate = [4 * id, 0, 0] }\n}\n\n// Sketch 4 cylinders.\nsketch001 = startSketchOn('XZ')\n |> circle({ center = [0, 0], radius = 2 }, %)\n |> extrude(5, %)\n |> patternTransform(4, transform, %)",
"// Each instance will be shifted along the X axis,\n// with a gap between the original (at x = 0) and the first replica\n// (at x = 8). This is because `id` starts at 1.\nfn transform = (id) => {\n return { translate: [4 * (1 + id), 0, 0] }\n}\n\nsketch001 = startSketchOn('XZ')\n |> circle({ center: [0, 0], radius: 2 }, %)\n |> extrude(5, %)\n |> patternTransform(4, transform, %)", "// Each instance will be shifted along the X axis,\n// with a gap between the original (at x = 0) and the first replica\n// (at x = 8). This is because `id` starts at 1.\nfn transform = (id) => {\n return { translate = [4 * (1 + id), 0, 0] }\n}\n\nsketch001 = startSketchOn('XZ')\n |> circle({ center = [0, 0], radius = 2 }, %)\n |> extrude(5, %)\n |> patternTransform(4, transform, %)",
"fn cube = (length, center) => {\n l = length / 2\n x = center[0]\n y = center[1]\n p0 = [-l + x, -l + y]\n p1 = [-l + x, l + y]\n p2 = [l + x, l + y]\n p3 = [l + x, -l + y]\n\n return startSketchAt(p0)\n |> lineTo(p1, %)\n |> lineTo(p2, %)\n |> lineTo(p3, %)\n |> lineTo(p0, %)\n |> close(%)\n |> extrude(length, %)\n}\n\nwidth = 20\nfn transform = (i) => {\n return {\n // Move down each time.\n translate: [0, 0, -i * width],\n // Make the cube longer, wider and flatter each time.\n scale: [pow(1.1, i), pow(1.1, i), pow(0.9, i)],\n // Turn by 15 degrees each time.\n rotation: { angle: 15 * i, origin: \"local\" }\n }\n}\n\nmyCubes = cube(width, [100, 0])\n |> patternTransform(25, transform, %)", "fn cube = (length, center) => {\n l = length / 2\n x = center[0]\n y = center[1]\n p0 = [-l + x, -l + y]\n p1 = [-l + x, l + y]\n p2 = [l + x, l + y]\n p3 = [l + x, -l + y]\n\n return startSketchAt(p0)\n |> lineTo(p1, %)\n |> lineTo(p2, %)\n |> lineTo(p3, %)\n |> lineTo(p0, %)\n |> close(%)\n |> extrude(length, %)\n}\n\nwidth = 20\nfn transform = (i) => {\n return {\n // Move down each time.\n translate = [0, 0, -i * width],\n // Make the cube longer, wider and flatter each time.\n scale = [pow(1.1, i), pow(1.1, i), pow(0.9, i)],\n // Turn by 15 degrees each time.\n rotation = { angle = 15 * i, origin = \"local\" }\n }\n}\n\nmyCubes = cube(width, [100, 0])\n |> patternTransform(25, transform, %)",
"fn cube = (length, center) => {\n l = length / 2\n x = center[0]\n y = center[1]\n p0 = [-l + x, -l + y]\n p1 = [-l + x, l + y]\n p2 = [l + x, l + y]\n p3 = [l + x, -l + y]\n\n return startSketchAt(p0)\n |> lineTo(p1, %)\n |> lineTo(p2, %)\n |> lineTo(p3, %)\n |> lineTo(p0, %)\n |> close(%)\n |> extrude(length, %)\n}\n\nwidth = 20\nfn transform = (i) => {\n return {\n translate: [0, 0, -i * width],\n rotation: {\n angle: 90 * i,\n // Rotate around the overall scene's origin.\n origin: \"global\"\n }\n }\n}\nmyCubes = cube(width, [100, 100])\n |> patternTransform(4, transform, %)", "fn cube = (length, center) => {\n l = length / 2\n x = center[0]\n y = center[1]\n p0 = [-l + x, -l + y]\n p1 = [-l + x, l + y]\n p2 = [l + x, l + y]\n p3 = [l + x, -l + y]\n\n return startSketchAt(p0)\n |> lineTo(p1, %)\n |> lineTo(p2, %)\n |> lineTo(p3, %)\n |> lineTo(p0, %)\n |> close(%)\n |> extrude(length, %)\n}\n\nwidth = 20\nfn transform = (i) => {\n return {\n translate = [0, 0, -i * width],\n rotation = {\n angle = 90 * i,\n // Rotate around the overall scene's origin.\n origin = \"global\"\n }\n }\n}\nmyCubes = cube(width, [100, 100])\n |> patternTransform(4, transform, %)",
"// Parameters\nr = 50 // base radius\nh = 10 // layer height\nt = 0.005 // taper factor [0-1)\n// Defines how to modify each layer of the vase.\n// Each replica is shifted up the Z axis, and has a smoothly-varying radius\nfn transform = (replicaId) => {\n scale = r * abs(1 - (t * replicaId)) * (5 + cos(replicaId / 8))\n return {\n translate: [0, 0, replicaId * 10],\n scale: [scale, scale, 0]\n }\n}\n// Each layer is just a pretty thin cylinder.\nfn layer = () => {\n return startSketchOn(\"XY\")\n // or some other plane idk\n |> circle({ center: [0, 0], radius: 1 }, %, $tag1)\n |> extrude(h, %)\n}\n// The vase is 100 layers tall.\n// The 100 layers are replica of each other, with a slight transformation applied to each.\nvase = layer()\n |> patternTransform(100, transform, %)", "// Parameters\nr = 50 // base radius\nh = 10 // layer height\nt = 0.005 // taper factor [0-1)\n// Defines how to modify each layer of the vase.\n// Each replica is shifted up the Z axis, and has a smoothly-varying radius\nfn transform = (replicaId) => {\n scale = r * abs(1 - (t * replicaId)) * (5 + cos(replicaId / 8))\n return {\n translate = [0, 0, replicaId * 10],\n scale = [scale, scale, 0]\n }\n}\n// Each layer is just a pretty thin cylinder.\nfn layer = () => {\n return startSketchOn(\"XY\")\n // or some other plane idk\n |> circle({ center = [0, 0], radius = 1 }, %, $tag1)\n |> extrude(h, %)\n}\n// The vase is 100 layers tall.\n// The 100 layers are replica of each other, with a slight transformation applied to each.\nvase = layer()\n |> patternTransform(100, transform, %)",
"fn transform = (i) => {\n // Transform functions can return multiple transforms. They'll be applied in order.\n return [\n { translate: [30 * i, 0, 0] },\n { rotation: { angle: 45 * i } }\n ]\n}\nstartSketchAt([0, 0])\n |> polygon({\n radius: 10,\n numSides: 4,\n center: [0, 0],\n inscribed: false\n }, %)\n |> extrude(4, %)\n |> patternTransform(3, transform, %)" "fn transform = (i) => {\n // Transform functions can return multiple transforms. They'll be applied in order.\n return [\n { translate = [30 * i, 0, 0] },\n { rotation = { angle = 45 * i } }\n ]\n}\nstartSketchAt([0, 0])\n |> polygon({\n radius = 10,\n numSides = 4,\n center = [0, 0],\n inscribed = false\n }, %)\n |> extrude(4, %)\n |> patternTransform(3, transform, %)"
] ]
}, },
{ {
@ -126654,7 +126654,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"// Each instance will be shifted along the X axis.\nfn transform = (id) => {\n return { translate: [4 * id, 0] }\n}\n\n// Sketch 4 circles.\nsketch001 = startSketchOn('XZ')\n |> circle({ center: [0, 0], radius: 2 }, %)\n |> patternTransform2d(4, transform, %)" "// Each instance will be shifted along the X axis.\nfn transform = (id) => {\n return { translate = [4 * id, 0] }\n}\n\n// Sketch 4 circles.\nsketch001 = startSketchOn('XZ')\n |> circle({ center = [0, 0], radius = 2 }, %)\n |> patternTransform2d(4, transform, %)"
] ]
}, },
{ {
@ -126679,7 +126679,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"circumference = 70\n\nexampleSketch = startSketchOn(\"XZ\")\n |> circle({\n center: [0, 0],\n radius: circumference / (2 * pi())\n }, %)\n\nexample = extrude(5, exampleSketch)" "circumference = 70\n\nexampleSketch = startSketchOn(\"XZ\")\n |> circle({\n center = [0, 0],\n radius = circumference / (2 * pi())\n }, %)\n\nexample = extrude(5, exampleSketch)"
] ]
}, },
{ {
@ -126735,7 +126735,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line(polar({ angle: 30, length: 5 }), %, $thing)\n |> line([0, 5], %)\n |> line([segEndX(thing), 0], %)\n |> line([-20, 10], %)\n |> close(%)\n\nexample = extrude(5, exampleSketch)" "exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line(polar({ angle = 30, length = 5 }), %, $thing)\n |> line([0, 5], %)\n |> line([segEndX(thing), 0], %)\n |> line([-20, 10], %)\n |> close(%)\n\nexample = extrude(5, exampleSketch)"
] ]
}, },
{ {
@ -130796,8 +130796,8 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"// Create a regular hexagon inscribed in a circle of radius 10\nhex = startSketchOn('XY')\n |> polygon({\n radius: 10,\n numSides: 6,\n center: [0, 0],\n inscribed: true\n }, %)\n\nexample = extrude(5, hex)", "// Create a regular hexagon inscribed in a circle of radius 10\nhex = startSketchOn('XY')\n |> polygon({\n radius = 10,\n numSides = 6,\n center = [0, 0],\n inscribed = true\n }, %)\n\nexample = extrude(5, hex)",
"// Create a square circumscribed around a circle of radius 5\nsquare = startSketchOn('XY')\n |> polygon({\n radius: 5.0,\n numSides: 4,\n center: [10, 10],\n inscribed: false\n }, %)\nexample = extrude(5, square)" "// Create a square circumscribed around a circle of radius 5\nsquare = startSketchOn('XY')\n |> polygon({\n radius = 5.0,\n numSides = 4,\n center = [10, 10],\n inscribed = false\n }, %)\nexample = extrude(5, square)"
] ]
}, },
{ {
@ -130845,7 +130845,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({ angle: 50, length: pow(5, 2) }, %)\n |> yLineTo(0, %)\n |> close(%)\n\nexample = extrude(5, exampleSketch)" "exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({ angle = 50, length = pow(5, 2) }, %)\n |> yLineTo(0, %)\n |> close(%)\n\nexample = extrude(5, exampleSketch)"
] ]
}, },
{ {
@ -132239,7 +132239,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"sketch001 = startSketchOn('XY')\n |> startProfileAt([5, 2], %)\n |> angledLine({ angle: 120, length: 50 }, %, $seg01)\n |> angledLine({\n angle: segAng(seg01) + 120,\n length: 50\n }, %)\n |> lineTo(profileStart(%), %)\n |> close(%)\n |> extrude(20, %)" "sketch001 = startSketchOn('XY')\n |> startProfileAt([5, 2], %)\n |> angledLine({ angle = 120, length = 50 }, %, $seg01)\n |> angledLine({\n angle = segAng(seg01) + 120,\n length = 50\n }, %)\n |> lineTo(profileStart(%), %)\n |> close(%)\n |> extrude(20, %)"
] ]
}, },
{ {
@ -133628,7 +133628,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"sketch001 = startSketchOn('XY')\n |> startProfileAt([5, 2], %)\n |> angledLine([-26.6, 50], %)\n |> angledLine([90, 50], %)\n |> angledLineToX({ angle: 30, to: profileStartX(%) }, %)" "sketch001 = startSketchOn('XY')\n |> startProfileAt([5, 2], %)\n |> angledLine([-26.6, 50], %)\n |> angledLine([90, 50], %)\n |> angledLineToX({ angle = 30, to = profileStartX(%) }, %)"
] ]
}, },
{ {
@ -135017,7 +135017,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"sketch001 = startSketchOn('XY')\n |> startProfileAt([5, 2], %)\n |> angledLine({ angle: -60, length: 14 }, %)\n |> angledLineToY({ angle: 30, to: profileStartY(%) }, %)" "sketch001 = startSketchOn('XY')\n |> startProfileAt([5, 2], %)\n |> angledLine({ angle = -60, length = 14 }, %)\n |> angledLineToY({ angle = 30, to = profileStartY(%) }, %)"
] ]
}, },
{ {
@ -169239,14 +169239,14 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"part001 = startSketchOn('XY')\n |> startProfileAt([4, 12], %)\n |> line([2, 0], %)\n |> line([0, -6], %)\n |> line([4, -6], %)\n |> line([0, -6], %)\n |> line([-3.75, -4.5], %)\n |> line([0, -5.5], %)\n |> line([-2, 0], %)\n |> close(%)\n |> revolve({ axis: 'y' }, %) // default angle is 360", "part001 = startSketchOn('XY')\n |> startProfileAt([4, 12], %)\n |> line([2, 0], %)\n |> line([0, -6], %)\n |> line([4, -6], %)\n |> line([0, -6], %)\n |> line([-3.75, -4.5], %)\n |> line([0, -5.5], %)\n |> line([-2, 0], %)\n |> close(%)\n |> revolve({ axis = 'y' }, %) // default angle is 360",
"// A donut shape.\nsketch001 = startSketchOn('XY')\n |> circle({ center: [15, 0], radius: 5 }, %)\n |> revolve({ angle: 360, axis: 'y' }, %)", "// A donut shape.\nsketch001 = startSketchOn('XY')\n |> circle({ center = [15, 0], radius = 5 }, %)\n |> revolve({ angle = 360, axis = 'y' }, %)",
"part001 = startSketchOn('XY')\n |> startProfileAt([4, 12], %)\n |> line([2, 0], %)\n |> line([0, -6], %)\n |> line([4, -6], %)\n |> line([0, -6], %)\n |> line([-3.75, -4.5], %)\n |> line([0, -5.5], %)\n |> line([-2, 0], %)\n |> close(%)\n |> revolve({ axis: 'y', angle: 180 }, %)", "part001 = startSketchOn('XY')\n |> startProfileAt([4, 12], %)\n |> line([2, 0], %)\n |> line([0, -6], %)\n |> line([4, -6], %)\n |> line([0, -6], %)\n |> line([-3.75, -4.5], %)\n |> line([0, -5.5], %)\n |> line([-2, 0], %)\n |> close(%)\n |> revolve({ axis = 'y', angle = 180 }, %)",
"part001 = startSketchOn('XY')\n |> startProfileAt([4, 12], %)\n |> line([2, 0], %)\n |> line([0, -6], %)\n |> line([4, -6], %)\n |> line([0, -6], %)\n |> line([-3.75, -4.5], %)\n |> line([0, -5.5], %)\n |> line([-2, 0], %)\n |> close(%)\n |> revolve({ axis: 'y', angle: 180 }, %)\npart002 = startSketchOn(part001, 'end')\n |> startProfileAt([4.5, -5], %)\n |> line([0, 5], %)\n |> line([5, 0], %)\n |> line([0, -5], %)\n |> close(%)\n |> extrude(5, %)", "part001 = startSketchOn('XY')\n |> startProfileAt([4, 12], %)\n |> line([2, 0], %)\n |> line([0, -6], %)\n |> line([4, -6], %)\n |> line([0, -6], %)\n |> line([-3.75, -4.5], %)\n |> line([0, -5.5], %)\n |> line([-2, 0], %)\n |> close(%)\n |> revolve({ axis = 'y', angle = 180 }, %)\npart002 = startSketchOn(part001, 'end')\n |> startProfileAt([4.5, -5], %)\n |> line([0, 5], %)\n |> line([5, 0], %)\n |> line([0, -5], %)\n |> close(%)\n |> extrude(5, %)",
"box = startSketchOn('XY')\n |> startProfileAt([0, 0], %)\n |> line([0, 20], %)\n |> line([20, 0], %)\n |> line([0, -20], %)\n |> close(%)\n |> extrude(20, %)\n\nsketch001 = startSketchOn(box, \"END\")\n |> circle({ center: [10, 10], radius: 4 }, %)\n |> revolve({ angle: -90, axis: 'y' }, %)", "box = startSketchOn('XY')\n |> startProfileAt([0, 0], %)\n |> line([0, 20], %)\n |> line([20, 0], %)\n |> line([0, -20], %)\n |> close(%)\n |> extrude(20, %)\n\nsketch001 = startSketchOn(box, \"END\")\n |> circle({ center = [10, 10], radius = 4 }, %)\n |> revolve({ angle = -90, axis = 'y' }, %)",
"box = startSketchOn('XY')\n |> startProfileAt([0, 0], %)\n |> line([0, 20], %)\n |> line([20, 0], %)\n |> line([0, -20], %, $revolveAxis)\n |> close(%)\n |> extrude(20, %)\n\nsketch001 = startSketchOn(box, \"END\")\n |> circle({ center: [10, 10], radius: 4 }, %)\n |> revolve({\n angle: 90,\n axis: getOppositeEdge(revolveAxis)\n }, %)", "box = startSketchOn('XY')\n |> startProfileAt([0, 0], %)\n |> line([0, 20], %)\n |> line([20, 0], %)\n |> line([0, -20], %, $revolveAxis)\n |> close(%)\n |> extrude(20, %)\n\nsketch001 = startSketchOn(box, \"END\")\n |> circle({ center = [10, 10], radius = 4 }, %)\n |> revolve({\n angle = 90,\n axis = getOppositeEdge(revolveAxis)\n }, %)",
"box = startSketchOn('XY')\n |> startProfileAt([0, 0], %)\n |> line([0, 20], %)\n |> line([20, 0], %)\n |> line([0, -20], %, $revolveAxis)\n |> close(%)\n |> extrude(20, %)\n\nsketch001 = startSketchOn(box, \"END\")\n |> circle({ center: [10, 10], radius: 4 }, %)\n |> revolve({\n angle: 90,\n axis: getOppositeEdge(revolveAxis),\n tolerance: 0.0001\n }, %)", "box = startSketchOn('XY')\n |> startProfileAt([0, 0], %)\n |> line([0, 20], %)\n |> line([20, 0], %)\n |> line([0, -20], %, $revolveAxis)\n |> close(%)\n |> extrude(20, %)\n\nsketch001 = startSketchOn(box, \"END\")\n |> circle({ center = [10, 10], radius = 4 }, %)\n |> revolve({\n angle = 90,\n axis = getOppositeEdge(revolveAxis),\n tolerance = 0.0001\n }, %)",
"sketch001 = startSketchOn('XY')\n |> startProfileAt([10, 0], %)\n |> line([5, -5], %)\n |> line([5, 5], %)\n |> lineTo([profileStartX(%), profileStartY(%)], %)\n |> close(%)\n\npart001 = revolve({\n axis: {\n custom: { axis: [0.0, 1.0], origin: [0.0, 0.0] }\n }\n}, sketch001)" "sketch001 = startSketchOn('XY')\n |> startProfileAt([10, 0], %)\n |> line([5, -5], %)\n |> line([5, 5], %)\n |> lineTo([profileStartX(%), profileStartY(%)], %)\n |> close(%)\n\npart001 = revolve({\n axis = {\n custom = {\n axis = [0.0, 1.0],\n origin = [0.0, 0.0]\n }\n }\n}, sketch001)"
] ]
}, },
{ {
@ -171047,7 +171047,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"w = 15\ncube = startSketchAt([0, 0])\n |> line([w, 0], %, $line1)\n |> line([0, w], %, $line2)\n |> line([-w, 0], %, $line3)\n |> line([0, -w], %, $line4)\n |> close(%)\n |> extrude(5, %)\n\nfn cylinder = (radius, tag) => {\n return startSketchAt([0, 0])\n |> circle({ radius: radius, center: segEnd(tag) }, %)\n |> extrude(radius, %)\n}\n\ncylinder(1, line1)\ncylinder(2, line2)\ncylinder(3, line3)\ncylinder(4, line4)" "w = 15\ncube = startSketchAt([0, 0])\n |> line([w, 0], %, $line1)\n |> line([0, w], %, $line2)\n |> line([-w, 0], %, $line3)\n |> line([0, -w], %, $line4)\n |> close(%)\n |> extrude(5, %)\n\nfn cylinder = (radius, tag) => {\n return startSketchAt([0, 0])\n |> circle({\n radius = radius,\n center = segEnd(tag)\n }, %)\n |> extrude(radius, %)\n}\n\ncylinder(1, line1)\ncylinder(2, line2)\ncylinder(3, line3)\ncylinder(4, line4)"
] ]
}, },
{ {
@ -173741,7 +173741,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({ angle: 60, length: 10 }, %, $thing)\n |> tangentialArc({ offset: -120, radius: 5 }, %)\n |> angledLine({ angle: -60, length: segLen(thing) }, %)\n |> close(%)\n\nexample = extrude(5, exampleSketch)" "exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({ angle = 60, length = 10 }, %, $thing)\n |> tangentialArc({ offset = -120, radius = 5 }, %)\n |> angledLine({ angle = -60, length = segLen(thing) }, %)\n |> close(%)\n\nexample = extrude(5, exampleSketch)"
] ]
}, },
{ {
@ -174644,7 +174644,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"w = 15\ncube = startSketchAt([0, 0])\n |> line([w, 0], %, $line1)\n |> line([0, w], %, $line2)\n |> line([-w, 0], %, $line3)\n |> line([0, -w], %, $line4)\n |> close(%)\n |> extrude(5, %)\n\nfn cylinder = (radius, tag) => {\n return startSketchAt([0, 0])\n |> circle({\n radius: radius,\n center: segStart(tag)\n }, %)\n |> extrude(radius, %)\n}\n\ncylinder(1, line1)\ncylinder(2, line2)\ncylinder(3, line3)\ncylinder(4, line4)" "w = 15\ncube = startSketchAt([0, 0])\n |> line([w, 0], %, $line1)\n |> line([0, w], %, $line2)\n |> line([-w, 0], %, $line3)\n |> line([0, -w], %, $line4)\n |> close(%)\n |> extrude(5, %)\n\nfn cylinder = (radius, tag) => {\n return startSketchAt([0, 0])\n |> circle({\n radius = radius,\n center = segStart(tag)\n }, %)\n |> extrude(radius, %)\n}\n\ncylinder(1, line1)\ncylinder(2, line2)\ncylinder(3, line3)\ncylinder(4, line4)"
] ]
}, },
{ {
@ -180229,13 +180229,13 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"// Remove the end face for the extrusion.\nfirstSketch = startSketchOn('XY')\n |> startProfileAt([-12, 12], %)\n |> line([24, 0], %)\n |> line([0, -24], %)\n |> line([-24, 0], %)\n |> close(%)\n |> extrude(6, %)\n\n// Remove the end face for the extrusion.\nshell({ faces: ['end'], thickness: 0.25 }, firstSketch)", "// Remove the end face for the extrusion.\nfirstSketch = startSketchOn('XY')\n |> startProfileAt([-12, 12], %)\n |> line([24, 0], %)\n |> line([0, -24], %)\n |> line([-24, 0], %)\n |> close(%)\n |> extrude(6, %)\n\n// Remove the end face for the extrusion.\nshell({ faces = ['end'], thickness = 0.25 }, firstSketch)",
"// Remove the start face for the extrusion.\nfirstSketch = startSketchOn('-XZ')\n |> startProfileAt([-12, 12], %)\n |> line([24, 0], %)\n |> line([0, -24], %)\n |> line([-24, 0], %)\n |> close(%)\n |> extrude(6, %)\n\n// Remove the start face for the extrusion.\nshell({ faces: ['start'], thickness: 0.25 }, firstSketch)", "// Remove the start face for the extrusion.\nfirstSketch = startSketchOn('-XZ')\n |> startProfileAt([-12, 12], %)\n |> line([24, 0], %)\n |> line([0, -24], %)\n |> line([-24, 0], %)\n |> close(%)\n |> extrude(6, %)\n\n// Remove the start face for the extrusion.\nshell({ faces = ['start'], thickness = 0.25 }, firstSketch)",
"// Remove a tagged face and the end face for the extrusion.\nfirstSketch = startSketchOn('XY')\n |> startProfileAt([-12, 12], %)\n |> line([24, 0], %)\n |> line([0, -24], %)\n |> line([-24, 0], %, $myTag)\n |> close(%)\n |> extrude(6, %)\n\n// Remove a tagged face for the extrusion.\nshell({ faces: [myTag], thickness: 0.25 }, firstSketch)", "// Remove a tagged face and the end face for the extrusion.\nfirstSketch = startSketchOn('XY')\n |> startProfileAt([-12, 12], %)\n |> line([24, 0], %)\n |> line([0, -24], %)\n |> line([-24, 0], %, $myTag)\n |> close(%)\n |> extrude(6, %)\n\n// Remove a tagged face for the extrusion.\nshell({ faces = [myTag], thickness = 0.25 }, firstSketch)",
"// Remove multiple faces at once.\nfirstSketch = startSketchOn('XY')\n |> startProfileAt([-12, 12], %)\n |> line([24, 0], %)\n |> line([0, -24], %)\n |> line([-24, 0], %, $myTag)\n |> close(%)\n |> extrude(6, %)\n\n// Remove a tagged face and the end face for the extrusion.\nshell({\n faces: [myTag, 'end'],\n thickness: 0.25\n}, firstSketch)", "// Remove multiple faces at once.\nfirstSketch = startSketchOn('XY')\n |> startProfileAt([-12, 12], %)\n |> line([24, 0], %)\n |> line([0, -24], %)\n |> line([-24, 0], %, $myTag)\n |> close(%)\n |> extrude(6, %)\n\n// Remove a tagged face and the end face for the extrusion.\nshell({\n faces = [myTag, 'end'],\n thickness = 0.25\n}, firstSketch)",
"// Shell a sketch on face.\nsize = 100\ncase = startSketchOn('-XZ')\n |> startProfileAt([-size, -size], %)\n |> line([2 * size, 0], %)\n |> line([0, 2 * size], %)\n |> tangentialArcTo([-size, size], %)\n |> close(%)\n |> extrude(65, %)\n\nthing1 = startSketchOn(case, 'end')\n |> circle({\n center: [-size / 2, -size / 2],\n radius: 25\n }, %)\n |> extrude(50, %)\n\nthing2 = startSketchOn(case, 'end')\n |> circle({\n center: [size / 2, -size / 2],\n radius: 25\n }, %)\n |> extrude(50, %)\n\n// We put \"case\" in the shell function to shell the entire object.\nshell({ faces: ['start'], thickness: 5 }, case)", "// Shell a sketch on face.\nsize = 100\ncase = startSketchOn('-XZ')\n |> startProfileAt([-size, -size], %)\n |> line([2 * size, 0], %)\n |> line([0, 2 * size], %)\n |> tangentialArcTo([-size, size], %)\n |> close(%)\n |> extrude(65, %)\n\nthing1 = startSketchOn(case, 'end')\n |> circle({\n center = [-size / 2, -size / 2],\n radius = 25\n }, %)\n |> extrude(50, %)\n\nthing2 = startSketchOn(case, 'end')\n |> circle({\n center = [size / 2, -size / 2],\n radius = 25\n }, %)\n |> extrude(50, %)\n\n// We put \"case\" in the shell function to shell the entire object.\nshell({ faces = ['start'], thickness = 5 }, case)",
"// Shell a sketch on face object on the end face.\nsize = 100\ncase = startSketchOn('XY')\n |> startProfileAt([-size, -size], %)\n |> line([2 * size, 0], %)\n |> line([0, 2 * size], %)\n |> tangentialArcTo([-size, size], %)\n |> close(%)\n |> extrude(65, %)\n\nthing1 = startSketchOn(case, 'end')\n |> circle({\n center: [-size / 2, -size / 2],\n radius: 25\n }, %)\n |> extrude(50, %)\n\nthing2 = startSketchOn(case, 'end')\n |> circle({\n center: [size / 2, -size / 2],\n radius: 25\n }, %)\n |> extrude(50, %)\n\n// We put \"thing1\" in the shell function to shell the end face of the object.\nshell({ faces: ['end'], thickness: 5 }, thing1)", "// Shell a sketch on face object on the end face.\nsize = 100\ncase = startSketchOn('XY')\n |> startProfileAt([-size, -size], %)\n |> line([2 * size, 0], %)\n |> line([0, 2 * size], %)\n |> tangentialArcTo([-size, size], %)\n |> close(%)\n |> extrude(65, %)\n\nthing1 = startSketchOn(case, 'end')\n |> circle({\n center = [-size / 2, -size / 2],\n radius = 25\n }, %)\n |> extrude(50, %)\n\nthing2 = startSketchOn(case, 'end')\n |> circle({\n center = [size / 2, -size / 2],\n radius = 25\n }, %)\n |> extrude(50, %)\n\n// We put \"thing1\" in the shell function to shell the end face of the object.\nshell({ faces = ['end'], thickness = 5 }, thing1)",
"// Shell sketched on face objects on the end face, include all sketches to shell\n// the entire object.\n\n\nsize = 100\ncase = startSketchOn('XY')\n |> startProfileAt([-size, -size], %)\n |> line([2 * size, 0], %)\n |> line([0, 2 * size], %)\n |> tangentialArcTo([-size, size], %)\n |> close(%)\n |> extrude(65, %)\n\nthing1 = startSketchOn(case, 'end')\n |> circle({\n center: [-size / 2, -size / 2],\n radius: 25\n }, %)\n |> extrude(50, %)\n\nthing2 = startSketchOn(case, 'end')\n |> circle({\n center: [size / 2, -size / 2],\n radius: 25\n }, %)\n |> extrude(50, %)\n\n// We put \"thing1\" and \"thing2\" in the shell function to shell the end face of the object.\nshell({ faces: ['end'], thickness: 5 }, [thing1, thing2])" "// Shell sketched on face objects on the end face, include all sketches to shell\n// the entire object.\n\n\nsize = 100\ncase = startSketchOn('XY')\n |> startProfileAt([-size, -size], %)\n |> line([2 * size, 0], %)\n |> line([0, 2 * size], %)\n |> tangentialArcTo([-size, size], %)\n |> close(%)\n |> extrude(65, %)\n\nthing1 = startSketchOn(case, 'end')\n |> circle({\n center = [-size / 2, -size / 2],\n radius = 25\n }, %)\n |> extrude(50, %)\n\nthing2 = startSketchOn(case, 'end')\n |> circle({\n center = [size / 2, -size / 2],\n radius = 25\n }, %)\n |> extrude(50, %)\n\n// We put \"thing1\" and \"thing2\" in the shell function to shell the end face of the object.\nshell({ faces = ['end'], thickness = 5 }, [thing1, thing2])"
] ]
}, },
{ {
@ -180272,7 +180272,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({\n angle: 50,\n length: 15 / sin(toDegrees(135))\n }, %)\n |> yLineTo(0, %)\n |> close(%)\n\nexample = extrude(5, exampleSketch)" "exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({\n angle = 50,\n length = 15 / sin(toDegrees(135))\n }, %)\n |> yLineTo(0, %)\n |> close(%)\n\nexample = extrude(5, exampleSketch)"
] ]
}, },
{ {
@ -180309,7 +180309,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({ angle: 50, length: sqrt(2500) }, %)\n |> yLineTo(0, %)\n |> close(%)\n\nexample = extrude(5, exampleSketch)" "exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({ angle = 50, length = sqrt(2500) }, %)\n |> yLineTo(0, %)\n |> close(%)\n\nexample = extrude(5, exampleSketch)"
] ]
}, },
{ {
@ -190336,8 +190336,8 @@
"examples": [ "examples": [
"exampleSketch = startSketchOn(\"XY\")\n |> startProfileAt([0, 0], %)\n |> line([10, 0], %)\n |> line([0, 10], %)\n |> line([-10, 0], %)\n |> close(%)\n\nexample = extrude(5, exampleSketch)\n\nexampleSketch002 = startSketchOn(example, 'end')\n |> startProfileAt([1, 1], %)\n |> line([8, 0], %)\n |> line([0, 8], %)\n |> line([-8, 0], %)\n |> close(%)\n\nexample002 = extrude(5, exampleSketch002)\n\nexampleSketch003 = startSketchOn(example002, 'end')\n |> startProfileAt([2, 2], %)\n |> line([6, 0], %)\n |> line([0, 6], %)\n |> line([-6, 0], %)\n |> close(%)\n\nexample003 = extrude(5, exampleSketch003)", "exampleSketch = startSketchOn(\"XY\")\n |> startProfileAt([0, 0], %)\n |> line([10, 0], %)\n |> line([0, 10], %)\n |> line([-10, 0], %)\n |> close(%)\n\nexample = extrude(5, exampleSketch)\n\nexampleSketch002 = startSketchOn(example, 'end')\n |> startProfileAt([1, 1], %)\n |> line([8, 0], %)\n |> line([0, 8], %)\n |> line([-8, 0], %)\n |> close(%)\n\nexample002 = extrude(5, exampleSketch002)\n\nexampleSketch003 = startSketchOn(example002, 'end')\n |> startProfileAt([2, 2], %)\n |> line([6, 0], %)\n |> line([0, 6], %)\n |> line([-6, 0], %)\n |> close(%)\n\nexample003 = extrude(5, exampleSketch003)",
"exampleSketch = startSketchOn(\"XY\")\n |> startProfileAt([0, 0], %)\n |> line([10, 0], %)\n |> line([0, 10], %, $sketchingFace)\n |> line([-10, 0], %)\n |> close(%)\n\nexample = extrude(10, exampleSketch)\n\nexampleSketch002 = startSketchOn(example, sketchingFace)\n |> startProfileAt([1, 1], %)\n |> line([8, 0], %)\n |> line([0, 8], %)\n |> line([-8, 0], %)\n |> close(%, $sketchingFace002)\n\nexample002 = extrude(10, exampleSketch002)\n\nexampleSketch003 = startSketchOn(example002, sketchingFace002)\n |> startProfileAt([-8, 12], %)\n |> line([0, 6], %)\n |> line([6, 0], %)\n |> line([0, -6], %)\n |> close(%)\n\nexample003 = extrude(5, exampleSketch003)", "exampleSketch = startSketchOn(\"XY\")\n |> startProfileAt([0, 0], %)\n |> line([10, 0], %)\n |> line([0, 10], %, $sketchingFace)\n |> line([-10, 0], %)\n |> close(%)\n\nexample = extrude(10, exampleSketch)\n\nexampleSketch002 = startSketchOn(example, sketchingFace)\n |> startProfileAt([1, 1], %)\n |> line([8, 0], %)\n |> line([0, 8], %)\n |> line([-8, 0], %)\n |> close(%, $sketchingFace002)\n\nexample002 = extrude(10, exampleSketch002)\n\nexampleSketch003 = startSketchOn(example002, sketchingFace002)\n |> startProfileAt([-8, 12], %)\n |> line([0, 6], %)\n |> line([6, 0], %)\n |> line([0, -6], %)\n |> close(%)\n\nexample003 = extrude(5, exampleSketch003)",
"exampleSketch = startSketchOn('XY')\n |> startProfileAt([4, 12], %)\n |> line([2, 0], %)\n |> line([0, -6], %)\n |> line([4, -6], %)\n |> line([0, -6], %)\n |> line([-3.75, -4.5], %)\n |> line([0, -5.5], %)\n |> line([-2, 0], %)\n |> close(%)\n\nexample = revolve({ axis: 'y', angle: 180 }, exampleSketch)\n\nexampleSketch002 = startSketchOn(example, 'end')\n |> startProfileAt([4.5, -5], %)\n |> line([0, 5], %)\n |> line([5, 0], %)\n |> line([0, -5], %)\n |> close(%)\n\nexample002 = extrude(5, exampleSketch002)", "exampleSketch = startSketchOn('XY')\n |> startProfileAt([4, 12], %)\n |> line([2, 0], %)\n |> line([0, -6], %)\n |> line([4, -6], %)\n |> line([0, -6], %)\n |> line([-3.75, -4.5], %)\n |> line([0, -5.5], %)\n |> line([-2, 0], %)\n |> close(%)\n\nexample = revolve({ axis = 'y', angle = 180 }, exampleSketch)\n\nexampleSketch002 = startSketchOn(example, 'end')\n |> startProfileAt([4.5, -5], %)\n |> line([0, 5], %)\n |> line([5, 0], %)\n |> line([0, -5], %)\n |> close(%)\n\nexample002 = extrude(5, exampleSketch002)",
"a1 = startSketchOn({\n plane: {\n origin: { x: 0, y: 0, z: 0 },\n xAxis: { x: 1, y: 0, z: 0 },\n yAxis: { x: 0, y: 1, z: 0 },\n zAxis: { x: 0, y: 0, z: 1 }\n }\n })\n |> startProfileAt([0, 0], %)\n |> line([100.0, 0], %)\n |> yLine(-100.0, %)\n |> xLine(-100.0, %)\n |> yLine(100.0, %)\n |> close(%)\n |> extrude(3.14, %)" "a1 = startSketchOn({\n plane = {\n origin = { x = 0, y = 0, z = 0 },\n xAxis = { x = 1, y = 0, z = 0 },\n yAxis = { x = 0, y = 1, z = 0 },\n zAxis = { x = 0, y = 0, z = 1 }\n }\n })\n |> startProfileAt([0, 0], %)\n |> line([100.0, 0], %)\n |> yLine(-100.0, %)\n |> xLine(-100.0, %)\n |> yLine(100.0, %)\n |> close(%)\n |> extrude(3.14, %)"
] ]
}, },
{ {
@ -190374,7 +190374,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({ angle: 50, length: 50 * tan(1 / 2) }, %)\n |> yLineTo(0, %)\n |> close(%)\n\nexample = extrude(5, exampleSketch)" "exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({ angle = 50, length = 50 * tan(1 / 2) }, %)\n |> yLineTo(0, %)\n |> close(%)\n\nexample = extrude(5, exampleSketch)"
] ]
}, },
{ {
@ -194466,7 +194466,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> angledLine({ angle: 60, length: 10 }, %)\n |> tangentialArc({ radius: 10, offset: -120 }, %)\n |> angledLine({ angle: -60, length: 10 }, %)\n |> close(%)\n\nexample = extrude(10, exampleSketch)" "exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> angledLine({ angle = 60, length = 10 }, %)\n |> tangentialArc({ radius = 10, offset = -120 }, %)\n |> angledLine({ angle = -60, length = 10 }, %)\n |> close(%)\n\nexample = extrude(10, exampleSketch)"
] ]
}, },
{ {
@ -198543,7 +198543,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> angledLine({ angle: 60, length: 10 }, %)\n |> tangentialArcTo([15, 15], %)\n |> line([10, -15], %)\n |> close(%)\n\nexample = extrude(10, exampleSketch)" "exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> angledLine({ angle = 60, length = 10 }, %)\n |> tangentialArcTo([15, 15], %)\n |> line([10, -15], %)\n |> close(%)\n\nexample = extrude(10, exampleSketch)"
] ]
}, },
{ {
@ -202620,7 +202620,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> angledLine({ angle: 45, length: 10 }, %)\n |> tangentialArcToRelative([0, -10], %)\n |> line([-10, 0], %)\n |> close(%)\n\nexample = extrude(10, exampleSketch)" "exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> angledLine({ angle = 45, length = 10 }, %)\n |> tangentialArcToRelative([0, -10], %)\n |> line([-10, 0], %)\n |> close(%)\n\nexample = extrude(10, exampleSketch)"
] ]
}, },
{ {
@ -202645,7 +202645,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({ angle: 50, length: 10 * tau() }, %)\n |> yLineTo(0, %)\n |> close(%)\n\nexample = extrude(5, exampleSketch)" "exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({ angle = 50, length = 10 * tau() }, %)\n |> yLineTo(0, %)\n |> close(%)\n\nexample = extrude(5, exampleSketch)"
] ]
}, },
{ {
@ -202682,7 +202682,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({\n angle: 50,\n length: 70 * cos(toDegrees(pi() / 4))\n }, %)\n |> yLineTo(0, %)\n |> close(%)\n\nexample = extrude(5, exampleSketch)" "exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({\n angle = 50,\n length = 70 * cos(toDegrees(pi() / 4))\n }, %)\n |> yLineTo(0, %)\n |> close(%)\n\nexample = extrude(5, exampleSketch)"
] ]
}, },
{ {
@ -202719,7 +202719,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({\n angle: 50,\n length: 70 * cos(toRadians(45))\n }, %)\n |> yLineTo(0, %)\n |> close(%)\n\nexample = extrude(5, exampleSketch)" "exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({\n angle = 50,\n length = 70 * cos(toRadians(45))\n }, %)\n |> yLineTo(0, %)\n |> close(%)\n\nexample = extrude(5, exampleSketch)"
] ]
}, },
{ {
@ -206791,7 +206791,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> xLine(15, %)\n |> angledLine({ angle: 80, length: 15 }, %)\n |> line([8, -10], %)\n |> xLine(10, %)\n |> angledLine({ angle: 120, length: 30 }, %)\n |> xLine(-15, %)\n |> close(%)\n\nexample = extrude(10, exampleSketch)" "exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> xLine(15, %)\n |> angledLine({ angle = 80, length = 15 }, %)\n |> line([8, -10], %)\n |> xLine(10, %)\n |> angledLine({ angle = 120, length = 30 }, %)\n |> xLine(-15, %)\n |> close(%)\n\nexample = extrude(10, exampleSketch)"
] ]
}, },
{ {
@ -210863,7 +210863,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> xLineTo(15, %)\n |> angledLine({ angle: 80, length: 15 }, %)\n |> line([8, -10], %)\n |> xLineTo(40, %)\n |> angledLine({ angle: 135, length: 30 }, %)\n |> xLineTo(10, %)\n |> close(%)\n\nexample = extrude(10, exampleSketch)" "exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> xLineTo(15, %)\n |> angledLine({ angle = 80, length = 15 }, %)\n |> line([8, -10], %)\n |> xLineTo(40, %)\n |> angledLine({ angle = 135, length = 30 }, %)\n |> xLineTo(10, %)\n |> close(%)\n\nexample = extrude(10, exampleSketch)"
] ]
}, },
{ {
@ -214935,7 +214935,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> yLine(15, %)\n |> angledLine({ angle: 30, length: 15 }, %)\n |> line([8, -10], %)\n |> yLine(-5, %)\n |> close(%)\n\nexample = extrude(10, exampleSketch)" "exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> yLine(15, %)\n |> angledLine({ angle = 30, length = 15 }, %)\n |> line([8, -10], %)\n |> yLine(-5, %)\n |> close(%)\n\nexample = extrude(10, exampleSketch)"
] ]
}, },
{ {
@ -219007,7 +219007,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({ angle: 50, length: 45 }, %)\n |> yLineTo(0, %)\n |> close(%)\n\nexample = extrude(5, exampleSketch)" "exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({ angle = 50, length = 45 }, %)\n |> yLineTo(0, %)\n |> close(%)\n\nexample = extrude(5, exampleSketch)"
] ]
}, },
{ {

View File

@ -33,7 +33,7 @@ tan(num: number) -> number
```js ```js
exampleSketch = startSketchOn("XZ") exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ angle: 50, length: 50 * tan(1 / 2) }, %) |> angledLine({ angle = 50, length = 50 * tan(1 / 2) }, %)
|> yLineTo(0, %) |> yLineTo(0, %)
|> close(%) |> close(%)

View File

@ -31,9 +31,9 @@ tangentialArc(data: TangentialArcData, sketch: Sketch, tag?: TagDeclarator) -> S
```js ```js
exampleSketch = startSketchOn('XZ') exampleSketch = startSketchOn('XZ')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ angle: 60, length: 10 }, %) |> angledLine({ angle = 60, length = 10 }, %)
|> tangentialArc({ radius: 10, offset: -120 }, %) |> tangentialArc({ radius = 10, offset = -120 }, %)
|> angledLine({ angle: -60, length: 10 }, %) |> angledLine({ angle = -60, length = 10 }, %)
|> close(%) |> close(%)
example = extrude(10, exampleSketch) example = extrude(10, exampleSketch)

View File

@ -31,7 +31,7 @@ tangentialArcTo(to: [number], sketch: Sketch, tag?: TagDeclarator) -> Sketch
```js ```js
exampleSketch = startSketchOn('XZ') exampleSketch = startSketchOn('XZ')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ angle: 60, length: 10 }, %) |> angledLine({ angle = 60, length = 10 }, %)
|> tangentialArcTo([15, 15], %) |> tangentialArcTo([15, 15], %)
|> line([10, -15], %) |> line([10, -15], %)
|> close(%) |> close(%)

View File

@ -31,7 +31,7 @@ tangentialArcToRelative(delta: [number], sketch: Sketch, tag?: TagDeclarator) ->
```js ```js
exampleSketch = startSketchOn('XZ') exampleSketch = startSketchOn('XZ')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ angle: 45, length: 10 }, %) |> angledLine({ angle = 45, length = 10 }, %)
|> tangentialArcToRelative([0, -10], %) |> tangentialArcToRelative([0, -10], %)
|> line([-10, 0], %) |> line([-10, 0], %)
|> close(%) |> close(%)

View File

@ -28,7 +28,7 @@ tau() -> number
```js ```js
exampleSketch = startSketchOn("XZ") exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ angle: 50, length: 10 * tau() }, %) |> angledLine({ angle = 50, length = 10 * tau() }, %)
|> yLineTo(0, %) |> yLineTo(0, %)
|> close(%) |> close(%)

View File

@ -34,8 +34,8 @@ toDegrees(num: number) -> number
exampleSketch = startSketchOn("XZ") exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ |> angledLine({
angle: 50, angle = 50,
length: 70 * cos(toDegrees(pi() / 4)) length = 70 * cos(toDegrees(pi() / 4))
}, %) }, %)
|> yLineTo(0, %) |> yLineTo(0, %)
|> close(%) |> close(%)

View File

@ -34,8 +34,8 @@ toRadians(num: number) -> number
exampleSketch = startSketchOn("XZ") exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ |> angledLine({
angle: 50, angle = 50,
length: 70 * cos(toRadians(45)) length = 70 * cos(toRadians(45))
}, %) }, %)
|> yLineTo(0, %) |> yLineTo(0, %)
|> close(%) |> close(%)

View File

@ -32,10 +32,10 @@ xLine(length: number, sketch: Sketch, tag?: TagDeclarator) -> Sketch
exampleSketch = startSketchOn('XZ') exampleSketch = startSketchOn('XZ')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> xLine(15, %) |> xLine(15, %)
|> angledLine({ angle: 80, length: 15 }, %) |> angledLine({ angle = 80, length = 15 }, %)
|> line([8, -10], %) |> line([8, -10], %)
|> xLine(10, %) |> xLine(10, %)
|> angledLine({ angle: 120, length: 30 }, %) |> angledLine({ angle = 120, length = 30 }, %)
|> xLine(-15, %) |> xLine(-15, %)
|> close(%) |> close(%)

View File

@ -32,10 +32,10 @@ xLineTo(to: number, sketch: Sketch, tag?: TagDeclarator) -> Sketch
exampleSketch = startSketchOn('XZ') exampleSketch = startSketchOn('XZ')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> xLineTo(15, %) |> xLineTo(15, %)
|> angledLine({ angle: 80, length: 15 }, %) |> angledLine({ angle = 80, length = 15 }, %)
|> line([8, -10], %) |> line([8, -10], %)
|> xLineTo(40, %) |> xLineTo(40, %)
|> angledLine({ angle: 135, length: 30 }, %) |> angledLine({ angle = 135, length = 30 }, %)
|> xLineTo(10, %) |> xLineTo(10, %)
|> close(%) |> close(%)

View File

@ -32,7 +32,7 @@ yLine(length: number, sketch: Sketch, tag?: TagDeclarator) -> Sketch
exampleSketch = startSketchOn('XZ') exampleSketch = startSketchOn('XZ')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> yLine(15, %) |> yLine(15, %)
|> angledLine({ angle: 30, length: 15 }, %) |> angledLine({ angle = 30, length = 15 }, %)
|> line([8, -10], %) |> line([8, -10], %)
|> yLine(-5, %) |> yLine(-5, %)
|> close(%) |> close(%)

View File

@ -31,7 +31,7 @@ yLineTo(to: number, sketch: Sketch, tag?: TagDeclarator) -> Sketch
```js ```js
exampleSketch = startSketchOn("XZ") exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ angle: 50, length: 45 }, %) |> angledLine({ angle = 50, length = 45 }, %)
|> yLineTo(0, %) |> yLineTo(0, %)
|> close(%) |> close(%)

View File

@ -87,7 +87,7 @@ extrude001 = extrude(-10, sketch001)`
await page.keyboard.press('Enter') // submit await page.keyboard.press('Enter') // submit
await page.waitForTimeout(100) await page.waitForTimeout(100)
await expect(page.locator('.cm-activeLine')).toContainText( await expect(page.locator('.cm-activeLine')).toContainText(
`fillet({ radius: ${KCL_DEFAULT_LENGTH}, tags: [seg01] }, %)` `fillet({ radius = ${KCL_DEFAULT_LENGTH}, tags = [seg01] }, %)`
) )
}) })

View File

@ -568,7 +568,7 @@ test.describe('Editor tests', () => {
await page.keyboard.press('ArrowDown') await page.keyboard.press('ArrowDown')
await page.keyboard.press('Enter') await page.keyboard.press('Enter')
await page.keyboard.type(`extrusion = startSketchOn('XY') await page.keyboard.type(`extrusion = startSketchOn('XY')
|> circle({ center: [0, 0], radius: dia/2 }, %) |> circle({ center = [0, 0], radius = dia/2 }, %)
|> hole(squareHole(length, width, height), %) |> hole(squareHole(length, width, height), %)
|> extrude(height, %)`) |> extrude(height, %)`)
@ -604,8 +604,8 @@ test.describe('Editor tests', () => {
|> line([0, -10], %) |> line([0, -10], %)
|> close(%) |> close(%)
|> revolve({ |> revolve({
axis: revolveAxis, axis = revolveAxis,
angle: 90 angle = 90
}, %) }, %)
` `
) )

View File

@ -25,7 +25,7 @@ test(
await test.step('check code model connection works and that button is still enable once circle is selected ', async () => { await test.step('check code model connection works and that button is still enable once circle is selected ', async () => {
await moveToCircle() await moveToCircle()
const circleSnippet = const circleSnippet =
'circle({ center: [318.33, 168.1], radius: 182.8 }, %)' 'circle({ center = [318.33, 168.1], radius = 182.8 }, %)'
await editor.expectState({ await editor.expectState({
activeLines: [], activeLines: [],
highlightedCode: circleSnippet, highlightedCode: circleSnippet,
@ -168,7 +168,7 @@ test.describe('verify sketch on chamfer works', () => {
cameraPos: { x: 16020, y: -2000, z: 10500 }, cameraPos: { x: 16020, y: -2000, z: 10500 },
cameraTarget: { x: -150, y: -4500, z: -80 }, cameraTarget: { x: -150, y: -4500, z: -80 },
beforeChamferSnippet: `angledLine([segAng(rectangleSegmentA001)-90,217.26],%,$seg01) beforeChamferSnippet: `angledLine([segAng(rectangleSegmentA001)-90,217.26],%,$seg01)
chamfer({length:30,tags:[ chamfer({length = 30,tags = [
seg01, seg01,
getNextAdjacentEdge(yo), getNextAdjacentEdge(yo),
getNextAdjacentEdge(seg02), getNextAdjacentEdge(seg02),
@ -199,8 +199,8 @@ test.describe('verify sketch on chamfer works', () => {
segAng(rectangleSegmentA001) - 90, segAng(rectangleSegmentA001) - 90,
217.26 217.26
], %, $seg01)chamfer({ ], %, $seg01)chamfer({
length: 30, length = 30,
tags: [ tags = [
seg01, seg01,
getNextAdjacentEdge(yo), getNextAdjacentEdge(yo),
getNextAdjacentEdge(seg02) getNextAdjacentEdge(seg02)
@ -227,8 +227,8 @@ test.describe('verify sketch on chamfer works', () => {
cameraPos: { x: -6200, y: 1500, z: 6200 }, cameraPos: { x: -6200, y: 1500, z: 6200 },
cameraTarget: { x: 8300, y: 1100, z: 4800 }, cameraTarget: { x: 8300, y: 1100, z: 4800 },
beforeChamferSnippet: `angledLine([0, 268.43], %, $rectangleSegmentA001)chamfer({ beforeChamferSnippet: `angledLine([0, 268.43], %, $rectangleSegmentA001)chamfer({
length: 30, length = 30,
tags: [ tags = [
getNextAdjacentEdge(yo), getNextAdjacentEdge(yo),
getNextAdjacentEdge(seg02) getNextAdjacentEdge(seg02)
] ]
@ -254,8 +254,8 @@ test.describe('verify sketch on chamfer works', () => {
cameraPos: { x: -1100, y: -7700, z: 1600 }, cameraPos: { x: -1100, y: -7700, z: 1600 },
cameraTarget: { x: 1450, y: 670, z: 4000 }, cameraTarget: { x: 1450, y: 670, z: 4000 },
beforeChamferSnippet: `chamfer({ beforeChamferSnippet: `chamfer({
length: 30, length = 30,
tags: [getNextAdjacentEdge(yo)] tags = [getNextAdjacentEdge(yo)]
}, %)`, }, %)`,
afterChamferSelectSnippet: afterChamferSelectSnippet:
'sketch005 = startSketchOn(extrude001, seg06)', 'sketch005 = startSketchOn(extrude001, seg06)',
@ -292,17 +292,17 @@ test.describe('verify sketch on chamfer works', () => {
|> close(%) |> close(%)
extrude001 = extrude(100, sketch001) extrude001 = extrude(100, sketch001)
|> chamfer({ |> chamfer({
length: 30, length = 30,
tags: [getOppositeEdge(seg01)] tags = [getOppositeEdge(seg01)]
}, %, $seg03) }, %, $seg03)
|> chamfer({ length: 30, tags: [seg01] }, %, $seg04) |> chamfer({ length = 30, tags = [seg01] }, %, $seg04)
|> chamfer({ |> chamfer({
length: 30, length = 30,
tags: [getNextAdjacentEdge(seg02)] tags = [getNextAdjacentEdge(seg02)]
}, %, $seg05) }, %, $seg05)
|> chamfer({ |> chamfer({
length: 30, length = 30,
tags: [getNextAdjacentEdge(yo)] tags = [getNextAdjacentEdge(yo)]
}, %, $seg06) }, %, $seg06)
sketch005 = startSketchOn(extrude001, seg06) sketch005 = startSketchOn(extrude001, seg06)
|> startProfileAt([-23.43, 19.69], %) |> startProfileAt([-23.43, 19.69], %)
@ -383,7 +383,7 @@ test.describe('verify sketch on chamfer works', () => {
cameraPos: { x: 16020, y: -2000, z: 10500 }, cameraPos: { x: 16020, y: -2000, z: 10500 },
cameraTarget: { x: -150, y: -4500, z: -80 }, cameraTarget: { x: -150, y: -4500, z: -80 },
beforeChamferSnippet: `angledLine([segAng(rectangleSegmentA001)-90,217.26],%,$seg01) beforeChamferSnippet: `angledLine([segAng(rectangleSegmentA001)-90,217.26],%,$seg01)
chamfer({length:30,tags:[ chamfer({length=30,tags=[
seg01, seg01,
getNextAdjacentEdge(yo), getNextAdjacentEdge(yo),
getNextAdjacentEdge(seg02), getNextAdjacentEdge(seg02),
@ -421,12 +421,12 @@ test.describe('verify sketch on chamfer works', () => {
|> close(%) |> close(%)
extrude001 = extrude(100, sketch001) extrude001 = extrude(100, sketch001)
chamf = chamfer({ chamf = chamfer({
length: 30, length = 30,
tags: [getOppositeEdge(seg01)] tags = [getOppositeEdge(seg01)]
}, extrude001, $seg03) }, extrude001, $seg03)
|> chamfer({ |> chamfer({
length: 30, length = 30,
tags: [ tags = [
seg01, seg01,
getNextAdjacentEdge(yo), getNextAdjacentEdge(yo),
getNextAdjacentEdge(seg02) getNextAdjacentEdge(seg02)

View File

@ -45,9 +45,9 @@ test.describe('Sketch tests', () => {
screwHole = startSketchOn('XY') screwHole = startSketchOn('XY')
${startProfileAt1} ${startProfileAt1}
|> arc({ |> arc({
radius: screwRadius, radius = screwRadius,
angle_start: 0, angle_start = 0,
angle_end: 360 angle_end = 360
}, %) }, %)
part001 = startSketchOn('XY') part001 = startSketchOn('XY')
@ -66,9 +66,9 @@ test.describe('Sketch tests', () => {
|> xLine(-width / 4 + wireRadius, %) |> xLine(-width / 4 + wireRadius, %)
|> yLine(wireOffset, %) |> yLine(wireOffset, %)
|> arc({ |> arc({
radius: wireRadius, radius = wireRadius,
angle_start: 0, angle_start = 0,
angle_end: 180 angle_end = 180
}, %) }, %)
|> yLine(-wireOffset, %) |> yLine(-wireOffset, %)
|> xLine(-width / 4, %) |> xLine(-width / 4, %)
@ -354,7 +354,7 @@ test.describe('Sketch tests', () => {
localStorage.setItem( localStorage.setItem(
'persistCode', 'persistCode',
`sketch001 = startSketchOn('XZ') `sketch001 = startSketchOn('XZ')
|> circle({ center: [4.61, -5.01], radius: 8 }, %)` |> circle({ center = [4.61, -5.01], radius = 8 }, %)`
) )
}) })
@ -392,7 +392,7 @@ test.describe('Sketch tests', () => {
const dragPX = 40 const dragPX = 40
await page await page
.getByText('circle({ center: [4.61, -5.01], radius: 8 }, %)') .getByText('circle({ center = [4.61, -5.01], radius = 8 }, %)')
.click() .click()
await expect( await expect(
page.getByRole('button', { name: 'Edit Sketch' }) page.getByRole('button', { name: 'Edit Sketch' })
@ -429,7 +429,7 @@ test.describe('Sketch tests', () => {
// expect the code to have changed // expect the code to have changed
await expect(page.locator('.cm-content')) await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XZ') .toHaveText(`sketch001 = startSketchOn('XZ')
|> circle({ center: [7.26, -2.37], radius: 11.44 }, %) |> circle({ center = [7.26, -2.37], radius = 11.44 }, %)
`) `)
}) })
test('Can edit a sketch that has been extruded in the same pipe', async ({ test('Can edit a sketch that has been extruded in the same pipe', async ({
@ -547,7 +547,7 @@ test.describe('Sketch tests', () => {
|> line([12.73, -0.09], %) |> line([12.73, -0.09], %)
|> tangentialArcTo([24.95, -5.38], %) |> tangentialArcTo([24.95, -5.38], %)
|> close(%) |> close(%)
|> revolve({ axis: "X",}, %)` |> revolve({ axis = "X",}, %)`
) )
}) })
@ -634,7 +634,7 @@ test.describe('Sketch tests', () => {
|> tangentialArcTo([24.95, -5.38], %) |> tangentialArcTo([24.95, -5.38], %)
|> line([1.97, 2.06], %) |> line([1.97, 2.06], %)
|> close(%) |> close(%)
|> revolve({ axis: "X" }, %)`) |> revolve({ axis = "X" }, %)`)
}) })
test('Can add multiple sketches', async ({ page }) => { test('Can add multiple sketches', async ({ page }) => {
const u = await getUtils(page) const u = await getUtils(page)
@ -1074,11 +1074,11 @@ sketch002 = startSketchOn(extrude001, 'END')
fn lug = (origin, length, diameter, plane) => { fn lug = (origin, length, diameter, plane) => {
lugSketch = startSketchOn(plane) lugSketch = startSketchOn(plane)
|> startProfileAt([origin[0] + lugDiameter / 2, origin[1]], %) |> startProfileAt([origin[0] + lugDiameter / 2, origin[1]], %)
|> angledLineOfYLength({ angle: 60, length: lugHeadLength }, %) |> angledLineOfYLength({ angle = 60, length = lugHeadLength }, %)
|> xLineTo(0 + .001, %) |> xLineTo(0 + .001, %)
|> yLineTo(0, %) |> yLineTo(0, %)
|> close(%) |> close(%)
|> revolve({ axis: "Y" }, %) |> revolve({ axis = "Y" }, %)
return lugSketch return lugSketch
} }

View File

@ -77,27 +77,27 @@ part001 = startSketchOn('-XZ')
|> yLine(baseHeight, %) |> yLine(baseHeight, %)
|> xLine(baseLen, %) |> xLine(baseLen, %)
|> angledLineToY({ |> angledLineToY({
angle: topAng, angle = topAng,
to: totalHeightHalf, to = totalHeightHalf,
}, %, $seg04) }, %, $seg04)
|> xLineTo(totalLen, %, $seg03) |> xLineTo(totalLen, %, $seg03)
|> yLine(-armThick, %, $seg01) |> yLine(-armThick, %, $seg01)
|> angledLineThatIntersects({ |> angledLineThatIntersects({
angle: HALF_TURN, angle = HALF_TURN,
offset: -armThick, offset = -armThick,
intersectTag: seg04 intersectTag = seg04
}, %) }, %)
|> angledLineToY([segAng(seg04, %) + 180, ZERO], %) |> angledLineToY([segAng(seg04, %) + 180, ZERO], %)
|> angledLineToY({ |> angledLineToY({
angle: -bottomAng, angle = -bottomAng,
to: -totalHeightHalf - armThick, to = -totalHeightHalf - armThick,
}, %, $seg02) }, %, $seg02)
|> xLineTo(segEndX(seg03, %) + 0, %) |> xLineTo(segEndX(seg03, %) + 0, %)
|> yLine(-segLen(seg01, %), %) |> yLine(-segLen(seg01, %), %)
|> angledLineThatIntersects({ |> angledLineThatIntersects({
angle: HALF_TURN, angle = HALF_TURN,
offset: -armThick, offset = -armThick,
intersectTag: seg02 intersectTag = seg02
}, %) }, %)
|> angledLineToY([segAng(seg02, %) + 180, -baseHeight], %) |> angledLineToY([segAng(seg02, %) + 180, -baseHeight], %)
|> xLineTo(ZERO, %) |> xLineTo(ZERO, %)
@ -592,7 +592,7 @@ test(
}) })
await expect(page.locator('.cm-content')).toHaveText( await expect(page.locator('.cm-content')).toHaveText(
`sketch001 = startSketchOn('XZ') `sketch001 = startSketchOn('XZ')
|> circle({ center: [14.44, -2.44], radius: 1 }, %)` |> circle({ center = [14.44, -2.44], radius = 1 }, %)`
) )
} }
) )

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View File

@ -189,9 +189,9 @@ part002 = startSketchOn('XZ')
.click() .click()
// Wait for the codemod to take effect // Wait for the codemod to take effect
await expect(page.locator('.cm-content')).toContainText(`angle: -57,`) await expect(page.locator('.cm-content')).toContainText(`angle = -57,`)
await expect(page.locator('.cm-content')).toContainText( await expect(page.locator('.cm-content')).toContainText(
`offset: ${offset},` `offset = ${offset},`
) )
const activeLinesContent = await page.locator('.cm-activeLine').all() const activeLinesContent = await page.locator('.cm-activeLine').all()

View File

@ -275,7 +275,7 @@ test.describe(`Testing gizmo, fixture-based`, () => {
await test.step(`Select an edge of this circle`, async () => { await test.step(`Select an edge of this circle`, async () => {
const circleSnippet = const circleSnippet =
'circle({ center: [318.33, 168.1], radius: 182.8 }, %)' 'circle({ center = [318.33, 168.1], radius = 182.8 }, %)'
await moveToCircle() await moveToCircle()
await clickCircle() await clickCircle()
await editor.expectState({ await editor.expectState({

View File

@ -185,20 +185,20 @@ test.describe('Testing segment overlays', () => {
`part001 = startSketchOn('XZ') `part001 = startSketchOn('XZ')
|> startProfileAt([5 + 0, 20 + 0], %) |> startProfileAt([5 + 0, 20 + 0], %)
|> line([0.5, -14 + 0], %) |> line([0.5, -14 + 0], %)
|> angledLine({ angle: 3 + 0, length: 32 + 0 }, %) |> angledLine({ angle = 3 + 0, length = 32 + 0 }, %)
|> lineTo([5 + 33, 20 + 11.5 + 0], %) |> lineTo([5 + 33, 20 + 11.5 + 0], %)
|> xLineTo(5 + 9 - 5, %) |> xLineTo(5 + 9 - 5, %)
|> yLineTo(20 + -10.77, %, $a) |> yLineTo(20 + -10.77, %, $a)
|> xLine(26.04, %) |> xLine(26.04, %)
|> yLine(21.14 + 0, %) |> yLine(21.14 + 0, %)
|> angledLineOfXLength({ angle: 181 + 0, length: 23.14 }, %) |> angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %)
|> angledLineOfYLength({ angle: -91, length: 19 + 0 }, %) |> angledLineOfYLength({ angle = -91, length = 19 + 0 }, %)
|> angledLineToX({ angle: 3 + 0, to: 5 + 26 }, %) |> angledLineToX({ angle = 3 + 0, to = 5 + 26 }, %)
|> angledLineToY({ angle: 89, to: 20 + 9.14 + 0 }, %) |> angledLineToY({ angle = 89, to = 20 + 9.14 + 0 }, %)
|> angledLineThatIntersects({ |> angledLineThatIntersects({
angle: 4.14, angle = 4.14,
intersectTag: a, intersectTag = a,
offset: 9 offset = 9
}, %) }, %)
|> tangentialArcTo([5 + 3.14 + 13, 20 + 3.14], %) |> tangentialArcTo([5 + 3.14 + 13, 20 + 3.14], %)
` `
@ -278,9 +278,10 @@ test.describe('Testing segment overlays', () => {
hoverPos: { x: angledLine.x, y: angledLine.y }, hoverPos: { x: angledLine.x, y: angledLine.y },
constraintType: 'angle', constraintType: 'angle',
expectBeforeUnconstrained: expectBeforeUnconstrained:
'angledLine({ angle: 3 + 0, length: 32 + 0 }, %)', 'angledLine({ angle = 3 + 0, length = 32 + 0 }, %)',
expectAfterUnconstrained: 'angledLine({ angle: 3, length: 32 + 0 }, %)', expectAfterUnconstrained:
expectFinal: 'angledLine({ angle: angle001, length: 32 + 0 }, %)', 'angledLine({ angle = 3, length = 32 + 0 }, %)',
expectFinal: 'angledLine({ angle = angle001, length = 32 + 0 }, %)',
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="1"]', locator: '[data-overlay-toolbar-index="1"]',
}) })
@ -289,10 +290,10 @@ test.describe('Testing segment overlays', () => {
hoverPos: { x: angledLine.x, y: angledLine.y }, hoverPos: { x: angledLine.x, y: angledLine.y },
constraintType: 'length', constraintType: 'length',
expectBeforeUnconstrained: expectBeforeUnconstrained:
'angledLine({ angle: angle001, length: 32 + 0 }, %)', 'angledLine({ angle = angle001, length = 32 + 0 }, %)',
expectAfterUnconstrained: expectAfterUnconstrained:
'angledLine({ angle: angle001, length: 32 }, %)', 'angledLine({ angle = angle001, length = 32 }, %)',
expectFinal: 'angledLine({ angle: angle001, length: len001 }, %)', expectFinal: 'angledLine({ angle = angle001, length = len001 }, %)',
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="1"]', locator: '[data-overlay-toolbar-index="1"]',
}) })
@ -353,13 +354,13 @@ xAbs002 = 4
part001 = startSketchOn('XZ') part001 = startSketchOn('XZ')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line([0.5, yRel001], %) |> line([0.5, yRel001], %)
|> angledLine({ angle: angle001, length: len001 }, %) |> angledLine({ angle = angle001, length = len001 }, %)
|> lineTo([33, yAbs001], %) |> lineTo([33, yAbs001], %)
|> xLineTo(xAbs002, %) |> xLineTo(xAbs002, %)
|> yLineTo(-10.77, %, $a) |> yLineTo(-10.77, %, $a)
|> xLine(26.04, %) |> xLine(26.04, %)
|> yLine(21.14 + 0, %) |> yLine(21.14 + 0, %)
|> angledLineOfXLength({ angle: 181 + 0, length: 23.14 }, %) |> angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %)
` `
) )
}) })
@ -423,20 +424,20 @@ part001 = startSketchOn('XZ')
`part001 = startSketchOn('XZ') `part001 = startSketchOn('XZ')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line([0.5, -14 + 0], %) |> line([0.5, -14 + 0], %)
|> angledLine({ angle: 3 + 0, length: 32 + 0 }, %) |> angledLine({ angle = 3 + 0, length = 32 + 0 }, %)
|> lineTo([33, 11.5 + 0], %) |> lineTo([33, 11.5 + 0], %)
|> xLineTo(9 - 5, %) |> xLineTo(9 - 5, %)
|> yLineTo(-10.77, %, $a) |> yLineTo(-10.77, %, $a)
|> xLine(26.04, %) |> xLine(26.04, %)
|> yLine(21.14 + 0, %) |> yLine(21.14 + 0, %)
|> angledLineOfXLength({ angle: 181 + 0, length: 23.14 }, %) |> angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %)
|> angledLineOfYLength({ angle: -91, length: 19 + 0 }, %) |> angledLineOfYLength({ angle = -91, length = 19 + 0 }, %)
|> angledLineToX({ angle: 3 + 0, to: 26 }, %) |> angledLineToX({ angle = 3 + 0, to = 26 }, %)
|> angledLineToY({ angle: 89, to: 9.14 + 0 }, %) |> angledLineToY({ angle = 89, to = 9.14 + 0 }, %)
|> angledLineThatIntersects({ |> angledLineThatIntersects({
angle: 4.14, angle = 4.14,
intersectTag: a, intersectTag = a,
offset: 9 offset = 9
}, %) }, %)
|> tangentialArcTo([3.14 + 13, 3.14], %) |> tangentialArcTo([3.14 + 13, 3.14], %)
` `
@ -488,11 +489,11 @@ part001 = startSketchOn('XZ')
hoverPos: { x: angledLineOfXLength.x, y: angledLineOfXLength.y }, hoverPos: { x: angledLineOfXLength.x, y: angledLineOfXLength.y },
constraintType: 'angle', constraintType: 'angle',
expectBeforeUnconstrained: expectBeforeUnconstrained:
'angledLineOfXLength({ angle: 181 + 0, length: 23.14 }, %)', 'angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %)',
expectAfterUnconstrained: expectAfterUnconstrained:
'angledLineOfXLength({ angle: -179, length: 23.14 }, %)', 'angledLineOfXLength({ angle = -179, length = 23.14 }, %)',
expectFinal: expectFinal:
'angledLineOfXLength({ angle: angle001, length: 23.14 }, %)', 'angledLineOfXLength({ angle = angle001, length = 23.14 }, %)',
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="7"]', locator: '[data-overlay-toolbar-index="7"]',
}) })
@ -501,11 +502,11 @@ part001 = startSketchOn('XZ')
hoverPos: { x: angledLineOfXLength.x, y: angledLineOfXLength.y }, hoverPos: { x: angledLineOfXLength.x, y: angledLineOfXLength.y },
constraintType: 'xRelative', constraintType: 'xRelative',
expectBeforeUnconstrained: expectBeforeUnconstrained:
'angledLineOfXLength({ angle: angle001, length: 23.14 }, %)', 'angledLineOfXLength({ angle = angle001, length = 23.14 }, %)',
expectAfterUnconstrained: expectAfterUnconstrained:
'angledLineOfXLength({ angle: angle001, length: xRel001 }, %)', 'angledLineOfXLength({ angle = angle001, length = xRel001 }, %)',
expectFinal: expectFinal:
'angledLineOfXLength({ angle: angle001, length: 23.14 }, %)', 'angledLineOfXLength({ angle = angle001, length = 23.14 }, %)',
steps: 7, steps: 7,
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="7"]', locator: '[data-overlay-toolbar-index="7"]',
@ -520,10 +521,10 @@ part001 = startSketchOn('XZ')
hoverPos: { x: angledLineOfYLength.x, y: angledLineOfYLength.y }, hoverPos: { x: angledLineOfYLength.x, y: angledLineOfYLength.y },
constraintType: 'angle', constraintType: 'angle',
expectBeforeUnconstrained: expectBeforeUnconstrained:
'angledLineOfYLength({ angle: -91, length: 19 + 0 }, %)', 'angledLineOfYLength({ angle = -91, length = 19 + 0 }, %)',
expectAfterUnconstrained: expectAfterUnconstrained:
'angledLineOfYLength({ angle: angle002, length: 19 + 0 }, %)', 'angledLineOfYLength({ angle = angle002, length = 19 + 0 }, %)',
expectFinal: 'angledLineOfYLength({ angle: -91, length: 19 + 0 }, %)', expectFinal: 'angledLineOfYLength({ angle = -91, length = 19 + 0 }, %)',
ang: ang + 180, ang: ang + 180,
steps: 6, steps: 6,
locator: '[data-overlay-toolbar-index="8"]', locator: '[data-overlay-toolbar-index="8"]',
@ -533,10 +534,11 @@ part001 = startSketchOn('XZ')
hoverPos: { x: angledLineOfYLength.x, y: angledLineOfYLength.y }, hoverPos: { x: angledLineOfYLength.x, y: angledLineOfYLength.y },
constraintType: 'yRelative', constraintType: 'yRelative',
expectBeforeUnconstrained: expectBeforeUnconstrained:
'angledLineOfYLength({ angle: -91, length: 19 + 0 }, %)', 'angledLineOfYLength({ angle = -91, length = 19 + 0 }, %)',
expectAfterUnconstrained: expectAfterUnconstrained:
'angledLineOfYLength({ angle: -91, length: 19 }, %)', 'angledLineOfYLength({ angle = -91, length = 19 }, %)',
expectFinal: 'angledLineOfYLength({ angle: -91, length: yRel002 }, %)', expectFinal:
'angledLineOfYLength({ angle = -91, length = yRel002 }, %)',
ang: ang + 180, ang: ang + 180,
steps: 7, steps: 7,
locator: '[data-overlay-toolbar-index="8"]', locator: '[data-overlay-toolbar-index="8"]',
@ -551,20 +553,20 @@ part001 = startSketchOn('XZ')
`part001 = startSketchOn('XZ') `part001 = startSketchOn('XZ')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line([0.5, -14 + 0], %) |> line([0.5, -14 + 0], %)
|> angledLine({ angle: 3 + 0, length: 32 + 0 }, %) |> angledLine({ angle = 3 + 0, length = 32 + 0 }, %)
|> lineTo([33, 11.5 + 0], %) |> lineTo([33, 11.5 + 0], %)
|> xLineTo(9 - 5, %) |> xLineTo(9 - 5, %)
|> yLineTo(-10.77, %, $a) |> yLineTo(-10.77, %, $a)
|> xLine(26.04, %) |> xLine(26.04, %)
|> yLine(21.14 + 0, %) |> yLine(21.14 + 0, %)
|> angledLineOfXLength({ angle: 181 + 0, length: 23.14 }, %) |> angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %)
|> angledLineOfYLength({ angle: -91, length: 19 + 0 }, %) |> angledLineOfYLength({ angle = -91, length = 19 + 0 }, %)
|> angledLineToX({ angle: 3 + 0, to: 26 }, %) |> angledLineToX({ angle = 3 + 0, to = 26 }, %)
|> angledLineToY({ angle: 89, to: 9.14 + 0 }, %) |> angledLineToY({ angle = 89, to = 9.14 + 0 }, %)
|> angledLineThatIntersects({ |> angledLineThatIntersects({
angle: 4.14, angle = 4.14,
intersectTag: a, intersectTag = a,
offset: 9 offset = 9
}, %) }, %)
|> tangentialArcTo([3.14 + 13, 1.14], %) |> tangentialArcTo([3.14 + 13, 1.14], %)
` `
@ -599,9 +601,10 @@ part001 = startSketchOn('XZ')
await clickConstrained({ await clickConstrained({
hoverPos: { x: angledLineToX.x, y: angledLineToX.y }, hoverPos: { x: angledLineToX.x, y: angledLineToX.y },
constraintType: 'angle', constraintType: 'angle',
expectBeforeUnconstrained: 'angledLineToX({ angle: 3 + 0, to: 26 }, %)', expectBeforeUnconstrained:
expectAfterUnconstrained: 'angledLineToX({ angle: 3, to: 26 }, %)', 'angledLineToX({ angle = 3 + 0, to = 26 }, %)',
expectFinal: 'angledLineToX({ angle: angle001, to: 26 }, %)', expectAfterUnconstrained: 'angledLineToX({ angle = 3, to = 26 }, %)',
expectFinal: 'angledLineToX({ angle = angle001, to = 26 }, %)',
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="9"]', locator: '[data-overlay-toolbar-index="9"]',
}) })
@ -610,10 +613,10 @@ part001 = startSketchOn('XZ')
hoverPos: { x: angledLineToX.x, y: angledLineToX.y }, hoverPos: { x: angledLineToX.x, y: angledLineToX.y },
constraintType: 'xAbsolute', constraintType: 'xAbsolute',
expectBeforeUnconstrained: expectBeforeUnconstrained:
'angledLineToX({ angle: angle001, to: 26 }, %)', 'angledLineToX({ angle = angle001, to = 26 }, %)',
expectAfterUnconstrained: expectAfterUnconstrained:
'angledLineToX({ angle: angle001, to: xAbs001 }, %)', 'angledLineToX({ angle = angle001, to = xAbs001 }, %)',
expectFinal: 'angledLineToX({ angle: angle001, to: 26 }, %)', expectFinal: 'angledLineToX({ angle = angle001, to = 26 }, %)',
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="9"]', locator: '[data-overlay-toolbar-index="9"]',
}) })
@ -625,10 +628,10 @@ part001 = startSketchOn('XZ')
hoverPos: { x: angledLineToY.x, y: angledLineToY.y }, hoverPos: { x: angledLineToY.x, y: angledLineToY.y },
constraintType: 'angle', constraintType: 'angle',
expectBeforeUnconstrained: expectBeforeUnconstrained:
'angledLineToY({ angle: 89, to: 9.14 + 0 }, %)', 'angledLineToY({ angle = 89, to = 9.14 + 0 }, %)',
expectAfterUnconstrained: expectAfterUnconstrained:
'angledLineToY({ angle: angle002, to: 9.14 + 0 }, %)', 'angledLineToY({ angle = angle002, to = 9.14 + 0 }, %)',
expectFinal: 'angledLineToY({ angle: 89, to: 9.14 + 0 }, %)', expectFinal: 'angledLineToY({ angle = 89, to = 9.14 + 0 }, %)',
steps: process.platform === 'darwin' ? 8 : 9, steps: process.platform === 'darwin' ? 8 : 9,
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="10"]', locator: '[data-overlay-toolbar-index="10"]',
@ -638,9 +641,9 @@ part001 = startSketchOn('XZ')
hoverPos: { x: angledLineToY.x, y: angledLineToY.y }, hoverPos: { x: angledLineToY.x, y: angledLineToY.y },
constraintType: 'yAbsolute', constraintType: 'yAbsolute',
expectBeforeUnconstrained: expectBeforeUnconstrained:
'angledLineToY({ angle: 89, to: 9.14 + 0 }, %)', 'angledLineToY({ angle = 89, to = 9.14 + 0 }, %)',
expectAfterUnconstrained: 'angledLineToY({ angle: 89, to: 9.14 }, %)', expectAfterUnconstrained: 'angledLineToY({ angle = 89, to = 9.14 }, %)',
expectFinal: 'angledLineToY({ angle: 89, to: yAbs001 }, %)', expectFinal: 'angledLineToY({ angle = 89, to = yAbs001 }, %)',
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="10"]', locator: '[data-overlay-toolbar-index="10"]',
}) })
@ -657,19 +660,19 @@ part001 = startSketchOn('XZ')
}, },
constraintType: 'angle', constraintType: 'angle',
expectBeforeUnconstrained: `angledLineThatIntersects({ expectBeforeUnconstrained: `angledLineThatIntersects({
angle: 4.14, angle = 4.14,
intersectTag: a, intersectTag = a,
offset: 9 offset = 9
}, %)`, }, %)`,
expectAfterUnconstrained: `angledLineThatIntersects({ expectAfterUnconstrained: `angledLineThatIntersects({
angle: angle003, angle = angle003,
intersectTag: a, intersectTag = a,
offset: 9 offset = 9
}, %)`, }, %)`,
expectFinal: `angledLineThatIntersects({ expectFinal: `angledLineThatIntersects({
angle: -176, angle = -176,
offset: 9, offset = 9,
intersectTag: a intersectTag = a
}, %)`, }, %)`,
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="11"]', locator: '[data-overlay-toolbar-index="11"]',
@ -682,19 +685,19 @@ part001 = startSketchOn('XZ')
}, },
constraintType: 'intersectionOffset', constraintType: 'intersectionOffset',
expectBeforeUnconstrained: `angledLineThatIntersects({ expectBeforeUnconstrained: `angledLineThatIntersects({
angle: -176, angle = -176,
offset: 9, offset = 9,
intersectTag: a intersectTag = a
}, %)`, }, %)`,
expectAfterUnconstrained: `angledLineThatIntersects({ expectAfterUnconstrained: `angledLineThatIntersects({
angle: -176, angle = -176,
offset: perpDist001, offset = perpDist001,
intersectTag: a intersectTag = a
}, %)`, }, %)`,
expectFinal: `angledLineThatIntersects({ expectFinal: `angledLineThatIntersects({
angle: -176, angle = -176,
offset: 9, offset = 9,
intersectTag: a intersectTag = a
}, %)`, }, %)`,
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="11"]', locator: '[data-overlay-toolbar-index="11"]',
@ -707,20 +710,20 @@ part001 = startSketchOn('XZ')
`part001 = startSketchOn('XZ') `part001 = startSketchOn('XZ')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line([0.5, -14 + 0], %) |> line([0.5, -14 + 0], %)
|> angledLine({ angle: 3 + 0, length: 32 + 0 }, %) |> angledLine({ angle = 3 + 0, length = 32 + 0 }, %)
|> lineTo([33, 11.5 + 0], %) |> lineTo([33, 11.5 + 0], %)
|> xLineTo(9 - 5, %) |> xLineTo(9 - 5, %)
|> yLineTo(-10.77, %, $a) |> yLineTo(-10.77, %, $a)
|> xLine(26.04, %) |> xLine(26.04, %)
|> yLine(21.14 + 0, %) |> yLine(21.14 + 0, %)
|> angledLineOfXLength({ angle: 181 + 0, length: 23.14 }, %) |> angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %)
|> angledLineOfYLength({ angle: -91, length: 19 + 0 }, %) |> angledLineOfYLength({ angle = -91, length = 19 + 0 }, %)
|> angledLineToX({ angle: 3 + 0, to: 26 }, %) |> angledLineToX({ angle = 3 + 0, to = 26 }, %)
|> angledLineToY({ angle: 89, to: 9.14 + 0 }, %) |> angledLineToY({ angle = 89, to = 9.14 + 0 }, %)
|> angledLineThatIntersects({ |> angledLineThatIntersects({
angle: 4.14, angle = 4.14,
intersectTag: a, intersectTag = a,
offset: 9 offset = 9
}, %) }, %)
|> tangentialArcTo([3.14 + 13, -3.14], %) |> tangentialArcTo([3.14 + 13, -3.14], %)
` `
@ -779,7 +782,7 @@ part001 = startSketchOn('XZ')
localStorage.setItem( localStorage.setItem(
'persistCode', 'persistCode',
`part001 = startSketchOn('XZ') `part001 = startSketchOn('XZ')
|> circle({ center: [1 + 0, 0], radius: 8 }, %) |> circle({ center = [1 + 0, 0], radius = 8 }, %)
` `
) )
localStorage.setItem('disableAxis', 'true') localStorage.setItem('disableAxis', 'true')
@ -795,7 +798,7 @@ part001 = startSketchOn('XZ')
await u.closeDebugPanel() await u.closeDebugPanel()
await page await page
.getByText('circle({ center: [1 + 0, 0], radius: 8 }, %)') .getByText('circle({ center = [1 + 0, 0], radius = 8 }, %)')
.click() .click()
await page.waitForTimeout(100) await page.waitForTimeout(100)
await page.getByRole('button', { name: 'Edit Sketch' }).click() await page.getByRole('button', { name: 'Edit Sketch' }).click()
@ -814,9 +817,9 @@ part001 = startSketchOn('XZ')
hoverPos, hoverPos,
constraintType: 'xAbsolute', constraintType: 'xAbsolute',
expectBeforeUnconstrained: expectBeforeUnconstrained:
'circle({ center: [1 + 0, 0], radius: 8 }, %)', 'circle({ center = [1 + 0, 0], radius = 8 }, %)',
expectAfterUnconstrained: 'circle({ center: [1, 0], radius: 8 }, %)', expectAfterUnconstrained: 'circle({ center = [1, 0], radius = 8 }, %)',
expectFinal: 'circle({ center: [xAbs001, 0], radius: 8 }, %)', expectFinal: 'circle({ center = [xAbs001, 0], radius = 8 }, %)',
ang: ang + 105, ang: ang + 105,
steps: 6, steps: 6,
locator: '[data-overlay-toolbar-index="0"]', locator: '[data-overlay-toolbar-index="0"]',
@ -826,10 +829,10 @@ part001 = startSketchOn('XZ')
hoverPos, hoverPos,
constraintType: 'yAbsolute', constraintType: 'yAbsolute',
expectBeforeUnconstrained: expectBeforeUnconstrained:
'circle({ center: [xAbs001, 0], radius: 8 }, %)', 'circle({ center = [xAbs001, 0], radius = 8 }, %)',
expectAfterUnconstrained: expectAfterUnconstrained:
'circle({ center: [xAbs001, yAbs001], radius: 8 }, %)', 'circle({ center = [xAbs001, yAbs001], radius = 8 }, %)',
expectFinal: 'circle({ center: [xAbs001, 0], radius: 8 }, %)', expectFinal: 'circle({ center = [xAbs001, 0], radius = 8 }, %)',
ang: ang + 105, ang: ang + 105,
steps: 10, steps: 10,
locator: '[data-overlay-toolbar-index="0"]', locator: '[data-overlay-toolbar-index="0"]',
@ -839,10 +842,10 @@ part001 = startSketchOn('XZ')
hoverPos, hoverPos,
constraintType: 'radius', constraintType: 'radius',
expectBeforeUnconstrained: expectBeforeUnconstrained:
'circle({ center: [xAbs001, 0], radius: 8 }, %)', 'circle({ center = [xAbs001, 0], radius = 8 }, %)',
expectAfterUnconstrained: expectAfterUnconstrained:
'circle({ center: [xAbs001, 0], radius: radius001 }, %)', 'circle({ center = [xAbs001, 0], radius = radius001 }, %)',
expectFinal: 'circle({ center: [xAbs001, 0], radius: 8 }, %)', expectFinal: 'circle({ center = [xAbs001, 0], radius = 8 }, %)',
ang: ang + 105, ang: ang + 105,
steps: 10, steps: 10,
locator: '[data-overlay-toolbar-index="0"]', locator: '[data-overlay-toolbar-index="0"]',
@ -894,20 +897,20 @@ part001 = startSketchOn('XZ')
`part001 = startSketchOn('XZ') `part001 = startSketchOn('XZ')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line([0.5, -14 + 0], %) |> line([0.5, -14 + 0], %)
|> angledLine({ angle: 3 + 0, length: 32 + 0 }, %) |> angledLine({ angle = 3 + 0, length = 32 + 0 }, %)
|> lineTo([33, 11.5 + 0], %) |> lineTo([33, 11.5 + 0], %)
|> xLineTo(9 - 5, %) |> xLineTo(9 - 5, %)
|> yLineTo(-10.77, %, $a) |> yLineTo(-10.77, %, $a)
|> xLine(26.04, %) |> xLine(26.04, %)
|> yLine(21.14 + 0, %) |> yLine(21.14 + 0, %)
|> angledLineOfXLength({ angle: 181 + 0, length: 23.14 }, %) |> angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %)
|> angledLineOfYLength({ angle: -91, length: 19 + 0 }, %) |> angledLineOfYLength({ angle = -91, length = 19 + 0 }, %)
|> angledLineToX({ angle: 3 + 0, to: 26 }, %) |> angledLineToX({ angle = 3 + 0, to = 26 }, %)
|> angledLineToY({ angle: 89, to: 9.14 + 0 }, %) |> angledLineToY({ angle = 89, to = 9.14 + 0 }, %)
|> angledLineThatIntersects({ |> angledLineThatIntersects({
angle: 4.14, angle = 4.14,
intersectTag: a, intersectTag = a,
offset: 9 offset = 9
}, %) }, %)
|> tangentialArcTo([3.14 + 13, 1.14], %) |> tangentialArcTo([3.14 + 13, 1.14], %)
` `
@ -952,9 +955,9 @@ part001 = startSketchOn('XZ')
await deleteSegmentSequence({ await deleteSegmentSequence({
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y }, hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
codeToBeDeleted: `angledLineThatIntersects({ codeToBeDeleted: `angledLineThatIntersects({
angle: 4.14, angle = 4.14,
intersectTag: a, intersectTag = a,
offset: 9 offset = 9
}, %)`, }, %)`,
stdLibFnName: 'angledLineThatIntersects', stdLibFnName: 'angledLineThatIntersects',
ang: ang + 180, ang: ang + 180,
@ -966,7 +969,7 @@ part001 = startSketchOn('XZ')
ang = await u.getAngle(`[data-overlay-index="${10}"]`) ang = await u.getAngle(`[data-overlay-index="${10}"]`)
await deleteSegmentSequence({ await deleteSegmentSequence({
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y }, hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
codeToBeDeleted: 'angledLineToY({ angle: 89, to: 9.14 + 0 }, %)', codeToBeDeleted: 'angledLineToY({ angle = 89, to = 9.14 + 0 }, %)',
stdLibFnName: 'angledLineToY', stdLibFnName: 'angledLineToY',
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="10"]', locator: '[data-overlay-toolbar-index="10"]',
@ -976,7 +979,7 @@ part001 = startSketchOn('XZ')
ang = await u.getAngle(`[data-overlay-index="${9}"]`) ang = await u.getAngle(`[data-overlay-index="${9}"]`)
await deleteSegmentSequence({ await deleteSegmentSequence({
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y }, hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
codeToBeDeleted: 'angledLineToX({ angle: 3 + 0, to: 26 }, %)', codeToBeDeleted: 'angledLineToX({ angle = 3 + 0, to = 26 }, %)',
stdLibFnName: 'angledLineToX', stdLibFnName: 'angledLineToX',
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="9"]', locator: '[data-overlay-toolbar-index="9"]',
@ -987,7 +990,7 @@ part001 = startSketchOn('XZ')
await deleteSegmentSequence({ await deleteSegmentSequence({
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y }, hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
codeToBeDeleted: codeToBeDeleted:
'angledLineOfYLength({ angle: -91, length: 19 + 0 }, %)', 'angledLineOfYLength({ angle = -91, length = 19 + 0 }, %)',
stdLibFnName: 'angledLineOfYLength', stdLibFnName: 'angledLineOfYLength',
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="8"]', locator: '[data-overlay-toolbar-index="8"]',
@ -998,7 +1001,7 @@ part001 = startSketchOn('XZ')
await deleteSegmentSequence({ await deleteSegmentSequence({
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y }, hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
codeToBeDeleted: codeToBeDeleted:
'angledLineOfXLength({ angle: 181 + 0, length: 23.14 }, %)', 'angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %)',
stdLibFnName: 'angledLineOfXLength', stdLibFnName: 'angledLineOfXLength',
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="7"]', locator: '[data-overlay-toolbar-index="7"]',
@ -1078,7 +1081,7 @@ part001 = startSketchOn('XZ')
ang = await u.getAngle(`[data-overlay-index="${1}"]`) ang = await u.getAngle(`[data-overlay-index="${1}"]`)
await deleteSegmentSequence({ await deleteSegmentSequence({
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y }, hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
codeToBeDeleted: 'angledLine({ angle: 3 + 0, length: 32 + 0 }, %)', codeToBeDeleted: 'angledLine({ angle = 3 + 0, length = 32 + 0 }, %)',
stdLibFnName: 'angledLine', stdLibFnName: 'angledLine',
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="1"]', locator: '[data-overlay-toolbar-index="1"]',
@ -1105,17 +1108,17 @@ part001 = startSketchOn('XZ')
'xLineTo(30, %, $seg01)', 'xLineTo(30, %, $seg01)',
'yLineTo(-4, %, $seg01)', 'yLineTo(-4, %, $seg01)',
'angledLineOfXLength([3, 30], %, $seg01)', 'angledLineOfXLength([3, 30], %, $seg01)',
'angledLineOfXLength({ angle: 3, length: 30 }, %, $seg01)', 'angledLineOfXLength({ angle = 3, length = 30 }, %, $seg01)',
'angledLineOfYLength([3, 1.5], %, $seg01)', 'angledLineOfYLength([3, 1.5], %, $seg01)',
'angledLineOfYLength({ angle: 3, length: 1.5 }, %, $seg01)', 'angledLineOfYLength({ angle = 3, length = 1.5 }, %, $seg01)',
'angledLineToX([3, 30], %, $seg01)', 'angledLineToX([3, 30], %, $seg01)',
'angledLineToX({ angle: 3, to: 30 }, %, $seg01)', 'angledLineToX({ angle = 3, to = 30 }, %, $seg01)',
'angledLineToY([3, 7], %, $seg01)', 'angledLineToY([3, 7], %, $seg01)',
'angledLineToY({ angle: 3, to: 7 }, %, $seg01)', 'angledLineToY({ angle = 3, to = 7 }, %, $seg01)',
] ]
for (const doesHaveTagOutsideSketch of [true, false]) { for (const doesHaveTagOutsideSketch of [true, false]) {
for (const lineOfInterest of cases) { for (const lineOfInterest of cases) {
const isObj = lineOfInterest.includes('{ angle: 3,') const isObj = lineOfInterest.includes('{ angle = 3,')
test(`${lineOfInterest.split('(')[0]}${isObj ? '-[obj-input]' : ''}${ test(`${lineOfInterest.split('(')[0]}${isObj ? '-[obj-input]' : ''}${
doesHaveTagOutsideSketch ? '-[tagOutsideSketch]' : '' doesHaveTagOutsideSketch ? '-[tagOutsideSketch]' : ''
}`, async ({ page }) => { }`, async ({ page }) => {
@ -1257,25 +1260,25 @@ ${extraLine ? 'myVar = segLen(seg01)' : ''}`
after: `line([19.08, 1], %, $seg01)`, after: `line([19.08, 1], %, $seg01)`,
}, },
{ {
before: `angledLineOfXLength({ angle: 3 + 0, length: 30 + 0 }, %, $seg01)`, before: `angledLineOfXLength({ angle = 3 + 0, length = 30 + 0 }, %, $seg01)`,
after: `line([30, 1.57], %, $seg01)`, after: `line([30, 1.57], %, $seg01)`,
}, },
{ {
before: `angledLineOfYLength({ angle: 3 + 0, length: 1.5 + 0 }, %, $seg01)`, before: `angledLineOfYLength({ angle = 3 + 0, length = 1.5 + 0 }, %, $seg01)`,
after: `line([28.62, 1.5], %, $seg01)`, after: `line([28.62, 1.5], %, $seg01)`,
}, },
{ {
before: `angledLineToX({ angle: 3 + 0, to: 30 + 0 }, %, $seg01)`, before: `angledLineToX({ angle = 3 + 0, to = 30 + 0 }, %, $seg01)`,
after: `line([25, 1.31], %, $seg01)`, after: `line([25, 1.31], %, $seg01)`,
}, },
{ {
before: `angledLineToY({ angle: 3 + 0, to: 7 + 0 }, %, $seg01)`, before: `angledLineToY({ angle = 3 + 0, to = 7 + 0 }, %, $seg01)`,
after: `line([19.08, 1], %, $seg01)`, after: `line([19.08, 1], %, $seg01)`,
}, },
] ]
for (const { before, after } of cases) { for (const { before, after } of cases) {
const isObj = before.includes('{ angle: 3') const isObj = before.includes('{ angle = 3')
test(`${before.split('(')[0]}${isObj ? '-[obj-input]' : ''}`, async ({ test(`${before.split('(')[0]}${isObj ? '-[obj-input]' : ''}`, async ({
page, page,
}) => { }) => {

View File

@ -314,22 +314,22 @@ part009 = startSketchOn('XY')
|> line([thickness, 0], %) |> line([thickness, 0], %)
|> line([0, -1], %) |> line([0, -1], %)
|> angledLineToX({ |> angledLineToX({
angle: 60, angle = 60,
to: pipeSmallDia + thickness to = pipeSmallDia + thickness
}, %) }, %)
|> line([0, -pipeLength], %) |> line([0, -pipeLength], %)
|> angledLineToX({ |> angledLineToX({
angle: -60, angle = -60,
to: pipeLargeDia + thickness to = pipeLargeDia + thickness
}, %) }, %)
|> line([0, -1], %) |> line([0, -1], %)
|> line([-thickness, 0], %) |> line([-thickness, 0], %)
|> line([0, 1], %) |> line([0, 1], %)
|> angledLineToX({ angle: 120, to: pipeSmallDia }, %) |> angledLineToX({ angle = 120, to = pipeSmallDia }, %)
|> line([0, pipeLength], %) |> line([0, pipeLength], %)
|> angledLineToX({ angle: 60, to: pipeLargeDia }, %) |> angledLineToX({ angle = 60, to = pipeLargeDia }, %)
|> close(%) |> close(%)
rev = revolve({ axis: 'y' }, part009) rev = revolve({ axis = 'y' }, part009)
` `
) )
}, KCL_DEFAULT_LENGTH) }, KCL_DEFAULT_LENGTH)
@ -395,27 +395,27 @@ rev = revolve({ axis: 'y' }, part009)
`extrude001 = extrude(50, sketch001)` `extrude001 = extrude(50, sketch001)`
) )
await expect(u.codeLocator).toContainText(`sketch005 = startSketchOn({ await expect(u.codeLocator).toContainText(`sketch005 = startSketchOn({
plane: { plane = {
origin: { x: 0, y: -50, z: 0 }, origin = { x = 0, y = -50, z = 0 },
x_axis: { x: 1, y: 0, z: 0 }, x_axis = { x = 1, y = 0, z = 0 },
y_axis: { x: 0, y: 0, z: 1 }, y_axis = { x = 0, y = 0, z = 1 },
z_axis: { x: 0, y: -1, z: 0 } z_axis = { x = 0, y = -1, z = 0 }
} }
})`) })`)
await expect(u.codeLocator).toContainText(`sketch003 = startSketchOn({ await expect(u.codeLocator).toContainText(`sketch003 = startSketchOn({
plane: { plane = {
origin: { x: 116.53, y: 0, z: 163.25 }, origin = { x = 116.53, y = 0, z = 163.25 },
x_axis: { x: -0.81, y: 0, z: 0.58 }, x_axis = { x = -0.81, y = 0, z = 0.58 },
y_axis: { x: 0, y: -1, z: 0 }, y_axis = { x = 0, y = -1, z = 0 },
z_axis: { x: 0.58, y: 0, z: 0.81 } z_axis = { x = 0.58, y = 0, z = 0.81 }
} }
})`) })`)
await expect(u.codeLocator).toContainText(`sketch002 = startSketchOn({ await expect(u.codeLocator).toContainText(`sketch002 = startSketchOn({
plane: { plane = {
origin: { x: -91.74, y: 0, z: 80.89 }, origin = { x = -91.74, y = 0, z = 80.89 },
x_axis: { x: -0.66, y: 0, z: -0.75 }, x_axis = { x = -0.66, y = 0, z = -0.75 },
y_axis: { x: 0, y: -1, z: 0 }, y_axis = { x = 0, y = -1, z = 0 },
z_axis: { x: -0.75, y: 0, z: 0.66 } z_axis = { x = -0.75, y = 0, z = 0.66 }
} }
})`) })`)
@ -505,19 +505,19 @@ sketch002 = startSketchOn(launderExtrudeThroughVar, seg02)
`part001 = startSketchOn('XZ') `part001 = startSketchOn('XZ')
|> startProfileAt([20, 0], %) |> startProfileAt([20, 0], %)
|> line([7.13, 4 + 0], %) |> line([7.13, 4 + 0], %)
|> angledLine({ angle: 3 + 0, length: 3.14 + 0 }, %) |> angledLine({ angle = 3 + 0, length = 3.14 + 0 }, %)
|> lineTo([20.14 + 0, -0.14 + 0], %) |> lineTo([20.14 + 0, -0.14 + 0], %)
|> xLineTo(29 + 0, %) |> xLineTo(29 + 0, %)
|> yLine(-3.14 + 0, %, $a) |> yLine(-3.14 + 0, %, $a)
|> xLine(1.63, %) |> xLine(1.63, %)
|> angledLineOfXLength({ angle: 3 + 0, length: 3.14 }, %) |> angledLineOfXLength({ angle = 3 + 0, length = 3.14 }, %)
|> angledLineOfYLength({ angle: 30, length: 3 + 0 }, %) |> angledLineOfYLength({ angle = 30, length = 3 + 0 }, %)
|> angledLineToX({ angle: 22.14 + 0, to: 12 }, %) |> angledLineToX({ angle = 22.14 + 0, to = 12 }, %)
|> angledLineToY({ angle: 30, to: 11.14 }, %) |> angledLineToY({ angle = 30, to = 11.14 }, %)
|> angledLineThatIntersects({ |> angledLineThatIntersects({
angle: 3.14, angle = 3.14,
intersectTag: a, intersectTag = a,
offset: 0 offset = 0
}, %) }, %)
|> tangentialArcTo([13.14 + 0, 13.14], %) |> tangentialArcTo([13.14 + 0, 13.14], %)
|> close(%) |> close(%)
@ -650,7 +650,7 @@ sketch002 = startSketchOn(launderExtrudeThroughVar, seg02)
await checkCodeAtHoverPosition( await checkCodeAtHoverPosition(
'flatExtrusionFace', 'flatExtrusionFace',
flatExtrusionFace, flatExtrusionFace,
`angledLineThatIntersects({angle:3.14,intersectTag:a,offset:0},%)extrude(5+7,%)`, `angledLineThatIntersects({angle=3.14,intersectTag=a,offset=0},%)extrude(5+7,%)`,
'}, %)' '}, %)'
) )
@ -707,19 +707,19 @@ sketch002 = startSketchOn(launderExtrudeThroughVar, seg02)
await checkCodeAtHoverPosition( await checkCodeAtHoverPosition(
'straightSegmentEdge', 'straightSegmentEdge',
straightSegmentEdge, straightSegmentEdge,
`angledLineToY({angle:30,to:11.14},%)`, `angledLineToY({angle=30,to=11.14},%)`,
'angledLineToY({ angle: 30, to: 11.14 }, %)' 'angledLineToY({ angle = 30, to = 11.14 }, %)'
) )
await checkCodeAtHoverPosition( await checkCodeAtHoverPosition(
'straightSegmentOppositeEdge', 'straightSegmentOppositeEdge',
straightSegmentOppositeEdge, straightSegmentOppositeEdge,
`angledLineToY({angle:30,to:11.14},%)`, `angledLineToY({angle=30,to=11.14},%)`,
'angledLineToY({ angle: 30, to: 11.14 }, %)' 'angledLineToY({ angle = 30, to = 11.14 }, %)'
) )
await checkCodeAtHoverPosition( await checkCodeAtHoverPosition(
'straightSegmentAdjacentEdge', 'straightSegmentAdjacentEdge',
straightSegmentAdjacentEdge, straightSegmentAdjacentEdge,
`angledLineThatIntersects({angle:3.14,intersectTag:a,offset:0},%)`, `angledLineThatIntersects({angle=3.14,intersectTag=a,offset=0},%)`,
'}, %)' '}, %)'
) )
@ -741,8 +741,8 @@ sketch002 = startSketchOn(launderExtrudeThroughVar, seg02)
|> close(%) |> close(%)
extrude001 = extrude(100, sketch001) extrude001 = extrude(100, sketch001)
|> chamfer({ |> chamfer({
length: 30, length = 30,
tags: [ tags = [
seg01, seg01,
getNextAdjacentEdge(yo), getNextAdjacentEdge(yo),
getNextAdjacentEdge(seg02), getNextAdjacentEdge(seg02),
@ -786,14 +786,14 @@ extrude001 = extrude(100, sketch001)
await checkCodeAtHoverPosition( await checkCodeAtHoverPosition(
'oppositeChamfer', 'oppositeChamfer',
oppositeChamfer, oppositeChamfer,
`angledLine([segAng(rectangleSegmentA001)-90,217.26],%,$seg01)chamfer({length:30,tags:[seg01,getNextAdjacentEdge(yo),getNextAdjacentEdge(seg02),getOppositeEdge(seg01)]},%)`, `angledLine([segAng(rectangleSegmentA001)-90,217.26],%,$seg01)chamfer({length=30,tags=[seg01,getNextAdjacentEdge(yo),getNextAdjacentEdge(seg02),getOppositeEdge(seg01)]},%)`,
'}, %)' '}, %)'
) )
await checkCodeAtHoverPosition( await checkCodeAtHoverPosition(
'baseChamfer', 'baseChamfer',
baseChamfer, baseChamfer,
`angledLine([segAng(rectangleSegmentA001)-90,217.26],%,$seg01)chamfer({length:30,tags:[seg01,getNextAdjacentEdge(yo),getNextAdjacentEdge(seg02),getOppositeEdge(seg01)]},%)`, `angledLine([segAng(rectangleSegmentA001)-90,217.26],%,$seg01)chamfer({length=30,tags=[seg01,getNextAdjacentEdge(yo),getNextAdjacentEdge(seg02),getOppositeEdge(seg01)]},%)`,
'}, %)' '}, %)'
) )
@ -824,14 +824,14 @@ extrude001 = extrude(100, sketch001)
await checkCodeAtHoverPosition( await checkCodeAtHoverPosition(
'adjacentChamfer1', 'adjacentChamfer1',
adjacentChamfer1, adjacentChamfer1,
`lineTo([profileStartX(%),profileStartY(%)],%,$seg02)chamfer({length:30,tags:[seg01,getNextAdjacentEdge(yo),getNextAdjacentEdge(seg02),getOppositeEdge(seg01)]},%)`, `lineTo([profileStartX(%),profileStartY(%)],%,$seg02)chamfer({length=30,tags=[seg01,getNextAdjacentEdge(yo),getNextAdjacentEdge(seg02),getOppositeEdge(seg01)]},%)`,
'}, %)' '}, %)'
) )
await checkCodeAtHoverPosition( await checkCodeAtHoverPosition(
'adjacentChamfer2', 'adjacentChamfer2',
adjacentChamfer2, adjacentChamfer2,
`angledLine([segAng(rectangleSegmentA001),-segLen(rectangleSegmentA001)],%,$yo)chamfer({length:30,tags:[seg01,getNextAdjacentEdge(yo),getNextAdjacentEdge(seg02),getOppositeEdge(seg01)]},%)`, `angledLine([segAng(rectangleSegmentA001),-segLen(rectangleSegmentA001)],%,$yo)chamfer({length=30,tags=[seg01,getNextAdjacentEdge(yo),getNextAdjacentEdge(seg02),getOppositeEdge(seg01)]},%)`,
'}, %)' '}, %)'
) )
}) })

View File

@ -518,27 +518,27 @@ ${!replace1 ? ` |> ${line}\n` : ''} |> angledLine([-65, ${
], ],
[ [
'angledLineOfXLength', 'angledLineOfXLength',
'angledLineOfXLength({ angle: 45.5, length: 198.85 }, %, $a)', 'angledLineOfXLength({ angle = 45.5, length = 198.85 }, %, $a)',
['283.7', '45.5'], ['283.7', '45.5'],
], ],
[ [
'angledLineOfYLength', 'angledLineOfYLength',
'angledLineOfYLength({ angle: 45.5, length: 198.85 }, %, $a)', 'angledLineOfYLength({ angle = 45.5, length = 198.85 }, %, $a)',
['278.79', '45.5'], ['278.79', '45.5'],
], ],
[ [
'angledLineToX', 'angledLineToX',
'angledLineToX({ angle: 45.5, to: 198.85 }, %, $a)', 'angledLineToX({ angle = 45.5, to = 198.85 }, %, $a)',
['231.33', '134.5'], ['231.33', '134.5'],
], ],
[ [
'angledLineToY', 'angledLineToY',
'angledLineToY({ angle: 45.5, to: 198.85 }, %, $a)', 'angledLineToY({ angle = 45.5, to = 198.85 }, %, $a)',
['134.51', '45.5'], ['134.51', '45.5'],
], ],
[ [
'angledLineThatIntersects', 'angledLineThatIntersects',
`angledLineThatIntersects({ angle: 45.5, intersectTag: b, offset: 198.85 }, %, $a)`, `angledLineThatIntersects({ angle = 45.5, intersectTag = b, offset = 198.85 }, %, $a)`,
['918.4', '45.5'], ['918.4', '45.5'],
], ],
])(`%s`, async (_, line, [replace1, replace2]) => { ])(`%s`, async (_, line, [replace1, replace2]) => {
@ -572,26 +572,26 @@ describe('Testing removeSingleConstraintInfo', () => {
const code = `part001 = startSketchOn('-XZ') const code = `part001 = startSketchOn('-XZ')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line([3 + 0, 4 + 0], %) |> line([3 + 0, 4 + 0], %)
|> angledLine({ angle: 3 + 0, length: 3.14 + 0 }, %) |> angledLine({ angle = 3 + 0, length = 3.14 + 0 }, %)
|> lineTo([6.14 + 0, 3.14 + 0], %) |> lineTo([6.14 + 0, 3.14 + 0], %)
|> xLineTo(8 + 0, %) |> xLineTo(8 + 0, %)
|> yLineTo(5 + 0, %) |> yLineTo(5 + 0, %)
|> yLine(3.14 + 0, %, $a) |> yLine(3.14 + 0, %, $a)
|> xLine(3.14 + 0, %) |> xLine(3.14 + 0, %)
|> angledLineOfXLength({ angle: 3 + 0, length: 3.14 + 0 }, %) |> angledLineOfXLength({ angle = 3 + 0, length = 3.14 + 0 }, %)
|> angledLineOfYLength({ angle: 30 + 0, length: 3 + 0 }, %) |> angledLineOfYLength({ angle = 30 + 0, length = 3 + 0 }, %)
|> angledLineToX({ angle: 12.14 + 0, to: 12 + 0 }, %) |> angledLineToX({ angle = 12.14 + 0, to = 12 + 0 }, %)
|> angledLineToY({ angle: 30 + 0, to: 10.14 + 0 }, %) |> angledLineToY({ angle = 30 + 0, to = 10.14 + 0 }, %)
|> angledLineThatIntersects({ |> angledLineThatIntersects({
angle: 3.14 + 0, angle = 3.14 + 0,
intersectTag: a, intersectTag = a,
offset: 0 + 0 offset = 0 + 0
}, %) }, %)
|> tangentialArcTo([3.14 + 0, 13.14 + 0], %)` |> tangentialArcTo([3.14 + 0, 13.14 + 0], %)`
test.each([ test.each([
[' line([3 + 0, 4], %)', 'arrayIndex', 1], [' line([3 + 0, 4], %)', 'arrayIndex', 1],
[ [
'angledLine({ angle: 3, length: 3.14 + 0 }, %)', 'angledLine({ angle = 3, length = 3.14 + 0 }, %)',
'objectProperty', 'objectProperty',
'angle', 'angle',
], ],
@ -601,30 +601,30 @@ describe('Testing removeSingleConstraintInfo', () => {
['yLine(3.14, %, $a)', '', ''], ['yLine(3.14, %, $a)', '', ''],
['xLine(3.14, %)', '', ''], ['xLine(3.14, %)', '', ''],
[ [
'angledLineOfXLength({ angle: 3, length: 3.14 + 0 }, %)', 'angledLineOfXLength({ angle = 3, length = 3.14 + 0 }, %)',
'objectProperty', 'objectProperty',
'angle', 'angle',
], ],
[ [
'angledLineOfYLength({ angle: 30 + 0, length: 3 }, %)', 'angledLineOfYLength({ angle = 30 + 0, length = 3 }, %)',
'objectProperty', 'objectProperty',
'length', 'length',
], ],
[ [
'angledLineToX({ angle: 12.14 + 0, to: 12 }, %)', 'angledLineToX({ angle = 12.14 + 0, to = 12 }, %)',
'objectProperty', 'objectProperty',
'to', 'to',
], ],
[ [
'angledLineToY({ angle: 30, to: 10.14 + 0 }, %)', 'angledLineToY({ angle = 30, to = 10.14 + 0 }, %)',
'objectProperty', 'objectProperty',
'angle', 'angle',
], ],
[ [
`angledLineThatIntersects({ `angledLineThatIntersects({
angle: 3.14 + 0, angle = 3.14 + 0,
offset: 0, offset = 0,
intersectTag: a intersectTag = a
}, %)`, }, %)`,
'objectProperty', 'objectProperty',
'offset', 'offset',
@ -801,11 +801,11 @@ sketch001 = startSketchOn('XZ')
|> lineTo([profileStartX(%), profileStartY(%)], %) |> lineTo([profileStartX(%), profileStartY(%)], %)
|> close(%) |> close(%)
sketch002 = startSketchOn({ sketch002 = startSketchOn({
plane: { plane = {
origin: { x: 1, y: 2, z: 3 }, origin = { x = 1, y = 2, z = 3 },
x_axis: { x: 4, y: 5, z: 6 }, x_axis = { x = 4, y = 5, z = 6 },
y_axis: { x: 7, y: 8, z: 9 }, y_axis = { x = 7, y = 8, z = 9 },
z_axis: { x: 10, y: 11, z: 12 } z_axis = { x = 10, y = 11, z = 12 }
} }
}) })
|> startProfileAt([-12.55, 2.89], %) |> startProfileAt([-12.55, 2.89], %)
@ -857,11 +857,11 @@ sketch001 = startSketchOn('XZ')
|> lineTo([profileStartX(%), profileStartY(%)], %) |> lineTo([profileStartX(%), profileStartY(%)], %)
|> close(%) |> close(%)
sketch002 = startSketchOn({ sketch002 = startSketchOn({
plane: { plane = {
origin: { x: 1, y: 2, z: 3 }, origin = { x = 1, y = 2, z = 3 },
x_axis: { x: 4, y: 5, z: 6 }, x_axis = { x = 4, y = 5, z = 6 },
y_axis: { x: 7, y: 8, z: 9 }, y_axis = { x = 7, y = 8, z = 9 },
z_axis: { x: 10, y: 11, z: 12 } z_axis = { x = 10, y = 11, z = 12 }
} }
}) })
|> startProfileAt([-12.55, 2.89], %) |> startProfileAt([-12.55, 2.89], %)

View File

@ -330,7 +330,7 @@ extrude001 = extrude(-15, sketch001)`
|> lineTo([profileStartX(%), profileStartY(%)], %) |> lineTo([profileStartX(%), profileStartY(%)], %)
|> close(%) |> close(%)
extrude001 = extrude(-15, sketch001) extrude001 = extrude(-15, sketch001)
|> fillet({ radius: 3, tags: [seg01] }, %)` |> fillet({ radius = 3, tags = [seg01] }, %)`
await runModifyAstCloneWithFilletAndTag( await runModifyAstCloneWithFilletAndTag(
code, code,
@ -358,7 +358,7 @@ extrude001 = extrude(-15, sketch001)
|> lineTo([profileStartX(%), profileStartY(%)], %) |> lineTo([profileStartX(%), profileStartY(%)], %)
|> close(%) |> close(%)
|> extrude(-15, %) |> extrude(-15, %)
|> fillet({ radius: 3, tags: [seg01] }, %)` |> fillet({ radius = 3, tags = [seg01] }, %)`
await runModifyAstCloneWithFilletAndTag( await runModifyAstCloneWithFilletAndTag(
code, code,
@ -386,7 +386,7 @@ extrude001 = extrude(-15, sketch001)`
|> lineTo([profileStartX(%), profileStartY(%)], %) |> lineTo([profileStartX(%), profileStartY(%)], %)
|> close(%) |> close(%)
extrude001 = extrude(-15, sketch001) extrude001 = extrude(-15, sketch001)
|> fillet({ radius: 3, tags: [seg01] }, %)` |> fillet({ radius = 3, tags = [seg01] }, %)`
await runModifyAstCloneWithFilletAndTag( await runModifyAstCloneWithFilletAndTag(
code, code,
@ -414,7 +414,7 @@ extrude001 = extrude(-15, sketch001)`
|> lineTo([profileStartX(%), profileStartY(%)], %) |> lineTo([profileStartX(%), profileStartY(%)], %)
|> close(%) |> close(%)
extrude001 = extrude(-15, sketch001) extrude001 = extrude(-15, sketch001)
|> fillet({ radius: 3, tags: [seg02] }, %)` |> fillet({ radius = 3, tags = [seg02] }, %)`
await runModifyAstCloneWithFilletAndTag( await runModifyAstCloneWithFilletAndTag(
code, code,
@ -432,7 +432,7 @@ extrude001 = extrude(-15, sketch001)
|> lineTo([profileStartX(%), profileStartY(%)], %) |> lineTo([profileStartX(%), profileStartY(%)], %)
|> close(%) |> close(%)
extrude001 = extrude(-15, sketch001) extrude001 = extrude(-15, sketch001)
|> fillet({ radius: 5, tags: [seg01] }, %)` |> fillet({ radius = 5, tags = [seg01] }, %)`
const segmentSnippets = ['line([-20, 0], %)'] const segmentSnippets = ['line([-20, 0], %)']
const radiusValue = 3 const radiusValue = 3
const expectedCode = `sketch001 = startSketchOn('XY') const expectedCode = `sketch001 = startSketchOn('XY')
@ -443,8 +443,8 @@ extrude001 = extrude(-15, sketch001)
|> lineTo([profileStartX(%), profileStartY(%)], %) |> lineTo([profileStartX(%), profileStartY(%)], %)
|> close(%) |> close(%)
extrude001 = extrude(-15, sketch001) extrude001 = extrude(-15, sketch001)
|> fillet({ radius: 5, tags: [seg01] }, %) |> fillet({ radius = 5, tags = [seg01] }, %)
|> fillet({ radius: 3, tags: [seg02] }, %)` |> fillet({ radius = 3, tags = [seg02] }, %)`
await runModifyAstCloneWithFilletAndTag( await runModifyAstCloneWithFilletAndTag(
code, code,
@ -472,7 +472,7 @@ extrude001 = extrude(-15, sketch001)`
|> lineTo([profileStartX(%), profileStartY(%)], %) |> lineTo([profileStartX(%), profileStartY(%)], %)
|> close(%) |> close(%)
extrude001 = extrude(-15, sketch001) extrude001 = extrude(-15, sketch001)
|> fillet({ radius: 3, tags: [seg01, seg02] }, %)` |> fillet({ radius = 3, tags = [seg01, seg02] }, %)`
await runModifyAstCloneWithFilletAndTag( await runModifyAstCloneWithFilletAndTag(
code, code,
@ -512,7 +512,7 @@ extrude002 = extrude(-25, sketch002)` // <--- body 2
|> lineTo([profileStartX(%), profileStartY(%)], %) |> lineTo([profileStartX(%), profileStartY(%)], %)
|> close(%) |> close(%)
extrude001 = extrude(-15, sketch001) extrude001 = extrude(-15, sketch001)
|> fillet({ radius: 3, tags: [seg01, seg02] }, %) |> fillet({ radius = 3, tags = [seg01, seg02] }, %)
sketch002 = startSketchOn('XY') sketch002 = startSketchOn('XY')
|> startProfileAt([30, 10], %) |> startProfileAt([30, 10], %)
|> line([15, 0], %) |> line([15, 0], %)
@ -521,7 +521,7 @@ sketch002 = startSketchOn('XY')
|> lineTo([profileStartX(%), profileStartY(%)], %) |> lineTo([profileStartX(%), profileStartY(%)], %)
|> close(%) |> close(%)
extrude002 = extrude(-25, sketch002) extrude002 = extrude(-25, sketch002)
|> fillet({ radius: 3, tags: [seg03] }, %)` // <-- able to add a new one |> fillet({ radius = 3, tags = [seg03] }, %)` // <-- able to add a new one
await runModifyAstCloneWithFilletAndTag( await runModifyAstCloneWithFilletAndTag(
code, code,
@ -541,8 +541,8 @@ describe('Testing isTagUsedInFillet', () => {
|> close(%) |> close(%)
extrude001 = extrude(-5, sketch001) extrude001 = extrude(-5, sketch001)
|> fillet({ |> fillet({
radius: 1.11, radius = 1.11,
tags: [ tags = [
getOppositeEdge(seg01), getOppositeEdge(seg01),
seg01, seg01,
getPreviousAdjacentEdge(seg02) getPreviousAdjacentEdge(seg02)

View File

@ -173,10 +173,10 @@ log(5, myVar)
it('recast long object execution', () => { it('recast long object execution', () => {
const code = `three = 3 const code = `three = 3
yo = { yo = {
aStr: 'str', aStr = 'str',
anum: 2, anum = 2,
identifier: three, identifier = three,
binExp: 4 + 5 binExp = 4 + 5
} }
` `
const { ast } = code2ast(code) const { ast } = code2ast(code)
@ -185,7 +185,7 @@ yo = {
expect(recasted).toBe(code) expect(recasted).toBe(code)
}) })
it('recast short object execution', () => { it('recast short object execution', () => {
const code = `yo = { key: 'val' } const code = `yo = { key = 'val' }
` `
const { ast } = code2ast(code) const { ast } = code2ast(code)
const recasted = recast(ast) const recasted = recast(ast)
@ -193,7 +193,7 @@ yo = {
expect(recasted).toBe(code) expect(recasted).toBe(code)
}) })
it('recast object execution with member expression', () => { it('recast object execution with member expression', () => {
const code = `yo = { a: { b: { c: '123' } } } const code = `yo = { a = { b = { c = '123' } } }
key = 'c' key = 'c'
myVar = yo.a['b'][key] myVar = yo.a['b'][key]
key2 = 'b' key2 = 'b'
@ -208,7 +208,7 @@ myVar2 = yo['a'][key2].c
describe('testing recasting with comments and whitespace', () => { describe('testing recasting with comments and whitespace', () => {
it('code with comments', () => { it('code with comments', () => {
const code = `yo = { a: { b: { c: '123' } } } const code = `yo = { a = { b = { c = '123' } } }
// this is a comment // this is a comment
key = 'c' key = 'c'
` `
@ -234,7 +234,7 @@ yo = 'bing'
}) })
it('comments at the start and end', () => { it('comments at the start and end', () => {
const code = `// this is a comment const code = `// this is a comment
yo = { a: { b: { c: '123' } } } yo = { a = { b = { c = '123' } } }
key = 'c' key = 'c'
// this is also a comment // this is also a comment
@ -247,7 +247,7 @@ key = 'c'
it('comments in a fn block', () => { it('comments in a fn block', () => {
const code = `fn myFn = () => { const code = `fn myFn = () => {
// this is a comment // this is a comment
yo = { a: { b: { c: '123' } } } yo = { a = { b = { c = '123' } } }
/* block /* block
comment */ comment */
@ -357,9 +357,9 @@ describe('it recasts wrapped object expressions in pipe bodies with correct inde
|> line([0.62, 4.15], %, $seg01) |> line([0.62, 4.15], %, $seg01)
|> line([2.77, -1.24], %) |> line([2.77, -1.24], %)
|> angledLineThatIntersects({ |> angledLineThatIntersects({
angle: 201, angle = 201,
offset: -1.35, offset = -1.35,
intersectTag: $seg01 intersectTag = $seg01
}, %) }, %)
|> line([-0.42, -1.72], %) |> line([-0.42, -1.72], %)
` `
@ -370,9 +370,9 @@ describe('it recasts wrapped object expressions in pipe bodies with correct inde
}) })
it('recasts wrapped object expressions NOT in pipe body correctly', () => { it('recasts wrapped object expressions NOT in pipe body correctly', () => {
const code = `angledLineThatIntersects({ const code = `angledLineThatIntersects({
angle: 201, angle = 201,
offset: -1.35, offset = -1.35,
intersectTag: $seg01 intersectTag = $seg01
}, %) }, %)
` `
const { ast } = code2ast(code) const { ast } = code2ast(code)

View File

@ -248,26 +248,26 @@ describe('testing addTagForSketchOnFace', () => {
{ {
desc: 'chamfer in pipeExpr', desc: 'chamfer in pipeExpr',
originalChamfer: ` |> chamfer({ originalChamfer: ` |> chamfer({
length: 30, length = 30,
tags: [seg01, getOppositeEdge(seg01)] tags = [seg01, getOppositeEdge(seg01)]
}, %)`, }, %)`,
expectedChamfer: ` |> chamfer({ expectedChamfer: ` |> chamfer({
length: 30, length = 30,
tags: [getOppositeEdge(seg01)] tags = [getOppositeEdge(seg01)]
}, %, $seg03) }, %, $seg03)
|> chamfer({ length: 30, tags: [seg01] }, %)`, |> chamfer({ length = 30, tags = [seg01] }, %)`,
}, },
{ {
desc: 'chamfer with its own variable', desc: 'chamfer with its own variable',
originalChamfer: `chamf = chamfer({ originalChamfer: `chamf = chamfer({
length: 30, length = 30,
tags: [seg01, getOppositeEdge(seg01)] tags = [seg01, getOppositeEdge(seg01)]
}, extrude001)`, }, extrude001)`,
expectedChamfer: `chamf = chamfer({ expectedChamfer: `chamf = chamfer({
length: 30, length = 30,
tags: [getOppositeEdge(seg01)] tags = [getOppositeEdge(seg01)]
}, extrude001, $seg03) }, extrude001, $seg03)
|> chamfer({ length: 30, tags: [seg01] }, %)`, |> chamfer({ length = 30, tags = [seg01] }, %)`,
}, },
// Add more test cases here if needed // Add more test cases here if needed
] as const ] as const
@ -329,8 +329,8 @@ describe('testing getConstraintInfo', () => {
|> startProfileAt([0,0], %) |> startProfileAt([0,0], %)
|> line([3, 4], %) |> line([3, 4], %)
|> angledLine({ |> angledLine({
angle: 3.14, angle = 3.14,
length: 3.14, length = 3.14,
}, %) }, %)
|> lineTo([6.14, 3.14], %) |> lineTo([6.14, 3.14], %)
|> xLineTo(8, %) |> xLineTo(8, %)
@ -338,25 +338,25 @@ describe('testing getConstraintInfo', () => {
|> yLine(3.14, %, 'a') |> yLine(3.14, %, 'a')
|> xLine(3.14, %) |> xLine(3.14, %)
|> angledLineOfXLength({ |> angledLineOfXLength({
angle: 3.14, angle = 3.14,
length: 3.14, length = 3.14,
}, %) }, %)
|> angledLineOfYLength({ |> angledLineOfYLength({
angle: 30, angle = 30,
length: 3, length = 3,
}, %) }, %)
|> angledLineToX({ |> angledLineToX({
angle: 12.14, angle = 12.14,
to: 12, to = 12,
}, %) }, %)
|> angledLineToY({ |> angledLineToY({
angle: 30, angle = 30,
to: 10.14, to = 10.14,
}, %) }, %)
|> angledLineThatIntersects({ |> angledLineThatIntersects({
angle: 3.14, angle = 3.14,
intersectTag: 'a', intersectTag = 'a',
offset: 0 offset = 0
}, %) }, %)
|> tangentialArcTo([3.14, 13.14], %)` |> tangentialArcTo([3.14, 13.14], %)`
const ast = parse(code) const ast = parse(code)
@ -713,9 +713,9 @@ describe('testing getConstraintInfo', () => {
|> angledLineToX([12, 12], %) |> angledLineToX([12, 12], %)
|> angledLineToY([30, 10], %) |> angledLineToY([30, 10], %)
|> angledLineThatIntersects({ |> angledLineThatIntersects({
angle: 3.14, angle = 3.14,
intersectTag: 'a', intersectTag = 'a',
offset: 0 offset = 0
}, %) }, %)
|> tangentialArcTo([3.14, 13.14], %)` |> tangentialArcTo([3.14, 13.14], %)`
const ast = parse(code) const ast = parse(code)
@ -856,20 +856,20 @@ describe('testing getConstraintInfo', () => {
const code = `const part001 = startSketchOn('-XZ') const code = `const part001 = startSketchOn('-XZ')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line([3 + 0, 4 + 0], %) |> line([3 + 0, 4 + 0], %)
|> angledLine({ angle: 3.14 + 0, length: 3.14 + 0 }, %) |> angledLine({ angle = 3.14 + 0, length = 3.14 + 0 }, %)
|> lineTo([6.14 + 0, 3.14 + 0], %) |> lineTo([6.14 + 0, 3.14 + 0], %)
|> xLineTo(8 + 0, %) |> xLineTo(8 + 0, %)
|> yLineTo(5 + 0, %) |> yLineTo(5 + 0, %)
|> yLine(3.14 + 0, %, 'a') |> yLine(3.14 + 0, %, 'a')
|> xLine(3.14 + 0, %) |> xLine(3.14 + 0, %)
|> angledLineOfXLength({ angle: 3.14 + 0, length: 3.14 + 0 }, %) |> angledLineOfXLength({ angle = 3.14 + 0, length = 3.14 + 0 }, %)
|> angledLineOfYLength({ angle: 30 + 0, length: 3 + 0 }, %) |> angledLineOfYLength({ angle = 30 + 0, length = 3 + 0 }, %)
|> angledLineToX({ angle: 12.14 + 0, to: 12 + 0 }, %) |> angledLineToX({ angle = 12.14 + 0, to = 12 + 0 }, %)
|> angledLineToY({ angle: 30 + 0, to: 10.14 + 0 }, %) |> angledLineToY({ angle = 30 + 0, to = 10.14 + 0 }, %)
|> angledLineThatIntersects({ |> angledLineThatIntersects({
angle: 3.14 + 0, angle = 3.14 + 0,
intersectTag: 'a', intersectTag = 'a',
offset: 0 + 0 offset = 0 + 0
}, %) }, %)
|> tangentialArcTo([3.14 + 0, 13.14 + 0], %)` |> tangentialArcTo([3.14 + 0, 13.14 + 0], %)`
const ast = parse(code) const ast = parse(code)

View File

@ -75,11 +75,11 @@ describe('testing swapping out sketch calls with xLine/xLineTo', () => {
` |> startProfileAt([0, 0], %)`, ` |> startProfileAt([0, 0], %)`,
` |> lineTo([1, 1], %, $abc1)`, ` |> lineTo([1, 1], %, $abc1)`,
` |> line([-2.04, -0.7], %, $abc2)`, ` |> line([-2.04, -0.7], %, $abc2)`,
` |> angledLine({ angle: 157, length: 1.69 }, %, $abc3)`, ` |> angledLine({ angle = 157, length = 1.69 }, %, $abc3)`,
` |> angledLineOfXLength({ angle: 217, length: 0.86 }, %, $abc4)`, ` |> angledLineOfXLength({ angle = 217, length = 0.86 }, %, $abc4)`,
` |> angledLineOfYLength({ angle: 104, length: 1.58 }, %, $abc5)`, ` |> angledLineOfYLength({ angle = 104, length = 1.58 }, %, $abc5)`,
` |> angledLineToX({ angle: 55, to: -2.89 }, %, $abc6)`, ` |> angledLineToX({ angle = 55, to = -2.89 }, %, $abc6)`,
` |> angledLineToY({ angle: 330, to: 2.53 }, %, $abc7)`, ` |> angledLineToY({ angle = 330, to = 2.53 }, %, $abc7)`,
` |> xLine(1.47, %, $abc8)`, ` |> xLine(1.47, %, $abc8)`,
` |> yLine(1.57, %, $abc9)`, ` |> yLine(1.57, %, $abc9)`,
` |> xLineTo(1.49, %, $abc10)`, ` |> xLineTo(1.49, %, $abc10)`,
@ -146,7 +146,7 @@ describe('testing swapping out sketch calls with xLine/xLineTo', () => {
it('angledLine with tag converts to xLine', async () => { it('angledLine with tag converts to xLine', async () => {
const { newCode, originalRange } = await testingSwapSketchFnCall({ const { newCode, originalRange } = await testingSwapSketchFnCall({
inputCode: bigExample, inputCode: bigExample,
callToSwap: 'angledLine({ angle: 157, length: 1.69 }, %, $abc3)', callToSwap: 'angledLine({ angle = 157, length = 1.69 }, %, $abc3)',
constraintType: 'horizontal', constraintType: 'horizontal',
}) })
const expectedLine = 'xLine(-1.56, %, $abc3)' const expectedLine = 'xLine(-1.56, %, $abc3)'
@ -169,7 +169,8 @@ describe('testing swapping out sketch calls with xLine/xLineTo', () => {
it('angledLineOfXLength with tag converts to xLine', async () => { it('angledLineOfXLength with tag converts to xLine', async () => {
const { newCode, originalRange } = await testingSwapSketchFnCall({ const { newCode, originalRange } = await testingSwapSketchFnCall({
inputCode: bigExample, inputCode: bigExample,
callToSwap: 'angledLineOfXLength({ angle: 217, length: 0.86 }, %, $abc4)', callToSwap:
'angledLineOfXLength({ angle = 217, length = 0.86 }, %, $abc4)',
constraintType: 'horizontal', constraintType: 'horizontal',
}) })
const expectedLine = 'xLine(-0.86, %, $abc4)' const expectedLine = 'xLine(-0.86, %, $abc4)'
@ -192,7 +193,8 @@ describe('testing swapping out sketch calls with xLine/xLineTo', () => {
it('angledLineOfYLength with tag converts to yLine', async () => { it('angledLineOfYLength with tag converts to yLine', async () => {
const { newCode, originalRange } = await testingSwapSketchFnCall({ const { newCode, originalRange } = await testingSwapSketchFnCall({
inputCode: bigExample, inputCode: bigExample,
callToSwap: 'angledLineOfYLength({ angle: 104, length: 1.58 }, %, $abc5)', callToSwap:
'angledLineOfYLength({ angle = 104, length = 1.58 }, %, $abc5)',
constraintType: 'vertical', constraintType: 'vertical',
}) })
const expectedLine = 'yLine(1.58, %, $abc5)' const expectedLine = 'yLine(1.58, %, $abc5)'
@ -214,7 +216,7 @@ describe('testing swapping out sketch calls with xLine/xLineTo', () => {
it('angledLineToX with tag converts to xLineTo', async () => { it('angledLineToX with tag converts to xLineTo', async () => {
const { newCode, originalRange } = await testingSwapSketchFnCall({ const { newCode, originalRange } = await testingSwapSketchFnCall({
inputCode: bigExample, inputCode: bigExample,
callToSwap: 'angledLineToX({ angle: 55, to: -2.89 }, %, $abc6)', callToSwap: 'angledLineToX({ angle = 55, to = -2.89 }, %, $abc6)',
constraintType: 'horizontal', constraintType: 'horizontal',
}) })
const expectedLine = 'xLineTo(-2.89, %, $abc6)' const expectedLine = 'xLineTo(-2.89, %, $abc6)'
@ -236,7 +238,7 @@ describe('testing swapping out sketch calls with xLine/xLineTo', () => {
it('angledLineToY with tag converts to yLineTo', async () => { it('angledLineToY with tag converts to yLineTo', async () => {
const { newCode, originalRange } = await testingSwapSketchFnCall({ const { newCode, originalRange } = await testingSwapSketchFnCall({
inputCode: bigExample, inputCode: bigExample,
callToSwap: 'angledLineToY({ angle: 330, to: 2.53 }, %, $abc7)', callToSwap: 'angledLineToY({ angle = 330, to = 2.53 }, %, $abc7)',
constraintType: 'vertical', constraintType: 'vertical',
}) })
const expectedLine = 'yLineTo(2.53, %, $abc7)' const expectedLine = 'yLineTo(2.53, %, $abc7)'

View File

@ -1569,7 +1569,7 @@ insideRevolve = startSketchOn('XZ')
|> line([0, -thickness], %) |> line([0, -thickness], %)
|> line([-overHangLength, 0], %) |> line([-overHangLength, 0], %)
|> close(%) |> close(%)
|> revolve({ axis: 'y' }, %) |> revolve({ axis = 'y' }, %)
// Sketch and revolve one of the balls and duplicate it using a circular pattern. (This is currently a workaround, we have a bug with rotating on a sketch that touches the rotation axis) // Sketch and revolve one of the balls and duplicate it using a circular pattern. (This is currently a workaround, we have a bug with rotating on a sketch that touches the rotation axis)
sphere = startSketchOn('XZ') sphere = startSketchOn('XZ')
@ -1579,18 +1579,18 @@ sphere = startSketchOn('XZ')
], %) ], %)
|> line([sphereDia - 0.1, 0], %) |> line([sphereDia - 0.1, 0], %)
|> arc({ |> arc({
angle_start: 0, angle_start = 0,
angle_end: -180, angle_end = -180,
radius: sphereDia / 2 - 0.05 radius = sphereDia / 2 - 0.05
}, %) }, %)
|> close(%) |> close(%)
|> revolve({ axis: 'x' }, %) |> revolve({ axis = 'x' }, %)
|> patternCircular3d({ |> patternCircular3d({
axis: [0, 0, 1], axis = [0, 0, 1],
center: [0, 0, 0], center = [0, 0, 0],
repetitions: 10, repetitions = 10,
arcDegrees: 360, arcDegrees = 360,
rotateDuplicates: true rotateDuplicates = true
}, %) }, %)
// Sketch and revolve the outside bearing // Sketch and revolve the outside bearing
@ -1608,7 +1608,7 @@ outsideRevolve = startSketchOn('XZ')
|> line([0, thickness], %) |> line([0, thickness], %)
|> line([overHangLength - thickness, 0], %) |> line([overHangLength - thickness, 0], %)
|> close(%) |> close(%)
|> revolve({ axis: 'y' }, %)"# |> revolve({ axis = 'y' }, %)"#
); );
} }

View File

@ -552,13 +552,6 @@ fn shebang(i: TokenSlice) -> PResult<Node<NonCodeNode>> {
)) ))
} }
/// Parse the = operator.
fn equals(i: TokenSlice) -> PResult<Token> {
one_of((TokenType::Operator, "="))
.context(expected("the equals operator, ="))
.parse_next(i)
}
#[allow(clippy::large_enum_variant)] #[allow(clippy::large_enum_variant)]
pub enum NonCodeOr<T> { pub enum NonCodeOr<T> {
NonCode(Node<NonCodeNode>), NonCode(Node<NonCodeNode>),
@ -692,11 +685,12 @@ fn object_property_same_key_and_val(i: TokenSlice) -> PResult<Node<ObjectPropert
} }
fn object_property(i: TokenSlice) -> PResult<Node<ObjectProperty>> { fn object_property(i: TokenSlice) -> PResult<Node<ObjectProperty>> {
let key = identifier.context(expected("the property's key (the name or identifier of the property), e.g. in 'height: 4', 'height' is the property key")).parse_next(i)?; let key = identifier.context(expected("the property's key (the name or identifier of the property), e.g. in 'height = 4', 'height' is the property key")).parse_next(i)?;
ignore_whitespace(i); ignore_whitespace(i);
colon // Temporarily accept both `:` and `=` for compatibility.
alt((colon, equals))
.context(expected( .context(expected(
"a colon, which separates the property's key from the value you're setting it to, e.g. 'height: 4'", "`=`, which separates the property's key from the value you're setting it to, e.g. 'height = 4'",
)) ))
.parse_next(i)?; .parse_next(i)?;
ignore_whitespace(i); ignore_whitespace(i);
@ -1933,6 +1927,13 @@ fn colon(i: TokenSlice) -> PResult<()> {
Ok(()) Ok(())
} }
fn equals(i: TokenSlice) -> PResult<()> {
one_of((TokenType::Operator, "="))
.context(expected("the equals operator, ="))
.parse_next(i)?;
Ok(())
}
fn question_mark(i: TokenSlice) -> PResult<()> { fn question_mark(i: TokenSlice) -> PResult<()> {
TokenType::QuestionMark.parse_from(i)?; TokenType::QuestionMark.parse_from(i)?;
Ok(()) Ok(())

View File

@ -61,6 +61,9 @@ fn unparse(test_name: &str) {
}; };
// Check recasting the AST produces the original string. // Check recasting the AST produces the original string.
let actual = ast.recast(&Default::default(), 0); let actual = ast.recast(&Default::default(), 0);
if matches!(std::env::var("EXPECTORATE").as_deref(), Ok("overwrite")) {
std::fs::write(format!("tests/{test_name}/input.kcl"), &actual).unwrap();
}
let expected = read("input.kcl", test_name); let expected = read("input.kcl", test_name);
pretty_assertions::assert_eq!( pretty_assertions::assert_eq!(
actual, actual,

View File

@ -57,8 +57,8 @@ pub async fn chamfer(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
/// ///
/// const mountingPlate = extrude(thickness, mountingPlateSketch) /// const mountingPlate = extrude(thickness, mountingPlateSketch)
/// |> chamfer({ /// |> chamfer({
/// length: chamferLength, /// length = chamferLength,
/// tags: [ /// tags = [
/// getNextAdjacentEdge(edge1), /// getNextAdjacentEdge(edge1),
/// getNextAdjacentEdge(edge2), /// getNextAdjacentEdge(edge2),
/// getNextAdjacentEdge(edge3), /// getNextAdjacentEdge(edge3),
@ -83,8 +83,8 @@ pub async fn chamfer(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
/// |> close(%, $line1) /// |> close(%, $line1)
/// |> extrude(20, %) /// |> extrude(20, %)
/// |> chamfer({ /// |> chamfer({
/// length: 10, /// length = 10,
/// tags: [getOppositeEdge(line1)] /// tags = [getOppositeEdge(line1)]
/// }, %, $chamfer1) // We tag the chamfer to reference it later. /// }, %, $chamfer1) // We tag the chamfer to reference it later.
/// ///
/// const sketch001 = startSketchOn(part001, chamfer1) /// const sketch001 = startSketchOn(part001, chamfer1)

View File

@ -52,10 +52,10 @@ pub async fn int(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
/// assertEqual(n, 3, 0.0001, "5/2 = 2.5, rounded up makes 3") /// assertEqual(n, 3, 0.0001, "5/2 = 2.5, rounded up makes 3")
/// // Draw n cylinders. /// // Draw n cylinders.
/// startSketchOn('XZ') /// startSketchOn('XZ')
/// |> circle({ center: [0, 0], radius: 2 }, %) /// |> circle({ center = [0, 0], radius = 2 }, %)
/// |> extrude(5, %) /// |> extrude(5, %)
/// |> patternTransform(n, (id) => { /// |> patternTransform(n, (id) => {
/// return { translate: [4 * id, 0, 0] } /// return { translate = [4 * id, 0, 0] }
/// }, %) /// }, %)
/// ``` /// ```
#[stdlib { #[stdlib {

View File

@ -35,16 +35,16 @@ pub async fn extrude(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
/// |> startProfileAt([0, 0], %) /// |> startProfileAt([0, 0], %)
/// |> line([10, 0], %) /// |> line([10, 0], %)
/// |> arc({ /// |> arc({
/// angleStart: 120, /// angleStart = 120,
/// angleEnd: 0, /// angleEnd = 0,
/// radius: 5, /// radius = 5,
/// }, %) /// }, %)
/// |> line([5, 0], %) /// |> line([5, 0], %)
/// |> line([0, 10], %) /// |> line([0, 10], %)
/// |> bezierCurve({ /// |> bezierCurve({
/// control1: [-10, 0], /// control1 = [-10, 0],
/// control2: [2, 10], /// control2 = [2, 10],
/// to: [-5, 10], /// to = [-5, 10],
/// }, %) /// }, %)
/// |> line([-5, -2], %) /// |> line([-5, -2], %)
/// |> close(%) /// |> close(%)
@ -55,16 +55,16 @@ pub async fn extrude(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
/// const exampleSketch = startSketchOn('XZ') /// const exampleSketch = startSketchOn('XZ')
/// |> startProfileAt([-10, 0], %) /// |> startProfileAt([-10, 0], %)
/// |> arc({ /// |> arc({
/// angleStart: 120, /// angleStart = 120,
/// angleEnd: -60, /// angleEnd = -60,
/// radius: 5, /// radius = 5,
/// }, %) /// }, %)
/// |> line([10, 0], %) /// |> line([10, 0], %)
/// |> line([5, 0], %) /// |> line([5, 0], %)
/// |> bezierCurve({ /// |> bezierCurve({
/// control1: [-3, 0], /// control1 = [-3, 0],
/// control2: [2, 10], /// control2 = [2, 10],
/// to: [-5, 10], /// to = [-5, 10],
/// }, %) /// }, %)
/// |> line([-4, 10], %) /// |> line([-4, 10], %)
/// |> line([-5, -2], %) /// |> line([-5, -2], %)

View File

@ -82,8 +82,8 @@ pub async fn fillet(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
/// ///
/// const mountingPlate = extrude(thickness, mountingPlateSketch) /// const mountingPlate = extrude(thickness, mountingPlateSketch)
/// |> fillet({ /// |> fillet({
/// radius: filletRadius, /// radius = filletRadius,
/// tags: [ /// tags = [
/// getNextAdjacentEdge(edge1), /// getNextAdjacentEdge(edge1),
/// getNextAdjacentEdge(edge2), /// getNextAdjacentEdge(edge2),
/// getNextAdjacentEdge(edge3), /// getNextAdjacentEdge(edge3),
@ -107,9 +107,9 @@ pub async fn fillet(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
/// ///
/// const mountingPlate = extrude(thickness, mountingPlateSketch) /// const mountingPlate = extrude(thickness, mountingPlateSketch)
/// |> fillet({ /// |> fillet({
/// radius: filletRadius, /// radius = filletRadius,
/// tolerance: 0.000001, /// tolerance = 0.000001,
/// tags: [ /// tags = [
/// getNextAdjacentEdge(edge1), /// getNextAdjacentEdge(edge1),
/// getNextAdjacentEdge(edge2), /// getNextAdjacentEdge(edge2),
/// getNextAdjacentEdge(edge3), /// getNextAdjacentEdge(edge3),
@ -199,24 +199,24 @@ pub async fn get_opposite_edge(exec_state: &mut ExecState, args: Args) -> Result
/// |> startProfileAt([0, 0], %) /// |> startProfileAt([0, 0], %)
/// |> line([10, 0], %) /// |> line([10, 0], %)
/// |> angledLine({ /// |> angledLine({
/// angle: 60, /// angle = 60,
/// length: 10, /// length = 10,
/// }, %) /// }, %)
/// |> angledLine({ /// |> angledLine({
/// angle: 120, /// angle = 120,
/// length: 10, /// length = 10,
/// }, %) /// }, %)
/// |> line([-10, 0], %) /// |> line([-10, 0], %)
/// |> angledLine({ /// |> angledLine({
/// angle: 240, /// angle = 240,
/// length: 10, /// length = 10,
/// }, %, $referenceEdge) /// }, %, $referenceEdge)
/// |> close(%) /// |> close(%)
/// ///
/// const example = extrude(5, exampleSketch) /// const example = extrude(5, exampleSketch)
/// |> fillet({ /// |> fillet({
/// radius: 3, /// radius = 3,
/// tags: [getOppositeEdge(referenceEdge)], /// tags = [getOppositeEdge(referenceEdge)],
/// }, %) /// }, %)
/// ``` /// ```
#[stdlib { #[stdlib {
@ -272,24 +272,24 @@ pub async fn get_next_adjacent_edge(exec_state: &mut ExecState, args: Args) -> R
/// |> startProfileAt([0, 0], %) /// |> startProfileAt([0, 0], %)
/// |> line([10, 0], %) /// |> line([10, 0], %)
/// |> angledLine({ /// |> angledLine({
/// angle: 60, /// angle = 60,
/// length: 10, /// length = 10,
/// }, %) /// }, %)
/// |> angledLine({ /// |> angledLine({
/// angle: 120, /// angle = 120,
/// length: 10, /// length = 10,
/// }, %) /// }, %)
/// |> line([-10, 0], %) /// |> line([-10, 0], %)
/// |> angledLine({ /// |> angledLine({
/// angle: 240, /// angle = 240,
/// length: 10, /// length = 10,
/// }, %, $referenceEdge) /// }, %, $referenceEdge)
/// |> close(%) /// |> close(%)
/// ///
/// const example = extrude(5, exampleSketch) /// const example = extrude(5, exampleSketch)
/// |> fillet({ /// |> fillet({
/// radius: 3, /// radius = 3,
/// tags: [getNextAdjacentEdge(referenceEdge)], /// tags = [getNextAdjacentEdge(referenceEdge)],
/// }, %) /// }, %)
/// ``` /// ```
#[stdlib { #[stdlib {
@ -357,24 +357,24 @@ pub async fn get_previous_adjacent_edge(exec_state: &mut ExecState, args: Args)
/// |> startProfileAt([0, 0], %) /// |> startProfileAt([0, 0], %)
/// |> line([10, 0], %) /// |> line([10, 0], %)
/// |> angledLine({ /// |> angledLine({
/// angle: 60, /// angle = 60,
/// length: 10, /// length = 10,
/// }, %) /// }, %)
/// |> angledLine({ /// |> angledLine({
/// angle: 120, /// angle = 120,
/// length: 10, /// length = 10,
/// }, %) /// }, %)
/// |> line([-10, 0], %) /// |> line([-10, 0], %)
/// |> angledLine({ /// |> angledLine({
/// angle: 240, /// angle = 240,
/// length: 10, /// length = 10,
/// }, %, $referenceEdge) /// }, %, $referenceEdge)
/// |> close(%) /// |> close(%)
/// ///
/// const example = extrude(5, exampleSketch) /// const example = extrude(5, exampleSketch)
/// |> fillet({ /// |> fillet({
/// radius: 3, /// radius = 3,
/// tags: [getPreviousAdjacentEdge(referenceEdge)], /// tags = [getPreviousAdjacentEdge(referenceEdge)],
/// }, %) /// }, %)
/// ``` /// ```
#[stdlib { #[stdlib {

View File

@ -46,9 +46,9 @@ pub async fn helix(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
/// |> circle({ center: [5, 5], radius: 10 }, %) /// |> circle({ center: [5, 5], radius: 10 }, %)
/// |> extrude(10, %) /// |> extrude(10, %)
/// |> helix({ /// |> helix({
/// angleStart: 0, /// angleStart = 0,
/// ccw: true, /// ccw = true,
/// revolutions: 16, /// revolutions = 16,
/// }, %) /// }, %)
/// ``` /// ```
#[stdlib { #[stdlib {

View File

@ -92,10 +92,10 @@ pub async fn loft(exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
/// |> close(%) /// |> close(%)
/// ///
/// const circleSketch0 = startSketchOn(offsetPlane('XY', 75)) /// const circleSketch0 = startSketchOn(offsetPlane('XY', 75))
/// |> circle({ center: [0, 100], radius: 50 }, %) /// |> circle({ center = [0, 100], radius = 50 }, %)
/// ///
/// const circleSketch1 = startSketchOn(offsetPlane('XY', 150)) /// const circleSketch1 = startSketchOn(offsetPlane('XY', 150))
/// |> circle({ center: [0, 100], radius: 20 }, %) /// |> circle({ center = [0, 100], radius = 20 }, %)
/// ///
/// loft([squareSketch, circleSketch0, circleSketch1]) /// loft([squareSketch, circleSketch0, circleSketch1])
/// ``` /// ```
@ -111,25 +111,25 @@ pub async fn loft(exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
/// |> close(%) /// |> close(%)
/// ///
/// const circleSketch0 = startSketchOn(offsetPlane('XY', 75)) /// const circleSketch0 = startSketchOn(offsetPlane('XY', 75))
/// |> circle({ center: [0, 100], radius: 50 }, %) /// |> circle({ center = [0, 100], radius = 50 }, %)
/// ///
/// const circleSketch1 = startSketchOn(offsetPlane('XY', 150)) /// const circleSketch1 = startSketchOn(offsetPlane('XY', 150))
/// |> circle({ center: [0, 100], radius: 20 }, %) /// |> circle({ center = [0, 100], radius = 20 }, %)
/// ///
/// loft([squareSketch, circleSketch0, circleSketch1], { /// loft([squareSketch, circleSketch0, circleSketch1], {
/// // This can be set to override the automatically determined /// // This can be set to override the automatically determined
/// // topological base curve, which is usually the first section encountered. /// // topological base curve, which is usually the first section encountered.
/// baseCurveIndex: 0, /// baseCurveIndex = 0,
/// // Attempt to approximate rational curves (such as arcs) using a bezier. /// // Attempt to approximate rational curves (such as arcs) using a bezier.
/// // This will remove banding around interpolations between arcs and non-arcs. /// // This will remove banding around interpolations between arcs and non-arcs.
/// // It may produce errors in other scenarios Over time, this field won't be necessary. /// // It may produce errors in other scenarios Over time, this field won't be necessary.
/// bezApproximateRational: false, /// bezApproximateRational = false,
/// // Tolerance for the loft operation. /// // Tolerance for the loft operation.
/// tolerance: 0.000001, /// tolerance = 0.000001,
/// // Degree of the interpolation. Must be greater than zero. /// // Degree of the interpolation. Must be greater than zero.
/// // For example, use 2 for quadratic, or 3 for cubic interpolation in /// // For example, use 2 for quadratic, or 3 for cubic interpolation in
/// // the V direction. This defaults to 2, if not specified. /// // the V direction. This defaults to 2, if not specified.
/// vDegree: 2, /// vDegree = 2,
/// }) /// })
/// ``` /// ```
#[stdlib { #[stdlib {

View File

@ -49,8 +49,8 @@ pub async fn cos(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
/// const exampleSketch = startSketchOn("XZ") /// const exampleSketch = startSketchOn("XZ")
/// |> startProfileAt([0, 0], %) /// |> startProfileAt([0, 0], %)
/// |> angledLine({ /// |> angledLine({
/// angle: 30, /// angle = 30,
/// length: 3 / cos(toRadians(30)), /// length = 3 / cos(toRadians(30)),
/// }, %) /// }, %)
/// |> yLineTo(0, %) /// |> yLineTo(0, %)
/// |> close(%) /// |> close(%)
@ -79,8 +79,8 @@ pub async fn sin(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
/// const exampleSketch = startSketchOn("XZ") /// const exampleSketch = startSketchOn("XZ")
/// |> startProfileAt([0, 0], %) /// |> startProfileAt([0, 0], %)
/// |> angledLine({ /// |> angledLine({
/// angle: 50, /// angle = 50,
/// length: 15 / sin(toDegrees(135)), /// length = 15 / sin(toDegrees(135)),
/// }, %) /// }, %)
/// |> yLineTo(0, %) /// |> yLineTo(0, %)
/// |> close(%) /// |> close(%)
@ -109,8 +109,8 @@ pub async fn tan(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
/// const exampleSketch = startSketchOn("XZ") /// const exampleSketch = startSketchOn("XZ")
/// |> startProfileAt([0, 0], %) /// |> startProfileAt([0, 0], %)
/// |> angledLine({ /// |> angledLine({
/// angle: 50, /// angle = 50,
/// length: 50 * tan(1/2), /// length = 50 * tan(1/2),
/// }, %) /// }, %)
/// |> yLineTo(0, %) /// |> yLineTo(0, %)
/// |> close(%) /// |> close(%)
@ -138,7 +138,7 @@ pub async fn pi(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kcl
/// const circumference = 70 /// const circumference = 70
/// ///
/// const exampleSketch = startSketchOn("XZ") /// const exampleSketch = startSketchOn("XZ")
/// |> circle({ center: [0, 0], radius: circumference/ (2 * pi()) }, %) /// |> circle({ center = [0, 0], radius = circumference/ (2 * pi()) }, %)
/// ///
/// const example = extrude(5, exampleSketch) /// const example = extrude(5, exampleSketch)
/// ``` /// ```
@ -164,8 +164,8 @@ pub async fn sqrt(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
/// const exampleSketch = startSketchOn("XZ") /// const exampleSketch = startSketchOn("XZ")
/// |> startProfileAt([0, 0], %) /// |> startProfileAt([0, 0], %)
/// |> angledLine({ /// |> angledLine({
/// angle: 50, /// angle = 50,
/// length: sqrt(2500), /// length = sqrt(2500),
/// }, %) /// }, %)
/// |> yLineTo(0, %) /// |> yLineTo(0, %)
/// |> close(%) /// |> close(%)
@ -197,13 +197,13 @@ pub async fn abs(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
/// |> startProfileAt([0, 0], %) /// |> startProfileAt([0, 0], %)
/// |> line([8, 0], %) /// |> line([8, 0], %)
/// |> angledLine({ /// |> angledLine({
/// angle: abs(myAngle), /// angle = abs(myAngle),
/// length: 5, /// length = 5,
/// }, %) /// }, %)
/// |> line([-5, 0], %) /// |> line([-5, 0], %)
/// |> angledLine({ /// |> angledLine({
/// angle: myAngle, /// angle = myAngle,
/// length: 5, /// length = 5,
/// }, %) /// }, %)
/// |> close(%) /// |> close(%)
/// ///
@ -287,8 +287,8 @@ pub async fn min(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
/// const exampleSketch = startSketchOn("XZ") /// const exampleSketch = startSketchOn("XZ")
/// |> startProfileAt([0, 0], %) /// |> startProfileAt([0, 0], %)
/// |> angledLine({ /// |> angledLine({
/// angle: 70, /// angle = 70,
/// length: min(15, 31, 4, 13, 22) /// length = min(15, 31, 4, 13, 22)
/// }, %) /// }, %)
/// |> line([20, 0], %) /// |> line([20, 0], %)
/// |> close(%) /// |> close(%)
@ -324,8 +324,8 @@ pub async fn max(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
/// const exampleSketch = startSketchOn("XZ") /// const exampleSketch = startSketchOn("XZ")
/// |> startProfileAt([0, 0], %) /// |> startProfileAt([0, 0], %)
/// |> angledLine({ /// |> angledLine({
/// angle: 70, /// angle = 70,
/// length: max(15, 31, 4, 13, 22) /// length = max(15, 31, 4, 13, 22)
/// }, %) /// }, %)
/// |> line([20, 0], %) /// |> line([20, 0], %)
/// |> close(%) /// |> close(%)
@ -375,8 +375,8 @@ pub async fn pow(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
/// const exampleSketch = startSketchOn("XZ") /// const exampleSketch = startSketchOn("XZ")
/// |> startProfileAt([0, 0], %) /// |> startProfileAt([0, 0], %)
/// |> angledLine({ /// |> angledLine({
/// angle: 50, /// angle = 50,
/// length: pow(5, 2), /// length = pow(5, 2),
/// }, %) /// }, %)
/// |> yLineTo(0, %) /// |> yLineTo(0, %)
/// |> close(%) /// |> close(%)
@ -405,8 +405,8 @@ pub async fn acos(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
/// const sketch001 = startSketchOn('XZ') /// const sketch001 = startSketchOn('XZ')
/// |> startProfileAt([0, 0], %) /// |> startProfileAt([0, 0], %)
/// |> angledLine({ /// |> angledLine({
/// angle: toDegrees(acos(0.5)), /// angle = toDegrees(acos(0.5)),
/// length: 10, /// length = 10,
/// }, %) /// }, %)
/// |> line([5, 0], %) /// |> line([5, 0], %)
/// |> lineTo([12, 0], %) /// |> lineTo([12, 0], %)
@ -436,8 +436,8 @@ pub async fn asin(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
/// const sketch001 = startSketchOn('XZ') /// const sketch001 = startSketchOn('XZ')
/// |> startProfileAt([0, 0], %) /// |> startProfileAt([0, 0], %)
/// |> angledLine({ /// |> angledLine({
/// angle: toDegrees(asin(0.5)), /// angle = toDegrees(asin(0.5)),
/// length: 20, /// length = 20,
/// }, %) /// }, %)
/// |> yLineTo(0, %) /// |> yLineTo(0, %)
/// |> close(%) /// |> close(%)
@ -466,8 +466,8 @@ pub async fn atan(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
/// const sketch001 = startSketchOn('XZ') /// const sketch001 = startSketchOn('XZ')
/// |> startProfileAt([0, 0], %) /// |> startProfileAt([0, 0], %)
/// |> angledLine({ /// |> angledLine({
/// angle: toDegrees(atan(1.25)), /// angle = toDegrees(atan(1.25)),
/// length: 20, /// length = 20,
/// }, %) /// }, %)
/// |> yLineTo(0, %) /// |> yLineTo(0, %)
/// |> close(%) /// |> close(%)
@ -628,8 +628,8 @@ pub async fn e(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclE
/// const exampleSketch = startSketchOn("XZ") /// const exampleSketch = startSketchOn("XZ")
/// |> startProfileAt([0, 0], %) /// |> startProfileAt([0, 0], %)
/// |> angledLine({ /// |> angledLine({
/// angle: 30, /// angle = 30,
/// length: 2 * e() ^ 2, /// length = 2 * e() ^ 2,
/// }, %) /// }, %)
/// |> yLineTo(0, %) /// |> yLineTo(0, %)
/// |> close(%) /// |> close(%)
@ -657,8 +657,8 @@ pub async fn tau(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
/// const exampleSketch = startSketchOn("XZ") /// const exampleSketch = startSketchOn("XZ")
/// |> startProfileAt([0, 0], %) /// |> startProfileAt([0, 0], %)
/// |> angledLine({ /// |> angledLine({
/// angle: 50, /// angle = 50,
/// length: 10 * tau(), /// length = 10 * tau(),
/// }, %) /// }, %)
/// |> yLineTo(0, %) /// |> yLineTo(0, %)
/// |> close(%) /// |> close(%)
@ -687,8 +687,8 @@ pub async fn to_radians(_exec_state: &mut ExecState, args: Args) -> Result<KclVa
/// const exampleSketch = startSketchOn("XZ") /// const exampleSketch = startSketchOn("XZ")
/// |> startProfileAt([0, 0], %) /// |> startProfileAt([0, 0], %)
/// |> angledLine({ /// |> angledLine({
/// angle: 50, /// angle = 50,
/// length: 70 * cos(toRadians(45)), /// length = 70 * cos(toRadians(45)),
/// }, %) /// }, %)
/// |> yLineTo(0, %) /// |> yLineTo(0, %)
/// |> close(%) /// |> close(%)
@ -717,8 +717,8 @@ pub async fn to_degrees(_exec_state: &mut ExecState, args: Args) -> Result<KclVa
/// const exampleSketch = startSketchOn("XZ") /// const exampleSketch = startSketchOn("XZ")
/// |> startProfileAt([0, 0], %) /// |> startProfileAt([0, 0], %)
/// |> angledLine({ /// |> angledLine({
/// angle: 50, /// angle = 50,
/// length: 70 * cos(toDegrees(pi()/4)), /// length = 70 * cos(toDegrees(pi()/4)),
/// }, %) /// }, %)
/// |> yLineTo(0, %) /// |> yLineTo(0, %)
/// |> close(%) /// |> close(%)

View File

@ -50,7 +50,7 @@ pub async fn mirror_2d(exec_state: &mut ExecState, args: Args) -> Result<KclValu
/// |> line([-8, -3], %) /// |> line([-8, -3], %)
/// |> line([9, -1], %) /// |> line([9, -1], %)
/// |> line([-19, -0], %) /// |> line([-19, -0], %)
/// |> mirror2d({axis: 'Y'}, %) /// |> mirror2d({axis = 'Y'}, %)
/// ///
/// const example = extrude(10, sketch001) /// const example = extrude(10, sketch001)
/// ``` /// ```
@ -61,7 +61,7 @@ pub async fn mirror_2d(exec_state: &mut ExecState, args: Args) -> Result<KclValu
/// |> startProfileAt([0, 8.5], %) /// |> startProfileAt([0, 8.5], %)
/// |> line([20, -8.5], %) /// |> line([20, -8.5], %)
/// |> line([-20, -8.5], %) /// |> line([-20, -8.5], %)
/// |> mirror2d({axis: 'Y'}, %) /// |> mirror2d({axis = 'Y'}, %)
/// ///
/// const example = extrude(10, sketch001) /// const example = extrude(10, sketch001)
/// ``` /// ```
@ -76,7 +76,7 @@ pub async fn mirror_2d(exec_state: &mut ExecState, args: Args) -> Result<KclValu
/// |> startProfileAt([0, 8.5], %) /// |> startProfileAt([0, 8.5], %)
/// |> line([20, -8.5], %) /// |> line([20, -8.5], %)
/// |> line([-20, -8.5], %) /// |> line([-20, -8.5], %)
/// |> mirror2d({axis: edge001}, %) /// |> mirror2d({axis = edge001}, %)
/// ///
/// const example = extrude(10, sketch001) /// const example = extrude(10, sketch001)
/// ``` /// ```
@ -88,10 +88,10 @@ pub async fn mirror_2d(exec_state: &mut ExecState, args: Args) -> Result<KclValu
/// |> line([20, -8.5], %) /// |> line([20, -8.5], %)
/// |> line([-20, -8.5], %) /// |> line([-20, -8.5], %)
/// |> mirror2d({ /// |> mirror2d({
/// axis: { /// axis = {
/// custom: { /// custom = {
/// axis: [0.0, 1.0], /// axis = [0.0, 1.0],
/// origin: [0.0, 0.0] /// origin = [0.0, 0.0]
/// } /// }
/// } /// }
/// }, %) /// }, %)

View File

@ -147,12 +147,12 @@ pub async fn pattern_transform_2d(exec_state: &mut ExecState, args: Args) -> Res
/// ```no_run /// ```no_run
/// // Each instance will be shifted along the X axis. /// // Each instance will be shifted along the X axis.
/// fn transform = (id) => { /// fn transform = (id) => {
/// return { translate: [4 * id, 0, 0] } /// return { translate = [4 * id, 0, 0] }
/// } /// }
/// ///
/// // Sketch 4 cylinders. /// // Sketch 4 cylinders.
/// const sketch001 = startSketchOn('XZ') /// const sketch001 = startSketchOn('XZ')
/// |> circle({ center: [0, 0], radius: 2 }, %) /// |> circle({ center = [0, 0], radius = 2 }, %)
/// |> extrude(5, %) /// |> extrude(5, %)
/// |> patternTransform(4, transform, %) /// |> patternTransform(4, transform, %)
/// ``` /// ```
@ -165,7 +165,7 @@ pub async fn pattern_transform_2d(exec_state: &mut ExecState, args: Args) -> Res
/// } /// }
/// ///
/// const sketch001 = startSketchOn('XZ') /// const sketch001 = startSketchOn('XZ')
/// |> circle({ center: [0, 0], radius: 2 }, %) /// |> circle({ center = [0, 0], radius = 2 }, %)
/// |> extrude(5, %) /// |> extrude(5, %)
/// |> patternTransform(4, transform, %) /// |> patternTransform(4, transform, %)
/// ``` /// ```
@ -192,13 +192,13 @@ pub async fn pattern_transform_2d(exec_state: &mut ExecState, args: Args) -> Res
/// fn transform = (i) => { /// fn transform = (i) => {
/// return { /// return {
/// // Move down each time. /// // Move down each time.
/// translate: [0, 0, -i * width], /// translate = [0, 0, -i * width],
/// // Make the cube longer, wider and flatter each time. /// // Make the cube longer, wider and flatter each time.
/// scale: [pow(1.1, i), pow(1.1, i), pow(0.9, i)], /// scale = [pow(1.1, i), pow(1.1, i), pow(0.9, i)],
/// // Turn by 15 degrees each time. /// // Turn by 15 degrees each time.
/// rotation: { /// rotation = {
/// angle: 15 * i, /// angle = 15 * i,
/// origin: "local", /// origin = "local",
/// } /// }
/// } /// }
/// } /// }
@ -230,11 +230,11 @@ pub async fn pattern_transform_2d(exec_state: &mut ExecState, args: Args) -> Res
/// let width = 20 /// let width = 20
/// fn transform = (i) => { /// fn transform = (i) => {
/// return { /// return {
/// translate: [0, 0, -i * width], /// translate = [0, 0, -i * width],
/// rotation: { /// rotation = {
/// angle: 90 * i, /// angle = 90 * i,
/// // Rotate around the overall scene's origin. /// // Rotate around the overall scene's origin.
/// origin: "global", /// origin = "global",
/// } /// }
/// } /// }
/// } /// }
@ -252,14 +252,14 @@ pub async fn pattern_transform_2d(exec_state: &mut ExecState, args: Args) -> Res
/// fn transform = (replicaId) => { /// fn transform = (replicaId) => {
/// let scale = r * abs(1 - (t * replicaId)) * (5 + cos(replicaId / 8)) /// let scale = r * abs(1 - (t * replicaId)) * (5 + cos(replicaId / 8))
/// return { /// return {
/// translate: [0, 0, replicaId * 10], /// translate = [0, 0, replicaId * 10],
/// scale: [scale, scale, 0], /// scale = [scale, scale, 0],
/// } /// }
/// } /// }
/// // Each layer is just a pretty thin cylinder. /// // Each layer is just a pretty thin cylinder.
/// fn layer = () => { /// fn layer = () => {
/// return startSketchOn("XY") // or some other plane idk /// return startSketchOn("XY") // or some other plane idk
/// |> circle({ center: [0, 0], radius: 1 }, %, $tag1) /// |> circle({ center = [0, 0], radius = 1 }, %, $tag1)
/// |> extrude(h, %) /// |> extrude(h, %)
/// } /// }
/// // The vase is 100 layers tall. /// // The vase is 100 layers tall.
@ -690,11 +690,11 @@ pub async fn pattern_linear_2d(exec_state: &mut ExecState, args: Args) -> Result
/// ///
/// ```no_run /// ```no_run
/// const exampleSketch = startSketchOn('XZ') /// const exampleSketch = startSketchOn('XZ')
/// |> circle({ center: [0, 0], radius: 1 }, %) /// |> circle({ center = [0, 0], radius = 1 }, %)
/// |> patternLinear2d({ /// |> patternLinear2d({
/// axis: [1, 0], /// axis = [1, 0],
/// instances: 7, /// instances = 7,
/// distance: 4 /// distance = 4
/// }, %) /// }, %)
/// ///
/// const example = extrude(1, exampleSketch) /// const example = extrude(1, exampleSketch)
@ -755,9 +755,9 @@ pub async fn pattern_linear_3d(exec_state: &mut ExecState, args: Args) -> Result
/// ///
/// const example = extrude(1, exampleSketch) /// const example = extrude(1, exampleSketch)
/// |> patternLinear3d({ /// |> patternLinear3d({
/// axis: [1, 0, 1], /// axis = [1, 0, 1],
/// instances: 7, /// instances = 7,
/// distance: 6 /// distance = 6
/// }, %) /// }, %)
/// ``` /// ```
#[stdlib { #[stdlib {
@ -907,10 +907,10 @@ pub async fn pattern_circular_2d(exec_state: &mut ExecState, args: Args) -> Resu
/// |> line([0, -5], %) /// |> line([0, -5], %)
/// |> close(%) /// |> close(%)
/// |> patternCircular2d({ /// |> patternCircular2d({
/// center: [0, 0], /// center = [0, 0],
/// instances: 13, /// instances = 13,
/// arcDegrees: 360, /// arcDegrees = 360,
/// rotateDuplicates: true /// rotateDuplicates = true
/// }, %) /// }, %)
/// ///
/// const example = extrude(1, exampleSketch) /// const example = extrude(1, exampleSketch)
@ -968,15 +968,15 @@ pub async fn pattern_circular_3d(exec_state: &mut ExecState, args: Args) -> Resu
/// ///
/// ```no_run /// ```no_run
/// const exampleSketch = startSketchOn('XZ') /// const exampleSketch = startSketchOn('XZ')
/// |> circle({ center: [0, 0], radius: 1 }, %) /// |> circle({ center = [0, 0], radius = 1 }, %)
/// ///
/// const example = extrude(-5, exampleSketch) /// const example = extrude(-5, exampleSketch)
/// |> patternCircular3d({ /// |> patternCircular3d({
/// axis: [1, -1, 0], /// axis = [1, -1, 0],
/// center: [10, -20, 0], /// center = [10, -20, 0],
/// instances: 11, /// instances = 11,
/// arcDegrees: 360, /// arcDegrees = 360,
/// rotateDuplicates: true /// rotateDuplicates = true
/// }, %) /// }, %)
/// ``` /// ```
#[stdlib { #[stdlib {

View File

@ -74,7 +74,7 @@ pub async fn offset_plane(exec_state: &mut ExecState, args: Args) -> Result<KclV
/// |> close(%) /// |> close(%)
/// ///
/// const circleSketch = startSketchOn(offsetPlane('XY', 150)) /// const circleSketch = startSketchOn(offsetPlane('XY', 150))
/// |> circle({ center: [0, 100], radius: 50 }, %) /// |> circle({ center = [0, 100], radius = 50 }, %)
/// ///
/// loft([squareSketch, circleSketch]) /// loft([squareSketch, circleSketch])
/// ``` /// ```
@ -90,7 +90,7 @@ pub async fn offset_plane(exec_state: &mut ExecState, args: Args) -> Result<KclV
/// |> close(%) /// |> close(%)
/// ///
/// const circleSketch = startSketchOn(offsetPlane('XZ', 150)) /// const circleSketch = startSketchOn(offsetPlane('XZ', 150))
/// |> circle({ center: [0, 100], radius: 50 }, %) /// |> circle({ center = [0, 100], radius = 50 }, %)
/// ///
/// loft([squareSketch, circleSketch]) /// loft([squareSketch, circleSketch])
/// ``` /// ```
@ -106,7 +106,7 @@ pub async fn offset_plane(exec_state: &mut ExecState, args: Args) -> Result<KclV
/// |> close(%) /// |> close(%)
/// ///
/// const circleSketch = startSketchOn(offsetPlane('YZ', 150)) /// const circleSketch = startSketchOn(offsetPlane('YZ', 150))
/// |> circle({ center: [0, 100], radius: 50 }, %) /// |> circle({ center = [0, 100], radius = 50 }, %)
/// ///
/// loft([squareSketch, circleSketch]) /// loft([squareSketch, circleSketch])
/// ``` /// ```
@ -122,7 +122,7 @@ pub async fn offset_plane(exec_state: &mut ExecState, args: Args) -> Result<KclV
/// |> close(%) /// |> close(%)
/// ///
/// const circleSketch = startSketchOn(offsetPlane('-XZ', -150)) /// const circleSketch = startSketchOn(offsetPlane('-XZ', -150))
/// |> circle({ center: [0, 100], radius: 50 }, %) /// |> circle({ center = [0, 100], radius = 50 }, %)
/// ///
/// loft([squareSketch, circleSketch]) /// loft([squareSketch, circleSketch])
/// ``` /// ```
@ -130,7 +130,7 @@ pub async fn offset_plane(exec_state: &mut ExecState, args: Args) -> Result<KclV
/// // A circle on the XY plane /// // A circle on the XY plane
/// startSketchOn("XY") /// startSketchOn("XY")
/// |> startProfileAt([0, 0], %) /// |> startProfileAt([0, 0], %)
/// |> circle({radius: 10, center: [0, 0]}, %) /// |> circle({ radius = 10, center = [0, 0] }, %)
/// ///
/// // Triangle on the plane 4 units above /// // Triangle on the plane 4 units above
/// startSketchOn(offsetPlane("XY", 4)) /// startSketchOn(offsetPlane("XY", 4))

View File

@ -123,16 +123,16 @@ pub async fn revolve(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
/// |> line([0, -5.5], %) /// |> line([0, -5.5], %)
/// |> line([-2, 0], %) /// |> line([-2, 0], %)
/// |> close(%) /// |> close(%)
/// |> revolve({axis: 'y'}, %) // default angle is 360 /// |> revolve({axis = 'y'}, %) // default angle is 360
/// ``` /// ```
/// ///
/// ```no_run /// ```no_run
/// // A donut shape. /// // A donut shape.
/// const sketch001 = startSketchOn('XY') /// const sketch001 = startSketchOn('XY')
/// |> circle({ center: [15, 0], radius: 5 }, %) /// |> circle({ center = [15, 0], radius = 5 }, %)
/// |> revolve({ /// |> revolve({
/// angle: 360, /// angle = 360,
/// axis: 'y' /// axis = 'y'
/// }, %) /// }, %)
/// ``` /// ```
/// ///
@ -147,7 +147,7 @@ pub async fn revolve(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
/// |> line([0, -5.5], %) /// |> line([0, -5.5], %)
/// |> line([-2, 0], %) /// |> line([-2, 0], %)
/// |> close(%) /// |> close(%)
/// |> revolve({axis: 'y', angle: 180}, %) /// |> revolve({axis = 'y', angle = 180}, %)
/// ``` /// ```
/// ///
/// ```no_run /// ```no_run
@ -161,7 +161,7 @@ pub async fn revolve(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
/// |> line([0, -5.5], %) /// |> line([0, -5.5], %)
/// |> line([-2, 0], %) /// |> line([-2, 0], %)
/// |> close(%) /// |> close(%)
/// |> revolve({axis: 'y', angle: 180}, %) /// |> revolve({axis = 'y', angle = 180}, %)
/// const part002 = startSketchOn(part001, 'end') /// const part002 = startSketchOn(part001, 'end')
/// |> startProfileAt([4.5, -5], %) /// |> startProfileAt([4.5, -5], %)
/// |> line([0, 5], %) /// |> line([0, 5], %)
@ -181,10 +181,10 @@ pub async fn revolve(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
/// |> extrude(20, %) /// |> extrude(20, %)
/// ///
/// const sketch001 = startSketchOn(box, "END") /// const sketch001 = startSketchOn(box, "END")
/// |> circle({ center: [10,10], radius: 4 }, %) /// |> circle({ center = [10,10], radius = 4 }, %)
/// |> revolve({ /// |> revolve({
/// angle: -90, /// angle = -90,
/// axis: 'y' /// axis = 'y'
/// }, %) /// }, %)
/// ``` /// ```
/// ///
@ -198,10 +198,10 @@ pub async fn revolve(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
/// |> extrude(20, %) /// |> extrude(20, %)
/// ///
/// const sketch001 = startSketchOn(box, "END") /// const sketch001 = startSketchOn(box, "END")
/// |> circle({ center: [10,10], radius: 4 }, %) /// |> circle({ center = [10,10], radius = 4 }, %)
/// |> revolve({ /// |> revolve({
/// angle: 90, /// angle = 90,
/// axis: getOppositeEdge(revolveAxis) /// axis = getOppositeEdge(revolveAxis)
/// }, %) /// }, %)
/// ``` /// ```
/// ///
@ -215,10 +215,10 @@ pub async fn revolve(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
/// |> extrude(20, %) /// |> extrude(20, %)
/// ///
/// const sketch001 = startSketchOn(box, "END") /// const sketch001 = startSketchOn(box, "END")
/// |> circle({ center: [10,10], radius: 4 }, %) /// |> circle({ center = [10,10], radius = 4 }, %)
/// |> revolve({ /// |> revolve({
/// angle: 90, /// angle = 90,
/// axis: getOppositeEdge(revolveAxis), /// axis = getOppositeEdge(revolveAxis),
/// tolerance: 0.0001 /// tolerance: 0.0001
/// }, %) /// }, %)
/// ``` /// ```
@ -232,9 +232,9 @@ pub async fn revolve(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
/// |> close(%) /// |> close(%)
/// ///
/// const part001 = revolve({ /// const part001 = revolve({
/// axis: { /// axis = {
/// custom: { /// custom: {
/// axis: [0.0, 1.0], /// axis = [0.0, 1.0],
/// origin: [0.0, 0.0] /// origin: [0.0, 0.0]
/// } /// }
/// } /// }

View File

@ -31,7 +31,7 @@ pub async fn segment_end(exec_state: &mut ExecState, args: Args) -> Result<KclVa
/// ///
/// fn cylinder = (radius, tag) => { /// fn cylinder = (radius, tag) => {
/// return startSketchAt([0, 0]) /// return startSketchAt([0, 0])
/// |> circle({ radius: radius, center: segEnd(tag) }, %) /// |> circle({ radius = radius, center = segEnd(tag) }, %)
/// |> extrude(radius, %) /// |> extrude(radius, %)
/// } /// }
/// ///
@ -150,7 +150,7 @@ pub async fn segment_start(exec_state: &mut ExecState, args: Args) -> Result<Kcl
/// ///
/// fn cylinder = (radius, tag) => { /// fn cylinder = (radius, tag) => {
/// return startSketchAt([0, 0]) /// return startSketchAt([0, 0])
/// |> circle({ radius: radius, center: segStart(tag) }, %) /// |> circle({ radius = radius, center = segStart(tag) }, %)
/// |> extrude(radius, %) /// |> extrude(radius, %)
/// } /// }
/// ///
@ -339,16 +339,16 @@ pub async fn segment_length(exec_state: &mut ExecState, args: Args) -> Result<Kc
/// const exampleSketch = startSketchOn("XZ") /// const exampleSketch = startSketchOn("XZ")
/// |> startProfileAt([0, 0], %) /// |> startProfileAt([0, 0], %)
/// |> angledLine({ /// |> angledLine({
/// angle: 60, /// angle = 60,
/// length: 10, /// length = 10,
/// }, %, $thing) /// }, %, $thing)
/// |> tangentialArc({ /// |> tangentialArc({
/// offset: -120, /// offset = -120,
/// radius: 5, /// radius = 5,
/// }, %) /// }, %)
/// |> angledLine({ /// |> angledLine({
/// angle: -60, /// angle = -60,
/// length: segLen(thing), /// length = segLen(thing),
/// }, %) /// }, %)
/// |> close(%) /// |> close(%)
/// ///
@ -488,8 +488,8 @@ pub async fn angle_to_match_length_y(exec_state: &mut ExecState, args: Args) ->
/// |> startProfileAt([0, 0], %) /// |> startProfileAt([0, 0], %)
/// |> line([1, 2], %, $seg01) /// |> line([1, 2], %, $seg01)
/// |> angledLine({ /// |> angledLine({
/// angle: angleToMatchLengthY(seg01, 15, %), /// angle = angleToMatchLengthY(seg01, 15, %),
/// length: 5, /// length = 5,
/// }, %) /// }, %)
/// |> yLineTo(0, %) /// |> yLineTo(0, %)
/// |> close(%) /// |> close(%)

View File

@ -58,7 +58,7 @@ pub async fn circle(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
/// ///
/// ```no_run /// ```no_run
/// const exampleSketch = startSketchOn("-XZ") /// const exampleSketch = startSketchOn("-XZ")
/// |> circle({ center: [0, 0], radius: 10 }, %) /// |> circle({ center = [0, 0], radius = 10 }, %)
/// ///
/// const example = extrude(5, exampleSketch) /// const example = extrude(5, exampleSketch)
/// ``` /// ```
@ -70,7 +70,7 @@ pub async fn circle(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
/// |> line([0, 30], %) /// |> line([0, 30], %)
/// |> line([-30, 0], %) /// |> line([-30, 0], %)
/// |> close(%) /// |> close(%)
/// |> hole(circle({ center: [0, 15], radius: 5 }, %), %) /// |> hole(circle({ center = [0, 15], radius = 5 }, %), %)
/// ///
/// const example = extrude(5, exampleSketch) /// const example = extrude(5, exampleSketch)
/// ``` /// ```
@ -195,10 +195,10 @@ pub async fn polygon(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
/// // Create a regular hexagon inscribed in a circle of radius 10 /// // Create a regular hexagon inscribed in a circle of radius 10
/// hex = startSketchOn('XY') /// hex = startSketchOn('XY')
/// |> polygon({ /// |> polygon({
/// radius: 10, /// radius = 10,
/// numSides: 6, /// numSides = 6,
/// center: [0, 0], /// center = [0, 0],
/// inscribed: true, /// inscribed = true,
/// }, %) /// }, %)
/// ///
/// example = extrude(5, hex) /// example = extrude(5, hex)
@ -208,10 +208,10 @@ pub async fn polygon(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
/// // Create a square circumscribed around a circle of radius 5 /// // Create a square circumscribed around a circle of radius 5
/// square = startSketchOn('XY') /// square = startSketchOn('XY')
/// |> polygon({ /// |> polygon({
/// radius: 5.0, /// radius = 5.0,
/// numSides: 4, /// numSides = 4,
/// center: [10, 10], /// center = [10, 10],
/// inscribed: false, /// inscribed = false,
/// }, %) /// }, %)
/// example = extrude(5, square) /// example = extrude(5, square)
/// ``` /// ```

View File

@ -48,8 +48,8 @@ pub async fn shell(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
/// ///
/// // Remove the end face for the extrusion. /// // Remove the end face for the extrusion.
/// shell({ /// shell({
/// faces: ['end'], /// faces = ['end'],
/// thickness: 0.25, /// thickness = 0.25,
/// }, firstSketch) /// }, firstSketch)
/// ``` /// ```
/// ///
@ -65,8 +65,8 @@ pub async fn shell(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
/// ///
/// // Remove the start face for the extrusion. /// // Remove the start face for the extrusion.
/// shell({ /// shell({
/// faces: ['start'], /// faces = ['start'],
/// thickness: 0.25, /// thickness = 0.25,
/// }, firstSketch) /// }, firstSketch)
/// ``` /// ```
/// ///
@ -82,8 +82,8 @@ pub async fn shell(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
/// ///
/// // Remove a tagged face for the extrusion. /// // Remove a tagged face for the extrusion.
/// shell({ /// shell({
/// faces: [myTag], /// faces = [myTag],
/// thickness: 0.25, /// thickness = 0.25,
/// }, firstSketch) /// }, firstSketch)
/// ``` /// ```
/// ///
@ -99,8 +99,8 @@ pub async fn shell(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
/// ///
/// // Remove a tagged face and the end face for the extrusion. /// // Remove a tagged face and the end face for the extrusion.
/// shell({ /// shell({
/// faces: [myTag, 'end'], /// faces = [myTag, 'end'],
/// thickness: 0.25, /// thickness = 0.25,
/// }, firstSketch) /// }, firstSketch)
/// ``` /// ```
/// ///
@ -116,15 +116,15 @@ pub async fn shell(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
/// |> extrude(65, %) /// |> extrude(65, %)
/// ///
/// const thing1 = startSketchOn(case, 'end') /// const thing1 = startSketchOn(case, 'end')
/// |> circle({ center: [-size / 2, -size / 2], radius: 25 }, %) /// |> circle({ center = [-size / 2, -size / 2], radius = 25 }, %)
/// |> extrude(50, %) /// |> extrude(50, %)
/// ///
/// const thing2 = startSketchOn(case, 'end') /// const thing2 = startSketchOn(case, 'end')
/// |> circle({ center: [size / 2, -size / 2], radius: 25 }, %) /// |> circle({ center = [size / 2, -size / 2], radius = 25 }, %)
/// |> extrude(50, %) /// |> extrude(50, %)
/// ///
/// // We put "case" in the shell function to shell the entire object. /// // We put "case" in the shell function to shell the entire object.
/// shell({ faces: ['start'], thickness: 5 }, case) /// shell({ faces = ['start'], thickness = 5 }, case)
/// ``` /// ```
/// ///
/// ```no_run /// ```no_run
@ -139,15 +139,15 @@ pub async fn shell(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
/// |> extrude(65, %) /// |> extrude(65, %)
/// ///
/// const thing1 = startSketchOn(case, 'end') /// const thing1 = startSketchOn(case, 'end')
/// |> circle({ center: [-size / 2, -size / 2], radius: 25 }, %) /// |> circle({ center = [-size / 2, -size / 2], radius = 25 }, %)
/// |> extrude(50, %) /// |> extrude(50, %)
/// ///
/// const thing2 = startSketchOn(case, 'end') /// const thing2 = startSketchOn(case, 'end')
/// |> circle({ center: [size / 2, -size / 2], radius: 25 }, %) /// |> circle({ center = [size / 2, -size / 2], radius = 25 }, %)
/// |> extrude(50, %) /// |> extrude(50, %)
/// ///
/// // We put "thing1" in the shell function to shell the end face of the object. /// // We put "thing1" in the shell function to shell the end face of the object.
/// shell({ faces: ['end'], thickness: 5 }, thing1) /// shell({ faces = ['end'], thickness = 5 }, thing1)
/// ``` /// ```
/// ///
/// ```no_run /// ```no_run
@ -164,15 +164,15 @@ pub async fn shell(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
/// |> extrude(65, %) /// |> extrude(65, %)
/// ///
/// const thing1 = startSketchOn(case, 'end') /// const thing1 = startSketchOn(case, 'end')
/// |> circle({ center: [-size / 2, -size / 2], radius: 25 }, %) /// |> circle({ center = [-size / 2, -size / 2], radius = 25 }, %)
/// |> extrude(50, %) /// |> extrude(50, %)
/// ///
/// const thing2 = startSketchOn(case, 'end') /// const thing2 = startSketchOn(case, 'end')
/// |> circle({ center: [size / 2, -size / 2], radius: 25 }, %) /// |> circle({ center = [size / 2, -size / 2], radius = 25 }, %)
/// |> extrude(50, %) /// |> extrude(50, %)
/// ///
/// // We put "thing1" and "thing2" in the shell function to shell the end face of the object. /// // We put "thing1" and "thing2" in the shell function to shell the end face of the object.
/// shell({ faces: ['end'], thickness: 5 }, [thing1, thing2]) /// shell({ faces = ['end'], thickness = 5 }, [thing1, thing2])
/// ``` /// ```
#[stdlib { #[stdlib {
name = "shell", name = "shell",
@ -291,11 +291,11 @@ pub async fn hollow(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
/// |> extrude(65, %) /// |> extrude(65, %)
/// ///
/// const thing1 = startSketchOn(case, 'end') /// const thing1 = startSketchOn(case, 'end')
/// |> circle({ center: [-size / 2, -size / 2], radius: 25 }, %) /// |> circle({ center = [-size / 2, -size / 2], radius = 25 }, %)
/// |> extrude(50, %) /// |> extrude(50, %)
/// ///
/// const thing2 = startSketchOn(case, 'end') /// const thing2 = startSketchOn(case, 'end')
/// |> circle({ center: [size / 2, -size / 2], radius: 25 }, %) /// |> circle({ center = [size / 2, -size / 2], radius = 25 }, %)
/// |> extrude(50, %) /// |> extrude(50, %)
/// ///
/// hollow(0.5, case) /// hollow(0.5, case)

Some files were not shown because too many files have changed in this diff Show More