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:
425
web/teaching/cases/carrier-partdesign/assembly-spec.json
Normal file
425
web/teaching/cases/carrier-partdesign/assembly-spec.json
Normal file
@@ -0,0 +1,425 @@
|
||||
{
|
||||
"schema": "freecad-web/carrier-toolkit/assembly-spec/v1",
|
||||
"document": "CarrierAssembly",
|
||||
"label": "航空母舰",
|
||||
"groundDocument": "CarrierHull",
|
||||
"note": "零件在各自文档里已按舰体坐标建模,插入用单位位姿;每个非接地零件用一个固定关节锚到父件(20 件 − 1 接地 = 19 个关节),避免出现悬空组件。",
|
||||
"inserts": [
|
||||
{
|
||||
"sourceDocument": "CarrierHull",
|
||||
"sourceObject": "Body",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"rotation": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceDocument": "CarrierDeck",
|
||||
"sourceObject": "Body",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"rotation": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceDocument": "CarrierAngledDeck",
|
||||
"sourceObject": "Body",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"rotation": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceDocument": "CarrierIsland",
|
||||
"sourceObject": "Body",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"rotation": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceDocument": "CarrierHangar",
|
||||
"sourceObject": "Body",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"rotation": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceDocument": "CarrierElevators",
|
||||
"sourceObject": "Body",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"rotation": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceDocument": "CarrierCatapults",
|
||||
"sourceObject": "Body",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"rotation": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceDocument": "CarrierArrestorWires",
|
||||
"sourceObject": "Body",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"rotation": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceDocument": "CarrierRadar",
|
||||
"sourceObject": "Body",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"rotation": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceDocument": "CarrierCiws",
|
||||
"sourceObject": "Body",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"rotation": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceDocument": "CarrierFighterA",
|
||||
"sourceObject": "Body",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"rotation": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceDocument": "CarrierFighterB",
|
||||
"sourceObject": "Body",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"rotation": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceDocument": "CarrierFighterC",
|
||||
"sourceObject": "Body",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"rotation": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceDocument": "CarrierFighterD",
|
||||
"sourceObject": "Body",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"rotation": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceDocument": "CarrierFighterE",
|
||||
"sourceObject": "Body",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"rotation": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceDocument": "CarrierFighterF",
|
||||
"sourceObject": "Body",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"rotation": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceDocument": "CarrierAwacs",
|
||||
"sourceObject": "Body",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"rotation": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceDocument": "CarrierHelicopterA",
|
||||
"sourceObject": "Body",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"rotation": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceDocument": "CarrierHelicopterB",
|
||||
"sourceObject": "Body",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"rotation": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceDocument": "CarrierMarkings",
|
||||
"sourceObject": "Body",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"rotation": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1
|
||||
]
|
||||
}
|
||||
],
|
||||
"joints": [
|
||||
{
|
||||
"type": "Fixed",
|
||||
"label": "飞行甲板 / 舰体",
|
||||
"a": "CarrierDeck",
|
||||
"b": "CarrierHull"
|
||||
},
|
||||
{
|
||||
"type": "Fixed",
|
||||
"label": "斜角甲板 / 飞行甲板",
|
||||
"a": "CarrierAngledDeck",
|
||||
"b": "CarrierDeck"
|
||||
},
|
||||
{
|
||||
"type": "Fixed",
|
||||
"label": "舰岛 / 飞行甲板",
|
||||
"a": "CarrierIsland",
|
||||
"b": "CarrierDeck"
|
||||
},
|
||||
{
|
||||
"type": "Fixed",
|
||||
"label": "机库 / 舰体",
|
||||
"a": "CarrierHangar",
|
||||
"b": "CarrierHull"
|
||||
},
|
||||
{
|
||||
"type": "Fixed",
|
||||
"label": "升降机 / 飞行甲板",
|
||||
"a": "CarrierElevators",
|
||||
"b": "CarrierDeck"
|
||||
},
|
||||
{
|
||||
"type": "Fixed",
|
||||
"label": "弹射器 / 飞行甲板",
|
||||
"a": "CarrierCatapults",
|
||||
"b": "CarrierDeck"
|
||||
},
|
||||
{
|
||||
"type": "Fixed",
|
||||
"label": "拦阻索 / 飞行甲板",
|
||||
"a": "CarrierArrestorWires",
|
||||
"b": "CarrierDeck"
|
||||
},
|
||||
{
|
||||
"type": "Fixed",
|
||||
"label": "相控阵雷达 / 舰岛",
|
||||
"a": "CarrierRadar",
|
||||
"b": "CarrierIsland"
|
||||
},
|
||||
{
|
||||
"type": "Fixed",
|
||||
"label": "近防炮 / 飞行甲板",
|
||||
"a": "CarrierCiws",
|
||||
"b": "CarrierDeck"
|
||||
},
|
||||
{
|
||||
"type": "Fixed",
|
||||
"label": "舰载战斗机 A / 飞行甲板",
|
||||
"a": "CarrierFighterA",
|
||||
"b": "CarrierDeck"
|
||||
},
|
||||
{
|
||||
"type": "Fixed",
|
||||
"label": "舰载战斗机 B / 飞行甲板",
|
||||
"a": "CarrierFighterB",
|
||||
"b": "CarrierDeck"
|
||||
},
|
||||
{
|
||||
"type": "Fixed",
|
||||
"label": "舰载战斗机 C / 飞行甲板",
|
||||
"a": "CarrierFighterC",
|
||||
"b": "CarrierDeck"
|
||||
},
|
||||
{
|
||||
"type": "Fixed",
|
||||
"label": "舰载战斗机 D / 飞行甲板",
|
||||
"a": "CarrierFighterD",
|
||||
"b": "CarrierDeck"
|
||||
},
|
||||
{
|
||||
"type": "Fixed",
|
||||
"label": "舰载战斗机 E / 飞行甲板",
|
||||
"a": "CarrierFighterE",
|
||||
"b": "CarrierDeck"
|
||||
},
|
||||
{
|
||||
"type": "Fixed",
|
||||
"label": "舰载战斗机 F / 飞行甲板",
|
||||
"a": "CarrierFighterF",
|
||||
"b": "CarrierDeck"
|
||||
},
|
||||
{
|
||||
"type": "Fixed",
|
||||
"label": "舰载预警机 / 飞行甲板",
|
||||
"a": "CarrierAwacs",
|
||||
"b": "CarrierDeck"
|
||||
},
|
||||
{
|
||||
"type": "Fixed",
|
||||
"label": "舰载直升机 A / 飞行甲板",
|
||||
"a": "CarrierHelicopterA",
|
||||
"b": "CarrierDeck"
|
||||
},
|
||||
{
|
||||
"type": "Fixed",
|
||||
"label": "舰载直升机 B / 飞行甲板",
|
||||
"a": "CarrierHelicopterB",
|
||||
"b": "CarrierDeck"
|
||||
},
|
||||
{
|
||||
"type": "Fixed",
|
||||
"label": "甲板标线 / 飞行甲板",
|
||||
"a": "CarrierMarkings",
|
||||
"b": "CarrierDeck"
|
||||
}
|
||||
]
|
||||
}
|
||||
110
web/teaching/cases/carrier-partdesign/build-assembly-replay.mjs
Normal file
110
web/teaching/cases/carrier-partdesign/build-assembly-replay.mjs
Normal file
@@ -0,0 +1,110 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Purpose: 由 assembly-spec.json 生成装配回放 out/replay/CarrierAssembly.json。
|
||||
*
|
||||
* 回放只记录“界面上做了什么、按什么参数做”:创建装配、打开 20 份源文档、
|
||||
* 逐个插入链接、接地、求解、每个非接地零件一个固定关节、再求解、列 BOM。
|
||||
* 组装脚本 web/tools/cad-ui-rebuild/assemble.mjs 直接读这份文件执行,
|
||||
* 不在这里启动浏览器。
|
||||
*
|
||||
* 组件名由插入顺序决定:Component、Component001 …(与 FreeCAD 一致),
|
||||
* 关节的 selection / references 全部引用这些名字。
|
||||
*
|
||||
* Usage: node build-assembly-replay.mjs [--dry]
|
||||
* Output: out/replay/<document>.json(schema freecad-web-process-replay/v1, kind assembly)
|
||||
*/
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const here = path.dirname(fileURLToPath(import.meta.url));
|
||||
const specFile = path.join(here, "assembly-spec.json");
|
||||
const spec = JSON.parse(fs.readFileSync(specFile, "utf8"));
|
||||
const ASSEMBLY = "Assembly";
|
||||
const dry = process.argv.includes("--dry");
|
||||
|
||||
const componentName = index => (index === 0 ? "Component" : `Component${String(index).padStart(3, "0")}`);
|
||||
const componentOf = new Map(spec.inserts.map((insert, index) => [insert.sourceDocument, componentName(index)]));
|
||||
|
||||
const steps = [];
|
||||
const push = (action, label, args, extra = {}) => steps.push({ step: steps.length + 1, label, action, seconds: 0, args, ...extra });
|
||||
|
||||
push("assembly.createRecompute", "create assembly", {
|
||||
schema: "freecad-web-assembly/create-recompute/v1",
|
||||
documentName: spec.document,
|
||||
objectName: ASSEMBLY,
|
||||
objectType: "Assembly::AssemblyObject",
|
||||
label: spec.label,
|
||||
});
|
||||
|
||||
push("Assembly_InsertLink", "open sources", {
|
||||
documentId: spec.document, assembly: ASSEMBLY, action: "open",
|
||||
files: spec.inserts.map(insert => ({ fileName: `${insert.sourceDocument}.FCStd` })),
|
||||
});
|
||||
|
||||
for (const [index, insert] of spec.inserts.entries()) {
|
||||
push("Assembly_InsertLink", `insert ${index + 1}/${spec.inserts.length} ${insert.sourceDocument}`, {
|
||||
documentId: spec.document, assembly: ASSEMBLY, action: "insert",
|
||||
sourceDocument: insert.sourceDocument, sourceObject: insert.sourceObject,
|
||||
position: insert.position, rotation: insert.rotation, rigid: true,
|
||||
}, { insert: { ...insert } });
|
||||
}
|
||||
|
||||
push("Assembly_InsertLink", "accept insertion", {
|
||||
documentId: spec.document, assembly: ASSEMBLY, action: "accept", selection: [],
|
||||
});
|
||||
|
||||
push("Assembly_ToggleGrounded", `ground ${spec.groundDocument}`, {
|
||||
documentId: spec.document, assembly: ASSEMBLY, action: "accept",
|
||||
selection: [{ documentId: spec.document, object: ASSEMBLY, subelements: [componentOf.get(spec.groundDocument)] }],
|
||||
});
|
||||
|
||||
const solve = label => ({
|
||||
documentId: spec.document, assembly: ASSEMBLY, action: "accept", selection: [],
|
||||
});
|
||||
push("Assembly_SolveAssembly", "solve at zero pose", solve("solve at zero pose"));
|
||||
|
||||
for (const joint of spec.joints) {
|
||||
const a = componentOf.get(joint.a);
|
||||
const b = componentOf.get(joint.b);
|
||||
if (!a || !b) throw new Error(`joint ${joint.label} names a part that is not inserted: ${joint.a} / ${joint.b}`);
|
||||
push(`Assembly_CreateJoint${joint.type ?? "Fixed"}`, `joint ${joint.label}`, {
|
||||
documentId: spec.document, assembly: ASSEMBLY, action: "accept", label: joint.label,
|
||||
preservePose: true,
|
||||
selection: [{ documentId: spec.document, object: a }, { documentId: spec.document, object: b }],
|
||||
references: [
|
||||
{ documentId: spec.document, object: ASSEMBLY, subelements: [a] },
|
||||
{ documentId: spec.document, object: ASSEMBLY, subelements: [b] },
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
push("Assembly_SolveAssembly", "solve", solve("solve"));
|
||||
push("Assembly_CreateBom", "list BOM", { documentId: spec.document, assembly: ASSEMBLY, action: "list" });
|
||||
|
||||
const replay = {
|
||||
schema: "freecad-web-process-replay/v1",
|
||||
kind: "assembly",
|
||||
document: spec.document,
|
||||
assembly: "build-assembly-replay.mjs",
|
||||
generatedAt: new Date().toISOString(),
|
||||
totals: { seconds: 0 },
|
||||
steps,
|
||||
};
|
||||
|
||||
if (dry) {
|
||||
console.log(JSON.stringify({
|
||||
document: spec.document,
|
||||
inserts: spec.inserts.length,
|
||||
joints: spec.joints.length,
|
||||
solves: steps.filter(step => step.action === "Assembly_SolveAssembly").length,
|
||||
steps: steps.length,
|
||||
}, null, 2));
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
const outFile = path.join(here, "out", "replay", `${spec.document}.json`);
|
||||
fs.mkdirSync(path.dirname(outFile), { recursive: true });
|
||||
fs.writeFileSync(outFile, `${JSON.stringify(replay, null, 2)}\n`);
|
||||
console.log(JSON.stringify({ output: path.relative(process.cwd(), outFile), steps: steps.length,
|
||||
inserts: spec.inserts.length, joints: spec.joints.length }, null, 2));
|
||||
90
web/teaching/cases/carrier-partdesign/build.mjs
Normal file
90
web/teaching/cases/carrier-partdesign/build.mjs
Normal file
@@ -0,0 +1,90 @@
|
||||
#!/usr/bin/env node
|
||||
// 航空母舰 PartDesign 建件入口。
|
||||
//
|
||||
// node web/teaching/cases/carrier-partdesign/build.mjs # 全部 20 件
|
||||
// node web/teaching/cases/carrier-partdesign/build.mjs P02 # 单件(id 或 Document)
|
||||
// node web/teaching/cases/carrier-partdesign/build.mjs Deck --dry # 只看摘要
|
||||
// node web/teaching/cases/carrier-partdesign/build.mjs --subset # P01..P10 舰体部分
|
||||
//
|
||||
// Each document is written to out/FCStd/<Document>.FCStd (OPFS mirror first,
|
||||
// then an evidence copy) and out/traces/<Document>.json. The replay stage reads
|
||||
// only the trace, so a failed builder leaves a trace you can inspect instead of
|
||||
// an empty out/replay entry.
|
||||
import path from "node:path";
|
||||
import fs from "node:fs";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { parts, partFor } from "./parts/index.mjs";
|
||||
import { buildDocument, caseDir, outDir, useCaseOpfs } from "./lib/build.mjs";
|
||||
|
||||
const argv = process.argv.slice(2);
|
||||
const flags = new Set(argv.filter(arg => arg.startsWith("--")));
|
||||
const selectors = argv.filter(arg => !arg.startsWith("--"));
|
||||
|
||||
const SHIP = ["P01", "P02", "P03", "P04", "P05", "P06", "P07", "P08", "P09", "P10"];
|
||||
|
||||
function selected() {
|
||||
if (selectors.length === 0) return flags.has("--subset") ? parts.filter(part => SHIP.includes(part.id)) : parts;
|
||||
const found = selectors.map(key => {
|
||||
const part = partFor(key) ?? parts.find(item => item.document.toLowerCase() === key.toLowerCase());
|
||||
if (!part) {
|
||||
console.error(`未知零件 ${key};可选:${parts.map(item => `${item.id} ${item.document}`).join(", ")}`);
|
||||
process.exit(2);
|
||||
}
|
||||
return part;
|
||||
});
|
||||
return found;
|
||||
}
|
||||
|
||||
function specIndex() {
|
||||
const file = path.join(caseDir, "spec.json");
|
||||
if (!fs.existsSync(file)) return new Map();
|
||||
const spec = JSON.parse(fs.readFileSync(file, "utf8"));
|
||||
return new Map(spec.parts.map(part => [part.document, part]));
|
||||
}
|
||||
|
||||
async function main() {
|
||||
useCaseOpfs();
|
||||
const queue = selected();
|
||||
const spec = specIndex();
|
||||
const indexFile = path.join(outDir, "index.json");
|
||||
const previous = fs.existsSync(indexFile) ? JSON.parse(fs.readFileSync(indexFile, "utf8")) : { documents: {} };
|
||||
const results = [];
|
||||
let failed = 0;
|
||||
for (const part of queue) {
|
||||
const entry = spec.get(part.document) ?? {};
|
||||
process.stdout.write(`▶ ${part.id} ${part.document} ${entry.title ?? ""}\n`);
|
||||
try {
|
||||
const summary = await buildDocument(part, { dry: flags.has("--dry") });
|
||||
const volume = Number(summary.volume);
|
||||
console.log(
|
||||
` ✓ ${summary.steps} 步 · ${summary.seconds}s · 体积 ${Number.isFinite(volume) ? `${volume.toFixed(3)} m³` : "n/a"} · ${summary.fcstd}`,
|
||||
);
|
||||
results.push({ id: part.id, title: entry.title ?? null, system: entry.system ?? null, ...summary });
|
||||
previous.documents[part.document] = {
|
||||
id: part.id, title: entry.title ?? null, system: entry.system ?? null,
|
||||
steps: summary.steps, volume: summary.volume, bounds: summary.bounds,
|
||||
seconds: summary.seconds, fcstd: summary.fcstd, builtAt: new Date().toISOString(),
|
||||
};
|
||||
} catch (error) {
|
||||
failed += 1;
|
||||
console.error(` ✗ ${part.document}: ${error?.message ?? error}`);
|
||||
if (!flags.has("--dry")) console.error(error?.stack ?? "");
|
||||
}
|
||||
}
|
||||
fs.mkdirSync(outDir, { recursive: true });
|
||||
fs.writeFileSync(indexFile, `${JSON.stringify({
|
||||
schema: "freecad-web-carrier-partdesign-index/v1",
|
||||
generatedAt: new Date().toISOString(),
|
||||
documents: previous.documents,
|
||||
}, null, 2)}\n`);
|
||||
const built = results.length;
|
||||
console.log(`\n${built}/${queue.length} 件完成${failed ? `,${failed} 件失败` : ""};索引 ${path.relative(caseDir, indexFile)}`);
|
||||
if (flags.has("--dry")) console.log(JSON.stringify(results.map(item => ({ id: item.id, volume: item.volume, steps: item.steps }))));
|
||||
process.exit(failed ? 1 : 0);
|
||||
}
|
||||
|
||||
main().catch(error => {
|
||||
console.error(error?.stack ?? error);
|
||||
process.exit(1);
|
||||
});
|
||||
void fileURLToPath;
|
||||
132
web/teaching/cases/carrier-partdesign/lib/build.mjs
Normal file
132
web/teaching/cases/carrier-partdesign/lib/build.mjs
Normal file
@@ -0,0 +1,132 @@
|
||||
// One recorded PartDesign build session for a carrier part.
|
||||
//
|
||||
// Every builder call goes through `part.timed()`, which is what makes the build
|
||||
// replayable: the trace carries the exact kernel action, its arguments and the
|
||||
// document listing after the call (tools/fcweb/kernel.mjs:188). The replay
|
||||
// generator then derives one volume/mesh record per step from those listings.
|
||||
//
|
||||
// Object names are chosen by the builder (HullSketch1, HullLoft …) so the
|
||||
// feature tree reads like a drawing, not like Sketch001. The UI renames on
|
||||
// rebuild; web/tools/cad-ui-rebuild/drive.mjs maps the recorded names onto the
|
||||
// names the workspace actually created.
|
||||
import path from "node:path";
|
||||
import fs from "node:fs";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { openPartDesign } from "../../../../../tools/fcweb/partdesign.mjs";
|
||||
import { configureOpfs, readExportFile } from "../../../../../tools/fcweb/opfs.mjs";
|
||||
|
||||
const here = path.dirname(fileURLToPath(import.meta.url));
|
||||
export const caseDir = path.resolve(here, "..");
|
||||
export const outDir = path.join(caseDir, "out");
|
||||
|
||||
/** Point the shared OPFS mirror at this case's out/, per the OPFS contract. */
|
||||
export function useCaseOpfs() {
|
||||
return configureOpfs({ root: path.join(outDir, "opfs", "freecad-exports") });
|
||||
}
|
||||
|
||||
export class Build {
|
||||
constructor(part, { document, builder }) {
|
||||
this.part = part;
|
||||
this.document = document;
|
||||
this.builder = builder ?? null;
|
||||
this.counters = new Map();
|
||||
this.steps = [];
|
||||
}
|
||||
|
||||
/** Next name with an increasing suffix: `name("Sketch")` -> Sketch3. */
|
||||
name(prefix) {
|
||||
const next = (this.counters.get(prefix) ?? 0) + 1;
|
||||
this.counters.set(prefix, next);
|
||||
return `${prefix}${next}`;
|
||||
}
|
||||
|
||||
record(object, label, action, args) {
|
||||
const result = this.part.timed(`${this.document} · ${label}`, action, { object, body: "Body", ...args });
|
||||
this.steps.push({ object, label, action, args });
|
||||
return result;
|
||||
}
|
||||
|
||||
/** Rectangle / Circle / Wire / Geometry sketch. `args` are setSketch fields. */
|
||||
sketch(object, { profileType = "Rectangle", parameters, position, placementRotation, points, geometries, constraints }, label) {
|
||||
this.stepsByName ??= new Map();
|
||||
const args = { profileType };
|
||||
if (parameters) args.parameters = parameters;
|
||||
if (position) args.position = position;
|
||||
if (placementRotation) args.placementRotation = placementRotation;
|
||||
if (points) args.points = points;
|
||||
if (geometries) args.geometries = geometries;
|
||||
if (constraints) args.constraints = constraints;
|
||||
return this.record(object, label ?? `草图 ${object}`, "setSketch", args);
|
||||
}
|
||||
|
||||
/** Pad / Pocket / Revolution / Groove / Hole / Loft / Pipe (+ subtractive twins). */
|
||||
feature(object, { featureType = "Pad", profile, length, angle, axis, depth, depthType, midplane, reversed, sections, ruled, closed, spine, pipeMode, transition }, label) {
|
||||
const args = { featureType, profile };
|
||||
for (const [key, value] of Object.entries({ length, angle, axis, depth, depthType, midplane, reversed, sections, ruled, closed, spine, pipeMode, transition })) {
|
||||
if (value !== undefined) args[key] = value;
|
||||
}
|
||||
return this.record(object, label ?? `${featureType} ${object}`, "setFeature", args);
|
||||
}
|
||||
|
||||
transform(object, { transformType, originals, direction, mirrorPlane, rotationAxis, length, angle, occurrences, reversed }, label) {
|
||||
const args = { transformType, originals };
|
||||
for (const [key, value] of Object.entries({ direction, mirrorPlane, rotationAxis, length, angle, occurrences, reversed })) {
|
||||
if (value !== undefined) args[key] = value;
|
||||
}
|
||||
return this.record(object, label ?? `${transformType} ${object}`, "setTransform", args);
|
||||
}
|
||||
|
||||
dressUp(object, { dressUpType, base, size, edges, useAllEdges, chamferType, size2, angle, flipDirection }, label) {
|
||||
const args = { dressUpType, base };
|
||||
for (const [key, value] of Object.entries({ size, edges, useAllEdges, chamferType, size2, angle, flipDirection })) {
|
||||
if (value !== undefined) args[key] = value;
|
||||
}
|
||||
return this.record(object, label ?? `${dressUpType} ${object}`, "setDressUp", args);
|
||||
}
|
||||
|
||||
primitive(object, { primitiveType, parameters, position }, label) {
|
||||
return this.record(object, label ?? `${primitiveType} ${object}`, "setPrimitive", { primitiveType, parameters, position });
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build one document end to end and persist the three artefacts that the rest
|
||||
* of the toolkit consumes: FCStd (OPFS mirror + evidence copy), trace JSON and,
|
||||
* indirectly through the trace, the replay.
|
||||
*/
|
||||
export async function buildDocument(module, options = {}) {
|
||||
const { document, builder, build } = module;
|
||||
const part = await openPartDesign(document, { builder });
|
||||
const session = new Build(part, { document, builder });
|
||||
const started = Date.now();
|
||||
try {
|
||||
await build(session);
|
||||
configureOpfs({ root: path.join(outDir, "opfs", "freecad-exports") });
|
||||
const saved = part.saveDocument();
|
||||
const bytes = readExportFile(saved.name);
|
||||
const fcstdDir = path.join(outDir, "FCStd");
|
||||
fs.mkdirSync(fcstdDir, { recursive: true });
|
||||
fs.writeFileSync(path.join(fcstdDir, saved.name), bytes);
|
||||
const traceDir = path.join(outDir, "traces");
|
||||
fs.mkdirSync(traceDir, { recursive: true });
|
||||
const trace = part.trace();
|
||||
fs.writeFileSync(path.join(traceDir, `${document}.json`), `${JSON.stringify(trace, null, 2)}\n`);
|
||||
const objects = part.snapshot().objects ?? [];
|
||||
const body = objects.find(object => object.type === "PartDesign::Body");
|
||||
// The kernel snapshot exposes volume/faceCount/edgeCount per object but no
|
||||
// bounding box, so replay checks compare those three numbers (plus the step
|
||||
// list) rather than a bbox.
|
||||
const summary = {
|
||||
document, builder, steps: session.steps.length,
|
||||
volume: body?.volume ?? null,
|
||||
faceCount: body?.faceCount ?? null,
|
||||
edgeCount: body?.edgeCount ?? null,
|
||||
seconds: Number(((Date.now() - started) / 1000).toFixed(2)),
|
||||
fcstd: path.relative(caseDir, path.join(fcstdDir, saved.name)),
|
||||
};
|
||||
if (options.dry) console.log(JSON.stringify(summary));
|
||||
return summary;
|
||||
} finally {
|
||||
part.dispose?.();
|
||||
}
|
||||
}
|
||||
132
web/teaching/cases/carrier-partdesign/lib/sketch.mjs
Normal file
132
web/teaching/cases/carrier-partdesign/lib/sketch.mjs
Normal file
@@ -0,0 +1,132 @@
|
||||
// Sketch geometry helpers for the carrier PartDesign parts.
|
||||
//
|
||||
// The kernel's `setSketch` accepts three authored profile types: Rectangle and
|
||||
// Circle carry named dimensions, and `Geometry` carries an explicit
|
||||
// geometry list plus a constraint list (PartDesignDocumentWorkflow.cpp:2302).
|
||||
// Only the Geometry form can describe a hull section or a wing planform, and a
|
||||
// Geometry wire is closed ONLY when consecutive edges are joined by Coincident
|
||||
// constraints -- the kernel runs the solver and then hands the wire to
|
||||
// Pad/Loft, which rejects an open profile. So every polygon built here ends
|
||||
// with an explicit coincident chain, exactly like the built-in Rectangle does
|
||||
// (PartDesignDocumentWorkflow.cpp:2295).
|
||||
//
|
||||
// Coordinates are 2D on the sketch plane; z stays 0 and the sketch's
|
||||
// placementRotation puts it where it belongs (a hull station is a YZ plane, a
|
||||
// deck plan is XY).
|
||||
|
||||
const r9 = value => Math.round(Number(value) * 1e9) / 1e9;
|
||||
const pt = (x, y) => [r9(x), r9(y), 0];
|
||||
|
||||
/** One line segment geometry row. */
|
||||
export function line(start, end) {
|
||||
return { type: "line", start: pt(start[0], start[1]), end: pt(end[0], end[1]) };
|
||||
}
|
||||
|
||||
/** One arc geometry row; angles in radians, as the kernel reports them. */
|
||||
export function arc(center, radius, startAngle, endAngle) {
|
||||
return {
|
||||
type: "arc", center: pt(center[0], center[1]), radius: r9(radius),
|
||||
startAngle: r9(startAngle), endAngle: r9(endAngle),
|
||||
};
|
||||
}
|
||||
|
||||
/** Circle geometry (used inside a Geometry profile, e.g. a hole cut). */
|
||||
export function circle(center, radius) {
|
||||
return { type: "circle", center: pt(center[0], center[1]), radius: r9(radius) };
|
||||
}
|
||||
|
||||
/**
|
||||
* Turn a closed point loop into `{ geometries, constraints }`.
|
||||
*
|
||||
* The loop is emitted as lines and closed with a coincident chain; a tiny
|
||||
* optional `radius` corner rounding is NOT applied here because two arcs and
|
||||
* two lines would need tangent constraints the solver has to satisfy, and a
|
||||
* hull section built from many stations does not need it (the loft smooths).
|
||||
*/
|
||||
export function polygon(points) {
|
||||
const geometries = [];
|
||||
const constraints = [];
|
||||
const n = points.length;
|
||||
for (let i = 0; i < n; i += 1) {
|
||||
geometries.push(line(points[i], points[(i + 1) % n]));
|
||||
}
|
||||
for (let i = 0; i < n; i += 1) {
|
||||
constraints.push({
|
||||
type: "Coincident",
|
||||
first: i, firstPos: "end",
|
||||
second: (i + 1) % n, secondPos: "start",
|
||||
});
|
||||
}
|
||||
return { geometries, constraints };
|
||||
}
|
||||
|
||||
/** Rectangle loop centred on the sketch origin. */
|
||||
export function rectPoints(cx, cy, width, height) {
|
||||
const hw = width / 2, hh = height / 2;
|
||||
return [
|
||||
[cx - hw, cy - hh], [cx + hw, cy - hh],
|
||||
[cx + hw, cy + hh], [cx - hw, cy + hh],
|
||||
];
|
||||
}
|
||||
|
||||
/** Rectangle profile as a Geometry sketch body. */
|
||||
export function rect(cx, cy, width, height) {
|
||||
return polygon(rectPoints(cx, cy, width, height));
|
||||
}
|
||||
|
||||
/**
|
||||
* A band (long thin rectangle) whose axis runs at `angleDeg` from +X, centred
|
||||
* on (cx, cy). Catapult tracks, arrestor wires and deck markings are bands.
|
||||
*/
|
||||
export function band(cx, cy, length, width, angleDeg = 0) {
|
||||
const a = (angleDeg * Math.PI) / 180;
|
||||
const ux = Math.cos(a), uy = Math.sin(a);
|
||||
const vx = -uy, vy = ux;
|
||||
const hl = length / 2, hw = width / 2;
|
||||
const corner = (l, w) => [cx + ux * l + vx * w, cy + uy * l + vy * w];
|
||||
return polygon([corner(-hl, -hw), corner(hl, -hw), corner(hl, hw), corner(-hl, hw)]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge several closed loops into one multi-wire profile.
|
||||
*
|
||||
* Pad/Loft accept a profile made of several closed wires; a single sketch with
|
||||
* four elevator openings is one feature instead of four, which is the lesson
|
||||
* the reducer gear learned the hard way (chained recompute is the cost, not
|
||||
* the geometry).
|
||||
*/
|
||||
export function merge(...shapes) {
|
||||
const geometries = [];
|
||||
const constraints = [];
|
||||
let offset = 0;
|
||||
for (const shape of shapes) {
|
||||
geometries.push(...shape.geometries);
|
||||
for (const constraint of shape.constraints) {
|
||||
const shifted = { ...constraint };
|
||||
if (typeof shifted.first === "number") shifted.first += offset;
|
||||
if (typeof shifted.second === "number") shifted.second += offset;
|
||||
constraints.push(shifted);
|
||||
}
|
||||
offset += shape.geometries.length;
|
||||
}
|
||||
return { geometries, constraints };
|
||||
}
|
||||
|
||||
/** Quaternion for a sketch plane rotated `angleDeg` about `axis` ("x"|"y"|"z"). */
|
||||
export function rotation(axis, angleDeg) {
|
||||
const half = (angleDeg * Math.PI) / 360;
|
||||
const s = Math.sin(half), c = Math.cos(half);
|
||||
if (axis === "x") return [s, 0, 0, c];
|
||||
if (axis === "y") return [0, s, 0, c];
|
||||
return [0, 0, s, c];
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience: a sketch plane whose local XY is the world YZ plane at `x`.
|
||||
* Rotation -90 about Y maps local +X onto world +Z, so a station point is
|
||||
* written (height, beam) and reads the same way in the drawing.
|
||||
*/
|
||||
export const stationAt = x => ({ position: [x, 0, 0], placementRotation: rotation("y", -90) });
|
||||
|
||||
/** Convenience: a sketch plane whose local XY is the world XZ plane at `y`. */
|
||||
export const sideAt = y => ({ position: [0, y, 0], placementRotation: rotation("x", 90) });
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
207
web/teaching/cases/carrier-partdesign/out/index.json
Normal file
207
web/teaching/cases/carrier-partdesign/out/index.json
Normal file
@@ -0,0 +1,207 @@
|
||||
{
|
||||
"schema": "freecad-web-carrier-partdesign-index/v1",
|
||||
"generatedAt": "2026-11-25T09:39:12.743Z",
|
||||
"documents": {
|
||||
"CarrierCiws": {
|
||||
"id": "P10",
|
||||
"title": "近防炮",
|
||||
"system": "weapons",
|
||||
"steps": 8,
|
||||
"volume": 55.99481508149678,
|
||||
"bounds": null,
|
||||
"seconds": 1.92,
|
||||
"fcstd": "out/FCStd/CarrierCiws.FCStd",
|
||||
"builtAt": "2026-11-25T02:42:05.877Z"
|
||||
},
|
||||
"CarrierDeck": {
|
||||
"id": "P02",
|
||||
"title": "飞行甲板",
|
||||
"system": "flight-deck",
|
||||
"steps": 14,
|
||||
"volume": 35733.026212188044,
|
||||
"seconds": 26.5,
|
||||
"fcstd": "out/FCStd/CarrierDeck.FCStd",
|
||||
"builtAt": "2026-11-25T03:21:46.285Z"
|
||||
},
|
||||
"CarrierAngledDeck": {
|
||||
"id": "P03",
|
||||
"title": "斜角甲板",
|
||||
"system": "angled-deck",
|
||||
"steps": 2,
|
||||
"volume": 6912.000000095107,
|
||||
"seconds": 0.57,
|
||||
"fcstd": "out/FCStd/CarrierAngledDeck.FCStd",
|
||||
"builtAt": "2026-11-25T02:45:28.101Z"
|
||||
},
|
||||
"CarrierHangar": {
|
||||
"id": "P05",
|
||||
"title": "机库",
|
||||
"system": "hangar",
|
||||
"steps": 4,
|
||||
"volume": 39639.999999999985,
|
||||
"seconds": 1.75,
|
||||
"fcstd": "out/FCStd/CarrierHangar.FCStd",
|
||||
"builtAt": "2026-11-25T09:39:12.743Z"
|
||||
},
|
||||
"CarrierElevators": {
|
||||
"id": "P06",
|
||||
"title": "升降机",
|
||||
"system": "aircraft-handling",
|
||||
"steps": 8,
|
||||
"volume": 1007.9999999999995,
|
||||
"seconds": 1.7,
|
||||
"fcstd": "out/FCStd/CarrierElevators.FCStd",
|
||||
"builtAt": "2026-11-25T02:45:46.125Z"
|
||||
},
|
||||
"CarrierCatapults": {
|
||||
"id": "P07",
|
||||
"title": "弹射器",
|
||||
"system": "aircraft-handling",
|
||||
"steps": 8,
|
||||
"volume": 346.5000000205559,
|
||||
"seconds": 17.61,
|
||||
"fcstd": "out/FCStd/CarrierCatapults.FCStd",
|
||||
"builtAt": "2026-11-25T02:46:22.809Z"
|
||||
},
|
||||
"CarrierArrestorWires": {
|
||||
"id": "P08",
|
||||
"title": "拦阻索",
|
||||
"system": "aircraft-handling",
|
||||
"steps": 8,
|
||||
"volume": 25.199999999999346,
|
||||
"seconds": 1.91,
|
||||
"fcstd": "out/FCStd/CarrierArrestorWires.FCStd",
|
||||
"builtAt": "2026-11-25T02:46:34.582Z"
|
||||
},
|
||||
"CarrierRadar": {
|
||||
"id": "P09",
|
||||
"title": "相控阵雷达",
|
||||
"system": "sensors",
|
||||
"steps": 6,
|
||||
"volume": 69.33026138282548,
|
||||
"seconds": 1.2,
|
||||
"fcstd": "out/FCStd/CarrierRadar.FCStd",
|
||||
"builtAt": "2026-11-25T02:46:37.834Z"
|
||||
},
|
||||
"CarrierMarkings": {
|
||||
"id": "P20",
|
||||
"title": "甲板标线",
|
||||
"system": "markings",
|
||||
"steps": 6,
|
||||
"volume": 25.959599999996996,
|
||||
"seconds": 4.16,
|
||||
"fcstd": "out/FCStd/CarrierMarkings.FCStd",
|
||||
"builtAt": "2026-11-25T02:46:42.963Z"
|
||||
},
|
||||
"CarrierHull": {
|
||||
"id": "P01",
|
||||
"title": "舰体",
|
||||
"system": "hull-structure",
|
||||
"steps": 10,
|
||||
"volume": 260846.77920152084,
|
||||
"seconds": 4.04,
|
||||
"fcstd": "out/FCStd/CarrierHull.FCStd",
|
||||
"builtAt": "2026-11-25T02:59:31.032Z"
|
||||
},
|
||||
"CarrierIsland": {
|
||||
"id": "P04",
|
||||
"title": "舰岛",
|
||||
"system": "island",
|
||||
"steps": 11,
|
||||
"volume": 10658.25,
|
||||
"seconds": 10.23,
|
||||
"fcstd": "out/FCStd/CarrierIsland.FCStd",
|
||||
"builtAt": "2026-11-25T02:59:42.332Z"
|
||||
},
|
||||
"CarrierFighterA": {
|
||||
"id": "P11",
|
||||
"title": "舰载战斗机 A",
|
||||
"system": "air-fighter",
|
||||
"steps": 13,
|
||||
"volume": 82.94751637748307,
|
||||
"seconds": 12.63,
|
||||
"fcstd": "out/FCStd/CarrierFighterA.FCStd",
|
||||
"builtAt": "2026-11-25T03:06:11.062Z"
|
||||
},
|
||||
"CarrierFighterB": {
|
||||
"id": "P12",
|
||||
"title": "舰载战斗机 B",
|
||||
"system": "air-fighter",
|
||||
"steps": 13,
|
||||
"volume": 87.54004703082904,
|
||||
"seconds": 13.06,
|
||||
"fcstd": "out/FCStd/CarrierFighterB.FCStd",
|
||||
"builtAt": "2026-11-25T03:07:17.468Z"
|
||||
},
|
||||
"CarrierFighterC": {
|
||||
"id": "P13",
|
||||
"title": "舰载战斗机 C",
|
||||
"system": "air-fighter",
|
||||
"steps": 13,
|
||||
"volume": 74.27704220951199,
|
||||
"seconds": 13.68,
|
||||
"fcstd": "out/FCStd/CarrierFighterC.FCStd",
|
||||
"builtAt": "2026-11-25T03:07:32.109Z"
|
||||
},
|
||||
"CarrierFighterD": {
|
||||
"id": "P14",
|
||||
"title": "舰载战斗机 D",
|
||||
"system": "air-fighter",
|
||||
"steps": 13,
|
||||
"volume": 92.30909038541577,
|
||||
"seconds": 13.55,
|
||||
"fcstd": "out/FCStd/CarrierFighterD.FCStd",
|
||||
"builtAt": "2026-11-25T03:07:46.614Z"
|
||||
},
|
||||
"CarrierFighterE": {
|
||||
"id": "P15",
|
||||
"title": "舰载战斗机 E",
|
||||
"system": "air-fighter",
|
||||
"steps": 13,
|
||||
"volume": 78.52773673764473,
|
||||
"seconds": 14.64,
|
||||
"fcstd": "out/FCStd/CarrierFighterE.FCStd",
|
||||
"builtAt": "2026-11-25T03:08:02.233Z"
|
||||
},
|
||||
"CarrierFighterF": {
|
||||
"id": "P16",
|
||||
"title": "舰载战斗机 F",
|
||||
"system": "air-fighter",
|
||||
"steps": 13,
|
||||
"volume": 85.22195279514976,
|
||||
"seconds": 12.63,
|
||||
"fcstd": "out/FCStd/CarrierFighterF.FCStd",
|
||||
"builtAt": "2026-11-25T03:08:15.840Z"
|
||||
},
|
||||
"CarrierAwacs": {
|
||||
"id": "P17",
|
||||
"title": "舰载预警机",
|
||||
"system": "air-awacs",
|
||||
"steps": 21,
|
||||
"volume": 254.94042344150378,
|
||||
"seconds": 34.17,
|
||||
"fcstd": "out/FCStd/CarrierAwacs.FCStd",
|
||||
"builtAt": "2026-11-25T03:08:50.977Z"
|
||||
},
|
||||
"CarrierHelicopterA": {
|
||||
"id": "P18",
|
||||
"title": "舰载直升机 A",
|
||||
"system": "air-rotor",
|
||||
"steps": 13,
|
||||
"volume": 48.34826428466978,
|
||||
"seconds": 8.63,
|
||||
"fcstd": "out/FCStd/CarrierHelicopterA.FCStd",
|
||||
"builtAt": "2026-11-25T03:09:00.538Z"
|
||||
},
|
||||
"CarrierHelicopterB": {
|
||||
"id": "P19",
|
||||
"title": "舰载直升机 B",
|
||||
"system": "air-rotor",
|
||||
"steps": 13,
|
||||
"volume": 48.39866428466979,
|
||||
"seconds": 8.87,
|
||||
"fcstd": "out/FCStd/CarrierHelicopterB.FCStd",
|
||||
"builtAt": "2026-11-25T03:09:10.413Z"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"schema":"freecad-web-process-replay/v1","document":"CarrierAngledDeck","source":"web/teaching/cases/carrier-partdesign/out/FCStd/CarrierAngledDeck.FCStd","meshMs":69,"steps":[{"step":1,"label":"CarrierAngledDeck · 斜角甲板平面","action":"setSketch","seconds":0.0598,"args":{"object":"AngledPlan","body":"Body","profileType":"Geometry","position":[0,0,24],"geometries":{"count":4,"sha256":"4db5d5b809389276"},"constraints":{"count":4,"sha256":"a7dc762a36ba48a3"}},"feature":"AngledPlan","volume":0,"faceCount":1,"mesh":{"positions":[77.162,4.584,24,-157.162,-52.584,24,80.502,-19.182,24,77.162,4.584,24,-160.502,-28.818,24,-157.162,-52.584,24],"normals":[0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1],"triangleCount":2,"bounds":[-160.50224546100003,-52.58398894,24,80.502245461,4.583988940000001,24]}},{"step":2,"label":"CarrierAngledDeck · 斜角甲板","action":"setFeature","seconds":0.2388,"args":{"object":"AngledPad","body":"Body","featureType":"Pad","profile":"AngledPlan","length":1.2},"feature":"AngledPad","volume":6912.000000095107,"faceCount":6,"mesh":{"positions":[-157.162,-52.584,24,80.502,-19.182,24,-157.162,-52.584,25.2,-157.162,-52.584,25.2,80.502,-19.182,24,80.502,-19.182,25.2,80.502,-19.182,24,77.162,4.584,24,80.502,-19.182,25.2,80.502,-19.182,25.2,77.162,4.584,24,77.162,4.584,25.2,77.162,4.584,24,-160.502,-28.818,24,77.162,4.584,25.2,77.162,4.584,25.2,-160.502,-28.818,24,-160.502,-28.818,25.2,-160.502,-28.818,24,-157.162,-52.584,24,-160.502,-28.818,25.2,-160.502,-28.818,25.2,-157.162,-52.584,24,-157.162,-52.584,25.2,-157.162,-52.584,24,77.162,4.584,24,80.502,-19.182,24,-160.502,-28.818,24,77.162,4.584,24,-157.162,-52.584,24,77.162,4.584,25.2,-157.162,-52.584,25.2,80.502,-19.182,25.2,77.162,4.584,25.2,-160.502,-28.818,25.2,-157.162,-52.584,25.2],"normals":[0.139,-0.99,0,0.139,-0.99,0,0.139,-0.99,0,0.139,-0.99,0,0.139,-0.99,0,0.139,-0.99,0,0.99,0.139,0,0.99,0.139,0,0.99,0.139,0,0.99,0.139,0,0.99,0.139,0,0.99,0.139,0,-0.139,0.99,0,-0.139,0.99,0,-0.139,0.99,0,-0.139,0.99,0,-0.139,0.99,0,-0.139,0.99,0,-0.99,-0.139,0,-0.99,-0.139,0,-0.99,-0.139,0,-0.99,-0.139,0,-0.99,-0.139,0,-0.99,-0.139,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1],"triangleCount":12,"bounds":[-160.50224546100003,-52.58398894,24,80.502245461,4.583988940000001,25.2]}}]}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
{"schema":"freecad-web-process-replay/v1","document":"CarrierHangar","source":"web/teaching/cases/carrier-partdesign/out/FCStd/CarrierHangar.FCStd","meshMs":130,"steps":[{"step":1,"label":"CarrierHangar · 机库外壳平面","action":"setSketch","seconds":0.1795,"args":{"object":"HangarShellSketch","body":"Body","profileType":"Geometry","position":[0,0,8],"geometries":{"count":4,"sha256":"33b2eb432edc596c"},"constraints":{"count":4,"sha256":"a7dc762a36ba48a3"}},"feature":"HangarShellSketch","volume":0,"faceCount":1,"mesh":{"positions":[60,17,8,-140,-17,8,60,-17,8,60,17,8,-140,17,8,-140,-17,8],"normals":[0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1],"triangleCount":2,"bounds":[-140,-17,8,60,17,8]}},{"step":2,"label":"CarrierHangar · 机库外壳","action":"setFeature","seconds":0.2389,"args":{"object":"HangarShell","body":"Body","featureType":"Pad","profile":"HangarShellSketch","length":16},"feature":"HangarShell","volume":108800.00000000003,"faceCount":6,"mesh":{"positions":[-140,-17,8,60,-17,8,-140,-17,24,-140,-17,24,60,-17,8,60,-17,24,60,-17,8,60,17,24,60,-17,24,60,-17,8,60,17,8,60,17,24,60,17,8,-140,17,8,60,17,24,60,17,24,-140,17,8,-140,17,24,-140,17,8,-140,-17,24,-140,17,24,-140,17,8,-140,-17,8,-140,-17,24,-140,-17,8,60,17,8,60,-17,8,-140,17,8,60,17,8,-140,-17,8,60,17,24,-140,-17,24,60,-17,24,60,17,24,-140,17,24,-140,-17,24],"normals":[0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1],"triangleCount":12,"bounds":[-140,-17,8,60,17,24]}},{"step":3,"label":"CarrierHangar · 机库内腔平面","action":"setSketch","seconds":0.0737,"args":{"object":"HangarCavitySketch","body":"Body","profileType":"Geometry","position":[0,0,24],"geometries":{"count":4,"sha256":"e7903266b587a746"},"constraints":{"count":4,"sha256":"a7dc762a36ba48a3"}},"feature":"HangarCavitySketch","volume":0,"faceCount":1,"mesh":{"positions":[55,14,24,-135,-14,24,55,-14,24,55,14,24,-135,14,24,-135,-14,24],"normals":[0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1],"triangleCount":2,"bounds":[-135,-14,24,55,14,24]}},{"step":4,"label":"CarrierHangar · 掏空内腔","action":"setFeature","seconds":0.3998,"args":{"object":"HangarCavity","body":"Body","featureType":"Pocket","profile":"HangarCavitySketch","length":13},"feature":"HangarCavity","volume":39639.999999999985,"faceCount":11,"mesh":{"positions":[-140,-17,8,60,-17,8,-140,-17,24,-140,-17,24,60,-17,8,60,-17,24,-140,17,8,-140,-17,24,-140,17,24,-140,17,8,-140,-17,8,-140,-17,24,60,-17,8,60,17,24,60,-17,24,60,-17,8,60,17,8,60,17,24,-140,-17,8,60,17,8,60,-17,8,-140,17,8,60,17,8,-140,-17,8,-135,14,24,-140,17,24,-140,-17,24,-135,14,24,-140,-17,24,-135,-14,24,60,-17,24,55,-14,24,-135,-14,24,60,-17,24,-135,-14,24,-140,-17,24,60,17,24,55,14,24,55,-14,24,60,17,24,55,-14,24,60,-17,24,60,17,24,-140,17,24,-135,14,24,60,17,24,-135,14,24,55,14,24,60,17,8,-140,17,8,60,17,24,60,17,24,-140,17,8,-140,17,24,-135,-14,24,55,-14,24,-135,-14,11,-135,-14,11,55,-14,24,55,-14,11,55,-14,24,55,14,11,55,-14,11,55,-14,24,55,14,24,55,14,11,55,14,24,-135,14,24,55,14,11,55,14,11,-135,14,24,-135,14,11,-135,14,24,-135,-14,11,-135,14,11,-135,14,24,-135,-14,24,-135,-14,11,55,14,11,-135,-14,11,55,-14,11,55,14,11,-135,14,11,-135,-14,11],"normals":[0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1],"triangleCount":28,"bounds":[-140,-17,8,60,17,24]}}]}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
17
web/teaching/cases/carrier-partdesign/out/replay/index.json
Normal file
17
web/teaching/cases/carrier-partdesign/out/replay/index.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"schema": "freecad-web-process-replay/v1",
|
||||
"generatedAt": "2026-11-25T09:42:37.240Z",
|
||||
"documents": [
|
||||
{
|
||||
"document": "CarrierHangar",
|
||||
"kind": "part",
|
||||
"events": 4,
|
||||
"steps": 4,
|
||||
"withMesh": 4,
|
||||
"solids": 4,
|
||||
"bytes": 3893,
|
||||
"meshMs": 130
|
||||
}
|
||||
],
|
||||
"failures": []
|
||||
}
|
||||
@@ -0,0 +1,286 @@
|
||||
{
|
||||
"schema": "freecad-web-process-trace/v1",
|
||||
"document": "CarrierAngledDeck",
|
||||
"builder": "deck",
|
||||
"totals": {
|
||||
"seconds": 0.299,
|
||||
"steps": 2,
|
||||
"timings": [
|
||||
{
|
||||
"label": "CarrierAngledDeck · 斜角甲板平面",
|
||||
"action": "setSketch",
|
||||
"seconds": 0.059793516000000636
|
||||
},
|
||||
{
|
||||
"label": "CarrierAngledDeck · 斜角甲板",
|
||||
"action": "setFeature",
|
||||
"seconds": 0.238780385
|
||||
}
|
||||
]
|
||||
},
|
||||
"events": [
|
||||
{
|
||||
"step": 1,
|
||||
"label": "CarrierAngledDeck · 斜角甲板平面",
|
||||
"action": "setSketch",
|
||||
"args": {
|
||||
"object": "AngledPlan",
|
||||
"body": "Body",
|
||||
"profileType": "Geometry",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
24
|
||||
],
|
||||
"geometries": {
|
||||
"count": 4,
|
||||
"sha256": "4db5d5b809389276"
|
||||
},
|
||||
"constraints": {
|
||||
"count": 4,
|
||||
"sha256": "a7dc762a36ba48a3"
|
||||
}
|
||||
},
|
||||
"seconds": 0.0598,
|
||||
"tips": {
|
||||
"objectCount": 10,
|
||||
"tip": "AngledPlan",
|
||||
"objects": [
|
||||
{
|
||||
"name": "Body",
|
||||
"label": "Body",
|
||||
"type": "PartDesign::Body",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"volume": null,
|
||||
"faceCount": 0,
|
||||
"edgeCount": null,
|
||||
"vertexCount": 0
|
||||
},
|
||||
{
|
||||
"name": "Origin",
|
||||
"label": "Origin",
|
||||
"type": "App::Origin",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "X_Axis",
|
||||
"label": "X-axis",
|
||||
"type": "App::Line",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "Y_Axis",
|
||||
"label": "Y-axis",
|
||||
"type": "App::Line",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "Z_Axis",
|
||||
"label": "Z-axis",
|
||||
"type": "App::Line",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "XY_Plane",
|
||||
"label": "XY-plane",
|
||||
"type": "App::Plane",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "XZ_Plane",
|
||||
"label": "XZ-plane",
|
||||
"type": "App::Plane",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "YZ_Plane",
|
||||
"label": "YZ-plane",
|
||||
"type": "App::Plane",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "Origin001",
|
||||
"label": "Origin001",
|
||||
"type": "App::Point",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "AngledPlan",
|
||||
"label": "AngledPlan",
|
||||
"type": "Sketcher::SketchObject",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
24
|
||||
],
|
||||
"volume": 0,
|
||||
"faceCount": 0,
|
||||
"edgeCount": 4,
|
||||
"vertexCount": 4
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"step": 2,
|
||||
"label": "CarrierAngledDeck · 斜角甲板",
|
||||
"action": "setFeature",
|
||||
"args": {
|
||||
"object": "AngledPad",
|
||||
"body": "Body",
|
||||
"featureType": "Pad",
|
||||
"profile": "AngledPlan",
|
||||
"length": 1.2
|
||||
},
|
||||
"seconds": 0.2388,
|
||||
"tips": {
|
||||
"objectCount": 11,
|
||||
"tip": "AngledPad",
|
||||
"objects": [
|
||||
{
|
||||
"name": "Body",
|
||||
"label": "Body",
|
||||
"type": "PartDesign::Body",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"volume": 6912.000000095107,
|
||||
"faceCount": 6,
|
||||
"edgeCount": 12,
|
||||
"vertexCount": 8
|
||||
},
|
||||
{
|
||||
"name": "Origin",
|
||||
"label": "Origin",
|
||||
"type": "App::Origin",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "X_Axis",
|
||||
"label": "X-axis",
|
||||
"type": "App::Line",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "Y_Axis",
|
||||
"label": "Y-axis",
|
||||
"type": "App::Line",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "Z_Axis",
|
||||
"label": "Z-axis",
|
||||
"type": "App::Line",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "XY_Plane",
|
||||
"label": "XY-plane",
|
||||
"type": "App::Plane",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "XZ_Plane",
|
||||
"label": "XZ-plane",
|
||||
"type": "App::Plane",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "YZ_Plane",
|
||||
"label": "YZ-plane",
|
||||
"type": "App::Plane",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "Origin001",
|
||||
"label": "Origin001",
|
||||
"type": "App::Point",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "AngledPlan",
|
||||
"label": "AngledPlan",
|
||||
"type": "Sketcher::SketchObject",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
24
|
||||
],
|
||||
"volume": 0,
|
||||
"faceCount": 0,
|
||||
"edgeCount": 4,
|
||||
"vertexCount": 4
|
||||
},
|
||||
{
|
||||
"name": "AngledPad",
|
||||
"label": "AngledPad",
|
||||
"type": "PartDesign::Pad",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
24
|
||||
],
|
||||
"volume": 6912.000000095107,
|
||||
"faceCount": 6,
|
||||
"edgeCount": 12,
|
||||
"vertexCount": 8
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
5681
web/teaching/cases/carrier-partdesign/out/traces/CarrierAwacs.json
Normal file
5681
web/teaching/cases/carrier-partdesign/out/traces/CarrierAwacs.json
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
1438
web/teaching/cases/carrier-partdesign/out/traces/CarrierCiws.json
Normal file
1438
web/teaching/cases/carrier-partdesign/out/traces/CarrierCiws.json
Normal file
File diff suppressed because it is too large
Load Diff
3099
web/teaching/cases/carrier-partdesign/out/traces/CarrierDeck.json
Normal file
3099
web/teaching/cases/carrier-partdesign/out/traces/CarrierDeck.json
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,615 @@
|
||||
{
|
||||
"schema": "freecad-web-process-trace/v1",
|
||||
"document": "CarrierHangar",
|
||||
"builder": "hangar",
|
||||
"totals": {
|
||||
"seconds": 0.892,
|
||||
"steps": 4,
|
||||
"timings": [
|
||||
{
|
||||
"label": "CarrierHangar · 机库外壳平面",
|
||||
"action": "setSketch",
|
||||
"seconds": 0.179451726
|
||||
},
|
||||
{
|
||||
"label": "CarrierHangar · 机库外壳",
|
||||
"action": "setFeature",
|
||||
"seconds": 0.23893987600000013
|
||||
},
|
||||
{
|
||||
"label": "CarrierHangar · 机库内腔平面",
|
||||
"action": "setSketch",
|
||||
"seconds": 0.07365641499999992
|
||||
},
|
||||
{
|
||||
"label": "CarrierHangar · 掏空内腔",
|
||||
"action": "setFeature",
|
||||
"seconds": 0.3998322840000001
|
||||
}
|
||||
]
|
||||
},
|
||||
"events": [
|
||||
{
|
||||
"step": 1,
|
||||
"label": "CarrierHangar · 机库外壳平面",
|
||||
"action": "setSketch",
|
||||
"args": {
|
||||
"object": "HangarShellSketch",
|
||||
"body": "Body",
|
||||
"profileType": "Geometry",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
8
|
||||
],
|
||||
"geometries": {
|
||||
"count": 4,
|
||||
"sha256": "33b2eb432edc596c"
|
||||
},
|
||||
"constraints": {
|
||||
"count": 4,
|
||||
"sha256": "a7dc762a36ba48a3"
|
||||
}
|
||||
},
|
||||
"seconds": 0.1795,
|
||||
"tips": {
|
||||
"objectCount": 10,
|
||||
"tip": "HangarShellSketch",
|
||||
"objects": [
|
||||
{
|
||||
"name": "Body",
|
||||
"label": "Body",
|
||||
"type": "PartDesign::Body",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"volume": null,
|
||||
"faceCount": 0,
|
||||
"edgeCount": null,
|
||||
"vertexCount": 0
|
||||
},
|
||||
{
|
||||
"name": "Origin",
|
||||
"label": "Origin",
|
||||
"type": "App::Origin",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "X_Axis",
|
||||
"label": "X-axis",
|
||||
"type": "App::Line",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "Y_Axis",
|
||||
"label": "Y-axis",
|
||||
"type": "App::Line",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "Z_Axis",
|
||||
"label": "Z-axis",
|
||||
"type": "App::Line",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "XY_Plane",
|
||||
"label": "XY-plane",
|
||||
"type": "App::Plane",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "XZ_Plane",
|
||||
"label": "XZ-plane",
|
||||
"type": "App::Plane",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "YZ_Plane",
|
||||
"label": "YZ-plane",
|
||||
"type": "App::Plane",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "Origin001",
|
||||
"label": "Origin001",
|
||||
"type": "App::Point",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "HangarShellSketch",
|
||||
"label": "HangarShellSketch",
|
||||
"type": "Sketcher::SketchObject",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
8
|
||||
],
|
||||
"volume": 0,
|
||||
"faceCount": 0,
|
||||
"edgeCount": 4,
|
||||
"vertexCount": 4
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"step": 2,
|
||||
"label": "CarrierHangar · 机库外壳",
|
||||
"action": "setFeature",
|
||||
"args": {
|
||||
"object": "HangarShell",
|
||||
"body": "Body",
|
||||
"featureType": "Pad",
|
||||
"profile": "HangarShellSketch",
|
||||
"length": 16
|
||||
},
|
||||
"seconds": 0.2389,
|
||||
"tips": {
|
||||
"objectCount": 11,
|
||||
"tip": "HangarShell",
|
||||
"objects": [
|
||||
{
|
||||
"name": "Body",
|
||||
"label": "Body",
|
||||
"type": "PartDesign::Body",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"volume": 108800.00000000003,
|
||||
"faceCount": 6,
|
||||
"edgeCount": 12,
|
||||
"vertexCount": 8
|
||||
},
|
||||
{
|
||||
"name": "Origin",
|
||||
"label": "Origin",
|
||||
"type": "App::Origin",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "X_Axis",
|
||||
"label": "X-axis",
|
||||
"type": "App::Line",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "Y_Axis",
|
||||
"label": "Y-axis",
|
||||
"type": "App::Line",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "Z_Axis",
|
||||
"label": "Z-axis",
|
||||
"type": "App::Line",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "XY_Plane",
|
||||
"label": "XY-plane",
|
||||
"type": "App::Plane",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "XZ_Plane",
|
||||
"label": "XZ-plane",
|
||||
"type": "App::Plane",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "YZ_Plane",
|
||||
"label": "YZ-plane",
|
||||
"type": "App::Plane",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "Origin001",
|
||||
"label": "Origin001",
|
||||
"type": "App::Point",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "HangarShellSketch",
|
||||
"label": "HangarShellSketch",
|
||||
"type": "Sketcher::SketchObject",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
8
|
||||
],
|
||||
"volume": 0,
|
||||
"faceCount": 0,
|
||||
"edgeCount": 4,
|
||||
"vertexCount": 4
|
||||
},
|
||||
{
|
||||
"name": "HangarShell",
|
||||
"label": "HangarShell",
|
||||
"type": "PartDesign::Pad",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
8
|
||||
],
|
||||
"volume": 108800.00000000003,
|
||||
"faceCount": 6,
|
||||
"edgeCount": 12,
|
||||
"vertexCount": 8
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"step": 3,
|
||||
"label": "CarrierHangar · 机库内腔平面",
|
||||
"action": "setSketch",
|
||||
"args": {
|
||||
"object": "HangarCavitySketch",
|
||||
"body": "Body",
|
||||
"profileType": "Geometry",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
24
|
||||
],
|
||||
"geometries": {
|
||||
"count": 4,
|
||||
"sha256": "e7903266b587a746"
|
||||
},
|
||||
"constraints": {
|
||||
"count": 4,
|
||||
"sha256": "a7dc762a36ba48a3"
|
||||
}
|
||||
},
|
||||
"seconds": 0.0737,
|
||||
"tips": {
|
||||
"objectCount": 12,
|
||||
"tip": "HangarCavitySketch",
|
||||
"objects": [
|
||||
{
|
||||
"name": "Body",
|
||||
"label": "Body",
|
||||
"type": "PartDesign::Body",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"volume": 108800.00000000003,
|
||||
"faceCount": 6,
|
||||
"edgeCount": 12,
|
||||
"vertexCount": 8
|
||||
},
|
||||
{
|
||||
"name": "Origin",
|
||||
"label": "Origin",
|
||||
"type": "App::Origin",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "X_Axis",
|
||||
"label": "X-axis",
|
||||
"type": "App::Line",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "Y_Axis",
|
||||
"label": "Y-axis",
|
||||
"type": "App::Line",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "Z_Axis",
|
||||
"label": "Z-axis",
|
||||
"type": "App::Line",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "XY_Plane",
|
||||
"label": "XY-plane",
|
||||
"type": "App::Plane",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "XZ_Plane",
|
||||
"label": "XZ-plane",
|
||||
"type": "App::Plane",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "YZ_Plane",
|
||||
"label": "YZ-plane",
|
||||
"type": "App::Plane",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "Origin001",
|
||||
"label": "Origin001",
|
||||
"type": "App::Point",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "HangarShellSketch",
|
||||
"label": "HangarShellSketch",
|
||||
"type": "Sketcher::SketchObject",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
8
|
||||
],
|
||||
"volume": 0,
|
||||
"faceCount": 0,
|
||||
"edgeCount": 4,
|
||||
"vertexCount": 4
|
||||
},
|
||||
{
|
||||
"name": "HangarShell",
|
||||
"label": "HangarShell",
|
||||
"type": "PartDesign::Pad",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
8
|
||||
],
|
||||
"volume": 108800.00000000003,
|
||||
"faceCount": 6,
|
||||
"edgeCount": 12,
|
||||
"vertexCount": 8
|
||||
},
|
||||
{
|
||||
"name": "HangarCavitySketch",
|
||||
"label": "HangarCavitySketch",
|
||||
"type": "Sketcher::SketchObject",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
24
|
||||
],
|
||||
"volume": 0,
|
||||
"faceCount": 0,
|
||||
"edgeCount": 4,
|
||||
"vertexCount": 4
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"step": 4,
|
||||
"label": "CarrierHangar · 掏空内腔",
|
||||
"action": "setFeature",
|
||||
"args": {
|
||||
"object": "HangarCavity",
|
||||
"body": "Body",
|
||||
"featureType": "Pocket",
|
||||
"profile": "HangarCavitySketch",
|
||||
"length": 13
|
||||
},
|
||||
"seconds": 0.3998,
|
||||
"tips": {
|
||||
"objectCount": 13,
|
||||
"tip": "HangarCavity",
|
||||
"objects": [
|
||||
{
|
||||
"name": "Body",
|
||||
"label": "Body",
|
||||
"type": "PartDesign::Body",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"volume": 39639.999999999985,
|
||||
"faceCount": 11,
|
||||
"edgeCount": 24,
|
||||
"vertexCount": 16
|
||||
},
|
||||
{
|
||||
"name": "Origin",
|
||||
"label": "Origin",
|
||||
"type": "App::Origin",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "X_Axis",
|
||||
"label": "X-axis",
|
||||
"type": "App::Line",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "Y_Axis",
|
||||
"label": "Y-axis",
|
||||
"type": "App::Line",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "Z_Axis",
|
||||
"label": "Z-axis",
|
||||
"type": "App::Line",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "XY_Plane",
|
||||
"label": "XY-plane",
|
||||
"type": "App::Plane",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "XZ_Plane",
|
||||
"label": "XZ-plane",
|
||||
"type": "App::Plane",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "YZ_Plane",
|
||||
"label": "YZ-plane",
|
||||
"type": "App::Plane",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "Origin001",
|
||||
"label": "Origin001",
|
||||
"type": "App::Point",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "HangarShellSketch",
|
||||
"label": "HangarShellSketch",
|
||||
"type": "Sketcher::SketchObject",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
8
|
||||
],
|
||||
"volume": 0,
|
||||
"faceCount": 0,
|
||||
"edgeCount": 4,
|
||||
"vertexCount": 4
|
||||
},
|
||||
{
|
||||
"name": "HangarShell",
|
||||
"label": "HangarShell",
|
||||
"type": "PartDesign::Pad",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
8
|
||||
],
|
||||
"volume": 108800.00000000003,
|
||||
"faceCount": 6,
|
||||
"edgeCount": 12,
|
||||
"vertexCount": 8
|
||||
},
|
||||
{
|
||||
"name": "HangarCavitySketch",
|
||||
"label": "HangarCavitySketch",
|
||||
"type": "Sketcher::SketchObject",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
24
|
||||
],
|
||||
"volume": 0,
|
||||
"faceCount": 0,
|
||||
"edgeCount": 4,
|
||||
"vertexCount": 4
|
||||
},
|
||||
{
|
||||
"name": "HangarCavity",
|
||||
"label": "HangarCavity",
|
||||
"type": "PartDesign::Pocket",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
8
|
||||
],
|
||||
"volume": 39639.999999999985,
|
||||
"faceCount": 11,
|
||||
"edgeCount": 24,
|
||||
"vertexCount": 16
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
2047
web/teaching/cases/carrier-partdesign/out/traces/CarrierHull.json
Normal file
2047
web/teaching/cases/carrier-partdesign/out/traces/CarrierHull.json
Normal file
File diff suppressed because it is too large
Load Diff
2198
web/teaching/cases/carrier-partdesign/out/traces/CarrierIsland.json
Normal file
2198
web/teaching/cases/carrier-partdesign/out/traces/CarrierIsland.json
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,996 @@
|
||||
{
|
||||
"schema": "freecad-web-process-trace/v1",
|
||||
"document": "CarrierRadar",
|
||||
"builder": "sensors",
|
||||
"totals": {
|
||||
"seconds": 1.064,
|
||||
"steps": 6,
|
||||
"timings": [
|
||||
{
|
||||
"label": "CarrierRadar · 雷达基座截面",
|
||||
"action": "setSketch",
|
||||
"seconds": 0.030709644000002298
|
||||
},
|
||||
{
|
||||
"label": "CarrierRadar · 雷达基座",
|
||||
"action": "setFeature",
|
||||
"seconds": 0.06350509900000179
|
||||
},
|
||||
{
|
||||
"label": "CarrierRadar · 阵面草图",
|
||||
"action": "setSketch",
|
||||
"seconds": 0.05788390299999446
|
||||
},
|
||||
{
|
||||
"label": "CarrierRadar · 相控阵面",
|
||||
"action": "setFeature",
|
||||
"seconds": 0.4745789090000035
|
||||
},
|
||||
{
|
||||
"label": "CarrierRadar · 阵面支架截面",
|
||||
"action": "setSketch",
|
||||
"seconds": 0.08302601299999515
|
||||
},
|
||||
{
|
||||
"label": "CarrierRadar · 阵面支架",
|
||||
"action": "setFeature",
|
||||
"seconds": 0.35445988500000386
|
||||
}
|
||||
]
|
||||
},
|
||||
"events": [
|
||||
{
|
||||
"step": 1,
|
||||
"label": "CarrierRadar · 雷达基座截面",
|
||||
"action": "setSketch",
|
||||
"args": {
|
||||
"object": "RadarPedestalSketch",
|
||||
"body": "Body",
|
||||
"profileType": "Circle",
|
||||
"parameters": {
|
||||
"Radius": 2.2
|
||||
},
|
||||
"position": [
|
||||
4,
|
||||
28,
|
||||
53
|
||||
]
|
||||
},
|
||||
"seconds": 0.0307,
|
||||
"tips": {
|
||||
"objectCount": 10,
|
||||
"tip": "RadarPedestalSketch",
|
||||
"objects": [
|
||||
{
|
||||
"name": "Body",
|
||||
"label": "Body",
|
||||
"type": "PartDesign::Body",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"volume": null,
|
||||
"faceCount": 0,
|
||||
"edgeCount": null,
|
||||
"vertexCount": 0
|
||||
},
|
||||
{
|
||||
"name": "Origin",
|
||||
"label": "Origin",
|
||||
"type": "App::Origin",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "X_Axis",
|
||||
"label": "X-axis",
|
||||
"type": "App::Line",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "Y_Axis",
|
||||
"label": "Y-axis",
|
||||
"type": "App::Line",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "Z_Axis",
|
||||
"label": "Z-axis",
|
||||
"type": "App::Line",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "XY_Plane",
|
||||
"label": "XY-plane",
|
||||
"type": "App::Plane",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "XZ_Plane",
|
||||
"label": "XZ-plane",
|
||||
"type": "App::Plane",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "YZ_Plane",
|
||||
"label": "YZ-plane",
|
||||
"type": "App::Plane",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "Origin001",
|
||||
"label": "Origin001",
|
||||
"type": "App::Point",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "RadarPedestalSketch",
|
||||
"label": "RadarPedestalSketch",
|
||||
"type": "Sketcher::SketchObject",
|
||||
"position": [
|
||||
4,
|
||||
28,
|
||||
53
|
||||
],
|
||||
"volume": 0,
|
||||
"faceCount": 0,
|
||||
"edgeCount": 1,
|
||||
"vertexCount": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"step": 2,
|
||||
"label": "CarrierRadar · 雷达基座",
|
||||
"action": "setFeature",
|
||||
"args": {
|
||||
"object": "RadarPedestal",
|
||||
"body": "Body",
|
||||
"featureType": "Pad",
|
||||
"profile": "RadarPedestalSketch",
|
||||
"length": 3
|
||||
},
|
||||
"seconds": 0.0635,
|
||||
"tips": {
|
||||
"objectCount": 11,
|
||||
"tip": "RadarPedestal",
|
||||
"objects": [
|
||||
{
|
||||
"name": "Body",
|
||||
"label": "Body",
|
||||
"type": "PartDesign::Body",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"volume": 45.6159253301238,
|
||||
"faceCount": 3,
|
||||
"edgeCount": 3,
|
||||
"vertexCount": 2
|
||||
},
|
||||
{
|
||||
"name": "Origin",
|
||||
"label": "Origin",
|
||||
"type": "App::Origin",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "X_Axis",
|
||||
"label": "X-axis",
|
||||
"type": "App::Line",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "Y_Axis",
|
||||
"label": "Y-axis",
|
||||
"type": "App::Line",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "Z_Axis",
|
||||
"label": "Z-axis",
|
||||
"type": "App::Line",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "XY_Plane",
|
||||
"label": "XY-plane",
|
||||
"type": "App::Plane",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "XZ_Plane",
|
||||
"label": "XZ-plane",
|
||||
"type": "App::Plane",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "YZ_Plane",
|
||||
"label": "YZ-plane",
|
||||
"type": "App::Plane",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "Origin001",
|
||||
"label": "Origin001",
|
||||
"type": "App::Point",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "RadarPedestalSketch",
|
||||
"label": "RadarPedestalSketch",
|
||||
"type": "Sketcher::SketchObject",
|
||||
"position": [
|
||||
4,
|
||||
28,
|
||||
53
|
||||
],
|
||||
"volume": 0,
|
||||
"faceCount": 0,
|
||||
"edgeCount": 1,
|
||||
"vertexCount": 1
|
||||
},
|
||||
{
|
||||
"name": "RadarPedestal",
|
||||
"label": "RadarPedestal",
|
||||
"type": "PartDesign::Pad",
|
||||
"position": [
|
||||
4,
|
||||
28,
|
||||
53
|
||||
],
|
||||
"volume": 45.61592533012381,
|
||||
"faceCount": 3,
|
||||
"edgeCount": 3,
|
||||
"vertexCount": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"step": 3,
|
||||
"label": "CarrierRadar · 阵面草图",
|
||||
"action": "setSketch",
|
||||
"args": {
|
||||
"object": "RadarFaceSketch",
|
||||
"body": "Body",
|
||||
"profileType": "Geometry",
|
||||
"position": [
|
||||
0,
|
||||
28,
|
||||
0
|
||||
],
|
||||
"placementRotation": [
|
||||
0.7071067811865476,
|
||||
0,
|
||||
0,
|
||||
0.7071067811865476
|
||||
],
|
||||
"geometries": {
|
||||
"count": 4,
|
||||
"sha256": "67346469493e7308"
|
||||
},
|
||||
"constraints": {
|
||||
"count": 4,
|
||||
"sha256": "a7dc762a36ba48a3"
|
||||
}
|
||||
},
|
||||
"seconds": 0.0579,
|
||||
"tips": {
|
||||
"objectCount": 12,
|
||||
"tip": "RadarFaceSketch",
|
||||
"objects": [
|
||||
{
|
||||
"name": "Body",
|
||||
"label": "Body",
|
||||
"type": "PartDesign::Body",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"volume": 45.6159253301238,
|
||||
"faceCount": 3,
|
||||
"edgeCount": 3,
|
||||
"vertexCount": 2
|
||||
},
|
||||
{
|
||||
"name": "Origin",
|
||||
"label": "Origin",
|
||||
"type": "App::Origin",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "X_Axis",
|
||||
"label": "X-axis",
|
||||
"type": "App::Line",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "Y_Axis",
|
||||
"label": "Y-axis",
|
||||
"type": "App::Line",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "Z_Axis",
|
||||
"label": "Z-axis",
|
||||
"type": "App::Line",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "XY_Plane",
|
||||
"label": "XY-plane",
|
||||
"type": "App::Plane",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "XZ_Plane",
|
||||
"label": "XZ-plane",
|
||||
"type": "App::Plane",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "YZ_Plane",
|
||||
"label": "YZ-plane",
|
||||
"type": "App::Plane",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "Origin001",
|
||||
"label": "Origin001",
|
||||
"type": "App::Point",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "RadarPedestalSketch",
|
||||
"label": "RadarPedestalSketch",
|
||||
"type": "Sketcher::SketchObject",
|
||||
"position": [
|
||||
4,
|
||||
28,
|
||||
53
|
||||
],
|
||||
"volume": 0,
|
||||
"faceCount": 0,
|
||||
"edgeCount": 1,
|
||||
"vertexCount": 1
|
||||
},
|
||||
{
|
||||
"name": "RadarPedestal",
|
||||
"label": "RadarPedestal",
|
||||
"type": "PartDesign::Pad",
|
||||
"position": [
|
||||
4,
|
||||
28,
|
||||
53
|
||||
],
|
||||
"volume": 45.61592533012381,
|
||||
"faceCount": 3,
|
||||
"edgeCount": 3,
|
||||
"vertexCount": 2
|
||||
},
|
||||
{
|
||||
"name": "RadarFaceSketch",
|
||||
"label": "RadarFaceSketch",
|
||||
"type": "Sketcher::SketchObject",
|
||||
"position": [
|
||||
0,
|
||||
28,
|
||||
0
|
||||
],
|
||||
"volume": 0,
|
||||
"faceCount": 0,
|
||||
"edgeCount": 4,
|
||||
"vertexCount": 4
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"step": 4,
|
||||
"label": "CarrierRadar · 相控阵面",
|
||||
"action": "setFeature",
|
||||
"args": {
|
||||
"object": "RadarFace",
|
||||
"body": "Body",
|
||||
"featureType": "Pad",
|
||||
"profile": "RadarFaceSketch",
|
||||
"length": 0.6
|
||||
},
|
||||
"seconds": 0.4746,
|
||||
"tips": {
|
||||
"objectCount": 13,
|
||||
"tip": "RadarFace",
|
||||
"objects": [
|
||||
{
|
||||
"name": "Body",
|
||||
"label": "Body",
|
||||
"type": "PartDesign::Body",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"volume": 66.61592533012391,
|
||||
"faceCount": 11,
|
||||
"edgeCount": 22,
|
||||
"vertexCount": 13
|
||||
},
|
||||
{
|
||||
"name": "Origin",
|
||||
"label": "Origin",
|
||||
"type": "App::Origin",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "X_Axis",
|
||||
"label": "X-axis",
|
||||
"type": "App::Line",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "Y_Axis",
|
||||
"label": "Y-axis",
|
||||
"type": "App::Line",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "Z_Axis",
|
||||
"label": "Z-axis",
|
||||
"type": "App::Line",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "XY_Plane",
|
||||
"label": "XY-plane",
|
||||
"type": "App::Plane",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "XZ_Plane",
|
||||
"label": "XZ-plane",
|
||||
"type": "App::Plane",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "YZ_Plane",
|
||||
"label": "YZ-plane",
|
||||
"type": "App::Plane",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "Origin001",
|
||||
"label": "Origin001",
|
||||
"type": "App::Point",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "RadarPedestalSketch",
|
||||
"label": "RadarPedestalSketch",
|
||||
"type": "Sketcher::SketchObject",
|
||||
"position": [
|
||||
4,
|
||||
28,
|
||||
53
|
||||
],
|
||||
"volume": 0,
|
||||
"faceCount": 0,
|
||||
"edgeCount": 1,
|
||||
"vertexCount": 1
|
||||
},
|
||||
{
|
||||
"name": "RadarPedestal",
|
||||
"label": "RadarPedestal",
|
||||
"type": "PartDesign::Pad",
|
||||
"position": [
|
||||
4,
|
||||
28,
|
||||
53
|
||||
],
|
||||
"volume": 45.61592533012381,
|
||||
"faceCount": 3,
|
||||
"edgeCount": 3,
|
||||
"vertexCount": 2
|
||||
},
|
||||
{
|
||||
"name": "RadarFaceSketch",
|
||||
"label": "RadarFaceSketch",
|
||||
"type": "Sketcher::SketchObject",
|
||||
"position": [
|
||||
0,
|
||||
28,
|
||||
0
|
||||
],
|
||||
"volume": 0,
|
||||
"faceCount": 0,
|
||||
"edgeCount": 4,
|
||||
"vertexCount": 4
|
||||
},
|
||||
{
|
||||
"name": "RadarFace",
|
||||
"label": "RadarFace",
|
||||
"type": "PartDesign::Pad",
|
||||
"position": [
|
||||
4,
|
||||
28,
|
||||
53
|
||||
],
|
||||
"volume": 66.61592533012393,
|
||||
"faceCount": 11,
|
||||
"edgeCount": 22,
|
||||
"vertexCount": 13
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"step": 5,
|
||||
"label": "CarrierRadar · 阵面支架截面",
|
||||
"action": "setSketch",
|
||||
"args": {
|
||||
"object": "RadarFrameSketch",
|
||||
"body": "Body",
|
||||
"profileType": "Circle",
|
||||
"parameters": {
|
||||
"Radius": 0.6
|
||||
},
|
||||
"position": [
|
||||
4,
|
||||
28.9,
|
||||
56
|
||||
]
|
||||
},
|
||||
"seconds": 0.083,
|
||||
"tips": {
|
||||
"objectCount": 14,
|
||||
"tip": "RadarFrameSketch",
|
||||
"objects": [
|
||||
{
|
||||
"name": "Body",
|
||||
"label": "Body",
|
||||
"type": "PartDesign::Body",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"volume": 66.61592533012391,
|
||||
"faceCount": 11,
|
||||
"edgeCount": 22,
|
||||
"vertexCount": 13
|
||||
},
|
||||
{
|
||||
"name": "Origin",
|
||||
"label": "Origin",
|
||||
"type": "App::Origin",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "X_Axis",
|
||||
"label": "X-axis",
|
||||
"type": "App::Line",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "Y_Axis",
|
||||
"label": "Y-axis",
|
||||
"type": "App::Line",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "Z_Axis",
|
||||
"label": "Z-axis",
|
||||
"type": "App::Line",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "XY_Plane",
|
||||
"label": "XY-plane",
|
||||
"type": "App::Plane",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "XZ_Plane",
|
||||
"label": "XZ-plane",
|
||||
"type": "App::Plane",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "YZ_Plane",
|
||||
"label": "YZ-plane",
|
||||
"type": "App::Plane",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "Origin001",
|
||||
"label": "Origin001",
|
||||
"type": "App::Point",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "RadarPedestalSketch",
|
||||
"label": "RadarPedestalSketch",
|
||||
"type": "Sketcher::SketchObject",
|
||||
"position": [
|
||||
4,
|
||||
28,
|
||||
53
|
||||
],
|
||||
"volume": 0,
|
||||
"faceCount": 0,
|
||||
"edgeCount": 1,
|
||||
"vertexCount": 1
|
||||
},
|
||||
{
|
||||
"name": "RadarPedestal",
|
||||
"label": "RadarPedestal",
|
||||
"type": "PartDesign::Pad",
|
||||
"position": [
|
||||
4,
|
||||
28,
|
||||
53
|
||||
],
|
||||
"volume": 45.61592533012381,
|
||||
"faceCount": 3,
|
||||
"edgeCount": 3,
|
||||
"vertexCount": 2
|
||||
},
|
||||
{
|
||||
"name": "RadarFaceSketch",
|
||||
"label": "RadarFaceSketch",
|
||||
"type": "Sketcher::SketchObject",
|
||||
"position": [
|
||||
0,
|
||||
28,
|
||||
0
|
||||
],
|
||||
"volume": 0,
|
||||
"faceCount": 0,
|
||||
"edgeCount": 4,
|
||||
"vertexCount": 4
|
||||
},
|
||||
{
|
||||
"name": "RadarFace",
|
||||
"label": "RadarFace",
|
||||
"type": "PartDesign::Pad",
|
||||
"position": [
|
||||
4,
|
||||
28,
|
||||
53
|
||||
],
|
||||
"volume": 66.61592533012393,
|
||||
"faceCount": 11,
|
||||
"edgeCount": 22,
|
||||
"vertexCount": 13
|
||||
},
|
||||
{
|
||||
"name": "RadarFrameSketch",
|
||||
"label": "RadarFrameSketch",
|
||||
"type": "Sketcher::SketchObject",
|
||||
"position": [
|
||||
4,
|
||||
28.9,
|
||||
56
|
||||
],
|
||||
"volume": 0,
|
||||
"faceCount": 0,
|
||||
"edgeCount": 1,
|
||||
"vertexCount": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"step": 6,
|
||||
"label": "CarrierRadar · 阵面支架",
|
||||
"action": "setFeature",
|
||||
"args": {
|
||||
"object": "RadarFrame",
|
||||
"body": "Body",
|
||||
"featureType": "Pad",
|
||||
"profile": "RadarFrameSketch",
|
||||
"length": 2.4
|
||||
},
|
||||
"seconds": 0.3545,
|
||||
"tips": {
|
||||
"objectCount": 15,
|
||||
"tip": "RadarFrame",
|
||||
"objects": [
|
||||
{
|
||||
"name": "Body",
|
||||
"label": "Body",
|
||||
"type": "PartDesign::Body",
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"volume": 69.33026138282548,
|
||||
"faceCount": 13,
|
||||
"edgeCount": 25,
|
||||
"vertexCount": 15
|
||||
},
|
||||
{
|
||||
"name": "Origin",
|
||||
"label": "Origin",
|
||||
"type": "App::Origin",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "X_Axis",
|
||||
"label": "X-axis",
|
||||
"type": "App::Line",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "Y_Axis",
|
||||
"label": "Y-axis",
|
||||
"type": "App::Line",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "Z_Axis",
|
||||
"label": "Z-axis",
|
||||
"type": "App::Line",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "XY_Plane",
|
||||
"label": "XY-plane",
|
||||
"type": "App::Plane",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "XZ_Plane",
|
||||
"label": "XZ-plane",
|
||||
"type": "App::Plane",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "YZ_Plane",
|
||||
"label": "YZ-plane",
|
||||
"type": "App::Plane",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "Origin001",
|
||||
"label": "Origin001",
|
||||
"type": "App::Point",
|
||||
"volume": null,
|
||||
"faceCount": null,
|
||||
"edgeCount": null,
|
||||
"vertexCount": null
|
||||
},
|
||||
{
|
||||
"name": "RadarPedestalSketch",
|
||||
"label": "RadarPedestalSketch",
|
||||
"type": "Sketcher::SketchObject",
|
||||
"position": [
|
||||
4,
|
||||
28,
|
||||
53
|
||||
],
|
||||
"volume": 0,
|
||||
"faceCount": 0,
|
||||
"edgeCount": 1,
|
||||
"vertexCount": 1
|
||||
},
|
||||
{
|
||||
"name": "RadarPedestal",
|
||||
"label": "RadarPedestal",
|
||||
"type": "PartDesign::Pad",
|
||||
"position": [
|
||||
4,
|
||||
28,
|
||||
53
|
||||
],
|
||||
"volume": 45.61592533012381,
|
||||
"faceCount": 3,
|
||||
"edgeCount": 3,
|
||||
"vertexCount": 2
|
||||
},
|
||||
{
|
||||
"name": "RadarFaceSketch",
|
||||
"label": "RadarFaceSketch",
|
||||
"type": "Sketcher::SketchObject",
|
||||
"position": [
|
||||
0,
|
||||
28,
|
||||
0
|
||||
],
|
||||
"volume": 0,
|
||||
"faceCount": 0,
|
||||
"edgeCount": 4,
|
||||
"vertexCount": 4
|
||||
},
|
||||
{
|
||||
"name": "RadarFace",
|
||||
"label": "RadarFace",
|
||||
"type": "PartDesign::Pad",
|
||||
"position": [
|
||||
4,
|
||||
28,
|
||||
53
|
||||
],
|
||||
"volume": 66.61592533012393,
|
||||
"faceCount": 11,
|
||||
"edgeCount": 22,
|
||||
"vertexCount": 13
|
||||
},
|
||||
{
|
||||
"name": "RadarFrameSketch",
|
||||
"label": "RadarFrameSketch",
|
||||
"type": "Sketcher::SketchObject",
|
||||
"position": [
|
||||
4,
|
||||
28.9,
|
||||
56
|
||||
],
|
||||
"volume": 0,
|
||||
"faceCount": 0,
|
||||
"edgeCount": 1,
|
||||
"vertexCount": 1
|
||||
},
|
||||
{
|
||||
"name": "RadarFrame",
|
||||
"label": "RadarFrame",
|
||||
"type": "PartDesign::Pad",
|
||||
"position": [
|
||||
4,
|
||||
28,
|
||||
53
|
||||
],
|
||||
"volume": 69.3302613828255,
|
||||
"faceCount": 13,
|
||||
"edgeCount": 25,
|
||||
"vertexCount": 15
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
230
web/teaching/cases/carrier-partdesign/parts/aircraft.mjs
Normal file
230
web/teaching/cases/carrier-partdesign/parts/aircraft.mjs
Normal file
@@ -0,0 +1,230 @@
|
||||
// 舰载机(P11–P19):战斗机、预警机、直升机。
|
||||
//
|
||||
// Every airframe is built in its own local frame -- nose along +X, the fuselage
|
||||
// centreline on the X axis, wings on the XY plane -- so a Revolution about the
|
||||
// body origin's X axis is the fuselage and a Mirrored about XZ makes the
|
||||
// second wing. The assembly then places each airframe on the deck with a
|
||||
// position and a heading.
|
||||
//
|
||||
// This is the part family where PartDesign earns its place: the fuselage is a
|
||||
// lathed profile, the wing is a swept planform Pad, the stabiliser is its
|
||||
// mirrored twin, and the canopy is a primitive dome. Six fighters share one
|
||||
// parameterised builder; the AWACS adds a rotodome and four nacelles; the two
|
||||
// helicopters add a PolarPattern rotor.
|
||||
import { polygon, band, stationAt, sideAt, rotation } from "../lib/sketch.mjs";
|
||||
|
||||
const X_AXIS = "X_Axis";
|
||||
const XZ_PLANE = { object: "XZ_Plane", subelements: [""] };
|
||||
const Z_AXIS = { object: "Z_Axis", subelements: [""] };
|
||||
|
||||
/** Fighter fuselage half-profile, scaled to `length`. */
|
||||
function fighterProfile(length) {
|
||||
const s = length / 9.2;
|
||||
return [
|
||||
[9.2 * s, 0], [8.7 * s, 0.4 * s], [7.4 * s, 0.75 * s], [5 * s, 1.1 * s],
|
||||
[2.5 * s, 1.25 * s], [0, 1.25 * s], [-2.8 * s, 1.15 * s], [-5.6 * s, 0.95 * s],
|
||||
[-8 * s, 0.8 * s], [-9.2 * s, 0.6 * s], [-9.2 * s, 0],
|
||||
];
|
||||
}
|
||||
|
||||
function fighterWing(span) {
|
||||
return [[2.6, 1.0], [-3.2, 1.0], [-4.4, span], [-1.2, span]];
|
||||
}
|
||||
|
||||
function buildFighter(part, { length, span }) {
|
||||
const s = length / 9.2;
|
||||
|
||||
// 1. Fuselage: half-profile revolved about the body X axis.
|
||||
part.sketch("FuseSketch", {
|
||||
profileType: "Geometry",
|
||||
...polygon(fighterProfile(length)),
|
||||
...sideAt(0),
|
||||
}, "机身半剖");
|
||||
part.feature("Fuselage", {
|
||||
featureType: "Revolution", profile: "FuseSketch", axis: X_AXIS, angle: 360,
|
||||
}, "机身回转");
|
||||
|
||||
// 2. Wing: swept planform, then its mirror image.
|
||||
part.sketch("WingSketch", {
|
||||
profileType: "Geometry",
|
||||
...polygon(fighterWing(span)),
|
||||
position: [0, 0, 0],
|
||||
}, "右机翼平面");
|
||||
part.feature("WingPad", {
|
||||
featureType: "Pad", profile: "WingSketch", length: 0.32, midplane: true,
|
||||
}, "右机翼");
|
||||
part.transform("WingMirror", {
|
||||
transformType: "Mirrored", originals: ["WingPad"], mirrorPlane: XZ_PLANE,
|
||||
}, "左机翼镜像");
|
||||
|
||||
// 3. Horizontal stabiliser, mirrored the same way.
|
||||
part.sketch("StabSketch", {
|
||||
profileType: "Geometry",
|
||||
...polygon([[-7.0 * s, 0.45], [-9.2 * s, 0.45], [-9.4 * s, 3.0], [-8.2 * s, 3.0]]),
|
||||
position: [0, 0, 0],
|
||||
}, "平尾平面");
|
||||
part.feature("StabilizerPad", {
|
||||
featureType: "Pad", profile: "StabSketch", length: 0.22, midplane: true,
|
||||
}, "平尾");
|
||||
part.transform("StabilizerMirror", {
|
||||
transformType: "Mirrored", originals: ["StabilizerPad"], mirrorPlane: XZ_PLANE,
|
||||
}, "平尾镜像");
|
||||
|
||||
// 4. Vertical tail in the XZ plane.
|
||||
part.sketch("TailSketch", {
|
||||
profileType: "Geometry",
|
||||
...polygon([[-5.0 * s, 0.45], [-8.6 * s, 0.45], [-9.0 * s, 4.2], [-7.4 * s, 4.2]]),
|
||||
...sideAt(0),
|
||||
}, "垂尾平面");
|
||||
part.feature("TailPad", {
|
||||
featureType: "Pad", profile: "TailSketch", length: 0.2, midplane: true,
|
||||
}, "垂尾");
|
||||
|
||||
// 5. Canopy dome and exhaust nozzle.
|
||||
part.primitive("Canopy", {
|
||||
primitiveType: "AdditiveSphere", parameters: { Radius: 0.8 }, position: [3.2 * s, 0, 1.15 * s],
|
||||
}, "座舱盖");
|
||||
part.sketch("NozzleSketch", {
|
||||
profileType: "Circle", parameters: { Radius: 0.68 },
|
||||
...stationAt(-9.3 * s),
|
||||
}, "尾喷口截面");
|
||||
part.feature("NozzlePad", {
|
||||
featureType: "Pad", profile: "NozzleSketch", length: 1.4,
|
||||
}, "尾喷口");
|
||||
}
|
||||
|
||||
const FIGHTERS = [
|
||||
{ id: "P11", document: "CarrierFighterA", length: 9.2, span: 6.6 },
|
||||
{ id: "P12", document: "CarrierFighterB", length: 9.4, span: 6.8 },
|
||||
{ id: "P13", document: "CarrierFighterC", length: 8.8, span: 6.2 },
|
||||
{ id: "P14", document: "CarrierFighterD", length: 9.6, span: 7.0 },
|
||||
{ id: "P15", document: "CarrierFighterE", length: 9.0, span: 6.4 },
|
||||
{ id: "P16", document: "CarrierFighterF", length: 9.3, span: 6.7 },
|
||||
];
|
||||
|
||||
export const fighters = FIGHTERS.map(cfg => ({
|
||||
document: cfg.document,
|
||||
builder: "aircraft",
|
||||
build(part) { buildFighter(part, cfg); },
|
||||
}));
|
||||
|
||||
// ---- 预警机 ----------------------------------------------------------------
|
||||
export const awacs = {
|
||||
document: "CarrierAwacs",
|
||||
builder: "aircraft",
|
||||
build(part) {
|
||||
// 17 m fuselage, high aspect-ratio wing, four nacelles, rotodome.
|
||||
part.sketch("FuseSketch", {
|
||||
profileType: "Geometry",
|
||||
...polygon([
|
||||
[8.6, 0], [8.0, 0.5], [6.4, 1.0], [4.2, 1.5], [1.6, 1.7],
|
||||
[-1.6, 1.7], [-4.6, 1.5], [-7.0, 1.2], [-8.2, 0.9], [-8.6, 0.4], [-8.6, 0],
|
||||
]),
|
||||
...sideAt(0),
|
||||
}, "机身半剖");
|
||||
part.feature("Fuselage", { featureType: "Revolution", profile: "FuseSketch", axis: X_AXIS, angle: 360 }, "机身回转");
|
||||
|
||||
part.sketch("WingSketch", {
|
||||
profileType: "Geometry",
|
||||
...polygon([[2.4, 0.8], [-1.8, 0.8], [-2.2, 11.6], [0.6, 11.6]]),
|
||||
position: [0, 0, 1.4],
|
||||
}, "右机翼平面");
|
||||
part.feature("WingPad", { featureType: "Pad", profile: "WingSketch", length: 0.34, midplane: true }, "右机翼");
|
||||
part.transform("WingMirror", { transformType: "Mirrored", originals: ["WingPad"], mirrorPlane: XZ_PLANE }, "左机翼镜像");
|
||||
|
||||
// Two nacelles per wing at y=4.2 and 8.6: two Pads, one mirror.
|
||||
for (const y of [4.2, 8.6]) {
|
||||
const sketch = part.name("NacelleSketch");
|
||||
part.sketch(sketch, {
|
||||
profileType: "Circle", parameters: { Radius: 0.55 },
|
||||
...stationAt(-0.6), position: [-0.6, y, 1.4],
|
||||
}, `桨舱截面 y=${y}`);
|
||||
part.feature(part.name("NacellePad"), { featureType: "Pad", profile: sketch, length: 2.6 }, "桨舱");
|
||||
}
|
||||
part.transform("NacelleMirror", {
|
||||
transformType: "Mirrored", originals: ["NacellePad1", "NacellePad2"], mirrorPlane: XZ_PLANE,
|
||||
}, "桨舱镜像");
|
||||
|
||||
part.sketch("StabSketch", {
|
||||
profileType: "Geometry",
|
||||
...polygon([[-6.2, 0.5], [-8.4, 0.5], [-8.6, 4.2], [-7.4, 4.2]]),
|
||||
position: [0, 0, 0.4],
|
||||
}, "平尾平面");
|
||||
part.feature("StabilizerPad", { featureType: "Pad", profile: "StabSketch", length: 0.24, midplane: true }, "平尾");
|
||||
part.transform("StabilizerMirror", { transformType: "Mirrored", originals: ["StabilizerPad"], mirrorPlane: XZ_PLANE }, "平尾镜像");
|
||||
|
||||
part.sketch("TailSketch", {
|
||||
profileType: "Geometry",
|
||||
...polygon([[-5.8, 0.5], [-8.4, 0.5], [-8.6, 3.8], [-7.2, 3.8]]),
|
||||
...sideAt(0),
|
||||
}, "垂尾平面");
|
||||
part.feature("TailPad", { featureType: "Pad", profile: "TailSketch", length: 0.22, midplane: true }, "垂尾");
|
||||
|
||||
// Rotodome on two struts.
|
||||
for (const x of [-2.4, 2.4]) {
|
||||
const sketch = part.name("StrutSketch");
|
||||
part.sketch(sketch, {
|
||||
profileType: "Circle", parameters: { Radius: 0.16 },
|
||||
position: [x, 0, 1.2],
|
||||
}, `旋罩支柱截面 x=${x}`);
|
||||
part.feature(part.name("StrutPad"), { featureType: "Pad", profile: sketch, length: 3.8 }, "旋罩支柱");
|
||||
}
|
||||
part.sketch("RotodomeSketch", {
|
||||
profileType: "Circle", parameters: { Radius: 5.8 }, position: [0, 0, 5.0],
|
||||
}, "旋罩截面");
|
||||
part.feature("RotodomePad", { featureType: "Pad", profile: "RotodomeSketch", length: 1.05 }, "雷达旋罩");
|
||||
},
|
||||
};
|
||||
|
||||
// ---- 直升机 ----------------------------------------------------------------
|
||||
function buildHelicopter(part, { rotorSpan }) {
|
||||
part.sketch("FuseSketch", {
|
||||
profileType: "Geometry",
|
||||
...polygon([
|
||||
[3.6, 0], [3.3, 0.5], [2.4, 1.2], [0.8, 1.65], [-1.2, 1.7],
|
||||
[-2.6, 1.4], [-3.4, 0.9], [-3.6, 0.2], [-3.6, 0],
|
||||
]),
|
||||
...sideAt(0),
|
||||
}, "机身半剖");
|
||||
part.feature("Fuselage", { featureType: "Revolution", profile: "FuseSketch", axis: X_AXIS, angle: 360 }, "机身回转");
|
||||
|
||||
// Tail boom, tail fin, tail rotor.
|
||||
// Boom: drawn at the aft end and padded forward into the fuselage so the
|
||||
// body stays one solid (Pad extrudes along +X from its sketch plane).
|
||||
part.sketch("BoomSketch", {
|
||||
profileType: "Circle", parameters: { Radius: 0.33 }, ...stationAt(-11.0),
|
||||
}, "尾梁截面");
|
||||
part.feature("TailBoom", { featureType: "Pad", profile: "BoomSketch", length: 7.6 }, "尾梁");
|
||||
part.sketch("FinSketch", {
|
||||
profileType: "Geometry", ...polygon([[-9.6, 0.1], [-11.0, 0.1], [-11.2, 2.6], [-10.2, 2.6]]),
|
||||
...sideAt(0),
|
||||
}, "尾鳍平面");
|
||||
part.feature("TailFin", { featureType: "Pad", profile: "FinSketch", length: 0.16, midplane: true }, "尾鳍");
|
||||
part.sketch("TailRotorSketch", {
|
||||
profileType: "Circle", parameters: { Radius: 0.9 }, ...stationAt(-10.6), position: [-10.6, 0.5, 1.9],
|
||||
}, "尾桨截面");
|
||||
part.feature("TailRotorPad", { featureType: "Pad", profile: "TailRotorSketch", length: 0.1 }, "尾桨");
|
||||
|
||||
// Rotor mast: keeps the disc attached to the fuselage roof (one solid) and
|
||||
// gives the PolarPattern a real hub to turn about.
|
||||
part.sketch("MastSketch", {
|
||||
profileType: "Circle", parameters: { Radius: 0.28 }, position: [0.4, 0, 1.4],
|
||||
}, "旋翼轴截面");
|
||||
part.feature("RotorMast", { featureType: "Pad", profile: "MastSketch", length: 0.5 }, "旋翼轴");
|
||||
|
||||
// Main rotor: one blade, then a four-blade PolarPattern about Z.
|
||||
part.sketch("BladeSketch", {
|
||||
profileType: "Geometry", ...band(0, 0, rotorSpan, 0.36, 0), position: [0.4, 0, 1.85],
|
||||
}, "主旋翼叶片");
|
||||
part.feature("BladePad", { featureType: "Pad", profile: "BladeSketch", length: 0.07 }, "主旋翼叶片");
|
||||
part.transform("RotorPattern", {
|
||||
transformType: "PolarPattern", originals: ["BladePad"],
|
||||
rotationAxis: Z_AXIS, angle: 360, occurrences: 4,
|
||||
}, "四叶旋翼");
|
||||
void rotation;
|
||||
}
|
||||
|
||||
export const helicopters = [
|
||||
{ document: "CarrierHelicopterA", builder: "aircraft", build: part => buildHelicopter(part, { rotorSpan: 12 }) },
|
||||
{ document: "CarrierHelicopterB", builder: "aircraft", build: part => buildHelicopter(part, { rotorSpan: 13 }) },
|
||||
];
|
||||
92
web/teaching/cases/carrier-partdesign/parts/deck.mjs
Normal file
92
web/teaching/cases/carrier-partdesign/parts/deck.mjs
Normal file
@@ -0,0 +1,92 @@
|
||||
// 飞行甲板(P02)与斜角甲板(P03)。
|
||||
//
|
||||
// The flight deck is a 333 m planform: parallel sides amidships, a swept bow,
|
||||
// a square transom. It is a Pad from one plan sketch, then four elevator wells
|
||||
// are cut as Pockets, then a row of tie-down fittings is patterned along the
|
||||
// deck, then the well edges are chamfered -- Pad, Pocket, LinearPattern and
|
||||
// Chamfer, the four feature kinds the legacy Part-workbench model could not
|
||||
// express, and the reason the deck is the first trial part of the toolkit.
|
||||
//
|
||||
// The angled deck (P03) is a separate strip, like the real ship where it is a
|
||||
// distinct structure cantilevered over the port side.
|
||||
import { polygon, band } from "../lib/sketch.mjs";
|
||||
|
||||
export const document = "CarrierDeck";
|
||||
export const builder = "deck";
|
||||
|
||||
const DECK_Z = 24;
|
||||
const DECK_T = 1.5;
|
||||
|
||||
// Flight-deck planform, 333 m x 78 m.
|
||||
const PLAN = [
|
||||
[-166.5, -39], [-166.5, 39],
|
||||
[-120, 39], [-60, 39], [0, 39], [60, 38],
|
||||
[110, 33], [150, 22], [166.5, 8],
|
||||
[166.5, -8], [150, -22], [110, -33],
|
||||
[60, -38], [0, -39], [-60, -39], [-120, -39],
|
||||
];
|
||||
|
||||
// Elevator wells: 20 m x 14 m, two rows of two aft of the island.
|
||||
const WELLS = [
|
||||
[-20, 26], [-20, -26], [-62, 26], [-62, -26],
|
||||
];
|
||||
|
||||
export function build(part) {
|
||||
part.sketch("DeckPlan", {
|
||||
profileType: "Geometry", ...polygon(PLAN), position: [0, 0, DECK_Z],
|
||||
}, "甲板平面");
|
||||
part.feature("DeckPad", { featureType: "Pad", profile: "DeckPlan", length: DECK_T }, "甲板板");
|
||||
|
||||
const pockets = [];
|
||||
for (const [x, y] of WELLS) {
|
||||
const sketch = part.name("WellSketch");
|
||||
// 20 m along x, 14 m along y, centred on the well.
|
||||
part.sketch(sketch, {
|
||||
profileType: "Geometry",
|
||||
...polygon([[x - 10, y - 7], [x + 10, y - 7], [x + 10, y + 7], [x - 10, y + 7]]),
|
||||
position: [0, 0, DECK_Z],
|
||||
}, `升降机井口 (${x}, ${y})`);
|
||||
const pocket = part.name("WellPocket");
|
||||
part.feature(pocket, { featureType: "Pocket", profile: sketch, length: DECK_T }, `切除井口 ${pocket}`);
|
||||
pockets.push(pocket);
|
||||
}
|
||||
|
||||
// The chamfer must come before the fittings: setDressUp sets the body Tip to
|
||||
// the dress-up feature, so anything added afterwards is chained on top of it.
|
||||
// With the fittings last, the Tip is the pattern and the final body shape
|
||||
// really contains all 12 padeyes.
|
||||
part.dressUp("DeckEdgeChamfer", {
|
||||
dressUpType: "Chamfer", base: pockets.at(-1), size: 0.25, useAllEdges: true,
|
||||
}, "井口边缘倒角");
|
||||
|
||||
// Tie-down fittings: one 1.2 m padeye on the centre lane (y=14 keeps clear
|
||||
// of the elevator wells at y=19..33), then a LinearPattern along the ship's
|
||||
// X axis copies it 12 times over 220 m. The pad starts 0.1 m inside the deck
|
||||
// (z=25.4, thickness 0.25) so the fuse overlaps instead of resting on a
|
||||
// coplanar face.
|
||||
part.sketch("FittingSketch", {
|
||||
profileType: "Geometry",
|
||||
...polygon([[-110.6, 13.4], [-109.4, 13.4], [-109.4, 14.6], [-110.6, 14.6]]),
|
||||
position: [0, 0, DECK_Z + DECK_T - 0.1],
|
||||
}, "系留桩平面");
|
||||
part.feature("FittingPad", {
|
||||
featureType: "Pad", profile: "FittingSketch", length: 0.25,
|
||||
}, "系留桩");
|
||||
part.transform("FittingPattern", {
|
||||
transformType: "LinearPattern", originals: ["FittingPad"],
|
||||
direction: { object: "X_Axis", subelements: [""] },
|
||||
length: 220, occurrences: 12,
|
||||
}, "系留桩阵列");
|
||||
}
|
||||
|
||||
export const angledDeck = {
|
||||
document: "CarrierAngledDeck",
|
||||
builder: "deck",
|
||||
build(part) {
|
||||
// 240 m strip at 8 deg to port, 24 m wide, 1.2 m thick.
|
||||
part.sketch("AngledPlan", {
|
||||
profileType: "Geometry", ...band(-40, -24, 240, 24, 8), position: [0, 0, DECK_Z],
|
||||
}, "斜角甲板平面");
|
||||
part.feature("AngledPad", { featureType: "Pad", profile: "AngledPlan", length: 1.2 }, "斜角甲板");
|
||||
},
|
||||
};
|
||||
74
web/teaching/cases/carrier-partdesign/parts/handling.mjs
Normal file
74
web/teaching/cases/carrier-partdesign/parts/handling.mjs
Normal file
@@ -0,0 +1,74 @@
|
||||
// 航空保障:升降机(P06)、弹射器(P07)、拦阻索(P08)。
|
||||
//
|
||||
// Three thin structures that only read correctly in plan: the four elevator
|
||||
// platforms fill the deck wells, the four catapult tracks run bow and waist,
|
||||
// and the arrestor wires cross the angled deck aft. All of them are built in
|
||||
// ship coordinates, so the assembly places them at identity.
|
||||
import { band } from "../lib/sketch.mjs";
|
||||
|
||||
const DECK_Z = 24;
|
||||
const DECK_TOP = DECK_Z + 1.5;
|
||||
|
||||
// Elevator well centres, matching parts/deck.mjs.
|
||||
const WELLS = [
|
||||
[-20, 26], [-20, -26], [-62, 26], [-62, -26],
|
||||
];
|
||||
|
||||
export const elevators = {
|
||||
document: "CarrierElevators",
|
||||
builder: "handling",
|
||||
build(part) {
|
||||
for (const [x, y] of WELLS) {
|
||||
const sketch = part.name("ElevatorSketch");
|
||||
part.sketch(sketch, {
|
||||
profileType: "Geometry", ...band(x, y, 20, 14, 0), position: [0, 0, DECK_Z + 0.2],
|
||||
}, `升降机平台 (${x}, ${y})`);
|
||||
part.feature(part.name("ElevatorPad"), {
|
||||
featureType: "Pad", profile: sketch, length: 0.9,
|
||||
}, "升降机平台");
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
// Bow cats run fore-aft; waist cats sit at an angle to port, as on the real deck.
|
||||
const CATS = [
|
||||
{ x: 118, y: 14, length: 88, angle: 0 },
|
||||
{ x: 118, y: -14, length: 88, angle: 0 },
|
||||
{ x: 8, y: 24, length: 76, angle: 0 },
|
||||
{ x: -30, y: -28, length: 78, angle: 8 },
|
||||
];
|
||||
|
||||
export const catapults = {
|
||||
document: "CarrierCatapults",
|
||||
builder: "handling",
|
||||
build(part) {
|
||||
for (const cat of CATS) {
|
||||
const sketch = part.name("CatapultSketch");
|
||||
part.sketch(sketch, {
|
||||
profileType: "Geometry",
|
||||
...band(cat.x, cat.y, cat.length, 3, cat.angle),
|
||||
position: [0, 0, DECK_TOP],
|
||||
}, `弹射轨道 (${cat.x}, ${cat.y})`);
|
||||
part.feature(part.name("CatapultPad"), {
|
||||
featureType: "Pad", profile: sketch, length: 0.35,
|
||||
}, "弹射轨道");
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
// Four wires across the angled deck, 6 m apart.
|
||||
export const arrestorWires = {
|
||||
document: "CarrierArrestorWires",
|
||||
builder: "handling",
|
||||
build(part) {
|
||||
for (const x of [-150, -144, -138, -132]) {
|
||||
const sketch = part.name("WireSketch");
|
||||
part.sketch(sketch, {
|
||||
profileType: "Geometry", ...band(x, -18, 56, 0.45, 90), position: [0, 0, DECK_TOP + 0.6],
|
||||
}, `拦阻索 x=${x}`);
|
||||
part.feature(part.name("WirePad"), {
|
||||
featureType: "Pad", profile: sketch, length: 0.25,
|
||||
}, "拦阻索");
|
||||
}
|
||||
},
|
||||
};
|
||||
30
web/teaching/cases/carrier-partdesign/parts/hangar.mjs
Normal file
30
web/teaching/cases/carrier-partdesign/parts/hangar.mjs
Normal file
@@ -0,0 +1,30 @@
|
||||
// 机库(P05):外壳 Pad + 内腔 Pocket。
|
||||
//
|
||||
// The hangar deck sits under the flight deck (z 8-24) and is the void the
|
||||
// elevators open into. Shell first, cavity second. The Pocket needs no
|
||||
// `reversed` flag: PartDesign::Pocket negates the sketch normal before
|
||||
// extruding (FeaturePocket::getProfileNormal, App/FeaturePocket.cpp:134-138),
|
||||
// so the default direction already cuts down into the solid. Reversing it
|
||||
// would extrude out of the deck and remove nothing.
|
||||
import { polygon, rectPoints } from "../lib/sketch.mjs";
|
||||
|
||||
export const document = "CarrierHangar";
|
||||
export const builder = "hangar";
|
||||
|
||||
export function build(part) {
|
||||
part.sketch("HangarShellSketch", {
|
||||
profileType: "Geometry",
|
||||
...polygon(rectPoints(-40, 0, 200, 34)),
|
||||
position: [0, 0, 8],
|
||||
}, "机库外壳平面");
|
||||
part.feature("HangarShell", { featureType: "Pad", profile: "HangarShellSketch", length: 16 }, "机库外壳");
|
||||
|
||||
part.sketch("HangarCavitySketch", {
|
||||
profileType: "Geometry",
|
||||
...polygon(rectPoints(-40, 0, 190, 28)),
|
||||
position: [0, 0, 24],
|
||||
}, "机库内腔平面");
|
||||
part.feature("HangarCavity", {
|
||||
featureType: "Pocket", profile: "HangarCavitySketch", length: 13,
|
||||
}, "掏空内腔");
|
||||
}
|
||||
71
web/teaching/cases/carrier-partdesign/parts/hull.mjs
Normal file
71
web/teaching/cases/carrier-partdesign/parts/hull.mjs
Normal file
@@ -0,0 +1,71 @@
|
||||
// 舰体(P01):9 个横剖面草图 + 放样。
|
||||
//
|
||||
// The hull is the one part whose realism cannot come from boxes: a carrier is a
|
||||
// slender body with a fine bow and a transom stern, and the shape lives in the
|
||||
// changing cross-section. Nine stations are enough for a smooth loft at this
|
||||
// scale (333 m), and every station uses the same 13-point half-section mirrored
|
||||
// about the centreline so OCCT never has to guess how two sections correspond.
|
||||
//
|
||||
// Station sketch plane: world YZ at `x` (lib/sketch.mjs stationAt), local
|
||||
// (u, v) = (height, beam). Loft sections must be distinct sketches in order,
|
||||
// which is exactly what the kernel validates (PartDesignDocumentWorkflow.cpp
|
||||
// setFeature, Loft branch).
|
||||
import { polygon, stationAt } from "../lib/sketch.mjs";
|
||||
|
||||
export const document = "CarrierHull";
|
||||
export const builder = "hull";
|
||||
|
||||
// x, half-beam at deck level. Bow 1.5 m, transom 9 m: a 333 m hull.
|
||||
const STATIONS = [
|
||||
[-166.5, 9],
|
||||
[-150, 15],
|
||||
[-120, 19],
|
||||
[-60, 21],
|
||||
[0, 21],
|
||||
[60, 20],
|
||||
[110, 16],
|
||||
[145, 10],
|
||||
[166.5, 1.5],
|
||||
];
|
||||
|
||||
const DECK = 24;
|
||||
|
||||
/** One closed half-section mirrored about y=0, in (height, beam) order. */
|
||||
function section(half) {
|
||||
const top = half * 0.86;
|
||||
return [
|
||||
[0, 0],
|
||||
[0.8, half * 0.55],
|
||||
[3, half * 0.85],
|
||||
[8, half * 0.97],
|
||||
[14, half],
|
||||
[20, half * 0.98],
|
||||
[DECK, top],
|
||||
[DECK, -top],
|
||||
[20, -half * 0.98],
|
||||
[14, -half],
|
||||
[8, -half * 0.97],
|
||||
[3, -half * 0.85],
|
||||
[0.8, -half * 0.55],
|
||||
];
|
||||
}
|
||||
|
||||
export function build(part) {
|
||||
const names = [];
|
||||
for (const [x, half] of STATIONS) {
|
||||
const name = part.name("HullSketch");
|
||||
const shape = polygon(section(half));
|
||||
part.sketch(name, { profileType: "Geometry", ...shape, ...stationAt(x) }, `横剖面 x=${x}`);
|
||||
names.push(name);
|
||||
}
|
||||
// Loft keeps the first station as its Profile and the rest as Sections
|
||||
// (PartDesign::Loft is ProfileBased): the kernel rejects a section that is
|
||||
// the profile itself, so pass names.slice(1).
|
||||
part.feature("HullLoft", {
|
||||
featureType: "Loft",
|
||||
profile: names[0],
|
||||
sections: names.slice(1),
|
||||
ruled: false,
|
||||
closed: false,
|
||||
}, "舰体放样");
|
||||
}
|
||||
51
web/teaching/cases/carrier-partdesign/parts/index.mjs
Normal file
51
web/teaching/cases/carrier-partdesign/parts/index.mjs
Normal file
@@ -0,0 +1,51 @@
|
||||
// Registry: every carrier PartDesign document, in build order.
|
||||
//
|
||||
// The ids match spec.json and the teaching console lessons. P01-P10 are the
|
||||
// ship herself (built in ship coordinates, placed at identity); P11-P19 are
|
||||
// airframes in local coordinates; P20 is deck paint.
|
||||
import * as hull from "./hull.mjs";
|
||||
import * as deck from "./deck.mjs";
|
||||
import * as island from "./island.mjs";
|
||||
import * as hangar from "./hangar.mjs";
|
||||
import * as handling from "./handling.mjs";
|
||||
import * as sensors from "./sensors.mjs";
|
||||
import { fighters, awacs, helicopters } from "./aircraft.mjs";
|
||||
import * as markings from "./markings.mjs";
|
||||
|
||||
const fighterById = Object.fromEntries(
|
||||
["P11", "P12", "P13", "P14", "P15", "P16"].map((id, index) => [id, fighters[index]]),
|
||||
);
|
||||
|
||||
const byDocument = [
|
||||
["P01", hull],
|
||||
["P02", deck],
|
||||
["P03", deck.angledDeck],
|
||||
["P04", island],
|
||||
["P05", hangar],
|
||||
["P06", handling.elevators],
|
||||
["P07", handling.catapults],
|
||||
["P08", handling.arrestorWires],
|
||||
["P09", sensors.radar],
|
||||
["P10", sensors.ciws],
|
||||
["P11", fighterById.P11],
|
||||
["P12", fighterById.P12],
|
||||
["P13", fighterById.P13],
|
||||
["P14", fighterById.P14],
|
||||
["P15", fighterById.P15],
|
||||
["P16", fighterById.P16],
|
||||
["P17", awacs],
|
||||
["P18", helicopters[0]],
|
||||
["P19", helicopters[1]],
|
||||
["P20", markings],
|
||||
];
|
||||
|
||||
export const parts = byDocument.map(([id, module]) => ({
|
||||
id,
|
||||
document: module.document,
|
||||
builder: module.builder,
|
||||
build: module.build,
|
||||
}));
|
||||
|
||||
export function partFor(key) {
|
||||
return parts.find(part => part.id === key || part.document === key) ?? null;
|
||||
}
|
||||
61
web/teaching/cases/carrier-partdesign/parts/island.mjs
Normal file
61
web/teaching/cases/carrier-partdesign/parts/island.mjs
Normal file
@@ -0,0 +1,61 @@
|
||||
// 舰岛(P04):塔式分层结构。
|
||||
//
|
||||
// A carrier island is a stack of shrinking decks -- base, tower, bridge -- with
|
||||
// a funnel aft and a mast on top. Each tier is its own plan sketch on its own
|
||||
// plane, which is how the real structure is drawn: no boolean of boxes, just
|
||||
// four Pads anchored at rising heights. The bridge top gets a Chamfer so the
|
||||
// silhouette is not a raw extrusion.
|
||||
import { polygon, rectPoints, circle } from "../lib/sketch.mjs";
|
||||
|
||||
export const document = "CarrierIsland";
|
||||
export const builder = "island";
|
||||
|
||||
const DECK_Z = 24;
|
||||
// Starboard side, slightly aft of midships.
|
||||
const CX = -4;
|
||||
const CY = 28;
|
||||
|
||||
const TIERS = [
|
||||
{ name: "IslandBase", cx: CX, cy: CY, w: 36, h: 14, z: DECK_Z, t: 12 },
|
||||
{ name: "IslandTower", cx: CX + 2, cy: CY, w: 28, h: 12, z: DECK_Z + 12, t: 10 },
|
||||
{ name: "IslandBridge", cx: CX + 4, cy: CY, w: 18, h: 10, z: DECK_Z + 22, t: 7 },
|
||||
];
|
||||
|
||||
export function build(part) {
|
||||
let last = null;
|
||||
for (const tier of TIERS) {
|
||||
const sketch = part.name("IslandSketch");
|
||||
part.sketch(sketch, {
|
||||
profileType: "Geometry",
|
||||
...polygon(rectPoints(tier.cx, tier.cy, tier.w, tier.h)),
|
||||
position: [0, 0, tier.z],
|
||||
}, `${tier.name} 平面 z=${tier.z}`);
|
||||
part.feature(tier.name, { featureType: "Pad", profile: sketch, length: tier.t }, `塔体 ${tier.name}`);
|
||||
last = tier.name;
|
||||
}
|
||||
|
||||
// Funnel: a 7 x 6 m uptake on the base, aft of the tower.
|
||||
part.sketch("FunnelSketch", {
|
||||
profileType: "Geometry",
|
||||
...polygon(rectPoints(CX - 17, CY, 7, 6)),
|
||||
position: [0, 0, DECK_Z],
|
||||
}, "烟囱平面");
|
||||
part.feature("IslandFunnel", { featureType: "Pad", profile: "FunnelSketch", length: 18 }, "烟囱");
|
||||
|
||||
// Mast: 1.3 m radius tube rising 14 m above the bridge.
|
||||
part.sketch("MastSketch", {
|
||||
profileType: "Circle",
|
||||
parameters: { Radius: 1.3 },
|
||||
position: [CX - 8, CY, DECK_Z + 29],
|
||||
}, "桅杆截面");
|
||||
part.feature("IslandMast", { featureType: "Pad", profile: "MastSketch", length: 14 }, "桅杆");
|
||||
|
||||
// 0.25 m survives the fused tier stack; 0.5 m makes OCCT fail the chamfer on
|
||||
// the short edges where the mast meets the bridge (measured, probe run
|
||||
// 2026-11-25: size=0.5 -> BRep_API command not done, 0.25/0.12 -> done).
|
||||
part.dressUp("BridgeChamfer", {
|
||||
dressUpType: "Chamfer", base: last, size: 0.25, useAllEdges: true,
|
||||
}, "舰桥顶倒角");
|
||||
|
||||
void circle;
|
||||
}
|
||||
38
web/teaching/cases/carrier-partdesign/parts/markings.mjs
Normal file
38
web/teaching/cases/carrier-partdesign/parts/markings.mjs
Normal file
@@ -0,0 +1,38 @@
|
||||
// 甲板标线(P20):中心线、降落区框、甲板边缘线。
|
||||
//
|
||||
// Paint is geometry in PartDesign too: each marking is a 3 cm Pad sitting on
|
||||
// the flight deck. The landing-area frame is one sketch made of four merged
|
||||
// bands, so the whole frame is a single feature rather than four.
|
||||
import { band, merge } from "../lib/sketch.mjs";
|
||||
|
||||
export const document = "CarrierMarkings";
|
||||
export const builder = "markings";
|
||||
|
||||
const TOP = 25.5;
|
||||
const PAINT = 0.03;
|
||||
|
||||
export function build(part) {
|
||||
part.sketch("CenterlineSketch", {
|
||||
profileType: "Geometry", ...band(0, 0, 320, 0.9, 0), position: [0, 0, TOP],
|
||||
}, "甲板中心线");
|
||||
part.feature("CenterlinePad", { featureType: "Pad", profile: "CenterlineSketch", length: PAINT }, "中心线");
|
||||
|
||||
// Landing area frame: 200 m long, 32 m wide, centred at x = -40.
|
||||
const frame = merge(
|
||||
band(-40, 16, 200, 0.6, 0),
|
||||
band(-40, -16, 200, 0.6, 0),
|
||||
band(-140, 0, 32.6, 0.6, 90),
|
||||
band(60, 0, 32.6, 0.6, 90),
|
||||
);
|
||||
part.sketch("LandingFrameSketch", {
|
||||
profileType: "Geometry", ...frame, position: [0, 0, TOP],
|
||||
}, "降落区边框");
|
||||
part.feature("LandingFramePad", { featureType: "Pad", profile: "LandingFrameSketch", length: PAINT }, "降落区边框");
|
||||
|
||||
// Port and starboard deck-edge lines.
|
||||
const edges = merge(band(0, 37, 300, 0.5, 0), band(0, -37, 300, 0.5, 0));
|
||||
part.sketch("DeckEdgeSketch", {
|
||||
profileType: "Geometry", ...edges, position: [0, 0, TOP],
|
||||
}, "甲板边缘线");
|
||||
part.feature("DeckEdgePad", { featureType: "Pad", profile: "DeckEdgeSketch", length: PAINT }, "甲板边缘线");
|
||||
}
|
||||
68
web/teaching/cases/carrier-partdesign/parts/sensors.mjs
Normal file
68
web/teaching/cases/carrier-partdesign/parts/sensors.mjs
Normal file
@@ -0,0 +1,68 @@
|
||||
// 传感与武器:相控阵雷达(P09)与近防炮(P10)。
|
||||
//
|
||||
// The radar is a pedestal, a flat array face and a back frame; the CIWS is a
|
||||
// local-coordinate mount (base, housing, two barrels) that the assembly drops
|
||||
// onto the starboard deck edge. Both keep every dimension in metres so the
|
||||
// parts can be checked against the ship drawing.
|
||||
import { polygon, rectPoints, circle } from "../lib/sketch.mjs";
|
||||
|
||||
const ISLAND_TOP = 53;
|
||||
const RADAR_Y = 28;
|
||||
|
||||
export const radar = {
|
||||
document: "CarrierRadar",
|
||||
builder: "sensors",
|
||||
build(part) {
|
||||
// Pedestal drum on the bridge top.
|
||||
part.sketch("RadarPedestalSketch", {
|
||||
profileType: "Circle", parameters: { Radius: 2.2 }, position: [4, RADAR_Y, ISLAND_TOP],
|
||||
}, "雷达基座截面");
|
||||
part.feature("RadarPedestal", { featureType: "Pad", profile: "RadarPedestalSketch", length: 3 }, "雷达基座");
|
||||
|
||||
// Array face: 7 m wide, 5 m tall, 0.6 m thick, lookng forward.
|
||||
part.sketch("RadarFaceSketch", {
|
||||
profileType: "Geometry",
|
||||
...polygon(rectPoints(4, ISLAND_TOP + 5.5, 7, 5)),
|
||||
position: [0, RADAR_Y, 0],
|
||||
placementRotation: [Math.SQRT1_2, 0, 0, Math.SQRT1_2],
|
||||
}, "阵面草图");
|
||||
part.feature("RadarFace", { featureType: "Pad", profile: "RadarFaceSketch", length: 0.6 }, "相控阵面");
|
||||
|
||||
// Back frame so the array does not look like a floating card.
|
||||
part.sketch("RadarFrameSketch", {
|
||||
profileType: "Circle", parameters: { Radius: 0.6 }, position: [4, RADAR_Y + 0.9, ISLAND_TOP + 3],
|
||||
}, "阵面支架截面");
|
||||
part.feature("RadarFrame", { featureType: "Pad", profile: "RadarFrameSketch", length: 2.4 }, "阵面支架");
|
||||
void circle;
|
||||
},
|
||||
};
|
||||
|
||||
export const ciws = {
|
||||
document: "CarrierCiws",
|
||||
builder: "sensors",
|
||||
build(part) {
|
||||
// Local origin at the deck contact point.
|
||||
part.sketch("CiwsBaseSketch", {
|
||||
profileType: "Circle", parameters: { Radius: 2.6 }, position: [0, 0, 0],
|
||||
}, "炮座截面");
|
||||
part.feature("CiwsBase", { featureType: "Pad", profile: "CiwsBaseSketch", length: 1.4 }, "炮座");
|
||||
|
||||
part.sketch("CiwsHousingSketch", {
|
||||
profileType: "Geometry", ...polygon(rectPoints(0, 0, 4.4, 2.6)), position: [0, 0, 1.4],
|
||||
}, "炮塔壳体");
|
||||
part.feature("CiwsHousing", { featureType: "Pad", profile: "CiwsHousingSketch", length: 2.2 }, "炮塔壳体");
|
||||
|
||||
// Two barrels along +X, 1.4 m apart.
|
||||
for (const y of [-0.7, 0.7]) {
|
||||
const sketch = part.name("BarrelSketch");
|
||||
part.sketch(sketch, {
|
||||
profileType: "Circle", parameters: { Radius: 0.22 },
|
||||
position: [2.2, y, 2.4],
|
||||
placementRotation: [0, Math.SQRT1_2, 0, Math.SQRT1_2],
|
||||
}, `炮管截面 y=${y}`);
|
||||
part.feature(part.name("BarrelPad"), {
|
||||
featureType: "Pad", profile: sketch, length: 3.6,
|
||||
}, "炮管");
|
||||
}
|
||||
},
|
||||
};
|
||||
71
web/teaching/cases/carrier-partdesign/spec.json
Normal file
71
web/teaching/cases/carrier-partdesign/spec.json
Normal file
@@ -0,0 +1,71 @@
|
||||
{
|
||||
"schema": "freecad-web-carrier-partdesign-spec/v1",
|
||||
"title": "航空母舰 PartDesign 建件清单",
|
||||
"units": "m",
|
||||
"dimensions": { "length": 333, "beam": 78, "height": 67, "draft": 12, "displacementT": 98257 },
|
||||
"systems": {
|
||||
"hull-structure": "舰体结构",
|
||||
"angled-deck": "斜角甲板",
|
||||
"flight-deck": "飞行甲板",
|
||||
"island": "舰岛上层建筑",
|
||||
"hangar": "机库",
|
||||
"aircraft-handling": "航空保障(升降机/弹射器/拦阻索)",
|
||||
"sensors": "雷达与传感",
|
||||
"weapons": "近防武器",
|
||||
"air-fighter": "舰载战斗机",
|
||||
"air-awacs": "舰载预警机",
|
||||
"air-rotor": "舰载直升机",
|
||||
"markings": "甲板标线"
|
||||
},
|
||||
"parts": [
|
||||
{ "id": "P01", "document": "CarrierHull", "title": "舰体", "system": "hull-structure",
|
||||
"module": "parts/hull.mjs", "featureTypes": ["Loft"] },
|
||||
{ "id": "P02", "document": "CarrierDeck", "title": "飞行甲板", "system": "flight-deck",
|
||||
"module": "parts/deck.mjs", "featureTypes": ["Pad", "Pocket", "Chamfer"] },
|
||||
{ "id": "P03", "document": "CarrierAngledDeck", "title": "斜角甲板", "system": "angled-deck",
|
||||
"module": "parts/deck.mjs", "featureTypes": ["Pad"] },
|
||||
{ "id": "P04", "document": "CarrierIsland", "title": "舰岛", "system": "island",
|
||||
"module": "parts/island.mjs", "featureTypes": ["Pad", "Chamfer"] },
|
||||
{ "id": "P05", "document": "CarrierHangar", "title": "机库", "system": "hangar",
|
||||
"module": "parts/hangar.mjs", "featureTypes": ["Pad", "Pocket"] },
|
||||
{ "id": "P06", "document": "CarrierElevators", "title": "升降机", "system": "aircraft-handling",
|
||||
"module": "parts/handling.mjs", "featureTypes": ["Pad"], "placement": { "position": [0, 0, 0], "heading": 0 } },
|
||||
{ "id": "P07", "document": "CarrierCatapults", "title": "弹射器", "system": "aircraft-handling",
|
||||
"module": "parts/handling.mjs", "featureTypes": ["Pad"], "placement": { "position": [0, 0, 0], "heading": 0 } },
|
||||
{ "id": "P08", "document": "CarrierArrestorWires", "title": "拦阻索", "system": "aircraft-handling",
|
||||
"module": "parts/handling.mjs", "featureTypes": ["Pad"], "placement": { "position": [0, 0, 0], "heading": 0 } },
|
||||
{ "id": "P09", "document": "CarrierRadar", "title": "相控阵雷达", "system": "sensors",
|
||||
"module": "parts/sensors.mjs", "featureTypes": ["Pad"], "placement": { "position": [0, 0, 0], "heading": 0 } },
|
||||
{ "id": "P10", "document": "CarrierCiws", "title": "近防炮", "system": "weapons",
|
||||
"module": "parts/sensors.mjs", "featureTypes": ["Pad"], "placement": { "position": [60, 28, 25.5], "heading": 0 } },
|
||||
{ "id": "P11", "document": "CarrierFighterA", "title": "舰载战斗机 A", "system": "air-fighter",
|
||||
"module": "parts/aircraft.mjs", "featureTypes": ["Revolution", "Pad", "Mirrored"],
|
||||
"placement": { "position": [-60, 20, 25.5], "heading": 0 } },
|
||||
{ "id": "P12", "document": "CarrierFighterB", "title": "舰载战斗机 B", "system": "air-fighter",
|
||||
"module": "parts/aircraft.mjs", "featureTypes": ["Revolution", "Pad", "Mirrored"],
|
||||
"placement": { "position": [-60, -20, 25.5], "heading": 0 } },
|
||||
{ "id": "P13", "document": "CarrierFighterC", "title": "舰载战斗机 C", "system": "air-fighter",
|
||||
"module": "parts/aircraft.mjs", "featureTypes": ["Revolution", "Pad", "Mirrored"],
|
||||
"placement": { "position": [-100, 20, 25.5], "heading": 0 } },
|
||||
{ "id": "P14", "document": "CarrierFighterD", "title": "舰载战斗机 D", "system": "air-fighter",
|
||||
"module": "parts/aircraft.mjs", "featureTypes": ["Revolution", "Pad", "Mirrored"],
|
||||
"placement": { "position": [-100, -20, 25.5], "heading": 0 } },
|
||||
{ "id": "P15", "document": "CarrierFighterE", "title": "舰载战斗机 E", "system": "air-fighter",
|
||||
"module": "parts/aircraft.mjs", "featureTypes": ["Revolution", "Pad", "Mirrored"],
|
||||
"placement": { "position": [30, 24, 25.5], "heading": 45 } },
|
||||
{ "id": "P16", "document": "CarrierFighterF", "title": "舰载战斗机 F", "system": "air-fighter",
|
||||
"module": "parts/aircraft.mjs", "featureTypes": ["Revolution", "Pad", "Mirrored"],
|
||||
"placement": { "position": [62, -20, 25.5], "heading": 180 } },
|
||||
{ "id": "P17", "document": "CarrierAwacs", "title": "舰载预警机", "system": "air-awacs",
|
||||
"module": "parts/aircraft.mjs", "featureTypes": ["Revolution", "Pad", "Mirrored"],
|
||||
"placement": { "position": [105, 0, 25.5], "heading": 0 } },
|
||||
{ "id": "P18", "document": "CarrierHelicopterA", "title": "舰载直升机 A", "system": "air-rotor",
|
||||
"module": "parts/aircraft.mjs", "featureTypes": ["Revolution", "Pad", "PolarPattern"],
|
||||
"placement": { "position": [-130, 18, 25.5], "heading": 0 } },
|
||||
{ "id": "P19", "document": "CarrierHelicopterB", "title": "舰载直升机 B", "system": "air-rotor",
|
||||
"module": "parts/aircraft.mjs", "featureTypes": ["Revolution", "Pad", "PolarPattern"],
|
||||
"placement": { "position": [-130, -18, 25.5], "heading": 0 } },
|
||||
{ "id": "P20", "document": "CarrierMarkings", "title": "甲板标线", "system": "markings",
|
||||
"module": "parts/markings.mjs", "featureTypes": ["Pad"], "placement": { "position": [0, 0, 0], "heading": 0 } }
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user