diff --git a/src/UI/WPF/ViewModels/AnimationControlViewModel.cs b/src/UI/WPF/ViewModels/AnimationControlViewModel.cs index 402c448..ac60081 100644 --- a/src/UI/WPF/ViewModels/AnimationControlViewModel.cs +++ b/src/UI/WPF/ViewModels/AnimationControlViewModel.cs @@ -1492,7 +1492,7 @@ namespace NavisworksTransport.UI.WPF.ViewModels UpdateMainStatus("碰撞报告已显示"); LogManager.Info("成功显示缓存的碰撞报告"); } - else + else if (!AutomationModeContext.IsAutomaticMode) { UpdateMainStatus("显示报告对话框失败"); LogManager.Error("CollisionReportDialog.ShowReport返回null"); diff --git a/src/UI/WPF/Views/CollisionAnalysisDialog.xaml.cs b/src/UI/WPF/Views/CollisionAnalysisDialog.xaml.cs index 54b6784..d1fd34f 100644 --- a/src/UI/WPF/Views/CollisionAnalysisDialog.xaml.cs +++ b/src/UI/WPF/Views/CollisionAnalysisDialog.xaml.cs @@ -81,6 +81,28 @@ namespace NavisworksTransport.UI.WPF.Views } LogManager.Info("[碰撞分析] 测试自动化已接管分析窗口,自动选择继续生成"); + + // 🔥 自动模式下清除所有预选排除: + // 智能预选(碰撞>100次或>50%)可能排除全部候选项(如唯一候选被选中), + // 导致后续检测无任何对象。默认动作 = 去掉选择 + 继续生成动画(检测所有物体)。 + int clearedCount = 0; + if (HotspotsDataGrid.ItemsSource is System.Collections.IEnumerable items) + { + foreach (var vm in items.OfType()) + { + if (vm.IsExcluded) + { + vm.IsExcluded = false; + clearedCount++; + } + } + } + + if (clearedCount > 0) + { + LogManager.Info($"[碰撞分析] 自动模式下已清除 {clearedCount} 个预选排除(避免排除全部候选项导致无检测对象)"); + } + ModelHighlightHelper.ClearCategory(PrecomputedHighlightCategory); SelectedAction = CollisionAnalysisAction.Continue; Close(); diff --git a/src/UI/WPF/Views/CollisionReportDialog.xaml.cs b/src/UI/WPF/Views/CollisionReportDialog.xaml.cs index 21c60be..eab69f0 100644 --- a/src/UI/WPF/Views/CollisionReportDialog.xaml.cs +++ b/src/UI/WPF/Views/CollisionReportDialog.xaml.cs @@ -3,6 +3,7 @@ using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Media; +using NavisworksTransport.Utils; using NavisworksTransport.UI.WPF.ViewModels; using NavisworksTransport.Commands; using CollisionReportScreenshot = NavisworksTransport.Commands.CollisionReportScreenshot; @@ -368,6 +369,14 @@ namespace NavisworksTransport.UI.WPF.Views /// 对话框实例 public static CollisionReportDialog ShowReport(CollisionReportResult reportResult, Window owner = null) { + // 自动模式(批处理/自动测试)下跳过碰撞报告窗口: + // 报告数据已落库/日志,避免残留窗口阻塞自动化流程 + if (AutomationModeContext.IsAutomaticMode) + { + LogManager.Info("[碰撞报告] 自动模式下跳过碰撞报告窗口(数据已保存至检测记录)"); + return null; + } + try { lock (_lock)