feat(VDE-446): add BrepModel convenience query APIs
Add face_surface(), body_name(), set_body_name(), body_shell_ids(), shell_face_ids() to BrepModel class. These replace the old label/shell/surf interfaces and unblock VDE-461/462/463/464 in vd_geom.
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
| **日期** | 2026-08-04 |
|
||||
| **模块** | vde_brep — BrepModel |
|
||||
| **严重度** | 高 |
|
||||
| **状态** | 待实现 |
|
||||
| **状态** | 已修复 |
|
||||
|
||||
## 现象
|
||||
|
||||
|
||||
@@ -543,6 +543,65 @@ public:
|
||||
/** @brief 获取所有面的只读引用 */
|
||||
[[nodiscard]] const std::vector<TopoFace>& all_faces() const { return faces_; }
|
||||
|
||||
// ── VDE-446: 便捷查询 API(替代旧 label/shell/surf 接口) ──
|
||||
|
||||
/**
|
||||
* @brief 获取面的几何曲面(NURBS)
|
||||
*
|
||||
* 便捷方法,等价于 `surface(face(face_id).surface_id)`。
|
||||
* 替代旧的 `TopoFace::surf()` 接口。
|
||||
*
|
||||
* @param face_id 面 ID(数组索引)
|
||||
* @return 该面关联的 NURBS 曲面引用
|
||||
*/
|
||||
[[nodiscard]] const curves::NurbsSurface& face_surface(int face_id) const {
|
||||
return surfaces_[faces_[face_id].surface_id];
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 获取体的名称(标签)
|
||||
*
|
||||
* 替代旧的 `BrepModel::label()` 接口。
|
||||
*
|
||||
* @param body_id 体 ID(默认 0 = 第一个体)
|
||||
* @return 体名称字符串
|
||||
*/
|
||||
[[nodiscard]] const std::string& body_name(int body_id = 0) const {
|
||||
return bodies_[body_id].name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 设置体的名称(标签)
|
||||
*
|
||||
* @param body_id 体 ID
|
||||
* @param name 新名称
|
||||
*/
|
||||
void set_body_name(int body_id, const std::string& name) {
|
||||
bodies_[body_id].name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 获取体包含的壳 ID 列表
|
||||
*
|
||||
* 替代旧的 `BrepModel::shell()` 接口。
|
||||
*
|
||||
* @param body_id 体 ID(默认 0 = 第一个体)
|
||||
* @return 壳 ID 列表
|
||||
*/
|
||||
[[nodiscard]] const std::vector<int>& body_shell_ids(int body_id = 0) const {
|
||||
return bodies_[body_id].shells;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 获取壳包含的面 ID 列表
|
||||
*
|
||||
* @param shell_id 壳 ID(数组索引)
|
||||
* @return 面 ID 列表
|
||||
*/
|
||||
[[nodiscard]] const std::vector<int>& shell_face_ids(int shell_id) const {
|
||||
return shells_[shell_id].faces;
|
||||
}
|
||||
|
||||
// ── 几何/拓扑查询 ──
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user