Compare commits
65 Commits
pierremtb/
...
pierremtb/
Author | SHA1 | Date | |
---|---|---|---|
b0ab335426 | |||
3811c88b5c | |||
69a1473197 | |||
b1e6f84a1f | |||
39ed99be2b | |||
1f1e996cfa | |||
58167deda7 | |||
83d22a4f5f | |||
7003b19a70 | |||
687ef1429d | |||
b1b00a9a22 | |||
a0924bcfa3 | |||
5ce22e2de8 | |||
ff6c1b9c68 | |||
eda485362e | |||
07e98916d3 | |||
d715a8b7af | |||
239ef48b3a | |||
850c5c62d1 | |||
b31786c9ab | |||
936549d60f | |||
0babbcff49 | |||
02c2e80b31 | |||
da236d9a3e | |||
1104d908c0 | |||
2efea3ec06 | |||
775007ef0d | |||
f490e7d6fe | |||
89bc93e4cd | |||
12edb6375d | |||
8d9bba02d6 | |||
56e100fad7 | |||
38f7a4089e | |||
91f5465e2d | |||
2ca58020cc | |||
1ca6c80707 | |||
58a9c60d0b | |||
725c4d95f8 | |||
19007862a6 | |||
1e597e9cbe | |||
615b7feabb | |||
4eaa5460b8 | |||
dd3799cfb7 | |||
0d79d0ff6d | |||
08fdcb1c1c | |||
5743b9ced0 | |||
087336b8ae | |||
fea5350cb9 | |||
400733f10e | |||
7f1383d314 | |||
d2adb5bfad | |||
8896d06028 | |||
fbed6bbcf7 | |||
291ad31bd0 | |||
929473a0ad | |||
1f217ef50b | |||
5ef5c6280c | |||
aac95e1e2e | |||
18f4a1303c | |||
ded97eda61 | |||
f6b06520ee | |||
dcfcdc98ce | |||
9ab3325580 | |||
cb5ad3ab27 | |||
1e539cc134 |
@ -1,3 +1,3 @@
|
||||
[codespell]
|
||||
ignore-words-list: crate,everytime,inout,co-ordinate,ot,nwo,atleast,ue,afterall,ser
|
||||
skip: **/target,node_modules,build,dist,./out,**/Cargo.lock,./docs/kcl/*.md,.yarn.lock,**/yarn.lock,./openapi/*.json,./packages/codemirror-lang-kcl/test/all.test.ts,tsconfig.tsbuildinfo
|
||||
skip: **/target,node_modules,build,dist,./out,**/Cargo.lock,./docs/kcl/*.md,pnpm-lock.yaml,**/yarn.lock,./openapi/*.json,./packages/codemirror-lang-kcl/test/all.test.ts,tsconfig.tsbuildinfo,src/lib/machine-api.d.ts
|
||||
|
@ -1,3 +1,4 @@
|
||||
src/wasm-lib/*
|
||||
*.typegen.ts
|
||||
packages/codemirror-lsp-client/dist/*
|
||||
e2e/playwright/snapshots/prompt-to-edit/*
|
||||
|
12
.github/ci-cd-scripts/playwright-electron.sh
vendored
12
.github/ci-cd-scripts/playwright-electron.sh
vendored
@ -7,11 +7,11 @@ if [[ ! -f "test-results/.last-run.json" ]]; then
|
||||
# if no last run artifact, than run plawright normally
|
||||
echo "run playwright normally"
|
||||
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" -- pnpm test:playwright:electron:ubuntu -- --shard=$1/$2 || true
|
||||
elif [[ "$3" == *windows* ]]; then
|
||||
yarn test:playwright:electron:windows -- --shard=$1/$2 || true
|
||||
pnpm test:playwright:electron:windows -- --shard=$1/$2 || true
|
||||
elif [[ "$3" == *macos* ]]; then
|
||||
yarn test:playwright:electron:macos -- --shard=$1/$2 || true
|
||||
pnpm test:playwright:electron:macos -- --shard=$1/$2 || true
|
||||
else
|
||||
echo "Do not run playwright. Unable to detect os runtime."
|
||||
exit 1
|
||||
@ -31,11 +31,11 @@ while [[ $retry -le $max_retrys ]]; do
|
||||
echo "retried=true" >>$GITHUB_OUTPUT
|
||||
echo "run playwright with last failed tests and retry $retry"
|
||||
if [[ "$3" == *ubuntu* ]]; then
|
||||
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn test:playwright:electron:ubuntu -- --last-failed || true
|
||||
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- pnpm test:playwright:electron:ubuntu -- --last-failed || true
|
||||
elif [[ "$3" == *windows* ]]; then
|
||||
yarn test:playwright:electron:windows -- --last-failed || true
|
||||
pnpm test:playwright:electron:windows -- --last-failed || true
|
||||
elif [[ "$3" == *macos* ]]; then
|
||||
yarn test:playwright:electron:macos -- --last-failed || true
|
||||
pnpm test:playwright:electron:macos -- --last-failed || true
|
||||
else
|
||||
echo "Do not run playwright. Unable to detect os runtime."
|
||||
exit 1
|
||||
|
7
.github/workflows/build-and-store-wasm.yml
vendored
7
.github/workflows/build-and-store-wasm.yml
vendored
@ -10,12 +10,13 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: pnpm/action-setup@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'yarn'
|
||||
cache: 'pnpm'
|
||||
- name: Install dependencies
|
||||
run: yarn
|
||||
run: pnpm install
|
||||
- name: Setup Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
- name: Cache wasm
|
||||
@ -26,7 +27,7 @@ jobs:
|
||||
with:
|
||||
tool: wasm-pack
|
||||
- name: build wasm
|
||||
run: yarn build:wasm
|
||||
run: pnpm build:wasm
|
||||
|
||||
|
||||
# Upload the WASM bundle as an artifact
|
||||
|
63
.github/workflows/build-apps.yml
vendored
63
.github/workflows/build-apps.yml
vendored
@ -5,16 +5,14 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- pierremtb/adhoc/pnpm
|
||||
tags:
|
||||
- 'v[0-9]+.[0-9]+.[0-9]+'
|
||||
schedule:
|
||||
- cron: '0 4 * * *'
|
||||
# Daily at 04:00 AM UTC
|
||||
# Will checkout the last commit from the default branch (main as of 2023-10-04)
|
||||
- 'nightly-v[0-9]+.[0-9]+.[0-9]+'
|
||||
|
||||
env:
|
||||
IS_RELEASE: ${{ github.ref_type == 'tag' }}
|
||||
IS_NIGHTLY: ${{ github.event_name == 'schedule' }}
|
||||
IS_RELEASE: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }}
|
||||
IS_NIGHTLY: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'nightly-v') }}
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||
@ -29,11 +27,14 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'pnpm'
|
||||
|
||||
- run: yarn install
|
||||
- run: pnpm install
|
||||
|
||||
- name: Setup Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
@ -48,17 +49,20 @@ jobs:
|
||||
tool: wasm-pack
|
||||
|
||||
- name: Run build:wasm
|
||||
run: "yarn build:wasm"
|
||||
run: "pnpm build:wasm"
|
||||
|
||||
- name: Set nightly version, product name, release notes, and icons
|
||||
if: ${{ env.IS_NIGHTLY == 'true' }}
|
||||
run: yarn files:flip-to-nightly
|
||||
run: |
|
||||
export VERSION=${GITHUB_REF_NAME#nightly-v}
|
||||
pnpm files:set-version
|
||||
pnpm files:flip-to-nightly
|
||||
|
||||
- name: Set release version
|
||||
if: ${{ env.IS_RELEASE == 'true' }}
|
||||
run: |
|
||||
export VERSION=${GITHUB_REF_NAME#v}
|
||||
yarn files:set-version
|
||||
pnpm files:set-version
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
@ -123,17 +127,21 @@ jobs:
|
||||
cp prepared-files/assets/icon.ico assets/icon.ico
|
||||
cp prepared-files/assets/icon.png assets/icon.png
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
- uses: pnpm/action-setup@v4
|
||||
|
||||
- name: Sync node version and setup cache
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'pnpm' # Set this to npm, pnpm or pnpm.
|
||||
|
||||
- name: yarn install
|
||||
- name: pnpm install
|
||||
# Windows is picky sometimes and fails on fetch. Step takes about ~30s
|
||||
uses: nick-fields/retry@v3.0.1
|
||||
with:
|
||||
timeout_minutes: 2
|
||||
max_attempts: 3
|
||||
command: yarn install
|
||||
command: pnpm install
|
||||
|
||||
- name: Prepare certificate and variables (Windows only)
|
||||
if: ${{ (env.IS_RELEASE == 'true' || env.IS_NIGHTLY == 'true') && matrix.os == 'windows-2022' }}
|
||||
@ -165,7 +173,7 @@ jobs:
|
||||
if: ${{ env.IS_RELEASE == 'false' && env.IS_NIGHTLY == 'false' }}
|
||||
# electron-builder doesn't have a concept of release vs debug,
|
||||
# this is just not doing any codesign or release yml generation, and points to dev infra
|
||||
run: yarn tronb:package:dev
|
||||
run: pnpm tronb:package:dev
|
||||
|
||||
- name: Build the app (release)
|
||||
if: ${{ env.IS_RELEASE == 'true' || env.IS_NIGHTLY == 'true' }}
|
||||
@ -184,7 +192,7 @@ jobs:
|
||||
with:
|
||||
timeout_minutes: 10
|
||||
max_attempts: 3
|
||||
command: yarn tronb:package:prod
|
||||
command: pnpm tronb:package:prod
|
||||
|
||||
- name: List artifacts in out/
|
||||
run: ls -R out
|
||||
@ -245,7 +253,7 @@ jobs:
|
||||
with:
|
||||
timeout_minutes: 10
|
||||
max_attempts: 3
|
||||
command: yarn tronb:package:prod
|
||||
command: pnpm tronb:package:prod
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: ${{ env.IS_RELEASE == 'true' }}
|
||||
@ -270,7 +278,7 @@ jobs:
|
||||
runs-on: ubuntu-22.04
|
||||
permissions:
|
||||
contents: write
|
||||
if: ${{ github.ref_type == 'tag' || github.event_name == 'schedule' }}
|
||||
if: ${{ github.ref_type == 'tag' }}
|
||||
env:
|
||||
VERSION_NO_V: ${{ needs.prepare-files.outputs.version }}
|
||||
VERSION: ${{ format('v{0}', needs.prepare-files.outputs.version) }}
|
||||
@ -327,8 +335,8 @@ jobs:
|
||||
env:
|
||||
NOTES: ${{ needs.prepare-files.outputs.notes }}
|
||||
PUB_DATE: ${{ github.event.repository.updated_at }}
|
||||
WEBSITE_DIR: ${{ github.event_name == 'schedule' && 'dl.zoo.dev/releases/modeling-app/nightly' || 'dl.zoo.dev/releases/modeling-app' }}
|
||||
URL_CODED_NAME: ${{ github.event_name == 'schedule' && 'Zoo%20Modeling%20App%20%28Nightly%29' || 'Zoo%20Modeling%20App' }}
|
||||
WEBSITE_DIR: ${{ env.IS_NIGHTLY == 'true' && 'dl.zoo.dev/releases/modeling-app/nightly' || 'dl.zoo.dev/releases/modeling-app' }}
|
||||
URL_CODED_NAME: ${{ env.IS_NIGHTLY == 'true' && 'Zoo%20Modeling%20App%20%28Nightly%29' || 'Zoo%20Modeling%20App' }}
|
||||
run: |
|
||||
RELEASE_DIR=https://${WEBSITE_DIR}
|
||||
jq --null-input \
|
||||
@ -383,9 +391,9 @@ jobs:
|
||||
# see https://github.com/actions/checkout/issues/1471
|
||||
git fetch --prune --unshallow --tags
|
||||
export TAG="nightly-${VERSION}"
|
||||
export PREVIOUS_TAG=$(git describe --tags --match="nightly-v[0-9]*" --abbrev=0)
|
||||
export PREVIOUS_TAG=$(git tag --list --sort=-committerdate "nightly-v[0-9]*" | head -n2 | tail -n1)
|
||||
export NOTES=$(./scripts/get-nightly-changelog.sh)
|
||||
yarn files:set-notes
|
||||
pnpm files:set-notes
|
||||
|
||||
- name: Authenticate to Google Cloud
|
||||
if: ${{ env.IS_NIGHTLY == 'true' }}
|
||||
@ -410,15 +418,4 @@ jobs:
|
||||
|
||||
- name: Invalidate bucket cache on latest*.yml and last_download.json files
|
||||
if: ${{ env.IS_NIGHTLY == 'true' }}
|
||||
run: yarn files:invalidate-bucket:nightly
|
||||
|
||||
- name: Tag nightly commit
|
||||
if: ${{ env.IS_NIGHTLY == 'true' }}
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const { VERSION } = process.env
|
||||
const { owner, repo } = context.repo
|
||||
const { sha } = context
|
||||
const ref = `refs/tags/nightly-${VERSION}`
|
||||
github.rest.git.createRef({ owner, repo, sha, ref })
|
||||
run: pnpm files:invalidate-bucket:nightly
|
||||
|
10
.github/workflows/codemirror-lang-kcl.yml
vendored
10
.github/workflows/codemirror-lang-kcl.yml
vendored
@ -16,17 +16,19 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'yarn'
|
||||
cache: 'pnpm'
|
||||
|
||||
- run: yarn install
|
||||
- run: pnpm install
|
||||
working-directory: packages/codemirror-lang-kcl
|
||||
|
||||
- run: yarn tsc
|
||||
- run: pnpm tsc
|
||||
working-directory: packages/codemirror-lang-kcl
|
||||
|
||||
- name: run unit tests
|
||||
run: yarn test
|
||||
run: pnpm test
|
||||
working-directory: packages/codemirror-lang-kcl
|
||||
|
63
.github/workflows/e2e-tests.yml
vendored
63
.github/workflows/e2e-tests.yml
vendored
@ -1,8 +1,10 @@
|
||||
name: E2E Tests
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
branches: [ main, pierremtb/adhoc/pnpm]
|
||||
pull_request:
|
||||
schedule:
|
||||
- cron: 0 * * * * # hourly
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||
@ -15,23 +17,6 @@ permissions:
|
||||
|
||||
|
||||
jobs:
|
||||
|
||||
check-rust-changes:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
rust-changed: ${{ steps.filter.outputs.rust }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- id: filter
|
||||
name: Check for Rust changes
|
||||
uses: dorny/paths-filter@v3
|
||||
with:
|
||||
filters: |
|
||||
rust:
|
||||
- 'src/wasm-lib/**'
|
||||
|
||||
electron:
|
||||
timeout-minutes: 60
|
||||
name: playwright:electron:${{ matrix.os }} ${{ matrix.shardIndex }} ${{ matrix.shardTotal }}
|
||||
@ -42,8 +27,8 @@ jobs:
|
||||
os: [namespace-profile-ubuntu-8-cores, namespace-profile-macos-8-cores, windows-16-cores]
|
||||
shardIndex: [1, 2, 3, 4]
|
||||
shardTotal: [4]
|
||||
# TODO: add ref here for main and latest release tag
|
||||
runs-on: ${{ matrix.os }}
|
||||
needs: check-rust-changes
|
||||
steps:
|
||||
- uses: actions/create-github-app-token@v1
|
||||
id: app-token
|
||||
@ -54,26 +39,36 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ steps.app-token.outputs.token }}
|
||||
- id: filter
|
||||
name: Check for Rust changes
|
||||
uses: dorny/paths-filter@v3
|
||||
with:
|
||||
filters: |
|
||||
rust:
|
||||
- 'src/wasm-lib/**'
|
||||
- uses: pnpm/action-setup@v4
|
||||
# TODO: remove this
|
||||
- run: npm install --global --force corepack@latest
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'yarn'
|
||||
cache: 'pnpm'
|
||||
- uses: KittyCAD/action-install-cli@main
|
||||
- name: Install dependencies
|
||||
shell: bash
|
||||
run: yarn
|
||||
run: pnpm install
|
||||
- name: Cache Playwright Browsers
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.cache/ms-playwright/
|
||||
key: ${{ runner.os }}-playwright-${{ hashFiles('yarn.lock') }}
|
||||
key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm.lock') }}
|
||||
- name: Install Playwright Browsers
|
||||
shell: bash
|
||||
run: yarn playwright install --with-deps
|
||||
run: pnpm playwright install --with-deps
|
||||
- name: Download Wasm Cache
|
||||
id: download-wasm
|
||||
if: needs.check-rust-changes.outputs.rust-changed == 'false'
|
||||
if: github.event_name != 'schedule' && steps.filter.outputs.rust == 'false'
|
||||
uses: dawidd6/action-download-artifact@v7
|
||||
continue-on-error: true
|
||||
with:
|
||||
@ -83,7 +78,7 @@ jobs:
|
||||
branch: main
|
||||
path: src/wasm-lib/pkg
|
||||
- name: copy wasm blob
|
||||
if: needs.check-rust-changes.outputs.rust-changed == 'false'
|
||||
if: github.event_name != 'schedule' && steps.filter.outputs.rust == 'false'
|
||||
shell: bash
|
||||
run: cp src/wasm-lib/pkg/wasm_lib_bg.wasm public
|
||||
continue-on-error: true
|
||||
@ -93,7 +88,7 @@ jobs:
|
||||
with:
|
||||
tool: wasm-pack
|
||||
- name: Cache Wasm (because rust diff)
|
||||
if: needs.check-rust-changes.outputs.rust-changed == 'true'
|
||||
if: github.event_name == 'schedule' || steps.filter.outputs.rust == 'true'
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: './src/wasm-lib'
|
||||
@ -126,23 +121,23 @@ jobs:
|
||||
cat /tmp/vector.toml
|
||||
${HOME}/.vector/bin/vector --config /tmp/vector.toml &
|
||||
- name: Build Wasm (because rust diff)
|
||||
if: needs.check-rust-changes.outputs.rust-changed == 'true'
|
||||
if: github.event_name == 'schedule' || steps.filter.outputs.rust == 'true'
|
||||
shell: bash
|
||||
run: yarn build:wasm
|
||||
run: pnpm build:wasm
|
||||
- name: OR Build Wasm (because wasm cache failed)
|
||||
if: steps.download-wasm.outcome == 'failure'
|
||||
shell: bash
|
||||
run: yarn build:wasm
|
||||
run: pnpm build:wasm
|
||||
- name: build web
|
||||
shell: bash
|
||||
run: yarn tronb:vite:dev
|
||||
run: pnpm tronb:vite:dev
|
||||
- name: Run ubuntu/chrome snapshots
|
||||
if: ${{ matrix.os == 'namespace-profile-ubuntu-8-cores' && matrix.shardIndex == 1 }}
|
||||
shell: bash
|
||||
# TODO: break this in its own job, for now it's not slowing down the overall execution as ubuntu is the quickest,
|
||||
# but we could do better. This forces a large 1/1 shard of all 20 snapshot tests that runs in about 3 minutes.
|
||||
run: |
|
||||
PLATFORM=web yarn playwright test --config=playwright.config.ts --retries="3" --update-snapshots --grep=@snapshot --shard=1/1
|
||||
PLATFORM=web pnpm playwright test --config=playwright.config.ts --retries="3" --update-snapshots --grep=@snapshot --trace=on --shard=1/1
|
||||
env:
|
||||
CI: true
|
||||
NODE_ENV: development
|
||||
@ -153,7 +148,7 @@ jobs:
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: ${{ !cancelled() && (success() || failure()) }}
|
||||
with:
|
||||
name: playwright-report-${{ matrix.os }}-snapshot-${{ matrix.shardIndex }}-${{ github.sha }}
|
||||
name: playwright-report-snapshots-${{ matrix.os }}-snapshot-${{ matrix.shardIndex }}-${{ github.sha }}
|
||||
path: playwright-report/
|
||||
include-hidden-files: true
|
||||
retention-days: 30
|
||||
@ -167,7 +162,7 @@ jobs:
|
||||
shell: bash
|
||||
id: git-check
|
||||
run: |
|
||||
git add e2e/playwright/snapshot-tests.spec.ts-snapshots
|
||||
git add e2e/playwright/snapshot-tests.spec.ts-snapshots e2e/playwright/snapshots
|
||||
if git status | grep -q "Changes to be committed"
|
||||
then echo "modified=true" >> $GITHUB_OUTPUT
|
||||
else echo "modified=false" >> $GITHUB_OUTPUT
|
||||
@ -176,7 +171,7 @@ jobs:
|
||||
if: steps.git-check.outputs.modified == 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
git add e2e/playwright/snapshot-tests.spec.ts-snapshots
|
||||
git add e2e/playwright/snapshot-tests.spec.ts-snapshots e2e/playwright/snapshots
|
||||
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git config --local user.name "github-actions[bot]"
|
||||
git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
|
||||
|
@ -18,13 +18,14 @@ jobs:
|
||||
runs-on: 'ubuntu-latest'
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: pnpm/action-setup@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'yarn'
|
||||
- run: yarn install
|
||||
- run: yarn generate:machine-api
|
||||
- run: yarn fmt
|
||||
cache: 'pnpm'
|
||||
- run: pnpm install
|
||||
- run: pnpm generate:machine-api
|
||||
- run: pnpm fmt
|
||||
- name: check for changes
|
||||
id: git-check
|
||||
run: |
|
||||
|
8
.github/workflows/publish-apps-release.yml
vendored
8
.github/workflows/publish-apps-release.yml
vendored
@ -16,10 +16,12 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'yarn'
|
||||
cache: 'pnpm'
|
||||
|
||||
- name: Find tag workflow id
|
||||
id: tag_workflow_id
|
||||
@ -105,7 +107,7 @@ jobs:
|
||||
- name: Override release notes
|
||||
env:
|
||||
NOTES: ${{ github.event.release.body }}
|
||||
run: yarn files:set-notes
|
||||
run: pnpm files:set-notes
|
||||
|
||||
- name: Authenticate to Google Cloud
|
||||
uses: 'google-github-actions/auth@v2.1.8'
|
||||
@ -126,7 +128,7 @@ jobs:
|
||||
destination: 'dl.kittycad.io/releases/modeling-app'
|
||||
|
||||
- name: Invalidate bucket cache on latest*.yml and last_download.json files
|
||||
run: yarn files:invalidate-bucket
|
||||
run: pnpm files:invalidate-bucket
|
||||
|
||||
- name: Upload release files to Github
|
||||
if: ${{ github.event_name == 'release' }}
|
||||
|
58
.github/workflows/static-analysis.yml
vendored
58
.github/workflows/static-analysis.yml
vendored
@ -20,38 +20,41 @@ jobs:
|
||||
runs-on: 'ubuntu-22.04'
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: pnpm/action-setup@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'yarn'
|
||||
- run: yarn install
|
||||
- run: yarn fmt-check
|
||||
cache: 'pnpm'
|
||||
- run: pnpm install
|
||||
- run: pnpm fmt-check
|
||||
|
||||
yarn-build-wasm:
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: pnpm/action-setup@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'yarn'
|
||||
- run: yarn install
|
||||
cache: 'pnpm'
|
||||
- run: pnpm install
|
||||
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb
|
||||
with:
|
||||
tool: wasm-pack
|
||||
- run: yarn build:wasm
|
||||
- run: pnpm build:wasm
|
||||
|
||||
yarn-tsc:
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: pnpm/action-setup@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'yarn'
|
||||
- run: yarn install
|
||||
cache: 'pnpm'
|
||||
- run: pnpm install
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: './src/wasm-lib'
|
||||
@ -59,20 +62,21 @@ jobs:
|
||||
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb
|
||||
with:
|
||||
tool: wasm-pack
|
||||
- run: yarn build:wasm
|
||||
- run: yarn tsc
|
||||
- run: pnpm build:wasm
|
||||
- run: pnpm tsc
|
||||
|
||||
yarn-lint:
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: pnpm/action-setup@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'yarn'
|
||||
- run: yarn install
|
||||
- run: yarn lint
|
||||
cache: 'pnpm'
|
||||
- run: pnpm install
|
||||
- run: pnpm lint
|
||||
|
||||
python-codespell:
|
||||
runs-on: ubuntu-22.04
|
||||
@ -92,27 +96,29 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'yarn'
|
||||
cache: 'pnpm'
|
||||
|
||||
- run: yarn install
|
||||
- run: pnpm install
|
||||
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb
|
||||
with:
|
||||
tool: wasm-pack
|
||||
- run: yarn build:wasm
|
||||
- run: pnpm build:wasm
|
||||
|
||||
- run: yarn simpleserver:bg
|
||||
- run: pnpm simpleserver:bg
|
||||
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
|
||||
|
||||
- name: Install Chromium Browser
|
||||
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
|
||||
run: yarn playwright install chromium --with-deps
|
||||
run: pnpm playwright install chromium --with-deps
|
||||
|
||||
- name: run unit tests for kcl samples
|
||||
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
|
||||
run: yarn test:unit:kcl-samples
|
||||
run: pnpm test:unit:kcl-samples
|
||||
env:
|
||||
VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
||||
|
||||
@ -121,27 +127,29 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'yarn'
|
||||
cache: 'pnpm'
|
||||
|
||||
- run: yarn install
|
||||
- run: pnpm install
|
||||
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb
|
||||
with:
|
||||
tool: wasm-pack
|
||||
- run: yarn build:wasm
|
||||
- run: pnpm build:wasm
|
||||
|
||||
- run: yarn simpleserver:bg
|
||||
- run: pnpm simpleserver:bg
|
||||
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
|
||||
|
||||
- name: Install Chromium Browser
|
||||
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
|
||||
run: yarn playwright install chromium --with-deps
|
||||
run: pnpm playwright install chromium --with-deps
|
||||
|
||||
- name: run unit tests
|
||||
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
|
||||
run: yarn test:unit
|
||||
run: pnpm test:unit
|
||||
env:
|
||||
VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
||||
|
||||
|
41
.github/workflows/tag-nightly.yml
vendored
Normal file
41
.github/workflows/tag-nightly.yml
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
name: tag-nightly
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 4 * * *'
|
||||
# Daily at 04:00 AM UTC
|
||||
# Will checkout the last commit from the default branch (main as of 2023-10-04)
|
||||
|
||||
jobs:
|
||||
tag-nightly:
|
||||
runs-on: ubuntu-22.04
|
||||
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 }}
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
|
||||
- run: pnpm install
|
||||
|
||||
- name: Push tag
|
||||
run: |
|
||||
VERSION_NO_V=$(date +'%-y.%-m.%-d')
|
||||
TAG="nightly-v$VERSION_NO_V"
|
||||
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git config --local user.name "github-actions[bot]"
|
||||
git tag $TAG
|
||||
git push origin tag $TAG
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -24,7 +24,7 @@ yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
.idea
|
||||
# .vscode
|
||||
.vscode
|
||||
.helix
|
||||
src/wasm-lib/.idea
|
||||
src/wasm-lib/.vscode
|
||||
@ -71,3 +71,4 @@ venv
|
||||
|
||||
# electron
|
||||
out/
|
||||
*.snap.new
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env sh
|
||||
. "$(dirname -- "$0")/_/husky.sh"
|
||||
|
||||
yarn fmt-check
|
||||
pnpm fmt-check
|
||||
|
@ -10,6 +10,7 @@ target
|
||||
src/wasm-lib/pkg
|
||||
src/wasm-lib/kcl/bindings
|
||||
e2e/playwright/export-snapshots
|
||||
e2e/playwright/snapshots/prompt-to-edit
|
||||
|
||||
|
||||
# XState generated files
|
||||
|
5
.vscode/settings.json
vendored
5
.vscode/settings.json
vendored
@ -1,5 +0,0 @@
|
||||
{
|
||||
"rust-analyzer.linkedProjects": [
|
||||
"src/wasm-lib/Cargo.toml"
|
||||
]
|
||||
}
|
10
Makefile
10
Makefile
@ -5,21 +5,21 @@ TS_SRC := $(wildcard src/**/*.tsx) $(wildcard src/**/*.ts)
|
||||
XSTATE_TYPEGENS := $(wildcard src/machines/*.typegen.ts)
|
||||
|
||||
dev: node_modules public/wasm_lib_bg.wasm $(XSTATE_TYPEGENS)
|
||||
yarn start
|
||||
pnpm start
|
||||
|
||||
# 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.
|
||||
# It should work for you other Linux users.
|
||||
lee-electron-test:
|
||||
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/ pnpm tron:test -g "when using the file tree"
|
||||
killall Xephyr
|
||||
|
||||
$(XSTATE_TYPEGENS): $(TS_SRC)
|
||||
yarn xstate typegen 'src/**/*.ts?(x)'
|
||||
pnpm xstate typegen 'src/**/*.ts?(x)'
|
||||
|
||||
public/wasm_lib_bg.wasm: $(WASM_LIB_FILES)
|
||||
yarn build:wasm
|
||||
pnpm build:wasm
|
||||
|
||||
node_modules: package.json yarn.lock
|
||||
yarn install
|
||||
pnpm install
|
||||
|
80
README.md
80
README.md
@ -60,37 +60,37 @@ fnm use
|
||||
|
||||
Install the NPM dependencies with:
|
||||
```
|
||||
yarn install
|
||||
pnpm install
|
||||
```
|
||||
|
||||
This project uses a lot of Rust compiled to [WASM](https://webassembly.org/) within it. We have package scripts to run rustup, see `package.json` for reference:
|
||||
```
|
||||
# macOS/Linux
|
||||
yarn install:rust
|
||||
yarn install:wasm-pack:sh
|
||||
pnpm install:rust
|
||||
pnpm install:wasm-pack:sh
|
||||
|
||||
# Windows
|
||||
yarn install:rust:windows
|
||||
yarn install:wasm-pack:cargo
|
||||
pnpm install:rust:windows
|
||||
pnpm install:wasm-pack:cargo
|
||||
```
|
||||
|
||||
Then to build the WASM layer, run:
|
||||
```
|
||||
# macOS/Linux
|
||||
yarn build:wasm
|
||||
pnpm build:wasm
|
||||
|
||||
# Windows
|
||||
yarn build:wasm:windows
|
||||
pnpm build:wasm:windows
|
||||
```
|
||||
|
||||
Or if you have the `gh` cli installed and want to download the latest main wasm bundle. Note that on Windows, you need to associate .ps1 files with PowerShell, which can be done via the right click menu, selecting `C:\Program Files\PowerShell\7\pwsh.exe`, and you can install tools like `gh` via `yarn install:tools:windows`.
|
||||
Or if you have the `gh` cli installed and want to download the latest main wasm bundle. Note that on Windows, you need to associate .ps1 files with PowerShell, which can be done via the right click menu, selecting `C:\Program Files\PowerShell\7\pwsh.exe`, and you can install tools like `gh` via `pnpm install:tools:windows`.
|
||||
|
||||
```
|
||||
# macOS/Linux
|
||||
yarn fetch:wasm
|
||||
pnpm fetch:wasm
|
||||
|
||||
# Windows
|
||||
yarn fetch:wasm:windows
|
||||
pnpm fetch:wasm:windows
|
||||
```
|
||||
|
||||
That will build the WASM binary and put in the `public` dir (though gitignored).
|
||||
@ -98,7 +98,7 @@ That will build the WASM binary and put in the `public` dir (though gitignored).
|
||||
Finally, to run the web app only, run:
|
||||
|
||||
```
|
||||
yarn start
|
||||
pnpm start
|
||||
```
|
||||
|
||||
If you're not a Zoo employee you won't be able to access the dev environment, you should copy everything from `.env.production` to `.env.development` to make it point to production instead, then when you navigate to `localhost:3000` the easiest way to sign in is to paste `localStorage.setItem('TOKEN_PERSIST_KEY', "your-token-from-https://zoo.dev/account/api-tokens")` replacing the with a real token from https://zoo.dev/account/api-tokens of course, then navigate to localhost:3000 again. Note that navigating to `localhost:3000/signin` removes your token so you will need to set the token again.
|
||||
@ -118,17 +118,17 @@ Third-Party Cookies".
|
||||
|
||||
## Desktop
|
||||
|
||||
To spin up the desktop app, `yarn install` and `yarn build:wasm` need to have been done before hand then
|
||||
To spin up the desktop app, `pnpm install` and `pnpm build:wasm` need to have been done before hand then
|
||||
|
||||
```
|
||||
yarn tron:start
|
||||
pnpm tron:start
|
||||
```
|
||||
|
||||
This will start the application and hot-reload on changes.
|
||||
|
||||
Devtools can be opened with the usual Cmd-Opt-I (Mac) or Ctrl-Shift-I (Linux and Windows).
|
||||
|
||||
To package the app for your platform with electron-builder, run `yarn tronb:package:dev` (or `yarn tronb:package:prod` to point to the .env.production variables)
|
||||
To package the app for your platform with electron-builder, run `pnpm tronb:package:dev` (or `pnpm tronb:package:prod` to point to the .env.production variables)
|
||||
|
||||
## Checking out commits / Bisecting
|
||||
|
||||
@ -136,9 +136,9 @@ Which commands from setup are one off vs need to be run every time?
|
||||
|
||||
The following will need to be run when checking out a new commit and guarantees the build is not stale:
|
||||
```bash
|
||||
yarn install
|
||||
yarn build:wasm
|
||||
yarn start # or yarn build:local && yarn serve for slower but more production-like build
|
||||
pnpm install
|
||||
pnpm build:wasm
|
||||
pnpm start # or pnpm build:local && pnpm serve for slower but more production-like build
|
||||
```
|
||||
|
||||
## Before submitting a PR
|
||||
@ -148,10 +148,10 @@ Before you submit a contribution PR to this repo, please ensure that:
|
||||
- There is a corresponding issue for the changes you want to make, so that discussion of approach can be had before work begins.
|
||||
- You have separated out refactoring commits from feature commits as much as possible
|
||||
- You have run all of the following commands locally:
|
||||
- `yarn fmt`
|
||||
- `yarn tsc`
|
||||
- `yarn test`
|
||||
- Here they are all together: `yarn fmt && yarn tsc && yarn test`
|
||||
- `pnpm fmt`
|
||||
- `pnpm tsc`
|
||||
- `pnpm test`
|
||||
- Here they are all together: `pnpm fmt && pnpm tsc && pnpm test`
|
||||
|
||||
## Release a new version
|
||||
|
||||
@ -260,7 +260,7 @@ docker run --network host --rm --init -it playwright/chrome:playwright-x.xx.x
|
||||
and in another terminal, run:
|
||||
|
||||
```bash
|
||||
PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:4444/ yarn playwright test --project="Google Chrome" <test suite>
|
||||
PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:4444/ pnpm playwright test --project="Google Chrome" <test suite>
|
||||
```
|
||||
|
||||
|
||||
@ -275,7 +275,7 @@ docker run --network host --rm --init -it playwright/chrome:playwright-1.46.0
|
||||
and in another terminal, run:
|
||||
|
||||
```bash
|
||||
PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:4444/ yarn playwright test --project="Google Chrome" e2e/playwright/command-bar-tests.spec.ts
|
||||
PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:4444/ pnpm playwright test --project="Google Chrome" e2e/playwright/command-bar-tests.spec.ts
|
||||
```
|
||||
|
||||
run a specific test change the test from `test('...` to `test.only('...`
|
||||
@ -287,13 +287,13 @@ run a specific test change the test from `test('...` to `test.only('...`
|
||||
run headed
|
||||
|
||||
```
|
||||
yarn playwright test --headed
|
||||
pnpm playwright test --headed
|
||||
```
|
||||
|
||||
run with step through debugger
|
||||
|
||||
```
|
||||
PWDEBUG=1 yarn playwright test
|
||||
PWDEBUG=1 pnpm playwright test
|
||||
```
|
||||
|
||||
However, if you want a debugger I recommend using VSCode and the `playwright` extension, as the above command is a cruder debugger that steps into every function call which is annoying.
|
||||
@ -304,7 +304,7 @@ Or comment out browsers in `playwright.config.ts`.
|
||||
|
||||
note chromium has encoder compat issues which is why were testing against the branded 'Google Chrome'
|
||||
|
||||
You may consider using the VSCode extension, it's useful for running individual threads, but some some reason the "record a test" is locked to chromium with we can't use. A work around is to us the CI `yarn playwright codegen -b wk --load-storage ./store localhost:3000`
|
||||
You may consider using the VSCode extension, it's useful for running individual threads, but some some reason the "record a test" is locked to chromium with we can't use. A work around is to us the CI `pnpm playwright codegen -b wk --load-storage ./store localhost:3000`
|
||||
|
||||
<details>
|
||||
<summary>
|
||||
@ -347,21 +347,21 @@ However because much of our tests involve clicking in the stream at specific loc
|
||||
If you already haven't, run the following:
|
||||
|
||||
```
|
||||
yarn
|
||||
yarn build:wasm
|
||||
yarn start
|
||||
pnpm install
|
||||
pnpm build:wasm
|
||||
pnpm start
|
||||
```
|
||||
|
||||
and finally:
|
||||
|
||||
```
|
||||
yarn test:unit
|
||||
pnpm test:unit
|
||||
```
|
||||
|
||||
For individual testing:
|
||||
|
||||
```
|
||||
yarn test abstractSyntaxTree -t "unexpected closed curly brace" --silent=false
|
||||
pnpm test abstractSyntaxTree -t "unexpected closed curly brace" --silent=false
|
||||
```
|
||||
|
||||
Which will run our suite of [Vitest unit](https://vitest.dev/) and [React Testing Library E2E](https://testing-library.com/docs/react-testing-library/intro) tests, in interactive mode by default.
|
||||
@ -432,17 +432,17 @@ Part of the CI CD pipeline performs static analysis on the code. Use the followi
|
||||
The following set of commands should get us closer to one and done commands to instantly retest issues.
|
||||
|
||||
```
|
||||
yarn test-setup
|
||||
pnpm test-setup
|
||||
```
|
||||
|
||||
> Gotcha, are packages up to date and is the wasm built?
|
||||
|
||||
|
||||
```
|
||||
yarn tsc
|
||||
yarn fmt-check
|
||||
yarn lint
|
||||
yarn test:unit:local
|
||||
pnpm tsc
|
||||
pnpm fmt-check
|
||||
pnpm lint
|
||||
pnpm test:unit:local
|
||||
```
|
||||
|
||||
> Gotcha: Our unit tests have integration tests in them. You need to run a localhost server to run the unit tests.
|
||||
@ -454,10 +454,10 @@ yarn test:unit:local
|
||||
These E2E tests run in electron. There are tests that are skipped if they are ran in a windows, linux, or macos environment. We can use playwright tags to implement test skipping.
|
||||
|
||||
```
|
||||
yarn test:playwright:electron:local
|
||||
yarn test:playwright:electron:windows:local
|
||||
yarn test:playwright:electron:macos:local
|
||||
yarn test:playwright:electron:ubuntu:local
|
||||
pnpm test:playwright:electron:local
|
||||
pnpm test:playwright:electron:windows:local
|
||||
pnpm test:playwright:electron:macos:local
|
||||
pnpm test:playwright:electron:ubuntu:local
|
||||
```
|
||||
|
||||
> Why does it say local? The CI CD commands that run in the pipeline cannot be ran locally. A single command will not properly setup the testing environment locally.
|
||||
|
@ -1,15 +0,0 @@
|
||||
---
|
||||
title: "QUARTER_TURN"
|
||||
excerpt: ""
|
||||
layout: manual
|
||||
---
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
```js
|
||||
QUARTER_TURN: number(deg) = 90deg
|
||||
```
|
||||
|
||||
|
@ -1,15 +0,0 @@
|
||||
---
|
||||
title: "THREE_QUARTER_TURN"
|
||||
excerpt: ""
|
||||
layout: manual
|
||||
---
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
```js
|
||||
THREE_QUARTER_TURN: number(deg) = 270deg
|
||||
```
|
||||
|
||||
|
@ -9,7 +9,11 @@ Returns the angle to match the given length for x.
|
||||
|
||||
|
||||
```js
|
||||
angleToMatchLengthX(tag: TagIdentifier, to: number, sketch: Sketch) -> number
|
||||
angleToMatchLengthX(
|
||||
tag: TagIdentifier,
|
||||
to: number,
|
||||
sketch: Sketch,
|
||||
) -> number
|
||||
```
|
||||
|
||||
|
||||
|
@ -9,7 +9,11 @@ Returns the angle to match the given length for y.
|
||||
|
||||
|
||||
```js
|
||||
angleToMatchLengthY(tag: TagIdentifier, to: number, sketch: Sketch) -> number
|
||||
angleToMatchLengthY(
|
||||
tag: TagIdentifier,
|
||||
to: number,
|
||||
sketch: Sketch,
|
||||
) -> number
|
||||
```
|
||||
|
||||
|
||||
|
@ -9,7 +9,11 @@ Draw a line segment relative to the current origin using the polar
|
||||
measure of some angle and distance.
|
||||
|
||||
```js
|
||||
angledLine(data: AngledLineData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
angledLine(
|
||||
data: AngledLineData,
|
||||
sketch: Sketch,
|
||||
tag?: TagDeclarator,
|
||||
) -> Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -29,7 +33,7 @@ angledLine(data: AngledLineData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
### Examples
|
||||
|
||||
```js
|
||||
exampleSketch = startSketchOn('XZ')
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> yLineTo(15, %)
|
||||
|> angledLine({ angle = 30, length = 15 }, %)
|
||||
|
@ -9,7 +9,11 @@ Create a line segment from the current 2-dimensional sketch origin
|
||||
along some angle (in degrees) for some relative length in the 'x' dimension.
|
||||
|
||||
```js
|
||||
angledLineOfXLength(data: AngledLineData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
angledLineOfXLength(
|
||||
data: AngledLineData,
|
||||
sketch: Sketch,
|
||||
tag?: TagDeclarator,
|
||||
) -> Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -29,7 +33,7 @@ angledLineOfXLength(data: AngledLineData, sketch: Sketch, tag?: TagDeclarator) -
|
||||
### Examples
|
||||
|
||||
```js
|
||||
sketch001 = startSketchOn('XZ')
|
||||
sketch001 = startSketchOn(XZ)
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> angledLineOfXLength({ angle = 45, length = 10 }, %, $edge1)
|
||||
|> angledLineOfXLength({ angle = -15, length = 20 }, %, $edge2)
|
||||
|
@ -9,7 +9,11 @@ Create a line segment from the current 2-dimensional sketch origin
|
||||
along some angle (in degrees) for some relative length in the 'y' dimension.
|
||||
|
||||
```js
|
||||
angledLineOfYLength(data: AngledLineData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
angledLineOfYLength(
|
||||
data: AngledLineData,
|
||||
sketch: Sketch,
|
||||
tag?: TagDeclarator,
|
||||
) -> Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -29,7 +33,7 @@ angledLineOfYLength(data: AngledLineData, sketch: Sketch, tag?: TagDeclarator) -
|
||||
### Examples
|
||||
|
||||
```js
|
||||
exampleSketch = startSketchOn('XZ')
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> line(end = [10, 0])
|
||||
|> angledLineOfYLength({ angle = 45, length = 10 }, %)
|
||||
|
@ -9,7 +9,11 @@ Draw an angled line from the current origin, constructing a line segment
|
||||
such that the newly created line intersects the desired target line segment.
|
||||
|
||||
```js
|
||||
angledLineThatIntersects(data: AngledLineThatIntersectsData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
angledLineThatIntersects(
|
||||
data: AngledLineThatIntersectsData,
|
||||
sketch: Sketch,
|
||||
tag?: TagDeclarator,
|
||||
) -> Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -29,7 +33,7 @@ angledLineThatIntersects(data: AngledLineThatIntersectsData, sketch: Sketch, tag
|
||||
### Examples
|
||||
|
||||
```js
|
||||
exampleSketch = startSketchOn('XZ')
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> line(endAbsolute = [5, 10])
|
||||
|> line(endAbsolute = [-10, 10], tag = $lineToIntersect)
|
||||
|
@ -9,7 +9,11 @@ Create a line segment from the current 2-dimensional sketch origin
|
||||
along some angle (in degrees) for some length, ending at the provided value in the 'x' dimension.
|
||||
|
||||
```js
|
||||
angledLineToX(data: AngledLineToData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
angledLineToX(
|
||||
data: AngledLineToData,
|
||||
sketch: Sketch,
|
||||
tag?: TagDeclarator,
|
||||
) -> Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -29,7 +33,7 @@ angledLineToX(data: AngledLineToData, sketch: Sketch, tag?: TagDeclarator) -> Sk
|
||||
### Examples
|
||||
|
||||
```js
|
||||
exampleSketch = startSketchOn('XZ')
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> angledLineToX({ angle = 30, to = 10 }, %)
|
||||
|> line(end = [0, 10])
|
||||
|
@ -9,7 +9,11 @@ Create a line segment from the current 2-dimensional sketch origin
|
||||
along some angle (in degrees) for some length, ending at the provided value in the 'y' dimension.
|
||||
|
||||
```js
|
||||
angledLineToY(data: AngledLineToData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
angledLineToY(
|
||||
data: AngledLineToData,
|
||||
sketch: Sketch,
|
||||
tag?: TagDeclarator,
|
||||
) -> Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -29,7 +33,7 @@ angledLineToY(data: AngledLineToData, sketch: Sketch, tag?: TagDeclarator) -> Sk
|
||||
### Examples
|
||||
|
||||
```js
|
||||
exampleSketch = startSketchOn('XZ')
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> angledLineToY({ angle = 60, to = 20 }, %)
|
||||
|> line(end = [-20, 0])
|
||||
|
File diff suppressed because one or more lines are too long
@ -11,7 +11,11 @@ The arc is constructed such that the current position of the sketch is placed al
|
||||
Unless this makes a lot of sense and feels like what you're looking for to construct your shape, you're likely looking for tangentialArc.
|
||||
|
||||
```js
|
||||
arc(data: ArcData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
arc(
|
||||
data: ArcData,
|
||||
sketch: Sketch,
|
||||
tag?: TagDeclarator,
|
||||
) -> Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -31,7 +35,7 @@ arc(data: ArcData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
### Examples
|
||||
|
||||
```js
|
||||
exampleSketch = startSketchOn('XZ')
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> line(end = [10, 0])
|
||||
|> arc({
|
||||
|
@ -9,7 +9,11 @@ Draw a 3 point arc.
|
||||
The arc is constructed such that the start point is the current position of the sketch and two more points defined as the end and interior point. The interior point is placed between the start point and end point. The radius of the arc will be controlled by how far the interior point is placed from the start and end.
|
||||
|
||||
```js
|
||||
arcTo(data: ArcToData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
arcTo(
|
||||
data: ArcToData,
|
||||
sketch: Sketch,
|
||||
tag?: TagDeclarator,
|
||||
) -> Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -29,7 +33,7 @@ arcTo(data: ArcToData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
### Examples
|
||||
|
||||
```js
|
||||
exampleSketch = startSketchOn('XZ')
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> arcTo({ end = [10, 0], interior = [5, 5] }, %)
|
||||
|> close()
|
||||
|
@ -9,7 +9,10 @@ Check a value at runtime, and raise an error if the argument provided
|
||||
is false.
|
||||
|
||||
```js
|
||||
assert(data: bool, message: string) -> ()
|
||||
assert(
|
||||
data: bool,
|
||||
message: string,
|
||||
) -> ()
|
||||
```
|
||||
|
||||
|
||||
|
@ -9,7 +9,12 @@ Check that a numerical value equals another at runtime,
|
||||
otherwise raise an error.
|
||||
|
||||
```js
|
||||
assertEqual(left: number, right: number, epsilon: number, message: string) -> ()
|
||||
assertEqual(
|
||||
left: number,
|
||||
right: number,
|
||||
epsilon: number,
|
||||
message: string,
|
||||
) -> ()
|
||||
```
|
||||
|
||||
|
||||
|
@ -9,7 +9,11 @@ Check that a numerical value is greater than another at runtime,
|
||||
otherwise raise an error.
|
||||
|
||||
```js
|
||||
assertGreaterThan(left: number, right: number, message: string) -> ()
|
||||
assertGreaterThan(
|
||||
left: number,
|
||||
right: number,
|
||||
message: string,
|
||||
) -> ()
|
||||
```
|
||||
|
||||
|
||||
|
@ -9,7 +9,11 @@ Check that a numerical value is greater than or equal to another at runtime,
|
||||
otherwise raise an error.
|
||||
|
||||
```js
|
||||
assertGreaterThanOrEq(left: number, right: number, message: string) -> ()
|
||||
assertGreaterThanOrEq(
|
||||
left: number,
|
||||
right: number,
|
||||
message: string,
|
||||
) -> ()
|
||||
```
|
||||
|
||||
|
||||
|
@ -9,7 +9,11 @@ Check that a numerical value is less than to another at runtime,
|
||||
otherwise raise an error.
|
||||
|
||||
```js
|
||||
assertLessThan(left: number, right: number, message: string) -> ()
|
||||
assertLessThan(
|
||||
left: number,
|
||||
right: number,
|
||||
message: string,
|
||||
) -> ()
|
||||
```
|
||||
|
||||
|
||||
|
@ -9,7 +9,11 @@ Check that a numerical value is less than or equal to another at runtime,
|
||||
otherwise raise an error.
|
||||
|
||||
```js
|
||||
assertLessThanOrEq(left: number, right: number, message: string) -> ()
|
||||
assertLessThanOrEq(
|
||||
left: number,
|
||||
right: number,
|
||||
message: string,
|
||||
) -> ()
|
||||
```
|
||||
|
||||
|
||||
|
@ -9,7 +9,10 @@ Compute the four quadrant arctangent of Y and X (in radians).
|
||||
|
||||
|
||||
```js
|
||||
atan2(y: number, x: number) -> number
|
||||
atan2(
|
||||
y: number,
|
||||
x: number,
|
||||
) -> number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
@ -9,7 +9,11 @@ Draw a smooth, continuous, curved line segment from the current origin to
|
||||
the desired (x, y), using a number of control points to shape the curve's shape.
|
||||
|
||||
```js
|
||||
bezierCurve(data: BezierData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
bezierCurve(
|
||||
data: BezierData,
|
||||
sketch: Sketch,
|
||||
tag?: TagDeclarator,
|
||||
) -> Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -29,7 +33,7 @@ bezierCurve(data: BezierData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
### Examples
|
||||
|
||||
```js
|
||||
exampleSketch = startSketchOn('XZ')
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> line(end = [0, 10])
|
||||
|> bezierCurve({
|
||||
|
@ -9,7 +9,12 @@ Cut a straight transitional edge along a tagged path.
|
||||
Chamfer is similar in function and use to a fillet, except a fillet will blend the transition along an edge, rather than cut a sharp, straight transitional edge.
|
||||
|
||||
```js
|
||||
chamfer(solid: Solid, length: number, tags: [EdgeReference], tag?: TagDeclarator) -> Solid
|
||||
chamfer(
|
||||
solid: Solid,
|
||||
length: number,
|
||||
tags: [EdgeReference],
|
||||
tag?: TagDeclarator,
|
||||
) -> Solid
|
||||
```
|
||||
|
||||
|
||||
|
@ -9,7 +9,11 @@ Construct a 2-dimensional circle, of the specified radius, centered at
|
||||
the provided (x, y) origin point.
|
||||
|
||||
```js
|
||||
circle(data: CircleData, sketchSurfaceOrGroup: SketchOrSurface, tag?: TagDeclarator) -> Sketch
|
||||
circle(
|
||||
data: CircleData,
|
||||
sketchSurfaceOrGroup: SketchOrSurface,
|
||||
tag?: TagDeclarator,
|
||||
) -> Sketch
|
||||
```
|
||||
|
||||
|
||||
|
@ -9,7 +9,13 @@ Construct a circle derived from 3 points.
|
||||
|
||||
|
||||
```js
|
||||
circleThreePoint(p1: [number], p2: [number], p3: [number], sketchSurfaceOrGroup: SketchOrSurface, tag?: TagDeclarator) -> Sketch
|
||||
circleThreePoint(
|
||||
p1: [number],
|
||||
p2: [number],
|
||||
p3: [number],
|
||||
sketchSurfaceOrGroup: SketchOrSurface,
|
||||
tag?: TagDeclarator,
|
||||
) -> Sketch
|
||||
```
|
||||
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,15 +0,0 @@
|
||||
---
|
||||
title: "HALF_TURN"
|
||||
excerpt: ""
|
||||
layout: manual
|
||||
---
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
```js
|
||||
HALF_TURN: number(deg) = 180deg
|
||||
```
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,15 +0,0 @@
|
||||
---
|
||||
title: "QUARTER_TURN"
|
||||
excerpt: ""
|
||||
layout: manual
|
||||
---
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
```js
|
||||
QUARTER_TURN: number(deg) = 90deg
|
||||
```
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,15 +0,0 @@
|
||||
---
|
||||
title: "THREE_QUARTER_TURN"
|
||||
excerpt: ""
|
||||
layout: manual
|
||||
---
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
```js
|
||||
THREE_QUARTER_TURN: number(deg) = 270deg
|
||||
```
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
---
|
||||
title: "ZERO"
|
||||
title: "std::XY"
|
||||
excerpt: ""
|
||||
layout: manual
|
||||
---
|
||||
@ -9,7 +9,7 @@ layout: manual
|
||||
|
||||
|
||||
```js
|
||||
ZERO: number = 0
|
||||
std::XY
|
||||
```
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
---
|
||||
title: "ZERO"
|
||||
title: "std::XZ"
|
||||
excerpt: ""
|
||||
layout: manual
|
||||
---
|
||||
@ -9,7 +9,7 @@ layout: manual
|
||||
|
||||
|
||||
```js
|
||||
ZERO: number = 0
|
||||
std::XZ
|
||||
```
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
---
|
||||
title: "HALF_TURN"
|
||||
title: "std::YZ"
|
||||
excerpt: ""
|
||||
layout: manual
|
||||
---
|
||||
@ -9,7 +9,7 @@ layout: manual
|
||||
|
||||
|
||||
```js
|
||||
HALF_TURN: number(deg) = 180deg
|
||||
std::YZ
|
||||
```
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -9,7 +9,10 @@ Extend a 2-dimensional sketch through a third dimension in order to
|
||||
create new 3-dimensional volume, or if extruded into an existing volume, cut into an existing solid.
|
||||
|
||||
```js
|
||||
extrude(sketchSet: SketchSet, length: number) -> SolidSet
|
||||
extrude(
|
||||
sketchSet: SketchSet,
|
||||
length: number,
|
||||
) -> SolidSet
|
||||
```
|
||||
|
||||
|
||||
|
@ -9,7 +9,13 @@ Blend a transitional edge along a tagged path, smoothing the sharp edge.
|
||||
Fillet is similar in function and use to a chamfer, except a chamfer will cut a sharp transition along an edge while fillet will smoothly blend the transition.
|
||||
|
||||
```js
|
||||
fillet(solid: Solid, radius: number, tags: [EdgeReference], tolerance?: number, tag?: TagDeclarator) -> Solid
|
||||
fillet(
|
||||
solid: Solid,
|
||||
radius: number,
|
||||
tags: [EdgeReference],
|
||||
tolerance?: number,
|
||||
tag?: TagDeclarator,
|
||||
) -> Solid
|
||||
```
|
||||
|
||||
|
||||
|
@ -9,7 +9,14 @@ Create a helix.
|
||||
|
||||
|
||||
```js
|
||||
helix(revolutions: number, angleStart: number, ccw?: bool, radius: number, axis: Axis3dOrEdgeReference, length?: number) -> HelixValue
|
||||
helix(
|
||||
revolutions: number,
|
||||
angleStart: number,
|
||||
ccw?: bool,
|
||||
radius: number,
|
||||
axis: Axis3dOrEdgeReference,
|
||||
length?: number,
|
||||
) -> HelixValue
|
||||
```
|
||||
|
||||
|
||||
|
@ -9,7 +9,10 @@ Create a helix on a cylinder.
|
||||
|
||||
|
||||
```js
|
||||
helixRevolutions(data: HelixRevolutionsData, solid: Solid) -> Solid
|
||||
helixRevolutions(
|
||||
data: HelixRevolutionsData,
|
||||
solid: Solid,
|
||||
) -> Solid
|
||||
```
|
||||
|
||||
|
||||
|
@ -9,7 +9,10 @@ Use a 2-dimensional sketch to cut a hole in another 2-dimensional sketch.
|
||||
|
||||
|
||||
```js
|
||||
hole(holeSketch: SketchSet, sketch: Sketch) -> Sketch
|
||||
hole(
|
||||
holeSketch: SketchSet,
|
||||
sketch: Sketch,
|
||||
) -> Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -28,7 +31,7 @@ hole(holeSketch: SketchSet, sketch: Sketch) -> Sketch
|
||||
### Examples
|
||||
|
||||
```js
|
||||
exampleSketch = startSketchOn('XY')
|
||||
exampleSketch = startSketchOn(XY)
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> line(end = [0, 5])
|
||||
|> line(end = [5, 0])
|
||||
@ -44,7 +47,7 @@ example = extrude(exampleSketch, length = 1)
|
||||
|
||||
```js
|
||||
fn squareHoleSketch() {
|
||||
squareSketch = startSketchOn('-XZ')
|
||||
squareSketch = startSketchOn(-XZ)
|
||||
|> startProfileAt([-1, -1], %)
|
||||
|> line(end = [2, 0])
|
||||
|> line(end = [0, 2])
|
||||
@ -53,7 +56,7 @@ fn squareHoleSketch() {
|
||||
return squareSketch
|
||||
}
|
||||
|
||||
exampleSketch = startSketchOn('-XZ')
|
||||
exampleSketch = startSketchOn(-XZ)
|
||||
|> circle({ center = [0, 0], radius = 3 }, %)
|
||||
|> hole(squareHoleSketch(), %)
|
||||
example = extrude(exampleSketch, length = 1)
|
||||
|
@ -9,7 +9,10 @@ Make the inside of a 3D object hollow.
|
||||
Remove volume from a 3-dimensional shape such that a wall of the provided thickness remains around the exterior of the shape.
|
||||
|
||||
```js
|
||||
hollow(thickness: number, solid: Solid) -> Solid
|
||||
hollow(
|
||||
thickness: number,
|
||||
solid: Solid,
|
||||
) -> Solid
|
||||
```
|
||||
|
||||
|
||||
|
@ -15,7 +15,10 @@ For formats lacking unit data (such as STL, OBJ, or PLY files), the default unit
|
||||
Note: The import command currently only works when using the native Modeling App.
|
||||
|
||||
```js
|
||||
import(filePath: String, options?: ImportFormat) -> ImportedGeometry
|
||||
import(
|
||||
filePath: String,
|
||||
options?: ImportFormat,
|
||||
) -> ImportedGeometry
|
||||
```
|
||||
|
||||
|
||||
|
@ -6,13 +6,22 @@ layout: manual
|
||||
|
||||
## Table of Contents
|
||||
|
||||
* [Types](kcl/types)
|
||||
* [Modules](kcl/modules)
|
||||
* [Known Issues](kcl/KNOWN-ISSUES)
|
||||
### Language
|
||||
|
||||
* [`Types`](kcl/types)
|
||||
* [`Modules`](kcl/modules)
|
||||
* [`Settings`](kcl/settings)
|
||||
* [`Known Issues`](kcl/known-issues)
|
||||
|
||||
### Standard library
|
||||
|
||||
* **`std`**
|
||||
* [`HALF_TURN`](kcl/const_std-HALF_TURN)
|
||||
* [`QUARTER_TURN`](kcl/const_std-QUARTER_TURN)
|
||||
* [`THREE_QUARTER_TURN`](kcl/const_std-THREE_QUARTER_TURN)
|
||||
* [`XY`](kcl/const_std-XY)
|
||||
* [`XZ`](kcl/const_std-XZ)
|
||||
* [`YZ`](kcl/const_std-YZ)
|
||||
* [`ZERO`](kcl/const_std-ZERO)
|
||||
* [`abs`](kcl/abs)
|
||||
* [`acos`](kcl/acos)
|
||||
@ -90,7 +99,9 @@ layout: manual
|
||||
* [`reduce`](kcl/reduce)
|
||||
* [`rem`](kcl/rem)
|
||||
* [`revolve`](kcl/revolve)
|
||||
* [`rotate`](kcl/rotate)
|
||||
* [`round`](kcl/round)
|
||||
* [`scale`](kcl/scale)
|
||||
* [`segAng`](kcl/segAng)
|
||||
* [`segEnd`](kcl/segEnd)
|
||||
* [`segEndX`](kcl/segEndX)
|
||||
@ -110,6 +121,7 @@ layout: manual
|
||||
* [`tangentialArcToRelative`](kcl/tangentialArcToRelative)
|
||||
* [`toDegrees`](kcl/toDegrees)
|
||||
* [`toRadians`](kcl/toRadians)
|
||||
* [`translate`](kcl/translate)
|
||||
* [`xLine`](kcl/xLine)
|
||||
* [`xLineTo`](kcl/xLineTo)
|
||||
* [`yLine`](kcl/yLine)
|
||||
|
@ -9,7 +9,10 @@ Compute the angle of the given leg for x.
|
||||
|
||||
|
||||
```js
|
||||
legAngX(hypotenuse: number, leg: number) -> number
|
||||
legAngX(
|
||||
hypotenuse: number,
|
||||
leg: number,
|
||||
) -> number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
@ -9,7 +9,10 @@ Compute the angle of the given leg for y.
|
||||
|
||||
|
||||
```js
|
||||
legAngY(hypotenuse: number, leg: number) -> number
|
||||
legAngY(
|
||||
hypotenuse: number,
|
||||
leg: number,
|
||||
) -> number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
@ -9,7 +9,10 @@ Compute the length of the given leg.
|
||||
|
||||
|
||||
```js
|
||||
legLen(hypotenuse: number, leg: number) -> number
|
||||
legLen(
|
||||
hypotenuse: number,
|
||||
leg: number,
|
||||
) -> number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
@ -9,7 +9,12 @@ Extend the current sketch with a new straight line.
|
||||
|
||||
|
||||
```js
|
||||
line(sketch: Sketch, endAbsolute?: [number], end?: [number], tag?: TagDeclarator) -> Sketch
|
||||
line(
|
||||
sketch: Sketch,
|
||||
endAbsolute?: [number],
|
||||
end?: [number],
|
||||
tag?: TagDeclarator,
|
||||
) -> Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -30,7 +35,7 @@ line(sketch: Sketch, endAbsolute?: [number], end?: [number], tag?: TagDeclarator
|
||||
### Examples
|
||||
|
||||
```js
|
||||
triangle = startSketchOn("XZ")
|
||||
triangle = startSketchOn(XZ)
|
||||
|> startProfileAt([0, 0], %)
|
||||
// The 'end' argument means it ends at exactly [10, 0].
|
||||
// This is an absolute measurement, it is NOT relative to
|
||||
@ -41,7 +46,7 @@ triangle = startSketchOn("XZ")
|
||||
|> close()
|
||||
|> extrude(length = 5)
|
||||
|
||||
box = startSketchOn("XZ")
|
||||
box = startSketchOn(XZ)
|
||||
|> startProfileAt([10, 10], %)
|
||||
// The 'to' argument means move the pen this much.
|
||||
// So, [10, 0] is a relative distance away from the current point.
|
||||
|
@ -9,7 +9,13 @@ Create a 3D surface or solid by interpolating between two or more sketches.
|
||||
The sketches need to closed and on the same plane.
|
||||
|
||||
```js
|
||||
loft(sketches: [Sketch], vDegree: NonZeroU32, bezApproximateRational: bool, baseCurveIndex?: integer, tolerance?: number) -> Solid
|
||||
loft(
|
||||
sketches: [Sketch],
|
||||
vDegree: NonZeroU32,
|
||||
bezApproximateRational: bool,
|
||||
baseCurveIndex?: integer,
|
||||
tolerance?: number,
|
||||
) -> Solid
|
||||
```
|
||||
|
||||
|
||||
|
@ -9,7 +9,10 @@ Compute the logarithm of the number with respect to an arbitrary base.
|
||||
The result might not be correctly rounded owing to implementation details; `log2()` can produce more accurate results for base 2, and `log10()` can produce more accurate results for base 10.
|
||||
|
||||
```js
|
||||
log(num: number, base: number) -> number
|
||||
log(
|
||||
num: number,
|
||||
base: number,
|
||||
) -> number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
@ -9,7 +9,10 @@ Apply a function to every element of a list.
|
||||
Given a list like `[a, b, c]`, and a function like `f`, returns `[f(a), f(b), f(c)]`
|
||||
|
||||
```js
|
||||
map(array: [KclValue], mapFn: FunctionSource) -> [KclValue]
|
||||
map(
|
||||
array: [KclValue],
|
||||
mapFn: FunctionSource,
|
||||
) -> [KclValue]
|
||||
```
|
||||
|
||||
|
||||
|
@ -11,7 +11,10 @@ Only works on unclosed sketches for now.
|
||||
Mirror occurs around a local sketch axis rather than a global axis.
|
||||
|
||||
```js
|
||||
mirror2d(data: Mirror2dData, sketchSet: SketchSet) -> [Sketch]
|
||||
mirror2d(
|
||||
data: Mirror2dData,
|
||||
sketchSet: SketchSet,
|
||||
) -> [Sketch]
|
||||
```
|
||||
|
||||
|
||||
|
@ -20,7 +20,7 @@ export fn increment(x) {
|
||||
Other files in the project can now import functions that have been exported.
|
||||
This makes them available to use in another file.
|
||||
|
||||
```
|
||||
```norun
|
||||
// main.kcl
|
||||
import increment from "util.kcl"
|
||||
|
||||
@ -48,13 +48,13 @@ export fn decrement(x) {
|
||||
|
||||
When importing, you can import multiple functions at once.
|
||||
|
||||
```
|
||||
```norun
|
||||
import increment, decrement from "util.kcl"
|
||||
```
|
||||
|
||||
Imported symbols can be renamed for convenience or to avoid name collisions.
|
||||
|
||||
```
|
||||
```norun
|
||||
import increment as inc, decrement as dec from "util.kcl"
|
||||
```
|
||||
|
||||
@ -63,13 +63,13 @@ import increment as inc, decrement as dec from "util.kcl"
|
||||
`import` can also be used to import files from other CAD systems. The format of the statement is the
|
||||
same as for KCL files. You can only import the whole file, not items from it. E.g.,
|
||||
|
||||
```
|
||||
```norun
|
||||
import "tests/inputs/cube.obj"
|
||||
|
||||
// Use `cube` just like a KCL object.
|
||||
```
|
||||
|
||||
```
|
||||
```norun
|
||||
import "tests/inputs/cube-2.sldprt" as cube
|
||||
|
||||
// Use `cube` just like a KCL object.
|
||||
@ -78,7 +78,7 @@ import "tests/inputs/cube-2.sldprt" as cube
|
||||
You can make the file format explicit using a format attribute (useful if using a different
|
||||
extension), e.g.,
|
||||
|
||||
```
|
||||
```norun
|
||||
@(format = obj)
|
||||
import "tests/inputs/cube"
|
||||
```
|
||||
@ -87,7 +87,7 @@ For formats lacking unit data (such as STL, OBJ, or PLY files), the default
|
||||
unit of measurement is millimeters. Alternatively you may specify the unit
|
||||
by using an attirbute. Likewise, you can also specify a coordinate system. E.g.,
|
||||
|
||||
```
|
||||
```norun
|
||||
@(unitLength = ft, coords = opengl)
|
||||
import "tests/inputs/cube.obj"
|
||||
```
|
||||
|
@ -9,7 +9,10 @@ Offset a plane by a distance along its normal.
|
||||
For example, if you offset the 'XZ' plane by 10, the new plane will be parallel to the 'XZ' plane and 10 units away from it.
|
||||
|
||||
```js
|
||||
offsetPlane(plane: PlaneData, offset: number) -> Plane
|
||||
offsetPlane(
|
||||
plane: PlaneData,
|
||||
offset: number,
|
||||
) -> Plane
|
||||
```
|
||||
|
||||
|
||||
|
@ -9,7 +9,14 @@ Repeat a 2-dimensional sketch some number of times along a partial or
|
||||
complete circle some specified number of times. Each object may additionally be rotated along the circle, ensuring orentation of the solid with respect to the center of the circle is maintained.
|
||||
|
||||
```js
|
||||
patternCircular2d(sketchSet: SketchSet, instances: integer, center: [number], arcDegrees: number, rotateDuplicates: bool, useOriginal?: bool) -> [Sketch]
|
||||
patternCircular2d(
|
||||
sketchSet: SketchSet,
|
||||
instances: integer,
|
||||
center: [number],
|
||||
arcDegrees: number,
|
||||
rotateDuplicates: bool,
|
||||
useOriginal?: bool,
|
||||
) -> [Sketch]
|
||||
```
|
||||
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -9,7 +9,13 @@ Repeat a 2-dimensional sketch along some dimension, with a dynamic amount
|
||||
of distance between each repetition, some specified number of times.
|
||||
|
||||
```js
|
||||
patternLinear2d(sketchSet: SketchSet, instances: integer, distance: number, axis: [number], useOriginal?: bool) -> [Sketch]
|
||||
patternLinear2d(
|
||||
sketchSet: SketchSet,
|
||||
instances: integer,
|
||||
distance: number,
|
||||
axis: [number],
|
||||
useOriginal?: bool,
|
||||
) -> [Sketch]
|
||||
```
|
||||
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -35,7 +35,12 @@ The transform function returns a transform object. All properties of the object
|
||||
- `rotation.origin` (either "local" i.e. rotate around its own center, "global" i.e. rotate around the scene's center, or a 3D point, defaults to "local")
|
||||
|
||||
```js
|
||||
patternTransform(solidSet: SolidSet, instances: integer, transform: FunctionSource, useOriginal?: bool) -> [Solid]
|
||||
patternTransform(
|
||||
solidSet: SolidSet,
|
||||
instances: integer,
|
||||
transform: FunctionSource,
|
||||
useOriginal?: bool,
|
||||
) -> [Solid]
|
||||
```
|
||||
|
||||
|
||||
|
@ -9,7 +9,12 @@ Just like patternTransform, but works on 2D sketches not 3D solids.
|
||||
|
||||
|
||||
```js
|
||||
patternTransform2d(sketchSet: SketchSet, instances: integer, transform: FunctionSource, useOriginal?: bool) -> [Sketch]
|
||||
patternTransform2d(
|
||||
sketchSet: SketchSet,
|
||||
instances: integer,
|
||||
transform: FunctionSource,
|
||||
useOriginal?: bool,
|
||||
) -> [Sketch]
|
||||
```
|
||||
|
||||
|
||||
|
@ -9,7 +9,11 @@ Create a regular polygon with the specified number of sides that is either inscr
|
||||
|
||||
|
||||
```js
|
||||
polygon(data: PolygonData, sketchSurfaceOrGroup: SketchOrSurface, tag?: TagDeclarator) -> Sketch
|
||||
polygon(
|
||||
data: PolygonData,
|
||||
sketchSurfaceOrGroup: SketchOrSurface,
|
||||
tag?: TagDeclarator,
|
||||
) -> Sketch
|
||||
```
|
||||
|
||||
|
||||
|
@ -9,7 +9,10 @@ Compute the number to a power.
|
||||
|
||||
|
||||
```js
|
||||
pow(num: number, pow: number) -> number
|
||||
pow(
|
||||
num: number,
|
||||
pow: number,
|
||||
) -> number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
@ -27,7 +27,7 @@ profileStart(sketch: Sketch) -> [number]
|
||||
### Examples
|
||||
|
||||
```js
|
||||
sketch001 = startSketchOn('XY')
|
||||
sketch001 = startSketchOn(XY)
|
||||
|> startProfileAt([5, 2], %)
|
||||
|> angledLine({ angle = 120, length = 50 }, %, $seg01)
|
||||
|> angledLine({
|
||||
|
@ -27,7 +27,7 @@ profileStartX(sketch: Sketch) -> number
|
||||
### Examples
|
||||
|
||||
```js
|
||||
sketch001 = startSketchOn('XY')
|
||||
sketch001 = startSketchOn(XY)
|
||||
|> startProfileAt([5, 2], %)
|
||||
|> angledLine([-26.6, 50], %)
|
||||
|> angledLine([90, 50], %)
|
||||
|
@ -27,7 +27,7 @@ profileStartY(sketch: Sketch) -> number
|
||||
### Examples
|
||||
|
||||
```js
|
||||
sketch001 = startSketchOn('XY')
|
||||
sketch001 = startSketchOn(XY)
|
||||
|> startProfileAt([5, 2], %)
|
||||
|> angledLine({ angle = -60, length = 14 }, %)
|
||||
|> angledLineToY({ angle = 30, to = profileStartY(%) }, %)
|
||||
|
@ -9,7 +9,10 @@ Append an element to the end of an array.
|
||||
Returns a new array with the element appended.
|
||||
|
||||
```js
|
||||
push(array: [KclValue], elem: KclValue) -> KclValue
|
||||
push(
|
||||
array: [KclValue],
|
||||
elem: KclValue,
|
||||
) -> KclValue
|
||||
```
|
||||
|
||||
|
||||
|
@ -9,7 +9,11 @@ Take a starting value. Then, for each element of an array, calculate the next va
|
||||
using the previous value and the element.
|
||||
|
||||
```js
|
||||
reduce(array: [KclValue], start: KclValue, reduceFn: FunctionSource) -> KclValue
|
||||
reduce(
|
||||
array: [KclValue],
|
||||
start: KclValue,
|
||||
reduceFn: FunctionSource,
|
||||
) -> KclValue
|
||||
```
|
||||
|
||||
|
||||
|
@ -9,7 +9,10 @@ Compute the remainder after dividing `num` by `div`.
|
||||
If `num` is negative, the result will be too.
|
||||
|
||||
```js
|
||||
rem(num: number, divisor: number) -> number
|
||||
rem(
|
||||
num: number,
|
||||
divisor: number,
|
||||
) -> number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
@ -11,7 +11,10 @@ This, like extrude, is able to create a 3-dimensional solid from a 2-dimensional
|
||||
Revolve occurs around a local sketch axis rather than a global axis.
|
||||
|
||||
```js
|
||||
revolve(data: RevolveData, sketch: Sketch) -> Solid
|
||||
revolve(
|
||||
data: RevolveData,
|
||||
sketch: Sketch,
|
||||
) -> Solid
|
||||
```
|
||||
|
||||
|
||||
|
109
docs/kcl/rotate.md
Normal file
109
docs/kcl/rotate.md
Normal file
File diff suppressed because one or more lines are too long
63
docs/kcl/scale.md
Normal file
63
docs/kcl/scale.md
Normal file
File diff suppressed because one or more lines are too long
30
docs/kcl/settings.md
Normal file
30
docs/kcl/settings.md
Normal file
@ -0,0 +1,30 @@
|
||||
---
|
||||
title: "KCL settings"
|
||||
excerpt: "Documentation of settings for the KCL language and Zoo Modeling App."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
# Per-file settings
|
||||
|
||||
Settings which affect a single file are configured using the settings attribute.
|
||||
This must be at the top of the KCL file (comments before the attribute are permitted).
|
||||
E.g.,
|
||||
|
||||
```
|
||||
// The settings attribute.
|
||||
@settings(defaultLengthUnit = in)
|
||||
|
||||
// The rest of your KCL code goes below...
|
||||
|
||||
x = 42 // Represents 42 inches.
|
||||
```
|
||||
|
||||
The settings attribute may contain multiple properties separated by commas.
|
||||
Valid properties are:
|
||||
|
||||
- `defaultLengthUnit`: the default length unit to use for numbers declared in this file.
|
||||
- Accepted values: `mm`, `cm`, `m`, `in` (inches), `ft` (feet), `yd` (yards).
|
||||
- `defaultAngleUnit`: the default angle unit to use for numbers declared in this file.
|
||||
- Accepted values: `deg` (degrees), `rad` (radians).
|
||||
|
||||
These settings override any project-wide settings (configured in project.toml or via the UI).
|
@ -9,7 +9,11 @@ Remove volume from a 3-dimensional shape such that a wall of the
|
||||
provided thickness remains, taking volume starting at the provided face, leaving it open in that direction.
|
||||
|
||||
```js
|
||||
shell(solidSet: SolidSet, thickness: number, faces: [FaceTag]) -> SolidSet
|
||||
shell(
|
||||
solidSet: SolidSet,
|
||||
thickness: number,
|
||||
faces: [FaceTag],
|
||||
) -> SolidSet
|
||||
```
|
||||
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
27505
docs/kcl/std.json
27505
docs/kcl/std.json
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -9,7 +9,11 @@ Draw a curved line segment along part of an imaginary circle.
|
||||
The arc is constructed such that the last line segment is placed tangent to the imaginary circle of the specified radius. The resulting arc is the segment of the imaginary circle from that tangent point for 'offset' degrees along the imaginary circle.
|
||||
|
||||
```js
|
||||
tangentialArc(data: TangentialArcData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
tangentialArc(
|
||||
data: TangentialArcData,
|
||||
sketch: Sketch,
|
||||
tag?: TagDeclarator,
|
||||
) -> Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -29,7 +33,7 @@ tangentialArc(data: TangentialArcData, sketch: Sketch, tag?: TagDeclarator) -> S
|
||||
### Examples
|
||||
|
||||
```js
|
||||
exampleSketch = startSketchOn('XZ')
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> angledLine({ angle = 60, length = 10 }, %)
|
||||
|> tangentialArc({ radius = 10, offset = -120 }, %)
|
||||
|
@ -9,7 +9,11 @@ Starting at the current sketch's origin, draw a curved line segment along
|
||||
some part of an imaginary circle until it reaches the desired (x, y) coordinates.
|
||||
|
||||
```js
|
||||
tangentialArcTo(to: [number], sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
tangentialArcTo(
|
||||
to: [number],
|
||||
sketch: Sketch,
|
||||
tag?: TagDeclarator,
|
||||
) -> Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -29,7 +33,7 @@ tangentialArcTo(to: [number], sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
### Examples
|
||||
|
||||
```js
|
||||
exampleSketch = startSketchOn('XZ')
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> angledLine({ angle = 60, length = 10 }, %)
|
||||
|> tangentialArcTo([15, 15], %)
|
||||
|
@ -9,7 +9,11 @@ Starting at the current sketch's origin, draw a curved line segment along
|
||||
some part of an imaginary circle until it reaches a point the given (x, y) distance away.
|
||||
|
||||
```js
|
||||
tangentialArcToRelative(delta: [number], sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
tangentialArcToRelative(
|
||||
delta: [number],
|
||||
sketch: Sketch,
|
||||
tag?: TagDeclarator,
|
||||
) -> Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -29,7 +33,7 @@ tangentialArcToRelative(delta: [number], sketch: Sketch, tag?: TagDeclarator) ->
|
||||
### Examples
|
||||
|
||||
```js
|
||||
exampleSketch = startSketchOn('XZ')
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> angledLine({ angle = 45, length = 10 }, %)
|
||||
|> tangentialArcToRelative([0, -10], %)
|
||||
|
61
docs/kcl/translate.md
Normal file
61
docs/kcl/translate.md
Normal file
File diff suppressed because one or more lines are too long
@ -74,18 +74,15 @@ fn myFn(x) {
|
||||
|
||||
As you can see above `myFn` just returns whatever it is given.
|
||||
|
||||
KCL's early drafts used positional arguments, but we now use keyword arguments. If you declare a
|
||||
function like this:
|
||||
KCL's early drafts used positional arguments, but we now use keyword arguments:
|
||||
|
||||
```
|
||||
// If you declare a function like this
|
||||
fn add(left, right) {
|
||||
return left + right
|
||||
}
|
||||
```
|
||||
|
||||
You can call it like this:
|
||||
|
||||
```
|
||||
// You can call it like this:
|
||||
total = add(left = 1, right = 2)
|
||||
```
|
||||
|
||||
@ -111,14 +108,14 @@ three = add(1, delta = 2)
|
||||
|
||||
It can be hard to read repeated function calls, because of all the nested brackets.
|
||||
|
||||
```
|
||||
```norun
|
||||
i = 1
|
||||
x = h(g(f(i)))
|
||||
```
|
||||
|
||||
You can make this easier to read by breaking it into many declarations, but that is a bit annoying.
|
||||
|
||||
```
|
||||
```norun
|
||||
i = 1
|
||||
x0 = f(i)
|
||||
x1 = g(x0)
|
||||
@ -133,7 +130,7 @@ the `%` in the right-hand side.
|
||||
So, this means `x |> f(%) |> g(%)` is shorthand for `g(f(x))`. The code example above, with its
|
||||
somewhat-clunky `x0` and `x1` constants could be rewritten as
|
||||
|
||||
```
|
||||
```norun
|
||||
i = 1
|
||||
x = i
|
||||
|> f(%)
|
||||
@ -147,8 +144,8 @@ This helps keep your code neat and avoid unnecessary declarations.
|
||||
|
||||
Say you have a long pipeline of sketch functions, like this:
|
||||
|
||||
```
|
||||
startSketch()
|
||||
```norun
|
||||
startSketchOn('XZ')
|
||||
|> line(%, end = [3, 4])
|
||||
|> line(%, end = [10, 10])
|
||||
|> line(%, end = [-13, -14])
|
||||
@ -162,8 +159,8 @@ If a function call uses an unlabeled first parameter, it will default to `%` if
|
||||
means that `|> line(%, end = [3, 4])` and `|> line(end = [3, 4])` are equivalent! So the above
|
||||
could be rewritten as
|
||||
|
||||
```
|
||||
startSketch()
|
||||
```norun
|
||||
startSketchOn('XZ')
|
||||
|> line(end = [3, 4])
|
||||
|> line(end = [10, 10])
|
||||
|> line(end = [-13, -14])
|
||||
@ -184,7 +181,7 @@ Tags are used to give a name (tag) to a specific path.
|
||||
The syntax for declaring a tag is `$myTag` you would use it in the following
|
||||
way:
|
||||
|
||||
```
|
||||
```norun
|
||||
startSketchOn('XZ')
|
||||
|> startProfileAt(origin, %)
|
||||
|> angledLine({angle = 0, length = 191.26}, %, $rectangleSegmentA001)
|
||||
@ -216,7 +213,7 @@ use the tag `rectangleSegmentA001` in any function or expression in the file.
|
||||
|
||||
However if the code was written like this:
|
||||
|
||||
```
|
||||
```norun
|
||||
fn rect(origin) {
|
||||
return startSketchOn('XZ')
|
||||
|> startProfileAt(origin, %)
|
||||
@ -244,7 +241,7 @@ However you likely want to use those tags somewhere outside the `rect` function.
|
||||
Tags are accessible through the sketch group they are declared in.
|
||||
For example the following code works.
|
||||
|
||||
```
|
||||
```norun
|
||||
fn rect(origin) {
|
||||
return startSketchOn('XZ')
|
||||
|> startProfileAt(origin, %)
|
||||
|
@ -34,6 +34,18 @@ A custom plane.
|
||||
|
||||
|
||||
|
||||
----
|
||||
A custom plane which has not been sent to the engine. It must be sent before it is used.
|
||||
|
||||
**enum:** `Uninit`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user