使用 Xbim 获取 IfcSpace 的 FinishFloorHeight

问题描述

我正在尝试使用 Xbim 获取 IfcSpace 的 FinishFloorHeight。

知道怎么做吗?

enter image description here

解决方法

如果您查看 xbim docs 中的示例,您将了解如何获取空间的数据。要获得链接中定义的完工楼层高度,您可以使用以下代码:

private static double? GetFinishFloorHeight(IIfcSpace space)
{
    return space.IsDefinedBy
        .SelectMany(r => r.RelatingPropertyDefinition.PropertySetDefinitions)
        .OfType<IIfcElementQuantity>()
        .Where(qs => qs.Name == "Qto_SpaceBaseQuantities")
        .SelectMany(qset => qset.Quantities)
        .OfType<IIfcQuantityLength>()
        .Where(q => q.Name == "FinishFloorHeight")
        .FirstOrDefault()?.LengthValue;
}