From d5cf6b2f8b9465b3f69b2af00635f3723c516fd1 Mon Sep 17 00:00:00 2001 From: tian <11429339@qq.com> Date: Tue, 27 Jan 2026 23:57:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=85=E9=99=A4=E8=B7=AF=E5=BE=84=E5=8F=AF?= =?UTF-8?q?=E8=A7=86=E5=8C=96=E4=BB=A5=E9=81=BF=E5=85=8D=E6=88=AA=E5=9B=BE?= =?UTF-8?q?=E5=B9=B2=E6=89=B0=EF=BC=8C=E4=BF=AE=E5=A4=8D=E8=BF=90=E5=8A=A8?= =?UTF-8?q?=E7=89=A9=E4=BD=93pathid=E6=97=A0=E6=95=88=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Core/BatchQueueManager.cs | 15 +++++++++++++-- .../WPF/ViewModels/AnimationControlViewModel.cs | 16 +++++++++++++++- 2 files changed, 28 insertions(+), 3 deletions(-) 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 表