The manual claimed 32 modules and taught several workflows that do not run in the web port. Rewrite the chapter bodies and drive every new screenshot from a real interaction with a waitFor before each shot. Screenshots go from 33 to 63. ch06-ch13 grow from one page snapshot each to 3-7 shots taken in headed Chrome, all with empty pageErrors and consoleErrors and every PNG well above the 5 KB bar. Correct the text where the port differs from the desktop: - ch08: Mesh_FromPartShape has no task panel, so the main line becomes Mesh_BuildRegularSolid, which really returns typeId Mesh::Cube. - ch09: no BIM creation command has a panel; only Library, Setup, Material and Views are usable. - ch10: CAM_Job offers only None in its Model select and fails with cam_command_failed. - ch11: the recorded error was Document does not exist; the real one is invalid_request: Select source objects in the current document, and PageDefault cannot create a page at all. - ch12: FEM_Analysis has no panel, so the chain breaks at step one. - ch13: drop every OpenSCAD scene action and screenshot; Robot jog buttons, the Plot canvas and Draft viewport picking do not work, so the chapter documents the panels instead of pretending they run. Rebuild gives 15 chapters, 1575 command rows, 1721 search entries and 945197 bytes; check:manual passes both viewports with no errors, no broken images and no horizontal overflow. The gap ledger goes from 7 to 11 boundaries. Remove b-openscad-recompile, which should not exist while the workbench is removed, and record the five newly measured ones: BIM creation, Mesh_FromPartShape, Draft viewport picking, Robot without a model and Plot without a canvas. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
129 lines
5.4 KiB
Markdown
129 lines
5.4 KiB
Markdown
---
|
||
id: ch06
|
||
order: 6
|
||
title: 测量、检查、材质与表格
|
||
level: core
|
||
---
|
||
|
||
# 第 6 章 测量、检查、材质与表格
|
||
|
||
## 学习目标
|
||
|
||
1. 用 Spreadsheet 建参数表、写公式、设置别名,让表格驱动模型尺寸。
|
||
2. 用 Measure 读距离、角度与质量属性,并与属性面板交叉验证。
|
||
3. 用 Inspection 查看面、边、顶点的几何数据。
|
||
4. 用 Material / Appearance 设置材质与显示颜色,并确认保存后仍保留。
|
||
|
||
## 6.1 Spreadsheet 参数表
|
||
|
||
把工作台切到 `Spreadsheet`,点“Create spreadsheet”建一张表。
|
||
|
||
| 功能 | 命令 |
|
||
|---|---|
|
||
| 新建表 | `Spreadsheet_CreateSheet` |
|
||
| 编辑单元格 | 双击单元格直接输入 |
|
||
| 设别名 | `Spreadsheet_SetAlias` |
|
||
| 合并 / 拆分 | `MergeCells` / `SplitCell` |
|
||
| 对齐 | `AlignLeft` / `AlignCenter` / `AlignRight` |
|
||
| 样式 | `StyleBold` / `StyleItalic` / `StyleUnderline` |
|
||
| 导入 / 导出 | `Spreadsheet_Import` / `Spreadsheet_Export` |
|
||
|
||
**公式**以 `=` 开头,可以引用其他单元格,例如 `=B2+C2`。
|
||
**别名**是给单元格起一个可读名字(如 `wallHeight`),之后模型属性可以绑定到别名。
|
||
|
||

|
||
|
||
上图的取图步骤可以照做:打开 `project.html`,`File → 新建 Document`,
|
||
再把顶部的 `Workbench` 下拉切到 `Spreadsheet`,点 `Create spreadsheet`。
|
||
表格出现在主舞台,公式栏在上方,样式按钮在下方的任务区。
|
||
|
||
参数驱动的实际价值:把墙高、板厚、阵列数量都放进同一张表,
|
||
改一个数字,所有引用它的对象一起更新,不用逐个打开任务面板。
|
||
这也是第 9 章 BIM 推荐的建模方式。
|
||
|
||
## 6.2 Measure 测量
|
||
|
||
| 命令 | 用途 |
|
||
|---|---|
|
||
| `Std_Measure` | 两点/两面之间的距离与角度 |
|
||
| `Std_MassProperties` | 体积、表面积、质量、质心 |
|
||
| `measure.measurementApi` | 通过 API 读取测量结果 |
|
||
| `measure.objectFamily` | 对象级测量 |
|
||
|
||
在项目页 Tasks 区点 `Std_Measure — Measure` 或 `Std_MassProperties — Mass properties`,
|
||
选中对象或子元素后读结果。
|
||
|
||
**交叉验证很重要**:一个 60 × 40 × 20 的 Box,属性面板与 `MassProperties` 都应给出
|
||
48,000 mm³。两个来源不一致,说明选中的对象不是你以为的那个。
|
||
|
||
`Std_MassProperties` 的任务面板是一个 `Add object` 分组:先选对象加进列表,
|
||
再点 `Refresh` 重算。
|
||
|
||

|
||
|
||
点 `Refresh` 之后,面板里出现体积、表面积、质量与质心四组结果:
|
||
|
||

|
||
|
||
## 6.3 Inspection 检查
|
||
|
||
- `Inspection_InspectElement`:检查选中的面、边、顶点信息。
|
||
- `Inspection_VisualInspection`:可视化检查,用于看曲率或偏差分布。
|
||
|
||
任务面板会列出选中元素的数量、类型与几何数据。做布尔之后用它确认
|
||
切出来的面确实存在,而不是凭体积猜。
|
||
|
||
## 6.4 Material 与 Appearance
|
||
|
||
| 命令 | 用途 |
|
||
|---|---|
|
||
| `Std_SetAppearance` | 设置显示颜色与外观 |
|
||
| `Std_SetMaterial` | 指定材料 |
|
||
| `Material_Edit` | 编辑材料属性 |
|
||
| `Materials_InspectAppearance` | 检查外观 |
|
||
| `Materials_InspectMaterial` | 检查材料 |
|
||
|
||
`Material_Edit` 打开的是材料属性编辑器,可以改名称、类别、密度等字段:
|
||
|
||

|
||
|
||
`Std_SetAppearance` 控制显示外观,面板顶部是 `Custom appearance` 入口:
|
||
|
||

|
||
|
||
颜色写入 FCStd 的 `WebDisplayColor` 属性,保存后重新打开仍保留。
|
||
|
||
**边界**:Material 原生库在 Web 端对稀疏数组与单位处理不完整,
|
||
部分命令会失败或返回不完整数据。以界面任务实际可用的项为准,
|
||
不要假定材料库的全部 API 都能调用。
|
||
|
||
## 边界与注意
|
||
|
||
- 公式与别名的绑定需要在对象属性里显式引用,光设别名不会自动生效。
|
||
- 测量前必须先选中对象,否则任务返回空结果,看起来像功能坏了。
|
||
- 材质库是边界,颜色与外观可用,材料物理属性不一定完整。
|
||
|
||
## 自检
|
||
|
||
- [ ] 能建 Spreadsheet 并输入文本、数字与公式。
|
||
- [ ] 公式 `=B2+C2` 能随 B2 变化自动更新。
|
||
- [ ] 能打开 Measure 与 MassProperties 并读到数值。
|
||
- [ ] 用两种方式测同一对象体积,结果一致。
|
||
- [ ] 能设置颜色并在保存后重新打开确认仍在。
|
||
- [ ] 知道 Material 库的 Web 边界。
|
||
|
||
## 常见错误
|
||
|
||
1. 公式输入后没按 Enter 或没点应用,值没生效。
|
||
2. 测量时没选对象,得到空结果就以为功能不可用。
|
||
3. 只改颜色没触发应用,保存后颜色丢了。
|
||
4. 设置了别名但没在对象属性里引用,以为能自动联动。
|
||
5. 改完表格数值没重新计算,模型还是旧尺寸。
|
||
|
||
## 练习
|
||
|
||
1. 建一张 3 行参数表,用公式计算长 × 宽,并给结果单元格设别名。
|
||
2. 测量一个 Box 的体积与质心,与属性面板对照,记录是否一致。
|
||
3. 给两个对象设不同颜色,保存、刷新、重新打开,确认颜色保留。
|
||
4. 把一个 Box 的 Length 绑定到表格别名,改表格数值,观察对象是否更新。
|