From 854bc2edc9f7ee47241e5f7274df4670d7fc08d4 Mon Sep 17 00:00:00 2001 From: sladro Date: Sat, 20 Sep 2025 09:43:41 +0800 Subject: [PATCH] add: multiple debug log points to trace execution flow --- CreoManager.cpp | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/CreoManager.cpp b/CreoManager.cpp index 6d811bb..e41db26 100644 --- a/CreoManager.cpp +++ b/CreoManager.cpp @@ -1562,6 +1562,21 @@ CreoManager::HierarchyDeleteResult CreoManager::DeleteHierarchyComponents(const CreoManager::ShellAnalysisResult CreoManager::AnalyzeShellFeaturesEnhanced(const ShellAnalysisRequest& request) { ShellAnalysisResult result; + // Create analysis log file immediately + try { + SessionInfo sessionInfo = GetSessionInfo(); + if (sessionInfo.is_valid) { + xstring workdir = sessionInfo.session->GetCurrentDirectory(); + std::string workingDir = XStringToString(workdir); + std::string logPath = workingDir + "\\shell_analysis_start.txt"; + std::ofstream logFile(logPath); + logFile << "Shell Analysis Started" << std::endl; + logFile << "Time: " << GetCurrentTimeString() << std::endl; + logFile << "Working Directory: " << workingDir << std::endl; + logFile.close(); + } + } catch (...) {} + try { // Get session SessionInfo sessionInfo = GetSessionInfo(); @@ -1857,6 +1872,20 @@ CreoManager::ShellAnalysisResult CreoManager::AnalyzeShellFeaturesEnhanced(const // Shell Analysis implementation using real OTK geometry APIs CreoManager::ShellAnalysisResult CreoManager::AnalyzeShellFeatures(const ShellAnalysisRequest& request) { + // Create test log file immediately + try { + SessionInfo sessionInfo = GetSessionInfo(); + if (sessionInfo.is_valid) { + xstring workdir = sessionInfo.session->GetCurrentDirectory(); + std::string workingDir = XStringToString(workdir); + std::string testPath = workingDir + "\\test_log.txt"; + std::ofstream testFile(testPath); + testFile << "Test log created at: " << GetCurrentTimeString() << std::endl; + testFile << "Working dir: " << workingDir << std::endl; + testFile.close(); + } + } catch (...) {} + return AnalyzeShellFeaturesEnhanced(request); } // Geometry analysis: determine if feature touches model boundary @@ -2776,6 +2805,21 @@ std::pair CreoManager::CalculateOBBProjectionRange(const OBB& ob CreoManager::ProjectionAnalysisData CreoManager::PerformMultiDirectionalProjectionAnalysis(pfcAssembly_ptr assembly) { ProjectionAnalysisData result; + // Create projection analysis log file + try { + SessionInfo sessionInfo = GetSessionInfo(); + if (sessionInfo.is_valid) { + xstring workdir = sessionInfo.session->GetCurrentDirectory(); + std::string workingDir = XStringToString(workdir); + std::string logPath = workingDir + "\\projection_analysis.txt"; + std::ofstream logFile(logPath); + logFile << "Projection Analysis Started" << std::endl; + logFile << "Time: " << GetCurrentTimeString() << std::endl; + logFile << "Working Directory: " << workingDir << std::endl; + logFile.close(); + } + } catch (...) {} + // Step 1: Collect all components result.components = CollectAllComponents(assembly);