diff --git a/src/Core/Properties/CategoryAttributeManager.cs b/src/Core/Properties/CategoryAttributeManager.cs index 95be22d..267bbea 100644 --- a/src/Core/Properties/CategoryAttributeManager.cs +++ b/src/Core/Properties/CategoryAttributeManager.cs @@ -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; } diff --git a/src/PathPlanning/ChannelBasedGridBuilder.cs b/src/PathPlanning/ChannelBasedGridBuilder.cs index 0bba1b4..3d82c76 100644 --- a/src/PathPlanning/ChannelBasedGridBuilder.cs +++ b/src/PathPlanning/ChannelBasedGridBuilder.cs @@ -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()) diff --git a/src/PathPlanning/RailGeometryHelper.cs b/src/PathPlanning/RailGeometryHelper.cs index b4fff76..171cbf2 100644 --- a/src/PathPlanning/RailGeometryHelper.cs +++ b/src/PathPlanning/RailGeometryHelper.cs @@ -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) {