Search code examples
c#ifcxbim

Get FinishFloorHeight of IfcSpace using Xbim


I'm trying to get the FinishFloorHeight of IfcSpace using Xbim.

Any idea of how to do that?

enter image description here


Solution

  • If you look at the examples at xbim docs, you will see how to get data for a space. To get finish floor height as defined in your link, you can use this code:

    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;
    }