Compare commits
28 Commits
ascii
...
jtran/prom
Author | SHA1 | Date | |
---|---|---|---|
5ab814d153 | |||
fe83cd94ca | |||
5178a72c52 | |||
f4e801351c | |||
7329753211 | |||
7d46e7e271 | |||
0583eb07d5 | |||
73694563cf | |||
bb4ed59191 | |||
566143757f | |||
822f2ffc73 | |||
eb3ceba497 | |||
2c6d0621c9 | |||
d8e84cb5e3 | |||
0b1e79871f | |||
954fddf578 | |||
f94f748339 | |||
e2b7b22ca9 | |||
efc8c82d8b | |||
eac5abba79 | |||
1956c14b8a | |||
017fac7041 | |||
0bdc50c78f | |||
57d78b6094 | |||
db5ce7ba85 | |||
51c16d0048 | |||
6532b23f1c | |||
49304b9ecd |
18
.eslintrc
@ -26,11 +26,17 @@
|
|||||||
"@typescript-eslint/no-duplicate-enum-values": "error",
|
"@typescript-eslint/no-duplicate-enum-values": "error",
|
||||||
"@typescript-eslint/no-duplicate-type-constituents": "error",
|
"@typescript-eslint/no-duplicate-type-constituents": "error",
|
||||||
"@typescript-eslint/no-empty-object-type": "error",
|
"@typescript-eslint/no-empty-object-type": "error",
|
||||||
|
"@typescript-eslint/no-extra-non-null-assertion": "error",
|
||||||
"@typescript-eslint/no-floating-promises": "error",
|
"@typescript-eslint/no-floating-promises": "error",
|
||||||
|
"@typescript-eslint/no-for-in-array": "error",
|
||||||
"no-implied-eval": "off", // This is wrong; use the @typescript-eslint one instead.
|
"no-implied-eval": "off", // This is wrong; use the @typescript-eslint one instead.
|
||||||
"@typescript-eslint/no-implied-eval": "error",
|
"@typescript-eslint/no-implied-eval": "error",
|
||||||
|
"@typescript-eslint/no-misused-new": "error",
|
||||||
"@typescript-eslint/no-misused-promises": "error",
|
"@typescript-eslint/no-misused-promises": "error",
|
||||||
"@typescript-eslint/no-namespace": "error",
|
"@typescript-eslint/no-namespace": "error",
|
||||||
|
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
|
||||||
|
"@typescript-eslint/no-redundant-type-constituents": "error",
|
||||||
|
"@typescript-eslint/no-this-alias": "warn",
|
||||||
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
||||||
"@typescript-eslint/no-unnecessary-type-constraint": "error",
|
"@typescript-eslint/no-unnecessary-type-constraint": "error",
|
||||||
"no-unused-vars": "off", // This is wrong; use the @typescript-eslint one instead.
|
"no-unused-vars": "off", // This is wrong; use the @typescript-eslint one instead.
|
||||||
@ -41,7 +47,13 @@
|
|||||||
"vars": "all",
|
"vars": "all",
|
||||||
"args": "none"
|
"args": "none"
|
||||||
}],
|
}],
|
||||||
|
"@typescript-eslint/no-unsafe-unary-minus": "error",
|
||||||
|
"@typescript-eslint/no-wrapper-object-types": "error",
|
||||||
|
"no-throw-literal": "off", // Use @typescript-eslint/only-throw-error instead.
|
||||||
|
"@typescript-eslint/only-throw-error": "error",
|
||||||
"@typescript-eslint/prefer-as-const": "warn",
|
"@typescript-eslint/prefer-as-const": "warn",
|
||||||
|
"@typescript-eslint/prefer-namespace-keyword": "error",
|
||||||
|
"@typescript-eslint/restrict-plus-operands": "error",
|
||||||
"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",
|
||||||
@ -50,7 +62,7 @@
|
|||||||
{
|
{
|
||||||
"name": "isNaN",
|
"name": "isNaN",
|
||||||
"message": "Use Number.isNaN() instead."
|
"message": "Use Number.isNaN() instead."
|
||||||
},
|
}
|
||||||
],
|
],
|
||||||
"no-restricted-syntax": [
|
"no-restricted-syntax": [
|
||||||
"error",
|
"error",
|
||||||
@ -64,7 +76,7 @@
|
|||||||
"never"
|
"never"
|
||||||
],
|
],
|
||||||
"react-hooks/exhaustive-deps": "off",
|
"react-hooks/exhaustive-deps": "off",
|
||||||
"suggest-no-throw/suggest-no-throw": "warn",
|
"suggest-no-throw/suggest-no-throw": "error"
|
||||||
},
|
},
|
||||||
"overrides": [
|
"overrides": [
|
||||||
{
|
{
|
||||||
@ -84,7 +96,7 @@
|
|||||||
"plugin:testing-library/react"
|
"plugin:testing-library/react"
|
||||||
],
|
],
|
||||||
"rules": {
|
"rules": {
|
||||||
"suggest-no-throw/suggest-no-throw": "off",
|
"suggest-no-throw/suggest-no-throw": "off"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
8
.github/workflows/e2e-tests.yml
vendored
@ -229,10 +229,6 @@ jobs:
|
|||||||
timeout_minutes: 30
|
timeout_minutes: 30
|
||||||
max_attempts: 3
|
max_attempts: 3
|
||||||
env:
|
env:
|
||||||
CI: true
|
|
||||||
NODE_ENV: development
|
|
||||||
VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
|
||||||
VITE_KC_SKIP_AUTH: true
|
|
||||||
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
||||||
snapshottoken: ${{ secrets.KITTYCAD_API_TOKEN }}
|
snapshottoken: ${{ secrets.KITTYCAD_API_TOKEN }}
|
||||||
|
|
||||||
@ -377,11 +373,7 @@ jobs:
|
|||||||
timeout_minutes: 45
|
timeout_minutes: 45
|
||||||
max_attempts: 15
|
max_attempts: 15
|
||||||
env:
|
env:
|
||||||
CI: true
|
|
||||||
FAIL_ON_CONSOLE_ERRORS: true
|
FAIL_ON_CONSOLE_ERRORS: true
|
||||||
NODE_ENV: development
|
|
||||||
VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
|
||||||
VITE_KC_SKIP_AUTH: true
|
|
||||||
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
|
@ -9,13 +9,9 @@ layout: manual
|
|||||||
|
|
||||||
### `std`
|
### `std`
|
||||||
|
|
||||||
- [`HALF_TURN`](/docs/kcl/consts/std-HALF_TURN)
|
|
||||||
- [`QUARTER_TURN`](/docs/kcl/consts/std-QUARTER_TURN)
|
|
||||||
- [`THREE_QUARTER_TURN`](/docs/kcl/consts/std-THREE_QUARTER_TURN)
|
|
||||||
- [`XY`](/docs/kcl/consts/std-XY)
|
- [`XY`](/docs/kcl/consts/std-XY)
|
||||||
- [`XZ`](/docs/kcl/consts/std-XZ)
|
- [`XZ`](/docs/kcl/consts/std-XZ)
|
||||||
- [`YZ`](/docs/kcl/consts/std-YZ)
|
- [`YZ`](/docs/kcl/consts/std-YZ)
|
||||||
- [`ZERO`](/docs/kcl/consts/std-ZERO)
|
|
||||||
|
|
||||||
### `std::math`
|
### `std::math`
|
||||||
|
|
||||||
@ -23,3 +19,10 @@ layout: manual
|
|||||||
- [`PI`](/docs/kcl/consts/std-math-PI)
|
- [`PI`](/docs/kcl/consts/std-math-PI)
|
||||||
- [`TAU`](/docs/kcl/consts/std-math-TAU)
|
- [`TAU`](/docs/kcl/consts/std-math-TAU)
|
||||||
|
|
||||||
|
### `std::turns`
|
||||||
|
|
||||||
|
- [`HALF_TURN`](/docs/kcl/consts/std-turns-HALF_TURN)
|
||||||
|
- [`QUARTER_TURN`](/docs/kcl/consts/std-turns-QUARTER_TURN)
|
||||||
|
- [`THREE_QUARTER_TURN`](/docs/kcl/consts/std-turns-THREE_QUARTER_TURN)
|
||||||
|
- [`ZERO`](/docs/kcl/consts/std-turns-ZERO)
|
||||||
|
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
---
|
|
||||||
title: "std::HALF_TURN"
|
|
||||||
excerpt: ""
|
|
||||||
layout: manual
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
std::HALF_TURN: number(deg) = 180deg
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
|||||||
---
|
|
||||||
title: "std::QUARTER_TURN"
|
|
||||||
excerpt: ""
|
|
||||||
layout: manual
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
std::QUARTER_TURN: number(deg) = 90deg
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
|||||||
---
|
|
||||||
title: "std::THREE_QUARTER_TURN"
|
|
||||||
excerpt: ""
|
|
||||||
layout: manual
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
std::THREE_QUARTER_TURN: number(deg) = 270deg
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
|||||||
---
|
|
||||||
title: "std::ZERO"
|
|
||||||
excerpt: ""
|
|
||||||
layout: manual
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
std::ZERO: number = 0
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
15
docs/kcl/consts/std-turns-HALF_TURN.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
title: "std::turns::HALF_TURN"
|
||||||
|
excerpt: ""
|
||||||
|
layout: manual
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```js
|
||||||
|
std::turns::HALF_TURN: number(deg) = 180deg
|
||||||
|
```
|
||||||
|
|
||||||
|
|
15
docs/kcl/consts/std-turns-QUARTER_TURN.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
title: "std::turns::QUARTER_TURN"
|
||||||
|
excerpt: ""
|
||||||
|
layout: manual
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```js
|
||||||
|
std::turns::QUARTER_TURN: number(deg) = 90deg
|
||||||
|
```
|
||||||
|
|
||||||
|
|
15
docs/kcl/consts/std-turns-THREE_QUARTER_TURN.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
title: "std::turns::THREE_QUARTER_TURN"
|
||||||
|
excerpt: ""
|
||||||
|
layout: manual
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```js
|
||||||
|
std::turns::THREE_QUARTER_TURN: number(deg) = 270deg
|
||||||
|
```
|
||||||
|
|
||||||
|
|
15
docs/kcl/consts/std-turns-ZERO.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
title: "std::turns::ZERO"
|
||||||
|
excerpt: ""
|
||||||
|
layout: manual
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```js
|
||||||
|
std::turns::ZERO: number = 0
|
||||||
|
```
|
||||||
|
|
||||||
|
|
@ -23,19 +23,15 @@ layout: manual
|
|||||||
* [`tag`](kcl/types/tag)
|
* [`tag`](kcl/types/tag)
|
||||||
* **std**
|
* **std**
|
||||||
* [`Face`](kcl/types/Face)
|
* [`Face`](kcl/types/Face)
|
||||||
* [`HALF_TURN`](kcl/consts/std-HALF_TURN)
|
|
||||||
* [`Helix`](kcl/types/Helix)
|
* [`Helix`](kcl/types/Helix)
|
||||||
* [`Plane`](kcl/types/Plane)
|
* [`Plane`](kcl/types/Plane)
|
||||||
* [`Point2d`](kcl/types/Point2d)
|
* [`Point2d`](kcl/types/Point2d)
|
||||||
* [`Point3d`](kcl/types/Point3d)
|
* [`Point3d`](kcl/types/Point3d)
|
||||||
* [`QUARTER_TURN`](kcl/consts/std-QUARTER_TURN)
|
|
||||||
* [`Sketch`](kcl/types/Sketch)
|
* [`Sketch`](kcl/types/Sketch)
|
||||||
* [`Solid`](kcl/types/Solid)
|
* [`Solid`](kcl/types/Solid)
|
||||||
* [`THREE_QUARTER_TURN`](kcl/consts/std-THREE_QUARTER_TURN)
|
|
||||||
* [`XY`](kcl/consts/std-XY)
|
* [`XY`](kcl/consts/std-XY)
|
||||||
* [`XZ`](kcl/consts/std-XZ)
|
* [`XZ`](kcl/consts/std-XZ)
|
||||||
* [`YZ`](kcl/consts/std-YZ)
|
* [`YZ`](kcl/consts/std-YZ)
|
||||||
* [`ZERO`](kcl/consts/std-ZERO)
|
|
||||||
* [`abs`](kcl/abs)
|
* [`abs`](kcl/abs)
|
||||||
* [`acos`](kcl/acos)
|
* [`acos`](kcl/acos)
|
||||||
* [`angleToMatchLengthX`](kcl/angleToMatchLengthX)
|
* [`angleToMatchLengthX`](kcl/angleToMatchLengthX)
|
||||||
@ -146,3 +142,8 @@ layout: manual
|
|||||||
* [`tan`](kcl/std-math-tan)
|
* [`tan`](kcl/std-math-tan)
|
||||||
* **std::sketch**
|
* **std::sketch**
|
||||||
* [`circle`](kcl/std-sketch-circle)
|
* [`circle`](kcl/std-sketch-circle)
|
||||||
|
* **std::turns**
|
||||||
|
* [`turns::HALF_TURN`](kcl/consts/std-turns-HALF_TURN)
|
||||||
|
* [`turns::QUARTER_TURN`](kcl/consts/std-turns-QUARTER_TURN)
|
||||||
|
* [`turns::THREE_QUARTER_TURN`](kcl/consts/std-turns-THREE_QUARTER_TURN)
|
||||||
|
* [`turns::ZERO`](kcl/consts/std-turns-ZERO)
|
||||||
|
@ -17,7 +17,7 @@ circle(@sketch_or_surface: Sketch | Plane | Face, center: Point2d, radius: numbe
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `sketch_or_surface` | [`Sketch`](/docs/kcl/types/Sketch) `|` [`Plane`](/docs/kcl/types/Face) `|` [`Plane`](/docs/kcl/types/Face) | Sketch to extend, or plane or surface to sketch on. | Yes |
|
| `sketch_or_surface` | [`Sketch`](/docs/kcl/types/Sketch) OR [`Plane`](/docs/kcl/types/Plane) OR [`Face`](/docs/kcl/types/Face) | Sketch to extend, or plane or surface to sketch on. | Yes |
|
||||||
| `center` | [`Point2d`](/docs/kcl/types/Point2d) | The center of the circle. | Yes |
|
| `center` | [`Point2d`](/docs/kcl/types/Point2d) | The center of the circle. | Yes |
|
||||||
| `radius` | [`number`](/docs/kcl/types/number) | The radius of the circle. | Yes |
|
| `radius` | [`number`](/docs/kcl/types/number) | The radius of the circle. | Yes |
|
||||||
| [`tag`](/docs/kcl/types/tag) | [`tag`](/docs/kcl/types/tag) | Create a new tag which refers to this circle. | No |
|
| [`tag`](/docs/kcl/types/tag) | [`tag`](/docs/kcl/types/tag) | Create a new tag which refers to this circle. | No |
|
||||||
|
@ -207302,372 +207302,8 @@
|
|||||||
},
|
},
|
||||||
"definitions": {
|
"definitions": {
|
||||||
"TyF64": {
|
"TyF64": {
|
||||||
"type": "object",
|
|
||||||
"required": [
|
|
||||||
"n",
|
|
||||||
"ty"
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"n": {
|
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"format": "double"
|
"format": "double"
|
||||||
},
|
|
||||||
"ty": {
|
|
||||||
"$ref": "#/components/schemas/NumericType"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"NumericType": {
|
|
||||||
"oneOf": [
|
|
||||||
{
|
|
||||||
"type": "object",
|
|
||||||
"oneOf": [
|
|
||||||
{
|
|
||||||
"type": "object",
|
|
||||||
"required": [
|
|
||||||
"type"
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"type": {
|
|
||||||
"type": "string",
|
|
||||||
"enum": [
|
|
||||||
"Count"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"description": "A unit of length.",
|
|
||||||
"type": "object",
|
|
||||||
"oneOf": [
|
|
||||||
{
|
|
||||||
"type": "object",
|
|
||||||
"required": [
|
|
||||||
"type"
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"type": {
|
|
||||||
"type": "string",
|
|
||||||
"enum": [
|
|
||||||
"Mm"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "object",
|
|
||||||
"required": [
|
|
||||||
"type"
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"type": {
|
|
||||||
"type": "string",
|
|
||||||
"enum": [
|
|
||||||
"Cm"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "object",
|
|
||||||
"required": [
|
|
||||||
"type"
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"type": {
|
|
||||||
"type": "string",
|
|
||||||
"enum": [
|
|
||||||
"M"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "object",
|
|
||||||
"required": [
|
|
||||||
"type"
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"type": {
|
|
||||||
"type": "string",
|
|
||||||
"enum": [
|
|
||||||
"Inches"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "object",
|
|
||||||
"required": [
|
|
||||||
"type"
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"type": {
|
|
||||||
"type": "string",
|
|
||||||
"enum": [
|
|
||||||
"Feet"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "object",
|
|
||||||
"required": [
|
|
||||||
"type"
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"type": {
|
|
||||||
"type": "string",
|
|
||||||
"enum": [
|
|
||||||
"Yards"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"required": [
|
|
||||||
"type"
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"type": {
|
|
||||||
"type": "string",
|
|
||||||
"enum": [
|
|
||||||
"Length"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"description": "A unit of angle.",
|
|
||||||
"type": "object",
|
|
||||||
"oneOf": [
|
|
||||||
{
|
|
||||||
"type": "object",
|
|
||||||
"required": [
|
|
||||||
"type"
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"type": {
|
|
||||||
"type": "string",
|
|
||||||
"enum": [
|
|
||||||
"Degrees"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "object",
|
|
||||||
"required": [
|
|
||||||
"type"
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"type": {
|
|
||||||
"type": "string",
|
|
||||||
"enum": [
|
|
||||||
"Radians"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"required": [
|
|
||||||
"type"
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"type": {
|
|
||||||
"type": "string",
|
|
||||||
"enum": [
|
|
||||||
"Angle"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"required": [
|
|
||||||
"type"
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"type": {
|
|
||||||
"type": "string",
|
|
||||||
"enum": [
|
|
||||||
"Known"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "object",
|
|
||||||
"required": [
|
|
||||||
"angle",
|
|
||||||
"len",
|
|
||||||
"type"
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"type": {
|
|
||||||
"type": "string",
|
|
||||||
"enum": [
|
|
||||||
"Default"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"len": {
|
|
||||||
"$ref": "#/components/schemas/UnitLen"
|
|
||||||
},
|
|
||||||
"angle": {
|
|
||||||
"$ref": "#/components/schemas/UnitAngle"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "object",
|
|
||||||
"required": [
|
|
||||||
"type"
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"type": {
|
|
||||||
"type": "string",
|
|
||||||
"enum": [
|
|
||||||
"Unknown"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "object",
|
|
||||||
"required": [
|
|
||||||
"type"
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"type": {
|
|
||||||
"type": "string",
|
|
||||||
"enum": [
|
|
||||||
"Any"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"UnitLen": {
|
|
||||||
"description": "A unit of length.",
|
|
||||||
"oneOf": [
|
|
||||||
{
|
|
||||||
"type": "object",
|
|
||||||
"required": [
|
|
||||||
"type"
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"type": {
|
|
||||||
"type": "string",
|
|
||||||
"enum": [
|
|
||||||
"Mm"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "object",
|
|
||||||
"required": [
|
|
||||||
"type"
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"type": {
|
|
||||||
"type": "string",
|
|
||||||
"enum": [
|
|
||||||
"Cm"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "object",
|
|
||||||
"required": [
|
|
||||||
"type"
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"type": {
|
|
||||||
"type": "string",
|
|
||||||
"enum": [
|
|
||||||
"M"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "object",
|
|
||||||
"required": [
|
|
||||||
"type"
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"type": {
|
|
||||||
"type": "string",
|
|
||||||
"enum": [
|
|
||||||
"Inches"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "object",
|
|
||||||
"required": [
|
|
||||||
"type"
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"type": {
|
|
||||||
"type": "string",
|
|
||||||
"enum": [
|
|
||||||
"Feet"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "object",
|
|
||||||
"required": [
|
|
||||||
"type"
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"type": {
|
|
||||||
"type": "string",
|
|
||||||
"enum": [
|
|
||||||
"Yards"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"UnitAngle": {
|
|
||||||
"description": "A unit of angle.",
|
|
||||||
"oneOf": [
|
|
||||||
{
|
|
||||||
"type": "object",
|
|
||||||
"required": [
|
|
||||||
"type"
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"type": {
|
|
||||||
"type": "string",
|
|
||||||
"enum": [
|
|
||||||
"Degrees"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "object",
|
|
||||||
"required": [
|
|
||||||
"type"
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"type": {
|
|
||||||
"type": "string",
|
|
||||||
"enum": [
|
|
||||||
"Radians"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -28,7 +28,7 @@ An extrude plane.
|
|||||||
| `faceId` |[`string`](/docs/kcl/types/string)| The face id for the extrude plane. | No |
|
| `faceId` |[`string`](/docs/kcl/types/string)| The face id for the extrude plane. | No |
|
||||||
| [`tag`](/docs/kcl/types/tag) |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag. | No |
|
| [`tag`](/docs/kcl/types/tag) |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag. | No |
|
||||||
| `id` |[`string`](/docs/kcl/types/string)| The id of the geometry. | No |
|
| `id` |[`string`](/docs/kcl/types/string)| The id of the geometry. | No |
|
||||||
| `sourceRange` |[`SourceRange`](/docs/kcl/types/SourceRange)| The source range. | No |
|
| `sourceRange` |`[integer, integer, integer]`| The source range. | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -48,7 +48,7 @@ An extruded arc.
|
|||||||
| `faceId` |[`string`](/docs/kcl/types/string)| The face id for the extrude plane. | No |
|
| `faceId` |[`string`](/docs/kcl/types/string)| The face id for the extrude plane. | No |
|
||||||
| [`tag`](/docs/kcl/types/tag) |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag. | No |
|
| [`tag`](/docs/kcl/types/tag) |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag. | No |
|
||||||
| `id` |[`string`](/docs/kcl/types/string)| The id of the geometry. | No |
|
| `id` |[`string`](/docs/kcl/types/string)| The id of the geometry. | No |
|
||||||
| `sourceRange` |[`SourceRange`](/docs/kcl/types/SourceRange)| The source range. | No |
|
| `sourceRange` |`[integer, integer, integer]`| The source range. | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -68,7 +68,7 @@ Geometry metadata.
|
|||||||
| `faceId` |[`string`](/docs/kcl/types/string)| The id for the chamfer surface. | No |
|
| `faceId` |[`string`](/docs/kcl/types/string)| The id for the chamfer surface. | No |
|
||||||
| [`tag`](/docs/kcl/types/tag) |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag. | No |
|
| [`tag`](/docs/kcl/types/tag) |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag. | No |
|
||||||
| `id` |[`string`](/docs/kcl/types/string)| The id of the geometry. | No |
|
| `id` |[`string`](/docs/kcl/types/string)| The id of the geometry. | No |
|
||||||
| `sourceRange` |[`SourceRange`](/docs/kcl/types/SourceRange)| The source range. | No |
|
| `sourceRange` |`[integer, integer, integer]`| The source range. | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -88,7 +88,7 @@ Geometry metadata.
|
|||||||
| `faceId` |[`string`](/docs/kcl/types/string)| The id for the fillet surface. | No |
|
| `faceId` |[`string`](/docs/kcl/types/string)| The id for the fillet surface. | No |
|
||||||
| [`tag`](/docs/kcl/types/tag) |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag. | No |
|
| [`tag`](/docs/kcl/types/tag) |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag. | No |
|
||||||
| `id` |[`string`](/docs/kcl/types/string)| The id of the geometry. | No |
|
| `id` |[`string`](/docs/kcl/types/string)| The id of the geometry. | No |
|
||||||
| `sourceRange` |[`SourceRange`](/docs/kcl/types/SourceRange)| The source range. | No |
|
| `sourceRange` |`[integer, integer, integer]`| The source range. | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
@ -17,6 +17,6 @@ Geometry metadata.
|
|||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `id` |[`string`](/docs/kcl/types/string)| The id of the geometry. | No |
|
| `id` |[`string`](/docs/kcl/types/string)| The id of the geometry. | No |
|
||||||
| `sourceRange` |[`SourceRange`](/docs/kcl/types/SourceRange)| The source range. | No |
|
| `sourceRange` |`[integer, integer, integer]`| The source range. | No |
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ A helix.
|
|||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `value` |[`string`](/docs/kcl/types/string)| The id of the helix. | No |
|
| `value` |[`string`](/docs/kcl/types/string)| The id of the helix. | No |
|
||||||
| `artifactId` |[`ArtifactId`](/docs/kcl/types/ArtifactId)| The artifact ID. | No |
|
| `artifactId` |[`string`](/docs/kcl/types/string)| The artifact ID. | No |
|
||||||
| `revolutions` |[`number`](/docs/kcl/types/number)| Number of revolutions. | No |
|
| `revolutions` |[`number`](/docs/kcl/types/number)| Number of revolutions. | No |
|
||||||
| `angleStart` |[`number`](/docs/kcl/types/number)| Start angle (in degrees). | No |
|
| `angleStart` |[`number`](/docs/kcl/types/number)| Start angle (in degrees). | No |
|
||||||
| `ccw` |`boolean`| Is the helix rotation counter clockwise? | No |
|
| `ccw` |`boolean`| Is the helix rotation counter clockwise? | No |
|
||||||
|
@ -285,7 +285,7 @@ Data for an imported geometry.
|
|||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `Module`| | No |
|
| `type` |enum: `Module`| | No |
|
||||||
| `value` |[`ModuleId`](/docs/kcl/types/ModuleId)| Identifier of a source file. Uses a u32 to keep the size small. | No |
|
| `value` |`integer`| Identifier of a source file. Uses a u32 to keep the size small. | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
@ -17,6 +17,6 @@ Data for polar coordinates.
|
|||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `angle` |[`number`](/docs/kcl/types/number)| The angle of the line (in degrees). | No |
|
| `angle` |[`number`](/docs/kcl/types/number)| The angle of the line (in degrees). | No |
|
||||||
| `length` |[`TyF64`](/docs/kcl/types/TyF64)| The length of the line. | No |
|
| `length` |[`number`](/docs/kcl/types/number)| The length of the line. | No |
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ A sketch type.
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `plane`| | No |
|
| `type` |enum: `plane`| | No |
|
||||||
| `id` |[`string`](/docs/kcl/types/string)| The id of the plane. | No |
|
| `id` |[`string`](/docs/kcl/types/string)| The id of the plane. | No |
|
||||||
| `artifactId` |[`ArtifactId`](/docs/kcl/types/ArtifactId)| The artifact ID. | No |
|
| `artifactId` |[`string`](/docs/kcl/types/string)| The artifact ID. | No |
|
||||||
| `value` |[`PlaneType`](/docs/kcl/types/PlaneType)| Type for a plane. | No |
|
| `value` |[`PlaneType`](/docs/kcl/types/PlaneType)| Type for a plane. | No |
|
||||||
| `origin` |[`Point3d`](/docs/kcl/types/Point3d)| Origin of the plane. | No |
|
| `origin` |[`Point3d`](/docs/kcl/types/Point3d)| Origin of the plane. | No |
|
||||||
| `xAxis` |[`Point3d`](/docs/kcl/types/Point3d)| What should the plane's X axis be? | No |
|
| `xAxis` |[`Point3d`](/docs/kcl/types/Point3d)| What should the plane's X axis be? | No |
|
||||||
@ -49,7 +49,7 @@ A face.
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `face`| | No |
|
| `type` |enum: `face`| | No |
|
||||||
| `id` |[`string`](/docs/kcl/types/string)| The id of the face. | No |
|
| `id` |[`string`](/docs/kcl/types/string)| The id of the face. | No |
|
||||||
| `artifactId` |[`ArtifactId`](/docs/kcl/types/ArtifactId)| The artifact ID. | No |
|
| `artifactId` |[`string`](/docs/kcl/types/string)| The artifact ID. | No |
|
||||||
| `value` |[`string`](/docs/kcl/types/string)| The tag of the face. | No |
|
| `value` |[`string`](/docs/kcl/types/string)| The tag of the face. | No |
|
||||||
| `xAxis` |[`Point3d`](/docs/kcl/types/Point3d)| What should the face's X axis be? | No |
|
| `xAxis` |[`Point3d`](/docs/kcl/types/Point3d)| What should the face's X axis be? | No |
|
||||||
| `yAxis` |[`Point3d`](/docs/kcl/types/Point3d)| What should the face's Y axis be? | No |
|
| `yAxis` |[`Point3d`](/docs/kcl/types/Point3d)| What should the face's Y axis be? | No |
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
---
|
|
||||||
title: "SourceRange"
|
|
||||||
excerpt: ""
|
|
||||||
layout: manual
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
**Type:** `integer` (`uint`)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -5,17 +5,11 @@ layout: manual
|
|||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
**Type:** `object`
|
**Type:** [`number`](/docs/kcl/types/number) (`double`)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
|
|
||||||
| Property | Type | Description | Required |
|
|
||||||
|----------|------|-------------|----------|
|
|
||||||
| `n` |[`number`](/docs/kcl/types/number)| | No |
|
|
||||||
| `ty` |[`NumericType`](/docs/kcl/types/NumericType)| | No |
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ async function doBasicSketch(
|
|||||||
await page.mouse.click(startXPx, 500 - PUR * 20)
|
await page.mouse.click(startXPx, 500 - PUR * 20)
|
||||||
if (openPanes.includes('code')) {
|
if (openPanes.includes('code')) {
|
||||||
await expect(u.codeLocator)
|
await expect(u.codeLocator)
|
||||||
.toHaveText(`sketch001 = startSketchOn(XZ)profile001 = startProfileAt(${
|
.toHaveText(`@settings(defaultLengthUnit = in)sketch001 = startSketchOn(XZ)profile001 = startProfileAt(${
|
||||||
commonPoints.startAt
|
commonPoints.startAt
|
||||||
}, sketch001)
|
}, sketch001)
|
||||||
|> xLine(length = ${commonPoints.num1})
|
|> xLine(length = ${commonPoints.num1})
|
||||||
@ -119,10 +119,7 @@ async function doBasicSketch(
|
|||||||
await page.waitForTimeout(100)
|
await page.waitForTimeout(100)
|
||||||
|
|
||||||
if (openPanes.includes('code')) {
|
if (openPanes.includes('code')) {
|
||||||
await expect(
|
expect(await u.getGreatestPixDiff(line1, TEST_COLORS.BLUE)).toBeLessThan(3)
|
||||||
await u.getGreatestPixDiff(line1, TEST_COLORS.BLUE)
|
|
||||||
).toBeLessThan(3)
|
|
||||||
await expect(await u.getGreatestPixDiff(line1, [0, 0, 255])).toBeLessThan(3)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// hold down shift
|
// hold down shift
|
||||||
@ -145,7 +142,7 @@ async function doBasicSketch(
|
|||||||
// Open the code pane.
|
// Open the code pane.
|
||||||
await u.openKclCodePanel()
|
await u.openKclCodePanel()
|
||||||
await expect(u.codeLocator)
|
await expect(u.codeLocator)
|
||||||
.toHaveText(`sketch001 = startSketchOn(XZ)profile001 = startProfileAt(${
|
.toHaveText(`@settings(defaultLengthUnit = in)sketch001 = startSketchOn(XZ)profile001 = startProfileAt(${
|
||||||
commonPoints.startAt
|
commonPoints.startAt
|
||||||
}, sketch001)
|
}, sketch001)
|
||||||
|> xLine(length = ${commonPoints.num1}, tag = $seg01)
|
|> xLine(length = ${commonPoints.num1}, tag = $seg01)
|
||||||
|
@ -46,7 +46,7 @@ test.describe(
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
const code = `sketch001 = startSketchOn(${plane})profile001 = startProfileAt([0.91, -1.22], sketch001)`
|
const code = `@settings(defaultLengthUnit = in)sketch001 = startSketchOn(${plane})profile001 = startProfileAt([0.91, -1.22], sketch001)`
|
||||||
|
|
||||||
await u.openDebugPanel()
|
await u.openDebugPanel()
|
||||||
|
|
||||||
|
@ -251,11 +251,11 @@ test(
|
|||||||
])
|
])
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
fsp.copyFile(
|
fsp.copyFile(
|
||||||
executorInputPath('router-template-slate.kcl'),
|
executorInputPath('cylinder-inches.kcl'),
|
||||||
join(routerTemplateDir, 'main.kcl')
|
join(routerTemplateDir, 'main.kcl')
|
||||||
),
|
),
|
||||||
fsp.copyFile(
|
fsp.copyFile(
|
||||||
executorInputPath('focusrite_scarlett_mounting_braket.kcl'),
|
executorInputPath('e2e-can-sketch-on-chamfer.kcl'),
|
||||||
join(bracketDir, 'main.kcl')
|
join(bracketDir, 'main.kcl')
|
||||||
),
|
),
|
||||||
])
|
])
|
||||||
|
@ -20,11 +20,11 @@ test(
|
|||||||
await Promise.all([fsp.mkdir(bracketDir, { recursive: true })])
|
await Promise.all([fsp.mkdir(bracketDir, { recursive: true })])
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
fsp.copyFile(
|
fsp.copyFile(
|
||||||
executorInputPath('router-template-slate.kcl'),
|
executorInputPath('cylinder-inches.kcl'),
|
||||||
path.join(bracketDir, 'other.kcl')
|
path.join(bracketDir, 'other.kcl')
|
||||||
),
|
),
|
||||||
fsp.copyFile(
|
fsp.copyFile(
|
||||||
executorInputPath('focusrite_scarlett_mounting_braket.kcl'),
|
executorInputPath('e2e-can-sketch-on-chamfer.kcl'),
|
||||||
path.join(bracketDir, 'main.kcl')
|
path.join(bracketDir, 'main.kcl')
|
||||||
),
|
),
|
||||||
])
|
])
|
||||||
@ -107,7 +107,7 @@ test(
|
|||||||
},
|
},
|
||||||
{ timeout: 15_000 }
|
{ timeout: 15_000 }
|
||||||
)
|
)
|
||||||
.toBeGreaterThan(300_000)
|
.toBeGreaterThan(30_000)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -187,7 +187,7 @@ test(
|
|||||||
},
|
},
|
||||||
{ timeout: 15_000 }
|
{ timeout: 15_000 }
|
||||||
)
|
)
|
||||||
.toBeGreaterThan(70_000)
|
.toBeGreaterThan(50_000)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -32,26 +32,30 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
|
|||||||
await page.keyboard.press('/')
|
await page.keyboard.press('/')
|
||||||
await page.keyboard.up('ControlOrMeta')
|
await page.keyboard.up('ControlOrMeta')
|
||||||
|
|
||||||
await expect(page.locator('.cm-content'))
|
await expect(page.locator('.cm-content')).toHaveText(
|
||||||
.toHaveText(`sketch001 = startSketchOn(XY)
|
`@settings(defaultLengthUnit = in)
|
||||||
|
sketch001 = startSketchOn(XY)
|
||||||
|> startProfileAt([-10, -10], %)
|
|> startProfileAt([-10, -10], %)
|
||||||
|> line(end = [20, 0])
|
|> line(end = [20, 0])
|
||||||
|> line(end = [0, 20])
|
|> line(end = [0, 20])
|
||||||
|> line(end = [-20, 0])
|
|> line(end = [-20, 0])
|
||||||
// |> close()`)
|
// |> close()`.replaceAll('\n', '')
|
||||||
|
)
|
||||||
|
|
||||||
// uncomment the code
|
// uncomment the code
|
||||||
await page.keyboard.down('ControlOrMeta')
|
await page.keyboard.down('ControlOrMeta')
|
||||||
await page.keyboard.press('/')
|
await page.keyboard.press('/')
|
||||||
await page.keyboard.up('ControlOrMeta')
|
await page.keyboard.up('ControlOrMeta')
|
||||||
|
|
||||||
await expect(page.locator('.cm-content'))
|
await expect(page.locator('.cm-content')).toHaveText(
|
||||||
.toHaveText(`sketch001 = startSketchOn(XY)
|
`@settings(defaultLengthUnit = in)
|
||||||
|
sketch001 = startSketchOn(XY)
|
||||||
|> startProfileAt([-10, -10], %)
|
|> startProfileAt([-10, -10], %)
|
||||||
|> line(end = [20, 0])
|
|> line(end = [20, 0])
|
||||||
|> line(end = [0, 20])
|
|> line(end = [0, 20])
|
||||||
|> line(end = [-20, 0])
|
|> line(end = [-20, 0])
|
||||||
|> close()`)
|
|> close()`.replaceAll('\n', '')
|
||||||
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('ensure we use the cache, and do not re-execute', async ({
|
test('ensure we use the cache, and do not re-execute', async ({
|
||||||
@ -178,13 +182,15 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
|
|||||||
await page.locator('#code-pane button:first-child').click()
|
await page.locator('#code-pane button:first-child').click()
|
||||||
await page.locator('button:has-text("Format code")').click()
|
await page.locator('button:has-text("Format code")').click()
|
||||||
|
|
||||||
await expect(page.locator('.cm-content'))
|
await expect(page.locator('.cm-content')).toHaveText(
|
||||||
.toHaveText(`sketch001 = startSketchOn(XY)
|
`@settings(defaultLengthUnit = in)
|
||||||
|
sketch001 = startSketchOn(XY)
|
||||||
|> startProfileAt([-10, -10], %)
|
|> startProfileAt([-10, -10], %)
|
||||||
|> line(end = [20, 0])
|
|> line(end = [20, 0])
|
||||||
|> line(end = [0, 20])
|
|> line(end = [0, 20])
|
||||||
|> line(end = [-20, 0])
|
|> line(end = [-20, 0])
|
||||||
|> close()`)
|
|> close()`.replaceAll('\n', '')
|
||||||
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('if you click the format button it formats your code and executes so lints are still there', async ({
|
test('if you click the format button it formats your code and executes so lints are still there', async ({
|
||||||
@ -227,13 +233,15 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
|
|||||||
await u.expectCmdLog('[data-message-type="execution-done"]')
|
await u.expectCmdLog('[data-message-type="execution-done"]')
|
||||||
await u.closeDebugPanel()
|
await u.closeDebugPanel()
|
||||||
|
|
||||||
await expect(page.locator('.cm-content'))
|
await expect(page.locator('.cm-content')).toHaveText(
|
||||||
.toHaveText(`sketch_001 = startSketchOn(XY)
|
`@settings(defaultLengthUnit = in)
|
||||||
|
sketch_001 = startSketchOn(XY)
|
||||||
|> startProfileAt([-10, -10], %)
|
|> startProfileAt([-10, -10], %)
|
||||||
|> line(end = [20, 0])
|
|> line(end = [20, 0])
|
||||||
|> line(end = [0, 20])
|
|> line(end = [0, 20])
|
||||||
|> line(end = [-20, 0])
|
|> line(end = [-20, 0])
|
||||||
|> close()`)
|
|> close()`.replaceAll('\n', '')
|
||||||
|
)
|
||||||
|
|
||||||
// error in guter
|
// error in guter
|
||||||
await expect(page.locator('.cm-lint-marker-info').first()).toBeVisible()
|
await expect(page.locator('.cm-lint-marker-info').first()).toBeVisible()
|
||||||
@ -471,6 +479,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
|
|||||||
test('if you write kcl with lint errors you get lints', async ({
|
test('if you write kcl with lint errors you get lints', async ({
|
||||||
page,
|
page,
|
||||||
homePage,
|
homePage,
|
||||||
|
scene,
|
||||||
}) => {
|
}) => {
|
||||||
const u = await getUtils(page)
|
const u = await getUtils(page)
|
||||||
await page.setBodyDimensions({ width: 1000, height: 500 })
|
await page.setBodyDimensions({ width: 1000, height: 500 })
|
||||||
@ -490,10 +499,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
|
|||||||
await page.keyboard.press('ArrowLeft')
|
await page.keyboard.press('ArrowLeft')
|
||||||
await page.keyboard.press('ArrowRight')
|
await page.keyboard.press('ArrowRight')
|
||||||
|
|
||||||
// FIXME: lsp errors do not propagate to the frontend until engine is connected and code is executed
|
await scene.waitForExecutionDone()
|
||||||
// This timeout is to wait for engine connection. LSP and code execution errors should be handled differently
|
|
||||||
// LSP can emit errors as fast as it waits and show them in the editor
|
|
||||||
await page.waitForTimeout(10000)
|
|
||||||
|
|
||||||
// error in guter
|
// error in guter
|
||||||
await expect(page.locator('.cm-lint-marker-info').first()).toBeVisible()
|
await expect(page.locator('.cm-lint-marker-info').first()).toBeVisible()
|
||||||
@ -815,10 +821,12 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
|
|||||||
// there shouldn't be any auto complete options for 'lin' in the comment
|
// there shouldn't be any auto complete options for 'lin' in the comment
|
||||||
await expect(page.locator('.cm-completionLabel')).not.toBeVisible()
|
await expect(page.locator('.cm-completionLabel')).not.toBeVisible()
|
||||||
|
|
||||||
await expect(page.locator('.cm-content'))
|
await expect(page.locator('.cm-content')).toHaveText(
|
||||||
.toHaveText(`sketch001 = startSketchOn(XZ)
|
`@settings(defaultLengthUnit = in)
|
||||||
|
sketch001 = startSketchOn(XZ)
|
||||||
|> startProfileAt([3.14, 12], %)
|
|> startProfileAt([3.14, 12], %)
|
||||||
|> xLine(%, length = 5) // lin`)
|
|> xLine(%, length = 5) // lin`.replaceAll('\n', '')
|
||||||
|
)
|
||||||
|
|
||||||
// expect there to be no KCL errors
|
// expect there to be no KCL errors
|
||||||
await expect(page.locator('.cm-lint-marker-error')).toHaveCount(0)
|
await expect(page.locator('.cm-lint-marker-error')).toHaveCount(0)
|
||||||
@ -888,10 +896,12 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
|
|||||||
// there shouldn't be any auto complete options for 'lin' in the comment
|
// there shouldn't be any auto complete options for 'lin' in the comment
|
||||||
await expect(page.locator('.cm-completionLabel')).not.toBeVisible()
|
await expect(page.locator('.cm-completionLabel')).not.toBeVisible()
|
||||||
|
|
||||||
await expect(page.locator('.cm-content'))
|
await expect(page.locator('.cm-content')).toHaveText(
|
||||||
.toHaveText(`sketch001 = startSketchOn(XZ)
|
`@settings(defaultLengthUnit = in)
|
||||||
|
sketch001 = startSketchOn(XZ)
|
||||||
|> startProfileAt([3.14, 12], %)
|
|> startProfileAt([3.14, 12], %)
|
||||||
|> xLine(%, length = 5) // lin`)
|
|> xLine(%, length = 5) // lin`.replaceAll('\n', '')
|
||||||
|
)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
test('Can undo a click and point extrude with ctrl+z', async ({
|
test('Can undo a click and point extrude with ctrl+z', async ({
|
||||||
@ -1206,4 +1216,55 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
test('Rectangle tool panning with middle click', async ({
|
||||||
|
page,
|
||||||
|
homePage,
|
||||||
|
toolbar,
|
||||||
|
scene,
|
||||||
|
cmdBar,
|
||||||
|
editor,
|
||||||
|
}) => {
|
||||||
|
await page.setBodyDimensions({ width: 1200, height: 900 })
|
||||||
|
await homePage.goToModelingScene()
|
||||||
|
|
||||||
|
// wait until scene is ready to be interacted with
|
||||||
|
await scene.connectionEstablished()
|
||||||
|
await scene.settled(cmdBar)
|
||||||
|
|
||||||
|
await page.getByRole('button', { name: 'Start Sketch' }).click()
|
||||||
|
|
||||||
|
// select an axis plane
|
||||||
|
await page.mouse.click(700, 200)
|
||||||
|
|
||||||
|
// Needed as we don't yet have a way to get a signal from the engine that the camera has animated to the sketch plane
|
||||||
|
await page.waitForTimeout(1000)
|
||||||
|
|
||||||
|
const middleMousePan = async (
|
||||||
|
startX: number,
|
||||||
|
startY: number,
|
||||||
|
endX: number,
|
||||||
|
endY: number
|
||||||
|
) => {
|
||||||
|
const initialCode = await editor.getCurrentCode()
|
||||||
|
|
||||||
|
await page.mouse.click(startX, startY, { button: 'middle' })
|
||||||
|
await page.mouse.move(endX, endY, {
|
||||||
|
steps: 10,
|
||||||
|
})
|
||||||
|
|
||||||
|
// We expect the code to be the same, middle mouse click should not modify the code, only do panning
|
||||||
|
await editor.expectEditor.toBe(initialCode)
|
||||||
|
}
|
||||||
|
|
||||||
|
await test.step(`Verify corner rectangle panning`, async () => {
|
||||||
|
await page.getByTestId('corner-rectangle').click()
|
||||||
|
await middleMousePan(800, 500, 900, 600)
|
||||||
|
})
|
||||||
|
|
||||||
|
await test.step(`Verify center rectangle panning`, async () => {
|
||||||
|
await toolbar.selectCenterRectangle()
|
||||||
|
await middleMousePan(800, 200, 900, 300)
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
@ -81,6 +81,13 @@ export class EditorFixture {
|
|||||||
expectEditor = {
|
expectEditor = {
|
||||||
toContain: this._expectEditorToContain(),
|
toContain: this._expectEditorToContain(),
|
||||||
not: { toContain: this._expectEditorToContain(true) },
|
not: { toContain: this._expectEditorToContain(true) },
|
||||||
|
toBe: async (code: string) => {
|
||||||
|
const currentCode = await this.getCurrentCode()
|
||||||
|
return expect(currentCode).toBe(code)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
getCurrentCode = async () => {
|
||||||
|
return await this.codeContent.innerText()
|
||||||
}
|
}
|
||||||
snapshot = async (options?: { timeout?: number; name?: string }) => {
|
snapshot = async (options?: { timeout?: number; name?: string }) => {
|
||||||
const wasPaneOpen = await this.checkIfPaneIsOpen()
|
const wasPaneOpen = await this.checkIfPaneIsOpen()
|
||||||
|
@ -124,6 +124,7 @@ export class ElectronZoo {
|
|||||||
|
|
||||||
// We need to expose this in order for some tests that require folder
|
// We need to expose this in order for some tests that require folder
|
||||||
// creation and some code below.
|
// creation and some code below.
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
||||||
const that = this
|
const that = this
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
|
@ -310,7 +310,9 @@ export async function expectPixelColor(
|
|||||||
.toBeTruthy()
|
.toBeTruthy()
|
||||||
.catch((cause) => {
|
.catch((cause) => {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`ExpectPixelColor: expecting ${colour} got ${finalValue}`,
|
`ExpectPixelColor: point ${JSON.stringify(
|
||||||
|
coords
|
||||||
|
)} was expecting ${colour} but got ${finalValue}`,
|
||||||
{ cause }
|
{ cause }
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -272,14 +272,6 @@ export const isErrorWhitelisted = (exception: Error) => {
|
|||||||
project: 'Google Chrome',
|
project: 'Google Chrome',
|
||||||
foundInSpec: 'e2e/playwright/snapshot-tests.spec.ts',
|
foundInSpec: 'e2e/playwright/snapshot-tests.spec.ts',
|
||||||
},
|
},
|
||||||
// TODO: fix this error in the code
|
|
||||||
{
|
|
||||||
name: 'ReferenceError',
|
|
||||||
message: 'createNewVariableCheckbox is not defined',
|
|
||||||
stack: '',
|
|
||||||
project: 'Google Chrome',
|
|
||||||
foundInSpec: 'e2e/playwright/testing-constraints.spec.ts',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: 'Error',
|
name: 'Error',
|
||||||
message: 'The "path" argument must be of type string. Received undefined',
|
message: 'The "path" argument must be of type string. Received undefined',
|
||||||
|
@ -11,7 +11,7 @@ test(
|
|||||||
const bracketDir = join(dir, 'bracket')
|
const bracketDir = join(dir, 'bracket')
|
||||||
await fsp.mkdir(bracketDir, { recursive: true })
|
await fsp.mkdir(bracketDir, { recursive: true })
|
||||||
await fsp.copyFile(
|
await fsp.copyFile(
|
||||||
executorInputPath('focusrite_scarlett_mounting_braket.kcl'),
|
executorInputPath('cylinder-inches.kcl'),
|
||||||
join(bracketDir, 'main.kcl')
|
join(bracketDir, 'main.kcl')
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
@ -51,7 +51,7 @@ test(
|
|||||||
const bracketDir = join(dir, 'bracket')
|
const bracketDir = join(dir, 'bracket')
|
||||||
await fsp.mkdir(bracketDir, { recursive: true })
|
await fsp.mkdir(bracketDir, { recursive: true })
|
||||||
await fsp.copyFile(
|
await fsp.copyFile(
|
||||||
executorInputPath('focusrite_scarlett_mounting_braket.kcl'),
|
executorInputPath('cylinder-inches.kcl'),
|
||||||
join(bracketDir, 'main.kcl')
|
join(bracketDir, 'main.kcl')
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -137,7 +137,7 @@ test.describe('Point-and-click tests', () => {
|
|||||||
|
|
||||||
await scene.moveCameraTo(cameraPos, cameraTarget)
|
await scene.moveCameraTo(cameraPos, cameraTarget)
|
||||||
|
|
||||||
await test.step('check chamfer selection changes cursor positon', async () => {
|
await test.step('check chamfer selection changes cursor position', async () => {
|
||||||
await expect(async () => {
|
await expect(async () => {
|
||||||
// sometimes initial click doesn't register
|
// sometimes initial click doesn't register
|
||||||
await clickChamfer()
|
await clickChamfer()
|
||||||
@ -173,7 +173,7 @@ test.describe('Point-and-click tests', () => {
|
|||||||
})
|
})
|
||||||
await test.step('Check there is no errors after code created in previous steps executes', async () => {
|
await test.step('Check there is no errors after code created in previous steps executes', async () => {
|
||||||
await editor.expectState({
|
await editor.expectState({
|
||||||
activeLines: ['sketch001 = startSketchOn(XZ)'],
|
activeLines: ['@settings(defaultLengthUnit = in)'],
|
||||||
highlightedCode: '',
|
highlightedCode: '',
|
||||||
diagnostics: [],
|
diagnostics: [],
|
||||||
})
|
})
|
||||||
@ -299,7 +299,8 @@ test.describe('Point-and-click tests', () => {
|
|||||||
|
|
||||||
await test.step('verify at the end of the test that final code is what is expected', async () => {
|
await test.step('verify at the end of the test that final code is what is expected', async () => {
|
||||||
await editor.expectEditor.toContain(
|
await editor.expectEditor.toContain(
|
||||||
`sketch001 = startSketchOn(XZ)
|
`@settings(defaultLengthUnit = in)
|
||||||
|
sketch001 = startSketchOn(XZ)
|
||||||
|> startProfileAt([75.8, 317.2], %) // [$startCapTag, $EndCapTag]
|
|> startProfileAt([75.8, 317.2], %) // [$startCapTag, $EndCapTag]
|
||||||
|> angledLine([0, 268.43], %, $rectangleSegmentA001)
|
|> angledLine([0, 268.43], %, $rectangleSegmentA001)
|
||||||
|> angledLine([
|
|> angledLine([
|
||||||
@ -369,7 +370,7 @@ profile001 = startProfileAt([205.96, 254.59], sketch002)
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
test('Works on chamfers that are non in a pipeExpression can break up multi edges in a chamfer array', async ({
|
test('Works on chamfers that are not in a pipeExpression can break up multi edges in a chamfer array', async ({
|
||||||
context,
|
context,
|
||||||
page,
|
page,
|
||||||
homePage,
|
homePage,
|
||||||
@ -418,7 +419,8 @@ profile001 = startProfileAt([205.96, 254.59], sketch002)
|
|||||||
|>close()`,
|
|>close()`,
|
||||||
})
|
})
|
||||||
await editor.expectEditor.toContain(
|
await editor.expectEditor.toContain(
|
||||||
`sketch001 = startSketchOn(XZ)
|
`@settings(defaultLengthUnit = in)
|
||||||
|
sketch001 = startSketchOn(XZ)
|
||||||
|> startProfileAt([75.8, 317.2], %)
|
|> startProfileAt([75.8, 317.2], %)
|
||||||
|> angledLine([0, 268.43], %, $rectangleSegmentA001)
|
|> angledLine([0, 268.43], %, $rectangleSegmentA001)
|
||||||
|> angledLine([
|
|> angledLine([
|
||||||
@ -1639,9 +1641,10 @@ loft001 = loft([sketch001, sketch002])
|
|||||||
{
|
{
|
||||||
targetType: 'circle',
|
targetType: 'circle',
|
||||||
testPoint: { x: 700, y: 250 },
|
testPoint: { x: 700, y: 250 },
|
||||||
initialCode: `sketch001 = startSketchOn('YZ')
|
initialCode: `@settings(defaultLengthUnit = in)
|
||||||
|
sketch001 = startSketchOn(YZ)
|
||||||
profile001 = circle(sketch001, center = [0, 0], radius = 500)
|
profile001 = circle(sketch001, center = [0, 0], radius = 500)
|
||||||
sketch002 = startSketchOn('XZ')
|
sketch002 = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> xLine(length = -500)
|
|> xLine(length = -500)
|
||||||
|> tangentialArcTo([-2000, 500], %)`,
|
|> tangentialArcTo([-2000, 500], %)`,
|
||||||
@ -1649,7 +1652,8 @@ sketch002 = startSketchOn('XZ')
|
|||||||
{
|
{
|
||||||
targetType: 'rectangle',
|
targetType: 'rectangle',
|
||||||
testPoint: { x: 710, y: 255 },
|
testPoint: { x: 710, y: 255 },
|
||||||
initialCode: `sketch001 = startSketchOn('YZ')
|
initialCode: `@settings(defaultLengthUnit = in)
|
||||||
|
sketch001 = startSketchOn(YZ)
|
||||||
profile001 = startProfileAt([-400, -400], sketch001)
|
profile001 = startProfileAt([-400, -400], sketch001)
|
||||||
|> angledLine([0, 800], %, $rectangleSegmentA001)
|
|> angledLine([0, 800], %, $rectangleSegmentA001)
|
||||||
|> angledLine([
|
|> angledLine([
|
||||||
@ -1662,7 +1666,7 @@ profile001 = startProfileAt([-400, -400], sketch001)
|
|||||||
], %)
|
], %)
|
||||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||||
|> close()
|
|> close()
|
||||||
sketch002 = startSketchOn('XZ')
|
sketch002 = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> xLine(length = -500)
|
|> xLine(length = -500)
|
||||||
|> tangentialArcTo([-2000, 500], %)`,
|
|> tangentialArcTo([-2000, 500], %)`,
|
||||||
@ -1806,7 +1810,8 @@ sketch002 = startSketchOn('XZ')
|
|||||||
toolbar,
|
toolbar,
|
||||||
cmdBar,
|
cmdBar,
|
||||||
}) => {
|
}) => {
|
||||||
const initialCode = `sketch001 = startSketchOn(YZ)
|
const initialCode = `@settings(defaultLengthUnit = in)
|
||||||
|
sketch001 = startSketchOn(YZ)
|
||||||
|> circle(
|
|> circle(
|
||||||
center = [0, 0],
|
center = [0, 0],
|
||||||
radius = 500
|
radius = 500
|
||||||
@ -2475,7 +2480,8 @@ extrude001 = extrude(profile001, length = 5)
|
|||||||
cmdBar,
|
cmdBar,
|
||||||
}) => {
|
}) => {
|
||||||
// Code samples
|
// Code samples
|
||||||
const initialCode = `sketch001 = startSketchOn(XY)
|
const initialCode = `@settings(defaultLengthUnit = in)
|
||||||
|
sketch001 = startSketchOn(XY)
|
||||||
|> startProfileAt([-12, -6], %)
|
|> startProfileAt([-12, -6], %)
|
||||||
|> line(end = [0, 12])
|
|> line(end = [0, 12])
|
||||||
|> line(end = [24, 0])
|
|> line(end = [24, 0])
|
||||||
@ -2767,7 +2773,8 @@ extrude001 = extrude(sketch001, length = -12)
|
|||||||
toolbar,
|
toolbar,
|
||||||
}) => {
|
}) => {
|
||||||
// Code samples
|
// Code samples
|
||||||
const initialCode = `sketch001 = startSketchOn(XY)
|
const initialCode = `@settings(defaultLengthUnit = in)
|
||||||
|
sketch001 = startSketchOn(XY)
|
||||||
|> startProfileAt([-12, -6], %)
|
|> startProfileAt([-12, -6], %)
|
||||||
|> line(end = [0, 12])
|
|> line(end = [0, 12])
|
||||||
|> line(end = [24, 0], tag = $seg02)
|
|> line(end = [24, 0], tag = $seg02)
|
||||||
@ -2921,7 +2928,8 @@ chamfer04 = chamfer(extrude001, length = 5, tags = [getOppositeEdge(seg02)])
|
|||||||
toolbar,
|
toolbar,
|
||||||
cmdBar,
|
cmdBar,
|
||||||
}) => {
|
}) => {
|
||||||
const initialCode = `sketch001 = startSketchOn(XZ)
|
const initialCode = `@settings(defaultLengthUnit = in)
|
||||||
|
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)
|
||||||
`
|
`
|
||||||
@ -3056,7 +3064,8 @@ extrude001 = extrude(sketch001, length = 30)
|
|||||||
toolbar,
|
toolbar,
|
||||||
cmdBar,
|
cmdBar,
|
||||||
}) => {
|
}) => {
|
||||||
const initialCode = `sketch001 = startSketchOn(XY)
|
const initialCode = `@settings(defaultLengthUnit = in)
|
||||||
|
sketch001 = startSketchOn(XY)
|
||||||
|> startProfileAt([-20, 20], %)
|
|> startProfileAt([-20, 20], %)
|
||||||
|> xLine(length = 40)
|
|> xLine(length = 40)
|
||||||
|> yLine(length = -60)
|
|> yLine(length = -60)
|
||||||
@ -3174,7 +3183,8 @@ extrude001 = extrude(sketch001, length = 40)
|
|||||||
})
|
})
|
||||||
|
|
||||||
const shellSketchOnFacesCases = [
|
const shellSketchOnFacesCases = [
|
||||||
`sketch001 = startSketchOn(XZ)
|
`@settings(defaultLengthUnit = in)
|
||||||
|
sketch001 = startSketchOn(XZ)
|
||||||
|> circle(center = [0, 0], radius = 100)
|
|> circle(center = [0, 0], radius = 100)
|
||||||
|> extrude(length = 100)
|
|> extrude(length = 100)
|
||||||
|
|
||||||
@ -3182,7 +3192,8 @@ sketch002 = startSketchOn(sketch001, 'END')
|
|||||||
|> circle(center = [0, 0], radius = 50)
|
|> circle(center = [0, 0], radius = 50)
|
||||||
|> extrude(length = 50)
|
|> extrude(length = 50)
|
||||||
`,
|
`,
|
||||||
`sketch001 = startSketchOn(XZ)
|
`@settings(defaultLengthUnit = in)
|
||||||
|
sketch001 = startSketchOn(XZ)
|
||||||
|> circle(center = [0, 0], radius = 100)
|
|> circle(center = [0, 0], radius = 100)
|
||||||
extrude001 = extrude(sketch001, length = 100)
|
extrude001 = extrude(sketch001, length = 100)
|
||||||
|
|
||||||
@ -3465,6 +3476,39 @@ segAng(rectangleSegmentA002),
|
|||||||
|
|
||||||
const newCodeToFind = `revolve001 = revolve(sketch002, angle = 360, axis = 'X')`
|
const newCodeToFind = `revolve001 = revolve(sketch002, angle = 360, axis = 'X')`
|
||||||
expect(editor.expectEditor.toContain(newCodeToFind)).toBeTruthy()
|
expect(editor.expectEditor.toContain(newCodeToFind)).toBeTruthy()
|
||||||
|
|
||||||
|
// Edit flow
|
||||||
|
const newAngle = '90'
|
||||||
|
await toolbar.openPane('feature-tree')
|
||||||
|
const operationButton = await toolbar.getFeatureTreeOperation(
|
||||||
|
'Revolve',
|
||||||
|
0
|
||||||
|
)
|
||||||
|
await operationButton.dblclick({ button: 'left' })
|
||||||
|
await cmdBar.expectState({
|
||||||
|
commandName: 'Revolve',
|
||||||
|
currentArgKey: 'angle',
|
||||||
|
currentArgValue: '360',
|
||||||
|
headerArguments: {
|
||||||
|
Angle: '360',
|
||||||
|
},
|
||||||
|
highlightedHeaderArg: 'angle',
|
||||||
|
stage: 'arguments',
|
||||||
|
})
|
||||||
|
await page.keyboard.insertText(newAngle)
|
||||||
|
await cmdBar.progressCmdBar()
|
||||||
|
await cmdBar.expectState({
|
||||||
|
stage: 'review',
|
||||||
|
headerArguments: {
|
||||||
|
Angle: newAngle,
|
||||||
|
},
|
||||||
|
commandName: 'Revolve',
|
||||||
|
})
|
||||||
|
await cmdBar.progressCmdBar()
|
||||||
|
await toolbar.closePane('feature-tree')
|
||||||
|
await editor.expectEditor.toContain(
|
||||||
|
newCodeToFind.replace('angle = 360', 'angle = ' + newAngle)
|
||||||
|
)
|
||||||
})
|
})
|
||||||
test('revolve surface around edge from an extruded solid2d', async ({
|
test('revolve surface around edge from an extruded solid2d', async ({
|
||||||
context,
|
context,
|
||||||
@ -3475,26 +3519,22 @@ segAng(rectangleSegmentA002),
|
|||||||
toolbar,
|
toolbar,
|
||||||
cmdBar,
|
cmdBar,
|
||||||
}) => {
|
}) => {
|
||||||
const initialCode = `
|
const initialCode = `sketch001 = startSketchOn(XZ)
|
||||||
sketch001 = startSketchOn(XZ)
|
|> startProfileAt([-102.57, 101.72], %)
|
||||||
|> startProfileAt([-102.57, 101.72], %)
|
|> angledLine([0, 202.6], %, $rectangleSegmentA001)
|
||||||
|> angledLine([0, 202.6], %, $rectangleSegmentA001)
|
|> angledLine([
|
||||||
|> angledLine([
|
segAng(rectangleSegmentA001) - 90,
|
||||||
segAng(rectangleSegmentA001) - 90,
|
202.6
|
||||||
202.6
|
], %, $rectangleSegmentB001)
|
||||||
], %, $rectangleSegmentB001)
|
|> angledLine([
|
||||||
|> angledLine([
|
segAng(rectangleSegmentA001),
|
||||||
segAng(rectangleSegmentA001),
|
-segLen(rectangleSegmentA001)
|
||||||
-segLen(rectangleSegmentA001)
|
], %, $rectangleSegmentC001)
|
||||||
], %, $rectangleSegmentC001)
|
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
|> close()
|
||||||
|> close()
|
|
||||||
extrude001 = extrude(sketch001, length = 50)
|
extrude001 = extrude(sketch001, length = 50)
|
||||||
sketch002 = startSketchOn(extrude001, rectangleSegmentA001)
|
sketch002 = startSketchOn(extrude001, rectangleSegmentA001)
|
||||||
|> circle(
|
|> circle(center = [-11.34, 10.0], radius = 8.69)
|
||||||
center = [-11.34, 10.0],
|
|
||||||
radius = 8.69
|
|
||||||
)
|
|
||||||
`
|
`
|
||||||
await context.addInitScript((initialCode) => {
|
await context.addInitScript((initialCode) => {
|
||||||
localStorage.setItem('persistCode', initialCode)
|
localStorage.setItem('persistCode', initialCode)
|
||||||
@ -3512,9 +3552,49 @@ radius = 8.69
|
|||||||
const lineCodeToSelection = `|> angledLine([0, 202.6], %, $rectangleSegmentA001)`
|
const lineCodeToSelection = `|> angledLine([0, 202.6], %, $rectangleSegmentA001)`
|
||||||
await page.getByText(lineCodeToSelection).click()
|
await page.getByText(lineCodeToSelection).click()
|
||||||
await cmdBar.progressCmdBar()
|
await cmdBar.progressCmdBar()
|
||||||
|
await cmdBar.progressCmdBar()
|
||||||
|
await cmdBar.progressCmdBar()
|
||||||
|
|
||||||
const newCodeToFind = `revolve001 = revolve(sketch002, angle = 360, axis = getOppositeEdge(rectangleSegmentA001)) `
|
const newCodeToFind = `revolve001 = revolve(sketch002, angle = 360, axis = rectangleSegmentA001)`
|
||||||
expect(editor.expectEditor.toContain(newCodeToFind)).toBeTruthy()
|
await editor.expectEditor.toContain(newCodeToFind)
|
||||||
|
|
||||||
|
// Edit flow
|
||||||
|
const newAngle = '180'
|
||||||
|
await toolbar.openPane('feature-tree')
|
||||||
|
const operationButton = await toolbar.getFeatureTreeOperation(
|
||||||
|
'Revolve',
|
||||||
|
0
|
||||||
|
)
|
||||||
|
await operationButton.dblclick({ button: 'left' })
|
||||||
|
await cmdBar.expectState({
|
||||||
|
commandName: 'Revolve',
|
||||||
|
currentArgKey: 'angle',
|
||||||
|
currentArgValue: '360',
|
||||||
|
headerArguments: {
|
||||||
|
Angle: '360',
|
||||||
|
},
|
||||||
|
highlightedHeaderArg: 'angle',
|
||||||
|
stage: 'arguments',
|
||||||
|
})
|
||||||
|
await page.keyboard.insertText(newAngle)
|
||||||
|
await page.getByRole('button', { name: 'Create new variable' }).click()
|
||||||
|
await expect(page.getByPlaceholder('Variable name')).toHaveValue(
|
||||||
|
'angle001'
|
||||||
|
)
|
||||||
|
await cmdBar.progressCmdBar()
|
||||||
|
await cmdBar.expectState({
|
||||||
|
stage: 'review',
|
||||||
|
headerArguments: {
|
||||||
|
Angle: newAngle,
|
||||||
|
},
|
||||||
|
commandName: 'Revolve',
|
||||||
|
})
|
||||||
|
await cmdBar.progressCmdBar()
|
||||||
|
await toolbar.closePane('feature-tree')
|
||||||
|
await editor.expectEditor.toContain('angle001 = ' + newAngle)
|
||||||
|
await editor.expectEditor.toContain(
|
||||||
|
newCodeToFind.replace('angle = 360', 'angle = angle001')
|
||||||
|
)
|
||||||
})
|
})
|
||||||
test('revolve sketch circle around line segment from startProfileAt sketch', async ({
|
test('revolve sketch circle around line segment from startProfileAt sketch', async ({
|
||||||
context,
|
context,
|
||||||
@ -3525,11 +3605,10 @@ radius = 8.69
|
|||||||
toolbar,
|
toolbar,
|
||||||
cmdBar,
|
cmdBar,
|
||||||
}) => {
|
}) => {
|
||||||
const initialCode = `
|
const initialCode = `sketch002 = startSketchOn(XY)
|
||||||
sketch002 = startSketchOn(XY)
|
|
||||||
|> startProfileAt([-2.02, 1.79], %)
|
|> startProfileAt([-2.02, 1.79], %)
|
||||||
|> xLine(length = 2.6)
|
|> xLine(length = 2.6)
|
||||||
sketch001 = startSketchOn('-XY')
|
sketch001 = startSketchOn(-XY)
|
||||||
|> startProfileAt([-0.48, 1.25], %)
|
|> startProfileAt([-0.48, 1.25], %)
|
||||||
|> angledLine([0, 2.38], %, $rectangleSegmentA001)
|
|> angledLine([0, 2.38], %, $rectangleSegmentA001)
|
||||||
|> angledLine([segAng(rectangleSegmentA001) - 90, 2.4], %, $rectangleSegmentB001)
|
|> angledLine([segAng(rectangleSegmentA001) - 90, 2.4], %, $rectangleSegmentB001)
|
||||||
@ -3539,12 +3618,9 @@ radius = 8.69
|
|||||||
], %, $rectangleSegmentC001)
|
], %, $rectangleSegmentC001)
|
||||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||||
|> close()
|
|> close()
|
||||||
extrude001 = extrude(sketch001, length = 5)
|
extrude001 = extrude(sketch001, length = 5)
|
||||||
sketch003 = startSketchOn(extrude001, 'START')
|
sketch003 = startSketchOn(extrude001, 'START')
|
||||||
|> circle(
|
|> circle(center = [-0.69, 0.56], radius = 0.28)
|
||||||
center = [-0.69, 0.56],
|
|
||||||
radius = 0.28
|
|
||||||
)
|
|
||||||
`
|
`
|
||||||
|
|
||||||
await context.addInitScript((initialCode) => {
|
await context.addInitScript((initialCode) => {
|
||||||
@ -3563,9 +3639,44 @@ radius = 8.69
|
|||||||
const lineCodeToSelection = `|> xLine(length = 2.6)`
|
const lineCodeToSelection = `|> xLine(length = 2.6)`
|
||||||
await page.getByText(lineCodeToSelection).click()
|
await page.getByText(lineCodeToSelection).click()
|
||||||
await cmdBar.progressCmdBar()
|
await cmdBar.progressCmdBar()
|
||||||
|
await cmdBar.progressCmdBar()
|
||||||
|
await cmdBar.progressCmdBar()
|
||||||
|
|
||||||
const newCodeToFind = `revolve001 = revolve(sketch003, angle = 360, axis = seg01)`
|
const newCodeToFind = `revolve001 = revolve(sketch003, angle = 360, axis = seg01)`
|
||||||
expect(editor.expectEditor.toContain(newCodeToFind)).toBeTruthy()
|
expect(editor.expectEditor.toContain(newCodeToFind)).toBeTruthy()
|
||||||
|
|
||||||
|
// Edit flow
|
||||||
|
const newAngle = '270'
|
||||||
|
await toolbar.openPane('feature-tree')
|
||||||
|
const operationButton = await toolbar.getFeatureTreeOperation(
|
||||||
|
'Revolve',
|
||||||
|
0
|
||||||
|
)
|
||||||
|
await operationButton.dblclick({ button: 'left' })
|
||||||
|
await cmdBar.expectState({
|
||||||
|
commandName: 'Revolve',
|
||||||
|
currentArgKey: 'angle',
|
||||||
|
currentArgValue: '360',
|
||||||
|
headerArguments: {
|
||||||
|
Angle: '360',
|
||||||
|
},
|
||||||
|
highlightedHeaderArg: 'angle',
|
||||||
|
stage: 'arguments',
|
||||||
|
})
|
||||||
|
await page.keyboard.insertText(newAngle)
|
||||||
|
await cmdBar.progressCmdBar()
|
||||||
|
await cmdBar.expectState({
|
||||||
|
stage: 'review',
|
||||||
|
headerArguments: {
|
||||||
|
Angle: newAngle,
|
||||||
|
},
|
||||||
|
commandName: 'Revolve',
|
||||||
|
})
|
||||||
|
await cmdBar.progressCmdBar()
|
||||||
|
await toolbar.closePane('feature-tree')
|
||||||
|
await editor.expectEditor.toContain(
|
||||||
|
newCodeToFind.replace('angle = 360', 'angle = ' + newAngle)
|
||||||
|
)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -3578,7 +3689,8 @@ radius = 8.69
|
|||||||
toolbar,
|
toolbar,
|
||||||
cmdBar,
|
cmdBar,
|
||||||
}) => {
|
}) => {
|
||||||
const initialCode = `sketch001 = startSketchOn(XZ)
|
const initialCode = `@settings(defaultLengthUnit = in)
|
||||||
|
sketch001 = startSketchOn(XZ)
|
||||||
profile001 = circle(
|
profile001 = circle(
|
||||||
sketch001,
|
sketch001,
|
||||||
center = [0, 0],
|
center = [0, 0],
|
||||||
|
@ -87,7 +87,7 @@ test(
|
|||||||
const bracketDir = path.join(dir, 'bracket')
|
const bracketDir = path.join(dir, 'bracket')
|
||||||
await fsp.mkdir(bracketDir, { recursive: true })
|
await fsp.mkdir(bracketDir, { recursive: true })
|
||||||
await fsp.copyFile(
|
await fsp.copyFile(
|
||||||
executorInputPath('focusrite_scarlett_mounting_braket.kcl'),
|
executorInputPath('cylinder-inches.kcl'),
|
||||||
path.join(bracketDir, 'main.kcl')
|
path.join(bracketDir, 'main.kcl')
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
@ -124,7 +124,7 @@ test(
|
|||||||
const bracketDir = path.join(dir, 'bracket')
|
const bracketDir = path.join(dir, 'bracket')
|
||||||
await fsp.mkdir(bracketDir, { recursive: true })
|
await fsp.mkdir(bracketDir, { recursive: true })
|
||||||
await fsp.copyFile(
|
await fsp.copyFile(
|
||||||
executorInputPath('focusrite_scarlett_mounting_braket.kcl'),
|
executorInputPath('cylinder-inches.kcl'),
|
||||||
path.join(bracketDir, 'main.kcl')
|
path.join(bracketDir, 'main.kcl')
|
||||||
)
|
)
|
||||||
const errorDir = path.join(dir, 'broken-code')
|
const errorDir = path.join(dir, 'broken-code')
|
||||||
@ -162,7 +162,7 @@ test(
|
|||||||
// gray at this pixel means the stream has loaded in the most
|
// gray at this pixel means the stream has loaded in the most
|
||||||
// user way we can verify it (pixel color)
|
// user way we can verify it (pixel color)
|
||||||
await expect
|
await expect
|
||||||
.poll(() => u.getGreatestPixDiff(pointOnModel, [85, 85, 85]), {
|
.poll(() => u.getGreatestPixDiff(pointOnModel, [110, 110, 110]), {
|
||||||
timeout: 10_000,
|
timeout: 10_000,
|
||||||
})
|
})
|
||||||
.toBeLessThan(20)
|
.toBeLessThan(20)
|
||||||
@ -213,7 +213,7 @@ test(
|
|||||||
const bracketDir = path.join(dir, 'bracket')
|
const bracketDir = path.join(dir, 'bracket')
|
||||||
await fsp.mkdir(bracketDir, { recursive: true })
|
await fsp.mkdir(bracketDir, { recursive: true })
|
||||||
await fsp.copyFile(
|
await fsp.copyFile(
|
||||||
executorInputPath('focusrite_scarlett_mounting_braket.kcl'),
|
executorInputPath('cylinder-inches.kcl'),
|
||||||
path.join(bracketDir, 'main.kcl')
|
path.join(bracketDir, 'main.kcl')
|
||||||
)
|
)
|
||||||
const emptyDir = path.join(dir, 'empty')
|
const emptyDir = path.join(dir, 'empty')
|
||||||
@ -248,7 +248,7 @@ test(
|
|||||||
// gray at this pixel means the stream has loaded in the most
|
// gray at this pixel means the stream has loaded in the most
|
||||||
// user way we can verify it (pixel color)
|
// user way we can verify it (pixel color)
|
||||||
await expect
|
await expect
|
||||||
.poll(() => u.getGreatestPixDiff(pointOnModel, [85, 85, 85]), {
|
.poll(() => u.getGreatestPixDiff(pointOnModel, [125, 125, 125]), {
|
||||||
timeout: 10_000,
|
timeout: 10_000,
|
||||||
})
|
})
|
||||||
.toBeLessThan(15)
|
.toBeLessThan(15)
|
||||||
@ -290,7 +290,7 @@ test(
|
|||||||
const bracketDir = path.join(dir, 'bracket')
|
const bracketDir = path.join(dir, 'bracket')
|
||||||
await fsp.mkdir(bracketDir, { recursive: true })
|
await fsp.mkdir(bracketDir, { recursive: true })
|
||||||
await fsp.copyFile(
|
await fsp.copyFile(
|
||||||
executorInputPath('focusrite_scarlett_mounting_braket.kcl'),
|
executorInputPath('cylinder-inches.kcl'),
|
||||||
path.join(bracketDir, 'main.kcl')
|
path.join(bracketDir, 'main.kcl')
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -319,7 +319,7 @@ test(
|
|||||||
// gray at this pixel means the stream has loaded in the most
|
// gray at this pixel means the stream has loaded in the most
|
||||||
// user way we can verify it (pixel color)
|
// user way we can verify it (pixel color)
|
||||||
await expect
|
await expect
|
||||||
.poll(() => u.getGreatestPixDiff(pointOnModel, [85, 85, 85]), {
|
.poll(() => u.getGreatestPixDiff(pointOnModel, [125, 125, 125]), {
|
||||||
timeout: 10_000,
|
timeout: 10_000,
|
||||||
})
|
})
|
||||||
.toBeLessThan(15)
|
.toBeLessThan(15)
|
||||||
@ -359,7 +359,7 @@ test(
|
|||||||
const bracketDir = path.join(dir, 'bracket')
|
const bracketDir = path.join(dir, 'bracket')
|
||||||
await fsp.mkdir(bracketDir, { recursive: true })
|
await fsp.mkdir(bracketDir, { recursive: true })
|
||||||
await fsp.copyFile(
|
await fsp.copyFile(
|
||||||
executorInputPath('focusrite_scarlett_mounting_braket.kcl'),
|
executorInputPath('cylinder-inches.kcl'),
|
||||||
path.join(bracketDir, 'main.kcl')
|
path.join(bracketDir, 'main.kcl')
|
||||||
)
|
)
|
||||||
await fsp.copyFile(
|
await fsp.copyFile(
|
||||||
@ -393,7 +393,7 @@ test(
|
|||||||
// gray at this pixel means the stream has loaded in the most
|
// gray at this pixel means the stream has loaded in the most
|
||||||
// user way we can verify it (pixel color)
|
// user way we can verify it (pixel color)
|
||||||
await expect
|
await expect
|
||||||
.poll(() => u.getGreatestPixDiff(pointOnModel, [85, 85, 85]), {
|
.poll(() => u.getGreatestPixDiff(pointOnModel, [125, 125, 125]), {
|
||||||
timeout: 10_000,
|
timeout: 10_000,
|
||||||
})
|
})
|
||||||
.toBeLessThan(15)
|
.toBeLessThan(15)
|
||||||
@ -443,7 +443,6 @@ test(
|
|||||||
await page.getByText('broken-code').click()
|
await page.getByText('broken-code').click()
|
||||||
|
|
||||||
// Gotcha: You can not use scene.waitForExecutionDone() since the KCL code is going to fail
|
// Gotcha: You can not use scene.waitForExecutionDone() since the KCL code is going to fail
|
||||||
await expect(page.getByTestId('loading')).toBeAttached()
|
|
||||||
await expect(page.getByTestId('loading')).not.toBeAttached({
|
await expect(page.getByTestId('loading')).not.toBeAttached({
|
||||||
timeout: 20_000,
|
timeout: 20_000,
|
||||||
})
|
})
|
||||||
@ -481,7 +480,7 @@ test.describe('Can export from electron app', () => {
|
|||||||
const bracketDir = path.join(dir, 'bracket')
|
const bracketDir = path.join(dir, 'bracket')
|
||||||
await fsp.mkdir(bracketDir, { recursive: true })
|
await fsp.mkdir(bracketDir, { recursive: true })
|
||||||
await fsp.copyFile(
|
await fsp.copyFile(
|
||||||
executorInputPath('focusrite_scarlett_mounting_braket.kcl'),
|
executorInputPath('cylinder-inches.kcl'),
|
||||||
path.join(bracketDir, 'main.kcl')
|
path.join(bracketDir, 'main.kcl')
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
@ -513,7 +512,7 @@ test.describe('Can export from electron app', () => {
|
|||||||
// gray at this pixel means the stream has loaded in the most
|
// gray at this pixel means the stream has loaded in the most
|
||||||
// user way we can verify it (pixel color)
|
// user way we can verify it (pixel color)
|
||||||
await expect
|
await expect
|
||||||
.poll(() => u.getGreatestPixDiff(pointOnModel, [85, 85, 85]), {
|
.poll(() => u.getGreatestPixDiff(pointOnModel, [125, 125, 125]), {
|
||||||
timeout: 10_000,
|
timeout: 10_000,
|
||||||
})
|
})
|
||||||
.toBeLessThan(15)
|
.toBeLessThan(15)
|
||||||
@ -554,7 +553,7 @@ test.describe('Can export from electron app', () => {
|
|||||||
},
|
},
|
||||||
{ timeout: 15_000 }
|
{ timeout: 15_000 }
|
||||||
)
|
)
|
||||||
.toBeGreaterThan(300_000)
|
.toBeGreaterThan(50_000)
|
||||||
|
|
||||||
// clean up exported file
|
// clean up exported file
|
||||||
await fsp.rm(filepath)
|
await fsp.rm(filepath)
|
||||||
@ -1507,7 +1506,12 @@ test(
|
|||||||
|
|
||||||
await u.waitForPageLoad()
|
await u.waitForPageLoad()
|
||||||
|
|
||||||
await page.locator('.cm-content').fill(`sketch001 = startSketchOn(XZ)
|
// The file should be prepopulated with the user's unit settings.
|
||||||
|
await expect(page.locator('.cm-content')).toHaveText(
|
||||||
|
'@settings(defaultLengthUnit = in)'
|
||||||
|
)
|
||||||
|
|
||||||
|
await page.locator('.cm-content').fill(`sketch001 = startSketchOn('XZ')
|
||||||
|> startProfileAt([-87.4, 282.92], %)
|
|> startProfileAt([-87.4, 282.92], %)
|
||||||
|> line(end = [324.07, 27.199], tag = $seg01)
|
|> line(end = [324.07, 27.199], tag = $seg01)
|
||||||
|> line(end = [118.328, -291.754])
|
|> line(end = [118.328, -291.754])
|
||||||
|
@ -4,9 +4,9 @@ import path from 'path'
|
|||||||
import * as fsp from 'fs/promises'
|
import * as fsp from 'fs/promises'
|
||||||
import {
|
import {
|
||||||
getUtils,
|
getUtils,
|
||||||
executorInputPath,
|
|
||||||
TEST_COLORS,
|
TEST_COLORS,
|
||||||
TestColor,
|
TestColor,
|
||||||
|
executorInputPath,
|
||||||
orRunWhenFullSuiteEnabled,
|
orRunWhenFullSuiteEnabled,
|
||||||
} from './test-utils'
|
} from './test-utils'
|
||||||
import { TEST_CODE_TRIGGER_ENGINE_EXPORT_ERROR } from './storageStates'
|
import { TEST_CODE_TRIGGER_ENGINE_EXPORT_ERROR } from './storageStates'
|
||||||
@ -331,7 +331,7 @@ extrude001 = extrude(sketch001, length = 50)
|
|||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'persistCode',
|
'persistCode',
|
||||||
`@settings(defaultLengthUnit = mm)
|
`@settings(defaultLengthUnit = mm)
|
||||||
sketch002 = startSketchOn('XY')
|
sketch002 = startSketchOn(XY)
|
||||||
profile002 = startProfileAt([72.24, -52.05], sketch002)
|
profile002 = startProfileAt([72.24, -52.05], sketch002)
|
||||||
|> angledLine([0, 181.26], %, $rectangleSegmentA001)
|
|> angledLine([0, 181.26], %, $rectangleSegmentA001)
|
||||||
|> angledLine([
|
|> angledLine([
|
||||||
@ -582,7 +582,7 @@ extrude002 = extrude(profile002, length = 150)
|
|||||||
const bracketDir = path.join(dir, 'bracket')
|
const bracketDir = path.join(dir, 'bracket')
|
||||||
await fsp.mkdir(bracketDir, { recursive: true })
|
await fsp.mkdir(bracketDir, { recursive: true })
|
||||||
await fsp.copyFile(
|
await fsp.copyFile(
|
||||||
executorInputPath('focusrite_scarlett_mounting_braket.kcl'),
|
executorInputPath('cylinder-inches.kcl'),
|
||||||
path.join(bracketDir, 'main.kcl')
|
path.join(bracketDir, 'main.kcl')
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
@ -619,6 +619,7 @@ extrude002 = extrude(profile002, length = 150)
|
|||||||
test(`View gizmo stays visible even when zoomed out all the way`, async ({
|
test(`View gizmo stays visible even when zoomed out all the way`, async ({
|
||||||
page,
|
page,
|
||||||
homePage,
|
homePage,
|
||||||
|
scene,
|
||||||
}) => {
|
}) => {
|
||||||
const u = await getUtils(page)
|
const u = await getUtils(page)
|
||||||
|
|
||||||
@ -632,7 +633,7 @@ extrude002 = extrude(profile002, length = 150)
|
|||||||
|
|
||||||
await test.step(`Load an empty file`, async () => {
|
await test.step(`Load an empty file`, async () => {
|
||||||
await page.addInitScript(async () => {
|
await page.addInitScript(async () => {
|
||||||
localStorage.setItem('persistCode', '')
|
localStorage.setItem('persistCode', '@settings(defaultLengthUnit = in)')
|
||||||
})
|
})
|
||||||
await page.setBodyDimensions({ width: 1200, height: 500 })
|
await page.setBodyDimensions({ width: 1200, height: 500 })
|
||||||
await homePage.goToModelingScene()
|
await homePage.goToModelingScene()
|
||||||
@ -646,22 +647,31 @@ extrude002 = extrude(profile002, length = 150)
|
|||||||
timeout: 5000,
|
timeout: 5000,
|
||||||
message: 'Plane color is visible',
|
message: 'Plane color is visible',
|
||||||
})
|
})
|
||||||
.toBeLessThanOrEqual(15)
|
.toBeLessThanOrEqual(20)
|
||||||
|
await expect(scene.startEditSketchBtn).toBeEnabled()
|
||||||
|
|
||||||
let maxZoomOuts = 10
|
let maxZoomOuts = 10
|
||||||
let middlePixelIsBackgroundColor =
|
let middlePixelIsBackgroundColor =
|
||||||
(await middlePixelIsColor(bgColor)) < 10
|
(await middlePixelIsColor(bgColor)) < 10
|
||||||
while (!middlePixelIsBackgroundColor && maxZoomOuts > 0) {
|
|
||||||
|
console.time('pressing control')
|
||||||
await page.keyboard.down('Control')
|
await page.keyboard.down('Control')
|
||||||
await page.mouse.move(600, 460)
|
|
||||||
await page.mouse.down({ button: 'right' })
|
while (!middlePixelIsBackgroundColor && maxZoomOuts > 0) {
|
||||||
await page.mouse.move(600, 50, { steps: 20 })
|
|
||||||
await page.mouse.up({ button: 'right' })
|
|
||||||
await page.keyboard.up('Control')
|
|
||||||
await page.waitForTimeout(100)
|
await page.waitForTimeout(100)
|
||||||
|
await page.mouse.move(650, 460)
|
||||||
|
console.time('moved to start point')
|
||||||
|
await page.mouse.down({ button: 'right' })
|
||||||
|
console.time('moused down')
|
||||||
|
await page.mouse.move(650, 50, { steps: 20 })
|
||||||
|
console.time('moved to end point')
|
||||||
|
await page.waitForTimeout(100)
|
||||||
|
await page.mouse.up({ button: 'right' })
|
||||||
|
console.time('moused up')
|
||||||
maxZoomOuts--
|
maxZoomOuts--
|
||||||
middlePixelIsBackgroundColor = (await middlePixelIsColor(bgColor)) < 10
|
middlePixelIsBackgroundColor = (await middlePixelIsColor(bgColor)) < 15
|
||||||
}
|
}
|
||||||
|
await page.keyboard.up('Control')
|
||||||
|
|
||||||
expect(middlePixelIsBackgroundColor, {
|
expect(middlePixelIsBackgroundColor, {
|
||||||
message: 'We should not see the default planes',
|
message: 'We should not see the default planes',
|
||||||
@ -678,13 +688,12 @@ extrude002 = extrude(profile002, length = 150)
|
|||||||
homePage,
|
homePage,
|
||||||
scene,
|
scene,
|
||||||
toolbar,
|
toolbar,
|
||||||
viewport,
|
|
||||||
}) => {
|
}) => {
|
||||||
await context.folderSetupFn(async (dir) => {
|
await context.folderSetupFn(async (dir) => {
|
||||||
const legoDir = path.join(dir, 'lego')
|
const legoDir = path.join(dir, 'lego')
|
||||||
await fsp.mkdir(legoDir, { recursive: true })
|
await fsp.mkdir(legoDir, { recursive: true })
|
||||||
await fsp.copyFile(
|
await fsp.copyFile(
|
||||||
executorInputPath('lego.kcl'),
|
executorInputPath('e2e-can-sketch-on-chamfer.kcl'),
|
||||||
path.join(legoDir, 'main.kcl')
|
path.join(legoDir, 'main.kcl')
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
@ -697,11 +706,8 @@ extrude002 = extrude(profile002, length = 150)
|
|||||||
await scene.loadingIndicator.waitFor({ state: 'detached' })
|
await scene.loadingIndicator.waitFor({ state: 'detached' })
|
||||||
})
|
})
|
||||||
await test.step(`The part should start loading quickly, not waiting until execution is complete`, async () => {
|
await test.step(`The part should start loading quickly, not waiting until execution is complete`, async () => {
|
||||||
await scene.expectPixelColor(
|
// TODO: use the viewport size to pick the center point, but the `viewport` fixture's values were wrong.
|
||||||
[143, 143, 143],
|
await scene.expectPixelColor([116, 116, 116], { x: 500, y: 250 }, 15)
|
||||||
{ x: (viewport?.width ?? 1200) / 2, y: (viewport?.height ?? 500) / 2 },
|
|
||||||
15
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -113,7 +113,8 @@ test.describe('Sketch tests', { tag: ['@skipWin'] }, () => {
|
|||||||
await page.addInitScript(async () => {
|
await page.addInitScript(async () => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'persistCode',
|
'persistCode',
|
||||||
`sketch001 = startSketchOn(XZ)
|
`@settings(defaultLengthUnit = in)
|
||||||
|
sketch001 = startSketchOn(XZ)
|
||||||
|> startProfileAt([2.61, -4.01], %)
|
|> startProfileAt([2.61, -4.01], %)
|
||||||
|> xLine(length = 8.73)
|
|> xLine(length = 8.73)
|
||||||
|> tangentialArcTo([8.33, -1.31], %)`
|
|> tangentialArcTo([8.33, -1.31], %)`
|
||||||
@ -159,7 +160,10 @@ test.describe('Sketch tests', { tag: ['@skipWin'] }, () => {
|
|||||||
await page.mouse.click(700, 200)
|
await page.mouse.click(700, 200)
|
||||||
|
|
||||||
await expect.poll(u.normalisedEditorCode, { timeout: 1000 })
|
await expect.poll(u.normalisedEditorCode, { timeout: 1000 })
|
||||||
.toBe(`sketch002 = startSketchOn(XZ)
|
.toBe(`@settings(defaultLengthUnit = in)
|
||||||
|
|
||||||
|
|
||||||
|
sketch002 = startSketchOn(XZ)
|
||||||
sketch001 = startProfileAt([12.34, -12.34], sketch002)
|
sketch001 = startProfileAt([12.34, -12.34], sketch002)
|
||||||
|> yLine(length = 12.34)
|
|> yLine(length = 12.34)
|
||||||
|
|
||||||
@ -789,7 +793,8 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
|
|||||||
200
|
200
|
||||||
)
|
)
|
||||||
|
|
||||||
let codeStr = 'sketch001 = startSketchOn(XY)'
|
let codeStr =
|
||||||
|
'@settings(defaultLengthUnit = in)sketch001 = startSketchOn(XY)'
|
||||||
|
|
||||||
await page.mouse.click(center.x, viewportSize.height * 0.55)
|
await page.mouse.click(center.x, viewportSize.height * 0.55)
|
||||||
await expect(u.codeLocator).toHaveText(codeStr)
|
await expect(u.codeLocator).toHaveText(codeStr)
|
||||||
@ -868,7 +873,8 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
|
|||||||
|
|
||||||
await u.openDebugPanel()
|
await u.openDebugPanel()
|
||||||
|
|
||||||
const code = `sketch001 = startSketchOn(-XZ)
|
const code = `@settings(defaultLengthUnit = in)
|
||||||
|
sketch001 = startSketchOn(-XZ)
|
||||||
profile001 = startProfileAt([${roundOff(scale * 69.6)}, ${roundOff(
|
profile001 = startProfileAt([${roundOff(scale * 69.6)}, ${roundOff(
|
||||||
scale * 34.8
|
scale * 34.8
|
||||||
)}], sketch001)
|
)}], sketch001)
|
||||||
@ -898,7 +904,7 @@ profile001 = startProfileAt([${roundOff(scale * 69.6)}, ${roundOff(
|
|||||||
await page.mouse.move(700, 200, { steps: 10 })
|
await page.mouse.move(700, 200, { steps: 10 })
|
||||||
await page.mouse.click(700, 200, { delay: 200 })
|
await page.mouse.click(700, 200, { delay: 200 })
|
||||||
await expect(page.locator('.cm-content')).toHaveText(
|
await expect(page.locator('.cm-content')).toHaveText(
|
||||||
`sketch001 = startSketchOn(-XZ)`
|
`@settings(defaultLengthUnit = in)sketch001 = startSketchOn(-XZ)`
|
||||||
)
|
)
|
||||||
|
|
||||||
let prevContent = await page.locator('.cm-content').innerText()
|
let prevContent = await page.locator('.cm-content').innerText()
|
||||||
@ -1426,7 +1432,8 @@ test.describe(`Sketching with offset planes`, () => {
|
|||||||
await context.addInitScript(() => {
|
await context.addInitScript(() => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'persistCode',
|
'persistCode',
|
||||||
`offsetPlane001 = offsetPlane(XY, offset = 10)`
|
`@settings(defaultLengthUnit = in)
|
||||||
|
offsetPlane001 = offsetPlane(XY, offset = 10)`
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -1440,7 +1447,7 @@ test.describe(`Sketching with offset planes`, () => {
|
|||||||
await test.step(`Hovering should highlight code`, async () => {
|
await test.step(`Hovering should highlight code`, async () => {
|
||||||
await planeHover()
|
await planeHover()
|
||||||
await editor.expectState({
|
await editor.expectState({
|
||||||
activeLines: [`offsetPlane001=offsetPlane(XY,offset=10)`],
|
activeLines: [`@settings(defaultLengthUnit = in)`],
|
||||||
diagnostics: [],
|
diagnostics: [],
|
||||||
highlightedCode: 'offsetPlane(XY, offset = 10)',
|
highlightedCode: 'offsetPlane(XY, offset = 10)',
|
||||||
})
|
})
|
||||||
@ -1453,7 +1460,7 @@ test.describe(`Sketching with offset planes`, () => {
|
|||||||
await expect(toolbar.lineBtn).toBeEnabled()
|
await expect(toolbar.lineBtn).toBeEnabled()
|
||||||
await editor.expectEditor.toContain('startSketchOn(offsetPlane001)')
|
await editor.expectEditor.toContain('startSketchOn(offsetPlane001)')
|
||||||
await editor.expectState({
|
await editor.expectState({
|
||||||
activeLines: [`offsetPlane001=offsetPlane(XY,offset=10)`],
|
activeLines: [`@settings(defaultLengthUnit = in)`],
|
||||||
diagnostics: [],
|
diagnostics: [],
|
||||||
highlightedCode: '',
|
highlightedCode: '',
|
||||||
})
|
})
|
||||||
@ -1604,7 +1611,8 @@ profile002 = startProfileAt([117.2, 56.08], sketch001)
|
|||||||
await context.addInitScript(() => {
|
await context.addInitScript(() => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'persistCode',
|
'persistCode',
|
||||||
`sketch001 = startSketchOn(XZ)
|
`@settings(defaultLengthUnit = in)
|
||||||
|
sketch001 = startSketchOn(XZ)
|
||||||
profile002 = startProfileAt([40.68, 87.67], sketch001)
|
profile002 = startProfileAt([40.68, 87.67], sketch001)
|
||||||
|> xLine(length = 239.17)
|
|> xLine(length = 239.17)
|
||||||
profile003 = startProfileAt([206.63, -56.73], sketch001)
|
profile003 = startProfileAt([206.63, -56.73], sketch001)
|
||||||
@ -2172,7 +2180,8 @@ profile003 = startProfileAt([206.63, -56.73], sketch001)
|
|||||||
await page.addInitScript(async () => {
|
await page.addInitScript(async () => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'persistCode',
|
'persistCode',
|
||||||
`sketch001 = startSketchOn(XZ)
|
`@settings(defaultLengthUnit = in)
|
||||||
|
sketch001 = startSketchOn(XZ)
|
||||||
profile001 = startProfileAt([6.24, 4.54], sketch001)
|
profile001 = startProfileAt([6.24, 4.54], sketch001)
|
||||||
|> line(end = [-0.41, 6.99])
|
|> line(end = [-0.41, 6.99])
|
||||||
|> line(end = [8.61, 0.74])
|
|> line(end = [8.61, 0.74])
|
||||||
@ -2317,7 +2326,8 @@ profile004 = circleThreePoint(sketch001, p1 = [13.44, -6.8], p2 = [13.39, -2.07]
|
|||||||
await page.addInitScript(async () => {
|
await page.addInitScript(async () => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'persistCode',
|
'persistCode',
|
||||||
`sketch001 = startSketchOn(XZ)
|
`@settings(defaultLengthUnit = in)
|
||||||
|
sketch001 = startSketchOn(XZ)
|
||||||
profile001 = startProfileAt([6.24, 4.54], sketch001)
|
profile001 = startProfileAt([6.24, 4.54], sketch001)
|
||||||
|> line(end = [-0.41, 6.99])
|
|> line(end = [-0.41, 6.99])
|
||||||
|> line(end = [8.61, 0.74])
|
|> line(end = [8.61, 0.74])
|
||||||
@ -2422,7 +2432,8 @@ profile003 = circle(sketch001, center = [6.92, -4.2], radius = 3.16)
|
|||||||
await page.addInitScript(async () => {
|
await page.addInitScript(async () => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'persistCode',
|
'persistCode',
|
||||||
`sketch001 = startSketchOn(XZ)
|
`@settings(defaultLengthUnit = in)
|
||||||
|
sketch001 = startSketchOn(XZ)
|
||||||
profile001 = startProfileAt([-63.43, 193.08], sketch001)
|
profile001 = startProfileAt([-63.43, 193.08], sketch001)
|
||||||
|> line(end = [168.52, 149.87])
|
|> line(end = [168.52, 149.87])
|
||||||
|> line(end = [190.29, -39.18])
|
|> line(end = [190.29, -39.18])
|
||||||
@ -2486,7 +2497,11 @@ extrude001 = extrude(profile003, length = 5)
|
|||||||
page,
|
page,
|
||||||
}) => {
|
}) => {
|
||||||
await page.addInitScript(async () => {
|
await page.addInitScript(async () => {
|
||||||
localStorage.setItem('persistCode', `myVar = 5`)
|
localStorage.setItem(
|
||||||
|
'persistCode',
|
||||||
|
`@settings(defaultLengthUnit = in)
|
||||||
|
myVar = 5`
|
||||||
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
await page.setBodyDimensions({ width: 1000, height: 500 })
|
await page.setBodyDimensions({ width: 1000, height: 500 })
|
||||||
@ -2533,7 +2548,8 @@ extrude001 = extrude(profile003, length = 5)
|
|||||||
await page.addInitScript(async () => {
|
await page.addInitScript(async () => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'persistCode',
|
'persistCode',
|
||||||
`sketch001 = startSketchOn(XZ)
|
`@settings(defaultLengthUnit = in)
|
||||||
|
sketch001 = startSketchOn(XZ)
|
||||||
profile001 = startProfileAt([85.19, 338.59], sketch001)
|
profile001 = startProfileAt([85.19, 338.59], sketch001)
|
||||||
|> line(end = [213.3, -94.52])
|
|> line(end = [213.3, -94.52])
|
||||||
|> line(end = [-230.09, -55.34])
|
|> line(end = [-230.09, -55.34])
|
||||||
@ -2575,7 +2591,8 @@ profile002 = startProfileAt([85.81, 52.55], sketch002)
|
|||||||
await page.addInitScript(async () => {
|
await page.addInitScript(async () => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'persistCode',
|
'persistCode',
|
||||||
`thePart = startSketchOn(XZ)
|
`@settings(defaultLengthUnit = in)
|
||||||
|
thePart = startSketchOn(XZ)
|
||||||
|> startProfileAt([7.53, 10.51], %)
|
|> startProfileAt([7.53, 10.51], %)
|
||||||
|> line(end = [12.54, 1.83])
|
|> line(end = [12.54, 1.83])
|
||||||
|> line(end = [6.65, -6.91])
|
|> line(end = [6.65, -6.91])
|
||||||
@ -2636,7 +2653,8 @@ extrude001 = extrude(thePart, length = 75)
|
|||||||
await page.addInitScript(async () => {
|
await page.addInitScript(async () => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'persistCode',
|
'persistCode',
|
||||||
`sketch001 = startSketchOn(XZ)
|
`@settings(defaultLengthUnit = in)
|
||||||
|
sketch001 = startSketchOn(XZ)
|
||||||
profile001 = startProfileAt([6.71, -3.66], sketch001)
|
profile001 = startProfileAt([6.71, -3.66], sketch001)
|
||||||
|> line(end = [2.65, 9.02], tag = $seg02)
|
|> line(end = [2.65, 9.02], tag = $seg02)
|
||||||
|> line(end = [3.73, -9.36], tag = $seg01)
|
|> line(end = [3.73, -9.36], tag = $seg01)
|
||||||
@ -2809,7 +2827,8 @@ extrude003 = extrude(profile011, length = 2.5)
|
|||||||
await page.addInitScript(async () => {
|
await page.addInitScript(async () => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'persistCode',
|
'persistCode',
|
||||||
`sketch001 = startSketchOn(XZ)
|
`@settings(defaultLengthUnit = in)
|
||||||
|
sketch001 = startSketchOn(XZ)
|
||||||
profile001 = startProfileAt([34, 42.66], sketch001)
|
profile001 = startProfileAt([34, 42.66], sketch001)
|
||||||
|> line(end = [102.65, 151.99])
|
|> line(end = [102.65, 151.99])
|
||||||
|> line(end = [76, -138.66])
|
|> line(end = [76, -138.66])
|
||||||
|
@ -76,11 +76,11 @@ part001 = startSketchOn(-XZ)
|
|||||||
|> xLine(endAbsolute = totalLen, tag = $seg03)
|
|> xLine(endAbsolute = totalLen, tag = $seg03)
|
||||||
|> yLine(length = -armThick, tag = $seg01)
|
|> yLine(length = -armThick, tag = $seg01)
|
||||||
|> angledLineThatIntersects({
|
|> angledLineThatIntersects({
|
||||||
angle = HALF_TURN,
|
angle = turns::HALF_TURN,
|
||||||
offset = -armThick,
|
offset = -armThick,
|
||||||
intersectTag = seg04
|
intersectTag = seg04
|
||||||
}, %)
|
}, %)
|
||||||
|> angledLineToY([segAng(seg04, %) + 180, ZERO], %)
|
|> angledLineToY([segAng(seg04, %) + 180, turns::ZERO], %)
|
||||||
|> angledLineToY({
|
|> angledLineToY({
|
||||||
angle = -bottomAng,
|
angle = -bottomAng,
|
||||||
to = -totalHeightHalf - armThick,
|
to = -totalHeightHalf - armThick,
|
||||||
@ -88,12 +88,12 @@ part001 = startSketchOn(-XZ)
|
|||||||
|> xLine(length = endAbsolute = segEndX(seg03) + 0)
|
|> xLine(length = endAbsolute = segEndX(seg03) + 0)
|
||||||
|> yLine(length = -segLen(seg01, %))
|
|> yLine(length = -segLen(seg01, %))
|
||||||
|> angledLineThatIntersects({
|
|> angledLineThatIntersects({
|
||||||
angle = HALF_TURN,
|
angle = turns::HALF_TURN,
|
||||||
offset = -armThick,
|
offset = -armThick,
|
||||||
intersectTag = seg02
|
intersectTag = seg02
|
||||||
}, %)
|
}, %)
|
||||||
|> angledLineToY([segAng(seg02, %) + 180, -baseHeight], %)
|
|> angledLineToY([segAng(seg02, %) + 180, -baseHeight], %)
|
||||||
|> xLine(endAbsolute = ZERO)
|
|> xLine(endAbsolute = turns::ZERO)
|
||||||
|> close()
|
|> close()
|
||||||
|> extrude(length = 4)`
|
|> extrude(length = 4)`
|
||||||
)
|
)
|
||||||
|
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 54 KiB |
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 48 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 |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 49 KiB |
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 55 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 54 KiB |
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 75 KiB |
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 62 KiB |
Before Width: | Height: | Size: 143 KiB After Width: | Height: | Size: 142 KiB |
Before Width: | Height: | Size: 131 KiB After Width: | Height: | Size: 125 KiB |
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 69 KiB |
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 72 KiB |
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 68 KiB |
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 71 KiB |
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 71 KiB |
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 67 KiB |
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"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",
|
"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",
|
"prompt": "make this neon green please, use #39FF14",
|
||||||
"source_ranges": [
|
"source_ranges": [
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,6 @@ import {
|
|||||||
getUtils,
|
getUtils,
|
||||||
TEST_COLORS,
|
TEST_COLORS,
|
||||||
pollEditorLinesSelectedLength,
|
pollEditorLinesSelectedLength,
|
||||||
executorInputPath,
|
|
||||||
orRunWhenFullSuiteEnabled,
|
orRunWhenFullSuiteEnabled,
|
||||||
} from './test-utils'
|
} from './test-utils'
|
||||||
import { XOR } from 'lib/utils'
|
import { XOR } from 'lib/utils'
|
||||||
@ -81,7 +80,8 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
|
|||||||
await page.addInitScript(async () => {
|
await page.addInitScript(async () => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'persistCode',
|
'persistCode',
|
||||||
`yo = 79
|
`@settings(defaultLengthUnit = in)
|
||||||
|
yo = 79
|
||||||
part001 = startSketchOn(XZ)
|
part001 = startSketchOn(XZ)
|
||||||
|> startProfileAt([-7.54, -26.74], %)
|
|> startProfileAt([-7.54, -26.74], %)
|
||||||
|> line(end = [74.36, 130.4], tag = $seg01)
|
|> line(end = [74.36, 130.4], tag = $seg01)
|
||||||
@ -145,7 +145,8 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
|
|||||||
await page.addInitScript(async () => {
|
await page.addInitScript(async () => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'persistCode',
|
'persistCode',
|
||||||
`yo = 5
|
`@settings(defaultLengthUnit = in)
|
||||||
|
yo = 5
|
||||||
part001 = startSketchOn(XZ)
|
part001 = startSketchOn(XZ)
|
||||||
|> startProfileAt([-7.54, -26.74], %)
|
|> startProfileAt([-7.54, -26.74], %)
|
||||||
|> line(end = [74.36, 130.4], tag = $seg01)
|
|> line(end = [74.36, 130.4], tag = $seg01)
|
||||||
@ -159,31 +160,6 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
|
|||||||
|> xLine(length = segLen(seg_what))
|
|> xLine(length = segLen(seg_what))
|
||||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])`
|
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])`
|
||||||
)
|
)
|
||||||
|
|
||||||
const isChecked = await createNewVariableCheckbox.isChecked()
|
|
||||||
const addVariable = testName === 'Add variable'
|
|
||||||
XOR(isChecked, addVariable) && // XOR because no need to click the checkbox if the state is already correct
|
|
||||||
(await createNewVariableCheckbox.click())
|
|
||||||
|
|
||||||
await page
|
|
||||||
.getByRole('button', { name: 'Add constraining value' })
|
|
||||||
.click()
|
|
||||||
|
|
||||||
// Wait for the codemod to take effect
|
|
||||||
await expect(page.locator('.cm-content')).toContainText(`angle: -57,`)
|
|
||||||
await expect(page.locator('.cm-content')).toContainText(
|
|
||||||
`offset: ${offset},`
|
|
||||||
)
|
|
||||||
|
|
||||||
await pollEditorLinesSelectedLength(page, 2)
|
|
||||||
const activeLinesContent = await page.locator('.cm-activeLine').all()
|
|
||||||
await expect(activeLinesContent[0]).toHaveText(
|
|
||||||
`|> line(end = [74.36, 130.4], tag = $seg01)`
|
|
||||||
)
|
|
||||||
await expect(activeLinesContent[1]).toHaveText(`}, %)`)
|
|
||||||
|
|
||||||
// checking the count of the overlays is a good proxy check that the client sketch scene is in a good state
|
|
||||||
await expect(page.getByTestId('segment-overlay')).toHaveCount(4)
|
|
||||||
})
|
})
|
||||||
const u = await getUtils(page)
|
const u = await getUtils(page)
|
||||||
await page.setBodyDimensions({ width: 1200, height: 500 })
|
await page.setBodyDimensions({ width: 1200, height: 500 })
|
||||||
@ -277,7 +253,8 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
|
|||||||
await page.addInitScript(async () => {
|
await page.addInitScript(async () => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'persistCode',
|
'persistCode',
|
||||||
`yo = 5
|
`@settings(defaultLengthUnit = in)
|
||||||
|
yo = 5
|
||||||
part001 = startSketchOn(XZ)
|
part001 = startSketchOn(XZ)
|
||||||
|> startProfileAt([-7.54, -26.74], %)
|
|> startProfileAt([-7.54, -26.74], %)
|
||||||
|> line(end = [74.36, 130.4])
|
|> line(end = [74.36, 130.4])
|
||||||
@ -387,7 +364,8 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
|
|||||||
await page.addInitScript(async () => {
|
await page.addInitScript(async () => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'persistCode',
|
'persistCode',
|
||||||
`yo = 5
|
`@settings(defaultLengthUnit = in)
|
||||||
|
yo = 5
|
||||||
part001 = startSketchOn(XZ)
|
part001 = startSketchOn(XZ)
|
||||||
|> startProfileAt([-7.54, -26.74], %)
|
|> startProfileAt([-7.54, -26.74], %)
|
||||||
|> line(end = [74.36, 130.4])
|
|> line(end = [74.36, 130.4])
|
||||||
@ -486,13 +464,13 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
|
|||||||
testName: 'Add variable, selecting axis',
|
testName: 'Add variable, selecting axis',
|
||||||
addVariable: true,
|
addVariable: true,
|
||||||
axisSelect: true,
|
axisSelect: true,
|
||||||
value: 'QUARTER_TURN - angle001',
|
value: 'turns::QUARTER_TURN - angle001',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
testName: 'No variable, selecting axis',
|
testName: 'No variable, selecting axis',
|
||||||
addVariable: false,
|
addVariable: false,
|
||||||
axisSelect: true,
|
axisSelect: true,
|
||||||
value: 'QUARTER_TURN - 7',
|
value: 'turns::QUARTER_TURN - 7',
|
||||||
},
|
},
|
||||||
] as const
|
] as const
|
||||||
for (const { testName, addVariable, value, axisSelect } of cases) {
|
for (const { testName, addVariable, value, axisSelect } of cases) {
|
||||||
@ -500,7 +478,8 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
|
|||||||
await page.addInitScript(async () => {
|
await page.addInitScript(async () => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'persistCode',
|
'persistCode',
|
||||||
`yo = 5
|
`@settings(defaultLengthUnit = in)
|
||||||
|
yo = 5
|
||||||
part001 = startSketchOn(XZ)
|
part001 = startSketchOn(XZ)
|
||||||
|> startProfileAt([-7.54, -26.74], %)
|
|> startProfileAt([-7.54, -26.74], %)
|
||||||
|> line(end = [74.36, 130.4])
|
|> line(end = [74.36, 130.4])
|
||||||
@ -602,7 +581,8 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
|
|||||||
await page.addInitScript(async () => {
|
await page.addInitScript(async () => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'persistCode',
|
'persistCode',
|
||||||
`yo = 5
|
`@settings(defaultLengthUnit = in)
|
||||||
|
yo = 5
|
||||||
part001 = startSketchOn(XZ)
|
part001 = startSketchOn(XZ)
|
||||||
|> startProfileAt([-7.54, -26.74], %)
|
|> startProfileAt([-7.54, -26.74], %)
|
||||||
|> line(end = [74.36, 130.4])
|
|> line(end = [74.36, 130.4])
|
||||||
@ -688,7 +668,8 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
|
|||||||
await page.addInitScript(async () => {
|
await page.addInitScript(async () => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'persistCode',
|
'persistCode',
|
||||||
`yo = 5
|
`@settings(defaultLengthUnit = in)
|
||||||
|
yo = 5
|
||||||
part001 = startSketchOn(XZ)
|
part001 = startSketchOn(XZ)
|
||||||
|> startProfileAt([-7.54, -26.74], %)
|
|> startProfileAt([-7.54, -26.74], %)
|
||||||
|> line(end = [74.36, 130.4])
|
|> line(end = [74.36, 130.4])
|
||||||
@ -768,7 +749,8 @@ part002 = startSketchOn(XZ)
|
|||||||
await page.addInitScript(async (customCode) => {
|
await page.addInitScript(async (customCode) => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'persistCode',
|
'persistCode',
|
||||||
`yo = 5
|
`@settings(defaultLengthUnit = in)
|
||||||
|
yo = 5
|
||||||
part001 = startSketchOn(XZ)
|
part001 = startSketchOn(XZ)
|
||||||
|> startProfileAt([-7.54, -26.74], %)
|
|> startProfileAt([-7.54, -26.74], %)
|
||||||
|> line(end = [74.36, 130.4])
|
|> line(end = [74.36, 130.4])
|
||||||
@ -869,7 +851,8 @@ part002 = startSketchOn(XZ)
|
|||||||
await page.addInitScript(async () => {
|
await page.addInitScript(async () => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'persistCode',
|
'persistCode',
|
||||||
`yo = 5
|
`@settings(defaultLengthUnit = in)
|
||||||
|
yo = 5
|
||||||
part001 = startSketchOn(XZ)
|
part001 = startSketchOn(XZ)
|
||||||
|> startProfileAt([-7.54, -26.74], %)
|
|> startProfileAt([-7.54, -26.74], %)
|
||||||
|> line(end = [74.36, 130.4])
|
|> line(end = [74.36, 130.4])
|
||||||
@ -935,12 +918,12 @@ part002 = startSketchOn(XZ)
|
|||||||
test.describe('Axis & segment - no modal constraints', () => {
|
test.describe('Axis & segment - no modal constraints', () => {
|
||||||
const cases = [
|
const cases = [
|
||||||
{
|
{
|
||||||
codeAfter: `|> line(endAbsolute = [154.9, ZERO])`,
|
codeAfter: `|> line(endAbsolute = [154.9, turns::ZERO])`,
|
||||||
axisClick: { x: 950, y: 250 },
|
axisClick: { x: 950, y: 250 },
|
||||||
constraintName: 'Snap To X',
|
constraintName: 'Snap To X',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
codeAfter: `|> line(endAbsolute = [ZERO, 61.34])`,
|
codeAfter: `|> line(endAbsolute = [turns::ZERO, 61.34])`,
|
||||||
axisClick: { x: 600, y: 150 },
|
axisClick: { x: 600, y: 150 },
|
||||||
constraintName: 'Snap To Y',
|
constraintName: 'Snap To Y',
|
||||||
},
|
},
|
||||||
@ -950,7 +933,8 @@ part002 = startSketchOn(XZ)
|
|||||||
await page.addInitScript(async () => {
|
await page.addInitScript(async () => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'persistCode',
|
'persistCode',
|
||||||
`yo = 5
|
`@settings(defaultLengthUnit = in)
|
||||||
|
yo = 5
|
||||||
part001 = startSketchOn(XZ)
|
part001 = startSketchOn(XZ)
|
||||||
|> startProfileAt([-7.54, -26.74], %)
|
|> startProfileAt([-7.54, -26.74], %)
|
||||||
|> line(end = [74.36, 130.4])
|
|> line(end = [74.36, 130.4])
|
||||||
@ -1117,9 +1101,19 @@ test.describe('Electron constraint tests', () => {
|
|||||||
await context.folderSetupFn(async (dir) => {
|
await context.folderSetupFn(async (dir) => {
|
||||||
const bracketDir = path.join(dir, 'test-sample')
|
const bracketDir = path.join(dir, 'test-sample')
|
||||||
await fsp.mkdir(bracketDir, { recursive: true })
|
await fsp.mkdir(bracketDir, { recursive: true })
|
||||||
await fsp.copyFile(
|
await fsp.writeFile(
|
||||||
executorInputPath('angled_line.kcl'),
|
path.join(bracketDir, 'main.kcl'),
|
||||||
path.join(bracketDir, 'main.kcl')
|
`@settings(defaultLengthUnit = in)
|
||||||
|
const part001 = startSketchOn(XY)
|
||||||
|
|> startProfileAt([4.83, 12.56], %)
|
||||||
|
|> line(end = [15.1, 2.48])
|
||||||
|
|> line(end = [3.15, -9.85], tag = $seg01)
|
||||||
|
|> line(end = [-15.17, -4.1])
|
||||||
|
|> angledLine([segAng(seg01), 12.35], %)
|
||||||
|
|> line(end = [-13.02, 10.03])
|
||||||
|
|> close()
|
||||||
|
|> extrude(length = 4)`,
|
||||||
|
'utf-8'
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -255,7 +255,7 @@ test.describe(`Testing gizmo, fixture-based`, () => {
|
|||||||
await context.addInitScript(() => {
|
await context.addInitScript(() => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'persistCode',
|
'persistCode',
|
||||||
`
|
`@settings(defaultLengthUnit = in)
|
||||||
const sketch002 = startSketchOn(XZ)
|
const sketch002 = startSketchOn(XZ)
|
||||||
|> startProfileAt([-108.83, -57.48], %)
|
|> startProfileAt([-108.83, -57.48], %)
|
||||||
|> angledLine([0, 105.13], %, $rectangleSegmentA001)
|
|> angledLine([0, 105.13], %, $rectangleSegmentA001)
|
||||||
|
@ -46,7 +46,7 @@ test.describe('Testing in-app sample loading', () => {
|
|||||||
page.getByRole('option', {
|
page.getByRole('option', {
|
||||||
name,
|
name,
|
||||||
})
|
})
|
||||||
const warningText = page.getByText('Overwrite current file and units?')
|
const warningText = page.getByText('Overwrite current file with sample?')
|
||||||
const confirmButton = page.getByRole('button', { name: 'Submit command' })
|
const confirmButton = page.getByRole('button', { name: 'Submit command' })
|
||||||
|
|
||||||
await test.step(`Precondition: check the initial code`, async () => {
|
await test.step(`Precondition: check the initial code`, async () => {
|
||||||
@ -110,11 +110,9 @@ test.describe('Testing in-app sample loading', () => {
|
|||||||
const commandMethodOption = page.getByRole('option', {
|
const commandMethodOption = page.getByRole('option', {
|
||||||
name: 'Overwrite',
|
name: 'Overwrite',
|
||||||
})
|
})
|
||||||
const newFileWarning = page.getByText(
|
const newFileWarning = page.getByText('Create a new file from sample?')
|
||||||
'Create a new file, overwrite project units?'
|
|
||||||
)
|
|
||||||
const overwriteWarning = page.getByText(
|
const overwriteWarning = page.getByText(
|
||||||
'Overwrite current file and units?'
|
'Overwrite current file with sample?'
|
||||||
)
|
)
|
||||||
const confirmButton = page.getByRole('button', { name: 'Submit command' })
|
const confirmButton = page.getByRole('button', { name: 'Submit command' })
|
||||||
const projectMenuButton = page.getByTestId('project-sidebar-toggle')
|
const projectMenuButton = page.getByTestId('project-sidebar-toggle')
|
||||||
|
@ -210,7 +210,8 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|
|||||||
await page.addInitScript(async () => {
|
await page.addInitScript(async () => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'persistCode',
|
'persistCode',
|
||||||
`part001 = startSketchOn(XZ)
|
`@settings(defaultLengthUnit = in)
|
||||||
|
part001 = startSketchOn(XZ)
|
||||||
|> startProfileAt([5 + 0, 20 + 0], %)
|
|> startProfileAt([5 + 0, 20 + 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 }, %)
|
||||||
@ -380,7 +381,8 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|
|||||||
await page.addInitScript(async () => {
|
await page.addInitScript(async () => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'persistCode',
|
'persistCode',
|
||||||
`yRel001 = -14
|
`@settings(defaultLengthUnit = in)
|
||||||
|
yRel001 = -14
|
||||||
xRel001 = 0.5
|
xRel001 = 0.5
|
||||||
angle001 = 3
|
angle001 = 3
|
||||||
len001 = 32
|
len001 = 32
|
||||||
@ -459,7 +461,8 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|
|||||||
await page.addInitScript(async () => {
|
await page.addInitScript(async () => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'persistCode',
|
'persistCode',
|
||||||
`part001 = startSketchOn(XZ)
|
`@settings(defaultLengthUnit = in)
|
||||||
|
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 }, %)
|
||||||
@ -590,7 +593,8 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|
|||||||
await page.addInitScript(async () => {
|
await page.addInitScript(async () => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'persistCode',
|
'persistCode',
|
||||||
`part001 = startSketchOn(XZ)
|
`@settings(defaultLengthUnit = in)
|
||||||
|
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 }, %)
|
||||||
@ -751,7 +755,8 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|
|||||||
await page.addInitScript(async () => {
|
await page.addInitScript(async () => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'persistCode',
|
'persistCode',
|
||||||
`part001 = startSketchOn(XZ)
|
`@settings(defaultLengthUnit = in)
|
||||||
|
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 }, %)
|
||||||
@ -831,7 +836,8 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|
|||||||
await page.addInitScript(async () => {
|
await page.addInitScript(async () => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'persistCode',
|
'persistCode',
|
||||||
`sketch001 = startSketchOn(XZ)
|
`@settings(defaultLengthUnit = in)
|
||||||
|
sketch001 = startSketchOn(XZ)
|
||||||
profile001 = startProfileAt([56.37, 120.33], sketch001)
|
profile001 = startProfileAt([56.37, 120.33], sketch001)
|
||||||
|> line(end = [162.86, 106.48])
|
|> line(end = [162.86, 106.48])
|
||||||
|> arcTo({
|
|> arcTo({
|
||||||
@ -957,7 +963,8 @@ profile001 = startProfileAt([56.37, 120.33], sketch001)
|
|||||||
await page.addInitScript(async () => {
|
await page.addInitScript(async () => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'persistCode',
|
'persistCode',
|
||||||
`part001 = startSketchOn(XZ)
|
`@settings(defaultLengthUnit = in)
|
||||||
|
part001 = startSketchOn(XZ)
|
||||||
|> circle(center = [1 + 0, 0], radius = 8)
|
|> circle(center = [1 + 0, 0], radius = 8)
|
||||||
`
|
`
|
||||||
)
|
)
|
||||||
@ -1077,7 +1084,8 @@ profile001 = startProfileAt([56.37, 120.33], sketch001)
|
|||||||
await page.addInitScript(async () => {
|
await page.addInitScript(async () => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'persistCode',
|
'persistCode',
|
||||||
`part001 = startSketchOn(XZ)
|
`@settings(defaultLengthUnit = in)
|
||||||
|
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 }, %)
|
||||||
@ -1351,7 +1359,8 @@ profile001 = startProfileAt([56.37, 120.33], sketch001)
|
|||||||
async ({ lineToBeDeleted, extraLine }) => {
|
async ({ lineToBeDeleted, extraLine }) => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'persistCode',
|
'persistCode',
|
||||||
`part001 = startSketchOn(XZ)
|
`@settings(defaultLengthUnit = in)
|
||||||
|
part001 = startSketchOn(XZ)
|
||||||
|> startProfileAt([5, 6], %)
|
|> startProfileAt([5, 6], %)
|
||||||
|> ${lineToBeDeleted}
|
|> ${lineToBeDeleted}
|
||||||
|> line(end = [-10, -15])
|
|> line(end = [-10, -15])
|
||||||
@ -1516,7 +1525,8 @@ profile001 = startProfileAt([56.37, 120.33], sketch001)
|
|||||||
async ({ lineToBeDeleted }) => {
|
async ({ lineToBeDeleted }) => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'persistCode',
|
'persistCode',
|
||||||
`part001 = startSketchOn(XZ)
|
`@settings(defaultLengthUnit = in)
|
||||||
|
part001 = startSketchOn(XZ)
|
||||||
|> startProfileAt([5, 6], %)
|
|> startProfileAt([5, 6], %)
|
||||||
|> ${lineToBeDeleted}
|
|> ${lineToBeDeleted}
|
||||||
|> line(end = [-10, -15])
|
|> line(end = [-10, -15])
|
||||||
|
@ -68,20 +68,20 @@ test.describe('Testing selections', { tag: ['@skipWin'] }, () => {
|
|||||||
await u.closeDebugPanel()
|
await u.closeDebugPanel()
|
||||||
await page.mouse.click(startXPx + PUR * 10, 500 - PUR * 10)
|
await page.mouse.click(startXPx + PUR * 10, 500 - PUR * 10)
|
||||||
await expect(page.locator('.cm-content')).toHaveText(
|
await expect(page.locator('.cm-content')).toHaveText(
|
||||||
`sketch001 = startSketchOn(XZ)profile001 = startProfileAt(${commonPoints.startAt}, sketch001)`
|
`@settings(defaultLengthUnit = in)sketch001 = startSketchOn(XZ)profile001 = startProfileAt(${commonPoints.startAt}, sketch001)`
|
||||||
)
|
)
|
||||||
|
|
||||||
await page.waitForTimeout(100)
|
await page.waitForTimeout(100)
|
||||||
await page.mouse.click(startXPx + PUR * 20, 500 - PUR * 10)
|
await page.mouse.click(startXPx + PUR * 20, 500 - PUR * 10)
|
||||||
|
|
||||||
await expect(page.locator('.cm-content'))
|
await expect(page.locator('.cm-content'))
|
||||||
.toHaveText(`sketch001 = startSketchOn(XZ)profile001 = startProfileAt(${commonPoints.startAt}, sketch001)
|
.toHaveText(`@settings(defaultLengthUnit = in)sketch001 = startSketchOn(XZ)profile001 = startProfileAt(${commonPoints.startAt}, sketch001)
|
||||||
|> xLine(length = ${commonPoints.num1})`)
|
|> xLine(length = ${commonPoints.num1})`)
|
||||||
|
|
||||||
await page.waitForTimeout(100)
|
await page.waitForTimeout(100)
|
||||||
await page.mouse.click(startXPx + PUR * 20, 500 - PUR * 20)
|
await page.mouse.click(startXPx + PUR * 20, 500 - PUR * 20)
|
||||||
await expect(page.locator('.cm-content'))
|
await expect(page.locator('.cm-content'))
|
||||||
.toHaveText(`sketch001 = startSketchOn(XZ)profile001 = startProfileAt(${
|
.toHaveText(`@settings(defaultLengthUnit = in)sketch001 = startSketchOn(XZ)profile001 = startProfileAt(${
|
||||||
commonPoints.startAt
|
commonPoints.startAt
|
||||||
}, sketch001)
|
}, sketch001)
|
||||||
|> xLine(length = ${commonPoints.num1})
|
|> xLine(length = ${commonPoints.num1})
|
||||||
@ -89,7 +89,7 @@ test.describe('Testing selections', { tag: ['@skipWin'] }, () => {
|
|||||||
await page.waitForTimeout(100)
|
await page.waitForTimeout(100)
|
||||||
await page.mouse.click(startXPx, 500 - PUR * 20)
|
await page.mouse.click(startXPx, 500 - PUR * 20)
|
||||||
await expect(page.locator('.cm-content'))
|
await expect(page.locator('.cm-content'))
|
||||||
.toHaveText(`sketch001 = startSketchOn(XZ)profile001 = startProfileAt(${
|
.toHaveText(`@settings(defaultLengthUnit = in)sketch001 = startSketchOn(XZ)profile001 = startProfileAt(${
|
||||||
commonPoints.startAt
|
commonPoints.startAt
|
||||||
}, sketch001)
|
}, sketch001)
|
||||||
|> xLine(length = ${commonPoints.num1})
|
|> xLine(length = ${commonPoints.num1})
|
||||||
@ -260,7 +260,8 @@ test.describe('Testing selections', { tag: ['@skipWin'] }, () => {
|
|||||||
await page.addInitScript(async () => {
|
await page.addInitScript(async () => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'persistCode',
|
'persistCode',
|
||||||
`sketch001 = startSketchOn(XZ)
|
`@settings(defaultLengthUnit = in)
|
||||||
|
sketch001 = startSketchOn(XZ)
|
||||||
|> startProfileAt([-79.26, 95.04], %)
|
|> startProfileAt([-79.26, 95.04], %)
|
||||||
|> line(end = [112.54, 127.64], tag = $seg02)
|
|> line(end = [112.54, 127.64], tag = $seg02)
|
||||||
|> line(end = [170.36, -121.61], tag = $seg01)
|
|> line(end = [170.36, -121.61], tag = $seg01)
|
||||||
@ -528,7 +529,8 @@ profile001 = startProfileAt([7.49, 9.96], sketch001)
|
|||||||
await page.addInitScript(async (KCL_DEFAULT_LENGTH) => {
|
await page.addInitScript(async (KCL_DEFAULT_LENGTH) => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'persistCode',
|
'persistCode',
|
||||||
`part001 = startSketchOn(XZ)
|
`@settings(defaultLengthUnit = in)
|
||||||
|
part001 = startSketchOn(XZ)
|
||||||
|> startProfileAt([20, 0], %)
|
|> startProfileAt([20, 0], %)
|
||||||
|> line(end = [7.13, 4 + 0])
|
|> line(end = [7.13, 4 + 0])
|
||||||
|> angledLine({ angle = 3 + 0, length = 3.14 + 0 }, %)
|
|> angledLine({ angle = 3 + 0, length = 3.14 + 0 }, %)
|
||||||
@ -747,7 +749,8 @@ profile001 = startProfileAt([7.49, 9.96], sketch001)
|
|||||||
await page.waitForTimeout(200)
|
await page.waitForTimeout(200)
|
||||||
|
|
||||||
await u.removeCurrentCode()
|
await u.removeCurrentCode()
|
||||||
await u.codeLocator.fill(`sketch001 = startSketchOn(XZ)
|
await u.codeLocator.fill(`@settings(defaultLengthUnit = in)
|
||||||
|
sketch001 = startSketchOn(XZ)
|
||||||
|> startProfileAt([75.8, 317.2], %) // [$startCapTag, $EndCapTag]
|
|> startProfileAt([75.8, 317.2], %) // [$startCapTag, $EndCapTag]
|
||||||
|> angledLine([0, 268.43], %, $rectangleSegmentA001)
|
|> angledLine([0, 268.43], %, $rectangleSegmentA001)
|
||||||
|> angledLine([
|
|> angledLine([
|
||||||
@ -965,7 +968,8 @@ profile001 = startProfileAt([7.49, 9.96], sketch001)
|
|||||||
async ({ cases }) => {
|
async ({ cases }) => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'persistCode',
|
'persistCode',
|
||||||
`yo = 79
|
`@settings(defaultLengthUnit = in)
|
||||||
|
yo = 79
|
||||||
part001 = startSketchOn(XZ)
|
part001 = startSketchOn(XZ)
|
||||||
|> startProfileAt([-7.54, -26.74], %)
|
|> startProfileAt([-7.54, -26.74], %)
|
||||||
|> ${cases[0].expectedCode}
|
|> ${cases[0].expectedCode}
|
||||||
@ -1020,7 +1024,8 @@ profile001 = startProfileAt([7.49, 9.96], sketch001)
|
|||||||
await page.addInitScript(async () => {
|
await page.addInitScript(async () => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'persistCode',
|
'persistCode',
|
||||||
`sketch001 = startSketchOn(XZ)
|
`@settings(defaultLengthUnit = in)
|
||||||
|
sketch001 = startSketchOn(XZ)
|
||||||
|> startProfileAt([-79.26, 95.04], %)
|
|> startProfileAt([-79.26, 95.04], %)
|
||||||
|> line(end = [112.54, 127.64])
|
|> line(end = [112.54, 127.64])
|
||||||
|> line(end = [170.36, -121.61], tag = $seg01)
|
|> line(end = [170.36, -121.61], tag = $seg01)
|
||||||
@ -1253,7 +1258,7 @@ profile001 = startProfileAt([7.49, 9.96], sketch001)
|
|||||||
await page.mouse.click(700, 200)
|
await page.mouse.click(700, 200)
|
||||||
|
|
||||||
await expect(page.locator('.cm-content')).toHaveText(
|
await expect(page.locator('.cm-content')).toHaveText(
|
||||||
`sketch001 = startSketchOn(XZ)`
|
`@settings(defaultLengthUnit = in)sketch001 = startSketchOn(XZ)`
|
||||||
)
|
)
|
||||||
|
|
||||||
await page.waitForTimeout(600)
|
await page.waitForTimeout(600)
|
||||||
|
@ -271,7 +271,7 @@ test.describe('Testing settings', () => {
|
|||||||
const bracketDir = join(dir, projectName)
|
const bracketDir = join(dir, projectName)
|
||||||
await fsp.mkdir(bracketDir, { recursive: true })
|
await fsp.mkdir(bracketDir, { recursive: true })
|
||||||
await fsp.copyFile(
|
await fsp.copyFile(
|
||||||
executorInputPath('focusrite_scarlett_mounting_braket.kcl'),
|
executorInputPath('cylinder-inches.kcl'),
|
||||||
join(bracketDir, 'main.kcl')
|
join(bracketDir, 'main.kcl')
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -699,19 +699,19 @@ test.describe('Testing settings', () => {
|
|||||||
name: 'Current units are: ',
|
name: 'Current units are: ',
|
||||||
})
|
})
|
||||||
await gizmo.click()
|
await gizmo.click()
|
||||||
const button = page.getByRole('button', {
|
const button = page.locator('ul').getByRole('button', {
|
||||||
name: copy,
|
name: copy,
|
||||||
exact: true,
|
exact: true,
|
||||||
})
|
})
|
||||||
await button.click()
|
await button.click()
|
||||||
const toastMessage = page.getByText(
|
const toastMessage = page.getByText(
|
||||||
`Set default unit to "${unitOfMeasure}" for this project`
|
`Updated per-file units to ${unitOfMeasure}`
|
||||||
)
|
)
|
||||||
await expect(toastMessage).toBeVisible()
|
await expect(toastMessage).toBeVisible()
|
||||||
}
|
}
|
||||||
|
|
||||||
await changeUnitOfMeasureInGizmo('in', 'Inches')
|
|
||||||
await changeUnitOfMeasureInGizmo('ft', 'Feet')
|
await changeUnitOfMeasureInGizmo('ft', 'Feet')
|
||||||
|
await changeUnitOfMeasureInGizmo('in', 'Inches')
|
||||||
await changeUnitOfMeasureInGizmo('yd', 'Yards')
|
await changeUnitOfMeasureInGizmo('yd', 'Yards')
|
||||||
await changeUnitOfMeasureInGizmo('mm', 'Millimeters')
|
await changeUnitOfMeasureInGizmo('mm', 'Millimeters')
|
||||||
await changeUnitOfMeasureInGizmo('cm', 'Centimeters')
|
await changeUnitOfMeasureInGizmo('cm', 'Centimeters')
|
||||||
@ -951,9 +951,9 @@ test.describe('Testing settings', () => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
await test.step(`Initial units from settings`, async () => {
|
await test.step(`Initial units from settings are ignored`, async () => {
|
||||||
await homePage.openProject('project-000')
|
await homePage.openProject('project-000')
|
||||||
await expect(unitsIndicator).toHaveText('Current units are: in')
|
await expect(unitsIndicator).toHaveText('Current units are: mm')
|
||||||
})
|
})
|
||||||
|
|
||||||
await test.step(`Manually write inline settings`, async () => {
|
await test.step(`Manually write inline settings`, async () => {
|
||||||
|
@ -67,11 +67,11 @@ part001 = startSketchOn(-XZ)
|
|||||||
|> xLine(endAbsolute = totalLen, tag = $seg03)
|
|> xLine(endAbsolute = totalLen, tag = $seg03)
|
||||||
|> yLine(length = -armThick, tag = $seg01)
|
|> yLine(length = -armThick, tag = $seg01)
|
||||||
|> angledLineThatIntersects({
|
|> angledLineThatIntersects({
|
||||||
angle = HALF_TURN,
|
angle = turns::HALF_TURN,
|
||||||
offset = -armThick,
|
offset = -armThick,
|
||||||
intersectTag = seg04
|
intersectTag = seg04
|
||||||
}, %)
|
}, %)
|
||||||
|> angledLineToY([segAng(seg04) + 180, ZERO], %)
|
|> angledLineToY([segAng(seg04) + 180, turns::ZERO], %)
|
||||||
|> angledLineToY({
|
|> angledLineToY({
|
||||||
angle = -bottomAng,
|
angle = -bottomAng,
|
||||||
to = -totalHeightHalf - armThick,
|
to = -totalHeightHalf - armThick,
|
||||||
@ -79,12 +79,12 @@ part001 = startSketchOn(-XZ)
|
|||||||
|> xLine(endAbsolute = segEndX(seg03) + 0)
|
|> xLine(endAbsolute = segEndX(seg03) + 0)
|
||||||
|> yLine(length = -segLen(seg01))
|
|> yLine(length = -segLen(seg01))
|
||||||
|> angledLineThatIntersects({
|
|> angledLineThatIntersects({
|
||||||
angle = HALF_TURN,
|
angle = turns::HALF_TURN,
|
||||||
offset = -armThick,
|
offset = -armThick,
|
||||||
intersectTag = seg02
|
intersectTag = seg02
|
||||||
}, %)
|
}, %)
|
||||||
|> angledLineToY([segAng(seg02) + 180, -baseHeight], %)
|
|> angledLineToY([segAng(seg02) + 180, -baseHeight], %)
|
||||||
|> xLine(endAbsolute = ZERO)
|
|> xLine(endAbsolute = turns::ZERO)
|
||||||
|> close()
|
|> close()
|
||||||
|> extrude(length = 4)`
|
|> extrude(length = 4)`
|
||||||
)
|
)
|
||||||
@ -483,7 +483,8 @@ test('Sketch on face', async ({ page, homePage, scene, cmdBar, toolbar }) => {
|
|||||||
await page.addInitScript(async () => {
|
await page.addInitScript(async () => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'persistCode',
|
'persistCode',
|
||||||
`sketch001 = startSketchOn(XZ)
|
`@settings(defaultLengthUnit = in)
|
||||||
|
sketch001 = startSketchOn(XZ)
|
||||||
|> startProfileAt([3.29, 7.86], %)
|
|> startProfileAt([3.29, 7.86], %)
|
||||||
|> line(end = [2.48, 2.44])
|
|> line(end = [2.48, 2.44])
|
||||||
|> line(end = [2.66, 1.17])
|
|> line(end = [2.66, 1.17])
|
||||||
|
32
package.json
@ -13,20 +13,20 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@codemirror/autocomplete": "^6.18.6",
|
"@codemirror/autocomplete": "^6.18.6",
|
||||||
"@codemirror/commands": "^6.8.0",
|
"@codemirror/commands": "^6.8.1",
|
||||||
"@codemirror/language": "^6.11.0",
|
"@codemirror/language": "^6.11.0",
|
||||||
"@codemirror/lint": "^6.8.4",
|
"@codemirror/lint": "^6.8.5",
|
||||||
"@codemirror/search": "^6.5.10",
|
"@codemirror/search": "^6.5.10",
|
||||||
"@codemirror/state": "^6.4.1",
|
"@codemirror/state": "^6.5.2",
|
||||||
"@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.8",
|
||||||
"@fortawesome/fontawesome-svg-core": "^6.7.2",
|
"@fortawesome/fontawesome-svg-core": "^6.7.2",
|
||||||
"@fortawesome/free-brands-svg-icons": "^6.7.2",
|
"@fortawesome/free-brands-svg-icons": "^6.7.2",
|
||||||
"@fortawesome/free-solid-svg-icons": "^6.7.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.2",
|
||||||
"@kittycad/lib": "2.0.21",
|
"@kittycad/lib": "2.0.23",
|
||||||
"@lezer/highlight": "^1.2.1",
|
"@lezer/highlight": "^1.2.1",
|
||||||
"@lezer/lr": "^1.4.1",
|
"@lezer/lr": "^1.4.1",
|
||||||
"@react-hook/resize-observer": "^2.0.1",
|
"@react-hook/resize-observer": "^2.0.1",
|
||||||
@ -37,11 +37,11 @@
|
|||||||
"@xstate/react": "^4.1.1",
|
"@xstate/react": "^4.1.1",
|
||||||
"bonjour-service": "^1.3.0",
|
"bonjour-service": "^1.3.0",
|
||||||
"bson": "^6.10.3",
|
"bson": "^6.10.3",
|
||||||
"chokidar": "^4.0.1",
|
"chokidar": "^4.0.3",
|
||||||
"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.2",
|
||||||
"fuse.js": "^7.1.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",
|
||||||
@ -164,15 +164,15 @@
|
|||||||
"@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.51.0",
|
"@playwright/test": "^1.51.1",
|
||||||
"@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.2",
|
||||||
"@types/electron": "^1.6.10",
|
"@types/electron": "^1.6.10",
|
||||||
"@types/isomorphic-fetch": "^0.0.39",
|
"@types/isomorphic-fetch": "^0.0.39",
|
||||||
"@types/minimist": "^1.2.5",
|
"@types/minimist": "^1.2.5",
|
||||||
"@types/mocha": "^10.0.10",
|
"@types/mocha": "^10.0.10",
|
||||||
"@types/node": "^22.13.9",
|
"@types/node": "^22.13.14",
|
||||||
"@types/pixelmatch": "^5.2.6",
|
"@types/pixelmatch": "^5.2.6",
|
||||||
"@types/pngjs": "^6.0.4",
|
"@types/pngjs": "^6.0.4",
|
||||||
"@types/react": "^18.3.4",
|
"@types/react": "^18.3.4",
|
||||||
@ -182,13 +182,13 @@
|
|||||||
"@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",
|
||||||
"@types/ws": "^8.5.13",
|
"@types/ws": "^8.18.0",
|
||||||
"@vitejs/plugin-react": "^4.3.0",
|
"@vitejs/plugin-react": "^4.3.4",
|
||||||
"@vitest/web-worker": "^1.5.0",
|
"@vitest/web-worker": "^1.5.0",
|
||||||
"@xstate/cli": "^0.5.17",
|
"@xstate/cli": "^0.5.17",
|
||||||
"autoprefixer": "^10.4.19",
|
"autoprefixer": "^10.4.21",
|
||||||
"electron": "^34.1.1",
|
"electron": "^34.1.1",
|
||||||
"electron-builder": "^26.0.6",
|
"electron-builder": "^26.0.12",
|
||||||
"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.31.0",
|
"eslint-plugin-import": "^2.31.0",
|
||||||
@ -220,7 +220,7 @@
|
|||||||
"vite-tsconfig-paths": "^4.3.2",
|
"vite-tsconfig-paths": "^4.3.2",
|
||||||
"vitest": "^1.6.1",
|
"vitest": "^1.6.1",
|
||||||
"vitest-webgl-canvas-mock": "^1.1.0",
|
"vitest-webgl-canvas-mock": "^1.1.0",
|
||||||
"ws": "^8.17.0",
|
"ws": "^8.18.1",
|
||||||
"yarn": "^1.22.22"
|
"yarn": "^1.22.22"
|
||||||
},
|
},
|
||||||
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
||||||
|
@ -37,11 +37,11 @@ export class IntoServer
|
|||||||
implements AsyncGenerator<Uint8Array, never, void>
|
implements AsyncGenerator<Uint8Array, never, void>
|
||||||
{
|
{
|
||||||
private worker: Worker | null = null
|
private worker: Worker | null = null
|
||||||
private type_: String | null = null
|
private type_: string | null = null
|
||||||
|
|
||||||
private trace: boolean = false
|
private trace: boolean = false
|
||||||
|
|
||||||
constructor(type_?: String, worker?: Worker, trace?: boolean) {
|
constructor(type_?: string, worker?: Worker, trace?: boolean) {
|
||||||
super()
|
super()
|
||||||
if (worker && type_) {
|
if (worker && type_) {
|
||||||
this.worker = worker
|
this.worker = worker
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Dual-Basin Utility Sink
|
// Dual-Basin Utility Sink
|
||||||
// A stainless steel sink unit with dual rectangular basins and six under-counter storage compartments.
|
// A stainless steel sink unit with dual rectangular basins and six under-counter storage compartments.
|
||||||
|
|
||||||
|
// set units
|
||||||
@settings(defaultLengthUnit = mm)
|
@settings(defaultLengthUnit = mm)
|
||||||
|
|
||||||
// globals
|
// globals
|
||||||
@ -12,7 +13,7 @@ profileThickness = 13
|
|||||||
metalThickness = 2
|
metalThickness = 2
|
||||||
|
|
||||||
blockCount = 3
|
blockCount = 3
|
||||||
blockWidth = (tableWidth-profileThickness) / 3
|
blockWidth = (tableWidth - profileThickness) / 3
|
||||||
blockHeight = tableHeight - metalThickness - 0.5
|
blockHeight = tableHeight - metalThickness - 0.5
|
||||||
blockDepth = tableDepth - profileThickness
|
blockDepth = tableDepth - profileThickness
|
||||||
|
|
||||||
@ -27,9 +28,9 @@ legHeight = blockHeight - profileThickness
|
|||||||
legCount = blockCount + 1
|
legCount = blockCount + 1
|
||||||
|
|
||||||
legBody = startProfileAt([0, 0], floorPlane)
|
legBody = startProfileAt([0, 0], floorPlane)
|
||||||
|> yLine(length=profileThickness)
|
|> yLine(length = profileThickness)
|
||||||
|> xLine(length=profileThickness)
|
|> xLine(length = profileThickness)
|
||||||
|> yLine(length=-profileThickness)
|
|> yLine(length = -profileThickness)
|
||||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||||
|> close()
|
|> close()
|
||||||
|> patternLinear2d(axis = [1, 0], instances = legCount, distance = blockWidth)
|
|> patternLinear2d(axis = [1, 0], instances = legCount, distance = blockWidth)
|
||||||
@ -42,9 +43,9 @@ lowerBeltLengthX = blockWidth - profileThickness
|
|||||||
|
|
||||||
lowerBeltPlane = startSketchOn(offsetPlane(XY, offset = lowerBeltHeightAboveTheFloor))
|
lowerBeltPlane = startSketchOn(offsetPlane(XY, offset = lowerBeltHeightAboveTheFloor))
|
||||||
lowerBeltBodyX = startProfileAt([profileThickness, 0], lowerBeltPlane)
|
lowerBeltBodyX = startProfileAt([profileThickness, 0], lowerBeltPlane)
|
||||||
|> yLine(length=profileThickness)
|
|> yLine(length = profileThickness)
|
||||||
|> xLine(length=lowerBeltLengthX)
|
|> xLine(length = lowerBeltLengthX)
|
||||||
|> yLine(length=-profileThickness)
|
|> yLine(length = -profileThickness)
|
||||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||||
|> close()
|
|> close()
|
||||||
|> patternLinear2d(axis = [1, 0], instances = blockCount, distance = blockWidth)
|
|> patternLinear2d(axis = [1, 0], instances = blockCount, distance = blockWidth)
|
||||||
@ -53,12 +54,12 @@ lowerBeltBodyX = startProfileAt([profileThickness, 0], lowerBeltPlane)
|
|||||||
|
|
||||||
lowerBeltLengthY = blockDepth - profileThickness
|
lowerBeltLengthY = blockDepth - profileThickness
|
||||||
lowerBeltBodyY = startProfileAt([0, profileThickness], lowerBeltPlane)
|
lowerBeltBodyY = startProfileAt([0, profileThickness], lowerBeltPlane)
|
||||||
|> yLine(length=lowerBeltLengthY)
|
|> yLine(length = lowerBeltLengthY)
|
||||||
|> xLine(length=profileThickness)
|
|> xLine(length = profileThickness)
|
||||||
|> yLine(length=-lowerBeltLengthY)
|
|> yLine(length = -lowerBeltLengthY)
|
||||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||||
|> close()
|
|> close()
|
||||||
|> patternLinear2d(axis = [1, 0], instances = 2, distance = tableWidth-profileThickness)
|
|> patternLinear2d(axis = [1, 0], instances = 2, distance = tableWidth - profileThickness)
|
||||||
|> extrude(length = profileThickness)
|
|> extrude(length = profileThickness)
|
||||||
|
|
||||||
// pillars
|
// pillars
|
||||||
@ -67,9 +68,9 @@ pillarPlane = startSketchOn(offsetPlane(XY, offset = pillarHeightAboveTheFloor))
|
|||||||
pillarTotalHeight = blockHeight - profileThickness - pillarHeightAboveTheFloor
|
pillarTotalHeight = blockHeight - profileThickness - pillarHeightAboveTheFloor
|
||||||
|
|
||||||
pillarBody = startProfileAt([blockSubdivisionWidth, 0], pillarPlane)
|
pillarBody = startProfileAt([blockSubdivisionWidth, 0], pillarPlane)
|
||||||
|> yLine(length=profileThickness)
|
|> yLine(length = profileThickness)
|
||||||
|> xLine(length=profileThickness)
|
|> xLine(length = profileThickness)
|
||||||
|> yLine(length=-profileThickness)
|
|> yLine(length = -profileThickness)
|
||||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||||
|> close()
|
|> close()
|
||||||
|> patternLinear2d(axis = [1, 0], instances = blockCount, distance = blockWidth)
|
|> patternLinear2d(axis = [1, 0], instances = blockCount, distance = blockWidth)
|
||||||
@ -80,9 +81,9 @@ pillarBody = startProfileAt([blockSubdivisionWidth, 0], pillarPlane)
|
|||||||
upperBeltPlane = startSketchOn(offsetPlane(XY, offset = blockHeight))
|
upperBeltPlane = startSketchOn(offsetPlane(XY, offset = blockHeight))
|
||||||
|
|
||||||
upperBeltBodyX = startProfileAt([0, 0], upperBeltPlane)
|
upperBeltBodyX = startProfileAt([0, 0], upperBeltPlane)
|
||||||
|> yLine(length=profileThickness)
|
|> yLine(length = profileThickness)
|
||||||
|> xLine(length=tableWidth)
|
|> xLine(length = tableWidth)
|
||||||
|> yLine(length=-profileThickness)
|
|> yLine(length = -profileThickness)
|
||||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||||
|> close()
|
|> close()
|
||||||
|> patternLinear2d(axis = [0, 1], instances = 2, distance = blockDepth)
|
|> patternLinear2d(axis = [0, 1], instances = 2, distance = blockDepth)
|
||||||
@ -90,20 +91,20 @@ upperBeltBodyX = startProfileAt([0, 0], upperBeltPlane)
|
|||||||
|
|
||||||
upperBeltLengthY = blockDepth - profileThickness
|
upperBeltLengthY = blockDepth - profileThickness
|
||||||
upperBeltBodyY = startProfileAt([0, profileThickness], upperBeltPlane)
|
upperBeltBodyY = startProfileAt([0, profileThickness], upperBeltPlane)
|
||||||
|> yLine(length=upperBeltLengthY)
|
|> yLine(length = upperBeltLengthY)
|
||||||
|> xLine(length=profileThickness)
|
|> xLine(length = profileThickness)
|
||||||
|> yLine(length=-upperBeltLengthY)
|
|> yLine(length = -upperBeltLengthY)
|
||||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||||
|> close()
|
|> close()
|
||||||
|> patternLinear2d(axis = [1, 0], instances = 2, distance = tableWidth-profileThickness)
|
|> patternLinear2d(axis = [1, 0], instances = 2, distance = tableWidth - profileThickness)
|
||||||
|> extrude(length = -profileThickness)
|
|> extrude(length = -profileThickness)
|
||||||
|
|
||||||
// sink
|
// sink
|
||||||
tableTopPlane = startSketchOn(offsetPlane(XY, offset = tableHeight))
|
tableTopPlane = startSketchOn(offsetPlane(XY, offset = tableHeight))
|
||||||
tableTopBody = startProfileAt([0, 0], tableTopPlane)
|
tableTopBody = startProfileAt([0, 0], tableTopPlane)
|
||||||
|> yLine(length=tableDepth)
|
|> yLine(length = tableDepth)
|
||||||
|> xLine(length=tableWidth)
|
|> xLine(length = tableWidth)
|
||||||
|> yLine(length=-tableDepth)
|
|> yLine(length = -tableDepth)
|
||||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||||
|> close()
|
|> close()
|
||||||
|> extrude(length = -metalThickness)
|
|> extrude(length = -metalThickness)
|
||||||
@ -114,23 +115,26 @@ sinkLength = 250
|
|||||||
sinkDepth = 200
|
sinkDepth = 200
|
||||||
sinkOffsetFront = 40
|
sinkOffsetFront = 40
|
||||||
sinkOffsetLeft = 350
|
sinkOffsetLeft = 350
|
||||||
sinkSpacing = tableWidth - sinkWidth - sinkOffsetLeft*2
|
sinkSpacing = tableWidth - sinkWidth - (sinkOffsetLeft * 2)
|
||||||
|
|
||||||
sinkPlaneOutside = startSketchOn(tableTopBody, 'START')
|
sinkPlaneOutside = startSketchOn(tableTopBody, 'START')
|
||||||
sinkBodyOutside = startProfileAt([-sinkOffsetLeft, sinkOffsetFront], sinkPlaneOutside)
|
sinkBodyOutside = startProfileAt([-sinkOffsetLeft, sinkOffsetFront], sinkPlaneOutside)
|
||||||
|> yLine(length=sinkLength)
|
|> yLine(length = sinkLength)
|
||||||
|> xLine(length=-sinkWidth)
|
|> xLine(length = -sinkWidth)
|
||||||
|> yLine(length=-sinkLength)
|
|> yLine(length = -sinkLength)
|
||||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||||
|> close()
|
|> close()
|
||||||
|> patternLinear2d(axis = [-1, 0], instances = sinkCount, distance = sinkSpacing)
|
|> patternLinear2d(axis = [-1, 0], instances = sinkCount, distance = sinkSpacing)
|
||||||
|> extrude(length = sinkDepth)
|
|> extrude(length = sinkDepth)
|
||||||
|
|
||||||
sinkPlaneInside = startSketchOn(tableTopBody, 'END')
|
sinkPlaneInside = startSketchOn(tableTopBody, 'END')
|
||||||
sinkBodyInside = startProfileAt([sinkOffsetLeft+metalThickness, sinkOffsetFront+metalThickness], sinkPlaneInside)
|
sinkBodyInside = startProfileAt([
|
||||||
|> yLine(length=sinkLength-metalThickness*2)
|
sinkOffsetLeft + metalThickness,
|
||||||
|> xLine(length=sinkWidth-metalThickness*2)
|
sinkOffsetFront + metalThickness
|
||||||
|> yLine(length=-sinkLength+metalThickness*2)
|
], sinkPlaneInside)
|
||||||
|
|> yLine(length = sinkLength - (metalThickness * 2))
|
||||||
|
|> xLine(length = sinkWidth - (metalThickness * 2))
|
||||||
|
|> yLine(length = -sinkLength + metalThickness * 2)
|
||||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||||
|> close()
|
|> close()
|
||||||
|> patternLinear2d(axis = [1, 0], instances = sinkCount, distance = sinkSpacing)
|
|> patternLinear2d(axis = [1, 0], instances = sinkCount, distance = sinkSpacing)
|
||||||
@ -138,30 +142,30 @@ sinkBodyInside = startProfileAt([sinkOffsetLeft+metalThickness, sinkOffsetFront+
|
|||||||
|
|
||||||
// door panels
|
// door panels
|
||||||
doorGap = 2
|
doorGap = 2
|
||||||
doorWidth = blockSubdivisionWidth - profileThickness - doorGap*2
|
doorWidth = blockSubdivisionWidth - profileThickness - (doorGap * 2)
|
||||||
doorStart = profileThickness+doorGap
|
doorStart = profileThickness + doorGap
|
||||||
doorHeightAboveTheFloor = pillarHeightAboveTheFloor + doorGap
|
doorHeightAboveTheFloor = pillarHeightAboveTheFloor + doorGap
|
||||||
doorHeight = blockHeight - doorHeightAboveTheFloor - profileThickness - doorGap
|
doorHeight = blockHeight - doorHeightAboveTheFloor - profileThickness - doorGap
|
||||||
doorCount = blockCount * blockSubdivisionCount
|
doorCount = blockCount * blockSubdivisionCount
|
||||||
|
|
||||||
doorPlane = startSketchOn(offsetPlane(XY, offset = doorHeightAboveTheFloor))
|
doorPlane = startSketchOn(offsetPlane(XY, offset = doorHeightAboveTheFloor))
|
||||||
doorBody = startProfileAt([doorStart, 0], doorPlane)
|
doorBody = startProfileAt([doorStart, 0], doorPlane)
|
||||||
|> yLine(length=profileThickness)
|
|> yLine(length = profileThickness)
|
||||||
|> xLine(length=doorWidth)
|
|> xLine(length = doorWidth)
|
||||||
|> yLine(length=-profileThickness)
|
|> yLine(length = -profileThickness)
|
||||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||||
|> close()
|
|> close()
|
||||||
|> patternLinear2d(axis = [1, 0], instances = doorCount, distance = blockSubdivisionWidth)
|
|> patternLinear2d(axis = [1, 0], instances = doorCount, distance = blockSubdivisionWidth)
|
||||||
|> extrude(length = doorHeight)
|
|> extrude(length = doorHeight)
|
||||||
|
|
||||||
// side panels
|
// side panels
|
||||||
panelWidth = blockDepth - profileThickness - doorGap*2
|
panelWidth = blockDepth - profileThickness - (doorGap * 2)
|
||||||
panelCount = doorCount + 1
|
panelCount = doorCount + 1
|
||||||
panelSpacing = tableWidth - profileThickness
|
panelSpacing = tableWidth - profileThickness
|
||||||
panelBody = startProfileAt([0, doorStart], doorPlane)
|
panelBody = startProfileAt([0, doorStart], doorPlane)
|
||||||
|> yLine(length=panelWidth)
|
|> yLine(length = panelWidth)
|
||||||
|> xLine(length=profileThickness)
|
|> xLine(length = profileThickness)
|
||||||
|> yLine(length=-panelWidth)
|
|> yLine(length = -panelWidth)
|
||||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||||
|> close()
|
|> close()
|
||||||
|> patternLinear2d(axis = [1, 0], instances = 2, distance = panelSpacing)
|
|> patternLinear2d(axis = [1, 0], instances = 2, distance = panelSpacing)
|
||||||
@ -179,22 +183,25 @@ handleLengthSegmentB = handleWidth - (handleFillet * 2)
|
|||||||
handlePlane = startSketchOn(offsetPlane(XY, offset = handleHeightAboveTheFloor))
|
handlePlane = startSketchOn(offsetPlane(XY, offset = handleHeightAboveTheFloor))
|
||||||
|
|
||||||
handleProfilePath = startProfileAt([0 + handleOffset, 0], handlePlane)
|
handleProfilePath = startProfileAt([0 + handleOffset, 0], handlePlane)
|
||||||
|> yLine(length=-handleLengthSegmentA)
|
|> yLine(length = -handleLengthSegmentA)
|
||||||
|> tangentialArcTo([
|
|> tangentialArcTo([
|
||||||
handleFillet + handleOffset,
|
handleFillet + handleOffset,
|
||||||
-handleDepth
|
-handleDepth
|
||||||
], %)
|
], %)
|
||||||
|> xLine(length=handleLengthSegmentB)
|
|> xLine(length = handleLengthSegmentB)
|
||||||
|> tangentialArcTo([
|
|> tangentialArcTo([
|
||||||
handleOffset + handleWidth,
|
handleOffset + handleWidth,
|
||||||
-handleLengthSegmentA
|
-handleLengthSegmentA
|
||||||
], %)
|
], %)
|
||||||
|> yLine(length=handleLengthSegmentA)
|
|> yLine(length = handleLengthSegmentA)
|
||||||
handleSectionPlane = startSketchOn(XZ)
|
handleSectionPlane = startSketchOn(XZ)
|
||||||
handleProfileSection = circle(
|
handleProfileSection = circle(
|
||||||
handleSectionPlane,
|
handleSectionPlane,
|
||||||
center = [handleOffset, handleHeightAboveTheFloor],
|
center = [
|
||||||
radius = 2)
|
handleOffset,
|
||||||
|
handleHeightAboveTheFloor
|
||||||
|
],
|
||||||
|
radius = 2,
|
||||||
|
)
|
||||||
handleBody = sweep(handleProfileSection, path = handleProfilePath)
|
handleBody = sweep(handleProfileSection, path = handleProfilePath)
|
||||||
|> patternLinear3d(axis = [1, 0, 0], instances = doorCount, distance = blockSubdivisionWidth)
|
|> patternLinear3d(axis = [1, 0, 0], instances = doorCount, distance = blockSubdivisionWidth)
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
@settings(defaultLengthUnit = in)
|
@settings(defaultLengthUnit = in)
|
||||||
|
|
||||||
// Define Beam Dimensions
|
// Define Beam Dimensions
|
||||||
beamLength = 6*ft()
|
beamLength = 6 * ft()
|
||||||
beamHeight = 4
|
beamHeight = 4
|
||||||
flangeWidth = 2.663
|
flangeWidth = 2.663
|
||||||
flangeThickness = 0.293
|
flangeThickness = 0.293
|
||||||
|
@ -52,19 +52,22 @@ armPartB = armFn(XZ, armLength, hingeHeight * 2.5 + hingeGap * 2)
|
|||||||
|
|
||||||
// mirror
|
// mirror
|
||||||
fn mirrorFn(plane, offsetX, offsetY, altitude, radius, tiefe, gestellR, gestellD) {
|
fn mirrorFn(plane, offsetX, offsetY, altitude, radius, tiefe, gestellR, gestellD) {
|
||||||
armPlane = startSketchOn(offsetPlane(plane, offset = offsetY - (tiefe / 2)))
|
armPlane = startSketchOn( offsetPlane(plane, offset = offsetY - (tiefe / 2)))
|
||||||
armBody = circle(armPlane, center = [offsetX, altitude], radius = radius)
|
armBody = circle(armPlane, center = [offsetX, altitude], radius = radius)
|
||||||
|> extrude(length = tiefe)
|
|> extrude(length = tiefe)
|
||||||
|
|
||||||
archBody = startProfileAt([offsetX-gestellR, altitude], armPlane)
|
archBody = startProfileAt([offsetX - gestellR, altitude], armPlane)
|
||||||
|> xLine(length = gestellD)
|
|> xLine(length = gestellD)
|
||||||
|> arcTo({
|
|> arcTo({
|
||||||
interior = [offsetX, altitude-gestellR],
|
interior = [offsetX, altitude - gestellR],
|
||||||
end = [offsetX+gestellR, altitude]
|
end = [offsetX + gestellR, altitude]
|
||||||
}, %)
|
}, %)
|
||||||
|> xLine(length = gestellD)
|
|> xLine(length = gestellD)
|
||||||
|> arcTo({
|
|> arcTo({
|
||||||
interior = [offsetX, altitude-gestellR-gestellD],
|
interior = [
|
||||||
|
offsetX,
|
||||||
|
altitude - gestellR - gestellD
|
||||||
|
],
|
||||||
end = [profileStartX(%), profileStartY(%)]
|
end = [profileStartX(%), profileStartY(%)]
|
||||||
}, %)
|
}, %)
|
||||||
|> close()
|
|> close()
|
||||||
@ -72,4 +75,4 @@ fn mirrorFn(plane, offsetX, offsetY, altitude, radius, tiefe, gestellR, gestellD
|
|||||||
return armBody
|
return armBody
|
||||||
}
|
}
|
||||||
|
|
||||||
mirror = mirrorFn(XZ, armLength, armLength, hingeHeight * 4 + hingeGap * 3 + mirrorRadius+archToMirrorGap+archThickness, mirrorRadius, mirrorThickness, archRadius, archThickness)
|
mirror = mirrorFn(XZ, armLength, armLength, hingeHeight * 4 + hingeGap * 3 + mirrorRadius + archToMirrorGap + archThickness, mirrorRadius, mirrorThickness, archRadius, archThickness)
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
// set units
|
// set units
|
||||||
@settings(defaultLengthUnit = in)
|
@settings(defaultLengthUnit = in)
|
||||||
|
|
||||||
|
|
||||||
// import constants
|
// import constants
|
||||||
import boltDiameter, boltLength, boltHeadLength, boltHeadDiameter, boltHexDrive, boltHexFlatLength, boltThreadLength from "globals.kcl"
|
import boltDiameter, boltLength, boltHeadLength, boltHeadDiameter, boltHexDrive, boltHexFlatLength, boltThreadLength from "globals.kcl"
|
||||||
|
|
||||||
|
@ -19,27 +19,15 @@ import pipe from "1120t74-pipe.kcl"
|
|||||||
flange()
|
flange()
|
||||||
flange()
|
flange()
|
||||||
|> rotate(axis = [0, 1, 0], angle = 180)
|
|> rotate(axis = [0, 1, 0], angle = 180)
|
||||||
|> translate(
|
|> translate(x = 0, y = 0, z = flangeBackHeight * 2 + gasketThickness)
|
||||||
x = 0,
|
|
||||||
y = 0,
|
|
||||||
z = flangeBackHeight * 2 + gasketThickness,
|
|
||||||
)
|
|
||||||
|
|
||||||
// place gasket between the flanges
|
// place gasket between the flanges
|
||||||
gasket()
|
gasket()
|
||||||
|> translate(
|
|> translate(x = 0, y = 0, z = -flangeBackHeight - gasketThickness)
|
||||||
x = 0,
|
|
||||||
y = 0,
|
|
||||||
z = -flangeBackHeight - gasketThickness
|
|
||||||
)
|
|
||||||
|
|
||||||
// place eight washers (four front, four back)
|
// place eight washers (four front, four back)
|
||||||
washer()
|
washer()
|
||||||
|> translate(
|
|> translate(x = mountingHolePlacementDiameter / 2, y = 0, z = flangeBaseThickness)
|
||||||
x = mountingHolePlacementDiameter / 2,
|
|
||||||
y = 0,
|
|
||||||
z = flangeBaseThickness
|
|
||||||
)
|
|
||||||
|> patternCircular3d(
|
|> patternCircular3d(
|
||||||
%,
|
%,
|
||||||
instances = 4,
|
instances = 4,
|
||||||
@ -57,11 +45,7 @@ washer()
|
|||||||
|
|
||||||
// place four bolts
|
// place four bolts
|
||||||
bolt()
|
bolt()
|
||||||
|> translate(
|
|> translate(x = mountingHolePlacementDiameter / 2, y = 0, z = flangeBaseThickness + washerThickness)
|
||||||
x = mountingHolePlacementDiameter / 2,
|
|
||||||
y = 0,
|
|
||||||
z = flangeBaseThickness + washerThickness,
|
|
||||||
)
|
|
||||||
|> rotate(roll = 90, pitch = 0, yaw = 0)
|
|> rotate(roll = 90, pitch = 0, yaw = 0)
|
||||||
|> patternCircular3d(
|
|> patternCircular3d(
|
||||||
%,
|
%,
|
||||||
@ -74,11 +58,7 @@ bolt()
|
|||||||
|
|
||||||
// place four hex nuts
|
// place four hex nuts
|
||||||
hexNut()
|
hexNut()
|
||||||
|> translate(
|
|> translate(x = mountingHolePlacementDiameter / 2, y = 0, z = -(flangeBackHeight * 2 + gasketThickness + flangeBaseThickness + washerThickness + hexNutThickness))
|
||||||
x = mountingHolePlacementDiameter / 2,
|
|
||||||
y = 0,
|
|
||||||
z = -(flangeBackHeight * 2 + gasketThickness + flangeBaseThickness + washerThickness + hexNutThickness),
|
|
||||||
)
|
|
||||||
|> patternCircular3d(
|
|> patternCircular3d(
|
||||||
%,
|
%,
|
||||||
instances = 4,
|
instances = 4,
|
||||||
|
@ -14,7 +14,7 @@ radius = 10
|
|||||||
depth = 30
|
depth = 30
|
||||||
distanceToInsideEdge = slateWidthHalf + templateThickness + templateGap
|
distanceToInsideEdge = slateWidthHalf + templateThickness + templateGap
|
||||||
sketch001 = startSketchOn(XZ)
|
sketch001 = startSketchOn(XZ)
|
||||||
|> startProfileAt([ZERO, depth + templateGap], %)
|
|> startProfileAt([0, depth + templateGap], %)
|
||||||
|> xLine(length = slateWidthHalf - radius, tag = $seg01)
|
|> xLine(length = slateWidthHalf - radius, tag = $seg01)
|
||||||
|> arc({
|
|> arc({
|
||||||
angleEnd = 0,
|
angleEnd = 0,
|
||||||
@ -28,7 +28,7 @@ sketch001 = startSketchOn(XZ)
|
|||||||
|> yLine(length = templateThickness * 2, tag = $seg08)
|
|> yLine(length = templateThickness * 2, tag = $seg08)
|
||||||
|> xLine(endAbsolute = segEndX(seg02) + 0, tag = $seg05)
|
|> xLine(endAbsolute = segEndX(seg02) + 0, tag = $seg05)
|
||||||
|> yLine(endAbsolute = segEndY(seg01) + templateThickness, tag = $seg10)
|
|> yLine(endAbsolute = segEndY(seg01) + templateThickness, tag = $seg10)
|
||||||
|> xLine(endAbsolute = ZERO, tag = $seg04)
|
|> xLine(endAbsolute = 0, tag = $seg04)
|
||||||
|> xLine(length = -segLen(seg04))
|
|> xLine(length = -segLen(seg04))
|
||||||
|> yLine(length = -segLen(seg10))
|
|> yLine(length = -segLen(seg10))
|
||||||
|> xLine(length = -segLen(seg05))
|
|> xLine(length = -segLen(seg05))
|
||||||
|
@ -28,7 +28,7 @@ sketch001 = startSketchOn(XZ)
|
|||||||
|> yLine(endAbsolute = -templateGap * 2 - (templateDiameter / 2), tag = $seg05)
|
|> yLine(endAbsolute = -templateGap * 2 - (templateDiameter / 2), tag = $seg05)
|
||||||
|> xLine(endAbsolute = slateWidthHalf + templateThickness, tag = $seg04)
|
|> xLine(endAbsolute = slateWidthHalf + templateThickness, tag = $seg04)
|
||||||
|> yLine(length = -length002, tag = $seg03)
|
|> yLine(length = -length002, tag = $seg03)
|
||||||
|> xLine(endAbsolute = ZERO, tag = $seg02)
|
|> xLine(endAbsolute = 0, tag = $seg02)
|
||||||
// |> line(end = [7.78, 11.16])
|
// |> line(end = [7.78, 11.16])
|
||||||
|> xLine(length = -segLen(seg02))
|
|> xLine(length = -segLen(seg02))
|
||||||
|> yLine(length = segLen(seg03))
|
|> yLine(length = segLen(seg03))
|
||||||
|
@ -32,25 +32,13 @@ talkButton()
|
|||||||
|
|
||||||
// import the frequency knob
|
// import the frequency knob
|
||||||
knob()
|
knob()
|
||||||
|> translate(
|
|> translate(x = width / 2 - 0.70, y = -thickness / 2, z = height / 2)
|
||||||
x = width / 2 - 0.70,
|
|
||||||
y = -thickness / 2,
|
|
||||||
z = height / 2
|
|
||||||
)
|
|
||||||
|
|
||||||
// import the buttons
|
// import the buttons
|
||||||
button()
|
button()
|
||||||
|> translate(
|
|> translate(x = -(screenWidth / 2 + tolerance), y = -1, z = screenYPosition)
|
||||||
x = -(screenWidth / 2 + tolerance),
|
|
||||||
y = -1,
|
|
||||||
z = screenYPosition
|
|
||||||
)
|
|
||||||
button()
|
button()
|
||||||
|> translate(
|
|> translate(x = -(screenWidth / 2 + tolerance), y = -1, z = screenYPosition - buttonHeight - (tolerance * 2))
|
||||||
x = -(screenWidth / 2 + tolerance),
|
|
||||||
y = -1,
|
|
||||||
z = screenYPosition - buttonHeight - (tolerance * 2)
|
|
||||||
)
|
|
||||||
button()
|
button()
|
||||||
|> rotate(
|
|> rotate(
|
||||||
%,
|
%,
|
||||||
|
28
rust/Cargo.lock
generated
@ -1780,7 +1780,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-bumper"
|
name = "kcl-bumper"
|
||||||
version = "0.1.55"
|
version = "0.1.57"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
"clap",
|
||||||
@ -1791,7 +1791,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-derive-docs"
|
name = "kcl-derive-docs"
|
||||||
version = "0.1.55"
|
version = "0.1.57"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"Inflector",
|
"Inflector",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
@ -1810,7 +1810,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-directory-test-macro"
|
name = "kcl-directory-test-macro"
|
||||||
version = "0.1.55"
|
version = "0.1.57"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@ -1819,7 +1819,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-language-server"
|
name = "kcl-language-server"
|
||||||
version = "0.2.55"
|
version = "0.2.57"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
"clap",
|
||||||
@ -1840,7 +1840,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-language-server-release"
|
name = "kcl-language-server-release"
|
||||||
version = "0.1.55"
|
version = "0.1.57"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
"clap",
|
||||||
@ -1860,7 +1860,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-lib"
|
name = "kcl-lib"
|
||||||
version = "0.2.55"
|
version = "0.2.57"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"approx 0.5.1",
|
"approx 0.5.1",
|
||||||
@ -1928,7 +1928,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-python-bindings"
|
name = "kcl-python-bindings"
|
||||||
version = "0.3.55"
|
version = "0.3.57"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"kcl-lib",
|
"kcl-lib",
|
||||||
@ -1943,7 +1943,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-test-server"
|
name = "kcl-test-server"
|
||||||
version = "0.1.55"
|
version = "0.1.57"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"hyper 0.14.32",
|
"hyper 0.14.32",
|
||||||
@ -1956,7 +1956,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-to-core"
|
name = "kcl-to-core"
|
||||||
version = "0.1.55"
|
version = "0.1.57"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
@ -1970,7 +1970,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-wasm-lib"
|
name = "kcl-wasm-lib"
|
||||||
version = "0.1.55"
|
version = "0.1.57"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bson",
|
"bson",
|
||||||
"console_error_panic_hook",
|
"console_error_panic_hook",
|
||||||
@ -1996,9 +1996,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kittycad"
|
name = "kittycad"
|
||||||
version = "0.3.33"
|
version = "0.3.36"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4f6f65645cc07a8f43c34584e4979bf4da16c047cce50c4715fa9381227574d5"
|
checksum = "0a345fd2a4cb16205f32bd1aa41715045830c59d78c59927fca6580e2a651ac9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
@ -2033,9 +2033,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kittycad-modeling-cmds"
|
name = "kittycad-modeling-cmds"
|
||||||
version = "0.2.107"
|
version = "0.2.108"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cb129c1f4906a76e3518e58f61968f16cb56f1279366415d2bae6059aa68fce8"
|
checksum = "58f5fbcfb0fe3384592829cd1a5109aa45fb6a3ffc5ff2d164d2fd528ffd4641"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"chrono",
|
"chrono",
|
||||||
|
@ -35,8 +35,8 @@ clap = { version = "4.5.31", features = ["derive"] }
|
|||||||
dashmap = { version = "6.1.0" }
|
dashmap = { version = "6.1.0" }
|
||||||
http = "1"
|
http = "1"
|
||||||
indexmap = "2.7.0"
|
indexmap = "2.7.0"
|
||||||
kittycad = { version = "0.3.33", default-features = false, features = ["js", "requests"] }
|
kittycad = { version = "0.3.36", default-features = false, features = ["js", "requests"] }
|
||||||
kittycad-modeling-cmds = { version = "0.2.107", features = ["ts-rs", "websocket"] }
|
kittycad-modeling-cmds = { version = "0.2.108", features = ["ts-rs", "websocket"] }
|
||||||
lazy_static = "1.5.0"
|
lazy_static = "1.5.0"
|
||||||
miette = "7.5.0"
|
miette = "7.5.0"
|
||||||
pyo3 = { version = "0.24.0" }
|
pyo3 = { version = "0.24.0" }
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "kcl-bumper"
|
name = "kcl-bumper"
|
||||||
version = "0.1.55"
|
version = "0.1.57"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
repository = "https://github.com/KittyCAD/modeling-api"
|
repository = "https://github.com/KittyCAD/modeling-api"
|
||||||
rust-version = "1.76"
|
rust-version = "1.76"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "kcl-derive-docs"
|
name = "kcl-derive-docs"
|
||||||
description = "A tool for generating documentation from Rust derive macros"
|
description = "A tool for generating documentation from Rust derive macros"
|
||||||
version = "0.1.55"
|
version = "0.1.57"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/KittyCAD/modeling-app"
|
repository = "https://github.com/KittyCAD/modeling-app"
|
||||||
|
@ -329,7 +329,7 @@ fn do_stdlib_inner(
|
|||||||
let camel_case_arg_name = to_camel_case(&arg_name);
|
let camel_case_arg_name = to_camel_case(&arg_name);
|
||||||
if ty_string != "ExecState" && ty_string != "Args" {
|
if ty_string != "ExecState" && ty_string != "Args" {
|
||||||
let schema = quote! {
|
let schema = quote! {
|
||||||
#docs_crate::cleanup_number_tuples_root(generator.root_schema_for::<#ty_ident>())
|
generator.root_schema_for::<#ty_ident>()
|
||||||
};
|
};
|
||||||
arg_types.push(quote! {
|
arg_types.push(quote! {
|
||||||
#docs_crate::StdLibFnArg {
|
#docs_crate::StdLibFnArg {
|
||||||
@ -394,7 +394,7 @@ fn do_stdlib_inner(
|
|||||||
let return_type = if !ret_ty_string.is_empty() || ret_ty_string != "()" {
|
let return_type = if !ret_ty_string.is_empty() || ret_ty_string != "()" {
|
||||||
let ret_ty_string = rust_type_to_openapi_type(&ret_ty_string);
|
let ret_ty_string = rust_type_to_openapi_type(&ret_ty_string);
|
||||||
quote! {
|
quote! {
|
||||||
let schema = #docs_crate::cleanup_number_tuples_root(generator.root_schema_for::<#return_type_inner>());
|
let schema = generator.root_schema_for::<#return_type_inner>();
|
||||||
Some(#docs_crate::StdLibFnArg {
|
Some(#docs_crate::StdLibFnArg {
|
||||||
name: "".to_string(),
|
name: "".to_string(),
|
||||||
type_: #ret_ty_string.to_string(),
|
type_: #ret_ty_string.to_string(),
|
||||||
@ -816,7 +816,7 @@ fn generate_code_block_test(fn_name: &str, code_block: &str, index: usize) -> pr
|
|||||||
async fn #test_name() -> miette::Result<()> {
|
async fn #test_name() -> miette::Result<()> {
|
||||||
let code = #code_block;
|
let code = #code_block;
|
||||||
// Note, `crate` must be kcl_lib
|
// Note, `crate` must be kcl_lib
|
||||||
let result = match crate::test_server::execute_and_snapshot(code, crate::settings::types::UnitLength::Mm, None).await {
|
let result = match crate::test_server::execute_and_snapshot(code, None).await {
|
||||||
Err(crate::errors::ExecError::Kcl(e)) => {
|
Err(crate::errors::ExecError::Kcl(e)) => {
|
||||||
return Err(miette::Report::new(crate::errors::Report {
|
return Err(miette::Report::new(crate::errors::Report {
|
||||||
error: e.error,
|
error: e.error,
|
||||||
|
@ -31,13 +31,7 @@ mod test_examples_someFn {
|
|||||||
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
|
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
|
||||||
async fn kcl_test_example_someFn0() -> miette::Result<()> {
|
async fn kcl_test_example_someFn0() -> miette::Result<()> {
|
||||||
let code = "someFn()";
|
let code = "someFn()";
|
||||||
let result = match crate::test_server::execute_and_snapshot(
|
let result = match crate::test_server::execute_and_snapshot(code, None).await {
|
||||||
code,
|
|
||||||
crate::settings::types::UnitLength::Mm,
|
|
||||||
None,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
{
|
|
||||||
Err(crate::errors::ExecError::Kcl(e)) => {
|
Err(crate::errors::ExecError::Kcl(e)) => {
|
||||||
return Err(miette::Report::new(crate::errors::Report {
|
return Err(miette::Report::new(crate::errors::Report {
|
||||||
error: e.error,
|
error: e.error,
|
||||||
@ -108,7 +102,7 @@ impl crate::docs::StdLibFn for SomeFn {
|
|||||||
vec![crate::docs::StdLibFnArg {
|
vec![crate::docs::StdLibFnArg {
|
||||||
name: "data".to_string(),
|
name: "data".to_string(),
|
||||||
type_: "Foo".to_string(),
|
type_: "Foo".to_string(),
|
||||||
schema: crate::docs::cleanup_number_tuples_root(generator.root_schema_for::<Foo>()),
|
schema: generator.root_schema_for::<Foo>(),
|
||||||
required: true,
|
required: true,
|
||||||
label_required: true,
|
label_required: true,
|
||||||
description: String::new().to_string(),
|
description: String::new().to_string(),
|
||||||
@ -120,7 +114,7 @@ impl crate::docs::StdLibFn for SomeFn {
|
|||||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||||
settings.inline_subschemas = inline_subschemas;
|
settings.inline_subschemas = inline_subschemas;
|
||||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||||
let schema = crate::docs::cleanup_number_tuples_root(generator.root_schema_for::<i32>());
|
let schema = generator.root_schema_for::<i32>();
|
||||||
Some(crate::docs::StdLibFnArg {
|
Some(crate::docs::StdLibFnArg {
|
||||||
name: "".to_string(),
|
name: "".to_string(),
|
||||||
type_: "i32".to_string(),
|
type_: "i32".to_string(),
|
||||||
|
@ -31,13 +31,7 @@ mod test_examples_someFn {
|
|||||||
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
|
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
|
||||||
async fn kcl_test_example_someFn0() -> miette::Result<()> {
|
async fn kcl_test_example_someFn0() -> miette::Result<()> {
|
||||||
let code = "someFn()";
|
let code = "someFn()";
|
||||||
let result = match crate::test_server::execute_and_snapshot(
|
let result = match crate::test_server::execute_and_snapshot(code, None).await {
|
||||||
code,
|
|
||||||
crate::settings::types::UnitLength::Mm,
|
|
||||||
None,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
{
|
|
||||||
Err(crate::errors::ExecError::Kcl(e)) => {
|
Err(crate::errors::ExecError::Kcl(e)) => {
|
||||||
return Err(miette::Report::new(crate::errors::Report {
|
return Err(miette::Report::new(crate::errors::Report {
|
||||||
error: e.error,
|
error: e.error,
|
||||||
@ -108,7 +102,7 @@ impl crate::docs::StdLibFn for SomeFn {
|
|||||||
vec![crate::docs::StdLibFnArg {
|
vec![crate::docs::StdLibFnArg {
|
||||||
name: "data".to_string(),
|
name: "data".to_string(),
|
||||||
type_: "string".to_string(),
|
type_: "string".to_string(),
|
||||||
schema: crate::docs::cleanup_number_tuples_root(generator.root_schema_for::<str>()),
|
schema: generator.root_schema_for::<str>(),
|
||||||
required: true,
|
required: true,
|
||||||
label_required: true,
|
label_required: true,
|
||||||
description: String::new().to_string(),
|
description: String::new().to_string(),
|
||||||
@ -120,7 +114,7 @@ impl crate::docs::StdLibFn for SomeFn {
|
|||||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||||
settings.inline_subschemas = inline_subschemas;
|
settings.inline_subschemas = inline_subschemas;
|
||||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||||
let schema = crate::docs::cleanup_number_tuples_root(generator.root_schema_for::<i32>());
|
let schema = generator.root_schema_for::<i32>();
|
||||||
Some(crate::docs::StdLibFnArg {
|
Some(crate::docs::StdLibFnArg {
|
||||||
name: "".to_string(),
|
name: "".to_string(),
|
||||||
type_: "i32".to_string(),
|
type_: "i32".to_string(),
|
||||||
|
@ -32,13 +32,7 @@ mod test_examples_show {
|
|||||||
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
|
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
|
||||||
async fn kcl_test_example_show0() -> miette::Result<()> {
|
async fn kcl_test_example_show0() -> miette::Result<()> {
|
||||||
let code = "This is another code block.\nyes sirrr.\nshow";
|
let code = "This is another code block.\nyes sirrr.\nshow";
|
||||||
let result = match crate::test_server::execute_and_snapshot(
|
let result = match crate::test_server::execute_and_snapshot(code, None).await {
|
||||||
code,
|
|
||||||
crate::settings::types::UnitLength::Mm,
|
|
||||||
None,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
{
|
|
||||||
Err(crate::errors::ExecError::Kcl(e)) => {
|
Err(crate::errors::ExecError::Kcl(e)) => {
|
||||||
return Err(miette::Report::new(crate::errors::Report {
|
return Err(miette::Report::new(crate::errors::Report {
|
||||||
error: e.error,
|
error: e.error,
|
||||||
@ -109,9 +103,7 @@ impl crate::docs::StdLibFn for Show {
|
|||||||
vec![crate::docs::StdLibFnArg {
|
vec![crate::docs::StdLibFnArg {
|
||||||
name: "args".to_string(),
|
name: "args".to_string(),
|
||||||
type_: "[number]".to_string(),
|
type_: "[number]".to_string(),
|
||||||
schema: crate::docs::cleanup_number_tuples_root(
|
schema: generator.root_schema_for::<[f64; 2usize]>(),
|
||||||
generator.root_schema_for::<[f64; 2usize]>(),
|
|
||||||
),
|
|
||||||
required: true,
|
required: true,
|
||||||
label_required: true,
|
label_required: true,
|
||||||
description: String::new().to_string(),
|
description: String::new().to_string(),
|
||||||
@ -123,7 +115,7 @@ impl crate::docs::StdLibFn for Show {
|
|||||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||||
settings.inline_subschemas = inline_subschemas;
|
settings.inline_subschemas = inline_subschemas;
|
||||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||||
let schema = crate::docs::cleanup_number_tuples_root(generator.root_schema_for::<f64>());
|
let schema = generator.root_schema_for::<f64>();
|
||||||
Some(crate::docs::StdLibFnArg {
|
Some(crate::docs::StdLibFnArg {
|
||||||
name: "".to_string(),
|
name: "".to_string(),
|
||||||
type_: "number".to_string(),
|
type_: "number".to_string(),
|
||||||
|
@ -32,13 +32,7 @@ mod test_examples_show {
|
|||||||
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
|
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
|
||||||
async fn kcl_test_example_show0() -> miette::Result<()> {
|
async fn kcl_test_example_show0() -> miette::Result<()> {
|
||||||
let code = "This is code.\nIt does other shit.\nshow";
|
let code = "This is code.\nIt does other shit.\nshow";
|
||||||
let result = match crate::test_server::execute_and_snapshot(
|
let result = match crate::test_server::execute_and_snapshot(code, None).await {
|
||||||
code,
|
|
||||||
crate::settings::types::UnitLength::Mm,
|
|
||||||
None,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
{
|
|
||||||
Err(crate::errors::ExecError::Kcl(e)) => {
|
Err(crate::errors::ExecError::Kcl(e)) => {
|
||||||
return Err(miette::Report::new(crate::errors::Report {
|
return Err(miette::Report::new(crate::errors::Report {
|
||||||
error: e.error,
|
error: e.error,
|
||||||
@ -109,7 +103,7 @@ impl crate::docs::StdLibFn for Show {
|
|||||||
vec![crate::docs::StdLibFnArg {
|
vec![crate::docs::StdLibFnArg {
|
||||||
name: "args".to_string(),
|
name: "args".to_string(),
|
||||||
type_: "number".to_string(),
|
type_: "number".to_string(),
|
||||||
schema: crate::docs::cleanup_number_tuples_root(generator.root_schema_for::<f64>()),
|
schema: generator.root_schema_for::<f64>(),
|
||||||
required: true,
|
required: true,
|
||||||
label_required: true,
|
label_required: true,
|
||||||
description: String::new().to_string(),
|
description: String::new().to_string(),
|
||||||
@ -121,7 +115,7 @@ impl crate::docs::StdLibFn for Show {
|
|||||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||||
settings.inline_subschemas = inline_subschemas;
|
settings.inline_subschemas = inline_subschemas;
|
||||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||||
let schema = crate::docs::cleanup_number_tuples_root(generator.root_schema_for::<f64>());
|
let schema = generator.root_schema_for::<f64>();
|
||||||
Some(crate::docs::StdLibFnArg {
|
Some(crate::docs::StdLibFnArg {
|
||||||
name: "".to_string(),
|
name: "".to_string(),
|
||||||
type_: "number".to_string(),
|
type_: "number".to_string(),
|
||||||
|
@ -33,13 +33,7 @@ mod test_examples_my_func {
|
|||||||
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
|
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
|
||||||
async fn kcl_test_example_my_func0() -> miette::Result<()> {
|
async fn kcl_test_example_my_func0() -> miette::Result<()> {
|
||||||
let code = "This is another code block.\nyes sirrr.\nmyFunc";
|
let code = "This is another code block.\nyes sirrr.\nmyFunc";
|
||||||
let result = match crate::test_server::execute_and_snapshot(
|
let result = match crate::test_server::execute_and_snapshot(code, None).await {
|
||||||
code,
|
|
||||||
crate::settings::types::UnitLength::Mm,
|
|
||||||
None,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
{
|
|
||||||
Err(crate::errors::ExecError::Kcl(e)) => {
|
Err(crate::errors::ExecError::Kcl(e)) => {
|
||||||
return Err(miette::Report::new(crate::errors::Report {
|
return Err(miette::Report::new(crate::errors::Report {
|
||||||
error: e.error,
|
error: e.error,
|
||||||
@ -110,9 +104,7 @@ impl crate::docs::StdLibFn for MyFunc {
|
|||||||
vec![crate::docs::StdLibFnArg {
|
vec![crate::docs::StdLibFnArg {
|
||||||
name: "args".to_string(),
|
name: "args".to_string(),
|
||||||
type_: "kittycad::types::InputFormat".to_string(),
|
type_: "kittycad::types::InputFormat".to_string(),
|
||||||
schema: crate::docs::cleanup_number_tuples_root(
|
schema: generator.root_schema_for::<Option<kittycad::types::InputFormat>>(),
|
||||||
generator.root_schema_for::<Option<kittycad::types::InputFormat>>(),
|
|
||||||
),
|
|
||||||
required: false,
|
required: false,
|
||||||
label_required: true,
|
label_required: true,
|
||||||
description: String::new().to_string(),
|
description: String::new().to_string(),
|
||||||
@ -124,8 +116,7 @@ impl crate::docs::StdLibFn for MyFunc {
|
|||||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||||
settings.inline_subschemas = inline_subschemas;
|
settings.inline_subschemas = inline_subschemas;
|
||||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||||
let schema =
|
let schema = generator.root_schema_for::<Vec<Sketch>>();
|
||||||
crate::docs::cleanup_number_tuples_root(generator.root_schema_for::<Vec<Sketch>>());
|
|
||||||
Some(crate::docs::StdLibFnArg {
|
Some(crate::docs::StdLibFnArg {
|
||||||
name: "".to_string(),
|
name: "".to_string(),
|
||||||
type_: "[Sketch]".to_string(),
|
type_: "[Sketch]".to_string(),
|
||||||
|
@ -33,13 +33,7 @@ mod test_examples_line_to {
|
|||||||
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
|
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
|
||||||
async fn kcl_test_example_line_to0() -> miette::Result<()> {
|
async fn kcl_test_example_line_to0() -> miette::Result<()> {
|
||||||
let code = "This is another code block.\nyes sirrr.\nlineTo";
|
let code = "This is another code block.\nyes sirrr.\nlineTo";
|
||||||
let result = match crate::test_server::execute_and_snapshot(
|
let result = match crate::test_server::execute_and_snapshot(code, None).await {
|
||||||
code,
|
|
||||||
crate::settings::types::UnitLength::Mm,
|
|
||||||
None,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
{
|
|
||||||
Err(crate::errors::ExecError::Kcl(e)) => {
|
Err(crate::errors::ExecError::Kcl(e)) => {
|
||||||
return Err(miette::Report::new(crate::errors::Report {
|
return Err(miette::Report::new(crate::errors::Report {
|
||||||
error: e.error,
|
error: e.error,
|
||||||
@ -111,9 +105,7 @@ impl crate::docs::StdLibFn for LineTo {
|
|||||||
crate::docs::StdLibFnArg {
|
crate::docs::StdLibFnArg {
|
||||||
name: "data".to_string(),
|
name: "data".to_string(),
|
||||||
type_: "LineToData".to_string(),
|
type_: "LineToData".to_string(),
|
||||||
schema: crate::docs::cleanup_number_tuples_root(
|
schema: generator.root_schema_for::<LineToData>(),
|
||||||
generator.root_schema_for::<LineToData>(),
|
|
||||||
),
|
|
||||||
required: true,
|
required: true,
|
||||||
label_required: true,
|
label_required: true,
|
||||||
description: String::new().to_string(),
|
description: String::new().to_string(),
|
||||||
@ -122,9 +114,7 @@ impl crate::docs::StdLibFn for LineTo {
|
|||||||
crate::docs::StdLibFnArg {
|
crate::docs::StdLibFnArg {
|
||||||
name: "sketch".to_string(),
|
name: "sketch".to_string(),
|
||||||
type_: "Sketch".to_string(),
|
type_: "Sketch".to_string(),
|
||||||
schema: crate::docs::cleanup_number_tuples_root(
|
schema: generator.root_schema_for::<Sketch>(),
|
||||||
generator.root_schema_for::<Sketch>(),
|
|
||||||
),
|
|
||||||
required: true,
|
required: true,
|
||||||
label_required: true,
|
label_required: true,
|
||||||
description: "the sketch you're adding the line to".to_string(),
|
description: "the sketch you're adding the line to".to_string(),
|
||||||
@ -137,7 +127,7 @@ impl crate::docs::StdLibFn for LineTo {
|
|||||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||||
settings.inline_subschemas = inline_subschemas;
|
settings.inline_subschemas = inline_subschemas;
|
||||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||||
let schema = crate::docs::cleanup_number_tuples_root(generator.root_schema_for::<Sketch>());
|
let schema = generator.root_schema_for::<Sketch>();
|
||||||
Some(crate::docs::StdLibFnArg {
|
Some(crate::docs::StdLibFnArg {
|
||||||
name: "".to_string(),
|
name: "".to_string(),
|
||||||
type_: "Sketch".to_string(),
|
type_: "Sketch".to_string(),
|
||||||
|
@ -32,13 +32,7 @@ mod test_examples_min {
|
|||||||
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
|
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
|
||||||
async fn kcl_test_example_min0() -> miette::Result<()> {
|
async fn kcl_test_example_min0() -> miette::Result<()> {
|
||||||
let code = "This is another code block.\nyes sirrr.\nmin";
|
let code = "This is another code block.\nyes sirrr.\nmin";
|
||||||
let result = match crate::test_server::execute_and_snapshot(
|
let result = match crate::test_server::execute_and_snapshot(code, None).await {
|
||||||
code,
|
|
||||||
crate::settings::types::UnitLength::Mm,
|
|
||||||
None,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
{
|
|
||||||
Err(crate::errors::ExecError::Kcl(e)) => {
|
Err(crate::errors::ExecError::Kcl(e)) => {
|
||||||
return Err(miette::Report::new(crate::errors::Report {
|
return Err(miette::Report::new(crate::errors::Report {
|
||||||
error: e.error,
|
error: e.error,
|
||||||
@ -109,9 +103,7 @@ impl crate::docs::StdLibFn for Min {
|
|||||||
vec![crate::docs::StdLibFnArg {
|
vec![crate::docs::StdLibFnArg {
|
||||||
name: "args".to_string(),
|
name: "args".to_string(),
|
||||||
type_: "[number]".to_string(),
|
type_: "[number]".to_string(),
|
||||||
schema: crate::docs::cleanup_number_tuples_root(
|
schema: generator.root_schema_for::<Vec<f64>>(),
|
||||||
generator.root_schema_for::<Vec<f64>>(),
|
|
||||||
),
|
|
||||||
required: true,
|
required: true,
|
||||||
label_required: true,
|
label_required: true,
|
||||||
description: String::new().to_string(),
|
description: String::new().to_string(),
|
||||||
@ -123,7 +115,7 @@ impl crate::docs::StdLibFn for Min {
|
|||||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||||
settings.inline_subschemas = inline_subschemas;
|
settings.inline_subschemas = inline_subschemas;
|
||||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||||
let schema = crate::docs::cleanup_number_tuples_root(generator.root_schema_for::<f64>());
|
let schema = generator.root_schema_for::<f64>();
|
||||||
Some(crate::docs::StdLibFnArg {
|
Some(crate::docs::StdLibFnArg {
|
||||||
name: "".to_string(),
|
name: "".to_string(),
|
||||||
type_: "number".to_string(),
|
type_: "number".to_string(),
|
||||||
|
@ -32,13 +32,7 @@ mod test_examples_show {
|
|||||||
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
|
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
|
||||||
async fn kcl_test_example_show0() -> miette::Result<()> {
|
async fn kcl_test_example_show0() -> miette::Result<()> {
|
||||||
let code = "This is code.\nIt does other shit.\nshow";
|
let code = "This is code.\nIt does other shit.\nshow";
|
||||||
let result = match crate::test_server::execute_and_snapshot(
|
let result = match crate::test_server::execute_and_snapshot(code, None).await {
|
||||||
code,
|
|
||||||
crate::settings::types::UnitLength::Mm,
|
|
||||||
None,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
{
|
|
||||||
Err(crate::errors::ExecError::Kcl(e)) => {
|
Err(crate::errors::ExecError::Kcl(e)) => {
|
||||||
return Err(miette::Report::new(crate::errors::Report {
|
return Err(miette::Report::new(crate::errors::Report {
|
||||||
error: e.error,
|
error: e.error,
|
||||||
@ -109,9 +103,7 @@ impl crate::docs::StdLibFn for Show {
|
|||||||
vec![crate::docs::StdLibFnArg {
|
vec![crate::docs::StdLibFnArg {
|
||||||
name: "args".to_string(),
|
name: "args".to_string(),
|
||||||
type_: "number".to_string(),
|
type_: "number".to_string(),
|
||||||
schema: crate::docs::cleanup_number_tuples_root(
|
schema: generator.root_schema_for::<Option<f64>>(),
|
||||||
generator.root_schema_for::<Option<f64>>(),
|
|
||||||
),
|
|
||||||
required: false,
|
required: false,
|
||||||
label_required: true,
|
label_required: true,
|
||||||
description: String::new().to_string(),
|
description: String::new().to_string(),
|
||||||
@ -123,7 +115,7 @@ impl crate::docs::StdLibFn for Show {
|
|||||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||||
settings.inline_subschemas = inline_subschemas;
|
settings.inline_subschemas = inline_subschemas;
|
||||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||||
let schema = crate::docs::cleanup_number_tuples_root(generator.root_schema_for::<f64>());
|
let schema = generator.root_schema_for::<f64>();
|
||||||
Some(crate::docs::StdLibFnArg {
|
Some(crate::docs::StdLibFnArg {
|
||||||
name: "".to_string(),
|
name: "".to_string(),
|
||||||
type_: "number".to_string(),
|
type_: "number".to_string(),
|
||||||
|
@ -32,13 +32,7 @@ mod test_examples_import {
|
|||||||
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
|
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
|
||||||
async fn kcl_test_example_import0() -> miette::Result<()> {
|
async fn kcl_test_example_import0() -> miette::Result<()> {
|
||||||
let code = "This is code.\nIt does other shit.\nimport";
|
let code = "This is code.\nIt does other shit.\nimport";
|
||||||
let result = match crate::test_server::execute_and_snapshot(
|
let result = match crate::test_server::execute_and_snapshot(code, None).await {
|
||||||
code,
|
|
||||||
crate::settings::types::UnitLength::Mm,
|
|
||||||
None,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
{
|
|
||||||
Err(crate::errors::ExecError::Kcl(e)) => {
|
Err(crate::errors::ExecError::Kcl(e)) => {
|
||||||
return Err(miette::Report::new(crate::errors::Report {
|
return Err(miette::Report::new(crate::errors::Report {
|
||||||
error: e.error,
|
error: e.error,
|
||||||
@ -109,9 +103,7 @@ impl crate::docs::StdLibFn for Import {
|
|||||||
vec![crate::docs::StdLibFnArg {
|
vec![crate::docs::StdLibFnArg {
|
||||||
name: "args".to_string(),
|
name: "args".to_string(),
|
||||||
type_: "kittycad::types::InputFormat".to_string(),
|
type_: "kittycad::types::InputFormat".to_string(),
|
||||||
schema: crate::docs::cleanup_number_tuples_root(
|
schema: generator.root_schema_for::<Option<kittycad::types::InputFormat>>(),
|
||||||
generator.root_schema_for::<Option<kittycad::types::InputFormat>>(),
|
|
||||||
),
|
|
||||||
required: false,
|
required: false,
|
||||||
label_required: true,
|
label_required: true,
|
||||||
description: String::new().to_string(),
|
description: String::new().to_string(),
|
||||||
@ -123,7 +115,7 @@ impl crate::docs::StdLibFn for Import {
|
|||||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||||
settings.inline_subschemas = inline_subschemas;
|
settings.inline_subschemas = inline_subschemas;
|
||||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||||
let schema = crate::docs::cleanup_number_tuples_root(generator.root_schema_for::<f64>());
|
let schema = generator.root_schema_for::<f64>();
|
||||||
Some(crate::docs::StdLibFnArg {
|
Some(crate::docs::StdLibFnArg {
|
||||||
name: "".to_string(),
|
name: "".to_string(),
|
||||||
type_: "number".to_string(),
|
type_: "number".to_string(),
|
||||||
|
@ -32,13 +32,7 @@ mod test_examples_import {
|
|||||||
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
|
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
|
||||||
async fn kcl_test_example_import0() -> miette::Result<()> {
|
async fn kcl_test_example_import0() -> miette::Result<()> {
|
||||||
let code = "This is code.\nIt does other shit.\nimport";
|
let code = "This is code.\nIt does other shit.\nimport";
|
||||||
let result = match crate::test_server::execute_and_snapshot(
|
let result = match crate::test_server::execute_and_snapshot(code, None).await {
|
||||||
code,
|
|
||||||
crate::settings::types::UnitLength::Mm,
|
|
||||||
None,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
{
|
|
||||||
Err(crate::errors::ExecError::Kcl(e)) => {
|
Err(crate::errors::ExecError::Kcl(e)) => {
|
||||||
return Err(miette::Report::new(crate::errors::Report {
|
return Err(miette::Report::new(crate::errors::Report {
|
||||||
error: e.error,
|
error: e.error,
|
||||||
@ -109,9 +103,7 @@ impl crate::docs::StdLibFn for Import {
|
|||||||
vec![crate::docs::StdLibFnArg {
|
vec![crate::docs::StdLibFnArg {
|
||||||
name: "args".to_string(),
|
name: "args".to_string(),
|
||||||
type_: "kittycad::types::InputFormat".to_string(),
|
type_: "kittycad::types::InputFormat".to_string(),
|
||||||
schema: crate::docs::cleanup_number_tuples_root(
|
schema: generator.root_schema_for::<Option<kittycad::types::InputFormat>>(),
|
||||||
generator.root_schema_for::<Option<kittycad::types::InputFormat>>(),
|
|
||||||
),
|
|
||||||
required: false,
|
required: false,
|
||||||
label_required: true,
|
label_required: true,
|
||||||
description: String::new().to_string(),
|
description: String::new().to_string(),
|
||||||
@ -123,8 +115,7 @@ impl crate::docs::StdLibFn for Import {
|
|||||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||||
settings.inline_subschemas = inline_subschemas;
|
settings.inline_subschemas = inline_subschemas;
|
||||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||||
let schema =
|
let schema = generator.root_schema_for::<Vec<Sketch>>();
|
||||||
crate::docs::cleanup_number_tuples_root(generator.root_schema_for::<Vec<Sketch>>());
|
|
||||||
Some(crate::docs::StdLibFnArg {
|
Some(crate::docs::StdLibFnArg {
|
||||||
name: "".to_string(),
|
name: "".to_string(),
|
||||||
type_: "[Sketch]".to_string(),
|
type_: "[Sketch]".to_string(),
|
||||||
|
@ -32,13 +32,7 @@ mod test_examples_import {
|
|||||||
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
|
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
|
||||||
async fn kcl_test_example_import0() -> miette::Result<()> {
|
async fn kcl_test_example_import0() -> miette::Result<()> {
|
||||||
let code = "This is code.\nIt does other shit.\nimport";
|
let code = "This is code.\nIt does other shit.\nimport";
|
||||||
let result = match crate::test_server::execute_and_snapshot(
|
let result = match crate::test_server::execute_and_snapshot(code, None).await {
|
||||||
code,
|
|
||||||
crate::settings::types::UnitLength::Mm,
|
|
||||||
None,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
{
|
|
||||||
Err(crate::errors::ExecError::Kcl(e)) => {
|
Err(crate::errors::ExecError::Kcl(e)) => {
|
||||||
return Err(miette::Report::new(crate::errors::Report {
|
return Err(miette::Report::new(crate::errors::Report {
|
||||||
error: e.error,
|
error: e.error,
|
||||||
@ -109,9 +103,7 @@ impl crate::docs::StdLibFn for Import {
|
|||||||
vec![crate::docs::StdLibFnArg {
|
vec![crate::docs::StdLibFnArg {
|
||||||
name: "args".to_string(),
|
name: "args".to_string(),
|
||||||
type_: "kittycad::types::InputFormat".to_string(),
|
type_: "kittycad::types::InputFormat".to_string(),
|
||||||
schema: crate::docs::cleanup_number_tuples_root(
|
schema: generator.root_schema_for::<Option<kittycad::types::InputFormat>>(),
|
||||||
generator.root_schema_for::<Option<kittycad::types::InputFormat>>(),
|
|
||||||
),
|
|
||||||
required: false,
|
required: false,
|
||||||
label_required: true,
|
label_required: true,
|
||||||
description: String::new().to_string(),
|
description: String::new().to_string(),
|
||||||
@ -123,8 +115,7 @@ impl crate::docs::StdLibFn for Import {
|
|||||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||||
settings.inline_subschemas = inline_subschemas;
|
settings.inline_subschemas = inline_subschemas;
|
||||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||||
let schema =
|
let schema = generator.root_schema_for::<Vec<Sketch>>();
|
||||||
crate::docs::cleanup_number_tuples_root(generator.root_schema_for::<Vec<Sketch>>());
|
|
||||||
Some(crate::docs::StdLibFnArg {
|
Some(crate::docs::StdLibFnArg {
|
||||||
name: "".to_string(),
|
name: "".to_string(),
|
||||||
type_: "[Sketch]".to_string(),
|
type_: "[Sketch]".to_string(),
|
||||||
|
@ -32,13 +32,7 @@ mod test_examples_show {
|
|||||||
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
|
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
|
||||||
async fn kcl_test_example_show0() -> miette::Result<()> {
|
async fn kcl_test_example_show0() -> miette::Result<()> {
|
||||||
let code = "This is code.\nIt does other shit.\nshow";
|
let code = "This is code.\nIt does other shit.\nshow";
|
||||||
let result = match crate::test_server::execute_and_snapshot(
|
let result = match crate::test_server::execute_and_snapshot(code, None).await {
|
||||||
code,
|
|
||||||
crate::settings::types::UnitLength::Mm,
|
|
||||||
None,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
{
|
|
||||||
Err(crate::errors::ExecError::Kcl(e)) => {
|
Err(crate::errors::ExecError::Kcl(e)) => {
|
||||||
return Err(miette::Report::new(crate::errors::Report {
|
return Err(miette::Report::new(crate::errors::Report {
|
||||||
error: e.error,
|
error: e.error,
|
||||||
@ -109,9 +103,7 @@ impl crate::docs::StdLibFn for Show {
|
|||||||
vec![crate::docs::StdLibFnArg {
|
vec![crate::docs::StdLibFnArg {
|
||||||
name: "args".to_string(),
|
name: "args".to_string(),
|
||||||
type_: "[number]".to_string(),
|
type_: "[number]".to_string(),
|
||||||
schema: crate::docs::cleanup_number_tuples_root(
|
schema: generator.root_schema_for::<Vec<f64>>(),
|
||||||
generator.root_schema_for::<Vec<f64>>(),
|
|
||||||
),
|
|
||||||
required: true,
|
required: true,
|
||||||
label_required: true,
|
label_required: true,
|
||||||
description: String::new().to_string(),
|
description: String::new().to_string(),
|
||||||
@ -123,7 +115,7 @@ impl crate::docs::StdLibFn for Show {
|
|||||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||||
settings.inline_subschemas = inline_subschemas;
|
settings.inline_subschemas = inline_subschemas;
|
||||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||||
let schema = crate::docs::cleanup_number_tuples_root(generator.root_schema_for::<()>());
|
let schema = generator.root_schema_for::<()>();
|
||||||
Some(crate::docs::StdLibFnArg {
|
Some(crate::docs::StdLibFnArg {
|
||||||
name: "".to_string(),
|
name: "".to_string(),
|
||||||
type_: "()".to_string(),
|
type_: "()".to_string(),
|
||||||
|
@ -31,13 +31,7 @@ mod test_examples_some_function {
|
|||||||
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
|
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
|
||||||
async fn kcl_test_example_some_function0() -> miette::Result<()> {
|
async fn kcl_test_example_some_function0() -> miette::Result<()> {
|
||||||
let code = "someFunction()";
|
let code = "someFunction()";
|
||||||
let result = match crate::test_server::execute_and_snapshot(
|
let result = match crate::test_server::execute_and_snapshot(code, None).await {
|
||||||
code,
|
|
||||||
crate::settings::types::UnitLength::Mm,
|
|
||||||
None,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
{
|
|
||||||
Err(crate::errors::ExecError::Kcl(e)) => {
|
Err(crate::errors::ExecError::Kcl(e)) => {
|
||||||
return Err(miette::Report::new(crate::errors::Report {
|
return Err(miette::Report::new(crate::errors::Report {
|
||||||
error: e.error,
|
error: e.error,
|
||||||
@ -112,7 +106,7 @@ impl crate::docs::StdLibFn for SomeFunction {
|
|||||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||||
settings.inline_subschemas = inline_subschemas;
|
settings.inline_subschemas = inline_subschemas;
|
||||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||||
let schema = crate::docs::cleanup_number_tuples_root(generator.root_schema_for::<i32>());
|
let schema = generator.root_schema_for::<i32>();
|
||||||
Some(crate::docs::StdLibFnArg {
|
Some(crate::docs::StdLibFnArg {
|
||||||
name: "".to_string(),
|
name: "".to_string(),
|
||||||
type_: "i32".to_string(),
|
type_: "i32".to_string(),
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "kcl-directory-test-macro"
|
name = "kcl-directory-test-macro"
|
||||||
description = "A tool for generating tests from a directory of kcl files"
|
description = "A tool for generating tests from a directory of kcl files"
|
||||||
version = "0.1.55"
|
version = "0.1.57"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/KittyCAD/modeling-app"
|
repository = "https://github.com/KittyCAD/modeling-app"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "kcl-language-server-release"
|
name = "kcl-language-server-release"
|
||||||
version = "0.1.55"
|
version = "0.1.57"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["KittyCAD Inc <kcl@kittycad.io>"]
|
authors = ["KittyCAD Inc <kcl@kittycad.io>"]
|
||||||
publish = false
|
publish = false
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
name = "kcl-language-server"
|
name = "kcl-language-server"
|
||||||
description = "A language server for KCL."
|
description = "A language server for KCL."
|
||||||
authors = ["KittyCAD Inc <kcl@kittycad.io>"]
|
authors = ["KittyCAD Inc <kcl@kittycad.io>"]
|
||||||
version = "0.2.55"
|
version = "0.2.57"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
@ -2194,9 +2194,9 @@ supports-color@^8.1.1:
|
|||||||
has-flag "^4.0.0"
|
has-flag "^4.0.0"
|
||||||
|
|
||||||
tar-fs@^2.0.0:
|
tar-fs@^2.0.0:
|
||||||
version "2.1.1"
|
version "2.1.2"
|
||||||
resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-2.1.1.tgz#489a15ab85f1f0befabb370b7de4f9eb5cbe8784"
|
resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-2.1.2.tgz#425f154f3404cb16cb8ff6e671d45ab2ed9596c5"
|
||||||
integrity sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==
|
integrity sha512-EsaAXwxmx8UB7FRKqeozqEPop69DXcmYwTQwXvyAPF352HJsPdkVhvTaDPYqfNgruveJIJy3TA2l+2zj8LJIJA==
|
||||||
dependencies:
|
dependencies:
|
||||||
chownr "^1.1.1"
|
chownr "^1.1.1"
|
||||||
mkdirp-classic "^0.5.2"
|
mkdirp-classic "^0.5.2"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "kcl-lib"
|
name = "kcl-lib"
|
||||||
description = "KittyCAD Language implementation and tools"
|
description = "KittyCAD Language implementation and tools"
|
||||||
version = "0.2.55"
|
version = "0.2.57"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/KittyCAD/modeling-app"
|
repository = "https://github.com/KittyCAD/modeling-app"
|
||||||
@ -104,7 +104,7 @@ tower-lsp = { workspace = true, features = ["proposed", "default"] }
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["engine"]
|
default = ["engine"]
|
||||||
cli = ["dep:clap"]
|
cli = ["dep:clap", "kittycad/clap"]
|
||||||
dhat-heap = ["dep:dhat"]
|
dhat-heap = ["dep:dhat"]
|
||||||
# For the lsp server, when run with stdout for rpc we want to disable println.
|
# For the lsp server, when run with stdout for rpc we want to disable println.
|
||||||
# This is used for editor extensions that use the lsp server.
|
# This is used for editor extensions that use the lsp server.
|
||||||
@ -153,8 +153,3 @@ harness = false
|
|||||||
name = "executor"
|
name = "executor"
|
||||||
path = "e2e/executor/main.rs"
|
path = "e2e/executor/main.rs"
|
||||||
required-features = ["engine"]
|
required-features = ["engine"]
|
||||||
|
|
||||||
[[test]]
|
|
||||||
name = "modify"
|
|
||||||
path = "e2e/modify/main.rs"
|
|
||||||
required-features = ["engine"]
|
|
||||||
|
@ -76,7 +76,7 @@ fn run_benchmarks(c: &mut Criterion) {
|
|||||||
group.bench_function(format!("execute_{}", dir_name), |b| {
|
group.bench_function(format!("execute_{}", dir_name), |b| {
|
||||||
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().await?;
|
||||||
let mut exec_state = kcl_lib::ExecState::new(&ctx);
|
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;
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
//! Cache testing framework.
|
//! Cache testing framework.
|
||||||
|
|
||||||
use kcl_lib::{bust_cache, ExecError, ExecOutcome};
|
use kcl_lib::{bust_cache, ExecError, ExecOutcome};
|
||||||
|
use kcmc::{each_cmd as mcmd, ModelingCmd};
|
||||||
|
use kittycad_modeling_cmds as kcmc;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct Variation<'a> {
|
struct Variation<'a> {
|
||||||
@ -49,45 +51,6 @@ async fn cache_test(
|
|||||||
img_results
|
img_results
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test(flavor = "multi_thread")]
|
|
||||||
async fn kcl_test_cache_change_units_changes_output() {
|
|
||||||
let code = r#"part001 = startSketchOn('XY')
|
|
||||||
|> startProfileAt([5.5229, 5.25217], %)
|
|
||||||
|> line(end = [10.50433, -1.19122])
|
|
||||||
|> line(end = [8.01362, -5.48731])
|
|
||||||
|> line(end = [-1.02877, -6.76825])
|
|
||||||
|> line(end = [-11.53311, 2.81559])
|
|
||||||
|> close()
|
|
||||||
|> extrude(length = 4)
|
|
||||||
"#;
|
|
||||||
|
|
||||||
let result = cache_test(
|
|
||||||
"change_units_changes_output",
|
|
||||||
vec![
|
|
||||||
Variation {
|
|
||||||
code,
|
|
||||||
settings: &kcl_lib::ExecutorSettings {
|
|
||||||
units: kcl_lib::UnitLength::In,
|
|
||||||
..Default::default()
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Variation {
|
|
||||||
code,
|
|
||||||
settings: &kcl_lib::ExecutorSettings {
|
|
||||||
units: kcl_lib::UnitLength::Mm,
|
|
||||||
..Default::default()
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
)
|
|
||||||
.await;
|
|
||||||
|
|
||||||
let first = result.first().unwrap();
|
|
||||||
let second = result.last().unwrap();
|
|
||||||
|
|
||||||
assert!(first.1 != second.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tokio::test(flavor = "multi_thread")]
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
async fn kcl_test_cache_change_grid_visualizes_grid_off_to_on() {
|
async fn kcl_test_cache_change_grid_visualizes_grid_off_to_on() {
|
||||||
let code = r#"part001 = startSketchOn('XY')
|
let code = r#"part001 = startSketchOn('XY')
|
||||||
@ -253,3 +216,69 @@ extrude(sketch001, length = 4)
|
|||||||
second.artifact_graph.len()
|
second.artifact_graph.len()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
|
async fn kcl_test_cache_empty_file_pop_cache_empty_file_planes_work() {
|
||||||
|
// Get the current working directory.
|
||||||
|
let code = "";
|
||||||
|
|
||||||
|
let ctx = kcl_lib::ExecutorContext::new_with_default_client().await.unwrap();
|
||||||
|
let program = kcl_lib::Program::parse_no_errs(code).unwrap();
|
||||||
|
let outcome = ctx.run_with_caching(program).await.unwrap();
|
||||||
|
|
||||||
|
// Ensure nothing is left in the batch
|
||||||
|
assert!(ctx.engine.batch().read().await.is_empty());
|
||||||
|
assert!(ctx.engine.batch_end().read().await.is_empty());
|
||||||
|
|
||||||
|
// Ensure the planes work, and we can show or hide them.
|
||||||
|
// Hide/show the grid.
|
||||||
|
let default_planes = ctx.engine.get_default_planes().read().await.clone().unwrap();
|
||||||
|
|
||||||
|
// Assure the outcome is the same.
|
||||||
|
assert_eq!(outcome.default_planes, Some(default_planes.clone()));
|
||||||
|
|
||||||
|
ctx.engine
|
||||||
|
.send_modeling_cmd(
|
||||||
|
uuid::Uuid::new_v4(),
|
||||||
|
Default::default(),
|
||||||
|
&ModelingCmd::from(mcmd::ObjectVisible {
|
||||||
|
hidden: false,
|
||||||
|
object_id: default_planes.xy,
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
// Now simulate an engine pause/network disconnect.
|
||||||
|
// Raw dog clear the scene entirely.
|
||||||
|
ctx.engine
|
||||||
|
.send_modeling_cmd(
|
||||||
|
uuid::Uuid::new_v4(),
|
||||||
|
Default::default(),
|
||||||
|
&ModelingCmd::from(mcmd::SceneClearAll {}),
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
// Bust the cache and reset the scene.
|
||||||
|
let outcome = ctx.bust_cache_and_reset_scene().await.unwrap();
|
||||||
|
// Get the default planes.
|
||||||
|
let default_planes = ctx.engine.get_default_planes().read().await.clone().unwrap();
|
||||||
|
|
||||||
|
assert_eq!(outcome.default_planes, Some(default_planes.clone()));
|
||||||
|
|
||||||
|
// Ensure we can show a plane.
|
||||||
|
ctx.engine
|
||||||
|
.send_modeling_cmd(
|
||||||
|
uuid::Uuid::new_v4(),
|
||||||
|
Default::default(),
|
||||||
|
&ModelingCmd::from(mcmd::ObjectVisible {
|
||||||
|
hidden: false,
|
||||||
|
object_id: default_planes.xz,
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
ctx.close().await;
|
||||||
|
}
|
||||||
|