Compare commits

...

21 Commits

Author SHA1 Message Date
ccb3edb0ec Update rust/kcl-lib/src/execution/memory.rs
Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2025-03-28 21:01:24 -07:00
252050468d ascii art diagram
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2025-03-28 14:30:45 -07:00
358b34de4c Fix translate scale & better docs (#6053)
* change translate & scale to be better & docs

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

* autocomplete

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

* gen std

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

* kcl-samples

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

* updates

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

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
2025-03-28 21:14:29 +00:00
9973e5fde3 Fix to preserve comments when changing file units (#6052) 2025-03-28 21:07:53 +00:00
36875e05fd Fix .length on undefined WASM error (#6048) 2025-03-28 14:48:47 -04:00
42123383bb Add path argument error to console error whitelist (#6046)
* Add path argument error to console error whitelist

* Lint
2025-03-28 13:50:54 -04:00
ef4c606ed1 Update sweep-related icons to be less detailed, show result (#6047)
* WIP trying out various icons

* Update to use outcome bodies for icons
2025-03-28 16:42:31 +00:00
1ebb73b935 Fix 'originalCode' undefined in a test (#6027) 2025-03-28 12:36:54 -04:00
b57d31c0e7 Fix build:wasm:dev for --dev builds (#6038)
This is useful since it preserves Rust backtraces in WASM.
2025-03-28 08:40:21 -04:00
678ebbc310 Make Helix available in numbered releases (#6024)
* Helix release outside of dev and nightly

* Make length non required on edge mode so we get the edge length by default
2025-03-28 11:25:32 +00:00
cc2efd316c Add more TS lints and fix types (#6037)
* Add as const lint

* Add lint for no implied eval

* Fix incorrect type and add lints

* Add more type lints

* Remove redundant type assertions and add lint

* Fix to turn off incorrect base rules

* Fix yarn lint workflow to wait for build:wasm

* Change so that we don't build:wasm more than once in the workflow
2025-03-28 04:24:24 +00:00
d1f811f91d Boolean create UI (#5906)
* first steps, add to cmd bar etc

* cmdbar working well enough

* mvp

* lint

* fix after rebase

* intersect and union mvps

* add test

* some clean up

* further fix up

* Update src/lang/modifyAst/boolean.ts

Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>

* Update src/lang/modifyAst/boolean.ts

Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>

* pierre's comments

* tsc

* add comment

---------

Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
2025-03-28 03:56:48 +00:00
7ca3afff9f Add CSG operations to the Feature Tree (#6028)
* Add operation tracking for CSG boolean functions

* Add CSG operations to the Feature Tree

* Add just command

* Add union sim test

* Update output with new sim test

* Add CSG subtract test

* Update output from subtract test

* Add intersect sim test

* Update output for intersect test
2025-03-28 09:48:55 +11:00
71b9e40bd9 Fix to not use cursed empty object type and add lint (#6033) 2025-03-27 22:08:57 +00:00
4f35197a96 Add a loading state to CommandBarKclInput while calculating (#6025)
* Add a loading state to CommandBarKclInput while calculating

This is so that we can more reliably await for the calculation to be
completed before advancing the command bar in Playwright E2E tests.

* Make sure the spinner shows on first frame, before `isExecuting` is set too
2025-03-27 16:22:04 -04:00
40b0cf5fd3 Create a new commit to preserve history from main (#6019) 2025-03-27 15:49:38 +00:00
355e6acf0d Make tests fail when there are console errors (#6015)
* Add a test to confirm console errors fail tests

* Check for console errors on all browsers

* Ignore error impacting lots of tests

* Add more detected errors to the allowlist for now
2025-03-27 15:41:25 +00:00
4ff38e7f44 Add dual-sink and makeup mirror to KCL samples (#6023)
* add makeup mirror

* m -> M

* add metal sink unit

* Update kcl-samples simulation test output

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-03-27 10:57:01 -04:00
1dcd3b84b7 Populate all environment variables from files (#6014) 2025-03-27 10:38:24 -04:00
2957216bd3 Fix kitt kcl-sample expected output (#6022) 2025-03-27 14:31:12 +00:00
11160f0b40 Point-and-click Helix from cylinders (#5979) 2025-03-26 17:57:30 -04:00
134 changed files with 60665 additions and 4651 deletions

View File

@ -1,5 +1,6 @@
NODE_ENV=development
DEV=true
VITE_KC_API_WS_MODELING_URL=wss://api.dev.zoo.dev/ws/modeling/commands
VITE_KC_API_BASE_URL=https://api.dev.zoo.dev
VITE_KC_SITE_BASE_URL=https://dev.zoo.dev
@ -8,3 +9,5 @@ VITE_KC_SKIP_AUTH=false
VITE_KC_CONNECTION_TIMEOUT_MS=5000
# ONLY add your token in .env.development.local if you want to skip auth, otherwise this token takes precedence!
#VITE_KC_DEV_TOKEN="your token from dev.zoo.dev should go in .env.development.local"
FAIL_ON_CONSOLE_ERRORS=true

10
.envrc
View File

@ -1,3 +1,13 @@
# Load optional shared environment variables
source_up_if_exists
# Load default development environment variables
dotenv .env.development
# Load optional environment variables overrides
dotenv_if_exists .env.development.local
# Load optional testing environment variables
dotenv_if_exists e2e/playwright/playwright-secrets.env
use flake .

View File

@ -20,8 +20,20 @@
"plugin:react-hooks/recommended"
],
"rules": {
"no-array-constructor": "off", // This is wrong; use the @typescript-eslint one instead.
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-array-delete": "error",
"@typescript-eslint/no-duplicate-enum-values": "error",
"@typescript-eslint/no-duplicate-type-constituents": "error",
"@typescript-eslint/no-empty-object-type": "error",
"@typescript-eslint/no-floating-promises": "error",
"no-implied-eval": "off", // This is wrong; use the @typescript-eslint one instead.
"@typescript-eslint/no-implied-eval": "error",
"@typescript-eslint/no-misused-promises": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-unnecessary-type-constraint": "error",
"no-unused-vars": "off", // This is wrong; use the @typescript-eslint one instead.
"@typescript-eslint/no-unused-vars": ["error", {
"varsIgnorePattern": "^_",
"argsIgnorePattern": "^_",
@ -29,6 +41,7 @@
"vars": "all",
"args": "none"
}],
"@typescript-eslint/prefer-as-const": "warn",
"jsx-a11y/click-events-have-key-events": "off",
"jsx-a11y/no-autofocus": "off",
"jsx-a11y/no-noninteractive-element-interactions": "off",

View File

@ -28,43 +28,57 @@ jobs:
- run: yarn fmt-check
yarn-build-wasm:
runs-on: ubuntu-22.04
# Build the wasm blob once on the fastest runner.
runs-on: runs-on=${{ github.run_id }}/family=i7ie.2xlarge/image=ubuntu22-full-x64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- run: yarn install
- name: Install dependencies
run: yarn install
- name: Use correct Rust toolchain
shell: bash
run: |
[ -e rust-toolchain.toml ] || cp rust/rust-toolchain.toml ./
- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: false # Configured below.
- uses: taiki-e/install-action@37bdc826eaedac215f638a96472df572feab0f9b
with:
tool: wasm-pack
- run: yarn build:wasm
yarn-tsc:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- run: yarn install
- run: yarn --cwd ./rust/kcl-language-server --modules-folder node_modules install
- uses: Swatinem/rust-cache@v2
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
workspaces: './rust'
- uses: taiki-e/install-action@37bdc826eaedac215f638a96472df572feab0f9b
with:
tool: wasm-pack
- run: yarn build:wasm
- run: yarn tsc
- name: Build Wasm
shell: bash
run: yarn build:wasm
yarn-lint:
runs-on: ubuntu-22.04
- uses: actions/upload-artifact@v4
with:
name: prepared-wasm
path: |
rust/kcl-wasm-lib/pkg/kcl_wasm_lib*
- uses: actions/upload-artifact@v4
with:
name: prepared-ts-rs-bindings
path: |
rust/kcl-lib/bindings/*
yarn-tsc:
runs-on: ubuntu-latest
needs: yarn-build-wasm
steps:
- uses: actions/checkout@v4
@ -73,7 +87,53 @@ jobs:
node-version-file: '.nvmrc'
cache: 'yarn'
- run: yarn install
- run: yarn --cwd ./rust/kcl-language-server --modules-folder node_modules install
- name: Download all artifacts
uses: actions/download-artifact@v4
- name: Copy prepared wasm
run: |
ls -R prepared-wasm
cp prepared-wasm/kcl_wasm_lib_bg.wasm public
mkdir rust/kcl-wasm-lib/pkg
cp prepared-wasm/kcl_wasm_lib* rust/kcl-wasm-lib/pkg
- name: Copy prepared ts-rs bindings
run: |
ls -R prepared-ts-rs-bindings
mkdir rust/kcl-lib/bindings
cp -r prepared-ts-rs-bindings/* rust/kcl-lib/bindings/
- run: yarn tsc
yarn-lint:
runs-on: ubuntu-latest
needs: yarn-build-wasm
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- run: yarn install
- name: Download all artifacts
uses: actions/download-artifact@v4
- name: Copy prepared wasm
run: |
ls -R prepared-wasm
cp prepared-wasm/kcl_wasm_lib_bg.wasm public
mkdir rust/kcl-wasm-lib/pkg
cp prepared-wasm/kcl_wasm_lib* rust/kcl-wasm-lib/pkg
- name: Copy prepared ts-rs bindings
run: |
ls -R prepared-ts-rs-bindings
mkdir rust/kcl-lib/bindings
cp -r prepared-ts-rs-bindings/* rust/kcl-lib/bindings/
- run: yarn lint
python-codespell:
@ -91,6 +151,7 @@ jobs:
yarn-unit-test-kcl-samples:
runs-on: ubuntu-latest
needs: yarn-build-wasm
steps:
- uses: actions/checkout@v4
@ -103,7 +164,22 @@ jobs:
- uses: taiki-e/install-action@37bdc826eaedac215f638a96472df572feab0f9b
with:
tool: wasm-pack
- run: yarn build:wasm
- name: Download all artifacts
uses: actions/download-artifact@v4
- name: Copy prepared wasm
run: |
ls -R prepared-wasm
cp prepared-wasm/kcl_wasm_lib_bg.wasm public
mkdir rust/kcl-wasm-lib/pkg
cp prepared-wasm/kcl_wasm_lib* rust/kcl-wasm-lib/pkg
- name: Copy prepared ts-rs bindings
run: |
ls -R prepared-ts-rs-bindings
mkdir rust/kcl-lib/bindings
cp -r prepared-ts-rs-bindings/* rust/kcl-lib/bindings/
- run: yarn simpleserver:bg
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
@ -120,6 +196,7 @@ jobs:
yarn-unit-test:
runs-on: ubuntu-latest
needs: yarn-build-wasm
steps:
- uses: actions/checkout@v4
@ -132,7 +209,22 @@ jobs:
- uses: taiki-e/install-action@37bdc826eaedac215f638a96472df572feab0f9b
with:
tool: wasm-pack
- run: yarn build:wasm
- name: Download all artifacts
uses: actions/download-artifact@v4
- name: Copy prepared wasm
run: |
ls -R prepared-wasm
cp prepared-wasm/kcl_wasm_lib_bg.wasm public
mkdir rust/kcl-wasm-lib/pkg
cp prepared-wasm/kcl_wasm_lib* rust/kcl-wasm-lib/pkg
- name: Copy prepared ts-rs bindings
run: |
ls -R prepared-ts-rs-bindings
mkdir rust/kcl-lib/bindings
cp -r prepared-ts-rs-bindings/* rust/kcl-lib/bindings/
- run: yarn simpleserver:bg
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}

View File

@ -38,7 +38,7 @@ jobs:
# Get a new SHA to prevent overwriting the commit status on main
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit --amend --message="[all-e2e] $(git log --max-count=1 --pretty=%B)"
git commit --allow-empty --message="[all-e2e] $(git log --max-count=1 --pretty=%B)"
# Overwrite the branch
git remote set-url origin https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/${{ github.repository }}.git

View File

@ -37,7 +37,7 @@ build-web: public/kcl_wasm_lib_bg.wasm build/index.html
build-desktop: public/kcl_wasm_lib_bg.wasm .vite/build/main.js
public/kcl_wasm_lib_bg.wasm: $(CARGO_SOURCES)$(RUST_SOURCES)
yarn build:wasm
yarn build:wasm:dev
build/index.html: $(REACT_SOURCES) $(TYPESCRIPT_SOURCES) $(VITE_SOURCES)
yarn build:local
@ -99,7 +99,7 @@ test-e2e-web: install build-web ## Run the web e2e tests
.PHONY: test-e2e-desktop
test-e2e-desktop: install build-desktop ## Run the desktop e2e tests
yarn test:playwright:electron --workers=$(E2E_WORKERS) --max-failures=$(E2E_FAILURES) --grep=$(E2E_GREP)
yarn test:playwright:electron --workers=$(E2E_WORKERS) --max-failures=$(E2E_FAILURES) --grep="$(E2E_GREP)"
###############################################################################
# CLEAN

View File

@ -6,6 +6,10 @@ layout: manual
Rotate a solid or a sketch.
This is really useful for assembling parts together. You can create a part and then rotate it to the correct orientation.
For sketches, you can use this to rotate a sketch and then loft it with another sketch.
### Using Roll, Pitch, and Yaw
When rotating a part in 3D space, "roll," "pitch," and "yaw" refer to the three rotational axes used to describe its orientation: roll is rotation around the longitudinal axis (front-to-back), pitch is rotation around the lateral axis (wing-to-wing), and yaw is rotation around the vertical axis (up-down); essentially, it's like tilting the part on its side (roll), tipping the nose up or down (pitch), and turning it left or right (yaw).
@ -166,7 +170,7 @@ fn square() {
profile001 = square()
profile002 = square()
|> translate(translate = [0, 0, 20])
|> translate(x = 0, y = 0, z = 20)
|> rotate(axis = [0, 0, 1.0], angle = 45)
loft([profile001, profile002])

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,117 @@
import { test, expect } from './zoo-test'
import fs from 'node:fs/promises'
import path from 'node:path'
test.describe('Point and click for boolean workflows', () => {
// Boolean operations to test
const booleanOperations = [
{
name: 'union',
code: 'union([extrude001, extrude006])',
},
{
name: 'subtract',
code: 'subtract([extrude001], tools = [extrude006])',
},
{
name: 'intersect',
code: 'intersect([extrude001, extrude006])',
},
] as const
for (let i = 0; i < booleanOperations.length; i++) {
const operation = booleanOperations[i]
const operationName = operation.name
const commandName = `Boolean ${
operationName.charAt(0).toUpperCase() + operationName.slice(1)
}`
test(`Create boolean operation -- ${operationName}`, async ({
context,
homePage,
cmdBar,
editor,
toolbar,
scene,
page,
}) => {
const file = await fs.readFile(
path.resolve(
__dirname,
'../../',
'./rust/kcl-lib/e2e/executor/inputs/boolean-setup-with'
),
'utf-8'
)
await context.addInitScript((file) => {
localStorage.setItem('persistCode', file)
}, file)
await homePage.goToModelingScene()
await scene.waitForExecutionDone()
await scene.settled(cmdBar)
// Test coordinates for selection - these might need adjustment based on actual scene layout
const cylinderPoint = { x: 592, y: 174 }
const secondObjectPoint = { x: 683, y: 273 }
// Create mouse helpers for selecting objects
const [clickFirstObject] = scene.makeMouseHelpers(
cylinderPoint.x,
cylinderPoint.y,
{ steps: 10 }
)
const [clickSecondObject] = scene.makeMouseHelpers(
secondObjectPoint.x,
secondObjectPoint.y,
{ steps: 10 }
)
await test.step(`Test ${operationName} operation`, async () => {
// Click the boolean operation button in the toolbar
await toolbar.selectBoolean(operationName)
// Verify command bar is showing the right command
await expect(cmdBar.page.getByTestId('command-name')).toContainText(
commandName
)
// Select first object in the scene, expect there to be a pixel diff from the selection color change
await clickFirstObject({ pixelDiff: 50 })
// For subtract, we need to proceed to the next step before selecting the second object
if (operationName !== 'subtract') {
// should down shift key to select multiple objects
await page.keyboard.down('Shift')
}
// Select second object
await clickSecondObject({ pixelDiff: 50 })
// Confirm the operation in the command bar
await cmdBar.progressCmdBar()
if (operationName === 'union' || operationName === 'intersect') {
await cmdBar.expectState({
stage: 'review',
headerArguments: {
Solids: '2 paths',
},
commandName,
})
} else if (operationName === 'subtract') {
await cmdBar.expectState({
stage: 'review',
headerArguments: {
Tool: '1 path',
Target: '1 path',
},
commandName,
})
}
await cmdBar.submit()
await editor.expectEditor.toContain(operation.code)
})
})
}
})

View File

@ -181,6 +181,14 @@ export class ToolbarFixture {
).toBeVisible()
await this.page.getByTestId('dropdown-center-rectangle').click()
}
selectBoolean = async (operation: 'union' | 'subtract' | 'intersect') => {
await this.page
.getByRole('button', { name: 'caret down Union: open menu' })
.click()
const operationTestId = `dropdown-boolean-${operation}`
await expect(this.page.getByTestId(operationTestId)).toBeVisible()
await this.page.getByTestId(operationTestId).click()
}
selectCircleThreePoint = async () => {
await this.page

View File

@ -257,6 +257,37 @@ export const isErrorWhitelisted = (exception: Error) => {
project: 'Google Chrome',
foundInSpec: 'e2e/playwright/testing-settings.spec.ts',
},
// TODO: fix this error in the code
{
name: 'ReferenceError',
message: '_testUtils is not defined',
stack: '',
project: 'Google Chrome',
foundInSpec: 'e2e/playwright/snapshot-tests.spec.ts',
},
{
name: 'TypeError',
message: 'Failed to fetch',
stack: '',
project: 'Google Chrome',
foundInSpec: 'e2e/playwright/snapshot-tests.spec.ts',
},
// TODO: fix this error in the code
{
name: 'ReferenceError',
message: 'createNewVariableCheckbox is not defined',
stack: '',
project: 'Google Chrome',
foundInSpec: 'e2e/playwright/testing-constraints.spec.ts',
},
{
name: 'Error',
message: 'The "path" argument must be of type string. Received undefined',
stack:
'Error: The "path" argument must be of type string. Received undefined',
project: 'Google Chrome',
foundInSpec: '', // many tests are impacted by this error
},
]
const cleanString = (str: string) => str.replace(/[`"]/g, '')

View File

@ -230,9 +230,9 @@ test.describe('Onboarding tests', () => {
// Override beforeEach test setup
await context.addInitScript(
async ({ settingsKey, settings }) => {
async ({ settingsKey, settings, code }) => {
// Give some initial code, so we can test that it's cleared
localStorage.setItem('persistCode', originalCode)
localStorage.setItem('persistCode', code)
localStorage.setItem(settingsKey, settings)
},
{
@ -240,6 +240,7 @@ test.describe('Onboarding tests', () => {
settings: settingsToToml({
settings: TEST_SETTINGS_ONBOARDING_EXPORT,
}),
code: originalCode,
}
)

View File

@ -1082,8 +1082,8 @@ openSketch = startSketchOn(XY)
}) => {
// One dumb hardcoded screen pixel value
const testPoint = { x: 620, y: 257 }
const expectedOutput = `helix001 = helix( revolutions = 1, angleStart = 360, ccw = false, radius = 5, axis = 'X', length = 5,)`
const expectedLine = `revolutions=1,`
const expectedOutput = `helix001 = helix( axis = 'X', radius = 5, length = 5, revolutions = 1, angleStart = 360, ccw = false,)`
const expectedLine = `axis='X',`
await homePage.goToModelingScene()
@ -1091,17 +1091,16 @@ openSketch = startSketchOn(XY)
await toolbar.helixButton.click()
await cmdBar.expectState({
stage: 'arguments',
currentArgKey: 'axisOrEdge',
currentArgKey: 'mode',
currentArgValue: '',
headerArguments: {
Mode: '',
AngleStart: '',
AxisOrEdge: '',
CounterClockWise: '',
Length: '',
Radius: '',
Revolutions: '',
Radius: '',
CounterClockWise: '',
},
highlightedHeaderArg: 'axisOrEdge',
highlightedHeaderArg: 'mode',
commandName: 'Helix',
})
await cmdBar.progressCmdBar()
@ -1110,7 +1109,19 @@ openSketch = startSketchOn(XY)
await cmdBar.progressCmdBar()
await cmdBar.progressCmdBar()
await cmdBar.progressCmdBar()
await cmdBar.progressCmdBar()
await cmdBar.expectState({
stage: 'review',
headerArguments: {
Mode: 'Axis',
Axis: 'X',
AngleStart: '360',
Revolutions: '1',
Length: '5',
Radius: '5',
CounterClockWise: '',
},
commandName: 'Helix',
})
await cmdBar.progressCmdBar()
})
@ -1134,30 +1145,31 @@ openSketch = startSketchOn(XY)
await cmdBar.expectState({
commandName: 'Helix',
stage: 'arguments',
currentArgKey: 'length',
currentArgValue: initialInput,
currentArgKey: 'CounterClockWise',
currentArgValue: '',
headerArguments: {
AngleStart: '360',
Axis: 'X',
CounterClockWise: '',
Length: initialInput,
Radius: '5',
AngleStart: '360',
Revolutions: '1',
Radius: '5',
Length: initialInput,
CounterClockWise: '',
},
highlightedHeaderArg: 'length',
highlightedHeaderArg: 'CounterClockWise',
})
await page.keyboard.press('Shift+Backspace')
await expect(cmdBar.currentArgumentInput).toBeVisible()
await cmdBar.currentArgumentInput.locator('.cm-content').fill(newInput)
await cmdBar.progressCmdBar()
await cmdBar.expectState({
stage: 'review',
headerArguments: {
AngleStart: '360',
Axis: 'X',
CounterClockWise: '',
Length: newInput,
Radius: '5',
AngleStart: '360',
Revolutions: '1',
Radius: '5',
Length: newInput,
CounterClockWise: '',
},
commandName: 'Helix',
})
@ -1181,14 +1193,14 @@ openSketch = startSketchOn(XY)
{
selectionType: 'segment',
testPoint: { x: 513, y: 221 },
expectedOutput: `helix001 = helix( revolutions = 20, angleStart = 0, ccw = true, radius = 1, axis = seg01, length = 100,)`,
expectedEditedOutput: `helix001 = helix( revolutions = 20, angleStart = 0, ccw = true, radius = 1, axis = seg01, length = 50,)`,
expectedOutput: `helix001 = helix( axis = seg01, radius = 1, revolutions = 20, angleStart = 0, ccw = false,)`,
expectedEditedOutput: `helix001 = helix( axis = seg01, radius = 5, revolutions = 20, angleStart = 0, ccw = false,)`,
},
{
selectionType: 'sweepEdge',
testPoint: { x: 564, y: 364 },
expectedOutput: `helix001 = helix( revolutions = 20, angleStart = 0, ccw = true, radius = 1, axis = getOppositeEdge(seg01), length = 100,)`,
expectedEditedOutput: `helix001 = helix( revolutions = 20, angleStart = 0, ccw = true, radius = 1, axis = getOppositeEdge(seg01), length = 50,)`,
expectedOutput: `helix001 = helix( axis = getOppositeEdge(seg01), radius = 1, revolutions = 20, angleStart = 0, ccw = false,)`,
expectedEditedOutput: `helix001 = helix( axis = getOppositeEdge(seg01), radius = 5, revolutions = 20, angleStart = 0, ccw = false,)`,
},
]
helixCases.map(
@ -1225,17 +1237,16 @@ openSketch = startSketchOn(XY)
await toolbar.helixButton.click()
await cmdBar.expectState({
stage: 'arguments',
currentArgKey: 'axisOrEdge',
currentArgKey: 'mode',
currentArgValue: '',
headerArguments: {
AngleStart: '',
AxisOrEdge: '',
Mode: '',
CounterClockWise: '',
Length: '',
Radius: '',
Revolutions: '',
},
highlightedHeaderArg: 'axisOrEdge',
highlightedHeaderArg: 'mode',
commandName: 'Helix',
})
await cmdBar.selectOption({ name: 'Edge' }).click()
@ -1246,21 +1257,17 @@ openSketch = startSketchOn(XY)
await cmdBar.progressCmdBar()
await page.keyboard.insertText('0')
await cmdBar.progressCmdBar()
await cmdBar.selectOption({ name: 'True' }).click()
await page.keyboard.insertText('1')
await cmdBar.progressCmdBar()
await page.keyboard.insertText('100')
await cmdBar.progressCmdBar()
await cmdBar.expectState({
stage: 'review',
headerArguments: {
AngleStart: '0',
AxisOrEdge: 'Edge',
Mode: 'Edge',
Edge: `1 ${selectionType}`,
CounterClockWise: '',
Length: '100',
Radius: '1',
AngleStart: '0',
Revolutions: '20',
Radius: '1',
CounterClockWise: '',
},
commandName: 'Helix',
})
@ -1280,22 +1287,24 @@ openSketch = startSketchOn(XY)
0
)
await operationButton.dblclick()
const initialInput = '100'
const newInput = '50'
const initialInput = '1'
const newInput = '5'
await cmdBar.expectState({
commandName: 'Helix',
stage: 'arguments',
currentArgKey: 'length',
currentArgValue: initialInput,
currentArgKey: 'CounterClockWise',
currentArgValue: '',
headerArguments: {
AngleStart: '0',
CounterClockWise: '',
Length: initialInput,
Radius: '1',
Revolutions: '20',
Radius: initialInput,
CounterClockWise: '',
},
highlightedHeaderArg: 'length',
highlightedHeaderArg: 'CounterClockWise',
})
await page
.getByRole('button', { name: 'radius', exact: false })
.click()
await expect(cmdBar.currentArgumentInput).toBeVisible()
await cmdBar.currentArgumentInput
.locator('.cm-content')
@ -1305,10 +1314,9 @@ openSketch = startSketchOn(XY)
stage: 'review',
headerArguments: {
AngleStart: '0',
CounterClockWise: '',
Length: newInput,
Radius: '1',
Revolutions: '20',
Radius: newInput,
CounterClockWise: '',
},
commandName: 'Helix',
})
@ -1336,6 +1344,140 @@ openSketch = startSketchOn(XY)
}
)
test('Helix point-and-click on cylinder', async ({
context,
page,
homePage,
scene,
editor,
toolbar,
cmdBar,
}) => {
const initialCode = `sketch001 = startSketchOn(XY)
profile001 = circle(
sketch001,
center = [0, 0],
radius = 100,
tag = $seg01,
)
extrude001 = extrude(profile001, length = 100)
`
await context.addInitScript((initialCode) => {
localStorage.setItem('persistCode', initialCode)
}, initialCode)
await page.setBodyDimensions({ width: 1000, height: 500 })
await homePage.goToModelingScene()
await scene.waitForExecutionDone()
// One dumb hardcoded screen pixel value
const testPoint = { x: 620, y: 257 }
const [clickOnWall] = scene.makeMouseHelpers(testPoint.x, testPoint.y)
const expectedOutput = `helix001 = helix( cylinder = extrude001, revolutions = 1, angleStart = 360, ccw = false,)`
const expectedLine = `cylinder = extrude001,`
const expectedEditedOutput = `helix001 = helix( cylinder = extrude001, revolutions = 1, angleStart = 360, ccw = true,)`
await test.step(`Go through the command bar flow`, async () => {
await toolbar.helixButton.click()
await cmdBar.expectState({
stage: 'arguments',
currentArgKey: 'mode',
currentArgValue: '',
headerArguments: {
Mode: '',
AngleStart: '',
Revolutions: '',
Radius: '',
CounterClockWise: '',
},
highlightedHeaderArg: 'mode',
commandName: 'Helix',
})
await cmdBar.selectOption({ name: 'Cylinder' }).click()
await cmdBar.expectState({
stage: 'arguments',
currentArgKey: 'cylinder',
currentArgValue: '',
headerArguments: {
Mode: 'Cylinder',
Cylinder: '',
AngleStart: '',
Revolutions: '',
CounterClockWise: '',
},
highlightedHeaderArg: 'cylinder',
commandName: 'Helix',
})
await clickOnWall()
await cmdBar.progressCmdBar()
await cmdBar.progressCmdBar()
await cmdBar.progressCmdBar()
await cmdBar.expectState({
stage: 'review',
headerArguments: {
Mode: 'Cylinder',
Cylinder: '1 face',
AngleStart: '360',
Revolutions: '1',
CounterClockWise: '',
},
commandName: 'Helix',
})
await cmdBar.progressCmdBar()
})
await test.step(`Confirm code is added to the editor, scene has changed`, async () => {
await editor.expectEditor.toContain(expectedOutput)
await editor.expectState({
diagnostics: [],
activeLines: [expectedLine],
highlightedCode: '',
})
})
await test.step(`Edit helix through the feature tree`, async () => {
await editor.closePane()
const operationButton = await toolbar.getFeatureTreeOperation('Helix', 0)
await operationButton.dblclick()
await cmdBar.expectState({
commandName: 'Helix',
stage: 'arguments',
currentArgKey: 'CounterClockWise',
currentArgValue: '',
headerArguments: {
AngleStart: '360',
Revolutions: '1',
CounterClockWise: '',
},
highlightedHeaderArg: 'CounterClockWise',
})
await cmdBar.selectOption({ name: 'True' }).click()
await cmdBar.expectState({
stage: 'review',
headerArguments: {
AngleStart: '360',
Revolutions: '1',
CounterClockWise: 'true',
},
commandName: 'Helix',
})
await cmdBar.progressCmdBar()
await toolbar.closePane('feature-tree')
await toolbar.openPane('code')
await editor.expectEditor.toContain(expectedEditedOutput)
await editor.closePane()
})
await test.step('Delete helix via feature tree selection', async () => {
await toolbar.openPane('feature-tree')
const operationButton = await toolbar.getFeatureTreeOperation('Helix', 0)
await operationButton.click({ button: 'left' })
await page.keyboard.press('Delete')
await toolbar.closePane('feature-tree')
await toolbar.openPane('code')
await editor.expectEditor.not.toContain(expectedEditedOutput)
})
})
const loftPointAndClickCases = [
{ shouldPreselect: true },
{ shouldPreselect: false },

View File

@ -473,6 +473,9 @@ test.describe('Can export from electron app', () => {
if (!tronApp) {
fail()
}
if (runningOnWindows()) {
test.fixme(orRunWhenFullSuiteEnabled())
}
await context.folderSetupFn(async (dir) => {
const bracketDir = path.join(dir, 'bracket')

View File

@ -778,6 +778,19 @@ plane002 = offsetPlane(XZ, offset = -2 * x)`
await editor.expectEditor.not.toContain(`plane002`)
})
})
test.fail(
'Console errors cause tests to fail',
async ({ page, homePage }) => {
const u = await getUtils(page)
await homePage.goToModelingScene()
await u.openAndClearDebugPanel()
await page.getByTestId('custom-cmd-input').fill('foobar')
await page.getByTestId('custom-cmd-send-button').scrollIntoViewIfNeeded()
await page.getByTestId('custom-cmd-send-button').click()
}
)
})
async function clickExportButton(page: Page) {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 72 KiB

View File

@ -935,47 +935,39 @@ export async function setup(
}
function failOnConsoleErrors(page: Page, testInfo?: TestInfo) {
// enabled for chrome for now
if (page.context().browser()?.browserType().name() === 'chromium') {
// No idea wtf exception is
page.on('pageerror', (exception: any) => {
if (isErrorWhitelisted(exception)) {
return
}
page.on('pageerror', (exception: any) => {
if (isErrorWhitelisted(exception)) {
return
}
// Only disable this environment variable if you want to collect console errors
if (process.env.FAIL_ON_CONSOLE_ERRORS !== 'false') {
// Use expect to prevent page from closing and not cleaning up
expect(`An error was detected in the console: \r\n message:${exception.message} \r\n name:${exception.name} \r\n stack:${exception.stack}
// only set this env var to false if you want to collect console errors
// This can be configured in the GH workflow. This should be set to true by default (we want tests to fail when
// unwhitelisted console errors are detected).
if (process.env.FAIL_ON_CONSOLE_ERRORS === 'true') {
// Fail when running on CI and FAIL_ON_CONSOLE_ERRORS is set
// use expect to prevent page from closing and not cleaning up
expect(`An error was detected in the console: \r\n message:${exception.message} \r\n name:${exception.name} \r\n stack:${exception.stack}
*Either fix the console error or add it to the whitelist defined in ./lib/console-error-whitelist.ts (if the error can be safely ignored)
`).toEqual('Console error detected')
} else {
// the (test-results/exceptions.txt) file will be uploaded as part of an upload artifact in GH
fsp
.appendFile(
'./test-results/exceptions.txt',
[
'~~~',
`triggered_by_test:${
testInfo?.file + ' ' + (testInfo?.title || ' ')
}`,
`name:${exception.name}`,
`message:${exception.message}`,
`stack:${exception.stack}`,
`project:${testInfo?.project.name}`,
'~~~',
].join('\n')
)
.catch((err) => {
console.error(err)
})
}
})
}
*Either fix the console error or add it to the whitelist defined in ./lib/console-error-whitelist.ts (if the error can be safely ignored)
`).toEqual('Console error detected')
} else {
// Add errors to `test-results/exceptions.txt` as a test artifact
fsp
.appendFile(
'./test-results/exceptions.txt',
[
'~~~',
`triggered_by_test:${
testInfo?.file + ' ' + (testInfo?.title || ' ')
}`,
`name:${exception.name}`,
`message:${exception.message}`,
`stack:${exception.stack}`,
`project:${testInfo?.project.name}`,
'~~~',
].join('\n')
)
.catch((err) => {
console.error(err)
})
}
})
}
export async function isOutOfViewInScrollContainer(
element: Locator,

View File

@ -94,9 +94,11 @@
"fetch:wasm": "./scripts/get-latest-wasm-bundle.sh",
"fetch:wasm:windows": "./scripts/get-latest-wasm-bundle.ps1",
"fetch:samples": "rm -rf public/kcl-samples* && curl -L -o public/kcl-samples.zip https://github.com/KittyCAD/kcl-samples/archive/refs/heads/achalmers/kw-args-xylineto.zip && unzip -o public/kcl-samples.zip -d public && mv public/kcl-samples-* public/kcl-samples",
"build:wasm-dev": "yarn wasm-prep && (cd rust && wasm-pack build kcl-wasm-lib --dev --target web --out-dir pkg && cargo test -p kcl-lib export_bindings) && yarn isomorphic-copy-wasm && yarn fmt:generated",
"build:wasm": "./scripts/build-wasm.sh",
"build:wasm:windows": "./scripts/build-wasm.ps1",
"build:wasm-dev": "yarn build:wasm:dev",
"build:wasm:dev": "./scripts/build-wasm-dev.sh",
"build:wasm:dev:windows": "./scripts/build-wasm-dev.ps1",
"remove-importmeta": "sed -i 's/import.meta.url/window.location.origin/g' \"./rust/kcl-wasm-lib/pkg/kcl_wasm_lib.js\"; sed -i '' 's/import.meta.url/window.location.origin/g' \"./rust/kcl-wasm-lib/pkg/kcl_wasm_lib.js\" || echo \"sed for both mac and linux\"",
"lint-fix": "eslint --fix --ext .ts --ext .tsx src e2e packages/codemirror-lsp-client/src rust/kcl-language-server/client/src",
"lint": "eslint --max-warnings 0 --ext .ts --ext .tsx src e2e packages/codemirror-lsp-client/src rust/kcl-language-server/client/src",

View File

@ -90,7 +90,7 @@ export default class StreamDemuxer extends Queue<Uint8Array> {
}
add(bytes: Uint8Array): void {
const message = Codec.decode(bytes) as vsrpc.Message
const message = Codec.decode<vsrpc.Message>(bytes)
if (this.trace) {
Tracer.server(message)
}

View File

@ -41,6 +41,8 @@ When you submit a PR to add or modify KCL samples, images and STEP files will be
[![cycloidal-gear](screenshots/cycloidal-gear.png)](cycloidal-gear/main.kcl)
#### [dodecahedron](dodecahedron/main.kcl) ([screenshot](screenshots/dodecahedron.png))
[![dodecahedron](screenshots/dodecahedron.png)](dodecahedron/main.kcl)
#### [dual-basin-utility-sink](dual-basin-utility-sink/main.kcl) ([screenshot](screenshots/dual-basin-utility-sink.png))
[![dual-basin-utility-sink](screenshots/dual-basin-utility-sink.png)](dual-basin-utility-sink/main.kcl)
#### [enclosure](enclosure/main.kcl) ([screenshot](screenshots/enclosure.png))
[![enclosure](screenshots/enclosure.png)](enclosure/main.kcl)
#### [exhaust-manifold](exhaust-manifold/main.kcl) ([screenshot](screenshots/exhaust-manifold.png))
@ -75,6 +77,8 @@ When you submit a PR to add or modify KCL samples, images and STEP files will be
[![kitt](screenshots/kitt.png)](kitt/main.kcl)
#### [lego](lego/main.kcl) ([screenshot](screenshots/lego.png))
[![lego](screenshots/lego.png)](lego/main.kcl)
#### [makeup-mirror](makeup-mirror/main.kcl) ([screenshot](screenshots/makeup-mirror.png))
[![makeup-mirror](screenshots/makeup-mirror.png)](makeup-mirror/main.kcl)
#### [mounting-plate](mounting-plate/main.kcl) ([screenshot](screenshots/mounting-plate.png))
[![mounting-plate](screenshots/mounting-plate.png)](mounting-plate/main.kcl)
#### [multi-axis-robot](multi-axis-robot/main.kcl) ([screenshot](screenshots/multi-axis-robot.png))

View File

@ -12,7 +12,7 @@ import "car-tire.kcl" as carTire
import lugCount from "globals.kcl"
carRotor
|> translate(translate = [0, 0.5, 0])
|> translate(x = 0, y = 0.5, z = 0)
carWheel
lugNut
|> patternCircular3d(
@ -23,5 +23,5 @@ lugNut
rotateDuplicates = false,
)
brakeCaliper
|> translate(translate = [0, 0.5, 0])
|> translate(x = 0, y = 0.5, z = 0)
carTire

View File

@ -0,0 +1,200 @@
// Dual-Basin Utility Sink
// A stainless steel sink unit with dual rectangular basins and six under-counter storage compartments.
@settings(defaultLengthUnit = mm)
// globals
tableHeight = 850
tableWidth = 3400
tableDepth = 400
profileThickness = 13
metalThickness = 2
blockCount = 3
blockWidth = (tableWidth-profileThickness) / 3
blockHeight = tableHeight - metalThickness - 0.5
blockDepth = tableDepth - profileThickness
blockSubdivisionCount = 2
blockSubdivisionWidth = blockWidth / blockSubdivisionCount
// Geometry
floorPlane = startSketchOn(XY)
// legs
legHeight = blockHeight - profileThickness
legCount = blockCount + 1
legBody = startProfileAt([0, 0], floorPlane)
|> yLine(length=profileThickness)
|> xLine(length=profileThickness)
|> yLine(length=-profileThickness)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> patternLinear2d(axis = [1, 0], instances = legCount, distance = blockWidth)
|> patternLinear2d(axis = [0, 1], instances = 2, distance = blockDepth)
|> extrude(length = legHeight)
// lower belt
lowerBeltHeightAboveTheFloor = 150
lowerBeltLengthX = blockWidth - profileThickness
lowerBeltPlane = startSketchOn(offsetPlane(XY, offset = lowerBeltHeightAboveTheFloor))
lowerBeltBodyX = startProfileAt([profileThickness, 0], lowerBeltPlane)
|> yLine(length=profileThickness)
|> xLine(length=lowerBeltLengthX)
|> yLine(length=-profileThickness)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> patternLinear2d(axis = [1, 0], instances = blockCount, distance = blockWidth)
|> patternLinear2d(axis = [0, 1], instances = 2, distance = blockDepth)
|> extrude(length = profileThickness)
lowerBeltLengthY = blockDepth - profileThickness
lowerBeltBodyY = startProfileAt([0, profileThickness], lowerBeltPlane)
|> yLine(length=lowerBeltLengthY)
|> xLine(length=profileThickness)
|> yLine(length=-lowerBeltLengthY)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> patternLinear2d(axis = [1, 0], instances = 2, distance = tableWidth-profileThickness)
|> extrude(length = profileThickness)
// pillars
pillarHeightAboveTheFloor = lowerBeltHeightAboveTheFloor + profileThickness
pillarPlane = startSketchOn(offsetPlane(XY, offset = pillarHeightAboveTheFloor))
pillarTotalHeight = blockHeight - profileThickness - pillarHeightAboveTheFloor
pillarBody = startProfileAt([blockSubdivisionWidth, 0], pillarPlane)
|> yLine(length=profileThickness)
|> xLine(length=profileThickness)
|> yLine(length=-profileThickness)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> patternLinear2d(axis = [1, 0], instances = blockCount, distance = blockWidth)
|> patternLinear2d(axis = [0, 1], instances = 2, distance = blockDepth)
|> extrude(length = pillarTotalHeight)
// upper belt
upperBeltPlane = startSketchOn(offsetPlane(XY, offset = blockHeight))
upperBeltBodyX = startProfileAt([0, 0], upperBeltPlane)
|> yLine(length=profileThickness)
|> xLine(length=tableWidth)
|> yLine(length=-profileThickness)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> patternLinear2d(axis = [0, 1], instances = 2, distance = blockDepth)
|> extrude(length = -profileThickness)
upperBeltLengthY = blockDepth - profileThickness
upperBeltBodyY = startProfileAt([0, profileThickness], upperBeltPlane)
|> yLine(length=upperBeltLengthY)
|> xLine(length=profileThickness)
|> yLine(length=-upperBeltLengthY)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> patternLinear2d(axis = [1, 0], instances = 2, distance = tableWidth-profileThickness)
|> extrude(length = -profileThickness)
// sink
tableTopPlane = startSketchOn(offsetPlane(XY, offset = tableHeight))
tableTopBody = startProfileAt([0, 0], tableTopPlane)
|> yLine(length=tableDepth)
|> xLine(length=tableWidth)
|> yLine(length=-tableDepth)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> extrude(length = -metalThickness)
sinkCount = 2
sinkWidth = 1000
sinkLength = 250
sinkDepth = 200
sinkOffsetFront = 40
sinkOffsetLeft = 350
sinkSpacing = tableWidth - sinkWidth - sinkOffsetLeft*2
sinkPlaneOutside = startSketchOn(tableTopBody, 'START')
sinkBodyOutside = startProfileAt([-sinkOffsetLeft, sinkOffsetFront], sinkPlaneOutside)
|> yLine(length=sinkLength)
|> xLine(length=-sinkWidth)
|> yLine(length=-sinkLength)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> patternLinear2d(axis = [-1, 0], instances = sinkCount, distance = sinkSpacing)
|> extrude(length = sinkDepth)
sinkPlaneInside = startSketchOn(tableTopBody, 'END')
sinkBodyInside = startProfileAt([sinkOffsetLeft+metalThickness, sinkOffsetFront+metalThickness], sinkPlaneInside)
|> yLine(length=sinkLength-metalThickness*2)
|> xLine(length=sinkWidth-metalThickness*2)
|> yLine(length=-sinkLength+metalThickness*2)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> patternLinear2d(axis = [1, 0], instances = sinkCount, distance = sinkSpacing)
|> extrude(length = -sinkDepth)
// door panels
doorGap = 2
doorWidth = blockSubdivisionWidth - profileThickness - doorGap*2
doorStart = profileThickness+doorGap
doorHeightAboveTheFloor = pillarHeightAboveTheFloor + doorGap
doorHeight = blockHeight - doorHeightAboveTheFloor - profileThickness - doorGap
doorCount = blockCount * blockSubdivisionCount
doorPlane = startSketchOn(offsetPlane(XY, offset = doorHeightAboveTheFloor))
doorBody = startProfileAt([doorStart, 0], doorPlane)
|> yLine(length=profileThickness)
|> xLine(length=doorWidth)
|> yLine(length=-profileThickness)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> patternLinear2d(axis = [1, 0], instances = doorCount, distance = blockSubdivisionWidth)
|> extrude(length = doorHeight)
// side panels
panelWidth = blockDepth - profileThickness - doorGap*2
panelCount = doorCount + 1
panelSpacing = tableWidth - profileThickness
panelBody = startProfileAt([0, doorStart], doorPlane)
|> yLine(length=panelWidth)
|> xLine(length=profileThickness)
|> yLine(length=-panelWidth)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> patternLinear2d(axis = [1, 0], instances = 2, distance = panelSpacing)
|> extrude(length = doorHeight)
// handle
handleDepth = 40
handleWidth = 120
handleFillet = 20
handleHeightAboveTheFloor = 780
handleOffset = doorStart + doorWidth / 2 - (handleWidth / 2)
handleLengthSegmentA = handleDepth - handleFillet
handleLengthSegmentB = handleWidth - (handleFillet * 2)
handlePlane = startSketchOn(offsetPlane(XY, offset = handleHeightAboveTheFloor))
handleProfilePath = startProfileAt([0 + handleOffset, 0], handlePlane)
|> yLine(length=-handleLengthSegmentA)
|> tangentialArcTo([
handleFillet + handleOffset,
-handleDepth
], %)
|> xLine(length=handleLengthSegmentB)
|> tangentialArcTo([
handleOffset + handleWidth,
-handleLengthSegmentA
], %)
|> yLine(length=handleLengthSegmentA)
handleSectionPlane = startSketchOn(XZ)
handleProfileSection = circle(
handleSectionPlane,
center = [handleOffset, handleHeightAboveTheFloor],
radius = 2)
handleBody = sweep(handleProfileSection, path = handleProfilePath)
|> patternLinear3d(axis = [1, 0, 0], instances = doorCount, distance = blockSubdivisionWidth)

View File

@ -0,0 +1,75 @@
// Makeup Mirror
// A circular vanity mirror mounted on a swiveling arm with pivot joints, used for personal grooming.
// Settings
@settings(defaultLengthUnit = mm)
// hinge
hingeRadius = 8
hingeHeight = hingeRadius * 3
hingeGap = 0.5
// arm
armLength = 170
armRadius = 5
// mirror
mirrorRadius = 170 / 2
mirrorThickness = 10
archToMirrorGap = 5
archThickness = 1
archRadius = mirrorRadius + archToMirrorGap
// Geometry
// hinge
fn hingeFn(x, y, z) {
hingeBody = startSketchOn(offsetPlane(XY, offset = z))
|> circle(center = [x, y], radius = hingeRadius)
|> extrude(length = hingeHeight)
return hingeBody
}
hingePartA1 = hingeFn(0, 0, 0)
hingePartA2 = hingeFn(0, 0, hingeHeight + hingeGap)
hingePartA3 = hingeFn(0, 0, hingeHeight * 2 + hingeGap * 2)
hingePartB2 = hingeFn(armLength, 0, hingeHeight + hingeGap)
hingePartB3 = hingeFn(armLength, 0, hingeHeight * 2 + hingeGap * 2)
hingePartC2 = hingeFn(armLength, -armLength, hingeHeight * 2 + hingeGap * 2)
hingePartC3 = hingeFn(armLength, -armLength, hingeHeight * 3 + hingeGap * 3)
// arm
fn armFn(plane, offset, altitude) {
armBody = startSketchOn(plane)
|> circle(center = [offset, altitude], radius = armRadius)
|> extrude(length = armLength)
return armBody
}
armPartA = armFn(YZ, 0, hingeHeight * 1.5 + hingeGap)
armPartB = armFn(XZ, armLength, hingeHeight * 2.5 + hingeGap * 2)
// mirror
fn mirrorFn(plane, offsetX, offsetY, altitude, radius, tiefe, gestellR, gestellD) {
armPlane = startSketchOn(offsetPlane(plane, offset = offsetY - (tiefe / 2)))
armBody = circle(armPlane, center = [offsetX, altitude], radius = radius)
|> extrude(length = tiefe)
archBody = startProfileAt([offsetX-gestellR, altitude], armPlane)
|> xLine(length = gestellD)
|> arcTo({
interior = [offsetX, altitude-gestellR],
end = [offsetX+gestellR, altitude]
}, %)
|> xLine(length = gestellD)
|> arcTo({
interior = [offsetX, altitude-gestellR-gestellD],
end = [profileStartX(%), profileStartY(%)]
}, %)
|> close()
|> extrude(length = tiefe)
return armBody
}
mirror = mirrorFn(XZ, armLength, armLength, hingeHeight * 4 + hingeGap * 3 + mirrorRadius+archToMirrorGap+archThickness, mirrorRadius, mirrorThickness, archRadius, archThickness)

View File

@ -62,6 +62,13 @@
"title": "Hollow Dodecahedron",
"description": "A regular dodecahedron or pentagonal dodecahedron is a dodecahedron composed of regular pentagonal faces, three meeting at each vertex. This example shows constructing the individual faces of the dodecahedron and extruding inwards."
},
{
"file": "main.kcl",
"pathFromProjectDirectoryToFirstFile": "dual-basin-utility-sink/main.kcl",
"multipleFiles": false,
"title": "Dual-Basin Utility Sink",
"description": "A stainless steel sink unit with dual rectangular basins and six under-counter storage compartments."
},
{
"file": "main.kcl",
"pathFromProjectDirectoryToFirstFile": "enclosure/main.kcl",
@ -181,6 +188,13 @@
"title": "Lego Brick",
"description": "A standard Lego brick. This is a small, plastic construction block toy that can be interlocked with other blocks to build various structures, models, and figures. There are a lot of hacks used in this code."
},
{
"file": "main.kcl",
"pathFromProjectDirectoryToFirstFile": "makeup-mirror/main.kcl",
"multipleFiles": false,
"title": "Makeup Mirror",
"description": "A circular vanity mirror mounted on a swiveling arm with pivot joints, used for personal grooming."
},
{
"file": "main.kcl",
"pathFromProjectDirectoryToFirstFile": "mounting-plate/main.kcl",

View File

@ -19,27 +19,27 @@ import pipe from "1120t74-pipe.kcl"
flange()
flange()
|> rotate(axis = [0, 1, 0], angle = 180)
|> translate(translate = [
0,
0,
flangeBackHeight * 2 + gasketThickness
])
|> translate(
x = 0,
y = 0,
z = flangeBackHeight * 2 + gasketThickness,
)
// place gasket between the flanges
gasket()
|> translate(translate = [
0,
0,
-flangeBackHeight - gasketThickness
])
|> translate(
x = 0,
y = 0,
z = -flangeBackHeight - gasketThickness
)
// place eight washers (four front, four back)
washer()
|> translate(translate = [
mountingHolePlacementDiameter / 2,
0,
flangeBaseThickness
])
|> translate(
x = mountingHolePlacementDiameter / 2,
y = 0,
z = flangeBaseThickness
)
|> patternCircular3d(
%,
instances = 4,
@ -57,11 +57,11 @@ washer()
// place four bolts
bolt()
|> translate(translate = [
mountingHolePlacementDiameter / 2,
0,
flangeBaseThickness + washerThickness
])
|> translate(
x = mountingHolePlacementDiameter / 2,
y = 0,
z = flangeBaseThickness + washerThickness,
)
|> rotate(roll = 90, pitch = 0, yaw = 0)
|> patternCircular3d(
%,
@ -74,11 +74,11 @@ bolt()
// place four hex nuts
hexNut()
|> translate(translate = [
mountingHolePlacementDiameter / 2,
0,
-(flangeBackHeight * 2 + gasketThickness + flangeBaseThickness + washerThickness + hexNutThickness)
])
|> translate(
x = mountingHolePlacementDiameter / 2,
y = 0,
z = -(flangeBackHeight * 2 + gasketThickness + flangeBaseThickness + washerThickness + hexNutThickness),
)
|> patternCircular3d(
%,
instances = 4,
@ -97,13 +97,11 @@ pipe()
yaw = 0,
)
|> translate(
%,
translate = [
0,
0,
flangeBaseThickness + flangeFrontHeight - 0.5
],
global = true,
%,
x = 0,
y = 0,
z = flangeBaseThickness + flangeFrontHeight - 0.5,
global = true,
)
pipe()
@ -114,11 +112,9 @@ pipe()
yaw = 0,
)
|> translate(
%,
translate = [
0,
0,
-(flangeBackHeight * 2 + gasketThickness + flangeBaseThickness + flangeFrontHeight - 0.5)
],
global = true,
%,
x = 0,
y = 0,
z = -(flangeBackHeight * 2 + gasketThickness + flangeBaseThickness + flangeFrontHeight - 0.5),
global = true,
)

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

View File

@ -20,51 +20,36 @@ body()
// import the antenna
antenna()
|> translate(translate = [-width / 2 + .45, -0.10, height / 2])
|> translate(x = -width / 2 + .45, y = -0.10, z = height / 2)
// import the case
case()
|> translate(translate = [0, -1, 0])
|> translate(x = 0, y = -1, z = 0)
// import the talk button
talkButton()
|> translate(translate = [width / 2, -thickness / 2, .5])
|> translate(x = width / 2, y = -thickness / 2, z = .5)
// import the frequency knob
knob()
|> translate(translate = [
width / 2 - 0.70,
-thickness / 2,
height / 2
])
|> translate(
x = width / 2 - 0.70,
y = -thickness / 2,
z = height / 2
)
// import the buttons
button()
|> translate(translate = [
-(screenWidth / 2 + tolerance),
-1,
screenYPosition
])
button()
|> translate(translate = [
-(screenWidth / 2 + tolerance),
-1,
screenYPosition - buttonHeight - (tolerance * 2)
])
button()
|> rotate(
%,
roll = 0,
pitch = 180,
yaw = 0,
)
|> translate(
translate = [
screenWidth / 2 + tolerance,
-1,
screenYPosition - buttonHeight
],
global = true,
x = -(screenWidth / 2 + tolerance),
y = -1,
z = screenYPosition
)
button()
|> translate(
x = -(screenWidth / 2 + tolerance),
y = -1,
z = screenYPosition - buttonHeight - (tolerance * 2)
)
button()
|> rotate(
@ -74,10 +59,21 @@ button()
yaw = 0,
)
|> translate(
translate = [
screenWidth / 2 + tolerance,
-1,
screenYPosition - (buttonHeight * 2) - (tolerance * 2)
],
x = screenWidth / 2 + tolerance,
y = -1,
z = screenYPosition - buttonHeight,
global = true,
)
button()
|> rotate(
%,
roll = 0,
pitch = 180,
yaw = 0,
)
|> translate(
x = screenWidth / 2 + tolerance,
y = -1,
z = screenYPosition - (buttonHeight * 2) - (tolerance * 2),
global = true,
)

View File

@ -43,6 +43,10 @@ overwrite-sim-test test_name:
EXPECTORATE=overwrite TWENTY_TWENTY=overwrite {{cita}} -p kcl-lib --no-quiet -- tests::{{test_name}}::kcl_test_execute
EXPECTORATE=overwrite {{cita}} -p kcl-lib --no-quiet -- simulation_tests::{{test_name}}::test_after_engine
# Regenerate all the simulation test output.
redo-sim-tests:
EXPECTORATE=overwrite TWENTY_TWENTY=overwrite {{cita}} -p kcl-lib --no-quiet -- simulation_tests
test:
export RUST_BRACKTRACE="full" && cargo nextest run --workspace --no-fail-fast

View File

@ -0,0 +1,77 @@
@settings(defaultLengthUnit = mm)
sketch001 = startSketchOn(XZ)
profile001 = circle(sketch001, center = [154.36, 113.92], radius = 41.09)
extrude001 = extrude(profile001, length = 200)
sketch002 = startSketchOn(XY)
profile002 = startProfileAt([72.24, -52.05], sketch002)
|> angledLine([0, 181.26], %, $rectangleSegmentA001)
|> angledLine([
segAng(rectangleSegmentA001) - 90,
21.54
], %)
|> angledLine([
segAng(rectangleSegmentA001),
-segLen(rectangleSegmentA001)
], %, $mySeg)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
extrude002 = extrude(profile002, length = 150)
|> chamfer(
%,
length = 15,
tags = [mySeg],
tag = $seg02,
)
sketch003 = startSketchOn(extrude002, mySeg)
profile003 = startProfileAt([207.36, 126.19], sketch003)
|> angledLine([0, 33.57], %, $rectangleSegmentA002)
|> angledLine([
segAng(rectangleSegmentA002) - 90,
99.11
], %)
|> angledLine([
segAng(rectangleSegmentA002),
-segLen(rectangleSegmentA002)
], %, $seg01)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
extrude003 = extrude(profile003, length = -20)
sketch004 = startSketchOn(extrude003, seg01)
profile004 = startProfileAt([-235.38, 66.16], sketch004)
|> angledLine([0, 24.21], %, $rectangleSegmentA003)
|> angledLine([
segAng(rectangleSegmentA003) - 90,
3.72
], %)
|> angledLine([
segAng(rectangleSegmentA003),
-segLen(rectangleSegmentA003)
], %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
extrude004 = extrude(profile004, length = 30)
sketch005 = startSketchOn(extrude002, seg02)
profile005 = startProfileAt([-129.93, -59.19], sketch005)
|> xLine(length = 48.79)
|> line(end = [1.33, 11.03])
|> xLine(length = -60.56, tag = $seg03)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
extrude005 = extrude(profile005, length = -10)
sketch006 = startSketchOn(extrude005, seg03)
profile006 = startProfileAt([-95.86, 38.73], sketch006)
|> angledLine([0, 3.48], %, $rectangleSegmentA004)
|> angledLine([
segAng(rectangleSegmentA004) - 90,
3.36
], %)
|> angledLine([
segAng(rectangleSegmentA004),
-segLen(rectangleSegmentA004)
], %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
extrude006 = extrude(profile006, length = 13)

View File

@ -1141,7 +1141,7 @@ mod tests {
let snippet = scale_fn.to_autocomplete_snippet().unwrap();
assert_eq!(
snippet,
r#"scale(${0:%}, scale = [${1:3.14}, ${2:3.14}, ${3:3.14}])${}"#
r#"scale(${0:%}, x = ${1:3.14}, y = ${2:3.14}, z = ${3:3.14})${}"#
);
}
@ -1152,7 +1152,7 @@ mod tests {
let snippet = translate_fn.to_autocomplete_snippet().unwrap();
assert_eq!(
snippet,
r#"translate(${0:%}, translate = [${1:3.14}, ${2:3.14}, ${3:3.14}])${}"#
r#"translate(${0:%}, x = ${1:3.14}, y = ${2:3.14}, z = ${3:3.14})${}"#
);
}

View File

@ -121,6 +121,13 @@ impl EngineConnection {
}
})?;
if value.is_null() || value.is_undefined() {
return Err(KclError::Engine(KclErrorDetails {
message: "Received null or undefined response from engine".into(),
source_ranges: vec![source_range],
}));
}
// Convert JsValue to a Uint8Array
let data = js_sys::Uint8Array::from(value);

View File

@ -201,6 +201,35 @@
//! check safety, it is not ever used for any decision. In any case, modifying the env storage is
//! must be safe if the env is in either state, so even if the transition happens at the same time
//! as the storage modification, it is ok.
//!
//! Here is an ascii art diagram of the memory system:
//!
//! +----------------------------+
//! | ProgramMemory |
//! |----------------------------|
//! | Envs: |
//! | |
//! | [ Env 1 ] |
//! | - Vars: { "a" = 10 } |
//! | - Epoch: 1 |
//! | - Owner ID: 0 | <- read-only
//! | |
//! | [ Env 2 ] |
//! | - Vars: { "b" = a } |
//! | - Epoch: 2 |
//! | - Owner ID: 42 | <- owned by Stack 42
//! | |
//! +-------------^--------------+
//! |
//! | shared, immutable OR
//! | uniquely owned mutable reference
//! +---------+---------+
//! | Stack 42 |
//! |-------------------|
//! | stack_id: 42 |
//! | env_stack: [2] |
//! | epoch: 2 |
//! +-------------------+
use std::{
cell::UnsafeCell,

View File

@ -2044,6 +2044,8 @@ let w = f() + f()
// Ensure the settings are as expected.
assert_eq!(settings_state, ctx.settings);
ctx.close().await;
}
#[tokio::test(flavor = "multi_thread")]
@ -2057,6 +2059,9 @@ let w = f() + f()
let program2 = crate::Program::parse_no_errs("z = x + 1").unwrap();
let result = ctx2.run_mock(program2, true).await.unwrap();
assert_eq!(result.variables.get("z").unwrap().as_f64().unwrap(), 3.0);
ctx.close().await;
ctx2.close().await;
}
#[tokio::test(flavor = "multi_thread")]

View File

@ -133,6 +133,13 @@ impl<T> Node<T> {
})
}
fn reset_source(&mut self) {
self.start = 0;
self.end = 0;
self.module_id = ModuleId::default();
self.comment_start = 0;
}
pub fn as_source_range(&self) -> SourceRange {
SourceRange::new(self.start, self.end, self.module_id)
}
@ -345,7 +352,10 @@ impl Node<Program> {
let mut found = false;
for node in &mut new_program.inner_attrs {
if node.name() == Some(annotations::SETTINGS) {
*node = Node::no_src(Annotation::new_from_meta_settings(&settings));
node.inner = Annotation::new_from_meta_settings(&settings);
// Previous source range no longer makes sense, but we want to
// preserve other things like comments.
node.reset_source();
found = true;
break;
}
@ -4140,6 +4150,50 @@ startSketchOn(XY)
r#"@settings(defaultLengthUnit = mm)
startSketchOn(XY)
"#
);
}
#[tokio::test(flavor = "multi_thread")]
async fn test_change_meta_settings_preserves_comments() {
let code = r#"// Title
// Set Units
@settings(defaultLengthUnit = in)
// Between
// Above Code
5
"#;
let program = crate::parsing::top_level_parse(code).unwrap();
let new_program = program
.change_meta_settings(crate::execution::MetaSettings {
default_length_units: crate::execution::types::UnitLen::Cm,
..Default::default()
})
.unwrap();
let result = new_program.meta_settings().unwrap();
assert!(result.is_some());
let meta_settings = result.unwrap();
assert_eq!(meta_settings.default_length_units, crate::execution::types::UnitLen::Cm);
let formatted = new_program.recast(&Default::default(), 0);
assert_eq!(
formatted,
r#"// Title
// Set Units
@settings(defaultLengthUnit = cm)
// Between
// Above Code
5
"#
);
}

View File

@ -2379,3 +2379,66 @@ mod rotate_after_fillet {
super::execute(TEST_NAME, true).await
}
}
mod union_cubes {
const TEST_NAME: &str = "union_cubes";
/// Test parsing KCL.
#[test]
fn parse() {
super::parse(TEST_NAME)
}
/// Test that parsing and unparsing KCL produces the original KCL input.
#[tokio::test(flavor = "multi_thread")]
async fn unparse() {
super::unparse(TEST_NAME).await
}
/// Test that KCL is executed correctly.
#[tokio::test(flavor = "multi_thread")]
async fn kcl_test_execute() {
super::execute(TEST_NAME, true).await
}
}
mod subtract_cylinder_from_cube {
const TEST_NAME: &str = "subtract_cylinder_from_cube";
/// Test parsing KCL.
#[test]
fn parse() {
super::parse(TEST_NAME)
}
/// Test that parsing and unparsing KCL produces the original KCL input.
#[tokio::test(flavor = "multi_thread")]
async fn unparse() {
super::unparse(TEST_NAME).await
}
/// Test that KCL is executed correctly.
#[tokio::test(flavor = "multi_thread")]
async fn kcl_test_execute() {
super::execute(TEST_NAME, true).await
}
}
mod intersect_cubes {
const TEST_NAME: &str = "intersect_cubes";
/// Test parsing KCL.
#[test]
fn parse() {
super::parse(TEST_NAME)
}
/// Test that parsing and unparsing KCL produces the original KCL input.
#[tokio::test(flavor = "multi_thread")]
async fn unparse() {
super::unparse(TEST_NAME).await
}
/// Test that KCL is executed correctly.
#[tokio::test(flavor = "multi_thread")]
async fn kcl_test_execute() {
super::execute(TEST_NAME, true).await
}
}

View File

@ -45,7 +45,7 @@ pub async fn union(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
/// ```
#[stdlib {
name = "union",
feature_tree_operation = false,
feature_tree_operation = true,
keywords = true,
unlabeled_first = true,
deprecated = true,
@ -107,7 +107,7 @@ pub async fn intersect(exec_state: &mut ExecState, args: Args) -> Result<KclValu
/// ```
#[stdlib {
name = "intersect",
feature_tree_operation = false,
feature_tree_operation = true,
keywords = true,
unlabeled_first = true,
deprecated = true,
@ -164,7 +164,7 @@ pub async fn subtract(exec_state: &mut ExecState, args: Args) -> Result<KclValue
/// ```
#[stdlib {
name = "subtract",
feature_tree_operation = false,
feature_tree_operation = true,
keywords = true,
unlabeled_first = true,
deprecated = true,

View File

@ -28,15 +28,22 @@ pub async fn scale(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
]),
exec_state,
)?;
let scale = args.get_kw_arg("scale")?;
let scale_x = args.get_kw_arg("x")?;
let scale_y = args.get_kw_arg("y")?;
let scale_z = args.get_kw_arg("z")?;
let global = args.get_kw_arg_opt("global")?;
let objects = inner_scale(objects, scale, global, exec_state, args).await?;
let objects = inner_scale(objects, scale_x, scale_y, scale_z, global, exec_state, args).await?;
Ok(objects.into())
}
/// Scale a solid or a sketch.
///
/// This is really useful for resizing parts. You can create a part and then scale it to the
/// correct size.
///
/// For sketches, you can use this to scale a sketch and then loft it with another sketch.
///
/// By default the transform is applied in local sketch axis, therefore the origin will not move.
///
/// If you want to apply the transform in global space, set `global` to `true`. The origin of the
@ -78,7 +85,9 @@ pub async fn scale(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
/// |> hole(pipeHole, %)
/// |> sweep(path = sweepPath)
/// |> scale(
/// scale = [1.0, 1.0, 2.5],
/// x = 1.0,
/// y = 1.0,
/// z = 2.5,
/// )
/// ```
///
@ -89,7 +98,9 @@ pub async fn scale(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
///
/// cube
/// |> scale(
/// scale = [1.0, 1.0, 2.5],
/// x = 1.0,
/// y = 1.0,
/// z = 2.5,
/// )
/// ```
///
@ -124,7 +135,7 @@ pub async fn scale(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
/// parts = sweep([rectangleSketch, circleSketch], path = sweepPath)
///
/// // Scale the sweep.
/// scale(parts, scale = [1.0, 1.0, 0.5])
/// scale(parts, x = 1.0, y = 1.0, z = 0.5)
/// ```
#[stdlib {
name = "scale",
@ -133,13 +144,17 @@ pub async fn scale(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
unlabeled_first = true,
args = {
objects = {docs = "The solid, sketch, or set of solids or sketches to scale."},
scale = {docs = "The scale factor for the x, y, and z axes."},
x = {docs = "The scale factor for the x axis."},
y = {docs = "The scale factor for the y axis."},
z = {docs = "The scale factor for the z axis."},
global = {docs = "If true, the transform is applied in global space. The origin of the model will move. By default, the transform is applied in local sketch axis, therefore the origin will not move."}
}
}]
async fn inner_scale(
objects: SolidOrSketchOrImportedGeometry,
scale: [f64; 3],
x: f64,
y: f64,
z: f64,
global: Option<bool>,
exec_state: &mut ExecState,
args: Args,
@ -159,11 +174,7 @@ async fn inner_scale(
object_id,
transforms: vec![shared::ComponentTransform {
scale: Some(shared::TransformBy::<Point3d<f64>> {
property: Point3d {
x: scale[0],
y: scale[1],
z: scale[2],
},
property: Point3d { x, y, z },
set: false,
is_local: !global.unwrap_or(false),
}),
@ -190,15 +201,23 @@ pub async fn translate(exec_state: &mut ExecState, args: Args) -> Result<KclValu
]),
exec_state,
)?;
let translate = args.get_kw_arg("translate")?;
let translate_x = args.get_kw_arg("x")?;
let translate_y = args.get_kw_arg("y")?;
let translate_z = args.get_kw_arg("z")?;
let global = args.get_kw_arg_opt("global")?;
let objects = inner_translate(objects, translate, global, exec_state, args).await?;
let objects = inner_translate(objects, translate_x, translate_y, translate_z, global, exec_state, args).await?;
Ok(objects.into())
}
/// Move a solid or a sketch.
///
/// This is really useful for assembling parts together. You can create a part
/// and then move it to the correct location.
///
/// Translate is really useful for sketches if you want to move a sketch
/// and then rotate it using the `rotate` function to create a loft.
///
/// ```no_run
/// // Move a pipe.
///
@ -232,7 +251,9 @@ pub async fn translate(exec_state: &mut ExecState, args: Args) -> Result<KclValu
/// |> hole(pipeHole, %)
/// |> sweep(path = sweepPath)
/// |> translate(
/// translate = [1.0, 1.0, 2.5],
/// x = 1.0,
/// y = 1.0,
/// z = 2.5,
/// )
/// ```
///
@ -243,7 +264,9 @@ pub async fn translate(exec_state: &mut ExecState, args: Args) -> Result<KclValu
///
/// cube
/// |> translate(
/// translate = [1.0, 1.0, 2.5],
/// x = 1.0,
/// y = 1.0,
/// z = 2.5,
/// )
/// ```
///
@ -278,7 +301,7 @@ pub async fn translate(exec_state: &mut ExecState, args: Args) -> Result<KclValu
/// parts = sweep([rectangleSketch, circleSketch], path = sweepPath)
///
/// // Move the sweeps.
/// translate(parts, translate = [1.0, 1.0, 2.5])
/// translate(parts, x = 1.0, y = 1.0, z = 2.5)
/// ```
///
/// ```no_run
@ -301,7 +324,9 @@ pub async fn translate(exec_state: &mut ExecState, args: Args) -> Result<KclValu
///
/// square(10)
/// |> translate(
/// translate = [5, 5, 0],
/// x = 5,
/// y = 5,
/// z = 0,
/// )
/// |> extrude(
/// length = 10,
@ -324,7 +349,7 @@ pub async fn translate(exec_state: &mut ExecState, args: Args) -> Result<KclValu
/// profile001 = square()
///
/// profile002 = square()
/// |> translate(translate = [0, 0, 20])
/// |> translate(x = 0, y = 0, z = 20)
/// |> rotate(axis = [0, 0, 1.0], angle = 45)
///
/// loft([profile001, profile002])
@ -336,13 +361,17 @@ pub async fn translate(exec_state: &mut ExecState, args: Args) -> Result<KclValu
unlabeled_first = true,
args = {
objects = {docs = "The solid, sketch, or set of solids or sketches to move."},
translate = {docs = "The amount to move the solid or sketch in all three axes."},
x = {docs = "The amount to move the solid or sketch along the x axis."},
y = {docs = "The amount to move the solid or sketch along the y axis."},
z = {docs = "The amount to move the solid or sketch along the z axis."},
global = {docs = "If true, the transform is applied in global space. The origin of the model will move. By default, the transform is applied in local sketch axis, therefore the origin will not move."}
}
}]
async fn inner_translate(
objects: SolidOrSketchOrImportedGeometry,
translate: [f64; 3],
x: f64,
y: f64,
z: f64,
global: Option<bool>,
exec_state: &mut ExecState,
args: Args,
@ -363,9 +392,9 @@ async fn inner_translate(
transforms: vec![shared::ComponentTransform {
translate: Some(shared::TransformBy::<Point3d<LengthUnit>> {
property: shared::Point3d {
x: LengthUnit(translate[0]),
y: LengthUnit(translate[1]),
z: LengthUnit(translate[2]),
x: LengthUnit(x),
y: LengthUnit(y),
z: LengthUnit(z),
},
set: false,
is_local: !global.unwrap_or(false),
@ -506,6 +535,11 @@ pub async fn rotate(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
/// Rotate a solid or a sketch.
///
/// This is really useful for assembling parts together. You can create a part
/// and then rotate it to the correct orientation.
///
/// For sketches, you can use this to rotate a sketch and then loft it with another sketch.
///
/// ### Using Roll, Pitch, and Yaw
///
/// When rotating a part in 3D space, "roll," "pitch," and "yaw" refer to the
@ -667,7 +701,7 @@ pub async fn rotate(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
/// profile001 = square()
///
/// profile002 = square()
/// |> translate(translate = [0, 0, 20])
/// |> translate(x = 0, y = 0, z = 20)
/// |> rotate(axis = [0, 0, 1.0], angle = 45)
///
/// loft([profile001, profile002])

View File

@ -151,54 +151,65 @@ description: Result of parsing import_transform.kcl
"label": {
"commentStart": 159,
"end": 0,
"name": "translate",
"name": "x",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 171,
"elements": [
{
"commentStart": 172,
"end": 0,
"raw": "3.14",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.14,
"suffix": "None"
}
},
{
"commentStart": 178,
"end": 0,
"raw": "3.14",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.14,
"suffix": "None"
}
},
{
"commentStart": 184,
"end": 0,
"raw": "3.14",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.14,
"suffix": "None"
}
}
],
"commentStart": 163,
"end": 0,
"raw": "3.14",
"start": 0,
"type": "ArrayExpression",
"type": "ArrayExpression"
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.14,
"suffix": "None"
}
}
},
{
"type": "LabeledArg",
"label": {
"commentStart": 169,
"end": 0,
"name": "y",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 173,
"end": 0,
"raw": "3.14",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.14,
"suffix": "None"
}
}
},
{
"type": "LabeledArg",
"label": {
"commentStart": 179,
"end": 0,
"name": "z",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 183,
"end": 0,
"raw": "3.14",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.14,
"suffix": "None"
}
}
}
],
@ -235,65 +246,76 @@ description: Result of parsing import_transform.kcl
{
"type": "LabeledArg",
"label": {
"commentStart": 205,
"commentStart": 203,
"end": 0,
"name": "scale",
"name": "x",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 213,
"elements": [
{
"commentStart": 214,
"end": 0,
"raw": "3.14",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.14,
"suffix": "None"
}
},
{
"commentStart": 220,
"end": 0,
"raw": "3.14",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.14,
"suffix": "None"
}
},
{
"commentStart": 226,
"end": 0,
"raw": "3.14",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.14,
"suffix": "None"
}
}
],
"commentStart": 207,
"end": 0,
"raw": "3.14",
"start": 0,
"type": "ArrayExpression",
"type": "ArrayExpression"
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.14,
"suffix": "None"
}
}
},
{
"type": "LabeledArg",
"label": {
"commentStart": 213,
"end": 0,
"name": "y",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 217,
"end": 0,
"raw": "3.14",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.14,
"suffix": "None"
}
}
},
{
"type": "LabeledArg",
"label": {
"commentStart": 223,
"end": 0,
"name": "z",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 227,
"end": 0,
"raw": "3.14",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.14,
"suffix": "None"
}
}
}
],
"callee": {
"abs_path": false,
"commentStart": 196,
"commentStart": 194,
"end": 0,
"name": {
"commentStart": 196,
"commentStart": 194,
"end": 0,
"name": "scale",
"start": 0,
@ -303,13 +325,13 @@ description: Result of parsing import_transform.kcl
"start": 0,
"type": "Name"
},
"commentStart": 196,
"commentStart": 194,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"commentStart": 202,
"commentStart": 200,
"end": 0,
"start": 0,
"type": "PipeSubstitution",

View File

@ -7,5 +7,5 @@ screw
pitch = 3.14,
yaw = 3.14,
)
|> translate(%, translate = [3.14, 3.14, 3.14])
|> scale(%, scale = [3.14, 3.14, 3.14])
|> translate(%, x = 3.14, y = 3.14, z = 3.14)
|> scale(%, x = 3.14, y = 3.14, z = 3.14)

View File

@ -11,5 +11,15 @@ screw
pitch = 3.14,
yaw = 3.14,
)
|> translate(%, translate = [3.14, 3.14, 3.14])
|> scale(%, scale = [3.14, 3.14, 3.14])
|> translate(
%,
x = 3.14,
y = 3.14,
z = 3.14,
)
|> scale(
%,
x = 3.14,
y = 3.14,
z = 3.14,
)

View File

@ -0,0 +1,554 @@
---
source: kcl-lib/src/simulation_tests.rs
description: Artifact commands intersect_cubes.kcl
---
[
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "edge_lines_visible",
"hidden": false
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "set_scene_units",
"unit": "mm"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
"hidden": true
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
"hidden": true
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"size": 60.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "enable_sketch_mode",
"entity_id": "[uuid]",
"ortho": false,
"animated": false,
"adjust_camera": false,
"planar_normal": {
"x": 0.0,
"y": 0.0,
"z": 1.0
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "start_path"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "move_path_pen",
"path": "[uuid]",
"to": {
"x": -10.0,
"y": -10.0,
"z": 0.0
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "sketch_mode_disable"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": 10.0,
"y": -10.0,
"z": 0.0
},
"relative": false
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": 10.0,
"y": 10.0,
"z": 0.0
},
"relative": false
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": -10.0,
"y": 10.0,
"z": 0.0
},
"relative": false
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "close_path",
"path_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "enable_sketch_mode",
"entity_id": "[uuid]",
"ortho": false,
"animated": false,
"adjust_camera": false,
"planar_normal": {
"x": 0.0,
"y": 0.0,
"z": 1.0
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "extrude",
"target": "[uuid]",
"distance": 10.0,
"faces": null
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "sketch_mode_disable"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "object_bring_to_front",
"object_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_extrusion_face_info",
"object_id": "[uuid]",
"edge_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"size": 60.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "enable_sketch_mode",
"entity_id": "[uuid]",
"ortho": false,
"animated": false,
"adjust_camera": false,
"planar_normal": {
"x": 0.0,
"y": 0.0,
"z": 1.0
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "start_path"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "move_path_pen",
"path": "[uuid]",
"to": {
"x": -2.0,
"y": -2.0,
"z": 0.0
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "sketch_mode_disable"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": 18.0,
"y": -2.0,
"z": 0.0
},
"relative": false
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": 18.0,
"y": 18.0,
"z": 0.0
},
"relative": false
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": -2.0,
"y": 18.0,
"z": 0.0
},
"relative": false
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "close_path",
"path_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "enable_sketch_mode",
"entity_id": "[uuid]",
"ortho": false,
"animated": false,
"adjust_camera": false,
"planar_normal": {
"x": 0.0,
"y": 0.0,
"z": 1.0
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "extrude",
"target": "[uuid]",
"distance": 10.0,
"faces": null
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "sketch_mode_disable"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "object_bring_to_front",
"object_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_extrusion_face_info",
"object_id": "[uuid]",
"edge_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
}
]

View File

@ -0,0 +1,6 @@
---
source: kcl-lib/src/simulation_tests.rs
description: Artifact graph flowchart intersect_cubes.kcl
extension: md
snapshot_kind: binary
---

View File

@ -0,0 +1,117 @@
```mermaid
flowchart LR
subgraph path2 [Path]
2["Path<br>[52, 103, 0]"]
3["Segment<br>[111, 163, 0]"]
4["Segment<br>[171, 223, 0]"]
5["Segment<br>[231, 283, 0]"]
6["Segment<br>[291, 298, 0]"]
7[Solid2d]
end
subgraph path24 [Path]
24["Path<br>[52, 103, 0]"]
25["Segment<br>[111, 163, 0]"]
26["Segment<br>[171, 223, 0]"]
27["Segment<br>[231, 283, 0]"]
28["Segment<br>[291, 298, 0]"]
29[Solid2d]
end
1["Plane<br>[27, 44, 0]"]
8["Sweep Extrusion<br>[306, 326, 0]"]
9[Wall]
10[Wall]
11[Wall]
12[Wall]
13["Cap Start"]
14["Cap End"]
15["SweepEdge Opposite"]
16["SweepEdge Adjacent"]
17["SweepEdge Opposite"]
18["SweepEdge Adjacent"]
19["SweepEdge Opposite"]
20["SweepEdge Adjacent"]
21["SweepEdge Opposite"]
22["SweepEdge Adjacent"]
23["Plane<br>[27, 44, 0]"]
30["Sweep Extrusion<br>[306, 326, 0]"]
31[Wall]
32[Wall]
33[Wall]
34[Wall]
35["Cap Start"]
36["Cap End"]
37["SweepEdge Opposite"]
38["SweepEdge Adjacent"]
39["SweepEdge Opposite"]
40["SweepEdge Adjacent"]
41["SweepEdge Opposite"]
42["SweepEdge Adjacent"]
43["SweepEdge Opposite"]
44["SweepEdge Adjacent"]
1 --- 2
2 --- 3
2 --- 4
2 --- 5
2 --- 6
2 ---- 8
2 --- 7
3 --- 9
3 --- 15
3 --- 16
4 --- 10
4 --- 17
4 --- 18
5 --- 11
5 --- 19
5 --- 20
6 --- 12
6 --- 21
6 --- 22
8 --- 9
8 --- 10
8 --- 11
8 --- 12
8 --- 13
8 --- 14
8 --- 15
8 --- 16
8 --- 17
8 --- 18
8 --- 19
8 --- 20
8 --- 21
8 --- 22
23 --- 24
24 --- 25
24 --- 26
24 --- 27
24 --- 28
24 ---- 30
24 --- 29
25 --- 31
25 --- 37
25 --- 38
26 --- 32
26 --- 39
26 --- 40
27 --- 33
27 --- 41
27 --- 42
28 --- 34
28 --- 43
28 --- 44
30 --- 31
30 --- 32
30 --- 33
30 --- 34
30 --- 35
30 --- 36
30 --- 37
30 --- 38
30 --- 39
30 --- 40
30 --- 41
30 --- 42
30 --- 43
30 --- 44
```

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,14 @@
fn cube(center) {
return startSketchOn(XY)
|> startProfileAt([center[0] - 10, center[1] - 10], %)
|> line(endAbsolute = [center[0] + 10, center[1] - 10])
|> line(endAbsolute = [center[0] + 10, center[1] + 10])
|> line(endAbsolute = [center[0] - 10, center[1] + 10])
|> close()
|> extrude(length = 10)
}
part001 = cube([0, 0])
part002 = cube([8, 8])
fullPart = intersect([part001, part002])

View File

@ -0,0 +1,158 @@
---
source: kcl-lib/src/simulation_tests.rs
description: Operations executed intersect_cubes.kcl
---
[
{
"type": "UserDefinedFunctionCall",
"name": "cube",
"functionSourceRange": [
7,
328,
0
],
"unlabeledArg": null,
"labeledArgs": {},
"sourceRange": []
},
{
"labeledArgs": {
"data": {
"value": {
"type": "Plane",
"artifact_id": "[uuid]"
},
"sourceRange": []
}
},
"name": "startSketchOn",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"value": {
"type": "Number",
"value": 10.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
}
},
"sourceRange": []
}
},
"name": "extrude",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Sketch",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
}
},
{
"type": "UserDefinedFunctionReturn"
},
{
"type": "UserDefinedFunctionCall",
"name": "cube",
"functionSourceRange": [
7,
328,
0
],
"unlabeledArg": null,
"labeledArgs": {},
"sourceRange": []
},
{
"labeledArgs": {
"data": {
"value": {
"type": "Plane",
"artifact_id": "[uuid]"
},
"sourceRange": []
}
},
"name": "startSketchOn",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"value": {
"type": "Number",
"value": 10.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
}
},
"sourceRange": []
}
},
"name": "extrude",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Sketch",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
}
},
{
"type": "UserDefinedFunctionReturn"
},
{
"labeledArgs": {
"solids": {
"value": {
"type": "Array",
"value": [
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
}
]
},
"sourceRange": []
}
},
"name": "intersect",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": null
}
]

View File

@ -0,0 +1,543 @@
---
source: kcl-lib/src/simulation_tests.rs
description: Variables in memory after executing intersect_cubes.kcl
---
{
"cube": {
"type": "Function"
},
"fullPart": {
"type": "Solid",
"value": {
"type": "Solid",
"id": "[uuid]",
"artifactId": "[uuid]",
"value": [
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
}
],
"sketch": {
"type": "Sketch",
"id": "[uuid]",
"paths": [
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
-10.0,
-10.0
],
"tag": null,
"to": [
10.0,
-10.0
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
10.0,
-10.0
],
"tag": null,
"to": [
10.0,
10.0
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
10.0,
10.0
],
"tag": null,
"to": [
-10.0,
10.0
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
-10.0,
10.0
],
"tag": null,
"to": [
-10.0,
-10.0
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
}
],
"on": {
"type": "plane",
"id": "[uuid]",
"artifactId": "[uuid]",
"value": "XY",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"xAxis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"yAxis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"zAxis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"units": {
"type": "Mm"
}
},
"start": {
"from": [
-10.0,
-10.0
],
"to": [
-10.0,
-10.0
],
"units": {
"type": "Mm"
},
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
}
},
"artifactId": "[uuid]",
"originalId": "[uuid]",
"units": {
"type": "Mm"
}
},
"height": 10.0,
"startCapId": "[uuid]",
"endCapId": "[uuid]",
"units": {
"type": "Mm"
}
}
},
"part001": {
"type": "Solid",
"value": {
"type": "Solid",
"id": "[uuid]",
"artifactId": "[uuid]",
"value": [
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
}
],
"sketch": {
"type": "Sketch",
"id": "[uuid]",
"paths": [
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
-10.0,
-10.0
],
"tag": null,
"to": [
10.0,
-10.0
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
10.0,
-10.0
],
"tag": null,
"to": [
10.0,
10.0
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
10.0,
10.0
],
"tag": null,
"to": [
-10.0,
10.0
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
-10.0,
10.0
],
"tag": null,
"to": [
-10.0,
-10.0
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
}
],
"on": {
"type": "plane",
"id": "[uuid]",
"artifactId": "[uuid]",
"value": "XY",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"xAxis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"yAxis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"zAxis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"units": {
"type": "Mm"
}
},
"start": {
"from": [
-10.0,
-10.0
],
"to": [
-10.0,
-10.0
],
"units": {
"type": "Mm"
},
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
}
},
"artifactId": "[uuid]",
"originalId": "[uuid]",
"units": {
"type": "Mm"
}
},
"height": 10.0,
"startCapId": "[uuid]",
"endCapId": "[uuid]",
"units": {
"type": "Mm"
}
}
},
"part002": {
"type": "Solid",
"value": {
"type": "Solid",
"id": "[uuid]",
"artifactId": "[uuid]",
"value": [
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
}
],
"sketch": {
"type": "Sketch",
"id": "[uuid]",
"paths": [
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
-2.0,
-2.0
],
"tag": null,
"to": [
18.0,
-2.0
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
18.0,
-2.0
],
"tag": null,
"to": [
18.0,
18.0
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
18.0,
18.0
],
"tag": null,
"to": [
-2.0,
18.0
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
-2.0,
18.0
],
"tag": null,
"to": [
-2.0,
-2.0
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
}
],
"on": {
"type": "plane",
"id": "[uuid]",
"artifactId": "[uuid]",
"value": "XY",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"xAxis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"yAxis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"zAxis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"units": {
"type": "Mm"
}
},
"start": {
"from": [
-2.0,
-2.0
],
"to": [
-2.0,
-2.0
],
"units": {
"type": "Mm"
},
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
}
},
"artifactId": "[uuid]",
"originalId": "[uuid]",
"units": {
"type": "Mm"
}
},
"height": 10.0,
"startCapId": "[uuid]",
"endCapId": "[uuid]",
"units": {
"type": "Mm"
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

View File

@ -0,0 +1,18 @@
---
source: kcl-lib/src/simulation_tests.rs
description: Result of unparsing intersect_cubes.kcl
---
fn cube(center) {
return startSketchOn(XY)
|> startProfileAt([center[0] - 10, center[1] - 10], %)
|> line(endAbsolute = [center[0] + 10, center[1] - 10])
|> line(endAbsolute = [center[0] + 10, center[1] + 10])
|> line(endAbsolute = [center[0] - 10, center[1] + 10])
|> close()
|> extrude(length = 10)
}
part001 = cube([0, 0])
part002 = cube([8, 8])
fullPart = intersect([part001, part002])

View File

@ -168,54 +168,65 @@ description: Result of parsing car-wheel-assembly.kcl
"label": {
"commentStart": 366,
"end": 0,
"name": "translate",
"name": "x",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 378,
"elements": [
{
"commentStart": 379,
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
{
"commentStart": 382,
"end": 0,
"raw": "0.5",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.5,
"suffix": "None"
}
},
{
"commentStart": 387,
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
}
],
"commentStart": 370,
"end": 0,
"raw": "0",
"start": 0,
"type": "ArrayExpression",
"type": "ArrayExpression"
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
}
},
{
"type": "LabeledArg",
"label": {
"commentStart": 373,
"end": 0,
"name": "y",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 377,
"end": 0,
"raw": "0.5",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.5,
"suffix": "None"
}
}
},
{
"type": "LabeledArg",
"label": {
"commentStart": 382,
"end": 0,
"name": "z",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 386,
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
}
}
],
@ -253,14 +264,14 @@ description: Result of parsing car-wheel-assembly.kcl
"type": "ExpressionStatement"
},
{
"commentStart": 391,
"commentStart": 389,
"end": 0,
"expression": {
"abs_path": false,
"commentStart": 391,
"commentStart": 389,
"end": 0,
"name": {
"commentStart": 391,
"commentStart": 389,
"end": 0,
"name": "carWheel",
"start": 0,
@ -276,16 +287,16 @@ description: Result of parsing car-wheel-assembly.kcl
"type": "ExpressionStatement"
},
{
"commentStart": 400,
"commentStart": 398,
"end": 0,
"expression": {
"body": [
{
"abs_path": false,
"commentStart": 400,
"commentStart": 398,
"end": 0,
"name": {
"commentStart": 400,
"commentStart": 398,
"end": 0,
"name": "lugNut",
"start": 0,
@ -301,14 +312,14 @@ description: Result of parsing car-wheel-assembly.kcl
{
"type": "LabeledArg",
"label": {
"commentStart": 438,
"commentStart": 436,
"end": 0,
"name": "arcDegrees",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 451,
"commentStart": 449,
"end": 0,
"raw": "360",
"start": 0,
@ -323,17 +334,17 @@ description: Result of parsing car-wheel-assembly.kcl
{
"type": "LabeledArg",
"label": {
"commentStart": 463,
"commentStart": 461,
"end": 0,
"name": "axis",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 470,
"commentStart": 468,
"elements": [
{
"commentStart": 471,
"commentStart": 469,
"end": 0,
"raw": "0",
"start": 0,
@ -345,7 +356,7 @@ description: Result of parsing car-wheel-assembly.kcl
}
},
{
"commentStart": 474,
"commentStart": 472,
"end": 0,
"raw": "1",
"start": 0,
@ -357,7 +368,7 @@ description: Result of parsing car-wheel-assembly.kcl
}
},
{
"commentStart": 477,
"commentStart": 475,
"end": 0,
"raw": "0",
"start": 0,
@ -378,17 +389,17 @@ description: Result of parsing car-wheel-assembly.kcl
{
"type": "LabeledArg",
"label": {
"commentStart": 488,
"commentStart": 486,
"end": 0,
"name": "center",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 497,
"commentStart": 495,
"elements": [
{
"commentStart": 498,
"commentStart": 496,
"end": 0,
"raw": "0",
"start": 0,
@ -400,7 +411,7 @@ description: Result of parsing car-wheel-assembly.kcl
}
},
{
"commentStart": 501,
"commentStart": 499,
"end": 0,
"raw": "0",
"start": 0,
@ -412,7 +423,7 @@ description: Result of parsing car-wheel-assembly.kcl
}
},
{
"commentStart": 504,
"commentStart": 502,
"end": 0,
"raw": "0",
"start": 0,
@ -433,7 +444,7 @@ description: Result of parsing car-wheel-assembly.kcl
{
"type": "LabeledArg",
"label": {
"commentStart": 515,
"commentStart": 513,
"end": 0,
"name": "instances",
"start": 0,
@ -441,10 +452,10 @@ description: Result of parsing car-wheel-assembly.kcl
},
"arg": {
"abs_path": false,
"commentStart": 527,
"commentStart": 525,
"end": 0,
"name": {
"commentStart": 527,
"commentStart": 525,
"end": 0,
"name": "lugCount",
"start": 0,
@ -459,14 +470,14 @@ description: Result of parsing car-wheel-assembly.kcl
{
"type": "LabeledArg",
"label": {
"commentStart": 544,
"commentStart": 542,
"end": 0,
"name": "rotateDuplicates",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 563,
"commentStart": 561,
"end": 0,
"raw": "false",
"start": 0,
@ -478,10 +489,10 @@ description: Result of parsing car-wheel-assembly.kcl
],
"callee": {
"abs_path": false,
"commentStart": 412,
"commentStart": 410,
"end": 0,
"name": {
"commentStart": 412,
"commentStart": 410,
"end": 0,
"name": "patternCircular3d",
"start": 0,
@ -491,7 +502,7 @@ description: Result of parsing car-wheel-assembly.kcl
"start": 0,
"type": "Name"
},
"commentStart": 412,
"commentStart": 410,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
@ -499,7 +510,7 @@ description: Result of parsing car-wheel-assembly.kcl
"unlabeled": null
}
],
"commentStart": 400,
"commentStart": 398,
"end": 0,
"start": 0,
"type": "PipeExpression",
@ -510,16 +521,16 @@ description: Result of parsing car-wheel-assembly.kcl
"type": "ExpressionStatement"
},
{
"commentStart": 577,
"commentStart": 575,
"end": 0,
"expression": {
"body": [
{
"abs_path": false,
"commentStart": 577,
"commentStart": 575,
"end": 0,
"name": {
"commentStart": 577,
"commentStart": 575,
"end": 0,
"name": "brakeCaliper",
"start": 0,
@ -535,65 +546,76 @@ description: Result of parsing car-wheel-assembly.kcl
{
"type": "LabeledArg",
"label": {
"commentStart": 605,
"commentStart": 603,
"end": 0,
"name": "translate",
"name": "x",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 617,
"elements": [
{
"commentStart": 618,
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
{
"commentStart": 621,
"end": 0,
"raw": "0.5",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.5,
"suffix": "None"
}
},
{
"commentStart": 626,
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
}
],
"commentStart": 607,
"end": 0,
"raw": "0",
"start": 0,
"type": "ArrayExpression",
"type": "ArrayExpression"
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
}
},
{
"type": "LabeledArg",
"label": {
"commentStart": 610,
"end": 0,
"name": "y",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 614,
"end": 0,
"raw": "0.5",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.5,
"suffix": "None"
}
}
},
{
"type": "LabeledArg",
"label": {
"commentStart": 619,
"end": 0,
"name": "z",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 623,
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
}
}
],
"callee": {
"abs_path": false,
"commentStart": 595,
"commentStart": 593,
"end": 0,
"name": {
"commentStart": 595,
"commentStart": 593,
"end": 0,
"name": "translate",
"start": 0,
@ -603,7 +625,7 @@ description: Result of parsing car-wheel-assembly.kcl
"start": 0,
"type": "Name"
},
"commentStart": 595,
"commentStart": 593,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
@ -611,7 +633,7 @@ description: Result of parsing car-wheel-assembly.kcl
"unlabeled": null
}
],
"commentStart": 577,
"commentStart": 575,
"end": 0,
"start": 0,
"type": "PipeExpression",
@ -622,14 +644,14 @@ description: Result of parsing car-wheel-assembly.kcl
"type": "ExpressionStatement"
},
{
"commentStart": 630,
"commentStart": 626,
"end": 0,
"expression": {
"abs_path": false,
"commentStart": 630,
"commentStart": 626,
"end": 0,
"name": {
"commentStart": 630,
"commentStart": 626,
"end": 0,
"name": "carTire",
"start": 0,

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,6 @@
---
source: kcl-lib/src/simulation_tests.rs
description: Artifact graph flowchart dual-basin-utility-sink.kcl
extension: md
snapshot_kind: binary
---

View File

@ -0,0 +1,726 @@
```mermaid
flowchart LR
subgraph path2 [Path]
2["Path<br>[647, 681, 0]"]
3["Segment<br>[687, 717, 0]"]
4["Segment<br>[723, 753, 0]"]
5["Segment<br>[759, 790, 0]"]
6["Segment<br>[796, 852, 0]"]
7["Segment<br>[858, 865, 0]"]
8[Solid2d]
end
subgraph path32 [Path]
32["Path<br>[1258, 1311, 0]"]
33["Segment<br>[1317, 1347, 0]"]
34["Segment<br>[1353, 1383, 0]"]
35["Segment<br>[1389, 1420, 0]"]
36["Segment<br>[1426, 1482, 0]"]
37["Segment<br>[1488, 1495, 0]"]
38[Solid2d]
end
subgraph path59 [Path]
59["Path<br>[1760, 1813, 0]"]
60["Segment<br>[1819, 1849, 0]"]
61["Segment<br>[1855, 1885, 0]"]
62["Segment<br>[1891, 1922, 0]"]
63["Segment<br>[1928, 1984, 0]"]
64["Segment<br>[1990, 1997, 0]"]
65[Solid2d]
end
subgraph path83 [Path]
83["Path<br>[2391, 2446, 0]"]
84["Segment<br>[2452, 2482, 0]"]
85["Segment<br>[2488, 2518, 0]"]
86["Segment<br>[2524, 2555, 0]"]
87["Segment<br>[2561, 2617, 0]"]
88["Segment<br>[2623, 2630, 0]"]
89[Solid2d]
end
subgraph path111 [Path]
111["Path<br>[2932, 2970, 0]"]
112["Segment<br>[2976, 3006, 0]"]
113["Segment<br>[3012, 3036, 0]"]
114["Segment<br>[3042, 3073, 0]"]
115["Segment<br>[3079, 3135, 0]"]
116["Segment<br>[3141, 3148, 0]"]
117[Solid2d]
end
subgraph path134 [Path]
134["Path<br>[3331, 3384, 0]"]
135["Segment<br>[3390, 3420, 0]"]
136["Segment<br>[3426, 3456, 0]"]
137["Segment<br>[3462, 3493, 0]"]
138["Segment<br>[3499, 3555, 0]"]
139["Segment<br>[3561, 3568, 0]"]
140[Solid2d]
end
subgraph path158 [Path]
158["Path<br>[3794, 3831, 0]"]
159["Segment<br>[3837, 3861, 0]"]
160["Segment<br>[3867, 3891, 0]"]
161["Segment<br>[3897, 3922, 0]"]
162["Segment<br>[3928, 3984, 0]"]
163["Segment<br>[3990, 3997, 0]"]
164[Solid2d]
end
subgraph path180 [Path]
180["Path<br>[4275, 4343, 0]"]
181["Segment<br>[4349, 4373, 0]"]
182["Segment<br>[4379, 4403, 0]"]
183["Segment<br>[4409, 4434, 0]"]
184["Segment<br>[4440, 4496, 0]"]
185["Segment<br>[4502, 4509, 0]"]
186[Solid2d]
end
subgraph path202 [Path]
202["Path<br>[4698, 4794, 0]"]
203["Segment<br>[4800, 4841, 0]"]
204["Segment<br>[4847, 4887, 0]"]
205["Segment<br>[4893, 4935, 0]"]
206["Segment<br>[4941, 4997, 0]"]
207["Segment<br>[5003, 5010, 0]"]
208[Solid2d]
end
subgraph path225 [Path]
225["Path<br>[5538, 5579, 0]"]
226["Segment<br>[5585, 5615, 0]"]
227["Segment<br>[5621, 5644, 0]"]
228["Segment<br>[5650, 5681, 0]"]
229["Segment<br>[5687, 5743, 0]"]
230["Segment<br>[5749, 5756, 0]"]
231[Solid2d]
end
subgraph path252 [Path]
252["Path<br>[6039, 6080, 0]"]
253["Segment<br>[6086, 6110, 0]"]
254["Segment<br>[6116, 6146, 0]"]
255["Segment<br>[6152, 6177, 0]"]
256["Segment<br>[6183, 6239, 0]"]
257["Segment<br>[6245, 6252, 0]"]
258[Solid2d]
end
subgraph path276 [Path]
276["Path<br>[6731, 6781, 0]"]
277["Segment<br>[6787, 6822, 0]"]
278["Segment<br>[6828, 6912, 0]"]
279["Segment<br>[6918, 6952, 0]"]
280["Segment<br>[6958, 7050, 0]"]
281["Segment<br>[7056, 7090, 0]"]
end
subgraph path283 [Path]
283["Path<br>[7153, 7250, 0]"]
284["Segment<br>[7153, 7250, 0]"]
285[Solid2d]
end
1["Plane<br>[540, 557, 0]"]
9["Sweep Extrusion<br>[1026, 1053, 0]"]
10[Wall]
11[Wall]
12[Wall]
13[Wall]
14["Cap Start"]
15["Cap End"]
16["SweepEdge Opposite"]
17["SweepEdge Adjacent"]
18["SweepEdge Opposite"]
19["SweepEdge Adjacent"]
20["SweepEdge Opposite"]
21["SweepEdge Adjacent"]
22["SweepEdge Opposite"]
23["SweepEdge Adjacent"]
24["Sweep Extrusion<br>[1026, 1053, 0]"]
25["Sweep Extrusion<br>[1026, 1053, 0]"]
26["Sweep Extrusion<br>[1026, 1053, 0]"]
27["Sweep Extrusion<br>[1026, 1053, 0]"]
28["Sweep Extrusion<br>[1026, 1053, 0]"]
29["Sweep Extrusion<br>[1026, 1053, 0]"]
30["Sweep Extrusion<br>[1026, 1053, 0]"]
31["Plane<br>[1185, 1239, 0]"]
39["Sweep Extrusion<br>[1658, 1692, 0]"]
40[Wall]
41[Wall]
42[Wall]
43[Wall]
44["Cap Start"]
45["Cap End"]
46["SweepEdge Opposite"]
47["SweepEdge Adjacent"]
48["SweepEdge Opposite"]
49["SweepEdge Adjacent"]
50["SweepEdge Opposite"]
51["SweepEdge Adjacent"]
52["SweepEdge Opposite"]
53["SweepEdge Adjacent"]
54["Sweep Extrusion<br>[1658, 1692, 0]"]
55["Sweep Extrusion<br>[1658, 1692, 0]"]
56["Sweep Extrusion<br>[1658, 1692, 0]"]
57["Sweep Extrusion<br>[1658, 1692, 0]"]
58["Sweep Extrusion<br>[1658, 1692, 0]"]
66["Sweep Extrusion<br>[2094, 2128, 0]"]
67[Wall]
68[Wall]
69[Wall]
70[Wall]
71["Cap Start"]
72["Cap End"]
73["SweepEdge Opposite"]
74["SweepEdge Adjacent"]
75["SweepEdge Opposite"]
76["SweepEdge Adjacent"]
77["SweepEdge Opposite"]
78["SweepEdge Adjacent"]
79["SweepEdge Opposite"]
80["SweepEdge Adjacent"]
81["Sweep Extrusion<br>[2094, 2128, 0]"]
82["Plane<br>[2245, 2296, 0]"]
90["Sweep Extrusion<br>[2793, 2828, 0]"]
91[Wall]
92[Wall]
93[Wall]
94[Wall]
95["Cap Start"]
96["Cap End"]
97["SweepEdge Opposite"]
98["SweepEdge Adjacent"]
99["SweepEdge Opposite"]
100["SweepEdge Adjacent"]
101["SweepEdge Opposite"]
102["SweepEdge Adjacent"]
103["SweepEdge Opposite"]
104["SweepEdge Adjacent"]
105["Sweep Extrusion<br>[2793, 2828, 0]"]
106["Sweep Extrusion<br>[2793, 2828, 0]"]
107["Sweep Extrusion<br>[2793, 2828, 0]"]
108["Sweep Extrusion<br>[2793, 2828, 0]"]
109["Sweep Extrusion<br>[2793, 2828, 0]"]
110["Plane<br>[2875, 2912, 0]"]
118["Sweep Extrusion<br>[3228, 3263, 0]"]
119[Wall]
120[Wall]
121[Wall]
122[Wall]
123["Cap Start"]
124["Cap End"]
125["SweepEdge Opposite"]
126["SweepEdge Adjacent"]
127["SweepEdge Opposite"]
128["SweepEdge Adjacent"]
129["SweepEdge Opposite"]
130["SweepEdge Adjacent"]
131["SweepEdge Opposite"]
132["SweepEdge Adjacent"]
133["Sweep Extrusion<br>[3228, 3263, 0]"]
141["Sweep Extrusion<br>[3665, 3700, 0]"]
142[Wall]
143[Wall]
144[Wall]
145[Wall]
146["Cap Start"]
147["Cap End"]
148["SweepEdge Opposite"]
149["SweepEdge Adjacent"]
150["SweepEdge Opposite"]
151["SweepEdge Adjacent"]
152["SweepEdge Opposite"]
153["SweepEdge Adjacent"]
154["SweepEdge Opposite"]
155["SweepEdge Adjacent"]
156["Sweep Extrusion<br>[3665, 3700, 0]"]
157["Plane<br>[3740, 3777, 0]"]
165["Sweep Extrusion<br>[4003, 4036, 0]"]
166[Wall]
167[Wall]
168[Wall]
169[Wall]
170["Cap Start"]
171["Cap End"]
172["SweepEdge Opposite"]
173["SweepEdge Adjacent"]
174["SweepEdge Opposite"]
175["SweepEdge Adjacent"]
176["SweepEdge Opposite"]
177["SweepEdge Adjacent"]
178["SweepEdge Opposite"]
179["SweepEdge Adjacent"]
187["Sweep Extrusion<br>[4599, 4626, 0]"]
188[Wall]
189[Wall]
190[Wall]
191[Wall]
192["Cap End"]
193["SweepEdge Opposite"]
194["SweepEdge Adjacent"]
195["SweepEdge Opposite"]
196["SweepEdge Adjacent"]
197["SweepEdge Opposite"]
198["SweepEdge Adjacent"]
199["SweepEdge Opposite"]
200["SweepEdge Adjacent"]
201["Sweep Extrusion<br>[4599, 4626, 0]"]
209["Sweep Extrusion<br>[5099, 5127, 0]"]
210[Wall]
211[Wall]
212[Wall]
213[Wall]
214["Cap Start"]
215["SweepEdge Opposite"]
216["SweepEdge Adjacent"]
217["SweepEdge Opposite"]
218["SweepEdge Adjacent"]
219["SweepEdge Opposite"]
220["SweepEdge Adjacent"]
221["SweepEdge Opposite"]
222["SweepEdge Adjacent"]
223["Sweep Extrusion<br>[5099, 5127, 0]"]
224["Plane<br>[5476, 5525, 0]"]
232["Sweep Extrusion<br>[5855, 5883, 0]"]
233[Wall]
234[Wall]
235[Wall]
236[Wall]
237["Cap Start"]
238["Cap End"]
239["SweepEdge Opposite"]
240["SweepEdge Adjacent"]
241["SweepEdge Opposite"]
242["SweepEdge Adjacent"]
243["SweepEdge Opposite"]
244["SweepEdge Adjacent"]
245["SweepEdge Opposite"]
246["SweepEdge Adjacent"]
247["Sweep Extrusion<br>[5855, 5883, 0]"]
248["Sweep Extrusion<br>[5855, 5883, 0]"]
249["Sweep Extrusion<br>[5855, 5883, 0]"]
250["Sweep Extrusion<br>[5855, 5883, 0]"]
251["Sweep Extrusion<br>[5855, 5883, 0]"]
259["Sweep Extrusion<br>[6334, 6362, 0]"]
260[Wall]
261[Wall]
262[Wall]
263[Wall]
264["Cap Start"]
265["Cap End"]
266["SweepEdge Opposite"]
267["SweepEdge Adjacent"]
268["SweepEdge Opposite"]
269["SweepEdge Adjacent"]
270["SweepEdge Opposite"]
271["SweepEdge Adjacent"]
272["SweepEdge Opposite"]
273["SweepEdge Adjacent"]
274["Sweep Extrusion<br>[6334, 6362, 0]"]
275["Plane<br>[6657, 6708, 0]"]
282["Plane<br>[7112, 7129, 0]"]
286["Sweep Sweep<br>[7267, 7320, 0]"]
287[Wall]
288["Cap Start"]
289["Cap Start"]
290["SweepEdge Opposite"]
291["SweepEdge Adjacent"]
292["StartSketchOnPlane<br>[1171, 1240, 0]"]
293["StartSketchOnPlane<br>[2231, 2297, 0]"]
294["StartSketchOnPlane<br>[2861, 2913, 0]"]
295["StartSketchOnPlane<br>[3726, 3778, 0]"]
296["StartSketchOnFace<br>[4220, 4256, 0]"]
297["StartSketchOnFace<br>[4646, 4680, 0]"]
298["StartSketchOnPlane<br>[5462, 5526, 0]"]
299["StartSketchOnPlane<br>[6643, 6709, 0]"]
1 --- 2
2 --- 3
2 --- 4
2 --- 5
2 --- 6
2 --- 7
2 ---- 9
2 --- 8
3 --- 13
3 --- 22
3 --- 23
4 --- 12
4 --- 20
4 --- 21
5 --- 11
5 --- 18
5 --- 19
6 --- 10
6 --- 16
6 --- 17
9 --- 10
9 --- 11
9 --- 12
9 --- 13
9 --- 14
9 --- 15
9 --- 16
9 --- 17
9 --- 18
9 --- 19
9 --- 20
9 --- 21
9 --- 22
9 --- 23
31 --- 32
31 --- 59
32 --- 33
32 --- 34
32 --- 35
32 --- 36
32 --- 37
32 ---- 39
32 --- 38
33 --- 43
33 --- 52
33 --- 53
34 --- 42
34 --- 50
34 --- 51
35 --- 41
35 --- 48
35 --- 49
36 --- 40
36 --- 46
36 --- 47
39 --- 40
39 --- 41
39 --- 42
39 --- 43
39 --- 44
39 --- 45
39 --- 46
39 --- 47
39 --- 48
39 --- 49
39 --- 50
39 --- 51
39 --- 52
39 --- 53
59 --- 60
59 --- 61
59 --- 62
59 --- 63
59 --- 64
59 ---- 66
59 --- 65
60 --- 70
60 --- 79
60 --- 80
61 --- 69
61 --- 77
61 --- 78
62 --- 68
62 --- 75
62 --- 76
63 --- 67
63 --- 73
63 --- 74
66 --- 67
66 --- 68
66 --- 69
66 --- 70
66 --- 71
66 --- 72
66 --- 73
66 --- 74
66 --- 75
66 --- 76
66 --- 77
66 --- 78
66 --- 79
66 --- 80
82 --- 83
83 --- 84
83 --- 85
83 --- 86
83 --- 87
83 --- 88
83 ---- 90
83 --- 89
84 --- 94
84 --- 103
84 --- 104
85 --- 93
85 --- 101
85 --- 102
86 --- 92
86 --- 99
86 --- 100
87 --- 91
87 --- 97
87 --- 98
90 --- 91
90 --- 92
90 --- 93
90 --- 94
90 --- 95
90 --- 96
90 --- 97
90 --- 98
90 --- 99
90 --- 100
90 --- 101
90 --- 102
90 --- 103
90 --- 104
110 --- 111
110 --- 134
111 --- 112
111 --- 113
111 --- 114
111 --- 115
111 --- 116
111 ---- 118
111 --- 117
112 --- 122
112 --- 131
112 --- 132
113 --- 121
113 --- 129
113 --- 130
114 --- 120
114 --- 127
114 --- 128
115 --- 119
115 --- 125
115 --- 126
118 --- 119
118 --- 120
118 --- 121
118 --- 122
118 --- 123
118 --- 124
118 --- 125
118 --- 126
118 --- 127
118 --- 128
118 --- 129
118 --- 130
118 --- 131
118 --- 132
134 --- 135
134 --- 136
134 --- 137
134 --- 138
134 --- 139
134 ---- 141
134 --- 140
135 --- 145
135 --- 154
135 --- 155
136 --- 144
136 --- 152
136 --- 153
137 --- 143
137 --- 150
137 --- 151
138 --- 142
138 --- 148
138 --- 149
141 --- 142
141 --- 143
141 --- 144
141 --- 145
141 --- 146
141 --- 147
141 --- 148
141 --- 149
141 --- 150
141 --- 151
141 --- 152
141 --- 153
141 --- 154
141 --- 155
157 --- 158
158 --- 159
158 --- 160
158 --- 161
158 --- 162
158 --- 163
158 ---- 165
158 --- 164
159 --- 169
159 --- 178
159 --- 179
160 --- 168
160 --- 176
160 --- 177
161 --- 167
161 --- 174
161 --- 175
162 --- 166
162 --- 172
162 --- 173
165 --- 166
165 --- 167
165 --- 168
165 --- 169
165 --- 170
165 --- 171
165 --- 172
165 --- 173
165 --- 174
165 --- 175
165 --- 176
165 --- 177
165 --- 178
165 --- 179
170 --- 180
171 --- 202
180 --- 181
180 --- 182
180 --- 183
180 --- 184
180 --- 185
180 ---- 187
180 --- 186
181 --- 188
181 --- 193
181 --- 194
182 --- 189
182 --- 195
182 --- 196
183 --- 190
183 --- 197
183 --- 198
184 --- 191
184 --- 199
184 --- 200
187 --- 188
187 --- 189
187 --- 190
187 --- 191
187 --- 192
187 --- 193
187 --- 194
187 --- 195
187 --- 196
187 --- 197
187 --- 198
187 --- 199
187 --- 200
202 --- 203
202 --- 204
202 --- 205
202 --- 206
202 --- 207
202 ---- 209
202 --- 208
203 --- 213
203 --- 221
203 --- 222
204 --- 212
204 --- 219
204 --- 220
205 --- 211
205 --- 217
205 --- 218
206 --- 210
206 --- 215
206 --- 216
209 --- 210
209 --- 211
209 --- 212
209 --- 213
209 --- 214
209 --- 215
209 --- 216
209 --- 217
209 --- 218
209 --- 219
209 --- 220
209 --- 221
209 --- 222
224 --- 225
224 --- 252
225 --- 226
225 --- 227
225 --- 228
225 --- 229
225 --- 230
225 ---- 232
225 --- 231
226 --- 236
226 --- 245
226 --- 246
227 --- 235
227 --- 243
227 --- 244
228 --- 234
228 --- 241
228 --- 242
229 --- 233
229 --- 239
229 --- 240
232 --- 233
232 --- 234
232 --- 235
232 --- 236
232 --- 237
232 --- 238
232 --- 239
232 --- 240
232 --- 241
232 --- 242
232 --- 243
232 --- 244
232 --- 245
232 --- 246
252 --- 253
252 --- 254
252 --- 255
252 --- 256
252 --- 257
252 ---- 259
252 --- 258
253 --- 263
253 --- 272
253 --- 273
254 --- 262
254 --- 270
254 --- 271
255 --- 261
255 --- 268
255 --- 269
256 --- 260
256 --- 266
256 --- 267
259 --- 260
259 --- 261
259 --- 262
259 --- 263
259 --- 264
259 --- 265
259 --- 266
259 --- 267
259 --- 268
259 --- 269
259 --- 270
259 --- 271
259 --- 272
259 --- 273
275 --- 276
276 --- 277
276 --- 278
276 --- 279
276 --- 280
276 --- 281
282 --- 283
283 --- 284
283 ---- 286
283 --- 285
284 --- 287
284 --- 290
284 --- 291
286 --- 287
286 --- 288
286 --- 289
286 --- 290
286 --- 291
31 <--x 292
82 <--x 293
110 <--x 294
157 <--x 295
170 <--x 296
171 <--x 297
224 <--x 298
275 <--x 299
```

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

View File

@ -14178,7 +14178,7 @@ description: Variables in memory after executing kitt.kcl
}
},
"height": 0.5,
"startCapId": "[uuid]",
"startCapId": null,
"endCapId": "[uuid]",
"units": {
"type": "Mm"
@ -16216,7 +16216,7 @@ description: Variables in memory after executing kitt.kcl
}
},
"height": 0.5,
"startCapId": "[uuid]",
"startCapId": null,
"endCapId": "[uuid]",
"units": {
"type": "Mm"

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,6 @@
---
source: kcl-lib/src/simulation_tests.rs
description: Artifact graph flowchart makeup-mirror.kcl
extension: md
snapshot_kind: binary
---

View File

@ -0,0 +1,317 @@
```mermaid
flowchart LR
subgraph path2 [Path]
2["Path<br>[520, 565, 0]"]
3["Segment<br>[520, 565, 0]"]
4[Solid2d]
end
subgraph path12 [Path]
12["Path<br>[520, 565, 0]"]
13["Segment<br>[520, 565, 0]"]
14[Solid2d]
end
subgraph path22 [Path]
22["Path<br>[520, 565, 0]"]
23["Segment<br>[520, 565, 0]"]
24[Solid2d]
end
subgraph path32 [Path]
32["Path<br>[520, 565, 0]"]
33["Segment<br>[520, 565, 0]"]
34[Solid2d]
end
subgraph path42 [Path]
42["Path<br>[520, 565, 0]"]
43["Segment<br>[520, 565, 0]"]
44[Solid2d]
end
subgraph path52 [Path]
52["Path<br>[520, 565, 0]"]
53["Segment<br>[520, 565, 0]"]
54[Solid2d]
end
subgraph path62 [Path]
62["Path<br>[520, 565, 0]"]
63["Segment<br>[520, 565, 0]"]
64[Solid2d]
end
subgraph path72 [Path]
72["Path<br>[1136, 1191, 0]"]
73["Segment<br>[1136, 1191, 0]"]
74[Solid2d]
end
subgraph path82 [Path]
82["Path<br>[1136, 1191, 0]"]
83["Segment<br>[1136, 1191, 0]"]
84[Solid2d]
end
subgraph path92 [Path]
92["Path<br>[1553, 1616, 0]"]
93["Segment<br>[1553, 1616, 0]"]
94[Solid2d]
end
subgraph path101 [Path]
101["Path<br>[1662, 1716, 0]"]
102["Segment<br>[1724, 1748, 0]"]
103["Segment<br>[1756, 1870, 0]"]
104["Segment<br>[1878, 1902, 0]"]
105["Segment<br>[1910, 2041, 0]"]
106["Segment<br>[2049, 2056, 0]"]
107[Solid2d]
end
1["Plane<br>[484, 511, 0]"]
5["Sweep Extrusion<br>[573, 602, 0]"]
6[Wall]
7["Cap Start"]
8["Cap End"]
9["SweepEdge Opposite"]
10["SweepEdge Adjacent"]
11["Plane<br>[484, 511, 0]"]
15["Sweep Extrusion<br>[573, 602, 0]"]
16[Wall]
17["Cap Start"]
18["Cap End"]
19["SweepEdge Opposite"]
20["SweepEdge Adjacent"]
21["Plane<br>[484, 511, 0]"]
25["Sweep Extrusion<br>[573, 602, 0]"]
26[Wall]
27["Cap Start"]
28["Cap End"]
29["SweepEdge Opposite"]
30["SweepEdge Adjacent"]
31["Plane<br>[484, 511, 0]"]
35["Sweep Extrusion<br>[573, 602, 0]"]
36[Wall]
37["Cap Start"]
38["Cap End"]
39["SweepEdge Opposite"]
40["SweepEdge Adjacent"]
41["Plane<br>[484, 511, 0]"]
45["Sweep Extrusion<br>[573, 602, 0]"]
46[Wall]
47["Cap Start"]
48["Cap End"]
49["SweepEdge Opposite"]
50["SweepEdge Adjacent"]
51["Plane<br>[484, 511, 0]"]
55["Sweep Extrusion<br>[573, 602, 0]"]
56[Wall]
57["Cap Start"]
58["Cap End"]
59["SweepEdge Opposite"]
60["SweepEdge Adjacent"]
61["Plane<br>[484, 511, 0]"]
65["Sweep Extrusion<br>[573, 602, 0]"]
66[Wall]
67["Cap Start"]
68["Cap End"]
69["SweepEdge Opposite"]
70["SweepEdge Adjacent"]
71["Plane<br>[1108, 1128, 0]"]
75["Sweep Extrusion<br>[1199, 1226, 0]"]
76[Wall]
77["Cap Start"]
78["Cap End"]
79["SweepEdge Opposite"]
80["SweepEdge Adjacent"]
81["Plane<br>[1108, 1128, 0]"]
85["Sweep Extrusion<br>[1199, 1226, 0]"]
86[Wall]
87["Cap Start"]
88["Cap End"]
89["SweepEdge Opposite"]
90["SweepEdge Adjacent"]
91["Plane<br>[1489, 1539, 0]"]
95["Sweep Extrusion<br>[1624, 1647, 0]"]
96[Wall]
97["Cap Start"]
98["Cap End"]
99["SweepEdge Opposite"]
100["SweepEdge Adjacent"]
108["Sweep Extrusion<br>[2064, 2087, 0]"]
109[Wall]
110[Wall]
111[Wall]
112[Wall]
113["Cap Start"]
114["Cap End"]
115["SweepEdge Opposite"]
116["SweepEdge Adjacent"]
117["SweepEdge Opposite"]
118["SweepEdge Adjacent"]
119["SweepEdge Opposite"]
120["SweepEdge Adjacent"]
121["SweepEdge Opposite"]
122["SweepEdge Adjacent"]
123["StartSketchOnPlane<br>[470, 512, 0]"]
124["StartSketchOnPlane<br>[470, 512, 0]"]
125["StartSketchOnPlane<br>[470, 512, 0]"]
126["StartSketchOnPlane<br>[470, 512, 0]"]
127["StartSketchOnPlane<br>[470, 512, 0]"]
128["StartSketchOnPlane<br>[470, 512, 0]"]
129["StartSketchOnPlane<br>[470, 512, 0]"]
130["StartSketchOnPlane<br>[1475, 1540, 0]"]
1 --- 2
2 --- 3
2 ---- 5
2 --- 4
3 --- 6
3 --- 9
3 --- 10
5 --- 6
5 --- 7
5 --- 8
5 --- 9
5 --- 10
11 --- 12
12 --- 13
12 ---- 15
12 --- 14
13 --- 16
13 --- 19
13 --- 20
15 --- 16
15 --- 17
15 --- 18
15 --- 19
15 --- 20
21 --- 22
22 --- 23
22 ---- 25
22 --- 24
23 --- 26
23 --- 29
23 --- 30
25 --- 26
25 --- 27
25 --- 28
25 --- 29
25 --- 30
31 --- 32
32 --- 33
32 ---- 35
32 --- 34
33 --- 36
33 --- 39
33 --- 40
35 --- 36
35 --- 37
35 --- 38
35 --- 39
35 --- 40
41 --- 42
42 --- 43
42 ---- 45
42 --- 44
43 --- 46
43 --- 49
43 --- 50
45 --- 46
45 --- 47
45 --- 48
45 --- 49
45 --- 50
51 --- 52
52 --- 53
52 ---- 55
52 --- 54
53 --- 56
53 --- 59
53 --- 60
55 --- 56
55 --- 57
55 --- 58
55 --- 59
55 --- 60
61 --- 62
62 --- 63
62 ---- 65
62 --- 64
63 --- 66
63 --- 69
63 --- 70
65 --- 66
65 --- 67
65 --- 68
65 --- 69
65 --- 70
71 --- 72
72 --- 73
72 ---- 75
72 --- 74
73 --- 76
73 --- 79
73 --- 80
75 --- 76
75 --- 77
75 --- 78
75 --- 79
75 --- 80
81 --- 82
82 --- 83
82 ---- 85
82 --- 84
83 --- 86
83 --- 89
83 --- 90
85 --- 86
85 --- 87
85 --- 88
85 --- 89
85 --- 90
91 --- 92
91 --- 101
92 --- 93
92 ---- 95
92 --- 94
93 --- 96
93 --- 99
93 --- 100
95 --- 96
95 --- 97
95 --- 98
95 --- 99
95 --- 100
101 --- 102
101 --- 103
101 --- 104
101 --- 105
101 --- 106
101 ---- 108
101 --- 107
102 --- 112
102 --- 121
102 --- 122
103 --- 111
103 --- 119
103 --- 120
104 --- 110
104 --- 117
104 --- 118
105 --- 109
105 --- 115
105 --- 116
108 --- 109
108 --- 110
108 --- 111
108 --- 112
108 --- 113
108 --- 114
108 --- 115
108 --- 116
108 --- 117
108 --- 118
108 --- 119
108 --- 120
108 --- 121
108 --- 122
1 <--x 123
11 <--x 124
21 <--x 125
31 <--x 126
41 <--x 127
51 <--x 128
61 <--x 129
91 <--x 130
```

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2097,54 +2097,65 @@ description: Result of parsing scale_after_fillet.kcl
"label": {
"commentStart": 1593,
"end": 0,
"name": "scale",
"name": "x",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 1601,
"elements": [
{
"commentStart": 1602,
"end": 0,
"raw": "3.14",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.14,
"suffix": "None"
}
},
{
"commentStart": 1608,
"end": 0,
"raw": "3.14",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.14,
"suffix": "None"
}
},
{
"commentStart": 1614,
"end": 0,
"raw": "3.14",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.14,
"suffix": "None"
}
}
],
"commentStart": 1597,
"end": 0,
"raw": "3.14",
"start": 0,
"type": "ArrayExpression",
"type": "ArrayExpression"
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.14,
"suffix": "None"
}
}
},
{
"type": "LabeledArg",
"label": {
"commentStart": 1603,
"end": 0,
"name": "y",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 1607,
"end": 0,
"raw": "3.14",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.14,
"suffix": "None"
}
}
},
{
"type": "LabeledArg",
"label": {
"commentStart": 1613,
"end": 0,
"name": "z",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 1617,
"end": 0,
"raw": "3.14",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.14,
"suffix": "None"
}
}
}
],
@ -2177,7 +2188,7 @@ description: Result of parsing scale_after_fillet.kcl
"nonCodeNodes": {
"1": [
{
"commentStart": 1620,
"commentStart": 1622,
"end": 0,
"start": 0,
"type": "NonCodeNode",

View File

@ -52,6 +52,6 @@ export fn bolt() {
}
bolt()
|> scale(scale = [3.14, 3.14, 3.14])
|> scale(x = 3.14, y = 3.14, z = 3.14)
// https://www.mcmaster.com/91251a404/

View File

@ -56,6 +56,6 @@ export fn bolt() {
}
bolt()
|> scale(scale = [3.14, 3.14, 3.14])
|> scale(x = 3.14, y = 3.14, z = 3.14)
// https://www.mcmaster.com/91251a404/

View File

@ -0,0 +1,468 @@
---
source: kcl-lib/src/simulation_tests.rs
description: Artifact commands subtract_cylinder_from_cube.kcl
---
[
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "edge_lines_visible",
"hidden": false
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "set_scene_units",
"unit": "mm"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
"hidden": true
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
"hidden": true
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"size": 60.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "enable_sketch_mode",
"entity_id": "[uuid]",
"ortho": false,
"animated": false,
"adjust_camera": false,
"planar_normal": {
"x": 0.0,
"y": 0.0,
"z": 1.0
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "start_path"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "move_path_pen",
"path": "[uuid]",
"to": {
"x": -10.0,
"y": -10.0,
"z": 0.0
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "sketch_mode_disable"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": 10.0,
"y": -10.0,
"z": 0.0
},
"relative": false
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": 10.0,
"y": 10.0,
"z": 0.0
},
"relative": false
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": -10.0,
"y": 10.0,
"z": 0.0
},
"relative": false
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "close_path",
"path_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "enable_sketch_mode",
"entity_id": "[uuid]",
"ortho": false,
"animated": false,
"adjust_camera": false,
"planar_normal": {
"x": 0.0,
"y": 0.0,
"z": 1.0
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "extrude",
"target": "[uuid]",
"distance": 10.0,
"faces": null
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "sketch_mode_disable"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "object_bring_to_front",
"object_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_extrusion_face_info",
"object_id": "[uuid]",
"edge_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"size": 60.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "enable_sketch_mode",
"entity_id": "[uuid]",
"ortho": false,
"animated": false,
"adjust_camera": false,
"planar_normal": {
"x": 0.0,
"y": 0.0,
"z": 1.0
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "start_path"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "move_path_pen",
"path": "[uuid]",
"to": {
"x": 2.0,
"y": 0.0,
"z": 0.0
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "sketch_mode_disable"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "arc",
"center": {
"x": 0.0,
"y": 0.0
},
"radius": 2.0,
"start": {
"unit": "degrees",
"value": 0.0
},
"end": {
"unit": "degrees",
"value": 360.0
},
"relative": false
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "close_path",
"path_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "enable_sketch_mode",
"entity_id": "[uuid]",
"ortho": false,
"animated": false,
"adjust_camera": false,
"planar_normal": {
"x": 0.0,
"y": 0.0,
"z": 1.0
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "extrude",
"target": "[uuid]",
"distance": 10.0,
"faces": null
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "sketch_mode_disable"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "object_bring_to_front",
"object_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_extrusion_face_info",
"object_id": "[uuid]",
"edge_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
}
]

View File

@ -0,0 +1,6 @@
---
source: kcl-lib/src/simulation_tests.rs
description: Artifact graph flowchart subtract_cylinder_from_cube.kcl
extension: md
snapshot_kind: binary
---

View File

@ -0,0 +1,84 @@
```mermaid
flowchart LR
subgraph path2 [Path]
2["Path<br>[52, 103, 0]"]
3["Segment<br>[111, 163, 0]"]
4["Segment<br>[171, 223, 0]"]
5["Segment<br>[231, 283, 0]"]
6["Segment<br>[291, 298, 0]"]
7[Solid2d]
end
subgraph path24 [Path]
24["Path<br>[388, 423, 0]"]
25["Segment<br>[388, 423, 0]"]
26[Solid2d]
end
1["Plane<br>[27, 44, 0]"]
8["Sweep Extrusion<br>[306, 326, 0]"]
9[Wall]
10[Wall]
11[Wall]
12[Wall]
13["Cap Start"]
14["Cap End"]
15["SweepEdge Opposite"]
16["SweepEdge Adjacent"]
17["SweepEdge Opposite"]
18["SweepEdge Adjacent"]
19["SweepEdge Opposite"]
20["SweepEdge Adjacent"]
21["SweepEdge Opposite"]
22["SweepEdge Adjacent"]
23["Plane<br>[363, 382, 0]"]
27["Sweep Extrusion<br>[429, 449, 0]"]
28[Wall]
29["Cap Start"]
30["Cap End"]
31["SweepEdge Opposite"]
32["SweepEdge Adjacent"]
1 --- 2
2 --- 3
2 --- 4
2 --- 5
2 --- 6
2 ---- 8
2 --- 7
3 --- 9
3 --- 15
3 --- 16
4 --- 10
4 --- 17
4 --- 18
5 --- 11
5 --- 19
5 --- 20
6 --- 12
6 --- 21
6 --- 22
8 --- 9
8 --- 10
8 --- 11
8 --- 12
8 --- 13
8 --- 14
8 --- 15
8 --- 16
8 --- 17
8 --- 18
8 --- 19
8 --- 20
8 --- 21
8 --- 22
23 --- 24
24 --- 25
24 ---- 27
24 --- 26
25 --- 28
25 --- 31
25 --- 32
27 --- 28
27 --- 29
27 --- 30
27 --- 31
27 --- 32
```

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,16 @@
fn cube(center) {
return startSketchOn(XY)
|> startProfileAt([center[0] - 10, center[1] - 10], %)
|> line(endAbsolute = [center[0] + 10, center[1] - 10])
|> line(endAbsolute = [center[0] + 10, center[1] + 10])
|> line(endAbsolute = [center[0] - 10, center[1] + 10])
|> close()
|> extrude(length = 10)
}
part001 = cube([0, 0])
part002 = startSketchOn('XY')
|> circle(center = [0, 0], radius = 2)
|> extrude(length = 10)
fullPart = subtract([part001], tools=[part002])

View File

@ -0,0 +1,216 @@
---
source: kcl-lib/src/simulation_tests.rs
description: Operations executed subtract_cylinder_from_cube.kcl
---
[
{
"type": "UserDefinedFunctionCall",
"name": "cube",
"functionSourceRange": [
7,
328,
0
],
"unlabeledArg": null,
"labeledArgs": {},
"sourceRange": []
},
{
"labeledArgs": {
"data": {
"value": {
"type": "Plane",
"artifact_id": "[uuid]"
},
"sourceRange": []
}
},
"name": "startSketchOn",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"value": {
"type": "Number",
"value": 10.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
}
},
"sourceRange": []
}
},
"name": "extrude",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Sketch",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
}
},
{
"type": "UserDefinedFunctionReturn"
},
{
"labeledArgs": {
"data": {
"value": {
"type": "String",
"value": "XY"
},
"sourceRange": []
}
},
"name": "startSketchOn",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"type": "UserDefinedFunctionCall",
"name": "circle",
"functionSourceRange": [
0,
0,
0
],
"unlabeledArg": null,
"labeledArgs": {
"center": {
"value": {
"type": "Array",
"value": [
{
"type": "Number",
"value": 0.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
}
},
{
"type": "Number",
"value": 0.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
}
}
]
},
"sourceRange": []
},
"radius": {
"value": {
"type": "Number",
"value": 2.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
}
},
"sourceRange": []
}
},
"sourceRange": []
},
{
"type": "UserDefinedFunctionReturn"
},
{
"labeledArgs": {
"length": {
"value": {
"type": "Number",
"value": 10.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
}
},
"sourceRange": []
}
},
"name": "extrude",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Sketch",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
}
},
{
"labeledArgs": {
"tools": {
"value": {
"type": "Array",
"value": [
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
}
]
},
"sourceRange": []
}
},
"name": "subtract",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Array",
"value": [
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
}
]
},
"sourceRange": []
}
}
]

View File

@ -0,0 +1,471 @@
---
source: kcl-lib/src/simulation_tests.rs
description: Variables in memory after executing subtract_cylinder_from_cube.kcl
---
{
"cube": {
"type": "Function"
},
"fullPart": {
"type": "Solid",
"value": {
"type": "Solid",
"id": "[uuid]",
"artifactId": "[uuid]",
"value": [
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
}
],
"sketch": {
"type": "Sketch",
"id": "[uuid]",
"paths": [
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
-10.0,
-10.0
],
"tag": null,
"to": [
10.0,
-10.0
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
10.0,
-10.0
],
"tag": null,
"to": [
10.0,
10.0
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
10.0,
10.0
],
"tag": null,
"to": [
-10.0,
10.0
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
-10.0,
10.0
],
"tag": null,
"to": [
-10.0,
-10.0
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
}
],
"on": {
"type": "plane",
"id": "[uuid]",
"artifactId": "[uuid]",
"value": "XY",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"xAxis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"yAxis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"zAxis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"units": {
"type": "Mm"
}
},
"start": {
"from": [
-10.0,
-10.0
],
"to": [
-10.0,
-10.0
],
"units": {
"type": "Mm"
},
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
}
},
"artifactId": "[uuid]",
"originalId": "[uuid]",
"units": {
"type": "Mm"
}
},
"height": 10.0,
"startCapId": "[uuid]",
"endCapId": "[uuid]",
"units": {
"type": "Mm"
}
}
},
"part001": {
"type": "Solid",
"value": {
"type": "Solid",
"id": "[uuid]",
"artifactId": "[uuid]",
"value": [
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
}
],
"sketch": {
"type": "Sketch",
"id": "[uuid]",
"paths": [
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
-10.0,
-10.0
],
"tag": null,
"to": [
10.0,
-10.0
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
10.0,
-10.0
],
"tag": null,
"to": [
10.0,
10.0
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
10.0,
10.0
],
"tag": null,
"to": [
-10.0,
10.0
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
-10.0,
10.0
],
"tag": null,
"to": [
-10.0,
-10.0
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
}
],
"on": {
"type": "plane",
"id": "[uuid]",
"artifactId": "[uuid]",
"value": "XY",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"xAxis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"yAxis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"zAxis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"units": {
"type": "Mm"
}
},
"start": {
"from": [
-10.0,
-10.0
],
"to": [
-10.0,
-10.0
],
"units": {
"type": "Mm"
},
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
}
},
"artifactId": "[uuid]",
"originalId": "[uuid]",
"units": {
"type": "Mm"
}
},
"height": 10.0,
"startCapId": "[uuid]",
"endCapId": "[uuid]",
"units": {
"type": "Mm"
}
}
},
"part002": {
"type": "Solid",
"value": {
"type": "Solid",
"id": "[uuid]",
"artifactId": "[uuid]",
"value": [
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": null,
"type": "extrudeArc"
}
],
"sketch": {
"type": "Sketch",
"id": "[uuid]",
"paths": [
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"ccw": true,
"center": [
0.0,
0.0
],
"from": [
2.0,
0.0
],
"radius": 2.0,
"tag": null,
"to": [
2.0,
0.0
],
"type": "Circle",
"units": {
"type": "Mm"
}
}
],
"on": {
"type": "plane",
"id": "[uuid]",
"artifactId": "[uuid]",
"value": "XY",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"xAxis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"yAxis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"zAxis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"units": {
"type": "Mm"
}
},
"start": {
"from": [
2.0,
0.0
],
"to": [
2.0,
0.0
],
"units": {
"type": "Mm"
},
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
}
},
"artifactId": "[uuid]",
"originalId": "[uuid]",
"units": {
"type": "Mm"
}
},
"height": 10.0,
"startCapId": "[uuid]",
"endCapId": "[uuid]",
"units": {
"type": "Mm"
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

View File

@ -0,0 +1,20 @@
---
source: kcl-lib/src/simulation_tests.rs
description: Result of unparsing subtract_cylinder_from_cube.kcl
---
fn cube(center) {
return startSketchOn(XY)
|> startProfileAt([center[0] - 10, center[1] - 10], %)
|> line(endAbsolute = [center[0] + 10, center[1] - 10])
|> line(endAbsolute = [center[0] + 10, center[1] + 10])
|> line(endAbsolute = [center[0] - 10, center[1] + 10])
|> close()
|> extrude(length = 10)
}
part001 = cube([0, 0])
part002 = startSketchOn(XY)
|> circle(center = [0, 0], radius = 2)
|> extrude(length = 10)
fullPart = subtract([part001], tools = [part002])

View File

@ -2097,54 +2097,65 @@ description: Result of parsing translate_after_fillet.kcl
"label": {
"commentStart": 1597,
"end": 0,
"name": "translate",
"name": "x",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 1601,
"end": 0,
"raw": "10",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 10.0,
"suffix": "None"
}
}
},
{
"type": "LabeledArg",
"label": {
"commentStart": 1605,
"end": 0,
"name": "y",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 1609,
"elements": [
{
"commentStart": 1610,
"end": 0,
"raw": "10",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 10.0,
"suffix": "None"
}
},
{
"commentStart": 1614,
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
{
"commentStart": 1617,
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
}
],
"end": 0,
"raw": "0",
"start": 0,
"type": "ArrayExpression",
"type": "ArrayExpression"
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
}
},
{
"type": "LabeledArg",
"label": {
"commentStart": 1612,
"end": 0,
"name": "z",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 1616,
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
}
}
],
@ -2177,7 +2188,7 @@ description: Result of parsing translate_after_fillet.kcl
"nonCodeNodes": {
"1": [
{
"commentStart": 1620,
"commentStart": 1618,
"end": 0,
"start": 0,
"type": "NonCodeNode",

View File

@ -52,6 +52,6 @@ export fn bolt() {
}
bolt()
|> translate(translate = [10, 0, 0])
|> translate(x = 10, y = 0, z = 0)
// https://www.mcmaster.com/91251a404/

View File

@ -56,6 +56,6 @@ export fn bolt() {
}
bolt()
|> translate(translate = [10, 0, 0])
|> translate(x = 10, y = 0, z = 0)
// https://www.mcmaster.com/91251a404/

View File

@ -0,0 +1,554 @@
---
source: kcl-lib/src/simulation_tests.rs
description: Artifact commands union_cubes.kcl
---
[
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "edge_lines_visible",
"hidden": false
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "set_scene_units",
"unit": "mm"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
"hidden": true
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
"hidden": true
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"size": 60.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "enable_sketch_mode",
"entity_id": "[uuid]",
"ortho": false,
"animated": false,
"adjust_camera": false,
"planar_normal": {
"x": 0.0,
"y": 0.0,
"z": 1.0
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "start_path"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "move_path_pen",
"path": "[uuid]",
"to": {
"x": -10.0,
"y": -10.0,
"z": 0.0
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "sketch_mode_disable"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": 10.0,
"y": -10.0,
"z": 0.0
},
"relative": false
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": 10.0,
"y": 10.0,
"z": 0.0
},
"relative": false
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": -10.0,
"y": 10.0,
"z": 0.0
},
"relative": false
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "close_path",
"path_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "enable_sketch_mode",
"entity_id": "[uuid]",
"ortho": false,
"animated": false,
"adjust_camera": false,
"planar_normal": {
"x": 0.0,
"y": 0.0,
"z": 1.0
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "extrude",
"target": "[uuid]",
"distance": 10.0,
"faces": null
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "sketch_mode_disable"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "object_bring_to_front",
"object_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_extrusion_face_info",
"object_id": "[uuid]",
"edge_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"size": 60.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "enable_sketch_mode",
"entity_id": "[uuid]",
"ortho": false,
"animated": false,
"adjust_camera": false,
"planar_normal": {
"x": 0.0,
"y": 0.0,
"z": 1.0
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "start_path"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "move_path_pen",
"path": "[uuid]",
"to": {
"x": 10.0,
"y": 0.0,
"z": 0.0
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "sketch_mode_disable"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": 30.0,
"y": 0.0,
"z": 0.0
},
"relative": false
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": 30.0,
"y": 20.0,
"z": 0.0
},
"relative": false
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": 10.0,
"y": 20.0,
"z": 0.0
},
"relative": false
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "close_path",
"path_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "enable_sketch_mode",
"entity_id": "[uuid]",
"ortho": false,
"animated": false,
"adjust_camera": false,
"planar_normal": {
"x": 0.0,
"y": 0.0,
"z": 1.0
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "extrude",
"target": "[uuid]",
"distance": 10.0,
"faces": null
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "sketch_mode_disable"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "object_bring_to_front",
"object_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_extrusion_face_info",
"object_id": "[uuid]",
"edge_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
}
]

View File

@ -0,0 +1,6 @@
---
source: kcl-lib/src/simulation_tests.rs
description: Artifact graph flowchart union_cubes.kcl
extension: md
snapshot_kind: binary
---

View File

@ -0,0 +1,117 @@
```mermaid
flowchart LR
subgraph path2 [Path]
2["Path<br>[52, 103, 0]"]
3["Segment<br>[111, 163, 0]"]
4["Segment<br>[171, 223, 0]"]
5["Segment<br>[231, 283, 0]"]
6["Segment<br>[291, 298, 0]"]
7[Solid2d]
end
subgraph path24 [Path]
24["Path<br>[52, 103, 0]"]
25["Segment<br>[111, 163, 0]"]
26["Segment<br>[171, 223, 0]"]
27["Segment<br>[231, 283, 0]"]
28["Segment<br>[291, 298, 0]"]
29[Solid2d]
end
1["Plane<br>[27, 44, 0]"]
8["Sweep Extrusion<br>[306, 326, 0]"]
9[Wall]
10[Wall]
11[Wall]
12[Wall]
13["Cap Start"]
14["Cap End"]
15["SweepEdge Opposite"]
16["SweepEdge Adjacent"]
17["SweepEdge Opposite"]
18["SweepEdge Adjacent"]
19["SweepEdge Opposite"]
20["SweepEdge Adjacent"]
21["SweepEdge Opposite"]
22["SweepEdge Adjacent"]
23["Plane<br>[27, 44, 0]"]
30["Sweep Extrusion<br>[306, 326, 0]"]
31[Wall]
32[Wall]
33[Wall]
34[Wall]
35["Cap Start"]
36["Cap End"]
37["SweepEdge Opposite"]
38["SweepEdge Adjacent"]
39["SweepEdge Opposite"]
40["SweepEdge Adjacent"]
41["SweepEdge Opposite"]
42["SweepEdge Adjacent"]
43["SweepEdge Opposite"]
44["SweepEdge Adjacent"]
1 --- 2
2 --- 3
2 --- 4
2 --- 5
2 --- 6
2 ---- 8
2 --- 7
3 --- 9
3 --- 15
3 --- 16
4 --- 10
4 --- 17
4 --- 18
5 --- 11
5 --- 19
5 --- 20
6 --- 12
6 --- 21
6 --- 22
8 --- 9
8 --- 10
8 --- 11
8 --- 12
8 --- 13
8 --- 14
8 --- 15
8 --- 16
8 --- 17
8 --- 18
8 --- 19
8 --- 20
8 --- 21
8 --- 22
23 --- 24
24 --- 25
24 --- 26
24 --- 27
24 --- 28
24 ---- 30
24 --- 29
25 --- 31
25 --- 37
25 --- 38
26 --- 32
26 --- 39
26 --- 40
27 --- 33
27 --- 41
27 --- 42
28 --- 34
28 --- 43
28 --- 44
30 --- 31
30 --- 32
30 --- 33
30 --- 34
30 --- 35
30 --- 36
30 --- 37
30 --- 38
30 --- 39
30 --- 40
30 --- 41
30 --- 42
30 --- 43
30 --- 44
```

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,14 @@
fn cube(center) {
return startSketchOn(XY)
|> startProfileAt([center[0] - 10, center[1] - 10], %)
|> line(endAbsolute = [center[0] + 10, center[1] - 10])
|> line(endAbsolute = [center[0] + 10, center[1] + 10])
|> line(endAbsolute = [center[0] - 10, center[1] + 10])
|> close()
|> extrude(length = 10)
}
part001 = cube([0, 0])
part002 = cube([20, 10])
fullPart = union([part001, part002])

View File

@ -0,0 +1,158 @@
---
source: kcl-lib/src/simulation_tests.rs
description: Operations executed union_cubes.kcl
---
[
{
"type": "UserDefinedFunctionCall",
"name": "cube",
"functionSourceRange": [
7,
328,
0
],
"unlabeledArg": null,
"labeledArgs": {},
"sourceRange": []
},
{
"labeledArgs": {
"data": {
"value": {
"type": "Plane",
"artifact_id": "[uuid]"
},
"sourceRange": []
}
},
"name": "startSketchOn",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"value": {
"type": "Number",
"value": 10.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
}
},
"sourceRange": []
}
},
"name": "extrude",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Sketch",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
}
},
{
"type": "UserDefinedFunctionReturn"
},
{
"type": "UserDefinedFunctionCall",
"name": "cube",
"functionSourceRange": [
7,
328,
0
],
"unlabeledArg": null,
"labeledArgs": {},
"sourceRange": []
},
{
"labeledArgs": {
"data": {
"value": {
"type": "Plane",
"artifact_id": "[uuid]"
},
"sourceRange": []
}
},
"name": "startSketchOn",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"value": {
"type": "Number",
"value": 10.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
}
},
"sourceRange": []
}
},
"name": "extrude",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Sketch",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
}
},
{
"type": "UserDefinedFunctionReturn"
},
{
"labeledArgs": {
"solids": {
"value": {
"type": "Array",
"value": [
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
}
]
},
"sourceRange": []
}
},
"name": "union",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": null
}
]

View File

@ -0,0 +1,543 @@
---
source: kcl-lib/src/simulation_tests.rs
description: Variables in memory after executing union_cubes.kcl
---
{
"cube": {
"type": "Function"
},
"fullPart": {
"type": "Solid",
"value": {
"type": "Solid",
"id": "[uuid]",
"artifactId": "[uuid]",
"value": [
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
}
],
"sketch": {
"type": "Sketch",
"id": "[uuid]",
"paths": [
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
-10.0,
-10.0
],
"tag": null,
"to": [
10.0,
-10.0
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
10.0,
-10.0
],
"tag": null,
"to": [
10.0,
10.0
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
10.0,
10.0
],
"tag": null,
"to": [
-10.0,
10.0
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
-10.0,
10.0
],
"tag": null,
"to": [
-10.0,
-10.0
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
}
],
"on": {
"type": "plane",
"id": "[uuid]",
"artifactId": "[uuid]",
"value": "XY",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"xAxis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"yAxis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"zAxis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"units": {
"type": "Mm"
}
},
"start": {
"from": [
-10.0,
-10.0
],
"to": [
-10.0,
-10.0
],
"units": {
"type": "Mm"
},
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
}
},
"artifactId": "[uuid]",
"originalId": "[uuid]",
"units": {
"type": "Mm"
}
},
"height": 10.0,
"startCapId": "[uuid]",
"endCapId": "[uuid]",
"units": {
"type": "Mm"
}
}
},
"part001": {
"type": "Solid",
"value": {
"type": "Solid",
"id": "[uuid]",
"artifactId": "[uuid]",
"value": [
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
}
],
"sketch": {
"type": "Sketch",
"id": "[uuid]",
"paths": [
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
-10.0,
-10.0
],
"tag": null,
"to": [
10.0,
-10.0
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
10.0,
-10.0
],
"tag": null,
"to": [
10.0,
10.0
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
10.0,
10.0
],
"tag": null,
"to": [
-10.0,
10.0
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
-10.0,
10.0
],
"tag": null,
"to": [
-10.0,
-10.0
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
}
],
"on": {
"type": "plane",
"id": "[uuid]",
"artifactId": "[uuid]",
"value": "XY",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"xAxis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"yAxis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"zAxis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"units": {
"type": "Mm"
}
},
"start": {
"from": [
-10.0,
-10.0
],
"to": [
-10.0,
-10.0
],
"units": {
"type": "Mm"
},
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
}
},
"artifactId": "[uuid]",
"originalId": "[uuid]",
"units": {
"type": "Mm"
}
},
"height": 10.0,
"startCapId": "[uuid]",
"endCapId": "[uuid]",
"units": {
"type": "Mm"
}
}
},
"part002": {
"type": "Solid",
"value": {
"type": "Solid",
"id": "[uuid]",
"artifactId": "[uuid]",
"value": [
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
}
],
"sketch": {
"type": "Sketch",
"id": "[uuid]",
"paths": [
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
10.0,
0.0
],
"tag": null,
"to": [
30.0,
0.0
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
30.0,
0.0
],
"tag": null,
"to": [
30.0,
20.0
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
30.0,
20.0
],
"tag": null,
"to": [
10.0,
20.0
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
10.0,
20.0
],
"tag": null,
"to": [
10.0,
0.0
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
}
],
"on": {
"type": "plane",
"id": "[uuid]",
"artifactId": "[uuid]",
"value": "XY",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"xAxis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"yAxis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"zAxis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"units": {
"type": "Mm"
}
},
"start": {
"from": [
10.0,
0.0
],
"to": [
10.0,
0.0
],
"units": {
"type": "Mm"
},
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
}
},
"artifactId": "[uuid]",
"originalId": "[uuid]",
"units": {
"type": "Mm"
}
},
"height": 10.0,
"startCapId": "[uuid]",
"endCapId": "[uuid]",
"units": {
"type": "Mm"
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

View File

@ -0,0 +1,18 @@
---
source: kcl-lib/src/simulation_tests.rs
description: Result of unparsing union_cubes.kcl
---
fn cube(center) {
return startSketchOn(XY)
|> startProfileAt([center[0] - 10, center[1] - 10], %)
|> line(endAbsolute = [center[0] + 10, center[1] - 10])
|> line(endAbsolute = [center[0] + 10, center[1] + 10])
|> line(endAbsolute = [center[0] - 10, center[1] + 10])
|> close()
|> extrude(length = 10)
}
part001 = cube([0, 0])
part002 = cube([20, 10])
fullPart = union([part001, part002])

View File

@ -0,0 +1,18 @@
# Stop the script when a cmdlet or a native command fails
# from https://www.meziantou.net/stop-the-script-when-an-error-occurs-in-powershell.htm
$ErrorActionPreference = 'Stop'
$PSNativeCommandUseErrorActionPreference = $true
rm -Recurse -Force rust/kcl-wasm-lib/pkg
mkdir -p rust/kcl-wasm-lib/pkg
rm -Recurse -Force rust/kcl-lib/bindings
cd rust
$env:RUSTFLAGS='--cfg getrandom_backend="wasm_js"'
wasm-pack build kcl-wasm-lib --dev --target web --out-dir pkg
$env:RUSTFLAGS=''
cargo test -p kcl-lib export_bindings
cd ..
copy rust\kcl-wasm-lib\pkg\kcl_wasm_lib_bg.wasm public
yarn fmt:generated

16
scripts/build-wasm-dev.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
set -euo pipefail
rm -rf rust/kcl-wasm-lib/pkg
mkdir -p rust/kcl-wasm-lib/pkg
rm -rf rust/kcl-lib/bindings
cd rust
export RUSTFLAGS='--cfg getrandom_backend="wasm_js"'
wasm-pack build kcl-wasm-lib --dev --target web --out-dir pkg
export RUSTFLAGS=''
cargo test -p kcl-lib export_bindings
cd ..
cp rust/kcl-wasm-lib/pkg/kcl_wasm_lib_bg.wasm public
yarn fmt:generated

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