完成 xyzbc-trt working 任务复核
This commit is contained in:
@@ -23,6 +23,7 @@ import {
|
||||
applyToolCommandSequence,
|
||||
createToolRuntimeState,
|
||||
} from "../../app/src/runtime/tool-db-simulation.js";
|
||||
import { buildAxisExecutionTraceFromProgram } from "../../app/src/runtime/axis-preview-path.js";
|
||||
|
||||
const profile = getFiveAxisProfile();
|
||||
|
||||
@@ -108,6 +109,49 @@ const selectedPlan = selectMachineFileProgram(
|
||||
);
|
||||
assert.equal(selectedPlan.selectedProgramFilename, "xyzbc_switchkins.ngc");
|
||||
assert.ok(selectedPlan.wasmProgramPath.endsWith("/demos/xyzbc_switchkins.ngc"));
|
||||
const selectedProgramFile = staged.save.files.find((file) => file.sourceRel === selectedPlan.selectedProgramSourceRel);
|
||||
const semanticExecutionPath = buildAxisExecutionTraceFromProgram({
|
||||
filename: selectedPlan.selectedProgramFilename,
|
||||
sourceRel: selectedPlan.selectedProgramSourceRel,
|
||||
content: selectedProgramFile.text,
|
||||
});
|
||||
assert.equal(semanticExecutionPath.status, "ok");
|
||||
assert.equal(semanticExecutionPath.samplePeriodMs, 50);
|
||||
assert.equal(semanticExecutionPath.sampleCount, 1300);
|
||||
assert.equal(semanticExecutionPath.segmentCount, 29);
|
||||
assert.equal(semanticExecutionPath.lineExecutionTrace.length, 64);
|
||||
assert.equal(semanticExecutionPath.axisValuesByLine.length, 29);
|
||||
assert.equal(semanticExecutionPath.gcodeExecutionProcess.status, "ok");
|
||||
assert.equal(semanticExecutionPath.gcodeExecutionProcess.executionStepCount, 128);
|
||||
assert.equal(semanticExecutionPath.gcodeExecutionProcess.sourceLineCoverage.length, 65);
|
||||
assert.equal(semanticExecutionPath.gcodeExecutionProcess.summary.motionStepCount, 29);
|
||||
assert.equal(semanticExecutionPath.gcodeExecutionProcess.summary.parameterAssignmentStepCount, 41);
|
||||
assert.deepEqual(semanticExecutionPath.samples.find((sample) => sample.motionType === "arc").machineState.cutting, {
|
||||
active: true,
|
||||
cuttingSpeedMmPerMin: 1000,
|
||||
});
|
||||
assert.equal(semanticExecutionPath.samples[0].machineState.spindle.speedRpm, 0);
|
||||
assert.equal(semanticExecutionPath.samples[0].machineState.coolant.flood, false);
|
||||
assert.equal(semanticExecutionPath.samples[0].machineState.toolChange.activeTool, 2);
|
||||
assert.equal(semanticExecutionPath.gcodeExecutionProcess.executionSteps.some((step) => (
|
||||
step.sourceFile === "helix_bc.ngc"
|
||||
&& step.line === 17
|
||||
&& step.result.operation === "feed-helix"
|
||||
&& step.result.motion?.endJoint?.b === 20
|
||||
&& step.result.motion?.endJoint?.c === 45
|
||||
&& step.result.motion?.endJoint?.z === 5
|
||||
&& step.result.machineStateAfter?.cutting?.active === true
|
||||
&& step.result.machineStateAfter?.feed?.actualMmPerMin === 1000
|
||||
)), true);
|
||||
assert.equal(semanticExecutionPath.axisValuesByLine.some((entry) => (
|
||||
entry.sourceFile === "helix_bc.ngc"
|
||||
&& entry.line === 17
|
||||
&& entry.operation === "feed-helix"
|
||||
&& entry.joint.b === 20
|
||||
&& entry.joint.c === 45
|
||||
&& entry.joint.z === 5
|
||||
&& entry.machineState.cutting.cuttingSpeedMmPerMin === 1000
|
||||
)), true);
|
||||
|
||||
const interpreter = await createLinuxCncInterpreterRuntime();
|
||||
const execution = interpreter.runMachineFileProgram({
|
||||
@@ -165,6 +209,15 @@ assert.equal(state.sessionName, "xyzbc-trt-web-session");
|
||||
assert.equal(state.kinematicsRuntimeReadiness, null);
|
||||
|
||||
const storeStage = await store.stageMachineFiles({ storage: createMemorySessionStorage() });
|
||||
assert.equal(store.getState().toolRuntimeState.ready, true);
|
||||
assert.equal(store.getState().toolRuntimeState.currentTool.toolNumber, 0);
|
||||
store.dispatch({
|
||||
type: "LOAD_LINUXCNC_GCODE_SOURCE",
|
||||
sourceRel: "configs/sim/axis/vismach/5axis/table-rotary-tilting/demos/xyzbc_switchkins.ngc",
|
||||
});
|
||||
assert.equal(store.getState().toolRuntimeState.activeToolNumber, 0);
|
||||
assert.equal(store.getState().programAxisPreviewPath.samples[0].tool.id, 2);
|
||||
assert.equal(store.getState().programAxisPreviewPath.samples[0].tool.diameter, 8);
|
||||
const toolOffsetDb = applyToolCommandSequence(store.getState().toolDbSimulation, [
|
||||
{ code: "T", toolNumber: 2 },
|
||||
{ code: "M6" },
|
||||
|
||||
Reference in New Issue
Block a user