diff --git a/CreoManager.cpp b/CreoManager.cpp index a430f0f..2590575 100644 --- a/CreoManager.cpp +++ b/CreoManager.cpp @@ -575,9 +575,10 @@ std::string CreoManager::CalculateAssemblyTotalSize(pfcModel_ptr model) { if (comp_model) { std::string comp_size = GetModelFileSize(comp_model); double comp_mb = ParseMBFromSizeString(comp_size); + // Always count valid components, regardless of file size + processed_count++; if (comp_mb > 0) { total_size_bytes += comp_mb * 1024 * 1024; - processed_count++; } } } @@ -1564,10 +1565,15 @@ CreoManager::ShellAnalysisResult CreoManager::AnalyzeShellFeatures(const ShellAn tolerance = 1.0; } - // 第2步:外壳识别算法 - 基于包络盒边界识别法 - for (int i = 0; i < total_features; i++) { + // 大模型优化:确定分析模式和采样策略 + ShellAnalysisMode analysis_mode = DetermineAnalysisMode(total_features); + std::vector sampling_indices = GetSamplingIndices(total_features, analysis_mode); + + // 第2步:外壳识别算法 - 基于包络盒边界识别法(优化版) + for (int idx : sampling_indices) { + if (idx >= total_features) continue; try { - pfcFeature_ptr feature = features->get(i); + pfcFeature_ptr feature = features->get(idx); if (feature) { pfcFeatureType feat_type = feature->GetFeatType(); std::string feat_name = ""; @@ -1581,21 +1587,21 @@ CreoManager::ShellAnalysisResult CreoManager::AnalyzeShellFeatures(const ShellAn // 使用特征类型+编号格式 pfcFeatureType feat_type = feature->GetFeatType(); std::string type_name = GetFeatureTypeName(feat_type); - feat_name = type_name + "_" + std::to_string(i + 1); + feat_name = type_name + "_" + std::to_string(idx + 1); } } catch (...) { // 获取失败时,使用特征类型+编号格式 try { pfcFeatureType feat_type = feature->GetFeatType(); std::string type_name = GetFeatureTypeName(feat_type); - feat_name = type_name + "_" + std::to_string(i + 1); + feat_name = type_name + "_" + std::to_string(idx + 1); } catch (...) { - feat_name = "FEATURE_" + std::to_string(i + 1); + feat_name = "FEATURE_" + std::to_string(idx + 1); } } // === 基于真实几何的薄壳化分析 === - double confidence = 0.5; // 基础置信度,基于几何分析调整 + double confidence = ShellAnalysisConstants::CONFIDENCE_SHELL_FEATURE; // 基础置信度,基于几何分析调整 bool is_shell_feature = false; bool is_internal_feature = false; bool feature_touches_boundary = false; @@ -1609,7 +1615,7 @@ CreoManager::ShellAnalysisResult CreoManager::AnalyzeShellFeatures(const ShellAn // 特征接触模型边界 -> 可能是外壳特征 is_shell_feature = true; shell_feature_whitelist.insert(feat_name); - confidence = 0.2; // 低置信度删除,倾向保留 + confidence = ShellAnalysisConstants::CONFIDENCE_SHELL_FEATURE; shell_surfaces++; // 进一步检查特征类型 @@ -1618,44 +1624,47 @@ CreoManager::ShellAnalysisResult CreoManager::AnalyzeShellFeatures(const ShellAn feat_type == pfcFeatureType::pfcFEATTYPE_DOME || feat_type == pfcFeatureType::pfcFEATTYPE_TORUS) { // 构建外形的特征且接触边界 -> 强制保留 - confidence = 0.05; + confidence = ShellAnalysisConstants::CONFIDENCE_EXTERNAL_FEATURE; } } else { // 特征完全在内部 -> 内部特征 is_internal_feature = true; - confidence = 0.8; // 高置信度删除 + confidence = ShellAnalysisConstants::CONFIDENCE_INTERNAL_GENERIC; internal_surfaces++; // 内部特征的具体分类 - if (feat_type == pfcFeatureType::pfcFEATTYPE_CUT || - feat_type == pfcFeatureType::pfcFEATTYPE_HOLE || - feat_type == pfcFeatureType::pfcFEATTYPE_ROUND || - feat_type == pfcFeatureType::pfcFEATTYPE_CHAMFER) { - // 明确的内部加工特征 -> 激进删除 - confidence = 0.95; + if (feat_type == pfcFeatureType::pfcFEATTYPE_CUT) { + confidence = ShellAnalysisConstants::CONFIDENCE_INTERNAL_CUT; + } else if (feat_type == pfcFeatureType::pfcFEATTYPE_HOLE) { + confidence = ShellAnalysisConstants::CONFIDENCE_INTERNAL_HOLE; + } else if (feat_type == pfcFeatureType::pfcFEATTYPE_ROUND || + feat_type == pfcFeatureType::pfcFEATTYPE_CHAMFER) { + confidence = ShellAnalysisConstants::CONFIDENCE_INTERNAL_GENERIC; } } // 标准件识别(优先级最高) if (IsStandardPart(feat_name)) { - confidence = 0.99; // 标准件强制删除 + confidence = ShellAnalysisConstants::CONFIDENCE_STANDARD_PART; is_internal_feature = true; is_shell_feature = false; } // 用户设置:保护外部表面 if (request.preserve_external_surfaces && is_shell_feature) { - confidence = std::min(confidence, 0.1); // 强制保留外部表面 + confidence = std::min(confidence, ShellAnalysisConstants::CONFIDENCE_EXTERNAL_FEATURE); } } catch (...) { // 几何分析失败,回退到基于特征类型的简单判断 - if (feat_type == pfcFeatureType::pfcFEATTYPE_CUT || - feat_type == pfcFeatureType::pfcFEATTYPE_HOLE) { - confidence = 0.7; // 中等置信度删除 + if (feat_type == pfcFeatureType::pfcFEATTYPE_CUT) { + confidence = ShellAnalysisConstants::CONFIDENCE_INTERNAL_CUT; + is_internal_feature = true; + } else if (feat_type == pfcFeatureType::pfcFEATTYPE_HOLE) { + confidence = ShellAnalysisConstants::CONFIDENCE_INTERNAL_HOLE; is_internal_feature = true; } else { - confidence = 0.3; // 低置信度删除,倾向保留 + confidence = ShellAnalysisConstants::CONFIDENCE_SHELL_FEATURE; } } @@ -1666,16 +1675,16 @@ CreoManager::ShellAnalysisResult CreoManager::AnalyzeShellFeatures(const ShellAn if (confidence > 0.8) { // 安全删除:高置信度的内部特征 FeatureDeletion deletion; - deletion.id = i + 1; + deletion.id = idx + 1; deletion.name = feat_name; deletion.type = GetFeatureTypeName(feat_type); deletion.reason = IsStandardPart(feat_name) ? "Internal feature, safe for removal" : "Internal feature, safe for removal"; deletion.confidence = confidence; - deletion.volume_reduction = - (feat_type == pfcFeatureType::pfcFEATTYPE_CUT) ? 8 : - (feat_type == pfcFeatureType::pfcFEATTYPE_HOLE) ? 6 : 4; + // Use real geometry calculation for volume impact + deletion.volume_reduction = static_cast( + CalculateFeatureVolumeImpact(feature, solid)); deletion.component_type = "FEATURE"; // 获取零件文件信息(零件模式 - 真实失败处理) @@ -1717,12 +1726,13 @@ CreoManager::ShellAnalysisResult CreoManager::AnalyzeShellFeatures(const ShellAn } else if (confidence > 0.5 && !is_shell_feature) { // 建议删除:中等置信度的非外壳特征 FeatureDeletion suggestion; - suggestion.id = i + 1; + suggestion.id = idx + 1; suggestion.name = feat_name; suggestion.type = GetFeatureTypeName(feat_type); suggestion.reason = "Suggest deletion - review recommended"; suggestion.confidence = confidence; - suggestion.volume_reduction = 3; + suggestion.volume_reduction = static_cast( + CalculateFeatureVolumeImpact(feature, solid)); suggestion.component_type = "FEATURE"; // 获取零件文件信息(零件模式 - 真实失败处理) @@ -1763,7 +1773,7 @@ CreoManager::ShellAnalysisResult CreoManager::AnalyzeShellFeatures(const ShellAn } else { // 保留:低置信度或外壳特征 FeatureDeletion preserve; - preserve.id = i + 1; + preserve.id = idx + 1; preserve.name = feat_name; preserve.type = GetFeatureTypeName(feat_type); preserve.reason = is_shell_feature ? @@ -2053,7 +2063,7 @@ CreoManager::ShellAnalysisResult CreoManager::AnalyzeShellFeatures(const ShellAn deletion.type = "COMPONENT"; deletion.reason = deletion_reason; deletion.confidence = confidence; - deletion.volume_reduction = 5; // 合理估算值 + deletion.volume_reduction = 5; // Assembly components use fixed estimate deletion.component_type = "COMPONENT"; // 获取组件文件信息(装配体模式 - 确保信息完整性) @@ -2091,7 +2101,7 @@ CreoManager::ShellAnalysisResult CreoManager::AnalyzeShellFeatures(const ShellAn suggestion.type = "COMPONENT"; suggestion.reason = deletion_reason; suggestion.confidence = confidence; - suggestion.volume_reduction = 3; // 合理估算值 + suggestion.volume_reduction = 3; // Assembly components use fixed estimate suggestion.component_type = "COMPONENT"; // 获取组件文件信息(装配体模式 - 确保信息完整性) @@ -2186,31 +2196,27 @@ CreoManager::ShellAnalysisResult CreoManager::AnalyzeShellFeatures(const ShellAn int total_suggested_deletions = (int)result.suggested_deletions.size(); int total_deletable_items = total_safe_deletions + total_suggested_deletions; - if (total_deletable_items > 0 && total_features > 0) { - // 基于删除项目数量的合理化计算 - double deletion_ratio = (double)total_deletable_items / (double)total_features; - - // 体积优化估算(基于删除比例,最大不超过50%) - int volume_reduction_percent = std::min(50, (int)(deletion_ratio * 30 + total_safe_deletions * 2)); - - // 文件大小优化估算(通常比体积优化低一些) - int file_size_reduction_percent = std::min(40, volume_reduction_percent * 3 / 4); - - // 性能提升估算(基于删除的复杂度,最大2.5倍) - double performance_multiplier = std::min(2.5, 1.0 + deletion_ratio * 1.2 + total_safe_deletions * 0.05); - - result.estimated_reduction.volume_reduction = std::to_string(volume_reduction_percent) + "%"; - result.estimated_reduction.file_size_reduction = std::to_string(file_size_reduction_percent) + "%"; - - std::ostringstream perf_stream; - perf_stream << std::fixed << std::setprecision(1) << performance_multiplier << "x"; - result.estimated_reduction.performance_improvement = perf_stream.str(); - } else { - result.estimated_reduction.volume_reduction = "0%"; - result.estimated_reduction.file_size_reduction = "0%"; - result.estimated_reduction.performance_improvement = "1.0x"; + // 使用新的基于真实数据的估算算法 + double original_volume = 0.0; + try { + if (!is_assembly) { + pfcSolid_ptr solid = pfcSolid::cast(currentModel); + if (solid) { + pfcMassProperty_ptr mass_props = solid->GetMassProperty(nullptr); + if (mass_props) { + original_volume = mass_props->GetVolume(); + } + } + } else { + original_volume = 1000.0; // Assembly fallback + } + } catch (...) { + original_volume = 1000.0; // Default fallback } + result.estimated_reduction = CalculateRealisticReduction( + result.safe_deletions, original_volume, total_features); + // 装配体层次分析(如果是装配体) if (is_assembly) { result.analysis_parameters.hierarchy_analysis.enabled = true; @@ -2233,6 +2239,233 @@ CreoManager::ShellAnalysisResult CreoManager::AnalyzeShellFeatures(const ShellAn return result; } +// 真实几何计算:计算特征的体积影响 +double CreoManager::CalculateFeatureVolumeImpact(pfcFeature_ptr feature, pfcSolid_ptr solid) { + if (!feature || !solid) return 0.0; + + try { + // Generate cache key + std::string feature_name; + try { + xstring xstr_name = feature->GetName(); + if (xstr_name != xstringnil && !xstr_name.IsEmpty()) { + feature_name = XStringToString(xstr_name); + } else { + feature_name = "feature_" + std::to_string(feature->GetId()); + } + } catch (...) { + feature_name = "feature_" + std::to_string(feature->GetId()); + } + + std::string model_name; + try { + xstring xstr_model = solid->GetFileName(); + if (xstr_model != xstringnil && !xstr_model.IsEmpty()) { + model_name = XStringToString(xstr_model); + } + } catch (...) { + model_name = "model"; + } + + std::string cache_key = model_name + "_" + feature_name; + + // Check cache first + double cached_volume, cached_surface; + if (shell_analysis_cache.GetCachedImpact(cache_key, cached_volume, cached_surface)) { + return cached_volume; + } + + // Get volume before suppression + pfcMassProperty_ptr mass_before = solid->GetMassProperty(nullptr); + if (!mass_before) return 0.0; + + double volume_before = mass_before->GetVolume(); + if (volume_before <= 0) return 0.0; + + // Real geometry calculation using feature suppression + double volume_impact = 0.0; + + try { + // Create feature ID sequence for suppression + xintsequence_ptr featIds = xintsequence::create(); + featIds->append(feature->GetId()); + + // Create suppression options + wfcFeatSuppressOrDeleteOptions_ptr options = wfcFeatSuppressOrDeleteOptions::create(); + options->append(wfcFEAT_SUPP_OR_DEL_NO_OPTS); + + // Create regeneration instructions + wfcWRegenInstructions_ptr regenInstr = wfcWRegenInstructions::Create(); + + // Get wfcWSolid for feature operations + wfcWSolid_ptr wsolid = wfcWSolid::cast(solid); + if (wsolid) { + // Suppress feature temporarily and measure volume difference + wsolid->SuppressFeatures(featIds, options, regenInstr); + solid->Regenerate(nullptr); + + pfcMassProperty_ptr mass_after = solid->GetMassProperty(nullptr); + if (mass_after) { + double volume_after = mass_after->GetVolume(); + volume_impact = abs(volume_before - volume_after); + } + + // Resume feature to restore original state + wfcFeatResumeOptions_ptr resumeOptions = wfcFeatResumeOptions::create(); + resumeOptions->append(wfcFEAT_RESUME_NO_OPTS); + wsolid->ResumeFeatures(featIds, resumeOptions, regenInstr); + solid->Regenerate(nullptr); + + // Convert to percentage impact + if (volume_before > 0) { + volume_impact = (volume_impact / volume_before) * 100.0; + } + } else { + // Cannot cast to wfcWSolid, use fallback + pfcFeatureType type = feature->GetFeatType(); + if (type == pfcFEATTYPE_CUT) { + volume_impact = 8.0; + } else if (type == pfcFEATTYPE_HOLE) { + volume_impact = 6.0; + } else { + volume_impact = 4.0; + } + } + + } catch (...) { + // Restore original state on error + try { + xintsequence_ptr featIds = xintsequence::create(); + featIds->append(feature->GetId()); + wfcWRegenInstructions_ptr regenInstr = wfcWRegenInstructions::Create(); + wfcWSolid_ptr wsolid = wfcWSolid::cast(solid); + if (wsolid) { + wfcFeatResumeOptions_ptr resumeOptions = wfcFeatResumeOptions::create(); + resumeOptions->append(wfcFEAT_RESUME_NO_OPTS); + wsolid->ResumeFeatures(featIds, resumeOptions, regenInstr); + solid->Regenerate(nullptr); + } + } catch (...) { + // Ignore restoration errors + } + + // Fall back to feature type estimation on error + pfcFeatureType type = feature->GetFeatType(); + if (type == pfcFEATTYPE_CUT) { + volume_impact = 8.0; + } else if (type == pfcFEATTYPE_HOLE) { + volume_impact = 6.0; + } else { + volume_impact = 4.0; + } + } + + // Cache the result + shell_analysis_cache.SetCachedImpact(cache_key, volume_impact, 0.0); + + return volume_impact; + + } catch (pfcXToolkitError&) { + // OTK error: return fallback based on feature type + try { + pfcFeatureType type = feature->GetFeatType(); + if (type == pfcFEATTYPE_CUT) return 8.0; + if (type == pfcFEATTYPE_HOLE) return 6.0; + return 4.0; + } catch (...) { + return 2.0; + } + } catch (...) { + // Other error: return minimal impact + return 1.0; + } +} + +// 大模型优化:根据特征数量确定分析模式 +ShellAnalysisMode CreoManager::DetermineAnalysisMode(int feature_count) { + if (feature_count > ShellAnalysisConstants::VERY_LARGE_MODEL_THRESHOLD) { + return SHELL_ANALYSIS_FAST; + } else if (feature_count > ShellAnalysisConstants::LARGE_MODEL_THRESHOLD) { + return SHELL_ANALYSIS_STANDARD; + } + return SHELL_ANALYSIS_DETAILED; +} + +// 大模型优化:获取采样索引 +std::vector CreoManager::GetSamplingIndices(int total_features, ShellAnalysisMode mode) { + std::vector indices; + int step = 1; + + switch(mode) { + case SHELL_ANALYSIS_FAST: + step = static_cast(1.0 / ShellAnalysisConstants::SAMPLING_RATIO_FAST); + break; + case SHELL_ANALYSIS_STANDARD: + step = static_cast(1.0 / ShellAnalysisConstants::SAMPLING_RATIO_STANDARD); + break; + default: + step = 1; // Full analysis + } + + for (int i = 0; i < total_features; i += step) { + indices.push_back(i); + } + + // Always include first and last features for better coverage + if (!indices.empty() && indices.front() != 0) { + indices.insert(indices.begin(), 0); + } + if (!indices.empty() && indices.back() != total_features - 1) { + indices.push_back(total_features - 1); + } + + return indices; +} + +// 优化的估算算法:基于真实数据计算 +CreoManager::EstimatedReduction CreoManager::CalculateRealisticReduction( + const std::vector& deletions, + double original_volume, + int total_features) { + + EstimatedReduction result; + + try { + // Accumulate real volume impacts + double total_volume_reduction = 0.0; + for (const auto& deletion : deletions) { + total_volume_reduction += deletion.volume_reduction; + } + + // Limit to reasonable range + total_volume_reduction = std::min(75.0, total_volume_reduction); + + // File size typically proportional to volume but with lower compression + double file_reduction = total_volume_reduction * 0.7; + + // Performance improvement based on feature count reduction + double feature_reduction_ratio = total_features > 0 ? + static_cast(deletions.size()) / total_features : 0.0; + double performance_improvement = 1.0 + feature_reduction_ratio * 1.5; + performance_improvement = std::min(3.0, performance_improvement); // Cap at 3x + + result.volume_reduction = std::to_string(static_cast(total_volume_reduction)) + "%"; + result.file_size_reduction = std::to_string(static_cast(file_reduction)) + "%"; + + std::ostringstream perf_stream; + perf_stream << std::fixed << std::setprecision(1) << performance_improvement << "x"; + result.performance_improvement = perf_stream.str(); + + } catch (...) { + // Fallback to safe default values + result.volume_reduction = "0%"; + result.file_size_reduction = "0%"; + result.performance_improvement = "1.0x"; + } + + return result; +} + // 辅助方法:获取特征类型名称 std::string CreoManager::GetFeatureTypeName(pfcFeatureType feat_type) { switch (feat_type) { diff --git a/CreoManager.h b/CreoManager.h index c16b2f5..59dedd1 100644 --- a/CreoManager.h +++ b/CreoManager.h @@ -144,6 +144,43 @@ struct HierarchyAnalysisResult { std::string error_message; }; +// Shell Analysis Constants +namespace ShellAnalysisConstants { + // Confidence thresholds + constexpr double CONFIDENCE_STANDARD_PART = 0.99; + constexpr double CONFIDENCE_INTERNAL_CUT = 0.95; + constexpr double CONFIDENCE_INTERNAL_HOLE = 0.90; + constexpr double CONFIDENCE_INTERNAL_GENERIC = 0.80; + constexpr double CONFIDENCE_SHELL_FEATURE = 0.20; + constexpr double CONFIDENCE_EXTERNAL_FEATURE = 0.05; + + // Performance thresholds + constexpr int LARGE_MODEL_THRESHOLD = 500; + constexpr int VERY_LARGE_MODEL_THRESHOLD = 1000; + constexpr double SAMPLING_RATIO_FAST = 0.1; + constexpr double SAMPLING_RATIO_STANDARD = 0.33; + + // Geometry calculation weights + constexpr double VOLUME_WEIGHT = 0.5; + constexpr double SURFACE_WEIGHT = 0.3; + constexpr double BBOX_WEIGHT = 0.2; + + // Batch processing + constexpr int BATCH_SIZE = 50; + constexpr int MAX_PARALLEL_FEATURES = 100; + + // Cache settings + constexpr int CACHE_TTL_SECONDS = 600; // 10 minutes + constexpr int MAX_CACHE_SIZE = 1000; +} + +// Analysis modes for large models +enum ShellAnalysisMode { + SHELL_ANALYSIS_FAST = 0, // Fast mode: sampling analysis + SHELL_ANALYSIS_STANDARD = 1, // Standard mode: normal analysis + SHELL_ANALYSIS_DETAILED = 2 // Detailed mode: full analysis +}; + // Creo管理器类 class CreoManager { public: @@ -258,7 +295,7 @@ public: ShellAnalysisParameters analysis_parameters; std::string error_message; }; - + ShellAnalysisResult AnalyzeShellFeatures(const ShellAnalysisRequest& request); // 薄壳化分析辅助方法 @@ -270,6 +307,19 @@ public: bool IsStandardPart(const std::string& part_name); bool IsInternalPart(pfcFeature_ptr feature, pfcModel_ptr model); + // 真实几何计算方法 + double CalculateFeatureVolumeImpact(pfcFeature_ptr feature, pfcSolid_ptr solid); + + // 大模型优化方法 + ShellAnalysisMode DetermineAnalysisMode(int feature_count); + std::vector GetSamplingIndices(int total_features, ShellAnalysisMode mode); + + // 优化的估算方法 + EstimatedReduction CalculateRealisticReduction( + const std::vector& deletions, + double original_volume, + int total_features); + // 辅助功能 std::string GetCurrentTimeString(); std::string GetCurrentTimeStringISO(); @@ -318,6 +368,55 @@ private: const std::string& parentPath, std::vector>& allComponents); + // Shell Analysis Cache + class ShellAnalysisCache { + private: + struct FeatureCacheEntry { + double volume_impact; + double surface_impact; + double confidence; + std::time_t timestamp; + }; + + std::map cache; + + public: + bool GetCachedImpact(const std::string& key, double& volume, double& surface) { + auto it = cache.find(key); + if (it != cache.end()) { + if (std::time(nullptr) - it->second.timestamp < ShellAnalysisConstants::CACHE_TTL_SECONDS) { + volume = it->second.volume_impact; + surface = it->second.surface_impact; + return true; + } + cache.erase(it); + } + return false; + } + + void SetCachedImpact(const std::string& key, double volume, double surface) { + FeatureCacheEntry entry; + entry.volume_impact = volume; + entry.surface_impact = surface; + entry.timestamp = std::time(nullptr); + cache[key] = entry; + + // Limit cache size + if (cache.size() > ShellAnalysisConstants::MAX_CACHE_SIZE) { + auto oldest = cache.begin(); + for (auto it = cache.begin(); it != cache.end(); ++it) { + if (it->second.timestamp < oldest->second.timestamp) { + oldest = it; + } + } + cache.erase(oldest); + } + } + }; + + // Cache instance + ShellAnalysisCache shell_analysis_cache; + // 真实几何分析方法 bool AnalyzeFeatureGeometry(pfcFeature_ptr feature, pfcOutline3D_ptr globalOutline, double tolerance); diff --git a/HierarchyStatisticsAnalyzer.cpp b/HierarchyStatisticsAnalyzer.cpp index dd7b460..18db5f4 100644 --- a/HierarchyStatisticsAnalyzer.cpp +++ b/HierarchyStatisticsAnalyzer.cpp @@ -1,6 +1,5 @@ #include "pch.h" #include "HierarchyStatisticsAnalyzer.h" -#include "CreoManager.h" #include #include #include @@ -28,7 +27,8 @@ std::string HierarchyStatisticsAnalyzer::GetCurrentTimeString() { HierarchyStatisticsResult HierarchyStatisticsAnalyzer::AnalyzeHierarchyStatistics(const HierarchyStatisticsRequest& request) { HierarchyStatisticsResult result; - CreoManager::SessionInfo sessionInfo = CreoManager::Instance().GetSessionInfo(); + auto& creoManager = CreoManager::Instance(); + CreoManager::SessionInfo sessionInfo = creoManager.GetSessionInfo(); if (!sessionInfo.is_valid) { result.error_message = "Creo session not available"; @@ -44,7 +44,7 @@ HierarchyStatisticsResult HierarchyStatisticsAnalyzer::AnalyzeHierarchyStatistic try { xstring filename_xstr = current_model->GetFileName(); - result.model_name = CreoManager::Instance().XStringToString(filename_xstr); + result.model_name = creoManager.XStringToString(filename_xstr); } catch (...) { result.model_name = "unknown_model"; } @@ -149,7 +149,8 @@ void HierarchyStatisticsAnalyzer::AnalyzeAssemblyLevel(wfcWAssembly_ptr assembly try { auto modelDescr = compFeat->GetModelDescr(); if (modelDescr) { - CreoManager::SessionInfo sessionInfo = CreoManager::Instance().GetSessionInfo(); + auto& creoManager2 = CreoManager::Instance(); + CreoManager::SessionInfo sessionInfo = creoManager2.GetSessionInfo(); if (sessionInfo.is_valid && sessionInfo.session) { childModel = sessionInfo.session->GetModelFromDescr(modelDescr); diff --git a/HierarchyStatisticsAnalyzer.h b/HierarchyStatisticsAnalyzer.h index 7ed2a7d..69bb62f 100644 --- a/HierarchyStatisticsAnalyzer.h +++ b/HierarchyStatisticsAnalyzer.h @@ -4,6 +4,7 @@ #include #include #include +#include "CreoManager.h" // 层级统计请求结构 struct HierarchyStatisticsRequest { diff --git a/MFCCreoDll/x64/Debug/AuthManager.obj b/MFCCreoDll/x64/Debug/AuthManager.obj index ded54ca..02111ca 100644 Binary files a/MFCCreoDll/x64/Debug/AuthManager.obj and b/MFCCreoDll/x64/Debug/AuthManager.obj differ diff --git a/MFCCreoDll/x64/Debug/CreoManager.obj b/MFCCreoDll/x64/Debug/CreoManager.obj index 11adc84..b1b2580 100644 Binary files a/MFCCreoDll/x64/Debug/CreoManager.obj and b/MFCCreoDll/x64/Debug/CreoManager.obj differ diff --git a/MFCCreoDll/x64/Debug/GeometryAnalyzer.obj b/MFCCreoDll/x64/Debug/GeometryAnalyzer.obj index af8ea9b..2b251ba 100644 Binary files a/MFCCreoDll/x64/Debug/GeometryAnalyzer.obj and b/MFCCreoDll/x64/Debug/GeometryAnalyzer.obj differ diff --git a/MFCCreoDll/x64/Debug/HierarchyStatisticsAnalyzer.obj b/MFCCreoDll/x64/Debug/HierarchyStatisticsAnalyzer.obj new file mode 100644 index 0000000..a3367e0 Binary files /dev/null and b/MFCCreoDll/x64/Debug/HierarchyStatisticsAnalyzer.obj differ diff --git a/MFCCreoDll/x64/Debug/HttpRouter.obj b/MFCCreoDll/x64/Debug/HttpRouter.obj index 80d271b..898b9ce 100644 Binary files a/MFCCreoDll/x64/Debug/HttpRouter.obj and b/MFCCreoDll/x64/Debug/HttpRouter.obj differ diff --git a/MFCCreoDll/x64/Debug/HttpServer.obj b/MFCCreoDll/x64/Debug/HttpServer.obj index f49b6c9..749013b 100644 Binary files a/MFCCreoDll/x64/Debug/HttpServer.obj and b/MFCCreoDll/x64/Debug/HttpServer.obj differ diff --git a/MFCCreoDll/x64/Debug/JsonHelper.obj b/MFCCreoDll/x64/Debug/JsonHelper.obj index d8962e5..366c302 100644 Binary files a/MFCCreoDll/x64/Debug/JsonHelper.obj and b/MFCCreoDll/x64/Debug/JsonHelper.obj differ diff --git a/MFCCreoDll/x64/Debug/Logger.obj b/MFCCreoDll/x64/Debug/Logger.obj index 52254ad..f99ffd4 100644 Binary files a/MFCCreoDll/x64/Debug/Logger.obj and b/MFCCreoDll/x64/Debug/Logger.obj differ diff --git a/MFCCreoDll/x64/Debug/MFCCreoDll.obj b/MFCCreoDll/x64/Debug/MFCCreoDll.obj index 10550e1..fae840c 100644 Binary files a/MFCCreoDll/x64/Debug/MFCCreoDll.obj and b/MFCCreoDll/x64/Debug/MFCCreoDll.obj differ diff --git a/MFCCreoDll/x64/Debug/MFCCreoDll.pch b/MFCCreoDll/x64/Debug/MFCCreoDll.pch index 25e0ee1..8927b77 100644 Binary files a/MFCCreoDll/x64/Debug/MFCCreoDll.pch and b/MFCCreoDll/x64/Debug/MFCCreoDll.pch differ diff --git a/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/CL.command.1.tlog b/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/CL.command.1.tlog index 78d2915..56e2c46 100644 Binary files a/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/CL.command.1.tlog and b/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/CL.command.1.tlog differ diff --git a/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/CL.read.1.tlog b/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/CL.read.1.tlog index adbb92b..195374a 100644 Binary files a/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/CL.read.1.tlog and b/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/CL.read.1.tlog differ diff --git a/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/CL.write.1.tlog b/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/CL.write.1.tlog index d625d09..0012a4e 100644 Binary files a/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/CL.write.1.tlog and b/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/CL.write.1.tlog differ diff --git a/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/Cl.items.tlog b/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/Cl.items.tlog index 83000b4..5757a7f 100644 --- a/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/Cl.items.tlog +++ b/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/Cl.items.tlog @@ -1,12 +1,15 @@ C:\Users\sladr\source\repos\MFCCreoDll\AuthManager.cpp;C:\Users\sladr\source\repos\MFCCreoDll\MFCCreoDll\x64\Debug\AuthManager.obj C:\Users\sladr\source\repos\MFCCreoDll\CreoManager.cpp;C:\Users\sladr\source\repos\MFCCreoDll\MFCCreoDll\x64\Debug\CreoManager.obj C:\Users\sladr\source\repos\MFCCreoDll\GeometryAnalyzer.cpp;C:\Users\sladr\source\repos\MFCCreoDll\MFCCreoDll\x64\Debug\GeometryAnalyzer.obj +C:\Users\sladr\source\repos\MFCCreoDll\HierarchyStatisticsAnalyzer.cpp;C:\Users\sladr\source\repos\MFCCreoDll\MFCCreoDll\x64\Debug\HierarchyStatisticsAnalyzer.obj C:\Users\sladr\source\repos\MFCCreoDll\HttpRouter.cpp;C:\Users\sladr\source\repos\MFCCreoDll\MFCCreoDll\x64\Debug\HttpRouter.obj C:\Users\sladr\source\repos\MFCCreoDll\HttpServer.cpp;C:\Users\sladr\source\repos\MFCCreoDll\MFCCreoDll\x64\Debug\HttpServer.obj C:\Users\sladr\source\repos\MFCCreoDll\JsonHelper.cpp;C:\Users\sladr\source\repos\MFCCreoDll\MFCCreoDll\x64\Debug\JsonHelper.obj C:\Users\sladr\source\repos\MFCCreoDll\Logger.cpp;C:\Users\sladr\source\repos\MFCCreoDll\MFCCreoDll\x64\Debug\Logger.obj C:\Users\sladr\source\repos\MFCCreoDll\MFCCreoDll.cpp;C:\Users\sladr\source\repos\MFCCreoDll\MFCCreoDll\x64\Debug\MFCCreoDll.obj C:\Users\sladr\source\repos\MFCCreoDll\ModelAnalyzer.cpp;C:\Users\sladr\source\repos\MFCCreoDll\MFCCreoDll\x64\Debug\ModelAnalyzer.obj +C:\Users\sladr\source\repos\MFCCreoDll\ModelSearchEngine.cpp;C:\Users\sladr\source\repos\MFCCreoDll\MFCCreoDll\x64\Debug\ModelSearchEngine.obj +C:\Users\sladr\source\repos\MFCCreoDll\ModelSearchHandler.cpp;C:\Users\sladr\source\repos\MFCCreoDll\MFCCreoDll\x64\Debug\ModelSearchHandler.obj C:\Users\sladr\source\repos\MFCCreoDll\PathDeleteManager.cpp;C:\Users\sladr\source\repos\MFCCreoDll\MFCCreoDll\x64\Debug\PathDeleteManager.obj C:\Users\sladr\source\repos\MFCCreoDll\pch.cpp;C:\Users\sladr\source\repos\MFCCreoDll\MFCCreoDll\x64\Debug\pch.obj C:\Users\sladr\source\repos\MFCCreoDll\ServerManager.cpp;C:\Users\sladr\source\repos\MFCCreoDll\MFCCreoDll\x64\Debug\ServerManager.obj diff --git a/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/MFCCreoDll.lastbuildstate b/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/MFCCreoDll.lastbuildstate index 891ae9c..f87ad5f 100644 --- a/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/MFCCreoDll.lastbuildstate +++ b/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/MFCCreoDll.lastbuildstate @@ -1,2 +1,2 @@ -PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.41.34120:TargetPlatformVersion=10.0.16299.0:VcpkgTriplet=x64-windows: +PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.41.34120:TargetPlatformVersion=10.0.16299.0: Debug|x64|C:\Users\sladr\source\repos\MFCCreoDll\| diff --git a/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/link.command.1.tlog b/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/link.command.1.tlog index 094ab5a..ebb7438 100644 Binary files a/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/link.command.1.tlog and b/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/link.command.1.tlog differ diff --git a/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/link.read.1.tlog b/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/link.read.1.tlog index 76a0473..ebc0614 100644 Binary files a/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/link.read.1.tlog and b/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/link.read.1.tlog differ diff --git a/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/link.secondary.1.tlog b/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/link.secondary.1.tlog index 24b6142..1b6a09e 100644 --- a/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/link.secondary.1.tlog +++ b/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/link.secondary.1.tlog @@ -1,3 +1,3 @@ -^C:\USERS\SLADR\SOURCE\REPOS\MFCCREODLL\MFCCREODLL\X64\DEBUG\AUTHMANAGER.OBJ|C:\USERS\SLADR\SOURCE\REPOS\MFCCREODLL\MFCCREODLL\X64\DEBUG\CREOMANAGER.OBJ|C:\USERS\SLADR\SOURCE\REPOS\MFCCREODLL\MFCCREODLL\X64\DEBUG\GEOMETRYANALYZER.OBJ|C:\USERS\SLADR\SOURCE\REPOS\MFCCREODLL\MFCCREODLL\X64\DEBUG\HTTPROUTER.OBJ|C:\USERS\SLADR\SOURCE\REPOS\MFCCREODLL\MFCCREODLL\X64\DEBUG\HTTPSERVER.OBJ|C:\USERS\SLADR\SOURCE\REPOS\MFCCREODLL\MFCCREODLL\X64\DEBUG\JSONHELPER.OBJ|C:\USERS\SLADR\SOURCE\REPOS\MFCCREODLL\MFCCREODLL\X64\DEBUG\LOGGER.OBJ|C:\USERS\SLADR\SOURCE\REPOS\MFCCREODLL\MFCCREODLL\X64\DEBUG\MFCCREODLL.OBJ|C:\USERS\SLADR\SOURCE\REPOS\MFCCREODLL\MFCCREODLL\X64\DEBUG\MFCCREODLL.RES|C:\USERS\SLADR\SOURCE\REPOS\MFCCREODLL\MFCCREODLL\X64\DEBUG\MODELANALYZER.OBJ|C:\USERS\SLADR\SOURCE\REPOS\MFCCREODLL\MFCCREODLL\X64\DEBUG\PATHDELETEMANAGER.OBJ|C:\USERS\SLADR\SOURCE\REPOS\MFCCREODLL\MFCCREODLL\X64\DEBUG\PCH.OBJ|C:\USERS\SLADR\SOURCE\REPOS\MFCCREODLL\MFCCREODLL\X64\DEBUG\SERVERMANAGER.OBJ|C:\USERS\SLADR\SOURCE\REPOS\MFCCREODLL\MFCCREODLL\X64\DEBUG\SHELLEXPORTHANDLER.OBJ|C:\USERS\SLADR\SOURCE\REPOS\MFCCREODLL\MFCCREODLL\X64\DEBUG\SHRINKWRAPMANAGER.OBJ|C:\USERS\SLADR\SOURCE\REPOS\MFCCREODLL\MFCCREODLL\X64\DEBUG\WEBSOCKETSERVER.OBJ +^C:\USERS\SLADR\SOURCE\REPOS\MFCCREODLL\MFCCREODLL\X64\DEBUG\AUTHMANAGER.OBJ|C:\USERS\SLADR\SOURCE\REPOS\MFCCREODLL\MFCCREODLL\X64\DEBUG\CREOMANAGER.OBJ|C:\USERS\SLADR\SOURCE\REPOS\MFCCREODLL\MFCCREODLL\X64\DEBUG\GEOMETRYANALYZER.OBJ|C:\USERS\SLADR\SOURCE\REPOS\MFCCREODLL\MFCCREODLL\X64\DEBUG\HIERARCHYSTATISTICSANALYZER.OBJ|C:\USERS\SLADR\SOURCE\REPOS\MFCCREODLL\MFCCREODLL\X64\DEBUG\HTTPROUTER.OBJ|C:\USERS\SLADR\SOURCE\REPOS\MFCCREODLL\MFCCREODLL\X64\DEBUG\HTTPSERVER.OBJ|C:\USERS\SLADR\SOURCE\REPOS\MFCCREODLL\MFCCREODLL\X64\DEBUG\JSONHELPER.OBJ|C:\USERS\SLADR\SOURCE\REPOS\MFCCREODLL\MFCCREODLL\X64\DEBUG\LOGGER.OBJ|C:\USERS\SLADR\SOURCE\REPOS\MFCCREODLL\MFCCREODLL\X64\DEBUG\MFCCREODLL.OBJ|C:\USERS\SLADR\SOURCE\REPOS\MFCCREODLL\MFCCREODLL\X64\DEBUG\MFCCREODLL.RES|C:\USERS\SLADR\SOURCE\REPOS\MFCCREODLL\MFCCREODLL\X64\DEBUG\MODELANALYZER.OBJ|C:\USERS\SLADR\SOURCE\REPOS\MFCCREODLL\MFCCREODLL\X64\DEBUG\MODELSEARCHENGINE.OBJ|C:\USERS\SLADR\SOURCE\REPOS\MFCCREODLL\MFCCREODLL\X64\DEBUG\MODELSEARCHHANDLER.OBJ|C:\USERS\SLADR\SOURCE\REPOS\MFCCREODLL\MFCCREODLL\X64\DEBUG\PATHDELETEMANAGER.OBJ|C:\USERS\SLADR\SOURCE\REPOS\MFCCREODLL\MFCCREODLL\X64\DEBUG\PCH.OBJ|C:\USERS\SLADR\SOURCE\REPOS\MFCCREODLL\MFCCREODLL\X64\DEBUG\SERVERMANAGER.OBJ|C:\USERS\SLADR\SOURCE\REPOS\MFCCREODLL\MFCCREODLL\X64\DEBUG\SHELLEXPORTHANDLER.OBJ|C:\USERS\SLADR\SOURCE\REPOS\MFCCREODLL\MFCCREODLL\X64\DEBUG\SHRINKWRAPMANAGER.OBJ|C:\USERS\SLADR\SOURCE\REPOS\MFCCREODLL\MFCCREODLL\X64\DEBUG\WEBSOCKETSERVER.OBJ C:\Users\sladr\source\repos\MFCCreoDll\x64\Debug\MFCCreoDll.lib C:\Users\sladr\source\repos\MFCCreoDll\x64\Debug\MFCCreoDll.EXP diff --git a/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/link.write.1.tlog b/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/link.write.1.tlog index f1f58be..a2b8b0c 100644 Binary files a/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/link.write.1.tlog and b/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/link.write.1.tlog differ diff --git a/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/rc.command.1.tlog b/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/rc.command.1.tlog index bc6fab2..bb78384 100644 Binary files a/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/rc.command.1.tlog and b/MFCCreoDll/x64/Debug/MFCCreoDll.tlog/rc.command.1.tlog differ diff --git a/MFCCreoDll/x64/Debug/ModelAnalyzer.obj b/MFCCreoDll/x64/Debug/ModelAnalyzer.obj index b1f66d6..dcf5c43 100644 Binary files a/MFCCreoDll/x64/Debug/ModelAnalyzer.obj and b/MFCCreoDll/x64/Debug/ModelAnalyzer.obj differ diff --git a/MFCCreoDll/x64/Debug/ModelSearchEngine.obj b/MFCCreoDll/x64/Debug/ModelSearchEngine.obj new file mode 100644 index 0000000..8b26dc3 Binary files /dev/null and b/MFCCreoDll/x64/Debug/ModelSearchEngine.obj differ diff --git a/MFCCreoDll/x64/Debug/ModelSearchHandler.obj b/MFCCreoDll/x64/Debug/ModelSearchHandler.obj new file mode 100644 index 0000000..d72f55a Binary files /dev/null and b/MFCCreoDll/x64/Debug/ModelSearchHandler.obj differ diff --git a/MFCCreoDll/x64/Debug/PathDeleteManager.obj b/MFCCreoDll/x64/Debug/PathDeleteManager.obj index b78e886..d9b5ffe 100644 Binary files a/MFCCreoDll/x64/Debug/PathDeleteManager.obj and b/MFCCreoDll/x64/Debug/PathDeleteManager.obj differ diff --git a/MFCCreoDll/x64/Debug/ServerManager.obj b/MFCCreoDll/x64/Debug/ServerManager.obj index b4d7e6d..d5f459e 100644 Binary files a/MFCCreoDll/x64/Debug/ServerManager.obj and b/MFCCreoDll/x64/Debug/ServerManager.obj differ diff --git a/MFCCreoDll/x64/Debug/ShellExportHandler.obj b/MFCCreoDll/x64/Debug/ShellExportHandler.obj index 7a56da9..dbdce94 100644 Binary files a/MFCCreoDll/x64/Debug/ShellExportHandler.obj and b/MFCCreoDll/x64/Debug/ShellExportHandler.obj differ diff --git a/MFCCreoDll/x64/Debug/ShrinkwrapManager.obj b/MFCCreoDll/x64/Debug/ShrinkwrapManager.obj index 05c3c30..f8e46dd 100644 Binary files a/MFCCreoDll/x64/Debug/ShrinkwrapManager.obj and b/MFCCreoDll/x64/Debug/ShrinkwrapManager.obj differ diff --git a/MFCCreoDll/x64/Debug/WebSocketServer.obj b/MFCCreoDll/x64/Debug/WebSocketServer.obj index ea2fc94..0f1b280 100644 Binary files a/MFCCreoDll/x64/Debug/WebSocketServer.obj and b/MFCCreoDll/x64/Debug/WebSocketServer.obj differ diff --git a/MFCCreoDll/x64/Debug/pch.obj b/MFCCreoDll/x64/Debug/pch.obj index 473bf83..0bbb9d0 100644 Binary files a/MFCCreoDll/x64/Debug/pch.obj and b/MFCCreoDll/x64/Debug/pch.obj differ diff --git a/MFCCreoDll/x64/Debug/vc143.idb b/MFCCreoDll/x64/Debug/vc143.idb index 67ff1f0..0726c92 100644 Binary files a/MFCCreoDll/x64/Debug/vc143.idb and b/MFCCreoDll/x64/Debug/vc143.idb differ diff --git a/MFCCreoDll/x64/Debug/vc143.pdb b/MFCCreoDll/x64/Debug/vc143.pdb index e464a8c..099904a 100644 Binary files a/MFCCreoDll/x64/Debug/vc143.pdb and b/MFCCreoDll/x64/Debug/vc143.pdb differ diff --git a/x64/Debug/MFCCreoDll.dll b/x64/Debug/MFCCreoDll.dll index 9001a8a..825975f 100644 Binary files a/x64/Debug/MFCCreoDll.dll and b/x64/Debug/MFCCreoDll.dll differ diff --git a/x64/Debug/MFCCreoDll.pdb b/x64/Debug/MFCCreoDll.pdb index 59a8824..1509d6f 100644 Binary files a/x64/Debug/MFCCreoDll.pdb and b/x64/Debug/MFCCreoDll.pdb differ