fix(feedback): VDE-120 — resolve header conflicts mirror_body return type + PMIType duplicate enum
- Rename pattern_ops.h mirror_body → mirror_body_pattern to avoid conflicting return type (BrepModel vs DirectModelingResult) with direct_modeling.h mirror_body. - Extract PMIType enum to shared include/vde/brep/pmi_types.h, consolidating definitions from pmi_mbd.h and assembly_feature.h. - Remove stray docs/VDE-076.md (duplicate with wrong issue topic). - Create docs/feedback/VDE-120.md documenting the fix. Build verified: all targets compile cleanly.
This commit is contained in:
@@ -1,44 +0,0 @@
|
||||
# VDE-076: Header conflicts — duplicate definitions across headers
|
||||
|
||||
**Date**: 2026-07-31
|
||||
**Severity**: High (breaks compilation when both headers are included)
|
||||
**Status**: Submitted
|
||||
|
||||
## Problem
|
||||
|
||||
Two header conflicts were discovered in the VDE kernel when compiling ViewDesign:
|
||||
|
||||
### 1. `mirror_body` — conflicting return types
|
||||
|
||||
- `vde/brep/direct_modeling.h:269` declares:
|
||||
```cpp
|
||||
[[nodiscard]] DirectModelingResult mirror_body(const BrepModel& body,
|
||||
const core::Point3D& plane_origin, const core::Vector3D& plane_normal);
|
||||
```
|
||||
- `vde/brep/pattern_ops.h:114` declares:
|
||||
```cpp
|
||||
[[nodiscard]] BrepModel mirror_body(const BrepModel& body,
|
||||
const core::Point3D& center, const core::Vector3D& normal);
|
||||
```
|
||||
|
||||
Both functions have the same signature (parameters differ only in parameter names, not types) but different return types (`DirectModelingResult` vs `BrepModel`). This causes C2556/C2371 errors when both headers are included.
|
||||
|
||||
### 2. `PMIType` — duplicate enum definition
|
||||
|
||||
- `vde/brep/pmi_mbd.h:31` defines `enum class PMIType { ... }`
|
||||
- `vde/brep/assembly_feature.h:26` also defines `enum class PMIType { ... }`
|
||||
|
||||
This causes C2011 when both headers are included.
|
||||
|
||||
## Suggested Fix
|
||||
|
||||
1. **mirror_body**: Either:
|
||||
- Rename one of the functions (e.g., `pattern_ops.h` could use `mirror_body_pattern`)
|
||||
- Make them have consistent return types (e.g., both return `DirectModelingResult`)
|
||||
- Move the declaration to a single location and forward-declare
|
||||
|
||||
2. **PMIType**: Extract to a shared header (e.g., `vde/brep/pmi_types.h`) and include from both locations, or remove one of the duplicate definitions.
|
||||
|
||||
## Impact on ViewDesign
|
||||
|
||||
The `partdesign_plugin.cpp` includes both `direct_modeling.h` and `pattern_ops.h`, and both `pmi_mbd.h` and `assembly_feature.h`, triggering these conflicts. The vd_geom library works around this by not including the conflicting headers simultaneously.
|
||||
@@ -0,0 +1,44 @@
|
||||
# VDE-120: Header conflicts — duplicate definitions across headers (from VDE-076 stray)
|
||||
|
||||
**Date**: 2026-07-31
|
||||
**Severity**: High (breaks compilation when both headers are included)
|
||||
**Status**: Fixed
|
||||
|
||||
## Problem
|
||||
|
||||
Two header conflicts were discovered in the VDE kernel when compiling ViewDesign:
|
||||
|
||||
### 1. `mirror_body` — conflicting return types
|
||||
|
||||
- `vde/brep/direct_modeling.h:269`: `[[nodiscard]] DirectModelingResult mirror_body(...)`
|
||||
- `vde/brep/pattern_ops.h:114`: `[[nodiscard]] BrepModel mirror_body(...)`
|
||||
|
||||
Both functions had identical parameter signatures but different return types.
|
||||
|
||||
### 2. `PMIType` — duplicate enum definition
|
||||
|
||||
- `vde/brep/pmi_mbd.h:31`: `enum class PMIType { ... }` (10 values)
|
||||
- `vde/brep/assembly_feature.h:26`: `enum class PMIType { ... }` (6 values)
|
||||
|
||||
Caused C2011 when both headers were included.
|
||||
|
||||
## Fix Applied
|
||||
|
||||
1. **mirror_body**: Renamed `pattern_ops.h`'s `mirror_body()` → `mirror_body_pattern()`. Updated both the header and `src/brep/pattern_ops.cpp`.
|
||||
|
||||
2. **PMIType**: Extracted to shared header `include/vde/brep/pmi_types.h` containing a consolidated `enum class PMIType` with all values from both sources:
|
||||
- From pmi_mbd.h: Dimension, GDTCalloutType, DatumTarget, SurfaceFinish, Note, WeldSymbol, DatumFeature, Balloon, Custom
|
||||
- From assembly_feature.h: GeometricTol, Datum
|
||||
- Both `pmi_mbd.h` and `assembly_feature.h` now include `pmi_types.h` instead of defining their own `PMIType`.
|
||||
|
||||
## Files Changed
|
||||
|
||||
- `include/vde/brep/pmi_types.h` — **NEW**: shared PMIType enum
|
||||
- `include/vde/brep/pmi_mbd.h` — include pmi_types.h, remove local PMIType
|
||||
- `include/vde/brep/assembly_feature.h` — include pmi_types.h, remove local PMIType
|
||||
- `include/vde/brep/pattern_ops.h` — rename `mirror_body` → `mirror_body_pattern`
|
||||
- `src/brep/pattern_ops.cpp` — rename `mirror_body` → `mirror_body_pattern`
|
||||
|
||||
## Note
|
||||
|
||||
The stray file `docs/VDE-076.md` (which reported these issues) was a duplicate with a different topic than the real VDE-076. It has been deleted — this VDE-120 replaces it.
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
#include "vde/brep/brep.h"
|
||||
#include "vde/brep/assembly.h"
|
||||
#include "vde/brep/pmi_types.h"
|
||||
|
||||
namespace vde::brep {
|
||||
|
||||
@@ -22,16 +23,6 @@ void apply_assembly_feature(Assembly& assembly, const AssemblyFeatureParams& par
|
||||
// PMI (Product Manufacturing Information) 标注传播
|
||||
// ═══════════════════════════════════════════════════════════════════════════
|
||||
|
||||
/// PMI 标注类型
|
||||
enum class PMIType {
|
||||
Dimension, ///< 尺寸标注
|
||||
GeometricTol, ///< 几何公差 (GD&T)
|
||||
SurfaceFinish, ///< 表面粗糙度
|
||||
Datum, ///< 基准标识
|
||||
Note, ///< 注释
|
||||
WeldSymbol ///< 焊接符号
|
||||
};
|
||||
|
||||
/// PMI 标注数据
|
||||
struct PMIAnnotation {
|
||||
PMIType type = PMIType::Dimension;
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
*
|
||||
* ## 功能概览
|
||||
*
|
||||
* | 类别 | 操作 |
|
||||
* |-------------|---------------------------------------------------|
|
||||
* | 线性阵列 | linear_pattern(body, direction, count, spacing) |
|
||||
* | 圆形阵列 | circular_pattern(body, center, axis, count, angle)|
|
||||
* | 镜像体 | mirror_body(body, plane_point, plane_normal) |
|
||||
* | 装配布尔 | assembly_boolean(assembly, op_type) |
|
||||
* | 类别 | 操作 |
|
||||
* |-------------|---------------------------------------------------------|
|
||||
* | 线性阵列 | linear_pattern(body, direction, count, spacing) |
|
||||
* | 圆形阵列 | circular_pattern(body, center, axis, count, angle) |
|
||||
* | 镜像体 | mirror_body_pattern(body, plane_point, plane_normal) |
|
||||
* | 装配布尔 | assembly_boolean(assembly, op_type) |
|
||||
*
|
||||
* ## 使用模式
|
||||
*
|
||||
@@ -24,7 +24,7 @@
|
||||
* // 圆形阵列:绕 Z 轴 8 个副本,总角度 360°
|
||||
* auto circle = brep::circular_pattern(body, Point3D::Zero(), Vector3D::UnitZ(), 8, 360.0);
|
||||
* // 镜像体
|
||||
* auto mirrored = brep::mirror_body(body, Point3D(0,0,0), Vector3D::UnitX());
|
||||
* auto mirrored = brep::mirror_body_pattern(body, Point3D(0,0,0), Vector3D::UnitX());
|
||||
* @endcode
|
||||
*
|
||||
* @ingroup brep
|
||||
@@ -108,10 +108,10 @@ enum class AssemblyBoolOp {
|
||||
*
|
||||
* @code{.cpp}
|
||||
* auto box = make_box(2, 2, 2);
|
||||
* auto mirrored = mirror_body(box, Point3D(0,0,0), Vector3D::UnitX());
|
||||
* auto mirrored = mirror_body_pattern(box, Point3D(0,0,0), Vector3D::UnitX());
|
||||
* @endcode
|
||||
*/
|
||||
[[nodiscard]] BrepModel mirror_body(const BrepModel& body,
|
||||
[[nodiscard]] BrepModel mirror_body_pattern(const BrepModel& body,
|
||||
const Point3D& plane_point, const Vector3D& plane_normal);
|
||||
|
||||
// ═══════════════════════════════════════════════
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "vde/brep/brep.h"
|
||||
#include "vde/brep/gdt.h"
|
||||
#include "vde/brep/auto_dimensioning.h"
|
||||
#include "vde/brep/pmi_types.h"
|
||||
#include "vde/core/point.h"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
@@ -27,19 +28,6 @@ namespace vde::brep {
|
||||
// PMI Annotation Types
|
||||
// ═══════════════════════════════════════════════════════════
|
||||
|
||||
/// PMI annotation category
|
||||
enum class PMIType {
|
||||
Dimension, ///< Linear/angular/radial dimension
|
||||
GDTCalloutType, ///< Geometric dimensioning & tolerancing
|
||||
DatumTarget, ///< Datum target symbol
|
||||
SurfaceFinish, ///< Surface finish / roughness
|
||||
Note, ///< General note / text
|
||||
WeldSymbol, ///< Welding symbol
|
||||
DatumFeature, ///< Datum feature identifier
|
||||
Balloon, ///< Balloon callout (for BOM)
|
||||
Custom, ///< Custom annotation
|
||||
};
|
||||
|
||||
/// PMI annotation display properties
|
||||
struct PMIDisplayProps {
|
||||
bool visible = true; ///< Visibility toggle
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
/**
|
||||
* @file pmi_types.h
|
||||
* @brief Shared PMI types — consolidated from pmi_mbd.h and assembly_feature.h
|
||||
*
|
||||
* Fixes VDE-076 duplicate enum: both pmi_mbd.h and assembly_feature.h
|
||||
* independently defined `enum class PMIType`, triggering C2011 when
|
||||
* both headers are included in the same translation unit.
|
||||
*
|
||||
* @ingroup brep
|
||||
*/
|
||||
|
||||
namespace vde::brep {
|
||||
|
||||
/// PMI (Product Manufacturing Information) annotation category
|
||||
enum class PMIType {
|
||||
// ── Primary dimension / annotation types ──
|
||||
Dimension, ///< Linear/angular/radial dimension
|
||||
GDTCalloutType, ///< Geometric dimensioning & tolerancing (pmi_mbd.h)
|
||||
DatumTarget, ///< Datum target symbol
|
||||
SurfaceFinish, ///< Surface finish / roughness
|
||||
Note, ///< General note / text
|
||||
WeldSymbol, ///< Welding symbol
|
||||
DatumFeature, ///< Datum feature identifier
|
||||
Balloon, ///< Balloon callout (for BOM)
|
||||
Custom, ///< Custom annotation
|
||||
|
||||
// ── Extended types from assembly_feature.h ──
|
||||
GeometricTol, ///< Geometric tolerance / GD&T (assembly_feature.h)
|
||||
Datum, ///< Datum identifier (assembly_feature.h)
|
||||
};
|
||||
|
||||
} // namespace vde::brep
|
||||
@@ -172,10 +172,10 @@ BrepModel circular_pattern(const BrepModel& body,
|
||||
}
|
||||
|
||||
// ═══════════════════════════════════════════════
|
||||
// mirror_body
|
||||
// mirror_body_pattern
|
||||
// ═══════════════════════════════════════════════
|
||||
|
||||
BrepModel mirror_body(const BrepModel& body,
|
||||
BrepModel mirror_body_pattern(const BrepModel& body,
|
||||
const Point3D& plane_point,
|
||||
const Vector3D& plane_normal) {
|
||||
Transform3D T = mirror_transform(plane_point, plane_normal);
|
||||
|
||||
Reference in New Issue
Block a user