Return modeling commands from KCL execution (#4912)
* Add Rust side artifacts for startSketchOn face or plane * Add Rust-generated artifacts to ExecOutcome * Add output of artifact commands * Add new output files * Wire the artifact commands to the artifact graph creation * Fix to use real PartialEq implemented in modeling commands * Fix modeling commands with zero fields to work * Fix missing artifactCommands field in errors * Change artifact graph to be built from artifact commands * Wire up ExecState artifacts, but not using them yet Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch> * Remove unneeded local var * Fix test to fail with a helpful error message when command isn't found * Rename and deprecate orderedCommands * Update comment about borrowing * Move ArtifactCommand tracking to the EngineManager trait * Update artifact commands since tracking in the engine * Upgrade kittycad-modeling-cmds from 0.2.85 to 0.2.86 * Remove unneeded JsonSchema derive to speed up build * Fix to not fail on floating point differences in CI * Update artifact commands output since truncating floating point numbers * Fix to ensure artifact commands get cleared after a clear scene * Update artifact commands snapshot after clearing them on clear scene * Remove all remnants of OrderedCommands * Update output for new simulation tests --------- Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch>
This commit is contained in:
@ -48,7 +48,13 @@ import { SourceRange as RustSourceRange } from 'wasm-lib/kcl/bindings/SourceRang
|
||||
import { getAllCurrentSettings } from 'lib/settings/settingsUtils'
|
||||
import { Operation } from 'wasm-lib/kcl/bindings/Operation'
|
||||
import { KclErrorWithOutputs } from 'wasm-lib/kcl/bindings/KclErrorWithOutputs'
|
||||
import { Artifact } from 'wasm-lib/kcl/bindings/Artifact'
|
||||
import { ArtifactId } from 'wasm-lib/kcl/bindings/ArtifactId'
|
||||
import { ArtifactCommand } from 'wasm-lib/kcl/bindings/ArtifactCommand'
|
||||
|
||||
export type { Artifact } from 'wasm-lib/kcl/bindings/Artifact'
|
||||
export type { ArtifactCommand } from 'wasm-lib/kcl/bindings/ArtifactCommand'
|
||||
export type { ArtifactId } from 'wasm-lib/kcl/bindings/ArtifactId'
|
||||
export type { Configuration } from 'wasm-lib/kcl/bindings/Configuration'
|
||||
export type { Program } from '../wasm-lib/kcl/bindings/Program'
|
||||
export type { Expr } from '../wasm-lib/kcl/bindings/Expr'
|
||||
@ -227,6 +233,7 @@ export const parse = (code: string | Error): ParseResult | Error => {
|
||||
parsed.kind,
|
||||
parsed.msg,
|
||||
sourceRangeFromRust(parsed.sourceRanges[0]),
|
||||
[],
|
||||
[]
|
||||
)
|
||||
}
|
||||
@ -251,6 +258,8 @@ export const isPathToNodeNumber = (
|
||||
export interface ExecState {
|
||||
memory: ProgramMemory
|
||||
operations: Operation[]
|
||||
artifacts: { [key in ArtifactId]?: Artifact }
|
||||
artifactCommands: ArtifactCommand[]
|
||||
}
|
||||
|
||||
/**
|
||||
@ -261,6 +270,8 @@ export function emptyExecState(): ExecState {
|
||||
return {
|
||||
memory: ProgramMemory.empty(),
|
||||
operations: [],
|
||||
artifacts: {},
|
||||
artifactCommands: [],
|
||||
}
|
||||
}
|
||||
|
||||
@ -268,6 +279,8 @@ function execStateFromRust(execOutcome: RustExecOutcome): ExecState {
|
||||
return {
|
||||
memory: ProgramMemory.fromRaw(execOutcome.memory),
|
||||
operations: execOutcome.operations,
|
||||
artifacts: execOutcome.artifacts,
|
||||
artifactCommands: execOutcome.artifactCommands,
|
||||
}
|
||||
}
|
||||
|
||||
@ -538,7 +551,8 @@ export const executor = async (
|
||||
parsed.error.kind,
|
||||
parsed.error.msg,
|
||||
sourceRangeFromRust(parsed.error.sourceRanges[0]),
|
||||
parsed.operations
|
||||
parsed.operations,
|
||||
parsed.artifactCommands
|
||||
)
|
||||
|
||||
return Promise.reject(kclError)
|
||||
@ -598,6 +612,7 @@ export const modifyAstForSketch = async (
|
||||
parsed.kind,
|
||||
parsed.msg,
|
||||
sourceRangeFromRust(parsed.sourceRanges[0]),
|
||||
[],
|
||||
[]
|
||||
)
|
||||
|
||||
@ -667,6 +682,7 @@ export function programMemoryInit(): ProgramMemory | Error {
|
||||
parsed.kind,
|
||||
parsed.msg,
|
||||
sourceRangeFromRust(parsed.sourceRanges[0]),
|
||||
[],
|
||||
[]
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user