feat: improve plugin overlay workflow
This commit is contained in:
@@ -122,6 +122,8 @@ async function writeInputJson(
|
||||
params: Record<string, unknown>,
|
||||
pointCloudPaths: string[],
|
||||
cadPath: string | null,
|
||||
inputPointCloudFileIds: number[],
|
||||
inputCadFileIds: number[],
|
||||
) {
|
||||
const inputJson = {
|
||||
schemaVersion: 1,
|
||||
@@ -133,7 +135,9 @@ async function writeInputJson(
|
||||
outDir: workDir,
|
||||
inputs: {
|
||||
pointCloudPaths,
|
||||
pointCloudFileIds: inputPointCloudFileIds,
|
||||
cadPath,
|
||||
cadFileIds: inputCadFileIds,
|
||||
config: params,
|
||||
},
|
||||
};
|
||||
@@ -331,6 +335,9 @@ export async function runAlgorithmJob(
|
||||
pointCloudFileIds,
|
||||
cadFileIds,
|
||||
);
|
||||
const inputPointCloudFileIds = pointCloudRecords.map((r) => r.id);
|
||||
const inputCadFileIds = Array.isArray(cadFileIds) ? cadFileIds.filter((id) => Number.isInteger(id)) : [];
|
||||
|
||||
const inputJsonPath = await writeInputJson(
|
||||
workDir,
|
||||
taskId,
|
||||
@@ -339,6 +346,8 @@ export async function runAlgorithmJob(
|
||||
params,
|
||||
pointCloudPaths,
|
||||
cadPath,
|
||||
inputPointCloudFileIds,
|
||||
inputCadFileIds,
|
||||
);
|
||||
|
||||
let exitCode: number | null = 0;
|
||||
@@ -363,6 +372,8 @@ export async function runAlgorithmJob(
|
||||
progress: finalStatus === 'completed' ? 1 : undefined,
|
||||
stage: finalStatus === 'completed' ? '完成' : '失败',
|
||||
exitCode,
|
||||
inputPointCloudFileIds,
|
||||
inputCadFileIds,
|
||||
// 把 result.json 内容平展到 resultData 里,方便前端直接使用
|
||||
schemaVersion: result?.schemaVersion ?? manifest.schemaVersion,
|
||||
message: result?.message,
|
||||
|
||||
@@ -394,7 +394,7 @@ def main() -> int:
|
||||
overlay3d: dict = {"kind": "none"}
|
||||
for ply_key in ("contourPly", "curvaturePly"):
|
||||
if ply_key in extra:
|
||||
overlay3d = {"kind": "vertexColors", "url": extra[ply_key]}
|
||||
overlay3d = {"kind": "ply", "file": extra[ply_key]}
|
||||
break
|
||||
|
||||
if skipped:
|
||||
|
||||
@@ -141,6 +141,8 @@ export type PluginOverlay3D =
|
||||
/** 着色 PLY 叠加文件(同样相对 outDir) */
|
||||
kind: 'ply';
|
||||
file: string;
|
||||
/** 批量结果可包含多个 PLY 叠加文件 */
|
||||
files?: string[];
|
||||
};
|
||||
|
||||
/** 算法写出的 result.json(与 INTEGRATION.md 描述对齐) */
|
||||
@@ -177,4 +179,8 @@ export interface PluginResultData extends Partial<PluginResult> {
|
||||
error?: string;
|
||||
/** 子进程已结束时的退出码 */
|
||||
exitCode?: number | null;
|
||||
/** 本次算法运行实际使用的任务点云文件 ID,用于前端叠加层匹配校验 */
|
||||
inputPointCloudFileIds?: number[];
|
||||
/** 本次算法运行前端选择的任务 CAD 文件 ID,用于后续匹配/追溯 */
|
||||
inputCadFileIds?: number[];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user