主要修复: - 修复CalculateAssemblyTotalSize中文件计数逻辑 - 解决"from X files"数量不正确的问题 - 无条件计数所有有效组件,不管文件大小是否为0 薄壳化分析优化: - 使用命名常量替代硬编码置信度值 - 实现真实几何计算和缓存机制 - 添加大模型采样优化策略 - 改进体积影响计算算法 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
48 lines
1.5 KiB
C++
48 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <map>
|
|
#include <vector>
|
|
#include <wfcAssembly.h>
|
|
#include "CreoManager.h"
|
|
|
|
// 层级统计请求结构
|
|
struct HierarchyStatisticsRequest {
|
|
std::string project_name; // 可选的项目名称,默认使用当前模型名
|
|
};
|
|
|
|
// 层级统计结果结构
|
|
struct HierarchyStatisticsResult {
|
|
bool success = false;
|
|
std::string message;
|
|
std::string model_name; // 当前模型名称
|
|
std::string model_type; // 模型类型 (assembly/part)
|
|
int total_levels = 0; // 总层级数
|
|
std::map<int, int> level_statistics; // key: 层级号, value: 该层级的直接子节点数量
|
|
std::string analysis_time; // 分析时间
|
|
std::string error_message;
|
|
};
|
|
|
|
// 层级统计分析器类
|
|
class HierarchyStatisticsAnalyzer {
|
|
public:
|
|
static HierarchyStatisticsAnalyzer& Instance();
|
|
|
|
// 执行层级统计分析
|
|
HierarchyStatisticsResult AnalyzeHierarchyStatistics(const HierarchyStatisticsRequest& request);
|
|
|
|
private:
|
|
HierarchyStatisticsAnalyzer() = default;
|
|
~HierarchyStatisticsAnalyzer() = default;
|
|
|
|
// 禁止拷贝
|
|
HierarchyStatisticsAnalyzer(const HierarchyStatisticsAnalyzer&) = delete;
|
|
HierarchyStatisticsAnalyzer& operator=(const HierarchyStatisticsAnalyzer&) = delete;
|
|
|
|
// 递归分析装配体层级
|
|
void AnalyzeAssemblyLevel(wfcWAssembly_ptr assembly, int level, std::map<int, int>& statistics, int& maxLevel);
|
|
|
|
// 获取当前时间字符串
|
|
std::string GetCurrentTimeString();
|
|
};
|