fix: VDE-028~030 compile warnings — close all ViewDesign feedback issues
Build & Test / build-and-test (push) Waiting to run
Build & Test / python-bindings (push) Blocked by required conditions
CI / Build & Test (push) Failing after 16m56s
CI / Release Build (push) Failing after 30s

VDE-028 (step_export.cpp):
  - Remove unused
  - Fix 4x misleading-indentation in write_bspline_surface loops

VDE-029 (class_a_surfacing.cpp):
  - Initialize Vector3D move = Vector3D::Zero() (2 occurrences)

VDE-030 (industrial_formats.cpp):
  - Remove unused brep_version read, fix pos_ offset
  - Fix misleading-indentation: split one-liner if-statements

All 30 VDE issues now resolved (30/30).
This commit is contained in:
茂之钳
2026-07-28 21:24:27 +08:00
parent 1b8f174e04
commit 93ca49cb4f
7 changed files with 150 additions and 17 deletions
+24 -6
View File
@@ -4,7 +4,7 @@ status: resolved
severity: medium
category: analysis
date: 2026-07-27
updated: 2026-07-28 (Batch 9: vd_core_linetypes + styles + units + undo + annotscale)
updated: 2026-07-28 (Batch 11: VDE-028~030 编译警告已修复 — 全部 30 个 VDE Issue 已解决)
reporter: ViewDesign
---
@@ -60,9 +60,18 @@ reporter: ViewDesign
| vd_core_undo (undo_manager) | 几何快照估算: estimateShapeSnapshotSize + estimateMaxShapeOperations | ✅ 已构建 |
| vd_core_annotscale (annotation_scale_manager) | 注释比例匹配: recommendScaleForShape + estimateViewportScale | ✅ 已构建 |
### Batch 11: vd_geom 核心能力扩展 (2026-07-28)
| 能力 | API | 底层 VDE 接口 | 状态 |
|------|-----|-------------|:--:|
| 特征识别 | recognizeFeatures | vde::brep::recognize_features | ✅ 已构建 |
| 去特征化 | defeature / removeHoles / removeFillets / simplifyForMeshing | vde::brep::defeature / remove_holes / remove_fillets / simplify_for_meshing | ✅ 已构建 |
| 直接建模 | tweakFace / pushPull / offsetFace / scaleBody / mirrorBody / draftFace | vde::brep::tweak_face / push_pull / offset_face / scale_body / mirror_body / draft_face | ✅ 已构建 |
| 高级过渡曲面 | variableRadiusBlend / multiFaceBlend / rollingBallBlend | vde::brep::variable_radius_blend / multi_face_blend / rolling_ball_blend | ✅ 已构建 |
### 反馈闭环验证
VDE-019~026 全部 Fixed。v1.0.1 更新修复了 make_box/cylinder/sphere 位置偏移、make_cone/torus、mesh→profile、edge/face ID 一致性、contour 提取、Assembly 批量构建、BVH 索引查询。良性迭代机制运转良好。
VDE-001~030 全部 Fixed。v1.0.1 更新修复了 make_box/cylinder/sphere 位置偏移、make_cone/torus、mesh→profile、edge/face ID 一致性、contour 提取、Assembly 批量构建、BVH 索引查询。VDE-028~030 编译代码整洁度警告(step_export / class_a_surfacing / industrial_formats)已修复。良性迭代机制运转良好。
### 累计集成模块: 83 个 ViewDesign 模块已通过 vd_geom 间接使用 VDE
@@ -98,6 +107,14 @@ VDE 团队快速响应了反馈,v1.0.1+ 更新修复了 7 个问题,引入
|------|------|:--:|
| VDE-027 | face_centroid 作用域错误 | 已修复 (v1.0.3) |
### 待修复(0 个)— 全部已修复
| 问题 | 内容 | 严重度 | 状态 |
|------|------|:--:|:--:|
| VDE-028 | step_export.cpp 误导缩进 + 未使用变量 | Low | Fixed |
| VDE-029 | class_a_surfacing.cpp Vector3D move 可能未初始化 | Low | Fixed |
| VDE-030 | industrial_formats.cpp 误导缩进 + 未使用变量 | Low | Fixed |
### 当前可用模块(10/10
```
@@ -128,9 +145,10 @@ vde_capi ✓
### 后续重点关注
所有已知问题已全部修复。后续关注:
1. 在 ViewDesign 端进行回归测试,验证 VDE-019~026 的全部修复
2. 持续监控 ViewDesign 构建集成,确保无新增编译错误
1. ~~VDE-028~030:编译时代码整洁度警告~~ — ✅ 已全部修复
2. 在 ViewDesign 端进行回归测试,验证 Batch 11 新增的 VDE 核心能力(特征识别、去特征化、直接建模、高级过渡曲面)
3. 持续监控 ViewDesign 构建集成,确保无新增编译错误
4. 下一批目标:vd_drawing、vd_core_layers、vd_core_smart_fasteners、vd_industry_mep 等 50+ 个未集成模块
---
@@ -151,7 +169,7 @@ vde_capi ✓
## ViewDesign 的战略路径
```
当前: 27/27 问题已修复 / 10/10 模块可用 / 全面 VDE
当前: 30/30 问题已修复 / 10/10 模块可用 / 全面 VDE
近期: 在 ViewDesign 中验证 VDE-019~026 修复效果
远期: 全面 VDE / OCCT 逐步移除
```
+41
View File
@@ -0,0 +1,41 @@
---
id: VDE-028
status: fixed
severity: low
category: code-quality
date: 2026-07-28
reporter: ViewDesign
---
# VDE-028: step_export.cpp 误导缩进警告 + 未使用变量
## 描述
在 ViewDesign MSVC 构建中,`vde_brep``step_export.cpp` 产生多个编译警告:
1. **`-Wmisleading-indentation`** (4处)`write_bspline_surface` 函数中 `if` 语句和后续语句在同一行,误导缩进
- 行 276: `if (i > 0) ss << ","; ss << um[i];`
- 行 280: `if (i > 0) ss << ","; ss << vm[i];`
- 行 284: `if (i > 0) ss << ","; ss << uu[i];`
- 行 288: `if (i > 0) ss << ","; ss << vuu[i];`
2. **`-Wunused-variable`** (1处):行 233 `auto& w = surf.weights();` 声明后未使用
## 复现步骤
```
cmake --build build --config Release --target vde_brep
```
## 影响
- 仅影响代码整洁度,不影响功能正确性
- 大量警告可能掩盖真正的错误
## 修复建议
1. 误导缩进:将同一行的两个语句拆分为多行带大括号
```cpp
if (i > 0) { ss << ","; }
ss << um[i];
```
2. 未使用变量:删除 `auto& w = surf.weights();`,或添加 `(void)w;`
## 相关文件
- `src/brep/step_export.cpp:233,276,280,284,288`
+34
View File
@@ -0,0 +1,34 @@
---
id: VDE-029
status: fixed
severity: low
category: code-quality
date: 2026-07-28
reporter: ViewDesign
---
# VDE-029: class_a_surfacing.cpp `move` 变量可能未初始化
## 描述
在 ViewDesign MSVC 构建中,`vde_curves``class_a_surfacing.cpp` 产生 `-Wmaybe-uninitialized` 警告:
- 行 1443: `Vector3D move;` 声明但未被初始化
- 行 1445: 在 `curvature_continuity_optimization` 函数中使用 `move` 参与运算,编译器分析认为该变量部分路径可能未赋值
## 复现步骤
```
cmake --build build --config Release --target vde_curves
```
## 影响
- 代码整洁度问题,在实际执行路径中可能已被正确赋值
- 大量 Eigen 模板内联展开导致警告信息冗长
## 修复建议
将声明改为带默认初始化:
```cpp
Vector3D move = Vector3D::Zero();
```
## 相关文件
- `src/curves/class_a_surfacing.cpp:1443,1445`
+36
View File
@@ -0,0 +1,36 @@
---
id: VDE-030
status: fixed
severity: low
category: code-quality
date: 2026-07-28
reporter: ViewDesign
---
# VDE-030: industrial_formats.cpp 误导缩进 + 未使用变量
## 描述
在 ViewDesign MSVC 构建中,`vde_foundation``industrial_formats.cpp` 产生编译警告:
1. **`-Wunused-variable`**:行 189 `uint32_t brep_version = read_u32_le(p + pos_);` 变量未使用
2. **`-Wmisleading-indentation`**:行 1585 `if (v0 < 0) v0 = 0; if (v1 < 0) v1 = 0;` 两个 `if` 在同一行
## 复现步骤
```
cmake --build build --config Release --target vde_foundation
```
## 影响
- 仅影响代码整洁度
## 修复建议
1. 未使用变量:删除 `brep_version`,或添加 `(void)brep_version;`
2. 误导缩进:拆分为两行带大括号
```cpp
if (v0 < 0) { v0 = 0; }
if (v1 < 0) { v1 = 0; }
```
## 相关文件
- `src/foundation/industrial_formats.cpp:189,1585`
+8 -5
View File
@@ -230,7 +230,6 @@ struct StepWriter {
int write_bspline_surface(const curves::NurbsSurface& surf) {
auto& cp = surf.control_points();
auto& w = surf.weights();
int du = surf.degree_u(), dv = surf.degree_v();
const auto& ku = surf.knots_u();
const auto& kv = surf.knots_v();
@@ -273,19 +272,23 @@ struct StepWriter {
auto [vm, vuu] = compute_mults(kv);
for (size_t i = 0; i < um.size(); ++i) {
if (i > 0) ss << ","; ss << um[i];
if (i > 0) { ss << ","; }
ss << um[i];
}
ss << "),(";
for (size_t i = 0; i < vm.size(); ++i) {
if (i > 0) ss << ","; ss << vm[i];
if (i > 0) { ss << ","; }
ss << vm[i];
}
ss << "),(";
for (size_t i = 0; i < uu.size(); ++i) {
if (i > 0) ss << ","; ss << uu[i];
if (i > 0) { ss << ","; }
ss << uu[i];
}
ss << "),(";
for (size_t i = 0; i < vuu.size(); ++i) {
if (i > 0) ss << ","; ss << vuu[i];
if (i > 0) { ss << ","; }
ss << vuu[i];
}
ss << "),.UNSPECIFIED.);\n";
return cpts_list_id;
+2 -2
View File
@@ -1440,7 +1440,7 @@ CurvatureContinuityResult curvature_continuity_optimization(
int row_idx = std::min(N, std::max(0, static_cast<int>(i * (nv - 1) / N)));
for (int k = 0; k < nu; ++k) {
double w_ij = 1.0 / (1.0 + std::abs(k - border_col));
Vector3D move;
Vector3D move = Vector3D::Zero();
if (g0_dist > options.position_tolerance) {
move = move + g0_delta * step * w_ij;
}
@@ -1459,7 +1459,7 @@ CurvatureContinuityResult curvature_continuity_optimization(
int col_idx = std::min(N, std::max(0, static_cast<int>(i * (nu - 1) / N)));
for (int k = 0; k < nv; ++k) {
double w_ij = 1.0 / (1.0 + std::abs(k - border_row));
Vector3D move;
Vector3D move = Vector3D::Zero();
if (g0_dist > options.position_tolerance) {
move = move + g0_delta * step * w_ij;
}
+5 -4
View File
@@ -186,9 +186,9 @@ private:
JTBrepData bd;
const uint8_t* p = reinterpret_cast<const uint8_t*>(data_.data());
// B-Rep 段结构:header(8) + XT data
uint32_t brep_version = read_u32_le(p + pos_);
uint32_t brep_length = read_u32_le(p + pos_ + 4);
pos_ += 8;
pos_ += 4; // skip brep_version — reserved, unused
uint32_t brep_length = read_u32_le(p + pos_);
pos_ += 4;
bd.xt_data.assign(p + pos_, p + pos_ + brep_length);
pos_ += brep_length;
return bd;
@@ -1582,7 +1582,8 @@ BrepModel import_acis_sab(const std::string& data) {
for (uint32_t i = 0; i + 1 < int_count; i += 2) {
int v0 = int_table[i] % static_cast<int>(verts.size());
int v1 = int_table[i+1] % static_cast<int>(verts.size());
if (v0 < 0) v0 = 0; if (v1 < 0) v1 = 0;
if (v0 < 0) { v0 = 0; }
if (v1 < 0) { v1 = 0; }
if (v0 == v1) continue;
auto key = std::make_pair(std::min(v0, v1), std::max(v0, v1));
if (ecache.find(key) == ecache.end()) {