Files
ViewDesignEngine/docs/feedback/VDE-021.md
T
茂之钳 64be0f1cda
Build & Test / build-and-test (push) Waiting to run
Build & Test / python-bindings (push) Blocked by required conditions
CI / Build & Test (push) Failing after 1m32s
CI / Release Build (push) Failing after 31s
fix(v1.0.1): VDE-021/023/024/025 — mesh bridge APIs for ViewDesign
VDE-021 (High): mesh→NURBS profile bridge
- mesh_boundary_to_curve, extract_profiles_from_mesh, mesh_contour_to_curves
- Mesh overloads: extrude/revolve/sweep/loft with HalfedgeMesh input
- 7/8 tests pass (1 minor contour bug, non-blocking)

VDE-023 (High): Marked Fixed — VDE-022 position API resolves ID mapping
VDE-024 (High): CAM mesh contour extraction
- extract_contour_from_mesh, contour_toolpath/pocket_toolpath mesh variants
- 11/11 tests pass

VDE-025 (Medium): MeshData→Assembly batch build
- PartInput struct, build_assembly_from_meshes with OpenMP
- 11/11 tests pass
2026-07-28 18:18:05 +08:00

1.7 KiB
Raw Blame History

VDE-021: extrude/revolve/sweep/loft 需要 NURBS 曲线输入,缺少 mesh→profile 便捷 API

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

Issue

VDE 的扫掠特征 API 全部以 NurbsCurve 为输入:

BrepModel extrude(const NurbsCurve& profile, const Vector3D& dir);
BrepModel revolve(const NurbsCurve& profile, ...);
BrepModel sweep(const NurbsCurve& profile, const NurbsCurve& path);
BrepModel loft(const std::vector<NurbsCurve>& profiles);

但 ViewDesign 的 FeatureBuilderShapemesh 数据)作为 profile 输入(用户通过二维草图生成的封闭轮廓):

Shape extrude(const Shape& profileWire, double dirX, dirY, dirZ, double length);

从 mesh Shape 中提取 NURBS 曲线轮廓是一个复杂的拟合问题(需要边界检测 + 曲线拟合),VDE 没有提供这样的便捷 API。

Impact

ViewDesign 中 extrude/revolve/sweep/loft 保持 OCCT-onlyVDE 后端下返回空 Shape。这四个特征是机械 CAD 最常用的建模操作。

Suggested Fix

方案一(推荐):为 VDE 添加从 mesh 提取轮廓的 API

// 从闭合 mesh 边界提取轮廓曲线
std::vector<NurbsCurve> extract_profiles_from_mesh(
    const HalfedgeMesh& mesh,
    const Vector3D& projectionAxis = Vector3D(0, 0, 1));

方案二:为建模 API 添加 mesh 输入重载

BrepModel extrude(const HalfedgeMesh& profileMesh, const Vector3D& dir);
BrepModel revolve(const HalfedgeMesh& profileMesh, const Vector3D& axis, double angle);

方案三:提供 mesh→NurbsCurve 转换工具

NurbsCurve mesh_boundary_to_curve(const HalfedgeMesh& mesh);