Compare commits

...

21 Commits

Author SHA1 Message Date
d453110768 Merge branch 'main' into franknoirot/adhoc/lengthen-code-timeout-onboarding-tests 2025-04-10 12:13:29 -04:00
970cf7f017 skip unreliable AI tests (#6252)
skip unrealiable AI tests
2025-04-10 12:10:57 -04:00
c2e1b50bde Lengthen timeout for onboarding code to appear
These tests work without fail locally so I have to believe this is due
to some slowness in startup on MacOS.
2025-04-10 12:07:59 -04:00
d125efcd60 Bidirectional extrude/revolve (#6154)
* extend extrude endpoint

* revolve and mocks

* add bounds check to revolve

* kcl examples of new args

* update to 110

* fix mock

* move example to prelude

* change to camelCase

* new prelude tests

* extend just file

* missed change

* change to XY

* redo sim tests

* review changes

* redo markdown
2025-04-10 10:46:10 -04:00
4664427832 Add a sidebar action to create a share link (#6233) 2025-04-10 00:27:22 +00:00
d84b9cc875 Remove flaky pixel check from prompt-to-edit test (#6225)
remove flaky pixel check
2025-04-10 00:06:38 +00:00
0c6b6bf5d5 Fix bad merge with some KCL snapshots (#6239)
Caused by admin merge in #5803
2025-04-09 16:43:56 -04:00
d275995dfe KCL: Angled line should use keyword args (#5803)
We continue migrating KCL stdlib functions to use keyword arguments. Next up is the `angledLine` family of functions (except `angledLineThatIntersects, which will be a quick follow-up).

Before vs. after:

`angledLine({angle = 90, length = 3}, %, $edge)`
  => `angledLine(angle = 90, length = 3, tag = $edge)`

`angledLineOfXLength({angle = 90, length = 3}, %, $edge)`
  => `angledLine(angle = 90, lengthX = 3, tag = $edge)`

`angledLineOfYLength({angle = 90, length = 3}, %, $edge)`
  => `angledLine(angle = 90, lengthY = 3, tag = $edge)`

`angledLineToX({angle = 90, length = 3}, %, $edge)`
  => `angledLine(angle = 90, endAbsoluteX = 3, tag = $edge)`

`angledLineToY({angle = 90, length = 3}, %, $edge)`
  => `angledLine(angle = 90, endAbsoluteY = 3, tag = $edge)`
2025-04-09 14:55:15 -05:00
b03ca30379 Cleanup spatula example. (#6232)
* Cleanup spatula example. Naming better variables and removing unused tags

* Update kcl-samples simulation test output

* remove unused tag

* fix spacing

* Update kcl-samples simulation test output

* cleanup comments

* Update kcl-samples simulation test output

* re-add spacing

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Greg Sweeney <greg@kittycad.io>
Co-authored-by: jgomez720 <114548659+jgomez720@users.noreply.github.com>
2025-04-09 15:21:05 -04:00
e5f23a49b4 #4469 Improve toolbar ux (#5841)
* Improve ActionButtonDropdown selection

* center rectangle icon fixed

* ignore Esc key when displaying hotkeys

* add ability to escape 3 point circle tool

* remove focus from ActionButton, ActionButtonDropdown

* remove focus outline from buttons

* remember lastly selected multi action item

* Add tests for toolbar buttons

* fix sketch-tests by turning toolbar dropdown arrays into an object with an id - this got broken because dropdown now remember the last selected option so we cant rely on cant reference the first option in tests

* update other tests with open menu click
2025-04-09 14:32:52 +02:00
e78100eaac Assemblies: UX improvements around foreign file imports (#6159)
* WIP: Add point-and-click Import for geometry
Will eventually fix #6120
Right now the whole loop is there but the codemod doesn't work yet

* Better pathToNOde, log on non-working cm dispatch call

* Add workaround to updateModelingState not working

* Back to updateModelingState with a skip flag

* Better todo

* Change working from Import to Insert, cleanups

* Sister command in kclCommands to populate file options

* Improve path selector

* Unsure: move importAstMod to kclCommands onSubmit 😶

* Add e2e test

* Clean up for review

* Add native file menu entry and test

* No await yo lint said so

* WIP: UX improvements around foreign file imports
Fixes #6152

* @lrev-Dev's suggestion to remove a comment

Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch>

* Update to scene.settled(cmdBar)

* Add partNNN default name for alias

* Lint

* Lint

* Fix unit tests

* Add sad path insert test
Thanks @Irev-Dev for the suggestion

* Add step insert test

* Lint

* Add test for second foreign import thru file tree click

* Add default value for local name alias

* Aligning tests

* Fix tests

* Add padding for filenames starting with a digit

---------

Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch>
2025-04-09 07:47:57 -04:00
ae9d8be4e4 Don't apply numeric adjustments in arithmetic yet (#6222)
Don't apply numeric adjustments yet

Signed-off-by: Nick Cameron <nrc@ncameron.org>
2025-04-09 14:16:58 +12:00
e4f73a6d5c Continue running tests with weak network (#6223) 2025-04-09 02:13:38 +00:00
a31fd608cf Improve hovers for KCL std lib fns (#6208)
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2025-04-09 12:15:12 +12:00
a98d5aa2fb Fix to not filter out empty modules from the Feature Tree (#6224) 2025-04-08 23:56:27 +00:00
4c6ef841bb Handle PowerShell vs. Git Bash on Windows (#6207) 2025-04-08 23:47:56 +00:00
997f539a8c More numeric type propagations (#6221)
Last few numeric type propagations

Signed-off-by: Nick Cameron <nrc@ncameron.org>
2025-04-09 11:46:54 +12:00
83f74faaf7 fix nix (#6213)
Signed-off-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: Adam Sunderland <adam@kittycad.io>
2025-04-08 19:06:47 +00:00
0bb5797377 Fix unclickable state while opening share link in browser (#6201)
* Fix unclickable state, don't show warning if query present

* Leave a note about need for a web test

* Fix browser share links by waiting for network connection

* Don't worry about engineConnection on home route
2025-04-08 13:10:49 -04:00
c3097aa334 fix missing extension (#6205)
* fix missing extension

* fix e2e

* better name
2025-04-08 15:41:48 +00:00
2cd0fcc9a7 #6157 Dispatch wheel event to camControls when hovering segment label (#6158)
dispatch wheel event to camControls when hovering segment label
2025-04-08 11:12:12 -04:00
436 changed files with 42340 additions and 41816 deletions

View File

@ -5,33 +5,40 @@ all: install build check
# INSTALL # INSTALL
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
CARGO ?= ~/.cargo/bin/cargo.exe export WINDOWS := true
WASM_PACK ?= ~/.cargo/bin/wasm-pack.exe ifndef MSYSTEM
else export POWERSHELL := true
CARGO ?= ~/.cargo/bin/cargo
WASM_PACK ?= ~/.cargo/bin/wasm-pack
endif endif
endif
ifdef WINDOWS
CARGO ?= $(USERPROFILE)/.cargo/bin/cargo.exe
WASM_PACK ?= $(USERPROFILE)/.cargo/bin/wasm-pack.exe
else
CARGO ?= ~/.cargo/bin/cargo
WASM_PACK ?= ~/.cargo/bin/wasm-pack
endif
.PHONY: install .PHONY: install
install: node_modules/.yarn-integrity $(CARGO) $(WASM_PACK) ## Install dependencies install: node_modules/.yarn-integrity $(CARGO) $(WASM_PACK) ## Install dependencies
node_modules/.yarn-integrity: package.json yarn.lock node_modules/.yarn-integrity: package.json yarn.lock
yarn install yarn install
ifeq ($(OS),Windows_NT) ifdef POWERSHELL
@ type nul > $@ @ type nul > $@
else else
@ touch $@ @ touch $@
endif endif
$(CARGO): $(CARGO):
ifeq ($(OS),Windows_NT) ifdef WINDOWS
yarn install:rust:windows yarn install:rust:windows
else else
yarn install:rust yarn install:rust
endif endif
$(WASM_PACK): $(WASM_PACK):
ifeq ($(OS),Windows_NT) ifdef WINDOWS
yarn install:wasm-pack:cargo yarn install:wasm-pack:cargo
else else
yarn install:wasm-pack:sh yarn install:wasm-pack:sh
@ -57,7 +64,7 @@ build-web: install public/kcl_wasm_lib_bg.wasm build/index.html
build-desktop: install public/kcl_wasm_lib_bg.wasm .vite/build/main.js build-desktop: install public/kcl_wasm_lib_bg.wasm .vite/build/main.js
public/kcl_wasm_lib_bg.wasm: $(CARGO_SOURCES) $(RUST_SOURCES) public/kcl_wasm_lib_bg.wasm: $(CARGO_SOURCES) $(RUST_SOURCES)
ifeq ($(OS),Windows_NT) ifdef WINDOWS
yarn build:wasm:dev:windows yarn build:wasm:dev:windows
else else
yarn build:wasm:dev yarn build:wasm:dev
@ -140,8 +147,8 @@ endif
.PHONY: clean .PHONY: clean
clean: ## Delete all artifacts clean: ## Delete all artifacts
ifeq ($(OS),Windows_NT) ifdef POWERSHELL
git clean --force -d -X git clean --force -d -x --exclude=.env* --exclude=**/*.env
else else
rm -rf .vite/ build/ rm -rf .vite/ build/
rm -rf trace.zip playwright-report/ test-results/ rm -rf trace.zip playwright-report/ test-results/
@ -152,7 +159,7 @@ endif
.PHONY: help .PHONY: help
help: install help: install
ifeq ($(OS),Windows_NT) ifdef POWERSHELL
@ powershell -Command "Get-Content $(MAKEFILE_LIST) | Select-String -Pattern '^[^\s]+:.*##\s.*$$' | ForEach-Object { $$line = $$_.Line -split ':.*?##\s+'; Write-Host -NoNewline $$line[0].PadRight(30) -ForegroundColor Cyan; Write-Host $$line[1] }" @ powershell -Command "Get-Content $(MAKEFILE_LIST) | Select-String -Pattern '^[^\s]+:.*##\s.*$$' | ForEach-Object { $$line = $$_.Line -split ':.*?##\s+'; Write-Host -NoNewline $$line[0].PadRight(30) -ForegroundColor Cyan; Write-Host $$line[1] }"
else else
@ grep -E '^[^[:space:]]+:.*## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' @ grep -E '^[^[:space:]]+:.*## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

View File

@ -36,9 +36,9 @@ myAngle = -120
sketch001 = startSketchOn(XZ) sketch001 = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line(end = [8, 0]) |> line(end = [8, 0])
|> angledLine({ angle = abs(myAngle), length = 5 }, %) |> angledLine(angle = abs(myAngle), length = 5)
|> line(end = [-5, 0]) |> line(end = [-5, 0])
|> angledLine({ angle = myAngle, length = 5 }, %) |> angledLine(angle = myAngle, length = 5)
|> close() |> close()
baseExtrusion = extrude(sketch001, length = 5) baseExtrusion = extrude(sketch001, length = 5)

View File

@ -33,10 +33,7 @@ acos(num: number): number
```js ```js
sketch001 = startSketchOn(XZ) sketch001 = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ |> angledLine(angle = toDegrees(acos(0.5)), length = 10)
angle = toDegrees(acos(0.5)),
length = 10
}, %)
|> line(end = [5, 0]) |> line(end = [5, 0])
|> line(endAbsolute = [12, 0]) |> line(endAbsolute = [12, 0])
|> close() |> close()

View File

@ -36,7 +36,7 @@ angleToMatchLengthX(
sketch001 = startSketchOn(XZ) sketch001 = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line(end = [2, 5], tag = $seg01) |> line(end = [2, 5], tag = $seg01)
|> angledLineToX([-angleToMatchLengthX(seg01, 7, %), 10], %) |> angledLine(angle = -angleToMatchLengthX(seg01, 7, %), endAbsoluteX = 10)
|> close() |> close()
extrusion = extrude(sketch001, length = 5) extrusion = extrude(sketch001, length = 5)

View File

@ -36,10 +36,7 @@ angleToMatchLengthY(
sketch001 = startSketchOn(XZ) sketch001 = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line(end = [1, 2], tag = $seg01) |> line(end = [1, 2], tag = $seg01)
|> angledLine({ |> angledLine(angle = angleToMatchLengthY(seg01, 15, %), length = 5)
angle = angleToMatchLengthY(seg01, 15, %),
length = 5
}, %)
|> yLine(endAbsolute = 0) |> yLine(endAbsolute = 0)
|> close() |> close()

View File

@ -10,8 +10,13 @@ Draw a line segment relative to the current origin using the polar measure of so
```js ```js
angledLine( angledLine(
data: AngledLineData,
sketch: Sketch, sketch: Sketch,
angle: number,
length?: number,
lengthX?: number,
lengthY?: number,
endAbsoluteX?: number,
endAbsoluteY?: number,
tag?: TagDeclarator, tag?: TagDeclarator,
): Sketch ): Sketch
``` ```
@ -21,9 +26,14 @@ angledLine(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `data` | [`AngledLineData`](/docs/kcl/types/AngledLineData) | Data to draw an angled line. | Yes | | `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | Which sketch should this path be added to? | Yes |
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes | | `angle` | [`number`](/docs/kcl/types/number) | Which angle should the line be drawn at? | Yes |
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No | | `length` | [`number`](/docs/kcl/types/number) | Draw the line this distance along the given angle. Only one of `length`, `lengthX`, `lengthY`, `lengthAbsoluteEndX`, `lengthAbsoluteEndY` can be given. | No |
| `lengthX` | [`number`](/docs/kcl/types/number) | Draw the line this distance along the X axis. Only one of `length`, `lengthX`, `lengthY`, `lengthAbsoluteEndX`, `lengthAbsoluteEndY` can be given. | No |
| `lengthY` | [`number`](/docs/kcl/types/number) | Draw the line this distance along the Y axis. Only one of `length`, `lengthX`, `lengthY`, `lengthAbsoluteEndX`, `lengthAbsoluteEndY` can be given. | No |
| `endAbsoluteX` | [`number`](/docs/kcl/types/number) | Draw the line along the given angle until it reaches this point along the X axis. Only one of `length`, `lengthX`, `lengthY`, `lengthAbsoluteEndX`, `lengthAbsoluteEndY` can be given. | No |
| `endAbsoluteY` | [`number`](/docs/kcl/types/number) | Draw the line along the given angle until it reaches this point along the Y axis. Only one of `length`, `lengthX`, `lengthY`, `lengthAbsoluteEndX`, `lengthAbsoluteEndY` can be given. | No |
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this line | No |
### Returns ### Returns
@ -36,7 +46,7 @@ angledLine(
exampleSketch = startSketchOn(XZ) exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> yLine(endAbsolute = 15) |> yLine(endAbsolute = 15)
|> angledLine({ angle = 30, length = 15 }, %) |> angledLine(angle = 30, length = 15)
|> line(end = [8, -10]) |> line(end = [8, -10])
|> yLine(endAbsolute = 0) |> yLine(endAbsolute = 0)
|> close() |> close()

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -33,10 +33,7 @@ asin(num: number): number
```js ```js
sketch001 = startSketchOn(XZ) sketch001 = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ |> angledLine(angle = toDegrees(asin(0.5)), length = 20)
angle = toDegrees(asin(0.5)),
length = 20
}, %)
|> yLine(endAbsolute = 0) |> yLine(endAbsolute = 0)
|> close() |> close()

View File

@ -33,10 +33,7 @@ atan(num: number): number
```js ```js
sketch001 = startSketchOn(XZ) sketch001 = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ |> angledLine(angle = toDegrees(atan(1.25)), length = 20)
angle = toDegrees(atan(1.25)),
length = 20
}, %)
|> yLine(endAbsolute = 0) |> yLine(endAbsolute = 0)
|> close() |> close()

View File

@ -37,10 +37,7 @@ atan2(
```js ```js
sketch001 = startSketchOn(XZ) sketch001 = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ |> angledLine(angle = toDegrees(atan2(1.25, 2)), length = 20)
angle = toDegrees(atan2(1.25, 2)),
length = 20
}, %)
|> yLine(endAbsolute = 0) |> yLine(endAbsolute = 0)
|> close() |> close()

View File

@ -17,10 +17,10 @@ std::math::E: number = 2.71828182845904523536028747135266250_
```js ```js
exampleSketch = startSketchOn(XZ) exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ |> angledLine(
angle = 30, angle = 30,
length = 2 * E ^ 2, length = 2 * E ^ 2,
}, %) )
|> yLine(endAbsolute = 0) |> yLine(endAbsolute = 0)
|> close() |> close()

View File

@ -17,10 +17,10 @@ std::math::TAU: number = 6.28318530717958647692528676655900577_
```js ```js
exampleSketch = startSketchOn(XZ) exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ |> angledLine(
angle = 50, angle = 50,
length = 10 * TAU, length = 10 * TAU,
}, %) )
|> yLine(endAbsolute = 0) |> yLine(endAbsolute = 0)
|> close() |> close()

View File

@ -30,7 +30,7 @@ e(): number
```js ```js
exampleSketch = startSketchOn(XZ) exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ angle = 30, length = 2 * e() ^ 2 }, %) |> angledLine(angle = 30, length = 2 * e() ^ 2)
|> yLine(endAbsolute = 0) |> yLine(endAbsolute = 0)
|> close() |> close()

File diff suppressed because one or more lines are too long

View File

@ -30,10 +30,10 @@ getNextAdjacentEdge(tag: TagIdentifier): Uuid
exampleSketch = startSketchOn(XZ) exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line(end = [10, 0]) |> line(end = [10, 0])
|> angledLine({ angle = 60, length = 10 }, %) |> angledLine(angle = 60, length = 10)
|> angledLine({ angle = 120, length = 10 }, %) |> angledLine(angle = 120, length = 10)
|> line(end = [-10, 0]) |> line(end = [-10, 0])
|> angledLine({ angle = 240, length = 10 }, %, $referenceEdge) |> angledLine(angle = 240, length = 10, tag = $referenceEdge)
|> close() |> close()
example = extrude(exampleSketch, length = 5) example = extrude(exampleSketch, length = 5)

View File

@ -30,10 +30,10 @@ getOppositeEdge(tag: TagIdentifier): Uuid
exampleSketch = startSketchOn(XZ) exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line(end = [10, 0]) |> line(end = [10, 0])
|> angledLine({ angle = 60, length = 10 }, %) |> angledLine(angle = 60, length = 10)
|> angledLine({ angle = 120, length = 10 }, %) |> angledLine(angle = 120, length = 10)
|> line(end = [-10, 0]) |> line(end = [-10, 0])
|> angledLine({ angle = 240, length = 10 }, %, $referenceEdge) |> angledLine(angle = 240, length = 10, tag = $referenceEdge)
|> close() |> close()
example = extrude(exampleSketch, length = 5) example = extrude(exampleSketch, length = 5)

View File

@ -30,10 +30,10 @@ getPreviousAdjacentEdge(tag: TagIdentifier): Uuid
exampleSketch = startSketchOn(XZ) exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line(end = [10, 0]) |> line(end = [10, 0])
|> angledLine({ angle = 60, length = 10 }, %) |> angledLine(angle = 60, length = 10)
|> angledLine({ angle = 120, length = 10 }, %) |> angledLine(angle = 120, length = 10)
|> line(end = [-10, 0]) |> line(end = [-10, 0])
|> angledLine({ angle = 240, length = 10 }, %, $referenceEdge) |> angledLine(angle = 240, length = 10, tag = $referenceEdge)
|> close() |> close()
example = extrude(exampleSketch, length = 5) example = extrude(exampleSketch, length = 5)

View File

@ -43,11 +43,7 @@ layout: manual
* [`angleToMatchLengthX`](kcl/angleToMatchLengthX) * [`angleToMatchLengthX`](kcl/angleToMatchLengthX)
* [`angleToMatchLengthY`](kcl/angleToMatchLengthY) * [`angleToMatchLengthY`](kcl/angleToMatchLengthY)
* [`angledLine`](kcl/angledLine) * [`angledLine`](kcl/angledLine)
* [`angledLineOfXLength`](kcl/angledLineOfXLength)
* [`angledLineOfYLength`](kcl/angledLineOfYLength)
* [`angledLineThatIntersects`](kcl/angledLineThatIntersects) * [`angledLineThatIntersects`](kcl/angledLineThatIntersects)
* [`angledLineToX`](kcl/angledLineToX)
* [`angledLineToY`](kcl/angledLineToY)
* [`appearance`](kcl/appearance) * [`appearance`](kcl/appearance)
* [`arc`](kcl/arc) * [`arc`](kcl/arc)
* [`arcTo`](kcl/arcTo) * [`arcTo`](kcl/arcTo)

View File

@ -33,10 +33,7 @@ max(args: [number]): number
```js ```js
exampleSketch = startSketchOn(XZ) exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ |> angledLine(angle = 70, length = max(15, 31, 4, 13, 22))
angle = 70,
length = max(15, 31, 4, 13, 22)
}, %)
|> line(end = [20, 0]) |> line(end = [20, 0])
|> close() |> close()

View File

@ -33,10 +33,7 @@ min(args: [number]): number
```js ```js
exampleSketch = startSketchOn(XZ) exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ |> angledLine(angle = 70, length = min(15, 31, 4, 13, 22))
angle = 70,
length = min(15, 31, 4, 13, 22)
}, %)
|> line(end = [20, 0]) |> line(end = [20, 0])
|> close() |> close()

View File

@ -37,7 +37,7 @@ pow(
```js ```js
exampleSketch = startSketchOn(XZ) exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ angle = 50, length = pow(5, 2) }, %) |> angledLine(angle = 50, length = pow(5, 2))
|> yLine(endAbsolute = 0) |> yLine(endAbsolute = 0)
|> close() |> close()

View File

@ -29,11 +29,8 @@ profileStart(sketch: Sketch): [number]
```js ```js
sketch001 = startSketchOn(XY) sketch001 = startSketchOn(XY)
|> startProfileAt([5, 2], %) |> startProfileAt([5, 2], %)
|> angledLine({ angle = 120, length = 50 }, %, $seg01) |> angledLine(angle = 120, length = 50, tag = $seg01)
|> angledLine({ |> angledLine(angle = segAng(seg01) + 120, length = 50)
angle = segAng(seg01) + 120,
length = 50
}, %)
|> line(end = profileStart(%)) |> line(end = profileStart(%))
|> close() |> close()
|> extrude(length = 20) |> extrude(length = 20)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -78,7 +78,7 @@ assertEqual(sum, 6, 0.00001, "1 + 2 + 3 summed is 6")
```js ```js
// Declare a function that sketches a decagon. // Declare a function that sketches a decagon.
fn decagon(radius) { fn decagon(radius) {
// Each side of the decagon is turned this many degrees from the previous angle. // Each side of the decagon is turned this many radians from the previous angle.
stepAngle = 1 / 10 * TAU stepAngle = 1 / 10 * TAU
// Start the decagon sketch at this point. // Start the decagon sketch at this point.

View File

@ -151,15 +151,9 @@ cube
sketch001 = startSketchOn(XY) sketch001 = startSketchOn(XY)
rectangleSketch = startProfileAt([-200, 23.86], sketch001) rectangleSketch = startProfileAt([-200, 23.86], sketch001)
|> angledLine([0, 73.47], %, $rectangleSegmentA001) |> angledLine(angle = 0, length = 73.47, tag = $rectangleSegmentA001)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 50.61)
segAng(rectangleSegmentA001) - 90, |> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001))
50.61
], %)
|> angledLine([
segAng(rectangleSegmentA001),
-segLen(rectangleSegmentA001)
], %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()

View File

@ -85,15 +85,9 @@ cube
sketch001 = startSketchOn(XY) sketch001 = startSketchOn(XY)
rectangleSketch = startProfileAt([-200, 23.86], sketch001) rectangleSketch = startProfileAt([-200, 23.86], sketch001)
|> angledLine([0, 73.47], %, $rectangleSegmentA001) |> angledLine(angle = 0, length = 73.47, tag = $rectangleSegmentA001)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 50.61)
segAng(rectangleSegmentA001) - 90, |> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001))
50.61
], %)
|> angledLine([
segAng(rectangleSegmentA001),
-segLen(rectangleSegmentA001)
], %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()

View File

@ -32,9 +32,9 @@ exampleSketch = startSketchOn(XZ)
|> line(end = [10, 0]) |> line(end = [10, 0])
|> line(end = [5, 10], tag = $seg01) |> line(end = [5, 10], tag = $seg01)
|> line(end = [-10, 0]) |> line(end = [-10, 0])
|> angledLine([segAng(seg01), 10], %) |> angledLine(angle = segAng(seg01), length = 10)
|> line(end = [-10, 0]) |> line(end = [-10, 0])
|> angledLine([segAng(seg01), -15], %) |> angledLine(angle = segAng(seg01), length = -15)
|> close() |> close()
example = extrude(exampleSketch, length = 4) example = extrude(exampleSketch, length = 4)

View File

@ -29,9 +29,9 @@ segLen(tag: TagIdentifier): number
```js ```js
exampleSketch = startSketchOn(XZ) exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ angle = 60, length = 10 }, %, $thing) |> angledLine(angle = 60, length = 10, tag = $thing)
|> tangentialArc({ offset = -120, radius = 5 }, %) |> tangentialArc({ offset = -120, radius = 5 }, %)
|> angledLine({ angle = -60, length = segLen(thing) }, %) |> angledLine(angle = -60, length = segLen(thing))
|> close() |> close()
example = extrude(exampleSketch, length = 5) example = extrude(exampleSketch, length = 5)

View File

@ -33,7 +33,7 @@ sqrt(num: number): number
```js ```js
exampleSketch = startSketchOn(XZ) exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ angle = 50, length = sqrt(2500) }, %) |> angledLine(angle = 50, length = sqrt(2500))
|> yLine(endAbsolute = 0) |> yLine(endAbsolute = 0)
|> close() |> close()

View File

@ -9,7 +9,15 @@ Create a helix.
```js ```js
helix(revolutions: number(_), angleStart: number(deg), ccw?: bool, radius?: number(mm), axis?: Axis3d | Edge, length?: number(mm), cylinder?: Solid): Helix helix(
revolutions: number(_),
angleStart: number(deg),
ccw?: bool,
radius?: number(mm),
axis?: Axis3d | Edge,
length?: number(mm),
cylinder?: Solid,
): Helix
``` ```

View File

@ -29,10 +29,10 @@ cos(@num: number(rad)): number(_)
```js ```js
exampleSketch = startSketchOn(XZ) exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ |> angledLine(
angle = 30, angle = 30,
length = 3 / cos(toRadians(30)), length = 3 / cos(toRadians(30)),
}, %) )
|> yLine(endAbsolute = 0) |> yLine(endAbsolute = 0)
|> close() |> close()

View File

@ -6,10 +6,14 @@ layout: manual
Convert polar/sphere (azimuth, elevation, distance) coordinates tocartesian (x/y/z grid) coordinates. Convert polar/sphere (azimuth, elevation, distance) coordinates to
cartesian (x/y/z grid) coordinates.
```js ```js
polar(angle: number(deg), length: number(mm)): [number(mm); 2] polar(
angle: number(deg),
length: number(mm),
): [number(mm); 2]
``` ```

File diff suppressed because one or more lines are too long

View File

@ -29,10 +29,10 @@ tan(@num: number(rad)): number(_)
```js ```js
exampleSketch = startSketchOn(XZ) exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ |> angledLine(
angle = 50, angle = 50,
length = 50 * tan(1/2), length = 50 * tan(1/2),
}, %) )
|> yLine(endAbsolute = 0) |> yLine(endAbsolute = 0)
|> close() |> close()

File diff suppressed because one or more lines are too long

View File

@ -6,10 +6,16 @@ layout: manual
Construct a 2-dimensional circle, of the specified radius, centered atthe provided (x, y) origin point. Construct a 2-dimensional circle, of the specified radius, centered at
the provided (x, y) origin point.
```js ```js
circle(@sketch_or_surface: Sketch | Plane | Face, center: Point2d, radius: number, tag?: tag): Sketch circle(
@sketch_or_surface: Sketch | Plane | Face,
center: Point2d,
radius: number,
tag?: tag,
): Sketch
``` ```

View File

@ -11,7 +11,10 @@ Only works on unclosed sketches for now.
Mirror occurs around a local sketch axis rather than a global axis. Mirror occurs around a local sketch axis rather than a global axis.
```js ```js
mirror2d(@sketches: [Sketch; 1+], axis: Axis2d | Edge): Sketch mirror2d(
@sketches: [Sketch; 1+],
axis: Axis2d | Edge,
): Sketch
``` ```

File diff suppressed because it is too large Load Diff

View File

@ -91,15 +91,9 @@ springSketch = startSketchOn(YZ)
sketch001 = startSketchOn(XY) sketch001 = startSketchOn(XY)
rectangleSketch = startProfileAt([-200, 23.86], sketch001) rectangleSketch = startProfileAt([-200, 23.86], sketch001)
|> angledLine([0, 73.47], %, $rectangleSegmentA001) |> angledLine(angle = 0, length = 73.47, tag = $rectangleSegmentA001)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 50.61)
segAng(rectangleSegmentA001) - 90, |> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001))
50.61
], %)
|> angledLine([
segAng(rectangleSegmentA001),
-segLen(rectangleSegmentA001)
], %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()

View File

@ -32,10 +32,7 @@ pillSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line(end = [20, 0]) |> line(end = [20, 0])
|> tangentialArcToRelative([0, 10], %, $arc1) |> tangentialArcToRelative([0, 10], %, $arc1)
|> angledLine({ |> angledLine(angle = tangentToEnd(arc1), length = 20)
angle = tangentToEnd(arc1),
length = 20
}, %)
|> tangentialArcToRelative([0, -10], %) |> tangentialArcToRelative([0, -10], %)
|> close() |> close()
@ -50,10 +47,7 @@ pillSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line(end = [0, 20]) |> line(end = [0, 20])
|> tangentialArcTo([10, 20], %, $arc1) |> tangentialArcTo([10, 20], %, $arc1)
|> angledLine({ |> angledLine(angle = tangentToEnd(arc1), length = 20)
angle = tangentToEnd(arc1),
length = 20
}, %)
|> tangentialArcToRelative([-10, 0], %) |> tangentialArcToRelative([-10, 0], %)
|> close() |> close()
@ -66,10 +60,7 @@ pillExtrude = extrude(pillSketch, length = 10)
rectangleSketch = startSketchOn(XZ) rectangleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line(end = [10, 0], tag = $seg1) |> line(end = [10, 0], tag = $seg1)
|> angledLine({ |> angledLine(angle = tangentToEnd(seg1), length = 10)
angle = tangentToEnd(seg1),
length = 10
}, %)
|> line(end = [0, 10]) |> line(end = [0, 10])
|> line(end = [-20, 0]) |> line(end = [-20, 0])
|> close() |> close()
@ -83,7 +74,7 @@ rectangleExtrude = extrude(rectangleSketch, length = 10)
bottom = startSketchOn(XY) bottom = startSketchOn(XY)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> arcTo({ end = [10, 10], interior = [5, 1] }, %, $arc1) |> arcTo({ end = [10, 10], interior = [5, 1] }, %, $arc1)
|> angledLine([tangentToEnd(arc1), 20], %) |> angledLine(angle = tangentToEnd(arc1), length = 20)
|> close() |> close()
``` ```
@ -95,7 +86,7 @@ circSketch = startSketchOn(XY)
triangleSketch = startSketchOn(XY) triangleSketch = startSketchOn(XY)
|> startProfileAt([-5, 0], %) |> startProfileAt([-5, 0], %)
|> angledLine([tangentToEnd(circ), 10], %) |> angledLine(angle = tangentToEnd(circ), length = 10)
|> line(end = [-15, 0]) |> line(end = [-15, 0])
|> close() |> close()
``` ```

View File

@ -35,9 +35,9 @@ tangentialArc(
```js ```js
exampleSketch = startSketchOn(XZ) exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ angle = 60, length = 10 }, %) |> angledLine(angle = 60, length = 10)
|> tangentialArc({ radius = 10, offset = -120 }, %) |> tangentialArc({ radius = 10, offset = -120 }, %)
|> angledLine({ angle = -60, length = 10 }, %) |> angledLine(angle = -60, length = 10)
|> close() |> close()
example = extrude(exampleSketch, length = 10) example = extrude(exampleSketch, length = 10)

View File

@ -35,7 +35,7 @@ tangentialArcTo(
```js ```js
exampleSketch = startSketchOn(XZ) exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ angle = 60, length = 10 }, %) |> angledLine(angle = 60, length = 10)
|> tangentialArcTo([15, 15], %) |> tangentialArcTo([15, 15], %)
|> line(end = [10, -15]) |> line(end = [10, -15])
|> close() |> close()

View File

@ -35,7 +35,7 @@ tangentialArcToRelative(
```js ```js
exampleSketch = startSketchOn(XZ) exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ angle = 45, length = 10 }, %) |> angledLine(angle = 45, length = 10)
|> tangentialArcToRelative([0, -10], %) |> tangentialArcToRelative([0, -10], %)
|> line(end = [-10, 0]) |> line(end = [-10, 0])
|> close() |> close()

View File

@ -30,7 +30,7 @@ tau(): number
```js ```js
exampleSketch = startSketchOn(XZ) exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ angle = 50, length = 10 * tau() }, %) |> angledLine(angle = 50, length = 10 * tau())
|> yLine(endAbsolute = 0) |> yLine(endAbsolute = 0)
|> close() |> close()

View File

@ -33,10 +33,7 @@ toDegrees(num: number): number
```js ```js
exampleSketch = startSketchOn(XZ) exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ |> angledLine(angle = 50, length = 70 * cos(toDegrees(pi() / 4)))
angle = 50,
length = 70 * cos(toDegrees(pi() / 4))
}, %)
|> yLine(endAbsolute = 0) |> yLine(endAbsolute = 0)
|> close() |> close()

View File

@ -33,10 +33,7 @@ toRadians(num: number): number
```js ```js
exampleSketch = startSketchOn(XZ) exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ |> angledLine(angle = 50, length = 70 * cos(toRadians(45)))
angle = 50,
length = 70 * cos(toRadians(45))
}, %)
|> yLine(endAbsolute = 0) |> yLine(endAbsolute = 0)
|> close() |> close()

View File

@ -86,15 +86,9 @@ cube
sketch001 = startSketchOn(XY) sketch001 = startSketchOn(XY)
rectangleSketch = startProfileAt([-200, 23.86], sketch001) rectangleSketch = startProfileAt([-200, 23.86], sketch001)
|> angledLine([0, 73.47], %, $rectangleSegmentA001) |> angledLine(angle = 0, length = 73.47, tag = $rectangleSegmentA001)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 50.61)
segAng(rectangleSegmentA001) - 90, |> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001))
50.61
], %)
|> angledLine([
segAng(rectangleSegmentA001),
-segLen(rectangleSegmentA001)
], %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()

View File

@ -184,15 +184,17 @@ way:
```norun ```norun
startSketchOn('XZ') startSketchOn('XZ')
|> startProfileAt(origin, %) |> startProfileAt(origin, %)
|> angledLine({angle = 0, length = 191.26}, %, $rectangleSegmentA001) |> angledLine(angle = 0, length = 191.26, tag = $rectangleSegmentA001)
|> angledLine({ |> angledLine(
angle = segAng(rectangleSegmentA001) - 90, angle = segAng(rectangleSegmentA001) - 90,
length = 196.99, length = 196.99,
}, %, $rectangleSegmentB001) tag = $rectangleSegmentB001,
|> angledLine({ )
|> angledLine(
angle = segAng(rectangleSegmentA001), angle = segAng(rectangleSegmentA001),
length = -segLen(rectangleSegmentA001), length = -segLen(rectangleSegmentA001),
}, %, $rectangleSegmentC001) tag = $rectangleSegmentC001,
)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()
``` ```
@ -217,15 +219,17 @@ However if the code was written like this:
fn rect(origin) { fn rect(origin) {
return startSketchOn('XZ') return startSketchOn('XZ')
|> startProfileAt(origin, %) |> startProfileAt(origin, %)
|> angledLine({angle = 0, length = 191.26}, %, $rectangleSegmentA001) |> angledLine(angle = 0, length = 191.26, tag = $rectangleSegmentA001)
|> angledLine({ |> angledLine(
angle = segAng(rectangleSegmentA001) - 90, angle = segAng(rectangleSegmentA001) - 90,
length = 196.99 length = 196.99,
}, %, $rectangleSegmentB001) tag = $rectangleSegmentB001,
|> angledLine({ )
|> angledLine(
angle = segAng(rectangleSegmentA001), angle = segAng(rectangleSegmentA001),
length = -segLen(rectangleSegmentA001) length = -segLen(rectangleSegmentA001)
}, %, $rectangleSegmentC001) tag = $rectangleSegmentC001,
)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()
} }
@ -245,15 +249,17 @@ For example the following code works.
fn rect(origin) { fn rect(origin) {
return startSketchOn('XZ') return startSketchOn('XZ')
|> startProfileAt(origin, %) |> startProfileAt(origin, %)
|> angledLine({angle = 0, length = 191.26}, %, $rectangleSegmentA001) |> angledLine(angle = 0, length = 191.26, tag = $rectangleSegmentA001)
|> angledLine({ |> angledLine(
angle = segAng(rectangleSegmentA001) - 90, angle = segAng(rectangleSegmentA001) - 90,
length = 196.99 length = 196.99,
}, %, $rectangleSegmentB001) tag = $rectangleSegmentB001,
|> angledLine({ )
|> angledLine(
angle = segAng(rectangleSegmentA001), angle = segAng(rectangleSegmentA001),
length = -segLen(rectangleSegmentA001) length = -segLen(rectangleSegmentA001)
}, %, $rectangleSegmentC001) tag = $rectangleSegmentC001,
)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()
} }

View File

@ -14,15 +14,17 @@ way:
```js ```js
startSketchOn('XZ') startSketchOn('XZ')
|> startProfileAt(origin, %) |> startProfileAt(origin, %)
|> angledLine({angle = 0, length = 191.26}, %, $rectangleSegmentA001) |> angledLine(angle = 0, length = 191.26, tag = $rectangleSegmentA001)
|> angledLine({ |> angledLine(
angle = segAng(rectangleSegmentA001) - 90, angle = segAng(rectangleSegmentA001) - 90,
length = 196.99, length = 196.99,
}, %, $rectangleSegmentB001) tag = $rectangleSegmentB001,
|> angledLine({ )
|> angledLine(
angle = segAng(rectangleSegmentA001), angle = segAng(rectangleSegmentA001),
length = -segLen(rectangleSegmentA001), length = -segLen(rectangleSegmentA001),
}, %, $rectangleSegmentC001) tag = $rectangleSegmentC001,
)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()
``` ```
@ -46,15 +48,16 @@ However if the code was written like this:
fn rect(origin) { fn rect(origin) {
return startSketchOn('XZ') return startSketchOn('XZ')
|> startProfileAt(origin, %) |> startProfileAt(origin, %)
|> angledLine({angle = 0, length = 191.26}, %, $rectangleSegmentA001) |> angledLine(angle = 0, length = 191.26, tag = $rectangleSegmentA001)
|> angledLine({ |> angledLine(
angle = segAng(rectangleSegmentA001) - 90, angle = segAng(rectangleSegmentA001) - 90,
length = 196.99 length = 196.99,
}, %, $rectangleSegmentB001) tag = $rectangleSegmentB001)
|> angledLine({ |> angledLine(
angle = segAng(rectangleSegmentA001), angle = segAng(rectangleSegmentA001),
length = -segLen(rectangleSegmentA001) length = -segLen(rectangleSegmentA001),
}, %, $rectangleSegmentC001) tag = $rectangleSegmentC001
)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()
} }
@ -74,15 +77,15 @@ For example the following code works.
fn rect(origin) { fn rect(origin) {
return startSketchOn('XZ') return startSketchOn('XZ')
|> startProfileAt(origin, %) |> startProfileAt(origin, %)
|> angledLine({angle = 0, length = 191.26}, %, $rectangleSegmentA001) |> angledLine(angle = 0, length = 191.26, tag = $rectangleSegmentA001)
|> angledLine({ |> angledLine(
angle = segAng(rectangleSegmentA001) - 90, angle = segAng(rectangleSegmentA001) - 90,
length = 196.99 length = 196.99
}, %, $rectangleSegmentB001) , %, $rectangleSegmentB001)
|> angledLine({ |> angledLine(
angle = segAng(rectangleSegmentA001), angle = segAng(rectangleSegmentA001),
length = -segLen(rectangleSegmentA001) length = -segLen(rectangleSegmentA001)
}, %, $rectangleSegmentC001) , %, $rectangleSegmentC001)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()
} }

View File

@ -38,10 +38,10 @@ xLine(
exampleSketch = startSketchOn(XZ) exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> xLine(length = 15) |> xLine(length = 15)
|> angledLine({ angle = 80, length = 15 }, %) |> angledLine(angle = 80, length = 15)
|> line(end = [8, -10]) |> line(end = [8, -10])
|> xLine(length = 10) |> xLine(length = 10)
|> angledLine({ angle = 120, length = 30 }, %) |> angledLine(angle = 120, length = 30)
|> xLine(length = -15) |> xLine(length = -15)
|> close() |> close()

View File

@ -38,7 +38,7 @@ yLine(
exampleSketch = startSketchOn(XZ) exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> yLine(length = 15) |> yLine(length = 15)
|> angledLine({ angle = 30, length = 15 }, %) |> angledLine(angle = 30, length = 15)
|> line(end = [8, -10]) |> line(end = [8, -10])
|> yLine(length = -5) |> yLine(length = -5)
|> close() |> close()

View File

@ -137,7 +137,7 @@ async function doBasicSketch(
await page.waitForTimeout(100) await page.waitForTimeout(100)
} }
await page.getByRole('button', { name: 'Length: open menu' }).click() await page.getByRole('button', { name: 'constraints: open menu' }).click()
await page.getByRole('button', { name: 'Equal Length' }).click() await page.getByRole('button', { name: 'Equal Length' }).click()
// Open the code pane. // Open the code pane.

View File

@ -38,7 +38,7 @@ test.describe('Point and click for boolean workflows', () => {
path.resolve( path.resolve(
__dirname, __dirname,
'../../', '../../',
'./rust/kcl-lib/e2e/executor/inputs/boolean-setup-with' './rust/kcl-lib/e2e/executor/inputs/boolean-setup-with-sketch-on-faces.kcl'
), ),
'utf-8' 'utf-8'
) )

View File

@ -1353,4 +1353,51 @@ sketch001 = startSketchOn(XZ)
15 15
) )
}) })
test(`test-toolbar-buttons`, async ({
page,
homePage,
toolbar,
scene,
cmdBar,
}) => {
await test.step('Load an empty file', async () => {
await page.addInitScript(async () => {
localStorage.setItem('persistCode', '')
})
await page.setBodyDimensions({ width: 1200, height: 500 })
await homePage.goToModelingScene()
// wait until scene is ready to be interacted with
await scene.connectionEstablished()
await scene.settled(cmdBar)
})
await test.step('Test toolbar button correct selection', async () => {
await toolbar.expectToolbarMode.toBe('modeling')
await toolbar.startSketchPlaneSelection()
// Click on a default plane
await page.mouse.click(700, 200)
// tools cannot be selected immediately, couldn't find an event to await instead.
await page.waitForTimeout(1000)
await toolbar.selectCenterRectangle()
await expect(page.getByTestId('center-rectangle')).toHaveAttribute(
'aria-pressed',
'true'
)
})
await test.step('Test Toolbar dropdown remembering last selection', async () => {
// Select another tool
await page.getByTestId('circle-center').click()
// center-rectangle should still be the active option in the rectangle dropdown
await expect(page.getByTestId('center-rectangle')).toBeVisible()
})
})
}) })

View File

@ -19,7 +19,7 @@ length001 = timesFive(1) * 5
sketch001 = startSketchOn(XZ) sketch001 = startSketchOn(XZ)
|> startProfileAt([20, 10], %) |> startProfileAt([20, 10], %)
|> line(end = [10, 10]) |> line(end = [10, 10])
|> angledLine([-45, length001], %) |> angledLine(angle = -45, length = length001)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()
revolve001 = revolve(sketch001, axis = X) revolve001 = revolve(sketch001, axis = X)
@ -38,15 +38,9 @@ extrude001 = extrude(sketch002, length = 10)
const FEATURE_TREE_SKETCH_CODE = `sketch001 = startSketchOn(XZ) const FEATURE_TREE_SKETCH_CODE = `sketch001 = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine([0, 4], %, $rectangleSegmentA001) |> angledLine(angle = 0, length = 4, tag = $rectangleSegmentA001)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 2, tag = $rectangleSegmentB001)
segAng(rectangleSegmentA001) - 90, |> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001), tag = $rectangleSegmentC001)
2
], %, $rectangleSegmentB001)
|> angledLine([
segAng(rectangleSegmentA001),
-segLen(rectangleSegmentA001)
], %, $rectangleSegmentC001)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close(%) |> close(%)
extrude001 = extrude(sketch001, length = 10) extrude001 = extrude(sketch001, length = 10)

View File

@ -49,7 +49,9 @@ export class SceneFixture {
constructor(page: Page) { constructor(page: Page) {
this.page = page this.page = page
this.streamWrapper = page.getByTestId('stream') this.streamWrapper = page.getByTestId('stream')
this.networkToggleConnected = page.getByTestId('network-toggle-ok') this.networkToggleConnected = page
.getByTestId('network-toggle-ok')
.or(page.getByTestId('network-toggle-other'))
this.startEditSketchBtn = page this.startEditSketchBtn = page
.getByRole('button', { name: 'Start Sketch' }) .getByRole('button', { name: 'Start Sketch' })
.or(page.getByRole('button', { name: 'Edit Sketch' })) .or(page.getByRole('button', { name: 'Edit Sketch' }))

View File

@ -169,7 +169,7 @@ export class ToolbarFixture {
} }
selectCenterRectangle = async () => { selectCenterRectangle = async () => {
await this.page await this.page
.getByRole('button', { name: 'caret down Corner rectangle:' }) .getByRole('button', { name: 'caret down rectangles:' })
.click() .click()
await expect( await expect(
this.page.getByTestId('dropdown-center-rectangle') this.page.getByTestId('dropdown-center-rectangle')
@ -178,7 +178,7 @@ export class ToolbarFixture {
} }
selectBoolean = async (operation: 'union' | 'subtract' | 'intersect') => { selectBoolean = async (operation: 'union' | 'subtract' | 'intersect') => {
await this.page await this.page
.getByRole('button', { name: 'caret down Union: open menu' }) .getByRole('button', { name: 'caret down booleans: open menu' })
.click() .click()
const operationTestId = `dropdown-boolean-${operation}` const operationTestId = `dropdown-boolean-${operation}`
await expect(this.page.getByTestId(operationTestId)).toBeVisible() await expect(this.page.getByTestId(operationTestId)).toBeVisible()
@ -186,25 +186,19 @@ export class ToolbarFixture {
} }
selectCircleThreePoint = async () => { selectCircleThreePoint = async () => {
await this.page await this.page.getByRole('button', { name: 'caret down circles:' }).click()
.getByRole('button', { name: 'caret down Center circle:' })
.click()
await expect( await expect(
this.page.getByTestId('dropdown-circle-three-points') this.page.getByTestId('dropdown-circle-three-points')
).toBeVisible() ).toBeVisible()
await this.page.getByTestId('dropdown-circle-three-points').click() await this.page.getByTestId('dropdown-circle-three-points').click()
} }
selectArc = async () => { selectArc = async () => {
await this.page await this.page.getByRole('button', { name: 'caret down arcs:' }).click()
.getByRole('button', { name: 'caret down Tangential Arc:' })
.click()
await expect(this.page.getByTestId('dropdown-arc')).toBeVisible() await expect(this.page.getByTestId('dropdown-arc')).toBeVisible()
await this.page.getByTestId('dropdown-arc').click() await this.page.getByTestId('dropdown-arc').click()
} }
selectThreePointArc = async () => { selectThreePointArc = async () => {
await this.page await this.page.getByRole('button', { name: 'caret down arcs:' }).click()
.getByRole('button', { name: 'caret down Tangential Arc:' })
.click()
await expect( await expect(
this.page.getByTestId('dropdown-three-point-arc') this.page.getByTestId('dropdown-three-point-arc')
).toBeVisible() ).toBeVisible()

View File

@ -21,15 +21,9 @@ test.describe('Import UI tests', () => {
path.join(projectDir, 'toBeImported.kcl'), path.join(projectDir, 'toBeImported.kcl'),
`sketch001 = startSketchOn(XZ) `sketch001 = startSketchOn(XZ)
profile001 = startProfileAt([281.54, 305.81], sketch001) profile001 = startProfileAt([281.54, 305.81], sketch001)
|> angledLine([0, 123.43], %, $rectangleSegmentA001) |> angledLine(angle = 0, length = 123.43, tag = $rectangleSegmentA001)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 85.99)
segAng(rectangleSegmentA001) - 90, |> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001))
85.99
], %)
|> angledLine([
segAng(rectangleSegmentA001),
-segLen(rectangleSegmentA001)
], %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()
extrude(profile001, length = 100)` extrude(profile001, length = 100)`
@ -44,15 +38,9 @@ importedCube
sketch001 = startSketchOn(XZ) sketch001 = startSketchOn(XZ)
profile001 = startProfileAt([-134.53, -56.17], sketch001) profile001 = startProfileAt([-134.53, -56.17], sketch001)
|> angledLine([0, 79.05], %, $rectangleSegmentA001) |> angledLine(angle = 0, length = 79.05, tag = $rectangleSegmentA001)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 76.28)
segAng(rectangleSegmentA001) - 90, |> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001), tag = $seg01)
76.28
], %)
|> angledLine([
segAng(rectangleSegmentA001),
-segLen(rectangleSegmentA001)
], %, $seg01)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)], tag = $seg02) |> line(endAbsolute = [profileStartX(%), profileStartY(%)], tag = $seg02)
|> close() |> close()
extrude001 = extrude(profile001, length = 100) extrude001 = extrude(profile001, length = 100)

View File

@ -61,6 +61,7 @@ function tomlStringOverWriteNamedViewUuids(toml: string): string {
} }
test.describe('Named view tests', () => { test.describe('Named view tests', () => {
test.skip() // TODO: Jace is working on these
test('Verify project.toml is not created', async ({ page }, testInfo) => { test('Verify project.toml is not created', async ({ page }, testInfo) => {
// Create project and load it // Create project and load it
const projectName = 'named-views' const projectName = 'named-views'

View File

@ -0,0 +1,16 @@
[settings]
modeling = { }
text_editor = { }
command_bar = { }
[settings.app.named_views.0656fb1a-9640-473e-b334-591dc70c0138]
name = "uuid1"
eye_offset = 1_378.0059
fov_y = 45
is_ortho = false
ortho_scale_enabled = true
ortho_scale_factor = 1.6
pivot_position = [ 0, 0, 0 ]
pivot_rotation = [ 0.5380994, 0.0, 0.0, 0.8428814 ]
world_coord_system = "right_handed_up_z"
version = 1

View File

@ -0,0 +1,28 @@
[settings]
modeling = { }
text_editor = { }
command_bar = { }
[settings.app.named_views.0656fb1a-9640-473e-b334-591dc70c0138]
name = "uuid1"
eye_offset = 1_378.0059
fov_y = 45
is_ortho = false
ortho_scale_enabled = true
ortho_scale_factor = 1.6
pivot_position = [ 0, 0, 0 ]
pivot_rotation = [ 0.5380994, 0.0, 0.0, 0.8428814 ]
world_coord_system = "right_handed_up_z"
version = 1
[settings.app.named_views.c810cf04-c6cc-4a4a-8b11-17bf445dcab7]
name = "uuid2"
eye_offset = 1_378.0059
fov_y = 45
is_ortho = false
ortho_scale_enabled = true
ortho_scale_factor = 1.6
pivot_position = [ 1_826.5239, 0.0, 0.0 ]
pivot_rotation = [ 0.5380994, 0.0, 0.0, 0.8428814 ]
world_coord_system = "right_handed_up_z"
version = 1

View File

@ -7,6 +7,7 @@ import { expect, test } from '@e2e/playwright/zoo-test'
* Test file menu actions that trigger something in the frontend * Test file menu actions that trigger something in the frontend
*/ */
test.describe('Native file menu', { tag: ['@electron'] }, () => { test.describe('Native file menu', { tag: ['@electron'] }, () => {
test.skip() // TODO: Reimplement native file menu tests
test.describe('Home page', () => { test.describe('Home page', () => {
test.describe('File role', () => { test.describe('File role', () => {
test('Home.File.Create project', async ({ tronApp, cmdBar, page }) => { test('Home.File.Create project', async ({ tronApp, cmdBar, page }) => {

View File

@ -48,7 +48,10 @@ test.describe('Onboarding tests', () => {
await expect(page.getByText('Welcome to Design Studio! This')).toBeVisible() await expect(page.getByText('Welcome to Design Studio! This')).toBeVisible()
// *and* that the code is shown in the editor // *and* that the code is shown in the editor
await expect(page.locator('.cm-content')).toContainText('// Shelf Bracket') await expect(page.locator('.cm-content')).toContainText(
'// Shelf Bracket',
{ timeout: 10_000 }
)
// Make sure the model loaded // Make sure the model loaded
const XYPlanePoint = { x: 774, y: 116 } as const const XYPlanePoint = { x: 774, y: 116 } as const
@ -91,7 +94,8 @@ test.describe('Onboarding tests', () => {
// *and* that the code is shown in the editor // *and* that the code is shown in the editor
await expect(page.locator('.cm-content')).toContainText( await expect(page.locator('.cm-content')).toContainText(
'// Shelf Bracket' '// Shelf Bracket',
{ timeout: 10_000 }
) )
// TODO: jess make less shit // TODO: jess make less shit

View File

@ -1,13 +1,47 @@
import * as fsp from 'fs/promises' import * as fsp from 'fs/promises'
import path from 'path' import path from 'path'
import { executorInputPath } from '@e2e/playwright/test-utils' import type { CmdBarFixture } from '@e2e/playwright/fixtures/cmdBarFixture'
import { test } from '@e2e/playwright/zoo-test' import type { ToolbarFixture } from '@e2e/playwright/fixtures/toolbarFixture'
import {
executorInputPath,
getUtils,
testsInputPath,
} from '@e2e/playwright/test-utils'
import { expect, test } from '@e2e/playwright/zoo-test'
import type { Page } from '@playwright/test'
async function insertPartIntoAssembly(
path: string,
alias: string,
toolbar: ToolbarFixture,
cmdBar: CmdBarFixture,
page: Page
) {
await toolbar.insertButton.click()
await cmdBar.selectOption({ name: path }).click()
await cmdBar.expectState({
stage: 'arguments',
currentArgKey: 'localName',
currentArgValue: '',
headerArguments: { Path: path, LocalName: '' },
highlightedHeaderArg: 'localName',
commandName: 'Insert',
})
await page.keyboard.insertText(alias)
await cmdBar.progressCmdBar()
await cmdBar.expectState({
stage: 'review',
headerArguments: { Path: path, LocalName: alias },
commandName: 'Insert',
})
await cmdBar.progressCmdBar()
}
// test file is for testing point an click code gen functionality that's assemblies related // test file is for testing point an click code gen functionality that's assemblies related
test.describe('Point-and-click assemblies tests', () => { test.describe('Point-and-click assemblies tests', () => {
test( test(
`Insert kcl part into assembly as whole module import`, `Insert kcl parts into assembly as whole module import`,
{ tag: ['@electron'] }, { tag: ['@electron'] },
async ({ async ({
context, context,
@ -23,11 +57,14 @@ test.describe('Point-and-click assemblies tests', () => {
fail() fail()
} }
// One dumb hardcoded screen pixel value const midPoint = { x: 500, y: 250 }
const testPoint = { x: 575, y: 200 } const partPoint = { x: midPoint.x + 30, y: midPoint.y - 30 } // mid point, just off top right
const initialColor: [number, number, number] = [50, 50, 50] const defaultPlanesColor: [number, number, number] = [180, 220, 180]
const partColor: [number, number, number] = [150, 150, 150] const partColor: [number, number, number] = [100, 100, 100]
const tolerance = 50 const tolerance = 50
const u = await getUtils(page)
const gizmo = page.locator('[aria-label*=gizmo]')
const resetCameraButton = page.getByRole('button', { name: 'Reset view' })
await test.step('Setup parts and expect empty assembly scene', async () => { await test.step('Setup parts and expect empty assembly scene', async () => {
const projectName = 'assembly' const projectName = 'assembly'
@ -36,41 +73,36 @@ test.describe('Point-and-click assemblies tests', () => {
await fsp.mkdir(bracketDir, { recursive: true }) await fsp.mkdir(bracketDir, { recursive: true })
await Promise.all([ await Promise.all([
fsp.copyFile( fsp.copyFile(
executorInputPath('cylinder-inches.kcl'), executorInputPath('cylinder.kcl'),
path.join(bracketDir, 'cylinder.kcl') path.join(bracketDir, 'cylinder.kcl')
), ),
fsp.copyFile( fsp.copyFile(
executorInputPath('e2e-can-sketch-on-chamfer.kcl'), executorInputPath('e2e-can-sketch-on-chamfer.kcl'),
path.join(bracketDir, 'bracket.kcl') path.join(bracketDir, 'bracket.kcl')
), ),
fsp.copyFile(
testsInputPath('cube.step'),
path.join(bracketDir, 'cube.step')
),
fsp.writeFile(path.join(bracketDir, 'main.kcl'), ''), fsp.writeFile(path.join(bracketDir, 'main.kcl'), ''),
]) ])
}) })
await page.setBodyDimensions({ width: 1000, height: 500 }) await page.setBodyDimensions({ width: 1000, height: 500 })
await homePage.openProject(projectName) await homePage.openProject(projectName)
await scene.settled(cmdBar) await scene.settled(cmdBar)
await scene.expectPixelColor(initialColor, testPoint, tolerance) await toolbar.closePane('code')
await scene.expectPixelColor(defaultPlanesColor, midPoint, tolerance)
}) })
await test.step('Insert first part into the assembly', async () => { await test.step('Insert kcl as first part as module', async () => {
await toolbar.insertButton.click() await insertPartIntoAssembly(
await cmdBar.selectOption({ name: 'cylinder.kcl' }).click() 'cylinder.kcl',
await cmdBar.expectState({ 'cylinder',
stage: 'arguments', toolbar,
currentArgKey: 'localName', cmdBar,
currentArgValue: '', page
headerArguments: { Path: 'cylinder.kcl', LocalName: '' }, )
highlightedHeaderArg: 'localName', await toolbar.openPane('code')
commandName: 'Insert',
})
await page.keyboard.insertText('cylinder')
await cmdBar.progressCmdBar()
await cmdBar.expectState({
stage: 'review',
headerArguments: { Path: 'cylinder.kcl', LocalName: 'cylinder' },
commandName: 'Insert',
})
await cmdBar.progressCmdBar()
await editor.expectEditor.toContain( await editor.expectEditor.toContain(
` `
import "cylinder.kcl" as cylinder import "cylinder.kcl" as cylinder
@ -78,28 +110,27 @@ test.describe('Point-and-click assemblies tests', () => {
`, `,
{ shouldNormalise: true } { shouldNormalise: true }
) )
await scene.expectPixelColor(partColor, testPoint, tolerance) await scene.settled(cmdBar)
// Check scene for changes
await toolbar.closePane('code')
await u.doAndWaitForCmd(async () => {
await gizmo.click({ button: 'right' })
await resetCameraButton.click()
}, 'zoom_to_fit')
await toolbar.closePane('debug')
await scene.expectPixelColor(partColor, partPoint, tolerance)
await toolbar.openPane('code')
}) })
await test.step('Insert second part into the assembly', async () => { await test.step('Insert kcl second part as module', async () => {
await toolbar.insertButton.click() await insertPartIntoAssembly(
await cmdBar.selectOption({ name: 'bracket.kcl' }).click() 'bracket.kcl',
await cmdBar.expectState({ 'bracket',
stage: 'arguments', toolbar,
currentArgKey: 'localName', cmdBar,
currentArgValue: '', page
headerArguments: { Path: 'bracket.kcl', LocalName: '' }, )
highlightedHeaderArg: 'localName',
commandName: 'Insert',
})
await page.keyboard.insertText('bracket')
await cmdBar.progressCmdBar()
await cmdBar.expectState({
stage: 'review',
headerArguments: { Path: 'bracket.kcl', LocalName: 'bracket' },
commandName: 'Insert',
})
await cmdBar.progressCmdBar()
await editor.expectEditor.toContain( await editor.expectEditor.toContain(
` `
import "cylinder.kcl" as cylinder import "cylinder.kcl" as cylinder
@ -109,6 +140,152 @@ test.describe('Point-and-click assemblies tests', () => {
`, `,
{ shouldNormalise: true } { shouldNormalise: true }
) )
await scene.settled(cmdBar)
})
await test.step('Insert a second time and expect error', async () => {
// TODO: revisit once we have clone with #6209
await insertPartIntoAssembly(
'bracket.kcl',
'bracket',
toolbar,
cmdBar,
page
)
await editor.expectEditor.toContain(
`
import "cylinder.kcl" as cylinder
import "bracket.kcl" as bracket
import "bracket.kcl" as bracket
cylinder
bracket
bracket
`,
{ shouldNormalise: true }
)
await scene.settled(cmdBar)
await expect(page.locator('.cm-lint-marker-error')).toBeVisible()
})
}
)
test(
`Insert foreign parts into assembly as whole module import`,
{ tag: ['@electron'] },
async ({
context,
page,
homePage,
scene,
editor,
toolbar,
cmdBar,
tronApp,
}) => {
if (!tronApp) {
fail()
}
const midPoint = { x: 500, y: 250 }
const partPoint = { x: midPoint.x + 30, y: midPoint.y - 30 } // mid point, just off top right
const defaultPlanesColor: [number, number, number] = [180, 220, 180]
const partColor: [number, number, number] = [150, 150, 150]
const tolerance = 50
const complexPlmFileName = 'cube_Complex-PLM_Name_-001.sldprt'
const camelCasedSolidworksFileName = 'cubeComplexPLMName001'
await test.step('Setup parts and expect empty assembly scene', async () => {
const projectName = 'assembly'
await context.folderSetupFn(async (dir) => {
const bracketDir = path.join(dir, projectName)
await fsp.mkdir(bracketDir, { recursive: true })
await Promise.all([
fsp.copyFile(
testsInputPath('cube.step'),
path.join(bracketDir, 'cube.step')
),
fsp.copyFile(
testsInputPath('cube.sldprt'),
path.join(bracketDir, complexPlmFileName)
),
fsp.writeFile(path.join(bracketDir, 'main.kcl'), ''),
])
})
await page.setBodyDimensions({ width: 1000, height: 500 })
await homePage.openProject(projectName)
await scene.settled(cmdBar)
await toolbar.closePane('code')
await scene.expectPixelColor(defaultPlanesColor, midPoint, tolerance)
})
await test.step('Insert step part as module', async () => {
await insertPartIntoAssembly('cube.step', 'cube', toolbar, cmdBar, page)
await toolbar.openPane('code')
await editor.expectEditor.toContain(
`
import "cube.step" as cube
cube
`,
{ shouldNormalise: true }
)
await scene.settled(cmdBar)
// TODO: remove this once #5780 is fixed
await page.reload()
await scene.settled(cmdBar)
await expect(page.locator('.cm-lint-marker-error')).not.toBeVisible()
await toolbar.closePane('code')
await scene.expectPixelColor(partColor, partPoint, tolerance)
})
await test.step('Insert second step part by clicking', async () => {
await toolbar.openPane('files')
await toolbar.expectFileTreeState([
complexPlmFileName,
'cube.step',
'main.kcl',
])
await toolbar.openFile(complexPlmFileName)
// Go through the ToastInsert prompt
await page.getByText('Insert into my current file').click()
// Check getPathFilenameInVariableCase output
const parsedValueFromFile =
await cmdBar.currentArgumentInput.inputValue()
expect(parsedValueFromFile).toEqual(camelCasedSolidworksFileName)
// Continue on with the flow
await page.keyboard.insertText('cubeSw')
await cmdBar.progressCmdBar()
await cmdBar.expectState({
stage: 'review',
headerArguments: { Path: complexPlmFileName, LocalName: 'cubeSw' },
commandName: 'Insert',
})
await cmdBar.progressCmdBar()
await toolbar.closePane('files')
await toolbar.openPane('code')
await editor.expectEditor.toContain(
`
import "cube.step" as cube
import "${complexPlmFileName}" as cubeSw
cube
cubeSw
`,
{ shouldNormalise: true }
)
await scene.settled(cmdBar)
// TODO: remove this once #5780 is fixed
await page.reload()
await scene.settled(cmdBar)
await expect(page.locator('.cm-lint-marker-error')).not.toBeVisible()
await toolbar.closePane('code')
await scene.expectPixelColor(partColor, partPoint, tolerance)
}) })
} }
) )

View File

@ -210,7 +210,7 @@ test.describe('Point-and-click tests', () => {
clickCoords: { x: 570, y: 220 }, clickCoords: { x: 570, y: 220 },
cameraPos: { x: 16020, y: -2000, z: 10500 }, cameraPos: { x: 16020, y: -2000, z: 10500 },
cameraTarget: { x: -150, y: -4500, z: -80 }, cameraTarget: { x: -150, y: -4500, z: -80 },
beforeChamferSnippet: `angledLine([segAng(rectangleSegmentA001)-90,217.26],%,$seg01) beforeChamferSnippet: `angledLine(angle=segAng(rectangleSegmentA001)-90,length=217.26,tag=$seg01)
chamfer(length = 30,tags = [ chamfer(length = 30,tags = [
seg01, seg01,
getNextAdjacentEdge(yo), getNextAdjacentEdge(yo),
@ -223,9 +223,9 @@ test.describe('Point-and-click tests', () => {
'sketch002 = startSketchOn(extrude001, seg03)', 'sketch002 = startSketchOn(extrude001, seg03)',
afterRectangle1stClickSnippet: afterRectangle1stClickSnippet:
'startProfileAt([205.96, 254.59], sketch002)', 'startProfileAt([205.96, 254.59], sketch002)',
afterRectangle2ndClickSnippet: `angledLine([0,11.39],%,$rectangleSegmentA002) afterRectangle2ndClickSnippet: `angledLine(angle=0,length=11.39,tag=$rectangleSegmentA002)
|>angledLine([segAng(rectangleSegmentA002)-90,105.26],%) |>angledLine(angle=segAng(rectangleSegmentA002)-90,length=105.26)
|>angledLine([segAng(rectangleSegmentA002),-segLen(rectangleSegmentA002)],%) |>angledLine(angle=segAng(rectangleSegmentA002),length=-segLen(rectangleSegmentA002))
|>line(endAbsolute=[profileStartX(%),profileStartY(%)]) |>line(endAbsolute=[profileStartX(%),profileStartY(%)])
|>close()`, |>close()`,
}) })
@ -234,10 +234,7 @@ test.describe('Point-and-click tests', () => {
clickCoords: { x: 690, y: 250 }, clickCoords: { x: 690, y: 250 },
cameraPos: { x: 16020, y: -2000, z: 10500 }, cameraPos: { x: 16020, y: -2000, z: 10500 },
cameraTarget: { x: -150, y: -4500, z: -80 }, cameraTarget: { x: -150, y: -4500, z: -80 },
beforeChamferSnippet: `angledLine([ beforeChamferSnippet: `angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 217.26, tag = $seg01)chamfer(
segAng(rectangleSegmentA001) - 90,
217.26
], %, $seg01)chamfer(
length = 30, length = 30,
tags = [ tags = [
seg01, seg01,
@ -250,9 +247,9 @@ test.describe('Point-and-click tests', () => {
'sketch003 = startSketchOn(extrude001, seg04)', 'sketch003 = startSketchOn(extrude001, seg04)',
afterRectangle1stClickSnippet: afterRectangle1stClickSnippet:
'startProfileAt([-209.64, 255.28], sketch003)', 'startProfileAt([-209.64, 255.28], sketch003)',
afterRectangle2ndClickSnippet: `angledLine([0,11.56],%,$rectangleSegmentA003) afterRectangle2ndClickSnippet: `angledLine(angle=0,length=11.56,tag=$rectangleSegmentA003)
|>angledLine([segAng(rectangleSegmentA003)-90,106.84],%) |>angledLine(angle=segAng(rectangleSegmentA003)-90,length=106.84)
|>angledLine([segAng(rectangleSegmentA003),-segLen(rectangleSegmentA003)],%) |>angledLine(angle=segAng(rectangleSegmentA003),length=-segLen(rectangleSegmentA003))
|>line(endAbsolute=[profileStartX(%),profileStartY(%)]) |>line(endAbsolute=[profileStartX(%),profileStartY(%)])
|>close()`, |>close()`,
}) })
@ -261,7 +258,7 @@ test.describe('Point-and-click tests', () => {
clickCoords: { x: 677, y: 87 }, clickCoords: { x: 677, y: 87 },
cameraPos: { x: -6200, y: 1500, z: 6200 }, cameraPos: { x: -6200, y: 1500, z: 6200 },
cameraTarget: { x: 8300, y: 1100, z: 4800 }, cameraTarget: { x: 8300, y: 1100, z: 4800 },
beforeChamferSnippet: `angledLine([0, 268.43], %, $rectangleSegmentA001)chamfer( beforeChamferSnippet: `angledLine(angle = 0, length = 268.43, tag = $rectangleSegmentA001)chamfer(
length = 30, length = 30,
tags = [ tags = [
getNextAdjacentEdge(yo), getNextAdjacentEdge(yo),
@ -272,9 +269,9 @@ test.describe('Point-and-click tests', () => {
'sketch004 = startSketchOn(extrude001, seg05)', 'sketch004 = startSketchOn(extrude001, seg05)',
afterRectangle1stClickSnippet: afterRectangle1stClickSnippet:
'startProfileAt([82.57, 322.96], sketch004)', 'startProfileAt([82.57, 322.96], sketch004)',
afterRectangle2ndClickSnippet: `angledLine([0,11.16],%,$rectangleSegmentA004) afterRectangle2ndClickSnippet: `angledLine(angle=0,length=11.16,tag=$rectangleSegmentA004)
|>angledLine([segAng(rectangleSegmentA004)-90,103.07],%) |>angledLine(angle=segAng(rectangleSegmentA004)-90,length=103.07)
|>angledLine([segAng(rectangleSegmentA004),-segLen(rectangleSegmentA004)],%) |>angledLine(angle=segAng(rectangleSegmentA004),length=-segLen(rectangleSegmentA004))
|>line(endAbsolute=[profileStartX(%),profileStartY(%)]) |>line(endAbsolute=[profileStartX(%),profileStartY(%)])
|>close()`, |>close()`,
}) })
@ -290,9 +287,9 @@ test.describe('Point-and-click tests', () => {
'sketch005 = startSketchOn(extrude001, seg06)', 'sketch005 = startSketchOn(extrude001, seg06)',
afterRectangle1stClickSnippet: afterRectangle1stClickSnippet:
'startProfileAt([-23.43, 19.69], sketch005)', 'startProfileAt([-23.43, 19.69], sketch005)',
afterRectangle2ndClickSnippet: `angledLine([0,9.1],%,$rectangleSegmentA005) afterRectangle2ndClickSnippet: `angledLine(angle=0,length=9.1,tag=$rectangleSegmentA005)
|>angledLine([segAng(rectangleSegmentA005)-90,84.07],%) |>angledLine(angle=segAng(rectangleSegmentA005)-90,length=84.07)
|>angledLine([segAng(rectangleSegmentA005),-segLen(rectangleSegmentA005)],%) |>angledLine(angle=segAng(rectangleSegmentA005),length=-segLen(rectangleSegmentA005))
|>line(endAbsolute=[profileStartX(%),profileStartY(%)]) |>line(endAbsolute=[profileStartX(%),profileStartY(%)])
|>close()`, |>close()`,
}) })
@ -302,15 +299,9 @@ test.describe('Point-and-click tests', () => {
`@settings(defaultLengthUnit = in) `@settings(defaultLengthUnit = in)
sketch001 = startSketchOn(XZ) sketch001 = startSketchOn(XZ)
|> startProfileAt([75.8, 317.2], %) // [$startCapTag, $EndCapTag] |> startProfileAt([75.8, 317.2], %) // [$startCapTag, $EndCapTag]
|> angledLine([0, 268.43], %, $rectangleSegmentA001) |> angledLine(angle = 0, length = 268.43, tag = $rectangleSegmentA001)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 217.26, tag = $seg01)
segAng(rectangleSegmentA001) - 90, |> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001), tag = $yo)
217.26
], %, $seg01)
|> angledLine([
segAng(rectangleSegmentA001),
-segLen(rectangleSegmentA001)
], %, $yo)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)], tag = $seg02) |> line(endAbsolute = [profileStartX(%), profileStartY(%)], tag = $seg02)
|> close() |> close()
extrude001 = extrude(sketch001, length = 100) extrude001 = extrude(sketch001, length = 100)
@ -320,48 +311,30 @@ extrude001 = extrude(sketch001, length = 100)
|> chamfer(length = 30, tags = [getNextAdjacentEdge(yo)], tag = $seg06) |> chamfer(length = 30, tags = [getNextAdjacentEdge(yo)], tag = $seg06)
sketch005 = startSketchOn(extrude001, seg06) sketch005 = startSketchOn(extrude001, seg06)
profile004=startProfileAt([-23.43,19.69], sketch005) profile004=startProfileAt([-23.43,19.69], sketch005)
|> angledLine([0, 9.1], %, $rectangleSegmentA005) |> angledLine(angle = 0, length = 9.1, tag = $rectangleSegmentA005)
|> angledLine([segAng(rectangleSegmentA005) - 90, 84.07], %) |> angledLine(angle = segAng(rectangleSegmentA005) - 90, length = 84.07)
|> angledLine([segAng(rectangleSegmentA005), -segLen(rectangleSegmentA005)], %) |> angledLine(angle = segAng(rectangleSegmentA005), length = -segLen(rectangleSegmentA005))
|> line(endAbsolute=[profileStartX(%), profileStartY(%)]) |> line(endAbsolute=[profileStartX(%), profileStartY(%)])
|> close() |> close()
sketch004 = startSketchOn(extrude001, seg05) sketch004 = startSketchOn(extrude001, seg05)
profile003 = startProfileAt([82.57, 322.96], sketch004) profile003 = startProfileAt([82.57, 322.96], sketch004)
|> angledLine([0, 11.16], %, $rectangleSegmentA004) |> angledLine(angle = 0, length = 11.16, tag = $rectangleSegmentA004)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA004) - 90, length = 103.07)
segAng(rectangleSegmentA004) - 90, |> angledLine(angle = segAng(rectangleSegmentA004), length = -segLen(rectangleSegmentA004))
103.07
], %)
|> angledLine([
segAng(rectangleSegmentA004),
-segLen(rectangleSegmentA004)
], %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()
sketch003 = startSketchOn(extrude001, seg04) sketch003 = startSketchOn(extrude001, seg04)
profile002 = startProfileAt([-209.64, 255.28], sketch003) profile002 = startProfileAt([-209.64, 255.28], sketch003)
|> angledLine([0, 11.56], %, $rectangleSegmentA003) |> angledLine(angle = 0, length = 11.56, tag = $rectangleSegmentA003)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA003) - 90, length = 106.84)
segAng(rectangleSegmentA003) - 90, |> angledLine(angle = segAng(rectangleSegmentA003), length = -segLen(rectangleSegmentA003))
106.84
], %)
|> angledLine([
segAng(rectangleSegmentA003),
-segLen(rectangleSegmentA003)
], %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()
sketch002 = startSketchOn(extrude001, seg03) sketch002 = startSketchOn(extrude001, seg03)
profile001 = startProfileAt([205.96, 254.59], sketch002) profile001 = startProfileAt([205.96, 254.59], sketch002)
|> angledLine([0, 11.39], %, $rectangleSegmentA002) |> angledLine(angle = 0, length = 11.39, tag = $rectangleSegmentA002)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA002) - 90, length = 105.26)
segAng(rectangleSegmentA002) - 90, |> angledLine(angle = segAng(rectangleSegmentA002), length = -segLen(rectangleSegmentA002))
105.26
], %)
|> angledLine([
segAng(rectangleSegmentA002),
-segLen(rectangleSegmentA002)
], %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()
`, `,
@ -401,7 +374,7 @@ profile001 = startProfileAt([205.96, 254.59], sketch002)
clickCoords: { x: 570, y: 220 }, clickCoords: { x: 570, y: 220 },
cameraPos: { x: 16020, y: -2000, z: 10500 }, cameraPos: { x: 16020, y: -2000, z: 10500 },
cameraTarget: { x: -150, y: -4500, z: -80 }, cameraTarget: { x: -150, y: -4500, z: -80 },
beforeChamferSnippet: `angledLine([segAng(rectangleSegmentA001)-90,217.26],%,$seg01) beforeChamferSnippet: `angledLine(angle=segAng(rectangleSegmentA001)-90,length=217.26,tag=$seg01)
chamfer(extrude001,length=30,tags=[ chamfer(extrude001,length=30,tags=[
seg01, seg01,
getNextAdjacentEdge(yo), getNextAdjacentEdge(yo),
@ -413,9 +386,9 @@ profile001 = startProfileAt([205.96, 254.59], sketch002)
'sketch002 = startSketchOn(extrude001, seg03)', 'sketch002 = startSketchOn(extrude001, seg03)',
afterRectangle1stClickSnippet: afterRectangle1stClickSnippet:
'startProfileAt([205.96, 254.59], sketch002)', 'startProfileAt([205.96, 254.59], sketch002)',
afterRectangle2ndClickSnippet: `angledLine([0,11.39],%,$rectangleSegmentA002) afterRectangle2ndClickSnippet: `angledLine(angle=0,length=11.39,tag=$rectangleSegmentA002)
|>angledLine([segAng(rectangleSegmentA002)-90,105.26],%) |>angledLine(angle=segAng(rectangleSegmentA002)-90,length=105.26)
|>angledLine([segAng(rectangleSegmentA002),-segLen(rectangleSegmentA002)],%) |>angledLine(angle=segAng(rectangleSegmentA002),length=-segLen(rectangleSegmentA002))
|>line(endAbsolute=[profileStartX(%),profileStartY(%)]) |>line(endAbsolute=[profileStartX(%),profileStartY(%)])
|>close()`, |>close()`,
}) })
@ -423,15 +396,9 @@ profile001 = startProfileAt([205.96, 254.59], sketch002)
`@settings(defaultLengthUnit = in) `@settings(defaultLengthUnit = in)
sketch001 = startSketchOn(XZ) sketch001 = startSketchOn(XZ)
|> startProfileAt([75.8, 317.2], %) |> startProfileAt([75.8, 317.2], %)
|> angledLine([0, 268.43], %, $rectangleSegmentA001) |> angledLine(angle = 0, length = 268.43, tag = $rectangleSegmentA001)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 217.26, tag = $seg01)
segAng(rectangleSegmentA001) - 90, |> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001), tag = $yo)
217.26
], %, $seg01)
|> angledLine([
segAng(rectangleSegmentA001),
-segLen(rectangleSegmentA001)
], %, $yo)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)], tag = $seg02) |> line(endAbsolute = [profileStartX(%), profileStartY(%)], tag = $seg02)
|> close() |> close()
extrude001 = extrude(sketch001, length = 100) extrude001 = extrude(sketch001, length = 100)
@ -451,15 +418,9 @@ chamf = chamfer(
) )
sketch002 = startSketchOn(extrude001, seg03) sketch002 = startSketchOn(extrude001, seg03)
profile001 = startProfileAt([205.96, 254.59], sketch002) profile001 = startProfileAt([205.96, 254.59], sketch002)
|> angledLine([0, 11.39], %, $rectangleSegmentA002) |> angledLine(angle = 0, length = 11.39, tag = $rectangleSegmentA002)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA002) - 90, length = 105.26)
segAng(rectangleSegmentA002) - 90, |> angledLine(angle = segAng(rectangleSegmentA002), length = -segLen(rectangleSegmentA002))
105.26
], %)
|> angledLine([
segAng(rectangleSegmentA002),
-segLen(rectangleSegmentA002)
], %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()
`, `,
@ -1671,15 +1632,9 @@ sketch002 = startSketchOn(XZ)
initialCode: `@settings(defaultLengthUnit = in) initialCode: `@settings(defaultLengthUnit = in)
sketch001 = startSketchOn(YZ) sketch001 = startSketchOn(YZ)
profile001 = startProfileAt([-400, -400], sketch001) profile001 = startProfileAt([-400, -400], sketch001)
|> angledLine([0, 800], %, $rectangleSegmentA001) |> angledLine(angle = 0, length = 800, tag = $rectangleSegmentA001)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA001) + 90, length = 800)
segAng(rectangleSegmentA001) + 90, |> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001))
800
], %)
|> angledLine([
segAng(rectangleSegmentA001),
-segLen(rectangleSegmentA001)
], %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()
sketch002 = startSketchOn(XZ) sketch002 = startSketchOn(XZ)
@ -3482,26 +3437,29 @@ sweep001 = sweep(sketch001, path = sketch002)
const initialCode = ` const initialCode = `
sketch001 = startSketchOn(XZ) sketch001 = startSketchOn(XZ)
|> startProfileAt([-100.0, 100.0], %) |> startProfileAt([-100.0, 100.0], %)
|> angledLine([0, 200.0], %, $rectangleSegmentA001) |> angledLine(angle = 0, length = 200.0, tag = $rectangleSegmentA001)
|> angledLine([segAng(rectangleSegmentA001) - 90, 200], %, $rectangleSegmentB001) |> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 200, tag = $rectangleSegmentB001)
|> angledLine([ |> angledLine(
segAng(rectangleSegmentA001), angle=segAng(rectangleSegmentA001),
-segLen(rectangleSegmentA001) length=-segLen(rectangleSegmentA001),
], %, $rectangleSegmentC001) tag=$rectangleSegmentC001,
)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()
extrude001 = extrude(sketch001, length = 200) extrude001 = extrude(sketch001, length = 200)
sketch002 = startSketchOn(extrude001, rectangleSegmentA001) sketch002 = startSketchOn(extrude001, rectangleSegmentA001)
|> startProfileAt([-66.77, 84.81], %) |> startProfileAt([-66.77, 84.81], %)
|> angledLine([180, 27.08], %, $rectangleSegmentA002) |> angledLine(angle = 180, length = 27.08, tag = $rectangleSegmentA002)
|> angledLine([ |> angledLine(
segAng(rectangleSegmentA002) - 90, angle=segAng(rectangleSegmentA002) - 90,
27.8 length=27.8,
], %, $rectangleSegmentB002) tag=$rectangleSegmentB002,
|> angledLine([ )
segAng(rectangleSegmentA002), |> angledLine(
-segLen(rectangleSegmentA002) angle=segAng(rectangleSegmentA002),
], %, $rectangleSegmentC002) length=-segLen(rectangleSegmentA002),
tag=$rectangleSegmentC002,
)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()
` `
@ -3571,20 +3529,15 @@ segAng(rectangleSegmentA002),
}) => { }) => {
const initialCode = `sketch001 = startSketchOn(XZ) const initialCode = `sketch001 = startSketchOn(XZ)
|> startProfileAt([-102.57, 101.72], %) |> startProfileAt([-102.57, 101.72], %)
|> angledLine([0, 202.6], %, $rectangleSegmentA001) |> angledLine(angle = 0, length = 202.6, tag = $rectangleSegmentA001)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 202.6, tag = $rectangleSegmentB001)
segAng(rectangleSegmentA001) - 90, |> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001), tag = $rectangleSegmentC001)
202.6
], %, $rectangleSegmentB001)
|> angledLine([
segAng(rectangleSegmentA001),
-segLen(rectangleSegmentA001)
], %, $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(center = [-11.34, 10.0], radius = 8.69) |> circle(center = [-11.34, 10.0], radius = 8.69)
` `
await context.addInitScript((initialCode) => { await context.addInitScript((initialCode) => {
localStorage.setItem('persistCode', initialCode) localStorage.setItem('persistCode', initialCode)
@ -3601,7 +3554,7 @@ sketch002 = startSketchOn(extrude001, rectangleSegmentA001)
await page.getByText(codeToSelection).click() await page.getByText(codeToSelection).click()
await toolbar.revolveButton.click() await toolbar.revolveButton.click()
await page.getByText('Edge', { exact: true }).click() await page.getByText('Edge', { exact: true }).click()
const lineCodeToSelection = `angledLine([0, 202.6], %, $rectangleSegmentA001)` const lineCodeToSelection = `angledLine(angle = 0, length = 202.6, tag = $rectangleSegmentA001)`
await page.getByText(lineCodeToSelection).click() await page.getByText(lineCodeToSelection).click()
await cmdBar.progressCmdBar() await cmdBar.progressCmdBar()
await cmdBar.progressCmdBar() await cmdBar.progressCmdBar()
@ -3658,22 +3611,23 @@ sketch002 = startSketchOn(extrude001, rectangleSegmentA001)
toolbar, toolbar,
cmdBar, cmdBar,
}) => { }) => {
const initialCode = `sketch002 = startSketchOn(XY) const initialCode = `
|> startProfileAt([-2.02, 1.79], %) sketch002 = startSketchOn(XY)
|> xLine(length = 2.6) |> startProfileAt([-2.02, 1.79], %)
sketch001 = startSketchOn(-XY) |> xLine(length = 2.6)
|> startProfileAt([-0.48, 1.25], %) sketch001 = startSketchOn('-XY')
|> angledLine([0, 2.38], %, $rectangleSegmentA001) |> startProfileAt([-0.48, 1.25], %)
|> angledLine([segAng(rectangleSegmentA001) - 90, 2.4], %, $rectangleSegmentB001) |> angledLine(angle = 0, length = 2.38, tag = $rectangleSegmentA001)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 2.4, tag = $rectangleSegmentB001)
segAng(rectangleSegmentA001), |> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001), tag = $rectangleSegmentC001)
-segLen(rectangleSegmentA001) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
], %, $rectangleSegmentC001) |> close()
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) extrude001 = extrude(sketch001, length = 5)
|> close() sketch003 = startSketchOn(extrude001, 'START')
extrude001 = extrude(sketch001, length = 5) |> circle(
sketch003 = startSketchOn(extrude001, 'START') center = [-0.69, 0.56],
|> circle(center = [-0.69, 0.56], radius = 0.28) radius = 0.28
)
` `
await context.addInitScript((initialCode) => { await context.addInitScript((initialCode) => {

View File

@ -41,15 +41,13 @@ sketch002 = startSketchOn(XZ)
extrude002 = extrude(sketch002, length = 50) extrude002 = extrude(sketch002, length = 50)
sketch003 = startSketchOn(XY) sketch003 = startSketchOn(XY)
|> startProfileAt([52.92, 157.81], %) |> startProfileAt([52.92, 157.81], %)
|> angledLine([0, 176.4], %, $rectangleSegmentA001) |> angledLine(angle = 0, length = 176.4, tag = $rectangleSegmentA001)
|> angledLine([ |> angledLine(
segAng(rectangleSegmentA001) - 90, angle = segAng(rectangleSegmentA001) - 90,
53.4 length = 53.4,
], %, $rectangleSegmentB001) tag = $rectangleSegmentB001,
|> angledLine([ )
segAng(rectangleSegmentA001), |> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001), tag = $rectangleSegmentC001)
-segLen(rectangleSegmentA001)
], %, $rectangleSegmentC001)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()
extrude003 = extrude(sketch003, length = 20) extrude003 = extrude(sketch003, length = 20)
@ -74,7 +72,6 @@ test.describe('edit with AI example snapshots', () => {
const submittingToast = page.getByText('Submitting to Text-to-CAD API...') const submittingToast = page.getByText('Submitting to Text-to-CAD API...')
await test.step('wait for scene to load select body and check selection came through', async () => { await test.step('wait for scene to load select body and check selection came through', async () => {
await scene.expectPixelColor([134, 134, 134], body1CapCoords, 15)
await clickBody1Cap() await clickBody1Cap()
await scene.expectPixelColor(yellow, body1CapCoords, 20) await scene.expectPixelColor(yellow, body1CapCoords, 20)
await editor.expectState({ await editor.expectState({

View File

@ -22,15 +22,9 @@ sketch002 = startSketchOn(XZ)
extrude002 = extrude(sketch002, length = 50) extrude002 = extrude(sketch002, length = 50)
sketch003 = startSketchOn(XY) sketch003 = startSketchOn(XY)
|> startProfileAt([52.92, 157.81], %) |> startProfileAt([52.92, 157.81], %)
|> angledLine([0, 176.4], %, $rectangleSegmentA001) |> angledLine(angle = 0, length = 176.4, tag = $rectangleSegmentA001)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 53.4, tag = $rectangleSegmentB001)
segAng(rectangleSegmentA001) - 90, |> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001), tag = $rectangleSegmentC001)
53.4
], %, $rectangleSegmentB001)
|> angledLine([
segAng(rectangleSegmentA001),
-segLen(rectangleSegmentA001)
], %, $rectangleSegmentC001)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()
extrude003 = extrude(sketch003, length = 20) extrude003 = extrude(sketch003, length = 20)
@ -57,6 +51,7 @@ test.describe('Prompt-to-edit tests', { tag: '@skipWin' }, () => {
page, page,
scene, scene,
}) => { }) => {
test.fixme(orRunWhenFullSuiteEnabled())
await context.addInitScript((file) => { await context.addInitScript((file) => {
localStorage.setItem('persistCode', file) localStorage.setItem('persistCode', file)
}, file) }, file)
@ -265,6 +260,7 @@ test.describe('Prompt-to-edit tests', { tag: '@skipWin' }, () => {
page, page,
scene, scene,
}) => { }) => {
test.fixme(orRunWhenFullSuiteEnabled())
const body1CapCoords = { x: 571, y: 311 } const body1CapCoords = { x: 571, y: 311 }
const body2WallCoords = { x: 620, y: 152 } const body2WallCoords = { x: 620, y: 152 }
const [clickBody1Cap] = scene.makeMouseHelpers( const [clickBody1Cap] = scene.makeMouseHelpers(

View File

@ -68,15 +68,9 @@ test.describe('Regression tests', { tag: ['@skipWin'] }, () => {
'persistCode', 'persistCode',
`sketch001 = startSketchOn(XY) `sketch001 = startSketchOn(XY)
|> startProfileAt([82.33, 238.21], %) |> startProfileAt([82.33, 238.21], %)
|> angledLine([0, 288.63], %, $rectangleSegmentA001) |> angledLine(angle = 0, length = 288.63, tag = $rectangleSegmentA001)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 197.97, tag = $rectangleSegmentB001)
segAng(rectangleSegmentA001) - 90, |> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001), tag = $rectangleSegmentC001)
197.97
], %, $rectangleSegmentB001)
|> angledLine([
segAng(rectangleSegmentA001),
-segLen(rectangleSegmentA001)
], %, $rectangleSegmentC001)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()
extrude001 = extrude(sketch001, length = 50) extrude001 = extrude(sketch001, length = 50)
@ -257,7 +251,7 @@ extrude001 = extrude(sketch001, length = 50)
'persistCode', 'persistCode',
`exampleSketch = startSketchOn("XZ") `exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ angle: 50, length: 45 }, %) |> angledLine(angle = 50, length = 45 )
|> yLine(endAbsolute = 0) |> yLine(endAbsolute = 0)
|> close() |> close()
|> |>
@ -313,7 +307,7 @@ extrude001 = extrude(sketch001, length = 50)
await expect(page.locator('.cm-content')) await expect(page.locator('.cm-content'))
.toContainText(`exampleSketch = startSketchOn("XZ") .toContainText(`exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ angle: 50, length: 45 }, %) |> angledLine(angle = 50, length = 45 )
|> yLine(endAbsolute = 0) |> yLine(endAbsolute = 0)
|> close() |> close()
@ -334,15 +328,9 @@ extrude001 = extrude(sketch001, length = 50)
`@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(angle = 0, length = 181.26, tag = $rectangleSegmentA001)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 21.54)
segAng(rectangleSegmentA001) - 90, |> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001))
21.54
], %)
|> angledLine([
segAng(rectangleSegmentA001),
-segLen(rectangleSegmentA001)
], %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()
extrude002 = extrude(profile002, length = 150) extrude002 = extrude(profile002, length = 150)

View File

@ -1222,7 +1222,7 @@ profile001 = startProfileAt([${roundOff(scale * 69.6)}, ${roundOff(
fn lug = (origin, length, diameter, plane) => { fn lug = (origin, length, diameter, plane) => {
lugSketch = startSketchOn(plane) lugSketch = startSketchOn(plane)
|> startProfileAt([origin[0] + lugDiameter / 2, origin[1]], %) |> startProfileAt([origin[0] + lugDiameter / 2, origin[1]], %)
|> angledLineOfYLength({ angle = 60, length = lugHeadLength }, %) |> angledLine(angle = 60, lengthY = lugHeadLength)
|> xLine(endAbsolute = 0 + .001) |> xLine(endAbsolute = 0 + .001)
|> yLine(endAbsolute = 0) |> yLine(endAbsolute = 0)
|> close() |> close()
@ -1977,12 +1977,9 @@ profile003 = startProfileAt([206.63, -56.73], sketch001)
) )
await crnRect1point2() await crnRect1point2()
await editor.expectEditor.toContain( await editor.expectEditor.toContain(
`|> angledLine([0, 2.37], %, $rectangleSegmentA001) `|> angledLine(angle = 0, length = 2.37, tag = $rectangleSegmentA001)
|> angledLine([segAng(rectangleSegmentA001) - 90, 7.8], %) |> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 7.8)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001))
segAng(rectangleSegmentA001),
-segLen(rectangleSegmentA001)
], %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()`.replaceAll('\n', '') |> close()`.replaceAll('\n', '')
) )
@ -1995,15 +1992,9 @@ profile003 = startProfileAt([206.63, -56.73], sketch001)
await crnRect2point2() await crnRect2point2()
await page.waitForTimeout(300) await page.waitForTimeout(300)
await editor.expectEditor.toContain( await editor.expectEditor.toContain(
`|> angledLine([0, 5.49], %, $rectangleSegmentA002) `|> angledLine(angle = 0, length = 5.49, tag = $rectangleSegmentA002)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA002) - 90, length = 4.14)
segAng(rectangleSegmentA002) - 90, |> angledLine(angle = segAng(rectangleSegmentA002), length = -segLen(rectangleSegmentA002))
4.14
], %)
|> angledLine([
segAng(rectangleSegmentA002),
-segLen(rectangleSegmentA002)
], %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()`.replaceAll('\n', '') |> close()`.replaceAll('\n', '')
) )
@ -2020,15 +2011,9 @@ profile003 = startProfileAt([206.63, -56.73], sketch001)
await cntrRect1point2() await cntrRect1point2()
await page.waitForTimeout(300) await page.waitForTimeout(300)
await editor.expectEditor.toContain( await editor.expectEditor.toContain(
`|> angledLine([0, 7.06], %, $rectangleSegmentA003) `|> angledLine(angle = 0, length = 7.06, tag = $rectangleSegmentA003)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA003) + 90, length = 4.34)
segAng(rectangleSegmentA003) + 90, |> angledLine(angle = segAng(rectangleSegmentA003), length = -segLen(rectangleSegmentA003))
4.34
], %)
|> angledLine([
segAng(rectangleSegmentA003),
-segLen(rectangleSegmentA003)
], %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()`.replaceAll('\n', '') |> close()`.replaceAll('\n', '')
) )
@ -2042,15 +2027,9 @@ profile003 = startProfileAt([206.63, -56.73], sketch001)
await cntrRect2point2() await cntrRect2point2()
await page.waitForTimeout(300) await page.waitForTimeout(300)
await editor.expectEditor.toContain( await editor.expectEditor.toContain(
`|> angledLine([0, 3.12], %, $rectangleSegmentA004) `|> angledLine(angle = 0, length = 3.12, tag = $rectangleSegmentA004)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA004) + 90, length = 6.24)
segAng(rectangleSegmentA004) + 90, |> angledLine(angle = segAng(rectangleSegmentA004), length = -segLen(rectangleSegmentA004))
6.24
], %)
|> angledLine([
segAng(rectangleSegmentA004),
-segLen(rectangleSegmentA004)
], %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()`.replaceAll('\n', '') |> close()`.replaceAll('\n', '')
) )
@ -2204,15 +2183,9 @@ profile001 = startProfileAt([6.24, 4.54], sketch001)
|> line(end = [8.61, 0.74]) |> line(end = [8.61, 0.74])
|> line(end = [10.99, -5.22]) |> line(end = [10.99, -5.22])
profile002 = startProfileAt([11.19, 5.02], sketch001) profile002 = startProfileAt([11.19, 5.02], sketch001)
|> angledLine([0, 10.78], %, $rectangleSegmentA001) |> angledLine(angle = 0, length = 10.78, tag = $rectangleSegmentA001)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 4.14)
segAng(rectangleSegmentA001) - 90, |> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001))
4.14
], %)
|> angledLine([
segAng(rectangleSegmentA001),
-segLen(rectangleSegmentA001)
], %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()
profile003 = circle(sketch001, center = [6.92, -4.2], radius = 3.16) profile003 = circle(sketch001, center = [6.92, -4.2], radius = 3.16)
@ -2282,7 +2255,7 @@ profile004 = circleThreePoint(sketch001, p1 = [13.44, -6.8], p2 = [13.39, -2.07]
await rectDragTo() await rectDragTo()
await page.mouse.up() await page.mouse.up()
await editor.expectEditor.toContain( await editor.expectEditor.toContain(
`angledLine([-7, 10.27], %, $rectangleSegmentA001)` `angledLine(angle = -7, length = 10.27, tag = $rectangleSegmentA001)`
) )
}) })
@ -2322,15 +2295,9 @@ profile004 = circleThreePoint(sketch001, p1 = [13.44, -6.8], p2 = [13.39, -2.07]
await page.waitForTimeout(100) await page.waitForTimeout(100)
await rectEnd() await rectEnd()
await editor.expectEditor.toContain( await editor.expectEditor.toContain(
`|> angledLine([180, 1.97], %, $rectangleSegmentA002) `|> angledLine(angle = 180, length = 1.97, tag = $rectangleSegmentA002)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA002) + 90, length = 3.89)
segAng(rectangleSegmentA002) + 90, |> angledLine(angle = segAng(rectangleSegmentA002), length = -segLen(rectangleSegmentA002))
3.89
], %)
|> angledLine([
segAng(rectangleSegmentA002),
-segLen(rectangleSegmentA002)
], %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()`.replaceAll('\n', '') |> close()`.replaceAll('\n', '')
) )
@ -2351,15 +2318,9 @@ profile001 = startProfileAt([6.24, 4.54], sketch001)
|> line(end = [8.61, 0.74]) |> line(end = [8.61, 0.74])
|> line(end = [10.99, -5.22]) |> line(end = [10.99, -5.22])
profile002 = startProfileAt([11.19, 5.02], sketch001) profile002 = startProfileAt([11.19, 5.02], sketch001)
|> angledLine([0, 10.78], %, $rectangleSegmentA001) |> angledLine(angle = 0, length = 10.78, tag = $rectangleSegmentA001)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 4.14)
segAng(rectangleSegmentA001) - 90, |> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001))
4.14
], %)
|> angledLine([
segAng(rectangleSegmentA001),
-segLen(rectangleSegmentA001)
], %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()
profile003 = circle(sketch001, center = [6.92, -4.2], radius = 3.16) profile003 = circle(sketch001, center = [6.92, -4.2], radius = 3.16)
@ -2460,15 +2421,9 @@ profile001 = startProfileAt([-63.43, 193.08], sketch001)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()
profile003 = startProfileAt([16.79, 38.24], sketch001) profile003 = startProfileAt([16.79, 38.24], sketch001)
|> angledLine([0, 182.82], %, $rectangleSegmentA001) |> angledLine(angle = 0, length = 182.82, tag = $rectangleSegmentA001)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 105.71)
segAng(rectangleSegmentA001) - 90, |> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001))
105.71
], %)
|> angledLine([
segAng(rectangleSegmentA001),
-segLen(rectangleSegmentA001)
], %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()
profile004 = circle( profile004 = circle(
@ -2684,15 +2639,9 @@ profile002 = startProfileAt([0.75, 13.46], sketch002)
|> line(end = [4.52, 3.79]) |> line(end = [4.52, 3.79])
|> line(end = [5.98, -2.81]) |> line(end = [5.98, -2.81])
profile003 = startProfileAt([3.19, 13.3], sketch002) profile003 = startProfileAt([3.19, 13.3], sketch002)
|> angledLine([0, 6.64], %, $rectangleSegmentA001) |> angledLine(angle = 0, length = 6.64, tag = $rectangleSegmentA001)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 2.81)
segAng(rectangleSegmentA001) - 90, |> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001))
2.81
], %)
|> angledLine([
segAng(rectangleSegmentA001),
-segLen(rectangleSegmentA001)
], %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()
profile004 = startProfileAt([3.15, 9.39], sketch002) profile004 = startProfileAt([3.15, 9.39], sketch002)
@ -2732,15 +2681,9 @@ profile010 = circle(
radius = 2.67 radius = 2.67
) )
profile011 = startProfileAt([5.07, -6.39], sketch003) profile011 = startProfileAt([5.07, -6.39], sketch003)
|> angledLine([0, 4.54], %, $rectangleSegmentA002) |> angledLine(angle = 0, length = 4.54, tag = $rectangleSegmentA002)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA002) - 90, length = 4.17)
segAng(rectangleSegmentA002) - 90, |> angledLine(angle = segAng(rectangleSegmentA002), length = -segLen(rectangleSegmentA002))
4.17
], %)
|> angledLine([
segAng(rectangleSegmentA002),
-segLen(rectangleSegmentA002)
], %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()
extrude003 = extrude(profile011, length = 2.5) extrude003 = extrude(profile011, length = 2.5)
@ -2889,7 +2832,7 @@ loft([profile001, profile002])
) )
await rect1Crn2() await rect1Crn2()
await editor.expectEditor.toContain( await editor.expectEditor.toContain(
`angledLine([0, 113.01], %, $rectangleSegmentA001)` `angledLine(angle = 0, length = 113.01, tag = $rectangleSegmentA001)`
) )
} }
) )
@ -2960,7 +2903,7 @@ loft([profile001, profile002])
) )
await rect1Crn2() await rect1Crn2()
await editor.expectEditor.toContain( await editor.expectEditor.toContain(
`angledLine([0, 106.42], %, $rectangleSegmentA001)` `angledLine(angle = 0, length = 106.42], tag = $rectangleSegmentA001)`
) )
await page.waitForTimeout(100) await page.waitForTimeout(100)
}) })

View File

@ -70,10 +70,11 @@ part001 = startSketchOn(-XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> yLine(length = baseHeight) |> yLine(length = baseHeight)
|> xLine(length = baseLen) |> xLine(length = baseLen)
|> angledLineToY({ |> angledLine(
angle = topAng, angle = topAng,
to = totalHeightHalf, endAbsoluteY = totalHeightHalf,
}, %, $seg04) tag = $seg04,
)
|> xLine(endAbsolute = totalLen, tag = $seg03) |> xLine(endAbsolute = totalLen, tag = $seg03)
|> yLine(length = -armThick, tag = $seg01) |> yLine(length = -armThick, tag = $seg01)
|> angledLineThatIntersects({ |> angledLineThatIntersects({
@ -81,11 +82,12 @@ part001 = startSketchOn(-XZ)
offset = -armThick, offset = -armThick,
intersectTag = seg04 intersectTag = seg04
}, %) }, %)
|> angledLineToY([segAng(seg04, %) + 180, turns::ZERO], %) |> angledLine(angle = segAng(seg04, %) + 180, endAbsoluteY = turns::ZERO)
|> angledLineToY({ |> angledLine(
angle = -bottomAng, angle = -bottomAng,
to = -totalHeightHalf - armThick, endAbsoluteY = -totalHeightHalf - armThick,
}, %, $seg02) tag = $seg02,
)
|> xLine(length = endAbsolute = segEndX(seg03) + 0) |> xLine(length = endAbsolute = segEndX(seg03) + 0)
|> yLine(length = -segLen(seg01, %)) |> yLine(length = -segLen(seg01, %))
|> angledLineThatIntersects({ |> angledLineThatIntersects({
@ -93,7 +95,7 @@ part001 = startSketchOn(-XZ)
offset = -armThick, offset = -armThick,
intersectTag = seg02 intersectTag = seg02
}, %) }, %)
|> angledLineToY([segAng(seg02, %) + 180, -baseHeight], %) |> angledLine(angle = segAng(seg02, %) + 180, endAbsoluteY = -baseHeight)
|> xLine(endAbsolute = turns::ZERO) |> xLine(endAbsolute = turns::ZERO)
|> close() |> close()
|> extrude(length = 4)` |> extrude(length = 4)`

View File

@ -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(angle = 0, length = 176.4, tag = $rectangleSegmentA001)\n |> angledLine(angle = segAng(rectangleSegmentA001) - 90,\n length = 53.4\n ], tag = $rectangleSegmentB001)\n |> angledLine(angle = segAng(rectangleSegmentA001),\n length = -segLen(rectangleSegmentA001)\n tag = $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": [
{ {

View File

@ -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(angle = 0, 176.4], %, $rectangleSegmentA001)\n |> angledLine([\n segAng(rectangleSegmentA001) - 90,\n 53.4\n ], %, length = $rectangleSegmentB001)\n |> angledLine(\n angle = segAng(rectangleSegmentA001),\n length = -segLen(rectangleSegmentA001),\n tag = $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": [
{ {
@ -30,4 +30,4 @@
} }
], ],
"kcl_version": "0.2.57" "kcl_version": "0.2.57"
} }

View File

@ -84,15 +84,15 @@ export const TEST_CODE_GIZMO = `@settings(defaultLengthUnit = in)
part001 = startSketchOn(XZ) 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 )
|> line(endAbsolute = [20.14 + 0, -0.14 + 0]) |> line(endAbsolute = [20.14 + 0, -0.14 + 0])
|> xLine(endAbsolute = 29 + 0) |> xLine(endAbsolute = 29 + 0)
|> yLine(length = -3.14 + 0, tag = $a) |> yLine(length = -3.14 + 0, tag = $a)
|> xLine(length = 1.63) |> xLine(length = 1.63)
|> angledLineOfXLength({ angle: 3 + 0, length: 3.14 }, %) |> angledLine(angle = 3 + 0, lengthX = 3.14 )
|> angledLineOfYLength({ angle: 30, length: 3 + 0 }, %) |> angledLine(angle = 30, lengthY = 3 + 0 )
|> angledLineToX({ angle: 22.14 + 0, to: 12 }, %) |> angledLine(angle = 22.14 + 0, endAbsoluteX = 12)
|> angledLineToY({ angle: 30, to: 11.14 }, %) |> angledLine(angle = 30, endAbsoluteY = 11.14)
|> angledLineThatIntersects({ |> angledLineThatIntersects({
angle: 3.14, angle: 3.14,
intersectTag: a, intersectTag: a,

View File

@ -1021,6 +1021,10 @@ export function executorInputPath(fileName: string): string {
return path.join('rust', 'kcl-lib', 'e2e', 'executor', 'inputs', fileName) return path.join('rust', 'kcl-lib', 'e2e', 'executor', 'inputs', fileName)
} }
export function testsInputPath(fileName: string): string {
return path.join('rust', 'kcl-lib', 'tests', 'inputs', fileName)
}
export async function doAndWaitForImageDiff( export async function doAndWaitForImageDiff(
page: Page, page: Page,
fn: () => Promise<unknown>, fn: () => Promise<unknown>,

View File

@ -58,7 +58,7 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
.click() .click()
await expect(page.locator('.cm-content')).toHaveText( await expect(page.locator('.cm-content')).toHaveText(
`length001 = 20sketch001 = startSketchOn(XY) |> startProfileAt([-10, -10], %) |> line(end = [20, 0]) |> angledLine([90, length001], %) |> xLine(length = -20)` `length001 = 20sketch001 = startSketchOn(XY) |> startProfileAt([-10, -10], %) |> line(end = [20, 0]) |> angledLine(angle = 90, length = length001) |> xLine(length = -20)`
) )
// Make sure we didn't pop out of sketch mode. // Make sure we didn't pop out of sketch mode.
@ -87,7 +87,7 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
|> 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)
|> line(end = [78.92, -120.11]) |> line(end = [78.92, -120.11])
|> angledLine([segAng(seg01), yo], %) |> angledLine(angle = segAng(seg01), length = yo)
|> line(end = [41.19, 58.97 + 5]) |> line(end = [41.19, 58.97 + 5])
part002 = startSketchOn(XZ) part002 = startSketchOn(XZ)
|> startProfileAt([299.05, 120], %) |> startProfileAt([299.05, 120], %)
@ -115,7 +115,7 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
await page.waitForTimeout(100) // this wait is needed for webkit - not sure why await page.waitForTimeout(100) // this wait is needed for webkit - not sure why
await page await page
.getByRole('button', { .getByRole('button', {
name: 'Length: open menu', name: 'constraints: open menu',
}) })
.click() .click()
await page.getByRole('button', { name: 'remove constraints' }).click() await page.getByRole('button', { name: 'remove constraints' }).click()
@ -152,7 +152,7 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
|> 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)
|> line(end = [78.92, -120.11]) |> line(end = [78.92, -120.11])
|> angledLine([segAng(seg01), 78.33], %) |> angledLine(angle = segAng(seg01), length = 78.33)
|> line(end = [51.19, 48.97]) |> line(end = [51.19, 48.97])
part002 = startSketchOn(XZ) part002 = startSketchOn(XZ)
|> startProfileAt([299.05, 231.45], %) |> startProfileAt([299.05, 231.45], %)
@ -189,7 +189,7 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
await page.waitForTimeout(100) await page.waitForTimeout(100)
await page await page
.getByRole('button', { .getByRole('button', {
name: 'Length: open menu', name: 'constraints: open menu',
}) })
.click() .click()
await page await page
@ -299,7 +299,7 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
await page.keyboard.up('Shift') await page.keyboard.up('Shift')
await page await page
.getByRole('button', { .getByRole('button', {
name: 'Length: open menu', name: 'constraints: open menu',
}) })
.click() .click()
await page.getByRole('button', { name: constraint }).click() await page.getByRole('button', { name: constraint }).click()
@ -420,7 +420,7 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
await page.waitForTimeout(100) await page.waitForTimeout(100)
await page await page
.getByRole('button', { .getByRole('button', {
name: 'Length: open menu', name: 'constraints: open menu',
}) })
.click() .click()
await page await page
@ -533,7 +533,7 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
await page.keyboard.up('Shift') await page.keyboard.up('Shift')
await page await page
.getByRole('button', { .getByRole('button', {
name: 'Length: open menu', name: 'constraints: open menu',
}) })
.click() .click()
await page.getByTestId('dropdown-constraint-angle').click() await page.getByTestId('dropdown-constraint-angle').click()
@ -552,7 +552,7 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
// checking activeLines assures the cursors are where they should be // checking activeLines assures the cursors are where they should be
const codeAfter = [ const codeAfter = [
'|> line(end = [74.36, 130.4], tag = $seg01)', '|> line(end = [74.36, 130.4], tag = $seg01)',
`|> angledLine([${value}, 78.33], %)`, `|> angledLine(angle = ${value}, length = 78.33)`,
] ]
if (axisSelect) codeAfter.shift() if (axisSelect) codeAfter.shift()
@ -627,7 +627,7 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
await page.mouse.click(line3.x, line3.y) await page.mouse.click(line3.x, line3.y)
await page await page
.getByRole('button', { .getByRole('button', {
name: 'Length: open menu', name: 'constraints: open menu',
}) })
.click() .click()
await page.getByTestId('dropdown-constraint-' + constraint).click() await page.getByTestId('dropdown-constraint-' + constraint).click()
@ -639,7 +639,8 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
.getByRole('button', { name: 'Add constraining value' }) .getByRole('button', { name: 'Add constraining value' })
.click() .click()
const changedCode = `|> angledLine([${value}], %)` const [ang, len] = value.split(', ')
const changedCode = `|> angledLine(angle = ${ang}, length = ${len})`
await expect(page.locator('.cm-content')).toContainText(changedCode) await expect(page.locator('.cm-content')).toContainText(changedCode)
// checking active assures the cursor is where it should be // checking active assures the cursor is where it should be
await expect(page.locator('.cm-activeLine')).toHaveText(changedCode) await expect(page.locator('.cm-activeLine')).toHaveText(changedCode)
@ -719,7 +720,7 @@ part002 = startSketchOn(XZ)
await page.mouse.click(line3.x, line3.y) await page.mouse.click(line3.x, line3.y)
await page await page
.getByRole('button', { .getByRole('button', {
name: 'Length: open menu', name: 'constraints: open menu',
}) })
.click() .click()
await page.getByTestId('dropdown-constraint-' + constraint).click() await page.getByTestId('dropdown-constraint-' + constraint).click()
@ -733,7 +734,8 @@ part002 = startSketchOn(XZ)
await expect(cmdBarKclInput).toHaveText('78.33') await expect(cmdBarKclInput).toHaveText('78.33')
await cmdBarSubmitButton.click() await cmdBarSubmitButton.click()
const changedCode = `|> angledLine([${value}], %)` const [ang, len] = value.split(', ')
const changedCode = `|> angledLine(angle = ${ang}, length = ${len})`
await expect(page.locator('.cm-content')).toContainText(changedCode) await expect(page.locator('.cm-content')).toContainText(changedCode)
// checking active assures the cursor is where it should be // checking active assures the cursor is where it should be
await expect(page.locator('.cm-activeLine')).toHaveText(changedCode) await expect(page.locator('.cm-activeLine')).toHaveText(changedCode)
@ -817,7 +819,7 @@ part002 = startSketchOn(XZ)
const activeLinesContent = await page.locator('.cm-activeLine').all() const activeLinesContent = await page.locator('.cm-activeLine').all()
const constraintMenuButton = page.getByRole('button', { const constraintMenuButton = page.getByRole('button', {
name: 'Length: open menu', name: 'constraints: open menu',
}) })
const constraintButton = page const constraintButton = page
.getByRole('button', { .getByRole('button', {
@ -848,11 +850,11 @@ part002 = startSketchOn(XZ)
test.describe('Two segment - no modal constraints', () => { test.describe('Two segment - no modal constraints', () => {
const cases = [ const cases = [
{ {
codeAfter: `|> angledLine([83, segLen(seg01)], %)`, codeAfter: `|> angledLine(angle = 83, length = segLen(seg01))`,
constraintName: 'Equal Length', constraintName: 'Equal Length',
}, },
{ {
codeAfter: `|> angledLine([segAng(seg01), 78.33], %)`, codeAfter: `|> angledLine(angle = segAng(seg01), length = 78.33)`,
constraintName: 'Parallel', constraintName: 'Parallel',
}, },
{ {
@ -905,7 +907,7 @@ part002 = startSketchOn(XZ)
await page.mouse.click(line3.x - 3, line3.y + 20) await page.mouse.click(line3.x - 3, line3.y + 20)
await page.keyboard.up('Shift') await page.keyboard.up('Shift')
const constraintMenuButton = page.getByRole('button', { const constraintMenuButton = page.getByRole('button', {
name: 'Length: open menu', name: 'constraints: open menu',
}) })
const constraintButton = page.getByRole('button', { const constraintButton = page.getByRole('button', {
name: constraintName, name: constraintName,
@ -990,7 +992,7 @@ part002 = startSketchOn(XZ)
await page.keyboard.up('Shift') await page.keyboard.up('Shift')
await page.waitForTimeout(100) await page.waitForTimeout(100)
const constraintMenuButton = page.getByRole('button', { const constraintMenuButton = page.getByRole('button', {
name: 'Length: open menu', name: 'constraints: open menu',
}) })
const constraintButton = page.getByRole('button', { const constraintButton = page.getByRole('button', {
name: constraintName, name: constraintName,
@ -1057,7 +1059,7 @@ part002 = startSketchOn(XZ)
await page await page
.getByRole('button', { .getByRole('button', {
name: 'Length: open menu', name: 'constraints: open menu',
}) })
.click() .click()
await page.waitForTimeout(500) await page.waitForTimeout(500)
@ -1129,7 +1131,7 @@ test.describe('Electron constraint tests', () => {
|> line(end = [15.1, 2.48]) |> line(end = [15.1, 2.48])
|> line(end = [3.15, -9.85], tag = $seg01) |> line(end = [3.15, -9.85], tag = $seg01)
|> line(end = [-15.17, -4.1]) |> line(end = [-15.17, -4.1])
|> angledLine([segAng(seg01), 12.35], %) |> angledLine(angle = segAng(seg01), length = 12.35)
|> line(end = [-13.02, 10.03]) |> line(end = [-13.02, 10.03])
|> close() |> close()
|> extrude(length = 4)`, |> extrude(length = 4)`,
@ -1169,7 +1171,9 @@ test.describe('Electron constraint tests', () => {
await clickOnFirstSegmentLabel() await clickOnFirstSegmentLabel()
await cmdBar.progressCmdBar() await cmdBar.progressCmdBar()
await editor.expectEditor.toContain('length001 = 15.3') await editor.expectEditor.toContain('length001 = 15.3')
await editor.expectEditor.toContain('|> angledLine([9, length001], %)') await editor.expectEditor.toContain(
'|> angledLine(angle = 9, length = length001)'
)
}) })
await test.step('Double click again and expect failure', async () => { await test.step('Double click again and expect failure', async () => {

View File

@ -259,15 +259,9 @@ test.describe(`Testing gizmo, fixture-based`, () => {
`@settings(defaultLengthUnit = in) `@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(angle = 0, length = 105.13, tag = $rectangleSegmentA001)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 77.9)
segAng(rectangleSegmentA001) - 90, |> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001))
77.9
], %)
|> angledLine([
segAng(rectangleSegmentA001),
-segLen(rectangleSegmentA001)
], %)
|> close() |> close()
const sketch001 = startSketchOn(XZ) const sketch001 = startSketchOn(XZ)
|> circle(center = [818.33, 168.1], radius = 182.8) |> circle(center = [818.33, 168.1], radius = 182.8)

View File

@ -214,16 +214,16 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
part001 = startSketchOn(XZ) 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)
|> line(endAbsolute = [5 + 33, 20 + 11.5 + 0]) |> line(endAbsolute = [5 + 33, 20 + 11.5 + 0])
|> xLine(endAbsolute = 5 + 9 - 5) |> xLine(endAbsolute = 5 + 9 - 5)
|> yLine(endAbsolute = 20 + -10.77, tag = $a) |> yLine(endAbsolute = 20 + -10.77, tag = $a)
|> xLine(length = 26.04) |> xLine(length = 26.04)
|> yLine(length = 21.14 + 0) |> yLine(length = 21.14 + 0)
|> angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %) |> angledLine(angle = 181 + 0, lengthX = 23.14)
|> angledLineOfYLength({ angle = -91, length = 19 + 0 }, %) |> angledLine(angle = -91, lengthY = 19 + 0)
|> angledLineToX({ angle = 3 + 0, to = 5 + 26 }, %) |> angledLine(angle = 3 + 0, endAbsoluteX = 5 + 26)
|> angledLineToY({ angle = 89, to = 20 + 9.14 + 0 }, %) |> angledLine(angle = 89, endAbsoluteY = 20 + 9.14 + 0)
|> angledLineThatIntersects({ |> angledLineThatIntersects({
angle = 4.14, angle = 4.14,
intersectTag = a, intersectTag = a,
@ -306,11 +306,9 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
await clickConstrained({ await clickConstrained({
hoverPos: { x: angledLine.x, y: angledLine.y }, hoverPos: { x: angledLine.x, y: angledLine.y },
constraintType: 'angle', constraintType: 'angle',
expectBeforeUnconstrained: expectBeforeUnconstrained: 'angledLine(angle = 3 + 0, length = 32 + 0)',
'angledLine({ angle = 3 + 0, length = 32 + 0 }, %)', expectAfterUnconstrained: 'angledLine(angle = 3, length = 32 + 0)',
expectAfterUnconstrained: expectFinal: 'angledLine(angle = angle001, length = 32 + 0)',
'angledLine({ angle = 3, length = 32 + 0 }, %)',
expectFinal: 'angledLine({ angle = angle001, length = 32 + 0 }, %)',
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="1"]', locator: '[data-overlay-toolbar-index="1"]',
}) })
@ -319,10 +317,9 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
hoverPos: { x: angledLine.x, y: angledLine.y }, hoverPos: { x: angledLine.x, y: angledLine.y },
constraintType: 'length', constraintType: 'length',
expectBeforeUnconstrained: expectBeforeUnconstrained:
'angledLine({ angle = angle001, length = 32 + 0 }, %)', 'angledLine(angle = angle001, length = 32 + 0)',
expectAfterUnconstrained: expectAfterUnconstrained: 'angledLine(angle = angle001, length = 32)',
'angledLine({ angle = angle001, length = 32 }, %)', expectFinal: 'angledLine(angle = angle001, length = len001)',
expectFinal: 'angledLine({ angle = angle001, length = len001 }, %)',
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="1"]', locator: '[data-overlay-toolbar-index="1"]',
}) })
@ -392,13 +389,13 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
part001 = startSketchOn(XZ) part001 = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line(end = [0.5, yRel001]) |> line(end = [0.5, yRel001])
|> angledLine({ angle = angle001, length = len001 }, %) |> angledLine(angle = angle001, length = len001)
|> line(endAbsolute = [33, yAbs001]) |> line(endAbsolute = [33, yAbs001])
|> xLine(endAbsolute = xAbs002) |> xLine(endAbsolute = xAbs002)
|> yLine(endAbsolute = -10.77, tag = $a) |> yLine(endAbsolute = -10.77, tag = $a)
|> xLine(length = 26.04) |> xLine(length = 26.04)
|> yLine(length = 21.14 + 0) |> yLine(length = 21.14 + 0)
|> angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %) |> angledLine(angle = 181 + 0, lengthX = 23.14)
` `
) )
}) })
@ -465,16 +462,16 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
part001 = startSketchOn(XZ) part001 = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line(end = [0.5, -14 + 0]) |> line(end = [0.5, -14 + 0])
|> angledLine({ angle = 3 + 0, length = 32 + 0 }, %) |> angledLine(angle = 3 + 0, length = 32 + 0)
|> line(endAbsolute = [33, 11.5 + 0]) |> line(endAbsolute = [33, 11.5 + 0])
|> xLine(endAbsolute = 9 - 5) |> xLine(endAbsolute = 9 - 5)
|> yLine(endAbsolute = -10.77, tag = $a) |> yLine(endAbsolute = -10.77, tag = $a)
|> xLine(length = 26.04) |> xLine(length = 26.04)
|> yLine(length = 21.14 + 0) |> yLine(length = 21.14 + 0)
|> angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %) |> angledLine(angle = 181 + 0, lengthX = 23.14)
|> angledLineOfYLength({ angle = -91, length = 19 + 0 }, %) |> angledLine(angle = -91, lengthY = 19 + 0)
|> angledLineToX({ angle = 3 + 0, to = 26 }, %) |> angledLine(angle = 3 + 0, endAbsoluteX = 26)
|> angledLineToY({ angle = 89, to = 9.14 + 0 }, %) |> angledLine(angle = 89, endAbsoluteY = 9.14 + 0)
|> angledLineThatIntersects({ |> angledLineThatIntersects({
angle = 4.14, angle = 4.14,
intersectTag = a, intersectTag = a,
@ -530,11 +527,9 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
hoverPos: { x: angledLineOfXLength.x, y: angledLineOfXLength.y }, hoverPos: { x: angledLineOfXLength.x, y: angledLineOfXLength.y },
constraintType: 'angle', constraintType: 'angle',
expectBeforeUnconstrained: expectBeforeUnconstrained:
'angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %)', 'angledLine(angle = 181 + 0, lengthX = 23.14)',
expectAfterUnconstrained: expectAfterUnconstrained: 'angledLine(angle = -179, lengthX = 23.14)',
'angledLineOfXLength({ angle = -179, length = 23.14 }, %)', expectFinal: 'angledLine(angle = angle001, lengthX = 23.14)',
expectFinal:
'angledLineOfXLength({ angle = angle001, length = 23.14 }, %)',
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="7"]', locator: '[data-overlay-toolbar-index="7"]',
}) })
@ -543,11 +538,10 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
hoverPos: { x: angledLineOfXLength.x, y: angledLineOfXLength.y }, hoverPos: { x: angledLineOfXLength.x, y: angledLineOfXLength.y },
constraintType: 'xRelative', constraintType: 'xRelative',
expectBeforeUnconstrained: expectBeforeUnconstrained:
'angledLineOfXLength({ angle = angle001, length = 23.14 }, %)', 'angledLine(angle = angle001, lengthX = 23.14)',
expectAfterUnconstrained: expectAfterUnconstrained:
'angledLineOfXLength({ angle = angle001, length = xRel001 }, %)', 'angledLine(angle = angle001, lengthX = xRel001)',
expectFinal: expectFinal: 'angledLine(angle = angle001, lengthX = 23.14)',
'angledLineOfXLength({ angle = angle001, length = 23.14 }, %)',
steps: 7, steps: 7,
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="7"]', locator: '[data-overlay-toolbar-index="7"]',
@ -561,11 +555,10 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
await clickUnconstrained({ await clickUnconstrained({
hoverPos: { x: angledLineOfYLength.x, y: angledLineOfYLength.y }, hoverPos: { x: angledLineOfYLength.x, y: angledLineOfYLength.y },
constraintType: 'angle', constraintType: 'angle',
expectBeforeUnconstrained: expectBeforeUnconstrained: 'angledLine(angle = -91, lengthY = 19 + 0)',
'angledLineOfYLength({ angle = -91, length = 19 + 0 }, %)',
expectAfterUnconstrained: expectAfterUnconstrained:
'angledLineOfYLength({ angle = angle002, length = 19 + 0 }, %)', 'angledLine(angle = angle002, lengthY = 19 + 0)',
expectFinal: 'angledLineOfYLength({ angle = -91, length = 19 + 0 }, %)', expectFinal: 'angledLine(angle = -91, lengthY = 19 + 0)',
ang: ang + 180, ang: ang + 180,
steps: 6, steps: 6,
locator: '[data-overlay-toolbar-index="8"]', locator: '[data-overlay-toolbar-index="8"]',
@ -574,12 +567,9 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
await clickConstrained({ await clickConstrained({
hoverPos: { x: angledLineOfYLength.x, y: angledLineOfYLength.y }, hoverPos: { x: angledLineOfYLength.x, y: angledLineOfYLength.y },
constraintType: 'yRelative', constraintType: 'yRelative',
expectBeforeUnconstrained: expectBeforeUnconstrained: 'angledLine(angle = -91, lengthY = 19 + 0)',
'angledLineOfYLength({ angle = -91, length = 19 + 0 }, %)', expectAfterUnconstrained: 'angledLine(angle = -91, lengthY = 19)',
expectAfterUnconstrained: expectFinal: 'angledLine(angle = -91, lengthY = yRel002)',
'angledLineOfYLength({ angle = -91, length = 19 }, %)',
expectFinal:
'angledLineOfYLength({ angle = -91, length = yRel002 }, %)',
ang: ang + 180, ang: ang + 180,
steps: 7, steps: 7,
locator: '[data-overlay-toolbar-index="8"]', locator: '[data-overlay-toolbar-index="8"]',
@ -597,16 +587,16 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
part001 = startSketchOn(XZ) part001 = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line(end = [0.5, -14 + 0]) |> line(end = [0.5, -14 + 0])
|> angledLine({ angle = 3 + 0, length = 32 + 0 }, %) |> angledLine(angle = 3 + 0, length = 32 + 0)
|> line(endAbsolute = [33, 11.5 + 0]) |> line(endAbsolute = [33, 11.5 + 0])
|> xLine(endAbsolute = 9 - 5) |> xLine(endAbsolute = 9 - 5)
|> yLine(endAbsolute = -10.77, tag = $a) |> yLine(endAbsolute = -10.77, tag = $a)
|> xLine(length = 26.04) |> xLine(length = 26.04)
|> yLine(length = 21.14 + 0) |> yLine(length = 21.14 + 0)
|> angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %) |> angledLine(angle = 181 + 0, lengthX = 23.14)
|> angledLineOfYLength({ angle = -91, length = 19 + 0 }, %) |> angledLine(angle = -91, lengthY = 19 + 0)
|> angledLineToX({ angle = 3 + 0, to = 26 }, %) |> angledLine(angle = 3 + 0, endAbsoluteX = 26)
|> angledLineToY({ angle = 89, to = 9.14 + 0 }, %) |> angledLine(angle = 89, endAbsoluteY = 9.14 + 0)
|> angledLineThatIntersects({ |> angledLineThatIntersects({
angle = 4.14, angle = 4.14,
intersectTag = a, intersectTag = a,
@ -646,9 +636,9 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
hoverPos: { x: angledLineToX.x, y: angledLineToX.y }, hoverPos: { x: angledLineToX.x, y: angledLineToX.y },
constraintType: 'angle', constraintType: 'angle',
expectBeforeUnconstrained: expectBeforeUnconstrained:
'angledLineToX({ angle = 3 + 0, to = 26 }, %)', 'angledLine(angle = 3 + 0, endAbsoluteX = 26)',
expectAfterUnconstrained: 'angledLineToX({ angle = 3, to = 26 }, %)', expectAfterUnconstrained: 'angledLine(angle = 3, endAbsoluteX = 26)',
expectFinal: 'angledLineToX({ angle = angle001, to = 26 }, %)', expectFinal: 'angledLine(angle = angle001, endAbsoluteX = 26)',
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="9"]', locator: '[data-overlay-toolbar-index="9"]',
}) })
@ -657,10 +647,10 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
hoverPos: { x: angledLineToX.x, y: angledLineToX.y }, hoverPos: { x: angledLineToX.x, y: angledLineToX.y },
constraintType: 'xAbsolute', constraintType: 'xAbsolute',
expectBeforeUnconstrained: expectBeforeUnconstrained:
'angledLineToX({ angle = angle001, to = 26 }, %)', 'angledLine(angle = angle001, endAbsoluteX = 26)',
expectAfterUnconstrained: expectAfterUnconstrained:
'angledLineToX({ angle = angle001, to = xAbs001 }, %)', 'angledLine(angle = angle001, endAbsoluteX = xAbs001)',
expectFinal: 'angledLineToX({ angle = angle001, to = 26 }, %)', expectFinal: 'angledLine(angle = angle001, endAbsoluteX = 26)',
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="9"]', locator: '[data-overlay-toolbar-index="9"]',
}) })
@ -671,11 +661,9 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
await clickUnconstrained({ await clickUnconstrained({
hoverPos: { x: angledLineToY.x, y: angledLineToY.y }, hoverPos: { x: angledLineToY.x, y: angledLineToY.y },
constraintType: 'angle', constraintType: 'angle',
expectBeforeUnconstrained: expectBeforeUnconstrained: 'angledLine(angle = 89, to = 9.14 + 0)',
'angledLineToY({ angle = 89, to = 9.14 + 0 }, %)', expectAfterUnconstrained: 'angledLine(angle = angle002, to = 9.14 + 0)',
expectAfterUnconstrained: expectFinal: 'angledLine(angle = 89, to = 9.14 + 0)',
'angledLineToY({ angle = angle002, to = 9.14 + 0 }, %)',
expectFinal: 'angledLineToY({ angle = 89, to = 9.14 + 0 }, %)',
steps: process.platform === 'darwin' ? 8 : 9, steps: process.platform === 'darwin' ? 8 : 9,
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="10"]', locator: '[data-overlay-toolbar-index="10"]',
@ -685,9 +673,9 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
hoverPos: { x: angledLineToY.x, y: angledLineToY.y }, hoverPos: { x: angledLineToY.x, y: angledLineToY.y },
constraintType: 'yAbsolute', constraintType: 'yAbsolute',
expectBeforeUnconstrained: expectBeforeUnconstrained:
'angledLineToY({ angle = 89, to = 9.14 + 0 }, %)', 'angledLine(angle = 89, endAbsoluteY = 9.14 + 0)',
expectAfterUnconstrained: 'angledLineToY({ angle = 89, to = 9.14 }, %)', expectAfterUnconstrained: 'angledLine(angle = 89, endAbsoluteY = 9.14)',
expectFinal: 'angledLineToY({ angle = 89, to = yAbs001 }, %)', expectFinal: 'angledLine(angle = 89, endAbsoluteY = yAbs001)',
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="10"]', locator: '[data-overlay-toolbar-index="10"]',
}) })
@ -759,16 +747,16 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
part001 = startSketchOn(XZ) part001 = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line(end = [0.5, -14 + 0]) |> line(end = [0.5, -14 + 0])
|> angledLine({ angle = 3 + 0, length = 32 + 0 }, %) |> angledLine(angle = 3 + 0, length = 32 + 0)
|> line(endAbsolute = [33, 11.5 + 0]) |> line(endAbsolute = [33, 11.5 + 0])
|> xLine(endAbsolute = 9 - 5) |> xLine(endAbsolute = 9 - 5)
|> yLine(endAbsolute = -10.77, tag = $a) |> yLine(endAbsolute = -10.77, tag = $a)
|> xLine(length = 26.04) |> xLine(length = 26.04)
|> yLine(length = 21.14 + 0) |> yLine(length = 21.14 + 0)
|> angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %) |> angledLine(angle = 181 + 0, lengthX = 23.14)
|> angledLineOfYLength({ angle = -91, length = 19 + 0 }, %) |> angledLine(angle = -91, lengthY = 19 + 0)
|> angledLineToX({ angle = 3 + 0, to = 26 }, %) |> angledLine(angle = 3 + 0, endAbsoluteX = 26)
|> angledLineToY({ angle = 89, to = 9.14 + 0 }, %) |> angledLine(angle = 89, endAbsoluteY = 9.14 + 0)
|> angledLineThatIntersects({ |> angledLineThatIntersects({
angle = 4.14, angle = 4.14,
intersectTag = a, intersectTag = a,
@ -1088,16 +1076,16 @@ part001 = startSketchOn(XZ)
part001 = startSketchOn(XZ) part001 = startSketchOn(XZ)
|>startProfileAt([0, 0], %) |>startProfileAt([0, 0], %)
|> line(end = [0.5, -14 + 0]) |> line(end = [0.5, -14 + 0])
|> angledLine({ angle = 3 + 0, length = 32 + 0 }, %) |> angledLine(angle = 3 + 0, length = 32 + 0)
|> line(endAbsolute = [33, 11.5 + 0]) |> line(endAbsolute = [33, 11.5 + 0])
|> xLine(endAbsolute = 9 - 5) |> xLine(endAbsolute = 9 - 5)
|> yLine(endAbsolute = -10.77, tag = $a) |> yLine(endAbsolute = -10.77, tag = $a)
|> xLine(length = 26.04) |> xLine(length = 26.04)
|> yLine(length = 21.14 + 0) |> yLine(length = 21.14 + 0)
|> angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %) |> angledLine(angle = 181 + 0, lengthX = 23.14)
|> angledLineOfYLength({ angle = -91, length = 19 + 0 }, %) |> angledLine(angle = -91, lengthY = 19 + 0)
|> angledLineToX({ angle = 3 + 0, to = 26 }, %) |> angledLine(angle = 3 + 0, endAbsoluteX = 26)
|> angledLineToY({ angle = 89, to = 9.14 + 0 }, %) |> angledLine(angle = 89, endAbsoluteY = 9.14 + 0)
|> angledLineThatIntersects({ |> angledLineThatIntersects({
angle = 4.14, angle = 4.14,
intersectTag = a, intersectTag = a,
@ -1199,7 +1187,7 @@ part001 = startSketchOn(XZ)
ang = await u.getAngle('[data-overlay-index="10"]') ang = await u.getAngle('[data-overlay-index="10"]')
await deleteSegmentSequence({ await deleteSegmentSequence({
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y }, hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
codeToBeDeleted: 'angledLineToY({ angle = 89, to = 9.14 + 0 }, %)', codeToBeDeleted: 'angledLine(angle = 89, endAbsoluteY = 9.14 + 0)',
stdLibFnName: 'angledLineToY', stdLibFnName: 'angledLineToY',
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="10"]', locator: '[data-overlay-toolbar-index="10"]',
@ -1209,7 +1197,7 @@ part001 = startSketchOn(XZ)
ang = await u.getAngle('[data-overlay-index="9"]') ang = await u.getAngle('[data-overlay-index="9"]')
await deleteSegmentSequence({ await deleteSegmentSequence({
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y }, hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
codeToBeDeleted: 'angledLineToX({ angle = 3 + 0, to = 26 }, %)', codeToBeDeleted: 'angledLine(angle = 3 + 0, endAbsoluteX = 26)',
stdLibFnName: 'angledLineToX', stdLibFnName: 'angledLineToX',
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="9"]', locator: '[data-overlay-toolbar-index="9"]',
@ -1219,8 +1207,7 @@ part001 = startSketchOn(XZ)
ang = await u.getAngle('[data-overlay-index="8"]') ang = await u.getAngle('[data-overlay-index="8"]')
await deleteSegmentSequence({ await deleteSegmentSequence({
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y }, hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
codeToBeDeleted: codeToBeDeleted: 'angledLine(angle = -91, lengthY = 19 + 0)',
'angledLineOfYLength({ angle = -91, length = 19 + 0 }, %)',
stdLibFnName: 'angledLineOfYLength', stdLibFnName: 'angledLineOfYLength',
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="8"]', locator: '[data-overlay-toolbar-index="8"]',
@ -1230,8 +1217,7 @@ part001 = startSketchOn(XZ)
ang = await u.getAngle('[data-overlay-index="7"]') ang = await u.getAngle('[data-overlay-index="7"]')
await deleteSegmentSequence({ await deleteSegmentSequence({
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y }, hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
codeToBeDeleted: codeToBeDeleted: 'angledLine(angle = 181 + 0, lengthX = 23.14)',
'angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %)',
stdLibFnName: 'angledLineOfXLength', stdLibFnName: 'angledLineOfXLength',
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="7"]', locator: '[data-overlay-toolbar-index="7"]',
@ -1314,7 +1300,7 @@ part001 = startSketchOn(XZ)
ang = await u.getAngle('[data-overlay-index="1"]') ang = await u.getAngle('[data-overlay-index="1"]')
await deleteSegmentSequence({ await deleteSegmentSequence({
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y }, hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
codeToBeDeleted: 'angledLine({ angle = 3 + 0, length = 32 + 0 }, %)', codeToBeDeleted: 'angledLine(angle = 3 + 0, length = 32 + 0)',
stdLibFnName: 'angledLine', stdLibFnName: 'angledLine',
ang: ang + 180, ang: ang + 180,
locator: '[data-overlay-toolbar-index="1"]', locator: '[data-overlay-toolbar-index="1"]',
@ -1335,24 +1321,20 @@ part001 = startSketchOn(XZ)
test.describe('Testing delete with dependent segments', () => { test.describe('Testing delete with dependent segments', () => {
const cases = [ const cases = [
'line(end = [22, 2], tag = $seg01)', 'line(end = [22, 2], tag = $seg01)',
'angledLine([5, 23.03], %, $seg01)', 'angledLine(angle = 5, length = 23.03, tag = $seg01)',
'xLine(length = 23, tag = $seg01)', 'xLine(length = 23, tag = $seg01)',
'yLine(length = -8, tag = $seg01)', 'yLine(length = -8, tag = $seg01)',
'xLine(endAbsolute = 30, tag = $seg01)', 'xLine(endAbsolute = 30, tag = $seg01)',
'yLine(endAbsolute = -4, tag = $seg01)', 'yLine(endAbsolute = -4, tag = $seg01)',
'angledLineOfXLength([3, 30], %, $seg01)', 'angledLine(angle = 3, lengthX = 30, tag = $seg01)',
'angledLineOfXLength({ angle = 3, length = 30 }, %, $seg01)', 'angledLine(angle = 3, lengthY = 1.5, tag = $seg01)',
'angledLineOfYLength([3, 1.5], %, $seg01)', 'angledLine(angle = 3, endAbsoluteX = 30, tag = $seg01)',
'angledLineOfYLength({ angle = 3, length = 1.5 }, %, $seg01)', 'angledLine(angle = 3, endAbsoluteY = 7, tag = $seg01)',
'angledLineToX([3, 30], %, $seg01)',
'angledLineToX({ angle = 3, to = 30 }, %, $seg01)',
'angledLineToY([3, 7], %, $seg01)',
'angledLineToY({ angle = 3, to = 7 }, %, $seg01)',
] ]
for (const doesHaveTagOutsideSketch of [true, false]) { for (const doesHaveTagOutsideSketch of [true, false]) {
for (const lineOfInterest of cases) { for (const lineOfInterest of cases) {
const isObj = lineOfInterest.includes('{ angle = 3,') const isObj = lineOfInterest.includes('{ angle = 3,')
test(`${lineOfInterest.split('=')[0]}${isObj ? '-[obj-input]' : ''}${ test(`${lineOfInterest}${isObj ? '-[obj-input]' : ''}${
doesHaveTagOutsideSketch ? '-[tagOutsideSketch]' : '' doesHaveTagOutsideSketch ? '-[tagOutsideSketch]' : ''
}`, async ({ page, editor, homePage }) => { }`, async ({ page, editor, homePage }) => {
await page.addInitScript( await page.addInitScript(
@ -1364,7 +1346,7 @@ part001 = startSketchOn(XZ)
|> startProfileAt([5, 6], %) |> startProfileAt([5, 6], %)
|> ${lineToBeDeleted} |> ${lineToBeDeleted}
|> line(end = [-10, -15]) |> line(end = [-10, -15])
|> angledLine([-176, segLen(seg01)], %) |> angledLine(angle = -176, length = segLen(seg01))
${extraLine ? 'myVar = segLen(seg01)' : ''}` ${extraLine ? 'myVar = segLen(seg01)' : ''}`
) )
}, },
@ -1477,7 +1459,7 @@ part001 = startSketchOn(XZ)
}, },
{ {
before: `angledLine([5 + 0, 23.03 + 0], %, $seg01)`, before: `angledLine(angle = 5 + 0, length = 23.03 + 0, tag = $seg01)`,
after: `line(end = [22.94, 2.01], tag = $seg01)`, after: `line(end = [22.94, 2.01], tag = $seg01)`,
}, },
{ {
@ -1497,32 +1479,25 @@ part001 = startSketchOn(XZ)
after: `line(end = [0, -10], tag = $seg01)`, after: `line(end = [0, -10], tag = $seg01)`,
}, },
{ {
before: `angledLineOfXLength({ angle = 3 + 0, length = 30 + 0 }, %, $seg01)`, before: `angledLine(angle = 3 + 0, lengthX = 30 + 0, tag = $seg01)`,
after: `line(end = [30, 1.57], tag = $seg01)`, after: `line(end = [30, 1.57], tag = $seg01)`,
}, },
{ {
before: `angledLineOfYLength({ angle = 3 + 0, length = 1.5 + 0 }, %, $seg01)`, before: `angledLine(angle = 3 + 0, lengthY = 1.5 + 0, tag = $seg01)`,
after: `line(end = [28.62, 1.5], tag = $seg01)`, after: `line(end = [28.62, 1.5], tag = $seg01)`,
}, },
{ {
before: `angledLineToX({ angle = 3 + 0, to = 30 + 0 }, %, $seg01)`, before: `angledLine(angle = 3 + 0, endAbsoluteX = 30 + 0, tag = $seg01)`,
after: `line(end = [25, 1.31], tag = $seg01)`, after: `line(end = [25, 1.31], tag = $seg01)`,
}, },
{ {
before: `angledLineToY({ angle = 3 + 0, to = 7 + 0 }, %, $seg01)`, before: `angledLine(angle = 3 + 0, endAbsoluteY = 7 + 0, tag = $seg01)`,
after: `line(end = [19.08, 1], tag = $seg01)`, after: `line(end = [19.08, 1], tag = $seg01)`,
}, },
] ]
for (const { before, after } of cases) { for (const { before, after } of cases) {
const isObj = before.includes('{ angle = 3') test(before, async ({ page, editor, homePage, scene, cmdBar }) => {
test(`${before.split('=')[0]}${isObj ? '-[obj-input]' : ''}`, async ({
page,
editor,
homePage,
scene,
cmdBar,
}) => {
await page.addInitScript( await page.addInitScript(
async ({ lineToBeDeleted }) => { async ({ lineToBeDeleted }) => {
localStorage.setItem( localStorage.setItem(
@ -1532,7 +1507,7 @@ part001 = startSketchOn(XZ)
|> startProfileAt([5, 6], %) |> startProfileAt([5, 6], %)
|> ${lineToBeDeleted} |> ${lineToBeDeleted}
|> line(end = [-10, -15]) |> line(end = [-10, -15])
|> angledLine([-176, segLen(seg01)], %)` |> angledLine(angle = -176, length = segLen(seg01))`
) )
}, },
{ {

View File

@ -124,7 +124,7 @@ test.describe('Testing selections', { tag: ['@skipWin'] }, () => {
// click a segment hold shift and click an axis, see that a relevant constraint is enabled // click a segment hold shift and click an axis, see that a relevant constraint is enabled
const constrainButton = page.getByRole('button', { const constrainButton = page.getByRole('button', {
name: 'Length: open menu', name: 'constraints: open menu',
}) })
const absXButton = page.getByRole('button', { name: 'Absolute X' }) const absXButton = page.getByRole('button', { name: 'Absolute X' })
@ -308,21 +308,15 @@ part009 = startSketchOn(XY)
|> startProfileAt([pipeLargeDia - (thickness / 2), 38], %) |> startProfileAt([pipeLargeDia - (thickness / 2), 38], %)
|> line(end = [thickness, 0]) |> line(end = [thickness, 0])
|> line(end = [0, -1]) |> line(end = [0, -1])
|> angledLineToX({ |> angledLine(angle = 60, endAbsoluteX = pipeSmallDia + thickness)
angle = 60,
to = pipeSmallDia + thickness
}, %)
|> line(end = [0, -pipeLength]) |> line(end = [0, -pipeLength])
|> angledLineToX({ |> angledLine(angle = -60, endAbsoluteX = pipeLargeDia + thickness)
angle = -60,
to = pipeLargeDia + thickness
}, %)
|> line(end = [0, -1]) |> line(end = [0, -1])
|> line(end = [-thickness, 0]) |> line(end = [-thickness, 0])
|> line(end = [0, 1]) |> line(end = [0, 1])
|> angledLineToX({ angle = 120, to = pipeSmallDia }, %) |> angledLine(angle = 120, endAbsoluteX = pipeSmallDia)
|> line(end = [0, pipeLength]) |> line(end = [0, pipeLength])
|> angledLineToX({ angle = 60, to = pipeLargeDia }, %) |> angledLine(angle = 60, endAbsoluteX = pipeLargeDia)
|> close() |> close()
rev = revolve(part009, axis = Y) rev = revolve(part009, axis = Y)
sketch006 = startSketchOn(XY) sketch006 = startSketchOn(XY)
@ -332,15 +326,9 @@ profile001 = circle(
radius = 17.96 radius = 17.96
) )
profile002 = startProfileAt([86.92, -63.81], sketch006) profile002 = startProfileAt([86.92, -63.81], sketch006)
|> angledLine([0, 63.81], %, $rectangleSegmentA001) |> angledLine(angle = 0, length = 63.81, tag = $rectangleSegmentA001)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 17.05)
segAng(rectangleSegmentA001) - 90, |> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001))
17.05
], %)
|> angledLine([
segAng(rectangleSegmentA001),
-segLen(rectangleSegmentA001)
], %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()
profile003 = startProfileAt([40.16, -120.48], sketch006) profile003 = startProfileAt([40.16, -120.48], sketch006)
@ -471,7 +459,7 @@ yo = startProfileAt([4.83, 12.56], part001)
|> line(end = [15.1, 2.48]) |> line(end = [15.1, 2.48])
|> line(end = [3.15, -9.85], tag = $seg01) |> line(end = [3.15, -9.85], tag = $seg01)
|> line(end = [-15.17, -4.1]) |> line(end = [-15.17, -4.1])
|> angledLine([segAng(seg01), 12.35], %, $seg02) |> angledLine(angle = segAng(seg01), length = 12.35, tag = $seg02)
|> line(end = [-13.02, 10.03]) |> line(end = [-13.02, 10.03])
|> close() |> close()
yoo = extrude(yo, length = 4) yoo = extrude(yo, length = 4)
@ -484,15 +472,9 @@ profile002 = startProfileAt([-11.08, 2.39], sketch002)
|> close() |> close()
extrude001 = extrude(profile002, length = 15) extrude001 = extrude(profile002, length = 15)
profile001 = startProfileAt([7.49, 9.96], sketch001) profile001 = startProfileAt([7.49, 9.96], sketch001)
|> angledLine([0, 5.05], %, $rectangleSegmentA001) |> angledLine(angle = 0, length = 5.05, tag = $rectangleSegmentA001)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 4.81)
segAng(rectangleSegmentA001) - 90, |> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001))
4.81
], %)
|> angledLine([
segAng(rectangleSegmentA001),
-segLen(rectangleSegmentA001)
], %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()
@ -539,15 +521,15 @@ profile001 = startProfileAt([7.49, 9.96], sketch001)
part001 = startSketchOn(XZ) 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 )
|> line(endAbsolute = [20.14 + 0, -0.14 + 0]) |> line(endAbsolute = [20.14 + 0, -0.14 + 0])
|> xLine(endAbsolute = 29 + 0) |> xLine(endAbsolute = 29 + 0)
|> yLine(length = -3.14 + 0, tag = $a) |> yLine(length = -3.14 + 0, tag = $a)
|> xLine(length = 1.63) |> xLine(length = 1.63)
|> angledLineOfXLength({ angle = 3 + 0, length = 3.14 }, %) |> angledLine(angle = 3 + 0, lengthX = 3.14)
|> angledLineOfYLength({ angle = 30, length = 3 + 0 }, %) |> angledLine(angle = 30, lengthY = 3 + 0)
|> angledLineToX({ angle = 22.14 + 0, to = 12 }, %) |> angledLine(angle = 22.14 + 0, endAbsoluteX = 12)
|> angledLineToY({ angle = 30, to = 11.14 }, %) |> angledLine(angle = 30, endAbsoluteY = 11.14)
|> angledLineThatIntersects({ |> angledLineThatIntersects({
angle = 3.14, angle = 3.14,
intersectTag = a, intersectTag = a,
@ -736,14 +718,14 @@ part001 = startSketchOn(XZ)
await checkCodeAtHoverPosition( await checkCodeAtHoverPosition(
'straightSegmentEdge', 'straightSegmentEdge',
straightSegmentEdge, straightSegmentEdge,
`angledLineToY({angle=30,to=11.14},%)`, `angledLine(angle=30,endAbsoluteY=11.14)`,
'angledLineToY({ angle = 30, to = 11.14 }, %)' 'angledLine(angle = 30, endAbsoluteY = 11.14)'
) )
await checkCodeAtHoverPosition( await checkCodeAtHoverPosition(
'straightSegmentOppositeEdge', 'straightSegmentOppositeEdge',
straightSegmentOppositeEdge, straightSegmentOppositeEdge,
`angledLineToY({angle=30,to=11.14},%)`, `angledLine(angle=30,endAbsoluteY=11.14)`,
'angledLineToY({ angle = 30, to = 11.14 }, %)' 'angledLine(angle = 30, endAbsoluteY = 11.14)'
) )
await checkCodeAtHoverPosition( await checkCodeAtHoverPosition(
'straightSegmentAdjacentEdge', 'straightSegmentAdjacentEdge',
@ -758,15 +740,9 @@ part001 = startSketchOn(XZ)
await u.codeLocator.fill(`@settings(defaultLengthUnit = in) await u.codeLocator.fill(`@settings(defaultLengthUnit = in)
sketch001 = startSketchOn(XZ) sketch001 = startSketchOn(XZ)
|> startProfileAt([75.8, 317.2], %) // [$startCapTag, $EndCapTag] |> startProfileAt([75.8, 317.2], %) // [$startCapTag, $EndCapTag]
|> angledLine([0, 268.43], %, $rectangleSegmentA001) |> angledLine(angle = 0, length = 268.43, tag = $rectangleSegmentA001)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 217.26, tag = $seg01)
segAng(rectangleSegmentA001) - 90, |> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001), tag = $yo)
217.26
], %, $seg01)
|> angledLine([
segAng(rectangleSegmentA001),
-segLen(rectangleSegmentA001)
], %, $yo)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)], tag = $seg02) |> line(endAbsolute = [profileStartX(%), profileStartY(%)], tag = $seg02)
|> close() |> close()
extrude001 = extrude(sketch001, length = 100) extrude001 = extrude(sketch001, length = 100)
@ -815,14 +791,14 @@ part001 = startSketchOn(XZ)
await checkCodeAtHoverPosition( await checkCodeAtHoverPosition(
'oppositeChamfer', 'oppositeChamfer',
oppositeChamfer, oppositeChamfer,
`angledLine([segAng(rectangleSegmentA001)-90,217.26],%,$seg01)chamfer(length=30,tags=[seg01,getNextAdjacentEdge(yo),getNextAdjacentEdge(seg02),getOppositeEdge(seg01)],)`, `angledLine(angle=segAng(rectangleSegmentA001)-90,length=217.26,tag=$seg01)chamfer(length=30,tags=[seg01,getNextAdjacentEdge(yo),getNextAdjacentEdge(seg02),getOppositeEdge(seg01)],)`,
' )' ' )'
) )
await checkCodeAtHoverPosition( await checkCodeAtHoverPosition(
'baseChamfer', 'baseChamfer',
baseChamfer, baseChamfer,
`angledLine([segAng(rectangleSegmentA001)-90,217.26],%,$seg01)chamfer(length=30,tags=[seg01,getNextAdjacentEdge(yo),getNextAdjacentEdge(seg02),getOppositeEdge(seg01)],)`, `angledLine(angle=segAng(rectangleSegmentA001)-90,length=217.26,tag=$seg01)chamfer(length=30,tags=[seg01,getNextAdjacentEdge(yo),getNextAdjacentEdge(seg02),getOppositeEdge(seg01)],)`,
' )' ' )'
) )
@ -860,7 +836,7 @@ part001 = startSketchOn(XZ)
await checkCodeAtHoverPosition( await checkCodeAtHoverPosition(
'adjacentChamfer2', 'adjacentChamfer2',
adjacentChamfer2, adjacentChamfer2,
`angledLine([segAng(rectangleSegmentA001),-segLen(rectangleSegmentA001)],%,$yo)chamfer(length=30,tags=[seg01,getNextAdjacentEdge(yo),getNextAdjacentEdge(seg02),getOppositeEdge(seg01)],)`, `angledLine(angle=segAng(rectangleSegmentA001),length=-segLen(rectangleSegmentA001),tag=$yo)chamfer(length=30,tags=[seg01,getNextAdjacentEdge(yo),getNextAdjacentEdge(seg02),getOppositeEdge(seg01)],)`,
' )' ' )'
) )
}) })
@ -960,7 +936,7 @@ part001 = startSketchOn(XZ)
}, },
{ {
pos: [816, 244], pos: [816, 244],
expectedCode: 'angledLine([segAng(seg01), yo], %)', expectedCode: 'angledLine(angle = segAng(seg01), length = yo)',
}, },
{ {
pos: [1107, 161], pos: [1107, 161],

View File

@ -1 +1 @@
part001 = startSketchOn('XY')yo = startProfileAt([4.83, 12.56], part001) |> 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], %, $seg02) |> line(end = [-13.02, 10.03]) |> close()sketch002 = startSketchOn({ plane = { origin = { x = 7.49, y = 2.4, z = 0 }, xAxis = { x = -0.3, y = 0.95, z = 0 }, yAxis = { x = 0, y = 0, z = 1 }, zAxis = { x = 0.95, y = 0.3, z = 0 } }})sketch001 = startSketchOn({ plane = { origin = { x = 0, y = 0, z = 4 }, xAxis = { x = 1, y = 0, z = 0 }, yAxis = { x = 0, y = 1, z = 0 }, zAxis = { x = 0, y = 0, z = 1 } }})profile002 = startProfileAt([-11.08, 2.39], sketch002) |> line(end = [4.89, 0.9]) |> line(end = [-0.61, -2.41]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> close()extrude001 = extrude(profile002, length = 15)profile001 = startProfileAt([7.49, 9.96], sketch001) |> angledLine([0, 5.05], %, $rectangleSegmentA001) |> angledLine([ segAng(rectangleSegmentA001) - 90, 4.81 ], %) |> angledLine([ segAng(rectangleSegmentA001), -segLen(rectangleSegmentA001) ], %) |> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> close() part001 = startSketchOn('XY')yo = startProfileAt([4.83, 12.56], part001) |> line(end = [15.1, 2.48]) |> line(end = [3.15, -9.85], tag = $seg01) |> line(end = [-15.17, -4.1]) |> angledLine(angle = segAng(seg01), 12.35], %, $seg02) |> line(end = [-13.02, 10.03]) |> close()sketch002 = startSketchOn({ plane = { origin = { x = 7.49, y = 2.4, z = 0 }, xAxis = { x = -0.3, y = 0.95, z = 0 }, yAxis = { x = 0, y = 0, z = 1 }, zAxis = { x = 0.95, y = 0.3, z = 0 } }})sketch001 = startSketchOn({ plane = { origin = { x = 0, y = 0, z = 4 }, xAxis = { x = 1, y = 0, z = 0 }, yAxis = { x = 0, y = 1, z = 0 }, zAxis = { x = 0, y = 0, z = 1 } }})profile002 = startProfileAt([-11.08, 2.39], sketch002) |> line(end = [4.89, 0.9]) |> line(end = [-0.61, -2.41]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> close()extrude001 = extrude(profile002, length = 15)profile001 = startProfileAt([7.49, 9.96], sketch001) |> angledLine(angle = 0, length = 5.05, tag = $rectangleSegmentA001) |> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 4.81 ) |> angledLine( angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001) ) |> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> close()

View File

@ -59,10 +59,11 @@ part001 = startSketchOn(-XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> yLine(length = baseHeight) |> yLine(length = baseHeight)
|> xLine(length = baseLen) |> xLine(length = baseLen)
|> angledLineToY({ |> angledLine(
angle = topAng, angle = topAng,
to = totalHeightHalf, endAbsoluteY = totalHeightHalf,
}, %, $seg04) tag = $seg04,
)
|> xLine(endAbsolute = totalLen, tag = $seg03) |> xLine(endAbsolute = totalLen, tag = $seg03)
|> yLine(length = -armThick, tag = $seg01) |> yLine(length = -armThick, tag = $seg01)
|> angledLineThatIntersects({ |> angledLineThatIntersects({
@ -70,11 +71,12 @@ part001 = startSketchOn(-XZ)
offset = -armThick, offset = -armThick,
intersectTag = seg04 intersectTag = seg04
}, %) }, %)
|> angledLineToY([segAng(seg04) + 180, turns::ZERO], %) |> angledLine(angle = segAng(seg04) + 180, endAbsoluteY = turns::ZERO)
|> angledLineToY({ |> angledLine(
angle = -bottomAng, angle = -bottomAng,
to = -totalHeightHalf - armThick, endAbsoluteY = -totalHeightHalf - armThick,
}, %, $seg02) tag = $seg02,
)
|> xLine(endAbsolute = segEndX(seg03) + 0) |> xLine(endAbsolute = segEndX(seg03) + 0)
|> yLine(length = -segLen(seg01)) |> yLine(length = -segLen(seg01))
|> angledLineThatIntersects({ |> angledLineThatIntersects({
@ -82,7 +84,7 @@ part001 = startSketchOn(-XZ)
offset = -armThick, offset = -armThick,
intersectTag = seg02 intersectTag = seg02
}, %) }, %)
|> angledLineToY([segAng(seg02) + 180, -baseHeight], %) |> angledLine(angle = segAng(seg02) + 180, endAbsoluteY = -baseHeight)
|> xLine(endAbsolute = turns::ZERO) |> xLine(endAbsolute = turns::ZERO)
|> close() |> close()
|> extrude(length = 4)` |> extrude(length = 4)`
@ -612,3 +614,12 @@ profile001 = startProfileAt([-12.34, 12.34], sketch002)
const sketch002 = extrude(sketch002, length = ${[5, 5]} + 7)` const sketch002 = extrude(sketch002, length = ${[5, 5]} + 7)`
await expect(page.locator('.cm-content')).toHaveText(result2.regExp) await expect(page.locator('.cm-content')).toHaveText(result2.regExp)
}) })
test.fixme(
`Opening a share link in the web isn't blocked by the web warning banner`,
async () => {
// This test is not able to be run right now since we don't have a web-only setup for Playwright.
// @franknoirot can implement it when that testing infra is set up. It should be a test to cover the fix from
// modeling-app issue #6172.
}
)

View File

@ -19,9 +19,14 @@
(self: super: { (self: super: {
rustToolchain = super. rust-bin.stable.latest.default.override { rustToolchain = super. rust-bin.stable.latest.default.override {
targets = [ "wasm32-unknown-unknown" ]; targets = [ "wasm32-unknown-unknown" ];
extensions = [ "rustfmt" "llvm-tools-preview" ]; extensions = [ "rustfmt" "llvm-tools-preview" "rust-src" ];
}; };
}) })
(self: super: {
cargo-llvm-cov = super.cargo-llvm-cov.overrideAttrs(oa: {
doCheck = false; doInstallCheck = false;
});
})
]; ];
# Systems supported # Systems supported
@ -34,7 +39,7 @@
# Helper to provide system-specific attributes # Helper to provide system-specific attributes
forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f { forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f {
pkgs = import nixpkgs { inherit overlays system; }; pkgs = import nixpkgs { inherit overlays system; config.allowBroken = true; };
}); });
in in
@ -62,7 +67,7 @@
electron electron
playwright-driver.browsers playwright-driver.browsers
]) ++ pkgs.lib.optionals pkgs.stdenv.isDarwin (with pkgs; [ ]) ++ pkgs.lib.optionals pkgs.stdenv.isDarwin (with pkgs; [
libiconv libiconv
darwin.apple_sdk.frameworks.Security darwin.apple_sdk.frameworks.Security
]); ]);

View File

@ -31,15 +31,9 @@ fn rail8020(originStart, railHeight, railLength) {
|> xLine(length = 0.06 * railHeight, tag = $edge1) |> xLine(length = 0.06 * railHeight, tag = $edge1)
|> yLine(length = 0.087 * railHeight, tag = $edge2) |> yLine(length = 0.087 * railHeight, tag = $edge2)
|> xLine(length = -0.183 * railHeight, tag = $edge3) |> xLine(length = -0.183 * railHeight, tag = $edge3)
|> angledLineToY({ |> angledLine(angle = 45, endAbsoluteY = (1 - 0.356) / 2 * railHeight + originStart[1], tag = $edge4)
angle = 45,
to = (1 - 0.356) / 2 * railHeight + originStart[1]
}, %, $edge4)
|> xLine(length = 0.232 * railHeight, tag = $edge5) |> xLine(length = 0.232 * railHeight, tag = $edge5)
|> angledLineToY({ |> angledLine(angle = -45, endAbsoluteY = 0.087 * railHeight + originStart[1], tag = $edge6)
angle = -45,
to = 0.087 * railHeight + originStart[1]
}, %, $edge6)
|> xLine(length = -0.183 * railHeight, tag = $edge7) |> xLine(length = -0.183 * railHeight, tag = $edge7)
|> yLine(length = -0.087 * railHeight, tag = $edge8) |> yLine(length = -0.087 * railHeight, tag = $edge8)
|> xLine(length = 0.06 * railHeight) |> xLine(length = 0.06 * railHeight)
@ -75,15 +69,9 @@ fn rail8020(originStart, railHeight, railLength) {
|> yLine(length = 0.06 * railHeight, tag = $edge9) |> yLine(length = 0.06 * railHeight, tag = $edge9)
|> xLine(length = -0.087 * railHeight, tag = $edge10) |> xLine(length = -0.087 * railHeight, tag = $edge10)
|> yLine(length = -0.183 * railHeight, tag = $edge11) // edge11 |> yLine(length = -0.183 * railHeight, tag = $edge11) // edge11
|> angledLineToX({ |> angledLine(angle = 135, endAbsoluteX = ((1 - 0.356) / 2 + 0.356) * railHeight + originStart[0], tag = $edge12) // edge12
angle = 135,
to = ((1 - 0.356) / 2 + 0.356) * railHeight + originStart[0]
}, %, $edge12) // edge12
|> yLine(length = 0.232 * railHeight, tag = $edge13) // 13 |> yLine(length = 0.232 * railHeight, tag = $edge13) // 13
|> angledLineToX({ |> angledLine(angle = 45, endAbsoluteX = (1 - 0.087) * railHeight + originStart[0], tag = $edge14) // 14
angle = 45,
to = (1 - 0.087) * railHeight + originStart[0]
}, %, $edge14) // 14
|> yLine(length = -0.183 * railHeight, tag = $edge15) // 15 |> yLine(length = -0.183 * railHeight, tag = $edge15) // 15
|> xLine(length = 0.087 * railHeight, tag = $edge16) |> xLine(length = 0.087 * railHeight, tag = $edge16)
|> yLine(length = 0.06 * railHeight) |> yLine(length = 0.06 * railHeight)
@ -119,15 +107,9 @@ fn rail8020(originStart, railHeight, railLength) {
|> xLine(length = -0.06 * railHeight, tag = $edge17) |> xLine(length = -0.06 * railHeight, tag = $edge17)
|> yLine(length = -0.087 * railHeight, tag = $edge18) |> yLine(length = -0.087 * railHeight, tag = $edge18)
|> xLine(length = 0.183 * railHeight, tag = $edge19) |> xLine(length = 0.183 * railHeight, tag = $edge19)
|> angledLineToY({ |> angledLine(angle = 45, endAbsoluteY = ((1 - 0.356) / 2 + 0.356) * railHeight + originStart[1], tag = $edge20)
angle = 45,
to = ((1 - 0.356) / 2 + 0.356) * railHeight + originStart[1]
}, %, $edge20)
|> xLine(length = -0.232 * railHeight, tag = $edge21) |> xLine(length = -0.232 * railHeight, tag = $edge21)
|> angledLineToY({ |> angledLine(angle = 135, endAbsoluteY = (1 - 0.087) * railHeight + originStart[1], tag = $edge22)
angle = 135,
to = (1 - 0.087) * railHeight + originStart[1]
}, %, $edge22)
|> xLine(length = 0.183 * railHeight, tag = $edge23) |> xLine(length = 0.183 * railHeight, tag = $edge23)
|> yLine(length = 0.087 * railHeight, tag = $edge24) |> yLine(length = 0.087 * railHeight, tag = $edge24)
|> xLine(length = -0.06 * railHeight) |> xLine(length = -0.06 * railHeight)
@ -163,15 +145,9 @@ fn rail8020(originStart, railHeight, railLength) {
|> yLine(length = -0.06 * railHeight, tag = $edge25) |> yLine(length = -0.06 * railHeight, tag = $edge25)
|> xLine(length = 0.087 * railHeight, tag = $edge26) |> xLine(length = 0.087 * railHeight, tag = $edge26)
|> yLine(length = 0.183 * railHeight, tag = $edge27) |> yLine(length = 0.183 * railHeight, tag = $edge27)
|> angledLineToX({ |> angledLine(angle = 135, endAbsoluteX = (1 - 0.356) / 2 * railHeight + originStart[0], tag = $edge28)
angle = 135,
to = (1 - 0.356) / 2 * railHeight + originStart[0]
}, %, $edge28)
|> yLine(length = -0.232 * railHeight, tag = $edge29) |> yLine(length = -0.232 * railHeight, tag = $edge29)
|> angledLineToX({ |> angledLine(angle = 45, endAbsoluteX = 0.087 * railHeight + originStart[0], tag = $edge30)
angle = 45,
to = 0.087 * railHeight + originStart[0]
}, %, $edge30)
|> yLine(length = 0.183 * railHeight, tag = $edge31) |> yLine(length = 0.183 * railHeight, tag = $edge31)
|> xLine(length = -0.087 * railHeight, tag = $edge32) |> xLine(length = -0.087 * railHeight, tag = $edge32)
|> yLine(length = -0.06 * railHeight) |> yLine(length = -0.06 * railHeight)

View File

@ -86,11 +86,11 @@ export fn seatSlats(plane, length) {
fn backSlatsSketch(plane) { fn backSlatsSketch(plane) {
sketch004 = startSketchOn(plane) sketch004 = startSketchOn(plane)
|> startProfileAt([22, 38.5], %) |> startProfileAt([22, 38.5], %)
|> angledLine([173, 2], %) |> angledLine(angle = 173, length = 2)
|> line(end = [-1.74, 2.03]) |> line(end = [-1.74, 2.03])
|> angledLine([82, 6.6], %) |> angledLine(angle = 82, length = 6.6)
|> line(end = [2.23, 1.42]) |> line(end = [2.23, 1.42])
|> angledLine([-7, 2], %) |> angledLine(angle = -7, length = 2)
|> line(endAbsolute = profileStart(%)) |> line(endAbsolute = profileStart(%))
|> close() |> close()
|> patternLinear2d(instances = 2, distance = 11, axis = [-0.137, -1]) |> patternLinear2d(instances = 2, distance = 11, axis = [-0.137, -1])

View File

@ -23,7 +23,7 @@ customPlane = {
fn lug(plane, length, diameter) { fn lug(plane, length, diameter) {
lugSketch = startSketchOn(customPlane) lugSketch = startSketchOn(customPlane)
|> startProfileAt([0 + diameter / 2, 0], %) |> startProfileAt([0 + diameter / 2, 0], %)
|> angledLineOfYLength({ angle = 70, length = lugHeadLength }, %) |> angledLine(angle = 70, lengthY = lugHeadLength)
|> xLine(endAbsolute = lugDiameter / 2) |> xLine(endAbsolute = lugDiameter / 2)
|> yLine(endAbsolute = lugLength) |> yLine(endAbsolute = lugLength)
|> tangentialArc({ offset = 90, radius = fromMm(3) }, %) |> tangentialArc({ offset = 90, radius = fromMm(3) }, %)

View File

@ -23,18 +23,12 @@ tealPlane = offsetPlane(YZ, offset = -halfSize)
fn sketchRectangle(profile, color) { fn sketchRectangle(profile, color) {
return profile return profile
|> startProfileAt([-halfSize, halfSize], %) |> startProfileAt([-halfSize, halfSize], %)
|> angledLine([0, size], %, $rectangleSegmentA001) |> angledLine(angle = 0, length = size, tag = $rectangleSegmentA001)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = size, tag = $rectangleSegmentB001)
segAng(rectangleSegmentA001) - 90, |> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001), tag = $rectangleSegmentC001)
size
], %, $rectangleSegmentB001)
|> angledLine([
segAng(rectangleSegmentA001),
-segLen(rectangleSegmentA001)
], %, $rectangleSegmentC001)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()
|> extrude(%, length = extrudeLength) |> extrude(length = extrudeLength)
|> appearance(color = color, metalness = metalConstant, roughness = roughnessConstant) |> appearance(color = color, metalness = metalConstant, roughness = roughnessConstant)
} }

View File

@ -14,15 +14,9 @@ holeDia = 4
// Model a box with base enclosure dimensions // Model a box with base enclosure dimensions
sketch001 = startSketchOn(XY) sketch001 = startSketchOn(XY)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine([0, width], %, $rectangleSegmentA001) |> angledLine(angle = 0, length = width, tag = $rectangleSegmentA001)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA001) + 90, length = length, tag = $rectangleSegmentB001)
segAng(rectangleSegmentA001) + 90, |> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001), tag = $rectangleSegmentC001)
length
], %, $rectangleSegmentB001)
|> angledLine([
segAng(rectangleSegmentA001),
-segLen(rectangleSegmentA001)
], %, $rectangleSegmentC001)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)], tag = $rectangleSegmentD001) |> line(endAbsolute = [profileStartX(%), profileStartY(%)], tag = $rectangleSegmentD001)
|> close() |> close()
extrude001 = extrude(sketch001, length = height) extrude001 = extrude(sketch001, length = height)
@ -81,15 +75,9 @@ function001([
// Define lid position and outer surface // Define lid position and outer surface
sketch003 = startSketchOn(XY) sketch003 = startSketchOn(XY)
|> startProfileAt([width * 1.2, 0], %) |> startProfileAt([width * 1.2, 0], %)
|> angledLine([0, width], %, $rectangleSegmentA002) |> angledLine(angle = 0, length = width, tag = $rectangleSegmentA002)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA001) + 90, length = length, tag = $rectangleSegmentB002)
segAng(rectangleSegmentA001) + 90, |> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001), tag = $rectangleSegmentC002)
length
], %, $rectangleSegmentB002)
|> angledLine([
segAng(rectangleSegmentA001),
-segLen(rectangleSegmentA001)
], %, $rectangleSegmentC002)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)], tag = $rectangleSegmentD002) |> line(endAbsolute = [profileStartX(%), profileStartY(%)], tag = $rectangleSegmentD002)
|> close() |> close()
|> hole(circle( |> hole(circle(
@ -137,15 +125,9 @@ sketch004 = startSketchOn(extrude003, 'END')
width * 1.2 + wallThickness, width * 1.2 + wallThickness,
wallThickness wallThickness
], %) ], %)
|> angledLine([0, width - (2 * wallThickness)], %, $rectangleSegmentA003) |> angledLine(angle = 0, length = width - (2 * wallThickness), tag = $rectangleSegmentA003)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA003) + 90, length = length - (2 * wallThickness), tag = $rectangleSegmentB003)
segAng(rectangleSegmentA003) + 90, |> angledLine(angle = segAng(rectangleSegmentA003), length = -segLen(rectangleSegmentA003), tag = $rectangleSegmentC003)
length - (2 * wallThickness)
], %, $rectangleSegmentB003)
|> angledLine([
segAng(rectangleSegmentA003),
-segLen(rectangleSegmentA003)
], %, $rectangleSegmentC003)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)], tag = $rectangleSegmentD003) |> line(endAbsolute = [profileStartX(%), profileStartY(%)], tag = $rectangleSegmentD003)
|> close() |> close()
|> hole(circle( |> hole(circle(

View File

@ -34,15 +34,9 @@ fn primaryTube(n, angle001, length001, length002, length003) {
|> startProfileAt([0, plateHeight], %) |> startProfileAt([0, plateHeight], %)
|> line(end = [0, length001]) |> line(end = [0, length001])
|> tangentialArc({ offset = -80, radius = bendRadius }, %, $arc01) |> tangentialArc({ offset = -80, radius = bendRadius }, %, $arc01)
|> angledLine({ |> angledLine(angle = tangentToEnd(arc01), length = length002)
angle = tangentToEnd(arc01),
length = length002
}, %)
|> tangentialArc({ offset = 85, radius = bendRadius }, %, $arc02) |> tangentialArc({ offset = 85, radius = bendRadius }, %, $arc02)
|> angledLine({ |> angledLine(angle = tangentToEnd(arc02), length = length003)
angle = tangentToEnd(arc02),
length = length003
}, %)
// Create the cross section of each tube and sweep them // Create the cross section of each tube and sweep them
sweepProfile = startSketchOn(XY) sweepProfile = startSketchOn(XY)

View File

@ -35,19 +35,19 @@ fn slot(sketch1, start, end, width) {
xstart = width / 2 * cos(toRadians(angle - 90)) + start[0] xstart = width / 2 * cos(toRadians(angle - 90)) + start[0]
ystart = width / 2 * sin(toRadians(angle - 90)) + start[1] ystart = width / 2 * sin(toRadians(angle - 90)) + start[1]
slotSketch = startProfileAt([xstart, ystart], sketch1) slotSketch = startProfileAt([xstart, ystart], sketch1)
|> angledLine({ angle = angle, length = dist }, %, $line000) |> angledLine(angle = angle, length = dist)
|> tangentialArc({ radius = width / 2, offset = 180 }, %, $arc000) |> tangentialArc({ radius = width / 2, offset = 180 }, %)
|> angledLine({ angle = angle, length = -dist }, %, $line001) |> angledLine(angle = angle, length = -dist)
|> tangentialArcTo([profileStartX(%), profileStartY(%)], %, $arc001) |> tangentialArcTo([profileStartX(%), profileStartY(%)], %)
|> close() |> close()
return slotSketch return slotSketch
} }
// Create a sketch on the "XY" plane // Create a sketch on the "XY" plane for the flipper
sketch000 = startSketchOn(XY) flipperSketch = startSketchOn(XY)
// Create a profile of the flipper // Create a profile of the flipper
flipperProfile = startProfileAt([-flipperLength, -32.0], sketch000) flipperProfile = startProfileAt([-flipperLength, -32.0], flipperSketch)
|> line(end = [flipperLength, 2.0]) |> line(end = [flipperLength, 2.0])
|> yLine(length = 60.0, tag = $backEdge) |> yLine(length = 60.0, tag = $backEdge)
|> line(end = [-flipperLength, 2.0]) |> line(end = [-flipperLength, 2.0])
@ -59,13 +59,13 @@ flipperProfile = startProfileAt([-flipperLength, -32.0], sketch000)
|> close() |> close()
// Create a profile of the middle // Create a profile of the middle
slotProfile000 = slot(sketch000, [-25, 0], [-55, 0], flipperSlotWidth) slotProfile000 = slot(flipperSketch, [-25, 0], [-55, 0], flipperSlotWidth)
// Create a profile of the top slot // Create a profile of the top slot
slotProfile001 = slot(sketch000, [-25, 18], [-55, 19], flipperSlotWidth) slotProfile001 = slot(flipperSketch, [-25, 18], [-55, 19], flipperSlotWidth)
// Create a profile of the bottom slot // Create a profile of the bottom slot
slotProfile002 = slot(sketch000, [-25, -18], [-55, -19], flipperSlotWidth) slotProfile002 = slot(flipperSketch, [-25, -18], [-55, -19], flipperSlotWidth)
// Create a profile with slots for the spatula // Create a profile with slots for the spatula
spatulaProfile = flipperProfile spatulaProfile = flipperProfile
@ -87,10 +87,10 @@ fillet(
) )
// Create a sketch on the "XZ" plane offset by half the thickness // Create a sketch on the "XZ" plane offset by half the thickness
sketch001 = startSketchOn(offsetPlane(XZ, offset = -handleWidth / 2)) handleSketch = startSketchOn(offsetPlane(XZ, offset = -handleWidth / 2))
// Create a profile of the spatula handle // Create a profile of the spatula handle
handleProfile = startProfileAt([0.0, flipperThickness], sketch001) handleProfile = startProfileAt([0.0, flipperThickness], handleSketch)
|> line(end = [31.819805, 31.819805], tag = $handleBottomEdge) |> line(end = [31.819805, 31.819805], tag = $handleBottomEdge)
|> line(end = [140.953893, 51.303021]) |> line(end = [140.953893, 51.303021])
|> line(end = [-1.710101, 4.698463]) |> line(end = [-1.710101, 4.698463])
@ -99,7 +99,7 @@ handleProfile = startProfileAt([0.0, flipperThickness], sketch001)
|> xLine(length = 7.071068) |> xLine(length = 7.071068)
|> close() |> close()
// Create an extrusion extrude001 // Create an extrusion
handle = extrude(handleProfile, length = handleWidth) handle = extrude(handleProfile, length = handleWidth)
// Fillet the bend of the spatula handle // Fillet the bend of the spatula handle
@ -123,10 +123,10 @@ handlePlane = {
} }
// Create a sketch on the handle plane // Create a sketch on the handle plane
sketch002 = startSketchOn(handlePlane) gripSketch = startSketchOn(handlePlane)
// Create a profile of the grip // Create a profile of the grip
gripProfile = startProfileAt([-26.806746, -10.0], sketch002) gripProfile = startProfileAt([-26.806746, -10.0], gripSketch)
|> xLine(length = gripWidth - (2 * gripFilletRadius)) |> xLine(length = gripWidth - (2 * gripFilletRadius))
|> arc({ |> arc({
angleStart = -90.0, angleStart = -90.0,
@ -157,10 +157,10 @@ gripProfile = startProfileAt([-26.806746, -10.0], sketch002)
grip = extrude(gripProfile, length = -gripLength) grip = extrude(gripProfile, length = -gripLength)
// Create a sketch on the grip for the hole // Create a sketch on the grip for the hole
sketch003 = startSketchOn(grip, gripEdgeTop) holeSketch = startSketchOn(grip, gripEdgeTop)
// Create a profile for the grip hole // Create a profile for the grip hole
gripHoleProfile = slot(sketch003, [0, 200], [0, 210], gripSlotWidth) gripHoleProfile = slot(holeSketch, [0, 200], [0, 210], gripSlotWidth)
// Cut a hole in the grip // Cut a hole in the grip
extrude(gripHoleProfile, length = -gripWidth - 20) extrude(gripHoleProfile, length = -gripWidth - 20)

View File

@ -12,15 +12,9 @@ handleThickness = 0.65
// Upper ring of the metal structure // Upper ring of the metal structure
sketch001 = startSketchOn(XZ) sketch001 = startSketchOn(XZ)
|> startProfileAt([carafeDiameter / 2, 5.7], %) |> startProfileAt([carafeDiameter / 2, 5.7], %)
|> angledLine([0, 0.1], %, $rectangleSegmentA001) |> angledLine(angle = 0, length = 0.1, tag = $rectangleSegmentA001)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = -0.75, tag = $rectangleSegmentB001)
segAng(rectangleSegmentA001) - 90, |> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001), tag = $rectangleSegmentC001)
-0.75
], %, $rectangleSegmentB001)
|> angledLine([
segAng(rectangleSegmentA001),
-segLen(rectangleSegmentA001)
], %, $rectangleSegmentC001)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()
|> revolve(angle = 360, axis = Y) |> revolve(angle = 360, axis = Y)
@ -45,13 +39,13 @@ sketch002 = startSketchOn(plane001)
angleEnd = 205, angleEnd = 205,
radius = 0.3 radius = 0.3
}, %) }, %)
|> angledLine({ angle = -60, length = 0.6 }, %, $edge2) |> angledLine(angle = -60, length = 0.6, tag = $edge2)
|> arc({ |> arc({
angleStart = 30, angleStart = 30,
angleEnd = -120, angleEnd = -120,
radius = 0.6 radius = 0.6
}, %) }, %)
|> angledLineToY({ angle = 150, to = -0.2 }, %, $edge3) |> angledLine(angle = 150, endAbsoluteY = -0.2, tag = $edge3)
|> arc({ |> arc({
angleStart = 60, angleStart = 60,
angleEnd = 90, angleEnd = 90,
@ -65,19 +59,13 @@ sketch002 = startSketchOn(plane001)
angleEnd = 60, angleEnd = 60,
radius = 0.6 radius = 0.6
}, %) }, %)
|> angledLine({ |> angledLine(angle = 150, length = -segLen(edge3) + 0.035, tag = $edge5)
angle = 150,
length = -segLen(edge3) + 0.035
}, %, $edge5)
|> arc({ |> arc({
angleStart = -120, angleStart = -120,
angleEnd = 30, angleEnd = 30,
radius = 0.5 radius = 0.5
}, %) }, %)
|> angledLine({ |> angledLine(angle = -60, length = -segLen(edge2) + 0.035, tag = $edge6)
angle = -60,
length = -segLen(edge2) + 0.035
}, %, $edge6)
|> arc({ |> arc({
angleStart = 205, angleStart = 205,
angleEnd = 180, angleEnd = 180,
@ -123,12 +111,9 @@ extrude002 = extrude(sketch004, length = -0.050)
sketch005 = startSketchOn(XZ) sketch005 = startSketchOn(XZ)
|> startProfileAt([0.15, 1.11], %) |> startProfileAt([0.15, 1.11], %)
|> xLine(endAbsolute = carafeDiameter / 2 - 0.2) |> xLine(endAbsolute = carafeDiameter / 2 - 0.2)
|> angledLineToX({ |> angledLine(angle = 30, endAbsoluteX = carafeDiameter / 2 - 0.07, tag = $seg1)
angle = 30, |> angledLine(angle = -60, length = 0.050)
to = carafeDiameter / 2 - 0.07 |> angledLine(angle = 30, length = -segLen(seg1))
}, %, $seg1)
|> angledLine({ angle = -60, length = 0.050 }, %)
|> angledLine({ angle = 30, length = -segLen(seg1) }, %)
|> xLine(endAbsolute = 0.15) |> xLine(endAbsolute = 0.15)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()
@ -138,7 +123,7 @@ sketch005 = startSketchOn(XZ)
sketch006 = startSketchOn(XZ) sketch006 = startSketchOn(XZ)
|> startProfileAt([0.1, 1], %) |> startProfileAt([0.1, 1], %)
|> line(end = [0.1, 0]) |> line(end = [0.1, 0])
|> angledLineToX({ angle = 10, to = 0.05 }, %) |> angledLine(angle = 10, endAbsoluteX = 0.05)
|> yLine(length = 10) |> yLine(length = 10)
|> line(end = [0.6, 0]) |> line(end = [0.6, 0])
|> yLine(length = -.05) |> yLine(length = -.05)

View File

@ -26,9 +26,9 @@ fn face(plane) {
faceSketch = startSketchOn(plane) faceSketch = startSketchOn(plane)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> yLine(length = height) |> yLine(length = height)
|> angledLineOfYLength({ angle = -45, length = thirdStep }, %) |> angledLine(angle = -45, lengthY = thirdStep)
|> yLine(length = -secondStep) |> yLine(length = -secondStep)
|> angledLineOfYLength({ angle = -45, length = firstStep }, %) |> angledLine(angle = -45, lengthY = firstStep)
|> close() |> close()
return faceSketch return faceSketch
} }

View File

@ -23,9 +23,9 @@ fn face(plane) {
faceSketch = startSketchOn(plane) faceSketch = startSketchOn(plane)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> yLine(length = height) |> yLine(length = height)
|> angledLineOfYLength({ angle = -45, length = thirdStep }, %) |> angledLine(angle = -45, lengthY = thirdStep)
|> yLine(length = -secondStep) |> yLine(length = -secondStep)
|> angledLineOfYLength({ angle = -45, length = firstStep }, %) |> angledLine(angle = -45, lengthY = firstStep)
|> close() |> close()
return faceSketch return faceSketch
} }

View File

@ -39,9 +39,9 @@ fn face(plane) {
|> startProfileAt([binBaseLength + binTol, 0], %) |> startProfileAt([binBaseLength + binTol, 0], %)
|> yLine(length = height) |> yLine(length = height)
|> xLine(length = -binBaseLength) |> xLine(length = -binBaseLength)
|> angledLineOfYLength({ angle = -45, length = thirdStep }, %) |> angledLine(angle = -45, lengthY = thirdStep)
|> yLine(length = -secondStep) |> yLine(length = -secondStep)
|> angledLineOfYLength({ angle = -45, length = firstStep }, %) |> angledLine(angle = -45, lengthY = firstStep)
|> close() |> close()
return faceSketch return faceSketch
} }
@ -184,12 +184,12 @@ fn lipFace(plane) {
angleEnd = 45.0, angleEnd = 45.0,
radius = 0.500000 radius = 0.500000
}, %, $arc000) }, %, $arc000)
// |> angledLineOfYLength({ angle: -45, length: lipStep5 }, %) // |> angledLine(angle = -45, lengthY = lipStep5 )
|> line(end = [1.046447, -1.046447], tag = $line001) |> line(end = [1.046447, -1.046447], tag = $line001)
|> yLine(length = -lipStep4) |> yLine(length = -lipStep4)
|> angledLineOfYLength({ angle = -45, length = lipStep3 }, %) |> angledLine(angle = -45, lengthY = lipStep3)
|> yLine(length = -lipStep2) |> yLine(length = -lipStep2)
|> angledLineOfYLength({ angle = -135, length = lipStep1 }, %) |> angledLine(angle = -135, lengthY = lipStep1)
|> close() |> close()
return faceSketch return faceSketch
} }

View File

@ -32,9 +32,9 @@ fn face(plane) {
|> startProfileAt([binBaseLength + binTol, 0], %) |> startProfileAt([binBaseLength + binTol, 0], %)
|> yLine(length = height) |> yLine(length = height)
|> xLine(length = -binBaseLength) |> xLine(length = -binBaseLength)
|> angledLineOfYLength({ angle = -45, length = thirdStep }, %) |> angledLine(angle = -45, lengthY = thirdStep)
|> yLine(length = -secondStep) |> yLine(length = -secondStep)
|> angledLineOfYLength({ angle = -45, length = firstStep }, %) |> angledLine(angle = -45, lengthY = firstStep)
|> close() |> close()
return faceSketch return faceSketch
} }

View File

@ -13,11 +13,11 @@ diameter = 0.3125
fn hexNut(start, thk, innerDia) { fn hexNut(start, thk, innerDia) {
hexNutSketch = startSketchOn(-XZ) hexNutSketch = startSketchOn(-XZ)
|> startProfileAt([start[0] + innerDia, start[1]], %) |> startProfileAt([start[0] + innerDia, start[1]], %)
|> angledLine({ angle = 240, length = innerDia }, %) |> angledLine(angle = 240, length = innerDia)
|> angledLine({ angle = 180, length = innerDia }, %) |> angledLine(angle = 180, length = innerDia)
|> angledLine({ angle = 120, length = innerDia }, %) |> angledLine(angle = 120, length = innerDia)
|> angledLine({ angle = 60, length = innerDia }, %) |> angledLine(angle = 60, length = innerDia)
|> angledLine({ angle = 0, length = innerDia * .90 }, %) |> angledLine(angle = 0, length = innerDia * .90)
|> close() |> close()
|> hole(circle(center = [start[0], start[1]], radius = innerDia / 2), %) |> hole(circle(center = [start[0], start[1]], radius = innerDia / 2), %)
|> extrude(length = thk) |> extrude(length = thk)

View File

@ -22,7 +22,7 @@ row6 = row5 + keyHeight + spacing
sketch001 = startSketchOn(YZ) sketch001 = startSketchOn(YZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line(end = [-0.14, 0.68], tag = $seg01) |> line(end = [-0.14, 0.68], tag = $seg01)
|> angledLine([7, row6 + 3 * spacing + keyHeight], %, $seg02) |> angledLine(angle = 7, length = row6 + 3 * spacing + keyHeight, tag = $seg02)
|> line(endAbsolute = [5.13, 0], tag = $seg03) |> line(endAbsolute = [5.13, 0], tag = $seg03)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)], tag = $seg04) |> line(endAbsolute = [profileStartX(%), profileStartY(%)], tag = $seg04)
|> close() |> close()
@ -73,17 +73,11 @@ fn keyFn(originStart, keyWidth, keyHeight, repeats, color) {
angleEnd = 270, angleEnd = 270,
radius = 0.1 radius = 0.1
}, %) }, %)
|> angledLine([0, keyWidth - .2], %, $rectangleSegmentA001) |> angledLine(angle = 0, length = keyWidth - .2, tag = $rectangleSegmentA001)
|> tangentialArc({ radius = 0.1, offset = 90 }, %) |> tangentialArc({ radius = 0.1, offset = 90 }, %)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA001) + 90, length = keyHeight - .2, tag = $rectangleSegmentB001)
segAng(rectangleSegmentA001) + 90,
keyHeight - .2
], %, $rectangleSegmentB001)
|> tangentialArc({ radius = 0.1, offset = 90 }, %) |> tangentialArc({ radius = 0.1, offset = 90 }, %)
|> angledLine([ |> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001), tag = $rectangleSegmentC001)
segAng(rectangleSegmentA001),
-segLen(rectangleSegmentA001)
], %, $rectangleSegmentC001)
|> tangentialArc({ radius = 0.1, offset = 90 }, %) |> tangentialArc({ radius = 0.1, offset = 90 }, %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)], tag = $rectangleSegmentD001) |> line(endAbsolute = [profileStartX(%), profileStartY(%)], tag = $rectangleSegmentD001)
|> close() |> close()
@ -151,24 +145,15 @@ fn z(origin, scale, depth) {
], %) ], %)
|> yLine(length = -0.15 * scale) |> yLine(length = -0.15 * scale)
|> xLine(length = 0.15 * scale) |> xLine(length = 0.15 * scale)
|> angledLineToX({ |> angledLine(angle = 47.15, endAbsoluteX = 0.3 * scale + origin[0], tag = $seg1)
angle = 47.15,
to = 0.3 * scale + origin[0]
}, %, $seg1)
|> yLine(endAbsolute = 0 + origin[1], tag = $seg3) |> yLine(endAbsolute = 0 + origin[1], tag = $seg3)
|> xLine(length = 0.63 * scale) |> xLine(length = 0.63 * scale)
|> yLine(length = 0.225 * scale) |> yLine(length = 0.225 * scale)
|> xLine(length = -0.57 * scale) |> xLine(length = -0.57 * scale)
|> angledLineToX({ |> angledLine(angle = 47.15, endAbsoluteX = 0.93 * scale + origin[0])
angle = 47.15,
to = 0.93 * scale + origin[0]
}, %)
|> yLine(length = 0.15 * scale) |> yLine(length = 0.15 * scale)
|> xLine(length = -0.15 * scale) |> xLine(length = -0.15 * scale)
|> angledLine({ |> angledLine(angle = 47.15, length = -segLen(seg1), tag = $seg2)
angle = 47.15,
length = -segLen(seg1)
}, %, $seg2)
|> yLine(length = segLen(seg3)) |> yLine(length = segLen(seg3))
|> xLine(endAbsolute = 0 + origin[0]) |> xLine(endAbsolute = 0 + origin[0])
|> yLine(length = -0.225 * scale) |> yLine(length = -0.225 * scale)
@ -195,7 +180,7 @@ fn o(origin, scale, depth) {
angleEnd = 47.15 - 6 + 180, angleEnd = 47.15 - 6 + 180,
radius = .525 * scale radius = .525 * scale
}, %) }, %)
|> angledLine({ angle = 47.15, length = .24 * scale }, %) |> angledLine(angle = 47.15, length = .24 * scale)
|> arc({ |> arc({
angleStart = 47.15 - 11 + 180, angleStart = 47.15 - 11 + 180,
angleEnd = 47.15 + 11, angleEnd = 47.15 + 11,
@ -215,7 +200,7 @@ fn o(origin, scale, depth) {
angleEnd = 47.15 - 6, angleEnd = 47.15 - 6,
radius = .525 * scale radius = .525 * scale
}, %) }, %)
|> angledLine({ angle = 47.15, length = -.24 * scale }, %) |> angledLine(angle = 47.15, length = -.24 * scale)
|> arc({ |> arc({
angleStart = 47.15 - 11, angleStart = 47.15 - 11,
angleEnd = 47.15 + 11 - 180, angleEnd = 47.15 + 11 - 180,

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