Files
FreeCADWasmDev/web/manual/content/ch05-assembly.md
wangdequan 300c8efb01 docs(web): full UI surface inventory, illustrated manual, panel screenshots
Interface design document and manual now share one authoritative surface
inventory (333 surfaces across 9 categories, gap 0), and every chapter carries
real Playwright screenshots of the panels it documents.

- tools/fcweb: ui-surface-scan/ui-surface-inventory (deterministic --check),
  build-ui-doc renders panel catalog, workbench matrix and mapping tables;
  blank toolbar crops (<1 KB) are skipped and pruned instead of embedded
- web/tools/manual: generate-panel-index (ch16), audit-ui-gaps,
  generate-final-status, generate-gaps-doc; pager is per-chapter so the manual
  no longer overflows horizontally
- manual: 130 screenshot references / 128 PNGs, panel sections for ch02-ch13
- web/src: utility menus stop click propagation (menu reopened on item click);
  workbench shell gains an OPFS document picker so workbench.html can bind a
  real document instead of the fixed workbench-document id; Sketcher panel
  moves from the command column to the main stage

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-23 01:30:31 +08:00

178 lines
8.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
id: ch05
order: 5
title: Assembly 装配
level: core
---
# 第 5 章 Assembly 装配
## 学习目标
1. 在 Assembly 工作台创建装配文档。
2. 从 OPFS 里的 FCStd 源文件插入零件链接,理解链接不等于复制几何。
3. 认识 Ground、Joint、Solve、Exploded、BOM、Simulation 各自的用途。
4. 能判断装配失败是源文件、链接还是求解器的问题。
## 5.1 创建装配文档
打开 Assembly 工作台:
`workbench.html?module=Assembly&command=Assembly_CreateAssembly`
在“Assembly document”任务里填:
| 参数 | 本例取值 |
|---|---|
| Assembly document name | `ManualAssembly` |
| Assembly label | `手动装配` |
点 Create。装配文档与零件文档是**分开保存**的:装配里存的是链接与关节,
而不是零件几何的副本。所以改零件,装配才会跟着变。
![Assembly 创建任务:文档名与标签](./manual-assets/ch05/assembly-create-insert/01-create-assembly.png)
## 5.2 插入零件链接
创建后自动进入 Insert Link 任务:
1. Source 选 OPFS 里的 `manual-assembly-source.FCStd`。
2. 点“Load source”,读取出源文件里的对象列表。
3. Object 选 `CabinetA_P01`,点 Insert。
4. 再选 `CabinetA_P02`,点 Insert。
5. 需要时设置 Position 的 X / Y / Z;Rigid link 表示刚性链接(不产生相对运动)。
6. 点 Accept 完成。
![Insert Link:源文件、对象与 2 条已插入链接](./manual-assets/ch05/assembly-create-insert/02-insert-links.png)
插入成功后列表显示:
```
CabinetA_P01 → Component (manual_assembly_source/Box)
CabinetA_P02 → Component001 (manual_assembly_source/Box001)
```
> **前提**:源文件必须已经在 OPFS 里。Web 版不能用本地绝对路径引用外部 FCStd,
> 所以要先把零件保存到 OPFS,再来插链接。
## 5.3 装配结果
Accept 之后,Assemblies 面板出现 `ManualAssembly`,其下是组件链接。
双击组件可以激活或编辑;链接与源文档保持关联,源文件变了装配会提示更新。
![装配结果:ManualAssembly 与两个组件](./manual-assets/ch05/assembly-create-insert/03-assembly-result.png)
## 5.4 关节与求解
| 命令 | 用途 |
|---|---|
| `Assembly_ToggleGrounded` | 固定一个组件作为基准 |
| `Assembly_CreateJointFixed` | 固定关节 |
| `Assembly_CreateJointRevolute` | 旋转关节 |
| `Assembly_CreateJointSlider` | 滑动关节 |
| `Assembly_CreateJointBall` | 球关节 |
| `Assembly_CreateJointDistance` | 距离关节 |
| `Assembly_CreateJointAngle` | 角度关节 |
| `Assembly_CreateJointGears` / `Belt` / `RackPinion` / `Screw` | 齿轮 / 带 / 齿条 / 丝杠 |
| `Assembly_SolveAssembly` | 求解当前关节约束 |
| `Assembly_CreateView` | 爆炸视图 |
| `Assembly_CreateBom` | BOM 物料清单 |
| `Assembly_CreateSimulation` | 运动仿真 |
| `Assembly_ExportASMT` | 导出装配 |
典型顺序:**插入组件 → Ground 基准件 → 建关节(选两个组件与子元素)→ Solve →
读 Solver messages → 爆炸 / BOM / 仿真 → 导出**。
先 Ground 再建关节这一点很关键。没有固定件的装配,求解器会把所有组件一起漂移,
看起来像关节建错了。
## 5.5 装配任务面板
Assembly 工作台在 Web 端有 9 个任务面板与 2 组工具栏,覆盖从建装配到出物料清单的全过程:
| 面板 | 用途 |
|---|---|
| 创建装配(Create Assembly) | 新建 Assembly 容器,指定名称与是否作为根装配 |
| 插入链接(Insert Link) | 从 OPFS 的 FCStd 中挑选对象插入为链接 |
| 新建零件(New Part) | 在装配内新建空零件并转入 PartDesign |
| 激活装配(Activate Assembly) | 切换当前活动装配,决定插入与求解的目标 |
| 装配关节(Assembly) | 关节类型、参考子元素与偏移,配合 Joints 工具栏使用 |
| 仿真(Simulation) | 运动学仿真参数与结果回放 |
| 爆炸视图(Exploded view) | 按方向与距离炸开组件,用于说明书插图 |
| 物料清单(Bill of Materials) | 汇总组件、数量与来源文档,可导出 |
| 尺寸链(Tolerance) | 公差链计算与结果表 |
工具栏分为「Assembly」与「Assembly Joints」两组:前者管容器与组件,后者管关节与求解。面板与工具栏的完整映射(含 React 实现文件)见第 16 章。
### 关节面板
`Fixed Joint` 面板是装配关节的典型形态:顶部是 `Document` / `Assembly` / `Label` 三个归属字段,
中间 `Component 1` + `Subelement 1` 与 `Component 2` + `Subelement 2` 成对填写要连接的两个零件及其面/边,
底部 `Use current selection` 把视口里选好的引用一键填入,再 `Preview joint` 预览、`Create joint` 提交:
![Fixed Joint 面板:两个组件与子元素成对引用,Preview joint / Create joint](./manual-assets/ch05/assembly-task-panels/04-joints.png)
### 新建零件面板
`New Part` 面板把「在装配里造一个新零件」做成一行字段:`Part name`、`Destination`(`New FCStd file` 或现有文件)、`File name`,
外加 `Joint new part origin (fixed)` 开关。下面一排是 `New Part…`、`Accept`、`Cancel`、`Undo`、`Redo`、`Save assembly and linked files`、`Edit active Body`,
以及 `Saved assembly` 下拉与 `Reopen`——新建零件会立即在 OPFS 里生成独立 FCStd,装配只用链接引用它:
![New Part 面板:Part name、Destination、File name 与 Accept/Undo/Redo](./manual-assets/ch05/assembly-task-panels/05-new-part.png)
### 仿真面板
`Simulation` 面板分成三段:`Create or edit simulation`(下拉 + `Create simulation`)、`Simulation parameters`(Start time / End time / Output step / Global tolerance / FPS)、
`Motions`(关节、Motion type、Formula,例如 `5*time`;`Add motion` / `Remove motion`),最后是 `Generate frames` 与 `Playback — 0 frames`。
面板会直接给出前置条件:没有可动关节时提示 `Add a Revolute, Slider or Cylindrical joint to enable simulation.`——
固定关节的装配不会产生运动,先加一个旋转或滑动关节再回来:
![Simulation 面板:参数组、Motions 与 Generate frames,提示需要可动关节](./manual-assets/ch05/assembly-task-panels/06-simulation.png)
### 爆炸视图面板
`Exploded view` 面板以 `Create or edit view` 为顶:`New exploded view` + `Create view` / `Clear view preview`,
中间 `Components` 按 `Parts as single solid` 列出现有组件,底部 `Move` 组给出 `Align dragger`、`Pick alignment feature`、
`Translation dragger`、`Rotation dragger`、X/Y/Z 平移、Rotation X/Y/Z 与 `Preview radial explosion` / `Add move` / `Dismiss move (Esc)`:
![Exploded view 面板:组件列表与 Move 组的拖拽、旋转与径向爆炸](./manual-assets/ch05/assembly-task-panels/07-exploded.png)
### 物料清单面板
`BOM` 面板是列配置器:勾选 `Only parts` / `Detail parts` / `Detail sub-assemblies` 决定明细层级,
下方按序排列 `Index`、`Name`、`Description`、`File Name`、`Quantity` 五列,每列可用 `Move up` / `Move down` / `Remove` 调整,
最后 `Add standard column`(下拉)或填 `Custom column name` 后 `Add custom column` 增加自定义列:
![BOM 面板:明细层级开关与可排序的列清单](./manual-assets/ch05/assembly-task-panels/08-bom.png)
## 边界与注意
- 源文件不在 OPFS 时 Source 下拉框是空的,先回去保存零件。
- 关节需要两个组件加各自的子元素(面、边、点),只有一个组件建不成。
- 改源文件后要更新链接,否则装配里还是旧几何。
- 装配文档不复制几何,所以单独拷走装配文件拿不到零件。
## 自检
- [ ] Assemblies 面板里有 `ManualAssembly`。
- [ ] Insert Link 列表里有 2 条链接。
- [ ] 源文件显示为 `manual-assembly-source.FCStd`。
- [ ] 能打开 Joint 面板并看到 Component 1 / 2 与 Subelement。
- [ ] Solve 后 Solver messages 没有 malformed 或 redundant 错误。
## 常见错误
1. 源文件不在 OPFS,Source 下拉框为空。
2. 只插入一个组件就建关节,缺少配对对象。
3. 重复点 Insert,产生重复链接。
4. 没 Ground 就 Solve,整个装配漂移。
5. 改了源文件但没更新链接,装配仍显示旧几何。
## 练习
1. 插入第三个组件 `CabinetA_P03`。
2. 把 `CabinetA_P01` 设为 Ground,再建一个 Fixed 关节连接 P01 与 P02。
3. 点 Solve,记录 Solver messages 里的 dof 与错误数量。
4. 建一个 Revolute 关节,改变角度后观察组件是否绕轴旋转。