纠正批处理截图使用当前路径和路径可未视化的问题

This commit is contained in:
tian 2026-01-27 13:36:27 +08:00
parent 423290bfd1
commit 8a3d480a0a
2 changed files with 27 additions and 12 deletions

View File

@ -715,21 +715,25 @@ namespace NavisworksTransport.Commands
/// <summary>
/// 创建综合报告命令
/// </summary>
public static GenerateCollisionReportCommand CreateComprehensive(bool hasHighlighted = false)
/// <param name="pathRouteId">路径ID用于视角调整如果为空则使用全局CurrentRoute</param>
/// <param name="hasHighlighted">碰撞结果是否已经被高亮</param>
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

View File

@ -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)
{