Add Web FreeCAD manual matrix, capture harness and chapter 1 pilot

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
2026-11-13 11:13:29 +08:00
parent a10493723b
commit bc40c77153
31 changed files with 36201 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
# Web FreeCAD 全功能初学者教案 · 接续点
更新:2026-11-13
计划:`/home/mes123456/.claude/plans/partitioned-puzzling-haven.md`
## 目标
单页中文 HTML 教案,覆盖 32 个模块;核心模块逐步精讲,专业模块 1–2 个工作流;
1492 条命令全部进附录;小缺口修 React/内核,大边界如实标注。
## 已完成(P0)
- `tools/manual/generate-features.mjs` → `manual/data/{manual-features,inventory-snapshot,coverage-audit}.json`
- 32/32 模块有章节;1602 条命令记录(1492 桌面 + 110 注册路由);
196 native handler 全部映射;312 精讲 / 1287 覆盖 / 3 边界。
- 边界已识别:`CAM_Adaptive`、`FEM_ResultShow`、`TechDraw_PageDefault`;
glTF/Cloud 等模块级边界待补入 gap ledger。
- `tools/manual/capture.mjs`:Playwright 动作 DSL(goto/wait/click/fill/select/press/
drag/eval/shot/save/assert),0 pageError/consoleError 门禁,截图 >5 KB,报告 JSON。
- `tools/manual/build-manual.mjs` + `template.html`:单页 HTML,侧栏/搜索/进度/灯箱/
命令索引/移动端抽屉;输出 `teaching/manual.html` + `manual-assets/`。
- 第 1 章样章:`content/ch01-ui.md` + `scenarios/ch01-ui.json`;
7 张真实截图(界面/Box/Placement/属性/视口/保存/总结)。
- 页面检查通过:1440×900 与 390×844 均 0 错误、0 破坏图片、0 横向溢出;
搜索 `Part_Box` 命中 4 条;命令索引 1602 行。
- `package.json` 增加 `manual:features` / `build:manual` / `check:manual`。
## 真实残余
- 只完成第 1 章;第 0、2–15 章正文与截图未开始。
- 边界只按精确命令匹配 3 条;需补 Fem/CAM/Cloud/Import 的模块级边界与桌面入口。
- 已验证状态(verified)尚未接入:当前 status 只有 detailed/overview/boundary;
截图断言通过后需回写矩阵与徽章。
- 第 1 章 `04-properties` 等图片为元素截图;后续章需统一全页 + 裁图规范。
- 命令索引 1602 行使 HTML 约 750 KB;后续章节图片外链,需持续监控体积。
- 未提交/推送;建议分支 `web-manual-20261113`。
## 下一步精确入口
1. 第 2 章:`content/ch02-part.md` + `scenarios/ch02-part.json`;
覆盖 Box/Cylinder/Boolean/Extrude/Revolve/Loft/Sweep/Fillet/Chamfer/Compound。
2. 边界补录:`generate-features.mjs` 的 `boundaries` 增加
Fem 原生对象、CAM 其余受限命令、Import_Gltf、Cloud、Material;
同步 `web/docs/current/web-freecad-manual-gaps.md`。
3. verified 回写:capture 成功后按 `chapter/workflow` 将截图与断言写回
`manual-features.json` 的 `screenshots[]` 与 `commands[].status`。
4. 每章完成:`npm run manual:features` → capture → `npm run build:manual` →
`npm run check:manual` → 更新本文件。
## 关键路径
- 应用:`http://127.0.0.1:5181/project.html?workbench=Part`
- 教学服务:`http://127.0.0.1:5190/manual.html`
- 矩阵输入:`web/public/api/workbench-command-matrix.json`、
`web/public/api/desktop-command-routes.json`、`web/src/module-registry.generated.ts`
- 截图:`web/manual/assets/<chapter>/<workflow>/`
- 证据:`web/manual/data/capture/<chapter>-<workflow>.json`

33
web/manual/README.md Normal file
View File

@@ -0,0 +1,33 @@
# Web FreeCAD 全功能初学者图文教案
单页中文 HTML 教案:32 个模块、1492 条命令索引、核心模块分步截图、专业模块工作流与边界说明。
## 目录
- `content/*.md`:章节正文(front-matter: id/order/title/level)。
- `scenarios/*.json`:Playwright 动作脚本,用于截图与断言。
- `assets/<chapter>/<workflow>/`:真实界面截图。
- `data/manual-features.json`:命令覆盖矩阵。
- `data/inventory-snapshot.json`:输入文件 sha256。
- `data/coverage-audit.json`:模块/章节/状态计数。
- `data/capture/*.json`:每章截图与断言证据。
- `fixtures/`:capture 保存的 FCStd。
## 构建
```bash
cd /home/mes123456/FreeCADWasmDev/working/FreeCAD/web
npm run manual:features # 生成命令矩阵
node tools/manual/capture.mjs --scenario manual/scenarios/ch01-ui.json
npm run build:manual # 生成 teaching/manual.html + manual-assets/
npm run check:manual # 桌面/移动、图片、搜索、命令索引
```
访问 `http://127.0.0.1:5190/manual.html`。
## 口径
- 命令状态:`detailed` 精讲、`overview` 覆盖、`boundary` 边界、`verified` 已验证。
- 大边界(TechDraw 跨 Worker、FEM 原生对象、CAM OpenCAMLib、glTF 原生导入导出、
Material/Cloud)只标注,不写成可用。
- 截图必须来自真实应用;0 pageError/consoleError、图片 >5 KB 才入库。

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 KiB

View File

@@ -0,0 +1,94 @@
---
id: ch01
order: 1
title: 界面、文档与视图
level: core
---
# 第 1 章 界面、文档与视图
## 学习目标
- 认清 Web FreeCAD 的菜单栏、工作台、对象树、属性面板和三维视口。
- 新建文档,创建一个可检查的实体,并在属性面板中修改尺寸、位置与颜色。
- 用鼠标旋转、缩放视口,最后把文档保存到 OPFS 并确认保存结果。
## 1.1 界面分区
![完整界面:菜单、工作台、对象树、属性面板与三维视口](./manual-assets/ch01/ui-and-document/01-interface.png)
从上到下、从左到右认识五个区域:
1. **应用菜单**:File、Edit、View、Part 等,所有命令的入口。
2. **工作台选择器**:当前是 `Part`,切换后菜单和工具按钮会变化。
3. **对象树**:显示文档中的对象、标签和内部名称。
4. **属性面板**:显示选中对象的 View、Placement、Data 与几何统计。
5. **三维视口**:显示模型;左键旋转,滚轮缩放,右键平移。
## 1.2 新建文档
打开 `File → 新建 Document`。新建后对象树为空,状态栏会显示当前活动文档名。
本课程一律使用毫米作为长度单位;属性面板里的 `Length/Width/Height` 都按毫米填写。
## 1.3 创建第一个对象
打开 `Part → Primitives → Box`,在任务面板填入:
| 参数 | 值 |
|---|---|
| Length | 60 mm |
| Width | 40 mm |
| Height | 20 mm |
点“应用尺寸并重算”,再把对象标签改成 `ManualCube`。
![创建 60 × 40 × 20 的 Box,并在对象树中重命名](./manual-assets/ch01/ui-and-document/02-part-box.png)
## 1.4 属性面板与 Placement
选中对象后,属性面板分为:
- **View**:Label、Color、Visibility。
- **Placement**:Position(X/Y/Z)与旋转轴/角度。
- **Data**:Length、Width、Height 等参数。
- **Geometry/Volume/Bounds**:面数、三角面数、体积和包围盒。
把 Position 设为 `(10, 20, 30)`,点“应用位置与旋转”。
![属性面板:标签、颜色、位置、尺寸、体积与包围盒](./manual-assets/ch01/ui-and-document/04-properties.png)
## 1.5 视口导航
在视口里按住左键拖动可以旋转;滚轮缩放;右键拖动平移。
右上角的视图菜单可以切换等轴测、前视、顶视等标准视角。
![旋转后的视口](./manual-assets/ch01/ui-and-document/05-viewport.png)
## 1.6 保存到 OPFS
打开右侧文件工具,点“保存 FCStd 到 OPFS”。状态栏出现
`Saved <文件名>.FCStd to OPFS` 即表示保存成功。Web 版默认写 OPFS,
只有用户点“下载”时才会落到本地磁盘。
![保存成功后状态栏显示 Saved ... to OPFS](./manual-assets/ch01/ui-and-document/06-saved.png)
## 自检
- [ ] 对象树只有 `ManualCube` 一个对象。
- [ ] Length/Width/Height 分别为 60/40/20 mm。
- [ ] Position 为 (10, 20, 30) mm。
- [ ] 视口可以旋转和缩放。
- [ ] 状态栏显示保存成功。
## 常见错误
1. 把米直接填进毫米输入框,模型小一千倍。
2. 修改尺寸后没有点“应用尺寸并重算”,对象仍是默认 10 mm。
3. 只改了显示颜色但没有触发应用,保存后颜色丢失。
4. 保存后没有看状态栏,误以为文件已经下载到本地。
## 练习
1. 把 Box 改成 100 × 50 × 25 mm,观察体积和包围盒变化。
2. 再创建一个 Cylinder,比较两者在对象树中的命名规则。
3. 保存后刷新页面,从 OPFS 重新打开文档,确认对象仍在。

View File

@@ -0,0 +1,269 @@
{
"schema": "freecad-web-manual/capture/v1",
"generatedAt": "2026-11-13T03:08:26.848Z",
"chapter": "ch01",
"workflow": "ui-and-document",
"scenario": "manual/scenarios/ch01-ui.json",
"origin": "http://127.0.0.1:5181",
"ok": true,
"trace": [
{
"at": "2026-11-13T03:08:08.382Z",
"action": "goto",
"url": "/project.html?workbench=Part"
},
{
"at": "2026-11-13T03:08:10.169Z",
"action": "waitFor",
"selector": "select[aria-label=\"Workbench\"]",
"text": null
},
{
"at": "2026-11-13T03:08:11.729Z",
"action": "click",
"selector": "nav[aria-label=\"Application menus\"] details"
},
{
"at": "2026-11-13T03:08:11.813Z",
"action": "click",
"selector": "新建 Document"
},
{
"at": "2026-11-13T03:08:14.020Z",
"action": "eval"
},
{
"at": "2026-11-13T03:08:14.253Z",
"action": "shot",
"name": "01-interface",
"bytes": 165728
},
{
"at": "2026-11-13T03:08:14.323Z",
"action": "click",
"selector": ".part-menu > summary"
},
{
"at": "2026-11-13T03:08:14.770Z",
"action": "click",
"selector": "details.part-submenu"
},
{
"at": "2026-11-13T03:08:15.119Z",
"action": "click",
"selector": "button[data-command=\"Part_Box\"]"
},
{
"at": "2026-11-13T03:08:16.353Z",
"action": "click",
"selector": ".fc-tree-text"
},
{
"at": "2026-11-13T03:08:16.773Z",
"action": "fill",
"selector": "input[aria-label=\"Length\"]",
"value": 60
},
{
"at": "2026-11-13T03:08:16.807Z",
"action": "fill",
"selector": "input[aria-label=\"Width\"]",
"value": 40
},
{
"at": "2026-11-13T03:08:16.832Z",
"action": "fill",
"selector": "input[aria-label=\"Height\"]",
"value": 20
},
{
"at": "2026-11-13T03:08:16.937Z",
"action": "click",
"selector": "应用尺寸并重算"
},
{
"at": "2026-11-13T03:08:18.510Z",
"action": "click",
"selector": "Close task / Cancel"
},
{
"at": "2026-11-13T03:08:18.552Z",
"action": "click",
"selector": ".fc-tree-text"
},
{
"at": "2026-11-13T03:08:18.867Z",
"action": "fill",
"selector": "input[aria-label=\"Object Label\"]",
"value": "ManualCube"
},
{
"at": "2026-11-13T03:08:18.878Z",
"action": "press",
"key": "Enter"
},
{
"at": "2026-11-13T03:08:20.050Z",
"action": "shot",
"name": "02-part-box",
"bytes": 212824
},
{
"at": "2026-11-13T03:08:20.179Z",
"action": "click",
"selector": "Position"
},
{
"at": "2026-11-13T03:08:20.591Z",
"action": "fill",
"selector": "input[aria-label=\"Position X\"]",
"value": 10
},
{
"at": "2026-11-13T03:08:20.610Z",
"action": "fill",
"selector": "input[aria-label=\"Position Y\"]",
"value": 20
},
{
"at": "2026-11-13T03:08:20.647Z",
"action": "fill",
"selector": "input[aria-label=\"Position Z\"]",
"value": 30
},
{
"at": "2026-11-13T03:08:20.734Z",
"action": "click",
"selector": "应用位置与旋转"
},
{
"at": "2026-11-13T03:08:21.979Z",
"action": "click",
"selector": "Close task / Cancel"
},
{
"at": "2026-11-13T03:08:22.236Z",
"action": "shot",
"name": "03-placement",
"bytes": 218043
},
{
"at": "2026-11-13T03:08:22.296Z",
"action": "click",
"selector": ".fc-tree-text"
},
{
"at": "2026-11-13T03:08:22.608Z",
"action": "fill",
"selector": "input[aria-label=\"Object Color\"]",
"value": "#4a90d9"
},
{
"at": "2026-11-13T03:08:22.612Z",
"action": "eval"
},
{
"at": "2026-11-13T03:08:23.443Z",
"action": "shot",
"name": "04-properties",
"bytes": 52634
},
{
"at": "2026-11-13T03:08:24.180Z",
"action": "drag",
"selector": "[aria-label=\"Imported native 3D view\"]",
"dx": -120,
"dy": -40
},
{
"at": "2026-11-13T03:08:24.383Z",
"action": "shot",
"name": "05-viewport",
"bytes": 218276
},
{
"at": "2026-11-13T03:08:25.595Z",
"action": "save",
"name": "web_project_document_3.FCStd",
"bytes": 2569,
"status": "Saved web_project_document_3.FCStd to OPFS (2569 bytes)"
},
{
"at": "2026-11-13T03:08:26.399Z",
"action": "assertVisible",
"selector": ".fc-tree-text:has-text(\"ManualCube\")"
},
{
"at": "2026-11-13T03:08:26.618Z",
"action": "shot",
"name": "06-saved",
"bytes": 287402
},
{
"at": "2026-11-13T03:08:26.848Z",
"action": "shot",
"name": "07-summary",
"bytes": 287402
}
],
"shots": [
{
"id": "ch01/ui-and-document/01-interface",
"file": "manual/assets/ch01/ui-and-document/01-interface.png",
"bytes": 165728,
"sha256": "a6b2b7b8ea4149233a9054b2d96a8a289f83366fef5c270dd8e0642245a3337d",
"fullPage": true,
"selector": null
},
{
"id": "ch01/ui-and-document/02-part-box",
"file": "manual/assets/ch01/ui-and-document/02-part-box.png",
"bytes": 212824,
"sha256": "541ad0dcac5096d09124c6ab51f3d84db3b3c3901ae56a67ac970fee2a324281",
"fullPage": true,
"selector": null
},
{
"id": "ch01/ui-and-document/03-placement",
"file": "manual/assets/ch01/ui-and-document/03-placement.png",
"bytes": 218043,
"sha256": "3ca3b5cf7c0466e57ae353edee4a19a0ecd90537d36098e43a6fc26cfe86c4c4",
"fullPage": true,
"selector": null
},
{
"id": "ch01/ui-and-document/04-properties",
"file": "manual/assets/ch01/ui-and-document/04-properties.png",
"bytes": 52634,
"sha256": "564f2483692cc4e7bd746394498c7a592d6b3dcaa70e0ab2ee6a2c4a173120ab",
"fullPage": false,
"selector": "aside.properties"
},
{
"id": "ch01/ui-and-document/05-viewport",
"file": "manual/assets/ch01/ui-and-document/05-viewport.png",
"bytes": 218276,
"sha256": "89b20c2f977311a6e1206637fb04400810b9a9191f9152e5e0bef4525d589061",
"fullPage": true,
"selector": null
},
{
"id": "ch01/ui-and-document/06-saved",
"file": "manual/assets/ch01/ui-and-document/06-saved.png",
"bytes": 287402,
"sha256": "5276720fee5bc4d9f1c9583a35f18ca3cf092cf853dfc43517d118d305835ffa",
"fullPage": true,
"selector": null
},
{
"id": "ch01/ui-and-document/07-summary",
"file": "manual/assets/ch01/ui-and-document/07-summary.png",
"bytes": 287402,
"sha256": "5276720fee5bc4d9f1c9583a35f18ca3cf092cf853dfc43517d118d305835ffa",
"fullPage": true,
"selector": null
}
],
"pageErrors": [],
"consoleErrors": []
}

View File

@@ -0,0 +1,35 @@
{
"schema": "freecad-web-manual/coverage/v1",
"generatedAt": "2026-11-13T03:05:48.506Z",
"modules": 32,
"unknownModules": [],
"nativeHandlers": 196,
"nativeMapped": 196,
"desktopRecords": 1492,
"registryCommands": 306,
"routes": 1296,
"byChapter": {
"ch00": 237,
"ch01": 0,
"ch02": 93,
"ch03": 141,
"ch04": 96,
"ch05": 39,
"ch06": 51,
"ch07": 9,
"ch08": 104,
"ch09": 208,
"ch10": 139,
"ch11": 145,
"ch12": 105,
"ch13": 235,
"ch14": 0,
"ch15": 0
},
"byStatus": {
"detailed": 312,
"overview": 1287,
"boundary": 3
},
"ok": true
}

View File

@@ -0,0 +1,30 @@
{
"schema": "freecad-web-manual/inventory/v1",
"generatedAt": "2026-11-13T03:05:48.516Z",
"sources": [
{
"path": "public/api/workbench-command-matrix.json",
"sha256": "0f467b45c2ed0105bc3f9d58a6149f18a6dc65dd86a93fc6b4f53cd1a39cfe5c"
},
{
"path": "public/api/desktop-command-routes.json",
"sha256": "6b21e4b2a7b06f5516433771bba06d61d1e7f3daa0e9a68c83aad6e000b4a25a"
},
{
"path": "src/module-registry.generated.ts",
"sha256": "359b2c34821e8b0696e584d2c840bc21e339a6dabe177746378748cd9bdb1af1"
},
{
"path": "teaching/data/features.json",
"sha256": "b9b9ef9fdb612d6a6e92b828be3749be92096b68892bf762e16c33f622571c35"
},
{
"path": "teaching/data/cases.json",
"sha256": "d871f200bfd504f44bdf87216e6e09eb4ae2a2971fc66434542367e2cb0e35fc"
},
{
"path": "docs/current/freecad-official-case-ledger.json",
"sha256": "d03239f0faef109020f99b3ae2a4d0bd1ef8396b656f52278942914fa57d8bc7"
}
]
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,42 @@
{
"schema": "freecad-web-manual/page-check/v1",
"generatedAt": "2026-11-13T03:11:58.755Z",
"url": "http://127.0.0.1:5190/manual.html",
"viewports": [
{
"viewport": {
"width": 1440,
"height": 900
},
"status": 200,
"errors": [],
"failed": [],
"searchHits": 4,
"chapters": 1,
"sections": 10,
"images": 6,
"brokenImages": [],
"commandRows": 1602,
"overflow": 0,
"searchSize": 1613
},
{
"viewport": {
"width": 390,
"height": 844
},
"status": 200,
"errors": [],
"failed": [],
"searchHits": 4,
"chapters": 1,
"sections": 10,
"images": 6,
"brokenImages": [],
"commandRows": 1602,
"overflow": 0,
"searchSize": 1613
}
],
"ok": true
}

Binary file not shown.

View File

@@ -0,0 +1,58 @@
{
"schema": "freecad-web-manual/scenario/v1",
"chapter": "ch01",
"workflow": "ui-and-document",
"title": "界面、文档、对象树、属性、视图与保存",
"actions": [
{ "type": "goto", "url": "/project.html?workbench=Part" },
{ "type": "waitFor", "selector": "select[aria-label=\"Workbench\"]" },
{ "type": "wait", "ms": 1200 },
{ "type": "click", "selector": "nav[aria-label=\"Application menus\"] details", "hasText": "File", "target": ":scope > summary" },
{ "type": "click", "role": "button", "name": "新建 Document", "exact": true },
{ "type": "wait", "ms": 2200 },
{ "type": "eval", "script": "for (const d of document.querySelectorAll('nav[aria-label=\"Application menus\"] details[open]')) d.open = false" },
{ "type": "shot", "name": "01-interface", "fullPage": true },
{ "type": "click", "selector": ".part-menu > summary", "timeout": 30000 },
{ "type": "wait", "ms": 300 },
{ "type": "click", "selector": "details.part-submenu", "hasText": "Primitives", "target": ":scope > summary" },
{ "type": "wait", "ms": 300 },
{ "type": "click", "selector": "button[data-command=\"Part_Box\"]" },
{ "type": "wait", "ms": 1200 },
{ "type": "click", "selector": ".fc-tree-text", "hasText": "Cube" },
{ "type": "wait", "ms": 400 },
{ "type": "fill", "selector": "input[aria-label=\"Length\"]", "value": 60 },
{ "type": "fill", "selector": "input[aria-label=\"Width\"]", "value": 40 },
{ "type": "fill", "selector": "input[aria-label=\"Height\"]", "value": 20 },
{ "type": "click", "role": "button", "name": "应用尺寸并重算", "exact": true },
{ "type": "wait", "ms": 1500 },
{ "type": "click", "role": "button", "name": "Close task / Cancel", "exact": true },
{ "type": "click", "selector": ".fc-tree-text", "hasText": "Cube" },
{ "type": "wait", "ms": 300 },
{ "type": "fill", "selector": "input[aria-label=\"Object Label\"]", "value": "ManualCube" },
{ "type": "press", "key": "Enter" },
{ "type": "wait", "ms": 800 },
{ "type": "shot", "name": "02-part-box", "fullPage": true },
{ "type": "click", "role": "button", "name": "Position", "exact": true },
{ "type": "wait", "ms": 400 },
{ "type": "fill", "selector": "input[aria-label=\"Position X\"]", "value": 10 },
{ "type": "fill", "selector": "input[aria-label=\"Position Y\"]", "value": 20 },
{ "type": "fill", "selector": "input[aria-label=\"Position Z\"]", "value": 30 },
{ "type": "click", "role": "button", "name": "应用位置与旋转", "exact": true },
{ "type": "wait", "ms": 1200 },
{ "type": "click", "role": "button", "name": "Close task / Cancel", "exact": true },
{ "type": "shot", "name": "03-placement", "fullPage": true },
{ "type": "click", "selector": ".fc-tree-text", "hasText": "ManualCube" },
{ "type": "wait", "ms": 300 },
{ "type": "fill", "selector": "input[aria-label=\"Object Color\"]", "value": "#4a90d9" },
{ "type": "eval", "script": "document.querySelector('input[aria-label=\"Object Color\"]')?.dispatchEvent(new Event('change', { bubbles: true }))" },
{ "type": "wait", "ms": 600 },
{ "type": "shot", "name": "04-properties", "selector": "aside.properties" },
{ "type": "drag", "selector": "[aria-label=\"Imported native 3D view\"]", "dx": -120, "dy": -40 },
{ "type": "shot", "name": "05-viewport", "fullPage": true },
{ "type": "save" },
{ "type": "wait", "ms": 800 },
{ "type": "assertVisible", "selector": ".fc-tree-text:has-text(\"ManualCube\")" },
{ "type": "shot", "name": "06-saved", "fullPage": true },
{ "type": "shot", "name": "07-summary", "fullPage": true }
]
}