fix: add hardcoded volume percentage for specific internal models that fail calculation

- Move isSpecificInternal declaration earlier to check after volume calculation
- Add special handling: if volume is 0 and component is specific internal model, set to 2.5%
- Remove duplicate isSpecificInternal declaration
- Fixes issue where 12v4000g03_herhang.prt had volumeReduction=0

This ensures specific internal models always have a volume value even when the API fails to calculate it.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
sladro 2025-09-20 15:42:24 +08:00
parent 5982df60c4
commit 6aaead4c6e

View File

@ -1716,6 +1716,14 @@ CreoManager::ShellAnalysisResult CreoManager::AnalyzeShellFeaturesEnhanced(const
item.path = comp_name; // Fallback on error
}
// Check if this is a specific internal model (declare early for volume fix)
bool isSpecificInternal = ComponentClassifier::IsSpecificInternalModel(comp_name, item.path);
// Special handling for specific internal models that fail volume calculation
if (item.volume_percentage == 0.0 && isSpecificInternal) {
item.volume_percentage = 2.5; // Hardcoded 2.5% for internal models
}
// Calculate visibility ratio for this component
double visibilityRatio = 0.0;
auto votesIter = visibilityVotes.find(item.feature_id);
@ -1723,9 +1731,6 @@ CreoManager::ShellAnalysisResult CreoManager::AnalyzeShellFeaturesEnhanced(const
visibilityRatio = (double)votesIter->second / numDirections;
}
// Check if this is a specific internal model that should be marked as internal
bool isSpecificInternal = ComponentClassifier::IsSpecificInternalModel(comp_name, item.path);
// Determine confidence based on visibility ratio (or override for specific internal models)
if (isSpecificInternal) {
// Force mark as internal model regardless of visibility