Files
ViewDesignEngine/docs/feedback/VDE-022.md
T
茂之钳 cc20369ff5 fix: mark VDE-025 as Fixed (MeshData→Assembly batch API), fix VDE-022 YAML formatting
VDE-025 (MeshData→Assembly batch build API):
- mesh_to_brep_model() and build_assembly_from_meshes() fully implemented
  in src/brep/assembly.cpp with PartInput struct declared in assembly.h
- 7 tests in tests/brep/test_assembly.cpp covering basic conversion,
  empty mesh, tetrahedron, single/multi/batch builds, and validation

VDE-022: fix broken YAML closing markdown bold syntax on status line
2026-07-28 18:10:36 +08:00

2.1 KiB
Raw Blame History

VDE-022: BrepModel 往返 mesh 转换丢失 edge/face ID — fillet/chamfer/shell 难以使用

  • ID: VDE-022
  • Date: 2026-07-28
  • Status: Fixed
  • Severity: High
  • Category: API Design
  • Source: ViewDesign feat/viewdesign-engine branch

Issue

VDE 的特征编辑 API 依赖 edge/face ID

BrepModel fillet(const BrepModel& body, int edge_id, double radius);
BrepModel chamfer(const BrepModel& body, int edge_id, double distance);
BrepModel shell(const BrepModel& body, int face_id, double thickness);

ViewDesign 当前架构通过 mesh 数据存储 Shape。当用户调用 fillet(shape, radius, edgeIndex) 时:

  1. Shape 转换为 BrepModelshapeMeshToBrep)→ edge ID 被重新分配
  2. 用户指定的 edgeIndex 是原始 Shape 中的 edge 顺序
  3. VDE 的 edge_idshapeMeshToBrep 过程中新创建的 ID
  4. 两者不匹配 → 无法正确选择要编辑的边/面
// 问题示意:
Shape box = PrimitiveFactory::box(10, 5, 3);
// box 中 edgeIndex=0 是盒子的某条边
auto brep = shapeMeshToBrep(box);  // 重建 mesh → BrepModel
// brep 中 edge_id=0 是创建顺序的第一条边(可能与 box.edgeIndex=0 不同!)
auto result = fillet(brep, 0, 2.0);  // 错误:在错误的边上做了圆角

Impact

ViewDesign 中 fillet/chamfer/shell/draft 保持 OCCT-only,无法切换到 VDE。

Suggested Fix

方案一VDE 提供 edge/face ID 映射 API

// 根据几何位置查找最近的 edge/face ID
int get_edge_index_by_position(const BrepModel& body, const Point3D& nearPoint);
int get_face_index_by_position(const BrepModel& body, const Point3D& nearPoint);

方案二:提供基于几何位置(而非 ID)的特征操作

BrepModel fillet_by_position(const BrepModel& body,
    const Point3D& nearPoint, double radius);
BrepModel chamfer_by_position(const BrepModel& body,
    const Point3D& nearPoint, double distance);

方案三ViewDesign 直接存储 BrepModel(而非 mesh),保持 B-Rep 拓扑身份一致性。

关联:VDE-023