diff --git a/src/Commands/GenerateCollisionReportCommand.cs b/src/Commands/GenerateCollisionReportCommand.cs index 2718dc6..8abb73a 100644 --- a/src/Commands/GenerateCollisionReportCommand.cs +++ b/src/Commands/GenerateCollisionReportCommand.cs @@ -715,21 +715,25 @@ namespace NavisworksTransport.Commands /// /// 创建综合报告命令 /// - public static GenerateCollisionReportCommand CreateComprehensive(bool hasHighlighted = false) + /// 路径ID(用于视角调整),如果为空则使用全局CurrentRoute + /// 碰撞结果是否已经被高亮 + public static GenerateCollisionReportCommand CreateComprehensive(string pathRouteId = null, bool hasHighlighted = false) { - // 获取当前路径ID - string pathRouteId = string.Empty; - try + // 如果没有传入路径ID,则从全局CurrentRoute获取 + if (string.IsNullOrEmpty(pathRouteId)) { - var currentRoute = PathPlanningManager.Instance?.CurrentRoute; - if (currentRoute != null) + try { - pathRouteId = currentRoute.Id; + var currentRoute = PathPlanningManager.Instance?.CurrentRoute; + if (currentRoute != null) + { + pathRouteId = currentRoute.Id; + } + } + catch (Exception ex) + { + LogManager.Error($"获取当前路径ID失败: {ex.Message}"); } - } - catch (Exception ex) - { - LogManager.Error($"获取当前路径ID失败: {ex.Message}"); } return new GenerateCollisionReportCommand(new CollisionReportParameters diff --git a/src/Core/BatchQueueManager.cs b/src/Core/BatchQueueManager.cs index 41c0d4e..5130a61 100644 --- a/src/Core/BatchQueueManager.cs +++ b/src/Core/BatchQueueManager.cs @@ -351,12 +351,23 @@ namespace NavisworksTransport.Core { try { - var reportCommand = Commands.GenerateCollisionReportCommand.CreateComprehensive(hasHighlighted: false); + // 渲染路径可视化(确保路径在截图中可见) + PathPointRenderPlugin.Instance.RenderPath(pathRoute); + LogManager.Info($"[批处理队列] 已渲染路径可视化: {pathRoute.Name}"); + + var reportCommand = Commands.GenerateCollisionReportCommand.CreateComprehensive( + pathRouteId: item.PathRouteId, // 使用任务自己的路径ID + hasHighlighted: false + ); reportCommand.SetTestName(testName); // 同步执行报告生成(在UI线程中) var reportTask = reportCommand.ExecuteAsync(); reportTask.Wait(); // 等待报告生成完成 + + // 清除路径可视化(避免影响下一个任务) + PathPointRenderPlugin.Instance.RemovePath(pathRoute.Id); + LogManager.Info($"[批处理队列] 已清除路径可视化: {pathRoute.Name}"); } catch (Exception reportEx) {