用通道的高度范围+车辆高度+安全间隙作为过滤范围。
This commit is contained in:
parent
3b1fae6a1e
commit
06faf04b83
14
CLAUDE.md
14
CLAUDE.md
@ -139,6 +139,20 @@ public class PathClickToolPlugin : ToolPlugin { }
|
||||
- **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
|
||||
|
||||
### Serena MCP工具配置
|
||||
|
||||
- **Token限制策略**: 所有serena MCP工具调用必须使用`max_answer_chars: 3000`参数
|
||||
- **适用工具**: 包括但不限于:
|
||||
- `mcp__serena__search_for_pattern`
|
||||
- `mcp__serena__find_symbol`
|
||||
- `mcp__serena__get_symbols_overview`
|
||||
- `mcp__serena__find_referencing_symbols`
|
||||
- 所有其他支持`max_answer_chars`参数的serena工具
|
||||
- **执行原则**:
|
||||
- 优先使用精确搜索而非宽泛搜索以减少token消耗
|
||||
- 分步骤获取信息,避免一次性获取大量内容
|
||||
- 如遇到3k限制导致内容截断,应使用更精确的搜索条件重新查询
|
||||
|
||||
## API Documentation Search Strategy
|
||||
|
||||
### CHM文档搜索最佳实践
|
||||
|
||||
@ -728,7 +728,6 @@ namespace NavisworksTransport.PathPlanning
|
||||
Math.Abs(optimizedPath[checkIdx+1].Z - optimizedPath[checkIdx].Z) > heightTolerance))
|
||||
{
|
||||
canSkip = false;
|
||||
LogManager.Debug($"[斜线优化] 不能跳过点{checkIdx},存在高度变化");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -216,22 +216,16 @@ namespace NavisworksTransport.PathPlanning
|
||||
// 计算网格中心点在三角形平面上的精确高度
|
||||
double gridCenterHeight = GetHeightAtPoint(triangle, worldPos.X, worldPos.Y);
|
||||
|
||||
// 调试日志:打印生成的网格坐标和高度
|
||||
LogManager.Debug($"[调试] 生成通道网格: ({gridPos.X}, {gridPos.Y}) 高度: {gridCenterHeight:F2}");
|
||||
// 使用SetCell方法正确创建通道网格并更新统计信息
|
||||
gridMap.SetCell(gridPos, true, 0, CategoryAttributeManager.LogisticsElementType.通道);
|
||||
|
||||
// 直接设置网格属性
|
||||
var cell = new GridCell
|
||||
{
|
||||
IsWalkable = true,
|
||||
CellType = CategoryAttributeManager.LogisticsElementType.通道,
|
||||
IsInChannel = true,
|
||||
PassableHeight = new HeightInterval(),
|
||||
ChannelType = ChannelType.Corridor,
|
||||
WorldPosition = new Point3D(worldPos.X, worldPos.Y, gridCenterHeight),
|
||||
RelatedModelItem = null
|
||||
};
|
||||
cell.Cost = cell.GetCost();
|
||||
gridMap.Cells[gridPos.X, gridPos.Y] = cell;
|
||||
// 然后更新特定的通道属性
|
||||
var updatedCell = gridMap.Cells[gridPos.X, gridPos.Y];
|
||||
updatedCell.WorldPosition = new Point3D(worldPos.X, worldPos.Y, gridCenterHeight);
|
||||
updatedCell.PassableHeight = new HeightInterval();
|
||||
updatedCell.ChannelType = ChannelType.Corridor;
|
||||
updatedCell.RelatedModelItem = null;
|
||||
gridMap.Cells[gridPos.X, gridPos.Y] = updatedCell;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,7 +120,7 @@ namespace NavisworksTransport.PathPlanning
|
||||
|
||||
// 2. 直接遍历处理障碍物(包围盒检测) - 使用高性能优化版本
|
||||
LogManager.Info("【生成网格地图】步骤2: 高性能包围盒遍历处理障碍物");
|
||||
ProcessObstaclesWithBoundingBoxOptimized(channelCoverage.GridMap, channelRelatedItems, scanHeightInModelUnits);
|
||||
ProcessObstaclesWithBoundingBox(channelCoverage.GridMap, channelRelatedItems, scanHeightInModelUnits, channelCoverage);
|
||||
|
||||
LogManager.Info($"【阶段2完成】障碍物处理后网格统计: {channelCoverage.GridMap.GetStatistics()}");
|
||||
|
||||
@ -1126,11 +1126,11 @@ namespace NavisworksTransport.PathPlanning
|
||||
/// 使用包围盒遍历方式处理障碍物(高性能优化版)
|
||||
/// 分离API访问和数值计算,利用并行处理加速纯计算部分
|
||||
/// </summary>
|
||||
/// <param name="document">Navisworks文档</param>
|
||||
/// <param name="gridMap">网格地图</param>
|
||||
/// <param name="channelItems">通道模型项列表</param>
|
||||
/// <param name="scanHeightInModelUnits">扫描高度范围(模型单位)</param>
|
||||
private void ProcessObstaclesWithBoundingBoxOptimized(GridMap gridMap, HashSet<ModelItem> channelItems, double scanHeightInModelUnits)
|
||||
/// <param name="channelCoverage">通道覆盖信息,包含通道边界</param>
|
||||
private void ProcessObstaclesWithBoundingBox(GridMap gridMap, HashSet<ModelItem> channelItems, double scanHeightInModelUnits, ChannelCoverage channelCoverage)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -1168,8 +1168,16 @@ namespace NavisworksTransport.PathPlanning
|
||||
var filterElapsed = (DateTime.Now - filterStart).TotalMilliseconds;
|
||||
LogManager.Info($"[高性能障碍物处理] 阶段3完成: 从缓存中筛选出 {validItems.Count} 个有效项,耗时: {filterElapsed:F1}ms");
|
||||
|
||||
// 阶段4:网格覆盖计算(并行几何计算)- 使用50%CPU核心优化 + 精确高度检查
|
||||
LogManager.Info("[高性能障碍物处理] 阶段4: 并行网格覆盖计算 + 精确高度检查");
|
||||
// 获取通道高度范围信息
|
||||
var channelBounds = channelCoverage.TotalBounds;
|
||||
var channelMinZ = channelBounds.Min.Z;
|
||||
var channelMaxZ = channelBounds.Max.Z;
|
||||
var channelHeightRange = channelMaxZ - channelMinZ;
|
||||
LogManager.Info($"[高性能障碍物处理] 通道高度信息 - 最低点: {channelMinZ:F2}, 最高点: {channelMaxZ:F2}");
|
||||
LogManager.Info($"[高性能障碍物处理] 通道高度范围: {channelHeightRange:F2}, 加车辆高度后扫描范围: [{channelMinZ:F2}, {channelMaxZ + scanHeightInModelUnits:F2}]");
|
||||
|
||||
// 阶段4:网格覆盖计算(并行几何计算)- 使用50%CPU核心优化 + 基于通道的精确高度检查
|
||||
LogManager.Info("[高性能障碍物处理] 阶段4: 并行网格覆盖计算 + 基于通道高度的精确高度检查");
|
||||
var gridCalcStart = DateTime.Now;
|
||||
|
||||
var heightCheckedItems = validItems.AsParallel()
|
||||
@ -1188,9 +1196,11 @@ namespace NavisworksTransport.PathPlanning
|
||||
}
|
||||
|
||||
var centerCell = gridMap.Cells[centerGridPos.X, centerGridPos.Y];
|
||||
var referenceZ = centerCell.WorldPosition.Z;
|
||||
var scanMin = referenceZ;
|
||||
var scanMax = referenceZ + scanHeightInModelUnits;
|
||||
|
||||
// 使用通道高度范围计算扫描范围
|
||||
// 扫描范围:从通道最低点开始,到通道最高点+车辆高度+安全间隙
|
||||
var scanMin = channelMinZ;
|
||||
var scanMax = channelMaxZ + scanHeightInModelUnits;
|
||||
|
||||
// 只有与该网格高度范围重叠的几何体才进入处理
|
||||
bool isInRange = !(bbox.Max.Z < scanMin || bbox.Min.Z > scanMax);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user