Compare commits

...

12 Commits

Author SHA1 Message Date
bc818f10c3 Remove last remnants of legacy positional call (#6678)
* Remove last remnants of legacy positional call

* Update docs

* Fix segAng()

* Fix more docs

* Update docs again
2025-05-02 20:07:31 -05:00
19f5031ef7 Release KCL 66 (#6679)
Breaking changes:

 - All functions (even functions defined by users) must use keyword arguments, not positional arguments
2025-05-02 21:55:58 +00:00
b71eb4fb89 Simplify some test code (#6669) 2025-05-02 21:39:20 +00:00
c327c73087 Catch import scene selection on transforms and point to the feature tree (#6674)
* Catch import scene selection on transforms and point to the feature tree
Fixes #6667

* Add test for toast on clone, bringing back forgotten test
2025-05-02 17:25:33 -04:00
4fe8741ea7 Remove CallExpression support (#6639)
Users MUST use keyword call syntax now.

Closes https://github.com/KittyCAD/modeling-app/issues/4600
2025-05-02 16:08:12 -05:00
75916d4300 Fix resetting onboarding from settings in web after #6564 (#6675)
Fix resetting onboarding in web after #6564

Oversight on my part while refactoring the onboarding system in #6564.
The new centralized `acceptOnboarding` workflow constructs a relative
path, so we have to get out of the settings before invoking it.
2025-05-02 16:48:38 -04:00
e65a6b6a38 Remove reminder message in import (#6668)
Fixes #6666
2025-05-02 19:58:06 +00:00
86a83cadd3 Make onboarding optional, able to be ignored on desktop (take 2) (#6628)
* Remove unused `telemetryLoader`

* Remove onboarding redirect behavior

* Allow subRoute to be passed to navigateToProject

* Replace warning dialog routes with toasts

* Wire up new utilities and toasts to UI components

* Add home sidebar buttons for tutorial flow

* Rename menu item

* Add flex-1 so home-layout fills available space

* Remove onboarding avatar tests, they are becoming irrelevant

* Consolidate onboarding tests to one longer one

and update it to not use pixel color checks, and use fixtures.

* Shorten warning toast button text

* tsc, lint, and circular deps

* Update circular dep file

* Fix mistakes made in circular update tweaking

* One more dumb created circular dep

* Update src/routes/Onboarding/utils.tsx

Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>

* Fix narrow screen home layout breaking

* fix: kevin, navigation routes fixed

* fix: filename parsing is correct now for onboarding with the last file sep

* Fix e2e test state checks that are diff on Linux

* Create onboarding project entirely through systemIOMachine

* Fix Windows path construction

* Make utility to verify a string is an onboarding value

* Little biome formatting suggestion fix

* Units onboarding step was not using OnboardingButtons

* Add type checking of next and previous status, fix useNextClick

* Thanks Graphite Diamond, I should use that new util

* Remove TODO comment

* Fix botched merge because IS_PLAYWRIGHT moved or something

---------

Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: Kevin Nadro <kevin@zoo.dev>
2025-05-02 15:54:49 -04:00
00553c34ab Enable Boolean op deletion from the feature tree (#6637)
* Can't Delete Union From Feature Tree
Fixes #6584. Works locally but the new tests don't appear to work yet

* Change tests to right-click > Delete
2025-05-02 15:34:21 -04:00
ace9a59a45 fix cache and imports (#6647)
* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix clippy

Signed-off-by: Jess Frazelle <github@jessfraz.com>

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
2025-05-02 17:41:14 +00:00
09ebb517d9 Fix link to types.md in docs (#6653)
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2025-05-02 09:06:43 -07:00
1c697d30ee Fix to not add extra spaces when formatting call (#6652) 2025-05-02 08:16:07 -05:00
435 changed files with 56830 additions and 72531 deletions

View File

@ -210,7 +210,7 @@ As per the example above you can use the tag identifier to get a reference to th
tagged object. The syntax for this is `myTag`. tagged object. The syntax for this is `myTag`.
In the example above we use the tag identifier to get the angle of the segment In the example above we use the tag identifier to get the angle of the segment
`segAng(rectangleSegmentA001, %)`. `segAng(rectangleSegmentA001)`.
### `Start` ### `Start`

View File

@ -144,11 +144,11 @@ layout: manual
See also the [types overview](types) See also the [types overview](types)
* **Primitive types** * **Primitive types**
* [`End`](kcl/types.md#End) * [`End`](kcl/types#End)
* [`ImportedGeometry`](kcl/types.md#ImportedGeometry) * [`ImportedGeometry`](kcl/types#ImportedGeometry)
* [`Start`](kcl/types.md#Start) * [`Start`](kcl/types#Start)
* [`TagDeclarator`](kcl/types.md#TagDeclarator) * [`TagDeclarator`](kcl/types#TagDeclarator)
* [`TagIdentifier`](kcl/types.md#TagIdentifier) * [`TagIdentifier`](kcl/types#TagIdentifier)
* [`any`](kcl/types/std-types-any) * [`any`](kcl/types/std-types-any)
* [`bool`](kcl/types/std-types-bool) * [`bool`](kcl/types/std-types-bool)
* [`number`](kcl/types/std-types-number) * [`number`](kcl/types/std-types-number)

View File

@ -55,7 +55,7 @@ fn sum(arr):
// We use `assert` to check that our `sum` function gives the // We use `assert` to check that our `sum` function gives the
// expected result. It's good to check your work! // expected result. It's good to check your work!
assert( assert(
sum([1, 2, 3]), sum([1, 2, 3]),
isEqualTo = 6, isEqualTo = 6,
tolerance = 0.1, tolerance = 0.1,
error = "1 + 2 + 3 summed is 6", error = "1 + 2 + 3 summed is 6",

View File

@ -232205,7 +232205,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"// This function adds two numbers.\nfn add(a, b) {\n return a + b\n}\n\n// This function adds an array of numbers.\n// It uses the `reduce` function, to call the `add` function on every\n// element of the `arr` parameter. The starting value is 0.\nfn sum(@arr) {\n return reduce(arr, initial = 0, f = add)\n}\n\n/* The above is basically like this pseudo-code:\nfn sum(arr):\n sumSoFar = 0\n for i in arr:\n sumSoFar = add(sumSoFar, i)\n return sumSoFar */\n\n// We use `assert` to check that our `sum` function gives the\n// expected result. It's good to check your work!\nassert(\n sum([1, 2, 3]),\n isEqualTo = 6,\n tolerance = 0.1,\n error = \"1 + 2 + 3 summed is 6\",\n)", "// This function adds two numbers.\nfn add(a, b) {\n return a + b\n}\n\n// This function adds an array of numbers.\n// It uses the `reduce` function, to call the `add` function on every\n// element of the `arr` parameter. The starting value is 0.\nfn sum(@arr) {\n return reduce(arr, initial = 0, f = add)\n}\n\n/* The above is basically like this pseudo-code:\nfn sum(arr):\n sumSoFar = 0\n for i in arr:\n sumSoFar = add(sumSoFar, i)\n return sumSoFar */\n\n// We use `assert` to check that our `sum` function gives the\n// expected result. It's good to check your work!\nassert(\n sum([1, 2, 3]),\n isEqualTo = 6,\n tolerance = 0.1,\n error = \"1 + 2 + 3 summed is 6\",\n)",
"// This example works just like the previous example above, but it uses\n// an anonymous `add` function as its parameter, instead of declaring a\n// named function outside.\narr = [1, 2, 3]\nsum = reduce(\n arr,\n initial = 0,\n f = fn(i, result_so_far) {\n return i + result_so_far\n },\n)\n\n// We use `assert` to check that our `sum` function gives the\n// expected result. It's good to check your work!\nassert(\n sum,\n isEqualTo = 6,\n tolerance = 0.1,\n error = \"1 + 2 + 3 summed is 6\",\n)", "// This example works just like the previous example above, but it uses\n// an anonymous `add` function as its parameter, instead of declaring a\n// named function outside.\narr = [1, 2, 3]\nsum = reduce(\n arr,\n initial = 0,\n f = fn(i, result_so_far) {\n return i + result_so_far\n },\n)\n\n// We use `assert` to check that our `sum` function gives the\n// expected result. It's good to check your work!\nassert(\n sum,\n isEqualTo = 6,\n tolerance = 0.1,\n error = \"1 + 2 + 3 summed is 6\",\n)",
"// Declare a function that sketches a decagon.\nfn decagon(@radius) {\n // Each side of the decagon is turned this many radians from the previous angle.\n stepAngle = (1 / 10 * TAU): number(rad)\n\n // Start the decagon sketch at this point.\n startOfDecagonSketch = startSketchOn(XY)\n |> startProfile(at = [cos(0) * radius, sin(0) * radius])\n\n // Use a `reduce` to draw the remaining decagon sides.\n // For each number in the array 1..10, run the given function,\n // which takes a partially-sketched decagon and adds one more edge to it.\n fullDecagon = reduce(\n [1..10],\n initial = startOfDecagonSketch,\n f = fn(i, partialDecagon) {\n // Draw one edge of the decagon.\n x = cos(stepAngle * i) * radius\n y = sin(stepAngle * i) * radius\n return line(partialDecagon, end = [x, y])\n },\n )\n\n return fullDecagon\n}\n\n/* The `decagon` above is basically like this pseudo-code:\nfn decagon(radius):\n stepAngle = ((1/10) * TAU): number(rad)\n plane = startSketchOn(XY)\n startOfDecagonSketch = startProfile(plane, at = [(cos(0)*radius), (sin(0) * radius)])\n\n // Here's the reduce part.\n partialDecagon = startOfDecagonSketch\n for i in [1..10]:\n x = cos(stepAngle * i) * radius\n y = sin(stepAngle * i) * radius\n partialDecagon = line(partialDecagon, end = [x, y])\n fullDecagon = partialDecagon // it's now full\n return fullDecagon */\n\n// Use the `decagon` function declared above, to sketch a decagon with radius 5.\ndecagon(5.0)\n |> close()" "// Declare a function that sketches a decagon.\nfn decagon(@radius) {\n // Each side of the decagon is turned this many radians from the previous angle.\n stepAngle = (1 / 10 * TAU): number(rad)\n\n // Start the decagon sketch at this point.\n startOfDecagonSketch = startSketchOn(XY)\n |> startProfile(at = [cos(0) * radius, sin(0) * radius])\n\n // Use a `reduce` to draw the remaining decagon sides.\n // For each number in the array 1..10, run the given function,\n // which takes a partially-sketched decagon and adds one more edge to it.\n fullDecagon = reduce(\n [1..10],\n initial = startOfDecagonSketch,\n f = fn(i, partialDecagon) {\n // Draw one edge of the decagon.\n x = cos(stepAngle * i) * radius\n y = sin(stepAngle * i) * radius\n return line(partialDecagon, end = [x, y])\n },\n )\n\n return fullDecagon\n}\n\n/* The `decagon` above is basically like this pseudo-code:\nfn decagon(radius):\n stepAngle = ((1/10) * TAU): number(rad)\n plane = startSketchOn(XY)\n startOfDecagonSketch = startProfile(plane, at = [(cos(0)*radius), (sin(0) * radius)])\n\n // Here's the reduce part.\n partialDecagon = startOfDecagonSketch\n for i in [1..10]:\n x = cos(stepAngle * i) * radius\n y = sin(stepAngle * i) * radius\n partialDecagon = line(partialDecagon, end = [x, y])\n fullDecagon = partialDecagon // it's now full\n return fullDecagon */\n\n// Use the `decagon` function declared above, to sketch a decagon with radius 5.\ndecagon(5.0)\n |> close()"
] ]

View File

@ -210,7 +210,7 @@ As per the example above you can use the tag identifier to get a reference to th
tagged object. The syntax for this is `myTag`. tagged object. The syntax for this is `myTag`.
In the example above we use the tag identifier to get the angle of the segment In the example above we use the tag identifier to get the angle of the segment
`segAng(rectangleSegmentA001, %)`. `segAng(rectangleSegmentA001)`.
### `Start` ### `Start`

View File

@ -35,7 +35,7 @@ As per the example above you can use the tag identifier to get a reference to th
tagged object. The syntax for this is `myTag`. tagged object. The syntax for this is `myTag`.
In the example above we use the tag identifier to get the angle of the segment In the example above we use the tag identifier to get the angle of the segment
`segAng(rectangleSegmentA001, %)`. `segAng(rectangleSegmentA001)`.
### Tag Scope ### Tag Scope
@ -81,11 +81,13 @@ fn rect(origin) {
|> angledLine( |> angledLine(
angle = segAng(rectangleSegmentA001) - 90, angle = segAng(rectangleSegmentA001) - 90,
length = 196.99 length = 196.99
, %, $rectangleSegmentB001) tag = $rectangleSegmentB001,
)
|> angledLine( |> angledLine(
angle = segAng(rectangleSegmentA001), angle = segAng(rectangleSegmentA001),
length = -segLen(rectangleSegmentA001) length = -segLen(rectangleSegmentA001)
, %, $rectangleSegmentC001) tag = $rectangleSegmentC001,
)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()
} }

View File

@ -111,9 +111,25 @@ test.describe('Point and click for boolean workflows', () => {
} }
await cmdBar.submit() await cmdBar.submit()
await scene.settled(cmdBar)
await editor.expectEditor.toContain(operation.code) await editor.expectEditor.toContain(operation.code)
}) })
await test.step(`Delete ${operationName} operation via feature tree selection`, async () => {
await toolbar.openPane('feature-tree')
const op = await toolbar.getFeatureTreeOperation(operationName, 0)
await op.click({ button: 'right' })
await page.getByTestId('context-menu-delete').click()
await scene.settled(cmdBar)
await toolbar.closePane('feature-tree')
// Expect changes in ft and code
await toolbar.openPane('code')
await editor.expectEditor.not.toContain(operation.code)
await expect(
await toolbar.getFeatureTreeOperation(operationName, 0)
).not.toBeVisible()
})
}) })
} }
}) })

View File

@ -871,14 +871,18 @@ a1 = startSketchOn(offsetPlane(XY, offset = 10))
await page.keyboard.press('Enter') await page.keyboard.press('Enter')
await page.keyboard.type(`extrusion = startSketchOn(XY) await page.keyboard.type(`extrusion = startSketchOn(XY)
|> circle(center = [0, 0], radius = dia/2) |> circle(center = [0, 0], radius = dia/2)
|> subtract2d(tool = squareHole(length, width, height)) |> subtract2d(tool = squareHole(l = length, w = width, height))
|> extrude(length = height)`) |> extrude(length = height)`)
// error in gutter // error in gutter
await expect(page.locator('.cm-lint-marker-error').first()).toBeVisible() await expect(page.locator('.cm-lint-marker-error').first()).toBeVisible()
await page.hover('.cm-lint-marker-error:first-child') await page.hover('.cm-lint-marker-error:first-child')
await expect( await expect(
page.getByText('Expected 2 arguments, got 3').first() page
.getByText(
'TODO ADAM: find the right error Expected 2 arguments, got 3'
)
.first()
).toBeVisible() ).toBeVisible()
// Make sure there are two diagnostics // Make sure there are two diagnostics

View File

@ -3,7 +3,7 @@ import * as fsp from 'fs/promises'
import { expect, test } from '@e2e/playwright/zoo-test' import { expect, test } from '@e2e/playwright/zoo-test'
const FEATURE_TREE_EXAMPLE_CODE = `export fn timesFive(x) { const FEATURE_TREE_EXAMPLE_CODE = `export fn timesFive(@x) {
return 5 * x return 5 * x
} }
export fn triangle() { export fn triangle() {

View File

@ -24,6 +24,7 @@ export class HomePageFixture {
projectTextName!: Locator projectTextName!: Locator
sortByDateBtn!: Locator sortByDateBtn!: Locator
sortByNameBtn!: Locator sortByNameBtn!: Locator
tutorialBtn!: Locator
constructor(page: Page) { constructor(page: Page) {
this.page = page this.page = page
@ -43,6 +44,7 @@ export class HomePageFixture {
this.sortByDateBtn = this.page.getByTestId('home-sort-by-modified') this.sortByDateBtn = this.page.getByTestId('home-sort-by-modified')
this.sortByNameBtn = this.page.getByTestId('home-sort-by-name') this.sortByNameBtn = this.page.getByTestId('home-sort-by-name')
this.tutorialBtn = this.page.getByTestId('home-tutorial-button')
} }
private _serialiseSortBy = async (): Promise< private _serialiseSortBy = async (): Promise<

View File

@ -17,6 +17,8 @@ type LengthUnitLabel = (typeof baseUnitLabels)[keyof typeof baseUnitLabels]
export class ToolbarFixture { export class ToolbarFixture {
public page: Page public page: Page
projectName!: Locator
fileName!: Locator
extrudeButton!: Locator extrudeButton!: Locator
loftButton!: Locator loftButton!: Locator
sweepButton!: Locator sweepButton!: Locator
@ -53,6 +55,8 @@ export class ToolbarFixture {
constructor(page: Page) { constructor(page: Page) {
this.page = page this.page = page
this.projectName = page.getByTestId('app-header-project-name')
this.fileName = page.getByTestId('app-header-file-name')
this.extrudeButton = page.getByTestId('extrude') this.extrudeButton = page.getByTestId('extrude')
this.loftButton = page.getByTestId('loft') this.loftButton = page.getByTestId('loft')
this.sweepButton = page.getByTestId('sweep') this.sweepButton = page.getByTestId('sweep')

View File

@ -450,7 +450,7 @@ test.describe(
) )
await expect(actual).toBeVisible() await expect(actual).toBeVisible()
}) })
test('Home.Help.Reset onboarding', async ({ test('Home.Help.Replay onboarding tutorial', async ({
tronApp, tronApp,
cmdBar, cmdBar,
page, page,
@ -464,7 +464,7 @@ test.describe(
await tronApp.electron.evaluate(async ({ app }) => { await tronApp.electron.evaluate(async ({ app }) => {
if (!app || !app.applicationMenu) return false if (!app || !app.applicationMenu) return false
const menu = app.applicationMenu.getMenuItemById( const menu = app.applicationMenu.getMenuItemById(
'Help.Reset onboarding' 'Help.Replay onboarding tutorial'
) )
if (!menu) { if (!menu) {
return false return false
@ -2339,7 +2339,7 @@ test.describe(
await scene.connectionEstablished() await scene.connectionEstablished()
await expect(toolbar.startSketchBtn).toBeVisible() await expect(toolbar.startSketchBtn).toBeVisible()
}) })
test('Modeling.Help.Reset onboarding', async ({ test('Modeling.Help.Replay onboarding tutorial', async ({
tronApp, tronApp,
cmdBar, cmdBar,
page, page,
@ -2358,7 +2358,7 @@ test.describe(
await tronApp.electron.evaluate(async ({ app }) => { await tronApp.electron.evaluate(async ({ app }) => {
if (!app || !app.applicationMenu) fail() if (!app || !app.applicationMenu) fail()
const menu = app.applicationMenu.getMenuItemById( const menu = app.applicationMenu.getMenuItemById(
'Help.Reset onboarding' 'Help.Replay onboarding tutorial'
) )
if (!menu) fail() if (!menu) fail()
menu.click() menu.click()

View File

@ -1,560 +1,175 @@
import { join } from 'path'
import { bracket } from '@e2e/playwright/fixtures/bracket'
import { onboardingPaths } from '@src/routes/Onboarding/paths'
import fsp from 'fs/promises'
import { expectPixelColor } from '@e2e/playwright/fixtures/sceneFixture'
import {
TEST_SETTINGS_KEY,
TEST_SETTINGS_ONBOARDING_EXPORT,
TEST_SETTINGS_ONBOARDING_START,
TEST_SETTINGS_ONBOARDING_USER_MENU,
} from '@e2e/playwright/storageStates'
import {
createProject,
executorInputPath,
getUtils,
settingsToToml,
} from '@e2e/playwright/test-utils'
import { expect, test } from '@e2e/playwright/zoo-test' import { expect, test } from '@e2e/playwright/zoo-test'
// Because our default test settings have the onboardingStatus set to 'dismissed',
// we must set it to empty for the tests where we want to see the onboarding immediately.
test.describe('Onboarding tests', () => { test.describe('Onboarding tests', () => {
test('Onboarding code is shown in the editor', async ({ test('Desktop onboarding flow works', async ({
page, page,
homePage, homePage,
tronApp, toolbar,
}) => { editor,
if (!tronApp) {
fail()
}
await tronApp.cleanProjectDir({
app: {
onboarding_status: '',
},
})
const u = await getUtils(page)
await page.setBodyDimensions({ width: 1200, height: 500 })
await homePage.goToModelingScene()
// Test that the onboarding pane loaded
await expect(page.getByText('Welcome to Design Studio! This')).toBeVisible()
// Test that the onboarding pane loaded
await expect(page.getByText('Welcome to Design Studio! This')).toBeVisible()
// *and* that the code is shown in the editor
await expect(page.locator('.cm-content')).toContainText('// Shelf Bracket')
// Make sure the model loaded
const XYPlanePoint = { x: 774, y: 116 } as const
const modelColor: [number, number, number] = [45, 45, 45]
await page.mouse.move(XYPlanePoint.x, XYPlanePoint.y)
expect(await u.getGreatestPixDiff(XYPlanePoint, modelColor)).toBeLessThan(8)
})
test(
'Desktop: fresh onboarding executes and loads',
{
tag: '@electron',
},
async ({ page, tronApp, scene }) => {
if (!tronApp) {
fail()
}
await tronApp.cleanProjectDir({
app: {
onboarding_status: '',
},
})
const viewportSize = { width: 1200, height: 500 }
await page.setBodyDimensions(viewportSize)
await test.step(`Create a project and open to the onboarding`, async () => {
await createProject({ name: 'project-link', page })
await test.step(`Ensure the engine connection works by testing the sketch button`, async () => {
await scene.connectionEstablished()
})
})
await test.step(`Ensure we see the onboarding stuff`, async () => {
// Test that the onboarding pane loaded
await expect(
page.getByText('Welcome to Design Studio! This')
).toBeVisible()
// *and* that the code is shown in the editor
await expect(page.locator('.cm-content')).toContainText(
'// Shelf Bracket'
)
// TODO: jess make less shit
// Make sure the model loaded
//const XYPlanePoint = { x: 986, y: 522 } as const
//const modelColor: [number, number, number] = [76, 76, 76]
//await page.mouse.move(XYPlanePoint.x, XYPlanePoint.y)
//await expectPixelColor(page, modelColor, XYPlanePoint, 8)
})
}
)
test('Code resets after confirmation', async ({
page,
homePage,
tronApp,
scene, scene,
}) => {
if (!tronApp) {
fail()
}
await tronApp.cleanProjectDir()
const initialCode = `sketch001 = startSketchOn(XZ)`
// Load the page up with some code so we see the confirmation warning
// when we go to replay onboarding
await page.addInitScript((code) => {
localStorage.setItem('persistCode', code)
}, initialCode)
await page.setBodyDimensions({ width: 1200, height: 500 })
await homePage.goToModelingScene()
await scene.connectionEstablished()
// Replay the onboarding
await page.getByRole('link', { name: 'Settings' }).last().click()
const replayButton = page.getByRole('button', {
name: 'Replay onboarding',
})
await expect(replayButton).toBeVisible()
await replayButton.click()
// Ensure we see the warning, and that the code has not yet updated
await expect(page.getByText('Would you like to create')).toBeVisible()
await expect(page.locator('.cm-content')).toHaveText(initialCode)
const nextButton = page.getByTestId('onboarding-next')
await nextButton.hover()
await nextButton.click()
// Ensure we see the introduction and that the code has been reset
await expect(page.getByText('Welcome to Design Studio!')).toBeVisible()
await expect(page.locator('.cm-content')).toContainText('// Shelf Bracket')
// There used to be old code here that checked if we stored the reset
// code into localStorage but that isn't the case on desktop. It gets
// saved to the file system, which we have other tests for.
})
test('Click through each onboarding step and back', async ({
context,
page,
homePage,
tronApp, tronApp,
}) => { }) => {
if (!tronApp) { if (!tronApp) {
fail() fail()
} }
// Because our default test settings have the onboardingStatus set to 'dismissed',
// we must set it to empty for the tests where we want to see the onboarding UI.
await tronApp.cleanProjectDir({ await tronApp.cleanProjectDir({
app: { app: {
onboarding_status: '', onboarding_status: '',
}, },
}) })
// Override beforeEach test setup
await context.addInitScript( const bracketComment = '// Shelf Bracket'
async ({ settingsKey, settings }) => { const tutorialWelcomHeading = page.getByText(
// Give no initial code, so that the onboarding start is shown immediately 'Welcome to Design Studio! This'
localStorage.setItem('persistCode', '')
localStorage.setItem(settingsKey, settings)
},
{
settingsKey: TEST_SETTINGS_KEY,
settings: settingsToToml({
settings: TEST_SETTINGS_ONBOARDING_START,
}),
}
) )
await page.setBodyDimensions({ width: 1200, height: 1080 })
await homePage.goToModelingScene()
// Test that the onboarding pane loaded
await expect(page.getByText('Welcome to Design Studio! This')).toBeVisible()
const nextButton = page.getByTestId('onboarding-next') const nextButton = page.getByTestId('onboarding-next')
const prevButton = page.getByTestId('onboarding-prev') const prevButton = page.getByTestId('onboarding-prev')
const userMenuButton = toolbar.userSidebarButton
while ((await nextButton.innerText()) !== 'Finish') { const userMenuSettingsButton = page.getByRole('button', {
await nextButton.hover() name: 'User settings',
await nextButton.click()
}
while ((await prevButton.innerText()) !== 'Dismiss') {
await prevButton.hover()
await prevButton.click()
}
// Dismiss the onboarding
await prevButton.hover()
await prevButton.click()
// Test that the onboarding pane is gone
await expect(page.getByTestId('onboarding-content')).not.toBeVisible()
await expect.poll(() => page.url()).not.toContain('/onboarding')
})
test('Onboarding redirects and code updating', async ({
context,
page,
homePage,
tronApp,
}) => {
if (!tronApp) {
fail()
}
await tronApp.cleanProjectDir({
app: {
onboarding_status: '/export',
},
}) })
const settingsHeading = page.getByRole('heading', {
const originalCode = 'sigmaAllow = 15000' name: 'Settings',
exact: true,
// Override beforeEach test setup })
await context.addInitScript( const restartOnboardingSettingsButton = page.getByRole('button', {
async ({ settingsKey, settings, code }) => { name: 'Replay onboarding',
// Give some initial code, so we can test that it's cleared })
localStorage.setItem('persistCode', code) const helpMenuButton = page.getByRole('button', {
localStorage.setItem(settingsKey, settings) name: 'Help and resources',
}, })
{ const helpMenuRestartOnboardingButton = page.getByRole('button', {
settingsKey: TEST_SETTINGS_KEY, name: 'Replay onboarding tutorial',
settings: settingsToToml({ })
settings: TEST_SETTINGS_ONBOARDING_EXPORT, const postDismissToast = page.getByText(
}), 'Click the question mark in the lower-right corner if you ever want to redo the tutorial!'
code: originalCode,
}
) )
await page.setBodyDimensions({ width: 1200, height: 500 }) await test.step('Test initial home page view, showing a tutorial button', async () => {
await homePage.goToModelingScene() await expect(homePage.tutorialBtn).toBeVisible()
await homePage.expectState({
// Test that the redirect happened projectCards: [],
await expect.poll(() => page.url()).toContain('/onboarding/export') sortBy: 'last-modified-desc',
// Test that you come back to this page when you refresh
await page.reload()
await expect.poll(() => page.url()).toContain('/onboarding/export')
// Test that the code changes when you advance to the next step
await page.getByTestId('onboarding-next').hover()
await page.getByTestId('onboarding-next').click()
// Test that the onboarding pane loaded
const title = page.locator('[data-testid="onboarding-content"]')
await expect(title).toBeAttached()
await expect(page.locator('.cm-content')).not.toHaveText(originalCode)
// Test that the code is not empty when you click on the next step
await page.locator('[data-testid="onboarding-next"]').hover()
await page.locator('[data-testid="onboarding-next"]').click()
await expect(page.locator('.cm-content')).toHaveText(/.+/)
})
test('Onboarding code gets reset to demo on Interactive Numbers step', async ({
page,
homePage,
tronApp,
editor,
toolbar,
}) => {
if (!tronApp) {
fail()
}
await tronApp.cleanProjectDir({
app: {
onboarding_status: '/parametric-modeling',
},
})
const badCode = `// This is bad code we shouldn't see`
await page.setBodyDimensions({ width: 1200, height: 1080 })
await homePage.goToModelingScene()
await expect
.poll(() => page.url())
.toContain(onboardingPaths.PARAMETRIC_MODELING)
// Check the code got reset on load
await toolbar.openPane('code')
await editor.expectEditor.toContain(bracket, {
shouldNormalise: true,
timeout: 10_000,
})
// Mess with the code again
await editor.replaceCode('', badCode)
await editor.expectEditor.toContain(badCode, {
shouldNormalise: true,
timeout: 10_000,
})
// Click to the next step
await page.locator('[data-testid="onboarding-next"]').hover()
await page.locator('[data-testid="onboarding-next"]').click()
await page.waitForURL('**' + onboardingPaths.INTERACTIVE_NUMBERS, {
waitUntil: 'domcontentloaded',
})
// Check that the code has been reset
await editor.expectEditor.toContain(bracket, {
shouldNormalise: true,
timeout: 10_000,
})
})
// (lee) The two avatar tests are weird because even on main, we don't have
// anything to do with the avatar inside the onboarding test. Due to the
// low impact of an avatar not showing I'm changing this to fixme.
test('Avatar text updates depending on image load success', async ({
context,
page,
toolbar,
homePage,
tronApp,
}) => {
if (!tronApp) {
fail()
}
await tronApp.cleanProjectDir({
app: {
onboarding_status: '',
},
})
// Override beforeEach test setup
await context.addInitScript(
async ({ settingsKey, settings }) => {
localStorage.setItem(settingsKey, settings)
},
{
settingsKey: TEST_SETTINGS_KEY,
settings: settingsToToml({
settings: TEST_SETTINGS_ONBOARDING_USER_MENU,
}),
}
)
await page.setBodyDimensions({ width: 1200, height: 500 })
await homePage.goToModelingScene()
// Test that the text in this step is correct
const avatarLocator = toolbar.userSidebarButton.locator('img')
const onboardingOverlayLocator = page
.getByTestId('onboarding-content')
.locator('div')
.nth(1)
// Expect the avatar to be visible and for the text to reference it
await expect(avatarLocator).toBeVisible()
await expect(onboardingOverlayLocator).toBeVisible()
await expect(onboardingOverlayLocator).toContainText('your avatar')
// This is to force the avatar to 404.
// For our test image (only triggers locally. on CI, it's Kurt's /
// gravatar image )
await page.route('/cat.jpg', async (route) => {
await route.fulfill({
status: 404,
contentType: 'text/plain',
body: 'Not Found!',
}) })
}) })
// 404 the CI avatar image await test.step('Create a blank project and verify no onboarding chrome is shown', async () => {
await page.route('https://lh3.googleusercontent.com/**', async (route) => { await homePage.goToModelingScene()
await route.fulfill({ await expect(toolbar.projectName).toContainText('testDefault')
status: 404, await expect(tutorialWelcomHeading).not.toBeVisible()
contentType: 'text/plain', await editor.expectEditor.toContain('@settings(defaultLengthUnit = in)', {
body: 'Not Found!', shouldNormalise: true,
})
await scene.connectionEstablished()
await expect(toolbar.startSketchBtn).toBeEnabled({ timeout: 15_000 })
})
await test.step('Go home and verify we still see the tutorial button, then begin it.', async () => {
await toolbar.logoLink.click()
await expect(homePage.tutorialBtn).toBeVisible()
await homePage.expectState({
projectCards: [
{
title: 'testDefault',
fileCount: 1,
},
],
sortBy: 'last-modified-desc',
})
await homePage.tutorialBtn.click()
})
// This is web-only.
// TODO: write a new test just for the onboarding in browser
// await test.step('Ensure the onboarding request toast appears', async () => {
// await expect(page.getByTestId('onboarding-toast')).toBeVisible()
// await page.getByTestId('onboarding-next').click()
// })
await test.step('Ensure we see the welcome screen in a new project', async () => {
await expect(toolbar.projectName).toContainText('Tutorial Project 00')
await expect(tutorialWelcomHeading).toBeVisible()
await editor.expectEditor.toContain(bracketComment)
await scene.connectionEstablished()
await expect(toolbar.startSketchBtn).toBeEnabled({ timeout: 15_000 })
})
await test.step('Test the clicking through the onboarding flow', async () => {
await test.step('Going forward', async () => {
while ((await nextButton.innerText()) !== 'Finish') {
await nextButton.hover()
await nextButton.click()
}
})
await test.step('Going backward', async () => {
while ((await prevButton.innerText()) !== 'Dismiss') {
await prevButton.hover()
await prevButton.click()
}
})
// Dismiss the onboarding
await test.step('Dismiss the onboarding', async () => {
await prevButton.hover()
await prevButton.click()
await expect(page.getByTestId('onboarding-content')).not.toBeVisible()
await expect(postDismissToast).toBeVisible()
await expect.poll(() => page.url()).not.toContain('/onboarding')
}) })
}) })
await page.reload({ waitUntil: 'domcontentloaded' }) await test.step('Resetting onboarding from inside project should always make a new one', async () => {
await test.step('Reset onboarding from settings', async () => {
await userMenuButton.click()
await userMenuSettingsButton.click()
await expect(settingsHeading).toBeVisible()
await expect(restartOnboardingSettingsButton).toBeVisible()
await restartOnboardingSettingsButton.click()
})
// Now expect the text to be different await test.step('Makes a new project', async () => {
await expect(avatarLocator).not.toBeVisible() await expect(toolbar.projectName).toContainText('Tutorial Project 01')
await expect(onboardingOverlayLocator).toBeVisible() await expect(tutorialWelcomHeading).toBeVisible()
await expect(onboardingOverlayLocator).toContainText('the menu button') await editor.expectEditor.toContain(bracketComment)
}) await scene.connectionEstablished()
await expect(toolbar.startSketchBtn).toBeEnabled({ timeout: 15_000 })
})
test("Avatar text doesn't mention avatar when no avatar", async ({ await test.step('Dismiss the onboarding', async () => {
context, await postDismissToast.waitFor({ state: 'detached' })
page, await page.keyboard.press('Escape')
toolbar, await expect(postDismissToast).toBeVisible()
homePage, await expect(page.getByTestId('onboarding-content')).not.toBeVisible()
tronApp, await expect.poll(() => page.url()).not.toContain('/onboarding')
}) => { })
if (!tronApp) {
fail()
}
await tronApp.cleanProjectDir({
app: {
onboarding_status: '',
},
})
// Override beforeEach test setup
await context.addInitScript(
async ({ settingsKey, settings }) => {
localStorage.setItem(settingsKey, settings)
localStorage.setItem('FORCE_NO_IMAGE', 'FORCE_NO_IMAGE')
},
{
settingsKey: TEST_SETTINGS_KEY,
settings: settingsToToml({
settings: TEST_SETTINGS_ONBOARDING_USER_MENU,
}),
}
)
await page.setBodyDimensions({ width: 1200, height: 500 })
await homePage.goToModelingScene()
// Test that the text in this step is correct
const sidebar = toolbar.userSidebarButton
const avatar = sidebar.locator('img')
const onboardingOverlayLocator = page
.getByTestId('onboarding-content')
.locator('div')
.nth(1)
// Expect the avatar to be visible and for the text to reference it
await expect(avatar).not.toBeVisible()
await expect(onboardingOverlayLocator).toBeVisible()
await expect(onboardingOverlayLocator).toContainText('the menu button')
// Test we mention what else is in this menu for https://github.com/KittyCAD/modeling-app/issues/2939
// which doesn't deserver its own full test spun up
const userMenuFeatures = [
'manage your account',
'report a bug',
'request a feature',
'sign out',
]
for (const feature of userMenuFeatures) {
await expect(onboardingOverlayLocator).toContainText(feature)
}
})
})
test('Restarting onboarding on desktop takes one attempt', async ({
context,
page,
toolbar,
tronApp,
}) => {
if (!tronApp) {
fail()
}
await tronApp.cleanProjectDir({
app: {
onboarding_status: 'dismissed',
},
})
await context.folderSetupFn(async (dir) => {
const routerTemplateDir = join(dir, 'router-template-slate')
await fsp.mkdir(routerTemplateDir, { recursive: true })
await fsp.copyFile(
executorInputPath('router-template-slate.kcl'),
join(routerTemplateDir, 'main.kcl')
)
})
// Our constants
const u = await getUtils(page)
const projectCard = page.getByText('router-template-slate')
const helpMenuButton = page.getByRole('button', {
name: 'Help and resources',
})
const restartOnboardingButton = page.getByRole('button', {
name: 'Reset onboarding',
})
const nextButton = page.getByTestId('onboarding-next')
const tutorialProjectIndicator = page
.getByTestId('project-sidebar-toggle')
.filter({ hasText: 'Tutorial Project 00' })
const tutorialModalText = page.getByText('Welcome to Design Studio!')
const tutorialDismissButton = page.getByRole('button', { name: 'Dismiss' })
const userMenuButton = toolbar.userSidebarButton
const userMenuSettingsButton = page.getByRole('button', {
name: 'User settings',
})
const settingsHeading = page.getByRole('heading', {
name: 'Settings',
exact: true,
})
const restartOnboardingSettingsButton = page.getByRole('button', {
name: 'Replay onboarding',
})
await test.step('Navigate into project', async () => {
await expect(page.getByRole('heading', { name: 'Projects' })).toBeVisible()
await expect(projectCard).toBeVisible()
await projectCard.click()
await u.waitForPageLoad()
})
await test.step('Restart the onboarding from help menu', async () => {
await helpMenuButton.click()
await restartOnboardingButton.click()
await nextButton.hover()
await nextButton.click()
})
await test.step('Confirm that the onboarding has restarted', async () => {
await expect(tutorialProjectIndicator).toBeVisible()
await expect(tutorialModalText).toBeVisible()
// Make sure the model loaded
const XYPlanePoint = { x: 988, y: 523 } as const
const modelColor: [number, number, number] = [76, 76, 76]
await page.mouse.move(XYPlanePoint.x, XYPlanePoint.y)
await expectPixelColor(page, modelColor, XYPlanePoint, 8)
await tutorialDismissButton.click()
// Make sure model still there.
await expectPixelColor(page, modelColor, XYPlanePoint, 8)
})
await test.step('Clear code and restart onboarding from settings', async () => {
await u.openKclCodePanel()
await expect(u.codeLocator).toContainText('// Shelf Bracket')
await u.codeLocator.selectText()
await u.codeLocator.fill('')
await test.step('Navigate to settings', async () => {
await userMenuButton.click()
await userMenuSettingsButton.click()
await expect(settingsHeading).toBeVisible()
await expect(restartOnboardingSettingsButton).toBeVisible()
}) })
await restartOnboardingSettingsButton.click() await test.step('Resetting onboarding from home help menu makes a new project', async () => {
// Since the code is empty, we should not see the confirmation dialog await test.step('Go home and reset onboarding from lower-right help menu', async () => {
await expect(nextButton).not.toBeVisible() await toolbar.logoLink.click()
await expect(tutorialProjectIndicator).toBeVisible() await expect(homePage.tutorialBtn).not.toBeVisible()
await expect(tutorialModalText).toBeVisible() await expect(
homePage.projectCard.getByText('Tutorial Project 00')
).toBeVisible()
await expect(
homePage.projectCard.getByText('Tutorial Project 01')
).toBeVisible()
await helpMenuButton.click()
await helpMenuRestartOnboardingButton.click()
})
await test.step('Makes a new project', async () => {
await expect(toolbar.projectName).toContainText('Tutorial Project 02')
await expect(tutorialWelcomHeading).toBeVisible()
await editor.expectEditor.toContain(bracketComment)
await scene.connectionEstablished()
await expect(toolbar.startSketchBtn).toBeEnabled({ timeout: 15_000 })
})
})
}) })
}) })

View File

@ -800,25 +800,26 @@ foreign
} }
) )
// TODO: bring back in https://github.com/KittyCAD/modeling-app/issues/6570 test(
test.fixme( `Point-and-click clone`,
'Point-and-click Clone on assembly parts',
{ tag: ['@electron'] }, { tag: ['@electron'] },
async ({ async ({
context, context,
page, page,
homePage, homePage,
scene, scene,
editor,
toolbar, toolbar,
cmdBar, cmdBar,
tronApp, tronApp,
editor,
}) => { }) => {
if (!tronApp) { if (!tronApp) {
fail() fail()
} }
const projectName = 'assembly' const projectName = 'assembly'
const midPoint = { x: 500, y: 250 }
const [clickMidPoint] = scene.makeMouseHelpers(midPoint.x, midPoint.y)
await test.step('Setup parts and expect imported model', async () => { await test.step('Setup parts and expect imported model', async () => {
await context.folderSetupFn(async (dir) => { await context.folderSetupFn(async (dir) => {
@ -855,6 +856,50 @@ washer
await toolbar.closePane('code') await toolbar.closePane('code')
}) })
await test.step('Try to clone from scene selection and expect error', async () => {
await cmdBar.openCmdBar()
await cmdBar.chooseCommand('Clone a solid')
await cmdBar.expectState({
stage: 'arguments',
currentArgKey: 'selection',
currentArgValue: '',
headerArguments: {
Selection: '',
VariableName: '',
},
highlightedHeaderArg: 'selection',
commandName: 'Clone',
})
await clickMidPoint()
await cmdBar.progressCmdBar()
await cmdBar.expectState({
stage: 'arguments',
currentArgKey: 'variableName',
currentArgValue: '',
headerArguments: {
Selection: '1 path',
VariableName: '',
},
highlightedHeaderArg: 'variableName',
commandName: 'Clone',
})
await cmdBar.progressCmdBar()
await cmdBar.expectState({
stage: 'review',
headerArguments: {
Selection: '1 path',
VariableName: 'clone001',
},
commandName: 'Clone',
})
await cmdBar.progressCmdBar()
await expect(
page.getByText(
"Couldn't retrieve selection. If you're trying to transform an import, use the feature tree."
)
).toBeVisible()
})
await test.step('Clone the part using the feature tree', async () => { await test.step('Clone the part using the feature tree', async () => {
await toolbar.openPane('feature-tree') await toolbar.openPane('feature-tree')
const op = await toolbar.getFeatureTreeOperation('washer', 0) const op = await toolbar.getFeatureTreeOperation('washer', 0)

View File

@ -1222,7 +1222,7 @@ profile001 = startProfile(sketch001, at = [299.72, 230.82])
return lugSketch return lugSketch
} }
lug([0, 0], 10, .5, XY)` lug(origin = [0, 0], length = 10, diameter = .5, plane = XY)`
) )
}) })

View File

@ -78,16 +78,16 @@ part001 = startSketchOn(-XZ)
|> xLine(endAbsolute = totalLen, tag = $seg03) |> xLine(endAbsolute = totalLen, tag = $seg03)
|> yLine(length = -armThick, tag = $seg01) |> yLine(length = -armThick, tag = $seg01)
|> angledLineThatIntersects(angle = turns::HALF_TURN, offset = -armThick, intersectTag = seg04) |> angledLineThatIntersects(angle = turns::HALF_TURN, offset = -armThick, intersectTag = seg04)
|> angledLine(angle = segAng(seg04, %) + 180, endAbsoluteY = turns::ZERO) |> angledLine(angle = segAng(seg04) + 180, endAbsoluteY = turns::ZERO)
|> angledLine( |> angledLine(
angle = -bottomAng, angle = -bottomAng,
endAbsoluteY = -totalHeightHalf - armThick, endAbsoluteY = -totalHeightHalf - armThick,
tag = $seg02, tag = $seg02,
) )
|> xLine(length = endAbsolute = segEndX(seg03) + 0) |> xLine(length = endAbsolute = segEndX(seg03) + 0)
|> yLine(length = -segLen(seg01, %)) |> yLine(length = -segLen(seg01))
|> angledLineThatIntersects(angle = turns::HALF_TURN, offset = -armThick, intersectTag = seg02) |> angledLineThatIntersects(angle = turns::HALF_TURN, offset = -armThick, intersectTag = seg02)
|> angledLine(angle = segAng(seg02, %) + 180, endAbsoluteY = -baseHeight) |> angledLine(angle = segAng(seg02) + 180, endAbsoluteY = -baseHeight)
|> xLine(endAbsolute = turns::ZERO) |> xLine(endAbsolute = turns::ZERO)
|> close() |> close()
|> extrude(length = 4)` |> extrude(length = 4)`

View File

@ -1,7 +1,7 @@
import type { SaveSettingsPayload } from '@src/lib/settings/settingsTypes' import type { SaveSettingsPayload } from '@src/lib/settings/settingsTypes'
import { Themes } from '@src/lib/theme' import { Themes } from '@src/lib/theme'
import type { DeepPartial } from '@src/lib/types' import type { DeepPartial } from '@src/lib/types'
import { onboardingPaths } from '@src/routes/Onboarding/paths' import { ONBOARDING_SUBPATHS } from '@src/lib/onboardingPaths'
import type { Settings } from '@rust/kcl-lib/bindings/Settings' import type { Settings } from '@rust/kcl-lib/bindings/Settings'
@ -31,12 +31,15 @@ export const TEST_SETTINGS: DeepPartial<Settings> = {
export const TEST_SETTINGS_ONBOARDING_USER_MENU: DeepPartial<Settings> = { export const TEST_SETTINGS_ONBOARDING_USER_MENU: DeepPartial<Settings> = {
...TEST_SETTINGS, ...TEST_SETTINGS,
app: { ...TEST_SETTINGS.app, onboarding_status: onboardingPaths.USER_MENU }, app: {
...TEST_SETTINGS.app,
onboarding_status: ONBOARDING_SUBPATHS.USER_MENU,
},
} }
export const TEST_SETTINGS_ONBOARDING_EXPORT: DeepPartial<Settings> = { export const TEST_SETTINGS_ONBOARDING_EXPORT: DeepPartial<Settings> = {
...TEST_SETTINGS, ...TEST_SETTINGS,
app: { ...TEST_SETTINGS.app, onboarding_status: onboardingPaths.EXPORT }, app: { ...TEST_SETTINGS.app, onboarding_status: ONBOARDING_SUBPATHS.EXPORT },
} }
export const TEST_SETTINGS_ONBOARDING_PARAMETRIC_MODELING: DeepPartial<Settings> = export const TEST_SETTINGS_ONBOARDING_PARAMETRIC_MODELING: DeepPartial<Settings> =
@ -44,7 +47,7 @@ export const TEST_SETTINGS_ONBOARDING_PARAMETRIC_MODELING: DeepPartial<Settings>
...TEST_SETTINGS, ...TEST_SETTINGS,
app: { app: {
...TEST_SETTINGS.app, ...TEST_SETTINGS.app,
onboarding_status: onboardingPaths.PARAMETRIC_MODELING, onboarding_status: ONBOARDING_SUBPATHS.PARAMETRIC_MODELING,
}, },
} }

View File

@ -5,7 +5,7 @@ import type { BrowserContext, Locator, Page, TestInfo } from '@playwright/test'
import { expect } from '@playwright/test' import { expect } from '@playwright/test'
import type { EngineCommand } from '@src/lang/std/artifactGraph' import type { EngineCommand } from '@src/lang/std/artifactGraph'
import type { Configuration } from '@src/lang/wasm' import type { Configuration } from '@src/lang/wasm'
import { COOKIE_NAME } from '@src/lib/constants' import { COOKIE_NAME, IS_PLAYWRIGHT_KEY } from '@src/lib/constants'
import { reportRejection } from '@src/lib/trap' import { reportRejection } from '@src/lib/trap'
import type { DeepPartial } from '@src/lib/types' import type { DeepPartial } from '@src/lib/types'
import { isArray } from '@src/lib/utils' import { isArray } from '@src/lib/utils'
@ -19,7 +19,6 @@ import type { ProjectConfiguration } from '@rust/kcl-lib/bindings/ProjectConfigu
import { isErrorWhitelisted } from '@e2e/playwright/lib/console-error-whitelist' import { isErrorWhitelisted } from '@e2e/playwright/lib/console-error-whitelist'
import { secrets } from '@e2e/playwright/secrets' import { secrets } from '@e2e/playwright/secrets'
import { TEST_SETTINGS, TEST_SETTINGS_KEY } from '@e2e/playwright/storageStates' import { TEST_SETTINGS, TEST_SETTINGS_KEY } from '@e2e/playwright/storageStates'
import { IS_PLAYWRIGHT_KEY } from '@src/lib/constants'
import { test } from '@e2e/playwright/zoo-test' import { test } from '@e2e/playwright/zoo-test'
const toNormalizedCode = (text: string) => { const toNormalizedCode = (text: string) => {

View File

@ -781,7 +781,7 @@ profile001 = startProfile(sketch001, at = [56.37, 120.33])
interiorAbsolute = [360.16, 231.76], interiorAbsolute = [360.16, 231.76],
endAbsolute = [391.48, 131.54], endAbsolute = [391.48, 131.54],
) )
|> yLine(-131.54, %) |> yLine(length = -131.54)
|> arc(angleStart = 33.53, angleEnd = -141.07, radius = 126.46) |> arc(angleStart = 33.53, angleEnd = -141.07, radius = 126.46)
` `
) )

View File

@ -1130,7 +1130,7 @@ part001 = startSketchOn(XZ)
|> line(end = [-20.38, -10.12]) |> line(end = [-20.38, -10.12])
|> line(end = [-15.79, 17.08]) |> line(end = [-15.79, 17.08])
fn yohey(pos) { fn yohey(@pos) {
sketch004 = startSketchOn(XZ) sketch004 = startSketchOn(XZ)
${extrudeAndEditBlockedInFunction} ${extrudeAndEditBlockedInFunction}
|> line(end = [27.55, -1.65]) |> line(end = [27.55, -1.65])

View File

@ -11,4 +11,3 @@
6) src/lib/singletons.ts -> src/clientSideScene/sceneEntities.ts -> src/clientSideScene/segments.ts -> src/components/Toolbar/angleLengthInfo.ts 6) src/lib/singletons.ts -> src/clientSideScene/sceneEntities.ts -> src/clientSideScene/segments.ts -> src/components/Toolbar/angleLengthInfo.ts
7) src/lib/singletons.ts -> src/clientSideScene/sceneEntities.ts -> src/clientSideScene/segments.ts 7) src/lib/singletons.ts -> src/clientSideScene/sceneEntities.ts -> src/clientSideScene/segments.ts
8) src/hooks/useModelingContext.ts -> src/components/ModelingMachineProvider.tsx -> src/components/Toolbar/Intersect.tsx -> src/components/SetHorVertDistanceModal.tsx -> src/lib/useCalculateKclExpression.ts 8) src/hooks/useModelingContext.ts -> src/components/ModelingMachineProvider.tsx -> src/components/Toolbar/Intersect.tsx -> src/components/SetHorVertDistanceModal.tsx -> src/lib/useCalculateKclExpression.ts
9) src/routes/Onboarding/index.tsx -> src/routes/Onboarding/Camera.tsx -> src/routes/Onboarding/utils.tsx

1
package-lock.json generated
View File

@ -14664,6 +14664,7 @@
"version": "0.1.0", "version": "0.1.0",
"resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz",
"integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==",
"dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=10" "node": ">=10"

View File

@ -14,37 +14,26 @@ f(1)
Program(ExpressionStatement(CallExpression(VariableName, Program(ExpressionStatement(CallExpression(VariableName,
ArgumentList(Number)))) ArgumentList(Number))))
# deprecated multiple anon args # unlabeled first arg and labeled arg
f(1, 2) line(sketch001, end = [thickness, 0])
==> ==>
Program(ExpressionStatement(CallExpression(VariableName, Program(ExpressionStatement(CallExpression(VariableName,
ArgumentList(Number, ArgumentList(VariableName,
Number)))) LabeledArgument(ArgumentLabel,
Equals,
ArrayExpression(VariableName,
Number))))))
# deprecated trailing % # % and labeled arg
startSketchOn('XY') startSketchOn(XY)
|> line([thickness, 0], %)
==>
Program(ExpressionStatement(PipeExpression(CallExpression(VariableName,
ArgumentList(String)),
PipeOperator,
CallExpression(VariableName,
ArgumentList(ArrayExpression(VariableName,
Number),
PipeSubstitution)))))
# % and named arg
startSketchOn('XY')
|> line(%, end = [thickness, 0]) |> line(%, end = [thickness, 0])
==> ==>
Program(ExpressionStatement(PipeExpression(CallExpression(VariableName, Program(ExpressionStatement(PipeExpression(CallExpression(VariableName,
ArgumentList(String)), ArgumentList(VariableName)),
PipeOperator, PipeOperator,
CallExpression(VariableName, CallExpression(VariableName,
ArgumentList(PipeSubstitution, ArgumentList(PipeSubstitution,
@ -53,14 +42,14 @@ Program(ExpressionStatement(PipeExpression(CallExpression(VariableName,
ArrayExpression(VariableName, ArrayExpression(VariableName,
Number))))))) Number)))))))
# implied % and named arg # implied % and labeled arg
startSketchOn('XY') startSketchOn(XY)
|> line(end = [thickness, 0]) |> line(end = [thickness, 0])
==> ==>
Program(ExpressionStatement(PipeExpression(CallExpression(VariableName, Program(ExpressionStatement(PipeExpression(CallExpression(VariableName,
ArgumentList(String)), ArgumentList(VariableName)),
PipeOperator, PipeOperator,
CallExpression(VariableName, CallExpression(VariableName,
ArgumentList(LabeledArgument(ArgumentLabel, ArgumentList(LabeledArgument(ArgumentLabel,
@ -68,7 +57,7 @@ Program(ExpressionStatement(PipeExpression(CallExpression(VariableName,
ArrayExpression(VariableName, ArrayExpression(VariableName,
Number))))))) Number)))))))
# multiple named arg # multiple labeled arg
ngon(plane = "XY", numSides = 5, radius = pentR) ngon(plane = "XY", numSides = 5, radius = pentR)

View File

@ -125,8 +125,8 @@ fn armRestProfile(@plane, offset) {
} }
export fn armRest(@plane, offset) { export fn armRest(@plane, offset) {
path = armRestPath( offsetPlane(plane, offset = offset)) path = armRestPath(offsetPlane(plane, offset = offset))
profile = armRestProfile( offsetPlane(-XZ, offset = 20), offset = -offset) profile = armRestProfile(offsetPlane(-XZ, offset = 20), offset = -offset)
sweep(profile, path = path) sweep(profile, path = path)
return 0 return 0
} }

View File

@ -28,7 +28,7 @@ fn slot(sketch1, start, end, width) {
if end[0] < start[0] { if end[0] < start[0] {
units::toDegrees(atan((end[1] - start[1]) / (end[0] - start[0]))) + 180 units::toDegrees(atan((end[1] - start[1]) / (end[0] - start[0]))) + 180
} else { } else {
units::toDegrees( atan((end[1] - start[1]) / (end[0] - start[0]))) units::toDegrees(atan((end[1] - start[1]) / (end[0] - start[0])))
} }
} }
dist = sqrt(pow(end[1] - start[1], exp = 2) + pow(end[0] - start[0], exp = 2)) dist = sqrt(pow(end[1] - start[1], exp = 2) + pow(end[0] - start[0], exp = 2))

View File

@ -28,7 +28,7 @@ rs = map(
angles = map( angles = map(
rs, rs,
f = fn(r) { f = fn(r) {
return units::toDegrees( acos(baseDiameter / 2 / r)) return units::toDegrees(acos(baseDiameter / 2 / r))
}, },
) )

View File

@ -52,7 +52,7 @@ armPartB = armFn(plane = XZ, offset = armLength, altitude = hingeHeight * 2.5 +
// Add a function to create the mirror // Add a function to create the mirror
fn mirrorFn(plane, offsetX, offsetY, altitude, radius, tiefe, gestellR, gestellD) { fn mirrorFn(plane, offsetX, offsetY, altitude, radius, tiefe, gestellR, gestellD) {
armPlane = startSketchOn( offsetPlane(plane, offset = offsetY - (tiefe / 2))) armPlane = startSketchOn(offsetPlane(plane, offset = offsetY - (tiefe / 2)))
armBody = circle(armPlane, center = [offsetX, altitude], radius = radius) armBody = circle(armPlane, center = [offsetX, altitude], radius = radius)
|> extrude(length = tiefe) |> extrude(length = tiefe)

20
rust/Cargo.lock generated
View File

@ -1815,7 +1815,7 @@ dependencies = [
[[package]] [[package]]
name = "kcl-bumper" name = "kcl-bumper"
version = "0.1.65" version = "0.1.66"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"clap", "clap",
@ -1826,7 +1826,7 @@ dependencies = [
[[package]] [[package]]
name = "kcl-derive-docs" name = "kcl-derive-docs"
version = "0.1.65" version = "0.1.66"
dependencies = [ dependencies = [
"Inflector", "Inflector",
"anyhow", "anyhow",
@ -1845,7 +1845,7 @@ dependencies = [
[[package]] [[package]]
name = "kcl-directory-test-macro" name = "kcl-directory-test-macro"
version = "0.1.65" version = "0.1.66"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -1854,7 +1854,7 @@ dependencies = [
[[package]] [[package]]
name = "kcl-language-server" name = "kcl-language-server"
version = "0.2.65" version = "0.2.66"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"clap", "clap",
@ -1875,7 +1875,7 @@ dependencies = [
[[package]] [[package]]
name = "kcl-language-server-release" name = "kcl-language-server-release"
version = "0.1.65" version = "0.1.66"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"clap", "clap",
@ -1895,7 +1895,7 @@ dependencies = [
[[package]] [[package]]
name = "kcl-lib" name = "kcl-lib"
version = "0.2.65" version = "0.2.66"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"approx 0.5.1", "approx 0.5.1",
@ -1969,7 +1969,7 @@ dependencies = [
[[package]] [[package]]
name = "kcl-python-bindings" name = "kcl-python-bindings"
version = "0.3.65" version = "0.3.66"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"kcl-lib", "kcl-lib",
@ -1984,7 +1984,7 @@ dependencies = [
[[package]] [[package]]
name = "kcl-test-server" name = "kcl-test-server"
version = "0.1.65" version = "0.1.66"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"hyper 0.14.32", "hyper 0.14.32",
@ -1997,7 +1997,7 @@ dependencies = [
[[package]] [[package]]
name = "kcl-to-core" name = "kcl-to-core"
version = "0.1.65" version = "0.1.66"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"async-trait", "async-trait",
@ -2011,7 +2011,7 @@ dependencies = [
[[package]] [[package]]
name = "kcl-wasm-lib" name = "kcl-wasm-lib"
version = "0.1.65" version = "0.1.66"
dependencies = [ dependencies = [
"bson", "bson",
"console_error_panic_hook", "console_error_panic_hook",

View File

@ -58,6 +58,7 @@ bump-kcl-crate-versions bump='patch':
# First build the kcl-bumper tool. # First build the kcl-bumper tool.
cargo build -p kcl-bumper cargo build -p kcl-bumper
./target/debug/kcl-bumper --bump {{bump}} ./target/debug/kcl-bumper --bump {{bump}}
cargo check -p kcl-bumper # this way Cargo.lock gets updated
publish-kcl version: publish-kcl version:
git tag kcl-{{version}} -m "Release kcl-{{version}}" git tag kcl-{{version}} -m "Release kcl-{{version}}"

View File

@ -1,7 +1,7 @@
[package] [package]
name = "kcl-bumper" name = "kcl-bumper"
version = "0.1.65" version = "0.1.66"
edition = "2021" edition = "2021"
repository = "https://github.com/KittyCAD/modeling-api" repository = "https://github.com/KittyCAD/modeling-api"
rust-version = "1.76" rust-version = "1.76"

View File

@ -1,7 +1,7 @@
[package] [package]
name = "kcl-derive-docs" name = "kcl-derive-docs"
description = "A tool for generating documentation from Rust derive macros" description = "A tool for generating documentation from Rust derive macros"
version = "0.1.65" version = "0.1.66"
edition = "2021" edition = "2021"
license = "MIT" license = "MIT"
repository = "https://github.com/KittyCAD/modeling-app" repository = "https://github.com/KittyCAD/modeling-app"

View File

@ -1,7 +1,7 @@
[package] [package]
name = "kcl-directory-test-macro" name = "kcl-directory-test-macro"
description = "A tool for generating tests from a directory of kcl files" description = "A tool for generating tests from a directory of kcl files"
version = "0.1.65" version = "0.1.66"
edition = "2021" edition = "2021"
license = "MIT" license = "MIT"
repository = "https://github.com/KittyCAD/modeling-app" repository = "https://github.com/KittyCAD/modeling-app"

View File

@ -1,6 +1,6 @@
[package] [package]
name = "kcl-language-server-release" name = "kcl-language-server-release"
version = "0.1.65" version = "0.1.66"
edition = "2021" edition = "2021"
authors = ["KittyCAD Inc <kcl@kittycad.io>"] authors = ["KittyCAD Inc <kcl@kittycad.io>"]
publish = false publish = false

View File

@ -2,7 +2,7 @@
name = "kcl-language-server" name = "kcl-language-server"
description = "A language server for KCL." description = "A language server for KCL."
authors = ["KittyCAD Inc <kcl@kittycad.io>"] authors = ["KittyCAD Inc <kcl@kittycad.io>"]
version = "0.2.65" version = "0.2.66"
edition = "2021" edition = "2021"
license = "MIT" license = "MIT"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@ -1,7 +1,7 @@
[package] [package]
name = "kcl-lib" name = "kcl-lib"
description = "KittyCAD Language implementation and tools" description = "KittyCAD Language implementation and tools"
version = "0.2.65" version = "0.2.66"
edition = "2021" edition = "2021"
license = "MIT" license = "MIT"
repository = "https://github.com/KittyCAD/modeling-app" repository = "https://github.com/KittyCAD/modeling-app"

View File

@ -474,3 +474,79 @@ extrude(profile001, length = 100)
result.first().unwrap(); result.first().unwrap();
result.last().unwrap(); result.last().unwrap();
} }
#[cfg(feature = "artifact-graph")]
#[tokio::test(flavor = "multi_thread")]
async fn kcl_test_cache_multi_file_other_file_only_change() {
let code = r#"import "toBeImported.kcl" as importedCube
importedCube
sketch001 = startSketchOn(XZ)
profile001 = startProfile(sketch001, at = [-134.53, -56.17])
|> angledLine(angle = 0, length = 79.05, tag = $rectangleSegmentA001)
|> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 76.28)
|> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001), tag = $seg01)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)], tag = $seg02)
|> close()
extrude001 = extrude(profile001, length = 100)
sketch003 = startSketchOn(extrude001, face = seg02)
sketch002 = startSketchOn(extrude001, face = seg01)
"#;
let other_file = (
std::path::PathBuf::from("toBeImported.kcl"),
r#"sketch001 = startSketchOn(XZ)
profile001 = startProfile(sketch001, at = [281.54, 305.81])
|> angledLine(angle = 0, length = 123.43, tag = $rectangleSegmentA001)
|> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 85.99)
|> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001))
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
extrude(profile001, length = 100)
"#
.to_string(),
);
let other_file2 = (
std::path::PathBuf::from("toBeImported.kcl"),
r#"sketch001 = startSketchOn(XZ)
profile001 = startProfile(sketch001, at = [281.54, 305.81])
|> angledLine(angle = 0, length = 123.43, tag = $rectangleSegmentA001)
|> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 85.99)
|> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001))
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
extrude(profile001, length = 100)
|> translate(z = 100)
"#
.to_string(),
);
let result = cache_test(
"multi_file_other_file_only_change",
vec![
Variation {
code,
other_files: vec![other_file],
settings: &Default::default(),
},
Variation {
code,
other_files: vec![other_file2],
settings: &Default::default(),
},
],
)
.await;
let r1 = result.first().unwrap();
let r2 = result.last().unwrap();
assert!(r1.1 != r2.1, "The images should be different");
// Make sure the outcomes are different.
assert!(
r1.2.artifact_graph != r2.2.artifact_graph,
"The outcomes artifact graphs should be different"
);
}

View File

@ -5,4 +5,4 @@ part001 = startSketchOn(XY)
|> line(end = [0, -10], tag = $thing2) |> line(end = [0, -10], tag = $thing2)
|> close(tag = $thing3) |> close(tag = $thing3)
|> extrude(length = 10) |> extrude(length = 10)
|> fillet(radius = 2, tags = [getNextAdjacentEdge(thing3)], %) |> fillet(radius = 2, tags = [getNextAdjacentEdge(thing3)])

View File

@ -1,9 +0,0 @@
part001 = startSketchOn(XY)
|> startProfile(at = [0, 0])
|> line(end = [1, 3.82], tag = $seg01)
|> angled(
angle = -angleToMatchLengthX(seg01, 3, %),
endAbsoluteX = 3,
)
|> close()
|> extrude(length = 10)

View File

@ -1,9 +0,0 @@
part001 = startSketchOn(XY)
|> startProfile(at = [0, 0])
|> line(end = [1, 3.82], tag = $seg01)
|> angledLine(
angle = -angleToMatchLengthY(seg01, 3, %),
endAbsoluteX = 3,
)
|> close()
|> extrude(length = 10)

View File

@ -32,13 +32,13 @@ bracket = startSketchOn(XY)
|> fillet( |> fillet(
radius = filletR, radius = filletR,
tags = [ tags = [
getPreviousAdjacentEdge('innerEdge', %) getPreviousAdjacentEdge('innerEdge')
] ]
) )
|> fillet( |> fillet(
radius = filletR + thickness, radius = filletR + thickness,
tags = [ tags = [
getPreviousAdjacentEdge('outerEdge', %) getPreviousAdjacentEdge('outerEdge')
] ]
) )

View File

@ -24,18 +24,18 @@ connectorPadding = 4
miniHdmiHole = startSketchOn(XY) miniHdmiHole = startSketchOn(XY)
|> startProfile(at = [0, border + miniHdmiDistance - (miniHdmiWidth / 2)]) |> startProfile(at = [0, border + miniHdmiDistance - (miniHdmiWidth / 2)])
|> lineTo([ |> line(endAbsolute = [
0, 0,
border + miniHdmiDistance + miniHdmiWidth / 2 border + miniHdmiDistance + miniHdmiWidth / 2
], %) ])
|> lineTo([ |> line(endAbsolute = [
1, 1,
border + miniHdmiDistance + miniHdmiWidth / 2 border + miniHdmiDistance + miniHdmiWidth / 2
], %) ])
|> lineTo([ |> line(endAbsolute = [
1, 1,
border + miniHdmiDistance - (miniHdmiWidth / 2) border + miniHdmiDistance - (miniHdmiWidth / 2)
], %) ])
|> close() |> close()
case = startSketchOn(XY) case = startSketchOn(XY)

View File

@ -1,20 +1,20 @@
svg = startSketchOn(XY) svg = startSketchOn(XY)
|> lineTo([0],%) |> line(endAbsolute = [0])
|> lineTo([0 + 1],%) |> line(endAbsolute = [0 + 1])
|> lineTo([0 + 1 + 2],%) |> line(endAbsolute = [0 + 1 + 2])
|> lineTo([0 + 1 + 2 + 3],%) |> line(endAbsolute = [0 + 1 + 2 + 3])
|> lineTo([0 + 1 + 2 + 3 + 4],%) |> line(endAbsolute = [0 + 1 + 2 + 3 + 4])
|> lineTo([0 + 1 + 2 + 3 + 4 + 5],%) |> line(endAbsolute = [0 + 1 + 2 + 3 + 4 + 5])
|> lineTo([0 + 1 + 2 + 3 + 4 + 5 + 6],%) |> line(endAbsolute = [0 + 1 + 2 + 3 + 4 + 5 + 6])
|> lineTo([0 + 1 + 2 + 3 + 4 + 5 + 6 + 7],%) |> line(endAbsolute = [0 + 1 + 2 + 3 + 4 + 5 + 6 + 7])
|> lineTo([0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8],%) |> line(endAbsolute = [0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8])
|> lineTo([0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9],%) |> line(endAbsolute = [0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9])
|> lineTo([0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10],%) |> line(endAbsolute = [0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10])
|> lineTo([0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11],%) |> line(endAbsolute = [0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11])
|> lineTo([0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12],%) |> line(endAbsolute = [0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12])
|> lineTo([0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13],%) |> line(endAbsolute = [0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13])
|> lineTo([0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14],%) |> line(endAbsolute = [0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14])
|> lineTo([0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15],%) |> line(endAbsolute = [0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15])
|> lineTo([0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16],%) |> line(endAbsolute = [0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16])
|> lineTo([0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17],%) |> line(endAbsolute = [0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17])
|> lineTo([0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18],%) |> line(endAbsolute = [0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18])

View File

@ -37,6 +37,6 @@ plumbus0 =
|> fillet( |> fillet(
radius = 5, radius = 5,
tags = [c2.tags.arc_tag, getOppositeEdge(c2.tags.arc_tag)] tags = [c2.tags.arc_tag, getOppositeEdge(c2.tags.arc_tag)]
, %) )

View File

@ -21,10 +21,10 @@ sketch001 = startSketchOn(XZ)
|> xLine(endAbsolute = slateWidthHalf + templateThickness, tag = $seg04) |> xLine(endAbsolute = slateWidthHalf + templateThickness, tag = $seg04)
|> yLine(length = -length002, tag = $seg03) |> yLine(length = -length002, tag = $seg03)
|> xLine(endAbsolute = 0, tag = $seg02) |> xLine(endAbsolute = 0, tag = $seg02)
|> xLine(length = -segLen(seg02, %)) |> xLine(length = -segLen(seg02))
|> yLine(length = segLen(seg03, %)) |> yLine(length = segLen(seg03))
|> xLine(length = segLen(seg04, %)) |> xLine(length = segLen(seg04))
|> yLine(length = segLen(seg05, %)) |> yLine(length = segLen(seg05))
|> arc( |> arc(
angleEnd = 90, angleEnd = 90,
angleStart = 180, angleStart = 180,
@ -36,16 +36,16 @@ extrude001 = extrude(sketch001, length = 5)
sketch002 = startSketchOn(extrude001, face = 'START') sketch002 = startSketchOn(extrude001, face = 'START')
|> startProfile(at = [-slateWidthHalf, -templateGap * 2 - (templateDiameter / 2)]) |> startProfile(at = [-slateWidthHalf, -templateGap * 2 - (templateDiameter / 2)])
|> xLine(length = -7, tag = $rectangleSegmentA001) |> xLine(length = -7, tag = $rectangleSegmentA001)
|> angledLine(angle = segAng(rectangleSegmentA001, %) + 90, length = minClampingDistance, tag = $rectangleSegmentB001) |> angledLine(angle = segAng(rectangleSegmentA001) + 90, length = minClampingDistance, tag = $rectangleSegmentB001)
|> angledLine(angle = segAng(rectangleSegmentA001, %), length = -segLen(rectangleSegmentA001, %), tag = $rectangleSegmentC001) |> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001), tag = $rectangleSegmentC001)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()
extrude002 = extrude(sketch002, length = 7.5) extrude002 = extrude(sketch002, length = 7.5)
sketch003 = startSketchOn(extrude001, face = 'START') sketch003 = startSketchOn(extrude001, face = 'START')
|> startProfile(at = [slateWidthHalf, -templateGap * 2 - (templateDiameter / 2)]) |> startProfile(at = [slateWidthHalf, -templateGap * 2 - (templateDiameter / 2)])
|> xLine(length = 7, tag = $rectangleSegmentA002) |> xLine(length = 7, tag = $rectangleSegmentA002)
|> angledLine(angle = segAng(rectangleSegmentA002, %) - 90, length = minClampingDistance) |> angledLine(angle = segAng(rectangleSegmentA002) - 90, length = minClampingDistance)
|> angledLine(angle = segAng(rectangleSegmentA002, %), length = -segLen(rectangleSegmentA002, %)) |> angledLine(angle = segAng(rectangleSegmentA002), length = -segLen(rectangleSegmentA002))
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()
extrude003 = extrude(sketch003, length = 7.5) extrude003 = extrude(sketch003, length = 7.5)

View File

@ -31,22 +31,22 @@ fn caster(@originStart) {
|> subtract2d(tool = circle(center = [ |> subtract2d(tool = circle(center = [
(3.543 - 2.756) / 2, (3.543 - 2.756) / 2,
(3.543 - 2.756) / 2 (3.543 - 2.756) / 2
], radius = 8.8 / 2 / 25.4), %) ], radius = 8.8 / 2 / 25.4))
|> subtract2d(tool = circle(center = [ |> subtract2d(tool = circle(center = [
(3.543 - 2.756) / 2 + 2.756, (3.543 - 2.756) / 2 + 2.756,
(3.543 - 2.756) / 2 (3.543 - 2.756) / 2
], radius = 8.8 / 2 / 25.4 ), %) ], radius = 8.8 / 2 / 25.4 ))
|> subtract2d(tool = circle(center = [ |> subtract2d(tool = circle(center = [
(3.543 - 2.756) / 2, (3.543 - 2.756) / 2,
(3.543 - 2.756) / 2 + 2.756 (3.543 - 2.756) / 2 + 2.756
], radius = 8.8 / 2 / 25.4 ), %) ], radius = 8.8 / 2 / 25.4 ))
|> subtract2d(tool = circle(center = [ |> subtract2d(tool = circle(center = [
(3.543 - 2.756) / 2 + 2.756, (3.543 - 2.756) / 2 + 2.756,
(3.543 - 2.756) / 2 + 2.756 (3.543 - 2.756) / 2 + 2.756
], radius = 8.8 / 2 / 25.4 ), %) ], radius = 8.8 / 2 / 25.4 ))
|> extrude(length = -.25) |> extrude(length = -.25)
sketch002c = startSketchOn(sketch001c, face = 'START') sketch002c = startSketchOn(sketch001c, face = START)
|> startProfile(at = [-originStart[0], 2.2 + originStart[1]]) |> startProfile(at = [-originStart[0], 2.2 + originStart[1]])
|> arc( |> arc(
angle_start = 30, angle_start = 30,
@ -460,10 +460,10 @@ sketch007 = startSketchOn(plane003)
|> line(end = [-width + 1, -depth + serverDepth + 3.8]) |> line(end = [-width + 1, -depth + serverDepth + 3.8])
|> line(end = [1, 0]) |> line(end = [1, 0])
|> line(end = [0, -.75]) |> line(end = [0, -.75])
|> line([ |> line(end = [
width - 2, width - 2,
depth - serverDepth - 5 + .6 depth - serverDepth - 5 + .6
], %) ])
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()
extrude007 = extrude(sketch007, length = 1) extrude007 = extrude(sketch007, length = 1)
@ -501,10 +501,10 @@ sketch007t = startSketchOn(plane004)
|> line(end = [-width + 1, -depth + serverDepth + 3.8]) |> line(end = [-width + 1, -depth + serverDepth + 3.8])
|> line(end = [1, 0]) |> line(end = [1, 0])
|> line(end = [0, -.75]) |> line(end = [0, -.75])
|> line([ |> line(end = [
width - 2, width - 2,
depth - serverDepth - 5 + .6 depth - serverDepth - 5 + .6
], %) ])
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()
extrude007t = extrude(sketch007t, length = -1) extrude007t = extrude(sketch007t, length = -1)
@ -584,7 +584,7 @@ sketch003fl = startSketchOn(planeXYfl)
extrude003fl = extrude(sketch003fl, length = railHeight * 1.75) extrude003fl = extrude(sketch003fl, length = railHeight * 1.75)
// EIA-310-D standard hole pattern // EIA-310-D standard hole pattern
sketch004fl = startSketchOn(extrude002fl, face = 'START') sketch004fl = startSketchOn(extrude002fl, face = START)
|> startProfile(at = [0.72 + originStart[1], originStart[2] + 0.15]) |> startProfile(at = [0.72 + originStart[1], originStart[2] + 0.15])
|> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA003fl) |> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA003fl)
|> angledLine(angle = segAng(rectangleSegmentA003fl) - 90, length = 0.375, tag = $rectangleSegmentB003fl) |> angledLine(angle = segAng(rectangleSegmentA003fl) - 90, length = 0.375, tag = $rectangleSegmentB003fl)
@ -599,7 +599,7 @@ sketch004fl = startSketchOn(extrude002fl, face = 'START')
extrude004fl = extrude(sketch004fl, length = -thickness) extrude004fl = extrude(sketch004fl, length = -thickness)
// EIA-310-D standard hole pattern // EIA-310-D standard hole pattern
sketch005fl = startSketchOn(extrude002fl, face = 'START') sketch005fl = startSketchOn(extrude002fl, face = START)
|> startProfile(at = [0.72 + originStart[1],originStart[2] + 0.15 + .62]) |> startProfile(at = [0.72 + originStart[1],originStart[2] + 0.15 + .62])
|> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA004fl) |> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA004fl)
|> angledLine(angle = segAng(rectangleSegmentA004fl) - 90, length = 0.375, tag = $rectangleSegmentB004fl) |> angledLine(angle = segAng(rectangleSegmentA004fl) - 90, length = 0.375, tag = $rectangleSegmentB004fl)
@ -614,7 +614,7 @@ sketch005fl = startSketchOn(extrude002fl, face = 'START')
extrude005fl = extrude(sketch005fl, length = -thickness) extrude005fl = extrude(sketch005fl, length = -thickness)
// EIA-310-D standard hole pattern // EIA-310-D standard hole pattern
sketch006fl = startSketchOn(extrude002fl, face = 'START') sketch006fl = startSketchOn(extrude002fl, face = START)
|> startProfile(at = [0.72 + originStart[1], originStart[2] + 0.15 + 0.62 + 0.50]) |> startProfile(at = [0.72 + originStart[1], originStart[2] + 0.15 + 0.62 + 0.50])
|> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA005fl) |> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA005fl)
|> angledLine(angle = segAng(rectangleSegmentA005fl) - 90, length = 0.375, tag = $rectangleSegmentB005fl) |> angledLine(angle = segAng(rectangleSegmentA005fl) - 90, length = 0.375, tag = $rectangleSegmentB005fl)
@ -629,7 +629,7 @@ sketch006fl = startSketchOn(extrude002fl, face = 'START')
extrude006fl = extrude(sketch006fl, length = -thickness) extrude006fl = extrude(sketch006fl, length = -thickness)
// EIA-310-D standard hole pattern // EIA-310-D standard hole pattern
sketch007fl = startSketchOn(extrude001fl, face = 'START') sketch007fl = startSketchOn(extrude001fl, face = START)
|> startProfile(at = [-1.45 - originStart[0], originStart[2] + 0.15]) |> startProfile(at = [-1.45 - originStart[0], originStart[2] + 0.15])
|> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA006fl) |> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA006fl)
|> angledLine(angle = segAng(rectangleSegmentA006fl) - 90, length = 0.375, tag = $rectangleSegmentB006fl) |> angledLine(angle = segAng(rectangleSegmentA006fl) - 90, length = 0.375, tag = $rectangleSegmentB006fl)
@ -644,7 +644,7 @@ sketch007fl = startSketchOn(extrude001fl, face = 'START')
extrude007fl = extrude(sketch007fl, length = -thickness) extrude007fl = extrude(sketch007fl, length = -thickness)
// EIA-310-D standard hole pattern // EIA-310-D standard hole pattern
sketch008fl = startSketchOn(extrude001fl, face = 'START') sketch008fl = startSketchOn(extrude001fl, face = START)
|> startProfile(at = [-1.45 - originStart[0],originStart[2] + 0.15 + 0.62]) |> startProfile(at = [-1.45 - originStart[0],originStart[2] + 0.15 + 0.62])
|> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA007fl) |> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA007fl)
|> angledLine(angle = segAng(rectangleSegmentA007fl) - 90, length = 0.375, tag = $rectangleSegmentB007fl) |> angledLine(angle = segAng(rectangleSegmentA007fl) - 90, length = 0.375, tag = $rectangleSegmentB007fl)
@ -659,7 +659,7 @@ sketch008fl = startSketchOn(extrude001fl, face = 'START')
extrude008fl = extrude(sketch008fl, length = -thickness) extrude008fl = extrude(sketch008fl, length = -thickness)
// EIA-310-D standard hole pattern // EIA-310-D standard hole pattern
sketch009fl = startSketchOn(extrude001fl, face = 'START') sketch009fl = startSketchOn(extrude001fl, face = START)
|> startProfile(at = [-1.45 - originStart[0], originStart[2] + 0.15 + 0.62 + 0.5]) |> startProfile(at = [-1.45 - originStart[0], originStart[2] + 0.15 + 0.62 + 0.5])
|> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA008fl) |> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA008fl)
|> angledLine(angle = segAng(rectangleSegmentA008fl) - 90, length = 0.375, tag = $rectangleSegmentB008fl) |> angledLine(angle = segAng(rectangleSegmentA008fl) - 90, length = 0.375, tag = $rectangleSegmentB008fl)
@ -674,7 +674,7 @@ sketch009fl = startSketchOn(extrude001fl, face = 'START')
extrude009fl = extrude(sketch009fl, length = -thickness) extrude009fl = extrude(sketch009fl, length = -thickness)
// define slots // define slots
sketch010fl = startSketchOn(extrude001fl, face = 'START') sketch010fl = startSketchOn(extrude001fl, face = START)
|> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0], originStart[2] + .81 - (.438 / 2)]) |> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0], originStart[2] + .81 - (.438 / 2)])
|> xLine(length = 0.75 - .438) |> xLine(length = 0.75 - .438)
|> tangentialArc(endAbsolute = [-0.66 - originStart[0],originStart[2] + .81 + .438 / 2]) |> tangentialArc(endAbsolute = [-0.66 - originStart[0],originStart[2] + .81 + .438 / 2])
@ -689,7 +689,7 @@ sketch010fl = startSketchOn(extrude001fl, face = 'START')
extrude010fl = extrude(sketch010fl, length = -thickness) extrude010fl = extrude(sketch010fl, length = -thickness)
// define slots // define slots
sketch011fl = startSketchOn(extrude001fl, face = 'START') sketch011fl = startSketchOn(extrude001fl, face = START)
|> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0], originStart[2] + railHeight * 1.75 / 2 + .438 / 2]) |> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0], originStart[2] + railHeight * 1.75 / 2 + .438 / 2])
|> xLine(length = 0.75 - .438) |> xLine(length = 0.75 - .438)
|> tangentialArc(endAbsolute = [ |> tangentialArc(endAbsolute = [
@ -703,7 +703,7 @@ sketch011fl = startSketchOn(extrude001fl, face = 'START')
extrude011fl = extrude(sketch011fl, length = -thickness) extrude011fl = extrude(sketch011fl, length = -thickness)
// define slots // define slots
sketch012fl = startSketchOn(extrude001fl, face = 'START') sketch012fl = startSketchOn(extrude001fl, face = START)
|> startProfile(at = [ |> startProfile(at = [
-1.12 + (.75 - .438) / 2 - originStart[0], originStart[2] + -1.12 + (.75 - .438) / 2 - originStart[0], originStart[2] +
railHeight * 1.75 - .81 + .438 / 2 railHeight * 1.75 - .81 + .438 / 2
@ -786,7 +786,7 @@ sketch003fr = startSketchOn(planeXYfr)
extrude003fr = extrude(sketch003fr, length = railHeight * 1.75) extrude003fr = extrude(sketch003fr, length = railHeight * 1.75)
// EIA-310-D standard hole pattern // EIA-310-D standard hole pattern
sketch004fr = startSketchOn(extrude002fr, face = 'START') sketch004fr = startSketchOn(extrude002fr, face = START)
|> startProfile(at = [-0.35 + originStart[1] + width - 2, originStart[2] + 0.15]) |> startProfile(at = [-0.35 + originStart[1] + width - 2, originStart[2] + 0.15])
|> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA003fr) |> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA003fr)
|> angledLine(angle = segAng(rectangleSegmentA003fr) - 90, length = 0.375, tag = $rectangleSegmentB003fr) |> angledLine(angle = segAng(rectangleSegmentA003fr) - 90, length = 0.375, tag = $rectangleSegmentB003fr)
@ -801,7 +801,7 @@ sketch004fr = startSketchOn(extrude002fr, face = 'START')
extrude004fr = extrude(sketch004fr, length = -thickness) extrude004fr = extrude(sketch004fr, length = -thickness)
// EIA-310-D standard hole pattern // EIA-310-D standard hole pattern
sketch005fr = startSketchOn(extrude002fr, face = 'START') sketch005fr = startSketchOn(extrude002fr, face = START)
|> startProfile(at = [-0.35 + originStart[1] + width - 2, originStart[2] + 0.15 + .62]) |> startProfile(at = [-0.35 + originStart[1] + width - 2, originStart[2] + 0.15 + .62])
|> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA004fr) |> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA004fr)
|> angledLine(angle = segAng(rectangleSegmentA004fr) - 90, length = 0.375, tag = $rectangleSegmentB004fr) |> angledLine(angle = segAng(rectangleSegmentA004fr) - 90, length = 0.375, tag = $rectangleSegmentB004fr)
@ -816,7 +816,7 @@ sketch005fr = startSketchOn(extrude002fr, face = 'START')
extrude005fr = extrude(sketch005fr, length = -thickness) extrude005fr = extrude(sketch005fr, length = -thickness)
// EIA-310-D standard hole pattern // EIA-310-D standard hole pattern
sketch006fr = startSketchOn(extrude002fr, face = 'START') sketch006fr = startSketchOn(extrude002fr, face = START)
|> startProfile(at = [-0.35 + originStart[1] + width - 2, originStart[2] + 0.15 + 0.62 + 0.50]) |> startProfile(at = [-0.35 + originStart[1] + width - 2, originStart[2] + 0.15 + 0.62 + 0.50])
|> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA005fr) |> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA005fr)
|> angledLine(angle = segAng(rectangleSegmentA005fr) - 90, length = 0.375, tag = $rectangleSegmentB005fr) |> angledLine(angle = segAng(rectangleSegmentA005fr) - 90, length = 0.375, tag = $rectangleSegmentB005fr)
@ -831,7 +831,7 @@ sketch006fr = startSketchOn(extrude002fr, face = 'START')
extrude006fr = extrude(sketch006fr, length = -thickness) extrude006fr = extrude(sketch006fr, length = -thickness)
// EIA-310-D standard hole pattern // EIA-310-D standard hole pattern
sketch007fr = startSketchOn(extrude001fr, face = 'START') sketch007fr = startSketchOn(extrude001fr, face = START)
|> startProfile(at = [-1.45 - originStart[0], originStart[2] + 0.15]) |> startProfile(at = [-1.45 - originStart[0], originStart[2] + 0.15])
|> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA006fr) |> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA006fr)
|> angledLine(angle = segAng(rectangleSegmentA006fr) - 90, length = 0.375, tag = $rectangleSegmentB006fr) |> angledLine(angle = segAng(rectangleSegmentA006fr) - 90, length = 0.375, tag = $rectangleSegmentB006fr)
@ -846,7 +846,7 @@ sketch007fr = startSketchOn(extrude001fr, face = 'START')
extrude007fr = extrude(sketch007fr, length = -thickness) extrude007fr = extrude(sketch007fr, length = -thickness)
// EIA-310-D standard hole pattern // EIA-310-D standard hole pattern
sketch008fr = startSketchOn(extrude001fr, face = 'START') sketch008fr = startSketchOn(extrude001fr, face = START)
|> startProfile(at = [-1.45 - originStart[0], originStart[2] + 0.15 + 0.62]) |> startProfile(at = [-1.45 - originStart[0], originStart[2] + 0.15 + 0.62])
|> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA007fr) |> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA007fr)
|> angledLine(angle = segAng(rectangleSegmentA007fr) - 90, length = 0.375, tag = $rectangleSegmentB007fr) |> angledLine(angle = segAng(rectangleSegmentA007fr) - 90, length = 0.375, tag = $rectangleSegmentB007fr)
@ -861,7 +861,7 @@ sketch008fr = startSketchOn(extrude001fr, face = 'START')
extrude008fr = extrude(sketch008fr, length = -thickness) extrude008fr = extrude(sketch008fr, length = -thickness)
// EIA-310-D standard hole pattern // EIA-310-D standard hole pattern
sketch009fr = startSketchOn(extrude001fr, face = 'START') sketch009fr = startSketchOn(extrude001fr, face = START)
|> startProfile(at = [-1.45 - originStart[0], originStart[2] + 0.15 + 0.62 + 0.5]) |> startProfile(at = [-1.45 - originStart[0], originStart[2] + 0.15 + 0.62 + 0.5])
|> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA008fr) |> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA008fr)
|> angledLine(angle = segAng(rectangleSegmentA008fr) - 90, length = 0.375, tag = $rectangleSegmentB008fr) |> angledLine(angle = segAng(rectangleSegmentA008fr) - 90, length = 0.375, tag = $rectangleSegmentB008fr)
@ -876,7 +876,7 @@ sketch009fr = startSketchOn(extrude001fr, face = 'START')
extrude009fr = extrude(sketch009fr, length = -thickness) extrude009fr = extrude(sketch009fr, length = -thickness)
// define slots // define slots
sketch010fr = startSketchOn(extrude001fr, face = 'START') sketch010fr = startSketchOn(extrude001fr, face = START)
|> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0], originStart[2] + .81 - (.438 / 2)]) |> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0], originStart[2] + .81 - (.438 / 2)])
|> xLine(length = 0.75 - .438) |> xLine(length = 0.75 - .438)
|> tangentialArc(endAbsolute = [ |> tangentialArc(endAbsolute = [
@ -894,7 +894,7 @@ sketch010fr = startSketchOn(extrude001fr, face = 'START')
extrude010fr = extrude(sketch010fr, length = -thickness) extrude010fr = extrude(sketch010fr, length = -thickness)
// define slots // define slots
sketch011fr = startSketchOn(extrude001fr, face = 'START') sketch011fr = startSketchOn(extrude001fr, face = START)
|> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0], originStart[2] + railHeight * 1.75 / 2 + .438 / 2]) |> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0], originStart[2] + railHeight * 1.75 / 2 + .438 / 2])
|> xLine(length = 0.75 - .438) |> xLine(length = 0.75 - .438)
|> tangentialArc(endAbsolute = [ |> tangentialArc(endAbsolute = [
@ -908,7 +908,7 @@ sketch011fr = startSketchOn(extrude001fr, face = 'START')
extrude011fr = extrude(sketch011fr, length = -thickness) extrude011fr = extrude(sketch011fr, length = -thickness)
// define slots // define slots
sketch012fr = startSketchOn(extrude001fr, face = 'START') sketch012fr = startSketchOn(extrude001fr, face = START)
|> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0], originStart[2] + railHeight * 1.75 - .81 + .438 / 2]) |> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0], originStart[2] + railHeight * 1.75 - .81 + .438 / 2])
|> xLine(length = 0.75 - .438) |> xLine(length = 0.75 - .438)
|> tangentialArc(endAbsolute = [ |> tangentialArc(endAbsolute = [
@ -988,7 +988,7 @@ sketch003rr = startSketchOn(planeXYrr)
extrude003rr = extrude(sketch003rr, length = railHeight * 1.75) extrude003rr = extrude(sketch003rr, length = railHeight * 1.75)
// EIA-310-D standard hole pattern // EIA-310-D standard hole pattern
sketch004rr = startSketchOn(extrude002rr, face = 'START') sketch004rr = startSketchOn(extrude002rr, face = START)
|> startProfile(at = [-0.35 + originStart[1] + width - 2, originStart[2] + 0.15]) |> startProfile(at = [-0.35 + originStart[1] + width - 2, originStart[2] + 0.15])
|> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA003rr) |> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA003rr)
|> angledLine(angle = segAng(rectangleSegmentA003rr) - 90, length = 0.375, tag = $rectangleSegmentB003rr) |> angledLine(angle = segAng(rectangleSegmentA003rr) - 90, length = 0.375, tag = $rectangleSegmentB003rr)
@ -1003,7 +1003,7 @@ sketch004rr = startSketchOn(extrude002rr, face = 'START')
extrude004rr = extrude(sketch004rr, length = -thickness) extrude004rr = extrude(sketch004rr, length = -thickness)
// EIA-310-D standard hole pattern // EIA-310-D standard hole pattern
sketch005rr = startSketchOn(extrude002rr, face = 'START') sketch005rr = startSketchOn(extrude002rr, face = START)
|> startProfile(at = [-0.35 + originStart[1] + width - 2, originStart[2] + 0.15 + .62]) |> startProfile(at = [-0.35 + originStart[1] + width - 2, originStart[2] + 0.15 + .62])
|> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA004rr) |> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA004rr)
|> angledLine(angle = segAng(rectangleSegmentA004rr) - 90, length = 0.375, tag = $rectangleSegmentB004rr) |> angledLine(angle = segAng(rectangleSegmentA004rr) - 90, length = 0.375, tag = $rectangleSegmentB004rr)
@ -1018,7 +1018,7 @@ sketch005rr = startSketchOn(extrude002rr, face = 'START')
extrude005rr = extrude(sketch005rr, length = -thickness) extrude005rr = extrude(sketch005rr, length = -thickness)
// EIA-310-D standard hole pattern // EIA-310-D standard hole pattern
sketch006rr = startSketchOn(extrude002rr, face = 'START') sketch006rr = startSketchOn(extrude002rr, face = START)
|> startProfile(at = [-0.35 + originStart[1] + width - 2, originStart[2] + 0.15 + 0.62 + 0.50]) |> startProfile(at = [-0.35 + originStart[1] + width - 2, originStart[2] + 0.15 + 0.62 + 0.50])
|> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA005rr) |> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA005rr)
|> angledLine(angle = segAng(rectangleSegmentA005rr) - 90, length = 0.375, tag = $rectangleSegmentB005rr) |> angledLine(angle = segAng(rectangleSegmentA005rr) - 90, length = 0.375, tag = $rectangleSegmentB005rr)
@ -1033,7 +1033,7 @@ sketch006rr = startSketchOn(extrude002rr, face = 'START')
extrude006rr = extrude(sketch006rr, length = -thickness) extrude006rr = extrude(sketch006rr, length = -thickness)
// EIA-310-D standard hole pattern // EIA-310-D standard hole pattern
sketch007rr = startSketchOn(extrude001rr, face = 'START') sketch007rr = startSketchOn(extrude001rr, face = START)
|> startProfile(at = [-originStart[0]-serverDepth+1.7, originStart[2] + 0.15]) |> startProfile(at = [-originStart[0]-serverDepth+1.7, originStart[2] + 0.15])
|> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA006rr) |> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA006rr)
|> angledLine(angle = segAng(rectangleSegmentA006rr) - 90, length = 0.375, tag = $rectangleSegmentB006rr) |> angledLine(angle = segAng(rectangleSegmentA006rr) - 90, length = 0.375, tag = $rectangleSegmentB006rr)
@ -1048,7 +1048,7 @@ sketch007rr = startSketchOn(extrude001rr, face = 'START')
extrude007rr = extrude(sketch007rr, length = -thickness) extrude007rr = extrude(sketch007rr, length = -thickness)
// EIA-310-D standard hole pattern // EIA-310-D standard hole pattern
sketch008rr = startSketchOn(extrude001rr, face = 'START') sketch008rr = startSketchOn(extrude001rr, face = START)
|> startProfile(at = [-originStart[0]-serverDepth+1.7, originStart[2] + 0.15 + 0.62]) |> startProfile(at = [-originStart[0]-serverDepth+1.7, originStart[2] + 0.15 + 0.62])
|> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA007rr) |> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA007rr)
|> angledLine(angle = segAng(rectangleSegmentA007rr) - 90, length = 0.375, tag = $rectangleSegmentB007rr) |> angledLine(angle = segAng(rectangleSegmentA007rr) - 90, length = 0.375, tag = $rectangleSegmentB007rr)
@ -1063,7 +1063,7 @@ sketch008rr = startSketchOn(extrude001rr, face = 'START')
extrude008rr = extrude(sketch008rr, length = -thickness) extrude008rr = extrude(sketch008rr, length = -thickness)
// EIA-310-D standard hole pattern // EIA-310-D standard hole pattern
sketch009rr = startSketchOn(extrude001rr, face = 'START') sketch009rr = startSketchOn(extrude001rr, face = START)
|> startProfile(at = [-originStart[0]-serverDepth+1.7, originStart[2] + 0.15 + 0.62 + 0.5]) |> startProfile(at = [-originStart[0]-serverDepth+1.7, originStart[2] + 0.15 + 0.62 + 0.5])
|> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA008rr) |> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA008rr)
|> angledLine(angle = segAng(rectangleSegmentA008rr) - 90, length = 0.375, tag = $rectangleSegmentB008rr) |> angledLine(angle = segAng(rectangleSegmentA008rr) - 90, length = 0.375, tag = $rectangleSegmentB008rr)
@ -1078,7 +1078,7 @@ sketch009rr = startSketchOn(extrude001rr, face = 'START')
extrude009rr = extrude(sketch009rr, length = -thickness) extrude009rr = extrude(sketch009rr, length = -thickness)
// define slots // define slots
sketch010rr = startSketchOn(extrude001rr, face = 'START') sketch010rr = startSketchOn(extrude001rr, face = START)
|> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0]+1.5-serverDepth, originStart[2] + .81 - (.438 / 2)]) |> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0]+1.5-serverDepth, originStart[2] + .81 - (.438 / 2)])
|> xLine(length = 0.75 - .438) |> xLine(length = 0.75 - .438)
|> tangentialArc(endAbsolute = [ |> tangentialArc(endAbsolute = [
@ -1096,7 +1096,7 @@ sketch010rr = startSketchOn(extrude001rr, face = 'START')
extrude010rr = extrude(sketch010rr, length = -thickness) extrude010rr = extrude(sketch010rr, length = -thickness)
// define slots // define slots
sketch011rr = startSketchOn(extrude001rr, face = 'START') sketch011rr = startSketchOn(extrude001rr, face = START)
|> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0]+1.5-serverDepth, originStart[2] + railHeight * 1.75 / 2 + .438 / 2]) |> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0]+1.5-serverDepth, originStart[2] + railHeight * 1.75 / 2 + .438 / 2])
|> xLine(length = 0.75 - .438) |> xLine(length = 0.75 - .438)
|> tangentialArc(endAbsolute = [ |> tangentialArc(endAbsolute = [
@ -1110,7 +1110,7 @@ sketch011rr = startSketchOn(extrude001rr, face = 'START')
extrude011rr = extrude(sketch011rr, length = -thickness) extrude011rr = extrude(sketch011rr, length = -thickness)
// define slots // define slots
sketch012rr = startSketchOn(extrude001rr, face = 'START') sketch012rr = startSketchOn(extrude001rr, face = START)
|> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0]+1.5-serverDepth, originStart[2] + railHeight * 1.75 - .81 + .438 / 2]) |> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0]+1.5-serverDepth, originStart[2] + railHeight * 1.75 - .81 + .438 / 2])
|> xLine(length = 0.75 - .438) |> xLine(length = 0.75 - .438)
|> tangentialArc(endAbsolute = [ |> tangentialArc(endAbsolute = [
@ -1189,7 +1189,7 @@ sketch003rl = startSketchOn(planeXYrl)
extrude003rl = extrude(sketch003rl, length = railHeight * 1.75) extrude003rl = extrude(sketch003rl, length = railHeight * 1.75)
// EIA-310-D standard hole pattern // EIA-310-D standard hole pattern
sketch004rl = startSketchOn(extrude002rl, face = 'START') sketch004rl = startSketchOn(extrude002rl, face = START)
|> startProfile(at = [-1.38 + 2 + thickness + originStart[1], originStart[2] + 0.15]) |> startProfile(at = [-1.38 + 2 + thickness + originStart[1], originStart[2] + 0.15])
|> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA003rl) |> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA003rl)
|> angledLine(angle = segAng(rectangleSegmentA003rl) - 90, length = 0.375, tag = $rectangleSegmentB003rl) |> angledLine(angle = segAng(rectangleSegmentA003rl) - 90, length = 0.375, tag = $rectangleSegmentB003rl)
@ -1204,7 +1204,7 @@ sketch004rl = startSketchOn(extrude002rl, face = 'START')
extrude004rl = extrude(sketch004rl, length = -thickness) extrude004rl = extrude(sketch004rl, length = -thickness)
// EIA-310-D standard hole pattern // EIA-310-D standard hole pattern
sketch005rl = startSketchOn(extrude002rl, face = 'START') sketch005rl = startSketchOn(extrude002rl, face = START)
|> startProfile(at = [-1.38 + 2 + thickness + originStart[1], originStart[2] + 0.15 + .62]) |> startProfile(at = [-1.38 + 2 + thickness + originStart[1], originStart[2] + 0.15 + .62])
|> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA004rl) |> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA004rl)
|> angledLine(angle = segAng(rectangleSegmentA004rl) - 90, length = 0.375, tag = $rectangleSegmentB004rl) |> angledLine(angle = segAng(rectangleSegmentA004rl) - 90, length = 0.375, tag = $rectangleSegmentB004rl)
@ -1219,7 +1219,7 @@ sketch005rl = startSketchOn(extrude002rl, face = 'START')
extrude005rl = extrude(sketch005rl, length = -thickness) extrude005rl = extrude(sketch005rl, length = -thickness)
// EIA-310-D standard hole pattern // EIA-310-D standard hole pattern
sketch006rl = startSketchOn(extrude002rl, face = 'START') sketch006rl = startSketchOn(extrude002rl, face = START)
|> startProfile(at = [-1.38 + 2 + thickness + originStart[1], originStart[2] + 0.15 + 0.62 + 0.50]) |> startProfile(at = [-1.38 + 2 + thickness + originStart[1], originStart[2] + 0.15 + 0.62 + 0.50])
|> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA005rl) |> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA005rl)
|> angledLine(angle = segAng(rectangleSegmentA005rl) - 90, length = 0.375, tag = $rectangleSegmentB005rl) |> angledLine(angle = segAng(rectangleSegmentA005rl) - 90, length = 0.375, tag = $rectangleSegmentB005rl)
@ -1234,7 +1234,7 @@ sketch006rl = startSketchOn(extrude002rl, face = 'START')
extrude006rl = extrude(sketch006rl, length = -thickness) extrude006rl = extrude(sketch006rl, length = -thickness)
// EIA-310-D standard hole pattern // EIA-310-D standard hole pattern
sketch007rl = startSketchOn(extrude001rl, face = 'START') sketch007rl = startSketchOn(extrude001rl, face = START)
|> startProfile(at = [1.75 - originStart[0] - serverDepth, originStart[2] + 0.15]) |> startProfile(at = [1.75 - originStart[0] - serverDepth, originStart[2] + 0.15])
|> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA006rl) |> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA006rl)
|> angledLine(angle = segAng(rectangleSegmentA006rl) - 90, length = 0.375, tag = $rectangleSegmentB006rl) |> angledLine(angle = segAng(rectangleSegmentA006rl) - 90, length = 0.375, tag = $rectangleSegmentB006rl)
@ -1249,7 +1249,7 @@ sketch007rl = startSketchOn(extrude001rl, face = 'START')
extrude007rl = extrude(sketch007rl, length = -thickness) extrude007rl = extrude(sketch007rl, length = -thickness)
// EIA-310-D standard hole pattern // EIA-310-D standard hole pattern
sketch008rl = startSketchOn(extrude001rl, face = 'START') sketch008rl = startSketchOn(extrude001rl, face = START)
|> startProfile(at = [1.75 - originStart[0] - serverDepth, originStart[2] + 0.15 + 0.62]) |> startProfile(at = [1.75 - originStart[0] - serverDepth, originStart[2] + 0.15 + 0.62])
|> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA007rl) |> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA007rl)
|> angledLine(angle = segAng(rectangleSegmentA007rl) - 90, length = 0.375, tag = $rectangleSegmentB007rl) |> angledLine(angle = segAng(rectangleSegmentA007rl) - 90, length = 0.375, tag = $rectangleSegmentB007rl)
@ -1264,7 +1264,7 @@ sketch008rl = startSketchOn(extrude001rl, face = 'START')
extrude008rl = extrude(sketch008rl, length = -thickness) extrude008rl = extrude(sketch008rl, length = -thickness)
// EIA-310-D standard hole pattern // EIA-310-D standard hole pattern
sketch009rl = startSketchOn(extrude001rl, face = 'START') sketch009rl = startSketchOn(extrude001rl, face = START)
|> startProfile(at = [1.75 - originStart[0] - serverDepth, originStart[2] + 0.15 + 0.62 + 0.5]) |> startProfile(at = [1.75 - originStart[0] - serverDepth, originStart[2] + 0.15 + 0.62 + 0.5])
|> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA008rl) |> angledLine(angle = 0, length = -0.375, tag = $rectangleSegmentA008rl)
|> angledLine(angle = segAng(rectangleSegmentA008rl) - 90, length = 0.375, tag = $rectangleSegmentB008rl) |> angledLine(angle = segAng(rectangleSegmentA008rl) - 90, length = 0.375, tag = $rectangleSegmentB008rl)
@ -1279,7 +1279,7 @@ sketch009rl = startSketchOn(extrude001rl, face = 'START')
extrude009rl = extrude(sketch009rl, length = -thickness) extrude009rl = extrude(sketch009rl, length = -thickness)
// define slots // define slots
sketch010rl = startSketchOn(extrude001rl, face = 'START') sketch010rl = startSketchOn(extrude001rl, face = START)
|> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0] - serverDepth + 1.5, originStart[2] + .81 - (.438 / 2)]) |> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0] - serverDepth + 1.5, originStart[2] + .81 - (.438 / 2)])
|> xLine(length = 0.75 - .438) |> xLine(length = 0.75 - .438)
|> tangentialArc(endAbsolute = [ |> tangentialArc(endAbsolute = [
@ -1297,7 +1297,7 @@ sketch010rl = startSketchOn(extrude001rl, face = 'START')
extrude010rl = extrude(sketch010rl, length = -thickness) extrude010rl = extrude(sketch010rl, length = -thickness)
// define slots // define slots
sketch011rl = startSketchOn(extrude001rl, face = 'START') sketch011rl = startSketchOn(extrude001rl, face = START)
|> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0] - serverDepth + 1.5, originStart[2] + railHeight * 1.75 / 2 + .438 / 2]) |> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0] - serverDepth + 1.5, originStart[2] + railHeight * 1.75 / 2 + .438 / 2])
|> xLine(length = 0.75 - .438) |> xLine(length = 0.75 - .438)
|> tangentialArc(endAbsolute = [ |> tangentialArc(endAbsolute = [
@ -1311,7 +1311,7 @@ sketch011rl = startSketchOn(extrude001rl, face = 'START')
extrude011rl = extrude(sketch011rl, length = -thickness) extrude011rl = extrude(sketch011rl, length = -thickness)
// define slots // define slots
sketch012rl = startSketchOn(extrude001rl, face = 'START') sketch012rl = startSketchOn(extrude001rl, face = START)
|> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0] - serverDepth + 1.5, originStart[2] + railHeight * 1.75 - .81 + .438 / 2]) |> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0] - serverDepth + 1.5, originStart[2] + railHeight * 1.75 - .81 + .438 / 2])
|> xLine(length = 0.75 - .438) |> xLine(length = 0.75 - .438)
|> tangentialArc(endAbsolute = [ |> tangentialArc(endAbsolute = [

View File

@ -29,22 +29,22 @@ fn caster(@originStart) {
|> subtract2d(tool = circle(center = [ |> subtract2d(tool = circle(center = [
(3.543 - 2.756) / 2, (3.543 - 2.756) / 2,
(3.543 - 2.756) / 2 (3.543 - 2.756) / 2
], radius= 8.8 / 2 / 25.4), %) ], radius= 8.8 / 2 / 25.4))
|> subtract2d(tool = circle(center = [ |> subtract2d(tool = circle(center = [
(3.543 - 2.756) / 2 + 2.756, (3.543 - 2.756) / 2 + 2.756,
(3.543 - 2.756) / 2 (3.543 - 2.756) / 2
], radius= 8.8 / 2 / 25.4), %) ], radius= 8.8 / 2 / 25.4))
|> subtract2d(tool = circle(center = [ |> subtract2d(tool = circle(center = [
(3.543 - 2.756) / 2, (3.543 - 2.756) / 2,
(3.543 - 2.756) / 2 + 2.756 (3.543 - 2.756) / 2 + 2.756
], radius= 8.8 / 2 / 25.4), %) ], radius= 8.8 / 2 / 25.4))
|> subtract2d(tool = circle(center = [ |> subtract2d(tool = circle(center = [
(3.543 - 2.756) / 2 + 2.756, (3.543 - 2.756) / 2 + 2.756,
(3.543 - 2.756) / 2 + 2.756 (3.543 - 2.756) / 2 + 2.756
], radius= 8.8 / 2 / 25.4), %) ], radius= 8.8 / 2 / 25.4))
|> extrude(length = -.25) |> extrude(length = -.25)
sketch002c = startSketchOn(sketch001c, face = 'START') sketch002c = startSketchOn(sketch001c, face = START)
|> startProfile(at = [-originStart[0], 2.2 + originStart[1]]) |> startProfile(at = [-originStart[0], 2.2 + originStart[1]])
|> arc( |> arc(
angle_start = 30, angle_start = 30,
@ -450,10 +450,10 @@ sketch007 = startSketchOn(plane003)
|> line(end = [-width + 1, -depth + serverDepth + 3.8]) |> line(end = [-width + 1, -depth + serverDepth + 3.8])
|> line(end = [1, 0]) |> line(end = [1, 0])
|> line(end = [0, -.75]) |> line(end = [0, -.75])
|> line([ |> line(end = [
width - 2, width - 2,
depth - serverDepth - 5 + .6 depth - serverDepth - 5 + .6
], %) ])
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()
extrude007 = extrude(sketch007, length = 1) extrude007 = extrude(sketch007, length = 1)
@ -491,10 +491,10 @@ sketch007t = startSketchOn(plane004)
|> line(end = [-width + 1, -depth + serverDepth + 3.8]) |> line(end = [-width + 1, -depth + serverDepth + 3.8])
|> line(end = [1, 0]) |> line(end = [1, 0])
|> line(end = [0, -.75]) |> line(end = [0, -.75])
|> line([ |> line(end = [
width - 2, width - 2,
depth - serverDepth - 5 + .6 depth - serverDepth - 5 + .6
], %) ])
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close() |> close()
extrude007t = extrude(sketch007t, length = -1) extrude007t = extrude(sketch007t, length = -1)
@ -582,7 +582,7 @@ sketch003fl = startSketchOn(planeXYfl)
extrude003fl = extrude(sketch003fl, length = railHeight * 1.75) extrude003fl = extrude(sketch003fl, length = railHeight * 1.75)
// define slots // define slots
sketch010fl = startSketchOn(extrude001fl, face = 'START') sketch010fl = startSketchOn(extrude001fl, face = START)
|> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0], originStart[2] + .81 - (.438 / 2)]) |> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0], originStart[2] + .81 - (.438 / 2)])
|> xLine(length = 0.75 - .438) |> xLine(length = 0.75 - .438)
|> tangentialArc(endAbsolute = [ |> tangentialArc(endAbsolute = [
@ -600,7 +600,7 @@ sketch010fl = startSketchOn(extrude001fl, face = 'START')
extrude010fl = extrude(sketch010fl, length = -thickness) extrude010fl = extrude(sketch010fl, length = -thickness)
// define slots // define slots
sketch011fl = startSketchOn(extrude001fl, face = 'START') sketch011fl = startSketchOn(extrude001fl, face = START)
|> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0], originStart[2] + railHeight * 1.75 / 2 + .438 / 2]) |> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0], originStart[2] + railHeight * 1.75 / 2 + .438 / 2])
|> xLine(length = 0.75 - .438) |> xLine(length = 0.75 - .438)
|> tangentialArc(endAbsolute = [ |> tangentialArc(endAbsolute = [
@ -614,7 +614,7 @@ sketch011fl = startSketchOn(extrude001fl, face = 'START')
extrude011fl = extrude(sketch011fl, length = -thickness) extrude011fl = extrude(sketch011fl, length = -thickness)
// define slots // define slots
sketch012fl = startSketchOn(extrude001fl, face = 'START') sketch012fl = startSketchOn(extrude001fl, face = START)
|> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0], originStart[2] + railHeight * 1.75 - .81 + .438 / 2]) |> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0], originStart[2] + railHeight * 1.75 - .81 + .438 / 2])
|> xLine(length = 0.75 - .438) |> xLine(length = 0.75 - .438)
|> tangentialArc(endAbsolute = [ |> tangentialArc(endAbsolute = [
@ -694,7 +694,7 @@ sketch003fr = startSketchOn(planeXYfr)
extrude003fr = extrude(sketch003fr, length = railHeight * 1.75) extrude003fr = extrude(sketch003fr, length = railHeight * 1.75)
// define slots // define slots
sketch010fr = startSketchOn(extrude001fr, face = 'START') sketch010fr = startSketchOn(extrude001fr, face = START)
|> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0], originStart[2] + .81 - (.438 / 2)]) |> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0], originStart[2] + .81 - (.438 / 2)])
|> xLine(length = 0.75 - .438) |> xLine(length = 0.75 - .438)
|> tangentialArc(endAbsolute = [ |> tangentialArc(endAbsolute = [
@ -712,7 +712,7 @@ sketch010fr = startSketchOn(extrude001fr, face = 'START')
extrude010fr = extrude(sketch010fr, length = -thickness) extrude010fr = extrude(sketch010fr, length = -thickness)
// define slots // define slots
sketch011fr = startSketchOn(extrude001fr, face = 'START') sketch011fr = startSketchOn(extrude001fr, face = START)
|> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0], originStart[2] + railHeight * 1.75 / 2 + .438 / 2]) |> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0], originStart[2] + railHeight * 1.75 / 2 + .438 / 2])
|> xLine(length = 0.75 - .438) |> xLine(length = 0.75 - .438)
|> tangentialArc(endAbsolute = [ |> tangentialArc(endAbsolute = [
@ -726,7 +726,7 @@ sketch011fr = startSketchOn(extrude001fr, face = 'START')
extrude011fr = extrude(sketch011fr, length = -thickness) extrude011fr = extrude(sketch011fr, length = -thickness)
// define slots // define slots
sketch012fr = startSketchOn(extrude001fr, face = 'START') sketch012fr = startSketchOn(extrude001fr, face = START)
|> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0], originStart[2] + railHeight * 1.75 - .81 + .438 / 2]) |> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0], originStart[2] + railHeight * 1.75 - .81 + .438 / 2])
|> xLine(length = 0.75 - .438) |> xLine(length = 0.75 - .438)
|> tangentialArc(endAbsolute = [ |> tangentialArc(endAbsolute = [
@ -806,7 +806,7 @@ sketch003rr = startSketchOn(planeXYrr)
extrude003rr = extrude(sketch003rr, length = railHeight * 1.75) extrude003rr = extrude(sketch003rr, length = railHeight * 1.75)
// define slots // define slots
sketch010rr = startSketchOn(extrude001rr, face = 'START') sketch010rr = startSketchOn(extrude001rr, face = START)
|> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0] + 1.5 - serverDepth, originStart[2] + .81 - (.438 / 2)]) |> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0] + 1.5 - serverDepth, originStart[2] + .81 - (.438 / 2)])
|> xLine(length = 0.75 - .438) |> xLine(length = 0.75 - .438)
|> tangentialArc(endAbsolute = [ |> tangentialArc(endAbsolute = [
@ -824,7 +824,7 @@ sketch010rr = startSketchOn(extrude001rr, face = 'START')
extrude010rr = extrude(sketch010rr, length = -thickness) extrude010rr = extrude(sketch010rr, length = -thickness)
// define slots // define slots
sketch011rr = startSketchOn(extrude001rr, face = 'START') sketch011rr = startSketchOn(extrude001rr, face = START)
|> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0] + 1.5 - serverDepth, originStart[2] + railHeight * 1.75 / 2 + .438 / 2]) |> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0] + 1.5 - serverDepth, originStart[2] + railHeight * 1.75 / 2 + .438 / 2])
|> xLine(length = 0.75 - .438) |> xLine(length = 0.75 - .438)
|> tangentialArc(endAbsolute = [ |> tangentialArc(endAbsolute = [
@ -838,7 +838,7 @@ sketch011rr = startSketchOn(extrude001rr, face = 'START')
extrude011rr = extrude(sketch011rr, length = -thickness) extrude011rr = extrude(sketch011rr, length = -thickness)
// define slots // define slots
sketch012rr = startSketchOn(extrude001rr, face = 'START') sketch012rr = startSketchOn(extrude001rr, face = START)
|> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0] + 1.5 - serverDepth, originStart[2] + railHeight * 1.75 - .81 + .438 / 2]) |> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0] + 1.5 - serverDepth, originStart[2] + railHeight * 1.75 - .81 + .438 / 2])
|> xLine(length = 0.75 - .438) |> xLine(length = 0.75 - .438)
|> tangentialArc(endAbsolute = [ |> tangentialArc(endAbsolute = [
@ -917,7 +917,7 @@ sketch003rl = startSketchOn(planeXYrl)
extrude003rl = extrude(sketch003rl, length = railHeight * 1.75) extrude003rl = extrude(sketch003rl, length = railHeight * 1.75)
// define slots // define slots
sketch010rl = startSketchOn(extrude001rl, face = 'START') sketch010rl = startSketchOn(extrude001rl, face = START)
|> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0] - serverDepth + 1.5, originStart[2] + .81 - (.438 / 2)]) |> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0] - serverDepth + 1.5, originStart[2] + .81 - (.438 / 2)])
|> xLine(length = 0.75 - .438) |> xLine(length = 0.75 - .438)
|> tangentialArc(endAbsolute = [ |> tangentialArc(endAbsolute = [
@ -935,7 +935,7 @@ sketch010rl = startSketchOn(extrude001rl, face = 'START')
extrude010rl = extrude(sketch010rl, length = -thickness) extrude010rl = extrude(sketch010rl, length = -thickness)
// define slots // define slots
sketch011rl = startSketchOn(extrude001rl, face = 'START') sketch011rl = startSketchOn(extrude001rl, face = START)
|> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0] - serverDepth + 1.5, originStart[2] + railHeight * 1.75 / 2 + .438 / 2]) |> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0] - serverDepth + 1.5, originStart[2] + railHeight * 1.75 / 2 + .438 / 2])
|> xLine(length = 0.75 - .438) |> xLine(length = 0.75 - .438)
|> tangentialArc(endAbsolute = [ |> tangentialArc(endAbsolute = [
@ -949,7 +949,7 @@ sketch011rl = startSketchOn(extrude001rl, face = 'START')
extrude011rl = extrude(sketch011rl, length = -thickness) extrude011rl = extrude(sketch011rl, length = -thickness)
// define slots // define slots
sketch012rl = startSketchOn(extrude001rl, face = 'START') sketch012rl = startSketchOn(extrude001rl, face = START)
|> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0] - serverDepth + 1.5, originStart[2] + railHeight * 1.75 - .81 + .438 / 2]) |> startProfile(at = [-1.12 + (.75 - .438) / 2 - originStart[0] - serverDepth + 1.5, originStart[2] + railHeight * 1.75 - .81 + .438 / 2])
|> xLine(length = 0.75 - .438) |> xLine(length = 0.75 - .438)
|> tangentialArc(endAbsolute = [ |> tangentialArc(endAbsolute = [

View File

@ -26,13 +26,13 @@ tubeFace = {
zAxis = { x = 0, y = 0, z = 1 } zAxis = { x = 0, y = 0, z = 1 }
} }
// Make the base // Make the base
s = startSketchOn('XY') s = startSketchOn(XY)
|> startProfile(at = [-totalWidth / 2, -totalLength / 2]) |> startProfile(at = [-totalWidth / 2, -totalLength / 2])
|> line([totalWidth, 0], %) |> line(end = [totalWidth, 0])
|> line([0, totalLength], %) |> line(end = [0, totalLength])
|> line([-totalWidth, 0], %) |> line(end = [-totalWidth, 0])
|> close(%) |> close()
|> extrude(height, %) |> extrude(length = height)
// Sketch and extrude a rectangular shape to create the shell underneath the lego. This is a hack until we have a shell function. // Sketch and extrude a rectangular shape to create the shell underneath the lego. This is a hack until we have a shell function.
shellExtrude = startSketchOn(s, "start") shellExtrude = startSketchOn(s, "start")
@ -40,11 +40,11 @@ shellExtrude = startSketchOn(s, "start")
-(totalWidth / 2 - t), -(totalWidth / 2 - t),
-(totalLength / 2 - t) -(totalLength / 2 - t)
]) ])
|> line([totalWidth - (2 * t), 0], %) |> line(end = [totalWidth - (2 * t), 0])
|> line([0, totalLength - (2 * t)], %) |> line(end = [0, totalLength - (2 * t)])
|> line([-(totalWidth - (2 * t)), 0], %) |> line(end = [-(totalWidth - (2 * t)), 0])
|> close(%) |> close()
|> extrude(-(height - t), %) |> extrude(length = -(height - t))
fn tr(i) { fn tr(i) {
j = i + 1 j = i + 1
@ -57,7 +57,7 @@ fn tr(i) {
// Create the pegs on the top of the base // Create the pegs on the top of the base
totalBumps = (wbumps * lbumps)-1 totalBumps = (wbumps * lbumps)-1
peg = startSketchOn(s, 'end') peg = startSketchOn(s, face = END)
|> circle( center = [ |> circle( center = [
-(pitch*(wbumps-1)/2), -(pitch*(wbumps-1)/2),
-(pitch*(lbumps-1)/2) -(pitch*(lbumps-1)/2)
@ -72,6 +72,6 @@ peg = startSketchOn(s, 'end')
instances = lbumps, instances = lbumps,
distance = pitch distance = pitch
) )
|> extrude(bumpHeight, %) |> extrude(length = bumpHeight)
// |> patternTransform(instances = int(totalBumps-1), transform = tr) // |> patternTransform(instances = totalBumps-1, transform = tr)

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

View File

@ -1,9 +1,4 @@
use std::{ use std::{collections::HashMap, fs, path::Path};
collections::HashMap,
fs::{self, File},
io::Read as _,
path::Path,
};
use anyhow::Result; use anyhow::Result;
use base64::Engine; use base64::Engine;
@ -141,7 +136,7 @@ fn generate_index(combined: &IndexMap<String, Box<dyn StdLibFn>>, kcl_lib: &[Doc
types types
.get_mut("Primitive types") .get_mut("Primitive types")
.unwrap() .unwrap()
.push((name.to_owned(), format!("types.md#{name}"))); .push((name.to_owned(), format!("types#{name}")));
} }
for d in kcl_lib { for d in kcl_lib {
@ -672,9 +667,7 @@ async fn test_code_in_topics() {
let mut join_set = JoinSet::new(); let mut join_set = JoinSet::new();
for name in LANG_TOPICS { for name in LANG_TOPICS {
let filename = format!("../../docs/kcl/{}.md", name.to_lowercase().replace(' ', "-")); let filename = format!("../../docs/kcl/{}.md", name.to_lowercase().replace(' ', "-"));
let mut file = File::open(&filename).unwrap(); let text = std::fs::read_to_string(&filename).unwrap();
let mut text = String::new();
file.read_to_string(&mut text).unwrap();
for (i, (eg, attr)) in find_examples(&text, &filename).into_iter().enumerate() { for (i, (eg, attr)) in find_examples(&text, &filename).into_iter().enumerate() {
if attr == "norun" { if attr == "norun" {

View File

@ -80,6 +80,15 @@ pub(super) enum CacheResult {
/// The program that needs to be executed. /// The program that needs to be executed.
program: Node<Program>, program: Node<Program>,
}, },
/// Check only the imports, and not the main program.
/// Before sending this we already checked the main program and it is the same.
/// And we made sure the import statements > 0.
CheckImportsOnly {
/// Argument is whether we need to reapply settings.
reapply_settings: bool,
/// The ast of the main file, which did not change.
ast: Node<Program>,
},
/// Argument is whether we need to reapply settings. /// Argument is whether we need to reapply settings.
NoAction(bool), NoAction(bool),
} }
@ -105,7 +114,19 @@ pub(super) async fn get_changed_program(old: CacheInformation<'_>, new: CacheInf
// If the ASTs are the EXACT same we return None. // If the ASTs are the EXACT same we return None.
// We don't even need to waste time computing the digests. // We don't even need to waste time computing the digests.
if old.ast == new.ast { if old.ast == new.ast {
return CacheResult::NoAction(reapply_settings); // First we need to make sure an imported file didn't change it's ast.
// We know they have the same imports because the ast is the same.
// If we have no imports, we can skip this.
if !old.ast.has_import_statements() {
println!("No imports, no need to check.");
return CacheResult::NoAction(reapply_settings);
}
// Tell the CacheResult we need to check all the imports, but the main ast is the same.
return CacheResult::CheckImportsOnly {
reapply_settings,
ast: old.ast.clone(),
};
} }
// We have to clone just because the digests are stored inline :-( // We have to clone just because the digests are stored inline :-(
@ -119,7 +140,19 @@ pub(super) async fn get_changed_program(old: CacheInformation<'_>, new: CacheInf
// Check if the digest is the same. // Check if the digest is the same.
if old_ast.digest == new_ast.digest { if old_ast.digest == new_ast.digest {
return CacheResult::NoAction(reapply_settings); // First we need to make sure an imported file didn't change it's ast.
// We know they have the same imports because the ast is the same.
// If we have no imports, we can skip this.
if !old.ast.has_import_statements() {
println!("No imports, no need to check.");
return CacheResult::NoAction(reapply_settings);
}
// Tell the CacheResult we need to check all the imports, but the main ast is the same.
return CacheResult::CheckImportsOnly {
reapply_settings,
ast: old.ast.clone(),
};
} }
// Check if the annotations are different. // Check if the annotations are different.
@ -242,6 +275,8 @@ fn generate_changed_program(old_ast: Node<Program>, mut new_ast: Node<Program>,
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use pretty_assertions::assert_eq;
use super::*; use super::*;
use crate::execution::{parse_execute, parse_execute_with_project_dir, ExecTestResults}; use crate::execution::{parse_execute, parse_execute_with_project_dir, ExecTestResults};
@ -658,6 +693,92 @@ extrude(profile001, length = 100)"#
) )
.await; .await;
assert_eq!(result, CacheResult::NoAction(false)); let CacheResult::CheckImportsOnly { reapply_settings, .. } = result else {
panic!("Expected CheckImportsOnly, got {:?}", result);
};
assert_eq!(reapply_settings, false);
}
#[tokio::test(flavor = "multi_thread")]
async fn test_cache_multi_file_only_other_file_changes_should_reexecute() {
let code = r#"import "toBeImported.kcl" as importedCube
importedCube
sketch001 = startSketchOn(XZ)
profile001 = startProfile(sketch001, at = [-134.53, -56.17])
|> angledLine(angle = 0, length = 79.05, tag = $rectangleSegmentA001)
|> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 76.28)
|> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001), tag = $seg01)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)], tag = $seg02)
|> close()
extrude001 = extrude(profile001, length = 100)
sketch003 = startSketchOn(extrude001, face = seg02)
sketch002 = startSketchOn(extrude001, face = seg01)
"#;
let other_file = (
std::path::PathBuf::from("toBeImported.kcl"),
r#"sketch001 = startSketchOn(XZ)
profile001 = startProfile(sketch001, at = [281.54, 305.81])
|> angledLine(angle = 0, length = 123.43, tag = $rectangleSegmentA001)
|> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 85.99)
|> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001))
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
extrude(profile001, length = 100)"#
.to_string(),
);
let other_file2 = (
std::path::PathBuf::from("toBeImported.kcl"),
r#"sketch001 = startSketchOn(XZ)
profile001 = startProfile(sketch001, at = [281.54, 305.81])
|> angledLine(angle = 0, length = 123.43, tag = $rectangleSegmentA001)
|> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 85.99)
|> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001))
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
extrude(profile001, length = 100)
|> translate(z=100)
"#
.to_string(),
);
let tmp_dir = std::env::temp_dir();
let tmp_dir = tmp_dir.join(uuid::Uuid::new_v4().to_string());
// Create a temporary file for each of the other files.
let tmp_file = tmp_dir.join(other_file.0);
std::fs::create_dir_all(tmp_file.parent().unwrap()).unwrap();
std::fs::write(&tmp_file, other_file.1).unwrap();
let ExecTestResults { program, exec_ctxt, .. } =
parse_execute_with_project_dir(code, Some(tmp_dir)).await.unwrap();
// Change the other file.
std::fs::write(tmp_file, other_file2.1).unwrap();
let mut new_program = crate::Program::parse_no_errs(code).unwrap();
new_program.compute_digest();
let result = get_changed_program(
CacheInformation {
ast: &program.ast,
settings: &exec_ctxt.settings,
},
CacheInformation {
ast: &new_program.ast,
settings: &exec_ctxt.settings,
},
)
.await;
let CacheResult::CheckImportsOnly { reapply_settings, .. } = result else {
panic!("Expected CheckImportsOnly, got {:?}", result);
};
assert_eq!(reapply_settings, false);
} }
} }

View File

@ -19,9 +19,9 @@ use crate::{
modules::{ModuleId, ModulePath, ModuleRepr}, modules::{ModuleId, ModulePath, ModuleRepr},
parsing::ast::types::{ parsing::ast::types::{
Annotation, ArrayExpression, ArrayRangeExpression, BinaryExpression, BinaryOperator, BinaryPart, BodyItem, Annotation, ArrayExpression, ArrayRangeExpression, BinaryExpression, BinaryOperator, BinaryPart, BodyItem,
CallExpression, CallExpressionKw, Expr, FunctionExpression, IfExpression, ImportPath, ImportSelector, CallExpressionKw, Expr, FunctionExpression, IfExpression, ImportPath, ImportSelector, ItemVisibility,
ItemVisibility, LiteralIdentifier, LiteralValue, MemberExpression, MemberObject, Name, Node, NodeRef, LiteralIdentifier, LiteralValue, MemberExpression, MemberObject, Name, Node, NodeRef, ObjectExpression,
ObjectExpression, PipeExpression, Program, TagDeclarator, Type, UnaryExpression, UnaryOperator, PipeExpression, Program, TagDeclarator, Type, UnaryExpression, UnaryOperator,
}, },
source_range::SourceRange, source_range::SourceRange,
std::{ std::{
@ -668,7 +668,6 @@ impl ExecutorContext {
} }
} }
} }
Expr::CallExpression(call_expression) => call_expression.execute(exec_state, self).await?,
Expr::CallExpressionKw(call_expression) => call_expression.execute(exec_state, self).await?, Expr::CallExpressionKw(call_expression) => call_expression.execute(exec_state, self).await?,
Expr::PipeExpression(pipe_expression) => pipe_expression.get_result(exec_state, self).await?, Expr::PipeExpression(pipe_expression) => pipe_expression.get_result(exec_state, self).await?,
Expr::PipeSubstitution(pipe_substitution) => match statement_kind { Expr::PipeSubstitution(pipe_substitution) => match statement_kind {
@ -755,7 +754,6 @@ impl BinaryPart {
BinaryPart::Literal(literal) => Ok(KclValue::from_literal((**literal).clone(), exec_state)), BinaryPart::Literal(literal) => Ok(KclValue::from_literal((**literal).clone(), exec_state)),
BinaryPart::Name(name) => name.get_result(exec_state, ctx).await.cloned(), BinaryPart::Name(name) => name.get_result(exec_state, ctx).await.cloned(),
BinaryPart::BinaryExpression(binary_expression) => binary_expression.get_result(exec_state, ctx).await, BinaryPart::BinaryExpression(binary_expression) => binary_expression.get_result(exec_state, ctx).await,
BinaryPart::CallExpression(call_expression) => call_expression.execute(exec_state, ctx).await,
BinaryPart::CallExpressionKw(call_expression) => call_expression.execute(exec_state, ctx).await, BinaryPart::CallExpressionKw(call_expression) => call_expression.execute(exec_state, ctx).await,
BinaryPart::UnaryExpression(unary_expression) => unary_expression.get_result(exec_state, ctx).await, BinaryPart::UnaryExpression(unary_expression) => unary_expression.get_result(exec_state, ctx).await,
BinaryPart::MemberExpression(member_expression) => member_expression.get_result(exec_state), BinaryPart::MemberExpression(member_expression) => member_expression.get_result(exec_state),
@ -1426,12 +1424,6 @@ impl Node<CallExpressionKw> {
e.add_source_ranges(vec![callsite]) e.add_source_ranges(vec![callsite])
})?; })?;
#[cfg(feature = "artifact-graph")]
if matches!(fn_src, FunctionSource::User { .. }) {
// Track return operation.
exec_state.global.operations.push(Operation::GroupEnd);
}
let result = return_value.ok_or_else(move || { let result = return_value.ok_or_else(move || {
let mut source_ranges: Vec<SourceRange> = vec![callsite]; let mut source_ranges: Vec<SourceRange> = vec![callsite];
// We want to send the source range of the original function. // We want to send the source range of the original function.
@ -1450,145 +1442,6 @@ impl Node<CallExpressionKw> {
} }
} }
impl Node<CallExpression> {
#[async_recursion]
pub async fn execute(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
let fn_name = &self.callee;
let callsite = SourceRange::from(self);
let mut fn_args: Vec<Arg> = Vec::with_capacity(self.arguments.len());
for arg_expr in &self.arguments {
let metadata = Metadata {
source_range: SourceRange::from(arg_expr),
};
let value = ctx
.execute_expr(arg_expr, exec_state, &metadata, &[], StatementKind::Expression)
.await?;
let arg = Arg::new(value, SourceRange::from(arg_expr));
fn_args.push(arg);
}
let fn_args = fn_args; // remove mutability
match ctx.stdlib.get_either(fn_name) {
FunctionKind::Core(func) => {
if func.deprecated() {
exec_state.warn(CompilationError::err(
self.callee.as_source_range(),
format!("`{fn_name}` is deprecated, see the docs for a recommended replacement"),
));
}
#[cfg(feature = "artifact-graph")]
let op = if func.feature_tree_operation() {
let op_labeled_args = func
.args(false)
.iter()
.zip(&fn_args)
.map(|(k, arg)| {
(
k.name.clone(),
OpArg::new(OpKclValue::from(&arg.value), arg.source_range),
)
})
.collect();
Some(Operation::StdLibCall {
std_lib_fn: (&func).into(),
unlabeled_arg: None,
labeled_args: op_labeled_args,
source_range: callsite,
is_error: false,
})
} else {
None
};
// Attempt to call the function.
let args = crate::std::Args::new(
fn_args,
self.into(),
ctx.clone(),
exec_state.mod_local.pipe_value.clone().map(|v| Arg::new(v, callsite)),
);
let mut return_value = {
// Don't early-return in this block.
exec_state.mut_stack().push_new_env_for_rust_call();
let result = func.std_lib_fn()(exec_state, args).await;
exec_state.mut_stack().pop_env();
#[cfg(feature = "artifact-graph")]
if let Some(mut op) = op {
op.set_std_lib_call_is_error(result.is_err());
// Track call operation. We do this after the call
// since things like patternTransform may call user code
// before running, and we will likely want to use the
// return value. The call takes ownership of the args,
// so we need to build the op before the call.
exec_state.global.operations.push(op);
}
result
}?;
update_memory_for_tags_of_geometry(&mut return_value, exec_state)?;
Ok(return_value)
}
FunctionKind::UserDefined => {
let source_range = SourceRange::from(self);
// Clone the function so that we can use a mutable reference to
// exec_state.
let func = fn_name.get_result(exec_state, ctx).await?.clone();
// Track call operation.
#[cfg(feature = "artifact-graph")]
exec_state.global.operations.push(Operation::GroupBegin {
group: Group::FunctionCall {
name: Some(fn_name.to_string()),
function_source_range: func.function_def_source_range().unwrap_or_default(),
unlabeled_arg: None,
// TODO: Add the arguments for legacy positional parameters.
labeled_args: Default::default(),
},
source_range: callsite,
});
let Some(fn_src) = func.as_fn() else {
return Err(KclError::Semantic(KclErrorDetails {
message: "cannot call this because it isn't a function".to_string(),
source_ranges: vec![source_range],
}));
};
let return_value = fn_src
.call(Some(fn_name.to_string()), exec_state, ctx, fn_args, source_range)
.await
.map_err(|e| {
// Add the call expression to the source ranges.
// TODO currently ignored by the frontend
e.add_source_ranges(vec![source_range])
})?;
let result = return_value.ok_or_else(move || {
let mut source_ranges: Vec<SourceRange> = vec![source_range];
// We want to send the source range of the original function.
if let KclValue::Function { meta, .. } = func {
source_ranges = meta.iter().map(|m| m.source_range).collect();
};
KclError::UndefinedValue(KclErrorDetails {
message: format!("Result of function {} is undefined", fn_name),
source_ranges,
})
})?;
// Track return operation.
#[cfg(feature = "artifact-graph")]
exec_state.global.operations.push(Operation::GroupEnd);
Ok(result)
}
}
}
}
fn update_memory_for_tags_of_geometry(result: &mut KclValue, exec_state: &mut ExecState) -> Result<(), KclError> { fn update_memory_for_tags_of_geometry(result: &mut KclValue, exec_state: &mut ExecState) -> Result<(), KclError> {
// If the return result is a sketch or solid, we want to update the // If the return result is a sketch or solid, we want to update the
// memory for the tags of the group. // memory for the tags of the group.
@ -2474,7 +2327,15 @@ impl FunctionSource {
}); });
} }
call_user_defined_function_kw(fn_name.as_deref(), args.kw_args, *memory, ast, exec_state, ctx).await let result =
call_user_defined_function_kw(fn_name.as_deref(), args.kw_args, *memory, ast, exec_state, ctx)
.await;
// Track return operation.
#[cfg(feature = "artifact-graph")]
exec_state.global.operations.push(Operation::GroupEnd);
result
} }
FunctionSource::None => unreachable!(), FunctionSource::None => unreachable!(),
} }
@ -2791,13 +2652,12 @@ d = b + c
let mut exec_state = ExecState::new(&exec_ctxt); let mut exec_state = ExecState::new(&exec_ctxt);
exec_ctxt exec_ctxt
.run_concurrent( .run(
&crate::Program { &crate::Program {
ast: main.clone(), ast: main.clone(),
original_file_contents: "".to_owned(), original_file_contents: "".to_owned(),
}, },
&mut exec_state, &mut exec_state,
false,
) )
.await .await
.unwrap(); .unwrap();

View File

@ -263,20 +263,6 @@ impl KclValue {
} }
} }
#[cfg(feature = "artifact-graph")]
pub(crate) fn function_def_source_range(&self) -> Option<SourceRange> {
let KclValue::Function {
value: FunctionSource::User { ast, .. },
..
} = self
else {
return None;
};
// TODO: It would be nice if we could extract the source range starting
// at the fn, but that's the variable declaration.
Some(ast.as_source_range())
}
#[allow(unused)] #[allow(unused)]
pub(crate) fn none() -> Self { pub(crate) fn none() -> Self {
Self::KclNone { Self::KclNone {

View File

@ -42,6 +42,7 @@ use crate::{
parsing::ast::types::{Expr, ImportPath, NodeRef}, parsing::ast::types::{Expr, ImportPath, NodeRef},
source_range::SourceRange, source_range::SourceRange,
std::StdLib, std::StdLib,
walk::{Universe, UniverseMap},
CompilationError, ExecError, KclErrorWithOutputs, CompilationError, ExecError, KclErrorWithOutputs,
}; };
@ -586,7 +587,7 @@ impl ExecutorContext {
pub async fn run_with_caching(&self, program: crate::Program) -> Result<ExecOutcome, KclErrorWithOutputs> { pub async fn run_with_caching(&self, program: crate::Program) -> Result<ExecOutcome, KclErrorWithOutputs> {
assert!(!self.is_mock()); assert!(!self.is_mock());
let (program, mut exec_state, preserve_mem) = if let Some(OldAstState { let (program, mut exec_state, preserve_mem, imports_info) = if let Some(OldAstState {
ast: old_ast, ast: old_ast,
exec_state: mut old_state, exec_state: mut old_state,
settings: old_settings, settings: old_settings,
@ -603,7 +604,7 @@ impl ExecutorContext {
}; };
// Get the program that actually changed from the old and new information. // Get the program that actually changed from the old and new information.
let (clear_scene, program) = match cache::get_changed_program(old, new).await { let (clear_scene, program, import_check_info) = match cache::get_changed_program(old, new).await {
CacheResult::ReExecute { CacheResult::ReExecute {
clear_scene, clear_scene,
reapply_settings, reapply_settings,
@ -616,7 +617,7 @@ impl ExecutorContext {
.await .await
.is_err() .is_err()
{ {
(true, program) (true, program, None)
} else { } else {
( (
clear_scene, clear_scene,
@ -624,6 +625,52 @@ impl ExecutorContext {
ast: changed_program, ast: changed_program,
original_file_contents: program.original_file_contents, original_file_contents: program.original_file_contents,
}, },
None,
)
}
}
CacheResult::CheckImportsOnly {
reapply_settings,
ast: changed_program,
} => {
if reapply_settings
&& self
.engine
.reapply_settings(&self.settings, Default::default(), old_state.id_generator())
.await
.is_err()
{
(true, program, None)
} else {
// We need to check our imports to see if they changed.
let mut new_exec_state = ExecState::new(self);
let (new_universe, new_universe_map) = self.get_universe(&program, &mut new_exec_state).await?;
let mut clear_scene = false;
let mut keys = new_universe.keys().clone().collect::<Vec<_>>();
keys.sort();
for key in keys {
let (_, id, _, _) = &new_universe[key];
let old_source = old_state.get_source(*id);
let new_source = new_exec_state.get_source(*id);
if old_source != new_source {
clear_scene = true;
break;
}
}
(
clear_scene,
crate::Program {
ast: changed_program,
original_file_contents: program.original_file_contents,
},
// We only care about this if we are clearing the scene.
if clear_scene {
Some((new_universe, new_universe_map, new_exec_state))
} else {
None
},
) )
} }
} }
@ -646,7 +693,7 @@ impl ExecutorContext {
let outcome = old_state.to_exec_outcome(result_env).await; let outcome = old_state.to_exec_outcome(result_env).await;
return Ok(outcome); return Ok(outcome);
} }
(true, program) (true, program, None)
} }
CacheResult::NoAction(false) => { CacheResult::NoAction(false) => {
let outcome = old_state.to_exec_outcome(result_env).await; let outcome = old_state.to_exec_outcome(result_env).await;
@ -654,34 +701,42 @@ impl ExecutorContext {
} }
}; };
let (exec_state, preserve_mem) = if clear_scene { let (exec_state, preserve_mem, universe_info) =
// Pop the execution state, since we are starting fresh. if let Some((new_universe, new_universe_map, mut new_exec_state)) = import_check_info {
let mut exec_state = old_state; // Clear the scene if the imports changed.
exec_state.reset(self); self.send_clear_scene(&mut new_exec_state, Default::default())
.await
.map_err(KclErrorWithOutputs::no_outputs)?;
// We don't do this in mock mode since there is no engine connection (new_exec_state, false, Some((new_universe, new_universe_map)))
// anyways and from the TS side we override memory and don't want to clear it. } else if clear_scene {
self.send_clear_scene(&mut exec_state, Default::default()) // Pop the execution state, since we are starting fresh.
.await let mut exec_state = old_state;
.map_err(KclErrorWithOutputs::no_outputs)?; exec_state.reset(self);
(exec_state, false) self.send_clear_scene(&mut exec_state, Default::default())
} else { .await
old_state.mut_stack().restore_env(result_env); .map_err(KclErrorWithOutputs::no_outputs)?;
(old_state, true) (exec_state, false, None)
}; } else {
old_state.mut_stack().restore_env(result_env);
(program, exec_state, preserve_mem) (old_state, true, None)
};
(program, exec_state, preserve_mem, universe_info)
} else { } else {
let mut exec_state = ExecState::new(self); let mut exec_state = ExecState::new(self);
self.send_clear_scene(&mut exec_state, Default::default()) self.send_clear_scene(&mut exec_state, Default::default())
.await .await
.map_err(KclErrorWithOutputs::no_outputs)?; .map_err(KclErrorWithOutputs::no_outputs)?;
(program, exec_state, false) (program, exec_state, false, None)
}; };
let result = self.run_concurrent(&program, &mut exec_state, preserve_mem).await; let result = self
.run_concurrent(&program, &mut exec_state, imports_info, preserve_mem)
.await;
if result.is_err() { if result.is_err() {
cache::bust_cache().await; cache::bust_cache().await;
@ -714,7 +769,7 @@ impl ExecutorContext {
program: &crate::Program, program: &crate::Program,
exec_state: &mut ExecState, exec_state: &mut ExecState,
) -> Result<(EnvironmentRef, Option<ModelingSessionData>), KclErrorWithOutputs> { ) -> Result<(EnvironmentRef, Option<ModelingSessionData>), KclErrorWithOutputs> {
self.run_concurrent(program, exec_state, false).await self.run_concurrent(program, exec_state, None, false).await
} }
/// Perform the execution of a program using a concurrent /// Perform the execution of a program using a concurrent
@ -728,47 +783,24 @@ impl ExecutorContext {
&self, &self,
program: &crate::Program, program: &crate::Program,
exec_state: &mut ExecState, exec_state: &mut ExecState,
universe_info: Option<(Universe, UniverseMap)>,
preserve_mem: bool, preserve_mem: bool,
) -> Result<(EnvironmentRef, Option<ModelingSessionData>), KclErrorWithOutputs> { ) -> Result<(EnvironmentRef, Option<ModelingSessionData>), KclErrorWithOutputs> {
exec_state.add_root_module_contents(program); // Reuse our cached universe if we have one.
#[allow(unused_variables)]
let (universe, universe_map) = if let Some((universe, universe_map)) = universe_info {
(universe, universe_map)
} else {
self.get_universe(program, exec_state).await?
};
let default_planes = self.engine.get_default_planes().read().await.clone();
// Run the prelude to set up the engine.
self.eval_prelude(exec_state, SourceRange::synthetic()) self.eval_prelude(exec_state, SourceRange::synthetic())
.await .await
.map_err(KclErrorWithOutputs::no_outputs)?; .map_err(KclErrorWithOutputs::no_outputs)?;
let mut universe = std::collections::HashMap::new();
let default_planes = self.engine.get_default_planes().read().await.clone();
#[cfg_attr(not(feature = "artifact-graph"), expect(unused_variables))]
let root_imports = crate::walk::import_universe(
self,
&ModuleRepr::Kcl(program.ast.clone(), None),
&mut universe,
exec_state,
)
.await
.map_err(|err| {
println!("Error: {err:?}");
let module_id_to_module_path: IndexMap<ModuleId, ModulePath> = exec_state
.global
.path_to_source_id
.iter()
.map(|(k, v)| ((*v), k.clone()))
.collect();
KclErrorWithOutputs::new(
err,
#[cfg(feature = "artifact-graph")]
exec_state.global.operations.clone(),
#[cfg(feature = "artifact-graph")]
exec_state.global.artifact_commands.clone(),
#[cfg(feature = "artifact-graph")]
exec_state.global.artifact_graph.clone(),
module_id_to_module_path,
exec_state.global.id_to_source.clone(),
default_planes.clone(),
)
})?;
for modules in crate::walk::import_graph(&universe, self) for modules in crate::walk::import_graph(&universe, self)
.map_err(|err| { .map_err(|err| {
let module_id_to_module_path: IndexMap<ModuleId, ModulePath> = exec_state let module_id_to_module_path: IndexMap<ModuleId, ModulePath> = exec_state
@ -821,7 +853,7 @@ impl ExecutorContext {
ModulePath::Local { value, .. } => { ModulePath::Local { value, .. } => {
// We only want to display the top-level module imports in // We only want to display the top-level module imports in
// the Feature Tree, not transitive imports. // the Feature Tree, not transitive imports.
if root_imports.contains_key(value) { if universe_map.contains_key(value) {
exec_state.global.operations.push(Operation::GroupBegin { exec_state.global.operations.push(Operation::GroupBegin {
group: Group::ModuleInstance { group: Group::ModuleInstance {
name: value.file_name().unwrap_or_default().to_string_lossy().into_owned(), name: value.file_name().unwrap_or_default().to_string_lossy().into_owned(),
@ -974,6 +1006,52 @@ impl ExecutorContext {
self.inner_run(program, exec_state, preserve_mem).await self.inner_run(program, exec_state, preserve_mem).await
} }
/// Get the universe & universe map of the program.
/// And see if any of the imports changed.
async fn get_universe(
&self,
program: &crate::Program,
exec_state: &mut ExecState,
) -> Result<(Universe, UniverseMap), KclErrorWithOutputs> {
exec_state.add_root_module_contents(program);
let mut universe = std::collections::HashMap::new();
let default_planes = self.engine.get_default_planes().read().await.clone();
let root_imports = crate::walk::import_universe(
self,
&ModuleRepr::Kcl(program.ast.clone(), None),
&mut universe,
exec_state,
)
.await
.map_err(|err| {
println!("Error: {err:?}");
let module_id_to_module_path: IndexMap<ModuleId, ModulePath> = exec_state
.global
.path_to_source_id
.iter()
.map(|(k, v)| ((*v), k.clone()))
.collect();
KclErrorWithOutputs::new(
err,
#[cfg(feature = "artifact-graph")]
exec_state.global.operations.clone(),
#[cfg(feature = "artifact-graph")]
exec_state.global.artifact_commands.clone(),
#[cfg(feature = "artifact-graph")]
exec_state.global.artifact_graph.clone(),
module_id_to_module_path,
exec_state.global.id_to_source.clone(),
default_planes,
)
})?;
Ok((universe, root_imports))
}
/// Perform the execution of a program. Accept all possible parameters and /// Perform the execution of a program. Accept all possible parameters and
/// output everything. /// output everything.
async fn inner_run( async fn inner_run(

View File

@ -238,6 +238,10 @@ impl ExecState {
self.global.id_to_source.insert(id, source.clone()); self.global.id_to_source.insert(id, source.clone());
} }
pub(super) fn get_source(&self, id: ModuleId) -> Option<&ModuleSource> {
self.global.id_to_source.get(&id)
}
pub(super) fn add_module(&mut self, id: ModuleId, path: ModulePath, repr: ModuleRepr) { pub(super) fn add_module(&mut self, id: ModuleId, path: ModulePath, repr: ModuleRepr) {
debug_assert!(self.global.path_to_source_id.contains_key(&path)); debug_assert!(self.global.path_to_source_id.contains_key(&path));
let module_info = ModuleInfo { id, repr, path }; let module_info = ModuleInfo { id, repr, path };

View File

@ -6,8 +6,7 @@ use crate::{
execution::{types::UnitLen, PlaneInfo, Point3d}, execution::{types::UnitLen, PlaneInfo, Point3d},
lint::rule::{def_finding, Discovered, Finding}, lint::rule::{def_finding, Discovered, Finding},
parsing::ast::types::{ parsing::ast::types::{
BinaryPart, CallExpression, CallExpressionKw, Expr, LiteralValue, Node as AstNode, ObjectExpression, Program, BinaryPart, CallExpressionKw, Expr, LiteralValue, Node as AstNode, ObjectExpression, Program, UnaryOperator,
UnaryOperator,
}, },
walk::Node, walk::Node,
SourceRange, SourceRange,
@ -128,37 +127,11 @@ fn get_offset(info: &PlaneInfo) -> Option<f64> {
pub fn start_sketch_on_check_specific_plane(node: Node) -> Result<Option<(SourceRange, PlaneName, f64)>> { pub fn start_sketch_on_check_specific_plane(node: Node) -> Result<Option<(SourceRange, PlaneName, f64)>> {
match node { match node {
Node::CallExpression(node) => start_sketch_on_check_specific_plane_pos(node),
Node::CallExpressionKw(node) => start_sketch_on_check_specific_plane_kw(node), Node::CallExpressionKw(node) => start_sketch_on_check_specific_plane_kw(node),
_ => Ok(None), _ => Ok(None),
} }
} }
pub fn start_sketch_on_check_specific_plane_pos(
call: &AstNode<CallExpression>,
) -> Result<Option<(SourceRange, PlaneName, f64)>> {
if call.inner.callee.inner.name.name != "startSketchOn" {
return Ok(None);
}
if call.arguments.len() != 1 {
// we only look for single-argument object patterns, if there's more
// than that we don't have a plane decl
return Ok(None);
}
let call_source_range = SourceRange::new(
call.arguments[0].start(),
call.arguments[0].end(),
call.arguments[0].module_id(),
);
let Expr::ObjectExpression(arg) = &call.arguments[0] else {
return Ok(None);
};
common(arg, call_source_range)
}
pub fn start_sketch_on_check_specific_plane_kw( pub fn start_sketch_on_check_specific_plane_kw(
call: &AstNode<CallExpressionKw>, call: &AstNode<CallExpressionKw>,
) -> Result<Option<(SourceRange, PlaneName, f64)>> { ) -> Result<Option<(SourceRange, PlaneName, f64)>> {

View File

@ -265,13 +265,13 @@ impl Backend {
r#"fn cube(pos, scale) { r#"fn cube(pos, scale) {
sg = startSketchOn(XY) sg = startSketchOn(XY)
|> startProfile(at = pos) |> startProfile(at = pos)
|> line([0, scale], %) |> line(end = [0, scale])
|> line([scale, 0], %) |> line(end = [scale, 0])
|> line([0, -scale], %) |> line(end = [0, -scale])
return sg return sg
} }
part001 = cube([0,0], 20) part001 = cube(pos = [0,0], scale = 20)
|> close(%) |> close()
|> extrude(length=20)"# |> extrude(length=20)"#
.to_string(), .to_string(),
); );

View File

@ -89,7 +89,6 @@ impl Expr {
Expr::FunctionExpression(function_expression) => { Expr::FunctionExpression(function_expression) => {
function_expression.get_hover_value_for_position(pos, code, opts) function_expression.get_hover_value_for_position(pos, code, opts)
} }
Expr::CallExpression(call_expression) => call_expression.get_hover_value_for_position(pos, code, opts),
Expr::CallExpressionKw(call_expression) => call_expression.get_hover_value_for_position(pos, code, opts), Expr::CallExpressionKw(call_expression) => call_expression.get_hover_value_for_position(pos, code, opts),
Expr::PipeExpression(pipe_expression) => pipe_expression.get_hover_value_for_position(pos, code, opts), Expr::PipeExpression(pipe_expression) => pipe_expression.get_hover_value_for_position(pos, code, opts),
Expr::ArrayExpression(array_expression) => array_expression.get_hover_value_for_position(pos, code, opts), Expr::ArrayExpression(array_expression) => array_expression.get_hover_value_for_position(pos, code, opts),
@ -144,9 +143,6 @@ impl BinaryPart {
BinaryPart::BinaryExpression(binary_expression) => { BinaryPart::BinaryExpression(binary_expression) => {
binary_expression.get_hover_value_for_position(pos, code, opts) binary_expression.get_hover_value_for_position(pos, code, opts)
} }
BinaryPart::CallExpression(call_expression) => {
call_expression.get_hover_value_for_position(pos, code, opts)
}
BinaryPart::CallExpressionKw(call_expression) => { BinaryPart::CallExpressionKw(call_expression) => {
call_expression.get_hover_value_for_position(pos, code, opts) call_expression.get_hover_value_for_position(pos, code, opts)
} }
@ -161,35 +157,6 @@ impl BinaryPart {
} }
} }
impl CallExpression {
fn get_hover_value_for_position(&self, pos: usize, code: &str, opts: &HoverOpts) -> Option<Hover> {
let callee_source_range: SourceRange = self.callee.clone().into();
if callee_source_range.contains(pos) {
return Some(Hover::Function {
name: self.callee.to_string(),
range: callee_source_range.to_lsp_range(code),
});
}
for (index, arg) in self.arguments.iter().enumerate() {
let source_range: SourceRange = arg.into();
if source_range.contains(pos) {
return if opts.prefer_sig {
Some(Hover::Signature {
name: self.callee.to_string(),
parameter_index: index as u32,
range: source_range.to_lsp_range(code),
})
} else {
arg.get_hover_value_for_position(pos, code, opts)
};
}
}
None
}
}
impl CallExpressionKw { impl CallExpressionKw {
fn get_hover_value_for_position(&self, pos: usize, code: &str, opts: &HoverOpts) -> Option<Hover> { fn get_hover_value_for_position(&self, pos: usize, code: &str, opts: &HoverOpts) -> Option<Hover> {
let callee_source_range: SourceRange = self.callee.clone().into(); let callee_source_range: SourceRange = self.callee.clone().into();

View File

@ -516,23 +516,6 @@ impl Backend {
} }
return get_modifier(vec![SemanticTokenModifier::DECLARATION]); return get_modifier(vec![SemanticTokenModifier::DECLARATION]);
} }
crate::walk::Node::CallExpression(call_expr) => {
let sr: SourceRange = (&call_expr.callee).into();
if sr.contains(source_range.start()) {
let mut ti = token_index.lock().map_err(|_| anyhow::anyhow!("mutex"))?;
*ti = match self.get_semantic_token_type_index(&SemanticTokenType::FUNCTION) {
Some(index) => index,
None => token_type_index,
};
if self.stdlib_completions.contains_key(&call_expr.callee.name.name) {
// This is a stdlib function.
return get_modifier(vec![SemanticTokenModifier::DEFAULT_LIBRARY]);
}
return Ok(false);
}
}
crate::walk::Node::CallExpressionKw(call_expr) => { crate::walk::Node::CallExpressionKw(call_expr) => {
let sr: SourceRange = (&call_expr.callee).into(); let sr: SourceRange = (&call_expr.callee).into();
if sr.contains(source_range.start()) { if sr.contains(source_range.start()) {

View File

@ -2,11 +2,11 @@ use sha2::{Digest as DigestTrait, Sha256};
use crate::parsing::ast::types::{ use crate::parsing::ast::types::{
Annotation, ArrayExpression, ArrayRangeExpression, AscribedExpression, BinaryExpression, BinaryPart, BodyItem, Annotation, ArrayExpression, ArrayRangeExpression, AscribedExpression, BinaryExpression, BinaryPart, BodyItem,
CallExpression, CallExpressionKw, DefaultParamVal, ElseIf, Expr, ExpressionStatement, FunctionExpression, CallExpressionKw, DefaultParamVal, ElseIf, Expr, ExpressionStatement, FunctionExpression, Identifier, IfExpression,
Identifier, IfExpression, ImportItem, ImportSelector, ImportStatement, ItemVisibility, KclNone, LabelledExpression, ImportItem, ImportSelector, ImportStatement, ItemVisibility, KclNone, LabelledExpression, Literal,
Literal, LiteralIdentifier, LiteralValue, MemberExpression, MemberObject, Name, ObjectExpression, ObjectProperty, LiteralIdentifier, LiteralValue, MemberExpression, MemberObject, Name, ObjectExpression, ObjectProperty, Parameter,
Parameter, PipeExpression, PipeSubstitution, PrimitiveType, Program, ReturnStatement, TagDeclarator, Type, PipeExpression, PipeSubstitution, PrimitiveType, Program, ReturnStatement, TagDeclarator, Type, TypeDeclaration,
TypeDeclaration, UnaryExpression, VariableDeclaration, VariableDeclarator, VariableKind, UnaryExpression, VariableDeclaration, VariableDeclarator, VariableKind,
}; };
/// Position-independent digest of the AST node. /// Position-independent digest of the AST node.
@ -132,7 +132,6 @@ impl Expr {
Expr::TagDeclarator(tag) => tag.compute_digest(), Expr::TagDeclarator(tag) => tag.compute_digest(),
Expr::BinaryExpression(be) => be.compute_digest(), Expr::BinaryExpression(be) => be.compute_digest(),
Expr::FunctionExpression(fe) => fe.compute_digest(), Expr::FunctionExpression(fe) => fe.compute_digest(),
Expr::CallExpression(ce) => ce.compute_digest(),
Expr::CallExpressionKw(ce) => ce.compute_digest(), Expr::CallExpressionKw(ce) => ce.compute_digest(),
Expr::PipeExpression(pe) => pe.compute_digest(), Expr::PipeExpression(pe) => pe.compute_digest(),
Expr::PipeSubstitution(ps) => ps.compute_digest(), Expr::PipeSubstitution(ps) => ps.compute_digest(),
@ -159,7 +158,6 @@ impl BinaryPart {
BinaryPart::Literal(lit) => lit.compute_digest(), BinaryPart::Literal(lit) => lit.compute_digest(),
BinaryPart::Name(id) => id.compute_digest(), BinaryPart::Name(id) => id.compute_digest(),
BinaryPart::BinaryExpression(be) => be.compute_digest(), BinaryPart::BinaryExpression(be) => be.compute_digest(),
BinaryPart::CallExpression(ce) => ce.compute_digest(),
BinaryPart::CallExpressionKw(ce) => ce.compute_digest(), BinaryPart::CallExpressionKw(ce) => ce.compute_digest(),
BinaryPart::UnaryExpression(ue) => ue.compute_digest(), BinaryPart::UnaryExpression(ue) => ue.compute_digest(),
BinaryPart::MemberExpression(me) => me.compute_digest(), BinaryPart::MemberExpression(me) => me.compute_digest(),
@ -480,16 +478,6 @@ impl PipeExpression {
}); });
} }
impl CallExpression {
compute_digest!(|slf, hasher| {
hasher.update(slf.callee.compute_digest());
hasher.update(slf.arguments.len().to_ne_bytes());
for argument in slf.arguments.iter_mut() {
hasher.update(argument.compute_digest());
}
});
}
impl CallExpressionKw { impl CallExpressionKw {
compute_digest!(|slf, hasher| { compute_digest!(|slf, hasher| {
hasher.update(slf.callee.compute_digest()); hasher.update(slf.callee.compute_digest());

View File

@ -26,7 +26,6 @@ impl Expr {
Expr::TagDeclarator(tag) => tag.module_id, Expr::TagDeclarator(tag) => tag.module_id,
Expr::BinaryExpression(binary_expression) => binary_expression.module_id, Expr::BinaryExpression(binary_expression) => binary_expression.module_id,
Expr::FunctionExpression(function_expression) => function_expression.module_id, Expr::FunctionExpression(function_expression) => function_expression.module_id,
Expr::CallExpression(call_expression) => call_expression.module_id,
Expr::CallExpressionKw(call_expression) => call_expression.module_id, Expr::CallExpressionKw(call_expression) => call_expression.module_id,
Expr::PipeExpression(pipe_expression) => pipe_expression.module_id, Expr::PipeExpression(pipe_expression) => pipe_expression.module_id,
Expr::PipeSubstitution(pipe_substitution) => pipe_substitution.module_id, Expr::PipeSubstitution(pipe_substitution) => pipe_substitution.module_id,
@ -49,7 +48,6 @@ impl BinaryPart {
BinaryPart::Literal(literal) => literal.module_id, BinaryPart::Literal(literal) => literal.module_id,
BinaryPart::Name(identifier) => identifier.module_id, BinaryPart::Name(identifier) => identifier.module_id,
BinaryPart::BinaryExpression(binary_expression) => binary_expression.module_id, BinaryPart::BinaryExpression(binary_expression) => binary_expression.module_id,
BinaryPart::CallExpression(call_expression) => call_expression.module_id,
BinaryPart::CallExpressionKw(call_expression) => call_expression.module_id, BinaryPart::CallExpressionKw(call_expression) => call_expression.module_id,
BinaryPart::UnaryExpression(unary_expression) => unary_expression.module_id, BinaryPart::UnaryExpression(unary_expression) => unary_expression.module_id,
BinaryPart::MemberExpression(member_expression) => member_expression.module_id, BinaryPart::MemberExpression(member_expression) => member_expression.module_id,

View File

@ -542,6 +542,16 @@ impl Program {
} }
} }
/// Checks if the ast has any import statements.
pub fn has_import_statements(&self) -> bool {
for item in &self.body {
if let BodyItem::ImportStatement(_) = item {
return true;
}
}
false
}
pub fn in_comment(&self, pos: usize) -> bool { pub fn in_comment(&self, pos: usize) -> bool {
// Check if its in the body. // Check if its in the body.
if self.non_code_meta.in_comment(pos) { if self.non_code_meta.in_comment(pos) {
@ -922,7 +932,6 @@ pub enum Expr {
TagDeclarator(BoxNode<TagDeclarator>), TagDeclarator(BoxNode<TagDeclarator>),
BinaryExpression(BoxNode<BinaryExpression>), BinaryExpression(BoxNode<BinaryExpression>),
FunctionExpression(BoxNode<FunctionExpression>), FunctionExpression(BoxNode<FunctionExpression>),
CallExpression(BoxNode<CallExpression>),
CallExpressionKw(BoxNode<CallExpressionKw>), CallExpressionKw(BoxNode<CallExpressionKw>),
PipeExpression(BoxNode<PipeExpression>), PipeExpression(BoxNode<PipeExpression>),
PipeSubstitution(BoxNode<PipeSubstitution>), PipeSubstitution(BoxNode<PipeSubstitution>),
@ -968,7 +977,6 @@ impl Expr {
Expr::MemberExpression(_mem_exp) => None, Expr::MemberExpression(_mem_exp) => None,
Expr::Literal(_literal) => None, Expr::Literal(_literal) => None,
Expr::FunctionExpression(_func_exp) => None, Expr::FunctionExpression(_func_exp) => None,
Expr::CallExpression(_call_exp) => None,
Expr::CallExpressionKw(_call_exp) => None, Expr::CallExpressionKw(_call_exp) => None,
Expr::Name(_ident) => None, Expr::Name(_ident) => None,
Expr::TagDeclarator(_tag) => None, Expr::TagDeclarator(_tag) => None,
@ -996,7 +1004,6 @@ impl Expr {
Expr::MemberExpression(_) => {} Expr::MemberExpression(_) => {}
Expr::Literal(_) => {} Expr::Literal(_) => {}
Expr::FunctionExpression(ref mut func_exp) => func_exp.replace_value(source_range, new_value), Expr::FunctionExpression(ref mut func_exp) => func_exp.replace_value(source_range, new_value),
Expr::CallExpression(ref mut call_exp) => call_exp.replace_value(source_range, new_value),
Expr::CallExpressionKw(ref mut call_exp) => call_exp.replace_value(source_range, new_value), Expr::CallExpressionKw(ref mut call_exp) => call_exp.replace_value(source_range, new_value),
Expr::Name(_) => {} Expr::Name(_) => {}
Expr::TagDeclarator(_) => {} Expr::TagDeclarator(_) => {}
@ -1017,7 +1024,6 @@ impl Expr {
Expr::TagDeclarator(tag) => tag.start, Expr::TagDeclarator(tag) => tag.start,
Expr::BinaryExpression(binary_expression) => binary_expression.start, Expr::BinaryExpression(binary_expression) => binary_expression.start,
Expr::FunctionExpression(function_expression) => function_expression.start, Expr::FunctionExpression(function_expression) => function_expression.start,
Expr::CallExpression(call_expression) => call_expression.start,
Expr::CallExpressionKw(call_expression) => call_expression.start, Expr::CallExpressionKw(call_expression) => call_expression.start,
Expr::PipeExpression(pipe_expression) => pipe_expression.start, Expr::PipeExpression(pipe_expression) => pipe_expression.start,
Expr::PipeSubstitution(pipe_substitution) => pipe_substitution.start, Expr::PipeSubstitution(pipe_substitution) => pipe_substitution.start,
@ -1040,7 +1046,6 @@ impl Expr {
Expr::TagDeclarator(tag) => tag.end, Expr::TagDeclarator(tag) => tag.end,
Expr::BinaryExpression(binary_expression) => binary_expression.end, Expr::BinaryExpression(binary_expression) => binary_expression.end,
Expr::FunctionExpression(function_expression) => function_expression.end, Expr::FunctionExpression(function_expression) => function_expression.end,
Expr::CallExpression(call_expression) => call_expression.end,
Expr::CallExpressionKw(call_expression) => call_expression.end, Expr::CallExpressionKw(call_expression) => call_expression.end,
Expr::PipeExpression(pipe_expression) => pipe_expression.end, Expr::PipeExpression(pipe_expression) => pipe_expression.end,
Expr::PipeSubstitution(pipe_substitution) => pipe_substitution.end, Expr::PipeSubstitution(pipe_substitution) => pipe_substitution.end,
@ -1071,7 +1076,6 @@ impl Expr {
binary_expression.rename_identifiers(old_name, new_name) binary_expression.rename_identifiers(old_name, new_name)
} }
Expr::FunctionExpression(_function_identifier) => {} Expr::FunctionExpression(_function_identifier) => {}
Expr::CallExpression(ref mut call_expression) => call_expression.rename_identifiers(old_name, new_name),
Expr::CallExpressionKw(ref mut call_expression) => call_expression.rename_identifiers(old_name, new_name), Expr::CallExpressionKw(ref mut call_expression) => call_expression.rename_identifiers(old_name, new_name),
Expr::PipeExpression(ref mut pipe_expression) => pipe_expression.rename_identifiers(old_name, new_name), Expr::PipeExpression(ref mut pipe_expression) => pipe_expression.rename_identifiers(old_name, new_name),
Expr::PipeSubstitution(_) => {} Expr::PipeSubstitution(_) => {}
@ -1100,7 +1104,6 @@ impl Expr {
Expr::BinaryExpression(binary_expression) => binary_expression.get_constraint_level(), Expr::BinaryExpression(binary_expression) => binary_expression.get_constraint_level(),
Expr::FunctionExpression(function_identifier) => function_identifier.get_constraint_level(), Expr::FunctionExpression(function_identifier) => function_identifier.get_constraint_level(),
Expr::CallExpression(call_expression) => call_expression.get_constraint_level(),
Expr::CallExpressionKw(call_expression) => call_expression.get_constraint_level(), Expr::CallExpressionKw(call_expression) => call_expression.get_constraint_level(),
Expr::PipeExpression(pipe_expression) => pipe_expression.get_constraint_level(), Expr::PipeExpression(pipe_expression) => pipe_expression.get_constraint_level(),
Expr::PipeSubstitution(pipe_substitution) => ConstraintLevel::Ignore { Expr::PipeSubstitution(pipe_substitution) => ConstraintLevel::Ignore {
@ -1118,16 +1121,6 @@ impl Expr {
} }
} }
pub fn has_substitution_arg(&self) -> bool {
match self {
Expr::CallExpression(call_expression) => call_expression.has_substitution_arg(),
Expr::CallExpressionKw(call_expression) => call_expression.has_substitution_arg(),
Expr::LabelledExpression(expr) => expr.expr.has_substitution_arg(),
Expr::AscribedExpression(expr) => expr.expr.has_substitution_arg(),
_ => false,
}
}
pub fn literal_bool(&self) -> Option<bool> { pub fn literal_bool(&self) -> Option<bool> {
match self { match self {
Expr::Literal(lit) => match lit.value { Expr::Literal(lit) => match lit.value {
@ -1184,7 +1177,6 @@ impl From<&BinaryPart> for Expr {
BinaryPart::Literal(literal) => Expr::Literal(literal.clone()), BinaryPart::Literal(literal) => Expr::Literal(literal.clone()),
BinaryPart::Name(name) => Expr::Name(name.clone()), BinaryPart::Name(name) => Expr::Name(name.clone()),
BinaryPart::BinaryExpression(binary_expression) => Expr::BinaryExpression(binary_expression.clone()), BinaryPart::BinaryExpression(binary_expression) => Expr::BinaryExpression(binary_expression.clone()),
BinaryPart::CallExpression(call_expression) => Expr::CallExpression(call_expression.clone()),
BinaryPart::CallExpressionKw(call_expression) => Expr::CallExpressionKw(call_expression.clone()), BinaryPart::CallExpressionKw(call_expression) => Expr::CallExpressionKw(call_expression.clone()),
BinaryPart::UnaryExpression(unary_expression) => Expr::UnaryExpression(unary_expression.clone()), BinaryPart::UnaryExpression(unary_expression) => Expr::UnaryExpression(unary_expression.clone()),
BinaryPart::MemberExpression(member_expression) => Expr::MemberExpression(member_expression.clone()), BinaryPart::MemberExpression(member_expression) => Expr::MemberExpression(member_expression.clone()),
@ -1251,7 +1243,6 @@ pub enum BinaryPart {
Literal(BoxNode<Literal>), Literal(BoxNode<Literal>),
Name(BoxNode<Name>), Name(BoxNode<Name>),
BinaryExpression(BoxNode<BinaryExpression>), BinaryExpression(BoxNode<BinaryExpression>),
CallExpression(BoxNode<CallExpression>),
CallExpressionKw(BoxNode<CallExpressionKw>), CallExpressionKw(BoxNode<CallExpressionKw>),
UnaryExpression(BoxNode<UnaryExpression>), UnaryExpression(BoxNode<UnaryExpression>),
MemberExpression(BoxNode<MemberExpression>), MemberExpression(BoxNode<MemberExpression>),
@ -1277,7 +1268,6 @@ impl BinaryPart {
BinaryPart::Literal(literal) => literal.get_constraint_level(), BinaryPart::Literal(literal) => literal.get_constraint_level(),
BinaryPart::Name(identifier) => identifier.get_constraint_level(), BinaryPart::Name(identifier) => identifier.get_constraint_level(),
BinaryPart::BinaryExpression(binary_expression) => binary_expression.get_constraint_level(), BinaryPart::BinaryExpression(binary_expression) => binary_expression.get_constraint_level(),
BinaryPart::CallExpression(call_expression) => call_expression.get_constraint_level(),
BinaryPart::CallExpressionKw(call_expression) => call_expression.get_constraint_level(), BinaryPart::CallExpressionKw(call_expression) => call_expression.get_constraint_level(),
BinaryPart::UnaryExpression(unary_expression) => unary_expression.get_constraint_level(), BinaryPart::UnaryExpression(unary_expression) => unary_expression.get_constraint_level(),
BinaryPart::MemberExpression(member_expression) => member_expression.get_constraint_level(), BinaryPart::MemberExpression(member_expression) => member_expression.get_constraint_level(),
@ -1292,9 +1282,6 @@ impl BinaryPart {
BinaryPart::BinaryExpression(ref mut binary_expression) => { BinaryPart::BinaryExpression(ref mut binary_expression) => {
binary_expression.replace_value(source_range, new_value) binary_expression.replace_value(source_range, new_value)
} }
BinaryPart::CallExpression(ref mut call_expression) => {
call_expression.replace_value(source_range, new_value)
}
BinaryPart::CallExpressionKw(ref mut call_expression) => { BinaryPart::CallExpressionKw(ref mut call_expression) => {
call_expression.replace_value(source_range, new_value) call_expression.replace_value(source_range, new_value)
} }
@ -1311,7 +1298,6 @@ impl BinaryPart {
BinaryPart::Literal(literal) => literal.start, BinaryPart::Literal(literal) => literal.start,
BinaryPart::Name(identifier) => identifier.start, BinaryPart::Name(identifier) => identifier.start,
BinaryPart::BinaryExpression(binary_expression) => binary_expression.start, BinaryPart::BinaryExpression(binary_expression) => binary_expression.start,
BinaryPart::CallExpression(call_expression) => call_expression.start,
BinaryPart::CallExpressionKw(call_expression) => call_expression.start, BinaryPart::CallExpressionKw(call_expression) => call_expression.start,
BinaryPart::UnaryExpression(unary_expression) => unary_expression.start, BinaryPart::UnaryExpression(unary_expression) => unary_expression.start,
BinaryPart::MemberExpression(member_expression) => member_expression.start, BinaryPart::MemberExpression(member_expression) => member_expression.start,
@ -1324,7 +1310,6 @@ impl BinaryPart {
BinaryPart::Literal(literal) => literal.end, BinaryPart::Literal(literal) => literal.end,
BinaryPart::Name(identifier) => identifier.end, BinaryPart::Name(identifier) => identifier.end,
BinaryPart::BinaryExpression(binary_expression) => binary_expression.end, BinaryPart::BinaryExpression(binary_expression) => binary_expression.end,
BinaryPart::CallExpression(call_expression) => call_expression.end,
BinaryPart::CallExpressionKw(call_expression) => call_expression.end, BinaryPart::CallExpressionKw(call_expression) => call_expression.end,
BinaryPart::UnaryExpression(unary_expression) => unary_expression.end, BinaryPart::UnaryExpression(unary_expression) => unary_expression.end,
BinaryPart::MemberExpression(member_expression) => member_expression.end, BinaryPart::MemberExpression(member_expression) => member_expression.end,
@ -1340,9 +1325,6 @@ impl BinaryPart {
BinaryPart::BinaryExpression(ref mut binary_expression) => { BinaryPart::BinaryExpression(ref mut binary_expression) => {
binary_expression.rename_identifiers(old_name, new_name) binary_expression.rename_identifiers(old_name, new_name)
} }
BinaryPart::CallExpression(ref mut call_expression) => {
call_expression.rename_identifiers(old_name, new_name)
}
BinaryPart::CallExpressionKw(ref mut call_expression) => { BinaryPart::CallExpressionKw(ref mut call_expression) => {
call_expression.rename_identifiers(old_name, new_name) call_expression.rename_identifiers(old_name, new_name)
} }
@ -1834,18 +1816,6 @@ pub struct ExpressionStatement {
pub digest: Option<Digest>, pub digest: Option<Digest>,
} }
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
#[ts(export)]
#[serde(tag = "type")]
pub struct CallExpression {
pub callee: Node<Name>,
pub arguments: Vec<Expr>,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(optional)]
pub digest: Option<Digest>,
}
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)] #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
#[ts(export)] #[ts(export)]
#[serde(rename_all = "camelCase", tag = "type")] #[serde(rename_all = "camelCase", tag = "type")]
@ -1871,37 +1841,12 @@ pub struct LabeledArg {
pub arg: Expr, pub arg: Expr,
} }
impl From<Node<CallExpression>> for Expr {
fn from(call_expression: Node<CallExpression>) -> Self {
Expr::CallExpression(Box::new(call_expression))
}
}
impl From<Node<CallExpressionKw>> for Expr { impl From<Node<CallExpressionKw>> for Expr {
fn from(call_expression: Node<CallExpressionKw>) -> Self { fn from(call_expression: Node<CallExpressionKw>) -> Self {
Expr::CallExpressionKw(Box::new(call_expression)) Expr::CallExpressionKw(Box::new(call_expression))
} }
} }
impl Node<CallExpression> {
/// Return the constraint level for this call expression.
pub fn get_constraint_level(&self) -> ConstraintLevel {
if self.arguments.is_empty() {
return ConstraintLevel::Ignore {
source_ranges: vec![self.into()],
};
}
// Iterate over the arguments and get the constraint level for each one.
let mut constraint_levels = ConstraintLevels::new();
for arg in &self.arguments {
constraint_levels.push(arg.get_constraint_level());
}
constraint_levels.get_constraint_level(self.into())
}
}
impl Node<CallExpressionKw> { impl Node<CallExpressionKw> {
/// Return the constraint level for this call expression. /// Return the constraint level for this call expression.
pub fn get_constraint_level(&self) -> ConstraintLevel { pub fn get_constraint_level(&self) -> ConstraintLevel {
@ -1921,38 +1866,6 @@ impl Node<CallExpressionKw> {
} }
} }
impl CallExpression {
pub fn new(name: &str, arguments: Vec<Expr>) -> Result<Node<Self>, KclError> {
Ok(Node::no_src(Self {
callee: Name::new(name),
arguments,
digest: None,
}))
}
/// Is at least one argument the '%' i.e. the substitution operator?
pub fn has_substitution_arg(&self) -> bool {
self.arguments
.iter()
.any(|arg| matches!(arg, Expr::PipeSubstitution(_)))
}
pub fn replace_value(&mut self, source_range: SourceRange, new_value: Expr) {
for arg in &mut self.arguments {
arg.replace_value(source_range, new_value.clone());
}
}
/// Rename all identifiers that have the old name to the new given name.
fn rename_identifiers(&mut self, old_name: &str, new_name: &str) {
self.callee.rename(old_name, new_name);
for arg in &mut self.arguments {
arg.rename_identifiers(old_name, new_name);
}
}
}
impl CallExpressionKw { impl CallExpressionKw {
pub fn new(name: &str, unlabeled: Option<Expr>, arguments: Vec<LabeledArg>) -> Result<Node<Self>, KclError> { pub fn new(name: &str, unlabeled: Option<Expr>, arguments: Vec<LabeledArg>) -> Result<Node<Self>, KclError> {
Ok(Node::no_src(Self { Ok(Node::no_src(Self {
@ -1972,13 +1885,6 @@ impl CallExpressionKw {
.chain(self.arguments.iter().map(|arg| (Some(&arg.label), &arg.arg))) .chain(self.arguments.iter().map(|arg| (Some(&arg.label), &arg.arg)))
} }
/// Is at least one argument the '%' i.e. the substitution operator?
pub fn has_substitution_arg(&self) -> bool {
self.arguments
.iter()
.any(|arg| matches!(arg.arg, Expr::PipeSubstitution(_)))
}
pub fn replace_value(&mut self, source_range: SourceRange, new_value: Expr) { pub fn replace_value(&mut self, source_range: SourceRange, new_value: Expr) {
for arg in &mut self.arguments { for arg in &mut self.arguments {
arg.arg.replace_value(source_range, new_value.clone()); arg.arg.replace_value(source_range, new_value.clone());
@ -4178,13 +4084,8 @@ cylinder = startSketchOn(-XZ)
}; };
oe oe
} }
Expr::CallExpression(ce) => {
let Expr::ObjectExpression(ref oe) = (ce.arguments).first().unwrap() else { other => panic!("expected a CallKw, found {other:?}"),
panic!("expected an object!");
};
oe
}
other => panic!("expected a Call or CallKw, found {other:?}"),
}; };
assert_eq!(oe.properties.len(), 2); assert_eq!(oe.properties.len(), 2);

View File

@ -177,18 +177,6 @@ impl NodePath {
} }
} }
} }
Expr::CallExpression(node) => {
if node.callee.contains_range(&range) {
path.push(Step::CallCallee);
return Some(path);
}
for (i, arg) in node.arguments.iter().enumerate() {
if arg.contains_range(&range) {
path.push(Step::CallArg { index: i });
return Self::from_expr(arg, range, path);
}
}
}
Expr::CallExpressionKw(node) => { Expr::CallExpressionKw(node) => {
if node.callee.contains_range(&range) { if node.callee.contains_range(&range) {
path.push(Step::CallKwCallee); path.push(Step::CallKwCallee);

View File

@ -14,7 +14,7 @@ use winnow::{
}; };
use super::{ use super::{
ast::types::{AscribedExpression, CallExpression, ImportPath, LabelledExpression}, ast::types::{AscribedExpression, ImportPath, LabelledExpression},
token::{NumericSuffix, RESERVED_WORDS}, token::{NumericSuffix, RESERVED_WORDS},
DeprecationKind, DeprecationKind,
}; };
@ -630,7 +630,6 @@ fn operand(i: &mut TokenSlice) -> PResult<BinaryPart> {
Expr::Literal(x) => BinaryPart::Literal(x), Expr::Literal(x) => BinaryPart::Literal(x),
Expr::Name(x) => BinaryPart::Name(x), Expr::Name(x) => BinaryPart::Name(x),
Expr::BinaryExpression(x) => BinaryPart::BinaryExpression(x), Expr::BinaryExpression(x) => BinaryPart::BinaryExpression(x),
Expr::CallExpression(x) => BinaryPart::CallExpression(x),
Expr::CallExpressionKw(x) => BinaryPart::CallExpressionKw(x), Expr::CallExpressionKw(x) => BinaryPart::CallExpressionKw(x),
Expr::MemberExpression(x) => BinaryPart::MemberExpression(x), Expr::MemberExpression(x) => BinaryPart::MemberExpression(x),
Expr::IfExpression(x) => BinaryPart::IfExpression(x), Expr::IfExpression(x) => BinaryPart::IfExpression(x),
@ -2030,7 +2029,6 @@ fn expr_allowed_in_pipe_expr(i: &mut TokenSlice) -> PResult<Expr> {
bool_value.map(Expr::Literal), bool_value.map(Expr::Literal),
tag.map(Box::new).map(Expr::TagDeclarator), tag.map(Box::new).map(Expr::TagDeclarator),
literal.map(Expr::Literal), literal.map(Expr::Literal),
fn_call.map(Box::new).map(Expr::CallExpression),
fn_call_kw.map(Box::new).map(Expr::CallExpressionKw), fn_call_kw.map(Box::new).map(Expr::CallExpressionKw),
name.map(Box::new).map(Expr::Name), name.map(Box::new).map(Expr::Name),
array, array,
@ -2050,7 +2048,6 @@ fn possible_operands(i: &mut TokenSlice) -> PResult<Expr> {
bool_value.map(Expr::Literal), bool_value.map(Expr::Literal),
member_expression.map(Box::new).map(Expr::MemberExpression), member_expression.map(Box::new).map(Expr::MemberExpression),
literal.map(Expr::Literal), literal.map(Expr::Literal),
fn_call.map(Box::new).map(Expr::CallExpression),
fn_call_kw.map(Box::new).map(Expr::CallExpressionKw), fn_call_kw.map(Box::new).map(Expr::CallExpressionKw),
name.map(Box::new).map(Expr::Name), name.map(Box::new).map(Expr::Name),
binary_expr_in_parens.map(Box::new).map(Expr::BinaryExpression), binary_expr_in_parens.map(Box::new).map(Expr::BinaryExpression),
@ -2711,13 +2708,6 @@ fn pipe_sep(i: &mut TokenSlice) -> PResult<()> {
Ok(()) Ok(())
} }
/// Arguments are passed into a function.
fn arguments(i: &mut TokenSlice) -> PResult<Vec<Expr>> {
separated(0.., expression, comma_sep)
.context(expected("function arguments"))
.parse_next(i)
}
fn labeled_argument(i: &mut TokenSlice) -> PResult<LabeledArg> { fn labeled_argument(i: &mut TokenSlice) -> PResult<LabeledArg> {
separated_pair( separated_pair(
terminated(nameable_identifier, opt(whitespace)), terminated(nameable_identifier, opt(whitespace)),
@ -2986,11 +2976,7 @@ fn binding_name(i: &mut TokenSlice) -> PResult<Node<Identifier>> {
/// Either a positional or keyword function call. /// Either a positional or keyword function call.
fn fn_call_pos_or_kw(i: &mut TokenSlice) -> PResult<Expr> { fn fn_call_pos_or_kw(i: &mut TokenSlice) -> PResult<Expr> {
alt(( alt((fn_call_kw.map(Box::new).map(Expr::CallExpressionKw),)).parse_next(i)
fn_call.map(Box::new).map(Expr::CallExpression),
fn_call_kw.map(Box::new).map(Expr::CallExpressionKw),
))
.parse_next(i)
} }
fn labelled_fn_call(i: &mut TokenSlice) -> PResult<Expr> { fn labelled_fn_call(i: &mut TokenSlice) -> PResult<Expr> {
@ -3003,43 +2989,6 @@ fn labelled_fn_call(i: &mut TokenSlice) -> PResult<Expr> {
} }
} }
fn fn_call(i: &mut TokenSlice) -> PResult<Node<CallExpression>> {
let fn_name = name(i)?;
opt(whitespace).parse_next(i)?;
let _ = terminated(open_paren, opt(whitespace)).parse_next(i)?;
let args = arguments(i)?;
let end = preceded(opt(whitespace), close_paren).parse_next(i)?.end;
let result = Node::new_node(
fn_name.start,
end,
fn_name.module_id,
CallExpression {
callee: fn_name,
arguments: args,
digest: None,
},
);
let callee_str = result.callee.name.name.to_string();
if let Some(suggestion) = super::deprecation(&callee_str, DeprecationKind::Function) {
ParseContext::warn(
CompilationError::err(
result.as_source_range(),
format!("Calling `{}` is deprecated, prefer using `{}`.", callee_str, suggestion),
)
.with_suggestion(
format!("Replace `{}` with `{}`", callee_str, suggestion),
suggestion,
None,
Tag::Deprecated,
),
);
}
Ok(result)
}
fn fn_call_kw(i: &mut TokenSlice) -> PResult<Node<CallExpressionKw>> { fn fn_call_kw(i: &mut TokenSlice) -> PResult<Node<CallExpressionKw>> {
let fn_name = name(i)?; let fn_name = name(i)?;
opt(whitespace).parse_next(i)?; opt(whitespace).parse_next(i)?;
@ -3231,18 +3180,6 @@ mod tests {
assert_reserved("import"); assert_reserved("import");
} }
#[test]
fn parse_args() {
for (i, (test, expected_len)) in [("someVar", 1), ("5, 3", 2), (r#""a""#, 1)].into_iter().enumerate() {
let tokens = crate::parsing::token::lex(test, ModuleId::default()).unwrap();
let actual = match arguments.parse(tokens.as_slice()) {
Ok(x) => x,
Err(e) => panic!("Failed test {i}, could not parse function arguments from \"{test}\": {e:?}"),
};
assert_eq!(actual.len(), expected_len, "failed test {i}");
}
}
#[test] #[test]
fn parse_names() { fn parse_names() {
for (test, expected_len) in [("someVar", 0), ("::foo", 0), ("foo::bar::baz", 2)] { for (test, expected_len) in [("someVar", 0), ("::foo", 0), ("foo::bar::baz", 2)] {

View File

@ -19,24 +19,6 @@ expression: actual
"init": { "init": {
"body": [ "body": [
{ {
"arguments": [
{
"abs_path": false,
"commentStart": 26,
"end": 28,
"name": {
"commentStart": 26,
"end": 28,
"name": "XY",
"start": 26,
"type": "Identifier"
},
"path": [],
"start": 26,
"type": "Name",
"type": "Name"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 12, "commentStart": 12,
@ -55,8 +37,24 @@ expression: actual
"commentStart": 12, "commentStart": 12,
"end": 29, "end": 29,
"start": 12, "start": 12,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 26,
"end": 28,
"name": {
"commentStart": 26,
"end": 28,
"name": "XY",
"start": 26,
"type": "Identifier"
},
"path": [],
"start": 26,
"type": "Name",
"type": "Name"
}
}, },
{ {
"arguments": [ "arguments": [

View File

@ -63,7 +63,6 @@ expression: actual
"commentStart": 56, "commentStart": 56,
"end": 74, "end": 74,
"expression": { "expression": {
"arguments": [],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 56, "commentStart": 56,
@ -82,8 +81,9 @@ expression: actual
"commentStart": 56, "commentStart": 56,
"end": 74, "end": 74,
"start": 56, "start": 56,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": null
}, },
"start": 56, "start": 56,
"type": "ExpressionStatement", "type": "ExpressionStatement",

View File

@ -71,17 +71,6 @@ expression: actual
"commentStart": 48, "commentStart": 48,
"end": 60, "end": 60,
"expression": { "expression": {
"arguments": [
{
"commentStart": 54,
"end": 59,
"raw": "false",
"start": 54,
"type": "Literal",
"type": "Literal",
"value": false
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 48, "commentStart": 48,
@ -100,8 +89,17 @@ expression: actual
"commentStart": 48, "commentStart": 48,
"end": 60, "end": 60,
"start": 48, "start": 48,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"commentStart": 54,
"end": 59,
"raw": "false",
"start": 54,
"type": "Literal",
"type": "Literal",
"value": false
}
}, },
"start": 48, "start": 48,
"type": "ExpressionStatement", "type": "ExpressionStatement",

View File

@ -19,24 +19,6 @@ expression: actual
"init": { "init": {
"body": [ "body": [
{ {
"arguments": [
{
"abs_path": false,
"commentStart": 25,
"end": 27,
"name": {
"commentStart": 25,
"end": 27,
"name": "XY",
"start": 25,
"type": "Identifier"
},
"path": [],
"start": 25,
"type": "Name",
"type": "Name"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 11, "commentStart": 11,
@ -55,8 +37,24 @@ expression: actual
"commentStart": 11, "commentStart": 11,
"end": 28, "end": 28,
"start": 11, "start": 11,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 25,
"end": 27,
"name": {
"commentStart": 25,
"end": 27,
"name": "XY",
"start": 25,
"type": "Identifier"
},
"path": [],
"start": 25,
"type": "Name",
"type": "Name"
}
}, },
{ {
"arguments": [ "arguments": [
@ -367,7 +365,6 @@ expression: actual
"unlabeled": null "unlabeled": null
}, },
{ {
"arguments": [],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 223, "commentStart": 223,
@ -386,8 +383,9 @@ expression: actual
"commentStart": 223, "commentStart": 223,
"end": 230, "end": 230,
"start": 223, "start": 223,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": null
} }
], ],
"commentStart": 11, "commentStart": 11,

View File

@ -19,24 +19,6 @@ expression: actual
"init": { "init": {
"body": [ "body": [
{ {
"arguments": [
{
"abs_path": false,
"commentStart": 25,
"end": 27,
"name": {
"commentStart": 25,
"end": 27,
"name": "XY",
"start": 25,
"type": "Identifier"
},
"path": [],
"start": 25,
"type": "Name",
"type": "Name"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 11, "commentStart": 11,
@ -55,8 +37,24 @@ expression: actual
"commentStart": 11, "commentStart": 11,
"end": 28, "end": 28,
"start": 11, "start": 11,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 25,
"end": 27,
"name": {
"commentStart": 25,
"end": 27,
"name": "XY",
"start": 25,
"type": "Identifier"
},
"path": [],
"start": 25,
"type": "Name",
"type": "Name"
}
}, },
{ {
"arguments": [ "arguments": [
@ -195,7 +193,6 @@ expression: actual
"unlabeled": null "unlabeled": null
}, },
{ {
"arguments": [],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 90, "commentStart": 90,
@ -214,8 +211,9 @@ expression: actual
"commentStart": 90, "commentStart": 90,
"end": 97, "end": 97,
"start": 90, "start": 90,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": null
} }
], ],
"commentStart": 11, "commentStart": 11,

View File

@ -19,24 +19,6 @@ expression: actual
"init": { "init": {
"body": [ "body": [
{ {
"arguments": [
{
"abs_path": false,
"commentStart": 22,
"end": 24,
"name": {
"commentStart": 22,
"end": 24,
"name": "XY",
"start": 22,
"type": "Identifier"
},
"path": [],
"start": 22,
"type": "Name",
"type": "Name"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 8, "commentStart": 8,
@ -55,8 +37,24 @@ expression: actual
"commentStart": 8, "commentStart": 8,
"end": 25, "end": 25,
"start": 8, "start": 8,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 22,
"end": 24,
"name": {
"commentStart": 22,
"end": 24,
"name": "XY",
"start": 22,
"type": "Identifier"
},
"path": [],
"start": 22,
"type": "Name",
"type": "Name"
}
}, },
{ {
"arguments": [ "arguments": [

View File

@ -19,20 +19,6 @@ expression: actual
"init": { "init": {
"body": [ "body": [
{ {
"arguments": [
{
"commentStart": 10,
"end": 11,
"raw": "1",
"start": 10,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 8, "commentStart": 8,
@ -51,24 +37,22 @@ expression: actual
"commentStart": 8, "commentStart": 8,
"end": 12, "end": 12,
"start": 8, "start": 8,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"commentStart": 10,
"end": 11,
"raw": "1",
"start": 10,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
}
}, },
{ {
"arguments": [
{
"commentStart": 18,
"end": 19,
"raw": "2",
"start": 18,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 16, "commentStart": 16,
@ -87,8 +71,20 @@ expression: actual
"commentStart": 16, "commentStart": 16,
"end": 20, "end": 20,
"start": 16, "start": 16,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"commentStart": 18,
"end": 19,
"raw": "2",
"start": 18,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
}
} }
], ],
"commentStart": 8, "commentStart": 8,

View File

@ -19,24 +19,6 @@ expression: actual
"init": { "init": {
"body": [ "body": [
{ {
"arguments": [
{
"abs_path": false,
"commentStart": 22,
"end": 24,
"name": {
"commentStart": 22,
"end": 24,
"name": "XY",
"start": 22,
"type": "Identifier"
},
"path": [],
"start": 22,
"type": "Name",
"type": "Name"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 8, "commentStart": 8,
@ -55,8 +37,24 @@ expression: actual
"commentStart": 8, "commentStart": 8,
"end": 25, "end": 25,
"start": 8, "start": 8,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 22,
"end": 24,
"name": {
"commentStart": 22,
"end": 24,
"name": "XY",
"start": 22,
"type": "Identifier"
},
"path": [],
"start": 22,
"type": "Name",
"type": "Name"
}
}, },
{ {
"arguments": [ "arguments": [

View File

@ -19,24 +19,6 @@ expression: actual
"init": { "init": {
"body": [ "body": [
{ {
"arguments": [
{
"abs_path": false,
"commentStart": 25,
"end": 27,
"name": {
"commentStart": 25,
"end": 27,
"name": "XY",
"start": 25,
"type": "Identifier"
},
"path": [],
"start": 25,
"type": "Name",
"type": "Name"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 11, "commentStart": 11,
@ -55,8 +37,24 @@ expression: actual
"commentStart": 11, "commentStart": 11,
"end": 28, "end": 28,
"start": 11, "start": 11,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 25,
"end": 27,
"name": {
"commentStart": 25,
"end": 27,
"name": "XY",
"start": 25,
"type": "Identifier"
},
"path": [],
"start": 25,
"type": "Name",
"type": "Name"
}
}, },
{ {
"arguments": [ "arguments": [

View File

@ -8,45 +8,6 @@ expression: actual
"commentStart": 0, "commentStart": 0,
"end": 12, "end": 12,
"expression": { "expression": {
"arguments": [
{
"commentStart": 5,
"elements": [
{
"commentStart": 6,
"end": 7,
"raw": "0",
"start": 6,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
{
"abs_path": false,
"commentStart": 9,
"end": 10,
"name": {
"commentStart": 9,
"end": 10,
"name": "l",
"start": 9,
"type": "Identifier"
},
"path": [],
"start": 9,
"type": "Name",
"type": "Name"
}
],
"end": 11,
"start": 5,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 0, "commentStart": 0,
@ -65,8 +26,45 @@ expression: actual
"commentStart": 0, "commentStart": 0,
"end": 12, "end": 12,
"start": 0, "start": 0,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"commentStart": 5,
"elements": [
{
"commentStart": 6,
"end": 7,
"raw": "0",
"start": 6,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
{
"abs_path": false,
"commentStart": 9,
"end": 10,
"name": {
"commentStart": 9,
"end": 10,
"name": "l",
"start": 9,
"type": "Identifier"
},
"path": [],
"start": 9,
"type": "Name",
"type": "Name"
}
],
"end": 11,
"start": 5,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}, },
"start": 0, "start": 0,
"type": "ExpressionStatement", "type": "ExpressionStatement",

View File

@ -19,24 +19,6 @@ expression: actual
"init": { "init": {
"body": [ "body": [
{ {
"arguments": [
{
"abs_path": false,
"commentStart": 25,
"end": 27,
"name": {
"commentStart": 25,
"end": 27,
"name": "XY",
"start": 25,
"type": "Identifier"
},
"path": [],
"start": 25,
"type": "Name",
"type": "Name"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 11, "commentStart": 11,
@ -55,8 +37,24 @@ expression: actual
"commentStart": 11, "commentStart": 11,
"end": 28, "end": 28,
"start": 11, "start": 11,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 25,
"end": 27,
"name": {
"commentStart": 25,
"end": 27,
"name": "XY",
"start": 25,
"type": "Identifier"
},
"path": [],
"start": 25,
"type": "Name",
"type": "Name"
}
}, },
{ {
"arguments": [ "arguments": [

View File

@ -32,24 +32,6 @@ expression: actual
{ {
"commentStart": 38, "commentStart": 38,
"cond": { "cond": {
"arguments": [
{
"abs_path": false,
"commentStart": 51,
"end": 57,
"name": {
"commentStart": 51,
"end": 57,
"name": "radius",
"start": 51,
"type": "Identifier"
},
"path": [],
"start": 51,
"type": "Name",
"type": "Name"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 46, "commentStart": 46,
@ -68,8 +50,24 @@ expression: actual
"commentStart": 46, "commentStart": 46,
"end": 58, "end": 58,
"start": 46, "start": 46,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 51,
"end": 57,
"name": {
"commentStart": 51,
"end": 57,
"name": "radius",
"start": 51,
"type": "Identifier"
},
"path": [],
"start": 51,
"type": "Name",
"type": "Name"
}
}, },
"digest": null, "digest": null,
"end": 84, "end": 84,

View File

@ -51,20 +51,6 @@ expression: actual
"type": "BinaryExpression" "type": "BinaryExpression"
}, },
{ {
"arguments": [
{
"commentStart": 24,
"end": 26,
"raw": "45",
"start": 24,
"type": "Literal",
"type": "Literal",
"value": {
"value": 45.0,
"suffix": "None"
}
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 17, "commentStart": 17,
@ -83,8 +69,20 @@ expression: actual
"commentStart": 17, "commentStart": 17,
"end": 27, "end": 27,
"start": 17, "start": 17,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"commentStart": 24,
"end": 26,
"raw": "45",
"start": 24,
"type": "Literal",
"type": "Literal",
"value": {
"value": 45.0,
"suffix": "None"
}
}
} }
], ],
"commentStart": 8, "commentStart": 8,

View File

@ -19,24 +19,6 @@ expression: actual
"init": { "init": {
"body": [ "body": [
{ {
"arguments": [
{
"abs_path": false,
"commentStart": 19,
"end": 21,
"name": {
"commentStart": 19,
"end": 21,
"name": "XY",
"start": 19,
"type": "Identifier"
},
"path": [],
"start": 19,
"type": "Name",
"type": "Name"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 5, "commentStart": 5,
@ -55,28 +37,26 @@ expression: actual
"commentStart": 5, "commentStart": 5,
"end": 22, "end": 22,
"start": 5, "start": 5,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 19,
"end": 21,
"name": {
"commentStart": 19,
"end": 21,
"name": "XY",
"start": 19,
"type": "Identifier"
},
"path": [],
"start": 19,
"type": "Name",
"type": "Name"
}
}, },
{ {
"arguments": [
{
"abs_path": false,
"commentStart": 39,
"end": 42,
"name": {
"commentStart": 39,
"end": 42,
"name": "pos",
"start": 39,
"type": "Identifier"
},
"path": [],
"start": 39,
"type": "Name",
"type": "Name"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 26, "commentStart": 26,
@ -95,8 +75,24 @@ expression: actual
"commentStart": 26, "commentStart": 26,
"end": 43, "end": 43,
"start": 26, "start": 26,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 39,
"end": 42,
"name": {
"commentStart": 39,
"end": 42,
"name": "pos",
"start": 39,
"type": "Identifier"
},
"path": [],
"start": 39,
"type": "Name",
"type": "Name"
}
} }
], ],
"commentStart": 5, "commentStart": 5,

View File

@ -19,24 +19,6 @@ expression: actual
"init": { "init": {
"body": [ "body": [
{ {
"arguments": [
{
"abs_path": false,
"commentStart": 19,
"end": 21,
"name": {
"commentStart": 19,
"end": 21,
"name": "XY",
"start": 19,
"type": "Identifier"
},
"path": [],
"start": 19,
"type": "Name",
"type": "Name"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 5, "commentStart": 5,
@ -55,28 +37,26 @@ expression: actual
"commentStart": 5, "commentStart": 5,
"end": 22, "end": 22,
"start": 5, "start": 5,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 19,
"end": 21,
"name": {
"commentStart": 19,
"end": 21,
"name": "XY",
"start": 19,
"type": "Identifier"
},
"path": [],
"start": 19,
"type": "Name",
"type": "Name"
}
}, },
{ {
"arguments": [
{
"abs_path": false,
"commentStart": 43,
"end": 46,
"name": {
"commentStart": 43,
"end": 46,
"name": "pos",
"start": 43,
"type": "Identifier"
},
"path": [],
"start": 43,
"type": "Name",
"type": "Name"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 30, "commentStart": 30,
@ -95,57 +75,26 @@ expression: actual
"commentStart": 30, "commentStart": 30,
"end": 47, "end": 47,
"start": 30, "start": 30,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 43,
"end": 46,
"name": {
"commentStart": 43,
"end": 46,
"name": "pos",
"start": 43,
"type": "Identifier"
},
"path": [],
"start": 43,
"type": "Name",
"type": "Name"
}
}, },
{ {
"arguments": [
{
"commentStart": 56,
"elements": [
{
"commentStart": 57,
"end": 58,
"raw": "0",
"start": 57,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
{
"argument": {
"abs_path": false,
"commentStart": 61,
"end": 66,
"name": {
"commentStart": 61,
"end": 66,
"name": "scale",
"start": 61,
"type": "Identifier"
},
"path": [],
"start": 61,
"type": "Name",
"type": "Name"
},
"commentStart": 60,
"end": 66,
"operator": "-",
"start": 60,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 67,
"start": 56,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 51, "commentStart": 51,
@ -164,8 +113,53 @@ expression: actual
"commentStart": 51, "commentStart": 51,
"end": 68, "end": 68,
"start": 51, "start": 51,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"commentStart": 56,
"elements": [
{
"commentStart": 57,
"end": 58,
"raw": "0",
"start": 57,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
{
"argument": {
"abs_path": false,
"commentStart": 61,
"end": 66,
"name": {
"commentStart": 61,
"end": 66,
"name": "scale",
"start": 61,
"type": "Identifier"
},
"path": [],
"start": 61,
"type": "Name",
"type": "Name"
},
"commentStart": 60,
"end": 66,
"operator": "-",
"start": 60,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 67,
"start": 56,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
} }
], ],
"commentStart": 5, "commentStart": 5,

View File

@ -527,9 +527,6 @@ pub enum OnboardingStatus {
#[serde(rename = "/export")] #[serde(rename = "/export")]
#[display("/export")] #[display("/export")]
Export, Export,
#[serde(rename = "/move")]
#[display("/move")]
Move,
#[serde(rename = "/sketching")] #[serde(rename = "/sketching")]
#[display("/sketching")] #[display("/sketching")]
Sketching, Sketching,

View File

@ -3,10 +3,10 @@ use std::fmt::Write;
use crate::parsing::{ use crate::parsing::{
ast::types::{ ast::types::{
Annotation, ArrayExpression, ArrayRangeExpression, BinaryExpression, BinaryOperator, BinaryPart, BodyItem, Annotation, ArrayExpression, ArrayRangeExpression, BinaryExpression, BinaryOperator, BinaryPart, BodyItem,
CallExpression, CallExpressionKw, CommentStyle, DefaultParamVal, Expr, FormatOptions, FunctionExpression, CallExpressionKw, CommentStyle, DefaultParamVal, Expr, FormatOptions, FunctionExpression, IfExpression,
IfExpression, ImportSelector, ImportStatement, ItemVisibility, LabeledArg, Literal, LiteralIdentifier, ImportSelector, ImportStatement, ItemVisibility, LabeledArg, Literal, LiteralIdentifier, LiteralValue,
LiteralValue, MemberExpression, MemberObject, Node, NonCodeNode, NonCodeValue, ObjectExpression, Parameter, MemberExpression, MemberObject, Node, NonCodeNode, NonCodeValue, ObjectExpression, Parameter, PipeExpression,
PipeExpression, Program, TagDeclarator, TypeDeclaration, UnaryExpression, VariableDeclaration, VariableKind, Program, TagDeclarator, TypeDeclaration, UnaryExpression, VariableDeclaration, VariableKind,
}, },
deprecation, deprecation,
token::NumericSuffix, token::NumericSuffix,
@ -291,7 +291,6 @@ impl Expr {
result += &func_exp.recast(options, indentation_level); result += &func_exp.recast(options, indentation_level);
result result
} }
Expr::CallExpression(call_exp) => call_exp.recast(options, indentation_level, ctxt),
Expr::CallExpressionKw(call_exp) => call_exp.recast(options, indentation_level, ctxt), Expr::CallExpressionKw(call_exp) => call_exp.recast(options, indentation_level, ctxt),
Expr::Name(name) => { Expr::Name(name) => {
let result = name.to_string(); let result = name.to_string();
@ -342,9 +341,6 @@ impl BinaryPart {
} }
} }
BinaryPart::BinaryExpression(binary_expression) => binary_expression.recast(options), BinaryPart::BinaryExpression(binary_expression) => binary_expression.recast(options),
BinaryPart::CallExpression(call_expression) => {
call_expression.recast(options, indentation_level, ExprContext::Other)
}
BinaryPart::CallExpressionKw(call_expression) => { BinaryPart::CallExpressionKw(call_expression) => {
call_expression.recast(options, indentation_level, ExprContext::Other) call_expression.recast(options, indentation_level, ExprContext::Other)
} }
@ -355,29 +351,10 @@ impl BinaryPart {
} }
} }
impl CallExpression {
fn recast(&self, options: &FormatOptions, indentation_level: usize, ctxt: ExprContext) -> String {
format!(
"{}{}({})",
if ctxt == ExprContext::Pipe {
"".to_string()
} else {
options.get_indentation(indentation_level)
},
self.callee,
self.arguments
.iter()
.map(|arg| arg.recast(options, indentation_level, ctxt))
.collect::<Vec<String>>()
.join(", ")
)
}
}
impl CallExpressionKw { impl CallExpressionKw {
fn recast_args(&self, options: &FormatOptions, indentation_level: usize, ctxt: ExprContext) -> Vec<String> { fn recast_args(&self, options: &FormatOptions, indentation_level: usize, ctxt: ExprContext) -> Vec<String> {
let mut arg_list = if let Some(first_arg) = &self.unlabeled { let mut arg_list = if let Some(first_arg) = &self.unlabeled {
vec![first_arg.recast(options, indentation_level, ctxt)] vec![first_arg.recast(options, indentation_level, ctxt).trim().to_owned()]
} else { } else {
Vec::with_capacity(self.arguments.len()) Vec::with_capacity(self.arguments.len())
}; };
@ -748,8 +725,7 @@ impl UnaryExpression {
| BinaryPart::Name(_) | BinaryPart::Name(_)
| BinaryPart::MemberExpression(_) | BinaryPart::MemberExpression(_)
| BinaryPart::IfExpression(_) | BinaryPart::IfExpression(_)
| BinaryPart::CallExpressionKw(_) | BinaryPart::CallExpressionKw(_) => {
| BinaryPart::CallExpression(_) => {
format!("{}{}", &self.operator, self.argument.recast(options, 0)) format!("{}{}", &self.operator, self.argument.recast(options, 0))
} }
BinaryPart::BinaryExpression(_) | BinaryPart::UnaryExpression(_) => { BinaryPart::BinaryExpression(_) | BinaryPart::UnaryExpression(_) => {
@ -2584,6 +2560,58 @@ sketch002 = startSketchOn({
assert_eq!(actual, input); assert_eq!(actual, input);
} }
#[test]
fn unparse_call_inside_function_single_line() {
let input = r#"fn foo() {
toDegrees(atan(0.5), foo = 1)
return 0
}
"#;
let ast = crate::parsing::top_level_parse(input).unwrap();
let actual = ast.recast(&FormatOptions::new(), 0);
assert_eq!(actual, input);
}
#[test]
fn unparse_call_inside_function_args_multiple_lines() {
let input = r#"fn foo() {
toDegrees(
atan(0.5),
foo = 1,
bar = 2,
baz = 3,
qux = 4,
)
return 0
}
"#;
let ast = crate::parsing::top_level_parse(input).unwrap();
let actual = ast.recast(&FormatOptions::new(), 0);
assert_eq!(actual, input);
}
#[test]
fn unparse_call_inside_function_single_arg_multiple_lines() {
let input = r#"fn foo() {
toDegrees(
[
profile0,
profile1,
profile2,
profile3,
profile4,
profile5
],
key = 1,
)
return 0
}
"#;
let ast = crate::parsing::top_level_parse(input).unwrap();
let actual = ast.recast(&FormatOptions::new(), 0);
assert_eq!(actual, input);
}
#[test] #[test]
fn recast_objects_with_comments() { fn recast_objects_with_comments() {
use winnow::Parser; use winnow::Parser;

View File

@ -23,7 +23,6 @@ pub enum Node<'a> {
Name(NodeRef<'a, types::Name>), Name(NodeRef<'a, types::Name>),
BinaryExpression(NodeRef<'a, types::BinaryExpression>), BinaryExpression(NodeRef<'a, types::BinaryExpression>),
FunctionExpression(NodeRef<'a, types::FunctionExpression>), FunctionExpression(NodeRef<'a, types::FunctionExpression>),
CallExpression(NodeRef<'a, types::CallExpression>),
CallExpressionKw(NodeRef<'a, types::CallExpressionKw>), CallExpressionKw(NodeRef<'a, types::CallExpressionKw>),
PipeExpression(NodeRef<'a, types::PipeExpression>), PipeExpression(NodeRef<'a, types::PipeExpression>),
PipeSubstitution(NodeRef<'a, types::PipeSubstitution>), PipeSubstitution(NodeRef<'a, types::PipeSubstitution>),
@ -64,7 +63,6 @@ impl Node<'_> {
Node::Name(n) => n.digest, Node::Name(n) => n.digest,
Node::BinaryExpression(n) => n.digest, Node::BinaryExpression(n) => n.digest,
Node::FunctionExpression(n) => n.digest, Node::FunctionExpression(n) => n.digest,
Node::CallExpression(n) => n.digest,
Node::CallExpressionKw(n) => n.digest, Node::CallExpressionKw(n) => n.digest,
Node::PipeExpression(n) => n.digest, Node::PipeExpression(n) => n.digest,
Node::PipeSubstitution(n) => n.digest, Node::PipeSubstitution(n) => n.digest,
@ -109,7 +107,6 @@ impl Node<'_> {
Node::Name(n) => *n as *const _ as *const (), Node::Name(n) => *n as *const _ as *const (),
Node::BinaryExpression(n) => *n as *const _ as *const (), Node::BinaryExpression(n) => *n as *const _ as *const (),
Node::FunctionExpression(n) => *n as *const _ as *const (), Node::FunctionExpression(n) => *n as *const _ as *const (),
Node::CallExpression(n) => *n as *const _ as *const (),
Node::CallExpressionKw(n) => *n as *const _ as *const (), Node::CallExpressionKw(n) => *n as *const _ as *const (),
Node::PipeExpression(n) => *n as *const _ as *const (), Node::PipeExpression(n) => *n as *const _ as *const (),
Node::PipeSubstitution(n) => *n as *const _ as *const (), Node::PipeSubstitution(n) => *n as *const _ as *const (),
@ -154,7 +151,6 @@ impl TryFrom<&Node<'_>> for SourceRange {
Node::Name(n) => SourceRange::from(*n), Node::Name(n) => SourceRange::from(*n),
Node::BinaryExpression(n) => SourceRange::from(*n), Node::BinaryExpression(n) => SourceRange::from(*n),
Node::FunctionExpression(n) => SourceRange::from(*n), Node::FunctionExpression(n) => SourceRange::from(*n),
Node::CallExpression(n) => SourceRange::from(*n),
Node::CallExpressionKw(n) => SourceRange::from(*n), Node::CallExpressionKw(n) => SourceRange::from(*n),
Node::PipeExpression(n) => SourceRange::from(*n), Node::PipeExpression(n) => SourceRange::from(*n),
Node::PipeSubstitution(n) => SourceRange::from(*n), Node::PipeSubstitution(n) => SourceRange::from(*n),
@ -199,7 +195,6 @@ impl<'tree> From<&'tree types::Expr> for Node<'tree> {
types::Expr::Name(id) => id.as_ref().into(), types::Expr::Name(id) => id.as_ref().into(),
types::Expr::BinaryExpression(be) => be.as_ref().into(), types::Expr::BinaryExpression(be) => be.as_ref().into(),
types::Expr::FunctionExpression(fe) => fe.as_ref().into(), types::Expr::FunctionExpression(fe) => fe.as_ref().into(),
types::Expr::CallExpression(ce) => ce.as_ref().into(),
types::Expr::CallExpressionKw(ce) => ce.as_ref().into(), types::Expr::CallExpressionKw(ce) => ce.as_ref().into(),
types::Expr::PipeExpression(pe) => pe.as_ref().into(), types::Expr::PipeExpression(pe) => pe.as_ref().into(),
types::Expr::PipeSubstitution(ps) => ps.as_ref().into(), types::Expr::PipeSubstitution(ps) => ps.as_ref().into(),
@ -222,7 +217,6 @@ impl<'tree> From<&'tree types::BinaryPart> for Node<'tree> {
types::BinaryPart::Literal(lit) => lit.as_ref().into(), types::BinaryPart::Literal(lit) => lit.as_ref().into(),
types::BinaryPart::Name(id) => id.as_ref().into(), types::BinaryPart::Name(id) => id.as_ref().into(),
types::BinaryPart::BinaryExpression(be) => be.as_ref().into(), types::BinaryPart::BinaryExpression(be) => be.as_ref().into(),
types::BinaryPart::CallExpression(ce) => ce.as_ref().into(),
types::BinaryPart::CallExpressionKw(ce) => ce.as_ref().into(), types::BinaryPart::CallExpressionKw(ce) => ce.as_ref().into(),
types::BinaryPart::UnaryExpression(ue) => ue.as_ref().into(), types::BinaryPart::UnaryExpression(ue) => ue.as_ref().into(),
types::BinaryPart::MemberExpression(me) => me.as_ref().into(), types::BinaryPart::MemberExpression(me) => me.as_ref().into(),
@ -282,7 +276,6 @@ impl_from!(Node, Identifier);
impl_from!(Node, Name); impl_from!(Node, Name);
impl_from!(Node, BinaryExpression); impl_from!(Node, BinaryExpression);
impl_from!(Node, FunctionExpression); impl_from!(Node, FunctionExpression);
impl_from!(Node, CallExpression);
impl_from!(Node, CallExpressionKw); impl_from!(Node, CallExpressionKw);
impl_from!(Node, PipeExpression); impl_from!(Node, PipeExpression);
impl_from!(Node, PipeSubstitution); impl_from!(Node, PipeSubstitution);

View File

@ -78,19 +78,17 @@ impl<'tree> Visitable<'tree> for Node<'tree> {
children.push((&n.body).into()); children.push((&n.body).into());
children children
} }
Node::CallExpression(n) => {
let mut children = n.arguments.iter().map(|v| v.into()).collect::<Vec<Node>>();
children.insert(0, (&n.callee).into());
children
}
Node::CallExpressionKw(n) => { Node::CallExpressionKw(n) => {
let mut children = n.unlabeled.iter().map(|v| v.into()).collect::<Vec<Node>>(); let mut children: Vec<Node<'_>> =
Vec::with_capacity(1 + if n.unlabeled.is_some() { 1 } else { 0 } + n.arguments.len());
children.push((&n.callee).into());
children.extend(n.unlabeled.iter().map(Node::from));
// TODO: this is wrong but it's what the old walk code was doing. // TODO: this is wrong but it's what the old walk code was doing.
// We likely need a real LabeledArg AST node, but I don't // We likely need a real LabeledArg AST node, but I don't
// want to tango with it since it's a lot deeper than // want to tango with it since it's a lot deeper than
// adding it to the enum. // adding it to the enum.
children.extend(n.arguments.iter().map(|v| (&v.arg).into()).collect::<Vec<Node>>()); children.extend(n.arguments.iter().map(|v| Node::from(&v.arg)));
children children
} }
Node::PipeExpression(n) => n.body.iter().map(|v| v.into()).collect(), Node::PipeExpression(n) => n.body.iter().map(|v| v.into()).collect(),

View File

@ -21,8 +21,9 @@ type Dependency = (String, String);
type Graph = Vec<Dependency>; type Graph = Vec<Dependency>;
type DependencyInfo = (AstNode<ImportStatement>, ModuleId, ModulePath, ModuleRepr); pub(crate) type DependencyInfo = (AstNode<ImportStatement>, ModuleId, ModulePath, ModuleRepr);
type Universe = HashMap<String, DependencyInfo>; pub(crate) type UniverseMap = HashMap<PathBuf, AstNode<ImportStatement>>;
pub(crate) type Universe = HashMap<String, DependencyInfo>;
/// Process a number of programs, returning the graph of dependencies. /// Process a number of programs, returning the graph of dependencies.
/// ///
@ -184,7 +185,7 @@ pub(crate) async fn import_universe(
repr: &ModuleRepr, repr: &ModuleRepr,
out: &mut Universe, out: &mut Universe,
exec_state: &mut ExecState, exec_state: &mut ExecState,
) -> Result<HashMap<PathBuf, crate::parsing::ast::types::Node<ImportStatement>>, KclError> { ) -> Result<UniverseMap, KclError> {
let modules = import_dependencies(repr, ctx)?; let modules = import_dependencies(repr, ctx)?;
let mut module_imports = HashMap::new(); let mut module_imports = HashMap::new();
for (filename, import_stmt, module_path) in modules { for (filename, import_stmt, module_path) in modules {

View File

@ -9,4 +9,4 @@ pub use ast_node::Node;
pub use ast_visitor::Visitable; pub use ast_visitor::Visitable;
pub use ast_walk::walk; pub use ast_walk::walk;
pub use import_graph::import_graph; pub use import_graph::import_graph;
pub(crate) use import_graph::import_universe; pub(crate) use import_graph::{import_universe, Universe, UniverseMap};

View File

@ -61,7 +61,7 @@ export type string
/// tagged object. The syntax for this is `myTag`. /// tagged object. The syntax for this is `myTag`.
/// ///
/// In the example above we use the tag identifier to get the angle of the segment /// In the example above we use the tag identifier to get the angle of the segment
/// `segAng(rectangleSegmentA001, %)`. /// `segAng(rectangleSegmentA001)`.
/// ///
/// ### Tag Scope /// ### Tag Scope
/// ///
@ -107,11 +107,13 @@ export type string
/// |> angledLine( /// |> angledLine(
/// angle = segAng(rectangleSegmentA001) - 90, /// angle = segAng(rectangleSegmentA001) - 90,
/// length = 196.99 /// length = 196.99
/// , %, $rectangleSegmentB001) /// tag = $rectangleSegmentB001,
/// )
/// |> angledLine( /// |> angledLine(
/// angle = segAng(rectangleSegmentA001), /// angle = segAng(rectangleSegmentA001),
/// length = -segLen(rectangleSegmentA001) /// length = -segLen(rectangleSegmentA001)
/// , %, $rectangleSegmentC001) /// tag = $rectangleSegmentC001,
/// )
/// |> line(endAbsolute = [profileStartX(%), profileStartY(%)]) /// |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
/// |> close() /// |> close()
/// } /// }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -20,24 +20,6 @@ description: Result of parsing angled_line.kcl
"init": { "init": {
"body": [ "body": [
{ {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "XY",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 0, "commentStart": 0,
@ -56,8 +38,24 @@ description: Result of parsing angled_line.kcl
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"start": 0, "start": 0,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "XY",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
}, },
{ {
"arguments": [ "arguments": [
@ -385,24 +383,6 @@ description: Result of parsing angled_line.kcl
"type": "Identifier" "type": "Identifier"
}, },
"arg": { "arg": {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "seg01",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 0, "commentStart": 0,
@ -421,8 +401,24 @@ description: Result of parsing angled_line.kcl
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"start": 0, "start": 0,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "seg01",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
} }
}, },
{ {
@ -547,7 +543,6 @@ description: Result of parsing angled_line.kcl
"unlabeled": null "unlabeled": null
}, },
{ {
"arguments": [],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 0, "commentStart": 0,
@ -566,8 +561,9 @@ description: Result of parsing angled_line.kcl
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"start": 0, "start": 0,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": null
}, },
{ {
"arguments": [ "arguments": [

View File

@ -4,19 +4,17 @@ description: Operations executed angled_line.kcl
--- ---
[ [
{ {
"labeledArgs": { "labeledArgs": {},
"planeOrSolid": {
"value": {
"type": "Plane",
"artifact_id": "[uuid]"
},
"sourceRange": []
}
},
"name": "startSketchOn", "name": "startSketchOn",
"sourceRange": [], "sourceRange": [],
"type": "StdLibCall", "type": "StdLibCall",
"unlabeledArg": null "unlabeledArg": {
"value": {
"type": "Plane",
"artifact_id": "[uuid]"
},
"sourceRange": []
}
}, },
{ {
"labeledArgs": { "labeledArgs": {

View File

@ -84,24 +84,6 @@ description: Result of parsing array_elem_pop.kcl
"type": "Identifier" "type": "Identifier"
}, },
"init": { "init": {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "arr",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 0, "commentStart": 0,
@ -120,8 +102,24 @@ description: Result of parsing array_elem_pop.kcl
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"start": 0, "start": 0,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "arr",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
}, },
"start": 0, "start": 0,
"type": "VariableDeclarator" "type": "VariableDeclarator"
@ -145,24 +143,6 @@ description: Result of parsing array_elem_pop.kcl
"type": "Identifier" "type": "Identifier"
}, },
"init": { "init": {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "new_arr1",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 0, "commentStart": 0,
@ -181,8 +161,24 @@ description: Result of parsing array_elem_pop.kcl
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"start": 0, "start": 0,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "new_arr1",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
}, },
"start": 0, "start": 0,
"type": "VariableDeclarator" "type": "VariableDeclarator"
@ -206,24 +202,6 @@ description: Result of parsing array_elem_pop.kcl
"type": "Identifier" "type": "Identifier"
}, },
"init": { "init": {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "new_arr2",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 0, "commentStart": 0,
@ -242,8 +220,24 @@ description: Result of parsing array_elem_pop.kcl
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"start": 0, "start": 0,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "new_arr2",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
}, },
"start": 0, "start": 0,
"type": "VariableDeclarator" "type": "VariableDeclarator"

View File

@ -47,24 +47,6 @@ description: Result of parsing array_elem_pop_empty_fail.kcl
"type": "Identifier" "type": "Identifier"
}, },
"init": { "init": {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "arr",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 0, "commentStart": 0,
@ -83,8 +65,24 @@ description: Result of parsing array_elem_pop_empty_fail.kcl
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"start": 0, "start": 0,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "arr",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
}, },
"start": 0, "start": 0,
"type": "VariableDeclarator" "type": "VariableDeclarator"

View File

@ -84,24 +84,6 @@ description: Result of parsing array_elem_pop_fail.kcl
"type": "Identifier" "type": "Identifier"
}, },
"init": { "init": {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "arr",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 0, "commentStart": 0,
@ -120,8 +102,24 @@ description: Result of parsing array_elem_pop_fail.kcl
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"start": 0, "start": 0,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "arr",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
}, },
"start": 0, "start": 0,
"type": "VariableDeclarator" "type": "VariableDeclarator"

View File

@ -20,24 +20,6 @@ description: Result of parsing artifact_graph_example_code1.kcl
"init": { "init": {
"body": [ "body": [
{ {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "XY",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 0, "commentStart": 0,
@ -56,8 +38,24 @@ description: Result of parsing artifact_graph_example_code1.kcl
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"start": 0, "start": 0,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "XY",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
}, },
{ {
"arguments": [ "arguments": [
@ -406,15 +404,6 @@ description: Result of parsing artifact_graph_example_code1.kcl
"commentStart": 0, "commentStart": 0,
"elements": [ "elements": [
{ {
"arguments": [
{
"commentStart": 0,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 0, "commentStart": 0,
@ -433,19 +422,17 @@ description: Result of parsing artifact_graph_example_code1.kcl
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"start": 0, "start": 0,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"commentStart": 0,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
}, },
{ {
"arguments": [
{
"commentStart": 0,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 0, "commentStart": 0,
@ -464,8 +451,15 @@ description: Result of parsing artifact_graph_example_code1.kcl
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"start": 0, "start": 0,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"commentStart": 0,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
} }
], ],
"end": 0, "end": 0,
@ -498,7 +492,6 @@ description: Result of parsing artifact_graph_example_code1.kcl
"unlabeled": null "unlabeled": null
}, },
{ {
"arguments": [],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 0, "commentStart": 0,
@ -517,8 +510,9 @@ description: Result of parsing artifact_graph_example_code1.kcl
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"start": 0, "start": 0,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": null
} }
], ],
"commentStart": 0, "commentStart": 0,
@ -1041,15 +1035,6 @@ description: Result of parsing artifact_graph_example_code1.kcl
"commentStart": 0, "commentStart": 0,
"elements": [ "elements": [
{ {
"arguments": [
{
"commentStart": 0,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 0, "commentStart": 0,
@ -1068,19 +1053,17 @@ description: Result of parsing artifact_graph_example_code1.kcl
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"start": 0, "start": 0,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"commentStart": 0,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
}, },
{ {
"arguments": [
{
"commentStart": 0,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 0, "commentStart": 0,
@ -1099,8 +1082,15 @@ description: Result of parsing artifact_graph_example_code1.kcl
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"start": 0, "start": 0,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"commentStart": 0,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
} }
], ],
"end": 0, "end": 0,
@ -1133,7 +1123,6 @@ description: Result of parsing artifact_graph_example_code1.kcl
"unlabeled": null "unlabeled": null
}, },
{ {
"arguments": [],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 0, "commentStart": 0,
@ -1152,8 +1141,9 @@ description: Result of parsing artifact_graph_example_code1.kcl
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"start": 0, "start": 0,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": null
} }
], ],
"commentStart": 0, "commentStart": 0,

View File

@ -4,19 +4,17 @@ description: Operations executed artifact_graph_example_code1.kcl
--- ---
[ [
{ {
"labeledArgs": { "labeledArgs": {},
"planeOrSolid": {
"value": {
"type": "Plane",
"artifact_id": "[uuid]"
},
"sourceRange": []
}
},
"name": "startSketchOn", "name": "startSketchOn",
"sourceRange": [], "sourceRange": [],
"type": "StdLibCall", "type": "StdLibCall",
"unlabeledArg": null "unlabeledArg": {
"value": {
"type": "Plane",
"artifact_id": "[uuid]"
},
"sourceRange": []
}
}, },
{ {
"labeledArgs": { "labeledArgs": {

View File

@ -20,24 +20,6 @@ description: Result of parsing artifact_graph_example_code_no_3d.kcl
"init": { "init": {
"body": [ "body": [
{ {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "YZ",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 0, "commentStart": 0,
@ -56,8 +38,24 @@ description: Result of parsing artifact_graph_example_code_no_3d.kcl
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"start": 0, "start": 0,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "YZ",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
}, },
{ {
"arguments": [ "arguments": [
@ -229,24 +227,6 @@ description: Result of parsing artifact_graph_example_code_no_3d.kcl
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"left": { "left": {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "rectangleSegmentA001",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 0, "commentStart": 0,
@ -265,8 +245,24 @@ description: Result of parsing artifact_graph_example_code_no_3d.kcl
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"start": 0, "start": 0,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "rectangleSegmentA001",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
}, },
"operator": "-", "operator": "-",
"right": { "right": {
@ -361,24 +357,6 @@ description: Result of parsing artifact_graph_example_code_no_3d.kcl
"type": "Identifier" "type": "Identifier"
}, },
"arg": { "arg": {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "rectangleSegmentA001",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 0, "commentStart": 0,
@ -397,8 +375,24 @@ description: Result of parsing artifact_graph_example_code_no_3d.kcl
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"start": 0, "start": 0,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "rectangleSegmentA001",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
} }
}, },
{ {
@ -412,24 +406,6 @@ description: Result of parsing artifact_graph_example_code_no_3d.kcl
}, },
"arg": { "arg": {
"argument": { "argument": {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "rectangleSegmentA001",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 0, "commentStart": 0,
@ -448,8 +424,24 @@ description: Result of parsing artifact_graph_example_code_no_3d.kcl
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"start": 0, "start": 0,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "rectangleSegmentA001",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
}, },
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
@ -515,15 +507,6 @@ description: Result of parsing artifact_graph_example_code_no_3d.kcl
"commentStart": 0, "commentStart": 0,
"elements": [ "elements": [
{ {
"arguments": [
{
"commentStart": 0,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 0, "commentStart": 0,
@ -542,19 +525,17 @@ description: Result of parsing artifact_graph_example_code_no_3d.kcl
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"start": 0, "start": 0,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"commentStart": 0,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
}, },
{ {
"arguments": [
{
"commentStart": 0,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 0, "commentStart": 0,
@ -573,8 +554,15 @@ description: Result of parsing artifact_graph_example_code_no_3d.kcl
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"start": 0, "start": 0,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"commentStart": 0,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
} }
], ],
"end": 0, "end": 0,
@ -607,7 +595,6 @@ description: Result of parsing artifact_graph_example_code_no_3d.kcl
"unlabeled": null "unlabeled": null
}, },
{ {
"arguments": [],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 0, "commentStart": 0,
@ -626,8 +613,9 @@ description: Result of parsing artifact_graph_example_code_no_3d.kcl
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"start": 0, "start": 0,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": null
} }
], ],
"commentStart": 0, "commentStart": 0,
@ -660,32 +648,6 @@ description: Result of parsing artifact_graph_example_code_no_3d.kcl
"init": { "init": {
"body": [ "body": [
{ {
"arguments": [
{
"argument": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "XZ",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"commentStart": 0,
"end": 0,
"operator": "-",
"start": 0,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 0, "commentStart": 0,
@ -704,8 +666,32 @@ description: Result of parsing artifact_graph_example_code_no_3d.kcl
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"start": 0, "start": 0,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"argument": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "XZ",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"commentStart": 0,
"end": 0,
"operator": "-",
"start": 0,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
}, },
{ {
"arguments": [ "arguments": [

View File

@ -4,33 +4,29 @@ description: Operations executed artifact_graph_example_code_no_3d.kcl
--- ---
[ [
{ {
"labeledArgs": { "labeledArgs": {},
"planeOrSolid": {
"value": {
"type": "Plane",
"artifact_id": "[uuid]"
},
"sourceRange": []
}
},
"name": "startSketchOn", "name": "startSketchOn",
"sourceRange": [], "sourceRange": [],
"type": "StdLibCall", "type": "StdLibCall",
"unlabeledArg": null "unlabeledArg": {
"value": {
"type": "Plane",
"artifact_id": "[uuid]"
},
"sourceRange": []
}
}, },
{ {
"labeledArgs": { "labeledArgs": {},
"planeOrSolid": {
"value": {
"type": "Plane",
"artifact_id": "[uuid]"
},
"sourceRange": []
}
},
"name": "startSketchOn", "name": "startSketchOn",
"sourceRange": [], "sourceRange": [],
"type": "StdLibCall", "type": "StdLibCall",
"unlabeledArg": null "unlabeledArg": {
"value": {
"type": "Plane",
"artifact_id": "[uuid]"
},
"sourceRange": []
}
} }
] ]

View File

@ -277,24 +277,6 @@ description: Result of parsing artifact_graph_example_code_offset_planes.kcl
"init": { "init": {
"body": [ "body": [
{ {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "offsetPlane001",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 0, "commentStart": 0,
@ -313,8 +295,24 @@ description: Result of parsing artifact_graph_example_code_offset_planes.kcl
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"start": 0, "start": 0,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "offsetPlane001",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
}, },
{ {
"arguments": [ "arguments": [

View File

@ -94,18 +94,16 @@ description: Operations executed artifact_graph_example_code_offset_planes.kcl
"sourceRange": [] "sourceRange": []
}, },
{ {
"labeledArgs": { "labeledArgs": {},
"planeOrSolid": {
"value": {
"type": "Plane",
"artifact_id": "[uuid]"
},
"sourceRange": []
}
},
"name": "startSketchOn", "name": "startSketchOn",
"sourceRange": [], "sourceRange": [],
"type": "StdLibCall", "type": "StdLibCall",
"unlabeledArg": null "unlabeledArg": {
"value": {
"type": "Plane",
"artifact_id": "[uuid]"
},
"sourceRange": []
}
} }
] ]

View File

@ -20,24 +20,6 @@ description: Result of parsing artifact_graph_sketch_on_face_etc.kcl
"init": { "init": {
"body": [ "body": [
{ {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "XZ",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 0, "commentStart": 0,
@ -56,8 +38,24 @@ description: Result of parsing artifact_graph_sketch_on_face_etc.kcl
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"start": 0, "start": 0,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "XZ",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
}, },
{ {
"arguments": [ "arguments": [
@ -304,15 +302,6 @@ description: Result of parsing artifact_graph_sketch_on_face_etc.kcl
"commentStart": 0, "commentStart": 0,
"elements": [ "elements": [
{ {
"arguments": [
{
"commentStart": 0,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 0, "commentStart": 0,
@ -331,19 +320,17 @@ description: Result of parsing artifact_graph_sketch_on_face_etc.kcl
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"start": 0, "start": 0,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"commentStart": 0,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
}, },
{ {
"arguments": [
{
"commentStart": 0,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 0, "commentStart": 0,
@ -362,8 +349,15 @@ description: Result of parsing artifact_graph_sketch_on_face_etc.kcl
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"start": 0, "start": 0,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"commentStart": 0,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
} }
], ],
"end": 0, "end": 0,
@ -396,7 +390,6 @@ description: Result of parsing artifact_graph_sketch_on_face_etc.kcl
"unlabeled": null "unlabeled": null
}, },
{ {
"arguments": [],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 0, "commentStart": 0,
@ -415,8 +408,9 @@ description: Result of parsing artifact_graph_sketch_on_face_etc.kcl
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"start": 0, "start": 0,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": null
} }
], ],
"commentStart": 0, "commentStart": 0,
@ -832,15 +826,6 @@ description: Result of parsing artifact_graph_sketch_on_face_etc.kcl
"commentStart": 0, "commentStart": 0,
"elements": [ "elements": [
{ {
"arguments": [
{
"commentStart": 0,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 0, "commentStart": 0,
@ -859,19 +844,17 @@ description: Result of parsing artifact_graph_sketch_on_face_etc.kcl
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"start": 0, "start": 0,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"commentStart": 0,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
}, },
{ {
"arguments": [
{
"commentStart": 0,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 0, "commentStart": 0,
@ -890,8 +873,15 @@ description: Result of parsing artifact_graph_sketch_on_face_etc.kcl
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"start": 0, "start": 0,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"commentStart": 0,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
} }
], ],
"end": 0, "end": 0,
@ -924,7 +914,6 @@ description: Result of parsing artifact_graph_sketch_on_face_etc.kcl
"unlabeled": null "unlabeled": null
}, },
{ {
"arguments": [],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 0, "commentStart": 0,
@ -943,8 +932,9 @@ description: Result of parsing artifact_graph_sketch_on_face_etc.kcl
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"start": 0, "start": 0,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": null
} }
], ],
"commentStart": 0, "commentStart": 0,
@ -1363,15 +1353,6 @@ description: Result of parsing artifact_graph_sketch_on_face_etc.kcl
"commentStart": 0, "commentStart": 0,
"elements": [ "elements": [
{ {
"arguments": [
{
"commentStart": 0,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 0, "commentStart": 0,
@ -1390,19 +1371,17 @@ description: Result of parsing artifact_graph_sketch_on_face_etc.kcl
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"start": 0, "start": 0,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"commentStart": 0,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
}, },
{ {
"arguments": [
{
"commentStart": 0,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 0, "commentStart": 0,
@ -1421,8 +1400,15 @@ description: Result of parsing artifact_graph_sketch_on_face_etc.kcl
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"start": 0, "start": 0,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"commentStart": 0,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
} }
], ],
"end": 0, "end": 0,
@ -1455,7 +1441,6 @@ description: Result of parsing artifact_graph_sketch_on_face_etc.kcl
"unlabeled": null "unlabeled": null
}, },
{ {
"arguments": [],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 0, "commentStart": 0,
@ -1474,8 +1459,9 @@ description: Result of parsing artifact_graph_sketch_on_face_etc.kcl
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"start": 0, "start": 0,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": null
} }
], ],
"commentStart": 0, "commentStart": 0,
@ -1891,15 +1877,6 @@ description: Result of parsing artifact_graph_sketch_on_face_etc.kcl
"commentStart": 0, "commentStart": 0,
"elements": [ "elements": [
{ {
"arguments": [
{
"commentStart": 0,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 0, "commentStart": 0,
@ -1918,19 +1895,17 @@ description: Result of parsing artifact_graph_sketch_on_face_etc.kcl
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"start": 0, "start": 0,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"commentStart": 0,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
}, },
{ {
"arguments": [
{
"commentStart": 0,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 0, "commentStart": 0,
@ -1949,8 +1924,15 @@ description: Result of parsing artifact_graph_sketch_on_face_etc.kcl
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"start": 0, "start": 0,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": {
"commentStart": 0,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
} }
], ],
"end": 0, "end": 0,
@ -1983,7 +1965,6 @@ description: Result of parsing artifact_graph_sketch_on_face_etc.kcl
"unlabeled": null "unlabeled": null
}, },
{ {
"arguments": [],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 0, "commentStart": 0,
@ -2002,8 +1983,9 @@ description: Result of parsing artifact_graph_sketch_on_face_etc.kcl
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"start": 0, "start": 0,
"type": "CallExpression", "type": "CallExpressionKw",
"type": "CallExpression" "type": "CallExpressionKw",
"unlabeled": null
} }
], ],
"commentStart": 0, "commentStart": 0,

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