feat(carrier): 航空母舰 PartDesign 有头创建工具包与初学者教学
- 新数据链 web/teaching/cases/carrier-partdesign:20 件零件(spec.json 唯一来源)、 内核建造器 parts/*.mjs、traces/FCStd/replay 全量产物;装配 20 插入 + 19 关节。 - 工具包 tools/carrier:catalog / preflight / create-part / create-assembly / create-all / list / self-test / README,按零件与装配拆分为独立工具。 - 共享驱动扩展 web/tools/cad-ui-rebuild:Loft/Pipe/Hole/Fillet/Chamfer/Mirrored/ LinearPattern 交互,Reversed 复选框补齐;装配 saveAssemblyBundle 先 Accept 再保存。 - 教学:lessons.mjs 新增 carrier 组(环境课 + 20 件 + 装配),suite-runner 增加 carrier-part/carrier-assembly,生成 carrier-toolkit.html 并接入 index 与控制台证据。 验证:20 件 210 步全部有头通过(P05 修复后 39640 m³;P06 回归 8/8); 装配 20/20 插入、19/19 关节、20 组件 0 畸形、0 mismatch;check:carrier、 check:reducer、check-console --live 全绿。 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -35,6 +35,8 @@ const PROBE_ENTRY = path.join(REPO_ROOT, "tools/layout-probe.mjs");
|
||||
const HOST_ENTRY = path.join(REPO_ROOT, "tools/static-host.mjs");
|
||||
const REDUCER_PART = path.join(REPO_ROOT, "tools/reducer/create-part.mjs");
|
||||
const REDUCER_ASSEMBLY = path.join(REPO_ROOT, "tools/reducer/create-assembly.mjs");
|
||||
const CARRIER_PART = path.join(REPO_ROOT, "tools/carrier/create-part.mjs");
|
||||
const CARRIER_ASSEMBLY = path.join(REPO_ROOT, "tools/carrier/create-assembly.mjs");
|
||||
|
||||
const LINE_LIMIT = 2000;
|
||||
const BYTE_LIMIT = 512 * 1024;
|
||||
@@ -47,6 +49,10 @@ const TIMEOUTS = {
|
||||
// A 26-step cover part takes ~10 min headed; leave room without hanging forever.
|
||||
"reducer-part": 40 * 60_000,
|
||||
"reducer-assembly": 45 * 60_000,
|
||||
// Carrier parts are heavier (deck chamfers and lofts compute for tens of
|
||||
// seconds each); the 14-step deck measured ~9.5 min headed.
|
||||
"carrier-part": 45 * 60_000,
|
||||
"carrier-assembly": 60 * 60_000,
|
||||
};
|
||||
|
||||
export class JobError extends Error {
|
||||
@@ -209,6 +215,17 @@ export function buildJobArgv(lesson, params = {}, { jobDir } = {}) {
|
||||
if (job.kind === "reducer-assembly") {
|
||||
return { argv: [process.execPath, REDUCER_ASSEMBLY, "--out", jobDir, "--json"], dir: jobDir };
|
||||
}
|
||||
if (job.kind === "carrier-part") {
|
||||
const partId = String(job.partId ?? "");
|
||||
if (!/^P\d{2}$/.test(partId)) throw new JobError("E_PARAM", `非法零件编号:${partId.slice(0, 20)}`);
|
||||
const argv = [process.execPath, CARRIER_PART, partId];
|
||||
if (job.dry) argv.push("--dry");
|
||||
argv.push("--out", jobDir, "--json");
|
||||
return { argv, dir: jobDir };
|
||||
}
|
||||
if (job.kind === "carrier-assembly") {
|
||||
return { argv: [process.execPath, CARRIER_ASSEMBLY, "--out", jobDir, "--json"], dir: jobDir };
|
||||
}
|
||||
throw new JobError("E_PARAM", `未知课程类型:${job.kind}`);
|
||||
}
|
||||
|
||||
@@ -389,6 +406,35 @@ export function createRunner({ root = CONSOLE_ROOT } = {}) {
|
||||
else if (job.timedOut) job.verdict = "timeout";
|
||||
else if (!report) job.verdict = code === 2 ? "precondition_fail" : "run_fail";
|
||||
else job.verdict = report.verdict;
|
||||
} else if (job.kind === "carrier-part" || job.kind === "carrier-assembly") {
|
||||
const report = readJson(path.join(job.dir, "report.json")).value;
|
||||
const isPart = job.kind === "carrier-part";
|
||||
const label = isPart ? (report?.part?.id ?? "part") : (report?.document ?? "assembly");
|
||||
job.progress = {
|
||||
...job.progress,
|
||||
planned: 1,
|
||||
completed: 1,
|
||||
results: report ? [{
|
||||
id: label,
|
||||
title: isPart ? (report.part?.title ?? report.part?.document ?? "零件")
|
||||
: (report.label ?? "装配"),
|
||||
status: report.verdict === "pass" ? "passed" : report.verdict === "product_fail" ? "failed" : "blocked",
|
||||
seconds: report.seconds ?? null,
|
||||
// Distinguish "the geometry differs" from "nothing ran at all": the
|
||||
// first is a product regression, the second a broken precondition.
|
||||
error: report.verdict === "product_fail"
|
||||
? (isPart && report.volumeMatches === false
|
||||
? `体积 ${report.volume} ≠ 记录 ${report.expectedVolume}`
|
||||
: (isPart
|
||||
? `有步骤失败:${report.steps}/${report.stepsTotal} 步完成`
|
||||
: `插入 ${report.inserted},关节 ${report.joints},畸形组件 ${report.malformedComponents}`))
|
||||
: (report.fatal ?? null),
|
||||
}] : [],
|
||||
};
|
||||
if (job.cancelled) job.verdict = "cancelled";
|
||||
else if (job.timedOut) job.verdict = "timeout";
|
||||
else if (!report) job.verdict = code === 2 ? "precondition_fail" : "run_fail";
|
||||
else job.verdict = report.verdict;
|
||||
} else if (job.kind === "host") {
|
||||
// The host lesson succeeds once ORIGIN is printed; an explicit user
|
||||
// cancel still reads as cancelled even if that already happened.
|
||||
@@ -446,6 +492,7 @@ export function createRunner({ root = CONSOLE_ROOT } = {}) {
|
||||
lines: [], bytes: 0, partial: { stdout: "", stderr: "" },
|
||||
progress: {
|
||||
planned: entry.job.kind === "reducer-part" || entry.job.kind === "reducer-assembly"
|
||||
|| entry.job.kind === "carrier-part" || entry.job.kind === "carrier-assembly"
|
||||
? 1
|
||||
: entry.job.selectable ? (params.only?.length ?? 0) : (entry.job.only?.length ?? 0),
|
||||
completed: 0, current: null, counts: null, results: [],
|
||||
|
||||
Reference in New Issue
Block a user