From a46568f43e54d5fbe6569cfcc04bcf379cdc844b Mon Sep 17 00:00:00 2001 From: tian <11429339@qq.com> Date: Sat, 11 Oct 2025 10:03:22 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8D=87=E7=BA=A7=E5=88=B00.?= =?UTF-8?q?13.0=EF=BC=9A=201=E3=80=81=E6=A0=B8=E5=BF=83=E7=AA=81=E7=A0=B4?= =?UTF-8?q?=203D=E8=B7=AF=E5=BE=84=E8=A7=84=E5=88=92=E7=B3=BB=E7=BB=9F=20-?= =?UTF-8?q?=20Graph=E6=9B=BF=E4=BB=A3Grid=EF=BC=8C=E7=9C=9F=E6=AD=A3?= =?UTF-8?q?=E7=9A=843D=E8=B7=AF=E5=BE=84=E8=A7=84=E5=88=92=20=E9=AB=98?= =?UTF-8?q?=E5=BA=A6=E5=B1=82=E7=BD=91=E6=A0=BC=20-=20=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E6=A5=BC=E6=A2=AF=E3=80=81=E6=96=9C=E9=9D=A2=E7=AD=89=E5=A4=8D?= =?UTF-8?q?=E6=9D=82=E5=A4=9A=E5=B1=82=E5=9C=BA=E6=99=AF=20=E7=BD=91?= =?UTF-8?q?=E6=A0=BC=E8=86=A8=E8=83=80=E7=AE=97=E6=B3=95=20-=20=E9=9A=9C?= =?UTF-8?q?=E7=A2=8D=E7=89=A9=E5=92=8C=E8=BE=B9=E7=95=8C=E5=88=86=E7=A6=BB?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=EF=BC=8C=E6=8F=90=E9=AB=98=E7=B2=BE=E5=BA=A6?= =?UTF-8?q?=202=E3=80=81=E6=96=B0=E5=A2=9E=E5=8A=9F=E8=83=BD=20SQLite?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E9=9B=86=E6=88=90=20-=20=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E5=88=86=E6=9E=90=E3=80=81=E7=A2=B0=E6=92=9E=E6=8A=A5?= =?UTF-8?q?=E5=91=8A=E5=AD=98=E5=82=A8=20=E5=AF=BC=E8=88=AA=E5=9C=B0?= =?UTF-8?q?=E5=9B=BE=E7=94=9F=E6=88=90=20-=20=E5=9C=BA=E6=99=AF=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E5=AF=BC=E5=87=BA=E5=8A=9F=E8=83=BD=20=E6=97=A0?= =?UTF-8?q?=E5=85=B3=E9=A1=B9=E8=BF=87=E6=BB=A4=20-=20=E6=96=B0=E7=89=A9?= =?UTF-8?q?=E6=B5=81=E7=B1=BB=E5=9E=8B=EF=BC=8C=E6=8F=90=E9=AB=98=E8=A7=84?= =?UTF-8?q?=E5=88=92=E6=95=88=E7=8E=87=203=E3=80=81=E6=80=A7=E8=83=BD?= =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E7=BD=91=E6=A0=BC=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E6=9C=BA=E5=88=B6=20-=20=E5=A4=A7=E5=B9=85=E6=8F=90=E9=AB=98?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E8=A7=84=E5=88=92=E9=80=9F=E5=BA=A6=20?= =?UTF-8?q?=E9=AB=98=E5=BA=A6=E5=A4=84=E7=90=86=E5=AE=8C=E5=96=84=20-=20?= =?UTF-8?q?=E6=96=9C=E9=9D=A2=E8=B7=AF=E5=BE=84=E3=80=81=E6=A5=BC=E6=A2=AF?= =?UTF-8?q?=E7=BD=91=E6=A0=BC=E7=94=9F=E6=88=90=20=E5=87=A0=E4=BD=95?= =?UTF-8?q?=E4=BD=93=E8=BF=87=E6=BB=A4=20-=20=E9=81=BF=E5=85=8D=E8=AF=AF?= =?UTF-8?q?=E5=88=A4=E9=9A=9C=E7=A2=8D=E7=89=A9=204=E3=80=81=E6=9E=B6?= =?UTF-8?q?=E6=9E=84=E6=B8=85=E7=90=86=20=E5=88=A0=E9=99=A4=E5=86=97?= =?UTF-8?q?=E4=BD=99UIStateMachine=E3=80=81=E6=9C=AA=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E7=9A=84WPF=20Services=20=E5=88=A0=E9=99=A4=E6=89=80=E6=9C=89?= =?UTF-8?q?=E5=90=91=E5=90=8E=E5=85=BC=E5=AE=B9=E4=BB=A3=E7=A0=81=20?= =?UTF-8?q?=E7=AE=80=E5=8C=96=E8=87=AA=E5=8A=A8=E5=AF=BB=E8=B7=AF=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=EF=BC=8C=E6=8F=90=E5=8D=87=E5=8F=AF=E8=AF=BB=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 103 ++++++++ CLAUDE.md | 355 ++++++++++----------------- VERSION.md | 2 +- doc/requirement/todo_features.md | 4 + src/Core/PathDatabase.cs | 2 - src/PathPlanning/GridMapGenerator.cs | 1 - 6 files changed, 235 insertions(+), 232 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e9d8c4..e4b7193 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,108 @@ # NavisworksTransport 变更日志 +## [0.13.0] - 2025-10-11 + +### 🎯 3D路径规划与多层网格系统 - 高度层算法重构 + +#### 核心算法突破 + +##### 3D路径规划系统 + +- **Graph替代Grid架构**: 完善A*算法,用graph代替grid,实现真正的3D路径规划 +- **高度层网格系统**: 给网格增加高度层概念,支持楼面上的楼梯等复杂场景 +- **多层边界处理**: 识别多层边界进行膨胀,每层增加IsWalkable属性 +- **3D障碍物投影**: 支持3D障碍物在网格平面的投影计算 +- **楼梯路径优化**: 改进高度层处理,实现路径从楼面爬上楼梯的功能 + +##### 网格膨胀算法完善 + +- **分离计算策略**: 把障碍物和边界膨胀分开计算,提高精度 +- **楼梯场景修复**: 修复楼梯场景路径不能到达却显示到达的bug +- **边界膨胀优化**: 修复楼梯边界膨胀的bug,确保可通行性判断准确 +- **高度不足区域**: 解决楼梯下高度不足区域的网格可视化问题 + +##### 路径策略算法增强 + +- **安全优先算法**: 完善安全优先和直线优先算法,增加高度层支持 +- **WorldPosition移除**: 去掉cell.WorldPosition,简化数据结构 +- **坐标转换优化**: 修改世界坐标到网格坐标的转换(四舍五入) +- **A*坐标修复**: 测试并修改A*返回的坐标转换问题 + +#### 路径分析与数据管理 + +##### SQLite数据库集成 + +- **文档关联数据库**: 增加文档关联的sqlite数据库支持 +- **路径分析功能**: 实现基本的路径分析功能,统计路径信息 +- **碰撞报告存储**: 把碰撞报告保存到数据库,优化报告格式 +- **参数持久化**: 将车辆最大宽度、长度、高度、安全间隙、网格尺寸加入路径保存内容 + +##### 导航地图生成 + +- **场景图片导出**: 增加生成导航地图功能,保存当前路径场景为图片 +- **可视化增强**: 支持多层网格可视化显示 + +#### 网格生成优化 + +##### 性能与精度提升 + +- **网格缓存机制**: 对生成的网格地图进行缓存,大幅提高路径规划速度 +- **缓存重建优化**: 修改Gridmap缓存重建机制,考虑所有物流构件变化 +- **单位转换修复**: 修复网格生成时的单位转换bug +- **几何体过滤**: 增加过滤snappoints类型几何体,避免误判为障碍物 + +##### 高度处理完善 + +- **斜面路径规划**: 实现路径在斜面(如楼梯)上的规划 +- **通道网格高度**: 修改通道网格生成的高度设置,能在斜面上生成网格 +- **障碍物扫描**: 使用包围盒中心下方通道网格z高度进行范围筛选 +- **高度范围优化**: 用通道高度范围+车辆高度+安全间隙作为过滤范围 +- **z值判断改进**: 修改z值判断为通道网格z值的最小和最大值 + +#### 物流分类系统 + +##### 无关项过滤 + +- **新增物流类型**: 增加"无关项"物流类型,过滤地基、建筑结构等与物流无关的构件 +- **提高规划效率**: 减少无关构件对路径规划的干扰 + +#### 代码架构清理 + +##### 架构简化重构 + +- **删除冗余UIStateMachine**: 阶段一清理工作 +- **删除未使用的WPF Services**: 阶段三清理 +- **删除向后兼容代码**: 阶段四清理,专注2026版本 +- **删除UI文档片段**: 阶段五清理总结 +- **合并动画管理器**: 阶段二架构优化 +- **简化自动寻路代码**: 代码可读性提升 + +#### Bug修复 + +##### 稳定性提升 + +- **网格生成bug**: 修改网格生成和路径规划中的多个bug +- **碰撞报告崩溃**: 修复查看碰撞报告时异步生成产生的崩溃风险 +- **路径可视化**: 优化路径可视化插件的参数初始化过程 + +### 验证结果 ✅ + +- ✅ 3D路径规划系统正常工作,支持楼梯等复杂场景 +- ✅ 多层网格系统稳定运行,高度层概念实现完整 +- ✅ 网格膨胀算法准确,障碍物和边界分离计算 +- ✅ SQLite数据库集成成功,路径分析功能可用 +- ✅ 网格缓存机制有效,路径规划速度显著提升 +- ✅ 代码架构清理完成,向后兼容代码全部移除 + +### 技术里程碑 + +- **3D路径规划**: 从2D网格到3D高度层的算法突破 +- **多层场景支持**: 楼梯、斜面等复杂场景的完整支持 +- **数据持久化**: SQLite数据库集成,路径分析数据化 +- **架构现代化**: 清理遗留代码,专注Navisworks 2026 + +--- + ## [0.12.0] - 2025-09-16 ### 🎯 系统全面升级 - 路径优化、碰撞检测、UI重构与物流属性管理 diff --git a/CLAUDE.md b/CLAUDE.md index 93b08dc..7800fa9 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,313 +1,212 @@ # CLAUDE.md -This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. +NavisworksTransport - Navisworks 2026 物流路径规划插件 (A* 算法、碰撞检测、动画) -## Project Overview +**环境**: Windows 10+, .NET Framework 4.8, C# 7.3 -NavisworksTransport is a Navisworks 2026 plugin for logistics path planning and transportation conflict detection in 3D building models. The plugin supports route optimization, collision detection, and animated object movement along defined paths. +**原则**: 专注 2026,不考虑向后兼容 -**Current Status**: Navisworks 2026 exclusive development - no legacy 2017 compatibility required. Leverages 2026-specific features for enhanced animation and A* pathfinding capabilities. +## 编译与测试 -## Build Commands +```bash +./compile.bat # 必须用 ./ 前缀 -### 标准编译方式 (Windows) +# 单元测试 +powershell -Command "& 'C:\...\MSBuild.exe' AStarTestRunner.csproj /p:Configuration=Debug /p:Platform=AnyCPU" +bin\Debug\AStarTestRunner.exe +``` -- **推荐编译命令**: `./compile.bat` - 在项目根目录下运行的标准方式 -- **重要说明**: 在Windows系统下必须使用 `./` 前缀来运行批处理文件,不要使用 `cmd /c compile.bat` 或其他复杂方式 +**调试**: 日志在 `C:\ProgramData\Autodesk\Navisworks Manage 2026\NavisworksTransport\logs\debug.log` -## Architecture Overview +## 架构 -### Dual Plugin Architecture +### 插件类型 -The system implements multiple Navisworks plugin types working together: +- **MainPlugin.cs**: AddInPlugin - Ribbon UI + 停靠面板 +- **PathClickToolPlugin.cs**: ToolPlugin - 3D 鼠标交互 +- **PathPointRenderPlugin.cs**: RenderPlugin - 3D 可视化 -- **MainPlugin.cs**: Primary AddInPlugin with ribbon UI and DockPanePlugin integration -- **PathClickToolPlugin.cs**: ToolPlugin for 3D mouse interaction and point placement -- **PathPointRenderPlugin.cs**: RenderPlugin for 3D visualization overlay +### 核心管理器 -### Core Management Layer +- PathPlanningManager - A* 路径规划 +- LogisticsAnimationManager - 动画系统 +- TimeLinerIntegrationManager - TimeLiner 集成 +- CategoryAttributeManager - COM API 属性持久化 +- VisibilityManager - 图层控制 +- ModelSplitterManager - 模型导出 -- **PathPlanningManager.cs**: Central coordinator for route planning with A* pathfinding support -- **LogisticsAnimationManager.cs**: Enhanced animation system targeting Navisworks 2026 native components -- **TimeLinerIntegrationManager.cs**: Bridge between custom animations and Navisworks TimeLiner -- **CategoryAttributeManager.cs**: COM API wrapper for persistent logistics attribute management -- **VisibilityManager.cs**: Model layer control and filtering -- **ModelSplitterManager.cs**: Model export and layer separation +### 数据层 -### Data and Coordinate Systems +- PathPlanningModels - 事件驱动状态管理 +- PathDataManager - JSON 序列化 +- CoordinateConverter - 2D↔3D 坐标转换 +- GeometryExtractor - 空间分析 +- FloorDetector - 楼层检测 -- **PathPlanningModels.cs**: Core data structures with event-driven state management -- **PathDataManager.cs**: JSON serialization with migration support -- **CoordinateConverter.cs**: 2D map overlay to 3D world coordinate transformation chains -- **GeometryExtractor.cs**: Spatial analysis and bounding box calculations -- **FloorDetector.cs**: Automatic floor/level detection for multi-story logistics +### UI -#### ⚠️ 模型单位系统 - 极其重要! +- WPF (MVVM): `src\UI\WPF\` - LogisticsControlPanel +- WinForms: 遗留对话框 +- ElementHost 嵌入 -**核心原则:网格地图生成和路径规划中统一使用模型单位(Model Units),不使用米制单位** +## ⚠️ 模型单位系统 - 极其重要 -本项目中出现的大量bug都源于混淆模型单位和米制单位。必须严格遵守以下规则: +**核心**: 网格地图和路径规划**统一使用模型单位**,不用米制。大量 bug 源于混淆单位。 + +### 转换原则 -**1. 单位转换原则** ```csharp -// ✅ 正确做法:在函数入口处一次性转换所有参数 -public GridMap GenerateFromBIM(BoundingBox3D bounds, double cellSize, double vehicleRadius, ...) +// ✅ 函数入口一次性转换 +public GridMap GenerateFromBIM(BoundingBox3D bounds, double cellSize, ...) { - // 第一步:立即转换所有米制参数为模型单位 - double metersToModelUnitsConversionFactor = UnitsConverter.GetMetersToUnitsConversionFactor(Application.ActiveDocument.Units); - double cellSizeInModelUnits = cellSize * metersToModelUnitsConversionFactor; - double vehicleRadiusInModelUnits = vehicleRadius * metersToModelUnitsConversionFactor; - double safetyMarginInModelUnits = safetyMargin * metersToModelUnitsConversionFactor; - double vehicleHeightInModelUnits = vehicleHeight * metersToModelUnitsConversionFactor; - - // 之后所有计算都使用模型单位变量 - var gridMap = new GridMap(bounds, cellSizeInModelUnits); + double factor = UnitsConverter.GetMetersToUnitsConversionFactor(Application.ActiveDocument.Units); + double cellSizeInModelUnits = cellSize * factor; + // 之后全用模型单位 } -// ❌ 错误做法:在计算过程中混用米制和模型单位 +// ❌ 计算中混用单位 ``` -**2. 网格地图内部统一使用模型单位** +### 必须使用模型单位 -GridMapGenerator和AutoPathFinder中的所有空间计算都基于模型单位: -- 网格单元大小(CellSize):模型单位 -- 车辆半径(VehicleRadius):模型单位 -- 安全间隙(SafetyMargin):模型单位 -- 车辆高度(VehicleHeight):模型单位 -- 扫描高度(ScanHeight):模型单位 -- 膨胀半径(InflationRadius):模型单位 -- 高度差阈值(MaxHeightDiff):模型单位 -- 网格坐标和世界坐标转换:模型单位 +GridMapGenerator 和 AutoPathFinder 中所有参数:CellSize, VehicleRadius, SafetyMargin, VehicleHeight, ScanHeight, InflationRadius, MaxHeightDiff -**3. 常见错误模式及避免方法** +### 命名约定 + +- 米制: `xxxMeters` (如 `cellSizeMeters`) +- 模型单位: `xxxInModelUnits` (如 `cellSizeInModelUnits`) +- 转换系数: `metersToModelUnitsConversionFactor` + +### 常见错误 ```csharp -// ❌ 错误:直接使用常量米制值 -private const double MAX_HEIGHT_DIFF = 0.35; // 这是米! -if (heightDiff > MAX_HEIGHT_DIFF) // Bug!heightDiff是模型单位 +// ❌ 直接用米制常量 +private const double MAX_HEIGHT_DIFF = 0.35; // 米! +if (heightDiff > MAX_HEIGHT_DIFF) // Bug! -// ✅ 正确:转换后使用 -private const double MAX_HEIGHT_DIFF_METERS = 0.35; // 明确标注单位 -double maxHeightDiffInModelUnits = MAX_HEIGHT_DIFF_METERS * UnitsConverter.GetMetersToUnitsConversionFactor(); -if (heightDiff > maxHeightDiffInModelUnits) // 正确! +// ✅ 转换后用 +private const double MAX_HEIGHT_DIFF_METERS = 0.35; +double maxHeightDiffInModelUnits = MAX_HEIGHT_DIFF_METERS * factor; -// ❌ 错误:在循环中重复转换 -for (int i = 0; i < count; i++) { - double modelValue = meterValue * UnitsConverter.GetMetersToUnitsConversionFactor(); // 性能浪费 -} +// ❌ 循环中重复转换 +for (...) { double v = x * UnitsConverter.Get...(); } -// ✅ 正确:提前转换一次 -double metersToModelUnits = UnitsConverter.GetMetersToUnitsConversionFactor(); -double modelValue = meterValue * metersToModelUnits; // 转换一次 -for (int i = 0; i < count; i++) { - // 使用modelValue进行计算 -} +// ✅ 提前转换 +double factor = UnitsConverter.Get...(); +double v = x * factor; +for (...) { /* 用 v */ } ``` -**4. 变量命名约定** - -为了避免混淆,强制使用以下命名规范: -- 米制变量:使用`Meters`后缀,如`vehicleHeightMeters`、`cellSizeMeters` -- 模型单位变量:使用`InModelUnits`后缀,如`vehicleHeightInModelUnits`、`cellSizeInModelUnits` -- 转换系数:统一命名为`metersToModelUnitsConversionFactor` - -**5. 关键API的单位约定** +### API 约定 ```csharp -// Navisworks API返回的坐标和尺寸都是模型单位 BoundingBox3D bbox = modelItem.BoundingBox(); // 模型单位 Point3D worldPos = gridMap.GridToWorld3D(gridPos); // 模型单位 -// 用户配置的参数通常是米制 -double cellSize = 0.5; // 米,需要转换 -double vehicleRadius = 0.3; // 米,需要转换 +double cellSize = 0.5; // 米,需转换 ``` -**6. 日志输出最佳实践** +### 日志规范 ```csharp -// ✅ 正确:在日志中明确标注单位 -LogManager.Info($"网格大小: {cellSize}米 → {cellSizeInModelUnits:F2}模型单位"); -LogManager.Info($"高度差阈值: {MAX_HEIGHT_DIFF_METERS}米 = {maxHeightDiffInModelUnits:F2}模型单位"); - -// ❌ 错误:日志中不标注单位,容易造成误解 -LogManager.Info($"网格大小: {cellSize}"); +// ✅ 标注单位 +LogManager.Info($"网格: {cellSize}米 → {cellSizeInModelUnits:F2}模型单位"); ``` -**记住:违反这些规则会导致路径规划失败、碰撞检测错误、网格生成异常等各种难以追踪的bug!** +**违反导致**: 路径失败、碰撞错误、网格异常 -### UI Architecture: WPF + WinForms Hybrid +### 其他关键点 -- **WPF Components**: Modern MVVM-based controls in `src\UI\WPF\` - - LogisticsControlPanel: Main docked interface - - ViewModels with INotifyPropertyChanged pattern - - Separated Views for different functional areas -- **WinForms Dialogs**: Legacy property editing interfaces -- **Integration**: ElementHost for WPF in Navisworks environment +- **网格坐标**: 网格单元**左下角**,非中心 +- **坐标转换**: 多层系统支持 2D→3D -## Key Technical Details +## Navisworks API -### Navisworks API Integration Pattern +### 双 API 策略 -- **Dual API Strategy**: Native API (`Autodesk.Navisworks.Api`) for core functionality + COM API (`Autodesk.Navisworks.ComApi`) for attribute persistence and TimeLiner operations -- **Plugin Architecture**: Three distinct plugin types registered in single assembly -- **Event-Driven Design**: Global exception handling with `GlobalExceptionHandler` class -- **Navisworks 2026 Focus**: Utilizes 2026-specific API features without backward compatibility constraints +- Native API (`Autodesk.Navisworks.Api`) - 核心功能 +- COM API (`Autodesk.Navisworks.ComApi`) - 属性持久化、TimeLiner -### Pathfinding and Animation System - -- **A* Algorithm**: RoyT.AStar library integration for optimal path calculation -- **Animation Pipeline**: Transform-based movement with collision detection integration -- **TimeLiner Bridge**: Synchronization between custom path animations and Navisworks timeline -- **Real-time Collision**: ClashDetectiveIntegration for dynamic conflict detection during animation - -### State Management and Persistence - -- **Session State**: PathEditState enum (None, AddingPoints, EditingPath) with event callbacks -- **Data Serialization**: JSON-based persistence with LogisticsAttributeChangedEventArgs for tracking -- **Coordinate Mapping**: Multi-layer coordinate system supporting 2D overlay on 3D models - -### Logistics Classification System - -Eight predefined categories with inheritance from parent to child nodes: - -- 门 (Doors), 电梯 (Elevators), 楼梯 (Stairs), 通道 (Channels) -- 障碍物 (Obstacles), 装卸区 (Loading Zones), 停车区 (Parking), 检查点 (Checkpoints) - -### Language and Communication - -- **使用中文进行所有交流和代码注释** - Primary language for user interaction and code documentation -- 代码注释和文档说明使用中文 - All technical documentation in Chinese - -### Package Management (Legacy Format) - -- **Old-style csproj**: Uses `` with HintPath instead of PackageReference -- **packages.config**: Manual NuGet package management (do NOT use `dotnet add package`) -- **Manual package installation**: Download .nupkg files and extract to packages/ directory -- **Path format**: `packages\{PackageId}.{Version}\lib\{TargetFramework}\{Assembly}.dll` - -### Plugin Registration Patterns +### 插件注册 ```csharp -// Multi-plugin registration in single assembly [Plugin("NavisworksTransport.MainPlugin", "YourDeveloperID")] [AddInPlugin(AddInLocation.AddIn)] public class MainPlugin : AddInPlugin { } - -[Plugin("NavisworksTransport.PathClickTool", "YourDeveloperID")] -[ToolPluginAttribute("NavisworksTransport.PathClickTool", "YourDeveloperID")] -public class PathClickToolPlugin : ToolPlugin { } ``` -### Development Principles +### 关键点 -- 防御性编程的正确态度: - - ✅ 应该做:检测异常情况并报错,让问题暴露出来 - - ❌ 不应该做:用默认值掩盖问题,让bug隐藏在系统中 +- GlobalExceptionHandler - MainPlugin 构造函数初始化 +- UI 操作必须编组到主线程 +- 实现前查阅 `doc\navisworks_api\` -- 对于"备份方案"和"容错处理": - - ✅ 正确做法:发现问题时记录错误日志,中断处理流程 - - ❌ 错误做法:遇到异常数据时自动"修复"或使用替代值继续执行 +## 核心系统 -- 对于"向后兼容性": - - 明确拒绝考虑向后兼容性 - - 专注解决当前问题,不为旧版本或边缘情况妥协 +### 路径规划 -- 核心原则: - - "让问题快速暴露" > "让程序看起来正常运行" - - "报错比静默失败好" > "容忍错误数据继续处理" - - "数据一致性检查" > "宽松的数据验证" - - "最小化修改" > "复杂全面的逻辑" +- A*: RoyT.AStar 库 +- 动画: Transform + 碰撞检测 +- TimeLiner: 自定义动画同步 +- 实时碰撞: ClashDetectiveIntegration -### Critical API Usage Patterns +### 状态管理 -- **Always reference Navisworks API documentation**: Check `doc\navisworks_api\` before implementing any Navisworks functionality -- **COM API for persistence**: Use COM API for attribute operations that need to persist across sessions -- **GlobalExceptionHandler**: Initialize in MainPlugin constructor for application-wide error handling -- **Thread safety**: UI operations must be marshaled to main thread when called from background processes +- PathEditState: None, AddingPoints, EditingPath +- JSON 持久化 + LogisticsAttributeChangedEventArgs -### Navisworks 2026 Development Focus +### 物流分类 -- **Exclusive 2026 targeting**: No backward compatibility required - leverage 2026-specific features freely -- **Legacy artifacts**: `src\Legacy\` contains reference code from 2017 version but is not actively maintained -- **Modern animation system**: Use Navisworks 2026 native animation components instead of manual Transform manipulation -- **Enhanced APIs**: Take advantage of improved 2026 APIs for collision detection, animation, and model management +门、电梯、楼梯、通道、障碍物、装卸区、停车区、检查点 -## API Documentation Search Strategy +### 包管理 -### CHM文档搜索最佳实践 +- 旧式 csproj: `` + HintPath +- packages.config 手动管理 (**不用** `dotnet add package`) +- 路径: `packages\{PackageId}.{Version}\lib\{TargetFramework}\{Assembly}.dll` -**问题**:CHM解压后产生大量HTML文件(数千个),标准搜索工具效果有限 +## 开发原则 -**解决策略**: +### 防御性编程 -1. **使用文档结构入口点**: +- ✅ 检测异常报错,让问题暴露 +- ❌ 默认值掩盖问题 - ```bash - # 优先访问类成员列表 - AllMembers_T_Autodesk_Navisworks_Api_ClassName.htm - ``` +### 容错处理 -2. **精确文件名搜索**: +- ✅ 错误日志 + 中断流程 +- ❌ 自动"修复"继续执行 - ```bash - find . -name "*ClassName*" -o -name "*MethodName*" - ``` +### 核心优先级 -3. **分层搜索方法**: - - 先定位到类级别文档 - - 从类成员列表找到方法链接 - - 利用文档间超链接导航 +1. 快速暴露 > 看起来正常 +2. 报错 > 静默失败 +3. 数据一致性 > 宽松验证 +4. 最小化修改 > 复杂逻辑 -4. **搜索模式示例**: +## API 文档查询 - ```bash - # 搜索特定API - grep -r "SaveFile\|Export.*nwd" --include="*.htm" doc/navisworks_api/ - - # 查找特定类的所有成员 - find . -name "AllMembers_T_Autodesk_Navisworks_Api_Document.htm" - ``` +### CHM 搜索策略 -5. **常用API文档路径**: - - Document类:`AllMembers_T_Autodesk_Navisworks_Api_Document.htm` - - TimeLiner:`AllMembers_T_Autodesk_Navisworks_Api_Timeliner_*.htm` - - 插件基类:`AllMembers_T_Autodesk_Navisworks_Api_Plugins_*.htm` +```bash +# 类成员列表入口 +AllMembers_T_Autodesk_Navisworks_Api_ClassName.htm -**避免的搜索方式**: +# 精确搜索 +find . -name "*ClassName*" -o -name "*MethodName*" +grep -r "SaveFile\|Export.*nwd" --include="*.htm" doc/navisworks_api/ +``` -- 避免在HTML内容中进行模糊搜索(标签干扰) -- 不要依赖GUID格式的文件名 -- 避免使用过于宽泛的搜索词 +**常用路径**: -## Testing and Deployment +- Document: `AllMembers_T_Autodesk_Navisworks_Api_Document.htm` +- TimeLiner: `AllMembers_T_Autodesk_Navisworks_Api_Timeliner_*.htm` +- 插件基类: `AllMembers_T_Autodesk_Navisworks_Api_Plugins_*.htm` -- **Testing environment**: Navisworks Manage 2026 exclusively - 2017 support discontinued -- **Plugin deployment**: Build output automatically copies to Navisworks 2026 plugin directory -- **Hot reload**: Restart Navisworks required after compilation to load new plugin version -- **Debugging**: Use LogManager for centralized logging and the built-in log viewer dialog for log analysis -- **2026 Features**: Test advanced animation capabilities, enhanced collision detection, and improved model handling -- 在编码中,不要用回退或向后兼容的思路和步骤 -- 程序的日志在:C:\ProgramData\Autodesk\Navisworks Manage 2026\NavisworksTransport\logs\debug.log -- 使用agent完成任务前,一定要先用Plan模式设计好方案和任务清单,并征得我同意。 -- 网格坐标代表的是网格单元的左下角,而不是中心点! +**避免**: HTML 内容模糊搜索、GUID 文件名、宽泛搜索词 -## 运行路径测试 +## 工作流程 -需要先编译单元测试DLL,然后再编译TestRunner: - -● Bash(powershell -Command "& 'C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe' - NavisworksTransport.UnitTests.csproj /p:Configu…) - ⎿ 适用于 .NET Framework MSBuild 版本 17.14.10+8b8e13593 - - NavisworksTransport.UnitTests -> C:\Users\Tellme\apps\NavisworksTransport\bin\Debug\NavisworksTransport.UnitTests.dll - -● Bash(powershell -Command "& 'C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe' - AStarTestRunner.csproj /p:Configuration=Debug /…) - ⎿ 适用于 .NET Framework MSBuild 版本 17.14.10+8b8e13593 - - AStarTestRunner -> C:\Users\Tellme\apps\NavisworksTransport\bin\Debug\AStarTestRunner.exe - -● 现在运行新的测试程序: - -● Bash("bin\Debug\AStarTestRunner.exe") +- 使用中文交流和注释 +- Agent 任务前 Plan 模式设计方案 +- `src\Legacy\` 仅参考,不维护 diff --git a/VERSION.md b/VERSION.md index 8c2aaec..ede6001 100644 --- a/VERSION.md +++ b/VERSION.md @@ -1,3 +1,3 @@ # 版本号 -0.12.0 +0.13.0 \ No newline at end of file diff --git a/doc/requirement/todo_features.md b/doc/requirement/todo_features.md index 2f7e32d..1c5bd81 100644 --- a/doc/requirement/todo_features.md +++ b/doc/requirement/todo_features.md @@ -2,6 +2,10 @@ ## 功能点 +### [2025/10/09] + +1. [x] (优化)支持楼梯场景的3D路径规划 + ### [2025/10/01] 1. [x] (功能)路径分析 diff --git a/src/Core/PathDatabase.cs b/src/Core/PathDatabase.cs index 9a57780..c939c9c 100644 --- a/src/Core/PathDatabase.cs +++ b/src/Core/PathDatabase.cs @@ -509,8 +509,6 @@ namespace NavisworksTransport } } } - - LogManager.Info($"为路径 '{route.Name}' 加载了 {route.Points.Count} 个路径点"); } /// diff --git a/src/PathPlanning/GridMapGenerator.cs b/src/PathPlanning/GridMapGenerator.cs index 7a92cff..5f09463 100644 --- a/src/PathPlanning/GridMapGenerator.cs +++ b/src/PathPlanning/GridMapGenerator.cs @@ -395,7 +395,6 @@ namespace NavisworksTransport.PathPlanning { layer.PassableHeight = new HeightInterval(0, actualPassableHeight); stairBottomLayersProcessed++; - LogManager.Debug($"【楼梯下方高度】网格({x},{y}) Layer{i} Z={layer.Z:F2}, 上层Z={upperLayer.Z:F2}, PassableHeight={actualPassableHeight:F2}模型单位"); } else {