Compare commits

..

13 Commits

Author SHA1 Message Date
3e08a4fa60 Fix test
Combination of two issues:
 - Test was wrong
 - Library code for removing constraints from sketch lines was wrong,
   was not properly recognizing when kw calls were absolute or relative
   because they only considered the function name, not its parameters
   (and parameters like 'length' or 'endAbsolute' determine if a call
   is actually relative/absolute, not just the function name)
2025-02-27 12:53:50 -06:00
e54ba22cd4 More places need to know how to tell if a call is absolute, and map it to a tooltip if so 2025-02-26 22:40:29 -06:00
f948be474a Update tests that still use positional data
Cases where the application/library code was correct, but the test code
was wrong.
2025-02-26 22:40:29 -06:00
83008f85af Update switch of all kwarg sketch fns to understand x/yLine 2025-02-26 15:08:50 -06:00
b501fab80c Update KCL samples branch 2025-02-25 19:35:10 -06:00
b509c86559 Update codemod for yLine 2025-02-25 18:42:02 -06:00
5b48c42827 Update tests 2025-02-25 16:17:05 -06:00
aa6dd18f93 Redo docs 2025-02-25 15:48:28 -06:00
49d6e079ff Update KCL snippets 2025-02-25 15:44:56 -06:00
1b5f8ecdc2 Update codemods now that xLine/To is kwarg 2025-02-25 15:44:56 -06:00
64c636fcc0 Fix parsing test 2025-02-25 15:44:55 -06:00
97af37bb33 Redo docs 2025-02-25 15:44:55 -06:00
a3540833cf Rust only: migrate xLine/xLineTo to kwargs 2025-02-25 15:44:55 -06:00
102 changed files with 11288 additions and 14639 deletions

2
.gitignore vendored
View File

@ -24,7 +24,7 @@ yarn-debug.log*
yarn-error.log*
.idea
# .vscode
.vscode
.helix
src/wasm-lib/.idea
src/wasm-lib/.vscode

View File

@ -1,5 +0,0 @@
{
"rust-analyzer.linkedProjects": [
"src/wasm-lib/Cargo.toml"
]
}

View File

@ -36,7 +36,7 @@ sketch001 = startSketchOn('XZ')
angle = angleToMatchLengthY(seg01, 15, %),
length = 5
}, %)
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
extrusion = extrude(sketch001, length = 5)

View File

@ -31,10 +31,10 @@ angledLine(data: AngledLineData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
```js
exampleSketch = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> yLineTo(15, %)
|> yLine(endAbsolute = 15)
|> angledLine({ angle = 30, length = 15 }, %)
|> line(end = [8, -10])
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
example = extrude(exampleSketch, length = 10)

File diff suppressed because one or more lines are too long

View File

@ -37,7 +37,7 @@ sketch001 = startSketchOn('XZ')
angle = toDegrees(asin(0.5)),
length = 20
}, %)
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
extrude001 = extrude(sketch001, length = 5)

View File

@ -37,7 +37,7 @@ sketch001 = startSketchOn('XZ')
angle = toDegrees(atan(1.25)),
length = 20
}, %)
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
extrude001 = extrude(sketch001, length = 5)

View File

@ -38,7 +38,7 @@ sketch001 = startSketchOn('XZ')
angle = toDegrees(atan2(1.25, 2)),
length = 20
}, %)
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
extrude001 = extrude(sketch001, length = 5)

View File

@ -35,7 +35,7 @@ sketch001 = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> line(endAbsolute = [12, 10])
|> line(end = [ceil(7.02986), 0])
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
extrude001 = extrude(sketch001, length = 5)

View File

@ -21,7 +21,7 @@ exampleSketch = startSketchOn("XZ")
angle = 30,
length = 2 * E ^ 2,
}, %)
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
example = extrude(exampleSketch, length = 10)

View File

@ -21,7 +21,7 @@ exampleSketch = startSketchOn("XZ")
angle = 50,
length = 10 * TAU,
}, %)
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
example = extrude(exampleSketch, length = 5)

View File

@ -31,7 +31,7 @@ e() -> number
exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %)
|> angledLine({ angle = 30, length = 2 * e() ^ 2 }, %)
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
example = extrude(exampleSketch, length = 10)

View File

@ -35,7 +35,7 @@ sketch001 = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> line(endAbsolute = [12, 10])
|> line(end = [floor(7.02986), 0])
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
extrude001 = extrude(sketch001, length = 5)

View File

@ -111,9 +111,7 @@ layout: manual
* [`toDegrees`](kcl/toDegrees)
* [`toRadians`](kcl/toRadians)
* [`xLine`](kcl/xLine)
* [`xLineTo`](kcl/xLineTo)
* [`yLine`](kcl/yLine)
* [`yLineTo`](kcl/yLineTo)
* [`yd`](kcl/yd)
* **`std::math`**
* [`E`](kcl/const_std-math-E)

View File

@ -35,7 +35,7 @@ pow(num: number, pow: number) -> number
exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %)
|> angledLine({ angle = 50, length = pow(5, 2) }, %)
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
example = extrude(exampleSketch, length = 5)

View File

@ -35,7 +35,7 @@ sketch001 = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> line(endAbsolute = [12, 10])
|> line(end = [round(7.02986), 0])
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
extrude001 = extrude(sketch001, length = 5)

View File

@ -34,7 +34,7 @@ sqrt(num: number) -> number
exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %)
|> angledLine({ angle = 50, length = sqrt(2500) }, %)
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
example = extrude(exampleSketch, length = 5)

View File

@ -134,9 +134,9 @@ a1 = startSketchOn({
})
|> startProfileAt([0, 0], %)
|> line(end = [100.0, 0])
|> yLine(-100.0, %)
|> xLine(-100.0, %)
|> yLine(100.0, %)
|> yLine(length = -100.0)
|> xLine(length = -100.0)
|> yLine(length = 100.0)
|> close()
|> extrude(length = 3.14)
```

View File

@ -33,7 +33,7 @@ exampleSketch = startSketchOn("XZ")
angle = 30,
length = 3 / cos(toRadians(30)),
}, %)
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
example = extrude(exampleSketch, length = 5)

View File

@ -33,7 +33,7 @@ exampleSketch = startSketchOn("XZ")
angle = 50,
length = 15 / sin(toDegrees(135)),
}, %)
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
example = extrude(exampleSketch, length = 5)

View File

@ -33,7 +33,7 @@ exampleSketch = startSketchOn("XZ")
angle = 50,
length = 50 * tan(1/2),
}, %)
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
example = extrude(exampleSketch, length = 5)

File diff suppressed because it is too large Load Diff

View File

@ -31,7 +31,7 @@ tau() -> number
exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %)
|> angledLine({ angle = 50, length = 10 * tau() }, %)
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
example = extrude(exampleSketch, length = 5)

View File

@ -37,7 +37,7 @@ exampleSketch = startSketchOn("XZ")
angle = 50,
length = 70 * cos(toDegrees(pi() / 4))
}, %)
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
example = extrude(exampleSketch, length = 5)

View File

@ -37,7 +37,7 @@ exampleSketch = startSketchOn("XZ")
angle = 50,
length = 70 * cos(toRadians(45))
}, %)
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
example = extrude(exampleSketch, length = 5)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -65,7 +65,7 @@ async function doBasicSketch(
if (openPanes.includes('code')) {
await expect(u.codeLocator)
.toHaveText(`sketch001 = startSketchOn('XZ')profile001 = startProfileAt(${commonPoints.startAt}, sketch001)
|> xLine(${commonPoints.num1}, %)`)
|> xLine(length = ${commonPoints.num1})`)
}
await page.waitForTimeout(500)
await page.mouse.click(startXPx + PUR * 20, 500 - PUR * 20)
@ -74,8 +74,8 @@ async function doBasicSketch(
.toHaveText(`sketch001 = startSketchOn('XZ')profile001 = startProfileAt(${
commonPoints.startAt
}, sketch001)
|> xLine(${commonPoints.num1}, %)
|> yLine(${commonPoints.num1 + 0.01}, %)`)
|> xLine(length = ${commonPoints.num1})
|> yLine(length = ${commonPoints.num1 + 0.01})`)
} else {
await page.waitForTimeout(500)
}
@ -86,9 +86,9 @@ async function doBasicSketch(
.toHaveText(`sketch001 = startSketchOn('XZ')profile001 = startProfileAt(${
commonPoints.startAt
}, sketch001)
|> xLine(${commonPoints.num1}, %)
|> yLine(${commonPoints.num1 + 0.01}, %)
|> xLine(${commonPoints.num2 * -1}, %)`)
|> xLine(length = ${commonPoints.num1})
|> yLine(length = ${commonPoints.num1 + 0.01})
|> xLine(length = ${commonPoints.num2 * -1})`)
}
// deselect line tool
@ -146,9 +146,9 @@ async function doBasicSketch(
.toHaveText(`sketch001 = startSketchOn('XZ')profile001 = startProfileAt(${
commonPoints.startAt
}, sketch001)
|> xLine(${commonPoints.num1}, %, $seg01)
|> yLine(${commonPoints.num1 + 0.01}, %)
|> xLine(-segLen(seg01), %)`)
|> xLine(length = ${commonPoints.num1}, tag = $seg01)
|> yLine(length = ${commonPoints.num1 + 0.01})
|> xLine(length = -segLen(seg01))`)
}
test.describe('Basic sketch', { tag: ['@skipWin'] }, () => {

View File

@ -16,7 +16,7 @@ test.describe('Command bar tests', { tag: ['@skipWin'] }, () => {
|> startProfileAt([-10, -10], %)
|> line(end = [20, 0])
|> line(end = [0, 20])
|> xLine(-20, %)
|> xLine(length = -20)
|> close()
`
)

View File

@ -817,7 +817,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XZ')
|> startProfileAt([3.14, 12], %)
|> xLine(5, %) // lin`)
|> xLine(length = 5) // lin`)
// expect there to be no KCL errors
await expect(page.locator('.cm-lint-marker-error')).toHaveCount(0)
@ -890,7 +890,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XZ')
|> startProfileAt([3.14, 12], %)
|> xLine(5, %) // lin`)
|> xLine(length = 5) // lin`)
})
})
test('Can undo a click and point extrude with ctrl+z', async ({

View File

@ -8,7 +8,7 @@ const FEATURE_TREE_EXAMPLE_CODE = `export fn timesFive(x) {
export fn triangle() {
return startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> xLine(10, %)
|> xLine(length = 10)
|> line(end = [-10, -5])
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
@ -28,7 +28,7 @@ plane001 = offsetPlane('XY', offset = 10)
sketch002 = startSketchOn(plane001)
|> startProfileAt([-20, 0], %)
|> line(end = [5, -15])
|> xLine(-10, %)
|> xLine(length = -10)
|> line(endAbsolute = [-40, 0])
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()

View File

@ -101,8 +101,7 @@ export class AuthenticatedTronApp {
// running against electron applications.
// The timeline is still broken but failure screenshots work again.
this.context = context
// TODO: try to get this to work again for screenshots, but it messed with test ends when enabled
// Object.assign(this.browserContext, this.context)
Object.assign(this.browserContext, this.context)
this.electronApp = electronApp
this.dir = dir

View File

@ -524,7 +524,7 @@ profile001 = startProfileAt([205.96, 254.59], sketch002)
const expectedCodeSnippets = {
sketchOnXzPlane: `sketch001 = startSketchOn('XZ')`,
pointAtOrigin: `startProfileAt([${originSloppy.kcl[0]}, ${originSloppy.kcl[1]}], sketch001)`,
segmentOnXAxis: `xLine(${xAxisSloppy.kcl[0]}, %)`,
segmentOnXAxis: `xLine(length = ${xAxisSloppy.kcl[0]})`,
afterSegmentDraggedOffYAxis: `startProfileAt([${offYAxis.kcl[0]}, ${offYAxis.kcl[1]}], sketch001)`,
afterSegmentDraggedOnYAxis: `startProfileAt([${yAxisSloppy.kcl[0]}, ${yAxisSloppy.kcl[1]}], sketch001)`,
}
@ -585,7 +585,7 @@ profile001 = startProfileAt([205.96, 254.59], sketch002)
openSketch = startSketchOn('XY')
|> startProfileAt([-5, 0], %)
|> line(endAbsolute = [0, 5])
|> xLine(5, %)
|> xLine(length = 5)
|> tangentialArcTo([10, 0], %)
`
const viewPortSize = { width: 1000, height: 500 }
@ -1350,7 +1350,7 @@ loft001 = loft([sketch001, sketch002])
}, %)
sketch002 = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> xLine(-500, %)
|> xLine(length = -500)
|> tangentialArcTo([-2000, 500], %)
`
await context.addInitScript((initialCode) => {
@ -1444,7 +1444,7 @@ sketch002 = startSketchOn('XZ')
}, %)
sketch002 = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> xLine(-500, %)
|> xLine(length = -500)
|> line(endAbsolute = [-2000, 500])
`
await context.addInitScript((initialCode) => {
@ -2365,9 +2365,9 @@ chamfer04 = chamfer(extrude001, length = 5, tags = [getOppositeEdge(seg02)])
}) => {
const initialCode = `sketch001 = startSketchOn('XY')
|> startProfileAt([-20, 20], %)
|> xLine(40, %)
|> yLine(-60, %)
|> xLine(-40, %)
|> xLine(length = 40)
|> yLine(length = -60)
|> xLine(length = -40)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
extrude001 = extrude(sketch001, length = 40)
@ -2383,7 +2383,7 @@ extrude001 = extrude(sketch001, length = 40)
const testPoint = { x: 580, y: 180 }
const [clickOnCap] = scene.makeMouseHelpers(testPoint.x, testPoint.y)
const [clickOnWall] = scene.makeMouseHelpers(testPoint.x, testPoint.y + 70)
const mutatedCode = 'xLine(-40, %, $seg01)'
const mutatedCode = 'xLine(length = -40, tag = $seg01)'
const shellDeclaration =
"shell001 = shell(extrude001, faces = ['end', seg01], thickness = 5)"
@ -2549,9 +2549,9 @@ extrude002 = extrude(sketch002, length = 50)
}) => {
const sketchCode = `sketch001 = startSketchOn('XY')
profile001 = startProfileAt([-20, 20], sketch001)
|> xLine(40, %)
|> yLine(-60, %)
|> xLine(-40, %)
|> xLine(length = 40)
|> yLine(length = -60)
|> xLine(length = -40)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
`
@ -2637,7 +2637,7 @@ profile001 = startProfileAt([-20, 20], sketch001)
}, %)
sketch002 = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> xLine(-2000, %)
|> xLine(length = -2000)
sweep001 = sweep(sketch001, path = sketch002)
`
await context.addInitScript((initialCode) => {
@ -2798,7 +2798,7 @@ radius = 8.69
const initialCode = `
sketch002 = startSketchOn('XY')
|> startProfileAt([-2.02, 1.79], %)
|> xLine(2.6, %)
|> xLine(length = 2.6)
sketch001 = startSketchOn('-XY')
|> startProfileAt([-0.48, 1.25], %)
|> angledLine([0, 2.38], %, $rectangleSegmentA001)
@ -2830,7 +2830,7 @@ radius = 8.69
await page.getByText(codeToSelecton).click()
await toolbar.revolveButton.click()
await page.getByText('Edge', { exact: true }).click()
const lineCodeToSelection = `|> xLine(2.6, %)`
const lineCodeToSelection = `|> xLine(length = 2.6)`
await page.getByText(lineCodeToSelection).click()
await cmdBar.progressCmdBar()

View File

@ -13,9 +13,9 @@ profile001 = startProfileAt([57.81, 250.51], sketch001)
extrude001 = extrude(profile001, length = 200)
sketch002 = startSketchOn('XZ')
|> startProfileAt([-73.64, -42.89], %)
|> xLine(173.71, %)
|> xLine(length = 173.71)
|> line(end = [-22.12, -94.4])
|> xLine(-156.98, %)
|> xLine(length = -156.98)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
extrude002 = extrude(sketch002, length = 50)

View File

@ -248,7 +248,7 @@ extrude001 = extrude(sketch001, length = 50)
`exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %)
|> angledLine({ angle: 50, length: 45 }, %)
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
|>
@ -304,7 +304,7 @@ extrude001 = extrude(sketch001, length = 50)
.toContainText(`exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %)
|> angledLine({ angle: 50, length: 45 }, %)
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
thing: "blah"`)

View File

@ -48,26 +48,26 @@ test.describe('Sketch tests', { tag: ['@skipWin'] }, () => {
part001 = startSketchOn('XY')
${startProfileAt2}
|> xLine(width * .5, %)
|> yLine(height, %)
|> xLine(-width * .5, %)
|> xLine(length = width * .5)
|> yLine(length = height)
|> xLine(length = -width * .5)
|> close()
|> hole(screwHole, %)
|> extrude(length = thickness)
part002 = startSketchOn('-XZ')
${startProfileAt3}
|> xLine(width / 4, %)
|> xLine(length = width / 4)
|> tangentialArcTo([width / 2, 0], %)
|> xLine(-width / 4 + wireRadius, %)
|> yLine(wireOffset, %)
|> xLine(length = -width / 4 + wireRadius)
|> yLine(length = wireOffset)
|> arc({
radius = wireRadius,
angleStart = 0,
angleEnd = 180
}, %)
|> yLine(-wireOffset, %)
|> xLine(-width / 4, %)
|> yLine(length = -wireOffset)
|> xLine(length = -width / 4)
|> close()
|> extrude(length = -height)
`
@ -111,7 +111,7 @@ test.describe('Sketch tests', { tag: ['@skipWin'] }, () => {
'persistCode',
`sketch001 = startSketchOn('XZ')
|> startProfileAt([2.61, -4.01], %)
|> xLine(8.73, %)
|> xLine(length = 8.73)
|> tangentialArcTo([8.33, -1.31], %)`
)
})
@ -157,7 +157,7 @@ test.describe('Sketch tests', { tag: ['@skipWin'] }, () => {
await expect.poll(u.normalisedEditorCode, { timeout: 1000 })
.toBe(`sketch002 = startSketchOn('XZ')
sketch001 = startProfileAt([12.34, -12.34], sketch002)
|> yLine(12.34, %)
|> yLine(length = 12.34)
`)
}).toPass({ timeout: 5_000, intervals: [1_000] })
@ -693,15 +693,15 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
await click00r(50, 0)
await page.waitForTimeout(100)
codeStr += ` |> xLine(${toU(50, 0)[0]}, %)`
codeStr += ` |> xLine(length = ${toU(50, 0)[0]})`
await expect(u.codeLocator).toHaveText(codeStr)
await click00r(0, 50)
codeStr += ` |> yLine(${toU(0, 50)[1]}, %)`
codeStr += ` |> yLine(length = ${toU(0, 50)[1]})`
await expect(u.codeLocator).toHaveText(codeStr)
await click00r(-50, 0)
codeStr += ` |> xLine(${toU(-50, 0)[0]}, %)`
codeStr += ` |> xLine(length = ${toU(-50, 0)[0]})`
await expect(u.codeLocator).toHaveText(codeStr)
// exit the sketch, reset relative clicker
@ -730,15 +730,15 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
// TODO: I couldn't use `toSU` here because of some rounding error causing
// it to be off by 0.01
await click00r(30, 0)
codeStr += ` |> xLine(2.04, %)`
codeStr += ` |> xLine(length = 2.04)`
await expect(u.codeLocator).toHaveText(codeStr)
await click00r(0, 30)
codeStr += ` |> yLine(-2.03, %)`
codeStr += ` |> yLine(length = -2.03)`
await expect(u.codeLocator).toHaveText(codeStr)
await click00r(-30, 0)
codeStr += ` |> xLine(-2.04, %)`
codeStr += ` |> xLine(length = -2.04)`
await expect(u.codeLocator).toHaveText(codeStr)
await click00r(undefined, undefined)
@ -763,8 +763,8 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
profile001 = startProfileAt([${roundOff(scale * 69.6)}, ${roundOff(
scale * 34.8
)}], sketch001)
|> xLine(${roundOff(scale * 139.19)}, %)
|> yLine(-${roundOff(scale * 139.2)}, %)
|> xLine(length = ${roundOff(scale * 139.19)})
|> yLine(length = -${roundOff(scale * 139.2)})
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()`
@ -1020,7 +1020,7 @@ profile001 = startProfileAt([${roundOff(scale * 69.6)}, ${roundOff(
|> startProfileAt([-10, -10], %)
|> line(end = [20, 0])
|> line(end = [0, 20])
|> xLine(-20, %)
|> xLine(length = -20)
`)
await u.expectCmdLog('[data-message-type="execution-done"]')
@ -1096,8 +1096,8 @@ profile001 = startProfileAt([${roundOff(scale * 69.6)}, ${roundOff(
lugSketch = startSketchOn(plane)
|> startProfileAt([origin[0] + lugDiameter / 2, origin[1]], %)
|> angledLineOfYLength({ angle = 60, length = lugHeadLength }, %)
|> xLineTo(0 + .001, %)
|> yLineTo(0, %)
|> xLine(endAbsolute = 0 + .001)
|> yLine(endAbsolute = 0)
|> close()
|> revolve({ axis = "Y" }, %)
@ -1370,7 +1370,7 @@ profile001 = startProfileAt([121.52, 168.25], sketch001)
|> close()
profile002 = startProfileAt([117.2, 56.08], sketch001)
|> line(end = [166.82, 25.89])
|> yLine(-107.86, %)
|> yLine(length = -107.86)
`
)
@ -1456,9 +1456,9 @@ profile002 = startProfileAt([117.2, 56.08], sketch001)
'persistCode',
`sketch001 = startSketchOn('XZ')
profile002 = startProfileAt([40.68, 87.67], sketch001)
|> xLine(239.17, %)
|> xLine(length = 239.17)
profile003 = startProfileAt([206.63, -56.73], sketch001)
|> xLine(-156.32, %)
|> xLine(length = -156.32)
`
)
})
@ -2316,7 +2316,7 @@ profile003 = startProfileAt([3.19, 13.3], sketch002)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
profile004 = startProfileAt([3.15, 9.39], sketch002)
|> xLine(6.92, %)
|> xLine(length = 6.92)
|> line(end = [-7.41, -2.85])
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
@ -2552,7 +2552,7 @@ profile001 = startProfileAt([34, 42.66], sketch001)
plane001 = offsetPlane('XZ', offset = 50)
sketch002 = startSketchOn(plane001)
profile002 = startProfileAt([39.43, 172.21], sketch002)
|> xLine(183.99, %)
|> xLine(length = 183.99)
|> line(end = [-77.95, -145.93])
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
@ -2605,7 +2605,7 @@ profile001 = startProfileAt([34, 42.66], sketch001)
plane001 = offsetPlane('XZ', offset = 50)
sketch002 = startSketchOn(plane001)
profile002 = startProfileAt([39.43, 172.21], sketch002)
|> xLine(183.99, %)
|> xLine(length = 183.99)
|> line(end = [-77.95, -145.93])
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()

View File

@ -71,14 +71,14 @@ armThick = 0.5
totalLen = 9.5
part001 = startSketchOn('-XZ')
|> startProfileAt([0, 0], %)
|> yLine(baseHeight, %)
|> xLine(baseLen, %)
|> yLine(length = baseHeight)
|> xLine(length = baseLen)
|> angledLineToY({
angle = topAng,
to = totalHeightHalf,
}, %, $seg04)
|> xLineTo(totalLen, %, $seg03)
|> yLine(-armThick, %, $seg01)
|> xLine(endAbsolute = totalLen, tag = $seg03)
|> yLine(length = -armThick, tag = $seg01)
|> angledLineThatIntersects({
angle = HALF_TURN,
offset = -armThick,
@ -89,15 +89,15 @@ part001 = startSketchOn('-XZ')
angle = -bottomAng,
to = -totalHeightHalf - armThick,
}, %, $seg02)
|> xLineTo(segEndX(seg03, %) + 0, %)
|> yLine(-segLen(seg01, %), %)
|> xLine(length = endAbsolute = segEndX(seg03) + 0)
|> yLine(length = -segLen(seg01, %))
|> angledLineThatIntersects({
angle = HALF_TURN,
offset = -armThick,
intersectTag = seg02
}, %)
|> angledLineToY([segAng(seg02, %) + 180, -baseHeight], %)
|> xLineTo(ZERO, %)
|> xLine(endAbsolute = ZERO)
|> close()
|> extrude(length = 4)`
)
@ -461,7 +461,7 @@ test(
await page.waitForTimeout(100)
code += `
|> xLine(7.25, %)`
|> xLine(length = 7.25)`
await expect(page.locator('.cm-content')).toHaveText(code)
await page
@ -653,7 +653,7 @@ test.describe(
await page.waitForTimeout(100)
code += `
|> xLine(7.25, %)`
|> xLine(length = 7.25)`
await expect(u.codeLocator).toHaveText(code)
await page
@ -761,7 +761,7 @@ test.describe(
await page.waitForTimeout(100)
code += `
|> xLine(184.3, %)`
|> xLine(length = 184.3)`
await expect(u.codeLocator).toHaveText(code)
await page

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB

View File

@ -79,9 +79,9 @@ export const TEST_CODE_GIZMO = `part001 = startSketchOn('XZ')
|> line(end = [7.13, 4 + 0])
|> angledLine({ angle: 3 + 0, length: 3.14 + 0 }, %)
|> line(endAbsolute = [20.14 + 0, -0.14 + 0])
|> xLineTo(29 + 0, %)
|> yLine(-3.14 + 0, %, $a)
|> xLine(1.63, %)
|> xLine(endAbsolute = 29 + 0)
|> yLine(length = -3.14 + 0, tag = $a)
|> xLine(length = 1.63)
|> angledLineOfXLength({ angle: 3 + 0, length: 3.14 }, %)
|> angledLineOfYLength({ angle: 30, length: 3 + 0 }, %)
|> angledLineToX({ angle: 22.14 + 0, to: 12 }, %)
@ -146,7 +146,7 @@ sketch001 = startSketchOn(box, revolveAxis)
sketch001 = startSketchOn('XZ')
|> startProfileAt([0.0, 0.0], %)
|> xLine(0.0, %)
|> xLine(length = 0.0)
|> close()
`

View File

@ -122,7 +122,7 @@ test.describe('Test network and connection issues', () => {
await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XZ')profile001 = startProfileAt(${commonPoints.startAt}, sketch001)
|> xLine(${commonPoints.num1}, %)`)
|> xLine(length = ${commonPoints.num1})`)
// Expect the network to be up
await expect(networkToggle).toContainText('Connected')
@ -215,7 +215,7 @@ test.describe('Test network and connection issues', () => {
await expect.poll(u.normalisedEditorCode)
.toBe(`sketch001 = startSketchOn('XZ')
profile001 = startProfileAt([12.34, -12.34], sketch001)
|> xLine(12.34, %)
|> xLine(length = 12.34)
|> line(end = [-12.34, 12.34])
`)
@ -225,9 +225,9 @@ profile001 = startProfileAt([12.34, -12.34], sketch001)
await expect.poll(u.normalisedEditorCode)
.toBe(`sketch001 = startSketchOn('XZ')
profile001 = startProfileAt([12.34, -12.34], sketch001)
|> xLine(12.34, %)
|> xLine(length = 12.34)
|> line(end = [-12.34, 12.34])
|> xLine(-12.34, %)
|> xLine(length = -12.34)
`)

View File

@ -18,7 +18,7 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
|> startProfileAt([-10, -10], %)
|> line(end = [20, 0])
|> line(end = [0, 20])
|> xLine(-20, %)
|> xLine(length = -20)
`
)
})
@ -57,7 +57,7 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
.click()
await expect(page.locator('.cm-content')).toHaveText(
`length001 = 20sketch001 = startSketchOn('XY') |> startProfileAt([-10, -10], %) |> line(end = [20, 0]) |> angledLine([90, length001], %) |> xLine(-20, %)`
`length001 = 20sketch001 = startSketchOn('XY') |> startProfileAt([-10, -10], %) |> line(end = [20, 0]) |> angledLine([90, length001], %) |> xLine(length = -20)`
)
// Make sure we didn't pop out of sketch mode.
@ -89,9 +89,9 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
|> line(end = [41.19, 58.97 + 5])
part002 = startSketchOn('XZ')
|> startProfileAt([299.05, 120], %)
|> xLine(-385.34, %, $seg_what)
|> yLine(-170.06, %)
|> xLine(segLen(seg_what), %)
|> xLine(length = -385.34, tag = $seg_what)
|> yLine(length = -170.06)
|> xLine(length = segLen(seg_what))
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])`
)
})
@ -153,9 +153,9 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
|> line(end = [51.19, 48.97])
part002 = startSketchOn('XZ')
|> startProfileAt([299.05, 231.45], %)
|> xLine(-425.34, %, $seg_what)
|> yLine(-264.06, %)
|> xLine(segLen(seg_what), %)
|> xLine(length = -425.34, tag = $seg_what)
|> yLine(length = -264.06)
|> xLine(length = segLen(seg_what))
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])`
)
@ -285,9 +285,9 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
|> line(end = [51.19, 48.97])
part002 = startSketchOn('XZ')
|> startProfileAt([299.05, 231.45], %)
|> xLine(-425.34, %, $seg_what)
|> yLine(-264.06, %)
|> xLine(segLen(seg_what), %)
|> xLine(length = -425.34, tag = $seg_what)
|> yLine(length = -264.06)
|> xLine(length = segLen(seg_what))
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])`
)
})
@ -395,9 +395,9 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
|> line(end = [51.19, 48.97])
part002 = startSketchOn('XZ')
|> startProfileAt([299.05, 231.45], %)
|> xLine(-425.34, %, $seg_what)
|> yLine(-264.06, %)
|> xLine(segLen(seg_what), %)
|> xLine(length = -425.34, tag = $seg_what)
|> yLine(length = -264.06)
|> xLine(length = segLen(seg_what))
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])`
)
})
@ -508,9 +508,9 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
|> line(end = [51.19, 48.97])
part002 = startSketchOn('XZ')
|> startProfileAt([299.05, 231.45], %)
|> xLine(-425.34, %, $seg_what)
|> yLine(-264.06, %)
|> xLine(segLen(seg_what), %)
|> xLine(length = -425.34, tag = $seg_what)
|> yLine(length = -264.06)
|> xLine(length = segLen(seg_what))
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])`
)
})
@ -610,9 +610,9 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
|> line(end = [51.19, 48.97])
part002 = startSketchOn('XZ')
|> startProfileAt([299.05, 231.45], %)
|> xLine(-425.34, %, $seg_what)
|> yLine(-264.06, %)
|> xLine(segLen(seg_what), %)
|> xLine(length = -425.34, tag = $seg_what)
|> yLine(length = -264.06)
|> xLine(length = segLen(seg_what))
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])`
)
})
@ -696,9 +696,9 @@ part001 = startSketchOn('XZ')
|> line(end = [51.19, 48.97])
part002 = startSketchOn('XZ')
|> startProfileAt([299.05, 231.45], %)
|> xLine(-425.34, %, $seg_what)
|> yLine(-264.06, %)
|> xLine(segLen(seg_what), %)
|> xLine(length = -425.34, tag = $seg_what)
|> yLine(length = -264.06)
|> xLine(length = segLen(seg_what))
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])`
)
})
@ -748,16 +748,16 @@ part002 = startSketchOn('XZ')
{
constraintName: 'Vertical',
codeAfter: [
`|> yLine(130.4, %)`,
`|> yLine(77.79, %)`,
`|> yLine(48.97, %)`,
`|> yLine(length = 130.4)`,
`|> yLine(length = 77.79)`,
`|> yLine(length = 48.97)`,
],
},
{
codeAfter: [
`|> xLine(74.36, %)`,
`|> xLine(9.16, %)`,
`|> xLine(51.19, %)`,
`|> xLine(length = 74.36)`,
`|> xLine(length = 9.16)`,
`|> xLine(length = 51.19)`,
],
constraintName: 'Horizontal',
},
@ -776,9 +776,9 @@ part002 = startSketchOn('XZ')
|> line(end = [51.19, 48.97])
part002 = startSketchOn('XZ')
|> startProfileAt([299.05, 231.45], %)
|> xLine(-425.34, %, $seg_what)
|> yLine(-264.06, %)
|> xLine(segLen(seg_what), %)
|> xLine(length = -425.34, tag = $seg_what)
|> yLine(length = -264.06)
|> xLine(length = segLen(seg_what))
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])`
)
})
@ -876,9 +876,9 @@ part002 = startSketchOn('XZ')
|> line(end = [9.16, 77.79])
part002 = startSketchOn('XZ')
|> startProfileAt([299.05, 231.45], %)
|> xLine(-425.34, %, $seg_what)
|> yLine(-264.06, %)
|> xLine(segLen(seg_what), %)
|> xLine(length = -425.34, tag = $seg_what)
|> yLine(length = -264.06)
|> xLine(length = segLen(seg_what))
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])`
)
})
@ -957,9 +957,9 @@ part002 = startSketchOn('XZ')
|> line(end = [9.16, 77.79])
part002 = startSketchOn('XZ')
|> startProfileAt([299.05, 231.45], %)
|> xLine(-425.34, %, $seg_what)
|> yLine(-264.06, %)
|> xLine(segLen(seg_what), %)
|> xLine(length = -425.34, tag = $seg_what)
|> yLine(length = -264.06)
|> xLine(length = segLen(seg_what))
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])`
)
})
@ -1061,7 +1061,7 @@ part002 = startSketchOn('XZ')
await pollEditorLinesSelectedLength(page, 1)
let activeLinesContent = await page.locator('.cm-activeLine').all()
await expect(activeLinesContent[0]).toHaveText(`|> xLine(3.13, %)`)
await expect(activeLinesContent[0]).toHaveText(`|> xLine(length = 3.13)`)
// Wait for code editor to settle.
await page.waitForTimeout(2000)
@ -1105,7 +1105,9 @@ part002 = startSketchOn('XZ')
await pollEditorLinesSelectedLength(page, 1)
activeLinesContent = await page.locator('.cm-activeLine').all()
await expect(activeLinesContent[0]).toHaveText(`|> xLine(length001, %)`)
await expect(activeLinesContent[0]).toHaveText(
`|> xLine(length = length001)`
)
// checking the count of the overlays is a good proxy check that the client sketch scene is in a good state
await expect(page.getByTestId('segment-overlay')).toHaveCount(2)

View File

@ -212,10 +212,10 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|> line(end = [0.5, -14 + 0])
|> angledLine({ angle = 3 + 0, length = 32 + 0 }, %)
|> line(endAbsolute = [5 + 33, 20 + 11.5 + 0])
|> xLineTo(5 + 9 - 5, %)
|> yLineTo(20 + -10.77, %, $a)
|> xLine(26.04, %)
|> yLine(21.14 + 0, %)
|> xLine(endAbsolute = 5 + 9 - 5)
|> yLine(endAbsolute = 20 + -10.77, tag = $a)
|> xLine(length = 26.04)
|> yLine(length = 21.14 + 0)
|> angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %)
|> angledLineOfYLength({ angle = -91, length = 19 + 0 }, %)
|> angledLineToX({ angle = 3 + 0, to = 5 + 26 }, %)
@ -239,7 +239,7 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
await u.expectCmdLog('[data-message-type="execution-done"]')
await u.closeDebugPanel()
await page.getByText('xLineTo(5 + 9 - 5, %)').click()
await page.getByText('xLine(endAbsolute = 5 + 9 - 5)').click()
await page.waitForTimeout(100)
await page.getByRole('button', { name: 'Edit Sketch' }).click()
await page.waitForTimeout(500)
@ -358,9 +358,9 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
await clickConstrained({
hoverPos: { x: xLineTo.x, y: xLineTo.y },
constraintType: 'xAbsolute',
expectBeforeUnconstrained: 'xLineTo(5 + 9 - 5, %)',
expectAfterUnconstrained: 'xLineTo(9, %)',
expectFinal: 'xLineTo(xAbs002, %)',
expectBeforeUnconstrained: 'xLine(endAbsolute = 5 + 9 - 5)',
expectAfterUnconstrained: 'xLine(endAbsolute = 9)',
expectFinal: 'xLine(endAbsolute = xAbs002)',
ang: ang + 180,
steps: 8,
locator: '[data-overlay-toolbar-index="3"]',
@ -386,10 +386,10 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|> line(end = [0.5, yRel001])
|> angledLine({ angle = angle001, length = len001 }, %)
|> line(endAbsolute = [33, yAbs001])
|> xLineTo(xAbs002, %)
|> yLineTo(-10.77, %, $a)
|> xLine(26.04, %)
|> yLine(21.14 + 0, %)
|> xLine(endAbsolute = xAbs002)
|> yLine(endAbsolute = -10.77, tag = $a)
|> xLine(length = 26.04)
|> yLine(length = 21.14 + 0)
|> angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %)
`
)
@ -404,7 +404,7 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
await u.expectCmdLog('[data-message-type="execution-done"]')
await u.closeDebugPanel()
await page.getByText('xLine(26.04, %)').click()
await page.getByText('xLine(length = 26.04)').click()
await page.waitForTimeout(100)
await page.getByRole('button', { name: 'Edit Sketch' }).click()
await page.waitForTimeout(500)
@ -424,9 +424,9 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
await clickUnconstrained({
hoverPos: { x: yLineTo.x, y: yLineTo.y - 200 },
constraintType: 'yAbsolute',
expectBeforeUnconstrained: 'yLineTo(-10.77, %, $a)',
expectAfterUnconstrained: 'yLineTo(yAbs002, %, $a)',
expectFinal: 'yLineTo(-10.77, %, $a)',
expectBeforeUnconstrained: 'yLine(endAbsolute = -10.77, tag = $a)',
expectAfterUnconstrained: 'yLine(endAbsolute = yAbs002, tag = $a)',
expectFinal: 'yLine(endAbsolute = -10.77, tag = $a)',
ang: ang + 180,
locator: '[data-overlay-toolbar-index="4"]',
})
@ -437,9 +437,9 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
await clickUnconstrained({
hoverPos: { x: xLine.x, y: xLine.y },
constraintType: 'xRelative',
expectBeforeUnconstrained: 'xLine(26.04, %)',
expectAfterUnconstrained: 'xLine(xRel002, %)',
expectFinal: 'xLine(26.04, %)',
expectBeforeUnconstrained: 'xLine(length = 26.04)',
expectAfterUnconstrained: 'xLine(length = xRel002)',
expectFinal: 'xLine(length = 26.04)',
steps: 10,
ang: ang + 180,
locator: '[data-overlay-toolbar-index="5"]',
@ -459,10 +459,10 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|> line(end = [0.5, -14 + 0])
|> angledLine({ angle = 3 + 0, length = 32 + 0 }, %)
|> line(endAbsolute = [33, 11.5 + 0])
|> xLineTo(9 - 5, %)
|> yLineTo(-10.77, %, $a)
|> xLine(26.04, %)
|> yLine(21.14 + 0, %)
|> xLine(endAbsolute = 9 - 5)
|> yLine(endAbsolute = -10.77, tag = $a)
|> xLine(length = 26.04)
|> yLine(length = 21.14 + 0)
|> angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %)
|> angledLineOfYLength({ angle = -91, length = 19 + 0 }, %)
|> angledLineToX({ angle = 3 + 0, to = 26 }, %)
@ -488,7 +488,7 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
await u.closeDebugPanel()
await page.waitForTimeout(500)
await page.getByText('xLineTo(9 - 5, %)').click()
await page.getByText('xLine(endAbsolute = 9 - 5)').click()
await page.waitForTimeout(100)
await page.getByRole('button', { name: 'Edit Sketch' }).click()
await page.waitForTimeout(500)
@ -506,9 +506,9 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
await clickConstrained({
hoverPos: { x: yLine.x, y: yLine.y },
constraintType: 'yRelative',
expectBeforeUnconstrained: 'yLine(21.14 + 0, %)',
expectAfterUnconstrained: 'yLine(21.14, %)',
expectFinal: 'yLine(yRel001, %)',
expectBeforeUnconstrained: 'yLine(length = 21.14 + 0)',
expectAfterUnconstrained: 'yLine(length = 21.14)',
expectFinal: 'yLine(length = yRel001)',
ang: ang + 180,
locator: '[data-overlay-toolbar-index="6"]',
})
@ -591,10 +591,10 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|> line(end = [0.5, -14 + 0])
|> angledLine({ angle = 3 + 0, length = 32 + 0 }, %)
|> line(endAbsolute = [33, 11.5 + 0])
|> xLineTo(9 - 5, %)
|> yLineTo(-10.77, %, $a)
|> xLine(26.04, %)
|> yLine(21.14 + 0, %)
|> xLine(endAbsolute = 9 - 5)
|> yLine(endAbsolute = -10.77, tag = $a)
|> xLine(length = 26.04)
|> yLine(length = 21.14 + 0)
|> angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %)
|> angledLineOfYLength({ angle = -91, length = 19 + 0 }, %)
|> angledLineToX({ angle = 3 + 0, to = 26 }, %)
@ -619,7 +619,7 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
await u.expectCmdLog('[data-message-type="execution-done"]')
await u.closeDebugPanel()
await page.getByText('xLineTo(9 - 5, %)').click()
await page.getByText('xLine(endAbsolute = 9 - 5)').click()
await page.waitForTimeout(100)
await page.getByRole('button', { name: 'Edit Sketch' }).click()
await page.waitForTimeout(500)
@ -755,10 +755,10 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|> line(end = [0.5, -14 + 0])
|> angledLine({ angle = 3 + 0, length = 32 + 0 }, %)
|> line(endAbsolute = [33, 11.5 + 0])
|> xLineTo(9 - 5, %)
|> yLineTo(-10.77, %, $a)
|> xLine(26.04, %)
|> yLine(21.14 + 0, %)
|> xLine(endAbsolute = 9 - 5)
|> yLine(endAbsolute = -10.77, tag = $a)
|> xLine(length = 26.04)
|> yLine(length = 21.14 + 0)
|> angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %)
|> angledLineOfYLength({ angle = -91, length = 19 + 0 }, %)
|> angledLineToX({ angle = 3 + 0, to = 26 }, %)
@ -783,7 +783,7 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
await u.expectCmdLog('[data-message-type="execution-done"]')
await u.closeDebugPanel()
await page.getByText('xLineTo(9 - 5, %)').click()
await page.getByText('xLine(endAbsolute = 9 - 5)').click()
await page.waitForTimeout(100)
await page.getByRole('button', { name: 'Edit Sketch' }).click()
await page.waitForTimeout(500)
@ -947,10 +947,10 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|> line(end = [0.5, -14 + 0])
|> angledLine({ angle = 3 + 0, length = 32 + 0 }, %)
|> line(endAbsolute = [33, 11.5 + 0])
|> xLineTo(9 - 5, %)
|> yLineTo(-10.77, %, $a)
|> xLine(26.04, %)
|> yLine(21.14 + 0, %)
|> xLine(endAbsolute = 9 - 5)
|> yLine(endAbsolute = -10.77, tag = $a)
|> xLine(length = 26.04)
|> yLine(length = 21.14 + 0)
|> angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %)
|> angledLineOfYLength({ angle = -91, length = 19 + 0 }, %)
|> angledLineToX({ angle = 3 + 0, to = 26 }, %)
@ -976,7 +976,7 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
await u.expectCmdLog('[data-message-type="execution-done"]')
await u.closeDebugPanel()
await page.getByText('xLineTo(9 - 5, %)').click()
await page.getByText('xLine(endAbsolute = 9 - 5)').click()
await page.waitForTimeout(100)
await page.getByRole('button', { name: 'Edit Sketch' }).click()
await page.waitForTimeout(500)
@ -1060,7 +1060,7 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
ang = await u.getAngle(`[data-overlay-index="${6}"]`)
await deleteSegmentSequence({
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
codeToBeDeleted: 'yLine(21.14 + 0, %)',
codeToBeDeleted: 'yLine(length = 21.14 + 0)',
stdLibFnName: 'yLine',
ang: ang + 180,
locator: '[data-overlay-toolbar-index="6"]',
@ -1070,7 +1070,7 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
ang = await u.getAngle(`[data-overlay-index="${5}"]`)
await deleteSegmentSequence({
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
codeToBeDeleted: 'xLine(26.04, %)',
codeToBeDeleted: 'xLine(length = 26.04)',
stdLibFnName: 'xLine',
ang: ang + 180,
locator: '[data-overlay-toolbar-index="5"]',
@ -1080,7 +1080,7 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
ang = await u.getAngle(`[data-overlay-index="${4}"]`)
await deleteSegmentSequence({
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
codeToBeDeleted: 'yLineTo(-10.77, %, $a)',
codeToBeDeleted: 'yLine(endAbsolute = -10.77, tag = $a)',
stdLibFnName: 'yLineTo',
ang: ang + 180,
locator: '[data-overlay-toolbar-index="4"]',
@ -1090,7 +1090,7 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
ang = await u.getAngle(`[data-overlay-index="${3}"]`)
await deleteSegmentSequence({
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
codeToBeDeleted: 'xLineTo(9 - 5, %)',
codeToBeDeleted: 'xLine(endAbsolute = 9 - 5)',
stdLibFnName: 'xLineTo',
ang: ang + 180,
locator: '[data-overlay-toolbar-index="3"]',
@ -1155,10 +1155,10 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
const cases = [
'line(end = [22, 2], tag = $seg01)',
'angledLine([5, 23.03], %, $seg01)',
'xLine(23, %, $seg01)',
'yLine(-8, %, $seg01)',
'xLineTo(30, %, $seg01)',
'yLineTo(-4, %, $seg01)',
'xLine(length = 23, tag = $seg01)',
'yLine(length = -8, tag = $seg01)',
'xLine(endAbsolute = 30, tag = $seg01)',
'yLine(endAbsolute = -4, tag = $seg01)',
'angledLineOfXLength([3, 30], %, $seg01)',
'angledLineOfXLength({ angle = 3, length = 30 }, %, $seg01)',
'angledLineOfYLength([3, 1.5], %, $seg01)',
@ -1298,19 +1298,19 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
after: `line(end = [22.94, 2.01], tag = $seg01)`,
},
{
before: `xLine(23 + 0, %, $seg01)`,
before: `xLine(length = 23 + 0, tag = $seg01)`,
after: `line(end = [23, 0], tag = $seg01)`,
},
{
before: `yLine(-8 + 0, %, $seg01)`,
before: `yLine(length = -8 + 0, tag = $seg01)`,
after: `line(end = [0, -8], tag = $seg01)`,
},
{
before: `xLineTo(30 + 0, %, $seg01)`,
before: `xLine(endAbsolute = 30 + 0, tag = $seg01)`,
after: `line(end = [25, 0], tag = $seg01)`,
},
{
before: `yLineTo(-4 + 0, %, $seg01)`,
before: `yLine(endAbsolute = -4 + 0, tag = $seg01)`,
after: `line(end = [0, -10], tag = $seg01)`,
},
{

View File

@ -75,7 +75,7 @@ test.describe('Testing selections', { tag: ['@skipWin'] }, () => {
await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XZ')profile001 = startProfileAt(${commonPoints.startAt}, sketch001)
|> xLine(${commonPoints.num1}, %)`)
|> xLine(length = ${commonPoints.num1})`)
await page.waitForTimeout(100)
await page.mouse.click(startXPx + PUR * 20, 500 - PUR * 20)
@ -83,17 +83,17 @@ test.describe('Testing selections', { tag: ['@skipWin'] }, () => {
.toHaveText(`sketch001 = startSketchOn('XZ')profile001 = startProfileAt(${
commonPoints.startAt
}, sketch001)
|> xLine(${commonPoints.num1}, %)
|> yLine(${commonPoints.num1 + 0.01}, %)`)
|> xLine(length = ${commonPoints.num1})
|> yLine(length = ${commonPoints.num1 + 0.01})`)
await page.waitForTimeout(100)
await page.mouse.click(startXPx, 500 - PUR * 20)
await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XZ')profile001 = startProfileAt(${
commonPoints.startAt
}, sketch001)
|> xLine(${commonPoints.num1}, %)
|> yLine(${commonPoints.num1 + 0.01}, %)
|> xLine(${commonPoints.num2 * -1}, %)`)
|> xLine(length = ${commonPoints.num1})
|> yLine(length = ${commonPoints.num1 + 0.01})
|> xLine(length = ${commonPoints.num2 * -1})`)
// deselect line tool
await page.getByRole('button', { name: 'line Line', exact: true }).click()
@ -158,7 +158,9 @@ test.describe('Testing selections', { tag: ['@skipWin'] }, () => {
// check the same selection again by putting cursor in code first then selecting axis
await test.step(`Same selection but code selection then axis`, async () => {
await page.getByText(` |> xLine(${commonPoints.num2 * -1}, %)`).click()
await page
.getByText(` |> xLine(length = ${commonPoints.num2 * -1})`)
.click()
await page.keyboard.down('Shift')
await constrainButton.click()
await expect(absXButton).toBeDisabled()
@ -182,7 +184,9 @@ test.describe('Testing selections', { tag: ['@skipWin'] }, () => {
process.platform === 'linux' ? 'Control' : 'Meta'
)
await page.waitForTimeout(100)
await page.getByText(` |> xLine(${commonPoints.num2 * -1}, %)`).click()
await page
.getByText(` |> xLine(length = ${commonPoints.num2 * -1})`)
.click()
await expect(page.locator('.cm-cursor')).toHaveCount(2)
await page.waitForTimeout(500)
@ -536,9 +540,9 @@ profile003 = startProfileAt([40.16, -120.48], sketch006)
|> line(end = [7.13, 4 + 0])
|> angledLine({ angle = 3 + 0, length = 3.14 + 0 }, %)
|> line(endAbsolute = [20.14 + 0, -0.14 + 0])
|> xLineTo(29 + 0, %)
|> yLine(-3.14 + 0, %, $a)
|> xLine(1.63, %)
|> xLine(endAbsolute = 29 + 0)
|> yLine(length = -3.14 + 0, tag = $a)
|> xLine(length = 1.63)
|> angledLineOfXLength({ angle = 3 + 0, length = 3.14 }, %)
|> angledLineOfYLength({ angle = 30, length = 3 + 0 }, %)
|> angledLineToX({ angle = 22.14 + 0, to = 12 }, %)

View File

@ -52,14 +52,14 @@ armThick = 0.5
totalLen = 9.5
part001 = startSketchOn('-XZ')
|> startProfileAt([0, 0], %)
|> yLine(baseHeight, %)
|> xLine(baseLen, %)
|> yLine(length = baseHeight)
|> xLine(length = baseLen)
|> angledLineToY({
angle = topAng,
to = totalHeightHalf,
}, %, $seg04)
|> xLineTo(totalLen, %, $seg03)
|> yLine(-armThick, %, $seg01)
|> xLine(endAbsolute = totalLen, tag = $seg03)
|> yLine(length = -armThick, tag = $seg01)
|> angledLineThatIntersects({
angle = HALF_TURN,
offset = -armThick,
@ -70,15 +70,15 @@ part001 = startSketchOn('-XZ')
angle = -bottomAng,
to = -totalHeightHalf - armThick,
}, %, $seg02)
|> xLineTo(segEndX(seg03) + 0, %)
|> yLine(-segLen(seg01), %)
|> xLine(endAbsolute = segEndX(seg03) + 0)
|> yLine(length = -segLen(seg01))
|> angledLineThatIntersects({
angle = HALF_TURN,
offset = -armThick,
intersectTag = seg02
}, %)
|> angledLineToY([segAng(seg02) + 180, -baseHeight], %)
|> xLineTo(ZERO, %)
|> xLine(endAbsolute = ZERO)
|> close()
|> extrude(length = 4)`
)

View File

@ -91,7 +91,7 @@
"fmt-check": "prettier --check ./src *.ts *.json *.js ./e2e ./packages",
"fetch:wasm": "./scripts/get-latest-wasm-bundle.sh",
"fetch:wasm:windows": "./scripts/get-latest-wasm-bundle.ps1",
"fetch:samples": "echo \"Fetching latest KCL samples...\" && curl -o public/kcl-samples-manifest-fallback.json https://raw.githubusercontent.com/KittyCAD/next/manifest.json",
"fetch:samples": "echo \"Fetching latest KCL samples...\" && curl -o public/kcl-samples-manifest-fallback.json https://raw.githubusercontent.com/KittyCAD/achalmers/kw-args-xylineto/manifest.json",
"build:wasm-dev": "yarn wasm-prep && (cd src/wasm-lib && wasm-pack build --dev --target web --out-dir pkg && cargo test -p kcl-lib export_bindings) && yarn isomorphic-copy-wasm && yarn fmt",
"build:wasm:nocopy": "yarn wasm-prep && cd src/wasm-lib && wasm-pack build --release --target web --out-dir pkg && cargo test -p kcl-lib export_bindings",
"build:wasm": "yarn build:wasm:nocopy && cp src/wasm-lib/pkg/wasm_lib_bg.wasm public && yarn fmt",

View File

@ -12,6 +12,7 @@ import child_process from 'node:child_process'
const DIR_KCL_SAMPLES = 'kcl-samples'
const URL_GIT_KCL_SAMPLES = 'https://github.com/KittyCAD/kcl-samples.git'
const BRANCH = 'achalmers/kw-args-xylineto'
interface KclSampleFile {
file: string
@ -32,7 +33,7 @@ child_process.spawnSync('git', [
'clone',
'--single-branch',
'--branch',
'next',
BRANCH,
URL_GIT_KCL_SAMPLES,
DIR_KCL_SAMPLES,
])

View File

@ -592,10 +592,10 @@ ${!replace1 ? ` |> ${line}\n` : ''} |> angledLine([-65, ${
'line(endAbsolute = [306.21, 198.85], tag = $a)',
['110.48', '119.73'],
],
['yLine', 'yLine(198.85, %, $a)', ['198.85', '90']],
['xLine', 'xLine(198.85, %, $a)', ['198.85', '0']],
['yLineTo', 'yLineTo(198.85, %, $a)', ['95.94', '90']],
['xLineTo', 'xLineTo(198.85, %, $a)', ['162.14', '180']],
['yLine', 'yLine(length = 198.85, tag = $a)', ['198.85', '90']],
['xLine', 'xLine(length = 198.85, tag = $a)', ['198.85', '0']],
['yLineTo', 'yLine(endAbsolute = 198.85, tag = $a)', ['95.94', '90']],
['xLineTo', 'xLine(endAbsolute = 198.85, tag = $a)', ['162.14', '180']],
[
'angledLine',
'angledLine({ angle: 45.5, length: 198.85 }, %, $a)',
@ -658,10 +658,10 @@ describe('Testing removeSingleConstraintInfo', () => {
|> line(end = [3 + 0, 4 + 0])
|> angledLine({ angle = 3 + 0, length = 3.14 + 0 }, %)
|> line(endAbsolute = [6.14 + 0, 3.14 + 0])
|> xLineTo(8 + 0, %)
|> yLineTo(5 + 0, %)
|> yLine(3.14 + 0, %, $a)
|> xLine(3.14 + 0, %)
|> xLine(endAbsolute = 8 + 0)
|> yLine(endAbsolute = 5 + 0)
|> yLine(length = 3.14 + 0, tag = $a)
|> xLine(length = 3.14 + 0)
|> angledLineOfXLength({ angle = 3 + 0, length = 3.14 + 0 }, %)
|> angledLineOfYLength({ angle = 30 + 0, length = 3 + 0 }, %)
|> angledLineToX({ angle = 12.14 + 0, to = 12 + 0 }, %)
@ -679,11 +679,11 @@ describe('Testing removeSingleConstraintInfo', () => {
'objectProperty',
'angle',
],
['line(endAbsolute = [6.14 + 0, 3.14 + 0])', 'arrayIndex', 0],
['xLineTo(8, %)', '', ''],
['yLineTo(5, %)', '', ''],
['yLine(3.14, %, $a)', '', ''],
['xLine(3.14, %)', '', ''],
['line(endAbsolute = [6.14, 3.14 + 0])', 'arrayIndex', 0],
['xLine(endAbsolute = 8)', '', ''],
['yLine(endAbsolute = 5)', '', ''],
['yLine(length = 3.14, tag = $a)', '', ''],
['xLine(length = 3.14)', '', ''],
[
'angledLineOfXLength({ angle = 3, length = 3.14 + 0 }, %)',
'objectProperty',
@ -718,11 +718,13 @@ describe('Testing removeSingleConstraintInfo', () => {
const ast = assertParse(code)
const execState = await enginelessExecutor(ast)
const lineOfInterest = expectedFinish.split('(')[0] + '('
const range = topLevelRange(
code.indexOf(lineOfInterest) + 1,
code.indexOf(lineOfInterest) + lineOfInterest.length
)
const lineOfInterest =
expectedFinish.indexOf('=') >= 0 && expectedFinish.indexOf('{') === -1
? expectedFinish.split('=')[0]
: expectedFinish.split('(')[0] + '('
const start = code.indexOf(lineOfInterest)
expect(start).toBeGreaterThanOrEqual(0)
const range = topLevelRange(start + 1, start + lineOfInterest.length)
const pathToNode = getNodePathFromSourceRange(ast, range)
let argPosition: SimplifiedArgDetails
if (key === 'arrayIndex' && typeof value === 'number') {

View File

@ -51,8 +51,8 @@ objExpShouldNotBeIncluded = { a: 1, b: 2, c: 3 }
part001 = startSketchOn('XY')
|> startProfileAt([0, 0], %)
|> yLineTo(1, %)
|> xLine(3.84, %) // selection-range-7ish-before-this
|> yLine(endAbsolute = 1)
|> xLine(length = 3.84) // selection-range-7ish-before-this
variableBelowShouldNotBeIncluded = 3
`
@ -690,25 +690,25 @@ describe('Testing specific sketch getNodeFromPath workflow', () => {
it('should parse the code', () => {
const openSketch = `sketch001 = startSketchOn('XZ')
|> startProfileAt([0.02, 0.22], %)
|> xLine(0.39, %)
|> xLine(length = 0.39)
|> line([0.02, -0.17], %)
|> yLine(-0.15, %)
|> yLine(length = -0.15)
|> line([-0.21, -0.02], %)
|> xLine(-0.15, %)
|> xLine(length = -0.15)
|> line([-0.02, 0.21], %)
|> line([-0.08, 0.05], %)`
const ast = assertParse(openSketch)
expect(ast.start).toEqual(0)
expect(ast.end).toEqual(227)
expect(ast.end).toEqual(245)
})
it('should find the location to add new lineTo', () => {
const openSketch = `sketch001 = startSketchOn('XZ')
|> startProfileAt([0.02, 0.22], %)
|> xLine(0.39, %)
|> xLine(length = 0.39)
|> line([0.02, -0.17], %)
|> yLine(-0.15, %)
|> yLine(length = -0.15)
|> line([-0.21, -0.02], %)
|> xLine(-0.15, %)
|> xLine(length = -0.15)
|> line([-0.02, 0.21], %)
|> line([-0.08, 0.05], %)`
const ast = assertParse(openSketch)
@ -744,11 +744,11 @@ describe('Testing specific sketch getNodeFromPath workflow', () => {
const recasted = recast(modifiedAst)
const expectedCode = `sketch001 = startSketchOn('XZ')
|> startProfileAt([0.02, 0.22], %)
|> xLine(0.39, %)
|> xLine(length = 0.39)
|> line([0.02, -0.17], %)
|> yLine(-0.15, %)
|> yLine(length = -0.15)
|> line([-0.21, -0.02], %)
|> xLine(-0.15, %)
|> xLine(length = -0.15)
|> line([-0.02, 0.21], %)
|> line([-0.08, 0.05], %)
|> lineTo([profileStartX(%), profileStartY(%)], %)
@ -758,11 +758,11 @@ describe('Testing specific sketch getNodeFromPath workflow', () => {
it('it should find the location to add close', () => {
const openSketch = `sketch001 = startSketchOn('XZ')
|> startProfileAt([0.02, 0.22], %)
|> xLine(0.39, %)
|> xLine(length = 0.39)
|> line([0.02, -0.17], %)
|> yLine(-0.15, %)
|> yLine(length = -0.15)
|> line([-0.21, -0.02], %)
|> xLine(-0.15, %)
|> xLine(length = -0.15)
|> line([-0.02, 0.21], %)
|> line([-0.08, 0.05], %)
|> lineTo([profileStartX(%), profileStartY(%)], %)
@ -784,11 +784,11 @@ describe('Testing specific sketch getNodeFromPath workflow', () => {
const recasted = recast(modifiedAst)
const expectedCode = `sketch001 = startSketchOn('XZ')
|> startProfileAt([0.02, 0.22], %)
|> xLine(0.39, %)
|> xLine(length = 0.39)
|> line([0.02, -0.17], %)
|> yLine(-0.15, %)
|> yLine(length = -0.15)
|> line([-0.21, -0.02], %)
|> xLine(-0.15, %)
|> xLine(length = -0.15)
|> line([-0.02, 0.21], %)
|> line([-0.08, 0.05], %)
|> lineTo([profileStartX(%), profileStartY(%)], %)

View File

@ -334,10 +334,10 @@ describe('testing getConstraintInfo', () => {
length = 3.14,
}, %)
|> line(endAbsolute = [6.14, 3.14])
|> xLineTo(8, %)
|> yLineTo(5, %)
|> yLine(3.14, %, $a)
|> xLine(3.14, %)
|> xLine(endAbsolute = 8)
|> yLine(endAbsolute = 5)
|> yLine(length = 3.14, tag = $a)
|> xLine(length = 3.14)
|> angledLineOfXLength({
angle = 3.14,
length = 3.14,
@ -431,12 +431,12 @@ describe('testing getConstraintInfo', () => {
],
],
[
'xLineTo',
'xLine(endAbsolute',
[
{
type: 'horizontal',
isConstrained: true,
value: 'xLineTo',
value: 'xLine',
sourceRange: [expect.any(Number), expect.any(Number), 0],
argPosition: undefined,
pathToNode: expect.any(Array),
@ -454,12 +454,12 @@ describe('testing getConstraintInfo', () => {
],
],
[
'yLineTo',
'yLine(endAbsolute',
[
{
type: 'vertical',
isConstrained: true,
value: 'yLineTo',
value: 'yLine',
sourceRange: [expect.any(Number), expect.any(Number), 0],
argPosition: undefined,
pathToNode: expect.any(Array),
@ -477,7 +477,7 @@ describe('testing getConstraintInfo', () => {
],
],
[
'yLine(',
'yLine(length',
[
{
type: 'vertical',
@ -500,7 +500,7 @@ describe('testing getConstraintInfo', () => {
],
],
[
'xLine(',
'xLine(length',
[
{
type: 'horizontal',
@ -683,10 +683,9 @@ describe('testing getConstraintInfo', () => {
],
])('testing %s when inputs are unconstrained', (functionName, expected) => {
const ast = assertParse(code)
const sourceRange = topLevelRange(
code.indexOf(functionName),
code.indexOf(functionName) + functionName.length
)
const start = code.indexOf(functionName)
expect(start).toBeGreaterThanOrEqual(0)
const sourceRange = topLevelRange(start, start + functionName.length)
if (err(ast)) return ast
const pathToNode = getNodePathFromSourceRange(ast, sourceRange)
const callExp = getNodeFromPath<Node<CallExpression | CallExpressionKw>>(
@ -708,10 +707,10 @@ describe('testing getConstraintInfo', () => {
|> line(end = [3, 4])
|> angledLine([3.14, 3.14], %)
|> line(endAbsolute = [6.14, 3.14])
|> xLineTo(8, %)
|> yLineTo(5, %)
|> yLine(3.14, %, $a)
|> xLine(3.14, %)
|> xLine(endAbsolute = 8)
|> yLine(endAbsolute = 5)
|> yLine(length = 3.14, tag = $a)
|> xLine(length = 3.14)
|> angledLineOfXLength([3.14, 3.14], %)
|> angledLineOfYLength([30, 3], %)
|> angledLineToX([12, 12], %)
@ -865,10 +864,10 @@ describe('testing getConstraintInfo', () => {
|> line(end = [3 + 0, 4 + 0])
|> angledLine({ angle = 3.14 + 0, length = 3.14 + 0 }, %)
|> line(endAbsolute = [6.14 + 0, 3.14 + 0])
|> xLineTo(8 + 0, %)
|> yLineTo(5 + 0, %)
|> yLine(3.14 + 0, %, $a)
|> xLine(3.14 + 0, %)
|> xLine(endAbsolute = 8 + 0)
|> yLine(endAbsolute = 5 + 0)
|> yLine(length = 3.14 + 0, tag = $a)
|> xLine(length = 3.14 + 0)
|> angledLineOfXLength({ angle = 3.14 + 0, length = 3.14 + 0 }, %)
|> angledLineOfYLength({ angle = 30 + 0, length = 3 + 0 }, %)
|> angledLineToX({ angle = 12.14 + 0, to = 12 + 0 }, %)
@ -950,12 +949,12 @@ describe('testing getConstraintInfo', () => {
],
],
[
'xLineTo',
'xLine(endAbsolute',
[
{
type: 'horizontal',
isConstrained: true,
value: 'xLineTo',
value: 'xLine',
sourceRange: [expect.any(Number), expect.any(Number), 0],
argPosition: undefined,
pathToNode: expect.any(Array),
@ -973,12 +972,12 @@ describe('testing getConstraintInfo', () => {
],
],
[
'yLineTo',
'yLine(endAbsolute',
[
{
type: 'vertical',
isConstrained: true,
value: 'yLineTo',
value: 'yLine',
sourceRange: [expect.any(Number), expect.any(Number), 0],
argPosition: undefined,
pathToNode: expect.any(Array),
@ -996,7 +995,7 @@ describe('testing getConstraintInfo', () => {
],
],
[
'yLine(',
'yLine(length',
[
{
type: 'vertical',
@ -1019,7 +1018,7 @@ describe('testing getConstraintInfo', () => {
],
],
[
'xLine(',
'xLine(length',
[
{
type: 'horizontal',

View File

@ -16,6 +16,7 @@ import {
VariableMap,
} from 'lang/wasm'
import {
ARG_INDEX_FIELD,
getNodeFromPath,
getNodeFromPathCurry,
getObjExprProperty,
@ -76,6 +77,7 @@ import {
export const ARG_TAG = 'tag'
export const ARG_END = 'end'
export const ARG_LENGTH = 'length'
export const ARG_END_ABSOLUTE = 'endAbsolute'
const STRAIGHT_SEGMENT_ERR = new Error(
@ -123,12 +125,7 @@ export function createFirstArg(
intersectTag: val[2],
})
} else {
if (
['startSketchAt', 'xLine', 'xLineTo', 'yLine', 'yLineTo'].includes(
sketchFn
)
)
return val
if (['startSketchAt'].includes(sketchFn)) return val
}
return new Error('Missing sketch line type')
}
@ -207,7 +204,9 @@ const commonConstraintInfoHelper = (
case 'CallExpression':
return 0
case 'CallExpressionKw':
return findKwArgAnyIndex([ARG_END, ARG_END_ABSOLUTE], callExp)
const arg = findKwArgAnyIndex([ARG_END, ARG_END_ABSOLUTE], callExp)
if (arg === undefined) return undefined
return arg.argIndex
}
})()
if (argIndex === undefined) {
@ -299,8 +298,8 @@ const commonConstraintInfoHelper = (
return constraints
}
const horzVertConstraintInfoHelper = (
callExp: CallExpression,
const horzVertConstraintInfoHelperKw = (
callExp: CallExpressionKw,
inputConstrainTypes: [ConstrainInfo['type'], ConstrainInfo['type']],
stdLibFnName: ConstrainInfo['stdLibFnName'],
abbreviatedInput: AbbreviatedInput,
@ -308,15 +307,24 @@ const horzVertConstraintInfoHelper = (
pathToNode: PathToNode,
filterValue?: string
) => {
if (callExp.type !== 'CallExpression') return []
const firstArg = callExp.arguments?.[0]
if (callExp.type !== 'CallExpressionKw') return []
const callee = callExp.callee
const pathToFirstArg: PathToNode = [
const relevantArg = findKwArgAnyIndex(
[ARG_END_ABSOLUTE, ARG_END, ARG_LENGTH],
callExp
)
if (relevantArg === undefined) return []
const { argIndex, expr: relevantArgExpr } = relevantArg
const pathToRelevantArg: PathToNode = [
...pathToNode,
['arguments', 'CallExpression'],
[0, 'index'],
['arguments', 'CallExpressionKw'],
[argIndex, ARG_INDEX_FIELD],
['arg', LABELED_ARG_FIELD],
]
const pathToCallee: PathToNode = [
...pathToNode,
['callee', 'CallExpressionKw'],
]
const pathToCallee: PathToNode = [...pathToNode, ['callee', 'CallExpression']]
return [
constrainInfo(
inputConstrainTypes[0],
@ -329,12 +337,12 @@ const horzVertConstraintInfoHelper = (
),
constrainInfo(
inputConstrainTypes[1],
isNotLiteralArrayOrStatic(callExp.arguments?.[0]),
code.slice(firstArg.start, firstArg.end),
isNotLiteralArrayOrStatic(relevantArgExpr),
code.slice(relevantArgExpr.start, relevantArgExpr.end),
stdLibFnName,
abbreviatedInput,
topLevelRange(firstArg.start, firstArg.end),
pathToFirstArg
topLevelRange(relevantArgExpr.start, relevantArgExpr.end),
pathToRelevantArg
),
]
}
@ -401,7 +409,6 @@ export const line: SketchLineHelperKw = {
const callExp = createCallExpressionStdLibKw(
'line',
null, // Assumes this is being called in a pipeline, so the first arg is optional and if not given, will become pipeline substitution.
// TODO: ADAM: This should have a tag sometimes.
[createLabeledArg(ARG_END, createArrayExpression([newXVal, newYVal]))]
)
const pathToNodeIndex = pathToNode.findIndex(
@ -651,7 +658,7 @@ export const lineTo: SketchLineHelperKw = {
),
}
export const xLineTo: SketchLineHelper = {
export const xLineTo: SketchLineHelperKw = {
add: ({ node, pathToNode, segmentInput, replaceExistingCallback }) => {
if (segmentInput.type !== 'straight-segment') return STRAIGHT_SEGMENT_ERR
const { to } = segmentInput
@ -681,9 +688,8 @@ export const xLineTo: SketchLineHelper = {
valueUsedInTransform,
}
}
const callExp = createCallExpression('xLineTo', [
newVal,
createPipeSubstitution(),
const callExp = createCallExpressionStdLibKw('xLine', newVal, [
createLabeledArg(ARG_END_ABSOLUTE, newVal),
])
pipe.body = [...pipe.body, callExp]
return {
@ -695,24 +701,20 @@ export const xLineTo: SketchLineHelper = {
if (input.type !== 'straight-segment') return STRAIGHT_SEGMENT_ERR
const { to } = input
const _node = { ...node }
const nodeMeta = getNodeFromPath<CallExpression>(_node, pathToNode)
const nodeMeta = getNodeFromPath<CallExpressionKw>(_node, pathToNode)
if (err(nodeMeta)) return nodeMeta
const { node: callExpression } = nodeMeta
const newX = createLiteral(roundOff(to[0], 2))
if (isLiteralArrayOrStatic(callExpression.arguments?.[0])) {
callExpression.arguments[0] = newX
} else {
mutateObjExpProp(callExpression.arguments?.[0], newX, 'to')
}
mutateKwArg(ARG_END_ABSOLUTE, callExpression, newX)
return {
modifiedAst: _node,
pathToNode,
}
},
getTag: getTag(),
addTag: addTag(),
getTag: getTagKwArg(),
addTag: addTagKw(),
getConstraintInfo: (callExp, ...args) =>
horzVertConstraintInfoHelper(
horzVertConstraintInfoHelperKw(
callExp,
['horizontal', 'xAbsolute'],
'xLineTo',
@ -721,7 +723,7 @@ export const xLineTo: SketchLineHelper = {
),
}
export const yLineTo: SketchLineHelper = {
export const yLineTo: SketchLineHelperKw = {
add: ({ node, pathToNode, segmentInput, replaceExistingCallback }) => {
if (segmentInput.type !== 'straight-segment') return STRAIGHT_SEGMENT_ERR
const { to } = segmentInput
@ -751,9 +753,8 @@ export const yLineTo: SketchLineHelper = {
valueUsedInTransform,
}
}
const callExp = createCallExpression('yLineTo', [
newVal,
createPipeSubstitution(),
const callExp = createCallExpressionStdLibKw('yLine', newVal, [
createLabeledArg(ARG_END_ABSOLUTE, newVal),
])
pipe.body = [...pipe.body, callExp]
return {
@ -765,24 +766,20 @@ export const yLineTo: SketchLineHelper = {
if (input.type !== 'straight-segment') return STRAIGHT_SEGMENT_ERR
const { to } = input
const _node = { ...node }
const nodeMeta = getNodeFromPath<CallExpression>(_node, pathToNode)
const nodeMeta = getNodeFromPath<CallExpressionKw>(_node, pathToNode)
if (err(nodeMeta)) return nodeMeta
const { node: callExpression } = nodeMeta
const newY = createLiteral(roundOff(to[1], 2))
if (isLiteralArrayOrStatic(callExpression.arguments?.[0])) {
callExpression.arguments[0] = newY
} else {
mutateObjExpProp(callExpression.arguments?.[0], newY, 'to')
}
mutateKwArg(ARG_END_ABSOLUTE, callExpression, newY)
return {
modifiedAst: _node,
pathToNode,
}
},
getTag: getTag(),
addTag: addTag(),
getTag: getTagKwArg(),
addTag: addTagKw(),
getConstraintInfo: (callExp, ...args) =>
horzVertConstraintInfoHelper(
horzVertConstraintInfoHelperKw(
callExp,
['vertical', 'yAbsolute'],
'yLineTo',
@ -791,7 +788,7 @@ export const yLineTo: SketchLineHelper = {
),
}
export const xLine: SketchLineHelper = {
export const xLine: SketchLineHelperKw = {
add: ({ node, pathToNode, segmentInput, replaceExistingCallback }) => {
if (segmentInput.type !== 'straight-segment') return STRAIGHT_SEGMENT_ERR
const { from, to } = segmentInput
@ -826,9 +823,8 @@ export const xLine: SketchLineHelper = {
}
}
const newLine = createCallExpression('xLine', [
newVal,
createPipeSubstitution(),
const newLine = createCallExpressionStdLibKw('xLine', null, [
createLabeledArg(ARG_LENGTH, newVal),
])
if (dec.init.type === 'PipeExpression') {
dec.init.body = [...dec.init.body, newLine]
@ -841,24 +837,20 @@ export const xLine: SketchLineHelper = {
if (input.type !== 'straight-segment') return STRAIGHT_SEGMENT_ERR
const { to, from } = input
const _node = { ...node }
const nodeMeta = getNodeFromPath<CallExpression>(_node, pathToNode)
const nodeMeta = getNodeFromPath<CallExpressionKw>(_node, pathToNode)
if (err(nodeMeta)) return nodeMeta
const { node: callExpression } = nodeMeta
const newX = createLiteral(roundOff(to[0] - from[0], 2))
if (isLiteralArrayOrStatic(callExpression.arguments?.[0])) {
callExpression.arguments[0] = newX
} else {
mutateObjExpProp(callExpression.arguments?.[0], newX, 'length')
}
mutateKwArg(ARG_LENGTH, callExpression, newX)
return {
modifiedAst: _node,
pathToNode,
}
},
getTag: getTag(),
addTag: addTag(),
getTag: getTagKwArg(),
addTag: addTagKw(),
getConstraintInfo: (callExp, ...args) =>
horzVertConstraintInfoHelper(
horzVertConstraintInfoHelperKw(
callExp,
['horizontal', 'xRelative'],
'xLine',
@ -867,7 +859,7 @@ export const xLine: SketchLineHelper = {
),
}
export const yLine: SketchLineHelper = {
export const yLine: SketchLineHelperKw = {
add: ({ node, pathToNode, segmentInput, replaceExistingCallback }) => {
if (segmentInput.type !== 'straight-segment') return STRAIGHT_SEGMENT_ERR
const { from, to } = segmentInput
@ -900,9 +892,8 @@ export const yLine: SketchLineHelper = {
}
}
const newLine = createCallExpression('yLine', [
newVal,
createPipeSubstitution(),
const newLine = createCallExpressionStdLibKw('yLine', null, [
createLabeledArg(ARG_LENGTH, newVal),
])
if (dec.init.type === 'PipeExpression') {
dec.init.body = [...dec.init.body, newLine]
@ -915,24 +906,20 @@ export const yLine: SketchLineHelper = {
if (input.type !== 'straight-segment') return STRAIGHT_SEGMENT_ERR
const { to, from } = input
const _node = { ...node }
const nodeMeta = getNodeFromPath<CallExpression>(_node, pathToNode)
const nodeMeta = getNodeFromPath<CallExpressionKw>(_node, pathToNode)
if (err(nodeMeta)) return nodeMeta
const { node: callExpression } = nodeMeta
const newY = createLiteral(roundOff(to[1] - from[1], 2))
if (isLiteralArrayOrStatic(callExpression.arguments?.[0])) {
callExpression.arguments[0] = newY
} else {
mutateObjExpProp(callExpression.arguments?.[0], newY, 'length')
}
mutateKwArg(ARG_LENGTH, callExpression, newY)
return {
modifiedAst: _node,
pathToNode,
}
},
getTag: getTag(),
addTag: addTag(),
getTag: getTagKwArg(),
addTag: addTagKw(),
getConstraintInfo: (callExp, ...args) =>
horzVertConstraintInfoHelper(
horzVertConstraintInfoHelperKw(
callExp,
['vertical', 'yRelative'],
'yLine',
@ -2284,10 +2271,6 @@ export const updateStartProfileAtArgs: SketchLineHelper['updateArgs'] = ({
}
export const sketchLineHelperMap: { [key: string]: SketchLineHelper } = {
xLine,
yLine,
xLineTo,
yLineTo,
angledLine,
angledLineOfXLength,
angledLineOfYLength,
@ -2302,6 +2285,10 @@ export const sketchLineHelperMapKw: { [key: string]: SketchLineHelperKw } = {
line,
lineTo,
circleThreePoint,
xLine,
xLineTo,
yLine,
yLineTo,
} as const
export function changeSketchArguments(
@ -2382,6 +2369,32 @@ export function getConstraintInfo(
)
}
/* Keyword functions like 'line' could be absolute or relative, depending on their parameters.
But tooltips like 'line' or 'lineTo' are either relative or absolute. Not both.
So, map (line, absolute) to lineTo, and (line, relative) to line. Etc.
*/
export function sketchFnNameToTooltip(
fnName: string,
isAbsolute: boolean
): ToolTip | undefined {
switch (fnName) {
case 'line':
return isAbsolute ? 'lineTo' : fnName
case 'xLine':
return isAbsolute ? 'xLineTo' : fnName
case 'yLine':
return isAbsolute ? 'yLineTo' : fnName
}
}
export function sketchFnIsAbsolute(callExpression: CallExpressionKw): boolean {
const fnName = callExpression.callee.name
return (
fnName === 'circleThreePoint' ||
findKwArg('endAbsolute', callExpression) !== undefined
)
}
export function getConstraintInfoKw(
callExpression: Node<CallExpressionKw>,
code: string,
@ -2389,11 +2402,12 @@ export function getConstraintInfoKw(
filterValue?: string
): ConstrainInfo[] {
const fnName = callExpression?.callee?.name || ''
const isAbsolute =
fnName === 'circleThreePoint' ||
findKwArg('endAbsolute', callExpression) !== undefined
if (!(fnName in sketchLineHelperMapKw)) return []
const correctFnName = fnName === 'line' && isAbsolute ? 'lineTo' : fnName
const isAbsolute = sketchFnIsAbsolute(callExpression)
const correctFnName = sketchFnNameToTooltip(fnName, isAbsolute)
if (correctFnName === undefined) {
return []
}
if (!(correctFnName in sketchLineHelperMapKw)) return []
return sketchLineHelperMapKw[correctFnName].getConstraintInfo(
callExpression,
code,
@ -2465,13 +2479,14 @@ export function addNewSketchLn({
pathToNode,
'PipeExpression'
)
return add({
const result = add({
node,
variables,
pathToNode,
segmentInput,
spliceBetween,
})
return result
}
export function addCallExpressionsToPipe({
@ -2939,6 +2954,7 @@ function getFirstArgValuesForAngleFns(callExpression: CallExpression):
return new Error('expected ArrayExpression or ObjectExpression')
}
// This only works for positional calls. Do not use this with keyword args.
function getFirstArgValuesForXYLineFns(callExpression: CallExpression): {
val: Expr
tag?: Expr
@ -2949,10 +2965,7 @@ function getFirstArgValuesForXYLineFns(callExpression: CallExpression): {
return { val: firstArg }
}
const tag = firstArg.properties.find((p) => p.key.name === 'tag')?.value
const secondArgName = ['xLineTo', 'yLineTo', 'startSketchAt'].includes(
// const secondArgName = ['xLineTo', 'yLineTo', 'angledLineToX', 'angledLineToY'].includes(
callExpression?.callee?.name
)
const secondArgName = ['startSketchAt'].includes(callExpression?.callee?.name)
? 'to'
: 'length'
const length = firstArg.properties.find(
@ -3032,8 +3045,29 @@ export function isAbsoluteLine(lineCall: CallExpressionKw): boolean | Error {
return true
}
return new Error(
`line call has neither ${ARG_END} nor ${ARG_END_ABSOLUTE} params`
`${name} call has neither ${ARG_END} nor ${ARG_END_ABSOLUTE} params`
)
case 'xLine':
if (findKwArg(ARG_LENGTH, lineCall) !== undefined) {
return false
}
if (findKwArg(ARG_END_ABSOLUTE, lineCall) !== undefined) {
return true
}
return new Error(
`${name} call has neither ${ARG_LENGTH} nor ${ARG_END_ABSOLUTE} params`
)
case 'yLine':
if (findKwArg(ARG_LENGTH, lineCall) !== undefined) {
return false
}
if (findKwArg(ARG_END_ABSOLUTE, lineCall) !== undefined) {
return true
}
return new Error(
`${name} call has neither ${ARG_LENGTH} nor ${ARG_END_ABSOLUTE} params`
)
case 'circleThreePoint':
return false
}
@ -3050,16 +3084,25 @@ export function getArgForEnd(lineCall: CallExpressionKw):
}
| Error {
const name = lineCall?.callee?.name
let arg
if (name === 'line') {
arg = findKwArgAny([ARG_END, ARG_END_ABSOLUTE], lineCall)
} else {
return new Error('cannot find end of line function: ' + name)
}
switch (name) {
case 'line': {
const arg = findKwArgAny([ARG_END, ARG_END_ABSOLUTE], lineCall)
if (arg === undefined) {
return new Error("no end of the line was found in fn '" + name + "'")
}
return getValuesForXYFns(arg)
}
case 'xLine':
case 'yLine': {
const arg = findKwArgAny([ARG_LENGTH, ARG_END_ABSOLUTE], lineCall)
if (arg === undefined) {
return new Error("no end of the line was found in fn '" + name + "'")
}
return { val: arg }
}
default:
return new Error('unknown sketch keyword function ' + name)
}
}
export function getFirstArg(callExp: CallExpression):
@ -3080,9 +3123,6 @@ export function getFirstArg(callExp: CallExpression):
) {
return getFirstArgValuesForAngleFns(callExp)
}
if (['xLine', 'yLine', 'xLineTo', 'yLineTo'].includes(name)) {
return getFirstArgValuesForXYLineFns(callExp)
}
if (['startSketchAt'].includes(name)) {
return getFirstArgValuesForXYLineFns(callExp)
}

View File

@ -80,10 +80,10 @@ describe('testing swapping out sketch calls with xLine/xLineTo', () => {
` |> angledLineOfYLength({ angle = 104, length = 1.58 }, %, $abc5)`,
` |> angledLineToX({ angle = 55, to = -2.89 }, %, $abc6)`,
` |> angledLineToY({ angle = 330, to = 2.53 }, %, $abc7)`,
` |> xLine(1.47, %, $abc8)`,
` |> yLine(1.57, %, $abc9)`,
` |> xLineTo(1.49, %, $abc10)`,
` |> yLineTo(2.64, %, $abc11)`,
` |> xLine(length = 1.47, tag = $abc8)`,
` |> yLine(length = 1.57, tag = $abc9)`,
` |> xLine(endAbsolute = 1.49, tag = $abc10)`,
` |> yLine(endAbsolute = 2.64, tag = $abc11)`,
` |> line(endAbsolute = [2.55, 3.58]) // lineTo`,
` |> line(end = [0.73, -0.75])`,
` |> angledLine([63, 1.38], %) // angledLine`,
@ -91,15 +91,15 @@ describe('testing swapping out sketch calls with xLine/xLineTo', () => {
` |> angledLineOfYLength([50, 1.35], %) // angledLineOfYLength`,
` |> angledLineToX([291, 6.66], %) // angledLineToX`,
` |> angledLineToY([228, 2.14], %) // angledLineToY`,
` |> xLine(-1.33, %)`,
` |> yLine(-1.07, %)`,
` |> xLineTo(3.27, %)`,
` |> yLineTo(2.14, %)`,
` |> xLine(length = -1.33)`,
` |> yLine(length = -1.07)`,
` |> xLine(endAbsolute = 3.27)`,
` |> yLine(endAbsolute = 2.14)`,
]
const bigExample = bigExampleArr.join('\n')
it('line with tag converts to xLine', async () => {
const callToSwap = 'line(end = [-2.04, -0.7], tag = $abc2)'
const expectedLine = 'xLine(-2.04, %, $abc2)'
const expectedLine = 'xLine(length = -2.04, tag = $abc2)'
const { newCode, originalRange } = await testingSwapSketchFnCall({
inputCode: bigExample,
callToSwap,
@ -111,7 +111,7 @@ describe('testing swapping out sketch calls with xLine/xLineTo', () => {
})
it('line w/o tag converts to xLine', async () => {
const callToSwap = 'line(end = [0.73, -0.75])'
const expectedLine = 'xLine(0.73, %)'
const expectedLine = 'xLine(length = 0.73)'
const { newCode, originalRange } = await testingSwapSketchFnCall({
inputCode: bigExample,
callToSwap,
@ -127,7 +127,7 @@ describe('testing swapping out sketch calls with xLine/xLineTo', () => {
callToSwap: 'line(endAbsolute = [1, 1], tag = $abc1)',
constraintType: 'horizontal',
})
const expectedLine = 'xLineTo(1, %, $abc1)'
const expectedLine = 'xLine(endAbsolute = 1, tag = $abc1)'
expect(newCode).toContain(expectedLine)
// new line should start at the same place as the old line
expect(originalRange[0]).toBe(newCode.indexOf(expectedLine))
@ -138,7 +138,7 @@ describe('testing swapping out sketch calls with xLine/xLineTo', () => {
callToSwap: 'line(endAbsolute = [2.55, 3.58])',
constraintType: 'horizontal',
})
const expectedLine = 'xLineTo(2.55, %) // lineTo'
const expectedLine = 'xLine(endAbsolute = 2.55) // lineTo'
expect(newCode).toContain(expectedLine)
// new line should start at the same place as the old line
expect(originalRange[0]).toBe(newCode.indexOf(expectedLine))
@ -149,7 +149,7 @@ describe('testing swapping out sketch calls with xLine/xLineTo', () => {
callToSwap: 'angledLine({ angle = 157, length = 1.69 }, %, $abc3)',
constraintType: 'horizontal',
})
const expectedLine = 'xLine(-1.56, %, $abc3)'
const expectedLine = 'xLine(length = -1.56, tag = $abc3)'
console.log(newCode)
expect(newCode).toContain(expectedLine)
// new line should start at the same place as the old line
@ -161,7 +161,7 @@ describe('testing swapping out sketch calls with xLine/xLineTo', () => {
callToSwap: 'angledLine([63, 1.38], %)',
constraintType: 'horizontal',
})
const expectedLine = 'xLine(0.63, %) // angledLine'
const expectedLine = 'xLine(length = 0.63) // angledLine'
expect(newCode).toContain(expectedLine)
// new line should start at the same place as the old line
expect(originalRange[0]).toBe(newCode.indexOf(expectedLine))
@ -173,7 +173,7 @@ describe('testing swapping out sketch calls with xLine/xLineTo', () => {
'angledLineOfXLength({ angle = 217, length = 0.86 }, %, $abc4)',
constraintType: 'horizontal',
})
const expectedLine = 'xLine(-0.86, %, $abc4)'
const expectedLine = 'xLine(length = -0.86, tag = $abc4)'
// hmm "-0.86" is correct since the angle is 104, but need to make sure this is compatible `-myVar`
expect(newCode).toContain(expectedLine)
// new line should start at the same place as the old line
@ -185,7 +185,7 @@ describe('testing swapping out sketch calls with xLine/xLineTo', () => {
callToSwap: 'angledLineOfXLength([319, 1.15], %)',
constraintType: 'horizontal',
})
const expectedLine = 'xLine(1.15, %) // angledLineOfXLength'
const expectedLine = 'xLine(length = 1.15) // angledLineOfXLength'
expect(newCode).toContain(expectedLine)
// new line should start at the same place as the old line
expect(originalRange[0]).toBe(newCode.indexOf(expectedLine))
@ -197,7 +197,7 @@ describe('testing swapping out sketch calls with xLine/xLineTo', () => {
'angledLineOfYLength({ angle = 104, length = 1.58 }, %, $abc5)',
constraintType: 'vertical',
})
const expectedLine = 'yLine(1.58, %, $abc5)'
const expectedLine = 'yLine(length = 1.58, tag = $abc5)'
expect(newCode).toContain(expectedLine)
// new line should start at the same place as the old line
expect(originalRange[0]).toBe(newCode.indexOf(expectedLine))
@ -208,7 +208,7 @@ describe('testing swapping out sketch calls with xLine/xLineTo', () => {
callToSwap: 'angledLineOfYLength([50, 1.35], %)',
constraintType: 'vertical',
})
const expectedLine = 'yLine(1.35, %) // angledLineOfYLength'
const expectedLine = 'yLine(length = 1.35) // angledLineOfYLength'
expect(newCode).toContain(expectedLine)
// new line should start at the same place as the old line
expect(originalRange[0]).toBe(newCode.indexOf(expectedLine))
@ -219,7 +219,7 @@ describe('testing swapping out sketch calls with xLine/xLineTo', () => {
callToSwap: 'angledLineToX({ angle = 55, to = -2.89 }, %, $abc6)',
constraintType: 'horizontal',
})
const expectedLine = 'xLineTo(-2.89, %, $abc6)'
const expectedLine = 'xLine(endAbsolute = -2.89, tag = $abc6)'
expect(newCode).toContain(expectedLine)
// new line should start at the same place as the old line
expect(originalRange[0]).toBe(newCode.indexOf(expectedLine))
@ -230,7 +230,7 @@ describe('testing swapping out sketch calls with xLine/xLineTo', () => {
callToSwap: 'angledLineToX([291, 6.66], %)',
constraintType: 'horizontal',
})
const expectedLine = 'xLineTo(6.66, %) // angledLineToX'
const expectedLine = 'xLine(endAbsolute = 6.66) // angledLineToX'
expect(newCode).toContain(expectedLine)
// new line should start at the same place as the old line
expect(originalRange[0]).toBe(newCode.indexOf(expectedLine))
@ -241,7 +241,7 @@ describe('testing swapping out sketch calls with xLine/xLineTo', () => {
callToSwap: 'angledLineToY({ angle = 330, to = 2.53 }, %, $abc7)',
constraintType: 'vertical',
})
const expectedLine = 'yLineTo(2.53, %, $abc7)'
const expectedLine = 'yLine(endAbsolute = 2.53, tag = $abc7)'
expect(newCode).toContain(expectedLine)
// new line should start at the same place as the old line
expect(originalRange[0]).toBe(newCode.indexOf(expectedLine))
@ -252,7 +252,7 @@ describe('testing swapping out sketch calls with xLine/xLineTo', () => {
callToSwap: 'angledLineToY([228, 2.14], %)',
constraintType: 'vertical',
})
const expectedLine = 'yLineTo(2.14, %) // angledLineToY'
const expectedLine = 'yLine(endAbsolute = 2.14) // angledLineToY'
expect(newCode).toContain(expectedLine)
// new line should start at the same place as the old line
expect(originalRange[0]).toBe(newCode.indexOf(expectedLine))
@ -289,7 +289,7 @@ describe('testing swapping out sketch calls with xLine/xLineTo while keeping var
callToSwap: 'line(end = [lineX, 2.13])',
constraintType: 'horizontal',
})
const expectedLine = 'xLine(lineX, %)'
const expectedLine = 'xLine(length = lineX)'
expect(newCode).toContain(expectedLine)
// new line should start at the same place as the old line
expect(originalRange[0]).toBe(newCode.indexOf(expectedLine))
@ -300,7 +300,7 @@ describe('testing swapping out sketch calls with xLine/xLineTo while keeping var
callToSwap: 'line(endAbsolute = [lineToX, 2.85])',
constraintType: 'horizontal',
})
const expectedLine = 'xLineTo(lineToX, %)'
const expectedLine = 'xLine(endAbsolute = lineToX)'
expect(newCode).toContain(expectedLine)
// new line should start at the same place as the old line
expect(originalRange[0]).toBe(newCode.indexOf(expectedLine))
@ -311,7 +311,7 @@ describe('testing swapping out sketch calls with xLine/xLineTo while keeping var
callToSwap: 'angledLineOfXLength([329, angledLineOfXLengthX], %)',
constraintType: 'horizontal',
})
const expectedLine = 'xLine(angledLineOfXLengthX, %)'
const expectedLine = 'xLine(length = angledLineOfXLengthX)'
expect(newCode).toContain(expectedLine)
// new line should start at the same place as the old line
expect(originalRange[0]).toBe(newCode.indexOf(expectedLine))
@ -322,7 +322,7 @@ describe('testing swapping out sketch calls with xLine/xLineTo while keeping var
callToSwap: 'angledLineOfYLength([222, angledLineOfYLengthY], %)',
constraintType: 'vertical',
})
const expectedLine = 'yLine(-angledLineOfYLengthY, %)'
const expectedLine = 'yLine(length = -angledLineOfYLengthY)'
expect(newCode).toContain(expectedLine)
// new line should start at the same place as the old line
expect(originalRange[0]).toBe(newCode.indexOf(expectedLine))
@ -333,7 +333,7 @@ describe('testing swapping out sketch calls with xLine/xLineTo while keeping var
callToSwap: 'angledLineToX([330, angledLineToXx], %)',
constraintType: 'horizontal',
})
const expectedLine = 'xLineTo(angledLineToXx, %)'
const expectedLine = 'xLine(endAbsolute = angledLineToXx)'
expect(newCode).toContain(expectedLine)
// new line should start at the same place as the old line
expect(originalRange[0]).toBe(newCode.indexOf(expectedLine))
@ -344,7 +344,7 @@ describe('testing swapping out sketch calls with xLine/xLineTo while keeping var
callToSwap: 'angledLineToY([217, angledLineToYy], %)',
constraintType: 'vertical',
})
const expectedLine = 'yLineTo(angledLineToYy, %)'
const expectedLine = 'yLine(endAbsolute = angledLineToYy)'
expect(newCode).toContain(expectedLine)
// new line should start at the same place as the old line
expect(originalRange[0]).toBe(newCode.indexOf(expectedLine))
@ -366,9 +366,9 @@ describe('testing getSketchSegmentIndexFromSourceRange', () => {
part001 = startSketchOn('XY')
|> startProfileAt([0, 0.04], %) // segment-in-start
|> line(end = [0, 0.4])
|> xLine(3.48, %)
|> xLine(length = 3.48)
|> line(end = [2.14, 1.35]) // normal-segment
|> xLine(3.54, %)`
|> xLine(length = 3.54)`
it('normal case works', async () => {
const execState = await enginelessExecutor(assertParse(code))
const index = code.indexOf('// normal-segment') - 7

View File

@ -94,10 +94,10 @@ export function isSketchVariablesLinked(
to check or it finds a match.
that way it can find fn calls that are linked to each other through variables eg:
const part001 = startSketchAt([0, 0])
|> xLineTo(1.69, %)
|> xLine(endAbsolute = 1.69)
|> line(end = [myVar, 0.38]) // ❗️ <- cursor in this fn call (the primary)
|> line(end = [0.41, baz])
|> xLine(0.91, %)
|> xLine(length = 0.91)
|> angledLine([37, 2], %)
const yo = line(end = [myVar, 0.38], tag = part001)
|> line(end = [1, 1])

View File

@ -21,7 +21,12 @@ import { err } from 'lib/trap'
import { enginelessExecutor } from '../../lib/testHelpers'
import { codeRefFromRange } from './artifactGraph'
import { findKwArg } from 'lang/util'
import { ARG_END, ARG_END_ABSOLUTE } from './sketch'
import {
ARG_END,
ARG_END_ABSOLUTE,
sketchFnIsAbsolute,
sketchFnNameToTooltip,
} from './sketch'
beforeAll(async () => {
await initPromise
@ -59,16 +64,16 @@ describe('testing getConstraintType', () => {
})
const helper2 = getConstraintTypeFromSourceHelper2
it('testing xLine', () => {
expect(helper2(`xLine(5, %)`)).toBe('yRelative')
expect(helper2(`xLine(length = 5)`)).toBe('yRelative')
})
it('testing yLine', () => {
expect(helper2(`yLine(5, %)`)).toBe('xRelative')
expect(helper2(`yLine(length = 5)`)).toBe('xRelative')
})
it('testing xLineTo', () => {
expect(helper2(`xLineTo(5, %)`)).toBe('yAbsolute')
expect(helper2(`xLine(endAbsolute = 5)`)).toBe('yAbsolute')
})
it('testing yLineTo', () => {
expect(helper2(`yLineTo(5, %)`)).toBe('xAbsolute')
expect(helper2(`yLine(endAbsolute = 5)`)).toBe('xAbsolute')
})
})
@ -124,9 +129,14 @@ function getConstraintTypeFromSourceHelper2(
): ReturnType<typeof getConstraintType> | Error {
const ast = assertParse(code)
const arg = (ast.body[0] as any).expression.arguments[0] as Expr
const fnName = (ast.body[0] as any).expression.callee.name as ToolTip
return getConstraintType(arg, fnName, false)
const call = (ast.body[0] as any).expression
const arg = call.arguments[0] as Expr
const fnName = call.callee.name as ToolTip
const correctFnName = sketchFnNameToTooltip(fnName, sketchFnIsAbsolute(call))
if (correctFnName === undefined) {
return new Error(`could not map this ${fnName} call to a tooltip`)
}
return getConstraintType(arg, correctFnName, false)
}
function makeSelections(
@ -254,10 +264,10 @@ part001 = startSketchOn('XY')
|> angledLineOfYLength([myAng, 0.7], %) // ln-angledLineOfYLength-angle should become angledLine
|> angledLineOfYLength([35, myVar], %) // ln-angledLineOfYLength-yRelative use legAngY
|> angledLineOfYLength([305, myVar], %) // ln-angledLineOfYLength-yRelative with angle > 90 use binExp
|> xLine(1.03, %) // ln-xLine-free should sub in segLen
|> yLine(1.04, %) // ln-yLine-free should sub in segLen
|> xLineTo(30, %) // ln-xLineTo-free should convert to xLine
|> yLineTo(20, %) // ln-yLineTo-free should convert to yLine
|> xLine(length = 1.03) // ln-xLine-free should sub in segLen
|> yLine(length = 1.04) // ln-yLine-free should sub in segLen
|> xLine(endAbsolute = 30) // ln-xLineTo-free should convert to xLine
|> yLine(endAbsolute = 20) // ln-yLineTo-free should convert to yLine
`
const expectModifiedScript = `myVar = 3
myVar2 = 5
@ -326,10 +336,10 @@ part001 = startSketchOn('XY')
270 + legAngY(segLen(seg01), myVar),
min(segLen(seg01), myVar)
], %) // ln-angledLineOfYLength-yRelative with angle > 90 use binExp
|> xLine(segLen(seg01), %) // ln-xLine-free should sub in segLen
|> yLine(segLen(seg01), %) // ln-yLine-free should sub in segLen
|> xLine(segLen(seg01), %) // ln-xLineTo-free should convert to xLine
|> yLine(segLen(seg01), %) // ln-yLineTo-free should convert to yLine
|> xLine(length = segLen(seg01)) // ln-xLine-free should sub in segLen
|> yLine(length = segLen(seg01)) // ln-yLine-free should sub in segLen
|> xLine(length = segLen(seg01)) // ln-xLineTo-free should convert to xLine
|> yLine(length = segLen(seg01)) // ln-yLineTo-free should convert to yLine
`
it('should transform the ast', async () => {
const ast = assertParse(inputScript)
@ -400,25 +410,25 @@ myVar3 = -10
part001 = startSketchOn('XY')
|> startProfileAt([0, 0], %)
|> line(endAbsolute = [1, 1])
|> xLine(-6.28, %) // select for horizontal constraint 1
|> xLine(length = -6.28) // select for horizontal constraint 1
|> line(end = [-1.07, myVar]) // select for vertical constraint 1
|> xLine(myVar, %) // select for horizontal constraint 2
|> xLine(length = myVar) // select for horizontal constraint 2
|> line(end = [6.35, -1.12]) // select for vertical constraint 2
|> xLineTo(5, %) // select for horizontal constraint 3
|> xLine(endAbsolute = 5) // select for horizontal constraint 3
|> line(endAbsolute = [3, 11]) // select for vertical constraint 3
|> xLineTo(myVar2, %) // select for horizontal constraint 4
|> xLine(endAbsolute = myVar2) // select for horizontal constraint 4
|> line(endAbsolute = [4.08, myVar2]) // select for vertical constraint 4
|> xLine(-1.22, %) // select for horizontal constraint 5
|> xLine(length = -1.22) // select for horizontal constraint 5
|> angledLine([103, 1.44], %) // select for vertical constraint 5
|> xLine(-myVar, %) // select for horizontal constraint 6
|> xLine(length = -myVar) // select for horizontal constraint 6
|> angledLine([129, myVar], %) // select for vertical constraint 6
|> xLine(-1.05, %) // select for horizontal constraint 7
|> xLine(length = -1.05) // select for horizontal constraint 7
|> angledLineOfYLength([196, 1.11], %) // select for vertical constraint 7
|> xLine(-myVar, %) // select for horizontal constraint 8
|> xLine(length = -myVar) // select for horizontal constraint 8
|> angledLineOfYLength([248, myVar], %) // select for vertical constraint 8
|> xLineTo(-10.92, %) // select for horizontal constraint 9
|> xLine(endAbsolute = -10.92) // select for horizontal constraint 9
|> angledLineToY([223, 7.68], %) // select for vertical constraint 9
|> xLineTo(myVar3, %) // select for horizontal constraint 10
|> xLine(endAbsolute = myVar3) // select for horizontal constraint 10
|> angledLineToY([301, myVar], %) // select for vertical constraint 10
`
const ast = assertParse(inputScript)
@ -461,25 +471,25 @@ part001 = startSketchOn('XY')
|> startProfileAt([0, 0], %)
|> line(endAbsolute = [1, 1])
|> line(end = [-6.28, 1.4]) // select for horizontal constraint 1
|> yLine(myVar, %) // select for vertical constraint 1
|> yLine(length = myVar) // select for vertical constraint 1
|> line(end = [myVar, 4.32]) // select for horizontal constraint 2
|> yLine(-1.12, %) // select for vertical constraint 2
|> yLine(length = -1.12) // select for vertical constraint 2
|> line(endAbsolute = [5, 8]) // select for horizontal constraint 3
|> yLineTo(11, %) // select for vertical constraint 3
|> yLine(endAbsolute = 11) // select for vertical constraint 3
|> line(endAbsolute = [myVar2, 12.63]) // select for horizontal constraint 4
|> yLineTo(myVar2, %) // select for vertical constraint 4
|> yLine(endAbsolute = myVar2) // select for vertical constraint 4
|> angledLine([156, 1.34], %) // select for horizontal constraint 5
|> yLine(1.4, %) // select for vertical constraint 5
|> yLine(length = 1.4) // select for vertical constraint 5
|> angledLine([-178, myVar], %) // select for horizontal constraint 6
|> yLine(myVar, %) // select for vertical constraint 6
|> yLine(length = myVar) // select for vertical constraint 6
|> angledLineOfXLength([237, 1.05], %) // select for horizontal constraint 7
|> yLine(-1.11, %) // select for vertical constraint 7
|> yLine(length = -1.11) // select for vertical constraint 7
|> angledLineOfXLength([194, myVar], %) // select for horizontal constraint 8
|> yLine(-myVar, %) // select for vertical constraint 8
|> yLine(length = -myVar) // select for vertical constraint 8
|> angledLineToX([202, -10.92], %) // select for horizontal constraint 9
|> yLineTo(7.68, %) // select for vertical constraint 9
|> yLine(endAbsolute = 7.68) // select for vertical constraint 9
|> angledLineToX([333, myVar3], %) // select for horizontal constraint 10
|> yLineTo(myVar, %) // select for vertical constraint 10
|> yLine(endAbsolute = myVar) // select for vertical constraint 10
`
const ast = assertParse(inputScript)
@ -627,19 +637,19 @@ halfArmAngle = armAngle / 2
part001 = startSketchOn('XY')
|> startProfileAt([-0.01, -0.05], %)
|> line(end = [0.01, 0.94 + 0]) // partial
|> xLine(3.03, %) // partial
|> xLine(length = 3.03) // partial
|> angledLine({
angle: halfArmAngle,
length: 2.45,
}, %, $seg01bing) // partial
|> xLine(4.4, %) // partial
|> yLine(-1, %) // partial
|> xLine(-4.2 + 0, %) // full
|> xLine(length = 4.4) // partial
|> yLine(length = -1) // partial
|> xLine(length = -4.2 + 0) // full
|> angledLine([segAng(seg01bing) + 180, 1.79], %) // partial
|> line(end = [1.44, -0.74]) // free
|> xLine(3.36, %) // partial
|> xLine(length = 3.36) // partial
|> line(end = [1.49, 1.06]) // free
|> xLine(-3.43 + 0, %) // full
|> xLine(length = -3.43 + 0) // full
|> angledLineOfXLength([243 + 0, 1.2 + 0], %) // full`
const ast = assertParse(code)
const constraintLevels: ConstraintLevel[] = ['full', 'partial', 'free']

View File

@ -51,6 +51,9 @@ import {
ARG_END_ABSOLUTE,
getConstraintInfoKw,
isAbsoluteLine,
ARG_LENGTH,
sketchFnNameToTooltip,
sketchFnIsAbsolute,
} from './sketch'
import {
getSketchSegmentFromPathToNode,
@ -138,7 +141,7 @@ function createCallWrapper(
}
if (tooltip === 'lineTo') {
const labeledArgs = [
createLabeledArg('endAbsolute', createArrayExpression(val)),
createLabeledArg(ARG_END_ABSOLUTE, createArrayExpression(val)),
]
if (tag) {
labeledArgs.push(createLabeledArg(ARG_TAG, tag))
@ -152,6 +155,40 @@ function createCallWrapper(
valueUsedInTransform,
}
}
} else {
// This else branch type narrows 'val' to a scalar.
if (
'xLine' === tooltip ||
'yLine' === tooltip ||
'xLineTo' === tooltip ||
'yLineTo' === tooltip
) {
const [isAbsolute, callee] = (() => {
switch (tooltip) {
case 'xLine':
return [false, 'xLine']
case 'yLine':
return [false, 'yLine']
case 'xLineTo':
return [true, 'xLine']
case 'yLineTo':
return [true, 'yLine']
}
})()
const argLabel = isAbsolute ? ARG_END_ABSOLUTE : ARG_LENGTH
const labeledArgs = [createLabeledArg(argLabel, val)]
if (tag) {
labeledArgs.push(createLabeledArg(ARG_TAG, tag))
}
return {
callExp: createCallExpressionStdLibKw(
callee,
null, // Assumes this is being called in a pipeline, so the first arg is optional and if not given, will become pipeline substitution.
labeledArgs
),
valueUsedInTransform,
}
}
}
const args =
@ -1376,6 +1413,14 @@ export function removeSingleConstraint({
console.error(callExp)
return false
}
const correctFnName = (() => {
switch (callExp.node.type) {
case 'CallExpressionKw': {
const isAbsolute = sketchFnIsAbsolute(callExp.node)
return sketchFnNameToTooltip(callExp.node.callee.name, isAbsolute)
}
}
})()
if (
callExp.node.type !== 'CallExpression' &&
callExp.node.type !== 'CallExpressionKw'
@ -1418,21 +1463,29 @@ export function removeSingleConstraint({
)
} else {
// It's a kw call.
const isAbsolute = callExp.node.callee.name == 'lineTo'
const res: { isAbsolute: boolean; fnName: ToolTip } | undefined =
(() => {
switch (correctFnName) {
case 'lineTo':
return { isAbsolute: true, fnName: 'line' }
case 'line':
return { isAbsolute: false, fnName: 'line' }
}
})()
if (res === undefined) {
return new Error('Unrecognized kw call function ' + correctFnName)
}
const { isAbsolute, fnName } = res
if (isAbsolute) {
const args = [
createLabeledArg(ARG_END_ABSOLUTE, createArrayExpression(values)),
]
return createStdlibCallExpressionKw('line', args, tag)
return createStdlibCallExpressionKw(fnName, args, tag)
} else {
const args = [
createLabeledArg(ARG_END, createArrayExpression(values)),
]
return createStdlibCallExpressionKw(
callExp.node.callee.name as ToolTip,
args,
tag
)
return createStdlibCallExpressionKw(fnName, args, tag)
}
}
}
@ -1550,7 +1603,7 @@ export function removeSingleConstraint({
}
return createCallWrapper(
callExp.node.callee.name as any,
correctFnName || (callExp.node.callee.name as any),
rawArgs[0].expr,
tag
)
@ -1635,7 +1688,18 @@ function getTransformMapPathKw(
return false
}
const isAbsolute = findKwArg(ARG_END_ABSOLUTE, sketchFnExp) !== undefined
const nameAbsolute = name === 'line' ? 'lineTo' : name
const nameAbsolute = (() => {
switch (name) {
case 'line':
return 'lineTo'
case 'xLine':
return 'xLineTo'
case 'yLine':
return 'yLineTo'
default:
return name
}
})()
if (!toolTips.includes(name)) {
return false
}
@ -1708,17 +1772,16 @@ export function getConstraintType(
fnName: ToolTip,
isAbsolute: boolean
): LineInputsType | null {
if (fnName === 'xLine') return 'yRelative'
if (fnName === 'yLine') return 'xRelative'
if (fnName === 'xLineTo') return 'yAbsolute'
if (fnName === 'yLineTo') return 'xAbsolute'
// this function assumes that for two val sketch functions that one arg is locked down not both
// and for one val sketch functions that the arg is NOT locked down
// these conditions should have been checked previously.
// completely locked down or not locked down at all does not depend on the fnName so we can check that first
const isArr = isArray(val)
if (!isArr) {
if (fnName === 'xLine') return 'yRelative'
if (fnName === 'yLine') return 'xRelative'
if (fnName === 'xLineTo') return 'yAbsolute'
if (fnName === 'yLineTo') return 'xAbsolute'
} else {
if (isArr) {
const isFirstArgLockedDown = isNotLiteralArrayOrStatic(val[0])
if (fnName === 'line' && !isAbsolute)
return isFirstArgLockedDown ? 'xRelative' : 'yRelative'
@ -2038,12 +2101,26 @@ export function transformAstSketchLines({
}
const { to, from } = seg
// Note to ADAM: Here is where the replaceExisting call gets sent.
const correctFnName = (() => {
switch (call.node.type) {
case 'CallExpressionKw': {
const fnName = call.node.callee.name as ToolTip
const correctFnName = sketchFnNameToTooltip(
fnName,
sketchFnIsAbsolute(call.node)
)
return correctFnName
}
}
})()
const fnName =
correctFnName || transformTo || (call.node.callee.name as ToolTip)
const replacedSketchLine = replaceSketchLine({
node: node,
variables: memVars,
pathToNode: _pathToNode,
referencedSegment,
fnName: transformTo || (call.node.callee.name as ToolTip),
fnName,
segmentInput:
seg.type === 'Circle'
? {
@ -2154,7 +2231,10 @@ export function getConstraintLevelFromSourceRange(
case 'CallExpression':
return getFirstArg(nodeMeta.node)
case 'CallExpressionKw':
const arg = findKwArgAny([ARG_END, ARG_END_ABSOLUTE], nodeMeta.node)
const arg = findKwArgAny(
[ARG_END, ARG_END_ABSOLUTE, ARG_LENGTH],
nodeMeta.node
)
if (arg === undefined) {
return new Error('unexpected call expression: ' + name)
}

View File

@ -157,10 +157,14 @@ Search the keyword arguments from a call for an argument with one of these label
export function findKwArgAnyIndex(
labels: string[],
call: CallExpressionKw
): number | undefined {
return call.arguments.findIndex((arg) => {
): { expr: Expr; argIndex: number } | undefined {
const argIndex = call.arguments.findIndex((arg) => {
return labels.includes(arg.label.name)
})
if (argIndex < 0) {
return undefined
}
return { expr: call.arguments[argIndex].arg, argIndex }
}
export function isAbsolute(call: CallExpressionKw): boolean {

View File

@ -21,11 +21,11 @@ mountingHoleDiameter = 0.5
sketch001 = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> xLine(shelfMountL - thickness, %, $seg01)
|> yLine(thickness, %, $seg02)
|> xLine(-shelfMountL, %, $seg03)
|> yLine(-wallMountL, %, $seg04)
|> xLine(thickness, %, $seg05)
|> xLine(length = shelfMountL - thickness, tag = $seg01)
|> yLine(length = thickness, tag = $seg02)
|> xLine(length = -shelfMountL, tag = $seg03)
|> yLine(length = -wallMountL, tag = $seg04)
|> xLine(length = thickness, tag = $seg05)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)], tag = $seg06)
|> close()
|> extrude(%, length = width)

View File

@ -16,9 +16,9 @@ beforeAll(async () => {
describe('testing source range to artifact conversion', () => {
const MY_CODE = `sketch001 = startSketchOn('XZ')
profile001 = startProfileAt([105.55, 105.55], sketch001)
|> xLine(332.55, %, $seg01)
|> yLine(-310.12, %, $seg02)
|> xLine(-373.65, %)
|> xLine(length = 332.55, tag = $seg01)
|> yLine(length = -310.12, tag = $seg02)
|> xLine(length = -373.65)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
extrude001 = extrude(profile001, length = 500)
@ -1126,7 +1126,7 @@ profile004 = circle({
[
'segment 2',
{
snippet: 'yLine(-310.12, %, $seg02)',
snippet: 'yLine(length = -310.12, tag = $seg02)',
artifactDetails: {
type: 'segment',
range: [149, 149, 0],

View File

@ -8,13 +8,12 @@ use indexmap::IndexMap;
use itertools::Itertools;
use serde_json::json;
use super::kcl_doc::{ConstData, DocData, FnData};
use crate::{
docs::{is_primitive, StdLibFn},
std::StdLib,
};
use super::kcl_doc::{ConstData, DocData, FnData};
const TYPES_DIR: &str = "../../../docs/kcl/types";
fn init_handlebars() -> Result<handlebars::Handlebars<'static>> {

View File

@ -138,6 +138,7 @@
use std::{collections::HashMap, fmt};
use anyhow::Result;
use env::Environment;
use indexmap::IndexMap;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
@ -147,7 +148,6 @@ use crate::{
execution::KclValue,
source_range::SourceRange,
};
use env::Environment;
/// The distinguished name of the return value of a function.
pub(crate) const RETURN_NAME: &str = "__return";
@ -894,9 +894,8 @@ mod env {
#[cfg(test)]
mod test {
use crate::execution::kcl_value::{FunctionSource, NumericType};
use super::*;
use crate::execution::kcl_value::{FunctionSource, NumericType};
fn sr() -> SourceRange {
SourceRange::default()

View File

@ -3,8 +3,16 @@
use std::{path::PathBuf, sync::Arc};
use anyhow::Result;
pub use artifact::{Artifact, ArtifactCommand, ArtifactGraph, ArtifactId};
use cache::OldAstState;
pub use cache::{bust_cache, clear_mem_cache};
pub use cad_op::Operation;
pub use geometry::*;
pub(crate) use import::{
import_foreign, send_to_engine as send_import_to_engine, PreImportedGeometry, ZOO_COORD_SYSTEM,
};
use indexmap::IndexMap;
pub use kcl_value::{KclObjectFields, KclValue, UnitAngle, UnitLen};
use kcmc::{
each_cmd as mcmd,
ok_response::{output::TakeSnapshot, OkModelingCmdResponse},
@ -12,8 +20,10 @@ use kcmc::{
ImageFormat, ModelingCmd,
};
use kittycad_modeling_cmds as kcmc;
pub use memory::EnvironmentRef;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
pub use state::{ExecState, IdGenerator, MetaSettings};
use crate::{
engine::EngineManager,
@ -30,17 +40,6 @@ use crate::{
CompilationError, ExecError, ExecutionKind, KclErrorWithOutputs,
};
pub use artifact::{Artifact, ArtifactCommand, ArtifactGraph, ArtifactId};
pub use cache::{bust_cache, clear_mem_cache};
pub use cad_op::Operation;
pub use geometry::*;
pub(crate) use import::{
import_foreign, send_to_engine as send_import_to_engine, PreImportedGeometry, ZOO_COORD_SYSTEM,
};
pub use kcl_value::{KclObjectFields, KclValue, UnitAngle, UnitLen};
pub use memory::EnvironmentRef;
pub use state::{ExecState, IdGenerator, MetaSettings};
pub(crate) mod annotations;
mod artifact;
pub(crate) mod cache;
@ -988,8 +987,8 @@ const objExpShouldNotBeIncluded = { a: 1, b: 2, c: 3 }
const part001 = startSketchOn('XY')
|> startProfileAt([0, 0], %)
|> yLineTo(1, %)
|> xLine(3.84, %) // selection-range-7ish-before-this
|> yLine(endAbsolute = 1)
|> xLine(length = 3.84) // selection-range-7ish-before-this
const variableBelowShouldNotBeIncluded = 3
"#;
@ -1723,9 +1722,9 @@ let w = f() + f()
async fn kcl_test_ids_stable_between_executions() {
let code = r#"sketch001 = startSketchOn('XZ')
|> startProfileAt([61.74, 206.13], %)
|> xLine(305.11, %, $seg01)
|> yLine(-291.85, %)
|> xLine(-segLen(seg01), %)
|> xLine(length = 305.11, tag = $seg01)
|> yLine(length = -291.85)
|> xLine(length = -segLen(seg01))
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> extrude(length = 40.14)
@ -1748,9 +1747,9 @@ let w = f() + f()
let code = r#"sketch001 = startSketchOn('XZ')
|> startProfileAt([62.74, 206.13], %)
|> xLine(305.11, %, $seg01)
|> yLine(-291.85, %)
|> xLine(-segLen(seg01), %)
|> xLine(length = 305.11, tag = $seg01)
|> yLine(length = -291.85)
|> xLine(length = -segLen(seg01))
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> extrude(length = 40.14)
@ -1774,9 +1773,9 @@ let w = f() + f()
async fn kcl_test_changing_a_setting_updates_the_cached_state() {
let code = r#"sketch001 = startSketchOn('XZ')
|> startProfileAt([61.74, 206.13], %)
|> xLine(305.11, %, $seg01)
|> yLine(-291.85, %)
|> xLine(-segLen(seg01), %)
|> xLine(length = 305.11, tag = $seg01)
|> yLine(length = -291.85)
|> xLine(length = -segLen(seg01))
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> extrude(length = 40.14)

View File

@ -3581,11 +3581,11 @@ const cylinder = startSketchOn('-XZ')
fn test_ast_get_non_code_node_inline_comment() {
let some_program_string = r#"const part001 = startSketchOn('XY')
|> startProfileAt([0,0], %)
|> xLine(5, %) // lin
|> xLine(length = 5) // lin
"#;
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
let value = program.get_non_code_meta_for_position(86);
let value = program.get_non_code_meta_for_position(92);
assert!(value.is_some());
}

View File

@ -4202,7 +4202,7 @@ e
/// angle = 30,
/// length = 3 / cos(toRadians(30)),
/// }, %)
/// |> yLineTo(0, %)
/// |> yLine(endAbsolute = 0)
/// |> close(%)
///
/// example = extrude(5, exampleSketch)

View File

@ -108,7 +108,7 @@ pub async fn sqrt(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
/// angle = 50,
/// length = sqrt(2500),
/// }, %)
/// |> yLineTo(0, %)
/// |> yLine(endAbsolute = 0)
/// |> close()
///
/// example = extrude(exampleSketch, length = 5)
@ -173,7 +173,7 @@ pub async fn round(_exec_state: &mut ExecState, args: Args) -> Result<KclValue,
/// |> startProfileAt([0, 0], %)
/// |> line(endAbsolute = [12, 10])
/// |> line(end = [round(7.02986), 0])
/// |> yLineTo(0, %)
/// |> yLine(endAbsolute = 0)
/// |> close()
///
/// extrude001 = extrude(sketch001, length = 5)
@ -201,7 +201,7 @@ pub async fn floor(_exec_state: &mut ExecState, args: Args) -> Result<KclValue,
/// |> startProfileAt([0, 0], %)
/// |> line(endAbsolute = [12, 10])
/// |> line(end = [floor(7.02986), 0])
/// |> yLineTo(0, %)
/// |> yLine(endAbsolute = 0)
/// |> close()
///
/// extrude001 = extrude(sketch001, length = 5)
@ -229,7 +229,7 @@ pub async fn ceil(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
/// |> startProfileAt([0, 0], %)
/// |> line(endAbsolute = [12, 10])
/// |> line(end = [ceil(7.02986), 0])
/// |> yLineTo(0, %)
/// |> yLine(endAbsolute = 0)
/// |> close()
///
/// extrude001 = extrude(sketch001, length = 5)
@ -347,7 +347,7 @@ pub async fn pow(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
/// angle = 50,
/// length = pow(5, 2),
/// }, %)
/// |> yLineTo(0, %)
/// |> yLine(endAbsolute = 0)
/// |> close()
///
/// example = extrude(exampleSketch, length = 5)
@ -408,7 +408,7 @@ pub async fn asin(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
/// angle = toDegrees(asin(0.5)),
/// length = 20,
/// }, %)
/// |> yLineTo(0, %)
/// |> yLine(endAbsolute = 0)
/// |> close()
///
/// extrude001 = extrude(sketch001, length = 5)
@ -438,7 +438,7 @@ pub async fn atan(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
/// angle = toDegrees(atan(1.25)),
/// length = 20,
/// }, %)
/// |> yLineTo(0, %)
/// |> yLine(endAbsolute = 0)
/// |> close()
///
/// extrude001 = extrude(sketch001, length = 5)
@ -468,7 +468,7 @@ pub async fn atan2(_exec_state: &mut ExecState, args: Args) -> Result<KclValue,
/// angle = toDegrees(atan2(1.25, 2)),
/// length = 20,
/// }, %)
/// |> yLineTo(0, %)
/// |> yLine(endAbsolute = 0)
/// |> close()
///
/// extrude001 = extrude(sketch001, length = 5)
@ -632,7 +632,7 @@ pub async fn e(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclE
/// angle = 30,
/// length = 2 * e() ^ 2,
/// }, %)
/// |> yLineTo(0, %)
/// |> yLine(endAbsolute = 0)
/// |> close()
///
/// example = extrude(exampleSketch, length = 10)
@ -664,7 +664,7 @@ pub async fn tau(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
/// angle = 50,
/// length = 10 * tau(),
/// }, %)
/// |> yLineTo(0, %)
/// |> yLine(endAbsolute = 0)
/// |> close()
///
/// example = extrude(exampleSketch, length = 5)
@ -695,7 +695,7 @@ pub async fn to_radians(_exec_state: &mut ExecState, args: Args) -> Result<KclVa
/// angle = 50,
/// length = 70 * cos(toRadians(45)),
/// }, %)
/// |> yLineTo(0, %)
/// |> yLine(endAbsolute = 0)
/// |> close()
///
/// example = extrude(exampleSketch, length = 5)
@ -725,7 +725,7 @@ pub async fn to_degrees(_exec_state: &mut ExecState, args: Args) -> Result<KclVa
/// angle = 50,
/// length = 70 * cos(toDegrees(pi()/4)),
/// }, %)
/// |> yLineTo(0, %)
/// |> yLine(endAbsolute = 0)
/// |> close()
///
/// example = extrude(exampleSketch, length = 5)

View File

@ -72,9 +72,7 @@ lazy_static! {
Box::new(crate::std::shapes::CircleThreePoint),
Box::new(crate::std::shapes::Polygon),
Box::new(crate::std::sketch::Line),
Box::new(crate::std::sketch::XLineTo),
Box::new(crate::std::sketch::XLine),
Box::new(crate::std::sketch::YLineTo),
Box::new(crate::std::sketch::YLine),
Box::new(crate::std::sketch::AngledLineToX),
Box::new(crate::std::sketch::AngledLineToY),

View File

@ -657,9 +657,8 @@ impl GeometryTrait for Box<Solid> {
#[cfg(test)]
mod tests {
use crate::execution::kcl_value::NumericType;
use super::*;
use crate::execution::kcl_value::NumericType;
#[test]
fn test_array_to_point3d() {

View File

@ -4,14 +4,13 @@ use derive_docs::stdlib;
use kcmc::{each_cmd as mcmd, length_unit::LengthUnit, shared::Color, ModelingCmd};
use kittycad_modeling_cmds as kcmc;
use super::sketch::PlaneData;
use crate::{
errors::KclError,
execution::{ExecState, KclValue, Plane, PlaneType},
std::Args,
};
use super::sketch::PlaneData;
/// Offset a plane by a distance along its normal.
pub async fn offset_plane(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
let std_plane = args.get_unlabeled_kw_arg("plane")?;

View File

@ -657,7 +657,7 @@ pub async fn angle_to_match_length_y(exec_state: &mut ExecState, args: Args) ->
/// angle = angleToMatchLengthY(seg01, 15, %),
/// length = 5,
/// }, %)
/// |> yLineTo(0, %)
/// |> yLine(endAbsolute = 0)
/// |> close()
///
/// extrusion = extrude(sketch001, length = 5)

View File

@ -95,7 +95,6 @@ pub const NEW_TAG_KW: &str = "tag";
/// Draw a line to a point.
pub async fn line(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
// let (to, sketch, tag): ([f64; 2], Sketch, Option<TagNode>) = args.get_data_and_sketch_and_tag()?;
let sketch = args.get_unlabeled_kw_arg("sketch")?;
let end = args.get_kw_arg_opt("end")?;
let end_absolute = args.get_kw_arg_opt("endAbsolute")?;
@ -260,152 +259,87 @@ async fn straight_line(
Ok(new_sketch)
}
/// Draw a line to a point on the x-axis.
pub async fn x_line_to(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
let (to, sketch, tag): (f64, Sketch, Option<TagNode>) = args.get_data_and_sketch_and_tag()?;
let new_sketch = inner_x_line_to(to, sketch, tag, exec_state, args).await?;
Ok(KclValue::Sketch {
value: Box::new(new_sketch),
})
}
/// Draw a line parallel to the X axis, that ends at the given X.
/// E.g. if the previous line ended at (1, 1),
/// then xLineTo(4) draws a line from (1, 1) to (4, 1)
///
/// ```no_run
/// exampleSketch = startSketchOn('XZ')
/// |> startProfileAt([0, 0], %)
/// |> xLineTo(15, %)
/// |> angledLine({
/// angle = 80,
/// length = 15,
/// }, %)
/// |> line(end = [8, -10])
/// |> xLineTo(40, %)
/// |> angledLine({
/// angle = 135,
/// length = 30,
/// }, %)
/// |> xLineTo(10, %)
/// |> close()
///
/// example = extrude(exampleSketch, length = 10)
/// ```
#[stdlib {
name = "xLineTo",
}]
async fn inner_x_line_to(
to: f64,
sketch: Sketch,
tag: Option<TagNode>,
exec_state: &mut ExecState,
args: Args,
) -> Result<Sketch, KclError> {
let from = sketch.current_pen_position()?;
let new_sketch = straight_line(
StraightLineParams::absolute([to, from.y], sketch, tag),
exec_state,
args,
)
.await?;
Ok(new_sketch)
}
/// Draw a line to a point on the y-axis.
pub async fn y_line_to(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
let (to, sketch, tag): (f64, Sketch, Option<TagNode>) = args.get_data_and_sketch_and_tag()?;
let new_sketch = inner_y_line_to(to, sketch, tag, exec_state, args).await?;
Ok(KclValue::Sketch {
value: Box::new(new_sketch),
})
}
/// Draw a line parallel to the Y axis, that ends at the given Y.
/// E.g. if the previous line ended at (1, 1),
/// then yLineTo(4) draws a line from (1, 1) to (1, 4)
///
/// ```no_run
/// exampleSketch = startSketchOn("XZ")
/// |> startProfileAt([0, 0], %)
/// |> angledLine({
/// angle = 50,
/// length = 45,
/// }, %)
/// |> yLineTo(0, %)
/// |> close()
///
/// example = extrude(exampleSketch, length = 5)
/// ```
#[stdlib {
name = "yLineTo",
}]
async fn inner_y_line_to(
to: f64,
sketch: Sketch,
tag: Option<TagNode>,
exec_state: &mut ExecState,
args: Args,
) -> Result<Sketch, KclError> {
let from = sketch.current_pen_position()?;
let new_sketch = straight_line(
StraightLineParams::absolute([from.x, to], sketch, tag),
exec_state,
args,
)
.await?;
Ok(new_sketch)
}
/// Draw a line on the x-axis.
pub async fn x_line(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
let (length, sketch, tag): (f64, Sketch, Option<TagNode>) = args.get_data_and_sketch_and_tag()?;
let sketch = args.get_unlabeled_kw_arg("sketch")?;
let length = args.get_kw_arg_opt("length")?;
let end_absolute = args.get_kw_arg_opt("endAbsolute")?;
let tag = args.get_kw_arg_opt(NEW_TAG_KW)?;
let new_sketch = inner_x_line(length, sketch, tag, exec_state, args).await?;
let new_sketch = inner_x_line(sketch, length, end_absolute, tag, exec_state, args).await?;
Ok(KclValue::Sketch {
value: Box::new(new_sketch),
})
}
/// Draw a line relative to the current origin to a specified distance away
/// from the current position along the 'x' axis.
/// Draw a line from current point, along the X axis. You can either specify
/// this line's length, or which X it should end at.
///
/// ```no_run
/// exampleSketch = startSketchOn('XZ')
/// |> startProfileAt([0, 0], %)
/// |> xLine(15, %)
/// |> xLine(length = 15)
/// |> angledLine({
/// angle = 80,
/// length = 15,
/// }, %)
/// |> line(end = [8, -10])
/// |> xLine(10, %)
/// |> xLine(length = 10)
/// |> angledLine({
/// angle = 120,
/// length = 30,
/// }, %)
/// |> xLine(-15, %)
/// |> xLine(length = -15)
/// |> close()
///
/// example = extrude(exampleSketch, length = 10)
/// ```
/// ```no_run
/// exampleSketch = startSketchOn('XZ')
/// |> startProfileAt([0, 0], %)
/// |> xLine(endAbsolute = 15)
/// |> angledLine({
/// angle = 80,
/// length = 15,
/// }, %)
/// |> line(end = [8, -10])
/// |> xLine(length = 40)
/// |> angledLine({
/// angle = 135,
/// length = 30,
/// }, %)
/// |> xLine(length = 10)
/// |> close()
///
/// example = extrude(exampleSketch, length = 10)
/// ```
#[stdlib {
name = "xLine",
keywords = true,
unlabeled_first = true,
args = {
sketch = { docs = "Which sketch should this path be added to?"},
length = { docs = "How far away along the X axis should this line go? Incompatible with `endAbsolute`.", include_in_snippet = true},
end_absolute = { docs = "Which absolute X value should this line go to? Incompatible with `length`."},
tag = { docs = "Create a new tag which refers to this line"},
}
}]
async fn inner_x_line(
length: f64,
sketch: Sketch,
length: Option<f64>,
end_absolute: Option<f64>,
tag: Option<TagNode>,
exec_state: &mut ExecState,
args: Args,
) -> Result<Sketch, KclError> {
let from = sketch.current_pen_position()?;
straight_line(
StraightLineParams::relative([length, 0.0], sketch, tag),
StraightLineParams {
sketch,
end_absolute: end_absolute.map(|x| [x, from.y]),
end: length.map(|x| [x, 0.0]),
tag,
},
exec_state,
args,
)
@ -414,9 +348,12 @@ async fn inner_x_line(
/// Draw a line on the y-axis.
pub async fn y_line(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
let (length, sketch, tag): (f64, Sketch, Option<TagNode>) = args.get_data_and_sketch_and_tag()?;
let sketch = args.get_unlabeled_kw_arg("sketch")?;
let length = args.get_kw_arg_opt("length")?;
let end_absolute = args.get_kw_arg_opt("endAbsolute")?;
let tag = args.get_kw_arg_opt(NEW_TAG_KW)?;
let new_sketch = inner_y_line(length, sketch, tag, exec_state, args).await?;
let new_sketch = inner_y_line(sketch, length, end_absolute, tag, exec_state, args).await?;
Ok(KclValue::Sketch {
value: Box::new(new_sketch),
})
@ -428,29 +365,56 @@ pub async fn y_line(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
/// ```no_run
/// exampleSketch = startSketchOn('XZ')
/// |> startProfileAt([0, 0], %)
/// |> yLine(15, %)
/// |> yLine(length = 15)
/// |> angledLine({
/// angle = 30,
/// length = 15,
/// }, %)
/// |> line(end = [8, -10])
/// |> yLine(-5, %)
/// |> yLine(length = -5)
/// |> close()
///
/// example = extrude(exampleSketch, length = 10)
/// ```
/// ```no_run
/// exampleSketch = startSketchOn("XZ")
/// |> startProfileAt([0, 0], %)
/// |> angledLine({
/// angle = 50,
/// length = 45,
/// }, %)
/// |> yLine(endAbsolute = 0)
/// |> close()
///
/// example = extrude(exampleSketch, length = 5)
/// ```
#[stdlib {
name = "yLine",
keywords = true,
unlabeled_first = true,
args = {
sketch = { docs = "Which sketch should this path be added to?"},
length = { docs = "How far away along the Y axis should this line go? Incompatible with `endAbsolute`.", include_in_snippet = true},
end_absolute = { docs = "Which absolute Y value should this line go to? Incompatible with `length`."},
tag = { docs = "Create a new tag which refers to this line"},
}
}]
async fn inner_y_line(
length: f64,
sketch: Sketch,
length: Option<f64>,
end_absolute: Option<f64>,
tag: Option<TagNode>,
exec_state: &mut ExecState,
args: Args,
) -> Result<Sketch, KclError> {
let from = sketch.current_pen_position()?;
straight_line(
StraightLineParams::relative([0.0, length], sketch, tag),
StraightLineParams {
sketch,
end_absolute: end_absolute.map(|y| [from.x, y]),
end: length.map(|y| [0.0, y]),
tag,
},
exec_state,
args,
)
@ -489,13 +453,13 @@ pub async fn angled_line(exec_state: &mut ExecState, args: Args) -> Result<KclVa
/// ```no_run
/// exampleSketch = startSketchOn('XZ')
/// |> startProfileAt([0, 0], %)
/// |> yLineTo(15, %)
/// |> yLine(endAbsolute = 15)
/// |> angledLine({
/// angle = 30,
/// length = 15,
/// }, %)
/// |> line(end = [8, -10])
/// |> yLineTo(0, %)
/// |> yLine(endAbsolute = 0)
/// |> close()
///
/// example = extrude(exampleSketch, length = 10)
@ -1120,9 +1084,9 @@ pub async fn start_sketch_on(exec_state: &mut ExecState, args: Args) -> Result<K
/// })
/// |> startProfileAt([0, 0], %)
/// |> line(end = [100.0, 0])
/// |> yLine(-100.0, %)
/// |> xLine(-100.0, %)
/// |> yLine(100.0, %)
/// |> yLine(length = -100.0)
/// |> xLine(length = -100.0)
/// |> yLine(length = 100.0)
/// |> close()
/// |> extrude(length = 3.14)
/// ```

View File

@ -949,9 +949,9 @@ d = 1
fn rect(x, y, w, h) {
startSketchOn('XY')
|> startProfileAt([x, y], %)
|> xLine(w, %)
|> yLine(h, %)
|> xLine(-w, %)
|> xLine(length = w)
|> yLine(length = h)
|> xLine(length = -w)
|> close()
|> extrude(d, %)
}
@ -969,11 +969,11 @@ fn quad(x1, y1, x2, y2, x3, y3, x4, y4) {
fn crosshair(x, y) {
startSketchOn('XY')
|> startProfileAt([x, y], %)
|> yLine(1, %)
|> yLine(-2, %)
|> yLine(1, %)
|> xLine(1, %)
|> xLine(-2, %)
|> yLine(length = 1)
|> yLine(length = -2)
|> yLine(length = 1)
|> xLine(length = 1)
|> xLine(length = -2)
}
fn z(z_x, z_y) {

View File

@ -21,7 +21,7 @@ export PI = 3.14159265358979323846264338327950288_
/// angle = 30,
/// length = 2 * E ^ 2,
/// }, %)
/// |> yLineTo(0, %)
/// |> yLine(endAbsolute = 0)
/// |> close()
///
/// example = extrude(exampleSketch, length = 10)
@ -37,7 +37,7 @@ export E = 2.71828182845904523536028747135266250_
/// angle = 50,
/// length = 10 * TAU,
/// }, %)
/// |> yLineTo(0, %)
/// |> yLine(endAbsolute = 0)
/// |> close()
///
/// example = extrude(exampleSketch, length = 5)
@ -53,7 +53,7 @@ export TAU = 6.28318530717958647692528676655900577_
/// angle = 30,
/// length = 3 / cos(toRadians(30)),
/// }, %)
/// |> yLineTo(0, %)
/// |> yLine(endAbsolute = 0)
/// |> close()
///
/// example = extrude(exampleSketch, length = 5)
@ -70,7 +70,7 @@ export fn cos(num: number(rad)): number(_) {}
/// angle = 50,
/// length = 15 / sin(toDegrees(135)),
/// }, %)
/// |> yLineTo(0, %)
/// |> yLine(endAbsolute = 0)
/// |> close()
///
/// example = extrude(exampleSketch, length = 5)
@ -87,7 +87,7 @@ export fn sin(num: number(rad)): number(_) {}
/// angle = 50,
/// length = 50 * tan(1/2),
/// }, %)
/// |> yLineTo(0, %)
/// |> yLine(endAbsolute = 0)
/// |> close()
///
/// example = extrude(exampleSketch, length = 5)

File diff suppressed because it is too large Load Diff

View File

@ -4,47 +4,47 @@ flowchart LR
2["Path<br>[399, 432, 0]"]
3["Segment<br>[438, 478, 0]"]
4["Segment<br>[484, 542, 0]"]
5["Segment<br>[548, 578, 0]"]
6["Segment<br>[584, 643, 0]"]
7["Segment<br>[649, 708, 0]"]
8["Segment<br>[714, 773, 0]"]
9["Segment<br>[779, 831, 0]"]
10["Segment<br>[837, 895, 0]"]
11["Segment<br>[901, 937, 0]"]
12["Segment<br>[943, 1001, 0]"]
13["Segment<br>[1007, 1037, 0]"]
14["Segment<br>[1043, 1102, 0]"]
15["Segment<br>[1108, 1171, 0]"]
16["Segment<br>[1177, 1237, 0]"]
17["Segment<br>[1243, 1276, 0]"]
18["Segment<br>[1282, 1341, 0]"]
19["Segment<br>[1347, 1383, 0]"]
20["Segment<br>[1389, 1448, 0]"]
21["Segment<br>[1454, 1509, 0]"]
22["Segment<br>[1515, 1575, 0]"]
23["Segment<br>[1581, 1705, 0]"]
24["Segment<br>[1711, 1771, 0]"]
25["Segment<br>[1777, 1810, 0]"]
26["Segment<br>[1816, 1875, 0]"]
27["Segment<br>[1881, 1889, 0]"]
5["Segment<br>[548, 584, 0]"]
6["Segment<br>[590, 649, 0]"]
7["Segment<br>[655, 720, 0]"]
8["Segment<br>[726, 785, 0]"]
9["Segment<br>[791, 849, 0]"]
10["Segment<br>[855, 913, 0]"]
11["Segment<br>[919, 961, 0]"]
12["Segment<br>[967, 1025, 0]"]
13["Segment<br>[1031, 1067, 0]"]
14["Segment<br>[1073, 1132, 0]"]
15["Segment<br>[1138, 1207, 0]"]
16["Segment<br>[1213, 1273, 0]"]
17["Segment<br>[1279, 1318, 0]"]
18["Segment<br>[1324, 1383, 0]"]
19["Segment<br>[1389, 1431, 0]"]
20["Segment<br>[1437, 1496, 0]"]
21["Segment<br>[1502, 1563, 0]"]
22["Segment<br>[1569, 1629, 0]"]
23["Segment<br>[1635, 1765, 0]"]
24["Segment<br>[1771, 1831, 0]"]
25["Segment<br>[1837, 1876, 0]"]
26["Segment<br>[1882, 1941, 0]"]
27["Segment<br>[1947, 1955, 0]"]
28[Solid2d]
end
subgraph path30 [Path]
30["Path<br>[1899, 1920, 0]"]
31["Segment<br>[1926, 1939, 0]"]
32["Segment<br>[1945, 2003, 0]"]
33["Segment<br>[2009, 2045, 0]"]
34["Segment<br>[2051, 2110, 0]"]
35["Segment<br>[2116, 2130, 0]"]
36["Segment<br>[2136, 2196, 0]"]
37["Segment<br>[2202, 2241, 0]"]
38["Segment<br>[2247, 2306, 0]"]
39["Segment<br>[2312, 2320, 0]"]
30["Path<br>[1965, 1986, 0]"]
31["Segment<br>[1992, 2011, 0]"]
32["Segment<br>[2017, 2075, 0]"]
33["Segment<br>[2081, 2123, 0]"]
34["Segment<br>[2129, 2188, 0]"]
35["Segment<br>[2194, 2214, 0]"]
36["Segment<br>[2220, 2280, 0]"]
37["Segment<br>[2286, 2331, 0]"]
38["Segment<br>[2337, 2396, 0]"]
39["Segment<br>[2402, 2410, 0]"]
40[Solid2d]
end
1["Plane<br>[399, 432, 0]"]
29["Plane<br>[1899, 1920, 0]"]
41["Sweep Extrusion<br>[2366, 2387, 0]"]
29["Plane<br>[1965, 1986, 0]"]
41["Sweep Extrusion<br>[2456, 2477, 0]"]
42[Wall]
43[Wall]
44[Wall]

File diff suppressed because it is too large Load Diff

View File

@ -10,38 +10,38 @@ corner_radius = 5.0
brace_base = startSketchAt([corner_radius, 0])
|> line(end = [width - corner_radius, 0.0])
|> tangentialArcToRelative([corner_radius, corner_radius], %)
|> yLine(25.0 - corner_radius, %)
|> yLine(length = 25.0 - corner_radius)
|> tangentialArcToRelative([-corner_radius, corner_radius], %)
|> xLine(-(d_wrist_circumference[0] - (corner_radius * 2)), %)
|> xLine(length = -(d_wrist_circumference[0] - (corner_radius * 2)))
|> tangentialArcToRelative([-corner_radius, corner_radius], %)
|> yLine(length - 25.0 - 23.0 - (corner_radius * 2), %)
|> yLine(length = length - 25.0 - 23.0 - (corner_radius * 2))
|> tangentialArcToRelative([corner_radius, corner_radius], %)
|> xLine(15.0 - (corner_radius * 2), %)
|> xLine(length = 15.0 - (corner_radius * 2))
|> tangentialArcToRelative([corner_radius, corner_radius], %)
|> yLine(23.0 - corner_radius, %)
|> yLine(length = 23.0 - corner_radius)
|> tangentialArcToRelative([-corner_radius, corner_radius], %)
|> xLine(-(hand_thickness + 15.0 + 15.0 - (corner_radius * 2)), %)
|> xLine(length = -(hand_thickness + 15.0 + 15.0 - (corner_radius * 2)))
|> tangentialArcToRelative([-corner_radius, -corner_radius], %)
|> yLine(-(23.0 - corner_radius), %)
|> yLine(length = -(23.0 - corner_radius))
|> tangentialArcToRelative([corner_radius, -corner_radius], %)
|> xLine(15.0 - (corner_radius * 2), %)
|> xLine(length = 15.0 - (corner_radius * 2))
|> tangentialArcToRelative([corner_radius, -corner_radius], %)
|> yLine(-(length - 25.0 - 23.0 - (corner_radius * 2)), %)
|> yLine(length = -(length - 25.0 - 23.0 - (corner_radius * 2)))
|> tangentialArcToRelative([-corner_radius, -corner_radius], %)
|> xLine(-(d_wrist_circumference[1] + d_wrist_circumference[2] + d_wrist_circumference[3] - hand_thickness - corner_radius), %)
|> xLine(length = -(d_wrist_circumference[1] + d_wrist_circumference[2] + d_wrist_circumference[3] - hand_thickness - corner_radius))
|> tangentialArcToRelative([-corner_radius, -corner_radius], %)
|> yLine(-(25.0 - corner_radius), %)
|> yLine(length = -(25.0 - corner_radius))
|> tangentialArcToRelative([corner_radius, -corner_radius], %)
|> close(%)
inner = startSketchAt([0, 0])
|> xLine(1.0, %)
|> xLine(length = 1.0)
|> tangentialArcToRelative([corner_radius, corner_radius], %)
|> yLine(25.0 - (corner_radius * 2), %)
|> yLine(length = 25.0 - (corner_radius * 2))
|> tangentialArcToRelative([-corner_radius, corner_radius], %)
|> xLine(-1.0, %)
|> xLine(length = -1.0)
|> tangentialArcToRelative([-corner_radius, -corner_radius], %)
|> yLine(-(25.0 - (corner_radius * 2)), %)
|> yLine(length = -(25.0 - (corner_radius * 2)))
|> tangentialArcToRelative([corner_radius, -corner_radius], %)
|> close(%)

View File

@ -14,8 +14,8 @@ snapshot_kind: text
}
},
"sourceRange": [
2351,
2356,
2441,
2446,
0
]
},
@ -27,16 +27,16 @@ snapshot_kind: text
}
},
"sourceRange": [
2358,
2359,
2448,
2449,
0
]
}
},
"name": "hole",
"sourceRange": [
2346,
2360,
2436,
2450,
0
],
"type": "StdLibCall",
@ -59,16 +59,16 @@ snapshot_kind: text
}
},
"sourceRange": [
2383,
2386,
2473,
2476,
0
]
}
},
"name": "extrude",
"sourceRange": [
2366,
2387,
2456,
2477,
0
],
"type": "StdLibCall",

View File

@ -1,6 +1,7 @@
---
source: kcl/src/simulation_tests.rs
description: Variables in memory after executing i_shape.kcl
snapshot_kind: text
---
{
"brace_base": {
@ -65,7 +66,7 @@ description: Variables in memory after executing i_shape.kcl
"id": "[uuid]",
"sourceRange": [
548,
578,
584,
0
]
},
@ -87,8 +88,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
584,
643,
590,
649,
0
]
},
@ -115,8 +116,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
649,
708,
655,
720,
0
]
},
@ -138,8 +139,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
714,
773,
726,
785,
0
]
},
@ -166,8 +167,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
779,
831,
791,
849,
0
]
},
@ -189,8 +190,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
837,
895,
855,
913,
0
]
},
@ -217,8 +218,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
901,
937,
919,
961,
0
]
},
@ -240,8 +241,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
943,
1001,
967,
1025,
0
]
},
@ -268,8 +269,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
1007,
1037,
1031,
1067,
0
]
},
@ -291,8 +292,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
1043,
1102,
1073,
1132,
0
]
},
@ -319,8 +320,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
1108,
1171,
1138,
1207,
0
]
},
@ -342,8 +343,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
1177,
1237,
1213,
1273,
0
]
},
@ -370,8 +371,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
1243,
1276,
1279,
1318,
0
]
},
@ -393,49 +394,26 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
1282,
1341,
0
]
},
"ccw": true,
"center": [
16.60000000000001,
107.0
],
"from": [
11.6,
107.0
],
"tag": null,
"to": [
16.6,
102.0
],
"type": "TangentialArcTo",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
1347,
1324,
1383,
0
]
},
"ccw": true,
"center": [
16.60000000000001,
107.0
],
"from": [
16.6,
102.0
11.6,
107.0
],
"tag": null,
"to": [
21.6,
16.6,
102.0
],
"type": "ToPoint",
"type": "TangentialArcTo",
"units": {
"type": "Mm"
}
@ -445,7 +423,30 @@ description: Variables in memory after executing i_shape.kcl
"id": "[uuid]",
"sourceRange": [
1389,
1448,
1431,
0
]
},
"from": [
16.6,
102.0
],
"tag": null,
"to": [
21.6,
102.0
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
1437,
1496,
0
]
},
@ -472,8 +473,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
1454,
1509,
1502,
1563,
0
]
},
@ -495,8 +496,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
1515,
1575,
1569,
1629,
0
]
},
@ -523,8 +524,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
1581,
1705,
1635,
1765,
0
]
},
@ -546,8 +547,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
1711,
1771,
1831,
0
]
},
@ -574,8 +575,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
1777,
1810,
1837,
1876,
0
]
},
@ -597,8 +598,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
1816,
1875,
1882,
1941,
0
]
},
@ -625,8 +626,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
1881,
1889,
1947,
1955,
0
]
},
@ -871,40 +872,18 @@ description: Variables in memory after executing i_shape.kcl
"id": "[uuid]",
"sourceRange": [
548,
578,
0
],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
584,
643,
0
],
"tag": null,
"type": "extrudeArc"
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
590,
649,
708,
0
],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
714,
773,
0
],
"tag": null,
@ -914,8 +893,8 @@ description: Variables in memory after executing i_shape.kcl
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
779,
831,
655,
720,
0
],
"tag": null,
@ -925,8 +904,8 @@ description: Variables in memory after executing i_shape.kcl
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
837,
895,
726,
785,
0
],
"tag": null,
@ -936,8 +915,8 @@ description: Variables in memory after executing i_shape.kcl
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
901,
937,
791,
849,
0
],
"tag": null,
@ -947,8 +926,8 @@ description: Variables in memory after executing i_shape.kcl
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
943,
1001,
855,
913,
0
],
"tag": null,
@ -958,8 +937,8 @@ description: Variables in memory after executing i_shape.kcl
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
1007,
1037,
919,
961,
0
],
"tag": null,
@ -969,8 +948,8 @@ description: Variables in memory after executing i_shape.kcl
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
1043,
1102,
967,
1025,
0
],
"tag": null,
@ -980,8 +959,8 @@ description: Variables in memory after executing i_shape.kcl
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
1108,
1171,
1031,
1067,
0
],
"tag": null,
@ -991,8 +970,8 @@ description: Variables in memory after executing i_shape.kcl
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
1177,
1237,
1073,
1132,
0
],
"tag": null,
@ -1002,8 +981,8 @@ description: Variables in memory after executing i_shape.kcl
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
1243,
1276,
1138,
1207,
0
],
"tag": null,
@ -1013,8 +992,8 @@ description: Variables in memory after executing i_shape.kcl
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
1282,
1341,
1213,
1273,
0
],
"tag": null,
@ -1024,30 +1003,30 @@ description: Variables in memory after executing i_shape.kcl
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
1347,
1279,
1318,
0
],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
1324,
1383,
0
],
"tag": null,
"type": "extrudePlane"
"type": "extrudeArc"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
1389,
1448,
0
],
"tag": null,
"type": "extrudeArc"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
1454,
1509,
1431,
0
],
"tag": null,
@ -1057,8 +1036,8 @@ description: Variables in memory after executing i_shape.kcl
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
1515,
1575,
1437,
1496,
0
],
"tag": null,
@ -1068,8 +1047,30 @@ description: Variables in memory after executing i_shape.kcl
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
1581,
1705,
1502,
1563,
0
],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
1569,
1629,
0
],
"tag": null,
"type": "extrudeArc"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
1635,
1765,
0
],
"tag": null,
@ -1079,8 +1080,8 @@ description: Variables in memory after executing i_shape.kcl
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
1711,
1771,
1831,
0
],
"tag": null,
@ -1090,8 +1091,8 @@ description: Variables in memory after executing i_shape.kcl
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
1777,
1810,
1837,
1876,
0
],
"tag": null,
@ -1101,8 +1102,8 @@ description: Variables in memory after executing i_shape.kcl
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
1816,
1875,
1882,
1941,
0
],
"tag": null,
@ -1169,7 +1170,7 @@ description: Variables in memory after executing i_shape.kcl
"id": "[uuid]",
"sourceRange": [
548,
578,
584,
0
]
},
@ -1191,8 +1192,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
584,
643,
590,
649,
0
]
},
@ -1219,8 +1220,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
649,
708,
655,
720,
0
]
},
@ -1242,8 +1243,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
714,
773,
726,
785,
0
]
},
@ -1270,8 +1271,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
779,
831,
791,
849,
0
]
},
@ -1293,8 +1294,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
837,
895,
855,
913,
0
]
},
@ -1321,8 +1322,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
901,
937,
919,
961,
0
]
},
@ -1344,8 +1345,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
943,
1001,
967,
1025,
0
]
},
@ -1372,8 +1373,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
1007,
1037,
1031,
1067,
0
]
},
@ -1395,8 +1396,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
1043,
1102,
1073,
1132,
0
]
},
@ -1423,8 +1424,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
1108,
1171,
1138,
1207,
0
]
},
@ -1446,8 +1447,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
1177,
1237,
1213,
1273,
0
]
},
@ -1474,8 +1475,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
1243,
1276,
1279,
1318,
0
]
},
@ -1497,49 +1498,26 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
1282,
1341,
0
]
},
"ccw": true,
"center": [
16.60000000000001,
107.0
],
"from": [
11.6,
107.0
],
"tag": null,
"to": [
16.6,
102.0
],
"type": "TangentialArcTo",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
1347,
1324,
1383,
0
]
},
"ccw": true,
"center": [
16.60000000000001,
107.0
],
"from": [
16.6,
102.0
11.6,
107.0
],
"tag": null,
"to": [
21.6,
16.6,
102.0
],
"type": "ToPoint",
"type": "TangentialArcTo",
"units": {
"type": "Mm"
}
@ -1549,7 +1527,30 @@ description: Variables in memory after executing i_shape.kcl
"id": "[uuid]",
"sourceRange": [
1389,
1448,
1431,
0
]
},
"from": [
16.6,
102.0
],
"tag": null,
"to": [
21.6,
102.0
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
1437,
1496,
0
]
},
@ -1576,8 +1577,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
1454,
1509,
1502,
1563,
0
]
},
@ -1599,8 +1600,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
1515,
1575,
1569,
1629,
0
]
},
@ -1627,8 +1628,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
1581,
1705,
1635,
1765,
0
]
},
@ -1650,8 +1651,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
1711,
1771,
1831,
0
]
},
@ -1678,8 +1679,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
1777,
1810,
1837,
1876,
0
]
},
@ -1701,8 +1702,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
1816,
1875,
1882,
1941,
0
]
},
@ -1729,8 +1730,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
1881,
1889,
1947,
1955,
0
]
},
@ -1865,8 +1866,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
1926,
1939,
1992,
2011,
0
]
},
@ -1888,8 +1889,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
1945,
2003,
2017,
2075,
0
]
},
@ -1916,8 +1917,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
2009,
2045,
2081,
2123,
0
]
},
@ -1939,8 +1940,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
2051,
2110,
2129,
2188,
0
]
},
@ -1967,8 +1968,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
2116,
2130,
2194,
2214,
0
]
},
@ -1990,8 +1991,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
2136,
2196,
2220,
2280,
0
]
},
@ -2018,8 +2019,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
2202,
2241,
2286,
2331,
0
]
},
@ -2041,8 +2042,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
2247,
2306,
2337,
2396,
0
]
},
@ -2069,8 +2070,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
2312,
2320,
2402,
2410,
0
]
},
@ -2135,8 +2136,8 @@ description: Variables in memory after executing i_shape.kcl
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
1899,
1920,
1965,
1986,
0
]
}
@ -2149,8 +2150,8 @@ description: Variables in memory after executing i_shape.kcl
"__meta": [
{
"sourceRange": [
1899,
1920,
1965,
1986,
0
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

View File

@ -363,7 +363,7 @@ snapshot_kind: text
"cmdId": "[uuid]",
"range": [
258,
286,
292,
0
],
"command": {
@ -383,8 +383,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
292,
355,
298,
361,
0
],
"command": {
@ -404,8 +404,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
361,
379,
367,
394,
0
],
"command": {
@ -425,8 +425,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
385,
410,
400,
431,
0
],
"command": {
@ -446,8 +446,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
416,
442,
437,
472,
0
],
"command": {
@ -467,8 +467,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
448,
547,
478,
577,
0
],
"command": {
@ -488,8 +488,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
553,
578,
583,
614,
0
],
"command": {
@ -509,8 +509,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
584,
662,
620,
698,
0
],
"command": {
@ -530,8 +530,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
668,
686,
704,
731,
0
],
"command": {
@ -551,29 +551,29 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
692,
705,
0
],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": 0.0,
"y": 5.5,
"z": 0.0
},
"relative": false
}
}
},
{
"cmdId": "[uuid]",
"range": [
711,
737,
759,
0
],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": 0.0,
"y": 5.5,
"z": 0.0
},
"relative": false
}
}
},
{
"cmdId": "[uuid]",
"range": [
765,
800,
0
],
"command": {
@ -593,8 +593,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
743,
789,
806,
852,
0
],
"command": {
@ -614,8 +614,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
795,
803,
858,
866,
0
],
"command": {
@ -626,8 +626,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
795,
803,
858,
866,
0
],
"command": {
@ -637,8 +637,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
814,
952,
877,
1015,
0
],
"command": {
@ -665,8 +665,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
814,
952,
877,
1015,
0
],
"command": {
@ -677,8 +677,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
814,
952,
877,
1015,
0
],
"command": {
@ -690,8 +690,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
814,
952,
877,
1015,
0
],
"command": {
@ -704,8 +704,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
814,
952,
877,
1015,
0
],
"command": {
@ -718,8 +718,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
814,
952,
877,
1015,
0
],
"command": {
@ -732,8 +732,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
814,
952,
877,
1015,
0
],
"command": {
@ -746,8 +746,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
814,
952,
877,
1015,
0
],
"command": {
@ -760,8 +760,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
814,
952,
877,
1015,
0
],
"command": {
@ -774,8 +774,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
814,
952,
877,
1015,
0
],
"command": {
@ -788,8 +788,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
814,
952,
877,
1015,
0
],
"command": {
@ -802,8 +802,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
814,
952,
877,
1015,
0
],
"command": {
@ -816,8 +816,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
814,
952,
877,
1015,
0
],
"command": {
@ -830,8 +830,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
814,
952,
877,
1015,
0
],
"command": {
@ -844,8 +844,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
814,
952,
877,
1015,
0
],
"command": {
@ -858,8 +858,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
814,
952,
877,
1015,
0
],
"command": {
@ -872,8 +872,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
814,
952,
877,
1015,
0
],
"command": {
@ -886,8 +886,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
814,
952,
877,
1015,
0
],
"command": {
@ -900,8 +900,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
814,
952,
877,
1015,
0
],
"command": {
@ -914,8 +914,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
814,
952,
877,
1015,
0
],
"command": {
@ -928,8 +928,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
814,
952,
877,
1015,
0
],
"command": {
@ -942,8 +942,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
814,
952,
877,
1015,
0
],
"command": {
@ -956,8 +956,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
814,
952,
877,
1015,
0
],
"command": {
@ -970,8 +970,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
814,
952,
877,
1015,
0
],
"command": {
@ -984,8 +984,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
814,
952,
877,
1015,
0
],
"command": {
@ -998,8 +998,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
814,
952,
877,
1015,
0
],
"command": {
@ -1012,8 +1012,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
814,
952,
877,
1015,
0
],
"command": {
@ -1026,8 +1026,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
814,
952,
877,
1015,
0
],
"command": {
@ -1040,8 +1040,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
814,
952,
877,
1015,
0
],
"command": {
@ -1054,8 +1054,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
966,
986,
1029,
1049,
0
],
"command": {
@ -1083,8 +1083,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
992,
1036,
1055,
1099,
0
],
"command": {
@ -1103,8 +1103,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
992,
1036,
1055,
1099,
0
],
"command": {
@ -1114,8 +1114,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
992,
1036,
1055,
1099,
0
],
"command": {
@ -1131,8 +1131,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1042,
1070,
1105,
1139,
0
],
"command": {
@ -1152,8 +1152,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1076,
1139,
1145,
1208,
0
],
"command": {
@ -1173,8 +1173,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1145,
1163,
1214,
1241,
0
],
"command": {
@ -1194,8 +1194,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1169,
1194,
1247,
1278,
0
],
"command": {
@ -1215,8 +1215,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1200,
1226,
1284,
1319,
0
],
"command": {
@ -1236,8 +1236,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1232,
1331,
1325,
1424,
0
],
"command": {
@ -1257,8 +1257,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1337,
1362,
1430,
1461,
0
],
"command": {
@ -1278,8 +1278,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1368,
1446,
1467,
1545,
0
],
"command": {
@ -1299,8 +1299,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1452,
1470,
1551,
1578,
0
],
"command": {
@ -1320,8 +1320,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1476,
1489,
1584,
1606,
0
],
"command": {
@ -1341,8 +1341,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1495,
1521,
1612,
1647,
0
],
"command": {
@ -1362,8 +1362,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1527,
1573,
1653,
1699,
0
],
"command": {
@ -1383,8 +1383,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1579,
1587,
1705,
1713,
0
],
"command": {
@ -1395,8 +1395,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1579,
1587,
1705,
1713,
0
],
"command": {
@ -1406,8 +1406,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1593,
1631,
1719,
1757,
0
],
"command": {
@ -1426,8 +1426,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1593,
1631,
1719,
1757,
0
],
"command": {
@ -1440,8 +1440,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1593,
1631,
1719,
1757,
0
],
"command": {
@ -1451,8 +1451,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1593,
1631,
1719,
1757,
0
],
"command": {
@ -1463,8 +1463,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1593,
1631,
1719,
1757,
0
],
"command": {
@ -1476,8 +1476,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1593,
1631,
1719,
1757,
0
],
"command": {
@ -1490,8 +1490,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1593,
1631,
1719,
1757,
0
],
"command": {
@ -1504,8 +1504,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1593,
1631,
1719,
1757,
0
],
"command": {
@ -1518,8 +1518,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1593,
1631,
1719,
1757,
0
],
"command": {
@ -1532,8 +1532,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1593,
1631,
1719,
1757,
0
],
"command": {
@ -1546,8 +1546,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1593,
1631,
1719,
1757,
0
],
"command": {
@ -1560,8 +1560,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1593,
1631,
1719,
1757,
0
],
"command": {
@ -1574,8 +1574,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1593,
1631,
1719,
1757,
0
],
"command": {
@ -1588,8 +1588,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1593,
1631,
1719,
1757,
0
],
"command": {
@ -1602,8 +1602,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1593,
1631,
1719,
1757,
0
],
"command": {
@ -1616,8 +1616,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1593,
1631,
1719,
1757,
0
],
"command": {
@ -1630,8 +1630,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1593,
1631,
1719,
1757,
0
],
"command": {
@ -1644,8 +1644,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1593,
1631,
1719,
1757,
0
],
"command": {
@ -1658,8 +1658,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1593,
1631,
1719,
1757,
0
],
"command": {
@ -1672,8 +1672,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1593,
1631,
1719,
1757,
0
],
"command": {
@ -1686,8 +1686,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1593,
1631,
1719,
1757,
0
],
"command": {
@ -1700,8 +1700,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1593,
1631,
1719,
1757,
0
],
"command": {
@ -1714,8 +1714,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1593,
1631,
1719,
1757,
0
],
"command": {
@ -1728,8 +1728,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1593,
1631,
1719,
1757,
0
],
"command": {
@ -1742,8 +1742,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1593,
1631,
1719,
1757,
0
],
"command": {
@ -1756,8 +1756,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1593,
1631,
1719,
1757,
0
],
"command": {
@ -1770,8 +1770,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1593,
1631,
1719,
1757,
0
],
"command": {
@ -1784,8 +1784,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1593,
1631,
1719,
1757,
0
],
"command": {
@ -1798,8 +1798,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1593,
1631,
1719,
1757,
0
],
"command": {
@ -1812,8 +1812,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1593,
1631,
1719,
1757,
0
],
"command": {
@ -1826,8 +1826,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1593,
1631,
1719,
1757,
0
],
"command": {

View File

@ -2,40 +2,40 @@
flowchart LR
subgraph path2 [Path]
2["Path<br>[208, 252, 0]"]
3["Segment<br>[258, 286, 0]"]
4["Segment<br>[292, 355, 0]"]
5["Segment<br>[361, 379, 0]"]
6["Segment<br>[385, 410, 0]"]
7["Segment<br>[416, 442, 0]"]
8["Segment<br>[448, 547, 0]"]
9["Segment<br>[553, 578, 0]"]
10["Segment<br>[584, 662, 0]"]
11["Segment<br>[668, 686, 0]"]
12["Segment<br>[692, 705, 0]"]
13["Segment<br>[711, 737, 0]"]
14["Segment<br>[743, 789, 0]"]
15["Segment<br>[795, 803, 0]"]
3["Segment<br>[258, 292, 0]"]
4["Segment<br>[298, 361, 0]"]
5["Segment<br>[367, 394, 0]"]
6["Segment<br>[400, 431, 0]"]
7["Segment<br>[437, 472, 0]"]
8["Segment<br>[478, 577, 0]"]
9["Segment<br>[583, 614, 0]"]
10["Segment<br>[620, 698, 0]"]
11["Segment<br>[704, 731, 0]"]
12["Segment<br>[737, 759, 0]"]
13["Segment<br>[765, 800, 0]"]
14["Segment<br>[806, 852, 0]"]
15["Segment<br>[858, 866, 0]"]
16[Solid2d]
end
subgraph path60 [Path]
60["Path<br>[992, 1036, 0]"]
61["Segment<br>[1042, 1070, 0]"]
62["Segment<br>[1076, 1139, 0]"]
63["Segment<br>[1145, 1163, 0]"]
64["Segment<br>[1169, 1194, 0]"]
65["Segment<br>[1200, 1226, 0]"]
66["Segment<br>[1232, 1331, 0]"]
67["Segment<br>[1337, 1362, 0]"]
68["Segment<br>[1368, 1446, 0]"]
69["Segment<br>[1452, 1470, 0]"]
70["Segment<br>[1476, 1489, 0]"]
71["Segment<br>[1495, 1521, 0]"]
72["Segment<br>[1527, 1573, 0]"]
73["Segment<br>[1579, 1587, 0]"]
60["Path<br>[1055, 1099, 0]"]
61["Segment<br>[1105, 1139, 0]"]
62["Segment<br>[1145, 1208, 0]"]
63["Segment<br>[1214, 1241, 0]"]
64["Segment<br>[1247, 1278, 0]"]
65["Segment<br>[1284, 1319, 0]"]
66["Segment<br>[1325, 1424, 0]"]
67["Segment<br>[1430, 1461, 0]"]
68["Segment<br>[1467, 1545, 0]"]
69["Segment<br>[1551, 1578, 0]"]
70["Segment<br>[1584, 1606, 0]"]
71["Segment<br>[1612, 1647, 0]"]
72["Segment<br>[1653, 1699, 0]"]
73["Segment<br>[1705, 1713, 0]"]
74[Solid2d]
end
1["Plane<br>[182, 202, 0]"]
17["Sweep Revolve<br>[814, 952, 0]"]
17["Sweep Revolve<br>[877, 1015, 0]"]
18[Wall]
19[Wall]
20[Wall]
@ -77,8 +77,8 @@ flowchart LR
56["SweepEdge Adjacent"]
57["SweepEdge Opposite"]
58["SweepEdge Adjacent"]
59["Plane<br>[966, 986, 0]"]
75["Sweep Extrusion<br>[1593, 1631, 0]"]
59["Plane<br>[1029, 1049, 0]"]
75["Sweep Extrusion<br>[1719, 1757, 0]"]
76[Wall]
77[Wall]
78[Wall]

File diff suppressed because it is too large Load Diff

View File

@ -11,23 +11,23 @@ Fy = 0.5
sketch001 = startSketchOn('-YZ')
|> startProfileAt([back_walls_width / 2, 0], %)
|> xLine(wall_thickness / 2, %)
|> xLine(length = wall_thickness / 2)
|> angledLineToX({ angle = 45, to = back_walls_width }, %, $seg01)
|> yLineTo(height, %)
|> xLine(-wall_thickness, %)
|> yLineTo(segEndY(seg01), %)
|> yLine(endAbsolute = height)
|> xLine(length = -wall_thickness)
|> yLine(endAbsolute = segEndY(seg01))
|> angledLineToX({
angle = 45,
to = back_walls_width / 2 + wall_thickness / 2
}, %)
|> xLine(-wall_thickness, %)
|> xLine(length = -wall_thickness)
|> angledLineToX({
angle = 180 - 45,
to = wall_thickness
}, %)
|> yLineTo(height, %)
|> xLineTo(0, %)
|> yLineTo(segEndY(seg01), %)
|> yLine(endAbsolute = height)
|> xLine(endAbsolute = 0)
|> yLine(endAbsolute = segEndY(seg01))
|> angledLineToY({ angle = 180 - 45, to = 0 }, %)
|> close(%)
part001 = revolve({
@ -42,23 +42,23 @@ part001 = revolve({
sketch002 = startSketchOn('-YZ')
|> startProfileAt([back_walls_width / 2, 0], %)
|> xLine(wall_thickness / 2, %)
|> xLine(length = wall_thickness / 2)
|> angledLineToX({ angle = 45, to = back_walls_width }, %, $seg02)
|> yLineTo(height, %)
|> xLine(-wall_thickness, %)
|> yLineTo(segEndY(seg01), %)
|> yLine(endAbsolute = height)
|> xLine(length = -wall_thickness)
|> yLine(endAbsolute = segEndY(seg01))
|> angledLineToX({
angle = 45,
to = back_walls_width / 2 + wall_thickness / 2
}, %)
|> xLine(-wall_thickness, %)
|> xLine(length = -wall_thickness)
|> angledLineToX({
angle = 180 - 45,
to = wall_thickness
}, %)
|> yLineTo(height, %)
|> xLineTo(0, %)
|> yLineTo(segEndY(seg02), %)
|> yLine(endAbsolute = height)
|> xLine(endAbsolute = 0)
|> yLine(endAbsolute = segEndY(seg02))
|> angledLineToY({ angle = 180 - 45, to = 0 }, %)
|> close(%)
|> extrude(length = back_length - height)

View File

@ -1,6 +1,7 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed poop_chute.kcl
snapshot_kind: text
---
[
{
@ -120,8 +121,8 @@ description: Operations executed poop_chute.kcl
}
},
"sourceRange": [
822,
940,
885,
1003,
0
]
},
@ -133,16 +134,16 @@ description: Operations executed poop_chute.kcl
}
},
"sourceRange": [
942,
951,
1005,
1014,
0
]
}
},
"name": "revolve",
"sourceRange": [
814,
952,
877,
1015,
0
],
"type": "StdLibCall",
@ -156,16 +157,16 @@ description: Operations executed poop_chute.kcl
"value": "-YZ"
},
"sourceRange": [
980,
985,
1043,
1048,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
966,
986,
1029,
1049,
0
],
"type": "StdLibCall",
@ -188,16 +189,16 @@ description: Operations executed poop_chute.kcl
}
},
"sourceRange": [
1610,
1630,
1736,
1756,
0
]
}
},
"name": "extrude",
"sourceRange": [
1593,
1631,
1719,
1757,
0
],
"type": "StdLibCall",

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2,21 +2,21 @@
flowchart LR
subgraph path2 [Path]
2["Path<br>[37, 71, 0]"]
3["Segment<br>[77, 91, 0]"]
4["Segment<br>[97, 122, 0]"]
5["Segment<br>[128, 161, 0]"]
6["Segment<br>[167, 183, 0]"]
7["Segment<br>[189, 259, 0]"]
8["Segment<br>[265, 272, 0]"]
3["Segment<br>[77, 97, 0]"]
4["Segment<br>[103, 128, 0]"]
5["Segment<br>[134, 167, 0]"]
6["Segment<br>[173, 195, 0]"]
7["Segment<br>[201, 271, 0]"]
8["Segment<br>[277, 284, 0]"]
9[Solid2d]
end
subgraph path28 [Path]
28["Path<br>[370, 421, 0]"]
29["Segment<br>[370, 421, 0]"]
28["Path<br>[382, 433, 0]"]
29["Segment<br>[382, 433, 0]"]
30[Solid2d]
end
1["Plane<br>[12, 31, 0]"]
10["Sweep Extrusion<br>[287, 318, 0]"]
10["Sweep Extrusion<br>[299, 330, 0]"]
11[Wall]
12[Wall]
13[Wall]
@ -34,7 +34,7 @@ flowchart LR
25["SweepEdge Adjacent"]
26["SweepEdge Opposite"]
27["SweepEdge Adjacent"]
31["Sweep Extrusion<br>[611, 632, 0]"]
31["Sweep Extrusion<br>[623, 644, 0]"]
32[Wall]
33["SweepEdge Opposite"]
34["SweepEdge Adjacent"]

View File

@ -1,13 +1,14 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing ssi_pattern.kcl
snapshot_kind: text
---
{
"Ok": {
"body": [
{
"declaration": {
"end": 272,
"end": 284,
"id": {
"end": 9,
"name": "sketch001",
@ -105,21 +106,22 @@ description: Result of parsing ssi_pattern.kcl
{
"arguments": [
{
"end": 87,
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "length"
},
"arg": {
"end": 96,
"raw": "10.2",
"start": 83,
"start": 92,
"type": "Literal",
"type": "Literal",
"value": {
"value": 10.2,
"suffix": "None"
}
},
{
"end": 90,
"start": 89,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
}
],
"callee": {
@ -128,10 +130,11 @@ description: Result of parsing ssi_pattern.kcl
"start": 77,
"type": "Identifier"
},
"end": 91,
"end": 97,
"start": 77,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
@ -144,9 +147,9 @@ description: Result of parsing ssi_pattern.kcl
"arg": {
"elements": [
{
"end": 113,
"end": 119,
"raw": "0.54",
"start": 109,
"start": 115,
"type": "Literal",
"type": "Literal",
"value": {
@ -156,9 +159,9 @@ description: Result of parsing ssi_pattern.kcl
},
{
"argument": {
"end": 120,
"end": 126,
"raw": "0.03",
"start": 116,
"start": 122,
"type": "Literal",
"type": "Literal",
"value": {
@ -166,28 +169,28 @@ description: Result of parsing ssi_pattern.kcl
"suffix": "None"
}
},
"end": 120,
"end": 126,
"operator": "-",
"start": 115,
"start": 121,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 121,
"start": 108,
"end": 127,
"start": 114,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"end": 101,
"end": 107,
"name": "line",
"start": 97,
"start": 103,
"type": "Identifier"
},
"end": 122,
"start": 97,
"end": 128,
"start": 103,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
@ -197,9 +200,9 @@ description: Result of parsing ssi_pattern.kcl
{
"elements": [
{
"end": 149,
"end": 155,
"raw": "20.4",
"start": 145,
"start": 151,
"type": "Literal",
"type": "Literal",
"value": {
@ -208,9 +211,9 @@ description: Result of parsing ssi_pattern.kcl
}
},
{
"end": 156,
"end": 162,
"raw": "14.61",
"start": 151,
"start": 157,
"type": "Literal",
"type": "Literal",
"value": {
@ -219,36 +222,42 @@ description: Result of parsing ssi_pattern.kcl
}
}
],
"end": 157,
"start": 144,
"end": 163,
"start": 150,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 160,
"start": 159,
"end": 166,
"start": 165,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 143,
"end": 149,
"name": "tangentialArcTo",
"start": 128,
"start": 134,
"type": "Identifier"
},
"end": 161,
"start": 128,
"end": 167,
"start": 134,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "length"
},
"arg": {
"argument": {
"end": 179,
"end": 194,
"raw": "26.76",
"start": 174,
"start": 189,
"type": "Literal",
"type": "Literal",
"value": {
@ -256,29 +265,25 @@ description: Result of parsing ssi_pattern.kcl
"suffix": "None"
}
},
"end": 179,
"end": 194,
"operator": "-",
"start": 173,
"start": 188,
"type": "UnaryExpression",
"type": "UnaryExpression"
},
{
"end": 182,
"start": 181,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
}
],
"callee": {
"end": 172,
"end": 178,
"name": "yLine",
"start": 167,
"start": 173,
"type": "Identifier"
},
"end": 183,
"start": 167,
"type": "CallExpression",
"type": "CallExpression"
"end": 195,
"start": 173,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
@ -293,46 +298,46 @@ description: Result of parsing ssi_pattern.kcl
{
"arguments": [
{
"end": 224,
"start": 223,
"end": 236,
"start": 235,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 222,
"end": 234,
"name": "profileStartX",
"start": 209,
"start": 221,
"type": "Identifier"
},
"end": 225,
"start": 209,
"end": 237,
"start": 221,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 242,
"start": 241,
"end": 254,
"start": 253,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 240,
"end": 252,
"name": "profileStartY",
"start": 227,
"start": 239,
"type": "Identifier"
},
"end": 243,
"start": 227,
"end": 255,
"start": 239,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 244,
"start": 208,
"end": 256,
"start": 220,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
@ -344,8 +349,8 @@ description: Result of parsing ssi_pattern.kcl
"name": "tag"
},
"arg": {
"end": 258,
"start": 252,
"end": 270,
"start": 264,
"type": "TagDeclarator",
"type": "TagDeclarator",
"value": "seg01"
@ -353,13 +358,13 @@ description: Result of parsing ssi_pattern.kcl
}
],
"callee": {
"end": 193,
"end": 205,
"name": "line",
"start": 189,
"start": 201,
"type": "Identifier"
},
"end": 259,
"start": 189,
"end": 271,
"start": 201,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
@ -367,18 +372,18 @@ description: Result of parsing ssi_pattern.kcl
{
"arguments": [],
"callee": {
"end": 270,
"end": 282,
"name": "close",
"start": 265,
"start": 277,
"type": "Identifier"
},
"end": 272,
"start": 265,
"end": 284,
"start": 277,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 272,
"end": 284,
"start": 12,
"type": "PipeExpression",
"type": "PipeExpression"
@ -386,7 +391,7 @@ description: Result of parsing ssi_pattern.kcl
"start": 0,
"type": "VariableDeclarator"
},
"end": 272,
"end": 284,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
@ -394,11 +399,11 @@ description: Result of parsing ssi_pattern.kcl
},
{
"declaration": {
"end": 318,
"end": 330,
"id": {
"end": 284,
"end": 296,
"name": "extrude001",
"start": 274,
"start": 286,
"type": "Identifier"
},
"init": {
@ -410,9 +415,9 @@ description: Result of parsing ssi_pattern.kcl
"name": "length"
},
"arg": {
"end": 317,
"end": 329,
"raw": "50",
"start": 315,
"start": 327,
"type": "Literal",
"type": "Literal",
"value": {
@ -423,39 +428,39 @@ description: Result of parsing ssi_pattern.kcl
}
],
"callee": {
"end": 294,
"end": 306,
"name": "extrude",
"start": 287,
"start": 299,
"type": "Identifier"
},
"end": 318,
"start": 287,
"end": 330,
"start": 299,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"end": 304,
"end": 316,
"name": "sketch001",
"start": 295,
"start": 307,
"type": "Identifier",
"type": "Identifier"
}
},
"start": 274,
"start": 286,
"type": "VariableDeclarator"
},
"end": 318,
"end": 330,
"kind": "const",
"start": 274,
"start": 286,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 632,
"end": 644,
"id": {
"end": 329,
"end": 341,
"name": "sketch002",
"start": 320,
"start": 332,
"type": "Identifier"
},
"init": {
@ -463,53 +468,53 @@ description: Result of parsing ssi_pattern.kcl
{
"arguments": [
{
"end": 356,
"end": 368,
"name": "extrude001",
"start": 346,
"start": 358,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 363,
"end": 375,
"name": "seg01",
"start": 358,
"start": 370,
"type": "Identifier",
"type": "Identifier"
}
],
"callee": {
"end": 345,
"end": 357,
"name": "startSketchOn",
"start": 332,
"start": 344,
"type": "Identifier"
},
"end": 364,
"start": 332,
"end": 376,
"start": 344,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 417,
"end": 429,
"properties": [
{
"end": 401,
"end": 413,
"key": {
"end": 385,
"end": 397,
"name": "center",
"start": 379,
"start": 391,
"type": "Identifier"
},
"start": 379,
"start": 391,
"type": "ObjectProperty",
"value": {
"elements": [
{
"argument": {
"end": 394,
"end": 406,
"raw": "2.08",
"start": 390,
"start": 402,
"type": "Literal",
"type": "Literal",
"value": {
@ -517,16 +522,16 @@ description: Result of parsing ssi_pattern.kcl
"suffix": "None"
}
},
"end": 394,
"end": 406,
"operator": "-",
"start": 389,
"start": 401,
"type": "UnaryExpression",
"type": "UnaryExpression"
},
{
"end": 400,
"end": 412,
"raw": "47.7",
"start": 396,
"start": 408,
"type": "Literal",
"type": "Literal",
"value": {
@ -535,26 +540,26 @@ description: Result of parsing ssi_pattern.kcl
}
}
],
"end": 401,
"start": 388,
"end": 413,
"start": 400,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
},
{
"end": 415,
"end": 427,
"key": {
"end": 409,
"end": 421,
"name": "radius",
"start": 403,
"start": 415,
"type": "Identifier"
},
"start": 403,
"start": 415,
"type": "ObjectProperty",
"value": {
"end": 415,
"end": 427,
"raw": "1.4",
"start": 412,
"start": 424,
"type": "Literal",
"type": "Literal",
"value": {
@ -564,25 +569,25 @@ description: Result of parsing ssi_pattern.kcl
}
}
],
"start": 377,
"start": 389,
"type": "ObjectExpression",
"type": "ObjectExpression"
},
{
"end": 420,
"start": 419,
"end": 432,
"start": 431,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 376,
"end": 388,
"name": "circle",
"start": 370,
"start": 382,
"type": "Identifier"
},
"end": 421,
"start": 370,
"end": 433,
"start": 382,
"type": "CallExpression",
"type": "CallExpression"
},
@ -595,9 +600,9 @@ description: Result of parsing ssi_pattern.kcl
"name": "instances"
},
"arg": {
"end": 456,
"end": 468,
"raw": "5",
"start": 455,
"start": 467,
"type": "Literal",
"type": "Literal",
"value": {
@ -613,9 +618,9 @@ description: Result of parsing ssi_pattern.kcl
"name": "distance"
},
"arg": {
"end": 470,
"end": 482,
"raw": "5",
"start": 469,
"start": 481,
"type": "Literal",
"type": "Literal",
"value": {
@ -633,9 +638,9 @@ description: Result of parsing ssi_pattern.kcl
"arg": {
"elements": [
{
"end": 481,
"end": 493,
"raw": "1",
"start": 480,
"start": 492,
"type": "Literal",
"type": "Literal",
"value": {
@ -644,9 +649,9 @@ description: Result of parsing ssi_pattern.kcl
}
},
{
"end": 484,
"end": 496,
"raw": "0",
"start": 483,
"start": 495,
"type": "Literal",
"type": "Literal",
"value": {
@ -655,21 +660,21 @@ description: Result of parsing ssi_pattern.kcl
}
}
],
"end": 485,
"start": 479,
"end": 497,
"start": 491,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"end": 442,
"end": 454,
"name": "patternLinear2d",
"start": 427,
"start": 439,
"type": "Identifier"
},
"end": 486,
"start": 427,
"end": 498,
"start": 439,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
@ -683,9 +688,9 @@ description: Result of parsing ssi_pattern.kcl
"name": "instances"
},
"arg": {
"end": 574,
"end": 586,
"raw": "6",
"start": 573,
"start": 585,
"type": "Literal",
"type": "Literal",
"value": {
@ -701,9 +706,9 @@ description: Result of parsing ssi_pattern.kcl
"name": "distance"
},
"arg": {
"end": 588,
"end": 600,
"raw": "4",
"start": 587,
"start": 599,
"type": "Literal",
"type": "Literal",
"value": {
@ -721,9 +726,9 @@ description: Result of parsing ssi_pattern.kcl
"arg": {
"elements": [
{
"end": 599,
"end": 611,
"raw": "0",
"start": 598,
"start": 610,
"type": "Literal",
"type": "Literal",
"value": {
@ -733,9 +738,9 @@ description: Result of parsing ssi_pattern.kcl
},
{
"argument": {
"end": 603,
"end": 615,
"raw": "1",
"start": 602,
"start": 614,
"type": "Literal",
"type": "Literal",
"value": {
@ -743,28 +748,28 @@ description: Result of parsing ssi_pattern.kcl
"suffix": "None"
}
},
"end": 603,
"end": 615,
"operator": "-",
"start": 601,
"start": 613,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 604,
"start": 597,
"end": 616,
"start": 609,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"end": 560,
"end": 572,
"name": "patternLinear2d",
"start": 545,
"start": 557,
"type": "Identifier"
},
"end": 605,
"start": 545,
"end": 617,
"start": 557,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
@ -779,9 +784,9 @@ description: Result of parsing ssi_pattern.kcl
},
"arg": {
"argument": {
"end": 631,
"end": 643,
"raw": "40",
"start": 629,
"start": 641,
"type": "Literal",
"type": "Literal",
"value": {
@ -789,34 +794,34 @@ description: Result of parsing ssi_pattern.kcl
"suffix": "None"
}
},
"end": 631,
"end": 643,
"operator": "-",
"start": 628,
"start": 640,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
}
],
"callee": {
"end": 618,
"end": 630,
"name": "extrude",
"start": 611,
"start": 623,
"type": "Identifier"
},
"end": 632,
"start": 611,
"end": 644,
"start": 623,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
}
],
"end": 632,
"end": 644,
"nonCodeMeta": {
"nonCodeNodes": {
"2": [
{
"end": 539,
"start": 488,
"end": 551,
"start": 500,
"type": "NonCodeNode",
"value": {
"type": "blockComment",
@ -828,27 +833,27 @@ description: Result of parsing ssi_pattern.kcl
},
"startNodes": []
},
"start": 332,
"start": 344,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 320,
"start": 332,
"type": "VariableDeclarator"
},
"end": 632,
"end": 644,
"kind": "const",
"start": 320,
"start": 332,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"end": 633,
"end": 645,
"nonCodeMeta": {
"nonCodeNodes": {
"0": [
{
"end": 274,
"start": 272,
"end": 286,
"start": 284,
"type": "NonCodeNode",
"value": {
"type": "newLine"
@ -857,8 +862,8 @@ description: Result of parsing ssi_pattern.kcl
],
"1": [
{
"end": 320,
"start": 318,
"end": 332,
"start": 330,
"type": "NonCodeNode",
"value": {
"type": "newLine"

View File

@ -1,9 +1,9 @@
sketch001 = startSketchOn('XZ')
|> startProfileAt([-4.35, -12.26], %)
|> yLine(10.2, %)
|> yLine(length = 10.2)
|> line(end = [0.54, -0.03])
|> tangentialArcTo([20.4, 14.61], %)
|> yLine(-26.76, %)
|> yLine(length = -26.76)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)], tag = $seg01)
|> close()

View File

@ -1,6 +1,7 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed ssi_pattern.kcl
snapshot_kind: text
---
[
{
@ -43,16 +44,16 @@ description: Operations executed ssi_pattern.kcl
}
},
"sourceRange": [
315,
317,
327,
329,
0
]
}
},
"name": "extrude",
"sourceRange": [
287,
318,
299,
330,
0
],
"type": "StdLibCall",
@ -64,8 +65,8 @@ description: Operations executed ssi_pattern.kcl
}
},
"sourceRange": [
295,
304,
307,
316,
0
]
}
@ -80,8 +81,8 @@ description: Operations executed ssi_pattern.kcl
}
},
"sourceRange": [
346,
356,
358,
368,
0
]
},
@ -92,16 +93,16 @@ description: Operations executed ssi_pattern.kcl
"artifact_id": "[uuid]"
},
"sourceRange": [
358,
363,
370,
375,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
332,
364,
344,
376,
0
],
"type": "StdLibCall",
@ -124,16 +125,16 @@ description: Operations executed ssi_pattern.kcl
}
},
"sourceRange": [
628,
631,
640,
643,
0
]
}
},
"name": "extrude",
"sourceRange": [
611,
632,
623,
644,
0
],
"type": "StdLibCall",

File diff suppressed because it is too large Load Diff

View File

@ -444,7 +444,7 @@ snapshot_kind: text
"cmdId": "[uuid]",
"range": [
443,
456,
465,
0
],
"command": {

View File

@ -6,7 +6,7 @@ flowchart LR
4["Segment<br>[191, 252, 0]"]
5["Segment<br>[258, 344, 0]"]
6["Segment<br>[350, 437, 0]"]
7["Segment<br>[443, 456, 0]"]
7["Segment<br>[443, 465, 0]"]
end
1["Plane<br>[64, 83, 0]"]
1 --- 2

View File

@ -1,6 +1,7 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing tan_arc_x_line.kcl
snapshot_kind: text
---
{
"Ok": {
@ -151,7 +152,7 @@ description: Result of parsing tan_arc_x_line.kcl
"type": "VariableDeclaration"
},
{
"end": 456,
"end": 465,
"expression": {
"body": [
{
@ -545,36 +546,38 @@ description: Result of parsing tan_arc_x_line.kcl
{
"arguments": [
{
"end": 452,
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "endAbsolute"
},
"arg": {
"end": 464,
"raw": "1",
"start": 451,
"start": 463,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
{
"end": 455,
"start": 454,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
}
],
"callee": {
"end": 450,
"name": "xLineTo",
"end": 448,
"name": "xLine",
"start": 443,
"type": "Identifier"
},
"end": 456,
"end": 465,
"start": 443,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
}
],
"end": 456,
"end": 465,
"start": 64,
"type": "PipeExpression",
"type": "PipeExpression"
@ -584,7 +587,7 @@ description: Result of parsing tan_arc_x_line.kcl
"type": "ExpressionStatement"
}
],
"end": 457,
"end": 466,
"nonCodeMeta": {
"nonCodeNodes": {
"4": [

View File

@ -16,4 +16,4 @@ startSketchOn('XY')
offset = -angleOffset,
radius = 0.5 * r
}, %, $arc3)
|> xLineTo(1, %)
|> xLine(endAbsolute = 1)

View File

@ -10,38 +10,38 @@ let corner_radius = 5.0
let brace_base = startSketchAt([corner_radius, 0])
|> line(end = [width - corner_radius, 0.0])
|> tangentialArcToRelative([corner_radius, corner_radius], %)
|> yLine(25.0 - corner_radius, %)
|> yLine(length = 25.0 - corner_radius)
|> tangentialArcToRelative([-corner_radius, corner_radius], %)
|> xLine(-(d_wrist_circumference[0] - (corner_radius * 2)), %)
|> xLine(length = -(d_wrist_circumference[0] - (corner_radius * 2)))
|> tangentialArcToRelative([-corner_radius, corner_radius], %)
|> yLine(length - 25.0 - 23.0 - (corner_radius * 2), %)
|> yLine(length = length - 25.0 - 23.0 - (corner_radius * 2))
|> tangentialArcToRelative([corner_radius, corner_radius], %)
|> xLine(15.0 - (corner_radius * 2), %)
|> xLine(length = 15.0 - (corner_radius * 2))
|> tangentialArcToRelative([corner_radius, corner_radius], %)
|> yLine(23.0 - corner_radius, %)
|> yLine(length = 23.0 - corner_radius)
|> tangentialArcToRelative([-corner_radius, corner_radius], %)
|> xLine(-(hand_thickness + 15.0 + 15.0 - (corner_radius * 2)), %)
|> xLine(length = -(hand_thickness + 15.0 + 15.0 - (corner_radius * 2)))
|> tangentialArcToRelative([-corner_radius, -corner_radius], %)
|> yLine(-(23.0 - corner_radius), %)
|> yLine(length = -(23.0 - corner_radius))
|> tangentialArcToRelative([corner_radius, -corner_radius], %)
|> xLine(15.0 - (corner_radius * 2), %)
|> xLine(length = 15.0 - (corner_radius * 2))
|> tangentialArcToRelative([corner_radius, -corner_radius], %)
|> yLine(-(length - 25.0 - 23.0 - (corner_radius * 2)), %)
|> yLine(length = -(length - 25.0 - 23.0 - (corner_radius * 2)))
|> tangentialArcToRelative([-corner_radius, -corner_radius], %)
|> xLine(-(d_wrist_circumference[1] + d_wrist_circumference[2] + d_wrist_circumference[3] - hand_thickness - corner_radius), %)
|> xLine(length = -(d_wrist_circumference[1] + d_wrist_circumference[2] + d_wrist_circumference[3] - hand_thickness - corner_radius))
|> tangentialArcToRelative([-corner_radius, -corner_radius], %)
|> yLine(-(25.0 - corner_radius), %)
|> yLine(length = -(25.0 - corner_radius))
|> tangentialArcToRelative([corner_radius, -corner_radius], %)
|> close()
let inner = startSketchAt([0, 0])
|> xLine(1.0, %)
|> xLine(length = 1.0)
|> tangentialArcToRelative([corner_radius, corner_radius], %)
|> yLine(25.0 - (corner_radius * 2), %)
|> yLine(length = 25.0 - (corner_radius * 2))
|> tangentialArcToRelative([-corner_radius, corner_radius], %)
|> xLine(-1.0, %)
|> xLine(length = -1.0)
|> tangentialArcToRelative([-corner_radius, -corner_radius], %)
|> yLine(-(25.0 - (corner_radius * 2)), %)
|> yLine(length = -(25.0 - (corner_radius * 2)))
|> tangentialArcToRelative([corner_radius, -corner_radius], %)
|> close()

View File

@ -11,20 +11,20 @@ Fy = 0.5
sketch001 = startSketchOn('-YZ')
|> startProfileAt([back_walls_width / 2, 0], %)
|> xLine(wall_thickness / 2, %)
|> xLine(length = wall_thickness / 2)
|> angledLineToX({ angle: 45, to: back_walls_width }, %, $seg01)
|> yLineTo(height, %)
|> xLine(-wall_thickness, %)
|> yLineTo(segEndY(seg01), %)
|> yLine(endAbsolute = height)
|> xLine(length = -wall_thickness)
|> yLine(endAbsolute = segEndY(seg01))
|> angledLineToX({
angle: 45,
to: back_walls_width / 2 + wall_thickness / 2
}, %)
|> xLine(-wall_thickness, %)
|> xLine(length = -wall_thickness)
|> angledLineToX({ angle: 180 - 45, to: wall_thickness }, %)
|> yLineTo(height, %)
|> xLineTo(0, %)
|> yLineTo(segEndY(seg01), %)
|> yLine(endAbsolute = height)
|> xLine(endAbsolute = 0)
|> yLine(endAbsolute = segEndY(seg01))
|> angledLineToY({ angle: 180 - 45, to: 0 }, %)
|> close()
part001 = revolve({
@ -39,20 +39,20 @@ part001 = revolve({
sketch002 = startSketchOn('-YZ')
|> startProfileAt([back_walls_width / 2, 0], %)
|> xLine(wall_thickness / 2, %)
|> xLine(length = wall_thickness / 2)
|> angledLineToX({ angle: 45, to: back_walls_width }, %, $seg02)
|> yLineTo(height, %)
|> xLine(-wall_thickness, %)
|> yLineTo(segEndY(seg01), %)
|> yLine(endAbsolute = height)
|> xLine(length = -wall_thickness)
|> yLine(endAbsolute = segEndY(seg01))
|> angledLineToX({
angle: 45,
to: back_walls_width / 2 + wall_thickness / 2
}, %)
|> xLine(-wall_thickness, %)
|> xLine(length = -wall_thickness)
|> angledLineToX({ angle: 180 - 45, to: wall_thickness }, %)
|> yLineTo(height, %)
|> xLineTo(0, %)
|> yLineTo(segEndY(seg02), %)
|> yLine(endAbsolute = height)
|> xLine(endAbsolute = 0)
|> yLine(endAbsolute = segEndY(seg02))
|> angledLineToY({ angle: 180 - 45, to: 0 }, %)
|> close()
|> extrude(length = back_length - height)

View File

@ -11,20 +11,20 @@ const length001 = slateWidthHalf - radius
const length002 = depth + minClampingDistance
const sketch001 = startSketchOn('XZ')
|> startProfileAt([0, depth - templateGap], %)
|> xLine(length001, %, $seg01)
|> xLine(length = length001, tag = $seg01)
|> arc({
angleEnd: 0,
angleStart: 90,
radius: radius - templateGap
}, %)
|> yLineTo(-templateGap * 2 - (templateDiameter / 2), %, $seg05)
|> xLineTo(slateWidthHalf + templateThickness, %, $seg04)
|> yLine(-length002, %, $seg03)
|> xLineTo(0, %, $seg02)
|> xLine(-segLen(seg02, %), %)
|> yLine(segLen(seg03, %), %)
|> xLine(segLen(seg04, %), %)
|> yLine(segLen(seg05, %), %)
|> yLine(endAbsolute = -templateGap * 2 - (templateDiameter / 2), tag = $seg05)
|> xLineTo(endAbsolute = slateWidthHalf + templateThickness, tag = $seg04)
|> yLine(length = -length002, tag = $seg03)
|> xLineTo(endAbsolute = 0, tag = $seg02)
|> xLine(length = length = -segLen(seg02))
|> yLine(length = segLen(seg03, %))
|> xLine(length = length = segLen(seg04))
|> yLine(length = segLen(seg05, %))
|> arc({
angleEnd: 90,
angleStart: 180,
@ -38,7 +38,7 @@ const sketch002 = startSketchOn(extrude001, 'START')
-slateWidthHalf,
-templateGap * 2 - (templateDiameter / 2)
], %)
|> xLine(-7, %, $rectangleSegmentA001)
|> xLine(length = -7, tag = $rectangleSegmentA001)
|> angledLine([
segAng(rectangleSegmentA001, %) + 90,
minClampingDistance
@ -55,7 +55,7 @@ const sketch003 = startSketchOn(extrude001, 'START')
slateWidthHalf,
-templateGap * 2 - (templateDiameter / 2)
], %)
|> xLine(7, %, $rectangleSegmentA002)
|> xLine(length = 7, tag = $rectangleSegmentA002)
|> angledLine([
segAng(rectangleSegmentA002, %) - 90,
minClampingDistance

View File

@ -25,9 +25,9 @@ fn caster = (originStart) => {
const sketch001c = startSketchOn(plane001c)
|> startProfileAt([0, 0], %)
|> xLine(3.543, %)
|> yLine(3.543, %)
|> xLine(-3.543, %)
|> xLine(length = 3.543)
|> yLine(length = 3.543)
|> xLine(length = -3.543)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> hole(circle({ center: [
@ -110,21 +110,21 @@ const plane001 = {
const sketch001l = startSketchOn(plane001)
|> startProfileAt([0, 0], %)
|> xLine(serverDepth + .8, %)
|> xLine(length = serverDepth + .8)
|> angledLineToY({ angle: -45, to: 1 }, %)
|> xLine(-serverDepth + 2 - .8, %, $seg01)
|> xLine(length = -serverDepth + 2 - .8, tag = $seg01)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
const extrude001l = extrude(sketch001l, length = 1)
const sketch002l = startSketchOn(plane001)
|> startProfileAt([serverDepth + .8, 0], %)
|> yLine(railHeight * 1.75 + 2, %)
|> yLine(length = railHeight * 1.75 + 2)
|> angledLineToX({
angle: -135,
to: serverDepth - 1 + .8
}, %)
|> yLine(-railHeight * 1.75, %)
|> yLine(length = -railHeight * 1.75)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
const extrude002l = extrude(sketch002l, length = 1)
@ -134,24 +134,24 @@ const sketch003l = startSketchOn(plane001)
serverDepth + .8,
railHeight * 1.75 + 2
], %)
|> xLine(-serverDepth - .8, %, $seg02)
|> xLine(length = -serverDepth - .8, tag = $seg02)
|> angledLineToY({
angle: -45,
to: railHeight * 1.75 - 1 + 2
}, %)
|> xLine(serverDepth - 2 + .8, %)
|> xLine(length = serverDepth - 2 + .8)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
const extrude003l = extrude(sketch003l, length = 1)
const sketch004l = startSketchOn(plane001)
|> startProfileAt([0, 0], %)
|> yLine(railHeight * 1.75 + 2, %)
|> yLine(length = railHeight * 1.75 + 2)
|> angledLineToY({
angle: 135,
to: railHeight * 1.75 + 2 - 1
}, %)
|> yLine(-railHeight * 1.75, %)
|> yLine(length = -railHeight * 1.75)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
const extrude004l = extrude(sketch004l, length = 1)
@ -159,7 +159,7 @@ const extrude004l = extrude(sketch004l, length = 1)
const sketch005l = startSketchOn(plane001)
|> startProfileAt([serverDepth - 1.25, 1], %)
|> line(end = [-serverDepth + 2.25, railHeight * 1.75], tag = $lineToIntersect4)
|> xLine(1, %)
|> xLine(length = 1)
|> line(end = [serverDepth - 2.25, -railHeight * 1.75], tag = $lineToIntersect5)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
@ -213,42 +213,42 @@ const plane002 = {
const sketch001w = startSketchOn(plane002)
|> startProfileAt([0, 0], %)
|> xLine(depth, %)
|> xLine(length = depth)
|> angledLineToY({ angle: -45, to: 1 }, %)
|> xLine(-depth + 2, %, $seg01w)
|> xLine(length = -depth + 2, tag = $seg01w)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
const extrude001w = extrude(sketch001w, length = 1)
const sketch002w = startSketchOn(plane002)
|> startProfileAt([depth, 0], %)
|> yLine(railHeight * 1.75 + 2, %)
|> yLine(length = railHeight * 1.75 + 2)
|> angledLineToX({ angle: -135, to: depth - 1 }, %)
|> yLine(-railHeight * 1.75, %)
|> yLine(length = -railHeight * 1.75)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
const extrude002w = extrude(sketch002w, length = 1)
const sketch003w = startSketchOn(plane002)
|> startProfileAt([depth, railHeight * 1.75 + 2], %)
|> xLine(-depth, %, $seg02w)
|> xLine(length = -depth, tag = $seg02w)
|> angledLineToY({
angle: -45,
to: railHeight * 1.75 - 1 + 2
}, %)
|> xLine(depth - 2, %)
|> xLine(length = depth - 2)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
const extrude003w = extrude(sketch003w, length = 1)
const sketch004w = startSketchOn(plane002)
|> startProfileAt([0, 0], %)
|> yLine(railHeight * 1.75 + 2, %)
|> yLine(length = railHeight * 1.75 + 2)
|> angledLineToY({
angle: 135,
to: railHeight * 1.75 + 2 - 1
}, %)
|> yLine(-railHeight * 1.75, %)
|> yLine(length = -railHeight * 1.75)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
const extrude004w = extrude(sketch004w, length = 1)
@ -268,7 +268,7 @@ const sketch006w = startSketchOn(plane002)
40.6 - (35.5 * sin(23 * pi() / 180)) + 1.75 / 2
], %)
|> angledLineToX({ angle: -23 + 90, to: depth - 1 }, %)
|> yLine(2.56, %)
|> yLine(length = 2.56)
|> angledLineThatIntersects({
angle: -23 + 90 + 180,
intersectTag: lineToIntersect,
@ -357,7 +357,7 @@ const sketch013w = startSketchOn(plane002)
], %)
|> angledLine({ angle: -23, length: 1 }, %)
|> angledLineToX({ angle: -23 + 90, to: 1 }, %)
|> yLine(2.56, %)
|> yLine(length = 2.56)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
const extrude013w = extrude(sketch013w, length = 1)
@ -462,7 +462,7 @@ const extrude020w = extrude(sketch020w, length = 1)
const sketch021w = startSketchOn(plane002)
|> startProfileAt([1, 21.9], %)
|> angledLineToX({ angle: -23, to: depth - 1 }, %)
|> yLine(-1.1, %)
|> yLine(length = -1.1)
|> angledLineToX({ angle: -23, to: 1 }, %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
@ -474,7 +474,7 @@ const sketch022w = startSketchOn(plane002)
angle: 180 - 23,
to: railHeight * 1.75 + 1
}, %)
|> xLine(-2.56, %)
|> xLine(length = -2.56)
|> angledLineToX({ angle: -23, to: depth - 1 }, %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
@ -486,7 +486,7 @@ const sketch023w = startSketchOn(plane002)
angle: 90 - 23,
to: railHeight * 1.75 + 1
}, %)
|> xLine(1.086, %)
|> xLine(length = 1.086)
|> angledLineToX({ angle: 90 - 23, to: 1 }, %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
@ -495,7 +495,7 @@ const extrude023w = extrude(sketch023w, length = 1)
const sketch024w = startSketchOn(plane002)
|> startProfileAt([1, 16.5], %)
|> angledLineToY({ angle: -23, to: 1 }, %)
|> xLine(-2.56, %)
|> xLine(length = -2.56)
|> angledLineToX({ angle: -23, to: 1 }, %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
@ -504,7 +504,7 @@ const extrude024w = extrude(sketch024w, length = 1)
const sketch025w = startSketchOn(plane002)
|> startProfileAt([1, 4], %)
|> angledLineToY({ angle: -23, to: 1 }, %)
|> xLine(-2.56, %)
|> xLine(length = -2.56)
|> angledLineToX({ angle: -23, to: 1 }, %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
@ -685,13 +685,13 @@ const sketch003fl = startSketchOn(planeXYfl)
angleEnd: 180,
radius: bendRad + thickness
}, %)
|> xLine(thickness, %)
|> xLine(length = thickness)
|> arc({
angleStart: 180,
angleEnd: 270,
radius: bendRad
}, %)
|> yLine(-thickness, %)
|> yLine(length = -thickness)
|> close()
const extrude003fl = extrude(sketch003fl, length = railHeight * 1.75)
@ -834,9 +834,9 @@ const sketch010fl = startSketchOn(extrude001fl, 'START')
-1.12 + (.75 - .438) / 2 - originStart[0],
originStart[2] + .81 - (.438 / 2)
], %)
|> xLine(0.75 - .438, %)
|> xLine(length = 0.75 - .438)
|> tangentialArcTo([-0.66 - originStart[0],originStart[2] + .81 + .438 / 2], %)
|> xLine(-0.75 + .438, %)
|> xLine(length = -0.75 + .438)
|> tangentialArcTo([profileStartX(%), profileStartY(%)], %)
|> close()
|> patternLinear2d(
@ -852,12 +852,12 @@ const sketch011fl = startSketchOn(extrude001fl, 'START')
-1.12 + (.75 - .438) / 2 - originStart[0],
originStart[2] + railHeight * 1.75 / 2 + .438 / 2
], %)
|> xLine(0.75 - .438, %)
|> xLine(length = 0.75 - .438)
|> tangentialArcTo([
-0.66 - originStart[0],originStart[2]+
railHeight * 1.75 / 2 - (.438 / 2)
], %)
|> xLine(-0.75 + .438, %)
|> xLine(length = -0.75 + .438)
|> tangentialArcTo([profileStartX(%), profileStartY(%)], %)
|> close()
@ -869,12 +869,12 @@ const sketch012fl = startSketchOn(extrude001fl, 'START')
-1.12 + (.75 - .438) / 2 - originStart[0], originStart[2] +
railHeight * 1.75 - .81 + .438 / 2
], %)
|> xLine(0.75 - .438, %)
|> xLine(length = 0.75 - .438)
|> tangentialArcTo([
-0.66 - originStart[0], originStart[2]+
railHeight * 1.75 - .81 - (.438 / 2)
], %)
|> xLine(-0.75 + .438, %)
|> xLine(length = -0.75 + .438)
|> tangentialArcTo([profileStartX(%), profileStartY(%)], %)
|> close()
|> patternLinear2d(
@ -965,7 +965,7 @@ const sketch003fr = startSketchOn(planeXYfr)
angleEnd: -90,
radius: bendRad
}, %)
|> yLine(-thickness, %)
|> yLine(length = -thickness)
|> arc({
angleStart: -90,
angleEnd: 0,
@ -1125,12 +1125,12 @@ const sketch010fr = startSketchOn(extrude001fr, 'START')
-1.12 + (.75 - .438) / 2 - originStart[0],
originStart[2] + .81 - (.438 / 2)
], %)
|> xLine(0.75 - .438, %)
|> xLine(length = 0.75 - .438)
|> tangentialArcTo([
-0.66 - originStart[0],
originStart[2] + .81 + .438 / 2
], %)
|> xLine(-0.75 + .438, %)
|> xLine(length = -0.75 + .438)
|> tangentialArcTo([profileStartX(%), profileStartY(%)], %)
|> close()
|> patternLinear2d(
@ -1146,12 +1146,12 @@ const sketch011fr = startSketchOn(extrude001fr, 'START')
-1.12 + (.75 - .438) / 2 - originStart[0],
originStart[2] + railHeight * 1.75 / 2 + .438 / 2
], %)
|> xLine(0.75 - .438, %)
|> xLine(length = 0.75 - .438)
|> tangentialArcTo([
-0.66 - originStart[0],
originStart[2] + railHeight * 1.75 / 2 - (.438 / 2)
], %)
|> xLine(-0.75 + .438, %)
|> xLine(length = -0.75 + .438)
|> tangentialArcTo([profileStartX(%), profileStartY(%)], %)
|> close()
@ -1163,12 +1163,12 @@ const sketch012fr = startSketchOn(extrude001fr, 'START')
-1.12 + (.75 - .438) / 2 - originStart[0],
originStart[2] + railHeight * 1.75 - .81 + .438 / 2
], %)
|> xLine(0.75 - .438, %)
|> xLine(length = 0.75 - .438)
|> tangentialArcTo([
-0.66 - originStart[0],
originStart[2] + railHeight * 1.75 - .81 - (.438 / 2)
], %)
|> xLine(-0.75 + .438, %)
|> xLine(length = -0.75 + .438)
|> tangentialArcTo([profileStartX(%), profileStartY(%)], %)
|> close()
|> patternLinear2d(
@ -1259,7 +1259,7 @@ const sketch003rr = startSketchOn(planeXYrr)
angleEnd: 90,
radius: bendRad+thickness
}, %)
|> yLine(-thickness, %)
|> yLine(length = -thickness)
|> arc({
angleStart: 90,
angleEnd: 0,
@ -1419,12 +1419,12 @@ const sketch010rr = startSketchOn(extrude001rr, 'START')
-1.12 + (.75 - .438) / 2 - originStart[0]+1.5-serverDepth,
originStart[2] + .81 - (.438 / 2)
], %)
|> xLine(0.75 - .438, %)
|> xLine(length = 0.75 - .438)
|> tangentialArcTo([
-0.66 - originStart[0]+1.5-serverDepth,
originStart[2] + .81 + .438 / 2
], %)
|> xLine(-0.75 + .438, %)
|> xLine(length = -0.75 + .438)
|> tangentialArcTo([profileStartX(%), profileStartY(%)], %)
|> close()
|> patternLinear2d(
@ -1440,12 +1440,12 @@ const sketch011rr = startSketchOn(extrude001rr, 'START')
-1.12 + (.75 - .438) / 2 - originStart[0]+1.5-serverDepth,
originStart[2] + railHeight * 1.75 / 2 + .438 / 2
], %)
|> xLine(0.75 - .438, %)
|> xLine(length = 0.75 - .438)
|> tangentialArcTo([
-0.66 - originStart[0]+1.5-serverDepth,
originStart[2] + railHeight * 1.75 / 2 - (.438 / 2)
], %)
|> xLine(-0.75 + .438, %)
|> xLine(length = -0.75 + .438)
|> tangentialArcTo([profileStartX(%), profileStartY(%)], %)
|> close()
@ -1457,12 +1457,12 @@ const sketch012rr = startSketchOn(extrude001rr, 'START')
-1.12 + (.75 - .438) / 2 - originStart[0]+1.5-serverDepth,
originStart[2] + railHeight * 1.75 - .81 + .438 / 2
], %)
|> xLine(0.75 - .438, %)
|> xLine(length = 0.75 - .438)
|> tangentialArcTo([
-0.66 - originStart[0]+1.5-serverDepth,
originStart[2] + railHeight * 1.75 - .81 - (.438 / 2)
], %)
|> xLine(-0.75 + .438, %)
|> xLine(length = -0.75 + .438)
|> tangentialArcTo([profileStartX(%), profileStartY(%)], %)
|> close()
|> patternLinear2d(
@ -1552,7 +1552,7 @@ const sketch003rl = startSketchOn(planeXYrl)
angleEnd: 180,
radius: bendRad
}, %)
|> xLine(-thickness, %)
|> xLine(length = -thickness)
|> arc({
angleStart: 180,
angleEnd: 90,
@ -1712,12 +1712,12 @@ const sketch010rl = startSketchOn(extrude001rl, 'START')
-1.12 + (.75 - .438) / 2 - originStart[0] - serverDepth + 1.5,
originStart[2] + .81 - (.438 / 2)
], %)
|> xLine(0.75 - .438, %)
|> xLine(length = 0.75 - .438)
|> tangentialArcTo([
-0.66 - originStart[0] - serverDepth + 1.5,
originStart[2] + .81 + .438 / 2
], %)
|> xLine(-0.75 + .438, %)
|> xLine(length = -0.75 + .438)
|> tangentialArcTo([profileStartX(%), profileStartY(%)], %)
|> close()
|> patternLinear2d(
@ -1733,12 +1733,12 @@ const sketch011rl = startSketchOn(extrude001rl, 'START')
-1.12 + (.75 - .438) / 2 - originStart[0] - serverDepth + 1.5,
originStart[2] + railHeight * 1.75 / 2 + .438 / 2
], %)
|> xLine(0.75 - .438, %)
|> xLine(length = 0.75 - .438)
|> tangentialArcTo([
-0.66 - originStart[0] - serverDepth + 1.5,
originStart[2] + railHeight * 1.75 / 2 - (.438 / 2)
], %)
|> xLine(-0.75 + .438, %)
|> xLine(length = -0.75 + .438)
|> tangentialArcTo([profileStartX(%), profileStartY(%)], %)
|> close()
@ -1750,12 +1750,12 @@ const sketch012rl = startSketchOn(extrude001rl, 'START')
-1.12 + (.75 - .438) / 2 - originStart[0] - serverDepth + 1.5,
originStart[2] + railHeight * 1.75 - .81 + .438 / 2
], %)
|> xLine(0.75 - .438, %)
|> xLine(length = 0.75 - .438)
|> tangentialArcTo([
-0.66 - originStart[0] - serverDepth + 1.5,
originStart[2] + railHeight * 1.75 - .81 - (.438 / 2)
], %)
|> xLine(-0.75 + .438, %)
|> xLine(length = -0.75 + .438)
|> tangentialArcTo([profileStartX(%), profileStartY(%)], %)
|> close()
|> patternLinear2d(
@ -1808,23 +1808,23 @@ fn streamServer = (serverPos) => {
const sketch002s = startSketchOn(planeXZs)
|> startProfileAt([-1, 4.114 + 1 + serverPos * 1.75], %)
|> yLine(6.98, %)
|> xLine(0.2, %)
|> yLine(-0.36, %)
|> xLine(0.5, %)
|> yLine(length = 6.98)
|> xLine(length = 0.2)
|> yLine(length = -0.36)
|> xLine(length = 0.5)
|> tangentialArcTo([
0.3,
17.15 + 4.114 + 1 + serverPos * 1.75 - 11.114
], %)
|> yLine(-1.77, %)
|> yLine(length = -1.77)
|> tangentialArcTo([
-0.13,
14.89 + 4.114 + 1 + serverPos * 1.75 - 11.114
], %)
|> xLine(-0.52, %)
|> yLine(-0.42, %)
|> xLine(length = -0.52)
|> yLine(length = -0.42)
|> line(end = [0.34, -0.15])
|> yLine(-2.97, %)
|> yLine(length = -2.97)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
@ -1832,23 +1832,23 @@ fn streamServer = (serverPos) => {
const sketch003s = startSketchOn(planeXZs2)
|> startProfileAt([-1, 4.114 + 1 + serverPos * 1.75], %)
|> yLine(6.98, %)
|> xLine(0.2, %)
|> yLine(-0.36, %)
|> xLine(0.5, %)
|> yLine(length = 6.98)
|> xLine(length = 0.2)
|> yLine(length = -0.36)
|> xLine(length = 0.5)
|> tangentialArcTo([
0.3,
17.15 + 4.114 + 1 + serverPos * 1.75 - 11.114
], %)
|> yLine(-1.77, %)
|> yLine(length = -1.77)
|> tangentialArcTo([
-0.13,
14.89 + 4.114 + 1 + serverPos * 1.75 - 11.114
], %)
|> xLine(-0.52, %)
|> yLine(-0.42, %)
|> xLine(length = -0.52)
|> yLine(length = -0.42)
|> line(end = [0.34, -0.15])
|> yLine(-2.97, %)
|> yLine(length = -2.97)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()

View File

@ -23,9 +23,9 @@ fn caster = (originStart) => {
const sketch001c = startSketchOn(plane001c)
|> startProfileAt([0, 0], %)
|> xLine(3.543, %)
|> yLine(3.543, %)
|> xLine(-3.543, %)
|> xLine(length = 3.543)
|> yLine(length = 3.543)
|> xLine(length = -3.543)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> hole(circle({ center: [
@ -108,21 +108,21 @@ const plane001 = {
const sketch001l = startSketchOn(plane001)
|> startProfileAt([0, 0], %)
|> xLine(serverDepth + .8, %)
|> xLine(length = serverDepth + .8)
|> angledLineToY({ angle: -45, to: 1 }, %)
|> xLine(-serverDepth + 2 - .8, %, $seg01)
|> xLine(length = -serverDepth + 2 - .8, tag = $seg01)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
const extrude001l = extrude(sketch001l, length = 1)
const sketch002l = startSketchOn(plane001)
|> startProfileAt([serverDepth + .8, 0], %)
|> yLine(railHeight * 1.75 + 2, %)
|> yLine(length = railHeight * 1.75 + 2)
|> angledLineToX({
angle: -135,
to: serverDepth - 1 + .8
}, %)
|> yLine(-railHeight * 1.75, %)
|> yLine(length = -railHeight * 1.75)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
const extrude002l = extrude(sketch002l, length = 1)
@ -132,24 +132,24 @@ const sketch003l = startSketchOn(plane001)
serverDepth + .8,
railHeight * 1.75 + 2
], %)
|> xLine(-serverDepth - .8, %, $seg02)
|> xLine(length = -serverDepth - .8, tag = $seg02)
|> angledLineToY({
angle: -45,
to: railHeight * 1.75 - 1 + 2
}, %)
|> xLine(serverDepth - 2 + .8, %)
|> xLine(length = serverDepth - 2 + .8)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
const extrude003l = extrude(sketch003l, length = 1)
const sketch004l = startSketchOn(plane001)
|> startProfileAt([0, 0], %)
|> yLine(railHeight * 1.75 + 2, %)
|> yLine(length = railHeight * 1.75 + 2)
|> angledLineToY({
angle: 135,
to: railHeight * 1.75 + 2 - 1
}, %)
|> yLine(-railHeight * 1.75, %)
|> yLine(length = -railHeight * 1.75)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
const extrude004l = extrude(sketch004l, length = 1)
@ -157,7 +157,7 @@ const extrude004l = extrude(sketch004l, length = 1)
const sketch005l = startSketchOn(plane001)
|> startProfileAt([serverDepth - 1.25, 1], %)
|> line(end = [-serverDepth + 2.25, railHeight * 1.75], tag = $lineToIntersect4)
|> xLine(1, %)
|> xLine(length = 1)
|> line(end = [serverDepth - 2.25, -railHeight * 1.75], tag = $lineToIntersect5)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
@ -211,42 +211,42 @@ const plane002 = {
const sketch001w = startSketchOn(plane002)
|> startProfileAt([0, 0], %)
|> xLine(depth, %)
|> xLine(length = depth)
|> angledLineToY({ angle: -45, to: 1 }, %)
|> xLine(-depth + 2, %, $seg01w)
|> xLine(length = -depth + 2, tag = $seg01w)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
const extrude001w = extrude(sketch001w, length = 1)
const sketch002w = startSketchOn(plane002)
|> startProfileAt([depth, 0], %)
|> yLine(railHeight * 1.75 + 2, %)
|> yLine(length = railHeight * 1.75 + 2)
|> angledLineToX({ angle: -135, to: depth - 1 }, %)
|> yLine(-railHeight * 1.75, %)
|> yLine(length = -railHeight * 1.75)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
const extrude002w = extrude(sketch002w, length = 1)
const sketch003w = startSketchOn(plane002)
|> startProfileAt([depth, railHeight * 1.75 + 2], %)
|> xLine(-depth, %, $seg02w)
|> xLine(length = -depth, tag = $seg02w)
|> angledLineToY({
angle: -45,
to: railHeight * 1.75 - 1 + 2
}, %)
|> xLine(depth - 2, %)
|> xLine(length = depth - 2)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
const extrude003w = extrude(sketch003w, length = 1)
const sketch004w = startSketchOn(plane002)
|> startProfileAt([0, 0], %)
|> yLine(railHeight * 1.75 + 2, %)
|> yLine(length = railHeight * 1.75 + 2)
|> angledLineToY({
angle: 135,
to: railHeight * 1.75 + 2 - 1
}, %)
|> yLine(-railHeight * 1.75, %)
|> yLine(length = -railHeight * 1.75)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
const extrude004w = extrude(sketch004w, length = 1)
@ -266,7 +266,7 @@ const sketch006w = startSketchOn(plane002)
40.6 - (35.5 * sin(23 * pi() / 180)) + 1.75 / 2
], %)
|> angledLineToX({ angle: -23 + 90, to: depth - 1 }, %)
|> yLine(2.56, %)
|> yLine(length = 2.56)
|> angledLineThatIntersects({
angle: -23 + 90 + 180,
intersectTag: lineToIntersect,
@ -355,7 +355,7 @@ const sketch013w = startSketchOn(plane002)
], %)
|> angledLine({ angle: -23, length: 1 }, %)
|> angledLineToX({ angle: -23 + 90, to: 1 }, %)
|> yLine(2.56, %)
|> yLine(length = 2.56)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
const extrude013w = extrude(sketch013w, length = 1)
@ -460,7 +460,7 @@ const extrude020w = extrude(sketch020w, length = 1)
const sketch021w = startSketchOn(plane002)
|> startProfileAt([1, 21.9], %)
|> angledLineToX({ angle: -23, to: depth - 1 }, %)
|> yLine(-1.1, %)
|> yLine(length = -1.1)
|> angledLineToX({ angle: -23, to: 1 }, %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
@ -472,7 +472,7 @@ const sketch022w = startSketchOn(plane002)
angle: 180 - 23,
to: railHeight * 1.75 + 1
}, %)
|> xLine(-2.56, %)
|> xLine(length = -2.56)
|> angledLineToX({ angle: -23, to: depth - 1 }, %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
@ -484,7 +484,7 @@ const sketch023w = startSketchOn(plane002)
angle: 90 - 23,
to: railHeight * 1.75 + 1
}, %)
|> xLine(1.086, %)
|> xLine(length = 1.086)
|> angledLineToX({ angle: 90 - 23, to: 1 }, %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
@ -493,7 +493,7 @@ const extrude023w = extrude(sketch023w, length = 1)
const sketch024w = startSketchOn(plane002)
|> startProfileAt([1, 16.5], %)
|> angledLineToY({ angle: -23, to: 1 }, %)
|> xLine(-2.56, %)
|> xLine(length = -2.56)
|> angledLineToX({ angle: -23, to: 1 }, %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
@ -502,7 +502,7 @@ const extrude024w = extrude(sketch024w, length = 1)
const sketch025w = startSketchOn(plane002)
|> startProfileAt([1, 4], %)
|> angledLineToY({ angle: -23, to: 1 }, %)
|> xLine(-2.56, %)
|> xLine(length = -2.56)
|> angledLineToX({ angle: -23, to: 1 }, %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
@ -694,13 +694,13 @@ const sketch003fl = startSketchOn(planeXYfl)
angleEnd: 180,
radius: bendRad + thickness
}, %)
|> xLine(thickness, %)
|> xLine(length = thickness)
|> arc({
angleStart: 180,
angleEnd: 270,
radius: bendRad
}, %)
|> yLine(-thickness, %)
|> yLine(length = -thickness)
|> close()
const extrude003fl = extrude(sketch003fl, length = railHeight * 1.75)
@ -711,12 +711,12 @@ const sketch010fl = startSketchOn(extrude001fl, 'START')
-1.12 + (.75 - .438) / 2 - originStart[0],
originStart[2] + .81 - (.438 / 2)
], %)
|> xLine(0.75 - .438, %)
|> xLine(length = 0.75 - .438)
|> tangentialArcTo([
-0.66 - originStart[0],
originStart[2] + .81 + .438 / 2
], %)
|> xLine(-0.75 + .438, %)
|> xLine(length = -0.75 + .438)
|> tangentialArcTo([profileStartX(%), profileStartY(%)], %)
|> close()
|> patternLinear2d(
@ -732,12 +732,12 @@ const sketch011fl = startSketchOn(extrude001fl, 'START')
-1.12 + (.75 - .438) / 2 - originStart[0],
originStart[2] + railHeight * 1.75 / 2 + .438 / 2
], %)
|> xLine(0.75 - .438, %)
|> xLine(length = 0.75 - .438)
|> tangentialArcTo([
-0.66 - originStart[0],
originStart[2] + railHeight * 1.75 / 2 - (.438 / 2)
], %)
|> xLine(-0.75 + .438, %)
|> xLine(length = -0.75 + .438)
|> tangentialArcTo([profileStartX(%), profileStartY(%)], %)
|> close()
@ -749,12 +749,12 @@ const sketch012fl = startSketchOn(extrude001fl, 'START')
-1.12 + (.75 - .438) / 2 - originStart[0],
originStart[2] + railHeight * 1.75 - .81 + .438 / 2
], %)
|> xLine(0.75 - .438, %)
|> xLine(length = 0.75 - .438)
|> tangentialArcTo([
-0.66 - originStart[0],
originStart[2] + railHeight * 1.75 - .81 - (.438 / 2)
], %)
|> xLine(-0.75 + .438, %)
|> xLine(length = -0.75 + .438)
|> tangentialArcTo([profileStartX(%), profileStartY(%)], %)
|> close()
|> patternLinear2d(
@ -845,7 +845,7 @@ const sketch003fr = startSketchOn(planeXYfr)
angleEnd: -90,
radius: bendRad
}, %)
|> yLine(-thickness, %)
|> yLine(length = -thickness)
|> arc({
angleStart: -90,
angleEnd: 0,
@ -861,12 +861,12 @@ const sketch010fr = startSketchOn(extrude001fr, 'START')
-1.12 + (.75 - .438) / 2 - originStart[0],
originStart[2] + .81 - (.438 / 2)
], %)
|> xLine(0.75 - .438, %)
|> xLine(length = 0.75 - .438)
|> tangentialArcTo([
-0.66 - originStart[0],
originStart[2] + .81 + .438 / 2
], %)
|> xLine(-0.75 + .438, %)
|> xLine(length = -0.75 + .438)
|> tangentialArcTo([profileStartX(%), profileStartY(%)], %)
|> close()
|> patternLinear2d(
@ -882,12 +882,12 @@ const sketch011fr = startSketchOn(extrude001fr, 'START')
-1.12 + (.75 - .438) / 2 - originStart[0],
originStart[2] + railHeight * 1.75 / 2 + .438 / 2
], %)
|> xLine(0.75 - .438, %)
|> xLine(length = 0.75 - .438)
|> tangentialArcTo([
-0.66 - originStart[0],
originStart[2] + railHeight * 1.75 / 2 - (.438 / 2)
], %)
|> xLine(-0.75 + .438, %)
|> xLine(length = -0.75 + .438)
|> tangentialArcTo([profileStartX(%), profileStartY(%)], %)
|> close()
@ -899,12 +899,12 @@ const sketch012fr = startSketchOn(extrude001fr, 'START')
-1.12 + (.75 - .438) / 2 - originStart[0],
originStart[2] + railHeight * 1.75 - .81 + .438 / 2
], %)
|> xLine(0.75 - .438, %)
|> xLine(length = 0.75 - .438)
|> tangentialArcTo([
-0.66 - originStart[0],
originStart[2] + railHeight * 1.75 - .81 - (.438 / 2)
], %)
|> xLine(-0.75 + .438, %)
|> xLine(length = -0.75 + .438)
|> tangentialArcTo([profileStartX(%), profileStartY(%)], %)
|> close()
|> patternLinear2d(
@ -995,7 +995,7 @@ const sketch003rr = startSketchOn(planeXYrr)
angleEnd: 90,
radius: bendRad + thickness
}, %)
|> yLine(-thickness, %)
|> yLine(length = -thickness)
|> arc({
angleStart: 90,
angleEnd: 0,
@ -1011,12 +1011,12 @@ const sketch010rr = startSketchOn(extrude001rr, 'START')
-1.12 + (.75 - .438) / 2 - originStart[0] + 1.5 - serverDepth,
originStart[2] + .81 - (.438 / 2)
], %)
|> xLine(0.75 - .438, %)
|> xLine(length = 0.75 - .438)
|> tangentialArcTo([
-0.66 - originStart[0] + 1.5 - serverDepth,
originStart[2] + .81 + .438 / 2
], %)
|> xLine(-0.75 + .438, %)
|> xLine(length = -0.75 + .438)
|> tangentialArcTo([profileStartX(%), profileStartY(%)], %)
|> close()
|> patternLinear2d(
@ -1032,12 +1032,12 @@ const sketch011rr = startSketchOn(extrude001rr, 'START')
-1.12 + (.75 - .438) / 2 - originStart[0] + 1.5 - serverDepth,
originStart[2] + railHeight * 1.75 / 2 + .438 / 2
], %)
|> xLine(0.75 - .438, %)
|> xLine(length = 0.75 - .438)
|> tangentialArcTo([
-0.66 - originStart[0] + 1.5 - serverDepth,
originStart[2] + railHeight * 1.75 / 2 - (.438 / 2)
], %)
|> xLine(-0.75 + .438, %)
|> xLine(length = -0.75 + .438)
|> tangentialArcTo([profileStartX(%), profileStartY(%)], %)
|> close()
@ -1049,12 +1049,12 @@ const sketch012rr = startSketchOn(extrude001rr, 'START')
-1.12 + (.75 - .438) / 2 - originStart[0] + 1.5 - serverDepth,
originStart[2] + railHeight * 1.75 - .81 + .438 / 2
], %)
|> xLine(0.75 - .438, %)
|> xLine(length = 0.75 - .438)
|> tangentialArcTo([
-0.66 - originStart[0] + 1.5 - serverDepth,
originStart[2] + railHeight * 1.75 - .81 - (.438 / 2)
], %)
|> xLine(-0.75 + .438, %)
|> xLine(length = -0.75 + .438)
|> tangentialArcTo([profileStartX(%), profileStartY(%)], %)
|> close()
|> patternLinear2d(
@ -1144,7 +1144,7 @@ const sketch003rl = startSketchOn(planeXYrl)
angleEnd: 180,
radius: bendRad
}, %)
|> xLine(-thickness, %)
|> xLine(length = -thickness)
|> arc({
angleStart: 180,
angleEnd: 90,
@ -1160,12 +1160,12 @@ const sketch010rl = startSketchOn(extrude001rl, 'START')
-1.12 + (.75 - .438) / 2 - originStart[0] - serverDepth + 1.5,
originStart[2] + .81 - (.438 / 2)
], %)
|> xLine(0.75 - .438, %)
|> xLine(length = 0.75 - .438)
|> tangentialArcTo([
-0.66 - originStart[0] - serverDepth + 1.5,
originStart[2] + .81 + .438 / 2
], %)
|> xLine(-0.75 + .438, %)
|> xLine(length = -0.75 + .438)
|> tangentialArcTo([profileStartX(%), profileStartY(%)], %)
|> close()
|> patternLinear2d(
@ -1181,12 +1181,12 @@ const sketch011rl = startSketchOn(extrude001rl, 'START')
-1.12 + (.75 - .438) / 2 - originStart[0] - serverDepth + 1.5,
originStart[2] + railHeight * 1.75 / 2 + .438 / 2
], %)
|> xLine(0.75 - .438, %)
|> xLine(length = 0.75 - .438)
|> tangentialArcTo([
-0.66 - originStart[0] - serverDepth + 1.5,
originStart[2] + railHeight * 1.75 / 2 - (.438 / 2)
], %)
|> xLine(-0.75 + .438, %)
|> xLine(length = -0.75 + .438)
|> tangentialArcTo([profileStartX(%), profileStartY(%)], %)
|> close()
@ -1198,12 +1198,12 @@ const sketch012rl = startSketchOn(extrude001rl, 'START')
-1.12 + (.75 - .438) / 2 - originStart[0] - serverDepth + 1.5,
originStart[2] + railHeight * 1.75 - .81 + .438 / 2
], %)
|> xLine(0.75 - .438, %)
|> xLine(length = 0.75 - .438)
|> tangentialArcTo([
-0.66 - originStart[0] - serverDepth + 1.5,
originStart[2] + railHeight * 1.75 - .81 - (.438 / 2)
], %)
|> xLine(-0.75 + .438, %)
|> xLine(length = -0.75 + .438)
|> tangentialArcTo([profileStartX(%), profileStartY(%)], %)
|> close()
|> patternLinear2d(
@ -1255,23 +1255,23 @@ fn streamServer = (serverPos) => {
const sketch002s = startSketchOn(planeXZs)
|> startProfileAt([-1, 4.114 + 1 + serverPos * 1.75], %)
|> yLine(6.98, %)
|> xLine(0.2, %)
|> yLine(-0.36, %)
|> xLine(0.5, %)
|> yLine(length = 6.98)
|> xLine(length = 0.2)
|> yLine(length = -0.36)
|> xLine(length = 0.5)
|> tangentialArcTo([
0.3,
17.15 + 4.114 + 1 + serverPos * 1.75 - 11.114
], %)
|> yLine(-1.77, %)
|> yLine(length = -1.77)
|> tangentialArcTo([
-0.13,
14.89 + 4.114 + 1 + serverPos * 1.75 - 11.114
], %)
|> xLine(-0.52, %)
|> yLine(-0.42, %)
|> xLine(length = -0.52)
|> yLine(length = -0.42)
|> line(end = [0.34, -0.15])
|> yLine(-2.97, %)
|> yLine(length = -2.97)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
@ -1279,23 +1279,23 @@ fn streamServer = (serverPos) => {
const sketch003s = startSketchOn(planeXZs2)
|> startProfileAt([-1, 4.114 + 1 + serverPos * 1.75], %)
|> yLine(6.98, %)
|> xLine(0.2, %)
|> yLine(-0.36, %)
|> xLine(0.5, %)
|> yLine(length = 6.98)
|> xLine(length = 0.2)
|> yLine(length = -0.36)
|> xLine(length = 0.5)
|> tangentialArcTo([
0.3,
17.15 + 4.114 + 1 + serverPos * 1.75 - 11.114
], %)
|> yLine(-1.77, %)
|> yLine(length = -1.77)
|> tangentialArcTo([
-0.13,
14.89 + 4.114 + 1 + serverPos * 1.75 - 11.114
], %)
|> xLine(-0.52, %)
|> yLine(-0.42, %)
|> xLine(length = -0.52)
|> yLine(length = -0.42)
|> line(end = [0.34, -0.15])
|> yLine(-2.97, %)
|> yLine(length = -2.97)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()

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