完善 xyzbc-trt OPFS 与 AXIS 首屏等效

This commit is contained in:
mes123456
2026-07-02 10:10:54 -04:00
parent 1c8908e3ab
commit 52e54f8089
16 changed files with 925 additions and 28 deletions

View File

@@ -57,6 +57,7 @@ const toolRuntime = buildToolRuntimeEvidence({
fallbackToolLength: state.toolPreview?.length,
});
const semanticFields = buildSemanticFields({ profile, ini, staged, state, toolRuntime });
const axisMainUi = buildAxisMainUiEvidence({ state, profile, paths, toolRuntime, semanticFields });
const evidence = {
apiName: "xyzbc-trt-web-opfs-wasm-evidence",
@@ -125,6 +126,7 @@ const evidence = {
previewPath: paths.previewPath,
executionPath: paths.executionPath,
toolRuntime,
axisMainUi,
...semanticFields,
wasm: wasmArtifacts,
coverage: {
@@ -152,6 +154,7 @@ const evidence = {
&& Boolean(semanticFields.axisJointLimits.axisLimits.C),
previewPathAvailable: paths.previewPath.sampleCount > 0,
executionPathAvailable: paths.executionPath.sampleCount > 0,
axisMainUiEquivalent: axisMainUi.ready,
toolTableToToolOffsetClosed: toolRuntime.ready
&& toolRuntime.toolTable.toolCount > 0
&& toolRuntime.activeOffsetApplied
@@ -512,6 +515,7 @@ function buildSemanticFields({ profile, ini, staged, state, toolRuntime }) {
})),
uiEquivalence: {
firstViewport: "axis-equivalent-cnc-console",
semanticBoundary: "xyzbc_trt_axis_first_screen_program_coordinates_status_mdi_switchkins_override_tool_preview_execution",
regions: [
"program",
"dro",
@@ -521,6 +525,18 @@ function buildSemanticFields({ profile, ini, staged, state, toolRuntime }) {
"tool",
"preview-execution",
],
axisMainUiCapabilityIds: [
"program",
"coordinates",
"status",
"mdi",
"switchkins",
"override",
"tool",
"preview",
"execution",
"axis-buttons",
],
activeProgram: state.activeProgram,
selectedGcodeSourceRel: state.machineFileStaging.selectedGcodeSourceRel,
pyvcpPanelSchema: profile.panelSchema?.id,
@@ -564,6 +580,92 @@ function buildSemanticFields({ profile, ini, staged, state, toolRuntime }) {
};
}
function buildAxisMainUiEvidence({ state, profile, paths, toolRuntime, semanticFields }) {
const taskPolicy = state.linuxCncTaskPolicy || {};
const requiredSections = [
{ id: "preview", section: "preview-toolpath-and-machine-model" },
{ id: "dro", section: "coordinates-dro" },
{ id: "gcode", section: "program-and-mdi" },
{ id: "status-sidebar", section: "status-mode-and-switchkins" },
{ id: "info-tabs", section: "execution-tool-and-runtime-state" },
{ id: "override", section: "feed-rapid-override" },
{ id: "spindle-coolant", section: "spindle-coolant" },
{ id: "bottom-controls", section: "run-jog-home-controls" },
];
const capabilities = [
{
id: "program",
ready: Boolean(state.activeProgram) && state.machineFileStaging?.selectedGcodeSourceRel?.endsWith("xyzbc_switchkins.ngc"),
evidence: state.activeProgram,
},
{
id: "coordinates",
ready: profile.traj?.coordinates === "XYZBC" && state.profile?.traj?.coordinates === "XYZBC",
evidence: { coordinates: profile.traj?.coordinates, droAxes: ["X", "Y", "Z", "B", "C"] },
},
{
id: "status",
ready: Boolean(state.machine?.taskState) && Boolean(state.runState),
evidence: { taskState: state.machine?.taskState, mode: state.machine?.mode, runState: state.runState },
},
{
id: "mdi",
ready: Boolean(state.machine?.mdiCommand) && profile.kinematicsParameters?.switchkinsTypes?.some((type) => type.mdiCommand === "M428"),
evidence: { command: state.machine?.mdiCommand, switchkinsMdi: profile.kinematicsParameters?.switchkinsTypes?.map((type) => type.mdiCommand) },
},
{
id: "switchkins",
ready: profile.kinematicsParameters?.switchkinsTypes?.length >= 3
&& semanticFields.switchkinsTransitions?.some((item) => item.mdiCommand === "M428"),
evidence: semanticFields.switchkinsTransitions,
},
{
id: "override",
ready: Number.isFinite(Number(state.feed?.feedOverride)) && Number.isFinite(Number(state.feed?.rapidOverride)),
evidence: { feedOverride: state.feed?.feedOverride, rapidOverride: state.feed?.rapidOverride },
},
{
id: "tool",
ready: toolRuntime.ready && toolRuntime.activeOffsetApplied,
evidence: toolRuntime.pathTool,
},
{
id: "preview",
ready: paths.previewPath?.sampleCount > 0,
evidence: { samplePeriodMs: paths.previewPath?.samplePeriodMs, sampleCount: paths.previewPath?.sampleCount },
},
{
id: "execution",
ready: paths.executionPath?.sampleCount > 0,
evidence: { samplePeriodMs: paths.executionPath?.samplePeriodMs, sampleCount: paths.executionPath?.sampleCount },
},
{
id: "axis-buttons",
ready: taskPolicy.canRunAuto !== undefined
&& taskPolicy.canExecuteMdi !== undefined
&& taskPolicy.canJog !== undefined
&& taskPolicy.canHome !== undefined,
evidence: {
canRunAuto: taskPolicy.canRunAuto,
canExecuteMdi: taskPolicy.canExecuteMdi,
canJog: taskPolicy.canJog,
canHome: taskPolicy.canHome,
},
},
];
const missingCapabilities = capabilities.filter((item) => !item.ready).map((item) => item.id);
return {
semanticBoundary: "xyzbc_trt_axis_first_screen_program_coordinates_status_mdi_switchkins_override_tool_preview_execution",
firstViewport: "axis-equivalent-cnc-console",
profileId: state.machineProfile,
coordinates: state.profile?.traj?.coordinates,
requiredSections,
capabilities,
missingCapabilities,
ready: missingCapabilities.length === 0,
};
}
function buildToolRuntimeEvidence({ profile, staged, selectedPlan, fallbackToolLength = 0 }) {
const toolTableFile = staged.save.files.find((file) => file.sourceRel === profile.toolTablePath)
|| staged.save.files.find((file) => file.kind === "toolTable");

View File

@@ -75,6 +75,9 @@ const checks = [
check("limits", "web TRAJ/AXIS/JOINT limits represented", webEvidence.coverage?.axisJointLimitsCovered === true, {
axisJointLimits: webEvidence.axisJointLimits,
}),
check("ui", "web AXIS first screen exposes program, coordinates, status, MDI/switchkins, override, tool, preview, and execution", webEvidence.coverage?.axisMainUiEquivalent === true, {
axisMainUi: webEvidence.axisMainUi,
}),
check("path-preview", "native and web preview path sample period is 20ms", pathComparison.previewVsPreview.periodsMatch === true, {
nativeSamplePeriodMs: pathComparison.previewVsPreview.nativeSamplePeriodMs,
webSamplePeriodMs: pathComparison.previewVsPreview.webSamplePeriodMs,