Compare commits

...

9 Commits

Author SHA1 Message Date
c6b7c7d9a6 failing test
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2024-06-24 17:35:36 -07:00
3304a74064 Tag as top level construct (#2769)
* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* udpages

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fixes

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* update

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* better functions

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* backwards compat everywhere

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* update docs

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* udpates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fixes

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fixes

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* add lsp symbols stuff;

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* tests for dupes

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* Revert "tests for dupes"

This reverts commit 6acaf5a9fa.

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* initial test updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* tests

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fixes

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* test

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fixes

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix tests

Signed-off-by: Jess Frazelle <github@jessfraz.com>

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
2024-06-24 14:45:07 -07:00
f4877cb160 Stop throwing in frontend code (#2654)
Return error instead of throw
2024-06-24 11:45:40 -04:00
f7196e7eb0 Add sketch tool events to command bar (#2708)
* Add command configs for sketch tools

* Update Constrain dropdown to be noun

* Update Cargo.lock

* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)

* Update E2E test references to "Constraints" button

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-06-24 11:37:48 -04:00
5260bd6820 allow for sketching on the face of a chamfer in kcl (#2760)
* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* cleanup

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* lots of cleanup

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* lots more cleanup

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* more cleaniup

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix typos

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* add to known issues

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fixes

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
2024-06-24 06:04:32 +00:00
394653247a Bump syn from 2.0.67 to 2.0.68 in /src/wasm-lib (#2761)
Bumps [syn](https://github.com/dtolnay/syn) from 2.0.67 to 2.0.68.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.67...2.0.68)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-23 22:03:02 -07:00
fbd22a2d17 Bump lazy_static from 1.4.0 to 1.5.0 in /src/wasm-lib (#2763)
Bumps [lazy_static](https://github.com/rust-lang-nursery/lazy-static.rs) from 1.4.0 to 1.5.0.
- [Release notes](https://github.com/rust-lang-nursery/lazy-static.rs/releases)
- [Commits](https://github.com/rust-lang-nursery/lazy-static.rs/compare/1.4.0...1.5.0)

---
updated-dependencies:
- dependency-name: lazy_static
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-23 22:02:53 -07:00
7c568f68e5 Bump kittycad from 0.3.5 to 0.3.6 in /src/wasm-lib (#2762)
Bumps [kittycad](https://github.com/KittyCAD/kittycad.rs) from 0.3.5 to 0.3.6.
- [Release notes](https://github.com/KittyCAD/kittycad.rs/releases)
- [Commits](https://github.com/KittyCAD/kittycad.rs/compare/v0.3.5...v0.3.6)

---
updated-dependencies:
- dependency-name: kittycad
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-23 22:02:26 -07:00
31b0766754 execute chamfers and fillets early if in a pattern (#2759)
* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* bump kcl version

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix others

Signed-off-by: Jess Frazelle <github@jessfraz.com>

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
2024-06-24 02:19:24 +00:00
163 changed files with 105901 additions and 9726 deletions

View File

@ -4,7 +4,8 @@
"project": "./tsconfig.json" "project": "./tsconfig.json"
}, },
"plugins": [ "plugins": [
"css-modules" "css-modules",
"suggest-no-throw",
], ],
"extends": [ "extends": [
"react-app", "react-app",
@ -17,6 +18,7 @@
"never" "never"
], ],
"react-hooks/exhaustive-deps": "off", "react-hooks/exhaustive-deps": "off",
"suggest-no-throw/suggest-no-throw": "warn",
}, },
"overrides": [ "overrides": [
{ {
@ -25,6 +27,12 @@
"@typescript-eslint/no-floating-promises": "warn", "@typescript-eslint/no-floating-promises": "warn",
"testing-library/prefer-screen-queries": "off" "testing-library/prefer-screen-queries": "off"
} }
},
{
"files": ["src/**/*.test.ts"],
"rules": {
"suggest-no-throw/suggest-no-throw": "off",
}
} }
] ]
} }

View File

@ -95,21 +95,13 @@ jobs:
CI: true CI: true
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }} token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
snapshottoken: ${{ secrets.KITTYCAD_API_TOKEN }} snapshottoken: ${{ secrets.KITTYCAD_API_TOKEN }}
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
- name: check for changes - name: check for changes
id: git-check id: git-check
run: | run: |
git add . git add .
if git status | grep -q "Changes to be committed" if git status | grep -q "Changes to be committed"
then then echo "modified=true" >> $GITHUB_OUTPUT
echo "::set-output name=modified::true" else echo "modified=false" >> $GITHUB_OUTPUT
else
echo "::set-output name=modified::false"
fi fi
- name: Commit changes, if any - name: Commit changes, if any
if: steps.git-check.outputs.modified == 'true' if: steps.git-check.outputs.modified == 'true'
@ -125,17 +117,53 @@ jobs:
git commit -am "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" || true git commit -am "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" || true
git push git push
git push origin ${{ github.head_ref }} git push origin ${{ github.head_ref }}
# only upload artifacts if there's actually changes
- uses: actions/upload-artifact@v4
if: steps.git-check.outputs.modified == 'true'
with:
name: playwright-report
path: playwright-report/
retention-days: 30
# if have previous run results, use them
- uses: actions/download-artifact@v4
if: always()
continue-on-error: true
with:
name: test-results
path: test-results/
- name: Run ubuntu/chrome flow retry failures
id: retry
if: always()
run: |
ls -1 "test-results"
if [[ $(ls -1 "test-results" | wc -l) == "0" ]];
then echo "retried=false" >> $GITHUB_OUTPUT; exit 0;
else echo "retried=true" >> $GITHUB_OUTPUT;
fi;
yarn playwright test --project="Google Chrome" --last-failed e2e/playwright/flow-tests.spec.ts
env:
CI: true
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
- name: Run ubuntu/chrome flow - name: Run ubuntu/chrome flow
if: steps.retry.outputs.retried == 'false'
run: yarn playwright test --project="Google Chrome" e2e/playwright/flow-tests.spec.ts run: yarn playwright test --project="Google Chrome" e2e/playwright/flow-tests.spec.ts
env: env:
CI: true CI: true
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }} token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v4
if: always() if: always()
with: with:
name: playwright-report-ubuntu name: test-results
path: test-results/
retention-days: 30
overwrite: true
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/ path: playwright-report/
retention-days: 30 retention-days: 30
overwrite: true
playwright-macos: playwright-macos:
timeout-minutes: 60 timeout-minutes: 60
@ -194,16 +222,46 @@ jobs:
run: yarn build:wasm run: yarn build:wasm
- name: build web - name: build web
run: yarn build:local run: yarn build:local
# if have previous run results, use them
- uses: actions/download-artifact@v4
if: ${{ always() }}
continue-on-error: true
with:
name: test-results
path: test-results/
- name: Run macos/safari flow retry failures
id: retry
continue-on-error: true
if: ${{ success() }}
run: |
if [ -d "test-results" ];
then echo "retried=true" >> $GITHUB_OUTPUT;
else echo "retried=false" >> $GITHUB_OUTPUT;
fi;
yarn playwright test --project="webkit" --last-failed e2e/playwright/flow-tests.spec.ts
env:
CI: true
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
- name: Run macos/safari flow - name: Run macos/safari flow
if: ${{ steps.retry.outputs.retried != 'true' }}
# webkit doesn't work on Ubuntu because of the same reason tauri doesn't (webRTC issues) # webkit doesn't work on Ubuntu because of the same reason tauri doesn't (webRTC issues)
# TODO remove this and the matrix and run all tests on ubuntu when this is fixed # TODO remove this and the matrix and run all tests on ubuntu when this is fixed
run: yarn playwright test --project="webkit" e2e/playwright/flow-tests.spec.ts run: yarn playwright test --project="webkit" e2e/playwright/flow-tests.spec.ts
env: env:
CI: true CI: true
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }} token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v4
if: always() if: ${{ always() }}
with: with:
name: playwright-report-macos name: test-results
path: test-results/
retention-days: 30
overwrite: true
- uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: playwright-report
path: playwright-report/ path: playwright-report/
retention-days: 30 retention-days: 30
overwrite: true

View File

@ -1,14 +1,17 @@
.PHONY: dev .PHONY: dev
WASM_LIB_FILES := $(wildcard src/wasm-lib/**/*.rs) WASM_LIB_FILES := $(wildcard src/wasm-lib/**/*.rs)
TS_SRC := $(wildcard src/**/*.tsx) $(wildcard src/**/*.ts)
XSTATE_TYPEGENS := $(wildcard src/machines/*.typegen.ts)
dev: node_modules public/wasm_lib_bg.wasm dev: node_modules public/wasm_lib_bg.wasm $(XSTATE_TYPEGENS)
yarn start yarn start
$(XSTATE_TYPEGENS): $(TS_SRC)
yarn xstate typegen 'src/**/*.ts?(x)'
public/wasm_lib_bg.wasm: $(WASM_LIB_FILES) public/wasm_lib_bg.wasm: $(WASM_LIB_FILES)
yarn build:wasm-dev yarn build:wasm-dev
node_modules: package.json node_modules: package.json yarn.lock
package.json:
yarn install yarn install

View File

@ -89,25 +89,6 @@ enable third-party cookies. You can enable third-party cookies by clicking on
the eye with a slash through it in the URL bar, and clicking on "Enable the eye with a slash through it in the URL bar, and clicking on "Enable
Third-Party Cookies". Third-Party Cookies".
## Running tests
First, start the dev server following "Running a development build" above.
Then in another terminal tab, run:
```
yarn test
```
Which will run our suite of [Vitest unit](https://vitest.dev/) and [React Testing Library E2E](https://testing-library.com/docs/react-testing-library/intro/) tests, in interactive mode by default.
For running the rust (not tauri rust though) only, you can
```bash
cd src/wasm-lib
cargo test
```
## Tauri ## Tauri
To spin up up tauri dev, `yarn install` and `yarn build:wasm-dev` need to have been done before hand then To spin up up tauri dev, `yarn install` and `yarn build:wasm-dev` need to have been done before hand then
@ -195,7 +176,9 @@ $ cargo +nightly fuzz run parser
For more information on fuzzing you can check out For more information on fuzzing you can check out
[this guide](https://rust-fuzz.github.io/book/cargo-fuzz.html). [this guide](https://rust-fuzz.github.io/book/cargo-fuzz.html).
### Playwright ## Tests
### Playwright tests
For a portable way to run Playwright you'll need Docker. For a portable way to run Playwright you'll need Docker.
@ -284,6 +267,37 @@ Where `./store` should look like this
However because much of our tests involve clicking in the stream at specific locations, it's code-gen looks `await page.locator('video').click();` when really we need to use a pixel coord, so I think it's of limited use. However because much of our tests involve clicking in the stream at specific locations, it's code-gen looks `await page.locator('video').click();` when really we need to use a pixel coord, so I think it's of limited use.
### Unit and component tests
If you already haven't, run the following:
```
yarn
yarn build:wasm
yarn start
```
and finally:
```
yarn test:nowatch
```
For individual testing:
```
yarn test abstractSyntaxTree -t "unexpected closed curly brace" --silent=false
```
Which will run our suite of [Vitest unit](https://vitest.dev/) and [React Testing Library E2E](https://testing-library.com/docs/react-testing-library/intro/) tests, in interactive mode by default.
### Rust tests
```bash
cd src/wasm-lib
cargo test
```
#### Some notes on CI #### Some notes on CI
The tests are broken into snapshot tests and non-snapshot tests, and they run in that order, they automatically commit new snap shots, so if you see an image commit check it was an intended change. If we have non-determinism in the snapshots such that they are always committing new images, hopefully this annoyance makes us fix them asap, if you notice this happening let Kurt know. But for the odd occasion `git reset --hard HEAD~ && git push -f` is your friend. The tests are broken into snapshot tests and non-snapshot tests, and they run in that order, they automatically commit new snap shots, so if you see an image commit check it was an intended change. If we have non-determinism in the snapshots such that they are always committing new images, hopefully this annoyance makes us fix them asap, if you notice this happening let Kurt know. But for the odd occasion `git reset --hard HEAD~ && git push -f` is your friend.

View File

@ -23,5 +23,7 @@ once fixed in engine will just start working here with no language changes.
- **Chamfers**: Chamfers cannot intersect, you will get an error. Only simple - **Chamfers**: Chamfers cannot intersect, you will get an error. Only simple
chamfer cases work currently. chamfer cases work currently.
Sketching on the chamfered face does not currently work.
- **Shell**: Shell is only working for `end` faces, not for `side` or `start` - **Shell**: Shell is only working for `end` faces, not for `side` or `start`
faces. We are tracking the engine side bug on this. faces. We are tracking the engine side bug on this.

View File

@ -9,7 +9,7 @@ Returns the angle to match the given length for x.
```js ```js
angleToMatchLengthX(segment_name: string, to: number, sketch_group: SketchGroup) -> number angleToMatchLengthX(segment_name: TagIdentifier, to: number, sketch_group: SketchGroup) -> number
``` ```
### Examples ### Examples
@ -31,7 +31,12 @@ const extrusion = extrude(5, sketch001)
### Arguments ### Arguments
* `segment_name`: `string` (REQUIRED) * `segment_name`: `TagIdentifier` (REQUIRED)
```js
{
value: string,
}
```
* `to`: `number` (REQUIRED) * `to`: `number` (REQUIRED)
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) * `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```js ```js
@ -71,10 +76,181 @@ const extrusion = extrude(5, sketch001)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -101,8 +277,12 @@ const extrusion = extrude(5, sketch001)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -110,8 +290,12 @@ const extrusion = extrude(5, sketch001)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -123,8 +307,12 @@ const extrusion = extrude(5, sketch001)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -132,8 +320,12 @@ const extrusion = extrude(5, sketch001)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -141,8 +333,12 @@ const extrusion = extrude(5, sketch001)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -152,8 +348,12 @@ const extrusion = extrude(5, sketch001)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -165,8 +365,12 @@ const extrusion = extrude(5, sketch001)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",

View File

@ -9,7 +9,7 @@ Returns the angle to match the given length for y.
```js ```js
angleToMatchLengthY(segment_name: string, to: number, sketch_group: SketchGroup) -> number angleToMatchLengthY(segment_name: TagIdentifier, to: number, sketch_group: SketchGroup) -> number
``` ```
### Examples ### Examples
@ -32,7 +32,12 @@ const extrusion = extrude(5, sketch001)
### Arguments ### Arguments
* `segment_name`: `string` (REQUIRED) * `segment_name`: `TagIdentifier` (REQUIRED)
```js
{
value: string,
}
```
* `to`: `number` (REQUIRED) * `to`: `number` (REQUIRED)
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) * `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```js ```js
@ -72,10 +77,181 @@ const extrusion = extrude(5, sketch001)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -102,8 +278,12 @@ const extrusion = extrude(5, sketch001)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -111,8 +291,12 @@ const extrusion = extrude(5, sketch001)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -124,8 +308,12 @@ const extrusion = extrude(5, sketch001)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -133,8 +321,12 @@ const extrusion = extrude(5, sketch001)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -142,8 +334,12 @@ const extrusion = extrude(5, sketch001)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -153,8 +349,12 @@ const extrusion = extrude(5, sketch001)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -166,8 +366,12 @@ const extrusion = extrude(5, sketch001)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",

View File

@ -9,7 +9,7 @@ Draw an angled line.
```js ```js
angledLine(data: AngledLineData, sketch_group: SketchGroup, tag?: String) -> SketchGroup angledLine(data: AngledLineData, sketch_group: SketchGroup, tag?: TagDeclarator) -> SketchGroup
``` ```
### Examples ### Examples
@ -78,10 +78,181 @@ const example = extrude(10, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -108,8 +279,12 @@ const example = extrude(10, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -117,8 +292,12 @@ const example = extrude(10, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -130,8 +309,12 @@ const example = extrude(10, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -139,8 +322,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -148,8 +335,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -159,8 +350,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -172,15 +367,26 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",
}], }],
} }
``` ```
* `tag`: `String` (OPTIONAL) * `tag`: `TagDeclarator` (OPTIONAL)
```js
{
end: number,
start: number,
value: string,
}
```
### Returns ### Returns
@ -222,10 +428,181 @@ const example = extrude(10, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -252,8 +629,12 @@ const example = extrude(10, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -261,8 +642,12 @@ const example = extrude(10, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -274,8 +659,12 @@ const example = extrude(10, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -283,8 +672,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -292,8 +685,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -303,8 +700,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -316,8 +717,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",

View File

@ -9,7 +9,7 @@ Draw an angled line of a given x length.
```js ```js
angledLineOfXLength(data: AngledLineData, sketch_group: SketchGroup, tag?: String) -> SketchGroup angledLineOfXLength(data: AngledLineData, sketch_group: SketchGroup, tag?: TagDeclarator) -> SketchGroup
``` ```
### Examples ### Examples
@ -77,10 +77,181 @@ const extrusion = extrude(10, sketch001)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -107,8 +278,12 @@ const extrusion = extrude(10, sketch001)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -116,8 +291,12 @@ const extrusion = extrude(10, sketch001)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -129,8 +308,12 @@ const extrusion = extrude(10, sketch001)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -138,8 +321,12 @@ const extrusion = extrude(10, sketch001)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -147,8 +334,12 @@ const extrusion = extrude(10, sketch001)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -158,8 +349,12 @@ const extrusion = extrude(10, sketch001)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -171,15 +366,26 @@ const extrusion = extrude(10, sketch001)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",
}], }],
} }
``` ```
* `tag`: `String` (OPTIONAL) * `tag`: `TagDeclarator` (OPTIONAL)
```js
{
end: number,
start: number,
value: string,
}
```
### Returns ### Returns
@ -221,10 +427,181 @@ const extrusion = extrude(10, sketch001)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -251,8 +628,12 @@ const extrusion = extrude(10, sketch001)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -260,8 +641,12 @@ const extrusion = extrude(10, sketch001)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -273,8 +658,12 @@ const extrusion = extrude(10, sketch001)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -282,8 +671,12 @@ const extrusion = extrude(10, sketch001)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -291,8 +684,12 @@ const extrusion = extrude(10, sketch001)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -302,8 +699,12 @@ const extrusion = extrude(10, sketch001)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -315,8 +716,12 @@ const extrusion = extrude(10, sketch001)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",

View File

@ -9,7 +9,7 @@ Draw an angled line of a given y length.
```js ```js
angledLineOfYLength(data: AngledLineData, sketch_group: SketchGroup, tag?: String) -> SketchGroup angledLineOfYLength(data: AngledLineData, sketch_group: SketchGroup, tag?: TagDeclarator) -> SketchGroup
``` ```
### Examples ### Examples
@ -79,10 +79,181 @@ const example = extrude(10, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -109,8 +280,12 @@ const example = extrude(10, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -118,8 +293,12 @@ const example = extrude(10, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -131,8 +310,12 @@ const example = extrude(10, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -140,8 +323,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -149,8 +336,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -160,8 +351,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -173,15 +368,26 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",
}], }],
} }
``` ```
* `tag`: `String` (OPTIONAL) * `tag`: `TagDeclarator` (OPTIONAL)
```js
{
end: number,
start: number,
value: string,
}
```
### Returns ### Returns
@ -223,10 +429,181 @@ const example = extrude(10, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -253,8 +630,12 @@ const example = extrude(10, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -262,8 +643,12 @@ const example = extrude(10, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -275,8 +660,12 @@ const example = extrude(10, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -284,8 +673,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -293,8 +686,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -304,8 +701,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -317,8 +718,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",

View File

@ -9,7 +9,7 @@ Draw an angled line that intersects with a given line.
```js ```js
angledLineThatIntersects(data: AngledLineThatIntersectsData, sketch_group: SketchGroup, tag?: String) -> SketchGroup angledLineThatIntersects(data: AngledLineThatIntersectsData, sketch_group: SketchGroup, tag?: TagDeclarator) -> SketchGroup
``` ```
### Examples ### Examples
@ -40,7 +40,9 @@ const example = extrude(10, exampleSketch)
// The angle of the line. // The angle of the line.
angle: number, angle: number,
// The tag of the line to intersect with. // The tag of the line to intersect with.
intersectTag: string, intersectTag: {
value: string,
},
// The offset from the intersecting line. // The offset from the intersecting line.
offset: number, offset: number,
} }
@ -83,10 +85,181 @@ const example = extrude(10, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -113,8 +286,12 @@ const example = extrude(10, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -122,8 +299,12 @@ const example = extrude(10, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -135,8 +316,12 @@ const example = extrude(10, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -144,8 +329,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -153,8 +342,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -164,8 +357,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -177,15 +374,26 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",
}], }],
} }
``` ```
* `tag`: `String` (OPTIONAL) * `tag`: `TagDeclarator` (OPTIONAL)
```js
{
end: number,
start: number,
value: string,
}
```
### Returns ### Returns
@ -227,10 +435,181 @@ const example = extrude(10, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -257,8 +636,12 @@ const example = extrude(10, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -266,8 +649,12 @@ const example = extrude(10, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -279,8 +666,12 @@ const example = extrude(10, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -288,8 +679,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -297,8 +692,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -308,8 +707,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -321,8 +724,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",

View File

@ -9,7 +9,7 @@ Draw an angled line to a given x coordinate.
```js ```js
angledLineToX(data: AngledLineToData, sketch_group: SketchGroup, tag?: String) -> SketchGroup angledLineToX(data: AngledLineToData, sketch_group: SketchGroup, tag?: TagDeclarator) -> SketchGroup
``` ```
### Examples ### Examples
@ -76,10 +76,181 @@ const example = extrude(10, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -106,8 +277,12 @@ const example = extrude(10, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -115,8 +290,12 @@ const example = extrude(10, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -128,8 +307,12 @@ const example = extrude(10, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -137,8 +320,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -146,8 +333,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -157,8 +348,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -170,15 +365,26 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",
}], }],
} }
``` ```
* `tag`: `String` (OPTIONAL) * `tag`: `TagDeclarator` (OPTIONAL)
```js
{
end: number,
start: number,
value: string,
}
```
### Returns ### Returns
@ -220,10 +426,181 @@ const example = extrude(10, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -250,8 +627,12 @@ const example = extrude(10, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -259,8 +640,12 @@ const example = extrude(10, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -272,8 +657,12 @@ const example = extrude(10, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -281,8 +670,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -290,8 +683,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -301,8 +698,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -314,8 +715,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",

View File

@ -9,7 +9,7 @@ Draw an angled line to a given y coordinate.
```js ```js
angledLineToY(data: AngledLineToData, sketch_group: SketchGroup, tag?: String) -> SketchGroup angledLineToY(data: AngledLineToData, sketch_group: SketchGroup, tag?: TagDeclarator) -> SketchGroup
``` ```
### Examples ### Examples
@ -76,10 +76,181 @@ const example = extrude(10, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -106,8 +277,12 @@ const example = extrude(10, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -115,8 +290,12 @@ const example = extrude(10, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -128,8 +307,12 @@ const example = extrude(10, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -137,8 +320,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -146,8 +333,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -157,8 +348,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -170,15 +365,26 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",
}], }],
} }
``` ```
* `tag`: `String` (OPTIONAL) * `tag`: `TagDeclarator` (OPTIONAL)
```js
{
end: number,
start: number,
value: string,
}
```
### Returns ### Returns
@ -220,10 +426,181 @@ const example = extrude(10, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -250,8 +627,12 @@ const example = extrude(10, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -259,8 +640,12 @@ const example = extrude(10, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -272,8 +657,12 @@ const example = extrude(10, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -281,8 +670,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -290,8 +683,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -301,8 +698,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -314,8 +715,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",

View File

@ -9,7 +9,7 @@ Draw an arc.
```js ```js
arc(data: ArcData, sketch_group: SketchGroup, tag?: String) -> SketchGroup arc(data: ArcData, sketch_group: SketchGroup, tag?: TagDeclarator) -> SketchGroup
``` ```
### Examples ### Examples
@ -87,10 +87,181 @@ const exampleSketch = startSketchOn('XZ')
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -117,8 +288,12 @@ const exampleSketch = startSketchOn('XZ')
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -126,8 +301,12 @@ const exampleSketch = startSketchOn('XZ')
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -139,8 +318,12 @@ const exampleSketch = startSketchOn('XZ')
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -148,8 +331,12 @@ const exampleSketch = startSketchOn('XZ')
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -157,8 +344,12 @@ const exampleSketch = startSketchOn('XZ')
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -168,8 +359,12 @@ const exampleSketch = startSketchOn('XZ')
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -181,15 +376,26 @@ const exampleSketch = startSketchOn('XZ')
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",
}], }],
} }
``` ```
* `tag`: `String` (OPTIONAL) * `tag`: `TagDeclarator` (OPTIONAL)
```js
{
end: number,
start: number,
value: string,
}
```
### Returns ### Returns
@ -231,10 +437,181 @@ const exampleSketch = startSketchOn('XZ')
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -261,8 +638,12 @@ const exampleSketch = startSketchOn('XZ')
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -270,8 +651,12 @@ const exampleSketch = startSketchOn('XZ')
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -283,8 +668,12 @@ const exampleSketch = startSketchOn('XZ')
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -292,8 +681,12 @@ const exampleSketch = startSketchOn('XZ')
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -301,8 +694,12 @@ const exampleSketch = startSketchOn('XZ')
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -312,8 +709,12 @@ const exampleSketch = startSketchOn('XZ')
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -325,8 +726,12 @@ const exampleSketch = startSketchOn('XZ')
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",

View File

@ -9,7 +9,7 @@ Draw a bezier curve.
```js ```js
bezierCurve(data: BezierData, sketch_group: SketchGroup, tag?: String) -> SketchGroup bezierCurve(data: BezierData, sketch_group: SketchGroup, tag?: TagDeclarator) -> SketchGroup
``` ```
### Examples ### Examples
@ -82,10 +82,181 @@ const example = extrude(10, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -112,8 +283,12 @@ const example = extrude(10, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -121,8 +296,12 @@ const example = extrude(10, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -134,8 +313,12 @@ const example = extrude(10, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -143,8 +326,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -152,8 +339,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -163,8 +354,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -176,15 +371,26 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",
}], }],
} }
``` ```
* `tag`: `String` (OPTIONAL) * `tag`: `TagDeclarator` (OPTIONAL)
```js
{
end: number,
start: number,
value: string,
}
```
### Returns ### Returns
@ -226,10 +432,181 @@ const example = extrude(10, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -256,8 +633,12 @@ const example = extrude(10, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -265,8 +646,12 @@ const example = extrude(10, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -278,8 +663,12 @@ const example = extrude(10, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -287,8 +676,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -296,8 +689,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -307,8 +704,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -320,8 +721,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",

View File

@ -9,7 +9,7 @@ Create chamfers on tagged paths.
```js ```js
chamfer(data: ChamferData, extrude_group: ExtrudeGroup) -> ExtrudeGroup chamfer(data: ChamferData, extrude_group: ExtrudeGroup, tag?: TagDeclarator) -> ExtrudeGroup
``` ```
### Examples ### Examples
@ -50,7 +50,9 @@ const mountingPlate = extrude(thickness, mountingPlateSketch)
length: number, length: number,
// The tags of the paths you want to chamfer. // The tags of the paths you want to chamfer.
tags: [uuid | tags: [uuid |
string], {
value: string,
}],
} }
``` ```
* `extrude_group`: `ExtrudeGroup` - An extrude group is a collection of extrude surfaces. (REQUIRED) * `extrude_group`: `ExtrudeGroup` - An extrude group is a collection of extrude surfaces. (REQUIRED)
@ -58,6 +60,28 @@ string],
{ {
// The id of the extrusion end cap // The id of the extrusion end cap
endCapId: uuid, endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group. // The height of the extrude group.
height: number, height: number,
// The id of the extrude group. // The id of the extrude group.
@ -99,10 +123,74 @@ string],
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: SketchGroup,
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -129,8 +217,12 @@ string],
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -138,8 +230,12 @@ string],
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -151,8 +247,12 @@ string],
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -160,8 +260,12 @@ string],
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -169,8 +273,12 @@ string],
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -180,8 +288,12 @@ string],
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -193,8 +305,12 @@ string],
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",
@ -208,10 +324,14 @@ string],
faceId: uuid, faceId: uuid,
// The id of the geometry. // The id of the geometry.
id: uuid, id: uuid,
// The name.
name: string,
// The source range. // The source range.
sourceRange: [number, number], sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane", type: "extrudePlane",
} | } |
{ {
@ -219,14 +339,26 @@ string],
faceId: uuid, faceId: uuid,
// The id of the geometry. // The id of the geometry.
id: uuid, id: uuid,
// The name.
name: string,
// The source range. // The source range.
sourceRange: [number, number], sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc", type: "extrudeArc",
}], }],
} }
``` ```
* `tag`: `TagDeclarator` (OPTIONAL)
```js
{
end: number,
start: number,
value: string,
}
```
### Returns ### Returns
@ -235,6 +367,28 @@ string],
{ {
// The id of the extrusion end cap // The id of the extrusion end cap
endCapId: uuid, endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group. // The height of the extrude group.
height: number, height: number,
// The id of the extrude group. // The id of the extrude group.
@ -276,10 +430,74 @@ string],
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: SketchGroup,
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -306,8 +524,12 @@ string],
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -315,8 +537,12 @@ string],
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -328,8 +554,12 @@ string],
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -337,8 +567,12 @@ string],
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -346,8 +580,12 @@ string],
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -357,8 +595,12 @@ string],
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -370,8 +612,12 @@ string],
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",
@ -385,10 +631,14 @@ string],
faceId: uuid, faceId: uuid,
// The id of the geometry. // The id of the geometry.
id: uuid, id: uuid,
// The name.
name: string,
// The source range. // The source range.
sourceRange: [number, number], sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane", type: "extrudePlane",
} | } |
{ {
@ -396,10 +646,14 @@ string],
faceId: uuid, faceId: uuid,
// The id of the geometry. // The id of the geometry.
id: uuid, id: uuid,
// The name.
name: string,
// The source range. // The source range.
sourceRange: [number, number], sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc", type: "extrudeArc",
}], }],
} }

View File

@ -9,7 +9,7 @@ Sketch a circle.
```js ```js
circle(center: [number], radius: number, tag?: String, sketch_surface_or_group: SketchSurfaceOrGroup) -> SketchGroup circle(center: [number], radius: number, tag?: TagDeclarator, sketch_surface_or_group: SketchSurfaceOrGroup) -> SketchGroup
``` ```
### Examples ### Examples
@ -41,7 +41,14 @@ const example = extrude(5, exampleSketch)
* `center`: `[number]` (REQUIRED) * `center`: `[number]` (REQUIRED)
* `radius`: `number` (REQUIRED) * `radius`: `number` (REQUIRED)
* `tag`: `String` (OPTIONAL) * `tag`: `TagDeclarator` (OPTIONAL)
```js
{
end: number,
start: number,
value: string,
}
```
* `sketch_surface_or_group`: `SketchSurfaceOrGroup` - A sketch surface or a sketch group. (REQUIRED) * `sketch_surface_or_group`: `SketchSurfaceOrGroup` - A sketch surface or a sketch group. (REQUIRED)
```js ```js
{ {
@ -76,10 +83,181 @@ const example = extrude(5, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -138,10 +316,74 @@ const example = extrude(5, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: SketchGroup,
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -168,8 +410,12 @@ const example = extrude(5, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -177,8 +423,12 @@ const example = extrude(5, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -190,8 +440,12 @@ const example = extrude(5, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -199,8 +453,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -208,8 +466,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -219,8 +481,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -232,8 +498,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",
@ -281,10 +551,181 @@ const example = extrude(5, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -311,8 +752,12 @@ const example = extrude(5, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -320,8 +765,12 @@ const example = extrude(5, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -333,8 +782,12 @@ const example = extrude(5, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -342,8 +795,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -351,8 +808,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -362,8 +823,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -375,8 +840,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",

View File

@ -9,7 +9,7 @@ Close the current sketch.
```js ```js
close(sketch_group: SketchGroup, tag?: String) -> SketchGroup close(sketch_group: SketchGroup, tag?: TagDeclarator) -> SketchGroup
``` ```
### Examples ### Examples
@ -77,10 +77,181 @@ const example = extrude(10, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -107,8 +278,12 @@ const example = extrude(10, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -116,8 +291,12 @@ const example = extrude(10, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -129,8 +308,12 @@ const example = extrude(10, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -138,8 +321,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -147,8 +334,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -158,8 +349,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -171,15 +366,26 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",
}], }],
} }
``` ```
* `tag`: `String` (OPTIONAL) * `tag`: `TagDeclarator` (OPTIONAL)
```js
{
end: number,
start: number,
value: string,
}
```
### Returns ### Returns
@ -221,10 +427,181 @@ const example = extrude(10, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -251,8 +628,12 @@ const example = extrude(10, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -260,8 +641,12 @@ const example = extrude(10, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -273,8 +658,12 @@ const example = extrude(10, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -282,8 +671,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -291,8 +684,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -302,8 +699,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -315,8 +716,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",

View File

@ -102,10 +102,181 @@ const example = extrude(10, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -132,8 +303,12 @@ const example = extrude(10, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -142,8 +317,12 @@ const example = extrude(10, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -155,8 +334,12 @@ const example = extrude(10, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -164,8 +347,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -173,8 +360,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -184,8 +375,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -197,8 +392,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",
@ -216,6 +415,28 @@ const example = extrude(10, exampleSketch)
{ {
// The id of the extrusion end cap // The id of the extrusion end cap
endCapId: uuid, endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group. // The height of the extrude group.
height: number, height: number,
// The id of the extrude group. // The id of the extrude group.
@ -257,10 +478,74 @@ const example = extrude(10, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: SketchGroup,
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -287,8 +572,12 @@ const example = extrude(10, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -296,8 +585,12 @@ const example = extrude(10, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -309,8 +602,12 @@ const example = extrude(10, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -318,8 +615,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -327,8 +628,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -338,8 +643,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -351,8 +660,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",
@ -367,10 +680,14 @@ const example = extrude(10, exampleSketch)
faceId: uuid, faceId: uuid,
// The id of the geometry. // The id of the geometry.
id: uuid, id: uuid,
// The name.
name: string,
// The source range. // The source range.
sourceRange: [number, number], sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane", type: "extrudePlane",
} | } |
{ {
@ -378,10 +695,14 @@ const example = extrude(10, exampleSketch)
faceId: uuid, faceId: uuid,
// The id of the geometry. // The id of the geometry.
id: uuid, id: uuid,
// The name.
name: string,
// The source range. // The source range.
sourceRange: [number, number], sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc", type: "extrudeArc",
}], }],
} | } |

View File

@ -50,7 +50,9 @@ const mountingPlate = extrude(thickness, mountingPlateSketch)
radius: number, radius: number,
// The tags of the paths you want to fillet. // The tags of the paths you want to fillet.
tags: [uuid | tags: [uuid |
string], {
value: string,
}],
} }
``` ```
* `extrude_group`: `ExtrudeGroup` - An extrude group is a collection of extrude surfaces. (REQUIRED) * `extrude_group`: `ExtrudeGroup` - An extrude group is a collection of extrude surfaces. (REQUIRED)
@ -58,6 +60,28 @@ string],
{ {
// The id of the extrusion end cap // The id of the extrusion end cap
endCapId: uuid, endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group. // The height of the extrude group.
height: number, height: number,
// The id of the extrude group. // The id of the extrude group.
@ -99,10 +123,74 @@ string],
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: SketchGroup,
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -129,8 +217,12 @@ string],
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -138,8 +230,12 @@ string],
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -151,8 +247,12 @@ string],
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -160,8 +260,12 @@ string],
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -169,8 +273,12 @@ string],
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -180,8 +288,12 @@ string],
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -193,8 +305,12 @@ string],
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",
@ -208,10 +324,14 @@ string],
faceId: uuid, faceId: uuid,
// The id of the geometry. // The id of the geometry.
id: uuid, id: uuid,
// The name.
name: string,
// The source range. // The source range.
sourceRange: [number, number], sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane", type: "extrudePlane",
} | } |
{ {
@ -219,10 +339,14 @@ string],
faceId: uuid, faceId: uuid,
// The id of the geometry. // The id of the geometry.
id: uuid, id: uuid,
// The name.
name: string,
// The source range. // The source range.
sourceRange: [number, number], sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc", type: "extrudeArc",
}], }],
} }
@ -235,6 +359,28 @@ string],
{ {
// The id of the extrusion end cap // The id of the extrusion end cap
endCapId: uuid, endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group. // The height of the extrude group.
height: number, height: number,
// The id of the extrude group. // The id of the extrude group.
@ -276,10 +422,74 @@ string],
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: SketchGroup,
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -306,8 +516,12 @@ string],
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -315,8 +529,12 @@ string],
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -328,8 +546,12 @@ string],
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -337,8 +559,12 @@ string],
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -346,8 +572,12 @@ string],
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -357,8 +587,12 @@ string],
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -370,8 +604,12 @@ string],
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",
@ -385,10 +623,14 @@ string],
faceId: uuid, faceId: uuid,
// The id of the geometry. // The id of the geometry.
id: uuid, id: uuid,
// The name.
name: string,
// The source range. // The source range.
sourceRange: [number, number], sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane", type: "extrudePlane",
} | } |
{ {
@ -396,10 +638,14 @@ string],
faceId: uuid, faceId: uuid,
// The id of the geometry. // The id of the geometry.
id: uuid, id: uuid,
// The name.
name: string,
// The source range. // The source range.
sourceRange: [number, number], sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc", type: "extrudeArc",
}], }],
} }

View File

@ -9,7 +9,7 @@ Get an edge on a 3D solid.
```js ```js
getEdge(tag: String, extrude_group: ExtrudeGroup) -> Uuid getEdge(tag: TagIdentifier, extrude_group: ExtrudeGroup) -> Uuid
``` ```
### Examples ### Examples
@ -39,12 +39,39 @@ const revolution = startSketchOn(box, "revolveAxis")
### Arguments ### Arguments
* `tag`: `String` (REQUIRED) * `tag`: `TagIdentifier` (REQUIRED)
```js
{
value: string,
}
```
* `extrude_group`: `ExtrudeGroup` - An extrude group is a collection of extrude surfaces. (REQUIRED) * `extrude_group`: `ExtrudeGroup` - An extrude group is a collection of extrude surfaces. (REQUIRED)
```js ```js
{ {
// The id of the extrusion end cap // The id of the extrusion end cap
endCapId: uuid, endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group. // The height of the extrude group.
height: number, height: number,
// The id of the extrude group. // The id of the extrude group.
@ -86,10 +113,74 @@ const revolution = startSketchOn(box, "revolveAxis")
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: SketchGroup,
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -116,8 +207,12 @@ const revolution = startSketchOn(box, "revolveAxis")
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -125,8 +220,12 @@ const revolution = startSketchOn(box, "revolveAxis")
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -138,8 +237,12 @@ const revolution = startSketchOn(box, "revolveAxis")
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -147,8 +250,12 @@ const revolution = startSketchOn(box, "revolveAxis")
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -156,8 +263,12 @@ const revolution = startSketchOn(box, "revolveAxis")
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -167,8 +278,12 @@ const revolution = startSketchOn(box, "revolveAxis")
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -180,8 +295,12 @@ const revolution = startSketchOn(box, "revolveAxis")
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",
@ -195,10 +314,14 @@ const revolution = startSketchOn(box, "revolveAxis")
faceId: uuid, faceId: uuid,
// The id of the geometry. // The id of the geometry.
id: uuid, id: uuid,
// The name.
name: string,
// The source range. // The source range.
sourceRange: [number, number], sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane", type: "extrudePlane",
} | } |
{ {
@ -206,10 +329,14 @@ const revolution = startSketchOn(box, "revolveAxis")
faceId: uuid, faceId: uuid,
// The id of the geometry. // The id of the geometry.
id: uuid, id: uuid,
// The name.
name: string,
// The source range. // The source range.
sourceRange: [number, number], sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc", type: "extrudeArc",
}], }],
} }

View File

@ -9,7 +9,7 @@ Get the next adjacent edge to the edge given.
```js ```js
getNextAdjacentEdge(tag: String, extrude_group: ExtrudeGroup) -> Uuid getNextAdjacentEdge(tag: TagIdentifier, extrude_group: ExtrudeGroup) -> Uuid
``` ```
### Examples ### Examples
@ -37,12 +37,39 @@ const example = extrude(5, exampleSketch)
### Arguments ### Arguments
* `tag`: `String` (REQUIRED) * `tag`: `TagIdentifier` (REQUIRED)
```js
{
value: string,
}
```
* `extrude_group`: `ExtrudeGroup` - An extrude group is a collection of extrude surfaces. (REQUIRED) * `extrude_group`: `ExtrudeGroup` - An extrude group is a collection of extrude surfaces. (REQUIRED)
```js ```js
{ {
// The id of the extrusion end cap // The id of the extrusion end cap
endCapId: uuid, endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group. // The height of the extrude group.
height: number, height: number,
// The id of the extrude group. // The id of the extrude group.
@ -84,10 +111,74 @@ const example = extrude(5, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: SketchGroup,
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -114,8 +205,12 @@ const example = extrude(5, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -123,8 +218,12 @@ const example = extrude(5, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -136,8 +235,12 @@ const example = extrude(5, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -145,8 +248,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -154,8 +261,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -165,8 +276,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -178,8 +293,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",
@ -193,10 +312,14 @@ const example = extrude(5, exampleSketch)
faceId: uuid, faceId: uuid,
// The id of the geometry. // The id of the geometry.
id: uuid, id: uuid,
// The name.
name: string,
// The source range. // The source range.
sourceRange: [number, number], sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane", type: "extrudePlane",
} | } |
{ {
@ -204,10 +327,14 @@ const example = extrude(5, exampleSketch)
faceId: uuid, faceId: uuid,
// The id of the geometry. // The id of the geometry.
id: uuid, id: uuid,
// The name.
name: string,
// The source range. // The source range.
sourceRange: [number, number], sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc", type: "extrudeArc",
}], }],
} }

View File

@ -9,7 +9,7 @@ Get the opposite edge to the edge given.
```js ```js
getOppositeEdge(tag: String, extrude_group: ExtrudeGroup) -> Uuid getOppositeEdge(tag: TagIdentifier, extrude_group: ExtrudeGroup) -> Uuid
``` ```
### Examples ### Examples
@ -35,12 +35,39 @@ const example = extrude(5, exampleSketch)
### Arguments ### Arguments
* `tag`: `String` (REQUIRED) * `tag`: `TagIdentifier` (REQUIRED)
```js
{
value: string,
}
```
* `extrude_group`: `ExtrudeGroup` - An extrude group is a collection of extrude surfaces. (REQUIRED) * `extrude_group`: `ExtrudeGroup` - An extrude group is a collection of extrude surfaces. (REQUIRED)
```js ```js
{ {
// The id of the extrusion end cap // The id of the extrusion end cap
endCapId: uuid, endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group. // The height of the extrude group.
height: number, height: number,
// The id of the extrude group. // The id of the extrude group.
@ -82,10 +109,74 @@ const example = extrude(5, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: SketchGroup,
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -112,8 +203,12 @@ const example = extrude(5, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -121,8 +216,12 @@ const example = extrude(5, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -134,8 +233,12 @@ const example = extrude(5, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -143,8 +246,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -152,8 +259,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -163,8 +274,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -176,8 +291,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",
@ -191,10 +310,14 @@ const example = extrude(5, exampleSketch)
faceId: uuid, faceId: uuid,
// The id of the geometry. // The id of the geometry.
id: uuid, id: uuid,
// The name.
name: string,
// The source range. // The source range.
sourceRange: [number, number], sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane", type: "extrudePlane",
} | } |
{ {
@ -202,10 +325,14 @@ const example = extrude(5, exampleSketch)
faceId: uuid, faceId: uuid,
// The id of the geometry. // The id of the geometry.
id: uuid, id: uuid,
// The name.
name: string,
// The source range. // The source range.
sourceRange: [number, number], sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc", type: "extrudeArc",
}], }],
} }

View File

@ -9,7 +9,7 @@ Get the previous adjacent edge to the edge given.
```js ```js
getPreviousAdjacentEdge(tag: String, extrude_group: ExtrudeGroup) -> Uuid getPreviousAdjacentEdge(tag: TagIdentifier, extrude_group: ExtrudeGroup) -> Uuid
``` ```
### Examples ### Examples
@ -37,12 +37,39 @@ const example = extrude(5, exampleSketch)
### Arguments ### Arguments
* `tag`: `String` (REQUIRED) * `tag`: `TagIdentifier` (REQUIRED)
```js
{
value: string,
}
```
* `extrude_group`: `ExtrudeGroup` - An extrude group is a collection of extrude surfaces. (REQUIRED) * `extrude_group`: `ExtrudeGroup` - An extrude group is a collection of extrude surfaces. (REQUIRED)
```js ```js
{ {
// The id of the extrusion end cap // The id of the extrusion end cap
endCapId: uuid, endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group. // The height of the extrude group.
height: number, height: number,
// The id of the extrude group. // The id of the extrude group.
@ -84,10 +111,74 @@ const example = extrude(5, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: SketchGroup,
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -114,8 +205,12 @@ const example = extrude(5, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -123,8 +218,12 @@ const example = extrude(5, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -136,8 +235,12 @@ const example = extrude(5, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -145,8 +248,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -154,8 +261,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -165,8 +276,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -178,8 +293,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",
@ -193,10 +312,14 @@ const example = extrude(5, exampleSketch)
faceId: uuid, faceId: uuid,
// The id of the geometry. // The id of the geometry.
id: uuid, id: uuid,
// The name.
name: string,
// The source range. // The source range.
sourceRange: [number, number], sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane", type: "extrudePlane",
} | } |
{ {
@ -204,10 +327,14 @@ const example = extrude(5, exampleSketch)
faceId: uuid, faceId: uuid,
// The id of the geometry. // The id of the geometry.
id: uuid, id: uuid,
// The name.
name: string,
// The source range. // The source range.
sourceRange: [number, number], sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc", type: "extrudeArc",
}], }],
} }

View File

@ -48,6 +48,28 @@ const part001 = startSketchOn('XY')
{ {
// The id of the extrusion end cap // The id of the extrusion end cap
endCapId: uuid, endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group. // The height of the extrude group.
height: number, height: number,
// The id of the extrude group. // The id of the extrude group.
@ -89,10 +111,74 @@ const part001 = startSketchOn('XY')
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: SketchGroup,
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -119,8 +205,12 @@ const part001 = startSketchOn('XY')
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -128,8 +218,12 @@ const part001 = startSketchOn('XY')
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -141,8 +235,12 @@ const part001 = startSketchOn('XY')
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -150,8 +248,12 @@ const part001 = startSketchOn('XY')
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -159,8 +261,12 @@ const part001 = startSketchOn('XY')
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -170,8 +276,12 @@ const part001 = startSketchOn('XY')
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -183,8 +293,12 @@ const part001 = startSketchOn('XY')
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",
@ -198,10 +312,14 @@ const part001 = startSketchOn('XY')
faceId: uuid, faceId: uuid,
// The id of the geometry. // The id of the geometry.
id: uuid, id: uuid,
// The name.
name: string,
// The source range. // The source range.
sourceRange: [number, number], sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane", type: "extrudePlane",
} | } |
{ {
@ -209,10 +327,14 @@ const part001 = startSketchOn('XY')
faceId: uuid, faceId: uuid,
// The id of the geometry. // The id of the geometry.
id: uuid, id: uuid,
// The name.
name: string,
// The source range. // The source range.
sourceRange: [number, number], sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc", type: "extrudeArc",
}], }],
} }
@ -225,6 +347,28 @@ const part001 = startSketchOn('XY')
{ {
// The id of the extrusion end cap // The id of the extrusion end cap
endCapId: uuid, endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group. // The height of the extrude group.
height: number, height: number,
// The id of the extrude group. // The id of the extrude group.
@ -266,10 +410,74 @@ const part001 = startSketchOn('XY')
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: SketchGroup,
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -296,8 +504,12 @@ const part001 = startSketchOn('XY')
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -305,8 +517,12 @@ const part001 = startSketchOn('XY')
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -318,8 +534,12 @@ const part001 = startSketchOn('XY')
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -327,8 +547,12 @@ const part001 = startSketchOn('XY')
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -336,8 +560,12 @@ const part001 = startSketchOn('XY')
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -347,8 +575,12 @@ const part001 = startSketchOn('XY')
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -360,8 +592,12 @@ const part001 = startSketchOn('XY')
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",
@ -375,10 +611,14 @@ const part001 = startSketchOn('XY')
faceId: uuid, faceId: uuid,
// The id of the geometry. // The id of the geometry.
id: uuid, id: uuid,
// The name.
name: string,
// The source range. // The source range.
sourceRange: [number, number], sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane", type: "extrudePlane",
} | } |
{ {
@ -386,10 +626,14 @@ const part001 = startSketchOn('XY')
faceId: uuid, faceId: uuid,
// The id of the geometry. // The id of the geometry.
id: uuid, id: uuid,
// The name.
name: string,
// The source range. // The source range.
sourceRange: [number, number], sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc", type: "extrudeArc",
}], }],
} }

View File

@ -88,10 +88,181 @@ const example = extrude(1, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -118,8 +289,12 @@ const example = extrude(1, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -128,8 +303,12 @@ const example = extrude(1, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -141,8 +320,12 @@ const example = extrude(1, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -150,8 +333,12 @@ const example = extrude(1, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -159,8 +346,12 @@ const example = extrude(1, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -170,8 +361,12 @@ const example = extrude(1, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -183,8 +378,12 @@ const example = extrude(1, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",
@ -232,10 +431,181 @@ const example = extrude(1, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -262,8 +632,12 @@ const example = extrude(1, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -271,8 +645,12 @@ const example = extrude(1, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -284,8 +662,12 @@ const example = extrude(1, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -293,8 +675,12 @@ const example = extrude(1, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -302,8 +688,12 @@ const example = extrude(1, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -313,8 +703,12 @@ const example = extrude(1, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -326,8 +720,12 @@ const example = extrude(1, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",
@ -375,10 +773,181 @@ const example = extrude(1, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -405,8 +974,12 @@ const example = extrude(1, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -414,8 +987,12 @@ const example = extrude(1, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -427,8 +1004,12 @@ const example = extrude(1, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -436,8 +1017,12 @@ const example = extrude(1, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -445,8 +1030,12 @@ const example = extrude(1, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -456,8 +1045,12 @@ const example = extrude(1, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -469,8 +1062,12 @@ const example = extrude(1, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",

View File

@ -68,10 +68,181 @@ const example = extrude(5, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -98,8 +269,12 @@ const example = extrude(5, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -107,8 +282,12 @@ const example = extrude(5, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -120,8 +299,12 @@ const example = extrude(5, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -129,8 +312,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -138,8 +325,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -149,8 +340,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -162,8 +357,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",

View File

@ -68,10 +68,181 @@ const example = extrude(5, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -98,8 +269,12 @@ const example = extrude(5, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -107,8 +282,12 @@ const example = extrude(5, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -120,8 +299,12 @@ const example = extrude(5, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -129,8 +312,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -138,8 +325,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -149,8 +340,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -162,8 +357,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",

View File

@ -9,7 +9,7 @@ Draw a line.
```js ```js
line(delta: [number], sketch_group: SketchGroup, tag?: String) -> SketchGroup line(delta: [number], sketch_group: SketchGroup, tag?: TagDeclarator) -> SketchGroup
``` ```
### Examples ### Examples
@ -81,10 +81,181 @@ const example = extrude(5, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -111,8 +282,12 @@ const example = extrude(5, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -120,8 +295,12 @@ const example = extrude(5, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -133,8 +312,12 @@ const example = extrude(5, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -142,8 +325,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -151,8 +338,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -162,8 +353,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -175,15 +370,26 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",
}], }],
} }
``` ```
* `tag`: `String` (OPTIONAL) * `tag`: `TagDeclarator` (OPTIONAL)
```js
{
end: number,
start: number,
value: string,
}
```
### Returns ### Returns
@ -225,10 +431,181 @@ const example = extrude(5, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -255,8 +632,12 @@ const example = extrude(5, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -264,8 +645,12 @@ const example = extrude(5, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -277,8 +662,12 @@ const example = extrude(5, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -286,8 +675,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -295,8 +688,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -306,8 +703,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -319,8 +720,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",

View File

@ -9,7 +9,7 @@ Draw a line to a point.
```js ```js
lineTo(to: [number], sketch_group: SketchGroup, tag?: String) -> SketchGroup lineTo(to: [number], sketch_group: SketchGroup, tag?: TagDeclarator) -> SketchGroup
``` ```
### Examples ### Examples
@ -68,10 +68,181 @@ const example = extrude(5, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -98,8 +269,12 @@ const example = extrude(5, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -107,8 +282,12 @@ const example = extrude(5, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -120,8 +299,12 @@ const example = extrude(5, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -129,8 +312,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -138,8 +325,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -149,8 +340,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -162,15 +357,26 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",
}], }],
} }
``` ```
* `tag`: `String` (OPTIONAL) * `tag`: `TagDeclarator` (OPTIONAL)
```js
{
end: number,
start: number,
value: string,
}
```
### Returns ### Returns
@ -212,10 +418,181 @@ const example = extrude(5, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -242,8 +619,12 @@ const example = extrude(5, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -251,8 +632,12 @@ const example = extrude(5, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -264,8 +649,12 @@ const example = extrude(5, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -273,8 +662,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -282,8 +675,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -293,8 +690,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -306,8 +707,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",

View File

@ -86,10 +86,181 @@ const example = extrude(1, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -116,8 +287,12 @@ const example = extrude(1, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -126,8 +301,12 @@ const example = extrude(1, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -139,8 +318,12 @@ const example = extrude(1, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -148,8 +331,12 @@ const example = extrude(1, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -157,8 +344,12 @@ const example = extrude(1, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -168,8 +359,12 @@ const example = extrude(1, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -181,8 +376,12 @@ const example = extrude(1, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",

View File

@ -52,6 +52,28 @@ const example = extrude(-5, exampleSketch)
{ {
// The id of the extrusion end cap // The id of the extrusion end cap
endCapId: uuid, endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group. // The height of the extrude group.
height: number, height: number,
// The id of the extrude group. // The id of the extrude group.
@ -93,10 +115,74 @@ const example = extrude(-5, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: SketchGroup,
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -123,8 +209,12 @@ const example = extrude(-5, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -132,8 +222,12 @@ const example = extrude(-5, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -145,8 +239,12 @@ const example = extrude(-5, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -154,8 +252,12 @@ const example = extrude(-5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -163,8 +265,12 @@ const example = extrude(-5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -174,8 +280,12 @@ const example = extrude(-5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -187,8 +297,12 @@ const example = extrude(-5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",
@ -203,10 +317,14 @@ const example = extrude(-5, exampleSketch)
faceId: uuid, faceId: uuid,
// The id of the geometry. // The id of the geometry.
id: uuid, id: uuid,
// The name.
name: string,
// The source range. // The source range.
sourceRange: [number, number], sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane", type: "extrudePlane",
} | } |
{ {
@ -214,10 +332,14 @@ const example = extrude(-5, exampleSketch)
faceId: uuid, faceId: uuid,
// The id of the geometry. // The id of the geometry.
id: uuid, id: uuid,
// The name.
name: string,
// The source range. // The source range.
sourceRange: [number, number], sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc", type: "extrudeArc",
}], }],
} | } |

View File

@ -79,10 +79,181 @@ const example = extrude(1, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -109,8 +280,12 @@ const example = extrude(1, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -119,8 +294,12 @@ const example = extrude(1, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -132,8 +311,12 @@ const example = extrude(1, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -141,8 +324,12 @@ const example = extrude(1, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -150,8 +337,12 @@ const example = extrude(1, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -161,8 +352,12 @@ const example = extrude(1, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -174,8 +369,12 @@ const example = extrude(1, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",

View File

@ -50,6 +50,28 @@ const example = extrude(1, exampleSketch)
{ {
// The id of the extrusion end cap // The id of the extrusion end cap
endCapId: uuid, endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group. // The height of the extrude group.
height: number, height: number,
// The id of the extrude group. // The id of the extrude group.
@ -91,10 +113,74 @@ const example = extrude(1, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: SketchGroup,
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -121,8 +207,12 @@ const example = extrude(1, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -130,8 +220,12 @@ const example = extrude(1, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -143,8 +237,12 @@ const example = extrude(1, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -152,8 +250,12 @@ const example = extrude(1, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -161,8 +263,12 @@ const example = extrude(1, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -172,8 +278,12 @@ const example = extrude(1, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -185,8 +295,12 @@ const example = extrude(1, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",
@ -201,10 +315,14 @@ const example = extrude(1, exampleSketch)
faceId: uuid, faceId: uuid,
// The id of the geometry. // The id of the geometry.
id: uuid, id: uuid,
// The name.
name: string,
// The source range. // The source range.
sourceRange: [number, number], sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane", type: "extrudePlane",
} | } |
{ {
@ -212,10 +330,14 @@ const example = extrude(1, exampleSketch)
faceId: uuid, faceId: uuid,
// The id of the geometry. // The id of the geometry.
id: uuid, id: uuid,
// The name.
name: string,
// The source range. // The source range.
sourceRange: [number, number], sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc", type: "extrudeArc",
}], }],
} | } |

View File

@ -69,10 +69,181 @@ const sketch001 = startSketchOn('XY')
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -99,8 +270,12 @@ const sketch001 = startSketchOn('XY')
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -108,8 +283,12 @@ const sketch001 = startSketchOn('XY')
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -121,8 +300,12 @@ const sketch001 = startSketchOn('XY')
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -130,8 +313,12 @@ const sketch001 = startSketchOn('XY')
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -139,8 +326,12 @@ const sketch001 = startSketchOn('XY')
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -150,8 +341,12 @@ const sketch001 = startSketchOn('XY')
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -163,8 +358,12 @@ const sketch001 = startSketchOn('XY')
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",

View File

@ -64,10 +64,181 @@ const sketch001 = startSketchOn('XY')
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -94,8 +265,12 @@ const sketch001 = startSketchOn('XY')
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -103,8 +278,12 @@ const sketch001 = startSketchOn('XY')
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -116,8 +295,12 @@ const sketch001 = startSketchOn('XY')
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -125,8 +308,12 @@ const sketch001 = startSketchOn('XY')
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -134,8 +321,12 @@ const sketch001 = startSketchOn('XY')
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -145,8 +336,12 @@ const sketch001 = startSketchOn('XY')
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -158,8 +353,12 @@ const sketch001 = startSketchOn('XY')
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",

View File

@ -63,10 +63,181 @@ const sketch001 = startSketchOn('XY')
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -93,8 +264,12 @@ const sketch001 = startSketchOn('XY')
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -102,8 +277,12 @@ const sketch001 = startSketchOn('XY')
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -115,8 +294,12 @@ const sketch001 = startSketchOn('XY')
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -124,8 +307,12 @@ const sketch001 = startSketchOn('XY')
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -133,8 +320,12 @@ const sketch001 = startSketchOn('XY')
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -144,8 +335,12 @@ const sketch001 = startSketchOn('XY')
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -157,8 +352,12 @@ const sketch001 = startSketchOn('XY')
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",

View File

@ -156,7 +156,9 @@ const part001 = revolve({
}, },
} | } |
uuid | uuid |
string, {
value: string,
},
} }
``` ```
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) * `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
@ -197,10 +199,181 @@ string,
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -227,8 +400,12 @@ string,
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -236,8 +413,12 @@ string,
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -249,8 +430,12 @@ string,
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -258,8 +443,12 @@ string,
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -267,8 +456,12 @@ string,
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -278,8 +471,12 @@ string,
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -291,8 +488,12 @@ string,
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",
@ -307,6 +508,28 @@ string,
{ {
// The id of the extrusion end cap // The id of the extrusion end cap
endCapId: uuid, endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group. // The height of the extrude group.
height: number, height: number,
// The id of the extrude group. // The id of the extrude group.
@ -348,10 +571,74 @@ string,
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: SketchGroup,
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -378,8 +665,12 @@ string,
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -387,8 +678,12 @@ string,
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -400,8 +695,12 @@ string,
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -409,8 +708,12 @@ string,
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -418,8 +721,12 @@ string,
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -429,8 +736,12 @@ string,
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -442,8 +753,12 @@ string,
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",
@ -457,10 +772,14 @@ string,
faceId: uuid, faceId: uuid,
// The id of the geometry. // The id of the geometry.
id: uuid, id: uuid,
// The name.
name: string,
// The source range. // The source range.
sourceRange: [number, number], sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane", type: "extrudePlane",
} | } |
{ {
@ -468,10 +787,14 @@ string,
faceId: uuid, faceId: uuid,
// The id of the geometry. // The id of the geometry.
id: uuid, id: uuid,
// The name.
name: string,
// The source range. // The source range.
sourceRange: [number, number], sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc", type: "extrudeArc",
}], }],
} }

View File

@ -9,7 +9,7 @@ Returns the angle of the segment.
```js ```js
segAng(segment_name: string, sketch_group: SketchGroup) -> number segAng(segment_name: TagIdentifier, sketch_group: SketchGroup) -> number
``` ```
### Examples ### Examples
@ -32,7 +32,12 @@ const example = extrude(4, exampleSketch)
### Arguments ### Arguments
* `segment_name`: `string` (REQUIRED) * `segment_name`: `TagIdentifier` (REQUIRED)
```js
{
value: string,
}
```
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) * `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```js ```js
{ {
@ -71,10 +76,181 @@ const example = extrude(4, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -101,8 +277,12 @@ const example = extrude(4, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -110,8 +290,12 @@ const example = extrude(4, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -123,8 +307,12 @@ const example = extrude(4, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -132,8 +320,12 @@ const example = extrude(4, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -141,8 +333,12 @@ const example = extrude(4, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -152,8 +348,12 @@ const example = extrude(4, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -165,8 +365,12 @@ const example = extrude(4, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",

View File

@ -9,7 +9,7 @@ Returns the segment end of x.
```js ```js
segEndX(segment_name: string, sketch_group: SketchGroup) -> number segEndX(segment_name: TagIdentifier, sketch_group: SketchGroup) -> number
``` ```
### Examples ### Examples
@ -30,7 +30,12 @@ const example = extrude(5, exampleSketch)
### Arguments ### Arguments
* `segment_name`: `string` (REQUIRED) * `segment_name`: `TagIdentifier` (REQUIRED)
```js
{
value: string,
}
```
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) * `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```js ```js
{ {
@ -69,10 +74,181 @@ const example = extrude(5, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -99,8 +275,12 @@ const example = extrude(5, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -108,8 +288,12 @@ const example = extrude(5, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -121,8 +305,12 @@ const example = extrude(5, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -130,8 +318,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -139,8 +331,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -150,8 +346,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -163,8 +363,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",

View File

@ -9,7 +9,7 @@ Returns the segment end of y.
```js ```js
segEndY(segment_name: string, sketch_group: SketchGroup) -> number segEndY(segment_name: TagIdentifier, sketch_group: SketchGroup) -> number
``` ```
### Examples ### Examples
@ -31,7 +31,12 @@ const example = extrude(5, exampleSketch)
### Arguments ### Arguments
* `segment_name`: `string` (REQUIRED) * `segment_name`: `TagIdentifier` (REQUIRED)
```js
{
value: string,
}
```
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) * `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```js ```js
{ {
@ -70,10 +75,181 @@ const example = extrude(5, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -100,8 +276,12 @@ const example = extrude(5, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -109,8 +289,12 @@ const example = extrude(5, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -122,8 +306,12 @@ const example = extrude(5, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -131,8 +319,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -140,8 +332,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -151,8 +347,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -164,8 +364,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",

View File

@ -9,7 +9,7 @@ Returns the length of the segment.
```js ```js
segLen(segment_name: string, sketch_group: SketchGroup) -> number segLen(segment_name: TagIdentifier, sketch_group: SketchGroup) -> number
``` ```
### Examples ### Examples
@ -32,7 +32,12 @@ const example = extrude(5, exampleSketch)
### Arguments ### Arguments
* `segment_name`: `string` (REQUIRED) * `segment_name`: `TagIdentifier` (REQUIRED)
```js
{
value: string,
}
```
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) * `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```js ```js
{ {
@ -71,10 +76,181 @@ const example = extrude(5, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -101,8 +277,12 @@ const example = extrude(5, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -110,8 +290,12 @@ const example = extrude(5, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -123,8 +307,12 @@ const example = extrude(5, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -132,8 +320,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -141,8 +333,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -152,8 +348,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -165,8 +365,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",

View File

@ -36,7 +36,9 @@ shell({ faces: ['end'], thickness: 0.25 }, firstSketch)
{ {
// The faces you want removed. // The faces you want removed.
faces: ["start" | "end" | faces: ["start" | "end" |
string], {
value: string,
}],
// The thickness of the shell. // The thickness of the shell.
thickness: number, thickness: number,
} }
@ -46,6 +48,28 @@ string],
{ {
// The id of the extrusion end cap // The id of the extrusion end cap
endCapId: uuid, endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group. // The height of the extrude group.
height: number, height: number,
// The id of the extrude group. // The id of the extrude group.
@ -87,10 +111,74 @@ string],
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: SketchGroup,
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -117,8 +205,12 @@ string],
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -126,8 +218,12 @@ string],
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -139,8 +235,12 @@ string],
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -148,8 +248,12 @@ string],
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -157,8 +261,12 @@ string],
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -168,8 +276,12 @@ string],
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -181,8 +293,12 @@ string],
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",
@ -196,10 +312,14 @@ string],
faceId: uuid, faceId: uuid,
// The id of the geometry. // The id of the geometry.
id: uuid, id: uuid,
// The name.
name: string,
// The source range. // The source range.
sourceRange: [number, number], sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane", type: "extrudePlane",
} | } |
{ {
@ -207,10 +327,14 @@ string],
faceId: uuid, faceId: uuid,
// The id of the geometry. // The id of the geometry.
id: uuid, id: uuid,
// The name.
name: string,
// The source range. // The source range.
sourceRange: [number, number], sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc", type: "extrudeArc",
}], }],
} }
@ -223,6 +347,28 @@ string],
{ {
// The id of the extrusion end cap // The id of the extrusion end cap
endCapId: uuid, endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group. // The height of the extrude group.
height: number, height: number,
// The id of the extrude group. // The id of the extrude group.
@ -264,10 +410,74 @@ string],
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: SketchGroup,
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -294,8 +504,12 @@ string],
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -303,8 +517,12 @@ string],
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -316,8 +534,12 @@ string],
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -325,8 +547,12 @@ string],
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -334,8 +560,12 @@ string],
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -345,8 +575,12 @@ string],
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -358,8 +592,12 @@ string],
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",
@ -373,10 +611,14 @@ string],
faceId: uuid, faceId: uuid,
// The id of the geometry. // The id of the geometry.
id: uuid, id: uuid,
// The name.
name: string,
// The source range. // The source range.
sourceRange: [number, number], sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane", type: "extrudePlane",
} | } |
{ {
@ -384,10 +626,14 @@ string],
faceId: uuid, faceId: uuid,
// The id of the geometry. // The id of the geometry.
id: uuid, id: uuid,
// The name.
name: string,
// The source range. // The source range.
sourceRange: [number, number], sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc", type: "extrudeArc",
}], }],
} }

View File

@ -9,7 +9,7 @@ Start a profile at a given point.
```js ```js
startProfileAt(to: [number], sketch_surface: SketchSurface, tag?: String) -> SketchGroup startProfileAt(to: [number], sketch_surface: SketchSurface, tag?: TagDeclarator) -> SketchGroup
``` ```
### Examples ### Examples
@ -90,10 +90,238 @@ const example = extrude(5, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
// The id of the plane.
id: uuid,
// Origin of the plane.
origin: {
x: number,
y: number,
z: number,
},
type: "plane",
// Type for a plane.
value: "XY" | "XZ" | "YZ" | "Custom",
// What should the planes X axis be?
xAxis: {
x: number,
y: number,
z: number,
},
// What should the planes Y axis be?
yAxis: {
x: number,
y: number,
z: number,
},
// The z-axis (normal).
zAxis: {
x: number,
y: number,
z: number,
},
} |
{
// The extrude group the face is on.
extrudeGroup: ExtrudeGroup,
// The id of the face.
id: uuid,
type: "face",
// The tag of the face.
value: string,
// What should the faces X axis be?
xAxis: {
x: number,
y: number,
z: number,
},
// What should the faces Y axis be?
yAxis: {
x: number,
y: number,
z: number,
},
// The z-axis (normal).
zAxis: {
x: number,
y: number,
z: number,
},
},
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -117,7 +345,14 @@ const example = extrude(5, exampleSketch)
}, },
} }
``` ```
* `tag`: `String` (OPTIONAL) * `tag`: `TagDeclarator` (OPTIONAL)
```js
{
end: number,
start: number,
value: string,
}
```
### Returns ### Returns
@ -159,10 +394,181 @@ const example = extrude(5, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -189,8 +595,12 @@ const example = extrude(5, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -198,8 +608,12 @@ const example = extrude(5, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -211,8 +625,12 @@ const example = extrude(5, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -220,8 +638,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -229,8 +651,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -240,8 +666,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -253,8 +683,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",

View File

@ -94,10 +94,181 @@ const example = extrude(5, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -124,8 +295,12 @@ const example = extrude(5, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -133,8 +308,12 @@ const example = extrude(5, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -146,8 +325,12 @@ const example = extrude(5, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -155,8 +338,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -164,8 +351,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -175,8 +366,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -188,8 +383,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",

View File

@ -9,7 +9,7 @@ Start a sketch on a specific plane or face.
```js ```js
startSketchOn(data: SketchData, tag?: SketchOnFaceTag) -> SketchSurface startSketchOn(data: SketchData, tag?: FaceTag) -> SketchSurface
``` ```
### Examples ### Examples
@ -163,6 +163,28 @@ const a1 = startSketchOn({
{ {
// The id of the extrusion end cap // The id of the extrusion end cap
endCapId: uuid, endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group. // The height of the extrude group.
height: number, height: number,
// The id of the extrude group. // The id of the extrude group.
@ -204,10 +226,10 @@ const a1 = startSketchOn({
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: ExtrudeGroup,
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -234,8 +256,12 @@ const a1 = startSketchOn({
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -243,8 +269,12 @@ const a1 = startSketchOn({
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -256,8 +286,12 @@ const a1 = startSketchOn({
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -265,8 +299,12 @@ const a1 = startSketchOn({
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -274,8 +312,12 @@ const a1 = startSketchOn({
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -285,8 +327,12 @@ const a1 = startSketchOn({
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -298,8 +344,12 @@ const a1 = startSketchOn({
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",
@ -313,10 +363,14 @@ const a1 = startSketchOn({
faceId: uuid, faceId: uuid,
// The id of the geometry. // The id of the geometry.
id: uuid, id: uuid,
// The name.
name: string,
// The source range. // The source range.
sourceRange: [number, number], sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane", type: "extrudePlane",
} | } |
{ {
@ -324,18 +378,24 @@ const a1 = startSketchOn({
faceId: uuid, faceId: uuid,
// The id of the geometry. // The id of the geometry.
id: uuid, id: uuid,
// The name.
name: string,
// The source range. // The source range.
sourceRange: [number, number], sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc", type: "extrudeArc",
}], }],
} }
``` ```
* `tag`: `SketchOnFaceTag` - A tag for sketch on face. (OPTIONAL) * `tag`: `FaceTag` - A tag for a face. (OPTIONAL)
```js ```js
"start" | "end" | "start" | "end" |
string {
value: string,
}
``` ```
### Returns ### Returns
@ -374,10 +434,238 @@ string
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
// The id of the plane.
id: uuid,
// Origin of the plane.
origin: {
x: number,
y: number,
z: number,
},
type: "plane",
// Type for a plane.
value: "XY" | "XZ" | "YZ" | "Custom",
// What should the planes X axis be?
xAxis: {
x: number,
y: number,
z: number,
},
// What should the planes Y axis be?
yAxis: {
x: number,
y: number,
z: number,
},
// The z-axis (normal).
zAxis: {
x: number,
y: number,
z: number,
},
} |
{
// The extrude group the face is on.
extrudeGroup: ExtrudeGroup,
// The id of the face.
id: uuid,
type: "face",
// The tag of the face.
value: string,
// What should the faces X axis be?
xAxis: {
x: number,
y: number,
z: number,
},
// What should the faces Y axis be?
yAxis: {
x: number,
y: number,
z: number,
},
// The z-axis (normal).
zAxis: {
x: number,
y: number,
z: number,
},
},
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,7 @@ Draw an arc.
```js ```js
tangentialArc(data: TangentialArcData, sketch_group: SketchGroup, tag?: String) -> SketchGroup tangentialArc(data: TangentialArcData, sketch_group: SketchGroup, tag?: TagDeclarator) -> SketchGroup
``` ```
### Examples ### Examples
@ -77,10 +77,181 @@ const example = extrude(10, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -107,8 +278,12 @@ const example = extrude(10, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -116,8 +291,12 @@ const example = extrude(10, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -129,8 +308,12 @@ const example = extrude(10, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -138,8 +321,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -147,8 +334,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -158,8 +349,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -171,15 +366,26 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",
}], }],
} }
``` ```
* `tag`: `String` (OPTIONAL) * `tag`: `TagDeclarator` (OPTIONAL)
```js
{
end: number,
start: number,
value: string,
}
```
### Returns ### Returns
@ -221,10 +427,181 @@ const example = extrude(10, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -251,8 +628,12 @@ const example = extrude(10, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -260,8 +641,12 @@ const example = extrude(10, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -273,8 +658,12 @@ const example = extrude(10, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -282,8 +671,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -291,8 +684,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -302,8 +699,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -315,8 +716,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",

View File

@ -9,7 +9,7 @@ Draw an arc.
```js ```js
tangentialArcTo(to: [number], sketch_group: SketchGroup, tag?: String) -> SketchGroup tangentialArcTo(to: [number], sketch_group: SketchGroup, tag?: TagDeclarator) -> SketchGroup
``` ```
### Examples ### Examples
@ -68,10 +68,181 @@ const example = extrude(10, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -98,8 +269,12 @@ const example = extrude(10, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -107,8 +282,12 @@ const example = extrude(10, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -120,8 +299,12 @@ const example = extrude(10, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -129,8 +312,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -138,8 +325,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -149,8 +340,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -162,15 +357,26 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",
}], }],
} }
``` ```
* `tag`: `String` (OPTIONAL) * `tag`: `TagDeclarator` (OPTIONAL)
```js
{
end: number,
start: number,
value: string,
}
```
### Returns ### Returns
@ -212,10 +418,181 @@ const example = extrude(10, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -242,8 +619,12 @@ const example = extrude(10, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -251,8 +632,12 @@ const example = extrude(10, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -264,8 +649,12 @@ const example = extrude(10, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -273,8 +662,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -282,8 +675,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -293,8 +690,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -306,8 +707,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",

View File

@ -9,7 +9,7 @@ Draw a line on the x-axis.
```js ```js
xLine(length: number, sketch_group: SketchGroup, tag?: String) -> SketchGroup xLine(length: number, sketch_group: SketchGroup, tag?: TagDeclarator) -> SketchGroup
``` ```
### Examples ### Examples
@ -71,10 +71,181 @@ const example = extrude(10, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -101,8 +272,12 @@ const example = extrude(10, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -110,8 +285,12 @@ const example = extrude(10, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -123,8 +302,12 @@ const example = extrude(10, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -132,8 +315,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -141,8 +328,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -152,8 +343,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -165,15 +360,26 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",
}], }],
} }
``` ```
* `tag`: `String` (OPTIONAL) * `tag`: `TagDeclarator` (OPTIONAL)
```js
{
end: number,
start: number,
value: string,
}
```
### Returns ### Returns
@ -215,10 +421,181 @@ const example = extrude(10, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -245,8 +622,12 @@ const example = extrude(10, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -254,8 +635,12 @@ const example = extrude(10, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -267,8 +652,12 @@ const example = extrude(10, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -276,8 +665,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -285,8 +678,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -296,8 +693,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -309,8 +710,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",

View File

@ -9,7 +9,7 @@ Draw a line to a point on the x-axis.
```js ```js
xLineTo(to: number, sketch_group: SketchGroup, tag?: String) -> SketchGroup xLineTo(to: number, sketch_group: SketchGroup, tag?: TagDeclarator) -> SketchGroup
``` ```
### Examples ### Examples
@ -71,10 +71,181 @@ const example = extrude(10, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -101,8 +272,12 @@ const example = extrude(10, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -110,8 +285,12 @@ const example = extrude(10, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -123,8 +302,12 @@ const example = extrude(10, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -132,8 +315,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -141,8 +328,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -152,8 +343,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -165,15 +360,26 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",
}], }],
} }
``` ```
* `tag`: `String` (OPTIONAL) * `tag`: `TagDeclarator` (OPTIONAL)
```js
{
end: number,
start: number,
value: string,
}
```
### Returns ### Returns
@ -215,10 +421,181 @@ const example = extrude(10, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -245,8 +622,12 @@ const example = extrude(10, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -254,8 +635,12 @@ const example = extrude(10, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -267,8 +652,12 @@ const example = extrude(10, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -276,8 +665,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -285,8 +678,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -296,8 +693,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -309,8 +710,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",

View File

@ -9,7 +9,7 @@ Draw a line on the y-axis.
```js ```js
yLine(length: number, sketch_group: SketchGroup, tag?: String) -> SketchGroup yLine(length: number, sketch_group: SketchGroup, tag?: TagDeclarator) -> SketchGroup
``` ```
### Examples ### Examples
@ -69,10 +69,181 @@ const example = extrude(10, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -99,8 +270,12 @@ const example = extrude(10, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -108,8 +283,12 @@ const example = extrude(10, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -121,8 +300,12 @@ const example = extrude(10, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -130,8 +313,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -139,8 +326,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -150,8 +341,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -163,15 +358,26 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",
}], }],
} }
``` ```
* `tag`: `String` (OPTIONAL) * `tag`: `TagDeclarator` (OPTIONAL)
```js
{
end: number,
start: number,
value: string,
}
```
### Returns ### Returns
@ -213,10 +419,181 @@ const example = extrude(10, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -243,8 +620,12 @@ const example = extrude(10, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -252,8 +633,12 @@ const example = extrude(10, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -265,8 +650,12 @@ const example = extrude(10, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -274,8 +663,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -283,8 +676,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -294,8 +691,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -307,8 +708,12 @@ const example = extrude(10, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",

View File

@ -9,7 +9,7 @@ Draw a line to a point on the y-axis.
```js ```js
yLineTo(to: number, sketch_group: SketchGroup, tag?: String) -> SketchGroup yLineTo(to: number, sketch_group: SketchGroup, tag?: TagDeclarator) -> SketchGroup
``` ```
### Examples ### Examples
@ -67,10 +67,181 @@ const example = extrude(5, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -97,8 +268,12 @@ const example = extrude(5, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -106,8 +281,12 @@ const example = extrude(5, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -119,8 +298,12 @@ const example = extrude(5, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -128,8 +311,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -137,8 +324,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -148,8 +339,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -161,15 +356,26 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",
}], }],
} }
``` ```
* `tag`: `String` (OPTIONAL) * `tag`: `TagDeclarator` (OPTIONAL)
```js
{
end: number,
start: number,
value: string,
}
```
### Returns ### Returns
@ -211,10 +417,181 @@ const example = extrude(5, exampleSketch)
}, },
} | } |
{ {
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
end: number,
start: number,
value: string,
},
type: "extrudeArc",
}],
},
// The id of the face. // The id of the face.
id: uuid, id: uuid,
// The original sketch group id of the object we are sketching on.
sketchGroupId: uuid,
type: "face", type: "face",
// The tag of the face. // The tag of the face.
value: string, value: string,
@ -241,8 +618,12 @@ const example = extrude(5, exampleSketch)
start: { start: {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
}, },
@ -250,8 +631,12 @@ const example = extrude(5, exampleSketch)
value: [{ value: [{
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "ToPoint", type: "ToPoint",
@ -263,8 +648,12 @@ const example = extrude(5, exampleSketch)
center: [number, number], center: [number, number],
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArcTo", type: "TangentialArcTo",
@ -272,8 +661,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "TangentialArc", type: "TangentialArc",
@ -281,8 +674,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Horizontal", type: "Horizontal",
@ -292,8 +689,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "AngledLineTo", type: "AngledLineTo",
@ -305,8 +706,12 @@ const example = extrude(5, exampleSketch)
{ {
// The from point. // The from point.
from: [number, number], from: [number, number],
// The name of the path. // The tag of the path.
name: string, tag: {
end: number,
start: number,
value: string,
},
// The to point. // The to point.
to: [number, number], to: [number, number],
type: "Base", type: "Base",

View File

@ -184,7 +184,7 @@ async function doBasicSketch(page: Page, openPanes: string[]) {
await expect(page.locator('.cm-cursor')).toHaveCount(2) await expect(page.locator('.cm-cursor')).toHaveCount(2)
} }
await page.getByRole('button', { name: 'Constrain' }).click() await page.getByRole('button', { name: 'Constraints' }).click()
await page.getByRole('button', { name: 'Equal Length' }).click() await page.getByRole('button', { name: 'Equal Length' }).click()
// Open the code pane. // Open the code pane.
@ -630,6 +630,7 @@ test('if you use the format keyboard binding it formats your code', async ({
|> line([-20, 0], %) |> line([-20, 0], %)
|> close(%)` |> close(%)`
) )
localStorage.setItem('disableAxis', 'true')
}) })
await page.setViewportSize({ width: 1000, height: 500 }) await page.setViewportSize({ width: 1000, height: 500 })
const lspStartPromise = page.waitForEvent('console', async (message) => { const lspStartPromise = page.waitForEvent('console', async (message) => {
@ -785,7 +786,7 @@ test('if you write invalid kcl you get inlined errors', async ({ page }) => {
// error text on hover // error text on hover
await page.hover('.cm-lint-marker-error') await page.hover('.cm-lint-marker-error')
await expect(page.getByText("found unknown token '$'")).toBeVisible() await expect(page.getByText('syntax: Unexpected token')).toBeVisible()
// select the line that's causing the error and delete it // select the line that's causing the error and delete it
await page.getByText('$ error').click() await page.getByText('$ error').click()
@ -812,7 +813,7 @@ test('if you write invalid kcl you get inlined errors', async ({ page }) => {
await page.locator('.cm-lintRange.cm-lintRange-error').hover() await page.locator('.cm-lintRange.cm-lintRange-error').hover()
await expect(page.locator('.cm-diagnosticText')).toBeVisible() await expect(page.locator('.cm-diagnosticText')).toBeVisible()
await expect(page.getByText('Cannot redefine topAng')).toBeVisible() await expect(page.getByText('Cannot redefine `topAng`')).toBeVisible()
const secondTopAng = await page.getByText('topAng').first() const secondTopAng = await page.getByText('topAng').first()
await secondTopAng?.dblclick() await secondTopAng?.dblclick()
@ -1761,7 +1762,7 @@ test.describe('Testing selections', () => {
// click a segment hold shift and click an axis, see that a relevant constraint is enabled // click a segment hold shift and click an axis, see that a relevant constraint is enabled
await topHorzSegmentClick() await topHorzSegmentClick()
await page.keyboard.down('Shift') await page.keyboard.down('Shift')
const constrainButton = page.getByRole('button', { name: 'Constrain' }) const constrainButton = page.getByRole('button', { name: 'Constraints' })
const absYButton = page.getByRole('button', { name: 'ABS Y' }) const absYButton = page.getByRole('button', { name: 'ABS Y' })
await constrainButton.click() await constrainButton.click()
await expect(absYButton).toBeDisabled() await expect(absYButton).toBeDisabled()
@ -2114,19 +2115,29 @@ test.describe('Command bar tests', () => {
await page.setViewportSize({ width: 1200, height: 500 }) await page.setViewportSize({ width: 1200, height: 500 })
await page.goto('/', { waitUntil: 'domcontentloaded' }) await page.goto('/', { waitUntil: 'domcontentloaded' })
let cmdSearchBar = page.getByPlaceholder('Search commands') await expect(
page.getByRole('button', { name: 'Start Sketch' })
).not.toBeDisabled()
// First try opening the command bar and closing it // First try opening the command bar and closing it
await page await page
.getByRole('button', { name: 'Commands', exact: false }) .getByRole('button', { name: 'Commands', exact: false })
.or(page.getByRole('button', { name: '⌘K' })) .or(page.getByRole('button', { name: '⌘K' }))
.click() .click()
let cmdSearchBar = await page.getByPlaceholder('Search commands')
await expect(cmdSearchBar).toBeVisible() await expect(cmdSearchBar).toBeVisible()
await page.keyboard.press('Escape') await page.keyboard.press('Escape')
cmdSearchBar = await page.getByPlaceholder('Search commands')
await expect(cmdSearchBar).not.toBeVisible() await expect(cmdSearchBar).not.toBeVisible()
// Now try the same, but with the keyboard shortcut, check focus // Now try the same, but with the keyboard shortcut, check focus
if (process.platform !== 'linux') {
await page.keyboard.press('Meta+K') await page.keyboard.press('Meta+K')
} else {
await page.locator('html').press('Control+C')
}
cmdSearchBar = await page.getByPlaceholder('Search commands')
await expect(cmdSearchBar).toBeVisible() await expect(cmdSearchBar).toBeVisible()
await expect(cmdSearchBar).toBeFocused() await expect(cmdSearchBar).toBeFocused()
@ -2165,13 +2176,21 @@ test.describe('Command bar tests', () => {
await page.setViewportSize({ width: 1200, height: 500 }) await page.setViewportSize({ width: 1200, height: 500 })
await page.goto('/', { waitUntil: 'domcontentloaded' }) await page.goto('/', { waitUntil: 'domcontentloaded' })
let cmdSearchBar = page.getByPlaceholder('Search commands') await expect(
page.getByRole('button', { name: 'Start Sketch' })
).not.toBeDisabled()
// Put the cursor in the code editor // Put the cursor in the code editor
await page.locator('.cm-content').click() await page.locator('.cm-content').click()
// Now try the same, but with the keyboard shortcut, check focus // Now try the same, but with the keyboard shortcut, check focus
if (process.platform !== 'linux') {
await page.keyboard.press('Meta+K') await page.keyboard.press('Meta+K')
} else {
await page.locator('.cm-content').press('Control+C')
}
let cmdSearchBar = page.getByPlaceholder('Search commands')
await expect(cmdSearchBar).toBeVisible() await expect(cmdSearchBar).toBeVisible()
await expect(cmdSearchBar).toBeFocused() await expect(cmdSearchBar).toBeFocused()
@ -2234,7 +2253,11 @@ test.describe('Command bar tests', () => {
await page.getByRole('button', { name: 'Extrude' }).isEnabled() await page.getByRole('button', { name: 'Extrude' }).isEnabled()
let cmdSearchBar = page.getByPlaceholder('Search commands') let cmdSearchBar = page.getByPlaceholder('Search commands')
if (process.platform !== 'linux') {
await page.keyboard.press('Meta+K') await page.keyboard.press('Meta+K')
} else {
await page.locator('html').press('Control+C')
}
await expect(cmdSearchBar).toBeVisible() await expect(cmdSearchBar).toBeVisible()
// Search for extrude command and choose it // Search for extrude command and choose it
@ -2889,7 +2912,7 @@ test('Can edit a sketch that has been extruded in the same pipe', async ({
const startPX = [665, 458] const startPX = [665, 458]
const dragPX = 30 const dragPX = 80
await page.getByText('startProfileAt([4.61, -14.01], %)').click() await page.getByText('startProfileAt([4.61, -14.01], %)').click()
await expect(page.getByRole('button', { name: 'Edit Sketch' })).toBeVisible() await expect(page.getByRole('button', { name: 'Edit Sketch' })).toBeVisible()
@ -2897,16 +2920,14 @@ test('Can edit a sketch that has been extruded in the same pipe', async ({
await page.waitForTimeout(400) await page.waitForTimeout(400)
let prevContent = await page.locator('.cm-content').innerText() let prevContent = await page.locator('.cm-content').innerText()
const step5 = { steps: 5 }
await expect(page.getByTestId('segment-overlay')).toHaveCount(2) await expect(page.getByTestId('segment-overlay')).toHaveCount(2)
// drag startProfieAt handle // drag startProfieAt handle
await page.mouse.move(startPX[0], startPX[1]) await page.dragAndDrop('#stream', '#stream', {
await page.mouse.down() sourcePosition: { x: startPX[0], y: startPX[1] },
await page.mouse.move(startPX[0] + dragPX, startPX[1] - dragPX, step5) targetPosition: { x: startPX[0] + dragPX, y: startPX[1] - dragPX },
await page.mouse.up() })
await page.waitForTimeout(100)
await expect(page.locator('.cm-content')).not.toHaveText(prevContent) await expect(page.locator('.cm-content')).not.toHaveText(prevContent)
prevContent = await page.locator('.cm-content').innerText() prevContent = await page.locator('.cm-content').innerText()
@ -2914,20 +2935,23 @@ test('Can edit a sketch that has been extruded in the same pipe', async ({
await page.waitForTimeout(100) await page.waitForTimeout(100)
const lineEnd = await u.getBoundingBox('[data-overlay-index="0"]') const lineEnd = await u.getBoundingBox('[data-overlay-index="0"]')
await page.mouse.move(lineEnd.x - 5, lineEnd.y)
await page.mouse.down()
await page.mouse.move(lineEnd.x + dragPX, lineEnd.y - dragPX, step5)
await page.mouse.up()
await page.waitForTimeout(100) await page.waitForTimeout(100)
await page.dragAndDrop('#stream', '#stream', {
sourcePosition: { x: lineEnd.x - 5, y: lineEnd.y },
targetPosition: { x: lineEnd.x + dragPX, y: lineEnd.y - dragPX },
})
await expect(page.locator('.cm-content')).not.toHaveText(prevContent) await expect(page.locator('.cm-content')).not.toHaveText(prevContent)
prevContent = await page.locator('.cm-content').innerText() prevContent = await page.locator('.cm-content').innerText()
// drag tangentialArcTo handle // drag tangentialArcTo handle
const tangentEnd = await u.getBoundingBox('[data-overlay-index="1"]') const tangentEnd = await u.getBoundingBox('[data-overlay-index="1"]')
await page.mouse.move(tangentEnd.x, tangentEnd.y - 5) await page.dragAndDrop('#stream', '#stream', {
await page.mouse.down() sourcePosition: { x: tangentEnd.x, y: tangentEnd.y - 5 },
await page.mouse.move(tangentEnd.x + dragPX, tangentEnd.y - dragPX, step5) targetPosition: {
await page.mouse.up() x: tangentEnd.x + dragPX,
y: tangentEnd.y - dragPX,
},
})
await page.waitForTimeout(100) await page.waitForTimeout(100)
await expect(page.locator('.cm-content')).not.toHaveText(prevContent) await expect(page.locator('.cm-content')).not.toHaveText(prevContent)
@ -3313,7 +3337,7 @@ test('Can code mod a line length', async ({ page }) => {
await page.mouse.click(834, 244) await page.mouse.click(834, 244)
await page.keyboard.up('Shift') await page.keyboard.up('Shift')
await page.getByRole('button', { name: 'Constrain', exact: true }).click() await page.getByRole('button', { name: 'Constraints', exact: true }).click()
await page.getByRole('button', { name: 'length', exact: true }).click() await page.getByRole('button', { name: 'length', exact: true }).click()
await page.getByText('Add constraining value').click() await page.getByText('Add constraining value').click()
@ -3404,20 +3428,18 @@ const part002 = startSketchOn('XZ')
const line3 = await u.getSegmentBodyCoords(`[data-overlay-index="${2}"]`) const line3 = await u.getSegmentBodyCoords(`[data-overlay-index="${2}"]`)
// await page.mouse.click(line1.x, line1.y)
// await page.keyboard.down('Shift')
await page.mouse.click(line3.x, line3.y) await page.mouse.click(line3.x, line3.y)
await page.waitForTimeout(100) // this wait is needed for webkit - not sure why await page.waitForTimeout(100) // this wait is needed for webkit - not sure why
// await page.keyboard.up('Shift')
await page await page
.getByRole('button', { .getByRole('button', {
name: 'Constrain', name: 'Constraints',
}) })
.click() .click()
await page await page
.getByRole('button', { name: 'remove constraints', exact: true }) .getByRole('button', { name: 'remove constraints', exact: true })
.click() .click()
await page.getByText('line([39.13, 68.63], %)').click()
const activeLinesContent = await page.locator('.cm-activeLine').all() const activeLinesContent = await page.locator('.cm-activeLine').all()
await expect(activeLinesContent).toHaveLength(1) await expect(activeLinesContent).toHaveLength(1)
await expect(activeLinesContent[0]).toHaveText('|> line([39.13, 68.63], %)') await expect(activeLinesContent[0]).toHaveText('|> line([39.13, 68.63], %)')
@ -3476,7 +3498,7 @@ const part002 = startSketchOn('XZ')
await page.keyboard.up('Shift') await page.keyboard.up('Shift')
await page await page
.getByRole('button', { .getByRole('button', {
name: 'Constrain', name: 'Constraints',
}) })
.click() .click()
await page await page
@ -3495,15 +3517,17 @@ const part002 = startSketchOn('XZ')
.getByRole('button', { name: 'Add constraining value' }) .getByRole('button', { name: 'Add constraining value' })
.click() .click()
// Wait for the codemod to take effect
await expect(page.locator('.cm-content')).toContainText(`angle: -57,`)
await expect(page.locator('.cm-content')).toContainText(
`offset: ${offset},`
)
const activeLinesContent = await page.locator('.cm-activeLine').all() const activeLinesContent = await page.locator('.cm-activeLine').all()
await expect(activeLinesContent[0]).toHaveText( await expect(activeLinesContent[0]).toHaveText(
`|> line([74.36, 130.4], %, 'seg01')` `|> line([74.36, 130.4], %, 'seg01')`
) )
await expect(activeLinesContent[1]).toHaveText(`}, %)`) await expect(activeLinesContent[1]).toHaveText(`}, %)`)
await expect(page.locator('.cm-content')).toContainText(`angle: -57,`)
await expect(page.locator('.cm-content')).toContainText(
`offset: ${offset},`
)
// checking the count of the overlays is a good proxy check that the client sketch scene is in a good state // checking the count of the overlays is a good proxy check that the client sketch scene is in a good state
await expect(page.getByTestId('segment-overlay')).toHaveCount(4) await expect(page.getByTestId('segment-overlay')).toHaveCount(4)
@ -3573,7 +3597,7 @@ const part002 = startSketchOn('XZ')
await page.keyboard.up('Shift') await page.keyboard.up('Shift')
await page await page
.getByRole('button', { .getByRole('button', {
name: 'Constrain', name: 'Constraints',
}) })
.click() .click()
await page await page
@ -3684,7 +3708,7 @@ const part002 = startSketchOn('XZ')
await page.keyboard.up('Shift') await page.keyboard.up('Shift')
await page await page
.getByRole('button', { .getByRole('button', {
name: 'Constrain', name: 'Constraints',
}) })
.click() .click()
await page await page
@ -3792,7 +3816,7 @@ const part002 = startSketchOn('XZ')
await page.keyboard.up('Shift') await page.keyboard.up('Shift')
await page await page
.getByRole('button', { .getByRole('button', {
name: 'Constrain', name: 'Constraints',
}) })
.click() .click()
await page.getByTestId('angle').click() await page.getByTestId('angle').click()
@ -3893,7 +3917,7 @@ const part002 = startSketchOn('XZ')
await page.mouse.click(line3.x, line3.y) await page.mouse.click(line3.x, line3.y)
await page await page
.getByRole('button', { .getByRole('button', {
name: 'Constrain', name: 'Constraints',
}) })
.click() .click()
await page.getByTestId(constraint).click() await page.getByTestId(constraint).click()
@ -3978,8 +4002,13 @@ const part002 = startSketchOn('XZ')
await page.mouse.click(line3.x, line3.y) await page.mouse.click(line3.x, line3.y)
await page.mouse.click(line4.x, line4.y) await page.mouse.click(line4.x, line4.y)
await page.keyboard.up('Shift') await page.keyboard.up('Shift')
// check actives lines
const activeLinesContent = await page.locator('.cm-activeLine').all()
await expect(activeLinesContent).toHaveLength(codeAfter.length)
const constraintMenuButton = page.getByRole('button', { const constraintMenuButton = page.getByRole('button', {
name: 'Constrain', name: 'Constraints',
}) })
const constraintButton = page const constraintButton = page
.getByRole('button', { .getByRole('button', {
@ -3989,11 +4018,8 @@ const part002 = startSketchOn('XZ')
// apply the constraint // apply the constraint
await constraintMenuButton.click() await constraintMenuButton.click()
await constraintButton.click() await constraintButton.click({ delay: 200 })
// check actives lines
const activeLinesContent = await page.locator('.cm-activeLine').all()
await expect(activeLinesContent).toHaveLength(codeAfter.length)
// check there are still 3 cursors (they should stay on the same lines as before constraint was applied) // check there are still 3 cursors (they should stay on the same lines as before constraint was applied)
await expect(page.locator('.cm-cursor')).toHaveCount(codeAfter.length) await expect(page.locator('.cm-cursor')).toHaveCount(codeAfter.length)
@ -4065,7 +4091,7 @@ const part002 = startSketchOn('XZ')
await page.mouse.click(line3.x - 3, line3.y + 20) await page.mouse.click(line3.x - 3, line3.y + 20)
await page.keyboard.up('Shift') await page.keyboard.up('Shift')
const constraintMenuButton = page.getByRole('button', { const constraintMenuButton = page.getByRole('button', {
name: 'Constrain', name: 'Constraints',
}) })
const constraintButton = page.getByRole('button', { const constraintButton = page.getByRole('button', {
name: constraintName, name: constraintName,
@ -4142,7 +4168,7 @@ const part002 = startSketchOn('XZ')
await page.mouse.click(axisClick.x, axisClick.y) await page.mouse.click(axisClick.x, axisClick.y)
await page.keyboard.up('Shift') await page.keyboard.up('Shift')
const constraintMenuButton = page.getByRole('button', { const constraintMenuButton = page.getByRole('button', {
name: 'Constrain', name: 'Constraints',
}) })
const constraintButton = page.getByRole('button', { const constraintButton = page.getByRole('button', {
name: constraintName, name: constraintName,
@ -4197,7 +4223,7 @@ const part002 = startSketchOn('XZ')
await page await page
.getByRole('button', { .getByRole('button', {
name: 'Constrain', name: 'Constraints',
}) })
.click() .click()
await page.getByRole('button', { name: 'horizontal', exact: true }).click() await page.getByRole('button', { name: 'horizontal', exact: true }).click()
@ -4220,7 +4246,7 @@ const part002 = startSketchOn('XZ')
await page await page
.getByRole('button', { .getByRole('button', {
name: 'Constrain', name: 'Constraints',
}) })
.click() .click()
await page.getByRole('button', { name: 'length', exact: true }).click() await page.getByRole('button', { name: 'length', exact: true }).click()
@ -4257,6 +4283,7 @@ test.describe('Testing segment overlays', () => {
expectFinal, expectFinal,
ang = 45, ang = 45,
steps = 10, steps = 10,
locator,
}: { }: {
hoverPos: { x: number; y: number } hoverPos: { x: number; y: number }
constraintType: constraintType:
@ -4269,6 +4296,7 @@ test.describe('Testing segment overlays', () => {
expectFinal: string expectFinal: string
ang?: number ang?: number
steps?: number steps?: number
locator?: string
}) => { }) => {
await expect(page.getByText('Added variable')).not.toBeVisible() await expect(page.getByText('Added variable')).not.toBeVisible()
@ -4279,7 +4307,7 @@ test.describe('Testing segment overlays', () => {
x = hoverPos.x + Math.cos(ang * deg) * 32 x = hoverPos.x + Math.cos(ang * deg) * 32
y = hoverPos.y - Math.sin(ang * deg) * 32 y = hoverPos.y - Math.sin(ang * deg) * 32
await page.mouse.move(x, y) await page.mouse.move(x, y)
await wiggleMove(page, x, y, 20, 30, ang, 10, 5) await wiggleMove(page, x, y, 20, 30, ang, 10, 5, locator)
await expect(page.locator('.cm-content')).toContainText( await expect(page.locator('.cm-content')).toContainText(
expectBeforeUnconstrained expectBeforeUnconstrained
@ -4302,7 +4330,7 @@ test.describe('Testing segment overlays', () => {
x = hoverPos.x + Math.cos(ang * deg) * 32 x = hoverPos.x + Math.cos(ang * deg) * 32
y = hoverPos.y - Math.sin(ang * deg) * 32 y = hoverPos.y - Math.sin(ang * deg) * 32
await page.mouse.move(x, y) await page.mouse.move(x, y)
await wiggleMove(page, x, y, 20, 30, ang, 10, 5) await wiggleMove(page, x, y, 20, 30, ang, 10, 5, locator)
const unconstrainedLocator = page.locator( const unconstrainedLocator = page.locator(
`[data-constraint-type="${constraintType}"][data-is-constrained="false"]` `[data-constraint-type="${constraintType}"][data-is-constrained="false"]`
@ -4336,6 +4364,7 @@ test.describe('Testing segment overlays', () => {
expectFinal, expectFinal,
ang = 45, ang = 45,
steps = 5, steps = 5,
locator,
}: { }: {
hoverPos: { x: number; y: number } hoverPos: { x: number; y: number }
constraintType: constraintType:
@ -4348,6 +4377,7 @@ test.describe('Testing segment overlays', () => {
expectFinal: string expectFinal: string
ang?: number ang?: number
steps?: number steps?: number
locator?: string
}) => { }) => {
await page.mouse.move(0, 0) await page.mouse.move(0, 0)
await page.waitForTimeout(1000) await page.waitForTimeout(1000)
@ -4356,7 +4386,7 @@ test.describe('Testing segment overlays', () => {
x = hoverPos.x + Math.cos(ang * deg) * 32 x = hoverPos.x + Math.cos(ang * deg) * 32
y = hoverPos.y - Math.sin(ang * deg) * 32 y = hoverPos.y - Math.sin(ang * deg) * 32
await page.mouse.move(x, y) await page.mouse.move(x, y)
await wiggleMove(page, x, y, 20, 30, ang, 10, 5) await wiggleMove(page, x, y, 20, 30, ang, 10, 5, locator)
await expect(page.getByText('Added variable')).not.toBeVisible() await expect(page.getByText('Added variable')).not.toBeVisible()
await expect(page.locator('.cm-content')).toContainText( await expect(page.locator('.cm-content')).toContainText(
@ -4382,7 +4412,7 @@ test.describe('Testing segment overlays', () => {
x = hoverPos.x + Math.cos(ang * deg) * 32 x = hoverPos.x + Math.cos(ang * deg) * 32
y = hoverPos.y - Math.sin(ang * deg) * 32 y = hoverPos.y - Math.sin(ang * deg) * 32
await page.mouse.move(x, y) await page.mouse.move(x, y)
await wiggleMove(page, x, y, 20, 30, ang, 10, 5) await wiggleMove(page, x, y, 20, 30, ang, 10, 5, locator)
const constrainedLocator = page.locator( const constrainedLocator = page.locator(
`[data-constraint-type="${constraintType}"][data-is-constrained="true"]` `[data-constraint-type="${constraintType}"][data-is-constrained="true"]`
@ -4478,6 +4508,7 @@ test.describe('Testing segment overlays', () => {
expectAfterUnconstrained: '|> line([0.5, -14], %)', expectAfterUnconstrained: '|> line([0.5, -14], %)',
expectFinal: '|> line([0.5, yRel001], %)', expectFinal: '|> line([0.5, yRel001], %)',
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="0"]',
}) })
console.log('line2') console.log('line2')
await clickUnconstrained({ await clickUnconstrained({
@ -4487,6 +4518,7 @@ test.describe('Testing segment overlays', () => {
expectAfterUnconstrained: 'line([xRel001, yRel001], %)', expectAfterUnconstrained: 'line([xRel001, yRel001], %)',
expectFinal: '|> line([0.5, yRel001], %)', expectFinal: '|> line([0.5, yRel001], %)',
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-index="0"]',
}) })
const angledLine = await u.getBoundingBox(`[data-overlay-index="1"]`) const angledLine = await u.getBoundingBox(`[data-overlay-index="1"]`)
@ -4500,6 +4532,7 @@ test.describe('Testing segment overlays', () => {
expectAfterUnconstrained: 'angledLine({ angle: 3, length: 32 + 0 }, %)', expectAfterUnconstrained: 'angledLine({ angle: 3, length: 32 + 0 }, %)',
expectFinal: 'angledLine({ angle: angle001, length: 32 + 0 }, %)', expectFinal: 'angledLine({ angle: angle001, length: 32 + 0 }, %)',
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="1"]',
}) })
console.log('angledLine2') console.log('angledLine2')
await clickConstrained({ await clickConstrained({
@ -4511,10 +4544,10 @@ test.describe('Testing segment overlays', () => {
'angledLine({ angle: angle001, length: 32 }, %)', 'angledLine({ angle: angle001, length: 32 }, %)',
expectFinal: 'angledLine({ angle: angle001, length: len001 }, %)', expectFinal: 'angledLine({ angle: angle001, length: len001 }, %)',
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="1"]',
}) })
await page.mouse.move(700, 250) await page.mouse.move(700, 250)
await page.mouse.wheel(0, 25)
await page.waitForTimeout(100) await page.waitForTimeout(100)
let lineTo = await u.getBoundingBox(`[data-overlay-index="2"]`) let lineTo = await u.getBoundingBox(`[data-overlay-index="2"]`)
@ -4528,6 +4561,7 @@ test.describe('Testing segment overlays', () => {
expectFinal: 'lineTo([5 + 33, yAbs001], %)', expectFinal: 'lineTo([5 + 33, yAbs001], %)',
steps: 8, steps: 8,
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="2"]',
}) })
console.log('lineTo2') console.log('lineTo2')
await clickConstrained({ await clickConstrained({
@ -4538,6 +4572,7 @@ test.describe('Testing segment overlays', () => {
expectFinal: 'lineTo([xAbs001, yAbs001], %)', expectFinal: 'lineTo([xAbs001, yAbs001], %)',
steps: 8, steps: 8,
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="2"]',
}) })
const xLineTo = await u.getBoundingBox(`[data-overlay-index="3"]`) const xLineTo = await u.getBoundingBox(`[data-overlay-index="3"]`)
@ -4551,6 +4586,7 @@ test.describe('Testing segment overlays', () => {
expectFinal: 'xLineTo(xAbs002, %)', expectFinal: 'xLineTo(xAbs002, %)',
ang: ang + 180, ang: ang + 180,
steps: 8, steps: 8,
locator: '[data-overlay-toolbar-index="3"]',
}) })
}) })
test('for segments [yLineTo, xLine]', async ({ page }) => { test('for segments [yLineTo, xLine]', async ({ page }) => {
@ -4597,7 +4633,6 @@ const part001 = startSketchOn('XZ')
const clickUnconstrained = _clickUnconstrained(page) const clickUnconstrained = _clickUnconstrained(page)
await page.mouse.move(700, 250) await page.mouse.move(700, 250)
await page.mouse.wheel(0, 25)
await page.waitForTimeout(100) await page.waitForTimeout(100)
let ang = 0 let ang = 0
@ -4612,6 +4647,7 @@ const part001 = startSketchOn('XZ')
expectAfterUnconstrained: "yLineTo(yAbs002, %, 'a')", expectAfterUnconstrained: "yLineTo(yAbs002, %, 'a')",
expectFinal: "yLineTo(-10.77, %, 'a')", expectFinal: "yLineTo(-10.77, %, 'a')",
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="4"]',
}) })
const xLine = await u.getBoundingBox(`[data-overlay-index="5"]`) const xLine = await u.getBoundingBox(`[data-overlay-index="5"]`)
@ -4625,6 +4661,7 @@ const part001 = startSketchOn('XZ')
expectFinal: 'xLine(26.04, %)', expectFinal: 'xLine(26.04, %)',
steps: 10, steps: 10,
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="5"]',
}) })
}) })
test('for segments [yLine, angledLineOfXLength, angledLineOfYLength]', async ({ test('for segments [yLine, angledLineOfXLength, angledLineOfYLength]', async ({
@ -4654,6 +4691,7 @@ const part001 = startSketchOn('XZ')
|> tangentialArcTo([3.14 + 13, 3.14], %) |> tangentialArcTo([3.14 + 13, 3.14], %)
` `
) )
localStorage.setItem('disableAxis', 'true')
}) })
const u = await getUtils(page) const u = await getUtils(page)
await page.setViewportSize({ width: 1200, height: 500 }) await page.setViewportSize({ width: 1200, height: 500 })
@ -4682,12 +4720,13 @@ const part001 = startSketchOn('XZ')
ang = await u.getAngle(`[data-overlay-index="6"]`) ang = await u.getAngle(`[data-overlay-index="6"]`)
console.log('yline1') console.log('yline1')
await clickConstrained({ await clickConstrained({
hoverPos: { x: yLine.x, y: yLine.y + 20 }, hoverPos: { x: yLine.x, y: yLine.y },
constraintType: 'yRelative', constraintType: 'yRelative',
expectBeforeUnconstrained: 'yLine(21.14 + 0, %)', expectBeforeUnconstrained: 'yLine(21.14 + 0, %)',
expectAfterUnconstrained: 'yLine(21.14, %)', expectAfterUnconstrained: 'yLine(21.14, %)',
expectFinal: 'yLine(yRel001, %)', expectFinal: 'yLine(yRel001, %)',
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="6"]',
}) })
const angledLineOfXLength = await u.getBoundingBox( const angledLineOfXLength = await u.getBoundingBox(
@ -4696,7 +4735,7 @@ const part001 = startSketchOn('XZ')
ang = await u.getAngle(`[data-overlay-index="7"]`) ang = await u.getAngle(`[data-overlay-index="7"]`)
console.log('angledLineOfXLength1') console.log('angledLineOfXLength1')
await clickConstrained({ await clickConstrained({
hoverPos: { x: angledLineOfXLength.x + 20, y: angledLineOfXLength.y }, hoverPos: { x: angledLineOfXLength.x, y: angledLineOfXLength.y },
constraintType: 'angle', constraintType: 'angle',
expectBeforeUnconstrained: expectBeforeUnconstrained:
'angledLineOfXLength({ angle: 181 + 0, length: 23.14 }, %)', 'angledLineOfXLength({ angle: 181 + 0, length: 23.14 }, %)',
@ -4705,10 +4744,11 @@ const part001 = startSketchOn('XZ')
expectFinal: expectFinal:
'angledLineOfXLength({ angle: angle001, length: 23.14 }, %)', 'angledLineOfXLength({ angle: angle001, length: 23.14 }, %)',
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="7"]',
}) })
console.log('angledLineOfXLength2') console.log('angledLineOfXLength2')
await clickUnconstrained({ await clickUnconstrained({
hoverPos: { x: angledLineOfXLength.x + 25, y: angledLineOfXLength.y }, hoverPos: { x: angledLineOfXLength.x, y: angledLineOfXLength.y },
constraintType: 'xRelative', constraintType: 'xRelative',
expectBeforeUnconstrained: expectBeforeUnconstrained:
'angledLineOfXLength({ angle: angle001, length: 23.14 }, %)', 'angledLineOfXLength({ angle: angle001, length: 23.14 }, %)',
@ -4718,6 +4758,7 @@ const part001 = startSketchOn('XZ')
'angledLineOfXLength({ angle: angle001, length: 23.14 }, %)', 'angledLineOfXLength({ angle: angle001, length: 23.14 }, %)',
steps: 7, steps: 7,
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="7"]',
}) })
const angledLineOfYLength = await u.getBoundingBox( const angledLineOfYLength = await u.getBoundingBox(
@ -4726,7 +4767,7 @@ const part001 = startSketchOn('XZ')
ang = await u.getAngle(`[data-overlay-index="8"]`) ang = await u.getAngle(`[data-overlay-index="8"]`)
console.log('angledLineOfYLength1') console.log('angledLineOfYLength1')
await clickUnconstrained({ await clickUnconstrained({
hoverPos: { x: angledLineOfYLength.x, y: angledLineOfYLength.y - 20 }, hoverPos: { x: angledLineOfYLength.x, y: angledLineOfYLength.y },
constraintType: 'angle', constraintType: 'angle',
expectBeforeUnconstrained: expectBeforeUnconstrained:
'angledLineOfYLength({ angle: -91, length: 19 + 0 }, %)', 'angledLineOfYLength({ angle: -91, length: 19 + 0 }, %)',
@ -4735,10 +4776,11 @@ const part001 = startSketchOn('XZ')
expectFinal: 'angledLineOfYLength({ angle: -91, length: 19 + 0 }, %)', expectFinal: 'angledLineOfYLength({ angle: -91, length: 19 + 0 }, %)',
ang: ang + 180, ang: ang + 180,
steps: 6, steps: 6,
locator: '[data-overlay-toolbar-index="8"]',
}) })
console.log('angledLineOfYLength2') console.log('angledLineOfYLength2')
await clickConstrained({ await clickConstrained({
hoverPos: { x: angledLineOfYLength.x, y: angledLineOfYLength.y - 20 }, hoverPos: { x: angledLineOfYLength.x, y: angledLineOfYLength.y },
constraintType: 'yRelative', constraintType: 'yRelative',
expectBeforeUnconstrained: expectBeforeUnconstrained:
'angledLineOfYLength({ angle: -91, length: 19 + 0 }, %)', 'angledLineOfYLength({ angle: -91, length: 19 + 0 }, %)',
@ -4747,6 +4789,7 @@ const part001 = startSketchOn('XZ')
expectFinal: 'angledLineOfYLength({ angle: -91, length: yRel002 }, %)', expectFinal: 'angledLineOfYLength({ angle: -91, length: yRel002 }, %)',
ang: ang + 180, ang: ang + 180,
steps: 7, steps: 7,
locator: '[data-overlay-toolbar-index="8"]',
}) })
}) })
test('for segments [angledLineToX, angledLineToY, angledLineThatIntersects]', async ({ test('for segments [angledLineToX, angledLineToY, angledLineThatIntersects]', async ({
@ -4776,6 +4819,7 @@ const part001 = startSketchOn('XZ')
|> tangentialArcTo([3.14 + 13, 1.14], %) |> tangentialArcTo([3.14 + 13, 1.14], %)
` `
) )
localStorage.setItem('disableAxis', 'true')
}) })
const u = await getUtils(page) const u = await getUtils(page)
await page.setViewportSize({ width: 1200, height: 500 }) await page.setViewportSize({ width: 1200, height: 500 })
@ -4809,10 +4853,11 @@ const part001 = startSketchOn('XZ')
expectAfterUnconstrained: 'angledLineToX({ angle: 3, to: 26 }, %)', expectAfterUnconstrained: 'angledLineToX({ angle: 3, to: 26 }, %)',
expectFinal: 'angledLineToX({ angle: angle001, to: 26 }, %)', expectFinal: 'angledLineToX({ angle: angle001, to: 26 }, %)',
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="9"]',
}) })
console.log('angledLineToX2') console.log('angledLineToX2')
await clickUnconstrained({ await clickUnconstrained({
hoverPos: { x: angledLineToX.x - 20, y: angledLineToX.y }, hoverPos: { x: angledLineToX.x, y: angledLineToX.y },
constraintType: 'xAbsolute', constraintType: 'xAbsolute',
expectBeforeUnconstrained: expectBeforeUnconstrained:
'angledLineToX({ angle: angle001, to: 26 }, %)', 'angledLineToX({ angle: angle001, to: 26 }, %)',
@ -4820,6 +4865,7 @@ const part001 = startSketchOn('XZ')
'angledLineToX({ angle: angle001, to: xAbs001 }, %)', 'angledLineToX({ angle: angle001, to: xAbs001 }, %)',
expectFinal: 'angledLineToX({ angle: angle001, to: 26 }, %)', expectFinal: 'angledLineToX({ angle: angle001, to: 26 }, %)',
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="9"]',
}) })
const angledLineToY = await u.getBoundingBox(`[data-overlay-index="10"]`) const angledLineToY = await u.getBoundingBox(`[data-overlay-index="10"]`)
@ -4835,16 +4881,18 @@ const part001 = startSketchOn('XZ')
expectFinal: 'angledLineToY({ angle: 89, to: 9.14 + 0 }, %)', expectFinal: 'angledLineToY({ angle: 89, to: 9.14 + 0 }, %)',
steps: process.platform === 'darwin' ? 8 : 9, steps: process.platform === 'darwin' ? 8 : 9,
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="10"]',
}) })
console.log('angledLineToY2') console.log('angledLineToY2')
await clickConstrained({ await clickConstrained({
hoverPos: { x: angledLineToY.x, y: angledLineToY.y + 20 }, hoverPos: { x: angledLineToY.x, y: angledLineToY.y },
constraintType: 'yAbsolute', constraintType: 'yAbsolute',
expectBeforeUnconstrained: expectBeforeUnconstrained:
'angledLineToY({ angle: 89, to: 9.14 + 0 }, %)', 'angledLineToY({ angle: 89, to: 9.14 + 0 }, %)',
expectAfterUnconstrained: 'angledLineToY({ angle: 89, to: 9.14 }, %)', expectAfterUnconstrained: 'angledLineToY({ angle: 89, to: 9.14 }, %)',
expectFinal: 'angledLineToY({ angle: 89, to: yAbs001 }, %)', expectFinal: 'angledLineToY({ angle: 89, to: yAbs001 }, %)',
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="10"]',
}) })
const angledLineThatIntersects = await u.getBoundingBox( const angledLineThatIntersects = await u.getBoundingBox(
@ -4854,7 +4902,7 @@ const part001 = startSketchOn('XZ')
console.log('angledLineThatIntersects') console.log('angledLineThatIntersects')
await clickUnconstrained({ await clickUnconstrained({
hoverPos: { hoverPos: {
x: angledLineThatIntersects.x + 20, x: angledLineThatIntersects.x,
y: angledLineThatIntersects.y, y: angledLineThatIntersects.y,
}, },
constraintType: 'angle', constraintType: 'angle',
@ -4874,11 +4922,12 @@ const part001 = startSketchOn('XZ')
intersectTag: 'a' intersectTag: 'a'
}, %)`, }, %)`,
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="11"]',
}) })
console.log('angledLineThatIntersects2') console.log('angledLineThatIntersects2')
await clickUnconstrained({ await clickUnconstrained({
hoverPos: { hoverPos: {
x: angledLineThatIntersects.x + 20, x: angledLineThatIntersects.x,
y: angledLineThatIntersects.y, y: angledLineThatIntersects.y,
}, },
constraintType: 'intersectionOffset', constraintType: 'intersectionOffset',
@ -4898,6 +4947,7 @@ const part001 = startSketchOn('XZ')
intersectTag: 'a' intersectTag: 'a'
}, %)`, }, %)`,
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="11"]',
}) })
}) })
test('for segment [tangentialArcTo]', async ({ page }) => { test('for segment [tangentialArcTo]', async ({ page }) => {
@ -4925,6 +4975,7 @@ const part001 = startSketchOn('XZ')
|> tangentialArcTo([3.14 + 13, -3.14], %) |> tangentialArcTo([3.14 + 13, -3.14], %)
` `
) )
localStorage.setItem('disableAxis', 'true')
}) })
const u = await getUtils(page) const u = await getUtils(page)
await page.setViewportSize({ width: 1200, height: 500 }) await page.setViewportSize({ width: 1200, height: 500 })
@ -4947,9 +4998,9 @@ const part001 = startSketchOn('XZ')
const clickConstrained = _clickConstrained(page) const clickConstrained = _clickConstrained(page)
const tangentialArcTo = await u.getBoundingBox( const tangentialArcTo = await u.getBoundingBox(
`[data-overlay-index="12"]` '[data-overlay-index="12"]'
) )
let ang = await u.getAngle(`[data-overlay-index="12"]`) let ang = await u.getAngle('[data-overlay-index="12"]')
console.log('tangentialArcTo') console.log('tangentialArcTo')
await clickConstrained({ await clickConstrained({
hoverPos: { x: tangentialArcTo.x, y: tangentialArcTo.y }, hoverPos: { x: tangentialArcTo.x, y: tangentialArcTo.y },
@ -4959,6 +5010,7 @@ const part001 = startSketchOn('XZ')
expectFinal: 'tangentialArcTo([xAbs001, -3.14], %)', expectFinal: 'tangentialArcTo([xAbs001, -3.14], %)',
ang: ang + 180, ang: ang + 180,
steps: 6, steps: 6,
locator: '[data-overlay-toolbar-index="12"]',
}) })
console.log('tangentialArcTo2') console.log('tangentialArcTo2')
await clickUnconstrained({ await clickUnconstrained({
@ -4969,6 +5021,7 @@ const part001 = startSketchOn('XZ')
expectFinal: 'tangentialArcTo([xAbs001, -3.14], %)', expectFinal: 'tangentialArcTo([xAbs001, -3.14], %)',
ang: ang + 180, ang: ang + 180,
steps: 10, steps: 10,
locator: '[data-overlay-toolbar-index="12"]',
}) })
}) })
}) })
@ -4981,21 +5034,26 @@ const part001 = startSketchOn('XZ')
stdLibFnName, stdLibFnName,
ang = 45, ang = 45,
steps = 6, steps = 6,
locator,
}: { }: {
hoverPos: { x: number; y: number } hoverPos: { x: number; y: number }
codeToBeDeleted: string codeToBeDeleted: string
stdLibFnName: string stdLibFnName: string
ang?: number ang?: number
steps?: number steps?: number
locator?: string
}) => { }) => {
await expect(page.getByText('Added variable')).not.toBeVisible() await expect(page.getByText('Added variable')).not.toBeVisible()
const [x, y] = [
Math.cos((ang * Math.PI) / 180) * 45,
Math.sin((ang * Math.PI) / 180) * 45,
]
await page.mouse.move(hoverPos.x + x, hoverPos.y + y) await page.mouse.move(0, 0)
await page.mouse.move(hoverPos.x, hoverPos.y, { steps }) await page.waitForTimeout(1000)
let x = 0,
y = 0
x = hoverPos.x + Math.cos(ang * deg) * 32
y = hoverPos.y - Math.sin(ang * deg) * 32
await page.mouse.move(x, y)
await wiggleMove(page, x, y, 20, 30, ang, 10, 5, locator)
await expect(page.locator('.cm-content')).toContainText(codeToBeDeleted) await expect(page.locator('.cm-content')).toContainText(codeToBeDeleted)
await page.locator(`[data-stdlib-fn-name="${stdLibFnName}"]`).click() await page.locator(`[data-stdlib-fn-name="${stdLibFnName}"]`).click()
@ -5030,6 +5088,7 @@ const part001 = startSketchOn('XZ')
|> tangentialArcTo([3.14 + 13, 1.14], %) |> tangentialArcTo([3.14 + 13, 1.14], %)
` `
) )
localStorage.setItem('disableAxis', 'true')
}) })
const u = await getUtils(page) const u = await getUtils(page)
await page.setViewportSize({ width: 1200, height: 500 }) await page.setViewportSize({ width: 1200, height: 500 })
@ -5054,96 +5113,137 @@ const part001 = startSketchOn('XZ')
const getOverlayByIndex = (index: number) => const getOverlayByIndex = (index: number) =>
u.getBoundingBox(`[data-overlay-index="${index}"]`) u.getBoundingBox(`[data-overlay-index="${index}"]`)
segmentToDelete = await getOverlayByIndex(12) segmentToDelete = await getOverlayByIndex(12)
let ang = await u.getAngle(`[data-overlay-index="${12}"]`)
await deleteSegmentSequence({ await deleteSegmentSequence({
hoverPos: { x: segmentToDelete.x - 10, y: segmentToDelete.y + 20 }, hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
codeToBeDeleted: 'tangentialArcTo([3.14 + 13, 1.14], %)', codeToBeDeleted: 'tangentialArcTo([3.14 + 13, 1.14], %)',
stdLibFnName: 'tangentialArcTo', stdLibFnName: 'tangentialArcTo',
ang: -45, ang: ang + 180,
steps: 6, steps: 6,
locator: '[data-overlay-toolbar-index="12"]',
}) })
segmentToDelete = await getOverlayByIndex(11) segmentToDelete = await getOverlayByIndex(11)
ang = await u.getAngle(`[data-overlay-index="${11}"]`)
await deleteSegmentSequence({ await deleteSegmentSequence({
hoverPos: { x: segmentToDelete.x + 10, y: segmentToDelete.y }, hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
codeToBeDeleted: `angledLineThatIntersects({ codeToBeDeleted: `angledLineThatIntersects({
angle: 4.14, angle: 4.14,
intersectTag: 'a', intersectTag: 'a',
offset: 9 offset: 9
}, %)`, }, %)`,
stdLibFnName: 'angledLineThatIntersects', stdLibFnName: 'angledLineThatIntersects',
ang: -45, ang: ang + 180,
steps: 7, steps: 7,
locator: '[data-overlay-toolbar-index="11"]',
}) })
segmentToDelete = await getOverlayByIndex(10) segmentToDelete = await getOverlayByIndex(10)
ang = await u.getAngle(`[data-overlay-index="${10}"]`)
await deleteSegmentSequence({ await deleteSegmentSequence({
hoverPos: { x: segmentToDelete.x + 10, y: segmentToDelete.y }, hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
codeToBeDeleted: 'angledLineToY({ angle: 89, to: 9.14 + 0 }, %)', codeToBeDeleted: 'angledLineToY({ angle: 89, to: 9.14 + 0 }, %)',
stdLibFnName: 'angledLineToY', stdLibFnName: 'angledLineToY',
ang: ang + 180,
locator: '[data-overlay-toolbar-index="10"]',
}) })
segmentToDelete = await getOverlayByIndex(9) segmentToDelete = await getOverlayByIndex(9)
ang = await u.getAngle(`[data-overlay-index="${9}"]`)
await deleteSegmentSequence({ await deleteSegmentSequence({
hoverPos: { x: segmentToDelete.x - 10, y: segmentToDelete.y }, hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
codeToBeDeleted: 'angledLineToX({ angle: 3 + 0, to: 26 }, %)', codeToBeDeleted: 'angledLineToX({ angle: 3 + 0, to: 26 }, %)',
stdLibFnName: 'angledLineToX', stdLibFnName: 'angledLineToX',
ang: ang + 180,
locator: '[data-overlay-toolbar-index="9"]',
}) })
segmentToDelete = await getOverlayByIndex(8) segmentToDelete = await getOverlayByIndex(8)
ang = await u.getAngle(`[data-overlay-index="${8}"]`)
await deleteSegmentSequence({ await deleteSegmentSequence({
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y - 10 }, hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
codeToBeDeleted: codeToBeDeleted:
'angledLineOfYLength({ angle: -91, length: 19 + 0 }, %)', 'angledLineOfYLength({ angle: -91, length: 19 + 0 }, %)',
stdLibFnName: 'angledLineOfYLength', stdLibFnName: 'angledLineOfYLength',
ang: ang + 180,
locator: '[data-overlay-toolbar-index="8"]',
}) })
segmentToDelete = await getOverlayByIndex(7) segmentToDelete = await getOverlayByIndex(7)
ang = await u.getAngle(`[data-overlay-index="${7}"]`)
await deleteSegmentSequence({ await deleteSegmentSequence({
hoverPos: { x: segmentToDelete.x + 10, y: segmentToDelete.y }, hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
codeToBeDeleted: codeToBeDeleted:
'angledLineOfXLength({ angle: 181 + 0, length: 23.14 }, %)', 'angledLineOfXLength({ angle: 181 + 0, length: 23.14 }, %)',
stdLibFnName: 'angledLineOfXLength', stdLibFnName: 'angledLineOfXLength',
ang: ang + 180,
locator: '[data-overlay-toolbar-index="7"]',
}) })
segmentToDelete = await getOverlayByIndex(6) segmentToDelete = await getOverlayByIndex(6)
ang = await u.getAngle(`[data-overlay-index="${6}"]`)
await deleteSegmentSequence({ await deleteSegmentSequence({
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y + 10 }, hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
codeToBeDeleted: 'yLine(21.14 + 0, %)', codeToBeDeleted: 'yLine(21.14 + 0, %)',
stdLibFnName: 'yLine', stdLibFnName: 'yLine',
ang: ang + 180,
locator: '[data-overlay-toolbar-index="6"]',
}) })
segmentToDelete = await getOverlayByIndex(5) segmentToDelete = await getOverlayByIndex(5)
ang = await u.getAngle(`[data-overlay-index="${5}"]`)
await deleteSegmentSequence({ await deleteSegmentSequence({
hoverPos: { x: segmentToDelete.x - 10, y: segmentToDelete.y }, hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
codeToBeDeleted: 'xLine(26.04, %)', codeToBeDeleted: 'xLine(26.04, %)',
stdLibFnName: 'xLine', stdLibFnName: 'xLine',
ang: ang + 180,
locator: '[data-overlay-toolbar-index="5"]',
}) })
segmentToDelete = await getOverlayByIndex(4) segmentToDelete = await getOverlayByIndex(4)
ang = await u.getAngle(`[data-overlay-index="${4}"]`)
await deleteSegmentSequence({ await deleteSegmentSequence({
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y - 10 }, hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
codeToBeDeleted: "yLineTo(-10.77, %, 'a')", codeToBeDeleted: "yLineTo(-10.77, %, 'a')",
stdLibFnName: 'yLineTo', stdLibFnName: 'yLineTo',
ang: ang + 180,
locator: '[data-overlay-toolbar-index="4"]',
}) })
segmentToDelete = await getOverlayByIndex(3) segmentToDelete = await getOverlayByIndex(3)
ang = await u.getAngle(`[data-overlay-index="${3}"]`)
await deleteSegmentSequence({ await deleteSegmentSequence({
hoverPos: { x: segmentToDelete.x + 10, y: segmentToDelete.y }, hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
codeToBeDeleted: 'xLineTo(9 - 5, %)', codeToBeDeleted: 'xLineTo(9 - 5, %)',
stdLibFnName: 'xLineTo', stdLibFnName: 'xLineTo',
ang: ang + 180,
locator: '[data-overlay-toolbar-index="3"]',
}) })
// Not sure why this is diff. from the others - Kurt, ideas?
segmentToDelete = await getOverlayByIndex(2) segmentToDelete = await getOverlayByIndex(2)
const hoverPos = { x: segmentToDelete.x - 10, y: segmentToDelete.y + 10 } ang = await u.getAngle(`[data-overlay-index="${2}"]`)
await expect(page.getByText('Added variable')).not.toBeVisible() await expect(page.getByText('Added variable')).not.toBeVisible()
const [x, y] = [
Math.cos((45 * Math.PI) / 180) * 45,
Math.sin((45 * Math.PI) / 180) * 45,
]
await page.mouse.move(hoverPos.x + x, hoverPos.y + y) const hoverPos = { x: segmentToDelete.x, y: segmentToDelete.y }
await page.mouse.move(hoverPos.x, hoverPos.y, { steps: 5 }) await page.mouse.move(0, 0)
await page.waitForTimeout(1000)
let x = 0,
y = 0
x = hoverPos.x + Math.cos(ang * deg) * 32
y = hoverPos.y - Math.sin(ang * deg) * 32
await page.mouse.move(hoverPos.x, hoverPos.y)
await wiggleMove(
page,
hoverPos.x,
hoverPos.y,
20,
30,
ang,
10,
5,
'[data-overlay-toolbar-index="2"]'
)
const codeToBeDeleted = 'lineTo([33, 11.5 + 0], %)' const codeToBeDeleted = 'lineTo([33, 11.5 + 0], %)'
await expect(page.locator('.cm-content')).toContainText(codeToBeDeleted) await expect(page.locator('.cm-content')).toContainText(codeToBeDeleted)
@ -5155,19 +5255,22 @@ const part001 = startSketchOn('XZ')
) )
segmentToDelete = await getOverlayByIndex(1) segmentToDelete = await getOverlayByIndex(1)
ang = await u.getAngle(`[data-overlay-index="${1}"]`)
await deleteSegmentSequence({ await deleteSegmentSequence({
hoverPos: { x: segmentToDelete.x - 20, y: segmentToDelete.y }, hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
codeToBeDeleted: 'angledLine({ angle: 3 + 0, length: 32 + 0 }, %)', codeToBeDeleted: 'angledLine({ angle: 3 + 0, length: 32 + 0 }, %)',
stdLibFnName: 'angledLine', stdLibFnName: 'angledLine',
ang: 135, ang: ang + 180,
locator: '[data-overlay-toolbar-index="1"]',
}) })
segmentToDelete = await getOverlayByIndex(0) segmentToDelete = await getOverlayByIndex(0)
ang = await u.getAngle(`[data-overlay-index="${0}"]`)
await deleteSegmentSequence({ await deleteSegmentSequence({
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y - 20 }, hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
codeToBeDeleted: 'line([0.5, -14 + 0], %)', codeToBeDeleted: 'line([0.5, -14 + 0], %)',
stdLibFnName: 'line', stdLibFnName: 'line',
ang: -45, ang: ang + 180,
}) })
await page.waitForTimeout(200) await page.waitForTimeout(200)
@ -5381,24 +5484,30 @@ ${extraLine ? "const myVar = segLen('seg01', part001)" : ''}`
await page.waitForTimeout(500) await page.waitForTimeout(500)
await expect(page.getByTestId('segment-overlay')).toHaveCount(3) await expect(page.getByTestId('segment-overlay')).toHaveCount(3)
const segmentToDelete = await u.getBoundingBox(
`[data-overlay-index="0"]`
)
const isYLine = before.toLowerCase().includes('yline')
const hoverPos = {
x: segmentToDelete.x + (isYLine ? 0 : -20),
y: segmentToDelete.y + (isYLine ? -20 : 0),
}
await expect(page.getByText('Added variable')).not.toBeVisible() await expect(page.getByText('Added variable')).not.toBeVisible()
const ang = isYLine ? 45 : -45
const [x, y] = [
Math.cos((ang * Math.PI) / 180) * 45,
Math.sin((ang * Math.PI) / 180) * 45,
]
await page.mouse.move(hoverPos.x + x, hoverPos.y + y) const hoverPos = await u.getBoundingBox(`[data-overlay-index="0"]`)
await page.mouse.move(hoverPos.x, hoverPos.y, { steps: 5 }) let ang = await u.getAngle(`[data-overlay-index="${0}"]`)
ang += 180
await page.mouse.move(0, 0)
await page.waitForTimeout(1000)
let x = 0,
y = 0
x = hoverPos.x + Math.cos(ang * deg) * 32
y = hoverPos.y - Math.sin(ang * deg) * 32
await page.mouse.move(x, y)
await wiggleMove(
page,
x,
y,
20,
30,
ang,
10,
5,
'[data-overlay-toolbar-index="0"]'
)
await expect(page.locator('.cm-content')).toContainText(before) await expect(page.locator('.cm-content')).toContainText(before)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 47 KiB

View File

@ -114,19 +114,45 @@ export const wiggleMove = async (
dist: number, dist: number,
ang: number, ang: number,
amplitude: number, amplitude: number,
freq: number freq: number,
locator?: string
) => { ) => {
const tau = Math.PI * 2 const tau = Math.PI * 2
const deg = tau / 360 const deg = tau / 360
const step = dist / steps const step = dist / steps
for (let i = 0, j = 0; i < dist; i += step, j += 1) { for (let i = 0, j = 0; i < dist; i += step, j += 1) {
if (locator) {
const isElVis = await page.locator(locator).isVisible()
if (isElVis) return
}
const [x1, y1] = [0, Math.sin((tau / steps) * j * freq) * amplitude] const [x1, y1] = [0, Math.sin((tau / steps) * j * freq) * amplitude]
const [x2, y2] = [ const [x2, y2] = [
Math.cos(-ang * deg) * i - Math.sin(-ang * deg) * y1, Math.cos(-ang * deg) * i - Math.sin(-ang * deg) * y1,
Math.sin(-ang * deg) * i + Math.cos(-ang * deg) * y1, Math.sin(-ang * deg) * i + Math.cos(-ang * deg) * y1,
] ]
const [xr, yr] = [x2, y2] const [xr, yr] = [x2, y2]
await page.mouse.move(x + xr, y + yr, { steps: 2 }) await page.mouse.move(x + xr, y + yr, { steps: 5 })
}
}
export const circleMove = async (
page: any,
x: number,
y: number,
steps: number,
diameter: number,
locator?: string
) => {
const tau = Math.PI * 2
const step = tau / steps
for (let i = 0; i < tau; i += step) {
if (locator) {
const isElVis = await page.locator(locator).isVisible()
if (isElVis) return
}
const [x1, y1] = [Math.cos(i) * diameter, Math.sin(i) * diameter]
const [xr, yr] = [x1, y1]
await page.mouse.move(x + xr, y + yr, { steps: 5 })
} }
} }
@ -151,11 +177,11 @@ export const getMovementUtils = (opts: any) => {
// Make it easier to click around from center ("click [from] zero zero") // Make it easier to click around from center ("click [from] zero zero")
const click00 = (x: number, y: number) => const click00 = (x: number, y: number) =>
opts.page.mouse.click(opts.center.x + x, opts.center.y + y) opts.page.mouse.click(opts.center.x + x, opts.center.y + y, { delay: 100 })
// Relative clicker, must keep state // Relative clicker, must keep state
let last = { x: 0, y: 0 } let last = { x: 0, y: 0 }
const click00r = (x?: number, y?: number) => { const click00r = async (x?: number, y?: number) => {
// reset relative coordinates when anything is undefined // reset relative coordinates when anything is undefined
if (x === undefined || y === undefined) { if (x === undefined || y === undefined) {
last.x = 0 last.x = 0
@ -163,12 +189,19 @@ export const getMovementUtils = (opts: any) => {
return return
} }
const ret = click00(last.x + x, last.y + y) await circleMove(
opts.page,
opts.center.x + last.x + x,
opts.center.y + last.y + y,
10,
10
)
await click00(last.x + x, last.y + y)
last.x += x last.x += x
last.y += y last.y += y
// Returns the new absolute coordinate if you need it. // Returns the new absolute coordinate if you need it.
return ret.then(() => [last.x, last.y]) return [last.x, last.y]
} }
return { toSU, click00r } return { toSU, click00r }

View File

@ -37,6 +37,7 @@
"crypto-js": "^4.2.0", "crypto-js": "^4.2.0",
"debounce-promise": "^3.1.2", "debounce-promise": "^3.1.2",
"decamelize": "^6.0.0", "decamelize": "^6.0.0",
"eslint-plugin-suggest-no-throw": "^1.0.0",
"formik": "^2.4.6", "formik": "^2.4.6",
"fuse.js": "^7.0.0", "fuse.js": "^7.0.0",
"html2canvas-pro": "^1.4.3", "html2canvas-pro": "^1.4.3",
@ -120,7 +121,7 @@
"@babel/plugin-proposal-private-property-in-object": "^7.21.11", "@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@babel/preset-env": "^7.24.3", "@babel/preset-env": "^7.24.3",
"@iarna/toml": "^2.2.5", "@iarna/toml": "^2.2.5",
"@playwright/test": "^1.43.1", "@playwright/test": "^1.44.1",
"@tauri-apps/cli": "^2.0.0-beta.13", "@tauri-apps/cli": "^2.0.0-beta.13",
"@types/crypto-js": "^4.2.2", "@types/crypto-js": "^4.2.2",
"@types/debounce-promise": "^3.1.9", "@types/debounce-promise": "^3.1.9",

View File

@ -18,7 +18,7 @@ export default defineConfig({
/* Retry on CI only */ /* Retry on CI only */
retries: process.env.CI ? 3 : 0, retries: process.env.CI ? 3 : 0,
/* Different amount of parallelism on CI and local. */ /* Different amount of parallelism on CI and local. */
workers: process.env.CI ? 1 : 1, workers: process.env.CI ? 1 : 4,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */ /* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html', reporter: 'html',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */

110
src-tauri/Cargo.lock generated
View File

@ -344,7 +344,7 @@ checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -379,7 +379,7 @@ checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -425,7 +425,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -574,7 +574,7 @@ dependencies = [
"proc-macro-crate 3.1.0", "proc-macro-crate 3.1.0",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
"syn_derive", "syn_derive",
] ]
@ -883,7 +883,7 @@ dependencies = [
"heck 0.5.0", "heck 0.5.0",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -1085,7 +1085,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331"
dependencies = [ dependencies = [
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -1095,7 +1095,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "edb49164822f3ee45b17acd4a208cfc1251410cf0cad9a833234c9890774dd9f" checksum = "edb49164822f3ee45b17acd4a208cfc1251410cf0cad9a833234c9890774dd9f"
dependencies = [ dependencies = [
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -1119,7 +1119,7 @@ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"strsim 0.10.0", "strsim 0.10.0",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -1130,7 +1130,7 @@ checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f"
dependencies = [ dependencies = [
"darling_core", "darling_core",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -1177,7 +1177,7 @@ checksum = "4078275de501a61ceb9e759d37bdd3d7210e654dbc167ac1a3678ef4435ed57b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
"synstructure", "synstructure",
] ]
@ -1214,7 +1214,7 @@ dependencies = [
"regex", "regex",
"serde", "serde",
"serde_tokenstream", "serde_tokenstream",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -1225,7 +1225,7 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -1287,7 +1287,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -1319,7 +1319,7 @@ checksum = "f2b99bf03862d7f545ebc28ddd33a665b50865f4dfd84031a393823879bd4c54"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -1417,7 +1417,7 @@ checksum = "5c785274071b1b420972453b306eeca06acf4633829db4223b58a2a8c5953bc4"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -1568,7 +1568,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -1684,7 +1684,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -1960,7 +1960,7 @@ dependencies = [
"proc-macro-error", "proc-macro-error",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -1988,7 +1988,7 @@ dependencies = [
"inflections", "inflections",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -2063,7 +2063,7 @@ dependencies = [
"proc-macro-error", "proc-macro-error",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -2568,7 +2568,7 @@ dependencies = [
[[package]] [[package]]
name = "kcl-lib" name = "kcl-lib"
version = "0.1.62" version = "0.1.65"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"approx", "approx",
@ -2625,9 +2625,9 @@ dependencies = [
[[package]] [[package]]
name = "kittycad" name = "kittycad"
version = "0.3.5" version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df75feef10313fa1cb15b7cecd0f579877312ba3d42bb5b8b4c1d4b1d0fcabf0" checksum = "af3de9bb4b1441f198689a9f64a8163a518377e30b348a784680e738985b95eb"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"async-trait", "async-trait",
@ -2677,9 +2677,9 @@ dependencies = [
[[package]] [[package]]
name = "lazy_static" name = "lazy_static"
version = "1.4.0" version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]] [[package]]
name = "libappindicator" name = "libappindicator"
@ -3358,7 +3358,7 @@ dependencies = [
"regex", "regex",
"regex-syntax 0.8.3", "regex-syntax 0.8.3",
"structmeta", "structmeta",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -3500,7 +3500,7 @@ dependencies = [
"phf_shared 0.11.2", "phf_shared 0.11.2",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -3568,7 +3568,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -4413,7 +4413,7 @@ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"serde_derive_internals", "serde_derive_internals",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -4522,7 +4522,7 @@ checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -4533,7 +4533,7 @@ checksum = "330f01ce65a3a5fe59a60c82f3c9a024b573b8a6e875bd233fe5f934e71d54e3"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -4566,7 +4566,7 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -4587,7 +4587,7 @@ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"serde", "serde",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -4629,7 +4629,7 @@ dependencies = [
"darling", "darling",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -4897,7 +4897,7 @@ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"structmeta-derive", "structmeta-derive",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -4908,7 +4908,7 @@ checksum = "152a0b65a590ff6c3da95cabe2353ee04e6167c896b28e3b14478c2636c922fc"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -4930,7 +4930,7 @@ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"rustversion", "rustversion",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -4963,9 +4963,9 @@ dependencies = [
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.67" version = "2.0.68"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff8655ed1d86f3af4ee3fd3263786bc14245ad17c4c7e85ba7187fb3ae028c90" checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -4981,7 +4981,7 @@ dependencies = [
"proc-macro-error", "proc-macro-error",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -4998,7 +4998,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -5215,7 +5215,7 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"sha2", "sha2",
"syn 2.0.67", "syn 2.0.68",
"tauri-utils", "tauri-utils",
"thiserror", "thiserror",
"time", "time",
@ -5233,7 +5233,7 @@ dependencies = [
"heck 0.4.1", "heck 0.4.1",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
"tauri-codegen", "tauri-codegen",
"tauri-utils", "tauri-utils",
] ]
@ -5599,7 +5599,7 @@ checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -5688,7 +5688,7 @@ checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -5888,7 +5888,7 @@ checksum = "84fd902d4e0b9a4b27f2f440108dc034e1758628a9b702f8ec61ad66355422fa"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -5917,7 +5917,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -6041,7 +6041,7 @@ checksum = "cbdee324e50a7402416d9c25270d3df4241ed528af5d36dda18b6f219551c577"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
"termcolor", "termcolor",
] ]
@ -6253,7 +6253,7 @@ dependencies = [
"proc-macro-error", "proc-macro-error",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -6352,7 +6352,7 @@ dependencies = [
"once_cell", "once_cell",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
@ -6386,7 +6386,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
"wasm-bindgen-backend", "wasm-bindgen-backend",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
@ -6527,7 +6527,7 @@ checksum = "ac1345798ecd8122468840bcdf1b95e5dc6d2206c5e4b0eafa078d061f59c9bc"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -6633,7 +6633,7 @@ checksum = "f6fc35f58ecd95a9b71c4f2329b911016e6bec66b3f2e6a4aad86bd2e99e2f9b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -6644,7 +6644,7 @@ checksum = "08990546bf4edef8f431fa6326e032865f27138718c587dc21bc0265bbcb57cc"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -7086,7 +7086,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]

View File

@ -339,7 +339,7 @@ export function Toolbar({
bgClassName, bgClassName,
}} }}
> >
Constrain Constraints
</ActionButtonDropdown> </ActionButtonDropdown>
)} )}
{state.matches('idle') && ( {state.matches('idle') && (

View File

@ -44,6 +44,7 @@ import {
removeSingleConstraintInfo, removeSingleConstraintInfo,
} from 'lang/modifyAst' } from 'lang/modifyAst'
import { ActionButton } from 'components/ActionButton' import { ActionButton } from 'components/ActionButton'
import { err, trap } from 'lib/trap'
function useShouldHideScene(): { hideClient: boolean; hideServer: boolean } { function useShouldHideScene(): { hideClient: boolean; hideServer: boolean } {
const [isCamMoving, setIsCamMoving] = useState(false) const [isCamMoving, setIsCamMoving] = useState(false)
@ -184,11 +185,14 @@ const Overlay = ({
let xAlignment = overlay.angle < 0 ? '0%' : '-100%' let xAlignment = overlay.angle < 0 ? '0%' : '-100%'
let yAlignment = overlay.angle < -90 || overlay.angle >= 90 ? '0%' : '-100%' let yAlignment = overlay.angle < -90 || overlay.angle >= 90 ? '0%' : '-100%'
const callExpression = getNodeFromPath<CallExpression>( const _node1 = getNodeFromPath<CallExpression>(
kclManager.ast, kclManager.ast,
overlay.pathToNode, overlay.pathToNode,
'CallExpression' 'CallExpression'
).node )
if (err(_node1)) return
const callExpression = _node1.node
const constraints = getConstraintInfo( const constraints = getConstraintInfo(
callExpression, callExpression,
codeManager.code, codeManager.code,
@ -219,6 +223,7 @@ const Overlay = ({
data-testid="segment-overlay" data-testid="segment-overlay"
data-path-to-node={pathToNodeString} data-path-to-node={pathToNodeString}
data-overlay-index={overlayIndex} data-overlay-index={overlayIndex}
data-overlay-visible={shouldShow}
data-overlay-angle={overlay.angle} data-overlay-angle={overlay.angle}
className="pointer-events-auto absolute w-0 h-0" className="pointer-events-auto absolute w-0 h-0"
style={{ style={{
@ -227,6 +232,7 @@ const Overlay = ({
></div> ></div>
{shouldShow && ( {shouldShow && (
<div <div
data-overlay-toolbar-index={overlayIndex}
className={`px-0 pointer-events-auto absolute flex gap-1`} className={`px-0 pointer-events-auto absolute flex gap-1`}
style={{ style={{
transform: `translate3d(calc(${ transform: `translate3d(calc(${
@ -352,7 +358,7 @@ export async function deleteSegment({
pathToNode: PathToNode pathToNode: PathToNode
sketchDetails: SketchDetails | null sketchDetails: SketchDetails | null
}) { }) {
let modifiedAst: Program = kclManager.ast let modifiedAst: Program | Error = kclManager.ast
const dependentRanges = findUsesOfTagInPipe(modifiedAst, pathToNode) const dependentRanges = findUsesOfTagInPipe(modifiedAst, pathToNode)
const shouldContinueSegDelete = dependentRanges.length const shouldContinueSegDelete = dependentRanges.length
@ -363,6 +369,7 @@ export async function deleteSegment({
: true : true
if (!shouldContinueSegDelete) return if (!shouldContinueSegDelete) return
modifiedAst = deleteSegmentFromPipeExpression( modifiedAst = deleteSegmentFromPipeExpression(
dependentRanges, dependentRanges,
modifiedAst, modifiedAst,
@ -370,9 +377,12 @@ export async function deleteSegment({
codeManager.code, codeManager.code,
pathToNode pathToNode
) )
if (err(modifiedAst)) return Promise.reject(modifiedAst)
const newCode = recast(modifiedAst) const newCode = recast(modifiedAst)
modifiedAst = parse(newCode) modifiedAst = parse(newCode)
if (err(modifiedAst)) return Promise.reject(modifiedAst)
const testExecute = await executeAst({ const testExecute = await executeAst({
ast: modifiedAst, ast: modifiedAst,
useFakeExecutor: true, useFakeExecutor: true,
@ -384,13 +394,15 @@ export async function deleteSegment({
} }
if (!sketchDetails) return if (!sketchDetails) return
sceneEntitiesManager.updateAstAndRejigSketch( await sceneEntitiesManager.updateAstAndRejigSketch(
sketchDetails.sketchPathToNode, pathToNode,
modifiedAst, modifiedAst,
sketchDetails.zAxis, sketchDetails.zAxis,
sketchDetails.yAxis, sketchDetails.yAxis,
sketchDetails.origin sketchDetails.origin
) )
// Now 'Set sketchDetails' is called with the modified pathToNode
} }
const SegmentMenu = ({ const SegmentMenu = ({
@ -535,10 +547,13 @@ const ConstraintSymbol = ({
const implicitDesc = const implicitDesc =
varNameMap[_type as LineInputsType]?.implicitConstraintDesc varNameMap[_type as LineInputsType]?.implicitConstraintDesc
const node = useMemo( const _node = useMemo(
() => getNodeFromPath<Value>(kclManager.ast, pathToNode).node, () => getNodeFromPath<Value>(kclManager.ast, pathToNode),
[kclManager.ast, pathToNode] [kclManager.ast, pathToNode]
) )
if (err(_node)) return
const node = _node.node
const range: SourceRange = node ? [node.start, node.end] : [0, 0] const range: SourceRange = node ? [node.start, node.end] : [0, 0]
if (_type === 'intersectionTag') return null if (_type === 'intersectionTag') return null
@ -576,12 +591,17 @@ const ConstraintSymbol = ({
}) })
} else if (isConstrained) { } else if (isConstrained) {
try { try {
const shallowPath = getNodeFromPath<CallExpression>( const parsed = parse(recast(kclManager.ast))
parse(recast(kclManager.ast)), if (trap(parsed)) return Promise.reject(parsed)
const _node1 = getNodeFromPath<CallExpression>(
parsed,
pathToNode, pathToNode,
'CallExpression', 'CallExpression',
true true
).shallowPath )
if (trap(_node1)) return Promise.reject(_node1)
const shallowPath = _node1.shallowPath
const input = makeRemoveSingleConstraintInput( const input = makeRemoveSingleConstraintInput(
argPosition, argPosition,
shallowPath shallowPath

View File

@ -101,6 +101,7 @@ import {
updateRectangleSketch, updateRectangleSketch,
} from 'lib/rectangleTool' } from 'lib/rectangleTool'
import { getThemeColorForThreeJs } from 'lib/theme' import { getThemeColorForThreeJs } from 'lib/theme'
import { err, trap } from 'lib/trap'
type DraftSegment = 'line' | 'tangentialArcTo' type DraftSegment = 'line' | 'tangentialArcTo'
@ -318,8 +319,14 @@ export class SceneEntities {
}> { }> {
this.createIntersectionPlane() this.createIntersectionPlane()
const prepared = this.prepareTruncatedMemoryAndAst(
sketchPathToNode || [],
maybeModdedAst
)
if (err(prepared)) return Promise.reject(prepared)
const { truncatedAst, programMemoryOverride, variableDeclarationName } = const { truncatedAst, programMemoryOverride, variableDeclarationName } =
this.prepareTruncatedMemoryAndAst(sketchPathToNode || [], maybeModdedAst) prepared
const { programMemory } = await executeAst({ const { programMemory } = await executeAst({
ast: truncatedAst, ast: truncatedAst,
useFakeExecutor: true, useFakeExecutor: true,
@ -331,6 +338,8 @@ export class SceneEntities {
ast: maybeModdedAst, ast: maybeModdedAst,
programMemory, programMemory,
}) })
if (err(sketchGroup)) return Promise.reject(sketchGroup)
if (!Array.isArray(sketchGroup?.value)) if (!Array.isArray(sketchGroup?.value))
return { return {
truncatedAst, truncatedAst,
@ -406,11 +415,14 @@ export class SceneEntities {
) )
let seg let seg
const callExpName = getNodeFromPath<CallExpression>( const _node1 = getNodeFromPath<CallExpression>(
maybeModdedAst, maybeModdedAst,
segPathToNode, segPathToNode,
'CallExpression' 'CallExpression'
)?.node?.callee?.name )
if (err(_node1)) return
const callExpName = _node1.node?.callee?.name
if (segment.type === 'TangentialArcTo') { if (segment.type === 'TangentialArcTo') {
seg = tangentialArcToSegment({ seg = tangentialArcToSegment({
prevSegment: sketchGroup.value[index - 1], prevSegment: sketchGroup.value[index - 1],
@ -489,12 +501,14 @@ export class SceneEntities {
} }
updateAstAndRejigSketch = async ( updateAstAndRejigSketch = async (
sketchPathToNode: PathToNode, sketchPathToNode: PathToNode,
modifiedAst: Program, modifiedAst: Program | Error,
forward: [number, number, number], forward: [number, number, number],
up: [number, number, number], up: [number, number, number],
origin: [number, number, number] origin: [number, number, number]
) => { ) => {
await kclManager.updateAst(modifiedAst, false) if (err(modifiedAst)) return modifiedAst
const nextAst = await kclManager.updateAst(modifiedAst, false)
await this.tearDownSketch({ removeAxis: false }) await this.tearDownSketch({ removeAxis: false })
sceneInfra.resetMouseListeners() sceneInfra.resetMouseListeners()
await this.setupSketch({ await this.setupSketch({
@ -502,7 +516,7 @@ export class SceneEntities {
forward, forward,
up, up,
position: origin, position: origin,
maybeModdedAst: kclManager.ast, maybeModdedAst: nextAst.newAst,
}) })
this.setupSketchIdleCallbacks({ this.setupSketchIdleCallbacks({
forward, forward,
@ -510,6 +524,7 @@ export class SceneEntities {
position: origin, position: origin,
pathToNode: sketchPathToNode, pathToNode: sketchPathToNode,
}) })
return nextAst
} }
setUpDraftSegment = async ( setUpDraftSegment = async (
sketchPathToNode: PathToNode, sketchPathToNode: PathToNode,
@ -521,12 +536,15 @@ export class SceneEntities {
) => { ) => {
const _ast = JSON.parse(JSON.stringify(kclManager.ast)) const _ast = JSON.parse(JSON.stringify(kclManager.ast))
const variableDeclarationName = const _node1 = getNodeFromPath<VariableDeclaration>(
getNodeFromPath<VariableDeclaration>(
_ast, _ast,
sketchPathToNode || [], sketchPathToNode || [],
'VariableDeclaration' 'VariableDeclaration'
)?.node?.declarations?.[0]?.id?.name || '' )
if (trap(_node1)) return Promise.reject(_node1)
const variableDeclarationName =
_node1.node?.declarations?.[0]?.id?.name || ''
const sg = kclManager.programMemory.root[ const sg = kclManager.programMemory.root[
variableDeclarationName variableDeclarationName
] as SketchGroup ] as SketchGroup
@ -542,7 +560,9 @@ export class SceneEntities {
fnName: segmentName, fnName: segmentName,
pathToNode: sketchPathToNode, pathToNode: sketchPathToNode,
}) })
if (trap(mod)) return Promise.reject(mod)
const modifiedAst = parse(recast(mod.modifiedAst)) const modifiedAst = parse(recast(mod.modifiedAst))
if (trap(modifiedAst)) return Promise.reject(modifiedAst)
const draftExpressionsIndices = { start: index, end: index } const draftExpressionsIndices = { start: index, end: index }
@ -593,14 +613,16 @@ export class SceneEntities {
), ),
], ],
}) })
if (trap(modifiedAst)) return Promise.reject(modifiedAst)
modifiedAst = addCloseToPipe({ modifiedAst = addCloseToPipe({
node: modifiedAst, node: modifiedAst,
programMemory: kclManager.programMemory, programMemory: kclManager.programMemory,
pathToNode: sketchPathToNode, pathToNode: sketchPathToNode,
}) })
if (trap(modifiedAst)) return Promise.reject(modifiedAst)
} else if (intersection2d) { } else if (intersection2d) {
const lastSegment = sketchGroup.value.slice(-1)[0] const lastSegment = sketchGroup.value.slice(-1)[0]
modifiedAst = addNewSketchLn({ const tmp = addNewSketchLn({
node: kclManager.ast, node: kclManager.ast,
programMemory: kclManager.programMemory, programMemory: kclManager.programMemory,
to: [intersection2d.x, intersection2d.y], to: [intersection2d.x, intersection2d.y],
@ -610,7 +632,10 @@ export class SceneEntities {
? 'tangentialArcTo' ? 'tangentialArcTo'
: 'line', : 'line',
pathToNode: sketchPathToNode, pathToNode: sketchPathToNode,
}).modifiedAst })
if (trap(tmp)) return Promise.reject(tmp)
modifiedAst = tmp.modifiedAst
if (trap(modifiedAst)) return Promise.reject(modifiedAst)
} else { } else {
// return early as we didn't modify the ast // return early as we didn't modify the ast
return return
@ -669,12 +694,14 @@ export class SceneEntities {
) => { ) => {
let _ast = JSON.parse(JSON.stringify(kclManager.ast)) let _ast = JSON.parse(JSON.stringify(kclManager.ast))
const variableDeclarationName = const _node1 = getNodeFromPath<VariableDeclaration>(
getNodeFromPath<VariableDeclaration>(
_ast, _ast,
sketchPathToNode || [], sketchPathToNode || [],
'VariableDeclaration' 'VariableDeclaration'
)?.node?.declarations?.[0]?.id?.name || '' )
if (trap(_node1)) return Promise.reject(_node1)
const variableDeclarationName =
_node1.node?.declarations?.[0]?.id?.name || ''
const tags: [string, string, string] = [ const tags: [string, string, string] = [
findUniqueName(_ast, 'rectangleSegmentA'), findUniqueName(_ast, 'rectangleSegmentA'),
@ -682,11 +709,13 @@ export class SceneEntities {
findUniqueName(_ast, 'rectangleSegmentC'), findUniqueName(_ast, 'rectangleSegmentC'),
] ]
const startSketchOn = getNodeFromPath<VariableDeclaration>( const _node2 = getNodeFromPath<VariableDeclaration>(
_ast, _ast,
sketchPathToNode || [], sketchPathToNode || [],
'VariableDeclaration' 'VariableDeclaration'
)?.node?.declarations )
if (trap(_node2)) return Promise.reject(_node2)
const startSketchOn = _node2.node?.declarations
const startSketchOnInit = startSketchOn?.[0]?.init const startSketchOnInit = startSketchOn?.[0]?.init
startSketchOn[0].init = createPipeExpression([ startSketchOn[0].init = createPipeExpression([
@ -711,11 +740,13 @@ export class SceneEntities {
const pathToNodeTwo = JSON.parse(JSON.stringify(sketchPathToNode)) const pathToNodeTwo = JSON.parse(JSON.stringify(sketchPathToNode))
pathToNodeTwo[1][0] = 0 pathToNodeTwo[1][0] = 0
const sketchInit = getNodeFromPath<VariableDeclaration>( const _node = getNodeFromPath<VariableDeclaration>(
truncatedAst, truncatedAst,
pathToNodeTwo || [], pathToNodeTwo || [],
'VariableDeclaration' 'VariableDeclaration'
)?.node?.declarations?.[0]?.init )
if (trap(_node)) return Promise.reject(_node)
const sketchInit = _node.node?.declarations?.[0]?.init
const x = (args.intersectionPoint.twoD.x || 0) - rectangleOrigin[0] const x = (args.intersectionPoint.twoD.x || 0) - rectangleOrigin[0]
const y = (args.intersectionPoint.twoD.y || 0) - rectangleOrigin[1] const y = (args.intersectionPoint.twoD.y || 0) - rectangleOrigin[1]
@ -757,11 +788,13 @@ export class SceneEntities {
const x = roundOff((cornerPoint.x || 0) - rectangleOrigin[0]) const x = roundOff((cornerPoint.x || 0) - rectangleOrigin[0])
const y = roundOff((cornerPoint.y || 0) - rectangleOrigin[1]) const y = roundOff((cornerPoint.y || 0) - rectangleOrigin[1])
const sketchInit = getNodeFromPath<VariableDeclaration>( const _node = getNodeFromPath<VariableDeclaration>(
_ast, _ast,
sketchPathToNode || [], sketchPathToNode || [],
'VariableDeclaration' 'VariableDeclaration'
)?.node?.declarations?.[0]?.init )
if (trap(_node)) return Promise.reject(_node)
const sketchInit = _node.node?.declarations?.[0]?.init
if (sketchInit.type === 'PipeExpression') { if (sketchInit.type === 'PipeExpression') {
updateRectangleSketch(sketchInit, x, y, tags[0]) updateRectangleSketch(sketchInit, x, y, tags[0])
@ -857,6 +890,7 @@ export class SceneEntities {
ast: kclManager.ast, ast: kclManager.ast,
programMemory: kclManager.programMemory, programMemory: kclManager.programMemory,
}) })
if (trap(sketchGroup)) return
const pipeIndex = pathToNode[pathToNodeIndex + 1][0] as number const pipeIndex = pathToNode[pathToNodeIndex + 1][0] as number
if (addingNewSegmentStatus === 'nothing') { if (addingNewSegmentStatus === 'nothing') {
@ -874,6 +908,8 @@ export class SceneEntities {
spliceBetween: true, spliceBetween: true,
}) })
addingNewSegmentStatus = 'pending' addingNewSegmentStatus = 'pending'
if (trap(mod)) return
await kclManager.executeAstMock(mod.modifiedAst) await kclManager.executeAstMock(mod.modifiedAst)
await this.tearDownSketch({ removeAxis: false }) await this.tearDownSketch({ removeAxis: false })
this.setupSketch({ this.setupSketch({
@ -982,17 +1018,22 @@ export class SceneEntities {
const to: [number, number] = [intersection2d.x, intersection2d.y] const to: [number, number] = [intersection2d.x, intersection2d.y]
let modifiedAst = draftInfo ? draftInfo.truncatedAst : { ...kclManager.ast } let modifiedAst = draftInfo ? draftInfo.truncatedAst : { ...kclManager.ast }
const node = getNodeFromPath<CallExpression>( const _node = getNodeFromPath<CallExpression>(
modifiedAst, modifiedAst,
pathToNode, pathToNode,
'CallExpression' 'CallExpression'
).node )
if (trap(_node)) return
const node = _node.node
if (node.type !== 'CallExpression') return if (node.type !== 'CallExpression') return
let modded: { let modded:
| {
modifiedAst: Program modifiedAst: Program
pathToNode: PathToNode pathToNode: PathToNode
} }
| Error
if (group.name === PROFILE_START) { if (group.name === PROFILE_START) {
modded = updateStartProfileAtArgs({ modded = updateStartProfileAtArgs({
node: modifiedAst, node: modifiedAst,
@ -1010,14 +1051,18 @@ export class SceneEntities {
from from
) )
} }
if (trap(modded)) return
modifiedAst = modded.modifiedAst modifiedAst = modded.modifiedAst
const { truncatedAst, programMemoryOverride, variableDeclarationName } = const info = draftInfo
draftInfo
? draftInfo ? draftInfo
: this.prepareTruncatedMemoryAndAst(sketchPathToNode || []) : this.prepareTruncatedMemoryAndAst(pathToNode || [])
if (trap(info, { suppress: true })) return
const { truncatedAst, programMemoryOverride, variableDeclarationName } =
info
;(async () => { ;(async () => {
const code = recast(modifiedAst) const code = recast(modifiedAst)
if (trap(code)) return
if (!draftInfo) if (!draftInfo)
// don't want to mod the user's code yet as they have't committed to the change yet // don't want to mod the user's code yet as they have't committed to the change yet
// plus this would be the truncated ast being recast, it would be wrong // plus this would be the truncated ast being recast, it would be wrong
@ -1544,11 +1589,14 @@ export class SceneEntities {
]) ])
if (parent?.userData?.pathToNode) { if (parent?.userData?.pathToNode) {
const updatedAst = parse(recast(kclManager.ast)) const updatedAst = parse(recast(kclManager.ast))
const node = getNodeFromPath<CallExpression>( if (trap(updatedAst)) return
const _node = getNodeFromPath<CallExpression>(
updatedAst, updatedAst,
parent.userData.pathToNode, parent.userData.pathToNode,
'CallExpression' 'CallExpression'
).node )
if (trap(_node, { suppress: true })) return
const node = _node.node
editorManager.setHighlightRange([node.start, node.end]) editorManager.setHighlightRange([node.start, node.end])
const yellow = 0xffff00 const yellow = 0xffff00
colorSegment(selected, yellow) colorSegment(selected, yellow)
@ -1663,20 +1711,23 @@ function prepareTruncatedMemoryAndAst(
ast: Program, ast: Program,
programMemory: ProgramMemory, programMemory: ProgramMemory,
draftSegment?: DraftSegment draftSegment?: DraftSegment
): { ):
| {
truncatedAst: Program truncatedAst: Program
programMemoryOverride: ProgramMemory programMemoryOverride: ProgramMemory
variableDeclarationName: string variableDeclarationName: string
} { }
| Error {
const bodyIndex = Number(sketchPathToNode?.[1]?.[0]) || 0 const bodyIndex = Number(sketchPathToNode?.[1]?.[0]) || 0
const _ast = JSON.parse(JSON.stringify(ast)) const _ast = JSON.parse(JSON.stringify(ast))
const variableDeclarationName = const _node = getNodeFromPath<VariableDeclaration>(
getNodeFromPath<VariableDeclaration>(
_ast, _ast,
sketchPathToNode || [], sketchPathToNode || [],
'VariableDeclaration' 'VariableDeclaration'
)?.node?.declarations?.[0]?.id?.name || '' )
if (err(_node)) return _node
const variableDeclarationName = _node.node?.declarations?.[0]?.id?.name || ''
const lastSeg = ( const lastSeg = (
programMemory.root[variableDeclarationName] as SketchGroup programMemory.root[variableDeclarationName] as SketchGroup
).value.slice(-1)[0] ).value.slice(-1)[0]
@ -1704,6 +1755,8 @@ function prepareTruncatedMemoryAndAst(
// update source ranges to section we just added. // update source ranges to section we just added.
// hacks like this wouldn't be needed if the AST put pathToNode info in memory/sketchGroup segments // hacks like this wouldn't be needed if the AST put pathToNode info in memory/sketchGroup segments
const updatedSrcRangeAst = parse(recast(_ast)) // get source ranges correct since unfortunately we still rely on them const updatedSrcRangeAst = parse(recast(_ast)) // get source ranges correct since unfortunately we still rely on them
if (err(updatedSrcRangeAst)) return updatedSrcRangeAst
const lastPipeItem = ( const lastPipeItem = (
(updatedSrcRangeAst.body[bodyIndex] as VariableDeclaration) (updatedSrcRangeAst.body[bodyIndex] as VariableDeclaration)
.declarations[0].init as PipeExpression .declarations[0].init as PipeExpression
@ -1727,7 +1780,9 @@ function prepareTruncatedMemoryAndAst(
..._ast, ..._ast,
body: [JSON.parse(JSON.stringify(_ast.body[bodyIndex]))], body: [JSON.parse(JSON.stringify(_ast.body[bodyIndex]))],
} }
const programMemoryOverride: ProgramMemory = programMemoryInit() const programMemoryOverride = programMemoryInit()
if (err(programMemoryOverride)) return programMemoryOverride
for (let i = 0; i < bodyIndex; i++) { for (let i = 0; i < bodyIndex; i++) {
const node = _ast.body[i] const node = _ast.body[i]
if (node.type !== 'VariableDeclaration') { if (node.type !== 'VariableDeclaration') {
@ -1768,12 +1823,14 @@ export function sketchGroupFromPathToNode({
pathToNode: PathToNode pathToNode: PathToNode
ast: Program ast: Program
programMemory: ProgramMemory programMemory: ProgramMemory
}): SketchGroup { }): SketchGroup | Error {
const varDec = getNodeFromPath<VariableDeclarator>( const _varDec = getNodeFromPath<VariableDeclarator>(
kclManager.ast, kclManager.ast,
pathToNode, pathToNode,
'VariableDeclarator' 'VariableDeclarator'
).node )
if (err(_varDec)) return _varDec
const varDec = _varDec.node
const result = programMemory.root[varDec?.id?.name || ''] const result = programMemory.root[varDec?.id?.name || '']
if (result?.type === 'ExtrudeGroup') { if (result?.type === 'ExtrudeGroup') {
return result.sketchGroup return result.sketchGroup
@ -1808,13 +1865,15 @@ function colorSegment(object: any, color: number) {
export function getSketchQuaternion( export function getSketchQuaternion(
sketchPathToNode: PathToNode, sketchPathToNode: PathToNode,
sketchNormalBackUp: [number, number, number] | null sketchNormalBackUp: [number, number, number] | null
): Quaternion { ): Quaternion | Error {
const sketchGroup = sketchGroupFromPathToNode({ const sketchGroup = sketchGroupFromPathToNode({
pathToNode: sketchPathToNode, pathToNode: sketchPathToNode,
ast: kclManager.ast, ast: kclManager.ast,
programMemory: kclManager.programMemory, programMemory: kclManager.programMemory,
}) })
if (err(sketchGroup)) return sketchGroup
const zAxis = sketchGroup?.on.zAxis || sketchNormalBackUp const zAxis = sketchGroup?.on.zAxis || sketchNormalBackUp
return getQuaternionFromZAxis(massageFormats(zAxis)) return getQuaternionFromZAxis(massageFormats(zAxis))
} }
export async function getSketchOrientationDetails( export async function getSketchOrientationDetails(
@ -1828,6 +1887,8 @@ export async function getSketchOrientationDetails(
ast: kclManager.ast, ast: kclManager.ast,
programMemory: kclManager.programMemory, programMemory: kclManager.programMemory,
}) })
if (err(sketchGroup)) return Promise.reject(sketchGroup)
if (sketchGroup.on.type === 'plane') { if (sketchGroup.on.type === 'plane') {
const zAxis = sketchGroup?.on.zAxis const zAxis = sketchGroup?.on.zAxis
return { return {
@ -1845,11 +1906,12 @@ export async function getSketchOrientationDetails(
}, },
} }
} }
if (sketchGroup.on.type === 'face') { if (sketchGroup.on.type === 'face') {
const faceInfo = await getFaceDetails(sketchGroup.on.id) const faceInfo = await getFaceDetails(sketchGroup.on.id)
if (!faceInfo?.origin || !faceInfo?.z_axis || !faceInfo?.y_axis) if (!faceInfo?.origin || !faceInfo?.z_axis || !faceInfo?.y_axis)
throw new Error('faceInfo') return Promise.reject('face info')
const { z_axis, y_axis, origin } = faceInfo const { z_axis, y_axis, origin } = faceInfo
const quaternion = quaternionFromUpNForward( const quaternion = quaternionFromUpNForward(
new Vector3(y_axis.x, y_axis.y, y_axis.z), new Vector3(y_axis.x, y_axis.y, y_axis.z),
@ -1866,7 +1928,7 @@ export async function getSketchOrientationDetails(
}, },
} }
} }
throw new Error( return Promise.reject(
'sketchGroup.on.type not recognized, has a new type been added?' 'sketchGroup.on.type not recognized, has a new type been added?'
) )
} }

View File

@ -2,6 +2,7 @@ import { useModelingContext } from 'hooks/useModelingContext'
import { editorManager, kclManager } from 'lib/singletons' import { editorManager, kclManager } from 'lib/singletons'
import { getNodeFromPath, getNodePathFromSourceRange } from 'lang/queryAst' import { getNodeFromPath, getNodePathFromSourceRange } from 'lang/queryAst'
import { useEffect, useRef, useState } from 'react' import { useEffect, useRef, useState } from 'react'
import { trap } from 'lib/trap'
export function AstExplorer() { export function AstExplorer() {
const { context } = useModelingContext() const { context } = useModelingContext()
@ -10,9 +11,12 @@ export function AstExplorer() {
kclManager.ast, kclManager.ast,
context.selectionRanges.codeBasedSelections?.[0]?.range context.selectionRanges.codeBasedSelections?.[0]?.range
) )
const node = getNodeFromPath(kclManager.ast, pathToNode).node
const [filterKeys, setFilterKeys] = useState<string[]>(['start', 'end']) const [filterKeys, setFilterKeys] = useState<string[]>(['start', 'end'])
const _node = getNodeFromPath(kclManager.ast, pathToNode)
if (trap(_node)) return
const node = _node
return ( return (
<div id="ast-explorer" className="relative"> <div id="ast-explorer" className="relative">
<div className=""> <div className="">

View File

@ -11,6 +11,7 @@ import { engineCommandManager, kclManager } from 'lib/singletons'
import { useKclContext } from 'lang/KclProvider' import { useKclContext } from 'lang/KclProvider'
import { useModelingContext } from 'hooks/useModelingContext' import { useModelingContext } from 'hooks/useModelingContext'
import { executeAst } from 'useStore' import { executeAst } from 'useStore'
import { trap } from 'lib/trap'
export const AvailableVars = ({ export const AvailableVars = ({
onVarClick, onVarClick,
@ -141,6 +142,7 @@ export function useCalc({
try { try {
const code = `const __result__ = ${value}` const code = `const __result__ = ${value}`
const ast = parse(code) const ast = parse(code)
if (trap(ast)) return
const _programMem: any = { root: {}, return: null } const _programMem: any = { root: {}, return: null }
availableVarInfo.variables.forEach(({ key, value }) => { availableVarInfo.variables.forEach(({ key, value }) => {
_programMem.root[key] = { type: 'userVal', value, __meta: [] } _programMem.root[key] = { type: 'userVal', value, __meta: [] }

View File

@ -24,7 +24,7 @@ export const CommandBar = () => {
}, [pathname]) }, [pathname])
// Hook up keyboard shortcuts // Hook up keyboard shortcuts
useHotkeyWrapper(['mod+k', 'mod+/'], () => { useHotkeyWrapper(['mod+k', 'ctrl+c'], () => {
if (commandBarState.context.commands.length === 0) return if (commandBarState.context.commands.length === 0) return
if (commandBarState.matches('Closed')) { if (commandBarState.matches('Closed')) {
commandBarSend({ type: 'Open' }) commandBarSend({ type: 'Open' })

View File

@ -1,6 +1,12 @@
import { LanguageServerClient } from 'editor/plugins/lsp' import { LanguageServerClient } from 'editor/plugins/lsp'
import type * as LSP from 'vscode-languageserver-protocol' import type * as LSP from 'vscode-languageserver-protocol'
import React, { createContext, useMemo, useEffect, useContext } from 'react' import React, {
createContext,
useMemo,
useEffect,
useContext,
useState,
} from 'react'
import { FromServer, IntoServer } from 'editor/plugins/lsp/codec' import { FromServer, IntoServer } from 'editor/plugins/lsp/codec'
import Client from '../editor/plugins/lsp/client' import Client from '../editor/plugins/lsp/client'
import { TEST, VITE_KC_API_BASE_URL } from 'env' import { TEST, VITE_KC_API_BASE_URL } from 'env'
@ -24,6 +30,7 @@ import { wasmUrl } from 'lang/wasm'
import { PROJECT_ENTRYPOINT } from 'lib/constants' import { PROJECT_ENTRYPOINT } from 'lib/constants'
import { useNetworkContext } from 'hooks/useNetworkContext' import { useNetworkContext } from 'hooks/useNetworkContext'
import { NetworkHealthState } from 'hooks/useNetworkStatus' import { NetworkHealthState } from 'hooks/useNetworkStatus'
import { err, trap } from 'lib/trap'
function getWorkspaceFolders(): LSP.WorkspaceFolder[] { function getWorkspaceFolders(): LSP.WorkspaceFolder[] {
return [] return []
@ -76,6 +83,8 @@ export const LspProvider = ({ children }: { children: React.ReactNode }) => {
setIsCopilotLspServerReady: s.setIsCopilotLspServerReady, setIsCopilotLspServerReady: s.setIsCopilotLspServerReady,
isStreamReady: s.isStreamReady, isStreamReady: s.isStreamReady,
})) }))
const [isLspReady, setIsLspReady] = useState(false)
const [isCopilotReady, setIsCopilotReady] = useState(false)
const { const {
auth, auth,
@ -111,14 +120,17 @@ export const LspProvider = ({ children }: { children: React.ReactNode }) => {
eventData: initEvent, eventData: initEvent,
}) })
lspWorker.onmessage = function (e) { lspWorker.onmessage = function (e) {
if (err(fromServer)) return
fromServer.add(e.data) fromServer.add(e.data)
} }
const intoServer: IntoServer = new IntoServer(LspWorker.Kcl, lspWorker) const intoServer: IntoServer = new IntoServer(LspWorker.Kcl, lspWorker)
const fromServer: FromServer = FromServer.create() const fromServer: FromServer | Error = FromServer.create()
if (err(fromServer)) return { lspClient: null }
const client = new Client(fromServer, intoServer) const client = new Client(fromServer, intoServer)
setIsKclLspServerReady(true) setIsLspReady(true)
const lspClient = new LanguageServerClient({ client, name: LspWorker.Kcl }) const lspClient = new LanguageServerClient({ client, name: LspWorker.Kcl })
return { lspClient } return { lspClient }
@ -185,14 +197,17 @@ export const LspProvider = ({ children }: { children: React.ReactNode }) => {
eventData: initEvent, eventData: initEvent,
}) })
lspWorker.onmessage = function (e) { lspWorker.onmessage = function (e) {
if (err(fromServer)) return
fromServer.add(e.data) fromServer.add(e.data)
} }
const intoServer: IntoServer = new IntoServer(LspWorker.Copilot, lspWorker) const intoServer: IntoServer = new IntoServer(LspWorker.Copilot, lspWorker)
const fromServer: FromServer = FromServer.create() const fromServer: FromServer | Error = FromServer.create()
if (err(fromServer)) return { lspClient: null }
const client = new Client(fromServer, intoServer) const client = new Client(fromServer, intoServer)
setIsCopilotLspServerReady(true) setIsCopilotReady(true)
const lspClient = new LanguageServerClient({ const lspClient = new LanguageServerClient({
client, client,
@ -230,6 +245,13 @@ export const LspProvider = ({ children }: { children: React.ReactNode }) => {
lspClients.push(copilotLspClient) lspClients.push(copilotLspClient)
} }
useEffect(() => {
setIsKclLspServerReady(isLspReady)
}, [isLspReady])
useEffect(() => {
setIsCopilotLspServerReady(isCopilotReady)
}, [isCopilotReady])
const onProjectClose = ( const onProjectClose = (
file: FileEntry | null, file: FileEntry | null,
projectPath: string | null, projectPath: string | null,

View File

@ -29,7 +29,6 @@ import {
applyConstraintAngleBetween, applyConstraintAngleBetween,
} from './Toolbar/SetAngleBetween' } from './Toolbar/SetAngleBetween'
import { applyConstraintAngleLength } from './Toolbar/setAngleLength' import { applyConstraintAngleLength } from './Toolbar/setAngleLength'
import { pathMapToSelections } from 'lang/util'
import { useStore } from 'useStore' import { useStore } from 'useStore'
import { import {
Selections, Selections,
@ -37,6 +36,7 @@ import {
handleSelectionBatch, handleSelectionBatch,
isSelectionLastLine, isSelectionLastLine,
isSketchPipe, isSketchPipe,
updateSelections,
} from 'lib/selections' } from 'lib/selections'
import { applyConstraintIntersect } from './Toolbar/Intersect' import { applyConstraintIntersect } from './Toolbar/Intersect'
import { applyConstraintAbsDistance } from './Toolbar/SetAbsDistance' import { applyConstraintAbsDistance } from './Toolbar/SetAbsDistance'
@ -77,6 +77,7 @@ import { letEngineAnimateAndSyncCamAfter } from 'clientSideScene/CameraControls'
import { getVarNameModal } from 'hooks/useToolbarGuards' import { getVarNameModal } from 'hooks/useToolbarGuards'
import useHotkeyWrapper from 'lib/hotkeyWrapper' import useHotkeyWrapper from 'lib/hotkeyWrapper'
import { uuidv4 } from 'lib/utils' import { uuidv4 } from 'lib/utils'
import { err, trap } from 'lib/trap'
type MachineContext<T extends AnyStateMachine> = { type MachineContext<T extends AnyStateMachine> = {
state: StateFrom<T> state: StateFrom<T>
@ -459,12 +460,17 @@ export const ModelingMachineProvider = ({
return canExtrudeSelection(selectionRanges) return canExtrudeSelection(selectionRanges)
}, },
'Sketch is empty': ({ sketchDetails }) => 'Sketch is empty': ({ sketchDetails }) => {
getNodeFromPath<VariableDeclaration>( const node = getNodeFromPath<VariableDeclaration>(
kclManager.ast, kclManager.ast,
sketchDetails?.sketchPathToNode || [], sketchDetails?.sketchPathToNode || [],
'VariableDeclaration' 'VariableDeclaration'
)?.node?.declarations?.[0]?.init.type !== 'PipeExpression', )
// This should not be returning false, and it should be caught
// but we need to simulate old behavior to move on.
if (err(node)) return false
return node.node?.declarations?.[0]?.init.type !== 'PipeExpression'
},
'Selection is on face': ({ selectionRanges }, { data }) => { 'Selection is on face': ({ selectionRanges }, { data }) => {
if (data?.forceNewSketch) return false if (data?.forceNewSketch) return false
if (!isSingleCursorInPipe(selectionRanges, kclManager.ast)) if (!isSingleCursorInPipe(selectionRanges, kclManager.ast))
@ -507,14 +513,16 @@ export const ModelingMachineProvider = ({
}, },
'animate-to-face': async (_, { data }) => { 'animate-to-face': async (_, { data }) => {
if (data.type === 'extrudeFace') { if (data.type === 'extrudeFace') {
const { modifiedAst, pathToNode: pathToNewSketchNode } = const sketched = sketchOnExtrudedFace(
sketchOnExtrudedFace(
kclManager.ast, kclManager.ast,
data.sketchPathToNode, data.sketchPathToNode,
data.extrudePathToNode, data.extrudePathToNode,
kclManager.programMemory, kclManager.programMemory,
data.cap data.cap
) )
if (trap(sketched)) return Promise.reject(sketched)
const { modifiedAst, pathToNode: pathToNewSketchNode } = sketched
await kclManager.executeAstMock(modifiedAst) await kclManager.executeAstMock(modifiedAst)
await letEngineAnimateAndSyncCamAfter( await letEngineAnimateAndSyncCamAfter(
@ -535,10 +543,12 @@ export const ModelingMachineProvider = ({
) )
await kclManager.updateAst(modifiedAst, false) await kclManager.updateAst(modifiedAst, false)
sceneInfra.camControls.syncDirection = 'clientToEngine' sceneInfra.camControls.syncDirection = 'clientToEngine'
await letEngineAnimateAndSyncCamAfter( await letEngineAnimateAndSyncCamAfter(
engineCommandManager, engineCommandManager,
data.planeId data.planeId
) )
return { return {
sketchPathToNode: pathToNode, sketchPathToNode: pathToNode,
zAxis: data.zAxis, zAxis: data.zAxis,
@ -576,25 +586,29 @@ export const ModelingMachineProvider = ({
selectionRanges, selectionRanges,
}) })
const _modifiedAst = parse(recast(modifiedAst)) const _modifiedAst = parse(recast(modifiedAst))
if (!sketchDetails) throw new Error('No sketch details') if (!sketchDetails)
return Promise.reject(new Error('No sketch details'))
const updatedPathToNode = updatePathToNodeFromMap( const updatedPathToNode = updatePathToNodeFromMap(
sketchDetails.sketchPathToNode, sketchDetails.sketchPathToNode,
pathToNodeMap pathToNodeMap
) )
await sceneEntitiesManager.updateAstAndRejigSketch( const updatedAst = await sceneEntitiesManager.updateAstAndRejigSketch(
updatedPathToNode, updatedPathToNode,
_modifiedAst, _modifiedAst,
sketchDetails.zAxis, sketchDetails.zAxis,
sketchDetails.yAxis, sketchDetails.yAxis,
sketchDetails.origin sketchDetails.origin
) )
if (err(updatedAst)) return Promise.reject(updatedAst)
const selection = updateSelections(
pathToNodeMap,
selectionRanges,
updatedAst.newAst
)
if (err(selection)) return Promise.reject(selection)
return { return {
selectionType: 'completeSelection', selectionType: 'completeSelection',
selection: pathMapToSelections( selection,
kclManager.ast,
selectionRanges,
pathToNodeMap
),
updatedPathToNode, updatedPathToNode,
} }
}, },
@ -608,25 +622,29 @@ export const ModelingMachineProvider = ({
selectionRanges, selectionRanges,
}) })
const _modifiedAst = parse(recast(modifiedAst)) const _modifiedAst = parse(recast(modifiedAst))
if (!sketchDetails) throw new Error('No sketch details') if (!sketchDetails)
return Promise.reject(new Error('No sketch details'))
const updatedPathToNode = updatePathToNodeFromMap( const updatedPathToNode = updatePathToNodeFromMap(
sketchDetails.sketchPathToNode, sketchDetails.sketchPathToNode,
pathToNodeMap pathToNodeMap
) )
await sceneEntitiesManager.updateAstAndRejigSketch( const updatedAst = await sceneEntitiesManager.updateAstAndRejigSketch(
updatedPathToNode, updatedPathToNode,
_modifiedAst, _modifiedAst,
sketchDetails.zAxis, sketchDetails.zAxis,
sketchDetails.yAxis, sketchDetails.yAxis,
sketchDetails.origin sketchDetails.origin
) )
if (err(updatedAst)) return Promise.reject(updatedAst)
const selection = updateSelections(
pathToNodeMap,
selectionRanges,
updatedAst.newAst
)
if (err(selection)) return Promise.reject(selection)
return { return {
selectionType: 'completeSelection', selectionType: 'completeSelection',
selection: pathMapToSelections( selection,
kclManager.ast,
selectionRanges,
pathToNodeMap
),
updatedPathToNode, updatedPathToNode,
} }
}, },
@ -634,9 +652,11 @@ export const ModelingMachineProvider = ({
selectionRanges, selectionRanges,
sketchDetails, sketchDetails,
}): Promise<SetSelections> => { }): Promise<SetSelections> => {
const { modifiedAst, pathToNodeMap } = await (angleBetweenInfo({ const info = angleBetweenInfo({
selectionRanges, selectionRanges,
}).enabled })
if (err(info)) return Promise.reject(info)
const { modifiedAst, pathToNodeMap } = await (info.enabled
? applyConstraintAngleBetween({ ? applyConstraintAngleBetween({
selectionRanges, selectionRanges,
}) })
@ -645,25 +665,31 @@ export const ModelingMachineProvider = ({
angleOrLength: 'setAngle', angleOrLength: 'setAngle',
})) }))
const _modifiedAst = parse(recast(modifiedAst)) const _modifiedAst = parse(recast(modifiedAst))
if (!sketchDetails) throw new Error('No sketch details') if (err(_modifiedAst)) return Promise.reject(_modifiedAst)
if (!sketchDetails)
return Promise.reject(new Error('No sketch details'))
const updatedPathToNode = updatePathToNodeFromMap( const updatedPathToNode = updatePathToNodeFromMap(
sketchDetails.sketchPathToNode, sketchDetails.sketchPathToNode,
pathToNodeMap pathToNodeMap
) )
await sceneEntitiesManager.updateAstAndRejigSketch( const updatedAst = await sceneEntitiesManager.updateAstAndRejigSketch(
updatedPathToNode, updatedPathToNode,
_modifiedAst, _modifiedAst,
sketchDetails.zAxis, sketchDetails.zAxis,
sketchDetails.yAxis, sketchDetails.yAxis,
sketchDetails.origin sketchDetails.origin
) )
if (err(updatedAst)) return Promise.reject(updatedAst)
const selection = updateSelections(
pathToNodeMap,
selectionRanges,
updatedAst.newAst
)
if (err(selection)) return Promise.reject(selection)
return { return {
selectionType: 'completeSelection', selectionType: 'completeSelection',
selection: pathMapToSelections( selection,
_modifiedAst,
selectionRanges,
pathToNodeMap
),
updatedPathToNode, updatedPathToNode,
} }
}, },
@ -674,25 +700,29 @@ export const ModelingMachineProvider = ({
const { modifiedAst, pathToNodeMap } = const { modifiedAst, pathToNodeMap } =
await applyConstraintAngleLength({ selectionRanges }) await applyConstraintAngleLength({ selectionRanges })
const _modifiedAst = parse(recast(modifiedAst)) const _modifiedAst = parse(recast(modifiedAst))
if (!sketchDetails) throw new Error('No sketch details') if (!sketchDetails)
return Promise.reject(new Error('No sketch details'))
const updatedPathToNode = updatePathToNodeFromMap( const updatedPathToNode = updatePathToNodeFromMap(
sketchDetails.sketchPathToNode, sketchDetails.sketchPathToNode,
pathToNodeMap pathToNodeMap
) )
await sceneEntitiesManager.updateAstAndRejigSketch( const updatedAst = await sceneEntitiesManager.updateAstAndRejigSketch(
updatedPathToNode, updatedPathToNode,
_modifiedAst, _modifiedAst,
sketchDetails.zAxis, sketchDetails.zAxis,
sketchDetails.yAxis, sketchDetails.yAxis,
sketchDetails.origin sketchDetails.origin
) )
if (err(updatedAst)) return Promise.reject(updatedAst)
const selection = updateSelections(
pathToNodeMap,
selectionRanges,
updatedAst.newAst
)
if (err(selection)) return Promise.reject(selection)
return { return {
selectionType: 'completeSelection', selectionType: 'completeSelection',
selection: pathMapToSelections( selection,
kclManager.ast,
selectionRanges,
pathToNodeMap
),
updatedPathToNode, updatedPathToNode,
} }
}, },
@ -706,25 +736,29 @@ export const ModelingMachineProvider = ({
} }
) )
const _modifiedAst = parse(recast(modifiedAst)) const _modifiedAst = parse(recast(modifiedAst))
if (!sketchDetails) throw new Error('No sketch details') if (!sketchDetails)
return Promise.reject(new Error('No sketch details'))
const updatedPathToNode = updatePathToNodeFromMap( const updatedPathToNode = updatePathToNodeFromMap(
sketchDetails.sketchPathToNode, sketchDetails.sketchPathToNode,
pathToNodeMap pathToNodeMap
) )
await sceneEntitiesManager.updateAstAndRejigSketch( const updatedAst = await sceneEntitiesManager.updateAstAndRejigSketch(
updatedPathToNode, updatedPathToNode,
_modifiedAst, _modifiedAst,
sketchDetails.zAxis, sketchDetails.zAxis,
sketchDetails.yAxis, sketchDetails.yAxis,
sketchDetails.origin sketchDetails.origin
) )
if (err(updatedAst)) return Promise.reject(updatedAst)
const selection = updateSelections(
pathToNodeMap,
selectionRanges,
updatedAst.newAst
)
if (err(selection)) return Promise.reject(selection)
return { return {
selectionType: 'completeSelection', selectionType: 'completeSelection',
selection: pathMapToSelections( selection,
kclManager.ast,
selectionRanges,
pathToNodeMap
),
updatedPathToNode, updatedPathToNode,
} }
}, },
@ -738,25 +772,29 @@ export const ModelingMachineProvider = ({
selectionRanges, selectionRanges,
}) })
const _modifiedAst = parse(recast(modifiedAst)) const _modifiedAst = parse(recast(modifiedAst))
if (!sketchDetails) throw new Error('No sketch details') if (!sketchDetails)
return Promise.reject(new Error('No sketch details'))
const updatedPathToNode = updatePathToNodeFromMap( const updatedPathToNode = updatePathToNodeFromMap(
sketchDetails.sketchPathToNode, sketchDetails.sketchPathToNode,
pathToNodeMap pathToNodeMap
) )
await sceneEntitiesManager.updateAstAndRejigSketch( const updatedAst = await sceneEntitiesManager.updateAstAndRejigSketch(
updatedPathToNode, updatedPathToNode,
_modifiedAst, _modifiedAst,
sketchDetails.zAxis, sketchDetails.zAxis,
sketchDetails.yAxis, sketchDetails.yAxis,
sketchDetails.origin sketchDetails.origin
) )
if (err(updatedAst)) return Promise.reject(updatedAst)
const selection = updateSelections(
pathToNodeMap,
selectionRanges,
updatedAst.newAst
)
if (err(selection)) return Promise.reject(selection)
return { return {
selectionType: 'completeSelection', selectionType: 'completeSelection',
selection: pathMapToSelections( selection,
kclManager.ast,
selectionRanges,
pathToNodeMap
),
updatedPathToNode, updatedPathToNode,
} }
}, },
@ -770,48 +808,77 @@ export const ModelingMachineProvider = ({
selectionRanges, selectionRanges,
}) })
const _modifiedAst = parse(recast(modifiedAst)) const _modifiedAst = parse(recast(modifiedAst))
if (!sketchDetails) throw new Error('No sketch details') if (!sketchDetails)
return Promise.reject(new Error('No sketch details'))
const updatedPathToNode = updatePathToNodeFromMap( const updatedPathToNode = updatePathToNodeFromMap(
sketchDetails.sketchPathToNode, sketchDetails.sketchPathToNode,
pathToNodeMap pathToNodeMap
) )
await sceneEntitiesManager.updateAstAndRejigSketch( const updatedAst = await sceneEntitiesManager.updateAstAndRejigSketch(
updatedPathToNode, updatedPathToNode,
_modifiedAst, _modifiedAst,
sketchDetails.zAxis, sketchDetails.zAxis,
sketchDetails.yAxis, sketchDetails.yAxis,
sketchDetails.origin sketchDetails.origin
) )
if (err(updatedAst)) return Promise.reject(updatedAst)
const selection = updateSelections(
pathToNodeMap,
selectionRanges,
updatedAst.newAst
)
if (err(selection)) return Promise.reject(selection)
return { return {
selectionType: 'completeSelection', selectionType: 'completeSelection',
selection: pathMapToSelections( selection,
kclManager.ast,
selectionRanges,
pathToNodeMap
),
updatedPathToNode, updatedPathToNode,
} }
}, },
'Get convert to variable info': async ({ sketchDetails }, { data }) => { 'Get convert to variable info': async (
if (!sketchDetails) return [] { sketchDetails, selectionRanges },
{ data }
): Promise<SetSelections> => {
if (!sketchDetails)
return Promise.reject(new Error('No sketch details'))
const { variableName } = await getVarNameModal({ const { variableName } = await getVarNameModal({
valueName: data.variableName || 'var', valueName: data.variableName || 'var',
}) })
let parsed = parse(recast(kclManager.ast))
if (trap(parsed)) return Promise.reject(parsed)
parsed = parsed as Program
const { modifiedAst: _modifiedAst, pathToReplacedNode } = const { modifiedAst: _modifiedAst, pathToReplacedNode } =
moveValueIntoNewVariablePath( moveValueIntoNewVariablePath(
parse(recast(kclManager.ast)), parsed,
kclManager.programMemory, kclManager.programMemory,
data.pathToNode, data.pathToNode,
variableName variableName
) )
await sceneEntitiesManager.updateAstAndRejigSketch( parsed = parse(recast(_modifiedAst))
if (trap(parsed)) return Promise.reject(parsed)
parsed = parsed as Program
if (!pathToReplacedNode)
return Promise.reject(new Error('No path to replaced node'))
const updatedAst = await sceneEntitiesManager.updateAstAndRejigSketch(
pathToReplacedNode || [], pathToReplacedNode || [],
parse(recast(_modifiedAst)), parsed,
sketchDetails.zAxis, sketchDetails.zAxis,
sketchDetails.yAxis, sketchDetails.yAxis,
sketchDetails.origin sketchDetails.origin
) )
return pathToReplacedNode || sketchDetails.sketchPathToNode if (err(updatedAst)) return Promise.reject(updatedAst)
const selection = updateSelections(
{ 0: pathToReplacedNode },
selectionRanges,
updatedAst.newAst
)
if (err(selection)) return Promise.reject(selection)
return {
selectionType: 'completeSelection',
selection,
updatedPathToNode: pathToReplacedNode,
}
}, },
}, },
devTools: true, devTools: true,

View File

@ -43,23 +43,23 @@ describe('processMemory', () => {
theExtrude: [ theExtrude: [
{ {
type: 'extrudePlane', type: 'extrudePlane',
name: '', tag: null,
id: expect.any(String), id: expect.any(String),
faceId: expect.any(String), faceId: expect.any(String),
sourceRange: [170, 194], sourceRange: [170, 194],
}, },
{ {
type: 'extrudePlane', type: 'extrudePlane',
name: '', tag: null,
id: expect.any(String), id: expect.any(String),
faceId: expect.any(String), faceId: expect.any(String),
sourceRange: [202, 230], sourceRange: [202, 230],
}, },
], ],
theSketch: [ theSketch: [
{ type: 'ToPoint', to: [-3.35, 0.17], from: [0, 0], name: '' }, { type: 'ToPoint', to: [-3.35, 0.17], from: [0, 0], tag: null },
{ type: 'ToPoint', to: [0.98, 5.16], from: [-3.35, 0.17], name: '' }, { type: 'ToPoint', to: [0.98, 5.16], from: [-3.35, 0.17], tag: null },
{ type: 'ToPoint', to: [2.15, 4.32], from: [0.98, 5.16], name: '' }, { type: 'ToPoint', to: [2.15, 4.32], from: [0.98, 5.16], tag: null },
], ],
}) })
}) })

View File

@ -1,10 +1,11 @@
import toast from 'react-hot-toast'
import ReactJson from 'react-json-view' import ReactJson from 'react-json-view'
import { useMemo } from 'react' import { useMemo } from 'react'
import { ProgramMemory, Path, ExtrudeSurface } from 'lang/wasm' import { ProgramMemory, Path, ExtrudeSurface } from 'lang/wasm'
import { useKclContext } from 'lang/KclProvider' import { useKclContext } from 'lang/KclProvider'
import { useResolvedTheme } from 'hooks/useResolvedTheme' import { useResolvedTheme } from 'hooks/useResolvedTheme'
import { ActionButton } from 'components/ActionButton' import { ActionButton } from 'components/ActionButton'
import toast from 'react-hot-toast' import { trap } from 'lib/trap'
import Tooltip from 'components/Tooltip' import Tooltip from 'components/Tooltip'
import { useModelingContext } from 'hooks/useModelingContext' import { useModelingContext } from 'hooks/useModelingContext'
@ -13,12 +14,12 @@ export const MemoryPaneMenu = () => {
function copyProgramMemoryToClipboard() { function copyProgramMemoryToClipboard() {
if (globalThis && 'navigator' in globalThis) { if (globalThis && 'navigator' in globalThis) {
try { navigator.clipboard
navigator.clipboard.writeText(JSON.stringify(programMemory)) .writeText(JSON.stringify(programMemory))
toast.success('Program memory copied to clipboard') .then(() => toast.success('Program memory copied to clipboard'))
} catch (e) { .catch((e) =>
toast.error('Failed to copy program memory to clipboard') trap(new Error('Failed to copy program memory to clipboard'))
} )
} }
} }

View File

@ -10,28 +10,46 @@ import {
transformSecondarySketchLinesTagFirst, transformSecondarySketchLinesTagFirst,
getTransformInfos, getTransformInfos,
PathToNodeMap, PathToNodeMap,
TransformInfo,
} from '../../lang/std/sketchcombos' } from '../../lang/std/sketchcombos'
import { kclManager } from 'lib/singletons' import { kclManager } from 'lib/singletons'
import { err } from 'lib/trap'
export function equalAngleInfo({ export function equalAngleInfo({
selectionRanges, selectionRanges,
}: { }: {
selectionRanges: Selections selectionRanges: Selections
}) { }):
| {
transforms: TransformInfo[]
enabled: boolean
}
| Error {
const paths = selectionRanges.codeBasedSelections.map(({ range }) => const paths = selectionRanges.codeBasedSelections.map(({ range }) =>
getNodePathFromSourceRange(kclManager.ast, range) getNodePathFromSourceRange(kclManager.ast, range)
) )
const nodes = paths.map( const _nodes = paths.map((pathToNode) => {
(pathToNode) => getNodeFromPath<Value>(kclManager.ast, pathToNode).node const tmp = getNodeFromPath<Value>(kclManager.ast, pathToNode)
) if (err(tmp)) return tmp
const varDecs = paths.map( return tmp.node
(pathToNode) => })
getNodeFromPath<VariableDeclarator>( const _err1 = _nodes.find(err)
if (err(_err1)) return _err1
const nodes = _nodes as Value[]
const _varDecs = paths.map((pathToNode) => {
const tmp = getNodeFromPath<VariableDeclarator>(
kclManager.ast, kclManager.ast,
pathToNode, pathToNode,
'VariableDeclarator' 'VariableDeclarator'
)?.node
) )
if (err(tmp)) return tmp
return tmp.node
})
const _err2 = _varDecs.find(err)
if (err(_err2)) return _err2
const varDecs = _varDecs as VariableDeclarator[]
const primaryLine = varDecs[0] const primaryLine = varDecs[0]
const secondaryVarDecs = varDecs.slice(1) const secondaryVarDecs = varDecs.slice(1)
const isOthersLinkedToPrimary = secondaryVarDecs.every((secondary) => const isOthersLinkedToPrimary = secondaryVarDecs.every((secondary) =>
@ -51,6 +69,7 @@ export function equalAngleInfo({
kclManager.ast, kclManager.ast,
'equalAngle' 'equalAngle'
) )
if (err(transforms)) return transforms
const enabled = const enabled =
!!secondaryVarDecs.length && !!secondaryVarDecs.length &&
@ -64,16 +83,24 @@ export function applyConstraintEqualAngle({
selectionRanges, selectionRanges,
}: { }: {
selectionRanges: Selections selectionRanges: Selections
}): { }):
| {
modifiedAst: Program modifiedAst: Program
pathToNodeMap: PathToNodeMap pathToNodeMap: PathToNodeMap
} { }
const { transforms } = equalAngleInfo({ selectionRanges }) | Error {
const { modifiedAst, pathToNodeMap } = transformSecondarySketchLinesTagFirst({ const info = equalAngleInfo({ selectionRanges })
if (err(info)) return info
const { transforms } = info
const transform = transformSecondarySketchLinesTagFirst({
ast: kclManager.ast, ast: kclManager.ast,
selectionRanges, selectionRanges,
transformInfos: transforms, transformInfos: transforms,
programMemory: kclManager.programMemory, programMemory: kclManager.programMemory,
}) })
if (err(transform)) return transform
const { modifiedAst, pathToNodeMap } = transform
return { modifiedAst, pathToNodeMap } return { modifiedAst, pathToNodeMap }
} }

View File

@ -10,28 +10,46 @@ import {
transformSecondarySketchLinesTagFirst, transformSecondarySketchLinesTagFirst,
getTransformInfos, getTransformInfos,
PathToNodeMap, PathToNodeMap,
TransformInfo,
} from '../../lang/std/sketchcombos' } from '../../lang/std/sketchcombos'
import { kclManager } from 'lib/singletons' import { kclManager } from 'lib/singletons'
import { err } from 'lib/trap'
export function setEqualLengthInfo({ export function setEqualLengthInfo({
selectionRanges, selectionRanges,
}: { }: {
selectionRanges: Selections selectionRanges: Selections
}) { }):
| {
transforms: TransformInfo[]
enabled: boolean
}
| Error {
const paths = selectionRanges.codeBasedSelections.map(({ range }) => const paths = selectionRanges.codeBasedSelections.map(({ range }) =>
getNodePathFromSourceRange(kclManager.ast, range) getNodePathFromSourceRange(kclManager.ast, range)
) )
const nodes = paths.map( const _nodes = paths.map((pathToNode) => {
(pathToNode) => getNodeFromPath<Value>(kclManager.ast, pathToNode).node const tmp = getNodeFromPath<Value>(kclManager.ast, pathToNode)
) if (err(tmp)) return tmp
const varDecs = paths.map( return tmp.node
(pathToNode) => })
getNodeFromPath<VariableDeclarator>( const _err1 = _nodes.find(err)
if (err(_err1)) return _err1
const nodes = _nodes as Value[]
const _varDecs = paths.map((pathToNode) => {
const tmp = getNodeFromPath<VariableDeclarator>(
kclManager.ast, kclManager.ast,
pathToNode, pathToNode,
'VariableDeclarator' 'VariableDeclarator'
)?.node
) )
if (err(tmp)) return tmp
return tmp.node
})
const _err2 = _varDecs.find(err)
if (err(_err2)) return _err2
const varDecs = _varDecs as VariableDeclarator[]
const primaryLine = varDecs[0] const primaryLine = varDecs[0]
const secondaryVarDecs = varDecs.slice(1) const secondaryVarDecs = varDecs.slice(1)
const isOthersLinkedToPrimary = secondaryVarDecs.every((secondary) => const isOthersLinkedToPrimary = secondaryVarDecs.every((secondary) =>
@ -51,6 +69,7 @@ export function setEqualLengthInfo({
kclManager.ast, kclManager.ast,
'equalLength' 'equalLength'
) )
if (err(transforms)) return transforms
const enabled = const enabled =
!!secondaryVarDecs.length && !!secondaryVarDecs.length &&
@ -65,16 +84,24 @@ export function applyConstraintEqualLength({
selectionRanges, selectionRanges,
}: { }: {
selectionRanges: Selections selectionRanges: Selections
}): { }):
| {
modifiedAst: Program modifiedAst: Program
pathToNodeMap: PathToNodeMap pathToNodeMap: PathToNodeMap
} { }
const { transforms } = setEqualLengthInfo({ selectionRanges }) | Error {
const { modifiedAst, pathToNodeMap } = transformSecondarySketchLinesTagFirst({ const info = setEqualLengthInfo({ selectionRanges })
if (err(info)) return info
const { transforms } = info
const transform = transformSecondarySketchLinesTagFirst({
ast: kclManager.ast, ast: kclManager.ast,
selectionRanges, selectionRanges,
transformInfos: transforms, transformInfos: transforms,
programMemory: kclManager.programMemory, programMemory: kclManager.programMemory,
}) })
if (err(transform)) return transform
const { modifiedAst, pathToNodeMap } = transform
return { modifiedAst, pathToNodeMap } return { modifiedAst, pathToNodeMap }
} }

View File

@ -9,19 +9,32 @@ import {
PathToNodeMap, PathToNodeMap,
getTransformInfos, getTransformInfos,
transformAstSketchLines, transformAstSketchLines,
TransformInfo,
} from '../../lang/std/sketchcombos' } from '../../lang/std/sketchcombos'
import { kclManager } from 'lib/singletons' import { kclManager } from 'lib/singletons'
import { err } from 'lib/trap'
export function horzVertInfo( export function horzVertInfo(
selectionRanges: Selections, selectionRanges: Selections,
horOrVert: 'vertical' | 'horizontal' horOrVert: 'vertical' | 'horizontal'
) { ):
| {
transforms: TransformInfo[]
enabled: boolean
}
| Error {
const paths = selectionRanges.codeBasedSelections.map(({ range }) => const paths = selectionRanges.codeBasedSelections.map(({ range }) =>
getNodePathFromSourceRange(kclManager.ast, range) getNodePathFromSourceRange(kclManager.ast, range)
) )
const nodes = paths.map( const _nodes = paths.map((pathToNode) => {
(pathToNode) => getNodeFromPath<Value>(kclManager.ast, pathToNode).node const tmp = getNodeFromPath<Value>(kclManager.ast, pathToNode)
) if (err(tmp)) return tmp
return tmp.node
})
const _err1 = _nodes.find(err)
if (err(_err1)) return _err1
const nodes = _nodes as Value[]
const isAllTooltips = nodes.every( const isAllTooltips = nodes.every(
(node) => (node) =>
node?.type === 'CallExpression' && node?.type === 'CallExpression' &&
@ -33,6 +46,8 @@ export function horzVertInfo(
kclManager.ast, kclManager.ast,
horOrVert horOrVert
) )
if (err(theTransforms)) return theTransforms
const _enableHorz = isAllTooltips && theTransforms.every(Boolean) const _enableHorz = isAllTooltips && theTransforms.every(Boolean)
return { enabled: _enableHorz, transforms: theTransforms } return { enabled: _enableHorz, transforms: theTransforms }
} }
@ -42,11 +57,16 @@ export function applyConstraintHorzVert(
horOrVert: 'vertical' | 'horizontal', horOrVert: 'vertical' | 'horizontal',
ast: Program, ast: Program,
programMemory: ProgramMemory programMemory: ProgramMemory
): { ):
| {
modifiedAst: Program modifiedAst: Program
pathToNodeMap: PathToNodeMap pathToNodeMap: PathToNodeMap
} { }
const transformInfos = horzVertInfo(selectionRanges, horOrVert).transforms | Error {
const info = horzVertInfo(selectionRanges, horOrVert)
if (err(info)) return info
const transformInfos = info.transforms
return transformAstSketchLines({ return transformAstSketchLines({
ast, ast,
selectionRanges, selectionRanges,

View File

@ -11,11 +11,13 @@ import {
transformSecondarySketchLinesTagFirst, transformSecondarySketchLinesTagFirst,
getTransformInfos, getTransformInfos,
PathToNodeMap, PathToNodeMap,
TransformInfo,
} from '../../lang/std/sketchcombos' } from '../../lang/std/sketchcombos'
import { GetInfoModal, createInfoModal } from '../SetHorVertDistanceModal' import { GetInfoModal, createInfoModal } from '../SetHorVertDistanceModal'
import { createVariableDeclaration } from '../../lang/modifyAst' import { createVariableDeclaration } from '../../lang/modifyAst'
import { removeDoubleNegatives } from '../AvailableVarsHelpers' import { removeDoubleNegatives } from '../AvailableVarsHelpers'
import { kclManager } from 'lib/singletons' import { kclManager } from 'lib/singletons'
import { err } from 'lib/trap'
const getModalInfo = createInfoModal(GetInfoModal) const getModalInfo = createInfoModal(GetInfoModal)
@ -23,7 +25,13 @@ export function intersectInfo({
selectionRanges, selectionRanges,
}: { }: {
selectionRanges: Selections selectionRanges: Selections
}) { }):
| {
transforms: TransformInfo[]
enabled: boolean
forcedSelectionRanges: Selections
}
| Error {
if (selectionRanges.codeBasedSelections.length < 2) { if (selectionRanges.codeBasedSelections.length < 2) {
return { return {
enabled: false, enabled: false,
@ -40,6 +48,8 @@ export function intersectInfo({
selectionRanges.codeBasedSelections[0], selectionRanges.codeBasedSelections[0],
selectionRanges.codeBasedSelections[1] selectionRanges.codeBasedSelections[1]
) )
if (err(previousSegment)) return previousSegment
const shouldUsePreviousSegment = const shouldUsePreviousSegment =
selectionRanges.codeBasedSelections?.[1]?.type !== 'line-end' && selectionRanges.codeBasedSelections?.[1]?.type !== 'line-end' &&
previousSegment && previousSegment &&
@ -61,17 +71,28 @@ export function intersectInfo({
const paths = _forcedSelectionRanges.codeBasedSelections.map(({ range }) => const paths = _forcedSelectionRanges.codeBasedSelections.map(({ range }) =>
getNodePathFromSourceRange(kclManager.ast, range) getNodePathFromSourceRange(kclManager.ast, range)
) )
const nodes = paths.map( const _nodes = paths.map((pathToNode) => {
(pathToNode) => getNodeFromPath<Value>(kclManager.ast, pathToNode).node const tmp = getNodeFromPath<Value>(kclManager.ast, pathToNode)
) if (err(tmp)) return tmp
const varDecs = paths.map( return tmp.node
(pathToNode) => })
getNodeFromPath<VariableDeclarator>( const _err1 = _nodes.find(err)
if (err(_err1)) return _err1
const nodes = _nodes as Value[]
const _varDecs = paths.map((pathToNode) => {
const tmp = getNodeFromPath<VariableDeclarator>(
kclManager.ast, kclManager.ast,
pathToNode, pathToNode,
'VariableDeclarator' 'VariableDeclarator'
)?.node
) )
if (err(tmp)) return tmp
return tmp.node
})
const _err2 = _varDecs.find(err)
if (err(_err2)) return _err2
const varDecs = _varDecs as VariableDeclarator[]
const primaryLine = varDecs[0] const primaryLine = varDecs[0]
const secondaryVarDecs = varDecs.slice(1) const secondaryVarDecs = varDecs.slice(1)
const isOthersLinkedToPrimary = secondaryVarDecs.every((secondary) => const isOthersLinkedToPrimary = secondaryVarDecs.every((secondary) =>
@ -117,16 +138,22 @@ export async function applyConstraintIntersect({
modifiedAst: Program modifiedAst: Program
pathToNodeMap: PathToNodeMap pathToNodeMap: PathToNodeMap
}> { }> {
const { transforms, forcedSelectionRanges } = intersectInfo({ const info = intersectInfo({
selectionRanges, selectionRanges,
}) })
const { modifiedAst, tagInfo, valueUsedInTransform, pathToNodeMap } = if (err(info)) return Promise.reject(info)
transformSecondarySketchLinesTagFirst({ const { transforms, forcedSelectionRanges } = info
const transform1 = transformSecondarySketchLinesTagFirst({
ast: JSON.parse(JSON.stringify(kclManager.ast)), ast: JSON.parse(JSON.stringify(kclManager.ast)),
selectionRanges: forcedSelectionRanges, selectionRanges: forcedSelectionRanges,
transformInfos: transforms, transformInfos: transforms,
programMemory: kclManager.programMemory, programMemory: kclManager.programMemory,
}) })
if (err(transform1)) return Promise.reject(transform1)
const { modifiedAst, tagInfo, valueUsedInTransform, pathToNodeMap } =
transform1
const { const {
segName, segName,
value, value,
@ -156,8 +183,7 @@ export async function applyConstraintIntersect({
sign, sign,
variableName variableName
) )
const { modifiedAst: _modifiedAst, pathToNodeMap: _pathToNodeMap } = const transform2 = transformSecondarySketchLinesTagFirst({
transformSecondarySketchLinesTagFirst({
ast: kclManager.ast, ast: kclManager.ast,
selectionRanges: forcedSelectionRanges, selectionRanges: forcedSelectionRanges,
transformInfos: transforms, transformInfos: transforms,
@ -165,6 +191,10 @@ export async function applyConstraintIntersect({
forceSegName: segName, forceSegName: segName,
forceValueUsedInTransform: finalValue, forceValueUsedInTransform: finalValue,
}) })
if (err(transform2)) return Promise.reject(transform2)
const { modifiedAst: _modifiedAst, pathToNodeMap: _pathToNodeMap } =
transform2
if (variableName) { if (variableName) {
const newBody = [..._modifiedAst.body] const newBody = [..._modifiedAst.body]
newBody.splice( newBody.splice(

View File

@ -9,8 +9,10 @@ import {
PathToNodeMap, PathToNodeMap,
getRemoveConstraintsTransforms, getRemoveConstraintsTransforms,
transformAstSketchLines, transformAstSketchLines,
TransformInfo,
} from '../../lang/std/sketchcombos' } from '../../lang/std/sketchcombos'
import { kclManager } from 'lib/singletons' import { kclManager } from 'lib/singletons'
import { err } from 'lib/trap'
export function removeConstrainingValuesInfo({ export function removeConstrainingValuesInfo({
selectionRanges, selectionRanges,
@ -18,15 +20,27 @@ export function removeConstrainingValuesInfo({
}: { }: {
selectionRanges: Selections selectionRanges: Selections
pathToNodes?: Array<PathToNode> pathToNodes?: Array<PathToNode>
}) { }):
| {
transforms: TransformInfo[]
enabled: boolean
updatedSelectionRanges: Selections
}
| Error {
const paths = const paths =
pathToNodes || pathToNodes ||
selectionRanges.codeBasedSelections.map(({ range }) => selectionRanges.codeBasedSelections.map(({ range }) =>
getNodePathFromSourceRange(kclManager.ast, range) getNodePathFromSourceRange(kclManager.ast, range)
) )
const nodes = paths.map( const _nodes = paths.map((pathToNode) => {
(pathToNode) => getNodeFromPath<Value>(kclManager.ast, pathToNode).node const tmp = getNodeFromPath<Value>(kclManager.ast, pathToNode)
) if (err(tmp)) return tmp
return tmp.node
})
const _err1 = _nodes.find(err)
if (err(_err1)) return _err1
const nodes = _nodes as Value[]
const updatedSelectionRanges = pathToNodes const updatedSelectionRanges = pathToNodes
? { ? {
otherSelections: [], otherSelections: [],
@ -44,19 +58,15 @@ export function removeConstrainingValuesInfo({
toolTips.includes(node.callee.name as any) toolTips.includes(node.callee.name as any)
) )
try {
const transforms = getRemoveConstraintsTransforms( const transforms = getRemoveConstraintsTransforms(
updatedSelectionRanges, updatedSelectionRanges,
kclManager.ast, kclManager.ast,
'removeConstrainingValues' 'removeConstrainingValues'
) )
if (err(transforms)) return transforms
const enabled = isAllTooltips && transforms.every(Boolean) const enabled = isAllTooltips && transforms.every(Boolean)
return { enabled, transforms, updatedSelectionRanges } return { enabled, transforms, updatedSelectionRanges }
} catch (e) {
console.error(e)
return { enabled: false, transforms: [], updatedSelectionRanges }
}
} }
export function applyRemoveConstrainingValues({ export function applyRemoveConstrainingValues({
@ -65,14 +75,19 @@ export function applyRemoveConstrainingValues({
}: { }: {
selectionRanges: Selections selectionRanges: Selections
pathToNodes?: Array<PathToNode> pathToNodes?: Array<PathToNode>
}): { }):
| {
modifiedAst: Program modifiedAst: Program
pathToNodeMap: PathToNodeMap pathToNodeMap: PathToNodeMap
} { }
const { transforms, updatedSelectionRanges } = removeConstrainingValuesInfo({ | Error {
const constraint = removeConstrainingValuesInfo({
selectionRanges, selectionRanges,
pathToNodes, pathToNodes,
}) })
if (err(constraint)) return constraint
const { transforms, updatedSelectionRanges } = constraint
return transformAstSketchLines({ return transformAstSketchLines({
ast: kclManager.ast, ast: kclManager.ast,
selectionRanges: updatedSelectionRanges, selectionRanges: updatedSelectionRanges,

View File

@ -9,6 +9,7 @@ import {
getTransformInfos, getTransformInfos,
transformAstSketchLines, transformAstSketchLines,
PathToNodeMap, PathToNodeMap,
TransformInfo,
} from '../../lang/std/sketchcombos' } from '../../lang/std/sketchcombos'
import { import {
SetAngleLengthModal, SetAngleLengthModal,
@ -20,6 +21,7 @@ import {
} from '../../lang/modifyAst' } from '../../lang/modifyAst'
import { removeDoubleNegatives } from '../AvailableVarsHelpers' import { removeDoubleNegatives } from '../AvailableVarsHelpers'
import { kclManager } from 'lib/singletons' import { kclManager } from 'lib/singletons'
import { err } from 'lib/trap'
const getModalInfo = createSetAngleLengthModal(SetAngleLengthModal) const getModalInfo = createSetAngleLengthModal(SetAngleLengthModal)
@ -31,7 +33,12 @@ export function absDistanceInfo({
}: { }: {
selectionRanges: Selections selectionRanges: Selections
constraint: Constraint constraint: Constraint
}) { }):
| {
transforms: TransformInfo[]
enabled: boolean
}
| Error {
const disType = const disType =
constraint === 'xAbs' || constraint === 'yAbs' constraint === 'xAbs' || constraint === 'yAbs'
? constraint ? constraint
@ -41,10 +48,19 @@ export function absDistanceInfo({
const paths = selectionRanges.codeBasedSelections.map(({ range }) => const paths = selectionRanges.codeBasedSelections.map(({ range }) =>
getNodePathFromSourceRange(kclManager.ast, range) getNodePathFromSourceRange(kclManager.ast, range)
) )
const nodes = paths.map( const _nodes = paths.map((pathToNode) => {
(pathToNode) => const tmp = getNodeFromPath<Value>(
getNodeFromPath<Value>(kclManager.ast, pathToNode, 'CallExpression').node kclManager.ast,
pathToNode,
'CallExpression'
) )
if (err(tmp)) return tmp
return tmp.node
})
const _err1 = _nodes.find(err)
if (err(_err1)) return _err1
const nodes = _nodes as Value[]
const isAllTooltips = nodes.every( const isAllTooltips = nodes.every(
(node) => (node) =>
node?.type === 'CallExpression' && node?.type === 'CallExpression' &&
@ -52,6 +68,7 @@ export function absDistanceInfo({
) )
const transforms = getTransformInfos(selectionRanges, kclManager.ast, disType) const transforms = getTransformInfos(selectionRanges, kclManager.ast, disType)
if (err(transforms)) return transforms
const enableY = const enableY =
disType === 'yAbs' && disType === 'yAbs' &&
@ -81,17 +98,23 @@ export async function applyConstraintAbsDistance({
modifiedAst: Program modifiedAst: Program
pathToNodeMap: PathToNodeMap pathToNodeMap: PathToNodeMap
}> { }> {
const transformInfos = absDistanceInfo({ const info = absDistanceInfo({
selectionRanges, selectionRanges,
constraint, constraint,
}).transforms })
const { valueUsedInTransform } = transformAstSketchLines({ if (err(info)) return Promise.reject(info)
const transformInfos = info.transforms
const transform1 = transformAstSketchLines({
ast: JSON.parse(JSON.stringify(kclManager.ast)), ast: JSON.parse(JSON.stringify(kclManager.ast)),
selectionRanges: selectionRanges, selectionRanges: selectionRanges,
transformInfos, transformInfos,
programMemory: kclManager.programMemory, programMemory: kclManager.programMemory,
referenceSegName: '', referenceSegName: '',
}) })
if (err(transform1)) return Promise.reject(transform1)
const { valueUsedInTransform } = transform1
let forceVal = valueUsedInTransform || 0 let forceVal = valueUsedInTransform || 0
const { valueNode, variableName, newVariableInsertIndex, sign } = const { valueNode, variableName, newVariableInsertIndex, sign } =
await getModalInfo({ await getModalInfo({
@ -104,7 +127,7 @@ export async function applyConstraintAbsDistance({
variableName variableName
) )
const { modifiedAst: _modifiedAst, pathToNodeMap } = transformAstSketchLines({ const transform2 = transformAstSketchLines({
ast: JSON.parse(JSON.stringify(kclManager.ast)), ast: JSON.parse(JSON.stringify(kclManager.ast)),
selectionRanges: selectionRanges, selectionRanges: selectionRanges,
transformInfos, transformInfos,
@ -112,6 +135,9 @@ export async function applyConstraintAbsDistance({
referenceSegName: '', referenceSegName: '',
forceValueUsedInTransform: finalValue, forceValueUsedInTransform: finalValue,
}) })
if (err(transform2)) return Promise.reject(transform2)
const { modifiedAst: _modifiedAst, pathToNodeMap } = transform2
if (variableName) { if (variableName) {
const newBody = [..._modifiedAst.body] const newBody = [..._modifiedAst.body]
newBody.splice( newBody.splice(
@ -134,14 +160,18 @@ export function applyConstraintAxisAlign({
}: { }: {
selectionRanges: Selections selectionRanges: Selections
constraint: 'snapToYAxis' | 'snapToXAxis' constraint: 'snapToYAxis' | 'snapToXAxis'
}): { }):
| {
modifiedAst: Program modifiedAst: Program
pathToNodeMap: PathToNodeMap pathToNodeMap: PathToNodeMap
} { }
const transformInfos = absDistanceInfo({ | Error {
const info = absDistanceInfo({
selectionRanges, selectionRanges,
constraint, constraint,
}).transforms })
if (err(info)) return info
const transformInfos = info.transforms
let finalValue = createIdentifier('ZERO') let finalValue = createIdentifier('ZERO')

View File

@ -10,11 +10,13 @@ import {
transformSecondarySketchLinesTagFirst, transformSecondarySketchLinesTagFirst,
getTransformInfos, getTransformInfos,
PathToNodeMap, PathToNodeMap,
TransformInfo,
} from '../../lang/std/sketchcombos' } from '../../lang/std/sketchcombos'
import { GetInfoModal, createInfoModal } from '../SetHorVertDistanceModal' import { GetInfoModal, createInfoModal } from '../SetHorVertDistanceModal'
import { createVariableDeclaration } from '../../lang/modifyAst' import { createVariableDeclaration } from '../../lang/modifyAst'
import { removeDoubleNegatives } from '../AvailableVarsHelpers' import { removeDoubleNegatives } from '../AvailableVarsHelpers'
import { kclManager } from 'lib/singletons' import { kclManager } from 'lib/singletons'
import { err } from 'lib/trap'
const getModalInfo = createInfoModal(GetInfoModal) const getModalInfo = createInfoModal(GetInfoModal)
@ -22,22 +24,38 @@ export function angleBetweenInfo({
selectionRanges, selectionRanges,
}: { }: {
selectionRanges: Selections selectionRanges: Selections
}) { }):
| {
transforms: TransformInfo[]
enabled: boolean
}
| Error {
const paths = selectionRanges.codeBasedSelections.map(({ range }) => const paths = selectionRanges.codeBasedSelections.map(({ range }) =>
getNodePathFromSourceRange(kclManager.ast, range) getNodePathFromSourceRange(kclManager.ast, range)
) )
const nodes = paths.map( const _nodes = paths.map((pathToNode) => {
(pathToNode) => getNodeFromPath<Value>(kclManager.ast, pathToNode).node const tmp = getNodeFromPath<Value>(kclManager.ast, pathToNode)
) if (err(tmp)) return tmp
const varDecs = paths.map( return tmp.node
(pathToNode) => })
getNodeFromPath<VariableDeclarator>( const _err1 = _nodes.find(err)
if (err(_err1)) return _err1
const nodes = _nodes as Value[]
const _varDecs = paths.map((pathToNode) => {
const tmp = getNodeFromPath<VariableDeclarator>(
kclManager.ast, kclManager.ast,
pathToNode, pathToNode,
'VariableDeclarator' 'VariableDeclarator'
)?.node
) )
if (err(tmp)) return tmp
return tmp.node
})
const _err2 = _varDecs.find(err)
if (err(_err2)) return _err2
const varDecs = _varDecs as VariableDeclarator[]
const primaryLine = varDecs[0] const primaryLine = varDecs[0]
const secondaryVarDecs = varDecs.slice(1) const secondaryVarDecs = varDecs.slice(1)
const isOthersLinkedToPrimary = secondaryVarDecs.every((secondary) => const isOthersLinkedToPrimary = secondaryVarDecs.every((secondary) =>
@ -77,14 +95,20 @@ export async function applyConstraintAngleBetween({
modifiedAst: Program modifiedAst: Program
pathToNodeMap: PathToNodeMap pathToNodeMap: PathToNodeMap
}> { }> {
const transformInfos = angleBetweenInfo({ selectionRanges }).transforms const info = angleBetweenInfo({ selectionRanges })
const { modifiedAst, tagInfo, valueUsedInTransform, pathToNodeMap } = if (err(info)) return Promise.reject(info)
transformSecondarySketchLinesTagFirst({ const transformInfos = info.transforms
const transformed1 = transformSecondarySketchLinesTagFirst({
ast: JSON.parse(JSON.stringify(kclManager.ast)), ast: JSON.parse(JSON.stringify(kclManager.ast)),
selectionRanges, selectionRanges,
transformInfos, transformInfos,
programMemory: kclManager.programMemory, programMemory: kclManager.programMemory,
}) })
if (err(transformed1)) return Promise.reject(transformed1)
const { modifiedAst, tagInfo, valueUsedInTransform, pathToNodeMap } =
transformed1
const { const {
segName, segName,
value, value,
@ -115,8 +139,7 @@ export async function applyConstraintAngleBetween({
variableName variableName
) )
// transform again but forcing certain values // transform again but forcing certain values
const { modifiedAst: _modifiedAst, pathToNodeMap: _pathToNodeMap } = const transformed2 = transformSecondarySketchLinesTagFirst({
transformSecondarySketchLinesTagFirst({
ast: kclManager.ast, ast: kclManager.ast,
selectionRanges, selectionRanges,
transformInfos, transformInfos,
@ -124,6 +147,10 @@ export async function applyConstraintAngleBetween({
forceSegName: segName, forceSegName: segName,
forceValueUsedInTransform: finalValue, forceValueUsedInTransform: finalValue,
}) })
if (err(transformed2)) return Promise.reject(transformed2)
const { modifiedAst: _modifiedAst, pathToNodeMap: _pathToNodeMap } =
transformed2
if (variableName) { if (variableName) {
const newBody = [..._modifiedAst.body] const newBody = [..._modifiedAst.body]
newBody.splice( newBody.splice(

View File

@ -9,12 +9,14 @@ import {
transformSecondarySketchLinesTagFirst, transformSecondarySketchLinesTagFirst,
getTransformInfos, getTransformInfos,
PathToNodeMap, PathToNodeMap,
TransformInfo,
} from '../../lang/std/sketchcombos' } from '../../lang/std/sketchcombos'
import { GetInfoModal, createInfoModal } from '../SetHorVertDistanceModal' import { GetInfoModal, createInfoModal } from '../SetHorVertDistanceModal'
import { createLiteral, createVariableDeclaration } from '../../lang/modifyAst' import { createLiteral, createVariableDeclaration } from '../../lang/modifyAst'
import { removeDoubleNegatives } from '../AvailableVarsHelpers' import { removeDoubleNegatives } from '../AvailableVarsHelpers'
import { kclManager } from 'lib/singletons' import { kclManager } from 'lib/singletons'
import { Selections } from 'lib/selections' import { Selections } from 'lib/selections'
import { cleanErrs, err } from 'lib/trap'
const getModalInfo = createInfoModal(GetInfoModal) const getModalInfo = createInfoModal(GetInfoModal)
@ -24,21 +26,38 @@ export function horzVertDistanceInfo({
}: { }: {
selectionRanges: Selections selectionRanges: Selections
constraint: 'setHorzDistance' | 'setVertDistance' constraint: 'setHorzDistance' | 'setVertDistance'
}) { }):
| {
transforms: TransformInfo[]
enabled: boolean
}
| Error {
const paths = selectionRanges.codeBasedSelections.map(({ range }) => const paths = selectionRanges.codeBasedSelections.map(({ range }) =>
getNodePathFromSourceRange(kclManager.ast, range) getNodePathFromSourceRange(kclManager.ast, range)
) )
const nodes = paths.map( const _nodes = paths.map((pathToNode) => {
(pathToNode) => getNodeFromPath<Value>(kclManager.ast, pathToNode).node const tmp = getNodeFromPath<Value>(kclManager.ast, pathToNode)
) if (err(tmp)) return tmp
const varDecs = paths.map( return tmp.node
(pathToNode) => })
getNodeFromPath<VariableDeclarator>( const [hasErr, , nodesWErrs] = cleanErrs(_nodes)
if (hasErr) return nodesWErrs[0]
const nodes = _nodes as Value[]
const _varDecs = paths.map((pathToNode) => {
const tmp = getNodeFromPath<VariableDeclarator>(
kclManager.ast, kclManager.ast,
pathToNode, pathToNode,
'VariableDeclarator' 'VariableDeclarator'
)?.node
) )
if (err(tmp)) return tmp
return tmp.node
})
const _err2 = _varDecs.find(err)
if (err(_err2)) return _err2
const varDecs = _varDecs as VariableDeclarator[]
const primaryLine = varDecs[0] const primaryLine = varDecs[0]
const secondaryVarDecs = varDecs.slice(1) const secondaryVarDecs = varDecs.slice(1)
const isOthersLinkedToPrimary = secondaryVarDecs.every((secondary) => const isOthersLinkedToPrimary = secondaryVarDecs.every((secondary) =>
@ -82,17 +101,21 @@ export async function applyConstraintHorzVertDistance({
modifiedAst: Program modifiedAst: Program
pathToNodeMap: PathToNodeMap pathToNodeMap: PathToNodeMap
}> { }> {
const transformInfos = horzVertDistanceInfo({ const info = horzVertDistanceInfo({
selectionRanges, selectionRanges,
constraint, constraint,
}).transforms })
const { modifiedAst, tagInfo, valueUsedInTransform, pathToNodeMap } = if (err(info)) return Promise.reject(info)
transformSecondarySketchLinesTagFirst({ const transformInfos = info.transforms
const transformed = transformSecondarySketchLinesTagFirst({
ast: JSON.parse(JSON.stringify(kclManager.ast)), ast: JSON.parse(JSON.stringify(kclManager.ast)),
selectionRanges, selectionRanges,
transformInfos, transformInfos,
programMemory: kclManager.programMemory, programMemory: kclManager.programMemory,
}) })
if (err(transformed)) return Promise.reject(transformed)
const { modifiedAst, tagInfo, valueUsedInTransform, pathToNodeMap } =
transformed
const { const {
segName, segName,
value, value,
@ -120,8 +143,7 @@ export async function applyConstraintHorzVertDistance({
? createLiteral(0) ? createLiteral(0)
: removeDoubleNegatives(valueNode as BinaryPart, sign, variableName) : removeDoubleNegatives(valueNode as BinaryPart, sign, variableName)
// transform again but forcing certain values // transform again but forcing certain values
const { modifiedAst: _modifiedAst, pathToNodeMap } = const transformed = transformSecondarySketchLinesTagFirst({
transformSecondarySketchLinesTagFirst({
ast: kclManager.ast, ast: kclManager.ast,
selectionRanges, selectionRanges,
transformInfos, transformInfos,
@ -129,6 +151,9 @@ export async function applyConstraintHorzVertDistance({
forceSegName: segName, forceSegName: segName,
forceValueUsedInTransform: finalValue, forceValueUsedInTransform: finalValue,
}) })
if (err(transformed)) return Promise.reject(transformed)
const { modifiedAst: _modifiedAst, pathToNodeMap } = transformed
if (variableName) { if (variableName) {
const newBody = [..._modifiedAst.body] const newBody = [..._modifiedAst.body]
newBody.splice( newBody.splice(
@ -155,22 +180,28 @@ export function applyConstraintHorzVertAlign({
}: { }: {
selectionRanges: Selections selectionRanges: Selections
constraint: 'setHorzDistance' | 'setVertDistance' constraint: 'setHorzDistance' | 'setVertDistance'
}): { }):
| {
modifiedAst: Program modifiedAst: Program
pathToNodeMap: PathToNodeMap pathToNodeMap: PathToNodeMap
} { }
const transformInfos = horzVertDistanceInfo({ | Error {
const info = horzVertDistanceInfo({
selectionRanges, selectionRanges,
constraint, constraint,
}).transforms })
if (err(info)) return info
const transformInfos = info.transforms
let finalValue = createLiteral(0) let finalValue = createLiteral(0)
const { modifiedAst, pathToNodeMap } = transformSecondarySketchLinesTagFirst({ const retval = transformSecondarySketchLinesTagFirst({
ast: kclManager.ast, ast: kclManager.ast,
selectionRanges, selectionRanges,
transformInfos, transformInfos,
programMemory: kclManager.programMemory, programMemory: kclManager.programMemory,
forceValueUsedInTransform: finalValue, forceValueUsedInTransform: finalValue,
}) })
if (err(retval)) return retval
const { modifiedAst, pathToNodeMap } = retval
return { return {
modifiedAst: modifiedAst, modifiedAst: modifiedAst,
pathToNodeMap, pathToNodeMap,

View File

@ -9,6 +9,7 @@ import {
PathToNodeMap, PathToNodeMap,
getTransformInfos, getTransformInfos,
transformAstSketchLines, transformAstSketchLines,
TransformInfo,
} from '../../lang/std/sketchcombos' } from '../../lang/std/sketchcombos'
import { import {
SetAngleLengthModal, SetAngleLengthModal,
@ -22,6 +23,7 @@ import {
import { removeDoubleNegatives } from '../AvailableVarsHelpers' import { removeDoubleNegatives } from '../AvailableVarsHelpers'
import { normaliseAngle } from '../../lib/utils' import { normaliseAngle } from '../../lib/utils'
import { kclManager } from 'lib/singletons' import { kclManager } from 'lib/singletons'
import { err } from 'lib/trap'
const getModalInfo = createSetAngleLengthModal(SetAngleLengthModal) const getModalInfo = createSetAngleLengthModal(SetAngleLengthModal)
@ -31,19 +33,29 @@ export function angleLengthInfo({
}: { }: {
selectionRanges: Selections selectionRanges: Selections
angleOrLength?: 'setLength' | 'setAngle' angleOrLength?: 'setLength' | 'setAngle'
}) { }):
| {
transforms: TransformInfo[]
enabled: boolean
}
| Error {
const paths = selectionRanges.codeBasedSelections.map(({ range }) => const paths = selectionRanges.codeBasedSelections.map(({ range }) =>
getNodePathFromSourceRange(kclManager.ast, range) getNodePathFromSourceRange(kclManager.ast, range)
) )
const nodes = paths.map(
(pathToNode) => const nodes = paths.map((pathToNode) =>
getNodeFromPath<Value>(kclManager.ast, pathToNode, 'CallExpression').node getNodeFromPath<Value>(kclManager.ast, pathToNode, 'CallExpression')
) )
const isAllTooltips = nodes.every( const _err1 = nodes.find(err)
(node) => if (err(_err1)) return _err1
node?.type === 'CallExpression' &&
toolTips.includes(node.callee.name as any) const isAllTooltips = nodes.every((meta) => {
if (err(meta)) return false
return (
meta.node?.type === 'CallExpression' &&
toolTips.includes(meta.node.callee.name as any)
) )
})
const transforms = getTransformInfos( const transforms = getTransformInfos(
selectionRanges, selectionRanges,
@ -67,15 +79,20 @@ export async function applyConstraintAngleLength({
modifiedAst: Program modifiedAst: Program
pathToNodeMap: PathToNodeMap pathToNodeMap: PathToNodeMap
}> { }> {
const { transforms } = angleLengthInfo({ selectionRanges, angleOrLength }) const angleLength = angleLengthInfo({ selectionRanges, angleOrLength })
const { valueUsedInTransform } = transformAstSketchLines({ if (err(angleLength)) return Promise.reject(angleLength)
const { transforms } = angleLength
const sketched = transformAstSketchLines({
ast: JSON.parse(JSON.stringify(kclManager.ast)), ast: JSON.parse(JSON.stringify(kclManager.ast)),
selectionRanges, selectionRanges,
transformInfos: transforms, transformInfos: transforms,
programMemory: kclManager.programMemory, programMemory: kclManager.programMemory,
referenceSegName: '', referenceSegName: '',
}) })
try { if (err(sketched)) return Promise.reject(sketched)
const { valueUsedInTransform } = sketched
const isReferencingYAxis = const isReferencingYAxis =
selectionRanges.otherSelections.length === 1 && selectionRanges.otherSelections.length === 1 &&
selectionRanges.otherSelections[0] === 'y-axis' selectionRanges.otherSelections[0] === 'y-axis'
@ -121,8 +138,7 @@ export async function applyConstraintAngleLength({
finalValue = createBinaryExpressionWithUnary([calcIdentifier, finalValue]) finalValue = createBinaryExpressionWithUnary([calcIdentifier, finalValue])
} }
const { modifiedAst: _modifiedAst, pathToNodeMap } = const retval = transformAstSketchLines({
transformAstSketchLines({
ast: JSON.parse(JSON.stringify(kclManager.ast)), ast: JSON.parse(JSON.stringify(kclManager.ast)),
selectionRanges, selectionRanges,
transformInfos: transforms, transformInfos: transforms,
@ -130,6 +146,9 @@ export async function applyConstraintAngleLength({
referenceSegName: '', referenceSegName: '',
forceValueUsedInTransform: finalValue, forceValueUsedInTransform: finalValue,
}) })
if (err(retval)) return Promise.reject(retval)
const { modifiedAst: _modifiedAst, pathToNodeMap } = retval
if (variableName) { if (variableName) {
const newBody = [..._modifiedAst.body] const newBody = [..._modifiedAst.body]
newBody.splice( newBody.splice(
@ -147,8 +166,4 @@ export async function applyConstraintAngleLength({
modifiedAst: _modifiedAst, modifiedAst: _modifiedAst,
pathToNodeMap, pathToNodeMap,
} }
} catch (e) {
console.log('error', e)
throw e
}
} }

View File

@ -6,6 +6,7 @@ import {
unregisterServerCapability, unregisterServerCapability,
} from './server-capability-registration' } from './server-capability-registration'
import { Codec, FromServer, IntoServer } from './codec' import { Codec, FromServer, IntoServer } from './codec'
import { err } from 'lib/trap'
const client_capabilities: LSP.ClientCapabilities = { const client_capabilities: LSP.ClientCapabilities = {
textDocument: { textDocument: {
@ -119,10 +120,12 @@ export default class Client extends jsrpc.JSONRPCServerAndClient {
// Register a server capability. // Register a server capability.
params.registrations.forEach( params.registrations.forEach(
(capabilityRegistration: LSP.Registration) => { (capabilityRegistration: LSP.Registration) => {
this.serverCapabilities = registerServerCapability( const caps = registerServerCapability(
this.serverCapabilities, this.serverCapabilities,
capabilityRegistration capabilityRegistration
) )
if (err(caps)) return (this.serverCapabilities = {})
this.serverCapabilities = caps
} }
) )
}) })
@ -132,10 +135,12 @@ export default class Client extends jsrpc.JSONRPCServerAndClient {
// Unregister a server capability. // Unregister a server capability.
params.unregisterations.forEach( params.unregisterations.forEach(
(capabilityUnregistration: LSP.Unregistration) => { (capabilityUnregistration: LSP.Unregistration) => {
this.serverCapabilities = unregisterServerCapability( const caps = unregisterServerCapability(
this.serverCapabilities, this.serverCapabilities,
capabilityUnregistration capabilityUnregistration
) )
if (err(caps)) return (this.serverCapabilities = {})
this.serverCapabilities = caps
} }
) )
}) })

View File

@ -67,7 +67,13 @@ export interface FromServer extends WritableStream<Uint8Array> {
// eslint-disable-next-line @typescript-eslint/no-namespace // eslint-disable-next-line @typescript-eslint/no-namespace
export namespace FromServer { export namespace FromServer {
export function create(): FromServer { export function create(): FromServer | Error {
// Calls private method .start() which can throw.
// This is an odd one of the bunch but try/catch seems most suitable here.
try {
return new StreamDemuxer() return new StreamDemuxer()
} catch (e: any) {
return e
}
} }
} }

View File

@ -38,7 +38,9 @@ export default class StreamDemuxer extends Queue<Uint8Array> {
// try to parse the content-length from the headers // try to parse the content-length from the headers
const length = parseInt(match[1]) const length = parseInt(match[1])
if (isNaN(length)) throw new Error('invalid content length')
if (isNaN(length))
return Promise.reject(new Error('invalid content length'))
// slice the headers since we now have the content length // slice the headers since we now have the content length
buffer = buffer.slice(match[0].length) buffer = buffer.slice(match[0].length)

View File

@ -176,7 +176,7 @@ export class LanguageServerClient {
}, },
}) })
this.semanticTokens = deserializeTokens( this.semanticTokens = await deserializeTokens(
result.data, result.data,
this.getServerCapabilities().semanticTokensProvider this.getServerCapabilities().semanticTokensProvider
) )

View File

@ -22,16 +22,16 @@ export class SemanticToken {
} }
} }
export function deserializeTokens( export async function deserializeTokens(
data: number[], data: number[],
semanticTokensProvider?: LSP.SemanticTokensOptions semanticTokensProvider?: LSP.SemanticTokensOptions
): SemanticToken[] { ): Promise<SemanticToken[]> {
if (!semanticTokensProvider) { if (!semanticTokensProvider) {
return [] return []
} }
// Check if data length is divisible by 5 // Check if data length is divisible by 5
if (data.length % 5 !== 0) { if (data.length % 5 !== 0) {
throw new Error('Length is not divisible by 5') return Promise.reject(new Error('Length is not divisible by 5'))
} }
const tokens = [] const tokens = []

View File

@ -41,7 +41,7 @@ const ServerCapabilitiesProviders: IMethodServerCapabilityProviderDictionary = {
function registerServerCapability( function registerServerCapability(
serverCapabilities: ServerCapabilities, serverCapabilities: ServerCapabilities,
registration: Registration registration: Registration
): ServerCapabilities { ): ServerCapabilities | Error {
const serverCapabilitiesCopy = JSON.parse( const serverCapabilitiesCopy = JSON.parse(
JSON.stringify(serverCapabilities) JSON.stringify(serverCapabilities)
) as IFlexibleServerCapabilities ) as IFlexibleServerCapabilities
@ -58,7 +58,7 @@ function registerServerCapability(
) )
} }
} else { } else {
throw new Error('Could not register server capability.') return new Error('Could not register server capability.')
} }
return serverCapabilitiesCopy return serverCapabilitiesCopy

View File

@ -14,9 +14,10 @@ import {
CopilotWorkerOptions, CopilotWorkerOptions,
} from 'editor/plugins/lsp/types' } from 'editor/plugins/lsp/types'
import { EngineCommandManager } from 'lang/std/engineConnection' import { EngineCommandManager } from 'lang/std/engineConnection'
import { err } from 'lib/trap'
const intoServer: IntoServer = new IntoServer() const intoServer: IntoServer = new IntoServer()
const fromServer: FromServer = FromServer.create() const fromServer: FromServer | Error = FromServer.create()
// Initialise the wasm module. // Initialise the wasm module.
const initialise = async (wasmUrl: string) => { const initialise = async (wasmUrl: string) => {
@ -56,6 +57,7 @@ export async function kclLspRun(
} }
onmessage = function (event) { onmessage = function (event) {
if (err(fromServer)) return
const { worker, eventType, eventData }: LspWorkerEvent = event.data const { worker, eventType, eventData }: LspWorkerEvent = event.data
switch (eventType) { switch (eventType) {
@ -111,6 +113,7 @@ onmessage = function (event) {
} }
new Promise<void>(async (resolve) => { new Promise<void>(async (resolve) => {
if (err(fromServer)) return
for await (const requests of fromServer.requests) { for await (const requests of fromServer.requests) {
const encoded = Codec.encode(requests as jsrpc.JSONRPCRequest) const encoded = Codec.encode(requests as jsrpc.JSONRPCRequest)
postMessage(encoded) postMessage(encoded)
@ -118,6 +121,7 @@ new Promise<void>(async (resolve) => {
}) })
new Promise<void>(async (resolve) => { new Promise<void>(async (resolve) => {
if (err(fromServer)) return
for await (const notification of fromServer.notifications) { for await (const notification of fromServer.notifications) {
const encoded = Codec.encode(notification as jsrpc.JSONRPCRequest) const encoded = Codec.encode(notification as jsrpc.JSONRPCRequest)
postMessage(encoded) postMessage(encoded)

View File

@ -15,6 +15,8 @@ export function useRefreshSettings(routeId: string = paths.INDEX) {
const routeData = useRouteLoaderData(routeId) as typeof settings const routeData = useRouteLoaderData(routeId) as typeof settings
if (!ctx) { if (!ctx) {
// Intended to stop the world
// eslint-disable-next-line
throw new Error( throw new Error(
'useRefreshSettings must be used within a SettingsAuthProvider' 'useRefreshSettings must be used within a SettingsAuthProvider'
) )

View File

@ -3,6 +3,7 @@ import {
createSetVarNameModal, createSetVarNameModal,
} from 'components/SetVarNameModal' } from 'components/SetVarNameModal'
import { editorManager, kclManager } from 'lib/singletons' import { editorManager, kclManager } from 'lib/singletons'
import { trap } from 'lib/trap'
import { moveValueIntoNewVariable } from 'lang/modifyAst' import { moveValueIntoNewVariable } from 'lang/modifyAst'
import { isNodeSafeToReplace } from 'lang/queryAst' import { isNodeSafeToReplace } from 'lang/queryAst'
import { useEffect, useState } from 'react' import { useEffect, useState } from 'react'
@ -22,10 +23,16 @@ export function useConvertToVariable(range?: SourceRange) {
}, [enable]) }, [enable])
useEffect(() => { useEffect(() => {
const { isSafe, value } = isNodeSafeToReplace( const parsed = parse(recast(ast))
parse(recast(ast)), if (trap(parsed)) return
const meta = isNodeSafeToReplace(
parsed,
range || context.selectionRanges.codeBasedSelections?.[0]?.range || [] range || context.selectionRanges.codeBasedSelections?.[0]?.range || []
) )
if (trap(meta)) return
const { isSafe, value } = meta
const canReplace = isSafe && value.type !== 'Identifier' const canReplace = isSafe && value.type !== 'Identifier'
const isOnlyOneSelection = const isOnlyOneSelection =
!!range || context.selectionRanges.codeBasedSelections.length === 1 !!range || context.selectionRanges.codeBasedSelections.length === 1

View File

@ -3,6 +3,7 @@ import { Selections } from 'lib/selections'
import { KCLError, kclErrorsToDiagnostics } from './errors' import { KCLError, kclErrorsToDiagnostics } from './errors'
import { uuidv4 } from 'lib/utils' import { uuidv4 } from 'lib/utils'
import { EngineCommandManager } from './std/engineConnection' import { EngineCommandManager } from './std/engineConnection'
import { err } from 'lib/trap'
import { deferExecution } from 'lib/utils' import { deferExecution } from 'lib/utils'
import { import {
@ -161,19 +162,18 @@ export class KclManager {
} }
safeParse(code: string): Program | null { safeParse(code: string): Program | null {
try {
const ast = parse(code) const ast = parse(code)
this.kclErrors = [] this.kclErrors = []
return ast if (!err(ast)) return ast
} catch (e) { const kclerror: KCLError = ast as KCLError
console.error('error parsing code', e)
if (e instanceof KCLError) { console.error('error parsing code', kclerror)
this.kclErrors = [e] this.kclErrors = [kclerror]
if (e.msg === 'file is empty') this.engineCommandManager?.endSession() // TODO: re-eval if session should end?
} if (kclerror.msg === 'file is empty')
this.engineCommandManager?.endSession()
return null return null
} }
}
async ensureWasmInit() { async ensureWasmInit() {
try { try {
@ -256,6 +256,10 @@ export class KclManager {
await this.ensureWasmInit() await this.ensureWasmInit()
const newCode = recast(ast) const newCode = recast(ast)
if (err(newCode)) {
console.error(newCode)
return
}
const newAst = this.safeParse(newCode) const newAst = this.safeParse(newCode)
if (!newAst) return if (!newAst) return
codeManager.updateCodeEditor(newCode) codeManager.updateCodeEditor(newCode)
@ -281,11 +285,13 @@ export class KclManager {
Object.entries(this.engineCommandManager.artifactMap).forEach( Object.entries(this.engineCommandManager.artifactMap).forEach(
([commandId, artifact]) => { ([commandId, artifact]) => {
if (!artifact.pathToNode) return if (!artifact.pathToNode) return
const node = getNodeFromPath<CallExpression>( const _node1 = getNodeFromPath<CallExpression>(
this.ast, this.ast,
artifact.pathToNode, artifact.pathToNode,
'CallExpression' 'CallExpression'
).node )
if (err(_node1)) return
const { node } = _node1
if (node.type !== 'CallExpression') return if (node.type !== 'CallExpression') return
const [oldStart, oldEnd] = artifact.range const [oldStart, oldEnd] = artifact.range
if (oldStart === 0 && oldEnd === 0) return if (oldStart === 0 && oldEnd === 0) return
@ -322,6 +328,10 @@ export class KclManager {
return return
} }
const code = recast(ast) const code = recast(ast)
if (err(code)) {
console.error(code)
return
}
if (originalCode === code) return if (originalCode === code) return
// Update the code state and the editor. // Update the code state and the editor.
@ -339,19 +349,31 @@ export class KclManager {
optionalParams?: { optionalParams?: {
focusPath?: PathToNode focusPath?: PathToNode
} }
): Promise<Selections | null> { ): Promise<{
newAst: Program
selections?: Selections
}> {
const newCode = recast(ast) const newCode = recast(ast)
if (err(newCode)) return Promise.reject(newCode)
const astWithUpdatedSource = this.safeParse(newCode) const astWithUpdatedSource = this.safeParse(newCode)
if (!astWithUpdatedSource) return null if (!astWithUpdatedSource) return Promise.reject(new Error('bad ast'))
let returnVal: Selections | null = null let returnVal: Selections | undefined = undefined
if (optionalParams?.focusPath) { if (optionalParams?.focusPath) {
const { node } = getNodeFromPath<any>( const _node1 = getNodeFromPath<any>(
astWithUpdatedSource, astWithUpdatedSource,
optionalParams?.focusPath optionalParams?.focusPath
) )
if (err(_node1)) return Promise.reject(_node1)
const { node } = _node1
const { start, end } = node const { start, end } = node
if (!start || !end) return null if (!start || !end)
return {
selections: undefined,
newAst: astWithUpdatedSource,
}
returnVal = { returnVal = {
codeBasedSelections: [ codeBasedSelections: [
{ {
@ -377,7 +399,8 @@ export class KclManager {
// Execute ast mock will update the code state and editor. // Execute ast mock will update the code state and editor.
await this.executeAstMock(astWithUpdatedSource) await this.executeAstMock(astWithUpdatedSource)
} }
return returnVal
return { selections: returnVal, newAst: astWithUpdatedSource }
} }
get defaultPlanes() { get defaultPlanes() {

View File

@ -1,5 +1,6 @@
import { KCLError } from './errors' import { KCLError } from './errors'
import { initPromise, parse } from './wasm' import { initPromise, parse } from './wasm'
import { err } from 'lib/trap'
beforeAll(async () => { beforeAll(async () => {
await initPromise await initPromise
@ -8,6 +9,7 @@ beforeAll(async () => {
describe('testing AST', () => { describe('testing AST', () => {
test('5 + 6', () => { test('5 + 6', () => {
const result = parse('5 +6') const result = parse('5 +6')
if (err(result)) throw result
delete (result as any).nonCodeMeta delete (result as any).nonCodeMeta
expect(result.body).toEqual([ expect(result.body).toEqual([
{ {
@ -38,7 +40,9 @@ describe('testing AST', () => {
]) ])
}) })
test('const myVar = 5', () => { test('const myVar = 5', () => {
const { body } = parse('const myVar = 5') const ast = parse('const myVar = 5')
if (err(ast)) throw ast
const { body } = ast
expect(body).toEqual([ expect(body).toEqual([
{ {
type: 'VariableDeclaration', type: 'VariableDeclaration',
@ -72,7 +76,9 @@ describe('testing AST', () => {
const code = `const myVar = 5 const code = `const myVar = 5
const newVar = myVar + 1 const newVar = myVar + 1
` `
const { body } = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const { body } = ast
expect(body).toEqual([ expect(body).toEqual([
{ {
type: 'VariableDeclaration', type: 'VariableDeclaration',
@ -144,9 +150,11 @@ const newVar = myVar + 1
describe('testing function declaration', () => { describe('testing function declaration', () => {
test('fn funcN = (a, b) => {return a + b}', () => { test('fn funcN = (a, b) => {return a + b}', () => {
const { body } = parse( const ast = parse(
['fn funcN = (a, b) => {', ' return a + b', '}'].join('\n') ['fn funcN = (a, b) => {', ' return a + b', '}'].join('\n')
) )
if (err(ast)) throw ast
const { body } = ast
delete (body[0] as any).declarations[0].init.body.nonCodeMeta delete (body[0] as any).declarations[0].init.body.nonCodeMeta
expect(body).toEqual([ expect(body).toEqual([
{ {
@ -229,7 +237,9 @@ describe('testing function declaration', () => {
test('call expression assignment', () => { test('call expression assignment', () => {
const code = `fn funcN = (a, b) => { return a + b } const code = `fn funcN = (a, b) => { return a + b }
const myVar = funcN(1, 2)` const myVar = funcN(1, 2)`
const { body } = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const { body } = ast
delete (body[0] as any).declarations[0].init.body.nonCodeMeta delete (body[0] as any).declarations[0].init.body.nonCodeMeta
expect(body).toEqual([ expect(body).toEqual([
{ {
@ -366,7 +376,9 @@ describe('testing pipe operator special', () => {
|> lineTo([1, 1], %) |> lineTo([1, 1], %)
|> rx(45, %) |> rx(45, %)
` `
const { body } = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const { body } = ast
delete (body[0] as any).declarations[0].init.nonCodeMeta delete (body[0] as any).declarations[0].init.nonCodeMeta
expect(body).toEqual([ expect(body).toEqual([
{ {
@ -566,7 +578,9 @@ describe('testing pipe operator special', () => {
}) })
test('pipe operator with binary expression', () => { test('pipe operator with binary expression', () => {
let code = `const myVar = 5 + 6 |> myFunc(45, %)` let code = `const myVar = 5 + 6 |> myFunc(45, %)`
const { body } = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const { body } = ast
delete (body as any)[0].declarations[0].init.nonCodeMeta delete (body as any)[0].declarations[0].init.nonCodeMeta
expect(body).toEqual([ expect(body).toEqual([
{ {
@ -645,7 +659,9 @@ describe('testing pipe operator special', () => {
}) })
test('array expression', () => { test('array expression', () => {
let code = `const yo = [1, '2', three, 4 + 5]` let code = `const yo = [1, '2', three, 4 + 5]`
const { body } = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const { body } = ast
expect(body).toEqual([ expect(body).toEqual([
{ {
type: 'VariableDeclaration', type: 'VariableDeclaration',
@ -720,7 +736,9 @@ describe('testing pipe operator special', () => {
'const three = 3', 'const three = 3',
"const yo = {aStr: 'str', anum: 2, identifier: three, binExp: 4 + 5}", "const yo = {aStr: 'str', anum: 2, identifier: three, binExp: 4 + 5}",
].join('\n') ].join('\n')
const { body } = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const { body } = ast
expect(body).toEqual([ expect(body).toEqual([
{ {
type: 'VariableDeclaration', type: 'VariableDeclaration',
@ -864,7 +882,9 @@ describe('testing pipe operator special', () => {
const code = `const yo = {key: { const code = `const yo = {key: {
key2: 'value' key2: 'value'
}}` }}`
const { body } = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const { body } = ast
expect(body).toEqual([ expect(body).toEqual([
{ {
type: 'VariableDeclaration', type: 'VariableDeclaration',
@ -932,7 +952,9 @@ describe('testing pipe operator special', () => {
}) })
test('object expression with array ast', () => { test('object expression with array ast', () => {
const code = `const yo = {key: [1, '2']}` const code = `const yo = {key: [1, '2']}`
const { body } = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const { body } = ast
expect(body).toEqual([ expect(body).toEqual([
{ {
type: 'VariableDeclaration', type: 'VariableDeclaration',
@ -996,7 +1018,9 @@ describe('testing pipe operator special', () => {
}) })
test('object memberExpression simple', () => { test('object memberExpression simple', () => {
const code = `const prop = yo.one.two` const code = `const prop = yo.one.two`
const { body } = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const { body } = ast
expect(body).toEqual([ expect(body).toEqual([
{ {
type: 'VariableDeclaration', type: 'VariableDeclaration',
@ -1051,7 +1075,9 @@ describe('testing pipe operator special', () => {
}) })
test('object memberExpression with square braces', () => { test('object memberExpression with square braces', () => {
const code = `const prop = yo.one["two"]` const code = `const prop = yo.one["two"]`
const { body } = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const { body } = ast
expect(body).toEqual([ expect(body).toEqual([
{ {
type: 'VariableDeclaration', type: 'VariableDeclaration',
@ -1107,7 +1133,9 @@ describe('testing pipe operator special', () => {
}) })
test('object memberExpression with two square braces literal and identifier', () => { test('object memberExpression with two square braces literal and identifier', () => {
const code = `const prop = yo["one"][two]` const code = `const prop = yo["one"][two]`
const { body } = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const { body } = ast
expect(body).toEqual([ expect(body).toEqual([
{ {
type: 'VariableDeclaration', type: 'VariableDeclaration',
@ -1166,7 +1194,9 @@ describe('testing pipe operator special', () => {
describe('nests binary expressions correctly', () => { describe('nests binary expressions correctly', () => {
it('works with the simple case', () => { it('works with the simple case', () => {
const code = `const yo = 1 + 2` const code = `const yo = 1 + 2`
const { body } = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const { body } = ast
expect(body[0]).toEqual({ expect(body[0]).toEqual({
type: 'VariableDeclaration', type: 'VariableDeclaration',
start: 0, start: 0,
@ -1210,7 +1240,9 @@ describe('nests binary expressions correctly', () => {
it('should nest according to precedence with multiply first', () => { it('should nest according to precedence with multiply first', () => {
// should be binExp { binExp { lit-1 * lit-2 } + lit} // should be binExp { binExp { lit-1 * lit-2 } + lit}
const code = `const yo = 1 * 2 + 3` const code = `const yo = 1 * 2 + 3`
const { body } = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const { body } = ast
expect(body[0]).toEqual({ expect(body[0]).toEqual({
type: 'VariableDeclaration', type: 'VariableDeclaration',
start: 0, start: 0,
@ -1267,7 +1299,9 @@ describe('nests binary expressions correctly', () => {
it('should nest according to precedence with sum first', () => { it('should nest according to precedence with sum first', () => {
// should be binExp { lit-1 + binExp { lit-2 * lit-3 } } // should be binExp { lit-1 + binExp { lit-2 * lit-3 } }
const code = `const yo = 1 + 2 * 3` const code = `const yo = 1 + 2 * 3`
const { body } = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const { body } = ast
expect(body[0]).toEqual({ expect(body[0]).toEqual({
type: 'VariableDeclaration', type: 'VariableDeclaration',
start: 0, start: 0,
@ -1323,7 +1357,9 @@ describe('nests binary expressions correctly', () => {
}) })
it('should nest properly with two operators of equal precedence', () => { it('should nest properly with two operators of equal precedence', () => {
const code = `const yo = 1 + 2 - 3` const code = `const yo = 1 + 2 - 3`
const { body } = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const { body } = ast
expect((body[0] as any).declarations[0].init).toEqual({ expect((body[0] as any).declarations[0].init).toEqual({
type: 'BinaryExpression', type: 'BinaryExpression',
start: 11, start: 11,
@ -1360,7 +1396,9 @@ describe('nests binary expressions correctly', () => {
}) })
it('should nest properly with two operators of equal (but higher) precedence', () => { it('should nest properly with two operators of equal (but higher) precedence', () => {
const code = `const yo = 1 * 2 / 3` const code = `const yo = 1 * 2 / 3`
const { body } = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const { body } = ast
expect((body[0] as any).declarations[0].init).toEqual({ expect((body[0] as any).declarations[0].init).toEqual({
type: 'BinaryExpression', type: 'BinaryExpression',
start: 11, start: 11,
@ -1397,7 +1435,9 @@ describe('nests binary expressions correctly', () => {
}) })
it('should nest properly with longer example', () => { it('should nest properly with longer example', () => {
const code = `const yo = 1 + 2 * (3 - 4) / 5 + 6` const code = `const yo = 1 + 2 * (3 - 4) / 5 + 6`
const { body } = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const { body } = ast
const init = (body[0] as any).declarations[0].init const init = (body[0] as any).declarations[0].init
expect(init).toEqual({ expect(init).toEqual({
type: 'BinaryExpression', type: 'BinaryExpression',
@ -1460,12 +1500,16 @@ const key = 'c'`
value: 'this is a comment', value: 'this is a comment',
}, },
} }
const { nonCodeMeta } = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const { nonCodeMeta } = ast
expect(nonCodeMeta.nonCodeNodes[0][0]).toEqual(nonCodeMetaInstance) expect(nonCodeMeta.nonCodeNodes[0][0]).toEqual(nonCodeMetaInstance)
// extra whitespace won't change it's position (0) or value (NB the start end would have changed though) // extra whitespace won't change it's position (0) or value (NB the start end would have changed though)
const codeWithExtraStartWhitespace = '\n\n\n' + code const codeWithExtraStartWhitespace = '\n\n\n' + code
const { nonCodeMeta: nonCodeMeta2 } = parse(codeWithExtraStartWhitespace) const ast2 = parse(codeWithExtraStartWhitespace)
if (err(ast2)) throw ast2
const { nonCodeMeta: nonCodeMeta2 } = ast2
expect(nonCodeMeta2.nonCodeNodes[0][0].value).toStrictEqual( expect(nonCodeMeta2.nonCodeNodes[0][0].value).toStrictEqual(
nonCodeMetaInstance.value nonCodeMetaInstance.value
) )
@ -1483,7 +1527,9 @@ const key = 'c'`
|> close(%) |> close(%)
` `
const { body } = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const { body } = ast
const indexOfSecondLineToExpression = 2 const indexOfSecondLineToExpression = 2
const sketchNonCodeMeta = (body as any)[0].declarations[0].init.nonCodeMeta const sketchNonCodeMeta = (body as any)[0].declarations[0].init.nonCodeMeta
.nonCodeNodes .nonCodeNodes
@ -1508,7 +1554,9 @@ const key = 'c'`
' |> rx(90, %)', ' |> rx(90, %)',
].join('\n') ].join('\n')
const { body } = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const { body } = ast
const sketchNonCodeMeta = (body[0] as any).declarations[0].init.nonCodeMeta const sketchNonCodeMeta = (body[0] as any).declarations[0].init.nonCodeMeta
.nonCodeNodes[3][0] .nonCodeNodes[3][0]
expect(sketchNonCodeMeta).toEqual({ expect(sketchNonCodeMeta).toEqual({
@ -1527,7 +1575,9 @@ const key = 'c'`
describe('test UnaryExpression', () => { describe('test UnaryExpression', () => {
it('should parse a unary expression in simple var dec situation', () => { it('should parse a unary expression in simple var dec situation', () => {
const code = `const myVar = -min(4, 100)` const code = `const myVar = -min(4, 100)`
const { body } = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const { body } = ast
const myVarInit = (body?.[0] as any).declarations[0]?.init const myVarInit = (body?.[0] as any).declarations[0]?.init
expect(myVarInit).toEqual({ expect(myVarInit).toEqual({
type: 'UnaryExpression', type: 'UnaryExpression',
@ -1552,7 +1602,9 @@ describe('test UnaryExpression', () => {
describe('testing nested call expressions', () => { describe('testing nested call expressions', () => {
it('callExp in a binExp in a callExp', () => { it('callExp in a binExp in a callExp', () => {
const code = 'const myVar = min(100, 1 + legLen(5, 3))' const code = 'const myVar = min(100, 1 + legLen(5, 3))'
const { body } = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const { body } = ast
const myVarInit = (body?.[0] as any).declarations[0]?.init const myVarInit = (body?.[0] as any).declarations[0]?.init
expect(myVarInit).toEqual({ expect(myVarInit).toEqual({
type: 'CallExpression', type: 'CallExpression',
@ -1588,7 +1640,9 @@ describe('testing nested call expressions', () => {
describe('should recognise callExpresions in binaryExpressions', () => { describe('should recognise callExpresions in binaryExpressions', () => {
const code = "xLineTo(segEndX('seg02', %) + 1, %)" const code = "xLineTo(segEndX('seg02', %) + 1, %)"
it('should recognise the callExp', () => { it('should recognise the callExp', () => {
const { body } = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const { body } = ast
const callExpArgs = (body?.[0] as any).expression?.arguments const callExpArgs = (body?.[0] as any).expression?.arguments
expect(callExpArgs).toEqual([ expect(callExpArgs).toEqual([
{ {
@ -1623,16 +1677,12 @@ describe('should recognise callExpresions in binaryExpressions', () => {
describe('parsing errors', () => { describe('parsing errors', () => {
it('should return an error when there is a unexpected closed curly brace', async () => { it('should return an error when there is a unexpected closed curly brace', async () => {
const code = `const myVar = startSketchAt([}], %)` const code = `const myVar = startSketchAt([}], %)`
const result = parse(code)
let _theError expect(result).toBeInstanceOf(KCLError)
try { const error = result as KCLError
let _ = expect(parse(code)) expect(error.kind).toBe('syntax')
} catch (e) { expect(error.msg).toBe('Unexpected token')
_theError = e expect(error.sourceRanges).toEqual([[27, 28]])
}
const theError = _theError as any
expect(theError).toEqual(
new KCLError('syntax', 'Unexpected token', [[27, 28]])
)
}) })
}) })

View File

@ -23,7 +23,7 @@ const mySketch001 = startSketchOn('XY')
start: { start: {
to: [0, 0], to: [0, 0],
from: [0, 0], from: [0, 0],
name: '', tag: null,
__geoMeta: { __geoMeta: {
id: expect.any(String), id: expect.any(String),
sourceRange: [46, 71], sourceRange: [46, 71],
@ -32,7 +32,7 @@ const mySketch001 = startSketchOn('XY')
value: [ value: [
{ {
type: 'ToPoint', type: 'ToPoint',
name: '', tag: null,
to: [-1.59, -1.54], to: [-1.59, -1.54],
from: [0, 0], from: [0, 0],
__geoMeta: { __geoMeta: {
@ -44,7 +44,7 @@ const mySketch001 = startSketchOn('XY')
type: 'ToPoint', type: 'ToPoint',
to: [0.46, -5.82], to: [0.46, -5.82],
from: [-1.59, -1.54], from: [-1.59, -1.54],
name: '', tag: null,
__geoMeta: { __geoMeta: {
sourceRange: [108, 132], sourceRange: [108, 132],
id: expect.any(String), id: expect.any(String),
@ -74,14 +74,14 @@ const mySketch001 = startSketchOn('XY')
{ {
type: 'extrudePlane', type: 'extrudePlane',
faceId: expect.any(String), faceId: expect.any(String),
name: '', tag: null,
id: expect.any(String), id: expect.any(String),
sourceRange: [77, 102], sourceRange: [77, 102],
}, },
{ {
type: 'extrudePlane', type: 'extrudePlane',
faceId: expect.any(String), faceId: expect.any(String),
name: '', tag: null,
id: expect.any(String), id: expect.any(String),
sourceRange: [108, 132], sourceRange: [108, 132],
}, },
@ -97,7 +97,7 @@ const mySketch001 = startSketchOn('XY')
type: 'ToPoint', type: 'ToPoint',
from: [0, 0], from: [0, 0],
to: [-1.59, -1.54], to: [-1.59, -1.54],
name: '', tag: null,
__geoMeta: { __geoMeta: {
id: expect.any(String), id: expect.any(String),
sourceRange: [77, 102], sourceRange: [77, 102],
@ -107,7 +107,7 @@ const mySketch001 = startSketchOn('XY')
type: 'ToPoint', type: 'ToPoint',
from: [-1.59, -1.54], from: [-1.59, -1.54],
to: [0.46, -5.82], to: [0.46, -5.82],
name: '', tag: null,
__geoMeta: { __geoMeta: {
id: expect.any(String), id: expect.any(String),
sourceRange: [108, 132], sourceRange: [108, 132],
@ -155,21 +155,26 @@ const sk2 = startSketchOn('XY')
{ {
type: 'extrudePlane', type: 'extrudePlane',
faceId: expect.any(String), faceId: expect.any(String),
name: '', tag: null,
id: expect.any(String), id: expect.any(String),
sourceRange: [69, 89], sourceRange: [69, 89],
}, },
{ {
type: 'extrudePlane', type: 'extrudePlane',
faceId: expect.any(String), faceId: expect.any(String),
name: 'p', tag: {
end: 117,
start: 114,
type: 'TagDeclarator',
value: 'p',
},
id: expect.any(String), id: expect.any(String),
sourceRange: [95, 118], sourceRange: [95, 118],
}, },
{ {
type: 'extrudePlane', type: 'extrudePlane',
faceId: expect.any(String), faceId: expect.any(String),
name: '', tag: null,
id: expect.any(String), id: expect.any(String),
sourceRange: [124, 143], sourceRange: [124, 143],
}, },
@ -185,7 +190,7 @@ const sk2 = startSketchOn('XY')
type: 'ToPoint', type: 'ToPoint',
from: [0, 0], from: [0, 0],
to: [-2.5, 0], to: [-2.5, 0],
name: '', tag: null,
__geoMeta: { __geoMeta: {
id: expect.any(String), id: expect.any(String),
sourceRange: [69, 89], sourceRange: [69, 89],
@ -195,7 +200,12 @@ const sk2 = startSketchOn('XY')
type: 'ToPoint', type: 'ToPoint',
from: [-2.5, 0], from: [-2.5, 0],
to: [0, 10], to: [0, 10],
name: 'p', tag: {
end: 117,
start: 114,
type: 'TagDeclarator',
value: 'p',
},
__geoMeta: { __geoMeta: {
id: expect.any(String), id: expect.any(String),
sourceRange: [95, 118], sourceRange: [95, 118],
@ -205,7 +215,7 @@ const sk2 = startSketchOn('XY')
type: 'ToPoint', type: 'ToPoint',
from: [0, 10], from: [0, 10],
to: [2.5, 0], to: [2.5, 0],
name: '', tag: null,
__geoMeta: { __geoMeta: {
id: expect.any(String), id: expect.any(String),
sourceRange: [124, 143], sourceRange: [124, 143],
@ -225,21 +235,26 @@ const sk2 = startSketchOn('XY')
{ {
type: 'extrudePlane', type: 'extrudePlane',
faceId: expect.any(String), faceId: expect.any(String),
name: '', tag: null,
id: expect.any(String), id: expect.any(String),
sourceRange: [374, 394], sourceRange: [374, 394],
}, },
{ {
type: 'extrudePlane', type: 'extrudePlane',
faceId: expect.any(String), faceId: expect.any(String),
name: 'p', tag: {
end: 421,
start: 418,
type: 'TagDeclarator',
value: 'p',
},
id: expect.any(String), id: expect.any(String),
sourceRange: [400, 422], sourceRange: [400, 422],
}, },
{ {
type: 'extrudePlane', type: 'extrudePlane',
faceId: expect.any(String), faceId: expect.any(String),
name: '', tag: null,
id: expect.any(String), id: expect.any(String),
sourceRange: [428, 447], sourceRange: [428, 447],
}, },
@ -255,7 +270,7 @@ const sk2 = startSketchOn('XY')
type: 'ToPoint', type: 'ToPoint',
from: [0, 0], from: [0, 0],
to: [-2.5, 0], to: [-2.5, 0],
name: '', tag: null,
__geoMeta: { __geoMeta: {
id: expect.any(String), id: expect.any(String),
sourceRange: [374, 394], sourceRange: [374, 394],
@ -265,7 +280,12 @@ const sk2 = startSketchOn('XY')
type: 'ToPoint', type: 'ToPoint',
from: [-2.5, 0], from: [-2.5, 0],
to: [0, 3], to: [0, 3],
name: 'p', tag: {
end: 421,
start: 418,
type: 'TagDeclarator',
value: 'p',
},
__geoMeta: { __geoMeta: {
id: expect.any(String), id: expect.any(String),
sourceRange: [400, 422], sourceRange: [400, 422],
@ -275,7 +295,7 @@ const sk2 = startSketchOn('XY')
type: 'ToPoint', type: 'ToPoint',
from: [0, 3], from: [0, 3],
to: [2.5, 0], to: [2.5, 0],
name: '', tag: null,
__geoMeta: { __geoMeta: {
id: expect.any(String), id: expect.any(String),
sourceRange: [428, 447], sourceRange: [428, 447],

View File

@ -4,6 +4,8 @@ describe('test kclErrToDiagnostic', () => {
it('converts KCL errors to CodeMirror diagnostics', () => { it('converts KCL errors to CodeMirror diagnostics', () => {
const errors: KCLError[] = [ const errors: KCLError[] = [
{ {
name: '',
message: '',
kind: 'semantic', kind: 'semantic',
msg: 'Semantic error', msg: 'Semantic error',
sourceRanges: [ sourceRanges: [
@ -12,6 +14,8 @@ describe('test kclErrToDiagnostic', () => {
], ],
}, },
{ {
name: '',
message: '',
kind: 'type', kind: 'type',
msg: 'Type error', msg: 'Type error',
sourceRanges: [ sourceRanges: [

View File

@ -5,7 +5,7 @@ import { Diagnostic as LspDiagnostic } from 'vscode-languageserver-protocol'
import { Text } from '@codemirror/state' import { Text } from '@codemirror/state'
type ExtractKind<T> = T extends { kind: infer K } ? K : never type ExtractKind<T> = T extends { kind: infer K } ? K : never
export class KCLError { export class KCLError extends Error {
kind: ExtractKind<RustKclError> | 'name' kind: ExtractKind<RustKclError> | 'name'
sourceRanges: [number, number][] sourceRanges: [number, number][]
msg: string msg: string
@ -14,6 +14,7 @@ export class KCLError {
msg: string, msg: string,
sourceRanges: [number, number][] sourceRanges: [number, number][]
) { ) {
super()
this.kind = kind this.kind = kind
this.msg = msg this.msg = msg
this.sourceRanges = sourceRanges this.sourceRanges = sourceRanges

View File

@ -62,13 +62,18 @@ const newVar = myVar + 1`
sourceRange: [72, 98], sourceRange: [72, 98],
id: expect.any(String), id: expect.any(String),
}, },
name: 'myPath', tag: {
end: 97,
start: 89,
type: 'TagDeclarator',
value: 'myPath',
},
}, },
{ {
type: 'ToPoint', type: 'ToPoint',
to: [2, 3], to: [2, 3],
from: [0, 2], from: [0, 2],
name: '', tag: null,
__geoMeta: { __geoMeta: {
sourceRange: [104, 120], sourceRange: [104, 120],
id: expect.any(String), id: expect.any(String),
@ -82,7 +87,12 @@ const newVar = myVar + 1`
sourceRange: [126, 156], sourceRange: [126, 156],
id: expect.any(String), id: expect.any(String),
}, },
name: 'rightPath', tag: {
end: 155,
start: 144,
type: 'TagDeclarator',
value: 'rightPath',
},
}, },
]) ])
}) })
@ -139,7 +149,7 @@ const newVar = myVar + 1`
start: { start: {
to: [0, 0], to: [0, 0],
from: [0, 0], from: [0, 0],
name: '', tag: null,
__geoMeta: { __geoMeta: {
id: expect.any(String), id: expect.any(String),
sourceRange: [39, 63], sourceRange: [39, 63],
@ -150,7 +160,7 @@ const newVar = myVar + 1`
type: 'ToPoint', type: 'ToPoint',
to: [1, 1], to: [1, 1],
from: [0, 0], from: [0, 0],
name: '', tag: null,
__geoMeta: { __geoMeta: {
sourceRange: [69, 85], sourceRange: [69, 85],
id: expect.any(String), id: expect.any(String),
@ -164,13 +174,18 @@ const newVar = myVar + 1`
sourceRange: [91, 118], sourceRange: [91, 118],
id: expect.any(String), id: expect.any(String),
}, },
name: 'myPath', tag: {
end: 117,
start: 109,
type: 'TagDeclarator',
value: 'myPath',
},
}, },
{ {
type: 'ToPoint', type: 'ToPoint',
to: [1, 1], to: [1, 1],
from: [0, 1], from: [0, 1],
name: '', tag: null,
__geoMeta: { __geoMeta: {
sourceRange: [124, 140], sourceRange: [124, 140],
id: expect.any(String), id: expect.any(String),

View File

@ -1,5 +1,6 @@
import { getNodePathFromSourceRange, getNodeFromPath } from './queryAst' import { getNodePathFromSourceRange, getNodeFromPath } from './queryAst'
import { Identifier, parse, initPromise, Parameter } from './wasm' import { Identifier, parse, initPromise, Parameter } from './wasm'
import { err } from 'lib/trap'
beforeAll(async () => { beforeAll(async () => {
await initPromise await initPromise
@ -22,8 +23,11 @@ const sk3 = startSketchAt([0, 0])
] ]
const ast = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const nodePath = getNodePathFromSourceRange(ast, sourceRange) const nodePath = getNodePathFromSourceRange(ast, sourceRange)
const { node } = getNodeFromPath<any>(ast, nodePath) const _node = getNodeFromPath<any>(ast, nodePath)
if (err(_node)) throw _node
const { node } = _node
expect([node.start, node.end]).toEqual(sourceRange) expect([node.start, node.end]).toEqual(sourceRange)
expect(node.type).toBe('CallExpression') expect(node.type).toBe('CallExpression')
@ -47,8 +51,11 @@ const b1 = cube([0,0], 10)`
] ]
const ast = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const nodePath = getNodePathFromSourceRange(ast, sourceRange) const nodePath = getNodePathFromSourceRange(ast, sourceRange)
const node = getNodeFromPath<Parameter>(ast, nodePath).node const _node = getNodeFromPath<Parameter>(ast, nodePath)
if (err(_node)) throw _node
const node = _node.node
expect(nodePath).toEqual([ expect(nodePath).toEqual([
['body', ''], ['body', ''],
@ -81,8 +88,11 @@ const b1 = cube([0,0], 10)`
] ]
const ast = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const nodePath = getNodePathFromSourceRange(ast, sourceRange) const nodePath = getNodePathFromSourceRange(ast, sourceRange)
const node = getNodeFromPath<Identifier>(ast, nodePath).node const _node = getNodeFromPath<Identifier>(ast, nodePath)
if (err(_node)) throw _node
const node = _node.node
expect(nodePath).toEqual([ expect(nodePath).toEqual([
['body', ''], ['body', ''],
[0, 'index'], [0, 'index'],

View File

@ -18,6 +18,7 @@ import {
} from './modifyAst' } from './modifyAst'
import { enginelessExecutor } from '../lib/testHelpers' import { enginelessExecutor } from '../lib/testHelpers'
import { findUsesOfTagInPipe, getNodePathFromSourceRange } from './queryAst' import { findUsesOfTagInPipe, getNodePathFromSourceRange } from './queryAst'
import { err } from 'lib/trap'
beforeAll(async () => { beforeAll(async () => {
await initPromise await initPromise
@ -140,10 +141,14 @@ function giveSketchFnCallTagTestHelper(
// this wrapper changes the input and output to code // this wrapper changes the input and output to code
// making it more of an integration test, but easier to read the test intention is the goal // making it more of an integration test, but easier to read the test intention is the goal
const ast = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const start = code.indexOf(searchStr) const start = code.indexOf(searchStr)
const range: [number, number] = [start, start + searchStr.length] const range: [number, number] = [start, start + searchStr.length]
const { modifiedAst, tag, isTagExisting } = giveSketchFnCallTag(ast, range) const sketchRes = giveSketchFnCallTag(ast, range)
if (err(sketchRes)) throw sketchRes
const { modifiedAst, tag, isTagExisting } = sketchRes
const newCode = recast(modifiedAst) const newCode = recast(modifiedAst)
if (err(newCode)) throw newCode
return { tag, newCode, isTagExisting } return { tag, newCode, isTagExisting }
} }
@ -211,6 +216,7 @@ const part001 = startSketchOn('XY')
const yo2 = hmm([identifierGuy + 5])` const yo2 = hmm([identifierGuy + 5])`
it('should move a binary expression into a new variable', async () => { it('should move a binary expression into a new variable', async () => {
const ast = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const programMemory = await enginelessExecutor(ast) const programMemory = await enginelessExecutor(ast)
const startIndex = code.indexOf('100 + 100') + 1 const startIndex = code.indexOf('100 + 100') + 1
const { modifiedAst } = moveValueIntoNewVariable( const { modifiedAst } = moveValueIntoNewVariable(
@ -225,6 +231,7 @@ const yo2 = hmm([identifierGuy + 5])`
}) })
it('should move a value into a new variable', async () => { it('should move a value into a new variable', async () => {
const ast = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const programMemory = await enginelessExecutor(ast) const programMemory = await enginelessExecutor(ast)
const startIndex = code.indexOf('2.8') + 1 const startIndex = code.indexOf('2.8') + 1
const { modifiedAst } = moveValueIntoNewVariable( const { modifiedAst } = moveValueIntoNewVariable(
@ -239,6 +246,7 @@ const yo2 = hmm([identifierGuy + 5])`
}) })
it('should move a callExpression into a new variable', async () => { it('should move a callExpression into a new variable', async () => {
const ast = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const programMemory = await enginelessExecutor(ast) const programMemory = await enginelessExecutor(ast)
const startIndex = code.indexOf('def(') const startIndex = code.indexOf('def(')
const { modifiedAst } = moveValueIntoNewVariable( const { modifiedAst } = moveValueIntoNewVariable(
@ -253,6 +261,7 @@ const yo2 = hmm([identifierGuy + 5])`
}) })
it('should move a binary expression with call expression into a new variable', async () => { it('should move a binary expression with call expression into a new variable', async () => {
const ast = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const programMemory = await enginelessExecutor(ast) const programMemory = await enginelessExecutor(ast)
const startIndex = code.indexOf('jkl(') + 1 const startIndex = code.indexOf('jkl(') + 1
const { modifiedAst } = moveValueIntoNewVariable( const { modifiedAst } = moveValueIntoNewVariable(
@ -267,6 +276,7 @@ const yo2 = hmm([identifierGuy + 5])`
}) })
it('should move a identifier into a new variable', async () => { it('should move a identifier into a new variable', async () => {
const ast = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const programMemory = await enginelessExecutor(ast) const programMemory = await enginelessExecutor(ast)
const startIndex = code.indexOf('identifierGuy +') + 1 const startIndex = code.indexOf('identifierGuy +') + 1
const { modifiedAst } = moveValueIntoNewVariable( const { modifiedAst } = moveValueIntoNewVariable(
@ -290,6 +300,8 @@ describe('testing sketchOnExtrudedFace', () => {
|> close(%) |> close(%)
|> extrude(5 + 7, %)` |> extrude(5 + 7, %)`
const ast = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const programMemory = await enginelessExecutor(ast) const programMemory = await enginelessExecutor(ast)
const segmentSnippet = `line([9.7, 9.19], %)` const segmentSnippet = `line([9.7, 9.19], %)`
const segmentRange: [number, number] = [ const segmentRange: [number, number] = [
@ -304,12 +316,15 @@ describe('testing sketchOnExtrudedFace', () => {
] ]
const extrudePathToNode = getNodePathFromSourceRange(ast, extrudeRange) const extrudePathToNode = getNodePathFromSourceRange(ast, extrudeRange)
const { modifiedAst } = sketchOnExtrudedFace( const extruded = sketchOnExtrudedFace(
ast, ast,
segmentPathToNode, segmentPathToNode,
extrudePathToNode, extrudePathToNode,
programMemory programMemory
) )
if (err(extruded)) throw extruded
const { modifiedAst } = extruded
const newCode = recast(modifiedAst) const newCode = recast(modifiedAst)
expect(newCode).toContain(`const part001 = startSketchOn('-XZ') expect(newCode).toContain(`const part001 = startSketchOn('-XZ')
|> startProfileAt([3.58, 2.06], %) |> startProfileAt([3.58, 2.06], %)
@ -327,6 +342,7 @@ const sketch001 = startSketchOn(part001, 'seg01')`)
|> close(%) |> close(%)
|> extrude(5 + 7, %)` |> extrude(5 + 7, %)`
const ast = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const programMemory = await enginelessExecutor(ast) const programMemory = await enginelessExecutor(ast)
const segmentSnippet = `close(%)` const segmentSnippet = `close(%)`
const segmentRange: [number, number] = [ const segmentRange: [number, number] = [
@ -341,12 +357,15 @@ const sketch001 = startSketchOn(part001, 'seg01')`)
] ]
const extrudePathToNode = getNodePathFromSourceRange(ast, extrudeRange) const extrudePathToNode = getNodePathFromSourceRange(ast, extrudeRange)
const { modifiedAst } = sketchOnExtrudedFace( const extruded = sketchOnExtrudedFace(
ast, ast,
segmentPathToNode, segmentPathToNode,
extrudePathToNode, extrudePathToNode,
programMemory programMemory
) )
if (err(extruded)) throw extruded
const { modifiedAst } = extruded
const newCode = recast(modifiedAst) const newCode = recast(modifiedAst)
expect(newCode).toContain(`const part001 = startSketchOn('-XZ') expect(newCode).toContain(`const part001 = startSketchOn('-XZ')
|> startProfileAt([3.58, 2.06], %) |> startProfileAt([3.58, 2.06], %)
@ -364,6 +383,7 @@ const sketch001 = startSketchOn(part001, 'seg01')`)
|> close(%) |> close(%)
|> extrude(5 + 7, %)` |> extrude(5 + 7, %)`
const ast = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const programMemory = await enginelessExecutor(ast) const programMemory = await enginelessExecutor(ast)
const sketchSnippet = `startProfileAt([3.58, 2.06], %)` const sketchSnippet = `startProfileAt([3.58, 2.06], %)`
const sketchRange: [number, number] = [ const sketchRange: [number, number] = [
@ -378,13 +398,16 @@ const sketch001 = startSketchOn(part001, 'seg01')`)
] ]
const extrudePathToNode = getNodePathFromSourceRange(ast, extrudeRange) const extrudePathToNode = getNodePathFromSourceRange(ast, extrudeRange)
const { modifiedAst } = sketchOnExtrudedFace( const extruded = sketchOnExtrudedFace(
ast, ast,
sketchPathToNode, sketchPathToNode,
extrudePathToNode, extrudePathToNode,
programMemory, programMemory,
'end' 'end'
) )
if (err(extruded)) throw extruded
const { modifiedAst } = extruded
const newCode = recast(modifiedAst) const newCode = recast(modifiedAst)
expect(newCode).toContain(`const part001 = startSketchOn('-XZ') expect(newCode).toContain(`const part001 = startSketchOn('-XZ')
|> startProfileAt([3.58, 2.06], %) |> startProfileAt([3.58, 2.06], %)
@ -410,6 +433,7 @@ const sketch001 = startSketchOn(part001, 'END')`)
|> close(%) |> close(%)
const part001 = extrude(5 + 7, sketch001)` const part001 = extrude(5 + 7, sketch001)`
const ast = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const programMemory = await enginelessExecutor(ast) const programMemory = await enginelessExecutor(ast)
const segmentSnippet = `line([4.99, -0.46], %)` const segmentSnippet = `line([4.99, -0.46], %)`
const segmentRange: [number, number] = [ const segmentRange: [number, number] = [
@ -424,13 +448,14 @@ const sketch001 = startSketchOn(part001, 'END')`)
] ]
const extrudePathToNode = getNodePathFromSourceRange(ast, extrudeRange) const extrudePathToNode = getNodePathFromSourceRange(ast, extrudeRange)
const { modifiedAst } = sketchOnExtrudedFace( const updatedAst = sketchOnExtrudedFace(
ast, ast,
segmentPathToNode, segmentPathToNode,
extrudePathToNode, extrudePathToNode,
programMemory programMemory
) )
const newCode = recast(modifiedAst) if (err(updatedAst)) throw updatedAst
const newCode = recast(updatedAst.modifiedAst)
expect(newCode).toContain(`const part001 = extrude(5 + 7, sketch001) expect(newCode).toContain(`const part001 = extrude(5 + 7, sketch001)
const sketch002 = startSketchOn(part001, 'seg01')`) const sketch002 = startSketchOn(part001, 'seg01')`)
}) })
@ -444,6 +469,7 @@ describe('Testing deleteSegmentFromPipeExpression', () => {
|> line([306.21, 198.85], %, 'a') |> line([306.21, 198.85], %, 'a')
|> line([306.21, 198.87], %)` |> line([306.21, 198.87], %)`
const ast = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const programMemory = await enginelessExecutor(ast) const programMemory = await enginelessExecutor(ast)
const lineOfInterest = "line([306.21, 198.85], %, 'a')" const lineOfInterest = "line([306.21, 198.85], %, 'a')"
const range: [number, number] = [ const range: [number, number] = [
@ -458,6 +484,7 @@ describe('Testing deleteSegmentFromPipeExpression', () => {
code, code,
pathToNode pathToNode
) )
if (err(modifiedAst)) throw modifiedAst
const newCode = recast(modifiedAst) const newCode = recast(modifiedAst)
expect(newCode).toBe(`const part001 = startSketchOn('-XZ') expect(newCode).toBe(`const part001 = startSketchOn('-XZ')
|> startProfileAt([54.78, -95.91], %) |> startProfileAt([54.78, -95.91], %)
@ -520,6 +547,7 @@ ${!replace1 ? ` |> ${line}\n` : ''} |> angledLine([-65, ${
])(`%s`, async (_, line, [replace1, replace2]) => { ])(`%s`, async (_, line, [replace1, replace2]) => {
const code = makeCode(line) const code = makeCode(line)
const ast = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const programMemory = await enginelessExecutor(ast) const programMemory = await enginelessExecutor(ast)
const lineOfInterest = line const lineOfInterest = line
const range: [number, number] = [ const range: [number, number] = [
@ -535,6 +563,7 @@ ${!replace1 ? ` |> ${line}\n` : ''} |> angledLine([-65, ${
code, code,
pathToNode pathToNode
) )
if (err(modifiedAst)) throw modifiedAst
const newCode = recast(modifiedAst) const newCode = recast(modifiedAst)
expect(newCode).toBe(makeCode(line, replace1, replace2)) expect(newCode).toBe(makeCode(line, replace1, replace2))
}) })
@ -606,6 +635,8 @@ describe('Testing removeSingleConstraintInfo', () => {
['tangentialArcTo([3.14 + 0, 13.14], %)', 'arrayIndex', 1], ['tangentialArcTo([3.14 + 0, 13.14], %)', 'arrayIndex', 1],
])('stdlib fn: %s', async (expectedFinish, key, value) => { ])('stdlib fn: %s', async (expectedFinish, key, value) => {
const ast = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const programMemory = await enginelessExecutor(ast) const programMemory = await enginelessExecutor(ast)
const lineOfInterest = expectedFinish.split('(')[0] + '(' const lineOfInterest = expectedFinish.split('(')[0] + '('
const range: [number, number] = [ const range: [number, number] = [
@ -621,7 +652,7 @@ describe('Testing removeSingleConstraintInfo', () => {
ast, ast,
programMemory programMemory
) )
if (!mod) throw new Error('yo is undefined') if (!mod) return new Error('mod is undefined')
const recastCode = recast(mod.modifiedAst) const recastCode = recast(mod.modifiedAst)
expect(recastCode).toContain(expectedFinish) expect(recastCode).toContain(expectedFinish)
}) })
@ -642,6 +673,8 @@ describe('Testing removeSingleConstraintInfo', () => {
['angledLineToY([30, 10.14 + 0], %)', 'arrayIndex', 0], ['angledLineToY([30, 10.14 + 0], %)', 'arrayIndex', 0],
])('stdlib fn: %s', async (expectedFinish, key, value) => { ])('stdlib fn: %s', async (expectedFinish, key, value) => {
const ast = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const programMemory = await enginelessExecutor(ast) const programMemory = await enginelessExecutor(ast)
const lineOfInterest = expectedFinish.split('(')[0] + '(' const lineOfInterest = expectedFinish.split('(')[0] + '('
const range: [number, number] = [ const range: [number, number] = [
@ -657,7 +690,7 @@ describe('Testing removeSingleConstraintInfo', () => {
ast, ast,
programMemory programMemory
) )
if (!mod) throw new Error('yo is undefined') if (!mod) return new Error('mod is undefined')
const recastCode = recast(mod.modifiedAst) const recastCode = recast(mod.modifiedAst)
expect(recastCode).toContain(expectedFinish) expect(recastCode).toContain(expectedFinish)
}) })

View File

@ -1,4 +1,5 @@
import { Selection } from 'lib/selections' import { Selection } from 'lib/selections'
import { err, trap } from 'lib/trap'
import { import {
Program, Program,
CallExpression, CallExpression,
@ -73,14 +74,16 @@ export function addStartProfileAt(
node: Program, node: Program,
pathToNode: PathToNode, pathToNode: PathToNode,
at: [number, number] at: [number, number]
): { modifiedAst: Program; pathToNode: PathToNode } { ): { modifiedAst: Program; pathToNode: PathToNode } | Error {
const variableDeclaration = getNodeFromPath<VariableDeclaration>( const _node1 = getNodeFromPath<VariableDeclaration>(
node, node,
pathToNode, pathToNode,
'VariableDeclaration' 'VariableDeclaration'
).node )
if (err(_node1)) return _node1
const variableDeclaration = _node1.node
if (variableDeclaration.type !== 'VariableDeclaration') { if (variableDeclaration.type !== 'VariableDeclaration') {
throw new Error('variableDeclaration.init.type !== PipeExpression') return new Error('variableDeclaration.init.type !== PipeExpression')
} }
const _node = { ...node } const _node = { ...node }
const init = variableDeclaration.declarations[0].init const init = variableDeclaration.declarations[0].init
@ -247,24 +250,36 @@ export function extrudeSketch(
pathToNode: PathToNode, pathToNode: PathToNode,
shouldPipe = false, shouldPipe = false,
distance = createLiteral(4) as Value distance = createLiteral(4) as Value
): { ):
| {
modifiedAst: Program modifiedAst: Program
pathToNode: PathToNode pathToNode: PathToNode
pathToExtrudeArg: PathToNode pathToExtrudeArg: PathToNode
} { }
| Error {
const _node = { ...node } const _node = { ...node }
const { node: sketchExpression } = getNodeFromPath(_node, pathToNode) const _node1 = getNodeFromPath(_node, pathToNode)
if (err(_node1)) return _node1
const { node: sketchExpression } = _node1
// determine if sketchExpression is in a pipeExpression or not // determine if sketchExpression is in a pipeExpression or not
const { node: pipeExpression } = getNodeFromPath<PipeExpression>( const _node2 = getNodeFromPath<PipeExpression>(
_node, _node,
pathToNode, pathToNode,
'PipeExpression' 'PipeExpression'
) )
if (err(_node2)) return _node2
const { node: pipeExpression } = _node2
const isInPipeExpression = pipeExpression.type === 'PipeExpression' const isInPipeExpression = pipeExpression.type === 'PipeExpression'
const { node: variableDeclarator, shallowPath: pathToDecleration } = const _node3 = getNodeFromPath<VariableDeclarator>(
getNodeFromPath<VariableDeclarator>(_node, pathToNode, 'VariableDeclarator') _node,
pathToNode,
'VariableDeclarator'
)
if (err(_node3)) return _node3
const { node: variableDeclarator, shallowPath: pathToDecleration } = _node3
const extrudeCall = createCallExpressionStdLib('extrude', [ const extrudeCall = createCallExpressionStdLib('extrude', [
distance, distance,
@ -331,34 +346,42 @@ export function sketchOnExtrudedFace(
extrudePathToNode: PathToNode, extrudePathToNode: PathToNode,
programMemory: ProgramMemory, programMemory: ProgramMemory,
cap: 'none' | 'start' | 'end' = 'none' cap: 'none' | 'start' | 'end' = 'none'
): { modifiedAst: Program; pathToNode: PathToNode } { ): { modifiedAst: Program; pathToNode: PathToNode } | Error {
let _node = { ...node } let _node = { ...node }
const newSketchName = findUniqueName( const newSketchName = findUniqueName(
node, node,
KCL_DEFAULT_CONSTANT_PREFIXES.SKETCH KCL_DEFAULT_CONSTANT_PREFIXES.SKETCH
) )
const { node: oldSketchNode } = getNodeFromPath<VariableDeclarator>( const _node1 = getNodeFromPath<VariableDeclarator>(
_node, _node,
sketchPathToNode, sketchPathToNode,
'VariableDeclarator', 'VariableDeclarator',
true true
) )
if (err(_node1)) return _node1
const { node: oldSketchNode } = _node1
const oldSketchName = oldSketchNode.id.name const oldSketchName = oldSketchNode.id.name
const { node: expression } = getNodeFromPath<CallExpression>( const _node2 = getNodeFromPath<CallExpression>(
_node, _node,
sketchPathToNode, sketchPathToNode,
'CallExpression' 'CallExpression'
) )
const { node: extrudeVarDec } = getNodeFromPath<VariableDeclarator>( if (err(_node2)) return _node2
const { node: expression } = _node2
const _node3 = getNodeFromPath<VariableDeclarator>(
_node, _node,
extrudePathToNode, extrudePathToNode,
'VariableDeclarator' 'VariableDeclarator'
) )
if (err(_node3)) return _node3
const { node: extrudeVarDec } = _node3
const extrudeName = extrudeVarDec.id?.name const extrudeName = extrudeVarDec.id?.name
let _tag = '' let _tag = ''
if (cap === 'none') { if (cap === 'none') {
const { modifiedAst, tag } = addTagForSketchOnFace( const __tag = addTagForSketchOnFace(
{ {
previousProgramMemory: programMemory, previousProgramMemory: programMemory,
pathToNode: sketchPathToNode, pathToNode: sketchPathToNode,
@ -366,6 +389,8 @@ export function sketchOnExtrudedFace(
}, },
expression.callee.name expression.callee.name
) )
if (err(__tag)) return __tag
const { modifiedAst, tag } = __tag
_tag = tag _tag = tag
_node = modifiedAst _node = modifiedAst
} else { } else {
@ -616,18 +641,19 @@ export function giveSketchFnCallTag(
ast: Program, ast: Program,
range: Selection['range'], range: Selection['range'],
tag?: string tag?: string
): { ):
| {
modifiedAst: Program modifiedAst: Program
tag: string tag: string
isTagExisting: boolean isTagExisting: boolean
pathToNode: PathToNode pathToNode: PathToNode
} { }
| Error {
const path = getNodePathFromSourceRange(ast, range) const path = getNodePathFromSourceRange(ast, range)
const { node: primaryCallExp } = getNodeFromPath<CallExpression>( const _node1 = getNodeFromPath<CallExpression>(ast, path, 'CallExpression')
ast, if (err(_node1)) return _node1
path, const { node: primaryCallExp } = _node1
'CallExpression'
)
// Tag is always 3rd expression now, using arg index feels brittle // Tag is always 3rd expression now, using arg index feels brittle
// but we can come up with a better way to identify tag later. // but we can come up with a better way to identify tag later.
const thirdArg = primaryCallExp.arguments?.[2] const thirdArg = primaryCallExp.arguments?.[2]
@ -646,7 +672,7 @@ export function giveSketchFnCallTag(
pathToNode: path, pathToNode: path,
} }
} else { } else {
throw new Error('Unable to assign tag without value') return new Error('Unable to assign tag without value')
} }
} }
@ -659,7 +685,10 @@ export function moveValueIntoNewVariablePath(
modifiedAst: Program modifiedAst: Program
pathToReplacedNode?: PathToNode pathToReplacedNode?: PathToNode
} { } {
const { isSafe, value, replacer } = isNodeSafeToReplacePath(ast, pathToNode) const meta = isNodeSafeToReplacePath(ast, pathToNode)
if (trap(meta)) return { modifiedAst: ast }
const { isSafe, value, replacer } = meta
if (!isSafe || value.type === 'Identifier') return { modifiedAst: ast } if (!isSafe || value.type === 'Identifier') return { modifiedAst: ast }
const { insertIndex } = findAllPreviousVariablesPath( const { insertIndex } = findAllPreviousVariablesPath(
@ -669,6 +698,8 @@ export function moveValueIntoNewVariablePath(
) )
let _node = JSON.parse(JSON.stringify(ast)) let _node = JSON.parse(JSON.stringify(ast))
const boop = replacer(_node, variableName) const boop = replacer(_node, variableName)
if (trap(boop)) return { modifiedAst: ast }
_node = boop.modifiedAst _node = boop.modifiedAst
_node.body.splice( _node.body.splice(
insertIndex, insertIndex,
@ -687,7 +718,9 @@ export function moveValueIntoNewVariable(
modifiedAst: Program modifiedAst: Program
pathToReplacedNode?: PathToNode pathToReplacedNode?: PathToNode
} { } {
const { isSafe, value, replacer } = isNodeSafeToReplace(ast, sourceRange) const meta = isNodeSafeToReplace(ast, sourceRange)
if (trap(meta)) return { modifiedAst: ast }
const { isSafe, value, replacer } = meta
if (!isSafe || value.type === 'Identifier') return { modifiedAst: ast } if (!isSafe || value.type === 'Identifier') return { modifiedAst: ast }
const { insertIndex } = findAllPreviousVariables( const { insertIndex } = findAllPreviousVariables(
@ -696,7 +729,10 @@ export function moveValueIntoNewVariable(
sourceRange sourceRange
) )
let _node = JSON.parse(JSON.stringify(ast)) let _node = JSON.parse(JSON.stringify(ast))
const { modifiedAst, pathToReplaced } = replacer(_node, variableName) const replaced = replacer(_node, variableName)
if (trap(replaced)) return { modifiedAst: ast }
const { modifiedAst, pathToReplaced } = replaced
_node = modifiedAst _node = modifiedAst
_node.body.splice( _node.body.splice(
insertIndex, insertIndex,
@ -716,7 +752,7 @@ export function deleteSegmentFromPipeExpression(
programMemory: ProgramMemory, programMemory: ProgramMemory,
code: string, code: string,
pathToNode: PathToNode pathToNode: PathToNode
): Program { ): Program | Error {
let _modifiedAst: Program = JSON.parse(JSON.stringify(modifiedAst)) let _modifiedAst: Program = JSON.parse(JSON.stringify(modifiedAst))
dependentRanges.forEach((range) => { dependentRanges.forEach((range) => {
@ -728,10 +764,13 @@ export function deleteSegmentFromPipeExpression(
'CallExpression', 'CallExpression',
true true
) )
if (err(callExp)) return callExp
const constraintInfo = getConstraintInfo(callExp.node, code, path).find( const constraintInfo = getConstraintInfo(callExp.node, code, path).find(
({ sourceRange }) => isOverlap(sourceRange, range) ({ sourceRange }) => isOverlap(sourceRange, range)
) )
if (!constraintInfo) return if (!constraintInfo) return
const input = makeRemoveSingleConstraintInput( const input = makeRemoveSingleConstraintInput(
constraintInfo.argPosition, constraintInfo.argPosition,
callExp.shallowPath callExp.shallowPath
@ -752,13 +791,17 @@ export function deleteSegmentFromPipeExpression(
_modifiedAst, _modifiedAst,
pathToNode, pathToNode,
'PipeExpression' 'PipeExpression'
).node )
if (err(pipeExpression)) return pipeExpression
const pipeInPathIndex = pathToNode.findIndex( const pipeInPathIndex = pathToNode.findIndex(
([_, desc]) => desc === 'PipeExpression' ([_, desc]) => desc === 'PipeExpression'
) )
const segmentIndexInPipe = pathToNode[pipeInPathIndex + 1][0] as number const segmentIndexInPipe = pathToNode[pipeInPathIndex + 1]
pipeExpression.body.splice(segmentIndexInPipe, 1) pipeExpression.node.body.splice(segmentIndexInPipe[0] as number, 1)
// Move up to the next segment.
segmentIndexInPipe[0] = Math.max((segmentIndexInPipe[0] as number) - 1, 0)
return _modifiedAst return _modifiedAst
} }
@ -809,11 +852,13 @@ export function removeSingleConstraintInfo(
ast, ast,
}) })
if (!transform) return false if (!transform) return false
return transformAstSketchLines({ const retval = transformAstSketchLines({
ast, ast,
selectionRanges: [pathToCallExp], selectionRanges: [pathToCallExp],
transformInfos: [transform], transformInfos: [transform],
programMemory, programMemory,
referenceSegName: '', referenceSegName: '',
}) })
if (err(retval)) return false
return retval
} }

View File

@ -17,6 +17,7 @@ import {
createLiteral, createLiteral,
createPipeSubstitution, createPipeSubstitution,
} from './modifyAst' } from './modifyAst'
import { err } from 'lib/trap'
beforeAll(async () => { beforeAll(async () => {
await initPromise await initPromise
@ -42,6 +43,7 @@ const variableBelowShouldNotBeIncluded = 3
` `
const rangeStart = code.indexOf('// selection-range-7ish-before-this') - 7 const rangeStart = code.indexOf('// selection-range-7ish-before-this') - 7
const ast = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const programMemory = await enginelessExecutor(ast) const programMemory = await enginelessExecutor(ast)
const { variables, bodyPath, insertIndex } = findAllPreviousVariables( const { variables, bodyPath, insertIndex } = findAllPreviousVariables(
@ -76,53 +78,65 @@ const yo = 5 + 6
const yo2 = hmm([identifierGuy + 5])` const yo2 = hmm([identifierGuy + 5])`
it('find a safe binaryExpression', () => { it('find a safe binaryExpression', () => {
const ast = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const rangeStart = code.indexOf('100 + 100') + 2 const rangeStart = code.indexOf('100 + 100') + 2
const result = isNodeSafeToReplace(ast, [rangeStart, rangeStart]) const result = isNodeSafeToReplace(ast, [rangeStart, rangeStart])
if (err(result)) throw result
expect(result.isSafe).toBe(true) expect(result.isSafe).toBe(true)
expect(result.value?.type).toBe('BinaryExpression') expect(result.value?.type).toBe('BinaryExpression')
expect(code.slice(result.value.start, result.value.end)).toBe('100 + 100') expect(code.slice(result.value.start, result.value.end)).toBe('100 + 100')
const { modifiedAst } = result.replacer( const replaced = result.replacer(
JSON.parse(JSON.stringify(ast)), JSON.parse(JSON.stringify(ast)),
'replaceName' 'replaceName'
) )
const outCode = recast(modifiedAst) if (err(replaced)) throw replaced
const outCode = recast(replaced.modifiedAst)
expect(outCode).toContain(`angledLine([replaceName, 3.09], %)`) expect(outCode).toContain(`angledLine([replaceName, 3.09], %)`)
}) })
it('find a safe Identifier', () => { it('find a safe Identifier', () => {
const ast = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const rangeStart = code.indexOf('abc') const rangeStart = code.indexOf('abc')
const result = isNodeSafeToReplace(ast, [rangeStart, rangeStart]) const result = isNodeSafeToReplace(ast, [rangeStart, rangeStart])
if (err(result)) throw result
expect(result.isSafe).toBe(true) expect(result.isSafe).toBe(true)
expect(result.value?.type).toBe('Identifier') expect(result.value?.type).toBe('Identifier')
expect(code.slice(result.value.start, result.value.end)).toBe('abc') expect(code.slice(result.value.start, result.value.end)).toBe('abc')
}) })
it('find a safe CallExpression', () => { it('find a safe CallExpression', () => {
const ast = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const rangeStart = code.indexOf('def') const rangeStart = code.indexOf('def')
const result = isNodeSafeToReplace(ast, [rangeStart, rangeStart]) const result = isNodeSafeToReplace(ast, [rangeStart, rangeStart])
if (err(result)) throw result
expect(result.isSafe).toBe(true) expect(result.isSafe).toBe(true)
expect(result.value?.type).toBe('CallExpression') expect(result.value?.type).toBe('CallExpression')
expect(code.slice(result.value.start, result.value.end)).toBe("def('yo')") expect(code.slice(result.value.start, result.value.end)).toBe("def('yo')")
const { modifiedAst } = result.replacer( const replaced = result.replacer(
JSON.parse(JSON.stringify(ast)), JSON.parse(JSON.stringify(ast)),
'replaceName' 'replaceName'
) )
const outCode = recast(modifiedAst) if (err(replaced)) throw replaced
const outCode = recast(replaced.modifiedAst)
expect(outCode).toContain(`angledLine([replaceName, 3.09], %)`) expect(outCode).toContain(`angledLine([replaceName, 3.09], %)`)
}) })
it('find an UNsafe CallExpression, as it has a PipeSubstitution', () => { it('find an UNsafe CallExpression, as it has a PipeSubstitution', () => {
const ast = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const rangeStart = code.indexOf('ghi') const rangeStart = code.indexOf('ghi')
const range: [number, number] = [rangeStart, rangeStart] const range: [number, number] = [rangeStart, rangeStart]
const result = isNodeSafeToReplace(ast, range) const result = isNodeSafeToReplace(ast, range)
if (err(result)) throw result
expect(result.isSafe).toBe(false) expect(result.isSafe).toBe(false)
expect(result.value?.type).toBe('CallExpression') expect(result.value?.type).toBe('CallExpression')
expect(code.slice(result.value.start, result.value.end)).toBe('ghi(%)') expect(code.slice(result.value.start, result.value.end)).toBe('ghi(%)')
}) })
it('find an UNsafe Identifier, as it is a callee', () => { it('find an UNsafe Identifier, as it is a callee', () => {
const ast = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const rangeStart = code.indexOf('ine([2.8,') const rangeStart = code.indexOf('ine([2.8,')
const result = isNodeSafeToReplace(ast, [rangeStart, rangeStart]) const result = isNodeSafeToReplace(ast, [rangeStart, rangeStart])
if (err(result)) throw result
expect(result.isSafe).toBe(false) expect(result.isSafe).toBe(false)
expect(result.value?.type).toBe('CallExpression') expect(result.value?.type).toBe('CallExpression')
expect(code.slice(result.value.start, result.value.end)).toBe( expect(code.slice(result.value.start, result.value.end)).toBe(
@ -131,47 +145,60 @@ const yo2 = hmm([identifierGuy + 5])`
}) })
it("find a safe BinaryExpression that's assigned to a variable", () => { it("find a safe BinaryExpression that's assigned to a variable", () => {
const ast = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const rangeStart = code.indexOf('5 + 6') + 1 const rangeStart = code.indexOf('5 + 6') + 1
const result = isNodeSafeToReplace(ast, [rangeStart, rangeStart]) const result = isNodeSafeToReplace(ast, [rangeStart, rangeStart])
if (err(result)) throw result
expect(result.isSafe).toBe(true) expect(result.isSafe).toBe(true)
expect(result.value?.type).toBe('BinaryExpression') expect(result.value?.type).toBe('BinaryExpression')
expect(code.slice(result.value.start, result.value.end)).toBe('5 + 6') expect(code.slice(result.value.start, result.value.end)).toBe('5 + 6')
const { modifiedAst } = result.replacer( const replaced = result.replacer(
JSON.parse(JSON.stringify(ast)), JSON.parse(JSON.stringify(ast)),
'replaceName' 'replaceName'
) )
const outCode = recast(modifiedAst) if (err(replaced)) throw replaced
const outCode = recast(replaced.modifiedAst)
expect(outCode).toContain(`const yo = replaceName`) expect(outCode).toContain(`const yo = replaceName`)
}) })
it('find a safe BinaryExpression that has a CallExpression within', () => { it('find a safe BinaryExpression that has a CallExpression within', () => {
const ast = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const rangeStart = code.indexOf('jkl') + 1 const rangeStart = code.indexOf('jkl') + 1
const result = isNodeSafeToReplace(ast, [rangeStart, rangeStart]) const result = isNodeSafeToReplace(ast, [rangeStart, rangeStart])
if (err(result)) throw result
expect(result.isSafe).toBe(true) expect(result.isSafe).toBe(true)
expect(result.value?.type).toBe('BinaryExpression') expect(result.value?.type).toBe('BinaryExpression')
expect(code.slice(result.value.start, result.value.end)).toBe( expect(code.slice(result.value.start, result.value.end)).toBe(
"jkl('yo') + 2" "jkl('yo') + 2"
) )
const { modifiedAst } = result.replacer( const replaced = result.replacer(
JSON.parse(JSON.stringify(ast)), JSON.parse(JSON.stringify(ast)),
'replaceName' 'replaceName'
) )
if (err(replaced)) throw replaced
const { modifiedAst } = replaced
const outCode = recast(modifiedAst) const outCode = recast(modifiedAst)
expect(outCode).toContain(`angledLine([replaceName, 3.09], %)`) expect(outCode).toContain(`angledLine([replaceName, 3.09], %)`)
}) })
it('find a safe BinaryExpression within a CallExpression', () => { it('find a safe BinaryExpression within a CallExpression', () => {
const ast = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const rangeStart = code.indexOf('identifierGuy') + 1 const rangeStart = code.indexOf('identifierGuy') + 1
const result = isNodeSafeToReplace(ast, [rangeStart, rangeStart]) const result = isNodeSafeToReplace(ast, [rangeStart, rangeStart])
if (err(result)) throw result
expect(result.isSafe).toBe(true) expect(result.isSafe).toBe(true)
expect(result.value?.type).toBe('BinaryExpression') expect(result.value?.type).toBe('BinaryExpression')
expect(code.slice(result.value.start, result.value.end)).toBe( expect(code.slice(result.value.start, result.value.end)).toBe(
'identifierGuy + 5' 'identifierGuy + 5'
) )
const { modifiedAst } = result.replacer( const replaced = result.replacer(
JSON.parse(JSON.stringify(ast)), JSON.parse(JSON.stringify(ast)),
'replaceName' 'replaceName'
) )
if (err(replaced)) throw replaced
const { modifiedAst } = replaced
const outCode = recast(modifiedAst) const outCode = recast(modifiedAst)
expect(outCode).toContain(`const yo2 = hmm([replaceName])`) expect(outCode).toContain(`const yo2 = hmm([replaceName])`)
}) })
@ -209,6 +236,8 @@ describe('testing getNodePathFromSourceRange', () => {
const searchLn = `line([0.94, 2.61], %)` const searchLn = `line([0.94, 2.61], %)`
const sourceIndex = code.indexOf(searchLn) + searchLn.length const sourceIndex = code.indexOf(searchLn) + searchLn.length
const ast = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const result = getNodePathFromSourceRange(ast, [sourceIndex, sourceIndex]) const result = getNodePathFromSourceRange(ast, [sourceIndex, sourceIndex])
expect(result).toEqual([ expect(result).toEqual([
['body', ''], ['body', ''],
@ -224,6 +253,8 @@ describe('testing getNodePathFromSourceRange', () => {
const searchLn = `line([-0.21, -1.4], %)` const searchLn = `line([-0.21, -1.4], %)`
const sourceIndex = code.indexOf(searchLn) + searchLn.length const sourceIndex = code.indexOf(searchLn) + searchLn.length
const ast = parse(code) const ast = parse(code)
if (err(ast)) throw ast
const result = getNodePathFromSourceRange(ast, [sourceIndex, sourceIndex]) const result = getNodePathFromSourceRange(ast, [sourceIndex, sourceIndex])
const expected = [ const expected = [
['body', ''], ['body', ''],
@ -262,6 +293,8 @@ const part001 = startSketchAt([-1.41, 3.46])
|> close(%) |> close(%)
` `
const ast = parse(exampleCode) const ast = parse(exampleCode)
if (err(ast)) throw ast
const result = doesPipeHaveCallExp({ const result = doesPipeHaveCallExp({
calleeName: 'close', calleeName: 'close',
ast, ast,
@ -280,6 +313,8 @@ const part001 = startSketchAt([-1.41, 3.46])
|> extrude(1, %) |> extrude(1, %)
` `
const ast = parse(exampleCode) const ast = parse(exampleCode)
if (err(ast)) throw ast
const result = doesPipeHaveCallExp({ const result = doesPipeHaveCallExp({
calleeName: 'extrude', calleeName: 'extrude',
ast, ast,
@ -296,6 +331,8 @@ const part001 = startSketchAt([-1.41, 3.46])
|> angledLine([-175, segLen('seg01', %)], %) |> angledLine([-175, segLen('seg01', %)], %)
` `
const ast = parse(exampleCode) const ast = parse(exampleCode)
if (err(ast)) throw ast
const result = doesPipeHaveCallExp({ const result = doesPipeHaveCallExp({
calleeName: 'close', calleeName: 'close',
ast, ast,
@ -306,6 +343,8 @@ const part001 = startSketchAt([-1.41, 3.46])
it('returns false if not a pipe', () => { it('returns false if not a pipe', () => {
const exampleCode = `const length001 = 2` const exampleCode = `const length001 = 2`
const ast = parse(exampleCode) const ast = parse(exampleCode)
if (err(ast)) throw ast
const result = doesPipeHaveCallExp({ const result = doesPipeHaveCallExp({
calleeName: 'close', calleeName: 'close',
ast, ast,
@ -324,6 +363,8 @@ const part001 = startSketchAt([-1.41, 3.46])
|> line([-3.22, -7.36], %) |> line([-3.22, -7.36], %)
|> angledLine([-175, segLen('seg01', %)], %)` |> angledLine([-175, segLen('seg01', %)], %)`
const ast = parse(exampleCode) const ast = parse(exampleCode)
if (err(ast)) throw ast
const programMemory = await enginelessExecutor(ast) const programMemory = await enginelessExecutor(ast)
const result = hasExtrudeSketchGroup({ const result = hasExtrudeSketchGroup({
ast, ast,
@ -341,6 +382,8 @@ const part001 = startSketchAt([-1.41, 3.46])
|> angledLine([-175, segLen('seg01', %)], %) |> angledLine([-175, segLen('seg01', %)], %)
|> extrude(1, %)` |> extrude(1, %)`
const ast = parse(exampleCode) const ast = parse(exampleCode)
if (err(ast)) throw ast
const programMemory = await enginelessExecutor(ast) const programMemory = await enginelessExecutor(ast)
const result = hasExtrudeSketchGroup({ const result = hasExtrudeSketchGroup({
ast, ast,
@ -352,6 +395,8 @@ const part001 = startSketchAt([-1.41, 3.46])
it('finds nothing', async () => { it('finds nothing', async () => {
const exampleCode = `const length001 = 2` const exampleCode = `const length001 = 2`
const ast = parse(exampleCode) const ast = parse(exampleCode)
if (err(ast)) throw ast
const programMemory = await enginelessExecutor(ast) const programMemory = await enginelessExecutor(ast)
const result = hasExtrudeSketchGroup({ const result = hasExtrudeSketchGroup({
ast, ast,
@ -372,6 +417,8 @@ describe('Testing findUsesOfTagInPipe', () => {
|> angledLine([65, segLen('seg01', %)], %)` |> angledLine([65, segLen('seg01', %)], %)`
it('finds the current segment', async () => { it('finds the current segment', async () => {
const ast = parse(exampleCode) const ast = parse(exampleCode)
if (err(ast)) throw ast
const lineOfInterest = `198.85], %, 'seg01'` const lineOfInterest = `198.85], %, 'seg01'`
const characterIndex = const characterIndex =
exampleCode.indexOf(lineOfInterest) + lineOfInterest.length exampleCode.indexOf(lineOfInterest) + lineOfInterest.length
@ -387,6 +434,8 @@ describe('Testing findUsesOfTagInPipe', () => {
}) })
it('find no tag if line has no tag', () => { it('find no tag if line has no tag', () => {
const ast = parse(exampleCode) const ast = parse(exampleCode)
if (err(ast)) throw ast
const lineOfInterest = `line([306.21, 198.82], %)` const lineOfInterest = `line([306.21, 198.82], %)`
const characterIndex = const characterIndex =
exampleCode.indexOf(lineOfInterest) + lineOfInterest.length exampleCode.indexOf(lineOfInterest) + lineOfInterest.length
@ -423,6 +472,7 @@ const sketch002 = startSketchOn(extrude001, 'seg01')
` `
it('finds sketch001 pipe to be extruded', async () => { it('finds sketch001 pipe to be extruded', async () => {
const ast = parse(exampleCode) const ast = parse(exampleCode)
if (err(ast)) throw ast
const lineOfInterest = `line([4.99, -0.46], %, 'seg01')` const lineOfInterest = `line([4.99, -0.46], %, 'seg01')`
const characterIndex = const characterIndex =
exampleCode.indexOf(lineOfInterest) + lineOfInterest.length exampleCode.indexOf(lineOfInterest) + lineOfInterest.length
@ -437,6 +487,7 @@ const sketch002 = startSketchOn(extrude001, 'seg01')
}) })
it('find sketch002 NOT pipe to be extruded', async () => { it('find sketch002 NOT pipe to be extruded', async () => {
const ast = parse(exampleCode) const ast = parse(exampleCode)
if (err(ast)) throw ast
const lineOfInterest = `line([2.45, -0.2], %)` const lineOfInterest = `line([2.45, -0.2], %)`
const characterIndex = const characterIndex =
exampleCode.indexOf(lineOfInterest) + lineOfInterest.length exampleCode.indexOf(lineOfInterest) + lineOfInterest.length
@ -468,6 +519,7 @@ const sketch002 = startSketchOn(extrude001, 'seg01')
|> close(%) |> close(%)
` `
const ast = parse(exampleCode) const ast = parse(exampleCode)
if (err(ast)) throw ast
const extrudable = hasExtrudableGeometry(ast) const extrudable = hasExtrudableGeometry(ast)
expect(extrudable).toBeTruthy() expect(extrudable).toBeTruthy()
}) })
@ -481,6 +533,7 @@ const sketch002 = startSketchOn(extrude001, 'seg01')
const extrude001 = extrude(10, sketch001) const extrude001 = extrude(10, sketch001)
` `
const ast = parse(exampleCode) const ast = parse(exampleCode)
if (err(ast)) throw ast
const extrudable = hasExtrudableGeometry(ast) const extrudable = hasExtrudableGeometry(ast)
expect(extrudable).toBeFalsy() expect(extrudable).toBeFalsy()
}) })

View File

@ -25,6 +25,7 @@ import {
getConstraintLevelFromSourceRange, getConstraintLevelFromSourceRange,
getConstraintType, getConstraintType,
} from './std/sketchcombos' } from './std/sketchcombos'
import { err } from 'lib/trap'
/** /**
* Retrieves a node from a given path within a Program node structure, optionally stopping at a specified node type. * Retrieves a node from a given path within a Program node structure, optionally stopping at a specified node type.
@ -38,19 +39,20 @@ export function getNodeFromPath<T>(
path: PathToNode, path: PathToNode,
stopAt?: SyntaxType | SyntaxType[], stopAt?: SyntaxType | SyntaxType[],
returnEarly = false returnEarly = false
): { ):
| {
node: T node: T
shallowPath: PathToNode shallowPath: PathToNode
deepPath: PathToNode deepPath: PathToNode
} { }
| Error {
let currentNode = node as any let currentNode = node as any
let stopAtNode = null let stopAtNode = null
let successfulPaths: PathToNode = [] let successfulPaths: PathToNode = []
let pathsExplored: PathToNode = [] let pathsExplored: PathToNode = []
for (const pathItem of path) { for (const pathItem of path) {
try {
if (typeof currentNode[pathItem[0]] !== 'object') if (typeof currentNode[pathItem[0]] !== 'object')
throw new Error('not an object') return new Error('not an object')
currentNode = currentNode?.[pathItem[0]] currentNode = currentNode?.[pathItem[0]]
successfulPaths.push(pathItem) successfulPaths.push(pathItem)
if (!stopAtNode) { if (!stopAtNode) {
@ -73,15 +75,6 @@ export function getNodeFromPath<T>(
} }
} }
} }
} catch (e) {
// console.error(
// `Could not find path ${pathItem} in node ${JSON.stringify(
// currentNode,
// null,
// 2
// )}, successful path was ${successfulPaths}`
// )
}
} }
return { return {
node: stopAtNode || currentNode, node: stopAtNode || currentNode,
@ -99,17 +92,16 @@ export function getNodeFromPathCurry(
): <T>( ): <T>(
stopAt?: SyntaxType | SyntaxType[], stopAt?: SyntaxType | SyntaxType[],
returnEarly?: boolean returnEarly?: boolean
) => { ) =>
| {
node: T node: T
path: PathToNode path: PathToNode
} { }
| Error {
return <T>(stopAt?: SyntaxType | SyntaxType[], returnEarly = false) => { return <T>(stopAt?: SyntaxType | SyntaxType[], returnEarly = false) => {
const { node: _node, shallowPath } = getNodeFromPath<T>( const _node1 = getNodeFromPath<T>(node, path, stopAt, returnEarly)
node, if (err(_node1)) return _node1
path, const { node: _node, shallowPath } = _node1
stopAt,
returnEarly
)
return { return {
node: _node, node: _node,
path: shallowPath, path: shallowPath,
@ -374,17 +366,31 @@ export function findAllPreviousVariablesPath(
bodyPath: PathToNode bodyPath: PathToNode
insertIndex: number insertIndex: number
} { } {
const { shallowPath: pathToDec, node } = getNodeFromPath( const _node1 = getNodeFromPath(ast, path, 'VariableDeclaration')
ast, if (err(_node1)) {
path, console.error(_node1)
'VariableDeclaration' return {
) variables: [],
bodyPath: [],
insertIndex: 0,
}
}
const { shallowPath: pathToDec, node } = _node1
const startRange = (node as any).start const startRange = (node as any).start
const { index: insertIndex, path: bodyPath } = splitPathAtLastIndex(pathToDec) const { index: insertIndex, path: bodyPath } = splitPathAtLastIndex(pathToDec)
const { node: bodyItems } = getNodeFromPath<Program['body']>(ast, bodyPath) const _node2 = getNodeFromPath<Program['body']>(ast, bodyPath)
if (err(_node2)) {
console.error(_node2)
return {
variables: [],
bodyPath: [],
insertIndex: 0,
}
}
const { node: bodyItems } = _node2
const variables: PrevVariable<any>[] = [] const variables: PrevVariable<any>[] = []
bodyItems?.forEach?.((item) => { bodyItems?.forEach?.((item) => {
@ -422,16 +428,18 @@ export function findAllPreviousVariables(
type ReplacerFn = ( type ReplacerFn = (
_ast: Program, _ast: Program,
varName: string varName: string
) => { modifiedAst: Program; pathToReplaced: PathToNode } ) => { modifiedAst: Program; pathToReplaced: PathToNode } | Error
export function isNodeSafeToReplacePath( export function isNodeSafeToReplacePath(
ast: Program, ast: Program,
path: PathToNode path: PathToNode
): { ):
| {
isSafe: boolean isSafe: boolean
value: Value value: Value
replacer: ReplacerFn replacer: ReplacerFn
} { }
| Error {
if (path[path.length - 1][0] === 'callee') { if (path[path.length - 1][0] === 'callee') {
path = path.slice(0, -1) path = path.slice(0, -1)
} }
@ -442,16 +450,14 @@ export function isNodeSafeToReplacePath(
'Literal', 'Literal',
'UnaryExpression', 'UnaryExpression',
] ]
const { node: value, deepPath: outPath } = getNodeFromPath( const _node1 = getNodeFromPath(ast, path, acceptedNodeTypes)
ast, if (err(_node1)) return _node1
path, const { node: value, deepPath: outPath } = _node1
acceptedNodeTypes
) const _node2 = getNodeFromPath(ast, path, 'BinaryExpression')
const { node: binValue, shallowPath: outBinPath } = getNodeFromPath( if (err(_node2)) return _node2
ast, const { node: binValue, shallowPath: outBinPath } = _node2
path,
'BinaryExpression'
)
// binaryExpression should take precedence // binaryExpression should take precedence
const [finVal, finPath] = const [finVal, finPath] =
(binValue as Value)?.type === 'BinaryExpression' (binValue as Value)?.type === 'BinaryExpression'
@ -464,7 +470,9 @@ export function isNodeSafeToReplacePath(
const pathToReplaced = JSON.parse(JSON.stringify(finPath)) const pathToReplaced = JSON.parse(JSON.stringify(finPath))
pathToReplaced[1][0] = pathToReplaced[1][0] + 1 pathToReplaced[1][0] = pathToReplaced[1][0] + 1
const startPath = finPath.slice(0, -1) const startPath = finPath.slice(0, -1)
const nodeToReplace = getNodeFromPath(_ast, startPath).node as any const _nodeToReplace = getNodeFromPath(_ast, startPath)
if (err(_nodeToReplace)) return _nodeToReplace
const nodeToReplace = _nodeToReplace.node as any
nodeToReplace[last[0]] = identifier nodeToReplace[last[0]] = identifier
return { modifiedAst: _ast, pathToReplaced } return { modifiedAst: _ast, pathToReplaced }
} }
@ -485,11 +493,13 @@ export function isNodeSafeToReplacePath(
export function isNodeSafeToReplace( export function isNodeSafeToReplace(
ast: Program, ast: Program,
sourceRange: [number, number] sourceRange: [number, number]
): { ):
| {
isSafe: boolean isSafe: boolean
value: Value value: Value
replacer: ReplacerFn replacer: ReplacerFn
} { }
| Error {
let path = getNodePathFromSourceRange(ast, sourceRange) let path = getNodePathFromSourceRange(ast, sourceRange)
return isNodeSafeToReplacePath(ast, path) return isNodeSafeToReplacePath(ast, path)
} }
@ -546,28 +556,38 @@ export function isLinesParallelAndConstrained(
programMemory: ProgramMemory, programMemory: ProgramMemory,
primaryLine: Selection, primaryLine: Selection,
secondaryLine: Selection secondaryLine: Selection
): { ):
| {
isParallelAndConstrained: boolean isParallelAndConstrained: boolean
sourceRange: SourceRange sourceRange: SourceRange
} { }
| Error {
try { try {
const EPSILON = 0.005 const EPSILON = 0.005
const primaryPath = getNodePathFromSourceRange(ast, primaryLine.range) const primaryPath = getNodePathFromSourceRange(ast, primaryLine.range)
const secondaryPath = getNodePathFromSourceRange(ast, secondaryLine.range) const secondaryPath = getNodePathFromSourceRange(ast, secondaryLine.range)
const secondaryNode = getNodeFromPath<CallExpression>( const _secondaryNode = getNodeFromPath<CallExpression>(
ast, ast,
secondaryPath, secondaryPath,
'CallExpression' 'CallExpression'
).node )
const varDec = getNodeFromPath(ast, primaryPath, 'VariableDeclaration').node if (err(_secondaryNode)) return _secondaryNode
const secondaryNode = _secondaryNode.node
const _varDec = getNodeFromPath(ast, primaryPath, 'VariableDeclaration')
if (err(_varDec)) return _varDec
const varDec = _varDec.node
const varName = (varDec as VariableDeclaration)?.declarations[0]?.id?.name const varName = (varDec as VariableDeclaration)?.declarations[0]?.id?.name
const path = programMemory?.root[varName] as SketchGroup const path = programMemory?.root[varName] as SketchGroup
const primarySegment = getSketchSegmentFromSourceRange( const _primarySegment = getSketchSegmentFromSourceRange(
path, path,
primaryLine.range primaryLine.range
).segment )
const { segment: secondarySegment, index: secondaryIndex } = if (err(_primarySegment)) return _primarySegment
getSketchSegmentFromSourceRange(path, secondaryLine.range) const primarySegment = _primarySegment.segment
const _segment = getSketchSegmentFromSourceRange(path, secondaryLine.range)
if (err(_segment)) return _segment
const { segment: secondarySegment, index: secondaryIndex } = _segment
const primaryAngle = getAngle(primarySegment.from, primarySegment.to) const primaryAngle = getAngle(primarySegment.from, primarySegment.to)
const secondaryAngle = getAngle(secondarySegment.from, secondarySegment.to) const secondaryAngle = getAngle(secondarySegment.from, secondarySegment.to)
const secondaryAngleAlt = getAngle( const secondaryAngleAlt = getAngle(
@ -580,14 +600,26 @@ export function isLinesParallelAndConstrained(
// is secordary line fully constrain, or has constrain type of 'angle' // is secordary line fully constrain, or has constrain type of 'angle'
const secondaryFirstArg = getFirstArg(secondaryNode) const secondaryFirstArg = getFirstArg(secondaryNode)
if (err(secondaryFirstArg)) return secondaryFirstArg
const constraintType = getConstraintType( const constraintType = getConstraintType(
secondaryFirstArg.val, secondaryFirstArg.val,
secondaryNode.callee.name as ToolTip secondaryNode.callee.name as ToolTip
) )
const constraintLevel = getConstraintLevelFromSourceRange(
const constraintLevelMeta = getConstraintLevelFromSourceRange(
secondaryLine.range, secondaryLine.range,
ast ast
).level )
if (err(constraintLevelMeta)) {
console.error(constraintLevelMeta)
return {
isParallelAndConstrained: false,
sourceRange: [0, 0],
}
}
const constraintLevel = constraintLevelMeta.level
const isConstrained = const isConstrained =
constraintType === 'angle' || constraintLevel === 'full' constraintType === 'angle' || constraintLevel === 'full'
@ -622,11 +654,16 @@ export function doesPipeHaveCallExp({
selection: Selection selection: Selection
}): boolean { }): boolean {
const pathToNode = getNodePathFromSourceRange(ast, selection.range) const pathToNode = getNodePathFromSourceRange(ast, selection.range)
const pipeExpression = getNodeFromPath<PipeExpression>( const pipeExpressionMeta = getNodeFromPath<PipeExpression>(
ast, ast,
pathToNode, pathToNode,
'PipeExpression' 'PipeExpression'
).node )
if (err(pipeExpressionMeta)) {
console.error(pipeExpressionMeta)
return false
}
const pipeExpression = pipeExpressionMeta.node
if (pipeExpression.type !== 'PipeExpression') return false if (pipeExpression.type !== 'PipeExpression') return false
return pipeExpression.body.some( return pipeExpression.body.some(
(expression) => (expression) =>
@ -645,11 +682,16 @@ export function hasExtrudeSketchGroup({
programMemory: ProgramMemory programMemory: ProgramMemory
}): boolean { }): boolean {
const pathToNode = getNodePathFromSourceRange(ast, selection.range) const pathToNode = getNodePathFromSourceRange(ast, selection.range)
const varDec = getNodeFromPath<VariableDeclaration>( const varDecMeta = getNodeFromPath<VariableDeclaration>(
ast, ast,
pathToNode, pathToNode,
'VariableDeclaration' 'VariableDeclaration'
).node )
if (err(varDecMeta)) {
console.error(varDecMeta)
return false
}
const varDec = varDecMeta.node
if (varDec.type !== 'VariableDeclaration') return false if (varDec.type !== 'VariableDeclaration') return false
const varName = varDec.declarations[0].id.name const varName = varDec.declarations[0].id.name
const varValue = programMemory?.root[varName] const varValue = programMemory?.root[varName]
@ -679,11 +721,16 @@ export function findUsesOfTagInPipe(
'segEndY', 'segEndY',
'segLen', 'segLen',
] ]
const node = getNodeFromPath<CallExpression>( const nodeMeta = getNodeFromPath<CallExpression>(
ast, ast,
pathToNode, pathToNode,
'CallExpression' 'CallExpression'
).node )
if (err(nodeMeta)) {
console.error(nodeMeta)
return []
}
const node = nodeMeta.node
if (node.type !== 'CallExpression') return [] if (node.type !== 'CallExpression') return []
const tagIndex = node.callee.name === 'close' ? 1 : 2 const tagIndex = node.callee.name === 'close' ? 1 : 2
const thirdParam = node.arguments[tagIndex] const thirdParam = node.arguments[tagIndex]
@ -694,10 +741,14 @@ export function findUsesOfTagInPipe(
ast, ast,
pathToNode, pathToNode,
'VariableDeclaration' 'VariableDeclaration'
).node )
if (err(varDec)) {
console.error(varDec)
return []
}
const dependentRanges: SourceRange[] = [] const dependentRanges: SourceRange[] = []
traverse(varDec, { traverse(varDec.node, {
enter: (node) => { enter: (node) => {
if ( if (
node.type !== 'CallExpression' || node.type !== 'CallExpression' ||
@ -715,17 +766,17 @@ export function findUsesOfTagInPipe(
export function hasSketchPipeBeenExtruded(selection: Selection, ast: Program) { export function hasSketchPipeBeenExtruded(selection: Selection, ast: Program) {
const path = getNodePathFromSourceRange(ast, selection.range) const path = getNodePathFromSourceRange(ast, selection.range)
const { node: pipeExpression } = getNodeFromPath<PipeExpression>( const _node = getNodeFromPath<PipeExpression>(ast, path, 'PipeExpression')
ast, if (err(_node)) return false
path, const { node: pipeExpression } = _node
'PipeExpression'
)
if (pipeExpression.type !== 'PipeExpression') return false if (pipeExpression.type !== 'PipeExpression') return false
const varDec = getNodeFromPath<VariableDeclarator>( const _varDec = getNodeFromPath<VariableDeclarator>(
ast, ast,
path, path,
'VariableDeclarator' 'VariableDeclarator'
).node )
if (err(_varDec)) return false
const varDec = _varDec.node
let extruded = false let extruded = false
traverse(ast as any, { traverse(ast as any, {
enter(node) { enter(node) {

View File

@ -1,5 +1,6 @@
import { parse, Program, recast, initPromise } from './wasm' import { parse, Program, recast, initPromise } from './wasm'
import fs from 'node:fs' import fs from 'node:fs'
import { err } from 'lib/trap'
beforeAll(async () => { beforeAll(async () => {
await initPromise await initPromise
@ -10,22 +11,27 @@ describe('recast', () => {
const code = '1 + 2' const code = '1 + 2'
const { ast } = code2ast(code) const { ast } = code2ast(code)
const recasted = recast(ast) const recasted = recast(ast)
if (err(recasted)) throw recasted
expect(recasted.trim()).toBe(code) expect(recasted.trim()).toBe(code)
}) })
it('variable declaration', () => { it('variable declaration', () => {
const code = 'const myVar = 5' const code = 'const myVar = 5'
const { ast } = code2ast(code) const { ast } = code2ast(code)
const recasted = recast(ast) const recasted = recast(ast)
if (err(recasted)) throw recasted
expect(recasted.trim()).toBe(code) expect(recasted.trim()).toBe(code)
}) })
it("variable declaration that's binary with string", () => { it("variable declaration that's binary with string", () => {
const code = "const myVar = 5 + 'yo'" const code = "const myVar = 5 + 'yo'"
const { ast } = code2ast(code) const { ast } = code2ast(code)
const recasted = recast(ast) const recasted = recast(ast)
if (err(recasted)) throw recasted
expect(recasted.trim()).toBe(code) expect(recasted.trim()).toBe(code)
const codeWithOtherQuotes = 'const myVar = 5 + "yo"' const codeWithOtherQuotes = 'const myVar = 5 + "yo"'
const { ast: ast2 } = code2ast(codeWithOtherQuotes) const { ast: ast2 } = code2ast(codeWithOtherQuotes)
expect(recast(ast2).trim()).toBe(codeWithOtherQuotes) const recastRetVal = recast(ast2)
if (err(recastRetVal)) throw recastRetVal
expect(recastRetVal.trim()).toBe(codeWithOtherQuotes)
}) })
it('test assigning two variables, the second summing with the first', () => { it('test assigning two variables, the second summing with the first', () => {
const code = `const myVar = 5 const code = `const myVar = 5
@ -33,6 +39,7 @@ const newVar = myVar + 1
` `
const { ast } = code2ast(code) const { ast } = code2ast(code)
const recasted = recast(ast) const recasted = recast(ast)
if (err(recasted)) throw recasted
expect(recasted).toBe(code) expect(recasted).toBe(code)
}) })
it('test assigning a var by cont concatenating two strings string', () => { it('test assigning a var by cont concatenating two strings string', () => {
@ -42,6 +49,7 @@ const newVar = myVar + 1
) )
const { ast } = code2ast(code) const { ast } = code2ast(code)
const recasted = recast(ast) const recasted = recast(ast)
if (err(recasted)) throw recasted
expect(recasted.trim()).toBe(code.trim()) expect(recasted.trim()).toBe(code.trim())
}) })
it('test with function call', () => { it('test with function call', () => {
@ -50,6 +58,7 @@ log(5, myVar)
` `
const { ast } = code2ast(code) const { ast } = code2ast(code)
const recasted = recast(ast) const recasted = recast(ast)
if (err(recasted)) throw recasted
expect(recasted).toBe(code) expect(recasted).toBe(code)
}) })
it('function declaration with call', () => { it('function declaration with call', () => {
@ -62,6 +71,7 @@ log(5, myVar)
].join('\n') ].join('\n')
const { ast } = code2ast(code) const { ast } = code2ast(code)
const recasted = recast(ast) const recasted = recast(ast)
if (err(recasted)) throw recasted
expect(recasted.trim()).toBe(code) expect(recasted.trim()).toBe(code)
}) })
it('recast sketch declaration', () => { it('recast sketch declaration', () => {
@ -73,6 +83,7 @@ log(5, myVar)
` `
const { ast } = code2ast(code) const { ast } = code2ast(code)
const recasted = recast(ast) const recasted = recast(ast)
if (err(recasted)) throw recasted
expect(recasted).toBe(code) expect(recasted).toBe(code)
}) })
it('sketch piped into callExpression', () => { it('sketch piped into callExpression', () => {
@ -85,6 +96,7 @@ log(5, myVar)
].join('\n') ].join('\n')
const { ast } = code2ast(code) const { ast } = code2ast(code)
const recasted = recast(ast) const recasted = recast(ast)
if (err(recasted)) throw recasted
expect(recasted.trim()).toBe(code.trim()) expect(recasted.trim()).toBe(code.trim())
}) })
it('recast BinaryExpression piped into CallExpression', () => { it('recast BinaryExpression piped into CallExpression', () => {
@ -97,36 +109,42 @@ log(5, myVar)
].join('\n') ].join('\n')
const { ast } = code2ast(code) const { ast } = code2ast(code)
const recasted = recast(ast) const recasted = recast(ast)
if (err(recasted)) throw recasted
expect(recasted.trim()).toBe(code) expect(recasted.trim()).toBe(code)
}) })
it('recast nested binary expression', () => { it('recast nested binary expression', () => {
const code = ['const myVar = 1 + 2 * 5'].join('\n') const code = ['const myVar = 1 + 2 * 5'].join('\n')
const { ast } = code2ast(code) const { ast } = code2ast(code)
const recasted = recast(ast) const recasted = recast(ast)
if (err(recasted)) throw recasted
expect(recasted.trim()).toBe(code.trim()) expect(recasted.trim()).toBe(code.trim())
}) })
it('recast nested binary expression with parans', () => { it('recast nested binary expression with parans', () => {
const code = ['const myVar = 1 + (1 + 2) * 5'].join('\n') const code = ['const myVar = 1 + (1 + 2) * 5'].join('\n')
const { ast } = code2ast(code) const { ast } = code2ast(code)
const recasted = recast(ast) const recasted = recast(ast)
if (err(recasted)) throw recasted
expect(recasted.trim()).toBe(code.trim()) expect(recasted.trim()).toBe(code.trim())
}) })
it('unnecessary paran wrap will be remove', () => { it('unnecessary paran wrap will be remove', () => {
const code = ['const myVar = 1 + (2 * 5)'].join('\n') const code = ['const myVar = 1 + (2 * 5)'].join('\n')
const { ast } = code2ast(code) const { ast } = code2ast(code)
const recasted = recast(ast) const recasted = recast(ast)
if (err(recasted)) throw recasted
expect(recasted.trim()).toBe(code.replace('(', '').replace(')', '')) expect(recasted.trim()).toBe(code.replace('(', '').replace(')', ''))
}) })
it('complex nested binary expression', () => { it('complex nested binary expression', () => {
const code = ['1 * ((2 + 3) / 4 + 5)'].join('\n') const code = ['1 * ((2 + 3) / 4 + 5)'].join('\n')
const { ast } = code2ast(code) const { ast } = code2ast(code)
const recasted = recast(ast) const recasted = recast(ast)
if (err(recasted)) throw recasted
expect(recasted.trim()).toBe(code.trim()) expect(recasted.trim()).toBe(code.trim())
}) })
it('multiplied paren expressions', () => { it('multiplied paren expressions', () => {
const code = ['3 + (1 + 2) * (3 + 4)'].join('\n') const code = ['3 + (1 + 2) * (3 + 4)'].join('\n')
const { ast } = code2ast(code) const { ast } = code2ast(code)
const recasted = recast(ast) const recasted = recast(ast)
if (err(recasted)) throw recasted
expect(recasted.trim()).toBe(code.trim()) expect(recasted.trim()).toBe(code.trim())
}) })
it('recast array declaration', () => { it('recast array declaration', () => {
@ -135,6 +153,7 @@ log(5, myVar)
) )
const { ast } = code2ast(code) const { ast } = code2ast(code)
const recasted = recast(ast) const recasted = recast(ast)
if (err(recasted)) throw recasted
expect(recasted.trim()).toBe(code.trim()) expect(recasted.trim()).toBe(code.trim())
}) })
it('recast long array declaration', () => { it('recast long array declaration', () => {
@ -150,6 +169,7 @@ log(5, myVar)
].join('\n') ].join('\n')
const { ast } = code2ast(code) const { ast } = code2ast(code)
const recasted = recast(ast) const recasted = recast(ast)
if (err(recasted)) throw recasted
expect(recasted.trim()).toBe(code.trim()) expect(recasted.trim()).toBe(code.trim())
}) })
it('recast long object execution', () => { it('recast long object execution', () => {
@ -163,6 +183,7 @@ const yo = {
` `
const { ast } = code2ast(code) const { ast } = code2ast(code)
const recasted = recast(ast) const recasted = recast(ast)
if (err(recasted)) throw recasted
expect(recasted).toBe(code) expect(recasted).toBe(code)
}) })
it('recast short object execution', () => { it('recast short object execution', () => {
@ -170,6 +191,7 @@ const yo = {
` `
const { ast } = code2ast(code) const { ast } = code2ast(code)
const recasted = recast(ast) const recasted = recast(ast)
if (err(recasted)) throw recasted
expect(recasted).toBe(code) expect(recasted).toBe(code)
}) })
it('recast object execution with member expression', () => { it('recast object execution with member expression', () => {
@ -181,6 +203,7 @@ const myVar2 = yo['a'][key2].c
` `
const { ast } = code2ast(code) const { ast } = code2ast(code)
const recasted = recast(ast) const recasted = recast(ast)
if (err(recasted)) throw recasted
expect(recasted).toBe(code) expect(recasted).toBe(code)
}) })
}) })
@ -194,6 +217,7 @@ const key = 'c'
const { ast } = code2ast(code) const { ast } = code2ast(code)
const recasted = recast(ast) const recasted = recast(ast)
if (err(recasted)) throw recasted
expect(recasted).toBe(code) expect(recasted).toBe(code)
}) })
@ -207,6 +231,7 @@ const yo = 'bing'
` `
const { ast } = code2ast(code) const { ast } = code2ast(code)
const recasted = recast(ast) const recasted = recast(ast)
if (err(recasted)) throw recasted
expect(recasted).toBe(code) expect(recasted).toBe(code)
}) })
it('comments at the start and end', () => { it('comments at the start and end', () => {
@ -218,6 +243,7 @@ const key = 'c'
` `
const { ast } = code2ast(code) const { ast } = code2ast(code)
const recasted = recast(ast) const recasted = recast(ast)
if (err(recasted)) throw recasted
expect(recasted).toBe(code) expect(recasted).toBe(code)
}) })
it('comments in a fn block', () => { it('comments in a fn block', () => {
@ -233,6 +259,7 @@ const key = 'c'
` `
const { ast } = code2ast(code) const { ast } = code2ast(code)
const recasted = recast(ast) const recasted = recast(ast)
if (err(recasted)) throw recasted
expect(recasted).toBe(code) expect(recasted).toBe(code)
}) })
it('comments in a pipe expression', () => { it('comments in a pipe expression', () => {
@ -246,6 +273,7 @@ const key = 'c'
].join('\n') ].join('\n')
const { ast } = code2ast(code) const { ast } = code2ast(code)
const recasted = recast(ast) const recasted = recast(ast)
if (err(recasted)) throw recasted
expect(recasted.trim()).toBe(code) expect(recasted.trim()).toBe(code)
}) })
it('comments sprinkled in all over the place', () => { it('comments sprinkled in all over the place', () => {
@ -272,6 +300,7 @@ one more for good measure
` `
const { ast } = code2ast(code) const { ast } = code2ast(code)
const recasted = recast(ast) const recasted = recast(ast)
if (err(recasted)) throw recasted
expect(recasted).toBe(`/* comment at start */ expect(recasted).toBe(`/* comment at start */
const mySk1 = startSketchAt([0, 0]) const mySk1 = startSketchAt([0, 0])
@ -295,18 +324,21 @@ describe('testing call Expressions in BinaryExpressions and UnaryExpressions', (
const code = 'const myVar = 2 + min(100, legLen(5, 3))' const code = 'const myVar = 2 + min(100, legLen(5, 3))'
const { ast } = code2ast(code) const { ast } = code2ast(code)
const recasted = recast(ast) const recasted = recast(ast)
if (err(recasted)) throw recasted
expect(recasted.trim()).toBe(code) expect(recasted.trim()).toBe(code)
}) })
it('nested callExpression in unaryExpression', () => { it('nested callExpression in unaryExpression', () => {
const code = 'const myVar = -min(100, legLen(5, 3))' const code = 'const myVar = -min(100, legLen(5, 3))'
const { ast } = code2ast(code) const { ast } = code2ast(code)
const recasted = recast(ast) const recasted = recast(ast)
if (err(recasted)) throw recasted
expect(recasted.trim()).toBe(code) expect(recasted.trim()).toBe(code)
}) })
it('with unaryExpression in callExpression', () => { it('with unaryExpression in callExpression', () => {
const code = 'const myVar = min(5, -legLen(5, 4))' const code = 'const myVar = min(5, -legLen(5, 4))'
const { ast } = code2ast(code) const { ast } = code2ast(code)
const recasted = recast(ast) const recasted = recast(ast)
if (err(recasted)) throw recasted
expect(recasted.trim()).toBe(code) expect(recasted.trim()).toBe(code)
}) })
it('with unaryExpression in sketch situation', () => { it('with unaryExpression in sketch situation', () => {
@ -316,6 +348,7 @@ describe('testing call Expressions in BinaryExpressions and UnaryExpressions', (
].join('\n') ].join('\n')
const { ast } = code2ast(code) const { ast } = code2ast(code)
const recasted = recast(ast) const recasted = recast(ast)
if (err(recasted)) throw recasted
expect(recasted.trim()).toBe(code) expect(recasted.trim()).toBe(code)
}) })
}) })
@ -334,6 +367,7 @@ describe('it recasts wrapped object expressions in pipe bodies with correct inde
` `
const { ast } = code2ast(code) const { ast } = code2ast(code)
const recasted = recast(ast) const recasted = recast(ast)
if (err(recasted)) throw recasted
expect(recasted).toBe(code) expect(recasted).toBe(code)
}) })
it('recasts wrapped object expressions NOT in pipe body correctly', () => { it('recasts wrapped object expressions NOT in pipe body correctly', () => {
@ -345,6 +379,7 @@ describe('it recasts wrapped object expressions in pipe bodies with correct inde
` `
const { ast } = code2ast(code) const { ast } = code2ast(code)
const recasted = recast(ast) const recasted = recast(ast)
if (err(recasted)) throw recasted
expect(recasted).toBe(code) expect(recasted).toBe(code)
}) })
}) })
@ -362,5 +397,7 @@ describe('it recasts binary expression using brackets where needed', () => {
function code2ast(code: string): { ast: Program } { function code2ast(code: string): { ast: Program } {
const ast = parse(code) const ast = parse(code)
// eslint-ignore-next-line
if (err(ast)) throw ast
return { ast } return { ast }
} }

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