2ecad1543f
v8.1 — 极致性能 (SIMD + LockFree + Transaction + NUMA): - simd_vector.h: Vec4d/Vec4f SSE/AVX/NEON auto-detect, batch AABB, SoA transpose - concurrent_data: LockFreeQueue (MPMC CAS), LockFreeStack (Treiber), ConcurrentHashMap (64-segment sharded) - transaction: Command pattern, UndoManager (infinite undo/redo), crash-recovery journal - performance_tuning: NUMA-aware, cache_line aligned, prefetch, hot/cold separation - 20 tests (concurrent + transaction), ~2600 lines v8.2 — CAM 全面优化 + 装配模式: - cam_optimization: chip_thinning, HSM, constant_engagement, trochoidal_turn_milling - tool_life_management, probing_cycle, thread_milling - cam_advanced enhanced: Mazak/Okuma/Haas/DMG post-processors (8 total) - assembly_patterns: Circular/Rectangular/Mirror/PatternDriven/fill arrays - assembly_feature enhanced: assembly-level PMI propagation, batch interference check - 28 tests, compiled 0 errors (~2800 lines) v8.3 — 可视化+压缩+IGA+质量闭环: - visualization_quality: ambient_occlusion, edge_highlighting, wireframe, normals - topology_compression: Brep compression, Edgebreaker, vertex quantization - iga_prep: knot_insertion, degree_elevation, Bezier extraction for IGA analysis - quality_feedback: design_rule_check, manufacturability, cost_estimation, quality_score (0-100) - 28 tests, ~2349 lines 27 files, ~7750 lines, 76 tests
147 lines
6.3 KiB
C++
147 lines
6.3 KiB
C++
#pragma once
|
|
#include "vde/brep/brep.h"
|
|
#include "vde/brep/assembly.h"
|
|
|
|
namespace vde::brep {
|
|
|
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
// 装配特征类型
|
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
|
|
enum class AssemblyFeatureType { BoltHole, PinSlot, WeldJoint, RivetPattern };
|
|
|
|
struct AssemblyFeatureParams {
|
|
AssemblyFeatureType type;
|
|
std::vector<double> values;
|
|
core::Vector3D direction{0, 0, 1};
|
|
};
|
|
|
|
void apply_assembly_feature(Assembly& assembly, const AssemblyFeatureParams& params);
|
|
|
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
// PMI (Product Manufacturing Information) 标注传播
|
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
|
|
/// PMI 标注类型
|
|
enum class PMIType {
|
|
Dimension, ///< 尺寸标注
|
|
GeometricTol, ///< 几何公差 (GD&T)
|
|
SurfaceFinish, ///< 表面粗糙度
|
|
Datum, ///< 基准标识
|
|
Note, ///< 注释
|
|
WeldSymbol ///< 焊接符号
|
|
};
|
|
|
|
/// PMI 标注数据
|
|
struct PMIAnnotation {
|
|
PMIType type = PMIType::Dimension;
|
|
std::string id; ///< 标注唯一标识
|
|
std::string label; ///< 标注文本
|
|
core::Point3D position; ///< 标注位置
|
|
core::Vector3D normal; ///< 标注平面法向
|
|
std::string target_feature_id; ///< 关联的特征 ID
|
|
std::vector<double> tolerance_values; ///< 公差值 (如 [0.1, 0.05] = 上/下偏差)
|
|
std::string datum_references; ///< 基准参考 (如 "A|B|C")
|
|
};
|
|
|
|
/// PMI 传播结果
|
|
struct PMIPropagationResult {
|
|
std::vector<PMIAnnotation> propagated_annotations; ///< 传播后的 PMI 标注列表
|
|
size_t total_source_count = 0; ///< 源标注总数
|
|
size_t propagated_count = 0; ///< 成功传播数
|
|
size_t unresolved_count = 0; ///< 无法解析的标注数
|
|
std::vector<std::string> warnings; ///< 警告消息
|
|
};
|
|
|
|
/// 将零件级 PMI 标注传播到装配级
|
|
///
|
|
/// 扫描装配体中的所有零件,收集其 PMI 标注(GD&T/尺寸/粗糙度等),
|
|
/// 通过装配变换将标注位置和方向转换到装配坐标系。
|
|
///
|
|
/// 典型用例:
|
|
/// - 在装配图中显示所有零件的关键尺寸和公差
|
|
/// - 装配级的 GD&T 基准传递
|
|
/// - 焊接符号的装配级聚合
|
|
///
|
|
/// @param assembly 目标装配体
|
|
/// @param source_annotations 零件级 PMI 标注列表(相对于各自零件坐标系)
|
|
/// @return PMI 传播结果
|
|
///
|
|
/// @ingroup brep
|
|
[[nodiscard]] PMIPropagationResult propagate_pmi_to_assembly(
|
|
const Assembly& assembly,
|
|
const std::vector<PMIAnnotation>& source_annotations);
|
|
|
|
/// 获取装配体中所有零件的 PMI 标注(扫描)
|
|
///
|
|
/// @param assembly 目标装配体
|
|
/// @return 装配坐标系下的所有 PMI 标注
|
|
///
|
|
/// @ingroup brep
|
|
[[nodiscard]] std::vector<PMIAnnotation> collect_assembly_pmi(
|
|
const Assembly& assembly);
|
|
|
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
// 装配级干涉检查批处理
|
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
|
|
/// 干涉检查批处理参数
|
|
struct InterferenceBatchParams {
|
|
bool check_part_to_part = true; ///< 零件间干涉检查
|
|
bool check_part_to_fastener = true; ///< 零件与紧固件干涉检查
|
|
bool check_kinematic_range = false; ///< 运动包络干涉检查
|
|
double clearance_threshold = 0.01; ///< 间隙阈值 (mm) — 小于此值视为干涉
|
|
bool generate_report = true; ///< 是否生成详细报告
|
|
int max_threads = 4; ///< 并行线程数
|
|
};
|
|
|
|
/// 干涉检查批处理结果
|
|
struct InterferenceBatchResult {
|
|
size_t total_pairs_checked = 0; ///< 检查的零件对数
|
|
size_t interference_count = 0; ///< 干涉对数
|
|
size_t clearance_violations = 0; ///< 间隙违规数
|
|
std::vector<std::string> interference_details; ///< 干涉详情
|
|
double total_check_time_ms = 0.0; ///< 总检查耗时 (ms)
|
|
std::string summary_report; ///< 摘要报告
|
|
};
|
|
|
|
/// 装配级干涉检查批处理
|
|
///
|
|
/// 对装配体中所有零件对进行批量的干涉/间隙检查。
|
|
/// 支持零件-零件、零件-紧固件、运动包络三种检查模式。
|
|
/// 可并行加速。
|
|
///
|
|
/// 算法:
|
|
/// 1. 对装配体构建 BVH (Bounding Volume Hierarchy) 加速结构
|
|
/// 2. 利用 BVH 快速筛选可能相交的零件对 (broad phase)
|
|
/// 3. 对候选对进行精确三角面片干涉检测 (narrow phase)
|
|
/// 4. 生成干涉报告
|
|
///
|
|
/// @param assembly 目标装配体
|
|
/// @param params 批处理参数
|
|
/// @return 干涉检查批处理结果
|
|
///
|
|
/// @ingroup brep
|
|
[[nodiscard]] InterferenceBatchResult interference_check_batch(
|
|
const Assembly& assembly,
|
|
const InterferenceBatchParams& params = InterferenceBatchParams{});
|
|
|
|
/// 检查两个特定零件是否干涉
|
|
///
|
|
/// @param model_a 零件 A
|
|
/// @param transform_a 零件 A 的世界变换
|
|
/// @param model_b 零件 B
|
|
/// @param transform_b 零件 B 的世界变换
|
|
/// @param clearance_threshold 间隙阈值
|
|
/// @return true 如果发生干涉
|
|
///
|
|
/// @ingroup brep
|
|
[[nodiscard]] bool check_part_interference(
|
|
const BrepModel& model_a,
|
|
const core::Transform3D& transform_a,
|
|
const BrepModel& model_b,
|
|
const core::Transform3D& transform_b,
|
|
double clearance_threshold = 0.01);
|
|
|
|
} // namespace vde::brep
|