修复自定义类别的障碍物检测问题

This commit is contained in:
tian 2026-02-19 14:52:28 +08:00
parent f9df83ba5b
commit 69765e092b
3 changed files with 10 additions and 13 deletions

View File

@ -1331,7 +1331,7 @@ namespace NavisworksTransport
// 首先检查是否有物流属性
if (CategoryAttributeManager.HasLogisticsAttributes(item))
{
var elementType = CategoryAttributeManager.GetLogisticsElementType(item);
var categoryId = CategoryAttributeManager.GetCategoryId(item);
var isTraversable = CategoryAttributeManager.GetLogisticsPropertyValue(item, CategoryAttributeManager.LogisticsProperties.TRAVERSABLE);
// 如果明确标记为不可通行,则为障碍物
@ -1340,8 +1340,8 @@ namespace NavisworksTransport
return true;
}
// 如果明确标记为障碍物类型,则为障碍物
if (elementType == CategoryAttributeManager.LogisticsElementType.)
// 使用类别定义检查是否为障碍物(支持自定义类别)
if (!CategoryAttributeManager.IsCategoryTraversable(categoryId))
{
return true;
}
@ -1425,7 +1425,7 @@ namespace NavisworksTransport
// 首先检查是否有物流属性
if (CategoryAttributeManager.HasLogisticsAttributes(item))
{
var elementType = CategoryAttributeManager.GetLogisticsElementType(item);
var categoryId = CategoryAttributeManager.GetCategoryId(item);
var isTraversable = CategoryAttributeManager.GetLogisticsPropertyValue(item, CategoryAttributeManager.LogisticsProperties.TRAVERSABLE);
// 如果明确标记为可通行,则为通道
@ -1434,11 +1434,8 @@ namespace NavisworksTransport
return true;
}
// 特定的可通行类型
if (elementType == CategoryAttributeManager.LogisticsElementType. ||
elementType == CategoryAttributeManager.LogisticsElementType. ||
elementType == CategoryAttributeManager.LogisticsElementType. ||
elementType == CategoryAttributeManager.LogisticsElementType.)
// 使用类别定义检查是否可通行(支持自定义类别)
if (CategoryAttributeManager.IsCategoryTraversable(categoryId))
{
return true;
}

View File

@ -75,17 +75,17 @@ namespace NavisworksTransport.PathPlanning
// 获取通道
var channels = CategoryAttributeManager.GetLogisticsItemsByType(
CategoryAttributeManager.LogisticsElementType.);
"通道");
channelItems.AddRange(channels);
// 获取楼梯
var stairs = CategoryAttributeManager.GetLogisticsItemsByType(
CategoryAttributeManager.LogisticsElementType.);
"楼梯");
channelItems.AddRange(stairs);
// 获取电梯
var elevators = CategoryAttributeManager.GetLogisticsItemsByType(
CategoryAttributeManager.LogisticsElementType.);
"电梯");
channelItems.AddRange(elevators);
if (!channelItems.Any())

View File

@ -417,7 +417,7 @@ namespace NavisworksTransport.PathPlanning
LogManager.Info("[空轨] 开始提取所有空轨模型的基准路径");
// 使用现成的辅助方法获取所有空轨模型
var railItems = CategoryAttributeManager.GetLogisticsItemsByType(CategoryAttributeManager.LogisticsElementType.);
var railItems = CategoryAttributeManager.GetLogisticsItemsByType("空轨");
if (railItems == null || railItems.Count == 0)
{