Compare commits
106 Commits
v0.49.0
...
jtran/prom
Author | SHA1 | Date | |
---|---|---|---|
5ab814d153 | |||
fe83cd94ca | |||
5178a72c52 | |||
f4e801351c | |||
7329753211 | |||
7d46e7e271 | |||
0583eb07d5 | |||
73694563cf | |||
bb4ed59191 | |||
566143757f | |||
822f2ffc73 | |||
eb3ceba497 | |||
2c6d0621c9 | |||
d8e84cb5e3 | |||
0b1e79871f | |||
954fddf578 | |||
f94f748339 | |||
e2b7b22ca9 | |||
efc8c82d8b | |||
eac5abba79 | |||
1956c14b8a | |||
017fac7041 | |||
0bdc50c78f | |||
57d78b6094 | |||
db5ce7ba85 | |||
51c16d0048 | |||
6532b23f1c | |||
49304b9ecd | |||
358b34de4c | |||
9973e5fde3 | |||
36875e05fd | |||
42123383bb | |||
ef4c606ed1 | |||
1ebb73b935 | |||
b57d31c0e7 | |||
678ebbc310 | |||
cc2efd316c | |||
d1f811f91d | |||
7ca3afff9f | |||
71b9e40bd9 | |||
4f35197a96 | |||
40b0cf5fd3 | |||
355e6acf0d | |||
4ff38e7f44 | |||
1dcd3b84b7 | |||
2957216bd3 | |||
11160f0b40 | |||
4b2c745db5 | |||
bb983021b1 | |||
d27b8871bc | |||
1753047d87 | |||
fa16fcedff | |||
0677474097 | |||
0c4826cdd5 | |||
b6fe660b84 | |||
c53fa421ad | |||
736533a482 | |||
a15565682d | |||
58861cd24a | |||
c0cdcb1b98 | |||
41f45afb3c | |||
e4edffa569 | |||
c28bad267a | |||
81f92bc7f9 | |||
58dc3382eb | |||
f7f7d9fa2c | |||
8c3408fda3 | |||
7c9f1248d4 | |||
89dd4fb039 | |||
fdeb2b3f49 | |||
65c455ae7c | |||
c3e12e5ff7 | |||
4dce1612c1 | |||
1b98897120 | |||
3b2abe5814 | |||
dddcd5ff46 | |||
cfbb03765e | |||
0d0dd1019b | |||
de2b1b3bea | |||
3464f93a30 | |||
f6936f55d6 | |||
eef1a28ebb | |||
5aed80e930 | |||
5654e9daaa | |||
d443576c7c | |||
e00317f316 | |||
c2f1ff67f2 | |||
869126e436 | |||
e8feb0309b | |||
06b35b76ff | |||
89d1f7f3d3 | |||
66b9b501ac | |||
9248b2e42d | |||
054bb5b500 | |||
12b546ea24 | |||
bc6c40c1e8 | |||
1d550da40b | |||
9da8574103 | |||
2c6404f671 | |||
09c6f51141 | |||
755c7df59c | |||
73b38cd9e2 | |||
227cb70d72 | |||
b36e416ab2 | |||
612d03bf73 | |||
c8ec35cd4a |
@ -1,5 +1,6 @@
|
|||||||
NODE_ENV=development
|
NODE_ENV=development
|
||||||
DEV=true
|
DEV=true
|
||||||
|
|
||||||
VITE_KC_API_WS_MODELING_URL=wss://api.dev.zoo.dev/ws/modeling/commands
|
VITE_KC_API_WS_MODELING_URL=wss://api.dev.zoo.dev/ws/modeling/commands
|
||||||
VITE_KC_API_BASE_URL=https://api.dev.zoo.dev
|
VITE_KC_API_BASE_URL=https://api.dev.zoo.dev
|
||||||
VITE_KC_SITE_BASE_URL=https://dev.zoo.dev
|
VITE_KC_SITE_BASE_URL=https://dev.zoo.dev
|
||||||
@ -8,3 +9,5 @@ VITE_KC_SKIP_AUTH=false
|
|||||||
VITE_KC_CONNECTION_TIMEOUT_MS=5000
|
VITE_KC_CONNECTION_TIMEOUT_MS=5000
|
||||||
# ONLY add your token in .env.development.local if you want to skip auth, otherwise this token takes precedence!
|
# ONLY add your token in .env.development.local if you want to skip auth, otherwise this token takes precedence!
|
||||||
#VITE_KC_DEV_TOKEN="your token from dev.zoo.dev should go in .env.development.local"
|
#VITE_KC_DEV_TOKEN="your token from dev.zoo.dev should go in .env.development.local"
|
||||||
|
|
||||||
|
FAIL_ON_CONSOLE_ERRORS=true
|
||||||
|
12
.envrc
12
.envrc
@ -1 +1,13 @@
|
|||||||
|
# Load optional shared environment variables
|
||||||
|
source_up_if_exists
|
||||||
|
|
||||||
|
# Load default development environment variables
|
||||||
|
dotenv .env.development
|
||||||
|
|
||||||
|
# Load optional environment variables overrides
|
||||||
|
dotenv_if_exists .env.development.local
|
||||||
|
|
||||||
|
# Load optional testing environment variables
|
||||||
|
dotenv_if_exists e2e/playwright/playwright-secrets.env
|
||||||
|
|
||||||
use flake .
|
use flake .
|
||||||
|
31
.eslintrc
31
.eslintrc
@ -20,8 +20,26 @@
|
|||||||
"plugin:react-hooks/recommended"
|
"plugin:react-hooks/recommended"
|
||||||
],
|
],
|
||||||
"rules": {
|
"rules": {
|
||||||
|
"no-array-constructor": "off", // This is wrong; use the @typescript-eslint one instead.
|
||||||
|
"@typescript-eslint/no-array-constructor": "error",
|
||||||
|
"@typescript-eslint/no-array-delete": "error",
|
||||||
|
"@typescript-eslint/no-duplicate-enum-values": "error",
|
||||||
|
"@typescript-eslint/no-duplicate-type-constituents": "error",
|
||||||
|
"@typescript-eslint/no-empty-object-type": "error",
|
||||||
|
"@typescript-eslint/no-extra-non-null-assertion": "error",
|
||||||
"@typescript-eslint/no-floating-promises": "error",
|
"@typescript-eslint/no-floating-promises": "error",
|
||||||
|
"@typescript-eslint/no-for-in-array": "error",
|
||||||
|
"no-implied-eval": "off", // This is wrong; use the @typescript-eslint one instead.
|
||||||
|
"@typescript-eslint/no-implied-eval": "error",
|
||||||
|
"@typescript-eslint/no-misused-new": "error",
|
||||||
"@typescript-eslint/no-misused-promises": "error",
|
"@typescript-eslint/no-misused-promises": "error",
|
||||||
|
"@typescript-eslint/no-namespace": "error",
|
||||||
|
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
|
||||||
|
"@typescript-eslint/no-redundant-type-constituents": "error",
|
||||||
|
"@typescript-eslint/no-this-alias": "warn",
|
||||||
|
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
||||||
|
"@typescript-eslint/no-unnecessary-type-constraint": "error",
|
||||||
|
"no-unused-vars": "off", // This is wrong; use the @typescript-eslint one instead.
|
||||||
"@typescript-eslint/no-unused-vars": ["error", {
|
"@typescript-eslint/no-unused-vars": ["error", {
|
||||||
"varsIgnorePattern": "^_",
|
"varsIgnorePattern": "^_",
|
||||||
"argsIgnorePattern": "^_",
|
"argsIgnorePattern": "^_",
|
||||||
@ -29,6 +47,13 @@
|
|||||||
"vars": "all",
|
"vars": "all",
|
||||||
"args": "none"
|
"args": "none"
|
||||||
}],
|
}],
|
||||||
|
"@typescript-eslint/no-unsafe-unary-minus": "error",
|
||||||
|
"@typescript-eslint/no-wrapper-object-types": "error",
|
||||||
|
"no-throw-literal": "off", // Use @typescript-eslint/only-throw-error instead.
|
||||||
|
"@typescript-eslint/only-throw-error": "error",
|
||||||
|
"@typescript-eslint/prefer-as-const": "warn",
|
||||||
|
"@typescript-eslint/prefer-namespace-keyword": "error",
|
||||||
|
"@typescript-eslint/restrict-plus-operands": "error",
|
||||||
"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",
|
||||||
@ -37,7 +62,7 @@
|
|||||||
{
|
{
|
||||||
"name": "isNaN",
|
"name": "isNaN",
|
||||||
"message": "Use Number.isNaN() instead."
|
"message": "Use Number.isNaN() instead."
|
||||||
},
|
}
|
||||||
],
|
],
|
||||||
"no-restricted-syntax": [
|
"no-restricted-syntax": [
|
||||||
"error",
|
"error",
|
||||||
@ -51,7 +76,7 @@
|
|||||||
"never"
|
"never"
|
||||||
],
|
],
|
||||||
"react-hooks/exhaustive-deps": "off",
|
"react-hooks/exhaustive-deps": "off",
|
||||||
"suggest-no-throw/suggest-no-throw": "warn",
|
"suggest-no-throw/suggest-no-throw": "error"
|
||||||
},
|
},
|
||||||
"overrides": [
|
"overrides": [
|
||||||
{
|
{
|
||||||
@ -71,7 +96,7 @@
|
|||||||
"plugin:testing-library/react"
|
"plugin:testing-library/react"
|
||||||
],
|
],
|
||||||
"rules": {
|
"rules": {
|
||||||
"suggest-no-throw/suggest-no-throw": "off",
|
"suggest-no-throw/suggest-no-throw": "off"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
4
.github/actions/github-release/package.json
vendored
4
.github/actions/github-release/package.json
vendored
@ -4,7 +4,7 @@
|
|||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.6",
|
"@actions/core": "^1.6",
|
||||||
"@actions/github": "^5.0",
|
"@actions/github": "^6.0",
|
||||||
"glob": "^7.1.5"
|
"glob": "^11.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
38
.github/ci-cd-scripts/playwright-electron.sh
vendored
38
.github/ci-cd-scripts/playwright-electron.sh
vendored
@ -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 plawright normally
|
# If no last run artifact, than run Playwright 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
|
||||||
# # send to axiom
|
# Log failures for Axiom to pick up
|
||||||
node playwrightProcess.mjs | tee /tmp/github-actions.log > /dev/null 2>&1
|
node playwrightProcess.mjs > /tmp/github-actions.log
|
||||||
fi
|
fi
|
||||||
|
|
||||||
retry=1
|
retry=1
|
||||||
max_retrys=1
|
max_retries=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_retrys ]]; do
|
while [[ $retry -le $max_retries ]]; 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_retrys ]]; 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
|
||||||
# send to axiom
|
# Log failures for Axiom to pick up
|
||||||
node playwrightProcess.mjs | tee /tmp/github-actions.log > /dev/null 2>&1
|
node playwrightProcess.mjs > /tmp/github-actions.log
|
||||||
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 retrys, then fail the job
|
# If it still fails after 3 retries, then fail the job
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
2
.github/workflows/build-and-store-wasm.yml
vendored
2
.github/workflows/build-and-store-wasm.yml
vendored
@ -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@955a6ff1416eae278c9f833008a9beb4b7f9afe3
|
- uses: taiki-e/install-action@37bdc826eaedac215f638a96472df572feab0f9b
|
||||||
with:
|
with:
|
||||||
tool: wasm-pack
|
tool: wasm-pack
|
||||||
- name: Rust Cache
|
- name: Rust Cache
|
||||||
|
2
.github/workflows/build-apps.yml
vendored
2
.github/workflows/build-apps.yml
vendored
@ -77,7 +77,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
cache: false # Configured below.
|
cache: false # Configured below.
|
||||||
|
|
||||||
- uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
|
- uses: taiki-e/install-action@37bdc826eaedac215f638a96472df572feab0f9b
|
||||||
if: ${{ steps.wasm.outputs.should-build-wasm == 'true' }}
|
if: ${{ steps.wasm.outputs.should-build-wasm == 'true' }}
|
||||||
with:
|
with:
|
||||||
tool: wasm-pack
|
tool: wasm-pack
|
||||||
|
49
.github/workflows/e2e-tests.yml
vendored
49
.github/workflows/e2e-tests.yml
vendored
@ -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:
|
||||||
@ -137,7 +140,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
cache: false # Configured below.
|
cache: false # Configured below.
|
||||||
|
|
||||||
- uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
|
- uses: taiki-e/install-action@37bdc826eaedac215f638a96472df572feab0f9b
|
||||||
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
|
||||||
@ -159,7 +162,6 @@ jobs:
|
|||||||
name: prepared-wasm
|
name: prepared-wasm
|
||||||
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
|
||||||
@ -227,10 +229,6 @@ jobs:
|
|||||||
timeout_minutes: 30
|
timeout_minutes: 30
|
||||||
max_attempts: 3
|
max_attempts: 3
|
||||||
env:
|
env:
|
||||||
CI: true
|
|
||||||
NODE_ENV: development
|
|
||||||
VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
|
||||||
VITE_KC_SKIP_AUTH: true
|
|
||||||
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
||||||
snapshottoken: ${{ secrets.KITTYCAD_API_TOKEN }}
|
snapshottoken: ${{ secrets.KITTYCAD_API_TOKEN }}
|
||||||
|
|
||||||
@ -243,7 +241,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
|
||||||
@ -255,7 +253,8 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Commit changes, if any
|
- name: Commit changes, if any
|
||||||
if: ${{ needs.conditions.outputs.should-run == 'true' && steps.git-check.outputs.modified == 'true' }}
|
# TODO: find a more reliable way to detect visual changes
|
||||||
|
if: ${{ false && needs.conditions.outputs.should-run == 'true' && steps.git-check.outputs.modified == 'true' }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
git add e2e/playwright/snapshot-tests.spec.ts-snapshots e2e/playwright/snapshots
|
git add e2e/playwright/snapshot-tests.spec.ts-snapshots e2e/playwright/snapshots
|
||||||
@ -340,14 +339,22 @@ jobs:
|
|||||||
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 good sed
|
- name: Install vector
|
||||||
if: startsWith(matrix.os, 'macos')
|
if: ${{ needs.conditions.outputs.should-run == 'true' && contains(matrix.os, 'ubuntu') }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
brew install gnu-sed
|
curl --proto '=https' --tlsv1.2 -sSfL https://sh.vector.dev > /tmp/vector.sh
|
||||||
echo "/opt/homebrew/opt/gnu-sed/libexec/gnubin" >> $GITHUB_PATH
|
chmod +x /tmp/vector.sh
|
||||||
|
/tmp/vector.sh -y -no-modify-path
|
||||||
# TODO: Add back axiom logs
|
mkdir -p /tmp/vector
|
||||||
|
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()) }}
|
||||||
@ -366,11 +373,7 @@ jobs:
|
|||||||
timeout_minutes: 45
|
timeout_minutes: 45
|
||||||
max_attempts: 15
|
max_attempts: 15
|
||||||
env:
|
env:
|
||||||
CI: true
|
|
||||||
FAIL_ON_CONSOLE_ERRORS: true
|
FAIL_ON_CONSOLE_ERRORS: true
|
||||||
NODE_ENV: development
|
|
||||||
VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
|
||||||
VITE_KC_SKIP_AUTH: true
|
|
||||||
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
|
2
.github/workflows/kcl-language-server.yml
vendored
2
.github/workflows/kcl-language-server.yml
vendored
@ -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.2
|
uses: google-github-actions/setup-gcloud@v2.1.4
|
||||||
with:
|
with:
|
||||||
project_id: kittycadapi
|
project_id: kittycadapi
|
||||||
- name: "upload files to gcp"
|
- name: "upload files to gcp"
|
||||||
|
154
.github/workflows/static-analysis.yml
vendored
154
.github/workflows/static-analysis.yml
vendored
@ -28,43 +28,57 @@ jobs:
|
|||||||
- run: yarn fmt-check
|
- run: yarn fmt-check
|
||||||
|
|
||||||
yarn-build-wasm:
|
yarn-build-wasm:
|
||||||
runs-on: ubuntu-22.04
|
# Build the wasm blob once on the fastest runner.
|
||||||
|
runs-on: runs-on=${{ github.run_id }}/family=i7ie.2xlarge/image=ubuntu22-full-x64
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
cache: 'yarn'
|
cache: 'yarn'
|
||||||
- run: yarn install
|
|
||||||
- uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
|
- name: Install dependencies
|
||||||
|
run: yarn install
|
||||||
|
|
||||||
|
- name: Use correct Rust toolchain
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
[ -e rust-toolchain.toml ] || cp rust/rust-toolchain.toml ./
|
||||||
|
|
||||||
|
- name: Install rust
|
||||||
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
with:
|
||||||
|
cache: false # Configured below.
|
||||||
|
|
||||||
|
- uses: taiki-e/install-action@37bdc826eaedac215f638a96472df572feab0f9b
|
||||||
with:
|
with:
|
||||||
tool: wasm-pack
|
tool: wasm-pack
|
||||||
- run: yarn build:wasm
|
|
||||||
|
|
||||||
yarn-tsc:
|
- name: Rust Cache
|
||||||
runs-on: ubuntu-22.04
|
uses: Swatinem/rust-cache@v2
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version-file: '.nvmrc'
|
|
||||||
cache: 'yarn'
|
|
||||||
- run: yarn install
|
|
||||||
- run: yarn --cwd ./rust/kcl-language-server --modules-folder node_modules install
|
|
||||||
- uses: Swatinem/rust-cache@v2
|
|
||||||
with:
|
with:
|
||||||
workspaces: './rust'
|
workspaces: './rust'
|
||||||
|
|
||||||
- uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
|
- name: Build Wasm
|
||||||
with:
|
shell: bash
|
||||||
tool: wasm-pack
|
run: yarn build:wasm
|
||||||
- run: yarn build:wasm
|
|
||||||
- run: yarn tsc
|
|
||||||
|
|
||||||
yarn-lint:
|
- uses: actions/upload-artifact@v4
|
||||||
runs-on: ubuntu-22.04
|
with:
|
||||||
|
name: prepared-wasm
|
||||||
|
path: |
|
||||||
|
rust/kcl-wasm-lib/pkg/kcl_wasm_lib*
|
||||||
|
|
||||||
|
- uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: prepared-ts-rs-bindings
|
||||||
|
path: |
|
||||||
|
rust/kcl-lib/bindings/*
|
||||||
|
|
||||||
|
yarn-tsc:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: yarn-build-wasm
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
@ -73,7 +87,53 @@ jobs:
|
|||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
cache: 'yarn'
|
cache: 'yarn'
|
||||||
- run: yarn install
|
- run: yarn install
|
||||||
- run: yarn --cwd ./rust/kcl-language-server --modules-folder node_modules install
|
|
||||||
|
- name: Download all artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
|
||||||
|
- name: Copy prepared wasm
|
||||||
|
run: |
|
||||||
|
ls -R prepared-wasm
|
||||||
|
cp prepared-wasm/kcl_wasm_lib_bg.wasm public
|
||||||
|
mkdir rust/kcl-wasm-lib/pkg
|
||||||
|
cp prepared-wasm/kcl_wasm_lib* rust/kcl-wasm-lib/pkg
|
||||||
|
|
||||||
|
- name: Copy prepared ts-rs bindings
|
||||||
|
run: |
|
||||||
|
ls -R prepared-ts-rs-bindings
|
||||||
|
mkdir rust/kcl-lib/bindings
|
||||||
|
cp -r prepared-ts-rs-bindings/* rust/kcl-lib/bindings/
|
||||||
|
|
||||||
|
- run: yarn tsc
|
||||||
|
|
||||||
|
yarn-lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: yarn-build-wasm
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version-file: '.nvmrc'
|
||||||
|
cache: 'yarn'
|
||||||
|
- run: yarn install
|
||||||
|
|
||||||
|
- name: Download all artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
|
||||||
|
- name: Copy prepared wasm
|
||||||
|
run: |
|
||||||
|
ls -R prepared-wasm
|
||||||
|
cp prepared-wasm/kcl_wasm_lib_bg.wasm public
|
||||||
|
mkdir rust/kcl-wasm-lib/pkg
|
||||||
|
cp prepared-wasm/kcl_wasm_lib* rust/kcl-wasm-lib/pkg
|
||||||
|
|
||||||
|
- name: Copy prepared ts-rs bindings
|
||||||
|
run: |
|
||||||
|
ls -R prepared-ts-rs-bindings
|
||||||
|
mkdir rust/kcl-lib/bindings
|
||||||
|
cp -r prepared-ts-rs-bindings/* rust/kcl-lib/bindings/
|
||||||
|
|
||||||
- run: yarn lint
|
- run: yarn lint
|
||||||
|
|
||||||
python-codespell:
|
python-codespell:
|
||||||
@ -91,6 +151,7 @@ jobs:
|
|||||||
|
|
||||||
yarn-unit-test-kcl-samples:
|
yarn-unit-test-kcl-samples:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: yarn-build-wasm
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
@ -100,10 +161,25 @@ jobs:
|
|||||||
cache: 'yarn'
|
cache: 'yarn'
|
||||||
|
|
||||||
- run: yarn install
|
- run: yarn install
|
||||||
- uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
|
- uses: taiki-e/install-action@37bdc826eaedac215f638a96472df572feab0f9b
|
||||||
with:
|
with:
|
||||||
tool: wasm-pack
|
tool: wasm-pack
|
||||||
- run: yarn build:wasm
|
|
||||||
|
- name: Download all artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
|
||||||
|
- name: Copy prepared wasm
|
||||||
|
run: |
|
||||||
|
ls -R prepared-wasm
|
||||||
|
cp prepared-wasm/kcl_wasm_lib_bg.wasm public
|
||||||
|
mkdir rust/kcl-wasm-lib/pkg
|
||||||
|
cp prepared-wasm/kcl_wasm_lib* rust/kcl-wasm-lib/pkg
|
||||||
|
|
||||||
|
- name: Copy prepared ts-rs bindings
|
||||||
|
run: |
|
||||||
|
ls -R prepared-ts-rs-bindings
|
||||||
|
mkdir rust/kcl-lib/bindings
|
||||||
|
cp -r prepared-ts-rs-bindings/* rust/kcl-lib/bindings/
|
||||||
|
|
||||||
- run: yarn simpleserver:bg
|
- run: yarn simpleserver:bg
|
||||||
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
|
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
|
||||||
@ -120,6 +196,7 @@ jobs:
|
|||||||
|
|
||||||
yarn-unit-test:
|
yarn-unit-test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: yarn-build-wasm
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
@ -129,10 +206,25 @@ jobs:
|
|||||||
cache: 'yarn'
|
cache: 'yarn'
|
||||||
|
|
||||||
- run: yarn install
|
- run: yarn install
|
||||||
- uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
|
- uses: taiki-e/install-action@37bdc826eaedac215f638a96472df572feab0f9b
|
||||||
with:
|
with:
|
||||||
tool: wasm-pack
|
tool: wasm-pack
|
||||||
- run: yarn build:wasm
|
|
||||||
|
- name: Download all artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
|
||||||
|
- name: Copy prepared wasm
|
||||||
|
run: |
|
||||||
|
ls -R prepared-wasm
|
||||||
|
cp prepared-wasm/kcl_wasm_lib_bg.wasm public
|
||||||
|
mkdir rust/kcl-wasm-lib/pkg
|
||||||
|
cp prepared-wasm/kcl_wasm_lib* rust/kcl-wasm-lib/pkg
|
||||||
|
|
||||||
|
- name: Copy prepared ts-rs bindings
|
||||||
|
run: |
|
||||||
|
ls -R prepared-ts-rs-bindings
|
||||||
|
mkdir rust/kcl-lib/bindings
|
||||||
|
cp -r prepared-ts-rs-bindings/* rust/kcl-lib/bindings/
|
||||||
|
|
||||||
- run: yarn simpleserver:bg
|
- run: yarn simpleserver:bg
|
||||||
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
|
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
|
||||||
@ -141,13 +233,13 @@ jobs:
|
|||||||
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
|
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
|
||||||
run: yarn playwright install chromium --with-deps
|
run: yarn playwright install chromium --with-deps
|
||||||
|
|
||||||
- name: run unit tests
|
- name: Run unit tests
|
||||||
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
|
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
|
||||||
run: xvfb-run -a yarn test:unit
|
run: xvfb-run -a yarn test:unit
|
||||||
env:
|
env:
|
||||||
VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
||||||
|
|
||||||
- name: check for changes
|
- name: Check for changes
|
||||||
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
|
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
|
||||||
id: git-check
|
id: git-check
|
||||||
run: |
|
run: |
|
||||||
|
5
.github/workflows/update-dev-branch.yml
vendored
5
.github/workflows/update-dev-branch.yml
vendored
@ -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
|
||||||
|
45
.github/workflows/update-e2e-branch.yml
vendored
Normal file
45
.github/workflows/update-e2e-branch.yml
vendored
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
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/create-github-app-token@v1
|
||||||
|
id: app-token
|
||||||
|
with:
|
||||||
|
app-id: ${{ secrets.MODELING_APP_GH_APP_ID }}
|
||||||
|
private-key: ${{ secrets.MODELING_APP_GH_APP_PRIVATE_KEY }}
|
||||||
|
owner: ${{ github.repository_owner }}
|
||||||
|
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
token: ${{ steps.app-token.outputs.token }}
|
||||||
|
|
||||||
|
- name: Sync with main
|
||||||
|
run: |
|
||||||
|
# Create the branch
|
||||||
|
git checkout all-e2e || git checkout -b all-e2e
|
||||||
|
|
||||||
|
# Reset to main
|
||||||
|
git fetch origin
|
||||||
|
git reset --hard origin/main
|
||||||
|
|
||||||
|
# Get a new SHA to prevent overwriting the commit status on main
|
||||||
|
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
git config --local user.name "github-actions[bot]"
|
||||||
|
git commit --allow-empty --message="[all-e2e] $(git log --max-count=1 --pretty=%B)"
|
||||||
|
|
||||||
|
# Overwrite the branch
|
||||||
|
git remote set-url origin https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/${{ github.repository }}.git
|
||||||
|
git push --force origin all-e2e
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -50,6 +50,7 @@ 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
|
||||||
|
132
Makefile
132
Makefile
@ -1,12 +1,125 @@
|
|||||||
.PHONY: dev
|
.PHONY: all
|
||||||
|
all: install build check
|
||||||
|
|
||||||
KCL_WASM_LIB_FILES := $(wildcard rust/**/*.rs)
|
###############################################################################
|
||||||
TS_SRC := $(wildcard src/**/*.tsx) $(wildcard src/**/*.ts)
|
# INSTALL
|
||||||
XSTATE_TYPEGENS := $(wildcard src/machines/*.typegen.ts)
|
|
||||||
|
|
||||||
dev: node_modules public/kcl_wasm_lib_bg.wasm $(XSTATE_TYPEGENS)
|
WASM_PACK ?= ~/.cargo/bin/wasm-pack
|
||||||
|
|
||||||
|
.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
|
||||||
|
|
||||||
|
CARGO_SOURCES := rust/.cargo/config.toml $(wildcard rust/Cargo.*) $(wildcard rust/**/Cargo.*)
|
||||||
|
RUST_SOURCES := $(wildcard rust/**/*.rs)
|
||||||
|
|
||||||
|
REACT_SOURCES := $(wildcard src/*.tsx) $(wildcard src/**/*.tsx)
|
||||||
|
TYPESCRIPT_SOURCES := tsconfig.* $(wildcard src/*.ts) $(wildcard src/**/*.ts)
|
||||||
|
VITE_SOURCES := $(wildcard vite.*) $(wildcard vite/**/*.tsx)
|
||||||
|
|
||||||
|
.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: $(CARGO_SOURCES)$(RUST_SOURCES)
|
||||||
|
yarn build:wasm:dev
|
||||||
|
|
||||||
|
build/index.html: $(REACT_SOURCES) $(TYPESCRIPT_SOURCES) $(VITE_SOURCES)
|
||||||
|
yarn build:local
|
||||||
|
|
||||||
|
.vite/build/main.js: $(REACT_SOURCES) $(TYPESCRIPT_SOURCES) $(VITE_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
|
||||||
|
|
||||||
|
E2E_WORKERS ?= 1
|
||||||
|
E2E_FAILURES ?= 1
|
||||||
|
E2E_GREP ?= ""
|
||||||
|
|
||||||
|
.PHONY: test
|
||||||
|
test: test-unit test-e2e
|
||||||
|
|
||||||
|
.PHONY: test-unit
|
||||||
|
test-unit: install ## Run the unit tests
|
||||||
|
@ curl -fs localhost:3000 >/dev/null || ( echo "Error: localhost:3000 not available, 'make run-web' first" && exit 1 )
|
||||||
|
yarn test:unit
|
||||||
|
|
||||||
|
.PHONY: test-e2e
|
||||||
|
test-e2e: test-e2e-desktop
|
||||||
|
|
||||||
|
.PHONY: test-e2e-web
|
||||||
|
test-e2e-web: install build-web ## Run the web e2e tests
|
||||||
|
@ curl -fs localhost:3000 >/dev/null || ( echo "Error: localhost:3000 not available, 'make run-web' first" && exit 1 )
|
||||||
|
yarn chrome:test --headed --workers=$(E2E_WORKERS) --max-failures=$(E2E_FAILURES) --grep=$(E2E_GREP)
|
||||||
|
|
||||||
|
.PHONY: test-e2e-desktop
|
||||||
|
test-e2e-desktop: install build-desktop ## Run the desktop e2e tests
|
||||||
|
yarn test:playwright:electron --workers=$(E2E_WORKERS) --max-failures=$(E2E_FAILURES) --grep="$(E2E_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.
|
||||||
@ -14,12 +127,3 @@ 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
|
|
||||||
|
@ -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 }, %)
|
||||||
|
@ -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)),
|
||||||
|
@ -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], %)
|
||||||
|
@ -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({
|
||||||
|
@ -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)
|
||||||
|
@ -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)),
|
||||||
|
@ -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)),
|
||||||
|
@ -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)),
|
||||||
|
@ -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])
|
||||||
|
@ -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
@ -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)
|
||||||
```
|
```
|
||||||
|
@ -9,13 +9,9 @@ layout: manual
|
|||||||
|
|
||||||
### `std`
|
### `std`
|
||||||
|
|
||||||
- [`HALF_TURN`](/docs/kcl/consts/std-HALF_TURN)
|
|
||||||
- [`QUARTER_TURN`](/docs/kcl/consts/std-QUARTER_TURN)
|
|
||||||
- [`THREE_QUARTER_TURN`](/docs/kcl/consts/std-THREE_QUARTER_TURN)
|
|
||||||
- [`XY`](/docs/kcl/consts/std-XY)
|
- [`XY`](/docs/kcl/consts/std-XY)
|
||||||
- [`XZ`](/docs/kcl/consts/std-XZ)
|
- [`XZ`](/docs/kcl/consts/std-XZ)
|
||||||
- [`YZ`](/docs/kcl/consts/std-YZ)
|
- [`YZ`](/docs/kcl/consts/std-YZ)
|
||||||
- [`ZERO`](/docs/kcl/consts/std-ZERO)
|
|
||||||
|
|
||||||
### `std::math`
|
### `std::math`
|
||||||
|
|
||||||
@ -23,3 +19,10 @@ layout: manual
|
|||||||
- [`PI`](/docs/kcl/consts/std-math-PI)
|
- [`PI`](/docs/kcl/consts/std-math-PI)
|
||||||
- [`TAU`](/docs/kcl/consts/std-math-TAU)
|
- [`TAU`](/docs/kcl/consts/std-math-TAU)
|
||||||
|
|
||||||
|
### `std::turns`
|
||||||
|
|
||||||
|
- [`HALF_TURN`](/docs/kcl/consts/std-turns-HALF_TURN)
|
||||||
|
- [`QUARTER_TURN`](/docs/kcl/consts/std-turns-QUARTER_TURN)
|
||||||
|
- [`THREE_QUARTER_TURN`](/docs/kcl/consts/std-turns-THREE_QUARTER_TURN)
|
||||||
|
- [`ZERO`](/docs/kcl/consts/std-turns-ZERO)
|
||||||
|
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
---
|
|
||||||
title: "std::HALF_TURN"
|
|
||||||
excerpt: ""
|
|
||||||
layout: manual
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
std::HALF_TURN: number(deg) = 180deg
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
|||||||
---
|
|
||||||
title: "std::QUARTER_TURN"
|
|
||||||
excerpt: ""
|
|
||||||
layout: manual
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
std::QUARTER_TURN: number(deg) = 90deg
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
|||||||
---
|
|
||||||
title: "std::THREE_QUARTER_TURN"
|
|
||||||
excerpt: ""
|
|
||||||
layout: manual
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
std::THREE_QUARTER_TURN: number(deg) = 270deg
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
|||||||
---
|
|
||||||
title: "std::ZERO"
|
|
||||||
excerpt: ""
|
|
||||||
layout: manual
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
std::ZERO: number = 0
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
@ -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,
|
||||||
|
@ -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)
|
||||||
|
@ -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,
|
||||||
|
15
docs/kcl/consts/std-turns-HALF_TURN.md
Normal file
15
docs/kcl/consts/std-turns-HALF_TURN.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
title: "std::turns::HALF_TURN"
|
||||||
|
excerpt: ""
|
||||||
|
layout: manual
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```js
|
||||||
|
std::turns::HALF_TURN: number(deg) = 180deg
|
||||||
|
```
|
||||||
|
|
||||||
|
|
15
docs/kcl/consts/std-turns-QUARTER_TURN.md
Normal file
15
docs/kcl/consts/std-turns-QUARTER_TURN.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
title: "std::turns::QUARTER_TURN"
|
||||||
|
excerpt: ""
|
||||||
|
layout: manual
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```js
|
||||||
|
std::turns::QUARTER_TURN: number(deg) = 90deg
|
||||||
|
```
|
||||||
|
|
||||||
|
|
15
docs/kcl/consts/std-turns-THREE_QUARTER_TURN.md
Normal file
15
docs/kcl/consts/std-turns-THREE_QUARTER_TURN.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
title: "std::turns::THREE_QUARTER_TURN"
|
||||||
|
excerpt: ""
|
||||||
|
layout: manual
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```js
|
||||||
|
std::turns::THREE_QUARTER_TURN: number(deg) = 270deg
|
||||||
|
```
|
||||||
|
|
||||||
|
|
15
docs/kcl/consts/std-turns-ZERO.md
Normal file
15
docs/kcl/consts/std-turns-ZERO.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
title: "std::turns::ZERO"
|
||||||
|
excerpt: ""
|
||||||
|
layout: manual
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```js
|
||||||
|
std::turns::ZERO: number = 0
|
||||||
|
```
|
||||||
|
|
||||||
|
|
@ -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
@ -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)
|
||||||
|
@ -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])
|
||||||
|
@ -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])
|
||||||
|
@ -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 }, %)
|
||||||
|
@ -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 }, %)
|
||||||
|
@ -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
@ -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])
|
||||||
|
@ -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])
|
||||||
|
@ -22,16 +22,16 @@ layout: manual
|
|||||||
* [`string`](kcl/types/string)
|
* [`string`](kcl/types/string)
|
||||||
* [`tag`](kcl/types/tag)
|
* [`tag`](kcl/types/tag)
|
||||||
* **std**
|
* **std**
|
||||||
* [`HALF_TURN`](kcl/consts/std-HALF_TURN)
|
* [`Face`](kcl/types/Face)
|
||||||
|
* [`Helix`](kcl/types/Helix)
|
||||||
* [`Plane`](kcl/types/Plane)
|
* [`Plane`](kcl/types/Plane)
|
||||||
* [`QUARTER_TURN`](kcl/consts/std-QUARTER_TURN)
|
* [`Point2d`](kcl/types/Point2d)
|
||||||
|
* [`Point3d`](kcl/types/Point3d)
|
||||||
* [`Sketch`](kcl/types/Sketch)
|
* [`Sketch`](kcl/types/Sketch)
|
||||||
* [`Solid`](kcl/types/Solid)
|
* [`Solid`](kcl/types/Solid)
|
||||||
* [`THREE_QUARTER_TURN`](kcl/consts/std-THREE_QUARTER_TURN)
|
|
||||||
* [`XY`](kcl/consts/std-XY)
|
* [`XY`](kcl/consts/std-XY)
|
||||||
* [`XZ`](kcl/consts/std-XZ)
|
* [`XZ`](kcl/consts/std-XZ)
|
||||||
* [`YZ`](kcl/consts/std-YZ)
|
* [`YZ`](kcl/consts/std-YZ)
|
||||||
* [`ZERO`](kcl/consts/std-ZERO)
|
|
||||||
* [`abs`](kcl/abs)
|
* [`abs`](kcl/abs)
|
||||||
* [`acos`](kcl/acos)
|
* [`acos`](kcl/acos)
|
||||||
* [`angleToMatchLengthX`](kcl/angleToMatchLengthX)
|
* [`angleToMatchLengthX`](kcl/angleToMatchLengthX)
|
||||||
@ -57,7 +57,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)
|
||||||
@ -70,7 +69,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)
|
||||||
@ -142,3 +140,10 @@ 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)
|
||||||
|
* **std::turns**
|
||||||
|
* [`turns::HALF_TURN`](kcl/consts/std-turns-HALF_TURN)
|
||||||
|
* [`turns::QUARTER_TURN`](kcl/consts/std-turns-QUARTER_TURN)
|
||||||
|
* [`turns::THREE_QUARTER_TURN`](kcl/consts/std-turns-THREE_QUARTER_TURN)
|
||||||
|
* [`turns::ZERO`](kcl/consts/std-turns-ZERO)
|
||||||
|
@ -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(
|
||||||
|
@ -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])
|
||||||
|
@ -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])
|
||||||
|
@ -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])
|
||||||
|
@ -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])
|
||||||
|
@ -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(
|
||||||
|
@ -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])
|
||||||
|
@ -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])
|
||||||
|
@ -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])
|
||||||
|
@ -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)
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
@ -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,
|
||||||
|
@ -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,
|
||||||
|
@ -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])
|
||||||
|
@ -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])
|
||||||
|
@ -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])
|
||||||
|
@ -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)
|
||||||
|
@ -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)
|
||||||
|
|
||||||
|
@ -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])
|
||||||
|
@ -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,
|
||||||
|
@ -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)
|
||||||
```
|
```
|
||||||
|
@ -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)
|
||||||
|
@ -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])
|
||||||
|
@ -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,
|
||||||
|
@ -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)
|
||||||
|
@ -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
@ -6,6 +6,10 @@ layout: manual
|
|||||||
|
|
||||||
Rotate a solid or a sketch.
|
Rotate a solid or a sketch.
|
||||||
|
|
||||||
|
This is really useful for assembling parts together. You can create a part and then rotate it to the correct orientation.
|
||||||
|
|
||||||
|
For sketches, you can use this to rotate a sketch and then loft it with another sketch.
|
||||||
|
|
||||||
### Using Roll, Pitch, and Yaw
|
### Using Roll, Pitch, and Yaw
|
||||||
|
|
||||||
When rotating a part in 3D space, "roll," "pitch," and "yaw" refer to the three rotational axes used to describe its orientation: roll is rotation around the longitudinal axis (front-to-back), pitch is rotation around the lateral axis (wing-to-wing), and yaw is rotation around the vertical axis (up-down); essentially, it's like tilting the part on its side (roll), tipping the nose up or down (pitch), and turning it left or right (yaw).
|
When rotating a part in 3D space, "roll," "pitch," and "yaw" refer to the three rotational axes used to describe its orientation: roll is rotation around the longitudinal axis (front-to-back), pitch is rotation around the lateral axis (wing-to-wing), and yaw is rotation around the vertical axis (up-down); essentially, it's like tilting the part on its side (roll), tipping the nose up or down (pitch), and turning it left or right (yaw).
|
||||||
@ -58,7 +62,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 +71,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 +87,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 +96,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 +124,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 +140,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 +156,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)
|
||||||
@ -166,7 +170,7 @@ fn square() {
|
|||||||
profile001 = square()
|
profile001 = square()
|
||||||
|
|
||||||
profile002 = square()
|
profile002 = square()
|
||||||
|> translate(translate = [0, 0, 20])
|
|> translate(x = 0, y = 0, z = 20)
|
||||||
|> rotate(axis = [0, 0, 1.0], angle = 45)
|
|> rotate(axis = [0, 0, 1.0], angle = 45)
|
||||||
|
|
||||||
loft([profile001, profile002])
|
loft([profile001, profile002])
|
||||||
|
@ -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])
|
||||||
|
File diff suppressed because one or more lines are too long
@ -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)
|
||||||
|
@ -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)
|
||||||
|
@ -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])
|
||||||
|
@ -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)
|
||||||
|
@ -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 }, %)
|
||||||
|
@ -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)
|
||||||
|
@ -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])
|
||||||
|
@ -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)
|
||||||
|
@ -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])
|
||||||
|
@ -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)
|
||||||
|
@ -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,
|
||||||
|
@ -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,
|
||||||
|
@ -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,
|
||||||
|
55
docs/kcl/std-sketch-circle.md
Normal file
55
docs/kcl/std-sketch-circle.md
Normal file
File diff suppressed because one or more lines are too long
22359
docs/kcl/std.json
22359
docs/kcl/std.json
File diff suppressed because it is too large
Load Diff
@ -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
@ -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)
|
||||||
|
@ -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,
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user