KCL: Use keyword arguments for line, lineTo, extrude and close (#5249)
Part of #4600. PR: https://github.com/KittyCAD/modeling-app/pull/4826 # Changes to KCL stdlib - `line(point, sketch, tag)` and `lineTo(point, sketch, tag)` are combined into `line(@sketch, end?, endAbsolute?, tag?)` - `close(sketch, tag?)` is now `close(@sketch, tag?)` - `extrude(length, sketch)` is now `extrude(@sketch, length)` Note that if a parameter starts with `@` like `@sketch`, it doesn't have any label when called, so you call it like this: ``` sketch = startSketchAt([0, 0]) line(sketch, end = [3, 3], tag = $hi) ``` Note also that if you're using a `|>` pipeline, you can omit the `@` argument and it will be assumed to be the LHS of the `|>`. So the above could be written as ``` sketch = startSketchAt([0, 0]) |> line(end = [3, 3], tag = $hi) ``` Also changes frontend tests to use KittyCAD/kcl-samples#139 instead of its main The regex find-and-replace I use for migrating code (note these don't work with multi-line expressions) are: ``` line\(([^=]*), %\) line(end = $1) line\((.*), %, (.*)\) line(end = $1, tag = $2) lineTo\((.*), %\) line(endAbsolute = $1) lineTo\((.*), %, (.*)\) line(endAbsolute = $1, tag = $2) extrude\((.*), %\) extrude(length = $1) extrude\(([^=]*), ([a-zA-Z0-9]+)\) extrude($2, length = $1) close\(%, (.*)\) close(tag = $1) ``` # Selected notes from commits before I squash them all * Fix test 'yRelative to horizontal distance' Fixes: - Make a lineTo helper - Fix pathToNode to go through the labeled arg .arg property * Fix test by changing lookups into transformMap Parts of the code assumed that `line` is always a relative call. But actually now it might be absolute, if it's got an `endAbsolute` parameter. So, change whether to look up `line` or `lineTo` and the relevant absolute or relative line types based on that parameter. * Stop asserting on exact source ranges When I changed line to kwargs, all the source ranges we assert on became slightly different. I find these assertions to be very very low value. So I'm removing them. * Fix more tests: getConstraintType calls weren't checking if the 'line' fn was absolute or relative. * Fixed another queryAst test There were 2 problems: - Test was looking for the old style of `line` call to choose an offset for pathToNode - Test assumed that the `tag` param was always the third one, but in a kwarg call, you have to look it up by label * Fix test: traverse was not handling CallExpressionKw * Fix another test, addTagKw addTag helper was not aware of kw args. * Convert close from positional to kwargs If the close() call has 0 args, or a single unlabeled arg, the parser interprets it as a CallExpression (positional) not a CallExpressionKw. But then if a codemod wants to add a tag to it, it tries adding a kwarg called 'tag', which fails because the CallExpression doesn't need kwargs inserted into it. The fix is: change the node from CallExpression to CallExpressionKw, and update getNodeFromPath to take a 'replacement' arg, so we can replace the old node with the new node in the AST. * Fix the last test Test was looking for `lineTo` as a substring of the input KCL program. But there's no more lineTo function, so I changed it to look for line() with an endAbsolute arg, which is the new equivalent. Also changed the getConstraintInfo code to look up the lineTo if using line with endAbsolute. * Fix many bad regex find-replaces I wrote a regex find-and-replace which converted `line` calls from positional to keyword calls. But it was accidentally applied to more places than it should be, for example, angledLine, xLine and yLine calls. Fixes this. * Fixes test 'Basic sketch › code pane closed at start' Problem was, the getNodeFromPath call might not actually find a callExpressionKw, it might find a callExpression. So the `giveSketchFnCallTag` thought it was modifying a kwargs call, but it was actually modifying a positional call. This meant it tried to push a labeled argument in, rather than a normal arg, and a lot of other problems. Fixed by doing runtime typechecking. * Fix: Optional args given with wrong type were silently ignored Optional args don't have to be given. But if the user gives them, they should be the right type. Bug: if the KCL interpreter found an optional arg, which was given, but was the wrong type, it would ignore it and pretend the arg was never given at all. This was confusing for users. Fix: Now if you give an optional arg, but it's the wrong type, KCL will emit a type error just like it would for a mandatory argument. --------- Signed-off-by: Nick Cameron <nrc@ncameron.org> Co-authored-by: Nick Cameron <nrc@ncameron.org> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Frank Noirot <frank@kittycad.io> Co-authored-by: Kevin Nadro <kevin@zoo.dev> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -25,6 +25,7 @@ yarn-error.log*
|
||||
|
||||
.idea
|
||||
.vscode
|
||||
.helix
|
||||
src/wasm-lib/.idea
|
||||
src/wasm-lib/.vscode
|
||||
|
||||
|
2
.helix/config.toml
Normal file
2
.helix/config.toml
Normal file
@ -0,0 +1,2 @@
|
||||
[editor]
|
||||
auto-format = true
|
10
.helix/languages.toml
Normal file
10
.helix/languages.toml
Normal file
@ -0,0 +1,10 @@
|
||||
[language-server.eslint]
|
||||
args = ["--stdio"]
|
||||
command = "vscode-eslint-language-server"
|
||||
|
||||
[[language]]
|
||||
name = "typescript"
|
||||
auto-format = true
|
||||
formatter = { command = "node_modules/.bin/prettier", args = ["--parser", "typescript"] }
|
||||
language-servers = [ { name = "eslint", only-features = [ "diagnostics" ] }, "typescript-language-server" ]
|
||||
|
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
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
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -31,12 +31,12 @@ appearance(data: AppearanceData, solid_set: SolidSet) -> SolidSet
|
||||
// Add color to an extruded solid.
|
||||
exampleSketch = startSketchOn("XZ")
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> lineTo([10, 0], %)
|
||||
|> lineTo([0, 10], %)
|
||||
|> lineTo([-10, 0], %)
|
||||
|> close(%)
|
||||
|> line(endAbsolute = [10, 0])
|
||||
|> line(endAbsolute = [0, 10])
|
||||
|> line(endAbsolute = [-10, 0])
|
||||
|> close()
|
||||
|
||||
example = extrude(5, exampleSketch)
|
||||
example = extrude(exampleSketch, length = 5)
|
||||
|> appearance({
|
||||
color = '#ff0000',
|
||||
metalness = 50,
|
||||
@ -65,11 +65,11 @@ sketch001 = startSketchOn('XY')
|
||||
fn cube(center) {
|
||||
return startSketchOn('XY')
|
||||
|> startProfileAt([center[0] - 10, center[1] - 10], %)
|
||||
|> lineTo([center[0] + 10, center[1] - 10], %)
|
||||
|> lineTo([center[0] + 10, center[1] + 10], %)
|
||||
|> lineTo([center[0] - 10, center[1] + 10], %)
|
||||
|> close(%)
|
||||
|> extrude(10, %)
|
||||
|> line(endAbsolute = [center[0] + 10, center[1] - 10])
|
||||
|> line(endAbsolute = [center[0] + 10, center[1] + 10])
|
||||
|> line(endAbsolute = [center[0] - 10, center[1] + 10])
|
||||
|> close()
|
||||
|> extrude(length = 10)
|
||||
}
|
||||
|
||||
example0 = cube([0, 0])
|
||||
@ -95,11 +95,11 @@ appearance({
|
||||
// This example shows setting the appearance _after_ the shell.
|
||||
firstSketch = startSketchOn('XY')
|
||||
|> startProfileAt([-12, 12], %)
|
||||
|> line([24, 0], %)
|
||||
|> line([0, -24], %)
|
||||
|> line([-24, 0], %)
|
||||
|> close(%)
|
||||
|> extrude(6, %)
|
||||
|> line(end = [24, 0])
|
||||
|> line(end = [0, -24])
|
||||
|> line(end = [-24, 0])
|
||||
|> close()
|
||||
|> extrude(length = 6)
|
||||
|
||||
shell({ faces = ['end'], thickness = 0.25 }, firstSketch)
|
||||
|> appearance({
|
||||
@ -116,11 +116,11 @@ shell({ faces = ['end'], thickness = 0.25 }, firstSketch)
|
||||
// This example shows setting the appearance _before_ the shell.
|
||||
firstSketch = startSketchOn('XY')
|
||||
|> startProfileAt([-12, 12], %)
|
||||
|> line([24, 0], %)
|
||||
|> line([0, -24], %)
|
||||
|> line([-24, 0], %)
|
||||
|> close(%)
|
||||
|> extrude(6, %)
|
||||
|> line(end = [24, 0])
|
||||
|> line(end = [0, -24])
|
||||
|> line(end = [-24, 0])
|
||||
|> close()
|
||||
|> extrude(length = 6)
|
||||
|> appearance({
|
||||
color = '#ff0000',
|
||||
metalness = 90,
|
||||
@ -137,12 +137,12 @@ shell({ faces = ['end'], thickness = 0.25 }, firstSketch)
|
||||
// This example shows _before_ the pattern.
|
||||
exampleSketch = startSketchOn('XZ')
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> line([0, 2], %)
|
||||
|> line([3, 1], %)
|
||||
|> line([0, -4], %)
|
||||
|> close(%)
|
||||
|> line(end = [0, 2])
|
||||
|> line(end = [3, 1])
|
||||
|> line(end = [0, -4])
|
||||
|> close()
|
||||
|
||||
example = extrude(1, exampleSketch)
|
||||
example = extrude(exampleSketch, length = 1)
|
||||
|> appearance({
|
||||
color = '#ff0000',
|
||||
metalness = 90,
|
||||
@ -162,12 +162,12 @@ example = extrude(1, exampleSketch)
|
||||
// This example shows _after_ the pattern.
|
||||
exampleSketch = startSketchOn('XZ')
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> line([0, 2], %)
|
||||
|> line([3, 1], %)
|
||||
|> line([0, -4], %)
|
||||
|> close(%)
|
||||
|> line(end = [0, 2])
|
||||
|> line(end = [3, 1])
|
||||
|> line(end = [0, -4])
|
||||
|> close()
|
||||
|
||||
example = extrude(1, exampleSketch)
|
||||
example = extrude(exampleSketch, length = 1)
|
||||
|> patternLinear3d({
|
||||
axis = [1, 0, 1],
|
||||
instances = 7,
|
||||
@ -186,10 +186,10 @@ example = extrude(1, exampleSketch)
|
||||
// Color the result of a 2D pattern that was extruded.
|
||||
exampleSketch = startSketchOn('XZ')
|
||||
|> startProfileAt([.5, 25], %)
|
||||
|> line([0, 5], %)
|
||||
|> line([-1, 0], %)
|
||||
|> line([0, -5], %)
|
||||
|> close(%)
|
||||
|> line(end = [0, 5])
|
||||
|> line(end = [-1, 0])
|
||||
|> line(end = [0, -5])
|
||||
|> close()
|
||||
|> patternCircular2d({
|
||||
center = [0, 0],
|
||||
instances = 13,
|
||||
@ -197,7 +197,7 @@ exampleSketch = startSketchOn('XZ')
|
||||
rotateDuplicates = true
|
||||
}, %)
|
||||
|
||||
example = extrude(1, exampleSketch)
|
||||
example = extrude(exampleSketch, length = 1)
|
||||
|> appearance({
|
||||
color = '#ff0000',
|
||||
metalness = 90,
|
||||
@ -214,11 +214,11 @@ example = extrude(1, exampleSketch)
|
||||
// Create a path for the sweep.
|
||||
sweepPath = startSketchOn('XZ')
|
||||
|> startProfileAt([0.05, 0.05], %)
|
||||
|> line([0, 7], %)
|
||||
|> line(end = [0, 7])
|
||||
|> tangentialArc({ offset = 90, radius = 5 }, %)
|
||||
|> line([-3, 0], %)
|
||||
|> line(end = [-3, 0])
|
||||
|> tangentialArc({ offset = -90, radius = 5 }, %)
|
||||
|> line([0, 7], %)
|
||||
|> line(end = [0, 7])
|
||||
|
||||
pipeHole = startSketchOn('XY')
|
||||
|> circle({ center = [0, 0], radius = 1.5 }, %)
|
||||
|
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
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
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
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -36,12 +36,12 @@ filletRadius = 2
|
||||
|
||||
mountingPlateSketch = startSketchOn("XY")
|
||||
|> startProfileAt([-width / 2, -length / 2], %)
|
||||
|> lineTo([width / 2, -length / 2], %, $edge1)
|
||||
|> lineTo([width / 2, length / 2], %, $edge2)
|
||||
|> lineTo([-width / 2, length / 2], %, $edge3)
|
||||
|> close(%, $edge4)
|
||||
|> line(endAbsolute = [width / 2, -length / 2], tag = $edge1)
|
||||
|> line(endAbsolute = [width / 2, length / 2], tag = $edge2)
|
||||
|> line(endAbsolute = [-width / 2, length / 2], tag = $edge3)
|
||||
|> close(tag = $edge4)
|
||||
|
||||
mountingPlate = extrude(thickness, mountingPlateSketch)
|
||||
mountingPlate = extrude(mountingPlateSketch, length = thickness)
|
||||
|> fillet({
|
||||
radius = filletRadius,
|
||||
tags = [
|
||||
@ -63,12 +63,12 @@ filletRadius = 1
|
||||
|
||||
mountingPlateSketch = startSketchOn("XY")
|
||||
|> startProfileAt([-width / 2, -length / 2], %)
|
||||
|> lineTo([width / 2, -length / 2], %, $edge1)
|
||||
|> lineTo([width / 2, length / 2], %, $edge2)
|
||||
|> lineTo([-width / 2, length / 2], %, $edge3)
|
||||
|> close(%, $edge4)
|
||||
|> line(endAbsolute = [width / 2, -length / 2], tag = $edge1)
|
||||
|> line(endAbsolute = [width / 2, length / 2], tag = $edge2)
|
||||
|> line(endAbsolute = [-width / 2, length / 2], tag = $edge3)
|
||||
|> close(tag = $edge4)
|
||||
|
||||
mountingPlate = extrude(thickness, mountingPlateSketch)
|
||||
mountingPlate = extrude(mountingPlateSketch, length = thickness)
|
||||
|> fillet({
|
||||
radius = filletRadius,
|
||||
tolerance = 0.000001,
|
||||
|
File diff suppressed because one or more lines are too long
@ -29,14 +29,14 @@ getNextAdjacentEdge(tag: TagIdentifier) -> Uuid
|
||||
```js
|
||||
exampleSketch = startSketchOn('XZ')
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> line([10, 0], %)
|
||||
|> line(end = [10, 0])
|
||||
|> angledLine({ angle = 60, length = 10 }, %)
|
||||
|> angledLine({ angle = 120, length = 10 }, %)
|
||||
|> line([-10, 0], %)
|
||||
|> line(end = [-10, 0])
|
||||
|> angledLine({ angle = 240, length = 10 }, %, $referenceEdge)
|
||||
|> close(%)
|
||||
|> close()
|
||||
|
||||
example = extrude(5, exampleSketch)
|
||||
example = extrude(exampleSketch, length = 5)
|
||||
|> fillet({
|
||||
radius = 3,
|
||||
tags = [getNextAdjacentEdge(referenceEdge)]
|
||||
|
@ -29,14 +29,14 @@ getOppositeEdge(tag: TagIdentifier) -> Uuid
|
||||
```js
|
||||
exampleSketch = startSketchOn('XZ')
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> line([10, 0], %)
|
||||
|> line(end = [10, 0])
|
||||
|> angledLine({ angle = 60, length = 10 }, %)
|
||||
|> angledLine({ angle = 120, length = 10 }, %)
|
||||
|> line([-10, 0], %)
|
||||
|> line(end = [-10, 0])
|
||||
|> angledLine({ angle = 240, length = 10 }, %, $referenceEdge)
|
||||
|> close(%)
|
||||
|> close()
|
||||
|
||||
example = extrude(5, exampleSketch)
|
||||
example = extrude(exampleSketch, length = 5)
|
||||
|> fillet({
|
||||
radius = 3,
|
||||
tags = [getOppositeEdge(referenceEdge)]
|
||||
|
@ -29,14 +29,14 @@ getPreviousAdjacentEdge(tag: TagIdentifier) -> Uuid
|
||||
```js
|
||||
exampleSketch = startSketchOn('XZ')
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> line([10, 0], %)
|
||||
|> line(end = [10, 0])
|
||||
|> angledLine({ angle = 60, length = 10 }, %)
|
||||
|> angledLine({ angle = 120, length = 10 }, %)
|
||||
|> line([-10, 0], %)
|
||||
|> line(end = [-10, 0])
|
||||
|> angledLine({ angle = 240, length = 10 }, %, $referenceEdge)
|
||||
|> close(%)
|
||||
|> close()
|
||||
|
||||
example = extrude(5, exampleSketch)
|
||||
example = extrude(exampleSketch, length = 5)
|
||||
|> fillet({
|
||||
radius = 3,
|
||||
tags = [getPreviousAdjacentEdge(referenceEdge)]
|
||||
|
@ -49,7 +49,7 @@ springSketch = startSketchOn('YZ')
|
||||
// Create a helix around an edge.
|
||||
helper001 = startSketchOn('XZ')
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> line([0, 10], %, $edge001)
|
||||
|> line(end = [0, 10], tag = $edge001)
|
||||
|
||||
helixPath = helix({
|
||||
angleStart = 0,
|
||||
|
@ -30,7 +30,7 @@ helixRevolutions(data: HelixRevolutionsData, solid: Solid) -> Solid
|
||||
```js
|
||||
part001 = startSketchOn('XY')
|
||||
|> circle({ center = [5, 5], radius = 10 }, %)
|
||||
|> extrude(10, %)
|
||||
|> extrude(length = 10)
|
||||
|> helixRevolutions({
|
||||
angleStart = 0,
|
||||
ccw = true,
|
||||
|
File diff suppressed because one or more lines are too long
@ -31,11 +31,11 @@ hollow(thickness: number, solid: Solid) -> Solid
|
||||
// Hollow a basic sketch.
|
||||
firstSketch = startSketchOn('XY')
|
||||
|> startProfileAt([-12, 12], %)
|
||||
|> line([24, 0], %)
|
||||
|> line([0, -24], %)
|
||||
|> line([-24, 0], %)
|
||||
|> close(%)
|
||||
|> extrude(6, %)
|
||||
|> line(end = [24, 0])
|
||||
|> line(end = [0, -24])
|
||||
|> line(end = [-24, 0])
|
||||
|> close()
|
||||
|> extrude(length = 6)
|
||||
|> hollow(0.25, %)
|
||||
```
|
||||
|
||||
@ -45,11 +45,11 @@ firstSketch = startSketchOn('XY')
|
||||
// Hollow a basic sketch.
|
||||
firstSketch = startSketchOn('-XZ')
|
||||
|> startProfileAt([-12, 12], %)
|
||||
|> line([24, 0], %)
|
||||
|> line([0, -24], %)
|
||||
|> line([-24, 0], %)
|
||||
|> close(%)
|
||||
|> extrude(6, %)
|
||||
|> line(end = [24, 0])
|
||||
|> line(end = [0, -24])
|
||||
|> line(end = [-24, 0])
|
||||
|> close()
|
||||
|> extrude(length = 6)
|
||||
|> hollow(0.5, %)
|
||||
```
|
||||
|
||||
@ -60,25 +60,25 @@ firstSketch = startSketchOn('-XZ')
|
||||
size = 100
|
||||
case = startSketchOn('-XZ')
|
||||
|> startProfileAt([-size, -size], %)
|
||||
|> line([2 * size, 0], %)
|
||||
|> line([0, 2 * size], %)
|
||||
|> line(end = [2 * size, 0])
|
||||
|> line(end = [0, 2 * size])
|
||||
|> tangentialArcTo([-size, size], %)
|
||||
|> close(%)
|
||||
|> extrude(65, %)
|
||||
|> close()
|
||||
|> extrude(length = 65)
|
||||
|
||||
thing1 = startSketchOn(case, 'end')
|
||||
|> circle({
|
||||
center = [-size / 2, -size / 2],
|
||||
radius = 25
|
||||
}, %)
|
||||
|> extrude(50, %)
|
||||
|> extrude(length = 50)
|
||||
|
||||
thing2 = startSketchOn(case, 'end')
|
||||
|> circle({
|
||||
center = [size / 2, -size / 2],
|
||||
radius = 25
|
||||
}, %)
|
||||
|> extrude(50, %)
|
||||
|> extrude(length = 50)
|
||||
|
||||
hollow(0.5, case)
|
||||
```
|
||||
|
@ -58,7 +58,6 @@ layout: manual
|
||||
* [`legAngY`](kcl/legAngY)
|
||||
* [`legLen`](kcl/legLen)
|
||||
* [`line`](kcl/line)
|
||||
* [`lineTo`](kcl/lineTo)
|
||||
* [`ln`](kcl/ln)
|
||||
* [`loft`](kcl/loft)
|
||||
* [`log`](kcl/log)
|
||||
|
@ -38,7 +38,7 @@ assertEqual(n, 3, 0.0001, "5/2 = 2.5, rounded up makes 3")
|
||||
// Draw n cylinders.
|
||||
startSketchOn('XZ')
|
||||
|> circle({ center = [0, 0], radius = 2 }, %)
|
||||
|> extrude(5, %)
|
||||
|> extrude(length = 5)
|
||||
|> patternTransform(n, fn(id) {
|
||||
return { translate = [4 * id, 0, 0] }
|
||||
}, %)
|
||||
|
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
@ -34,18 +34,18 @@ loft(sketches: [Sketch], v_degree: NonZeroU32, bez_approximate_rational: bool, b
|
||||
// Loft a square and a triangle.
|
||||
squareSketch = startSketchOn('XY')
|
||||
|> startProfileAt([-100, 200], %)
|
||||
|> line([200, 0], %)
|
||||
|> line([0, -200], %)
|
||||
|> line([-200, 0], %)
|
||||
|> lineTo([profileStartX(%), profileStartY(%)], %)
|
||||
|> close(%)
|
||||
|> line(end = [200, 0])
|
||||
|> line(end = [0, -200])
|
||||
|> line(end = [-200, 0])
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
|
||||
triangleSketch = startSketchOn(offsetPlane('XY', 75))
|
||||
|> startProfileAt([0, 125], %)
|
||||
|> line([-15, -30], %)
|
||||
|> line([30, 0], %)
|
||||
|> lineTo([profileStartX(%), profileStartY(%)], %)
|
||||
|> close(%)
|
||||
|> line(end = [-15, -30])
|
||||
|> line(end = [30, 0])
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
|
||||
loft([squareSketch, triangleSketch])
|
||||
```
|
||||
@ -56,11 +56,11 @@ loft([squareSketch, triangleSketch])
|
||||
// Loft a square, a circle, and another circle.
|
||||
squareSketch = startSketchOn('XY')
|
||||
|> startProfileAt([-100, 200], %)
|
||||
|> line([200, 0], %)
|
||||
|> line([0, -200], %)
|
||||
|> line([-200, 0], %)
|
||||
|> lineTo([profileStartX(%), profileStartY(%)], %)
|
||||
|> close(%)
|
||||
|> line(end = [200, 0])
|
||||
|> line(end = [0, -200])
|
||||
|> line(end = [-200, 0])
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
|
||||
circleSketch0 = startSketchOn(offsetPlane('XY', 75))
|
||||
|> circle({ center = [0, 100], radius = 50 }, %)
|
||||
@ -81,11 +81,11 @@ loft([
|
||||
// Loft a square, a circle, and another circle with options.
|
||||
squareSketch = startSketchOn('XY')
|
||||
|> startProfileAt([-100, 200], %)
|
||||
|> line([200, 0], %)
|
||||
|> line([0, -200], %)
|
||||
|> line([-200, 0], %)
|
||||
|> lineTo([profileStartX(%), profileStartY(%)], %)
|
||||
|> close(%)
|
||||
|> line(end = [200, 0])
|
||||
|> line(end = [0, -200])
|
||||
|> line(end = [-200, 0])
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
|
||||
circleSketch0 = startSketchOn(offsetPlane('XY', 75))
|
||||
|> circle({ center = [0, 100], radius = 50 }, %)
|
||||
|
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
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
@ -31,7 +31,7 @@ patternCircular3d(data: CircularPattern3dData, solid_set: SolidSet) -> [Solid]
|
||||
exampleSketch = startSketchOn('XZ')
|
||||
|> circle({ center = [0, 0], radius = 1 }, %)
|
||||
|
||||
example = extrude(-5, exampleSketch)
|
||||
example = extrude(exampleSketch, length = -5)
|
||||
|> patternCircular3d({
|
||||
axis = [1, -1, 0],
|
||||
center = [10, -20, 0],
|
||||
|
File diff suppressed because one or more lines are too long
@ -30,12 +30,12 @@ patternLinear3d(data: LinearPattern3dData, solid_set: SolidSet) -> [Solid]
|
||||
```js
|
||||
exampleSketch = startSketchOn('XZ')
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> line([0, 2], %)
|
||||
|> line([3, 1], %)
|
||||
|> line([0, -4], %)
|
||||
|> close(%)
|
||||
|> line(end = [0, 2])
|
||||
|> line(end = [3, 1])
|
||||
|> line(end = [0, -4])
|
||||
|> close()
|
||||
|
||||
example = extrude(1, exampleSketch)
|
||||
example = extrude(exampleSketch, length = 1)
|
||||
|> patternLinear3d({
|
||||
axis = [1, 0, 1],
|
||||
instances = 7,
|
||||
|
@ -63,7 +63,7 @@ fn transform(id) {
|
||||
// Sketch 4 cylinders.
|
||||
sketch001 = startSketchOn('XZ')
|
||||
|> circle({ center = [0, 0], radius = 2 }, %)
|
||||
|> extrude(5, %)
|
||||
|> extrude(length = 5)
|
||||
|> patternTransform(4, transform, %)
|
||||
```
|
||||
|
||||
@ -79,7 +79,7 @@ fn transform(id) {
|
||||
|
||||
sketch001 = startSketchOn('XZ')
|
||||
|> circle({ center = [0, 0], radius = 2 }, %)
|
||||
|> extrude(5, %)
|
||||
|> extrude(length = 5)
|
||||
|> patternTransform(4, transform, %)
|
||||
```
|
||||
|
||||
@ -97,12 +97,12 @@ fn cube(length, center) {
|
||||
|
||||
return startSketchOn('XY')
|
||||
|> startProfileAt(p0, %)
|
||||
|> lineTo(p1, %)
|
||||
|> lineTo(p2, %)
|
||||
|> lineTo(p3, %)
|
||||
|> lineTo(p0, %)
|
||||
|> close(%)
|
||||
|> extrude(length, %)
|
||||
|> line(endAbsolute = p1)
|
||||
|> line(endAbsolute = p2)
|
||||
|> line(endAbsolute = p3)
|
||||
|> line(endAbsolute = p0)
|
||||
|> close()
|
||||
|> extrude(length = length)
|
||||
}
|
||||
|
||||
width = 20
|
||||
@ -135,12 +135,12 @@ fn cube(length, center) {
|
||||
|
||||
return startSketchOn('XY')
|
||||
|> startProfileAt(p0, %)
|
||||
|> lineTo(p1, %)
|
||||
|> lineTo(p2, %)
|
||||
|> lineTo(p3, %)
|
||||
|> lineTo(p0, %)
|
||||
|> close(%)
|
||||
|> extrude(length, %)
|
||||
|> line(endAbsolute = p1)
|
||||
|> line(endAbsolute = p2)
|
||||
|> line(endAbsolute = p3)
|
||||
|> line(endAbsolute = p0)
|
||||
|> close()
|
||||
|> extrude(length = length)
|
||||
}
|
||||
|
||||
width = 20
|
||||
@ -179,7 +179,7 @@ fn layer() {
|
||||
return startSketchOn("XY")
|
||||
// or some other plane idk
|
||||
|> circle({ center = [0, 0], radius = 1 }, %, $tag1)
|
||||
|> extrude(h, %)
|
||||
|> extrude(length = h)
|
||||
}
|
||||
// The vase is 100 layers tall.
|
||||
// The 100 layers are replica of each other, with a slight transformation applied to each.
|
||||
@ -205,7 +205,7 @@ startSketchOn('XY')
|
||||
center = [0, 0],
|
||||
inscribed = false
|
||||
}, %)
|
||||
|> extrude(4, %)
|
||||
|> extrude(length = 4)
|
||||
|> patternTransform(3, transform, %)
|
||||
```
|
||||
|
||||
|
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
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
File diff suppressed because one or more lines are too long
@ -30,12 +30,12 @@ segEnd(tag: TagIdentifier) -> [number]
|
||||
w = 15
|
||||
cube = startSketchOn('XY')
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> line([w, 0], %, $line1)
|
||||
|> line([0, w], %, $line2)
|
||||
|> line([-w, 0], %, $line3)
|
||||
|> line([0, -w], %, $line4)
|
||||
|> close(%)
|
||||
|> extrude(5, %)
|
||||
|> line(end = [w, 0], tag = $line1)
|
||||
|> line(end = [0, w], tag = $line2)
|
||||
|> line(end = [-w, 0], tag = $line3)
|
||||
|> line(end = [0, -w], tag = $line4)
|
||||
|> close()
|
||||
|> extrude(length = 5)
|
||||
|
||||
fn cylinder(radius, tag) {
|
||||
return startSketchOn('XY')
|
||||
@ -44,7 +44,7 @@ fn cylinder(radius, tag) {
|
||||
radius = radius,
|
||||
center = segEnd(tag)
|
||||
}, %)
|
||||
|> extrude(radius, %)
|
||||
|> extrude(length = radius)
|
||||
}
|
||||
|
||||
cylinder(1, line1)
|
||||
|
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
@ -30,12 +30,12 @@ segStart(tag: TagIdentifier) -> [number]
|
||||
w = 15
|
||||
cube = startSketchOn('XY')
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> line([w, 0], %, $line1)
|
||||
|> line([0, w], %, $line2)
|
||||
|> line([-w, 0], %, $line3)
|
||||
|> line([0, -w], %, $line4)
|
||||
|> close(%)
|
||||
|> extrude(5, %)
|
||||
|> line(end = [w, 0], tag = $line1)
|
||||
|> line(end = [0, w], tag = $line2)
|
||||
|> line(end = [-w, 0], tag = $line3)
|
||||
|> line(end = [0, -w], tag = $line4)
|
||||
|> close()
|
||||
|> extrude(length = 5)
|
||||
|
||||
fn cylinder(radius, tag) {
|
||||
return startSketchOn('XY')
|
||||
@ -44,7 +44,7 @@ fn cylinder(radius, tag) {
|
||||
radius = radius,
|
||||
center = segStart(tag)
|
||||
}, %)
|
||||
|> extrude(radius, %)
|
||||
|> extrude(length = radius)
|
||||
}
|
||||
|
||||
cylinder(1, line1)
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -31,11 +31,11 @@ shell(data: ShellData, solid_set: SolidSet) -> SolidSet
|
||||
// Remove the end face for the extrusion.
|
||||
firstSketch = startSketchOn('XY')
|
||||
|> startProfileAt([-12, 12], %)
|
||||
|> line([24, 0], %)
|
||||
|> line([0, -24], %)
|
||||
|> line([-24, 0], %)
|
||||
|> close(%)
|
||||
|> extrude(6, %)
|
||||
|> line(end = [24, 0])
|
||||
|> line(end = [0, -24])
|
||||
|> line(end = [-24, 0])
|
||||
|> close()
|
||||
|> extrude(length = 6)
|
||||
|
||||
// Remove the end face for the extrusion.
|
||||
shell({ faces = ['end'], thickness = 0.25 }, firstSketch)
|
||||
@ -47,11 +47,11 @@ shell({ faces = ['end'], thickness = 0.25 }, firstSketch)
|
||||
// Remove the start face for the extrusion.
|
||||
firstSketch = startSketchOn('-XZ')
|
||||
|> startProfileAt([-12, 12], %)
|
||||
|> line([24, 0], %)
|
||||
|> line([0, -24], %)
|
||||
|> line([-24, 0], %)
|
||||
|> close(%)
|
||||
|> extrude(6, %)
|
||||
|> line(end = [24, 0])
|
||||
|> line(end = [0, -24])
|
||||
|> line(end = [-24, 0])
|
||||
|> close()
|
||||
|> extrude(length = 6)
|
||||
|
||||
// Remove the start face for the extrusion.
|
||||
shell({ faces = ['start'], thickness = 0.25 }, firstSketch)
|
||||
@ -63,11 +63,11 @@ shell({ faces = ['start'], thickness = 0.25 }, firstSketch)
|
||||
// Remove a tagged face and the end face for the extrusion.
|
||||
firstSketch = startSketchOn('XY')
|
||||
|> startProfileAt([-12, 12], %)
|
||||
|> line([24, 0], %)
|
||||
|> line([0, -24], %)
|
||||
|> line([-24, 0], %, $myTag)
|
||||
|> close(%)
|
||||
|> extrude(6, %)
|
||||
|> line(end = [24, 0])
|
||||
|> line(end = [0, -24])
|
||||
|> line(end = [-24, 0], tag = $myTag)
|
||||
|> close()
|
||||
|> extrude(length = 6)
|
||||
|
||||
// Remove a tagged face for the extrusion.
|
||||
shell({ faces = [myTag], thickness = 0.25 }, firstSketch)
|
||||
@ -79,11 +79,11 @@ shell({ faces = [myTag], thickness = 0.25 }, firstSketch)
|
||||
// Remove multiple faces at once.
|
||||
firstSketch = startSketchOn('XY')
|
||||
|> startProfileAt([-12, 12], %)
|
||||
|> line([24, 0], %)
|
||||
|> line([0, -24], %)
|
||||
|> line([-24, 0], %, $myTag)
|
||||
|> close(%)
|
||||
|> extrude(6, %)
|
||||
|> line(end = [24, 0])
|
||||
|> line(end = [0, -24])
|
||||
|> line(end = [-24, 0], tag = $myTag)
|
||||
|> close()
|
||||
|> extrude(length = 6)
|
||||
|
||||
// Remove a tagged face and the end face for the extrusion.
|
||||
shell({
|
||||
@ -99,25 +99,25 @@ shell({
|
||||
size = 100
|
||||
case = startSketchOn('-XZ')
|
||||
|> startProfileAt([-size, -size], %)
|
||||
|> line([2 * size, 0], %)
|
||||
|> line([0, 2 * size], %)
|
||||
|> line(end = [2 * size, 0])
|
||||
|> line(end = [0, 2 * size])
|
||||
|> tangentialArcTo([-size, size], %)
|
||||
|> close(%)
|
||||
|> extrude(65, %)
|
||||
|> close()
|
||||
|> extrude(length = 65)
|
||||
|
||||
thing1 = startSketchOn(case, 'end')
|
||||
|> circle({
|
||||
center = [-size / 2, -size / 2],
|
||||
radius = 25
|
||||
}, %)
|
||||
|> extrude(50, %)
|
||||
|> extrude(length = 50)
|
||||
|
||||
thing2 = startSketchOn(case, 'end')
|
||||
|> circle({
|
||||
center = [size / 2, -size / 2],
|
||||
radius = 25
|
||||
}, %)
|
||||
|> extrude(50, %)
|
||||
|> extrude(length = 50)
|
||||
|
||||
// We put "case" in the shell function to shell the entire object.
|
||||
shell({ faces = ['start'], thickness = 5 }, case)
|
||||
@ -130,25 +130,25 @@ shell({ faces = ['start'], thickness = 5 }, case)
|
||||
size = 100
|
||||
case = startSketchOn('XY')
|
||||
|> startProfileAt([-size, -size], %)
|
||||
|> line([2 * size, 0], %)
|
||||
|> line([0, 2 * size], %)
|
||||
|> line(end = [2 * size, 0])
|
||||
|> line(end = [0, 2 * size])
|
||||
|> tangentialArcTo([-size, size], %)
|
||||
|> close(%)
|
||||
|> extrude(65, %)
|
||||
|> close()
|
||||
|> extrude(length = 65)
|
||||
|
||||
thing1 = startSketchOn(case, 'end')
|
||||
|> circle({
|
||||
center = [-size / 2, -size / 2],
|
||||
radius = 25
|
||||
}, %)
|
||||
|> extrude(50, %)
|
||||
|> extrude(length = 50)
|
||||
|
||||
thing2 = startSketchOn(case, 'end')
|
||||
|> circle({
|
||||
center = [size / 2, -size / 2],
|
||||
radius = 25
|
||||
}, %)
|
||||
|> extrude(50, %)
|
||||
|> extrude(length = 50)
|
||||
|
||||
// We put "thing1" in the shell function to shell the end face of the object.
|
||||
shell({ faces = ['end'], thickness = 5 }, thing1)
|
||||
@ -164,25 +164,25 @@ shell({ faces = ['end'], thickness = 5 }, thing1)
|
||||
size = 100
|
||||
case = startSketchOn('XY')
|
||||
|> startProfileAt([-size, -size], %)
|
||||
|> line([2 * size, 0], %)
|
||||
|> line([0, 2 * size], %)
|
||||
|> line(end = [2 * size, 0])
|
||||
|> line(end = [0, 2 * size])
|
||||
|> tangentialArcTo([-size, size], %)
|
||||
|> close(%)
|
||||
|> extrude(65, %)
|
||||
|> close()
|
||||
|> extrude(length = 65)
|
||||
|
||||
thing1 = startSketchOn(case, 'end')
|
||||
|> circle({
|
||||
center = [-size / 2, -size / 2],
|
||||
radius = 25
|
||||
}, %)
|
||||
|> extrude(50, %)
|
||||
|> extrude(length = 50)
|
||||
|
||||
thing2 = startSketchOn(case, 'end')
|
||||
|> circle({
|
||||
center = [size / 2, -size / 2],
|
||||
radius = 25
|
||||
}, %)
|
||||
|> extrude(50, %)
|
||||
|> extrude(length = 50)
|
||||
|
||||
// We put "thing1" and "thing2" in the shell function to shell the end face of the object.
|
||||
shell({ faces = ['end'], thickness = 5 }, [thing1, thing2])
|
||||
|
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
File diff suppressed because one or more lines are too long
9318
docs/kcl/std.json
9318
docs/kcl/std.json
File diff suppressed because it is too large
Load Diff
@ -34,11 +34,11 @@ sweep(data: SweepData, sketch: Sketch) -> Solid
|
||||
// Create a path for the sweep.
|
||||
sweepPath = startSketchOn('XZ')
|
||||
|> startProfileAt([0.05, 0.05], %)
|
||||
|> line([0, 7], %)
|
||||
|> line(end = [0, 7])
|
||||
|> tangentialArc({ offset = 90, radius = 5 }, %)
|
||||
|> line([-3, 0], %)
|
||||
|> line(end = [-3, 0])
|
||||
|> tangentialArc({ offset = -90, radius = 5 }, %)
|
||||
|> line([0, 7], %)
|
||||
|> line(end = [0, 7])
|
||||
|
||||
// Create a hole for the pipe.
|
||||
pipeHole = startSketchOn('XY')
|
||||
|
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
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
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
@ -20,11 +20,11 @@ test.describe('Code pane and errors', () => {
|
||||
`// Extruded Triangle
|
||||
sketch001 = startSketchOn('XZ')
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> line([10, 0], %)
|
||||
|> line([-5, 10], %)
|
||||
|> lineTo([profileStartX(%), profileStartY(%)], %)
|
||||
|> close(%)
|
||||
extrude001 = extrude(5, sketch001)`
|
||||
|> line(end = [10, 0])
|
||||
|> line(end = [-5, 10])
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
extrude001 = extrude(sketch001, length = 5)`
|
||||
)
|
||||
})
|
||||
|
||||
@ -79,8 +79,10 @@ test.describe('Code pane and errors', () => {
|
||||
|
||||
// Delete a character to break the KCL
|
||||
await editor.openPane()
|
||||
await editor.scrollToText('thickness, bracketLeg1Sketch)')
|
||||
await page.getByText('extrude(thickness, bracketLeg1Sketch)').click()
|
||||
await editor.scrollToText('bracketLeg1Sketch, length = thickness)')
|
||||
await page
|
||||
.getByText('extrude(bracketLeg1Sketch, length = thickness)')
|
||||
.click()
|
||||
await page.keyboard.press('Backspace')
|
||||
|
||||
// Ensure that a badge appears on the button
|
||||
@ -107,7 +109,7 @@ test.describe('Code pane and errors', () => {
|
||||
await editor.openPane()
|
||||
|
||||
// Go to our problematic code again (missing closing paren!)
|
||||
await editor.scrollToText('extrude(thickness, bracketLeg1Sketch')
|
||||
await editor.scrollToText('extrude(bracketLeg1Sketch, length = thickness')
|
||||
|
||||
// Ensure that a badge appears on the button
|
||||
await expect(codePaneButtonHolder).toContainText('notification')
|
||||
|
@ -14,10 +14,10 @@ test.describe('Command bar tests', () => {
|
||||
'persistCode',
|
||||
`sketch001 = startSketchOn('XY')
|
||||
|> startProfileAt([-10, -10], %)
|
||||
|> line([20, 0], %)
|
||||
|> line([0, 20], %)
|
||||
|> line(end = [20, 0])
|
||||
|> line(end = [0, 20])
|
||||
|> xLine(-20, %)
|
||||
|> close(%)
|
||||
|> close()
|
||||
`
|
||||
)
|
||||
})
|
||||
@ -32,7 +32,7 @@ test.describe('Command bar tests', () => {
|
||||
await u.closeDebugPanel()
|
||||
|
||||
// Click the line of code for xLine.
|
||||
await page.getByText(`close(%)`).click() // TODO remove this and reinstate // await topHorzSegmentClick()
|
||||
await page.getByText(`close()`).click() // TODO remove this and reinstate // await topHorzSegmentClick()
|
||||
await page.waitForTimeout(100)
|
||||
|
||||
await page.getByRole('button', { name: 'Extrude' }).click()
|
||||
@ -42,7 +42,47 @@ test.describe('Command bar tests', () => {
|
||||
await page.keyboard.press('Enter')
|
||||
await page.waitForTimeout(200)
|
||||
await expect(page.locator('.cm-activeLine')).toHaveText(
|
||||
`extrude001 = extrude(${KCL_DEFAULT_LENGTH}, sketch001)`
|
||||
`extrude001 = extrude(sketch001, length = ${KCL_DEFAULT_LENGTH})`
|
||||
)
|
||||
})
|
||||
|
||||
// TODO: fix this test after the electron migration
|
||||
test.fixme('Fillet from command bar', async ({ page, homePage }) => {
|
||||
await page.addInitScript(async () => {
|
||||
localStorage.setItem(
|
||||
'persistCode',
|
||||
`sketch001 = startSketchOn('XY')
|
||||
|> startProfileAt([-5, -5], %)
|
||||
|> line(end = [0, 10])
|
||||
|> line(end = [10, 0])
|
||||
|> line(end = [0, -10])
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
extrude001 = extrude(sketch001, length = -10)`
|
||||
)
|
||||
})
|
||||
|
||||
const u = await getUtils(page)
|
||||
await page.setBodyDimensions({ width: 1000, height: 500 })
|
||||
await homePage.goToModelingScene()
|
||||
await u.openDebugPanel()
|
||||
await u.expectCmdLog('[data-message-type="execution-done"]')
|
||||
await u.closeDebugPanel()
|
||||
|
||||
const selectSegment = () => page.getByText(`line(end = [0, -10])`).click()
|
||||
|
||||
await selectSegment()
|
||||
await page.waitForTimeout(100)
|
||||
await page.getByRole('button', { name: 'Fillet' }).click()
|
||||
await page.waitForTimeout(100)
|
||||
await page.keyboard.press('Enter') // skip selection
|
||||
await page.waitForTimeout(100)
|
||||
await page.keyboard.press('Enter') // accept default radius
|
||||
await page.waitForTimeout(100)
|
||||
await page.keyboard.press('Enter') // submit
|
||||
await page.waitForTimeout(100)
|
||||
await expect(page.locator('.cm-activeLine')).toContainText(
|
||||
`fillet({ radius = ${KCL_DEFAULT_LENGTH}, tags = [seg01] }, %)`
|
||||
)
|
||||
})
|
||||
|
||||
@ -183,10 +223,10 @@ test.describe('Command bar tests', () => {
|
||||
`distance = sqrt(20)
|
||||
sketch001 = startSketchOn('XZ')
|
||||
|> startProfileAt([-6.95, 10.98], %)
|
||||
|> line([25.1, 0.41], %)
|
||||
|> line([0.73, -20.93], %)
|
||||
|> line([-23.44, 0.52], %)
|
||||
|> close(%)
|
||||
|> line(end = [25.1, 0.41])
|
||||
|> line(end = [0.73, -20.93])
|
||||
|> line(end = [-23.44, 0.52])
|
||||
|> close()
|
||||
`
|
||||
)
|
||||
})
|
||||
@ -251,7 +291,7 @@ test.describe('Command bar tests', () => {
|
||||
await u.waitForCmdReceive('extrude')
|
||||
|
||||
await expect(page.locator('.cm-content')).toContainText(
|
||||
'extrude001 = extrude(distance001, sketch001)'
|
||||
'extrude001 = extrude(sketch001, length = distance001)'
|
||||
)
|
||||
})
|
||||
|
||||
|
@ -20,7 +20,7 @@ test.describe('Copilot ghost text', () => {
|
||||
await page.keyboard.press('Enter')
|
||||
await expect(page.locator('.cm-ghostText').first()).toBeVisible()
|
||||
await expect(page.locator('.cm-content')).toHaveText(
|
||||
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line([0, scale], %) |> line([scale, 0], %) |> line([0, -scale], %) return sg}part001 = cube([0,0], 20) |> close(%) |> extrude(20, %)`
|
||||
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
|
||||
)
|
||||
await expect(page.locator('.cm-ghostText').first()).toHaveText(
|
||||
`fn cube = (pos, scale) => {`
|
||||
@ -29,7 +29,7 @@ test.describe('Copilot ghost text', () => {
|
||||
// We should be able to hit Tab to accept the completion.
|
||||
await page.keyboard.press('Tab')
|
||||
await expect(page.locator('.cm-content')).toHaveText(
|
||||
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line([0, scale], %) |> line([scale, 0], %) |> line([0, -scale], %) return sg}part001 = cube([0,0], 20) |> close(%) |> extrude(20, %)`
|
||||
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
|
||||
)
|
||||
|
||||
// Hit enter a few times.
|
||||
@ -37,7 +37,7 @@ test.describe('Copilot ghost text', () => {
|
||||
await page.keyboard.press('Enter')
|
||||
|
||||
await expect(page.locator('.cm-content')).toHaveText(
|
||||
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line([0, scale], %) |> line([scale, 0], %) |> line([0, -scale], %) return sg}part001 = cube([0,0], 20) |> close(%) |> extrude(20, %) `
|
||||
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20) `
|
||||
)
|
||||
|
||||
await expect(page.locator('.cm-ghostText')).not.toBeVisible()
|
||||
@ -80,7 +80,7 @@ test.describe('Copilot ghost text', () => {
|
||||
await page.keyboard.press('Enter')
|
||||
|
||||
await expect(page.locator('.cm-content')).toHaveText(
|
||||
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line([0, scale], %) |> line([scale, 0], %) |> line([0, -scale], %) return sg}part001 = cube([0,0], 20) |> close(%) |> extrude(20, %)`
|
||||
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
|
||||
)
|
||||
await expect(page.locator('.cm-ghostText').first()).toHaveText(
|
||||
`fn cube = (pos, scale) => {`
|
||||
@ -89,7 +89,7 @@ test.describe('Copilot ghost text', () => {
|
||||
// We should be able to hit Tab to accept the completion.
|
||||
await page.keyboard.press('Tab')
|
||||
await expect(page.locator('.cm-content')).toContainText(
|
||||
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line([0, scale], %) |> line([scale, 0], %) |> line([0, -scale], %) return sg}part001 = cube([0,0], 20) |> close(%) |> extrude(20, %)`
|
||||
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
|
||||
)
|
||||
})
|
||||
|
||||
@ -156,7 +156,7 @@ test.describe('Copilot ghost text', () => {
|
||||
await page.keyboard.press('Enter')
|
||||
|
||||
await expect(page.locator('.cm-content')).toHaveText(
|
||||
`sketch001 = startSketchOn('XZ')fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line([0, scale], %) |> line([scale, 0], %) |> line([0, -scale], %) return sg}part001 = cube([0,0], 20) |> close(%) |> extrude(20, %)`
|
||||
`sketch001 = startSketchOn('XZ')fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
|
||||
)
|
||||
await expect(page.locator('.cm-ghostText').first()).toHaveText(
|
||||
`fn cube = (pos, scale) => {`
|
||||
@ -165,7 +165,7 @@ test.describe('Copilot ghost text', () => {
|
||||
// We should be able to hit Tab to accept the completion.
|
||||
await page.keyboard.press('Tab')
|
||||
await expect(page.locator('.cm-content')).toHaveText(
|
||||
`sketch001 = startSketchOn('XZ')fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line([0, scale], %) |> line([scale, 0], %) |> line([0, -scale], %) return sg}part001 = cube([0,0], 20) |> close(%) |> extrude(20, %)`
|
||||
`sketch001 = startSketchOn('XZ')fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
|
||||
)
|
||||
|
||||
// Hit enter a few times.
|
||||
@ -173,7 +173,7 @@ test.describe('Copilot ghost text', () => {
|
||||
await page.keyboard.press('Enter')
|
||||
|
||||
await expect(page.locator('.cm-content')).toHaveText(
|
||||
`sketch001 = startSketchOn('XZ')fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line([0, scale], %) |> line([scale, 0], %) |> line([0, -scale], %) return sg}part001 = cube([0,0], 20) |> close(%) |> extrude(20, %) `
|
||||
`sketch001 = startSketchOn('XZ')fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20) `
|
||||
)
|
||||
|
||||
await expect(page.locator('.cm-ghostText')).not.toBeVisible()
|
||||
@ -194,7 +194,7 @@ test.describe('Copilot ghost text', () => {
|
||||
await page.keyboard.press('Enter')
|
||||
await expect(page.locator('.cm-ghostText').first()).toBeVisible()
|
||||
await expect(page.locator('.cm-content')).toHaveText(
|
||||
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line([0, scale], %) |> line([scale, 0], %) |> line([0, -scale], %) return sg}part001 = cube([0,0], 20) |> close(%) |> extrude(20, %)`
|
||||
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
|
||||
)
|
||||
await expect(page.locator('.cm-ghostText').first()).toHaveText(
|
||||
`fn cube = (pos, scale) => {`
|
||||
@ -225,7 +225,7 @@ test.describe('Copilot ghost text', () => {
|
||||
await page.keyboard.press('Enter')
|
||||
await expect(page.locator('.cm-ghostText').first()).toBeVisible()
|
||||
await expect(page.locator('.cm-content')).toHaveText(
|
||||
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line([0, scale], %) |> line([scale, 0], %) |> line([0, -scale], %) return sg}part001 = cube([0,0], 20) |> close(%) |> extrude(20, %)`
|
||||
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
|
||||
)
|
||||
await expect(page.locator('.cm-ghostText').first()).toHaveText(
|
||||
`fn cube = (pos, scale) => {`
|
||||
@ -256,7 +256,7 @@ test.describe('Copilot ghost text', () => {
|
||||
await page.keyboard.press('Enter')
|
||||
await expect(page.locator('.cm-ghostText').first()).toBeVisible()
|
||||
await expect(page.locator('.cm-content')).toHaveText(
|
||||
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line([0, scale], %) |> line([scale, 0], %) |> line([0, -scale], %) return sg}part001 = cube([0,0], 20) |> close(%) |> extrude(20, %)`
|
||||
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
|
||||
)
|
||||
await expect(page.locator('.cm-ghostText').first()).toHaveText(
|
||||
`fn cube = (pos, scale) => {`
|
||||
@ -287,7 +287,7 @@ test.describe('Copilot ghost text', () => {
|
||||
await page.keyboard.press('Enter')
|
||||
await expect(page.locator('.cm-ghostText').first()).toBeVisible()
|
||||
await expect(page.locator('.cm-content')).toHaveText(
|
||||
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line([0, scale], %) |> line([scale, 0], %) |> line([0, -scale], %) return sg}part001 = cube([0,0], 20) |> close(%) |> extrude(20, %)`
|
||||
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
|
||||
)
|
||||
await expect(page.locator('.cm-ghostText').first()).toHaveText(
|
||||
`fn cube = (pos, scale) => {`
|
||||
@ -315,7 +315,7 @@ test.describe('Copilot ghost text', () => {
|
||||
await page.keyboard.press('Enter')
|
||||
await expect(page.locator('.cm-ghostText').first()).toBeVisible()
|
||||
await expect(page.locator('.cm-content')).toHaveText(
|
||||
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line([0, scale], %) |> line([scale, 0], %) |> line([0, -scale], %) return sg}part001 = cube([0,0], 20) |> close(%) |> extrude(20, %)`
|
||||
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
|
||||
)
|
||||
await expect(page.locator('.cm-ghostText').first()).toHaveText(
|
||||
`fn cube = (pos, scale) => {`
|
||||
@ -326,7 +326,7 @@ test.describe('Copilot ghost text', () => {
|
||||
await expect(page.locator('.cm-ghostText').first()).toBeVisible()
|
||||
|
||||
await expect(page.locator('.cm-content')).toHaveText(
|
||||
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line([0, scale], %) |> line([scale, 0], %) |> line([0, -scale], %) return sg}part001 = cube([0,0], 20) |> close(%) |> extrude(20, %)`
|
||||
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
|
||||
)
|
||||
})
|
||||
|
||||
@ -348,7 +348,7 @@ test.describe('Copilot ghost text', () => {
|
||||
await page.keyboard.press('Enter')
|
||||
await expect(page.locator('.cm-ghostText').first()).toBeVisible()
|
||||
await expect(page.locator('.cm-content')).toHaveText(
|
||||
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line([0, scale], %) |> line([scale, 0], %) |> line([0, -scale], %) return sg}part001 = cube([0,0], 20) |> close(%) |> extrude(20, %)`
|
||||
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
|
||||
)
|
||||
await expect(page.locator('.cm-ghostText').first()).toHaveText(
|
||||
`fn cube = (pos, scale) => {`
|
||||
@ -409,7 +409,7 @@ test.describe('Copilot ghost text', () => {
|
||||
await page.keyboard.press('Enter')
|
||||
await expect(page.locator('.cm-ghostText').first()).toBeVisible()
|
||||
await expect(page.locator('.cm-content')).toHaveText(
|
||||
`{thing: "blah"}fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line([0, scale], %) |> line([scale, 0], %) |> line([0, -scale], %) return sg}part001 = cube([0,0], 20) |> close(%) |> extrude(20, %)`
|
||||
`{thing: "blah"}fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
|
||||
)
|
||||
await expect(page.locator('.cm-ghostText').first()).toHaveText(
|
||||
`fn cube = (pos, scale) => {`
|
||||
@ -450,7 +450,7 @@ test.describe('Copilot ghost text', () => {
|
||||
await page.keyboard.press('Enter')
|
||||
await expect(page.locator('.cm-ghostText').first()).toBeVisible()
|
||||
await expect(page.locator('.cm-content')).toHaveText(
|
||||
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line([0, scale], %) |> line([scale, 0], %) |> line([0, -scale], %) return sg}part001 = cube([0,0], 20) |> close(%) |> extrude(20, %)`
|
||||
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
|
||||
)
|
||||
await expect(page.locator('.cm-ghostText').first()).toHaveText(
|
||||
`fn cube = (pos, scale) => {`
|
||||
@ -483,7 +483,7 @@ test.describe('Copilot ghost text', () => {
|
||||
await page.keyboard.press('Enter')
|
||||
await expect(page.locator('.cm-ghostText').first()).toBeVisible()
|
||||
await expect(page.locator('.cm-content')).toHaveText(
|
||||
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line([0, scale], %) |> line([scale, 0], %) |> line([0, -scale], %) return sg}part001 = cube([0,0], 20) |> close(%) |> extrude(20, %)`
|
||||
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
|
||||
)
|
||||
await expect(page.locator('.cm-ghostText').first()).toHaveText(
|
||||
`fn cube = (pos, scale) => {`
|
||||
@ -514,7 +514,7 @@ test.describe('Copilot ghost text', () => {
|
||||
await page.keyboard.press('Enter')
|
||||
await expect(page.locator('.cm-ghostText').first()).toBeVisible()
|
||||
await expect(page.locator('.cm-content')).toHaveText(
|
||||
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line([0, scale], %) |> line([scale, 0], %) |> line([0, -scale], %) return sg}part001 = cube([0,0], 20) |> close(%) |> extrude(20, %)`
|
||||
`fn cube = (pos, scale) => { sg = startSketchOn('XY') |> startProfileAt(pos, %) |> line(end = [0, scale], %) |> line(end = [scale, 0]) |> line(end = [0, -scale]) return sg}part001 = cube([0,0], 20) |> close() |> extrude(length = 20)`
|
||||
)
|
||||
await expect(page.locator('.cm-ghostText').first()).toHaveText(
|
||||
`fn cube = (pos, scale) => {`
|
||||
|
@ -20,7 +20,7 @@ test.describe('Debug pane', () => {
|
||||
}) => {
|
||||
const code = `sketch001 = startSketchOn('XZ')
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> line([1, 1], %)
|
||||
|> line(end = [1, 1])
|
||||
`
|
||||
const u = await getUtils(page)
|
||||
await page.setBodyDimensions({ width: 1200, height: 500 })
|
||||
@ -61,7 +61,7 @@ test.describe('Debug pane', () => {
|
||||
}
|
||||
})
|
||||
await test.step('Enter a comment', async () => {
|
||||
await page.keyboard.type('|> line([2, 2], %)', { delay: 0 })
|
||||
await page.keyboard.type('|> line(end = [2, 2])', { delay: 0 })
|
||||
// Wait for keyboard input debounce and updated artifact graph.
|
||||
await page.waitForTimeout(1000)
|
||||
})
|
||||
|
@ -23,10 +23,10 @@ test.describe('Editor tests', () => {
|
||||
await u.codeLocator.click()
|
||||
await page.keyboard.type(`sketch001 = startSketchOn('XY')
|
||||
|> startProfileAt([-10, -10], %)
|
||||
|> line([20, 0], %)
|
||||
|> line([0, 20], %)
|
||||
|> line([-20, 0], %)
|
||||
|> close(%)`)
|
||||
|> line(end = [20, 0])
|
||||
|> line(end = [0, 20])
|
||||
|> line(end = [-20, 0])
|
||||
|> close()`)
|
||||
|
||||
await page.keyboard.down('ControlOrMeta')
|
||||
await page.keyboard.press('/')
|
||||
@ -35,10 +35,10 @@ test.describe('Editor tests', () => {
|
||||
await expect(page.locator('.cm-content'))
|
||||
.toHaveText(`sketch001 = startSketchOn('XY')
|
||||
|> startProfileAt([-10, -10], %)
|
||||
|> line([20, 0], %)
|
||||
|> line([0, 20], %)
|
||||
|> line([-20, 0], %)
|
||||
// |> close(%)`)
|
||||
|> line(end = [20, 0])
|
||||
|> line(end = [0, 20])
|
||||
|> line(end = [-20, 0])
|
||||
// |> close()`)
|
||||
|
||||
// uncomment the code
|
||||
await page.keyboard.down('ControlOrMeta')
|
||||
@ -48,10 +48,10 @@ test.describe('Editor tests', () => {
|
||||
await expect(page.locator('.cm-content'))
|
||||
.toHaveText(`sketch001 = startSketchOn('XY')
|
||||
|> startProfileAt([-10, -10], %)
|
||||
|> line([20, 0], %)
|
||||
|> line([0, 20], %)
|
||||
|> line([-20, 0], %)
|
||||
|> close(%)`)
|
||||
|> line(end = [20, 0])
|
||||
|> line(end = [0, 20])
|
||||
|> line(end = [-20, 0])
|
||||
|> close()`)
|
||||
})
|
||||
|
||||
test('ensure we use the cache, and do not re-execute', async ({
|
||||
@ -67,10 +67,10 @@ test.describe('Editor tests', () => {
|
||||
await u.codeLocator.click()
|
||||
await page.keyboard.type(`sketch001 = startSketchOn('XY')
|
||||
|> startProfileAt([-10, -10], %)
|
||||
|> line([20, 0], %)
|
||||
|> line([0, 20], %)
|
||||
|> line([-20, 0], %)
|
||||
|> close(%)`)
|
||||
|> line(end = [20, 0])
|
||||
|> line(end = [0, 20])
|
||||
|> line(end = [-20, 0])
|
||||
|> close()`)
|
||||
|
||||
// Ensure we execute the first time.
|
||||
await u.openDebugPanel()
|
||||
@ -116,10 +116,10 @@ test.describe('Editor tests', () => {
|
||||
await u.codeLocator.click()
|
||||
await page.keyboard.type(`sketch001 = startSketchOn('XY')
|
||||
|> startProfileAt([-10, -10], %)
|
||||
|> line([20, 0], %)
|
||||
|> line([0, 20], %)
|
||||
|> line([-20, 0], %)
|
||||
|> close(%)`)
|
||||
|> line(end = [20, 0])
|
||||
|> line(end = [0, 20])
|
||||
|> line(end = [-20, 0])
|
||||
|> close()`)
|
||||
|
||||
// Ensure we execute the first time.
|
||||
await u.openDebugPanel()
|
||||
@ -171,20 +171,20 @@ test.describe('Editor tests', () => {
|
||||
await u.codeLocator.click()
|
||||
await page.keyboard.type(`sketch001 = startSketchOn('XY')
|
||||
|> startProfileAt([-10, -10], %)
|
||||
|> line([20, 0], %)
|
||||
|> line([0, 20], %)
|
||||
|> line([-20, 0], %)
|
||||
|> close(%)`)
|
||||
|> line(end = [20, 0])
|
||||
|> line(end = [0, 20])
|
||||
|> line(end = [-20, 0])
|
||||
|> close()`)
|
||||
await page.locator('#code-pane button:first-child').click()
|
||||
await page.locator('button:has-text("Format code")').click()
|
||||
|
||||
await expect(page.locator('.cm-content'))
|
||||
.toHaveText(`sketch001 = startSketchOn('XY')
|
||||
|> startProfileAt([-10, -10], %)
|
||||
|> line([20, 0], %)
|
||||
|> line([0, 20], %)
|
||||
|> line([-20, 0], %)
|
||||
|> close(%)`)
|
||||
|> line(end = [20, 0])
|
||||
|> line(end = [0, 20])
|
||||
|> line(end = [-20, 0])
|
||||
|> close()`)
|
||||
})
|
||||
|
||||
test('if you click the format button it formats your code and executes so lints are still there', async ({
|
||||
@ -202,10 +202,10 @@ test.describe('Editor tests', () => {
|
||||
await u.codeLocator.click()
|
||||
await page.keyboard.type(`sketch_001 = startSketchOn('XY')
|
||||
|> startProfileAt([-10, -10], %)
|
||||
|> line([20, 0], %)
|
||||
|> line([0, 20], %)
|
||||
|> line([-20, 0], %)
|
||||
|> close(%)`)
|
||||
|> line(end = [20, 0])
|
||||
|> line(end = [0, 20])
|
||||
|> line(end = [-20, 0])
|
||||
|> close()`)
|
||||
|
||||
await u.openDebugPanel()
|
||||
await u.expectCmdLog('[data-message-type="execution-done"]')
|
||||
@ -230,10 +230,10 @@ test.describe('Editor tests', () => {
|
||||
await expect(page.locator('.cm-content'))
|
||||
.toHaveText(`sketch_001 = startSketchOn('XY')
|
||||
|> startProfileAt([-10, -10], %)
|
||||
|> line([20, 0], %)
|
||||
|> line([0, 20], %)
|
||||
|> line([-20, 0], %)
|
||||
|> close(%)`)
|
||||
|> line(end = [20, 0])
|
||||
|> line(end = [0, 20])
|
||||
|> line(end = [-20, 0])
|
||||
|> close()`)
|
||||
|
||||
// error in guter
|
||||
await expect(page.locator('.cm-lint-marker-info').first()).toBeVisible()
|
||||
@ -248,19 +248,19 @@ test.describe('Editor tests', () => {
|
||||
test('fold gutters work', async ({ page, homePage }) => {
|
||||
const fullCode = `sketch001 = startSketchOn('XY')
|
||||
|> startProfileAt([-10, -10], %)
|
||||
|> line([20, 0], %)
|
||||
|> line([0, 20], %)
|
||||
|> line([-20, 0], %)
|
||||
|> close(%)`
|
||||
|> line(end = [20, 0])
|
||||
|> line(end = [0, 20])
|
||||
|> line(end = [-20, 0])
|
||||
|> close()`
|
||||
await page.addInitScript(async () => {
|
||||
localStorage.setItem(
|
||||
'persistCode',
|
||||
`sketch001 = startSketchOn('XY')
|
||||
|> startProfileAt([-10, -10], %)
|
||||
|> line([20, 0], %)
|
||||
|> line([0, 20], %)
|
||||
|> line([-20, 0], %)
|
||||
|> close(%)`
|
||||
|> line(end = [20, 0])
|
||||
|> line(end = [0, 20])
|
||||
|> line(end = [-20, 0])
|
||||
|> close()`
|
||||
)
|
||||
})
|
||||
await page.setBodyDimensions({ width: 1000, height: 500 })
|
||||
@ -326,10 +326,10 @@ test.describe('Editor tests', () => {
|
||||
'persistCode',
|
||||
`sketch001 = startSketchOn('XY')
|
||||
|> startProfileAt([-10, -10], %)
|
||||
|> line([20, 0], %)
|
||||
|> line([0, 20], %)
|
||||
|> line([-20, 0], %)
|
||||
|> close(%)`
|
||||
|> line(end = [20, 0])
|
||||
|> line(end = [0, 20])
|
||||
|> line(end = [-20, 0])
|
||||
|> close()`
|
||||
)
|
||||
})
|
||||
await page.setBodyDimensions({ width: 1000, height: 500 })
|
||||
@ -358,7 +358,9 @@ test.describe('Editor tests', () => {
|
||||
// Hover over the line function
|
||||
await page.getByText('line').first().hover()
|
||||
await expect(page.locator('.hover-tooltip')).toBeVisible()
|
||||
await expect(page.getByText('Draw a line')).toBeVisible()
|
||||
await expect(
|
||||
page.getByText('Extend the current sketch with a new straight line.')
|
||||
).toBeVisible()
|
||||
})
|
||||
|
||||
test('if you use the format keyboard binding it formats your code', async ({
|
||||
@ -371,10 +373,10 @@ test.describe('Editor tests', () => {
|
||||
'persistCode',
|
||||
`sketch001 = startSketchOn('XY')
|
||||
|> startProfileAt([-10, -10], %)
|
||||
|> line([20, 0], %)
|
||||
|> line([0, 20], %)
|
||||
|> line([-20, 0], %)
|
||||
|> close(%)`
|
||||
|> line(end = [20, 0])
|
||||
|> line(end = [0, 20])
|
||||
|> line(end = [-20, 0])
|
||||
|> close()`
|
||||
)
|
||||
localStorage.setItem('disableAxis', 'true')
|
||||
})
|
||||
@ -398,10 +400,10 @@ test.describe('Editor tests', () => {
|
||||
await expect(page.locator('.cm-content'))
|
||||
.toHaveText(`sketch001 = startSketchOn('XY')
|
||||
|> startProfileAt([-10, -10], %)
|
||||
|> line([20, 0], %)
|
||||
|> line([0, 20], %)
|
||||
|> line([-20, 0], %)
|
||||
|> close(%)`)
|
||||
|> line(end = [20, 0])
|
||||
|> line(end = [0, 20])
|
||||
|> line(end = [-20, 0])
|
||||
|> close()`)
|
||||
})
|
||||
|
||||
test('if you use the format keyboard binding it formats your code and executes so lints are shown', async ({
|
||||
@ -414,10 +416,10 @@ test.describe('Editor tests', () => {
|
||||
'persistCode',
|
||||
`sketch_001 = startSketchOn('XY')
|
||||
|> startProfileAt([-10, -10], %)
|
||||
|> line([20, 0], %)
|
||||
|> line([0, 20], %)
|
||||
|> line([-20, 0], %)
|
||||
|> close(%)`
|
||||
|> line(end = [20, 0])
|
||||
|> line(end = [0, 20])
|
||||
|> line(end = [-20, 0])
|
||||
|> close()`
|
||||
)
|
||||
localStorage.setItem('disableAxis', 'true')
|
||||
})
|
||||
@ -451,10 +453,10 @@ test.describe('Editor tests', () => {
|
||||
await expect(page.locator('.cm-content'))
|
||||
.toHaveText(`sketch_001 = startSketchOn('XY')
|
||||
|> startProfileAt([-10, -10], %)
|
||||
|> line([20, 0], %)
|
||||
|> line([0, 20], %)
|
||||
|> line([-20, 0], %)
|
||||
|> close(%)`)
|
||||
|> line(end = [20, 0])
|
||||
|> line(end = [0, 20])
|
||||
|> line(end = [-20, 0])
|
||||
|> close()`)
|
||||
|
||||
// error in guter
|
||||
await expect(page.locator('.cm-lint-marker-info').first()).toBeVisible()
|
||||
@ -519,9 +521,9 @@ test.describe('Editor tests', () => {
|
||||
'persistCode',
|
||||
`sketch001 = startSketchOn('XZ')
|
||||
|> startProfileAt([3.29, 7.86], %)
|
||||
|> line([2.48, 2.44], %)
|
||||
|> line([2.66, 1.17], %)
|
||||
|> close(%)
|
||||
|> line(end = [2.48, 2.44])
|
||||
|> line(end = [2.66, 1.17])
|
||||
|> close()
|
||||
`
|
||||
)
|
||||
})
|
||||
@ -535,7 +537,7 @@ test.describe('Editor tests', () => {
|
||||
|
||||
await u.codeLocator.click()
|
||||
|
||||
await page.getByText(' |> line([2.48, 2.44], %)').click()
|
||||
await page.getByText(' |> line(end = [2.48, 2.44])').click()
|
||||
|
||||
await expect(
|
||||
page.locator('.cm-lint-marker-error').first()
|
||||
@ -643,10 +645,10 @@ test.describe('Editor tests', () => {
|
||||
fn squareHole = (l, w) => {
|
||||
squareHoleSketch = startSketchOn('XY')
|
||||
|> startProfileAt([-width / 2, -length / 2], %)
|
||||
|> lineTo([width / 2, -length / 2], %)
|
||||
|> lineTo([width / 2, length / 2], %)
|
||||
|> lineTo([-width / 2, length / 2], %)
|
||||
|> close(%)
|
||||
|> line(endAbsolute = [width / 2, -length / 2])
|
||||
|> line(endAbsolute = [width / 2, length / 2])
|
||||
|> line(endAbsolute = [-width / 2, length / 2])
|
||||
|> close()
|
||||
return squareHoleSketch
|
||||
}
|
||||
`
|
||||
@ -684,7 +686,7 @@ test.describe('Editor tests', () => {
|
||||
await page.keyboard.type(`extrusion = startSketchOn('XY')
|
||||
|> circle({ center: [0, 0], radius: dia/2 }, %)
|
||||
|> hole(squareHole(length, width, height), %)
|
||||
|> extrude(height, %)`)
|
||||
|> extrude(length = height)`)
|
||||
|
||||
// error in gutter
|
||||
await expect(page.locator('.cm-lint-marker-error').first()).toBeVisible()
|
||||
@ -707,18 +709,18 @@ test.describe('Editor tests', () => {
|
||||
'persistCode',
|
||||
`box = startSketchOn('XY')
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> line([0, 10], %)
|
||||
|> line([10, 0], %)
|
||||
|> line([0, -10], %, $revolveAxis)
|
||||
|> close(%)
|
||||
|> extrude(10, %)
|
||||
|> line(end = [0, 10])
|
||||
|> line(end = [10, 0])
|
||||
|> line(end = [0, -10], tag = $revolveAxis)
|
||||
|> close()
|
||||
|> extrude(length = 10)
|
||||
|
||||
sketch001 = startSketchOn(box, revolveAxis)
|
||||
|> startProfileAt([5, 10], %)
|
||||
|> line([0, -10], %)
|
||||
|> line([2, 0], %)
|
||||
|> line([0, -10], %)
|
||||
|> close(%)
|
||||
|> line(end = [0, -10])
|
||||
|> line(end = [2, 0])
|
||||
|> line(end = [0, -10])
|
||||
|> close()
|
||||
|> revolve({
|
||||
axis: revolveAxis,
|
||||
angle: 90
|
||||
@ -789,8 +791,7 @@ test.describe('Editor tests', () => {
|
||||
|
||||
await expect(page.locator('.cm-tooltip-autocomplete')).toBeVisible()
|
||||
await page.waitForTimeout(100)
|
||||
// press arrow down twice then enter to accept xLine
|
||||
await page.keyboard.press('ArrowDown')
|
||||
// press arrow down then enter to accept xLine
|
||||
await page.keyboard.press('ArrowDown')
|
||||
await page.keyboard.press('Enter')
|
||||
// finish line with comment
|
||||
@ -863,8 +864,7 @@ test.describe('Editor tests', () => {
|
||||
|
||||
await expect(page.locator('.cm-tooltip-autocomplete')).toBeVisible()
|
||||
await page.waitForTimeout(100)
|
||||
// press arrow down twice then tab to accept xLine
|
||||
await page.keyboard.press('ArrowDown')
|
||||
// press arrow down then tab to accept xLine
|
||||
await page.keyboard.press('ArrowDown')
|
||||
await page.keyboard.press('Tab')
|
||||
// finish line with comment
|
||||
@ -899,9 +899,9 @@ test.describe('Editor tests', () => {
|
||||
'persistCode',
|
||||
`sketch001 = startSketchOn('XZ')
|
||||
|> startProfileAt([4.61, -14.01], %)
|
||||
|> line([12.73, -0.09], %)
|
||||
|> line(end = [12.73, -0.09])
|
||||
|> tangentialArcTo([24.95, -5.38], %)
|
||||
|> close(%)`
|
||||
|> close()`
|
||||
)
|
||||
})
|
||||
|
||||
@ -949,7 +949,7 @@ test.describe('Editor tests', () => {
|
||||
|
||||
// expect the code to have changed
|
||||
await expect(page.locator('.cm-content')).toHaveText(
|
||||
`sketch001 = startSketchOn('XZ') |> startProfileAt([4.61, -14.01], %) |> line([12.73, -0.09], %) |> tangentialArcTo([24.95, -5.38], %) |> close(%)extrude001 = extrude(5, sketch001)`
|
||||
`sketch001 = startSketchOn('XZ') |> startProfileAt([4.61, -14.01], %) |> line(end = [12.73, -0.09]) |> tangentialArcTo([24.95, -5.38], %) |> close()extrude001 = extrude(sketch001, length = 5)`
|
||||
)
|
||||
|
||||
// Now hit undo
|
||||
@ -961,9 +961,9 @@ test.describe('Editor tests', () => {
|
||||
await expect(page.locator('.cm-content'))
|
||||
.toHaveText(`sketch001 = startSketchOn('XZ')
|
||||
|> startProfileAt([4.61, -14.01], %)
|
||||
|> line([12.73, -0.09], %)
|
||||
|> line(end = [12.73, -0.09])
|
||||
|> tangentialArcTo([24.95, -5.38], %)
|
||||
|> close(%)`)
|
||||
|> close()`)
|
||||
})
|
||||
|
||||
test(
|
||||
@ -976,10 +976,10 @@ test.describe('Editor tests', () => {
|
||||
'persistCode',
|
||||
`sketch001 = startSketchOn('XZ')
|
||||
|> startProfileAt([4.61, -10.01], %)
|
||||
|> line([12.73, -0.09], %)
|
||||
|> line(end = [12.73, -0.09])
|
||||
|> tangentialArcTo([24.95, -0.38], %)
|
||||
|> close(%)
|
||||
|> extrude(5, %)`
|
||||
|> close()
|
||||
|> extrude(length = 5)`
|
||||
)
|
||||
})
|
||||
|
||||
@ -1067,10 +1067,10 @@ test.describe('Editor tests', () => {
|
||||
await expect(page.locator('.cm-content'))
|
||||
.toHaveText(`sketch001 = startSketchOn('XZ')
|
||||
|> startProfileAt([2.71, -2.71], %)
|
||||
|> line([15.4, -2.78], %)
|
||||
|> line(end = [15.4, -2.78])
|
||||
|> tangentialArcTo([27.6, -3.05], %)
|
||||
|> close(%)
|
||||
|> extrude(5, %)
|
||||
|> close()
|
||||
|> extrude(length = 5)
|
||||
`)
|
||||
|
||||
// Hit undo
|
||||
@ -1081,10 +1081,10 @@ test.describe('Editor tests', () => {
|
||||
await expect(page.locator('.cm-content'))
|
||||
.toHaveText(`sketch001 = startSketchOn('XZ')
|
||||
|> startProfileAt([2.71, -2.71], %)
|
||||
|> line([15.4, -2.78], %)
|
||||
|> line(end = [15.4, -2.78])
|
||||
|> tangentialArcTo([24.95, -0.38], %)
|
||||
|> close(%)
|
||||
|> extrude(5, %)`)
|
||||
|> close()
|
||||
|> extrude(length = 5)`)
|
||||
|
||||
// Hit undo again.
|
||||
await page.keyboard.down('Control')
|
||||
@ -1094,10 +1094,10 @@ test.describe('Editor tests', () => {
|
||||
await expect(page.locator('.cm-content'))
|
||||
.toHaveText(`sketch001 = startSketchOn('XZ')
|
||||
|> startProfileAt([2.71, -2.71], %)
|
||||
|> line([12.73, -0.09], %)
|
||||
|> line(end = [12.73, -0.09])
|
||||
|> tangentialArcTo([24.95, -0.38], %)
|
||||
|> close(%)
|
||||
|> extrude(5, %)
|
||||
|> close()
|
||||
|> extrude(length = 5)
|
||||
`)
|
||||
|
||||
// Hit undo again.
|
||||
@ -1109,10 +1109,10 @@ test.describe('Editor tests', () => {
|
||||
await expect(page.locator('.cm-content'))
|
||||
.toHaveText(`sketch001 = startSketchOn('XZ')
|
||||
|> startProfileAt([4.61, -10.01], %)
|
||||
|> line([12.73, -0.09], %)
|
||||
|> line(end = [12.73, -0.09])
|
||||
|> tangentialArcTo([24.95, -0.38], %)
|
||||
|> close(%)
|
||||
|> extrude(5, %)`)
|
||||
|> close()
|
||||
|> extrude(length = 5)`)
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -9,30 +9,30 @@ export fn triangle() {
|
||||
return startSketchOn('XZ')
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> xLine(10, %)
|
||||
|> line([-10, -5], %)
|
||||
|> lineTo([profileStartX(%), profileStartY(%)], %)
|
||||
|> close(%)
|
||||
|> line(end = [-10, -5])
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
}
|
||||
|
||||
length001 = timesFive(1) * 5
|
||||
sketch001 = startSketchOn('XZ')
|
||||
|> startProfileAt([20, 10], %)
|
||||
|> line([10, 10], %)
|
||||
|> line(end = [10, 10])
|
||||
|> angledLine([-45, length001], %)
|
||||
|> lineTo([profileStartX(%), profileStartY(%)], %)
|
||||
|> close(%)
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
revolve001 = revolve({ axis = "X" }, sketch001)
|
||||
triangle()
|
||||
|> extrude(30, %)
|
||||
|> extrude(length = 30)
|
||||
plane001 = offsetPlane('XY', 10)
|
||||
sketch002 = startSketchOn(plane001)
|
||||
|> startProfileAt([-20, 0], %)
|
||||
|> line([5, -15], %)
|
||||
|> line(end = [5, -15])
|
||||
|> xLine(-10, %)
|
||||
|> lineTo([-40, 0], %)
|
||||
|> lineTo([profileStartX(%), profileStartY(%)], %)
|
||||
|> close(%)
|
||||
extrude001 = extrude(10, sketch002)
|
||||
|> line(endAbsolute = [-40, 0])
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
extrude001 = extrude(sketch002, length = 10)
|
||||
`
|
||||
|
||||
test.describe('Feature Tree pane', () => {
|
||||
@ -97,7 +97,7 @@ test.describe('Feature Tree pane', () => {
|
||||
await testViewSource({
|
||||
operationName: 'Extrude',
|
||||
operationIndex: 1,
|
||||
expectedActiveLine: 'extrude001 = extrude(10, sketch002)',
|
||||
expectedActiveLine: 'extrude001 = extrude(sketch002, length = 10)',
|
||||
})
|
||||
await testViewSource({
|
||||
operationName: 'Revolve',
|
||||
|
@ -82,7 +82,7 @@ test('verify extruding circle works', async ({
|
||||
})
|
||||
await cmdBar.progressCmdBar()
|
||||
|
||||
const expectString = 'extrude001 = extrude(5, sketch001)'
|
||||
const expectString = 'extrude001 = extrude(sketch001, length = 5)'
|
||||
await editor.expectEditor.not.toContain(expectString)
|
||||
|
||||
await cmdBar.expectState({
|
||||
@ -228,8 +228,8 @@ test.describe('verify sketch on chamfer works', () => {
|
||||
segAng(rectangleSegmentA002),
|
||||
-segLen(rectangleSegmentA002)
|
||||
], %, $rectangleSegmentC001)
|
||||
|> lineTo([profileStartX(%), profileStartY(%)], %)
|
||||
|> close(%)`,
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()`,
|
||||
})
|
||||
|
||||
await sketchOnAChamfer({
|
||||
@ -259,8 +259,8 @@ test.describe('verify sketch on chamfer works', () => {
|
||||
segAng(rectangleSegmentA003),
|
||||
-segLen(rectangleSegmentA003)
|
||||
], %, $rectangleSegmentC002)
|
||||
|> lineTo([profileStartX(%), profileStartY(%)], %)
|
||||
|> close(%)`,
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()`,
|
||||
})
|
||||
await sketchOnAChamfer({
|
||||
clickCoords: { x: 677, y: 87 },
|
||||
@ -284,8 +284,8 @@ test.describe('verify sketch on chamfer works', () => {
|
||||
segAng(rectangleSegmentA003),
|
||||
-segLen(rectangleSegmentA003)
|
||||
], %, $rectangleSegmentC002)
|
||||
|> lineTo([profileStartX(%), profileStartY(%)], %)
|
||||
|> close(%)`,
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()`,
|
||||
})
|
||||
/// last one
|
||||
await sketchOnAChamfer({
|
||||
@ -308,8 +308,8 @@ test.describe('verify sketch on chamfer works', () => {
|
||||
segAng(rectangleSegmentA005),
|
||||
-segLen(rectangleSegmentA005)
|
||||
], %, $rectangleSegmentC004)
|
||||
|> lineTo([profileStartX(%), profileStartY(%)], %)
|
||||
|> close(%)`,
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()`,
|
||||
})
|
||||
|
||||
await test.step('verify at the end of the test that final code is what is expected', async () => {
|
||||
@ -326,9 +326,9 @@ test.describe('verify sketch on chamfer works', () => {
|
||||
segAng(rectangleSegmentA001),
|
||||
-segLen(rectangleSegmentA001)
|
||||
], %, $yo)
|
||||
|> lineTo([profileStartX(%), profileStartY(%)], %, $seg02)
|
||||
|> close(%)
|
||||
extrude001 = extrude(100, sketch001)
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)], tag = $seg02)
|
||||
|> close()
|
||||
extrude001 = extrude(sketch001, length = 100)
|
||||
|> chamfer({
|
||||
length = 30,
|
||||
tags = [getOppositeEdge(seg01)]
|
||||
@ -353,8 +353,8 @@ test.describe('verify sketch on chamfer works', () => {
|
||||
segAng(rectangleSegmentA005),
|
||||
-segLen(rectangleSegmentA005)
|
||||
], %, $rectangleSegmentC004)
|
||||
|> lineTo([profileStartX(%), profileStartY(%)], %)
|
||||
|> close(%)
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
sketch004 = startSketchOn(extrude001, seg05)
|
||||
|> startProfileAt([82.57,322.96], %)
|
||||
|> angledLine([0, 11.16], %, $rectangleSegmentA004)
|
||||
@ -366,8 +366,8 @@ test.describe('verify sketch on chamfer works', () => {
|
||||
segAng(rectangleSegmentA004),
|
||||
-segLen(rectangleSegmentA004)
|
||||
], %, $rectangleSegmentC003)
|
||||
|> lineTo([profileStartX(%), profileStartY(%)], %)
|
||||
|> close(%)
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
sketch003 = startSketchOn(extrude001, seg04)
|
||||
|> startProfileAt([-209.64,255.28], %)
|
||||
|> angledLine([0, 11.56], %, $rectangleSegmentA003)
|
||||
@ -379,8 +379,8 @@ test.describe('verify sketch on chamfer works', () => {
|
||||
segAng(rectangleSegmentA003),
|
||||
-segLen(rectangleSegmentA003)
|
||||
], %, $rectangleSegmentC002)
|
||||
|> lineTo([profileStartX(%), profileStartY(%)], %)
|
||||
|> close(%)
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
sketch002 = startSketchOn(extrude001, seg03)
|
||||
|> startProfileAt([205.96,254.59], %)
|
||||
|> angledLine([0, 11.39], %, $rectangleSegmentA002)
|
||||
@ -392,8 +392,8 @@ test.describe('verify sketch on chamfer works', () => {
|
||||
segAng(rectangleSegmentA002),
|
||||
-segLen(rectangleSegmentA002)
|
||||
], %, $rectangleSegmentC001)
|
||||
|> lineTo([profileStartX(%), profileStartY(%)], %)
|
||||
|> close(%)
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
`,
|
||||
{ shouldNormalise: true }
|
||||
)
|
||||
@ -447,8 +447,8 @@ test.describe('verify sketch on chamfer works', () => {
|
||||
segAng(rectangleSegmentA002),
|
||||
-segLen(rectangleSegmentA002)
|
||||
], %, $rectangleSegmentC001)
|
||||
|> lineTo([profileStartX(%), profileStartY(%)], %)
|
||||
|> close(%)`,
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()`,
|
||||
})
|
||||
await editor.expectEditor.toContain(
|
||||
`sketch001 = startSketchOn('XZ')
|
||||
@ -462,9 +462,9 @@ test.describe('verify sketch on chamfer works', () => {
|
||||
segAng(rectangleSegmentA001),
|
||||
-segLen(rectangleSegmentA001)
|
||||
], %, $yo)
|
||||
|> lineTo([profileStartX(%), profileStartY(%)], %, $seg02)
|
||||
|> close(%)
|
||||
extrude001 = extrude(100, sketch001)
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)], tag = $seg02)
|
||||
|> close()
|
||||
extrude001 = extrude(sketch001, length = 100)
|
||||
chamf = chamfer({
|
||||
length = 30,
|
||||
tags = [getOppositeEdge(seg01)]
|
||||
@ -488,8 +488,8 @@ sketch002 = startSketchOn(extrude001, seg03)
|
||||
segAng(rectangleSegmentA002),
|
||||
-segLen(rectangleSegmentA002)
|
||||
], %, $rectangleSegmentC001)
|
||||
|> lineTo([profileStartX(%), profileStartY(%)], %)
|
||||
|> close(%)
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
`,
|
||||
{ shouldNormalise: true }
|
||||
)
|
||||
@ -615,7 +615,7 @@ test(`Verify user can double-click to edit a sketch`, async ({
|
||||
|> circle({ center = [8, 5], radius = 2 }, %)
|
||||
openSketch = startSketchOn('XY')
|
||||
|> startProfileAt([-5, 0], %)
|
||||
|> lineTo([0, 5], %)
|
||||
|> line(endAbsolute = [0, 5])
|
||||
|> xLine(5, %)
|
||||
|> tangentialArcTo([10, 0], %)
|
||||
`
|
||||
@ -1030,7 +1030,7 @@ test(`Sweep point-and-click failing validation`, async ({
|
||||
sketch002 = startSketchOn('XZ')
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> xLine(-500, %)
|
||||
|> lineTo([-2000, 500], %)
|
||||
|> line(endAbsolute = [-2000, 500])
|
||||
`
|
||||
await context.addInitScript((initialCode) => {
|
||||
localStorage.setItem('persistCode', initialCode)
|
||||
@ -1095,12 +1095,12 @@ test(`Fillet point-and-click`, async ({
|
||||
// Code samples
|
||||
const initialCode = `sketch001 = startSketchOn('XY')
|
||||
|> startProfileAt([-12, -6], %)
|
||||
|> line([0, 12], %)
|
||||
|> line([24, 0], %)
|
||||
|> line([0, -12], %)
|
||||
|> lineTo([profileStartX(%), profileStartY(%)], %)
|
||||
|> close(%)
|
||||
extrude001 = extrude(-12, sketch001)
|
||||
|> line(end = [0, 12])
|
||||
|> line(end = [24, 0])
|
||||
|> line(end = [0, -12])
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
extrude001 = extrude(sketch001, length = -12)
|
||||
`
|
||||
const firstFilletDeclaration = 'fillet({ radius = 5, tags = [seg01] }, %)'
|
||||
const secondFilletDeclaration =
|
||||
@ -1327,12 +1327,12 @@ test(`Fillet point-and-click delete`, async ({
|
||||
// Code samples
|
||||
const initialCode = `sketch001 = startSketchOn('XY')
|
||||
|> startProfileAt([-12, -6], %)
|
||||
|> line([0, 12], %)
|
||||
|> line([24, 0], %, $seg02)
|
||||
|> line([0, -12], %)
|
||||
|> lineTo([profileStartX(%), profileStartY(%)], %, $seg01)
|
||||
|> close(%)
|
||||
extrude001 = extrude(-12, sketch001)
|
||||
|> line(end = [0, 12])
|
||||
|> line(end = [24, 0], tag = $seg02)
|
||||
|> line(end = [0, -12])
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)], tag = $seg01)
|
||||
|> close()
|
||||
extrude001 = extrude(sketch001, length = -12)
|
||||
|> fillet({ radius = 5, tags = [seg01] }, %) // fillet01
|
||||
|> fillet({ radius = 5, tags = [seg02] }, %) // fillet02
|
||||
fillet03 = fillet({ radius = 5, tags = [getOppositeEdge(seg01)]}, extrude001)
|
||||
@ -1471,12 +1471,12 @@ test(`Chamfer point-and-click`, async ({
|
||||
// Code samples
|
||||
const initialCode = `sketch001 = startSketchOn('XY')
|
||||
|> startProfileAt([-12, -6], %)
|
||||
|> line([0, 12], %)
|
||||
|> line([24, 0], %)
|
||||
|> line([0, -12], %)
|
||||
|> lineTo([profileStartX(%), profileStartY(%)], %)
|
||||
|> close(%)
|
||||
extrude001 = extrude(-12, sketch001)
|
||||
|> line(end = [0, 12])
|
||||
|> line(end = [24, 0])
|
||||
|> line(end = [0, -12])
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
extrude001 = extrude(sketch001, length = -12)
|
||||
`
|
||||
const firstChamferDeclaration = 'chamfer({ length = 5, tags = [seg01] }, %)'
|
||||
const secondChamferDeclaration =
|
||||
@ -1699,12 +1699,12 @@ test(`Chamfer point-and-click delete`, async ({
|
||||
// Code samples
|
||||
const initialCode = `sketch001 = startSketchOn('XY')
|
||||
|> startProfileAt([-12, -6], %)
|
||||
|> line([0, 12], %)
|
||||
|> line([24, 0], %, $seg02)
|
||||
|> line([0, -12], %)
|
||||
|> lineTo([profileStartX(%), profileStartY(%)], %, $seg01)
|
||||
|> close(%)
|
||||
extrude001 = extrude(-12, sketch001)
|
||||
|> line(end = [0, 12])
|
||||
|> line(end = [24, 0], tag = $seg02)
|
||||
|> line(end = [0, -12])
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)], tag = $seg01)
|
||||
|> close()
|
||||
extrude001 = extrude(sketch001, length = -12)
|
||||
|> chamfer({ length = 5, tags = [seg01] }, %) // chamfer01
|
||||
|> chamfer({ length = 5, tags = [seg02] }, %) // chamfer02
|
||||
chamfer03 = chamfer({ length = 5, tags = [getOppositeEdge(seg01)]}, extrude001)
|
||||
@ -1849,7 +1849,7 @@ shellPointAndClickCapCases.forEach(({ shouldPreselect }) => {
|
||||
test.skip(process.platform === 'win32', 'Skip on windows')
|
||||
const initialCode = `sketch001 = startSketchOn('XZ')
|
||||
|> circle({ center = [0, 0], radius = 30 }, %)
|
||||
extrude001 = extrude(30, sketch001)
|
||||
extrude001 = extrude(sketch001, length = 30)
|
||||
`
|
||||
await context.addInitScript((initialCode) => {
|
||||
localStorage.setItem('persistCode', initialCode)
|
||||
@ -1945,9 +1945,9 @@ test('Shell point-and-click wall', async ({
|
||||
|> xLine(40, %)
|
||||
|> yLine(-60, %)
|
||||
|> xLine(-40, %)
|
||||
|> lineTo([profileStartX(%), profileStartY(%)], %)
|
||||
|> close(%)
|
||||
extrude001 = extrude(40, sketch001)
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
extrude001 = extrude(sketch001, length = 40)
|
||||
`
|
||||
await context.addInitScript((initialCode) => {
|
||||
localStorage.setItem('persistCode', initialCode)
|
||||
@ -2023,19 +2023,19 @@ extrude001 = extrude(40, sketch001)
|
||||
const shellSketchOnFacesCases = [
|
||||
`sketch001 = startSketchOn('XZ')
|
||||
|> circle({ center = [0, 0], radius = 100 }, %)
|
||||
|> extrude(100, %)
|
||||
|> extrude(length = 100)
|
||||
|
||||
sketch002 = startSketchOn(sketch001, 'END')
|
||||
|> circle({ center = [0, 0], radius = 50 }, %)
|
||||
|> extrude(50, %)
|
||||
|> extrude(length = 50)
|
||||
`,
|
||||
`sketch001 = startSketchOn('XZ')
|
||||
|> circle({ center = [0, 0], radius = 100 }, %)
|
||||
extrude001 = extrude(100, sketch001)
|
||||
extrude001 = extrude(sketch001, length = 100)
|
||||
|
||||
sketch002 = startSketchOn(extrude001, 'END')
|
||||
|> circle({ center = [0, 0], radius = 50 }, %)
|
||||
extrude002 = extrude(50, sketch002)
|
||||
extrude002 = extrude(sketch002, length = 50)
|
||||
`,
|
||||
]
|
||||
shellSketchOnFacesCases.forEach((initialCode, index) => {
|
||||
@ -2189,9 +2189,9 @@ sketch001 = startSketchOn('XZ')
|
||||
segAng(rectangleSegmentA001),
|
||||
-segLen(rectangleSegmentA001)
|
||||
], %, $rectangleSegmentC001)
|
||||
|> lineTo([profileStartX(%), profileStartY(%)], %)
|
||||
|> close(%)
|
||||
extrude001 = extrude(200, sketch001)
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
extrude001 = extrude(sketch001, length = 200)
|
||||
sketch002 = startSketchOn(extrude001, rectangleSegmentA001)
|
||||
|> startProfileAt([-66.77, 84.81], %)
|
||||
|> angledLine([180, 27.08], %, $rectangleSegmentA002)
|
||||
@ -2203,8 +2203,8 @@ segAng(rectangleSegmentA002) - 90,
|
||||
segAng(rectangleSegmentA002),
|
||||
-segLen(rectangleSegmentA002)
|
||||
], %, $rectangleSegmentC002)
|
||||
|> lineTo([profileStartX(%), profileStartY(%)], %)
|
||||
|> close(%)
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
`
|
||||
|
||||
await context.addInitScript((initialCode) => {
|
||||
@ -2248,9 +2248,9 @@ segAng(rectangleSegmentA001) - 90,
|
||||
segAng(rectangleSegmentA001),
|
||||
-segLen(rectangleSegmentA001)
|
||||
], %, $rectangleSegmentC001)
|
||||
|> lineTo([profileStartX(%), profileStartY(%)], %)
|
||||
|> close(%)
|
||||
extrude001 = extrude(50, sketch001)
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
extrude001 = extrude(sketch001, length = 50)
|
||||
sketch002 = startSketchOn(extrude001, rectangleSegmentA001)
|
||||
|> circle({
|
||||
center = [-11.34, 10.0],
|
||||
@ -2298,9 +2298,9 @@ radius = 8.69
|
||||
segAng(rectangleSegmentA001),
|
||||
-segLen(rectangleSegmentA001)
|
||||
], %, $rectangleSegmentC001)
|
||||
|> lineTo([profileStartX(%), profileStartY(%)], %)
|
||||
|> close(%)
|
||||
extrude001 = extrude(5, sketch001)
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
extrude001 = extrude(sketch001, length = 5)
|
||||
sketch003 = startSketchOn(extrude001, 'START')
|
||||
|> circle({
|
||||
center = [-0.69, 0.56],
|
||||
|
@ -1461,12 +1461,12 @@ test.fixme(
|
||||
|
||||
await page.locator('.cm-content').fill(`sketch001 = startSketchOn('XZ')
|
||||
|> startProfileAt([-87.4, 282.92], %)
|
||||
|> line([324.07, 27.199], %, $seg01)
|
||||
|> line([118.328, -291.754], %)
|
||||
|> line([-180.04, -202.08], %)
|
||||
|> lineTo([profileStartX(%), profileStartY(%)], %)
|
||||
|> close(%)
|
||||
extrude001 = extrude(200, sketch001)`)
|
||||
|> line(end = [324.07, 27.199], tag = $seg01)
|
||||
|> line(end = [118.328, -291.754])
|
||||
|> line(end = [-180.04, -202.08])
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
extrude001 = extrude(sketch001, length = 200)`)
|
||||
await page.waitForTimeout(800)
|
||||
|
||||
async function getCameraZValue() {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user