Compare commits
29 Commits
lf94/mac-m
...
v0.48.0
Author | SHA1 | Date | |
---|---|---|---|
cccb71fd30 | |||
44be072d04 | |||
86beb6ebf1 | |||
6d72104faa | |||
f2c5661710 | |||
ecb2359bc5 | |||
6e5058bbdc | |||
988a068d6d | |||
0688ce7fe9 | |||
f9e09893e7 | |||
dd1534a61d | |||
e17c6e272c | |||
cb0470a31d | |||
ff6186f4f0 | |||
4dd669bd46 | |||
09131722e3 | |||
87ab8fe78d | |||
bc928a34ef | |||
dca78acdf2 | |||
40f4450995 | |||
178d943423 | |||
e78788482e | |||
e50e9a00d4 | |||
dc82b4c8ea | |||
a8b0e1a771 | |||
75a975b1e1 | |||
3f02bb2065 | |||
9c986d3aa8 | |||
4741d9592b |
@ -22,6 +22,13 @@
|
|||||||
"rules": {
|
"rules": {
|
||||||
"@typescript-eslint/no-floating-promises": "error",
|
"@typescript-eslint/no-floating-promises": "error",
|
||||||
"@typescript-eslint/no-misused-promises": "error",
|
"@typescript-eslint/no-misused-promises": "error",
|
||||||
|
"@typescript-eslint/no-unused-vars": ["error", {
|
||||||
|
"varsIgnorePattern": "^_",
|
||||||
|
"argsIgnorePattern": "^_",
|
||||||
|
"ignoreRestSiblings": true,
|
||||||
|
"vars": "all",
|
||||||
|
"args": "none"
|
||||||
|
}],
|
||||||
"jsx-a11y/click-events-have-key-events": "off",
|
"jsx-a11y/click-events-have-key-events": "off",
|
||||||
"jsx-a11y/no-autofocus": "off",
|
"jsx-a11y/no-autofocus": "off",
|
||||||
"jsx-a11y/no-noninteractive-element-interactions": "off",
|
"jsx-a11y/no-noninteractive-element-interactions": "off",
|
||||||
|
66
.github/workflows/e2e-tests.yml
vendored
@ -75,7 +75,7 @@ jobs:
|
|||||||
|
|
||||||
prepare-wasm:
|
prepare-wasm:
|
||||||
# seperate job on Ubuntu to build or fetch the wasm blob once on the fastest runner
|
# seperate job on Ubuntu to build or fetch the wasm blob once on the fastest runner
|
||||||
runs-on: namespace-profile-ubuntu-8-cores
|
runs-on: runs-on=${{ github.run_id }}/family=i7ie.2xlarge/image=ubuntu22-full-x64
|
||||||
needs: conditions
|
needs: conditions
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
@ -163,7 +163,7 @@ jobs:
|
|||||||
|
|
||||||
snapshots:
|
snapshots:
|
||||||
name: playwright:snapshots:ubuntu
|
name: playwright:snapshots:ubuntu
|
||||||
runs-on: namespace-profile-ubuntu-8-cores
|
runs-on: runs-on=${{ github.run_id }}/family=i7ie.2xlarge/image=ubuntu22-full-x64
|
||||||
needs: [conditions, prepare-wasm]
|
needs: [conditions, prepare-wasm]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/create-github-app-token@v1
|
- uses: actions/create-github-app-token@v1
|
||||||
@ -220,8 +220,12 @@ jobs:
|
|||||||
|
|
||||||
- name: Run ubuntu/chrome snapshots
|
- name: Run ubuntu/chrome snapshots
|
||||||
if: needs.conditions.outputs.should-run == 'true'
|
if: needs.conditions.outputs.should-run == 'true'
|
||||||
run: |
|
uses: nick-fields/retry@v3.0.2
|
||||||
yarn test:snapshots
|
with:
|
||||||
|
shell: bash
|
||||||
|
command: yarn test:snapshots
|
||||||
|
timeout_minutes: 30
|
||||||
|
max_attempts: 3
|
||||||
env:
|
env:
|
||||||
CI: true
|
CI: true
|
||||||
NODE_ENV: development
|
NODE_ENV: development
|
||||||
@ -233,19 +237,14 @@ jobs:
|
|||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
if: ${{ needs.conditions.outputs.should-run == 'true' && !cancelled() && (success() || failure()) }}
|
if: ${{ needs.conditions.outputs.should-run == 'true' && !cancelled() && (success() || failure()) }}
|
||||||
with:
|
with:
|
||||||
name: playwright-report-snapshots-${{ matrix.os }}-snapshot-${{ matrix.shardIndex }}-${{ github.sha }}
|
name: playwright-report-ubuntu-snapshot-${{ github.sha }}
|
||||||
path: playwright-report/
|
path: playwright-report/
|
||||||
include-hidden-files: true
|
include-hidden-files: true
|
||||||
retention-days: 30
|
retention-days: 30
|
||||||
overwrite: true
|
overwrite: true
|
||||||
|
|
||||||
- name: Clean up test-results
|
|
||||||
if: ${{ needs.conditions.outputs.should-run == 'true' && !cancelled() && (success() || failure()) }}
|
|
||||||
continue-on-error: true
|
|
||||||
run: rm -r test-results
|
|
||||||
|
|
||||||
- name: check for changes
|
- name: check for changes
|
||||||
if: ${{ needs.conditions.outputs.should-run == 'true' && matrix.os == 'namespace-profile-ubuntu-8-cores' && matrix.shardIndex == 1 && github.ref != 'refs/heads/main' }}
|
if: ${{ needs.conditions.outputs.should-run == 'true' && github.ref != 'refs/heads/main' }}
|
||||||
shell: bash
|
shell: bash
|
||||||
id: git-check
|
id: git-check
|
||||||
run: |
|
run: |
|
||||||
@ -266,31 +265,36 @@ jobs:
|
|||||||
git fetch origin
|
git fetch origin
|
||||||
echo ${{ github.head_ref }}
|
echo ${{ github.head_ref }}
|
||||||
git checkout ${{ github.head_ref }}
|
git checkout ${{ github.head_ref }}
|
||||||
git commit -m "A snapshot a day keeps the bugs away! 📷🐛 (OS: ${{matrix.os}})" || true
|
git commit -m "A snapshot a day keeps the bugs away! 📷🐛" || 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: ${{ needs.conditions.outputs.should-run == 'true' && steps.git-check.outputs.modified == 'true' }}
|
|
||||||
with:
|
|
||||||
name: playwright-report-ubuntu-${{ github.sha }}
|
|
||||||
path: playwright-report/
|
|
||||||
include-hidden-files: true
|
|
||||||
retention-days: 30
|
|
||||||
|
|
||||||
|
|
||||||
electron:
|
electron:
|
||||||
needs: [conditions, prepare-wasm]
|
needs: [conditions, prepare-wasm]
|
||||||
timeout-minutes: 60
|
timeout-minutes: 60
|
||||||
name: playwright:electron:${{ matrix.os }} ${{ matrix.shardIndex }} ${{ matrix.shardTotal }}
|
env:
|
||||||
|
OS_NAME: ${{ contains(matrix.os, 'ubuntu') && 'ubuntu' || (contains(matrix.os, 'windows') && 'windows' || 'macos') }}
|
||||||
|
name: playwright:electron:${{ contains(matrix.os, 'ubuntu') && 'ubuntu' || (contains(matrix.os, 'windows') && 'windows' || 'macos') }}:${{ matrix.shardIndex }}:${{ matrix.shardTotal }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
# TODO: enable self-hosted-windows-8-cores once available
|
# TODO: enable namespace-profile-windows-latest once available
|
||||||
os: [namespace-profile-ubuntu-8-cores, namespace-profile-macos-8-cores, windows-16-cores]
|
os:
|
||||||
|
- "runs-on=${{ github.run_id }}/family=i7ie.2xlarge/image=ubuntu22-full-x64"
|
||||||
|
- namespace-profile-macos-8-cores
|
||||||
|
- windows-latest
|
||||||
shardIndex: [1, 2, 3, 4]
|
shardIndex: [1, 2, 3, 4]
|
||||||
shardTotal: [4]
|
shardTotal: [4]
|
||||||
|
# Disable macos and windows tests on hourly e2e tests since we only care
|
||||||
|
# about server side changes.
|
||||||
|
# Technique from https://github.com/joaomcteixeira/python-project-skeleton/pull/31/files
|
||||||
|
isScheduled:
|
||||||
|
- ${{ github.event_name == 'schedule' }}
|
||||||
|
exclude:
|
||||||
|
- os: namespace-profile-macos-8-cores
|
||||||
|
isScheduled: true
|
||||||
|
- os: windows-latest
|
||||||
|
isScheduled: true
|
||||||
# TODO: add ref here for main and latest release tag
|
# TODO: add ref here for main and latest release tag
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
@ -347,7 +351,7 @@ jobs:
|
|||||||
if: ${{ needs.conditions.outputs.should-run == 'true' && !cancelled() && (success() || failure()) }}
|
if: ${{ needs.conditions.outputs.should-run == 'true' && !cancelled() && (success() || failure()) }}
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
with:
|
with:
|
||||||
name: test-results-${{ matrix.os }}-${{ matrix.shardIndex }}-${{ github.sha }}
|
name: test-results-${{ env.OS_NAME }}-${{ matrix.shardIndex }}-${{ github.sha }}
|
||||||
path: test-results/
|
path: test-results/
|
||||||
|
|
||||||
- name: Run playwright/electron flow (with retries)
|
- name: Run playwright/electron flow (with retries)
|
||||||
@ -356,9 +360,9 @@ jobs:
|
|||||||
uses: nick-fields/retry@v3.0.2
|
uses: nick-fields/retry@v3.0.2
|
||||||
with:
|
with:
|
||||||
shell: bash
|
shell: bash
|
||||||
command: .github/ci-cd-scripts/playwright-electron.sh ${{matrix.shardIndex}} ${{matrix.shardTotal}} ${{matrix.os}}
|
command: .github/ci-cd-scripts/playwright-electron.sh ${{matrix.shardIndex}} ${{matrix.shardTotal}} ${{ env.OS_NAME }}
|
||||||
timeout_minutes: 30
|
timeout_minutes: 45
|
||||||
max_attempts: 25
|
max_attempts: 15
|
||||||
env:
|
env:
|
||||||
CI: true
|
CI: true
|
||||||
FAIL_ON_CONSOLE_ERRORS: true
|
FAIL_ON_CONSOLE_ERRORS: true
|
||||||
@ -370,7 +374,7 @@ jobs:
|
|||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
if: ${{ needs.conditions.outputs.should-run == 'true' && always() }}
|
if: ${{ needs.conditions.outputs.should-run == 'true' && always() }}
|
||||||
with:
|
with:
|
||||||
name: test-results-${{ matrix.os }}-${{ matrix.shardIndex }}-${{ github.sha }}
|
name: test-results-${{ env.OS_NAME }}-${{ matrix.shardIndex }}-${{ github.sha }}
|
||||||
path: test-results/
|
path: test-results/
|
||||||
include-hidden-files: true
|
include-hidden-files: true
|
||||||
retention-days: 30
|
retention-days: 30
|
||||||
@ -379,7 +383,7 @@ jobs:
|
|||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
if: ${{ needs.conditions.outputs.should-run == 'true' && always() }}
|
if: ${{ needs.conditions.outputs.should-run == 'true' && always() }}
|
||||||
with:
|
with:
|
||||||
name: playwright-report-${{ matrix.os }}-${{ matrix.shardIndex }}-${{ github.sha }}
|
name: playwright-report-${{ env.OS_NAME }}-${{ matrix.shardIndex }}-${{ github.sha }}
|
||||||
path: playwright-report/
|
path: playwright-report/
|
||||||
include-hidden-files: true
|
include-hidden-files: true
|
||||||
retention-days: 30
|
retention-days: 30
|
||||||
|
10
README.md
@ -105,7 +105,7 @@ Finally, to run the web app only, run:
|
|||||||
yarn start
|
yarn start
|
||||||
```
|
```
|
||||||
|
|
||||||
If you're not a Zoo employee you won't be able to access the dev environment, you should copy everything from `.env.production` to `.env.development` to make it point to production instead, then when you navigate to `localhost:3000` the easiest way to sign in is to paste `localStorage.setItem('TOKEN_PERSIST_KEY', "your-token-from-https://zoo.dev/account/api-tokens")` replacing the with a real token from https://zoo.dev/account/api-tokens of course, then navigate to localhost:3000 again. Note that navigating to `localhost:3000/signin` removes your token so you will need to set the token again.
|
If you're not a Zoo employee you won't be able to access the dev environment, you should copy everything from `.env.production` to `.env.development.local` to make it point to production instead, then when you navigate to `localhost:3000` the easiest way to sign in is to paste `localStorage.setItem('TOKEN_PERSIST_KEY', "your-token-from-https://zoo.dev/account/api-tokens")` replacing the with a real token from https://zoo.dev/account/api-tokens of course, then navigate to `localhost:3000` again. Note that navigating to `localhost:3000/signin` removes your token so you will need to set the token again.
|
||||||
|
|
||||||
### Development environment variables
|
### Development environment variables
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ Third-Party Cookies".
|
|||||||
|
|
||||||
## Desktop
|
## Desktop
|
||||||
|
|
||||||
To spin up the desktop app, `yarn install` and `yarn build:wasm` need to have been done before hand then
|
To spin up the desktop app, `yarn install` and `yarn build:wasm` need to have been done before hand then:
|
||||||
|
|
||||||
```
|
```
|
||||||
yarn tron:start
|
yarn tron:start
|
||||||
@ -130,13 +130,13 @@ yarn tron:start
|
|||||||
|
|
||||||
This will start the application and hot-reload on changes.
|
This will start the application and hot-reload on changes.
|
||||||
|
|
||||||
Devtools can be opened with the usual Cmd-Opt-I (Mac) or Ctrl-Shift-I (Linux and Windows).
|
Devtools can be opened with the usual Command-Option-I (macOS) or Ctrl-Shift-I (Linux and Windows).
|
||||||
|
|
||||||
To package the app for your platform with electron-builder, run `yarn tronb:package:dev` (or `yarn tronb:package:prod` to point to the .env.production variables)
|
To package the app for your platform with electron-builder, run `yarn tronb:package:dev` (or `yarn tronb:package:prod` to point to the .env.production variables).
|
||||||
|
|
||||||
## Checking out commits / Bisecting
|
## Checking out commits / Bisecting
|
||||||
|
|
||||||
Which commands from setup are one off vs need to be run every time?
|
Which commands from setup are one off vs. need to be run every time?
|
||||||
|
|
||||||
The following will need to be run when checking out a new commit and guarantees the build is not stale:
|
The following will need to be run when checking out a new commit and guarantees the build is not stale:
|
||||||
|
|
||||||
|
@ -10,11 +10,11 @@ This will work on any solid, including extruded solids, revolved solids, and she
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
appearance(
|
appearance(
|
||||||
solidSet: SolidSet,
|
solids: [Solid],
|
||||||
color: String,
|
color: String,
|
||||||
metalness?: number,
|
metalness?: number,
|
||||||
roughness?: number,
|
roughness?: number,
|
||||||
): SolidSet
|
): [Solid]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -22,14 +22,14 @@ appearance(
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `solidSet` | [`SolidSet`](/docs/kcl/types/SolidSet) | The solid(s) whose appearance is being set | Yes |
|
| `solids` | [`[Solid]`](/docs/kcl/types/Solid) | The solid(s) whose appearance is being set | Yes |
|
||||||
| `color` | `String` | Color of the new material, a hex string like '#ff0000' | Yes |
|
| `color` | `String` | Color of the new material, a hex string like '#ff0000' | Yes |
|
||||||
| `metalness` | [`number`](/docs/kcl/types/number) | Metalness of the new material, a percentage like 95.7. | No |
|
| `metalness` | [`number`](/docs/kcl/types/number) | Metalness of the new material, a percentage like 95.7. | No |
|
||||||
| `roughness` | [`number`](/docs/kcl/types/number) | Roughness of the new material, a percentage like 95.7. | No |
|
| `roughness` | [`number`](/docs/kcl/types/number) | Roughness of the new material, a percentage like 95.7. | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
[`SolidSet`](/docs/kcl/types/SolidSet) - A solid or a group of solids.
|
[`[Solid]`](/docs/kcl/types/Solid)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
@ -10,9 +10,9 @@ You can provide more than one sketch to extrude, and they will all be extruded i
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
extrude(
|
extrude(
|
||||||
sketchSet: SketchSet,
|
sketches: [Sketch],
|
||||||
length: number,
|
length: number,
|
||||||
): SolidSet
|
): [Solid]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -20,12 +20,12 @@ extrude(
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `sketchSet` | [`SketchSet`](/docs/kcl/types/SketchSet) | Which sketch or set of sketches should be extruded | Yes |
|
| `sketches` | [`[Sketch]`](/docs/kcl/types/Sketch) | Which sketch or sketches should be extruded | Yes |
|
||||||
| `length` | [`number`](/docs/kcl/types/number) | How far to extrude the given sketches | Yes |
|
| `length` | [`number`](/docs/kcl/types/number) | How far to extrude the given sketches | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
[`SolidSet`](/docs/kcl/types/SolidSet) - A solid or a group of solids.
|
[`[Solid]`](/docs/kcl/types/Solid)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
@ -10,7 +10,7 @@ Use a 2-dimensional sketch to cut a hole in another 2-dimensional sketch.
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
hole(
|
hole(
|
||||||
holeSketch: SketchSet,
|
holeSketch: [Sketch],
|
||||||
sketch: Sketch,
|
sketch: Sketch,
|
||||||
): Sketch
|
): Sketch
|
||||||
```
|
```
|
||||||
@ -20,7 +20,7 @@ hole(
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `holeSketch` | [`SketchSet`](/docs/kcl/types/SketchSet) | A sketch or a group of sketches. | Yes |
|
| `holeSketch` | [`[Sketch]`](/docs/kcl/types/Sketch) | | Yes |
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
@ -13,7 +13,7 @@ Mirror occurs around a local sketch axis rather than a global axis.
|
|||||||
```js
|
```js
|
||||||
mirror2d(
|
mirror2d(
|
||||||
data: Mirror2dData,
|
data: Mirror2dData,
|
||||||
sketchSet: SketchSet,
|
sketches: [Sketch],
|
||||||
): [Sketch]
|
): [Sketch]
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ mirror2d(
|
|||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `data` | [`Mirror2dData`](/docs/kcl/types/Mirror2dData) | Data for a mirror. | Yes |
|
| `data` | [`Mirror2dData`](/docs/kcl/types/Mirror2dData) | Data for a mirror. | Yes |
|
||||||
| `sketchSet` | [`SketchSet`](/docs/kcl/types/SketchSet) | A sketch or a group of sketches. | Yes |
|
| `sketches` | [`[Sketch]`](/docs/kcl/types/Sketch) | | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ Repeat a 2-dimensional sketch some number of times along a partial or complete c
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
patternCircular2d(
|
patternCircular2d(
|
||||||
sketchSet: SketchSet,
|
sketchSet: [Sketch],
|
||||||
instances: integer,
|
instances: integer,
|
||||||
center: [number],
|
center: [number],
|
||||||
arcDegrees: number,
|
arcDegrees: number,
|
||||||
@ -24,7 +24,7 @@ patternCircular2d(
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `sketchSet` | [`SketchSet`](/docs/kcl/types/SketchSet) | Which sketch(es) to pattern | Yes |
|
| `sketchSet` | [`[Sketch]`](/docs/kcl/types/Sketch) | Which sketch(es) to pattern | Yes |
|
||||||
| `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes |
|
| `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes |
|
||||||
| `center` | [`[number]`](/docs/kcl/types/number) | The center about which to make the pattern. This is a 2D vector. | Yes |
|
| `center` | [`[number]`](/docs/kcl/types/number) | The center about which to make the pattern. This is a 2D vector. | Yes |
|
||||||
| `arcDegrees` | [`number`](/docs/kcl/types/number) | The arc angle (in degrees) to place the repetitions. Must be greater than 0. | Yes |
|
| `arcDegrees` | [`number`](/docs/kcl/types/number) | The arc angle (in degrees) to place the repetitions. Must be greater than 0. | Yes |
|
||||||
|
@ -10,7 +10,7 @@ Repeat a 3-dimensional solid some number of times along a partial or complete ci
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
patternCircular3d(
|
patternCircular3d(
|
||||||
solidSet: SolidSet,
|
solids: [Solid],
|
||||||
instances: integer,
|
instances: integer,
|
||||||
axis: [number],
|
axis: [number],
|
||||||
center: [number],
|
center: [number],
|
||||||
@ -25,7 +25,7 @@ patternCircular3d(
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `solidSet` | [`SolidSet`](/docs/kcl/types/SolidSet) | Which solid(s) to pattern | Yes |
|
| `solids` | [`[Solid]`](/docs/kcl/types/Solid) | Which solid(s) to pattern | Yes |
|
||||||
| `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes |
|
| `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes |
|
||||||
| `axis` | [`[number]`](/docs/kcl/types/number) | The axis around which to make the pattern. This is a 3D vector | Yes |
|
| `axis` | [`[number]`](/docs/kcl/types/number) | The axis around which to make the pattern. This is a 3D vector | Yes |
|
||||||
| `center` | [`[number]`](/docs/kcl/types/number) | The center about which to make the pattern. This is a 3D vector. | Yes |
|
| `center` | [`[number]`](/docs/kcl/types/number) | The center about which to make the pattern. This is a 3D vector. | Yes |
|
||||||
|
@ -10,7 +10,7 @@ Repeat a 2-dimensional sketch along some dimension, with a dynamic amount of dis
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
patternLinear2d(
|
patternLinear2d(
|
||||||
sketchSet: SketchSet,
|
sketches: [Sketch],
|
||||||
instances: integer,
|
instances: integer,
|
||||||
distance: number,
|
distance: number,
|
||||||
axis: [number],
|
axis: [number],
|
||||||
@ -23,7 +23,7 @@ patternLinear2d(
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `sketchSet` | [`SketchSet`](/docs/kcl/types/SketchSet) | The sketch(es) to duplicate | Yes |
|
| `sketches` | [`[Sketch]`](/docs/kcl/types/Sketch) | The sketch(es) to duplicate | Yes |
|
||||||
| `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes |
|
| `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes |
|
||||||
| `distance` | [`number`](/docs/kcl/types/number) | Distance between each repetition. Also known as 'spacing'. | Yes |
|
| `distance` | [`number`](/docs/kcl/types/number) | Distance between each repetition. Also known as 'spacing'. | Yes |
|
||||||
| `axis` | [`[number]`](/docs/kcl/types/number) | The axis of the pattern. A 2D vector. | Yes |
|
| `axis` | [`[number]`](/docs/kcl/types/number) | The axis of the pattern. A 2D vector. | Yes |
|
||||||
|
@ -10,7 +10,7 @@ Repeat a 3-dimensional solid along a linear path, with a dynamic amount of dista
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
patternLinear3d(
|
patternLinear3d(
|
||||||
solidSet: SolidSet,
|
solids: [Solid],
|
||||||
instances: integer,
|
instances: integer,
|
||||||
distance: number,
|
distance: number,
|
||||||
axis: [number],
|
axis: [number],
|
||||||
@ -23,7 +23,7 @@ patternLinear3d(
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `solidSet` | [`SolidSet`](/docs/kcl/types/SolidSet) | The solid(s) to duplicate | Yes |
|
| `solids` | [`[Solid]`](/docs/kcl/types/Solid) | The solid(s) to duplicate | Yes |
|
||||||
| `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes |
|
| `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes |
|
||||||
| `distance` | [`number`](/docs/kcl/types/number) | Distance between each repetition. Also known as 'spacing'. | Yes |
|
| `distance` | [`number`](/docs/kcl/types/number) | Distance between each repetition. Also known as 'spacing'. | Yes |
|
||||||
| `axis` | [`[number]`](/docs/kcl/types/number) | The axis of the pattern. A 2D vector. | Yes |
|
| `axis` | [`[number]`](/docs/kcl/types/number) | The axis of the pattern. A 2D vector. | Yes |
|
||||||
|
@ -36,7 +36,7 @@ The transform function returns a transform object. All properties of the object
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
patternTransform(
|
patternTransform(
|
||||||
solidSet: SolidSet,
|
solids: [Solid],
|
||||||
instances: integer,
|
instances: integer,
|
||||||
transform: FunctionSource,
|
transform: FunctionSource,
|
||||||
useOriginal?: bool,
|
useOriginal?: bool,
|
||||||
@ -48,7 +48,7 @@ patternTransform(
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `solidSet` | [`SolidSet`](/docs/kcl/types/SolidSet) | The solid(s) to duplicate | Yes |
|
| `solids` | [`[Solid]`](/docs/kcl/types/Solid) | The solid(s) to duplicate | Yes |
|
||||||
| `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes |
|
| `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes |
|
||||||
| `transform` | `FunctionSource` | How each replica should be transformed. The transform function takes a single parameter: an integer representing which number replication the transform is for. E.g. the first replica to be transformed will be passed the argument `1`. This simplifies your math: the transform function can rely on id `0` being the original instance passed into the `patternTransform`. See the examples. | Yes |
|
| `transform` | `FunctionSource` | How each replica should be transformed. The transform function takes a single parameter: an integer representing which number replication the transform is for. E.g. the first replica to be transformed will be passed the argument `1`. This simplifies your math: the transform function can rely on id `0` being the original instance passed into the `patternTransform`. See the examples. | Yes |
|
||||||
| `useOriginal` | [`bool`](/docs/kcl/types/bool) | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No |
|
| `useOriginal` | [`bool`](/docs/kcl/types/bool) | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No |
|
||||||
|
@ -10,7 +10,7 @@ Just like patternTransform, but works on 2D sketches not 3D solids.
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
patternTransform2d(
|
patternTransform2d(
|
||||||
sketchSet: SketchSet,
|
sketches: [Sketch],
|
||||||
instances: integer,
|
instances: integer,
|
||||||
transform: FunctionSource,
|
transform: FunctionSource,
|
||||||
useOriginal?: bool,
|
useOriginal?: bool,
|
||||||
@ -22,7 +22,7 @@ patternTransform2d(
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `sketchSet` | [`SketchSet`](/docs/kcl/types/SketchSet) | The sketch(es) to duplicate | Yes |
|
| `sketches` | [`[Sketch]`](/docs/kcl/types/Sketch) | The sketch(es) to duplicate | Yes |
|
||||||
| `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes |
|
| `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes |
|
||||||
| `transform` | `FunctionSource` | How each replica should be transformed. The transform function takes a single parameter: an integer representing which number replication the transform is for. E.g. the first replica to be transformed will be passed the argument `1`. This simplifies your math: the transform function can rely on id `0` being the original instance passed into the `patternTransform`. See the examples. | Yes |
|
| `transform` | `FunctionSource` | How each replica should be transformed. The transform function takes a single parameter: an integer representing which number replication the transform is for. E.g. the first replica to be transformed will be passed the argument `1`. This simplifies your math: the transform function can rely on id `0` being the original instance passed into the `patternTransform`. See the examples. | Yes |
|
||||||
| `useOriginal` | [`bool`](/docs/kcl/types/bool) | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No |
|
| `useOriginal` | [`bool`](/docs/kcl/types/bool) | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No |
|
||||||
|
@ -15,8 +15,8 @@ You can provide more than one sketch to revolve, and they will all be revolved a
|
|||||||
```js
|
```js
|
||||||
revolve(
|
revolve(
|
||||||
data: RevolveData,
|
data: RevolveData,
|
||||||
sketchSet: SketchSet,
|
sketches: [Sketch],
|
||||||
): SolidSet
|
): [Solid]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -25,11 +25,11 @@ revolve(
|
|||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `data` | [`RevolveData`](/docs/kcl/types/RevolveData) | Data for revolution surfaces. | Yes |
|
| `data` | [`RevolveData`](/docs/kcl/types/RevolveData) | Data for revolution surfaces. | Yes |
|
||||||
| `sketchSet` | [`SketchSet`](/docs/kcl/types/SketchSet) | A sketch or a group of sketches. | Yes |
|
| `sketches` | [`[Sketch]`](/docs/kcl/types/Sketch) | | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
[`SolidSet`](/docs/kcl/types/SolidSet) - A solid or a group of solids.
|
[`[Solid]`](/docs/kcl/types/Solid)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
@ -24,7 +24,7 @@ When rotating a part around an axis, you specify the axis of rotation and the an
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
rotate(
|
rotate(
|
||||||
solidSet: SolidOrImportedGeometry,
|
solids: SolidOrImportedGeometry,
|
||||||
roll?: number,
|
roll?: number,
|
||||||
pitch?: number,
|
pitch?: number,
|
||||||
yaw?: number,
|
yaw?: number,
|
||||||
@ -39,7 +39,7 @@ rotate(
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `solidSet` | [`SolidOrImportedGeometry`](/docs/kcl/types/SolidOrImportedGeometry) | The solid or set of solids to rotate. | Yes |
|
| `solids` | [`SolidOrImportedGeometry`](/docs/kcl/types/SolidOrImportedGeometry) | The solid or set of solids to rotate. | Yes |
|
||||||
| `roll` | [`number`](/docs/kcl/types/number) | The roll angle in degrees. Must be used with `pitch` and `yaw`. Must be between -360 and 360. | No |
|
| `roll` | [`number`](/docs/kcl/types/number) | The roll angle in degrees. Must be used with `pitch` and `yaw`. Must be between -360 and 360. | No |
|
||||||
| `pitch` | [`number`](/docs/kcl/types/number) | The pitch angle in degrees. Must be used with `roll` and `yaw`. Must be between -360 and 360. | No |
|
| `pitch` | [`number`](/docs/kcl/types/number) | The pitch angle in degrees. Must be used with `roll` and `yaw`. Must be between -360 and 360. | No |
|
||||||
| `yaw` | [`number`](/docs/kcl/types/number) | The yaw angle in degrees. Must be used with `roll` and `pitch`. Must be between -360 and 360. | No |
|
| `yaw` | [`number`](/docs/kcl/types/number) | The yaw angle in degrees. Must be used with `roll` and `pitch`. Must be between -360 and 360. | No |
|
||||||
|
@ -12,7 +12,7 @@ If you want to apply the transform in global space, set `global` to `true`. The
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
scale(
|
scale(
|
||||||
solidSet: SolidOrImportedGeometry,
|
solids: SolidOrImportedGeometry,
|
||||||
scale: [number],
|
scale: [number],
|
||||||
global?: bool,
|
global?: bool,
|
||||||
): SolidOrImportedGeometry
|
): SolidOrImportedGeometry
|
||||||
@ -23,7 +23,7 @@ scale(
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `solidSet` | [`SolidOrImportedGeometry`](/docs/kcl/types/SolidOrImportedGeometry) | The solid or set of solids to scale. | Yes |
|
| `solids` | [`SolidOrImportedGeometry`](/docs/kcl/types/SolidOrImportedGeometry) | The solid or set of solids to scale. | Yes |
|
||||||
| `scale` | [`[number]`](/docs/kcl/types/number) | The scale factor for the x, y, and z axes. | Yes |
|
| `scale` | [`[number]`](/docs/kcl/types/number) | The scale factor for the x, y, and z axes. | Yes |
|
||||||
| `global` | [`bool`](/docs/kcl/types/bool) | If true, the transform is applied in global space. The origin of the model will move. By default, the transform is applied in local sketch axis, therefore the origin will not move. | No |
|
| `global` | [`bool`](/docs/kcl/types/bool) | If true, the transform is applied in global space. The origin of the model will move. By default, the transform is applied in local sketch axis, therefore the origin will not move. | No |
|
||||||
|
|
||||||
|
@ -10,10 +10,10 @@ Remove volume from a 3-dimensional shape such that a wall of the provided thickn
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
shell(
|
shell(
|
||||||
solidSet: SolidSet,
|
solids: [Solid],
|
||||||
thickness: number,
|
thickness: number,
|
||||||
faces: [FaceTag],
|
faces: [FaceTag],
|
||||||
): SolidSet
|
): [Solid]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -21,13 +21,13 @@ shell(
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `solidSet` | [`SolidSet`](/docs/kcl/types/SolidSet) | Which solid (or solids) to shell out | Yes |
|
| `solids` | [`[Solid]`](/docs/kcl/types/Solid) | Which solid (or solids) to shell out | Yes |
|
||||||
| `thickness` | [`number`](/docs/kcl/types/number) | The thickness of the shell | Yes |
|
| `thickness` | [`number`](/docs/kcl/types/number) | The thickness of the shell | Yes |
|
||||||
| `faces` | [`[FaceTag]`](/docs/kcl/types/FaceTag) | The faces you want removed | Yes |
|
| `faces` | [`[FaceTag]`](/docs/kcl/types/FaceTag) | The faces you want removed | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
[`SolidSet`](/docs/kcl/types/SolidSet) - A solid or a group of solids.
|
[`[Solid]`](/docs/kcl/types/Solid)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
80930
docs/kcl/std.json
@ -12,11 +12,11 @@ You can provide more than one sketch to sweep, and they will all be swept along
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
sweep(
|
sweep(
|
||||||
sketchSet: SketchSet,
|
sketches: [Sketch],
|
||||||
path: SweepPath,
|
path: SweepPath,
|
||||||
sectional?: bool,
|
sectional?: bool,
|
||||||
tolerance?: number,
|
tolerance?: number,
|
||||||
): SolidSet
|
): [Solid]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -24,14 +24,14 @@ sweep(
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `sketchSet` | [`SketchSet`](/docs/kcl/types/SketchSet) | The sketch or set of sketches that should be swept in space | Yes |
|
| `sketches` | [`[Sketch]`](/docs/kcl/types/Sketch) | The sketch or set of sketches that should be swept in space | Yes |
|
||||||
| `path` | [`SweepPath`](/docs/kcl/types/SweepPath) | The path to sweep the sketch along | Yes |
|
| `path` | [`SweepPath`](/docs/kcl/types/SweepPath) | The path to sweep the sketch along | Yes |
|
||||||
| `sectional` | [`bool`](/docs/kcl/types/bool) | If true, the sweep will be broken up into sub-sweeps (extrusions, revolves, sweeps) based on the trajectory path components. | No |
|
| `sectional` | [`bool`](/docs/kcl/types/bool) | If true, the sweep will be broken up into sub-sweeps (extrusions, revolves, sweeps) based on the trajectory path components. | No |
|
||||||
| `tolerance` | [`number`](/docs/kcl/types/number) | Tolerance for this operation | No |
|
| `tolerance` | [`number`](/docs/kcl/types/number) | Tolerance for this operation | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
[`SolidSet`](/docs/kcl/types/SolidSet) - A solid or a group of solids.
|
[`[Solid]`](/docs/kcl/types/Solid)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
@ -10,7 +10,7 @@ Move a solid.
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
translate(
|
translate(
|
||||||
solidSet: SolidOrImportedGeometry,
|
solids: SolidOrImportedGeometry,
|
||||||
translate: [number],
|
translate: [number],
|
||||||
global?: bool,
|
global?: bool,
|
||||||
): SolidOrImportedGeometry
|
): SolidOrImportedGeometry
|
||||||
@ -21,7 +21,7 @@ translate(
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `solidSet` | [`SolidOrImportedGeometry`](/docs/kcl/types/SolidOrImportedGeometry) | The solid or set of solids to move. | Yes |
|
| `solids` | [`SolidOrImportedGeometry`](/docs/kcl/types/SolidOrImportedGeometry) | The solid or set of solids to move. | Yes |
|
||||||
| `translate` | [`[number]`](/docs/kcl/types/number) | The amount to move the solid in all three axes. | Yes |
|
| `translate` | [`[number]`](/docs/kcl/types/number) | The amount to move the solid in all three axes. | Yes |
|
||||||
| `global` | [`bool`](/docs/kcl/types/bool) | If true, the transform is applied in global space. The origin of the model will move. By default, the transform is applied in local sketch axis, therefore the origin will not move. | No |
|
| `global` | [`bool`](/docs/kcl/types/bool) | If true, the transform is applied in global space. The origin of the model will move. By default, the transform is applied in local sketch axis, therefore the origin will not move. | No |
|
||||||
|
|
||||||
|
@ -100,6 +100,22 @@ Any KCL value.
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
| Property | Type | Description | Required |
|
||||||
|
|----------|------|-------------|----------|
|
||||||
|
| `type` |enum: `HomArray`| | No |
|
||||||
|
| `value` |`[` [`KclValue`](/docs/kcl/types/KclValue) `]`| | No |
|
||||||
|
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
**Type:** `object`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
@ -122,7 +138,6 @@ Any KCL value.
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`TagIdentifier`](/docs/kcl/types#tag-identifier)| | No |
|
| `type` |enum: [`TagIdentifier`](/docs/kcl/types#tag-identifier)| | No |
|
||||||
| `value` |[`string`](/docs/kcl/types/string)| | No |
|
| `value` |[`string`](/docs/kcl/types/string)| | No |
|
||||||
| `info` |[`TagEngineInfo`](/docs/kcl/types/TagEngineInfo)| | No |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -200,22 +215,6 @@ Any KCL value.
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
|
|
||||||
| Property | Type | Description | Required |
|
|
||||||
|----------|------|-------------|----------|
|
|
||||||
| `type` |enum: `Sketches`| | No |
|
|
||||||
| `value` |`[` [`Sketch`](/docs/kcl/types/Sketch) `]`| | No |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
**Type:** `object`
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
@ -232,22 +231,6 @@ Any KCL value.
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
|
|
||||||
| Property | Type | Description | Required |
|
|
||||||
|----------|------|-------------|----------|
|
|
||||||
| `type` |enum: `Solids`| | No |
|
|
||||||
| `value` |`[` [`Solid`](/docs/kcl/types/Solid) `]`| | No |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
**Type:** `object`
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
@ -338,22 +321,6 @@ Data for an imported geometry.
|
|||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
**Type:** `object`
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
|
|
||||||
| Property | Type | Description | Required |
|
|
||||||
|----------|------|-------------|----------|
|
|
||||||
| `type` |enum: `Tombstone`| | No |
|
|
||||||
| `value` |`null`| | No |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -126,6 +126,30 @@ A base path.
|
|||||||
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
||||||
|
|
||||||
|
|
||||||
|
----
|
||||||
|
A base path.
|
||||||
|
|
||||||
|
**Type:** `object`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
| Property | Type | Description | Required |
|
||||||
|
|----------|------|-------------|----------|
|
||||||
|
| `type` |enum: `ArcThreePoint`| | No |
|
||||||
|
| `p1` |`[number, number]`| Point 1 of the arc (base on the end of previous segment) | No |
|
||||||
|
| `p2` |`[number, number]`| Point 2 of the arc (interior kwarg) | No |
|
||||||
|
| `p3` |`[number, number]`| Point 3 of the arc (end kwarg) | No |
|
||||||
|
| `from` |`[number, number]`| The from point. | No |
|
||||||
|
| `to` |`[number, number]`| The to point. | No |
|
||||||
|
| `units` |[`UnitLen`](/docs/kcl/types/UnitLen)| A unit of length. | No |
|
||||||
|
| [`tag`](/docs/kcl/types/tag) |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag of the path. | No |
|
||||||
|
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
A path that is horizontal.
|
A path that is horizontal.
|
||||||
|
|
||||||
|
@ -1,56 +0,0 @@
|
|||||||
---
|
|
||||||
title: "SketchSet"
|
|
||||||
excerpt: "A sketch or a group of sketches."
|
|
||||||
layout: manual
|
|
||||||
---
|
|
||||||
|
|
||||||
A sketch or a group of sketches.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
**This schema accepts exactly one of the following:**
|
|
||||||
|
|
||||||
|
|
||||||
**Type:** `object`
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
|
|
||||||
| Property | Type | Description | Required |
|
|
||||||
|----------|------|-------------|----------|
|
|
||||||
| `type` |enum: `sketch`| | No |
|
|
||||||
| `id` |[`string`](/docs/kcl/types/string)| The id of the sketch (this will change when the engine's reference to it changes). | No |
|
|
||||||
| `paths` |`[` [`Path`](/docs/kcl/types/Path) `]`| The paths in the sketch. | No |
|
|
||||||
| `on` |[`SketchSurface`](/docs/kcl/types/SketchSurface)| What the sketch is on (can be a plane or a face). | No |
|
|
||||||
| `start` |[`BasePath`](/docs/kcl/types/BasePath)| The starting path. | No |
|
|
||||||
| `tags` |`object`| Tag identifiers that have been declared in this sketch. | No |
|
|
||||||
| `artifactId` |[`ArtifactId`](/docs/kcl/types/ArtifactId)| The original id of the sketch. This stays the same even if the sketch is is sketched on face etc. | No |
|
|
||||||
| `originalId` |[`string`](/docs/kcl/types/string)| | No |
|
|
||||||
| `units` |[`UnitLen`](/docs/kcl/types/UnitLen)| A unit of length. | No |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
**Type:** `[object, array]`
|
|
||||||
|
|
||||||
`[` [`Sketch`](/docs/kcl/types/Sketch) `]`
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
|
|
||||||
| Property | Type | Description | Required |
|
|
||||||
|----------|------|-------------|----------|
|
|
||||||
| `type` |enum: `sketches`| | No |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -12,30 +12,6 @@ Data for a solid or an imported geometry.
|
|||||||
|
|
||||||
**This schema accepts exactly one of the following:**
|
**This schema accepts exactly one of the following:**
|
||||||
|
|
||||||
|
|
||||||
**Type:** `object`
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
|
|
||||||
| Property | Type | Description | Required |
|
|
||||||
|----------|------|-------------|----------|
|
|
||||||
| `type` |enum: `solid`| | No |
|
|
||||||
| `id` |[`string`](/docs/kcl/types/string)| The id of the solid. | No |
|
|
||||||
| `artifactId` |[`ArtifactId`](/docs/kcl/types/ArtifactId)| The artifact ID of the solid. Unlike `id`, this doesn't change. | No |
|
|
||||||
| `value` |`[` [`ExtrudeSurface`](/docs/kcl/types/ExtrudeSurface) `]`| The extrude surfaces. | No |
|
|
||||||
| `sketch` |[`Sketch`](/docs/kcl/types/Sketch)| The sketch. | No |
|
|
||||||
| `height` |[`number`](/docs/kcl/types/number)| The height of the solid. | No |
|
|
||||||
| `startCapId` |[`string`](/docs/kcl/types/string)| The id of the extrusion start cap | No |
|
|
||||||
| `endCapId` |[`string`](/docs/kcl/types/string)| The id of the extrusion end cap | No |
|
|
||||||
| `edgeCuts` |`[` [`EdgeCut`](/docs/kcl/types/EdgeCut) `]`| Chamfers or fillets on this solid. | No |
|
|
||||||
| `units` |[`UnitLen`](/docs/kcl/types/UnitLen)| A unit of length. | No |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
|
||||||
Data for an imported geometry.
|
Data for an imported geometry.
|
||||||
|
|
||||||
**Type:** `object`
|
**Type:** `object`
|
||||||
|
@ -1,57 +0,0 @@
|
|||||||
---
|
|
||||||
title: "SolidSet"
|
|
||||||
excerpt: "A solid or a group of solids."
|
|
||||||
layout: manual
|
|
||||||
---
|
|
||||||
|
|
||||||
A solid or a group of solids.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
**This schema accepts exactly one of the following:**
|
|
||||||
|
|
||||||
|
|
||||||
**Type:** `object`
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
|
|
||||||
| Property | Type | Description | Required |
|
|
||||||
|----------|------|-------------|----------|
|
|
||||||
| `type` |enum: `solid`| | No |
|
|
||||||
| `id` |[`string`](/docs/kcl/types/string)| The id of the solid. | No |
|
|
||||||
| `artifactId` |[`ArtifactId`](/docs/kcl/types/ArtifactId)| The artifact ID of the solid. Unlike `id`, this doesn't change. | No |
|
|
||||||
| `value` |`[` [`ExtrudeSurface`](/docs/kcl/types/ExtrudeSurface) `]`| The extrude surfaces. | No |
|
|
||||||
| `sketch` |[`Sketch`](/docs/kcl/types/Sketch)| The sketch. | No |
|
|
||||||
| `height` |[`number`](/docs/kcl/types/number)| The height of the solid. | No |
|
|
||||||
| `startCapId` |[`string`](/docs/kcl/types/string)| The id of the extrusion start cap | No |
|
|
||||||
| `endCapId` |[`string`](/docs/kcl/types/string)| The id of the extrusion end cap | No |
|
|
||||||
| `edgeCuts` |`[` [`EdgeCut`](/docs/kcl/types/EdgeCut) `]`| Chamfers or fillets on this solid. | No |
|
|
||||||
| `units` |[`UnitLen`](/docs/kcl/types/UnitLen)| A unit of length. | No |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
**Type:** `[object, array]`
|
|
||||||
|
|
||||||
`[` [`Solid`](/docs/kcl/types/Solid) `]`
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
|
|
||||||
| Property | Type | Description | Required |
|
|
||||||
|----------|------|-------------|----------|
|
|
||||||
| `type` |enum: `solids`| | No |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -100,7 +100,8 @@ test(
|
|||||||
try {
|
try {
|
||||||
const outputGltf = await fsp.readFile(firstFileFullPath)
|
const outputGltf = await fsp.readFile(firstFileFullPath)
|
||||||
return outputGltf.byteLength
|
return outputGltf.byteLength
|
||||||
} catch (e) {
|
} catch (error: unknown) {
|
||||||
|
void error
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -179,7 +180,8 @@ test(
|
|||||||
try {
|
try {
|
||||||
const outputGltf = await fsp.readFile(secondFileFullPath)
|
const outputGltf = await fsp.readFile(secondFileFullPath)
|
||||||
return outputGltf.byteLength
|
return outputGltf.byteLength
|
||||||
} catch (e) {
|
} catch (error: unknown) {
|
||||||
|
void error
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1197,7 +1197,7 @@ test.describe('Undo and redo do not keep history when navigating between files',
|
|||||||
`cloned file has an incremented name and same contents`,
|
`cloned file has an incremented name and same contents`,
|
||||||
{ tag: '@electron' },
|
{ tag: '@electron' },
|
||||||
async ({ page, context, homePage }, testInfo) => {
|
async ({ page, context, homePage }, testInfo) => {
|
||||||
const { panesOpen, createNewFile, cloneFile } = await getUtils(page, test)
|
const { panesOpen, cloneFile } = await getUtils(page, test)
|
||||||
|
|
||||||
const { dir } = await context.folderSetupFn(async (dir) => {
|
const { dir } = await context.folderSetupFn(async (dir) => {
|
||||||
const finalDir = join(dir, 'testDefault')
|
const finalDir = join(dir, 'testDefault')
|
||||||
|
@ -3,25 +3,15 @@
|
|||||||
import type {
|
import type {
|
||||||
BrowserContext,
|
BrowserContext,
|
||||||
ElectronApplication,
|
ElectronApplication,
|
||||||
Fixtures as PlaywrightFixtures,
|
|
||||||
TestInfo,
|
TestInfo,
|
||||||
Page,
|
Page,
|
||||||
} from '@playwright/test'
|
} from '@playwright/test'
|
||||||
|
|
||||||
import {
|
import { _electron as electron } from '@playwright/test'
|
||||||
_electron as electron,
|
|
||||||
PlaywrightTestArgs,
|
|
||||||
PlaywrightWorkerArgs,
|
|
||||||
} from '@playwright/test'
|
|
||||||
|
|
||||||
import * as TOML from '@iarna/toml'
|
import * as TOML from '@iarna/toml'
|
||||||
import {
|
import { TEST_SETTINGS } from '../storageStates'
|
||||||
TEST_SETTINGS_KEY,
|
import { SETTINGS_FILE_NAME } from 'lib/constants'
|
||||||
TEST_SETTINGS_CORRUPTED,
|
|
||||||
TEST_SETTINGS,
|
|
||||||
TEST_SETTINGS_DEFAULT_THEME,
|
|
||||||
} from '../storageStates'
|
|
||||||
import { SETTINGS_FILE_NAME, PROJECT_SETTINGS_FILE_NAME } from 'lib/constants'
|
|
||||||
import { getUtils, setup } from '../test-utils'
|
import { getUtils, setup } from '../test-utils'
|
||||||
import fsp from 'fs/promises'
|
import fsp from 'fs/promises'
|
||||||
import fs from 'node:fs'
|
import fs from 'node:fs'
|
||||||
@ -31,7 +21,6 @@ import { EditorFixture } from './editorFixture'
|
|||||||
import { ToolbarFixture } from './toolbarFixture'
|
import { ToolbarFixture } from './toolbarFixture'
|
||||||
import { SceneFixture } from './sceneFixture'
|
import { SceneFixture } from './sceneFixture'
|
||||||
import { HomePageFixture } from './homePageFixture'
|
import { HomePageFixture } from './homePageFixture'
|
||||||
import { unsafeTypedKeys } from 'lib/utils'
|
|
||||||
import { DeepPartial } from 'lib/types'
|
import { DeepPartial } from 'lib/types'
|
||||||
import { Settings } from '@rust/kcl-lib/bindings/Settings'
|
import { Settings } from '@rust/kcl-lib/bindings/Settings'
|
||||||
|
|
||||||
@ -278,13 +267,14 @@ export class ElectronZoo {
|
|||||||
if (fs.existsSync(this.projectDirName)) {
|
if (fs.existsSync(this.projectDirName)) {
|
||||||
await fsp.rm(this.projectDirName, { recursive: true })
|
await fsp.rm(this.projectDirName, { recursive: true })
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (_e) {
|
||||||
console.error(e)
|
console.error(_e)
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await fsp.mkdir(this.projectDirName)
|
await fsp.mkdir(this.projectDirName)
|
||||||
} catch (e) {
|
} catch (error: unknown) {
|
||||||
|
void error
|
||||||
// Not a problem if it already exists.
|
// Not a problem if it already exists.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ import {
|
|||||||
} from '../test-utils'
|
} from '../test-utils'
|
||||||
import { SidebarType } from 'components/ModelingSidebar/ModelingPanes'
|
import { SidebarType } from 'components/ModelingSidebar/ModelingPanes'
|
||||||
import { SIDEBAR_BUTTON_SUFFIX } from 'lib/constants'
|
import { SIDEBAR_BUTTON_SUFFIX } from 'lib/constants'
|
||||||
|
import { ToolbarModeName } from 'lib/toolbar'
|
||||||
|
|
||||||
export class ToolbarFixture {
|
export class ToolbarFixture {
|
||||||
public page: Page
|
public page: Page
|
||||||
@ -120,6 +121,15 @@ export class ToolbarFixture {
|
|||||||
// this is for the engine animation, as it takes 500ms to complete
|
// this is for the engine animation, as it takes 500ms to complete
|
||||||
await this.page.waitForTimeout(600)
|
await this.page.waitForTimeout(600)
|
||||||
}
|
}
|
||||||
|
private _getMode = () =>
|
||||||
|
this.page.locator('[data-current-mode]').getAttribute('data-current-mode')
|
||||||
|
expectToolbarMode = {
|
||||||
|
toBe: (mode: ToolbarModeName) => expect.poll(this._getMode).toEqual(mode),
|
||||||
|
not: {
|
||||||
|
toBe: (mode: ToolbarModeName) =>
|
||||||
|
expect.poll(this._getMode).not.toEqual(mode),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
private _serialiseFileTree = async () => {
|
private _serialiseFileTree = async () => {
|
||||||
return this.page
|
return this.page
|
||||||
@ -176,6 +186,22 @@ export class ToolbarFixture {
|
|||||||
).toBeVisible()
|
).toBeVisible()
|
||||||
await this.page.getByTestId('dropdown-circle-three-points').click()
|
await this.page.getByTestId('dropdown-circle-three-points').click()
|
||||||
}
|
}
|
||||||
|
selectArc = async () => {
|
||||||
|
await this.page
|
||||||
|
.getByRole('button', { name: 'caret down Tangential Arc:' })
|
||||||
|
.click()
|
||||||
|
await expect(this.page.getByTestId('dropdown-arc')).toBeVisible()
|
||||||
|
await this.page.getByTestId('dropdown-arc').click()
|
||||||
|
}
|
||||||
|
selectThreePointArc = async () => {
|
||||||
|
await this.page
|
||||||
|
.getByRole('button', { name: 'caret down Tangential Arc:' })
|
||||||
|
.click()
|
||||||
|
await expect(
|
||||||
|
this.page.getByTestId('dropdown-three-point-arc')
|
||||||
|
).toBeVisible()
|
||||||
|
await this.page.getByTestId('dropdown-three-point-arc').click()
|
||||||
|
}
|
||||||
|
|
||||||
async closePane(paneId: SidebarType) {
|
async closePane(paneId: SidebarType) {
|
||||||
return closePane(this.page, paneId + SIDEBAR_BUTTON_SUFFIX)
|
return closePane(this.page, paneId + SIDEBAR_BUTTON_SUFFIX)
|
||||||
|
@ -1024,7 +1024,7 @@ openSketch = startSketchOn('XY')
|
|||||||
await page.waitForTimeout(15000)
|
await page.waitForTimeout(15000)
|
||||||
|
|
||||||
await test.step(`Look for the blue of the XZ plane`, async () => {
|
await test.step(`Look for the blue of the XZ plane`, async () => {
|
||||||
await scene.expectPixelColor([50, 51, 96], testPoint, 15)
|
//await scene.expectPixelColor([50, 51, 96], testPoint, 15) // FIXME
|
||||||
})
|
})
|
||||||
await test.step(`Go through the command bar flow`, async () => {
|
await test.step(`Go through the command bar flow`, async () => {
|
||||||
await toolbar.offsetPlaneButton.click()
|
await toolbar.offsetPlaneButton.click()
|
||||||
@ -1066,7 +1066,7 @@ openSketch = startSketchOn('XY')
|
|||||||
)
|
)
|
||||||
await operationButton.click({ button: 'left' })
|
await operationButton.click({ button: 'left' })
|
||||||
await page.keyboard.press('Delete')
|
await page.keyboard.press('Delete')
|
||||||
await scene.expectPixelColor([50, 51, 96], testPoint, 15)
|
//await scene.expectPixelColor([50, 51, 96], testPoint, 15) // FIXME
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -1906,7 +1906,6 @@ extrude001 = extrude(sketch001, length = -12)
|
|||||||
// Locators
|
// Locators
|
||||||
const firstEdgeLocation = { x: 600, y: 193 }
|
const firstEdgeLocation = { x: 600, y: 193 }
|
||||||
const secondEdgeLocation = { x: 600, y: 383 }
|
const secondEdgeLocation = { x: 600, y: 383 }
|
||||||
const bodyLocation = { x: 630, y: 290 }
|
|
||||||
const [clickOnFirstEdge] = scene.makeMouseHelpers(
|
const [clickOnFirstEdge] = scene.makeMouseHelpers(
|
||||||
firstEdgeLocation.x,
|
firstEdgeLocation.x,
|
||||||
firstEdgeLocation.y
|
firstEdgeLocation.y
|
||||||
@ -1919,7 +1918,6 @@ extrude001 = extrude(sketch001, length = -12)
|
|||||||
// Colors
|
// Colors
|
||||||
const edgeColorWhite: [number, number, number] = [248, 248, 248]
|
const edgeColorWhite: [number, number, number] = [248, 248, 248]
|
||||||
const edgeColorYellow: [number, number, number] = [251, 251, 40] // Mac:B=67 Ubuntu:B=12
|
const edgeColorYellow: [number, number, number] = [251, 251, 40] // Mac:B=67 Ubuntu:B=12
|
||||||
const bodyColor: [number, number, number] = [155, 155, 155]
|
|
||||||
const chamferColor: [number, number, number] = [168, 168, 168]
|
const chamferColor: [number, number, number] = [168, 168, 168]
|
||||||
const backgroundColor: [number, number, number] = [30, 30, 30]
|
const backgroundColor: [number, number, number] = [30, 30, 30]
|
||||||
const lowTolerance = 20
|
const lowTolerance = 20
|
||||||
@ -2271,8 +2269,8 @@ chamfer04 = chamfer(extrude001, length = 5, tags = [getOppositeEdge(seg02)])
|
|||||||
cmdBar,
|
cmdBar,
|
||||||
}) => {
|
}) => {
|
||||||
const initialCode = `sketch001 = startSketchOn('XZ')
|
const initialCode = `sketch001 = startSketchOn('XZ')
|
||||||
|> circle(center = [0, 0], radius = 30)
|
|> circle(center = [0, 0], radius = 30)
|
||||||
extrude001 = extrude(sketch001, length = 30)
|
extrude001 = extrude(sketch001, length = 30)
|
||||||
`
|
`
|
||||||
await context.addInitScript((initialCode) => {
|
await context.addInitScript((initialCode) => {
|
||||||
localStorage.setItem('persistCode', initialCode)
|
localStorage.setItem('persistCode', initialCode)
|
||||||
@ -2286,6 +2284,8 @@ chamfer04 = chamfer(extrude001, length = 5, tags = [getOppositeEdge(seg02)])
|
|||||||
const [clickOnCap] = scene.makeMouseHelpers(testPoint.x, testPoint.y)
|
const [clickOnCap] = scene.makeMouseHelpers(testPoint.x, testPoint.y)
|
||||||
const shellDeclaration =
|
const shellDeclaration =
|
||||||
"shell001 = shell(extrude001, faces = ['end'], thickness = 5)"
|
"shell001 = shell(extrude001, faces = ['end'], thickness = 5)"
|
||||||
|
const editedShellDeclaration =
|
||||||
|
"shell001 = shell(extrude001, faces = ['end'], thickness = 2)"
|
||||||
|
|
||||||
await test.step(`Look for the grey of the shape`, async () => {
|
await test.step(`Look for the grey of the shape`, async () => {
|
||||||
await scene.expectPixelColor([127, 127, 127], testPoint, 15)
|
await scene.expectPixelColor([127, 127, 127], testPoint, 15)
|
||||||
@ -2352,6 +2352,45 @@ chamfer04 = chamfer(extrude001, length = 5, tags = [getOppositeEdge(seg02)])
|
|||||||
})
|
})
|
||||||
await scene.expectPixelColor([146, 146, 146], testPoint, 15)
|
await scene.expectPixelColor([146, 146, 146], testPoint, 15)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
await test.step('Edit shell via feature tree selection works', async () => {
|
||||||
|
await toolbar.closePane('code')
|
||||||
|
await toolbar.openPane('feature-tree')
|
||||||
|
const operationButton = await toolbar.getFeatureTreeOperation(
|
||||||
|
'Shell',
|
||||||
|
0
|
||||||
|
)
|
||||||
|
await operationButton.dblclick()
|
||||||
|
await cmdBar.expectState({
|
||||||
|
stage: 'arguments',
|
||||||
|
currentArgKey: 'thickness',
|
||||||
|
currentArgValue: '5',
|
||||||
|
headerArguments: {
|
||||||
|
Thickness: '5',
|
||||||
|
},
|
||||||
|
highlightedHeaderArg: 'thickness',
|
||||||
|
commandName: 'Shell',
|
||||||
|
})
|
||||||
|
await page.keyboard.insertText('2')
|
||||||
|
await cmdBar.progressCmdBar()
|
||||||
|
await cmdBar.expectState({
|
||||||
|
stage: 'review',
|
||||||
|
headerArguments: {
|
||||||
|
Thickness: '2',
|
||||||
|
},
|
||||||
|
commandName: 'Shell',
|
||||||
|
})
|
||||||
|
await cmdBar.progressCmdBar()
|
||||||
|
await toolbar.closePane('feature-tree')
|
||||||
|
await scene.expectPixelColor([150, 150, 150], testPoint, 15)
|
||||||
|
await toolbar.openPane('code')
|
||||||
|
await editor.expectEditor.toContain(editedShellDeclaration)
|
||||||
|
await editor.expectState({
|
||||||
|
diagnostics: [],
|
||||||
|
activeLines: [editedShellDeclaration],
|
||||||
|
highlightedCode: '',
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -2387,6 +2426,8 @@ extrude001 = extrude(sketch001, length = 40)
|
|||||||
const mutatedCode = 'xLine(length = -40, tag = $seg01)'
|
const mutatedCode = 'xLine(length = -40, tag = $seg01)'
|
||||||
const shellDeclaration =
|
const shellDeclaration =
|
||||||
"shell001 = shell(extrude001, faces = ['end', seg01], thickness = 5)"
|
"shell001 = shell(extrude001, faces = ['end', seg01], thickness = 5)"
|
||||||
|
const editedShellDeclaration =
|
||||||
|
"shell001 = shell(extrude001, faces = ['end', seg01], thickness = 1)"
|
||||||
|
|
||||||
await test.step(`Look for the grey of the shape`, async () => {
|
await test.step(`Look for the grey of the shape`, async () => {
|
||||||
await scene.expectPixelColor([99, 99, 99], testPoint, 15)
|
await scene.expectPixelColor([99, 99, 99], testPoint, 15)
|
||||||
@ -2435,6 +2476,41 @@ extrude001 = extrude(sketch001, length = 40)
|
|||||||
await scene.expectPixelColor([49, 49, 49], testPoint, 15)
|
await scene.expectPixelColor([49, 49, 49], testPoint, 15)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
await test.step('Edit shell via feature tree selection works', async () => {
|
||||||
|
await editor.closePane()
|
||||||
|
const operationButton = await toolbar.getFeatureTreeOperation('Shell', 0)
|
||||||
|
await operationButton.dblclick({ button: 'left' })
|
||||||
|
await cmdBar.expectState({
|
||||||
|
stage: 'arguments',
|
||||||
|
currentArgKey: 'thickness',
|
||||||
|
currentArgValue: '5',
|
||||||
|
headerArguments: {
|
||||||
|
Thickness: '5',
|
||||||
|
},
|
||||||
|
highlightedHeaderArg: 'thickness',
|
||||||
|
commandName: 'Shell',
|
||||||
|
})
|
||||||
|
await page.keyboard.insertText('1')
|
||||||
|
await cmdBar.progressCmdBar()
|
||||||
|
await cmdBar.expectState({
|
||||||
|
stage: 'review',
|
||||||
|
headerArguments: {
|
||||||
|
Thickness: '1',
|
||||||
|
},
|
||||||
|
commandName: 'Shell',
|
||||||
|
})
|
||||||
|
await cmdBar.progressCmdBar()
|
||||||
|
await toolbar.closePane('feature-tree')
|
||||||
|
await scene.expectPixelColor([150, 150, 150], testPoint, 15)
|
||||||
|
await toolbar.openPane('code')
|
||||||
|
await editor.expectEditor.toContain(editedShellDeclaration)
|
||||||
|
await editor.expectState({
|
||||||
|
diagnostics: [],
|
||||||
|
activeLines: [editedShellDeclaration],
|
||||||
|
highlightedCode: '',
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
await test.step('Delete shell via feature tree selection', async () => {
|
await test.step('Delete shell via feature tree selection', async () => {
|
||||||
await editor.closePane()
|
await editor.closePane()
|
||||||
const operationButton = await toolbar.getFeatureTreeOperation('Shell', 0)
|
const operationButton = await toolbar.getFeatureTreeOperation('Shell', 0)
|
||||||
@ -2529,7 +2605,7 @@ extrude002 = extrude(sketch002, length = 50)
|
|||||||
highlightedCode: '',
|
highlightedCode: '',
|
||||||
})
|
})
|
||||||
await toolbar.closePane('code')
|
await toolbar.closePane('code')
|
||||||
await scene.expectPixelColor([73, 73, 73], testPoint, 15)
|
await scene.expectPixelColor([80, 80, 80], testPoint, 15)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -539,7 +539,8 @@ test.describe('Can export from electron app', () => {
|
|||||||
try {
|
try {
|
||||||
const outputGltf = await fsp.readFile(filepath)
|
const outputGltf = await fsp.readFile(filepath)
|
||||||
return outputGltf.byteLength
|
return outputGltf.byteLength
|
||||||
} catch (e) {
|
} catch (error: unknown) {
|
||||||
|
void error
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -53,46 +53,47 @@ sketch003 = startSketchOn('XY')
|
|||||||
|> close()
|
|> close()
|
||||||
extrude003 = extrude(sketch003, length = 20)
|
extrude003 = extrude(sketch003, length = 20)
|
||||||
`
|
`
|
||||||
|
test.describe('edit with AI example snapshots', () => {
|
||||||
|
test(
|
||||||
|
`change colour`,
|
||||||
|
{ tag: '@snapshot' },
|
||||||
|
async ({ context, homePage, cmdBar, editor, page, scene }) => {
|
||||||
|
await context.addInitScript((file) => {
|
||||||
|
localStorage.setItem('persistCode', file)
|
||||||
|
}, file)
|
||||||
|
await homePage.goToModelingScene()
|
||||||
|
await scene.waitForExecutionDone()
|
||||||
|
|
||||||
test(
|
const body1CapCoords = { x: 571, y: 351 }
|
||||||
`change colour`,
|
const [clickBody1Cap] = scene.makeMouseHelpers(
|
||||||
{ tag: '@snapshot' },
|
body1CapCoords.x,
|
||||||
async ({ context, homePage, cmdBar, editor, page, scene }) => {
|
body1CapCoords.y
|
||||||
await context.addInitScript((file) => {
|
)
|
||||||
localStorage.setItem('persistCode', file)
|
const yellow: [number, number, number] = [179, 179, 131]
|
||||||
}, file)
|
const submittingToast = page.getByText('Submitting to Text-to-CAD API...')
|
||||||
await homePage.goToModelingScene()
|
|
||||||
await scene.waitForExecutionDone()
|
|
||||||
|
|
||||||
const body1CapCoords = { x: 571, y: 351 }
|
await test.step('wait for scene to load select body and check selection came through', async () => {
|
||||||
const [clickBody1Cap] = scene.makeMouseHelpers(
|
await scene.expectPixelColor([134, 134, 134], body1CapCoords, 15)
|
||||||
body1CapCoords.x,
|
await clickBody1Cap()
|
||||||
body1CapCoords.y
|
await scene.expectPixelColor(yellow, body1CapCoords, 20)
|
||||||
)
|
await editor.expectState({
|
||||||
const yellow: [number, number, number] = [179, 179, 131]
|
highlightedCode: '',
|
||||||
const submittingToast = page.getByText('Submitting to Text-to-CAD API...')
|
activeLines: ['|>startProfileAt([-73.64,-42.89],%)'],
|
||||||
|
diagnostics: [],
|
||||||
await test.step('wait for scene to load select body and check selection came through', async () => {
|
})
|
||||||
await scene.expectPixelColor([134, 134, 134], body1CapCoords, 15)
|
|
||||||
await clickBody1Cap()
|
|
||||||
await scene.expectPixelColor(yellow, body1CapCoords, 20)
|
|
||||||
await editor.expectState({
|
|
||||||
highlightedCode: '',
|
|
||||||
activeLines: ['|>startProfileAt([-73.64,-42.89],%)'],
|
|
||||||
diagnostics: [],
|
|
||||||
})
|
})
|
||||||
})
|
|
||||||
|
|
||||||
await test.step('fire off edit prompt', async () => {
|
await test.step('fire off edit prompt', async () => {
|
||||||
await cmdBar.captureTextToCadRequestSnapshot(test.info())
|
await cmdBar.captureTextToCadRequestSnapshot(test.info())
|
||||||
await cmdBar.openCmdBar('promptToEdit')
|
await cmdBar.openCmdBar('promptToEdit')
|
||||||
// being specific about the color with a hex means asserting pixel color is more stable
|
// being specific about the color with a hex means asserting pixel color is more stable
|
||||||
await page
|
await page
|
||||||
.getByTestId('cmd-bar-arg-value')
|
.getByTestId('cmd-bar-arg-value')
|
||||||
.fill('make this neon green please, use #39FF14')
|
.fill('make this neon green please, use #39FF14')
|
||||||
await page.waitForTimeout(100)
|
await page.waitForTimeout(100)
|
||||||
await cmdBar.progressCmdBar()
|
await cmdBar.progressCmdBar()
|
||||||
await expect(submittingToast).toBeVisible()
|
await expect(submittingToast).toBeVisible()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
})
|
||||||
|
@ -319,7 +319,6 @@ extrude001 = extrude(sketch001, length = 50)
|
|||||||
'when engine fails export we handle the failure and alert the user',
|
'when engine fails export we handle the failure and alert the user',
|
||||||
{ tag: '@skipLocalEngine' },
|
{ tag: '@skipLocalEngine' },
|
||||||
async ({ scene, page, homePage, cmdBar }) => {
|
async ({ scene, page, homePage, cmdBar }) => {
|
||||||
const u = await getUtils(page)
|
|
||||||
await page.addInitScript(
|
await page.addInitScript(
|
||||||
async ({ code }) => {
|
async ({ code }) => {
|
||||||
localStorage.setItem('persistCode', code)
|
localStorage.setItem('persistCode', code)
|
||||||
@ -636,11 +635,8 @@ extrude001 = extrude(sketch001, length = 50)
|
|||||||
await homePage.goToModelingScene()
|
await homePage.goToModelingScene()
|
||||||
})
|
})
|
||||||
|
|
||||||
const toolBarMode = () =>
|
|
||||||
page.locator('[data-currentMode]').getAttribute('data-currentMode')
|
|
||||||
|
|
||||||
await test.step('Start sketch and select a plane', async () => {
|
await test.step('Start sketch and select a plane', async () => {
|
||||||
await expect.poll(toolBarMode).toEqual('modeling')
|
await toolbar.expectToolbarMode.toBe('modeling')
|
||||||
// Click the start sketch button
|
// Click the start sketch button
|
||||||
await toolbar.startSketchPlaneSelection()
|
await toolbar.startSketchPlaneSelection()
|
||||||
|
|
||||||
@ -649,10 +645,10 @@ extrude001 = extrude(sketch001, length = 50)
|
|||||||
|
|
||||||
// Check that the modeling toolbar doesn't appear during the animation
|
// Check that the modeling toolbar doesn't appear during the animation
|
||||||
// The animation typically takes around 500ms, so we'll check for a second
|
// The animation typically takes around 500ms, so we'll check for a second
|
||||||
await expect.poll(toolBarMode, { timeout: 1000 }).not.toEqual('modeling')
|
await toolbar.expectToolbarMode.not.toBe('modeling')
|
||||||
|
|
||||||
// After animation completes, we should see the sketching toolbar
|
// After animation completes, we should see the sketching toolbar
|
||||||
await expect.poll(toolBarMode).toEqual('sketching')
|
await toolbar.expectToolbarMode.toBe('sketching')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import { readFileSync } from 'fs'
|
import { readFileSync } from 'fs'
|
||||||
|
|
||||||
const secrets: Record<string, string> = {}
|
const secrets: Record<string, string> = {}
|
||||||
|
const secretsPath = './e2e/playwright/playwright-secrets.env'
|
||||||
try {
|
try {
|
||||||
const file = readFileSync('./e2e/playwright/playwright-secrets.env', 'utf8')
|
const file = readFileSync(secretsPath, 'utf8')
|
||||||
file
|
file
|
||||||
.split('\n')
|
.split('\n')
|
||||||
.filter((line) => line && line.length > 1)
|
.filter((line) => line && line.length > 1)
|
||||||
@ -13,11 +14,15 @@ try {
|
|||||||
// prefer env vars over secrets file
|
// prefer env vars over secrets file
|
||||||
secrets[key] = process.env[key] || (value as any).replaceAll('"', '')
|
secrets[key] = process.env[key] || (value as any).replaceAll('"', '')
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (error: unknown) {
|
||||||
|
void error
|
||||||
// probably running in CI
|
// probably running in CI
|
||||||
secrets.token = process.env.token || ''
|
console.warn(
|
||||||
secrets.snapshottoken = process.env.snapshottoken || ''
|
`Error reading ${secretsPath}; environment variables will be used`
|
||||||
// add more env vars here to make them available in CI
|
)
|
||||||
}
|
}
|
||||||
|
secrets.token = secrets.token || process.env.token || ''
|
||||||
|
secrets.snapshottoken = secrets.snapshottoken || process.env.snapshottoken || ''
|
||||||
|
// add more env vars here to make them available in CI
|
||||||
|
|
||||||
export { secrets }
|
export { secrets }
|
||||||
|
@ -12,6 +12,7 @@ import {
|
|||||||
} from './test-utils'
|
} from './test-utils'
|
||||||
import { uuidv4, roundOff } from 'lib/utils'
|
import { uuidv4, roundOff } from 'lib/utils'
|
||||||
import { SceneFixture } from './fixtures/sceneFixture'
|
import { SceneFixture } from './fixtures/sceneFixture'
|
||||||
|
import { CmdBarFixture } from './fixtures/cmdBarFixture'
|
||||||
|
|
||||||
test.describe('Sketch tests', { tag: ['@skipWin'] }, () => {
|
test.describe('Sketch tests', { tag: ['@skipWin'] }, () => {
|
||||||
test('multi-sketch file shows multiple Edit Sketch buttons', async ({
|
test('multi-sketch file shows multiple Edit Sketch buttons', async ({
|
||||||
@ -191,7 +192,8 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
|
|||||||
page: Page,
|
page: Page,
|
||||||
homePage: HomePageFixture,
|
homePage: HomePageFixture,
|
||||||
openPanes: string[],
|
openPanes: string[],
|
||||||
scene: SceneFixture
|
scene: SceneFixture,
|
||||||
|
cmdBar: CmdBarFixture
|
||||||
) => {
|
) => {
|
||||||
// Load the app with the code panes
|
// Load the app with the code panes
|
||||||
await page.addInitScript(async () => {
|
await page.addInitScript(async () => {
|
||||||
@ -201,13 +203,22 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
|
|||||||
|> startProfileAt([4.61, -14.01], %)
|
|> startProfileAt([4.61, -14.01], %)
|
||||||
|> line(end = [12.73, -0.09])
|
|> line(end = [12.73, -0.09])
|
||||||
|> tangentialArcTo([24.95, -5.38], %)
|
|> tangentialArcTo([24.95, -5.38], %)
|
||||||
|
|> arcTo({
|
||||||
|
interior = [20.18, -1.7],
|
||||||
|
end = [11.82, -1.16]
|
||||||
|
}, %)
|
||||||
|
|> arc({
|
||||||
|
radius = 5.92,
|
||||||
|
angleStart = -89.36,
|
||||||
|
angleEnd = 135.81
|
||||||
|
}, %)
|
||||||
|> close()`
|
|> close()`
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
const u = await getUtils(page)
|
const u = await getUtils(page)
|
||||||
await homePage.goToModelingScene()
|
await homePage.goToModelingScene()
|
||||||
await scene.waitForExecutionDone()
|
await scene.settled(cmdBar)
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
page.getByRole('button', { name: 'Start Sketch' })
|
page.getByRole('button', { name: 'Start Sketch' })
|
||||||
@ -242,7 +253,17 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
|
|||||||
|> startProfileAt([4.61, -14.01], %)
|
|> startProfileAt([4.61, -14.01], %)
|
||||||
|> line(end = [12.73, -0.09])
|
|> line(end = [12.73, -0.09])
|
||||||
|> tangentialArcTo([24.95, -5.38], %)
|
|> tangentialArcTo([24.95, -5.38], %)
|
||||||
|> close()`)
|
|> arcTo({
|
||||||
|
interior = [20.18, -1.7],
|
||||||
|
end = [11.82, -1.16]
|
||||||
|
}, %)
|
||||||
|
|> arc({
|
||||||
|
radius = 5.92,
|
||||||
|
angleStart = -89.36,
|
||||||
|
angleEnd = 135.81
|
||||||
|
}, %)
|
||||||
|
|> close()
|
||||||
|
`)
|
||||||
} else {
|
} else {
|
||||||
// Ensure we don't see the code.
|
// Ensure we don't see the code.
|
||||||
await expect(u.codeLocator).not.toBeVisible()
|
await expect(u.codeLocator).not.toBeVisible()
|
||||||
@ -272,7 +293,7 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
|
|||||||
|
|
||||||
const step5 = { steps: 5 }
|
const step5 = { steps: 5 }
|
||||||
|
|
||||||
await expect(page.getByTestId('segment-overlay')).toHaveCount(2)
|
await expect(page.getByTestId('segment-overlay')).toHaveCount(5)
|
||||||
|
|
||||||
// drag startProfileAt handle
|
// drag startProfileAt handle
|
||||||
await page.mouse.move(startPX[0], startPX[1])
|
await page.mouse.move(startPX[0], startPX[1])
|
||||||
@ -310,22 +331,93 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
|
|||||||
await expect(page.locator('.cm-content')).not.toHaveText(prevContent)
|
await expect(page.locator('.cm-content')).not.toHaveText(prevContent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// drag arcTo interior handle (three point arc)
|
||||||
|
const arcToHandle = await u.getBoundingBox('[data-overlay-index="2"]')
|
||||||
|
await page.mouse.move(arcToHandle.x, arcToHandle.y - 5)
|
||||||
|
await page.mouse.down()
|
||||||
|
await page.mouse.move(
|
||||||
|
arcToHandle.x - dragPX,
|
||||||
|
arcToHandle.y + dragPX,
|
||||||
|
step5
|
||||||
|
)
|
||||||
|
await page.mouse.up()
|
||||||
|
await page.waitForTimeout(100)
|
||||||
|
if (openPanes.includes('code')) {
|
||||||
|
await expect(page.locator('.cm-content')).not.toHaveText(prevContent)
|
||||||
|
prevContent = await page.locator('.cm-content').innerText()
|
||||||
|
}
|
||||||
|
|
||||||
|
// drag arcTo end handle (three point arc)
|
||||||
|
const arcToEndHandle = await u.getBoundingBox('[data-overlay-index="3"]')
|
||||||
|
await page.mouse.move(arcToEndHandle.x, arcToEndHandle.y - 5)
|
||||||
|
await page.mouse.down()
|
||||||
|
await page.mouse.move(
|
||||||
|
arcToEndHandle.x - dragPX,
|
||||||
|
arcToEndHandle.y + dragPX,
|
||||||
|
step5
|
||||||
|
)
|
||||||
|
await page.mouse.up()
|
||||||
|
await page.waitForTimeout(100)
|
||||||
|
if (openPanes.includes('code')) {
|
||||||
|
await expect(page.locator('.cm-content')).not.toHaveText(prevContent)
|
||||||
|
prevContent = await page.locator('.cm-content').innerText()
|
||||||
|
}
|
||||||
|
|
||||||
|
// drag arc radius handle
|
||||||
|
const arcRadiusHandle = await u.getBoundingBox('[data-overlay-index="4"]')
|
||||||
|
await page.mouse.move(arcRadiusHandle.x, arcRadiusHandle.y - 5)
|
||||||
|
await page.mouse.down()
|
||||||
|
await page.mouse.move(
|
||||||
|
arcRadiusHandle.x - dragPX,
|
||||||
|
arcRadiusHandle.y + dragPX,
|
||||||
|
step5
|
||||||
|
)
|
||||||
|
await page.mouse.up()
|
||||||
|
await page.waitForTimeout(100)
|
||||||
|
if (openPanes.includes('code')) {
|
||||||
|
await expect(page.locator('.cm-content')).not.toHaveText(prevContent)
|
||||||
|
}
|
||||||
|
|
||||||
|
// drag arc center handle (we'll have to hardcode the position because it doesn't have a overlay near the handle)
|
||||||
|
const arcCenterHandle = { x: 745, y: 214 }
|
||||||
|
await page.mouse.move(arcCenterHandle.x, arcCenterHandle.y - 5)
|
||||||
|
await page.mouse.down()
|
||||||
|
await page.mouse.move(
|
||||||
|
arcCenterHandle.x - dragPX,
|
||||||
|
arcCenterHandle.y + dragPX,
|
||||||
|
step5
|
||||||
|
)
|
||||||
|
await page.mouse.up()
|
||||||
|
await page.waitForTimeout(100)
|
||||||
|
if (openPanes.includes('code')) {
|
||||||
|
await expect(page.locator('.cm-content')).not.toHaveText(prevContent)
|
||||||
|
}
|
||||||
|
|
||||||
// Open the code pane
|
// Open the code pane
|
||||||
await u.openKclCodePanel()
|
await u.openKclCodePanel()
|
||||||
|
|
||||||
// expect the code to have changed
|
// expect the code to have changed
|
||||||
await expect(page.locator('.cm-content'))
|
await expect(page.locator('.cm-content'))
|
||||||
.toHaveText(`sketch001 = startSketchOn('XZ')
|
.toHaveText(`sketch001 = startSketchOn('XZ')
|
||||||
|> startProfileAt([6.44, -12.07], %)
|
|> startProfileAt([6.44, -12.07], %)
|
||||||
|> line(end = [14.72, 1.97])
|
|> line(end = [14.72, 1.97])
|
||||||
|> tangentialArcTo([24.95, -5.38], %)
|
|> tangentialArcTo([26.92, -3.32], %)
|
||||||
|> line(end = [1.97, 2.06])
|
|> arcTo({
|
||||||
|> close()`)
|
interior = [18.11, -3.73],
|
||||||
|
end = [9.77, -3.19]
|
||||||
|
}, %)
|
||||||
|
|> arc({
|
||||||
|
radius = 3.75,
|
||||||
|
angleStart = -58.29,
|
||||||
|
angleEnd = 161.17
|
||||||
|
}, %)
|
||||||
|
|> close()
|
||||||
|
`)
|
||||||
}
|
}
|
||||||
test(
|
test(
|
||||||
'code pane open at start-handles',
|
'code pane open at start-handles',
|
||||||
{ tag: ['@skipWin'] },
|
{ tag: ['@skipWin'] },
|
||||||
async ({ page, homePage, scene }) => {
|
async ({ page, homePage, scene, cmdBar }) => {
|
||||||
// Load the app with the code panes
|
// Load the app with the code panes
|
||||||
await page.addInitScript(async () => {
|
await page.addInitScript(async () => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
@ -338,14 +430,20 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
await doEditSegmentsByDraggingHandle(page, homePage, ['code'], scene)
|
await doEditSegmentsByDraggingHandle(
|
||||||
|
page,
|
||||||
|
homePage,
|
||||||
|
['code'],
|
||||||
|
scene,
|
||||||
|
cmdBar
|
||||||
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
test(
|
test(
|
||||||
'code pane closed at start-handles',
|
'code pane closed at start-handles',
|
||||||
{ tag: ['@skipWin'] },
|
{ tag: ['@skipWin'] },
|
||||||
async ({ page, homePage, scene }) => {
|
async ({ page, homePage, scene, cmdBar }) => {
|
||||||
// Load the app with the code panes
|
// Load the app with the code panes
|
||||||
await page.addInitScript(async (persistModelingContext) => {
|
await page.addInitScript(async (persistModelingContext) => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
@ -353,7 +451,7 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
|
|||||||
JSON.stringify({ openPanes: [] })
|
JSON.stringify({ openPanes: [] })
|
||||||
)
|
)
|
||||||
}, PERSIST_MODELING_CONTEXT)
|
}, PERSIST_MODELING_CONTEXT)
|
||||||
await doEditSegmentsByDraggingHandle(page, homePage, [], scene)
|
await doEditSegmentsByDraggingHandle(page, homePage, [], scene, cmdBar)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
@ -362,6 +460,8 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
|
|||||||
page,
|
page,
|
||||||
editor,
|
editor,
|
||||||
homePage,
|
homePage,
|
||||||
|
scene,
|
||||||
|
cmdBar,
|
||||||
}) => {
|
}) => {
|
||||||
const u = await getUtils(page)
|
const u = await getUtils(page)
|
||||||
await page.addInitScript(async () => {
|
await page.addInitScript(async () => {
|
||||||
@ -373,6 +473,8 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
|
|||||||
})
|
})
|
||||||
|
|
||||||
await homePage.goToModelingScene()
|
await homePage.goToModelingScene()
|
||||||
|
await scene.connectionEstablished()
|
||||||
|
await scene.settled(cmdBar)
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
page.getByRole('button', { name: 'Start Sketch' })
|
page.getByRole('button', { name: 'Start Sketch' })
|
||||||
@ -1174,7 +1276,7 @@ profile001 = startProfileAt([${roundOff(scale * 69.6)}, ${roundOff(
|
|||||||
|> line(endAbsolute = [
|
|> line(endAbsolute = [
|
||||||
railWideWidth / 2,
|
railWideWidth / 2,
|
||||||
railClampable / 2 + railBaseLength
|
railClampable / 2 + railBaseLength
|
||||||
], $seg01)
|
], tag = $seg01)
|
||||||
|> line(endAbsolute = [railTop / 2, railBaseLength])
|
|> line(endAbsolute = [railTop / 2, railBaseLength])
|
||||||
|> line(endAbsolute = [railBaseWidth / 2, railBaseLength])
|
|> line(endAbsolute = [railBaseWidth / 2, railBaseLength])
|
||||||
|> line(endAbsolute = [railBaseWidth / 2, 0])
|
|> line(endAbsolute = [railBaseWidth / 2, 0])
|
||||||
@ -1355,7 +1457,7 @@ test.describe('multi-profile sketching', () => {
|
|||||||
test(
|
test(
|
||||||
`test it removes half-finished expressions when changing tools in sketch mode`,
|
`test it removes half-finished expressions when changing tools in sketch mode`,
|
||||||
{ tag: ['@skipWin'] },
|
{ tag: ['@skipWin'] },
|
||||||
async ({ context, page, scene, toolbar, editor, homePage }) => {
|
async ({ context, page, scene, toolbar, editor, homePage, cmdBar }) => {
|
||||||
// We seed the scene with a single offset plane
|
// We seed the scene with a single offset plane
|
||||||
await context.addInitScript(() => {
|
await context.addInitScript(() => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
@ -1375,7 +1477,10 @@ profile002 = startProfileAt([117.2, 56.08], sketch001)
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const [continueProfile2Clk] = scene.makeMouseHelpers(954, 282)
|
||||||
|
|
||||||
await homePage.goToModelingScene()
|
await homePage.goToModelingScene()
|
||||||
|
await scene.settled(cmdBar)
|
||||||
await expect(
|
await expect(
|
||||||
page.getByRole('button', { name: 'Start Sketch' })
|
page.getByRole('button', { name: 'Start Sketch' })
|
||||||
).not.toBeDisabled()
|
).not.toBeDisabled()
|
||||||
@ -1386,7 +1491,13 @@ profile002 = startProfileAt([117.2, 56.08], sketch001)
|
|||||||
const [circlePoint1] = scene.makeMouseHelpers(700, 200)
|
const [circlePoint1] = scene.makeMouseHelpers(700, 200)
|
||||||
|
|
||||||
await test.step('equip circle tool and click first point', async () => {
|
await test.step('equip circle tool and click first point', async () => {
|
||||||
await toolbar.circleBtn.click()
|
// await page.waitForTimeout(100)
|
||||||
|
await expect
|
||||||
|
.poll(async () => {
|
||||||
|
await toolbar.circleBtn.click()
|
||||||
|
return toolbar.circleBtn.getAttribute('aria-pressed')
|
||||||
|
})
|
||||||
|
.toBe('true')
|
||||||
await page.waitForTimeout(100)
|
await page.waitForTimeout(100)
|
||||||
await circlePoint1()
|
await circlePoint1()
|
||||||
await editor.expectEditor.toContain(
|
await editor.expectEditor.toContain(
|
||||||
@ -1401,6 +1512,7 @@ profile002 = startProfileAt([117.2, 56.08], sketch001)
|
|||||||
|
|
||||||
const [circle3Point1] = scene.makeMouseHelpers(650, 200)
|
const [circle3Point1] = scene.makeMouseHelpers(650, 200)
|
||||||
const [circle3Point2] = scene.makeMouseHelpers(750, 200)
|
const [circle3Point2] = scene.makeMouseHelpers(750, 200)
|
||||||
|
// const [circle3Point3] = scene.makeMouseHelpers(700, 150)
|
||||||
|
|
||||||
await test.step('equip three point circle tool and click first two points', async () => {
|
await test.step('equip three point circle tool and click first two points', async () => {
|
||||||
await toolbar.selectCircleThreePoint()
|
await toolbar.selectCircleThreePoint()
|
||||||
@ -1411,25 +1523,40 @@ profile002 = startProfileAt([117.2, 56.08], sketch001)
|
|||||||
await editor.expectEditor.toContain('profile003 = circleThreePoint(')
|
await editor.expectEditor.toContain('profile003 = circleThreePoint(')
|
||||||
})
|
})
|
||||||
|
|
||||||
await test.step('equip line tool and verify three point circle code is removed', async () => {
|
await test.step('equip line tool and verify three-point circle code is removed', async () => {
|
||||||
await toolbar.lineBtn.click()
|
await toolbar.lineBtn.click()
|
||||||
await editor.expectEditor.not.toContain(
|
await editor.expectEditor.not.toContain(
|
||||||
'profile003 = circleThreePoint('
|
'profile003 = circleThreePoint('
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
await test.step('equip three-point-arc tool and click first two points', async () => {
|
||||||
|
await page.waitForTimeout(200)
|
||||||
|
await toolbar.selectThreePointArc()
|
||||||
|
await page.waitForTimeout(200)
|
||||||
|
await circle3Point1()
|
||||||
|
await page.waitForTimeout(200)
|
||||||
|
await circle3Point2()
|
||||||
|
await editor.expectEditor.toContain('arcTo({')
|
||||||
|
})
|
||||||
|
|
||||||
|
await test.step('equip line tool and verify three-point-arc code is removed after second click', async () => {
|
||||||
|
await toolbar.lineBtn.click()
|
||||||
|
await editor.expectEditor.not.toContain('arcTo({')
|
||||||
|
})
|
||||||
|
|
||||||
const [cornerRectPoint1] = scene.makeMouseHelpers(600, 300)
|
const [cornerRectPoint1] = scene.makeMouseHelpers(600, 300)
|
||||||
|
|
||||||
await test.step('equip corner rectangle tool and click first point', async () => {
|
await test.step('equip corner rectangle tool and click first point', async () => {
|
||||||
await toolbar.rectangleBtn.click()
|
await toolbar.rectangleBtn.click()
|
||||||
await page.waitForTimeout(100)
|
await page.waitForTimeout(100)
|
||||||
await cornerRectPoint1()
|
await cornerRectPoint1()
|
||||||
await editor.expectEditor.toContain('profile003 = startProfileAt(')
|
await editor.expectEditor.toContain('profile004 = startProfileAt(')
|
||||||
})
|
})
|
||||||
|
|
||||||
await test.step('equip line tool and verify corner rectangle code is removed', async () => {
|
await test.step('equip line tool and verify corner rectangle code is removed', async () => {
|
||||||
await toolbar.lineBtn.click()
|
await toolbar.lineBtn.click()
|
||||||
await editor.expectEditor.not.toContain('profile003 = startProfileAt(')
|
await editor.expectEditor.not.toContain('profile004 = startProfileAt(')
|
||||||
})
|
})
|
||||||
|
|
||||||
const [centerRectPoint1] = scene.makeMouseHelpers(700, 300)
|
const [centerRectPoint1] = scene.makeMouseHelpers(700, 300)
|
||||||
@ -1438,12 +1565,24 @@ profile002 = startProfileAt([117.2, 56.08], sketch001)
|
|||||||
await toolbar.selectCenterRectangle()
|
await toolbar.selectCenterRectangle()
|
||||||
await page.waitForTimeout(100)
|
await page.waitForTimeout(100)
|
||||||
await centerRectPoint1()
|
await centerRectPoint1()
|
||||||
await editor.expectEditor.toContain('profile003 = startProfileAt(')
|
await editor.expectEditor.toContain('profile004 = startProfileAt(')
|
||||||
})
|
})
|
||||||
|
|
||||||
await test.step('equip line tool and verify center rectangle code is removed', async () => {
|
await test.step('equip line tool and verify center rectangle code is removed', async () => {
|
||||||
await toolbar.lineBtn.click()
|
await toolbar.lineBtn.click()
|
||||||
await editor.expectEditor.not.toContain('profile003 = startProfileAt(')
|
await editor.expectEditor.not.toContain('profile004 = startProfileAt(')
|
||||||
|
})
|
||||||
|
|
||||||
|
await test.step('continue profile002 with the three point arc tool, and then switch back to the line tool to verify it only removes the last expression in the pipe', async () => {
|
||||||
|
await toolbar.selectThreePointArc()
|
||||||
|
await page.waitForTimeout(200)
|
||||||
|
await continueProfile2Clk()
|
||||||
|
await page.waitForTimeout(200)
|
||||||
|
await circle3Point1()
|
||||||
|
await editor.expectEditor.toContain('arcTo({')
|
||||||
|
await toolbar.lineBtn.click()
|
||||||
|
await editor.expectEditor.not.toContain('arcTo({')
|
||||||
|
await editor.expectEditor.toContain('profile002')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -1532,6 +1671,7 @@ profile003 = startProfileAt([206.63, -56.73], sketch001)
|
|||||||
}) => {
|
}) => {
|
||||||
await page.setBodyDimensions({ width: 1000, height: 500 })
|
await page.setBodyDimensions({ width: 1000, height: 500 })
|
||||||
await homePage.goToModelingScene()
|
await homePage.goToModelingScene()
|
||||||
|
await scene.connectionEstablished()
|
||||||
await expect(
|
await expect(
|
||||||
page.getByRole('button', { name: 'Start Sketch' })
|
page.getByRole('button', { name: 'Start Sketch' })
|
||||||
).not.toBeDisabled()
|
).not.toBeDisabled()
|
||||||
@ -1595,7 +1735,7 @@ profile003 = startProfileAt([206.63, -56.73], sketch001)
|
|||||||
// timeout wait for engine animation is unavoidable
|
// timeout wait for engine animation is unavoidable
|
||||||
await page.waitForTimeout(600)
|
await page.waitForTimeout(600)
|
||||||
await editor.expectEditor.toContain(`sketch001 = startSketchOn('XZ')`)
|
await editor.expectEditor.toContain(`sketch001 = startSketchOn('XZ')`)
|
||||||
await test.step('Create a close profile stopping mid profile to equip the tangential arc, and than back to the line tool', async () => {
|
await test.step('Create a close profile stopping mid profile to equip the tangential arc, then three-point arc, and then back to the line tool', async () => {
|
||||||
await startProfile1()
|
await startProfile1()
|
||||||
await editor.expectEditor.toContain(
|
await editor.expectEditor.toContain(
|
||||||
`profile001 = startProfileAt([4.61, 12.21], sketch001)`
|
`profile001 = startProfileAt([4.61, 12.21], sketch001)`
|
||||||
@ -1613,12 +1753,45 @@ profile003 = startProfileAt([206.63, -56.73], sketch001)
|
|||||||
await editor.expectEditor.toContain(
|
await editor.expectEditor.toContain(
|
||||||
`|> tangentialArcTo([16.61, 4.14], %)`
|
`|> tangentialArcTo([16.61, 4.14], %)`
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Add a three-point arc segment
|
||||||
|
await toolbar.selectThreePointArc()
|
||||||
|
await page.waitForTimeout(300)
|
||||||
|
|
||||||
|
// select end of profile again
|
||||||
|
await endLineStartTanArc()
|
||||||
|
await page.waitForTimeout(300)
|
||||||
|
|
||||||
|
// Define points for the three-point arc
|
||||||
|
const [threePointInterior, threePointInteriorMove] =
|
||||||
|
scene.makeMouseHelpers(600, 200)
|
||||||
|
const [threePointEnd, threePointEndMove] = scene.makeMouseHelpers(
|
||||||
|
590,
|
||||||
|
270
|
||||||
|
)
|
||||||
|
|
||||||
|
// Create the three-point arc
|
||||||
|
await page.waitForTimeout(300)
|
||||||
|
await threePointInteriorMove()
|
||||||
|
await threePointInterior()
|
||||||
|
await page.waitForTimeout(300)
|
||||||
|
await threePointEndMove()
|
||||||
|
await threePointEnd()
|
||||||
|
await page.waitForTimeout(300)
|
||||||
|
|
||||||
|
// Verify the three-point arc was created correctly
|
||||||
|
await editor.expectEditor.toContain(`|> arcTo(`)
|
||||||
|
|
||||||
|
// Switch back to line tool to continue
|
||||||
await toolbar.lineBtn.click()
|
await toolbar.lineBtn.click()
|
||||||
await page.waitForTimeout(300)
|
await page.waitForTimeout(300)
|
||||||
await endArcStartLine()
|
|
||||||
|
// Continue with the original line segment
|
||||||
|
await threePointEnd()
|
||||||
|
await page.waitForTimeout(300)
|
||||||
|
|
||||||
await page.mouse.click(572, 110)
|
await page.mouse.click(572, 110)
|
||||||
await editor.expectEditor.toContain(`|> line(end = [-11.73, 5.35])`)
|
await editor.expectEditor.toContain(`|> line(end = [-1.22, 10.85])`)
|
||||||
await startProfile1()
|
await startProfile1()
|
||||||
await editor.expectEditor.toContain(
|
await editor.expectEditor.toContain(
|
||||||
`|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
`|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||||
@ -1820,8 +1993,68 @@ profile003 = startProfileAt([206.63, -56.73], sketch001)
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
await test.step('double check that circle three point can be unequiped', async () => {
|
await test.step('create three-point arcs in a row without an unequip', async () => {
|
||||||
// this was tested implicitly for other tools, but not for circle three point since it's last
|
// Define points for the first three-point arc
|
||||||
|
const [arc1Point1, arc1Point1Move] = scene.makeMouseHelpers(700, 397)
|
||||||
|
const [arc1Point2, arc1Point2Move] = scene.makeMouseHelpers(724, 346)
|
||||||
|
const [arc1Point3, arc1Point3Move] = scene.makeMouseHelpers(785, 415)
|
||||||
|
|
||||||
|
// Define points for the second three-point arc
|
||||||
|
const [arc2Point1, arc2Point1Move] = scene.makeMouseHelpers(792, 225)
|
||||||
|
const [arc2Point2, arc2Point2Move] = scene.makeMouseHelpers(820, 207)
|
||||||
|
const [arc2Point3, arc2Point3Move] = scene.makeMouseHelpers(905, 229)
|
||||||
|
|
||||||
|
// Select the three-point arc tool
|
||||||
|
await toolbar.selectThreePointArc()
|
||||||
|
|
||||||
|
// Create the first three-point arc
|
||||||
|
await arc1Point1Move()
|
||||||
|
await arc1Point1()
|
||||||
|
await page.waitForTimeout(300)
|
||||||
|
await arc1Point2Move()
|
||||||
|
await arc1Point2()
|
||||||
|
await page.waitForTimeout(300)
|
||||||
|
await arc1Point3Move()
|
||||||
|
await arc1Point3()
|
||||||
|
await page.waitForTimeout(300)
|
||||||
|
|
||||||
|
// Verify the first three-point arc was created correctly
|
||||||
|
await editor.expectEditor.toContain(
|
||||||
|
`profile011 = startProfileAt([13.56, -9.97], sketch001)
|
||||||
|
|> arcTo({
|
||||||
|
interior = [15.19, -6.51],
|
||||||
|
end = [19.33, -11.19]
|
||||||
|
}, %)`,
|
||||||
|
{ shouldNormalise: true }
|
||||||
|
)
|
||||||
|
|
||||||
|
// Create the second three-point arc
|
||||||
|
await arc2Point1Move()
|
||||||
|
await arc2Point1()
|
||||||
|
await page.waitForTimeout(300)
|
||||||
|
await arc2Point2Move()
|
||||||
|
await arc2Point2()
|
||||||
|
await page.waitForTimeout(300)
|
||||||
|
await arc2Point3Move()
|
||||||
|
await arc2Point3()
|
||||||
|
await page.waitForTimeout(300)
|
||||||
|
|
||||||
|
// Verify the second three-point arc was created correctly
|
||||||
|
await editor.expectEditor.toContain(
|
||||||
|
` |> arcTo({
|
||||||
|
interior = [19.8, 1.7],
|
||||||
|
end = [21.7, 2.92]
|
||||||
|
}, %)
|
||||||
|
|> arcTo({
|
||||||
|
interior = [27.47, 1.42],
|
||||||
|
end = [27.57, 1.52]
|
||||||
|
}, %)`,
|
||||||
|
{ shouldNormalise: true }
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
await test.step('double check that three-point arc can be unequipped', async () => {
|
||||||
|
// this was tested implicitly for other tools, but not for three-point arc since it's last
|
||||||
await page.waitForTimeout(300)
|
await page.waitForTimeout(300)
|
||||||
await expect
|
await expect
|
||||||
.poll(async () => {
|
.poll(async () => {
|
||||||
@ -2085,7 +2318,7 @@ profile003 = circle(sketch001, center = [6.92, -4.2], radius = 3.16)
|
|||||||
test(
|
test(
|
||||||
'can enter sketch when there is an extrude',
|
'can enter sketch when there is an extrude',
|
||||||
{ tag: ['@skipWin'] },
|
{ tag: ['@skipWin'] },
|
||||||
async ({ homePage, scene, toolbar, page }) => {
|
async ({ homePage, scene, toolbar, page, cmdBar }) => {
|
||||||
await page.addInitScript(async () => {
|
await page.addInitScript(async () => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'persistCode',
|
'persistCode',
|
||||||
@ -2122,6 +2355,8 @@ extrude001 = extrude(profile003, length = 5)
|
|||||||
|
|
||||||
await page.setBodyDimensions({ width: 1000, height: 500 })
|
await page.setBodyDimensions({ width: 1000, height: 500 })
|
||||||
await homePage.goToModelingScene()
|
await homePage.goToModelingScene()
|
||||||
|
await scene.connectionEstablished()
|
||||||
|
await scene.settled(cmdBar)
|
||||||
await expect(
|
await expect(
|
||||||
page.getByRole('button', { name: 'Start Sketch' })
|
page.getByRole('button', { name: 'Start Sketch' })
|
||||||
).not.toBeDisabled()
|
).not.toBeDisabled()
|
||||||
@ -2134,9 +2369,11 @@ extrude001 = extrude(profile003, length = 5)
|
|||||||
await page.waitForTimeout(600)
|
await page.waitForTimeout(600)
|
||||||
|
|
||||||
await test.step('check the sketch is still drawn properly', async () => {
|
await test.step('check the sketch is still drawn properly', async () => {
|
||||||
await scene.expectPixelColor([255, 255, 255], { x: 596, y: 165 }, 15)
|
await Promise.all([
|
||||||
await scene.expectPixelColor([255, 255, 255], { x: 641, y: 220 }, 15)
|
scene.expectPixelColor(TEST_COLORS.WHITE, { x: 596, y: 165 }, 15),
|
||||||
await scene.expectPixelColor([255, 255, 255], { x: 763, y: 214 }, 15)
|
scene.expectPixelColor(TEST_COLORS.WHITE, { x: 641, y: 220 }, 15),
|
||||||
|
scene.expectPixelColor(TEST_COLORS.WHITE, { x: 763, y: 214 }, 15),
|
||||||
|
])
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -2293,7 +2530,7 @@ extrude001 = extrude(thePart, length = 75)
|
|||||||
test(
|
test(
|
||||||
'Can enter sketch on sketch of wall and cap for segment, solid2d, extrude-wall, extrude-cap selections',
|
'Can enter sketch on sketch of wall and cap for segment, solid2d, extrude-wall, extrude-cap selections',
|
||||||
{ tag: ['@skipWin'] },
|
{ tag: ['@skipWin'] },
|
||||||
async ({ homePage, scene, toolbar, editor, page }) => {
|
async ({ homePage, scene, toolbar, editor, page, cmdBar }) => {
|
||||||
// TODO this test should include a test for selecting revolve walls and caps
|
// TODO this test should include a test for selecting revolve walls and caps
|
||||||
|
|
||||||
await page.addInitScript(async () => {
|
await page.addInitScript(async () => {
|
||||||
@ -2378,6 +2615,8 @@ extrude003 = extrude(profile011, length = 2.5)
|
|||||||
|
|
||||||
await page.setBodyDimensions({ width: 1000, height: 500 })
|
await page.setBodyDimensions({ width: 1000, height: 500 })
|
||||||
await homePage.goToModelingScene()
|
await homePage.goToModelingScene()
|
||||||
|
await scene.connectionEstablished()
|
||||||
|
await scene.settled(cmdBar)
|
||||||
await expect(
|
await expect(
|
||||||
page.getByRole('button', { name: 'Start Sketch' })
|
page.getByRole('button', { name: 'Start Sketch' })
|
||||||
).not.toBeDisabled()
|
).not.toBeDisabled()
|
||||||
@ -2387,11 +2626,6 @@ extrude003 = extrude(profile011, length = 2.5)
|
|||||||
{ x: 834, y: -680, z: 534 },
|
{ x: 834, y: -680, z: 534 },
|
||||||
{ x: -54, y: -476, z: 148 }
|
{ x: -54, y: -476, z: 148 }
|
||||||
)
|
)
|
||||||
const camPositionForSelectingSketchOnCapProfiles = () =>
|
|
||||||
scene.moveCameraTo(
|
|
||||||
{ x: 404, y: 690, z: 38 },
|
|
||||||
{ x: 16, y: -140, z: -10 }
|
|
||||||
)
|
|
||||||
const wallSelectionOptions = [
|
const wallSelectionOptions = [
|
||||||
{
|
{
|
||||||
title: 'select wall segment',
|
title: 'select wall segment',
|
||||||
@ -2414,103 +2648,25 @@ extrude003 = extrude(profile011, length = 2.5)
|
|||||||
selectClick: scene.makeMouseHelpers(836, 103)[0],
|
selectClick: scene.makeMouseHelpers(836, 103)[0],
|
||||||
},
|
},
|
||||||
] as const
|
] as const
|
||||||
const capSelectionOptions = [
|
|
||||||
{
|
|
||||||
title: 'select cap segment',
|
|
||||||
selectClick: scene.makeMouseHelpers(688, 91)[0],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'select cap solid 2d',
|
|
||||||
selectClick: scene.makeMouseHelpers(733, 204)[0],
|
|
||||||
},
|
|
||||||
// TODO keeps failing
|
|
||||||
// {
|
|
||||||
// title: 'select cap circle',
|
|
||||||
// selectClick: scene.makeMouseHelpers(679, 290)[0],
|
|
||||||
// },
|
|
||||||
{
|
|
||||||
title: 'select cap extrude wall',
|
|
||||||
selectClick: scene.makeMouseHelpers(649, 402)[0],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'select cap extrude cap',
|
|
||||||
selectClick: scene.makeMouseHelpers(693, 408)[0],
|
|
||||||
},
|
|
||||||
] as const
|
|
||||||
|
|
||||||
const verifyWallProfilesAreDrawn = async () =>
|
const verifyWallProfilesAreDrawn = async () =>
|
||||||
test.step('verify wall profiles are drawn', async () => {
|
test.step('verify wall profiles are drawn', async () => {
|
||||||
// open polygon
|
await Promise.all([
|
||||||
await scene.expectPixelColor(
|
// open polygon
|
||||||
TEST_COLORS.WHITE,
|
scene.expectPixelColor(TEST_COLORS.WHITE, { x: 599, y: 168 }, 15),
|
||||||
{ x: 599, y: 168 },
|
// closed polygon
|
||||||
15
|
scene.expectPixelColor(TEST_COLORS.WHITE, { x: 656, y: 171 }, 15),
|
||||||
)
|
// revolved profile
|
||||||
// closed polygon
|
scene.expectPixelColor(TEST_COLORS.WHITE, { x: 655, y: 264 }, 15),
|
||||||
await scene.expectPixelColor(
|
// extruded profile
|
||||||
TEST_COLORS.WHITE,
|
scene.expectPixelColor(TEST_COLORS.WHITE, { x: 808, y: 396 }, 15),
|
||||||
{ x: 656, y: 171 },
|
// circle (When entering via the circle, it's selected and therefore blue)
|
||||||
15
|
scene.expectPixelColor(
|
||||||
)
|
[TEST_COLORS.WHITE, TEST_COLORS.BLUE],
|
||||||
// revolved profile
|
{ x: 742, y: 386 },
|
||||||
await scene.expectPixelColor(
|
15
|
||||||
TEST_COLORS.WHITE,
|
),
|
||||||
{ x: 655, y: 264 },
|
])
|
||||||
15
|
|
||||||
)
|
|
||||||
// extruded profile
|
|
||||||
await scene.expectPixelColor(
|
|
||||||
TEST_COLORS.WHITE,
|
|
||||||
{ x: 808, y: 396 },
|
|
||||||
15
|
|
||||||
)
|
|
||||||
// circle
|
|
||||||
await scene.expectPixelColor(
|
|
||||||
[
|
|
||||||
TEST_COLORS.WHITE,
|
|
||||||
TEST_COLORS.BLUE, // When entering via the circle, it's selected and therefore blue
|
|
||||||
],
|
|
||||||
{ x: 742, y: 386 },
|
|
||||||
15
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
const verifyCapProfilesAreDrawn = async () =>
|
|
||||||
test.step('verify cap profiles are drawn', async () => {
|
|
||||||
// open polygon
|
|
||||||
await scene.expectPixelColor(
|
|
||||||
TEST_COLORS.WHITE,
|
|
||||||
// TEST_COLORS.BLUE, // When entering via the circle, it's selected and therefore blue
|
|
||||||
{ x: 620, y: 58 },
|
|
||||||
15
|
|
||||||
)
|
|
||||||
// revolved profile
|
|
||||||
await scene.expectPixelColor(
|
|
||||||
TEST_COLORS.WHITE,
|
|
||||||
{ x: 641, y: 110 },
|
|
||||||
15
|
|
||||||
)
|
|
||||||
// closed polygon
|
|
||||||
await scene.expectPixelColor(
|
|
||||||
TEST_COLORS.WHITE,
|
|
||||||
{ x: 632, y: 200 },
|
|
||||||
15
|
|
||||||
)
|
|
||||||
// extruded profile
|
|
||||||
await scene.expectPixelColor(
|
|
||||||
TEST_COLORS.WHITE,
|
|
||||||
{ x: 628, y: 410 },
|
|
||||||
15
|
|
||||||
)
|
|
||||||
// circle
|
|
||||||
await scene.expectPixelColor(
|
|
||||||
[
|
|
||||||
TEST_COLORS.WHITE,
|
|
||||||
TEST_COLORS.BLUE, // When entering via the circle, it's selected and therefore blue
|
|
||||||
],
|
|
||||||
{ x: 681, y: 303 },
|
|
||||||
15
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
await test.step('select wall profiles', async () => {
|
await test.step('select wall profiles', async () => {
|
||||||
|
@ -7,12 +7,7 @@ import { spawn } from 'child_process'
|
|||||||
import { KCL_DEFAULT_LENGTH } from 'lib/constants'
|
import { KCL_DEFAULT_LENGTH } from 'lib/constants'
|
||||||
import JSZip from 'jszip'
|
import JSZip from 'jszip'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import {
|
import { TEST_SETTINGS, TEST_SETTINGS_KEY } from './storageStates'
|
||||||
IS_PLAYWRIGHT_KEY,
|
|
||||||
TEST_SETTINGS,
|
|
||||||
TEST_SETTINGS_KEY,
|
|
||||||
} from './storageStates'
|
|
||||||
import * as TOML from '@iarna/toml'
|
|
||||||
import { SceneFixture } from './fixtures/sceneFixture'
|
import { SceneFixture } from './fixtures/sceneFixture'
|
||||||
import { CmdBarFixture } from './fixtures/cmdBarFixture'
|
import { CmdBarFixture } from './fixtures/cmdBarFixture'
|
||||||
|
|
||||||
@ -410,9 +405,9 @@ test.describe(
|
|||||||
test(
|
test(
|
||||||
'Draft segments should look right',
|
'Draft segments should look right',
|
||||||
{ tag: '@snapshot' },
|
{ tag: '@snapshot' },
|
||||||
async ({ page, context, scene, cmdBar }) => {
|
async ({ page, scene, toolbar }) => {
|
||||||
// FIXME: Skip on macos its being weird.
|
// FIXME: Skip on macos its being weird.
|
||||||
test.skip(process.platform === 'darwin', 'Skip on macos')
|
// test.skip(process.platform === 'darwin', 'Skip on macos')
|
||||||
|
|
||||||
const u = await getUtils(page)
|
const u = await getUtils(page)
|
||||||
await page.setViewportSize({ width: 1200, height: 500 })
|
await page.setViewportSize({ width: 1200, height: 500 })
|
||||||
@ -421,6 +416,23 @@ test(
|
|||||||
|
|
||||||
await scene.connectionEstablished()
|
await scene.connectionEstablished()
|
||||||
|
|
||||||
|
const startXPx = 600
|
||||||
|
const [endOfTangentClk, endOfTangentMv] = scene.makeMouseHelpers(
|
||||||
|
startXPx + PUR * 30,
|
||||||
|
500 - PUR * 20,
|
||||||
|
{ steps: 10 }
|
||||||
|
)
|
||||||
|
const [threePointArcMidPointClk, threePointArcMidPointMv] =
|
||||||
|
scene.makeMouseHelpers(800, 250, { steps: 10 })
|
||||||
|
const [threePointArcEndPointClk, threePointArcEndPointMv] =
|
||||||
|
scene.makeMouseHelpers(750, 285, { steps: 10 })
|
||||||
|
const [arcCenterClk, arcCenterMv] = scene.makeMouseHelpers(750, 210, {
|
||||||
|
steps: 10,
|
||||||
|
})
|
||||||
|
const [arcEndClk, arcEndMv] = scene.makeMouseHelpers(750, 150, {
|
||||||
|
steps: 10,
|
||||||
|
})
|
||||||
|
|
||||||
// click on "Start Sketch" button
|
// click on "Start Sketch" button
|
||||||
await u.doAndWaitForImageDiff(
|
await u.doAndWaitForImageDiff(
|
||||||
() => page.getByRole('button', { name: 'Start Sketch' }).click(),
|
() => page.getByRole('button', { name: 'Start Sketch' }).click(),
|
||||||
@ -435,7 +447,6 @@ test(
|
|||||||
|
|
||||||
await page.waitForTimeout(700) // TODO detect animation ending, or disable animation
|
await page.waitForTimeout(700) // TODO detect animation ending, or disable animation
|
||||||
|
|
||||||
const startXPx = 600
|
|
||||||
await page.mouse.click(startXPx + PUR * 10, 500 - PUR * 10)
|
await page.mouse.click(startXPx + PUR * 10, 500 - PUR * 10)
|
||||||
code += `profile001 = startProfileAt([7.19, -9.7], sketch001)`
|
code += `profile001 = startProfileAt([7.19, -9.7], sketch001)`
|
||||||
await expect(page.locator('.cm-content')).toHaveText(code)
|
await expect(page.locator('.cm-content')).toHaveText(code)
|
||||||
@ -471,12 +482,52 @@ test(
|
|||||||
await page.mouse.move(813, 392, { steps: 10 })
|
await page.mouse.move(813, 392, { steps: 10 })
|
||||||
await page.waitForTimeout(500)
|
await page.waitForTimeout(500)
|
||||||
|
|
||||||
await page.mouse.move(startXPx + PUR * 30, 500 - PUR * 20, { steps: 10 })
|
await endOfTangentMv()
|
||||||
|
|
||||||
await expect(page).toHaveScreenshot({
|
await expect(page).toHaveScreenshot({
|
||||||
maxDiffPixels: 100,
|
maxDiffPixels: 100,
|
||||||
mask: [page.getByTestId('model-state-indicator')],
|
mask: [page.getByTestId('model-state-indicator')],
|
||||||
})
|
})
|
||||||
|
await endOfTangentClk()
|
||||||
|
|
||||||
|
await toolbar.selectThreePointArc()
|
||||||
|
await page.waitForTimeout(500)
|
||||||
|
await endOfTangentClk()
|
||||||
|
await threePointArcMidPointMv()
|
||||||
|
await expect(page).toHaveScreenshot({
|
||||||
|
maxDiffPixels: 100,
|
||||||
|
mask: [page.getByTestId('model-state-indicator')],
|
||||||
|
})
|
||||||
|
await threePointArcMidPointClk()
|
||||||
|
await page.waitForTimeout(100)
|
||||||
|
|
||||||
|
await threePointArcEndPointMv()
|
||||||
|
await page.waitForTimeout(500)
|
||||||
|
await expect(page).toHaveScreenshot({
|
||||||
|
maxDiffPixels: 100,
|
||||||
|
mask: [page.getByTestId('model-state-indicator')],
|
||||||
|
})
|
||||||
|
|
||||||
|
await threePointArcEndPointClk()
|
||||||
|
await page.waitForTimeout(100)
|
||||||
|
|
||||||
|
await toolbar.selectArc()
|
||||||
|
await page.waitForTimeout(100)
|
||||||
|
|
||||||
|
// continue the profile
|
||||||
|
await threePointArcEndPointClk()
|
||||||
|
await page.waitForTimeout(100)
|
||||||
|
await arcCenterMv()
|
||||||
|
await page.waitForTimeout(500)
|
||||||
|
await arcCenterClk()
|
||||||
|
|
||||||
|
await arcEndMv()
|
||||||
|
await page.waitForTimeout(500)
|
||||||
|
await expect(page).toHaveScreenshot({
|
||||||
|
maxDiffPixels: 100,
|
||||||
|
mask: [page.getByTestId('model-state-indicator')],
|
||||||
|
})
|
||||||
|
await arcEndClk()
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 54 KiB |
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 52 KiB |
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 60 KiB |
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 53 KiB |
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 45 KiB |
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 45 KiB |
After Width: | Height: | Size: 49 KiB |
After Width: | Height: | Size: 55 KiB |
After Width: | Height: | Size: 68 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 52 KiB |
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 66 KiB |
Before Width: | Height: | Size: 145 KiB After Width: | Height: | Size: 143 KiB |
Before Width: | Height: | Size: 128 KiB After Width: | Height: | Size: 127 KiB |
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 74 KiB |
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 69 KiB |
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 72 KiB |
@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
"original_source_code": "sketch001 = startSketchOn('XZ')\nprofile001 = startProfileAt([57.81, 250.51], sketch001)\n |> line(end = [121.13, 56.63], tag = $seg02)\n |> line(end = [83.37, -34.61], tag = $seg01)\n |> line(end = [19.66, -116.4])\n |> line(end = [-221.8, -41.69])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\nextrude001 = extrude(profile001, length = 200)\nsketch002 = startSketchOn('XZ')\n |> startProfileAt([-73.64, -42.89], %)\n |> xLine(length = 173.71)\n |> line(end = [-22.12, -94.4])\n |> xLine(length = -156.98)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\nextrude002 = extrude(sketch002, length = 50)\nsketch003 = startSketchOn('XY')\n |> startProfileAt([52.92, 157.81], %)\n |> angledLine([0, 176.4], %, $rectangleSegmentA001)\n |> angledLine([\n segAng(rectangleSegmentA001) - 90,\n 53.4\n ], %, $rectangleSegmentB001)\n |> angledLine([\n segAng(rectangleSegmentA001),\n -segLen(rectangleSegmentA001)\n ], %, $rectangleSegmentC001)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\nextrude003 = extrude(sketch003, length = 20)\n",
|
||||||
|
"prompt": "make this neon green please, use #39FF14",
|
||||||
|
"source_ranges": [
|
||||||
|
{
|
||||||
|
"prompt": "The users main selection is the end cap of a general-sweep (that is an extrusion, revolve, sweep or loft).\nThe source range most likely refers to \"startProfileAt\" simply because this is the start of the profile that was swept.\nIf you need to operate on this cap, for example for sketching on the face, you can use the special string END i.e. `startSketchOn(someSweepVariable, END)`\nWhen they made this selection they main have intended this surface directly or meant something more general like the sweep body.\nSee later source ranges for more context.",
|
||||||
|
"range": {
|
||||||
|
"start": {
|
||||||
|
"line": 11,
|
||||||
|
"column": 5
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 11,
|
||||||
|
"column": 40
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"prompt": "This is the sweep's source range from the user's main selection of the end cap.",
|
||||||
|
"range": {
|
||||||
|
"start": {
|
||||||
|
"line": 17,
|
||||||
|
"column": 13
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 17,
|
||||||
|
"column": 44
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kcl_version": "0.2.50"
|
||||||
|
}
|
@ -1,4 +1,3 @@
|
|||||||
import { MouseControlType } from '@rust/kcl-lib/bindings/MouseControlType'
|
|
||||||
import { Settings } from '@rust/kcl-lib/bindings/Settings'
|
import { Settings } from '@rust/kcl-lib/bindings/Settings'
|
||||||
import { SaveSettingsPayload } from 'lib/settings/settingsTypes'
|
import { SaveSettingsPayload } from 'lib/settings/settingsTypes'
|
||||||
import { Themes } from 'lib/theme'
|
import { Themes } from 'lib/theme'
|
||||||
|
@ -2,15 +2,12 @@ import {
|
|||||||
expect,
|
expect,
|
||||||
BrowserContext,
|
BrowserContext,
|
||||||
TestInfo,
|
TestInfo,
|
||||||
_electron as electron,
|
|
||||||
ElectronApplication,
|
|
||||||
Locator,
|
Locator,
|
||||||
Page,
|
Page,
|
||||||
} from '@playwright/test'
|
} from '@playwright/test'
|
||||||
import { test } from './zoo-test'
|
import { test } from './zoo-test'
|
||||||
import { EngineCommand } from 'lang/std/artifactGraph'
|
import { EngineCommand } from 'lang/std/artifactGraph'
|
||||||
import fsp from 'fs/promises'
|
import fsp from 'fs/promises'
|
||||||
import fsSync from 'fs'
|
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import pixelMatch from 'pixelmatch'
|
import pixelMatch from 'pixelmatch'
|
||||||
import { PNG } from 'pngjs'
|
import { PNG } from 'pngjs'
|
||||||
@ -24,14 +21,11 @@ import {
|
|||||||
IS_PLAYWRIGHT_KEY,
|
IS_PLAYWRIGHT_KEY,
|
||||||
} from './storageStates'
|
} from './storageStates'
|
||||||
import * as TOML from '@iarna/toml'
|
import * as TOML from '@iarna/toml'
|
||||||
import { SaveSettingsPayload } from 'lib/settings/settingsTypes'
|
|
||||||
import { SETTINGS_FILE_NAME } from 'lib/constants'
|
|
||||||
import { isErrorWhitelisted } from './lib/console-error-whitelist'
|
import { isErrorWhitelisted } from './lib/console-error-whitelist'
|
||||||
import { isArray } from 'lib/utils'
|
import { isArray } from 'lib/utils'
|
||||||
import { reportRejection } from 'lib/trap'
|
import { reportRejection } from 'lib/trap'
|
||||||
import { DeepPartial } from 'lib/types'
|
import { DeepPartial } from 'lib/types'
|
||||||
import { Configuration } from 'lang/wasm'
|
import { Configuration } from 'lang/wasm'
|
||||||
import { Settings } from '@rust/kcl-lib/bindings/Settings'
|
|
||||||
|
|
||||||
const toNormalizedCode = (text: string) => {
|
const toNormalizedCode = (text: string) => {
|
||||||
return text.replace(/\s+/g, '')
|
return text.replace(/\s+/g, '')
|
||||||
@ -928,10 +922,6 @@ export async function setup(
|
|||||||
// await page.reload()
|
// await page.reload()
|
||||||
}
|
}
|
||||||
|
|
||||||
let electronApp: ElectronApplication | undefined = undefined
|
|
||||||
let context: BrowserContext | undefined = undefined
|
|
||||||
let page: Page | undefined = undefined
|
|
||||||
|
|
||||||
function failOnConsoleErrors(page: Page, testInfo?: TestInfo) {
|
function failOnConsoleErrors(page: Page, testInfo?: TestInfo) {
|
||||||
// enabled for chrome for now
|
// enabled for chrome for now
|
||||||
if (page.context().browser()?.browserType().name() === 'chromium') {
|
if (page.context().browser()?.browserType().name() === 'chromium') {
|
||||||
|
@ -4,7 +4,6 @@ import { bracket } from 'lib/exampleKcl'
|
|||||||
import * as fsp from 'fs/promises'
|
import * as fsp from 'fs/promises'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import { FILE_EXT } from 'lib/constants'
|
import { FILE_EXT } from 'lib/constants'
|
||||||
import { UnitLength_type } from '@kittycad/lib/dist/types/src/models'
|
|
||||||
|
|
||||||
test.describe('Testing in-app sample loading', () => {
|
test.describe('Testing in-app sample loading', () => {
|
||||||
/**
|
/**
|
||||||
@ -49,8 +48,6 @@ test.describe('Testing in-app sample loading', () => {
|
|||||||
})
|
})
|
||||||
const warningText = page.getByText('Overwrite current file and units?')
|
const warningText = page.getByText('Overwrite current file and units?')
|
||||||
const confirmButton = page.getByRole('button', { name: 'Submit command' })
|
const confirmButton = page.getByRole('button', { name: 'Submit command' })
|
||||||
const unitsToast = (unit: UnitLength_type) =>
|
|
||||||
page.getByText(`Set default unit to "${unit}" for this project`)
|
|
||||||
|
|
||||||
await test.step(`Precondition: check the initial code`, async () => {
|
await test.step(`Precondition: check the initial code`, async () => {
|
||||||
await u.openKclCodePanel()
|
await u.openKclCodePanel()
|
||||||
@ -125,8 +122,6 @@ test.describe('Testing in-app sample loading', () => {
|
|||||||
page.getByRole('listitem').filter({
|
page.getByRole('listitem').filter({
|
||||||
has: page.getByRole('button', { name }),
|
has: page.getByRole('button', { name }),
|
||||||
})
|
})
|
||||||
const unitsToast = (unit: UnitLength_type) =>
|
|
||||||
page.getByText(`Set default unit to "${unit}" for this project`)
|
|
||||||
|
|
||||||
await test.step(`Test setup`, async () => {
|
await test.step(`Test setup`, async () => {
|
||||||
await page.setBodyDimensions({ width: 1200, height: 500 })
|
await page.setBodyDimensions({ width: 1200, height: 500 })
|
||||||
|
@ -159,7 +159,6 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|
|||||||
const unconstrainedLocator = page.locator(
|
const unconstrainedLocator = page.locator(
|
||||||
`[data-constraint-type="${constraintType}"][data-is-constrained="false"]`
|
`[data-constraint-type="${constraintType}"][data-is-constrained="false"]`
|
||||||
)
|
)
|
||||||
await expect(unconstrainedLocator).toBeVisible()
|
|
||||||
await unconstrainedLocator.hover()
|
await unconstrainedLocator.hover()
|
||||||
await expect(
|
await expect(
|
||||||
await page.getByTestId('constraint-symbol-popover').count()
|
await page.getByTestId('constraint-symbol-popover').count()
|
||||||
@ -274,8 +273,8 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|
|||||||
|
|
||||||
let ang = 0
|
let ang = 0
|
||||||
|
|
||||||
const line = await u.getBoundingBox(`[data-overlay-index="${0}"]`)
|
const line = await u.getBoundingBox('[data-overlay-index="0"]')
|
||||||
ang = await u.getAngle(`[data-overlay-index="${0}"]`)
|
ang = await u.getAngle('[data-overlay-index="0"]')
|
||||||
console.log('line1', line, ang)
|
console.log('line1', line, ang)
|
||||||
await clickConstrained({
|
await clickConstrained({
|
||||||
hoverPos: { x: line.x, y: line.y },
|
hoverPos: { x: line.x, y: line.y },
|
||||||
@ -297,8 +296,8 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|
|||||||
locator: '[data-overlay-index="0"]',
|
locator: '[data-overlay-index="0"]',
|
||||||
})
|
})
|
||||||
|
|
||||||
const angledLine = await u.getBoundingBox(`[data-overlay-index="1"]`)
|
const angledLine = await u.getBoundingBox('[data-overlay-index="1"]')
|
||||||
ang = await u.getAngle(`[data-overlay-index="1"]`)
|
ang = await u.getAngle('[data-overlay-index="1"]')
|
||||||
console.log('angledLine1')
|
console.log('angledLine1')
|
||||||
await clickConstrained({
|
await clickConstrained({
|
||||||
hoverPos: { x: angledLine.x, y: angledLine.y },
|
hoverPos: { x: angledLine.x, y: angledLine.y },
|
||||||
@ -327,8 +326,8 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|
|||||||
await page.mouse.move(700, 250)
|
await page.mouse.move(700, 250)
|
||||||
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"]')
|
||||||
ang = await u.getAngle(`[data-overlay-index="2"]`)
|
ang = await u.getAngle('[data-overlay-index="2"]')
|
||||||
console.log('lineTo1')
|
console.log('lineTo1')
|
||||||
await clickConstrained({
|
await clickConstrained({
|
||||||
hoverPos: { x: lineTo.x, y: lineTo.y },
|
hoverPos: { x: lineTo.x, y: lineTo.y },
|
||||||
@ -353,8 +352,8 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|
|||||||
locator: '[data-overlay-toolbar-index="2"]',
|
locator: '[data-overlay-toolbar-index="2"]',
|
||||||
})
|
})
|
||||||
|
|
||||||
const xLineTo = await u.getBoundingBox(`[data-overlay-index="3"]`)
|
const xLineTo = await u.getBoundingBox('[data-overlay-index="3"]')
|
||||||
ang = await u.getAngle(`[data-overlay-index="3"]`)
|
ang = await u.getAngle('[data-overlay-index="3"]')
|
||||||
console.log('xlineTo1')
|
console.log('xlineTo1')
|
||||||
await clickConstrained({
|
await clickConstrained({
|
||||||
hoverPos: { x: xLineTo.x, y: xLineTo.y },
|
hoverPos: { x: xLineTo.x, y: xLineTo.y },
|
||||||
@ -419,8 +418,8 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|
|||||||
|
|
||||||
let ang = 0
|
let ang = 0
|
||||||
|
|
||||||
const yLineTo = await u.getBoundingBox(`[data-overlay-index="4"]`)
|
const yLineTo = await u.getBoundingBox('[data-overlay-index="4"]')
|
||||||
ang = await u.getAngle(`[data-overlay-index="4"]`)
|
ang = await u.getAngle('[data-overlay-index="4"]')
|
||||||
console.log('ylineTo1')
|
console.log('ylineTo1')
|
||||||
await clickUnconstrained({
|
await clickUnconstrained({
|
||||||
hoverPos: { x: yLineTo.x, y: yLineTo.y - 200 },
|
hoverPos: { x: yLineTo.x, y: yLineTo.y - 200 },
|
||||||
@ -432,8 +431,8 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|
|||||||
locator: '[data-overlay-toolbar-index="4"]',
|
locator: '[data-overlay-toolbar-index="4"]',
|
||||||
})
|
})
|
||||||
|
|
||||||
const xLine = await u.getBoundingBox(`[data-overlay-index="5"]`)
|
const xLine = await u.getBoundingBox('[data-overlay-index="5"]')
|
||||||
ang = await u.getAngle(`[data-overlay-index="5"]`)
|
ang = await u.getAngle('[data-overlay-index="5"]')
|
||||||
console.log('xline')
|
console.log('xline')
|
||||||
await clickUnconstrained({
|
await clickUnconstrained({
|
||||||
hoverPos: { x: xLine.x, y: xLine.y },
|
hoverPos: { x: xLine.x, y: xLine.y },
|
||||||
@ -501,8 +500,8 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|
|||||||
|
|
||||||
let ang = 0
|
let ang = 0
|
||||||
|
|
||||||
const yLine = await u.getBoundingBox(`[data-overlay-index="6"]`)
|
const yLine = await u.getBoundingBox('[data-overlay-index="6"]')
|
||||||
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 },
|
hoverPos: { x: yLine.x, y: yLine.y },
|
||||||
@ -515,9 +514,9 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const angledLineOfXLength = await u.getBoundingBox(
|
const angledLineOfXLength = await u.getBoundingBox(
|
||||||
`[data-overlay-index="7"]`
|
'[data-overlay-index="7"]'
|
||||||
)
|
)
|
||||||
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, y: angledLineOfXLength.y },
|
hoverPos: { x: angledLineOfXLength.x, y: angledLineOfXLength.y },
|
||||||
@ -547,9 +546,9 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const angledLineOfYLength = await u.getBoundingBox(
|
const angledLineOfYLength = await u.getBoundingBox(
|
||||||
`[data-overlay-index="8"]`
|
'[data-overlay-index="8"]'
|
||||||
)
|
)
|
||||||
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 },
|
hoverPos: { x: angledLineOfYLength.x, y: angledLineOfYLength.y },
|
||||||
@ -632,8 +631,8 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|
|||||||
|
|
||||||
let ang = 0
|
let ang = 0
|
||||||
|
|
||||||
const angledLineToX = await u.getBoundingBox(`[data-overlay-index="9"]`)
|
const angledLineToX = await u.getBoundingBox('[data-overlay-index="9"]')
|
||||||
ang = await u.getAngle(`[data-overlay-index="9"]`)
|
ang = await u.getAngle('[data-overlay-index="9"]')
|
||||||
console.log('angledLineToX')
|
console.log('angledLineToX')
|
||||||
await clickConstrained({
|
await clickConstrained({
|
||||||
hoverPos: { x: angledLineToX.x, y: angledLineToX.y },
|
hoverPos: { x: angledLineToX.x, y: angledLineToX.y },
|
||||||
@ -659,9 +658,9 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const angledLineToY = await u.getBoundingBox(
|
const angledLineToY = await u.getBoundingBox(
|
||||||
`[data-overlay-index="10"]`
|
'[data-overlay-index="10"]'
|
||||||
)
|
)
|
||||||
ang = await u.getAngle(`[data-overlay-index="10"]`)
|
ang = await u.getAngle('[data-overlay-index="10"]')
|
||||||
console.log('angledLineToY')
|
console.log('angledLineToY')
|
||||||
await clickUnconstrained({
|
await clickUnconstrained({
|
||||||
hoverPos: { x: angledLineToY.x, y: angledLineToY.y },
|
hoverPos: { x: angledLineToY.x, y: angledLineToY.y },
|
||||||
@ -689,9 +688,9 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const angledLineThatIntersects = await u.getBoundingBox(
|
const angledLineThatIntersects = await u.getBoundingBox(
|
||||||
`[data-overlay-index="11"]`
|
'[data-overlay-index="11"]'
|
||||||
)
|
)
|
||||||
ang = await u.getAngle(`[data-overlay-index="11"]`)
|
ang = await u.getAngle('[data-overlay-index="11"]')
|
||||||
console.log('angledLineThatIntersects')
|
console.log('angledLineThatIntersects')
|
||||||
await clickUnconstrained({
|
await clickUnconstrained({
|
||||||
hoverPos: {
|
hoverPos: {
|
||||||
@ -821,6 +820,138 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|
|||||||
locator: '[data-overlay-toolbar-index="12"]',
|
locator: '[data-overlay-toolbar-index="12"]',
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
test('for segment [arcTo]', async ({
|
||||||
|
page,
|
||||||
|
editor,
|
||||||
|
homePage,
|
||||||
|
scene,
|
||||||
|
cmdBar,
|
||||||
|
}) => {
|
||||||
|
await page.addInitScript(async () => {
|
||||||
|
localStorage.setItem(
|
||||||
|
'persistCode',
|
||||||
|
`sketch001 = startSketchOn('XZ')
|
||||||
|
profile001 = startProfileAt([56.37, 120.33], sketch001)
|
||||||
|
|> line(end = [162.86, 106.48])
|
||||||
|
|> arcTo({
|
||||||
|
interior = [360.16, 231.76],
|
||||||
|
end = [391.48, 131.54]
|
||||||
|
}, %)
|
||||||
|
|> yLine(-131.54, %)
|
||||||
|
|> arc({
|
||||||
|
radius = 126.46,
|
||||||
|
angleStart = 33.53,
|
||||||
|
angleEnd = -141.07
|
||||||
|
}, %)
|
||||||
|
`
|
||||||
|
)
|
||||||
|
localStorage.setItem('disableAxis', 'true')
|
||||||
|
})
|
||||||
|
const u = await getUtils(page)
|
||||||
|
await page.setBodyDimensions({ width: 1200, height: 500 })
|
||||||
|
|
||||||
|
await homePage.goToModelingScene()
|
||||||
|
await scene.connectionEstablished()
|
||||||
|
await scene.settled(cmdBar)
|
||||||
|
|
||||||
|
// wait for execution done
|
||||||
|
|
||||||
|
await page.getByText('line(end = [162.86, 106.48])').click()
|
||||||
|
await page.waitForTimeout(100)
|
||||||
|
await page.getByRole('button', { name: 'Edit Sketch' }).click()
|
||||||
|
await page.waitForTimeout(500)
|
||||||
|
|
||||||
|
await expect(page.getByTestId('segment-overlay')).toHaveCount(5)
|
||||||
|
|
||||||
|
const clickUnconstrained = _clickUnconstrained(page, editor)
|
||||||
|
const clickConstrained = _clickConstrained(page, editor)
|
||||||
|
|
||||||
|
const arcTo = await u.getBoundingBox('[data-overlay-index="1"]')
|
||||||
|
let ang = await u.getAngle('[data-overlay-index="1"]')
|
||||||
|
console.log('arcTo interior x')
|
||||||
|
await clickUnconstrained({
|
||||||
|
hoverPos: { x: arcTo.x, y: arcTo.y },
|
||||||
|
constraintType: 'xAbsolute',
|
||||||
|
expectBeforeUnconstrained: `arcTo({
|
||||||
|
interior = [360.16, 231.76],
|
||||||
|
end = [391.48, 131.54]
|
||||||
|
}, %)`,
|
||||||
|
expectAfterUnconstrained: `arcTo({
|
||||||
|
interior = [360.16, 231.76],
|
||||||
|
end = [391.48, 131.54]
|
||||||
|
}, %)`,
|
||||||
|
expectFinal: `arcTo({
|
||||||
|
interior = [xAbs001, 231.76],
|
||||||
|
end = [391.48, 131.54]
|
||||||
|
}, %)`,
|
||||||
|
ang: ang,
|
||||||
|
steps: 6,
|
||||||
|
locator: '[data-overlay-toolbar-index="1"]',
|
||||||
|
})
|
||||||
|
|
||||||
|
console.log('arcTo interior y')
|
||||||
|
await clickUnconstrained({
|
||||||
|
hoverPos: { x: arcTo.x, y: arcTo.y },
|
||||||
|
constraintType: 'yAbsolute',
|
||||||
|
expectBeforeUnconstrained: `arcTo({
|
||||||
|
interior = [xAbs001, 231.76],
|
||||||
|
end = [391.48, 131.54]
|
||||||
|
}, %)`,
|
||||||
|
expectAfterUnconstrained: `arcTo({
|
||||||
|
interior = [xAbs001, yAbs001],
|
||||||
|
end = [391.48, 131.54]
|
||||||
|
}, %)`,
|
||||||
|
expectFinal: `arcTo({
|
||||||
|
interior = [xAbs001, 231.76],
|
||||||
|
end = [391.48, 131.54]
|
||||||
|
}, %)`,
|
||||||
|
ang: ang,
|
||||||
|
steps: 10,
|
||||||
|
locator: '[data-overlay-toolbar-index="1"]',
|
||||||
|
})
|
||||||
|
|
||||||
|
console.log('arcTo end x')
|
||||||
|
await clickConstrained({
|
||||||
|
hoverPos: { x: arcTo.x, y: arcTo.y },
|
||||||
|
constraintType: 'xAbsolute',
|
||||||
|
expectBeforeUnconstrained: `arcTo({
|
||||||
|
interior = [xAbs001, 231.76],
|
||||||
|
end = [391.48, 131.54]
|
||||||
|
}, %)`,
|
||||||
|
expectAfterUnconstrained: `arcTo({
|
||||||
|
interior = [xAbs001, 231.76],
|
||||||
|
end = [391.48, 131.54]
|
||||||
|
}, %)`,
|
||||||
|
expectFinal: `arcTo({
|
||||||
|
interior = [xAbs001, 231.76],
|
||||||
|
end = [xAbs002, 131.54]
|
||||||
|
}, %)`,
|
||||||
|
ang: ang + 180,
|
||||||
|
steps: 6,
|
||||||
|
locator: '[data-overlay-toolbar-index="1"]',
|
||||||
|
})
|
||||||
|
|
||||||
|
console.log('arcTo end y')
|
||||||
|
await clickUnconstrained({
|
||||||
|
hoverPos: { x: arcTo.x, y: arcTo.y },
|
||||||
|
constraintType: 'yAbsolute',
|
||||||
|
expectBeforeUnconstrained: `arcTo({
|
||||||
|
interior = [xAbs001, 231.76],
|
||||||
|
end = [xAbs002, 131.54]
|
||||||
|
}, %)`,
|
||||||
|
expectAfterUnconstrained: `arcTo({
|
||||||
|
interior = [xAbs001, 231.76],
|
||||||
|
end = [xAbs002, yAbs002]
|
||||||
|
}, %)`,
|
||||||
|
expectFinal: `arcTo({
|
||||||
|
interior = [xAbs001, 231.76],
|
||||||
|
end = [xAbs002, 131.54]
|
||||||
|
}, %)`,
|
||||||
|
ang: ang + 180,
|
||||||
|
steps: 10,
|
||||||
|
locator: '[data-overlay-toolbar-index="1"]',
|
||||||
|
})
|
||||||
|
})
|
||||||
test('for segment [circle]', async ({ page, editor, homePage }) => {
|
test('for segment [circle]', async ({ page, editor, homePage }) => {
|
||||||
await page.addInitScript(async () => {
|
await page.addInitScript(async () => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
@ -928,36 +1059,55 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|
|||||||
shouldNormalise: true,
|
shouldNormalise: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
await page.locator(`[data-stdlib-fn-name="${stdLibFnName}"]`).click()
|
await page
|
||||||
|
.locator(`[data-stdlib-fn-name="${stdLibFnName}"]`)
|
||||||
|
.first()
|
||||||
|
.click()
|
||||||
await page.getByText('Delete Segment').click()
|
await page.getByText('Delete Segment').click()
|
||||||
|
|
||||||
await editor.expectEditor.not.toContain(codeToBeDeleted, {
|
await editor.expectEditor.not.toContain(codeToBeDeleted, {
|
||||||
shouldNormalise: true,
|
shouldNormalise: true,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
test('all segment types', async ({ page, editor, homePage }) => {
|
test('all segment types', async ({
|
||||||
|
page,
|
||||||
|
editor,
|
||||||
|
homePage,
|
||||||
|
scene,
|
||||||
|
cmdBar,
|
||||||
|
}) => {
|
||||||
await page.addInitScript(async () => {
|
await page.addInitScript(async () => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'persistCode',
|
'persistCode',
|
||||||
`part001 = startSketchOn('XZ')
|
`part001 = startSketchOn('XZ')
|
||||||
|> startProfileAt([0, 0], %)
|
|>startProfileAt([0, 0], %)
|
||||||
|> line(end = [0.5, -14 + 0])
|
|> line(end = [0.5, -14 + 0])
|
||||||
|> angledLine({ angle = 3 + 0, length = 32 + 0 }, %)
|
|> angledLine({ angle = 3 + 0, length = 32 + 0 }, %)
|
||||||
|> line(endAbsolute = [33, 11.5 + 0])
|
|> line(endAbsolute = [33, 11.5 + 0])
|
||||||
|> xLine(endAbsolute = 9 - 5)
|
|> xLine(endAbsolute = 9 - 5)
|
||||||
|> yLine(endAbsolute = -10.77, tag = $a)
|
|> yLine(endAbsolute = -10.77, tag = $a)
|
||||||
|> xLine(length = 26.04)
|
|> xLine(length = 26.04)
|
||||||
|> yLine(length = 21.14 + 0)
|
|> yLine(length = 21.14 + 0)
|
||||||
|> angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %)
|
|> angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %)
|
||||||
|> angledLineOfYLength({ angle = -91, length = 19 + 0 }, %)
|
|> angledLineOfYLength({ angle = -91, length = 19 + 0 }, %)
|
||||||
|> angledLineToX({ angle = 3 + 0, to = 26 }, %)
|
|> angledLineToX({ angle = 3 + 0, to = 26 }, %)
|
||||||
|> angledLineToY({ angle = 89, to = 9.14 + 0 }, %)
|
|> angledLineToY({ angle = 89, to = 9.14 + 0 }, %)
|
||||||
|> angledLineThatIntersects({
|
|> angledLineThatIntersects({
|
||||||
angle = 4.14,
|
angle = 4.14,
|
||||||
intersectTag = a,
|
intersectTag = a,
|
||||||
offset = 9
|
offset = 9
|
||||||
}, %)
|
}, %)
|
||||||
|> tangentialArcTo([3.14 + 13, 1.14], %)
|
|> tangentialArcTo([3.14 + 13, 1.14], %)
|
||||||
|
|> arcTo({
|
||||||
|
interior = [16.25, 5.12],
|
||||||
|
end = [21.61, 4.15]
|
||||||
|
}, %)
|
||||||
|
|> arc({
|
||||||
|
radius = 9.03,
|
||||||
|
angleStart = 40.27,
|
||||||
|
angleEnd = -38.05
|
||||||
|
}, %)
|
||||||
|
|
||||||
`
|
`
|
||||||
)
|
)
|
||||||
localStorage.setItem('disableAxis', 'true')
|
localStorage.setItem('disableAxis', 'true')
|
||||||
@ -966,27 +1116,55 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|
|||||||
await page.setBodyDimensions({ width: 1200, height: 500 })
|
await page.setBodyDimensions({ width: 1200, height: 500 })
|
||||||
|
|
||||||
await homePage.goToModelingScene()
|
await homePage.goToModelingScene()
|
||||||
|
await scene.connectionEstablished()
|
||||||
|
await scene.settled(cmdBar)
|
||||||
await u.waitForPageLoad()
|
await u.waitForPageLoad()
|
||||||
|
|
||||||
// wait for execution done
|
|
||||||
await u.openDebugPanel()
|
|
||||||
await u.expectCmdLog('[data-message-type="execution-done"]')
|
|
||||||
await u.closeDebugPanel()
|
|
||||||
|
|
||||||
await page.getByText('xLine(endAbsolute = 9 - 5)').click()
|
await page.getByText('xLine(endAbsolute = 9 - 5)').click()
|
||||||
await page.waitForTimeout(100)
|
await page.waitForTimeout(100)
|
||||||
await page.getByRole('button', { name: 'Edit Sketch' }).click()
|
await page.getByRole('button', { name: 'Edit Sketch' }).click()
|
||||||
await page.waitForTimeout(500)
|
await page.waitForTimeout(500)
|
||||||
|
|
||||||
await expect(page.getByTestId('segment-overlay')).toHaveCount(13)
|
await expect(page.getByTestId('segment-overlay')).toHaveCount(16)
|
||||||
const deleteSegmentSequence = _deleteSegmentSequence(page, editor)
|
const deleteSegmentSequence = _deleteSegmentSequence(page, editor)
|
||||||
|
|
||||||
let segmentToDelete
|
let segmentToDelete
|
||||||
|
|
||||||
const getOverlayByIndex = (index: number) =>
|
const getOverlayByIndex = (index: number) =>
|
||||||
u.getBoundingBox(`[data-overlay-index="${index}"]`)
|
u.getBoundingBox(`[data-overlay-index="${index}"]`)
|
||||||
|
|
||||||
|
segmentToDelete = await getOverlayByIndex(14)
|
||||||
|
let ang = await u.getAngle('[data-overlay-index="14"]')
|
||||||
|
|
||||||
|
await editor.scrollToText('angleEnd')
|
||||||
|
|
||||||
|
await deleteSegmentSequence({
|
||||||
|
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
|
||||||
|
codeToBeDeleted: `arc({
|
||||||
|
radius = 9.03,
|
||||||
|
angleStart = 40.27,
|
||||||
|
angleEnd = -38.05
|
||||||
|
}, %)`,
|
||||||
|
stdLibFnName: 'arc',
|
||||||
|
ang: ang + 180,
|
||||||
|
steps: 6,
|
||||||
|
locator: '[data-overlay-toolbar-index="14"]',
|
||||||
|
})
|
||||||
|
segmentToDelete = await getOverlayByIndex(13)
|
||||||
|
ang = await u.getAngle('[data-overlay-index="13"]')
|
||||||
|
await deleteSegmentSequence({
|
||||||
|
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
|
||||||
|
codeToBeDeleted: `arcTo({
|
||||||
|
interior = [16.25, 5.12],
|
||||||
|
end = [21.61, 4.15]
|
||||||
|
}, %)`,
|
||||||
|
stdLibFnName: 'arcTo',
|
||||||
|
ang: ang,
|
||||||
|
steps: 6,
|
||||||
|
locator: '[data-overlay-toolbar-index="13"]',
|
||||||
|
})
|
||||||
segmentToDelete = await getOverlayByIndex(12)
|
segmentToDelete = await getOverlayByIndex(12)
|
||||||
let ang = await u.getAngle(`[data-overlay-index="${12}"]`)
|
ang = await u.getAngle('[data-overlay-index="12"]')
|
||||||
await deleteSegmentSequence({
|
await deleteSegmentSequence({
|
||||||
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
|
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
|
||||||
codeToBeDeleted: 'tangentialArcTo([3.14 + 13, 1.14], %)',
|
codeToBeDeleted: 'tangentialArcTo([3.14 + 13, 1.14], %)',
|
||||||
@ -997,7 +1175,7 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
segmentToDelete = await getOverlayByIndex(11)
|
segmentToDelete = await getOverlayByIndex(11)
|
||||||
ang = await u.getAngle(`[data-overlay-index="${11}"]`)
|
ang = await u.getAngle('[data-overlay-index="11"]')
|
||||||
await deleteSegmentSequence({
|
await deleteSegmentSequence({
|
||||||
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
|
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
|
||||||
codeToBeDeleted: `angledLineThatIntersects({
|
codeToBeDeleted: `angledLineThatIntersects({
|
||||||
@ -1012,7 +1190,7 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
segmentToDelete = await getOverlayByIndex(10)
|
segmentToDelete = await getOverlayByIndex(10)
|
||||||
ang = await u.getAngle(`[data-overlay-index="${10}"]`)
|
ang = await u.getAngle('[data-overlay-index="10"]')
|
||||||
await deleteSegmentSequence({
|
await deleteSegmentSequence({
|
||||||
hoverPos: { x: segmentToDelete.x, 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 }, %)',
|
||||||
@ -1022,7 +1200,7 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
segmentToDelete = await getOverlayByIndex(9)
|
segmentToDelete = await getOverlayByIndex(9)
|
||||||
ang = await u.getAngle(`[data-overlay-index="${9}"]`)
|
ang = await u.getAngle('[data-overlay-index="9"]')
|
||||||
await deleteSegmentSequence({
|
await deleteSegmentSequence({
|
||||||
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
|
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
|
||||||
codeToBeDeleted: 'angledLineToX({ angle = 3 + 0, to = 26 }, %)',
|
codeToBeDeleted: 'angledLineToX({ angle = 3 + 0, to = 26 }, %)',
|
||||||
@ -1032,7 +1210,7 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
segmentToDelete = await getOverlayByIndex(8)
|
segmentToDelete = await getOverlayByIndex(8)
|
||||||
ang = await u.getAngle(`[data-overlay-index="${8}"]`)
|
ang = await u.getAngle('[data-overlay-index="8"]')
|
||||||
await deleteSegmentSequence({
|
await deleteSegmentSequence({
|
||||||
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
|
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
|
||||||
codeToBeDeleted:
|
codeToBeDeleted:
|
||||||
@ -1043,7 +1221,7 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
segmentToDelete = await getOverlayByIndex(7)
|
segmentToDelete = await getOverlayByIndex(7)
|
||||||
ang = await u.getAngle(`[data-overlay-index="${7}"]`)
|
ang = await u.getAngle('[data-overlay-index="7"]')
|
||||||
await deleteSegmentSequence({
|
await deleteSegmentSequence({
|
||||||
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
|
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
|
||||||
codeToBeDeleted:
|
codeToBeDeleted:
|
||||||
@ -1054,7 +1232,7 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
segmentToDelete = await getOverlayByIndex(6)
|
segmentToDelete = await getOverlayByIndex(6)
|
||||||
ang = await u.getAngle(`[data-overlay-index="${6}"]`)
|
ang = await u.getAngle('[data-overlay-index="6"]')
|
||||||
await deleteSegmentSequence({
|
await deleteSegmentSequence({
|
||||||
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
|
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
|
||||||
codeToBeDeleted: 'yLine(length = 21.14 + 0)',
|
codeToBeDeleted: 'yLine(length = 21.14 + 0)',
|
||||||
@ -1064,7 +1242,7 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
segmentToDelete = await getOverlayByIndex(5)
|
segmentToDelete = await getOverlayByIndex(5)
|
||||||
ang = await u.getAngle(`[data-overlay-index="${5}"]`)
|
ang = await u.getAngle('[data-overlay-index="5"]')
|
||||||
await deleteSegmentSequence({
|
await deleteSegmentSequence({
|
||||||
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
|
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
|
||||||
codeToBeDeleted: 'xLine(length = 26.04)',
|
codeToBeDeleted: 'xLine(length = 26.04)',
|
||||||
@ -1074,7 +1252,7 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
segmentToDelete = await getOverlayByIndex(4)
|
segmentToDelete = await getOverlayByIndex(4)
|
||||||
ang = await u.getAngle(`[data-overlay-index="${4}"]`)
|
ang = await u.getAngle('[data-overlay-index="4"]')
|
||||||
await deleteSegmentSequence({
|
await deleteSegmentSequence({
|
||||||
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
|
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
|
||||||
codeToBeDeleted: 'yLine(endAbsolute = -10.77, tag = $a)',
|
codeToBeDeleted: 'yLine(endAbsolute = -10.77, tag = $a)',
|
||||||
@ -1084,7 +1262,7 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
segmentToDelete = await getOverlayByIndex(3)
|
segmentToDelete = await getOverlayByIndex(3)
|
||||||
ang = await u.getAngle(`[data-overlay-index="${3}"]`)
|
ang = await u.getAngle('[data-overlay-index="3"]')
|
||||||
await deleteSegmentSequence({
|
await deleteSegmentSequence({
|
||||||
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
|
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
|
||||||
codeToBeDeleted: 'xLine(endAbsolute = 9 - 5)',
|
codeToBeDeleted: 'xLine(endAbsolute = 9 - 5)',
|
||||||
@ -1094,7 +1272,7 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
segmentToDelete = await getOverlayByIndex(2)
|
segmentToDelete = await getOverlayByIndex(2)
|
||||||
ang = await u.getAngle(`[data-overlay-index="${2}"]`)
|
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 hoverPos = { x: segmentToDelete.x, y: segmentToDelete.y }
|
const hoverPos = { x: segmentToDelete.x, y: segmentToDelete.y }
|
||||||
@ -1127,7 +1305,7 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
segmentToDelete = await getOverlayByIndex(1)
|
segmentToDelete = await getOverlayByIndex(1)
|
||||||
ang = await u.getAngle(`[data-overlay-index="${1}"]`)
|
ang = await u.getAngle('[data-overlay-index="1"]')
|
||||||
await deleteSegmentSequence({
|
await deleteSegmentSequence({
|
||||||
hoverPos: { x: segmentToDelete.x, 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 }, %)',
|
||||||
@ -1137,7 +1315,7 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
segmentToDelete = await getOverlayByIndex(0)
|
segmentToDelete = await getOverlayByIndex(0)
|
||||||
ang = await u.getAngle(`[data-overlay-index="${0}"]`)
|
ang = await u.getAngle('[data-overlay-index="0"]')
|
||||||
await deleteSegmentSequence({
|
await deleteSegmentSequence({
|
||||||
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
|
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
|
||||||
codeToBeDeleted: 'line(end = [0.5, -14 + 0])',
|
codeToBeDeleted: 'line(end = [0.5, -14 + 0])',
|
||||||
@ -1208,7 +1386,8 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|
|||||||
page.getByRole('button', { name: 'Edit Sketch' })
|
page.getByRole('button', { name: 'Edit Sketch' })
|
||||||
).toBeVisible()
|
).toBeVisible()
|
||||||
return true
|
return true
|
||||||
} catch (_) {
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
} catch (_e) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -1366,7 +1545,7 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|
|||||||
await expect(page.getByText('Added variable')).not.toBeVisible()
|
await expect(page.getByText('Added variable')).not.toBeVisible()
|
||||||
|
|
||||||
const hoverPos = await u.getBoundingBox(`[data-overlay-index="0"]`)
|
const hoverPos = await u.getBoundingBox(`[data-overlay-index="0"]`)
|
||||||
let ang = await u.getAngle(`[data-overlay-index="${0}"]`)
|
let ang = await u.getAngle('[data-overlay-index="0"]')
|
||||||
ang += 180
|
ang += 180
|
||||||
|
|
||||||
await page.mouse.move(0, 0)
|
await page.mouse.move(0, 0)
|
||||||
|
@ -364,7 +364,6 @@ profile003 = startProfileAt([40.16, -120.48], sketch006)
|
|||||||
await camPosition1()
|
await camPosition1()
|
||||||
|
|
||||||
const revolve = { x: 635, y: 253 }
|
const revolve = { x: 635, y: 253 }
|
||||||
const parentExtrude = { x: 915, y: 133 }
|
|
||||||
const solid2d = { x: 770, y: 167 }
|
const solid2d = { x: 770, y: 167 }
|
||||||
const individualProfile = { x: 694, y: 432 }
|
const individualProfile = { x: 694, y: 432 }
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import {
|
|||||||
createProject,
|
createProject,
|
||||||
tomlToSettings,
|
tomlToSettings,
|
||||||
} from './test-utils'
|
} from './test-utils'
|
||||||
import { SaveSettingsPayload, SettingsLevel } from 'lib/settings/settingsTypes'
|
import { SettingsLevel } from 'lib/settings/settingsTypes'
|
||||||
import { SETTINGS_FILE_NAME, PROJECT_SETTINGS_FILE_NAME } from 'lib/constants'
|
import { SETTINGS_FILE_NAME, PROJECT_SETTINGS_FILE_NAME } from 'lib/constants'
|
||||||
import {
|
import {
|
||||||
TEST_SETTINGS_KEY,
|
TEST_SETTINGS_KEY,
|
||||||
@ -15,7 +15,6 @@ import {
|
|||||||
TEST_SETTINGS,
|
TEST_SETTINGS,
|
||||||
TEST_SETTINGS_DEFAULT_THEME,
|
TEST_SETTINGS_DEFAULT_THEME,
|
||||||
} from './storageStates'
|
} from './storageStates'
|
||||||
import * as TOML from '@iarna/toml'
|
|
||||||
import { DeepPartial } from 'lib/types'
|
import { DeepPartial } from 'lib/types'
|
||||||
import { Settings } from '@rust/kcl-lib/bindings/Settings'
|
import { Settings } from '@rust/kcl-lib/bindings/Settings'
|
||||||
|
|
||||||
@ -1006,11 +1005,6 @@ fn cube`
|
|||||||
page.getByText(
|
page.getByText(
|
||||||
`Set highlight edges to "${String(value)}" as a user default`
|
`Set highlight edges to "${String(value)}" as a user default`
|
||||||
)
|
)
|
||||||
const initialPath = testInfo.snapshotPath('toggle-settings-initial.png')
|
|
||||||
const initialScreenshot = await scene.streamWrapper.screenshot({
|
|
||||||
path: initialPath,
|
|
||||||
mask: [page.getByTestId('model-state-indicator')],
|
|
||||||
})
|
|
||||||
|
|
||||||
await test.step(`Toggle highlightEdges off`, async () => {
|
await test.step(`Toggle highlightEdges off`, async () => {
|
||||||
await cmdBar.openCmdBar()
|
await cmdBar.openCmdBar()
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* eslint-disable react-hooks/rules-of-hooks */
|
/* eslint-disable react-hooks/rules-of-hooks */
|
||||||
|
|
||||||
import { test as playwrightTestFn, ElectronApplication } from '@playwright/test'
|
import { test as playwrightTestFn } from '@playwright/test'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
fixturesBasedOnProcessEnvPlatform,
|
fixturesBasedOnProcessEnvPlatform,
|
||||||
@ -8,8 +8,6 @@ import {
|
|||||||
ElectronZoo,
|
ElectronZoo,
|
||||||
} from './fixtures/fixtureSetup'
|
} from './fixtures/fixtureSetup'
|
||||||
|
|
||||||
import { Settings } from '@rust/kcl-lib/bindings/Settings'
|
|
||||||
import { DeepPartial } from 'lib/types'
|
|
||||||
export { expect } from '@playwright/test'
|
export { expect } from '@playwright/test'
|
||||||
|
|
||||||
declare module '@playwright/test' {
|
declare module '@playwright/test' {
|
||||||
|
54
package.json
@ -12,17 +12,17 @@
|
|||||||
"main": ".vite/build/main.js",
|
"main": ".vite/build/main.js",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@codemirror/autocomplete": "^6.17.0",
|
"@codemirror/autocomplete": "^6.18.6",
|
||||||
"@codemirror/commands": "^6.8.0",
|
"@codemirror/commands": "^6.8.0",
|
||||||
"@codemirror/language": "^6.10.8",
|
"@codemirror/language": "^6.11.0",
|
||||||
"@codemirror/lint": "^6.8.4",
|
"@codemirror/lint": "^6.8.4",
|
||||||
"@codemirror/search": "^6.5.10",
|
"@codemirror/search": "^6.5.10",
|
||||||
"@codemirror/state": "^6.4.1",
|
"@codemirror/state": "^6.4.1",
|
||||||
"@codemirror/theme-one-dark": "^6.1.2",
|
"@codemirror/theme-one-dark": "^6.1.2",
|
||||||
"@csstools/postcss-oklab-function": "^4.0.7",
|
"@csstools/postcss-oklab-function": "^4.0.7",
|
||||||
"@fortawesome/fontawesome-svg-core": "^6.5.2",
|
"@fortawesome/fontawesome-svg-core": "^6.7.2",
|
||||||
"@fortawesome/free-brands-svg-icons": "^6.5.2",
|
"@fortawesome/free-brands-svg-icons": "^6.7.2",
|
||||||
"@fortawesome/free-solid-svg-icons": "^6.4.2",
|
"@fortawesome/free-solid-svg-icons": "^6.7.2",
|
||||||
"@fortawesome/react-fontawesome": "^0.2.0",
|
"@fortawesome/react-fontawesome": "^0.2.0",
|
||||||
"@headlessui/react": "^1.7.19",
|
"@headlessui/react": "^1.7.19",
|
||||||
"@headlessui/tailwindcss": "^0.2.0",
|
"@headlessui/tailwindcss": "^0.2.0",
|
||||||
@ -35,35 +35,35 @@
|
|||||||
"@tweenjs/tween.js": "^23.1.1",
|
"@tweenjs/tween.js": "^23.1.1",
|
||||||
"@xstate/inspect": "^0.8.0",
|
"@xstate/inspect": "^0.8.0",
|
||||||
"@xstate/react": "^4.1.1",
|
"@xstate/react": "^4.1.1",
|
||||||
"bonjour-service": "^1.2.1",
|
"bonjour-service": "^1.3.0",
|
||||||
"chokidar": "^4.0.1",
|
"chokidar": "^4.0.1",
|
||||||
"codemirror": "^6.0.1",
|
"codemirror": "^6.0.1",
|
||||||
"decamelize": "^6.0.0",
|
"decamelize": "^6.0.0",
|
||||||
"diff": "^7.0.0",
|
"diff": "^7.0.0",
|
||||||
"electron-updater": "^6.6.0",
|
"electron-updater": "^6.6.0",
|
||||||
"fuse.js": "^7.0.0",
|
"fuse.js": "^7.1.0",
|
||||||
"html2canvas-pro": "^1.5.8",
|
"html2canvas-pro": "^1.5.8",
|
||||||
"isomorphic-fetch": "^3.0.0",
|
"isomorphic-fetch": "^3.0.0",
|
||||||
"json-rpc-2.0": "^1.6.0",
|
"json-rpc-2.0": "^1.6.0",
|
||||||
"jszip": "^3.10.1",
|
"jszip": "^3.10.1",
|
||||||
"minimist": "^1.2.8",
|
"minimist": "^1.2.8",
|
||||||
"openid-client": "^5.6.5",
|
"openid-client": "^5.6.5",
|
||||||
"re-resizable": "^6.9.11",
|
"re-resizable": "^6.11.2",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"react-hot-toast": "^2.4.1",
|
"react-hot-toast": "^2.5.2",
|
||||||
"react-hotkeys-hook": "^4.6.1",
|
"react-hotkeys-hook": "^4.6.1",
|
||||||
"react-json-view": "^1.21.3",
|
"react-json-view": "^1.21.3",
|
||||||
"react-modal": "^3.16.3",
|
"react-modal": "^3.16.3",
|
||||||
"react-modal-promise": "^1.0.2",
|
"react-modal-promise": "^1.0.2",
|
||||||
"react-router-dom": "^6.28.0",
|
"react-router-dom": "^6.28.0",
|
||||||
"sketch-helpers": "^0.0.4",
|
"sketch-helpers": "^0.0.4",
|
||||||
"three": "^0.172.0",
|
"three": "^0.174.0",
|
||||||
"ua-parser-js": "^1.0.37",
|
"ua-parser-js": "^1.0.37",
|
||||||
"uuid": "^11.0.2",
|
"uuid": "^11.1.0",
|
||||||
"vscode-jsonrpc": "^8.2.1",
|
"vscode-jsonrpc": "^8.2.1",
|
||||||
"vscode-languageserver-protocol": "^3.17.5",
|
"vscode-languageserver-protocol": "^3.17.5",
|
||||||
"vscode-uri": "^3.0.8",
|
"vscode-uri": "^3.1.0",
|
||||||
"web-vitals": "^3.5.2",
|
"web-vitals": "^3.5.2",
|
||||||
"xstate": "^5.19.2",
|
"xstate": "^5.19.2",
|
||||||
"yargs": "^17.7.2"
|
"yargs": "^17.7.2"
|
||||||
@ -71,7 +71,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"install:rust": "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none && source \"$HOME/.cargo/env\" && (cd rust && (rustup show active-toolchain || rustup toolchain install))",
|
"install:rust": "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none && source \"$HOME/.cargo/env\" && (cd rust && (rustup show active-toolchain || rustup toolchain install))",
|
||||||
"install:rust:windows": "winget install Microsoft.VisualStudio.2022.Community --silent --override \"--wait --quiet --add ProductLang En-us --add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended\" && winget install Rustlang.Rustup",
|
"install:rust:windows": "winget install Microsoft.VisualStudio.2022.Community --silent --override \"--wait --quiet --add ProductLang En-us --add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended\" && winget install Rustlang.Rustup",
|
||||||
"install:wasm-pack:sh": ". $HOME/.cargo/env && curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -y",
|
"install:wasm-pack:sh": ". $HOME/.cargo/env && curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -f",
|
||||||
"install:wasm-pack:cargo": "cargo install wasm-pack",
|
"install:wasm-pack:cargo": "cargo install wasm-pack",
|
||||||
"install:tools:windows": "winget install jqlang.jq MikeFarah.yq GitHub.cli",
|
"install:tools:windows": "winget install jqlang.jq MikeFarah.yq GitHub.cli",
|
||||||
"start": "vite --port=3000 --host=0.0.0.0",
|
"start": "vite --port=3000 --host=0.0.0.0",
|
||||||
@ -93,11 +93,9 @@
|
|||||||
"fetch:wasm:windows": "./scripts/get-latest-wasm-bundle.ps1",
|
"fetch:wasm:windows": "./scripts/get-latest-wasm-bundle.ps1",
|
||||||
"fetch:samples": "rm -rf public/kcl-samples* && curl -L -o public/kcl-samples.zip https://github.com/KittyCAD/kcl-samples/archive/refs/heads/achalmers/kw-args-xylineto.zip && unzip -o public/kcl-samples.zip -d public && mv public/kcl-samples-* public/kcl-samples",
|
"fetch:samples": "rm -rf public/kcl-samples* && curl -L -o public/kcl-samples.zip https://github.com/KittyCAD/kcl-samples/archive/refs/heads/achalmers/kw-args-xylineto.zip && unzip -o public/kcl-samples.zip -d public && mv public/kcl-samples-* public/kcl-samples",
|
||||||
"build:wasm-dev": "yarn wasm-prep && (cd rust && wasm-pack build kcl-wasm-lib --dev --target web --out-dir pkg && cargo test -p kcl-lib export_bindings) && yarn isomorphic-copy-wasm && yarn fmt",
|
"build:wasm-dev": "yarn wasm-prep && (cd rust && wasm-pack build kcl-wasm-lib --dev --target web --out-dir pkg && cargo test -p kcl-lib export_bindings) && yarn isomorphic-copy-wasm && yarn fmt",
|
||||||
"build:wasm:nocopy": "yarn wasm-prep && cd rust && RUSTFLAGS='--cfg getrandom_backend=\"wasm_js\"' wasm-pack build kcl-wasm-lib --release --target web --out-dir pkg && cargo test -p kcl-lib export_bindings",
|
"build:wasm": "./scripts/build-wasm.sh",
|
||||||
"build:wasm": "yarn build:wasm:nocopy && cp rust/kcl-wasm-lib/pkg/kcl_wasm_lib_bg.wasm public && yarn fmt",
|
"build:wasm:windows": "./scripts/build-wasm.ps1",
|
||||||
"build:wasm:windows": "yarn install:wasm-pack:cargo && yarn build:wasm:nocopy && ./scripts/copy-wasm.ps1 && yarn fmt",
|
|
||||||
"remove-importmeta": "sed -i 's/import.meta.url/window.location.origin/g' \"./rust/kcl-wasm-lib/pkg/kcl_wasm_lib.js\"; sed -i '' 's/import.meta.url/window.location.origin/g' \"./rust/kcl-wasm-lib/pkg/kcl_wasm_lib.js\" || echo \"sed for both mac and linux\"",
|
"remove-importmeta": "sed -i 's/import.meta.url/window.location.origin/g' \"./rust/kcl-wasm-lib/pkg/kcl_wasm_lib.js\"; sed -i '' 's/import.meta.url/window.location.origin/g' \"./rust/kcl-wasm-lib/pkg/kcl_wasm_lib.js\" || echo \"sed for both mac and linux\"",
|
||||||
"wasm-prep": "rimraf rust/kcl-wasm-lib/pkg && mkdirp rust/kcl-wasm-lib/pkg && rimraf rust/kcl-lib/bindings",
|
|
||||||
"lint-fix": "eslint --fix --ext .ts --ext .tsx src e2e packages/codemirror-lsp-client/src rust/kcl-language-server/client/src",
|
"lint-fix": "eslint --fix --ext .ts --ext .tsx src e2e packages/codemirror-lsp-client/src rust/kcl-language-server/client/src",
|
||||||
"lint": "eslint --max-warnings 0 --ext .ts --ext .tsx src e2e packages/codemirror-lsp-client/src rust/kcl-language-server/client/src",
|
"lint": "eslint --max-warnings 0 --ext .ts --ext .tsx src e2e packages/codemirror-lsp-client/src rust/kcl-language-server/client/src",
|
||||||
"files:set-version": "echo \"$(jq --arg v \"$VERSION\" '.version=$v' package.json --indent 2)\" > package.json",
|
"files:set-version": "echo \"$(jq --arg v \"$VERSION\" '.version=$v' package.json --indent 2)\" > package.json",
|
||||||
@ -153,16 +151,16 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
|
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
|
||||||
"@babel/preset-env": "^7.25.4",
|
"@babel/preset-env": "^7.26.9",
|
||||||
"@electron-forge/cli": "^7.6.1",
|
"@electron-forge/cli": "^7.7.0",
|
||||||
"@electron-forge/plugin-fuses": "^7.6.1",
|
"@electron-forge/plugin-fuses": "^7.7.0",
|
||||||
"@electron-forge/plugin-vite": "^7.6.1",
|
"@electron-forge/plugin-vite": "^7.7.0",
|
||||||
"@electron/fuses": "^1.8.0",
|
"@electron/fuses": "^1.8.0",
|
||||||
"@electron/notarize": "^2.5.0",
|
"@electron/notarize": "^2.5.0",
|
||||||
"@iarna/toml": "^2.2.5",
|
"@iarna/toml": "^2.2.5",
|
||||||
"@lezer/generator": "^1.7.2",
|
"@lezer/generator": "^1.7.2",
|
||||||
"@nabla/vite-plugin-eslint": "^2.0.5",
|
"@nabla/vite-plugin-eslint": "^2.0.5",
|
||||||
"@playwright/test": "^1.49.0",
|
"@playwright/test": "^1.51.0",
|
||||||
"@testing-library/jest-dom": "^5.14.1",
|
"@testing-library/jest-dom": "^5.14.1",
|
||||||
"@testing-library/react": "^15.0.2",
|
"@testing-library/react": "^15.0.2",
|
||||||
"@types/diff": "^7.0.1",
|
"@types/diff": "^7.0.1",
|
||||||
@ -176,7 +174,7 @@
|
|||||||
"@types/react": "^18.3.4",
|
"@types/react": "^18.3.4",
|
||||||
"@types/react-dom": "^18.3.1",
|
"@types/react-dom": "^18.3.1",
|
||||||
"@types/react-modal": "^3.16.3",
|
"@types/react-modal": "^3.16.3",
|
||||||
"@types/three": "^0.172.0",
|
"@types/three": "^0.174.0",
|
||||||
"@types/ua-parser-js": "^0.7.39",
|
"@types/ua-parser-js": "^0.7.39",
|
||||||
"@types/uuid": "^9.0.8",
|
"@types/uuid": "^9.0.8",
|
||||||
"@types/wicg-file-system-access": "^2023.10.5",
|
"@types/wicg-file-system-access": "^2023.10.5",
|
||||||
@ -189,11 +187,11 @@
|
|||||||
"electron-builder": "^26.0.6",
|
"electron-builder": "^26.0.6",
|
||||||
"eslint": "^8.0.1",
|
"eslint": "^8.0.1",
|
||||||
"eslint-plugin-css-modules": "^2.12.0",
|
"eslint-plugin-css-modules": "^2.12.0",
|
||||||
"eslint-plugin-import": "^2.30.0",
|
"eslint-plugin-import": "^2.31.0",
|
||||||
"eslint-plugin-jest": "^28.10.0",
|
"eslint-plugin-jest": "^28.11.0",
|
||||||
"eslint-plugin-jsx-a11y": "^6.10.2",
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
||||||
"eslint-plugin-react": "^7.37.4",
|
"eslint-plugin-react": "^7.37.4",
|
||||||
"eslint-plugin-react-hooks": "^5.1.0",
|
"eslint-plugin-react-hooks": "^5.2.0",
|
||||||
"eslint-plugin-react-perf": "^3.3.3",
|
"eslint-plugin-react-perf": "^3.3.3",
|
||||||
"eslint-plugin-suggest-no-throw": "^1.0.0",
|
"eslint-plugin-suggest-no-throw": "^1.0.0",
|
||||||
"eslint-plugin-testing-library": "^7.1.1",
|
"eslint-plugin-testing-library": "^7.1.1",
|
||||||
@ -210,8 +208,8 @@
|
|||||||
"setimmediate": "^1.0.5",
|
"setimmediate": "^1.0.5",
|
||||||
"tailwindcss": "^3.4.17",
|
"tailwindcss": "^3.4.17",
|
||||||
"ts-node": "^10.0.0",
|
"ts-node": "^10.0.0",
|
||||||
"typescript": "^5.7.3",
|
"typescript": "^5.8.2",
|
||||||
"typescript-eslint": "^8.23.0",
|
"typescript-eslint": "^8.26.1",
|
||||||
"vite": "^5.4.12",
|
"vite": "^5.4.12",
|
||||||
"vite-plugin-package-version": "^1.1.0",
|
"vite-plugin-package-version": "^1.1.0",
|
||||||
"vite-tsconfig-paths": "^4.3.2",
|
"vite-tsconfig-paths": "^4.3.2",
|
||||||
|
@ -19,14 +19,14 @@
|
|||||||
"private": false,
|
"private": false,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@codemirror/autocomplete": "6.18.6",
|
"@codemirror/autocomplete": "6.18.6",
|
||||||
"@codemirror/language": "^6.10.2",
|
"@codemirror/language": "^6.11.0",
|
||||||
"@codemirror/state": "^6.4.1",
|
"@codemirror/state": "^6.5.2",
|
||||||
"@lezer/highlight": "^1.2.0",
|
"@lezer/highlight": "^1.2.0",
|
||||||
"@ts-stack/markdown": "^1.5.0",
|
"@ts-stack/markdown": "^1.5.0",
|
||||||
"json-rpc-2.0": "^1.7.0",
|
"json-rpc-2.0": "^1.7.0",
|
||||||
"typescript": "^5.7.2",
|
"typescript": "^5.8.2",
|
||||||
"vscode-languageserver-protocol": "^3.17.5",
|
"vscode-languageserver-protocol": "^3.17.5",
|
||||||
"vscode-uri": "^3.0.8"
|
"vscode-uri": "^3.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^22.13.9",
|
"@types/node": "^22.13.9",
|
||||||
|
@ -12,10 +12,10 @@
|
|||||||
"@codemirror/view" "^6.17.0"
|
"@codemirror/view" "^6.17.0"
|
||||||
"@lezer/common" "^1.0.0"
|
"@lezer/common" "^1.0.0"
|
||||||
|
|
||||||
"@codemirror/language@^6.0.0", "@codemirror/language@^6.10.2":
|
"@codemirror/language@^6.0.0", "@codemirror/language@^6.11.0":
|
||||||
version "6.10.2"
|
version "6.11.0"
|
||||||
resolved "https://registry.yarnpkg.com/@codemirror/language/-/language-6.10.2.tgz#4056dc219619627ffe995832eeb09cea6060be61"
|
resolved "https://registry.yarnpkg.com/@codemirror/language/-/language-6.11.0.tgz#5ae90972601497f4575f30811519d720bf7232c9"
|
||||||
integrity sha512-kgbTYTo0Au6dCSc/TFy7fK3fpJmgHDv1sG1KNQKJXVi+xBTEeBPY/M30YXiU6mMXeH+YIDLsbrT4ZwNRdtF+SA==
|
integrity sha512-A7+f++LodNNc1wGgoRDTt78cOwWm9KVezApgjOMp1W4hM0898nsqBXwF+sbePE7ZRcjN7Sa1Z5m2oN27XkmEjQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@codemirror/state" "^6.0.0"
|
"@codemirror/state" "^6.0.0"
|
||||||
"@codemirror/view" "^6.23.0"
|
"@codemirror/view" "^6.23.0"
|
||||||
@ -24,10 +24,12 @@
|
|||||||
"@lezer/lr" "^1.0.0"
|
"@lezer/lr" "^1.0.0"
|
||||||
style-mod "^4.0.0"
|
style-mod "^4.0.0"
|
||||||
|
|
||||||
"@codemirror/state@^6.0.0", "@codemirror/state@^6.4.0", "@codemirror/state@^6.4.1":
|
"@codemirror/state@^6.0.0", "@codemirror/state@^6.4.0", "@codemirror/state@^6.5.2":
|
||||||
version "6.4.1"
|
version "6.5.2"
|
||||||
resolved "https://registry.yarnpkg.com/@codemirror/state/-/state-6.4.1.tgz#da57143695c056d9a3c38705ed34136e2b68171b"
|
resolved "https://registry.yarnpkg.com/@codemirror/state/-/state-6.5.2.tgz#8eca3a64212a83367dc85475b7d78d5c9b7076c6"
|
||||||
integrity sha512-QkEyUiLhsJoZkbumGZlswmAhA7CBU02Wrz7zvH4SrcifbsqwlXShVXg65f3v/ts57W3dqyamEriMhij1Z3Zz4A==
|
integrity sha512-FVqsPqtPWKVVL3dPSxy8wEF/ymIEuVzF1PK3VbUgrxXpJUSHQWWZz4JMToquRxnkw+36LTamCZG2iua2Ptq0fA==
|
||||||
|
dependencies:
|
||||||
|
"@marijn/find-cluster-break" "^1.0.0"
|
||||||
|
|
||||||
"@codemirror/view@^6.17.0", "@codemirror/view@^6.23.0":
|
"@codemirror/view@^6.17.0", "@codemirror/view@^6.23.0":
|
||||||
version "6.28.2"
|
version "6.28.2"
|
||||||
@ -82,6 +84,11 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
"@lezer/common" "^1.0.0"
|
"@lezer/common" "^1.0.0"
|
||||||
|
|
||||||
|
"@marijn/find-cluster-break@^1.0.0":
|
||||||
|
version "1.0.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/@marijn/find-cluster-break/-/find-cluster-break-1.0.2.tgz#775374306116d51c0c500b8c4face0f9a04752d8"
|
||||||
|
integrity sha512-l0h88YhZFyKdXIFNfSWpyjStDjGHwZ/U7iobcK1cQQD8sejsONdQtTVU+1wVN1PBw40PiiHB1vA5S7VTfQiP9g==
|
||||||
|
|
||||||
"@ts-stack/markdown@^1.5.0":
|
"@ts-stack/markdown@^1.5.0":
|
||||||
version "1.5.0"
|
version "1.5.0"
|
||||||
resolved "https://registry.yarnpkg.com/@ts-stack/markdown/-/markdown-1.5.0.tgz#5dc298a20dc3dc040143c5a5948201eb6bf5419d"
|
resolved "https://registry.yarnpkg.com/@ts-stack/markdown/-/markdown-1.5.0.tgz#5dc298a20dc3dc040143c5a5948201eb6bf5419d"
|
||||||
@ -182,10 +189,10 @@ tslib@^2.3.0:
|
|||||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.3.tgz#0438f810ad7a9edcde7a241c3d80db693c8cbfe0"
|
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.3.tgz#0438f810ad7a9edcde7a241c3d80db693c8cbfe0"
|
||||||
integrity sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==
|
integrity sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==
|
||||||
|
|
||||||
typescript@^5.7.2:
|
typescript@^5.8.2:
|
||||||
version "5.7.2"
|
version "5.8.2"
|
||||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.7.2.tgz#3169cf8c4c8a828cde53ba9ecb3d2b1d5dd67be6"
|
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.8.2.tgz#8170b3702f74b79db2e5a96207c15e65807999e4"
|
||||||
integrity sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==
|
integrity sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ==
|
||||||
|
|
||||||
undici-types@~6.20.0:
|
undici-types@~6.20.0:
|
||||||
version "6.20.0"
|
version "6.20.0"
|
||||||
@ -215,10 +222,10 @@ vscode-languageserver-types@3.17.5:
|
|||||||
resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.17.5.tgz#3273676f0cf2eab40b3f44d085acbb7f08a39d8a"
|
resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.17.5.tgz#3273676f0cf2eab40b3f44d085acbb7f08a39d8a"
|
||||||
integrity sha512-Ld1VelNuX9pdF39h2Hgaeb5hEZM2Z3jUrrMgWQAu82jMtZp7p3vJT3BzToKtZI7NgQssZje5o0zryOrhQvzQAg==
|
integrity sha512-Ld1VelNuX9pdF39h2Hgaeb5hEZM2Z3jUrrMgWQAu82jMtZp7p3vJT3BzToKtZI7NgQssZje5o0zryOrhQvzQAg==
|
||||||
|
|
||||||
vscode-uri@^3.0.8:
|
vscode-uri@^3.1.0:
|
||||||
version "3.0.8"
|
version "3.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/vscode-uri/-/vscode-uri-3.0.8.tgz#1770938d3e72588659a172d0fd4642780083ff9f"
|
resolved "https://registry.yarnpkg.com/vscode-uri/-/vscode-uri-3.1.0.tgz#dd09ec5a66a38b5c3fffc774015713496d14e09c"
|
||||||
integrity sha512-AyFQ0EVmsOZOlAnxoFOGOq1SQDWAB7C6aqMGS23svWAllfOaxbuFvcT8D1i8z3Gyn8fraVeZNNmN6e9bxxXkKw==
|
integrity sha512-/BpdSx+yCQGnCvecbyXdxHDkuk55/G3xwnC0GqY4gmQ3j+A+g8kzzgB4Nk/SINjqn6+waqw3EgbVF2QKExkRxQ==
|
||||||
|
|
||||||
w3c-keyname@^2.2.4:
|
w3c-keyname@^2.2.4:
|
||||||
version "2.2.8"
|
version "2.2.8"
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { defineConfig, devices } from '@playwright/test'
|
import { defineConfig, devices } from '@playwright/test'
|
||||||
|
import { platform } from 'os'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See https://playwright.dev/docs/test-configuration.
|
* See https://playwright.dev/docs/test-configuration.
|
||||||
@ -13,7 +14,7 @@ export default defineConfig({
|
|||||||
/* Do not retry */
|
/* Do not retry */
|
||||||
retries: 0,
|
retries: 0,
|
||||||
/* Different amount of parallelism on CI and local. */
|
/* Different amount of parallelism on CI and local. */
|
||||||
workers: 8,
|
workers: platform() === 'win32' ? 1 : 2,
|
||||||
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
||||||
reporter: [
|
reporter: [
|
||||||
['dot'],
|
['dot'],
|
||||||
|
@ -3073,7 +3073,7 @@ DATA;
|
|||||||
#3057 = CARTESIAN_POINT('NONE', (0.051104890518972546, -0.039940414856583686, -0.0635));
|
#3057 = CARTESIAN_POINT('NONE', (0.051104890518972546, -0.039940414856583686, -0.0635));
|
||||||
#3058 = CARTESIAN_POINT('NONE', (0.052242074077479335, -0.038876903045998674, -0.0635));
|
#3058 = CARTESIAN_POINT('NONE', (0.052242074077479335, -0.038876903045998674, -0.0635));
|
||||||
#3059 = CARTESIAN_POINT('NONE', (0.05224392753122875, -0.03887516966712757, -0.0635));
|
#3059 = CARTESIAN_POINT('NONE', (0.05224392753122875, -0.03887516966712757, -0.0635));
|
||||||
#3060 = CARTESIAN_POINT('NONE', (0.05311532463588208, -0.03767579444673182, -0.0635));
|
#3060 = CARTESIAN_POINT('NONE', (0.05311532463588208, -0.03767579444673181, -0.0635));
|
||||||
#3061 = CARTESIAN_POINT('NONE', (0.05311674489404425, -0.03767383962907501, -0.0635));
|
#3061 = CARTESIAN_POINT('NONE', (0.05311674489404425, -0.03767383962907501, -0.0635));
|
||||||
#3062 = CARTESIAN_POINT('NONE', (0.053776795686355607, -0.03626367057234418, -0.0635));
|
#3062 = CARTESIAN_POINT('NONE', (0.053776795686355607, -0.03626367057234418, -0.0635));
|
||||||
#3063 = CARTESIAN_POINT('NONE', (0.05377787147891932, -0.036261372189549286, -0.0635));
|
#3063 = CARTESIAN_POINT('NONE', (0.05377787147891932, -0.036261372189549286, -0.0635));
|
||||||
@ -3087,7 +3087,7 @@ DATA;
|
|||||||
#3071 = CARTESIAN_POINT('NONE', (0.053252818350252196, -0.029748655756475863, -0.0635));
|
#3071 = CARTESIAN_POINT('NONE', (0.053252818350252196, -0.029748655756475863, -0.0635));
|
||||||
#3072 = CARTESIAN_POINT('NONE', (0.05233460363130192, -0.028414043632913145, -0.0635));
|
#3072 = CARTESIAN_POINT('NONE', (0.05233460363130192, -0.028414043632913145, -0.0635));
|
||||||
#3073 = CARTESIAN_POINT('NONE', (0.05233310706682834, -0.028411868397590818, -0.0635));
|
#3073 = CARTESIAN_POINT('NONE', (0.05233310706682834, -0.028411868397590818, -0.0635));
|
||||||
#3074 = CARTESIAN_POINT('NONE', (0.051232952266167, -0.02734405921816657, -0.0635));
|
#3074 = CARTESIAN_POINT('NONE', (0.05123295226616701, -0.02734405921816657, -0.0635));
|
||||||
#3075 = CARTESIAN_POINT('NONE', (0.05123115916423111, -0.027342318835171704, -0.0635));
|
#3075 = CARTESIAN_POINT('NONE', (0.05123115916423111, -0.027342318835171704, -0.0635));
|
||||||
#3076 = CARTESIAN_POINT('NONE', (0.0499865731843106, -0.02652506813979786, -0.0635));
|
#3076 = CARTESIAN_POINT('NONE', (0.0499865731843106, -0.02652506813979786, -0.0635));
|
||||||
#3077 = CARTESIAN_POINT('NONE', (0.049984544679296, -0.026523736132881105, -0.0635));
|
#3077 = CARTESIAN_POINT('NONE', (0.049984544679296, -0.026523736132881105, -0.0635));
|
||||||
@ -3105,7 +3105,7 @@ DATA;
|
|||||||
#3089 = CARTESIAN_POINT('NONE', (0.0407616757108459, -0.02775624333996861, -0.0635));
|
#3089 = CARTESIAN_POINT('NONE', (0.0407616757108459, -0.02775624333996861, -0.0635));
|
||||||
#3090 = CARTESIAN_POINT('NONE', (0.03976400232776854, -0.0288872140372878, -0.0635));
|
#3090 = CARTESIAN_POINT('NONE', (0.03976400232776854, -0.0288872140372878, -0.0635));
|
||||||
#3091 = CARTESIAN_POINT('NONE', (0.03976237625653429, -0.028889057364922765, -0.0635));
|
#3091 = CARTESIAN_POINT('NONE', (0.03976237625653429, -0.028889057364922765, -0.0635));
|
||||||
#3092 = B_SPLINE_CURVE_WITH_KNOTS('NONE', 2, (#3029, #3030, #3031, #3032, #3033, #3034, #3035, #3036, #3037, #3038, #3039, #3040, #3041, #3042, #3043, #3044, #3045, #3046, #3047, #3048, #3049, #3050, #3051, #3052, #3053, #3054, #3055, #3056, #3057, #3058, #3059, #3060, #3061, #3062, #3063, #3064, #3065, #3066, #3067, #3068, #3069, #3070, #3071, #3072, #3073, #3074, #3075, #3076, #3077, #3078, #3079, #3080, #3081, #3082, #3083, #3084, #3085, #3086, #3087, #3088, #3089, #3090, #3091), .UNSPECIFIED., .F., .F., (3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3), (0, 0.01639344262295082, 0.03278688524590164, 0.04918032786885246, 0.06557377049180328, 0.0819672131147541, 0.09836065573770492, 0.11475409836065574, 0.13114754098360656, 0.14754098360655737, 0.1639344262295082, 0.18032786885245902, 0.19672131147540983, 0.21311475409836067, 0.22950819672131148, 0.24590163934426232, 0.26229508196721313, 0.27868852459016397, 0.29508196721311475, 0.3114754098360656, 0.3278688524590164, 0.3442622950819672, 0.36065573770491804, 0.3770491803278689, 0.39344262295081966, 0.4098360655737705, 0.42622950819672134, 0.4426229508196722, 0.45901639344262296, 0.4754098360655738, 0.49180327868852464, 0.5081967213114753, 0.5245901639344261, 0.540983606557377, 0.5573770491803278, 0.5737704918032787, 0.5901639344262295, 0.6065573770491803, 0.6229508196721312, 0.639344262295082, 0.6557377049180328, 0.6721311475409836, 0.6885245901639344, 0.7049180327868853, 0.721311475409836, 0.7377049180327868, 0.7540983606557377, 0.7704918032786885, 0.7868852459016393, 0.8032786885245902, 0.819672131147541, 0.8360655737704918, 0.8524590163934427, 0.8688524590163934, 0.8852459016393442, 0.9016393442622951, 0.9180327868852459, 0.9344262295081968, 0.9508196721311475, 0.9672131147540983, 0.9836065573770492, 1), .UNSPECIFIED.);
|
#3092 = B_SPLINE_CURVE_WITH_KNOTS('NONE', 2, (#3029, #3030, #3031, #3032, #3033, #3034, #3035, #3036, #3037, #3038, #3039, #3040, #3041, #3042, #3043, #3044, #3045, #3046, #3047, #3048, #3049, #3050, #3051, #3052, #3053, #3054, #3055, #3056, #3057, #3058, #3059, #3060, #3061, #3062, #3063, #3064, #3065, #3066, #3067, #3068, #3069, #3070, #3071, #3072, #3073, #3074, #3075, #3076, #3077, #3078, #3079, #3080, #3081, #3082, #3083, #3084, #3085, #3086, #3087, #3088, #3089, #3090, #3091), .UNSPECIFIED., .F., .F., (3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3), (-1, -0.9836065573770492, -0.9672131147540983, -0.9508196721311475, -0.9344262295081968, -0.9180327868852459, -0.9016393442622951, -0.8852459016393442, -0.8688524590163934, -0.8524590163934427, -0.8360655737704918, -0.819672131147541, -0.8032786885245902, -0.7868852459016393, -0.7704918032786885, -0.7540983606557377, -0.7377049180327868, -0.721311475409836, -0.7049180327868853, -0.6885245901639344, -0.6721311475409836, -0.6557377049180328, -0.639344262295082, -0.6229508196721312, -0.6065573770491803, -0.5901639344262295, -0.5737704918032787, -0.5573770491803278, -0.540983606557377, -0.5245901639344261, -0.5081967213114753, -0.49180327868852464, -0.4754098360655738, -0.45901639344262296, -0.4426229508196722, -0.42622950819672134, -0.4098360655737705, -0.39344262295081966, -0.3770491803278689, -0.36065573770491804, -0.3442622950819672, -0.3278688524590164, -0.3114754098360656, -0.29508196721311475, -0.27868852459016397, -0.26229508196721313, -0.24590163934426232, -0.22950819672131148, -0.21311475409836067, -0.19672131147540983, -0.18032786885245902, -0.1639344262295082, -0.14754098360655737, -0.13114754098360656, -0.11475409836065574, -0.09836065573770492, -0.0819672131147541, -0.06557377049180328, -0.04918032786885246, -0.03278688524590164, -0.01639344262295082, -0), .UNSPECIFIED.);
|
||||||
#3093 = DIRECTION('NONE', (0, 0, 1));
|
#3093 = DIRECTION('NONE', (0, 0, 1));
|
||||||
#3094 = VECTOR('NONE', #3093, 1);
|
#3094 = VECTOR('NONE', #3093, 1);
|
||||||
#3095 = CARTESIAN_POINT('NONE', (0.03976237625653429, -0.028889057364922765, -0.063501));
|
#3095 = CARTESIAN_POINT('NONE', (0.03976237625653429, -0.028889057364922765, -0.063501));
|
||||||
|
@ -6,7 +6,7 @@ uses-engine = { max-threads = 4 }
|
|||||||
after-engine = { max-threads = 12 }
|
after-engine = { max-threads = 12 }
|
||||||
|
|
||||||
[profile.default]
|
[profile.default]
|
||||||
slow-timeout = { period = "30s", terminate-after = 1 }
|
slow-timeout = { period = "90s", terminate-after = 1 }
|
||||||
|
|
||||||
[profile.ci]
|
[profile.ci]
|
||||||
slow-timeout = { period = "50s", terminate-after = 5 }
|
slow-timeout = { period = "50s", terminate-after = 5 }
|
||||||
|
34
rust/Cargo.lock
generated
@ -2194,6 +2194,17 @@ dependencies = [
|
|||||||
"crc",
|
"crc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "lzma-sys"
|
||||||
|
version = "0.1.20"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5fda04ab3764e6cde78b9974eec4f779acaba7c4e84b36eca3cf77c581b85d27"
|
||||||
|
dependencies = [
|
||||||
|
"cc",
|
||||||
|
"libc",
|
||||||
|
"pkg-config",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "measurements"
|
name = "measurements"
|
||||||
version = "0.11.0"
|
version = "0.11.0"
|
||||||
@ -3463,6 +3474,12 @@ dependencies = [
|
|||||||
"digest",
|
"digest",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "sha1_smol"
|
||||||
|
version = "1.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bbfa15b3dddfee50a0fff136974b3e1bde555604ba463834a7eb7deb6417705d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sha2"
|
name = "sha2"
|
||||||
version = "0.10.8"
|
version = "0.10.8"
|
||||||
@ -4378,6 +4395,7 @@ dependencies = [
|
|||||||
"getrandom 0.3.1",
|
"getrandom 0.3.1",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"serde",
|
"serde",
|
||||||
|
"sha1_smol",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -4855,6 +4873,15 @@ version = "0.2.7"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "32ac00cd3f8ec9c1d33fb3e7958a82df6989c42d747bd326c822b1d625283547"
|
checksum = "32ac00cd3f8ec9c1d33fb3e7958a82df6989c42d747bd326c822b1d625283547"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "xz2"
|
||||||
|
version = "0.1.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "388c44dc09d76f1536602ead6d325eb532f5c122f17782bd57fb47baeeb767e2"
|
||||||
|
dependencies = [
|
||||||
|
"lzma-sys",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "yaml-rust"
|
name = "yaml-rust"
|
||||||
version = "0.4.5"
|
version = "0.4.5"
|
||||||
@ -4999,9 +5026,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zip"
|
name = "zip"
|
||||||
version = "2.2.3"
|
version = "2.4.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b280484c454e74e5fff658bbf7df8fdbe7a07c6b2de4a53def232c15ef138f3a"
|
checksum = "938cc23ac49778ac8340e366ddc422b2227ea176edb447e23fc0627608dddadd"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aes",
|
"aes",
|
||||||
"arbitrary",
|
"arbitrary",
|
||||||
@ -5012,15 +5039,16 @@ dependencies = [
|
|||||||
"deflate64",
|
"deflate64",
|
||||||
"displaydoc",
|
"displaydoc",
|
||||||
"flate2",
|
"flate2",
|
||||||
|
"getrandom 0.3.1",
|
||||||
"hmac",
|
"hmac",
|
||||||
"indexmap 2.8.0",
|
"indexmap 2.8.0",
|
||||||
"lzma-rs",
|
"lzma-rs",
|
||||||
"memchr",
|
"memchr",
|
||||||
"pbkdf2",
|
"pbkdf2",
|
||||||
"rand 0.8.5",
|
|
||||||
"sha1",
|
"sha1",
|
||||||
"thiserror 2.0.12",
|
"thiserror 2.0.12",
|
||||||
"time",
|
"time",
|
||||||
|
"xz2",
|
||||||
"zeroize",
|
"zeroize",
|
||||||
"zopfli",
|
"zopfli",
|
||||||
"zstd",
|
"zstd",
|
||||||
|
@ -49,7 +49,7 @@ tokio = { version = "1" }
|
|||||||
tower-lsp = { version = "0.20.0", default-features = false }
|
tower-lsp = { version = "0.20.0", default-features = false }
|
||||||
tracing-subscriber = { version = "0.3.19", features = ["registry", "std", "fmt", "smallvec", "ansi", "tracing-log", "json"] }
|
tracing-subscriber = { version = "0.3.19", features = ["registry", "std", "fmt", "smallvec", "ansi", "tracing-log", "json"] }
|
||||||
uuid = { version = "1", features = ["v4", "serde"] }
|
uuid = { version = "1", features = ["v4", "serde"] }
|
||||||
zip = { version = "2.2.2", default-features = false }
|
zip = { version = "2.4.1", default-features = false }
|
||||||
|
|
||||||
[workspace.lints.clippy]
|
[workspace.lints.clippy]
|
||||||
assertions_on_result_states = "warn"
|
assertions_on_result_states = "warn"
|
||||||
|
@ -802,7 +802,7 @@ fn generate_code_block_test(fn_name: &str, code_block: &str, index: usize) -> pr
|
|||||||
context_type: crate::execution::ContextType::Mock,
|
context_type: crate::execution::ContextType::Mock,
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Err(e) = ctx.run(&program, &mut crate::execution::ExecState::new(&ctx.settings)).await {
|
if let Err(e) = ctx.run(&program, &mut crate::execution::ExecState::new(&ctx)).await {
|
||||||
return Err(miette::Report::new(crate::errors::Report {
|
return Err(miette::Report::new(crate::errors::Report {
|
||||||
error: e.error,
|
error: e.error,
|
||||||
filename: format!("{}{}", #fn_name, #index),
|
filename: format!("{}{}", #fn_name, #index),
|
||||||
|
@ -15,10 +15,7 @@ mod test_examples_someFn {
|
|||||||
context_type: crate::execution::ContextType::Mock,
|
context_type: crate::execution::ContextType::Mock,
|
||||||
};
|
};
|
||||||
if let Err(e) = ctx
|
if let Err(e) = ctx
|
||||||
.run(
|
.run(&program, &mut crate::execution::ExecState::new(&ctx))
|
||||||
&program,
|
|
||||||
&mut crate::execution::ExecState::new(&ctx.settings),
|
|
||||||
)
|
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
return Err(miette::Report::new(crate::errors::Report {
|
return Err(miette::Report::new(crate::errors::Report {
|
||||||
|
@ -15,10 +15,7 @@ mod test_examples_someFn {
|
|||||||
context_type: crate::execution::ContextType::Mock,
|
context_type: crate::execution::ContextType::Mock,
|
||||||
};
|
};
|
||||||
if let Err(e) = ctx
|
if let Err(e) = ctx
|
||||||
.run(
|
.run(&program, &mut crate::execution::ExecState::new(&ctx))
|
||||||
&program,
|
|
||||||
&mut crate::execution::ExecState::new(&ctx.settings),
|
|
||||||
)
|
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
return Err(miette::Report::new(crate::errors::Report {
|
return Err(miette::Report::new(crate::errors::Report {
|
||||||
|
@ -16,10 +16,7 @@ mod test_examples_show {
|
|||||||
context_type: crate::execution::ContextType::Mock,
|
context_type: crate::execution::ContextType::Mock,
|
||||||
};
|
};
|
||||||
if let Err(e) = ctx
|
if let Err(e) = ctx
|
||||||
.run(
|
.run(&program, &mut crate::execution::ExecState::new(&ctx))
|
||||||
&program,
|
|
||||||
&mut crate::execution::ExecState::new(&ctx.settings),
|
|
||||||
)
|
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
return Err(miette::Report::new(crate::errors::Report {
|
return Err(miette::Report::new(crate::errors::Report {
|
||||||
|
@ -16,10 +16,7 @@ mod test_examples_show {
|
|||||||
context_type: crate::execution::ContextType::Mock,
|
context_type: crate::execution::ContextType::Mock,
|
||||||
};
|
};
|
||||||
if let Err(e) = ctx
|
if let Err(e) = ctx
|
||||||
.run(
|
.run(&program, &mut crate::execution::ExecState::new(&ctx))
|
||||||
&program,
|
|
||||||
&mut crate::execution::ExecState::new(&ctx.settings),
|
|
||||||
)
|
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
return Err(miette::Report::new(crate::errors::Report {
|
return Err(miette::Report::new(crate::errors::Report {
|
||||||
|
@ -17,10 +17,7 @@ mod test_examples_my_func {
|
|||||||
context_type: crate::execution::ContextType::Mock,
|
context_type: crate::execution::ContextType::Mock,
|
||||||
};
|
};
|
||||||
if let Err(e) = ctx
|
if let Err(e) = ctx
|
||||||
.run(
|
.run(&program, &mut crate::execution::ExecState::new(&ctx))
|
||||||
&program,
|
|
||||||
&mut crate::execution::ExecState::new(&ctx.settings),
|
|
||||||
)
|
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
return Err(miette::Report::new(crate::errors::Report {
|
return Err(miette::Report::new(crate::errors::Report {
|
||||||
|
@ -17,10 +17,7 @@ mod test_examples_line_to {
|
|||||||
context_type: crate::execution::ContextType::Mock,
|
context_type: crate::execution::ContextType::Mock,
|
||||||
};
|
};
|
||||||
if let Err(e) = ctx
|
if let Err(e) = ctx
|
||||||
.run(
|
.run(&program, &mut crate::execution::ExecState::new(&ctx))
|
||||||
&program,
|
|
||||||
&mut crate::execution::ExecState::new(&ctx.settings),
|
|
||||||
)
|
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
return Err(miette::Report::new(crate::errors::Report {
|
return Err(miette::Report::new(crate::errors::Report {
|
||||||
|
@ -16,10 +16,7 @@ mod test_examples_min {
|
|||||||
context_type: crate::execution::ContextType::Mock,
|
context_type: crate::execution::ContextType::Mock,
|
||||||
};
|
};
|
||||||
if let Err(e) = ctx
|
if let Err(e) = ctx
|
||||||
.run(
|
.run(&program, &mut crate::execution::ExecState::new(&ctx))
|
||||||
&program,
|
|
||||||
&mut crate::execution::ExecState::new(&ctx.settings),
|
|
||||||
)
|
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
return Err(miette::Report::new(crate::errors::Report {
|
return Err(miette::Report::new(crate::errors::Report {
|
||||||
|
@ -16,10 +16,7 @@ mod test_examples_show {
|
|||||||
context_type: crate::execution::ContextType::Mock,
|
context_type: crate::execution::ContextType::Mock,
|
||||||
};
|
};
|
||||||
if let Err(e) = ctx
|
if let Err(e) = ctx
|
||||||
.run(
|
.run(&program, &mut crate::execution::ExecState::new(&ctx))
|
||||||
&program,
|
|
||||||
&mut crate::execution::ExecState::new(&ctx.settings),
|
|
||||||
)
|
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
return Err(miette::Report::new(crate::errors::Report {
|
return Err(miette::Report::new(crate::errors::Report {
|
||||||
|
@ -16,10 +16,7 @@ mod test_examples_import {
|
|||||||
context_type: crate::execution::ContextType::Mock,
|
context_type: crate::execution::ContextType::Mock,
|
||||||
};
|
};
|
||||||
if let Err(e) = ctx
|
if let Err(e) = ctx
|
||||||
.run(
|
.run(&program, &mut crate::execution::ExecState::new(&ctx))
|
||||||
&program,
|
|
||||||
&mut crate::execution::ExecState::new(&ctx.settings),
|
|
||||||
)
|
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
return Err(miette::Report::new(crate::errors::Report {
|
return Err(miette::Report::new(crate::errors::Report {
|
||||||
|
@ -16,10 +16,7 @@ mod test_examples_import {
|
|||||||
context_type: crate::execution::ContextType::Mock,
|
context_type: crate::execution::ContextType::Mock,
|
||||||
};
|
};
|
||||||
if let Err(e) = ctx
|
if let Err(e) = ctx
|
||||||
.run(
|
.run(&program, &mut crate::execution::ExecState::new(&ctx))
|
||||||
&program,
|
|
||||||
&mut crate::execution::ExecState::new(&ctx.settings),
|
|
||||||
)
|
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
return Err(miette::Report::new(crate::errors::Report {
|
return Err(miette::Report::new(crate::errors::Report {
|
||||||
|
@ -16,10 +16,7 @@ mod test_examples_import {
|
|||||||
context_type: crate::execution::ContextType::Mock,
|
context_type: crate::execution::ContextType::Mock,
|
||||||
};
|
};
|
||||||
if let Err(e) = ctx
|
if let Err(e) = ctx
|
||||||
.run(
|
.run(&program, &mut crate::execution::ExecState::new(&ctx))
|
||||||
&program,
|
|
||||||
&mut crate::execution::ExecState::new(&ctx.settings),
|
|
||||||
)
|
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
return Err(miette::Report::new(crate::errors::Report {
|
return Err(miette::Report::new(crate::errors::Report {
|
||||||
|
@ -16,10 +16,7 @@ mod test_examples_show {
|
|||||||
context_type: crate::execution::ContextType::Mock,
|
context_type: crate::execution::ContextType::Mock,
|
||||||
};
|
};
|
||||||
if let Err(e) = ctx
|
if let Err(e) = ctx
|
||||||
.run(
|
.run(&program, &mut crate::execution::ExecState::new(&ctx))
|
||||||
&program,
|
|
||||||
&mut crate::execution::ExecState::new(&ctx.settings),
|
|
||||||
)
|
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
return Err(miette::Report::new(crate::errors::Report {
|
return Err(miette::Report::new(crate::errors::Report {
|
||||||
|
@ -15,10 +15,7 @@ mod test_examples_some_function {
|
|||||||
context_type: crate::execution::ContextType::Mock,
|
context_type: crate::execution::ContextType::Mock,
|
||||||
};
|
};
|
||||||
if let Err(e) = ctx
|
if let Err(e) = ctx
|
||||||
.run(
|
.run(&program, &mut crate::execution::ExecState::new(&ctx))
|
||||||
&program,
|
|
||||||
&mut crate::execution::ExecState::new(&ctx.settings),
|
|
||||||
)
|
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
return Err(miette::Report::new(crate::errors::Report {
|
return Err(miette::Report::new(crate::errors::Report {
|
||||||
|
@ -248,6 +248,7 @@ export class Ctx {
|
|||||||
this.clientSubscriptions = []
|
this.clientSubscriptions = []
|
||||||
try {
|
try {
|
||||||
await this._client?.dispose(2000)
|
await this._client?.dispose(2000)
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// DO nothing.
|
// DO nothing.
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ ts-rs = { version = "10.1.0", features = [
|
|||||||
] }
|
] }
|
||||||
tynm = "0.1.10"
|
tynm = "0.1.10"
|
||||||
url = { version = "2.5.4", features = ["serde"] }
|
url = { version = "2.5.4", features = ["serde"] }
|
||||||
uuid = { workspace = true, features = ["v4", "js", "serde"] }
|
uuid = { workspace = true, features = ["v4", "v5", "js", "serde"] }
|
||||||
validator = { version = "0.20.0", features = ["derive"] }
|
validator = { version = "0.20.0", features = ["derive"] }
|
||||||
web-time = "1.1"
|
web-time = "1.1"
|
||||||
winnow = "=0.6.24"
|
winnow = "=0.6.24"
|
||||||
|
@ -77,7 +77,7 @@ fn run_benchmarks(c: &mut Criterion) {
|
|||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
if let Err(err) = rt.block_on(async {
|
if let Err(err) = rt.block_on(async {
|
||||||
let ctx = kcl_lib::ExecutorContext::new_with_default_client(Default::default()).await?;
|
let ctx = kcl_lib::ExecutorContext::new_with_default_client(Default::default()).await?;
|
||||||
let mut exec_state = kcl_lib::ExecState::new(&ctx.settings);
|
let mut exec_state = kcl_lib::ExecState::new(&ctx);
|
||||||
ctx.run(black_box(&program), &mut exec_state).await?;
|
ctx.run(black_box(&program), &mut exec_state).await?;
|
||||||
ctx.close().await;
|
ctx.close().await;
|
||||||
Ok::<(), anyhow::Error>(())
|
Ok::<(), anyhow::Error>(())
|
||||||
|
@ -2053,7 +2053,7 @@ sketch000 = startSketchOn('XY')
|
|||||||
let ctx = kcl_lib::ExecutorContext::new_with_default_client(Default::default())
|
let ctx = kcl_lib::ExecutorContext::new_with_default_client(Default::default())
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let mut exec_state = kcl_lib::ExecState::new(&ctx.settings);
|
let mut exec_state = kcl_lib::ExecState::new(&ctx);
|
||||||
let program = kcl_lib::Program::parse_no_errs(code).unwrap();
|
let program = kcl_lib::Program::parse_no_errs(code).unwrap();
|
||||||
ctx.run(&program, &mut exec_state).await.unwrap();
|
ctx.run(&program, &mut exec_state).await.unwrap();
|
||||||
|
|
||||||
@ -2078,7 +2078,7 @@ async fn kcl_test_ensure_nothing_left_in_batch_multi_file() {
|
|||||||
let ctx = kcl_lib::ExecutorContext::new_with_default_client(Default::default())
|
let ctx = kcl_lib::ExecutorContext::new_with_default_client(Default::default())
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let mut exec_state = kcl_lib::ExecState::new(&ctx.settings);
|
let mut exec_state = kcl_lib::ExecState::new(&ctx);
|
||||||
let program = kcl_lib::Program::parse_no_errs(&code).unwrap();
|
let program = kcl_lib::Program::parse_no_errs(&code).unwrap();
|
||||||
ctx.run(&program, &mut exec_state).await.unwrap();
|
ctx.run(&program, &mut exec_state).await.unwrap();
|
||||||
|
|
||||||
@ -2106,7 +2106,7 @@ async fn kcl_test_better_type_names() {
|
|||||||
},
|
},
|
||||||
None => todo!(),
|
None => todo!(),
|
||||||
};
|
};
|
||||||
assert_eq!(err, "This function expected the input argument to be of type SolidSet but it's actually of type Sketch. You can convert a sketch (2D) into a Solid (3D) by calling a function like `extrude` or `revolve`");
|
assert_eq!(err, "This function expected the input argument to be one or more Solids but it's actually of type Sketch. You can convert a sketch (2D) into a Solid (3D) by calling a function like `extrude` or `revolve`");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test(flavor = "multi_thread")]
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
|
@ -10,9 +10,9 @@ use pretty_assertions::assert_eq;
|
|||||||
async fn setup(code: &str, name: &str) -> Result<(ExecutorContext, Program, ModuleId, uuid::Uuid)> {
|
async fn setup(code: &str, name: &str) -> Result<(ExecutorContext, Program, ModuleId, uuid::Uuid)> {
|
||||||
let program = Program::parse_no_errs(code)?;
|
let program = Program::parse_no_errs(code)?;
|
||||||
let ctx = kcl_lib::ExecutorContext::new_with_default_client(Default::default()).await?;
|
let ctx = kcl_lib::ExecutorContext::new_with_default_client(Default::default()).await?;
|
||||||
let mut exec_state = ExecState::new(&ctx.settings);
|
let mut exec_state = ExecState::new(&ctx);
|
||||||
let result = ctx.run(&program, &mut exec_state).await?;
|
let result = ctx.run(&program, &mut exec_state).await?;
|
||||||
let outcome = exec_state.to_wasm_outcome(result.0);
|
let outcome = exec_state.to_wasm_outcome(result.0).await;
|
||||||
|
|
||||||
// We need to get the sketch ID.
|
// We need to get the sketch ID.
|
||||||
let KclValue::Sketch { value: sketch } = outcome.variables.get(name).unwrap() else {
|
let KclValue::Sketch { value: sketch } = outcome.variables.get(name).unwrap() else {
|
||||||
|
@ -1153,7 +1153,7 @@ fn find_examples(text: &str, filename: &str) -> Vec<(String, String)> {
|
|||||||
async fn run_example(text: &str) -> Result<()> {
|
async fn run_example(text: &str) -> Result<()> {
|
||||||
let program = crate::Program::parse_no_errs(text)?;
|
let program = crate::Program::parse_no_errs(text)?;
|
||||||
let ctx = ExecutorContext::new_with_default_client(crate::UnitLength::Mm).await?;
|
let ctx = ExecutorContext::new_with_default_client(crate::UnitLength::Mm).await?;
|
||||||
let mut exec_state = crate::execution::ExecState::new(&ctx.settings);
|
let mut exec_state = crate::execution::ExecState::new(&ctx);
|
||||||
ctx.run(&program, &mut exec_state).await?;
|
ctx.run(&program, &mut exec_state).await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -128,9 +128,9 @@ impl StdLibFnArg {
|
|||||||
""
|
""
|
||||||
};
|
};
|
||||||
if self.type_ == "Sketch"
|
if self.type_ == "Sketch"
|
||||||
|| self.type_ == "SketchSet"
|
|| self.type_ == "[Sketch]"
|
||||||
|| self.type_ == "Solid"
|
|| self.type_ == "Solid"
|
||||||
|| self.type_ == "SolidSet"
|
|| self.type_ == "[Solid]"
|
||||||
|| self.type_ == "SketchSurface"
|
|| self.type_ == "SketchSurface"
|
||||||
|| self.type_ == "SketchOrSurface"
|
|| self.type_ == "SketchOrSurface"
|
||||||
|| self.type_ == "SolidOrImportedGeometry"
|
|| self.type_ == "SolidOrImportedGeometry"
|
||||||
|
@ -18,7 +18,7 @@ use tokio::sync::{mpsc, oneshot, RwLock};
|
|||||||
use tokio_tungstenite::tungstenite::Message as WsMsg;
|
use tokio_tungstenite::tungstenite::Message as WsMsg;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
use super::ExecutionKind;
|
use super::{EngineStats, ExecutionKind};
|
||||||
use crate::{
|
use crate::{
|
||||||
engine::EngineManager,
|
engine::EngineManager,
|
||||||
errors::{KclError, KclErrorDetails},
|
errors::{KclError, KclErrorDetails},
|
||||||
@ -52,6 +52,7 @@ pub struct EngineConnection {
|
|||||||
session_data: Arc<RwLock<Option<ModelingSessionData>>>,
|
session_data: Arc<RwLock<Option<ModelingSessionData>>>,
|
||||||
|
|
||||||
execution_kind: Arc<RwLock<ExecutionKind>>,
|
execution_kind: Arc<RwLock<ExecutionKind>>,
|
||||||
|
stats: EngineStats,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct TcpRead {
|
pub struct TcpRead {
|
||||||
@ -344,6 +345,7 @@ impl EngineConnection {
|
|||||||
default_planes: Default::default(),
|
default_planes: Default::default(),
|
||||||
session_data,
|
session_data,
|
||||||
execution_kind: Default::default(),
|
execution_kind: Default::default(),
|
||||||
|
stats: Default::default(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -378,22 +380,12 @@ impl EngineManager for EngineConnection {
|
|||||||
original
|
original
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn default_planes(
|
fn stats(&self) -> &EngineStats {
|
||||||
&self,
|
&self.stats
|
||||||
id_generator: &mut IdGenerator,
|
}
|
||||||
source_range: SourceRange,
|
|
||||||
) -> Result<DefaultPlanes, KclError> {
|
|
||||||
{
|
|
||||||
let opt = self.default_planes.read().await.as_ref().cloned();
|
|
||||||
if let Some(planes) = opt {
|
|
||||||
return Ok(planes);
|
|
||||||
}
|
|
||||||
} // drop the read lock
|
|
||||||
|
|
||||||
let new_planes = self.new_default_planes(id_generator, source_range).await?;
|
fn get_default_planes(&self) -> Arc<RwLock<Option<DefaultPlanes>>> {
|
||||||
*self.default_planes.write().await = Some(new_planes.clone());
|
self.default_planes.clone()
|
||||||
|
|
||||||
Ok(new_planes)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn clear_scene_post_hook(
|
async fn clear_scene_post_hook(
|
||||||
|
@ -16,7 +16,7 @@ use kittycad_modeling_cmds::{self as kcmc};
|
|||||||
use tokio::sync::RwLock;
|
use tokio::sync::RwLock;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
use super::ExecutionKind;
|
use super::{EngineStats, ExecutionKind};
|
||||||
use crate::{
|
use crate::{
|
||||||
errors::KclError,
|
errors::KclError,
|
||||||
exec::DefaultPlanes,
|
exec::DefaultPlanes,
|
||||||
@ -30,6 +30,9 @@ pub struct EngineConnection {
|
|||||||
batch_end: Arc<RwLock<IndexMap<uuid::Uuid, (WebSocketRequest, SourceRange)>>>,
|
batch_end: Arc<RwLock<IndexMap<uuid::Uuid, (WebSocketRequest, SourceRange)>>>,
|
||||||
artifact_commands: Arc<RwLock<Vec<ArtifactCommand>>>,
|
artifact_commands: Arc<RwLock<Vec<ArtifactCommand>>>,
|
||||||
execution_kind: Arc<RwLock<ExecutionKind>>,
|
execution_kind: Arc<RwLock<ExecutionKind>>,
|
||||||
|
/// The default planes for the scene.
|
||||||
|
default_planes: Arc<RwLock<Option<DefaultPlanes>>>,
|
||||||
|
stats: EngineStats,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EngineConnection {
|
impl EngineConnection {
|
||||||
@ -39,6 +42,8 @@ impl EngineConnection {
|
|||||||
batch_end: Arc::new(RwLock::new(IndexMap::new())),
|
batch_end: Arc::new(RwLock::new(IndexMap::new())),
|
||||||
artifact_commands: Arc::new(RwLock::new(Vec::new())),
|
artifact_commands: Arc::new(RwLock::new(Vec::new())),
|
||||||
execution_kind: Default::default(),
|
execution_kind: Default::default(),
|
||||||
|
default_planes: Default::default(),
|
||||||
|
stats: Default::default(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -57,6 +62,10 @@ impl crate::engine::EngineManager for EngineConnection {
|
|||||||
Arc::new(RwLock::new(IndexMap::new()))
|
Arc::new(RwLock::new(IndexMap::new()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn stats(&self) -> &EngineStats {
|
||||||
|
&self.stats
|
||||||
|
}
|
||||||
|
|
||||||
fn artifact_commands(&self) -> Arc<RwLock<Vec<ArtifactCommand>>> {
|
fn artifact_commands(&self) -> Arc<RwLock<Vec<ArtifactCommand>>> {
|
||||||
self.artifact_commands.clone()
|
self.artifact_commands.clone()
|
||||||
}
|
}
|
||||||
@ -73,12 +82,8 @@ impl crate::engine::EngineManager for EngineConnection {
|
|||||||
original
|
original
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn default_planes(
|
fn get_default_planes(&self) -> Arc<RwLock<Option<DefaultPlanes>>> {
|
||||||
&self,
|
self.default_planes.clone()
|
||||||
_id_generator: &mut IdGenerator,
|
|
||||||
_source_range: SourceRange,
|
|
||||||
) -> Result<DefaultPlanes, KclError> {
|
|
||||||
Ok(DefaultPlanes::default())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn clear_scene_post_hook(
|
async fn clear_scene_post_hook(
|
||||||
|
@ -11,7 +11,7 @@ use uuid::Uuid;
|
|||||||
use wasm_bindgen::prelude::*;
|
use wasm_bindgen::prelude::*;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
engine::ExecutionKind,
|
engine::{EngineStats, ExecutionKind},
|
||||||
errors::{KclError, KclErrorDetails},
|
errors::{KclError, KclErrorDetails},
|
||||||
execution::{ArtifactCommand, DefaultPlanes, IdGenerator},
|
execution::{ArtifactCommand, DefaultPlanes, IdGenerator},
|
||||||
SourceRange,
|
SourceRange,
|
||||||
@ -31,12 +31,6 @@ extern "C" {
|
|||||||
idToRangeStr: String,
|
idToRangeStr: String,
|
||||||
) -> Result<js_sys::Promise, js_sys::Error>;
|
) -> Result<js_sys::Promise, js_sys::Error>;
|
||||||
|
|
||||||
#[wasm_bindgen(method, js_name = wasmGetDefaultPlanes, catch)]
|
|
||||||
fn get_default_planes(this: &EngineCommandManager) -> Result<js_sys::Promise, js_sys::Error>;
|
|
||||||
|
|
||||||
#[wasm_bindgen(method, js_name = clearDefaultPlanes, catch)]
|
|
||||||
fn clear_default_planes(this: &EngineCommandManager) -> Result<(), js_sys::Error>;
|
|
||||||
|
|
||||||
#[wasm_bindgen(method, js_name = startNewSession, catch)]
|
#[wasm_bindgen(method, js_name = startNewSession, catch)]
|
||||||
fn start_new_session(this: &EngineCommandManager) -> Result<js_sys::Promise, js_sys::Error>;
|
fn start_new_session(this: &EngineCommandManager) -> Result<js_sys::Promise, js_sys::Error>;
|
||||||
}
|
}
|
||||||
@ -49,6 +43,9 @@ pub struct EngineConnection {
|
|||||||
responses: Arc<RwLock<IndexMap<Uuid, WebSocketResponse>>>,
|
responses: Arc<RwLock<IndexMap<Uuid, WebSocketResponse>>>,
|
||||||
artifact_commands: Arc<RwLock<Vec<ArtifactCommand>>>,
|
artifact_commands: Arc<RwLock<Vec<ArtifactCommand>>>,
|
||||||
execution_kind: Arc<RwLock<ExecutionKind>>,
|
execution_kind: Arc<RwLock<ExecutionKind>>,
|
||||||
|
/// The default planes for the scene.
|
||||||
|
default_planes: Arc<RwLock<Option<DefaultPlanes>>>,
|
||||||
|
stats: EngineStats,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Safety: WebAssembly will only ever run in a single-threaded context.
|
// Safety: WebAssembly will only ever run in a single-threaded context.
|
||||||
@ -65,6 +62,8 @@ impl EngineConnection {
|
|||||||
responses: Arc::new(RwLock::new(IndexMap::new())),
|
responses: Arc::new(RwLock::new(IndexMap::new())),
|
||||||
artifact_commands: Arc::new(RwLock::new(Vec::new())),
|
artifact_commands: Arc::new(RwLock::new(Vec::new())),
|
||||||
execution_kind: Default::default(),
|
execution_kind: Default::default(),
|
||||||
|
default_planes: Default::default(),
|
||||||
|
stats: Default::default(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,6 +143,10 @@ impl crate::engine::EngineManager for EngineConnection {
|
|||||||
self.responses.clone()
|
self.responses.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn stats(&self) -> &EngineStats {
|
||||||
|
&self.stats
|
||||||
|
}
|
||||||
|
|
||||||
fn artifact_commands(&self) -> Arc<RwLock<Vec<ArtifactCommand>>> {
|
fn artifact_commands(&self) -> Arc<RwLock<Vec<ArtifactCommand>>> {
|
||||||
self.artifact_commands.clone()
|
self.artifact_commands.clone()
|
||||||
}
|
}
|
||||||
@ -160,59 +163,18 @@ impl crate::engine::EngineManager for EngineConnection {
|
|||||||
original
|
original
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn default_planes(
|
fn get_default_planes(&self) -> Arc<RwLock<Option<DefaultPlanes>>> {
|
||||||
&self,
|
self.default_planes.clone()
|
||||||
_id_generator: &mut IdGenerator,
|
|
||||||
source_range: SourceRange,
|
|
||||||
) -> Result<DefaultPlanes, KclError> {
|
|
||||||
// Get the default planes.
|
|
||||||
let promise = self.manager.get_default_planes().map_err(|e| {
|
|
||||||
KclError::Engine(KclErrorDetails {
|
|
||||||
message: e.to_string().into(),
|
|
||||||
source_ranges: vec![source_range],
|
|
||||||
})
|
|
||||||
})?;
|
|
||||||
|
|
||||||
let value = crate::wasm::JsFuture::from(promise).await.map_err(|e| {
|
|
||||||
KclError::Engine(KclErrorDetails {
|
|
||||||
message: format!("Failed to wait for promise from get default planes: {:?}", e),
|
|
||||||
source_ranges: vec![source_range],
|
|
||||||
})
|
|
||||||
})?;
|
|
||||||
|
|
||||||
// Parse the value as a string.
|
|
||||||
let s = value.as_string().ok_or_else(|| {
|
|
||||||
KclError::Engine(KclErrorDetails {
|
|
||||||
message: format!(
|
|
||||||
"Failed to get string from response from get default planes: `{:?}`",
|
|
||||||
value
|
|
||||||
),
|
|
||||||
source_ranges: vec![source_range],
|
|
||||||
})
|
|
||||||
})?;
|
|
||||||
|
|
||||||
// Deserialize the response.
|
|
||||||
let default_planes: DefaultPlanes = serde_json::from_str(&s).map_err(|e| {
|
|
||||||
KclError::Engine(KclErrorDetails {
|
|
||||||
message: format!("Failed to deserialize default planes: {:?}", e),
|
|
||||||
source_ranges: vec![source_range],
|
|
||||||
})
|
|
||||||
})?;
|
|
||||||
|
|
||||||
Ok(default_planes)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn clear_scene_post_hook(
|
async fn clear_scene_post_hook(
|
||||||
&self,
|
&self,
|
||||||
_id_generator: &mut IdGenerator,
|
id_generator: &mut IdGenerator,
|
||||||
source_range: SourceRange,
|
source_range: SourceRange,
|
||||||
) -> Result<(), KclError> {
|
) -> Result<(), KclError> {
|
||||||
self.manager.clear_default_planes().map_err(|e| {
|
// Remake the default planes, since they would have been removed after the scene was cleared.
|
||||||
KclError::Engine(KclErrorDetails {
|
let new_planes = self.new_default_planes(id_generator, source_range).await?;
|
||||||
message: e.to_string().into(),
|
*self.default_planes.write().await = Some(new_planes);
|
||||||
source_ranges: vec![source_range],
|
|
||||||
})
|
|
||||||
})?;
|
|
||||||
|
|
||||||
// Start a new session.
|
// Start a new session.
|
||||||
let promise = self.manager.start_new_session().map_err(|e| {
|
let promise = self.manager.start_new_session().map_err(|e| {
|
||||||
|
@ -8,7 +8,13 @@ pub mod conn_mock;
|
|||||||
#[cfg(feature = "engine")]
|
#[cfg(feature = "engine")]
|
||||||
pub mod conn_wasm;
|
pub mod conn_wasm;
|
||||||
|
|
||||||
use std::{collections::HashMap, sync::Arc};
|
use std::{
|
||||||
|
collections::HashMap,
|
||||||
|
sync::{
|
||||||
|
atomic::{AtomicUsize, Ordering},
|
||||||
|
Arc,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
use indexmap::IndexMap;
|
use indexmap::IndexMap;
|
||||||
use kcmc::{
|
use kcmc::{
|
||||||
@ -58,6 +64,21 @@ impl ExecutionKind {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Default, Debug)]
|
||||||
|
pub struct EngineStats {
|
||||||
|
pub commands_batched: AtomicUsize,
|
||||||
|
pub batches_sent: AtomicUsize,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Clone for EngineStats {
|
||||||
|
fn clone(&self) -> Self {
|
||||||
|
Self {
|
||||||
|
commands_batched: AtomicUsize::new(self.commands_batched.load(Ordering::Relaxed)),
|
||||||
|
batches_sent: AtomicUsize::new(self.batches_sent.load(Ordering::Relaxed)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[async_trait::async_trait]
|
#[async_trait::async_trait]
|
||||||
pub trait EngineManager: std::fmt::Debug + Send + Sync + 'static {
|
pub trait EngineManager: std::fmt::Debug + Send + Sync + 'static {
|
||||||
/// Get the batch of commands to be sent to the engine.
|
/// Get the batch of commands to be sent to the engine.
|
||||||
@ -95,11 +116,28 @@ pub trait EngineManager: std::fmt::Debug + Send + Sync + 'static {
|
|||||||
async fn replace_execution_kind(&self, execution_kind: ExecutionKind) -> ExecutionKind;
|
async fn replace_execution_kind(&self, execution_kind: ExecutionKind) -> ExecutionKind;
|
||||||
|
|
||||||
/// Get the default planes.
|
/// Get the default planes.
|
||||||
|
fn get_default_planes(&self) -> Arc<RwLock<Option<DefaultPlanes>>>;
|
||||||
|
|
||||||
|
fn stats(&self) -> &EngineStats;
|
||||||
|
|
||||||
|
/// Get the default planes, creating them if they don't exist.
|
||||||
async fn default_planes(
|
async fn default_planes(
|
||||||
&self,
|
&self,
|
||||||
id_generator: &mut IdGenerator,
|
id_generator: &mut IdGenerator,
|
||||||
_source_range: SourceRange,
|
source_range: SourceRange,
|
||||||
) -> Result<DefaultPlanes, crate::errors::KclError>;
|
) -> Result<DefaultPlanes, KclError> {
|
||||||
|
{
|
||||||
|
let opt = self.get_default_planes().read().await.as_ref().cloned();
|
||||||
|
if let Some(planes) = opt {
|
||||||
|
return Ok(planes);
|
||||||
|
}
|
||||||
|
} // drop the read lock
|
||||||
|
|
||||||
|
let new_planes = self.new_default_planes(id_generator, source_range).await?;
|
||||||
|
*self.get_default_planes().write().await = Some(new_planes.clone());
|
||||||
|
|
||||||
|
Ok(new_planes)
|
||||||
|
}
|
||||||
|
|
||||||
/// Helpers to be called after clearing a scene.
|
/// Helpers to be called after clearing a scene.
|
||||||
/// (These really only apply to wasm for now).
|
/// (These really only apply to wasm for now).
|
||||||
@ -239,6 +277,7 @@ pub trait EngineManager: std::fmt::Debug + Send + Sync + 'static {
|
|||||||
|
|
||||||
// Add cmd to the batch.
|
// Add cmd to the batch.
|
||||||
self.batch().write().await.push((req, source_range));
|
self.batch().write().await.push((req, source_range));
|
||||||
|
self.stats().commands_batched.fetch_add(1, Ordering::Relaxed);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -262,6 +301,9 @@ pub trait EngineManager: std::fmt::Debug + Send + Sync + 'static {
|
|||||||
for cmd in cmds {
|
for cmd in cmds {
|
||||||
extended_cmds.push((WebSocketRequest::ModelingCmdReq(cmd.clone()), source_range));
|
extended_cmds.push((WebSocketRequest::ModelingCmdReq(cmd.clone()), source_range));
|
||||||
}
|
}
|
||||||
|
self.stats()
|
||||||
|
.commands_batched
|
||||||
|
.fetch_add(extended_cmds.len(), Ordering::Relaxed);
|
||||||
self.batch().write().await.extend(extended_cmds);
|
self.batch().write().await.extend(extended_cmds);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
@ -288,6 +330,7 @@ pub trait EngineManager: std::fmt::Debug + Send + Sync + 'static {
|
|||||||
|
|
||||||
// Add cmd to the batch end.
|
// Add cmd to the batch end.
|
||||||
self.batch_end().write().await.insert(id, (req, source_range));
|
self.batch_end().write().await.insert(id, (req, source_range));
|
||||||
|
self.stats().commands_batched.fetch_add(1, Ordering::Relaxed);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -390,6 +433,7 @@ pub trait EngineManager: std::fmt::Debug + Send + Sync + 'static {
|
|||||||
if batch_end {
|
if batch_end {
|
||||||
self.batch_end().write().await.clear();
|
self.batch_end().write().await.clear();
|
||||||
}
|
}
|
||||||
|
self.stats().batches_sent.fetch_add(1, Ordering::Relaxed);
|
||||||
|
|
||||||
// We pop off the responses to cleanup our mappings.
|
// We pop off the responses to cleanup our mappings.
|
||||||
match final_req {
|
match final_req {
|
||||||
|
@ -4,7 +4,7 @@ use thiserror::Error;
|
|||||||
use tower_lsp::lsp_types::{Diagnostic, DiagnosticSeverity};
|
use tower_lsp::lsp_types::{Diagnostic, DiagnosticSeverity};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
execution::{ArtifactCommand, ArtifactGraph, Operation},
|
execution::{ArtifactCommand, ArtifactGraph, DefaultPlanes, Operation},
|
||||||
lsp::IntoDiagnostic,
|
lsp::IntoDiagnostic,
|
||||||
modules::{ModulePath, ModuleSource},
|
modules::{ModulePath, ModuleSource},
|
||||||
source_range::SourceRange,
|
source_range::SourceRange,
|
||||||
@ -131,6 +131,7 @@ pub struct KclErrorWithOutputs {
|
|||||||
pub artifact_graph: ArtifactGraph,
|
pub artifact_graph: ArtifactGraph,
|
||||||
pub filenames: IndexMap<ModuleId, ModulePath>,
|
pub filenames: IndexMap<ModuleId, ModulePath>,
|
||||||
pub source_files: IndexMap<ModuleId, ModuleSource>,
|
pub source_files: IndexMap<ModuleId, ModuleSource>,
|
||||||
|
pub default_planes: Option<DefaultPlanes>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl KclErrorWithOutputs {
|
impl KclErrorWithOutputs {
|
||||||
@ -141,6 +142,7 @@ impl KclErrorWithOutputs {
|
|||||||
artifact_graph: ArtifactGraph,
|
artifact_graph: ArtifactGraph,
|
||||||
filenames: IndexMap<ModuleId, ModulePath>,
|
filenames: IndexMap<ModuleId, ModulePath>,
|
||||||
source_files: IndexMap<ModuleId, ModuleSource>,
|
source_files: IndexMap<ModuleId, ModuleSource>,
|
||||||
|
default_planes: Option<DefaultPlanes>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
error,
|
error,
|
||||||
@ -149,6 +151,7 @@ impl KclErrorWithOutputs {
|
|||||||
artifact_graph,
|
artifact_graph,
|
||||||
filenames,
|
filenames,
|
||||||
source_files,
|
source_files,
|
||||||
|
default_planes,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn no_outputs(error: KclError) -> Self {
|
pub fn no_outputs(error: KclError) -> Self {
|
||||||
@ -159,6 +162,7 @@ impl KclErrorWithOutputs {
|
|||||||
artifact_graph: Default::default(),
|
artifact_graph: Default::default(),
|
||||||
filenames: Default::default(),
|
filenames: Default::default(),
|
||||||
source_files: Default::default(),
|
source_files: Default::default(),
|
||||||
|
default_planes: Default::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn into_miette_report_with_outputs(self, code: &str) -> anyhow::Result<ReportWithOutputs> {
|
pub fn into_miette_report_with_outputs(self, code: &str) -> anyhow::Result<ReportWithOutputs> {
|
||||||
|
@ -180,15 +180,9 @@ pub enum OpKclValue {
|
|||||||
Sketch {
|
Sketch {
|
||||||
value: Box<OpSketch>,
|
value: Box<OpSketch>,
|
||||||
},
|
},
|
||||||
Sketches {
|
|
||||||
value: Vec<OpSketch>,
|
|
||||||
},
|
|
||||||
Solid {
|
Solid {
|
||||||
value: Box<OpSolid>,
|
value: Box<OpSolid>,
|
||||||
},
|
},
|
||||||
Solids {
|
|
||||||
value: Vec<OpSolid>,
|
|
||||||
},
|
|
||||||
Helix {
|
Helix {
|
||||||
value: Box<OpHelix>,
|
value: Box<OpHelix>,
|
||||||
},
|
},
|
||||||
@ -234,7 +228,7 @@ impl From<&KclValue> for OpKclValue {
|
|||||||
ty: ty.clone(),
|
ty: ty.clone(),
|
||||||
},
|
},
|
||||||
KclValue::String { value, .. } => Self::String { value: value.clone() },
|
KclValue::String { value, .. } => Self::String { value: value.clone() },
|
||||||
KclValue::MixedArray { value, .. } => {
|
KclValue::MixedArray { value, .. } | KclValue::HomArray { value, .. } => {
|
||||||
let value = value.iter().map(Self::from).collect();
|
let value = value.iter().map(Self::from).collect();
|
||||||
Self::Array { value }
|
Self::Array { value }
|
||||||
}
|
}
|
||||||
@ -244,7 +238,7 @@ impl From<&KclValue> for OpKclValue {
|
|||||||
}
|
}
|
||||||
KclValue::TagIdentifier(tag_identifier) => Self::TagIdentifier {
|
KclValue::TagIdentifier(tag_identifier) => Self::TagIdentifier {
|
||||||
value: tag_identifier.value.clone(),
|
value: tag_identifier.value.clone(),
|
||||||
artifact_id: tag_identifier.info.as_ref().map(|info| ArtifactId::new(info.id)),
|
artifact_id: tag_identifier.get_cur_info().map(|info| ArtifactId::new(info.id)),
|
||||||
},
|
},
|
||||||
KclValue::TagDeclarator(node) => Self::TagDeclarator {
|
KclValue::TagDeclarator(node) => Self::TagDeclarator {
|
||||||
name: node.name.clone(),
|
name: node.name.clone(),
|
||||||
@ -260,29 +254,11 @@ impl From<&KclValue> for OpKclValue {
|
|||||||
artifact_id: value.artifact_id,
|
artifact_id: value.artifact_id,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
KclValue::Sketches { value } => {
|
|
||||||
let value = value
|
|
||||||
.iter()
|
|
||||||
.map(|sketch| OpSketch {
|
|
||||||
artifact_id: sketch.artifact_id,
|
|
||||||
})
|
|
||||||
.collect();
|
|
||||||
Self::Sketches { value }
|
|
||||||
}
|
|
||||||
KclValue::Solid { value } => Self::Solid {
|
KclValue::Solid { value } => Self::Solid {
|
||||||
value: Box::new(OpSolid {
|
value: Box::new(OpSolid {
|
||||||
artifact_id: value.artifact_id,
|
artifact_id: value.artifact_id,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
KclValue::Solids { value } => {
|
|
||||||
let value = value
|
|
||||||
.iter()
|
|
||||||
.map(|solid| OpSolid {
|
|
||||||
artifact_id: solid.artifact_id,
|
|
||||||
})
|
|
||||||
.collect();
|
|
||||||
Self::Solids { value }
|
|
||||||
}
|
|
||||||
KclValue::Helix { value } => Self::Helix {
|
KclValue::Helix { value } => Self::Helix {
|
||||||
value: Box::new(OpHelix {
|
value: Box::new(OpHelix {
|
||||||
artifact_id: value.artifact_id,
|
artifact_id: value.artifact_id,
|
||||||
@ -295,7 +271,6 @@ impl From<&KclValue> for OpKclValue {
|
|||||||
KclValue::Module { .. } => Self::Module {},
|
KclValue::Module { .. } => Self::Module {},
|
||||||
KclValue::KclNone { .. } => Self::KclNone {},
|
KclValue::KclNone { .. } => Self::KclNone {},
|
||||||
KclValue::Type { .. } => Self::Type {},
|
KclValue::Type { .. } => Self::Type {},
|
||||||
KclValue::Tombstone { .. } => unreachable!("Tombstone OpKclValue"),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|