diff --git a/src/Core/BatchQueueManager.cs b/src/Core/BatchQueueManager.cs index 5b77bf6..56c47f4 100644 --- a/src/Core/BatchQueueManager.cs +++ b/src/Core/BatchQueueManager.cs @@ -115,9 +115,20 @@ namespace NavisworksTransport.Core public async Task ProcessQueueAsync() { Autodesk.Navisworks.Api.Progress progress = null; - + try { + // 清除所有路径可视化(避免截图包含之前的路径) + try + { + PathPointRenderPlugin.Instance.ClearAllPaths(); + LogManager.Info("[批处理队列] 已清除所有路径可视化"); + } + catch (Exception ex) + { + LogManager.Warning($"[批处理队列] 清除路径可视化失败: {ex.Message}"); + } + // 开始进度条 progress = Autodesk.Navisworks.Api.Application.BeginProgress( "执行批处理队列", @@ -130,7 +141,7 @@ namespace NavisworksTransport.Core { initialQueueCount = _queue.Count; } - + int completedCount = 0; while (true) diff --git a/src/UI/WPF/ViewModels/AnimationControlViewModel.cs b/src/UI/WPF/ViewModels/AnimationControlViewModel.cs index cb6af4f..1e5ecac 100644 --- a/src/UI/WPF/ViewModels/AnimationControlViewModel.cs +++ b/src/UI/WPF/ViewModels/AnimationControlViewModel.cs @@ -3585,10 +3585,16 @@ namespace NavisworksTransport.UI.WPF.ViewModels // 存储运动物体到 ModelItemReferences 表 if (!UseVirtualVehicle && SelectedAnimatedObject != null) { + LogManager.Info($"[批处理] 准备存储运动物体: {SelectedAnimatedObject.DisplayName}"); var pathIdInfo = GetVehiclePathIdInfo(); - if (pathIdInfo.ModelIndex != 0 && !string.IsNullOrEmpty(pathIdInfo.PathId)) + LogManager.Info($"[批处理] 运动物体 PathId: ModelIndex={pathIdInfo.ModelIndex}, PathId={pathIdInfo.PathId}"); + + // 只要 PathId 不为空就认为是有效的(ModelIndex=0 表示主模型,也是有效的) + if (!string.IsNullOrEmpty(pathIdInfo.PathId)) { var db = _pathPlanningManager?.GetPathDatabase(); + LogManager.Info($"[批处理] PathDatabase 是否为 null: {db == null}"); + if (db != null) { await db.AddModelItemReferenceAsync( @@ -3603,6 +3609,14 @@ namespace NavisworksTransport.UI.WPF.ViewModels LogManager.Info($"[批处理] 已存储运动物体: {SelectedAnimatedObject.DisplayName}"); } } + else + { + LogManager.Warning($"[批处理] 运动物体 PathId 无效,跳过存储"); + } + } + else + { + LogManager.Info($"[批处理] 跳过存储运动物体: UseVirtualVehicle={UseVirtualVehicle}, SelectedAnimatedObject 是否为 null={SelectedAnimatedObject == null}"); } // 存储手工指定的碰撞检测目标到 ModelItemReferences 表