From 70fee3cf3aef69d9bd35307c9d51f7693f297b82 Mon Sep 17 00:00:00 2001 From: tian <11429339@qq.com> Date: Tue, 7 Jul 2026 20:38:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=A2=B0=E6=92=9E=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=E5=AE=B9=E5=B7=AE=E5=8D=95=E4=BD=8D=E9=94=99=E8=AF=AF=20&=20?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E8=B7=AF=E5=BE=84=E5=A2=9E=E9=87=8F=E5=88=B7?= =?UTF-8?q?=E6=96=B0;=20docs:=20AGENTS.md=20=E6=9E=84=E5=BB=BA=E8=84=9A?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AGENTS.md | 13 ++-- .../GenerateCollisionReportCommand.cs | 3 +- src/UI/WPF/ViewModels/PathEditingViewModel.cs | 68 ++++--------------- 3 files changed, 26 insertions(+), 58 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index fde719a..7f21017 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -19,8 +19,13 @@ ### 构建流水线(必须串行,不可并行) ```bash -./compile.bat # 1. 编译 -./deploy-plugin.bat # 2. 等待编译确认成功后部署 +./build-and-deploy.bat # 编译+部署(推荐) +``` + +如需单独操作: +```bash +./compile.bat # 仅编译 +./deploy-plugin.bat # 仅部署(编译通过后) ``` **严禁**:加 `cmd.exe /c` 前缀、直接调 MSBuild、拆 PowerShell 逻辑、改 `powershell` 为 `pwsh`。 @@ -29,9 +34,9 @@ | 允许并行(纯读取) | 禁止并行(产出/锁文件) | |---|---| -| rg, ls, Get-Content, 读日志 | compile, deploy, run-unit-tests, 启动 NW | +| rg, ls, Get-Content, 读日志 | build-and-deploy, compile, deploy, run-unit-tests, 启动 NW | -`run-unit-tests → compile → deploy` 是单通道流水线,不可拆分并行。 +`run-unit-tests → build-and-deploy` 是单通道流水线,不可拆分并行。 ### 路径 diff --git a/src/Commands/GenerateCollisionReportCommand.cs b/src/Commands/GenerateCollisionReportCommand.cs index 6b737a8..4b4ee1b 100644 --- a/src/Commands/GenerateCollisionReportCommand.cs +++ b/src/Commands/GenerateCollisionReportCommand.cs @@ -8,6 +8,7 @@ using Autodesk.Navisworks.Api; using Autodesk.Navisworks.Api.Clash; using NavisworksTransport.Core; using NavisworksTransport.Core.Animation; +using NavisworksTransport.Core.Config; using NavisworksTransport.Utils; using NavisworksTransport.Utils.CoordinateSystem; using NavisworksTransport.UI.WPF.Views; @@ -223,7 +224,7 @@ namespace NavisworksTransport.Commands { result.FrameRate = animationManager.AnimationFrameRate; result.Duration = animationManager.AnimationDuration; - result.DetectionTolerance = animationManager.DetectionTolerance; + result.DetectionTolerance = ConfigManager.Instance.Current.Animation.DetectionToleranceMeters; } // 从数据库记录填充路径信息 diff --git a/src/UI/WPF/ViewModels/PathEditingViewModel.cs b/src/UI/WPF/ViewModels/PathEditingViewModel.cs index 8e7fe0d..020a466 100644 --- a/src/UI/WPF/ViewModels/PathEditingViewModel.cs +++ b/src/UI/WPF/ViewModels/PathEditingViewModel.cs @@ -5744,7 +5744,21 @@ namespace NavisworksTransport.UI.WPF.ViewModels } } - RefreshPathRoutes(); + var existingIds = new HashSet(PathRoutes.Select(r => r.Route.Id)); + foreach (var coreRoute in _pathPlanningManager.Routes) + { + if (!existingIds.Add(coreRoute.Id)) continue; + + var pathViewModel = new PathRouteViewModel(isFromDatabase: true) + { + Route = coreRoute, + IsActive = false + }; + pathViewModel.SetTimeInfo(coreRoute.CreatedTime, coreRoute.LastModified); + foreach (var pt in CreatePathPointViewModelsFromCoreRoute(coreRoute)) + pathViewModel.Points.Add(pt); + PathRoutes.Add(pathViewModel); + } // 自动选择第一个路径 if (PathRoutes.Count > 0) @@ -6031,58 +6045,6 @@ namespace NavisworksTransport.UI.WPF.ViewModels } } - - /// - /// 刷新路径集合显示 - /// - private void RefreshPathRoutes() - { - try - { - if (_pathPlanningManager?.Routes != null) - { - // 清除现有的UI路径 - PathRoutes.Clear(); - - // 重新加载所有路径 - foreach (var coreRoute in _pathPlanningManager.Routes) - { - var pathViewModel = new PathRouteViewModel(isFromDatabase: true) - { - Route = coreRoute, - IsActive = false - }; - - // 设置时间信息 - pathViewModel.SetTimeInfo(coreRoute.CreatedTime, coreRoute.LastModified); - - // 使用统一的辅助方法创建路径点 - var pathPoints = CreatePathPointViewModelsFromCoreRoute(coreRoute); - foreach (var point in pathPoints) - { - pathViewModel.Points.Add(point); - } - - PathRoutes.Add(pathViewModel); - LogManager.Info($"RefreshPathRoutes: 添加路径ViewModel {coreRoute.Name} (Hash: {pathViewModel.GetHashCode()})"); - } - - LogManager.Info($"已刷新路径集合显示,共 {PathRoutes.Count} 个路径"); - - // 调试:列出所有PathRoutes中的路径名称和哈希码 - for (int i = 0; i < PathRoutes.Count; i++) - { - var route = PathRoutes[i]; - LogManager.Info($" PathRoutes[{i}]: {route.Name} (Hash: {route.GetHashCode()}, Points: {route.Points.Count})"); - } - } - } - catch (Exception ex) - { - LogManager.Error($"刷新路径集合失败: {ex.Message}", ex); - } - } - #endregion #endregion