Compare commits
232 Commits
v0.21.8
...
callbacks-
Author | SHA1 | Date | |
---|---|---|---|
cf068f325e | |||
d60d2292f3 | |||
7d564cc2ac | |||
05a84213dd | |||
a85c1a9375 | |||
5701616f3e | |||
846acaba2f | |||
0a524d42f6 | |||
fe28527ef9 | |||
0e8d0083c4 | |||
4f4167b247 | |||
fbc2e9d02c | |||
33b15e818b | |||
6cebb84ae0 | |||
85403e47e4 | |||
0dfee64e3b | |||
6370d45f94 | |||
fb3e922180 | |||
1257ec0327 | |||
08e9fe2e52 | |||
7cec1d45fe | |||
93710bc8f2 | |||
87e7e9447f | |||
8be113d284 | |||
7cfc927d5c | |||
c0f04d5f86 | |||
3dbc701f26 | |||
16e7ae38e3 | |||
24c7260327 | |||
72cfc4a471 | |||
2d128ed32e | |||
cd6749ba02 | |||
7243405e1b | |||
c8da057ec2 | |||
220fe5b2b8 | |||
4e6429de49 | |||
5391a65b18 | |||
592628917a | |||
4c6e8633f7 | |||
c5150468a2 | |||
39126dbff1 | |||
f86a69f12a | |||
de354ee5d3 | |||
dfef7338ee | |||
ee08948f54 | |||
832f6b65e2 | |||
68efd77c5d | |||
8f138109dd | |||
8972f53256 | |||
0c5b13ade5 | |||
446f92a53a | |||
2256e3bc09 | |||
9e2876edc6 | |||
a138af1ec8 | |||
684c585a48 | |||
500be20649 | |||
5fbbe2fa8c | |||
5f5ecc5afe | |||
3dafc31cad | |||
9c230bc678 | |||
1fad6966b6 | |||
c7efb4c006 | |||
68fd921a64 | |||
a20e710e8f | |||
9daf2d7794 | |||
f86473d13b | |||
6fccc68c18 | |||
ade66d0876 | |||
b5f3a067ee | |||
bb9d24f821 | |||
bd3cd97d74 | |||
1b5839a7f8 | |||
a9e480f0ed | |||
63fa04608c | |||
0d4d7fa751 | |||
68cdb68231 | |||
053bdffc45 | |||
9ffc08b84a | |||
47e8d3f4fc | |||
53db421d97 | |||
289ed291c4 | |||
39ceb83840 | |||
af449ff6ca | |||
e1bf55cc4a | |||
8fe2d33063 | |||
d7e36eed24 | |||
6123ed6a82 | |||
da6cd5cf9f | |||
ad5bfa1a29 | |||
6358bdd7cd | |||
d6fe414b2e | |||
25e7e8cb89 | |||
a175870453 | |||
24516cdb2d | |||
496398de52 | |||
3304a74064 | |||
f4877cb160 | |||
f7196e7eb0 | |||
5260bd6820 | |||
394653247a | |||
fbd22a2d17 | |||
7c568f68e5 | |||
31b0766754 | |||
cd33b40c37 | |||
3300772e3d | |||
fa37752a41 | |||
34c5c153c8 | |||
3f343698a8 | |||
0bd9f42e17 | |||
aad29fca9f | |||
a8c1a14d48 | |||
8194f8b70b | |||
03e4f457d4 | |||
226ed37c5f | |||
0f3f923019 | |||
bf8fb0d127 | |||
4a275c2ff7 | |||
baf5509f1d | |||
47a5e1f6d3 | |||
d85211c5a4 | |||
1beb6b5186 | |||
17978ab1d7 | |||
a1bcad9dfb | |||
2e7bdf02cf | |||
6f76196b72 | |||
e7af064518 | |||
674d49e2ae | |||
4cb48674c6 | |||
82daec2aff | |||
f1ef9d5200 | |||
dc226d3270 | |||
7bf50d8fe0 | |||
b26764bc9a | |||
1b0c6298d7 | |||
fe9a483726 | |||
bd42ea037b | |||
fdb1b21af3 | |||
630ef316b8 | |||
e322926be9 | |||
a9e61da8b5 | |||
e2a835a437 | |||
c61273085f | |||
a79e365c0f | |||
2386ba24e5 | |||
e42a891df8 | |||
98200565bf | |||
570fd827ed | |||
0add26cf61 | |||
b54fc534c2 | |||
c66f851a3f | |||
13b8ab71d8 | |||
bdeab4f87d | |||
05ccf5e2f4 | |||
7ab015d783 | |||
3d6cfa980f | |||
9f5f1eb8c3 | |||
50fcdff879 | |||
efaae2b193 | |||
7e4ebacb72 | |||
72482506c3 | |||
a51b5b09a3 | |||
53ccc1ed6c | |||
8106749ccf | |||
081e34a600 | |||
541400f4be | |||
39d249030d | |||
f8a69fac73 | |||
24f4bf160f | |||
8011594e24 | |||
0e09affb8f | |||
197a47346a | |||
9d083710e0 | |||
afa7c1dc4e | |||
c74b695a71 | |||
d0c244e05e | |||
a315b77f02 | |||
15c854ff18 | |||
acd3a5717d | |||
8a2555550f | |||
62e75c852a | |||
dd3601ea7b | |||
a5e7782d9a | |||
79b0b70688 | |||
1d134c1be0 | |||
1c58572234 | |||
ecee51e82b | |||
978ac42f1c | |||
893996430e | |||
41e65fc4e9 | |||
99aa74ceba | |||
0bcf33ed00 | |||
d0a9b5ecab | |||
a569f818cf | |||
f73556ba7b | |||
29cdc66b34 | |||
c9800a58d0 | |||
e46aca4992 | |||
9564890b29 | |||
f8a1f40f20 | |||
c551d88db4 | |||
8eee3e1c58 | |||
b02529cae0 | |||
cf03021366 | |||
f52d2d55f1 | |||
59b1319e50 | |||
b07bbda20b | |||
3c01924184 | |||
bd16902f02 | |||
8c3af1a72a | |||
33f5d7740d | |||
b388f60648 | |||
8f4380be74 | |||
9ae8042a57 | |||
4b676d47da | |||
e6641e68f3 | |||
450afb1605 | |||
04433fecad | |||
6567e2ff92 | |||
91c32a7fe2 | |||
f735cdc22e | |||
1b72c7df85 | |||
062abd148f | |||
c93ed0f306 | |||
27e2518dde | |||
dc6505acaf | |||
6ff3284eca | |||
4cb6ceb043 | |||
1db3e1b5e4 | |||
d797d20d50 | |||
cf52e151fb | |||
87c551b869 | |||
2001262494 |
@ -1,3 +1,3 @@
|
||||
[codespell]
|
||||
ignore-words-list: crate,everytime,inout,co-ordinate,ot,nwo,absolutey,atleast
|
||||
ignore-words-list: crate,everytime,inout,co-ordinate,ot,nwo,absolutey,atleast,ue
|
||||
skip: **/target,node_modules,build,**/Cargo.lock,./docs/kcl/*.md,./src-tauri/gen/schemas
|
||||
|
10
.eslintrc
@ -4,7 +4,8 @@
|
||||
"project": "./tsconfig.json"
|
||||
},
|
||||
"plugins": [
|
||||
"css-modules"
|
||||
"css-modules",
|
||||
"suggest-no-throw",
|
||||
],
|
||||
"extends": [
|
||||
"react-app",
|
||||
@ -17,6 +18,7 @@
|
||||
"never"
|
||||
],
|
||||
"react-hooks/exhaustive-deps": "off",
|
||||
"suggest-no-throw/suggest-no-throw": "warn",
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
@ -25,6 +27,12 @@
|
||||
"@typescript-eslint/no-floating-promises": "warn",
|
||||
"testing-library/prefer-screen-queries": "off"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": ["src/**/*.test.ts"],
|
||||
"rules": {
|
||||
"suggest-no-throw/suggest-no-throw": "off",
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
4
.github/workflows/cargo-bench.yml
vendored
@ -38,5 +38,7 @@ jobs:
|
||||
- name: Benchmark kcl library
|
||||
shell: bash
|
||||
run: |-
|
||||
cd src/wasm-lib/kcl; cargo bench -- iai
|
||||
cd src/wasm-lib/kcl; cargo bench --all-features -- iai
|
||||
env:
|
||||
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}}
|
||||
|
||||
|
40
.github/workflows/cargo-check.yml
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- '**/Cargo.toml'
|
||||
- '**/Cargo.lock'
|
||||
- '**/rust-toolchain.toml'
|
||||
- '**.rs'
|
||||
- .github/workflows/cargo-check.yml
|
||||
pull_request:
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
name: cargo check
|
||||
jobs:
|
||||
cargocheck:
|
||||
name: cargo check
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
dir: ['src/wasm-lib']
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install latest rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
override: true
|
||||
|
||||
- name: Rust Cache
|
||||
uses: Swatinem/rust-cache@v2.6.1
|
||||
|
||||
- name: Run check
|
||||
run: |
|
||||
cd "${{ matrix.dir }}"
|
||||
# We specifically want to test the disable-println feature
|
||||
# Since it is not enabled by default, we need to specify it
|
||||
# This is used in kcl-lsp
|
||||
cargo check --all --features disable-println --features pyo3
|
11
.github/workflows/cargo-clippy.yml
vendored
@ -9,6 +9,12 @@ on:
|
||||
- '**.rs'
|
||||
- .github/workflows/cargo-clippy.yml
|
||||
pull_request:
|
||||
paths:
|
||||
- '**/Cargo.toml'
|
||||
- '**/Cargo.lock'
|
||||
- '**/rust-toolchain.toml'
|
||||
- '**.rs'
|
||||
- .github/workflows/cargo-clippy.yml
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
@ -54,3 +60,8 @@ jobs:
|
||||
run: |
|
||||
cd "${{ matrix.dir }}"
|
||||
cargo clippy --all --tests --benches -- -D warnings
|
||||
# If this fails, run "cargo check" to update Cargo.lock,
|
||||
# then add Cargo.lock to the PR.
|
||||
- name: Check Cargo.lock doesn't need updating
|
||||
run: |
|
||||
cargo check --locked || echo "Pls run cargo check and commit the changed Cargo.lock"
|
||||
|
34
.github/workflows/ci.yml
vendored
@ -138,6 +138,7 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/download-artifact@v3
|
||||
if: github.event_name == 'schedule'
|
||||
|
||||
- name: Copy updated .json files
|
||||
if: github.event_name == 'schedule'
|
||||
@ -147,6 +148,14 @@ jobs:
|
||||
cp artifact/src-tauri/tauri.conf.json src-tauri/tauri.conf.json
|
||||
cp artifact/src-tauri/tauri.release.conf.json src-tauri/tauri.release.conf.json
|
||||
|
||||
- name: Update WebView2 on Windows
|
||||
if: matrix.os == 'windows-latest'
|
||||
# Workaround needed to build the tauri windows app with matching edge version.
|
||||
# From https://github.com/actions/runner-images/issues/9538
|
||||
run: |
|
||||
Invoke-WebRequest -Uri 'https://go.microsoft.com/fwlink/p/?LinkId=2124703' -OutFile 'setup.exe'
|
||||
Start-Process -FilePath setup.exe -Verb RunAs -Wait
|
||||
|
||||
- name: Install ubuntu system dependencies
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
run: |
|
||||
@ -172,9 +181,7 @@ jobs:
|
||||
- name: Setup Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
# TODO: re-enable for Windows builds, see https://github.com/tauri-apps/tauri/issues/9045
|
||||
- name: Setup Rust cache
|
||||
if: matrix.os != 'windows-latest'
|
||||
uses: swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: './src-tauri -> target'
|
||||
@ -232,12 +239,8 @@ jobs:
|
||||
shell: cmd
|
||||
|
||||
- name: Build the app (debug)
|
||||
uses: tauri-apps/tauri-action@v0
|
||||
if: ${{ env.BUILD_RELEASE == 'false' }}
|
||||
with:
|
||||
includeRelease: false
|
||||
includeDebug: true
|
||||
args: "${{ env.TAURI_ARGS_MACOS }} ${{ env.TAURI_ARGS_UBUNTU }}"
|
||||
run: "yarn tauri build --debug ${{ env.TAURI_ARGS_MACOS }} ${{ env.TAURI_ARGS_UBUNTU }}"
|
||||
|
||||
- name: Build for Mac TestFlight (nightly)
|
||||
if: ${{ github.event_name == 'schedule' && matrix.os == 'macos-14' }}
|
||||
@ -330,7 +333,6 @@ jobs:
|
||||
# specific and we want to overwrite it with the this new build after and
|
||||
# not upload the apple store build to the public bucket
|
||||
- name: Build the app (release) and sign
|
||||
uses: tauri-apps/tauri-action@v0
|
||||
if: ${{ env.BUILD_RELEASE == 'true' }}
|
||||
env:
|
||||
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
||||
@ -342,8 +344,7 @@ jobs:
|
||||
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
|
||||
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
||||
TAURI_CONF_ARGS: "--config ${{ matrix.os == 'windows-latest' && 'src-tauri\\tauri.release.conf.json' || 'src-tauri/tauri.release.conf.json' }}"
|
||||
with:
|
||||
args: "${{ env.TAURI_CONF_ARGS }} ${{ env.TAURI_ARGS_MACOS }} ${{ env.TAURI_ARGS_UBUNTU }}"
|
||||
run: "yarn tauri build ${{ env.TAURI_CONF_ARGS }} ${{ env.TAURI_ARGS_MACOS }} ${{ env.TAURI_ARGS_UBUNTU }}"
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: matrix.os != 'ubuntu-latest'
|
||||
@ -364,8 +365,21 @@ jobs:
|
||||
E2E_APPLICATION: "./src-tauri/target/${{ env.BUILD_RELEASE == 'true' && 'release' || 'debug' }}/zoo-modeling-app"
|
||||
KITTYCAD_API_TOKEN: ${{ env.BUILD_RELEASE == 'true' && secrets.KITTYCAD_API_TOKEN || secrets.KITTYCAD_API_TOKEN_DEV }}
|
||||
|
||||
- name: Run e2e tests (windows only)
|
||||
if: ${{ matrix.os == 'windows-latest' && github.event_name != 'release' && github.event_name != 'schedule' }}
|
||||
run: |
|
||||
cargo install tauri-driver --force
|
||||
yarn wdio run wdio.conf.ts
|
||||
env:
|
||||
E2E_APPLICATION: ".\\src-tauri\\target\\${{ env.BUILD_RELEASE == 'true' && 'release' || 'debug' }}\\Zoo Modeling App.exe"
|
||||
KITTYCAD_API_TOKEN: ${{ env.BUILD_RELEASE == 'true' && secrets.KITTYCAD_API_TOKEN || secrets.KITTYCAD_API_TOKEN_DEV }}
|
||||
VITE_KC_API_BASE_URL: ${{ env.BUILD_RELEASE == 'true' && 'https://api.zoo.dev' || 'https://api.dev.zoo.dev' }}
|
||||
E2E_TAURI_ENABLED: true
|
||||
TS_NODE_COMPILER_OPTIONS: '{"module": "commonjs"}'
|
||||
|
||||
publish-apps-release:
|
||||
permissions:
|
||||
contents: write
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event_name == 'release' || github.event_name == 'schedule' }}
|
||||
needs: [check-format, check-types, check-typos, build-test-web, prepare-json-files, build-test-apps]
|
||||
|
122
.github/workflows/playwright.yml
vendored
@ -38,6 +38,8 @@ jobs:
|
||||
runs-on: ubuntu-latest-8-cores
|
||||
needs: check-rust-changes
|
||||
steps:
|
||||
- name: Tune GitHub-hosted runner network
|
||||
uses: smorimoto/tune-github-hosted-runner-network@v1
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
@ -46,12 +48,18 @@ jobs:
|
||||
- uses: KittyCAD/action-install-cli@main
|
||||
- name: Install dependencies
|
||||
run: yarn
|
||||
- name: Cache Playwright Browsers
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.cache/ms-playwright/
|
||||
key: ${{ runner.os }}-playwright-${{ hashFiles('yarn.lock') }}
|
||||
- name: Install Playwright Browsers
|
||||
run: yarn playwright install --with-deps
|
||||
- name: Download Wasm Cache
|
||||
id: download-wasm
|
||||
if: needs.check-rust-changes.outputs.rust-changed == 'false'
|
||||
uses: dawidd6/action-download-artifact@v3
|
||||
uses: dawidd6/action-download-artifact@v6
|
||||
continue-on-error: true
|
||||
with:
|
||||
github_token: ${{secrets.GITHUB_TOKEN}}
|
||||
@ -84,26 +92,24 @@ jobs:
|
||||
- name: build web
|
||||
run: yarn build:local
|
||||
- name: Run ubuntu/chrome snapshots
|
||||
run: yarn playwright test --project="Google Chrome" --update-snapshots e2e/playwright/snapshot-tests.spec.ts
|
||||
continue-on-error: true
|
||||
run: |
|
||||
yarn playwright test --project="Google Chrome" --update-snapshots e2e/playwright/snapshot-tests.spec.ts
|
||||
env:
|
||||
CI: true
|
||||
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
||||
snapshottoken: ${{ secrets.KITTYCAD_API_TOKEN }}
|
||||
- uses: actions/upload-artifact@v3
|
||||
- name: Clean up test-results
|
||||
if: always()
|
||||
with:
|
||||
name: playwright-report
|
||||
path: playwright-report/
|
||||
retention-days: 30
|
||||
continue-on-error: true
|
||||
run: rm -r test-results
|
||||
- name: check for changes
|
||||
id: git-check
|
||||
run: |
|
||||
git add .
|
||||
if git status | grep -q "Changes to be committed"
|
||||
then
|
||||
echo "::set-output name=modified::true"
|
||||
else
|
||||
echo "::set-output name=modified::false"
|
||||
then echo "modified=true" >> $GITHUB_OUTPUT
|
||||
else echo "modified=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
- name: Commit changes, if any
|
||||
if: steps.git-check.outputs.modified == 'true'
|
||||
@ -119,23 +125,63 @@ jobs:
|
||||
git commit -am "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" || true
|
||||
git push
|
||||
git push origin ${{ github.head_ref }}
|
||||
# only upload artifacts if there's actually changes
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: steps.git-check.outputs.modified == 'true'
|
||||
with:
|
||||
name: playwright-report-ubuntu-${{ github.sha }}
|
||||
path: playwright-report/
|
||||
retention-days: 30
|
||||
# if have previous run results, use them
|
||||
- uses: actions/download-artifact@v4
|
||||
if: always()
|
||||
continue-on-error: true
|
||||
with:
|
||||
name: test-results-ubuntu-${{ github.sha }}
|
||||
path: test-results/
|
||||
- name: Run ubuntu/chrome flow retry failures
|
||||
id: retry
|
||||
if: always()
|
||||
run: |
|
||||
if [[ -d "test-results" ]];
|
||||
then if [[ $(ls -1 "test-results" | wc -l) != "0" ]];
|
||||
then echo "retried=true" >> $GITHUB_OUTPUT;
|
||||
else echo "retried=false" >> $GITHUB_OUTPUT; exit 0;
|
||||
fi;
|
||||
else echo "retried=false" >> $GITHUB_OUTPUT; exit 0;
|
||||
fi;
|
||||
yarn playwright test --project="Google Chrome" --last-failed e2e/playwright/flow-tests.spec.ts
|
||||
env:
|
||||
CI: true
|
||||
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
||||
- name: Run ubuntu/chrome flow
|
||||
if: steps.retry.outputs.retried == 'false'
|
||||
run: yarn playwright test --project="Google Chrome" e2e/playwright/flow-tests.spec.ts
|
||||
env:
|
||||
CI: true
|
||||
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: always()
|
||||
with:
|
||||
name: playwright-report
|
||||
name: test-results-ubuntu-${{ github.sha }}
|
||||
path: test-results/
|
||||
retention-days: 30
|
||||
overwrite: true
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: always()
|
||||
with:
|
||||
name: playwright-report-ubuntu-${{ github.sha }}
|
||||
path: playwright-report/
|
||||
retention-days: 30
|
||||
overwrite: true
|
||||
|
||||
playwright-macos:
|
||||
timeout-minutes: 60
|
||||
runs-on: macos-14
|
||||
runs-on: macos-14-large
|
||||
needs: check-rust-changes
|
||||
steps:
|
||||
- name: Tune GitHub-hosted runner network
|
||||
uses: smorimoto/tune-github-hosted-runner-network@v1
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
@ -143,12 +189,20 @@ jobs:
|
||||
cache: 'yarn'
|
||||
- name: Install dependencies
|
||||
run: yarn
|
||||
- name: Cache Playwright Browsers
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.cache/ms-playwright
|
||||
key: ${{ runner.os }}-playwright-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-playwright-
|
||||
- name: Install Playwright Browsers
|
||||
run: yarn playwright install --with-deps
|
||||
- name: Download Wasm Cache
|
||||
id: download-wasm
|
||||
if: needs.check-rust-changes.outputs.rust-changed == 'false'
|
||||
uses: dawidd6/action-download-artifact@v3
|
||||
uses: dawidd6/action-download-artifact@v6
|
||||
continue-on-error: true
|
||||
with:
|
||||
github_token: ${{secrets.GITHUB_TOKEN}}
|
||||
@ -180,16 +234,48 @@ jobs:
|
||||
run: yarn build:wasm
|
||||
- name: build web
|
||||
run: yarn build:local
|
||||
# if have previous run results, use them
|
||||
- uses: actions/download-artifact@v4
|
||||
if: ${{ always() }}
|
||||
continue-on-error: true
|
||||
with:
|
||||
name: test-results-macos-${{ github.sha }}
|
||||
path: test-results/
|
||||
- name: Run macos/safari flow retry failures
|
||||
id: retry
|
||||
if: always()
|
||||
run: |
|
||||
if [[ -d "test-results" ]];
|
||||
then if [[ $(ls -1 "test-results" | wc -l) != "0" ]];
|
||||
then echo "retried=true" >> $GITHUB_OUTPUT;
|
||||
else echo "retried=false" >> $GITHUB_OUTPUT; exit 0;
|
||||
fi;
|
||||
else echo "retried=false" >> $GITHUB_OUTPUT; exit 0;
|
||||
fi;
|
||||
yarn playwright test --project="webkit" --last-failed e2e/playwright/flow-tests.spec.ts
|
||||
env:
|
||||
CI: true
|
||||
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
||||
- name: Run macos/safari flow
|
||||
if: steps.retry.outputs.retried == 'false'
|
||||
# webkit doesn't work on Ubuntu because of the same reason tauri doesn't (webRTC issues)
|
||||
# TODO remove this and the matrix and run all tests on ubuntu when this is fixed
|
||||
run: yarn playwright test --project="webkit" e2e/playwright/flow-tests.spec.ts
|
||||
env:
|
||||
CI: true
|
||||
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: always()
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: ${{ always() }}
|
||||
with:
|
||||
name: playwright-report
|
||||
name: test-results-macos-${{ github.sha }}
|
||||
path: test-results/
|
||||
retention-days: 30
|
||||
overwrite: true
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: ${{ always() }}
|
||||
with:
|
||||
name: playwright-report-macos-${{ github.sha }}
|
||||
path: playwright-report/
|
||||
retention-days: 30
|
||||
overwrite: true
|
||||
|
||||
|
3
.gitignore
vendored
@ -17,6 +17,7 @@
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
.direnv
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
@ -55,3 +56,5 @@ src-tauri/gen
|
||||
|
||||
src/wasm-lib/grackle/stdlib_cube_partial.json
|
||||
Mac_App_Distribution.provisionprofile
|
||||
|
||||
*.tsbuildinfo
|
||||
|
@ -1,5 +1,6 @@
|
||||
# Ignore artifacts:
|
||||
build
|
||||
dist
|
||||
coverage
|
||||
|
||||
# Ignore Rust projects:
|
||||
@ -9,5 +10,6 @@ src/wasm-lib/pkg
|
||||
src/wasm-lib/kcl/bindings
|
||||
e2e/playwright/export-snapshots
|
||||
|
||||
|
||||
# XState generated files
|
||||
src/machines/**.typegen.ts
|
||||
|
7
.vscode/settings.json
vendored
@ -1,7 +0,0 @@
|
||||
{
|
||||
"cSpell.words": [
|
||||
"geos"
|
||||
],
|
||||
"editor.tabSize": 2,
|
||||
"editor.insertSpaces": true,
|
||||
}
|
17
Makefile
Normal file
@ -0,0 +1,17 @@
|
||||
.PHONY: dev
|
||||
|
||||
WASM_LIB_FILES := $(wildcard src/wasm-lib/**/*.rs)
|
||||
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
|
||||
|
||||
$(XSTATE_TYPEGENS): $(TS_SRC)
|
||||
yarn xstate typegen 'src/**/*.ts?(x)'
|
||||
|
||||
public/wasm_lib_bg.wasm: $(WASM_LIB_FILES)
|
||||
yarn build:wasm-dev
|
||||
|
||||
node_modules: package.json yarn.lock
|
||||
yarn install
|
135
README.md
@ -89,25 +89,6 @@ enable third-party cookies. You can enable third-party cookies by clicking on
|
||||
the eye with a slash through it in the URL bar, and clicking on "Enable
|
||||
Third-Party Cookies".
|
||||
|
||||
## Running tests
|
||||
|
||||
First, start the dev server following "Running a development build" above.
|
||||
|
||||
Then in another terminal tab, run:
|
||||
|
||||
```
|
||||
yarn test
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
For running the rust (not tauri rust though) only, you can
|
||||
|
||||
```bash
|
||||
cd src/wasm-lib
|
||||
cargo test
|
||||
```
|
||||
|
||||
## Tauri
|
||||
|
||||
To spin up up tauri dev, `yarn install` and `yarn build:wasm-dev` need to have been done before hand then
|
||||
@ -143,36 +124,20 @@ Before you submit a contribution PR to this repo, please ensure that:
|
||||
|
||||
## Release a new version
|
||||
|
||||
1. Bump the versions in the .json files by creating a `Cut release v{x}.{y}.{z}` PR, committing the changes from
|
||||
1. Bump the versions by running `./make-realease.sh` while on a fresh pull of main
|
||||
|
||||
```bash
|
||||
VERSION=x.y.z yarn run bump-jsons
|
||||
```
|
||||
|
||||
Alternatively you can try the experimental `make-release.sh` bash script that will create the branch with the updated json files for you.
|
||||
That will create the branch with the updated json files for you.
|
||||
run `./make-release.sh` for a patch update
|
||||
run `./make-release.sh "minor"` for minor
|
||||
run `./make-release.sh "major"` for major
|
||||
|
||||
The PR may serve as a place to discuss the human-readable changelog and extra QA. A quick way of getting PR's merged since the last bump is to [use this PR filter](https://github.com/KittyCAD/modeling-app/pulls?q=is%3Apr+sort%3Aupdated-desc+is%3Amerged+), open up the browser console and paste in the following
|
||||
After it runs you should just need to push the push the branch and open a PR (it will suggest a changelog for you too, delete any that are not user facing)
|
||||
|
||||
```typescript
|
||||
console.log(
|
||||
'- ' +
|
||||
Array.from(
|
||||
document.querySelectorAll('[data-hovercard-type="pull_request"]')
|
||||
).map((a) => `[${a.innerText}](${a.href})`).join(`
|
||||
- `)
|
||||
)
|
||||
```
|
||||
|
||||
grab the md list and delete any that are older than the last bump
|
||||
The PR may serve as a place to discuss the human-readable changelog and extra QA.
|
||||
|
||||
2. Merge the PR
|
||||
|
||||
3. Create a new release and tag pointing to the bump version commit using semantic versioning `v{x}.{y}.{z}`
|
||||
|
||||
4. A new Action kicks in at https://github.com/KittyCAD/modeling-app/actions, uploading artifacts to the release
|
||||
3. Profit (A new Action kicks in at https://github.com/KittyCAD/modeling-app/actions if the PR was correctly named)
|
||||
|
||||
## Fuzzing the parser
|
||||
|
||||
@ -195,30 +160,36 @@ $ cargo +nightly fuzz run parser
|
||||
For more information on fuzzing you can check out
|
||||
[this guide](https://rust-fuzz.github.io/book/cargo-fuzz.html).
|
||||
|
||||
### Playwright
|
||||
## Tests
|
||||
|
||||
First time running plawright locally, you'll need to add the secrets file
|
||||
### Playwright tests
|
||||
|
||||
For a portable way to run Playwright you'll need Docker.
|
||||
|
||||
After that, open a terminal and run:
|
||||
|
||||
```bash
|
||||
touch ./e2e/playwright/playwright-secrets.env
|
||||
printf 'token="your-token"\nsnapshottoken="your-snapshot-token"' > ./e2e/playwright/playwright-secrets.env
|
||||
docker run --network host --rm --init -it playwright/chrome:playwright-1.43.1
|
||||
```
|
||||
|
||||
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>
|
||||
```
|
||||
|
||||
An example of a `<test suite>` is: `e2e/playwright/flow-tests.spec.ts`
|
||||
|
||||
YOU WILL NEED A PLAYWRIGHT-SECRETS.ENV FILE:
|
||||
|
||||
|
||||
```bash
|
||||
# ./e2e/playwright/playwright-secrets.env
|
||||
token=<your-token>
|
||||
snapshottoken=<your-snapshot-token>
|
||||
```
|
||||
then replace "your-token" with a dev token from dev.zoo.dev/account/api-tokens
|
||||
|
||||
then:
|
||||
run playwright
|
||||
|
||||
```
|
||||
yarn playwright test
|
||||
```
|
||||
|
||||
run a specific test suite
|
||||
|
||||
```
|
||||
yarn playwright test src/e2e-tests/example.spec.ts
|
||||
```
|
||||
|
||||
run a specific test change the test from `test('...` to `test.only('...`
|
||||
(note if you commit this, the tests will instantly fail without running any of the tests)
|
||||
|
||||
@ -280,6 +251,37 @@ Where `./store` should look like this
|
||||
|
||||
However because much of our tests involve clicking in the stream at specific locations, it's code-gen looks `await page.locator('video').click();` when really we need to use a pixel coord, so I think it's of limited use.
|
||||
|
||||
### Unit and component tests
|
||||
|
||||
If you already haven't, run the following:
|
||||
|
||||
```
|
||||
yarn
|
||||
yarn build:wasm
|
||||
yarn start
|
||||
```
|
||||
|
||||
and finally:
|
||||
|
||||
```
|
||||
yarn test:nowatch
|
||||
```
|
||||
|
||||
For individual testing:
|
||||
|
||||
```
|
||||
yarn 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.
|
||||
|
||||
### Rust tests
|
||||
|
||||
```bash
|
||||
cd src/wasm-lib
|
||||
cargo test
|
||||
```
|
||||
|
||||
#### Some notes on CI
|
||||
|
||||
The tests are broken into snapshot tests and non-snapshot tests, and they run in that order, they automatically commit new snap shots, so if you see an image commit check it was an intended change. If we have non-determinism in the snapshots such that they are always committing new images, hopefully this annoyance makes us fix them asap, if you notice this happening let Kurt know. But for the odd occasion `git reset --hard HEAD~ && git push -f` is your friend.
|
||||
@ -309,6 +311,25 @@ PS: for the debug panel, the following JSON is useful for snapping the camera
|
||||
|
||||
</details>
|
||||
|
||||
### Tauri e2e tests
|
||||
|
||||
#### Windows (local only until the CI edge version mismatch is fixed)
|
||||
|
||||
```
|
||||
yarn install
|
||||
yarn build:wasm-dev
|
||||
cp src/wasm-lib/pkg/wasm_lib_bg.wasm public
|
||||
yarn vite build --mode development
|
||||
yarn tauri build --debug -b
|
||||
$env:KITTYCAD_API_TOKEN="<YOUR_KITTYCAD_API_TOKEN>"
|
||||
$env:VITE_KC_API_BASE_URL="https://api.dev.zoo.dev"
|
||||
$env:E2E_TAURI_ENABLED="true"
|
||||
$env:TS_NODE_COMPILER_OPTIONS='{"module": "commonjs"}'
|
||||
$env:E2E_APPLICATION=".\src-tauri\target\debug\Zoo Modeling App.exe"
|
||||
Stop-Process -Name msedgedriver
|
||||
yarn wdio run wdio.conf.ts
|
||||
```
|
||||
|
||||
## KCL
|
||||
|
||||
For how to contribute to KCL, [see our KCL README](https://github.com/KittyCAD/modeling-app/tree/main/src/wasm-lib/kcl).
|
||||
|
@ -17,4 +17,13 @@ once fixed in engine will just start working here with no language changes.
|
||||
currently move or transform the imported objects at all, once we have assemblies
|
||||
this will work.
|
||||
|
||||
- **Fillets**: Fillets cannot intersect, you will get an error. Only simple fillet cases work currently.
|
||||
- **Fillets**: Fillets cannot intersect, you will get an error. Only simple fillet
|
||||
cases work currently.
|
||||
|
||||
- **Chamfers**: Chamfers cannot intersect, you will get an error. Only simple
|
||||
chamfer cases work currently.
|
||||
|
||||
Sketching on the chamfered face does not currently work.
|
||||
|
||||
- **Shell**: Shell is only working for `end` faces, not for `side` or `start`
|
||||
faces. We are tracking the engine side bug on this.
|
||||
|
@ -9,7 +9,7 @@ Draw an angled line.
|
||||
|
||||
|
||||
```js
|
||||
angledLine(data: AngledLineData, sketch_group: SketchGroup, tag?: String) -> SketchGroup
|
||||
angledLine(data: AngledLineData, sketch_group: SketchGroup, tag?: TagDeclarator) -> SketchGroup
|
||||
```
|
||||
|
||||
### Examples
|
||||
@ -43,8 +43,6 @@ const example = extrude(10, exampleSketch)
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
|
||||
```js
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
entityId: uuid,
|
||||
// The id of the sketch group.
|
||||
id: uuid,
|
||||
// What the sketch is on (can be a plane or a face).
|
||||
@ -80,12 +78,184 @@ const example = extrude(10, exampleSketch)
|
||||
},
|
||||
} |
|
||||
{
|
||||
// the face id the sketch is on
|
||||
// The extrude group the face is on.
|
||||
extrudeGroup: {
|
||||
// The id of the extrusion end cap
|
||||
endCapId: uuid,
|
||||
// Chamfers or fillets on this extrude group.
|
||||
filletOrChamfers: [{
|
||||
// The engine id of the edge to fillet.
|
||||
edge_id: uuid,
|
||||
// The id of the engine command that called this fillet.
|
||||
id: uuid,
|
||||
radius: number,
|
||||
type: "fillet",
|
||||
} |
|
||||
{
|
||||
// The engine id of the edge to chamfer.
|
||||
edge_id: uuid,
|
||||
// The id of the engine command that called this chamfer.
|
||||
id: uuid,
|
||||
length: number,
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
type: "chamfer",
|
||||
}],
|
||||
// The height of the extrude group.
|
||||
height: number,
|
||||
// The id of the extrude group.
|
||||
id: uuid,
|
||||
// The sketch group.
|
||||
sketchGroup: {
|
||||
// The id of the sketch group.
|
||||
id: uuid,
|
||||
// What the sketch is on (can be a plane or a face).
|
||||
on: SketchSurface,
|
||||
// The starting path.
|
||||
start: {
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
},
|
||||
// Tag identifiers that have been declared in this sketch group.
|
||||
tags: {
|
||||
},
|
||||
// The paths in the sketch group.
|
||||
value: [{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "ToPoint",
|
||||
} |
|
||||
{
|
||||
// arc's direction
|
||||
ccw: string,
|
||||
// the arc's center
|
||||
center: [number, number],
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArcTo",
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArc",
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Horizontal",
|
||||
// The x coordinate.
|
||||
x: number,
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "AngledLineTo",
|
||||
// The x coordinate.
|
||||
x: number,
|
||||
// The y coordinate.
|
||||
y: number,
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Base",
|
||||
}],
|
||||
},
|
||||
// The id of the extrusion start cap
|
||||
startCapId: uuid,
|
||||
// The extrude surfaces.
|
||||
value: [{
|
||||
// The face id for the extrude plane.
|
||||
faceId: uuid,
|
||||
// The id of the geometry.
|
||||
id: uuid,
|
||||
// The source range.
|
||||
sourceRange: [number, number],
|
||||
// The tag.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
type: "extrudePlane",
|
||||
} |
|
||||
{
|
||||
// The face id for the extrude plane.
|
||||
faceId: uuid,
|
||||
// The id of the geometry.
|
||||
id: uuid,
|
||||
// The source range.
|
||||
sourceRange: [number, number],
|
||||
// The tag.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
type: "extrudeArc",
|
||||
}],
|
||||
},
|
||||
// The id of the face.
|
||||
id: uuid,
|
||||
// The original sketch group id of the object we are sketching on.
|
||||
sketchGroupId: uuid,
|
||||
type: "face",
|
||||
// The tag of the face.
|
||||
value: string,
|
||||
@ -108,25 +278,32 @@ const example = extrude(10, exampleSketch)
|
||||
z: number,
|
||||
},
|
||||
},
|
||||
// The position of the sketch group.
|
||||
position: [number, number, number],
|
||||
// The rotation of the sketch group base plane.
|
||||
rotation: [number, number, number, number],
|
||||
// The starting path.
|
||||
start: {
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
},
|
||||
// Tag identifiers that have been declared in this sketch group.
|
||||
tags: {
|
||||
},
|
||||
// The paths in the sketch group.
|
||||
value: [{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "ToPoint",
|
||||
@ -138,8 +315,12 @@ const example = extrude(10, exampleSketch)
|
||||
center: [number, number],
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArcTo",
|
||||
@ -147,8 +328,12 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArc",
|
||||
@ -156,8 +341,12 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Horizontal",
|
||||
@ -167,8 +356,12 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "AngledLineTo",
|
||||
@ -180,41 +373,32 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Base",
|
||||
}],
|
||||
// The x-axis of the sketch group base plane in the 3D space
|
||||
xAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
// The y-axis of the sketch group base plane in the 3D space
|
||||
yAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
// The z-axis of the sketch group base plane in the 3D space
|
||||
zAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
}
|
||||
```
|
||||
* `tag`: `String` (OPTIONAL)
|
||||
* `tag`: `TagDeclarator` (OPTIONAL)
|
||||
```js
|
||||
{
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
}
|
||||
```
|
||||
|
||||
### Returns
|
||||
|
||||
`SketchGroup` - A sketch group is a collection of paths.
|
||||
```js
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
entityId: uuid,
|
||||
// The id of the sketch group.
|
||||
id: uuid,
|
||||
// What the sketch is on (can be a plane or a face).
|
||||
@ -250,12 +434,184 @@ const example = extrude(10, exampleSketch)
|
||||
},
|
||||
} |
|
||||
{
|
||||
// the face id the sketch is on
|
||||
// The extrude group the face is on.
|
||||
extrudeGroup: {
|
||||
// The id of the extrusion end cap
|
||||
endCapId: uuid,
|
||||
// Chamfers or fillets on this extrude group.
|
||||
filletOrChamfers: [{
|
||||
// The engine id of the edge to fillet.
|
||||
edge_id: uuid,
|
||||
// The id of the engine command that called this fillet.
|
||||
id: uuid,
|
||||
radius: number,
|
||||
type: "fillet",
|
||||
} |
|
||||
{
|
||||
// The engine id of the edge to chamfer.
|
||||
edge_id: uuid,
|
||||
// The id of the engine command that called this chamfer.
|
||||
id: uuid,
|
||||
length: number,
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
type: "chamfer",
|
||||
}],
|
||||
// The height of the extrude group.
|
||||
height: number,
|
||||
// The id of the extrude group.
|
||||
id: uuid,
|
||||
// The sketch group.
|
||||
sketchGroup: {
|
||||
// The id of the sketch group.
|
||||
id: uuid,
|
||||
// What the sketch is on (can be a plane or a face).
|
||||
on: SketchSurface,
|
||||
// The starting path.
|
||||
start: {
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
},
|
||||
// Tag identifiers that have been declared in this sketch group.
|
||||
tags: {
|
||||
},
|
||||
// The paths in the sketch group.
|
||||
value: [{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "ToPoint",
|
||||
} |
|
||||
{
|
||||
// arc's direction
|
||||
ccw: string,
|
||||
// the arc's center
|
||||
center: [number, number],
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArcTo",
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArc",
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Horizontal",
|
||||
// The x coordinate.
|
||||
x: number,
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "AngledLineTo",
|
||||
// The x coordinate.
|
||||
x: number,
|
||||
// The y coordinate.
|
||||
y: number,
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Base",
|
||||
}],
|
||||
},
|
||||
// The id of the extrusion start cap
|
||||
startCapId: uuid,
|
||||
// The extrude surfaces.
|
||||
value: [{
|
||||
// The face id for the extrude plane.
|
||||
faceId: uuid,
|
||||
// The id of the geometry.
|
||||
id: uuid,
|
||||
// The source range.
|
||||
sourceRange: [number, number],
|
||||
// The tag.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
type: "extrudePlane",
|
||||
} |
|
||||
{
|
||||
// The face id for the extrude plane.
|
||||
faceId: uuid,
|
||||
// The id of the geometry.
|
||||
id: uuid,
|
||||
// The source range.
|
||||
sourceRange: [number, number],
|
||||
// The tag.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
type: "extrudeArc",
|
||||
}],
|
||||
},
|
||||
// The id of the face.
|
||||
id: uuid,
|
||||
// The original sketch group id of the object we are sketching on.
|
||||
sketchGroupId: uuid,
|
||||
type: "face",
|
||||
// The tag of the face.
|
||||
value: string,
|
||||
@ -278,25 +634,32 @@ const example = extrude(10, exampleSketch)
|
||||
z: number,
|
||||
},
|
||||
},
|
||||
// The position of the sketch group.
|
||||
position: [number, number, number],
|
||||
// The rotation of the sketch group base plane.
|
||||
rotation: [number, number, number, number],
|
||||
// The starting path.
|
||||
start: {
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
},
|
||||
// Tag identifiers that have been declared in this sketch group.
|
||||
tags: {
|
||||
},
|
||||
// The paths in the sketch group.
|
||||
value: [{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "ToPoint",
|
||||
@ -308,8 +671,12 @@ const example = extrude(10, exampleSketch)
|
||||
center: [number, number],
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArcTo",
|
||||
@ -317,8 +684,12 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArc",
|
||||
@ -326,8 +697,12 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Horizontal",
|
||||
@ -337,8 +712,12 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "AngledLineTo",
|
||||
@ -350,30 +729,16 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Base",
|
||||
}],
|
||||
// The x-axis of the sketch group base plane in the 3D space
|
||||
xAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
// The y-axis of the sketch group base plane in the 3D space
|
||||
yAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
// The z-axis of the sketch group base plane in the 3D space
|
||||
zAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
|
535
docs/kcl/arc.md
669
docs/kcl/chamfer.md
Normal file
787
docs/kcl/hole.md
@ -23,6 +23,7 @@ layout: manual
|
||||
* [`atan`](kcl/atan)
|
||||
* [`bezierCurve`](kcl/bezierCurve)
|
||||
* [`ceil`](kcl/ceil)
|
||||
* [`chamfer`](kcl/chamfer)
|
||||
* [`circle`](kcl/circle)
|
||||
* [`close`](kcl/close)
|
||||
* [`cos`](kcl/cos)
|
||||
@ -54,6 +55,7 @@ layout: manual
|
||||
* [`patternCircular3d`](kcl/patternCircular3d)
|
||||
* [`patternLinear2d`](kcl/patternLinear2d)
|
||||
* [`patternLinear3d`](kcl/patternLinear3d)
|
||||
* [`patternTransform`](kcl/patternTransform)
|
||||
* [`pi`](kcl/pi)
|
||||
* [`pow`](kcl/pow)
|
||||
* [`profileStart`](kcl/profileStart)
|
||||
@ -64,6 +66,7 @@ layout: manual
|
||||
* [`segEndX`](kcl/segEndX)
|
||||
* [`segEndY`](kcl/segEndY)
|
||||
* [`segLen`](kcl/segLen)
|
||||
* [`shell`](kcl/shell)
|
||||
* [`sin`](kcl/sin)
|
||||
* [`sqrt`](kcl/sqrt)
|
||||
* [`startProfileAt`](kcl/startProfileAt)
|
||||
|
@ -33,8 +33,6 @@ const example = extrude(5, exampleSketch)
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
|
||||
```js
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
entityId: uuid,
|
||||
// The id of the sketch group.
|
||||
id: uuid,
|
||||
// What the sketch is on (can be a plane or a face).
|
||||
@ -70,12 +68,184 @@ const example = extrude(5, exampleSketch)
|
||||
},
|
||||
} |
|
||||
{
|
||||
// the face id the sketch is on
|
||||
// The extrude group the face is on.
|
||||
extrudeGroup: {
|
||||
// The id of the extrusion end cap
|
||||
endCapId: uuid,
|
||||
// Chamfers or fillets on this extrude group.
|
||||
filletOrChamfers: [{
|
||||
// The engine id of the edge to fillet.
|
||||
edge_id: uuid,
|
||||
// The id of the engine command that called this fillet.
|
||||
id: uuid,
|
||||
radius: number,
|
||||
type: "fillet",
|
||||
} |
|
||||
{
|
||||
// The engine id of the edge to chamfer.
|
||||
edge_id: uuid,
|
||||
// The id of the engine command that called this chamfer.
|
||||
id: uuid,
|
||||
length: number,
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
type: "chamfer",
|
||||
}],
|
||||
// The height of the extrude group.
|
||||
height: number,
|
||||
// The id of the extrude group.
|
||||
id: uuid,
|
||||
// The sketch group.
|
||||
sketchGroup: {
|
||||
// The id of the sketch group.
|
||||
id: uuid,
|
||||
// What the sketch is on (can be a plane or a face).
|
||||
on: SketchSurface,
|
||||
// The starting path.
|
||||
start: {
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
},
|
||||
// Tag identifiers that have been declared in this sketch group.
|
||||
tags: {
|
||||
},
|
||||
// The paths in the sketch group.
|
||||
value: [{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "ToPoint",
|
||||
} |
|
||||
{
|
||||
// arc's direction
|
||||
ccw: string,
|
||||
// the arc's center
|
||||
center: [number, number],
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArcTo",
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArc",
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Horizontal",
|
||||
// The x coordinate.
|
||||
x: number,
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "AngledLineTo",
|
||||
// The x coordinate.
|
||||
x: number,
|
||||
// The y coordinate.
|
||||
y: number,
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Base",
|
||||
}],
|
||||
},
|
||||
// The id of the extrusion start cap
|
||||
startCapId: uuid,
|
||||
// The extrude surfaces.
|
||||
value: [{
|
||||
// The face id for the extrude plane.
|
||||
faceId: uuid,
|
||||
// The id of the geometry.
|
||||
id: uuid,
|
||||
// The source range.
|
||||
sourceRange: [number, number],
|
||||
// The tag.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
type: "extrudePlane",
|
||||
} |
|
||||
{
|
||||
// The face id for the extrude plane.
|
||||
faceId: uuid,
|
||||
// The id of the geometry.
|
||||
id: uuid,
|
||||
// The source range.
|
||||
sourceRange: [number, number],
|
||||
// The tag.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
type: "extrudeArc",
|
||||
}],
|
||||
},
|
||||
// The id of the face.
|
||||
id: uuid,
|
||||
// The original sketch group id of the object we are sketching on.
|
||||
sketchGroupId: uuid,
|
||||
type: "face",
|
||||
// The tag of the face.
|
||||
value: string,
|
||||
@ -98,25 +268,32 @@ const example = extrude(5, exampleSketch)
|
||||
z: number,
|
||||
},
|
||||
},
|
||||
// The position of the sketch group.
|
||||
position: [number, number, number],
|
||||
// The rotation of the sketch group base plane.
|
||||
rotation: [number, number, number, number],
|
||||
// The starting path.
|
||||
start: {
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
},
|
||||
// Tag identifiers that have been declared in this sketch group.
|
||||
tags: {
|
||||
},
|
||||
// The paths in the sketch group.
|
||||
value: [{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "ToPoint",
|
||||
@ -128,8 +305,12 @@ const example = extrude(5, exampleSketch)
|
||||
center: [number, number],
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArcTo",
|
||||
@ -137,8 +318,12 @@ const example = extrude(5, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArc",
|
||||
@ -146,8 +331,12 @@ const example = extrude(5, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Horizontal",
|
||||
@ -157,8 +346,12 @@ const example = extrude(5, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "AngledLineTo",
|
||||
@ -170,30 +363,16 @@ const example = extrude(5, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Base",
|
||||
}],
|
||||
// The x-axis of the sketch group base plane in the 3D space
|
||||
xAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
// The y-axis of the sketch group base plane in the 3D space
|
||||
yAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
// The z-axis of the sketch group base plane in the 3D space
|
||||
zAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
|
537
docs/kcl/line.md
359
docs/kcl/patternTransform.md
Normal file
@ -17,9 +17,9 @@ profileStart(sketch_group: SketchGroup) -> [number]
|
||||
```js
|
||||
const sketch001 = startSketchOn('XY')
|
||||
|> startProfileAt([5, 2], %)
|
||||
|> angledLine({ angle: 120, length: 50 }, %, 'seg01')
|
||||
|> angledLine({ angle: 120, length: 50 }, %, $seg01)
|
||||
|> angledLine({
|
||||
angle: segAng('seg01', %) + 120,
|
||||
angle: segAng(seg01, %) + 120,
|
||||
length: 50
|
||||
}, %)
|
||||
|> lineTo(profileStart(%), %)
|
||||
@ -34,8 +34,6 @@ const sketch001 = startSketchOn('XY')
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
|
||||
```js
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
entityId: uuid,
|
||||
// The id of the sketch group.
|
||||
id: uuid,
|
||||
// What the sketch is on (can be a plane or a face).
|
||||
@ -71,12 +69,184 @@ const sketch001 = startSketchOn('XY')
|
||||
},
|
||||
} |
|
||||
{
|
||||
// the face id the sketch is on
|
||||
// The extrude group the face is on.
|
||||
extrudeGroup: {
|
||||
// The id of the extrusion end cap
|
||||
endCapId: uuid,
|
||||
// Chamfers or fillets on this extrude group.
|
||||
filletOrChamfers: [{
|
||||
// The engine id of the edge to fillet.
|
||||
edge_id: uuid,
|
||||
// The id of the engine command that called this fillet.
|
||||
id: uuid,
|
||||
radius: number,
|
||||
type: "fillet",
|
||||
} |
|
||||
{
|
||||
// The engine id of the edge to chamfer.
|
||||
edge_id: uuid,
|
||||
// The id of the engine command that called this chamfer.
|
||||
id: uuid,
|
||||
length: number,
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
type: "chamfer",
|
||||
}],
|
||||
// The height of the extrude group.
|
||||
height: number,
|
||||
// The id of the extrude group.
|
||||
id: uuid,
|
||||
// The sketch group.
|
||||
sketchGroup: {
|
||||
// The id of the sketch group.
|
||||
id: uuid,
|
||||
// What the sketch is on (can be a plane or a face).
|
||||
on: SketchSurface,
|
||||
// The starting path.
|
||||
start: {
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
},
|
||||
// Tag identifiers that have been declared in this sketch group.
|
||||
tags: {
|
||||
},
|
||||
// The paths in the sketch group.
|
||||
value: [{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "ToPoint",
|
||||
} |
|
||||
{
|
||||
// arc's direction
|
||||
ccw: string,
|
||||
// the arc's center
|
||||
center: [number, number],
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArcTo",
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArc",
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Horizontal",
|
||||
// The x coordinate.
|
||||
x: number,
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "AngledLineTo",
|
||||
// The x coordinate.
|
||||
x: number,
|
||||
// The y coordinate.
|
||||
y: number,
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Base",
|
||||
}],
|
||||
},
|
||||
// The id of the extrusion start cap
|
||||
startCapId: uuid,
|
||||
// The extrude surfaces.
|
||||
value: [{
|
||||
// The face id for the extrude plane.
|
||||
faceId: uuid,
|
||||
// The id of the geometry.
|
||||
id: uuid,
|
||||
// The source range.
|
||||
sourceRange: [number, number],
|
||||
// The tag.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
type: "extrudePlane",
|
||||
} |
|
||||
{
|
||||
// The face id for the extrude plane.
|
||||
faceId: uuid,
|
||||
// The id of the geometry.
|
||||
id: uuid,
|
||||
// The source range.
|
||||
sourceRange: [number, number],
|
||||
// The tag.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
type: "extrudeArc",
|
||||
}],
|
||||
},
|
||||
// The id of the face.
|
||||
id: uuid,
|
||||
// The original sketch group id of the object we are sketching on.
|
||||
sketchGroupId: uuid,
|
||||
type: "face",
|
||||
// The tag of the face.
|
||||
value: string,
|
||||
@ -99,25 +269,32 @@ const sketch001 = startSketchOn('XY')
|
||||
z: number,
|
||||
},
|
||||
},
|
||||
// The position of the sketch group.
|
||||
position: [number, number, number],
|
||||
// The rotation of the sketch group base plane.
|
||||
rotation: [number, number, number, number],
|
||||
// The starting path.
|
||||
start: {
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
},
|
||||
// Tag identifiers that have been declared in this sketch group.
|
||||
tags: {
|
||||
},
|
||||
// The paths in the sketch group.
|
||||
value: [{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "ToPoint",
|
||||
@ -129,8 +306,12 @@ const sketch001 = startSketchOn('XY')
|
||||
center: [number, number],
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArcTo",
|
||||
@ -138,8 +319,12 @@ const sketch001 = startSketchOn('XY')
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArc",
|
||||
@ -147,8 +332,12 @@ const sketch001 = startSketchOn('XY')
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Horizontal",
|
||||
@ -158,8 +347,12 @@ const sketch001 = startSketchOn('XY')
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "AngledLineTo",
|
||||
@ -171,30 +364,16 @@ const sketch001 = startSketchOn('XY')
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Base",
|
||||
}],
|
||||
// The x-axis of the sketch group base plane in the 3D space
|
||||
xAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
// The y-axis of the sketch group base plane in the 3D space
|
||||
yAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
// The z-axis of the sketch group base plane in the 3D space
|
||||
zAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -29,8 +29,6 @@ const sketch001 = startSketchOn('XY')
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
|
||||
```js
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
entityId: uuid,
|
||||
// The id of the sketch group.
|
||||
id: uuid,
|
||||
// What the sketch is on (can be a plane or a face).
|
||||
@ -66,12 +64,184 @@ const sketch001 = startSketchOn('XY')
|
||||
},
|
||||
} |
|
||||
{
|
||||
// the face id the sketch is on
|
||||
// The extrude group the face is on.
|
||||
extrudeGroup: {
|
||||
// The id of the extrusion end cap
|
||||
endCapId: uuid,
|
||||
// Chamfers or fillets on this extrude group.
|
||||
filletOrChamfers: [{
|
||||
// The engine id of the edge to fillet.
|
||||
edge_id: uuid,
|
||||
// The id of the engine command that called this fillet.
|
||||
id: uuid,
|
||||
radius: number,
|
||||
type: "fillet",
|
||||
} |
|
||||
{
|
||||
// The engine id of the edge to chamfer.
|
||||
edge_id: uuid,
|
||||
// The id of the engine command that called this chamfer.
|
||||
id: uuid,
|
||||
length: number,
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
type: "chamfer",
|
||||
}],
|
||||
// The height of the extrude group.
|
||||
height: number,
|
||||
// The id of the extrude group.
|
||||
id: uuid,
|
||||
// The sketch group.
|
||||
sketchGroup: {
|
||||
// The id of the sketch group.
|
||||
id: uuid,
|
||||
// What the sketch is on (can be a plane or a face).
|
||||
on: SketchSurface,
|
||||
// The starting path.
|
||||
start: {
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
},
|
||||
// Tag identifiers that have been declared in this sketch group.
|
||||
tags: {
|
||||
},
|
||||
// The paths in the sketch group.
|
||||
value: [{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "ToPoint",
|
||||
} |
|
||||
{
|
||||
// arc's direction
|
||||
ccw: string,
|
||||
// the arc's center
|
||||
center: [number, number],
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArcTo",
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArc",
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Horizontal",
|
||||
// The x coordinate.
|
||||
x: number,
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "AngledLineTo",
|
||||
// The x coordinate.
|
||||
x: number,
|
||||
// The y coordinate.
|
||||
y: number,
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Base",
|
||||
}],
|
||||
},
|
||||
// The id of the extrusion start cap
|
||||
startCapId: uuid,
|
||||
// The extrude surfaces.
|
||||
value: [{
|
||||
// The face id for the extrude plane.
|
||||
faceId: uuid,
|
||||
// The id of the geometry.
|
||||
id: uuid,
|
||||
// The source range.
|
||||
sourceRange: [number, number],
|
||||
// The tag.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
type: "extrudePlane",
|
||||
} |
|
||||
{
|
||||
// The face id for the extrude plane.
|
||||
faceId: uuid,
|
||||
// The id of the geometry.
|
||||
id: uuid,
|
||||
// The source range.
|
||||
sourceRange: [number, number],
|
||||
// The tag.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
type: "extrudeArc",
|
||||
}],
|
||||
},
|
||||
// The id of the face.
|
||||
id: uuid,
|
||||
// The original sketch group id of the object we are sketching on.
|
||||
sketchGroupId: uuid,
|
||||
type: "face",
|
||||
// The tag of the face.
|
||||
value: string,
|
||||
@ -94,25 +264,32 @@ const sketch001 = startSketchOn('XY')
|
||||
z: number,
|
||||
},
|
||||
},
|
||||
// The position of the sketch group.
|
||||
position: [number, number, number],
|
||||
// The rotation of the sketch group base plane.
|
||||
rotation: [number, number, number, number],
|
||||
// The starting path.
|
||||
start: {
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
},
|
||||
// Tag identifiers that have been declared in this sketch group.
|
||||
tags: {
|
||||
},
|
||||
// The paths in the sketch group.
|
||||
value: [{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "ToPoint",
|
||||
@ -124,8 +301,12 @@ const sketch001 = startSketchOn('XY')
|
||||
center: [number, number],
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArcTo",
|
||||
@ -133,8 +314,12 @@ const sketch001 = startSketchOn('XY')
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArc",
|
||||
@ -142,8 +327,12 @@ const sketch001 = startSketchOn('XY')
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Horizontal",
|
||||
@ -153,8 +342,12 @@ const sketch001 = startSketchOn('XY')
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "AngledLineTo",
|
||||
@ -166,30 +359,16 @@ const sketch001 = startSketchOn('XY')
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Base",
|
||||
}],
|
||||
// The x-axis of the sketch group base plane in the 3D space
|
||||
xAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
// The y-axis of the sketch group base plane in the 3D space
|
||||
yAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
// The z-axis of the sketch group base plane in the 3D space
|
||||
zAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
|
649
docs/kcl/shell.md
Normal file
116723
docs/kcl/std.json
@ -9,7 +9,7 @@ Draw an arc.
|
||||
|
||||
|
||||
```js
|
||||
tangentialArc(data: TangentialArcData, sketch_group: SketchGroup, tag?: String) -> SketchGroup
|
||||
tangentialArc(data: TangentialArcData, sketch_group: SketchGroup, tag?: TagDeclarator) -> SketchGroup
|
||||
```
|
||||
|
||||
### Examples
|
||||
@ -42,8 +42,6 @@ const example = extrude(10, exampleSketch)
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
|
||||
```js
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
entityId: uuid,
|
||||
// The id of the sketch group.
|
||||
id: uuid,
|
||||
// What the sketch is on (can be a plane or a face).
|
||||
@ -79,12 +77,184 @@ const example = extrude(10, exampleSketch)
|
||||
},
|
||||
} |
|
||||
{
|
||||
// the face id the sketch is on
|
||||
// The extrude group the face is on.
|
||||
extrudeGroup: {
|
||||
// The id of the extrusion end cap
|
||||
endCapId: uuid,
|
||||
// Chamfers or fillets on this extrude group.
|
||||
filletOrChamfers: [{
|
||||
// The engine id of the edge to fillet.
|
||||
edge_id: uuid,
|
||||
// The id of the engine command that called this fillet.
|
||||
id: uuid,
|
||||
radius: number,
|
||||
type: "fillet",
|
||||
} |
|
||||
{
|
||||
// The engine id of the edge to chamfer.
|
||||
edge_id: uuid,
|
||||
// The id of the engine command that called this chamfer.
|
||||
id: uuid,
|
||||
length: number,
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
type: "chamfer",
|
||||
}],
|
||||
// The height of the extrude group.
|
||||
height: number,
|
||||
// The id of the extrude group.
|
||||
id: uuid,
|
||||
// The sketch group.
|
||||
sketchGroup: {
|
||||
// The id of the sketch group.
|
||||
id: uuid,
|
||||
// What the sketch is on (can be a plane or a face).
|
||||
on: SketchSurface,
|
||||
// The starting path.
|
||||
start: {
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
},
|
||||
// Tag identifiers that have been declared in this sketch group.
|
||||
tags: {
|
||||
},
|
||||
// The paths in the sketch group.
|
||||
value: [{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "ToPoint",
|
||||
} |
|
||||
{
|
||||
// arc's direction
|
||||
ccw: string,
|
||||
// the arc's center
|
||||
center: [number, number],
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArcTo",
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArc",
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Horizontal",
|
||||
// The x coordinate.
|
||||
x: number,
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "AngledLineTo",
|
||||
// The x coordinate.
|
||||
x: number,
|
||||
// The y coordinate.
|
||||
y: number,
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Base",
|
||||
}],
|
||||
},
|
||||
// The id of the extrusion start cap
|
||||
startCapId: uuid,
|
||||
// The extrude surfaces.
|
||||
value: [{
|
||||
// The face id for the extrude plane.
|
||||
faceId: uuid,
|
||||
// The id of the geometry.
|
||||
id: uuid,
|
||||
// The source range.
|
||||
sourceRange: [number, number],
|
||||
// The tag.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
type: "extrudePlane",
|
||||
} |
|
||||
{
|
||||
// The face id for the extrude plane.
|
||||
faceId: uuid,
|
||||
// The id of the geometry.
|
||||
id: uuid,
|
||||
// The source range.
|
||||
sourceRange: [number, number],
|
||||
// The tag.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
type: "extrudeArc",
|
||||
}],
|
||||
},
|
||||
// The id of the face.
|
||||
id: uuid,
|
||||
// The original sketch group id of the object we are sketching on.
|
||||
sketchGroupId: uuid,
|
||||
type: "face",
|
||||
// The tag of the face.
|
||||
value: string,
|
||||
@ -107,25 +277,32 @@ const example = extrude(10, exampleSketch)
|
||||
z: number,
|
||||
},
|
||||
},
|
||||
// The position of the sketch group.
|
||||
position: [number, number, number],
|
||||
// The rotation of the sketch group base plane.
|
||||
rotation: [number, number, number, number],
|
||||
// The starting path.
|
||||
start: {
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
},
|
||||
// Tag identifiers that have been declared in this sketch group.
|
||||
tags: {
|
||||
},
|
||||
// The paths in the sketch group.
|
||||
value: [{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "ToPoint",
|
||||
@ -137,8 +314,12 @@ const example = extrude(10, exampleSketch)
|
||||
center: [number, number],
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArcTo",
|
||||
@ -146,8 +327,12 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArc",
|
||||
@ -155,8 +340,12 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Horizontal",
|
||||
@ -166,8 +355,12 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "AngledLineTo",
|
||||
@ -179,41 +372,32 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Base",
|
||||
}],
|
||||
// The x-axis of the sketch group base plane in the 3D space
|
||||
xAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
// The y-axis of the sketch group base plane in the 3D space
|
||||
yAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
// The z-axis of the sketch group base plane in the 3D space
|
||||
zAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
}
|
||||
```
|
||||
* `tag`: `String` (OPTIONAL)
|
||||
* `tag`: `TagDeclarator` (OPTIONAL)
|
||||
```js
|
||||
{
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
}
|
||||
```
|
||||
|
||||
### Returns
|
||||
|
||||
`SketchGroup` - A sketch group is a collection of paths.
|
||||
```js
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
entityId: uuid,
|
||||
// The id of the sketch group.
|
||||
id: uuid,
|
||||
// What the sketch is on (can be a plane or a face).
|
||||
@ -249,12 +433,184 @@ const example = extrude(10, exampleSketch)
|
||||
},
|
||||
} |
|
||||
{
|
||||
// the face id the sketch is on
|
||||
// The extrude group the face is on.
|
||||
extrudeGroup: {
|
||||
// The id of the extrusion end cap
|
||||
endCapId: uuid,
|
||||
// Chamfers or fillets on this extrude group.
|
||||
filletOrChamfers: [{
|
||||
// The engine id of the edge to fillet.
|
||||
edge_id: uuid,
|
||||
// The id of the engine command that called this fillet.
|
||||
id: uuid,
|
||||
radius: number,
|
||||
type: "fillet",
|
||||
} |
|
||||
{
|
||||
// The engine id of the edge to chamfer.
|
||||
edge_id: uuid,
|
||||
// The id of the engine command that called this chamfer.
|
||||
id: uuid,
|
||||
length: number,
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
type: "chamfer",
|
||||
}],
|
||||
// The height of the extrude group.
|
||||
height: number,
|
||||
// The id of the extrude group.
|
||||
id: uuid,
|
||||
// The sketch group.
|
||||
sketchGroup: {
|
||||
// The id of the sketch group.
|
||||
id: uuid,
|
||||
// What the sketch is on (can be a plane or a face).
|
||||
on: SketchSurface,
|
||||
// The starting path.
|
||||
start: {
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
},
|
||||
// Tag identifiers that have been declared in this sketch group.
|
||||
tags: {
|
||||
},
|
||||
// The paths in the sketch group.
|
||||
value: [{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "ToPoint",
|
||||
} |
|
||||
{
|
||||
// arc's direction
|
||||
ccw: string,
|
||||
// the arc's center
|
||||
center: [number, number],
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArcTo",
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArc",
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Horizontal",
|
||||
// The x coordinate.
|
||||
x: number,
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "AngledLineTo",
|
||||
// The x coordinate.
|
||||
x: number,
|
||||
// The y coordinate.
|
||||
y: number,
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Base",
|
||||
}],
|
||||
},
|
||||
// The id of the extrusion start cap
|
||||
startCapId: uuid,
|
||||
// The extrude surfaces.
|
||||
value: [{
|
||||
// The face id for the extrude plane.
|
||||
faceId: uuid,
|
||||
// The id of the geometry.
|
||||
id: uuid,
|
||||
// The source range.
|
||||
sourceRange: [number, number],
|
||||
// The tag.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
type: "extrudePlane",
|
||||
} |
|
||||
{
|
||||
// The face id for the extrude plane.
|
||||
faceId: uuid,
|
||||
// The id of the geometry.
|
||||
id: uuid,
|
||||
// The source range.
|
||||
sourceRange: [number, number],
|
||||
// The tag.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
type: "extrudeArc",
|
||||
}],
|
||||
},
|
||||
// The id of the face.
|
||||
id: uuid,
|
||||
// The original sketch group id of the object we are sketching on.
|
||||
sketchGroupId: uuid,
|
||||
type: "face",
|
||||
// The tag of the face.
|
||||
value: string,
|
||||
@ -277,25 +633,32 @@ const example = extrude(10, exampleSketch)
|
||||
z: number,
|
||||
},
|
||||
},
|
||||
// The position of the sketch group.
|
||||
position: [number, number, number],
|
||||
// The rotation of the sketch group base plane.
|
||||
rotation: [number, number, number, number],
|
||||
// The starting path.
|
||||
start: {
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
},
|
||||
// Tag identifiers that have been declared in this sketch group.
|
||||
tags: {
|
||||
},
|
||||
// The paths in the sketch group.
|
||||
value: [{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "ToPoint",
|
||||
@ -307,8 +670,12 @@ const example = extrude(10, exampleSketch)
|
||||
center: [number, number],
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArcTo",
|
||||
@ -316,8 +683,12 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArc",
|
||||
@ -325,8 +696,12 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Horizontal",
|
||||
@ -336,8 +711,12 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "AngledLineTo",
|
||||
@ -349,30 +728,16 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Base",
|
||||
}],
|
||||
// The x-axis of the sketch group base plane in the 3D space
|
||||
xAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
// The y-axis of the sketch group base plane in the 3D space
|
||||
yAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
// The z-axis of the sketch group base plane in the 3D space
|
||||
zAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -74,6 +74,107 @@ You can nest expressions in parenthesis as well:
|
||||
let myMathExpression = 3 + (1 * 2 / (3 - 7))
|
||||
```
|
||||
|
||||
Please if you find any issues using any of the above expressions or syntax
|
||||
## Tags
|
||||
|
||||
Tags are used to give a name (tag) to a specific path.
|
||||
|
||||
### Tag Declaration
|
||||
|
||||
The syntax for declaring a tag is `$myTag` you would use it in the following
|
||||
way:
|
||||
|
||||
```
|
||||
startSketchOn('XZ')
|
||||
|> startProfileAt(origin, %)
|
||||
|> angledLine([0, 191.26], %, $rectangleSegmentA001)
|
||||
|> angledLine([
|
||||
segAng(rectangleSegmentA001, %) - 90,
|
||||
196.99
|
||||
], %, $rectangleSegmentB001)
|
||||
|> angledLine([
|
||||
segAng(rectangleSegmentA001, %),
|
||||
-segLen(rectangleSegmentA001, %)
|
||||
], %, $rectangleSegmentC001)
|
||||
|> lineTo([profileStartX(%), profileStartY(%)], %)
|
||||
|> close(%)
|
||||
```
|
||||
|
||||
### Tag Identifier
|
||||
|
||||
As per the example above you can use the tag identifier to get a reference to the
|
||||
tagged object. The syntax for this is `myTag`.
|
||||
|
||||
In the example above we use the tag identifier to get the angle of the segment
|
||||
`segAng(rectangleSegmentA001, %)`.
|
||||
|
||||
|
||||
### Tag Scope
|
||||
|
||||
Tags are scoped globally if in the root context meaning in this example you can
|
||||
use the tag `rectangleSegmentA001` in any function or expression in the file.
|
||||
|
||||
However if the code was written like this:
|
||||
|
||||
```
|
||||
fn rect = (origin) => {
|
||||
return startSketchOn('XZ')
|
||||
|> startProfileAt(origin, %)
|
||||
|> angledLine([0, 191.26], %, $rectangleSegmentA001)
|
||||
|> angledLine([
|
||||
segAng(rectangleSegmentA001, %) - 90,
|
||||
196.99
|
||||
], %, $rectangleSegmentB001)
|
||||
|> angledLine([
|
||||
segAng(rectangleSegmentA001, %),
|
||||
-segLen(rectangleSegmentA001, %)
|
||||
], %, $rectangleSegmentC001)
|
||||
|> lineTo([profileStartX(%), profileStartY(%)], %)
|
||||
|> close(%)
|
||||
}
|
||||
|
||||
rect([0, 0])
|
||||
rect([20, 0])
|
||||
```
|
||||
|
||||
Those tags would only be available in the `rect` function and not globally.
|
||||
|
||||
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.
|
||||
|
||||
```
|
||||
fn rect = (origin) => {
|
||||
return startSketchOn('XZ')
|
||||
|> startProfileAt(origin, %)
|
||||
|> angledLine([0, 191.26], %, $rectangleSegmentA001)
|
||||
|> angledLine([
|
||||
segAng(rectangleSegmentA001, %) - 90,
|
||||
196.99
|
||||
], %, $rectangleSegmentB001)
|
||||
|> angledLine([
|
||||
segAng(rectangleSegmentA001, %),
|
||||
-segLen(rectangleSegmentA001, %)
|
||||
], %, $rectangleSegmentC001)
|
||||
|> lineTo([profileStartX(%), profileStartY(%)], %)
|
||||
|> close(%)
|
||||
}
|
||||
|
||||
rect([0, 0])
|
||||
const myRect = rect([20, 0])
|
||||
|
||||
myRect
|
||||
|> extrude(10, %)
|
||||
|> fillet({radius: 0.5, tags: [myRect.tags.rectangleSegmentA001]}, %)
|
||||
```
|
||||
|
||||
See how we use the tag `rectangleSegmentA001` in the `fillet` function outside
|
||||
the `rect` function. This is because the `rect` function is returning the
|
||||
sketch group that contains the tags.
|
||||
|
||||
|
||||
---
|
||||
|
||||
If you find any issues using any of the above expressions or syntax,
|
||||
please file an issue with the `ast` label on the [modeling-app
|
||||
repo](https://github.com/KittyCAD/modeling-app/issues/new).
|
||||
|
@ -9,7 +9,7 @@ Draw a line on the x-axis.
|
||||
|
||||
|
||||
```js
|
||||
xLine(length: number, sketch_group: SketchGroup, tag?: String) -> SketchGroup
|
||||
xLine(length: number, sketch_group: SketchGroup, tag?: TagDeclarator) -> SketchGroup
|
||||
```
|
||||
|
||||
### Examples
|
||||
@ -36,8 +36,6 @@ const example = extrude(10, exampleSketch)
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
|
||||
```js
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
entityId: uuid,
|
||||
// The id of the sketch group.
|
||||
id: uuid,
|
||||
// What the sketch is on (can be a plane or a face).
|
||||
@ -73,12 +71,184 @@ const example = extrude(10, exampleSketch)
|
||||
},
|
||||
} |
|
||||
{
|
||||
// the face id the sketch is on
|
||||
// The extrude group the face is on.
|
||||
extrudeGroup: {
|
||||
// The id of the extrusion end cap
|
||||
endCapId: uuid,
|
||||
// Chamfers or fillets on this extrude group.
|
||||
filletOrChamfers: [{
|
||||
// The engine id of the edge to fillet.
|
||||
edge_id: uuid,
|
||||
// The id of the engine command that called this fillet.
|
||||
id: uuid,
|
||||
radius: number,
|
||||
type: "fillet",
|
||||
} |
|
||||
{
|
||||
// The engine id of the edge to chamfer.
|
||||
edge_id: uuid,
|
||||
// The id of the engine command that called this chamfer.
|
||||
id: uuid,
|
||||
length: number,
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
type: "chamfer",
|
||||
}],
|
||||
// The height of the extrude group.
|
||||
height: number,
|
||||
// The id of the extrude group.
|
||||
id: uuid,
|
||||
// The sketch group.
|
||||
sketchGroup: {
|
||||
// The id of the sketch group.
|
||||
id: uuid,
|
||||
// What the sketch is on (can be a plane or a face).
|
||||
on: SketchSurface,
|
||||
// The starting path.
|
||||
start: {
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
},
|
||||
// Tag identifiers that have been declared in this sketch group.
|
||||
tags: {
|
||||
},
|
||||
// The paths in the sketch group.
|
||||
value: [{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "ToPoint",
|
||||
} |
|
||||
{
|
||||
// arc's direction
|
||||
ccw: string,
|
||||
// the arc's center
|
||||
center: [number, number],
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArcTo",
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArc",
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Horizontal",
|
||||
// The x coordinate.
|
||||
x: number,
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "AngledLineTo",
|
||||
// The x coordinate.
|
||||
x: number,
|
||||
// The y coordinate.
|
||||
y: number,
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Base",
|
||||
}],
|
||||
},
|
||||
// The id of the extrusion start cap
|
||||
startCapId: uuid,
|
||||
// The extrude surfaces.
|
||||
value: [{
|
||||
// The face id for the extrude plane.
|
||||
faceId: uuid,
|
||||
// The id of the geometry.
|
||||
id: uuid,
|
||||
// The source range.
|
||||
sourceRange: [number, number],
|
||||
// The tag.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
type: "extrudePlane",
|
||||
} |
|
||||
{
|
||||
// The face id for the extrude plane.
|
||||
faceId: uuid,
|
||||
// The id of the geometry.
|
||||
id: uuid,
|
||||
// The source range.
|
||||
sourceRange: [number, number],
|
||||
// The tag.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
type: "extrudeArc",
|
||||
}],
|
||||
},
|
||||
// The id of the face.
|
||||
id: uuid,
|
||||
// The original sketch group id of the object we are sketching on.
|
||||
sketchGroupId: uuid,
|
||||
type: "face",
|
||||
// The tag of the face.
|
||||
value: string,
|
||||
@ -101,25 +271,32 @@ const example = extrude(10, exampleSketch)
|
||||
z: number,
|
||||
},
|
||||
},
|
||||
// The position of the sketch group.
|
||||
position: [number, number, number],
|
||||
// The rotation of the sketch group base plane.
|
||||
rotation: [number, number, number, number],
|
||||
// The starting path.
|
||||
start: {
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
},
|
||||
// Tag identifiers that have been declared in this sketch group.
|
||||
tags: {
|
||||
},
|
||||
// The paths in the sketch group.
|
||||
value: [{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "ToPoint",
|
||||
@ -131,8 +308,12 @@ const example = extrude(10, exampleSketch)
|
||||
center: [number, number],
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArcTo",
|
||||
@ -140,8 +321,12 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArc",
|
||||
@ -149,8 +334,12 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Horizontal",
|
||||
@ -160,8 +349,12 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "AngledLineTo",
|
||||
@ -173,41 +366,32 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Base",
|
||||
}],
|
||||
// The x-axis of the sketch group base plane in the 3D space
|
||||
xAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
// The y-axis of the sketch group base plane in the 3D space
|
||||
yAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
// The z-axis of the sketch group base plane in the 3D space
|
||||
zAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
}
|
||||
```
|
||||
* `tag`: `String` (OPTIONAL)
|
||||
* `tag`: `TagDeclarator` (OPTIONAL)
|
||||
```js
|
||||
{
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
}
|
||||
```
|
||||
|
||||
### Returns
|
||||
|
||||
`SketchGroup` - A sketch group is a collection of paths.
|
||||
```js
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
entityId: uuid,
|
||||
// The id of the sketch group.
|
||||
id: uuid,
|
||||
// What the sketch is on (can be a plane or a face).
|
||||
@ -243,12 +427,184 @@ const example = extrude(10, exampleSketch)
|
||||
},
|
||||
} |
|
||||
{
|
||||
// the face id the sketch is on
|
||||
// The extrude group the face is on.
|
||||
extrudeGroup: {
|
||||
// The id of the extrusion end cap
|
||||
endCapId: uuid,
|
||||
// Chamfers or fillets on this extrude group.
|
||||
filletOrChamfers: [{
|
||||
// The engine id of the edge to fillet.
|
||||
edge_id: uuid,
|
||||
// The id of the engine command that called this fillet.
|
||||
id: uuid,
|
||||
radius: number,
|
||||
type: "fillet",
|
||||
} |
|
||||
{
|
||||
// The engine id of the edge to chamfer.
|
||||
edge_id: uuid,
|
||||
// The id of the engine command that called this chamfer.
|
||||
id: uuid,
|
||||
length: number,
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
type: "chamfer",
|
||||
}],
|
||||
// The height of the extrude group.
|
||||
height: number,
|
||||
// The id of the extrude group.
|
||||
id: uuid,
|
||||
// The sketch group.
|
||||
sketchGroup: {
|
||||
// The id of the sketch group.
|
||||
id: uuid,
|
||||
// What the sketch is on (can be a plane or a face).
|
||||
on: SketchSurface,
|
||||
// The starting path.
|
||||
start: {
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
},
|
||||
// Tag identifiers that have been declared in this sketch group.
|
||||
tags: {
|
||||
},
|
||||
// The paths in the sketch group.
|
||||
value: [{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "ToPoint",
|
||||
} |
|
||||
{
|
||||
// arc's direction
|
||||
ccw: string,
|
||||
// the arc's center
|
||||
center: [number, number],
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArcTo",
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArc",
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Horizontal",
|
||||
// The x coordinate.
|
||||
x: number,
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "AngledLineTo",
|
||||
// The x coordinate.
|
||||
x: number,
|
||||
// The y coordinate.
|
||||
y: number,
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Base",
|
||||
}],
|
||||
},
|
||||
// The id of the extrusion start cap
|
||||
startCapId: uuid,
|
||||
// The extrude surfaces.
|
||||
value: [{
|
||||
// The face id for the extrude plane.
|
||||
faceId: uuid,
|
||||
// The id of the geometry.
|
||||
id: uuid,
|
||||
// The source range.
|
||||
sourceRange: [number, number],
|
||||
// The tag.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
type: "extrudePlane",
|
||||
} |
|
||||
{
|
||||
// The face id for the extrude plane.
|
||||
faceId: uuid,
|
||||
// The id of the geometry.
|
||||
id: uuid,
|
||||
// The source range.
|
||||
sourceRange: [number, number],
|
||||
// The tag.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
type: "extrudeArc",
|
||||
}],
|
||||
},
|
||||
// The id of the face.
|
||||
id: uuid,
|
||||
// The original sketch group id of the object we are sketching on.
|
||||
sketchGroupId: uuid,
|
||||
type: "face",
|
||||
// The tag of the face.
|
||||
value: string,
|
||||
@ -271,25 +627,32 @@ const example = extrude(10, exampleSketch)
|
||||
z: number,
|
||||
},
|
||||
},
|
||||
// The position of the sketch group.
|
||||
position: [number, number, number],
|
||||
// The rotation of the sketch group base plane.
|
||||
rotation: [number, number, number, number],
|
||||
// The starting path.
|
||||
start: {
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
},
|
||||
// Tag identifiers that have been declared in this sketch group.
|
||||
tags: {
|
||||
},
|
||||
// The paths in the sketch group.
|
||||
value: [{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "ToPoint",
|
||||
@ -301,8 +664,12 @@ const example = extrude(10, exampleSketch)
|
||||
center: [number, number],
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArcTo",
|
||||
@ -310,8 +677,12 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArc",
|
||||
@ -319,8 +690,12 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Horizontal",
|
||||
@ -330,8 +705,12 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "AngledLineTo",
|
||||
@ -343,30 +722,16 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Base",
|
||||
}],
|
||||
// The x-axis of the sketch group base plane in the 3D space
|
||||
xAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
// The y-axis of the sketch group base plane in the 3D space
|
||||
yAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
// The z-axis of the sketch group base plane in the 3D space
|
||||
zAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -9,7 +9,7 @@ Draw a line to a point on the x-axis.
|
||||
|
||||
|
||||
```js
|
||||
xLineTo(to: number, sketch_group: SketchGroup, tag?: String) -> SketchGroup
|
||||
xLineTo(to: number, sketch_group: SketchGroup, tag?: TagDeclarator) -> SketchGroup
|
||||
```
|
||||
|
||||
### Examples
|
||||
@ -36,8 +36,6 @@ const example = extrude(10, exampleSketch)
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
|
||||
```js
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
entityId: uuid,
|
||||
// The id of the sketch group.
|
||||
id: uuid,
|
||||
// What the sketch is on (can be a plane or a face).
|
||||
@ -73,12 +71,184 @@ const example = extrude(10, exampleSketch)
|
||||
},
|
||||
} |
|
||||
{
|
||||
// the face id the sketch is on
|
||||
// The extrude group the face is on.
|
||||
extrudeGroup: {
|
||||
// The id of the extrusion end cap
|
||||
endCapId: uuid,
|
||||
// Chamfers or fillets on this extrude group.
|
||||
filletOrChamfers: [{
|
||||
// The engine id of the edge to fillet.
|
||||
edge_id: uuid,
|
||||
// The id of the engine command that called this fillet.
|
||||
id: uuid,
|
||||
radius: number,
|
||||
type: "fillet",
|
||||
} |
|
||||
{
|
||||
// The engine id of the edge to chamfer.
|
||||
edge_id: uuid,
|
||||
// The id of the engine command that called this chamfer.
|
||||
id: uuid,
|
||||
length: number,
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
type: "chamfer",
|
||||
}],
|
||||
// The height of the extrude group.
|
||||
height: number,
|
||||
// The id of the extrude group.
|
||||
id: uuid,
|
||||
// The sketch group.
|
||||
sketchGroup: {
|
||||
// The id of the sketch group.
|
||||
id: uuid,
|
||||
// What the sketch is on (can be a plane or a face).
|
||||
on: SketchSurface,
|
||||
// The starting path.
|
||||
start: {
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
},
|
||||
// Tag identifiers that have been declared in this sketch group.
|
||||
tags: {
|
||||
},
|
||||
// The paths in the sketch group.
|
||||
value: [{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "ToPoint",
|
||||
} |
|
||||
{
|
||||
// arc's direction
|
||||
ccw: string,
|
||||
// the arc's center
|
||||
center: [number, number],
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArcTo",
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArc",
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Horizontal",
|
||||
// The x coordinate.
|
||||
x: number,
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "AngledLineTo",
|
||||
// The x coordinate.
|
||||
x: number,
|
||||
// The y coordinate.
|
||||
y: number,
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Base",
|
||||
}],
|
||||
},
|
||||
// The id of the extrusion start cap
|
||||
startCapId: uuid,
|
||||
// The extrude surfaces.
|
||||
value: [{
|
||||
// The face id for the extrude plane.
|
||||
faceId: uuid,
|
||||
// The id of the geometry.
|
||||
id: uuid,
|
||||
// The source range.
|
||||
sourceRange: [number, number],
|
||||
// The tag.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
type: "extrudePlane",
|
||||
} |
|
||||
{
|
||||
// The face id for the extrude plane.
|
||||
faceId: uuid,
|
||||
// The id of the geometry.
|
||||
id: uuid,
|
||||
// The source range.
|
||||
sourceRange: [number, number],
|
||||
// The tag.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
type: "extrudeArc",
|
||||
}],
|
||||
},
|
||||
// The id of the face.
|
||||
id: uuid,
|
||||
// The original sketch group id of the object we are sketching on.
|
||||
sketchGroupId: uuid,
|
||||
type: "face",
|
||||
// The tag of the face.
|
||||
value: string,
|
||||
@ -101,25 +271,32 @@ const example = extrude(10, exampleSketch)
|
||||
z: number,
|
||||
},
|
||||
},
|
||||
// The position of the sketch group.
|
||||
position: [number, number, number],
|
||||
// The rotation of the sketch group base plane.
|
||||
rotation: [number, number, number, number],
|
||||
// The starting path.
|
||||
start: {
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
},
|
||||
// Tag identifiers that have been declared in this sketch group.
|
||||
tags: {
|
||||
},
|
||||
// The paths in the sketch group.
|
||||
value: [{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "ToPoint",
|
||||
@ -131,8 +308,12 @@ const example = extrude(10, exampleSketch)
|
||||
center: [number, number],
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArcTo",
|
||||
@ -140,8 +321,12 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArc",
|
||||
@ -149,8 +334,12 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Horizontal",
|
||||
@ -160,8 +349,12 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "AngledLineTo",
|
||||
@ -173,41 +366,32 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Base",
|
||||
}],
|
||||
// The x-axis of the sketch group base plane in the 3D space
|
||||
xAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
// The y-axis of the sketch group base plane in the 3D space
|
||||
yAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
// The z-axis of the sketch group base plane in the 3D space
|
||||
zAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
}
|
||||
```
|
||||
* `tag`: `String` (OPTIONAL)
|
||||
* `tag`: `TagDeclarator` (OPTIONAL)
|
||||
```js
|
||||
{
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
}
|
||||
```
|
||||
|
||||
### Returns
|
||||
|
||||
`SketchGroup` - A sketch group is a collection of paths.
|
||||
```js
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
entityId: uuid,
|
||||
// The id of the sketch group.
|
||||
id: uuid,
|
||||
// What the sketch is on (can be a plane or a face).
|
||||
@ -243,12 +427,184 @@ const example = extrude(10, exampleSketch)
|
||||
},
|
||||
} |
|
||||
{
|
||||
// the face id the sketch is on
|
||||
// The extrude group the face is on.
|
||||
extrudeGroup: {
|
||||
// The id of the extrusion end cap
|
||||
endCapId: uuid,
|
||||
// Chamfers or fillets on this extrude group.
|
||||
filletOrChamfers: [{
|
||||
// The engine id of the edge to fillet.
|
||||
edge_id: uuid,
|
||||
// The id of the engine command that called this fillet.
|
||||
id: uuid,
|
||||
radius: number,
|
||||
type: "fillet",
|
||||
} |
|
||||
{
|
||||
// The engine id of the edge to chamfer.
|
||||
edge_id: uuid,
|
||||
// The id of the engine command that called this chamfer.
|
||||
id: uuid,
|
||||
length: number,
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
type: "chamfer",
|
||||
}],
|
||||
// The height of the extrude group.
|
||||
height: number,
|
||||
// The id of the extrude group.
|
||||
id: uuid,
|
||||
// The sketch group.
|
||||
sketchGroup: {
|
||||
// The id of the sketch group.
|
||||
id: uuid,
|
||||
// What the sketch is on (can be a plane or a face).
|
||||
on: SketchSurface,
|
||||
// The starting path.
|
||||
start: {
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
},
|
||||
// Tag identifiers that have been declared in this sketch group.
|
||||
tags: {
|
||||
},
|
||||
// The paths in the sketch group.
|
||||
value: [{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "ToPoint",
|
||||
} |
|
||||
{
|
||||
// arc's direction
|
||||
ccw: string,
|
||||
// the arc's center
|
||||
center: [number, number],
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArcTo",
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArc",
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Horizontal",
|
||||
// The x coordinate.
|
||||
x: number,
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "AngledLineTo",
|
||||
// The x coordinate.
|
||||
x: number,
|
||||
// The y coordinate.
|
||||
y: number,
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Base",
|
||||
}],
|
||||
},
|
||||
// The id of the extrusion start cap
|
||||
startCapId: uuid,
|
||||
// The extrude surfaces.
|
||||
value: [{
|
||||
// The face id for the extrude plane.
|
||||
faceId: uuid,
|
||||
// The id of the geometry.
|
||||
id: uuid,
|
||||
// The source range.
|
||||
sourceRange: [number, number],
|
||||
// The tag.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
type: "extrudePlane",
|
||||
} |
|
||||
{
|
||||
// The face id for the extrude plane.
|
||||
faceId: uuid,
|
||||
// The id of the geometry.
|
||||
id: uuid,
|
||||
// The source range.
|
||||
sourceRange: [number, number],
|
||||
// The tag.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
type: "extrudeArc",
|
||||
}],
|
||||
},
|
||||
// The id of the face.
|
||||
id: uuid,
|
||||
// The original sketch group id of the object we are sketching on.
|
||||
sketchGroupId: uuid,
|
||||
type: "face",
|
||||
// The tag of the face.
|
||||
value: string,
|
||||
@ -271,25 +627,32 @@ const example = extrude(10, exampleSketch)
|
||||
z: number,
|
||||
},
|
||||
},
|
||||
// The position of the sketch group.
|
||||
position: [number, number, number],
|
||||
// The rotation of the sketch group base plane.
|
||||
rotation: [number, number, number, number],
|
||||
// The starting path.
|
||||
start: {
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
},
|
||||
// Tag identifiers that have been declared in this sketch group.
|
||||
tags: {
|
||||
},
|
||||
// The paths in the sketch group.
|
||||
value: [{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "ToPoint",
|
||||
@ -301,8 +664,12 @@ const example = extrude(10, exampleSketch)
|
||||
center: [number, number],
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArcTo",
|
||||
@ -310,8 +677,12 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArc",
|
||||
@ -319,8 +690,12 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Horizontal",
|
||||
@ -330,8 +705,12 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "AngledLineTo",
|
||||
@ -343,30 +722,16 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Base",
|
||||
}],
|
||||
// The x-axis of the sketch group base plane in the 3D space
|
||||
xAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
// The y-axis of the sketch group base plane in the 3D space
|
||||
yAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
// The z-axis of the sketch group base plane in the 3D space
|
||||
zAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -9,7 +9,7 @@ Draw a line on the y-axis.
|
||||
|
||||
|
||||
```js
|
||||
yLine(length: number, sketch_group: SketchGroup, tag?: String) -> SketchGroup
|
||||
yLine(length: number, sketch_group: SketchGroup, tag?: TagDeclarator) -> SketchGroup
|
||||
```
|
||||
|
||||
### Examples
|
||||
@ -34,8 +34,6 @@ const example = extrude(10, exampleSketch)
|
||||
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
|
||||
```js
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
entityId: uuid,
|
||||
// The id of the sketch group.
|
||||
id: uuid,
|
||||
// What the sketch is on (can be a plane or a face).
|
||||
@ -71,12 +69,184 @@ const example = extrude(10, exampleSketch)
|
||||
},
|
||||
} |
|
||||
{
|
||||
// the face id the sketch is on
|
||||
// The extrude group the face is on.
|
||||
extrudeGroup: {
|
||||
// The id of the extrusion end cap
|
||||
endCapId: uuid,
|
||||
// Chamfers or fillets on this extrude group.
|
||||
filletOrChamfers: [{
|
||||
// The engine id of the edge to fillet.
|
||||
edge_id: uuid,
|
||||
// The id of the engine command that called this fillet.
|
||||
id: uuid,
|
||||
radius: number,
|
||||
type: "fillet",
|
||||
} |
|
||||
{
|
||||
// The engine id of the edge to chamfer.
|
||||
edge_id: uuid,
|
||||
// The id of the engine command that called this chamfer.
|
||||
id: uuid,
|
||||
length: number,
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
type: "chamfer",
|
||||
}],
|
||||
// The height of the extrude group.
|
||||
height: number,
|
||||
// The id of the extrude group.
|
||||
id: uuid,
|
||||
// The sketch group.
|
||||
sketchGroup: {
|
||||
// The id of the sketch group.
|
||||
id: uuid,
|
||||
// What the sketch is on (can be a plane or a face).
|
||||
on: SketchSurface,
|
||||
// The starting path.
|
||||
start: {
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
},
|
||||
// Tag identifiers that have been declared in this sketch group.
|
||||
tags: {
|
||||
},
|
||||
// The paths in the sketch group.
|
||||
value: [{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "ToPoint",
|
||||
} |
|
||||
{
|
||||
// arc's direction
|
||||
ccw: string,
|
||||
// the arc's center
|
||||
center: [number, number],
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArcTo",
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArc",
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Horizontal",
|
||||
// The x coordinate.
|
||||
x: number,
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "AngledLineTo",
|
||||
// The x coordinate.
|
||||
x: number,
|
||||
// The y coordinate.
|
||||
y: number,
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Base",
|
||||
}],
|
||||
},
|
||||
// The id of the extrusion start cap
|
||||
startCapId: uuid,
|
||||
// The extrude surfaces.
|
||||
value: [{
|
||||
// The face id for the extrude plane.
|
||||
faceId: uuid,
|
||||
// The id of the geometry.
|
||||
id: uuid,
|
||||
// The source range.
|
||||
sourceRange: [number, number],
|
||||
// The tag.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
type: "extrudePlane",
|
||||
} |
|
||||
{
|
||||
// The face id for the extrude plane.
|
||||
faceId: uuid,
|
||||
// The id of the geometry.
|
||||
id: uuid,
|
||||
// The source range.
|
||||
sourceRange: [number, number],
|
||||
// The tag.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
type: "extrudeArc",
|
||||
}],
|
||||
},
|
||||
// The id of the face.
|
||||
id: uuid,
|
||||
// The original sketch group id of the object we are sketching on.
|
||||
sketchGroupId: uuid,
|
||||
type: "face",
|
||||
// The tag of the face.
|
||||
value: string,
|
||||
@ -99,25 +269,32 @@ const example = extrude(10, exampleSketch)
|
||||
z: number,
|
||||
},
|
||||
},
|
||||
// The position of the sketch group.
|
||||
position: [number, number, number],
|
||||
// The rotation of the sketch group base plane.
|
||||
rotation: [number, number, number, number],
|
||||
// The starting path.
|
||||
start: {
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
},
|
||||
// Tag identifiers that have been declared in this sketch group.
|
||||
tags: {
|
||||
},
|
||||
// The paths in the sketch group.
|
||||
value: [{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "ToPoint",
|
||||
@ -129,8 +306,12 @@ const example = extrude(10, exampleSketch)
|
||||
center: [number, number],
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArcTo",
|
||||
@ -138,8 +319,12 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArc",
|
||||
@ -147,8 +332,12 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Horizontal",
|
||||
@ -158,8 +347,12 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "AngledLineTo",
|
||||
@ -171,41 +364,32 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Base",
|
||||
}],
|
||||
// The x-axis of the sketch group base plane in the 3D space
|
||||
xAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
// The y-axis of the sketch group base plane in the 3D space
|
||||
yAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
// The z-axis of the sketch group base plane in the 3D space
|
||||
zAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
}
|
||||
```
|
||||
* `tag`: `String` (OPTIONAL)
|
||||
* `tag`: `TagDeclarator` (OPTIONAL)
|
||||
```js
|
||||
{
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
}
|
||||
```
|
||||
|
||||
### Returns
|
||||
|
||||
`SketchGroup` - A sketch group is a collection of paths.
|
||||
```js
|
||||
{
|
||||
// The plane id or face id of the sketch group.
|
||||
entityId: uuid,
|
||||
// The id of the sketch group.
|
||||
id: uuid,
|
||||
// What the sketch is on (can be a plane or a face).
|
||||
@ -241,12 +425,184 @@ const example = extrude(10, exampleSketch)
|
||||
},
|
||||
} |
|
||||
{
|
||||
// the face id the sketch is on
|
||||
// The extrude group the face is on.
|
||||
extrudeGroup: {
|
||||
// The id of the extrusion end cap
|
||||
endCapId: uuid,
|
||||
// Chamfers or fillets on this extrude group.
|
||||
filletOrChamfers: [{
|
||||
// The engine id of the edge to fillet.
|
||||
edge_id: uuid,
|
||||
// The id of the engine command that called this fillet.
|
||||
id: uuid,
|
||||
radius: number,
|
||||
type: "fillet",
|
||||
} |
|
||||
{
|
||||
// The engine id of the edge to chamfer.
|
||||
edge_id: uuid,
|
||||
// The id of the engine command that called this chamfer.
|
||||
id: uuid,
|
||||
length: number,
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
type: "chamfer",
|
||||
}],
|
||||
// The height of the extrude group.
|
||||
height: number,
|
||||
// The id of the extrude group.
|
||||
id: uuid,
|
||||
// The sketch group.
|
||||
sketchGroup: {
|
||||
// The id of the sketch group.
|
||||
id: uuid,
|
||||
// What the sketch is on (can be a plane or a face).
|
||||
on: SketchSurface,
|
||||
// The starting path.
|
||||
start: {
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
},
|
||||
// Tag identifiers that have been declared in this sketch group.
|
||||
tags: {
|
||||
},
|
||||
// The paths in the sketch group.
|
||||
value: [{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "ToPoint",
|
||||
} |
|
||||
{
|
||||
// arc's direction
|
||||
ccw: string,
|
||||
// the arc's center
|
||||
center: [number, number],
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArcTo",
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArc",
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Horizontal",
|
||||
// The x coordinate.
|
||||
x: number,
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "AngledLineTo",
|
||||
// The x coordinate.
|
||||
x: number,
|
||||
// The y coordinate.
|
||||
y: number,
|
||||
} |
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Base",
|
||||
}],
|
||||
},
|
||||
// The id of the extrusion start cap
|
||||
startCapId: uuid,
|
||||
// The extrude surfaces.
|
||||
value: [{
|
||||
// The face id for the extrude plane.
|
||||
faceId: uuid,
|
||||
// The id of the geometry.
|
||||
id: uuid,
|
||||
// The source range.
|
||||
sourceRange: [number, number],
|
||||
// The tag.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
type: "extrudePlane",
|
||||
} |
|
||||
{
|
||||
// The face id for the extrude plane.
|
||||
faceId: uuid,
|
||||
// The id of the geometry.
|
||||
id: uuid,
|
||||
// The source range.
|
||||
sourceRange: [number, number],
|
||||
// The tag.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
type: "extrudeArc",
|
||||
}],
|
||||
},
|
||||
// The id of the face.
|
||||
id: uuid,
|
||||
// The original sketch group id of the object we are sketching on.
|
||||
sketchGroupId: uuid,
|
||||
type: "face",
|
||||
// The tag of the face.
|
||||
value: string,
|
||||
@ -269,25 +625,32 @@ const example = extrude(10, exampleSketch)
|
||||
z: number,
|
||||
},
|
||||
},
|
||||
// The position of the sketch group.
|
||||
position: [number, number, number],
|
||||
// The rotation of the sketch group base plane.
|
||||
rotation: [number, number, number, number],
|
||||
// The starting path.
|
||||
start: {
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
},
|
||||
// Tag identifiers that have been declared in this sketch group.
|
||||
tags: {
|
||||
},
|
||||
// The paths in the sketch group.
|
||||
value: [{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "ToPoint",
|
||||
@ -299,8 +662,12 @@ const example = extrude(10, exampleSketch)
|
||||
center: [number, number],
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArcTo",
|
||||
@ -308,8 +675,12 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "TangentialArc",
|
||||
@ -317,8 +688,12 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Horizontal",
|
||||
@ -328,8 +703,12 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "AngledLineTo",
|
||||
@ -341,30 +720,16 @@ const example = extrude(10, exampleSketch)
|
||||
{
|
||||
// The from point.
|
||||
from: [number, number],
|
||||
// The name of the path.
|
||||
name: string,
|
||||
// The tag of the path.
|
||||
tag: {
|
||||
end: number,
|
||||
start: number,
|
||||
value: string,
|
||||
},
|
||||
// The to point.
|
||||
to: [number, number],
|
||||
type: "Base",
|
||||
}],
|
||||
// The x-axis of the sketch group base plane in the 3D space
|
||||
xAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
// The y-axis of the sketch group base plane in the 3D space
|
||||
yAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
// The z-axis of the sketch group base plane in the 3D space
|
||||
zAxis: {
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { test, expect, Download } from '@playwright/test'
|
||||
import { test, expect } from '@playwright/test'
|
||||
import { secrets } from './secrets'
|
||||
import { getUtils } from './test-utils'
|
||||
import { Paths, doExport, getUtils } from './test-utils'
|
||||
import { Models } from '@kittycad/lib'
|
||||
import fsp from 'fs/promises'
|
||||
import { spawn } from 'child_process'
|
||||
import { APP_NAME, KCL_DEFAULT_LENGTH } from 'lib/constants'
|
||||
import { KCL_DEFAULT_LENGTH } from 'lib/constants'
|
||||
import JSZip from 'jszip'
|
||||
import path from 'path'
|
||||
import { TEST_SETTINGS, TEST_SETTINGS_KEY } from './storageStates'
|
||||
@ -20,6 +20,7 @@ test.beforeEach(async ({ page }) => {
|
||||
localStorage.setItem('TOKEN_PERSIST_KEY', token)
|
||||
localStorage.setItem('persistCode', ``)
|
||||
localStorage.setItem(settingsKey, settings)
|
||||
localStorage.setItem('playwright', 'true')
|
||||
},
|
||||
{
|
||||
token: secrets.token,
|
||||
@ -90,86 +91,15 @@ const part001 = startSketchOn('-XZ')
|
||||
)
|
||||
})
|
||||
await page.setViewportSize({ width: 1200, height: 500 })
|
||||
await page.goto('/')
|
||||
|
||||
await u.waitForAuthSkipAppStart()
|
||||
|
||||
await u.openDebugPanel()
|
||||
await u.expectCmdLog('[data-message-type="execution-done"]')
|
||||
await u.waitForCmdReceive('extrude')
|
||||
await page.waitForTimeout(1000)
|
||||
await u.clearAndCloseDebugPanel()
|
||||
|
||||
interface Paths {
|
||||
modelPath: string
|
||||
imagePath: string
|
||||
outputType: string
|
||||
}
|
||||
const doExport = async (
|
||||
output: Models['OutputFormat_type']
|
||||
): Promise<Paths> => {
|
||||
await page.getByRole('button', { name: APP_NAME }).click()
|
||||
await expect(
|
||||
page.getByRole('button', { name: 'Export Part' })
|
||||
).toBeVisible()
|
||||
await page.getByRole('button', { name: 'Export Part' }).click()
|
||||
await expect(page.getByTestId('command-bar')).toBeVisible()
|
||||
|
||||
// Go through export via command bar
|
||||
await page.getByRole('option', { name: output.type, exact: false }).click()
|
||||
await page.locator('#arg-form').waitFor({ state: 'detached' })
|
||||
if ('storage' in output) {
|
||||
await page.getByTestId('arg-name-storage').waitFor({ timeout: 1000 })
|
||||
await page.getByRole('button', { name: 'storage', exact: false }).click()
|
||||
await page
|
||||
.getByRole('option', { name: output.storage, exact: false })
|
||||
.click()
|
||||
await page.locator('#arg-form').waitFor({ state: 'detached' })
|
||||
}
|
||||
await expect(page.getByText('Confirm Export')).toBeVisible()
|
||||
|
||||
const getPromiseAndResolve = () => {
|
||||
let resolve: any = () => {}
|
||||
const promise = new Promise<Download>((r) => {
|
||||
resolve = r
|
||||
})
|
||||
return [promise, resolve]
|
||||
}
|
||||
|
||||
const [downloadPromise1, downloadResolve1] = getPromiseAndResolve()
|
||||
let downloadCnt = 0
|
||||
|
||||
page.on('download', async (download) => {
|
||||
if (downloadCnt === 0) {
|
||||
downloadResolve1(download)
|
||||
}
|
||||
downloadCnt++
|
||||
})
|
||||
await page.getByRole('button', { name: 'Submit command' }).click()
|
||||
|
||||
// Handle download
|
||||
const download = await downloadPromise1
|
||||
const downloadLocationer = (extra = '', isImage = false) =>
|
||||
`./e2e/playwright/export-snapshots/${output.type}-${
|
||||
'storage' in output ? output.storage : ''
|
||||
}${extra}.${isImage ? 'png' : output.type}`
|
||||
const downloadLocation = downloadLocationer()
|
||||
|
||||
await download.saveAs(downloadLocation)
|
||||
|
||||
if (output.type === 'step') {
|
||||
// stable timestamps for step files
|
||||
const fileContents = await fsp.readFile(downloadLocation, 'utf-8')
|
||||
const newFileContents = fileContents.replace(
|
||||
/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]+[0-9]+[0-9]\+[0-9]{2}:[0-9]{2}/g,
|
||||
'1970-01-01T00:00:00.0+00:00'
|
||||
)
|
||||
await fsp.writeFile(downloadLocation, newFileContents)
|
||||
}
|
||||
return {
|
||||
modelPath: downloadLocation,
|
||||
imagePath: downloadLocationer('', true),
|
||||
outputType: output.type,
|
||||
}
|
||||
}
|
||||
const axisDirectionPair: Models['AxisDirectionPair_type'] = {
|
||||
axis: 'z',
|
||||
direction: 'positive',
|
||||
@ -185,84 +115,114 @@ const part001 = startSketchOn('-XZ')
|
||||
// just note that only `type` and `storage` are used for selecting the drop downs is the app
|
||||
// the rest are only there to make typescript happy
|
||||
exportLocations.push(
|
||||
await doExport({
|
||||
await doExport(
|
||||
{
|
||||
type: 'step',
|
||||
coords: sysType,
|
||||
})
|
||||
},
|
||||
page
|
||||
)
|
||||
)
|
||||
exportLocations.push(
|
||||
await doExport({
|
||||
await doExport(
|
||||
{
|
||||
type: 'ply',
|
||||
coords: sysType,
|
||||
selection: { type: 'default_scene' },
|
||||
storage: 'ascii',
|
||||
units: 'in',
|
||||
})
|
||||
},
|
||||
page
|
||||
)
|
||||
)
|
||||
exportLocations.push(
|
||||
await doExport({
|
||||
await doExport(
|
||||
{
|
||||
type: 'ply',
|
||||
storage: 'binary_little_endian',
|
||||
coords: sysType,
|
||||
selection: { type: 'default_scene' },
|
||||
units: 'in',
|
||||
})
|
||||
},
|
||||
page
|
||||
)
|
||||
)
|
||||
exportLocations.push(
|
||||
await doExport({
|
||||
await doExport(
|
||||
{
|
||||
type: 'ply',
|
||||
storage: 'binary_big_endian',
|
||||
coords: sysType,
|
||||
selection: { type: 'default_scene' },
|
||||
units: 'in',
|
||||
})
|
||||
},
|
||||
page
|
||||
)
|
||||
)
|
||||
exportLocations.push(
|
||||
await doExport({
|
||||
await doExport(
|
||||
{
|
||||
type: 'stl',
|
||||
storage: 'ascii',
|
||||
coords: sysType,
|
||||
units: 'in',
|
||||
selection: { type: 'default_scene' },
|
||||
})
|
||||
},
|
||||
page
|
||||
)
|
||||
)
|
||||
exportLocations.push(
|
||||
await doExport({
|
||||
await doExport(
|
||||
{
|
||||
type: 'stl',
|
||||
storage: 'binary',
|
||||
coords: sysType,
|
||||
units: 'in',
|
||||
selection: { type: 'default_scene' },
|
||||
})
|
||||
},
|
||||
page
|
||||
)
|
||||
)
|
||||
exportLocations.push(
|
||||
await doExport({
|
||||
await doExport(
|
||||
{
|
||||
// obj seems to be a little flaky, times out tests sometimes
|
||||
type: 'obj',
|
||||
coords: sysType,
|
||||
units: 'in',
|
||||
})
|
||||
},
|
||||
page
|
||||
)
|
||||
)
|
||||
exportLocations.push(
|
||||
await doExport({
|
||||
await doExport(
|
||||
{
|
||||
type: 'gltf',
|
||||
storage: 'embedded',
|
||||
presentation: 'pretty',
|
||||
})
|
||||
},
|
||||
page
|
||||
)
|
||||
)
|
||||
exportLocations.push(
|
||||
await doExport({
|
||||
await doExport(
|
||||
{
|
||||
type: 'gltf',
|
||||
storage: 'binary',
|
||||
presentation: 'pretty',
|
||||
})
|
||||
},
|
||||
page
|
||||
)
|
||||
)
|
||||
exportLocations.push(
|
||||
await doExport({
|
||||
await doExport(
|
||||
{
|
||||
type: 'gltf',
|
||||
storage: 'standard',
|
||||
presentation: 'pretty',
|
||||
})
|
||||
},
|
||||
page
|
||||
)
|
||||
)
|
||||
|
||||
// close page to disconnect websocket since we can only have one open atm
|
||||
@ -371,7 +331,7 @@ const extrudeDefaultPlane = async (context: any, page: any, plane: string) => {
|
||||
|
||||
const u = await getUtils(page)
|
||||
await page.setViewportSize({ width: 1200, height: 500 })
|
||||
await page.goto('/')
|
||||
|
||||
await u.waitForAuthSkipAppStart()
|
||||
|
||||
// wait for execution done
|
||||
@ -427,8 +387,8 @@ test('Draft segments should look right', async ({ page, context }) => {
|
||||
const u = await getUtils(page)
|
||||
await page.setViewportSize({ width: 1200, height: 500 })
|
||||
const PUR = 400 / 37.5 //pixeltoUnitRatio
|
||||
await page.goto('/')
|
||||
await u.waitForAuthSkipAppStart()
|
||||
|
||||
await u.openDebugPanel()
|
||||
|
||||
await expect(
|
||||
@ -446,17 +406,16 @@ test('Draft segments should look right', async ({ page, context }) => {
|
||||
// select a plane
|
||||
await page.mouse.click(700, 200)
|
||||
|
||||
await expect(page.locator('.cm-content')).toHaveText(
|
||||
`const part001 = startSketchOn('XZ')`
|
||||
)
|
||||
let code = `const sketch001 = startSketchOn('XZ')`
|
||||
await expect(page.locator('.cm-content')).toHaveText(code)
|
||||
|
||||
await page.waitForTimeout(300) // TODO detect animation ending, or disable animation
|
||||
await page.waitForTimeout(700) // TODO detect animation ending, or disable animation
|
||||
|
||||
const startXPx = 600
|
||||
await page.mouse.click(startXPx + PUR * 10, 500 - PUR * 10)
|
||||
await expect(page.locator('.cm-content'))
|
||||
.toHaveText(`const part001 = startSketchOn('XZ')
|
||||
|> startProfileAt([9.06, -12.22], %)`)
|
||||
code += `
|
||||
|> startProfileAt([7.19, -9.7], %)`
|
||||
await expect(page.locator('.cm-content')).toHaveText(code)
|
||||
await page.waitForTimeout(100)
|
||||
|
||||
await u.closeDebugPanel()
|
||||
@ -468,10 +427,9 @@ test('Draft segments should look right', async ({ page, context }) => {
|
||||
await page.mouse.click(startXPx + PUR * 20, 500 - PUR * 10)
|
||||
await page.waitForTimeout(100)
|
||||
|
||||
await expect(page.locator('.cm-content'))
|
||||
.toHaveText(`const part001 = startSketchOn('XZ')
|
||||
|> startProfileAt([9.06, -12.22], %)
|
||||
|> line([9.14, 0], %)`)
|
||||
code += `
|
||||
|> line([7.25, 0], %)`
|
||||
await expect(page.locator('.cm-content')).toHaveText(code)
|
||||
|
||||
await page.getByRole('button', { name: 'Tangential Arc' }).click()
|
||||
|
||||
@ -486,7 +444,7 @@ test('Draft rectangles should look right', async ({ page, context }) => {
|
||||
const u = await getUtils(page)
|
||||
await page.setViewportSize({ width: 1200, height: 500 })
|
||||
const PUR = 400 / 37.5 //pixeltoUnitRatio
|
||||
await page.goto('/')
|
||||
|
||||
await u.waitForAuthSkipAppStart()
|
||||
await u.openDebugPanel()
|
||||
|
||||
@ -506,7 +464,7 @@ test('Draft rectangles should look right', async ({ page, context }) => {
|
||||
await page.mouse.click(700, 200)
|
||||
|
||||
await expect(page.locator('.cm-content')).toHaveText(
|
||||
`const part001 = startSketchOn('XZ')`
|
||||
`const sketch001 = startSketchOn('XZ')`
|
||||
)
|
||||
|
||||
await page.waitForTimeout(500) // TODO detect animation ending, or disable animation
|
||||
@ -533,7 +491,7 @@ test.describe('Client side scene scale should match engine scale', () => {
|
||||
const u = await getUtils(page)
|
||||
await page.setViewportSize({ width: 1200, height: 500 })
|
||||
const PUR = 400 / 37.5 //pixeltoUnitRatio
|
||||
await page.goto('/')
|
||||
|
||||
await u.waitForAuthSkipAppStart()
|
||||
await u.openDebugPanel()
|
||||
|
||||
@ -554,17 +512,16 @@ test.describe('Client side scene scale should match engine scale', () => {
|
||||
// select a plane
|
||||
await page.mouse.click(700, 200)
|
||||
|
||||
await expect(page.locator('.cm-content')).toHaveText(
|
||||
`const part001 = startSketchOn('XZ')`
|
||||
)
|
||||
let code = `const sketch001 = startSketchOn('XZ')`
|
||||
await expect(page.locator('.cm-content')).toHaveText(code)
|
||||
|
||||
await page.waitForTimeout(300) // TODO detect animation ending, or disable animation
|
||||
await page.waitForTimeout(600) // TODO detect animation ending, or disable animation
|
||||
|
||||
const startXPx = 600
|
||||
await page.mouse.click(startXPx + PUR * 10, 500 - PUR * 10)
|
||||
await expect(page.locator('.cm-content'))
|
||||
.toHaveText(`const part001 = startSketchOn('XZ')
|
||||
|> startProfileAt([9.06, -12.22], %)`)
|
||||
code += `
|
||||
|> startProfileAt([7.19, -9.7], %)`
|
||||
await expect(u.codeLocator).toHaveText(code)
|
||||
await page.waitForTimeout(100)
|
||||
|
||||
await u.closeDebugPanel()
|
||||
@ -572,21 +529,18 @@ test.describe('Client side scene scale should match engine scale', () => {
|
||||
await page.mouse.click(startXPx + PUR * 20, 500 - PUR * 10)
|
||||
await page.waitForTimeout(100)
|
||||
|
||||
await expect(page.locator('.cm-content'))
|
||||
.toHaveText(`const part001 = startSketchOn('XZ')
|
||||
|> startProfileAt([9.06, -12.22], %)
|
||||
|> line([9.14, 0], %)`)
|
||||
code += `
|
||||
|> line([7.25, 0], %)`
|
||||
await expect(u.codeLocator).toHaveText(code)
|
||||
|
||||
await page.getByRole('button', { name: 'Tangential Arc' }).click()
|
||||
await page.waitForTimeout(100)
|
||||
|
||||
await page.mouse.click(startXPx + PUR * 30, 500 - PUR * 20)
|
||||
|
||||
await expect(page.locator('.cm-content'))
|
||||
.toHaveText(`const part001 = startSketchOn('XZ')
|
||||
|> startProfileAt([9.06, -12.22], %)
|
||||
|> line([9.14, 0], %)
|
||||
|> tangentialArcTo([27.34, -3.08], %)`)
|
||||
code += `
|
||||
|> tangentialArcTo([21.7, -2.44], %)`
|
||||
await expect(u.codeLocator).toHaveText(code)
|
||||
|
||||
// click tangential arc tool again to unequip it
|
||||
await page.getByRole('button', { name: 'Tangential Arc' }).click()
|
||||
@ -636,7 +590,7 @@ test.describe('Client side scene scale should match engine scale', () => {
|
||||
const u = await getUtils(page)
|
||||
await page.setViewportSize({ width: 1200, height: 500 })
|
||||
const PUR = 400 / 37.5 //pixeltoUnitRatio
|
||||
await page.goto('/')
|
||||
|
||||
await u.waitForAuthSkipAppStart()
|
||||
await u.openDebugPanel()
|
||||
|
||||
@ -657,17 +611,16 @@ test.describe('Client side scene scale should match engine scale', () => {
|
||||
// select a plane
|
||||
await page.mouse.click(700, 200)
|
||||
|
||||
await expect(page.locator('.cm-content')).toHaveText(
|
||||
`const part001 = startSketchOn('XZ')`
|
||||
)
|
||||
let code = `const sketch001 = startSketchOn('XZ')`
|
||||
await expect(u.codeLocator).toHaveText(code)
|
||||
|
||||
await page.waitForTimeout(300) // TODO detect animation ending, or disable animation
|
||||
await page.waitForTimeout(600) // TODO detect animation ending, or disable animation
|
||||
|
||||
const startXPx = 600
|
||||
await page.mouse.click(startXPx + PUR * 10, 500 - PUR * 10)
|
||||
await expect(page.locator('.cm-content'))
|
||||
.toHaveText(`const part001 = startSketchOn('XZ')
|
||||
|> startProfileAt([230.03, -310.32], %)`)
|
||||
code += `
|
||||
|> startProfileAt([182.59, -246.32], %)`
|
||||
await expect(u.codeLocator).toHaveText(code)
|
||||
await page.waitForTimeout(100)
|
||||
|
||||
await u.closeDebugPanel()
|
||||
@ -675,21 +628,18 @@ test.describe('Client side scene scale should match engine scale', () => {
|
||||
await page.mouse.click(startXPx + PUR * 20, 500 - PUR * 10)
|
||||
await page.waitForTimeout(100)
|
||||
|
||||
await expect(page.locator('.cm-content'))
|
||||
.toHaveText(`const part001 = startSketchOn('XZ')
|
||||
|> startProfileAt([230.03, -310.32], %)
|
||||
|> line([232.2, 0], %)`)
|
||||
code += `
|
||||
|> line([184.3, 0], %)`
|
||||
await expect(u.codeLocator).toHaveText(code)
|
||||
|
||||
await page.getByRole('button', { name: 'Tangential Arc' }).click()
|
||||
await page.waitForTimeout(100)
|
||||
|
||||
await page.mouse.click(startXPx + PUR * 30, 500 - PUR * 20)
|
||||
|
||||
await expect(page.locator('.cm-content'))
|
||||
.toHaveText(`const part001 = startSketchOn('XZ')
|
||||
|> startProfileAt([230.03, -310.32], %)
|
||||
|> line([232.2, 0], %)
|
||||
|> tangentialArcTo([694.43, -78.12], %)`)
|
||||
code += `
|
||||
|> tangentialArcTo([551.2, -62.01], %)`
|
||||
await expect(u.codeLocator).toHaveText(code)
|
||||
|
||||
await page.getByRole('button', { name: 'Tangential Arc' }).click()
|
||||
await page.waitForTimeout(100)
|
||||
@ -740,7 +690,7 @@ const part002 = startSketchOn(part001, 'seg01')
|
||||
}, KCL_DEFAULT_LENGTH)
|
||||
|
||||
await page.setViewportSize({ width: 1200, height: 500 })
|
||||
await page.goto('/')
|
||||
|
||||
await u.waitForAuthSkipAppStart()
|
||||
|
||||
await u.openDebugPanel()
|
||||
@ -790,7 +740,7 @@ test('Zoom to fit on load - solid 2d', async ({ page, context }) => {
|
||||
}, KCL_DEFAULT_LENGTH)
|
||||
|
||||
await page.setViewportSize({ width: 1200, height: 500 })
|
||||
await page.goto('/')
|
||||
|
||||
await u.waitForAuthSkipAppStart()
|
||||
|
||||
await u.openDebugPanel()
|
||||
@ -827,7 +777,7 @@ test('Zoom to fit on load - solid 3d', async ({ page, context }) => {
|
||||
}, KCL_DEFAULT_LENGTH)
|
||||
|
||||
await page.setViewportSize({ width: 1200, height: 500 })
|
||||
await page.goto('/')
|
||||
|
||||
await u.waitForAuthSkipAppStart()
|
||||
|
||||
await u.openDebugPanel()
|
||||
@ -846,3 +796,83 @@ test('Zoom to fit on load - solid 3d', async ({ page, context }) => {
|
||||
maxDiffPixels: 100,
|
||||
})
|
||||
})
|
||||
|
||||
test.describe('Grid visibility', () => {
|
||||
test('Grid turned off', async ({ page }) => {
|
||||
const u = await getUtils(page)
|
||||
const stream = page.getByTestId('stream')
|
||||
const mask = [
|
||||
page.locator('#app-header'),
|
||||
page.locator('#sidebar-top-ribbon'),
|
||||
page.locator('#sidebar-bottom-ribbon'),
|
||||
]
|
||||
|
||||
await page.setViewportSize({ width: 1200, height: 500 })
|
||||
await page.goto('/')
|
||||
await u.waitForAuthSkipAppStart()
|
||||
|
||||
await u.openDebugPanel()
|
||||
// wait for execution done
|
||||
await expect(
|
||||
page.locator('[data-message-type="execution-done"]')
|
||||
).toHaveCount(2)
|
||||
await u.closeDebugPanel()
|
||||
await u.closeKclCodePanel()
|
||||
// TODO: Find a way to truly know that the objects have finished
|
||||
// rendering, because an execution-done message is not sufficient.
|
||||
await page.waitForTimeout(1000)
|
||||
|
||||
await expect(stream).toHaveScreenshot({
|
||||
maxDiffPixels: 100,
|
||||
mask,
|
||||
})
|
||||
})
|
||||
|
||||
test('Grid turned on', async ({ page }) => {
|
||||
await page.addInitScript(
|
||||
async ({ settingsKey, settings }) => {
|
||||
localStorage.setItem(settingsKey, settings)
|
||||
},
|
||||
{
|
||||
settingsKey: TEST_SETTINGS_KEY,
|
||||
settings: TOML.stringify({
|
||||
settings: {
|
||||
...TEST_SETTINGS,
|
||||
modeling: {
|
||||
...TEST_SETTINGS.modeling,
|
||||
showScaleGrid: true,
|
||||
},
|
||||
},
|
||||
}),
|
||||
}
|
||||
)
|
||||
|
||||
const u = await getUtils(page)
|
||||
const stream = page.getByTestId('stream')
|
||||
const mask = [
|
||||
page.locator('#app-header'),
|
||||
page.locator('#sidebar-top-ribbon'),
|
||||
page.locator('#sidebar-bottom-ribbon'),
|
||||
]
|
||||
|
||||
await page.setViewportSize({ width: 1200, height: 500 })
|
||||
await page.goto('/')
|
||||
await u.waitForAuthSkipAppStart()
|
||||
|
||||
await u.openDebugPanel()
|
||||
// wait for execution done
|
||||
await expect(
|
||||
page.locator('[data-message-type="execution-done"]')
|
||||
).toHaveCount(2)
|
||||
await u.closeDebugPanel()
|
||||
await u.closeKclCodePanel()
|
||||
// TODO: Find a way to truly know that the objects have finished
|
||||
// rendering, because an execution-done message is not sufficient.
|
||||
await page.waitForTimeout(1000)
|
||||
|
||||
await expect(stream).toHaveScreenshot({
|
||||
maxDiffPixels: 100,
|
||||
mask,
|
||||
})
|
||||
})
|
||||
})
|
||||
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 43 KiB |
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 49 KiB |
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 71 KiB |
Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 43 KiB |
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 61 KiB |
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 29 KiB |
@ -1,5 +1,6 @@
|
||||
import { SaveSettingsPayload } from 'lib/settings/settingsTypes'
|
||||
import { Themes } from 'lib/theme'
|
||||
import { onboardingPaths } from 'routes/Onboarding/paths'
|
||||
|
||||
export const TEST_SETTINGS_KEY = '/settings.toml'
|
||||
export const TEST_SETTINGS = {
|
||||
@ -22,9 +23,22 @@ export const TEST_SETTINGS = {
|
||||
},
|
||||
} satisfies Partial<SaveSettingsPayload>
|
||||
|
||||
export const TEST_SETTINGS_ONBOARDING_USER_MENU = {
|
||||
...TEST_SETTINGS,
|
||||
app: { ...TEST_SETTINGS.app, onboardingStatus: onboardingPaths.USER_MENU },
|
||||
} satisfies Partial<SaveSettingsPayload>
|
||||
|
||||
export const TEST_SETTINGS_ONBOARDING_EXPORT = {
|
||||
...TEST_SETTINGS,
|
||||
app: { ...TEST_SETTINGS.app, onboardingStatus: '/export' },
|
||||
app: { ...TEST_SETTINGS.app, onboardingStatus: onboardingPaths.EXPORT },
|
||||
} satisfies Partial<SaveSettingsPayload>
|
||||
|
||||
export const TEST_SETTINGS_ONBOARDING_PARAMETRIC_MODELING = {
|
||||
...TEST_SETTINGS,
|
||||
app: {
|
||||
...TEST_SETTINGS.app,
|
||||
onboardingStatus: onboardingPaths.PARAMETRIC_MODELING,
|
||||
},
|
||||
} satisfies Partial<SaveSettingsPayload>
|
||||
|
||||
export const TEST_SETTINGS_ONBOARDING_START = {
|
||||
@ -50,3 +64,25 @@ export const TEST_SETTINGS_CORRUPTED = {
|
||||
textWrapping: true,
|
||||
},
|
||||
} satisfies Partial<SaveSettingsPayload>
|
||||
|
||||
export const TEST_CODE_GIZMO = `const part001 = startSketchOn('XZ')
|
||||
|> startProfileAt([20, 0], %)
|
||||
|> line([7.13, 4 + 0], %)
|
||||
|> angledLine({ angle: 3 + 0, length: 3.14 + 0 }, %)
|
||||
|> lineTo([20.14 + 0, -0.14 + 0], %)
|
||||
|> xLineTo(29 + 0, %)
|
||||
|> yLine(-3.14 + 0, %, 'a')
|
||||
|> xLine(1.63, %)
|
||||
|> angledLineOfXLength({ angle: 3 + 0, length: 3.14 }, %)
|
||||
|> angledLineOfYLength({ angle: 30, length: 3 + 0 }, %)
|
||||
|> angledLineToX({ angle: 22.14 + 0, to: 12 }, %)
|
||||
|> angledLineToY({ angle: 30, to: 11.14 }, %)
|
||||
|> angledLineThatIntersects({
|
||||
angle: 3.14,
|
||||
intersectTag: 'a',
|
||||
offset: 0
|
||||
}, %)
|
||||
|> tangentialArcTo([13.14 + 0, 13.14], %)
|
||||
|> close(%)
|
||||
|> extrude(5 + 7, %)
|
||||
`
|
||||
|
@ -1,22 +1,34 @@
|
||||
import { test, expect, Page } from '@playwright/test'
|
||||
import { test, expect, Page, Download } from '@playwright/test'
|
||||
import { EngineCommand } from '../../src/lang/std/engineConnection'
|
||||
import os from 'os'
|
||||
import fsp from 'fs/promises'
|
||||
import pixelMatch from 'pixelmatch'
|
||||
import { PNG } from 'pngjs'
|
||||
import { Protocol } from 'playwright-core/types/protocol'
|
||||
import type { Models } from '@kittycad/lib'
|
||||
import { APP_NAME } from 'lib/constants'
|
||||
|
||||
type TestColor = [number, number, number]
|
||||
export const TEST_COLORS = {
|
||||
WHITE: [249, 249, 249] as TestColor,
|
||||
YELLOW: [255, 255, 0] as TestColor,
|
||||
BLUE: [0, 0, 255] as TestColor,
|
||||
} as const
|
||||
|
||||
async function waitForPageLoad(page: Page) {
|
||||
// wait for 'Loading stream...' spinner
|
||||
await page.getByTestId('loading-stream').waitFor()
|
||||
// wait for all spinners to be gone
|
||||
await page.getByTestId('loading').waitFor({ state: 'detached' })
|
||||
await page
|
||||
.getByTestId('loading')
|
||||
.waitFor({ state: 'detached', timeout: 20_000 })
|
||||
|
||||
await page.getByTestId('start-sketch').waitFor()
|
||||
}
|
||||
|
||||
async function removeCurrentCode(page: Page) {
|
||||
const hotkey = process.platform === 'darwin' ? 'Meta' : 'Control'
|
||||
await page.click('.cm-content')
|
||||
await page.locator('.cm-content').click()
|
||||
await page.keyboard.down(hotkey)
|
||||
await page.keyboard.press('a')
|
||||
await page.keyboard.up(hotkey)
|
||||
@ -25,16 +37,16 @@ async function removeCurrentCode(page: Page) {
|
||||
}
|
||||
|
||||
async function sendCustomCmd(page: Page, cmd: EngineCommand) {
|
||||
await page.fill('[data-testid="custom-cmd-input"]', JSON.stringify(cmd))
|
||||
await page.click('[data-testid="custom-cmd-send-button"]')
|
||||
await page.getByTestId('custom-cmd-input').fill(JSON.stringify(cmd))
|
||||
await page.getByTestId('custom-cmd-send-button').click()
|
||||
}
|
||||
|
||||
async function clearCommandLogs(page: Page) {
|
||||
await page.click('[data-testid="clear-commands"]')
|
||||
await page.getByTestId('clear-commands').click()
|
||||
}
|
||||
|
||||
async function expectCmdLog(page: Page, locatorStr: string) {
|
||||
await expect(page.locator(locatorStr).last()).toBeVisible()
|
||||
async function expectCmdLog(page: Page, locatorStr: string, timeout = 5000) {
|
||||
await expect(page.locator(locatorStr).last()).toBeVisible({ timeout })
|
||||
}
|
||||
|
||||
async function waitForDefaultPlanesToBeVisible(page: Page) {
|
||||
@ -94,14 +106,133 @@ async function waitForCmdReceive(page: Page, commandType: string) {
|
||||
.waitFor()
|
||||
}
|
||||
|
||||
export const wiggleMove = async (
|
||||
page: any,
|
||||
x: number,
|
||||
y: number,
|
||||
steps: number,
|
||||
dist: number,
|
||||
ang: number,
|
||||
amplitude: number,
|
||||
freq: number,
|
||||
locator?: string
|
||||
) => {
|
||||
const tau = Math.PI * 2
|
||||
const deg = tau / 360
|
||||
const step = dist / steps
|
||||
for (let i = 0, j = 0; i < dist; i += step, j += 1) {
|
||||
if (locator) {
|
||||
const isElVis = await page.locator(locator).isVisible()
|
||||
if (isElVis) return
|
||||
}
|
||||
const [x1, y1] = [0, Math.sin((tau / steps) * j * freq) * amplitude]
|
||||
const [x2, y2] = [
|
||||
Math.cos(-ang * deg) * i - Math.sin(-ang * deg) * y1,
|
||||
Math.sin(-ang * deg) * i + Math.cos(-ang * deg) * y1,
|
||||
]
|
||||
const [xr, yr] = [x2, y2]
|
||||
await page.mouse.move(x + xr, y + yr, { steps: 5 })
|
||||
}
|
||||
}
|
||||
|
||||
export const circleMove = async (
|
||||
page: any,
|
||||
x: number,
|
||||
y: number,
|
||||
steps: number,
|
||||
diameter: number,
|
||||
locator?: string
|
||||
) => {
|
||||
const tau = Math.PI * 2
|
||||
const step = tau / steps
|
||||
for (let i = 0; i < tau; i += step) {
|
||||
if (locator) {
|
||||
const isElVis = await page.locator(locator).isVisible()
|
||||
if (isElVis) return
|
||||
}
|
||||
const [x1, y1] = [Math.cos(i) * diameter, Math.sin(i) * diameter]
|
||||
const [xr, yr] = [x1, y1]
|
||||
await page.mouse.move(x + xr, y + yr, { steps: 5 })
|
||||
}
|
||||
}
|
||||
|
||||
export const getMovementUtils = (opts: any) => {
|
||||
// The way we truncate is kinda odd apparently, so we need this function
|
||||
// "[k]itty[c]ad round"
|
||||
const kcRound = (n: number) => Math.trunc(n * 100) / 100
|
||||
|
||||
// To translate between screen and engine ("[U]nit") coordinates
|
||||
// NOTE: these pretty much can't be perfect because of screen scaling.
|
||||
// Handle on a case-by-case.
|
||||
const toU = (x: number, y: number) => [
|
||||
kcRound(x * 0.0678),
|
||||
kcRound(-y * 0.0678), // Y is inverted in our coordinate system
|
||||
]
|
||||
|
||||
// Turn the array into a string with specific formatting
|
||||
const fromUToString = (xy: number[]) => `[${xy[0]}, ${xy[1]}]`
|
||||
|
||||
// Combine because used often
|
||||
const toSU = (xy: number[]) => fromUToString(toU(xy[0], xy[1]))
|
||||
|
||||
// Make it easier to click around from center ("click [from] zero zero")
|
||||
const click00 = (x: number, y: number) =>
|
||||
opts.page.mouse.click(opts.center.x + x, opts.center.y + y, { delay: 100 })
|
||||
|
||||
// Relative clicker, must keep state
|
||||
let last = { x: 0, y: 0 }
|
||||
const click00r = async (x?: number, y?: number) => {
|
||||
// reset relative coordinates when anything is undefined
|
||||
if (x === undefined || y === undefined) {
|
||||
last.x = 0
|
||||
last.y = 0
|
||||
return
|
||||
}
|
||||
|
||||
await circleMove(
|
||||
opts.page,
|
||||
opts.center.x + last.x + x,
|
||||
opts.center.y + last.y + y,
|
||||
10,
|
||||
10
|
||||
)
|
||||
await click00(last.x + x, last.y + y)
|
||||
last.x += x
|
||||
last.y += y
|
||||
|
||||
// Returns the new absolute coordinate if you need it.
|
||||
return [last.x, last.y]
|
||||
}
|
||||
|
||||
return { toSU, click00r }
|
||||
}
|
||||
|
||||
async function waitForAuthAndLsp(page: Page) {
|
||||
const waitForLspPromise = page.waitForEvent('console', async (message) => {
|
||||
// it would be better to wait for a message that the kcl lsp has started by looking for the message message.text().includes('[lsp] [window/logMessage]')
|
||||
// but that doesn't seem to make it to the console for macos/safari :(
|
||||
if (message.text().includes('start kcl lsp')) {
|
||||
await new Promise((resolve) => setTimeout(resolve, 200))
|
||||
return true
|
||||
}
|
||||
return false
|
||||
})
|
||||
|
||||
await page.goto('/')
|
||||
await waitForPageLoad(page)
|
||||
|
||||
return waitForLspPromise
|
||||
}
|
||||
|
||||
export async function getUtils(page: Page) {
|
||||
// Chrome devtools protocol session only works in Chromium
|
||||
const browserType = page.context().browser()?.browserType().name()
|
||||
const cdpSession =
|
||||
process.platform === 'darwin'
|
||||
? null
|
||||
: await page.context().newCDPSession(page)
|
||||
browserType !== 'chromium' ? null : await page.context().newCDPSession(page)
|
||||
|
||||
return {
|
||||
waitForAuthSkipAppStart: () => waitForPageLoad(page),
|
||||
waitForAuthSkipAppStart: () => waitForAuthAndLsp(page),
|
||||
waitForPageLoad: () => waitForPageLoad(page),
|
||||
removeCurrentCode: () => removeCurrentCode(page),
|
||||
sendCustomCmd: (cmd: EngineCommand) => sendCustomCmd(page, cmd),
|
||||
updateCamPosition: async (xyz: [number, number, number]) => {
|
||||
@ -115,7 +246,8 @@ export async function getUtils(page: Page) {
|
||||
await fillInput('z', xyz[2])
|
||||
},
|
||||
clearCommandLogs: () => clearCommandLogs(page),
|
||||
expectCmdLog: (locatorStr: string) => expectCmdLog(page, locatorStr),
|
||||
expectCmdLog: (locatorStr: string, timeout = 5000) =>
|
||||
expectCmdLog(page, locatorStr, timeout),
|
||||
openKclCodePanel: () => openKclCodePanel(page),
|
||||
closeKclCodePanel: () => closeKclCodePanel(page),
|
||||
openDebugPanel: () => openDebugPanel(page),
|
||||
@ -130,6 +262,30 @@ export async function getUtils(page: Page) {
|
||||
},
|
||||
waitForCmdReceive: (commandType: string) =>
|
||||
waitForCmdReceive(page, commandType),
|
||||
getSegmentBodyCoords: async (locator: string, px = 30) => {
|
||||
const overlay = page.locator(locator)
|
||||
const bbox = await overlay
|
||||
.boundingBox()
|
||||
.then((box) => ({ ...box, x: box?.x || 0, y: box?.y || 0 }))
|
||||
const angle = Number(await overlay.getAttribute('data-overlay-angle'))
|
||||
const angleXOffset = Math.cos(((angle - 180) * Math.PI) / 180) * px
|
||||
const angleYOffset = Math.sin(((angle - 180) * Math.PI) / 180) * px
|
||||
return {
|
||||
x: Math.round(bbox.x + angleXOffset),
|
||||
y: Math.round(bbox.y - angleYOffset),
|
||||
}
|
||||
},
|
||||
getAngle: async (locator: string) => {
|
||||
const overlay = page.locator(locator)
|
||||
return Number(await overlay.getAttribute('data-overlay-angle'))
|
||||
},
|
||||
getBoundingBox: async (locator: string) =>
|
||||
page
|
||||
.locator(locator)
|
||||
.boundingBox()
|
||||
.then((box) => ({ ...box, x: box?.x || 0, y: box?.y || 0 })),
|
||||
codeLocator: page.locator('.cm-content'),
|
||||
canvasLocator: page.getByTestId('client-side-scene'),
|
||||
doAndWaitForCmd: async (
|
||||
fn: () => Promise<void>,
|
||||
commandType: string,
|
||||
@ -145,6 +301,38 @@ export async function getUtils(page: Page) {
|
||||
await closeDebugPanel(page)
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Given an expected RGB value, diff if the channel with the largest difference
|
||||
*/
|
||||
getGreatestPixDiff: async (
|
||||
coords: { x: number; y: number },
|
||||
expected: [number, number, number]
|
||||
): Promise<number> => {
|
||||
const buffer = await page.screenshot({
|
||||
fullPage: true,
|
||||
})
|
||||
const screenshot = await PNG.sync.read(buffer)
|
||||
// most likely related to pixel density but the screenshots for webkit are 2x the size
|
||||
// there might be a more robust way of doing this.
|
||||
const pixMultiplier = browserType === 'webkit' ? 2 : 1
|
||||
const index =
|
||||
(screenshot.width * coords.y * pixMultiplier +
|
||||
coords.x * pixMultiplier) *
|
||||
4 // rbga is 4 channels
|
||||
const maxDiff = Math.max(
|
||||
Math.abs(screenshot.data[index] - expected[0]),
|
||||
Math.abs(screenshot.data[index + 1] - expected[1]),
|
||||
Math.abs(screenshot.data[index + 2] - expected[2])
|
||||
)
|
||||
if (maxDiff > 4) {
|
||||
console.log(
|
||||
`Expected: ${expected} Actual: [${screenshot.data[index]}, ${
|
||||
screenshot.data[index + 1]
|
||||
}, ${screenshot.data[index + 2]}]`
|
||||
)
|
||||
}
|
||||
return maxDiff
|
||||
},
|
||||
doAndWaitForImageDiff: (fn: () => Promise<any>, diffCount = 200) =>
|
||||
new Promise(async (resolve) => {
|
||||
await page.screenshot({
|
||||
@ -272,3 +460,82 @@ export const makeTemplate: (
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
export interface Paths {
|
||||
modelPath: string
|
||||
imagePath: string
|
||||
outputType: string
|
||||
}
|
||||
|
||||
export const doExport = async (
|
||||
output: Models['OutputFormat_type'],
|
||||
page: Page
|
||||
): Promise<Paths> => {
|
||||
await page.getByRole('button', { name: APP_NAME }).click()
|
||||
await expect(page.getByRole('button', { name: 'Export Part' })).toBeVisible()
|
||||
await page.getByRole('button', { name: 'Export Part' }).click()
|
||||
await expect(page.getByTestId('command-bar')).toBeVisible()
|
||||
|
||||
// Go through export via command bar
|
||||
await page.getByRole('option', { name: output.type, exact: false }).click()
|
||||
await page.locator('#arg-form').waitFor({ state: 'detached' })
|
||||
if ('storage' in output) {
|
||||
await page.getByTestId('arg-name-storage').waitFor({ timeout: 1000 })
|
||||
await page.getByRole('button', { name: 'storage', exact: false }).click()
|
||||
await page
|
||||
.getByRole('option', { name: output.storage, exact: false })
|
||||
.click()
|
||||
await page.locator('#arg-form').waitFor({ state: 'detached' })
|
||||
}
|
||||
await expect(page.getByText('Confirm Export')).toBeVisible()
|
||||
|
||||
const getPromiseAndResolve = () => {
|
||||
let resolve: any = () => {}
|
||||
const promise = new Promise<Download>((r) => {
|
||||
resolve = r
|
||||
})
|
||||
return [promise, resolve]
|
||||
}
|
||||
|
||||
const [downloadPromise1, downloadResolve1] = getPromiseAndResolve()
|
||||
let downloadCnt = 0
|
||||
|
||||
page.on('download', async (download) => {
|
||||
if (downloadCnt === 0) {
|
||||
downloadResolve1(download)
|
||||
}
|
||||
downloadCnt++
|
||||
})
|
||||
await page.getByRole('button', { name: 'Submit command' }).click()
|
||||
|
||||
// Handle download
|
||||
const download = await downloadPromise1
|
||||
const downloadLocationer = (extra = '', isImage = false) =>
|
||||
`./e2e/playwright/export-snapshots/${output.type}-${
|
||||
'storage' in output ? output.storage : ''
|
||||
}${extra}.${isImage ? 'png' : output.type}`
|
||||
const downloadLocation = downloadLocationer()
|
||||
|
||||
await download.saveAs(downloadLocation)
|
||||
|
||||
if (output.type === 'step') {
|
||||
// stable timestamps for step files
|
||||
const fileContents = await fsp.readFile(downloadLocation, 'utf-8')
|
||||
const newFileContents = fileContents.replace(
|
||||
/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]+[0-9]+[0-9]\+[0-9]{2}:[0-9]{2}/g,
|
||||
'1970-01-01T00:00:00.0+00:00'
|
||||
)
|
||||
await fsp.writeFile(downloadLocation, newFileContents)
|
||||
}
|
||||
|
||||
return {
|
||||
modelPath: downloadLocation,
|
||||
imagePath: downloadLocationer('', true),
|
||||
outputType: output.type,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the appropriate modifier key for the platform.
|
||||
*/
|
||||
export const metaModifier = os.platform() === 'darwin' ? 'Meta' : 'Control'
|
||||
|
@ -1,31 +1,23 @@
|
||||
import { browser, $, expect } from '@wdio/globals'
|
||||
import fs from 'fs/promises'
|
||||
import path from 'path'
|
||||
import os from 'os'
|
||||
import { click, setDatasetValue } from '../utils'
|
||||
|
||||
const documentsDir = `${process.env.HOME}/Documents`
|
||||
const userSettingsDir = `${process.env.HOME}/.config/dev.zoo.modeling-app`
|
||||
const defaultProjectDir = `${documentsDir}/zoo-modeling-app-projects`
|
||||
const newProjectDir = `${documentsDir}/a-different-directory`
|
||||
const userCodeDir = '/tmp/kittycad_user_code'
|
||||
const isWin32 = os.platform() === 'win32'
|
||||
const documentsDir = path.join(os.homedir(), 'Documents')
|
||||
const userSettingsDir = path.join(
|
||||
os.homedir(),
|
||||
'.config',
|
||||
'dev.zoo.modeling-app'
|
||||
)
|
||||
const defaultProjectDir = path.join(documentsDir, 'zoo-modeling-app-projects')
|
||||
const newProjectDir = path.join(documentsDir, 'a-different-directory')
|
||||
const tmp = process.env.TEMP || '/tmp'
|
||||
const userCodeDir = path.join(tmp, 'kittycad_user_code')
|
||||
|
||||
async function click(element: WebdriverIO.Element): Promise<void> {
|
||||
// Workaround for .click(), see https://github.com/tauri-apps/tauri/issues/6541
|
||||
await element.waitForClickable()
|
||||
await browser.execute('arguments[0].click();', element)
|
||||
}
|
||||
|
||||
/* Shoutout to @Sheap on Github for a great workaround utility:
|
||||
* https://github.com/tauri-apps/tauri/issues/6541#issue-1638944060
|
||||
*/
|
||||
async function setDatasetValue(
|
||||
field: WebdriverIO.Element,
|
||||
property: string,
|
||||
value: string
|
||||
) {
|
||||
await browser.execute(`arguments[0].dataset.${property} = "${value}"`, field)
|
||||
}
|
||||
|
||||
describe('ZMA (Tauri, Linux)', () => {
|
||||
it('opens the auth page and signs in', async () => {
|
||||
describe('ZMA sign in flow', () => {
|
||||
before(async () => {
|
||||
// Clean up filesystem from previous tests
|
||||
await new Promise((resolve) => setTimeout(resolve, 100))
|
||||
await fs.rm(defaultProjectDir, { force: true, recursive: true })
|
||||
@ -34,7 +26,9 @@ describe('ZMA (Tauri, Linux)', () => {
|
||||
await fs.rm(userSettingsDir, { force: true, recursive: true })
|
||||
await fs.mkdir(defaultProjectDir, { recursive: true })
|
||||
await fs.mkdir(newProjectDir, { recursive: true })
|
||||
})
|
||||
|
||||
it('opens the auth page and signs in', async () => {
|
||||
const signInButton = await $('[data-testid="sign-in-button"]')
|
||||
expect(await signInButton.getText()).toEqual('Sign in')
|
||||
|
||||
@ -42,9 +36,7 @@ describe('ZMA (Tauri, Linux)', () => {
|
||||
await new Promise((resolve) => setTimeout(resolve, 2000))
|
||||
|
||||
// Get from main.rs
|
||||
const userCode = await (
|
||||
await fs.readFile('/tmp/kittycad_user_code')
|
||||
).toString()
|
||||
const userCode = await (await fs.readFile(userCodeDir)).toString()
|
||||
console.log(`Found user code ${userCode}`)
|
||||
|
||||
// Device flow: verify
|
||||
@ -76,6 +68,10 @@ describe('ZMA (Tauri, Linux)', () => {
|
||||
const newFileButton = await $('[data-testid="home-new-file"]')
|
||||
expect(await newFileButton.getText()).toEqual('New project')
|
||||
})
|
||||
})
|
||||
|
||||
describe('ZMA authorized user flows', () => {
|
||||
// Note: each flow below is intended to start *and* end from the home page
|
||||
|
||||
it('opens the settings page, checks filesystem settings, and closes the settings page', async () => {
|
||||
const menuButton = await $('[data-testid="user-sidebar-toggle"]')
|
||||
@ -92,7 +88,12 @@ describe('ZMA (Tauri, Linux)', () => {
|
||||
* to be able to skip the folder selection dialog if data-testValue
|
||||
* has a value, allowing us to test the input otherwise works.
|
||||
*/
|
||||
await setDatasetValue(projectDirInput, 'testValue', newProjectDir)
|
||||
// TODO: understand why we need to force double \ on Windows
|
||||
await setDatasetValue(
|
||||
projectDirInput,
|
||||
'testValue',
|
||||
isWin32 ? newProjectDir.replaceAll('\\', '\\\\') : newProjectDir
|
||||
)
|
||||
const projectDirButton = await $('[data-testid="project-directory-button"]')
|
||||
await click(projectDirButton)
|
||||
await new Promise((resolve) => setTimeout(resolve, 500))
|
||||
@ -102,6 +103,15 @@ describe('ZMA (Tauri, Linux)', () => {
|
||||
const nameInput = await $('[data-testid="projects-defaultProjectName"]')
|
||||
expect(await nameInput.getValue()).toEqual('project-$nnn')
|
||||
|
||||
// Setting it back (for back to back local tests)
|
||||
await new Promise((resolve) => setTimeout(resolve, 5000))
|
||||
await setDatasetValue(
|
||||
projectDirInput,
|
||||
'testValue',
|
||||
isWin32 ? defaultProjectDir.replaceAll('\\', '\\\\') : newProjectDir
|
||||
)
|
||||
await click(projectDirButton)
|
||||
|
||||
const closeButton = await $('[data-testid="settings-close-button"]')
|
||||
await click(closeButton)
|
||||
})
|
||||
@ -120,12 +130,21 @@ describe('ZMA (Tauri, Linux)', () => {
|
||||
it('opens the new file and expects a loading stream', async () => {
|
||||
const projectLink = await $('[data-testid="project-link"]')
|
||||
await click(projectLink)
|
||||
if (isWin32) {
|
||||
// TODO: actually do something to check that the stream is up
|
||||
await new Promise((resolve) => setTimeout(resolve, 5000))
|
||||
} else {
|
||||
const errorText = await $('[data-testid="unexpected-error"]')
|
||||
expect(await errorText.getText()).toContain('unexpected error')
|
||||
await browser.execute('window.location.href = "tauri://localhost/home"')
|
||||
}
|
||||
const base = isWin32 ? 'http://tauri.localhost' : 'tauri://localhost'
|
||||
await browser.execute(`window.location.href = "${base}/home"`)
|
||||
})
|
||||
})
|
||||
|
||||
describe('ZMA sign out flow', () => {
|
||||
it('signs out', async () => {
|
||||
await new Promise((resolve) => setTimeout(resolve, 1000))
|
||||
const menuButton = await $('[data-testid="user-sidebar-toggle"]')
|
||||
await click(menuButton)
|
||||
const signoutButton = await $('[data-testid="user-sidebar-sign-out"]')
|
18
e2e/tauri/utils.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import { browser } from '@wdio/globals'
|
||||
|
||||
export async function click(element: WebdriverIO.Element): Promise<void> {
|
||||
// Workaround for .click(), see https://github.com/tauri-apps/tauri/issues/6541
|
||||
await element.waitForClickable()
|
||||
await browser.execute('arguments[0].click();', element)
|
||||
}
|
||||
|
||||
/* Shoutout to @Sheap on Github for a great workaround utility:
|
||||
* https://github.com/tauri-apps/tauri/issues/6541#issue-1638944060
|
||||
*/
|
||||
export async function setDatasetValue(
|
||||
field: WebdriverIO.Element,
|
||||
property: string,
|
||||
value: string
|
||||
) {
|
||||
await browser.execute(`arguments[0].dataset.${property} = "${value}"`, field)
|
||||
}
|