Compare commits
56 Commits
nadro/adho
...
ben/conics
Author | SHA1 | Date | |
---|---|---|---|
550fe929ae | |||
fb36c1703a | |||
dbed075648 | |||
2112cd0994 | |||
5372731ac1 | |||
df6256266c | |||
ba2aa7e57d | |||
c7825e3cfd | |||
e5d082f441 | |||
d4d3e179b1 | |||
4f4c44e7c7 | |||
1b75020686 | |||
fba62dab98 | |||
a85a534d6b | |||
6ddbb7a31d | |||
051bb0589e | |||
7f9851ae28 | |||
fbcbb341e2 | |||
4a080d1583 | |||
8fa429fe20 | |||
9b41be763f | |||
a8d923ad19 | |||
c0253e7a8e | |||
8ab5c52a4f | |||
5e34562630 | |||
2adcf393a8 | |||
f2426b9776 | |||
4faaccbae0 | |||
80f869d1c0 | |||
eb8499f35b | |||
94d2a8addb | |||
3a6d5c0005 | |||
67122d66e0 | |||
d3d2349a80 | |||
756b5541e5 | |||
9f34c0d0c0 | |||
dc0c5d5278 | |||
7b490da1b4 | |||
37e9e9015a | |||
3fea2efd81 | |||
96eebc3d27 | |||
c4caf1ec94 | |||
0f51113009 | |||
8d4a4b529b | |||
9b35ca06da | |||
75c1a35a25 | |||
b6ba5ef4be | |||
0ed27a6c33 | |||
fc0c0bf817 | |||
9637f1943f | |||
64c4d8eb24 | |||
f928c88b59 | |||
afe0550e3e | |||
fad8b8209f | |||
9f9601d49a | |||
8cf67a29bf |
@ -7,7 +7,6 @@ VITE_KC_API_WS_MODELING_URL=wss://api.dev.zoo.dev/ws/modeling/commands
|
|||||||
VITE_KC_API_BASE_URL=https://api.dev.zoo.dev
|
VITE_KC_API_BASE_URL=https://api.dev.zoo.dev
|
||||||
VITE_KC_SITE_BASE_URL=https://dev.zoo.dev
|
VITE_KC_SITE_BASE_URL=https://dev.zoo.dev
|
||||||
VITE_KC_SITE_APP_URL=https://app.dev.zoo.dev
|
VITE_KC_SITE_APP_URL=https://app.dev.zoo.dev
|
||||||
VITE_KC_SKIP_AUTH=false
|
|
||||||
VITE_KC_CONNECTION_TIMEOUT_MS=5000
|
VITE_KC_CONNECTION_TIMEOUT_MS=5000
|
||||||
#VITE_WASM_URL="optional way of overriding the wasm url, particular for unit tests which need this if you running not on the default 3000 port"
|
#VITE_WASM_URL="optional way of overriding the wasm url, particular for unit tests which need this if you running not on the default 3000 port"
|
||||||
#VITE_KC_DEV_TOKEN="optional token to skip auth in the app"
|
#VITE_KC_DEV_TOKEN="optional token to skip auth in the app"
|
||||||
|
@ -3,5 +3,4 @@ VITE_KC_API_WS_MODELING_URL=wss://api.zoo.dev/ws/modeling/commands
|
|||||||
VITE_KC_API_BASE_URL=https://api.zoo.dev
|
VITE_KC_API_BASE_URL=https://api.zoo.dev
|
||||||
VITE_KC_SITE_BASE_URL=https://zoo.dev
|
VITE_KC_SITE_BASE_URL=https://zoo.dev
|
||||||
VITE_KC_SITE_APP_URL=https://app.zoo.dev
|
VITE_KC_SITE_APP_URL=https://app.zoo.dev
|
||||||
VITE_KC_SKIP_AUTH=false
|
|
||||||
VITE_KC_CONNECTION_TIMEOUT_MS=15000
|
VITE_KC_CONNECTION_TIMEOUT_MS=15000
|
||||||
|
30
.github/workflows/static-analysis.yml
vendored
@ -120,6 +120,36 @@ jobs:
|
|||||||
|
|
||||||
- run: npm run circular-deps:diff
|
- run: npm run circular-deps:diff
|
||||||
|
|
||||||
|
npm-url-checker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: npm-build-wasm
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version-file: '.nvmrc'
|
||||||
|
cache: 'npm'
|
||||||
|
- run: npm install
|
||||||
|
|
||||||
|
- name: Download all artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
|
||||||
|
- name: Copy prepared wasm
|
||||||
|
run: |
|
||||||
|
ls -R prepared-wasm
|
||||||
|
cp prepared-wasm/kcl_wasm_lib_bg.wasm public
|
||||||
|
mkdir rust/kcl-wasm-lib/pkg
|
||||||
|
cp prepared-wasm/kcl_wasm_lib* rust/kcl-wasm-lib/pkg
|
||||||
|
|
||||||
|
- name: Copy prepared ts-rs bindings
|
||||||
|
run: |
|
||||||
|
ls -R prepared-ts-rs-bindings
|
||||||
|
mkdir rust/kcl-lib/bindings
|
||||||
|
cp -r prepared-ts-rs-bindings/* rust/kcl-lib/bindings/
|
||||||
|
|
||||||
|
- run: npm run url-checker:diff
|
||||||
|
|
||||||
python-codespell:
|
python-codespell:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
steps:
|
steps:
|
||||||
|
@ -235,6 +235,47 @@ To display logging (to the terminal or console) set `ZOO_LOG=1`. This will log s
|
|||||||
|
|
||||||
To enable memory metrics, build with `--features dhat-heap`.
|
To enable memory metrics, build with `--features dhat-heap`.
|
||||||
|
|
||||||
|
## Running scripts
|
||||||
|
|
||||||
|
There are multiple scripts under the folder path `./scripts` which can be used in various settings.
|
||||||
|
|
||||||
|
### Pattern for a static file, npm run commands, and CI-CD checks
|
||||||
|
|
||||||
|
If you want to implement a static checker follow this pattern. Two static checkers we have are circular dependency checks in our typescript code and url checker to see if any hard coded URL is the typescript application 404s. We have a set of known files in `./scripts/known/*.txt` which is the baseline.
|
||||||
|
|
||||||
|
If you improve the baseline, run the overwrite command and commit the new smaller baseline. Try not to make the baseline bigger, the CI CD will complain.
|
||||||
|
These baselines are to hold us to higher standards and help implement automated testing against the repository
|
||||||
|
|
||||||
|
#### Output result to stdout
|
||||||
|
- `npm run circular-deps`
|
||||||
|
- `npm run url-checker`
|
||||||
|
|
||||||
|
- create a `<name>.sh` file that will run the static checker then output the result to `stdout`
|
||||||
|
|
||||||
|
#### Overwrite result to known .txt file on disk
|
||||||
|
|
||||||
|
If the application needs to overwrite the known file on disk use this pattern. This known .txt file will be source controlled as the baseline
|
||||||
|
|
||||||
|
- `npm run circular-deps:overwrite`
|
||||||
|
- `npm run url-checker:overwrite`
|
||||||
|
|
||||||
|
#### Diff baseline and current
|
||||||
|
|
||||||
|
These commands will write a /tmp/ file on disk and compare it to the known file in the repository. This command will also be used in the CI CD pipeline for automated checks
|
||||||
|
|
||||||
|
- create a `diff-<name>.sh` file that is the script to diff your tmp file to the baseline
|
||||||
|
e.g. `diff-url-checker.sh`
|
||||||
|
```bash
|
||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
npm run url-checker > /tmp/urls.txt
|
||||||
|
diff --ignore-blank-lines -w /tmp/urls.txt ./scripts/known/urls.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
- `npm run circular-deps:diff`
|
||||||
|
- `npm run url-checker:diff`
|
||||||
|
|
||||||
## Proposing changes
|
## Proposing changes
|
||||||
|
|
||||||
Before you submit a contribution PR to this repo, please ensure that:
|
Before you submit a contribution PR to this repo, please ensure that:
|
||||||
|
48
docs/kcl-std/functions/std-sketch-planeOf.md
Normal file
55
docs/kcl-std/functions/std-sketch-rectangle.md
Normal file
@ -54,23 +54,33 @@ layout: manual
|
|||||||
* [`circle`](/docs/kcl-std/functions/std-sketch-circle)
|
* [`circle`](/docs/kcl-std/functions/std-sketch-circle)
|
||||||
* [`circleThreePoint`](/docs/kcl-std/functions/std-sketch-circleThreePoint)
|
* [`circleThreePoint`](/docs/kcl-std/functions/std-sketch-circleThreePoint)
|
||||||
* [`close`](/docs/kcl-std/functions/std-sketch-close)
|
* [`close`](/docs/kcl-std/functions/std-sketch-close)
|
||||||
|
* [`conic`](/docs/kcl-std/functions/std-sketch-conic)
|
||||||
|
* [`ellipse`](/docs/kcl-std/functions/std-sketch-ellipse)
|
||||||
|
* [`elliptic`](/docs/kcl-std/functions/std-sketch-elliptic)
|
||||||
|
* [`ellipticPoint`](/docs/kcl-std/functions/std-sketch-ellipticPoint)
|
||||||
* [`extrude`](/docs/kcl-std/functions/std-sketch-extrude)
|
* [`extrude`](/docs/kcl-std/functions/std-sketch-extrude)
|
||||||
* [`getCommonEdge`](/docs/kcl-std/functions/std-sketch-getCommonEdge)
|
* [`getCommonEdge`](/docs/kcl-std/functions/std-sketch-getCommonEdge)
|
||||||
* [`getNextAdjacentEdge`](/docs/kcl-std/functions/std-sketch-getNextAdjacentEdge)
|
* [`getNextAdjacentEdge`](/docs/kcl-std/functions/std-sketch-getNextAdjacentEdge)
|
||||||
* [`getOppositeEdge`](/docs/kcl-std/functions/std-sketch-getOppositeEdge)
|
* [`getOppositeEdge`](/docs/kcl-std/functions/std-sketch-getOppositeEdge)
|
||||||
* [`getPreviousAdjacentEdge`](/docs/kcl-std/functions/std-sketch-getPreviousAdjacentEdge)
|
* [`getPreviousAdjacentEdge`](/docs/kcl-std/functions/std-sketch-getPreviousAdjacentEdge)
|
||||||
|
* [`hyperbolic`](/docs/kcl-std/functions/std-sketch-hyperbolic)
|
||||||
|
* [`hyperbolicPoint`](/docs/kcl-std/functions/std-sketch-hyperbolicPoint)
|
||||||
* [`involuteCircular`](/docs/kcl-std/functions/std-sketch-involuteCircular)
|
* [`involuteCircular`](/docs/kcl-std/functions/std-sketch-involuteCircular)
|
||||||
* [`lastSegX`](/docs/kcl-std/functions/std-sketch-lastSegX)
|
* [`lastSegX`](/docs/kcl-std/functions/std-sketch-lastSegX)
|
||||||
* [`lastSegY`](/docs/kcl-std/functions/std-sketch-lastSegY)
|
* [`lastSegY`](/docs/kcl-std/functions/std-sketch-lastSegY)
|
||||||
* [`line`](/docs/kcl-std/functions/std-sketch-line)
|
* [`line`](/docs/kcl-std/functions/std-sketch-line)
|
||||||
* [`loft`](/docs/kcl-std/functions/std-sketch-loft)
|
* [`loft`](/docs/kcl-std/functions/std-sketch-loft)
|
||||||
|
* [`parabolic`](/docs/kcl-std/functions/std-sketch-parabolic)
|
||||||
|
* [`parabolicPoint`](/docs/kcl-std/functions/std-sketch-parabolicPoint)
|
||||||
* [`patternCircular2d`](/docs/kcl-std/functions/std-sketch-patternCircular2d)
|
* [`patternCircular2d`](/docs/kcl-std/functions/std-sketch-patternCircular2d)
|
||||||
* [`patternLinear2d`](/docs/kcl-std/functions/std-sketch-patternLinear2d)
|
* [`patternLinear2d`](/docs/kcl-std/functions/std-sketch-patternLinear2d)
|
||||||
* [`patternTransform2d`](/docs/kcl-std/functions/std-sketch-patternTransform2d)
|
* [`patternTransform2d`](/docs/kcl-std/functions/std-sketch-patternTransform2d)
|
||||||
|
* [`planeOf`](/docs/kcl-std/functions/std-sketch-planeOf)
|
||||||
* [`polygon`](/docs/kcl-std/functions/std-sketch-polygon)
|
* [`polygon`](/docs/kcl-std/functions/std-sketch-polygon)
|
||||||
* [`profileStart`](/docs/kcl-std/functions/std-sketch-profileStart)
|
* [`profileStart`](/docs/kcl-std/functions/std-sketch-profileStart)
|
||||||
* [`profileStartX`](/docs/kcl-std/functions/std-sketch-profileStartX)
|
* [`profileStartX`](/docs/kcl-std/functions/std-sketch-profileStartX)
|
||||||
* [`profileStartY`](/docs/kcl-std/functions/std-sketch-profileStartY)
|
* [`profileStartY`](/docs/kcl-std/functions/std-sketch-profileStartY)
|
||||||
|
* [`rectangle`](/docs/kcl-std/functions/std-sketch-rectangle)
|
||||||
* [`revolve`](/docs/kcl-std/functions/std-sketch-revolve)
|
* [`revolve`](/docs/kcl-std/functions/std-sketch-revolve)
|
||||||
* [`segAng`](/docs/kcl-std/functions/std-sketch-segAng)
|
* [`segAng`](/docs/kcl-std/functions/std-sketch-segAng)
|
||||||
* [`segEnd`](/docs/kcl-std/functions/std-sketch-segEnd)
|
* [`segEnd`](/docs/kcl-std/functions/std-sketch-segEnd)
|
||||||
|
@ -19,23 +19,33 @@ This module contains functions for creating and manipulating sketches, and makin
|
|||||||
* [`circle`](/docs/kcl-std/functions/std-sketch-circle)
|
* [`circle`](/docs/kcl-std/functions/std-sketch-circle)
|
||||||
* [`circleThreePoint`](/docs/kcl-std/functions/std-sketch-circleThreePoint)
|
* [`circleThreePoint`](/docs/kcl-std/functions/std-sketch-circleThreePoint)
|
||||||
* [`close`](/docs/kcl-std/functions/std-sketch-close)
|
* [`close`](/docs/kcl-std/functions/std-sketch-close)
|
||||||
|
* [`conic`](/docs/kcl-std/functions/std-sketch-conic)
|
||||||
|
* [`ellipse`](/docs/kcl-std/functions/std-sketch-ellipse)
|
||||||
|
* [`elliptic`](/docs/kcl-std/functions/std-sketch-elliptic)
|
||||||
|
* [`ellipticPoint`](/docs/kcl-std/functions/std-sketch-ellipticPoint)
|
||||||
* [`extrude`](/docs/kcl-std/functions/std-sketch-extrude)
|
* [`extrude`](/docs/kcl-std/functions/std-sketch-extrude)
|
||||||
* [`getCommonEdge`](/docs/kcl-std/functions/std-sketch-getCommonEdge)
|
* [`getCommonEdge`](/docs/kcl-std/functions/std-sketch-getCommonEdge)
|
||||||
* [`getNextAdjacentEdge`](/docs/kcl-std/functions/std-sketch-getNextAdjacentEdge)
|
* [`getNextAdjacentEdge`](/docs/kcl-std/functions/std-sketch-getNextAdjacentEdge)
|
||||||
* [`getOppositeEdge`](/docs/kcl-std/functions/std-sketch-getOppositeEdge)
|
* [`getOppositeEdge`](/docs/kcl-std/functions/std-sketch-getOppositeEdge)
|
||||||
* [`getPreviousAdjacentEdge`](/docs/kcl-std/functions/std-sketch-getPreviousAdjacentEdge)
|
* [`getPreviousAdjacentEdge`](/docs/kcl-std/functions/std-sketch-getPreviousAdjacentEdge)
|
||||||
|
* [`hyperbolic`](/docs/kcl-std/functions/std-sketch-hyperbolic)
|
||||||
|
* [`hyperbolicPoint`](/docs/kcl-std/functions/std-sketch-hyperbolicPoint)
|
||||||
* [`involuteCircular`](/docs/kcl-std/functions/std-sketch-involuteCircular)
|
* [`involuteCircular`](/docs/kcl-std/functions/std-sketch-involuteCircular)
|
||||||
* [`lastSegX`](/docs/kcl-std/functions/std-sketch-lastSegX)
|
* [`lastSegX`](/docs/kcl-std/functions/std-sketch-lastSegX)
|
||||||
* [`lastSegY`](/docs/kcl-std/functions/std-sketch-lastSegY)
|
* [`lastSegY`](/docs/kcl-std/functions/std-sketch-lastSegY)
|
||||||
* [`line`](/docs/kcl-std/functions/std-sketch-line)
|
* [`line`](/docs/kcl-std/functions/std-sketch-line)
|
||||||
* [`loft`](/docs/kcl-std/functions/std-sketch-loft)
|
* [`loft`](/docs/kcl-std/functions/std-sketch-loft)
|
||||||
|
* [`parabolic`](/docs/kcl-std/functions/std-sketch-parabolic)
|
||||||
|
* [`parabolicPoint`](/docs/kcl-std/functions/std-sketch-parabolicPoint)
|
||||||
* [`patternCircular2d`](/docs/kcl-std/functions/std-sketch-patternCircular2d)
|
* [`patternCircular2d`](/docs/kcl-std/functions/std-sketch-patternCircular2d)
|
||||||
* [`patternLinear2d`](/docs/kcl-std/functions/std-sketch-patternLinear2d)
|
* [`patternLinear2d`](/docs/kcl-std/functions/std-sketch-patternLinear2d)
|
||||||
* [`patternTransform2d`](/docs/kcl-std/functions/std-sketch-patternTransform2d)
|
* [`patternTransform2d`](/docs/kcl-std/functions/std-sketch-patternTransform2d)
|
||||||
|
* [`planeOf`](/docs/kcl-std/functions/std-sketch-planeOf)
|
||||||
* [`polygon`](/docs/kcl-std/functions/std-sketch-polygon)
|
* [`polygon`](/docs/kcl-std/functions/std-sketch-polygon)
|
||||||
* [`profileStart`](/docs/kcl-std/functions/std-sketch-profileStart)
|
* [`profileStart`](/docs/kcl-std/functions/std-sketch-profileStart)
|
||||||
* [`profileStartX`](/docs/kcl-std/functions/std-sketch-profileStartX)
|
* [`profileStartX`](/docs/kcl-std/functions/std-sketch-profileStartX)
|
||||||
* [`profileStartY`](/docs/kcl-std/functions/std-sketch-profileStartY)
|
* [`profileStartY`](/docs/kcl-std/functions/std-sketch-profileStartY)
|
||||||
|
* [`rectangle`](/docs/kcl-std/functions/std-sketch-rectangle)
|
||||||
* [`revolve`](/docs/kcl-std/functions/std-sketch-revolve)
|
* [`revolve`](/docs/kcl-std/functions/std-sketch-revolve)
|
||||||
* [`segAng`](/docs/kcl-std/functions/std-sketch-segAng)
|
* [`segAng`](/docs/kcl-std/functions/std-sketch-segAng)
|
||||||
* [`segEnd`](/docs/kcl-std/functions/std-sketch-segEnd)
|
* [`segEnd`](/docs/kcl-std/functions/std-sketch-segEnd)
|
||||||
|
2
interface.d.ts
vendored
@ -72,14 +72,12 @@ export interface IElectronAPI {
|
|||||||
}
|
}
|
||||||
process: {
|
process: {
|
||||||
env: {
|
env: {
|
||||||
BASE_URL: string
|
|
||||||
IS_PLAYWRIGHT: string
|
IS_PLAYWRIGHT: string
|
||||||
VITE_KC_DEV_TOKEN: string
|
VITE_KC_DEV_TOKEN: string
|
||||||
VITE_KC_API_WS_MODELING_URL: string
|
VITE_KC_API_WS_MODELING_URL: string
|
||||||
VITE_KC_API_BASE_URL: string
|
VITE_KC_API_BASE_URL: string
|
||||||
VITE_KC_SITE_BASE_URL: string
|
VITE_KC_SITE_BASE_URL: string
|
||||||
VITE_KC_SITE_APP_URL: string
|
VITE_KC_SITE_APP_URL: string
|
||||||
VITE_KC_SKIP_AUTH: string
|
|
||||||
VITE_KC_CONNECTION_TIMEOUT_MS: string
|
VITE_KC_CONNECTION_TIMEOUT_MS: string
|
||||||
VITE_KC_DEV_TOKEN: string
|
VITE_KC_DEV_TOKEN: string
|
||||||
NODE_ENV: string
|
NODE_ENV: string
|
||||||
|
@ -110,8 +110,11 @@
|
|||||||
"remove-importmeta": "sed -i 's/import.meta.url/window.location.origin/g' \"./rust/kcl-wasm-lib/pkg/kcl_wasm_lib.js\"; sed -i '' 's/import.meta.url/window.location.origin/g' \"./rust/kcl-wasm-lib/pkg/kcl_wasm_lib.js\" || echo \"sed for both mac and linux\"",
|
"remove-importmeta": "sed -i 's/import.meta.url/window.location.origin/g' \"./rust/kcl-wasm-lib/pkg/kcl_wasm_lib.js\"; sed -i '' 's/import.meta.url/window.location.origin/g' \"./rust/kcl-wasm-lib/pkg/kcl_wasm_lib.js\" || echo \"sed for both mac and linux\"",
|
||||||
"lint-fix": "eslint --fix --ext .ts --ext .tsx src e2e packages/codemirror-lsp-client/src rust/kcl-language-server/client/src",
|
"lint-fix": "eslint --fix --ext .ts --ext .tsx src e2e packages/codemirror-lsp-client/src rust/kcl-language-server/client/src",
|
||||||
"lint": "eslint --max-warnings 0 --ext .ts --ext .tsx src e2e packages/codemirror-lsp-client/src rust/kcl-language-server/client/src",
|
"lint": "eslint --max-warnings 0 --ext .ts --ext .tsx src e2e packages/codemirror-lsp-client/src rust/kcl-language-server/client/src",
|
||||||
|
"url-checker":"./scripts/url-checker.sh",
|
||||||
|
"url-checker:overwrite":"npm run url-checker > scripts/known/urls.txt",
|
||||||
|
"url-checker:diff":"./scripts/diff-url-checker.sh",
|
||||||
"circular-deps": "dpdm --no-warning --no-tree -T --skip-dynamic-imports=circular src/index.tsx",
|
"circular-deps": "dpdm --no-warning --no-tree -T --skip-dynamic-imports=circular src/index.tsx",
|
||||||
"circular-deps:overwrite": "npm run circular-deps | sed '$d' | grep -v '^npm run' > known-circular.txt",
|
"circular-deps:overwrite": "npm run circular-deps | sed '$d' | grep -v '^npm run' > scripts/known/circular.txt",
|
||||||
"circular-deps:diff": "./scripts/diff-circular-deps.sh",
|
"circular-deps:diff": "./scripts/diff-circular-deps.sh",
|
||||||
"circular-deps:diff:nodejs": "npm run circular-deps:diff || node ./scripts/diff.js",
|
"circular-deps:diff:nodejs": "npm run circular-deps:diff || node ./scripts/diff.js",
|
||||||
"files:set-version": "echo \"$(jq --arg v \"$VERSION\" '.version=$v' package.json --indent 2)\" > package.json",
|
"files:set-version": "echo \"$(jq --arg v \"$VERSION\" '.version=$v' package.json --indent 2)\" > package.json",
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
"vscode-uri": "^3.1.0"
|
"vscode-uri": "^3.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^22.14.1",
|
"@types/node": "^24.0.7",
|
||||||
"ts-node": "^10.9.2"
|
"ts-node": "^10.9.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
24
rust/Cargo.lock
generated
@ -1814,7 +1814,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-bumper"
|
name = "kcl-bumper"
|
||||||
version = "0.1.83"
|
version = "0.1.84"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
"clap",
|
||||||
@ -1825,7 +1825,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-derive-docs"
|
name = "kcl-derive-docs"
|
||||||
version = "0.1.83"
|
version = "0.1.84"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@ -1834,7 +1834,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-directory-test-macro"
|
name = "kcl-directory-test-macro"
|
||||||
version = "0.1.83"
|
version = "0.1.84"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"convert_case",
|
"convert_case",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
@ -1844,7 +1844,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-language-server"
|
name = "kcl-language-server"
|
||||||
version = "0.2.83"
|
version = "0.2.84"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
"clap",
|
||||||
@ -1865,7 +1865,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-language-server-release"
|
name = "kcl-language-server-release"
|
||||||
version = "0.1.83"
|
version = "0.1.84"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
"clap",
|
||||||
@ -1885,7 +1885,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-lib"
|
name = "kcl-lib"
|
||||||
version = "0.2.83"
|
version = "0.2.84"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"approx 0.5.1",
|
"approx 0.5.1",
|
||||||
@ -1962,7 +1962,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-python-bindings"
|
name = "kcl-python-bindings"
|
||||||
version = "0.3.83"
|
version = "0.3.84"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"kcl-lib",
|
"kcl-lib",
|
||||||
@ -1977,7 +1977,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-test-server"
|
name = "kcl-test-server"
|
||||||
version = "0.1.83"
|
version = "0.1.84"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"hyper 0.14.32",
|
"hyper 0.14.32",
|
||||||
@ -1990,7 +1990,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-to-core"
|
name = "kcl-to-core"
|
||||||
version = "0.1.83"
|
version = "0.1.84"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
@ -2004,7 +2004,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-wasm-lib"
|
name = "kcl-wasm-lib"
|
||||||
version = "0.1.83"
|
version = "0.1.84"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"bson",
|
"bson",
|
||||||
@ -2071,9 +2071,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kittycad-modeling-cmds"
|
name = "kittycad-modeling-cmds"
|
||||||
version = "0.2.125"
|
version = "0.2.126"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cfd09d95f8bbeb090d4d1137c9bf421eb75763f7a30e4a9e8eefa249ddf20bd3"
|
checksum = "58ca9ecdacf1161add6d1c0ea4c6765449a57b5e50dea26c84629ea39a3d51b7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"chrono",
|
"chrono",
|
||||||
|
@ -36,7 +36,7 @@ dashmap = { version = "6.1.0" }
|
|||||||
http = "1"
|
http = "1"
|
||||||
indexmap = "2.9.0"
|
indexmap = "2.9.0"
|
||||||
kittycad = { version = "0.3.37", default-features = false, features = ["js", "requests"] }
|
kittycad = { version = "0.3.37", default-features = false, features = ["js", "requests"] }
|
||||||
kittycad-modeling-cmds = { version = "0.2.125", features = ["ts-rs", "websocket"] }
|
kittycad-modeling-cmds = { version = "0.2.126", features = ["ts-rs", "websocket"] }
|
||||||
lazy_static = "1.5.0"
|
lazy_static = "1.5.0"
|
||||||
miette = "7.6.0"
|
miette = "7.6.0"
|
||||||
pyo3 = { version = "0.24.2" }
|
pyo3 = { version = "0.24.2" }
|
||||||
@ -61,5 +61,6 @@ result_large_err = "allow"
|
|||||||
|
|
||||||
# Example: how to point modeling-app at a different repo (e.g. a branch or a local clone)
|
# Example: how to point modeling-app at a different repo (e.g. a branch or a local clone)
|
||||||
# [patch.crates-io]
|
# [patch.crates-io]
|
||||||
# kittycad-modeling-cmds = { path = "../../modeling-api/modeling-cmds/" }
|
# kittycad-modeling-cmds = { git = "https://github.com/KittyCAD/modeling-api.git", branch = "ben/conics" }
|
||||||
# kittycad-modeling-session = { path = "../../modeling-api/modeling-session" }
|
# kittycad-modeling-cmds = { path = "../../modeling-api/modeling-cmds" }
|
||||||
|
#kittycad-modeling-session = { path = "../../../modeling-api/modeling-session" }
|
||||||
|
@ -8,6 +8,9 @@ lint:
|
|||||||
# Ensure we can build without extra feature flags.
|
# Ensure we can build without extra feature flags.
|
||||||
cargo clippy -p kcl-lib --all-targets -- -D warnings
|
cargo clippy -p kcl-lib --all-targets -- -D warnings
|
||||||
|
|
||||||
|
lint-fix:
|
||||||
|
cargo clippy --workspace --all-targets --all-features --fix
|
||||||
|
|
||||||
# Run the stdlib docs generation
|
# Run the stdlib docs generation
|
||||||
redo-kcl-stdlib-docs-no-imgs:
|
redo-kcl-stdlib-docs-no-imgs:
|
||||||
EXPECTORATE=overwrite {{cnr}} {{kcl_lib_flags}} docs::gen_std_tests::test_generate_stdlib
|
EXPECTORATE=overwrite {{cnr}} {{kcl_lib_flags}} docs::gen_std_tests::test_generate_stdlib
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "kcl-bumper"
|
name = "kcl-bumper"
|
||||||
version = "0.1.83"
|
version = "0.1.84"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
repository = "https://github.com/KittyCAD/modeling-api"
|
repository = "https://github.com/KittyCAD/modeling-api"
|
||||||
rust-version = "1.76"
|
rust-version = "1.76"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "kcl-derive-docs"
|
name = "kcl-derive-docs"
|
||||||
description = "A tool for generating documentation from Rust derive macros"
|
description = "A tool for generating documentation from Rust derive macros"
|
||||||
version = "0.1.83"
|
version = "0.1.84"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/KittyCAD/modeling-app"
|
repository = "https://github.com/KittyCAD/modeling-app"
|
||||||
|
@ -97,8 +97,11 @@ pub const TEST_NAMES: &[&str] = &[
|
|||||||
"std-offsetPlane-2",
|
"std-offsetPlane-2",
|
||||||
"std-offsetPlane-3",
|
"std-offsetPlane-3",
|
||||||
"std-offsetPlane-4",
|
"std-offsetPlane-4",
|
||||||
|
"std-sketch-planeOf-0",
|
||||||
"std-sketch-circle-0",
|
"std-sketch-circle-0",
|
||||||
"std-sketch-circle-1",
|
"std-sketch-circle-1",
|
||||||
|
"std-sketch-rectangle-0",
|
||||||
|
"std-sketch-rectangle-1",
|
||||||
"std-sketch-patternTransform2d-0",
|
"std-sketch-patternTransform2d-0",
|
||||||
"std-sketch-revolve-0",
|
"std-sketch-revolve-0",
|
||||||
"std-sketch-revolve-1",
|
"std-sketch-revolve-1",
|
||||||
@ -174,6 +177,14 @@ pub const TEST_NAMES: &[&str] = &[
|
|||||||
"std-sketch-line-0",
|
"std-sketch-line-0",
|
||||||
"std-sketch-subtract2d-0",
|
"std-sketch-subtract2d-0",
|
||||||
"std-sketch-subtract2d-1",
|
"std-sketch-subtract2d-1",
|
||||||
|
"std-sketch-conic-0",
|
||||||
|
"std-sketch-parabolic-0",
|
||||||
|
"std-sketch-parabolicPoint-0",
|
||||||
|
"std-sketch-hyperbolic-0",
|
||||||
|
"std-sketch-hyperbolicPoint-0",
|
||||||
|
"std-sketch-ellipse-0",
|
||||||
|
"std-sketch-elliptic-0",
|
||||||
|
"std-sketch-ellipticPoint-0",
|
||||||
"std-sketch-tangentialArc-0",
|
"std-sketch-tangentialArc-0",
|
||||||
"std-sketch-tangentialArc-1",
|
"std-sketch-tangentialArc-1",
|
||||||
"std-sketch-tangentialArc-2",
|
"std-sketch-tangentialArc-2",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "kcl-directory-test-macro"
|
name = "kcl-directory-test-macro"
|
||||||
description = "A tool for generating tests from a directory of kcl files"
|
description = "A tool for generating tests from a directory of kcl files"
|
||||||
version = "0.1.83"
|
version = "0.1.84"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/KittyCAD/modeling-app"
|
repository = "https://github.com/KittyCAD/modeling-app"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "kcl-language-server-release"
|
name = "kcl-language-server-release"
|
||||||
version = "0.1.83"
|
version = "0.1.84"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["KittyCAD Inc <kcl@kittycad.io>"]
|
authors = ["KittyCAD Inc <kcl@kittycad.io>"]
|
||||||
publish = false
|
publish = false
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
name = "kcl-language-server"
|
name = "kcl-language-server"
|
||||||
description = "A language server for KCL."
|
description = "A language server for KCL."
|
||||||
authors = ["KittyCAD Inc <kcl@kittycad.io>"]
|
authors = ["KittyCAD Inc <kcl@kittycad.io>"]
|
||||||
version = "0.2.83"
|
version = "0.2.84"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "kcl-lib"
|
name = "kcl-lib"
|
||||||
description = "KittyCAD Language implementation and tools"
|
description = "KittyCAD Language implementation and tools"
|
||||||
version = "0.2.83"
|
version = "0.2.84"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/KittyCAD/modeling-app"
|
repository = "https://github.com/KittyCAD/modeling-app"
|
||||||
|
@ -10,71 +10,76 @@ DATA;
|
|||||||
NAMED_UNIT(*)
|
NAMED_UNIT(*)
|
||||||
SI_UNIT($, .METRE.)
|
SI_UNIT($, .METRE.)
|
||||||
);
|
);
|
||||||
#2 = UNCERTAINTY_MEASURE_WITH_UNIT(0.00001, #1, 'DISTANCE_ACCURACY_VALUE', $);
|
#2 = (
|
||||||
#3 = (
|
NAMED_UNIT(*)
|
||||||
|
PLANE_ANGLE_UNIT()
|
||||||
|
SI_UNIT($, .RADIAN.)
|
||||||
|
);
|
||||||
|
#3 = UNCERTAINTY_MEASURE_WITH_UNIT(0.00001, #1, 'DISTANCE_ACCURACY_VALUE', $);
|
||||||
|
#4 = (
|
||||||
GEOMETRIC_REPRESENTATION_CONTEXT(3)
|
GEOMETRIC_REPRESENTATION_CONTEXT(3)
|
||||||
GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#2))
|
GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#3))
|
||||||
GLOBAL_UNIT_ASSIGNED_CONTEXT((#1))
|
GLOBAL_UNIT_ASSIGNED_CONTEXT((#1, #2))
|
||||||
REPRESENTATION_CONTEXT('', '3D')
|
REPRESENTATION_CONTEXT('', '3D')
|
||||||
);
|
);
|
||||||
#4 = CARTESIAN_POINT('NONE', (0.015, -0.01, -0.005));
|
#5 = CARTESIAN_POINT('NONE', (0.015, -0.01, -0.005));
|
||||||
#5 = VERTEX_POINT('NONE', #4);
|
#6 = VERTEX_POINT('NONE', #5);
|
||||||
#6 = CARTESIAN_POINT('NONE', (0.015, 0, -0.005));
|
#7 = CARTESIAN_POINT('NONE', (0.015, 0, -0.005));
|
||||||
#7 = VERTEX_POINT('NONE', #6);
|
#8 = VERTEX_POINT('NONE', #7);
|
||||||
#8 = DIRECTION('NONE', (1, 0, -0));
|
#9 = DIRECTION('NONE', (1, 0, -0));
|
||||||
#9 = DIRECTION('NONE', (0, 1, 0));
|
#10 = DIRECTION('NONE', (0, 1, 0));
|
||||||
#10 = CARTESIAN_POINT('NONE', (0.005, -0.01, -0.005));
|
#11 = CARTESIAN_POINT('NONE', (0.005, -0.01, -0.005));
|
||||||
#11 = AXIS2_PLACEMENT_3D('NONE', #10, #9, #8);
|
#12 = AXIS2_PLACEMENT_3D('NONE', #11, #10, #9);
|
||||||
#12 = CIRCLE('NONE', #11, 0.01);
|
#13 = CIRCLE('NONE', #12, 0.01);
|
||||||
#13 = DIRECTION('NONE', (0, 1, 0));
|
#14 = DIRECTION('NONE', (0, 1, 0));
|
||||||
#14 = VECTOR('NONE', #13, 1);
|
#15 = VECTOR('NONE', #14, 1);
|
||||||
#15 = CARTESIAN_POINT('NONE', (0.015, -0.01, -0.005));
|
#16 = CARTESIAN_POINT('NONE', (0.015, -0.01, -0.005));
|
||||||
#16 = LINE('NONE', #15, #14);
|
#17 = LINE('NONE', #16, #15);
|
||||||
#17 = DIRECTION('NONE', (1, 0, -0));
|
#18 = DIRECTION('NONE', (1, 0, -0));
|
||||||
#18 = DIRECTION('NONE', (0, 1, 0));
|
#19 = DIRECTION('NONE', (0, 1, 0));
|
||||||
#19 = CARTESIAN_POINT('NONE', (0.005, 0, -0.005));
|
#20 = CARTESIAN_POINT('NONE', (0.005, 0, -0.005));
|
||||||
#20 = AXIS2_PLACEMENT_3D('NONE', #19, #18, #17);
|
#21 = AXIS2_PLACEMENT_3D('NONE', #20, #19, #18);
|
||||||
#21 = CIRCLE('NONE', #20, 0.01);
|
#22 = CIRCLE('NONE', #21, 0.01);
|
||||||
#22 = EDGE_CURVE('NONE', #5, #5, #12, .T.);
|
#23 = EDGE_CURVE('NONE', #6, #6, #13, .T.);
|
||||||
#23 = EDGE_CURVE('NONE', #5, #7, #16, .T.);
|
#24 = EDGE_CURVE('NONE', #6, #8, #17, .T.);
|
||||||
#24 = EDGE_CURVE('NONE', #7, #7, #21, .T.);
|
#25 = EDGE_CURVE('NONE', #8, #8, #22, .T.);
|
||||||
#25 = CARTESIAN_POINT('NONE', (0.005, -0.005, -0.005));
|
#26 = CARTESIAN_POINT('NONE', (0.005, -0.005, -0.005));
|
||||||
#26 = DIRECTION('NONE', (0, 1, 0));
|
#27 = DIRECTION('NONE', (0, 1, 0));
|
||||||
#27 = DIRECTION('NONE', (1, 0, -0));
|
#28 = DIRECTION('NONE', (1, 0, -0));
|
||||||
#28 = AXIS2_PLACEMENT_3D('NONE', #25, #26, #27);
|
#29 = AXIS2_PLACEMENT_3D('NONE', #26, #27, #28);
|
||||||
#29 = CYLINDRICAL_SURFACE('NONE', #28, 0.01);
|
#30 = CYLINDRICAL_SURFACE('NONE', #29, 0.01);
|
||||||
#30 = CARTESIAN_POINT('NONE', (0, -0.01, -0));
|
#31 = CARTESIAN_POINT('NONE', (0, -0.01, -0));
|
||||||
#31 = DIRECTION('NONE', (0, 1, 0));
|
#32 = DIRECTION('NONE', (0, 1, 0));
|
||||||
#32 = AXIS2_PLACEMENT_3D('NONE', #30, #31, $);
|
#33 = AXIS2_PLACEMENT_3D('NONE', #31, #32, $);
|
||||||
#33 = PLANE('NONE', #32);
|
#34 = PLANE('NONE', #33);
|
||||||
#34 = CARTESIAN_POINT('NONE', (0, 0, -0));
|
#35 = CARTESIAN_POINT('NONE', (0, 0, -0));
|
||||||
#35 = DIRECTION('NONE', (0, 1, 0));
|
#36 = DIRECTION('NONE', (0, 1, 0));
|
||||||
#36 = AXIS2_PLACEMENT_3D('NONE', #34, #35, $);
|
#37 = AXIS2_PLACEMENT_3D('NONE', #35, #36, $);
|
||||||
#37 = PLANE('NONE', #36);
|
#38 = PLANE('NONE', #37);
|
||||||
#38 = ORIENTED_EDGE('NONE', *, *, #22, .T.);
|
#39 = ORIENTED_EDGE('NONE', *, *, #23, .T.);
|
||||||
#39 = ORIENTED_EDGE('NONE', *, *, #24, .F.);
|
#40 = ORIENTED_EDGE('NONE', *, *, #25, .F.);
|
||||||
#40 = EDGE_LOOP('NONE', (#38));
|
#41 = EDGE_LOOP('NONE', (#39));
|
||||||
#41 = FACE_BOUND('NONE', #40, .T.);
|
#42 = FACE_BOUND('NONE', #41, .T.);
|
||||||
#42 = EDGE_LOOP('NONE', (#39));
|
#43 = EDGE_LOOP('NONE', (#40));
|
||||||
#43 = FACE_BOUND('NONE', #42, .T.);
|
#44 = FACE_BOUND('NONE', #43, .T.);
|
||||||
#44 = ADVANCED_FACE('NONE', (#41, #43), #29, .T.);
|
#45 = ADVANCED_FACE('NONE', (#42, #44), #30, .T.);
|
||||||
#45 = ORIENTED_EDGE('NONE', *, *, #22, .F.);
|
#46 = ORIENTED_EDGE('NONE', *, *, #23, .F.);
|
||||||
#46 = EDGE_LOOP('NONE', (#45));
|
#47 = EDGE_LOOP('NONE', (#46));
|
||||||
#47 = FACE_BOUND('NONE', #46, .T.);
|
#48 = FACE_BOUND('NONE', #47, .T.);
|
||||||
#48 = ADVANCED_FACE('NONE', (#47), #33, .F.);
|
#49 = ADVANCED_FACE('NONE', (#48), #34, .F.);
|
||||||
#49 = ORIENTED_EDGE('NONE', *, *, #24, .T.);
|
#50 = ORIENTED_EDGE('NONE', *, *, #25, .T.);
|
||||||
#50 = EDGE_LOOP('NONE', (#49));
|
#51 = EDGE_LOOP('NONE', (#50));
|
||||||
#51 = FACE_BOUND('NONE', #50, .T.);
|
#52 = FACE_BOUND('NONE', #51, .T.);
|
||||||
#52 = ADVANCED_FACE('NONE', (#51), #37, .T.);
|
#53 = ADVANCED_FACE('NONE', (#52), #38, .T.);
|
||||||
#53 = CLOSED_SHELL('NONE', (#44, #48, #52));
|
#54 = CLOSED_SHELL('NONE', (#45, #49, #53));
|
||||||
#54 = MANIFOLD_SOLID_BREP('NONE', #53);
|
#55 = MANIFOLD_SOLID_BREP('NONE', #54);
|
||||||
#55 = APPLICATION_CONTEXT('configuration controlled 3D design of mechanical parts and assemblies');
|
#56 = APPLICATION_CONTEXT('configuration controlled 3D design of mechanical parts and assemblies');
|
||||||
#56 = PRODUCT_DEFINITION_CONTEXT('part definition', #55, 'design');
|
#57 = PRODUCT_DEFINITION_CONTEXT('part definition', #56, 'design');
|
||||||
#57 = PRODUCT('UNIDENTIFIED_PRODUCT', 'NONE', $, ());
|
#58 = PRODUCT('UNIDENTIFIED_PRODUCT', 'NONE', $, ());
|
||||||
#58 = PRODUCT_DEFINITION_FORMATION('', $, #57);
|
#59 = PRODUCT_DEFINITION_FORMATION('', $, #58);
|
||||||
#59 = PRODUCT_DEFINITION('design', $, #58, #56);
|
#60 = PRODUCT_DEFINITION('design', $, #59, #57);
|
||||||
#60 = PRODUCT_DEFINITION_SHAPE('NONE', $, #59);
|
#61 = PRODUCT_DEFINITION_SHAPE('NONE', $, #60);
|
||||||
#61 = ADVANCED_BREP_SHAPE_REPRESENTATION('NONE', (#54), #3);
|
#62 = ADVANCED_BREP_SHAPE_REPRESENTATION('NONE', (#55), #4);
|
||||||
#62 = SHAPE_DEFINITION_REPRESENTATION(#60, #61);
|
#63 = SHAPE_DEFINITION_REPRESENTATION(#61, #62);
|
||||||
ENDSEC;
|
ENDSEC;
|
||||||
END-ISO-10303-21;
|
END-ISO-10303-21;
|
||||||
|
@ -226,10 +226,7 @@ impl From<&KclValue> for OpKclValue {
|
|||||||
match value {
|
match value {
|
||||||
KclValue::Uuid { value, .. } => Self::Uuid { value: *value },
|
KclValue::Uuid { value, .. } => Self::Uuid { value: *value },
|
||||||
KclValue::Bool { value, .. } => Self::Bool { value: *value },
|
KclValue::Bool { value, .. } => Self::Bool { value: *value },
|
||||||
KclValue::Number { value, ty, .. } => Self::Number {
|
KclValue::Number { value, ty, .. } => Self::Number { value: *value, ty: *ty },
|
||||||
value: *value,
|
|
||||||
ty: ty.clone(),
|
|
||||||
},
|
|
||||||
KclValue::String { value, .. } => Self::String { value: value.clone() },
|
KclValue::String { value, .. } => Self::String { value: value.clone() },
|
||||||
KclValue::Tuple { value, .. } | KclValue::HomArray { value, .. } => {
|
KclValue::Tuple { value, .. } | KclValue::HomArray { value, .. } => {
|
||||||
let value = value.iter().map(Self::from).collect();
|
let value = value.iter().map(Self::from).collect();
|
||||||
|
@ -864,6 +864,9 @@ impl BinaryPart {
|
|||||||
BinaryPart::CallExpressionKw(call_expression) => call_expression.execute(exec_state, ctx).await,
|
BinaryPart::CallExpressionKw(call_expression) => call_expression.execute(exec_state, ctx).await,
|
||||||
BinaryPart::UnaryExpression(unary_expression) => unary_expression.get_result(exec_state, ctx).await,
|
BinaryPart::UnaryExpression(unary_expression) => unary_expression.get_result(exec_state, ctx).await,
|
||||||
BinaryPart::MemberExpression(member_expression) => member_expression.get_result(exec_state, ctx).await,
|
BinaryPart::MemberExpression(member_expression) => member_expression.get_result(exec_state, ctx).await,
|
||||||
|
BinaryPart::ArrayExpression(e) => e.execute(exec_state, ctx).await,
|
||||||
|
BinaryPart::ArrayRangeExpression(e) => e.execute(exec_state, ctx).await,
|
||||||
|
BinaryPart::ObjectExpression(e) => e.execute(exec_state, ctx).await,
|
||||||
BinaryPart::IfExpression(e) => e.get_result(exec_state, ctx).await,
|
BinaryPart::IfExpression(e) => e.get_result(exec_state, ctx).await,
|
||||||
BinaryPart::AscribedExpression(e) => e.get_result(exec_state, ctx).await,
|
BinaryPart::AscribedExpression(e) => e.get_result(exec_state, ctx).await,
|
||||||
}
|
}
|
||||||
@ -991,6 +994,39 @@ impl Node<MemberExpression> {
|
|||||||
|
|
||||||
// Check the property and object match -- e.g. ints for arrays, strs for objects.
|
// Check the property and object match -- e.g. ints for arrays, strs for objects.
|
||||||
match (object, property, self.computed) {
|
match (object, property, self.computed) {
|
||||||
|
(KclValue::Plane { value: plane }, Property::String(property), false) => match property.as_str() {
|
||||||
|
"yAxis" => {
|
||||||
|
let (p, u) = plane.info.y_axis.as_3_dims();
|
||||||
|
Ok(KclValue::array_from_point3d(
|
||||||
|
p,
|
||||||
|
NumericType::Known(crate::exec::UnitType::Length(u)),
|
||||||
|
vec![meta],
|
||||||
|
))
|
||||||
|
}
|
||||||
|
"xAxis" => {
|
||||||
|
let (p, u) = plane.info.x_axis.as_3_dims();
|
||||||
|
Ok(KclValue::array_from_point3d(
|
||||||
|
p,
|
||||||
|
NumericType::Known(crate::exec::UnitType::Length(u)),
|
||||||
|
vec![meta],
|
||||||
|
))
|
||||||
|
}
|
||||||
|
"origin" => {
|
||||||
|
let (p, u) = plane.info.origin.as_3_dims();
|
||||||
|
Ok(KclValue::array_from_point3d(
|
||||||
|
p,
|
||||||
|
NumericType::Known(crate::exec::UnitType::Length(u)),
|
||||||
|
vec![meta],
|
||||||
|
))
|
||||||
|
}
|
||||||
|
other => Err(KclError::new_undefined_value(
|
||||||
|
KclErrorDetails::new(
|
||||||
|
format!("Property '{other}' not found in plane"),
|
||||||
|
vec![self.clone().into()],
|
||||||
|
),
|
||||||
|
None,
|
||||||
|
)),
|
||||||
|
},
|
||||||
(KclValue::Object { value: map, meta: _ }, Property::String(property), false) => {
|
(KclValue::Object { value: map, meta: _ }, Property::String(property), false) => {
|
||||||
if let Some(value) = map.get(&property) {
|
if let Some(value) = map.get(&property) {
|
||||||
Ok(value.to_owned())
|
Ok(value.to_owned())
|
||||||
@ -1010,7 +1046,22 @@ impl Node<MemberExpression> {
|
|||||||
vec![self.clone().into()],
|
vec![self.clone().into()],
|
||||||
)))
|
)))
|
||||||
}
|
}
|
||||||
(KclValue::Object { .. }, p, _) => {
|
(KclValue::Object { value: map, .. }, p @ Property::UInt(i), _) => {
|
||||||
|
if i == 0
|
||||||
|
&& let Some(value) = map.get("x")
|
||||||
|
{
|
||||||
|
return Ok(value.to_owned());
|
||||||
|
}
|
||||||
|
if i == 1
|
||||||
|
&& let Some(value) = map.get("y")
|
||||||
|
{
|
||||||
|
return Ok(value.to_owned());
|
||||||
|
}
|
||||||
|
if i == 2
|
||||||
|
&& let Some(value) = map.get("z")
|
||||||
|
{
|
||||||
|
return Ok(value.to_owned());
|
||||||
|
}
|
||||||
let t = p.type_name();
|
let t = p.type_name();
|
||||||
let article = article_for(t);
|
let article = article_for(t);
|
||||||
Err(KclError::new_semantic(KclErrorDetails::new(
|
Err(KclError::new_semantic(KclErrorDetails::new(
|
||||||
@ -1046,6 +1097,16 @@ impl Node<MemberExpression> {
|
|||||||
(KclValue::Solid { value }, Property::String(prop), false) if prop == "sketch" => Ok(KclValue::Sketch {
|
(KclValue::Solid { value }, Property::String(prop), false) if prop == "sketch" => Ok(KclValue::Sketch {
|
||||||
value: Box::new(value.sketch),
|
value: Box::new(value.sketch),
|
||||||
}),
|
}),
|
||||||
|
(geometry @ KclValue::Solid { .. }, Property::String(prop), false) if prop == "tags" => {
|
||||||
|
// This is a common mistake.
|
||||||
|
Err(KclError::new_semantic(KclErrorDetails::new(
|
||||||
|
format!(
|
||||||
|
"Property `{prop}` not found on {}. You can get a solid's tags through its sketch, as in, `exampleSolid.sketch.tags`.",
|
||||||
|
geometry.human_friendly_type()
|
||||||
|
),
|
||||||
|
vec![self.clone().into()],
|
||||||
|
)))
|
||||||
|
}
|
||||||
(KclValue::Sketch { value: sk }, Property::String(prop), false) if prop == "tags" => Ok(KclValue::Object {
|
(KclValue::Sketch { value: sk }, Property::String(prop), false) if prop == "tags" => Ok(KclValue::Object {
|
||||||
meta: vec![Metadata {
|
meta: vec![Metadata {
|
||||||
source_range: SourceRange::from(self.clone()),
|
source_range: SourceRange::from(self.clone()),
|
||||||
@ -1056,6 +1117,12 @@ impl Node<MemberExpression> {
|
|||||||
.map(|(k, tag)| (k.to_owned(), KclValue::TagIdentifier(Box::new(tag.to_owned()))))
|
.map(|(k, tag)| (k.to_owned(), KclValue::TagIdentifier(Box::new(tag.to_owned()))))
|
||||||
.collect(),
|
.collect(),
|
||||||
}),
|
}),
|
||||||
|
(geometry @ (KclValue::Sketch { .. } | KclValue::Solid { .. }), Property::String(property), false) => {
|
||||||
|
Err(KclError::new_semantic(KclErrorDetails::new(
|
||||||
|
format!("Property `{property}` not found on {}", geometry.human_friendly_type()),
|
||||||
|
vec![self.clone().into()],
|
||||||
|
)))
|
||||||
|
}
|
||||||
(being_indexed, _, _) => Err(KclError::new_semantic(KclErrorDetails::new(
|
(being_indexed, _, _) => Err(KclError::new_semantic(KclErrorDetails::new(
|
||||||
format!(
|
format!(
|
||||||
"Only arrays can be indexed, but you're trying to index {}",
|
"Only arrays can be indexed, but you're trying to index {}",
|
||||||
@ -1297,7 +1364,7 @@ impl Node<UnaryExpression> {
|
|||||||
Ok(KclValue::Number {
|
Ok(KclValue::Number {
|
||||||
value: -value,
|
value: -value,
|
||||||
meta,
|
meta,
|
||||||
ty: ty.clone(),
|
ty: *ty,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
KclValue::Plane { value } => {
|
KclValue::Plane { value } => {
|
||||||
@ -1329,7 +1396,7 @@ impl Node<UnaryExpression> {
|
|||||||
.map(|v| match v {
|
.map(|v| match v {
|
||||||
KclValue::Number { value, ty, meta } => Ok(KclValue::Number {
|
KclValue::Number { value, ty, meta } => Ok(KclValue::Number {
|
||||||
value: *value * -1.0,
|
value: *value * -1.0,
|
||||||
ty: ty.clone(),
|
ty: *ty,
|
||||||
meta: meta.clone(),
|
meta: meta.clone(),
|
||||||
}),
|
}),
|
||||||
_ => Err(err()),
|
_ => Err(err()),
|
||||||
@ -1350,7 +1417,7 @@ impl Node<UnaryExpression> {
|
|||||||
.map(|v| match v {
|
.map(|v| match v {
|
||||||
KclValue::Number { value, ty, meta } => Ok(KclValue::Number {
|
KclValue::Number { value, ty, meta } => Ok(KclValue::Number {
|
||||||
value: *value * -1.0,
|
value: *value * -1.0,
|
||||||
ty: ty.clone(),
|
ty: *ty,
|
||||||
meta: meta.clone(),
|
meta: meta.clone(),
|
||||||
}),
|
}),
|
||||||
_ => Err(err()),
|
_ => Err(err()),
|
||||||
@ -1544,7 +1611,7 @@ impl Node<ArrayRangeExpression> {
|
|||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|num| KclValue::Number {
|
.map(|num| KclValue::Number {
|
||||||
value: num as f64,
|
value: num as f64,
|
||||||
ty: start_ty.clone(),
|
ty: start_ty,
|
||||||
meta: meta.clone(),
|
meta: meta.clone(),
|
||||||
})
|
})
|
||||||
.collect(),
|
.collect(),
|
||||||
@ -2186,4 +2253,12 @@ y = x[0mm + 1]
|
|||||||
"#;
|
"#;
|
||||||
parse_execute(ast).await.unwrap_err();
|
parse_execute(ast).await.unwrap_err();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
|
async fn getting_property_of_plane() {
|
||||||
|
// let ast = include_str!("../../tests/inputs/planestuff.kcl");
|
||||||
|
let ast = std::fs::read_to_string("tests/inputs/planestuff.kcl").unwrap();
|
||||||
|
|
||||||
|
parse_execute(&ast).await.unwrap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -663,8 +663,21 @@ impl SketchSurface {
|
|||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub(crate) enum GetTangentialInfoFromPathsResult {
|
pub(crate) enum GetTangentialInfoFromPathsResult {
|
||||||
PreviousPoint([f64; 2]),
|
PreviousPoint([f64; 2]),
|
||||||
Arc { center: [f64; 2], ccw: bool },
|
Arc {
|
||||||
Circle { center: [f64; 2], ccw: bool, radius: f64 },
|
center: [f64; 2],
|
||||||
|
ccw: bool,
|
||||||
|
},
|
||||||
|
Circle {
|
||||||
|
center: [f64; 2],
|
||||||
|
ccw: bool,
|
||||||
|
radius: f64,
|
||||||
|
},
|
||||||
|
Ellipse {
|
||||||
|
center: [f64; 2],
|
||||||
|
ccw: bool,
|
||||||
|
major_radius: f64,
|
||||||
|
_minor_radius: f64,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GetTangentialInfoFromPathsResult {
|
impl GetTangentialInfoFromPathsResult {
|
||||||
@ -679,6 +692,12 @@ impl GetTangentialInfoFromPathsResult {
|
|||||||
GetTangentialInfoFromPathsResult::Circle {
|
GetTangentialInfoFromPathsResult::Circle {
|
||||||
center, radius, ccw, ..
|
center, radius, ccw, ..
|
||||||
} => [center[0] + radius, center[1] + if *ccw { -1.0 } else { 1.0 }],
|
} => [center[0] + radius, center[1] + if *ccw { -1.0 } else { 1.0 }],
|
||||||
|
GetTangentialInfoFromPathsResult::Ellipse {
|
||||||
|
center,
|
||||||
|
major_radius,
|
||||||
|
ccw,
|
||||||
|
..
|
||||||
|
} => [center[0] + major_radius, center[1] + if *ccw { -1.0 } else { 1.0 }],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -921,6 +940,12 @@ impl Point3d {
|
|||||||
units: UnitLen::Unknown,
|
units: UnitLen::Unknown,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn as_3_dims(&self) -> ([f64; 3], UnitLen) {
|
||||||
|
let p = [self.x, self.y, self.z];
|
||||||
|
let u = self.units;
|
||||||
|
(p, u)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<[TyF64; 3]> for Point3d {
|
impl From<[TyF64; 3]> for Point3d {
|
||||||
@ -939,6 +964,7 @@ impl From<Point3d> for Point3D {
|
|||||||
Self { x: p.x, y: p.y, z: p.z }
|
Self { x: p.x, y: p.y, z: p.z }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Point3d> for kittycad_modeling_cmds::shared::Point3d<LengthUnit> {
|
impl From<Point3d> for kittycad_modeling_cmds::shared::Point3d<LengthUnit> {
|
||||||
fn from(p: Point3d) -> Self {
|
fn from(p: Point3d) -> Self {
|
||||||
Self {
|
Self {
|
||||||
@ -1004,12 +1030,12 @@ pub struct BasePath {
|
|||||||
impl BasePath {
|
impl BasePath {
|
||||||
pub fn get_to(&self) -> [TyF64; 2] {
|
pub fn get_to(&self) -> [TyF64; 2] {
|
||||||
let ty: NumericType = self.units.into();
|
let ty: NumericType = self.units.into();
|
||||||
[TyF64::new(self.to[0], ty.clone()), TyF64::new(self.to[1], ty)]
|
[TyF64::new(self.to[0], ty), TyF64::new(self.to[1], ty)]
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_from(&self) -> [TyF64; 2] {
|
pub fn get_from(&self) -> [TyF64; 2] {
|
||||||
let ty: NumericType = self.units.into();
|
let ty: NumericType = self.units.into();
|
||||||
[TyF64::new(self.from[0], ty.clone()), TyF64::new(self.from[1], ty)]
|
[TyF64::new(self.from[0], ty), TyF64::new(self.from[1], ty)]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1030,7 +1056,7 @@ pub struct GeoMeta {
|
|||||||
#[ts(export)]
|
#[ts(export)]
|
||||||
#[serde(tag = "type")]
|
#[serde(tag = "type")]
|
||||||
pub enum Path {
|
pub enum Path {
|
||||||
/// A path that goes to a point.
|
/// A straight line which ends at the given point.
|
||||||
ToPoint {
|
ToPoint {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
base: BasePath,
|
base: BasePath,
|
||||||
@ -1127,6 +1153,19 @@ pub enum Path {
|
|||||||
/// True if the arc is counterclockwise.
|
/// True if the arc is counterclockwise.
|
||||||
ccw: bool,
|
ccw: bool,
|
||||||
},
|
},
|
||||||
|
Ellipse {
|
||||||
|
#[serde(flatten)]
|
||||||
|
base: BasePath,
|
||||||
|
center: [f64; 2],
|
||||||
|
major_radius: f64,
|
||||||
|
minor_radius: f64,
|
||||||
|
ccw: bool,
|
||||||
|
},
|
||||||
|
//TODO: (bc) figure this out
|
||||||
|
Conic {
|
||||||
|
#[serde(flatten)]
|
||||||
|
base: BasePath,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
/// What kind of path is this?
|
/// What kind of path is this?
|
||||||
@ -1141,6 +1180,8 @@ enum PathType {
|
|||||||
Horizontal,
|
Horizontal,
|
||||||
AngledLineTo,
|
AngledLineTo,
|
||||||
Arc,
|
Arc,
|
||||||
|
Ellipse,
|
||||||
|
Conic,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<&Path> for PathType {
|
impl From<&Path> for PathType {
|
||||||
@ -1156,6 +1197,8 @@ impl From<&Path> for PathType {
|
|||||||
Path::Base { .. } => Self::Base,
|
Path::Base { .. } => Self::Base,
|
||||||
Path::Arc { .. } => Self::Arc,
|
Path::Arc { .. } => Self::Arc,
|
||||||
Path::ArcThreePoint { .. } => Self::Arc,
|
Path::ArcThreePoint { .. } => Self::Arc,
|
||||||
|
Path::Ellipse { .. } => Self::Ellipse,
|
||||||
|
Path::Conic { .. } => Self::Conic,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1173,6 +1216,8 @@ impl Path {
|
|||||||
Path::CircleThreePoint { base, .. } => base.geo_meta.id,
|
Path::CircleThreePoint { base, .. } => base.geo_meta.id,
|
||||||
Path::Arc { base, .. } => base.geo_meta.id,
|
Path::Arc { base, .. } => base.geo_meta.id,
|
||||||
Path::ArcThreePoint { base, .. } => base.geo_meta.id,
|
Path::ArcThreePoint { base, .. } => base.geo_meta.id,
|
||||||
|
Path::Ellipse { base, .. } => base.geo_meta.id,
|
||||||
|
Path::Conic { base, .. } => base.geo_meta.id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1188,6 +1233,8 @@ impl Path {
|
|||||||
Path::CircleThreePoint { base, .. } => base.geo_meta.id = id,
|
Path::CircleThreePoint { base, .. } => base.geo_meta.id = id,
|
||||||
Path::Arc { base, .. } => base.geo_meta.id = id,
|
Path::Arc { base, .. } => base.geo_meta.id = id,
|
||||||
Path::ArcThreePoint { base, .. } => base.geo_meta.id = id,
|
Path::ArcThreePoint { base, .. } => base.geo_meta.id = id,
|
||||||
|
Path::Ellipse { base, .. } => base.geo_meta.id = id,
|
||||||
|
Path::Conic { base, .. } => base.geo_meta.id = id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1203,6 +1250,8 @@ impl Path {
|
|||||||
Path::CircleThreePoint { base, .. } => base.tag.clone(),
|
Path::CircleThreePoint { base, .. } => base.tag.clone(),
|
||||||
Path::Arc { base, .. } => base.tag.clone(),
|
Path::Arc { base, .. } => base.tag.clone(),
|
||||||
Path::ArcThreePoint { base, .. } => base.tag.clone(),
|
Path::ArcThreePoint { base, .. } => base.tag.clone(),
|
||||||
|
Path::Ellipse { base, .. } => base.tag.clone(),
|
||||||
|
Path::Conic { base, .. } => base.tag.clone(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1218,6 +1267,8 @@ impl Path {
|
|||||||
Path::CircleThreePoint { base, .. } => base,
|
Path::CircleThreePoint { base, .. } => base,
|
||||||
Path::Arc { base, .. } => base,
|
Path::Arc { base, .. } => base,
|
||||||
Path::ArcThreePoint { base, .. } => base,
|
Path::ArcThreePoint { base, .. } => base,
|
||||||
|
Path::Ellipse { base, .. } => base,
|
||||||
|
Path::Conic { base, .. } => base,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1225,14 +1276,14 @@ impl Path {
|
|||||||
pub fn get_from(&self) -> [TyF64; 2] {
|
pub fn get_from(&self) -> [TyF64; 2] {
|
||||||
let p = &self.get_base().from;
|
let p = &self.get_base().from;
|
||||||
let ty: NumericType = self.get_base().units.into();
|
let ty: NumericType = self.get_base().units.into();
|
||||||
[TyF64::new(p[0], ty.clone()), TyF64::new(p[1], ty)]
|
[TyF64::new(p[0], ty), TyF64::new(p[1], ty)]
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Where does this path segment end?
|
/// Where does this path segment end?
|
||||||
pub fn get_to(&self) -> [TyF64; 2] {
|
pub fn get_to(&self) -> [TyF64; 2] {
|
||||||
let p = &self.get_base().to;
|
let p = &self.get_base().to;
|
||||||
let ty: NumericType = self.get_base().units.into();
|
let ty: NumericType = self.get_base().units.into();
|
||||||
[TyF64::new(p[0], ty.clone()), TyF64::new(p[1], ty)]
|
[TyF64::new(p[0], ty), TyF64::new(p[1], ty)]
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The path segment start point and its type.
|
/// The path segment start point and its type.
|
||||||
@ -1249,11 +1300,12 @@ impl Path {
|
|||||||
(*p, ty)
|
(*p, ty)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Length of this path segment, in cartesian plane.
|
/// Length of this path segment, in cartesian plane. Not all segment types
|
||||||
pub fn length(&self) -> TyF64 {
|
/// are supported.
|
||||||
|
pub fn length(&self) -> Option<TyF64> {
|
||||||
let n = match self {
|
let n = match self {
|
||||||
Self::ToPoint { .. } | Self::Base { .. } | Self::Horizontal { .. } | Self::AngledLineTo { .. } => {
|
Self::ToPoint { .. } | Self::Base { .. } | Self::Horizontal { .. } | Self::AngledLineTo { .. } => {
|
||||||
linear_distance(&self.get_base().from, &self.get_base().to)
|
Some(linear_distance(&self.get_base().from, &self.get_base().to))
|
||||||
}
|
}
|
||||||
Self::TangentialArc {
|
Self::TangentialArc {
|
||||||
base: _,
|
base: _,
|
||||||
@ -1270,9 +1322,9 @@ impl Path {
|
|||||||
let radius = linear_distance(&self.get_base().from, center);
|
let radius = linear_distance(&self.get_base().from, center);
|
||||||
debug_assert_eq!(radius, linear_distance(&self.get_base().to, center));
|
debug_assert_eq!(radius, linear_distance(&self.get_base().to, center));
|
||||||
// TODO: Call engine utils to figure this out.
|
// TODO: Call engine utils to figure this out.
|
||||||
linear_distance(&self.get_base().from, &self.get_base().to)
|
Some(linear_distance(&self.get_base().from, &self.get_base().to))
|
||||||
}
|
}
|
||||||
Self::Circle { radius, .. } => 2.0 * std::f64::consts::PI * radius,
|
Self::Circle { radius, .. } => Some(2.0 * std::f64::consts::PI * radius),
|
||||||
Self::CircleThreePoint { .. } => {
|
Self::CircleThreePoint { .. } => {
|
||||||
let circle_center = crate::std::utils::calculate_circle_from_3_points([
|
let circle_center = crate::std::utils::calculate_circle_from_3_points([
|
||||||
self.get_base().from,
|
self.get_base().from,
|
||||||
@ -1283,18 +1335,26 @@ impl Path {
|
|||||||
&[circle_center.center[0], circle_center.center[1]],
|
&[circle_center.center[0], circle_center.center[1]],
|
||||||
&self.get_base().from,
|
&self.get_base().from,
|
||||||
);
|
);
|
||||||
2.0 * std::f64::consts::PI * radius
|
Some(2.0 * std::f64::consts::PI * radius)
|
||||||
}
|
}
|
||||||
Self::Arc { .. } => {
|
Self::Arc { .. } => {
|
||||||
// TODO: Call engine utils to figure this out.
|
// TODO: Call engine utils to figure this out.
|
||||||
linear_distance(&self.get_base().from, &self.get_base().to)
|
Some(linear_distance(&self.get_base().from, &self.get_base().to))
|
||||||
}
|
}
|
||||||
Self::ArcThreePoint { .. } => {
|
Self::ArcThreePoint { .. } => {
|
||||||
// TODO: Call engine utils to figure this out.
|
// TODO: Call engine utils to figure this out.
|
||||||
linear_distance(&self.get_base().from, &self.get_base().to)
|
Some(linear_distance(&self.get_base().from, &self.get_base().to))
|
||||||
|
}
|
||||||
|
Self::Ellipse { .. } => {
|
||||||
|
// Not supported.
|
||||||
|
None
|
||||||
|
}
|
||||||
|
Self::Conic { .. } => {
|
||||||
|
// Not supported.
|
||||||
|
None
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
TyF64::new(n, self.get_base().units.into())
|
n.map(|n| TyF64::new(n, self.get_base().units.into()))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_base_mut(&mut self) -> Option<&mut BasePath> {
|
pub fn get_base_mut(&mut self) -> Option<&mut BasePath> {
|
||||||
@ -1309,6 +1369,8 @@ impl Path {
|
|||||||
Path::CircleThreePoint { base, .. } => Some(base),
|
Path::CircleThreePoint { base, .. } => Some(base),
|
||||||
Path::Arc { base, .. } => Some(base),
|
Path::Arc { base, .. } => Some(base),
|
||||||
Path::ArcThreePoint { base, .. } => Some(base),
|
Path::ArcThreePoint { base, .. } => Some(base),
|
||||||
|
Path::Ellipse { base, .. } => Some(base),
|
||||||
|
Path::Conic { base, .. } => Some(base),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1344,7 +1406,24 @@ impl Path {
|
|||||||
radius: circle.radius,
|
radius: circle.radius,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Path::ToPoint { .. } | Path::Horizontal { .. } | Path::AngledLineTo { .. } | Path::Base { .. } => {
|
// TODO: (bc) fix me
|
||||||
|
Path::Ellipse {
|
||||||
|
center,
|
||||||
|
major_radius,
|
||||||
|
minor_radius,
|
||||||
|
ccw,
|
||||||
|
..
|
||||||
|
} => GetTangentialInfoFromPathsResult::Ellipse {
|
||||||
|
center: *center,
|
||||||
|
major_radius: *major_radius,
|
||||||
|
_minor_radius: *minor_radius,
|
||||||
|
ccw: *ccw,
|
||||||
|
},
|
||||||
|
Path::Conic { .. }
|
||||||
|
| Path::ToPoint { .. }
|
||||||
|
| Path::Horizontal { .. }
|
||||||
|
| Path::AngledLineTo { .. }
|
||||||
|
| Path::Base { .. } => {
|
||||||
let base = self.get_base();
|
let base = self.get_base();
|
||||||
GetTangentialInfoFromPathsResult::PreviousPoint(base.from)
|
GetTangentialInfoFromPathsResult::PreviousPoint(base.from)
|
||||||
}
|
}
|
||||||
|
@ -415,15 +415,16 @@ impl KclValue {
|
|||||||
|
|
||||||
/// Put the point into a KCL value.
|
/// Put the point into a KCL value.
|
||||||
pub fn from_point2d(p: [f64; 2], ty: NumericType, meta: Vec<Metadata>) -> Self {
|
pub fn from_point2d(p: [f64; 2], ty: NumericType, meta: Vec<Metadata>) -> Self {
|
||||||
|
let [x, y] = p;
|
||||||
Self::Tuple {
|
Self::Tuple {
|
||||||
value: vec![
|
value: vec![
|
||||||
Self::Number {
|
Self::Number {
|
||||||
value: p[0],
|
value: x,
|
||||||
meta: meta.clone(),
|
meta: meta.clone(),
|
||||||
ty: ty.clone(),
|
ty,
|
||||||
},
|
},
|
||||||
Self::Number {
|
Self::Number {
|
||||||
value: p[1],
|
value: y,
|
||||||
meta: meta.clone(),
|
meta: meta.clone(),
|
||||||
ty,
|
ty,
|
||||||
},
|
},
|
||||||
@ -432,6 +433,56 @@ impl KclValue {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Put the point into a KCL value.
|
||||||
|
pub fn from_point3d(p: [f64; 3], ty: NumericType, meta: Vec<Metadata>) -> Self {
|
||||||
|
let [x, y, z] = p;
|
||||||
|
Self::Tuple {
|
||||||
|
value: vec![
|
||||||
|
Self::Number {
|
||||||
|
value: x,
|
||||||
|
meta: meta.clone(),
|
||||||
|
ty,
|
||||||
|
},
|
||||||
|
Self::Number {
|
||||||
|
value: y,
|
||||||
|
meta: meta.clone(),
|
||||||
|
ty,
|
||||||
|
},
|
||||||
|
Self::Number {
|
||||||
|
value: z,
|
||||||
|
meta: meta.clone(),
|
||||||
|
ty,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
meta,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Put the point into a KCL point.
|
||||||
|
pub fn array_from_point3d(p: [f64; 3], ty: NumericType, meta: Vec<Metadata>) -> Self {
|
||||||
|
let [x, y, z] = p;
|
||||||
|
Self::HomArray {
|
||||||
|
value: vec![
|
||||||
|
Self::Number {
|
||||||
|
value: x,
|
||||||
|
meta: meta.clone(),
|
||||||
|
ty,
|
||||||
|
},
|
||||||
|
Self::Number {
|
||||||
|
value: y,
|
||||||
|
meta: meta.clone(),
|
||||||
|
ty,
|
||||||
|
},
|
||||||
|
Self::Number {
|
||||||
|
value: z,
|
||||||
|
meta: meta.clone(),
|
||||||
|
ty,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
ty: ty.into(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) fn as_usize(&self) -> Option<usize> {
|
pub(crate) fn as_usize(&self) -> Option<usize> {
|
||||||
match self {
|
match self {
|
||||||
KclValue::Number { value, .. } => crate::try_f64_to_usize(*value),
|
KclValue::Number { value, .. } => crate::try_f64_to_usize(*value),
|
||||||
@ -448,7 +499,7 @@ impl KclValue {
|
|||||||
|
|
||||||
pub fn as_int_with_ty(&self) -> Option<(i64, NumericType)> {
|
pub fn as_int_with_ty(&self) -> Option<(i64, NumericType)> {
|
||||||
match self {
|
match self {
|
||||||
KclValue::Number { value, ty, .. } => crate::try_f64_to_i64(*value).map(|i| (i, ty.clone())),
|
KclValue::Number { value, ty, .. } => crate::try_f64_to_i64(*value).map(|i| (i, *ty)),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -562,7 +613,7 @@ impl KclValue {
|
|||||||
|
|
||||||
pub fn as_ty_f64(&self) -> Option<TyF64> {
|
pub fn as_ty_f64(&self) -> Option<TyF64> {
|
||||||
match self {
|
match self {
|
||||||
KclValue::Number { value, ty, .. } => Some(TyF64::new(*value, ty.clone())),
|
KclValue::Number { value, ty, .. } => Some(TyF64::new(*value, *ty)),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -460,7 +460,7 @@ impl fmt::Display for PrimitiveType {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, ts_rs::TS, JsonSchema)]
|
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, ts_rs::TS, JsonSchema)]
|
||||||
#[ts(export)]
|
#[ts(export)]
|
||||||
#[serde(tag = "type")]
|
#[serde(tag = "type")]
|
||||||
pub enum NumericType {
|
pub enum NumericType {
|
||||||
@ -575,7 +575,7 @@ impl NumericType {
|
|||||||
match (&ty, &i.ty) {
|
match (&ty, &i.ty) {
|
||||||
(Any, Default { .. }) if i.n == 0.0 => {}
|
(Any, Default { .. }) if i.n == 0.0 => {}
|
||||||
(Any, t) => {
|
(Any, t) => {
|
||||||
ty = t.clone();
|
ty = *t;
|
||||||
}
|
}
|
||||||
(_, Unknown) | (Default { .. }, Default { .. }) => return (result, Unknown),
|
(_, Unknown) | (Default { .. }, Default { .. }) => return (result, Unknown),
|
||||||
|
|
||||||
@ -598,7 +598,7 @@ impl NumericType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ty == Any && !input.is_empty() {
|
if ty == Any && !input.is_empty() {
|
||||||
ty = input[0].ty.clone();
|
ty = input[0].ty;
|
||||||
}
|
}
|
||||||
|
|
||||||
(result, ty)
|
(result, ty)
|
||||||
@ -722,7 +722,7 @@ impl NumericType {
|
|||||||
if ty.subtype(self) {
|
if ty.subtype(self) {
|
||||||
return Ok(KclValue::Number {
|
return Ok(KclValue::Number {
|
||||||
value: *value,
|
value: *value,
|
||||||
ty: ty.clone(),
|
ty: *ty,
|
||||||
meta: meta.clone(),
|
meta: meta.clone(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -736,7 +736,7 @@ impl NumericType {
|
|||||||
|
|
||||||
(Any, _) => Ok(KclValue::Number {
|
(Any, _) => Ok(KclValue::Number {
|
||||||
value: *value,
|
value: *value,
|
||||||
ty: self.clone(),
|
ty: *self,
|
||||||
meta: meta.clone(),
|
meta: meta.clone(),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
@ -744,7 +744,7 @@ impl NumericType {
|
|||||||
// means accept any number rather than force the current default.
|
// means accept any number rather than force the current default.
|
||||||
(_, Default { .. }) => Ok(KclValue::Number {
|
(_, Default { .. }) => Ok(KclValue::Number {
|
||||||
value: *value,
|
value: *value,
|
||||||
ty: ty.clone(),
|
ty: *ty,
|
||||||
meta: meta.clone(),
|
meta: meta.clone(),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
@ -1491,7 +1491,7 @@ impl KclValue {
|
|||||||
pub fn principal_type(&self) -> Option<RuntimeType> {
|
pub fn principal_type(&self) -> Option<RuntimeType> {
|
||||||
match self {
|
match self {
|
||||||
KclValue::Bool { .. } => Some(RuntimeType::Primitive(PrimitiveType::Boolean)),
|
KclValue::Bool { .. } => Some(RuntimeType::Primitive(PrimitiveType::Boolean)),
|
||||||
KclValue::Number { ty, .. } => Some(RuntimeType::Primitive(PrimitiveType::Number(ty.clone()))),
|
KclValue::Number { ty, .. } => Some(RuntimeType::Primitive(PrimitiveType::Number(*ty))),
|
||||||
KclValue::String { .. } => Some(RuntimeType::Primitive(PrimitiveType::String)),
|
KclValue::String { .. } => Some(RuntimeType::Primitive(PrimitiveType::String)),
|
||||||
KclValue::Object { value, .. } => {
|
KclValue::Object { value, .. } => {
|
||||||
let properties = value
|
let properties = value
|
||||||
|
@ -149,6 +149,9 @@ impl BinaryPart {
|
|||||||
BinaryPart::UnaryExpression(unary_expression) => {
|
BinaryPart::UnaryExpression(unary_expression) => {
|
||||||
unary_expression.get_hover_value_for_position(pos, code, opts)
|
unary_expression.get_hover_value_for_position(pos, code, opts)
|
||||||
}
|
}
|
||||||
|
BinaryPart::ArrayExpression(e) => e.get_hover_value_for_position(pos, code, opts),
|
||||||
|
BinaryPart::ArrayRangeExpression(e) => e.get_hover_value_for_position(pos, code, opts),
|
||||||
|
BinaryPart::ObjectExpression(e) => e.get_hover_value_for_position(pos, code, opts),
|
||||||
BinaryPart::IfExpression(e) => e.get_hover_value_for_position(pos, code, opts),
|
BinaryPart::IfExpression(e) => e.get_hover_value_for_position(pos, code, opts),
|
||||||
BinaryPart::AscribedExpression(e) => e.expr.get_hover_value_for_position(pos, code, opts),
|
BinaryPart::AscribedExpression(e) => e.expr.get_hover_value_for_position(pos, code, opts),
|
||||||
BinaryPart::MemberExpression(member_expression) => {
|
BinaryPart::MemberExpression(member_expression) => {
|
||||||
|
@ -161,6 +161,9 @@ impl BinaryPart {
|
|||||||
BinaryPart::CallExpressionKw(ce) => ce.compute_digest(),
|
BinaryPart::CallExpressionKw(ce) => ce.compute_digest(),
|
||||||
BinaryPart::UnaryExpression(ue) => ue.compute_digest(),
|
BinaryPart::UnaryExpression(ue) => ue.compute_digest(),
|
||||||
BinaryPart::MemberExpression(me) => me.compute_digest(),
|
BinaryPart::MemberExpression(me) => me.compute_digest(),
|
||||||
|
BinaryPart::ArrayExpression(e) => e.compute_digest(),
|
||||||
|
BinaryPart::ArrayRangeExpression(e) => e.compute_digest(),
|
||||||
|
BinaryPart::ObjectExpression(e) => e.compute_digest(),
|
||||||
BinaryPart::IfExpression(e) => e.compute_digest(),
|
BinaryPart::IfExpression(e) => e.compute_digest(),
|
||||||
BinaryPart::AscribedExpression(e) => e.compute_digest(),
|
BinaryPart::AscribedExpression(e) => e.compute_digest(),
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,9 @@ impl BinaryPart {
|
|||||||
BinaryPart::CallExpressionKw(call_expression) => call_expression.module_id,
|
BinaryPart::CallExpressionKw(call_expression) => call_expression.module_id,
|
||||||
BinaryPart::UnaryExpression(unary_expression) => unary_expression.module_id,
|
BinaryPart::UnaryExpression(unary_expression) => unary_expression.module_id,
|
||||||
BinaryPart::MemberExpression(member_expression) => member_expression.module_id,
|
BinaryPart::MemberExpression(member_expression) => member_expression.module_id,
|
||||||
|
BinaryPart::ArrayExpression(e) => e.module_id,
|
||||||
|
BinaryPart::ArrayRangeExpression(e) => e.module_id,
|
||||||
|
BinaryPart::ObjectExpression(e) => e.module_id,
|
||||||
BinaryPart::IfExpression(e) => e.module_id,
|
BinaryPart::IfExpression(e) => e.module_id,
|
||||||
BinaryPart::AscribedExpression(e) => e.module_id,
|
BinaryPart::AscribedExpression(e) => e.module_id,
|
||||||
}
|
}
|
||||||
|
@ -1214,6 +1214,9 @@ impl From<&BinaryPart> for Expr {
|
|||||||
BinaryPart::CallExpressionKw(call_expression) => Expr::CallExpressionKw(call_expression.clone()),
|
BinaryPart::CallExpressionKw(call_expression) => Expr::CallExpressionKw(call_expression.clone()),
|
||||||
BinaryPart::UnaryExpression(unary_expression) => Expr::UnaryExpression(unary_expression.clone()),
|
BinaryPart::UnaryExpression(unary_expression) => Expr::UnaryExpression(unary_expression.clone()),
|
||||||
BinaryPart::MemberExpression(member_expression) => Expr::MemberExpression(member_expression.clone()),
|
BinaryPart::MemberExpression(member_expression) => Expr::MemberExpression(member_expression.clone()),
|
||||||
|
BinaryPart::ArrayExpression(e) => Expr::ArrayExpression(e.clone()),
|
||||||
|
BinaryPart::ArrayRangeExpression(e) => Expr::ArrayRangeExpression(e.clone()),
|
||||||
|
BinaryPart::ObjectExpression(e) => Expr::ObjectExpression(e.clone()),
|
||||||
BinaryPart::IfExpression(e) => Expr::IfExpression(e.clone()),
|
BinaryPart::IfExpression(e) => Expr::IfExpression(e.clone()),
|
||||||
BinaryPart::AscribedExpression(e) => Expr::AscribedExpression(e.clone()),
|
BinaryPart::AscribedExpression(e) => Expr::AscribedExpression(e.clone()),
|
||||||
}
|
}
|
||||||
@ -1281,6 +1284,9 @@ pub enum BinaryPart {
|
|||||||
CallExpressionKw(BoxNode<CallExpressionKw>),
|
CallExpressionKw(BoxNode<CallExpressionKw>),
|
||||||
UnaryExpression(BoxNode<UnaryExpression>),
|
UnaryExpression(BoxNode<UnaryExpression>),
|
||||||
MemberExpression(BoxNode<MemberExpression>),
|
MemberExpression(BoxNode<MemberExpression>),
|
||||||
|
ArrayExpression(BoxNode<ArrayExpression>),
|
||||||
|
ArrayRangeExpression(BoxNode<ArrayRangeExpression>),
|
||||||
|
ObjectExpression(BoxNode<ObjectExpression>),
|
||||||
IfExpression(BoxNode<IfExpression>),
|
IfExpression(BoxNode<IfExpression>),
|
||||||
AscribedExpression(BoxNode<AscribedExpression>),
|
AscribedExpression(BoxNode<AscribedExpression>),
|
||||||
}
|
}
|
||||||
@ -1307,6 +1313,9 @@ impl BinaryPart {
|
|||||||
BinaryPart::CallExpressionKw(call_expression) => call_expression.get_constraint_level(),
|
BinaryPart::CallExpressionKw(call_expression) => call_expression.get_constraint_level(),
|
||||||
BinaryPart::UnaryExpression(unary_expression) => unary_expression.get_constraint_level(),
|
BinaryPart::UnaryExpression(unary_expression) => unary_expression.get_constraint_level(),
|
||||||
BinaryPart::MemberExpression(member_expression) => member_expression.get_constraint_level(),
|
BinaryPart::MemberExpression(member_expression) => member_expression.get_constraint_level(),
|
||||||
|
BinaryPart::ArrayExpression(e) => e.get_constraint_level(),
|
||||||
|
BinaryPart::ArrayRangeExpression(e) => e.get_constraint_level(),
|
||||||
|
BinaryPart::ObjectExpression(e) => e.get_constraint_level(),
|
||||||
BinaryPart::IfExpression(e) => e.get_constraint_level(),
|
BinaryPart::IfExpression(e) => e.get_constraint_level(),
|
||||||
BinaryPart::AscribedExpression(e) => e.expr.get_constraint_level(),
|
BinaryPart::AscribedExpression(e) => e.expr.get_constraint_level(),
|
||||||
}
|
}
|
||||||
@ -1320,6 +1329,9 @@ impl BinaryPart {
|
|||||||
BinaryPart::CallExpressionKw(call_expression) => call_expression.replace_value(source_range, new_value),
|
BinaryPart::CallExpressionKw(call_expression) => call_expression.replace_value(source_range, new_value),
|
||||||
BinaryPart::UnaryExpression(unary_expression) => unary_expression.replace_value(source_range, new_value),
|
BinaryPart::UnaryExpression(unary_expression) => unary_expression.replace_value(source_range, new_value),
|
||||||
BinaryPart::MemberExpression(_) => {}
|
BinaryPart::MemberExpression(_) => {}
|
||||||
|
BinaryPart::ArrayExpression(e) => e.replace_value(source_range, new_value),
|
||||||
|
BinaryPart::ArrayRangeExpression(e) => e.replace_value(source_range, new_value),
|
||||||
|
BinaryPart::ObjectExpression(e) => e.replace_value(source_range, new_value),
|
||||||
BinaryPart::IfExpression(e) => e.replace_value(source_range, new_value),
|
BinaryPart::IfExpression(e) => e.replace_value(source_range, new_value),
|
||||||
BinaryPart::AscribedExpression(e) => e.expr.replace_value(source_range, new_value),
|
BinaryPart::AscribedExpression(e) => e.expr.replace_value(source_range, new_value),
|
||||||
}
|
}
|
||||||
@ -1333,6 +1345,9 @@ impl BinaryPart {
|
|||||||
BinaryPart::CallExpressionKw(call_expression) => call_expression.start,
|
BinaryPart::CallExpressionKw(call_expression) => call_expression.start,
|
||||||
BinaryPart::UnaryExpression(unary_expression) => unary_expression.start,
|
BinaryPart::UnaryExpression(unary_expression) => unary_expression.start,
|
||||||
BinaryPart::MemberExpression(member_expression) => member_expression.start,
|
BinaryPart::MemberExpression(member_expression) => member_expression.start,
|
||||||
|
BinaryPart::ArrayExpression(e) => e.start,
|
||||||
|
BinaryPart::ArrayRangeExpression(e) => e.start,
|
||||||
|
BinaryPart::ObjectExpression(e) => e.start,
|
||||||
BinaryPart::IfExpression(e) => e.start,
|
BinaryPart::IfExpression(e) => e.start,
|
||||||
BinaryPart::AscribedExpression(e) => e.start,
|
BinaryPart::AscribedExpression(e) => e.start,
|
||||||
}
|
}
|
||||||
@ -1346,6 +1361,9 @@ impl BinaryPart {
|
|||||||
BinaryPart::CallExpressionKw(call_expression) => call_expression.end,
|
BinaryPart::CallExpressionKw(call_expression) => call_expression.end,
|
||||||
BinaryPart::UnaryExpression(unary_expression) => unary_expression.end,
|
BinaryPart::UnaryExpression(unary_expression) => unary_expression.end,
|
||||||
BinaryPart::MemberExpression(member_expression) => member_expression.end,
|
BinaryPart::MemberExpression(member_expression) => member_expression.end,
|
||||||
|
BinaryPart::ArrayExpression(e) => e.end,
|
||||||
|
BinaryPart::ArrayRangeExpression(e) => e.end,
|
||||||
|
BinaryPart::ObjectExpression(e) => e.end,
|
||||||
BinaryPart::IfExpression(e) => e.end,
|
BinaryPart::IfExpression(e) => e.end,
|
||||||
BinaryPart::AscribedExpression(e) => e.end,
|
BinaryPart::AscribedExpression(e) => e.end,
|
||||||
}
|
}
|
||||||
@ -1360,6 +1378,9 @@ impl BinaryPart {
|
|||||||
BinaryPart::CallExpressionKw(call_expression) => call_expression.rename_identifiers(old_name, new_name),
|
BinaryPart::CallExpressionKw(call_expression) => call_expression.rename_identifiers(old_name, new_name),
|
||||||
BinaryPart::UnaryExpression(unary_expression) => unary_expression.rename_identifiers(old_name, new_name),
|
BinaryPart::UnaryExpression(unary_expression) => unary_expression.rename_identifiers(old_name, new_name),
|
||||||
BinaryPart::MemberExpression(member_expression) => member_expression.rename_identifiers(old_name, new_name),
|
BinaryPart::MemberExpression(member_expression) => member_expression.rename_identifiers(old_name, new_name),
|
||||||
|
BinaryPart::ArrayExpression(e) => e.rename_identifiers(old_name, new_name),
|
||||||
|
BinaryPart::ArrayRangeExpression(e) => e.rename_identifiers(old_name, new_name),
|
||||||
|
BinaryPart::ObjectExpression(e) => e.rename_identifiers(old_name, new_name),
|
||||||
BinaryPart::IfExpression(if_expression) => if_expression.rename_identifiers(old_name, new_name),
|
BinaryPart::IfExpression(if_expression) => if_expression.rename_identifiers(old_name, new_name),
|
||||||
BinaryPart::AscribedExpression(e) => e.expr.rename_identifiers(old_name, new_name),
|
BinaryPart::AscribedExpression(e) => e.expr.rename_identifiers(old_name, new_name),
|
||||||
}
|
}
|
||||||
|
@ -624,9 +624,6 @@ fn operand(i: &mut TokenSlice) -> ModalResult<BinaryPart> {
|
|||||||
Expr::FunctionExpression(_)
|
Expr::FunctionExpression(_)
|
||||||
| Expr::PipeExpression(_)
|
| Expr::PipeExpression(_)
|
||||||
| Expr::PipeSubstitution(_)
|
| Expr::PipeSubstitution(_)
|
||||||
| Expr::ArrayExpression(_)
|
|
||||||
| Expr::ArrayRangeExpression(_)
|
|
||||||
| Expr::ObjectExpression(_)
|
|
||||||
| Expr::LabelledExpression(..) => return Err(CompilationError::fatal(source_range, TODO_783)),
|
| Expr::LabelledExpression(..) => return Err(CompilationError::fatal(source_range, TODO_783)),
|
||||||
Expr::None(_) => {
|
Expr::None(_) => {
|
||||||
return Err(CompilationError::fatal(
|
return Err(CompilationError::fatal(
|
||||||
@ -652,6 +649,9 @@ fn operand(i: &mut TokenSlice) -> ModalResult<BinaryPart> {
|
|||||||
Expr::BinaryExpression(x) => BinaryPart::BinaryExpression(x),
|
Expr::BinaryExpression(x) => BinaryPart::BinaryExpression(x),
|
||||||
Expr::CallExpressionKw(x) => BinaryPart::CallExpressionKw(x),
|
Expr::CallExpressionKw(x) => BinaryPart::CallExpressionKw(x),
|
||||||
Expr::MemberExpression(x) => BinaryPart::MemberExpression(x),
|
Expr::MemberExpression(x) => BinaryPart::MemberExpression(x),
|
||||||
|
Expr::ArrayExpression(x) => BinaryPart::ArrayExpression(x),
|
||||||
|
Expr::ArrayRangeExpression(x) => BinaryPart::ArrayRangeExpression(x),
|
||||||
|
Expr::ObjectExpression(x) => BinaryPart::ObjectExpression(x),
|
||||||
Expr::IfExpression(x) => BinaryPart::IfExpression(x),
|
Expr::IfExpression(x) => BinaryPart::IfExpression(x),
|
||||||
Expr::AscribedExpression(x) => BinaryPart::AscribedExpression(x),
|
Expr::AscribedExpression(x) => BinaryPart::AscribedExpression(x),
|
||||||
};
|
};
|
||||||
@ -2115,6 +2115,8 @@ fn possible_operands(i: &mut TokenSlice) -> ModalResult<Expr> {
|
|||||||
literal.map(Expr::Literal),
|
literal.map(Expr::Literal),
|
||||||
fn_call_kw.map(Box::new).map(Expr::CallExpressionKw),
|
fn_call_kw.map(Box::new).map(Expr::CallExpressionKw),
|
||||||
name.map(Box::new).map(Expr::Name),
|
name.map(Box::new).map(Expr::Name),
|
||||||
|
array,
|
||||||
|
object.map(Box::new).map(Expr::ObjectExpression),
|
||||||
binary_expr_in_parens.map(Box::new).map(Expr::BinaryExpression),
|
binary_expr_in_parens.map(Box::new).map(Expr::BinaryExpression),
|
||||||
unnecessarily_bracketed,
|
unnecessarily_bracketed,
|
||||||
))
|
))
|
||||||
@ -3398,6 +3400,27 @@ mod tests {
|
|||||||
operand.parse(tokens).unwrap();
|
operand.parse(tokens).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn parse_binary_operator_on_array() {
|
||||||
|
let tokens = crate::parsing::token::lex("[0] + 1", ModuleId::default()).unwrap();
|
||||||
|
let tokens = tokens.as_slice();
|
||||||
|
binary_expression.parse(tokens).unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn parse_binary_operator_on_object() {
|
||||||
|
let tokens = crate::parsing::token::lex("{ a = 1 } + 2", ModuleId::default()).unwrap();
|
||||||
|
let tokens = tokens.as_slice();
|
||||||
|
binary_expression.parse(tokens).unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn parse_call_array_operator() {
|
||||||
|
let tokens = crate::parsing::token::lex("f([0] + 1)", ModuleId::default()).unwrap();
|
||||||
|
let tokens = tokens.as_slice();
|
||||||
|
fn_call_kw.parse(tokens).unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn weird_program_just_a_pipe() {
|
fn weird_program_just_a_pipe() {
|
||||||
let tokens = crate::parsing::token::lex("|", ModuleId::default()).unwrap();
|
let tokens = crate::parsing::token::lex("|", ModuleId::default()).unwrap();
|
||||||
|
@ -779,6 +779,27 @@ mod add_lots {
|
|||||||
super::execute(TEST_NAME, false).await
|
super::execute(TEST_NAME, false).await
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mod add_arrays {
|
||||||
|
const TEST_NAME: &str = "add_arrays";
|
||||||
|
|
||||||
|
/// Test parsing KCL.
|
||||||
|
#[test]
|
||||||
|
fn parse() {
|
||||||
|
super::parse(TEST_NAME)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Test that parsing and unparsing KCL produces the original KCL input.
|
||||||
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
|
async fn unparse() {
|
||||||
|
super::unparse(TEST_NAME).await
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Test that KCL is executed correctly.
|
||||||
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
|
async fn kcl_test_execute() {
|
||||||
|
super::execute(TEST_NAME, false).await
|
||||||
|
}
|
||||||
|
}
|
||||||
mod argument_error {
|
mod argument_error {
|
||||||
//! The argument error points to the problematic argument in the call site,
|
//! The argument error points to the problematic argument in the call site,
|
||||||
//! not the function definition that the variable points to.
|
//! not the function definition that the variable points to.
|
||||||
@ -887,6 +908,27 @@ mod invalid_index_fractional {
|
|||||||
super::execute(TEST_NAME, false).await
|
super::execute(TEST_NAME, false).await
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mod property_access_not_found_on_solid {
|
||||||
|
const TEST_NAME: &str = "property_access_not_found_on_solid";
|
||||||
|
|
||||||
|
/// Test parsing KCL.
|
||||||
|
#[test]
|
||||||
|
fn parse() {
|
||||||
|
super::parse(TEST_NAME)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Test that parsing and unparsing KCL produces the original KCL input.
|
||||||
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
|
async fn unparse() {
|
||||||
|
super::unparse(TEST_NAME).await
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Test that KCL is executed correctly.
|
||||||
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
|
async fn kcl_test_execute() {
|
||||||
|
super::execute(TEST_NAME, true).await
|
||||||
|
}
|
||||||
|
}
|
||||||
mod invalid_member_object {
|
mod invalid_member_object {
|
||||||
const TEST_NAME: &str = "invalid_member_object";
|
const TEST_NAME: &str = "invalid_member_object";
|
||||||
|
|
||||||
@ -3632,3 +3674,66 @@ mod non_english_identifiers {
|
|||||||
super::execute(TEST_NAME, true).await
|
super::execute(TEST_NAME, true).await
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mod rect {
|
||||||
|
const TEST_NAME: &str = "rect";
|
||||||
|
|
||||||
|
/// Test parsing KCL.
|
||||||
|
#[test]
|
||||||
|
fn parse() {
|
||||||
|
super::parse(TEST_NAME)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Test that parsing and unparsing KCL produces the original KCL input.
|
||||||
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
|
async fn unparse() {
|
||||||
|
super::unparse(TEST_NAME).await
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Test that KCL is executed correctly.
|
||||||
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
|
async fn kcl_test_execute() {
|
||||||
|
super::execute(TEST_NAME, true).await
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mod rect_helper {
|
||||||
|
const TEST_NAME: &str = "rect_helper";
|
||||||
|
|
||||||
|
/// Test parsing KCL.
|
||||||
|
#[test]
|
||||||
|
fn parse() {
|
||||||
|
super::parse(TEST_NAME)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Test that parsing and unparsing KCL produces the original KCL input.
|
||||||
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
|
async fn unparse() {
|
||||||
|
super::unparse(TEST_NAME).await
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Test that KCL is executed correctly.
|
||||||
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
|
async fn kcl_test_execute() {
|
||||||
|
super::execute(TEST_NAME, true).await
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mod plane_of {
|
||||||
|
const TEST_NAME: &str = "plane_of";
|
||||||
|
|
||||||
|
/// Test parsing KCL.
|
||||||
|
#[test]
|
||||||
|
fn parse() {
|
||||||
|
super::parse(TEST_NAME)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Test that parsing and unparsing KCL produces the original KCL input.
|
||||||
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
|
async fn unparse() {
|
||||||
|
super::unparse(TEST_NAME).await
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Test that KCL is executed correctly.
|
||||||
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
|
async fn kcl_test_execute() {
|
||||||
|
super::execute(TEST_NAME, true).await
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -340,12 +340,12 @@ impl Args {
|
|||||||
let x = KclValue::Number {
|
let x = KclValue::Number {
|
||||||
value: p[0],
|
value: p[0],
|
||||||
meta: vec![meta],
|
meta: vec![meta],
|
||||||
ty: ty.clone(),
|
ty,
|
||||||
};
|
};
|
||||||
let y = KclValue::Number {
|
let y = KclValue::Number {
|
||||||
value: p[1],
|
value: p[1],
|
||||||
meta: vec![meta],
|
meta: vec![meta],
|
||||||
ty: ty.clone(),
|
ty,
|
||||||
};
|
};
|
||||||
let ty = RuntimeType::Primitive(PrimitiveType::Number(ty));
|
let ty = RuntimeType::Primitive(PrimitiveType::Number(ty));
|
||||||
|
|
||||||
@ -1038,7 +1038,7 @@ impl<'a> FromKclValue<'a> for u64 {
|
|||||||
impl<'a> FromKclValue<'a> for TyF64 {
|
impl<'a> FromKclValue<'a> for TyF64 {
|
||||||
fn from_kcl_val(arg: &'a KclValue) -> Option<Self> {
|
fn from_kcl_val(arg: &'a KclValue) -> Option<Self> {
|
||||||
match arg {
|
match arg {
|
||||||
KclValue::Number { value, ty, .. } => Some(TyF64::new(*value, ty.clone())),
|
KclValue::Number { value, ty, .. } => Some(TyF64::new(*value, *ty)),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1079,6 +1079,34 @@ impl<'a> FromKclValue<'a> for [TyF64; 3] {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'a> FromKclValue<'a> for [TyF64; 6] {
|
||||||
|
fn from_kcl_val(arg: &'a KclValue) -> Option<Self> {
|
||||||
|
match arg {
|
||||||
|
KclValue::Tuple { value, meta: _ } | KclValue::HomArray { value, .. } => {
|
||||||
|
if value.len() != 6 {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
let v0 = value.first()?;
|
||||||
|
let v1 = value.get(1)?;
|
||||||
|
let v2 = value.get(2)?;
|
||||||
|
let v3 = value.get(3)?;
|
||||||
|
let v4 = value.get(4)?;
|
||||||
|
let v5 = value.get(5)?;
|
||||||
|
let array = [
|
||||||
|
v0.as_ty_f64()?,
|
||||||
|
v1.as_ty_f64()?,
|
||||||
|
v2.as_ty_f64()?,
|
||||||
|
v3.as_ty_f64()?,
|
||||||
|
v4.as_ty_f64()?,
|
||||||
|
v5.as_ty_f64()?,
|
||||||
|
];
|
||||||
|
Some(array)
|
||||||
|
}
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<'a> FromKclValue<'a> for Sketch {
|
impl<'a> FromKclValue<'a> for Sketch {
|
||||||
fn from_kcl_val(arg: &'a KclValue) -> Option<Self> {
|
fn from_kcl_val(arg: &'a KclValue) -> Option<Self> {
|
||||||
let KclValue::Sketch { value } = arg else {
|
let KclValue::Sketch { value } = arg else {
|
||||||
|
@ -251,6 +251,9 @@ pub(crate) async fn do_post_extrude<'a>(
|
|||||||
Path::Arc { .. }
|
Path::Arc { .. }
|
||||||
| Path::TangentialArc { .. }
|
| Path::TangentialArc { .. }
|
||||||
| Path::TangentialArcTo { .. }
|
| Path::TangentialArcTo { .. }
|
||||||
|
// TODO: (bc) fix me
|
||||||
|
| Path::Ellipse { .. }
|
||||||
|
| Path::Conic {.. }
|
||||||
| Path::Circle { .. }
|
| Path::Circle { .. }
|
||||||
| Path::CircleThreePoint { .. } => {
|
| Path::CircleThreePoint { .. } => {
|
||||||
let extrude_surface = ExtrudeSurface::ExtrudeArc(crate::execution::ExtrudeArc {
|
let extrude_surface = ExtrudeSurface::ExtrudeArc(crate::execution::ExtrudeArc {
|
||||||
|
@ -156,6 +156,14 @@ pub(crate) fn std_fn(path: &str, fn_name: &str) -> (crate::std::StdFn, StdFnProp
|
|||||||
|e, a| Box::pin(crate::std::math::leg_angle_y(e, a)),
|
|e, a| Box::pin(crate::std::math::leg_angle_y(e, a)),
|
||||||
StdFnProps::default("std::math::legAngY"),
|
StdFnProps::default("std::math::legAngY"),
|
||||||
),
|
),
|
||||||
|
("sketch", "circle") => (
|
||||||
|
|e, a| Box::pin(crate::std::shapes::circle(e, a)),
|
||||||
|
StdFnProps::default("std::sketch::circle"),
|
||||||
|
),
|
||||||
|
("sketch", "ellipse") => (
|
||||||
|
|e, a| Box::pin(crate::std::shapes::ellipse(e, a)),
|
||||||
|
StdFnProps::default("std::sketch::ellipse").include_in_feature_tree(),
|
||||||
|
),
|
||||||
("prelude", "helix") => (
|
("prelude", "helix") => (
|
||||||
|e, a| Box::pin(crate::std::helix::helix(e, a)),
|
|e, a| Box::pin(crate::std::helix::helix(e, a)),
|
||||||
StdFnProps::default("std::helix").include_in_feature_tree(),
|
StdFnProps::default("std::helix").include_in_feature_tree(),
|
||||||
@ -252,9 +260,41 @@ pub(crate) fn std_fn(path: &str, fn_name: &str) -> (crate::std::StdFn, StdFnProp
|
|||||||
|e, a| Box::pin(crate::std::clone::clone(e, a)),
|
|e, a| Box::pin(crate::std::clone::clone(e, a)),
|
||||||
StdFnProps::default("std::clone").include_in_feature_tree(),
|
StdFnProps::default("std::clone").include_in_feature_tree(),
|
||||||
),
|
),
|
||||||
("sketch", "circle") => (
|
("sketch", "conic") => (
|
||||||
|e, a| Box::pin(crate::std::shapes::circle(e, a)),
|
|e, a| Box::pin(crate::std::sketch::conic(e, a)),
|
||||||
StdFnProps::default("std::sketch::circle"),
|
StdFnProps::default("std::sketch::conic").include_in_feature_tree(),
|
||||||
|
),
|
||||||
|
("sketch", "parabolic") => (
|
||||||
|
|e, a| Box::pin(crate::std::sketch::parabolic(e, a)),
|
||||||
|
StdFnProps::default("std::sketch::parabolic").include_in_feature_tree(),
|
||||||
|
),
|
||||||
|
("sketch", "parabolicPoint") => (
|
||||||
|
|e, a| Box::pin(crate::std::sketch::parabolic_point(e, a)),
|
||||||
|
StdFnProps::default("std::sketch::parabolicPoint"),
|
||||||
|
),
|
||||||
|
("sketch", "hyperbolic") => (
|
||||||
|
|e, a| Box::pin(crate::std::sketch::hyperbolic(e, a)),
|
||||||
|
StdFnProps::default("std::sketch::hyperbolic").include_in_feature_tree(),
|
||||||
|
),
|
||||||
|
("sketch", "hyperbolicPoint") => (
|
||||||
|
|e, a| Box::pin(crate::std::sketch::hyperbolic_point(e, a)),
|
||||||
|
StdFnProps::default("std::sketch::hyperbolicPoint"),
|
||||||
|
),
|
||||||
|
("sketch", "elliptic") => (
|
||||||
|
|e, a| Box::pin(crate::std::sketch::elliptic(e, a)),
|
||||||
|
StdFnProps::default("std::sketch::elliptic").include_in_feature_tree(),
|
||||||
|
),
|
||||||
|
("sketch", "ellipticPoint") => (
|
||||||
|
|e, a| Box::pin(crate::std::sketch::elliptic_point(e, a)),
|
||||||
|
StdFnProps::default("std::sketch::ellipticPoint"),
|
||||||
|
),
|
||||||
|
("sketch", "rectangle") => (
|
||||||
|
|e, a| Box::pin(crate::std::shapes::rectangle(e, a)),
|
||||||
|
StdFnProps::default("std::sketch::rectangle"),
|
||||||
|
),
|
||||||
|
("sketch", "planeOf") => (
|
||||||
|
|e, a| Box::pin(crate::std::planes::plane_of(e, a)),
|
||||||
|
StdFnProps::default("std::sketch::planeOf"),
|
||||||
),
|
),
|
||||||
("sketch", "extrude") => (
|
("sketch", "extrude") => (
|
||||||
|e, a| Box::pin(crate::std::extrude::extrude(e, a)),
|
|e, a| Box::pin(crate::std::extrude::extrude(e, a)),
|
||||||
|
@ -408,7 +408,7 @@ impl GeometryTrait for Sketch {
|
|||||||
exec_state: &mut ExecState,
|
exec_state: &mut ExecState,
|
||||||
) -> Result<[TyF64; 3], KclError> {
|
) -> Result<[TyF64; 3], KclError> {
|
||||||
let [x, y] = array_to_point2d(val, source_ranges, exec_state)?;
|
let [x, y] = array_to_point2d(val, source_ranges, exec_state)?;
|
||||||
let ty = x.ty.clone();
|
let ty = x.ty;
|
||||||
Ok([x, y, TyF64::new(0.0, ty)])
|
Ok([x, y, TyF64::new(0.0, ty)])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,15 +1,123 @@
|
|||||||
//! Standard library plane helpers.
|
//! Standard library plane helpers.
|
||||||
|
|
||||||
use kcmc::{ModelingCmd, each_cmd as mcmd, length_unit::LengthUnit, shared::Color};
|
use kcmc::{ModelingCmd, each_cmd as mcmd, length_unit::LengthUnit, shared::Color};
|
||||||
use kittycad_modeling_cmds as kcmc;
|
use kittycad_modeling_cmds::{self as kcmc, ok_response::OkModelingCmdResponse, websocket::OkWebSocketResponseData};
|
||||||
|
|
||||||
use super::{args::TyF64, sketch::PlaneData};
|
use super::{
|
||||||
|
args::TyF64,
|
||||||
|
sketch::{FaceTag, PlaneData},
|
||||||
|
};
|
||||||
use crate::{
|
use crate::{
|
||||||
errors::KclError,
|
UnitLen,
|
||||||
execution::{ExecState, KclValue, ModelingCmdMeta, Plane, PlaneType, types::RuntimeType},
|
errors::{KclError, KclErrorDetails},
|
||||||
|
execution::{ExecState, KclValue, Metadata, ModelingCmdMeta, Plane, PlaneType, types::RuntimeType},
|
||||||
std::Args,
|
std::Args,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Find the plane of a given face.
|
||||||
|
pub async fn plane_of(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||||
|
let solid = args.get_unlabeled_kw_arg("solid", &RuntimeType::solid(), exec_state)?;
|
||||||
|
let face = args.get_kw_arg("face", &RuntimeType::tagged_face(), exec_state)?;
|
||||||
|
|
||||||
|
inner_plane_of(solid, face, exec_state, &args)
|
||||||
|
.await
|
||||||
|
.map(Box::new)
|
||||||
|
.map(|value| KclValue::Plane { value })
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn inner_plane_of(
|
||||||
|
solid: crate::execution::Solid,
|
||||||
|
face: FaceTag,
|
||||||
|
exec_state: &mut ExecState,
|
||||||
|
args: &Args,
|
||||||
|
) -> Result<Plane, KclError> {
|
||||||
|
// Support mock execution
|
||||||
|
// Return an arbitrary (incorrect) plane and a non-fatal error.
|
||||||
|
if args.ctx.no_engine_commands().await {
|
||||||
|
let plane_id = exec_state.id_generator().next_uuid();
|
||||||
|
exec_state.err(crate::CompilationError {
|
||||||
|
source_range: args.source_range,
|
||||||
|
message: "The engine isn't available, so returning an arbitrary incorrect plane".to_owned(),
|
||||||
|
suggestion: None,
|
||||||
|
severity: crate::errors::Severity::Error,
|
||||||
|
tag: crate::errors::Tag::None,
|
||||||
|
});
|
||||||
|
return Ok(Plane {
|
||||||
|
artifact_id: plane_id.into(),
|
||||||
|
id: plane_id,
|
||||||
|
// Engine doesn't know about the ID we created, so set this to Uninit.
|
||||||
|
value: PlaneType::Uninit,
|
||||||
|
info: crate::execution::PlaneInfo {
|
||||||
|
origin: Default::default(),
|
||||||
|
x_axis: Default::default(),
|
||||||
|
y_axis: Default::default(),
|
||||||
|
},
|
||||||
|
meta: vec![Metadata {
|
||||||
|
source_range: args.source_range,
|
||||||
|
}],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Query the engine to learn what plane, if any, this face is on.
|
||||||
|
let face_id = face.get_face_id(&solid, exec_state, args, true).await?;
|
||||||
|
let meta = args.into();
|
||||||
|
let cmd = ModelingCmd::FaceIsPlanar(mcmd::FaceIsPlanar { object_id: face_id });
|
||||||
|
let plane_resp = exec_state.send_modeling_cmd(meta, cmd).await?;
|
||||||
|
let OkWebSocketResponseData::Modeling {
|
||||||
|
modeling_response: OkModelingCmdResponse::FaceIsPlanar(planar),
|
||||||
|
} = plane_resp
|
||||||
|
else {
|
||||||
|
return Err(KclError::new_semantic(KclErrorDetails::new(
|
||||||
|
format!(
|
||||||
|
"Engine returned invalid response, it should have returned FaceIsPlanar but it returned {plane_resp:#?}"
|
||||||
|
),
|
||||||
|
vec![args.source_range],
|
||||||
|
)));
|
||||||
|
};
|
||||||
|
// Destructure engine's response to check if the face was on a plane.
|
||||||
|
let not_planar: Result<_, KclError> = Err(KclError::new_semantic(KclErrorDetails::new(
|
||||||
|
"The face you provided doesn't lie on any plane. It might be curved.".to_owned(),
|
||||||
|
vec![args.source_range],
|
||||||
|
)));
|
||||||
|
let Some(x_axis) = planar.x_axis else { return not_planar };
|
||||||
|
let Some(y_axis) = planar.y_axis else { return not_planar };
|
||||||
|
let Some(origin) = planar.origin else { return not_planar };
|
||||||
|
|
||||||
|
// Engine always returns measurements in mm.
|
||||||
|
let engine_units = UnitLen::Mm;
|
||||||
|
let x_axis = crate::execution::Point3d {
|
||||||
|
x: x_axis.x,
|
||||||
|
y: x_axis.y,
|
||||||
|
z: x_axis.z,
|
||||||
|
units: engine_units,
|
||||||
|
};
|
||||||
|
let y_axis = crate::execution::Point3d {
|
||||||
|
x: y_axis.x,
|
||||||
|
y: y_axis.y,
|
||||||
|
z: y_axis.z,
|
||||||
|
units: engine_units,
|
||||||
|
};
|
||||||
|
let origin = crate::execution::Point3d {
|
||||||
|
x: origin.x.0,
|
||||||
|
y: origin.y.0,
|
||||||
|
z: origin.z.0,
|
||||||
|
units: engine_units,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Engine doesn't send back an ID, so let's just make a new plane ID.
|
||||||
|
let plane_id = exec_state.id_generator().next_uuid();
|
||||||
|
Ok(Plane {
|
||||||
|
artifact_id: plane_id.into(),
|
||||||
|
id: plane_id,
|
||||||
|
// Engine doesn't know about the ID we created, so set this to Uninit.
|
||||||
|
value: PlaneType::Uninit,
|
||||||
|
info: crate::execution::PlaneInfo { origin, x_axis, y_axis },
|
||||||
|
meta: vec![Metadata {
|
||||||
|
source_range: args.source_range,
|
||||||
|
}],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/// Offset a plane by a distance along its normal.
|
/// Offset a plane by a distance along its normal.
|
||||||
pub async fn offset_plane(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
pub async fn offset_plane(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||||
let std_plane = args.get_unlabeled_kw_arg("plane", &RuntimeType::plane(), exec_state)?;
|
let std_plane = args.get_unlabeled_kw_arg("plane", &RuntimeType::plane(), exec_state)?;
|
||||||
|
@ -18,7 +18,7 @@ pub async fn segment_end(exec_state: &mut ExecState, args: Args) -> Result<KclVa
|
|||||||
let tag: TagIdentifier = args.get_unlabeled_kw_arg("tag", &RuntimeType::tagged_edge(), exec_state)?;
|
let tag: TagIdentifier = args.get_unlabeled_kw_arg("tag", &RuntimeType::tagged_edge(), exec_state)?;
|
||||||
let pt = inner_segment_end(&tag, exec_state, args.clone())?;
|
let pt = inner_segment_end(&tag, exec_state, args.clone())?;
|
||||||
|
|
||||||
args.make_kcl_val_from_point([pt[0].n, pt[1].n], pt[0].ty.clone())
|
args.make_kcl_val_from_point([pt[0].n, pt[1].n], pt[0].ty)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn inner_segment_end(tag: &TagIdentifier, exec_state: &mut ExecState, args: Args) -> Result<[TyF64; 2], KclError> {
|
fn inner_segment_end(tag: &TagIdentifier, exec_state: &mut ExecState, args: Args) -> Result<[TyF64; 2], KclError> {
|
||||||
@ -31,7 +31,7 @@ fn inner_segment_end(tag: &TagIdentifier, exec_state: &mut ExecState, args: Args
|
|||||||
})?;
|
})?;
|
||||||
let (p, ty) = path.end_point_components();
|
let (p, ty) = path.end_point_components();
|
||||||
// Docs generation isn't smart enough to handle ([f64; 2], NumericType).
|
// Docs generation isn't smart enough to handle ([f64; 2], NumericType).
|
||||||
let point = [TyF64::new(p[0], ty.clone()), TyF64::new(p[1], ty)];
|
let point = [TyF64::new(p[0], ty), TyF64::new(p[1], ty)];
|
||||||
|
|
||||||
Ok(point)
|
Ok(point)
|
||||||
}
|
}
|
||||||
@ -81,7 +81,7 @@ pub async fn segment_start(exec_state: &mut ExecState, args: Args) -> Result<Kcl
|
|||||||
let tag: TagIdentifier = args.get_unlabeled_kw_arg("tag", &RuntimeType::tagged_edge(), exec_state)?;
|
let tag: TagIdentifier = args.get_unlabeled_kw_arg("tag", &RuntimeType::tagged_edge(), exec_state)?;
|
||||||
let pt = inner_segment_start(&tag, exec_state, args.clone())?;
|
let pt = inner_segment_start(&tag, exec_state, args.clone())?;
|
||||||
|
|
||||||
args.make_kcl_val_from_point([pt[0].n, pt[1].n], pt[0].ty.clone())
|
args.make_kcl_val_from_point([pt[0].n, pt[1].n], pt[0].ty)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn inner_segment_start(tag: &TagIdentifier, exec_state: &mut ExecState, args: Args) -> Result<[TyF64; 2], KclError> {
|
fn inner_segment_start(tag: &TagIdentifier, exec_state: &mut ExecState, args: Args) -> Result<[TyF64; 2], KclError> {
|
||||||
@ -94,7 +94,7 @@ fn inner_segment_start(tag: &TagIdentifier, exec_state: &mut ExecState, args: Ar
|
|||||||
})?;
|
})?;
|
||||||
let (p, ty) = path.start_point_components();
|
let (p, ty) = path.start_point_components();
|
||||||
// Docs generation isn't smart enough to handle ([f64; 2], NumericType).
|
// Docs generation isn't smart enough to handle ([f64; 2], NumericType).
|
||||||
let point = [TyF64::new(p[0], ty.clone()), TyF64::new(p[1], ty)];
|
let point = [TyF64::new(p[0], ty), TyF64::new(p[1], ty)];
|
||||||
|
|
||||||
Ok(point)
|
Ok(point)
|
||||||
}
|
}
|
||||||
@ -200,7 +200,12 @@ fn inner_segment_length(tag: &TagIdentifier, exec_state: &mut ExecState, args: A
|
|||||||
))
|
))
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
Ok(path.length())
|
path.length().ok_or_else(|| {
|
||||||
|
KclError::new_semantic(KclErrorDetails::new(
|
||||||
|
"Computing the length of this segment type is unsupported".to_owned(),
|
||||||
|
vec![args.source_range],
|
||||||
|
))
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the angle of the segment.
|
/// Returns the angle of the segment.
|
||||||
|
@ -38,6 +38,119 @@ pub enum SketchOrSurface {
|
|||||||
Sketch(Box<Sketch>),
|
Sketch(Box<Sketch>),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Sketch a rectangle.
|
||||||
|
pub async fn rectangle(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||||
|
let sketch_or_surface =
|
||||||
|
args.get_unlabeled_kw_arg("sketchOrSurface", &RuntimeType::sketch_or_surface(), exec_state)?;
|
||||||
|
let center = args.get_kw_arg_opt("center", &RuntimeType::point2d(), exec_state)?;
|
||||||
|
let corner = args.get_kw_arg_opt("corner", &RuntimeType::point2d(), exec_state)?;
|
||||||
|
let width: TyF64 = args.get_kw_arg("width", &RuntimeType::length(), exec_state)?;
|
||||||
|
let height: TyF64 = args.get_kw_arg("height", &RuntimeType::length(), exec_state)?;
|
||||||
|
|
||||||
|
inner_rectangle(sketch_or_surface, center, corner, width, height, exec_state, args)
|
||||||
|
.await
|
||||||
|
.map(Box::new)
|
||||||
|
.map(|value| KclValue::Sketch { value })
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn inner_rectangle(
|
||||||
|
sketch_or_surface: SketchOrSurface,
|
||||||
|
center: Option<[TyF64; 2]>,
|
||||||
|
corner: Option<[TyF64; 2]>,
|
||||||
|
width: TyF64,
|
||||||
|
height: TyF64,
|
||||||
|
exec_state: &mut ExecState,
|
||||||
|
args: Args,
|
||||||
|
) -> Result<Sketch, KclError> {
|
||||||
|
let sketch_surface = match sketch_or_surface {
|
||||||
|
SketchOrSurface::SketchSurface(surface) => surface,
|
||||||
|
SketchOrSurface::Sketch(s) => s.on,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Find the corner in the negative quadrant
|
||||||
|
let (ty, corner) = match (center, corner) {
|
||||||
|
(Some(center), None) => (
|
||||||
|
center[0].ty,
|
||||||
|
[center[0].n - width.n / 2.0, center[1].n - height.n / 2.0],
|
||||||
|
),
|
||||||
|
(None, Some(corner)) => (corner[0].ty, [corner[0].n, corner[1].n]),
|
||||||
|
(None, None) => {
|
||||||
|
return Err(KclError::new_semantic(KclErrorDetails::new(
|
||||||
|
"You must supply either `corner` or `center` arguments, but not both".to_string(),
|
||||||
|
vec![args.source_range],
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
(Some(_), Some(_)) => {
|
||||||
|
return Err(KclError::new_semantic(KclErrorDetails::new(
|
||||||
|
"You must supply either `corner` or `center` arguments, but not both".to_string(),
|
||||||
|
vec![args.source_range],
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
let units = ty.expect_length();
|
||||||
|
let corner_t = [TyF64::new(corner[0], ty), TyF64::new(corner[1], ty)];
|
||||||
|
|
||||||
|
// Start the sketch then draw the 4 lines.
|
||||||
|
let sketch =
|
||||||
|
crate::std::sketch::inner_start_profile(sketch_surface, corner_t, None, exec_state, args.clone()).await?;
|
||||||
|
let sketch_id = sketch.id;
|
||||||
|
let deltas = [[width.n, 0.0], [0.0, height.n], [-width.n, 0.0], [0.0, -height.n]];
|
||||||
|
let ids = [
|
||||||
|
exec_state.next_uuid(),
|
||||||
|
exec_state.next_uuid(),
|
||||||
|
exec_state.next_uuid(),
|
||||||
|
exec_state.next_uuid(),
|
||||||
|
];
|
||||||
|
for (id, delta) in ids.iter().copied().zip(deltas) {
|
||||||
|
exec_state
|
||||||
|
.batch_modeling_cmd(
|
||||||
|
ModelingCmdMeta::from_args_id(&args, id),
|
||||||
|
ModelingCmd::from(mcmd::ExtendPath {
|
||||||
|
path: sketch.id.into(),
|
||||||
|
segment: PathSegment::Line {
|
||||||
|
end: KPoint2d::from(untyped_point_to_mm(delta, units))
|
||||||
|
.with_z(0.0)
|
||||||
|
.map(LengthUnit),
|
||||||
|
relative: true,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
}
|
||||||
|
exec_state
|
||||||
|
.batch_modeling_cmd(
|
||||||
|
ModelingCmdMeta::from_args_id(&args, sketch_id),
|
||||||
|
ModelingCmd::from(mcmd::ClosePath { path_id: sketch.id }),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
// Update the sketch in KCL memory.
|
||||||
|
let mut new_sketch = sketch.clone();
|
||||||
|
fn add(a: [f64; 2], b: [f64; 2]) -> [f64; 2] {
|
||||||
|
[a[0] + b[0], a[1] + b[1]]
|
||||||
|
}
|
||||||
|
let a = (corner, add(corner, deltas[0]));
|
||||||
|
let b = (a.1, add(a.1, deltas[1]));
|
||||||
|
let c = (b.1, add(b.1, deltas[2]));
|
||||||
|
let d = (c.1, add(c.1, deltas[3]));
|
||||||
|
for (id, (from, to)) in ids.into_iter().zip([a, b, c, d]) {
|
||||||
|
let current_path = Path::ToPoint {
|
||||||
|
base: BasePath {
|
||||||
|
from,
|
||||||
|
to,
|
||||||
|
tag: None,
|
||||||
|
units,
|
||||||
|
geo_meta: GeoMeta {
|
||||||
|
id,
|
||||||
|
metadata: args.source_range.into(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
new_sketch.paths.push(current_path);
|
||||||
|
}
|
||||||
|
Ok(new_sketch)
|
||||||
|
}
|
||||||
|
|
||||||
/// Sketch a circle.
|
/// Sketch a circle.
|
||||||
pub async fn circle(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
pub async fn circle(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||||
let sketch_or_surface =
|
let sketch_or_surface =
|
||||||
@ -71,7 +184,7 @@ async fn inner_circle(
|
|||||||
|
|
||||||
let radius = get_radius(radius, diameter, args.source_range)?;
|
let radius = get_radius(radius, diameter, args.source_range)?;
|
||||||
let from = [center_u[0] + radius.to_length_units(units), center_u[1]];
|
let from = [center_u[0] + radius.to_length_units(units), center_u[1]];
|
||||||
let from_t = [TyF64::new(from[0], ty.clone()), TyF64::new(from[1], ty)];
|
let from_t = [TyF64::new(from[0], ty), TyF64::new(from[1], ty)];
|
||||||
|
|
||||||
let sketch =
|
let sketch =
|
||||||
crate::std::sketch::inner_start_profile(sketch_surface, from_t, None, exec_state, args.clone()).await?;
|
crate::std::sketch::inner_start_profile(sketch_surface, from_t, None, exec_state, args.clone()).await?;
|
||||||
@ -156,7 +269,7 @@ async fn inner_circle_three_point(
|
|||||||
exec_state: &mut ExecState,
|
exec_state: &mut ExecState,
|
||||||
args: Args,
|
args: Args,
|
||||||
) -> Result<Sketch, KclError> {
|
) -> Result<Sketch, KclError> {
|
||||||
let ty = p1[0].ty.clone();
|
let ty = p1[0].ty;
|
||||||
let units = ty.expect_length();
|
let units = ty.expect_length();
|
||||||
|
|
||||||
let p1 = point_to_len_unit(p1, units);
|
let p1 = point_to_len_unit(p1, units);
|
||||||
@ -172,10 +285,7 @@ async fn inner_circle_three_point(
|
|||||||
SketchOrSurface::Sketch(group) => group.on,
|
SketchOrSurface::Sketch(group) => group.on,
|
||||||
};
|
};
|
||||||
|
|
||||||
let from = [
|
let from = [TyF64::new(center[0] + radius, ty), TyF64::new(center[1], ty)];
|
||||||
TyF64::new(center[0] + radius, ty.clone()),
|
|
||||||
TyF64::new(center[1], ty.clone()),
|
|
||||||
];
|
|
||||||
let sketch =
|
let sketch =
|
||||||
crate::std::sketch::inner_start_profile(sketch_surface, from.clone(), None, exec_state, args.clone()).await?;
|
crate::std::sketch::inner_start_profile(sketch_surface, from.clone(), None, exec_state, args.clone()).await?;
|
||||||
|
|
||||||
@ -410,6 +520,114 @@ async fn inner_polygon(
|
|||||||
Ok(sketch)
|
Ok(sketch)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Sketch an ellipse.
|
||||||
|
pub async fn ellipse(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||||
|
exec_state.warn(crate::CompilationError {
|
||||||
|
source_range: args.source_range,
|
||||||
|
message: "Use of ellipse is currently experimental and the interface may change.".to_string(),
|
||||||
|
suggestion: None,
|
||||||
|
severity: crate::errors::Severity::Warning,
|
||||||
|
tag: crate::errors::Tag::None,
|
||||||
|
});
|
||||||
|
let sketch_or_surface =
|
||||||
|
args.get_unlabeled_kw_arg("sketchOrSurface", &RuntimeType::sketch_or_surface(), exec_state)?;
|
||||||
|
let center = args.get_kw_arg("center", &RuntimeType::point2d(), exec_state)?;
|
||||||
|
let major_radius = args.get_kw_arg("majorRadius", &RuntimeType::length(), exec_state)?;
|
||||||
|
let minor_radius = args.get_kw_arg("minorRadius", &RuntimeType::length(), exec_state)?;
|
||||||
|
let tag = args.get_kw_arg_opt("tag", &RuntimeType::tag_decl(), exec_state)?;
|
||||||
|
|
||||||
|
let sketch = inner_ellipse(
|
||||||
|
sketch_or_surface,
|
||||||
|
center,
|
||||||
|
major_radius,
|
||||||
|
minor_radius,
|
||||||
|
tag,
|
||||||
|
exec_state,
|
||||||
|
args,
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
Ok(KclValue::Sketch {
|
||||||
|
value: Box::new(sketch),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn inner_ellipse(
|
||||||
|
sketch_surface_or_group: SketchOrSurface,
|
||||||
|
center: [TyF64; 2],
|
||||||
|
major_radius: TyF64,
|
||||||
|
minor_radius: TyF64,
|
||||||
|
tag: Option<TagNode>,
|
||||||
|
exec_state: &mut ExecState,
|
||||||
|
args: Args,
|
||||||
|
) -> Result<Sketch, KclError> {
|
||||||
|
let sketch_surface = match sketch_surface_or_group {
|
||||||
|
SketchOrSurface::SketchSurface(surface) => surface,
|
||||||
|
SketchOrSurface::Sketch(group) => group.on,
|
||||||
|
};
|
||||||
|
let (center_u, ty) = untype_point(center.clone());
|
||||||
|
let units = ty.expect_length();
|
||||||
|
|
||||||
|
let from = [center_u[0] + major_radius.to_length_units(units), center_u[1]];
|
||||||
|
let from_t = [TyF64::new(from[0], ty), TyF64::new(from[1], ty)];
|
||||||
|
|
||||||
|
let sketch =
|
||||||
|
crate::std::sketch::inner_start_profile(sketch_surface, from_t, None, exec_state, args.clone()).await?;
|
||||||
|
|
||||||
|
let angle_start = Angle::zero();
|
||||||
|
let angle_end = Angle::turn();
|
||||||
|
|
||||||
|
let id = exec_state.next_uuid();
|
||||||
|
|
||||||
|
exec_state
|
||||||
|
.batch_modeling_cmd(
|
||||||
|
ModelingCmdMeta::from_args_id(&args, id),
|
||||||
|
ModelingCmd::from(mcmd::ExtendPath {
|
||||||
|
path: sketch.id.into(),
|
||||||
|
segment: PathSegment::Ellipse {
|
||||||
|
center: KPoint2d::from(point_to_mm(center)).map(LengthUnit),
|
||||||
|
major_radius: LengthUnit(major_radius.to_mm()),
|
||||||
|
minor_radius: LengthUnit(minor_radius.to_mm()),
|
||||||
|
start_angle: Angle::from_degrees(angle_start.to_degrees()),
|
||||||
|
end_angle: Angle::from_degrees(angle_end.to_degrees()),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
let current_path = Path::Ellipse {
|
||||||
|
base: BasePath {
|
||||||
|
from,
|
||||||
|
to: from,
|
||||||
|
tag: tag.clone(),
|
||||||
|
units,
|
||||||
|
geo_meta: GeoMeta {
|
||||||
|
id,
|
||||||
|
metadata: args.source_range.into(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
major_radius: major_radius.to_length_units(units),
|
||||||
|
minor_radius: minor_radius.to_length_units(units),
|
||||||
|
center: center_u,
|
||||||
|
ccw: angle_start < angle_end,
|
||||||
|
};
|
||||||
|
|
||||||
|
let mut new_sketch = sketch.clone();
|
||||||
|
if let Some(tag) = &tag {
|
||||||
|
new_sketch.add_tag(tag, ¤t_path, exec_state);
|
||||||
|
}
|
||||||
|
|
||||||
|
new_sketch.paths.push(current_path);
|
||||||
|
|
||||||
|
exec_state
|
||||||
|
.batch_modeling_cmd(
|
||||||
|
ModelingCmdMeta::from_args_id(&args, id),
|
||||||
|
ModelingCmd::from(mcmd::ClosePath { path_id: new_sketch.id }),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
Ok(new_sketch)
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) fn get_radius(
|
pub(crate) fn get_radius(
|
||||||
radius: Option<TyF64>,
|
radius: Option<TyF64>,
|
||||||
diameter: Option<TyF64>,
|
diameter: Option<TyF64>,
|
||||||
|
@ -11,7 +11,10 @@ use parse_display::{Display, FromStr};
|
|||||||
use schemars::JsonSchema;
|
use schemars::JsonSchema;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use super::shapes::{get_radius, get_radius_labelled};
|
use super::{
|
||||||
|
shapes::{get_radius, get_radius_labelled},
|
||||||
|
utils::{untype_array, untype_point},
|
||||||
|
};
|
||||||
#[cfg(feature = "artifact-graph")]
|
#[cfg(feature = "artifact-graph")]
|
||||||
use crate::execution::{Artifact, ArtifactId, CodeRef, StartSketchOnFace, StartSketchOnPlane};
|
use crate::execution::{Artifact, ArtifactId, CodeRef, StartSketchOnFace, StartSketchOnPlane};
|
||||||
use crate::{
|
use crate::{
|
||||||
@ -599,7 +602,7 @@ async fn inner_angled_line_of_x_length(
|
|||||||
}
|
}
|
||||||
|
|
||||||
let to = get_y_component(Angle::from_degrees(angle_degrees), length.n);
|
let to = get_y_component(Angle::from_degrees(angle_degrees), length.n);
|
||||||
let to = [TyF64::new(to[0], length.ty.clone()), TyF64::new(to[1], length.ty)];
|
let to = [TyF64::new(to[0], length.ty), TyF64::new(to[1], length.ty)];
|
||||||
|
|
||||||
let new_sketch = straight_line(StraightLineParams::relative(to, sketch, tag), exec_state, args).await?;
|
let new_sketch = straight_line(StraightLineParams::relative(to, sketch, tag), exec_state, args).await?;
|
||||||
|
|
||||||
@ -666,7 +669,7 @@ async fn inner_angled_line_of_y_length(
|
|||||||
}
|
}
|
||||||
|
|
||||||
let to = get_x_component(Angle::from_degrees(angle_degrees), length.n);
|
let to = get_x_component(Angle::from_degrees(angle_degrees), length.n);
|
||||||
let to = [TyF64::new(to[0], length.ty.clone()), TyF64::new(to[1], length.ty)];
|
let to = [TyF64::new(to[0], length.ty), TyF64::new(to[1], length.ty)];
|
||||||
|
|
||||||
let new_sketch = straight_line(StraightLineParams::relative(to, sketch, tag), exec_state, args).await?;
|
let new_sketch = straight_line(StraightLineParams::relative(to, sketch, tag), exec_state, args).await?;
|
||||||
|
|
||||||
@ -1777,6 +1780,727 @@ async fn inner_subtract_2d(
|
|||||||
Ok(sketch)
|
Ok(sketch)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Calculate the (x, y) point on an ellipse given x or y and the major/minor radii of the ellipse.
|
||||||
|
pub async fn elliptic_point(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||||
|
let x = args.get_kw_arg_opt("x", &RuntimeType::length(), exec_state)?;
|
||||||
|
let y = args.get_kw_arg_opt("y", &RuntimeType::length(), exec_state)?;
|
||||||
|
let major_radius = args.get_kw_arg("majorRadius", &RuntimeType::num_any(), exec_state)?;
|
||||||
|
let minor_radius = args.get_kw_arg("minorRadius", &RuntimeType::num_any(), exec_state)?;
|
||||||
|
|
||||||
|
let elliptic_point = inner_elliptic_point(x, y, major_radius, minor_radius, &args).await?;
|
||||||
|
|
||||||
|
args.make_kcl_val_from_point(elliptic_point, exec_state.length_unit().into())
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn inner_elliptic_point(
|
||||||
|
x: Option<TyF64>,
|
||||||
|
y: Option<TyF64>,
|
||||||
|
major_radius: TyF64,
|
||||||
|
minor_radius: TyF64,
|
||||||
|
args: &Args,
|
||||||
|
) -> Result<[f64; 2], KclError> {
|
||||||
|
let major_radius = major_radius.n;
|
||||||
|
let minor_radius = minor_radius.n;
|
||||||
|
if let Some(x) = x {
|
||||||
|
if x.n > major_radius {
|
||||||
|
Err(KclError::Type {
|
||||||
|
details: KclErrorDetails::new(
|
||||||
|
format!(
|
||||||
|
"Invalid input. The x value, {}, cannot be larger than the major radius {}.",
|
||||||
|
x.n, major_radius
|
||||||
|
)
|
||||||
|
.to_owned(),
|
||||||
|
vec![args.source_range],
|
||||||
|
),
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
Ok((
|
||||||
|
x.n,
|
||||||
|
minor_radius * (1.0 - x.n.powf(2.0) / major_radius.powf(2.0)).sqrt(),
|
||||||
|
)
|
||||||
|
.into())
|
||||||
|
}
|
||||||
|
} else if let Some(y) = y {
|
||||||
|
if y.n > minor_radius {
|
||||||
|
Err(KclError::Type {
|
||||||
|
details: KclErrorDetails::new(
|
||||||
|
format!(
|
||||||
|
"Invalid input. The y value, {}, cannot be larger than the minor radius {}.",
|
||||||
|
y.n, minor_radius
|
||||||
|
)
|
||||||
|
.to_owned(),
|
||||||
|
vec![args.source_range],
|
||||||
|
),
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
Ok((
|
||||||
|
major_radius * (1.0 - y.n.powf(2.0) / minor_radius.powf(2.0)).sqrt(),
|
||||||
|
y.n,
|
||||||
|
)
|
||||||
|
.into())
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Err(KclError::Type {
|
||||||
|
details: KclErrorDetails::new(
|
||||||
|
"Invalid input. Must have either x or y, you cannot have both or neither.".to_owned(),
|
||||||
|
vec![args.source_range],
|
||||||
|
),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Draw an elliptical arc.
|
||||||
|
pub async fn elliptic(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||||
|
exec_state.warn(crate::CompilationError {
|
||||||
|
source_range: args.source_range,
|
||||||
|
message: "Use of elliptic is currently experimental and the interface may change.".to_string(),
|
||||||
|
suggestion: None,
|
||||||
|
severity: crate::errors::Severity::Warning,
|
||||||
|
tag: crate::errors::Tag::None,
|
||||||
|
});
|
||||||
|
let sketch = args.get_unlabeled_kw_arg("sketch", &RuntimeType::Primitive(PrimitiveType::Sketch), exec_state)?;
|
||||||
|
|
||||||
|
let center = args.get_kw_arg("center", &RuntimeType::point2d(), exec_state)?;
|
||||||
|
let angle_start = args.get_kw_arg("angleStart", &RuntimeType::degrees(), exec_state)?;
|
||||||
|
let angle_end = args.get_kw_arg("angleEnd", &RuntimeType::degrees(), exec_state)?;
|
||||||
|
let major_radius = args.get_kw_arg("majorRadius", &RuntimeType::length(), exec_state)?;
|
||||||
|
let minor_radius = args.get_kw_arg("minorRadius", &RuntimeType::length(), exec_state)?;
|
||||||
|
let tag = args.get_kw_arg_opt("tag", &RuntimeType::tag_decl(), exec_state)?;
|
||||||
|
|
||||||
|
let new_sketch = inner_elliptic(
|
||||||
|
sketch,
|
||||||
|
center,
|
||||||
|
angle_start,
|
||||||
|
angle_end,
|
||||||
|
major_radius,
|
||||||
|
minor_radius,
|
||||||
|
tag,
|
||||||
|
exec_state,
|
||||||
|
args,
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
Ok(KclValue::Sketch {
|
||||||
|
value: Box::new(new_sketch),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
|
pub(crate) async fn inner_elliptic(
|
||||||
|
sketch: Sketch,
|
||||||
|
center: [TyF64; 2],
|
||||||
|
angle_start: TyF64,
|
||||||
|
angle_end: TyF64,
|
||||||
|
major_radius: TyF64,
|
||||||
|
minor_radius: TyF64,
|
||||||
|
tag: Option<TagNode>,
|
||||||
|
exec_state: &mut ExecState,
|
||||||
|
args: Args,
|
||||||
|
) -> Result<Sketch, KclError> {
|
||||||
|
let from: Point2d = sketch.current_pen_position()?;
|
||||||
|
let id = exec_state.next_uuid();
|
||||||
|
|
||||||
|
let (center_u, _) = untype_point(center);
|
||||||
|
|
||||||
|
let start_angle = Angle::from_degrees(angle_start.to_degrees());
|
||||||
|
let end_angle = Angle::from_degrees(angle_end.to_degrees());
|
||||||
|
let to = [
|
||||||
|
center_u[0] + major_radius.to_length_units(from.units) * libm::cos(end_angle.to_radians()),
|
||||||
|
center_u[1] + minor_radius.to_length_units(from.units) * libm::sin(end_angle.to_radians()),
|
||||||
|
];
|
||||||
|
|
||||||
|
exec_state
|
||||||
|
.batch_modeling_cmd(
|
||||||
|
ModelingCmdMeta::from_args_id(&args, id),
|
||||||
|
ModelingCmd::from(mcmd::ExtendPath {
|
||||||
|
path: sketch.id.into(),
|
||||||
|
segment: PathSegment::Ellipse {
|
||||||
|
center: KPoint2d::from(untyped_point_to_mm(center_u, from.units)).map(LengthUnit),
|
||||||
|
major_radius: LengthUnit(from.units.adjust_to(major_radius.to_mm(), UnitLen::Mm).0),
|
||||||
|
minor_radius: LengthUnit(from.units.adjust_to(minor_radius.to_mm(), UnitLen::Mm).0),
|
||||||
|
start_angle,
|
||||||
|
end_angle,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
let current_path = Path::Ellipse {
|
||||||
|
ccw: start_angle < end_angle,
|
||||||
|
center: center_u,
|
||||||
|
major_radius: major_radius.to_mm(),
|
||||||
|
minor_radius: minor_radius.to_mm(),
|
||||||
|
base: BasePath {
|
||||||
|
from: from.ignore_units(),
|
||||||
|
to,
|
||||||
|
tag: tag.clone(),
|
||||||
|
units: sketch.units,
|
||||||
|
geo_meta: GeoMeta {
|
||||||
|
id,
|
||||||
|
metadata: args.source_range.into(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
let mut new_sketch = sketch.clone();
|
||||||
|
if let Some(tag) = &tag {
|
||||||
|
new_sketch.add_tag(tag, ¤t_path, exec_state);
|
||||||
|
}
|
||||||
|
|
||||||
|
new_sketch.paths.push(current_path);
|
||||||
|
|
||||||
|
Ok(new_sketch)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Calculate the (x, y) point on an hyperbola given x or y and the semi major/minor of the ellipse.
|
||||||
|
pub async fn hyperbolic_point(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||||
|
let x = args.get_kw_arg_opt("x", &RuntimeType::length(), exec_state)?;
|
||||||
|
let y = args.get_kw_arg_opt("y", &RuntimeType::length(), exec_state)?;
|
||||||
|
let semi_major = args.get_kw_arg("semiMajor", &RuntimeType::num_any(), exec_state)?;
|
||||||
|
let semi_minor = args.get_kw_arg("semiMinor", &RuntimeType::num_any(), exec_state)?;
|
||||||
|
|
||||||
|
let hyperbolic_point = inner_hyperbolic_point(x, y, semi_major, semi_minor, &args).await?;
|
||||||
|
|
||||||
|
args.make_kcl_val_from_point(hyperbolic_point, exec_state.length_unit().into())
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn inner_hyperbolic_point(
|
||||||
|
x: Option<TyF64>,
|
||||||
|
y: Option<TyF64>,
|
||||||
|
semi_major: TyF64,
|
||||||
|
semi_minor: TyF64,
|
||||||
|
args: &Args,
|
||||||
|
) -> Result<[f64; 2], KclError> {
|
||||||
|
let semi_major = semi_major.n;
|
||||||
|
let semi_minor = semi_minor.n;
|
||||||
|
if let Some(x) = x {
|
||||||
|
if x.n < semi_major {
|
||||||
|
Err(KclError::Type {
|
||||||
|
details: KclErrorDetails::new(
|
||||||
|
format!(
|
||||||
|
"Invalid input. The x value, {}, cannot be less than the semi major value, {}.",
|
||||||
|
x.n, semi_major
|
||||||
|
)
|
||||||
|
.to_owned(),
|
||||||
|
vec![args.source_range],
|
||||||
|
),
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
Ok((x.n, semi_minor * (x.n.powf(2.0) / semi_major.powf(2.0) - 1.0).sqrt()).into())
|
||||||
|
}
|
||||||
|
} else if let Some(y) = y {
|
||||||
|
Ok((semi_major * (y.n.powf(2.0) / semi_minor.powf(2.0) + 1.0).sqrt(), y.n).into())
|
||||||
|
} else {
|
||||||
|
Err(KclError::Type {
|
||||||
|
details: KclErrorDetails::new(
|
||||||
|
"Invalid input. Must have either x or y, cannot have both or neither.".to_owned(),
|
||||||
|
vec![args.source_range],
|
||||||
|
),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Draw a hyperbolic arc.
|
||||||
|
pub async fn hyperbolic(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||||
|
exec_state.warn(crate::CompilationError {
|
||||||
|
source_range: args.source_range,
|
||||||
|
message: "Use of hyperbolic is currently experimental and the interface may change.".to_string(),
|
||||||
|
suggestion: None,
|
||||||
|
severity: crate::errors::Severity::Warning,
|
||||||
|
tag: crate::errors::Tag::None,
|
||||||
|
});
|
||||||
|
let sketch = args.get_unlabeled_kw_arg("sketch", &RuntimeType::Primitive(PrimitiveType::Sketch), exec_state)?;
|
||||||
|
|
||||||
|
let semi_major = args.get_kw_arg("semiMajor", &RuntimeType::length(), exec_state)?;
|
||||||
|
let semi_minor = args.get_kw_arg("semiMinor", &RuntimeType::length(), exec_state)?;
|
||||||
|
let interior = args.get_kw_arg_opt("interior", &RuntimeType::point2d(), exec_state)?;
|
||||||
|
let end = args.get_kw_arg_opt("end", &RuntimeType::point2d(), exec_state)?;
|
||||||
|
let interior_absolute = args.get_kw_arg_opt("interiorAbsolute", &RuntimeType::point2d(), exec_state)?;
|
||||||
|
let end_absolute = args.get_kw_arg_opt("endAbsolute", &RuntimeType::point2d(), exec_state)?;
|
||||||
|
let tag = args.get_kw_arg_opt("tag", &RuntimeType::tag_decl(), exec_state)?;
|
||||||
|
|
||||||
|
let new_sketch = inner_hyperbolic(
|
||||||
|
sketch,
|
||||||
|
semi_major,
|
||||||
|
semi_minor,
|
||||||
|
interior,
|
||||||
|
end,
|
||||||
|
interior_absolute,
|
||||||
|
end_absolute,
|
||||||
|
tag,
|
||||||
|
exec_state,
|
||||||
|
args,
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
Ok(KclValue::Sketch {
|
||||||
|
value: Box::new(new_sketch),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Calculate the tangent of a hyperbolic given a point on the curve
|
||||||
|
fn hyperbolic_tangent(point: Point2d, semi_major: f64, semi_minor: f64) -> [f64; 2] {
|
||||||
|
(point.y * semi_major.powf(2.0), point.x * semi_minor.powf(2.0)).into()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
|
pub(crate) async fn inner_hyperbolic(
|
||||||
|
sketch: Sketch,
|
||||||
|
semi_major: TyF64,
|
||||||
|
semi_minor: TyF64,
|
||||||
|
interior: Option<[TyF64; 2]>,
|
||||||
|
end: Option<[TyF64; 2]>,
|
||||||
|
interior_absolute: Option<[TyF64; 2]>,
|
||||||
|
end_absolute: Option<[TyF64; 2]>,
|
||||||
|
tag: Option<TagNode>,
|
||||||
|
exec_state: &mut ExecState,
|
||||||
|
args: Args,
|
||||||
|
) -> Result<Sketch, KclError> {
|
||||||
|
let from = sketch.current_pen_position()?;
|
||||||
|
let id = exec_state.next_uuid();
|
||||||
|
|
||||||
|
let (interior, end, relative) = match (interior, end, interior_absolute, end_absolute) {
|
||||||
|
(Some(interior), Some(end), None, None) => (interior, end, true),
|
||||||
|
(None, None, Some(interior_absolute), Some(end_absolute)) => (interior_absolute, end_absolute, false),
|
||||||
|
_ => return Err(KclError::Type {
|
||||||
|
details: KclErrorDetails::new(
|
||||||
|
"Invalid combination of arguments. Either provide (end, interior) or (endAbsolute, interiorAbsolute)"
|
||||||
|
.to_owned(),
|
||||||
|
vec![args.source_range],
|
||||||
|
),
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
|
||||||
|
let (interior, _) = untype_point(interior);
|
||||||
|
let (end, _) = untype_point(end);
|
||||||
|
let end_point = Point2d {
|
||||||
|
x: end[0],
|
||||||
|
y: end[1],
|
||||||
|
units: from.units,
|
||||||
|
};
|
||||||
|
|
||||||
|
let semi_major_u = semi_major.to_length_units(from.units);
|
||||||
|
let semi_minor_u = semi_minor.to_length_units(from.units);
|
||||||
|
|
||||||
|
let start_tangent = hyperbolic_tangent(from, semi_major_u, semi_minor_u);
|
||||||
|
let end_tangent = hyperbolic_tangent(end_point, semi_major_u, semi_minor_u);
|
||||||
|
|
||||||
|
exec_state
|
||||||
|
.batch_modeling_cmd(
|
||||||
|
ModelingCmdMeta::from_args_id(&args, id),
|
||||||
|
ModelingCmd::from(mcmd::ExtendPath {
|
||||||
|
path: sketch.id.into(),
|
||||||
|
segment: PathSegment::ConicTo {
|
||||||
|
start_tangent: KPoint2d::from(untyped_point_to_mm(start_tangent, from.units)).map(LengthUnit),
|
||||||
|
end_tangent: KPoint2d::from(untyped_point_to_mm(end_tangent, from.units)).map(LengthUnit),
|
||||||
|
end: KPoint2d::from(untyped_point_to_mm(end, from.units)).map(LengthUnit),
|
||||||
|
interior: KPoint2d::from(untyped_point_to_mm(interior, from.units)).map(LengthUnit),
|
||||||
|
relative,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
let current_path = Path::Conic {
|
||||||
|
base: BasePath {
|
||||||
|
from: from.ignore_units(),
|
||||||
|
to: end,
|
||||||
|
tag: tag.clone(),
|
||||||
|
units: sketch.units,
|
||||||
|
geo_meta: GeoMeta {
|
||||||
|
id,
|
||||||
|
metadata: args.source_range.into(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
let mut new_sketch = sketch.clone();
|
||||||
|
if let Some(tag) = &tag {
|
||||||
|
new_sketch.add_tag(tag, ¤t_path, exec_state);
|
||||||
|
}
|
||||||
|
|
||||||
|
new_sketch.paths.push(current_path);
|
||||||
|
|
||||||
|
Ok(new_sketch)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Calculate the point on a parabola given the coefficient of the parabola and either x or y
|
||||||
|
pub async fn parabolic_point(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||||
|
let x = args.get_kw_arg_opt("x", &RuntimeType::length(), exec_state)?;
|
||||||
|
let y = args.get_kw_arg_opt("y", &RuntimeType::length(), exec_state)?;
|
||||||
|
let coefficients = args.get_kw_arg(
|
||||||
|
"coefficients",
|
||||||
|
&RuntimeType::Array(Box::new(RuntimeType::num_any()), ArrayLen::Known(3)),
|
||||||
|
exec_state,
|
||||||
|
)?;
|
||||||
|
|
||||||
|
let parabolic_point = inner_parabolic_point(x, y, &coefficients, &args).await?;
|
||||||
|
|
||||||
|
args.make_kcl_val_from_point(parabolic_point, exec_state.length_unit().into())
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn inner_parabolic_point(
|
||||||
|
x: Option<TyF64>,
|
||||||
|
y: Option<TyF64>,
|
||||||
|
coefficients: &[TyF64; 3],
|
||||||
|
args: &Args,
|
||||||
|
) -> Result<[f64; 2], KclError> {
|
||||||
|
let a = coefficients[0].n;
|
||||||
|
let b = coefficients[1].n;
|
||||||
|
let c = coefficients[2].n;
|
||||||
|
if let Some(x) = x {
|
||||||
|
Ok((x.n, a * x.n.powf(2.0) + b * x.n + c).into())
|
||||||
|
} else if let Some(y) = y {
|
||||||
|
let det = (b.powf(2.0) - 4.0 * a * (c - y.n)).sqrt();
|
||||||
|
Ok(((-b + det) / (2.0 * a), y.n).into())
|
||||||
|
} else {
|
||||||
|
Err(KclError::Type {
|
||||||
|
details: KclErrorDetails::new(
|
||||||
|
"Invalid input. Must have either x or y, cannot have both or neither.".to_owned(),
|
||||||
|
vec![args.source_range],
|
||||||
|
),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Draw a parabolic arc.
|
||||||
|
pub async fn parabolic(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||||
|
exec_state.warn(crate::CompilationError {
|
||||||
|
source_range: args.source_range,
|
||||||
|
message: "Use of parabolic is currently experimental and the interface may change.".to_string(),
|
||||||
|
suggestion: None,
|
||||||
|
severity: crate::errors::Severity::Warning,
|
||||||
|
tag: crate::errors::Tag::None,
|
||||||
|
});
|
||||||
|
let sketch = args.get_unlabeled_kw_arg("sketch", &RuntimeType::Primitive(PrimitiveType::Sketch), exec_state)?;
|
||||||
|
|
||||||
|
let coefficients = args.get_kw_arg_opt(
|
||||||
|
"coefficients",
|
||||||
|
&RuntimeType::Array(Box::new(RuntimeType::num_any()), ArrayLen::Known(3)),
|
||||||
|
exec_state,
|
||||||
|
)?;
|
||||||
|
let interior = args.get_kw_arg_opt("interior", &RuntimeType::point2d(), exec_state)?;
|
||||||
|
let end = args.get_kw_arg_opt("end", &RuntimeType::point2d(), exec_state)?;
|
||||||
|
let interior_absolute = args.get_kw_arg_opt("interiorAbsolute", &RuntimeType::point2d(), exec_state)?;
|
||||||
|
let end_absolute = args.get_kw_arg_opt("endAbsolute", &RuntimeType::point2d(), exec_state)?;
|
||||||
|
let tag = args.get_kw_arg_opt("tag", &RuntimeType::tag_decl(), exec_state)?;
|
||||||
|
|
||||||
|
let new_sketch = inner_parabolic(
|
||||||
|
sketch,
|
||||||
|
coefficients,
|
||||||
|
interior,
|
||||||
|
end,
|
||||||
|
interior_absolute,
|
||||||
|
end_absolute,
|
||||||
|
tag,
|
||||||
|
exec_state,
|
||||||
|
args,
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
Ok(KclValue::Sketch {
|
||||||
|
value: Box::new(new_sketch),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fn parabolic_tangent(point: Point2d, a: f64, b: f64) -> [f64; 2] {
|
||||||
|
//f(x) = ax^2 + bx + c
|
||||||
|
//f'(x) = 2ax + b
|
||||||
|
(1.0, 2.0 * a * point.x + b).into()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
|
pub(crate) async fn inner_parabolic(
|
||||||
|
sketch: Sketch,
|
||||||
|
coefficients: Option<[TyF64; 3]>,
|
||||||
|
interior: Option<[TyF64; 2]>,
|
||||||
|
end: Option<[TyF64; 2]>,
|
||||||
|
interior_absolute: Option<[TyF64; 2]>,
|
||||||
|
end_absolute: Option<[TyF64; 2]>,
|
||||||
|
tag: Option<TagNode>,
|
||||||
|
exec_state: &mut ExecState,
|
||||||
|
args: Args,
|
||||||
|
) -> Result<Sketch, KclError> {
|
||||||
|
let from = sketch.current_pen_position()?;
|
||||||
|
let id = exec_state.next_uuid();
|
||||||
|
|
||||||
|
if (coefficients.is_some() && interior.is_some()) || (coefficients.is_none() && interior.is_none()) {
|
||||||
|
return Err(KclError::Type {
|
||||||
|
details: KclErrorDetails::new(
|
||||||
|
"Invalid combination of arguments. Either provide (a, b, c) or (interior)".to_owned(),
|
||||||
|
vec![args.source_range],
|
||||||
|
),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
let (interior, end, relative) = match (coefficients.clone(), interior, end, interior_absolute, end_absolute) {
|
||||||
|
(None, Some(interior), Some(end), None, None) => {
|
||||||
|
let (interior, _) = untype_point(interior);
|
||||||
|
let (end, _) = untype_point(end);
|
||||||
|
(interior,end, true)
|
||||||
|
},
|
||||||
|
(None, None, None, Some(interior_absolute), Some(end_absolute)) => {
|
||||||
|
let (interior_absolute, _) = untype_point(interior_absolute);
|
||||||
|
let (end_absolute, _) = untype_point(end_absolute);
|
||||||
|
(interior_absolute, end_absolute, false)
|
||||||
|
}
|
||||||
|
(Some(coefficients), _, Some(end), _, _) => {
|
||||||
|
let (end, _) = untype_point(end);
|
||||||
|
let interior =
|
||||||
|
inner_parabolic_point(
|
||||||
|
Some(TyF64::count(0.5 * (from.x + end[0]))),
|
||||||
|
None,
|
||||||
|
&coefficients,
|
||||||
|
&args,
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
(interior, end, true)
|
||||||
|
}
|
||||||
|
(Some(coefficients), _, _, _, Some(end)) => {
|
||||||
|
let (end, _) = untype_point(end);
|
||||||
|
let interior =
|
||||||
|
inner_parabolic_point(
|
||||||
|
Some(TyF64::count(0.5 * (from.x + end[0]))),
|
||||||
|
None,
|
||||||
|
&coefficients,
|
||||||
|
&args,
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
(interior, end, false)
|
||||||
|
}
|
||||||
|
_ => return
|
||||||
|
Err(KclError::Type{details: KclErrorDetails::new(
|
||||||
|
"Invalid combination of arguments. Either provide (end, interior) or (endAbsolute, interiorAbsolute) if coefficients are not provided."
|
||||||
|
.to_owned(),
|
||||||
|
vec![args.source_range],
|
||||||
|
)}),
|
||||||
|
};
|
||||||
|
|
||||||
|
let end_point = Point2d {
|
||||||
|
x: end[0],
|
||||||
|
y: end[1],
|
||||||
|
units: from.units,
|
||||||
|
};
|
||||||
|
|
||||||
|
let (a, b, _c) = if let Some([a, b, c]) = coefficients {
|
||||||
|
(a.n, b.n, c.n)
|
||||||
|
} else {
|
||||||
|
// Any three points is enough to uniquely define a parabola
|
||||||
|
let denom = (from.x - interior[0]) * (from.x - end_point.x) * (interior[0] - end_point.x);
|
||||||
|
let a = (end_point.x * (interior[1] - from.y)
|
||||||
|
+ interior[0] * (from.y - end_point.y)
|
||||||
|
+ from.x * (end_point.y - interior[1]))
|
||||||
|
/ denom;
|
||||||
|
let b = (end_point.x.powf(2.0) * (from.y - interior[1])
|
||||||
|
+ interior[0].powf(2.0) * (end_point.y - from.y)
|
||||||
|
+ from.x.powf(2.0) * (interior[1] - end_point.y))
|
||||||
|
/ denom;
|
||||||
|
let c = (interior[0] * end_point.x * (interior[0] - end_point.x) * from.y
|
||||||
|
+ end_point.x * from.x * (end_point.x - from.x) * interior[1]
|
||||||
|
+ from.x * interior[0] * (from.x - interior[0]) * end_point.y)
|
||||||
|
/ denom;
|
||||||
|
|
||||||
|
(a, b, c)
|
||||||
|
};
|
||||||
|
|
||||||
|
let start_tangent = parabolic_tangent(from, a, b);
|
||||||
|
let end_tangent = parabolic_tangent(end_point, a, b);
|
||||||
|
|
||||||
|
exec_state
|
||||||
|
.batch_modeling_cmd(
|
||||||
|
ModelingCmdMeta::from_args_id(&args, id),
|
||||||
|
ModelingCmd::from(mcmd::ExtendPath {
|
||||||
|
path: sketch.id.into(),
|
||||||
|
segment: PathSegment::ConicTo {
|
||||||
|
start_tangent: KPoint2d::from(untyped_point_to_mm(start_tangent, from.units)).map(LengthUnit),
|
||||||
|
end_tangent: KPoint2d::from(untyped_point_to_mm(end_tangent, from.units)).map(LengthUnit),
|
||||||
|
end: KPoint2d::from(untyped_point_to_mm(end, from.units)).map(LengthUnit),
|
||||||
|
interior: KPoint2d::from(untyped_point_to_mm(interior, from.units)).map(LengthUnit),
|
||||||
|
relative,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
let current_path = Path::Conic {
|
||||||
|
base: BasePath {
|
||||||
|
from: from.ignore_units(),
|
||||||
|
to: end,
|
||||||
|
tag: tag.clone(),
|
||||||
|
units: sketch.units,
|
||||||
|
geo_meta: GeoMeta {
|
||||||
|
id,
|
||||||
|
metadata: args.source_range.into(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
let mut new_sketch = sketch.clone();
|
||||||
|
if let Some(tag) = &tag {
|
||||||
|
new_sketch.add_tag(tag, ¤t_path, exec_state);
|
||||||
|
}
|
||||||
|
|
||||||
|
new_sketch.paths.push(current_path);
|
||||||
|
|
||||||
|
Ok(new_sketch)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn conic_tangent(coefficients: [f64; 6], point: [f64; 2]) -> [f64; 2] {
|
||||||
|
let [a, b, c, d, e, _] = coefficients;
|
||||||
|
|
||||||
|
(
|
||||||
|
c * point[0] + 2.0 * b * point[1] + e,
|
||||||
|
-(2.0 * a * point[0] + c * point[1] + d),
|
||||||
|
)
|
||||||
|
.into()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Draw a conic section
|
||||||
|
pub async fn conic(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||||
|
exec_state.warn(crate::CompilationError {
|
||||||
|
source_range: args.source_range,
|
||||||
|
message: "Use of conics is currently experimental and the interface may change.".to_string(),
|
||||||
|
suggestion: None,
|
||||||
|
severity: crate::errors::Severity::Warning,
|
||||||
|
tag: crate::errors::Tag::None,
|
||||||
|
});
|
||||||
|
let sketch = args.get_unlabeled_kw_arg("sketch", &RuntimeType::Primitive(PrimitiveType::Sketch), exec_state)?;
|
||||||
|
|
||||||
|
let start_tangent = args.get_kw_arg_opt("startTangent", &RuntimeType::point2d(), exec_state)?;
|
||||||
|
let end_tangent = args.get_kw_arg_opt("endTangent", &RuntimeType::point2d(), exec_state)?;
|
||||||
|
let end = args.get_kw_arg_opt("end", &RuntimeType::point2d(), exec_state)?;
|
||||||
|
let interior = args.get_kw_arg_opt("interior", &RuntimeType::point2d(), exec_state)?;
|
||||||
|
let end_absolute = args.get_kw_arg_opt("endAbsolute", &RuntimeType::point2d(), exec_state)?;
|
||||||
|
let interior_absolute = args.get_kw_arg_opt("interiorAbsolute", &RuntimeType::point2d(), exec_state)?;
|
||||||
|
let coefficients = args.get_kw_arg_opt(
|
||||||
|
"coefficients",
|
||||||
|
&RuntimeType::Array(Box::new(RuntimeType::num_any()), ArrayLen::Known(6)),
|
||||||
|
exec_state,
|
||||||
|
)?;
|
||||||
|
let tag = args.get_kw_arg_opt("tag", &RuntimeType::tag_decl(), exec_state)?;
|
||||||
|
|
||||||
|
let new_sketch = inner_conic(
|
||||||
|
sketch,
|
||||||
|
start_tangent,
|
||||||
|
end,
|
||||||
|
end_tangent,
|
||||||
|
interior,
|
||||||
|
coefficients,
|
||||||
|
interior_absolute,
|
||||||
|
end_absolute,
|
||||||
|
tag,
|
||||||
|
exec_state,
|
||||||
|
args,
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
Ok(KclValue::Sketch {
|
||||||
|
value: Box::new(new_sketch),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
|
pub(crate) async fn inner_conic(
|
||||||
|
sketch: Sketch,
|
||||||
|
start_tangent: Option<[TyF64; 2]>,
|
||||||
|
end: Option<[TyF64; 2]>,
|
||||||
|
end_tangent: Option<[TyF64; 2]>,
|
||||||
|
interior: Option<[TyF64; 2]>,
|
||||||
|
coefficients: Option<[TyF64; 6]>,
|
||||||
|
interior_absolute: Option<[TyF64; 2]>,
|
||||||
|
end_absolute: Option<[TyF64; 2]>,
|
||||||
|
tag: Option<TagNode>,
|
||||||
|
exec_state: &mut ExecState,
|
||||||
|
args: Args,
|
||||||
|
) -> Result<Sketch, KclError> {
|
||||||
|
let from: Point2d = sketch.current_pen_position()?;
|
||||||
|
let id = exec_state.next_uuid();
|
||||||
|
|
||||||
|
if (coefficients.is_some() && (start_tangent.is_some() || end_tangent.is_some()))
|
||||||
|
|| (coefficients.is_none() && (start_tangent.is_none() && end_tangent.is_none()))
|
||||||
|
{
|
||||||
|
return Err(KclError::Type {
|
||||||
|
details: KclErrorDetails::new(
|
||||||
|
"Invalid combination of arguments. Either provide coefficients or (startTangent, endTangent)"
|
||||||
|
.to_owned(),
|
||||||
|
vec![args.source_range],
|
||||||
|
),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
let (interior, end, relative) = match (interior, end, interior_absolute, end_absolute) {
|
||||||
|
(Some(interior), Some(end), None, None) => (interior, end, true),
|
||||||
|
(None, None, Some(interior_absolute), Some(end_absolute)) => (interior_absolute, end_absolute, false),
|
||||||
|
_ => return Err(KclError::Type {
|
||||||
|
details: KclErrorDetails::new(
|
||||||
|
"Invalid combination of arguments. Either provide (end, interior) or (endAbsolute, interiorAbsolute)"
|
||||||
|
.to_owned(),
|
||||||
|
vec![args.source_range],
|
||||||
|
),
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
|
||||||
|
let (end, _) = untype_array(end);
|
||||||
|
let (interior, _) = untype_point(interior);
|
||||||
|
|
||||||
|
let (start_tangent, end_tangent) = if let Some(coeffs) = coefficients {
|
||||||
|
let (coeffs, _) = untype_array(coeffs);
|
||||||
|
(conic_tangent(coeffs, [from.x, from.y]), conic_tangent(coeffs, end))
|
||||||
|
} else {
|
||||||
|
let start = if let Some(start_tangent) = start_tangent {
|
||||||
|
let (start, _) = untype_point(start_tangent);
|
||||||
|
start
|
||||||
|
} else {
|
||||||
|
let previous_point = sketch
|
||||||
|
.get_tangential_info_from_paths()
|
||||||
|
.tan_previous_point(from.ignore_units());
|
||||||
|
let from = from.ignore_units();
|
||||||
|
[from[0] - previous_point[0], from[1] - previous_point[1]]
|
||||||
|
};
|
||||||
|
|
||||||
|
let Some(end_tangent) = end_tangent else {
|
||||||
|
return Err(KclError::new_semantic(KclErrorDetails::new(
|
||||||
|
"You must either provide either `coefficients` or `endTangent`.".to_owned(),
|
||||||
|
vec![args.source_range],
|
||||||
|
)));
|
||||||
|
};
|
||||||
|
let (end_tan, _) = untype_point(end_tangent);
|
||||||
|
(start, end_tan)
|
||||||
|
};
|
||||||
|
|
||||||
|
exec_state
|
||||||
|
.batch_modeling_cmd(
|
||||||
|
ModelingCmdMeta::from_args_id(&args, id),
|
||||||
|
ModelingCmd::from(mcmd::ExtendPath {
|
||||||
|
path: sketch.id.into(),
|
||||||
|
segment: PathSegment::ConicTo {
|
||||||
|
start_tangent: KPoint2d::from(untyped_point_to_mm(start_tangent, from.units)).map(LengthUnit),
|
||||||
|
end_tangent: KPoint2d::from(untyped_point_to_mm(end_tangent, from.units)).map(LengthUnit),
|
||||||
|
end: KPoint2d::from(untyped_point_to_mm(end, from.units)).map(LengthUnit),
|
||||||
|
interior: KPoint2d::from(untyped_point_to_mm(interior, from.units)).map(LengthUnit),
|
||||||
|
relative,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
let current_path = Path::Conic {
|
||||||
|
base: BasePath {
|
||||||
|
from: from.ignore_units(),
|
||||||
|
to: end,
|
||||||
|
tag: tag.clone(),
|
||||||
|
units: sketch.units,
|
||||||
|
geo_meta: GeoMeta {
|
||||||
|
id,
|
||||||
|
metadata: args.source_range.into(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
let mut new_sketch = sketch.clone();
|
||||||
|
if let Some(tag) = &tag {
|
||||||
|
new_sketch.add_tag(tag, ¤t_path, exec_state);
|
||||||
|
}
|
||||||
|
|
||||||
|
new_sketch.paths.push(current_path);
|
||||||
|
|
||||||
|
Ok(new_sketch)
|
||||||
|
}
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|
||||||
|
@ -10,6 +10,15 @@ pub(crate) fn untype_point(p: [TyF64; 2]) -> ([f64; 2], NumericType) {
|
|||||||
([x, y], ty)
|
([x, y], ty)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn untype_array<const N: usize>(p: [TyF64; N]) -> ([f64; N], NumericType) {
|
||||||
|
let (vec, ty) = NumericType::combine_eq_array(&p);
|
||||||
|
(
|
||||||
|
vec.try_into()
|
||||||
|
.unwrap_or_else(|v: Vec<f64>| panic!("Expected a Vec of length {} but it was {}", N, v.len())),
|
||||||
|
ty,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) fn point_to_mm(p: [TyF64; 2]) -> [f64; 2] {
|
pub(crate) fn point_to_mm(p: [TyF64; 2]) -> [f64; 2] {
|
||||||
[p[0].to_mm(), p[1].to_mm()]
|
[p[0].to_mm(), p[1].to_mm()]
|
||||||
}
|
}
|
||||||
|
@ -363,6 +363,9 @@ impl BinaryPart {
|
|||||||
BinaryPart::MemberExpression(member_expression) => {
|
BinaryPart::MemberExpression(member_expression) => {
|
||||||
member_expression.recast(options, indentation_level, ctxt)
|
member_expression.recast(options, indentation_level, ctxt)
|
||||||
}
|
}
|
||||||
|
BinaryPart::ArrayExpression(e) => e.recast(options, indentation_level, ctxt),
|
||||||
|
BinaryPart::ArrayRangeExpression(e) => e.recast(options, indentation_level, ctxt),
|
||||||
|
BinaryPart::ObjectExpression(e) => e.recast(options, indentation_level, ctxt),
|
||||||
BinaryPart::IfExpression(e) => e.recast(options, indentation_level, ExprContext::Other),
|
BinaryPart::IfExpression(e) => e.recast(options, indentation_level, ExprContext::Other),
|
||||||
BinaryPart::AscribedExpression(e) => e.recast(options, indentation_level, ExprContext::Other),
|
BinaryPart::AscribedExpression(e) => e.recast(options, indentation_level, ExprContext::Other),
|
||||||
}
|
}
|
||||||
@ -745,6 +748,9 @@ impl UnaryExpression {
|
|||||||
BinaryPart::Literal(_)
|
BinaryPart::Literal(_)
|
||||||
| BinaryPart::Name(_)
|
| BinaryPart::Name(_)
|
||||||
| BinaryPart::MemberExpression(_)
|
| BinaryPart::MemberExpression(_)
|
||||||
|
| BinaryPart::ArrayExpression(_)
|
||||||
|
| BinaryPart::ArrayRangeExpression(_)
|
||||||
|
| BinaryPart::ObjectExpression(_)
|
||||||
| BinaryPart::IfExpression(_)
|
| BinaryPart::IfExpression(_)
|
||||||
| BinaryPart::AscribedExpression(_)
|
| BinaryPart::AscribedExpression(_)
|
||||||
| BinaryPart::CallExpressionKw(_) => {
|
| BinaryPart::CallExpressionKw(_) => {
|
||||||
|
@ -220,6 +220,9 @@ impl<'tree> From<&'tree types::BinaryPart> for Node<'tree> {
|
|||||||
types::BinaryPart::CallExpressionKw(ce) => ce.as_ref().into(),
|
types::BinaryPart::CallExpressionKw(ce) => ce.as_ref().into(),
|
||||||
types::BinaryPart::UnaryExpression(ue) => ue.as_ref().into(),
|
types::BinaryPart::UnaryExpression(ue) => ue.as_ref().into(),
|
||||||
types::BinaryPart::MemberExpression(me) => me.as_ref().into(),
|
types::BinaryPart::MemberExpression(me) => me.as_ref().into(),
|
||||||
|
types::BinaryPart::ArrayExpression(e) => e.as_ref().into(),
|
||||||
|
types::BinaryPart::ArrayRangeExpression(e) => e.as_ref().into(),
|
||||||
|
types::BinaryPart::ObjectExpression(e) => e.as_ref().into(),
|
||||||
types::BinaryPart::IfExpression(e) => e.as_ref().into(),
|
types::BinaryPart::IfExpression(e) => e.as_ref().into(),
|
||||||
types::BinaryPart::AscribedExpression(e) => e.as_ref().into(),
|
types::BinaryPart::AscribedExpression(e) => e.as_ref().into(),
|
||||||
}
|
}
|
||||||
|
@ -234,6 +234,39 @@ export fn startProfile(
|
|||||||
tag?: TagDecl,
|
tag?: TagDecl,
|
||||||
): Sketch {}
|
): Sketch {}
|
||||||
|
|
||||||
|
/// Sketch a rectangle.
|
||||||
|
///
|
||||||
|
/// ```
|
||||||
|
/// exampleSketch = startSketchOn(-XZ)
|
||||||
|
/// |> rectangle(center = [0, 0], width = 10, height = 5)
|
||||||
|
// |> extrude(length = 2)
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// ```
|
||||||
|
/// exampleSketch = startSketchOn(-XZ)
|
||||||
|
/// |> rectangle(corner = [0, 0], width = 10, height = 5)
|
||||||
|
// |> extrude(length = 2)
|
||||||
|
/// ```
|
||||||
|
@(impl = std_rust)
|
||||||
|
export fn rectangle(
|
||||||
|
/// Sketch to extend, or plane or surface to sketch on.
|
||||||
|
@sketchOrSurface: Sketch | Plane | Face,
|
||||||
|
/// Rectangle's width along X axis.
|
||||||
|
width: number(Length),
|
||||||
|
/// Rectangle's height along Y axis.
|
||||||
|
height: number(Length),
|
||||||
|
/// The center of the rectangle.
|
||||||
|
/// Incompatible with `corner`.
|
||||||
|
@(snippetArray = ["0", "0"])
|
||||||
|
center?: Point2d,
|
||||||
|
/// The corner of the rectangle.
|
||||||
|
/// Incompatible with `center`.
|
||||||
|
/// This will be the corner which is most negative on
|
||||||
|
/// both X and Y axes.
|
||||||
|
@(snippetArray = ["0", "0"])
|
||||||
|
corner?: Point2d,
|
||||||
|
): Sketch {}
|
||||||
|
|
||||||
/// Construct a 2-dimensional circle, of the specified radius, centered at
|
/// Construct a 2-dimensional circle, of the specified radius, centered at
|
||||||
/// the provided (x, y) origin point.
|
/// the provided (x, y) origin point.
|
||||||
///
|
///
|
||||||
@ -271,6 +304,27 @@ export fn circle(
|
|||||||
tag?: TagDecl,
|
tag?: TagDecl,
|
||||||
): Sketch {}
|
): Sketch {}
|
||||||
|
|
||||||
|
/// Construct a 2-dimensional ellipse, of the specified major/minor radius, centered at the provided (x, y) point.
|
||||||
|
///
|
||||||
|
/// ```
|
||||||
|
/// exampleSketch = startSketchOn(XY)
|
||||||
|
/// |> ellipse(center = [0, 0], majorRadius = 50, minorRadius = 20)
|
||||||
|
/// ```
|
||||||
|
@(impl = std_rust)
|
||||||
|
export fn ellipse(
|
||||||
|
/// Sketch to extend, or plane or surface to sketch on.
|
||||||
|
@sketchOrSurface: Sketch | Plane | Face,
|
||||||
|
/// The center of the ellipse.
|
||||||
|
@(snippetArray = ["0", "0"])
|
||||||
|
center: Point2d,
|
||||||
|
/// The major radius of the ellipse.
|
||||||
|
majorRadius: number(Length),
|
||||||
|
/// The minor radius of the ellipse.
|
||||||
|
minorRadius: number(Length),
|
||||||
|
/// Create a new tag which refers to this ellipse.
|
||||||
|
tag?: tag,
|
||||||
|
): Sketch {}
|
||||||
|
|
||||||
/// Extend a 2-dimensional sketch through a third dimension in order to
|
/// Extend a 2-dimensional sketch through a third dimension in order to
|
||||||
/// create new 3-dimensional volume, or if extruded into an existing volume,
|
/// create new 3-dimensional volume, or if extruded into an existing volume,
|
||||||
/// cut into an existing solid.
|
/// cut into an existing solid.
|
||||||
@ -1941,3 +1995,213 @@ export fn subtract2d(
|
|||||||
/// The shape(s) which should be cut out of the sketch.
|
/// The shape(s) which should be cut out of the sketch.
|
||||||
tool: [Sketch; 1+],
|
tool: [Sketch; 1+],
|
||||||
): Sketch {}
|
): Sketch {}
|
||||||
|
|
||||||
|
/// Add a conic section to an existing sketch.
|
||||||
|
///
|
||||||
|
/// ```kcl
|
||||||
|
/// exampleSketch = startSketchOn(XZ)
|
||||||
|
/// |> startProfile(at = [0, 0])
|
||||||
|
/// |> conic(
|
||||||
|
/// end = [10,0],
|
||||||
|
/// endTangent = [0,1],
|
||||||
|
/// interior = [5,5],
|
||||||
|
/// startTangent = [0, -1],
|
||||||
|
/// )
|
||||||
|
/// |> close()
|
||||||
|
/// example = extrude(exampleSketch, length = 10)
|
||||||
|
/// ```
|
||||||
|
@(impl = std_rust)
|
||||||
|
export fn conic(
|
||||||
|
/// Which sketch should this path be added to?
|
||||||
|
@sketch: Sketch,
|
||||||
|
/// Any point between the segment's start and end. Requires `endAbsolute`. Incompatible with `interior` or `end`.
|
||||||
|
interiorAbsolute?: Point2d,
|
||||||
|
/// Where should this segment end? Requires `interiorAbsolute`. Incompatible with `interior` or `end`.
|
||||||
|
endAbsolute?: Point2d,
|
||||||
|
/// Any point between the segment's start and end. This point is relative to the start point. Requires `end`. Incompatible with `interiorAbsolute` or `endAbsolute`.
|
||||||
|
interior?: Point2d,
|
||||||
|
/// Where should this segment end? This point is relative to the start point. Requires `interior`. Incompatible with `interiorAbsolute` or `endAbsolute`.
|
||||||
|
end?: Point2d,
|
||||||
|
/// The coefficients [a, b, c, d, e, f] of the generic conic equation ax^2 + by^2 + cxy + dx + ey + f = 0. If provided the start and end tangents will be calculated using this equation. Incompatible with `startTangent` and `endTangent`.
|
||||||
|
coefficients?: [number; 6],
|
||||||
|
/// The tangent of the conic section at the start. If not provided the tangent of the previous path segment is used. Incompatible with `coefficients`.
|
||||||
|
startTangent?: Point2d,
|
||||||
|
/// The tangent of the conic section at the end. Incompatible with `coefficients`.
|
||||||
|
endTangent?: Point2d,
|
||||||
|
/// Create a new tag which refers to this segment.
|
||||||
|
tag?: tag,
|
||||||
|
): Sketch {}
|
||||||
|
|
||||||
|
/// Add a parabolic segment to an existing sketch.
|
||||||
|
///
|
||||||
|
/// ```kcl
|
||||||
|
/// exampleSketch = startSketchOn(XY)
|
||||||
|
/// |> startProfile(at = [0,0])
|
||||||
|
/// |> parabolic(
|
||||||
|
/// end = [10,0],
|
||||||
|
/// coefficients = [2, 0, 0],
|
||||||
|
/// )
|
||||||
|
/// |>close()
|
||||||
|
///```
|
||||||
|
@(impl = std_rust)
|
||||||
|
export fn parabolic(
|
||||||
|
/// Which sketch should this path be added to?
|
||||||
|
@sketch: Sketch,
|
||||||
|
/// Where should the path end? Relative to the start point. Incompatible with `interiorAbsolute` or `endAbsolute`.
|
||||||
|
end: Point2d,
|
||||||
|
/// Where should this segment end? Requires `interiorAbsolute`. Incompatible with `interior` or `end`.
|
||||||
|
endAbsolute?: Point2d,
|
||||||
|
/// The coefficients [a, b, c] of the parabolic equation y = ax^2 + bx + c. Incompatible with `interior`.
|
||||||
|
coefficients?: [number; 3],
|
||||||
|
/// A point between the segment's start and end that lies on the parabola. Incompatible with `coefficients` or `interiorAbsolute` or `endAbsolute`.
|
||||||
|
interior?: Point2d,
|
||||||
|
/// Any point between the segment's start and end. Requires `endAbsolute`. Incompatible with `coefficients` or `interior` or `end`.
|
||||||
|
interiorAbsolute?: Point2d,
|
||||||
|
/// Create a new tag which refers to this segment.
|
||||||
|
tag?: tag,
|
||||||
|
): Sketch {}
|
||||||
|
|
||||||
|
/// Calculate the point (x, y) on a parabola given x or y and the coefficients [a, b, c] of the parabola.
|
||||||
|
///
|
||||||
|
/// ```kcl
|
||||||
|
/// point001 = parabolicPoint(x = 5, coefficients = [0.1, 0, 0])
|
||||||
|
/// point002 = parabolicPoint(y = 2.5, coefficients = [0.1, 0, 0])
|
||||||
|
/// assert(point001[0], isEqualTo = point002[0])
|
||||||
|
/// assert(point001[1], isEqualTo = point002[1])
|
||||||
|
///```
|
||||||
|
@(impl = std_rust)
|
||||||
|
export fn parabolicPoint(
|
||||||
|
/// The coefficients [a, b, c] of the parabolic equation y = ax^2 + bx + c.
|
||||||
|
coefficients: [number; 3],
|
||||||
|
/// The x value. Calculates y and returns (x, y). Incompatible with `y`.
|
||||||
|
x?: number(Length),
|
||||||
|
/// The y value. Calculates x and returns (x, y). Incompatible with `x`.
|
||||||
|
y?: number(Length),
|
||||||
|
): Point2d {}
|
||||||
|
|
||||||
|
/// Add a hyperbolic section to an existing sketch.
|
||||||
|
///
|
||||||
|
/// ```kcl
|
||||||
|
/// exampleSketch = startSketchOn(XY)
|
||||||
|
/// |> startProfile(at = [0,0])
|
||||||
|
/// |> hyperbolic(
|
||||||
|
/// end = [10,0],
|
||||||
|
/// semiMajor = 2,
|
||||||
|
/// semiMinor = 1,
|
||||||
|
/// interior = [0,0]
|
||||||
|
/// )
|
||||||
|
/// |>close()
|
||||||
|
///```
|
||||||
|
@(impl = std_rust)
|
||||||
|
export fn hyperbolic(
|
||||||
|
/// Which sketch should this path be added to?
|
||||||
|
@sketch: Sketch,
|
||||||
|
/// The semi major value, a, of the hyperbolic equation x^2 / a ^ 2 - y^2 / b^2 = 1.
|
||||||
|
semiMajor: number(Length),
|
||||||
|
/// The semi minor value, b, of the hyperbolic equation x^2 / a ^ 2 - y^2 / b^2 = 1.
|
||||||
|
semiMinor: number(Length),
|
||||||
|
/// Any point between the segment's start and end. Requires `endAbsolute`. Incompatible with `interior` or `end`.
|
||||||
|
interiorAbsolute?: Point2d,
|
||||||
|
/// Where should this segment end? Requires `interiorAbsolute`. Incompatible with `interior` or `end`.
|
||||||
|
endAbsolute?: Point2d,
|
||||||
|
/// Any point between the segment's start and end. This point is relative to the start point. Requires `end`. Incompatible with `interiorAbsolute` or `endAbsolute`.
|
||||||
|
interior?: Point2d,
|
||||||
|
/// Where should this segment end? This point is relative to the start point. Requires `interior`. Incompatible with `interiorAbsolute` or `endAbsolute`.
|
||||||
|
end?: Point2d,
|
||||||
|
/// Create a new tag which refers to this arc.
|
||||||
|
tag?: tag,
|
||||||
|
): Sketch {}
|
||||||
|
|
||||||
|
/// Calculate the point (x, y) on a hyperbola given x or y and the semi major/minor values of the hyperbolic.
|
||||||
|
///
|
||||||
|
/// ```kcl
|
||||||
|
/// point = hyperbolicPoint(x = 5, semiMajor = 2, semiMinor = 1)
|
||||||
|
///```
|
||||||
|
@(impl = std_rust)
|
||||||
|
export fn hyperbolicPoint(
|
||||||
|
/// The semi major value, a, of the hyperbolic equation x^2 / a ^ 2 - y^2 / b^2 = 1.
|
||||||
|
semiMajor: number,
|
||||||
|
/// The semi minor value, b, of the hyperbolic equation x^2 / a ^ 2 - y^2 / b^2 = 1.
|
||||||
|
semiMinor: number,
|
||||||
|
/// The x value. Calculates y and returns (x, y). Incompatible with `y`.
|
||||||
|
x?: number(Length),
|
||||||
|
/// The y value. Calculates x and returns (x, y). Incompatible with `x`.
|
||||||
|
y?: number(Length),
|
||||||
|
): Point2d {}
|
||||||
|
|
||||||
|
/// Add a parabolic section to an existing sketch.
|
||||||
|
///
|
||||||
|
/// ```kcl
|
||||||
|
/// majorRadius = 2
|
||||||
|
/// minorRadius = 1
|
||||||
|
/// ellip = ellipticPoint(majorRadius, minorRadius, x = 2)
|
||||||
|
///
|
||||||
|
/// exampleSketch = startSketchOn(XY)
|
||||||
|
/// |> startProfile(at = ellip, tag = $start)
|
||||||
|
/// |> elliptic(center = [0, 0], angleStart = segAng(start), angleEnd = 160, majorRadius, minorRadius)
|
||||||
|
/// |> close()
|
||||||
|
/// example = extrude(exampleSketch, length = 10)
|
||||||
|
/// ```
|
||||||
|
@(impl = std_rust)
|
||||||
|
export fn elliptic(
|
||||||
|
/// Which sketch should this path be added to?
|
||||||
|
@sketch: Sketch,
|
||||||
|
/// The center of the ellipse.
|
||||||
|
@(snippetArray = ["0", "0"])
|
||||||
|
center: Point2d,
|
||||||
|
/// Where along the ellptic should this segment start?
|
||||||
|
@(includeInSnippet = true)
|
||||||
|
angleStart: number(Angle),
|
||||||
|
/// Where along the ellptic should this segment end?
|
||||||
|
@(includeInSnippet = true)
|
||||||
|
angleEnd: number(Angle),
|
||||||
|
/// The major radius, a, of the elliptic equation x^2 / a^2 + y^2 / b^2 = 1.
|
||||||
|
@(includeInSnippet = true)
|
||||||
|
majorRadius: number(Length),
|
||||||
|
/// The minor radius, b, of the elliptic equation x^2 / a^2 + y^2 / b^2 = 1.
|
||||||
|
@(includeInSnippet = true)
|
||||||
|
minorRadius: number(Length),
|
||||||
|
/// Create a new tag which refers to this arc.
|
||||||
|
tag?: tag,
|
||||||
|
): Sketch {}
|
||||||
|
|
||||||
|
/// Calculate the point (x, y) on an ellipse given x or y and the center and major/minor radii of the ellipse.
|
||||||
|
///
|
||||||
|
/// ```kcl
|
||||||
|
/// point001 = ellipticPoint(x = 2, majorRadius = 2, minorRadius = 1)
|
||||||
|
/// point002 = ellipticPoint(y = 0, majorRadius = 2, minorRadius = 1)
|
||||||
|
/// assert(point001[0], isEqualTo = point002[0])
|
||||||
|
/// assert(point001[1], isEqualTo = point002[1])
|
||||||
|
///```
|
||||||
|
@(impl = std_rust)
|
||||||
|
export fn ellipticPoint(
|
||||||
|
/// The major radius, a, of the elliptic equation x^2 / a ^ 2 + y^2 / b^2 = 1.
|
||||||
|
majorRadius: number,
|
||||||
|
/// The minor radius, b, of the hyperbolic equation x^2 / a ^ 2 + y^2 / b^2 = 1.
|
||||||
|
minorRadius: number,
|
||||||
|
/// The x value. Calculates y and returns (x, y). Incompatible with `y`.
|
||||||
|
x?: number(Length),
|
||||||
|
/// The y value. Calculates x and returns (x, y). Incompatible with `x`.
|
||||||
|
y?: number(Length),
|
||||||
|
): Point2d {}
|
||||||
|
|
||||||
|
/// Find the plane a face lies on.
|
||||||
|
/// Returns an error if the face doesn't lie on any plane (for example, the curved face of a cylinder)
|
||||||
|
///```kcl
|
||||||
|
/// triangle = startSketchOn(XY)
|
||||||
|
/// |> polygon(radius = 3, numSides = 3, center = [0, 0])
|
||||||
|
/// |> extrude(length = 2)
|
||||||
|
///
|
||||||
|
/// // Find the plane of the triangle's top face.
|
||||||
|
/// topPlane = planeOf(triangle, face = END)
|
||||||
|
///
|
||||||
|
/// // Create a new plane, 10 units above the triangle's top face.
|
||||||
|
/// startSketchOn(offsetPlane(topPlane, offset = 10))
|
||||||
|
/// ```
|
||||||
|
@(impl = std_rust)
|
||||||
|
export fn planeOf(
|
||||||
|
/// The solid whose face is being queried.
|
||||||
|
@solid: Solid,
|
||||||
|
/// Find the plane which this face lies on.
|
||||||
|
face: TaggedFace,
|
||||||
|
): Plane {}
|
||||||
|
18
rust/kcl-lib/tests/add_arrays/artifact_commands.snap
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Artifact commands add_arrays.kcl
|
||||||
|
---
|
||||||
|
{
|
||||||
|
"rust/kcl-lib/tests/add_arrays/input.kcl": [],
|
||||||
|
"std::appearance": [],
|
||||||
|
"std::array": [],
|
||||||
|
"std::math": [],
|
||||||
|
"std::prelude": [],
|
||||||
|
"std::sketch": [],
|
||||||
|
"std::solid": [],
|
||||||
|
"std::sweep": [],
|
||||||
|
"std::transform": [],
|
||||||
|
"std::turns": [],
|
||||||
|
"std::types": [],
|
||||||
|
"std::units": []
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Artifact graph flowchart add_arrays.kcl
|
||||||
|
extension: md
|
||||||
|
snapshot_kind: binary
|
||||||
|
---
|
@ -0,0 +1,3 @@
|
|||||||
|
```mermaid
|
||||||
|
flowchart LR
|
||||||
|
```
|
106
rust/kcl-lib/tests/add_arrays/ast.snap
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Result of parsing add_arrays.kcl
|
||||||
|
---
|
||||||
|
{
|
||||||
|
"Ok": {
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"commentStart": 0,
|
||||||
|
"declaration": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"id": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "answer",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"init": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"left": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"raw": "0",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 0.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"raw": "1",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 1.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "ArrayExpression",
|
||||||
|
"type": "ArrayExpression"
|
||||||
|
},
|
||||||
|
"moduleId": 0,
|
||||||
|
"operator": "+",
|
||||||
|
"right": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"raw": "2",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 2.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "ArrayExpression",
|
||||||
|
"type": "ArrayExpression"
|
||||||
|
},
|
||||||
|
"start": 0,
|
||||||
|
"type": "BinaryExpression",
|
||||||
|
"type": "BinaryExpression"
|
||||||
|
},
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "VariableDeclarator"
|
||||||
|
},
|
||||||
|
"end": 0,
|
||||||
|
"kind": "const",
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"type": "VariableDeclaration"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0
|
||||||
|
}
|
||||||
|
}
|
12
rust/kcl-lib/tests/add_arrays/execution_error.snap
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Error from executing add_arrays.kcl
|
||||||
|
---
|
||||||
|
KCL Semantic error
|
||||||
|
|
||||||
|
× semantic: Expected a number, but found an array of `number`, `number`
|
||||||
|
╭────
|
||||||
|
1 │ answer = [0, 1] + [2]
|
||||||
|
· ───┬──
|
||||||
|
· ╰── tests/add_arrays/input.kcl
|
||||||
|
╰────
|
1
rust/kcl-lib/tests/add_arrays/input.kcl
Normal file
@ -0,0 +1 @@
|
|||||||
|
answer = [0, 1] + [2]
|
96
rust/kcl-lib/tests/add_arrays/ops.snap
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Operations executed add_arrays.kcl
|
||||||
|
---
|
||||||
|
{
|
||||||
|
"rust/kcl-lib/tests/add_arrays/input.kcl": [],
|
||||||
|
"std::appearance": [],
|
||||||
|
"std::array": [],
|
||||||
|
"std::math": [
|
||||||
|
{
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"name": "PI",
|
||||||
|
"value": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Unknown"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"visibility": "export",
|
||||||
|
"nodePath": {
|
||||||
|
"steps": []
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"name": "E",
|
||||||
|
"value": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"visibility": "export",
|
||||||
|
"nodePath": {
|
||||||
|
"steps": []
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"name": "TAU",
|
||||||
|
"value": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"visibility": "export",
|
||||||
|
"nodePath": {
|
||||||
|
"steps": []
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"std::prelude": [
|
||||||
|
{
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"name": "START",
|
||||||
|
"value": {
|
||||||
|
"type": "String",
|
||||||
|
"value": "start"
|
||||||
|
},
|
||||||
|
"visibility": "export",
|
||||||
|
"nodePath": {
|
||||||
|
"steps": []
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"name": "END",
|
||||||
|
"value": {
|
||||||
|
"type": "String",
|
||||||
|
"value": "end"
|
||||||
|
},
|
||||||
|
"visibility": "export",
|
||||||
|
"nodePath": {
|
||||||
|
"steps": []
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"std::sketch": [],
|
||||||
|
"std::solid": [],
|
||||||
|
"std::sweep": [],
|
||||||
|
"std::transform": [],
|
||||||
|
"std::turns": [],
|
||||||
|
"std::types": [],
|
||||||
|
"std::units": []
|
||||||
|
}
|
5
rust/kcl-lib/tests/add_arrays/unparsed.snap
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Result of unparsing add_arrays.kcl
|
||||||
|
---
|
||||||
|
answer = [0, 1] + [2]
|
60
rust/kcl-lib/tests/inputs/planestuff.kcl
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
// There are 3 ways to define a plane in KCL, according to https://zoo.dev/docs/kcl-std/types/std-types-Plane
|
||||||
|
// - A default plane
|
||||||
|
// - Modifying a default plane e.g. via offsetPlane
|
||||||
|
// - Defining your own struct
|
||||||
|
// This file tests they all work equivalently.
|
||||||
|
|
||||||
|
// Define a plane using struct representation.
|
||||||
|
myPlane = {
|
||||||
|
origin = { x = 0, y = 0, z = 0 },
|
||||||
|
xAxis = { x = 1, y = 0, z = 0 },
|
||||||
|
yAxis = { x = 0, y = 1, z = 0 },
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prove we can get its axes and origin.
|
||||||
|
ax = myPlane.xAxis
|
||||||
|
assert(ax[0], isEqualTo = 1)
|
||||||
|
assert(ax[1], isEqualTo = 0)
|
||||||
|
assert(ax[2], isEqualTo = 0)
|
||||||
|
ay = myPlane.yAxis
|
||||||
|
assert(ay[0], isEqualTo = 0)
|
||||||
|
assert(ay[1], isEqualTo = 1)
|
||||||
|
assert(ay[2], isEqualTo = 0)
|
||||||
|
aorigin = myPlane.origin
|
||||||
|
assert(aorigin[0], isEqualTo = 0)
|
||||||
|
assert(aorigin[1], isEqualTo = 0)
|
||||||
|
assert(aorigin[2], isEqualTo = 0)
|
||||||
|
|
||||||
|
// Define a plane using standard planes.
|
||||||
|
myOtherPlane = XY
|
||||||
|
|
||||||
|
// Prove we can get its axes and origin.
|
||||||
|
axOther = myOtherPlane.xAxis
|
||||||
|
assert(axOther[0], isEqualTo = 1)
|
||||||
|
assert(axOther[1], isEqualTo = 0)
|
||||||
|
assert(axOther[2], isEqualTo = 0)
|
||||||
|
ayOther = myOtherPlane.yAxis
|
||||||
|
assert(ayOther[0], isEqualTo = 0)
|
||||||
|
assert(ayOther[1], isEqualTo = 1)
|
||||||
|
assert(ayOther[2], isEqualTo = 0)
|
||||||
|
aoriginOther = myOtherPlane.origin
|
||||||
|
assert(aoriginOther[0], isEqualTo = 0)
|
||||||
|
assert(aoriginOther[1], isEqualTo = 0)
|
||||||
|
assert(aoriginOther[2], isEqualTo = 0)
|
||||||
|
|
||||||
|
// Define a plane using a plane-modifying function like offsetPlane.
|
||||||
|
myAlternatePlane = offsetPlane(XY, offset = 0)
|
||||||
|
|
||||||
|
// Prove we can get its axes and origin.
|
||||||
|
axAlternate = myAlternatePlane.xAxis
|
||||||
|
assert(axAlternate[0], isEqualTo = 1)
|
||||||
|
assert(axAlternate[1], isEqualTo = 0)
|
||||||
|
assert(axAlternate[2], isEqualTo = 0)
|
||||||
|
ayAlternate = myAlternatePlane.yAxis
|
||||||
|
assert(ayAlternate[0], isEqualTo = 0)
|
||||||
|
assert(ayAlternate[1], isEqualTo = 1)
|
||||||
|
assert(ayAlternate[2], isEqualTo = 0)
|
||||||
|
aoriginAlternate = myAlternatePlane.origin
|
||||||
|
assert(aoriginAlternate[0], isEqualTo = 0)
|
||||||
|
assert(aoriginAlternate[1], isEqualTo = 0)
|
||||||
|
assert(aoriginAlternate[2], isEqualTo = 0)
|
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 24 KiB |
381
rust/kcl-lib/tests/plane_of/artifact_commands.snap
Normal file
@ -0,0 +1,381 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Artifact commands plane_of.kcl
|
||||||
|
---
|
||||||
|
{
|
||||||
|
"rust/kcl-lib/tests/plane_of/input.kcl": [
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "make_plane",
|
||||||
|
"origin": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"x_axis": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"y_axis": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 1.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"size": 60.0,
|
||||||
|
"clobber": false,
|
||||||
|
"hide": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "enable_sketch_mode",
|
||||||
|
"entity_id": "[uuid]",
|
||||||
|
"ortho": false,
|
||||||
|
"animated": false,
|
||||||
|
"adjust_camera": false,
|
||||||
|
"planar_normal": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 1.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "start_path"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "move_path_pen",
|
||||||
|
"path": "[uuid]",
|
||||||
|
"to": {
|
||||||
|
"x": 2743.2,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "sketch_mode_disable"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "extend_path",
|
||||||
|
"path": "[uuid]",
|
||||||
|
"segment": {
|
||||||
|
"type": "line",
|
||||||
|
"end": {
|
||||||
|
"x": -1371.5999999999995,
|
||||||
|
"y": 2375.680887661472,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"relative": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "extend_path",
|
||||||
|
"path": "[uuid]",
|
||||||
|
"segment": {
|
||||||
|
"type": "line",
|
||||||
|
"end": {
|
||||||
|
"x": -1371.6000000000013,
|
||||||
|
"y": -2375.680887661472,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"relative": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "extend_path",
|
||||||
|
"path": "[uuid]",
|
||||||
|
"segment": {
|
||||||
|
"type": "line",
|
||||||
|
"end": {
|
||||||
|
"x": 2743.2,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"relative": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "close_path",
|
||||||
|
"path_id": "[uuid]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "enable_sketch_mode",
|
||||||
|
"entity_id": "[uuid]",
|
||||||
|
"ortho": false,
|
||||||
|
"animated": false,
|
||||||
|
"adjust_camera": false,
|
||||||
|
"planar_normal": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 1.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "extrude",
|
||||||
|
"target": "[uuid]",
|
||||||
|
"distance": 1828.8,
|
||||||
|
"faces": null,
|
||||||
|
"opposite": "None"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "sketch_mode_disable"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "object_bring_to_front",
|
||||||
|
"object_id": "[uuid]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "solid3d_get_extrusion_face_info",
|
||||||
|
"object_id": "[uuid]",
|
||||||
|
"edge_id": "[uuid]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "solid3d_get_adjacency_info",
|
||||||
|
"object_id": "[uuid]",
|
||||||
|
"edge_id": "[uuid]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "face_is_planar",
|
||||||
|
"object_id": "[uuid]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "make_plane",
|
||||||
|
"origin": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 3657.6
|
||||||
|
},
|
||||||
|
"x_axis": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"y_axis": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 1.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"size": 100.0,
|
||||||
|
"clobber": false,
|
||||||
|
"hide": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "plane_set_color",
|
||||||
|
"plane_id": "[uuid]",
|
||||||
|
"color": {
|
||||||
|
"r": 0.6,
|
||||||
|
"g": 0.6,
|
||||||
|
"b": 0.6,
|
||||||
|
"a": 0.3
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "object_visible",
|
||||||
|
"object_id": "[uuid]",
|
||||||
|
"hidden": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "enable_sketch_mode",
|
||||||
|
"entity_id": "[uuid]",
|
||||||
|
"ortho": false,
|
||||||
|
"animated": false,
|
||||||
|
"adjust_camera": false,
|
||||||
|
"planar_normal": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 1.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "start_path"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "move_path_pen",
|
||||||
|
"path": "[uuid]",
|
||||||
|
"to": {
|
||||||
|
"x": 1828.8,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "sketch_mode_disable"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "extend_path",
|
||||||
|
"path": "[uuid]",
|
||||||
|
"segment": {
|
||||||
|
"type": "line",
|
||||||
|
"end": {
|
||||||
|
"x": 0.00000000000011198170331403397,
|
||||||
|
"y": 1828.8,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"relative": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "extend_path",
|
||||||
|
"path": "[uuid]",
|
||||||
|
"segment": {
|
||||||
|
"type": "line",
|
||||||
|
"end": {
|
||||||
|
"x": -1828.8,
|
||||||
|
"y": 0.00000000000022396340662806795,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"relative": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "extend_path",
|
||||||
|
"path": "[uuid]",
|
||||||
|
"segment": {
|
||||||
|
"type": "line",
|
||||||
|
"end": {
|
||||||
|
"x": -0.0000000000003359451099421019,
|
||||||
|
"y": -1828.8,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"relative": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "extend_path",
|
||||||
|
"path": "[uuid]",
|
||||||
|
"segment": {
|
||||||
|
"type": "line",
|
||||||
|
"end": {
|
||||||
|
"x": 1828.8,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"relative": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "close_path",
|
||||||
|
"path_id": "[uuid]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"std::appearance": [],
|
||||||
|
"std::array": [],
|
||||||
|
"std::math": [],
|
||||||
|
"std::prelude": [],
|
||||||
|
"std::sketch": [],
|
||||||
|
"std::solid": [],
|
||||||
|
"std::sweep": [],
|
||||||
|
"std::transform": [],
|
||||||
|
"std::turns": [],
|
||||||
|
"std::types": [],
|
||||||
|
"std::units": []
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Artifact graph flowchart plane_of.kcl
|
||||||
|
extension: md
|
||||||
|
snapshot_kind: binary
|
||||||
|
---
|
105
rust/kcl-lib/tests/plane_of/artifact_graph_flowchart.snap.md
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
```mermaid
|
||||||
|
flowchart LR
|
||||||
|
subgraph path2 [Path]
|
||||||
|
2["Path<br>[64, 114, 0]"]
|
||||||
|
%% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
|
||||||
|
3["Segment<br>[64, 114, 0]"]
|
||||||
|
%% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
|
||||||
|
4["Segment<br>[64, 114, 0]"]
|
||||||
|
%% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
|
||||||
|
5["Segment<br>[64, 114, 0]"]
|
||||||
|
%% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
|
||||||
|
6["Segment<br>[64, 114, 0]"]
|
||||||
|
%% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
|
||||||
|
7[Solid2d]
|
||||||
|
end
|
||||||
|
subgraph path21 [Path]
|
||||||
|
21["Path<br>[311, 361, 0]"]
|
||||||
|
%% [ProgramBodyItem { index: 2 }, ExpressionStatementExpr, PipeBodyItem { index: 1 }]
|
||||||
|
22["Segment<br>[311, 361, 0]"]
|
||||||
|
%% [ProgramBodyItem { index: 2 }, ExpressionStatementExpr, PipeBodyItem { index: 1 }]
|
||||||
|
23["Segment<br>[311, 361, 0]"]
|
||||||
|
%% [ProgramBodyItem { index: 2 }, ExpressionStatementExpr, PipeBodyItem { index: 1 }]
|
||||||
|
24["Segment<br>[311, 361, 0]"]
|
||||||
|
%% [ProgramBodyItem { index: 2 }, ExpressionStatementExpr, PipeBodyItem { index: 1 }]
|
||||||
|
25["Segment<br>[311, 361, 0]"]
|
||||||
|
%% [ProgramBodyItem { index: 2 }, ExpressionStatementExpr, PipeBodyItem { index: 1 }]
|
||||||
|
26["Segment<br>[311, 361, 0]"]
|
||||||
|
%% [ProgramBodyItem { index: 2 }, ExpressionStatementExpr, PipeBodyItem { index: 1 }]
|
||||||
|
27[Solid2d]
|
||||||
|
end
|
||||||
|
1["Plane<br>[41, 58, 0]"]
|
||||||
|
%% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }]
|
||||||
|
8["Sweep Extrusion<br>[120, 139, 0]"]
|
||||||
|
%% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 2 }]
|
||||||
|
9[Wall]
|
||||||
|
%% face_code_ref=Missing NodePath
|
||||||
|
10[Wall]
|
||||||
|
%% face_code_ref=Missing NodePath
|
||||||
|
11[Wall]
|
||||||
|
%% face_code_ref=Missing NodePath
|
||||||
|
12["Cap Start"]
|
||||||
|
%% face_code_ref=Missing NodePath
|
||||||
|
13["Cap End"]
|
||||||
|
%% face_code_ref=Missing NodePath
|
||||||
|
14["SweepEdge Opposite"]
|
||||||
|
15["SweepEdge Adjacent"]
|
||||||
|
16["SweepEdge Opposite"]
|
||||||
|
17["SweepEdge Adjacent"]
|
||||||
|
18["SweepEdge Opposite"]
|
||||||
|
19["SweepEdge Adjacent"]
|
||||||
|
20["Plane<br>[277, 304, 0]"]
|
||||||
|
%% [ProgramBodyItem { index: 2 }, ExpressionStatementExpr, PipeBodyItem { index: 0 }, CallKwUnlabeledArg]
|
||||||
|
28["StartSketchOnPlane<br>[263, 305, 0]"]
|
||||||
|
%% [ProgramBodyItem { index: 2 }, ExpressionStatementExpr, PipeBodyItem { index: 0 }]
|
||||||
|
1 --- 2
|
||||||
|
2 --- 3
|
||||||
|
2 --- 4
|
||||||
|
2 --- 5
|
||||||
|
2 --- 6
|
||||||
|
2 --- 7
|
||||||
|
2 ---- 8
|
||||||
|
3 --- 9
|
||||||
|
3 x--> 12
|
||||||
|
3 --- 14
|
||||||
|
3 --- 15
|
||||||
|
4 --- 10
|
||||||
|
4 x--> 12
|
||||||
|
4 --- 16
|
||||||
|
4 --- 17
|
||||||
|
5 --- 11
|
||||||
|
5 x--> 12
|
||||||
|
5 --- 18
|
||||||
|
5 --- 19
|
||||||
|
8 --- 9
|
||||||
|
8 --- 10
|
||||||
|
8 --- 11
|
||||||
|
8 --- 12
|
||||||
|
8 --- 13
|
||||||
|
8 --- 14
|
||||||
|
8 --- 15
|
||||||
|
8 --- 16
|
||||||
|
8 --- 17
|
||||||
|
8 --- 18
|
||||||
|
8 --- 19
|
||||||
|
9 --- 14
|
||||||
|
9 --- 15
|
||||||
|
19 <--x 9
|
||||||
|
15 <--x 10
|
||||||
|
10 --- 16
|
||||||
|
10 --- 17
|
||||||
|
17 <--x 11
|
||||||
|
11 --- 18
|
||||||
|
11 --- 19
|
||||||
|
14 <--x 13
|
||||||
|
16 <--x 13
|
||||||
|
18 <--x 13
|
||||||
|
20 --- 21
|
||||||
|
20 <--x 28
|
||||||
|
21 --- 22
|
||||||
|
21 --- 23
|
||||||
|
21 --- 24
|
||||||
|
21 --- 25
|
||||||
|
21 --- 26
|
||||||
|
21 --- 27
|
||||||
|
```
|
705
rust/kcl-lib/tests/plane_of/ast.snap
Normal file
@ -0,0 +1,705 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Result of parsing plane_of.kcl
|
||||||
|
---
|
||||||
|
{
|
||||||
|
"Ok": {
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"commentStart": 0,
|
||||||
|
"declaration": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"id": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "tri",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"init": {
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"arguments": [],
|
||||||
|
"callee": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "startSketchOn",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name"
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "XY",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name",
|
||||||
|
"type": "Name"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "radius",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"raw": "3",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 3.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "numSides",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"raw": "3",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 3.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "center",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"raw": "0",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 0.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"raw": "0",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 0.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "ArrayExpression",
|
||||||
|
"type": "ArrayExpression"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"callee": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "polygon",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name"
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "length",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"raw": "2",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 2.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"callee": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "extrude",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name"
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"nonCodeMeta": {
|
||||||
|
"nonCodeNodes": {
|
||||||
|
"2": [
|
||||||
|
{
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "NonCodeNode",
|
||||||
|
"value": {
|
||||||
|
"type": "newLineBlockComment",
|
||||||
|
"value": "Get the plane which `tri` ends on.",
|
||||||
|
"style": "line"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"startNodes": []
|
||||||
|
},
|
||||||
|
"start": 0,
|
||||||
|
"type": "PipeExpression",
|
||||||
|
"type": "PipeExpression"
|
||||||
|
},
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "VariableDeclarator"
|
||||||
|
},
|
||||||
|
"end": 0,
|
||||||
|
"kind": "const",
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"type": "VariableDeclaration"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"commentStart": 0,
|
||||||
|
"declaration": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"id": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "p0",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"init": {
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "face",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "END",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name",
|
||||||
|
"type": "Name"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"callee": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "planeOf",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name"
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "tri",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name",
|
||||||
|
"type": "Name"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "VariableDeclarator"
|
||||||
|
},
|
||||||
|
"end": 0,
|
||||||
|
"kind": "const",
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"type": "VariableDeclaration"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"expression": {
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"arguments": [],
|
||||||
|
"callee": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "startSketchOn",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name"
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": {
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "offset",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"raw": "2",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 2.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"callee": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "offsetPlane",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name"
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "p0",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name",
|
||||||
|
"type": "Name"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "radius",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"raw": "2",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 2.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "numSides",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"raw": "4",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 4.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "center",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"raw": "0",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 0.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"raw": "0",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 0.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "ArrayExpression",
|
||||||
|
"type": "ArrayExpression"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"callee": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "polygon",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name"
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "PipeExpression",
|
||||||
|
"type": "PipeExpression"
|
||||||
|
},
|
||||||
|
"moduleId": 0,
|
||||||
|
"preComments": [
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"// Offset that plane by 2, then draw a square on it."
|
||||||
|
],
|
||||||
|
"start": 0,
|
||||||
|
"type": "ExpressionStatement",
|
||||||
|
"type": "ExpressionStatement"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"innerAttrs": [
|
||||||
|
{
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "settings",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"key": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "defaultLengthUnit",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "ObjectProperty",
|
||||||
|
"value": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "yd",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name",
|
||||||
|
"type": "Name"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Annotation"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"moduleId": 0,
|
||||||
|
"nonCodeMeta": {
|
||||||
|
"nonCodeNodes": {
|
||||||
|
"2": [
|
||||||
|
{
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "NonCodeNode",
|
||||||
|
"value": {
|
||||||
|
"type": "newLine"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"startNodes": [
|
||||||
|
{
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "NonCodeNode",
|
||||||
|
"value": {
|
||||||
|
"type": "newLine"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"start": 0
|
||||||
|
}
|
||||||
|
}
|
13
rust/kcl-lib/tests/plane_of/input.kcl
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
@settings(defaultLengthUnit = yd)
|
||||||
|
|
||||||
|
tri = startSketchOn(XY)
|
||||||
|
|> polygon(radius = 3, numSides = 3, center = [0, 0])
|
||||||
|
|> extrude(length = 2)
|
||||||
|
|
||||||
|
// Get the plane which `tri` ends on.
|
||||||
|
p0 = planeOf(tri, face = END)
|
||||||
|
|
||||||
|
// Offset that plane by 2, then draw a square on it.
|
||||||
|
startSketchOn(offsetPlane(p0, offset = 2))
|
||||||
|
|> polygon(radius = 2, numSides = 4, center = [0, 0])
|
||||||
|
|
254
rust/kcl-lib/tests/plane_of/ops.snap
Normal file
@ -0,0 +1,254 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Operations executed plane_of.kcl
|
||||||
|
---
|
||||||
|
{
|
||||||
|
"rust/kcl-lib/tests/plane_of/input.kcl": [
|
||||||
|
{
|
||||||
|
"type": "StdLibCall",
|
||||||
|
"name": "startSketchOn",
|
||||||
|
"unlabeledArg": {
|
||||||
|
"value": {
|
||||||
|
"type": "Plane",
|
||||||
|
"artifact_id": "[uuid]"
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
"labeledArgs": {},
|
||||||
|
"nodePath": {
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"type": "ProgramBodyItem",
|
||||||
|
"index": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "VariableDeclarationDeclaration"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "VariableDeclarationInit"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "PipeBodyItem",
|
||||||
|
"index": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "StdLibCall",
|
||||||
|
"name": "extrude",
|
||||||
|
"unlabeledArg": {
|
||||||
|
"value": {
|
||||||
|
"type": "Sketch",
|
||||||
|
"value": {
|
||||||
|
"artifactId": "[uuid]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
"labeledArgs": {
|
||||||
|
"length": {
|
||||||
|
"value": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.0,
|
||||||
|
"ty": {
|
||||||
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Yards"
|
||||||
|
},
|
||||||
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nodePath": {
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"type": "ProgramBodyItem",
|
||||||
|
"index": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "VariableDeclarationDeclaration"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "VariableDeclarationInit"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "PipeBodyItem",
|
||||||
|
"index": 2
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "StdLibCall",
|
||||||
|
"name": "offsetPlane",
|
||||||
|
"unlabeledArg": {
|
||||||
|
"value": {
|
||||||
|
"type": "Plane",
|
||||||
|
"artifact_id": "[uuid]"
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
"labeledArgs": {
|
||||||
|
"offset": {
|
||||||
|
"value": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.0,
|
||||||
|
"ty": {
|
||||||
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Yards"
|
||||||
|
},
|
||||||
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nodePath": {
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"type": "ProgramBodyItem",
|
||||||
|
"index": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ExpressionStatementExpr"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "PipeBodyItem",
|
||||||
|
"index": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "CallKwUnlabeledArg"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "StdLibCall",
|
||||||
|
"name": "startSketchOn",
|
||||||
|
"unlabeledArg": {
|
||||||
|
"value": {
|
||||||
|
"type": "Plane",
|
||||||
|
"artifact_id": "[uuid]"
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
"labeledArgs": {},
|
||||||
|
"nodePath": {
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"type": "ProgramBodyItem",
|
||||||
|
"index": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ExpressionStatementExpr"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "PipeBodyItem",
|
||||||
|
"index": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"std::appearance": [],
|
||||||
|
"std::array": [],
|
||||||
|
"std::math": [
|
||||||
|
{
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"name": "PI",
|
||||||
|
"value": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Unknown"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"visibility": "export",
|
||||||
|
"nodePath": {
|
||||||
|
"steps": []
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"name": "E",
|
||||||
|
"value": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"visibility": "export",
|
||||||
|
"nodePath": {
|
||||||
|
"steps": []
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"name": "TAU",
|
||||||
|
"value": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"visibility": "export",
|
||||||
|
"nodePath": {
|
||||||
|
"steps": []
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"std::prelude": [
|
||||||
|
{
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"name": "START",
|
||||||
|
"value": {
|
||||||
|
"type": "String",
|
||||||
|
"value": "start"
|
||||||
|
},
|
||||||
|
"visibility": "export",
|
||||||
|
"nodePath": {
|
||||||
|
"steps": []
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"name": "END",
|
||||||
|
"value": {
|
||||||
|
"type": "String",
|
||||||
|
"value": "end"
|
||||||
|
},
|
||||||
|
"visibility": "export",
|
||||||
|
"nodePath": {
|
||||||
|
"steps": []
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"std::sketch": [],
|
||||||
|
"std::solid": [],
|
||||||
|
"std::sweep": [],
|
||||||
|
"std::transform": [],
|
||||||
|
"std::turns": [],
|
||||||
|
"std::types": [],
|
||||||
|
"std::units": []
|
||||||
|
}
|
192
rust/kcl-lib/tests/plane_of/program_memory.snap
Normal file
@ -0,0 +1,192 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Variables in memory after executing plane_of.kcl
|
||||||
|
---
|
||||||
|
{
|
||||||
|
"p0": {
|
||||||
|
"type": "Plane",
|
||||||
|
"value": {
|
||||||
|
"artifactId": "[uuid]",
|
||||||
|
"id": "[uuid]",
|
||||||
|
"origin": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 1828.8,
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"value": "Uninit",
|
||||||
|
"xAxis": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0,
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"yAxis": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 1.0,
|
||||||
|
"z": 0.0,
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tri": {
|
||||||
|
"type": "Solid",
|
||||||
|
"value": {
|
||||||
|
"type": "Solid",
|
||||||
|
"id": "[uuid]",
|
||||||
|
"artifactId": "[uuid]",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"faceId": "[uuid]",
|
||||||
|
"id": "[uuid]",
|
||||||
|
"sourceRange": [],
|
||||||
|
"tag": null,
|
||||||
|
"type": "extrudePlane"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faceId": "[uuid]",
|
||||||
|
"id": "[uuid]",
|
||||||
|
"sourceRange": [],
|
||||||
|
"tag": null,
|
||||||
|
"type": "extrudePlane"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faceId": "[uuid]",
|
||||||
|
"id": "[uuid]",
|
||||||
|
"sourceRange": [],
|
||||||
|
"tag": null,
|
||||||
|
"type": "extrudePlane"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sketch": {
|
||||||
|
"type": "Sketch",
|
||||||
|
"id": "[uuid]",
|
||||||
|
"paths": [
|
||||||
|
{
|
||||||
|
"__geoMeta": {
|
||||||
|
"id": "[uuid]",
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
"from": [
|
||||||
|
3.0,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"tag": null,
|
||||||
|
"to": [
|
||||||
|
-1.4999999999999993,
|
||||||
|
2.598076211353316
|
||||||
|
],
|
||||||
|
"type": "ToPoint",
|
||||||
|
"units": {
|
||||||
|
"type": "Yards"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__geoMeta": {
|
||||||
|
"id": "[uuid]",
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
"from": [
|
||||||
|
-1.4999999999999993,
|
||||||
|
2.598076211353316
|
||||||
|
],
|
||||||
|
"tag": null,
|
||||||
|
"to": [
|
||||||
|
-1.5000000000000013,
|
||||||
|
-2.5980762113533156
|
||||||
|
],
|
||||||
|
"type": "ToPoint",
|
||||||
|
"units": {
|
||||||
|
"type": "Yards"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__geoMeta": {
|
||||||
|
"id": "[uuid]",
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
"from": [
|
||||||
|
-1.5000000000000013,
|
||||||
|
-2.5980762113533156
|
||||||
|
],
|
||||||
|
"tag": null,
|
||||||
|
"to": [
|
||||||
|
3.0,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"type": "ToPoint",
|
||||||
|
"units": {
|
||||||
|
"type": "Yards"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"on": {
|
||||||
|
"artifactId": "[uuid]",
|
||||||
|
"id": "[uuid]",
|
||||||
|
"origin": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0,
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"type": "plane",
|
||||||
|
"value": "XY",
|
||||||
|
"xAxis": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0,
|
||||||
|
"units": {
|
||||||
|
"type": "Unknown"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"yAxis": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 1.0,
|
||||||
|
"z": 0.0,
|
||||||
|
"units": {
|
||||||
|
"type": "Unknown"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"start": {
|
||||||
|
"from": [
|
||||||
|
3.0,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"to": [
|
||||||
|
3.0,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"units": {
|
||||||
|
"type": "Yards"
|
||||||
|
},
|
||||||
|
"tag": null,
|
||||||
|
"__geoMeta": {
|
||||||
|
"id": "[uuid]",
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"artifactId": "[uuid]",
|
||||||
|
"originalId": "[uuid]",
|
||||||
|
"units": {
|
||||||
|
"type": "Yards"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"height": 2.0,
|
||||||
|
"startCapId": "[uuid]",
|
||||||
|
"endCapId": "[uuid]",
|
||||||
|
"units": {
|
||||||
|
"type": "Yards"
|
||||||
|
},
|
||||||
|
"sectional": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
BIN
rust/kcl-lib/tests/plane_of/rendered_model.png
Normal file
After Width: | Height: | Size: 53 KiB |
16
rust/kcl-lib/tests/plane_of/unparsed.snap
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Result of unparsing plane_of.kcl
|
||||||
|
---
|
||||||
|
@settings(defaultLengthUnit = yd)
|
||||||
|
|
||||||
|
tri = startSketchOn(XY)
|
||||||
|
|> polygon(radius = 3, numSides = 3, center = [0, 0])
|
||||||
|
|> extrude(length = 2)
|
||||||
|
|
||||||
|
// Get the plane which `tri` ends on.
|
||||||
|
p0 = planeOf(tri, face = END)
|
||||||
|
|
||||||
|
// Offset that plane by 2, then draw a square on it.
|
||||||
|
startSketchOn(offsetPlane(p0, offset = 2))
|
||||||
|
|> polygon(radius = 2, numSides = 4, center = [0, 0])
|
@ -0,0 +1,206 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Artifact commands property_access_not_found_on_solid.kcl
|
||||||
|
---
|
||||||
|
{
|
||||||
|
"rust/kcl-lib/tests/property_access_not_found_on_solid/input.kcl": [
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "make_plane",
|
||||||
|
"origin": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"x_axis": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"y_axis": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 1.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"size": 60.0,
|
||||||
|
"clobber": false,
|
||||||
|
"hide": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "enable_sketch_mode",
|
||||||
|
"entity_id": "[uuid]",
|
||||||
|
"ortho": false,
|
||||||
|
"animated": false,
|
||||||
|
"adjust_camera": false,
|
||||||
|
"planar_normal": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 1.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "start_path"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "move_path_pen",
|
||||||
|
"path": "[uuid]",
|
||||||
|
"to": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "sketch_mode_disable"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "extend_path",
|
||||||
|
"path": "[uuid]",
|
||||||
|
"segment": {
|
||||||
|
"type": "line",
|
||||||
|
"end": {
|
||||||
|
"x": 10.0,
|
||||||
|
"y": 10.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"relative": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "extend_path",
|
||||||
|
"path": "[uuid]",
|
||||||
|
"segment": {
|
||||||
|
"type": "line",
|
||||||
|
"end": {
|
||||||
|
"x": -20.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"relative": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "extend_path",
|
||||||
|
"path": "[uuid]",
|
||||||
|
"segment": {
|
||||||
|
"type": "line",
|
||||||
|
"end": {
|
||||||
|
"x": 10.0,
|
||||||
|
"y": -10.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"relative": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "close_path",
|
||||||
|
"path_id": "[uuid]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "enable_sketch_mode",
|
||||||
|
"entity_id": "[uuid]",
|
||||||
|
"ortho": false,
|
||||||
|
"animated": false,
|
||||||
|
"adjust_camera": false,
|
||||||
|
"planar_normal": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 1.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "extrude",
|
||||||
|
"target": "[uuid]",
|
||||||
|
"distance": 5.0,
|
||||||
|
"faces": null,
|
||||||
|
"opposite": "None"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "sketch_mode_disable"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "object_bring_to_front",
|
||||||
|
"object_id": "[uuid]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "solid3d_get_extrusion_face_info",
|
||||||
|
"object_id": "[uuid]",
|
||||||
|
"edge_id": "[uuid]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "solid3d_get_adjacency_info",
|
||||||
|
"object_id": "[uuid]",
|
||||||
|
"edge_id": "[uuid]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"std::appearance": [],
|
||||||
|
"std::array": [],
|
||||||
|
"std::math": [],
|
||||||
|
"std::prelude": [],
|
||||||
|
"std::sketch": [],
|
||||||
|
"std::solid": [],
|
||||||
|
"std::sweep": [],
|
||||||
|
"std::transform": [],
|
||||||
|
"std::turns": [],
|
||||||
|
"std::types": [],
|
||||||
|
"std::units": []
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Artifact graph flowchart property_access_not_found_on_solid.kcl
|
||||||
|
extension: md
|
||||||
|
snapshot_kind: binary
|
||||||
|
---
|
@ -0,0 +1,78 @@
|
|||||||
|
```mermaid
|
||||||
|
flowchart LR
|
||||||
|
subgraph path2 [Path]
|
||||||
|
2["Path<br>[52, 77, 0]"]
|
||||||
|
%% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, ReturnStatementArg, PipeBodyItem { index: 1 }]
|
||||||
|
3["Segment<br>[85, 119, 0]"]
|
||||||
|
%% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, ReturnStatementArg, PipeBodyItem { index: 2 }]
|
||||||
|
4["Segment<br>[127, 147, 0]"]
|
||||||
|
%% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, ReturnStatementArg, PipeBodyItem { index: 3 }]
|
||||||
|
5["Segment<br>[155, 176, 0]"]
|
||||||
|
%% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, ReturnStatementArg, PipeBodyItem { index: 4 }]
|
||||||
|
6["Segment<br>[184, 191, 0]"]
|
||||||
|
%% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, ReturnStatementArg, PipeBodyItem { index: 5 }]
|
||||||
|
7[Solid2d]
|
||||||
|
end
|
||||||
|
1["Plane<br>[27, 44, 0]"]
|
||||||
|
%% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, ReturnStatementArg, PipeBodyItem { index: 0 }]
|
||||||
|
8["Sweep Extrusion<br>[199, 235, 0]"]
|
||||||
|
%% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, ReturnStatementArg, PipeBodyItem { index: 6 }]
|
||||||
|
9[Wall]
|
||||||
|
%% face_code_ref=Missing NodePath
|
||||||
|
10[Wall]
|
||||||
|
%% face_code_ref=Missing NodePath
|
||||||
|
11[Wall]
|
||||||
|
%% face_code_ref=Missing NodePath
|
||||||
|
12["Cap Start"]
|
||||||
|
%% face_code_ref=Missing NodePath
|
||||||
|
13["Cap End"]
|
||||||
|
%% face_code_ref=Missing NodePath
|
||||||
|
14["SweepEdge Opposite"]
|
||||||
|
15["SweepEdge Adjacent"]
|
||||||
|
16["SweepEdge Opposite"]
|
||||||
|
17["SweepEdge Adjacent"]
|
||||||
|
18["SweepEdge Opposite"]
|
||||||
|
19["SweepEdge Adjacent"]
|
||||||
|
1 --- 2
|
||||||
|
2 --- 3
|
||||||
|
2 --- 4
|
||||||
|
2 --- 5
|
||||||
|
2 --- 6
|
||||||
|
2 --- 7
|
||||||
|
2 ---- 8
|
||||||
|
3 --- 9
|
||||||
|
3 x--> 12
|
||||||
|
3 --- 14
|
||||||
|
3 --- 15
|
||||||
|
4 --- 10
|
||||||
|
4 x--> 12
|
||||||
|
4 --- 16
|
||||||
|
4 --- 17
|
||||||
|
5 --- 11
|
||||||
|
5 x--> 12
|
||||||
|
5 --- 18
|
||||||
|
5 --- 19
|
||||||
|
8 --- 9
|
||||||
|
8 --- 10
|
||||||
|
8 --- 11
|
||||||
|
8 --- 12
|
||||||
|
8 --- 13
|
||||||
|
8 --- 14
|
||||||
|
8 --- 15
|
||||||
|
8 --- 16
|
||||||
|
8 --- 17
|
||||||
|
8 --- 18
|
||||||
|
8 --- 19
|
||||||
|
9 --- 14
|
||||||
|
9 --- 15
|
||||||
|
19 <--x 9
|
||||||
|
15 <--x 10
|
||||||
|
10 --- 16
|
||||||
|
10 --- 17
|
||||||
|
17 <--x 11
|
||||||
|
11 --- 18
|
||||||
|
11 --- 19
|
||||||
|
14 <--x 13
|
||||||
|
16 <--x 13
|
||||||
|
18 <--x 13
|
||||||
|
```
|
780
rust/kcl-lib/tests/property_access_not_found_on_solid/ast.snap
Normal file
@ -0,0 +1,780 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Result of parsing property_access_not_found_on_solid.kcl
|
||||||
|
---
|
||||||
|
{
|
||||||
|
"Ok": {
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"commentStart": 0,
|
||||||
|
"declaration": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"id": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "myFunction",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"init": {
|
||||||
|
"body": {
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"argument": {
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"arguments": [],
|
||||||
|
"callee": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "startSketchOn",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name"
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "XY",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name",
|
||||||
|
"type": "Name"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "at",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"raw": "0",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 0.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"raw": "0",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 0.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "ArrayExpression",
|
||||||
|
"type": "ArrayExpression"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"callee": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "startProfile",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name"
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "end",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"raw": "10",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 10.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"raw": "10",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 10.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "ArrayExpression",
|
||||||
|
"type": "ArrayExpression"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "tag",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "TagDeclarator",
|
||||||
|
"type": "TagDeclarator",
|
||||||
|
"value": "seg01"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"callee": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "line",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name"
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "end",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"argument": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"raw": "20",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 20.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"operator": "-",
|
||||||
|
"start": 0,
|
||||||
|
"type": "UnaryExpression",
|
||||||
|
"type": "UnaryExpression"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"raw": "0",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 0.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "ArrayExpression",
|
||||||
|
"type": "ArrayExpression"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"callee": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "line",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name"
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "end",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"raw": "10",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 10.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"argument": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"raw": "10",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 10.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"operator": "-",
|
||||||
|
"start": 0,
|
||||||
|
"type": "UnaryExpression",
|
||||||
|
"type": "UnaryExpression"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "ArrayExpression",
|
||||||
|
"type": "ArrayExpression"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"callee": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "line",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name"
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"arguments": [],
|
||||||
|
"callee": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "close",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name"
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "length",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"raw": "5",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 5.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "tagEnd",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "TagDeclarator",
|
||||||
|
"type": "TagDeclarator",
|
||||||
|
"value": "end01"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"callee": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "extrude",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name"
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "PipeExpression",
|
||||||
|
"type": "PipeExpression"
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "ReturnStatement",
|
||||||
|
"type": "ReturnStatement"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"params": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "FunctionExpression",
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "VariableDeclarator"
|
||||||
|
},
|
||||||
|
"end": 0,
|
||||||
|
"kind": "fn",
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"type": "VariableDeclaration"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"commentStart": 0,
|
||||||
|
"declaration": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"id": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "myShape",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"init": {
|
||||||
|
"arguments": [],
|
||||||
|
"callee": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "myFunction",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name"
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": null
|
||||||
|
},
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "VariableDeclarator"
|
||||||
|
},
|
||||||
|
"end": 0,
|
||||||
|
"kind": "const",
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"type": "VariableDeclaration"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"commentStart": 0,
|
||||||
|
"declaration": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"id": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "sketch001",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"init": {
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "face",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"computed": false,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"object": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"computed": false,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"object": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "myShape",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name",
|
||||||
|
"type": "Name"
|
||||||
|
},
|
||||||
|
"property": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "tags",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier",
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"start": 0,
|
||||||
|
"type": "MemberExpression",
|
||||||
|
"type": "MemberExpression"
|
||||||
|
},
|
||||||
|
"property": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "seg01",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier",
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"start": 0,
|
||||||
|
"type": "MemberExpression",
|
||||||
|
"type": "MemberExpression"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"callee": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "startSketchOn",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name"
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "myShape",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name",
|
||||||
|
"type": "Name"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "VariableDeclarator"
|
||||||
|
},
|
||||||
|
"end": 0,
|
||||||
|
"kind": "const",
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"type": "VariableDeclaration"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"nonCodeMeta": {
|
||||||
|
"nonCodeNodes": {
|
||||||
|
"0": [
|
||||||
|
{
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "NonCodeNode",
|
||||||
|
"value": {
|
||||||
|
"type": "newLine"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"1": [
|
||||||
|
{
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "NonCodeNode",
|
||||||
|
"value": {
|
||||||
|
"type": "newLine"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"2": [
|
||||||
|
{
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "NonCodeNode",
|
||||||
|
"value": {
|
||||||
|
"type": "newLine"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"startNodes": []
|
||||||
|
},
|
||||||
|
"start": 0
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Error from executing property_access_not_found_on_solid.kcl
|
||||||
|
---
|
||||||
|
KCL Semantic error
|
||||||
|
|
||||||
|
× semantic: Property `tags` not found on a solid. You can get a solid's tags
|
||||||
|
│ through its sketch, as in, `exampleSolid.sketch.tags`.
|
||||||
|
╭─[13:43]
|
||||||
|
12 │
|
||||||
|
13 │ sketch001 = startSketchOn(myShape, face = myShape.tags.seg01)
|
||||||
|
· ──────┬─────
|
||||||
|
· ╰── tests/property_access_not_found_on_solid/input.kcl
|
||||||
|
14 │
|
||||||
|
╰────
|
@ -0,0 +1,14 @@
|
|||||||
|
fn myFunction() {
|
||||||
|
return startSketchOn(XY)
|
||||||
|
|> startProfile(at = [0, 0])
|
||||||
|
|> line(end = [10, 10], tag = $seg01)
|
||||||
|
|> line(end = [-20, 0])
|
||||||
|
|> line(end = [10, -10])
|
||||||
|
|> close()
|
||||||
|
|> extrude(length = 5, tagEnd = $end01)
|
||||||
|
}
|
||||||
|
|
||||||
|
myShape = myFunction()
|
||||||
|
|
||||||
|
sketch001 = startSketchOn(myShape, face = myShape.tags.seg01)
|
||||||
|
|
233
rust/kcl-lib/tests/property_access_not_found_on_solid/ops.snap
Normal file
@ -0,0 +1,233 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Operations executed property_access_not_found_on_solid.kcl
|
||||||
|
---
|
||||||
|
{
|
||||||
|
"rust/kcl-lib/tests/property_access_not_found_on_solid/input.kcl": [
|
||||||
|
{
|
||||||
|
"type": "GroupBegin",
|
||||||
|
"group": {
|
||||||
|
"type": "FunctionCall",
|
||||||
|
"name": "myFunction",
|
||||||
|
"functionSourceRange": [],
|
||||||
|
"unlabeledArg": null,
|
||||||
|
"labeledArgs": {}
|
||||||
|
},
|
||||||
|
"nodePath": {
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"type": "ProgramBodyItem",
|
||||||
|
"index": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "VariableDeclarationDeclaration"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "VariableDeclarationInit"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "StdLibCall",
|
||||||
|
"name": "startSketchOn",
|
||||||
|
"unlabeledArg": {
|
||||||
|
"value": {
|
||||||
|
"type": "Plane",
|
||||||
|
"artifact_id": "[uuid]"
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
"labeledArgs": {},
|
||||||
|
"nodePath": {
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"type": "ProgramBodyItem",
|
||||||
|
"index": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "VariableDeclarationDeclaration"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "VariableDeclarationInit"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "FunctionExpressionBody"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "FunctionExpressionBodyItem",
|
||||||
|
"index": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ReturnStatementArg"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "PipeBodyItem",
|
||||||
|
"index": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "StdLibCall",
|
||||||
|
"name": "extrude",
|
||||||
|
"unlabeledArg": {
|
||||||
|
"value": {
|
||||||
|
"type": "Sketch",
|
||||||
|
"value": {
|
||||||
|
"artifactId": "[uuid]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
"labeledArgs": {
|
||||||
|
"length": {
|
||||||
|
"value": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 5.0,
|
||||||
|
"ty": {
|
||||||
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
|
},
|
||||||
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
"tagEnd": {
|
||||||
|
"value": {
|
||||||
|
"type": "TagDeclarator",
|
||||||
|
"name": "end01"
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nodePath": {
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"type": "ProgramBodyItem",
|
||||||
|
"index": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "VariableDeclarationDeclaration"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "VariableDeclarationInit"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "FunctionExpressionBody"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "FunctionExpressionBodyItem",
|
||||||
|
"index": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ReturnStatementArg"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "PipeBodyItem",
|
||||||
|
"index": 6
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "GroupEnd"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"std::appearance": [],
|
||||||
|
"std::array": [],
|
||||||
|
"std::math": [
|
||||||
|
{
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"name": "PI",
|
||||||
|
"value": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Unknown"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"visibility": "export",
|
||||||
|
"nodePath": {
|
||||||
|
"steps": []
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"name": "E",
|
||||||
|
"value": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"visibility": "export",
|
||||||
|
"nodePath": {
|
||||||
|
"steps": []
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"name": "TAU",
|
||||||
|
"value": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"visibility": "export",
|
||||||
|
"nodePath": {
|
||||||
|
"steps": []
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"std::prelude": [
|
||||||
|
{
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"name": "START",
|
||||||
|
"value": {
|
||||||
|
"type": "String",
|
||||||
|
"value": "start"
|
||||||
|
},
|
||||||
|
"visibility": "export",
|
||||||
|
"nodePath": {
|
||||||
|
"steps": []
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"name": "END",
|
||||||
|
"value": {
|
||||||
|
"type": "String",
|
||||||
|
"value": "end"
|
||||||
|
},
|
||||||
|
"visibility": "export",
|
||||||
|
"nodePath": {
|
||||||
|
"steps": []
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"std::sketch": [],
|
||||||
|
"std::solid": [],
|
||||||
|
"std::sweep": [],
|
||||||
|
"std::transform": [],
|
||||||
|
"std::turns": [],
|
||||||
|
"std::types": [],
|
||||||
|
"std::units": []
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Result of unparsing property_access_not_found_on_solid.kcl
|
||||||
|
---
|
||||||
|
fn myFunction() {
|
||||||
|
return startSketchOn(XY)
|
||||||
|
|> startProfile(at = [0, 0])
|
||||||
|
|> line(end = [10, 10], tag = $seg01)
|
||||||
|
|> line(end = [-20, 0])
|
||||||
|
|> line(end = [10, -10])
|
||||||
|
|> close()
|
||||||
|
|> extrude(length = 5, tagEnd = $end01)
|
||||||
|
}
|
||||||
|
|
||||||
|
myShape = myFunction()
|
||||||
|
|
||||||
|
sketch001 = startSketchOn(myShape, face = myShape.tags.seg01)
|
163
rust/kcl-lib/tests/rect/artifact_commands.snap
Normal file
@ -0,0 +1,163 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Artifact commands rect.kcl
|
||||||
|
---
|
||||||
|
{
|
||||||
|
"rust/kcl-lib/tests/rect/input.kcl": [
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "make_plane",
|
||||||
|
"origin": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"x_axis": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"y_axis": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 1.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"size": 60.0,
|
||||||
|
"clobber": false,
|
||||||
|
"hide": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "enable_sketch_mode",
|
||||||
|
"entity_id": "[uuid]",
|
||||||
|
"ortho": false,
|
||||||
|
"animated": false,
|
||||||
|
"adjust_camera": false,
|
||||||
|
"planar_normal": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 1.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "start_path"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "move_path_pen",
|
||||||
|
"path": "[uuid]",
|
||||||
|
"to": {
|
||||||
|
"x": -2.0,
|
||||||
|
"y": -1.0,
|
||||||
|
"z": 0.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "sketch_mode_disable"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "extend_path",
|
||||||
|
"path": "[uuid]",
|
||||||
|
"segment": {
|
||||||
|
"type": "line",
|
||||||
|
"end": {
|
||||||
|
"x": 3.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"relative": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "extend_path",
|
||||||
|
"path": "[uuid]",
|
||||||
|
"segment": {
|
||||||
|
"type": "line",
|
||||||
|
"end": {
|
||||||
|
"x": 0.00000000000000012246467991473532,
|
||||||
|
"y": 2.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"relative": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "extend_path",
|
||||||
|
"path": "[uuid]",
|
||||||
|
"segment": {
|
||||||
|
"type": "line",
|
||||||
|
"end": {
|
||||||
|
"x": -3.0,
|
||||||
|
"y": -0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"relative": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "extend_path",
|
||||||
|
"path": "[uuid]",
|
||||||
|
"segment": {
|
||||||
|
"type": "line",
|
||||||
|
"end": {
|
||||||
|
"x": -2.0,
|
||||||
|
"y": -1.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"relative": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "close_path",
|
||||||
|
"path_id": "[uuid]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"std::appearance": [],
|
||||||
|
"std::array": [],
|
||||||
|
"std::math": [],
|
||||||
|
"std::prelude": [],
|
||||||
|
"std::sketch": [],
|
||||||
|
"std::solid": [],
|
||||||
|
"std::sweep": [],
|
||||||
|
"std::transform": [],
|
||||||
|
"std::turns": [],
|
||||||
|
"std::types": [],
|
||||||
|
"std::units": []
|
||||||
|
}
|
6
rust/kcl-lib/tests/rect/artifact_graph_flowchart.snap
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Artifact graph flowchart rect.kcl
|
||||||
|
extension: md
|
||||||
|
snapshot_kind: binary
|
||||||
|
---
|
27
rust/kcl-lib/tests/rect/artifact_graph_flowchart.snap.md
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
```mermaid
|
||||||
|
flowchart LR
|
||||||
|
subgraph path2 [Path]
|
||||||
|
2["Path<br>[27, 54, 0]"]
|
||||||
|
%% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
|
||||||
|
3["Segment<br>[60, 103, 0]"]
|
||||||
|
%% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 2 }]
|
||||||
|
4["Segment<br>[109, 155, 0]"]
|
||||||
|
%% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 3 }]
|
||||||
|
5["Segment<br>[161, 211, 0]"]
|
||||||
|
%% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 4 }]
|
||||||
|
6["Segment<br>[217, 273, 0]"]
|
||||||
|
%% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 5 }]
|
||||||
|
7["Segment<br>[279, 286, 0]"]
|
||||||
|
%% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 6 }]
|
||||||
|
8[Solid2d]
|
||||||
|
end
|
||||||
|
1["Plane<br>[4, 21, 0]"]
|
||||||
|
%% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }]
|
||||||
|
1 --- 2
|
||||||
|
2 --- 3
|
||||||
|
2 --- 4
|
||||||
|
2 --- 5
|
||||||
|
2 --- 6
|
||||||
|
2 --- 7
|
||||||
|
2 --- 8
|
||||||
|
```
|
701
rust/kcl-lib/tests/rect/ast.snap
Normal file
@ -0,0 +1,701 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Result of parsing rect.kcl
|
||||||
|
---
|
||||||
|
{
|
||||||
|
"Ok": {
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"commentStart": 0,
|
||||||
|
"declaration": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"id": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "x",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"init": {
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"arguments": [],
|
||||||
|
"callee": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "startSketchOn",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name"
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "XY",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name",
|
||||||
|
"type": "Name"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "at",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"argument": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"raw": "2",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 2.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"operator": "-",
|
||||||
|
"start": 0,
|
||||||
|
"type": "UnaryExpression",
|
||||||
|
"type": "UnaryExpression"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"argument": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"raw": "1",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 1.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"operator": "-",
|
||||||
|
"start": 0,
|
||||||
|
"type": "UnaryExpression",
|
||||||
|
"type": "UnaryExpression"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "ArrayExpression",
|
||||||
|
"type": "ArrayExpression"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"callee": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "startProfile",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name"
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "angle",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"raw": "0",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 0.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "length",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"raw": "3",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 3.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "tag",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "TagDeclarator",
|
||||||
|
"type": "TagDeclarator",
|
||||||
|
"value": "a"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"callee": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "angledLine",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name"
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "angle",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"left": {
|
||||||
|
"arguments": [],
|
||||||
|
"callee": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "segAng",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name"
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "a",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name",
|
||||||
|
"type": "Name"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"moduleId": 0,
|
||||||
|
"operator": "+",
|
||||||
|
"right": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"raw": "90",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 90.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"start": 0,
|
||||||
|
"type": "BinaryExpression",
|
||||||
|
"type": "BinaryExpression"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "length",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"raw": "2",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 2.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"callee": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "angledLine",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name"
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "angle",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"arguments": [],
|
||||||
|
"callee": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "segAng",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name"
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "a",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name",
|
||||||
|
"type": "Name"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "length",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"argument": {
|
||||||
|
"arguments": [],
|
||||||
|
"callee": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "segLen",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name"
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "a",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name",
|
||||||
|
"type": "Name"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"operator": "-",
|
||||||
|
"start": 0,
|
||||||
|
"type": "UnaryExpression",
|
||||||
|
"type": "UnaryExpression"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"callee": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "angledLine",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name"
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "endAbsolute",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"arguments": [],
|
||||||
|
"callee": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "profileStartX",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name"
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "PipeSubstitution",
|
||||||
|
"type": "PipeSubstitution"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"arguments": [],
|
||||||
|
"callee": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "profileStartY",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name"
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "PipeSubstitution",
|
||||||
|
"type": "PipeSubstitution"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "ArrayExpression",
|
||||||
|
"type": "ArrayExpression"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"callee": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "line",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name"
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"arguments": [],
|
||||||
|
"callee": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "close",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name"
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "PipeExpression",
|
||||||
|
"type": "PipeExpression"
|
||||||
|
},
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "VariableDeclarator"
|
||||||
|
},
|
||||||
|
"end": 0,
|
||||||
|
"kind": "const",
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"type": "VariableDeclaration"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0
|
||||||
|
}
|
||||||
|
}
|
7
rust/kcl-lib/tests/rect/input.kcl
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
x = startSketchOn(XY)
|
||||||
|
|> startProfile(at = [-2, -1])
|
||||||
|
|> angledLine(angle = 0, length = 3, tag = $a)
|
||||||
|
|> angledLine(angle = segAng(a) + 90, length = 2)
|
||||||
|
|> angledLine(angle = segAng(a), length = -segLen(a))
|
||||||
|
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||||
|
|> close()
|
128
rust/kcl-lib/tests/rect/ops.snap
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Operations executed rect.kcl
|
||||||
|
---
|
||||||
|
{
|
||||||
|
"rust/kcl-lib/tests/rect/input.kcl": [
|
||||||
|
{
|
||||||
|
"type": "StdLibCall",
|
||||||
|
"name": "startSketchOn",
|
||||||
|
"unlabeledArg": {
|
||||||
|
"value": {
|
||||||
|
"type": "Plane",
|
||||||
|
"artifact_id": "[uuid]"
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
"labeledArgs": {},
|
||||||
|
"nodePath": {
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"type": "ProgramBodyItem",
|
||||||
|
"index": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "VariableDeclarationDeclaration"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "VariableDeclarationInit"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "PipeBodyItem",
|
||||||
|
"index": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"std::appearance": [],
|
||||||
|
"std::array": [],
|
||||||
|
"std::math": [
|
||||||
|
{
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"name": "PI",
|
||||||
|
"value": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Unknown"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"visibility": "export",
|
||||||
|
"nodePath": {
|
||||||
|
"steps": []
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"name": "E",
|
||||||
|
"value": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"visibility": "export",
|
||||||
|
"nodePath": {
|
||||||
|
"steps": []
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"name": "TAU",
|
||||||
|
"value": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"visibility": "export",
|
||||||
|
"nodePath": {
|
||||||
|
"steps": []
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"std::prelude": [
|
||||||
|
{
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"name": "START",
|
||||||
|
"value": {
|
||||||
|
"type": "String",
|
||||||
|
"value": "start"
|
||||||
|
},
|
||||||
|
"visibility": "export",
|
||||||
|
"nodePath": {
|
||||||
|
"steps": []
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"name": "END",
|
||||||
|
"value": {
|
||||||
|
"type": "String",
|
||||||
|
"value": "end"
|
||||||
|
},
|
||||||
|
"visibility": "export",
|
||||||
|
"nodePath": {
|
||||||
|
"steps": []
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"std::sketch": [],
|
||||||
|
"std::solid": [],
|
||||||
|
"std::sweep": [],
|
||||||
|
"std::transform": [],
|
||||||
|
"std::turns": [],
|
||||||
|
"std::types": [],
|
||||||
|
"std::units": []
|
||||||
|
}
|
181
rust/kcl-lib/tests/rect/program_memory.snap
Normal file
@ -0,0 +1,181 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Variables in memory after executing rect.kcl
|
||||||
|
---
|
||||||
|
{
|
||||||
|
"a": {
|
||||||
|
"type": "TagIdentifier",
|
||||||
|
"type": "TagIdentifier",
|
||||||
|
"value": "a"
|
||||||
|
},
|
||||||
|
"x": {
|
||||||
|
"type": "Sketch",
|
||||||
|
"value": {
|
||||||
|
"type": "Sketch",
|
||||||
|
"id": "[uuid]",
|
||||||
|
"paths": [
|
||||||
|
{
|
||||||
|
"__geoMeta": {
|
||||||
|
"id": "[uuid]",
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
"from": [
|
||||||
|
-2.0,
|
||||||
|
-1.0
|
||||||
|
],
|
||||||
|
"tag": {
|
||||||
|
"commentStart": 100,
|
||||||
|
"end": 102,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 100,
|
||||||
|
"type": "TagDeclarator",
|
||||||
|
"value": "a"
|
||||||
|
},
|
||||||
|
"to": [
|
||||||
|
1.0,
|
||||||
|
-1.0
|
||||||
|
],
|
||||||
|
"type": "ToPoint",
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__geoMeta": {
|
||||||
|
"id": "[uuid]",
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
"from": [
|
||||||
|
1.0,
|
||||||
|
-1.0
|
||||||
|
],
|
||||||
|
"tag": null,
|
||||||
|
"to": [
|
||||||
|
1.0000000000000002,
|
||||||
|
1.0
|
||||||
|
],
|
||||||
|
"type": "ToPoint",
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__geoMeta": {
|
||||||
|
"id": "[uuid]",
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
"from": [
|
||||||
|
1.0000000000000002,
|
||||||
|
1.0
|
||||||
|
],
|
||||||
|
"tag": null,
|
||||||
|
"to": [
|
||||||
|
-1.9999999999999998,
|
||||||
|
1.0
|
||||||
|
],
|
||||||
|
"type": "ToPoint",
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__geoMeta": {
|
||||||
|
"id": "[uuid]",
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
"from": [
|
||||||
|
-1.9999999999999998,
|
||||||
|
1.0
|
||||||
|
],
|
||||||
|
"tag": null,
|
||||||
|
"to": [
|
||||||
|
-2.0,
|
||||||
|
-1.0
|
||||||
|
],
|
||||||
|
"type": "ToPoint",
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__geoMeta": {
|
||||||
|
"id": "[uuid]",
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
"from": [
|
||||||
|
-2.0,
|
||||||
|
-1.0
|
||||||
|
],
|
||||||
|
"tag": null,
|
||||||
|
"to": [
|
||||||
|
-2.0,
|
||||||
|
-1.0
|
||||||
|
],
|
||||||
|
"type": "ToPoint",
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"on": {
|
||||||
|
"artifactId": "[uuid]",
|
||||||
|
"id": "[uuid]",
|
||||||
|
"origin": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0,
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"type": "plane",
|
||||||
|
"value": "XY",
|
||||||
|
"xAxis": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0,
|
||||||
|
"units": {
|
||||||
|
"type": "Unknown"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"yAxis": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 1.0,
|
||||||
|
"z": 0.0,
|
||||||
|
"units": {
|
||||||
|
"type": "Unknown"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"start": {
|
||||||
|
"from": [
|
||||||
|
-2.0,
|
||||||
|
-1.0
|
||||||
|
],
|
||||||
|
"to": [
|
||||||
|
-2.0,
|
||||||
|
-1.0
|
||||||
|
],
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
},
|
||||||
|
"tag": null,
|
||||||
|
"__geoMeta": {
|
||||||
|
"id": "[uuid]",
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tags": {
|
||||||
|
"a": {
|
||||||
|
"type": "TagIdentifier",
|
||||||
|
"value": "a"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"artifactId": "[uuid]",
|
||||||
|
"originalId": "[uuid]",
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
BIN
rust/kcl-lib/tests/rect/rendered_model.png
Normal file
After Width: | Height: | Size: 26 KiB |
11
rust/kcl-lib/tests/rect/unparsed.snap
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Result of unparsing rect.kcl
|
||||||
|
---
|
||||||
|
x = startSketchOn(XY)
|
||||||
|
|> startProfile(at = [-2, -1])
|
||||||
|
|> angledLine(angle = 0, length = 3, tag = $a)
|
||||||
|
|> angledLine(angle = segAng(a) + 90, length = 2)
|
||||||
|
|> angledLine(angle = segAng(a), length = -segLen(a))
|
||||||
|
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||||
|
|> close()
|
163
rust/kcl-lib/tests/rect_helper/artifact_commands.snap
Normal file
@ -0,0 +1,163 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Artifact commands rect_helper.kcl
|
||||||
|
---
|
||||||
|
{
|
||||||
|
"rust/kcl-lib/tests/rect_helper/input.kcl": [
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "make_plane",
|
||||||
|
"origin": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"x_axis": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"y_axis": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 1.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"size": 60.0,
|
||||||
|
"clobber": false,
|
||||||
|
"hide": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "enable_sketch_mode",
|
||||||
|
"entity_id": "[uuid]",
|
||||||
|
"ortho": false,
|
||||||
|
"animated": false,
|
||||||
|
"adjust_camera": false,
|
||||||
|
"planar_normal": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 1.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "start_path"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "move_path_pen",
|
||||||
|
"path": "[uuid]",
|
||||||
|
"to": {
|
||||||
|
"x": -2.0,
|
||||||
|
"y": -1.0,
|
||||||
|
"z": 0.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "sketch_mode_disable"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "extend_path",
|
||||||
|
"path": "[uuid]",
|
||||||
|
"segment": {
|
||||||
|
"type": "line",
|
||||||
|
"end": {
|
||||||
|
"x": 3.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"relative": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "extend_path",
|
||||||
|
"path": "[uuid]",
|
||||||
|
"segment": {
|
||||||
|
"type": "line",
|
||||||
|
"end": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 2.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"relative": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "extend_path",
|
||||||
|
"path": "[uuid]",
|
||||||
|
"segment": {
|
||||||
|
"type": "line",
|
||||||
|
"end": {
|
||||||
|
"x": -3.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"relative": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "extend_path",
|
||||||
|
"path": "[uuid]",
|
||||||
|
"segment": {
|
||||||
|
"type": "line",
|
||||||
|
"end": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": -2.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"relative": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "close_path",
|
||||||
|
"path_id": "[uuid]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"std::appearance": [],
|
||||||
|
"std::array": [],
|
||||||
|
"std::math": [],
|
||||||
|
"std::prelude": [],
|
||||||
|
"std::sketch": [],
|
||||||
|
"std::solid": [],
|
||||||
|
"std::sweep": [],
|
||||||
|
"std::transform": [],
|
||||||
|
"std::turns": [],
|
||||||
|
"std::types": [],
|
||||||
|
"std::units": []
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Artifact graph flowchart rect_helper.kcl
|
||||||
|
extension: md
|
||||||
|
snapshot_kind: binary
|
||||||
|
---
|
@ -0,0 +1,24 @@
|
|||||||
|
```mermaid
|
||||||
|
flowchart LR
|
||||||
|
subgraph path2 [Path]
|
||||||
|
2["Path<br>[25, 76, 0]"]
|
||||||
|
%% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
|
||||||
|
3["Segment<br>[25, 76, 0]"]
|
||||||
|
%% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
|
||||||
|
4["Segment<br>[25, 76, 0]"]
|
||||||
|
%% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
|
||||||
|
5["Segment<br>[25, 76, 0]"]
|
||||||
|
%% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
|
||||||
|
6["Segment<br>[25, 76, 0]"]
|
||||||
|
%% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
|
||||||
|
7[Solid2d]
|
||||||
|
end
|
||||||
|
1["Plane<br>[4, 21, 0]"]
|
||||||
|
%% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }]
|
||||||
|
1 --- 2
|
||||||
|
2 --- 3
|
||||||
|
2 --- 4
|
||||||
|
2 --- 5
|
||||||
|
2 --- 6
|
||||||
|
2 --- 7
|
||||||
|
```
|
233
rust/kcl-lib/tests/rect_helper/ast.snap
Normal file
@ -0,0 +1,233 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Result of parsing rect_helper.kcl
|
||||||
|
---
|
||||||
|
{
|
||||||
|
"Ok": {
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"commentStart": 0,
|
||||||
|
"declaration": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"id": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "x",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"init": {
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"arguments": [],
|
||||||
|
"callee": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "startSketchOn",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name"
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "XY",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name",
|
||||||
|
"type": "Name"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "width",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"raw": "3",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 3.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "height",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"raw": "2",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 2.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "corner",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"argument": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"raw": "2",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 2.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"operator": "-",
|
||||||
|
"start": 0,
|
||||||
|
"type": "UnaryExpression",
|
||||||
|
"type": "UnaryExpression"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"argument": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"raw": "1",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 1.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"operator": "-",
|
||||||
|
"start": 0,
|
||||||
|
"type": "UnaryExpression",
|
||||||
|
"type": "UnaryExpression"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "ArrayExpression",
|
||||||
|
"type": "ArrayExpression"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"callee": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"name": "rectangle",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name"
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "PipeExpression",
|
||||||
|
"type": "PipeExpression"
|
||||||
|
},
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "VariableDeclarator"
|
||||||
|
},
|
||||||
|
"end": 0,
|
||||||
|
"kind": "const",
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"type": "VariableDeclaration"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"moduleId": 0,
|
||||||
|
"start": 0
|
||||||
|
}
|
||||||
|
}
|
2
rust/kcl-lib/tests/rect_helper/input.kcl
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
x = startSketchOn(XY)
|
||||||
|
|> rectangle(width = 3, height = 2, corner = [-2, -1])
|
128
rust/kcl-lib/tests/rect_helper/ops.snap
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Operations executed rect_helper.kcl
|
||||||
|
---
|
||||||
|
{
|
||||||
|
"rust/kcl-lib/tests/rect_helper/input.kcl": [
|
||||||
|
{
|
||||||
|
"type": "StdLibCall",
|
||||||
|
"name": "startSketchOn",
|
||||||
|
"unlabeledArg": {
|
||||||
|
"value": {
|
||||||
|
"type": "Plane",
|
||||||
|
"artifact_id": "[uuid]"
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
"labeledArgs": {},
|
||||||
|
"nodePath": {
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"type": "ProgramBodyItem",
|
||||||
|
"index": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "VariableDeclarationDeclaration"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "VariableDeclarationInit"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "PipeBodyItem",
|
||||||
|
"index": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"std::appearance": [],
|
||||||
|
"std::array": [],
|
||||||
|
"std::math": [
|
||||||
|
{
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"name": "PI",
|
||||||
|
"value": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Unknown"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"visibility": "export",
|
||||||
|
"nodePath": {
|
||||||
|
"steps": []
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"name": "E",
|
||||||
|
"value": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"visibility": "export",
|
||||||
|
"nodePath": {
|
||||||
|
"steps": []
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"name": "TAU",
|
||||||
|
"value": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"visibility": "export",
|
||||||
|
"nodePath": {
|
||||||
|
"steps": []
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"std::prelude": [
|
||||||
|
{
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"name": "START",
|
||||||
|
"value": {
|
||||||
|
"type": "String",
|
||||||
|
"value": "start"
|
||||||
|
},
|
||||||
|
"visibility": "export",
|
||||||
|
"nodePath": {
|
||||||
|
"steps": []
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"name": "END",
|
||||||
|
"value": {
|
||||||
|
"type": "String",
|
||||||
|
"value": "end"
|
||||||
|
},
|
||||||
|
"visibility": "export",
|
||||||
|
"nodePath": {
|
||||||
|
"steps": []
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"std::sketch": [],
|
||||||
|
"std::solid": [],
|
||||||
|
"std::sweep": [],
|
||||||
|
"std::transform": [],
|
||||||
|
"std::turns": [],
|
||||||
|
"std::types": [],
|
||||||
|
"std::units": []
|
||||||
|
}
|
144
rust/kcl-lib/tests/rect_helper/program_memory.snap
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Variables in memory after executing rect_helper.kcl
|
||||||
|
---
|
||||||
|
{
|
||||||
|
"x": {
|
||||||
|
"type": "Sketch",
|
||||||
|
"value": {
|
||||||
|
"type": "Sketch",
|
||||||
|
"id": "[uuid]",
|
||||||
|
"paths": [
|
||||||
|
{
|
||||||
|
"__geoMeta": {
|
||||||
|
"id": "[uuid]",
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
"from": [
|
||||||
|
-2.0,
|
||||||
|
-1.0
|
||||||
|
],
|
||||||
|
"tag": null,
|
||||||
|
"to": [
|
||||||
|
1.0,
|
||||||
|
-1.0
|
||||||
|
],
|
||||||
|
"type": "ToPoint",
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__geoMeta": {
|
||||||
|
"id": "[uuid]",
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
"from": [
|
||||||
|
1.0,
|
||||||
|
-1.0
|
||||||
|
],
|
||||||
|
"tag": null,
|
||||||
|
"to": [
|
||||||
|
1.0,
|
||||||
|
1.0
|
||||||
|
],
|
||||||
|
"type": "ToPoint",
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__geoMeta": {
|
||||||
|
"id": "[uuid]",
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
"from": [
|
||||||
|
1.0,
|
||||||
|
1.0
|
||||||
|
],
|
||||||
|
"tag": null,
|
||||||
|
"to": [
|
||||||
|
-2.0,
|
||||||
|
1.0
|
||||||
|
],
|
||||||
|
"type": "ToPoint",
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__geoMeta": {
|
||||||
|
"id": "[uuid]",
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
"from": [
|
||||||
|
-2.0,
|
||||||
|
1.0
|
||||||
|
],
|
||||||
|
"tag": null,
|
||||||
|
"to": [
|
||||||
|
-2.0,
|
||||||
|
-1.0
|
||||||
|
],
|
||||||
|
"type": "ToPoint",
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"on": {
|
||||||
|
"artifactId": "[uuid]",
|
||||||
|
"id": "[uuid]",
|
||||||
|
"origin": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0,
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"type": "plane",
|
||||||
|
"value": "XY",
|
||||||
|
"xAxis": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0,
|
||||||
|
"units": {
|
||||||
|
"type": "Unknown"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"yAxis": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 1.0,
|
||||||
|
"z": 0.0,
|
||||||
|
"units": {
|
||||||
|
"type": "Unknown"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"start": {
|
||||||
|
"from": [
|
||||||
|
-2.0,
|
||||||
|
-1.0
|
||||||
|
],
|
||||||
|
"to": [
|
||||||
|
-2.0,
|
||||||
|
-1.0
|
||||||
|
],
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
},
|
||||||
|
"tag": null,
|
||||||
|
"__geoMeta": {
|
||||||
|
"id": "[uuid]",
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"artifactId": "[uuid]",
|
||||||
|
"originalId": "[uuid]",
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
BIN
rust/kcl-lib/tests/rect_helper/rendered_model.png
Normal file
After Width: | Height: | Size: 26 KiB |
6
rust/kcl-lib/tests/rect_helper/unparsed.snap
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Result of unparsing rect_helper.kcl
|
||||||
|
---
|
||||||
|
x = startSketchOn(XY)
|
||||||
|
|> rectangle(width = 3, height = 2, corner = [-2, -1])
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "kcl-python-bindings"
|
name = "kcl-python-bindings"
|
||||||
version = "0.3.83"
|
version = "0.3.84"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
repository = "https://github.com/kittycad/modeling-app"
|
repository = "https://github.com/kittycad/modeling-app"
|
||||||
exclude = ["tests/*", "files/*", "venv/*"]
|
exclude = ["tests/*", "files/*", "venv/*"]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "kcl-test-server"
|
name = "kcl-test-server"
|
||||||
description = "A test server for KCL"
|
description = "A test server for KCL"
|
||||||
version = "0.1.83"
|
version = "0.1.84"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "kcl-to-core"
|
name = "kcl-to-core"
|
||||||
description = "Utility methods to convert kcl to engine core executable tests"
|
description = "Utility methods to convert kcl to engine core executable tests"
|
||||||
version = "0.1.83"
|
version = "0.1.84"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/KittyCAD/modeling-app"
|
repository = "https://github.com/KittyCAD/modeling-app"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "kcl-wasm-lib"
|
name = "kcl-wasm-lib"
|
||||||
version = "0.1.83"
|
version = "0.1.84"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
repository = "https://github.com/KittyCAD/modeling-app"
|
repository = "https://github.com/KittyCAD/modeling-app"
|
||||||
rust-version = "1.83"
|
rust-version = "1.83"
|
||||||
@ -53,5 +53,5 @@ wasm-bindgen-test = "0.3.50"
|
|||||||
typed-path = "0.11.0"
|
typed-path = "0.11.0"
|
||||||
|
|
||||||
# Local development only. Placeholder to speed up development cycle
|
# Local development only. Placeholder to speed up development cycle
|
||||||
#[package.metadata.wasm-pack.profile.release]
|
[package.metadata.wasm-pack.profile.release]
|
||||||
#wasm-opt = false
|
wasm-opt = false
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
npm run circular-deps | sed '$d' > /tmp/circular-deps.txt
|
npm run circular-deps | sed '$d' > /tmp/circular-deps.txt
|
||||||
diff --ignore-blank-lines -w /tmp/circular-deps.txt ./known-circular.txt
|
diff --ignore-blank-lines -w /tmp/circular-deps.txt ./scripts/known/circular.txt
|
||||||
|