Merge branch 'main' into pierremtb/windows-dev-experience
This commit is contained in:
File diff suppressed because one or more lines are too long
@ -17,7 +17,7 @@ lastSegX(sketch: Sketch) -> number
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | The sketch whose line segment is being queried | Yes |
|
||||
|
||||
### Returns
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ lastSegY(sketch: Sketch) -> number
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | The sketch whose line segment is being queried | Yes |
|
||||
|
||||
### Returns
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -17,7 +17,7 @@ segAng(tag: TagIdentifier) -> number
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `tag` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes |
|
||||
| `tag` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | The line segment being queried by its tag | Yes |
|
||||
|
||||
### Returns
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ segEnd(tag: TagIdentifier) -> [number]
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `tag` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes |
|
||||
| `tag` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | The line segment being queried by its tag | Yes |
|
||||
|
||||
### Returns
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ segEndX(tag: TagIdentifier) -> number
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `tag` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes |
|
||||
| `tag` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | The line segment being queried by its tag | Yes |
|
||||
|
||||
### Returns
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ segEndY(tag: TagIdentifier) -> number
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `tag` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes |
|
||||
| `tag` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | The line segment being queried by its tag | Yes |
|
||||
|
||||
### Returns
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ segLen(tag: TagIdentifier) -> number
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `tag` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes |
|
||||
| `tag` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | The line segment being queried by its tag | Yes |
|
||||
|
||||
### Returns
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ segStart(tag: TagIdentifier) -> [number]
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `tag` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes |
|
||||
| `tag` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | The line segment being queried by its tag | Yes |
|
||||
|
||||
### Returns
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ segStartX(tag: TagIdentifier) -> number
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `tag` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes |
|
||||
| `tag` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | The line segment being queried by its tag | Yes |
|
||||
|
||||
### Returns
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ segStartY(tag: TagIdentifier) -> number
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `tag` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes |
|
||||
| `tag` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | The line segment being queried by its tag | Yes |
|
||||
|
||||
### Returns
|
||||
|
||||
|
||||
6023
docs/kcl/std.json
6023
docs/kcl/std.json
File diff suppressed because it is too large
Load Diff
@ -17,7 +17,7 @@ tangentToEnd(tag: TagIdentifier) -> number
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `tag` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes |
|
||||
| `tag` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | The line segment being queried by its tag | Yes |
|
||||
|
||||
### Returns
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
"@fortawesome/react-fontawesome": "^0.2.0",
|
||||
"@headlessui/react": "^1.7.19",
|
||||
"@headlessui/tailwindcss": "^0.2.0",
|
||||
"@kittycad/lib": "2.0.13",
|
||||
"@kittycad/lib": "2.0.17",
|
||||
"@lezer/highlight": "^1.2.1",
|
||||
"@lezer/lr": "^1.4.1",
|
||||
"@react-hook/resize-observer": "^2.0.1",
|
||||
@ -87,7 +87,7 @@
|
||||
"install:tools:windows": "winget install Schniz.fnm jqlang.jq MikeFarah.yq",
|
||||
"fetch:wasm": "./scripts/get-latest-wasm-bundle.sh",
|
||||
"fetch:wasm:windows": "./scripts/get-latest-wasm-bundle.ps1",
|
||||
"fetch:samples": "echo \"Fetching latest KCL samples...\" && curl -o public/kcl-samples-manifest-fallback.json https://raw.githubusercontent.com/KittyCAD/kcl-samples/achalmers/kw-appearance/manifest.json",
|
||||
"fetch:samples": "echo \"Fetching latest KCL samples...\" && curl -o public/kcl-samples-manifest-fallback.json https://raw.githubusercontent.com/KittyCAD/kcl-samples/achalmers/kw-pattern-transform2/manifest.json",
|
||||
"isomorphic-copy-wasm": "(copy src/wasm-lib/pkg/wasm_lib_bg.wasm public || cp src/wasm-lib/pkg/wasm_lib_bg.wasm public)",
|
||||
"build:wasm-dev": "yarn wasm-prep && (cd src/wasm-lib && wasm-pack build --dev --target web --out-dir pkg && cargo test -p kcl-lib export_bindings) && yarn isomorphic-copy-wasm && yarn fmt",
|
||||
"build:wasm": "yarn wasm-prep && cd src/wasm-lib && wasm-pack build --release --target web --out-dir pkg && cargo test -p kcl-lib export_bindings && cd ../.. && yarn isomorphic-copy-wasm && yarn fmt",
|
||||
|
||||
@ -34,6 +34,13 @@
|
||||
"title": "Car Wheel Assembly",
|
||||
"description": "A car wheel assembly with a rotor, tire, and lug nuts."
|
||||
},
|
||||
{
|
||||
"file": "main.kcl",
|
||||
"pathFromProjectDirectoryToFirstFile": "cycloidal-gear/main.kcl",
|
||||
"multipleFiles": false,
|
||||
"title": "Cycloidal Gear",
|
||||
"description": "A cycloidal gear is a gear with a continuous, curved tooth profile. They are used in watchmaking and high precision robotics actuation"
|
||||
},
|
||||
{
|
||||
"file": "main.kcl",
|
||||
"pathFromProjectDirectoryToFirstFile": "dodecahedron/main.kcl",
|
||||
@ -48,6 +55,13 @@
|
||||
"title": "Enclosure",
|
||||
"description": "An enclosure body and sealing lid for storing items"
|
||||
},
|
||||
{
|
||||
"file": "main.kcl",
|
||||
"pathFromProjectDirectoryToFirstFile": "exhaust-manifold/main.kcl",
|
||||
"multipleFiles": false,
|
||||
"title": "Exhaust Manifold",
|
||||
"description": "A welded exhaust header for an inline 4-cylinder engine"
|
||||
},
|
||||
{
|
||||
"file": "main.kcl",
|
||||
"pathFromProjectDirectoryToFirstFile": "flange-with-patterns/main.kcl",
|
||||
|
||||
@ -1199,6 +1199,7 @@ export const ModelingMachineProvider = ({
|
||||
selections: input.selection,
|
||||
token,
|
||||
artifactGraph: engineCommandManager.artifactGraph,
|
||||
projectName: context.project.name,
|
||||
})
|
||||
}),
|
||||
},
|
||||
|
||||
@ -16,6 +16,7 @@ import {
|
||||
clearSceneAndBustCache,
|
||||
emptyExecState,
|
||||
ExecState,
|
||||
getKclVersion,
|
||||
initPromise,
|
||||
KclValue,
|
||||
parse,
|
||||
@ -59,7 +60,8 @@ export class KclManager {
|
||||
nonCodeNodes: {},
|
||||
startNodes: [],
|
||||
},
|
||||
trivia: [],
|
||||
innerAttrs: [],
|
||||
outerAttrs: [],
|
||||
}
|
||||
private _execState: ExecState = emptyExecState()
|
||||
private _variables: VariableMap = {}
|
||||
@ -74,6 +76,7 @@ export class KclManager {
|
||||
private _hasErrors = false
|
||||
private _switchedFiles = false
|
||||
private _fileSettings: KclSettingsAnnotation = {}
|
||||
private _kclVersion: string | undefined = undefined
|
||||
|
||||
engineCommandManager: EngineCommandManager
|
||||
|
||||
@ -118,6 +121,16 @@ export class KclManager {
|
||||
return this._execState
|
||||
}
|
||||
|
||||
// Get the kcl version from the wasm module
|
||||
// and store it in the singleton
|
||||
// so we don't waste time getting it multiple times
|
||||
get kclVersion() {
|
||||
if (this._kclVersion === undefined) {
|
||||
this._kclVersion = getKclVersion()
|
||||
}
|
||||
return this._kclVersion
|
||||
}
|
||||
|
||||
get errors() {
|
||||
return this._errors
|
||||
}
|
||||
@ -243,7 +256,8 @@ export class KclManager {
|
||||
nonCodeNodes: {},
|
||||
startNodes: [],
|
||||
},
|
||||
trivia: [],
|
||||
innerAttrs: [],
|
||||
outerAttrs: [],
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ child_process.spawnSync('git', [
|
||||
'clone',
|
||||
'--single-branch',
|
||||
'--branch',
|
||||
'achalmers/kw-pattern',
|
||||
'achalmers/kw-pattern-transform2',
|
||||
URL_GIT_KCL_SAMPLES,
|
||||
DIR_KCL_SAMPLES,
|
||||
])
|
||||
|
||||
@ -134,7 +134,7 @@ describe('Testing findUniqueName', () => {
|
||||
start: 0,
|
||||
end: 0,
|
||||
moduleId: 0,
|
||||
trivia: [],
|
||||
outerAttrs: [],
|
||||
},
|
||||
{
|
||||
type: 'Identifier',
|
||||
@ -142,7 +142,7 @@ describe('Testing findUniqueName', () => {
|
||||
start: 0,
|
||||
end: 0,
|
||||
moduleId: 0,
|
||||
trivia: [],
|
||||
outerAttrs: [],
|
||||
},
|
||||
{
|
||||
type: 'Identifier',
|
||||
@ -150,7 +150,7 @@ describe('Testing findUniqueName', () => {
|
||||
start: 0,
|
||||
end: 0,
|
||||
moduleId: 0,
|
||||
trivia: [],
|
||||
outerAttrs: [],
|
||||
},
|
||||
{
|
||||
type: 'Identifier',
|
||||
@ -158,7 +158,7 @@ describe('Testing findUniqueName', () => {
|
||||
start: 0,
|
||||
end: 0,
|
||||
moduleId: 0,
|
||||
trivia: [],
|
||||
outerAttrs: [],
|
||||
},
|
||||
{
|
||||
type: 'Identifier',
|
||||
@ -166,7 +166,7 @@ describe('Testing findUniqueName', () => {
|
||||
start: 0,
|
||||
end: 0,
|
||||
moduleId: 0,
|
||||
trivia: [],
|
||||
outerAttrs: [],
|
||||
},
|
||||
{
|
||||
type: 'Identifier',
|
||||
@ -174,7 +174,7 @@ describe('Testing findUniqueName', () => {
|
||||
start: 0,
|
||||
end: 0,
|
||||
moduleId: 0,
|
||||
trivia: [],
|
||||
outerAttrs: [],
|
||||
},
|
||||
{
|
||||
type: 'Identifier',
|
||||
@ -182,7 +182,7 @@ describe('Testing findUniqueName', () => {
|
||||
start: 0,
|
||||
end: 0,
|
||||
moduleId: 0,
|
||||
trivia: [],
|
||||
outerAttrs: [],
|
||||
},
|
||||
{
|
||||
type: 'Identifier',
|
||||
@ -190,7 +190,7 @@ describe('Testing findUniqueName', () => {
|
||||
start: 0,
|
||||
end: 0,
|
||||
moduleId: 0,
|
||||
trivia: [],
|
||||
outerAttrs: [],
|
||||
},
|
||||
{
|
||||
type: 'Identifier',
|
||||
@ -198,7 +198,7 @@ describe('Testing findUniqueName', () => {
|
||||
start: 0,
|
||||
end: 0,
|
||||
moduleId: 0,
|
||||
trivia: [],
|
||||
outerAttrs: [],
|
||||
},
|
||||
] satisfies Node<Identifier>[]),
|
||||
'yo',
|
||||
@ -217,7 +217,8 @@ describe('Testing addSketchTo', () => {
|
||||
end: 0,
|
||||
moduleId: 0,
|
||||
nonCodeMeta: { nonCodeNodes: {}, startNodes: [] },
|
||||
trivia: [],
|
||||
innerAttrs: [],
|
||||
outerAttrs: [],
|
||||
},
|
||||
'yz'
|
||||
)
|
||||
|
||||
@ -278,7 +278,7 @@ export function mutateObjExpProp(
|
||||
start: 0,
|
||||
end: 0,
|
||||
moduleId: 0,
|
||||
trivia: [],
|
||||
outerAttrs: [],
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -891,7 +891,7 @@ export function createLiteral(value: LiteralValue | number): Node<Literal> {
|
||||
moduleId: 0,
|
||||
value,
|
||||
raw,
|
||||
trivia: [],
|
||||
outerAttrs: [],
|
||||
}
|
||||
}
|
||||
|
||||
@ -901,7 +901,7 @@ export function createTagDeclarator(value: string): Node<TagDeclarator> {
|
||||
start: 0,
|
||||
end: 0,
|
||||
moduleId: 0,
|
||||
trivia: [],
|
||||
outerAttrs: [],
|
||||
|
||||
value,
|
||||
}
|
||||
@ -913,7 +913,7 @@ export function createIdentifier(name: string): Node<Identifier> {
|
||||
start: 0,
|
||||
end: 0,
|
||||
moduleId: 0,
|
||||
trivia: [],
|
||||
outerAttrs: [],
|
||||
|
||||
name,
|
||||
}
|
||||
@ -925,7 +925,7 @@ export function createPipeSubstitution(): Node<PipeSubstitution> {
|
||||
start: 0,
|
||||
end: 0,
|
||||
moduleId: 0,
|
||||
trivia: [],
|
||||
outerAttrs: [],
|
||||
}
|
||||
}
|
||||
|
||||
@ -938,13 +938,13 @@ export function createCallExpressionStdLib(
|
||||
start: 0,
|
||||
end: 0,
|
||||
moduleId: 0,
|
||||
trivia: [],
|
||||
outerAttrs: [],
|
||||
callee: {
|
||||
type: 'Identifier',
|
||||
start: 0,
|
||||
end: 0,
|
||||
moduleId: 0,
|
||||
trivia: [],
|
||||
outerAttrs: [],
|
||||
|
||||
name,
|
||||
},
|
||||
@ -962,13 +962,13 @@ export function createCallExpressionStdLibKw(
|
||||
start: 0,
|
||||
end: 0,
|
||||
moduleId: 0,
|
||||
trivia: [],
|
||||
outerAttrs: [],
|
||||
callee: {
|
||||
type: 'Identifier',
|
||||
start: 0,
|
||||
end: 0,
|
||||
moduleId: 0,
|
||||
trivia: [],
|
||||
outerAttrs: [],
|
||||
|
||||
name,
|
||||
},
|
||||
@ -986,13 +986,13 @@ export function createCallExpression(
|
||||
start: 0,
|
||||
end: 0,
|
||||
moduleId: 0,
|
||||
trivia: [],
|
||||
outerAttrs: [],
|
||||
callee: {
|
||||
type: 'Identifier',
|
||||
start: 0,
|
||||
end: 0,
|
||||
moduleId: 0,
|
||||
trivia: [],
|
||||
outerAttrs: [],
|
||||
|
||||
name,
|
||||
},
|
||||
@ -1008,7 +1008,7 @@ export function createArrayExpression(
|
||||
start: 0,
|
||||
end: 0,
|
||||
moduleId: 0,
|
||||
trivia: [],
|
||||
outerAttrs: [],
|
||||
|
||||
nonCodeMeta: nonCodeMetaEmpty(),
|
||||
elements,
|
||||
@ -1023,7 +1023,7 @@ export function createPipeExpression(
|
||||
start: 0,
|
||||
end: 0,
|
||||
moduleId: 0,
|
||||
trivia: [],
|
||||
outerAttrs: [],
|
||||
|
||||
body,
|
||||
nonCodeMeta: nonCodeMetaEmpty(),
|
||||
@ -1041,14 +1041,14 @@ export function createVariableDeclaration(
|
||||
start: 0,
|
||||
end: 0,
|
||||
moduleId: 0,
|
||||
trivia: [],
|
||||
outerAttrs: [],
|
||||
|
||||
declaration: {
|
||||
type: 'VariableDeclarator',
|
||||
start: 0,
|
||||
end: 0,
|
||||
moduleId: 0,
|
||||
trivia: [],
|
||||
outerAttrs: [],
|
||||
|
||||
id: createIdentifier(varName),
|
||||
init,
|
||||
@ -1066,7 +1066,7 @@ export function createObjectExpression(properties: {
|
||||
start: 0,
|
||||
end: 0,
|
||||
moduleId: 0,
|
||||
trivia: [],
|
||||
outerAttrs: [],
|
||||
|
||||
nonCodeMeta: nonCodeMetaEmpty(),
|
||||
properties: Object.entries(properties).map(([key, value]) => ({
|
||||
@ -1074,7 +1074,7 @@ export function createObjectExpression(properties: {
|
||||
start: 0,
|
||||
end: 0,
|
||||
moduleId: 0,
|
||||
trivia: [],
|
||||
outerAttrs: [],
|
||||
key: createIdentifier(key),
|
||||
|
||||
value,
|
||||
@ -1091,7 +1091,7 @@ export function createUnaryExpression(
|
||||
start: 0,
|
||||
end: 0,
|
||||
moduleId: 0,
|
||||
trivia: [],
|
||||
outerAttrs: [],
|
||||
|
||||
operator,
|
||||
argument,
|
||||
@ -1108,7 +1108,7 @@ export function createBinaryExpression([left, operator, right]: [
|
||||
start: 0,
|
||||
end: 0,
|
||||
moduleId: 0,
|
||||
trivia: [],
|
||||
outerAttrs: [],
|
||||
|
||||
operator,
|
||||
left,
|
||||
|
||||
@ -1945,7 +1945,8 @@ export const updateStartProfileAtArgs: SketchLineHelper['updateArgs'] = ({
|
||||
startNodes: [],
|
||||
nonCodeNodes: [],
|
||||
},
|
||||
trivia: [],
|
||||
innerAttrs: [],
|
||||
outerAttrs: [],
|
||||
},
|
||||
pathToNode,
|
||||
}
|
||||
@ -2527,7 +2528,7 @@ function addTagKw(): addTagFn {
|
||||
start: callExpr.node.start,
|
||||
end: callExpr.node.end,
|
||||
moduleId: callExpr.node.moduleId,
|
||||
trivia: callExpr.node.trivia,
|
||||
outerAttrs: callExpr.node.outerAttrs,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ import {
|
||||
modify_ast_for_sketch_wasm,
|
||||
is_points_ccw,
|
||||
get_tangential_arc_to_info,
|
||||
program_memory_init,
|
||||
get_kcl_version,
|
||||
make_default_planes,
|
||||
coredump,
|
||||
toml_stringify,
|
||||
@ -43,9 +43,6 @@ import { DeepPartial } from 'lib/types'
|
||||
import { ProjectConfiguration } from 'wasm-lib/kcl/bindings/ProjectConfiguration'
|
||||
import { Sketch } from '../wasm-lib/kcl/bindings/Sketch'
|
||||
import { ExecOutcome as RustExecOutcome } from 'wasm-lib/kcl/bindings/ExecOutcome'
|
||||
import { ProgramMemory as RawProgramMemory } from '../wasm-lib/kcl/bindings/ProgramMemory'
|
||||
import { EnvironmentRef } from '../wasm-lib/kcl/bindings/EnvironmentRef'
|
||||
import { Environment } from '../wasm-lib/kcl/bindings/Environment'
|
||||
import { Node } from 'wasm-lib/kcl/bindings/Node'
|
||||
import { CompilationError } from 'wasm-lib/kcl/bindings/CompilationError'
|
||||
import { SourceRange } from 'wasm-lib/kcl/bindings/SourceRange'
|
||||
@ -770,3 +767,10 @@ export function unitAngToUnitAngle(input: UnitAng): UnitAngle {
|
||||
return 'degrees'
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the KCL version currently being used.
|
||||
*/
|
||||
export function getKclVersion(): string {
|
||||
return get_kcl_version()
|
||||
}
|
||||
|
||||
@ -40,10 +40,12 @@ export async function submitPromptToEditToQueue({
|
||||
code,
|
||||
token,
|
||||
artifactGraph,
|
||||
projectName,
|
||||
}: {
|
||||
prompt: string
|
||||
selections: Selections
|
||||
code: string
|
||||
projectName: string
|
||||
token?: string
|
||||
artifactGraph: ArtifactGraph
|
||||
}): Promise<Models['TextToCadIteration_type'] | Error> {
|
||||
@ -157,6 +159,9 @@ See later source ranges for more context. about the sweep`,
|
||||
original_source_code: code,
|
||||
prompt,
|
||||
source_ranges: ranges,
|
||||
project_name:
|
||||
projectName !== '' && projectName !== 'browser' ? projectName : undefined,
|
||||
kcl_version: kclManager.kclVersion,
|
||||
}
|
||||
const url = VITE_KC_API_BASE_URL + '/ml/text-to-cad/iteration'
|
||||
const data: Models['TextToCadIteration_type'] | Error =
|
||||
@ -203,11 +208,13 @@ export async function doPromptEdit({
|
||||
code,
|
||||
token,
|
||||
artifactGraph,
|
||||
projectName,
|
||||
}: {
|
||||
prompt: string
|
||||
selections: Selections
|
||||
code: string
|
||||
token?: string
|
||||
projectName: string
|
||||
artifactGraph: ArtifactGraph
|
||||
}): Promise<Models['TextToCadIteration_type'] | Error> {
|
||||
const toastId = toast.loading('Submitting to Text-to-CAD API...')
|
||||
@ -217,6 +224,7 @@ export async function doPromptEdit({
|
||||
code,
|
||||
token,
|
||||
artifactGraph,
|
||||
projectName,
|
||||
})
|
||||
if (err(submitResult)) return submitResult
|
||||
|
||||
@ -269,12 +277,14 @@ export async function promptToEditFlow({
|
||||
code,
|
||||
token,
|
||||
artifactGraph,
|
||||
projectName,
|
||||
}: {
|
||||
prompt: string
|
||||
selections: Selections
|
||||
code: string
|
||||
token?: string
|
||||
artifactGraph: ArtifactGraph
|
||||
projectName: string
|
||||
}) {
|
||||
const result = await doPromptEdit({
|
||||
prompt,
|
||||
@ -282,6 +292,7 @@ export async function promptToEditFlow({
|
||||
code,
|
||||
token,
|
||||
artifactGraph,
|
||||
projectName,
|
||||
})
|
||||
if (err(result)) return Promise.reject(result)
|
||||
const oldCode = codeManager.code
|
||||
|
||||
@ -16,12 +16,19 @@ import { commandBarMachine } from 'machines/commandBarMachine'
|
||||
import { getNextFileName } from './desktopFS'
|
||||
import { reportRejection } from './trap'
|
||||
import { toSync } from './utils'
|
||||
import { kclManager } from './singletons'
|
||||
|
||||
async function submitTextToCadPrompt(
|
||||
prompt: string,
|
||||
projectName: string,
|
||||
token?: string
|
||||
): Promise<Models['TextToCad_type'] | Error> {
|
||||
const body: Models['TextToCadCreateBody_type'] = { prompt }
|
||||
const body: Models['TextToCadCreateBody_type'] = {
|
||||
prompt,
|
||||
project_name:
|
||||
projectName !== '' && projectName !== 'browser' ? projectName : undefined,
|
||||
kcl_version: kclManager.kclVersion,
|
||||
}
|
||||
// Glb has a smaller footprint than gltf, should we want to render it.
|
||||
const url = VITE_KC_API_BASE_URL + '/ai/text-to-cad/glb?kcl=true'
|
||||
const data: Models['TextToCad_type'] | Error = await crossPlatformFetch(
|
||||
@ -100,7 +107,11 @@ export async function submitAndAwaitTextToKcl({
|
||||
)
|
||||
}
|
||||
|
||||
const textToCadQueued = await submitTextToCadPrompt(trimmedPrompt, token)
|
||||
const textToCadQueued = await submitTextToCadPrompt(
|
||||
trimmedPrompt,
|
||||
context.project.name,
|
||||
token
|
||||
)
|
||||
.then((value) => {
|
||||
if (value instanceof Error) {
|
||||
return Promise.reject(value)
|
||||
|
||||
@ -17,7 +17,6 @@ import {
|
||||
modify_ast_for_sketch_wasm as ModifyAstForSketch,
|
||||
is_points_ccw as IsPointsCcw,
|
||||
get_tangential_arc_to_info as GetTangentialArcToInfo,
|
||||
program_memory_init as ProgramMemoryInit,
|
||||
make_default_planes as MakeDefaultPlanes,
|
||||
coredump as CoreDump,
|
||||
toml_stringify as TomlStringify,
|
||||
@ -29,6 +28,7 @@ import {
|
||||
clear_scene_and_bust_cache as ClearSceneAndBustCache,
|
||||
kcl_settings as KclSettings,
|
||||
change_kcl_settings as ChangeKclSettings,
|
||||
get_kcl_version as GetKclVersion,
|
||||
} from '../wasm-lib/pkg/wasm_lib'
|
||||
|
||||
type ModuleType = typeof import('../wasm-lib/pkg/wasm_lib')
|
||||
@ -80,9 +80,6 @@ export const get_tangential_arc_to_info: typeof GetTangentialArcToInfo = (
|
||||
) => {
|
||||
return getModule().get_tangential_arc_to_info(...args)
|
||||
}
|
||||
export const program_memory_init: typeof ProgramMemoryInit = (...args) => {
|
||||
return getModule().program_memory_init(...args)
|
||||
}
|
||||
export const make_default_planes: typeof MakeDefaultPlanes = (...args) => {
|
||||
return getModule().make_default_planes(...args)
|
||||
}
|
||||
@ -122,3 +119,6 @@ export const kcl_settings: typeof KclSettings = (...args) => {
|
||||
export const change_kcl_settings: typeof ChangeKclSettings = (...args) => {
|
||||
return getModule().change_kcl_settings(...args)
|
||||
}
|
||||
export const get_kcl_version: typeof GetKclVersion = () => {
|
||||
return getModule().get_kcl_version()
|
||||
}
|
||||
|
||||
@ -442,7 +442,7 @@ fn do_stdlib_inner(
|
||||
#const_struct
|
||||
|
||||
fn #boxed_fn_name_ident(
|
||||
exec_state: &mut crate::ExecState,
|
||||
exec_state: &mut crate::execution::ExecState,
|
||||
args: crate::std::Args,
|
||||
) -> std::pin::Pin<
|
||||
Box<dyn std::future::Future<Output = anyhow::Result<crate::execution::KclValue, crate::errors::KclError>> + Send + '_>,
|
||||
@ -831,7 +831,7 @@ fn generate_code_block_test(fn_name: &str, code_block: &str, index: usize) -> pr
|
||||
context_type: crate::execution::ContextType::Mock,
|
||||
};
|
||||
|
||||
if let Err(e) = ctx.run(&program, &mut crate::ExecState::new(&ctx.settings)).await {
|
||||
if let Err(e) = ctx.run(&program, &mut crate::execution::ExecState::new(&ctx.settings)).await {
|
||||
return Err(miette::Report::new(crate::errors::Report {
|
||||
error: e,
|
||||
filename: format!("{}{}", #fn_name, #index),
|
||||
|
||||
@ -15,7 +15,10 @@ mod test_examples_someFn {
|
||||
context_type: crate::execution::ContextType::Mock,
|
||||
};
|
||||
if let Err(e) = ctx
|
||||
.run(&program, &mut crate::ExecState::new(&ctx.settings))
|
||||
.run(
|
||||
&program,
|
||||
&mut crate::execution::ExecState::new(&ctx.settings),
|
||||
)
|
||||
.await
|
||||
{
|
||||
return Err(miette::Report::new(crate::errors::Report {
|
||||
@ -67,7 +70,7 @@ pub(crate) struct SomeFn {}
|
||||
#[doc = "Std lib function: someFn\nDocs"]
|
||||
pub(crate) const SomeFn: SomeFn = SomeFn {};
|
||||
fn boxed_someFn(
|
||||
exec_state: &mut crate::ExecState,
|
||||
exec_state: &mut crate::execution::ExecState,
|
||||
args: crate::std::Args,
|
||||
) -> std::pin::Pin<
|
||||
Box<
|
||||
|
||||
@ -15,7 +15,10 @@ mod test_examples_someFn {
|
||||
context_type: crate::execution::ContextType::Mock,
|
||||
};
|
||||
if let Err(e) = ctx
|
||||
.run(&program, &mut crate::ExecState::new(&ctx.settings))
|
||||
.run(
|
||||
&program,
|
||||
&mut crate::execution::ExecState::new(&ctx.settings),
|
||||
)
|
||||
.await
|
||||
{
|
||||
return Err(miette::Report::new(crate::errors::Report {
|
||||
@ -67,7 +70,7 @@ pub(crate) struct SomeFn {}
|
||||
#[doc = "Std lib function: someFn\nDocs"]
|
||||
pub(crate) const SomeFn: SomeFn = SomeFn {};
|
||||
fn boxed_someFn(
|
||||
exec_state: &mut crate::ExecState,
|
||||
exec_state: &mut crate::execution::ExecState,
|
||||
args: crate::std::Args,
|
||||
) -> std::pin::Pin<
|
||||
Box<
|
||||
|
||||
@ -16,7 +16,10 @@ mod test_examples_show {
|
||||
context_type: crate::execution::ContextType::Mock,
|
||||
};
|
||||
if let Err(e) = ctx
|
||||
.run(&program, &mut crate::ExecState::new(&ctx.settings))
|
||||
.run(
|
||||
&program,
|
||||
&mut crate::execution::ExecState::new(&ctx.settings),
|
||||
)
|
||||
.await
|
||||
{
|
||||
return Err(miette::Report::new(crate::errors::Report {
|
||||
@ -73,7 +76,10 @@ mod test_examples_show {
|
||||
context_type: crate::execution::ContextType::Mock,
|
||||
};
|
||||
if let Err(e) = ctx
|
||||
.run(&program, &mut crate::ExecState::new(&ctx.settings))
|
||||
.run(
|
||||
&program,
|
||||
&mut crate::execution::ExecState::new(&ctx.settings),
|
||||
)
|
||||
.await
|
||||
{
|
||||
return Err(miette::Report::new(crate::errors::Report {
|
||||
@ -125,7 +131,7 @@ pub(crate) struct Show {}
|
||||
#[doc = "Std lib function: show\nThis is some function.\nIt does shit."]
|
||||
pub(crate) const Show: Show = Show {};
|
||||
fn boxed_show(
|
||||
exec_state: &mut crate::ExecState,
|
||||
exec_state: &mut crate::execution::ExecState,
|
||||
args: crate::std::Args,
|
||||
) -> std::pin::Pin<
|
||||
Box<
|
||||
|
||||
@ -16,7 +16,10 @@ mod test_examples_show {
|
||||
context_type: crate::execution::ContextType::Mock,
|
||||
};
|
||||
if let Err(e) = ctx
|
||||
.run(&program, &mut crate::ExecState::new(&ctx.settings))
|
||||
.run(
|
||||
&program,
|
||||
&mut crate::execution::ExecState::new(&ctx.settings),
|
||||
)
|
||||
.await
|
||||
{
|
||||
return Err(miette::Report::new(crate::errors::Report {
|
||||
@ -68,7 +71,7 @@ pub(crate) struct Show {}
|
||||
#[doc = "Std lib function: show\nThis is some function.\nIt does shit."]
|
||||
pub(crate) const Show: Show = Show {};
|
||||
fn boxed_show(
|
||||
exec_state: &mut crate::ExecState,
|
||||
exec_state: &mut crate::execution::ExecState,
|
||||
args: crate::std::Args,
|
||||
) -> std::pin::Pin<
|
||||
Box<
|
||||
|
||||
@ -17,7 +17,10 @@ mod test_examples_my_func {
|
||||
context_type: crate::execution::ContextType::Mock,
|
||||
};
|
||||
if let Err(e) = ctx
|
||||
.run(&program, &mut crate::ExecState::new(&ctx.settings))
|
||||
.run(
|
||||
&program,
|
||||
&mut crate::execution::ExecState::new(&ctx.settings),
|
||||
)
|
||||
.await
|
||||
{
|
||||
return Err(miette::Report::new(crate::errors::Report {
|
||||
@ -74,7 +77,10 @@ mod test_examples_my_func {
|
||||
context_type: crate::execution::ContextType::Mock,
|
||||
};
|
||||
if let Err(e) = ctx
|
||||
.run(&program, &mut crate::ExecState::new(&ctx.settings))
|
||||
.run(
|
||||
&program,
|
||||
&mut crate::execution::ExecState::new(&ctx.settings),
|
||||
)
|
||||
.await
|
||||
{
|
||||
return Err(miette::Report::new(crate::errors::Report {
|
||||
@ -126,7 +132,7 @@ pub(crate) struct MyFunc {}
|
||||
#[doc = "Std lib function: myFunc\nThis is some function.\nIt does shit."]
|
||||
pub(crate) const MyFunc: MyFunc = MyFunc {};
|
||||
fn boxed_my_func(
|
||||
exec_state: &mut crate::ExecState,
|
||||
exec_state: &mut crate::execution::ExecState,
|
||||
args: crate::std::Args,
|
||||
) -> std::pin::Pin<
|
||||
Box<
|
||||
|
||||
@ -17,7 +17,10 @@ mod test_examples_line_to {
|
||||
context_type: crate::execution::ContextType::Mock,
|
||||
};
|
||||
if let Err(e) = ctx
|
||||
.run(&program, &mut crate::ExecState::new(&ctx.settings))
|
||||
.run(
|
||||
&program,
|
||||
&mut crate::execution::ExecState::new(&ctx.settings),
|
||||
)
|
||||
.await
|
||||
{
|
||||
return Err(miette::Report::new(crate::errors::Report {
|
||||
@ -74,7 +77,10 @@ mod test_examples_line_to {
|
||||
context_type: crate::execution::ContextType::Mock,
|
||||
};
|
||||
if let Err(e) = ctx
|
||||
.run(&program, &mut crate::ExecState::new(&ctx.settings))
|
||||
.run(
|
||||
&program,
|
||||
&mut crate::execution::ExecState::new(&ctx.settings),
|
||||
)
|
||||
.await
|
||||
{
|
||||
return Err(miette::Report::new(crate::errors::Report {
|
||||
@ -126,7 +132,7 @@ pub(crate) struct LineTo {}
|
||||
#[doc = "Std lib function: lineTo\nThis is some function.\nIt does shit."]
|
||||
pub(crate) const LineTo: LineTo = LineTo {};
|
||||
fn boxed_line_to(
|
||||
exec_state: &mut crate::ExecState,
|
||||
exec_state: &mut crate::execution::ExecState,
|
||||
args: crate::std::Args,
|
||||
) -> std::pin::Pin<
|
||||
Box<
|
||||
|
||||
@ -16,7 +16,10 @@ mod test_examples_min {
|
||||
context_type: crate::execution::ContextType::Mock,
|
||||
};
|
||||
if let Err(e) = ctx
|
||||
.run(&program, &mut crate::ExecState::new(&ctx.settings))
|
||||
.run(
|
||||
&program,
|
||||
&mut crate::execution::ExecState::new(&ctx.settings),
|
||||
)
|
||||
.await
|
||||
{
|
||||
return Err(miette::Report::new(crate::errors::Report {
|
||||
@ -73,7 +76,10 @@ mod test_examples_min {
|
||||
context_type: crate::execution::ContextType::Mock,
|
||||
};
|
||||
if let Err(e) = ctx
|
||||
.run(&program, &mut crate::ExecState::new(&ctx.settings))
|
||||
.run(
|
||||
&program,
|
||||
&mut crate::execution::ExecState::new(&ctx.settings),
|
||||
)
|
||||
.await
|
||||
{
|
||||
return Err(miette::Report::new(crate::errors::Report {
|
||||
@ -125,7 +131,7 @@ pub(crate) struct Min {}
|
||||
#[doc = "Std lib function: min\nThis is some function.\nIt does shit."]
|
||||
pub(crate) const Min: Min = Min {};
|
||||
fn boxed_min(
|
||||
exec_state: &mut crate::ExecState,
|
||||
exec_state: &mut crate::execution::ExecState,
|
||||
args: crate::std::Args,
|
||||
) -> std::pin::Pin<
|
||||
Box<
|
||||
|
||||
@ -16,7 +16,10 @@ mod test_examples_show {
|
||||
context_type: crate::execution::ContextType::Mock,
|
||||
};
|
||||
if let Err(e) = ctx
|
||||
.run(&program, &mut crate::ExecState::new(&ctx.settings))
|
||||
.run(
|
||||
&program,
|
||||
&mut crate::execution::ExecState::new(&ctx.settings),
|
||||
)
|
||||
.await
|
||||
{
|
||||
return Err(miette::Report::new(crate::errors::Report {
|
||||
@ -68,7 +71,7 @@ pub(crate) struct Show {}
|
||||
#[doc = "Std lib function: show\nThis is some function.\nIt does shit."]
|
||||
pub(crate) const Show: Show = Show {};
|
||||
fn boxed_show(
|
||||
exec_state: &mut crate::ExecState,
|
||||
exec_state: &mut crate::execution::ExecState,
|
||||
args: crate::std::Args,
|
||||
) -> std::pin::Pin<
|
||||
Box<
|
||||
|
||||
@ -16,7 +16,10 @@ mod test_examples_import {
|
||||
context_type: crate::execution::ContextType::Mock,
|
||||
};
|
||||
if let Err(e) = ctx
|
||||
.run(&program, &mut crate::ExecState::new(&ctx.settings))
|
||||
.run(
|
||||
&program,
|
||||
&mut crate::execution::ExecState::new(&ctx.settings),
|
||||
)
|
||||
.await
|
||||
{
|
||||
return Err(miette::Report::new(crate::errors::Report {
|
||||
@ -68,7 +71,7 @@ pub(crate) struct Import {}
|
||||
#[doc = "Std lib function: import\nThis is some function.\nIt does shit."]
|
||||
pub(crate) const Import: Import = Import {};
|
||||
fn boxed_import(
|
||||
exec_state: &mut crate::ExecState,
|
||||
exec_state: &mut crate::execution::ExecState,
|
||||
args: crate::std::Args,
|
||||
) -> std::pin::Pin<
|
||||
Box<
|
||||
|
||||
@ -16,7 +16,10 @@ mod test_examples_import {
|
||||
context_type: crate::execution::ContextType::Mock,
|
||||
};
|
||||
if let Err(e) = ctx
|
||||
.run(&program, &mut crate::ExecState::new(&ctx.settings))
|
||||
.run(
|
||||
&program,
|
||||
&mut crate::execution::ExecState::new(&ctx.settings),
|
||||
)
|
||||
.await
|
||||
{
|
||||
return Err(miette::Report::new(crate::errors::Report {
|
||||
@ -68,7 +71,7 @@ pub(crate) struct Import {}
|
||||
#[doc = "Std lib function: import\nThis is some function.\nIt does shit."]
|
||||
pub(crate) const Import: Import = Import {};
|
||||
fn boxed_import(
|
||||
exec_state: &mut crate::ExecState,
|
||||
exec_state: &mut crate::execution::ExecState,
|
||||
args: crate::std::Args,
|
||||
) -> std::pin::Pin<
|
||||
Box<
|
||||
|
||||
@ -16,7 +16,10 @@ mod test_examples_import {
|
||||
context_type: crate::execution::ContextType::Mock,
|
||||
};
|
||||
if let Err(e) = ctx
|
||||
.run(&program, &mut crate::ExecState::new(&ctx.settings))
|
||||
.run(
|
||||
&program,
|
||||
&mut crate::execution::ExecState::new(&ctx.settings),
|
||||
)
|
||||
.await
|
||||
{
|
||||
return Err(miette::Report::new(crate::errors::Report {
|
||||
@ -68,7 +71,7 @@ pub(crate) struct Import {}
|
||||
#[doc = "Std lib function: import\nThis is some function.\nIt does shit."]
|
||||
pub(crate) const Import: Import = Import {};
|
||||
fn boxed_import(
|
||||
exec_state: &mut crate::ExecState,
|
||||
exec_state: &mut crate::execution::ExecState,
|
||||
args: crate::std::Args,
|
||||
) -> std::pin::Pin<
|
||||
Box<
|
||||
|
||||
@ -16,7 +16,10 @@ mod test_examples_show {
|
||||
context_type: crate::execution::ContextType::Mock,
|
||||
};
|
||||
if let Err(e) = ctx
|
||||
.run(&program, &mut crate::ExecState::new(&ctx.settings))
|
||||
.run(
|
||||
&program,
|
||||
&mut crate::execution::ExecState::new(&ctx.settings),
|
||||
)
|
||||
.await
|
||||
{
|
||||
return Err(miette::Report::new(crate::errors::Report {
|
||||
@ -68,7 +71,7 @@ pub(crate) struct Show {}
|
||||
#[doc = "Std lib function: show\nThis is some function.\nIt does shit."]
|
||||
pub(crate) const Show: Show = Show {};
|
||||
fn boxed_show(
|
||||
exec_state: &mut crate::ExecState,
|
||||
exec_state: &mut crate::execution::ExecState,
|
||||
args: crate::std::Args,
|
||||
) -> std::pin::Pin<
|
||||
Box<
|
||||
|
||||
@ -15,7 +15,10 @@ mod test_examples_some_function {
|
||||
context_type: crate::execution::ContextType::Mock,
|
||||
};
|
||||
if let Err(e) = ctx
|
||||
.run(&program, &mut crate::ExecState::new(&ctx.settings))
|
||||
.run(
|
||||
&program,
|
||||
&mut crate::execution::ExecState::new(&ctx.settings),
|
||||
)
|
||||
.await
|
||||
{
|
||||
return Err(miette::Report::new(crate::errors::Report {
|
||||
@ -67,7 +70,7 @@ pub(crate) struct SomeFunction {}
|
||||
#[doc = "Std lib function: someFunction\nDocs"]
|
||||
pub(crate) const SomeFunction: SomeFunction = SomeFunction {};
|
||||
fn boxed_some_function(
|
||||
exec_state: &mut crate::ExecState,
|
||||
exec_state: &mut crate::execution::ExecState,
|
||||
args: crate::std::Args,
|
||||
) -> std::pin::Pin<
|
||||
Box<
|
||||
|
||||
@ -17,7 +17,9 @@ use kcmc::{
|
||||
},
|
||||
ModelingCmd,
|
||||
};
|
||||
use kittycad_modeling_cmds::{self as kcmc, id::ModelingCmdId, websocket::ModelingBatch};
|
||||
use kittycad_modeling_cmds::{
|
||||
self as kcmc, id::ModelingCmdId, ok_response::OkModelingCmdResponse, websocket::ModelingBatch,
|
||||
};
|
||||
use tokio::sync::{mpsc, oneshot, RwLock};
|
||||
use tokio_tungstenite::tungstenite::Message as WsMsg;
|
||||
use uuid::Uuid;
|
||||
@ -459,6 +461,35 @@ impl EngineManager for EngineConnection {
|
||||
_ => {}
|
||||
}
|
||||
|
||||
// In isolated mode, we don't send the command to the engine.
|
||||
if self.execution_kind().is_isolated() {
|
||||
return match &cmd {
|
||||
WebSocketRequest::ModelingCmdBatchReq(ModelingBatch { requests, .. }) => {
|
||||
let mut responses = HashMap::with_capacity(requests.len());
|
||||
for request in requests {
|
||||
responses.insert(
|
||||
request.cmd_id,
|
||||
BatchResponse::Success {
|
||||
response: OkModelingCmdResponse::Empty {},
|
||||
},
|
||||
);
|
||||
}
|
||||
Ok(WebSocketResponse::Success(SuccessWebSocketResponse {
|
||||
request_id: Some(id),
|
||||
resp: OkWebSocketResponseData::ModelingBatch { responses },
|
||||
success: true,
|
||||
}))
|
||||
}
|
||||
_ => Ok(WebSocketResponse::Success(SuccessWebSocketResponse {
|
||||
request_id: Some(id),
|
||||
resp: OkWebSocketResponseData::Modeling {
|
||||
modeling_response: OkModelingCmdResponse::Empty {},
|
||||
},
|
||||
success: true,
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
// Send the request to the engine, via the actor.
|
||||
|
||||
@ -128,7 +128,7 @@ impl crate::engine::EngineManager for EngineConnection {
|
||||
responses: _,
|
||||
}) => {
|
||||
// Create the empty responses.
|
||||
let mut responses = HashMap::new();
|
||||
let mut responses = HashMap::with_capacity(requests.len());
|
||||
for request in requests {
|
||||
self.handle_command(&request.cmd, request.cmd_id, &id_to_source_range)?;
|
||||
responses.insert(
|
||||
|
||||
@ -9,7 +9,11 @@ use anyhow::Result;
|
||||
use indexmap::IndexMap;
|
||||
use kcmc::{
|
||||
id::ModelingCmdId,
|
||||
websocket::{ModelingBatch, WebSocketRequest, WebSocketResponse},
|
||||
ok_response::OkModelingCmdResponse,
|
||||
websocket::{
|
||||
BatchResponse, ModelingBatch, OkWebSocketResponseData, SuccessWebSocketResponse, WebSocketRequest,
|
||||
WebSocketResponse,
|
||||
},
|
||||
ModelingCmd,
|
||||
};
|
||||
use kittycad_modeling_cmds as kcmc;
|
||||
@ -222,6 +226,35 @@ impl crate::engine::EngineManager for EngineConnection {
|
||||
_ => {}
|
||||
}
|
||||
|
||||
// In isolated mode, we don't send the command to the engine.
|
||||
if self.execution_kind().is_isolated() {
|
||||
return match &cmd {
|
||||
WebSocketRequest::ModelingCmdBatchReq(ModelingBatch { requests, .. }) => {
|
||||
let mut responses = HashMap::with_capacity(requests.len());
|
||||
for request in requests {
|
||||
responses.insert(
|
||||
request.cmd_id,
|
||||
BatchResponse::Success {
|
||||
response: OkModelingCmdResponse::Empty {},
|
||||
},
|
||||
);
|
||||
}
|
||||
Ok(WebSocketResponse::Success(SuccessWebSocketResponse {
|
||||
request_id: Some(id),
|
||||
resp: OkWebSocketResponseData::ModelingBatch { responses },
|
||||
success: true,
|
||||
}))
|
||||
}
|
||||
_ => Ok(WebSocketResponse::Success(SuccessWebSocketResponse {
|
||||
request_id: Some(id),
|
||||
resp: OkWebSocketResponseData::Modeling {
|
||||
modeling_response: OkModelingCmdResponse::Empty {},
|
||||
},
|
||||
success: true,
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
let source_range_str = serde_json::to_string(&source_range).map_err(|e| {
|
||||
KclError::Engine(KclErrorDetails {
|
||||
message: format!("Failed to serialize source range: {:?}", e),
|
||||
|
||||
@ -31,12 +31,12 @@ impl From<KclErrorWithOutputs> for ExecError {
|
||||
#[derive(Debug)]
|
||||
pub struct ExecErrorWithState {
|
||||
pub error: ExecError,
|
||||
pub exec_state: Option<crate::ExecState>,
|
||||
pub exec_state: Option<crate::execution::ExecState>,
|
||||
}
|
||||
|
||||
impl ExecErrorWithState {
|
||||
#[cfg_attr(target_arch = "wasm32", expect(dead_code))]
|
||||
pub fn new(error: ExecError, exec_state: crate::ExecState) -> Self {
|
||||
pub fn new(error: ExecError, exec_state: crate::execution::ExecState) -> Self {
|
||||
Self {
|
||||
error,
|
||||
exec_state: Some(exec_state),
|
||||
|
||||
@ -5,14 +5,18 @@ use kittycad_modeling_cmds::coord::{System, KITTYCAD, OPENGL, VULKAN};
|
||||
use crate::{
|
||||
errors::KclErrorDetails,
|
||||
execution::kcl_value::{UnitAngle, UnitLen},
|
||||
parsing::ast::types::{Expr, Node, NonCodeValue, ObjectProperty},
|
||||
parsing::ast::types::{Annotation, Expr, Node, ObjectProperty},
|
||||
KclError, SourceRange,
|
||||
};
|
||||
|
||||
/// Annotations which should cause re-execution if they change.
|
||||
pub(super) const SIGNIFICANT_ATTRS: [&str; 2] = [SETTINGS, NO_PRELUDE];
|
||||
|
||||
pub(crate) const SETTINGS: &str = "settings";
|
||||
pub(crate) const SETTINGS_UNIT_LENGTH: &str = "defaultLengthUnit";
|
||||
pub(crate) const SETTINGS_UNIT_ANGLE: &str = "defaultAngleUnit";
|
||||
pub(super) const NO_PRELUDE: &str = "no_prelude";
|
||||
|
||||
pub(super) const IMPORT_FORMAT: &str = "format";
|
||||
pub(super) const IMPORT_FORMAT_VALUES: [&str; 9] = ["fbx", "gltf", "glb", "obj", "ply", "sldprt", "stp", "step", "stl"];
|
||||
pub(super) const IMPORT_COORDS: &str = "coords";
|
||||
@ -25,35 +29,24 @@ pub(super) enum AnnotationScope {
|
||||
Module,
|
||||
}
|
||||
|
||||
pub(super) fn expect_properties<'a>(
|
||||
for_key: &'static str,
|
||||
annotation: &'a NonCodeValue,
|
||||
source_range: SourceRange,
|
||||
) -> Result<&'a [Node<ObjectProperty>], KclError> {
|
||||
match annotation {
|
||||
NonCodeValue::Annotation { name, properties } => {
|
||||
assert_eq!(name.as_ref().unwrap().name, for_key);
|
||||
Ok(&**properties.as_ref().ok_or_else(|| {
|
||||
KclError::Semantic(KclErrorDetails {
|
||||
message: format!("Empty `{for_key}` annotation"),
|
||||
source_ranges: vec![source_range],
|
||||
})
|
||||
})?)
|
||||
}
|
||||
_ => unreachable!(),
|
||||
pub(super) fn is_significant(attr: &&Node<Annotation>) -> bool {
|
||||
match attr.name() {
|
||||
Some(name) => SIGNIFICANT_ATTRS.contains(&name),
|
||||
None => true,
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn unnamed_properties<'a>(
|
||||
annotations: impl Iterator<Item = &'a NonCodeValue>,
|
||||
) -> Option<&'a [Node<ObjectProperty>]> {
|
||||
for annotation in annotations {
|
||||
if let NonCodeValue::Annotation { name: None, properties } = annotation {
|
||||
return properties.as_deref();
|
||||
}
|
||||
}
|
||||
|
||||
None
|
||||
pub(super) fn expect_properties<'a>(
|
||||
for_key: &'static str,
|
||||
annotation: &'a Node<Annotation>,
|
||||
) -> Result<&'a [Node<ObjectProperty>], KclError> {
|
||||
assert_eq!(annotation.name().unwrap(), for_key);
|
||||
Ok(&**annotation.properties.as_ref().ok_or_else(|| {
|
||||
KclError::Semantic(KclErrorDetails {
|
||||
message: format!("Empty `{for_key}` annotation"),
|
||||
source_ranges: vec![annotation.as_source_range()],
|
||||
})
|
||||
})?)
|
||||
}
|
||||
|
||||
pub(super) fn expect_ident(expr: &Expr) -> Result<&str, KclError> {
|
||||
|
||||
@ -6,13 +6,11 @@ use itertools::{EitherOrBoth, Itertools};
|
||||
use tokio::sync::RwLock;
|
||||
|
||||
use crate::{
|
||||
execution::{ExecState, ExecutorSettings},
|
||||
parsing::ast::types::{Node, NonCodeValue, Program},
|
||||
execution::{annotations, memory::ProgramMemory, ExecState, ExecutorSettings},
|
||||
parsing::ast::types::{Annotation, Node, Program},
|
||||
walk::Node as WalkNode,
|
||||
};
|
||||
|
||||
use super::ProgramMemory;
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
/// A static mutable lock for updating the last successful execution state for the cache.
|
||||
static ref OLD_AST: Arc<RwLock<Option<OldAstState>>> = Default::default();
|
||||
@ -93,7 +91,7 @@ pub(super) enum CacheResult {
|
||||
/// Returns `None` when there are no changes to the program, i.e. it is
|
||||
/// fully cached.
|
||||
pub(super) async fn get_changed_program(old: CacheInformation<'_>, new: CacheInformation<'_>) -> CacheResult {
|
||||
let mut try_reapply_settings = false;
|
||||
let mut reapply_settings = false;
|
||||
|
||||
// If the settings are different we might need to bust the cache.
|
||||
// We specifically do this before checking if they are the exact same.
|
||||
@ -109,13 +107,13 @@ pub(super) async fn get_changed_program(old: CacheInformation<'_>, new: CacheInf
|
||||
|
||||
// If anything else is different we may not need to re-execute, but rather just
|
||||
// run the settings again.
|
||||
try_reapply_settings = true;
|
||||
reapply_settings = true;
|
||||
}
|
||||
|
||||
// If the ASTs are the EXACT same we return None.
|
||||
// We don't even need to waste time computing the digests.
|
||||
if old.ast == new.ast {
|
||||
return CacheResult::NoAction(try_reapply_settings);
|
||||
return CacheResult::NoAction(reapply_settings);
|
||||
}
|
||||
|
||||
// We have to clone just because the digests are stored inline :-(
|
||||
@ -129,37 +127,39 @@ pub(super) async fn get_changed_program(old: CacheInformation<'_>, new: CacheInf
|
||||
|
||||
// Check if the digest is the same.
|
||||
if old_ast.digest == new_ast.digest {
|
||||
return CacheResult::NoAction(try_reapply_settings);
|
||||
return CacheResult::NoAction(reapply_settings);
|
||||
}
|
||||
|
||||
// Check if the annotations are different.
|
||||
if !old_ast.annotations().zip_longest(new_ast.annotations()).all(|pair| {
|
||||
match pair {
|
||||
EitherOrBoth::Both(old, new) => {
|
||||
// Compare annotations, ignoring source ranges. Digests must
|
||||
// have been computed before this.
|
||||
match (&old.value, &new.value) {
|
||||
(
|
||||
NonCodeValue::Annotation { name, properties },
|
||||
NonCodeValue::Annotation {
|
||||
name: new_name,
|
||||
properties: new_properties,
|
||||
},
|
||||
) => {
|
||||
name.as_ref().map(|n| n.digest) == new_name.as_ref().map(|n| n.digest)
|
||||
&& properties
|
||||
if !old_ast
|
||||
.inner_attrs
|
||||
.iter()
|
||||
.filter(annotations::is_significant)
|
||||
.zip_longest(new_ast.inner_attrs.iter().filter(annotations::is_significant))
|
||||
.all(|pair| {
|
||||
match pair {
|
||||
EitherOrBoth::Both(old, new) => {
|
||||
// Compare annotations, ignoring source ranges. Digests must
|
||||
// have been computed before this.
|
||||
let Annotation { name, properties, .. } = &old.inner;
|
||||
let Annotation {
|
||||
name: new_name,
|
||||
properties: new_properties,
|
||||
..
|
||||
} = &new.inner;
|
||||
|
||||
name.as_ref().map(|n| n.digest) == new_name.as_ref().map(|n| n.digest)
|
||||
&& properties
|
||||
.as_ref()
|
||||
.map(|props| props.iter().map(|p| p.digest).collect::<Vec<_>>())
|
||||
== new_properties
|
||||
.as_ref()
|
||||
.map(|props| props.iter().map(|p| p.digest).collect::<Vec<_>>())
|
||||
== new_properties
|
||||
.as_ref()
|
||||
.map(|props| props.iter().map(|p| p.digest).collect::<Vec<_>>())
|
||||
}
|
||||
_ => false,
|
||||
}
|
||||
_ => false,
|
||||
}
|
||||
_ => false,
|
||||
}
|
||||
}) {
|
||||
})
|
||||
{
|
||||
// If any of the annotations are different at the beginning of the
|
||||
// program, it's likely the settings, and we have to bust the cache and
|
||||
// re-execute the whole thing.
|
||||
@ -171,12 +171,7 @@ pub(super) async fn get_changed_program(old: CacheInformation<'_>, new: CacheInf
|
||||
}
|
||||
|
||||
// Check if the changes were only to Non-code areas, like comments or whitespace.
|
||||
let (clear_scene, program) = generate_changed_program(old_ast, new_ast);
|
||||
CacheResult::ReExecute {
|
||||
clear_scene,
|
||||
reapply_settings: try_reapply_settings,
|
||||
program,
|
||||
}
|
||||
generate_changed_program(old_ast, new_ast, reapply_settings)
|
||||
}
|
||||
|
||||
/// Force-generate a new CacheResult, even if one shouldn't be made. The
|
||||
@ -185,7 +180,7 @@ pub(super) async fn get_changed_program(old: CacheInformation<'_>, new: CacheInf
|
||||
/// how we construct a new [CacheResult].
|
||||
///
|
||||
/// Digests *must* be computed before calling this.
|
||||
fn generate_changed_program(old_ast: Node<Program>, mut new_ast: Node<Program>) -> (bool, Node<Program>) {
|
||||
fn generate_changed_program(old_ast: Node<Program>, mut new_ast: Node<Program>, reapply_settings: bool) -> CacheResult {
|
||||
if !old_ast.body.iter().zip(new_ast.body.iter()).all(|(old, new)| {
|
||||
let old_node: WalkNode = old.into();
|
||||
let new_node: WalkNode = new.into();
|
||||
@ -196,7 +191,11 @@ fn generate_changed_program(old_ast: Node<Program>, mut new_ast: Node<Program>)
|
||||
// means a single insertion or deletion will result in a cache
|
||||
// bust.
|
||||
|
||||
return (true, new_ast);
|
||||
return CacheResult::ReExecute {
|
||||
clear_scene: true,
|
||||
reapply_settings,
|
||||
program: new_ast,
|
||||
};
|
||||
}
|
||||
|
||||
// otherwise the overlapping section of the ast bodies matches.
|
||||
@ -212,7 +211,11 @@ fn generate_changed_program(old_ast: Node<Program>, mut new_ast: Node<Program>)
|
||||
// supporting that.
|
||||
|
||||
// Cache bust time.
|
||||
(true, new_ast)
|
||||
CacheResult::ReExecute {
|
||||
clear_scene: true,
|
||||
reapply_settings,
|
||||
program: new_ast,
|
||||
}
|
||||
}
|
||||
std::cmp::Ordering::Greater => {
|
||||
// the new AST is longer than the old AST, which means
|
||||
@ -224,7 +227,11 @@ fn generate_changed_program(old_ast: Node<Program>, mut new_ast: Node<Program>)
|
||||
|
||||
new_ast.body = new_ast.body[old_ast.body.len()..].to_owned();
|
||||
|
||||
(false, new_ast)
|
||||
CacheResult::ReExecute {
|
||||
clear_scene: false,
|
||||
reapply_settings,
|
||||
program: new_ast,
|
||||
}
|
||||
}
|
||||
std::cmp::Ordering::Equal => {
|
||||
// currently unreachable, but let's pretend like the code
|
||||
@ -236,9 +243,7 @@ fn generate_changed_program(old_ast: Node<Program>, mut new_ast: Node<Program>)
|
||||
// so but i think many things. This def needs to change
|
||||
// when the code above changes.
|
||||
|
||||
new_ast.body = vec![];
|
||||
|
||||
(false, new_ast)
|
||||
CacheResult::NoAction(reapply_settings)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -370,8 +375,10 @@ shell(firstSketch, faces = ['end'], thickness = 0.25)"#;
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn test_get_changed_program_same_code_changed_code_comments() {
|
||||
let old = r#" // Removed the end face for the extrusion.
|
||||
async fn test_get_changed_program_same_code_changed_code_comments_attrs() {
|
||||
let old = r#"@foo(whatever = whatever)
|
||||
@bar
|
||||
// Removed the end face for the extrusion.
|
||||
firstSketch = startSketchOn('XY')
|
||||
|> startProfileAt([-12, 12], %)
|
||||
|> line(end = [24, 0])
|
||||
@ -383,7 +390,9 @@ firstSketch = startSketchOn('XY')
|
||||
// Remove the end face for the extrusion.
|
||||
shell(firstSketch, faces = ['end'], thickness = 0.25) "#;
|
||||
|
||||
let new = r#"// Remove the end face for the extrusion.
|
||||
let new = r#"@foo(whatever = 42)
|
||||
@baz
|
||||
// Remove the end face for the extrusion.
|
||||
firstSketch = startSketchOn('XY')
|
||||
|> startProfileAt([-12, 12], %)
|
||||
|> line(end = [24, 0])
|
||||
|
||||
@ -10,15 +10,16 @@ use crate::{
|
||||
annotations,
|
||||
cad_op::{OpArg, Operation},
|
||||
memory,
|
||||
memory::ProgramMemory,
|
||||
state::ModuleState,
|
||||
BodyType, EnvironmentRef, ExecState, ExecutorContext, KclValue, MemoryFunction, Metadata, ProgramMemory,
|
||||
TagEngineInfo, TagIdentifier,
|
||||
BodyType, EnvironmentRef, ExecState, ExecutorContext, KclValue, MemoryFunction, Metadata, TagEngineInfo,
|
||||
TagIdentifier,
|
||||
},
|
||||
modules::{ModuleId, ModulePath, ModuleRepr},
|
||||
parsing::ast::types::{
|
||||
ArrayExpression, ArrayRangeExpression, BinaryExpression, BinaryOperator, BinaryPart, BodyItem, CallExpression,
|
||||
CallExpressionKw, Expr, FunctionExpression, IfExpression, ImportPath, ImportSelector, ItemVisibility,
|
||||
LiteralIdentifier, LiteralValue, MemberExpression, MemberObject, Node, NodeRef, NonCodeNode, NonCodeValue,
|
||||
Annotation, ArrayExpression, ArrayRangeExpression, BinaryExpression, BinaryOperator, BinaryPart, BodyItem,
|
||||
CallExpression, CallExpressionKw, Expr, FunctionExpression, IfExpression, ImportPath, ImportSelector,
|
||||
ItemVisibility, LiteralIdentifier, LiteralValue, MemberExpression, MemberObject, Node, NodeRef,
|
||||
ObjectExpression, PipeExpression, Program, TagDeclarator, UnaryExpression, UnaryOperator,
|
||||
},
|
||||
source_range::SourceRange,
|
||||
@ -36,37 +37,36 @@ enum StatementKind<'a> {
|
||||
impl ExecutorContext {
|
||||
async fn handle_annotations(
|
||||
&self,
|
||||
annotations: impl Iterator<Item = (&NonCodeValue, SourceRange)>,
|
||||
annotations: impl Iterator<Item = &Node<Annotation>>,
|
||||
scope: annotations::AnnotationScope,
|
||||
exec_state: &mut ExecState,
|
||||
) -> Result<bool, KclError> {
|
||||
let mut no_prelude = false;
|
||||
for (annotation, source_range) in annotations {
|
||||
if annotation.annotation_name() == Some(annotations::SETTINGS) {
|
||||
for annotation in annotations {
|
||||
if annotation.name() == Some(annotations::SETTINGS) {
|
||||
if scope == annotations::AnnotationScope::Module {
|
||||
let old_units = exec_state.length_unit();
|
||||
exec_state
|
||||
.mod_local
|
||||
.settings
|
||||
.update_from_annotation(annotation, source_range)?;
|
||||
exec_state.mod_local.settings.update_from_annotation(annotation)?;
|
||||
let new_units = exec_state.length_unit();
|
||||
if !self.engine.execution_kind().is_isolated() && old_units != new_units {
|
||||
self.engine.set_units(new_units.into(), source_range).await?;
|
||||
self.engine
|
||||
.set_units(new_units.into(), annotation.as_source_range())
|
||||
.await?;
|
||||
}
|
||||
} else {
|
||||
return Err(KclError::Semantic(KclErrorDetails {
|
||||
message: "Settings can only be modified at the top level scope of a file".to_owned(),
|
||||
source_ranges: vec![source_range],
|
||||
source_ranges: vec![annotation.as_source_range()],
|
||||
}));
|
||||
}
|
||||
}
|
||||
if annotation.annotation_name() == Some(annotations::NO_PRELUDE) {
|
||||
if annotation.name() == Some(annotations::NO_PRELUDE) {
|
||||
if scope == annotations::AnnotationScope::Module {
|
||||
no_prelude = true;
|
||||
} else {
|
||||
return Err(KclError::Semantic(KclErrorDetails {
|
||||
message: "Prelude can only be skipped at the top level scope of a file".to_owned(),
|
||||
source_ranges: vec![source_range],
|
||||
source_ranges: vec![annotation.as_source_range()],
|
||||
}));
|
||||
}
|
||||
}
|
||||
@ -86,11 +86,7 @@ impl ExecutorContext {
|
||||
if body_type == BodyType::Root {
|
||||
let _no_prelude = self
|
||||
.handle_annotations(
|
||||
program
|
||||
.non_code_meta
|
||||
.start_nodes
|
||||
.iter()
|
||||
.filter_map(|n| n.annotation().map(|result| (result, n.as_source_range()))),
|
||||
program.inner_attrs.iter(),
|
||||
annotations::AnnotationScope::Module,
|
||||
exec_state,
|
||||
)
|
||||
@ -99,7 +95,7 @@ impl ExecutorContext {
|
||||
|
||||
let mut last_expr = None;
|
||||
// Iterate over the body of the program.
|
||||
for (i, statement) in program.body.iter().enumerate() {
|
||||
for statement in &program.body {
|
||||
match statement {
|
||||
BodyItem::ImportStatement(import_stmt) => {
|
||||
if body_type != BodyType::Root {
|
||||
@ -110,9 +106,9 @@ impl ExecutorContext {
|
||||
}
|
||||
|
||||
let source_range = SourceRange::from(import_stmt);
|
||||
let meta_nodes = program.non_code_meta.get(i);
|
||||
let attrs = &import_stmt.outer_attrs;
|
||||
let module_id = self
|
||||
.open_module(&import_stmt.path, meta_nodes, exec_state, source_range)
|
||||
.open_module(&import_stmt.path, attrs, exec_state, source_range)
|
||||
.await?;
|
||||
|
||||
match &import_stmt.selector {
|
||||
@ -208,7 +204,7 @@ impl ExecutorContext {
|
||||
let source_range = SourceRange::from(&variable_declaration.declaration.init);
|
||||
let metadata = Metadata { source_range };
|
||||
|
||||
let _meta_nodes = program.non_code_meta.get(i);
|
||||
let _annotations = &variable_declaration.outer_attrs;
|
||||
|
||||
let memory_item = self
|
||||
.execute_expr(
|
||||
@ -278,7 +274,7 @@ impl ExecutorContext {
|
||||
async fn open_module(
|
||||
&self,
|
||||
path: &ImportPath,
|
||||
non_code_meta: &[Node<NonCodeNode>],
|
||||
attrs: &[Node<Annotation>],
|
||||
exec_state: &mut ExecState,
|
||||
source_range: SourceRange,
|
||||
) -> Result<ModuleId, KclError> {
|
||||
@ -306,7 +302,7 @@ impl ExecutorContext {
|
||||
|
||||
let id = exec_state.next_module_id();
|
||||
let path = resolved_path.expect_path();
|
||||
let format = super::import::format_from_annotations(non_code_meta, path, source_range)?;
|
||||
let format = super::import::format_from_annotations(attrs, path, source_range)?;
|
||||
let geom = super::import::import_foreign(path, format, exec_state, self, source_range).await?;
|
||||
exec_state.add_module(id, resolved_path, ModuleRepr::Foreign(geom));
|
||||
Ok(id)
|
||||
@ -1837,18 +1833,7 @@ mod test {
|
||||
// Run each test.
|
||||
let func_expr = &Node::no_src(FunctionExpression {
|
||||
params,
|
||||
body: Node {
|
||||
inner: crate::parsing::ast::types::Program {
|
||||
body: Vec::new(),
|
||||
non_code_meta: Default::default(),
|
||||
shebang: None,
|
||||
digest: None,
|
||||
},
|
||||
start: 0,
|
||||
end: 0,
|
||||
module_id: ModuleId::default(),
|
||||
trivia: Vec::new(),
|
||||
},
|
||||
body: crate::parsing::ast::types::Program::empty(),
|
||||
return_type: None,
|
||||
digest: None,
|
||||
});
|
||||
|
||||
@ -19,7 +19,7 @@ use crate::{
|
||||
errors::{KclError, KclErrorDetails},
|
||||
execution::{annotations, kcl_value::UnitLen, ExecState, ExecutorContext, ImportedGeometry},
|
||||
fs::FileSystem,
|
||||
parsing::ast::types::{Node, NonCodeNode},
|
||||
parsing::ast::types::{Annotation, Node},
|
||||
source_range::SourceRange,
|
||||
};
|
||||
|
||||
@ -155,16 +155,18 @@ pub async fn import_foreign(
|
||||
}
|
||||
|
||||
pub(super) fn format_from_annotations(
|
||||
non_code_meta: &[Node<NonCodeNode>],
|
||||
annotations: &[Node<Annotation>],
|
||||
path: &Path,
|
||||
import_source_range: SourceRange,
|
||||
) -> Result<Option<InputFormat>, KclError> {
|
||||
let Some(props) = annotations::unnamed_properties(non_code_meta.iter().map(|n| &n.value)) else {
|
||||
if annotations.is_empty() {
|
||||
return Ok(None);
|
||||
};
|
||||
}
|
||||
|
||||
let props = annotations.iter().flat_map(|a| a.properties.as_deref().unwrap_or(&[]));
|
||||
|
||||
let mut result = None;
|
||||
for p in props {
|
||||
for p in props.clone() {
|
||||
if p.key.name == annotations::IMPORT_FORMAT {
|
||||
result = Some(
|
||||
get_import_format_from_extension(annotations::expect_ident(&p.value)?).map_err(|_| {
|
||||
@ -287,7 +289,7 @@ pub struct PreImportedGeometry {
|
||||
}
|
||||
|
||||
pub async fn send_to_engine(pre: PreImportedGeometry, ctxt: &ExecutorContext) -> Result<ImportedGeometry, KclError> {
|
||||
if ctxt.is_mock() {
|
||||
if ctxt.no_engine_commands() {
|
||||
return Ok(ImportedGeometry {
|
||||
id: pre.id,
|
||||
value: pre.command.files.iter().map(|f| f.path.to_string()).collect(),
|
||||
@ -422,8 +424,8 @@ mod test {
|
||||
// no format, no options
|
||||
let text = "@()\nimport '../foo.gltf' as foo";
|
||||
let parsed = crate::Program::parse_no_errs(text).unwrap().ast;
|
||||
let non_code_meta = parsed.non_code_meta.get(0);
|
||||
let fmt = format_from_annotations(non_code_meta, Path::new("../foo.gltf"), SourceRange::default())
|
||||
let attrs = parsed.body[0].get_attrs();
|
||||
let fmt = format_from_annotations(attrs, Path::new("../foo.gltf"), SourceRange::default())
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
@ -434,8 +436,8 @@ mod test {
|
||||
// format, no options
|
||||
let text = "@(format = gltf)\nimport '../foo.txt' as foo";
|
||||
let parsed = crate::Program::parse_no_errs(text).unwrap().ast;
|
||||
let non_code_meta = parsed.non_code_meta.get(0);
|
||||
let fmt = format_from_annotations(non_code_meta, Path::new("../foo.txt"), SourceRange::default())
|
||||
let attrs = parsed.body[0].get_attrs();
|
||||
let fmt = format_from_annotations(attrs, Path::new("../foo.txt"), SourceRange::default())
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
@ -444,7 +446,7 @@ mod test {
|
||||
);
|
||||
|
||||
// format, no extension (wouldn't parse but might some day)
|
||||
let fmt = format_from_annotations(non_code_meta, Path::new("../foo"), SourceRange::default())
|
||||
let fmt = format_from_annotations(attrs, Path::new("../foo"), SourceRange::default())
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
@ -455,8 +457,8 @@ mod test {
|
||||
// format, options
|
||||
let text = "@(format = obj, coords = vulkan, lengthUnit = ft)\nimport '../foo.txt' as foo";
|
||||
let parsed = crate::Program::parse_no_errs(text).unwrap().ast;
|
||||
let non_code_meta = parsed.non_code_meta.get(0);
|
||||
let fmt = format_from_annotations(non_code_meta, Path::new("../foo.txt"), SourceRange::default())
|
||||
let attrs = parsed.body[0].get_attrs();
|
||||
let fmt = format_from_annotations(attrs, Path::new("../foo.txt"), SourceRange::default())
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
@ -470,8 +472,8 @@ mod test {
|
||||
// no format, options
|
||||
let text = "@(coords = vulkan, lengthUnit = ft)\nimport '../foo.obj' as foo";
|
||||
let parsed = crate::Program::parse_no_errs(text).unwrap().ast;
|
||||
let non_code_meta = parsed.non_code_meta.get(0);
|
||||
let fmt = format_from_annotations(non_code_meta, Path::new("../foo.obj"), SourceRange::default())
|
||||
let attrs = parsed.body[0].get_attrs();
|
||||
let fmt = format_from_annotations(attrs, Path::new("../foo.obj"), SourceRange::default())
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
@ -523,8 +525,8 @@ mod test {
|
||||
#[track_caller]
|
||||
fn assert_annotation_error(src: &str, path: &str, expected: &str) {
|
||||
let parsed = crate::Program::parse_no_errs(src).unwrap().ast;
|
||||
let non_code_meta = parsed.non_code_meta.get(0);
|
||||
let err = format_from_annotations(non_code_meta, Path::new(path), SourceRange::default()).unwrap_err();
|
||||
let attrs = parsed.body[0].get_attrs();
|
||||
let err = format_from_annotations(attrs, Path::new(path), SourceRange::default()).unwrap_err();
|
||||
assert!(
|
||||
err.message().contains(expected),
|
||||
"Expected: `{expected}`, found `{}`",
|
||||
|
||||
@ -8,14 +8,15 @@ use crate::{
|
||||
errors::KclErrorDetails,
|
||||
exec::Sketch,
|
||||
execution::{
|
||||
Face, Helix, ImportedGeometry, MemoryFunction, Metadata, Plane, SketchSet, Solid, SolidSet, TagIdentifier,
|
||||
ExecState, Face, Helix, ImportedGeometry, MemoryFunction, Metadata, Plane, SketchSet, Solid, SolidSet,
|
||||
TagIdentifier,
|
||||
},
|
||||
parsing::{
|
||||
ast::types::{FunctionExpression, KclNone, LiteralValue, TagDeclarator, TagNode},
|
||||
token::NumericSuffix,
|
||||
},
|
||||
std::{args::Arg, FnAsArg},
|
||||
ExecState, ExecutorContext, KclError, ModuleId, SourceRange,
|
||||
ExecutorContext, KclError, ModuleId, SourceRange,
|
||||
};
|
||||
|
||||
use super::memory::EnvironmentRef;
|
||||
|
||||
@ -156,18 +156,14 @@ pub(crate) const RETURN_NAME: &str = "__return";
|
||||
/// including other modules). Multiple interpretation runs should have fresh instances.
|
||||
///
|
||||
/// See module docs.
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, ts_rs::TS, JsonSchema)]
|
||||
#[ts(export)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ProgramMemory {
|
||||
#[derive(Debug, Clone)]
|
||||
pub(crate) struct ProgramMemory {
|
||||
environments: Vec<Environment>,
|
||||
/// Invariant: current_env.1.is_none()
|
||||
current_env: EnvironmentRef,
|
||||
/// Invariant: forall er in call_stack: er.1.is_none()
|
||||
call_stack: Vec<EnvironmentRef>,
|
||||
/// Statistics about the memory, should not be used for anything other than meta-info.
|
||||
#[allow(dead_code)]
|
||||
#[serde(skip)]
|
||||
pub(crate) stats: MemoryStats,
|
||||
}
|
||||
|
||||
@ -573,7 +569,7 @@ pub(crate) struct MemoryStats {
|
||||
mod env {
|
||||
use super::*;
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub(super) struct Environment {
|
||||
bindings: IndexMap<String, KclValue>,
|
||||
// invariant: self.parent.is_none() => forall s in self.snapshots: s.parent_snapshot.is_none()
|
||||
@ -603,7 +599,7 @@ mod env {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
struct Snapshot {
|
||||
/// The version of the owning environment's parent environment corresponding to this snapshot.
|
||||
parent_snapshot: Option<SnapshotRef>,
|
||||
|
||||
@ -39,7 +39,7 @@ pub(crate) use import::{
|
||||
import_foreign, send_to_engine as send_import_to_engine, PreImportedGeometry, ZOO_COORD_SYSTEM,
|
||||
};
|
||||
pub use kcl_value::{KclObjectFields, KclValue, UnitAngle, UnitLen};
|
||||
pub use memory::{EnvironmentRef, ProgramMemory};
|
||||
pub use memory::EnvironmentRef;
|
||||
pub use state::{ExecState, IdGenerator, MetaSettings};
|
||||
|
||||
pub(crate) mod annotations;
|
||||
@ -483,6 +483,11 @@ impl ExecutorContext {
|
||||
self.context_type == ContextType::Mock || self.context_type == ContextType::MockCustomForwarded
|
||||
}
|
||||
|
||||
/// Returns true if we should not send engine commands for any reason.
|
||||
pub fn no_engine_commands(&self) -> bool {
|
||||
self.is_mock() || self.engine.execution_kind().is_isolated()
|
||||
}
|
||||
|
||||
pub async fn send_clear_scene(
|
||||
&self,
|
||||
exec_state: &mut ExecState,
|
||||
@ -821,7 +826,7 @@ mod tests {
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use super::*;
|
||||
use crate::{errors::KclErrorDetails, ModuleId};
|
||||
use crate::{errors::KclErrorDetails, execution::memory::ProgramMemory, ModuleId};
|
||||
|
||||
/// Convenience function to get a JSON value from memory and unwrap.
|
||||
#[track_caller]
|
||||
@ -1235,7 +1240,7 @@ fn layer = () => {
|
||||
const x = 5
|
||||
|
||||
// The 10 layers are replicas of each other, with a transform applied to each.
|
||||
let shape = layer() |> patternTransform(10, transform, %)
|
||||
let shape = layer() |> patternTransform(instances = 10, transform = transform)
|
||||
"#;
|
||||
|
||||
let result = parse_execute(ast).await;
|
||||
|
||||
@ -8,25 +8,23 @@ use uuid::Uuid;
|
||||
use crate::{
|
||||
errors::{KclError, KclErrorDetails},
|
||||
execution::{
|
||||
annotations, kcl_value, Artifact, ArtifactCommand, ArtifactGraph, ArtifactId, ExecOutcome, ExecutorSettings,
|
||||
KclValue, Operation, ProgramMemory, UnitAngle, UnitLen,
|
||||
annotations, kcl_value, memory::ProgramMemory, Artifact, ArtifactCommand, ArtifactGraph, ArtifactId,
|
||||
ExecOutcome, ExecutorSettings, KclValue, Operation, UnitAngle, UnitLen,
|
||||
},
|
||||
modules::{ModuleId, ModuleInfo, ModuleLoader, ModulePath, ModuleRepr},
|
||||
parsing::ast::types::NonCodeValue,
|
||||
parsing::ast::types::Annotation,
|
||||
source_range::SourceRange,
|
||||
};
|
||||
|
||||
/// State for executing a program.
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ExecState {
|
||||
pub global: GlobalState,
|
||||
pub mod_local: ModuleState,
|
||||
pub(super) global: GlobalState,
|
||||
pub(super) mod_local: ModuleState,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct GlobalState {
|
||||
#[derive(Debug, Clone)]
|
||||
pub(super) struct GlobalState {
|
||||
/// Program variable bindings.
|
||||
pub memory: ProgramMemory,
|
||||
/// The stable artifact ID generator.
|
||||
@ -52,9 +50,8 @@ pub struct GlobalState {
|
||||
pub mod_loader: ModuleLoader,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ModuleState {
|
||||
#[derive(Debug, Clone)]
|
||||
pub(super) struct ModuleState {
|
||||
/// The current value of the pipe operator returned from the previous
|
||||
/// expression. If we're not currently in a pipeline, this will be None.
|
||||
pub pipe_value: Option<KclValue>,
|
||||
@ -125,19 +122,19 @@ impl ExecState {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn memory(&self) -> &ProgramMemory {
|
||||
pub(crate) fn memory(&self) -> &ProgramMemory {
|
||||
&self.global.memory
|
||||
}
|
||||
|
||||
pub fn mut_memory(&mut self) -> &mut ProgramMemory {
|
||||
pub(crate) fn mut_memory(&mut self) -> &mut ProgramMemory {
|
||||
&mut self.global.memory
|
||||
}
|
||||
|
||||
pub fn next_uuid(&mut self) -> Uuid {
|
||||
pub(crate) fn next_uuid(&mut self) -> Uuid {
|
||||
self.global.id_generator.next_uuid()
|
||||
}
|
||||
|
||||
pub fn add_artifact(&mut self, artifact: Artifact) {
|
||||
pub(crate) fn add_artifact(&mut self, artifact: Artifact) {
|
||||
let id = artifact.id();
|
||||
self.global.artifacts.insert(id, artifact);
|
||||
}
|
||||
@ -239,21 +236,20 @@ pub struct MetaSettings {
|
||||
impl MetaSettings {
|
||||
pub(crate) fn update_from_annotation(
|
||||
&mut self,
|
||||
annotation: &NonCodeValue,
|
||||
source_range: SourceRange,
|
||||
annotation: &crate::parsing::ast::types::Node<Annotation>,
|
||||
) -> Result<(), KclError> {
|
||||
let properties = annotations::expect_properties(annotations::SETTINGS, annotation, source_range)?;
|
||||
let properties = annotations::expect_properties(annotations::SETTINGS, annotation)?;
|
||||
|
||||
for p in properties {
|
||||
match &*p.inner.key.name {
|
||||
annotations::SETTINGS_UNIT_LENGTH => {
|
||||
let value = annotations::expect_ident(&p.inner.value)?;
|
||||
let value = kcl_value::UnitLen::from_str(value, source_range)?;
|
||||
let value = kcl_value::UnitLen::from_str(value, annotation.as_source_range())?;
|
||||
self.default_length_units = value;
|
||||
}
|
||||
annotations::SETTINGS_UNIT_ANGLE => {
|
||||
let value = annotations::expect_ident(&p.inner.value)?;
|
||||
let value = kcl_value::UnitAngle::from_str(value, source_range)?;
|
||||
let value = kcl_value::UnitAngle::from_str(value, annotation.as_source_range())?;
|
||||
self.default_angle_units = value;
|
||||
}
|
||||
name => {
|
||||
@ -263,7 +259,7 @@ impl MetaSettings {
|
||||
annotations::SETTINGS_UNIT_LENGTH,
|
||||
annotations::SETTINGS_UNIT_ANGLE
|
||||
),
|
||||
source_ranges: vec![source_range],
|
||||
source_ranges: vec![annotation.as_source_range()],
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
@ -98,9 +98,7 @@ pub use source_range::SourceRange;
|
||||
// Rather than make executor public and make lots of it pub(crate), just re-export into a new module.
|
||||
// Ideally we wouldn't export these things at all, they should only be used for testing.
|
||||
pub mod exec {
|
||||
pub use crate::execution::{
|
||||
ArtifactCommand, DefaultPlanes, IdGenerator, KclValue, PlaneType, ProgramMemory, Sketch,
|
||||
};
|
||||
pub use crate::execution::{ArtifactCommand, DefaultPlanes, IdGenerator, KclValue, PlaneType, Sketch};
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
@ -238,6 +236,11 @@ fn try_f64_to_i64(f: f64) -> Option<i64> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the version of the KCL library.
|
||||
pub fn version() -> &'static str {
|
||||
env!("CARGO_PKG_VERSION")
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
|
||||
@ -33,9 +33,8 @@ impl ModuleId {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, Default)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ModuleLoader {
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub(crate) struct ModuleLoader {
|
||||
/// The stack of import statements for detecting circular module imports.
|
||||
/// If this is empty, we're not currently executing an import statement.
|
||||
pub import_stack: Vec<PathBuf>,
|
||||
|
||||
@ -1,13 +1,10 @@
|
||||
use sha2::{Digest as DigestTrait, Sha256};
|
||||
|
||||
use super::types::{
|
||||
DefaultParamVal, ItemVisibility, LabelledExpression, LiteralValue, NonCodeMeta, NonCodeNode, NonCodeValue,
|
||||
VariableKind,
|
||||
};
|
||||
use super::types::{DefaultParamVal, ItemVisibility, LabelledExpression, LiteralValue, VariableKind};
|
||||
use crate::parsing::ast::types::{
|
||||
ArrayExpression, ArrayRangeExpression, BinaryExpression, BinaryPart, BodyItem, CallExpression, CallExpressionKw,
|
||||
ElseIf, Expr, ExpressionStatement, FnArgType, FunctionExpression, Identifier, IfExpression, ImportItem,
|
||||
ImportSelector, ImportStatement, KclNone, Literal, LiteralIdentifier, MemberExpression, MemberObject,
|
||||
Annotation, ArrayExpression, ArrayRangeExpression, BinaryExpression, BinaryPart, BodyItem, CallExpression,
|
||||
CallExpressionKw, ElseIf, Expr, ExpressionStatement, FnArgType, FunctionExpression, Identifier, IfExpression,
|
||||
ImportItem, ImportSelector, ImportStatement, KclNone, Literal, LiteralIdentifier, MemberExpression, MemberObject,
|
||||
ObjectExpression, ObjectProperty, Parameter, PipeExpression, PipeSubstitution, Program, ReturnStatement,
|
||||
TagDeclarator, UnaryExpression, VariableDeclaration, VariableDeclarator,
|
||||
};
|
||||
@ -82,57 +79,28 @@ impl Program {
|
||||
for body_item in slf.body.iter_mut() {
|
||||
hasher.update(body_item.compute_digest());
|
||||
}
|
||||
// This contains settings annotations.
|
||||
hasher.update(slf.non_code_meta.compute_digest());
|
||||
for attr in &mut slf.inner_attrs {
|
||||
hasher.update(attr.compute_digest());
|
||||
}
|
||||
if let Some(shebang) = &slf.shebang {
|
||||
hasher.update(&shebang.inner.content);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
impl NonCodeMeta {
|
||||
compute_digest!(|slf, hasher| {
|
||||
for non_code_node in slf.start_nodes.iter_mut() {
|
||||
hasher.update(non_code_node.compute_digest());
|
||||
}
|
||||
for (_, non_code_nodes) in slf.non_code_nodes.iter_mut() {
|
||||
for non_code_node in non_code_nodes.iter_mut() {
|
||||
hasher.update(non_code_node.compute_digest());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
impl NonCodeNode {
|
||||
compute_digest!(|slf, hasher| {
|
||||
hasher.update(slf.value.compute_digest());
|
||||
});
|
||||
}
|
||||
|
||||
impl NonCodeValue {
|
||||
impl Annotation {
|
||||
pub fn compute_digest(&mut self) -> Digest {
|
||||
let mut hasher = Sha256::new();
|
||||
match self {
|
||||
NonCodeValue::InlineComment { .. } => {}
|
||||
NonCodeValue::BlockComment { .. } => {}
|
||||
NonCodeValue::NewLineBlockComment { .. } => {}
|
||||
NonCodeValue::NewLine => {}
|
||||
NonCodeValue::Annotation {
|
||||
ref mut name,
|
||||
properties,
|
||||
} => {
|
||||
if let Some(name) = name {
|
||||
hasher.update(name.compute_digest());
|
||||
}
|
||||
if let Some(properties) = properties {
|
||||
hasher.update(properties.len().to_ne_bytes());
|
||||
for property in properties.iter_mut() {
|
||||
hasher.update(property.compute_digest());
|
||||
}
|
||||
} else {
|
||||
hasher.update("no_properties");
|
||||
}
|
||||
if let Some(name) = &mut self.name {
|
||||
hasher.update(name.compute_digest());
|
||||
}
|
||||
if let Some(properties) = &mut self.properties {
|
||||
hasher.update(properties.len().to_ne_bytes());
|
||||
for property in properties.iter_mut() {
|
||||
hasher.update(property.compute_digest());
|
||||
}
|
||||
} else {
|
||||
hasher.update("no_properties");
|
||||
}
|
||||
hasher.finalize().into()
|
||||
}
|
||||
@ -140,12 +108,18 @@ impl NonCodeValue {
|
||||
|
||||
impl BodyItem {
|
||||
pub fn compute_digest(&mut self) -> Digest {
|
||||
match self {
|
||||
let mut hasher = Sha256::new();
|
||||
hasher.update(match self {
|
||||
BodyItem::ImportStatement(s) => s.compute_digest(),
|
||||
BodyItem::ExpressionStatement(es) => es.compute_digest(),
|
||||
BodyItem::VariableDeclaration(vs) => vs.compute_digest(),
|
||||
BodyItem::ReturnStatement(rs) => rs.compute_digest(),
|
||||
});
|
||||
|
||||
for a in self.get_attrs_mut() {
|
||||
hasher.update(a.compute_digest());
|
||||
}
|
||||
hasher.finalize().into()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -52,7 +52,7 @@ pub struct Node<T> {
|
||||
#[serde(default, skip_serializing_if = "ModuleId::is_top_level")]
|
||||
pub module_id: ModuleId,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub trivia: NodeList<NonCodeNode>,
|
||||
pub outer_attrs: NodeList<Annotation>,
|
||||
}
|
||||
|
||||
impl<T> Node<T> {
|
||||
@ -96,7 +96,7 @@ impl<T> Node<T> {
|
||||
start,
|
||||
end,
|
||||
module_id,
|
||||
trivia: Vec::new(),
|
||||
outer_attrs: Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,7 +106,7 @@ impl<T> Node<T> {
|
||||
start: 0,
|
||||
end: 0,
|
||||
module_id: ModuleId::default(),
|
||||
trivia: Vec::new(),
|
||||
outer_attrs: Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ impl<T> Node<T> {
|
||||
start,
|
||||
end,
|
||||
module_id,
|
||||
trivia: Vec::new(),
|
||||
outer_attrs: Vec::new(),
|
||||
})
|
||||
}
|
||||
|
||||
@ -181,6 +181,8 @@ pub struct Program {
|
||||
pub non_code_meta: NonCodeMeta,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub shebang: Option<Node<Shebang>>,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub inner_attrs: NodeList<Annotation>,
|
||||
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
@ -261,28 +263,12 @@ impl Node<Program> {
|
||||
Ok(findings)
|
||||
}
|
||||
|
||||
pub fn annotations(&self) -> impl Iterator<Item = &Node<NonCodeNode>> {
|
||||
self.non_code_meta
|
||||
.start_nodes
|
||||
.iter()
|
||||
.filter(|n| n.value_is_annotation())
|
||||
}
|
||||
|
||||
pub fn annotations_mut(&mut self) -> impl Iterator<Item = &mut Node<NonCodeNode>> {
|
||||
self.non_code_meta
|
||||
.start_nodes
|
||||
.iter_mut()
|
||||
.filter(|n| n.value_is_annotation())
|
||||
}
|
||||
|
||||
/// Get the annotations for the meta settings from the kcl file.
|
||||
pub fn meta_settings(&self) -> Result<Option<crate::execution::MetaSettings>, KclError> {
|
||||
for annotation_node in self.annotations() {
|
||||
let annotation = &annotation_node.value;
|
||||
if annotation.annotation_name() == Some(annotations::SETTINGS) {
|
||||
let source_range = annotation_node.as_source_range();
|
||||
for annotation in &self.inner_attrs {
|
||||
if annotation.name() == Some(annotations::SETTINGS) {
|
||||
let mut meta_settings = crate::execution::MetaSettings::default();
|
||||
meta_settings.update_from_annotation(annotation, source_range)?;
|
||||
meta_settings.update_from_annotation(annotation)?;
|
||||
return Ok(Some(meta_settings));
|
||||
}
|
||||
}
|
||||
@ -293,24 +279,18 @@ impl Node<Program> {
|
||||
pub fn change_meta_settings(&mut self, settings: crate::execution::MetaSettings) -> Result<Self, KclError> {
|
||||
let mut new_program = self.clone();
|
||||
let mut found = false;
|
||||
for node in new_program.annotations_mut() {
|
||||
if node.value.annotation_name() == Some(annotations::SETTINGS) {
|
||||
let annotation = NonCodeValue::new_from_meta_settings(&settings);
|
||||
*node = Node::no_src(NonCodeNode {
|
||||
value: annotation,
|
||||
digest: None,
|
||||
});
|
||||
for node in &mut new_program.inner_attrs {
|
||||
if node.name() == Some(annotations::SETTINGS) {
|
||||
*node = Node::no_src(Annotation::new_from_meta_settings(&settings));
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if !found {
|
||||
let annotation = NonCodeValue::new_from_meta_settings(&settings);
|
||||
new_program.non_code_meta.start_nodes.push(Node::no_src(NonCodeNode {
|
||||
value: annotation,
|
||||
digest: None,
|
||||
}));
|
||||
new_program
|
||||
.inner_attrs
|
||||
.push(Node::no_src(Annotation::new_from_meta_settings(&settings)));
|
||||
}
|
||||
|
||||
Ok(new_program)
|
||||
@ -318,6 +298,10 @@ impl Node<Program> {
|
||||
}
|
||||
|
||||
impl Program {
|
||||
#[cfg(test)]
|
||||
pub fn empty() -> Node<Self> {
|
||||
Node::no_src(Program::default())
|
||||
}
|
||||
/// Is the last body item an expression?
|
||||
pub fn ends_with_expr(&self) -> bool {
|
||||
let Some(ref last) = self.body.last() else {
|
||||
@ -629,6 +613,33 @@ impl BodyItem {
|
||||
BodyItem::ReturnStatement(return_statement) => return_statement.end,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn set_attrs(&mut self, attr: NodeList<Annotation>) {
|
||||
match self {
|
||||
BodyItem::ImportStatement(node) => node.outer_attrs = attr,
|
||||
BodyItem::ExpressionStatement(node) => node.outer_attrs = attr,
|
||||
BodyItem::VariableDeclaration(node) => node.outer_attrs = attr,
|
||||
BodyItem::ReturnStatement(node) => node.outer_attrs = attr,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn get_attrs(&self) -> &[Node<Annotation>] {
|
||||
match self {
|
||||
BodyItem::ImportStatement(node) => &node.outer_attrs,
|
||||
BodyItem::ExpressionStatement(node) => &node.outer_attrs,
|
||||
BodyItem::VariableDeclaration(node) => &node.outer_attrs,
|
||||
BodyItem::ReturnStatement(node) => &node.outer_attrs,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn get_attrs_mut(&mut self) -> &mut [Node<Annotation>] {
|
||||
match self {
|
||||
BodyItem::ImportStatement(node) => &mut node.outer_attrs,
|
||||
BodyItem::ExpressionStatement(node) => &mut node.outer_attrs,
|
||||
BodyItem::VariableDeclaration(node) => &mut node.outer_attrs,
|
||||
BodyItem::ReturnStatement(node) => &mut node.outer_attrs,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<BodyItem> for SourceRange {
|
||||
@ -1134,24 +1145,6 @@ impl NonCodeNode {
|
||||
NonCodeValue::BlockComment { value, style: _ } => value.clone(),
|
||||
NonCodeValue::NewLineBlockComment { value, style: _ } => value.clone(),
|
||||
NonCodeValue::NewLine => "\n\n".to_string(),
|
||||
n @ NonCodeValue::Annotation { .. } => n.annotation_name().unwrap_or("").to_owned(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn annotation(&self) -> Option<&NonCodeValue> {
|
||||
match &self.value {
|
||||
a @ NonCodeValue::Annotation { .. } => Some(a),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn value_is_annotation(&self) -> bool {
|
||||
match self.value {
|
||||
NonCodeValue::InlineComment { .. }
|
||||
| NonCodeValue::BlockComment { .. }
|
||||
| NonCodeValue::NewLineBlockComment { .. }
|
||||
| NonCodeValue::NewLine => false,
|
||||
NonCodeValue::Annotation { .. } => true,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1202,37 +1195,6 @@ pub enum NonCodeValue {
|
||||
// A new line like `\n\n` NOT a new line like `\n`.
|
||||
// This is also not a comment.
|
||||
NewLine,
|
||||
Annotation {
|
||||
name: Option<Node<Identifier>>,
|
||||
properties: Option<Vec<Node<ObjectProperty>>>,
|
||||
},
|
||||
}
|
||||
|
||||
impl NonCodeValue {
|
||||
pub fn annotation_name(&self) -> Option<&str> {
|
||||
match self {
|
||||
NonCodeValue::Annotation { name, .. } => name.as_ref().map(|i| &*i.name),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_from_meta_settings(settings: &crate::execution::MetaSettings) -> NonCodeValue {
|
||||
let mut properties: Vec<Node<ObjectProperty>> = vec![ObjectProperty::new(
|
||||
Identifier::new(annotations::SETTINGS_UNIT_LENGTH),
|
||||
Expr::Identifier(Box::new(Identifier::new(&settings.default_length_units.to_string()))),
|
||||
)];
|
||||
|
||||
if settings.default_angle_units != Default::default() {
|
||||
properties.push(ObjectProperty::new(
|
||||
Identifier::new(annotations::SETTINGS_UNIT_ANGLE),
|
||||
Expr::Identifier(Box::new(Identifier::new(&settings.default_angle_units.to_string()))),
|
||||
));
|
||||
}
|
||||
NonCodeValue::Annotation {
|
||||
name: Some(Identifier::new(annotations::SETTINGS)),
|
||||
properties: Some(properties),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Clone, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
||||
@ -1314,6 +1276,47 @@ impl<'de> Deserialize<'de> for NonCodeMeta {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
||||
#[ts(export)]
|
||||
#[serde(tag = "type")]
|
||||
pub struct Annotation {
|
||||
pub name: Option<Node<Identifier>>,
|
||||
pub properties: Option<Vec<Node<ObjectProperty>>>,
|
||||
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub digest: Option<Digest>,
|
||||
}
|
||||
|
||||
impl Annotation {
|
||||
pub fn is_inner(&self) -> bool {
|
||||
self.name.is_some()
|
||||
}
|
||||
|
||||
pub fn name(&self) -> Option<&str> {
|
||||
self.name.as_ref().map(|n| &*n.name)
|
||||
}
|
||||
|
||||
pub fn new_from_meta_settings(settings: &crate::execution::MetaSettings) -> Annotation {
|
||||
let mut properties: Vec<Node<ObjectProperty>> = vec![ObjectProperty::new(
|
||||
Identifier::new(annotations::SETTINGS_UNIT_LENGTH),
|
||||
Expr::Identifier(Box::new(Identifier::new(&settings.default_length_units.to_string()))),
|
||||
)];
|
||||
|
||||
if settings.default_angle_units != Default::default() {
|
||||
properties.push(ObjectProperty::new(
|
||||
Identifier::new(annotations::SETTINGS_UNIT_ANGLE),
|
||||
Expr::Identifier(Box::new(Identifier::new(&settings.default_angle_units.to_string()))),
|
||||
));
|
||||
}
|
||||
Annotation {
|
||||
name: Some(Identifier::new(annotations::SETTINGS)),
|
||||
properties: Some(properties),
|
||||
digest: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
||||
#[ts(export)]
|
||||
#[serde(tag = "type")]
|
||||
@ -3823,12 +3826,7 @@ const cylinder = startSketchOn('-XZ')
|
||||
(0..=0),
|
||||
Node::no_src(FunctionExpression {
|
||||
params: vec![],
|
||||
body: Node::no_src(Program {
|
||||
body: Vec::new(),
|
||||
non_code_meta: Default::default(),
|
||||
shebang: None,
|
||||
digest: None,
|
||||
}),
|
||||
body: Program::empty(),
|
||||
return_type: None,
|
||||
digest: None,
|
||||
}),
|
||||
@ -3847,18 +3845,7 @@ const cylinder = startSketchOn('-XZ')
|
||||
labeled: true,
|
||||
digest: None,
|
||||
}],
|
||||
body: Node {
|
||||
inner: Program {
|
||||
body: Vec::new(),
|
||||
non_code_meta: Default::default(),
|
||||
shebang: None,
|
||||
digest: None,
|
||||
},
|
||||
start: 0,
|
||||
end: 0,
|
||||
module_id: ModuleId::default(),
|
||||
trivia: Vec::new(),
|
||||
},
|
||||
body: Program::empty(),
|
||||
return_type: None,
|
||||
digest: None,
|
||||
}),
|
||||
@ -3877,18 +3864,7 @@ const cylinder = startSketchOn('-XZ')
|
||||
labeled: true,
|
||||
digest: None,
|
||||
}],
|
||||
body: Node {
|
||||
inner: Program {
|
||||
body: Vec::new(),
|
||||
non_code_meta: Default::default(),
|
||||
shebang: None,
|
||||
digest: None,
|
||||
},
|
||||
start: 0,
|
||||
end: 0,
|
||||
module_id: ModuleId::default(),
|
||||
trivia: Vec::new(),
|
||||
},
|
||||
body: Program::empty(),
|
||||
return_type: None,
|
||||
digest: None,
|
||||
}),
|
||||
@ -3919,18 +3895,7 @@ const cylinder = startSketchOn('-XZ')
|
||||
digest: None,
|
||||
},
|
||||
],
|
||||
body: Node {
|
||||
inner: Program {
|
||||
body: Vec::new(),
|
||||
non_code_meta: Default::default(),
|
||||
shebang: None,
|
||||
digest: None,
|
||||
},
|
||||
start: 0,
|
||||
end: 0,
|
||||
module_id: ModuleId::default(),
|
||||
trivia: Vec::new(),
|
||||
},
|
||||
body: Program::empty(),
|
||||
return_type: None,
|
||||
digest: None,
|
||||
}),
|
||||
|
||||
@ -21,13 +21,13 @@ use crate::{
|
||||
errors::{CompilationError, Severity, Tag},
|
||||
parsing::{
|
||||
ast::types::{
|
||||
ArrayExpression, ArrayRangeExpression, BinaryExpression, BinaryOperator, BinaryPart, BodyItem, BoxNode,
|
||||
CallExpression, CallExpressionKw, CommentStyle, DefaultParamVal, ElseIf, Expr, ExpressionStatement,
|
||||
FnArgPrimitive, FnArgType, FunctionExpression, Identifier, IfExpression, ImportItem, ImportSelector,
|
||||
ImportStatement, ItemVisibility, LabeledArg, Literal, LiteralIdentifier, LiteralValue, MemberExpression,
|
||||
MemberObject, Node, NodeList, NonCodeMeta, NonCodeNode, NonCodeValue, ObjectExpression, ObjectProperty,
|
||||
Parameter, PipeExpression, PipeSubstitution, Program, ReturnStatement, Shebang, TagDeclarator,
|
||||
UnaryExpression, UnaryOperator, VariableDeclaration, VariableDeclarator, VariableKind,
|
||||
Annotation, ArrayExpression, ArrayRangeExpression, BinaryExpression, BinaryOperator, BinaryPart, BodyItem,
|
||||
BoxNode, CallExpression, CallExpressionKw, CommentStyle, DefaultParamVal, ElseIf, Expr,
|
||||
ExpressionStatement, FnArgPrimitive, FnArgType, FunctionExpression, Identifier, IfExpression, ImportItem,
|
||||
ImportSelector, ImportStatement, ItemVisibility, LabeledArg, Literal, LiteralIdentifier, LiteralValue,
|
||||
MemberExpression, MemberObject, Node, NodeList, NonCodeMeta, NonCodeNode, NonCodeValue, ObjectExpression,
|
||||
ObjectProperty, Parameter, PipeExpression, PipeSubstitution, Program, ReturnStatement, Shebang,
|
||||
TagDeclarator, UnaryExpression, UnaryOperator, VariableDeclaration, VariableDeclarator, VariableKind,
|
||||
},
|
||||
math::BinaryExpressionToken,
|
||||
token::{Token, TokenSlice, TokenType},
|
||||
@ -284,7 +284,7 @@ fn non_code_node(i: &mut TokenSlice) -> PResult<Node<NonCodeNode>> {
|
||||
alt((non_code_node_leading_whitespace, non_code_node_no_leading_whitespace)).parse_next(i)
|
||||
}
|
||||
|
||||
fn annotation(i: &mut TokenSlice) -> PResult<Node<NonCodeNode>> {
|
||||
fn annotation(i: &mut TokenSlice) -> PResult<Node<Annotation>> {
|
||||
let at = at_sign.parse_next(i)?;
|
||||
let name = opt(binding_name).parse_next(i)?;
|
||||
let mut end = name.as_ref().map(|n| n.end).unwrap_or(at.end);
|
||||
@ -308,7 +308,7 @@ fn annotation(i: &mut TokenSlice) -> PResult<Node<NonCodeNode>> {
|
||||
value,
|
||||
digest: None,
|
||||
},
|
||||
trivia: Vec::new(),
|
||||
outer_attrs: Vec::new(),
|
||||
}),
|
||||
comma_sep,
|
||||
)
|
||||
@ -327,50 +327,46 @@ fn annotation(i: &mut TokenSlice) -> PResult<Node<NonCodeNode>> {
|
||||
));
|
||||
}
|
||||
|
||||
let value = NonCodeValue::Annotation { name, properties };
|
||||
Ok(Node::new(
|
||||
NonCodeNode { value, digest: None },
|
||||
at.start,
|
||||
end,
|
||||
at.module_id,
|
||||
))
|
||||
let value = Annotation {
|
||||
name,
|
||||
properties,
|
||||
digest: None,
|
||||
};
|
||||
Ok(Node::new(value, at.start, end, at.module_id))
|
||||
}
|
||||
|
||||
// Matches remaining three cases of NonCodeValue
|
||||
fn non_code_node_no_leading_whitespace(i: &mut TokenSlice) -> PResult<Node<NonCodeNode>> {
|
||||
alt((
|
||||
annotation,
|
||||
any.verify_map(|token: Token| {
|
||||
if token.is_code_token() {
|
||||
None
|
||||
} else {
|
||||
let value = match token.token_type {
|
||||
TokenType::Whitespace if token.value.contains("\n\n") => NonCodeValue::NewLine,
|
||||
TokenType::LineComment => NonCodeValue::BlockComment {
|
||||
value: token.value.trim_start_matches("//").trim().to_owned(),
|
||||
style: CommentStyle::Line,
|
||||
},
|
||||
TokenType::BlockComment => NonCodeValue::BlockComment {
|
||||
style: CommentStyle::Block,
|
||||
value: token
|
||||
.value
|
||||
.trim_start_matches("/*")
|
||||
.trim_end_matches("*/")
|
||||
.trim()
|
||||
.to_owned(),
|
||||
},
|
||||
_ => return None,
|
||||
};
|
||||
Some(Node::new(
|
||||
NonCodeNode { value, digest: None },
|
||||
token.start,
|
||||
token.end,
|
||||
token.module_id,
|
||||
))
|
||||
}
|
||||
})
|
||||
.context(expected("Non-code token (comments or whitespace)")),
|
||||
))
|
||||
any.verify_map(|token: Token| {
|
||||
if token.is_code_token() {
|
||||
None
|
||||
} else {
|
||||
let value = match token.token_type {
|
||||
TokenType::Whitespace if token.value.contains("\n\n") => NonCodeValue::NewLine,
|
||||
TokenType::LineComment => NonCodeValue::BlockComment {
|
||||
value: token.value.trim_start_matches("//").trim().to_owned(),
|
||||
style: CommentStyle::Line,
|
||||
},
|
||||
TokenType::BlockComment => NonCodeValue::BlockComment {
|
||||
style: CommentStyle::Block,
|
||||
value: token
|
||||
.value
|
||||
.trim_start_matches("/*")
|
||||
.trim_end_matches("*/")
|
||||
.trim()
|
||||
.to_owned(),
|
||||
},
|
||||
_ => return None,
|
||||
};
|
||||
Some(Node::new(
|
||||
NonCodeNode { value, digest: None },
|
||||
token.start,
|
||||
token.end,
|
||||
token.module_id,
|
||||
))
|
||||
}
|
||||
})
|
||||
.context(expected("Non-code token (comments or whitespace)"))
|
||||
.parse_next(i)
|
||||
}
|
||||
|
||||
@ -427,7 +423,7 @@ fn pipe_expression(i: &mut TokenSlice) -> PResult<Node<PipeExpression>> {
|
||||
non_code_meta,
|
||||
digest: None,
|
||||
},
|
||||
trivia: Vec::new(),
|
||||
outer_attrs: Vec::new(),
|
||||
})
|
||||
}
|
||||
|
||||
@ -830,7 +826,7 @@ fn object_property_same_key_and_val(i: &mut TokenSlice) -> PResult<Node<ObjectPr
|
||||
key,
|
||||
digest: None,
|
||||
},
|
||||
trivia: Vec::new(),
|
||||
outer_attrs: Vec::new(),
|
||||
})
|
||||
}
|
||||
|
||||
@ -859,7 +855,7 @@ fn object_property(i: &mut TokenSlice) -> PResult<Node<ObjectProperty>> {
|
||||
value: expr,
|
||||
digest: None,
|
||||
},
|
||||
trivia: Vec::new(),
|
||||
outer_attrs: Vec::new(),
|
||||
};
|
||||
|
||||
if sep.token_type == TokenType::Colon {
|
||||
@ -1131,17 +1127,7 @@ fn function_decl(i: &mut TokenSlice) -> PResult<(Node<FunctionExpression>, bool)
|
||||
let close: Option<(Vec<Vec<Token>>, Token)> = opt((repeat(0.., whitespace), close_brace)).parse_next(i)?;
|
||||
let (body, end) = match close {
|
||||
Some((_, end)) => (
|
||||
Node::new(
|
||||
Program {
|
||||
body: Vec::new(),
|
||||
non_code_meta: NonCodeMeta::default(),
|
||||
shebang: None,
|
||||
digest: None,
|
||||
},
|
||||
brace.end,
|
||||
brace.end,
|
||||
brace.module_id,
|
||||
),
|
||||
Node::new(Program::default(), brace.end, brace.end, brace.module_id),
|
||||
end.end,
|
||||
),
|
||||
None => (function_body(i)?, close_brace(i)?.end),
|
||||
@ -1277,7 +1263,6 @@ fn noncode_just_after_code(i: &mut TokenSlice) -> PResult<Node<NonCodeNode>> {
|
||||
x @ NonCodeValue::InlineComment { .. } => x,
|
||||
x @ NonCodeValue::NewLineBlockComment { .. } => x,
|
||||
x @ NonCodeValue::NewLine => x,
|
||||
x @ NonCodeValue::Annotation { .. } => x,
|
||||
};
|
||||
Node::new(
|
||||
NonCodeNode { value, ..nc.inner },
|
||||
@ -1298,7 +1283,6 @@ fn noncode_just_after_code(i: &mut TokenSlice) -> PResult<Node<NonCodeNode>> {
|
||||
x @ NonCodeValue::InlineComment { .. } => x,
|
||||
x @ NonCodeValue::NewLineBlockComment { .. } => x,
|
||||
x @ NonCodeValue::NewLine => x,
|
||||
x @ NonCodeValue::Annotation { .. } => x,
|
||||
};
|
||||
Node::new(NonCodeNode { value, ..nc.inner }, nc.start, nc.end, nc.module_id)
|
||||
}
|
||||
@ -1314,6 +1298,7 @@ fn noncode_just_after_code(i: &mut TokenSlice) -> PResult<Node<NonCodeNode>> {
|
||||
#[derive(Debug)]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
enum WithinFunction {
|
||||
Annotation(Node<Annotation>),
|
||||
BodyItem((BodyItem, Option<Node<NonCodeNode>>)),
|
||||
NonCode(Node<NonCodeNode>),
|
||||
}
|
||||
@ -1338,9 +1323,12 @@ fn body_items_within_function(i: &mut TokenSlice) -> PResult<WithinFunction> {
|
||||
(import_stmt.map(BodyItem::ImportStatement), opt(noncode_just_after_code)).map(WithinFunction::BodyItem),
|
||||
Token { ref value, .. } if value == "return" =>
|
||||
(return_stmt.map(BodyItem::ReturnStatement), opt(noncode_just_after_code)).map(WithinFunction::BodyItem),
|
||||
token if !token.is_code_token() || token.token_type == TokenType::At => {
|
||||
token if !token.is_code_token() => {
|
||||
non_code_node.map(WithinFunction::NonCode)
|
||||
},
|
||||
token if token.token_type == TokenType::At => {
|
||||
annotation.map(WithinFunction::Annotation)
|
||||
},
|
||||
_ =>
|
||||
alt((
|
||||
(
|
||||
@ -1447,16 +1435,32 @@ fn function_body(i: &mut TokenSlice) -> PResult<Node<Program>> {
|
||||
}
|
||||
|
||||
let mut body = Vec::new();
|
||||
let mut inner_attrs = Vec::new();
|
||||
let mut pending_attrs = Vec::new();
|
||||
let mut non_code_meta = NonCodeMeta::default();
|
||||
let mut end = 0;
|
||||
let mut start = leading_whitespace_start;
|
||||
for thing_in_body in things_within_body {
|
||||
match thing_in_body {
|
||||
WithinFunction::BodyItem((b, maybe_noncode)) => {
|
||||
WithinFunction::Annotation(attr) => {
|
||||
if start.is_none() {
|
||||
start = Some((attr.start, attr.module_id))
|
||||
}
|
||||
if attr.is_inner() {
|
||||
inner_attrs.push(attr);
|
||||
} else {
|
||||
pending_attrs.push(attr);
|
||||
}
|
||||
}
|
||||
WithinFunction::BodyItem((mut b, maybe_noncode)) => {
|
||||
if start.is_none() {
|
||||
start = Some((b.start(), b.module_id()));
|
||||
}
|
||||
end = b.end();
|
||||
if !pending_attrs.is_empty() {
|
||||
b.set_attrs(pending_attrs);
|
||||
pending_attrs = Vec::new();
|
||||
}
|
||||
body.push(b);
|
||||
if let Some(nc) = maybe_noncode {
|
||||
end = nc.end;
|
||||
@ -1476,9 +1480,26 @@ fn function_body(i: &mut TokenSlice) -> PResult<Node<Program>> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let start = start.expect(
|
||||
"the `things_within_body` vec should have looped at least once, and each loop overwrites `start` if it is None",
|
||||
);
|
||||
|
||||
if !pending_attrs.is_empty() {
|
||||
for a in pending_attrs {
|
||||
ParseContext::err(CompilationError::err(
|
||||
a.as_source_range(),
|
||||
"Attribute is not attached to any item",
|
||||
));
|
||||
}
|
||||
return Err(ErrMode::Cut(
|
||||
CompilationError::fatal(
|
||||
SourceRange::new(start.0, end, start.1),
|
||||
"Block contains un-attached attributes",
|
||||
)
|
||||
.into(),
|
||||
));
|
||||
}
|
||||
// Safe to unwrap `body.first()` because `body` is `separated1` therefore guaranteed
|
||||
// to have len >= 1.
|
||||
let end_ws = opt(whitespace)
|
||||
@ -1492,6 +1513,7 @@ fn function_body(i: &mut TokenSlice) -> PResult<Node<Program>> {
|
||||
Program {
|
||||
body,
|
||||
non_code_meta,
|
||||
inner_attrs,
|
||||
shebang: None,
|
||||
digest: None,
|
||||
},
|
||||
@ -1790,7 +1812,7 @@ fn return_stmt(i: &mut TokenSlice) -> PResult<Node<ReturnStatement>> {
|
||||
end: argument.end(),
|
||||
module_id: ret.module_id,
|
||||
inner: ReturnStatement { argument, digest: None },
|
||||
trivia: Vec::new(),
|
||||
outer_attrs: Vec::new(),
|
||||
})
|
||||
}
|
||||
|
||||
@ -2017,13 +2039,13 @@ fn declaration(i: &mut TokenSlice) -> PResult<BoxNode<VariableDeclaration>> {
|
||||
init: val,
|
||||
digest: None,
|
||||
},
|
||||
trivia: Vec::new(),
|
||||
outer_attrs: Vec::new(),
|
||||
},
|
||||
visibility,
|
||||
kind,
|
||||
digest: None,
|
||||
},
|
||||
trivia: Vec::new(),
|
||||
outer_attrs: Vec::new(),
|
||||
}))
|
||||
}
|
||||
|
||||
@ -2229,7 +2251,7 @@ fn unary_expression(i: &mut TokenSlice) -> PResult<Node<UnaryExpression>> {
|
||||
argument,
|
||||
digest: None,
|
||||
},
|
||||
trivia: Vec::new(),
|
||||
outer_attrs: Vec::new(),
|
||||
})
|
||||
}
|
||||
|
||||
@ -2310,7 +2332,7 @@ fn expression_stmt(i: &mut TokenSlice) -> PResult<Node<ExpressionStatement>> {
|
||||
expression: val,
|
||||
digest: None,
|
||||
},
|
||||
trivia: Vec::new(),
|
||||
outer_attrs: Vec::new(),
|
||||
})
|
||||
}
|
||||
|
||||
@ -2750,7 +2772,7 @@ fn fn_call(i: &mut TokenSlice) -> PResult<Node<CallExpression>> {
|
||||
arguments: args,
|
||||
digest: None,
|
||||
},
|
||||
trivia: Vec::new(),
|
||||
outer_attrs: Vec::new(),
|
||||
})
|
||||
}
|
||||
|
||||
@ -2780,7 +2802,7 @@ fn fn_call_kw(i: &mut TokenSlice) -> PResult<Node<CallExpressionKw>> {
|
||||
arguments: args,
|
||||
digest: None,
|
||||
},
|
||||
trivia: Vec::new(),
|
||||
outer_attrs: Vec::new(),
|
||||
})
|
||||
}
|
||||
|
||||
@ -3023,6 +3045,7 @@ mySk1 = startSketchAt([0, 0])"#;
|
||||
)],
|
||||
digest: None,
|
||||
},
|
||||
inner_attrs: Vec::new(),
|
||||
shebang: None,
|
||||
digest: None,
|
||||
},
|
||||
@ -3700,6 +3723,7 @@ mySk1 = startSketchAt([0, 0])"#;
|
||||
))],
|
||||
shebang: None,
|
||||
non_code_meta: NonCodeMeta::default(),
|
||||
inner_attrs: Vec::new(),
|
||||
digest: None,
|
||||
},
|
||||
0,
|
||||
|
||||
@ -102,21 +102,22 @@ async fn execute(test_name: &str, render_to_png: bool) {
|
||||
if render_to_png {
|
||||
twenty_twenty::assert_image(format!("tests/{test_name}/rendered_model.png"), &png, 0.99);
|
||||
}
|
||||
assert_snapshot(test_name, "Program memory after executing", || {
|
||||
insta::assert_json_snapshot!("program_memory", exec_state.memory(), {
|
||||
".environments[].**[].from[]" => rounded_redaction(4),
|
||||
".environments[].**[].to[]" => rounded_redaction(4),
|
||||
".environments[].**[].x[]" => rounded_redaction(4),
|
||||
".environments[].**[].y[]" => rounded_redaction(4),
|
||||
".environments[].**[].z[]" => rounded_redaction(4),
|
||||
});
|
||||
});
|
||||
let outcome = exec_state.to_wasm_outcome();
|
||||
assert_common_snapshots(
|
||||
test_name,
|
||||
exec_state.mod_local.operations,
|
||||
exec_state.global.artifact_commands,
|
||||
exec_state.global.artifact_graph,
|
||||
outcome.operations,
|
||||
outcome.artifact_commands,
|
||||
outcome.artifact_graph,
|
||||
);
|
||||
assert_snapshot(test_name, "Variables in memory after executing", || {
|
||||
insta::assert_json_snapshot!("program_memory", outcome.variables, {
|
||||
".**[].from[]" => rounded_redaction(4),
|
||||
".**[].to[]" => rounded_redaction(4),
|
||||
".**[].x[]" => rounded_redaction(4),
|
||||
".**[].y[]" => rounded_redaction(4),
|
||||
".**[].z[]" => rounded_redaction(4),
|
||||
})
|
||||
});
|
||||
}
|
||||
Err(e) => {
|
||||
let ok_path_str = format!("tests/{test_name}/program_memory.snap");
|
||||
|
||||
@ -358,10 +358,6 @@ impl Args {
|
||||
Ok(numbers)
|
||||
}
|
||||
|
||||
pub(crate) fn get_pattern_transform_args(&self) -> Result<(u32, FnAsArg<'_>, SolidSet, Option<bool>), KclError> {
|
||||
FromArgs::from_args(self, 0)
|
||||
}
|
||||
|
||||
pub(crate) fn get_hypotenuse_leg(&self) -> Result<(f64, f64), KclError> {
|
||||
let numbers = self.get_number_array()?;
|
||||
|
||||
|
||||
@ -134,7 +134,7 @@ async fn inner_chamfer(
|
||||
EdgeReference::Tag(edge_tag) => args.get_tag_engine_info(exec_state, &edge_tag)?.id,
|
||||
};
|
||||
|
||||
let id = exec_state.global.id_generator.next_uuid();
|
||||
let id = exec_state.next_uuid();
|
||||
args.batch_end_cmd(
|
||||
id,
|
||||
ModelingCmd::from(mcmd::Solid3dFilletEdge {
|
||||
|
||||
@ -27,9 +27,9 @@ pub async fn int(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
|
||||
/// startSketchOn('XZ')
|
||||
/// |> circle({ center = [0, 0], radius = 2 }, %)
|
||||
/// |> extrude(length = 5)
|
||||
/// |> patternTransform(n, fn(id) {
|
||||
/// |> patternTransform(instances = n, transform = fn(id) {
|
||||
/// return { translate = [4 * id, 0, 0] }
|
||||
/// }, %)
|
||||
/// })
|
||||
/// ```
|
||||
#[stdlib {
|
||||
name = "int",
|
||||
|
||||
@ -266,7 +266,7 @@ pub(crate) async fn do_post_extrude(
|
||||
Some(extrude_surface)
|
||||
}
|
||||
}
|
||||
} else if args.ctx.is_mock() {
|
||||
} else if args.ctx.no_engine_commands() {
|
||||
// Only pre-populate the extrude surface if we are in mock mode.
|
||||
|
||||
let extrude_surface = ExtrudeSurface::ExtrudePlane(crate::execution::ExtrudePlane {
|
||||
@ -317,7 +317,7 @@ fn analyze_faces(exec_state: &mut ExecState, args: &Args, face_infos: Vec<Extrus
|
||||
sides: HashMap::with_capacity(face_infos.len()),
|
||||
..Default::default()
|
||||
};
|
||||
if args.ctx.is_mock() {
|
||||
if args.ctx.no_engine_commands() {
|
||||
// Create fake IDs for start and end caps, to make extrudes mock-execute safe
|
||||
faces.start_cap_id = Some(exec_state.next_uuid());
|
||||
faces.end_cap_id = Some(exec_state.next_uuid());
|
||||
|
||||
@ -222,7 +222,7 @@ pub async fn get_opposite_edge(exec_state: &mut ExecState, args: Args) -> Result
|
||||
name = "getOppositeEdge",
|
||||
}]
|
||||
async fn inner_get_opposite_edge(tag: TagIdentifier, exec_state: &mut ExecState, args: Args) -> Result<Uuid, KclError> {
|
||||
if args.ctx.is_mock() {
|
||||
if args.ctx.no_engine_commands() {
|
||||
return Ok(exec_state.next_uuid());
|
||||
}
|
||||
let face_id = args.get_adjacent_face_to_tag(exec_state, &tag, false).await?;
|
||||
@ -299,7 +299,7 @@ async fn inner_get_next_adjacent_edge(
|
||||
exec_state: &mut ExecState,
|
||||
args: Args,
|
||||
) -> Result<Uuid, KclError> {
|
||||
if args.ctx.is_mock() {
|
||||
if args.ctx.no_engine_commands() {
|
||||
return Ok(exec_state.next_uuid());
|
||||
}
|
||||
let face_id = args.get_adjacent_face_to_tag(exec_state, &tag, false).await?;
|
||||
@ -384,7 +384,7 @@ async fn inner_get_previous_adjacent_edge(
|
||||
exec_state: &mut ExecState,
|
||||
args: Args,
|
||||
) -> Result<Uuid, KclError> {
|
||||
if args.ctx.is_mock() {
|
||||
if args.ctx.no_engine_commands() {
|
||||
return Ok(exec_state.next_uuid());
|
||||
}
|
||||
let face_id = args.get_adjacent_face_to_tag(exec_state, &tag, false).await?;
|
||||
|
||||
@ -125,7 +125,7 @@ async fn inner_helix(
|
||||
meta: vec![args.source_range.into()],
|
||||
});
|
||||
|
||||
if args.ctx.is_mock() {
|
||||
if args.ctx.no_engine_commands() {
|
||||
return Ok(helix_result);
|
||||
}
|
||||
|
||||
|
||||
@ -112,7 +112,7 @@ async fn inner_mirror_2d(
|
||||
SketchSet::Sketches(sketches) => sketches,
|
||||
};
|
||||
|
||||
if args.ctx.is_mock() {
|
||||
if args.ctx.no_engine_commands() {
|
||||
return Ok(starting_sketches);
|
||||
}
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@ use schemars::JsonSchema;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use uuid::Uuid;
|
||||
|
||||
use super::args::Arg;
|
||||
use super::{args::Arg, FnAsArg};
|
||||
use crate::{
|
||||
errors::{KclError, KclErrorDetails},
|
||||
execution::{
|
||||
@ -47,10 +47,14 @@ pub struct LinearPattern3dData {
|
||||
|
||||
/// Repeat some 3D solid, changing each repetition slightly.
|
||||
pub async fn pattern_transform(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||
let (num_repetitions, transform, extr, use_original) = args.get_pattern_transform_args()?;
|
||||
let solid_set = args.get_unlabeled_kw_arg("solidSet")?;
|
||||
let instances: u32 = args.get_kw_arg("instances")?;
|
||||
let transform: FnAsArg<'_> = args.get_kw_arg("transform")?;
|
||||
let use_original: Option<bool> = args.get_kw_arg_opt("useOriginal")?;
|
||||
|
||||
let solids = inner_pattern_transform(
|
||||
num_repetitions,
|
||||
solid_set,
|
||||
instances,
|
||||
FunctionParam {
|
||||
inner: transform.func,
|
||||
fn_expr: transform.expr,
|
||||
@ -58,7 +62,6 @@ pub async fn pattern_transform(exec_state: &mut ExecState, args: Args) -> Result
|
||||
ctx: args.ctx.clone(),
|
||||
memory: transform.memory,
|
||||
},
|
||||
extr,
|
||||
use_original,
|
||||
exec_state,
|
||||
&args,
|
||||
@ -69,11 +72,14 @@ pub async fn pattern_transform(exec_state: &mut ExecState, args: Args) -> Result
|
||||
|
||||
/// Repeat some 2D sketch, changing each repetition slightly.
|
||||
pub async fn pattern_transform_2d(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||
let (num_repetitions, transform, sketch, use_original): (u32, super::FnAsArg<'_>, SketchSet, Option<bool>) =
|
||||
super::args::FromArgs::from_args(&args, 0)?;
|
||||
let sketch_set = args.get_unlabeled_kw_arg("sketchSet")?;
|
||||
let instances: u32 = args.get_kw_arg("instances")?;
|
||||
let transform: FnAsArg<'_> = args.get_kw_arg("transform")?;
|
||||
let use_original: Option<bool> = args.get_kw_arg_opt("useOriginal")?;
|
||||
|
||||
let sketches = inner_pattern_transform_2d(
|
||||
num_repetitions,
|
||||
sketch_set,
|
||||
instances,
|
||||
FunctionParam {
|
||||
inner: transform.func,
|
||||
fn_expr: transform.expr,
|
||||
@ -81,7 +87,6 @@ pub async fn pattern_transform_2d(exec_state: &mut ExecState, args: Args) -> Res
|
||||
ctx: args.ctx.clone(),
|
||||
memory: transform.memory,
|
||||
},
|
||||
sketch,
|
||||
use_original,
|
||||
exec_state,
|
||||
&args,
|
||||
@ -96,7 +101,7 @@ pub async fn pattern_transform_2d(exec_state: &mut ExecState, args: Args) -> Res
|
||||
/// Transformation function could alter rotation, scale, visibility, position, etc.
|
||||
///
|
||||
/// The `patternTransform` call itself takes a number for how many total instances of
|
||||
/// the shape should be. For example, if you use a circle with `patternTransform(4, transform)`
|
||||
/// the shape should be. For example, if you use a circle with `patternTransform(instances = 4, transform = f)`
|
||||
/// then there will be 4 circles: the original, and 3 created by replicating the original and
|
||||
/// calling the transform function on each.
|
||||
///
|
||||
@ -140,7 +145,7 @@ pub async fn pattern_transform_2d(exec_state: &mut ExecState, args: Args) -> Res
|
||||
/// sketch001 = startSketchOn('XZ')
|
||||
/// |> circle({ center = [0, 0], radius = 2 }, %)
|
||||
/// |> extrude(length = 5)
|
||||
/// |> patternTransform(4, transform, %)
|
||||
/// |> patternTransform(instances = 4, transform = transform)
|
||||
/// ```
|
||||
/// ```no_run
|
||||
/// // Each instance will be shifted along the X axis,
|
||||
@ -153,7 +158,7 @@ pub async fn pattern_transform_2d(exec_state: &mut ExecState, args: Args) -> Res
|
||||
/// sketch001 = startSketchOn('XZ')
|
||||
/// |> circle({ center = [0, 0], radius = 2 }, %)
|
||||
/// |> extrude(length = 5)
|
||||
/// |> patternTransform(4, transform, %)
|
||||
/// |> patternTransform(instances = 4, transform = transform)
|
||||
/// ```
|
||||
/// ```no_run
|
||||
/// fn cube(length, center) {
|
||||
@ -192,7 +197,7 @@ pub async fn pattern_transform_2d(exec_state: &mut ExecState, args: Args) -> Res
|
||||
///
|
||||
/// myCubes =
|
||||
/// cube(width, [100,0])
|
||||
/// |> patternTransform(25, transform, %)
|
||||
/// |> patternTransform(instances = 25, transform = transform)
|
||||
/// ```
|
||||
///
|
||||
/// ```no_run
|
||||
@ -228,7 +233,7 @@ pub async fn pattern_transform_2d(exec_state: &mut ExecState, args: Args) -> Res
|
||||
/// }
|
||||
/// myCubes =
|
||||
/// cube(width, [100,100])
|
||||
/// |> patternTransform(4, transform, %)
|
||||
/// |> patternTransform(instances = 4, transform = transform)
|
||||
/// ```
|
||||
/// ```no_run
|
||||
/// // Parameters
|
||||
@ -252,7 +257,7 @@ pub async fn pattern_transform_2d(exec_state: &mut ExecState, args: Args) -> Res
|
||||
/// }
|
||||
/// // The vase is 100 layers tall.
|
||||
/// // The 100 layers are replica of each other, with a slight transformation applied to each.
|
||||
/// vase = layer() |> patternTransform(100, transform, %)
|
||||
/// vase = layer() |> patternTransform(instances = 100, transform = transform)
|
||||
/// ```
|
||||
/// ```
|
||||
/// fn transform(i) {
|
||||
@ -271,33 +276,48 @@ pub async fn pattern_transform_2d(exec_state: &mut ExecState, args: Args) -> Res
|
||||
/// inscribed: false
|
||||
/// }, %)
|
||||
/// |> extrude(length = 4)
|
||||
/// |> patternTransform(3, transform, %)
|
||||
/// |> patternTransform(instances = 3, transform = transform)
|
||||
/// ```
|
||||
#[stdlib {
|
||||
name = "patternTransform",
|
||||
feature_tree_operation = true,
|
||||
keywords = true,
|
||||
unlabeled_first = true,
|
||||
args = {
|
||||
solid_set = { docs = "The solid(s) to duplicate" },
|
||||
instances = { docs = "The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect." },
|
||||
transform = { docs = "How each replica should be transformed. The transform function takes a single parameter: an integer representing which number replication the transform is for. E.g. the first replica to be transformed will be passed the argument `1`. This simplifies your math: the transform function can rely on id `0` being the original instance passed into the `patternTransform`. See the examples." },
|
||||
use_original = { docs = "If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false." },
|
||||
}
|
||||
}]
|
||||
async fn inner_pattern_transform<'a>(
|
||||
total_instances: u32,
|
||||
transform_function: FunctionParam<'a>,
|
||||
solid_set: SolidSet,
|
||||
instances: u32,
|
||||
transform: FunctionParam<'a>,
|
||||
use_original: Option<bool>,
|
||||
exec_state: &mut ExecState,
|
||||
args: &'a Args,
|
||||
) -> Result<Vec<Box<Solid>>, KclError> {
|
||||
// Build the vec of transforms, one for each repetition.
|
||||
let mut transform = Vec::with_capacity(usize::try_from(total_instances).unwrap());
|
||||
if total_instances < 1 {
|
||||
let mut transform_vec = Vec::with_capacity(usize::try_from(instances).unwrap());
|
||||
if instances < 1 {
|
||||
return Err(KclError::Semantic(KclErrorDetails {
|
||||
source_ranges: vec![args.source_range],
|
||||
message: MUST_HAVE_ONE_INSTANCE.to_owned(),
|
||||
}));
|
||||
}
|
||||
for i in 1..total_instances {
|
||||
let t = make_transform::<Box<Solid>>(i, &transform_function, args.source_range, exec_state).await?;
|
||||
transform.push(t);
|
||||
for i in 1..instances {
|
||||
let t = make_transform::<Box<Solid>>(i, &transform, args.source_range, exec_state).await?;
|
||||
transform_vec.push(t);
|
||||
}
|
||||
execute_pattern_transform(transform, solid_set, use_original.unwrap_or_default(), exec_state, args).await
|
||||
execute_pattern_transform(
|
||||
transform_vec,
|
||||
solid_set,
|
||||
use_original.unwrap_or_default(),
|
||||
exec_state,
|
||||
args,
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
/// Just like patternTransform, but works on 2D sketches not 3D solids.
|
||||
@ -310,32 +330,47 @@ async fn inner_pattern_transform<'a>(
|
||||
/// // Sketch 4 circles.
|
||||
/// sketch001 = startSketchOn('XZ')
|
||||
/// |> circle({ center: [0, 0], radius: 2 }, %)
|
||||
/// |> patternTransform2d(4, transform, %)
|
||||
/// |> patternTransform2d(instances = 4, transform = transform)
|
||||
/// ```
|
||||
#[stdlib {
|
||||
name = "patternTransform2d",
|
||||
keywords = true,
|
||||
unlabeled_first = true,
|
||||
args = {
|
||||
sketch_set = { docs = "The sketch(es) to duplicate" },
|
||||
instances = { docs = "The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect." },
|
||||
transform = { docs = "How each replica should be transformed. The transform function takes a single parameter: an integer representing which number replication the transform is for. E.g. the first replica to be transformed will be passed the argument `1`. This simplifies your math: the transform function can rely on id `0` being the original instance passed into the `patternTransform`. See the examples." },
|
||||
use_original = { docs = "If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false." },
|
||||
}
|
||||
}]
|
||||
async fn inner_pattern_transform_2d<'a>(
|
||||
total_instances: u32,
|
||||
transform_function: FunctionParam<'a>,
|
||||
solid_set: SketchSet,
|
||||
sketch_set: SketchSet,
|
||||
instances: u32,
|
||||
transform: FunctionParam<'a>,
|
||||
use_original: Option<bool>,
|
||||
exec_state: &mut ExecState,
|
||||
args: &'a Args,
|
||||
) -> Result<Vec<Box<Sketch>>, KclError> {
|
||||
// Build the vec of transforms, one for each repetition.
|
||||
let mut transform = Vec::with_capacity(usize::try_from(total_instances).unwrap());
|
||||
if total_instances < 1 {
|
||||
let mut transform_vec = Vec::with_capacity(usize::try_from(instances).unwrap());
|
||||
if instances < 1 {
|
||||
return Err(KclError::Semantic(KclErrorDetails {
|
||||
source_ranges: vec![args.source_range],
|
||||
message: MUST_HAVE_ONE_INSTANCE.to_owned(),
|
||||
}));
|
||||
}
|
||||
for i in 1..total_instances {
|
||||
let t = make_transform::<Box<Sketch>>(i, &transform_function, args.source_range, exec_state).await?;
|
||||
transform.push(t);
|
||||
for i in 1..instances {
|
||||
let t = make_transform::<Box<Sketch>>(i, &transform, args.source_range, exec_state).await?;
|
||||
transform_vec.push(t);
|
||||
}
|
||||
execute_pattern_transform(transform, solid_set, use_original.unwrap_or_default(), exec_state, args).await
|
||||
execute_pattern_transform(
|
||||
transform_vec,
|
||||
sketch_set,
|
||||
use_original.unwrap_or_default(),
|
||||
exec_state,
|
||||
args,
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
async fn execute_pattern_transform<T: GeometryTrait>(
|
||||
@ -406,7 +441,7 @@ async fn send_pattern_transform<T: GeometryTrait>(
|
||||
|
||||
async fn make_transform<T: GeometryTrait>(
|
||||
i: u32,
|
||||
transform_function: &FunctionParam<'_>,
|
||||
transform: &FunctionParam<'_>,
|
||||
source_range: SourceRange,
|
||||
exec_state: &mut ExecState,
|
||||
) -> Result<Vec<Transform>, KclError> {
|
||||
@ -416,7 +451,7 @@ async fn make_transform<T: GeometryTrait>(
|
||||
meta: vec![source_range.into()],
|
||||
};
|
||||
let transform_fn_args = vec![Arg::synthetic(repetition_num)];
|
||||
let transform_fn_return = transform_function.call(exec_state, transform_fn_args).await?;
|
||||
let transform_fn_return = transform.call(exec_state, transform_fn_args).await?;
|
||||
|
||||
// Unpack the returned transform object.
|
||||
let source_ranges = vec![source_range];
|
||||
|
||||
@ -12,7 +12,7 @@ use crate::{
|
||||
|
||||
/// Returns the point at the end of the given segment.
|
||||
pub async fn segment_end(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||
let tag: TagIdentifier = args.get_data()?;
|
||||
let tag: TagIdentifier = args.get_unlabeled_kw_arg("tag")?;
|
||||
let result = inner_segment_end(&tag, exec_state, args.clone())?;
|
||||
|
||||
args.make_user_val_from_point(result)
|
||||
@ -45,6 +45,11 @@ pub async fn segment_end(exec_state: &mut ExecState, args: Args) -> Result<KclVa
|
||||
/// ```
|
||||
#[stdlib {
|
||||
name = "segEnd",
|
||||
keywords = true,
|
||||
unlabeled_first = true,
|
||||
args = {
|
||||
tag = { docs = "The line segment being queried by its tag"},
|
||||
}
|
||||
}]
|
||||
fn inner_segment_end(tag: &TagIdentifier, exec_state: &mut ExecState, args: Args) -> Result<[f64; 2], KclError> {
|
||||
let line = args.get_tag_engine_info(exec_state, tag)?;
|
||||
@ -60,7 +65,7 @@ fn inner_segment_end(tag: &TagIdentifier, exec_state: &mut ExecState, args: Args
|
||||
|
||||
/// Returns the segment end of x.
|
||||
pub async fn segment_end_x(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||
let tag: TagIdentifier = args.get_data()?;
|
||||
let tag: TagIdentifier = args.get_unlabeled_kw_arg("tag")?;
|
||||
let result = inner_segment_end_x(&tag, exec_state, args.clone())?;
|
||||
|
||||
Ok(args.make_user_val_from_f64(result))
|
||||
@ -81,6 +86,11 @@ pub async fn segment_end_x(exec_state: &mut ExecState, args: Args) -> Result<Kcl
|
||||
/// ```
|
||||
#[stdlib {
|
||||
name = "segEndX",
|
||||
keywords = true,
|
||||
unlabeled_first = true,
|
||||
args = {
|
||||
tag = { docs = "The line segment being queried by its tag"},
|
||||
}
|
||||
}]
|
||||
fn inner_segment_end_x(tag: &TagIdentifier, exec_state: &mut ExecState, args: Args) -> Result<f64, KclError> {
|
||||
let line = args.get_tag_engine_info(exec_state, tag)?;
|
||||
@ -96,7 +106,7 @@ fn inner_segment_end_x(tag: &TagIdentifier, exec_state: &mut ExecState, args: Ar
|
||||
|
||||
/// Returns the segment end of y.
|
||||
pub async fn segment_end_y(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||
let tag: TagIdentifier = args.get_data()?;
|
||||
let tag: TagIdentifier = args.get_unlabeled_kw_arg("tag")?;
|
||||
let result = inner_segment_end_y(&tag, exec_state, args.clone())?;
|
||||
|
||||
Ok(args.make_user_val_from_f64(result))
|
||||
@ -118,6 +128,11 @@ pub async fn segment_end_y(exec_state: &mut ExecState, args: Args) -> Result<Kcl
|
||||
/// ```
|
||||
#[stdlib {
|
||||
name = "segEndY",
|
||||
keywords = true,
|
||||
unlabeled_first = true,
|
||||
args = {
|
||||
tag = { docs = "The line segment being queried by its tag"},
|
||||
}
|
||||
}]
|
||||
fn inner_segment_end_y(tag: &TagIdentifier, exec_state: &mut ExecState, args: Args) -> Result<f64, KclError> {
|
||||
let line = args.get_tag_engine_info(exec_state, tag)?;
|
||||
@ -133,7 +148,7 @@ fn inner_segment_end_y(tag: &TagIdentifier, exec_state: &mut ExecState, args: Ar
|
||||
|
||||
/// Returns the point at the start of the given segment.
|
||||
pub async fn segment_start(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||
let tag: TagIdentifier = args.get_data()?;
|
||||
let tag: TagIdentifier = args.get_unlabeled_kw_arg("tag")?;
|
||||
let result = inner_segment_start(&tag, exec_state, args.clone())?;
|
||||
|
||||
args.make_user_val_from_point(result)
|
||||
@ -166,6 +181,11 @@ pub async fn segment_start(exec_state: &mut ExecState, args: Args) -> Result<Kcl
|
||||
/// ```
|
||||
#[stdlib {
|
||||
name = "segStart",
|
||||
keywords = true,
|
||||
unlabeled_first = true,
|
||||
args = {
|
||||
tag = { docs = "The line segment being queried by its tag"},
|
||||
}
|
||||
}]
|
||||
fn inner_segment_start(tag: &TagIdentifier, exec_state: &mut ExecState, args: Args) -> Result<[f64; 2], KclError> {
|
||||
let line = args.get_tag_engine_info(exec_state, tag)?;
|
||||
@ -181,7 +201,7 @@ fn inner_segment_start(tag: &TagIdentifier, exec_state: &mut ExecState, args: Ar
|
||||
|
||||
/// Returns the segment start of x.
|
||||
pub async fn segment_start_x(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||
let tag: TagIdentifier = args.get_data()?;
|
||||
let tag: TagIdentifier = args.get_unlabeled_kw_arg("tag")?;
|
||||
let result = inner_segment_start_x(&tag, exec_state, args.clone())?;
|
||||
|
||||
Ok(args.make_user_val_from_f64(result))
|
||||
@ -202,6 +222,11 @@ pub async fn segment_start_x(exec_state: &mut ExecState, args: Args) -> Result<K
|
||||
/// ```
|
||||
#[stdlib {
|
||||
name = "segStartX",
|
||||
keywords = true,
|
||||
unlabeled_first = true,
|
||||
args = {
|
||||
tag = { docs = "The line segment being queried by its tag"},
|
||||
}
|
||||
}]
|
||||
fn inner_segment_start_x(tag: &TagIdentifier, exec_state: &mut ExecState, args: Args) -> Result<f64, KclError> {
|
||||
let line = args.get_tag_engine_info(exec_state, tag)?;
|
||||
@ -217,7 +242,7 @@ fn inner_segment_start_x(tag: &TagIdentifier, exec_state: &mut ExecState, args:
|
||||
|
||||
/// Returns the segment start of y.
|
||||
pub async fn segment_start_y(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||
let tag: TagIdentifier = args.get_data()?;
|
||||
let tag: TagIdentifier = args.get_unlabeled_kw_arg("tag")?;
|
||||
let result = inner_segment_start_y(&tag, exec_state, args.clone())?;
|
||||
|
||||
Ok(args.make_user_val_from_f64(result))
|
||||
@ -239,6 +264,11 @@ pub async fn segment_start_y(exec_state: &mut ExecState, args: Args) -> Result<K
|
||||
/// ```
|
||||
#[stdlib {
|
||||
name = "segStartY",
|
||||
keywords = true,
|
||||
unlabeled_first = true,
|
||||
args = {
|
||||
tag = { docs = "The line segment being queried by its tag"},
|
||||
}
|
||||
}]
|
||||
fn inner_segment_start_y(tag: &TagIdentifier, exec_state: &mut ExecState, args: Args) -> Result<f64, KclError> {
|
||||
let line = args.get_tag_engine_info(exec_state, tag)?;
|
||||
@ -253,7 +283,7 @@ fn inner_segment_start_y(tag: &TagIdentifier, exec_state: &mut ExecState, args:
|
||||
}
|
||||
/// Returns the last segment of x.
|
||||
pub async fn last_segment_x(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||
let sketch = args.get_sketch()?;
|
||||
let sketch = args.get_unlabeled_kw_arg("sketch")?;
|
||||
let result = inner_last_segment_x(sketch, args.clone())?;
|
||||
|
||||
Ok(args.make_user_val_from_f64(result))
|
||||
@ -275,6 +305,11 @@ pub async fn last_segment_x(_exec_state: &mut ExecState, args: Args) -> Result<K
|
||||
/// ```
|
||||
#[stdlib {
|
||||
name = "lastSegX",
|
||||
keywords = true,
|
||||
unlabeled_first = true,
|
||||
args = {
|
||||
sketch = { docs = "The sketch whose line segment is being queried"},
|
||||
}
|
||||
}]
|
||||
fn inner_last_segment_x(sketch: Sketch, args: Args) -> Result<f64, KclError> {
|
||||
let last_line = sketch
|
||||
@ -293,7 +328,7 @@ fn inner_last_segment_x(sketch: Sketch, args: Args) -> Result<f64, KclError> {
|
||||
|
||||
/// Returns the last segment of y.
|
||||
pub async fn last_segment_y(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||
let sketch = args.get_sketch()?;
|
||||
let sketch = args.get_unlabeled_kw_arg("sketch")?;
|
||||
let result = inner_last_segment_y(sketch, args.clone())?;
|
||||
|
||||
Ok(args.make_user_val_from_f64(result))
|
||||
@ -315,6 +350,11 @@ pub async fn last_segment_y(_exec_state: &mut ExecState, args: Args) -> Result<K
|
||||
/// ```
|
||||
#[stdlib {
|
||||
name = "lastSegY",
|
||||
keywords = true,
|
||||
unlabeled_first = true,
|
||||
args = {
|
||||
sketch = { docs = "The sketch whose line segment is being queried"},
|
||||
}
|
||||
}]
|
||||
fn inner_last_segment_y(sketch: Sketch, args: Args) -> Result<f64, KclError> {
|
||||
let last_line = sketch
|
||||
@ -333,7 +373,7 @@ fn inner_last_segment_y(sketch: Sketch, args: Args) -> Result<f64, KclError> {
|
||||
|
||||
/// Returns the length of the segment.
|
||||
pub async fn segment_length(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||
let tag: TagIdentifier = args.get_data()?;
|
||||
let tag: TagIdentifier = args.get_unlabeled_kw_arg("tag")?;
|
||||
let result = inner_segment_length(&tag, exec_state, args.clone())?;
|
||||
Ok(args.make_user_val_from_f64(result))
|
||||
}
|
||||
@ -361,6 +401,11 @@ pub async fn segment_length(exec_state: &mut ExecState, args: Args) -> Result<Kc
|
||||
/// ```
|
||||
#[stdlib {
|
||||
name = "segLen",
|
||||
keywords = true,
|
||||
unlabeled_first = true,
|
||||
args = {
|
||||
tag = { docs = "The line segment being queried by its tag"},
|
||||
}
|
||||
}]
|
||||
fn inner_segment_length(tag: &TagIdentifier, exec_state: &mut ExecState, args: Args) -> Result<f64, KclError> {
|
||||
let line = args.get_tag_engine_info(exec_state, tag)?;
|
||||
@ -378,7 +423,7 @@ fn inner_segment_length(tag: &TagIdentifier, exec_state: &mut ExecState, args: A
|
||||
|
||||
/// Returns the angle of the segment.
|
||||
pub async fn segment_angle(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||
let tag: TagIdentifier = args.get_data()?;
|
||||
let tag: TagIdentifier = args.get_unlabeled_kw_arg("tag")?;
|
||||
|
||||
let result = inner_segment_angle(&tag, exec_state, args.clone())?;
|
||||
Ok(args.make_user_val_from_f64(result))
|
||||
@ -401,6 +446,11 @@ pub async fn segment_angle(exec_state: &mut ExecState, args: Args) -> Result<Kcl
|
||||
/// ```
|
||||
#[stdlib {
|
||||
name = "segAng",
|
||||
keywords = true,
|
||||
unlabeled_first = true,
|
||||
args = {
|
||||
tag = { docs = "The line segment being queried by its tag"},
|
||||
}
|
||||
}]
|
||||
fn inner_segment_angle(tag: &TagIdentifier, exec_state: &mut ExecState, args: Args) -> Result<f64, KclError> {
|
||||
let line = args.get_tag_engine_info(exec_state, tag)?;
|
||||
@ -418,7 +468,7 @@ fn inner_segment_angle(tag: &TagIdentifier, exec_state: &mut ExecState, args: Ar
|
||||
|
||||
/// Returns the angle coming out of the end of the segment in degrees.
|
||||
pub async fn tangent_to_end(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||
let tag: TagIdentifier = args.get_data()?;
|
||||
let tag: TagIdentifier = args.get_unlabeled_kw_arg("tag")?;
|
||||
|
||||
let result = inner_tangent_to_end(&tag, exec_state, args.clone()).await?;
|
||||
Ok(args.make_user_val_from_f64(result))
|
||||
@ -496,6 +546,11 @@ pub async fn tangent_to_end(exec_state: &mut ExecState, args: Args) -> Result<Kc
|
||||
/// ```
|
||||
#[stdlib {
|
||||
name = "tangentToEnd",
|
||||
keywords = true,
|
||||
unlabeled_first = true,
|
||||
args = {
|
||||
tag = { docs = "The line segment being queried by its tag"},
|
||||
}
|
||||
}]
|
||||
async fn inner_tangent_to_end(tag: &TagIdentifier, exec_state: &mut ExecState, args: Args) -> Result<f64, KclError> {
|
||||
let line = args.get_tag_engine_info(exec_state, tag)?;
|
||||
|
||||
@ -218,7 +218,7 @@ async fn straight_line(
|
||||
}
|
||||
};
|
||||
|
||||
let id = exec_state.global.id_generator.next_uuid();
|
||||
let id = exec_state.next_uuid();
|
||||
args.batch_modeling_cmd(
|
||||
id,
|
||||
ModelingCmd::from(mcmd::ExtendPath {
|
||||
|
||||
@ -5,9 +5,9 @@ use std::path::PathBuf;
|
||||
use crate::{
|
||||
engine::new_zoo_client,
|
||||
errors::ExecErrorWithState,
|
||||
execution::{ExecutorContext, ExecutorSettings},
|
||||
execution::{ExecState, ExecutorContext, ExecutorSettings},
|
||||
settings::types::UnitLength,
|
||||
ConnectionError, ExecError, ExecState, KclErrorWithOutputs, Program,
|
||||
ConnectionError, ExecError, KclErrorWithOutputs, Program,
|
||||
};
|
||||
|
||||
#[derive(serde::Deserialize, serde::Serialize)]
|
||||
|
||||
@ -2,11 +2,12 @@ use std::fmt::Write;
|
||||
|
||||
use crate::parsing::{
|
||||
ast::types::{
|
||||
ArrayExpression, ArrayRangeExpression, BinaryExpression, BinaryOperator, BinaryPart, BodyItem, CallExpression,
|
||||
CallExpressionKw, CommentStyle, DefaultParamVal, Expr, FnArgType, FormatOptions, FunctionExpression,
|
||||
IfExpression, ImportSelector, ImportStatement, ItemVisibility, LabeledArg, Literal, LiteralIdentifier,
|
||||
LiteralValue, MemberExpression, MemberObject, Node, NonCodeNode, NonCodeValue, ObjectExpression, Parameter,
|
||||
PipeExpression, Program, TagDeclarator, UnaryExpression, VariableDeclaration, VariableKind,
|
||||
Annotation, ArrayExpression, ArrayRangeExpression, BinaryExpression, BinaryOperator, BinaryPart, BodyItem,
|
||||
CallExpression, CallExpressionKw, CommentStyle, DefaultParamVal, Expr, FnArgType, FormatOptions,
|
||||
FunctionExpression, IfExpression, ImportSelector, ImportStatement, ItemVisibility, LabeledArg, Literal,
|
||||
LiteralIdentifier, LiteralValue, MemberExpression, MemberObject, Node, NonCodeNode, NonCodeValue,
|
||||
ObjectExpression, Parameter, PipeExpression, Program, TagDeclarator, UnaryExpression, VariableDeclaration,
|
||||
VariableKind,
|
||||
},
|
||||
token::NumericSuffix,
|
||||
PIPE_OPERATOR,
|
||||
@ -22,6 +23,9 @@ impl Program {
|
||||
.map(|sh| format!("{}\n\n", sh.inner.content))
|
||||
.unwrap_or_default();
|
||||
|
||||
for attr in &self.inner_attrs {
|
||||
result.push_str(&attr.recast(options, indentation_level));
|
||||
}
|
||||
for start in &self.non_code_meta.start_nodes {
|
||||
result.push_str(&start.recast(options, indentation_level));
|
||||
}
|
||||
@ -30,36 +34,44 @@ impl Program {
|
||||
let result = self
|
||||
.body
|
||||
.iter()
|
||||
.map(|body_item| match body_item.clone() {
|
||||
BodyItem::ImportStatement(stmt) => stmt.recast(options, indentation_level),
|
||||
BodyItem::ExpressionStatement(expression_statement) => {
|
||||
expression_statement
|
||||
.expression
|
||||
.recast(options, indentation_level, ExprContext::Other)
|
||||
.map(|body_item| {
|
||||
let mut result = String::new();
|
||||
for attr in body_item.get_attrs() {
|
||||
result.push_str(&attr.recast(options, indentation_level));
|
||||
}
|
||||
BodyItem::VariableDeclaration(variable_declaration) => {
|
||||
variable_declaration.recast(options, indentation_level)
|
||||
}
|
||||
BodyItem::ReturnStatement(return_statement) => {
|
||||
format!(
|
||||
"{}return {}",
|
||||
indentation,
|
||||
return_statement
|
||||
.argument
|
||||
result.push_str(&match body_item.clone() {
|
||||
BodyItem::ImportStatement(stmt) => stmt.recast(options, indentation_level),
|
||||
BodyItem::ExpressionStatement(expression_statement) => {
|
||||
expression_statement
|
||||
.expression
|
||||
.recast(options, indentation_level, ExprContext::Other)
|
||||
.trim_start()
|
||||
)
|
||||
}
|
||||
}
|
||||
BodyItem::VariableDeclaration(variable_declaration) => {
|
||||
variable_declaration.recast(options, indentation_level)
|
||||
}
|
||||
BodyItem::ReturnStatement(return_statement) => {
|
||||
format!(
|
||||
"{}return {}",
|
||||
indentation,
|
||||
return_statement
|
||||
.argument
|
||||
.recast(options, indentation_level, ExprContext::Other)
|
||||
.trim_start()
|
||||
)
|
||||
}
|
||||
});
|
||||
result
|
||||
})
|
||||
.enumerate()
|
||||
.fold(result, |mut output, (index, recast_str)| {
|
||||
let start_string = if index == 0 && self.non_code_meta.start_nodes.is_empty() {
|
||||
// We need to indent.
|
||||
indentation.to_string()
|
||||
} else {
|
||||
// Do nothing, we already applied the indentation elsewhere.
|
||||
String::new()
|
||||
};
|
||||
let start_string =
|
||||
if index == 0 && self.non_code_meta.start_nodes.is_empty() && self.inner_attrs.is_empty() {
|
||||
// We need to indent.
|
||||
indentation.to_string()
|
||||
} else {
|
||||
// Do nothing, we already applied the indentation elsewhere.
|
||||
String::new()
|
||||
};
|
||||
|
||||
// determine the value of the end string
|
||||
// basically if we are inside a nested function we want to end with a new line
|
||||
@ -113,9 +125,7 @@ impl NonCodeValue {
|
||||
fn should_cause_array_newline(&self) -> bool {
|
||||
match self {
|
||||
Self::InlineComment { .. } => false,
|
||||
Self::BlockComment { .. } | Self::NewLineBlockComment { .. } | Self::NewLine | Self::Annotation { .. } => {
|
||||
true
|
||||
}
|
||||
Self::BlockComment { .. } | Self::NewLineBlockComment { .. } | Self::NewLine => true,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -156,38 +166,41 @@ impl Node<NonCodeNode> {
|
||||
}
|
||||
}
|
||||
NonCodeValue::NewLine => "\n\n".to_string(),
|
||||
NonCodeValue::Annotation { name, properties } => {
|
||||
let mut result = "@".to_owned();
|
||||
if let Some(name) = name {
|
||||
result.push_str(&name.name);
|
||||
}
|
||||
if let Some(properties) = properties {
|
||||
result.push('(');
|
||||
result.push_str(
|
||||
&properties
|
||||
.iter()
|
||||
.map(|prop| {
|
||||
format!(
|
||||
"{} = {}",
|
||||
prop.key.name,
|
||||
prop.value
|
||||
.recast(options, indentation_level + 1, ExprContext::Other)
|
||||
.trim()
|
||||
)
|
||||
})
|
||||
.collect::<Vec<String>>()
|
||||
.join(", "),
|
||||
);
|
||||
result.push(')');
|
||||
result.push('\n');
|
||||
}
|
||||
|
||||
result
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Node<Annotation> {
|
||||
fn recast(&self, options: &FormatOptions, indentation_level: usize) -> String {
|
||||
let mut result = "@".to_owned();
|
||||
if let Some(name) = &self.name {
|
||||
result.push_str(&name.name);
|
||||
}
|
||||
if let Some(properties) = &self.properties {
|
||||
result.push('(');
|
||||
result.push_str(
|
||||
&properties
|
||||
.iter()
|
||||
.map(|prop| {
|
||||
format!(
|
||||
"{} = {}",
|
||||
prop.key.name,
|
||||
prop.value
|
||||
.recast(options, indentation_level + 1, ExprContext::Other)
|
||||
.trim()
|
||||
)
|
||||
})
|
||||
.collect::<Vec<String>>()
|
||||
.join(", "),
|
||||
);
|
||||
result.push(')');
|
||||
result.push('\n');
|
||||
}
|
||||
|
||||
result
|
||||
}
|
||||
}
|
||||
|
||||
impl ImportStatement {
|
||||
pub fn recast(&self, options: &FormatOptions, indentation_level: usize) -> String {
|
||||
let indentation = options.get_indentation(indentation_level);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,50 +1,320 @@
|
||||
---
|
||||
source: kcl/src/simulation_tests.rs
|
||||
description: Program memory after executing angled_line.kcl
|
||||
description: Variables in memory after executing angled_line.kcl
|
||||
---
|
||||
{
|
||||
"environments": [
|
||||
{
|
||||
"bindings": {
|
||||
"HALF_TURN": {
|
||||
"type": "Number",
|
||||
"value": 180.0,
|
||||
"HALF_TURN": {
|
||||
"type": "Number",
|
||||
"value": 180.0,
|
||||
"__meta": []
|
||||
},
|
||||
"QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 90.0,
|
||||
"__meta": []
|
||||
},
|
||||
"THREE_QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 270.0,
|
||||
"__meta": []
|
||||
},
|
||||
"ZERO": {
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": []
|
||||
},
|
||||
"part001": {
|
||||
"type": "Solid",
|
||||
"value": {
|
||||
"type": "Solid",
|
||||
"id": "[uuid]",
|
||||
"artifactId": "[uuid]",
|
||||
"value": [
|
||||
{
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
73,
|
||||
97,
|
||||
0
|
||||
],
|
||||
"tag": null,
|
||||
"type": "extrudePlane"
|
||||
},
|
||||
{
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
103,
|
||||
142,
|
||||
0
|
||||
],
|
||||
"tag": {
|
||||
"end": 141,
|
||||
"start": 135,
|
||||
"type": "TagDeclarator",
|
||||
"value": "seg01"
|
||||
},
|
||||
"type": "extrudePlane"
|
||||
},
|
||||
{
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
148,
|
||||
174,
|
||||
0
|
||||
],
|
||||
"tag": null,
|
||||
"type": "extrudePlane"
|
||||
},
|
||||
{
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
180,
|
||||
217,
|
||||
0
|
||||
],
|
||||
"tag": null,
|
||||
"type": "extrudePlane"
|
||||
},
|
||||
{
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
223,
|
||||
250,
|
||||
0
|
||||
],
|
||||
"tag": null,
|
||||
"type": "extrudePlane"
|
||||
},
|
||||
{
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
256,
|
||||
264,
|
||||
0
|
||||
],
|
||||
"tag": null,
|
||||
"type": "extrudePlane"
|
||||
}
|
||||
],
|
||||
"sketch": {
|
||||
"type": "Sketch",
|
||||
"id": "[uuid]",
|
||||
"paths": [
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
73,
|
||||
97,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
4.83,
|
||||
12.56
|
||||
],
|
||||
"tag": null,
|
||||
"to": [
|
||||
19.93,
|
||||
15.04
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
103,
|
||||
142,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
19.93,
|
||||
15.04
|
||||
],
|
||||
"tag": {
|
||||
"end": 141,
|
||||
"start": 135,
|
||||
"type": "TagDeclarator",
|
||||
"value": "seg01"
|
||||
},
|
||||
"to": [
|
||||
23.08,
|
||||
5.19
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
148,
|
||||
174,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
23.08,
|
||||
5.19
|
||||
],
|
||||
"tag": null,
|
||||
"to": [
|
||||
7.91,
|
||||
1.09
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
180,
|
||||
217,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
7.91,
|
||||
1.09
|
||||
],
|
||||
"tag": null,
|
||||
"to": [
|
||||
11.6718,
|
||||
-10.6731
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
223,
|
||||
250,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
11.6718,
|
||||
-10.6731
|
||||
],
|
||||
"tag": null,
|
||||
"to": [
|
||||
-1.3482,
|
||||
-0.6431
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
256,
|
||||
264,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
-1.3482,
|
||||
-0.6431
|
||||
],
|
||||
"tag": null,
|
||||
"to": [
|
||||
4.83,
|
||||
12.56
|
||||
],
|
||||
"type": "ToPoint"
|
||||
}
|
||||
],
|
||||
"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"
|
||||
},
|
||||
"__meta": []
|
||||
},
|
||||
"QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 90.0,
|
||||
"__meta": []
|
||||
},
|
||||
"THREE_QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 270.0,
|
||||
"__meta": []
|
||||
},
|
||||
"ZERO": {
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": []
|
||||
},
|
||||
"part001": {
|
||||
"type": "Solid",
|
||||
"value": {
|
||||
"type": "Solid",
|
||||
"start": {
|
||||
"from": [
|
||||
4.83,
|
||||
12.56
|
||||
],
|
||||
"to": [
|
||||
4.83,
|
||||
12.56
|
||||
],
|
||||
"tag": null,
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"artifactId": "[uuid]",
|
||||
"value": [
|
||||
{
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
73,
|
||||
97,
|
||||
0
|
||||
"sourceRange": [
|
||||
35,
|
||||
67,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"tags": {
|
||||
"seg01": {
|
||||
"type": "TagIdentifier",
|
||||
"value": "seg01",
|
||||
"info": {
|
||||
"type": "TagEngineInfo",
|
||||
"id": "[uuid]",
|
||||
"sketch": "[uuid]",
|
||||
"path": {
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
103,
|
||||
142,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
19.93,
|
||||
15.040000000000001
|
||||
],
|
||||
"tag": null,
|
||||
"type": "extrudePlane"
|
||||
"tag": {
|
||||
"end": 141,
|
||||
"start": 135,
|
||||
"type": "TagDeclarator",
|
||||
"value": "seg01"
|
||||
},
|
||||
"to": [
|
||||
23.08,
|
||||
5.190000000000001
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
{
|
||||
"surface": {
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
@ -59,392 +329,109 @@ description: Program memory after executing angled_line.kcl
|
||||
"value": "seg01"
|
||||
},
|
||||
"type": "extrudePlane"
|
||||
},
|
||||
{
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
148,
|
||||
174,
|
||||
0
|
||||
],
|
||||
"tag": null,
|
||||
"type": "extrudePlane"
|
||||
},
|
||||
{
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
180,
|
||||
217,
|
||||
0
|
||||
],
|
||||
"tag": null,
|
||||
"type": "extrudePlane"
|
||||
},
|
||||
{
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
223,
|
||||
250,
|
||||
0
|
||||
],
|
||||
"tag": null,
|
||||
"type": "extrudePlane"
|
||||
},
|
||||
{
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
256,
|
||||
264,
|
||||
0
|
||||
],
|
||||
"tag": null,
|
||||
"type": "extrudePlane"
|
||||
}
|
||||
],
|
||||
"sketch": {
|
||||
"type": "Sketch",
|
||||
"id": "[uuid]",
|
||||
"paths": [
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
73,
|
||||
97,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
4.83,
|
||||
12.56
|
||||
],
|
||||
"tag": null,
|
||||
"to": [
|
||||
19.93,
|
||||
15.04
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
103,
|
||||
142,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
19.93,
|
||||
15.04
|
||||
],
|
||||
"tag": {
|
||||
"end": 141,
|
||||
"start": 135,
|
||||
"type": "TagDeclarator",
|
||||
"value": "seg01"
|
||||
},
|
||||
"to": [
|
||||
23.08,
|
||||
5.19
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
148,
|
||||
174,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
23.08,
|
||||
5.19
|
||||
],
|
||||
"tag": null,
|
||||
"to": [
|
||||
7.91,
|
||||
1.09
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
180,
|
||||
217,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
7.91,
|
||||
1.09
|
||||
],
|
||||
"tag": null,
|
||||
"to": [
|
||||
11.6718,
|
||||
-10.6731
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
223,
|
||||
250,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
11.6718,
|
||||
-10.6731
|
||||
],
|
||||
"tag": null,
|
||||
"to": [
|
||||
-1.3482,
|
||||
-0.6431
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
256,
|
||||
264,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
-1.3482,
|
||||
-0.6431
|
||||
],
|
||||
"tag": null,
|
||||
"to": [
|
||||
4.83,
|
||||
12.56
|
||||
],
|
||||
"type": "ToPoint"
|
||||
}
|
||||
],
|
||||
"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"
|
||||
},
|
||||
"__meta": []
|
||||
},
|
||||
"start": {
|
||||
"from": [
|
||||
4.83,
|
||||
12.56
|
||||
],
|
||||
"to": [
|
||||
4.83,
|
||||
12.56
|
||||
],
|
||||
"tag": null,
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
35,
|
||||
67,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"tags": {
|
||||
"seg01": {
|
||||
"type": "TagIdentifier",
|
||||
"value": "seg01",
|
||||
"info": {
|
||||
"type": "TagEngineInfo",
|
||||
"id": "[uuid]",
|
||||
"sketch": "[uuid]",
|
||||
"path": {
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
103,
|
||||
142,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
19.93,
|
||||
15.040000000000001
|
||||
],
|
||||
"tag": {
|
||||
"end": 141,
|
||||
"start": 135,
|
||||
"type": "TagDeclarator",
|
||||
"value": "seg01"
|
||||
},
|
||||
"to": [
|
||||
23.08,
|
||||
5.190000000000001
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
"surface": {
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
103,
|
||||
142,
|
||||
0
|
||||
],
|
||||
"tag": {
|
||||
"end": 141,
|
||||
"start": 135,
|
||||
"type": "TagDeclarator",
|
||||
"value": "seg01"
|
||||
},
|
||||
"type": "extrudePlane"
|
||||
}
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
135,
|
||||
141,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"artifactId": "[uuid]",
|
||||
"originalId": "[uuid]",
|
||||
"units": {
|
||||
"type": "Mm"
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
35,
|
||||
67,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"height": 4.0,
|
||||
"startCapId": "[uuid]",
|
||||
"endCapId": "[uuid]",
|
||||
"units": {
|
||||
"type": "Mm"
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
35,
|
||||
67,
|
||||
135,
|
||||
141,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"seg01": {
|
||||
"type": "TagIdentifier",
|
||||
"type": "TagIdentifier",
|
||||
"value": "seg01",
|
||||
"info": {
|
||||
"type": "TagEngineInfo",
|
||||
"id": "[uuid]",
|
||||
"sketch": "[uuid]",
|
||||
"path": {
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
103,
|
||||
142,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
19.93,
|
||||
15.040000000000001
|
||||
],
|
||||
"tag": {
|
||||
"end": 141,
|
||||
"start": 135,
|
||||
"type": "TagDeclarator",
|
||||
"value": "seg01"
|
||||
},
|
||||
"to": [
|
||||
23.08,
|
||||
5.190000000000001
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
"surface": {
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
103,
|
||||
142,
|
||||
0
|
||||
],
|
||||
"tag": {
|
||||
"end": 141,
|
||||
"start": 135,
|
||||
"type": "TagDeclarator",
|
||||
"value": "seg01"
|
||||
},
|
||||
"type": "extrudePlane"
|
||||
}
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
135,
|
||||
141,
|
||||
0
|
||||
]
|
||||
}
|
||||
"artifactId": "[uuid]",
|
||||
"originalId": "[uuid]",
|
||||
"units": {
|
||||
"type": "Mm"
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
35,
|
||||
67,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"height": 4.0,
|
||||
"startCapId": "[uuid]",
|
||||
"endCapId": "[uuid]",
|
||||
"units": {
|
||||
"type": "Mm"
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
35,
|
||||
67,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"snapshots": [],
|
||||
"parent": null
|
||||
]
|
||||
}
|
||||
],
|
||||
"currentEnv": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"callStack": []
|
||||
},
|
||||
"seg01": {
|
||||
"type": "TagIdentifier",
|
||||
"type": "TagIdentifier",
|
||||
"value": "seg01",
|
||||
"info": {
|
||||
"type": "TagEngineInfo",
|
||||
"id": "[uuid]",
|
||||
"sketch": "[uuid]",
|
||||
"path": {
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
103,
|
||||
142,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
19.93,
|
||||
15.040000000000001
|
||||
],
|
||||
"tag": {
|
||||
"end": 141,
|
||||
"start": 135,
|
||||
"type": "TagDeclarator",
|
||||
"value": "seg01"
|
||||
},
|
||||
"to": [
|
||||
23.08,
|
||||
5.190000000000001
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
"surface": {
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
103,
|
||||
142,
|
||||
0
|
||||
],
|
||||
"tag": {
|
||||
"end": 141,
|
||||
"start": 135,
|
||||
"type": "TagDeclarator",
|
||||
"value": "seg01"
|
||||
},
|
||||
"type": "extrudePlane"
|
||||
}
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
135,
|
||||
141,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,172 +1,159 @@
|
||||
---
|
||||
source: kcl/src/simulation_tests.rs
|
||||
description: Program memory after executing array_elem_pop.kcl
|
||||
description: Variables in memory after executing array_elem_pop.kcl
|
||||
---
|
||||
{
|
||||
"environments": [
|
||||
{
|
||||
"bindings": {
|
||||
"HALF_TURN": {
|
||||
"type": "Number",
|
||||
"value": 180.0,
|
||||
"__meta": []
|
||||
},
|
||||
"QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 90.0,
|
||||
"__meta": []
|
||||
},
|
||||
"THREE_QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 270.0,
|
||||
"__meta": []
|
||||
},
|
||||
"ZERO": {
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": []
|
||||
},
|
||||
"arr": {
|
||||
"type": "Array",
|
||||
"value": [
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 1.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
7,
|
||||
8,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 2.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
10,
|
||||
11,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 3.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
13,
|
||||
14,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
6,
|
||||
15,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"new_arr1": {
|
||||
"type": "Array",
|
||||
"value": [
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 1.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
7,
|
||||
8,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 2.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
10,
|
||||
11,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
27,
|
||||
35,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"new_arr2": {
|
||||
"type": "Array",
|
||||
"value": [
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 1.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
7,
|
||||
8,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
47,
|
||||
60,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"new_arr3": {
|
||||
"type": "Array",
|
||||
"value": [],
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
72,
|
||||
85,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
"HALF_TURN": {
|
||||
"type": "Number",
|
||||
"value": 180.0,
|
||||
"__meta": []
|
||||
},
|
||||
"QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 90.0,
|
||||
"__meta": []
|
||||
},
|
||||
"THREE_QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 270.0,
|
||||
"__meta": []
|
||||
},
|
||||
"ZERO": {
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": []
|
||||
},
|
||||
"arr": {
|
||||
"type": "Array",
|
||||
"value": [
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 1.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
7,
|
||||
8,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"snapshots": [],
|
||||
"parent": null
|
||||
}
|
||||
],
|
||||
"currentEnv": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"callStack": []
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 2.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
10,
|
||||
11,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 3.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
13,
|
||||
14,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
6,
|
||||
15,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"new_arr1": {
|
||||
"type": "Array",
|
||||
"value": [
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 1.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
7,
|
||||
8,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 2.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
10,
|
||||
11,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
27,
|
||||
35,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"new_arr2": {
|
||||
"type": "Array",
|
||||
"value": [
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 1.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
7,
|
||||
8,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
47,
|
||||
60,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"new_arr3": {
|
||||
"type": "Array",
|
||||
"value": [],
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
72,
|
||||
85,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,237 +1,224 @@
|
||||
---
|
||||
source: kcl/src/simulation_tests.rs
|
||||
description: Program memory after executing array_elem_push.kcl
|
||||
description: Variables in memory after executing array_elem_push.kcl
|
||||
---
|
||||
{
|
||||
"environments": [
|
||||
{
|
||||
"bindings": {
|
||||
"HALF_TURN": {
|
||||
"type": "Number",
|
||||
"value": 180.0,
|
||||
"__meta": []
|
||||
},
|
||||
"QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 90.0,
|
||||
"__meta": []
|
||||
},
|
||||
"THREE_QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 270.0,
|
||||
"__meta": []
|
||||
},
|
||||
"ZERO": {
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": []
|
||||
},
|
||||
"arr": {
|
||||
"type": "Array",
|
||||
"value": [
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 1.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
7,
|
||||
8,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 2.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
10,
|
||||
11,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 3.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
13,
|
||||
14,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
6,
|
||||
15,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"new_arr1": {
|
||||
"type": "Array",
|
||||
"value": [
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 1.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
7,
|
||||
8,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 2.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
10,
|
||||
11,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 3.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
13,
|
||||
14,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 4.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
37,
|
||||
38,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
27,
|
||||
39,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"new_arr2": {
|
||||
"type": "Array",
|
||||
"value": [
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 1.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
7,
|
||||
8,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 2.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
10,
|
||||
11,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 3.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
13,
|
||||
14,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 4.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
37,
|
||||
38,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 5.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
66,
|
||||
67,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
51,
|
||||
68,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
"HALF_TURN": {
|
||||
"type": "Number",
|
||||
"value": 180.0,
|
||||
"__meta": []
|
||||
},
|
||||
"QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 90.0,
|
||||
"__meta": []
|
||||
},
|
||||
"THREE_QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 270.0,
|
||||
"__meta": []
|
||||
},
|
||||
"ZERO": {
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": []
|
||||
},
|
||||
"arr": {
|
||||
"type": "Array",
|
||||
"value": [
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 1.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
7,
|
||||
8,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"snapshots": [],
|
||||
"parent": null
|
||||
}
|
||||
],
|
||||
"currentEnv": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"callStack": []
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 2.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
10,
|
||||
11,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 3.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
13,
|
||||
14,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
6,
|
||||
15,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"new_arr1": {
|
||||
"type": "Array",
|
||||
"value": [
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 1.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
7,
|
||||
8,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 2.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
10,
|
||||
11,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 3.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
13,
|
||||
14,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 4.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
37,
|
||||
38,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
27,
|
||||
39,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"new_arr2": {
|
||||
"type": "Array",
|
||||
"value": [
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 1.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
7,
|
||||
8,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 2.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
10,
|
||||
11,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 3.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
13,
|
||||
14,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 4.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
37,
|
||||
38,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 5.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
66,
|
||||
67,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
51,
|
||||
68,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,394 +1,381 @@
|
||||
---
|
||||
source: kcl/src/simulation_tests.rs
|
||||
description: Program memory after executing array_range_expr.kcl
|
||||
description: Variables in memory after executing array_range_expr.kcl
|
||||
---
|
||||
{
|
||||
"environments": [
|
||||
{
|
||||
"bindings": {
|
||||
"HALF_TURN": {
|
||||
"type": "Number",
|
||||
"value": 180.0,
|
||||
"__meta": []
|
||||
},
|
||||
"QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 90.0,
|
||||
"__meta": []
|
||||
},
|
||||
"THREE_QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 270.0,
|
||||
"__meta": []
|
||||
},
|
||||
"ZERO": {
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": []
|
||||
},
|
||||
"five": {
|
||||
"type": "Number",
|
||||
"value": 5.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
175,
|
||||
188,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"four": {
|
||||
"type": "Number",
|
||||
"value": 4.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
79,
|
||||
80,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"r1": {
|
||||
"type": "Array",
|
||||
"value": [
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
11,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 1,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
11,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 2,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
11,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 3,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
11,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 4,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
11,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
11,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"r2": {
|
||||
"type": "Array",
|
||||
"value": [
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
95,
|
||||
107,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 1,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
95,
|
||||
107,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 2,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
95,
|
||||
107,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 3,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
95,
|
||||
107,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 4,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
95,
|
||||
107,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
95,
|
||||
107,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"r3": {
|
||||
"type": "Array",
|
||||
"value": [
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
194,
|
||||
206,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 1,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
194,
|
||||
206,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 2,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
194,
|
||||
206,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 3,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
194,
|
||||
206,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 4,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
194,
|
||||
206,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 5,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
194,
|
||||
206,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
194,
|
||||
206,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"r4": {
|
||||
"type": "Array",
|
||||
"value": [
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 1,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
341,
|
||||
373,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 2,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
341,
|
||||
373,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 3,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
341,
|
||||
373,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 4,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
341,
|
||||
373,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
341,
|
||||
373,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"zero": {
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
88,
|
||||
89,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
"HALF_TURN": {
|
||||
"type": "Number",
|
||||
"value": 180.0,
|
||||
"__meta": []
|
||||
},
|
||||
"QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 90.0,
|
||||
"__meta": []
|
||||
},
|
||||
"THREE_QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 270.0,
|
||||
"__meta": []
|
||||
},
|
||||
"ZERO": {
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": []
|
||||
},
|
||||
"five": {
|
||||
"type": "Number",
|
||||
"value": 5.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
175,
|
||||
188,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"four": {
|
||||
"type": "Number",
|
||||
"value": 4.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
79,
|
||||
80,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"r1": {
|
||||
"type": "Array",
|
||||
"value": [
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
11,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"snapshots": [],
|
||||
"parent": null
|
||||
}
|
||||
],
|
||||
"currentEnv": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"callStack": []
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 1,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
11,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 2,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
11,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 3,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
11,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 4,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
11,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
11,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"r2": {
|
||||
"type": "Array",
|
||||
"value": [
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
95,
|
||||
107,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 1,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
95,
|
||||
107,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 2,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
95,
|
||||
107,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 3,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
95,
|
||||
107,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 4,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
95,
|
||||
107,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
95,
|
||||
107,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"r3": {
|
||||
"type": "Array",
|
||||
"value": [
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
194,
|
||||
206,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 1,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
194,
|
||||
206,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 2,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
194,
|
||||
206,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 3,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
194,
|
||||
206,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 4,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
194,
|
||||
206,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 5,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
194,
|
||||
206,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
194,
|
||||
206,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"r4": {
|
||||
"type": "Array",
|
||||
"value": [
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 1,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
341,
|
||||
373,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 2,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
341,
|
||||
373,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 3,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
341,
|
||||
373,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 4,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
341,
|
||||
373,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
341,
|
||||
373,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"zero": {
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
88,
|
||||
89,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,196 +1,183 @@
|
||||
---
|
||||
source: kcl/src/simulation_tests.rs
|
||||
description: Program memory after executing array_range_negative_expr.kcl
|
||||
description: Variables in memory after executing array_range_negative_expr.kcl
|
||||
---
|
||||
{
|
||||
"environments": [
|
||||
{
|
||||
"bindings": {
|
||||
"HALF_TURN": {
|
||||
"type": "Number",
|
||||
"value": 180.0,
|
||||
"__meta": []
|
||||
},
|
||||
"QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 90.0,
|
||||
"__meta": []
|
||||
},
|
||||
"THREE_QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 270.0,
|
||||
"__meta": []
|
||||
},
|
||||
"ZERO": {
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": []
|
||||
},
|
||||
"xs": {
|
||||
"type": "Array",
|
||||
"value": [
|
||||
{
|
||||
"type": "Int",
|
||||
"value": -5,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
19,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": -4,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
19,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": -3,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
19,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": -2,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
19,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": -1,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
19,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
19,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 1,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
19,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 2,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
19,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 3,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
19,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 4,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
19,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 5,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
19,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
19,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
"HALF_TURN": {
|
||||
"type": "Number",
|
||||
"value": 180.0,
|
||||
"__meta": []
|
||||
},
|
||||
"QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 90.0,
|
||||
"__meta": []
|
||||
},
|
||||
"THREE_QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 270.0,
|
||||
"__meta": []
|
||||
},
|
||||
"ZERO": {
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": []
|
||||
},
|
||||
"xs": {
|
||||
"type": "Array",
|
||||
"value": [
|
||||
{
|
||||
"type": "Int",
|
||||
"value": -5,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
19,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"snapshots": [],
|
||||
"parent": null
|
||||
}
|
||||
],
|
||||
"currentEnv": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"callStack": []
|
||||
{
|
||||
"type": "Int",
|
||||
"value": -4,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
19,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": -3,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
19,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": -2,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
19,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": -1,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
19,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
19,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 1,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
19,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 2,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
19,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 3,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
19,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 4,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
19,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 5,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
19,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
19,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,228 +1,214 @@
|
||||
---
|
||||
source: kcl/src/simulation_tests.rs
|
||||
description: Program memory after executing artifact_graph_example_code_offset_planes.kcl
|
||||
snapshot_kind: text
|
||||
description: Variables in memory after executing artifact_graph_example_code_offset_planes.kcl
|
||||
---
|
||||
{
|
||||
"environments": [
|
||||
{
|
||||
"bindings": {
|
||||
"HALF_TURN": {
|
||||
"type": "Number",
|
||||
"value": 180.0,
|
||||
"__meta": []
|
||||
},
|
||||
"QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 90.0,
|
||||
"__meta": []
|
||||
},
|
||||
"THREE_QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 270.0,
|
||||
"__meta": []
|
||||
},
|
||||
"ZERO": {
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": []
|
||||
},
|
||||
"offsetPlane001": {
|
||||
"type": "Plane",
|
||||
"value": {
|
||||
"HALF_TURN": {
|
||||
"type": "Number",
|
||||
"value": 180.0,
|
||||
"__meta": []
|
||||
},
|
||||
"QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 90.0,
|
||||
"__meta": []
|
||||
},
|
||||
"THREE_QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 270.0,
|
||||
"__meta": []
|
||||
},
|
||||
"ZERO": {
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": []
|
||||
},
|
||||
"offsetPlane001": {
|
||||
"type": "Plane",
|
||||
"value": {
|
||||
"id": "[uuid]",
|
||||
"artifactId": "[uuid]",
|
||||
"value": "Custom",
|
||||
"origin": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 20.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"
|
||||
},
|
||||
"__meta": []
|
||||
}
|
||||
},
|
||||
"offsetPlane002": {
|
||||
"type": "Plane",
|
||||
"value": {
|
||||
"id": "[uuid]",
|
||||
"artifactId": "[uuid]",
|
||||
"value": "Custom",
|
||||
"origin": {
|
||||
"x": 0.0,
|
||||
"y": 50.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"xAxis": {
|
||||
"x": 1.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"yAxis": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 1.0
|
||||
},
|
||||
"zAxis": {
|
||||
"x": 0.0,
|
||||
"y": -1.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"units": {
|
||||
"type": "Mm"
|
||||
},
|
||||
"__meta": []
|
||||
}
|
||||
},
|
||||
"offsetPlane003": {
|
||||
"type": "Plane",
|
||||
"value": {
|
||||
"id": "[uuid]",
|
||||
"artifactId": "[uuid]",
|
||||
"value": "Custom",
|
||||
"origin": {
|
||||
"x": 10.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"xAxis": {
|
||||
"x": 0.0,
|
||||
"y": 1.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"yAxis": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 1.0
|
||||
},
|
||||
"zAxis": {
|
||||
"x": 1.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"units": {
|
||||
"type": "Mm"
|
||||
},
|
||||
"__meta": []
|
||||
}
|
||||
},
|
||||
"sketch002": {
|
||||
"type": "Sketch",
|
||||
"value": {
|
||||
"type": "Sketch",
|
||||
"id": "[uuid]",
|
||||
"paths": [
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"artifactId": "[uuid]",
|
||||
"value": "Custom",
|
||||
"origin": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 20.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"
|
||||
},
|
||||
"__meta": []
|
||||
}
|
||||
},
|
||||
"offsetPlane002": {
|
||||
"type": "Plane",
|
||||
"value": {
|
||||
"id": "[uuid]",
|
||||
"artifactId": "[uuid]",
|
||||
"value": "Custom",
|
||||
"origin": {
|
||||
"x": 0.0,
|
||||
"y": 50.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"xAxis": {
|
||||
"x": 1.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"yAxis": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 1.0
|
||||
},
|
||||
"zAxis": {
|
||||
"x": 0.0,
|
||||
"y": -1.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"units": {
|
||||
"type": "Mm"
|
||||
},
|
||||
"__meta": []
|
||||
}
|
||||
},
|
||||
"offsetPlane003": {
|
||||
"type": "Plane",
|
||||
"value": {
|
||||
"id": "[uuid]",
|
||||
"artifactId": "[uuid]",
|
||||
"value": "Custom",
|
||||
"origin": {
|
||||
"x": 10.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"xAxis": {
|
||||
"x": 0.0,
|
||||
"y": 1.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"yAxis": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 1.0
|
||||
},
|
||||
"zAxis": {
|
||||
"x": 1.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"units": {
|
||||
"type": "Mm"
|
||||
},
|
||||
"__meta": []
|
||||
}
|
||||
},
|
||||
"sketch002": {
|
||||
"type": "Sketch",
|
||||
"value": {
|
||||
"type": "Sketch",
|
||||
"id": "[uuid]",
|
||||
"paths": [
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
197,
|
||||
222,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"tag": null,
|
||||
"to": [
|
||||
6.78,
|
||||
15.01
|
||||
],
|
||||
"type": "ToPoint"
|
||||
}
|
||||
],
|
||||
"on": {
|
||||
"type": "plane",
|
||||
"id": "[uuid]",
|
||||
"artifactId": "[uuid]",
|
||||
"value": "Custom",
|
||||
"origin": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 20.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"
|
||||
},
|
||||
"__meta": []
|
||||
},
|
||||
"start": {
|
||||
"from": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"to": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"tag": null,
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
166,
|
||||
191,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"artifactId": "[uuid]",
|
||||
"originalId": "[uuid]",
|
||||
"units": {
|
||||
"type": "Mm"
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
166,
|
||||
191,
|
||||
0
|
||||
]
|
||||
}
|
||||
"sourceRange": [
|
||||
197,
|
||||
222,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"from": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"tag": null,
|
||||
"to": [
|
||||
6.78,
|
||||
15.01
|
||||
],
|
||||
"type": "ToPoint"
|
||||
}
|
||||
],
|
||||
"on": {
|
||||
"type": "plane",
|
||||
"id": "[uuid]",
|
||||
"artifactId": "[uuid]",
|
||||
"value": "Custom",
|
||||
"origin": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 20.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"
|
||||
},
|
||||
"__meta": []
|
||||
},
|
||||
"start": {
|
||||
"from": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"to": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"tag": null,
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
166,
|
||||
191,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"snapshots": [],
|
||||
"parent": null
|
||||
"artifactId": "[uuid]",
|
||||
"originalId": "[uuid]",
|
||||
"units": {
|
||||
"type": "Mm"
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
166,
|
||||
191,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"currentEnv": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"callStack": []
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,39 +1,268 @@
|
||||
---
|
||||
source: kcl/src/simulation_tests.rs
|
||||
description: Program memory after executing basic_fillet_cube_end.kcl
|
||||
description: Variables in memory after executing basic_fillet_cube_end.kcl
|
||||
---
|
||||
{
|
||||
"environments": [
|
||||
{
|
||||
"bindings": {
|
||||
"HALF_TURN": {
|
||||
"type": "Number",
|
||||
"value": 180.0,
|
||||
"HALF_TURN": {
|
||||
"type": "Number",
|
||||
"value": 180.0,
|
||||
"__meta": []
|
||||
},
|
||||
"QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 90.0,
|
||||
"__meta": []
|
||||
},
|
||||
"THREE_QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 270.0,
|
||||
"__meta": []
|
||||
},
|
||||
"ZERO": {
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": []
|
||||
},
|
||||
"part001": {
|
||||
"type": "Solid",
|
||||
"value": {
|
||||
"type": "Solid",
|
||||
"id": "[uuid]",
|
||||
"artifactId": "[uuid]",
|
||||
"value": [
|
||||
{
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
99,
|
||||
0
|
||||
],
|
||||
"tag": {
|
||||
"end": 98,
|
||||
"start": 92,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing"
|
||||
},
|
||||
"type": "extrudePlane"
|
||||
},
|
||||
{
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
105,
|
||||
124,
|
||||
0
|
||||
],
|
||||
"tag": null,
|
||||
"type": "extrudePlane"
|
||||
},
|
||||
{
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
130,
|
||||
165,
|
||||
0
|
||||
],
|
||||
"tag": {
|
||||
"end": 164,
|
||||
"start": 157,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing2"
|
||||
},
|
||||
"type": "extrudePlane"
|
||||
},
|
||||
{
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
171,
|
||||
179,
|
||||
0
|
||||
],
|
||||
"tag": null,
|
||||
"type": "extrudePlane"
|
||||
}
|
||||
],
|
||||
"sketch": {
|
||||
"type": "Sketch",
|
||||
"id": "[uuid]",
|
||||
"paths": [
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
99,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"tag": {
|
||||
"end": 98,
|
||||
"start": 92,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing"
|
||||
},
|
||||
"to": [
|
||||
0.0,
|
||||
10.0
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
105,
|
||||
124,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
0.0,
|
||||
10.0
|
||||
],
|
||||
"tag": null,
|
||||
"to": [
|
||||
10.0,
|
||||
10.0
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
130,
|
||||
165,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
10.0,
|
||||
10.0
|
||||
],
|
||||
"tag": {
|
||||
"end": 164,
|
||||
"start": 157,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing2"
|
||||
},
|
||||
"to": [
|
||||
10.0,
|
||||
0.0
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
171,
|
||||
179,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
10.0,
|
||||
0.0
|
||||
],
|
||||
"tag": null,
|
||||
"to": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"type": "ToPoint"
|
||||
}
|
||||
],
|
||||
"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"
|
||||
},
|
||||
"__meta": []
|
||||
},
|
||||
"QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 90.0,
|
||||
"__meta": []
|
||||
},
|
||||
"THREE_QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 270.0,
|
||||
"__meta": []
|
||||
},
|
||||
"ZERO": {
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": []
|
||||
},
|
||||
"part001": {
|
||||
"type": "Solid",
|
||||
"value": {
|
||||
"type": "Solid",
|
||||
"start": {
|
||||
"from": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"to": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"tag": null,
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"artifactId": "[uuid]",
|
||||
"value": [
|
||||
{
|
||||
"sourceRange": [
|
||||
35,
|
||||
60,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"tags": {
|
||||
"thing": {
|
||||
"type": "TagIdentifier",
|
||||
"value": "thing",
|
||||
"info": {
|
||||
"type": "TagEngineInfo",
|
||||
"id": "[uuid]",
|
||||
"sketch": "[uuid]",
|
||||
"path": {
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
99,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"tag": {
|
||||
"end": 98,
|
||||
"start": 92,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing"
|
||||
},
|
||||
"to": [
|
||||
0.0,
|
||||
10.0
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
"surface": {
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
@ -48,19 +277,51 @@ description: Program memory after executing basic_fillet_cube_end.kcl
|
||||
"value": "thing"
|
||||
},
|
||||
"type": "extrudePlane"
|
||||
},
|
||||
}
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
105,
|
||||
124,
|
||||
92,
|
||||
98,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"thing2": {
|
||||
"type": "TagIdentifier",
|
||||
"value": "thing2",
|
||||
"info": {
|
||||
"type": "TagEngineInfo",
|
||||
"id": "[uuid]",
|
||||
"sketch": "[uuid]",
|
||||
"path": {
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
130,
|
||||
165,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
10.0,
|
||||
10.0
|
||||
],
|
||||
"tag": null,
|
||||
"type": "extrudePlane"
|
||||
"tag": {
|
||||
"end": 164,
|
||||
"start": 157,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing2"
|
||||
},
|
||||
"to": [
|
||||
10.0,
|
||||
0.0
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
{
|
||||
"surface": {
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
@ -75,459 +336,185 @@ description: Program memory after executing basic_fillet_cube_end.kcl
|
||||
"value": "thing2"
|
||||
},
|
||||
"type": "extrudePlane"
|
||||
},
|
||||
{
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
171,
|
||||
179,
|
||||
0
|
||||
],
|
||||
"tag": null,
|
||||
"type": "extrudePlane"
|
||||
}
|
||||
],
|
||||
"sketch": {
|
||||
"type": "Sketch",
|
||||
"id": "[uuid]",
|
||||
"paths": [
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
99,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"tag": {
|
||||
"end": 98,
|
||||
"start": 92,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing"
|
||||
},
|
||||
"to": [
|
||||
0.0,
|
||||
10.0
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
105,
|
||||
124,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
0.0,
|
||||
10.0
|
||||
],
|
||||
"tag": null,
|
||||
"to": [
|
||||
10.0,
|
||||
10.0
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
130,
|
||||
165,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
10.0,
|
||||
10.0
|
||||
],
|
||||
"tag": {
|
||||
"end": 164,
|
||||
"start": 157,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing2"
|
||||
},
|
||||
"to": [
|
||||
10.0,
|
||||
0.0
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
171,
|
||||
179,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
10.0,
|
||||
0.0
|
||||
],
|
||||
"tag": null,
|
||||
"to": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"type": "ToPoint"
|
||||
}
|
||||
],
|
||||
"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"
|
||||
},
|
||||
"__meta": []
|
||||
},
|
||||
"start": {
|
||||
"from": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"to": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"tag": null,
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
35,
|
||||
60,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"tags": {
|
||||
"thing": {
|
||||
"type": "TagIdentifier",
|
||||
"value": "thing",
|
||||
"info": {
|
||||
"type": "TagEngineInfo",
|
||||
"id": "[uuid]",
|
||||
"sketch": "[uuid]",
|
||||
"path": {
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
99,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"tag": {
|
||||
"end": 98,
|
||||
"start": 92,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing"
|
||||
},
|
||||
"to": [
|
||||
0.0,
|
||||
10.0
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
"surface": {
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
99,
|
||||
0
|
||||
],
|
||||
"tag": {
|
||||
"end": 98,
|
||||
"start": 92,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing"
|
||||
},
|
||||
"type": "extrudePlane"
|
||||
}
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
92,
|
||||
98,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"thing2": {
|
||||
"type": "TagIdentifier",
|
||||
"value": "thing2",
|
||||
"info": {
|
||||
"type": "TagEngineInfo",
|
||||
"id": "[uuid]",
|
||||
"sketch": "[uuid]",
|
||||
"path": {
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
130,
|
||||
165,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
10.0,
|
||||
10.0
|
||||
],
|
||||
"tag": {
|
||||
"end": 164,
|
||||
"start": 157,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing2"
|
||||
},
|
||||
"to": [
|
||||
10.0,
|
||||
0.0
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
"surface": {
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
130,
|
||||
165,
|
||||
0
|
||||
],
|
||||
"tag": {
|
||||
"end": 164,
|
||||
"start": 157,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing2"
|
||||
},
|
||||
"type": "extrudePlane"
|
||||
}
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
157,
|
||||
164,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"artifactId": "[uuid]",
|
||||
"originalId": "[uuid]",
|
||||
"units": {
|
||||
"type": "Mm"
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
35,
|
||||
60,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"height": 10.0,
|
||||
"startCapId": "[uuid]",
|
||||
"endCapId": "[uuid]",
|
||||
"edgeCuts": [
|
||||
{
|
||||
"type": "fillet",
|
||||
"id": "[uuid]",
|
||||
"radius": 2.0,
|
||||
"edgeId": "[uuid]",
|
||||
"tag": null
|
||||
},
|
||||
{
|
||||
"type": "fillet",
|
||||
"id": "[uuid]",
|
||||
"radius": 2.0,
|
||||
"edgeId": "[uuid]",
|
||||
"tag": null
|
||||
}
|
||||
],
|
||||
"units": {
|
||||
"type": "Mm"
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
35,
|
||||
60,
|
||||
157,
|
||||
164,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"thing": {
|
||||
"type": "TagIdentifier",
|
||||
"type": "TagIdentifier",
|
||||
"value": "thing",
|
||||
"info": {
|
||||
"type": "TagEngineInfo",
|
||||
"id": "[uuid]",
|
||||
"sketch": "[uuid]",
|
||||
"path": {
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
99,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"tag": {
|
||||
"end": 98,
|
||||
"start": 92,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing"
|
||||
},
|
||||
"to": [
|
||||
0.0,
|
||||
10.0
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
"surface": {
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
99,
|
||||
0
|
||||
],
|
||||
"tag": {
|
||||
"end": 98,
|
||||
"start": 92,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing"
|
||||
},
|
||||
"type": "extrudePlane"
|
||||
}
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
92,
|
||||
98,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
"artifactId": "[uuid]",
|
||||
"originalId": "[uuid]",
|
||||
"units": {
|
||||
"type": "Mm"
|
||||
},
|
||||
"thing2": {
|
||||
"type": "TagIdentifier",
|
||||
"type": "TagIdentifier",
|
||||
"value": "thing2",
|
||||
"info": {
|
||||
"type": "TagEngineInfo",
|
||||
"id": "[uuid]",
|
||||
"sketch": "[uuid]",
|
||||
"path": {
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
130,
|
||||
165,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
10.0,
|
||||
10.0
|
||||
],
|
||||
"tag": {
|
||||
"end": 164,
|
||||
"start": 157,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing2"
|
||||
},
|
||||
"to": [
|
||||
10.0,
|
||||
0.0
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
"surface": {
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
130,
|
||||
165,
|
||||
0
|
||||
],
|
||||
"tag": {
|
||||
"end": 164,
|
||||
"start": 157,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing2"
|
||||
},
|
||||
"type": "extrudePlane"
|
||||
}
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
157,
|
||||
164,
|
||||
0
|
||||
]
|
||||
}
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
35,
|
||||
60,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"height": 10.0,
|
||||
"startCapId": "[uuid]",
|
||||
"endCapId": "[uuid]",
|
||||
"edgeCuts": [
|
||||
{
|
||||
"type": "fillet",
|
||||
"id": "[uuid]",
|
||||
"radius": 2.0,
|
||||
"edgeId": "[uuid]",
|
||||
"tag": null
|
||||
},
|
||||
{
|
||||
"type": "fillet",
|
||||
"id": "[uuid]",
|
||||
"radius": 2.0,
|
||||
"edgeId": "[uuid]",
|
||||
"tag": null
|
||||
}
|
||||
],
|
||||
"units": {
|
||||
"type": "Mm"
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
35,
|
||||
60,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"snapshots": [],
|
||||
"parent": null
|
||||
]
|
||||
}
|
||||
],
|
||||
"currentEnv": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"callStack": []
|
||||
},
|
||||
"thing": {
|
||||
"type": "TagIdentifier",
|
||||
"type": "TagIdentifier",
|
||||
"value": "thing",
|
||||
"info": {
|
||||
"type": "TagEngineInfo",
|
||||
"id": "[uuid]",
|
||||
"sketch": "[uuid]",
|
||||
"path": {
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
99,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"tag": {
|
||||
"end": 98,
|
||||
"start": 92,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing"
|
||||
},
|
||||
"to": [
|
||||
0.0,
|
||||
10.0
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
"surface": {
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
99,
|
||||
0
|
||||
],
|
||||
"tag": {
|
||||
"end": 98,
|
||||
"start": 92,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing"
|
||||
},
|
||||
"type": "extrudePlane"
|
||||
}
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
92,
|
||||
98,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"thing2": {
|
||||
"type": "TagIdentifier",
|
||||
"type": "TagIdentifier",
|
||||
"value": "thing2",
|
||||
"info": {
|
||||
"type": "TagEngineInfo",
|
||||
"id": "[uuid]",
|
||||
"sketch": "[uuid]",
|
||||
"path": {
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
130,
|
||||
165,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
10.0,
|
||||
10.0
|
||||
],
|
||||
"tag": {
|
||||
"end": 164,
|
||||
"start": 157,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing2"
|
||||
},
|
||||
"to": [
|
||||
10.0,
|
||||
0.0
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
"surface": {
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
130,
|
||||
165,
|
||||
0
|
||||
],
|
||||
"tag": {
|
||||
"end": 164,
|
||||
"start": 157,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing2"
|
||||
},
|
||||
"type": "extrudePlane"
|
||||
}
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
157,
|
||||
164,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,39 +1,268 @@
|
||||
---
|
||||
source: kcl/src/simulation_tests.rs
|
||||
description: Program memory after executing basic_fillet_cube_start.kcl
|
||||
description: Variables in memory after executing basic_fillet_cube_start.kcl
|
||||
---
|
||||
{
|
||||
"environments": [
|
||||
{
|
||||
"bindings": {
|
||||
"HALF_TURN": {
|
||||
"type": "Number",
|
||||
"value": 180.0,
|
||||
"HALF_TURN": {
|
||||
"type": "Number",
|
||||
"value": 180.0,
|
||||
"__meta": []
|
||||
},
|
||||
"QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 90.0,
|
||||
"__meta": []
|
||||
},
|
||||
"THREE_QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 270.0,
|
||||
"__meta": []
|
||||
},
|
||||
"ZERO": {
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": []
|
||||
},
|
||||
"part001": {
|
||||
"type": "Solid",
|
||||
"value": {
|
||||
"type": "Solid",
|
||||
"id": "[uuid]",
|
||||
"artifactId": "[uuid]",
|
||||
"value": [
|
||||
{
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
99,
|
||||
0
|
||||
],
|
||||
"tag": {
|
||||
"end": 98,
|
||||
"start": 92,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing"
|
||||
},
|
||||
"type": "extrudePlane"
|
||||
},
|
||||
{
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
105,
|
||||
124,
|
||||
0
|
||||
],
|
||||
"tag": null,
|
||||
"type": "extrudePlane"
|
||||
},
|
||||
{
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
130,
|
||||
165,
|
||||
0
|
||||
],
|
||||
"tag": {
|
||||
"end": 164,
|
||||
"start": 157,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing2"
|
||||
},
|
||||
"type": "extrudePlane"
|
||||
},
|
||||
{
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
171,
|
||||
179,
|
||||
0
|
||||
],
|
||||
"tag": null,
|
||||
"type": "extrudePlane"
|
||||
}
|
||||
],
|
||||
"sketch": {
|
||||
"type": "Sketch",
|
||||
"id": "[uuid]",
|
||||
"paths": [
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
99,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"tag": {
|
||||
"end": 98,
|
||||
"start": 92,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing"
|
||||
},
|
||||
"to": [
|
||||
0.0,
|
||||
10.0
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
105,
|
||||
124,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
0.0,
|
||||
10.0
|
||||
],
|
||||
"tag": null,
|
||||
"to": [
|
||||
10.0,
|
||||
10.0
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
130,
|
||||
165,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
10.0,
|
||||
10.0
|
||||
],
|
||||
"tag": {
|
||||
"end": 164,
|
||||
"start": 157,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing2"
|
||||
},
|
||||
"to": [
|
||||
10.0,
|
||||
0.0
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
171,
|
||||
179,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
10.0,
|
||||
0.0
|
||||
],
|
||||
"tag": null,
|
||||
"to": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"type": "ToPoint"
|
||||
}
|
||||
],
|
||||
"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"
|
||||
},
|
||||
"__meta": []
|
||||
},
|
||||
"QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 90.0,
|
||||
"__meta": []
|
||||
},
|
||||
"THREE_QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 270.0,
|
||||
"__meta": []
|
||||
},
|
||||
"ZERO": {
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": []
|
||||
},
|
||||
"part001": {
|
||||
"type": "Solid",
|
||||
"value": {
|
||||
"type": "Solid",
|
||||
"start": {
|
||||
"from": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"to": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"tag": null,
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"artifactId": "[uuid]",
|
||||
"value": [
|
||||
{
|
||||
"sourceRange": [
|
||||
35,
|
||||
60,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"tags": {
|
||||
"thing": {
|
||||
"type": "TagIdentifier",
|
||||
"value": "thing",
|
||||
"info": {
|
||||
"type": "TagEngineInfo",
|
||||
"id": "[uuid]",
|
||||
"sketch": "[uuid]",
|
||||
"path": {
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
99,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"tag": {
|
||||
"end": 98,
|
||||
"start": 92,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing"
|
||||
},
|
||||
"to": [
|
||||
0.0,
|
||||
10.0
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
"surface": {
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
@ -48,19 +277,51 @@ description: Program memory after executing basic_fillet_cube_start.kcl
|
||||
"value": "thing"
|
||||
},
|
||||
"type": "extrudePlane"
|
||||
},
|
||||
}
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
105,
|
||||
124,
|
||||
92,
|
||||
98,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"thing2": {
|
||||
"type": "TagIdentifier",
|
||||
"value": "thing2",
|
||||
"info": {
|
||||
"type": "TagEngineInfo",
|
||||
"id": "[uuid]",
|
||||
"sketch": "[uuid]",
|
||||
"path": {
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
130,
|
||||
165,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
10.0,
|
||||
10.0
|
||||
],
|
||||
"tag": null,
|
||||
"type": "extrudePlane"
|
||||
"tag": {
|
||||
"end": 164,
|
||||
"start": 157,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing2"
|
||||
},
|
||||
"to": [
|
||||
10.0,
|
||||
0.0
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
{
|
||||
"surface": {
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
@ -75,459 +336,185 @@ description: Program memory after executing basic_fillet_cube_start.kcl
|
||||
"value": "thing2"
|
||||
},
|
||||
"type": "extrudePlane"
|
||||
},
|
||||
{
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
171,
|
||||
179,
|
||||
0
|
||||
],
|
||||
"tag": null,
|
||||
"type": "extrudePlane"
|
||||
}
|
||||
],
|
||||
"sketch": {
|
||||
"type": "Sketch",
|
||||
"id": "[uuid]",
|
||||
"paths": [
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
99,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"tag": {
|
||||
"end": 98,
|
||||
"start": 92,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing"
|
||||
},
|
||||
"to": [
|
||||
0.0,
|
||||
10.0
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
105,
|
||||
124,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
0.0,
|
||||
10.0
|
||||
],
|
||||
"tag": null,
|
||||
"to": [
|
||||
10.0,
|
||||
10.0
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
130,
|
||||
165,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
10.0,
|
||||
10.0
|
||||
],
|
||||
"tag": {
|
||||
"end": 164,
|
||||
"start": 157,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing2"
|
||||
},
|
||||
"to": [
|
||||
10.0,
|
||||
0.0
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
171,
|
||||
179,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
10.0,
|
||||
0.0
|
||||
],
|
||||
"tag": null,
|
||||
"to": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"type": "ToPoint"
|
||||
}
|
||||
],
|
||||
"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"
|
||||
},
|
||||
"__meta": []
|
||||
},
|
||||
"start": {
|
||||
"from": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"to": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"tag": null,
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
35,
|
||||
60,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"tags": {
|
||||
"thing": {
|
||||
"type": "TagIdentifier",
|
||||
"value": "thing",
|
||||
"info": {
|
||||
"type": "TagEngineInfo",
|
||||
"id": "[uuid]",
|
||||
"sketch": "[uuid]",
|
||||
"path": {
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
99,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"tag": {
|
||||
"end": 98,
|
||||
"start": 92,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing"
|
||||
},
|
||||
"to": [
|
||||
0.0,
|
||||
10.0
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
"surface": {
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
99,
|
||||
0
|
||||
],
|
||||
"tag": {
|
||||
"end": 98,
|
||||
"start": 92,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing"
|
||||
},
|
||||
"type": "extrudePlane"
|
||||
}
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
92,
|
||||
98,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"thing2": {
|
||||
"type": "TagIdentifier",
|
||||
"value": "thing2",
|
||||
"info": {
|
||||
"type": "TagEngineInfo",
|
||||
"id": "[uuid]",
|
||||
"sketch": "[uuid]",
|
||||
"path": {
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
130,
|
||||
165,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
10.0,
|
||||
10.0
|
||||
],
|
||||
"tag": {
|
||||
"end": 164,
|
||||
"start": 157,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing2"
|
||||
},
|
||||
"to": [
|
||||
10.0,
|
||||
0.0
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
"surface": {
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
130,
|
||||
165,
|
||||
0
|
||||
],
|
||||
"tag": {
|
||||
"end": 164,
|
||||
"start": 157,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing2"
|
||||
},
|
||||
"type": "extrudePlane"
|
||||
}
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
157,
|
||||
164,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"artifactId": "[uuid]",
|
||||
"originalId": "[uuid]",
|
||||
"units": {
|
||||
"type": "Mm"
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
35,
|
||||
60,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"height": 10.0,
|
||||
"startCapId": "[uuid]",
|
||||
"endCapId": "[uuid]",
|
||||
"edgeCuts": [
|
||||
{
|
||||
"type": "fillet",
|
||||
"id": "[uuid]",
|
||||
"radius": 2.0,
|
||||
"edgeId": "[uuid]",
|
||||
"tag": null
|
||||
},
|
||||
{
|
||||
"type": "fillet",
|
||||
"id": "[uuid]",
|
||||
"radius": 2.0,
|
||||
"edgeId": "[uuid]",
|
||||
"tag": null
|
||||
}
|
||||
],
|
||||
"units": {
|
||||
"type": "Mm"
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
35,
|
||||
60,
|
||||
157,
|
||||
164,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"thing": {
|
||||
"type": "TagIdentifier",
|
||||
"type": "TagIdentifier",
|
||||
"value": "thing",
|
||||
"info": {
|
||||
"type": "TagEngineInfo",
|
||||
"id": "[uuid]",
|
||||
"sketch": "[uuid]",
|
||||
"path": {
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
99,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"tag": {
|
||||
"end": 98,
|
||||
"start": 92,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing"
|
||||
},
|
||||
"to": [
|
||||
0.0,
|
||||
10.0
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
"surface": {
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
99,
|
||||
0
|
||||
],
|
||||
"tag": {
|
||||
"end": 98,
|
||||
"start": 92,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing"
|
||||
},
|
||||
"type": "extrudePlane"
|
||||
}
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
92,
|
||||
98,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
"artifactId": "[uuid]",
|
||||
"originalId": "[uuid]",
|
||||
"units": {
|
||||
"type": "Mm"
|
||||
},
|
||||
"thing2": {
|
||||
"type": "TagIdentifier",
|
||||
"type": "TagIdentifier",
|
||||
"value": "thing2",
|
||||
"info": {
|
||||
"type": "TagEngineInfo",
|
||||
"id": "[uuid]",
|
||||
"sketch": "[uuid]",
|
||||
"path": {
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
130,
|
||||
165,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
10.0,
|
||||
10.0
|
||||
],
|
||||
"tag": {
|
||||
"end": 164,
|
||||
"start": 157,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing2"
|
||||
},
|
||||
"to": [
|
||||
10.0,
|
||||
0.0
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
"surface": {
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
130,
|
||||
165,
|
||||
0
|
||||
],
|
||||
"tag": {
|
||||
"end": 164,
|
||||
"start": 157,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing2"
|
||||
},
|
||||
"type": "extrudePlane"
|
||||
}
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
157,
|
||||
164,
|
||||
0
|
||||
]
|
||||
}
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
35,
|
||||
60,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"height": 10.0,
|
||||
"startCapId": "[uuid]",
|
||||
"endCapId": "[uuid]",
|
||||
"edgeCuts": [
|
||||
{
|
||||
"type": "fillet",
|
||||
"id": "[uuid]",
|
||||
"radius": 2.0,
|
||||
"edgeId": "[uuid]",
|
||||
"tag": null
|
||||
},
|
||||
{
|
||||
"type": "fillet",
|
||||
"id": "[uuid]",
|
||||
"radius": 2.0,
|
||||
"edgeId": "[uuid]",
|
||||
"tag": null
|
||||
}
|
||||
],
|
||||
"units": {
|
||||
"type": "Mm"
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
35,
|
||||
60,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"snapshots": [],
|
||||
"parent": null
|
||||
]
|
||||
}
|
||||
],
|
||||
"currentEnv": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"callStack": []
|
||||
},
|
||||
"thing": {
|
||||
"type": "TagIdentifier",
|
||||
"type": "TagIdentifier",
|
||||
"value": "thing",
|
||||
"info": {
|
||||
"type": "TagEngineInfo",
|
||||
"id": "[uuid]",
|
||||
"sketch": "[uuid]",
|
||||
"path": {
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
99,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"tag": {
|
||||
"end": 98,
|
||||
"start": 92,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing"
|
||||
},
|
||||
"to": [
|
||||
0.0,
|
||||
10.0
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
"surface": {
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
99,
|
||||
0
|
||||
],
|
||||
"tag": {
|
||||
"end": 98,
|
||||
"start": 92,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing"
|
||||
},
|
||||
"type": "extrudePlane"
|
||||
}
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
92,
|
||||
98,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"thing2": {
|
||||
"type": "TagIdentifier",
|
||||
"type": "TagIdentifier",
|
||||
"value": "thing2",
|
||||
"info": {
|
||||
"type": "TagEngineInfo",
|
||||
"id": "[uuid]",
|
||||
"sketch": "[uuid]",
|
||||
"path": {
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
130,
|
||||
165,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
10.0,
|
||||
10.0
|
||||
],
|
||||
"tag": {
|
||||
"end": 164,
|
||||
"start": 157,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing2"
|
||||
},
|
||||
"to": [
|
||||
10.0,
|
||||
0.0
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
"surface": {
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
130,
|
||||
165,
|
||||
0
|
||||
],
|
||||
"tag": {
|
||||
"end": 164,
|
||||
"start": 157,
|
||||
"type": "TagDeclarator",
|
||||
"value": "thing2"
|
||||
},
|
||||
"type": "extrudePlane"
|
||||
}
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
157,
|
||||
164,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,39 +1,227 @@
|
||||
---
|
||||
source: kcl/src/simulation_tests.rs
|
||||
description: Program memory after executing big_number_angle_to_match_length_x.kcl
|
||||
description: Variables in memory after executing big_number_angle_to_match_length_x.kcl
|
||||
---
|
||||
{
|
||||
"environments": [
|
||||
{
|
||||
"bindings": {
|
||||
"HALF_TURN": {
|
||||
"type": "Number",
|
||||
"value": 180.0,
|
||||
"HALF_TURN": {
|
||||
"type": "Number",
|
||||
"value": 180.0,
|
||||
"__meta": []
|
||||
},
|
||||
"QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 90.0,
|
||||
"__meta": []
|
||||
},
|
||||
"THREE_QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 270.0,
|
||||
"__meta": []
|
||||
},
|
||||
"ZERO": {
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": []
|
||||
},
|
||||
"part001": {
|
||||
"type": "Solid",
|
||||
"value": {
|
||||
"type": "Solid",
|
||||
"id": "[uuid]",
|
||||
"artifactId": "[uuid]",
|
||||
"value": [
|
||||
{
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
101,
|
||||
0
|
||||
],
|
||||
"tag": {
|
||||
"end": 100,
|
||||
"start": 94,
|
||||
"type": "TagDeclarator",
|
||||
"value": "seg01"
|
||||
},
|
||||
"type": "extrudePlane"
|
||||
},
|
||||
{
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
107,
|
||||
163,
|
||||
0
|
||||
],
|
||||
"tag": null,
|
||||
"type": "extrudePlane"
|
||||
},
|
||||
{
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
169,
|
||||
177,
|
||||
0
|
||||
],
|
||||
"tag": null,
|
||||
"type": "extrudePlane"
|
||||
}
|
||||
],
|
||||
"sketch": {
|
||||
"type": "Sketch",
|
||||
"id": "[uuid]",
|
||||
"paths": [
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
101,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"tag": {
|
||||
"end": 100,
|
||||
"start": 94,
|
||||
"type": "TagDeclarator",
|
||||
"value": "seg01"
|
||||
},
|
||||
"to": [
|
||||
1.0,
|
||||
3.82
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
107,
|
||||
163,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
1.0,
|
||||
3.82
|
||||
],
|
||||
"tag": null,
|
||||
"to": [
|
||||
3.0,
|
||||
0.4152
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
169,
|
||||
177,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
3.0,
|
||||
0.4152
|
||||
],
|
||||
"tag": null,
|
||||
"to": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"type": "ToPoint"
|
||||
}
|
||||
],
|
||||
"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"
|
||||
},
|
||||
"__meta": []
|
||||
},
|
||||
"QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 90.0,
|
||||
"__meta": []
|
||||
},
|
||||
"THREE_QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 270.0,
|
||||
"__meta": []
|
||||
},
|
||||
"ZERO": {
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": []
|
||||
},
|
||||
"part001": {
|
||||
"type": "Solid",
|
||||
"value": {
|
||||
"type": "Solid",
|
||||
"start": {
|
||||
"from": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"to": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"tag": null,
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"artifactId": "[uuid]",
|
||||
"value": [
|
||||
{
|
||||
"sourceRange": [
|
||||
35,
|
||||
60,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"tags": {
|
||||
"seg01": {
|
||||
"type": "TagIdentifier",
|
||||
"value": "seg01",
|
||||
"info": {
|
||||
"type": "TagEngineInfo",
|
||||
"id": "[uuid]",
|
||||
"sketch": "[uuid]",
|
||||
"path": {
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
101,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"tag": {
|
||||
"end": 100,
|
||||
"start": 94,
|
||||
"type": "TagDeclarator",
|
||||
"value": "seg01"
|
||||
},
|
||||
"to": [
|
||||
1.0,
|
||||
3.82
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
"surface": {
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
@ -48,310 +236,109 @@ description: Program memory after executing big_number_angle_to_match_length_x.k
|
||||
"value": "seg01"
|
||||
},
|
||||
"type": "extrudePlane"
|
||||
},
|
||||
{
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
107,
|
||||
163,
|
||||
0
|
||||
],
|
||||
"tag": null,
|
||||
"type": "extrudePlane"
|
||||
},
|
||||
{
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
169,
|
||||
177,
|
||||
0
|
||||
],
|
||||
"tag": null,
|
||||
"type": "extrudePlane"
|
||||
}
|
||||
],
|
||||
"sketch": {
|
||||
"type": "Sketch",
|
||||
"id": "[uuid]",
|
||||
"paths": [
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
101,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"tag": {
|
||||
"end": 100,
|
||||
"start": 94,
|
||||
"type": "TagDeclarator",
|
||||
"value": "seg01"
|
||||
},
|
||||
"to": [
|
||||
1.0,
|
||||
3.82
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
107,
|
||||
163,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
1.0,
|
||||
3.82
|
||||
],
|
||||
"tag": null,
|
||||
"to": [
|
||||
3.0,
|
||||
0.4152
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
169,
|
||||
177,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
3.0,
|
||||
0.4152
|
||||
],
|
||||
"tag": null,
|
||||
"to": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"type": "ToPoint"
|
||||
}
|
||||
],
|
||||
"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"
|
||||
},
|
||||
"__meta": []
|
||||
},
|
||||
"start": {
|
||||
"from": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"to": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"tag": null,
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
35,
|
||||
60,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"tags": {
|
||||
"seg01": {
|
||||
"type": "TagIdentifier",
|
||||
"value": "seg01",
|
||||
"info": {
|
||||
"type": "TagEngineInfo",
|
||||
"id": "[uuid]",
|
||||
"sketch": "[uuid]",
|
||||
"path": {
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
101,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"tag": {
|
||||
"end": 100,
|
||||
"start": 94,
|
||||
"type": "TagDeclarator",
|
||||
"value": "seg01"
|
||||
},
|
||||
"to": [
|
||||
1.0,
|
||||
3.82
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
"surface": {
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
101,
|
||||
0
|
||||
],
|
||||
"tag": {
|
||||
"end": 100,
|
||||
"start": 94,
|
||||
"type": "TagDeclarator",
|
||||
"value": "seg01"
|
||||
},
|
||||
"type": "extrudePlane"
|
||||
}
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
94,
|
||||
100,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"artifactId": "[uuid]",
|
||||
"originalId": "[uuid]",
|
||||
"units": {
|
||||
"type": "Mm"
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
35,
|
||||
60,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"height": 10.0,
|
||||
"startCapId": "[uuid]",
|
||||
"endCapId": "[uuid]",
|
||||
"units": {
|
||||
"type": "Mm"
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
35,
|
||||
60,
|
||||
94,
|
||||
100,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"seg01": {
|
||||
"type": "TagIdentifier",
|
||||
"type": "TagIdentifier",
|
||||
"value": "seg01",
|
||||
"info": {
|
||||
"type": "TagEngineInfo",
|
||||
"id": "[uuid]",
|
||||
"sketch": "[uuid]",
|
||||
"path": {
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
101,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"tag": {
|
||||
"end": 100,
|
||||
"start": 94,
|
||||
"type": "TagDeclarator",
|
||||
"value": "seg01"
|
||||
},
|
||||
"to": [
|
||||
1.0,
|
||||
3.82
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
"surface": {
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
101,
|
||||
0
|
||||
],
|
||||
"tag": {
|
||||
"end": 100,
|
||||
"start": 94,
|
||||
"type": "TagDeclarator",
|
||||
"value": "seg01"
|
||||
},
|
||||
"type": "extrudePlane"
|
||||
}
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
94,
|
||||
100,
|
||||
0
|
||||
]
|
||||
}
|
||||
"artifactId": "[uuid]",
|
||||
"originalId": "[uuid]",
|
||||
"units": {
|
||||
"type": "Mm"
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
35,
|
||||
60,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"height": 10.0,
|
||||
"startCapId": "[uuid]",
|
||||
"endCapId": "[uuid]",
|
||||
"units": {
|
||||
"type": "Mm"
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
35,
|
||||
60,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"snapshots": [],
|
||||
"parent": null
|
||||
]
|
||||
}
|
||||
],
|
||||
"currentEnv": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"callStack": []
|
||||
},
|
||||
"seg01": {
|
||||
"type": "TagIdentifier",
|
||||
"type": "TagIdentifier",
|
||||
"value": "seg01",
|
||||
"info": {
|
||||
"type": "TagEngineInfo",
|
||||
"id": "[uuid]",
|
||||
"sketch": "[uuid]",
|
||||
"path": {
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
101,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"tag": {
|
||||
"end": 100,
|
||||
"start": 94,
|
||||
"type": "TagDeclarator",
|
||||
"value": "seg01"
|
||||
},
|
||||
"to": [
|
||||
1.0,
|
||||
3.82
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
"surface": {
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
101,
|
||||
0
|
||||
],
|
||||
"tag": {
|
||||
"end": 100,
|
||||
"start": 94,
|
||||
"type": "TagDeclarator",
|
||||
"value": "seg01"
|
||||
},
|
||||
"type": "extrudePlane"
|
||||
}
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
94,
|
||||
100,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,39 +1,227 @@
|
||||
---
|
||||
source: kcl/src/simulation_tests.rs
|
||||
description: Program memory after executing big_number_angle_to_match_length_y.kcl
|
||||
description: Variables in memory after executing big_number_angle_to_match_length_y.kcl
|
||||
---
|
||||
{
|
||||
"environments": [
|
||||
{
|
||||
"bindings": {
|
||||
"HALF_TURN": {
|
||||
"type": "Number",
|
||||
"value": 180.0,
|
||||
"HALF_TURN": {
|
||||
"type": "Number",
|
||||
"value": 180.0,
|
||||
"__meta": []
|
||||
},
|
||||
"QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 90.0,
|
||||
"__meta": []
|
||||
},
|
||||
"THREE_QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 270.0,
|
||||
"__meta": []
|
||||
},
|
||||
"ZERO": {
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": []
|
||||
},
|
||||
"part001": {
|
||||
"type": "Solid",
|
||||
"value": {
|
||||
"type": "Solid",
|
||||
"id": "[uuid]",
|
||||
"artifactId": "[uuid]",
|
||||
"value": [
|
||||
{
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
101,
|
||||
0
|
||||
],
|
||||
"tag": {
|
||||
"end": 100,
|
||||
"start": 94,
|
||||
"type": "TagDeclarator",
|
||||
"value": "seg01"
|
||||
},
|
||||
"type": "extrudePlane"
|
||||
},
|
||||
{
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
107,
|
||||
163,
|
||||
0
|
||||
],
|
||||
"tag": null,
|
||||
"type": "extrudePlane"
|
||||
},
|
||||
{
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
169,
|
||||
177,
|
||||
0
|
||||
],
|
||||
"tag": null,
|
||||
"type": "extrudePlane"
|
||||
}
|
||||
],
|
||||
"sketch": {
|
||||
"type": "Sketch",
|
||||
"id": "[uuid]",
|
||||
"paths": [
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
101,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"tag": {
|
||||
"end": 100,
|
||||
"start": 94,
|
||||
"type": "TagDeclarator",
|
||||
"value": "seg01"
|
||||
},
|
||||
"to": [
|
||||
1.0,
|
||||
3.82
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
107,
|
||||
163,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
1.0,
|
||||
3.82
|
||||
],
|
||||
"tag": null,
|
||||
"to": [
|
||||
3.0,
|
||||
3.3954
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
169,
|
||||
177,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
3.0,
|
||||
3.3954
|
||||
],
|
||||
"tag": null,
|
||||
"to": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"type": "ToPoint"
|
||||
}
|
||||
],
|
||||
"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"
|
||||
},
|
||||
"__meta": []
|
||||
},
|
||||
"QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 90.0,
|
||||
"__meta": []
|
||||
},
|
||||
"THREE_QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 270.0,
|
||||
"__meta": []
|
||||
},
|
||||
"ZERO": {
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": []
|
||||
},
|
||||
"part001": {
|
||||
"type": "Solid",
|
||||
"value": {
|
||||
"type": "Solid",
|
||||
"start": {
|
||||
"from": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"to": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"tag": null,
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"artifactId": "[uuid]",
|
||||
"value": [
|
||||
{
|
||||
"sourceRange": [
|
||||
35,
|
||||
60,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"tags": {
|
||||
"seg01": {
|
||||
"type": "TagIdentifier",
|
||||
"value": "seg01",
|
||||
"info": {
|
||||
"type": "TagEngineInfo",
|
||||
"id": "[uuid]",
|
||||
"sketch": "[uuid]",
|
||||
"path": {
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
101,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"tag": {
|
||||
"end": 100,
|
||||
"start": 94,
|
||||
"type": "TagDeclarator",
|
||||
"value": "seg01"
|
||||
},
|
||||
"to": [
|
||||
1.0,
|
||||
3.82
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
"surface": {
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
@ -48,310 +236,109 @@ description: Program memory after executing big_number_angle_to_match_length_y.k
|
||||
"value": "seg01"
|
||||
},
|
||||
"type": "extrudePlane"
|
||||
},
|
||||
{
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
107,
|
||||
163,
|
||||
0
|
||||
],
|
||||
"tag": null,
|
||||
"type": "extrudePlane"
|
||||
},
|
||||
{
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
169,
|
||||
177,
|
||||
0
|
||||
],
|
||||
"tag": null,
|
||||
"type": "extrudePlane"
|
||||
}
|
||||
],
|
||||
"sketch": {
|
||||
"type": "Sketch",
|
||||
"id": "[uuid]",
|
||||
"paths": [
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
101,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"tag": {
|
||||
"end": 100,
|
||||
"start": 94,
|
||||
"type": "TagDeclarator",
|
||||
"value": "seg01"
|
||||
},
|
||||
"to": [
|
||||
1.0,
|
||||
3.82
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
107,
|
||||
163,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
1.0,
|
||||
3.82
|
||||
],
|
||||
"tag": null,
|
||||
"to": [
|
||||
3.0,
|
||||
3.3954
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
169,
|
||||
177,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
3.0,
|
||||
3.3954
|
||||
],
|
||||
"tag": null,
|
||||
"to": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"type": "ToPoint"
|
||||
}
|
||||
],
|
||||
"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"
|
||||
},
|
||||
"__meta": []
|
||||
},
|
||||
"start": {
|
||||
"from": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"to": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"tag": null,
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
35,
|
||||
60,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"tags": {
|
||||
"seg01": {
|
||||
"type": "TagIdentifier",
|
||||
"value": "seg01",
|
||||
"info": {
|
||||
"type": "TagEngineInfo",
|
||||
"id": "[uuid]",
|
||||
"sketch": "[uuid]",
|
||||
"path": {
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
101,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"tag": {
|
||||
"end": 100,
|
||||
"start": 94,
|
||||
"type": "TagDeclarator",
|
||||
"value": "seg01"
|
||||
},
|
||||
"to": [
|
||||
1.0,
|
||||
3.82
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
"surface": {
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
101,
|
||||
0
|
||||
],
|
||||
"tag": {
|
||||
"end": 100,
|
||||
"start": 94,
|
||||
"type": "TagDeclarator",
|
||||
"value": "seg01"
|
||||
},
|
||||
"type": "extrudePlane"
|
||||
}
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
94,
|
||||
100,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"artifactId": "[uuid]",
|
||||
"originalId": "[uuid]",
|
||||
"units": {
|
||||
"type": "Mm"
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
35,
|
||||
60,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"height": 10.0,
|
||||
"startCapId": "[uuid]",
|
||||
"endCapId": "[uuid]",
|
||||
"units": {
|
||||
"type": "Mm"
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
35,
|
||||
60,
|
||||
94,
|
||||
100,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"seg01": {
|
||||
"type": "TagIdentifier",
|
||||
"type": "TagIdentifier",
|
||||
"value": "seg01",
|
||||
"info": {
|
||||
"type": "TagEngineInfo",
|
||||
"id": "[uuid]",
|
||||
"sketch": "[uuid]",
|
||||
"path": {
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
101,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"tag": {
|
||||
"end": 100,
|
||||
"start": 94,
|
||||
"type": "TagDeclarator",
|
||||
"value": "seg01"
|
||||
},
|
||||
"to": [
|
||||
1.0,
|
||||
3.82
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
"surface": {
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
101,
|
||||
0
|
||||
],
|
||||
"tag": {
|
||||
"end": 100,
|
||||
"start": 94,
|
||||
"type": "TagDeclarator",
|
||||
"value": "seg01"
|
||||
},
|
||||
"type": "extrudePlane"
|
||||
}
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
94,
|
||||
100,
|
||||
0
|
||||
]
|
||||
}
|
||||
"artifactId": "[uuid]",
|
||||
"originalId": "[uuid]",
|
||||
"units": {
|
||||
"type": "Mm"
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
35,
|
||||
60,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"height": 10.0,
|
||||
"startCapId": "[uuid]",
|
||||
"endCapId": "[uuid]",
|
||||
"units": {
|
||||
"type": "Mm"
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
35,
|
||||
60,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"snapshots": [],
|
||||
"parent": null
|
||||
]
|
||||
}
|
||||
],
|
||||
"currentEnv": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"callStack": []
|
||||
},
|
||||
"seg01": {
|
||||
"type": "TagIdentifier",
|
||||
"type": "TagIdentifier",
|
||||
"value": "seg01",
|
||||
"info": {
|
||||
"type": "TagEngineInfo",
|
||||
"id": "[uuid]",
|
||||
"sketch": "[uuid]",
|
||||
"path": {
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
101,
|
||||
0
|
||||
]
|
||||
},
|
||||
"from": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"tag": {
|
||||
"end": 100,
|
||||
"start": 94,
|
||||
"type": "TagDeclarator",
|
||||
"value": "seg01"
|
||||
},
|
||||
"to": [
|
||||
1.0,
|
||||
3.82
|
||||
],
|
||||
"type": "ToPoint"
|
||||
},
|
||||
"surface": {
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
66,
|
||||
101,
|
||||
0
|
||||
],
|
||||
"tag": {
|
||||
"end": 100,
|
||||
"start": 94,
|
||||
"type": "TagDeclarator",
|
||||
"value": "seg01"
|
||||
},
|
||||
"type": "extrudePlane"
|
||||
}
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
94,
|
||||
100,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,171 +1,158 @@
|
||||
---
|
||||
source: kcl/src/simulation_tests.rs
|
||||
description: Program memory after executing boolean_logical_and.kcl
|
||||
description: Variables in memory after executing boolean_logical_and.kcl
|
||||
---
|
||||
{
|
||||
"environments": [
|
||||
{
|
||||
"bindings": {
|
||||
"HALF_TURN": {
|
||||
"type": "Number",
|
||||
"value": 180.0,
|
||||
"__meta": []
|
||||
},
|
||||
"QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 90.0,
|
||||
"__meta": []
|
||||
},
|
||||
"THREE_QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 270.0,
|
||||
"__meta": []
|
||||
},
|
||||
"ZERO": {
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": []
|
||||
},
|
||||
"a": {
|
||||
"type": "Number",
|
||||
"value": 2.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
45,
|
||||
46,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"aa": {
|
||||
"type": "Bool",
|
||||
"value": false,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
9,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
12,
|
||||
17,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"b": {
|
||||
"type": "Number",
|
||||
"value": 2.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
175,
|
||||
176,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"bb": {
|
||||
"type": "Bool",
|
||||
"value": false,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
135,
|
||||
140,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
143,
|
||||
147,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"c": {
|
||||
"type": "Number",
|
||||
"value": 1.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
290,
|
||||
291,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"cc": {
|
||||
"type": "Bool",
|
||||
"value": true,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
264,
|
||||
268,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
271,
|
||||
275,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"d": {
|
||||
"type": "Number",
|
||||
"value": 2.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
434,
|
||||
435,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"dd": {
|
||||
"type": "Bool",
|
||||
"value": false,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
393,
|
||||
398,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
401,
|
||||
406,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
"HALF_TURN": {
|
||||
"type": "Number",
|
||||
"value": 180.0,
|
||||
"__meta": []
|
||||
},
|
||||
"QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 90.0,
|
||||
"__meta": []
|
||||
},
|
||||
"THREE_QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 270.0,
|
||||
"__meta": []
|
||||
},
|
||||
"ZERO": {
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": []
|
||||
},
|
||||
"a": {
|
||||
"type": "Number",
|
||||
"value": 2.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
45,
|
||||
46,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"aa": {
|
||||
"type": "Bool",
|
||||
"value": false,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
9,
|
||||
0
|
||||
]
|
||||
},
|
||||
"snapshots": [],
|
||||
"parent": null
|
||||
}
|
||||
],
|
||||
"currentEnv": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"callStack": []
|
||||
{
|
||||
"sourceRange": [
|
||||
12,
|
||||
17,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"b": {
|
||||
"type": "Number",
|
||||
"value": 2.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
175,
|
||||
176,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"bb": {
|
||||
"type": "Bool",
|
||||
"value": false,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
135,
|
||||
140,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
143,
|
||||
147,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"c": {
|
||||
"type": "Number",
|
||||
"value": 1.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
290,
|
||||
291,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"cc": {
|
||||
"type": "Bool",
|
||||
"value": true,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
264,
|
||||
268,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
271,
|
||||
275,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"d": {
|
||||
"type": "Number",
|
||||
"value": 2.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
434,
|
||||
435,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"dd": {
|
||||
"type": "Bool",
|
||||
"value": false,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
393,
|
||||
398,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
401,
|
||||
406,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,133 +1,120 @@
|
||||
---
|
||||
source: kcl/src/simulation_tests.rs
|
||||
description: Program memory after executing boolean_logical_multiple.kcl
|
||||
description: Variables in memory after executing boolean_logical_multiple.kcl
|
||||
---
|
||||
{
|
||||
"environments": [
|
||||
{
|
||||
"bindings": {
|
||||
"HALF_TURN": {
|
||||
"type": "Number",
|
||||
"value": 180.0,
|
||||
"__meta": []
|
||||
},
|
||||
"QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 90.0,
|
||||
"__meta": []
|
||||
},
|
||||
"THREE_QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 270.0,
|
||||
"__meta": []
|
||||
},
|
||||
"ZERO": {
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": []
|
||||
},
|
||||
"i": {
|
||||
"type": "Number",
|
||||
"value": 1.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
40,
|
||||
41,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"ii": {
|
||||
"type": "Bool",
|
||||
"value": true,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
9,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
12,
|
||||
17,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
20,
|
||||
25,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"j": {
|
||||
"type": "Number",
|
||||
"value": 1.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
166,
|
||||
167,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"jj": {
|
||||
"type": "Bool",
|
||||
"value": true,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
115,
|
||||
120,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
123,
|
||||
127,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
130,
|
||||
136,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
139,
|
||||
144,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
147,
|
||||
151,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
"HALF_TURN": {
|
||||
"type": "Number",
|
||||
"value": 180.0,
|
||||
"__meta": []
|
||||
},
|
||||
"QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 90.0,
|
||||
"__meta": []
|
||||
},
|
||||
"THREE_QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 270.0,
|
||||
"__meta": []
|
||||
},
|
||||
"ZERO": {
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": []
|
||||
},
|
||||
"i": {
|
||||
"type": "Number",
|
||||
"value": 1.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
40,
|
||||
41,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"ii": {
|
||||
"type": "Bool",
|
||||
"value": true,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
9,
|
||||
0
|
||||
]
|
||||
},
|
||||
"snapshots": [],
|
||||
"parent": null
|
||||
}
|
||||
],
|
||||
"currentEnv": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"callStack": []
|
||||
{
|
||||
"sourceRange": [
|
||||
12,
|
||||
17,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
20,
|
||||
25,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"j": {
|
||||
"type": "Number",
|
||||
"value": 1.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
166,
|
||||
167,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"jj": {
|
||||
"type": "Bool",
|
||||
"value": true,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
115,
|
||||
120,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
123,
|
||||
127,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
130,
|
||||
136,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
139,
|
||||
144,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
147,
|
||||
151,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,171 +1,158 @@
|
||||
---
|
||||
source: kcl/src/simulation_tests.rs
|
||||
description: Program memory after executing boolean_logical_or.kcl
|
||||
description: Variables in memory after executing boolean_logical_or.kcl
|
||||
---
|
||||
{
|
||||
"environments": [
|
||||
{
|
||||
"bindings": {
|
||||
"HALF_TURN": {
|
||||
"type": "Number",
|
||||
"value": 180.0,
|
||||
"__meta": []
|
||||
},
|
||||
"QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 90.0,
|
||||
"__meta": []
|
||||
},
|
||||
"THREE_QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 270.0,
|
||||
"__meta": []
|
||||
},
|
||||
"ZERO": {
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": []
|
||||
},
|
||||
"a": {
|
||||
"type": "Number",
|
||||
"value": 1.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
32,
|
||||
33,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"aa": {
|
||||
"type": "Bool",
|
||||
"value": true,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
9,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
12,
|
||||
17,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"b": {
|
||||
"type": "Number",
|
||||
"value": 1.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
158,
|
||||
159,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"bb": {
|
||||
"type": "Bool",
|
||||
"value": true,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
131,
|
||||
136,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
139,
|
||||
143,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"c": {
|
||||
"type": "Number",
|
||||
"value": 1.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
284,
|
||||
285,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"cc": {
|
||||
"type": "Bool",
|
||||
"value": true,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
258,
|
||||
262,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
265,
|
||||
269,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"d": {
|
||||
"type": "Number",
|
||||
"value": 2.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
427,
|
||||
428,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"dd": {
|
||||
"type": "Bool",
|
||||
"value": false,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
386,
|
||||
391,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
394,
|
||||
399,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
"HALF_TURN": {
|
||||
"type": "Number",
|
||||
"value": 180.0,
|
||||
"__meta": []
|
||||
},
|
||||
"QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 90.0,
|
||||
"__meta": []
|
||||
},
|
||||
"THREE_QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 270.0,
|
||||
"__meta": []
|
||||
},
|
||||
"ZERO": {
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": []
|
||||
},
|
||||
"a": {
|
||||
"type": "Number",
|
||||
"value": 1.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
32,
|
||||
33,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"aa": {
|
||||
"type": "Bool",
|
||||
"value": true,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
5,
|
||||
9,
|
||||
0
|
||||
]
|
||||
},
|
||||
"snapshots": [],
|
||||
"parent": null
|
||||
}
|
||||
],
|
||||
"currentEnv": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"callStack": []
|
||||
{
|
||||
"sourceRange": [
|
||||
12,
|
||||
17,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"b": {
|
||||
"type": "Number",
|
||||
"value": 1.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
158,
|
||||
159,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"bb": {
|
||||
"type": "Bool",
|
||||
"value": true,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
131,
|
||||
136,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
139,
|
||||
143,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"c": {
|
||||
"type": "Number",
|
||||
"value": 1.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
284,
|
||||
285,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"cc": {
|
||||
"type": "Bool",
|
||||
"value": true,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
258,
|
||||
262,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
265,
|
||||
269,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"d": {
|
||||
"type": "Number",
|
||||
"value": 2.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
427,
|
||||
428,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"dd": {
|
||||
"type": "Bool",
|
||||
"value": false,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
386,
|
||||
391,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
394,
|
||||
399,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,171 +1,157 @@
|
||||
---
|
||||
source: kcl/src/simulation_tests.rs
|
||||
description: Program memory after executing circle_three_point.kcl
|
||||
snapshot_kind: text
|
||||
description: Variables in memory after executing circle_three_point.kcl
|
||||
---
|
||||
{
|
||||
"environments": [
|
||||
{
|
||||
"bindings": {
|
||||
"HALF_TURN": {
|
||||
"type": "Number",
|
||||
"value": 180.0,
|
||||
"__meta": []
|
||||
},
|
||||
"QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 90.0,
|
||||
"__meta": []
|
||||
},
|
||||
"THREE_QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 270.0,
|
||||
"__meta": []
|
||||
},
|
||||
"ZERO": {
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": []
|
||||
},
|
||||
"sketch001": {
|
||||
"type": "Solid",
|
||||
"value": {
|
||||
"type": "Solid",
|
||||
"id": "[uuid]",
|
||||
"artifactId": "[uuid]",
|
||||
"value": [
|
||||
{
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
37,
|
||||
98,
|
||||
0
|
||||
],
|
||||
"tag": null,
|
||||
"type": "extrudeArc"
|
||||
}
|
||||
],
|
||||
"sketch": {
|
||||
"type": "Sketch",
|
||||
"HALF_TURN": {
|
||||
"type": "Number",
|
||||
"value": 180.0,
|
||||
"__meta": []
|
||||
},
|
||||
"QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 90.0,
|
||||
"__meta": []
|
||||
},
|
||||
"THREE_QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 270.0,
|
||||
"__meta": []
|
||||
},
|
||||
"ZERO": {
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": []
|
||||
},
|
||||
"sketch001": {
|
||||
"type": "Solid",
|
||||
"value": {
|
||||
"type": "Solid",
|
||||
"id": "[uuid]",
|
||||
"artifactId": "[uuid]",
|
||||
"value": [
|
||||
{
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
37,
|
||||
98,
|
||||
0
|
||||
],
|
||||
"tag": null,
|
||||
"type": "extrudeArc"
|
||||
}
|
||||
],
|
||||
"sketch": {
|
||||
"type": "Sketch",
|
||||
"id": "[uuid]",
|
||||
"paths": [
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"paths": [
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
37,
|
||||
98,
|
||||
0
|
||||
]
|
||||
},
|
||||
"ccw": true,
|
||||
"center": [
|
||||
24.749999999999996,
|
||||
19.749999999999996
|
||||
],
|
||||
"from": [
|
||||
30.0059,
|
||||
19.75
|
||||
],
|
||||
"radius": 5.255949010407163,
|
||||
"tag": null,
|
||||
"to": [
|
||||
30.0059,
|
||||
19.75
|
||||
],
|
||||
"type": "Circle"
|
||||
}
|
||||
],
|
||||
"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"
|
||||
},
|
||||
"__meta": []
|
||||
},
|
||||
"start": {
|
||||
"from": [
|
||||
30.00594901040716,
|
||||
19.749999999999996
|
||||
],
|
||||
"to": [
|
||||
30.00594901040716,
|
||||
19.749999999999996
|
||||
],
|
||||
"tag": null,
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
37,
|
||||
98,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"artifactId": "[uuid]",
|
||||
"originalId": "[uuid]",
|
||||
"units": {
|
||||
"type": "Mm"
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
37,
|
||||
98,
|
||||
0
|
||||
]
|
||||
}
|
||||
"sourceRange": [
|
||||
37,
|
||||
98,
|
||||
0
|
||||
]
|
||||
},
|
||||
"height": 10.0,
|
||||
"startCapId": "[uuid]",
|
||||
"endCapId": "[uuid]",
|
||||
"units": {
|
||||
"type": "Mm"
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
37,
|
||||
98,
|
||||
0
|
||||
]
|
||||
}
|
||||
"ccw": true,
|
||||
"center": [
|
||||
24.749999999999996,
|
||||
19.749999999999996
|
||||
],
|
||||
"from": [
|
||||
30.0059,
|
||||
19.75
|
||||
],
|
||||
"radius": 5.255949010407163,
|
||||
"tag": null,
|
||||
"to": [
|
||||
30.0059,
|
||||
19.75
|
||||
],
|
||||
"type": "Circle"
|
||||
}
|
||||
],
|
||||
"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"
|
||||
},
|
||||
"__meta": []
|
||||
},
|
||||
"start": {
|
||||
"from": [
|
||||
30.00594901040716,
|
||||
19.749999999999996
|
||||
],
|
||||
"to": [
|
||||
30.00594901040716,
|
||||
19.749999999999996
|
||||
],
|
||||
"tag": null,
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
37,
|
||||
98,
|
||||
0
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"artifactId": "[uuid]",
|
||||
"originalId": "[uuid]",
|
||||
"units": {
|
||||
"type": "Mm"
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
37,
|
||||
98,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"snapshots": [],
|
||||
"parent": null
|
||||
"height": 10.0,
|
||||
"startCapId": "[uuid]",
|
||||
"endCapId": "[uuid]",
|
||||
"units": {
|
||||
"type": "Mm"
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
37,
|
||||
98,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"currentEnv": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"callStack": []
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,39 +1,26 @@
|
||||
---
|
||||
source: kcl/src/simulation_tests.rs
|
||||
description: Program memory after executing comparisons.kcl
|
||||
description: Variables in memory after executing comparisons.kcl
|
||||
---
|
||||
{
|
||||
"environments": [
|
||||
{
|
||||
"bindings": {
|
||||
"HALF_TURN": {
|
||||
"type": "Number",
|
||||
"value": 180.0,
|
||||
"__meta": []
|
||||
},
|
||||
"QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 90.0,
|
||||
"__meta": []
|
||||
},
|
||||
"THREE_QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 270.0,
|
||||
"__meta": []
|
||||
},
|
||||
"ZERO": {
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": []
|
||||
}
|
||||
},
|
||||
"snapshots": [],
|
||||
"parent": null
|
||||
}
|
||||
],
|
||||
"currentEnv": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"callStack": []
|
||||
"HALF_TURN": {
|
||||
"type": "Number",
|
||||
"value": 180.0,
|
||||
"__meta": []
|
||||
},
|
||||
"QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 90.0,
|
||||
"__meta": []
|
||||
},
|
||||
"THREE_QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 270.0,
|
||||
"__meta": []
|
||||
},
|
||||
"ZERO": {
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": []
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,197 +1,184 @@
|
||||
---
|
||||
source: kcl/src/simulation_tests.rs
|
||||
description: Program memory after executing computed_var.kcl
|
||||
description: Variables in memory after executing computed_var.kcl
|
||||
---
|
||||
{
|
||||
"environments": [
|
||||
{
|
||||
"bindings": {
|
||||
"HALF_TURN": {
|
||||
"type": "Number",
|
||||
"value": 180.0,
|
||||
"__meta": []
|
||||
},
|
||||
"QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 90.0,
|
||||
"__meta": []
|
||||
},
|
||||
"THREE_QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 270.0,
|
||||
"__meta": []
|
||||
},
|
||||
"ZERO": {
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": []
|
||||
},
|
||||
"arr": {
|
||||
"type": "Array",
|
||||
"value": [
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
44,
|
||||
45,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
47,
|
||||
48,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
50,
|
||||
51,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 10.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
53,
|
||||
55,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
43,
|
||||
56,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"i": {
|
||||
"type": "Number",
|
||||
"value": 3.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
61,
|
||||
62,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"obj": {
|
||||
"type": "Object",
|
||||
"value": {
|
||||
"bar": {
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
150,
|
||||
151,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"foo": {
|
||||
"type": "Number",
|
||||
"value": 1.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
141,
|
||||
142,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
133,
|
||||
153,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"one": {
|
||||
"type": "Number",
|
||||
"value": 1.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
141,
|
||||
142,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"p": {
|
||||
"type": "String",
|
||||
"value": "foo",
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
121,
|
||||
126,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"ten": {
|
||||
"type": "Number",
|
||||
"value": 10.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
53,
|
||||
55,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
"HALF_TURN": {
|
||||
"type": "Number",
|
||||
"value": 180.0,
|
||||
"__meta": []
|
||||
},
|
||||
"QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 90.0,
|
||||
"__meta": []
|
||||
},
|
||||
"THREE_QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 270.0,
|
||||
"__meta": []
|
||||
},
|
||||
"ZERO": {
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": []
|
||||
},
|
||||
"arr": {
|
||||
"type": "Array",
|
||||
"value": [
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
44,
|
||||
45,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"snapshots": [],
|
||||
"parent": null
|
||||
}
|
||||
],
|
||||
"currentEnv": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"callStack": []
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
47,
|
||||
48,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
50,
|
||||
51,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 10.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
53,
|
||||
55,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
43,
|
||||
56,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"i": {
|
||||
"type": "Number",
|
||||
"value": 3.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
61,
|
||||
62,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"obj": {
|
||||
"type": "Object",
|
||||
"value": {
|
||||
"bar": {
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
150,
|
||||
151,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"foo": {
|
||||
"type": "Number",
|
||||
"value": 1.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
141,
|
||||
142,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
133,
|
||||
153,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"one": {
|
||||
"type": "Number",
|
||||
"value": 1.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
141,
|
||||
142,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"p": {
|
||||
"type": "String",
|
||||
"value": "foo",
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
121,
|
||||
126,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"ten": {
|
||||
"type": "Number",
|
||||
"value": 10.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
53,
|
||||
55,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,277 +1,243 @@
|
||||
---
|
||||
source: kcl/src/simulation_tests.rs
|
||||
description: Program memory after executing double_map_fn.kcl
|
||||
description: Variables in memory after executing double_map_fn.kcl
|
||||
---
|
||||
{
|
||||
"environments": [
|
||||
{
|
||||
"bindings": {
|
||||
"HALF_TURN": {
|
||||
"type": "Number",
|
||||
"value": 180.0,
|
||||
"__meta": []
|
||||
},
|
||||
"QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 90.0,
|
||||
"__meta": []
|
||||
},
|
||||
"THREE_QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 270.0,
|
||||
"__meta": []
|
||||
},
|
||||
"ZERO": {
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": []
|
||||
},
|
||||
"increment": {
|
||||
"type": "Function",
|
||||
"expression": {
|
||||
"body": {
|
||||
"body": [
|
||||
{
|
||||
"argument": {
|
||||
"end": 32,
|
||||
"left": {
|
||||
"end": 28,
|
||||
"name": "i",
|
||||
"start": 27,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
"operator": "+",
|
||||
"right": {
|
||||
"end": 32,
|
||||
"raw": "1",
|
||||
"start": 31,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 27,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
},
|
||||
"end": 32,
|
||||
"start": 20,
|
||||
"type": "ReturnStatement",
|
||||
"type": "ReturnStatement"
|
||||
"HALF_TURN": {
|
||||
"type": "Number",
|
||||
"value": 180.0,
|
||||
"__meta": []
|
||||
},
|
||||
"QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 90.0,
|
||||
"__meta": []
|
||||
},
|
||||
"THREE_QUARTER_TURN": {
|
||||
"type": "Number",
|
||||
"value": 270.0,
|
||||
"__meta": []
|
||||
},
|
||||
"ZERO": {
|
||||
"type": "Number",
|
||||
"value": 0.0,
|
||||
"__meta": []
|
||||
},
|
||||
"increment": {
|
||||
"type": "Function",
|
||||
"expression": {
|
||||
"body": {
|
||||
"body": [
|
||||
{
|
||||
"argument": {
|
||||
"end": 32,
|
||||
"left": {
|
||||
"end": 28,
|
||||
"name": "i",
|
||||
"start": 27,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
"operator": "+",
|
||||
"right": {
|
||||
"end": 32,
|
||||
"raw": "1",
|
||||
"start": 31,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
],
|
||||
"end": 34,
|
||||
"start": 16
|
||||
},
|
||||
"start": 27,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
},
|
||||
"end": 34,
|
||||
"params": [
|
||||
{
|
||||
"type": "Parameter",
|
||||
"identifier": {
|
||||
"end": 14,
|
||||
"name": "i",
|
||||
"start": 13,
|
||||
"type": "Identifier"
|
||||
}
|
||||
}
|
||||
],
|
||||
"start": 12,
|
||||
"type": "FunctionExpression"
|
||||
},
|
||||
"memory": [
|
||||
0,
|
||||
1
|
||||
],
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
12,
|
||||
34,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"xs": {
|
||||
"type": "Array",
|
||||
"value": [
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
41,
|
||||
47,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 1,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
41,
|
||||
47,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 2,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
41,
|
||||
47,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
41,
|
||||
47,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"ys": {
|
||||
"type": "Array",
|
||||
"value": [
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 2.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
41,
|
||||
47,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
31,
|
||||
32,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
31,
|
||||
32,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 3.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
41,
|
||||
47,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
31,
|
||||
32,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
31,
|
||||
32,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 4.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
41,
|
||||
47,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
31,
|
||||
32,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
31,
|
||||
32,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
84,
|
||||
101,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
"end": 32,
|
||||
"start": 20,
|
||||
"type": "ReturnStatement",
|
||||
"type": "ReturnStatement"
|
||||
}
|
||||
],
|
||||
"end": 34,
|
||||
"start": 16
|
||||
},
|
||||
"snapshots": [
|
||||
"end": 34,
|
||||
"params": [
|
||||
{
|
||||
"parent_snapshot": null,
|
||||
"data": {
|
||||
"increment": {
|
||||
"type": "Tombstone",
|
||||
"value": null,
|
||||
"__meta": []
|
||||
},
|
||||
"xs": {
|
||||
"type": "Tombstone",
|
||||
"value": null,
|
||||
"__meta": []
|
||||
},
|
||||
"ys": {
|
||||
"type": "Tombstone",
|
||||
"value": null,
|
||||
"__meta": []
|
||||
}
|
||||
"type": "Parameter",
|
||||
"identifier": {
|
||||
"end": 14,
|
||||
"name": "i",
|
||||
"start": 13,
|
||||
"type": "Identifier"
|
||||
}
|
||||
}
|
||||
],
|
||||
"parent": null
|
||||
}
|
||||
],
|
||||
"currentEnv": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"callStack": []
|
||||
"start": 12,
|
||||
"type": "FunctionExpression"
|
||||
},
|
||||
"memory": [
|
||||
0,
|
||||
1
|
||||
],
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
12,
|
||||
34,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"xs": {
|
||||
"type": "Array",
|
||||
"value": [
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
41,
|
||||
47,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 1,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
41,
|
||||
47,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Int",
|
||||
"value": 2,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
41,
|
||||
47,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
41,
|
||||
47,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"ys": {
|
||||
"type": "Array",
|
||||
"value": [
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 2.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
41,
|
||||
47,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
31,
|
||||
32,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
31,
|
||||
32,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 3.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
41,
|
||||
47,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
31,
|
||||
32,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
31,
|
||||
32,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Number",
|
||||
"value": 4.0,
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
41,
|
||||
47,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
31,
|
||||
32,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
31,
|
||||
32,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
84,
|
||||
101,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
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
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user