KCL: Convert x/y lines to use keyword arguments (#5615)

Previously, `xLine`, `xLineTo`, `yLine` and `yLineTo` used positional arguments. Now:

- `xLineTo` and `yLineTo` have been removed
- `xLine` and `yLine` both use keyword arguments:
  - `length`, optional (i.e. a relative distance along the X or Y axis)
  - `endAbsolute` optional (i.e. an absolute point along the X or Y axis)
  - `tag` optional
- Exactly one of `length` or `endAbsolute` must be given. Not both, not neither.

For example:

```
// Old way
|> xLine(6.04, %)
|> yLineTo(20, %, $base)

// New way
|> xLine(length = 6.04)
|> yLine(endAbsolute = 20, tag = $base)
```

This also improves some of the general-purpose keyword arguments code in modeling app's TS codebase.
This commit is contained in:
Adam Chalmers
2025-03-07 22:07:16 -06:00
committed by GitHub
parent bc3a0e3896
commit aea82e004a
289 changed files with 65906 additions and 67955 deletions

View File

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

View File

@ -35,10 +35,10 @@ angledLine(
```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)

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

@ -41,7 +41,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

@ -131,9 +131,7 @@ layout: manual
* [`toRadians`](kcl/toRadians)
* [`translate`](kcl/translate)
* [`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

@ -38,7 +38,7 @@ pow(
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

@ -137,9 +137,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)

View File

@ -10,8 +10,9 @@ Draw a line relative to the current origin to a specified distance away from the
```js
xLine(
length: number,
sketch: Sketch,
length?: number,
endAbsolute?: number,
tag?: TagDeclarator,
): Sketch
```
@ -21,9 +22,10 @@ xLine(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `length` | [`number`](/docs/kcl/types/number) | | Yes |
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes |
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | Which sketch should this path be added to? | Yes |
| `length` | [`number`](/docs/kcl/types/number) | How far away along the X axis should this line go? Incompatible with `endAbsolute`. | No |
| `endAbsolute` | [`number`](/docs/kcl/types/number) | Which absolute X value should this line go to? Incompatible with `length`. | No |
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this line | No |
### Returns
@ -35,12 +37,12 @@ xLine(
```js
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)

View File

@ -10,8 +10,9 @@ Draw a line relative to the current origin to a specified distance away from the
```js
yLine(
length: number,
sketch: Sketch,
length?: number,
endAbsolute?: number,
tag?: TagDeclarator,
): Sketch
```
@ -21,9 +22,10 @@ yLine(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `length` | [`number`](/docs/kcl/types/number) | | Yes |
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes |
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | Which sketch should this path be added to? | Yes |
| `length` | [`number`](/docs/kcl/types/number) | How far away along the Y axis should this line go? Incompatible with `endAbsolute`. | No |
| `endAbsolute` | [`number`](/docs/kcl/types/number) | Which absolute Y value should this line go to? Incompatible with `length`. | No |
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this line | No |
### Returns
@ -35,10 +37,10 @@ yLine(
```js
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)

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

@ -800,10 +800,10 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await page.keyboard.press('ArrowDown')
await page.keyboard.press('Enter')
// finish line with comment
await page.keyboard.type('5')
await page.waitForTimeout(100)
await page.keyboard.press('Tab')
await page.waitForTimeout(100)
await page.keyboard.type('5')
await page.waitForTimeout(100)
await page.keyboard.press('Tab')
await page.keyboard.type(' // ')
@ -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)
@ -873,10 +873,10 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await page.keyboard.press('ArrowDown')
await page.keyboard.press('Tab')
// finish line with comment
await page.keyboard.type('5')
await page.waitForTimeout(100)
await page.keyboard.press('Tab')
await page.waitForTimeout(100)
await page.keyboard.type('5')
await page.waitForTimeout(100)
await page.keyboard.press('Tab')
await page.keyboard.type(' // ')
@ -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()
@ -402,7 +402,7 @@ test.describe('Feature Tree pane', () => {
sketch001 = startSketchOn(plane001)
profile001 = circle(sketch001, center = [0, 20], radius = 12)
profile002 = startProfileAt([0, 7.25], sketch001)
|> xLine(13.3, %)
|> xLine(length = 13.3)
profile003 = startProfileAt([0, -4.93], sketch001)
|> line(endAbsolute = [-5.56, 0])`
await context.folderSetupFn(async (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

@ -32,9 +32,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

@ -13,9 +13,9 @@ profile001 = startProfileAt([57.81, 250.51], sketch001)
extrude001 = extrude(profile001, length = 200)
sketch002 = startSketchOn('XZ')
|> startProfileAt([-114, 85.52], %)
|> xLine(265.36, %)
|> xLine(length = 265.36)
|> line(end = [33.17, -261.22])
|> xLine(-297.25, %)
|> xLine(length = -297.25)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
extrude002 = extrude(sketch002, length = 50)

View File

@ -249,7 +249,7 @@ extrude001 = extrude(sketch001, length = 50)
`exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %)
|> angledLine({ angle: 50, length: 45 }, %)
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close()
|>
@ -305,7 +305,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] })
@ -691,15 +691,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
@ -728,15 +728,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)
@ -761,8 +761,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()`
@ -1018,7 +1018,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"]')
@ -1094,8 +1094,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" }, %)
@ -1368,7 +1368,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)
`
)
})
@ -2318,7 +2318,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()
@ -2556,7 +2556,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()
@ -2609,7 +2609,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

@ -62,14 +62,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,
@ -80,15 +80,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)`
)
@ -443,7 +443,7 @@ test(
await page.waitForTimeout(500)
code += `
|> xLine(7.25, %)`
|> xLine(length = 7.25)`
await expect(page.locator('.cm-content')).toHaveText(code)
await page
@ -609,7 +609,7 @@ test.describe(
await page.waitForTimeout(100)
code += `
|> xLine(7.25, %)`
|> xLine(length = 7.25)`
await expect(u.codeLocator).toHaveText(code)
await page
@ -704,7 +704,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: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

View File

@ -1,5 +1,5 @@
{
"original_source_code": "sketch001 = startSketchOn('XZ')\nprofile001 = startProfileAt([57.81, 250.51], sketch001)\n |> line(end = [121.13, 56.63], tag = $seg02)\n |> line(end = [83.37, -34.61], tag = $seg01)\n |> line(end = [19.66, -116.4])\n |> line(end = [-221.8, -41.69])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\nextrude001 = extrude(profile001, length = 200)\nsketch002 = startSketchOn('XZ')\n |> startProfileAt([-73.64, -42.89], %)\n |> xLine(173.71, %)\n |> line(end = [-22.12, -94.4])\n |> xLine(-156.98, %)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\nextrude002 = extrude(sketch002, length = 50)\nsketch003 = startSketchOn('XY')\n |> startProfileAt([52.92, 157.81], %)\n |> angledLine([0, 176.4], %, $rectangleSegmentA001)\n |> angledLine([\n segAng(rectangleSegmentA001) - 90,\n 53.4\n ], %, $rectangleSegmentB001)\n |> angledLine([\n segAng(rectangleSegmentA001),\n -segLen(rectangleSegmentA001)\n ], %, $rectangleSegmentC001)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\nextrude003 = extrude(sketch003, length = 20)\n",
"original_source_code": "sketch001 = startSketchOn('XZ')\nprofile001 = startProfileAt([57.81, 250.51], sketch001)\n |> line(end = [121.13, 56.63], tag = $seg02)\n |> line(end = [83.37, -34.61], tag = $seg01)\n |> line(end = [19.66, -116.4])\n |> line(end = [-221.8, -41.69])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\nextrude001 = extrude(profile001, length = 200)\nsketch002 = startSketchOn('XZ')\n |> startProfileAt([-73.64, -42.89], %)\n |> xLine(length = 173.71)\n |> line(end = [-22.12, -94.4])\n |> xLine(length = -156.98)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\nextrude002 = extrude(sketch002, length = 50)\nsketch003 = startSketchOn('XY')\n |> startProfileAt([52.92, 157.81], %)\n |> angledLine([0, 176.4], %, $rectangleSegmentA001)\n |> angledLine([\n segAng(rectangleSegmentA001) - 90,\n 53.4\n ], %, $rectangleSegmentB001)\n |> angledLine([\n segAng(rectangleSegmentA001),\n -segLen(rectangleSegmentA001)\n ], %, $rectangleSegmentC001)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\nextrude003 = extrude(sketch003, length = 20)\n",
"prompt": "make this neon green please, use #39FF14",
"source_ranges": [
{

View File

@ -83,9 +83,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 }, %)
@ -150,7 +150,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)
@ -943,10 +943,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 }, %)
@ -972,7 +972,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)
@ -1056,7 +1056,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"]',
@ -1066,7 +1066,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"]',
@ -1076,7 +1076,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"]',
@ -1086,7 +1086,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"]',
@ -1151,10 +1151,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)',
@ -1167,7 +1167,7 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
for (const doesHaveTagOutsideSketch of [true, false]) {
for (const lineOfInterest of cases) {
const isObj = lineOfInterest.includes('{ angle = 3,')
test(`${lineOfInterest.split('(')[0]}${isObj ? '-[obj-input]' : ''}${
test(`${lineOfInterest.split('=')[0]}${isObj ? '-[obj-input]' : ''}${
doesHaveTagOutsideSketch ? '-[tagOutsideSketch]' : ''
}`, async ({ page, editor, homePage }) => {
await page.addInitScript(
@ -1294,19 +1294,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)`,
},
{
@ -1329,7 +1329,7 @@ test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
for (const { before, after } of cases) {
const isObj = before.includes('{ angle = 3')
test(`${before.split('(')[0]}${isObj ? '-[obj-input]' : ''}`, async ({
test(`${before.split('=')[0]}${isObj ? '-[obj-input]' : ''}`, async ({
page,
editor,
homePage,

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)
@ -537,9 +541,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 ./rust/kcl-language-server",
"fetch:wasm": "./scripts/get-latest-wasm-bundle.sh",
"fetch:wasm:windows": "./scripts/get-latest-wasm-bundle.ps1",
"fetch:samples": "rm -rf public/kcl-samples* && curl -L -o public/kcl-samples.zip https://github.com/KittyCAD/kcl-samples/archive/refs/heads/next.zip && unzip -o public/kcl-samples.zip -d public && mv public/kcl-samples-* public/kcl-samples",
"fetch:samples": "rm -rf public/kcl-samples* && curl -L -o public/kcl-samples.zip https://github.com/KittyCAD/kcl-samples/archive/refs/heads/achalmers/kw-args-xylineto.zip && unzip -o public/kcl-samples.zip -d public && mv public/kcl-samples-* public/kcl-samples",
"build:wasm-dev": "yarn wasm-prep && (cd rust && wasm-pack build kcl-wasm-lib --dev --target web --out-dir pkg && cargo test -p kcl-lib export_bindings) && yarn isomorphic-copy-wasm && yarn fmt",
"build:wasm:nocopy": "yarn wasm-prep && cd rust && wasm-pack build kcl-wasm-lib --release --target web --out-dir pkg && cargo test -p kcl-lib export_bindings",
"build:wasm": "yarn build:wasm:nocopy && cp rust/kcl-wasm-lib/pkg/kcl_wasm_lib_bg.wasm public && yarn fmt",

View File

@ -14,11 +14,11 @@ fn dividerSketch(plane) {
|> tangentialArcTo([-16.6, profileStartY(%) - 15.52], %)
|> tangentialArcTo([-18.38, profileStartY(%) - 18.63], %)
|> line(end = [-1.25, -2.6])
|> xLine(6.04, %)
|> xLine(length = 6.04)
|> line(end = [6.68, 7.87])
|> tangentialArcTo([10.06, profileStartY(%) - 12.69], %)
|> line(end = [7.28, -8.47])
|> xLine(5.98, %)
|> xLine(length = 5.98)
|> line(end = [-1.3, 3.01])
|> tangentialArcTo([22.45, profileStartY(%) - 2.84], %)
|> tangentialArcTo([25.08, profileStartY(%) + 6.42], %)
@ -106,7 +106,7 @@ export fn backSlats(plane, length) {
fn armRestPath(plane) {
sketch005 = startSketchOn(plane)
|> startProfileAt([20, 33], %)
|> xLine(-20, %)
|> xLine(length = -20)
|> arc({
angleStart = 90,
angleEnd = 180,
@ -118,10 +118,10 @@ fn armRestPath(plane) {
fn armRestProfile(plane, offset) {
sketch006 = startSketchOn(plane)
|> startProfileAt([offset, 32.4], %)
|> xLine(1.3, %)
|> xLine(length = 1.3)
|> line(end = [0.3, 0.6])
|> line(end = [-0.3, 0.6])
|> xLine(-2.6, %)
|> xLine(length = -2.6)
|> line(end = [-0.3, -0.6])
|> line(end = [0.3, -0.6])
|> close()

View File

@ -22,33 +22,33 @@ fn rail8020(originStart, railHeight, railLength) {
angleEnd = 0,
radius = 0.072 / 4 * railHeight
}, %)
|> xLine(0.1 * railHeight, %)
|> xLine(length = 0.1 * railHeight)
|> arc({
angleStart = 180,
angleEnd = 0,
radius = 0.072 / 4 * railHeight
}, %)
|> xLine(0.06 * railHeight, %, $edge1)
|> yLine(0.087 * railHeight, %, $edge2)
|> xLine(-0.183 * railHeight, %, $edge3)
|> xLine(length = 0.06 * railHeight, tag = $edge1)
|> yLine(length = 0.087 * railHeight, tag = $edge2)
|> xLine(length = -0.183 * railHeight, tag = $edge3)
|> angledLineToY({
angle = 45,
to = (1 - 0.356) / 2 * railHeight + originStart[1]
}, %, $edge4)
|> xLine(0.232 * railHeight, %, $edge5)
|> xLine(length = 0.232 * railHeight, tag = $edge5)
|> angledLineToY({
angle = -45,
to = 0.087 * railHeight + originStart[1]
}, %, $edge6)
|> xLine(-0.183 * railHeight, %, $edge7)
|> yLine(-0.087 * railHeight, %, $edge8)
|> xLine(0.06 * railHeight, %)
|> xLine(length = -0.183 * railHeight, tag = $edge7)
|> yLine(length = -0.087 * railHeight, tag = $edge8)
|> xLine(length = 0.06 * railHeight)
|> arc({
angleStart = 180,
angleEnd = 0,
radius = 0.072 / 4 * railHeight
}, %)
|> xLine(0.1 * railHeight, %)
|> xLine(length = 0.1 * railHeight)
|> arc({
angleStart = 180,
angleEnd = 0,
@ -66,33 +66,33 @@ fn rail8020(originStart, railHeight, railLength) {
angleEnd = 90,
radius = 0.072 / 4 * railHeight
}, %)
|> yLine(0.1 * railHeight, %)
|> yLine(length = 0.1 * railHeight)
|> arc({
angleStart = 270,
angleEnd = 90,
radius = 0.072 / 4 * railHeight
}, %)
|> yLine(0.06 * railHeight, %, $edge9)
|> xLine(-0.087 * railHeight, %, $edge10)
|> yLine(-0.183 * railHeight, %, $edge11) // edge11
|> yLine(length = 0.06 * railHeight, tag = $edge9)
|> xLine(length = -0.087 * railHeight, tag = $edge10)
|> yLine(length = -0.183 * railHeight, tag = $edge11) // edge11
|> angledLineToX({
angle = 135,
to = ((1 - 0.356) / 2 + 0.356) * railHeight + originStart[0]
}, %, $edge12) // edge12
|> yLine(0.232 * railHeight, %, $edge13) // 13
|> yLine(length = 0.232 * railHeight, tag = $edge13) // 13
|> angledLineToX({
angle = 45,
to = (1 - 0.087) * railHeight + originStart[0]
}, %, $edge14) // 14
|> yLine(-0.183 * railHeight, %, $edge15) // 15
|> xLine(0.087 * railHeight, %, $edge16)
|> yLine(0.06 * railHeight, %)
|> yLine(length = -0.183 * railHeight, tag = $edge15) // 15
|> xLine(length = 0.087 * railHeight, tag = $edge16)
|> yLine(length = 0.06 * railHeight)
|> arc({
angleStart = 270,
angleEnd = 90,
radius = 0.072 / 4 * railHeight
}, %)
|> yLine(0.1 * railHeight, %)
|> yLine(length = 0.1 * railHeight)
|> arc({
angleStart = 270,
angleEnd = 90,
@ -110,33 +110,33 @@ fn rail8020(originStart, railHeight, railLength) {
angleEnd = -180,
radius = 0.072 / 4 * railHeight
}, %)
|> xLine(-0.1 * railHeight, %)
|> xLine(length = -0.1 * railHeight)
|> arc({
angleStart = 0,
angleEnd = -180,
radius = 0.072 / 4 * railHeight
}, %)
|> xLine(-0.06 * railHeight, %, $edge17)
|> yLine(-0.087 * railHeight, %, $edge18)
|> xLine(0.183 * railHeight, %, $edge19)
|> xLine(length = -0.06 * railHeight, tag = $edge17)
|> yLine(length = -0.087 * railHeight, tag = $edge18)
|> xLine(length = 0.183 * railHeight, tag = $edge19)
|> angledLineToY({
angle = 45,
to = ((1 - 0.356) / 2 + 0.356) * railHeight + originStart[1]
}, %, $edge20)
|> xLine(-0.232 * railHeight, %, $edge21)
|> xLine(length = -0.232 * railHeight, tag = $edge21)
|> angledLineToY({
angle = 135,
to = (1 - 0.087) * railHeight + originStart[1]
}, %, $edge22)
|> xLine(0.183 * railHeight, %, $edge23)
|> yLine(0.087 * railHeight, %, $edge24)
|> xLine(-0.06 * railHeight, %)
|> xLine(length = 0.183 * railHeight, tag = $edge23)
|> yLine(length = 0.087 * railHeight, tag = $edge24)
|> xLine(length = -0.06 * railHeight)
|> arc({
angleStart = 0,
angleEnd = -180,
radius = 0.072 / 4 * railHeight
}, %)
|> xLine(-0.1 * railHeight, %)
|> xLine(length = -0.1 * railHeight)
|> arc({
angleStart = 0,
angleEnd = -180,
@ -154,33 +154,33 @@ fn rail8020(originStart, railHeight, railLength) {
angleEnd = -90,
radius = 0.072 / 4 * railHeight
}, %)
|> yLine(-0.1 * railHeight, %)
|> yLine(length = -0.1 * railHeight)
|> arc({
angleStart = 90,
angleEnd = -90,
radius = 0.072 / 4 * railHeight
}, %)
|> yLine(-0.06 * railHeight, %, $edge25)
|> xLine(0.087 * railHeight, %, $edge26)
|> yLine(0.183 * railHeight, %, $edge27)
|> yLine(length = -0.06 * railHeight, tag = $edge25)
|> xLine(length = 0.087 * railHeight, tag = $edge26)
|> yLine(length = 0.183 * railHeight, tag = $edge27)
|> angledLineToX({
angle = 135,
to = (1 - 0.356) / 2 * railHeight + originStart[0]
}, %, $edge28)
|> yLine(-0.232 * railHeight, %, $edge29)
|> yLine(length = -0.232 * railHeight, tag = $edge29)
|> angledLineToX({
angle = 45,
to = 0.087 * railHeight + originStart[0]
}, %, $edge30)
|> yLine(0.183 * railHeight, %, $edge31)
|> xLine(-0.087 * railHeight, %, $edge32)
|> yLine(-0.06 * railHeight, %)
|> yLine(length = 0.183 * railHeight, tag = $edge31)
|> xLine(length = -0.087 * railHeight, tag = $edge32)
|> yLine(length = -0.06 * railHeight)
|> arc({
angleStart = 90,
angleEnd = -90,
radius = 0.072 / 4 * railHeight
}, %)
|> yLine(-0.1 * railHeight, %)
|> yLine(length = -0.1 * railHeight)
|> arc({
angleStart = 90,
angleEnd = -90,

View File

@ -81,9 +81,9 @@ spacers = extrude(spacerSketch, length = -spacerLength)
|> appearance(color = "#dbcd70", roughness = 90, metalness = 90)
rotorSlottedSketch = startSketchOn(rotor, 'START')
|> startProfileAt([2.17, 2.56], %)
|> xLine(0.12, %)
|> yLine(2.56, %)
|> xLine(-0.12, %)
|> xLine(length = 0.12)
|> yLine(length = 2.56)
|> xLine(length = -0.12)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> patternCircular2d(
@ -96,9 +96,9 @@ rotorSlotted = extrude(rotorSlottedSketch, length = -rotorSinglePlateThickness /
secondRotorSlottedSketch = startSketchOn(secondRotor, 'END')
|> startProfileAt([-2.17, 2.56], %)
|> xLine(-0.12, %)
|> yLine(2.56, %)
|> xLine(0.12, %)
|> xLine(length = -0.12)
|> yLine(length = 2.56)
|> xLine(length = 0.12)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> patternCircular2d(

View File

@ -65,13 +65,13 @@ lugHoles = startSketchOn(lugBase, 'END')
// Add detail to the wheel center by revolving curved edge profiles
wheelCenterInner = startSketchOn('XY')
|> startProfileAt([(lugSpacing - 1.5) / 2, 0], %)
|> yLine(-wheelWidth / 10 - (wheelWidth / 20), %)
|> yLine(length = -wheelWidth / 10 - (wheelWidth / 20))
|> bezierCurve({
to = [-0.4, 0.3],
control1 = [-0.3, 0],
control2 = [0, 0.3]
}, %)
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> revolve({ axis = 'y' }, %)
@ -79,13 +79,13 @@ wheelCenterInner = startSketchOn('XY')
wheelCenterOuter = startSketchOn('XY')
|> startProfileAt([(lugSpacing + 1.5) / 2, 0], %)
|> yLine(-wheelWidth / 10 - (wheelWidth / 20), %)
|> yLine(length = -wheelWidth / 10 - (wheelWidth / 20))
|> bezierCurve({
to = [0.4, -0.1],
control1 = [0.3, 0],
control2 = [0.2, -0.3]
}, %)
|> yLineTo(-wheelWidth / 20, %)
|> yLine(endAbsolute = -wheelWidth / 20)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> revolve({ axis = 'y' }, %)
@ -120,7 +120,7 @@ fn spoke(spokeGap, spokeAngle, spokeThickness) {
offset / 1.5
]
}, %)
|> yLine(-wheelWidth / 15, %)
|> yLine(length = -wheelWidth / 15)
|> bezierCurve({
to = [
-(wheelDiameter - lugSpacing - 2.9) / 2,
@ -160,38 +160,38 @@ startSketchOn('XY')
wheelDiameter / 2,
-wheelWidth + backSpacing + offset
], %)
|> yLine(wheelWidth * 0.25, %)
|> yLine(length = wheelWidth * 0.25)
|> line(end = [-wheelWidth * 0.02, wheelWidth * 0.02])
|> yLine(wheelWidth * 0.25, %)
|> yLine(length = wheelWidth * 0.25)
|> line(end = [wheelWidth * 0.02, wheelWidth * 0.02])
|> yLineTo(backSpacing + offset, %)
|> yLine(endAbsolute = backSpacing + offset)
|> line(end = [wheelWidth * 0.05, wheelWidth * .01])
|> yLine(wheelWidth * 0.05, %)
|> xLine(-wheelWidth * 0.03, %)
|> yLine(-wheelWidth * 0.02, %)
|> yLine(length = wheelWidth * 0.05)
|> xLine(length = -wheelWidth * 0.03)
|> yLine(length = -wheelWidth * 0.02)
|> line(end = [-wheelWidth * 0.05, -wheelWidth * 0.01])
|> yLine(-backSpacing * 0.7, %)
|> yLine(length = -backSpacing * 0.7)
|> line(end = [
-wheelDiameter * 0.01,
-wheelWidth * 0.02
])
|> yLineTo(offset - 0.2, %)
|> yLine(endAbsolute = offset - 0.2)
|> line(end = [
-wheelDiameter * 0.03,
-wheelWidth * 0.02
])
|> yLine(-wheelWidth * 0.02, %)
|> yLine(length = -wheelWidth * 0.02)
|> line(end = [
wheelDiameter * 0.03,
-wheelWidth * 0.1
])
|> yLine(-wheelWidth * 0.05, %)
|> yLine(length = -wheelWidth * 0.05)
|> line(end = [wheelWidth * 0.02, -wheelWidth * 0.02])
|> yLineTo(-wheelWidth + backSpacing + offset - 0.28, %)
|> yLine(endAbsolute = -wheelWidth + backSpacing + offset - 0.28)
|> line(end = [wheelWidth * 0.05, -wheelWidth * 0.01])
|> yLine(-wheelWidth * 0.02, %)
|> xLine(wheelWidth * 0.03, %)
|> yLine(wheelWidth * 0.05, %)
|> yLine(length = -wheelWidth * 0.02)
|> xLine(length = wheelWidth * 0.03)
|> yLine(length = wheelWidth * 0.05)
|> close()
|> revolve({ axis = 'y' }, %)
|> appearance(color = "#ffffff", metalness = 0, roughness = 0)

View File

@ -26,13 +26,13 @@ fn lug(plane, length, diameter) {
lugSketch = startSketchOn(customPlane)
|> startProfileAt([0 + diameter / 2, 0], %)
|> angledLineOfYLength({ angle = 70, length = lugHeadLength }, %)
|> xLineTo(lugDiameter / 2, %)
|> yLineTo(lugLength, %)
|> xLine(endAbsolute = lugDiameter / 2)
|> yLine(endAbsolute = lugLength)
|> tangentialArc({ offset = 90, radius = 3 * mm() }, %)
|> xLineTo(0 + .001, %, $c1)
|> yLineTo(lugThreadDepth, %)
|> xLineTo(lugThreadDiameter, %)
|> yLineTo(0, %)
|> xLine(endAbsolute = 0 + .001, tag = $c1)
|> yLine(endAbsolute = lugThreadDepth)
|> xLine(endAbsolute = lugThreadDiameter)
|> yLine(endAbsolute = 0)
|> close()
|> revolve({ axis = "Y" }, %)
|> appearance(color = "#dbcd70", roughness = 90, metalness = 90)

View File

@ -68,19 +68,19 @@ primaryTube(3, 25.2, 5, 5, 3)
// Create the mounting flange for the header
flangeSketch = startSketchOn('XY')
|> startProfileAt([3 + 1.3, -1.25], %)
|> xLine(-2.6, %, $seg01)
|> xLine(length = -2.6, tag = $seg01)
|> tangentialArc({ radius = .3, offset = -40 }, %)
|> tangentialArc({ radius = .9, offset = 80 }, %)
|> tangentialArc({ radius = .3, offset = -40 }, %)
|> xLine(-1.4, %, $seg03)
|> yLine(segLen(seg01), %, $seg04)
|> xLine(3.1, %, $seg05)
|> xLine(length = -1.4, tag = $seg03)
|> yLine(length = segLen(seg01), tag = $seg04)
|> xLine(length = 3.1, tag = $seg05)
|> tangentialArc({ radius = .3, offset = -40 }, %)
|> tangentialArc({ radius = 1.5, offset = 80 }, %)
|> tangentialArc({ radius = .3, offset = -40 }, %)
|> xLine(segLen(seg05), %, $seg07)
|> yLineTo(profileStartY(%), %, $seg08)
|> xLine(-segLen(seg03), %, $seg09)
|> xLine(length = segLen(seg05), tag = $seg07)
|> yLine(endAbsolute = profileStartY(%), tag = $seg08)
|> xLine(length = -segLen(seg03), tag = $seg09)
|> tangentialArc({ radius = .3, offset = -40 }, %)
|> tangentialArc({ radius = .9, offset = 80 }, %)
|> tangentialArcTo([profileStartX(%), profileStartY(%)], %)

View File

@ -49,7 +49,7 @@ sketch000 = startSketchOn('XY')
// create a profile of the flipper
flipperProfile = startProfileAt([-flipperLength, -32.0], sketch000)
|> line(end = [flipperLength, 2.0])
|> yLine(60.0, %, $backEdge)
|> yLine(length = 60.0, tag = $backEdge)
|> line(end = [-flipperLength, 2.0])
|> arc({
angleEnd = 196.912390,
@ -96,7 +96,7 @@ handleProfile = startProfileAt([0.0, flipperThickness], sketch001)
|> line(end = [-1.710101, 4.698463])
|> line(end = [-141.995517, -51.682142], tag = $handleTopEdge)
|> line(end = [-36.139148, -36.139148])
|> xLine(7.071068, %)
|> xLine(length = 7.071068)
|> close()
// create an extrusion extrude001
@ -127,25 +127,25 @@ sketch002 = startSketchOn(handlePlane)
// create a profile of the grip
gripProfile = startProfileAt([-26.806746, -10.0], sketch002)
|> xLine(gripWidth - (2 * gripFilletRadius), %)
|> xLine(length = gripWidth - (2 * gripFilletRadius))
|> arc({
angleStart = -90.0,
angleEnd = 0.0,
radius = gripFilletRadius
}, %)
|> yLine(gripHeight - (2 * gripFilletRadius), %)
|> yLine(length = gripHeight - (2 * gripFilletRadius))
|> arc({
angleStart = 0.0,
angleEnd = 90.0,
radius = gripFilletRadius
}, %)
|> xLine(-(gripWidth - (2 * gripFilletRadius)), %)
|> xLine(length = -(gripWidth - (2 * gripFilletRadius)))
|> arc({
angleStart = 90.0,
angleEnd = 180.0,
radius = gripFilletRadius
}, %)
|> yLine(-(gripHeight - (2 * gripFilletRadius)), %, $gripEdgeTop)
|> yLine(length = -(gripHeight - (2 * gripFilletRadius)), tag = $gripEdgeTop)
|> arc({
angleStart = 180.0,
angleEnd = 270.0,

View File

@ -38,8 +38,8 @@ plane001 = {
// Cross section of the metal supports
sketch002 = startSketchOn(plane001)
|> startProfileAt([carafeDiameter / 2, 5.7], %)
|> xLine(0.1, %)
|> yLine(-5.2, %, $edge1)
|> xLine(length = 0.1)
|> yLine(length = -5.2, tag = $edge1)
|> arc({
angleStart = 180,
angleEnd = 205,
@ -57,9 +57,9 @@ sketch002 = startSketchOn(plane001)
angleEnd = 90,
radius = 0.5
}, %)
|> xLineTo(0.1, %, $edgeLen)
|> yLine(0.1, %)
|> xLine(segLen(edgeLen) + 0.035, %, $edge4)
|> xLine(endAbsolute = 0.1, tag = $edgeLen)
|> yLine(length = 0.1)
|> xLine(length = segLen(edgeLen) + 0.035, tag = $edge4)
|> arc({
angleStart = 90,
angleEnd = 60,
@ -105,7 +105,7 @@ extrude001 = extrude(sketch003, length = 0.050)
sketch004 = startSketchOn(extrude001, 'END')
|> startProfileAt([0.3, 0.17], %)
|> yLine(1.2, %)
|> yLine(length = 1.2)
|> arc({
angleStart = 90,
angleEnd = -30,
@ -125,14 +125,14 @@ extrude002 = extrude(sketch004, length = -0.050)
// Filter screen
sketch005 = startSketchOn('XZ')
|> startProfileAt([0.15, 1.11], %)
|> xLineTo(carafeDiameter / 2 - 0.2, %)
|> xLine(endAbsolute = carafeDiameter / 2 - 0.2)
|> angledLineToX({
angle = 30,
to = carafeDiameter / 2 - 0.07
}, %, $seg1)
|> angledLine({ angle = -60, length = 0.050 }, %)
|> angledLine({ angle = 30, length = -segLen(seg1) }, %)
|> xLineTo(0.15, %)
|> xLine(endAbsolute = 0.15)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> revolve({ axis = 'y' }, %)
@ -142,9 +142,9 @@ sketch006 = startSketchOn('XZ')
|> startProfileAt([0.1, 1], %)
|> line(end = [0.1, 0])
|> angledLineToX({ angle = 10, to = 0.05 }, %)
|> yLine(10, %)
|> yLine(length = 10)
|> line(end = [0.6, 0])
|> yLine(-.05, %)
|> yLine(length = -.05)
|> tangentialArc({ radius = 0.6, offset = -90 }, %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
@ -198,10 +198,10 @@ extrude006 = extrude(sketch010, length = carafeHeight)
// Draw and revolve the lid
sketch011 = startSketchOn('XZ')
|> startProfileAt([0.2, carafeHeight - 0.7], %)
|> xLine(carafeDiameter / 2 - 0.3, %)
|> yLine(0.7, %)
|> xLine(0.3, %)
|> yLine(0.4, %)
|> xLine(length = carafeDiameter / 2 - 0.3)
|> yLine(length = 0.7)
|> xLine(length = 0.3)
|> yLine(length = 0.4)
|> line(end = [-0.02, 0.02])
|> bezierCurve({
to = [-carafeDiameter / 2 - 0.1, 1],

View File

@ -95,9 +95,9 @@ keyWay = startSketchOn(body, 'END')
holeRadius * cos(startAngle),
holeRadius * sin(startAngle)
], %)
|> xLine(keywayDepth, %)
|> yLine(-keywayWidth, %)
|> xLine(-keywayDepth, %)
|> xLine(length = keywayDepth)
|> yLine(length = -keywayWidth)
|> xLine(length = -keywayDepth)
|> arc({
angleEnd = 180,
angleStart = -1 * 180 / PI * startAngle + 360,

View File

@ -25,9 +25,9 @@ height = firstStep + secondStep + thirdStep
fn face(plane) {
faceSketch = startSketchOn(plane)
|> startProfileAt([0, 0], %)
|> yLine(height, %)
|> yLine(length = height)
|> angledLineOfYLength({ angle = -45, length = thirdStep }, %)
|> yLine(-secondStep, %)
|> yLine(length = -secondStep)
|> angledLineOfYLength({ angle = -45, length = firstStep }, %)
|> close()
return faceSketch
@ -100,38 +100,38 @@ fn magnetCenterCutout(plane) {
firstStep + thirdStep,
2 * magOuterDiam
], %)
|> xLine(2 * magOuterDiam - (firstStep + thirdStep) - (magOuterDiam / 2), %)
|> xLine(length = 2 * magOuterDiam - (firstStep + thirdStep) - (magOuterDiam / 2))
|> arc({
angleStart = 90.0,
angleEnd = 0.0,
radius = magOuterDiam / 2
}, %)
|> yLine(-(2 * magOuterDiam - (firstStep + thirdStep) - (magOuterDiam / 2)), %)
|> xLine(binLength - (4 * magOuterDiam), %)
|> yLine(2 * magOuterDiam - (firstStep + thirdStep) - (magOuterDiam / 2), %)
|> yLine(length = -(2 * magOuterDiam - (firstStep + thirdStep) - (magOuterDiam / 2)))
|> xLine(length = binLength - (4 * magOuterDiam))
|> yLine(length = 2 * magOuterDiam - (firstStep + thirdStep) - (magOuterDiam / 2))
|> arc({
angleStart = 180.0,
angleEnd = 90.0,
radius = magOuterDiam / 2
}, %)
|> xLine(2 * magOuterDiam - (firstStep + thirdStep) - (magOuterDiam / 2), %)
|> yLine(binLength - (4 * magOuterDiam), %)
|> xLine(-(2 * magOuterDiam - (firstStep + thirdStep) - (magOuterDiam / 2)), %)
|> xLine(length = 2 * magOuterDiam - (firstStep + thirdStep) - (magOuterDiam / 2))
|> yLine(length = binLength - (4 * magOuterDiam))
|> xLine(length = -(2 * magOuterDiam - (firstStep + thirdStep) - (magOuterDiam / 2)))
|> arc({
angleStart = 270.0,
angleEnd = 180.0,
radius = magOuterDiam / 2
}, %)
|> yLine(2 * magOuterDiam - (firstStep + thirdStep) - (magOuterDiam / 2), %)
|> xLine(-(binLength - (4 * magOuterDiam)), %, $line012)
|> yLine(-(2 * magOuterDiam - (firstStep + thirdStep) - (magOuterDiam / 2)), %)
|> yLine(length = 2 * magOuterDiam - (firstStep + thirdStep) - (magOuterDiam / 2))
|> xLine(length = -(binLength - (4 * magOuterDiam)), tag = $line012)
|> yLine(length = -(2 * magOuterDiam - (firstStep + thirdStep) - (magOuterDiam / 2)))
|> arc({
angleStart = 360.0,
angleEnd = 270.0,
radius = magOuterDiam / 2
}, %)
|> xLine(-(2 * magOuterDiam - (firstStep + thirdStep) - (magOuterDiam / 2)), %)
|> yLine(-(binLength - (4 * magOuterDiam)), %)
|> xLine(length = -(2 * magOuterDiam - (firstStep + thirdStep) - (magOuterDiam / 2)))
|> yLine(length = -(binLength - (4 * magOuterDiam)))
|> close()
return magnetSketch
}
@ -140,9 +140,9 @@ fn magnetCenterCutout(plane) {
fn magnetBase(plane) {
magnetBaseSketch = startSketchOn(plane)
|> startProfileAt([0, 0], %)
|> xLine(binLength, %, $line001)
|> yLine(binLength, %, $line002)
|> xLineTo(profileStartX(%), %, $line003)
|> xLine(length = binLength, tag = $line001)
|> yLine(length = binLength, tag = $line002)
|> xLine(endAbsolute = profileStartX(%), tag = $line003)
|> close(tag = $line004)
|> hole(magnetCenterCutout(plane), %)
return magnetBaseSketch

View File

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

View File

@ -37,10 +37,10 @@ lipHeight = lipStep1 + lipStep2 + lipStep3 + lipStep4 + lipStep5
fn face(plane) {
faceSketch = startSketchOn(plane)
|> startProfileAt([binBaseLength + binTol, 0], %)
|> yLine(height, %)
|> xLine(-binBaseLength, %)
|> yLine(length = height)
|> xLine(length = -binBaseLength)
|> angledLineOfYLength({ angle = -45, length = thirdStep }, %)
|> yLine(-secondStep, %)
|> yLine(length = -secondStep)
|> angledLineOfYLength({ angle = -45, length = firstStep }, %)
|> close()
return faceSketch
@ -98,7 +98,7 @@ singleBinFill = startSketchOn("XY")
], %)
|> line(end = [binLength - (binBaseLength * 2), 0], tag = $line000)
|> line(end = [0, binLength - (binBaseLength * 2)], tag = $line001)
|> xLineTo(profileStartX(%), %, $line002)
|> xLine(endAbsolute = profileStartX(%), tag = $line002)
|> close(tag = $line003)
|> extrude(length = height)
|> fillet(
@ -172,9 +172,9 @@ binFill = patternLinear3d(
//
binTop = startSketchOn(offsetPlane("XY", offset = height))
|> startProfileAt([0, 0], %)
|> xLine((binLength + 2 * binTol) * countBinWidth, %, $line010)
|> yLine((binLength + 2 * binTol) * countBinLength, %, $line011)
|> xLineTo(profileStartX(%), %, $line012)
|> xLine(length = (binLength + 2 * binTol) * countBinWidth, tag = $line010)
|> yLine(length = (binLength + 2 * binTol) * countBinLength, tag = $line011)
|> xLine(endAbsolute = profileStartX(%), tag = $line012)
|> close(tag = $line013)
|> extrude(length = binHeight * countBinHeight)
|> fillet(
@ -192,7 +192,7 @@ binTop = startSketchOn(offsetPlane("XY", offset = height))
fn lipFace(plane) {
faceSketch = startSketchOn(plane)
|> startProfileAt([0, 0], %)
// |> yLine(lipHeight, %, $line100)
// |> yLine(length = lipHeight, tag = $line100)
|> line(end = [0.0, 5.792893], tag = $line000)
|> arc({
angleStart = 180.0,
@ -201,9 +201,9 @@ fn lipFace(plane) {
}, %, $arc000)
// |> angledLineOfYLength({ angle: -45, length: lipStep5 }, %)
|> line(end = [1.046447, -1.046447], tag = $line001)
|> yLine(-lipStep4, %)
|> yLine(length = -lipStep4)
|> angledLineOfYLength({ angle = -45, length = lipStep3 }, %)
|> yLine(-lipStep2, %)
|> yLine(length = -lipStep2)
|> angledLineOfYLength({ angle = -135, length = lipStep1 }, %)
|> close()
return faceSketch

View File

@ -30,10 +30,10 @@ height = firstStep + secondStep + thirdStep
fn face(plane) {
faceSketch = startSketchOn(plane)
|> startProfileAt([binBaseLength + binTol, 0], %)
|> yLine(height, %)
|> xLine(-binBaseLength, %)
|> yLine(length = height)
|> xLine(length = -binBaseLength)
|> angledLineOfYLength({ angle = -45, length = thirdStep }, %)
|> yLine(-secondStep, %)
|> yLine(length = -secondStep)
|> angledLineOfYLength({ angle = -45, length = firstStep }, %)
|> close()
return faceSketch
@ -91,7 +91,7 @@ singleBinFill = startSketchOn("XY")
], %)
|> line(end = [binLength - (binBaseLength * 2), 0], tag = $line000)
|> line(end = [0, binLength - (binBaseLength * 2)], tag = $line001)
|> xLineTo(profileStartX(%), %, $line002)
|> xLine(endAbsolute = profileStartX(%), tag = $line002)
|> close(tag = $line003)
|> extrude(length = height)
|> fillet(
@ -165,9 +165,9 @@ binFill = patternLinear3d(
// create the top of the bin
binTop = startSketchOn(offsetPlane("XY", offset = height))
|> startProfileAt([0, 0], %)
|> xLine((binLength + 2 * binTol) * countBinWidth, %, $line010)
|> yLine((binLength + 2 * binTol) * countBinLength, %, $line011)
|> xLineTo(profileStartX(%), %, $line012)
|> xLine(length = (binLength + 2 * binTol) * countBinWidth, tag = $line010)
|> yLine(length = (binLength + 2 * binTol) * countBinLength, tag = $line011)
|> xLine(endAbsolute = profileStartX(%), tag = $line012)
|> close(tag = $line013)
|> extrude(length = binHeight * countBinHeight)
|> fillet(

View File

@ -13,10 +13,10 @@ wallThickness = 0.293
// Sketch a quadrant of the beam cross section, then mirror for symmetry across each axis. Extrude to the appropriate length
sketch001 = startSketchOn('-XZ')
|> startProfileAt([0, beamHeight/2], %)
|> xLine(beamWidth/2, %)
|> yLine(-wallThickness, %)
|> xLineTo(wallThickness/2, %)
|> yLineTo(0, %)
|> xLine(length = beamWidth/2)
|> yLine(length = -wallThickness)
|> xLine(endAbsolute = wallThickness/2)
|> yLine(endAbsolute = 0)
|> mirror2d({ axis = 'X' }, %)
|> mirror2d({ axis = 'Y' }, %)
|> extrude(length = beamLength)

View File

@ -69,7 +69,7 @@ fn capScrew(start, length, dia) {
-start[0] + wallToWallLength / 2,
start[2]
], %)
|> yLine(-hexWallLength / 2, %)
|> yLine(length = -hexWallLength / 2)
|> angledLine({
angle = hexStartingAngle,
length = hexWallLength

View File

@ -24,7 +24,7 @@ pipeSketch = startSketchOn('XY')
length = pipeTransitionLength
}, %)
|> line(end = [0, -pipeLargeDiaLength])
|> xLine(-thickness, %)
|> xLine(length = -thickness)
|> line(end = [0, pipeLargeDiaLength])
|> angledLineToX({
angle = -pipeTransitionAngle + 180,

View File

@ -14,20 +14,20 @@ frontLength = 7
sketch001 = startSketchOn("-YZ")
|> startProfileAt([wallsWidth / 2, 0], %)
|> xLine(wallThickness / 2, %)
|> xLine(length = wallThickness / 2)
|> angledLineToX({ angle = 60, to = wallsWidth }, %, $seg01)
|> yLineTo(height, %)
|> xLine(-wallThickness, %)
|> yLineTo(segEndY(seg01), %)
|> yLine(endAbsolute = height)
|> xLine(length = -wallThickness)
|> yLine(endAbsolute = segEndY(seg01))
|> angledLineToX({
angle = 60,
to = wallsWidth / 2 + wallThickness / 2
}, %)
|> xLine(-wallThickness, %)
|> xLine(length = -wallThickness)
|> angledLineToX({ angle = 180 - 60, to = wallThickness }, %)
|> yLineTo(height, %)
|> xLineTo(0, %)
|> yLineTo(segEndY(seg01), %)
|> yLine(endAbsolute = height)
|> xLine(endAbsolute = 0)
|> yLine(endAbsolute = segEndY(seg01))
|> angledLineToY({ angle = 180 - 60, to = 0 }, %)
|> close()
part001 = revolve({
@ -42,20 +42,20 @@ part001 = revolve({
sketch002 = startSketchOn('-YZ')
|> startProfileAt([wallsWidth / 2, 0], %)
|> xLine(wallThickness / 2, %)
|> xLine(length = wallThickness / 2)
|> angledLineToX({ angle = 60, to = wallsWidth }, %, $seg02)
|> yLineTo(height, %)
|> xLine(-wallThickness, %)
|> yLineTo(segEndY(seg01), %)
|> yLine(endAbsolute = height)
|> xLine(length = -wallThickness)
|> yLine(endAbsolute = segEndY(seg01))
|> angledLineToX({
angle = 60,
to = wallsWidth / 2 + wallThickness / 2
}, %)
|> xLine(-wallThickness, %)
|> xLine(length = -wallThickness)
|> angledLineToX({ angle = 180 - 60, to = wallThickness }, %)
|> yLineTo(height, %)
|> xLineTo(0, %)
|> yLineTo(segEndY(seg02), %)
|> yLine(endAbsolute = height)
|> xLine(endAbsolute = 0)
|> yLine(endAbsolute = segEndY(seg02))
|> angledLineToY({ angle = 180 - 60, to = 0 }, %)
|> close()
|> extrude(length = backLength - height)
@ -81,23 +81,23 @@ sketch003 = startSketchOn(customPlane)
sketch004 = startSketchOn(sketch002, 'END')
|> startProfileAt([0, 0], %)
|> yLineTo(height, %)
|> xLineTo(wallThickness, %)
|> yLineTo(segEndY(seg01), %)
|> yLine(endAbsolute = height)
|> xLine(endAbsolute = wallThickness)
|> yLine(endAbsolute = segEndY(seg01))
|> angledLineToX({
angle = 180 - 60,
to = wallsWidth / 2 - (wallThickness / 2)
}, %)
|> xLine(wallThickness, %)
|> xLine(length = wallThickness)
|> angledLineToY({ angle = 60, to = segEndY(seg01) }, %)
|> yLineTo(height, %)
|> xLine(wallThickness, %)
|> yLine(endAbsolute = height)
|> xLine(length = wallThickness)
|> tangentialArcTo([
(frontLength - wallsWidth) / 2 + wallsWidth,
height - ((height - exitHeight) / 2)
], %)
|> tangentialArcTo([frontLength, exitHeight], %)
|> yLineTo(0, %)
|> yLine(endAbsolute = 0)
|> close(tag = $seg04)
|> extrude(length = wallThickness)
@ -115,30 +115,30 @@ customPlane2 = {
}
sketch005 = startSketchOn(customPlane2)
|> startProfileAt([0, 0], %)
|> yLineTo(height, %)
|> xLineTo(wallsWidth, %)
|> yLine(endAbsolute = height)
|> xLine(endAbsolute = wallsWidth)
|> tangentialArcTo([
(frontLength - wallsWidth) / 2 + wallsWidth,
height - ((height - exitHeight) / 2)
], %)
|> tangentialArcTo([frontLength, exitHeight], %)
|> yLineTo(0, %, $seg03)
|> yLine(endAbsolute = 0, tag = $seg03)
|> close()
|> extrude(length = wallThickness)
sketch006 = startSketchOn(sketch005, seg03)
|> startProfileAt([0, -1 * (backLength - height)], %)
|> xLineTo(-exitHeight, %)
|> yLine(-wallsWidth, %)
|> xLineTo(0, %)
|> xLine(endAbsolute = -exitHeight)
|> yLine(length = -wallsWidth)
|> xLine(endAbsolute = 0)
|> close()
|> extrude(length = wallThickness)
sketch007 = startSketchOn(sketch004, 'END')
|> startProfileAt([0, 0], %)
|> xLineTo(wallThickness, %)
|> yLineTo(height, %)
|> xLineTo(0, %)
|> xLine(endAbsolute = wallThickness)
|> yLine(endAbsolute = height)
|> xLine(endAbsolute = 0)
|> close()
|> extrude(length = wallsWidth - (2 * wallThickness))
@ -157,8 +157,8 @@ customPlane3 = {
sketch008 = startSketchOn(customPlane3)
|> startProfileAt([wallThickness, wallThickness], %)
|> xLineTo(frontLength, %)
|> yLine(wallsWidth - (2 * wallThickness), %)
|> xLineTo(wallThickness, %)
|> xLine(endAbsolute = frontLength)
|> yLine(length = wallsWidth - (2 * wallThickness))
|> xLine(endAbsolute = wallThickness)
|> close()
|> extrude(length = -wallThickness)

View File

@ -15,28 +15,28 @@ depth = 30
distanceToInsideEdge = slateWidthHalf + templateThickness + templateGap
sketch001 = startSketchOn('XZ')
|> startProfileAt([ZERO, depth + templateGap], %)
|> xLine(slateWidthHalf - radius, %, $seg01)
|> xLine(length = slateWidthHalf - radius, tag = $seg01)
|> arc({
angleEnd = 0,
angleStart = 90,
radius = 10 + templateGap
}, %, $seg09)
|> yLineTo(-templateThickness, %, $seg03)
|> xLine(templateThickness, %, $seg07)
|> yLineTo((segEndY(seg01) + templateThickness) / 2 - templateThickness, %, $seg02)
|> xLineTo(segEndX(seg03) + minClampingDistance, %, $seg06)
|> yLine(templateThickness * 2, %, $seg08)
|> xLineTo(segEndX(seg02) + 0, %, $seg05)
|> yLineTo(segEndY(seg01) + templateThickness, %, $seg10)
|> xLineTo(ZERO, %, $seg04)
|> xLine(-segLen(seg04), %)
|> yLine(-segLen(seg10), %)
|> xLine(-segLen(seg05), %)
|> yLine(-segLen(seg08), %)
|> xLine(segLen(seg06), %)
|> yLine(-segLen(seg02), %)
|> xLine(segLen(seg07), %)
|> yLine(segLen(seg03), %)
|> yLine(endAbsolute = -templateThickness, tag = $seg03)
|> xLine(length = templateThickness, tag = $seg07)
|> yLine(endAbsolute = (segEndY(seg01) + templateThickness) / 2 - templateThickness, tag = $seg02)
|> xLine(endAbsolute = segEndX(seg03) + minClampingDistance, tag = $seg06)
|> yLine(length = templateThickness * 2, tag = $seg08)
|> xLine(endAbsolute = segEndX(seg02) + 0, tag = $seg05)
|> yLine(endAbsolute = segEndY(seg01) + templateThickness, tag = $seg10)
|> xLine(endAbsolute = ZERO, tag = $seg04)
|> xLine(length = -segLen(seg04))
|> yLine(length = -segLen(seg10))
|> xLine(length = -segLen(seg05))
|> yLine(length = -segLen(seg08))
|> xLine(length = segLen(seg06))
|> yLine(length = -segLen(seg02))
|> xLine(length = segLen(seg07))
|> yLine(length = segLen(seg03))
|> arc({
angleEnd = 90,
angleStart = 180,

View File

@ -19,21 +19,21 @@ length002 = depth + minClampingDistance
// Create the first sketch
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(ZERO, %, $seg02)
|> yLine(endAbsolute = -templateGap * 2 - (templateDiameter / 2), tag = $seg05)
|> xLine(endAbsolute = slateWidthHalf + templateThickness, tag = $seg04)
|> yLine(length = -length002, tag = $seg03)
|> xLine(endAbsolute = ZERO, tag = $seg02)
// |> line(end = [7.78, 11.16])
|> xLine(-segLen(seg02), %)
|> yLine(segLen(seg03), %)
|> xLine(segLen(seg04), %)
|> yLine(segLen(seg05), %)
|> xLine(length = -segLen(seg02))
|> yLine(length = segLen(seg03))
|> xLine(length = segLen(seg04))
|> yLine(length = segLen(seg05))
|> arc({
angleEnd = 90,
angleStart = 180,
@ -51,7 +51,7 @@ sketch002 = startSketchOn(extrude001, 'START')
-slateWidthHalf,
-templateGap * 2 - (templateDiameter / 2)
], %)
|> xLine(-7, %, $rectangleSegmentA001)
|> xLine(length = -7, tag = $rectangleSegmentA001)
|> angledLine([
segAng(rectangleSegmentA001) + 90,
minClampingDistance
@ -72,7 +72,7 @@ sketch003 = startSketchOn(extrude001, 'START')
slateWidthHalf,
-templateGap * 2 - (templateDiameter / 2)
], %)
|> xLine(7, %, $rectangleSegmentA002)
|> xLine(length = 7, tag = $rectangleSegmentA002)
|> angledLine([
segAng(rectangleSegmentA002) - 90,
minClampingDistance

View File

@ -32,7 +32,7 @@ fn capScrew(start, length, dia, capHeadLength) {
// Define the sketch of the hex pattern on the screw head
hexPatternSketch = startSketchOn(screwHead, 'end')
|> startProfileAt([hexWallToWall / 2, 0], %)
|> yLine(-hexWallLength / 2, %)
|> yLine(length = -hexWallLength / 2)
|> angledLine({
angle = hexStartingAngle,
length = hexWallLength

View File

@ -40,9 +40,9 @@ sketch002 = startSketchOn(loftPlane)
origin[0] + (antennaBaseWidth - antennaTopWidth) / 2,
origin[1] - ((antennaBaseHeight - antennaTopHeight) / 2)
], %)
|> xLine(antennaTopWidth, %)
|> yLine(-antennaTopHeight, %)
|> xLine(-antennaTopWidth, %)
|> xLine(length = antennaTopWidth)
|> yLine(length = -antennaTopHeight)
|> xLine(length = -antennaTopWidth)
|> close()
// Create the antenna using a loft

View File

@ -10,9 +10,9 @@ import height, width, thickness, chamferLength, offset, screenWidth, screenHeigh
bodySketch = startSketchOn('XZ')
|> startProfileAt([-width / 2, height / 2], %)
|> xLine(width, %, $chamfer1)
|> yLine(-height, %, $chamfer2)
|> xLine(-width, %, $chamfer3)
|> xLine(length = width, tag = $chamfer1)
|> yLine(length = -height, tag = $chamfer2)
|> xLine(length = -width, tag = $chamfer3)
|> close(tag = $chamfer4)
bodyExtrude = extrude(bodySketch, length = thickness)
|> chamfer(
@ -59,9 +59,9 @@ extrude002 = extrude(sketch002, length = -0.0625)
// Create the pocket for the screen
sketch003 = startSketchOn(extrude002, 'start')
|> startProfileAt([-screenWidth / 2, screenYPosition], %)
|> xLine(screenWidth, %, $seg01)
|> yLine(-screenHeight, %)
|> xLine(-segLen(seg01), %)
|> xLine(length = screenWidth, tag = $seg01)
|> yLine(length = -screenHeight)
|> xLine(length = -segLen(seg01))
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
extrude003 = extrude(sketch003, length = screenDepth)
@ -69,9 +69,9 @@ extrude003 = extrude(sketch003, length = screenDepth)
// Create the speaker box
sketch004 = startSketchOn(extrude002, 'start')
|> startProfileAt([-1.25 / 2, -.125], %)
|> xLine(speakerBoxWidth, %)
|> yLine(-speakerBoxHeight, %)
|> xLine(-speakerBoxWidth, %)
|> xLine(length = speakerBoxWidth)
|> yLine(length = -speakerBoxHeight)
|> xLine(length = -speakerBoxWidth)
|> close()
extrude(sketch004, length = -.5)
|> appearance(

View File

@ -14,9 +14,9 @@ plane = offsetPlane("XZ", offset = 1)
fn screenHole(sketchStart) {
sketch006 = startSketchOn(sketchStart)
|> startProfileAt([-screenWidth / 2, screenYPosition], %)
|> xLine(screenWidth, %)
|> yLine(-screenHeight, %)
|> xLine(-screenWidth, %)
|> xLine(length = screenWidth)
|> yLine(length = -screenHeight)
|> xLine(length = -screenWidth)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
return sketch006

View File

@ -25,14 +25,14 @@ knobPlane = {
// Create the knob sketch and revolve
startSketchOn(knobPlane)
|> startProfileAt([0.0001, 0], %)
|> xLine(knobDiameter / 2, %)
|> yLine(knobHeight - 0.05, %)
|> xLine(length = knobDiameter / 2)
|> yLine(length = knobHeight - 0.05)
|> arc({
angleStart = 0,
angleEnd = 90,
radius = .05
}, %)
|> xLineTo(0.0001, %)
|> xLine(endAbsolute = 0.0001)
|> close()
|> revolve({ axis = "Y" }, %)
|> appearance(color = '#D0FF01', metalness = 90, roughness = 50)

View File

@ -27,9 +27,9 @@ talkButtonSketch = startSketchOn(talkButtonPlane)
-talkButtonSideLength / 2,
talkButtonSideLength / 2
], %)
|> xLine(talkButtonSideLength, %, $tag1)
|> yLine(-talkButtonSideLength, %, $tag2)
|> xLine(-talkButtonSideLength, %, $tag3)
|> xLine(length = talkButtonSideLength, tag = $tag1)
|> yLine(length = -talkButtonSideLength, tag = $tag2)
|> xLine(length = -talkButtonSideLength, tag = $tag3)
|> close(tag = $tag4)
// Create the talk button and apply fillets

View File

@ -7,29 +7,29 @@ export fn zLogo(surface, origin, scale) {
0 + origin[0],
0.15 * scale + origin[1]
], %)
|> yLine(-0.15 * scale, %)
|> xLine(0.15 * scale, %)
|> yLine(length = -0.15 * scale)
|> xLine(length = 0.15 * scale)
|> angledLineToX({
angle = 47.15,
to = 0.3 * scale + origin[0]
}, %, $seg1)
|> yLineTo(0 + origin[1], %, $seg3)
|> xLine(0.63 * scale, %)
|> yLine(0.225 * scale, %)
|> xLine(-0.57 * scale, %)
|> yLine(endAbsolute = 0 + origin[1], tag = $seg3)
|> xLine(length = 0.63 * scale)
|> yLine(length = 0.225 * scale)
|> xLine(length = -0.57 * scale)
|> angledLineToX({
angle = 47.15,
to = 0.93 * scale + origin[0]
}, %)
|> yLine(0.15 * scale, %)
|> xLine(-0.15 * scale, %)
|> yLine(length = 0.15 * scale)
|> xLine(length = -0.15 * scale)
|> angledLine({
angle = 47.15,
length = -segLen(seg1)
}, %, $seg2)
|> yLine(segLen(seg3), %)
|> xLineTo(0 + origin[0], %)
|> yLine(-0.225 * scale, %)
|> yLine(length = segLen(seg3))
|> xLine(endAbsolute = 0 + origin[0])
|> yLine(length = -0.225 * scale)
|> angledLineThatIntersects({
angle = 0,
intersectTag = seg2,

View File

@ -11,39 +11,39 @@ let brace_base = startSketchOn(XY)
|> startProfileAt([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 = startSketchOn(XY)
|> startProfileAt([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)
|> xLine(endAbsolute = slateWidthHalf + templateThickness, tag = $seg04)
|> yLine(length = -length002, tag = $seg03)
|> xLine(endAbsolute = 0, tag = $seg02)
|> xLine(length = -segLen(seg02, %))
|> yLine(length = segLen(seg03, %))
|> xLine(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()

View File

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

View File

@ -1545,9 +1545,9 @@ baseExtrusion = extrude(sketch001, length = width)
async fn kcl_test_shell_with_tag() {
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)
@ -2009,9 +2009,9 @@ someFunction('INVALID')
async fn kcl_test_error_no_auth_websocket() {
let code = r#"const 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

@ -1090,8 +1090,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
"#;
@ -1878,9 +1878,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)
@ -1903,9 +1903,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)
@ -1929,9 +1929,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

@ -3469,11 +3469,11 @@ const cylinder = startSketchOn('-XZ')
fn test_ast_in_comment_inline() {
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();
assert!(program.in_comment(86));
assert!(program.in_comment(92));
}
#[tokio::test(flavor = "multi_thread")]

View File

@ -4219,7 +4219,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

@ -73,9 +73,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,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

@ -260,113 +260,14 @@ 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),
})
@ -378,34 +279,49 @@ pub async fn x_line(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
/// ```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)
/// ```
#[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 +330,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 +347,44 @@ 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)
/// ```
#[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 +423,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)
@ -1069,9 +1003,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

@ -965,9 +965,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, %)
}
@ -985,11 +985,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)

View File

@ -1,6 +1,5 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed argument_error.kcl
snapshot_kind: text
---
[]

View File

@ -1,6 +1,5 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed array_elem_push.kcl
snapshot_kind: text
---
[]

View File

@ -1,6 +1,5 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed array_elem_push_fail.kcl
snapshot_kind: text
---
[]

View File

@ -1,6 +1,5 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed array_index_oob.kcl
snapshot_kind: text
---
[]

View File

@ -1,6 +1,5 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed array_range_expr.kcl
snapshot_kind: text
---
[]

View File

@ -1,6 +1,5 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed array_range_negative_expr.kcl
snapshot_kind: text
---
[]

View File

@ -1,7 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed artifact_graph_example_code1.kcl
snapshot_kind: text
---
[
{

View File

@ -1,7 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed basic_fillet_cube_close_opposite.kcl
snapshot_kind: text
---
[
{

View File

@ -1,7 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed basic_fillet_cube_end.kcl
snapshot_kind: text
---
[
{

View File

@ -1,7 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed basic_fillet_cube_previous_adjacent.kcl
snapshot_kind: text
---
[
{

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