Files
茂之钳 2a5a84670c
Build & Test / build-and-test (push) Waiting to run
Build & Test / python-bindings (push) Blocked by required conditions
CI / Build & Test (push) Failing after 37s
CI / Release Build (push) Failing after 31s
fix(feedback): properly close **Status** bold markdown in VDE-021/023/024/053/054
Commit 92f13b6 added trailing ** but left the opening ** unclosed after the
Status label, producing **Status**: Fixed** instead of **Status**: Fixed.
2026-07-29 11:36:47 +08:00

1.7 KiB
Raw Permalink 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);