2026-07-28 17:08:03 +08:00
|
|
|
|
# VDE-024: CAM toolpath 全部以 NurbsCurve 为输入,缺少 mesh contour 提取 API
|
|
|
|
|
|
|
|
|
|
|
|
- **ID**: VDE-024
|
|
|
|
|
|
- **Date**: 2026-07-28
|
2026-07-29 11:36:47 +08:00
|
|
|
|
- **Status**: Fixed
|
2026-07-28 17:08:03 +08:00
|
|
|
|
- **Severity**: High
|
|
|
|
|
|
- **Category**: API Gap
|
|
|
|
|
|
- **Source**: ViewDesign feat/viewdesign-engine branch
|
|
|
|
|
|
|
|
|
|
|
|
## Issue
|
|
|
|
|
|
|
|
|
|
|
|
VDE 的 CAM 模块(5 个文件,覆盖 3 轴到 5 轴联动)形成了完整的 CAM 体系,
|
|
|
|
|
|
但所有刀路生成 API 都以 `NurbsCurve` 为输入:
|
|
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
|
Toolpath contour_toolpath(const NurbsCurve& curve, ...);
|
|
|
|
|
|
Toolpath pocket_toolpath(const NurbsCurve& boundary,
|
|
|
|
|
|
const std::vector<NurbsCurve>& islands, ...);
|
|
|
|
|
|
// cam_strategies.h, cam_advanced.h, cam_optimization.h, cam_5axis.h 全部同理
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
ViewDesign 的几何数据以 mesh 形式存储,从中提取轮廓曲线(边界检测 + NURBS 拟合)
|
|
|
|
|
|
是一个复杂的几何处理问题,VDE 没有提供这样的便捷入口。
|
|
|
|
|
|
|
|
|
|
|
|
## Impact
|
|
|
|
|
|
|
|
|
|
|
|
CAM 模块完全未集成 VDE。刀具路径生成、加工策略选择、后处理等全部依赖 OCCT。
|
|
|
|
|
|
|
|
|
|
|
|
## Suggested Fix
|
|
|
|
|
|
|
|
|
|
|
|
**方案一(推荐)**:VDE 提供 mesh contour 提取 API
|
|
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
|
// 在给定 Z 高度截取 mesh 并提取轮廓
|
|
|
|
|
|
std::vector<NurbsCurve> extract_contour_from_mesh(
|
|
|
|
|
|
const HalfedgeMesh& mesh, double zHeight);
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
**方案二**:为 CAM API 添加 mesh 输入重载
|
|
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
|
Toolpath contour_toolpath(const HalfedgeMesh& mesh, double zHeight, ...);
|
|
|
|
|
|
Toolpath pocket_toolpath(const HalfedgeMesh& mesh,
|
|
|
|
|
|
const std::vector<HalfedgeMesh>& islands, double zHeight, ...);
|
|
|
|
|
|
```
|