Compare commits

..

7 Commits

Author SHA1 Message Date
5713526e99 Lint again 2025-03-18 12:25:21 -04:00
3612c195eb Revert "Lint"
This reverts commit 53a04d0f24.
2025-03-18 12:19:28 -04:00
53a04d0f24 Lint 2025-03-18 12:10:17 -04:00
089b3397b6 A snapshot a day keeps the bugs away! 📷🐛 2025-03-18 16:01:08 +00:00
77a072cc38 A snapshot a day keeps the bugs away! 📷🐛 2025-03-18 15:51:35 +00:00
3090827cc1 A snapshot a day keeps the bugs away! 📷🐛 2025-03-18 15:41:54 +00:00
3daf6acf4e pierremtb/adhoc/disable-failing-tests 2025-03-18 11:32:26 -04:00
1259 changed files with 761005 additions and 282714 deletions

View File

@ -22,13 +22,6 @@
"rules": { "rules": {
"@typescript-eslint/no-floating-promises": "error", "@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-misused-promises": "error", "@typescript-eslint/no-misused-promises": "error",
"@typescript-eslint/no-unused-vars": ["error", {
"varsIgnorePattern": "^_",
"argsIgnorePattern": "^_",
"ignoreRestSiblings": true,
"vars": "all",
"args": "none"
}],
"jsx-a11y/click-events-have-key-events": "off", "jsx-a11y/click-events-have-key-events": "off",
"jsx-a11y/no-autofocus": "off", "jsx-a11y/no-autofocus": "off",
"jsx-a11y/no-noninteractive-element-interactions": "off", "jsx-a11y/no-noninteractive-element-interactions": "off",

View File

@ -4,7 +4,7 @@
"main": "main.js", "main": "main.js",
"dependencies": { "dependencies": {
"@actions/core": "^1.6", "@actions/core": "^1.6",
"@actions/github": "^6.0", "@actions/github": "^5.0",
"glob": "^11.0.1" "glob": "^7.1.5"
} }
} }

View File

@ -4,27 +4,27 @@
set -euo pipefail set -euo pipefail
if [[ ! -f "test-results/.last-run.json" ]]; then if [[ ! -f "test-results/.last-run.json" ]]; then
# If no last run artifact, than run Playwright normally # if no last run artifact, than run plawright normally
echo "run playwright normally" echo "run playwright normally"
if [[ "$3" == *ubuntu* ]]; then if [[ "$3" == *ubuntu* ]]; then
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn test:playwright:electron:ubuntu -- --shard=$1/$2 || true xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn test:playwright:electron:ubuntu -- --shard=$1/$2 || true
elif [[ "$3" == *windows* ]]; then elif [[ "$3" == *windows* ]]; then
yarn test:playwright:electron:windows -- --shard=$1/$2 || true yarn test:playwright:electron:windows -- --shard=$1/$2 || true
elif [[ "$3" == *macos* ]]; then elif [[ "$3" == *macos* ]]; then
yarn test:playwright:electron:macos -- --shard=$1/$2 || true yarn test:playwright:electron:macos -- --shard=$1/$2 || true
else else
echo "Do not run Playwright. Unable to detect os runtime." echo "Do not run playwright. Unable to detect os runtime."
exit 1 exit 1
fi fi
# Log failures for Axiom to pick up # # send to axiom
node playwrightProcess.mjs > /tmp/github-actions.log node playwrightProcess.mjs | tee /tmp/github-actions.log > /dev/null 2>&1
fi fi
retry=1 retry=1
max_retries=1 max_retrys=1
# Retry failed tests, doing our own retries because using inbuilt Playwright retries causes connection issues # retry failed tests, doing our own retries because using inbuilt playwright retries causes connection issues
while [[ $retry -le $max_retries ]]; do while [[ $retry -le $max_retrys ]]; do
if [[ -f "test-results/.last-run.json" ]]; then if [[ -f "test-results/.last-run.json" ]]; then
failed_tests=$(jq '.failedTests | length' test-results/.last-run.json) failed_tests=$(jq '.failedTests | length' test-results/.last-run.json)
if [[ $failed_tests -gt 0 ]]; then if [[ $failed_tests -gt 0 ]]; then
@ -40,8 +40,8 @@ while [[ $retry -le $max_retries ]]; do
echo "Do not run playwright. Unable to detect os runtime." echo "Do not run playwright. Unable to detect os runtime."
exit 1 exit 1
fi fi
# Log failures for Axiom to pick up # send to axiom
node playwrightProcess.mjs > /tmp/github-actions.log node playwrightProcess.mjs | tee /tmp/github-actions.log > /dev/null 2>&1
retry=$((retry + 1)) retry=$((retry + 1))
else else
echo "retried=false" >>$GITHUB_OUTPUT echo "retried=false" >>$GITHUB_OUTPUT
@ -58,7 +58,7 @@ echo "retried=false" >>$GITHUB_OUTPUT
if [[ -f "test-results/.last-run.json" ]]; then if [[ -f "test-results/.last-run.json" ]]; then
failed_tests=$(jq '.failedTests | length' test-results/.last-run.json) failed_tests=$(jq '.failedTests | length' test-results/.last-run.json)
if [[ $failed_tests -gt 0 ]]; then if [[ $failed_tests -gt 0 ]]; then
# If it still fails after 3 retries, then fail the job # if it still fails after 3 retrys, then fail the job
exit 1 exit 1
fi fi
fi fi

View File

@ -230,6 +230,39 @@ updates:
update-types: update-types:
- minor - minor
- patch - patch
- package-ecosystem: pip
directory: /public/kcl-samples
schedule:
interval: weekly
day: monday
time: '03:00'
timezone: America/Los_Angeles
open-pull-requests-limit: 5
reviewers:
- adamchalmers
- franknoirot
- irev-dev
- jessfraz
groups:
security:
applies-to: security-updates
update-types:
- major
- minor
- patch
patch:
applies-to: version-updates
update-types:
- patch
major:
applies-to: version-updates
update-types:
- major
minor:
applies-to: version-updates
update-types:
- minor
- patch
- package-ecosystem: pip - package-ecosystem: pip
directory: /rust/kcl-python-bindings directory: /rust/kcl-python-bindings
schedule: schedule:

View File

@ -24,7 +24,7 @@ jobs:
uses: actions-rust-lang/setup-rust-toolchain@v1 uses: actions-rust-lang/setup-rust-toolchain@v1
with: with:
cache: false # Configured below. cache: false # Configured below.
- uses: taiki-e/install-action@37bdc826eaedac215f638a96472df572feab0f9b - uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
with: with:
tool: wasm-pack tool: wasm-pack
- name: Rust Cache - name: Rust Cache

View File

@ -77,7 +77,7 @@ jobs:
with: with:
cache: false # Configured below. cache: false # Configured below.
- uses: taiki-e/install-action@37bdc826eaedac215f638a96472df572feab0f9b - uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
if: ${{ steps.wasm.outputs.should-build-wasm == 'true' }} if: ${{ steps.wasm.outputs.should-build-wasm == 'true' }}
with: with:
tool: wasm-pack tool: wasm-pack

View File

@ -100,14 +100,9 @@ jobs:
shell: bash shell: bash
run: | run: |
set -euo pipefail set -euo pipefail
pushd rust cd rust
just overwrite-sim-test kcl_samples just overwrite-sim-test kcl_samples
popd git add kcl-lib/tests
git add \
rust/kcl-lib/tests \
public/kcl-samples/manifest.json \
public/kcl-samples/README.md \
public/kcl-samples/screenshots
git config --local user.email "github-actions[bot]@users.noreply.github.com" git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]" git config --local user.name "github-actions[bot]"
git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git

View File

@ -137,7 +137,7 @@ jobs:
with: with:
cache: false # Configured below. cache: false # Configured below.
- uses: taiki-e/install-action@37bdc826eaedac215f638a96472df572feab0f9b - uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
if: ${{ needs.conditions.outputs.should-run == 'true' && steps.wasm.outputs.should-build-wasm == 'true' }} if: ${{ needs.conditions.outputs.should-run == 'true' && steps.wasm.outputs.should-build-wasm == 'true' }}
with: with:
tool: wasm-pack tool: wasm-pack
@ -325,7 +325,6 @@ jobs:
run: yarn run: yarn
- name: Cache Playwright Browsers - name: Cache Playwright Browsers
if: needs.conditions.outputs.should-run == 'true'
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
path: | path: |
@ -333,29 +332,20 @@ jobs:
key: ${{ runner.os }}-playwright-${{ hashFiles('yarn.lock') }} key: ${{ runner.os }}-playwright-${{ hashFiles('yarn.lock') }}
- name: Install Playwright Browsers - name: Install Playwright Browsers
if: needs.conditions.outputs.should-run == 'true'
run: yarn playwright install --with-deps run: yarn playwright install --with-deps
- name: Build web - name: Build web
if: needs.conditions.outputs.should-run == 'true' if: needs.conditions.outputs.should-run == 'true'
run: yarn tronb:vite:dev run: yarn tronb:vite:dev
- name: Install vector - name: Install good sed
if: contains(matrix.os, 'ubuntu') if: startsWith(matrix.os, 'macos')
shell: bash shell: bash
run: | run: |
curl --proto '=https' --tlsv1.2 -sSfL https://sh.vector.dev > /tmp/vector.sh brew install gnu-sed
chmod +x /tmp/vector.sh echo "/opt/homebrew/opt/gnu-sed/libexec/gnubin" >> $GITHUB_PATH
/tmp/vector.sh -y -no-modify-path
mkdir -p /tmp/vector # TODO: Add back axiom logs
cp .github/workflows/vector.toml /tmp/vector.toml
sed -i "s#GITHUB_WORKFLOW#${GITHUB_WORKFLOW}#g" /tmp/vector.toml
sed -i "s#GITHUB_REPOSITORY#${GITHUB_REPOSITORY}#g" /tmp/vector.toml
sed -i "s#GITHUB_SHA#${GITHUB_SHA}#g" /tmp/vector.toml
sed -i "s#GITHUB_REF_NAME#${GITHUB_REF_NAME}#g" /tmp/vector.toml
sed -i "s#GH_ACTIONS_AXIOM_TOKEN#${{secrets.GH_ACTIONS_AXIOM_TOKEN}}#g" /tmp/vector.toml
cat /tmp/vector.toml
${HOME}/.vector/bin/vector --config /tmp/vector.toml &
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
if: ${{ needs.conditions.outputs.should-run == 'true' && !cancelled() && (success() || failure()) }} if: ${{ needs.conditions.outputs.should-run == 'true' && !cancelled() && (success() || failure()) }}

View File

@ -376,7 +376,7 @@ jobs:
with: with:
credentials_json: "${{ secrets.GOOGLE_CLOUD_DL_SA }}" credentials_json: "${{ secrets.GOOGLE_CLOUD_DL_SA }}"
- name: Set up Cloud SDK - name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2.1.4 uses: google-github-actions/setup-gcloud@v2.1.2
with: with:
project_id: kittycadapi project_id: kittycadapi
- name: "upload files to gcp" - name: "upload files to gcp"

View File

@ -37,7 +37,7 @@ jobs:
node-version-file: '.nvmrc' node-version-file: '.nvmrc'
cache: 'yarn' cache: 'yarn'
- run: yarn install - run: yarn install
- uses: taiki-e/install-action@37bdc826eaedac215f638a96472df572feab0f9b - uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
with: with:
tool: wasm-pack tool: wasm-pack
- run: yarn build:wasm - run: yarn build:wasm
@ -57,7 +57,7 @@ jobs:
with: with:
workspaces: './rust' workspaces: './rust'
- uses: taiki-e/install-action@37bdc826eaedac215f638a96472df572feab0f9b - uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
with: with:
tool: wasm-pack tool: wasm-pack
- run: yarn build:wasm - run: yarn build:wasm
@ -100,7 +100,7 @@ jobs:
cache: 'yarn' cache: 'yarn'
- run: yarn install - run: yarn install
- uses: taiki-e/install-action@37bdc826eaedac215f638a96472df572feab0f9b - uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
with: with:
tool: wasm-pack tool: wasm-pack
- run: yarn build:wasm - run: yarn build:wasm
@ -129,7 +129,7 @@ jobs:
cache: 'yarn' cache: 'yarn'
- run: yarn install - run: yarn install
- uses: taiki-e/install-action@37bdc826eaedac215f638a96472df572feab0f9b - uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
with: with:
tool: wasm-pack tool: wasm-pack
- run: yarn build:wasm - run: yarn build:wasm

View File

@ -1,8 +1,5 @@
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:
@ -29,4 +26,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 --force origin dev git push -f origin dev

View File

@ -1,29 +0,0 @@
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

1
.gitignore vendored
View File

@ -50,7 +50,6 @@ e2e/playwright/**/*.png
e2e/playwright/export-snapshots/* e2e/playwright/export-snapshots/*
!e2e/playwright/export-snapshots/*.png !e2e/playwright/export-snapshots/*.png
!e2e/playwright/snapshot-tests.spec.ts-snapshots/*.png !e2e/playwright/snapshot-tests.spec.ts-snapshots/*.png
trace.zip
/public/kcl-samples.zip /public/kcl-samples.zip
/public/kcl-samples/.github /public/kcl-samples/.github

118
Makefile
View File

@ -1,111 +1,12 @@
.PHONY: all .PHONY: dev
all: install build check
############################################################################### KCL_WASM_LIB_FILES := $(wildcard rust/**/*.rs)
# INSTALL TS_SRC := $(wildcard src/**/*.tsx) $(wildcard src/**/*.ts)
XSTATE_TYPEGENS := $(wildcard src/machines/*.typegen.ts)
WASM_PACK ?= ~/.cargo/bin/wasm-pack dev: node_modules public/wasm_lib_bg.wasm $(XSTATE_TYPEGENS)
.PHONY: install
install: node_modules/.yarn-integrity $(WASM_PACK) ## Install dependencies
node_modules/.yarn-integrity: package.json yarn.lock
yarn install
@ touch $@
$(WASM_PACK):
yarn install:rust
yarn install:wasm-pack:sh
###############################################################################
# BUILD
RUST_SOURCES := $(wildcard rust/*) $(wildcard rust/**/*)
TYPESCRIPT_SOURCES := $(wildcard src/**/*.tsx) $(wildcard src/**/*.ts)
.PHONY: build
build: build-web build-desktop
.PHONY: build-web
build-web: public/kcl_wasm_lib_bg.wasm build/index.html
.PHONY: build-desktop
build-desktop: public/kcl_wasm_lib_bg.wasm .vite/build/main.js
public/kcl_wasm_lib_bg.wasm: $(RUST_SOURCES)
yarn build:wasm
build/index.html: $(TYPESCRIPT_SOURCES)
yarn build:local
.vite/build/main.js: $(TYPESCRIPT_SOURCES)
yarn tronb:vite:dev
###############################################################################
# CHECK
.PHONY: check
check: format lint
.PHONY: format
format: install ## Format the code
yarn fmt
.PHONY: lint
lint: install ## Lint the code
yarn tsc
yarn lint
###############################################################################
# RUN
.PHONY: run
run: run-web
.PHONY: run-web
run-web: install build-web ## Start the web app
yarn start yarn start
.PHONY: run-desktop
run-desktop: install build-desktop ## Start the desktop app
yarn tron:start
###############################################################################
# TEST
GREP ?= ""
.PHONY: test
test: test-unit test-e2e
.PHONY: test-unit
test-unit: install ## Run the unit tests
@ nc -z localhost 3000 || ( echo "Error: localhost:3000 not available, 'make run-web' first" && exit 1 )
yarn test:unit
.PHONY: test-e2e
test-e2e: install build-desktop ## Run the e2e tests
yarn test:playwright:electron --workers=1 --grep=$(GREP)
###############################################################################
# CLEAN
.PHONY: clean
clean: ## Delete all artifacts
rm -rf .vite/ build/
rm -rf trace.zip playwright-report/ test-results/
rm -rf public/kcl_wasm_lib_bg.wasm
rm -rf rust/*/bindings/ rust/*/pkg/ rust/target/
rm -rf node_modules/ rust/*/node_modules/
.PHONY: help
help: install
@ grep -E '^[^[:space:]]+:.*## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.DEFAULT_GOAL := help
###############################################################################
# I'm sorry this is so specific to my setup you may as well ignore this. # I'm sorry this is so specific to my setup you may as well ignore this.
# This is so you don't have to deal with electron windows popping up constantly. # This is so you don't have to deal with electron windows popping up constantly.
# It should work for you other Linux users. # It should work for you other Linux users.
@ -113,3 +14,12 @@ lee-electron-test:
Xephyr -br -ac -noreset -screen 1200x500 :2 & Xephyr -br -ac -noreset -screen 1200x500 :2 &
DISPLAY=:2 NODE_ENV=development PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:4444/ yarn tron:test -g "when using the file tree" DISPLAY=:2 NODE_ENV=development PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:4444/ yarn tron:test -g "when using the file tree"
killall Xephyr killall Xephyr
$(XSTATE_TYPEGENS): $(TS_SRC)
yarn xstate typegen 'src/**/*.ts?(x)'
public/kcl_wasm_lib_bg.wasm: $(KCL_WASM_LIB_FILES)
yarn build:wasm
node_modules: package.json yarn.lock
yarn install

View File

@ -105,7 +105,7 @@ Finally, to run the web app only, run:
yarn start yarn start
``` ```
If you're not a Zoo employee you won't be able to access the dev environment, you should copy everything from `.env.production` to `.env.development.local` to make it point to production instead, then when you navigate to `localhost:3000` the easiest way to sign in is to paste `localStorage.setItem('TOKEN_PERSIST_KEY', "your-token-from-https://zoo.dev/account/api-tokens")` replacing the with a real token from https://zoo.dev/account/api-tokens of course, then navigate to `localhost:3000` again. Note that navigating to `localhost:3000/signin` removes your token so you will need to set the token again. If you're not a Zoo employee you won't be able to access the dev environment, you should copy everything from `.env.production` to `.env.development` to make it point to production instead, then when you navigate to `localhost:3000` the easiest way to sign in is to paste `localStorage.setItem('TOKEN_PERSIST_KEY', "your-token-from-https://zoo.dev/account/api-tokens")` replacing the with a real token from https://zoo.dev/account/api-tokens of course, then navigate to localhost:3000 again. Note that navigating to `localhost:3000/signin` removes your token so you will need to set the token again.
### Development environment variables ### Development environment variables
@ -122,7 +122,7 @@ Third-Party Cookies".
## Desktop ## Desktop
To spin up the desktop app, `yarn install` and `yarn build:wasm` need to have been done before hand then: To spin up the desktop app, `yarn install` and `yarn build:wasm` need to have been done before hand then
``` ```
yarn tron:start yarn tron:start
@ -130,13 +130,13 @@ yarn tron:start
This will start the application and hot-reload on changes. This will start the application and hot-reload on changes.
Devtools can be opened with the usual Command-Option-I (macOS) or Ctrl-Shift-I (Linux and Windows). Devtools can be opened with the usual Cmd-Opt-I (Mac) or Ctrl-Shift-I (Linux and Windows).
To package the app for your platform with electron-builder, run `yarn tronb:package:dev` (or `yarn tronb:package:prod` to point to the .env.production variables). To package the app for your platform with electron-builder, run `yarn tronb:package:dev` (or `yarn tronb:package:prod` to point to the .env.production variables)
## Checking out commits / Bisecting ## Checking out commits / Bisecting
Which commands from setup are one off vs. need to be run every time? Which commands from setup are one off vs need to be run every time?
The following will need to be run when checking out a new commit and guarantees the build is not stale: The following will need to be run when checking out a new commit and guarantees the build is not stale:

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,9 +52,9 @@ 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])
@ -184,8 +184,9 @@ example = extrude(exampleSketch, length = 1)
```js ```js
// 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 +194,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

@ -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

@ -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])

File diff suppressed because one or more lines are too long

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 }, %)

View File

@ -50,7 +50,7 @@ helixPath = helix(
) )
// Create a spring by sweeping around the helix path. // Create a spring by sweeping around the helix path.
springSketch = startSketchOn(YZ) springSketch = startSketchOn('YZ')
|> circle(center = [0, 0], radius = 0.5) |> circle(center = [0, 0], radius = 0.5)
|> sweep(path = helixPath) |> sweep(path = helixPath)
``` ```
@ -59,7 +59,7 @@ springSketch = startSketchOn(YZ)
```js ```js
// Create a helix around an edge. // Create a helix around 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)
@ -73,7 +73,7 @@ helixPath = helix(
) )
// Create a spring by sweeping around the helix path. // Create a spring by sweeping around the helix path.
springSketch = startSketchOn(XY) springSketch = startSketchOn('XY')
|> circle(center = [0, 0], radius = 0.5) |> circle(center = [0, 0], radius = 0.5)
|> sweep(path = helixPath) |> sweep(path = helixPath)
``` ```
@ -97,7 +97,7 @@ helixPath = helix(
) )
// Create a spring by sweeping around the helix path. // Create a spring by sweeping around the helix path.
springSketch = startSketchOn(XY) springSketch = startSketchOn('XY')
|> circle(center = [0, 0], radius = 1) |> circle(center = [0, 0], radius = 1)
|> sweep(path = helixPath) |> sweep(path = helixPath)
``` ```

View File

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

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

@ -22,12 +22,8 @@ layout: manual
* [`string`](kcl/types/string) * [`string`](kcl/types/string)
* [`tag`](kcl/types/tag) * [`tag`](kcl/types/tag)
* **std** * **std**
* [`Face`](kcl/types/Face)
* [`HALF_TURN`](kcl/consts/std-HALF_TURN) * [`HALF_TURN`](kcl/consts/std-HALF_TURN)
* [`Helix`](kcl/types/Helix)
* [`Plane`](kcl/types/Plane) * [`Plane`](kcl/types/Plane)
* [`Point2d`](kcl/types/Point2d)
* [`Point3d`](kcl/types/Point3d)
* [`QUARTER_TURN`](kcl/consts/std-QUARTER_TURN) * [`QUARTER_TURN`](kcl/consts/std-QUARTER_TURN)
* [`Sketch`](kcl/types/Sketch) * [`Sketch`](kcl/types/Sketch)
* [`Solid`](kcl/types/Solid) * [`Solid`](kcl/types/Solid)
@ -69,7 +65,6 @@ layout: manual
* [`fillet`](kcl/fillet) * [`fillet`](kcl/fillet)
* [`floor`](kcl/floor) * [`floor`](kcl/floor)
* [`ft`](kcl/ft) * [`ft`](kcl/ft)
* [`getCommonEdge`](kcl/getCommonEdge)
* [`getNextAdjacentEdge`](kcl/getNextAdjacentEdge) * [`getNextAdjacentEdge`](kcl/getNextAdjacentEdge)
* [`getOppositeEdge`](kcl/getOppositeEdge) * [`getOppositeEdge`](kcl/getOppositeEdge)
* [`getPreviousAdjacentEdge`](kcl/getPreviousAdjacentEdge) * [`getPreviousAdjacentEdge`](kcl/getPreviousAdjacentEdge)

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(

File diff suppressed because one or more lines are too long

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

@ -15,8 +15,6 @@ loft(
bezApproximateRational: bool, bezApproximateRational: bool,
baseCurveIndex?: integer, baseCurveIndex?: integer,
tolerance?: number, tolerance?: number,
tagStart?: TagDeclarator,
tagEnd?: TagDeclarator,
): Solid ): Solid
``` ```
@ -30,8 +28,6 @@ loft(
| `bezApproximateRational` | [`bool`](/docs/kcl/types/bool) | Attempt to approximate rational curves (such as arcs) using a bezier. This will remove banding around interpolations between arcs and non-arcs. It may produce errors in other scenarios Over time, this field won't be necessary. | Yes | | `bezApproximateRational` | [`bool`](/docs/kcl/types/bool) | Attempt to approximate rational curves (such as arcs) using a bezier. This will remove banding around interpolations between arcs and non-arcs. It may produce errors in other scenarios Over time, this field won't be necessary. | Yes |
| `baseCurveIndex` | `integer` | This can be set to override the automatically determined topological base curve, which is usually the first section encountered. | No | | `baseCurveIndex` | `integer` | This can be set to override the automatically determined topological base curve, which is usually the first section encountered. | No |
| `tolerance` | [`number`](/docs/kcl/types/number) | Tolerance for the loft operation. | No | | `tolerance` | [`number`](/docs/kcl/types/number) | Tolerance for the loft operation. | No |
| `tagStart` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | A named tag for the face at the start of the loft, i.e. the original sketch | No |
| `tagEnd` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | A named tag for the face at the end of the loft, i.e. the last sketch | No |
### Returns ### Returns
@ -42,7 +38,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 +46,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 +60,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 +68,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 +85,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 +93,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

@ -52,6 +52,7 @@ fn sum(arr):
sumSoFar = add(sumSoFar, i) sumSoFar = add(sumSoFar, i)
return sumSoFar */ return sumSoFar */
// We use `assertEqual` to check that our `sum` function gives the // We use `assertEqual` to check that our `sum` function gives the
// expected result. It's good to check your work! // expected result. It's good to check your work!
assertEqual(sum([1, 2, 3]), 6, 0.00001, "1 + 2 + 3 summed is 6") assertEqual(sum([1, 2, 3]), 6, 0.00001, "1 + 2 + 3 summed is 6")
@ -82,7 +83,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.
@ -113,6 +114,7 @@ fn decagon(radius):
fullDecagon = partialDecagon // it's now full fullDecagon = partialDecagon // it's now full
return fullDecagon */ return fullDecagon */
// Use the `decagon` function declared above, to sketch a decagon with radius 5. // Use the `decagon` function declared above, to sketch a decagon with radius 5.
decagon(5.0) decagon(5.0)
|> close() |> close()

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

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

@ -1,10 +1,10 @@
--- ---
title: "scale" title: "scale"
excerpt: "Scale a solid or a sketch." excerpt: "Scale a solid."
layout: manual layout: manual
--- ---
Scale a solid or a sketch. Scale a solid.
By default the transform is applied in local sketch axis, therefore the origin will not move. By default the transform is applied in local sketch axis, therefore the origin will not move.
@ -12,10 +12,10 @@ If you want to apply the transform in global space, set `global` to `true`. The
```js ```js
scale( scale(
objects: SolidOrSketchOrImportedGeometry, solids: SolidOrImportedGeometry,
scale: [number], scale: [number],
global?: bool, global?: bool,
): SolidOrSketchOrImportedGeometry ): SolidOrImportedGeometry
``` ```
@ -23,13 +23,13 @@ scale(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `objects` | [`SolidOrSketchOrImportedGeometry`](/docs/kcl/types/SolidOrSketchOrImportedGeometry) | The solid, sketch, or set of solids or sketches to scale. | Yes | | `solids` | [`SolidOrImportedGeometry`](/docs/kcl/types/SolidOrImportedGeometry) | The solid or set of solids to scale. | Yes |
| `scale` | [`[number]`](/docs/kcl/types/number) | The scale factor for the x, y, and z axes. | Yes | | `scale` | [`[number]`](/docs/kcl/types/number) | The scale factor for the x, y, and z axes. | Yes |
| `global` | [`bool`](/docs/kcl/types/bool) | If true, the transform is applied in global space. The origin of the model will move. By default, the transform is applied in local sketch axis, therefore the origin will not move. | No | | `global` | [`bool`](/docs/kcl/types/bool) | If true, the transform is applied in global space. The origin of the model will move. By default, the transform is applied in local sketch axis, therefore the origin will not move. | No |
### Returns ### Returns
[`SolidOrSketchOrImportedGeometry`](/docs/kcl/types/SolidOrSketchOrImportedGeometry) - Data for a solid or an imported geometry. [`SolidOrImportedGeometry`](/docs/kcl/types/SolidOrImportedGeometry) - Data for a solid or an imported geometry.
### Examples ### Examples
@ -37,8 +37,9 @@ scale(
```js ```js
// 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 +48,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 +76,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 +92,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)

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -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,

File diff suppressed because one or more lines are too long

View File

@ -1,12 +1,28 @@
--- ---
title: "std::Face" title: "Face"
excerpt: "A face." excerpt: "A face."
layout: manual layout: manual
--- ---
A face. A face.
**Type:** `object`
## Properties
| Property | Type | Description | Required |
|----------|------|-------------|----------|
| `id` |[`string`](/docs/kcl/types/string)| The id of the face. | No |
| `artifactId` |[`ArtifactId`](/docs/kcl/types/ArtifactId)| The artifact ID. | No |
| `value` |[`string`](/docs/kcl/types/string)| The tag of the face. | No |
| `xAxis` |[`Point3d`](/docs/kcl/types/Point3d)| What should the face's X axis be? | No |
| `yAxis` |[`Point3d`](/docs/kcl/types/Point3d)| What should the face's Y axis be? | No |
| `zAxis` |[`Point3d`](/docs/kcl/types/Point3d)| The z-axis (normal). | No |
| `solid` |[`Solid`](/docs/kcl/types/Solid)| The solid the face is on. | No |
| `units` |[`UnitLen`](/docs/kcl/types/UnitLen)| A unit of length. | No |

View File

@ -1,12 +1,26 @@
--- ---
title: "std::Helix" title: "Helix"
excerpt: "A helix." excerpt: "A helix."
layout: manual layout: manual
--- ---
A helix. A helix.
**Type:** `object`
## Properties
| Property | Type | Description | Required |
|----------|------|-------------|----------|
| `value` |[`string`](/docs/kcl/types/string)| The id of the helix. | No |
| `artifactId` |[`ArtifactId`](/docs/kcl/types/ArtifactId)| The artifact ID. | No |
| `revolutions` |[`number`](/docs/kcl/types/number)| Number of revolutions. | No |
| `angleStart` |[`number`](/docs/kcl/types/number)| Start angle (in degrees). | No |
| `ccw` |`boolean`| Is the helix rotation counter clockwise? | No |
| `units` |[`UnitLen`](/docs/kcl/types/UnitLen)| A unit of length. | No |

View File

@ -188,7 +188,7 @@ Any KCL value.
| Property | Type | Description | Required | | Property | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `type` |enum: [`Face`](/docs/kcl/types/Face)| | No | | `type` |enum: [`Face`](/docs/kcl/types/Face)| | No |
| `value` |[`Face`](/docs/kcl/types/Face)| | No | | `value` |[`Face`](/docs/kcl/types/Face)| A face. | No |
---- ----
@ -236,7 +236,7 @@ Any KCL value.
| Property | Type | Description | Required | | Property | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `type` |enum: [`Helix`](/docs/kcl/types/Helix)| | No | | `type` |enum: [`Helix`](/docs/kcl/types/Helix)| | No |
| `value` |[`Helix`](/docs/kcl/types/Helix)| | No | | `value` |[`Helix`](/docs/kcl/types/Helix)| A helix. | No |
---- ----

View File

@ -1,17 +0,0 @@
---
title: "std::Point2d"
excerpt: "A point in two dimensional space."
layout: manual
---
A point in two dimensional space.
```kcl
type Point2d = [number; 2]
```
`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]`.

View File

@ -1,17 +1,22 @@
--- ---
title: "std::Point3d" title: "Point3d"
excerpt: "A point in three dimensional space." excerpt: ""
layout: manual layout: manual
--- ---
A point in three dimensional space.
```kcl **Type:** `object`
type Point3d = [number; 3]
```
`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]`.
## Properties
| Property | Type | Description | Required |
|----------|------|-------------|----------|
| `x` |[`number`](/docs/kcl/types/number)| | No |
| `y` |[`number`](/docs/kcl/types/number)| | No |
| `z` |[`number`](/docs/kcl/types/number)| | No |

View File

@ -1,66 +0,0 @@
---
title: "SolidOrSketchOrImportedGeometry"
excerpt: "Data for a solid or an imported geometry."
layout: manual
---
Data for a solid or an imported geometry.
**This schema accepts exactly one of the following:**
Data for an imported geometry.
**Type:** `object`
## Properties
| Property | Type | Description | Required |
|----------|------|-------------|----------|
| `type` |enum: `importedGeometry`| | No |
| `id` |[`string`](/docs/kcl/types/string)| The ID of the imported geometry. | No |
| `value` |`[` [`string`](/docs/kcl/types/string) `]`| The original file paths. | No |
----
**Type:** `[object, array]`
`[` [`Solid`](/docs/kcl/types/Solid) `]`
## Properties
| Property | Type | Description | Required |
|----------|------|-------------|----------|
| `type` |enum: `solidSet`| | No |
----
**Type:** `[object, array]`
`[` [`Sketch`](/docs/kcl/types/Sketch) `]`
## Properties
| Property | Type | Description | Required |
|----------|------|-------------|----------|
| `type` |enum: `sketchSet`| | No |
----

View File

@ -22,6 +22,7 @@ A path to sweep along.
---- ----
A helix.
[`Helix`](/docs/kcl/types/Helix) [`Helix`](/docs/kcl/types/Helix)

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,6 @@ 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'
@ -47,7 +46,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()
@ -57,7 +56,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)
@ -66,14 +65,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})
@ -85,7 +84,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(`@settings(defaultLengthUnit = in)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})
@ -145,7 +144,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(`@settings(defaultLengthUnit = in)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,8 +153,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.fixme('code pane open at start', async ({ page, homePage }) => {
test.fixme(orRunWhenFullSuiteEnabled())
await doBasicSketch(page, homePage, ['code']) await doBasicSketch(page, homePage, ['code'])
}) })

View File

@ -46,7 +46,7 @@ test.describe(
}, },
} }
const code = `@settings(defaultLengthUnit = in)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,9 +1,6 @@
import { test, expect } from './zoo-test' import { test, expect } from './zoo-test'
import {
orRunWhenFullSuiteEnabled, import { getUtils, executorInputPath } from './test-utils'
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'
@ -22,7 +19,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])
@ -49,12 +46,11 @@ test.describe('Code pane and errors', { tag: ['@skipWin'] }, () => {
await expect(codePaneButtonHolder).toContainText('notification') await expect(codePaneButtonHolder).toContainText('notification')
}) })
test('Opening and closing the code pane will consistently show error diagnostics', async ({ test.skip('Opening and closing the code pane will consistently show error diagnostics', async ({
page, page,
homePage, homePage,
editor, editor,
}) => { }) => {
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
@ -123,47 +119,45 @@ test.describe('Code pane and errors', { tag: ['@skipWin'] }, () => {
await expect(page.locator('.cm-tooltip').first()).toBeVisible() await expect(page.locator('.cm-tooltip').first()).toBeVisible()
}) })
test('When error is not in view you can click the badge to scroll to it', async ({ test.fixme(
page, 'When error is not in view you can click the badge to scroll to it',
homePage, async ({ page, homePage, context }) => {
context, // Load the app with the working starter code
}) => { await context.addInitScript((code) => {
test.fixme(orRunWhenFullSuiteEnabled()) localStorage.setItem('persistCode', code)
// Load the app with the working starter code }, TEST_CODE_LONG_WITH_ERROR_OUT_OF_VIEW)
await context.addInitScript((code) => {
localStorage.setItem('persistCode', code)
}, TEST_CODE_LONG_WITH_ERROR_OUT_OF_VIEW)
await page.setBodyDimensions({ width: 1200, height: 500 }) await page.setBodyDimensions({ width: 1200, height: 500 })
await homePage.goToModelingScene() await homePage.goToModelingScene()
await page.waitForTimeout(1000) await page.waitForTimeout(1000)
// Ensure badge is present // Ensure badge is present
const codePaneButtonHolder = page.locator('#code-button-holder') const codePaneButtonHolder = page.locator('#code-button-holder')
await expect(codePaneButtonHolder).toContainText('notification') await expect(codePaneButtonHolder).toContainText('notification')
// Ensure we have no errors in the gutter, since error out of view. // Ensure we have no errors in the gutter, since error out of view.
await expect(page.locator('.cm-lint-marker-error')).not.toBeVisible() await expect(page.locator('.cm-lint-marker-error')).not.toBeVisible()
// Click the badge. // Click the badge.
const badge = page.locator('#code-badge') const badge = page.locator('#code-badge')
await expect(badge).toBeVisible() await expect(badge).toBeVisible()
await badge.click() await badge.click()
// Ensure we have an error diagnostic. // Ensure we have an error diagnostic.
await expect(page.locator('.cm-lint-marker-error').first()).toBeVisible() await expect(page.locator('.cm-lint-marker-error').first()).toBeVisible()
// Hover over the error to see the error message // Hover over the error to see the error message
await page.hover('.cm-lint-marker-error') await page.hover('.cm-lint-marker-error')
await expect( await expect(
page page
.getByText( .getByText(
'Modeling command failed: [ApiError { error_code: InternalEngine, message: "Solid3D revolve failed: sketch profile must lie entirely on one side of the revolution axis" }]' 'Modeling command failed: [ApiError { error_code: InternalEngine, message: "Solid3D revolve failed: sketch profile must lie entirely on one side of the revolution axis" }]'
) )
.first() .first()
).toBeVisible() ).toBeVisible()
}) }
)
test('When error is not in view WITH LINTS you can click the badge to scroll to it', async ({ test('When error is not in view WITH LINTS you can click the badge to scroll to it', async ({
context, context,
@ -250,11 +244,11 @@ test(
]) ])
await Promise.all([ await Promise.all([
fsp.copyFile( fsp.copyFile(
executorInputPath('cylinder-inches.kcl'), executorInputPath('router-template-slate.kcl'),
join(routerTemplateDir, 'main.kcl') join(routerTemplateDir, 'main.kcl')
), ),
fsp.copyFile( fsp.copyFile(
executorInputPath('e2e-can-sketch-on-chamfer.kcl'), executorInputPath('focusrite_scarlett_mounting_braket.kcl'),
join(bracketDir, 'main.kcl') join(bracketDir, 'main.kcl')
), ),
]) ])

View File

@ -1,12 +1,8 @@
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 { import { executorInputPath, getUtils } from './test-utils'
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 from 'path'
test.describe('Command bar tests', { tag: ['@skipWin'] }, () => { test.describe('Command bar tests', { tag: ['@skipWin'] }, () => {
test('Extrude from command bar selects extrude line after', async ({ test('Extrude from command bar selects extrude line after', async ({
@ -16,7 +12,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])
@ -51,12 +47,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.fixme('Fillet from command bar', async ({ page, homePage }) => {
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])
@ -239,7 +234,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])
@ -492,105 +487,4 @@ test.describe('Command bar tests', { tag: ['@skipWin'] }, () => {
await toolbar.expectFileTreeState(['main.kcl', 'test.kcl']) await toolbar.expectFileTreeState(['main.kcl', 'test.kcl'])
}) })
}) })
test(`Can add and edit a named parameter or constant`, async ({
page,
homePage,
context,
cmdBar,
scene,
editor,
}) => {
const projectName = 'test'
const beforeKclCode = `a = 5
b = a * a
c = 3 + a`
await context.folderSetupFn(async (dir) => {
const testProject = join(dir, projectName)
await fsp.mkdir(testProject, { recursive: true })
await fsp.writeFile(join(testProject, 'main.kcl'), beforeKclCode, 'utf-8')
})
await homePage.openProject(projectName)
// TODO: you probably shouldn't need an engine connection to add a parameter,
// but you do because all modeling commands have that requirement
await scene.settled(cmdBar)
await test.step(`Create a parameter via command bar`, async () => {
await cmdBar.cmdBarOpenBtn.click()
await cmdBar.chooseCommand('create parameter')
await cmdBar.expectState({
stage: 'arguments',
commandName: 'Create parameter',
currentArgKey: 'value',
currentArgValue: '5',
headerArguments: {
Value: '',
},
highlightedHeaderArg: 'value',
})
await cmdBar.argumentInput.locator('[contenteditable]').fill(`b - 5`)
// TODO: we have no loading indicator for the KCL argument input calculation
await page.waitForTimeout(100)
await cmdBar.progressCmdBar()
await cmdBar.expectState({
stage: 'commandBarClosed',
})
})
await editor.expectEditor.toContain(
`a = 5b = a * amyParameter001 = b - 5c = 3 + a`
)
const newValue = `2 * b + a`
await test.step(`Edit the parameter via command bar`, async () => {
await cmdBar.cmdBarOpenBtn.click()
await cmdBar.chooseCommand('edit parameter')
await cmdBar.expectState({
stage: 'arguments',
commandName: 'Edit parameter',
currentArgKey: 'Name',
currentArgValue: '',
headerArguments: {
Name: '',
Value: '',
},
highlightedHeaderArg: 'Name',
})
await cmdBar
.selectOption({
name: 'myParameter001',
})
.click()
await cmdBar.expectState({
stage: 'arguments',
commandName: 'Edit parameter',
currentArgKey: 'value',
currentArgValue: 'b - 5',
headerArguments: {
Name: 'myParameter001',
Value: '',
},
highlightedHeaderArg: 'value',
})
await cmdBar.argumentInput.locator('[contenteditable]').fill(newValue)
await cmdBar.progressCmdBar()
await cmdBar.expectState({
stage: 'review',
commandName: 'Edit parameter',
headerArguments: {
Name: 'myParameter001',
// KCL inputs show the *computed* value, not the input value, in the command palette header
Value: '55',
},
})
await cmdBar.progressCmdBar()
await cmdBar.expectState({
stage: 'commandBarClosed',
})
})
await editor.expectEditor.toContain(
`a = 5b = a * amyParameter001 = ${newValue}c = 3 + a`
)
})
}) })

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