VDE-618~622: Batch 288-292 feedback - ResultsPost, CAMOpMgr, MaterialDB, FormatConverter, ImportDiagnostics
This commit is contained in:
@@ -0,0 +1,117 @@
|
||||
# VDE-618: CAE Results Post-Processing — 仿真结果后处理 API
|
||||
|
||||
**来源**: Batch 288 — Results Post-Processing Panel (F534)
|
||||
**优先级**: High
|
||||
**日期**: 2026-08-07
|
||||
|
||||
## 背景
|
||||
|
||||
F534 结果后处理面板需要从 CAE 求解结果中提取场数据(位移、应力、应变、温度等),并在网格节点/单元级别进行插值、可视化。当前 VDE 缺失 CAE 结果数据结构和查询 API。
|
||||
|
||||
## API 建议
|
||||
|
||||
```cpp
|
||||
namespace vd::cae {
|
||||
|
||||
// ============================================================
|
||||
// Result field types
|
||||
// ============================================================
|
||||
enum class ResultFieldType {
|
||||
Displacement, // 位移 (vector)
|
||||
Stress, // 应力 (tensor, von Mises/principal)
|
||||
Strain, // 应变 (tensor)
|
||||
Temperature, // 温度 (scalar)
|
||||
SafetyFactor, // 安全系数 (scalar)
|
||||
ReactionForce, // 反应力 (vector)
|
||||
StrainEnergy, // 应变能 (scalar)
|
||||
ContactPressure, // 接触压力 (scalar)
|
||||
FatigueLife, // 疲劳寿命 (scalar)
|
||||
Damage, // 损伤 (scalar)
|
||||
};
|
||||
|
||||
enum class ResultComponent {
|
||||
Scalar,
|
||||
X, Y, Z, // vector components
|
||||
XX, YY, ZZ, // tensor normal components
|
||||
XY, YZ, ZX, // tensor shear components
|
||||
VonMises, // von Mises equivalent
|
||||
Principal1, Principal2, Principal3, // principal values
|
||||
Magnitude,
|
||||
};
|
||||
|
||||
// ============================================================
|
||||
// Result value at a node/element
|
||||
// ============================================================
|
||||
struct ResultValue {
|
||||
double value;
|
||||
ResultComponent component;
|
||||
bool isValid;
|
||||
};
|
||||
|
||||
// ============================================================
|
||||
// Result dataset (one per load case / step)
|
||||
// ============================================================
|
||||
struct ResultDataSet {
|
||||
std::string name; // e.g. "Load Case 1: Static"
|
||||
ResultFieldType fieldType;
|
||||
int stepIndex;
|
||||
double timeValue; // for transient analysis
|
||||
std::vector<ResultValue> nodeResults; // indexed by nodeId
|
||||
std::vector<ResultValue> elementResults; // indexed by elementId
|
||||
};
|
||||
|
||||
// ============================================================
|
||||
// Results Manager API
|
||||
// ============================================================
|
||||
class ResultsManager {
|
||||
public:
|
||||
// Load results from solver output file
|
||||
bool loadResults(const std::string& filePath, const std::string& format);
|
||||
|
||||
// Query available result fields and steps
|
||||
std::vector<ResultFieldType> availableFields() const;
|
||||
std::vector<ResultDataSet> dataSets(ResultFieldType field) const;
|
||||
|
||||
// Get result at a specific node or element
|
||||
ResultValue nodeResult(int nodeId, ResultFieldType field, int stepIndex) const;
|
||||
ResultValue elementResult(int elemId, ResultFieldType field, int stepIndex) const;
|
||||
|
||||
// Min/max over entire model
|
||||
double minValue(ResultFieldType field, int stepIndex) const;
|
||||
double maxValue(ResultFieldType field, int stepIndex) const;
|
||||
int minLocationNode(ResultFieldType field, int stepIndex) const;
|
||||
int maxLocationNode(ResultFieldType field, int stepIndex) const;
|
||||
|
||||
// Probe result at a 3D point (interpolation)
|
||||
ResultValue probeResult(const Point3d& pt, ResultFieldType field, int stepIndex) const;
|
||||
|
||||
// Export results for visualization
|
||||
bool exportToVTK(const std::string& filePath, ResultFieldType field, int stepIndex) const;
|
||||
|
||||
// Clear loaded results
|
||||
void clear();
|
||||
};
|
||||
|
||||
} // namespace vd::cae
|
||||
```
|
||||
|
||||
## 对标参考
|
||||
|
||||
- **ANSYS Mechanical**: `/POST1` 后处理器,支持节点/单元结果查询、路径绘制、等值面
|
||||
- **Abaqus/CAE**: Visualization module,ODB 结果数据库,XY 曲线
|
||||
- **SolidWorks Simulation**: Result plots (stress/displacement/strain/fatigue/FOS)
|
||||
|
||||
## 验收标准
|
||||
|
||||
1. 支持至少 9 种结果字段类型
|
||||
2. 节点级和单元级结果查询
|
||||
3. 3D 空间点插值探测 (probe)
|
||||
4. 全场 min/max 及位置查询
|
||||
5. VTK 格式导出用于外部可视化
|
||||
|
||||
## 影响面板
|
||||
|
||||
- `vd_results_post_panel` (F534) — 主要消费方
|
||||
- `vd_cae_explicit_panel` (F415) — 显式动力学结果
|
||||
- `vd_cae_fatigue_panel` (F416) — 疲劳结果
|
||||
- `vd_cae_nonlinear_panel` (F414) — 非线性结果
|
||||
@@ -0,0 +1,170 @@
|
||||
# VDE-619: CAM Operation Manager — CAM 加工操作管理 API
|
||||
|
||||
**来源**: Batch 289 — CAM Operation Manager Panel (F508)
|
||||
**优先级**: High
|
||||
**日期**: 2026-08-07
|
||||
|
||||
## 背景
|
||||
|
||||
F508 CAM 操作管理器面板需要管理加工操作的定义、刀具路径生成和工序编排。当前 VDE 缺失 CAM 相关的数据结构和刀具路径生成 API。
|
||||
|
||||
## API 建议
|
||||
|
||||
```cpp
|
||||
namespace vd::cam {
|
||||
|
||||
// ============================================================
|
||||
// Tool definition
|
||||
// ============================================================
|
||||
struct CAMTool {
|
||||
enum class Type {
|
||||
EndMill, BallMill, FaceMill, Drill,
|
||||
Tap, Reamer, ChamferMill, ThreadMill
|
||||
};
|
||||
|
||||
std::string name;
|
||||
Type type;
|
||||
double diameter_mm;
|
||||
double cornerRadius_mm;
|
||||
double fluteLength_mm;
|
||||
double overallLength_mm;
|
||||
int numFlutes;
|
||||
double shankDiameter_mm;
|
||||
std::string material; // HSS, Carbide, CBN, etc.
|
||||
std::string coating;
|
||||
};
|
||||
|
||||
// ============================================================
|
||||
// Machining operation
|
||||
// ============================================================
|
||||
struct CAMOperation {
|
||||
enum class Type {
|
||||
Drilling, // 钻孔
|
||||
FaceMilling, // 面铣
|
||||
ProfileMilling, // 轮廓铣
|
||||
PocketMilling, // 槽铣
|
||||
Roughing, // 粗加工
|
||||
Finishing, // 精加工
|
||||
Contouring, // 轮廓加工
|
||||
Engraving, // 雕刻
|
||||
Tapping, // 攻丝
|
||||
Boring, // 镗孔
|
||||
Reaming, // 铰孔
|
||||
Chamfering, // 倒角
|
||||
ThreadMilling, // 螺纹铣
|
||||
SlotMilling, // 槽铣
|
||||
PlungeMilling, // 插铣
|
||||
AdaptiveRoughing, // 自适应粗加工
|
||||
RestMachining, // 残料加工
|
||||
};
|
||||
|
||||
std::string name;
|
||||
Type type;
|
||||
CAMTool tool;
|
||||
|
||||
// Cutting parameters
|
||||
double spindleSpeed_rpm;
|
||||
double feedRate_mmPerMin;
|
||||
double plungeRate_mmPerMin;
|
||||
double stepOver_mm;
|
||||
double stepDown_mm;
|
||||
double stockToLeave_mm;
|
||||
double tolerance_mm;
|
||||
|
||||
// Coolant
|
||||
enum class CoolantMode { Off, Flood, Mist, ThroughTool };
|
||||
CoolantMode coolant;
|
||||
};
|
||||
|
||||
// ============================================================
|
||||
// Machining setup (workpiece + fixtures)
|
||||
// ============================================================
|
||||
struct CAMSetup {
|
||||
std::string name;
|
||||
std::string stockDefinition; // stock body ID
|
||||
std::string machineDefinition; // machine tool ID
|
||||
Point3d workOffset; // G54 offset
|
||||
Matrix4x4 workCoordinateSystem;
|
||||
std::vector<std::string> fixtureBodies;
|
||||
};
|
||||
|
||||
// ============================================================
|
||||
// Toolpath (generated by CAM engine)
|
||||
// ============================================================
|
||||
struct ToolpathPoint {
|
||||
Point3d position;
|
||||
Vector3d toolAxis; // for 5-axis
|
||||
double feedRate; // overridable per point
|
||||
};
|
||||
|
||||
struct ToolpathSegment {
|
||||
enum class MoveType { Rapid, Linear, Circular, Helical };
|
||||
|
||||
MoveType type;
|
||||
std::vector<ToolpathPoint> points;
|
||||
double arcCenterX_mm; // for circular moves
|
||||
double arcCenterY_mm;
|
||||
};
|
||||
|
||||
struct Toolpath {
|
||||
std::string operationName;
|
||||
std::vector<ToolpathSegment> segments;
|
||||
double totalLength_mm;
|
||||
double estimatedTime_sec;
|
||||
BoundingBox bounds;
|
||||
};
|
||||
|
||||
// ============================================================
|
||||
// CAM Manager API
|
||||
// ============================================================
|
||||
class CAMManager {
|
||||
public:
|
||||
// Tool library
|
||||
bool addTool(const CAMTool& tool);
|
||||
bool removeTool(const std::string& toolName);
|
||||
CAMTool getTool(const std::string& toolName) const;
|
||||
std::vector<CAMTool> listTools(CAMTool::Type filter = CAMTool::Type::EndMill) const;
|
||||
|
||||
// Operation management
|
||||
std::string createOperation(const CAMOperation& op);
|
||||
bool updateOperation(const std::string& id, const CAMOperation& op);
|
||||
bool deleteOperation(const std::string& id);
|
||||
CAMOperation getOperation(const std::string& id) const;
|
||||
std::vector<CAMOperation> listOperations() const;
|
||||
|
||||
// Setup management
|
||||
bool createSetup(const CAMSetup& setup);
|
||||
CAMSetup getSetup(const std::string& name) const;
|
||||
|
||||
// Toolpath generation (core engine)
|
||||
Toolpath generateToolpath(const std::string& operationId);
|
||||
bool validateToolpath(const Toolpath& tp); // collision check
|
||||
bool simulateToolpath(const Toolpath& tp); // material removal sim
|
||||
|
||||
// Post-processing
|
||||
std::string generateGCode(const Toolpath& tp, const std::string& postProcessor);
|
||||
};
|
||||
|
||||
} // namespace vd::cam
|
||||
```
|
||||
|
||||
## 对标参考
|
||||
|
||||
- **SolidWorks CAM**: 基于 CAMWorks 内核,特征识别 + 刀具路径 + G-code
|
||||
- **Fusion 360 Manufacturing**: Adaptive clearing, 3+2/5-axis, tool library
|
||||
- **Mastercam**: 完整 2D-5X 加工策略库
|
||||
|
||||
## 验收标准
|
||||
|
||||
1. 8 种刀具类型管理(CRUD)
|
||||
2. 17 种加工操作类型定义
|
||||
3. 刀具路径生成(直线/圆弧/螺旋)
|
||||
4. 碰撞检测验证
|
||||
5. G-code 后处理输出
|
||||
|
||||
## 影响面板
|
||||
|
||||
- `vd_cam_op_mgr_panel` (F508) — CAM 操作管理器
|
||||
- `vd_cam_3axis_enhanced` (F425) — 3 轴增强 CAM
|
||||
- `vd_cam_5axis_enhanced` (F426) — 5 轴增强 CAM
|
||||
- `vd_mill_turn` (F427) — 车铣复合
|
||||
@@ -0,0 +1,137 @@
|
||||
# VDE-620: Material Database — 材料数据库与属性查询 API
|
||||
|
||||
**来源**: Batch 290 — Material Database Panel (F524)
|
||||
**优先级**: Medium
|
||||
**日期**: 2026-08-07
|
||||
|
||||
## 背景
|
||||
|
||||
F524 材料数据库面板需要管理工程材料及其力学、热学、物理属性。当前 VDE 没有统一的材料属性 API,各模块独立管理材料数据。建议 VDE 提供集中的材料数据库接口,供 CAE、CAD、CAM 模块共享。
|
||||
|
||||
## API 建议
|
||||
|
||||
```cpp
|
||||
namespace vd::material {
|
||||
|
||||
// ============================================================
|
||||
// Material categories
|
||||
// ============================================================
|
||||
enum class MaterialCategory {
|
||||
Steel, // 钢
|
||||
StainlessSteel, // 不锈钢
|
||||
Aluminum, // 铝合金
|
||||
Titanium, // 钛合金
|
||||
Copper, // 铜合金
|
||||
Plastic, // 塑料
|
||||
Composite, // 复合材料
|
||||
Ceramic, // 陶瓷
|
||||
Wood, // 木材
|
||||
Other,
|
||||
};
|
||||
|
||||
// ============================================================
|
||||
// Material properties structure
|
||||
// ============================================================
|
||||
struct MaterialProperties {
|
||||
// Physical
|
||||
double density_kgPerM3;
|
||||
double meltingPoint_C;
|
||||
double thermalConductivity_WPerMK;
|
||||
double specificHeat_JPerKgK;
|
||||
double thermalExpansion_1PerK;
|
||||
double electricalResistivity_ohmM;
|
||||
bool magnetic;
|
||||
|
||||
// Mechanical (elastic)
|
||||
double elasticModulus_GPa;
|
||||
double shearModulus_GPa;
|
||||
double poissonRatio;
|
||||
double yieldStrength_MPa;
|
||||
double ultimateStrength_MPa;
|
||||
double elongation_Percent;
|
||||
double hardness_HB;
|
||||
|
||||
// Thermal
|
||||
double maxServiceTemp_C;
|
||||
|
||||
// Cost
|
||||
double costPerKg_USD;
|
||||
};
|
||||
|
||||
// ============================================================
|
||||
// Material definition
|
||||
// ============================================================
|
||||
struct Material {
|
||||
std::string id;
|
||||
std::string name;
|
||||
std::string designation; // e.g. "AISI 304", "Al 6061-T6"
|
||||
MaterialCategory category;
|
||||
std::string standard; // ISO, DIN, ASTM, JIS, GB
|
||||
MaterialProperties properties;
|
||||
|
||||
// Visual (PBR)
|
||||
ColorRGB baseColor;
|
||||
double metallic;
|
||||
double roughness;
|
||||
std::string texturePath;
|
||||
|
||||
// Source / reference
|
||||
std::string source; // library origin
|
||||
std::string description;
|
||||
};
|
||||
|
||||
// ============================================================
|
||||
// Material Library API
|
||||
// ============================================================
|
||||
class MaterialLibrary {
|
||||
public:
|
||||
// CRUD
|
||||
bool addMaterial(const Material& mat);
|
||||
bool removeMaterial(const std::string& id);
|
||||
bool updateMaterial(const std::string& id, const Material& mat);
|
||||
Material getMaterial(const std::string& id) const;
|
||||
|
||||
// Query
|
||||
std::vector<Material> search(const std::string& query) const;
|
||||
std::vector<Material> filterByCategory(MaterialCategory cat) const;
|
||||
std::vector<Material> filterByStandard(const std::string& standard) const;
|
||||
std::vector<Material> listAll() const;
|
||||
|
||||
// Bulk import/export
|
||||
bool importLibrary(const std::string& filePath); // JSON/XML
|
||||
bool exportLibrary(const std::string& filePath) const;
|
||||
|
||||
// Default libraries
|
||||
bool loadBuiltIn(const std::string& standard); // ISO/DIN/ASTM
|
||||
std::vector<std::string> availableStandards() const;
|
||||
|
||||
// Material comparison / selection
|
||||
std::vector<Material> ashbySelection(
|
||||
double minDensity, double maxDensity,
|
||||
double minModulus, double maxModulus,
|
||||
double minStrength, double maxStrength) const;
|
||||
};
|
||||
|
||||
} // namespace vd::material
|
||||
```
|
||||
|
||||
## 对标参考
|
||||
|
||||
- **SolidWorks Material Library**: 内置 ANSI/ASTM/ISO/DIN/JIS 材料库,自定义材料
|
||||
- **ANSYS Granta / CES EduPack**: Ashby 材料选择图表,完整材料数据库
|
||||
- **Abaqus Material Library**: 线弹性/超弹性/塑性/粘弹性材料模型
|
||||
|
||||
## 验收标准
|
||||
|
||||
1. 10 种材料类别支持
|
||||
2. 至少 13 物理属性 + 6 力学 + 5 热学属性
|
||||
3. ISO/DIN/ASTM 内置材料库
|
||||
4. Ashby 材料选择(密度/模量/强度范围)
|
||||
5. JSON 导入导出
|
||||
|
||||
## 影响面板
|
||||
|
||||
- `vd_material_db_panel` (F524) — 材料数据库面板
|
||||
- `vd_core_materials` (MT-01) — 材料管理器
|
||||
- `vd_smart_material_advisor` (F182) — AI 材料顾问
|
||||
- 所有 CAE 面板(需要材料属性进行仿真)
|
||||
@@ -0,0 +1,149 @@
|
||||
# VDE-621: Format Converter — 几何格式转换与批量处理 API
|
||||
|
||||
**来源**: Batch 291 — Format Converter Panel (F545)
|
||||
**优先级**: High
|
||||
**日期**: 2026-08-07
|
||||
|
||||
## 背景
|
||||
|
||||
F545 格式转换器面板需要批量转换 CAD 文件格式(STEP ↔ IGES ↔ STL ↔ OBJ ↔ 3MF ↔ Parasolid ↔ JT ↔ glTF)。当前 VDE 的格式导入导出能力分散在各模块中,缺少统一的 Format Bridge 层和批量转换接口。
|
||||
|
||||
## API 建议
|
||||
|
||||
```cpp
|
||||
namespace vd::exchange {
|
||||
|
||||
// ============================================================
|
||||
// Supported formats
|
||||
// ============================================================
|
||||
enum class FileFormat {
|
||||
STEP_AP203, // AP203 (geometry only)
|
||||
STEP_AP214, // AP214 (geometry + colors)
|
||||
STEP_AP242, // AP242 (PMI + annotations)
|
||||
IGES, // IGES 5.3
|
||||
STL_ASCII, // STL ASCII
|
||||
STL_Binary, // STL Binary
|
||||
OBJ, // Wavefront OBJ
|
||||
PLY, // Stanford PLY
|
||||
GLTF_Binary, // glTF 2.0 (.glb)
|
||||
GLTF_ASCII, // glTF 2.0 (.gltf)
|
||||
Parasolid_XT, // Parasolid .x_t
|
||||
Parasolid_XB, // Parasolid .x_b
|
||||
JT, // JT Open
|
||||
ThreeMF, // 3MF
|
||||
VRML, // VRML 2.0
|
||||
AMF, // Additive Manufacturing Format
|
||||
};
|
||||
|
||||
// ============================================================
|
||||
// Conversion options
|
||||
// ============================================================
|
||||
struct ConversionOptions {
|
||||
// Geometry
|
||||
double linearTolerance_mm; // default: 0.001
|
||||
double angularTolerance_deg; // default: 0.5
|
||||
bool stitchSurfaces; // stitch adjacent surfaces
|
||||
bool sewToleranceAuto; // auto-detect sew tolerance
|
||||
bool simplifyGeometry; // remove redundant edges/faces
|
||||
double chordalTolerance_mm; // for tessellation
|
||||
|
||||
// Coordinate system
|
||||
enum class UnitSystem { mm, cm, m, inch, ft };
|
||||
UnitSystem sourceUnits;
|
||||
UnitSystem targetUnits;
|
||||
bool flipYZ; // for Z-up ↔ Y-up conversion
|
||||
|
||||
// Level of Detail (for mesh formats)
|
||||
enum class LOD { Coarse, Medium, Fine, Custom };
|
||||
LOD lod;
|
||||
|
||||
// Visual
|
||||
bool exportColors;
|
||||
bool exportTextures;
|
||||
bool exportPMI; // Product Manufacturing Information
|
||||
bool exportMetadata;
|
||||
|
||||
// Compression
|
||||
bool compressBinary; // gzip binary output
|
||||
bool dracoCompress; // Draco mesh compression (glTF)
|
||||
};
|
||||
|
||||
// ============================================================
|
||||
// Conversion job
|
||||
// ============================================================
|
||||
struct ConversionJob {
|
||||
std::string id;
|
||||
std::string sourceFile;
|
||||
std::string targetFile;
|
||||
FileFormat sourceFormat;
|
||||
FileFormat targetFormat;
|
||||
ConversionOptions options;
|
||||
|
||||
enum class Status { Pending, Running, Completed, Failed, Cancelled };
|
||||
Status status;
|
||||
double progress; // 0.0 ~ 1.0
|
||||
std::string errorMessage;
|
||||
double elapsedTime_sec;
|
||||
int64_t sourceSize_bytes;
|
||||
int64_t targetSize_bytes;
|
||||
};
|
||||
|
||||
// ============================================================
|
||||
// Format Converter API
|
||||
// ============================================================
|
||||
class FormatConverter {
|
||||
public:
|
||||
// Single file conversion
|
||||
ConversionJob convert(
|
||||
const std::string& sourceFile,
|
||||
const std::string& targetFile,
|
||||
FileFormat sourceFmt, FileFormat targetFmt,
|
||||
const ConversionOptions& opts = {}
|
||||
);
|
||||
|
||||
// Batch conversion
|
||||
std::vector<ConversionJob> convertBatch(
|
||||
const std::vector<ConversionJob>& jobs,
|
||||
int maxParallel = 4
|
||||
);
|
||||
|
||||
// Query job status
|
||||
ConversionJob::Status jobStatus(const std::string& jobId) const;
|
||||
bool cancelJob(const std::string& jobId);
|
||||
|
||||
// Format detection
|
||||
FileFormat detectFormat(const std::string& filePath) const;
|
||||
std::string formatExtension(FileFormat fmt) const;
|
||||
|
||||
// Format compatibility check
|
||||
bool isCompatible(FileFormat source, FileFormat target) const;
|
||||
std::vector<FileFormat> compatibleTargets(FileFormat source) const;
|
||||
|
||||
// Log
|
||||
std::string conversionLog(const std::string& jobId) const;
|
||||
};
|
||||
|
||||
} // namespace vd::exchange
|
||||
```
|
||||
|
||||
## 对标参考
|
||||
|
||||
- **CAD Exchanger**: 专业 CAD 格式转换 SDK,30+ 格式
|
||||
- **Datakit CrossManager**: 批量格式转换工具
|
||||
- **SolidWorks Task Scheduler**: 批量文件转换 + 打印
|
||||
|
||||
## 验收标准
|
||||
|
||||
1. 支持 16 种格式定义
|
||||
2. 单文件和批量转换
|
||||
3. 格式自动检测(扩展名 + 魔数)
|
||||
4. 单位系统和坐标系转换
|
||||
5. 转换进度报告和日志
|
||||
|
||||
## 影响面板
|
||||
|
||||
- `vd_format_converter_panel` (F545) — 格式转换器面板
|
||||
- `vd_format_bridge` (F318) — 格式桥接层
|
||||
- `vd_step_exchange` (F406) — STEP 交换
|
||||
- `vd_parasolid_io` (F407) — Parasolid 导入导出
|
||||
- `vd_jt3dpdf` (F408) — JT/3D PDF
|
||||
@@ -0,0 +1,172 @@
|
||||
# VDE-622: Import Diagnostics — 导入几何诊断与修复 API
|
||||
|
||||
**来源**: Batch 292 — Import Diagnostics Panel (F546)
|
||||
**优先级**: High
|
||||
**日期**: 2026-08-07
|
||||
|
||||
## 背景
|
||||
|
||||
F546 导入诊断面板需要对导入的几何模型进行自动诊断和修复。当前 VDE 缺少系统化的几何验证和修复 API。导入的第三方 CAD 数据经常包含几何缺陷(间隙、重叠、退化面、自交等),需要自动检测和修复才能用于后续建模/仿真。
|
||||
|
||||
## API 建议
|
||||
|
||||
```cpp
|
||||
namespace vd::healing {
|
||||
|
||||
// ============================================================
|
||||
// Diagnostic issue types
|
||||
// ============================================================
|
||||
enum class IssueType {
|
||||
ShortEdge, // 短边(低于公差)
|
||||
ThinFace, // 薄面
|
||||
SmallHole, // 小孔
|
||||
OverlappingFaces, // 重叠面
|
||||
GapBetweenFaces, // 面间间隙
|
||||
SelfIntersectingFace, // 自交面
|
||||
NonManifoldEdge, // 非流形边
|
||||
NakedEdge, // 裸边(未缝合)
|
||||
DegenerateFace, // 退化面(面积≈0)
|
||||
InvertedNormal, // 反转法向
|
||||
DuplicateBody, // 重复体
|
||||
MissingTopology, // 缺失拓扑信息
|
||||
};
|
||||
|
||||
// ============================================================
|
||||
// Diagnostic issue
|
||||
// ============================================================
|
||||
struct DiagnosticIssue {
|
||||
int id;
|
||||
IssueType type;
|
||||
std::string description;
|
||||
std::string entityId; // face/edge/vertex ID
|
||||
Point3d location; // centroid or representative point
|
||||
double severity; // 0.0 (minor) ~ 1.0 (critical)
|
||||
bool repairable;
|
||||
std::string repairStrategy; // suggested fix
|
||||
};
|
||||
|
||||
// ============================================================
|
||||
// Repair action
|
||||
// ============================================================
|
||||
enum class RepairAction {
|
||||
StitchGaps, // 缝合间隙(容差内)
|
||||
RemoveSmallFaces, // 移除小面
|
||||
MergeCoincidentVerts, // 合并重合点
|
||||
HealDegenerateFaces, // 修复退化面
|
||||
FixNormals, // 统��法向
|
||||
RemoveDuplicateBodies, // 删除重复体
|
||||
SimplifyTopology, // 简化拓扑
|
||||
RebuildEdges, // 重建边
|
||||
RetessellateFaces, // 重新三角化面
|
||||
AutoRepair, // 自动修复(全部)
|
||||
};
|
||||
|
||||
// ============================================================
|
||||
// Repair result
|
||||
// ============================================================
|
||||
struct RepairResult {
|
||||
RepairAction action;
|
||||
int issuesFound;
|
||||
int issuesFixed;
|
||||
int issuesRemaining;
|
||||
bool success;
|
||||
std::string log;
|
||||
};
|
||||
|
||||
// ============================================================
|
||||
// Import configuration
|
||||
// ============================================================
|
||||
struct ImportConfig {
|
||||
std::string format; // STEP, IGES, Parasolid, etc.
|
||||
double stitchingTolerance_mm; // sewing/stitching tolerance
|
||||
double geometryTolerance_mm; // general geometry tolerance
|
||||
bool autoRepair; // auto-fix after import
|
||||
bool simplifyGeometry; // remove sliver faces, short edges
|
||||
bool detectInterferences; // detect self-intersections
|
||||
bool preservePMI; // preserve Product Manufacturing Info
|
||||
bool preserveColors; // preserve face colors
|
||||
bool preserveLayers; // preserve layer/level info
|
||||
};
|
||||
|
||||
// ============================================================
|
||||
// Health score
|
||||
// ============================================================
|
||||
struct HealthReport {
|
||||
double score; // 0.0 (unusable) ~ 100.0 (perfect)
|
||||
int totalIssues;
|
||||
int criticalIssues; // non-manifold, self-intersection
|
||||
int warningIssues; // gaps, thin faces
|
||||
int infoIssues; // short edges, duplicate bodies
|
||||
bool isSolid; // closed, watertight, manifold
|
||||
bool isManifold;
|
||||
double boundingBoxVolume_mm3;
|
||||
int bodyCount;
|
||||
int faceCount;
|
||||
int edgeCount;
|
||||
int vertexCount;
|
||||
};
|
||||
|
||||
// ============================================================
|
||||
// Geometry Diagnostics & Healing API
|
||||
// ============================================================
|
||||
class GeometryHealer {
|
||||
public:
|
||||
// Diagnostics
|
||||
std::vector<DiagnosticIssue> diagnose(
|
||||
const std::string& bodyId,
|
||||
double tolerance_mm = 0.001
|
||||
);
|
||||
|
||||
HealthReport healthCheck(const std::string& bodyId);
|
||||
|
||||
// Repair
|
||||
RepairResult repair(
|
||||
const std::string& bodyId,
|
||||
RepairAction action
|
||||
);
|
||||
|
||||
RepairResult repairAll(const std::string& bodyId); // AutoRepair
|
||||
|
||||
bool undoLastRepair(const std::string& bodyId);
|
||||
|
||||
// Batch operations
|
||||
HealthReport batchHealthCheck(const std::vector<std::string>& bodyIds);
|
||||
std::vector<RepairResult> batchRepair(
|
||||
const std::vector<std::string>& bodyIds,
|
||||
RepairAction action
|
||||
);
|
||||
|
||||
// Import with diagnostics
|
||||
HealthReport importAndValidate(
|
||||
const std::string& filePath,
|
||||
const ImportConfig& config
|
||||
);
|
||||
|
||||
// Report generation
|
||||
std::string generateReport(const std::string& bodyId, bool includeDetails = true);
|
||||
};
|
||||
|
||||
} // namespace vd::healing
|
||||
```
|
||||
|
||||
## 对标参考
|
||||
|
||||
- **SolidWorks Import Diagnostics**: 自动检测间隙/坏面,交互式修复向导
|
||||
- **ANSYS SpaceClaim**: 几何清理工具(Stitch, Missing Faces, Simplify)
|
||||
- **CADfix**: 专业 CAD 修复与转换工具,支持批量和交互式修复
|
||||
|
||||
## 验收标准
|
||||
|
||||
1. 12 种诊断问题类型
|
||||
2. 10 种修复操作(含自动修复)
|
||||
3. 健康评分(0-100)
|
||||
4. 撤销上次修复
|
||||
5. 导入时自动诊断和修复
|
||||
6. HTML 报告生成
|
||||
|
||||
## 影响面板
|
||||
|
||||
- `vd_import_diag_panel` (F546) — 导入诊断面板
|
||||
- `vd_model_repair_panel` (F507) — 模型修复面板
|
||||
- `vd_measure_panel` — 测量面板(几何验证辅助)
|
||||
- `vd_core_validation` (P3-VL) — 设计验证工具包
|
||||
Reference in New Issue
Block a user