diff --git a/web/src/pages/app/modules/preview.ts b/web/src/pages/app/modules/preview.ts index 3ce20f5..411403e 100644 --- a/web/src/pages/app/modules/preview.ts +++ b/web/src/pages/app/modules/preview.ts @@ -629,6 +629,10 @@ function bindProcessPlaceholder(operations: PreviewOperation[]) { }); document.querySelector("#previewPlayBtn")?.addEventListener("click", () => { + if (operations.length === 0) { + notify("当前模型暂无工艺数据"); + return; + } const operation = getSelectedOperation(operations); updateStatus(operation); if (!operation) { @@ -639,7 +643,7 @@ function bindProcessPlaceholder(operations: PreviewOperation[]) { notifyError(`工艺播放数据解析失败:${operation.parseError}`); return; } - if (!operation.parsedCraftPlayData) { + if (!operation.parsedCraftPlayData || operation.parsedCraftPlayData.OPERATION.frames.length === 0) { notify("当前工艺暂无播放数据"); return; } @@ -653,10 +657,14 @@ function bindProcessPlaceholder(operations: PreviewOperation[]) { } function startPreviewPlayback(operation: PreviewOperation) { - if (!runtime?.context.modelObject || !operation.parsedCraftPlayData) { + if (!runtime?.context.modelObject) { notify("模型还未加载完成"); return; } + if (!operation.parsedCraftPlayData || operation.parsedCraftPlayData.OPERATION.frames.length === 0) { + notify("当前工艺暂无播放数据"); + return; + } if (previewPlayback.isPlaying && previewPlayback.operation === operation) { return;