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>
6.4 KiB
id, order, title, level
| id | order | title | level |
|---|---|---|---|
| ch08 | 8 | 网格、点、逆向与曲面 | specialist |
第 8 章 网格、点、逆向与曲面
能力概览
这一章处理“不是实体”的几何:三角网格、点云、逆向重建的近似曲面。 它们与前面几章的 B-Rep 实体是两种不同表示,转换时必然有信息损失。
| 模块 | 主要能力 | 代表命令 |
|---|---|---|
| Mesh | 导入导出、从形状生成网格、布尔、抽稀、平滑、重网格、截面 | Mesh_Import、Mesh_FromPartShape、Mesh_Boolean、Mesh_Decimating |
| MeshPart | 网格转形状、修剪、分段、评估 | MeshPart_CreateShape、MeshPart_Trim、MeshPart_Sections |
| Points | 点云导入导出、合并、从网格取点 | Points_Import、Points_Merge、Points_FromMesh |
| ReverseEngineering | 近似曲面、分割、拟合 | ReverseEngineering_Approximation、Segmentation |
| Surface | 填充曲面、边界曲面 | Surface_Filling、Surface_GeomFillSurface |
注意模块页上可能显示
boundary · no worker。这意味着该命令没有可用的后台 执行通道,点了也不会成功。可用的替代入口见 8.1 与 8.2。
8.1 从实体生成网格
这里要先说清一个实测结论:Mesh_FromPartShape 在 Web 端没有任务面板,
上面写的那条"实体 → 网格"标准路径走不通。取而代之的是 Mesh_BuildRegularSolid,
它反而有完整面板,而且能真正生成几何。
Mesh_BuildRegularSolid 的面板叫 Regular Mesh,可以选实体类型(立方体、圆柱、
球、圆锥、环……),并分别填三组尺寸。下面是把尺寸填成 40 / 30 / 20 后点 Preview 的结果:
点 Create 提交后,返回的是真实原生结果:
{"nativeOperationCompleted": true, "object": "Cube", "solid": "box", "typeId": "Mesh::Cube"}
也就是说这条路不是"面板能填但没反应",而是真的产出了一个 Mesh::Cube。
建出来的网格可以继续做下面几步。
质量评估
Mesh_Evaluation 的面板叫 Refresh document meshes,点它重新统计文档里所有网格:
接着点 Analyze Indices,面板给出三角面数、顶点数与边界状态:
导出
Mesh_Export 的面板叫 Mesh export,选格式与目标文件后提交:
按 OPFS 铁律,导出默认落在浏览器 OPFS 的 freecad-exports 目录,
只有显式点"下载到本地"才会落盘。
8.2 从实体生成网格(桌面版标准路径)
桌面版的顺序是这样的,Web 端目前只能走上面 8.1 的替代路径:
- 先用 Part 或 PartDesign 建一个实体(例如第 2 章的 Box)。
- 打开 Mesh 工作台,执行
Mesh_FromPartShape。 - 在弹出的参数里设定线性挠度与角度挠度。挠度越小,面越多、越贴近原形。
- 用
Mesh_Evaluation查看三角面数、顶点数、包围盒。 - 需要减小体积时执行
Mesh_Decimating,填写目标缩减比例。 - 用
Mesh_Export导出 STL / OBJ / 3MF。
挠度是这一步唯一的品质旋钮。同一个 Box,挠度从 0.1 放到 1.0,三角面数会明显下降, 但平坦面上看不出差别——所以调参要用带曲面的对象验证,别用立方体。
8.3 网格转实体
方向反过来:网格 → 实体,常见于扫描件或外部 STL 的再加工。
Part_ShapeFromMesh:把 Mesh 转为 Part 形状。Part_MakeSolid:把封闭壳进一步转为实体(需要网格封闭)。MeshPart_CreateShape:带公差与缝合参数的转换,可控性更好。- 转换完成后必须跑
Part_CheckGeometry确认有效性。
转换失败最常见的原因是网格不封闭:有开放边就做不成实体。先用 Mesh_Evaluation
看边界状态,必要时先用 Mesh_FillHoles 补洞。
8.4 点云
Points_Import读入点云文件。Points_Merge合并多个点云(多次扫描的拼接)。Points_FromMesh从已有网格反向取点,用于测试或抽样。
点云本身不是几何体,只能显示与作为拟合输入,不能直接参与布尔运算。
8.5 逆向与曲面
ReverseEngineering_Approximation:把点云/网格近似成曲面。ReverseEngineering_Segmentation:把点云按区域分割,便于分区拟合。Surface_Filling:在封闭边界上填充曲面。Surface_GeomFillSurface:在边界曲线之间生成过渡曲面。
逆向结果是近似曲面,不是原始设计意图的重建。拟合完成后要人工比对偏差, 不要默认它与实物一致。
边界与注意
- Mesh 模块页里标
no worker的命令不能从页面直接执行。 - 网格导出(STL/OBJ/3MF)不含参数化历史,无法反推回 Pad/Pocket 特征。
- 点云与逆向结果是自由曲面,后续参数化编辑能力很有限。
- 网格布尔容易产生开放边,做完要检查封闭性。
自检
- 能说出 Mesh / MeshPart / Points / ReverseEngineering / Surface 各一个命令。
- 能从实体生成网格并读出三角面数。
- 能解释
boundary · no worker标记的含义。 - 能把网格转成 Part 形状并跑
Part_CheckGeometry。 - 知道网格转实体为什么要求封闭。
常见错误
- 拿网格直接做实体布尔,结果出现开放边、体积算不出来。
- 抽稀过度,尺寸和特征一起丢掉了。
- 没检查封闭性就转实体,转换失败或得到空壳。
- 以为 STL 能恢复参数化特征,回头发现改不了任何尺寸。
- 把逆向拟合结果当成精确重建,实际有系统性偏差。
练习
- 建一个 Box,用
Mesh_FromPartShape生成网格,记录三角面数。 - 用
Mesh_Decimating抽稀 50%,比较体积与包围盒误差。 - 把网格转成 Part 形状,跑
Part_CheckGeometry并记录结果。 - 故意用一个开放网格做
Part_MakeSolid,观察报错信息。




