Update from main

This commit is contained in:
Pierre Jacquier
2025-03-24 10:05:08 -04:00
585 changed files with 90810 additions and 30563 deletions

View File

@ -1,7 +1,9 @@
name: E2E Tests name: E2E Tests
on: on:
push: push:
branches: [ main ] branches:
- main
- all-e2e # this bypasses `fixme()` using `orRunWhenFullSuiteEnabled()`
pull_request: pull_request:
schedule: schedule:
- cron: 0 * * * * # hourly - cron: 0 * * * * # hourly
@ -15,7 +17,6 @@ permissions:
pull-requests: write pull-requests: write
actions: read actions: read
jobs: jobs:
conditions: conditions:
@ -67,14 +68,16 @@ jobs:
- name: Display conditions - name: Display conditions
shell: bash shell: bash
run: | run: |
# For debugging purposes. # For debugging purposes
set -euo pipefail set -euo pipefail
echo "GITHUB_REF: $GITHUB_REF"
echo "GITHUB_HEAD_REF: $GITHUB_HEAD_REF"
echo "GITHUB_BASE_REF: $GITHUB_BASE_REF"
echo "significant: ${{ steps.path-changes.outputs.significant }}" echo "significant: ${{ steps.path-changes.outputs.significant }}"
echo "should-run: ${{ steps.should-run.outputs.should-run }}" echo "should-run: ${{ steps.should-run.outputs.should-run }}"
prepare-wasm: prepare-wasm:
# seperate job on Ubuntu to build or fetch the wasm blob once on the fastest runner # separate job on Ubuntu to build or fetch the wasm blob once on the fastest runner
runs-on: runs-on=${{ github.run_id }}/family=i7ie.2xlarge/image=ubuntu22-full-x64 runs-on: runs-on=${{ github.run_id }}/family=i7ie.2xlarge/image=ubuntu22-full-x64
needs: conditions needs: conditions
steps: steps:
@ -160,7 +163,6 @@ jobs:
path: | path: |
rust/kcl-wasm-lib/pkg/kcl_wasm_lib* rust/kcl-wasm-lib/pkg/kcl_wasm_lib*
snapshots: snapshots:
name: playwright:snapshots:ubuntu name: playwright:snapshots:ubuntu
runs-on: runs-on=${{ github.run_id }}/family=i7ie.2xlarge/image=ubuntu22-full-x64 runs-on: runs-on=${{ github.run_id }}/family=i7ie.2xlarge/image=ubuntu22-full-x64
@ -243,7 +245,7 @@ jobs:
retention-days: 30 retention-days: 30
overwrite: true overwrite: true
- name: check for changes - name: Check for changes
if: ${{ needs.conditions.outputs.should-run == 'true' && github.ref != 'refs/heads/main' }} if: ${{ needs.conditions.outputs.should-run == 'true' && github.ref != 'refs/heads/main' }}
shell: bash shell: bash
id: git-check id: git-check

View File

@ -1,5 +1,8 @@
name: update-dev-branch name: update-dev-branch
# This is used to sync the `dev` branch with the `main` branch to continuously
# deploy a second instance of the app to Vercel: https://app.dev.zoo.dev
on: on:
push: push:
branches: branches:
@ -26,4 +29,4 @@ jobs:
# reset to main # reset to main
git reset --hard origin/main git reset --hard origin/main
# force push it # force push it
git push -f origin dev git push --force origin dev

29
.github/workflows/update-e2e-branch.yml vendored Normal file
View File

@ -0,0 +1,29 @@
name: update-e2e-branch
# This is used to sync the `all-e2e` branch with the `main` branch for the
# logic in the test utility `orRunWhenFullSuiteEnabled()` that allows all e2e
# tests to run on a particular branch to analyze failures metrics in Axiom.
on:
schedule:
- cron: '0 * * * *' # runs every hour
permissions:
contents: write
jobs:
update-branch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- shell: bash
run: |
# checkout our branch
git checkout all-e2e || git checkout -b all-e2e
# fetch origin
git fetch origin
# reset to main
git reset --hard origin/main
# force push it
git push --force origin all-e2e

View File

@ -53,6 +53,7 @@ format: install ## Format the code
.PHONY: lint .PHONY: lint
lint: install ## Lint the code lint: install ## Lint the code
yarn tsc
yarn lint yarn lint
############################################################################### ###############################################################################

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

File diff suppressed because one or more lines are too long

View File

@ -10,10 +10,10 @@ Construct a circle derived from 3 points.
```js ```js
circleThreePoint( circleThreePoint(
sketchSurfaceOrGroup: SketchOrSurface,
p1: [number], p1: [number],
p2: [number], p2: [number],
p3: [number], p3: [number],
sketchSurfaceOrGroup: SketchOrSurface,
tag?: TagDeclarator, tag?: TagDeclarator,
): Sketch ): Sketch
``` ```
@ -23,10 +23,10 @@ circleThreePoint(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `sketchSurfaceOrGroup` | [`SketchOrSurface`](/docs/kcl/types/SketchOrSurface) | Plane or surface to sketch on. | Yes |
| `p1` | [`[number]`](/docs/kcl/types/number) | 1st point to derive the circle. | Yes | | `p1` | [`[number]`](/docs/kcl/types/number) | 1st point to derive the circle. | Yes |
| `p2` | [`[number]`](/docs/kcl/types/number) | 2nd point to derive the circle. | Yes | | `p2` | [`[number]`](/docs/kcl/types/number) | 2nd point to derive the circle. | Yes |
| `p3` | [`[number]`](/docs/kcl/types/number) | 3rd point to derive the circle. | Yes | | `p3` | [`[number]`](/docs/kcl/types/number) | 3rd point to derive the circle. | Yes |
| `sketchSurfaceOrGroup` | [`SketchOrSurface`](/docs/kcl/types/SketchOrSurface) | Plane or surface to sketch on. | Yes |
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Identifier for the circle to reference elsewhere. | No | | [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Identifier for the circle to reference elsewhere. | No |
### Returns ### Returns
@ -37,7 +37,7 @@ circleThreePoint(
### Examples ### Examples
```js ```js
exampleSketch = startSketchOn("XY") exampleSketch = startSketchOn(XY)
|> circleThreePoint(p1 = [10, 10], p2 = [20, 8], p3 = [15, 5]) |> circleThreePoint(p1 = [10, 10], p2 = [20, 8], p3 = [15, 5])
|> extrude(length = 5) |> extrude(length = 5)
``` ```

View File

@ -15,7 +15,7 @@ std::math::E: number = 2.71828182845904523536028747135266250_
### Examples ### Examples
```js ```js
exampleSketch = startSketchOn("XZ") exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ |> angledLine({
angle = 30, angle = 30,

View File

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

View File

@ -15,7 +15,7 @@ std::math::TAU: number = 6.28318530717958647692528676655900577_
### Examples ### Examples
```js ```js
exampleSketch = startSketchOn("XZ") exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ |> angledLine({
angle = 50, angle = 50,

View File

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

File diff suppressed because one or more lines are too long

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

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

View File

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

View File

@ -61,7 +61,6 @@ layout: manual
* [`bezierCurve`](kcl/bezierCurve) * [`bezierCurve`](kcl/bezierCurve)
* [`ceil`](kcl/ceil) * [`ceil`](kcl/ceil)
* [`chamfer`](kcl/chamfer) * [`chamfer`](kcl/chamfer)
* [`circle`](kcl/circle)
* [`circleThreePoint`](kcl/circleThreePoint) * [`circleThreePoint`](kcl/circleThreePoint)
* [`close`](kcl/close) * [`close`](kcl/close)
* [`cm`](kcl/cm) * [`cm`](kcl/cm)
@ -74,7 +73,6 @@ layout: manual
* [`getOppositeEdge`](kcl/getOppositeEdge) * [`getOppositeEdge`](kcl/getOppositeEdge)
* [`getPreviousAdjacentEdge`](kcl/getPreviousAdjacentEdge) * [`getPreviousAdjacentEdge`](kcl/getPreviousAdjacentEdge)
* [`helix`](kcl/helix) * [`helix`](kcl/helix)
* [`helixRevolutions`](kcl/helixRevolutions)
* [`hole`](kcl/hole) * [`hole`](kcl/hole)
* [`hollow`](kcl/hollow) * [`hollow`](kcl/hollow)
* [`inch`](kcl/inch) * [`inch`](kcl/inch)
@ -146,3 +144,5 @@ layout: manual
* [`cos`](kcl/std-math-cos) * [`cos`](kcl/std-math-cos)
* [`sin`](kcl/std-math-sin) * [`sin`](kcl/std-math-sin)
* [`tan`](kcl/std-math-tan) * [`tan`](kcl/std-math-tan)
* **std::sketch**
* [`circle`](kcl/std-sketch-circle)

View File

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

View File

@ -30,7 +30,7 @@ intersect(solids: [Solid]): [Solid]
```js ```js
fn cube(center) { fn cube(center) {
return startSketchOn('XY') return startSketchOn(XY)
|> startProfileAt([center[0] - 10, center[1] - 10], %) |> startProfileAt([center[0] - 10, center[1] - 10], %)
|> line(endAbsolute = [center[0] + 10, center[1] - 10]) |> line(endAbsolute = [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 ### Examples
```js ```js
exampleSketch = startSketchOn("XZ") exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line(end = [5, 0]) |> line(end = [5, 0])
|> line(end = [20, 5]) |> line(end = [20, 5])

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -9,7 +9,7 @@ Compute the cosine of a number (in radians).
```js ```js
cos(num: number(rad)): number(_) cos(@num: number(rad)): number(_)
``` ```
@ -27,7 +27,7 @@ cos(num: number(rad)): number(_)
### Examples ### Examples
```js ```js
exampleSketch = startSketchOn("XZ") exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ |> angledLine({
angle = 30, angle = 30,

View File

@ -9,7 +9,7 @@ Compute the sine of a number (in radians).
```js ```js
sin(num: number(rad)): number(_) sin(@num: number(rad)): number(_)
``` ```
@ -27,7 +27,7 @@ sin(num: number(rad)): number(_)
### Examples ### Examples
```js ```js
exampleSketch = startSketchOn("XZ") exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ |> angledLine({
angle = 50, angle = 50,

View File

@ -9,7 +9,7 @@ Compute the tangent of a number (in radians).
```js ```js
tan(num: number(rad)): number(_) tan(@num: number(rad)): number(_)
``` ```
@ -27,7 +27,7 @@ tan(num: number(rad)): number(_)
### Examples ### Examples
```js ```js
exampleSketch = startSketchOn("XZ") exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ |> angledLine({
angle = 50, angle = 50,

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

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

View File

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

View File

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

View File

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

View File

@ -21,6 +21,7 @@ A helix.
| `revolutions` |[`number`](/docs/kcl/types/number)| Number of revolutions. | No | | `revolutions` |[`number`](/docs/kcl/types/number)| Number of revolutions. | No |
| `angleStart` |[`number`](/docs/kcl/types/number)| Start angle (in degrees). | No | | `angleStart` |[`number`](/docs/kcl/types/number)| Start angle (in degrees). | No |
| `ccw` |`boolean`| Is the helix rotation counter clockwise? | No | | `ccw` |`boolean`| Is the helix rotation counter clockwise? | No |
| `cylinderId` |[`string`](/docs/kcl/types/string)| The cylinder the helix was created on. | No |
| `units` |[`UnitLen`](/docs/kcl/types/UnitLen)| A unit of length. | No | | `units` |[`UnitLen`](/docs/kcl/types/UnitLen)| A unit of length. | No |

View File

@ -10,8 +10,8 @@ A point in two dimensional space.
type Point2d = [number; 2] type Point2d = [number; 2]
``` ```
`Point2d` is an alias for a two-element array of [number](/docs/kcl/types/number)s. To write a value [`Point2d`](/docs/kcl/types/Point2d) is an alias for a two-element array of [number](/docs/kcl/types/number)s. To write a value
with type `Point2d`, use an array, e.g., `[0, 0]` or `[5.0, 3.14]`. with type [`Point2d`](/docs/kcl/types/Point2d), use an array, e.g., `[0, 0]` or `[5.0, 3.14]`.

View File

@ -10,8 +10,8 @@ A point in three dimensional space.
type Point3d = [number; 3] type Point3d = [number; 3]
``` ```
`Point3d` is an alias for a three-element array of [number](/docs/kcl/types/number)s. To write a value [`Point3d`](/docs/kcl/types/Point3d) is an alias for a three-element array of [number](/docs/kcl/types/number)s. To write a value
with type `Point3d`, use an array, e.g., `[0, 0, 0]` or `[5.0, 3.14, 6.8]`. with type [`Point3d`](/docs/kcl/types/Point3d), use an array, e.g., `[0, 0, 0]` or `[5.0, 3.14, 6.8]`.

View File

@ -17,7 +17,7 @@ mySketch = startSketchOn('XY')
|> close() |> close()
``` ```
The `mySketch` variable will be an executed `Sketch` object. Executed being past The `mySketch` variable will be an executed [`Sketch`](/docs/kcl/types/Sketch) object. Executed being past
tense, because the engine has already executed the commands to create the sketch. tense, because the engine has already executed the commands to create the sketch.
The previous sketch commands will never be executed again, in this case. The previous sketch commands will never be executed again, in this case.

View File

@ -18,7 +18,7 @@ myPart = startSketchOn('XY')
|> extrude(length = 6) |> extrude(length = 6)
``` ```
The `myPart` variable will be an executed `Solid` object. Executed being past The `myPart` variable will be an executed [`Solid`](/docs/kcl/types/Solid) object. Executed being past
tense, because the engine has already executed the commands to create the solid. tense, because the engine has already executed the commands to create the solid.
The previous solid commands will never be executed again, in this case. The previous solid commands will never be executed again, in this case.

View File

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

View File

@ -5,6 +5,7 @@ import {
TEST_COLORS, TEST_COLORS,
commonPoints, commonPoints,
PERSIST_MODELING_CONTEXT, PERSIST_MODELING_CONTEXT,
orRunWhenFullSuiteEnabled,
} from './test-utils' } from './test-utils'
import { HomePageFixture } from './fixtures/homePageFixture' import { HomePageFixture } from './fixtures/homePageFixture'
@ -46,7 +47,7 @@ async function doBasicSketch(
await page.mouse.click(700, 200) await page.mouse.click(700, 200)
if (openPanes.includes('code')) { if (openPanes.includes('code')) {
await expect(u.codeLocator).toHaveText(`sketch001 = startSketchOn('XZ')`) await expect(u.codeLocator).toHaveText(`sketch001 = startSketchOn(XZ)`)
} }
await u.closeDebugPanel() await u.closeDebugPanel()
@ -56,7 +57,7 @@ async function doBasicSketch(
await page.mouse.click(startXPx + PUR * 10, 500 - PUR * 10) await page.mouse.click(startXPx + PUR * 10, 500 - PUR * 10)
if (openPanes.includes('code')) { if (openPanes.includes('code')) {
await expect(u.codeLocator).toContainText( 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) await page.waitForTimeout(500)
@ -65,14 +66,14 @@ async function doBasicSketch(
if (openPanes.includes('code')) { if (openPanes.includes('code')) {
await expect(u.codeLocator) 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})`) |> xLine(length = ${commonPoints.num1})`)
} }
await page.waitForTimeout(500) await page.waitForTimeout(500)
await page.mouse.click(startXPx + PUR * 20, 500 - PUR * 20) await page.mouse.click(startXPx + PUR * 20, 500 - PUR * 20)
if (openPanes.includes('code')) { if (openPanes.includes('code')) {
await expect(u.codeLocator) await expect(u.codeLocator)
.toHaveText(`sketch001 = startSketchOn('XZ')profile001 = startProfileAt(${ .toHaveText(`sketch001 = startSketchOn(XZ)profile001 = startProfileAt(${
commonPoints.startAt commonPoints.startAt
}, sketch001) }, sketch001)
|> xLine(length = ${commonPoints.num1}) |> xLine(length = ${commonPoints.num1})
@ -84,7 +85,7 @@ async function doBasicSketch(
await page.mouse.click(startXPx, 500 - PUR * 20) await page.mouse.click(startXPx, 500 - PUR * 20)
if (openPanes.includes('code')) { if (openPanes.includes('code')) {
await expect(u.codeLocator) await expect(u.codeLocator)
.toHaveText(`sketch001 = startSketchOn('XZ')profile001 = startProfileAt(${ .toHaveText(`sketch001 = startSketchOn(XZ)profile001 = startProfileAt(${
commonPoints.startAt commonPoints.startAt
}, sketch001) }, sketch001)
|> xLine(length = ${commonPoints.num1}) |> xLine(length = ${commonPoints.num1})
@ -144,7 +145,7 @@ async function doBasicSketch(
// Open the code pane. // Open the code pane.
await u.openKclCodePanel() await u.openKclCodePanel()
await expect(u.codeLocator) await expect(u.codeLocator)
.toHaveText(`sketch001 = startSketchOn('XZ')profile001 = startProfileAt(${ .toHaveText(`sketch001 = startSketchOn(XZ)profile001 = startProfileAt(${
commonPoints.startAt commonPoints.startAt
}, sketch001) }, sketch001)
|> xLine(length = ${commonPoints.num1}, tag = $seg01) |> xLine(length = ${commonPoints.num1}, tag = $seg01)
@ -154,7 +155,7 @@ async function doBasicSketch(
test.describe('Basic sketch', { tag: ['@skipWin'] }, () => { test.describe('Basic sketch', { tag: ['@skipWin'] }, () => {
test('code pane open at start', async ({ page, homePage }) => { test('code pane open at start', async ({ page, homePage }) => {
test.fixme(process.env.GITHUB_HEAD_REF !== 'all-e2e') test.fixme(orRunWhenFullSuiteEnabled())
await doBasicSketch(page, homePage, ['code']) await doBasicSketch(page, homePage, ['code'])
}) })

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() await u.openDebugPanel()

View File

@ -1,6 +1,9 @@
import { test, expect } from './zoo-test' import { test, expect } from './zoo-test'
import {
import { getUtils, executorInputPath } from './test-utils' orRunWhenFullSuiteEnabled,
getUtils,
executorInputPath,
} from './test-utils'
import { join } from 'path' import { join } from 'path'
import { bracket } from 'lib/exampleKcl' import { bracket } from 'lib/exampleKcl'
import { TEST_CODE_LONG_WITH_ERROR_OUT_OF_VIEW } from './storageStates' import { TEST_CODE_LONG_WITH_ERROR_OUT_OF_VIEW } from './storageStates'
@ -19,7 +22,7 @@ test.describe('Code pane and errors', { tag: ['@skipWin'] }, () => {
localStorage.setItem( localStorage.setItem(
'persistCode', 'persistCode',
`// Extruded Triangle `// Extruded Triangle
sketch001 = startSketchOn('XZ') sketch001 = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line(end = [10, 0]) |> line(end = [10, 0])
|> line(end = [-5, 10]) |> line(end = [-5, 10])
@ -51,7 +54,7 @@ test.describe('Code pane and errors', { tag: ['@skipWin'] }, () => {
homePage, homePage,
editor, editor,
}) => { }) => {
test.fixme(process.env.GITHUB_HEAD_REF !== 'all-e2e') test.fixme(orRunWhenFullSuiteEnabled())
const u = await getUtils(page) const u = await getUtils(page)
// Load the app with the working starter code // Load the app with the working starter code
@ -125,7 +128,7 @@ test.describe('Code pane and errors', { tag: ['@skipWin'] }, () => {
homePage, homePage,
context, context,
}) => { }) => {
test.fixme(process.env.GITHUB_HEAD_REF !== 'all-e2e') test.fixme(orRunWhenFullSuiteEnabled())
// Load the app with the working starter code // Load the app with the working starter code
await context.addInitScript((code) => { await context.addInitScript((code) => {
localStorage.setItem('persistCode', code) localStorage.setItem('persistCode', code)

View File

@ -1,6 +1,10 @@
import { test, expect } from './zoo-test' import { test, expect } from './zoo-test'
import * as fsp from 'fs/promises' import * as fsp from 'fs/promises'
import { executorInputPath, getUtils } from './test-utils' import {
executorInputPath,
getUtils,
orRunWhenFullSuiteEnabled,
} from './test-utils'
import { KCL_DEFAULT_LENGTH } from 'lib/constants' import { KCL_DEFAULT_LENGTH } from 'lib/constants'
import path, { join } from 'path' import path, { join } from 'path'
@ -12,7 +16,7 @@ test.describe('Command bar tests', { tag: ['@skipWin'] }, () => {
await page.addInitScript(async () => { await page.addInitScript(async () => {
localStorage.setItem( localStorage.setItem(
'persistCode', 'persistCode',
`sketch001 = startSketchOn('XY') `sketch001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %) |> startProfileAt([-10, -10], %)
|> line(end = [20, 0]) |> line(end = [20, 0])
|> line(end = [0, 20]) |> line(end = [0, 20])
@ -48,11 +52,11 @@ test.describe('Command bar tests', { tag: ['@skipWin'] }, () => {
// TODO: fix this test after the electron migration // TODO: fix this test after the electron migration
test('Fillet from command bar', async ({ page, homePage }) => { test('Fillet from command bar', async ({ page, homePage }) => {
test.fixme(process.env.GITHUB_HEAD_REF !== 'all-e2e') test.fixme(orRunWhenFullSuiteEnabled())
await page.addInitScript(async () => { await page.addInitScript(async () => {
localStorage.setItem( localStorage.setItem(
'persistCode', 'persistCode',
`sketch001 = startSketchOn('XY') `sketch001 = startSketchOn(XY)
|> startProfileAt([-5, -5], %) |> startProfileAt([-5, -5], %)
|> line(end = [0, 10]) |> line(end = [0, 10])
|> line(end = [10, 0]) |> line(end = [10, 0])
@ -235,7 +239,7 @@ test.describe('Command bar tests', { tag: ['@skipWin'] }, () => {
localStorage.setItem( localStorage.setItem(
'persistCode', 'persistCode',
`distance = sqrt(20) `distance = sqrt(20)
sketch001 = startSketchOn('XZ') sketch001 = startSketchOn(XZ)
|> startProfileAt([-6.95, 10.98], %) |> startProfileAt([-6.95, 10.98], %)
|> line(end = [25.1, 0.41]) |> line(end = [25.1, 0.41])
|> line(end = [0.73, -20.93]) |> line(end = [0.73, -20.93])

View File

@ -20,7 +20,7 @@ test.describe('Copilot ghost text', () => {
await page.keyboard.press('Enter') await page.keyboard.press('Enter')
await expect(page.locator('.cm-ghostText').first()).toBeVisible() await expect(page.locator('.cm-ghostText').first()).toBeVisible()
await expect(page.locator('.cm-content')).toHaveText( 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( await expect(page.locator('.cm-ghostText').first()).toHaveText(
`fn cube = (pos, scale) => {` `fn cube = (pos, scale) => {`
@ -29,7 +29,7 @@ test.describe('Copilot ghost text', () => {
// We should be able to hit Tab to accept the completion. // We should be able to hit Tab to accept the completion.
await page.keyboard.press('Tab') await page.keyboard.press('Tab')
await expect(page.locator('.cm-content')).toHaveText( 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. // Hit enter a few times.
@ -37,7 +37,7 @@ test.describe('Copilot ghost text', () => {
await page.keyboard.press('Enter') await page.keyboard.press('Enter')
await expect(page.locator('.cm-content')).toHaveText( 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() await expect(page.locator('.cm-ghostText')).not.toBeVisible()
@ -80,7 +80,7 @@ test.describe('Copilot ghost text', () => {
await page.keyboard.press('Enter') await page.keyboard.press('Enter')
await expect(page.locator('.cm-content')).toHaveText( 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( await expect(page.locator('.cm-ghostText').first()).toHaveText(
`fn cube = (pos, scale) => {` `fn cube = (pos, scale) => {`
@ -89,7 +89,7 @@ test.describe('Copilot ghost text', () => {
// We should be able to hit Tab to accept the completion. // We should be able to hit Tab to accept the completion.
await page.keyboard.press('Tab') await page.keyboard.press('Tab')
await expect(page.locator('.cm-content')).toContainText( 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 page.waitForTimeout(500)
await expect(page.locator('.cm-ghostText').first()).not.toBeVisible() await expect(page.locator('.cm-ghostText').first()).not.toBeVisible()
await expect(page.locator('.cm-content')).toHaveText( await expect(page.locator('.cm-content')).toHaveText(
`sketch001 = startSketchOn('XZ')` `sketch001 = startSketchOn(XZ)`
) )
// Escape to exit the tool. // Escape to exit the tool.
@ -139,7 +139,7 @@ test.describe('Copilot ghost text', () => {
await page.waitForTimeout(500) await page.waitForTimeout(500)
await expect(page.locator('.cm-ghostText').first()).not.toBeVisible() await expect(page.locator('.cm-ghostText').first()).not.toBeVisible()
await expect(page.locator('.cm-content')).toHaveText( await expect(page.locator('.cm-content')).toHaveText(
`sketch001 = startSketchOn('XZ')` `sketch001 = startSketchOn(XZ)`
) )
// Escape again to exit sketch mode. // Escape again to exit sketch mode.
@ -156,7 +156,7 @@ test.describe('Copilot ghost text', () => {
await page.keyboard.press('Enter') await page.keyboard.press('Enter')
await expect(page.locator('.cm-content')).toHaveText( 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( await expect(page.locator('.cm-ghostText').first()).toHaveText(
`fn cube = (pos, scale) => {` `fn cube = (pos, scale) => {`
@ -165,7 +165,7 @@ test.describe('Copilot ghost text', () => {
// We should be able to hit Tab to accept the completion. // We should be able to hit Tab to accept the completion.
await page.keyboard.press('Tab') await page.keyboard.press('Tab')
await expect(page.locator('.cm-content')).toHaveText( 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. // Hit enter a few times.
@ -173,7 +173,7 @@ test.describe('Copilot ghost text', () => {
await page.keyboard.press('Enter') await page.keyboard.press('Enter')
await expect(page.locator('.cm-content')).toHaveText( 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() await expect(page.locator('.cm-ghostText')).not.toBeVisible()
@ -194,7 +194,7 @@ test.describe('Copilot ghost text', () => {
await page.keyboard.press('Enter') await page.keyboard.press('Enter')
await expect(page.locator('.cm-ghostText').first()).toBeVisible() await expect(page.locator('.cm-ghostText').first()).toBeVisible()
await expect(page.locator('.cm-content')).toHaveText( 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( await expect(page.locator('.cm-ghostText').first()).toHaveText(
`fn cube = (pos, scale) => {` `fn cube = (pos, scale) => {`
@ -225,7 +225,7 @@ test.describe('Copilot ghost text', () => {
await page.keyboard.press('Enter') await page.keyboard.press('Enter')
await expect(page.locator('.cm-ghostText').first()).toBeVisible() await expect(page.locator('.cm-ghostText').first()).toBeVisible()
await expect(page.locator('.cm-content')).toHaveText( 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( await expect(page.locator('.cm-ghostText').first()).toHaveText(
`fn cube = (pos, scale) => {` `fn cube = (pos, scale) => {`
@ -256,7 +256,7 @@ test.describe('Copilot ghost text', () => {
await page.keyboard.press('Enter') await page.keyboard.press('Enter')
await expect(page.locator('.cm-ghostText').first()).toBeVisible() await expect(page.locator('.cm-ghostText').first()).toBeVisible()
await expect(page.locator('.cm-content')).toHaveText( 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( await expect(page.locator('.cm-ghostText').first()).toHaveText(
`fn cube = (pos, scale) => {` `fn cube = (pos, scale) => {`
@ -287,7 +287,7 @@ test.describe('Copilot ghost text', () => {
await page.keyboard.press('Enter') await page.keyboard.press('Enter')
await expect(page.locator('.cm-ghostText').first()).toBeVisible() await expect(page.locator('.cm-ghostText').first()).toBeVisible()
await expect(page.locator('.cm-content')).toHaveText( 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( await expect(page.locator('.cm-ghostText').first()).toHaveText(
`fn cube = (pos, scale) => {` `fn cube = (pos, scale) => {`
@ -315,7 +315,7 @@ test.describe('Copilot ghost text', () => {
await page.keyboard.press('Enter') await page.keyboard.press('Enter')
await expect(page.locator('.cm-ghostText').first()).toBeVisible() await expect(page.locator('.cm-ghostText').first()).toBeVisible()
await expect(page.locator('.cm-content')).toHaveText( 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( await expect(page.locator('.cm-ghostText').first()).toHaveText(
`fn cube = (pos, scale) => {` `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-ghostText').first()).toBeVisible()
await expect(page.locator('.cm-content')).toHaveText( 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 page.keyboard.press('Enter')
await expect(page.locator('.cm-ghostText').first()).toBeVisible() await expect(page.locator('.cm-ghostText').first()).toBeVisible()
await expect(page.locator('.cm-content')).toHaveText( 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( await expect(page.locator('.cm-ghostText').first()).toHaveText(
`fn cube = (pos, scale) => {` `fn cube = (pos, scale) => {`
@ -409,7 +409,7 @@ test.describe('Copilot ghost text', () => {
await page.keyboard.press('Enter') await page.keyboard.press('Enter')
await expect(page.locator('.cm-ghostText').first()).toBeVisible() await expect(page.locator('.cm-ghostText').first()).toBeVisible()
await expect(page.locator('.cm-content')).toHaveText( 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( await expect(page.locator('.cm-ghostText').first()).toHaveText(
`fn cube = (pos, scale) => {` `fn cube = (pos, scale) => {`
@ -450,7 +450,7 @@ test.describe('Copilot ghost text', () => {
await page.keyboard.press('Enter') await page.keyboard.press('Enter')
await expect(page.locator('.cm-ghostText').first()).toBeVisible() await expect(page.locator('.cm-ghostText').first()).toBeVisible()
await expect(page.locator('.cm-content')).toHaveText( 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( await expect(page.locator('.cm-ghostText').first()).toHaveText(
`fn cube = (pos, scale) => {` `fn cube = (pos, scale) => {`
@ -483,7 +483,7 @@ test.describe('Copilot ghost text', () => {
await page.keyboard.press('Enter') await page.keyboard.press('Enter')
await expect(page.locator('.cm-ghostText').first()).toBeVisible() await expect(page.locator('.cm-ghostText').first()).toBeVisible()
await expect(page.locator('.cm-content')).toHaveText( 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( await expect(page.locator('.cm-ghostText').first()).toHaveText(
`fn cube = (pos, scale) => {` `fn cube = (pos, scale) => {`
@ -514,7 +514,7 @@ test.describe('Copilot ghost text', () => {
await page.keyboard.press('Enter') await page.keyboard.press('Enter')
await expect(page.locator('.cm-ghostText').first()).toBeVisible() await expect(page.locator('.cm-ghostText').first()).toBeVisible()
await expect(page.locator('.cm-content')).toHaveText( 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( await expect(page.locator('.cm-ghostText').first()).toHaveText(
`fn cube = (pos, scale) => {` `fn cube = (pos, scale) => {`

View File

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

View File

@ -2,10 +2,10 @@ import { test, expect } from './zoo-test'
import fsp from 'fs/promises' import fsp from 'fs/promises'
import { uuidv4 } from 'lib/utils' import { uuidv4 } from 'lib/utils'
import { import {
darkModeBgColor,
darkModePlaneColorXZ,
executorInputPath, executorInputPath,
getUtils, getUtils,
orRunWhenFullSuiteEnabled,
TEST_COLORS,
} from './test-utils' } from './test-utils'
import { join } from 'path' import { join } from 'path'
@ -21,7 +21,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await expect(page.locator('.cm-lint-marker-error')).not.toBeVisible() await expect(page.locator('.cm-lint-marker-error')).not.toBeVisible()
await u.codeLocator.click() await u.codeLocator.click()
await page.keyboard.type(`sketch001 = startSketchOn('XY') await page.keyboard.type(`sketch001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %) |> startProfileAt([-10, -10], %)
|> line(end = [20, 0]) |> line(end = [20, 0])
|> line(end = [0, 20]) |> line(end = [0, 20])
@ -33,7 +33,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await page.keyboard.up('ControlOrMeta') await page.keyboard.up('ControlOrMeta')
await expect(page.locator('.cm-content')) await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XY') .toHaveText(`sketch001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %) |> startProfileAt([-10, -10], %)
|> line(end = [20, 0]) |> line(end = [20, 0])
|> line(end = [0, 20]) |> line(end = [0, 20])
@ -46,7 +46,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await page.keyboard.up('ControlOrMeta') await page.keyboard.up('ControlOrMeta')
await expect(page.locator('.cm-content')) await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XY') .toHaveText(`sketch001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %) |> startProfileAt([-10, -10], %)
|> line(end = [20, 0]) |> line(end = [20, 0])
|> line(end = [0, 20]) |> line(end = [0, 20])
@ -65,7 +65,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await u.waitForPageLoad() await u.waitForPageLoad()
await u.codeLocator.click() await u.codeLocator.click()
await page.keyboard.type(`sketch001 = startSketchOn('XY') await page.keyboard.type(`sketch001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %) |> startProfileAt([-10, -10], %)
|> line(end = [20, 0]) |> line(end = [20, 0])
|> line(end = [0, 20]) |> line(end = [0, 20])
@ -114,7 +114,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await u.waitForPageLoad() await u.waitForPageLoad()
await u.codeLocator.click() await u.codeLocator.click()
await page.keyboard.type(`sketch001 = startSketchOn('XY') await page.keyboard.type(`sketch001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %) |> startProfileAt([-10, -10], %)
|> line(end = [20, 0]) |> line(end = [20, 0])
|> line(end = [0, 20]) |> 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 expect(page.locator('.cm-lint-marker-error')).not.toBeVisible()
await u.codeLocator.click() await u.codeLocator.click()
await page.keyboard.type(`sketch001 = startSketchOn('XY') await page.keyboard.type(`sketch001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %) |> startProfileAt([-10, -10], %)
|> line(end = [20, 0]) |> line(end = [20, 0])
|> line(end = [0, 20]) |> line(end = [0, 20])
@ -179,7 +179,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await page.locator('button:has-text("Format code")').click() await page.locator('button:has-text("Format code")').click()
await expect(page.locator('.cm-content')) await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XY') .toHaveText(`sketch001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %) |> startProfileAt([-10, -10], %)
|> line(end = [20, 0]) |> line(end = [20, 0])
|> line(end = [0, 20]) |> 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 expect(page.locator('.cm-lint-marker-error')).not.toBeVisible()
await u.codeLocator.click() await u.codeLocator.click()
await page.keyboard.type(`sketch_001 = startSketchOn('XY') await page.keyboard.type(`sketch_001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %) |> startProfileAt([-10, -10], %)
|> line(end = [20, 0]) |> line(end = [20, 0])
|> line(end = [0, 20]) |> line(end = [0, 20])
@ -228,7 +228,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await u.closeDebugPanel() await u.closeDebugPanel()
await expect(page.locator('.cm-content')) await expect(page.locator('.cm-content'))
.toHaveText(`sketch_001 = startSketchOn('XY') .toHaveText(`sketch_001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %) |> startProfileAt([-10, -10], %)
|> line(end = [20, 0]) |> line(end = [20, 0])
|> line(end = [0, 20]) |> line(end = [0, 20])
@ -246,7 +246,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
}) })
test('fold gutters work', async ({ page, homePage }) => { test('fold gutters work', async ({ page, homePage }) => {
const fullCode = `sketch001 = startSketchOn('XY') const fullCode = `sketch001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %) |> startProfileAt([-10, -10], %)
|> line(end = [20, 0]) |> line(end = [20, 0])
|> line(end = [0, 20]) |> line(end = [0, 20])
@ -255,7 +255,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await page.addInitScript(async () => { await page.addInitScript(async () => {
localStorage.setItem( localStorage.setItem(
'persistCode', 'persistCode',
`sketch001 = startSketchOn('XY') `sketch001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %) |> startProfileAt([-10, -10], %)
|> line(end = [20, 0]) |> line(end = [20, 0])
|> line(end = [0, 20]) |> line(end = [0, 20])
@ -293,7 +293,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await foldGutterFoldLine.click() await foldGutterFoldLine.click()
await expect(page.locator('.cm-content')).toHaveText( await expect(page.locator('.cm-content')).toHaveText(
`sketch001 = startSketchOn('XY')… ` `sketch001 = startSketchOn(XY)… `
) )
await expect(page.locator('.cm-content')).not.toHaveText(fullCode) await expect(page.locator('.cm-content')).not.toHaveText(fullCode)
await expect(foldGutterFoldLine).not.toBeVisible() await expect(foldGutterFoldLine).not.toBeVisible()
@ -324,7 +324,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await page.addInitScript(async () => { await page.addInitScript(async () => {
localStorage.setItem( localStorage.setItem(
'persistCode', 'persistCode',
`sketch001 = startSketchOn('XY') `sketch001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %) |> startProfileAt([-10, -10], %)
|> line(end = [20, 0]) |> line(end = [20, 0])
|> line(end = [0, 20]) |> line(end = [0, 20])
@ -371,7 +371,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await page.addInitScript(async () => { await page.addInitScript(async () => {
localStorage.setItem( localStorage.setItem(
'persistCode', 'persistCode',
`sketch001 = startSketchOn('XY') `sketch001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %) |> startProfileAt([-10, -10], %)
|> line(end = [20, 0]) |> line(end = [20, 0])
|> line(end = [0, 20]) |> line(end = [0, 20])
@ -398,7 +398,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await page.keyboard.press('Alt+Shift+KeyF') await page.keyboard.press('Alt+Shift+KeyF')
await expect(page.locator('.cm-content')) await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XY') .toHaveText(`sketch001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %) |> startProfileAt([-10, -10], %)
|> line(end = [20, 0]) |> line(end = [20, 0])
|> line(end = [0, 20]) |> line(end = [0, 20])
@ -414,7 +414,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await page.addInitScript(async () => { await page.addInitScript(async () => {
localStorage.setItem( localStorage.setItem(
'persistCode', 'persistCode',
`sketch_001 = startSketchOn('XY') `sketch_001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %) |> startProfileAt([-10, -10], %)
|> line(end = [20, 0]) |> line(end = [20, 0])
|> line(end = [0, 20]) |> line(end = [0, 20])
@ -451,7 +451,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await u.closeDebugPanel() await u.closeDebugPanel()
await expect(page.locator('.cm-content')) await expect(page.locator('.cm-content'))
.toHaveText(`sketch_001 = startSketchOn('XY') .toHaveText(`sketch_001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %) |> startProfileAt([-10, -10], %)
|> line(end = [20, 0]) |> line(end = [20, 0])
|> line(end = [0, 20]) |> line(end = [0, 20])
@ -524,7 +524,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await page.addInitScript(async () => { await page.addInitScript(async () => {
localStorage.setItem( localStorage.setItem(
'persistCode', 'persistCode',
`sketch001 = startSketchOn('XZ') `sketch001 = startSketchOn(XZ)
|> startProfileAt([3.29, 7.86], %) |> startProfileAt([3.29, 7.86], %)
|> line(end = [2.48, 2.44]) |> line(end = [2.48, 2.44])
|> line(end = [2.66, 1.17]) |> line(end = [2.66, 1.17])
@ -639,7 +639,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
page, page,
homePage, homePage,
}) => { }) => {
test.fixme(process.env.GITHUB_HEAD_REF !== 'all-e2e') test.fixme(orRunWhenFullSuiteEnabled())
const u = await getUtils(page) const u = await getUtils(page)
await page.addInitScript(async () => { await page.addInitScript(async () => {
localStorage.setItem( localStorage.setItem(
@ -650,7 +650,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
dia = 4 dia = 4
fn squareHole = (l, w) => { fn squareHole = (l, w) => {
squareHoleSketch = startSketchOn('XY') squareHoleSketch = startSketchOn(XY)
|> startProfileAt([-width / 2, -length / 2], %) |> startProfileAt([-width / 2, -length / 2], %)
|> line(endAbsolute = [width / 2, -length / 2]) |> line(endAbsolute = [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('ArrowDown') await page.keyboard.press('ArrowDown')
await page.keyboard.press('Enter') await page.keyboard.press('Enter')
await page.keyboard.type(`extrusion = startSketchOn('XY') await page.keyboard.type(`extrusion = startSketchOn(XY)
|> circle(center: [0, 0], radius: dia/2) |> circle(center: [0, 0], radius: dia/2)
|> hole(squareHole(length, width, height), %) |> hole(squareHole(length, width, height), %)
|> extrude(length = height)`) |> extrude(length = height)`)
@ -713,7 +713,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await context.addInitScript(async () => { await context.addInitScript(async () => {
localStorage.setItem( localStorage.setItem(
'persistCode', 'persistCode',
`box = startSketchOn('XY') `box = startSketchOn(XY)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line(end = [0, 10]) |> line(end = [0, 10])
|> line(end = [10, 0]) |> line(end = [10, 0])
@ -772,7 +772,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
}).toPass() }).toPass()
// this makes sure we can accept a completion with click // this makes sure we can accept a completion with click
await page.getByText('startSketchOn').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('Tab')
await page.keyboard.press('Enter') await page.keyboard.press('Enter')
await page.keyboard.type(' |> startProfi') 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-completionLabel')).not.toBeVisible()
await expect(page.locator('.cm-content')) await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XZ') .toHaveText(`sketch001 = startSketchOn(XZ)
|> startProfileAt([3.14, 12], %) |> startProfileAt([3.14, 12], %)
|> xLine(%, length = 5) // lin`) |> xLine(%, length = 5) // lin`)
@ -846,7 +846,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await page.keyboard.press('ArrowDown') await page.keyboard.press('ArrowDown')
await page.keyboard.press('Tab') await page.keyboard.press('Tab')
await page.waitForTimeout(500) await page.waitForTimeout(500)
await page.keyboard.type("'XZ'") await page.keyboard.type('XZ')
await page.keyboard.press('Tab') await page.keyboard.press('Tab')
await page.keyboard.press('Enter') await page.keyboard.press('Enter')
await page.keyboard.type(' |> startProfi') 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-completionLabel')).not.toBeVisible()
await expect(page.locator('.cm-content')) await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XZ') .toHaveText(`sketch001 = startSketchOn(XZ)
|> startProfileAt([3.14, 12], %) |> startProfileAt([3.14, 12], %)
|> xLine(%, length = 5) // lin`) |> xLine(%, length = 5) // lin`)
}) })
@ -903,7 +903,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await context.addInitScript(async () => { await context.addInitScript(async () => {
localStorage.setItem( localStorage.setItem(
'persistCode', 'persistCode',
`sketch001 = startSketchOn('XZ') `sketch001 = startSketchOn(XZ)
|> startProfileAt([4.61, -14.01], %) |> startProfileAt([4.61, -14.01], %)
|> line(end = [12.73, -0.09]) |> line(end = [12.73, -0.09])
|> tangentialArcTo([24.95, -5.38], %) |> tangentialArcTo([24.95, -5.38], %)
@ -955,7 +955,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
// expect the code to have changed // expect the code to have changed
await expect(page.locator('.cm-content')).toHaveText( 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 // Now hit undo
@ -965,7 +965,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await page.waitForTimeout(100) await page.waitForTimeout(100)
await expect(page.locator('.cm-content')) await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XZ') .toHaveText(`sketch001 = startSketchOn(XZ)
|> startProfileAt([4.61, -14.01], %) |> startProfileAt([4.61, -14.01], %)
|> line(end = [12.73, -0.09]) |> line(end = [12.73, -0.09])
|> tangentialArcTo([24.95, -5.38], %) |> tangentialArcTo([24.95, -5.38], %)
@ -980,7 +980,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await page.addInitScript(async () => { await page.addInitScript(async () => {
localStorage.setItem( localStorage.setItem(
'persistCode', 'persistCode',
`sketch001 = startSketchOn('XZ') `sketch001 = startSketchOn(XZ)
|> startProfileAt([4.61, -10.01], %) |> startProfileAt([4.61, -10.01], %)
|> line(end = [12.73, -0.09]) |> line(end = [12.73, -0.09])
|> tangentialArcTo([24.95, -0.38], %) |> tangentialArcTo([24.95, -0.38], %)
@ -1071,7 +1071,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
// expect the code to have changed // expect the code to have changed
await expect(page.locator('.cm-content')) await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XZ') .toHaveText(`sketch001 = startSketchOn(XZ)
|> startProfileAt([2.71, -2.71], %) |> startProfileAt([2.71, -2.71], %)
|> line(end = [15.4, -2.78]) |> line(end = [15.4, -2.78])
|> tangentialArcTo([27.6, -3.05], %) |> tangentialArcTo([27.6, -3.05], %)
@ -1085,7 +1085,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await page.keyboard.up('Control') await page.keyboard.up('Control')
await expect(page.locator('.cm-content')) await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XZ') .toHaveText(`sketch001 = startSketchOn(XZ)
|> startProfileAt([2.71, -2.71], %) |> startProfileAt([2.71, -2.71], %)
|> line(end = [15.4, -2.78]) |> line(end = [15.4, -2.78])
|> tangentialArcTo([24.95, -0.38], %) |> tangentialArcTo([24.95, -0.38], %)
@ -1098,7 +1098,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await page.keyboard.up('Control') await page.keyboard.up('Control')
await expect(page.locator('.cm-content')) await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XZ') .toHaveText(`sketch001 = startSketchOn(XZ)
|> startProfileAt([2.71, -2.71], %) |> startProfileAt([2.71, -2.71], %)
|> line(end = [12.73, -0.09]) |> line(end = [12.73, -0.09])
|> tangentialArcTo([24.95, -0.38], %) |> tangentialArcTo([24.95, -0.38], %)
@ -1113,7 +1113,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await page.waitForTimeout(100) await page.waitForTimeout(100)
await expect(page.locator('.cm-content')) await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XZ') .toHaveText(`sketch001 = startSketchOn(XZ)
|> startProfileAt([4.61, -10.01], %) |> startProfileAt([4.61, -10.01], %)
|> line(end = [12.73, -0.09]) |> line(end = [12.73, -0.09])
|> tangentialArcTo([24.95, -0.38], %) |> tangentialArcTo([24.95, -0.38], %)
@ -1126,7 +1126,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
`Can use the import stdlib function on a local OBJ file`, `Can use the import stdlib function on a local OBJ file`,
{ tag: '@electron' }, { tag: '@electron' },
async ({ page, context }, testInfo) => { async ({ page, context }, testInfo) => {
test.fixme(process.env.GITHUB_HEAD_REF !== 'all-e2e') test.fixme(orRunWhenFullSuiteEnabled())
await context.folderSetupFn(async (dir) => { await context.folderSetupFn(async (dir) => {
const bracketDir = join(dir, 'cube') const bracketDir = join(dir, 'cube')
await fsp.mkdir(bracketDir, { recursive: true }) await fsp.mkdir(bracketDir, { recursive: true })
@ -1163,7 +1163,8 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await u.waitForPageLoad() await u.waitForPageLoad()
await expect await expect
.poll( .poll(
async () => locationToHavColor(notTheOrigin, darkModePlaneColorXZ), async () =>
locationToHavColor(notTheOrigin, TEST_COLORS.DARK_MODE_PLANE_XZ),
{ {
timeout: 5000, timeout: 5000,
message: 'XZ plane color is visible', message: 'XZ plane color is visible',
@ -1184,16 +1185,23 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await test.step(`Verify that we see the imported geometry and no errors`, async () => { await test.step(`Verify that we see the imported geometry and no errors`, async () => {
await expect(errorIndicators).toHaveCount(0) await expect(errorIndicators).toHaveCount(0)
await expect await expect
.poll(async () => locationToHavColor(origin, darkModePlaneColorXZ), { .poll(
async () =>
locationToHavColor(origin, TEST_COLORS.DARK_MODE_PLANE_XZ),
{
timeout: 3000, timeout: 3000,
message: 'Plane color should not be visible', message: 'Plane color should not be visible',
}) }
)
.toBeGreaterThan(15) .toBeGreaterThan(15)
await expect await expect
.poll(async () => locationToHavColor(origin, darkModeBgColor), { .poll(
async () => locationToHavColor(origin, TEST_COLORS.DARK_MODE_BKGD),
{
timeout: 3000, timeout: 3000,
message: 'Background color should not be visible', message: 'Background color should not be visible',
}) }
)
.toBeGreaterThan(15) .toBeGreaterThan(15)
}) })
} }

View File

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

View File

@ -1,7 +1,12 @@
import { test, expect } from './zoo-test' import { test, expect } from './zoo-test'
import * as fsp from 'fs/promises' import * as fsp from 'fs/promises'
import * as fs from 'fs' import * as fs from 'fs'
import { createProject, executorInputPath, getUtils } from './test-utils' import {
createProject,
executorInputPath,
getUtils,
orRunWhenFullSuiteEnabled,
} from './test-utils'
import { join } from 'path' import { join } from 'path'
import { FILE_EXT } from 'lib/constants' import { FILE_EXT } from 'lib/constants'
@ -10,6 +15,7 @@ test.describe('integrations tests', () => {
'Creating a new file or switching file while in sketchMode should exit sketchMode', 'Creating a new file or switching file while in sketchMode should exit sketchMode',
{ tag: '@electron' }, { tag: '@electron' },
async ({ page, context, homePage, scene, editor, toolbar, cmdBar }) => { async ({ page, context, homePage, scene, editor, toolbar, cmdBar }) => {
test.fixme(orRunWhenFullSuiteEnabled())
await context.folderSetupFn(async (dir) => { await context.folderSetupFn(async (dir) => {
const bracketDir = join(dir, 'test-sample') const bracketDir = join(dir, 'test-sample')
await fsp.mkdir(bracketDir, { recursive: true }) await fsp.mkdir(bracketDir, { recursive: true })
@ -272,7 +278,7 @@ test.describe('when using the file tree to', () => {
tag: '@electron', tag: '@electron',
}, },
async ({ page }, testInfo) => { async ({ page }, testInfo) => {
test.fixme(process.env.GITHUB_HEAD_REF !== 'all-e2e') test.fixme(orRunWhenFullSuiteEnabled())
const { const {
panesOpen, panesOpen,
pasteCodeInEditor, pasteCodeInEditor,
@ -1059,7 +1065,7 @@ test.describe('Undo and redo do not keep history when navigating between files',
// Click in the editor and add some new lines. // Click in the editor and add some new lines.
await u.codeLocator.click() await u.codeLocator.click()
await page.keyboard.type(`sketch001 = startSketchOn('XY') await page.keyboard.type(`sketch001 = startSketchOn(XY)
some other shit`) some other shit`)
// Ensure the content in the editor changed. // 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 // 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 // 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" // but less so for exactly "sketch002 = startS"
await this.codeContent.getByText(text).first().selectText() await this.codeContent.getByText(text).first().selectText()

View File

@ -6,6 +6,7 @@ import {
executorInputPath, executorInputPath,
createProject, createProject,
settingsToToml, settingsToToml,
orRunWhenFullSuiteEnabled,
} from './test-utils' } from './test-utils'
import { bracket } from 'lib/exampleKcl' import { bracket } from 'lib/exampleKcl'
import { onboardingPaths } from 'routes/Onboarding/paths' import { onboardingPaths } from 'routes/Onboarding/paths'
@ -116,7 +117,7 @@ test.describe('Onboarding tests', () => {
} }
await tronApp.cleanProjectDir() 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 // Load the page up with some code so we see the confirmation warning
// when we go to replay onboarding // when we go to replay onboarding
@ -325,7 +326,7 @@ test.describe('Onboarding tests', () => {
homePage, homePage,
tronApp, tronApp,
}) => { }) => {
test.fixme(process.env.GITHUB_HEAD_REF !== 'all-e2e') test.fixme(orRunWhenFullSuiteEnabled())
if (!tronApp) { if (!tronApp) {
fail() fail()
} }
@ -398,7 +399,7 @@ test.describe('Onboarding tests', () => {
homePage, homePage,
tronApp, tronApp,
}) => { }) => {
test.fixme(process.env.GITHUB_HEAD_REF !== 'all-e2e') test.fixme(orRunWhenFullSuiteEnabled())
if (!tronApp) { if (!tronApp) {
fail() fail()
} }
@ -457,7 +458,7 @@ test('Restarting onboarding on desktop takes one attempt', async ({
page, page,
tronApp, tronApp,
}) => { }) => {
test.fixme(process.env.GITHUB_HEAD_REF !== 'all-e2e') test.fixme(orRunWhenFullSuiteEnabled())
if (!tronApp) { if (!tronApp) {
fail() fail()
} }

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