Files
FreeCADWasmDev/web/manual/content/ch02-part.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

167 lines
8.7 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: ch02
order: 2
title: Part 图元与布尔
level: core
---
# 第 2 章 Part 图元与布尔
## 学习目标
1. 从 Part 菜单创建 Box、Cylinder 等参数化图元。
2. 在属性面板改尺寸与 Placement,而不是反复重建对象。
3. 用 Cut 做通孔,理解 Base / Tool 与布尔结果的关系。
4. 用 CheckGeometry 检查实体有效性,看懂体积、面数、三角面数。
## 2.1 Part 菜单与工作流
Part 工作台把命令分成九组:Primitives、Solids、Boolean、Split、Compound、
Copy、Join、Feature、Inspection。
初学阶段只走一条主线:**图元 → 布尔 → 检查**。其余工具等这条主线熟了再展开。
![Part 工作台:菜单、对象树、属性面板与视口](./manual-assets/ch02/part-primitives-boolean/01-primitives.png)
本例要做出一个带通孔的底板:
- 底板:80 × 60 × 20 的 Box,标签 `PartBase`。
- 圆柱:半径 15、高度 40,标签 `Cylinder1`,沿 Z 放到 `-10`,
让它从底板下方穿到上方。
## 2.2 创建与修改图元
1. 打开 `Part → Primitives → Box`,任务面板填 `Length 80 / Width 60 / Height 20`。
2. 点“应用尺寸并重算”,把标签改为 `PartBase`。
3. 打开 `Part → Primitives → Cylinder`。圆柱会以默认参数立即创建。
4. 选中 `Cylinder1`,在属性面板 Data 区把 `Radius` 改成 15、`Height` 改成 40。
5. 在同面板把 Placement 的 Position 设为 `(40, 30, -10)`。
为什么 Z 要设成 `-10`:圆柱高度 40、底面在 `-10`,顶面就到 `+30`,
完整穿过厚度 20 的底板。位置不对,布尔结果就是实心块。
> 图元建好后,尺寸与位置都在属性面板改。重新打开命令只会再建一个新对象。
## 2.3 布尔 Cut
选中底板和圆柱这两个对象,打开 `Part → Boolean → Cut`。
Part 会用当前选择(或前两个对象)建立 `Cut1`,属性面板显示
`Operation = Cut`、`Base = PartBase`、`Tool = Cylinder1`。
![Cut 结果:通孔、体积 81862.83 mm³、7 个面、124 个三角面](./manual-assets/ch02/part-primitives-boolean/02-boolean-cut.png)
检查结果:
| 指标 | 值 | 说明 |
|---|---|---|
| 体积 | 81862.83 mm³ | 小于原始 96000,说明真的挖掉了材料 |
| Faces | 7 | 底板 6 面 + 孔壁 1 面 |
| Triangles | 124 | 显示用的三角面数 |
| 包围盒 | 80 × 60 × 20 mm | 外形没变 |
如果体积仍是 `96000`,说明圆柱根本没和底板相交:回头检查圆柱的
`Height` 与 Placement 的 Z。
## 2.4 检查几何
选中 `Cut1`,打开 `Part → Inspection → Check Geometry`,
勾选对象后点“Check shapes”。任务面板列出 BOP 检查结果,有效实体应当没有错误。
![CheckGeometry 任务:选择 Cut1 并执行检查](./manual-assets/ch02/part-primitives-boolean/03-check-geometry.png)
![检查后的结果视图](./manual-assets/ch02/part-primitives-boolean/04-result.png)
布尔做多了容易留下微小自交或开放边,这类问题体积数字看不出来,
只有 CheckGeometry 能发现。养成布尔之后必查的习惯。
## 2.5 其他 Part 工具速查
| 组 | 命令 | 用途 |
|---|---|---|
| Boolean | `Part_Fuse` / `Part_Common` | 并集 / 交集 |
| Split | `Part_Slice` / `Part_SliceApart` / `Part_XOR` | 切片、拆开、异或 |
| Join | `Part_JoinConnect` / `Part_JoinEmbed` / `Part_JoinCutout` | 连接、嵌入、挖槽 |
| Compound | `Part_Compound` / `Part_ExplodeCompound` | 合成 / 炸开复合体 |
| Copy | `Part_SimpleCopy` / `Part_TransformedCopy` / `Part_RefineShape` | 复制与清理 |
| Feature | `Part_Extrude` / `Part_Revolve` / `Part_Loft` / `Part_Sweep` | 拉伸、旋转、放样、扫掠 |
| Dress-up | `Part_Fillet` / `Part_Chamfer` | 圆角 / 倒角 |
| Offset | `Part_Offset` / `Part_Offset2D` / `Part_Thickness` | 3D / 2D 偏移、抽壳 |
| Inspection | `Part_CheckGeometry` / `Part_Defeaturing` | 几何检查、去特征 |
| 显示 | `Part_ColorPerFace` / `Part_SectionCut` | 逐面上色、剖切 |
完整命令与状态见附录命令索引。
## 2.6 面板与任务面板
Part 工作台在 Web 端登记了 33 个任务面板与 7 组菜单,全部由 React 组件承载,打开方式与桌面一致:菜单命令或工具栏按钮触发后,参数面板出现在界面左侧「Tasks」区域。
| 面板 | 用途 | 打开方式 |
|---|---|---|
| 形状构建器(Shape builder) | 用边、面、线框拼出实体或壳体 | Part → 形状构建器 |
| 倒角 / 圆角(Chamfer / Fillet) | 对边或面做倒角、圆角,可选连续边链 | Part → 倒角 / 圆角 |
| 复合(Compound) | 把多个形状合成复合体并支持炸开 | Part → Compound |
| 布尔运算 | Cut / Fuse / Common 的结果对象与参数复核 | Part → 布尔 |
| 检查几何(Check geometry) | BOP 检查、面/边/壳体清单与错误定位 | Part → 检查几何 |
| 去特征(Defeaturing) | 删除指定面并重建,用于简化导入模型 | Part → Defeaturing |
| 逐面上色(Color per face) | 为单个面指定颜色与透明度 | 视图 → 逐面上色 |
| 剖切(Cross-sections) | 动态剖面与截面轮廓 | 视图 → 剖切 |
面板里的「应用」与「关闭」成对出现:改参数后点应用立即重算,关闭只收起面板不撤销已应用的结果;要撤销用编辑 → 撤销。每个面板的 React 实现文件与桌面参考源码可在第 16 章「任务面板」表中逐项查对。
### 形状构建器
`Shape builder` 用已有对象的顶点、边、面拼出新形状。面板从上到下是:`Mode`(Edge from vertices / Wire from edges / Face from vertices / Face from edges / Shell …)、`Source`(源对象)、元素复选框列表(Vertex1…、Edge1…、Face1…),以及 `Create shape` 与关闭按钮。
底部实时显示选中的预览长度与面积,提交前就能看出选择对不对:
![Shape builder:Mode、Source Cube 与顶点列表,底部显示预览长度 1280 mm、面积 15200 mm²](./manual-assets/ch02/part-task-panels/01-shape-builder.png)
### 倒角与圆角
`Fillet` 面板有 `Base`(目标对象)、`Type`(Constant radius / Variable radius)、半径(如 1 mm)、`Select all` / `Clear selection`,以及逐条边的起始/结束半径。
面板底部显示预览:`Edges 12`、`Volume 96000 mm³`——这两个数字是判断参数是否生效的直接依据。
![Fillet:Base Cube、Constant radius、半径 1 mm,预览 Edges 12 / Volume 96000 mm³](./manual-assets/ch02/part-task-panels/02-fillet.png)
`Chamfer` 结构相同,`Type` 为 `Equal distance`、`Two distances`、`Distance and Angle`,默认距离 1 mm。切换类型后多出的字段与 PartDesign 的边缘特征一致:
![Chamfer:Equal distance 1 mm,预览同样给出 Edges 12 / Volume 96000](./manual-assets/ch02/part-task-panels/03-chamfer.png)
### 布尔运算面板
`布尔运算` 面板用三个图标按钮切 `Cut` / `Fuse` / `Common`,`Base` 选主对象,`Tool` 选参与运算的另一个对象,`创建` 提交、`重算` 就地更新。
它和 2.3 节菜单里的 `Part_Cut` 是同一套内核路径,区别只在可以反复改参数:
![布尔运算:三种布尔类型、Base 与 Tool 选择,创建/重算](./manual-assets/ch02/part-task-panels/04-boolean.png)
### 检查几何面板
`Check geometry` 先勾选要检查的对象,点 `Check shapes` 执行,结果表逐对象给出有效性:
`Valid` 行后面跟拓扑统计(Edge 12 / Face 6 / Shell 1 / Solid 1 / Vertex 8 / Wire 6),最后一列 `Issues` 为 `None` 表示没有 BOP 问题:
![Check geometry:Cube Valid,拓扑统计与 Issues None](./manual-assets/ch02/part-task-panels/05-check-geometry.png)
这张表比体积数字更能说明形状是否健康。导入的 STEP 出现红色面或体积异常时,先跑一次检查几何再判断是显示问题还是几何问题。
## 自检
- [ ] 对象树里有 `PartBase`、`Cylinder1`、`Cut1` 三个对象。
- [ ] `Cylinder1` 的 Radius = 15、Height = 40、Position Z = -10。
- [ ] `Cut1` 体积 81862.83 mm³,不是 96000。
- [ ] `Cut1` 的 Faces = 7、Triangles = 124。
- [ ] CheckGeometry 报告没有错误。
## 常见错误
1. 圆柱还是默认高度 10 且位于底板下方,Cut 后体积不变。
2. 只选中一个对象就执行 Cut,报“需要两个对象”。
3. 改了图元尺寸但没重算,布尔用的还是旧形状。
4. Cut 的 Base / Tool 选反,得到的孔形与预期相反。
5. 做完布尔不检查几何,留下自交问题带到导出环节。
## 练习
1. 把圆柱半径改成 10,观察体积变化,再改回 15。
2. 用 `Part_Fuse` 把 `PartBase` 与 `Cylinder1` 合并,比较与 Cut 的体积差别。
3. 用 `Part_SimpleCopy` 复制 `Cut1`,再对副本跑 `Part_CheckGeometry`。
4. 把圆柱改成不穿透(Height 10、Z = 0),观察体积与预期是否一致。