Automatic fixing of deprecations and use non-quoted default planes by default (#5902)

* Automatic fixing of deprecations and use non-quoted default planes by default

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* A snapshot a day keeps the bugs away! 📷🐛

* A snapshot a day keeps the bugs away! 📷🐛

* A snapshot a day keeps the bugs away! 📷🐛

* A snapshot a day keeps the bugs away! 📷🐛

* A snapshot a day keeps the bugs away! 📷🐛

---------

Signed-off-by: Nick Cameron <nrc@ncameron.org>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Nick Cameron
2025-03-21 22:39:12 +13:00
committed by GitHub
parent 06b35b76ff
commit e8feb0309b
235 changed files with 1227 additions and 1097 deletions

View File

@ -33,7 +33,7 @@ abs(num: number): number
```js
myAngle = -120
sketch001 = startSketchOn('XZ')
sketch001 = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> line(end = [8, 0])
|> angledLine({ angle = abs(myAngle), length = 5 }, %)

View File

@ -31,7 +31,7 @@ acos(num: number): number
### Examples
```js
sketch001 = startSketchOn('XZ')
sketch001 = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> angledLine({
angle = toDegrees(acos(0.5)),

View File

@ -33,7 +33,7 @@ angleToMatchLengthX(
### Examples
```js
sketch001 = startSketchOn('XZ')
sketch001 = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> line(end = [2, 5], tag = $seg01)
|> angledLineToX([-angleToMatchLengthX(seg01, 7, %), 10], %)

View File

@ -33,7 +33,7 @@ angleToMatchLengthY(
### Examples
```js
sketch001 = startSketchOn('XZ')
sketch001 = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> line(end = [1, 2], tag = $seg01)
|> angledLine({

View File

@ -36,7 +36,7 @@ appearance(
```js
// Add color to an extruded solid.
exampleSketch = startSketchOn("XZ")
exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> line(endAbsolute = [10, 0])
|> line(endAbsolute = [0, 10])
@ -52,7 +52,7 @@ example = extrude(exampleSketch, length = 5)
```js
// Add color to a revolved solid.
sketch001 = startSketchOn('XY')
sketch001 = startSketchOn(XY)
|> circle(center = [15, 0], radius = 5)
|> revolve(angle = 360, axis = 'y')
|> appearance(color = '#ff0000', metalness = 90, roughness = 90)
@ -63,7 +63,7 @@ sketch001 = startSketchOn('XY')
```js
// Add color to different solids.
fn cube(center) {
return startSketchOn('XY')
return startSketchOn(XY)
|> startProfileAt([center[0] - 10, center[1] - 10], %)
|> line(endAbsolute = [center[0] + 10, center[1] - 10])
|> line(endAbsolute = [center[0] + 10, center[1] + 10])
@ -95,7 +95,7 @@ appearance(
```js
// You can set the appearance before or after you shell it will yield the same result.
// This example shows setting the appearance _after_ the shell.
firstSketch = startSketchOn('XY')
firstSketch = startSketchOn(XY)
|> startProfileAt([-12, 12], %)
|> line(end = [24, 0])
|> line(end = [0, -24])
@ -112,7 +112,7 @@ shell(firstSketch, faces = ['end'], thickness = 0.25)
```js
// You can set the appearance before or after you shell it will yield the same result.
// This example shows setting the appearance _before_ the shell.
firstSketch = startSketchOn('XY')
firstSketch = startSketchOn(XY)
|> startProfileAt([-12, 12], %)
|> line(end = [24, 0])
|> line(end = [0, -24])
@ -129,7 +129,7 @@ shell(firstSketch, faces = ['end'], thickness = 0.25)
```js
// Setting the appearance of a 3D pattern can be done _before_ or _after_ the pattern.
// This example shows _before_ the pattern.
exampleSketch = startSketchOn('XZ')
exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> line(end = [0, 2])
|> line(end = [3, 1])
@ -146,7 +146,7 @@ example = extrude(exampleSketch, length = 1)
```js
// Setting the appearance of a 3D pattern can be done _before_ or _after_ the pattern.
// This example shows _after_ the pattern.
exampleSketch = startSketchOn('XZ')
exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> line(end = [0, 2])
|> line(end = [3, 1])
@ -162,7 +162,7 @@ example = extrude(exampleSketch, length = 1)
```js
// Color the result of a 2D pattern that was extruded.
exampleSketch = startSketchOn('XZ')
exampleSketch = startSketchOn(XZ)
|> startProfileAt([.5, 25], %)
|> line(end = [0, 5])
|> line(end = [-1, 0])
@ -185,7 +185,7 @@ example = extrude(exampleSketch, length = 1)
// Color the result of a sweep.
// Create a path for the sweep.
sweepPath = startSketchOn('XZ')
sweepPath = startSketchOn(XZ)
|> startProfileAt([0.05, 0.05], %)
|> line(end = [0, 7])
|> tangentialArc({ offset = 90, radius = 5 }, %)
@ -193,10 +193,10 @@ sweepPath = startSketchOn('XZ')
|> tangentialArc({ offset = -90, radius = 5 }, %)
|> line(end = [0, 7])
pipeHole = startSketchOn('XY')
pipeHole = startSketchOn(XY)
|> circle(center = [0, 0], radius = 1.5)
sweepSketch = startSketchOn('XY')
sweepSketch = startSketchOn(XY)
|> circle(center = [0, 0], radius = 2)
|> hole(pipeHole, %)
|> sweep(path = sweepPath)

View File

@ -31,7 +31,7 @@ asin(num: number): number
### Examples
```js
sketch001 = startSketchOn('XZ')
sketch001 = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> angledLine({
angle = toDegrees(asin(0.5)),

View File

@ -31,7 +31,7 @@ atan(num: number): number
### Examples
```js
sketch001 = startSketchOn('XZ')
sketch001 = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> angledLine({
angle = toDegrees(atan(1.25)),

View File

@ -35,7 +35,7 @@ atan2(
### Examples
```js
sketch001 = startSketchOn('XZ')
sketch001 = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> angledLine({
angle = toDegrees(atan2(1.25, 2)),

View File

@ -31,7 +31,7 @@ ceil(num: number): number
### Examples
```js
sketch001 = startSketchOn('XZ')
sketch001 = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> line(endAbsolute = [12, 10])
|> line(end = [ceil(7.02986), 0])

View File

@ -41,7 +41,7 @@ length = 10
thickness = 1
chamferLength = 2
mountingPlateSketch = startSketchOn("XY")
mountingPlateSketch = startSketchOn(XY)
|> startProfileAt([-width / 2, -length / 2], %)
|> line(endAbsolute = [width / 2, -length / 2], tag = $edge1)
|> line(endAbsolute = [width / 2, length / 2], tag = $edge2)
@ -65,7 +65,7 @@ mountingPlate = extrude(mountingPlateSketch, length = thickness)
```js
// Sketch on the face of a chamfer.
fn cube(pos, scale) {
sg = startSketchOn('XY')
sg = startSketchOn(XY)
|> startProfileAt(pos, %)
|> line(end = [0, scale])
|> line(end = [scale, 0])

File diff suppressed because one or more lines are too long

View File

@ -37,7 +37,7 @@ circleThreePoint(
### Examples
```js
exampleSketch = startSketchOn("XY")
exampleSketch = startSketchOn(XY)
|> circleThreePoint(p1 = [10, 10], p2 = [20, 8], p3 = [15, 5])
|> extrude(length = 5)
```

View File

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

File diff suppressed because one or more lines are too long

View File

@ -42,7 +42,7 @@ length = 10
thickness = 1
filletRadius = 2
mountingPlateSketch = startSketchOn("XY")
mountingPlateSketch = startSketchOn(XY)
|> startProfileAt([-width / 2, -length / 2], %)
|> line(endAbsolute = [width / 2, -length / 2], tag = $edge1)
|> line(endAbsolute = [width / 2, length / 2], tag = $edge2)
@ -69,7 +69,7 @@ length = 10
thickness = 1
filletRadius = 1
mountingPlateSketch = startSketchOn("XY")
mountingPlateSketch = startSketchOn(XY)
|> startProfileAt([-width / 2, -length / 2], %)
|> line(endAbsolute = [width / 2, -length / 2], tag = $edge1)
|> line(endAbsolute = [width / 2, length / 2], tag = $edge2)

View File

@ -31,7 +31,7 @@ floor(num: number): number
### Examples
```js
sketch001 = startSketchOn('XZ')
sketch001 = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> line(endAbsolute = [12, 10])
|> line(end = [floor(7.02986), 0])

View File

@ -31,7 +31,7 @@ getCommonEdge(faces: [TagIdentifier]): Uuid
scale = 20
part001 = startSketchOn('XY')
part001 = startSketchOn(XY)
|> startProfileAt([0, 0], %)
|> line(end = [0, scale])
|> line(end = [scale, 0])

View File

@ -27,7 +27,7 @@ getNextAdjacentEdge(tag: TagIdentifier): Uuid
### Examples
```js
exampleSketch = startSketchOn('XZ')
exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> line(end = [10, 0])
|> angledLine({ angle = 60, length = 10 }, %)

View File

@ -27,7 +27,7 @@ getOppositeEdge(tag: TagIdentifier): Uuid
### Examples
```js
exampleSketch = startSketchOn('XZ')
exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> line(end = [10, 0])
|> angledLine({ angle = 60, length = 10 }, %)

View File

@ -27,7 +27,7 @@ getPreviousAdjacentEdge(tag: TagIdentifier): Uuid
### Examples
```js
exampleSketch = startSketchOn('XZ')
exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> line(end = [10, 0])
|> angledLine({ angle = 60, length = 10 }, %)

View File

@ -50,7 +50,7 @@ helixPath = helix(
)
// Create a spring by sweeping around the helix path.
springSketch = startSketchOn('YZ')
springSketch = startSketchOn(YZ)
|> circle(center = [0, 0], radius = 0.5)
|> sweep(path = helixPath)
```
@ -59,7 +59,7 @@ springSketch = startSketchOn('YZ')
```js
// Create a helix around an edge.
helper001 = startSketchOn('XZ')
helper001 = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> line(end = [0, 10], tag = $edge001)
@ -73,7 +73,7 @@ helixPath = helix(
)
// Create a spring by sweeping around the helix path.
springSketch = startSketchOn('XY')
springSketch = startSketchOn(XY)
|> circle(center = [0, 0], radius = 0.5)
|> sweep(path = helixPath)
```
@ -97,7 +97,7 @@ helixPath = helix(
)
// Create a spring by sweeping around the helix path.
springSketch = startSketchOn('XY')
springSketch = startSketchOn(XY)
|> circle(center = [0, 0], radius = 1)
|> sweep(path = helixPath)
```

View File

@ -31,7 +31,7 @@ helixRevolutions(
### Examples
```js
part001 = startSketchOn('XY')
part001 = startSketchOn(XY)
|> circle(center = [5, 5], radius = 10)
|> extrude(length = 10)
|> helixRevolutions({

View File

@ -32,7 +32,7 @@ hollow(
```js
// Hollow a basic sketch.
firstSketch = startSketchOn('XY')
firstSketch = startSketchOn(XY)
|> startProfileAt([-12, 12], %)
|> line(end = [24, 0])
|> line(end = [0, -24])
@ -46,7 +46,7 @@ firstSketch = startSketchOn('XY')
```js
// Hollow a basic sketch.
firstSketch = startSketchOn('-XZ')
firstSketch = startSketchOn(-XZ)
|> startProfileAt([-12, 12], %)
|> line(end = [24, 0])
|> line(end = [0, -24])
@ -61,7 +61,7 @@ firstSketch = startSketchOn('-XZ')
```js
// Hollow a sketch on face object.
size = 100
case = startSketchOn('-XZ')
case = startSketchOn(-XZ)
|> startProfileAt([-size, -size], %)
|> line(end = [2 * size, 0])
|> line(end = [0, 2 * size])

View File

@ -69,7 +69,7 @@ model = import("tests/inputs/cube.step")
```js
import height, buildSketch from "common.kcl"
plane = 'XZ'
plane = XZ
margin = 2
s1 = buildSketch(plane, [0, 0])
s2 = buildSketch(plane, [0, height() + margin])

View File

@ -36,7 +36,7 @@ int(num: number): number
n = int(ceil(5 / 2))
assertEqual(n, 3, 0.0001, "5/2 = 2.5, rounded up makes 3")
// Draw n cylinders.
startSketchOn('XZ')
startSketchOn(XZ)
|> circle(center = [0, 0], radius = 2)
|> extrude(length = 5)
|> patternTransform(

View File

@ -30,7 +30,7 @@ intersect(solids: [Solid]): [Solid]
```js
fn cube(center) {
return startSketchOn('XY')
return startSketchOn(XY)
|> startProfileAt([center[0] - 10, center[1] - 10], %)
|> line(endAbsolute = [center[0] + 10, center[1] - 10])
|> line(endAbsolute = [center[0] + 10, center[1] + 10])

View File

@ -27,7 +27,7 @@ lastSegX(sketch: Sketch): number
### Examples
```js
exampleSketch = startSketchOn("XZ")
exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> line(end = [5, 0])
|> line(end = [20, 5])

View File

@ -27,7 +27,7 @@ lastSegY(sketch: Sketch): number
### Examples
```js
exampleSketch = startSketchOn("XZ")
exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> line(end = [5, 0])
|> line(end = [20, 5])

View File

@ -31,7 +31,7 @@ ln(num: number): number
### Examples
```js
exampleSketch = startSketchOn("XZ")
exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> line(end = [ln(100), 15])
|> line(end = [5, -6])

View File

@ -42,7 +42,7 @@ loft(
```js
// Loft a square and a triangle.
squareSketch = startSketchOn('XY')
squareSketch = startSketchOn(XY)
|> startProfileAt([-100, 200], %)
|> line(end = [200, 0])
|> line(end = [0, -200])
@ -50,7 +50,7 @@ squareSketch = startSketchOn('XY')
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
triangleSketch = startSketchOn(offsetPlane('XY', offset = 75))
triangleSketch = startSketchOn(offsetPlane(XY, offset = 75))
|> startProfileAt([0, 125], %)
|> line(end = [-15, -30])
|> line(end = [30, 0])
@ -64,7 +64,7 @@ loft([squareSketch, triangleSketch])
```js
// Loft a square, a circle, and another circle.
squareSketch = startSketchOn('XY')
squareSketch = startSketchOn(XY)
|> startProfileAt([-100, 200], %)
|> line(end = [200, 0])
|> line(end = [0, -200])
@ -72,10 +72,10 @@ squareSketch = startSketchOn('XY')
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
circleSketch0 = startSketchOn(offsetPlane('XY', offset = 75))
circleSketch0 = startSketchOn(offsetPlane(XY, offset = 75))
|> circle(center = [0, 100], radius = 50)
circleSketch1 = startSketchOn(offsetPlane('XY', offset = 150))
circleSketch1 = startSketchOn(offsetPlane(XY, offset = 150))
|> circle(center = [0, 100], radius = 20)
loft([
@ -89,7 +89,7 @@ loft([
```js
// Loft a square, a circle, and another circle with options.
squareSketch = startSketchOn('XY')
squareSketch = startSketchOn(XY)
|> startProfileAt([-100, 200], %)
|> line(end = [200, 0])
|> line(end = [0, -200])
@ -97,10 +97,10 @@ squareSketch = startSketchOn('XY')
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
circleSketch0 = startSketchOn(offsetPlane('XY', offset = 75))
circleSketch0 = startSketchOn(offsetPlane(XY, offset = 75))
|> circle(center = [0, 100], radius = 50)
circleSketch1 = startSketchOn(offsetPlane('XY', offset = 150))
circleSketch1 = startSketchOn(offsetPlane(XY, offset = 150))
|> circle(center = [0, 100], radius = 20)
loft(

View File

@ -35,7 +35,7 @@ log(
### Examples
```js
exampleSketch = startSketchOn("XZ")
exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> line(end = [log(100, 5), 0])
|> line(end = [5, 8])

View File

@ -31,7 +31,7 @@ log10(num: number): number
### Examples
```js
exampleSketch = startSketchOn("XZ")
exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> line(end = [log10(100), 0])
|> line(end = [5, 8])

View File

@ -31,7 +31,7 @@ log2(num: number): number
### Examples
```js
exampleSketch = startSketchOn("XZ")
exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> line(end = [log2(100), 0])
|> line(end = [5, 8])

View File

@ -33,7 +33,7 @@ map(
```js
r = 10 // radius
fn drawCircle(id) {
return startSketchOn("XY")
return startSketchOn(XY)
|> circle(center = [id * 2 * r, 0], radius = r)
}
@ -49,7 +49,7 @@ circles = map([1..3], drawCircle)
r = 10 // radius
// Call `map`, using an anonymous function instead of a named one.
circles = map([1..3], fn(id) {
return startSketchOn("XY")
return startSketchOn(XY)
|> circle(center = [id * 2 * r, 0], radius = r)
})
```

View File

@ -31,7 +31,7 @@ max(args: [number]): number
### Examples
```js
exampleSketch = startSketchOn("XZ")
exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> angledLine({
angle = 70,

View File

@ -31,7 +31,7 @@ min(args: [number]): number
### Examples
```js
exampleSketch = startSketchOn("XZ")
exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> angledLine({
angle = 70,

View File

@ -34,7 +34,7 @@ mirror2d(
```js
// Mirror an un-closed sketch across the Y axis.
sketch001 = startSketchOn('XZ')
sketch001 = startSketchOn(XZ)
|> startProfileAt([0, 10], %)
|> line(end = [15, 0])
|> line(end = [-7, -3])
@ -53,7 +53,7 @@ example = extrude(sketch001, length = 10)
```js
// Mirror a un-closed sketch across the Y axis.
sketch001 = startSketchOn('XZ')
sketch001 = startSketchOn(XZ)
|> startProfileAt([0, 8.5], %)
|> line(end = [20, -8.5])
|> line(end = [-20, -8.5])
@ -66,11 +66,11 @@ example = extrude(sketch001, length = 10)
```js
// Mirror a un-closed sketch across an edge.
helper001 = startSketchOn('XZ')
helper001 = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> line(end = [0, 10], tag = $edge001)
sketch001 = startSketchOn('XZ')
sketch001 = startSketchOn(XZ)
|> startProfileAt([0, 8.5], %)
|> line(end = [20, -8.5])
|> line(end = [-20, -8.5])
@ -83,7 +83,7 @@ sketch001 = startSketchOn('XZ')
```js
// Mirror an un-closed sketch across a custom axis.
sketch001 = startSketchOn('XZ')
sketch001 = startSketchOn(XZ)
|> startProfileAt([0, 8.5], %)
|> line(end = [20, -8.5])
|> line(end = [-20, -8.5])

View File

@ -32,7 +32,7 @@ offsetPlane(
```js
// Loft a square and a circle on the `XY` plane using offset.
squareSketch = startSketchOn('XY')
squareSketch = startSketchOn(XY)
|> startProfileAt([-100, 200], %)
|> line(end = [200, 0])
|> line(end = [0, -200])
@ -40,7 +40,7 @@ squareSketch = startSketchOn('XY')
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
circleSketch = startSketchOn(offsetPlane('XY', offset = 150))
circleSketch = startSketchOn(offsetPlane(XY, offset = 150))
|> circle(center = [0, 100], radius = 50)
loft([squareSketch, circleSketch])
@ -50,7 +50,7 @@ loft([squareSketch, circleSketch])
```js
// Loft a square and a circle on the `XZ` plane using offset.
squareSketch = startSketchOn('XZ')
squareSketch = startSketchOn(XZ)
|> startProfileAt([-100, 200], %)
|> line(end = [200, 0])
|> line(end = [0, -200])
@ -58,7 +58,7 @@ squareSketch = startSketchOn('XZ')
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
circleSketch = startSketchOn(offsetPlane('XZ', offset = 150))
circleSketch = startSketchOn(offsetPlane(XZ, offset = 150))
|> circle(center = [0, 100], radius = 50)
loft([squareSketch, circleSketch])
@ -68,7 +68,7 @@ loft([squareSketch, circleSketch])
```js
// Loft a square and a circle on the `YZ` plane using offset.
squareSketch = startSketchOn('YZ')
squareSketch = startSketchOn(YZ)
|> startProfileAt([-100, 200], %)
|> line(end = [200, 0])
|> line(end = [0, -200])
@ -76,7 +76,7 @@ squareSketch = startSketchOn('YZ')
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
circleSketch = startSketchOn(offsetPlane('YZ', offset = 150))
circleSketch = startSketchOn(offsetPlane(YZ, offset = 150))
|> circle(center = [0, 100], radius = 50)
loft([squareSketch, circleSketch])
@ -86,7 +86,7 @@ loft([squareSketch, circleSketch])
```js
// Loft a square and a circle on the `-XZ` plane using offset.
squareSketch = startSketchOn('-XZ')
squareSketch = startSketchOn(-XZ)
|> startProfileAt([-100, 200], %)
|> line(end = [200, 0])
|> line(end = [0, -200])
@ -94,7 +94,7 @@ squareSketch = startSketchOn('-XZ')
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
circleSketch = startSketchOn(offsetPlane('-XZ', offset = -150))
circleSketch = startSketchOn(offsetPlane(-XZ, offset = -150))
|> circle(center = [0, 100], radius = 50)
loft([squareSketch, circleSketch])
@ -104,12 +104,12 @@ loft([squareSketch, circleSketch])
```js
// A circle on the XY plane
startSketchOn("XY")
startSketchOn(XY)
|> startProfileAt([0, 0], %)
|> circle(radius = 10, center = [0, 0])
// Triangle on the plane 4 units above
startSketchOn(offsetPlane("XY", offset = 4))
startSketchOn(offsetPlane(XY, offset = 4))
|> startProfileAt([0, 0], %)
|> line(end = [10, 0])
|> line(end = [0, 10])

View File

@ -39,7 +39,7 @@ patternCircular2d(
### Examples
```js
exampleSketch = startSketchOn('XZ')
exampleSketch = startSketchOn(XZ)
|> startProfileAt([.5, 25], %)
|> line(end = [0, 5])
|> line(end = [-1, 0])

View File

@ -41,7 +41,7 @@ patternCircular3d(
### Examples
```js
exampleSketch = startSketchOn('XZ')
exampleSketch = startSketchOn(XZ)
|> circle(center = [0, 0], radius = 1)
example = extrude(exampleSketch, length = -5)

View File

@ -37,7 +37,7 @@ patternLinear2d(
### Examples
```js
exampleSketch = startSketchOn('XZ')
exampleSketch = startSketchOn(XZ)
|> circle(center = [0, 0], radius = 1)
|> patternLinear2d(axis = [1, 0], instances = 7, distance = 4)

View File

@ -37,7 +37,7 @@ patternLinear3d(
### Examples
```js
exampleSketch = startSketchOn('XZ')
exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> line(end = [0, 2])
|> line(end = [3, 1])
@ -53,7 +53,7 @@ example = extrude(exampleSketch, length = 1)
```js
// Pattern a whole sketch on face.
size = 100
case = startSketchOn('XY')
case = startSketchOn(XY)
|> startProfileAt([-size, -size], %)
|> line(end = [2 * size, 0])
|> line(end = [0, 2 * size])
@ -84,7 +84,7 @@ patternLinear3d(
```js
// Pattern an object on a face.
size = 100
case = startSketchOn('XY')
case = startSketchOn(XY)
|> startProfileAt([-size, -size], %)
|> line(end = [2 * size, 0])
|> line(end = [0, 2 * size])

View File

@ -67,7 +67,7 @@ fn transform(id) {
}
// Sketch 4 cylinders.
sketch001 = startSketchOn('XZ')
sketch001 = startSketchOn(XZ)
|> circle(center = [0, 0], radius = 2)
|> extrude(length = 5)
|> patternTransform(instances = 4, transform = transform)
@ -83,7 +83,7 @@ fn transform(id) {
return { translate = [4 * (1 + id), 0, 0] }
}
sketch001 = startSketchOn('XZ')
sketch001 = startSketchOn(XZ)
|> circle(center = [0, 0], radius = 2)
|> extrude(length = 5)
|> patternTransform(instances = 4, transform = transform)
@ -101,7 +101,7 @@ fn cube(length, center) {
p2 = [l + x, l + y]
p3 = [l + x, -l + y]
return startSketchOn('XY')
return startSketchOn(XY)
|> startProfileAt(p0, %)
|> line(endAbsolute = p1)
|> line(endAbsolute = p2)
@ -139,7 +139,7 @@ fn cube(length, center) {
p2 = [l + x, l + y]
p3 = [l + x, -l + y]
return startSketchOn('XY')
return startSketchOn(XY)
|> startProfileAt(p0, %)
|> line(endAbsolute = p1)
|> line(endAbsolute = p2)
@ -182,7 +182,7 @@ fn transform(replicaId) {
}
// Each layer is just a pretty thin cylinder.
fn layer() {
return startSketchOn("XY")
return startSketchOn(XY)
// or some other plane idk
|> circle(center = [0, 0], radius = 1, tag = $tag1)
|> extrude(length = h)
@ -203,7 +203,7 @@ fn transform(i) {
{ rotation = { angle = 45 * i } }
]
}
startSketchOn('XY')
startSketchOn(XY)
|> startProfileAt([0, 0], %)
|> polygon({
radius = 10,

View File

@ -41,7 +41,7 @@ fn transform(id) {
}
// Sketch 4 circles.
sketch001 = startSketchOn('XZ')
sketch001 = startSketchOn(XZ)
|> circle(center = [0, 0], radius = 2)
|> patternTransform2d(instances = 4, transform = transform)
```

View File

@ -30,7 +30,7 @@ pi(): number
```js
circumference = 70
exampleSketch = startSketchOn("XZ")
exampleSketch = startSketchOn(XZ)
|> circle(center = [0, 0], radius = circumference / (2 * pi()))
example = extrude(exampleSketch, length = 5)

View File

@ -27,7 +27,7 @@ polar(data: PolarCoordsData): [number]
### Examples
```js
exampleSketch = startSketchOn('XZ')
exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> line(end = polar({ angle = 30, length = 5 }), tag = $thing)
|> line(end = [0, 5])

View File

@ -34,7 +34,7 @@ polygon(
```js
// Create a regular hexagon inscribed in a circle of radius 10
hex = startSketchOn('XY')
hex = startSketchOn(XY)
|> polygon({
radius = 10,
numSides = 6,
@ -49,7 +49,7 @@ example = extrude(hex, length = 5)
```js
// Create a square circumscribed around a circle of radius 5
square = startSketchOn('XY')
square = startSketchOn(XY)
|> polygon({
radius = 5.0,
numSides = 4,

View File

@ -35,7 +35,7 @@ pow(
### Examples
```js
exampleSketch = startSketchOn("XZ")
exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> angledLine({ angle = 50, length = pow(5, 2) }, %)
|> yLine(endAbsolute = 0)

View File

@ -82,7 +82,7 @@ fn decagon(radius) {
stepAngle = 1 / 10 * TAU
// Start the decagon sketch at this point.
startOfDecagonSketch = startSketchOn('XY')
startOfDecagonSketch = startSketchOn(XY)
|> startProfileAt([cos(0) * radius, sin(0) * radius], %)
// Use a `reduce` to draw the remaining decagon sides.

File diff suppressed because one or more lines are too long

View File

@ -58,7 +58,7 @@ rotate(
// Rotate a pipe with roll, pitch, and yaw.
// Create a path for the sweep.
sweepPath = startSketchOn('XZ')
sweepPath = startSketchOn(XZ)
|> startProfileAt([0.05, 0.05], %)
|> line(end = [0, 7])
|> tangentialArc({ offset = 90, radius = 5 }, %)
@ -67,10 +67,10 @@ sweepPath = startSketchOn('XZ')
|> line(end = [0, 7])
// Create a hole for the pipe.
pipeHole = startSketchOn('XY')
pipeHole = startSketchOn(XY)
|> circle(center = [0, 0], radius = 1.5)
sweepSketch = startSketchOn('XY')
sweepSketch = startSketchOn(XY)
|> circle(center = [0, 0], radius = 2)
|> hole(pipeHole, %)
|> sweep(path = sweepPath)
@ -83,7 +83,7 @@ sweepSketch = startSketchOn('XY')
// Rotate a pipe about an axis with an angle.
// Create a path for the sweep.
sweepPath = startSketchOn('XZ')
sweepPath = startSketchOn(XZ)
|> startProfileAt([0.05, 0.05], %)
|> line(end = [0, 7])
|> tangentialArc({ offset = 90, radius = 5 }, %)
@ -92,10 +92,10 @@ sweepPath = startSketchOn('XZ')
|> line(end = [0, 7])
// Create a hole for the pipe.
pipeHole = startSketchOn('XY')
pipeHole = startSketchOn(XY)
|> circle(center = [0, 0], radius = 1.5)
sweepSketch = startSketchOn('XY')
sweepSketch = startSketchOn(XY)
|> circle(center = [0, 0], radius = 2)
|> hole(pipeHole, %)
|> sweep(path = sweepPath)
@ -120,7 +120,7 @@ cube
// Sweep two sketches along the same path.
sketch001 = startSketchOn('XY')
sketch001 = startSketchOn(XY)
rectangleSketch = startProfileAt([-200, 23.86], sketch001)
|> angledLine([0, 73.47], %, $rectangleSegmentA001)
|> angledLine([
@ -136,7 +136,7 @@ rectangleSketch = startProfileAt([-200, 23.86], sketch001)
circleSketch = circle(sketch001, center = [200, -30.29], radius = 32.63)
sketch002 = startSketchOn('YZ')
sketch002 = startSketchOn(YZ)
sweepPath = startProfileAt([0, 0], sketch002)
|> yLine(length = 231.81)
|> tangentialArc({ radius = 80, offset = -90 }, %)
@ -152,7 +152,7 @@ rotate(parts, axis = [0, 0, 1.0], angle = 90)
```js
// Translate and rotate a sketch to create a loft.
sketch001 = startSketchOn('XY')
sketch001 = startSketchOn(XY)
fn square() {
return startProfileAt([-10, 10], sketch001)

View File

@ -31,7 +31,7 @@ round(num: number): number
### Examples
```js
sketch001 = startSketchOn('XZ')
sketch001 = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> line(endAbsolute = [12, 10])
|> line(end = [round(7.02986), 0])

View File

@ -38,7 +38,7 @@ scale(
// Scale a pipe.
// Create a path for the sweep.
sweepPath = startSketchOn('XZ')
sweepPath = startSketchOn(XZ)
|> startProfileAt([0.05, 0.05], %)
|> line(end = [0, 7])
|> tangentialArc({ offset = 90, radius = 5 }, %)
@ -47,10 +47,10 @@ sweepPath = startSketchOn('XZ')
|> line(end = [0, 7])
// Create a hole for the pipe.
pipeHole = startSketchOn('XY')
pipeHole = startSketchOn(XY)
|> circle(center = [0, 0], radius = 1.5)
sweepSketch = startSketchOn('XY')
sweepSketch = startSketchOn(XY)
|> circle(center = [0, 0], radius = 2)
|> hole(pipeHole, %)
|> sweep(path = sweepPath)
@ -75,7 +75,7 @@ cube
// Sweep two sketches along the same path.
sketch001 = startSketchOn('XY')
sketch001 = startSketchOn(XY)
rectangleSketch = startProfileAt([-200, 23.86], sketch001)
|> angledLine([0, 73.47], %, $rectangleSegmentA001)
|> angledLine([
@ -91,7 +91,7 @@ rectangleSketch = startProfileAt([-200, 23.86], sketch001)
circleSketch = circle(sketch001, center = [200, -30.29], radius = 32.63)
sketch002 = startSketchOn('YZ')
sketch002 = startSketchOn(YZ)
sweepPath = startProfileAt([0, 0], sketch002)
|> yLine(length = 231.81)
|> tangentialArc({ radius = 80, offset = -90 }, %)

View File

@ -27,7 +27,7 @@ segAng(tag: TagIdentifier): number
### Examples
```js
exampleSketch = startSketchOn('XZ')
exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> line(end = [10, 0])
|> line(end = [5, 10], tag = $seg01)

View File

@ -28,7 +28,7 @@ segEnd(tag: TagIdentifier): [number]
```js
w = 15
cube = startSketchOn('XY')
cube = startSketchOn(XY)
|> startProfileAt([0, 0], %)
|> line(end = [w, 0], tag = $line1)
|> line(end = [0, w], tag = $line2)
@ -38,7 +38,7 @@ cube = startSketchOn('XY')
|> extrude(length = 5)
fn cylinder(radius, tag) {
return startSketchOn('XY')
return startSketchOn(XY)
|> startProfileAt([0, 0], %)
|> circle(radius = radius, center = segEnd(tag))
|> extrude(length = radius)

View File

@ -27,7 +27,7 @@ segEndX(tag: TagIdentifier): number
### Examples
```js
exampleSketch = startSketchOn('XZ')
exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> line(end = [20, 0], tag = $thing)
|> line(end = [0, 5])

View File

@ -27,7 +27,7 @@ segEndY(tag: TagIdentifier): number
### Examples
```js
exampleSketch = startSketchOn('XZ')
exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> line(end = [20, 0])
|> line(end = [0, 3], tag = $thing)

View File

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

View File

@ -28,7 +28,7 @@ segStart(tag: TagIdentifier): [number]
```js
w = 15
cube = startSketchOn('XY')
cube = startSketchOn(XY)
|> startProfileAt([0, 0], %)
|> line(end = [w, 0], tag = $line1)
|> line(end = [0, w], tag = $line2)
@ -38,7 +38,7 @@ cube = startSketchOn('XY')
|> extrude(length = 5)
fn cylinder(radius, tag) {
return startSketchOn('XY')
return startSketchOn(XY)
|> startProfileAt([0, 0], %)
|> circle(radius = radius, center = segStart(tag))
|> extrude(length = radius)

View File

@ -27,7 +27,7 @@ segStartX(tag: TagIdentifier): number
### Examples
```js
exampleSketch = startSketchOn('XZ')
exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> line(end = [20, 0], tag = $thing)
|> line(end = [0, 5])

View File

@ -27,7 +27,7 @@ segStartY(tag: TagIdentifier): number
### Examples
```js
exampleSketch = startSketchOn('XZ')
exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> line(end = [20, 0])
|> line(end = [0, 3], tag = $thing)

View File

@ -34,7 +34,7 @@ shell(
```js
// Remove the end face for the extrusion.
firstSketch = startSketchOn('XY')
firstSketch = startSketchOn(XY)
|> startProfileAt([-12, 12], %)
|> line(end = [24, 0])
|> line(end = [0, -24])
@ -50,7 +50,7 @@ shell(firstSketch, faces = ['end'], thickness = 0.25)
```js
// Remove the start face for the extrusion.
firstSketch = startSketchOn('-XZ')
firstSketch = startSketchOn(-XZ)
|> startProfileAt([-12, 12], %)
|> line(end = [24, 0])
|> line(end = [0, -24])
@ -66,7 +66,7 @@ shell(firstSketch, faces = ['start'], thickness = 0.25)
```js
// Remove a tagged face and the end face for the extrusion.
firstSketch = startSketchOn('XY')
firstSketch = startSketchOn(XY)
|> startProfileAt([-12, 12], %)
|> line(end = [24, 0])
|> line(end = [0, -24])
@ -82,7 +82,7 @@ shell(firstSketch, faces = [myTag], thickness = 0.25)
```js
// Remove multiple faces at once.
firstSketch = startSketchOn('XY')
firstSketch = startSketchOn(XY)
|> startProfileAt([-12, 12], %)
|> line(end = [24, 0])
|> line(end = [0, -24])
@ -99,7 +99,7 @@ shell(firstSketch, faces = [myTag, 'end'], thickness = 0.25)
```js
// Shell a sketch on face.
size = 100
case = startSketchOn('-XZ')
case = startSketchOn(-XZ)
|> startProfileAt([-size, -size], %)
|> line(end = [2 * size, 0])
|> line(end = [0, 2 * size])
@ -124,7 +124,7 @@ shell(case, faces = ['start'], thickness = 5)
```js
// Shell a sketch on face object on the end face.
size = 100
case = startSketchOn('XY')
case = startSketchOn(XY)
|> startProfileAt([-size, -size], %)
|> line(end = [2 * size, 0])
|> line(end = [0, 2 * size])
@ -152,7 +152,7 @@ shell(thing1, faces = ['end'], thickness = 5)
size = 100
case = startSketchOn('XY')
case = startSketchOn(XY)
|> startProfileAt([-size, -size], %)
|> line(end = [2 * size, 0])
|> line(end = [0, 2 * size])

View File

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

View File

@ -38,7 +38,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"myAngle = -120\n\nsketch001 = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line(end = [8, 0])\n |> angledLine({ angle = abs(myAngle), length = 5 }, %)\n |> line(end = [-5, 0])\n |> angledLine({ angle = myAngle, length = 5 }, %)\n |> close()\n\nbaseExtrusion = extrude(sketch001, length = 5)"
"myAngle = -120\n\nsketch001 = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> line(end = [8, 0])\n |> angledLine({ angle = abs(myAngle), length = 5 }, %)\n |> line(end = [-5, 0])\n |> angledLine({ angle = myAngle, length = 5 }, %)\n |> close()\n\nbaseExtrusion = extrude(sketch001, length = 5)"
]
},
{
@ -80,7 +80,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"sketch001 = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> angledLine({\n angle = toDegrees(acos(0.5)),\n length = 10\n }, %)\n |> line(end = [5, 0])\n |> line(endAbsolute = [12, 0])\n |> close()\n\nextrude001 = extrude(sketch001, length = 5)"
"sketch001 = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> angledLine({\n angle = toDegrees(acos(0.5)),\n length = 10\n }, %)\n |> line(end = [5, 0])\n |> line(endAbsolute = [12, 0])\n |> close()\n\nextrude001 = extrude(sketch001, length = 5)"
]
},
{
@ -1796,7 +1796,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"sketch001 = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line(end = [2, 5], tag = $seg01)\n |> angledLineToX([-angleToMatchLengthX(seg01, 7, %), 10], %)\n |> close()\n\nextrusion = extrude(sketch001, length = 5)"
"sketch001 = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> line(end = [2, 5], tag = $seg01)\n |> angledLineToX([-angleToMatchLengthX(seg01, 7, %), 10], %)\n |> close()\n\nextrusion = extrude(sketch001, length = 5)"
]
},
{
@ -3512,7 +3512,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"sketch001 = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line(end = [1, 2], tag = $seg01)\n |> angledLine({\n angle = angleToMatchLengthY(seg01, 15, %),\n length = 5\n }, %)\n |> yLine(endAbsolute = 0)\n |> close()\n\nextrusion = extrude(sketch001, length = 5)"
"sketch001 = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> line(end = [1, 2], tag = $seg01)\n |> angledLine({\n angle = angleToMatchLengthY(seg01, 15, %),\n length = 5\n }, %)\n |> yLine(endAbsolute = 0)\n |> close()\n\nextrusion = extrude(sketch001, length = 5)"
]
},
{
@ -41304,15 +41304,15 @@
"unpublished": false,
"deprecated": false,
"examples": [
"// Add color to an extruded solid.\nexampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> line(endAbsolute = [10, 0])\n |> line(endAbsolute = [0, 10])\n |> line(endAbsolute = [-10, 0])\n |> close()\n\nexample = extrude(exampleSketch, length = 5)\n // There are other options besides 'color', but they're optional.\n |> appearance(color = '#ff0000')",
"// Add color to a revolved solid.\nsketch001 = startSketchOn('XY')\n |> circle(center = [15, 0], radius = 5)\n |> revolve(angle = 360, axis = 'y')\n |> appearance(color = '#ff0000', metalness = 90, roughness = 90)",
"// Add color to different solids.\nfn cube(center) {\n return startSketchOn('XY')\n |> startProfileAt([center[0] - 10, center[1] - 10], %)\n |> line(endAbsolute = [center[0] + 10, center[1] - 10])\n |> line(endAbsolute = [center[0] + 10, center[1] + 10])\n |> line(endAbsolute = [center[0] - 10, center[1] + 10])\n |> close()\n |> extrude(length = 10)\n}\n\nexample0 = cube([0, 0])\nexample1 = cube([20, 0])\nexample2 = cube([40, 0])\n\nappearance(\n [example0, example1],\n color = '#ff0000',\n metalness = 50,\n roughness = 50,\n)\nappearance(\n example2,\n color = '#00ff00',\n metalness = 50,\n roughness = 50,\n)",
"// You can set the appearance before or after you shell it will yield the same result.\n// This example shows setting the appearance _after_ the shell.\nfirstSketch = startSketchOn('XY')\n |> startProfileAt([-12, 12], %)\n |> line(end = [24, 0])\n |> line(end = [0, -24])\n |> line(end = [-24, 0])\n |> close()\n |> extrude(length = 6)\n\nshell(firstSketch, faces = ['end'], thickness = 0.25)\n |> appearance(color = '#ff0000', metalness = 90, roughness = 90)",
"// You can set the appearance before or after you shell it will yield the same result.\n// This example shows setting the appearance _before_ the shell.\nfirstSketch = startSketchOn('XY')\n |> startProfileAt([-12, 12], %)\n |> line(end = [24, 0])\n |> line(end = [0, -24])\n |> line(end = [-24, 0])\n |> close()\n |> extrude(length = 6)\n |> appearance(color = '#ff0000', metalness = 90, roughness = 90)\n\nshell(firstSketch, faces = ['end'], thickness = 0.25)",
"// Setting the appearance of a 3D pattern can be done _before_ or _after_ the pattern.\n// This example shows _before_ the pattern.\nexampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line(end = [0, 2])\n |> line(end = [3, 1])\n |> line(end = [0, -4])\n |> close()\n\nexample = extrude(exampleSketch, length = 1)\n |> appearance(color = '#ff0000', metalness = 90, roughness = 90)\n |> patternLinear3d(axis = [1, 0, 1], instances = 7, distance = 6)",
"// Setting the appearance of a 3D pattern can be done _before_ or _after_ the pattern.\n// This example shows _after_ the pattern.\nexampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line(end = [0, 2])\n |> line(end = [3, 1])\n |> line(end = [0, -4])\n |> close()\n\nexample = extrude(exampleSketch, length = 1)\n |> patternLinear3d(axis = [1, 0, 1], instances = 7, distance = 6)\n |> appearance(color = '#ff0000', metalness = 90, roughness = 90)",
"// Color the result of a 2D pattern that was extruded.\nexampleSketch = startSketchOn('XZ')\n |> startProfileAt([.5, 25], %)\n |> line(end = [0, 5])\n |> line(end = [-1, 0])\n |> line(end = [0, -5])\n |> close()\n |> patternCircular2d(\n center = [0, 0],\n instances = 13,\n arcDegrees = 360,\n rotateDuplicates = true,\n )\n\nexample = extrude(exampleSketch, length = 1)\n |> appearance(color = '#ff0000', metalness = 90, roughness = 90)",
"// Color the result of a sweep.\n\n// Create a path for the sweep.\nsweepPath = startSketchOn('XZ')\n |> startProfileAt([0.05, 0.05], %)\n |> line(end = [0, 7])\n |> tangentialArc({ offset = 90, radius = 5 }, %)\n |> line(end = [-3, 0])\n |> tangentialArc({ offset = -90, radius = 5 }, %)\n |> line(end = [0, 7])\n\npipeHole = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 1.5)\n\nsweepSketch = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 2)\n |> hole(pipeHole, %)\n |> sweep(path = sweepPath)\n |> appearance(color = \"#ff0000\", metalness = 50, roughness = 50)"
"// Add color to an extruded solid.\nexampleSketch = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> line(endAbsolute = [10, 0])\n |> line(endAbsolute = [0, 10])\n |> line(endAbsolute = [-10, 0])\n |> close()\n\nexample = extrude(exampleSketch, length = 5)\n // There are other options besides 'color', but they're optional.\n |> appearance(color = '#ff0000')",
"// Add color to a revolved solid.\nsketch001 = startSketchOn(XY)\n |> circle(center = [15, 0], radius = 5)\n |> revolve(angle = 360, axis = 'y')\n |> appearance(color = '#ff0000', metalness = 90, roughness = 90)",
"// Add color to different solids.\nfn cube(center) {\n return startSketchOn(XY)\n |> startProfileAt([center[0] - 10, center[1] - 10], %)\n |> line(endAbsolute = [center[0] + 10, center[1] - 10])\n |> line(endAbsolute = [center[0] + 10, center[1] + 10])\n |> line(endAbsolute = [center[0] - 10, center[1] + 10])\n |> close()\n |> extrude(length = 10)\n}\n\nexample0 = cube([0, 0])\nexample1 = cube([20, 0])\nexample2 = cube([40, 0])\n\nappearance(\n [example0, example1],\n color = '#ff0000',\n metalness = 50,\n roughness = 50,\n)\nappearance(\n example2,\n color = '#00ff00',\n metalness = 50,\n roughness = 50,\n)",
"// You can set the appearance before or after you shell it will yield the same result.\n// This example shows setting the appearance _after_ the shell.\nfirstSketch = startSketchOn(XY)\n |> startProfileAt([-12, 12], %)\n |> line(end = [24, 0])\n |> line(end = [0, -24])\n |> line(end = [-24, 0])\n |> close()\n |> extrude(length = 6)\n\nshell(firstSketch, faces = ['end'], thickness = 0.25)\n |> appearance(color = '#ff0000', metalness = 90, roughness = 90)",
"// You can set the appearance before or after you shell it will yield the same result.\n// This example shows setting the appearance _before_ the shell.\nfirstSketch = startSketchOn(XY)\n |> startProfileAt([-12, 12], %)\n |> line(end = [24, 0])\n |> line(end = [0, -24])\n |> line(end = [-24, 0])\n |> close()\n |> extrude(length = 6)\n |> appearance(color = '#ff0000', metalness = 90, roughness = 90)\n\nshell(firstSketch, faces = ['end'], thickness = 0.25)",
"// Setting the appearance of a 3D pattern can be done _before_ or _after_ the pattern.\n// This example shows _before_ the pattern.\nexampleSketch = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> line(end = [0, 2])\n |> line(end = [3, 1])\n |> line(end = [0, -4])\n |> close()\n\nexample = extrude(exampleSketch, length = 1)\n |> appearance(color = '#ff0000', metalness = 90, roughness = 90)\n |> patternLinear3d(axis = [1, 0, 1], instances = 7, distance = 6)",
"// Setting the appearance of a 3D pattern can be done _before_ or _after_ the pattern.\n// This example shows _after_ the pattern.\nexampleSketch = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> line(end = [0, 2])\n |> line(end = [3, 1])\n |> line(end = [0, -4])\n |> close()\n\nexample = extrude(exampleSketch, length = 1)\n |> patternLinear3d(axis = [1, 0, 1], instances = 7, distance = 6)\n |> appearance(color = '#ff0000', metalness = 90, roughness = 90)",
"// Color the result of a 2D pattern that was extruded.\nexampleSketch = startSketchOn(XZ)\n |> startProfileAt([.5, 25], %)\n |> line(end = [0, 5])\n |> line(end = [-1, 0])\n |> line(end = [0, -5])\n |> close()\n |> patternCircular2d(\n center = [0, 0],\n instances = 13,\n arcDegrees = 360,\n rotateDuplicates = true,\n )\n\nexample = extrude(exampleSketch, length = 1)\n |> appearance(color = '#ff0000', metalness = 90, roughness = 90)",
"// Color the result of a sweep.\n\n// Create a path for the sweep.\nsweepPath = startSketchOn(XZ)\n |> startProfileAt([0.05, 0.05], %)\n |> line(end = [0, 7])\n |> tangentialArc({ offset = 90, radius = 5 }, %)\n |> line(end = [-3, 0])\n |> tangentialArc({ offset = -90, radius = 5 }, %)\n |> line(end = [0, 7])\n\npipeHole = startSketchOn(XY)\n |> circle(center = [0, 0], radius = 1.5)\n\nsweepSketch = startSketchOn(XY)\n |> circle(center = [0, 0], radius = 2)\n |> hole(pipeHole, %)\n |> sweep(path = sweepPath)\n |> appearance(color = \"#ff0000\", metalness = 50, roughness = 50)"
]
},
{
@ -51323,7 +51323,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"sketch001 = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> angledLine({\n angle = toDegrees(asin(0.5)),\n length = 20\n }, %)\n |> yLine(endAbsolute = 0)\n |> close()\n\nextrude001 = extrude(sketch001, length = 5)"
"sketch001 = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> angledLine({\n angle = toDegrees(asin(0.5)),\n length = 20\n }, %)\n |> yLine(endAbsolute = 0)\n |> close()\n\nextrude001 = extrude(sketch001, length = 5)"
]
},
{
@ -51748,7 +51748,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"sketch001 = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> angledLine({\n angle = toDegrees(atan(1.25)),\n length = 20\n }, %)\n |> yLine(endAbsolute = 0)\n |> close()\n\nextrude001 = extrude(sketch001, length = 5)"
"sketch001 = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> angledLine({\n angle = toDegrees(atan(1.25)),\n length = 20\n }, %)\n |> yLine(endAbsolute = 0)\n |> close()\n\nextrude001 = extrude(sketch001, length = 5)"
]
},
{
@ -51803,7 +51803,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"sketch001 = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> angledLine({\n angle = toDegrees(atan2(1.25, 2)),\n length = 20\n }, %)\n |> yLine(endAbsolute = 0)\n |> close()\n\nextrude001 = extrude(sketch001, length = 5)"
"sketch001 = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> angledLine({\n angle = toDegrees(atan2(1.25, 2)),\n length = 20\n }, %)\n |> yLine(endAbsolute = 0)\n |> close()\n\nextrude001 = extrude(sketch001, length = 5)"
]
},
{
@ -56820,7 +56820,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"sketch001 = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line(endAbsolute = [12, 10])\n |> line(end = [ceil(7.02986), 0])\n |> yLine(endAbsolute = 0)\n |> close()\n\nextrude001 = extrude(sketch001, length = 5)"
"sketch001 = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> line(endAbsolute = [12, 10])\n |> line(end = [ceil(7.02986), 0])\n |> yLine(endAbsolute = 0)\n |> close()\n\nextrude001 = extrude(sketch001, length = 5)"
]
},
{
@ -64987,8 +64987,8 @@
"unpublished": false,
"deprecated": false,
"examples": [
"// Chamfer a mounting plate.\nwidth = 20\nlength = 10\nthickness = 1\nchamferLength = 2\n\nmountingPlateSketch = startSketchOn(\"XY\")\n |> startProfileAt([-width / 2, -length / 2], %)\n |> line(endAbsolute = [width / 2, -length / 2], tag = $edge1)\n |> line(endAbsolute = [width / 2, length / 2], tag = $edge2)\n |> line(endAbsolute = [-width / 2, length / 2], tag = $edge3)\n |> close(tag = $edge4)\n\nmountingPlate = extrude(mountingPlateSketch, length = thickness)\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(end = [0, scale])\n |> line(end = [scale, 0])\n |> line(end = [0, -scale])\n\n return sg\n}\n\npart001 = cube([0, 0], 20)\n |> close(tag = $line1)\n |> extrude(length = 20)\n // We tag the chamfer to reference it later.\n |> chamfer(length = 10, tags = [getOppositeEdge(line1)], tag = $chamfer1)\n\nsketch001 = startSketchOn(part001, chamfer1)\n |> startProfileAt([10, 10], %)\n |> line(end = [2, 0])\n |> line(end = [0, 2])\n |> line(end = [-2, 0])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n |> extrude(length = 10)"
"// Chamfer a mounting plate.\nwidth = 20\nlength = 10\nthickness = 1\nchamferLength = 2\n\nmountingPlateSketch = startSketchOn(XY)\n |> startProfileAt([-width / 2, -length / 2], %)\n |> line(endAbsolute = [width / 2, -length / 2], tag = $edge1)\n |> line(endAbsolute = [width / 2, length / 2], tag = $edge2)\n |> line(endAbsolute = [-width / 2, length / 2], tag = $edge3)\n |> close(tag = $edge4)\n\nmountingPlate = extrude(mountingPlateSketch, length = thickness)\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(end = [0, scale])\n |> line(end = [scale, 0])\n |> line(end = [0, -scale])\n\n return sg\n}\n\npart001 = cube([0, 0], 20)\n |> close(tag = $line1)\n |> extrude(length = 20)\n // We tag the chamfer to reference it later.\n |> chamfer(length = 10, tags = [getOppositeEdge(line1)], tag = $chamfer1)\n\nsketch001 = startSketchOn(part001, chamfer1)\n |> startProfileAt([10, 10], %)\n |> line(end = [2, 0])\n |> line(end = [0, 2])\n |> line(end = [-2, 0])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n |> extrude(length = 10)"
]
},
{
@ -73061,8 +73061,8 @@
"unpublished": false,
"deprecated": false,
"examples": [
"exampleSketch = startSketchOn(\"-XZ\")\n |> circle(center = [0, 0], radius = 10)\n\nexample = extrude(exampleSketch, length = 5)",
"exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([-15, 0], %)\n |> line(end = [30, 0])\n |> line(end = [0, 30])\n |> line(end = [-30, 0])\n |> close()\n |> hole(circle(center = [0, 15], radius = 5), %)\n\nexample = extrude(exampleSketch, length = 5)"
"exampleSketch = startSketchOn(-XZ)\n |> circle(center = [0, 0], radius = 10)\n\nexample = extrude(exampleSketch, length = 5)",
"exampleSketch = startSketchOn(XZ)\n |> startProfileAt([-15, 0], %)\n |> line(end = [30, 0])\n |> line(end = [0, 30])\n |> line(end = [-30, 0])\n |> close()\n |> hole(circle(center = [0, 15], radius = 5), %)\n\nexample = extrude(exampleSketch, length = 5)"
]
},
{
@ -77993,7 +77993,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"exampleSketch = startSketchOn(\"XY\")\n |> circleThreePoint(p1 = [10, 10], p2 = [20, 8], p3 = [15, 5])\n |> extrude(length = 5)"
"exampleSketch = startSketchOn(XY)\n |> circleThreePoint(p1 = [10, 10], p2 = [20, 8], p3 = [15, 5])\n |> extrude(length = 5)"
]
},
{
@ -82977,7 +82977,7 @@
"unpublished": false,
"deprecated": true,
"examples": [
"exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({ angle = 30, length = 2 * e() ^ 2 }, %)\n |> yLine(endAbsolute = 0)\n |> close()\n\nexample = extrude(exampleSketch, length = 10)"
"exampleSketch = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> angledLine({ angle = 30, length = 2 * e() ^ 2 }, %)\n |> yLine(endAbsolute = 0)\n |> close()\n\nexample = extrude(exampleSketch, length = 10)"
]
},
{
@ -90985,8 +90985,8 @@
"unpublished": false,
"deprecated": false,
"examples": [
"example = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line(end = [10, 0])\n |> arc({\n angleStart = 120,\n angleEnd = 0,\n radius = 5\n }, %)\n |> line(end = [5, 0])\n |> line(end = [0, 10])\n |> bezierCurve({\n control1 = [-10, 0],\n control2 = [2, 10],\n to = [-5, 10]\n }, %)\n |> line(end = [-5, -2])\n |> close()\n |> extrude(length = 10)",
"exampleSketch = startSketchOn('XZ')\n |> startProfileAt([-10, 0], %)\n |> arc({\n angleStart = 120,\n angleEnd = -60,\n radius = 5\n }, %)\n |> line(end = [10, 0])\n |> line(end = [5, 0])\n |> bezierCurve({\n control1 = [-3, 0],\n control2 = [2, 10],\n to = [-5, 10]\n }, %)\n |> line(end = [-4, 10])\n |> line(end = [-5, -2])\n |> close()\n\nexample = extrude(exampleSketch, length = 10)"
"example = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> line(end = [10, 0])\n |> arc({\n angleStart = 120,\n angleEnd = 0,\n radius = 5\n }, %)\n |> line(end = [5, 0])\n |> line(end = [0, 10])\n |> bezierCurve({\n control1 = [-10, 0],\n control2 = [2, 10],\n to = [-5, 10]\n }, %)\n |> line(end = [-5, -2])\n |> close()\n |> extrude(length = 10)",
"exampleSketch = startSketchOn(XZ)\n |> startProfileAt([-10, 0], %)\n |> arc({\n angleStart = 120,\n angleEnd = -60,\n radius = 5\n }, %)\n |> line(end = [10, 0])\n |> line(end = [5, 0])\n |> bezierCurve({\n control1 = [-3, 0],\n control2 = [2, 10],\n to = [-5, 10]\n }, %)\n |> line(end = [-4, 10])\n |> line(end = [-5, -2])\n |> close()\n\nexample = extrude(exampleSketch, length = 10)"
]
},
{
@ -100768,8 +100768,8 @@
"unpublished": false,
"deprecated": false,
"examples": [
"width = 20\nlength = 10\nthickness = 1\nfilletRadius = 2\n\nmountingPlateSketch = startSketchOn(\"XY\")\n |> startProfileAt([-width / 2, -length / 2], %)\n |> line(endAbsolute = [width / 2, -length / 2], tag = $edge1)\n |> line(endAbsolute = [width / 2, length / 2], tag = $edge2)\n |> line(endAbsolute = [-width / 2, length / 2], tag = $edge3)\n |> close(tag = $edge4)\n\nmountingPlate = extrude(mountingPlateSketch, length = thickness)\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 |> line(endAbsolute = [width / 2, -length / 2], tag = $edge1)\n |> line(endAbsolute = [width / 2, length / 2], tag = $edge2)\n |> line(endAbsolute = [-width / 2, length / 2], tag = $edge3)\n |> close(tag = $edge4)\n\nmountingPlate = extrude(mountingPlateSketch, length = thickness)\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 = 2\n\nmountingPlateSketch = startSketchOn(XY)\n |> startProfileAt([-width / 2, -length / 2], %)\n |> line(endAbsolute = [width / 2, -length / 2], tag = $edge1)\n |> line(endAbsolute = [width / 2, length / 2], tag = $edge2)\n |> line(endAbsolute = [-width / 2, length / 2], tag = $edge3)\n |> close(tag = $edge4)\n\nmountingPlate = extrude(mountingPlateSketch, length = thickness)\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 |> line(endAbsolute = [width / 2, -length / 2], tag = $edge1)\n |> line(endAbsolute = [width / 2, length / 2], tag = $edge2)\n |> line(endAbsolute = [-width / 2, length / 2], tag = $edge3)\n |> close(tag = $edge4)\n\nmountingPlate = extrude(mountingPlateSketch, length = thickness)\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 )"
]
},
{
@ -100811,7 +100811,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"sketch001 = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line(endAbsolute = [12, 10])\n |> line(end = [floor(7.02986), 0])\n |> yLine(endAbsolute = 0)\n |> close()\n\nextrude001 = extrude(sketch001, length = 5)"
"sketch001 = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> line(endAbsolute = [12, 10])\n |> line(end = [floor(7.02986), 0])\n |> yLine(endAbsolute = 0)\n |> close()\n\nextrude001 = extrude(sketch001, length = 5)"
]
},
{
@ -100895,7 +100895,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"// Get an edge shared between two faces, created after a chamfer.\n\n\nscale = 20\npart001 = startSketchOn('XY')\n |> startProfileAt([0, 0], %)\n |> line(end = [0, scale])\n |> line(end = [scale, 0])\n |> line(end = [0, -scale])\n |> close(tag = $line0)\n |> extrude(length = 20, tagEnd = $end0)\n // We tag the chamfer to reference it later.\n |> chamfer(length = 10, tags = [getOppositeEdge(line0)], tag = $chamfer0)\n\n// Get the shared edge between the chamfer and the extrusion.\ncommonEdge = getCommonEdge(faces = [chamfer0, end0])\n\n// Chamfer the shared edge.\n// TODO: uncomment this when ssi for fillets lands\n// chamfer(part001, length = 5, tags = [commonEdge])"
"// Get an edge shared between two faces, created after a chamfer.\n\n\nscale = 20\npart001 = startSketchOn(XY)\n |> startProfileAt([0, 0], %)\n |> line(end = [0, scale])\n |> line(end = [scale, 0])\n |> line(end = [0, -scale])\n |> close(tag = $line0)\n |> extrude(length = 20, tagEnd = $end0)\n // We tag the chamfer to reference it later.\n |> chamfer(length = 10, tags = [getOppositeEdge(line0)], tag = $chamfer0)\n\n// Get the shared edge between the chamfer and the extrusion.\ncommonEdge = getCommonEdge(faces = [chamfer0, end0])\n\n// Chamfer the shared edge.\n// TODO: uncomment this when ssi for fillets lands\n// chamfer(part001, length = 5, tags = [commonEdge])"
]
},
{
@ -100942,7 +100942,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line(end = [10, 0])\n |> angledLine({ angle = 60, length = 10 }, %)\n |> angledLine({ angle = 120, length = 10 }, %)\n |> line(end = [-10, 0])\n |> angledLine({ angle = 240, length = 10 }, %, $referenceEdge)\n |> close()\n\nexample = extrude(exampleSketch, length = 5)\n |> fillet(radius = 3, tags = [getNextAdjacentEdge(referenceEdge)])"
"exampleSketch = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> line(end = [10, 0])\n |> angledLine({ angle = 60, length = 10 }, %)\n |> angledLine({ angle = 120, length = 10 }, %)\n |> line(end = [-10, 0])\n |> angledLine({ angle = 240, length = 10 }, %, $referenceEdge)\n |> close()\n\nexample = extrude(exampleSketch, length = 5)\n |> fillet(radius = 3, tags = [getNextAdjacentEdge(referenceEdge)])"
]
},
{
@ -100989,7 +100989,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line(end = [10, 0])\n |> angledLine({ angle = 60, length = 10 }, %)\n |> angledLine({ angle = 120, length = 10 }, %)\n |> line(end = [-10, 0])\n |> angledLine({ angle = 240, length = 10 }, %, $referenceEdge)\n |> close()\n\nexample = extrude(exampleSketch, length = 5)\n |> fillet(radius = 3, tags = [getOppositeEdge(referenceEdge)])"
"exampleSketch = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> line(end = [10, 0])\n |> angledLine({ angle = 60, length = 10 }, %)\n |> angledLine({ angle = 120, length = 10 }, %)\n |> line(end = [-10, 0])\n |> angledLine({ angle = 240, length = 10 }, %, $referenceEdge)\n |> close()\n\nexample = extrude(exampleSketch, length = 5)\n |> fillet(radius = 3, tags = [getOppositeEdge(referenceEdge)])"
]
},
{
@ -101036,7 +101036,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line(end = [10, 0])\n |> angledLine({ angle = 60, length = 10 }, %)\n |> angledLine({ angle = 120, length = 10 }, %)\n |> line(end = [-10, 0])\n |> angledLine({ angle = 240, length = 10 }, %, $referenceEdge)\n |> close()\n\nexample = extrude(exampleSketch, length = 5)\n |> fillet(radius = 3, tags = [getPreviousAdjacentEdge(referenceEdge)])"
"exampleSketch = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> line(end = [10, 0])\n |> angledLine({ angle = 60, length = 10 }, %)\n |> angledLine({ angle = 120, length = 10 }, %)\n |> line(end = [-10, 0])\n |> angledLine({ angle = 240, length = 10 }, %, $referenceEdge)\n |> close()\n\nexample = extrude(exampleSketch, length = 5)\n |> fillet(radius = 3, tags = [getPreviousAdjacentEdge(referenceEdge)])"
]
},
{
@ -101531,9 +101531,9 @@
"unpublished": false,
"deprecated": false,
"examples": [
"// Create a helix around the Z axis.\nhelixPath = helix(\n angleStart = 0,\n ccw = true,\n revolutions = 5,\n length = 10,\n radius = 5,\n axis = 'Z',\n)\n\n// Create a spring by sweeping around the helix path.\nspringSketch = startSketchOn('YZ')\n |> circle(center = [0, 0], radius = 0.5)\n |> sweep(path = helixPath)",
"// Create a helix around an edge.\nhelper001 = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line(end = [0, 10], tag = $edge001)\n\nhelixPath = helix(\n angleStart = 0,\n ccw = true,\n revolutions = 5,\n length = 10,\n radius = 5,\n axis = edge001,\n)\n\n// Create a spring by sweeping around the helix path.\nspringSketch = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 0.5)\n |> sweep(path = helixPath)",
"// Create a helix around a custom axis.\nhelixPath = helix(\n angleStart = 0,\n ccw = true,\n revolutions = 5,\n length = 10,\n radius = 5,\n axis = {\n custom = {\n axis = [0, 0, 1.0],\n origin = [0, 0.25, 0]\n }\n },\n)\n\n// Create a spring by sweeping around the helix path.\nspringSketch = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 1)\n |> sweep(path = helixPath)"
"// Create a helix around the Z axis.\nhelixPath = helix(\n angleStart = 0,\n ccw = true,\n revolutions = 5,\n length = 10,\n radius = 5,\n axis = 'Z',\n)\n\n// Create a spring by sweeping around the helix path.\nspringSketch = startSketchOn(YZ)\n |> circle(center = [0, 0], radius = 0.5)\n |> sweep(path = helixPath)",
"// Create a helix around an edge.\nhelper001 = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> line(end = [0, 10], tag = $edge001)\n\nhelixPath = helix(\n angleStart = 0,\n ccw = true,\n revolutions = 5,\n length = 10,\n radius = 5,\n axis = edge001,\n)\n\n// Create a spring by sweeping around the helix path.\nspringSketch = startSketchOn(XY)\n |> circle(center = [0, 0], radius = 0.5)\n |> sweep(path = helixPath)",
"// Create a helix around a custom axis.\nhelixPath = helix(\n angleStart = 0,\n ccw = true,\n revolutions = 5,\n length = 10,\n radius = 5,\n axis = {\n custom = {\n axis = [0, 0, 1.0],\n origin = [0, 0.25, 0]\n }\n },\n)\n\n// Create a spring by sweeping around the helix path.\nspringSketch = startSketchOn(XY)\n |> circle(center = [0, 0], radius = 1)\n |> sweep(path = helixPath)"
]
},
{
@ -104907,7 +104907,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"part001 = startSketchOn('XY')\n |> circle(center = [5, 5], radius = 10)\n |> extrude(length = 10)\n |> helixRevolutions({\n angleStart = 0,\n ccw = true,\n revolutions = 16\n }, %)"
"part001 = startSketchOn(XY)\n |> circle(center = [5, 5], radius = 10)\n |> extrude(length = 10)\n |> helixRevolutions({\n angleStart = 0,\n ccw = true,\n revolutions = 16\n }, %)"
]
},
{
@ -113179,9 +113179,9 @@
"unpublished": false,
"deprecated": false,
"examples": [
"// Hollow a basic sketch.\nfirstSketch = startSketchOn('XY')\n |> startProfileAt([-12, 12], %)\n |> line(end = [24, 0])\n |> line(end = [0, -24])\n |> line(end = [-24, 0])\n |> close()\n |> extrude(length = 6)\n |> hollow(0.25, %)",
"// Hollow a basic sketch.\nfirstSketch = startSketchOn('-XZ')\n |> startProfileAt([-12, 12], %)\n |> line(end = [24, 0])\n |> line(end = [0, -24])\n |> line(end = [-24, 0])\n |> close()\n |> extrude(length = 6)\n |> hollow(0.5, %)",
"// Hollow a sketch on face object.\nsize = 100\ncase = startSketchOn('-XZ')\n |> startProfileAt([-size, -size], %)\n |> line(end = [2 * size, 0])\n |> line(end = [0, 2 * size])\n |> tangentialArcTo([-size, size], %)\n |> close()\n |> extrude(length = 65)\n\nthing1 = startSketchOn(case, 'end')\n |> circle(center = [-size / 2, -size / 2], radius = 25)\n |> extrude(length = 50)\n\nthing2 = startSketchOn(case, 'end')\n |> circle(center = [size / 2, -size / 2], radius = 25)\n |> extrude(length = 50)\n\nhollow(0.5, case)"
"// Hollow a basic sketch.\nfirstSketch = startSketchOn(XY)\n |> startProfileAt([-12, 12], %)\n |> line(end = [24, 0])\n |> line(end = [0, -24])\n |> line(end = [-24, 0])\n |> close()\n |> extrude(length = 6)\n |> hollow(0.25, %)",
"// Hollow a basic sketch.\nfirstSketch = startSketchOn(-XZ)\n |> startProfileAt([-12, 12], %)\n |> line(end = [24, 0])\n |> line(end = [0, -24])\n |> line(end = [-24, 0])\n |> close()\n |> extrude(length = 6)\n |> hollow(0.5, %)",
"// Hollow a sketch on face object.\nsize = 100\ncase = startSketchOn(-XZ)\n |> startProfileAt([-size, -size], %)\n |> line(end = [2 * size, 0])\n |> line(end = [0, 2 * size])\n |> tangentialArcTo([-size, size], %)\n |> close()\n |> extrude(length = 65)\n\nthing1 = startSketchOn(case, 'end')\n |> circle(center = [-size / 2, -size / 2], radius = 25)\n |> extrude(length = 50)\n\nthing2 = startSketchOn(case, 'end')\n |> circle(center = [size / 2, -size / 2], radius = 25)\n |> extrude(length = 50)\n\nhollow(0.5, case)"
]
},
{
@ -113562,7 +113562,7 @@
"model = import(\"tests/inputs/cube.gltf\")",
"model = import(\"tests/inputs/cube.sldprt\")",
"model = import(\"tests/inputs/cube.step\")",
"import height, buildSketch from \"common.kcl\"\n\nplane = 'XZ'\nmargin = 2\ns1 = buildSketch(plane, [0, 0])\ns2 = buildSketch(plane, [0, height() + margin])"
"import height, buildSketch from \"common.kcl\"\n\nplane = XZ\nmargin = 2\ns1 = buildSketch(plane, [0, 0])\ns2 = buildSketch(plane, [0, height() + margin])"
]
},
{
@ -113632,7 +113632,7 @@
"unpublished": false,
"deprecated": true,
"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(length = 5)\n |> patternTransform(\n instances = n,\n transform = fn(id) {\n return { translate = [4 * id, 0, 0] }\n },\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(length = 5)\n |> patternTransform(\n instances = n,\n transform = fn(id) {\n return { translate = [4 * id, 0, 0] }\n },\n )"
]
},
{
@ -116843,7 +116843,7 @@
"unpublished": false,
"deprecated": true,
"examples": [
"fn cube(center) {\n return startSketchOn('XY')\n |> startProfileAt([center[0] - 10, center[1] - 10], %)\n |> line(endAbsolute = [center[0] + 10, center[1] - 10])\n |> line(endAbsolute = [center[0] + 10, center[1] + 10])\n |> line(endAbsolute = [center[0] - 10, center[1] + 10])\n |> close()\n |> extrude(length = 10)\n}\n\npart001 = cube([0, 0])\npart002 = cube([8, 8])\n\nintersectedPart = intersect([part001, part002])"
"fn cube(center) {\n return startSketchOn(XY)\n |> startProfileAt([center[0] - 10, center[1] - 10], %)\n |> line(endAbsolute = [center[0] + 10, center[1] - 10])\n |> line(endAbsolute = [center[0] + 10, center[1] + 10])\n |> line(endAbsolute = [center[0] - 10, center[1] + 10])\n |> close()\n |> extrude(length = 10)\n}\n\npart001 = cube([0, 0])\npart002 = cube([8, 8])\n\nintersectedPart = intersect([part001, part002])"
]
},
{
@ -118527,7 +118527,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> line(end = [5, 0])\n |> line(end = [20, 5])\n |> line(end = [lastSegX(%), 0])\n |> line(end = [-15, 0])\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
"exampleSketch = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> line(end = [5, 0])\n |> line(end = [20, 5])\n |> line(end = [lastSegX(%), 0])\n |> line(end = [-15, 0])\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
]
},
{
@ -120211,7 +120211,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> line(end = [5, 0])\n |> line(end = [20, 5])\n |> line(end = [0, lastSegY(%)])\n |> line(end = [-15, 0])\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
"exampleSketch = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> line(end = [5, 0])\n |> line(end = [20, 5])\n |> line(end = [0, lastSegY(%)])\n |> line(end = [-15, 0])\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
]
},
{
@ -128550,7 +128550,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> line(end = [ln(100), 15])\n |> line(end = [5, -6])\n |> line(end = [-10, -10])\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
"exampleSketch = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> line(end = [ln(100), 15])\n |> line(end = [5, -6])\n |> line(end = [-10, -10])\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
]
},
{
@ -141412,9 +141412,9 @@
"unpublished": false,
"deprecated": false,
"examples": [
"// Loft a square and a triangle.\nsquareSketch = startSketchOn('XY')\n |> startProfileAt([-100, 200], %)\n |> line(end = [200, 0])\n |> line(end = [0, -200])\n |> line(end = [-200, 0])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ntriangleSketch = startSketchOn(offsetPlane('XY', offset = 75))\n |> startProfileAt([0, 125], %)\n |> line(end = [-15, -30])\n |> line(end = [30, 0])\n |> line(endAbsolute = [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(end = [200, 0])\n |> line(end = [0, -200])\n |> line(end = [-200, 0])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ncircleSketch0 = startSketchOn(offsetPlane('XY', offset = 75))\n |> circle(center = [0, 100], radius = 50)\n\ncircleSketch1 = startSketchOn(offsetPlane('XY', offset = 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(end = [200, 0])\n |> line(end = [0, -200])\n |> line(end = [-200, 0])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ncircleSketch0 = startSketchOn(offsetPlane('XY', offset = 75))\n |> circle(center = [0, 100], radius = 50)\n\ncircleSketch1 = startSketchOn(offsetPlane('XY', offset = 150))\n |> circle(center = [0, 100], radius = 20)\n\nloft(\n [\n squareSketch,\n circleSketch0,\n circleSketch1\n ],\n baseCurveIndex = 0,\n bezApproximateRational = false,\n tolerance = 0.000001,\n vDegree = 2,\n)"
"// Loft a square and a triangle.\nsquareSketch = startSketchOn(XY)\n |> startProfileAt([-100, 200], %)\n |> line(end = [200, 0])\n |> line(end = [0, -200])\n |> line(end = [-200, 0])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ntriangleSketch = startSketchOn(offsetPlane(XY, offset = 75))\n |> startProfileAt([0, 125], %)\n |> line(end = [-15, -30])\n |> line(end = [30, 0])\n |> line(endAbsolute = [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(end = [200, 0])\n |> line(end = [0, -200])\n |> line(end = [-200, 0])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ncircleSketch0 = startSketchOn(offsetPlane(XY, offset = 75))\n |> circle(center = [0, 100], radius = 50)\n\ncircleSketch1 = startSketchOn(offsetPlane(XY, offset = 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(end = [200, 0])\n |> line(end = [0, -200])\n |> line(end = [-200, 0])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ncircleSketch0 = startSketchOn(offsetPlane(XY, offset = 75))\n |> circle(center = [0, 100], radius = 50)\n\ncircleSketch1 = startSketchOn(offsetPlane(XY, offset = 150))\n |> circle(center = [0, 100], radius = 20)\n\nloft(\n [\n squareSketch,\n circleSketch0,\n circleSketch1\n ],\n baseCurveIndex = 0,\n bezApproximateRational = false,\n tolerance = 0.000001,\n vDegree = 2,\n)"
]
},
{
@ -141469,7 +141469,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> line(end = [log(100, 5), 0])\n |> line(end = [5, 8])\n |> line(end = [-10, 0])\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
"exampleSketch = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> line(end = [log(100, 5), 0])\n |> line(end = [5, 8])\n |> line(end = [-10, 0])\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
]
},
{
@ -141511,7 +141511,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> line(end = [log10(100), 0])\n |> line(end = [5, 8])\n |> line(end = [-10, 0])\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
"exampleSketch = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> line(end = [log10(100), 0])\n |> line(end = [5, 8])\n |> line(end = [-10, 0])\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
]
},
{
@ -141553,7 +141553,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> line(end = [log2(100), 0])\n |> line(end = [5, 8])\n |> line(end = [-10, 0])\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
"exampleSketch = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> line(end = [log2(100), 0])\n |> line(end = [5, 8])\n |> line(end = [-10, 0])\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
]
},
{
@ -148936,8 +148936,8 @@
"unpublished": false,
"deprecated": false,
"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\n// Call `map`, using an anonymous function instead of a named one.\ncircles = map([1..3], fn(id) {\n return startSketchOn(\"XY\")\n |> circle(center = [id * 2 * r, 0], radius = r)\n})"
"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], fn(id) {\n return startSketchOn(XY)\n |> circle(center = [id * 2 * r, 0], radius = r)\n})"
]
},
{
@ -148982,7 +148982,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({\n angle = 70,\n length = max(15, 31, 4, 13, 22)\n }, %)\n |> line(end = [20, 0])\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
"exampleSketch = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> angledLine({\n angle = 70,\n length = max(15, 31, 4, 13, 22)\n }, %)\n |> line(end = [20, 0])\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
]
},
{
@ -149027,7 +149027,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({\n angle = 70,\n length = min(15, 31, 4, 13, 22)\n }, %)\n |> line(end = [20, 0])\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
"exampleSketch = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> angledLine({\n angle = 70,\n length = min(15, 31, 4, 13, 22)\n }, %)\n |> line(end = [20, 0])\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
]
},
{
@ -152496,10 +152496,10 @@
"unpublished": false,
"deprecated": false,
"examples": [
"// Mirror an un-closed sketch across the Y axis.\nsketch001 = startSketchOn('XZ')\n |> startProfileAt([0, 10], %)\n |> line(end = [15, 0])\n |> line(end = [-7, -3])\n |> line(end = [9, -1])\n |> line(end = [-8, -5])\n |> line(end = [9, -3])\n |> line(end = [-8, -3])\n |> line(end = [9, -1])\n |> line(end = [-19, -0])\n |> mirror2d({ axis = 'Y' }, %)\n\nexample = extrude(sketch001, length = 10)",
"// Mirror a un-closed sketch across the Y axis.\nsketch001 = startSketchOn('XZ')\n |> startProfileAt([0, 8.5], %)\n |> line(end = [20, -8.5])\n |> line(end = [-20, -8.5])\n |> mirror2d({ axis = 'Y' }, %)\n\nexample = extrude(sketch001, length = 10)",
"// Mirror a un-closed sketch across an edge.\nhelper001 = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line(end = [0, 10], tag = $edge001)\n\nsketch001 = startSketchOn('XZ')\n |> startProfileAt([0, 8.5], %)\n |> line(end = [20, -8.5])\n |> line(end = [-20, -8.5])\n |> mirror2d({ axis = edge001 }, %)\n\n// example = extrude(sketch001, length = 10)",
"// Mirror an un-closed sketch across a custom axis.\nsketch001 = startSketchOn('XZ')\n |> startProfileAt([0, 8.5], %)\n |> line(end = [20, -8.5])\n |> line(end = [-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(sketch001, length = 10)"
"// Mirror an un-closed sketch across the Y axis.\nsketch001 = startSketchOn(XZ)\n |> startProfileAt([0, 10], %)\n |> line(end = [15, 0])\n |> line(end = [-7, -3])\n |> line(end = [9, -1])\n |> line(end = [-8, -5])\n |> line(end = [9, -3])\n |> line(end = [-8, -3])\n |> line(end = [9, -1])\n |> line(end = [-19, -0])\n |> mirror2d({ axis = 'Y' }, %)\n\nexample = extrude(sketch001, length = 10)",
"// Mirror a un-closed sketch across the Y axis.\nsketch001 = startSketchOn(XZ)\n |> startProfileAt([0, 8.5], %)\n |> line(end = [20, -8.5])\n |> line(end = [-20, -8.5])\n |> mirror2d({ axis = 'Y' }, %)\n\nexample = extrude(sketch001, length = 10)",
"// Mirror a un-closed sketch across an edge.\nhelper001 = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> line(end = [0, 10], tag = $edge001)\n\nsketch001 = startSketchOn(XZ)\n |> startProfileAt([0, 8.5], %)\n |> line(end = [20, -8.5])\n |> line(end = [-20, -8.5])\n |> mirror2d({ axis = edge001 }, %)\n\n// example = extrude(sketch001, length = 10)",
"// Mirror an un-closed sketch across a custom axis.\nsketch001 = startSketchOn(XZ)\n |> startProfileAt([0, 8.5], %)\n |> line(end = [20, -8.5])\n |> line(end = [-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(sketch001, length = 10)"
]
},
{
@ -152932,11 +152932,11 @@
"unpublished": false,
"deprecated": false,
"examples": [
"// Loft a square and a circle on the `XY` plane using offset.\nsquareSketch = startSketchOn('XY')\n |> startProfileAt([-100, 200], %)\n |> line(end = [200, 0])\n |> line(end = [0, -200])\n |> line(end = [-200, 0])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ncircleSketch = startSketchOn(offsetPlane('XY', offset = 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(end = [200, 0])\n |> line(end = [0, -200])\n |> line(end = [-200, 0])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ncircleSketch = startSketchOn(offsetPlane('XZ', offset = 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(end = [200, 0])\n |> line(end = [0, -200])\n |> line(end = [-200, 0])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ncircleSketch = startSketchOn(offsetPlane('YZ', offset = 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(end = [200, 0])\n |> line(end = [0, -200])\n |> line(end = [-200, 0])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ncircleSketch = startSketchOn(offsetPlane('-XZ', offset = -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\", offset = 4))\n |> startProfileAt([0, 0], %)\n |> line(end = [10, 0])\n |> line(end = [0, 10])\n |> close()"
"// Loft a square and a circle on the `XY` plane using offset.\nsquareSketch = startSketchOn(XY)\n |> startProfileAt([-100, 200], %)\n |> line(end = [200, 0])\n |> line(end = [0, -200])\n |> line(end = [-200, 0])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ncircleSketch = startSketchOn(offsetPlane(XY, offset = 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(end = [200, 0])\n |> line(end = [0, -200])\n |> line(end = [-200, 0])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ncircleSketch = startSketchOn(offsetPlane(XZ, offset = 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(end = [200, 0])\n |> line(end = [0, -200])\n |> line(end = [-200, 0])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ncircleSketch = startSketchOn(offsetPlane(YZ, offset = 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(end = [200, 0])\n |> line(end = [0, -200])\n |> line(end = [-200, 0])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ncircleSketch = startSketchOn(offsetPlane(-XZ, offset = -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, offset = 4))\n |> startProfileAt([0, 0], %)\n |> line(end = [10, 0])\n |> line(end = [0, 10])\n |> close()"
]
},
{
@ -164136,7 +164136,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"exampleSketch = startSketchOn('XZ')\n |> startProfileAt([.5, 25], %)\n |> line(end = [0, 5])\n |> line(end = [-1, 0])\n |> line(end = [0, -5])\n |> close()\n |> patternCircular2d(\n center = [0, 0],\n instances = 13,\n arcDegrees = 360,\n rotateDuplicates = true,\n )\n\nexample = extrude(exampleSketch, length = 1)"
"exampleSketch = startSketchOn(XZ)\n |> startProfileAt([.5, 25], %)\n |> line(end = [0, 5])\n |> line(end = [-1, 0])\n |> line(end = [0, -5])\n |> close()\n |> patternCircular2d(\n center = [0, 0],\n instances = 13,\n arcDegrees = 360,\n rotateDuplicates = true,\n )\n\nexample = extrude(exampleSketch, length = 1)"
]
},
{
@ -176938,7 +176938,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"exampleSketch = startSketchOn('XZ')\n |> circle(center = [0, 0], radius = 1)\n\nexample = extrude(exampleSketch, length = -5)\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(exampleSketch, length = -5)\n |> patternCircular3d(\n axis = [1, -1, 0],\n center = [10, -20, 0],\n instances = 11,\n arcDegrees = 360,\n rotateDuplicates = true,\n )"
]
},
{
@ -186542,7 +186542,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"exampleSketch = startSketchOn('XZ')\n |> circle(center = [0, 0], radius = 1)\n |> patternLinear2d(axis = [1, 0], instances = 7, distance = 4)\n\nexample = extrude(exampleSketch, length = 1)"
"exampleSketch = startSketchOn(XZ)\n |> circle(center = [0, 0], radius = 1)\n |> patternLinear2d(axis = [1, 0], instances = 7, distance = 4)\n\nexample = extrude(exampleSketch, length = 1)"
]
},
{
@ -196146,9 +196146,9 @@
"unpublished": false,
"deprecated": false,
"examples": [
"exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line(end = [0, 2])\n |> line(end = [3, 1])\n |> line(end = [0, -4])\n |> close()\n\nexample = extrude(exampleSketch, length = 1)\n |> patternLinear3d(axis = [1, 0, 1], instances = 7, distance = 6)",
"// Pattern a whole sketch on face.\nsize = 100\ncase = startSketchOn('XY')\n |> startProfileAt([-size, -size], %)\n |> line(end = [2 * size, 0])\n |> line(end = [0, 2 * size])\n |> tangentialArcTo([-size, size], %)\n |> close(%)\n |> extrude(length = 65)\n\nthing1 = startSketchOn(case, 'end')\n |> circle(center = [-size / 2, -size / 2], radius = 25)\n |> extrude(length = 50)\n\nthing2 = startSketchOn(case, 'end')\n |> circle(center = [size / 2, -size / 2], radius = 25)\n |> extrude(length = 50)\n\n // We pass in the \"case\" here since we want to pattern the whole sketch.\n// And the case was the base of the sketch.\npatternLinear3d(\n case,\n axis = [1, 0, 0],\n distance = 250,\n instances = 2,\n)",
"// Pattern an object on a face.\nsize = 100\ncase = startSketchOn('XY')\n |> startProfileAt([-size, -size], %)\n |> line(end = [2 * size, 0])\n |> line(end = [0, 2 * size])\n |> tangentialArcTo([-size, size], %)\n |> close(%)\n |> extrude(length = 65)\n\nthing1 = startSketchOn(case, 'end')\n |> circle(center = [-size / 2, -size / 2], radius = 25)\n |> extrude(length = 50)\n\n// We pass in `thing1` here with `useOriginal` since we want to pattern just this object on the face.\npatternLinear3d(\n thing1,\n axis = [1, 0, 0],\n distance = size,\n instances = 2,\n useOriginal = true,\n)"
"exampleSketch = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> line(end = [0, 2])\n |> line(end = [3, 1])\n |> line(end = [0, -4])\n |> close()\n\nexample = extrude(exampleSketch, length = 1)\n |> patternLinear3d(axis = [1, 0, 1], instances = 7, distance = 6)",
"// Pattern a whole sketch on face.\nsize = 100\ncase = startSketchOn(XY)\n |> startProfileAt([-size, -size], %)\n |> line(end = [2 * size, 0])\n |> line(end = [0, 2 * size])\n |> tangentialArcTo([-size, size], %)\n |> close(%)\n |> extrude(length = 65)\n\nthing1 = startSketchOn(case, 'end')\n |> circle(center = [-size / 2, -size / 2], radius = 25)\n |> extrude(length = 50)\n\nthing2 = startSketchOn(case, 'end')\n |> circle(center = [size / 2, -size / 2], radius = 25)\n |> extrude(length = 50)\n\n // We pass in the \"case\" here since we want to pattern the whole sketch.\n// And the case was the base of the sketch.\npatternLinear3d(\n case,\n axis = [1, 0, 0],\n distance = 250,\n instances = 2,\n)",
"// Pattern an object on a face.\nsize = 100\ncase = startSketchOn(XY)\n |> startProfileAt([-size, -size], %)\n |> line(end = [2 * size, 0])\n |> line(end = [0, 2 * size])\n |> tangentialArcTo([-size, size], %)\n |> close(%)\n |> extrude(length = 65)\n\nthing1 = startSketchOn(case, 'end')\n |> circle(center = [-size / 2, -size / 2], radius = 25)\n |> extrude(length = 50)\n\n// We pass in `thing1` here with `useOriginal` since we want to pattern just this object on the face.\npatternLinear3d(\n thing1,\n axis = [1, 0, 0],\n distance = size,\n instances = 2,\n useOriginal = true,\n)"
]
},
{
@ -204149,12 +204149,12 @@
"unpublished": false,
"deprecated": false,
"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(length = 5)\n |> patternTransform(instances = 4, transform = 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(length = 5)\n |> patternTransform(instances = 4, transform = 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 startSketchOn('XY')\n |> startProfileAt(p0, %)\n |> line(endAbsolute = p1)\n |> line(endAbsolute = p2)\n |> line(endAbsolute = p3)\n |> line(endAbsolute = p0)\n |> close()\n |> extrude(length = 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(instances = 25, transform = 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 startSketchOn('XY')\n |> startProfileAt(p0, %)\n |> line(endAbsolute = p1)\n |> line(endAbsolute = p2)\n |> line(endAbsolute = p3)\n |> line(endAbsolute = p0)\n |> close()\n |> extrude(length = 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(instances = 4, transform = 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, tag = $tag1)\n |> extrude(length = 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(instances = 100, transform = 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}\nstartSketchOn('XY')\n |> startProfileAt([0, 0], %)\n |> polygon({\n radius = 10,\n numSides = 4,\n center = [0, 0],\n inscribed = false\n }, %)\n |> extrude(length = 4)\n |> patternTransform(instances = 3, transform = 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(length = 5)\n |> patternTransform(instances = 4, transform = 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(length = 5)\n |> patternTransform(instances = 4, transform = 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 startSketchOn(XY)\n |> startProfileAt(p0, %)\n |> line(endAbsolute = p1)\n |> line(endAbsolute = p2)\n |> line(endAbsolute = p3)\n |> line(endAbsolute = p0)\n |> close()\n |> extrude(length = 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(instances = 25, transform = 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 startSketchOn(XY)\n |> startProfileAt(p0, %)\n |> line(endAbsolute = p1)\n |> line(endAbsolute = p2)\n |> line(endAbsolute = p3)\n |> line(endAbsolute = p0)\n |> close()\n |> extrude(length = 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(instances = 4, transform = 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, tag = $tag1)\n |> extrude(length = 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(instances = 100, transform = 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}\nstartSketchOn(XY)\n |> startProfileAt([0, 0], %)\n |> polygon({\n radius = 10,\n numSides = 4,\n center = [0, 0],\n inscribed = false\n }, %)\n |> extrude(length = 4)\n |> patternTransform(instances = 3, transform = transform)"
]
},
{
@ -212155,7 +212155,7 @@
"unpublished": false,
"deprecated": false,
"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(instances = 4, transform = 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(instances = 4, transform = transform)"
]
},
{
@ -212183,7 +212183,7 @@
"unpublished": false,
"deprecated": true,
"examples": [
"circumference = 70\n\nexampleSketch = startSketchOn(\"XZ\")\n |> circle(center = [0, 0], radius = circumference / (2 * pi()))\n\nexample = extrude(exampleSketch, length = 5)"
"circumference = 70\n\nexampleSketch = startSketchOn(XZ)\n |> circle(center = [0, 0], radius = circumference / (2 * pi()))\n\nexample = extrude(exampleSketch, length = 5)"
]
},
{
@ -212617,7 +212617,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line(end = polar({ angle = 30, length = 5 }), tag = $thing)\n |> line(end = [0, 5])\n |> line(end = [segEndX(thing), 0])\n |> line(end = [-20, 10])\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
"exampleSketch = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> line(end = polar({ angle = 30, length = 5 }), tag = $thing)\n |> line(end = [0, 5])\n |> line(end = [segEndX(thing), 0])\n |> line(end = [-20, 10])\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
]
},
{
@ -217535,8 +217535,8 @@
"unpublished": false,
"deprecated": false,
"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(hex, length = 5)",
"// 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(square, length = 5)"
"// 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(hex, length = 5)",
"// 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(square, length = 5)"
]
},
{
@ -222882,7 +222882,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({ angle = 50, length = pow(5, 2) }, %)\n |> yLine(endAbsolute = 0)\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
"exampleSketch = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> angledLine({ angle = 50, length = pow(5, 2) }, %)\n |> yLine(endAbsolute = 0)\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
]
},
{
@ -246619,7 +246619,7 @@
"examples": [
"// This function adds two numbers.\nfn add(a, b) {\n return a + b\n}\n\n// This function adds an array of numbers.\n// It uses the `reduce` function, to call the `add` function on every\n// element of the `arr` parameter. The starting value is 0.\nfn sum(arr) {\n return reduce(arr, 0, add)\n}\n\n/* The above is basically like this pseudo-code:\nfn sum(arr):\n sumSoFar = 0\n for i in arr:\n sumSoFar = add(sumSoFar, i)\n return sumSoFar */\n\n// We use `assertEqual` to check that our `sum` function gives the\n// expected result. It's good to check your work!\nassertEqual(sum([1, 2, 3]), 6, 0.00001, \"1 + 2 + 3 summed is 6\")",
"// This example works just like the previous example above, but it uses\n// an anonymous `add` function as its parameter, instead of declaring a\n// named function outside.\narr = [1, 2, 3]\nsum = reduce(arr, 0, fn(i, result_so_far) {\n return i + result_so_far\n})\n\n// We use `assertEqual` to check that our `sum` function gives the\n// expected result. It's good to check your work!\nassertEqual(sum, 6, 0.00001, \"1 + 2 + 3 summed is 6\")",
"// Declare a function that sketches a decagon.\nfn decagon(radius) {\n // Each side of the decagon is turned this many degrees from the previous angle.\n stepAngle = 1 / 10 * TAU\n\n // Start the decagon sketch at this point.\n startOfDecagonSketch = startSketchOn('XY')\n |> startProfileAt([cos(0) * radius, sin(0) * radius], %)\n\n // Use a `reduce` to draw the remaining decagon sides.\n // For each number in the array 1..10, run the given function,\n // which takes a partially-sketched decagon and adds one more edge to it.\n fullDecagon = reduce([1..10], startOfDecagonSketch, fn(i, partialDecagon) {\n // Draw one edge of the decagon.\n x = cos(stepAngle * i) * radius\n y = sin(stepAngle * i) * radius\n return line(partialDecagon, end = [x, y])\n })\n\n return fullDecagon\n}\n\n/* The `decagon` above is basically like this pseudo-code:\nfn decagon(radius):\n stepAngle = (1/10) * TAU\n plane = startSketchOn('XY')\n startOfDecagonSketch = startProfileAt([(cos(0)*radius), (sin(0) * radius)], plane)\n\n // Here's the reduce part.\n partialDecagon = startOfDecagonSketch\n for i in [1..10]:\n x = cos(stepAngle * i) * radius\n y = sin(stepAngle * i) * radius\n partialDecagon = line(partialDecagon, end = [x, y])\n fullDecagon = partialDecagon // it's now full\n return fullDecagon */\n\n// Use the `decagon` function declared above, to sketch a decagon with radius 5.\ndecagon(5.0)\n |> close()"
"// Declare a function that sketches a decagon.\nfn decagon(radius) {\n // Each side of the decagon is turned this many degrees from the previous angle.\n stepAngle = 1 / 10 * TAU\n\n // Start the decagon sketch at this point.\n startOfDecagonSketch = startSketchOn(XY)\n |> startProfileAt([cos(0) * radius, sin(0) * radius], %)\n\n // Use a `reduce` to draw the remaining decagon sides.\n // For each number in the array 1..10, run the given function,\n // which takes a partially-sketched decagon and adds one more edge to it.\n fullDecagon = reduce([1..10], startOfDecagonSketch, fn(i, partialDecagon) {\n // Draw one edge of the decagon.\n x = cos(stepAngle * i) * radius\n y = sin(stepAngle * i) * radius\n return line(partialDecagon, end = [x, y])\n })\n\n return fullDecagon\n}\n\n/* The `decagon` above is basically like this pseudo-code:\nfn decagon(radius):\n stepAngle = (1/10) * TAU\n plane = startSketchOn('XY')\n startOfDecagonSketch = startProfileAt([(cos(0)*radius), (sin(0) * radius)], plane)\n\n // Here's the reduce part.\n partialDecagon = startOfDecagonSketch\n for i in [1..10]:\n x = cos(stepAngle * i) * radius\n y = sin(stepAngle * i) * radius\n partialDecagon = line(partialDecagon, end = [x, y])\n fullDecagon = partialDecagon // it's now full\n return fullDecagon */\n\n// Use the `decagon` function declared above, to sketch a decagon with radius 5.\ndecagon(5.0)\n |> close()"
]
},
{
@ -258340,17 +258340,17 @@
"unpublished": false,
"deprecated": false,
"examples": [
"part001 = startSketchOn('XY')\n |> startProfileAt([4, 12], %)\n |> line(end = [2, 0])\n |> line(end = [0, -6])\n |> line(end = [4, -6])\n |> line(end = [0, -6])\n |> line(end = [-3.75, -4.5])\n |> line(end = [0, -5.5])\n |> line(end = [-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')",
"part001 = startSketchOn('XY')\n |> startProfileAt([4, 12], %)\n |> line(end = [2, 0])\n |> line(end = [0, -6])\n |> line(end = [4, -6])\n |> line(end = [0, -6])\n |> line(end = [-3.75, -4.5])\n |> line(end = [0, -5.5])\n |> line(end = [-2, 0])\n |> close()\n |> revolve(axis = 'y', angle = 180)",
"part001 = startSketchOn('XY')\n |> startProfileAt([4, 12], %)\n |> line(end = [2, 0])\n |> line(end = [0, -6])\n |> line(end = [4, -6])\n |> line(end = [0, -6])\n |> line(end = [-3.75, -4.5])\n |> line(end = [0, -5.5])\n |> line(end = [-2, 0])\n |> close()\n |> revolve(axis = 'y', angle = 180)\n\npart002 = startSketchOn(part001, 'end')\n |> startProfileAt([4.5, -5], %)\n |> line(end = [0, 5])\n |> line(end = [5, 0])\n |> line(end = [0, -5])\n |> close()\n |> extrude(length = 5)",
"box = startSketchOn('XY')\n |> startProfileAt([0, 0], %)\n |> line(end = [0, 20])\n |> line(end = [20, 0])\n |> line(end = [0, -20])\n |> close()\n |> extrude(length = 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(end = [0, 20])\n |> line(end = [20, 0])\n |> line(end = [0, -20], tag = $revolveAxis)\n |> close()\n |> extrude(length = 20)\n\nsketch001 = startSketchOn(box, \"END\")\n |> circle(center = [10, 10], radius = 4)\n |> revolve(angle = 90, axis = getOppositeEdge(revolveAxis))",
"box = startSketchOn('XY')\n |> startProfileAt([0, 0], %)\n |> line(end = [0, 20])\n |> line(end = [20, 0])\n |> line(end = [0, -20], tag = $revolveAxis)\n |> close()\n |> extrude(length = 20)\n\nsketch001 = startSketchOn(box, \"END\")\n |> circle(center = [10, 10], radius = 4)\n |> revolve(angle = 90, axis = getOppositeEdge(revolveAxis), tolerance = 0.0001)",
"sketch001 = startSketchOn('XY')\n |> startProfileAt([10, 0], %)\n |> line(end = [5, -5])\n |> line(end = [5, 5])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\npart001 = revolve(\n sketch001,\n axis = {\n custom = {\n axis = [0.0, 1.0],\n origin = [0.0, 0.0]\n }\n },\n)",
"// Revolve two sketches around the same axis.\n\n\nsketch001 = startSketchOn('XY')\nprofile001 = startProfileAt([4, 8], sketch001)\n |> xLine(length = 3)\n |> yLine(length = -3)\n |> xLine(length = -3)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\nprofile002 = startProfileAt([-5, 8], sketch001)\n |> xLine(length = 3)\n |> yLine(length = -3)\n |> xLine(length = -3)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\nrevolve([profile001, profile002], axis = \"X\")",
"// Revolve around a path that has not been extruded.\n\n\nprofile001 = startSketchOn('XY')\n |> startProfileAt([0, 0], %)\n |> line(end = [0, 20], tag = $revolveAxis)\n |> line(end = [20, 0])\n |> line(end = [0, -20])\n |> close(%)\n\nsketch001 = startSketchOn('XY')\n |> circle(center = [-10, 10], radius = 4)\n |> revolve(angle = 90, axis = revolveAxis)",
"// Revolve around a path that has not been extruded or closed.\n\n\nprofile001 = startSketchOn('XY')\n |> startProfileAt([0, 0], %)\n |> line(end = [0, 20], tag = $revolveAxis)\n |> line(end = [20, 0])\n\nsketch001 = startSketchOn('XY')\n |> circle(center = [-10, 10], radius = 4)\n |> revolve(angle = 90, axis = revolveAxis)"
"part001 = startSketchOn(XY)\n |> startProfileAt([4, 12], %)\n |> line(end = [2, 0])\n |> line(end = [0, -6])\n |> line(end = [4, -6])\n |> line(end = [0, -6])\n |> line(end = [-3.75, -4.5])\n |> line(end = [0, -5.5])\n |> line(end = [-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')",
"part001 = startSketchOn(XY)\n |> startProfileAt([4, 12], %)\n |> line(end = [2, 0])\n |> line(end = [0, -6])\n |> line(end = [4, -6])\n |> line(end = [0, -6])\n |> line(end = [-3.75, -4.5])\n |> line(end = [0, -5.5])\n |> line(end = [-2, 0])\n |> close()\n |> revolve(axis = 'y', angle = 180)",
"part001 = startSketchOn(XY)\n |> startProfileAt([4, 12], %)\n |> line(end = [2, 0])\n |> line(end = [0, -6])\n |> line(end = [4, -6])\n |> line(end = [0, -6])\n |> line(end = [-3.75, -4.5])\n |> line(end = [0, -5.5])\n |> line(end = [-2, 0])\n |> close()\n |> revolve(axis = 'y', angle = 180)\n\npart002 = startSketchOn(part001, 'end')\n |> startProfileAt([4.5, -5], %)\n |> line(end = [0, 5])\n |> line(end = [5, 0])\n |> line(end = [0, -5])\n |> close()\n |> extrude(length = 5)",
"box = startSketchOn(XY)\n |> startProfileAt([0, 0], %)\n |> line(end = [0, 20])\n |> line(end = [20, 0])\n |> line(end = [0, -20])\n |> close()\n |> extrude(length = 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(end = [0, 20])\n |> line(end = [20, 0])\n |> line(end = [0, -20], tag = $revolveAxis)\n |> close()\n |> extrude(length = 20)\n\nsketch001 = startSketchOn(box, \"END\")\n |> circle(center = [10, 10], radius = 4)\n |> revolve(angle = 90, axis = getOppositeEdge(revolveAxis))",
"box = startSketchOn(XY)\n |> startProfileAt([0, 0], %)\n |> line(end = [0, 20])\n |> line(end = [20, 0])\n |> line(end = [0, -20], tag = $revolveAxis)\n |> close()\n |> extrude(length = 20)\n\nsketch001 = startSketchOn(box, \"END\")\n |> circle(center = [10, 10], radius = 4)\n |> revolve(angle = 90, axis = getOppositeEdge(revolveAxis), tolerance = 0.0001)",
"sketch001 = startSketchOn(XY)\n |> startProfileAt([10, 0], %)\n |> line(end = [5, -5])\n |> line(end = [5, 5])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\npart001 = revolve(\n sketch001,\n axis = {\n custom = {\n axis = [0.0, 1.0],\n origin = [0.0, 0.0]\n }\n },\n)",
"// Revolve two sketches around the same axis.\n\n\nsketch001 = startSketchOn(XY)\nprofile001 = startProfileAt([4, 8], sketch001)\n |> xLine(length = 3)\n |> yLine(length = -3)\n |> xLine(length = -3)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\nprofile002 = startProfileAt([-5, 8], sketch001)\n |> xLine(length = 3)\n |> yLine(length = -3)\n |> xLine(length = -3)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\nrevolve([profile001, profile002], axis = \"X\")",
"// Revolve around a path that has not been extruded.\n\n\nprofile001 = startSketchOn(XY)\n |> startProfileAt([0, 0], %)\n |> line(end = [0, 20], tag = $revolveAxis)\n |> line(end = [20, 0])\n |> line(end = [0, -20])\n |> close(%)\n\nsketch001 = startSketchOn(XY)\n |> circle(center = [-10, 10], radius = 4)\n |> revolve(angle = 90, axis = revolveAxis)",
"// Revolve around a path that has not been extruded or closed.\n\n\nprofile001 = startSketchOn(XY)\n |> startProfileAt([0, 0], %)\n |> line(end = [0, 20], tag = $revolveAxis)\n |> line(end = [20, 0])\n\nsketch001 = startSketchOn(XY)\n |> circle(center = [-10, 10], radius = 4)\n |> revolve(angle = 90, axis = revolveAxis)"
]
},
{
@ -271286,11 +271286,11 @@
"unpublished": false,
"deprecated": false,
"examples": [
"// Rotate a pipe with roll, pitch, and yaw.\n\n// Create a path for the sweep.\nsweepPath = startSketchOn('XZ')\n |> startProfileAt([0.05, 0.05], %)\n |> line(end = [0, 7])\n |> tangentialArc({ offset = 90, radius = 5 }, %)\n |> line(end = [-3, 0])\n |> tangentialArc({ offset = -90, radius = 5 }, %)\n |> line(end = [0, 7])\n\n// Create a hole for the pipe.\npipeHole = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 1.5)\n\nsweepSketch = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 2)\n |> hole(pipeHole, %)\n |> sweep(path = sweepPath)\n |> rotate(roll = 10, pitch = 10, yaw = 90)",
"// Rotate a pipe about an axis with an angle.\n\n// Create a path for the sweep.\nsweepPath = startSketchOn('XZ')\n |> startProfileAt([0.05, 0.05], %)\n |> line(end = [0, 7])\n |> tangentialArc({ offset = 90, radius = 5 }, %)\n |> line(end = [-3, 0])\n |> tangentialArc({ offset = -90, radius = 5 }, %)\n |> line(end = [0, 7])\n\n// Create a hole for the pipe.\npipeHole = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 1.5)\n\nsweepSketch = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 2)\n |> hole(pipeHole, %)\n |> sweep(path = sweepPath)\n |> rotate(axis = [0, 0, 1.0], angle = 90)",
"// Rotate a pipe with roll, pitch, and yaw.\n\n// Create a path for the sweep.\nsweepPath = startSketchOn(XZ)\n |> startProfileAt([0.05, 0.05], %)\n |> line(end = [0, 7])\n |> tangentialArc({ offset = 90, radius = 5 }, %)\n |> line(end = [-3, 0])\n |> tangentialArc({ offset = -90, radius = 5 }, %)\n |> line(end = [0, 7])\n\n// Create a hole for the pipe.\npipeHole = startSketchOn(XY)\n |> circle(center = [0, 0], radius = 1.5)\n\nsweepSketch = startSketchOn(XY)\n |> circle(center = [0, 0], radius = 2)\n |> hole(pipeHole, %)\n |> sweep(path = sweepPath)\n |> rotate(roll = 10, pitch = 10, yaw = 90)",
"// Rotate a pipe about an axis with an angle.\n\n// Create a path for the sweep.\nsweepPath = startSketchOn(XZ)\n |> startProfileAt([0.05, 0.05], %)\n |> line(end = [0, 7])\n |> tangentialArc({ offset = 90, radius = 5 }, %)\n |> line(end = [-3, 0])\n |> tangentialArc({ offset = -90, radius = 5 }, %)\n |> line(end = [0, 7])\n\n// Create a hole for the pipe.\npipeHole = startSketchOn(XY)\n |> circle(center = [0, 0], radius = 1.5)\n\nsweepSketch = startSketchOn(XY)\n |> circle(center = [0, 0], radius = 2)\n |> hole(pipeHole, %)\n |> sweep(path = sweepPath)\n |> rotate(axis = [0, 0, 1.0], angle = 90)",
"// Rotate an imported model.\n\n\nimport \"tests/inputs/cube.sldprt\" as cube\n\ncube\n |> rotate(axis = [0, 0, 1.0], angle = 90)",
"// Sweep two sketches along the same path.\n\n\nsketch001 = startSketchOn('XY')\nrectangleSketch = startProfileAt([-200, 23.86], sketch001)\n |> angledLine([0, 73.47], %, $rectangleSegmentA001)\n |> angledLine([\n segAng(rectangleSegmentA001) - 90,\n 50.61\n ], %)\n |> angledLine([\n segAng(rectangleSegmentA001),\n -segLen(rectangleSegmentA001)\n ], %)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ncircleSketch = circle(sketch001, center = [200, -30.29], radius = 32.63)\n\nsketch002 = startSketchOn('YZ')\nsweepPath = startProfileAt([0, 0], sketch002)\n |> yLine(length = 231.81)\n |> tangentialArc({ radius = 80, offset = -90 }, %)\n |> xLine(length = 384.93)\n\nparts = sweep([rectangleSketch, circleSketch], path = sweepPath)\n\n// Rotate the sweeps.\nrotate(parts, axis = [0, 0, 1.0], angle = 90)",
"// Translate and rotate a sketch to create a loft.\nsketch001 = startSketchOn('XY')\n\nfn square() {\n return startProfileAt([-10, 10], sketch001)\n |> xLine(length = 20)\n |> yLine(length = -20)\n |> xLine(length = -20)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n}\n\nprofile001 = square()\n\nprofile002 = square()\n |> translate(translate = [0, 0, 20])\n |> rotate(axis = [0, 0, 1.0], angle = 45)\n\nloft([profile001, profile002])"
"// Sweep two sketches along the same path.\n\n\nsketch001 = startSketchOn(XY)\nrectangleSketch = startProfileAt([-200, 23.86], sketch001)\n |> angledLine([0, 73.47], %, $rectangleSegmentA001)\n |> angledLine([\n segAng(rectangleSegmentA001) - 90,\n 50.61\n ], %)\n |> angledLine([\n segAng(rectangleSegmentA001),\n -segLen(rectangleSegmentA001)\n ], %)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ncircleSketch = circle(sketch001, center = [200, -30.29], radius = 32.63)\n\nsketch002 = startSketchOn(YZ)\nsweepPath = startProfileAt([0, 0], sketch002)\n |> yLine(length = 231.81)\n |> tangentialArc({ radius = 80, offset = -90 }, %)\n |> xLine(length = 384.93)\n\nparts = sweep([rectangleSketch, circleSketch], path = sweepPath)\n\n// Rotate the sweeps.\nrotate(parts, axis = [0, 0, 1.0], angle = 90)",
"// Translate and rotate a sketch to create a loft.\nsketch001 = startSketchOn(XY)\n\nfn square() {\n return startProfileAt([-10, 10], sketch001)\n |> xLine(length = 20)\n |> yLine(length = -20)\n |> xLine(length = -20)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n}\n\nprofile001 = square()\n\nprofile002 = square()\n |> translate(translate = [0, 0, 20])\n |> rotate(axis = [0, 0, 1.0], angle = 45)\n\nloft([profile001, profile002])"
]
},
{
@ -271332,7 +271332,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"sketch001 = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line(endAbsolute = [12, 10])\n |> line(end = [round(7.02986), 0])\n |> yLine(endAbsolute = 0)\n |> close()\n\nextrude001 = extrude(sketch001, length = 5)"
"sketch001 = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> line(endAbsolute = [12, 10])\n |> line(end = [round(7.02986), 0])\n |> yLine(endAbsolute = 0)\n |> close()\n\nextrude001 = extrude(sketch001, length = 5)"
]
},
{
@ -277877,9 +277877,9 @@
"unpublished": false,
"deprecated": false,
"examples": [
"// Scale a pipe.\n\n// Create a path for the sweep.\nsweepPath = startSketchOn('XZ')\n |> startProfileAt([0.05, 0.05], %)\n |> line(end = [0, 7])\n |> tangentialArc({ offset = 90, radius = 5 }, %)\n |> line(end = [-3, 0])\n |> tangentialArc({ offset = -90, radius = 5 }, %)\n |> line(end = [0, 7])\n\n// Create a hole for the pipe.\npipeHole = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 1.5)\n\nsweepSketch = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 2)\n |> hole(pipeHole, %)\n |> sweep(path = sweepPath)\n |> scale(scale = [1.0, 1.0, 2.5])",
"// Scale a pipe.\n\n// Create a path for the sweep.\nsweepPath = startSketchOn(XZ)\n |> startProfileAt([0.05, 0.05], %)\n |> line(end = [0, 7])\n |> tangentialArc({ offset = 90, radius = 5 }, %)\n |> line(end = [-3, 0])\n |> tangentialArc({ offset = -90, radius = 5 }, %)\n |> line(end = [0, 7])\n\n// Create a hole for the pipe.\npipeHole = startSketchOn(XY)\n |> circle(center = [0, 0], radius = 1.5)\n\nsweepSketch = startSketchOn(XY)\n |> circle(center = [0, 0], radius = 2)\n |> hole(pipeHole, %)\n |> sweep(path = sweepPath)\n |> scale(scale = [1.0, 1.0, 2.5])",
"// Scale an imported model.\n\n\nimport \"tests/inputs/cube.sldprt\" as cube\n\ncube\n |> scale(scale = [1.0, 1.0, 2.5])",
"// Sweep two sketches along the same path.\n\n\nsketch001 = startSketchOn('XY')\nrectangleSketch = startProfileAt([-200, 23.86], sketch001)\n |> angledLine([0, 73.47], %, $rectangleSegmentA001)\n |> angledLine([\n segAng(rectangleSegmentA001) - 90,\n 50.61\n ], %)\n |> angledLine([\n segAng(rectangleSegmentA001),\n -segLen(rectangleSegmentA001)\n ], %)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ncircleSketch = circle(sketch001, center = [200, -30.29], radius = 32.63)\n\nsketch002 = startSketchOn('YZ')\nsweepPath = startProfileAt([0, 0], sketch002)\n |> yLine(length = 231.81)\n |> tangentialArc({ radius = 80, offset = -90 }, %)\n |> xLine(length = 384.93)\n\nparts = sweep([rectangleSketch, circleSketch], path = sweepPath)\n\n// Scale the sweep.\nscale(parts, scale = [1.0, 1.0, 0.5])"
"// Sweep two sketches along the same path.\n\n\nsketch001 = startSketchOn(XY)\nrectangleSketch = startProfileAt([-200, 23.86], sketch001)\n |> angledLine([0, 73.47], %, $rectangleSegmentA001)\n |> angledLine([\n segAng(rectangleSegmentA001) - 90,\n 50.61\n ], %)\n |> angledLine([\n segAng(rectangleSegmentA001),\n -segLen(rectangleSegmentA001)\n ], %)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ncircleSketch = circle(sketch001, center = [200, -30.29], radius = 32.63)\n\nsketch002 = startSketchOn(YZ)\nsweepPath = startProfileAt([0, 0], sketch002)\n |> yLine(length = 231.81)\n |> tangentialArc({ radius = 80, offset = -90 }, %)\n |> xLine(length = 384.93)\n\nparts = sweep([rectangleSketch, circleSketch], path = sweepPath)\n\n// Scale the sweep.\nscale(parts, scale = [1.0, 1.0, 0.5])"
]
},
{
@ -277927,7 +277927,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line(end = [10, 0])\n |> line(end = [5, 10], tag = $seg01)\n |> line(end = [-10, 0])\n |> angledLine([segAng(seg01), 10], %)\n |> line(end = [-10, 0])\n |> angledLine([segAng(seg01), -15], %)\n |> close()\n\nexample = extrude(exampleSketch, length = 4)"
"exampleSketch = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> line(end = [10, 0])\n |> line(end = [5, 10], tag = $seg01)\n |> line(end = [-10, 0])\n |> angledLine([segAng(seg01), 10], %)\n |> line(end = [-10, 0])\n |> angledLine([segAng(seg01), -15], %)\n |> close()\n\nexample = extrude(exampleSketch, length = 4)"
]
},
{
@ -277980,7 +277980,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"w = 15\ncube = startSketchOn('XY')\n |> startProfileAt([0, 0], %)\n |> line(end = [w, 0], tag = $line1)\n |> line(end = [0, w], tag = $line2)\n |> line(end = [-w, 0], tag = $line3)\n |> line(end = [0, -w], tag = $line4)\n |> close()\n |> extrude(length = 5)\n\nfn cylinder(radius, tag) {\n return startSketchOn('XY')\n |> startProfileAt([0, 0], %)\n |> circle(radius = radius, center = segEnd(tag))\n |> extrude(length = radius)\n}\n\ncylinder(1, line1)\ncylinder(2, line2)\ncylinder(3, line3)\ncylinder(4, line4)"
"w = 15\ncube = startSketchOn(XY)\n |> startProfileAt([0, 0], %)\n |> line(end = [w, 0], tag = $line1)\n |> line(end = [0, w], tag = $line2)\n |> line(end = [-w, 0], tag = $line3)\n |> line(end = [0, -w], tag = $line4)\n |> close()\n |> extrude(length = 5)\n\nfn cylinder(radius, tag) {\n return startSketchOn(XY)\n |> startProfileAt([0, 0], %)\n |> circle(radius = radius, center = segEnd(tag))\n |> extrude(length = radius)\n}\n\ncylinder(1, line1)\ncylinder(2, line2)\ncylinder(3, line3)\ncylinder(4, line4)"
]
},
{
@ -278028,7 +278028,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line(end = [20, 0], tag = $thing)\n |> line(end = [0, 5])\n |> line(end = [segEndX(thing), 0])\n |> line(end = [-20, 10])\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
"exampleSketch = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> line(end = [20, 0], tag = $thing)\n |> line(end = [0, 5])\n |> line(end = [segEndX(thing), 0])\n |> line(end = [-20, 10])\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
]
},
{
@ -278076,7 +278076,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line(end = [20, 0])\n |> line(end = [0, 3], tag = $thing)\n |> line(end = [-10, 0])\n |> line(end = [0, segEndY(thing)])\n |> line(end = [-10, 0])\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
"exampleSketch = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> line(end = [20, 0])\n |> line(end = [0, 3], tag = $thing)\n |> line(end = [-10, 0])\n |> line(end = [0, segEndY(thing)])\n |> line(end = [-10, 0])\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
]
},
{
@ -278124,7 +278124,7 @@
"unpublished": false,
"deprecated": false,
"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(exampleSketch, length = 5)"
"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(exampleSketch, length = 5)"
]
},
{
@ -278177,7 +278177,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"w = 15\ncube = startSketchOn('XY')\n |> startProfileAt([0, 0], %)\n |> line(end = [w, 0], tag = $line1)\n |> line(end = [0, w], tag = $line2)\n |> line(end = [-w, 0], tag = $line3)\n |> line(end = [0, -w], tag = $line4)\n |> close()\n |> extrude(length = 5)\n\nfn cylinder(radius, tag) {\n return startSketchOn('XY')\n |> startProfileAt([0, 0], %)\n |> circle(radius = radius, center = segStart(tag))\n |> extrude(length = radius)\n}\n\ncylinder(1, line1)\ncylinder(2, line2)\ncylinder(3, line3)\ncylinder(4, line4)"
"w = 15\ncube = startSketchOn(XY)\n |> startProfileAt([0, 0], %)\n |> line(end = [w, 0], tag = $line1)\n |> line(end = [0, w], tag = $line2)\n |> line(end = [-w, 0], tag = $line3)\n |> line(end = [0, -w], tag = $line4)\n |> close()\n |> extrude(length = 5)\n\nfn cylinder(radius, tag) {\n return startSketchOn(XY)\n |> startProfileAt([0, 0], %)\n |> circle(radius = radius, center = segStart(tag))\n |> extrude(length = radius)\n}\n\ncylinder(1, line1)\ncylinder(2, line2)\ncylinder(3, line3)\ncylinder(4, line4)"
]
},
{
@ -278225,7 +278225,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line(end = [20, 0], tag = $thing)\n |> line(end = [0, 5])\n |> line(end = [20 - segStartX(thing), 0])\n |> line(end = [-20, 10])\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
"exampleSketch = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> line(end = [20, 0], tag = $thing)\n |> line(end = [0, 5])\n |> line(end = [20 - segStartX(thing), 0])\n |> line(end = [-20, 10])\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
]
},
{
@ -278273,7 +278273,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line(end = [20, 0])\n |> line(end = [0, 3], tag = $thing)\n |> line(end = [-10, 0])\n |> line(end = [0, 20 - segStartY(thing)])\n |> line(end = [-10, 0])\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
"exampleSketch = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> line(end = [20, 0])\n |> line(end = [0, 3], tag = $thing)\n |> line(end = [-10, 0])\n |> line(end = [0, 20 - segStartY(thing)])\n |> line(end = [-10, 0])\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
]
},
{
@ -284714,13 +284714,13 @@
"unpublished": false,
"deprecated": false,
"examples": [
"// Remove the end face for the extrusion.\nfirstSketch = startSketchOn('XY')\n |> startProfileAt([-12, 12], %)\n |> line(end = [24, 0])\n |> line(end = [0, -24])\n |> line(end = [-24, 0])\n |> close()\n |> extrude(length = 6)\n\n// Remove the end face for the extrusion.\nshell(firstSketch, faces = ['end'], thickness = 0.25)",
"// Remove the start face for the extrusion.\nfirstSketch = startSketchOn('-XZ')\n |> startProfileAt([-12, 12], %)\n |> line(end = [24, 0])\n |> line(end = [0, -24])\n |> line(end = [-24, 0])\n |> close()\n |> extrude(length = 6)\n\n// Remove the start face for the extrusion.\nshell(firstSketch, faces = ['start'], thickness = 0.25)",
"// Remove a tagged face and the end face for the extrusion.\nfirstSketch = startSketchOn('XY')\n |> startProfileAt([-12, 12], %)\n |> line(end = [24, 0])\n |> line(end = [0, -24])\n |> line(end = [-24, 0], tag = $myTag)\n |> close()\n |> extrude(length = 6)\n\n// Remove a tagged face for the extrusion.\nshell(firstSketch, faces = [myTag], thickness = 0.25)",
"// Remove multiple faces at once.\nfirstSketch = startSketchOn('XY')\n |> startProfileAt([-12, 12], %)\n |> line(end = [24, 0])\n |> line(end = [0, -24])\n |> line(end = [-24, 0], tag = $myTag)\n |> close()\n |> extrude(length = 6)\n\n// Remove a tagged face and the end face for the extrusion.\nshell(firstSketch, faces = [myTag, 'end'], thickness = 0.25)",
"// Shell a sketch on face.\nsize = 100\ncase = startSketchOn('-XZ')\n |> startProfileAt([-size, -size], %)\n |> line(end = [2 * size, 0])\n |> line(end = [0, 2 * size])\n |> tangentialArcTo([-size, size], %)\n |> close()\n |> extrude(length = 65)\n\nthing1 = startSketchOn(case, 'end')\n |> circle(center = [-size / 2, -size / 2], radius = 25)\n |> extrude(length = 50)\n\nthing2 = startSketchOn(case, 'end')\n |> circle(center = [size / 2, -size / 2], radius = 25)\n |> extrude(length = 50)\n\n// We put \"case\" in the shell function to shell the entire object.\nshell(case, faces = ['start'], thickness = 5)",
"// Shell a sketch on face object on the end face.\nsize = 100\ncase = startSketchOn('XY')\n |> startProfileAt([-size, -size], %)\n |> line(end = [2 * size, 0])\n |> line(end = [0, 2 * size])\n |> tangentialArcTo([-size, size], %)\n |> close()\n |> extrude(length = 65)\n\nthing1 = startSketchOn(case, 'end')\n |> circle(center = [-size / 2, -size / 2], radius = 25)\n |> extrude(length = 50)\n\nthing2 = startSketchOn(case, 'end')\n |> circle(center = [size / 2, -size / 2], radius = 25)\n |> extrude(length = 50)\n\n// We put \"thing1\" in the shell function to shell the end face of the object.\nshell(thing1, faces = ['end'], thickness = 5)",
"// 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(end = [2 * size, 0])\n |> line(end = [0, 2 * size])\n |> tangentialArcTo([-size, size], %)\n |> close()\n |> extrude(length = 65)\n\nthing1 = startSketchOn(case, 'end')\n |> circle(center = [-size / 2, -size / 2], radius = 25)\n |> extrude(length = 50)\n\nthing2 = startSketchOn(case, 'end')\n |> circle(center = [size / 2, -size / 2], radius = 25)\n |> extrude(length = 50)\n\n// We put \"thing1\" and \"thing2\" in the shell function to shell the end face of the object.\nshell([thing1, thing2], faces = ['end'], thickness = 5)"
"// Remove the end face for the extrusion.\nfirstSketch = startSketchOn(XY)\n |> startProfileAt([-12, 12], %)\n |> line(end = [24, 0])\n |> line(end = [0, -24])\n |> line(end = [-24, 0])\n |> close()\n |> extrude(length = 6)\n\n// Remove the end face for the extrusion.\nshell(firstSketch, faces = ['end'], thickness = 0.25)",
"// Remove the start face for the extrusion.\nfirstSketch = startSketchOn(-XZ)\n |> startProfileAt([-12, 12], %)\n |> line(end = [24, 0])\n |> line(end = [0, -24])\n |> line(end = [-24, 0])\n |> close()\n |> extrude(length = 6)\n\n// Remove the start face for the extrusion.\nshell(firstSketch, faces = ['start'], thickness = 0.25)",
"// Remove a tagged face and the end face for the extrusion.\nfirstSketch = startSketchOn(XY)\n |> startProfileAt([-12, 12], %)\n |> line(end = [24, 0])\n |> line(end = [0, -24])\n |> line(end = [-24, 0], tag = $myTag)\n |> close()\n |> extrude(length = 6)\n\n// Remove a tagged face for the extrusion.\nshell(firstSketch, faces = [myTag], thickness = 0.25)",
"// Remove multiple faces at once.\nfirstSketch = startSketchOn(XY)\n |> startProfileAt([-12, 12], %)\n |> line(end = [24, 0])\n |> line(end = [0, -24])\n |> line(end = [-24, 0], tag = $myTag)\n |> close()\n |> extrude(length = 6)\n\n// Remove a tagged face and the end face for the extrusion.\nshell(firstSketch, faces = [myTag, 'end'], thickness = 0.25)",
"// Shell a sketch on face.\nsize = 100\ncase = startSketchOn(-XZ)\n |> startProfileAt([-size, -size], %)\n |> line(end = [2 * size, 0])\n |> line(end = [0, 2 * size])\n |> tangentialArcTo([-size, size], %)\n |> close()\n |> extrude(length = 65)\n\nthing1 = startSketchOn(case, 'end')\n |> circle(center = [-size / 2, -size / 2], radius = 25)\n |> extrude(length = 50)\n\nthing2 = startSketchOn(case, 'end')\n |> circle(center = [size / 2, -size / 2], radius = 25)\n |> extrude(length = 50)\n\n// We put \"case\" in the shell function to shell the entire object.\nshell(case, faces = ['start'], thickness = 5)",
"// Shell a sketch on face object on the end face.\nsize = 100\ncase = startSketchOn(XY)\n |> startProfileAt([-size, -size], %)\n |> line(end = [2 * size, 0])\n |> line(end = [0, 2 * size])\n |> tangentialArcTo([-size, size], %)\n |> close()\n |> extrude(length = 65)\n\nthing1 = startSketchOn(case, 'end')\n |> circle(center = [-size / 2, -size / 2], radius = 25)\n |> extrude(length = 50)\n\nthing2 = startSketchOn(case, 'end')\n |> circle(center = [size / 2, -size / 2], radius = 25)\n |> extrude(length = 50)\n\n// We put \"thing1\" in the shell function to shell the end face of the object.\nshell(thing1, faces = ['end'], thickness = 5)",
"// 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(end = [2 * size, 0])\n |> line(end = [0, 2 * size])\n |> tangentialArcTo([-size, size], %)\n |> close()\n |> extrude(length = 65)\n\nthing1 = startSketchOn(case, 'end')\n |> circle(center = [-size / 2, -size / 2], radius = 25)\n |> extrude(length = 50)\n\nthing2 = startSketchOn(case, 'end')\n |> circle(center = [size / 2, -size / 2], radius = 25)\n |> extrude(length = 50)\n\n// We put \"thing1\" and \"thing2\" in the shell function to shell the end face of the object.\nshell([thing1, thing2], faces = ['end'], thickness = 5)"
]
},
{
@ -284762,7 +284762,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({ angle = 50, length = sqrt(2500) }, %)\n |> yLine(endAbsolute = 0)\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
"exampleSketch = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> angledLine({ angle = 50, length = sqrt(2500) }, %)\n |> yLine(endAbsolute = 0)\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
]
},
{
@ -299941,7 +299941,7 @@
"unpublished": false,
"deprecated": true,
"examples": [
"fn cube(center) {\n return startSketchOn('XY')\n |> startProfileAt([center[0] - 10, center[1] - 10], %)\n |> line(endAbsolute = [center[0] + 10, center[1] - 10])\n |> line(endAbsolute = [center[0] + 10, center[1] + 10])\n |> line(endAbsolute = [center[0] - 10, center[1] + 10])\n |> close()\n |> extrude(length = 10)\n}\n\npart001 = cube([0, 0])\npart002 = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 2)\n |> extrude(length = 10)\n\nsubtractedPart = subtract([part001], tools = [part002])"
"fn cube(center) {\n return startSketchOn(XY)\n |> startProfileAt([center[0] - 10, center[1] - 10], %)\n |> line(endAbsolute = [center[0] + 10, center[1] - 10])\n |> line(endAbsolute = [center[0] + 10, center[1] + 10])\n |> line(endAbsolute = [center[0] - 10, center[1] + 10])\n |> close()\n |> extrude(length = 10)\n}\n\npart001 = cube([0, 0])\npart002 = startSketchOn(XY)\n |> circle(center = [0, 0], radius = 2)\n |> extrude(length = 10)\n\nsubtractedPart = subtract([part001], tools = [part002])"
]
},
{
@ -311369,9 +311369,9 @@
"unpublished": false,
"deprecated": false,
"examples": [
"// Create a pipe using a sweep.\n\n// Create a path for the sweep.\nsweepPath = startSketchOn('XZ')\n |> startProfileAt([0.05, 0.05], %)\n |> line(end = [0, 7])\n |> tangentialArc({ offset = 90, radius = 5 }, %)\n |> line(end = [-3, 0])\n |> tangentialArc({ offset = -90, radius = 5 }, %)\n |> line(end = [0, 7])\n\n// Create a hole for the pipe.\npipeHole = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 1.5)\n\nsweepSketch = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 2)\n |> hole(pipeHole, %)\n |> sweep(path = sweepPath)",
"// Create a spring by sweeping around a helix path.\n\n// Create a helix around the Z axis.\nhelixPath = helix(\n angleStart = 0,\n ccw = true,\n revolutions = 4,\n length = 10,\n radius = 5,\n axis = 'Z',\n)\n\n// Create a spring by sweeping around the helix path.\nspringSketch = startSketchOn('YZ')\n |> circle(center = [0, 0], radius = 1)\n |> sweep(path = helixPath)",
"// Sweep two sketches along the same path.\n\n\nsketch001 = startSketchOn('XY')\nrectangleSketch = startProfileAt([-200, 23.86], sketch001)\n |> angledLine([0, 73.47], %, $rectangleSegmentA001)\n |> angledLine([\n segAng(rectangleSegmentA001) - 90,\n 50.61\n ], %)\n |> angledLine([\n segAng(rectangleSegmentA001),\n -segLen(rectangleSegmentA001)\n ], %)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ncircleSketch = circle(sketch001, center = [200, -30.29], radius = 32.63)\n\nsketch002 = startSketchOn('YZ')\nsweepPath = startProfileAt([0, 0], sketch002)\n |> yLine(length = 231.81)\n |> tangentialArc({ radius = 80, offset = -90 }, %)\n |> xLine(length = 384.93)\n\nsweep([rectangleSketch, circleSketch], path = sweepPath)"
"// Create a pipe using a sweep.\n\n// Create a path for the sweep.\nsweepPath = startSketchOn(XZ)\n |> startProfileAt([0.05, 0.05], %)\n |> line(end = [0, 7])\n |> tangentialArc({ offset = 90, radius = 5 }, %)\n |> line(end = [-3, 0])\n |> tangentialArc({ offset = -90, radius = 5 }, %)\n |> line(end = [0, 7])\n\n// Create a hole for the pipe.\npipeHole = startSketchOn(XY)\n |> circle(center = [0, 0], radius = 1.5)\n\nsweepSketch = startSketchOn(XY)\n |> circle(center = [0, 0], radius = 2)\n |> hole(pipeHole, %)\n |> sweep(path = sweepPath)",
"// Create a spring by sweeping around a helix path.\n\n// Create a helix around the Z axis.\nhelixPath = helix(\n angleStart = 0,\n ccw = true,\n revolutions = 4,\n length = 10,\n radius = 5,\n axis = 'Z',\n)\n\n// Create a spring by sweeping around the helix path.\nspringSketch = startSketchOn(YZ)\n |> circle(center = [0, 0], radius = 1)\n |> sweep(path = helixPath)",
"// Sweep two sketches along the same path.\n\n\nsketch001 = startSketchOn(XY)\nrectangleSketch = startProfileAt([-200, 23.86], sketch001)\n |> angledLine([0, 73.47], %, $rectangleSegmentA001)\n |> angledLine([\n segAng(rectangleSegmentA001) - 90,\n 50.61\n ], %)\n |> angledLine([\n segAng(rectangleSegmentA001),\n -segLen(rectangleSegmentA001)\n ], %)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ncircleSketch = circle(sketch001, center = [200, -30.29], radius = 32.63)\n\nsketch002 = startSketchOn(YZ)\nsweepPath = startProfileAt([0, 0], sketch002)\n |> yLine(length = 231.81)\n |> tangentialArc({ radius = 80, offset = -90 }, %)\n |> xLine(length = 384.93)\n\nsweep([rectangleSketch, circleSketch], path = sweepPath)"
]
},
{
@ -311419,11 +311419,11 @@
"unpublished": false,
"deprecated": false,
"examples": [
"// Horizontal pill.\npillSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line(end = [20, 0])\n |> tangentialArcToRelative([0, 10], %, $arc1)\n |> angledLine({\n angle = tangentToEnd(arc1),\n length = 20\n }, %)\n |> tangentialArcToRelative([0, -10], %)\n |> close()\n\npillExtrude = extrude(pillSketch, length = 10)",
"// Vertical pill. Use absolute coordinate for arc.\npillSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line(end = [0, 20])\n |> tangentialArcTo([10, 20], %, $arc1)\n |> angledLine({\n angle = tangentToEnd(arc1),\n length = 20\n }, %)\n |> tangentialArcToRelative([-10, 0], %)\n |> close()\n\npillExtrude = extrude(pillSketch, length = 10)",
"rectangleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line(end = [10, 0], tag = $seg1)\n |> angledLine({\n angle = tangentToEnd(seg1),\n length = 10\n }, %)\n |> line(end = [0, 10])\n |> line(end = [-20, 0])\n |> close()\n\nrectangleExtrude = extrude(rectangleSketch, length = 10)",
"bottom = startSketchOn(\"XY\")\n |> startProfileAt([0, 0], %)\n |> arcTo({ end = [10, 10], interior = [5, 1] }, %, $arc1)\n |> angledLine([tangentToEnd(arc1), 20], %)\n |> close()",
"circSketch = startSketchOn(\"XY\")\n |> circle(center = [0, 0], radius = 3, tag = $circ)\n\ntriangleSketch = startSketchOn(\"XY\")\n |> startProfileAt([-5, 0], %)\n |> angledLine([tangentToEnd(circ), 10], %)\n |> line(end = [-15, 0])\n |> close()"
"// Horizontal pill.\npillSketch = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> line(end = [20, 0])\n |> tangentialArcToRelative([0, 10], %, $arc1)\n |> angledLine({\n angle = tangentToEnd(arc1),\n length = 20\n }, %)\n |> tangentialArcToRelative([0, -10], %)\n |> close()\n\npillExtrude = extrude(pillSketch, length = 10)",
"// Vertical pill. Use absolute coordinate for arc.\npillSketch = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> line(end = [0, 20])\n |> tangentialArcTo([10, 20], %, $arc1)\n |> angledLine({\n angle = tangentToEnd(arc1),\n length = 20\n }, %)\n |> tangentialArcToRelative([-10, 0], %)\n |> close()\n\npillExtrude = extrude(pillSketch, length = 10)",
"rectangleSketch = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> line(end = [10, 0], tag = $seg1)\n |> angledLine({\n angle = tangentToEnd(seg1),\n length = 10\n }, %)\n |> line(end = [0, 10])\n |> line(end = [-20, 0])\n |> close()\n\nrectangleExtrude = extrude(rectangleSketch, length = 10)",
"bottom = startSketchOn(XY)\n |> startProfileAt([0, 0], %)\n |> arcTo({ end = [10, 10], interior = [5, 1] }, %, $arc1)\n |> angledLine([tangentToEnd(arc1), 20], %)\n |> close()",
"circSketch = startSketchOn(XY)\n |> circle(center = [0, 0], radius = 3, tag = $circ)\n\ntriangleSketch = startSketchOn(XY)\n |> startProfileAt([-5, 0], %)\n |> angledLine([tangentToEnd(circ), 10], %)\n |> line(end = [-15, 0])\n |> close()"
]
},
{
@ -326295,7 +326295,7 @@
"unpublished": false,
"deprecated": true,
"examples": [
"exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({ angle = 50, length = 10 * tau() }, %)\n |> yLine(endAbsolute = 0)\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
"exampleSketch = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> angledLine({ angle = 50, length = 10 * tau() }, %)\n |> yLine(endAbsolute = 0)\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
]
},
{
@ -326337,7 +326337,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({\n angle = 50,\n length = 70 * cos(toDegrees(pi() / 4))\n }, %)\n |> yLine(endAbsolute = 0)\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
"exampleSketch = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> angledLine({\n angle = 50,\n length = 70 * cos(toDegrees(pi() / 4))\n }, %)\n |> yLine(endAbsolute = 0)\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
]
},
{
@ -326379,7 +326379,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({\n angle = 50,\n length = 70 * cos(toRadians(45))\n }, %)\n |> yLine(endAbsolute = 0)\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
"exampleSketch = startSketchOn(XZ)\n |> startProfileAt([0, 0], %)\n |> angledLine({\n angle = 50,\n length = 70 * cos(toRadians(45))\n }, %)\n |> yLine(endAbsolute = 0)\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
]
},
{
@ -332924,11 +332924,11 @@
"unpublished": false,
"deprecated": false,
"examples": [
"// Move a pipe.\n\n// Create a path for the sweep.\nsweepPath = startSketchOn('XZ')\n |> startProfileAt([0.05, 0.05], %)\n |> line(end = [0, 7])\n |> tangentialArc({ offset = 90, radius = 5 }, %)\n |> line(end = [-3, 0])\n |> tangentialArc({ offset = -90, radius = 5 }, %)\n |> line(end = [0, 7])\n\n// Create a hole for the pipe.\npipeHole = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 1.5)\n\nsweepSketch = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 2)\n |> hole(pipeHole, %)\n |> sweep(path = sweepPath)\n |> translate(translate = [1.0, 1.0, 2.5])",
"// Move a pipe.\n\n// Create a path for the sweep.\nsweepPath = startSketchOn(XZ)\n |> startProfileAt([0.05, 0.05], %)\n |> line(end = [0, 7])\n |> tangentialArc({ offset = 90, radius = 5 }, %)\n |> line(end = [-3, 0])\n |> tangentialArc({ offset = -90, radius = 5 }, %)\n |> line(end = [0, 7])\n\n// Create a hole for the pipe.\npipeHole = startSketchOn(XY)\n |> circle(center = [0, 0], radius = 1.5)\n\nsweepSketch = startSketchOn(XY)\n |> circle(center = [0, 0], radius = 2)\n |> hole(pipeHole, %)\n |> sweep(path = sweepPath)\n |> translate(translate = [1.0, 1.0, 2.5])",
"// Move an imported model.\n\n\nimport \"tests/inputs/cube.sldprt\" as cube\n\ncube\n |> translate(translate = [1.0, 1.0, 2.5])",
"// Sweep two sketches along the same path.\n\n\nsketch001 = startSketchOn('XY')\nrectangleSketch = startProfileAt([-200, 23.86], sketch001)\n |> angledLine([0, 73.47], %, $rectangleSegmentA001)\n |> angledLine([\n segAng(rectangleSegmentA001) - 90,\n 50.61\n ], %)\n |> angledLine([\n segAng(rectangleSegmentA001),\n -segLen(rectangleSegmentA001)\n ], %)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ncircleSketch = circle(sketch001, center = [200, -30.29], radius = 32.63)\n\nsketch002 = startSketchOn('YZ')\nsweepPath = startProfileAt([0, 0], sketch002)\n |> yLine(length = 231.81)\n |> tangentialArc({ radius = 80, offset = -90 }, %)\n |> xLine(length = 384.93)\n\nparts = sweep([rectangleSketch, circleSketch], path = sweepPath)\n\n// Move the sweeps.\ntranslate(parts, translate = [1.0, 1.0, 2.5])",
"// Sweep two sketches along the same path.\n\n\nsketch001 = startSketchOn(XY)\nrectangleSketch = startProfileAt([-200, 23.86], sketch001)\n |> angledLine([0, 73.47], %, $rectangleSegmentA001)\n |> angledLine([\n segAng(rectangleSegmentA001) - 90,\n 50.61\n ], %)\n |> angledLine([\n segAng(rectangleSegmentA001),\n -segLen(rectangleSegmentA001)\n ], %)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ncircleSketch = circle(sketch001, center = [200, -30.29], radius = 32.63)\n\nsketch002 = startSketchOn(YZ)\nsweepPath = startProfileAt([0, 0], sketch002)\n |> yLine(length = 231.81)\n |> tangentialArc({ radius = 80, offset = -90 }, %)\n |> xLine(length = 384.93)\n\nparts = sweep([rectangleSketch, circleSketch], path = sweepPath)\n\n// Move the sweeps.\ntranslate(parts, translate = [1.0, 1.0, 2.5])",
"// Move a sketch.\n\n\nfn square(length) {\n l = length / 2\n p0 = [-l, -l]\n p1 = [-l, l]\n p2 = [l, l]\n p3 = [l, -l]\n\n return startSketchOn(XY)\n |> startProfileAt(p0, %)\n |> line(endAbsolute = p1)\n |> line(endAbsolute = p2)\n |> line(endAbsolute = p3)\n |> close()\n}\n\nsquare(10)\n |> translate(translate = [5, 5, 0])\n |> extrude(length = 10)",
"// Translate and rotate a sketch to create a loft.\nsketch001 = startSketchOn('XY')\n\nfn square() {\n return startProfileAt([-10, 10], sketch001)\n |> xLine(length = 20)\n |> yLine(length = -20)\n |> xLine(length = -20)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n}\n\nprofile001 = square()\n\nprofile002 = square()\n |> translate(translate = [0, 0, 20])\n |> rotate(axis = [0, 0, 1.0], angle = 45)\n\nloft([profile001, profile002])"
"// Translate and rotate a sketch to create a loft.\nsketch001 = startSketchOn(XY)\n\nfn square() {\n return startProfileAt([-10, 10], sketch001)\n |> xLine(length = 20)\n |> yLine(length = -20)\n |> xLine(length = -20)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n}\n\nprofile001 = square()\n\nprofile002 = square()\n |> translate(translate = [0, 0, 20])\n |> rotate(axis = [0, 0, 1.0], angle = 45)\n\nloft([profile001, profile002])"
]
},
{
@ -336139,7 +336139,7 @@
"unpublished": false,
"deprecated": true,
"examples": [
"fn cube(center) {\n return startSketchOn('XY')\n |> startProfileAt([center[0] - 10, center[1] - 10], %)\n |> line(endAbsolute = [center[0] + 10, center[1] - 10])\n |> line(endAbsolute = [center[0] + 10, center[1] + 10])\n |> line(endAbsolute = [center[0] - 10, center[1] + 10])\n |> close()\n |> extrude(length = 10)\n}\n\npart001 = cube([0, 0])\npart002 = cube([20, 10])\n\nunionedPart = union([part001, part002])"
"fn cube(center) {\n return startSketchOn(XY)\n |> startProfileAt([center[0] - 10, center[1] - 10], %)\n |> line(endAbsolute = [center[0] + 10, center[1] - 10])\n |> line(endAbsolute = [center[0] + 10, center[1] + 10])\n |> line(endAbsolute = [center[0] - 10, center[1] + 10])\n |> close()\n |> extrude(length = 10)\n}\n\npart001 = cube([0, 0])\npart002 = cube([20, 10])\n\nunionedPart = union([part001, part002])"
]
},
{

View File

@ -34,7 +34,7 @@ subtract(
```js
fn cube(center) {
return startSketchOn('XY')
return startSketchOn(XY)
|> startProfileAt([center[0] - 10, center[1] - 10], %)
|> line(endAbsolute = [center[0] + 10, center[1] - 10])
|> line(endAbsolute = [center[0] + 10, center[1] + 10])
@ -44,7 +44,7 @@ fn cube(center) {
}
part001 = cube([0, 0])
part002 = startSketchOn('XY')
part002 = startSketchOn(XY)
|> circle(center = [0, 0], radius = 2)
|> extrude(length = 10)

View File

@ -44,7 +44,7 @@ sweep(
// Create a pipe using a sweep.
// Create a path for the sweep.
sweepPath = startSketchOn('XZ')
sweepPath = startSketchOn(XZ)
|> startProfileAt([0.05, 0.05], %)
|> line(end = [0, 7])
|> tangentialArc({ offset = 90, radius = 5 }, %)
@ -53,10 +53,10 @@ sweepPath = startSketchOn('XZ')
|> line(end = [0, 7])
// Create a hole for the pipe.
pipeHole = startSketchOn('XY')
pipeHole = startSketchOn(XY)
|> circle(center = [0, 0], radius = 1.5)
sweepSketch = startSketchOn('XY')
sweepSketch = startSketchOn(XY)
|> circle(center = [0, 0], radius = 2)
|> hole(pipeHole, %)
|> sweep(path = sweepPath)
@ -78,7 +78,7 @@ helixPath = helix(
)
// Create a spring by sweeping around the helix path.
springSketch = startSketchOn('YZ')
springSketch = startSketchOn(YZ)
|> circle(center = [0, 0], radius = 1)
|> sweep(path = helixPath)
```
@ -89,7 +89,7 @@ springSketch = startSketchOn('YZ')
// Sweep two sketches along the same path.
sketch001 = startSketchOn('XY')
sketch001 = startSketchOn(XY)
rectangleSketch = startProfileAt([-200, 23.86], sketch001)
|> angledLine([0, 73.47], %, $rectangleSegmentA001)
|> angledLine([
@ -105,7 +105,7 @@ rectangleSketch = startProfileAt([-200, 23.86], sketch001)
circleSketch = circle(sketch001, center = [200, -30.29], radius = 32.63)
sketch002 = startSketchOn('YZ')
sketch002 = startSketchOn(YZ)
sweepPath = startProfileAt([0, 0], sketch002)
|> yLine(length = 231.81)
|> tangentialArc({ radius = 80, offset = -90 }, %)

File diff suppressed because one or more lines are too long

View File

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

View File

@ -31,7 +31,7 @@ toDegrees(num: number): number
### Examples
```js
exampleSketch = startSketchOn("XZ")
exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> angledLine({
angle = 50,

View File

@ -31,7 +31,7 @@ toRadians(num: number): number
### Examples
```js
exampleSketch = startSketchOn("XZ")
exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> angledLine({
angle = 50,

View File

@ -36,7 +36,7 @@ translate(
// Move a pipe.
// Create a path for the sweep.
sweepPath = startSketchOn('XZ')
sweepPath = startSketchOn(XZ)
|> startProfileAt([0.05, 0.05], %)
|> line(end = [0, 7])
|> tangentialArc({ offset = 90, radius = 5 }, %)
@ -45,10 +45,10 @@ sweepPath = startSketchOn('XZ')
|> line(end = [0, 7])
// Create a hole for the pipe.
pipeHole = startSketchOn('XY')
pipeHole = startSketchOn(XY)
|> circle(center = [0, 0], radius = 1.5)
sweepSketch = startSketchOn('XY')
sweepSketch = startSketchOn(XY)
|> circle(center = [0, 0], radius = 2)
|> hole(pipeHole, %)
|> sweep(path = sweepPath)
@ -73,7 +73,7 @@ cube
// Sweep two sketches along the same path.
sketch001 = startSketchOn('XY')
sketch001 = startSketchOn(XY)
rectangleSketch = startProfileAt([-200, 23.86], sketch001)
|> angledLine([0, 73.47], %, $rectangleSegmentA001)
|> angledLine([
@ -89,7 +89,7 @@ rectangleSketch = startProfileAt([-200, 23.86], sketch001)
circleSketch = circle(sketch001, center = [200, -30.29], radius = 32.63)
sketch002 = startSketchOn('YZ')
sketch002 = startSketchOn(YZ)
sweepPath = startProfileAt([0, 0], sketch002)
|> yLine(length = 231.81)
|> tangentialArc({ radius = 80, offset = -90 }, %)
@ -131,7 +131,7 @@ square(10)
```js
// Translate and rotate a sketch to create a loft.
sketch001 = startSketchOn('XY')
sketch001 = startSketchOn(XY)
fn square() {
return startProfileAt([-10, 10], sketch001)

View File

@ -30,7 +30,7 @@ union(solids: [Solid]): [Solid]
```js
fn cube(center) {
return startSketchOn('XY')
return startSketchOn(XY)
|> startProfileAt([center[0] - 10, center[1] - 10], %)
|> line(endAbsolute = [center[0] + 10, center[1] - 10])
|> line(endAbsolute = [center[0] + 10, center[1] + 10])

View File

@ -47,7 +47,7 @@ async function doBasicSketch(
await page.mouse.click(700, 200)
if (openPanes.includes('code')) {
await expect(u.codeLocator).toHaveText(`sketch001 = startSketchOn('XZ')`)
await expect(u.codeLocator).toHaveText(`sketch001 = startSketchOn(XZ)`)
}
await u.closeDebugPanel()
@ -57,7 +57,7 @@ async function doBasicSketch(
await page.mouse.click(startXPx + PUR * 10, 500 - PUR * 10)
if (openPanes.includes('code')) {
await expect(u.codeLocator).toContainText(
`sketch001 = startSketchOn('XZ')profile001 = startProfileAt(${commonPoints.startAt}, sketch001)`
`sketch001 = startSketchOn(XZ)profile001 = startProfileAt(${commonPoints.startAt}, sketch001)`
)
}
await page.waitForTimeout(500)
@ -66,14 +66,14 @@ async function doBasicSketch(
if (openPanes.includes('code')) {
await expect(u.codeLocator)
.toHaveText(`sketch001 = startSketchOn('XZ')profile001 = startProfileAt(${commonPoints.startAt}, sketch001)
.toHaveText(`sketch001 = startSketchOn(XZ)profile001 = startProfileAt(${commonPoints.startAt}, sketch001)
|> xLine(length = ${commonPoints.num1})`)
}
await page.waitForTimeout(500)
await page.mouse.click(startXPx + PUR * 20, 500 - PUR * 20)
if (openPanes.includes('code')) {
await expect(u.codeLocator)
.toHaveText(`sketch001 = startSketchOn('XZ')profile001 = startProfileAt(${
.toHaveText(`sketch001 = startSketchOn(XZ)profile001 = startProfileAt(${
commonPoints.startAt
}, sketch001)
|> xLine(length = ${commonPoints.num1})
@ -85,7 +85,7 @@ async function doBasicSketch(
await page.mouse.click(startXPx, 500 - PUR * 20)
if (openPanes.includes('code')) {
await expect(u.codeLocator)
.toHaveText(`sketch001 = startSketchOn('XZ')profile001 = startProfileAt(${
.toHaveText(`sketch001 = startSketchOn(XZ)profile001 = startProfileAt(${
commonPoints.startAt
}, sketch001)
|> xLine(length = ${commonPoints.num1})
@ -145,7 +145,7 @@ async function doBasicSketch(
// Open the code pane.
await u.openKclCodePanel()
await expect(u.codeLocator)
.toHaveText(`sketch001 = startSketchOn('XZ')profile001 = startProfileAt(${
.toHaveText(`sketch001 = startSketchOn(XZ)profile001 = startProfileAt(${
commonPoints.startAt
}, sketch001)
|> xLine(length = ${commonPoints.num1}, tag = $seg01)

View File

@ -46,7 +46,7 @@ test.describe(
},
}
const code = `sketch001 = startSketchOn('${plane}')profile001 = startProfileAt([0.91, -1.22], sketch001)`
const code = `sketch001 = startSketchOn(${plane})profile001 = startProfileAt([0.91, -1.22], sketch001)`
await u.openDebugPanel()

View File

@ -22,7 +22,7 @@ test.describe('Code pane and errors', { tag: ['@skipWin'] }, () => {
localStorage.setItem(
'persistCode',
`// Extruded Triangle
sketch001 = startSketchOn('XZ')
sketch001 = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> line(end = [10, 0])
|> line(end = [-5, 10])

View File

@ -16,7 +16,7 @@ test.describe('Command bar tests', { tag: ['@skipWin'] }, () => {
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XY')
`sketch001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %)
|> line(end = [20, 0])
|> line(end = [0, 20])
@ -56,7 +56,7 @@ test.describe('Command bar tests', { tag: ['@skipWin'] }, () => {
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XY')
`sketch001 = startSketchOn(XY)
|> startProfileAt([-5, -5], %)
|> line(end = [0, 10])
|> line(end = [10, 0])
@ -239,7 +239,7 @@ test.describe('Command bar tests', { tag: ['@skipWin'] }, () => {
localStorage.setItem(
'persistCode',
`distance = sqrt(20)
sketch001 = startSketchOn('XZ')
sketch001 = startSketchOn(XZ)
|> startProfileAt([-6.95, 10.98], %)
|> line(end = [25.1, 0.41])
|> line(end = [0.73, -20.93])

View File

@ -20,7 +20,7 @@ test.describe('Copilot ghost text', () => {
await page.keyboard.press('Enter')
await expect(page.locator('.cm-ghostText').first()).toBeVisible()
await expect(page.locator('.cm-content')).toHaveText(
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
`fn cube = (pos, scale) => { sg = startSketchOn(XY) |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
)
await expect(page.locator('.cm-ghostText').first()).toHaveText(
`fn cube = (pos, scale) => {`
@ -29,7 +29,7 @@ test.describe('Copilot ghost text', () => {
// We should be able to hit Tab to accept the completion.
await page.keyboard.press('Tab')
await expect(page.locator('.cm-content')).toHaveText(
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
`fn cube = (pos, scale) => { sg = startSketchOn(XY) |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
)
// Hit enter a few times.
@ -37,7 +37,7 @@ test.describe('Copilot ghost text', () => {
await page.keyboard.press('Enter')
await expect(page.locator('.cm-content')).toHaveText(
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20) `
`fn cube = (pos, scale) => { sg = startSketchOn(XY) |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20) `
)
await expect(page.locator('.cm-ghostText')).not.toBeVisible()
@ -80,7 +80,7 @@ test.describe('Copilot ghost text', () => {
await page.keyboard.press('Enter')
await expect(page.locator('.cm-content')).toHaveText(
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
`fn cube = (pos, scale) => { sg = startSketchOn(XY) |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
)
await expect(page.locator('.cm-ghostText').first()).toHaveText(
`fn cube = (pos, scale) => {`
@ -89,7 +89,7 @@ test.describe('Copilot ghost text', () => {
// We should be able to hit Tab to accept the completion.
await page.keyboard.press('Tab')
await expect(page.locator('.cm-content')).toContainText(
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
`fn cube = (pos, scale) => { sg = startSketchOn(XY) |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
)
})
@ -123,7 +123,7 @@ test.describe('Copilot ghost text', () => {
await page.waitForTimeout(500)
await expect(page.locator('.cm-ghostText').first()).not.toBeVisible()
await expect(page.locator('.cm-content')).toHaveText(
`sketch001 = startSketchOn('XZ')`
`sketch001 = startSketchOn(XZ)`
)
// Escape to exit the tool.
@ -139,7 +139,7 @@ test.describe('Copilot ghost text', () => {
await page.waitForTimeout(500)
await expect(page.locator('.cm-ghostText').first()).not.toBeVisible()
await expect(page.locator('.cm-content')).toHaveText(
`sketch001 = startSketchOn('XZ')`
`sketch001 = startSketchOn(XZ)`
)
// Escape again to exit sketch mode.
@ -156,7 +156,7 @@ test.describe('Copilot ghost text', () => {
await page.keyboard.press('Enter')
await expect(page.locator('.cm-content')).toHaveText(
`sketch001 = startSketchOn('XZ')fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
`sketch001 = startSketchOn(XZ)fn cube = (pos, scale) => { sg = startSketchOn(XY) |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
)
await expect(page.locator('.cm-ghostText').first()).toHaveText(
`fn cube = (pos, scale) => {`
@ -165,7 +165,7 @@ test.describe('Copilot ghost text', () => {
// We should be able to hit Tab to accept the completion.
await page.keyboard.press('Tab')
await expect(page.locator('.cm-content')).toHaveText(
`sketch001 = startSketchOn('XZ')fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
`sketch001 = startSketchOn(XZ)fn cube = (pos, scale) => { sg = startSketchOn(XY) |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
)
// Hit enter a few times.
@ -173,7 +173,7 @@ test.describe('Copilot ghost text', () => {
await page.keyboard.press('Enter')
await expect(page.locator('.cm-content')).toHaveText(
`sketch001 = startSketchOn('XZ')fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20) `
`sketch001 = startSketchOn(XZ)fn cube = (pos, scale) => { sg = startSketchOn(XY) |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20) `
)
await expect(page.locator('.cm-ghostText')).not.toBeVisible()
@ -194,7 +194,7 @@ test.describe('Copilot ghost text', () => {
await page.keyboard.press('Enter')
await expect(page.locator('.cm-ghostText').first()).toBeVisible()
await expect(page.locator('.cm-content')).toHaveText(
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
`fn cube = (pos, scale) => { sg = startSketchOn(XY) |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
)
await expect(page.locator('.cm-ghostText').first()).toHaveText(
`fn cube = (pos, scale) => {`
@ -225,7 +225,7 @@ test.describe('Copilot ghost text', () => {
await page.keyboard.press('Enter')
await expect(page.locator('.cm-ghostText').first()).toBeVisible()
await expect(page.locator('.cm-content')).toHaveText(
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
`fn cube = (pos, scale) => { sg = startSketchOn(XY) |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
)
await expect(page.locator('.cm-ghostText').first()).toHaveText(
`fn cube = (pos, scale) => {`
@ -256,7 +256,7 @@ test.describe('Copilot ghost text', () => {
await page.keyboard.press('Enter')
await expect(page.locator('.cm-ghostText').first()).toBeVisible()
await expect(page.locator('.cm-content')).toHaveText(
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
`fn cube = (pos, scale) => { sg = startSketchOn(XY) |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
)
await expect(page.locator('.cm-ghostText').first()).toHaveText(
`fn cube = (pos, scale) => {`
@ -287,7 +287,7 @@ test.describe('Copilot ghost text', () => {
await page.keyboard.press('Enter')
await expect(page.locator('.cm-ghostText').first()).toBeVisible()
await expect(page.locator('.cm-content')).toHaveText(
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
`fn cube = (pos, scale) => { sg = startSketchOn(XY) |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
)
await expect(page.locator('.cm-ghostText').first()).toHaveText(
`fn cube = (pos, scale) => {`
@ -315,7 +315,7 @@ test.describe('Copilot ghost text', () => {
await page.keyboard.press('Enter')
await expect(page.locator('.cm-ghostText').first()).toBeVisible()
await expect(page.locator('.cm-content')).toHaveText(
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
`fn cube = (pos, scale) => { sg = startSketchOn(XY) |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
)
await expect(page.locator('.cm-ghostText').first()).toHaveText(
`fn cube = (pos, scale) => {`
@ -326,7 +326,7 @@ test.describe('Copilot ghost text', () => {
await expect(page.locator('.cm-ghostText').first()).toBeVisible()
await expect(page.locator('.cm-content')).toHaveText(
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
`fn cube = (pos, scale) => { sg = startSketchOn(XY) |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
)
})
@ -348,7 +348,7 @@ test.describe('Copilot ghost text', () => {
await page.keyboard.press('Enter')
await expect(page.locator('.cm-ghostText').first()).toBeVisible()
await expect(page.locator('.cm-content')).toHaveText(
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
`fn cube = (pos, scale) => { sg = startSketchOn(XY) |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
)
await expect(page.locator('.cm-ghostText').first()).toHaveText(
`fn cube = (pos, scale) => {`
@ -409,7 +409,7 @@ test.describe('Copilot ghost text', () => {
await page.keyboard.press('Enter')
await expect(page.locator('.cm-ghostText').first()).toBeVisible()
await expect(page.locator('.cm-content')).toHaveText(
`{thing: "blah"}fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
`{thing: "blah"}fn cube = (pos, scale) => { sg = startSketchOn(XY) |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
)
await expect(page.locator('.cm-ghostText').first()).toHaveText(
`fn cube = (pos, scale) => {`
@ -450,7 +450,7 @@ test.describe('Copilot ghost text', () => {
await page.keyboard.press('Enter')
await expect(page.locator('.cm-ghostText').first()).toBeVisible()
await expect(page.locator('.cm-content')).toHaveText(
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
`fn cube = (pos, scale) => { sg = startSketchOn(XY) |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
)
await expect(page.locator('.cm-ghostText').first()).toHaveText(
`fn cube = (pos, scale) => {`
@ -483,7 +483,7 @@ test.describe('Copilot ghost text', () => {
await page.keyboard.press('Enter')
await expect(page.locator('.cm-ghostText').first()).toBeVisible()
await expect(page.locator('.cm-content')).toHaveText(
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
`fn cube = (pos, scale) => { sg = startSketchOn(XY) |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
)
await expect(page.locator('.cm-ghostText').first()).toHaveText(
`fn cube = (pos, scale) => {`
@ -514,7 +514,7 @@ test.describe('Copilot ghost text', () => {
await page.keyboard.press('Enter')
await expect(page.locator('.cm-ghostText').first()).toBeVisible()
await expect(page.locator('.cm-content')).toHaveText(
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
`fn cube = (pos, scale) => { sg = startSketchOn(XY) |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
)
await expect(page.locator('.cm-ghostText').first()).toHaveText(
`fn cube = (pos, scale) => {`

View File

@ -18,7 +18,7 @@ test.describe('Debug pane', () => {
context,
homePage,
}) => {
const code = `sketch001 = startSketchOn('XZ')
const code = `sketch001 = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> line(end = [1, 1])
`

View File

@ -21,7 +21,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await expect(page.locator('.cm-lint-marker-error')).not.toBeVisible()
await u.codeLocator.click()
await page.keyboard.type(`sketch001 = startSketchOn('XY')
await page.keyboard.type(`sketch001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %)
|> line(end = [20, 0])
|> line(end = [0, 20])
@ -33,7 +33,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await page.keyboard.up('ControlOrMeta')
await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XY')
.toHaveText(`sketch001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %)
|> line(end = [20, 0])
|> line(end = [0, 20])
@ -46,7 +46,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await page.keyboard.up('ControlOrMeta')
await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XY')
.toHaveText(`sketch001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %)
|> line(end = [20, 0])
|> line(end = [0, 20])
@ -65,7 +65,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await u.waitForPageLoad()
await u.codeLocator.click()
await page.keyboard.type(`sketch001 = startSketchOn('XY')
await page.keyboard.type(`sketch001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %)
|> line(end = [20, 0])
|> line(end = [0, 20])
@ -114,7 +114,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await u.waitForPageLoad()
await u.codeLocator.click()
await page.keyboard.type(`sketch001 = startSketchOn('XY')
await page.keyboard.type(`sketch001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %)
|> line(end = [20, 0])
|> line(end = [0, 20])
@ -169,7 +169,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await expect(page.locator('.cm-lint-marker-error')).not.toBeVisible()
await u.codeLocator.click()
await page.keyboard.type(`sketch001 = startSketchOn('XY')
await page.keyboard.type(`sketch001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %)
|> line(end = [20, 0])
|> line(end = [0, 20])
@ -179,7 +179,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await page.locator('button:has-text("Format code")').click()
await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XY')
.toHaveText(`sketch001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %)
|> line(end = [20, 0])
|> line(end = [0, 20])
@ -200,7 +200,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await expect(page.locator('.cm-lint-marker-error')).not.toBeVisible()
await u.codeLocator.click()
await page.keyboard.type(`sketch_001 = startSketchOn('XY')
await page.keyboard.type(`sketch_001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %)
|> line(end = [20, 0])
|> line(end = [0, 20])
@ -228,7 +228,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await u.closeDebugPanel()
await expect(page.locator('.cm-content'))
.toHaveText(`sketch_001 = startSketchOn('XY')
.toHaveText(`sketch_001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %)
|> line(end = [20, 0])
|> line(end = [0, 20])
@ -246,7 +246,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
})
test('fold gutters work', async ({ page, homePage }) => {
const fullCode = `sketch001 = startSketchOn('XY')
const fullCode = `sketch001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %)
|> line(end = [20, 0])
|> line(end = [0, 20])
@ -255,7 +255,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XY')
`sketch001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %)
|> line(end = [20, 0])
|> line(end = [0, 20])
@ -293,7 +293,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await foldGutterFoldLine.click()
await expect(page.locator('.cm-content')).toHaveText(
`sketch001 = startSketchOn('XY')… `
`sketch001 = startSketchOn(XY)… `
)
await expect(page.locator('.cm-content')).not.toHaveText(fullCode)
await expect(foldGutterFoldLine).not.toBeVisible()
@ -324,7 +324,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XY')
`sketch001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %)
|> line(end = [20, 0])
|> line(end = [0, 20])
@ -371,7 +371,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XY')
`sketch001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %)
|> line(end = [20, 0])
|> line(end = [0, 20])
@ -398,7 +398,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await page.keyboard.press('Alt+Shift+KeyF')
await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XY')
.toHaveText(`sketch001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %)
|> line(end = [20, 0])
|> line(end = [0, 20])
@ -414,7 +414,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch_001 = startSketchOn('XY')
`sketch_001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %)
|> line(end = [20, 0])
|> line(end = [0, 20])
@ -451,7 +451,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await u.closeDebugPanel()
await expect(page.locator('.cm-content'))
.toHaveText(`sketch_001 = startSketchOn('XY')
.toHaveText(`sketch_001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %)
|> line(end = [20, 0])
|> line(end = [0, 20])
@ -524,7 +524,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
|> startProfileAt([3.29, 7.86], %)
|> line(end = [2.48, 2.44])
|> line(end = [2.66, 1.17])
@ -650,7 +650,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
dia = 4
fn squareHole = (l, w) => {
squareHoleSketch = startSketchOn('XY')
squareHoleSketch = startSketchOn(XY)
|> startProfileAt([-width / 2, -length / 2], %)
|> line(endAbsolute = [width / 2, -length / 2])
|> line(endAbsolute = [width / 2, length / 2])
@ -690,7 +690,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await page.keyboard.press('ArrowDown')
await page.keyboard.press('ArrowDown')
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)
|> hole(squareHole(length, width, height), %)
|> extrude(length = height)`)
@ -713,7 +713,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await context.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`box = startSketchOn('XY')
`box = startSketchOn(XY)
|> startProfileAt([0, 0], %)
|> line(end = [0, 10])
|> line(end = [10, 0])
@ -772,7 +772,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
}).toPass()
// this makes sure we can accept a completion with click
await page.getByText('startSketchOn').click()
await page.keyboard.type("'XZ'")
await page.keyboard.type('XZ')
await page.keyboard.press('Tab')
await page.keyboard.press('Enter')
await page.keyboard.type(' |> startProfi')
@ -816,7 +816,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await expect(page.locator('.cm-completionLabel')).not.toBeVisible()
await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XZ')
.toHaveText(`sketch001 = startSketchOn(XZ)
|> startProfileAt([3.14, 12], %)
|> xLine(%, length = 5) // lin`)
@ -846,7 +846,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await page.keyboard.press('ArrowDown')
await page.keyboard.press('Tab')
await page.waitForTimeout(500)
await page.keyboard.type("'XZ'")
await page.keyboard.type('XZ')
await page.keyboard.press('Tab')
await page.keyboard.press('Enter')
await page.keyboard.type(' |> startProfi')
@ -889,7 +889,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await expect(page.locator('.cm-completionLabel')).not.toBeVisible()
await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XZ')
.toHaveText(`sketch001 = startSketchOn(XZ)
|> startProfileAt([3.14, 12], %)
|> xLine(%, length = 5) // lin`)
})
@ -903,7 +903,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await context.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
|> startProfileAt([4.61, -14.01], %)
|> line(end = [12.73, -0.09])
|> tangentialArcTo([24.95, -5.38], %)
@ -955,7 +955,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
// expect the code to have changed
await expect(page.locator('.cm-content')).toHaveText(
`sketch001 = startSketchOn('XZ') |> startProfileAt([4.61, -14.01], %) |> line(end = [12.73, -0.09]) |> tangentialArcTo([24.95, -5.38], %) |> close()extrude001 = extrude(sketch001, length = 5)`
`sketch001 = startSketchOn(XZ) |> startProfileAt([4.61, -14.01], %) |> line(end = [12.73, -0.09]) |> tangentialArcTo([24.95, -5.38], %) |> close()extrude001 = extrude(sketch001, length = 5)`
)
// Now hit undo
@ -965,7 +965,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await page.waitForTimeout(100)
await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XZ')
.toHaveText(`sketch001 = startSketchOn(XZ)
|> startProfileAt([4.61, -14.01], %)
|> line(end = [12.73, -0.09])
|> tangentialArcTo([24.95, -5.38], %)
@ -980,7 +980,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
|> startProfileAt([4.61, -10.01], %)
|> line(end = [12.73, -0.09])
|> tangentialArcTo([24.95, -0.38], %)
@ -1071,7 +1071,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
// expect the code to have changed
await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XZ')
.toHaveText(`sketch001 = startSketchOn(XZ)
|> startProfileAt([2.71, -2.71], %)
|> line(end = [15.4, -2.78])
|> tangentialArcTo([27.6, -3.05], %)
@ -1085,7 +1085,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await page.keyboard.up('Control')
await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XZ')
.toHaveText(`sketch001 = startSketchOn(XZ)
|> startProfileAt([2.71, -2.71], %)
|> line(end = [15.4, -2.78])
|> tangentialArcTo([24.95, -0.38], %)
@ -1098,7 +1098,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await page.keyboard.up('Control')
await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XZ')
.toHaveText(`sketch001 = startSketchOn(XZ)
|> startProfileAt([2.71, -2.71], %)
|> line(end = [12.73, -0.09])
|> tangentialArcTo([24.95, -0.38], %)
@ -1113,7 +1113,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await page.waitForTimeout(100)
await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XZ')
.toHaveText(`sketch001 = startSketchOn(XZ)
|> startProfileAt([4.61, -10.01], %)
|> line(end = [12.73, -0.09])
|> tangentialArcTo([24.95, -0.38], %)

View File

@ -6,7 +6,7 @@ const FEATURE_TREE_EXAMPLE_CODE = `export fn timesFive(x) {
return 5 * x
}
export fn triangle() {
return startSketchOn('XZ')
return startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> xLine(length = 10)
|> line(end = [-10, -5])
@ -15,7 +15,7 @@ export fn triangle() {
}
length001 = timesFive(1) * 5
sketch001 = startSketchOn('XZ')
sketch001 = startSketchOn(XZ)
|> startProfileAt([20, 10], %)
|> line(end = [10, 10])
|> angledLine([-45, length001], %)
@ -24,7 +24,7 @@ sketch001 = startSketchOn('XZ')
revolve001 = revolve(sketch001, axis = "X")
triangle()
|> extrude(length = 30)
plane001 = offsetPlane('XY', offset = 10)
plane001 = offsetPlane(XY, offset = 10)
sketch002 = startSketchOn(plane001)
|> startProfileAt([-20, 0], %)
|> line(end = [5, -15])
@ -35,7 +35,7 @@ sketch002 = startSketchOn(plane001)
extrude001 = extrude(sketch002, length = 10)
`
const FEATURE_TREE_SKETCH_CODE = `sketch001 = startSketchOn('XZ')
const FEATURE_TREE_SKETCH_CODE = `sketch001 = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> angledLine([0, 4], %, $rectangleSegmentA001)
|> angledLine([
@ -54,7 +54,7 @@ sketch002 = startSketchOn(extrude001, rectangleSegmentB001)
center = [-1, 2],
radius = .5
)
plane001 = offsetPlane('XZ', offset = -5)
plane001 = offsetPlane(XZ, offset = -5)
sketch003 = startSketchOn(plane001)
|> circle(center = [0, 0], radius = 5)
`
@ -116,7 +116,7 @@ test.describe('Feature Tree pane', () => {
await testViewSource({
operationName: 'Offset Plane',
operationIndex: 0,
expectedActiveLine: "plane001 = offsetPlane('XY', offset = 10)",
expectedActiveLine: 'plane001 = offsetPlane(XY, offset = 10)',
})
await testViewSource({
operationName: 'Extrude',
@ -174,7 +174,7 @@ test.describe('Feature Tree pane', () => {
await editor.expectState({
highlightedCode: '',
diagnostics: [],
activeLines: ["sketch001 = startSketchOn('XZ')"],
activeLines: ['sketch001 = startSketchOn(XZ)'],
})
await toolbar.exitSketchBtn.click()
})
@ -227,12 +227,12 @@ test.describe('Feature Tree pane', () => {
page,
}) => {
const initialInput = '23'
const initialCode = `sketch001 = startSketchOn('XZ')
const initialCode = `sketch001 = startSketchOn(XZ)
|> circle(center = [0, 0], radius = 5)
renamedExtrude = extrude(sketch001, length = ${initialInput})`
const newConstantName = 'distance001'
const expectedCode = `${newConstantName} = 23
sketch001 = startSketchOn('XZ')
sketch001 = startSketchOn(XZ)
|> circle(center = [0, 0], radius = 5)
renamedExtrude = extrude(sketch001, length = ${newConstantName})`
@ -316,8 +316,7 @@ test.describe('Feature Tree pane', () => {
toolbar,
cmdBar,
}) => {
const testCode = (value: string) =>
`p = offsetPlane('XY', offset = ${value})`
const testCode = (value: string) => `p = offsetPlane(XY, offset = ${value})`
const initialInput = '10'
const initialCode = testCode(initialInput)
const newInput = '5 + 10'
@ -396,7 +395,7 @@ test.describe('Feature Tree pane', () => {
toolbar,
cmdBar,
}) => {
const beforeKclCode = `plane001 = offsetPlane('XY', offset = 5)
const beforeKclCode = `plane001 = offsetPlane(XY, offset = 5)
sketch001 = startSketchOn(plane001)
profile001 = circle(sketch001, center = [0, 20], radius = 12)
profile002 = startProfileAt([0, 7.25], sketch001)

View File

@ -1064,7 +1064,7 @@ test.describe('Undo and redo do not keep history when navigating between files',
// Click in the editor and add some new lines.
await u.codeLocator.click()
await page.keyboard.type(`sketch001 = startSketchOn('XY')
await page.keyboard.type(`sketch001 = startSketchOn(XY)
some other shit`)
// Ensure the content in the editor changed.

View File

@ -205,7 +205,7 @@ export class EditorFixture {
// Use Playwright's built-in text selection on the code content
// it seems to only select whole divs, which works out to align with syntax highlighting
// for code mirror, so you can probably select "sketch002 = startSketchOn('XZ')"
// for code mirror, so you can probably select "sketch002 = startSketchOn(XZ)"
// but less so for exactly "sketch002 = startS"
await this.codeContent.getByText(text).first().selectText()

View File

@ -117,7 +117,7 @@ test.describe('Onboarding tests', () => {
}
await tronApp.cleanProjectDir()
const initialCode = `sketch001 = startSketchOn('XZ')`
const initialCode = `sketch001 = startSketchOn(XZ)`
// Load the page up with some code so we see the confirmation warning
// when we go to replay onboarding

View File

@ -45,7 +45,7 @@ test.describe('Point-and-click tests', () => {
await moveToCircle()
const circleSnippet = 'circle(center = [318.33, 168.1], radius = 182.8)'
await editor.expectState({
activeLines: ["sketch002=startSketchOn('XZ')"],
activeLines: ['sketch002=startSketchOn(XZ)'],
highlightedCode: circleSnippet,
diagnostics: [],
})
@ -54,7 +54,7 @@ test.describe('Point-and-click tests', () => {
await moveToCircle()
const circleSnippet = 'circle(center = [318.33, 168.1], radius = 182.8)'
await editor.expectState({
activeLines: ["sketch002=startSketchOn('XZ')"],
activeLines: ['sketch002=startSketchOn(XZ)'],
highlightedCode: circleSnippet,
diagnostics: [],
})
@ -173,7 +173,7 @@ test.describe('Point-and-click tests', () => {
})
await test.step('Check there is no errors after code created in previous steps executes', async () => {
await editor.expectState({
activeLines: ["sketch001 = startSketchOn('XZ')"],
activeLines: ['sketch001 = startSketchOn(XZ)'],
highlightedCode: '',
diagnostics: [],
})
@ -299,7 +299,7 @@ test.describe('Point-and-click tests', () => {
await test.step('verify at the end of the test that final code is what is expected', async () => {
await editor.expectEditor.toContain(
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
|> startProfileAt([75.8, 317.2], %) // [$startCapTag, $EndCapTag]
|> angledLine([0, 268.43], %, $rectangleSegmentA001)
|> angledLine([
@ -418,7 +418,7 @@ profile001 = startProfileAt([205.96, 254.59], sketch002)
|>close()`,
})
await editor.expectEditor.toContain(
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
|> startProfileAt([75.8, 317.2], %)
|> angledLine([0, 268.43], %, $rectangleSegmentA001)
|> angledLine([
@ -523,7 +523,7 @@ profile001 = startProfileAt([205.96, 254.59], sketch002)
)
const expectedCodeSnippets = {
sketchOnXzPlane: `sketch001 = startSketchOn('XZ')`,
sketchOnXzPlane: `sketch001 = startSketchOn(XZ)`,
pointAtOrigin: `startProfileAt([${originSloppy.kcl[0]}, ${originSloppy.kcl[1]}], sketch001)`,
segmentOnXAxis: `xLine(length = ${xAxisSloppy.kcl[0]})`,
afterSegmentDraggedOffYAxis: `startProfileAt([${offYAxis.kcl[0]}, ${offYAxis.kcl[1]}], sketch001)`,
@ -581,9 +581,9 @@ profile001 = startProfileAt([205.96, 254.59], sketch002)
}) => {
const u = await getUtils(page)
const initialCode = `closedSketch = startSketchOn('XZ')
const initialCode = `closedSketch = startSketchOn(XZ)
|> circle(center = [8, 5], radius = 2)
openSketch = startSketchOn('XY')
openSketch = startSketchOn(XY)
|> startProfileAt([-5, 0], %)
|> line(endAbsolute = [0, 5])
|> xLine(length = 5)
@ -687,7 +687,7 @@ openSketch = startSketchOn('XY')
scene,
}) => {
// Code samples
const initialCode = `sketch001 = startSketchOn('XY')
const initialCode = `sketch001 = startSketchOn(XY)
|> startProfileAt([-12, -6], %)
|> line(end = [0, 12])
|> line(end = [24, 0])
@ -1017,7 +1017,7 @@ openSketch = startSketchOn('XY')
// One dumb hardcoded screen pixel value
const testPoint = { x: 700, y: 150 }
const [clickOnXzPlane] = scene.makeMouseHelpers(testPoint.x, testPoint.y)
const expectedOutput = `plane001 = offsetPlane('XZ', offset = 5)`
const expectedOutput = `plane001 = offsetPlane(XZ, offset = 5)`
await homePage.goToModelingScene()
// FIXME: Since there is no KCL code loaded. We need to wait for the scene to load before we continue.
@ -1193,9 +1193,9 @@ openSketch = startSketchOn('XY')
toolbar,
cmdBar,
}) => {
const initialCode = `sketch001 = startSketchOn('XZ')
const initialCode = `sketch001 = startSketchOn(XZ)
|> circle(center = [0, 0], radius = 30)
plane001 = offsetPlane('XZ', offset = 50)
plane001 = offsetPlane(XZ, offset = 50)
sketch002 = startSketchOn(plane001)
|> circle(center = [0, 0], radius = 20)
`
@ -1279,9 +1279,9 @@ openSketch = startSketchOn('XY')
homePage,
scene,
}) => {
const initialCode = `sketch001 = startSketchOn('XZ')
const initialCode = `sketch001 = startSketchOn(XZ)
|> circle(center = [0, 0], radius = 30)
plane001 = offsetPlane('XZ', offset = 50)
plane001 = offsetPlane(XZ, offset = 50)
sketch002 = startSketchOn(plane001)
|> circle(center = [0, 0], radius = 20)
loft001 = loft([sketch001, sketch002])
@ -1328,7 +1328,7 @@ loft001 = loft([sketch001, sketch002])
await page.waitForTimeout(1000)
await clickOnSketch2()
await expect(page.locator('.cm-activeLine')).toHaveText(`
plane001 = offsetPlane('XZ', offset = 50)
plane001 = offsetPlane(XZ, offset = 50)
`)
await page.keyboard.press('Delete')
// Check for sketch 1
@ -1345,12 +1345,12 @@ loft001 = loft([sketch001, sketch002])
toolbar,
cmdBar,
}) => {
const initialCode = `sketch001 = startSketchOn('YZ')
const initialCode = `sketch001 = startSketchOn(YZ)
|> circle(
center = [0, 0],
radius = 500
)
sketch002 = startSketchOn('XZ')
sketch002 = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> xLine(length = -500)
|> tangentialArcTo([-2000, 500], %)
@ -1476,12 +1476,12 @@ sketch002 = startSketchOn('XZ')
toolbar,
cmdBar,
}) => {
const initialCode = `sketch001 = startSketchOn('YZ')
const initialCode = `sketch001 = startSketchOn(YZ)
|> circle(
center = [0, 0],
radius = 500
)
sketch002 = startSketchOn('XZ')
sketch002 = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> xLine(length = -500)
|> line(endAbsolute = [-2000, 500])
@ -1552,7 +1552,7 @@ sketch002 = startSketchOn('XZ')
cmdBar,
}) => {
// Code samples
const initialCode = `sketch001 = startSketchOn('XY')
const initialCode = `sketch001 = startSketchOn(XY)
|> startProfileAt([-12, -6], %)
|> line(end = [0, 12])
|> line(end = [24, 0])
@ -1787,7 +1787,7 @@ extrude001 = extrude(sketch001, length = -12)
toolbar,
}) => {
// Code samples
const initialCode = `sketch001 = startSketchOn('XY')
const initialCode = `sketch001 = startSketchOn(XY)
|> startProfileAt([-12, -6], %)
|> line(end = [0, 12])
|> line(end = [24, 0], tag = $seg02)
@ -1930,7 +1930,7 @@ fillet04 = fillet(extrude001, radius = 5, tags = [getOppositeEdge(seg02)])
cmdBar,
}) => {
// Create a cube with small edges that will cause some fillets to fail
const initialCode = `sketch001 = startSketchOn('XY')
const initialCode = `sketch001 = startSketchOn(XY)
profile001 = startProfileAt([0, 0], sketch001)
|> yLine(length = -1)
|> xLine(length = -10)
@ -2043,7 +2043,7 @@ extrude001 = extrude(profile001, length = 5)
cmdBar,
}) => {
// Code samples
const initialCode = `sketch001 = startSketchOn('XY')
const initialCode = `sketch001 = startSketchOn(XY)
|> startProfileAt([-12, -6], %)
|> line(end = [0, 12])
|> line(end = [24, 0])
@ -2267,7 +2267,7 @@ extrude001 = extrude(sketch001, length = -12)
toolbar,
}) => {
// Code samples
const initialCode = `sketch001 = startSketchOn('XY')
const initialCode = `sketch001 = startSketchOn(XY)
|> startProfileAt([-12, -6], %)
|> line(end = [0, 12])
|> line(end = [24, 0], tag = $seg02)
@ -2421,7 +2421,7 @@ chamfer04 = chamfer(extrude001, length = 5, tags = [getOppositeEdge(seg02)])
toolbar,
cmdBar,
}) => {
const initialCode = `sketch001 = startSketchOn('XZ')
const initialCode = `sketch001 = startSketchOn(XZ)
|> circle(center = [0, 0], radius = 30)
extrude001 = extrude(sketch001, length = 30)
`
@ -2556,7 +2556,7 @@ extrude001 = extrude(sketch001, length = 30)
toolbar,
cmdBar,
}) => {
const initialCode = `sketch001 = startSketchOn('XY')
const initialCode = `sketch001 = startSketchOn(XY)
|> startProfileAt([-20, 20], %)
|> xLine(length = 40)
|> yLine(length = -60)
@ -2674,7 +2674,7 @@ extrude001 = extrude(sketch001, length = 40)
})
const shellSketchOnFacesCases = [
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
|> circle(center = [0, 0], radius = 100)
|> extrude(length = 100)
@ -2682,7 +2682,7 @@ sketch002 = startSketchOn(sketch001, 'END')
|> circle(center = [0, 0], radius = 50)
|> extrude(length = 50)
`,
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
|> circle(center = [0, 0], radius = 100)
extrude001 = extrude(sketch001, length = 100)
@ -2777,7 +2777,7 @@ extrude002 = extrude(sketch002, length = 50)
toolbar,
cmdBar,
}) => {
const sketchCode = `sketch001 = startSketchOn('XY')
const sketchCode = `sketch001 = startSketchOn(XY)
profile001 = startProfileAt([-20, 20], sketch001)
|> xLine(length = 40)
|> yLine(length = -60)
@ -2860,12 +2860,12 @@ profile001 = startProfileAt([-20, 20], sketch001)
toolbar,
cmdBar,
}) => {
const initialCode = `sketch001 = startSketchOn('YZ')
const initialCode = `sketch001 = startSketchOn(YZ)
|> circle(
center = [0, 0],
radius = 500
)
sketch002 = startSketchOn('XZ')
sketch002 = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> xLine(length = -2000)
sweep001 = sweep(sketch001, path = sketch002)
@ -2920,7 +2920,7 @@ sweep001 = sweep(sketch001, path = sketch002)
cmdBar,
}) => {
const initialCode = `
sketch001 = startSketchOn('XZ')
sketch001 = startSketchOn(XZ)
|> startProfileAt([-100.0, 100.0], %)
|> angledLine([0, 200.0], %, $rectangleSegmentA001)
|> angledLine([segAng(rectangleSegmentA001) - 90, 200], %, $rectangleSegmentB001)
@ -2976,7 +2976,7 @@ segAng(rectangleSegmentA002),
cmdBar,
}) => {
const initialCode = `
sketch001 = startSketchOn('XZ')
sketch001 = startSketchOn(XZ)
|> startProfileAt([-102.57, 101.72], %)
|> angledLine([0, 202.6], %, $rectangleSegmentA001)
|> angledLine([
@ -3026,7 +3026,7 @@ radius = 8.69
cmdBar,
}) => {
const initialCode = `
sketch002 = startSketchOn('XY')
sketch002 = startSketchOn(XY)
|> startProfileAt([-2.02, 1.79], %)
|> xLine(length = 2.6)
sketch001 = startSketchOn('-XY')
@ -3078,7 +3078,7 @@ radius = 8.69
toolbar,
cmdBar,
}) => {
const initialCode = `sketch001 = startSketchOn('XZ')
const initialCode = `sketch001 = startSketchOn(XZ)
profile001 = circle(
sketch001,
center = [0, 0],

View File

@ -1497,7 +1497,7 @@ test(
await u.waitForPageLoad()
await page.locator('.cm-content').fill(`sketch001 = startSketchOn('XZ')
await page.locator('.cm-content').fill(`sketch001 = startSketchOn(XZ)
|> startProfileAt([-87.4, 282.92], %)
|> line(end = [324.07, 27.199], tag = $seg01)
|> line(end = [118.328, -291.754])

View File

@ -21,7 +21,7 @@ import { test, expect } from './zoo-test'
*
*/
const file = `sketch001 = startSketchOn('XZ')
const file = `sketch001 = startSketchOn(XZ)
profile001 = startProfileAt([57.81, 250.51], sketch001)
|> line(end = [121.13, 56.63], tag = $seg02)
|> line(end = [83.37, -34.61], tag = $seg01)
@ -30,7 +30,7 @@ profile001 = startProfileAt([57.81, 250.51], sketch001)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
extrude001 = extrude(profile001, length = 200)
sketch002 = startSketchOn('XZ')
sketch002 = startSketchOn(XZ)
|> startProfileAt([-73.64, -42.89], %)
|> xLine(length = 173.71)
|> line(end = [-22.12, -94.4])
@ -38,7 +38,7 @@ sketch002 = startSketchOn('XZ')
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
extrude002 = extrude(sketch002, length = 50)
sketch003 = startSketchOn('XY')
sketch003 = startSketchOn(XY)
|> startProfileAt([52.92, 157.81], %)
|> angledLine([0, 176.4], %, $rectangleSegmentA001)
|> angledLine([

View File

@ -3,7 +3,7 @@ import { orRunWhenFullSuiteEnabled } from './test-utils'
/* eslint-disable jest/no-conditional-expect */
const file = `sketch001 = startSketchOn('XZ')
const file = `sketch001 = startSketchOn(XZ)
profile001 = startProfileAt([57.81, 250.51], sketch001)
|> line(end = [121.13, 56.63], tag = $seg02)
|> line(end = [83.37, -34.61], tag = $seg01)
@ -12,7 +12,7 @@ profile001 = startProfileAt([57.81, 250.51], sketch001)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
extrude001 = extrude(profile001, length = 200)
sketch002 = startSketchOn('XZ')
sketch002 = startSketchOn(XZ)
|> startProfileAt([-114, 85.52], %)
|> xLine(length = 265.36)
|> line(end = [33.17, -261.22])
@ -20,7 +20,7 @@ sketch002 = startSketchOn('XZ')
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
extrude002 = extrude(sketch002, length = 50)
sketch003 = startSketchOn('XY')
sketch003 = startSketchOn(XY)
|> startProfileAt([52.92, 157.81], %)
|> angledLine([0, 176.4], %, $rectangleSegmentA001)
|> angledLine([
@ -225,7 +225,7 @@ test.describe('Prompt-to-edit tests', { tag: '@skipWin' }, () => {
// Verify the selection was made
await editor.expectState({
highlightedCode: '',
activeLines: ["sketch002 = startSketchOn('XZ')"],
activeLines: ['sketch002 = startSketchOn(XZ)'],
diagnostics: [],
})
})

View File

@ -65,7 +65,7 @@ test.describe('Regression tests', { tag: ['@skipWin'] }, () => {
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XY')
`sketch001 = startSketchOn(XY)
|> startProfileAt([82.33, 238.21], %)
|> angledLine([0, 288.63], %, $rectangleSegmentA001)
|> angledLine([
@ -133,7 +133,7 @@ extrude001 = extrude(sketch001, length = 50)
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('-XZ')
`sketch001 = startSketchOn(-XZ)
|> startProfileAt([-6.95, 4.98], %)
|> line(end = [25.1, 0.41])
|> line(end = [0.73, -14.93])
@ -194,7 +194,7 @@ extrude001 = extrude(sketch001, length = 50)
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`part = startSketchOn('XY')
`part = startSketchOn(XY)
|> startProfileAt([0, 0], %)
|> line(end = [0, 1])
|> line(end = [1, 0])

View File

@ -42,7 +42,7 @@ test.describe('Sketch tests', { tag: ['@skipWin'] }, () => {
wireRadius = 2
wireOffset = 0.5
screwHole = startSketchOn('XY')
screwHole = startSketchOn(XY)
${startProfileAt1}
|> arc({
radius = screwRadius,
@ -50,7 +50,7 @@ test.describe('Sketch tests', { tag: ['@skipWin'] }, () => {
angleEnd = 360
}, %)
part001 = startSketchOn('XY')
part001 = startSketchOn(XY)
${startProfileAt2}
|> xLine(length = width * .5)
|> yLine(length = height)
@ -59,7 +59,7 @@ test.describe('Sketch tests', { tag: ['@skipWin'] }, () => {
|> hole(screwHole, %)
|> extrude(length = thickness)
part002 = startSketchOn('-XZ')
part002 = startSketchOn(-XZ)
${startProfileAt3}
|> xLine(length = width / 4)
|> tangentialArcTo([width / 2, 0], %)
@ -113,7 +113,7 @@ test.describe('Sketch tests', { tag: ['@skipWin'] }, () => {
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
|> startProfileAt([2.61, -4.01], %)
|> xLine(length = 8.73)
|> tangentialArcTo([8.33, -1.31], %)`
@ -159,7 +159,7 @@ test.describe('Sketch tests', { tag: ['@skipWin'] }, () => {
await page.mouse.click(700, 200)
await expect.poll(u.normalisedEditorCode, { timeout: 1000 })
.toBe(`sketch002 = startSketchOn('XZ')
.toBe(`sketch002 = startSketchOn(XZ)
sketch001 = startProfileAt([12.34, -12.34], sketch002)
|> yLine(length = 12.34)
@ -203,7 +203,7 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
|> startProfileAt([4.61, -14.01], %)
|> line(end = [12.73, -0.09])
|> tangentialArcTo([24.95, -5.38], %)
@ -253,7 +253,7 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
// If we have the code pane open, we should see the code.
if (openPanes.includes('code')) {
await expect(u.codeLocator).toHaveText(`sketch001 = startSketchOn('XZ')
await expect(u.codeLocator).toHaveText(`sketch001 = startSketchOn(XZ)
|> startProfileAt([4.61, -14.01], %)
|> line(end = [12.73, -0.09])
|> tangentialArcTo([24.95, -5.38], %)
@ -398,7 +398,7 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
// expect the code to have changed
await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XZ')
.toHaveText(`sketch001 = startSketchOn(XZ)
|> startProfileAt([6.44, -12.07], %)
|> line(end = [14.72, 1.97])
|> tangentialArcTo([26.92, -3.32], %)
@ -475,7 +475,7 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
|> circle(center = [4.61, -5.01], radius = 8)`
)
})
@ -552,7 +552,7 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
// expect the code to have changed
await editor.expectEditor.toContain(
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
|> circle(center = [7.26, -2.37], radius = 11.44)`,
{ shouldNormalise: true }
)
@ -565,7 +565,7 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
|> startProfileAt([4.61, -10.01], %)
|> line(end = [12.73, -0.09])
|> tangentialArcTo([24.95, -0.38], %)
@ -651,7 +651,7 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
// expect the code to have changed
await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XZ')
.toHaveText(`sketch001 = startSketchOn(XZ)
|> startProfileAt([7.12, -12.68], %)
|> line(end = [12.68, -1.09])
|> tangentialArcTo([24.89, 0.68], %)
@ -669,7 +669,7 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
|> startProfileAt([4.61, -14.01], %)
|> line(end = [12.73, -0.09])
|> tangentialArcTo([24.95, -5.38], %)
@ -755,7 +755,7 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
// expect the code to have changed
await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XZ')
.toHaveText(`sketch001 = startSketchOn(XZ)
|> startProfileAt([6.44, -12.07], %)
|> line(end = [14.72, 1.97])
|> tangentialArcTo([24.95, -5.38], %)
@ -789,7 +789,7 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
200
)
let codeStr = "sketch001 = startSketchOn('XY')"
let codeStr = 'sketch001 = startSketchOn(XY)'
await page.mouse.click(center.x, viewportSize.height * 0.55)
await expect(u.codeLocator).toHaveText(codeStr)
@ -828,7 +828,7 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
// so selecting the plane again is a bit easier.
await page.mouse.click(center.x + 200, center.y + 100)
await page.waitForTimeout(600) // TODO detect animation ending, or disable animation
codeStr += "sketch002 = startSketchOn('XY')"
codeStr += 'sketch002 = startSketchOn(XY)'
await expect(u.codeLocator).toHaveText(codeStr)
await u.closeDebugPanel()
@ -868,7 +868,7 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
await u.openDebugPanel()
const code = `sketch001 = startSketchOn('-XZ')
const code = `sketch001 = startSketchOn(-XZ)
profile001 = startProfileAt([${roundOff(scale * 69.6)}, ${roundOff(
scale * 34.8
)}], sketch001)
@ -898,7 +898,7 @@ profile001 = startProfileAt([${roundOff(scale * 69.6)}, ${roundOff(
await page.mouse.move(700, 200, { steps: 10 })
await page.mouse.click(700, 200, { delay: 200 })
await expect(page.locator('.cm-content')).toHaveText(
`sketch001 = startSketchOn('-XZ')`
`sketch001 = startSketchOn(-XZ)`
)
let prevContent = await page.locator('.cm-content').innerText()
@ -973,7 +973,7 @@ profile001 = startProfileAt([${roundOff(scale * 69.6)}, ${roundOff(
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
|> startProfileAt([-0.45, 0.87], %)
|> line(end = [1.32, 0.38])
|> line(end = [1.02, -1.32], tag = $seg01)
@ -1031,7 +1031,7 @@ profile001 = startProfileAt([${roundOff(scale * 69.6)}, ${roundOff(
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
|> startProfileAt([-0.45, 0.87], %)
|> line(end = [1.32, 0.38])
|> line(end = [1.02, -1.32], tag = $seg01)
@ -1074,7 +1074,7 @@ profile001 = startProfileAt([${roundOff(scale * 69.6)}, ${roundOff(
).toBeVisible()
await expect((await u.codeLocator.innerText()).replace(/\s/g, '')).toBe(
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
|> startProfileAt([-0.45, 0.87], %)
|> line(end = [1.32, 0.38])
|> line(end = [1.02, -1.32], tag = $seg01)
@ -1127,7 +1127,7 @@ profile001 = startProfileAt([${roundOff(scale * 69.6)}, ${roundOff(
await u.openAndClearDebugPanel()
await u.codeLocator.fill(`sketch001 = startSketchOn('XY')
await u.codeLocator.fill(`sketch001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %)
|> line(end = [20, 0])
|> line(end = [0, 20])
@ -1166,7 +1166,7 @@ profile001 = startProfileAt([${roundOff(scale * 69.6)}, ${roundOff(
await page.mouse.click(XYPlanePoint.x, XYPlanePoint.y)
await page.waitForTimeout(200)
await page.mouse.click(XYPlanePoint.x + 50, XYPlanePoint.y + 50)
await expect(u.codeLocator).toHaveText(`sketch001 = startSketchOn('XZ')
await expect(u.codeLocator).toHaveText(`sketch001 = startSketchOn(XZ)
|> startProfileAt([11.8, 9.09], %)
|> line(end = [3.39, -3.39])
`)
@ -1174,7 +1174,7 @@ profile001 = startProfileAt([${roundOff(scale * 69.6)}, ${roundOff(
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
|> startProfileAt([11.8, 9.09], %)
|> line(end = [3.39, -3.39])
`
@ -1214,7 +1214,7 @@ profile001 = startProfileAt([${roundOff(scale * 69.6)}, ${roundOff(
return lugSketch
}
lug([0, 0], 10, .5, "XY")`
lug([0, 0], 10, .5, XY)`
)
})
@ -1273,7 +1273,7 @@ profile001 = startProfileAt([${roundOff(scale * 69.6)}, ${roundOff(
const railBaseLength = in2mm(.200)
const railClampable = in2mm(.200)
const rail = startSketchOn('XZ')
const rail = startSketchOn(XZ)
|> startProfileAt([
-railTop / 2,
railClampable + railBaseLength
@ -1426,7 +1426,7 @@ test.describe(`Sketching with offset planes`, () => {
await context.addInitScript(() => {
localStorage.setItem(
'persistCode',
`offsetPlane001 = offsetPlane("XY", offset = 10)`
`offsetPlane001 = offsetPlane(XY, offset = 10)`
)
})
@ -1440,9 +1440,9 @@ test.describe(`Sketching with offset planes`, () => {
await test.step(`Hovering should highlight code`, async () => {
await planeHover()
await editor.expectState({
activeLines: [`offsetPlane001=offsetPlane("XY",offset=10)`],
activeLines: [`offsetPlane001=offsetPlane(XY,offset=10)`],
diagnostics: [],
highlightedCode: 'offsetPlane("XY", offset = 10)',
highlightedCode: 'offsetPlane(XY, offset = 10)',
})
})
@ -1453,7 +1453,7 @@ test.describe(`Sketching with offset planes`, () => {
await expect(toolbar.lineBtn).toBeEnabled()
await editor.expectEditor.toContain('startSketchOn(offsetPlane001)')
await editor.expectState({
activeLines: [`offsetPlane001=offsetPlane("XY",offset=10)`],
activeLines: [`offsetPlane001=offsetPlane(XY,offset=10)`],
diagnostics: [],
highlightedCode: '',
})
@ -1473,7 +1473,7 @@ test.describe('multi-profile sketching', () => {
localStorage.setItem(
'persistCode',
`yo = 5
sketch001 = startSketchOn('XZ')
sketch001 = startSketchOn(XZ)
profile001 = startProfileAt([121.52, 168.25], sketch001)
|> line(end = [115.04, 113.61])
|> line(end = [130.87, -97.79])
@ -1604,7 +1604,7 @@ profile002 = startProfileAt([117.2, 56.08], sketch001)
await context.addInitScript(() => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
profile002 = startProfileAt([40.68, 87.67], sketch001)
|> xLine(length = 239.17)
profile003 = startProfileAt([206.63, -56.73], sketch001)
@ -1683,7 +1683,7 @@ profile003 = startProfileAt([206.63, -56.73], sketch001)
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XY')
`sketch001 = startSketchOn(XY)
`
)
})
@ -1733,7 +1733,7 @@ profile003 = startProfileAt([206.63, -56.73], sketch001)
await selectXZPlane()
// timeout wait for engine animation is unavoidable
await page.waitForTimeout(600)
await editor.expectEditor.toContain(`sketch001 = startSketchOn('XZ')`)
await editor.expectEditor.toContain(`sketch001 = startSketchOn(XZ)`)
const [startProfile1] = scene.makeMouseHelpers(568, 70)
const [segment1Clk] = scene.makeMouseHelpers(701, 78)
@ -1751,7 +1751,7 @@ profile003 = startProfileAt([206.63, -56.73], sketch001)
})
await test.step('delete all profiles', async () => {
await editor.replaceCode('', "sketch001 = startSketchOn('XZ')\n")
await editor.replaceCode('', 'sketch001 = startSketchOn(XZ)\n')
await page.waitForTimeout(600) // wait for deferred execution
})
@ -1834,7 +1834,7 @@ profile003 = startProfileAt([206.63, -56.73], sketch001)
await selectXZPlane()
// timeout wait for engine animation is unavoidable
await page.waitForTimeout(600)
await editor.expectEditor.toContain(`sketch001 = startSketchOn('XZ')`)
await editor.expectEditor.toContain(`sketch001 = startSketchOn(XZ)`)
await test.step('Create a close profile stopping mid profile to equip the tangential arc, then three-point arc, and then back to the line tool', async () => {
await startProfile1()
await editor.expectEditor.toContain(
@ -2172,7 +2172,7 @@ profile003 = startProfileAt([206.63, -56.73], sketch001)
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
profile001 = startProfileAt([6.24, 4.54], sketch001)
|> line(end = [-0.41, 6.99])
|> line(end = [8.61, 0.74])
@ -2317,7 +2317,7 @@ profile004 = circleThreePoint(sketch001, p1 = [13.44, -6.8], p2 = [13.39, -2.07]
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
profile001 = startProfileAt([6.24, 4.54], sketch001)
|> line(end = [-0.41, 6.99])
|> line(end = [8.61, 0.74])
@ -2422,7 +2422,7 @@ profile003 = circle(sketch001, center = [6.92, -4.2], radius = 3.16)
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
profile001 = startProfileAt([-63.43, 193.08], sketch001)
|> line(end = [168.52, 149.87])
|> line(end = [190.29, -39.18])
@ -2504,16 +2504,16 @@ extrude001 = extrude(profile003, length = 5)
// timeout wait for engine animation is unavoidable
await page.waitForTimeout(600)
await editor.expectEditor.toContain(`sketch001 = startSketchOn('XZ')`)
await editor.expectEditor.toContain(`sketch001 = startSketchOn(XZ)`)
await toolbar.exitSketch()
await editor.expectEditor.not.toContain(`sketch001 = startSketchOn('XZ')`)
await editor.expectEditor.not.toContain(`sketch001 = startSketchOn(XZ)`)
await test.step("still renders code, hasn't got into a weird state", async () => {
await editor.replaceCode(
'myVar = 5',
`myVar = 5
sketch001 = startSketchOn('XZ')
sketch001 = startSketchOn(XZ)
profile001 = circle(
sketch001,
center = [12.41, 3.87],
@ -2533,13 +2533,13 @@ extrude001 = extrude(profile003, length = 5)
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
profile001 = startProfileAt([85.19, 338.59], sketch001)
|> line(end = [213.3, -94.52])
|> line(end = [-230.09, -55.34])
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
sketch002 = startSketchOn('XY')
sketch002 = startSketchOn(XY)
profile002 = startProfileAt([85.81, 52.55], sketch002)
`
@ -2575,7 +2575,7 @@ profile002 = startProfileAt([85.81, 52.55], sketch002)
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`thePart = startSketchOn('XZ')
`thePart = startSketchOn(XZ)
|> startProfileAt([7.53, 10.51], %)
|> line(end = [12.54, 1.83])
|> line(end = [6.65, -6.91])
@ -2606,14 +2606,14 @@ extrude001 = extrude(thePart, length = 75)
await test.step('expect code to match initial conditions still', async () => {
await editor.expectEditor.toContain(
`thePart = startSketchOn('XZ') |> startProfileAt([7.53, 10.51], %)`
`thePart = startSketchOn(XZ) |> startProfileAt([7.53, 10.51], %)`
)
})
await test.step('equiping the line tool should break up the pipe expression', async () => {
await toolbar.lineBtn.click()
await editor.expectEditor.toContain(
`sketch001 = startSketchOn('XZ')thePart = startProfileAt([7.53, 10.51], sketch001)`
`sketch001 = startSketchOn(XZ)thePart = startProfileAt([7.53, 10.51], sketch001)`
)
})
@ -2636,7 +2636,7 @@ extrude001 = extrude(thePart, length = 75)
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
profile001 = startProfileAt([6.71, -3.66], sketch001)
|> line(end = [2.65, 9.02], tag = $seg02)
|> line(end = [3.73, -9.36], tag = $seg01)
@ -2676,7 +2676,7 @@ revolve001 = revolve(
axis = getNextAdjacentEdge(seg01)
)
extrude002 = extrude(profile006, length = 4)
sketch003 = startSketchOn('-XZ')
sketch003 = startSketchOn(-XZ)
profile007 = startProfileAt([4.8, 7.55], sketch003)
|> line(end = [7.39, 2.58])
|> line(end = [7.02, -2.85])
@ -2809,13 +2809,13 @@ extrude003 = extrude(profile011, length = 2.5)
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
profile001 = startProfileAt([34, 42.66], sketch001)
|> line(end = [102.65, 151.99])
|> line(end = [76, -138.66])
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
plane001 = offsetPlane('XZ', offset = 50)
plane001 = offsetPlane(XZ, offset = 50)
sketch002 = startSketchOn(plane001)
profile002 = startProfileAt([39.43, 172.21], sketch002)
|> xLine(length = 183.99)
@ -2867,13 +2867,13 @@ loft([profile001, profile002])
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
profile001 = startProfileAt([34, 42.66], sketch001)
|> line(end = [102.65, 151.99])
|> line(end = [76, -138.66])
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
plane001 = offsetPlane('XZ', offset = 50)
plane001 = offsetPlane(XZ, offset = 50)
sketch002 = startSketchOn(plane001)
profile002 = startProfileAt([39.43, 172.21], sketch002)
|> xLine(length = 183.99)
@ -2943,7 +2943,7 @@ test.describe(`Click based selection don't brick the app when clicked out of ran
await context.addInitScript(() => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> line(end = [3.14, 3.14])
|> arcTo({
@ -2981,7 +2981,7 @@ test.describe(`Click based selection don't brick the app when clicked out of ran
// Check that the code is highlighted
await editor.expectState({
activeLines: ["sketch001=startSketchOn('XZ')"],
activeLines: ['sketch001=startSketchOn(XZ)'],
diagnostics: [],
highlightedCode: 'arcTo({end = [4, 2], interior = [1, 2]}, %)',
})
@ -2992,7 +2992,7 @@ test.describe(`Click based selection don't brick the app when clicked out of ran
await page.mouse.move(655, 337)
await editor.expectState({
activeLines: ["sketch001=startSketchOn('XZ')"],
activeLines: ['sketch001=startSketchOn(XZ)'],
diagnostics: [],
highlightedCode: '',
})
@ -3025,7 +3025,7 @@ test.describe('Redirecting to home page and back to the original file should cle
await context.addInitScript(() => {
localStorage.setItem(
'persistCode',
` sketch001 = startSketchOn('XZ')
` sketch001 = startSketchOn(XZ)
|> startProfileAt([256.85, 14.41], %)
|> line(endAbsolute = [0, 211.07])
`

View File

@ -65,7 +65,7 @@ baseHeight = 1
totalHeightHalf = 2
armThick = 0.5
totalLen = 9.5
part001 = startSketchOn('-XZ')
part001 = startSketchOn(-XZ)
|> startProfileAt([0, 0], %)
|> yLine(length = baseHeight)
|> xLine(length = baseLen)
@ -322,7 +322,7 @@ const extrudeDefaultPlane = async (
scene: SceneFixture,
plane: string
) => {
const code = `part001 = startSketchOn('${plane}')
const code = `part001 = startSketchOn(${plane})
|> startProfileAt([7.00, 4.40], %)
|> line(end = [6.60, -0.20])
|> line(end = [2.80, 5.00])
@ -446,7 +446,7 @@ test(
// select a plane
await page.mouse.click(700, 200)
let code = `sketch001 = startSketchOn('XZ')`
let code = `sketch001 = startSketchOn(XZ)`
await expect(page.locator('.cm-content')).toHaveText(code)
await page.waitForTimeout(700) // TODO detect animation ending, or disable animation
@ -560,7 +560,7 @@ test(
await page.mouse.click(700, 200)
await expect(page.locator('.cm-content')).toHaveText(
`sketch001 = startSketchOn('XZ')`
`sketch001 = startSketchOn(XZ)`
)
// Wait for camera animation
@ -606,7 +606,7 @@ test(
await page.mouse.click(700, 200)
await expect(page.locator('.cm-content')).toHaveText(
`sketch001 = startSketchOn('XZ')`
`sketch001 = startSketchOn(XZ)`
)
// Wait for camera animation
@ -628,7 +628,7 @@ test(
mask: [page.getByTestId('model-state-indicator')],
})
await expect(page.locator('.cm-content')).toHaveText(
`sketch001 = startSketchOn('XZ')profile001 = circle(sketch001, center = [14.44, -2.44], radius = 1)`
`sketch001 = startSketchOn(XZ)profile001 = circle(sketch001, center = [14.44, -2.44], radius = 1)`
)
}
)
@ -657,7 +657,7 @@ test.describe(
// select a plane
await page.mouse.click(700, 200)
let code = `sketch001 = startSketchOn('XZ')`
let code = `sketch001 = startSketchOn(XZ)`
await expect(page.locator('.cm-content')).toHaveText(code)
// Wait for camera animation
@ -752,7 +752,7 @@ test.describe(
// select a plane
await page.mouse.click(700, 200)
let code = `sketch001 = startSketchOn('XZ')`
let code = `sketch001 = startSketchOn(XZ)`
await expect(u.codeLocator).toHaveText(code)
// Wait for camera animation
@ -823,7 +823,7 @@ test(
await context.addInitScript(async (KCL_DEFAULT_LENGTH) => {
localStorage.setItem(
'persistCode',
`part001 = startSketchOn('-XZ')
`part001 = startSketchOn(-XZ)
|> startProfileAt([1.4, 2.47], %)
|> line(end = [9.31, 10.55], tag = $seg01)
|> line(end = [11.91, -10.42])
@ -885,7 +885,7 @@ test(
await context.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`part001 = startSketchOn('XY')
`part001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %)
|> line(end = [20, 0])
|> line(end = [0, 20])
@ -925,7 +925,7 @@ test(
await context.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`part001 = startSketchOn('XY')
`part001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %)
|> line(end = [20, 0])
|> line(end = [0, 20])
@ -1104,7 +1104,7 @@ test('theme persists', async ({ page, context }) => {
await context.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`part001 = startSketchOn('XY')
`part001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %)
|> line(end = [20, 0])
|> line(end = [0, 20])
@ -1174,7 +1174,7 @@ test.describe('code color goober', { tag: '@snapshot' }, () => {
`// Create a pipe using a sweep.
// Create a path for the sweep.
sweepPath = startSketchOn('XZ')
sweepPath = startSketchOn(XZ)
|> startProfileAt([0.05, 0.05], %)
|> line(end = [0, 7])
|> tangentialArc({ offset = 90, radius = 5 }, %)
@ -1182,7 +1182,7 @@ sweepPath = startSketchOn('XZ')
|> tangentialArc({ offset = -90, radius = 5 }, %)
|> line(end = [0, 7])
sweepSketch = startSketchOn('XY')
sweepSketch = startSketchOn(XY)
|> startProfileAt([2, 0], %)
|> arc({
angleEnd = 360,
@ -1224,7 +1224,7 @@ sweepSketch = startSketchOn('XY')
`// Create a pipe using a sweep.
// Create a path for the sweep.
sweepPath = startSketchOn('XZ')
sweepPath = startSketchOn(XZ)
|> startProfileAt([0.05, 0.05], %)
|> line(end = [0, 7])
|> tangentialArc({ offset = 90, radius = 5 }, %)
@ -1232,7 +1232,7 @@ sweepPath = startSketchOn('XZ')
|> tangentialArc({ offset = -90, radius = 5 }, %)
|> line(end = [0, 7])
sweepSketch = startSketchOn('XY')
sweepSketch = startSketchOn(XY)
|> startProfileAt([2, 0], %)
|> arc({
angleEnd = 360,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 143 KiB

After

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 69 KiB

View File

@ -1,5 +1,5 @@
{
"original_source_code": "sketch001 = startSketchOn('XZ')\nprofile001 = startProfileAt([57.81, 250.51], sketch001)\n |> line(end = [121.13, 56.63], tag = $seg02)\n |> line(end = [83.37, -34.61], tag = $seg01)\n |> line(end = [19.66, -116.4])\n |> line(end = [-221.8, -41.69])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\nextrude001 = extrude(profile001, length = 200)\nsketch002 = startSketchOn('XZ')\n |> startProfileAt([-73.64, -42.89], %)\n |> xLine(length = 173.71)\n |> line(end = [-22.12, -94.4])\n |> xLine(length = -156.98)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\nextrude002 = extrude(sketch002, length = 50)\nsketch003 = startSketchOn('XY')\n |> startProfileAt([52.92, 157.81], %)\n |> angledLine([0, 176.4], %, $rectangleSegmentA001)\n |> angledLine([\n segAng(rectangleSegmentA001) - 90,\n 53.4\n ], %, $rectangleSegmentB001)\n |> angledLine([\n segAng(rectangleSegmentA001),\n -segLen(rectangleSegmentA001)\n ], %, $rectangleSegmentC001)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\nextrude003 = extrude(sketch003, length = 20)\n",
"original_source_code": "sketch001 = startSketchOn(XZ)\nprofile001 = startProfileAt([57.81, 250.51], sketch001)\n |> line(end = [121.13, 56.63], tag = $seg02)\n |> line(end = [83.37, -34.61], tag = $seg01)\n |> line(end = [19.66, -116.4])\n |> line(end = [-221.8, -41.69])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\nextrude001 = extrude(profile001, length = 200)\nsketch002 = startSketchOn(XZ)\n |> startProfileAt([-73.64, -42.89], %)\n |> xLine(length = 173.71)\n |> line(end = [-22.12, -94.4])\n |> xLine(length = -156.98)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\nextrude002 = extrude(sketch002, length = 50)\nsketch003 = startSketchOn(XY)\n |> startProfileAt([52.92, 157.81], %)\n |> angledLine([0, 176.4], %, $rectangleSegmentA001)\n |> angledLine([\n segAng(rectangleSegmentA001) - 90,\n 53.4\n ], %, $rectangleSegmentB001)\n |> angledLine([\n segAng(rectangleSegmentA001),\n -segLen(rectangleSegmentA001)\n ], %, $rectangleSegmentC001)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\nextrude003 = extrude(sketch003, length = 20)\n",
"prompt": "make this neon green please, use #39FF14",
"source_ranges": [
{

View File

@ -77,7 +77,7 @@ export const TEST_SETTINGS_CORRUPTED = {
},
} satisfies Partial<SaveSettingsPayload>
export const TEST_CODE_GIZMO = `part001 = startSketchOn('XZ')
export const TEST_CODE_GIZMO = `part001 = startSketchOn(XZ)
|> startProfileAt([20, 0], %)
|> line(end = [7.13, 4 + 0])
|> angledLine({ angle: 3 + 0, length: 3.14 + 0 }, %)
@ -128,7 +128,7 @@ keychain2 = startSketchOn("XY")
|> close()
|> extrude(length = thickness)
box = startSketchOn('XY')
box = startSketchOn(XY)
|> startProfileAt([0, 0], %)
|> line(end = [0, 10])
|> line(end = [10, 0])
@ -147,7 +147,7 @@ sketch001 = startSketchOn(box, revolveAxis)
angle = 90
)
sketch001 = startSketchOn('XZ')
sketch001 = startSketchOn(XZ)
|> startProfileAt([0.0, 0.0], %)
|> xLine(length = 0.0)
|> close()

View File

@ -105,7 +105,7 @@ test.describe('Test network and connection issues', () => {
await page.mouse.click(700, 200)
await expect(page.locator('.cm-content')).toHaveText(
`sketch001 = startSketchOn('XZ')`
`sketch001 = startSketchOn(XZ)`
)
await u.closeDebugPanel()
@ -114,7 +114,7 @@ test.describe('Test network and connection issues', () => {
const startXPx = 600
await page.mouse.click(startXPx + PUR * 10, 500 - PUR * 10)
await expect(page.locator('.cm-content')).toHaveText(
`sketch001 = startSketchOn('XZ')profile001 = startProfileAt(${commonPoints.startAt}, sketch001)`
`sketch001 = startSketchOn(XZ)profile001 = startProfileAt(${commonPoints.startAt}, sketch001)`
)
await page.waitForTimeout(100)
@ -122,7 +122,7 @@ test.describe('Test network and connection issues', () => {
await page.waitForTimeout(100)
await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XZ')profile001 = startProfileAt(${commonPoints.startAt}, sketch001)
.toHaveText(`sketch001 = startSketchOn(XZ)profile001 = startProfileAt(${commonPoints.startAt}, sketch001)
|> xLine(length = ${commonPoints.num1})`)
// Expect the network to be up
@ -211,7 +211,7 @@ test.describe('Test network and connection issues', () => {
// Ensure we can continue sketching
await page.mouse.click(startXPx + PUR * 20, 500 - PUR * 20)
await expect.poll(u.normalisedEditorCode)
.toBe(`sketch001 = startSketchOn('XZ')
.toBe(`sketch001 = startSketchOn(XZ)
profile001 = startProfileAt([12.34, -12.34], sketch001)
|> xLine(length = 12.34)
|> line(end = [-12.34, 12.34])
@ -221,7 +221,7 @@ profile001 = startProfileAt([12.34, -12.34], sketch001)
await page.mouse.click(startXPx, 500 - PUR * 20)
await expect.poll(u.normalisedEditorCode)
.toBe(`sketch001 = startSketchOn('XZ')
.toBe(`sketch001 = startSketchOn(XZ)
profile001 = startProfileAt([12.34, -12.34], sketch001)
|> xLine(length = 12.34)
|> line(end = [-12.34, 12.34])

View File

@ -15,7 +15,7 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XY')
`sketch001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %)
|> line(end = [20, 0])
|> line(end = [0, 20])
@ -58,7 +58,7 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
.click()
await expect(page.locator('.cm-content')).toHaveText(
`length001 = 20sketch001 = startSketchOn('XY') |> startProfileAt([-10, -10], %) |> line(end = [20, 0]) |> angledLine([90, length001], %) |> xLine(length = -20)`
`length001 = 20sketch001 = startSketchOn(XY) |> startProfileAt([-10, -10], %) |> line(end = [20, 0]) |> angledLine([90, length001], %) |> xLine(length = -20)`
)
// Make sure we didn't pop out of sketch mode.
@ -82,13 +82,13 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
localStorage.setItem(
'persistCode',
`yo = 79
part001 = startSketchOn('XZ')
part001 = startSketchOn(XZ)
|> startProfileAt([-7.54, -26.74], %)
|> line(end = [74.36, 130.4], tag = $seg01)
|> line(end = [78.92, -120.11])
|> angledLine([segAng(seg01), yo], %)
|> line(end = [41.19, 58.97 + 5])
part002 = startSketchOn('XZ')
part002 = startSketchOn(XZ)
|> startProfileAt([299.05, 120], %)
|> xLine(length = -385.34, tag = $seg_what)
|> yLine(length = -170.06)
@ -146,13 +146,13 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
localStorage.setItem(
'persistCode',
`yo = 5
part001 = startSketchOn('XZ')
part001 = startSketchOn(XZ)
|> startProfileAt([-7.54, -26.74], %)
|> line(end = [74.36, 130.4], tag = $seg01)
|> line(end = [78.92, -120.11])
|> angledLine([segAng(seg01), 78.33], %)
|> line(end = [51.19, 48.97])
part002 = startSketchOn('XZ')
part002 = startSketchOn(XZ)
|> startProfileAt([299.05, 231.45], %)
|> xLine(length = -425.34, tag = $seg_what)
|> yLine(length = -264.06)
@ -278,13 +278,13 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
localStorage.setItem(
'persistCode',
`yo = 5
part001 = startSketchOn('XZ')
part001 = startSketchOn(XZ)
|> startProfileAt([-7.54, -26.74], %)
|> line(end = [74.36, 130.4])
|> line(end = [78.92, -120.11])
|> line(end = [9.16, 77.79])
|> line(end = [51.19, 48.97])
part002 = startSketchOn('XZ')
part002 = startSketchOn(XZ)
|> startProfileAt([299.05, 231.45], %)
|> xLine(length = -425.34, tag = $seg_what)
|> yLine(length = -264.06)
@ -388,13 +388,13 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
localStorage.setItem(
'persistCode',
`yo = 5
part001 = startSketchOn('XZ')
part001 = startSketchOn(XZ)
|> startProfileAt([-7.54, -26.74], %)
|> line(end = [74.36, 130.4])
|> line(end = [78.92, -120.11])
|> line(end = [9.16, 77.79])
|> line(end = [51.19, 48.97])
part002 = startSketchOn('XZ')
part002 = startSketchOn(XZ)
|> startProfileAt([299.05, 231.45], %)
|> xLine(length = -425.34, tag = $seg_what)
|> yLine(length = -264.06)
@ -501,13 +501,13 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
localStorage.setItem(
'persistCode',
`yo = 5
part001 = startSketchOn('XZ')
part001 = startSketchOn(XZ)
|> startProfileAt([-7.54, -26.74], %)
|> line(end = [74.36, 130.4])
|> line(end = [78.92, -120.11])
|> line(end = [9.16, 77.79])
|> line(end = [51.19, 48.97])
part002 = startSketchOn('XZ')
part002 = startSketchOn(XZ)
|> startProfileAt([299.05, 231.45], %)
|> xLine(length = -425.34, tag = $seg_what)
|> yLine(length = -264.06)
@ -603,13 +603,13 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
localStorage.setItem(
'persistCode',
`yo = 5
part001 = startSketchOn('XZ')
part001 = startSketchOn(XZ)
|> startProfileAt([-7.54, -26.74], %)
|> line(end = [74.36, 130.4])
|> line(end = [78.92, -120.11])
|> line(end = [9.16, 77.79])
|> line(end = [51.19, 48.97])
part002 = startSketchOn('XZ')
part002 = startSketchOn(XZ)
|> startProfileAt([299.05, 231.45], %)
|> xLine(length = -425.34, tag = $seg_what)
|> yLine(length = -264.06)
@ -689,13 +689,13 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
localStorage.setItem(
'persistCode',
`yo = 5
part001 = startSketchOn('XZ')
part001 = startSketchOn(XZ)
|> startProfileAt([-7.54, -26.74], %)
|> line(end = [74.36, 130.4])
|> line(end = [78.92, -120.11])
|> line(end = [9.16, 77.79])
|> line(end = [51.19, 48.97])
part002 = startSketchOn('XZ')
part002 = startSketchOn(XZ)
|> startProfileAt([299.05, 231.45], %)
|> xLine(length = -425.34, tag = $seg_what)
|> yLine(length = -264.06)
@ -769,13 +769,13 @@ part002 = startSketchOn('XZ')
localStorage.setItem(
'persistCode',
`yo = 5
part001 = startSketchOn('XZ')
part001 = startSketchOn(XZ)
|> startProfileAt([-7.54, -26.74], %)
|> line(end = [74.36, 130.4])
|> line(end = [78.92, -120.11])
|> line(end = [9.16, 77.79])
|> line(end = [51.19, 48.97])
part002 = startSketchOn('XZ')
part002 = startSketchOn(XZ)
|> startProfileAt([299.05, 231.45], %)
|> xLine(length = -425.34, tag = $seg_what)
|> yLine(length = -264.06)
@ -870,12 +870,12 @@ part002 = startSketchOn('XZ')
localStorage.setItem(
'persistCode',
`yo = 5
part001 = startSketchOn('XZ')
part001 = startSketchOn(XZ)
|> startProfileAt([-7.54, -26.74], %)
|> line(end = [74.36, 130.4])
|> line(end = [78.92, -120.11])
|> line(end = [9.16, 77.79])
part002 = startSketchOn('XZ')
part002 = startSketchOn(XZ)
|> startProfileAt([299.05, 231.45], %)
|> xLine(length = -425.34, tag = $seg_what)
|> yLine(length = -264.06)
@ -951,12 +951,12 @@ part002 = startSketchOn('XZ')
localStorage.setItem(
'persistCode',
`yo = 5
part001 = startSketchOn('XZ')
part001 = startSketchOn(XZ)
|> startProfileAt([-7.54, -26.74], %)
|> line(end = [74.36, 130.4])
|> line(end = [78.92, -120.11])
|> line(end = [9.16, 77.79])
part002 = startSketchOn('XZ')
part002 = startSketchOn(XZ)
|> startProfileAt([299.05, 231.45], %)
|> xLine(length = -425.34, tag = $seg_what)
|> yLine(length = -264.06)
@ -1015,7 +1015,7 @@ part002 = startSketchOn('XZ')
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XY')
`sketch001 = startSketchOn(XY)
|> startProfileAt([-1.05, -1.07], %)
|> line(end = [3.79, 2.68], tag = $seg01)
|> line(end = [3.13, -2.4])`

View File

@ -256,7 +256,7 @@ test.describe(`Testing gizmo, fixture-based`, () => {
localStorage.setItem(
'persistCode',
`
const sketch002 = startSketchOn('XZ')
const sketch002 = startSketchOn(XZ)
|> startProfileAt([-108.83, -57.48], %)
|> angledLine([0, 105.13], %, $rectangleSegmentA001)
|> angledLine([
@ -268,7 +268,7 @@ test.describe(`Testing gizmo, fixture-based`, () => {
-segLen(rectangleSegmentA001)
], %)
|> close()
const sketch001 = startSketchOn('XZ')
const sketch001 = startSketchOn(XZ)
|> circle(center = [818.33, 168.1], radius = 182.8)
|> extrude(length = 50)
`

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