offsetPlane kwargs (#5367)
Previously: `offsetPlane('XY', 75)` Now: `offsetPlane('XY', offset = 75)` Pairs with this KCL-samples PR: https://github.com/KittyCAD/kcl-samples/pull/163
This commit is contained in:
@ -40,7 +40,7 @@ squareSketch = startSketchOn('XY')
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
|
||||
triangleSketch = startSketchOn(offsetPlane('XY', 75))
|
||||
triangleSketch = startSketchOn(offsetPlane('XY', offset = 75))
|
||||
|> startProfileAt([0, 125], %)
|
||||
|> line(end = [-15, -30])
|
||||
|> line(end = [30, 0])
|
||||
@ -62,10 +62,10 @@ squareSketch = startSketchOn('XY')
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
|
||||
circleSketch0 = startSketchOn(offsetPlane('XY', 75))
|
||||
circleSketch0 = startSketchOn(offsetPlane('XY', offset = 75))
|
||||
|> circle({ center = [0, 100], radius = 50 }, %)
|
||||
|
||||
circleSketch1 = startSketchOn(offsetPlane('XY', 150))
|
||||
circleSketch1 = startSketchOn(offsetPlane('XY', offset = 150))
|
||||
|> circle({ center = [0, 100], radius = 20 }, %)
|
||||
|
||||
loft([
|
||||
@ -87,10 +87,10 @@ squareSketch = startSketchOn('XY')
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
|
||||
circleSketch0 = startSketchOn(offsetPlane('XY', 75))
|
||||
circleSketch0 = startSketchOn(offsetPlane('XY', offset = 75))
|
||||
|> circle({ center = [0, 100], radius = 50 }, %)
|
||||
|
||||
circleSketch1 = startSketchOn(offsetPlane('XY', 150))
|
||||
circleSketch1 = startSketchOn(offsetPlane('XY', offset = 150))
|
||||
|> circle({ center = [0, 100], radius = 20 }, %)
|
||||
|
||||
loft(
|
||||
|
@ -17,8 +17,8 @@ offsetPlane(std_plane: StandardPlane, offset: number) -> Plane
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `std_plane` | [`StandardPlane`](/docs/kcl/types/StandardPlane) | One of the standard planes. | Yes |
|
||||
| `offset` | `number` | | Yes |
|
||||
| `std_plane` | [`StandardPlane`](/docs/kcl/types/StandardPlane) | Which standard plane (e.g. XY) should this new plane be created from? | Yes |
|
||||
| `offset` | `number` | Distance from the standard plane this new plane will be created at. | Yes |
|
||||
|
||||
### Returns
|
||||
|
||||
@ -37,7 +37,7 @@ squareSketch = startSketchOn('XY')
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
|
||||
circleSketch = startSketchOn(offsetPlane('XY', 150))
|
||||
circleSketch = startSketchOn(offsetPlane('XY', offset = 150))
|
||||
|> circle({ center = [0, 100], radius = 50 }, %)
|
||||
|
||||
loft([squareSketch, circleSketch])
|
||||
@ -55,7 +55,7 @@ squareSketch = startSketchOn('XZ')
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
|
||||
circleSketch = startSketchOn(offsetPlane('XZ', 150))
|
||||
circleSketch = startSketchOn(offsetPlane('XZ', offset = 150))
|
||||
|> circle({ center = [0, 100], radius = 50 }, %)
|
||||
|
||||
loft([squareSketch, circleSketch])
|
||||
@ -73,7 +73,7 @@ squareSketch = startSketchOn('YZ')
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
|
||||
circleSketch = startSketchOn(offsetPlane('YZ', 150))
|
||||
circleSketch = startSketchOn(offsetPlane('YZ', offset = 150))
|
||||
|> circle({ center = [0, 100], radius = 50 }, %)
|
||||
|
||||
loft([squareSketch, circleSketch])
|
||||
@ -91,7 +91,7 @@ squareSketch = startSketchOn('-XZ')
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
|
||||
circleSketch = startSketchOn(offsetPlane('-XZ', -150))
|
||||
circleSketch = startSketchOn(offsetPlane('-XZ', offset = -150))
|
||||
|> circle({ center = [0, 100], radius = 50 }, %)
|
||||
|
||||
loft([squareSketch, circleSketch])
|
||||
@ -106,7 +106,7 @@ startSketchOn("XY")
|
||||
|> circle({ radius = 10, center = [0, 0] }, %)
|
||||
|
||||
// Triangle on the plane 4 units above
|
||||
startSketchOn(offsetPlane("XY", 4))
|
||||
startSketchOn(offsetPlane("XY", offset = 4))
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> line(end = [10, 0])
|
||||
|> line(end = [0, 10])
|
||||
|
@ -122973,9 +122973,9 @@
|
||||
"unpublished": false,
|
||||
"deprecated": false,
|
||||
"examples": [
|
||||
"// Loft a square and a triangle.\nsquareSketch = startSketchOn('XY')\n |> startProfileAt([-100, 200], %)\n |> line(end = [200, 0])\n |> line(end = [0, -200])\n |> line(end = [-200, 0])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ntriangleSketch = startSketchOn(offsetPlane('XY', 75))\n |> startProfileAt([0, 125], %)\n |> line(end = [-15, -30])\n |> line(end = [30, 0])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\nloft([squareSketch, triangleSketch])",
|
||||
"// Loft a square, a circle, and another circle.\nsquareSketch = startSketchOn('XY')\n |> startProfileAt([-100, 200], %)\n |> line(end = [200, 0])\n |> line(end = [0, -200])\n |> line(end = [-200, 0])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ncircleSketch0 = startSketchOn(offsetPlane('XY', 75))\n |> circle({ center = [0, 100], radius = 50 }, %)\n\ncircleSketch1 = startSketchOn(offsetPlane('XY', 150))\n |> circle({ center = [0, 100], radius = 20 }, %)\n\nloft([\n squareSketch,\n circleSketch0,\n circleSketch1\n])",
|
||||
"// Loft a square, a circle, and another circle with options.\nsquareSketch = startSketchOn('XY')\n |> startProfileAt([-100, 200], %)\n |> line(end = [200, 0])\n |> line(end = [0, -200])\n |> line(end = [-200, 0])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ncircleSketch0 = startSketchOn(offsetPlane('XY', 75))\n |> circle({ center = [0, 100], radius = 50 }, %)\n\ncircleSketch1 = startSketchOn(offsetPlane('XY', 150))\n |> circle({ center = [0, 100], radius = 20 }, %)\n\nloft(\n [\n squareSketch,\n circleSketch0,\n circleSketch1\n],\n baseCurveIndex = 0,\n bezApproximateRational = false,\n tolerance = 0.000001,\n vDegree = 2,\n)"
|
||||
"// Loft a square and a triangle.\nsquareSketch = startSketchOn('XY')\n |> startProfileAt([-100, 200], %)\n |> line(end = [200, 0])\n |> line(end = [0, -200])\n |> line(end = [-200, 0])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ntriangleSketch = startSketchOn(offsetPlane('XY', offset = 75))\n |> startProfileAt([0, 125], %)\n |> line(end = [-15, -30])\n |> line(end = [30, 0])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\nloft([squareSketch, triangleSketch])",
|
||||
"// Loft a square, a circle, and another circle.\nsquareSketch = startSketchOn('XY')\n |> startProfileAt([-100, 200], %)\n |> line(end = [200, 0])\n |> line(end = [0, -200])\n |> line(end = [-200, 0])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ncircleSketch0 = startSketchOn(offsetPlane('XY', offset = 75))\n |> circle({ center = [0, 100], radius = 50 }, %)\n\ncircleSketch1 = startSketchOn(offsetPlane('XY', offset = 150))\n |> circle({ center = [0, 100], radius = 20 }, %)\n\nloft([\n squareSketch,\n circleSketch0,\n circleSketch1\n])",
|
||||
"// Loft a square, a circle, and another circle with options.\nsquareSketch = startSketchOn('XY')\n |> startProfileAt([-100, 200], %)\n |> line(end = [200, 0])\n |> line(end = [0, -200])\n |> line(end = [-200, 0])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ncircleSketch0 = startSketchOn(offsetPlane('XY', offset = 75))\n |> circle({ center = [0, 100], radius = 50 }, %)\n\ncircleSketch1 = startSketchOn(offsetPlane('XY', offset = 150))\n |> circle({ center = [0, 100], radius = 20 }, %)\n\nloft(\n [\n squareSketch,\n circleSketch0,\n circleSketch1\n],\n baseCurveIndex = 0,\n bezApproximateRational = false,\n tolerance = 0.000001,\n vDegree = 2,\n)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -134124,7 +134124,7 @@
|
||||
"summary": "Offset a plane by a distance along its normal.",
|
||||
"description": "For example, if you offset the 'XZ' plane by 10, the new plane will be parallel to the 'XZ' plane and 10 units away from it.",
|
||||
"tags": [],
|
||||
"keywordArguments": false,
|
||||
"keywordArguments": true,
|
||||
"args": [
|
||||
{
|
||||
"name": "std_plane",
|
||||
@ -134180,7 +134180,8 @@
|
||||
},
|
||||
"required": true,
|
||||
"includeInSnippet": true,
|
||||
"labelRequired": true
|
||||
"description": "Which standard plane (e.g. XY) should this new plane be created from?",
|
||||
"labelRequired": false
|
||||
},
|
||||
{
|
||||
"name": "offset",
|
||||
@ -134193,6 +134194,7 @@
|
||||
},
|
||||
"required": true,
|
||||
"includeInSnippet": true,
|
||||
"description": "Distance from the standard plane this new plane will be created at.",
|
||||
"labelRequired": true
|
||||
}
|
||||
],
|
||||
@ -134446,11 +134448,11 @@
|
||||
"unpublished": false,
|
||||
"deprecated": false,
|
||||
"examples": [
|
||||
"// Loft a square and a circle on the `XY` plane using offset.\nsquareSketch = startSketchOn('XY')\n |> startProfileAt([-100, 200], %)\n |> line(end = [200, 0])\n |> line(end = [0, -200])\n |> line(end = [-200, 0])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ncircleSketch = startSketchOn(offsetPlane('XY', 150))\n |> circle({ center = [0, 100], radius = 50 }, %)\n\nloft([squareSketch, circleSketch])",
|
||||
"// Loft a square and a circle on the `XZ` plane using offset.\nsquareSketch = startSketchOn('XZ')\n |> startProfileAt([-100, 200], %)\n |> line(end = [200, 0])\n |> line(end = [0, -200])\n |> line(end = [-200, 0])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ncircleSketch = startSketchOn(offsetPlane('XZ', 150))\n |> circle({ center = [0, 100], radius = 50 }, %)\n\nloft([squareSketch, circleSketch])",
|
||||
"// Loft a square and a circle on the `YZ` plane using offset.\nsquareSketch = startSketchOn('YZ')\n |> startProfileAt([-100, 200], %)\n |> line(end = [200, 0])\n |> line(end = [0, -200])\n |> line(end = [-200, 0])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ncircleSketch = startSketchOn(offsetPlane('YZ', 150))\n |> circle({ center = [0, 100], radius = 50 }, %)\n\nloft([squareSketch, circleSketch])",
|
||||
"// Loft a square and a circle on the `-XZ` plane using offset.\nsquareSketch = startSketchOn('-XZ')\n |> startProfileAt([-100, 200], %)\n |> line(end = [200, 0])\n |> line(end = [0, -200])\n |> line(end = [-200, 0])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ncircleSketch = startSketchOn(offsetPlane('-XZ', -150))\n |> circle({ center = [0, 100], radius = 50 }, %)\n\nloft([squareSketch, circleSketch])",
|
||||
"// A circle on the XY plane\nstartSketchOn(\"XY\")\n |> startProfileAt([0, 0], %)\n |> circle({ radius = 10, center = [0, 0] }, %)\n\n// Triangle on the plane 4 units above\nstartSketchOn(offsetPlane(\"XY\", 4))\n |> startProfileAt([0, 0], %)\n |> line(end = [10, 0])\n |> line(end = [0, 10])\n |> close()"
|
||||
"// Loft a square and a circle on the `XY` plane using offset.\nsquareSketch = startSketchOn('XY')\n |> startProfileAt([-100, 200], %)\n |> line(end = [200, 0])\n |> line(end = [0, -200])\n |> line(end = [-200, 0])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ncircleSketch = startSketchOn(offsetPlane('XY', offset = 150))\n |> circle({ center = [0, 100], radius = 50 }, %)\n\nloft([squareSketch, circleSketch])",
|
||||
"// Loft a square and a circle on the `XZ` plane using offset.\nsquareSketch = startSketchOn('XZ')\n |> startProfileAt([-100, 200], %)\n |> line(end = [200, 0])\n |> line(end = [0, -200])\n |> line(end = [-200, 0])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ncircleSketch = startSketchOn(offsetPlane('XZ', offset = 150))\n |> circle({ center = [0, 100], radius = 50 }, %)\n\nloft([squareSketch, circleSketch])",
|
||||
"// Loft a square and a circle on the `YZ` plane using offset.\nsquareSketch = startSketchOn('YZ')\n |> startProfileAt([-100, 200], %)\n |> line(end = [200, 0])\n |> line(end = [0, -200])\n |> line(end = [-200, 0])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ncircleSketch = startSketchOn(offsetPlane('YZ', offset = 150))\n |> circle({ center = [0, 100], radius = 50 }, %)\n\nloft([squareSketch, circleSketch])",
|
||||
"// Loft a square and a circle on the `-XZ` plane using offset.\nsquareSketch = startSketchOn('-XZ')\n |> startProfileAt([-100, 200], %)\n |> line(end = [200, 0])\n |> line(end = [0, -200])\n |> line(end = [-200, 0])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ncircleSketch = startSketchOn(offsetPlane('-XZ', offset = -150))\n |> circle({ center = [0, 100], radius = 50 }, %)\n\nloft([squareSketch, circleSketch])",
|
||||
"// A circle on the XY plane\nstartSketchOn(\"XY\")\n |> startProfileAt([0, 0], %)\n |> circle({ radius = 10, center = [0, 0] }, %)\n\n// Triangle on the plane 4 units above\nstartSketchOn(offsetPlane(\"XY\", offset = 4))\n |> startProfileAt([0, 0], %)\n |> line(end = [10, 0])\n |> line(end = [0, 10])\n |> close()"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -24,7 +24,7 @@ sketch001 = startSketchOn('XZ')
|
||||
revolve001 = revolve({ axis = "X" }, sketch001)
|
||||
triangle()
|
||||
|> extrude(length = 30)
|
||||
plane001 = offsetPlane('XY', 10)
|
||||
plane001 = offsetPlane('XY', offset = 10)
|
||||
sketch002 = startSketchOn(plane001)
|
||||
|> startProfileAt([-20, 0], %)
|
||||
|> line(end = [5, -15])
|
||||
@ -54,7 +54,7 @@ sketch002 = startSketchOn(extrude001, rectangleSegmentB001)
|
||||
center = [-1, 2],
|
||||
radius = .5
|
||||
}, %)
|
||||
plane001 = offsetPlane('XZ', -5)
|
||||
plane001 = offsetPlane('XZ', offset = -5)
|
||||
sketch003 = startSketchOn(plane001)
|
||||
|> circle({ center = [0, 0], radius = 5 }, %)
|
||||
`
|
||||
@ -116,7 +116,7 @@ test.describe('Feature Tree pane', () => {
|
||||
await testViewSource({
|
||||
operationName: 'Offset Plane',
|
||||
operationIndex: 0,
|
||||
expectedActiveLine: "plane001 = offsetPlane('XY', 10)",
|
||||
expectedActiveLine: "plane001 = offsetPlane('XY', offset = 10)",
|
||||
})
|
||||
await testViewSource({
|
||||
operationName: 'Extrude',
|
||||
@ -342,7 +342,8 @@ test.describe('Feature Tree pane', () => {
|
||||
toolbar,
|
||||
cmdBar,
|
||||
}) => {
|
||||
const testCode = (value: string) => `p = offsetPlane('XY', ${value})`
|
||||
const testCode = (value: string) =>
|
||||
`p = offsetPlane('XY', offset = ${value})`
|
||||
const initialInput = '10'
|
||||
const initialCode = testCode(initialInput)
|
||||
const newInput = '5 + 10'
|
||||
|
@ -1052,7 +1052,7 @@ openSketch = startSketchOn('XY')
|
||||
// One dumb hardcoded screen pixel value
|
||||
const testPoint = { x: 700, y: 150 }
|
||||
const [clickOnXzPlane] = scene.makeMouseHelpers(testPoint.x, testPoint.y)
|
||||
const expectedOutput = `plane001 = offsetPlane('XZ', 5)`
|
||||
const expectedOutput = `plane001 = offsetPlane('XZ', offset = 5)`
|
||||
|
||||
await homePage.goToModelingScene()
|
||||
// FIXME: Since there is no KCL code loaded. We need to wait for the scene to load before we continue.
|
||||
@ -1188,7 +1188,7 @@ openSketch = startSketchOn('XY')
|
||||
}) => {
|
||||
const initialCode = `sketch001 = startSketchOn('XZ')
|
||||
|> circle({ center = [0, 0], radius = 30 }, %)
|
||||
plane001 = offsetPlane('XZ', 50)
|
||||
plane001 = offsetPlane('XZ', offset = 50)
|
||||
sketch002 = startSketchOn(plane001)
|
||||
|> circle({ center = [0, 0], radius = 20 }, %)
|
||||
`
|
||||
@ -1274,7 +1274,7 @@ openSketch = startSketchOn('XY')
|
||||
}) => {
|
||||
const initialCode = `sketch001 = startSketchOn('XZ')
|
||||
|> circle({ center = [0, 0], radius = 30 }, %)
|
||||
plane001 = offsetPlane('XZ', 50)
|
||||
plane001 = offsetPlane('XZ', offset = 50)
|
||||
sketch002 = startSketchOn(plane001)
|
||||
|> circle({ center = [0, 0], radius = 20 }, %)
|
||||
loft001 = loft([sketch001, sketch002])
|
||||
@ -1321,7 +1321,7 @@ loft001 = loft([sketch001, sketch002])
|
||||
await page.waitForTimeout(1000)
|
||||
await clickOnSketch2()
|
||||
await expect(page.locator('.cm-activeLine')).toHaveText(`
|
||||
plane001 = offsetPlane('XZ', 50)
|
||||
plane001 = offsetPlane('XZ', offset = 50)
|
||||
`)
|
||||
await page.keyboard.press('Backspace')
|
||||
// Check for sketch 1
|
||||
|
@ -1304,7 +1304,7 @@ test.describe(`Sketching with offset planes`, () => {
|
||||
await context.addInitScript(() => {
|
||||
localStorage.setItem(
|
||||
'persistCode',
|
||||
`offsetPlane001 = offsetPlane("XY", 10)`
|
||||
`offsetPlane001 = offsetPlane("XY", offset = 10)`
|
||||
)
|
||||
})
|
||||
|
||||
@ -1318,9 +1318,9 @@ test.describe(`Sketching with offset planes`, () => {
|
||||
await test.step(`Hovering should highlight code`, async () => {
|
||||
await planeHover()
|
||||
await editor.expectState({
|
||||
activeLines: [`offsetPlane001=offsetPlane("XY",10)`],
|
||||
activeLines: [`offsetPlane001=offsetPlane("XY",offset=10)`],
|
||||
diagnostics: [],
|
||||
highlightedCode: 'offsetPlane("XY", 10)',
|
||||
highlightedCode: 'offsetPlane("XY", offset = 10)',
|
||||
})
|
||||
})
|
||||
|
||||
@ -1331,7 +1331,7 @@ test.describe(`Sketching with offset planes`, () => {
|
||||
await expect(toolbar.lineBtn).toBeEnabled()
|
||||
await editor.expectEditor.toContain('startSketchOn(offsetPlane001)')
|
||||
await editor.expectState({
|
||||
activeLines: [`offsetPlane001=offsetPlane("XY",10)`],
|
||||
activeLines: [`offsetPlane001=offsetPlane("XY",offset=10)`],
|
||||
diagnostics: [],
|
||||
highlightedCode: '',
|
||||
})
|
||||
|
@ -85,7 +85,7 @@
|
||||
"fmt": "prettier --write ./src *.ts *.json *.js ./e2e ./packages",
|
||||
"fmt-check": "prettier --check ./src *.ts *.json *.js ./e2e ./packages",
|
||||
"fetch:wasm": "./get-latest-wasm-bundle.sh",
|
||||
"fetch:samples": "echo \"Fetching latest KCL samples...\" && curl -o public/kcl-samples-manifest-fallback.json https://raw.githubusercontent.com/KittyCAD/kcl-samples/achalmers/kw-pattern-transform2/manifest.json",
|
||||
"fetch:samples": "echo \"Fetching latest KCL samples...\" && curl -o public/kcl-samples-manifest-fallback.json https://raw.githubusercontent.com/KittyCAD/kcl-samples/achalmers/offset-plane-kwargs/manifest.json",
|
||||
"isomorphic-copy-wasm": "(copy src/wasm-lib/pkg/wasm_lib_bg.wasm public || cp src/wasm-lib/pkg/wasm_lib_bg.wasm public)",
|
||||
"build:wasm-dev": "yarn wasm-prep && (cd src/wasm-lib && wasm-pack build --dev --target web --out-dir pkg && cargo test -p kcl-lib export_bindings) && yarn isomorphic-copy-wasm && yarn fmt",
|
||||
"build:wasm": "yarn wasm-prep && cd src/wasm-lib && wasm-pack build --release --target web --out-dir pkg && cargo test -p kcl-lib export_bindings && cd ../.. && yarn isomorphic-copy-wasm && yarn fmt",
|
||||
|
@ -32,7 +32,7 @@ child_process.spawnSync('git', [
|
||||
'clone',
|
||||
'--single-branch',
|
||||
'--branch',
|
||||
'achalmers/kw-pattern-transform2',
|
||||
'achalmers/offset-plane-kwargs',
|
||||
URL_GIT_KCL_SAMPLES,
|
||||
DIR_KCL_SAMPLES,
|
||||
])
|
||||
|
@ -33,6 +33,7 @@ import {
|
||||
traverse,
|
||||
ARG_INDEX_FIELD,
|
||||
LABELED_ARG_FIELD,
|
||||
UNLABELED_ARG,
|
||||
} from './queryAst'
|
||||
import {
|
||||
addTagForSketchOnFace,
|
||||
@ -656,10 +657,11 @@ export function addOffsetPlane({
|
||||
|
||||
const newPlane = createVariableDeclaration(
|
||||
newPlaneName,
|
||||
createCallExpressionStdLib('offsetPlane', [
|
||||
createCallExpressionStdLibKw(
|
||||
'offsetPlane',
|
||||
createLiteral(defaultPlane.toUpperCase()),
|
||||
offset,
|
||||
])
|
||||
[createLabeledArg('offset', offset)]
|
||||
)
|
||||
)
|
||||
|
||||
const insertAt =
|
||||
@ -677,8 +679,7 @@ export function addOffsetPlane({
|
||||
[insertAt, 'index'],
|
||||
['declaration', 'VariableDeclaration'],
|
||||
['init', 'VariableDeclarator'],
|
||||
['arguments', 'CallExpression'],
|
||||
[0, 'index'],
|
||||
['unlabeled', UNLABELED_ARG],
|
||||
]
|
||||
return {
|
||||
modifiedAst,
|
||||
|
@ -582,7 +582,7 @@ sketch002 = startSketchOn(extrude001, $seg01)
|
||||
it('finds sketch001 and sketch002 pipes to be lofted', async () => {
|
||||
const exampleCode = `sketch001 = startSketchOn('XZ')
|
||||
|> circle({ center = [0, 0], radius = 1 }, %)
|
||||
plane001 = offsetPlane('XZ', 2)
|
||||
plane001 = offsetPlane('XZ', offset = 2)
|
||||
sketch002 = startSketchOn(plane001)
|
||||
|> circle({ center = [0, 0], radius = 3 }, %)
|
||||
`
|
||||
|
@ -44,6 +44,7 @@ import { codeRefFromRange } from './std/artifactGraph'
|
||||
import { KclSettingsAnnotation } from 'lib/settings/settingsTypes'
|
||||
|
||||
export const LABELED_ARG_FIELD = 'LabeledArg -> Arg'
|
||||
export const UNLABELED_ARG = 'unlabeled first arg'
|
||||
export const ARG_INDEX_FIELD = 'arg index'
|
||||
|
||||
/**
|
||||
|
@ -126,8 +126,7 @@ const prepareToEditOffsetPlane: PrepareToEditCallback = async ({
|
||||
if (
|
||||
operation.type !== 'StdLibCall' ||
|
||||
!operation.labeledArgs ||
|
||||
!('std_plane' in operation.labeledArgs) ||
|
||||
!operation.labeledArgs.std_plane ||
|
||||
!operation.unlabeledArg ||
|
||||
!('offset' in operation.labeledArgs) ||
|
||||
!operation.labeledArgs.offset
|
||||
) {
|
||||
@ -135,11 +134,9 @@ const prepareToEditOffsetPlane: PrepareToEditCallback = async ({
|
||||
}
|
||||
// TODO: Implement conversion to arbitrary plane selection
|
||||
// once the Offset Plane command supports it.
|
||||
const stdPlane = operation.unlabeledArg
|
||||
const planeName = codeManager.code
|
||||
.slice(
|
||||
operation.labeledArgs.std_plane.sourceRange[0],
|
||||
operation.labeledArgs.std_plane.sourceRange[1]
|
||||
)
|
||||
.slice(stdPlane.sourceRange[0], stdPlane.sourceRange[1])
|
||||
.replaceAll(`'`, ``)
|
||||
|
||||
if (!isDefaultPlaneStr(planeName)) {
|
||||
|
@ -456,13 +456,6 @@ impl Args {
|
||||
FromArgs::from_args(self, 0)
|
||||
}
|
||||
|
||||
pub(crate) fn get_data_and_float<'a, T>(&'a self) -> Result<(T, f64), KclError>
|
||||
where
|
||||
T: serde::de::DeserializeOwned + FromKclValue<'a> + Sized,
|
||||
{
|
||||
FromArgs::from_args(self, 0)
|
||||
}
|
||||
|
||||
pub(crate) async fn get_adjacent_face_to_tag(
|
||||
&self,
|
||||
exec_state: &mut ExecState,
|
||||
|
@ -57,7 +57,7 @@ pub async fn loft(exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
|
||||
/// |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
/// |> close()
|
||||
///
|
||||
/// triangleSketch = startSketchOn(offsetPlane('XY', 75))
|
||||
/// triangleSketch = startSketchOn(offsetPlane('XY', offset = 75))
|
||||
/// |> startProfileAt([0, 125], %)
|
||||
/// |> line(end = [-15, -30])
|
||||
/// |> line(end = [30, 0])
|
||||
@ -77,10 +77,10 @@ pub async fn loft(exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
|
||||
/// |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
/// |> close()
|
||||
///
|
||||
/// circleSketch0 = startSketchOn(offsetPlane('XY', 75))
|
||||
/// circleSketch0 = startSketchOn(offsetPlane('XY', offset = 75))
|
||||
/// |> circle({ center = [0, 100], radius = 50 }, %)
|
||||
///
|
||||
/// circleSketch1 = startSketchOn(offsetPlane('XY', 150))
|
||||
/// circleSketch1 = startSketchOn(offsetPlane('XY', offset = 150))
|
||||
/// |> circle({ center = [0, 100], radius = 20 }, %)
|
||||
///
|
||||
/// loft([squareSketch, circleSketch0, circleSketch1])
|
||||
@ -96,10 +96,10 @@ pub async fn loft(exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
|
||||
/// |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
/// |> close()
|
||||
///
|
||||
/// circleSketch0 = startSketchOn(offsetPlane('XY', 75))
|
||||
/// circleSketch0 = startSketchOn(offsetPlane('XY', offset = 75))
|
||||
/// |> circle({ center = [0, 100], radius = 50 }, %)
|
||||
///
|
||||
/// circleSketch1 = startSketchOn(offsetPlane('XY', 150))
|
||||
/// circleSketch1 = startSketchOn(offsetPlane('XY', offset = 150))
|
||||
/// |> circle({ center = [0, 100], radius = 20 }, %)
|
||||
///
|
||||
/// loft([squareSketch, circleSketch0, circleSketch1],
|
||||
|
@ -52,7 +52,9 @@ impl From<StandardPlane> for PlaneData {
|
||||
|
||||
/// Offset a plane by a distance along its normal.
|
||||
pub async fn offset_plane(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||
let (std_plane, offset): (StandardPlane, f64) = args.get_data_and_float()?;
|
||||
// let (std_plane, offset): (StandardPlane, f64) = args.get_data_and_float()?;
|
||||
let std_plane = args.get_unlabeled_kw_arg("stdPlane")?;
|
||||
let offset = args.get_kw_arg("offset")?;
|
||||
let plane = inner_offset_plane(std_plane, offset, exec_state).await?;
|
||||
make_offset_plane_in_engine(&plane, exec_state, &args).await?;
|
||||
Ok(KclValue::Plane { value: Box::new(plane) })
|
||||
@ -73,7 +75,7 @@ pub async fn offset_plane(exec_state: &mut ExecState, args: Args) -> Result<KclV
|
||||
/// |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
/// |> close()
|
||||
///
|
||||
/// circleSketch = startSketchOn(offsetPlane('XY', 150))
|
||||
/// circleSketch = startSketchOn(offsetPlane('XY', offset = 150))
|
||||
/// |> circle({ center = [0, 100], radius = 50 }, %)
|
||||
///
|
||||
/// loft([squareSketch, circleSketch])
|
||||
@ -89,7 +91,7 @@ pub async fn offset_plane(exec_state: &mut ExecState, args: Args) -> Result<KclV
|
||||
/// |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
/// |> close()
|
||||
///
|
||||
/// circleSketch = startSketchOn(offsetPlane('XZ', 150))
|
||||
/// circleSketch = startSketchOn(offsetPlane('XZ', offset = 150))
|
||||
/// |> circle({ center = [0, 100], radius = 50 }, %)
|
||||
///
|
||||
/// loft([squareSketch, circleSketch])
|
||||
@ -105,7 +107,7 @@ pub async fn offset_plane(exec_state: &mut ExecState, args: Args) -> Result<KclV
|
||||
/// |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
/// |> close()
|
||||
///
|
||||
/// circleSketch = startSketchOn(offsetPlane('YZ', 150))
|
||||
/// circleSketch = startSketchOn(offsetPlane('YZ', offset = 150))
|
||||
/// |> circle({ center = [0, 100], radius = 50 }, %)
|
||||
///
|
||||
/// loft([squareSketch, circleSketch])
|
||||
@ -121,7 +123,7 @@ pub async fn offset_plane(exec_state: &mut ExecState, args: Args) -> Result<KclV
|
||||
/// |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
/// |> close()
|
||||
///
|
||||
/// circleSketch = startSketchOn(offsetPlane('-XZ', -150))
|
||||
/// circleSketch = startSketchOn(offsetPlane('-XZ', offset = -150))
|
||||
/// |> circle({ center = [0, 100], radius = 50 }, %)
|
||||
///
|
||||
/// loft([squareSketch, circleSketch])
|
||||
@ -133,7 +135,7 @@ pub async fn offset_plane(exec_state: &mut ExecState, args: Args) -> Result<KclV
|
||||
/// |> circle({ radius = 10, center = [0, 0] }, %)
|
||||
///
|
||||
/// // Triangle on the plane 4 units above
|
||||
/// startSketchOn(offsetPlane("XY", 4))
|
||||
/// startSketchOn(offsetPlane("XY", offset = 4))
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> line(end = [10, 0])
|
||||
/// |> line(end = [0, 10])
|
||||
@ -143,6 +145,12 @@ pub async fn offset_plane(exec_state: &mut ExecState, args: Args) -> Result<KclV
|
||||
#[stdlib {
|
||||
name = "offsetPlane",
|
||||
feature_tree_operation = true,
|
||||
keywords = true,
|
||||
unlabeled_first = true,
|
||||
args = {
|
||||
std_plane = { docs = "Which standard plane (e.g. XY) should this new plane be created from?" },
|
||||
offset = { docs = "Distance from the standard plane this new plane will be created at." },
|
||||
}
|
||||
}]
|
||||
async fn inner_offset_plane(
|
||||
std_plane: StandardPlane,
|
||||
|
@ -286,7 +286,7 @@ snapshot_kind: text
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
17,
|
||||
38,
|
||||
47,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
@ -315,7 +315,7 @@ snapshot_kind: text
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
17,
|
||||
38,
|
||||
47,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
@ -332,8 +332,8 @@ snapshot_kind: text
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
56,
|
||||
78,
|
||||
65,
|
||||
96,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
@ -361,8 +361,8 @@ snapshot_kind: text
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
56,
|
||||
78,
|
||||
65,
|
||||
96,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
@ -379,8 +379,8 @@ snapshot_kind: text
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
96,
|
||||
117,
|
||||
114,
|
||||
144,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
@ -408,8 +408,8 @@ snapshot_kind: text
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
96,
|
||||
117,
|
||||
114,
|
||||
144,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
@ -426,8 +426,8 @@ snapshot_kind: text
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
166,
|
||||
191,
|
||||
193,
|
||||
218,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
@ -446,8 +446,8 @@ snapshot_kind: text
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
166,
|
||||
191,
|
||||
193,
|
||||
218,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
@ -457,8 +457,8 @@ snapshot_kind: text
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
166,
|
||||
191,
|
||||
193,
|
||||
218,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
@ -474,8 +474,8 @@ snapshot_kind: text
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
197,
|
||||
222,
|
||||
224,
|
||||
249,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
@ -495,8 +495,8 @@ snapshot_kind: text
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
166,
|
||||
191,
|
||||
193,
|
||||
218,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
|
@ -1,12 +1,12 @@
|
||||
```mermaid
|
||||
flowchart LR
|
||||
subgraph path4 [Path]
|
||||
4["Path<br>[166, 191, 0]"]
|
||||
5["Segment<br>[197, 222, 0]"]
|
||||
4["Path<br>[193, 218, 0]"]
|
||||
5["Segment<br>[224, 249, 0]"]
|
||||
end
|
||||
1["Plane<br>[17, 38, 0]"]
|
||||
2["Plane<br>[56, 78, 0]"]
|
||||
3["Plane<br>[96, 117, 0]"]
|
||||
1["Plane<br>[17, 47, 0]"]
|
||||
2["Plane<br>[65, 96, 0]"]
|
||||
3["Plane<br>[114, 144, 0]"]
|
||||
1 --- 4
|
||||
4 --- 5
|
||||
```
|
||||
|
@ -1,13 +1,14 @@
|
||||
---
|
||||
source: kcl/src/simulation_tests.rs
|
||||
description: Result of parsing artifact_graph_example_code_offset_planes.kcl
|
||||
snapshot_kind: text
|
||||
---
|
||||
{
|
||||
"Ok": {
|
||||
"body": [
|
||||
{
|
||||
"declaration": {
|
||||
"end": 38,
|
||||
"end": 47,
|
||||
"id": {
|
||||
"end": 14,
|
||||
"name": "offsetPlane001",
|
||||
@ -17,17 +18,15 @@ description: Result of parsing artifact_graph_example_code_offset_planes.kcl
|
||||
"init": {
|
||||
"arguments": [
|
||||
{
|
||||
"end": 33,
|
||||
"raw": "\"XY\"",
|
||||
"start": 29,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "XY"
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"type": "Identifier",
|
||||
"name": "offset"
|
||||
},
|
||||
{
|
||||
"end": 37,
|
||||
"arg": {
|
||||
"end": 46,
|
||||
"raw": "20",
|
||||
"start": 35,
|
||||
"start": 44,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
@ -35,6 +34,7 @@ description: Result of parsing artifact_graph_example_code_offset_planes.kcl
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 28,
|
||||
@ -42,15 +42,23 @@ description: Result of parsing artifact_graph_example_code_offset_planes.kcl
|
||||
"start": 17,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 38,
|
||||
"end": 47,
|
||||
"start": 17,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"end": 33,
|
||||
"raw": "\"XY\"",
|
||||
"start": 29,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "XY"
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "VariableDeclarator"
|
||||
},
|
||||
"end": 38,
|
||||
"end": 47,
|
||||
"kind": "const",
|
||||
"start": 0,
|
||||
"type": "VariableDeclaration",
|
||||
@ -58,28 +66,26 @@ description: Result of parsing artifact_graph_example_code_offset_planes.kcl
|
||||
},
|
||||
{
|
||||
"declaration": {
|
||||
"end": 78,
|
||||
"end": 96,
|
||||
"id": {
|
||||
"end": 53,
|
||||
"end": 62,
|
||||
"name": "offsetPlane002",
|
||||
"start": 39,
|
||||
"start": 48,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"arguments": [
|
||||
{
|
||||
"end": 72,
|
||||
"raw": "\"XZ\"",
|
||||
"start": 68,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "XZ"
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"type": "Identifier",
|
||||
"name": "offset"
|
||||
},
|
||||
{
|
||||
"arg": {
|
||||
"argument": {
|
||||
"end": 77,
|
||||
"end": 95,
|
||||
"raw": "50",
|
||||
"start": 75,
|
||||
"start": 93,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
@ -87,56 +93,63 @@ description: Result of parsing artifact_graph_example_code_offset_planes.kcl
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"end": 77,
|
||||
"end": 95,
|
||||
"operator": "-",
|
||||
"start": 74,
|
||||
"start": 92,
|
||||
"type": "UnaryExpression",
|
||||
"type": "UnaryExpression"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 67,
|
||||
"end": 76,
|
||||
"name": "offsetPlane",
|
||||
"start": 56,
|
||||
"start": 65,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 78,
|
||||
"start": 56,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
"end": 96,
|
||||
"start": 65,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"end": 81,
|
||||
"raw": "\"XZ\"",
|
||||
"start": 77,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "XZ"
|
||||
}
|
||||
},
|
||||
"start": 39,
|
||||
"start": 48,
|
||||
"type": "VariableDeclarator"
|
||||
},
|
||||
"end": 78,
|
||||
"end": 96,
|
||||
"kind": "const",
|
||||
"start": 39,
|
||||
"start": 48,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
},
|
||||
{
|
||||
"declaration": {
|
||||
"end": 117,
|
||||
"end": 144,
|
||||
"id": {
|
||||
"end": 93,
|
||||
"end": 111,
|
||||
"name": "offsetPlane003",
|
||||
"start": 79,
|
||||
"start": 97,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"arguments": [
|
||||
{
|
||||
"end": 112,
|
||||
"raw": "\"YZ\"",
|
||||
"start": 108,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "YZ"
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"type": "Identifier",
|
||||
"name": "offset"
|
||||
},
|
||||
{
|
||||
"end": 116,
|
||||
"arg": {
|
||||
"end": 143,
|
||||
"raw": "10",
|
||||
"start": 114,
|
||||
"start": 141,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
@ -144,34 +157,43 @@ description: Result of parsing artifact_graph_example_code_offset_planes.kcl
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 107,
|
||||
"end": 125,
|
||||
"name": "offsetPlane",
|
||||
"start": 96,
|
||||
"start": 114,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 117,
|
||||
"start": 96,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
"end": 144,
|
||||
"start": 114,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"end": 130,
|
||||
"raw": "\"YZ\"",
|
||||
"start": 126,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "YZ"
|
||||
}
|
||||
},
|
||||
"start": 79,
|
||||
"start": 97,
|
||||
"type": "VariableDeclarator"
|
||||
},
|
||||
"end": 117,
|
||||
"end": 144,
|
||||
"kind": "const",
|
||||
"start": 79,
|
||||
"start": 97,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
},
|
||||
{
|
||||
"declaration": {
|
||||
"end": 222,
|
||||
"end": 249,
|
||||
"id": {
|
||||
"end": 128,
|
||||
"end": 155,
|
||||
"name": "sketch002",
|
||||
"start": 119,
|
||||
"start": 146,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
@ -179,21 +201,21 @@ description: Result of parsing artifact_graph_example_code_offset_planes.kcl
|
||||
{
|
||||
"arguments": [
|
||||
{
|
||||
"end": 159,
|
||||
"end": 186,
|
||||
"name": "offsetPlane001",
|
||||
"start": 145,
|
||||
"start": 172,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 144,
|
||||
"end": 171,
|
||||
"name": "startSketchOn",
|
||||
"start": 131,
|
||||
"start": 158,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 160,
|
||||
"start": 131,
|
||||
"end": 187,
|
||||
"start": 158,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
@ -202,9 +224,9 @@ description: Result of parsing artifact_graph_example_code_offset_planes.kcl
|
||||
{
|
||||
"elements": [
|
||||
{
|
||||
"end": 183,
|
||||
"end": 210,
|
||||
"raw": "0",
|
||||
"start": 182,
|
||||
"start": 209,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
@ -213,9 +235,9 @@ description: Result of parsing artifact_graph_example_code_offset_planes.kcl
|
||||
}
|
||||
},
|
||||
{
|
||||
"end": 186,
|
||||
"end": 213,
|
||||
"raw": "0",
|
||||
"start": 185,
|
||||
"start": 212,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
@ -224,26 +246,26 @@ description: Result of parsing artifact_graph_example_code_offset_planes.kcl
|
||||
}
|
||||
}
|
||||
],
|
||||
"end": 187,
|
||||
"start": 181,
|
||||
"end": 214,
|
||||
"start": 208,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
},
|
||||
{
|
||||
"end": 190,
|
||||
"start": 189,
|
||||
"end": 217,
|
||||
"start": 216,
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 180,
|
||||
"end": 207,
|
||||
"name": "startProfileAt",
|
||||
"start": 166,
|
||||
"start": 193,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 191,
|
||||
"start": 166,
|
||||
"end": 218,
|
||||
"start": 193,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
@ -258,9 +280,9 @@ description: Result of parsing artifact_graph_example_code_offset_planes.kcl
|
||||
"arg": {
|
||||
"elements": [
|
||||
{
|
||||
"end": 213,
|
||||
"end": 240,
|
||||
"raw": "6.78",
|
||||
"start": 209,
|
||||
"start": 236,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
@ -269,9 +291,9 @@ description: Result of parsing artifact_graph_example_code_offset_planes.kcl
|
||||
}
|
||||
},
|
||||
{
|
||||
"end": 220,
|
||||
"end": 247,
|
||||
"raw": "15.01",
|
||||
"start": 215,
|
||||
"start": 242,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
@ -280,48 +302,48 @@ description: Result of parsing artifact_graph_example_code_offset_planes.kcl
|
||||
}
|
||||
}
|
||||
],
|
||||
"end": 221,
|
||||
"start": 208,
|
||||
"end": 248,
|
||||
"start": 235,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 201,
|
||||
"end": 228,
|
||||
"name": "line",
|
||||
"start": 197,
|
||||
"start": 224,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 222,
|
||||
"start": 197,
|
||||
"end": 249,
|
||||
"start": 224,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": null
|
||||
}
|
||||
],
|
||||
"end": 222,
|
||||
"start": 131,
|
||||
"end": 249,
|
||||
"start": 158,
|
||||
"type": "PipeExpression",
|
||||
"type": "PipeExpression"
|
||||
},
|
||||
"start": 119,
|
||||
"start": 146,
|
||||
"type": "VariableDeclarator"
|
||||
},
|
||||
"end": 222,
|
||||
"end": 249,
|
||||
"kind": "const",
|
||||
"start": 119,
|
||||
"start": 146,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
}
|
||||
],
|
||||
"end": 223,
|
||||
"end": 250,
|
||||
"nonCodeMeta": {
|
||||
"nonCodeNodes": {
|
||||
"2": [
|
||||
{
|
||||
"end": 119,
|
||||
"start": 117,
|
||||
"end": 146,
|
||||
"start": 144,
|
||||
"type": "NonCodeNode",
|
||||
"value": {
|
||||
"type": "newLine"
|
||||
|
@ -1,6 +1,6 @@
|
||||
offsetPlane001 = offsetPlane("XY", 20)
|
||||
offsetPlane002 = offsetPlane("XZ", -50)
|
||||
offsetPlane003 = offsetPlane("YZ", 10)
|
||||
offsetPlane001 = offsetPlane("XY", offset = 20)
|
||||
offsetPlane002 = offsetPlane("XZ", offset = -50)
|
||||
offsetPlane003 = offsetPlane("YZ", offset = 10)
|
||||
|
||||
sketch002 = startSketchOn(offsetPlane001)
|
||||
|> startProfileAt([0, 0], %)
|
||||
|
@ -8,15 +8,8 @@ snapshot_kind: text
|
||||
"labeledArgs": {
|
||||
"offset": {
|
||||
"sourceRange": [
|
||||
35,
|
||||
37,
|
||||
0
|
||||
]
|
||||
},
|
||||
"std_plane": {
|
||||
"sourceRange": [
|
||||
29,
|
||||
33,
|
||||
44,
|
||||
46,
|
||||
0
|
||||
]
|
||||
}
|
||||
@ -24,78 +17,82 @@ snapshot_kind: text
|
||||
"name": "offsetPlane",
|
||||
"sourceRange": [
|
||||
17,
|
||||
38,
|
||||
47,
|
||||
0
|
||||
],
|
||||
"type": "StdLibCall",
|
||||
"unlabeledArg": null
|
||||
"unlabeledArg": {
|
||||
"sourceRange": [
|
||||
29,
|
||||
33,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"labeledArgs": {
|
||||
"offset": {
|
||||
"sourceRange": [
|
||||
74,
|
||||
77,
|
||||
0
|
||||
]
|
||||
},
|
||||
"std_plane": {
|
||||
"sourceRange": [
|
||||
68,
|
||||
72,
|
||||
92,
|
||||
95,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"name": "offsetPlane",
|
||||
"sourceRange": [
|
||||
56,
|
||||
78,
|
||||
65,
|
||||
96,
|
||||
0
|
||||
],
|
||||
"type": "StdLibCall",
|
||||
"unlabeledArg": null
|
||||
"unlabeledArg": {
|
||||
"sourceRange": [
|
||||
77,
|
||||
81,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"labeledArgs": {
|
||||
"offset": {
|
||||
"sourceRange": [
|
||||
141,
|
||||
143,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"name": "offsetPlane",
|
||||
"sourceRange": [
|
||||
114,
|
||||
116,
|
||||
0
|
||||
]
|
||||
},
|
||||
"std_plane": {
|
||||
"sourceRange": [
|
||||
108,
|
||||
112,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"name": "offsetPlane",
|
||||
"sourceRange": [
|
||||
96,
|
||||
117,
|
||||
144,
|
||||
0
|
||||
],
|
||||
"type": "StdLibCall",
|
||||
"unlabeledArg": null
|
||||
"unlabeledArg": {
|
||||
"sourceRange": [
|
||||
126,
|
||||
130,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"labeledArgs": {
|
||||
"data": {
|
||||
"sourceRange": [
|
||||
145,
|
||||
159,
|
||||
172,
|
||||
186,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"name": "startSketchOn",
|
||||
"sourceRange": [
|
||||
131,
|
||||
160,
|
||||
158,
|
||||
187,
|
||||
0
|
||||
],
|
||||
"type": "StdLibCall",
|
||||
|
@ -1,6 +1,7 @@
|
||||
---
|
||||
source: kcl/src/simulation_tests.rs
|
||||
description: Variables in memory after executing artifact_graph_example_code_offset_planes.kcl
|
||||
snapshot_kind: text
|
||||
---
|
||||
{
|
||||
"HALF_TURN": {
|
||||
@ -129,8 +130,8 @@ description: Variables in memory after executing artifact_graph_example_code_off
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
197,
|
||||
222,
|
||||
224,
|
||||
249,
|
||||
0
|
||||
]
|
||||
},
|
||||
@ -189,8 +190,8 @@ description: Variables in memory after executing artifact_graph_example_code_off
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
166,
|
||||
191,
|
||||
193,
|
||||
218,
|
||||
0
|
||||
]
|
||||
}
|
||||
@ -203,8 +204,8 @@ description: Variables in memory after executing artifact_graph_example_code_off
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
166,
|
||||
191,
|
||||
193,
|
||||
218,
|
||||
0
|
||||
]
|
||||
}
|
||||
|
Reference in New Issue
Block a user