Xbim library does not find all properties

63 views Asked by At

We process ifc IFC2X3 file for retrieving information.

With the following code some properties seems not to be found. Its about "Typical-code" in "General" section

            //get one single object 
            var id = "2c$4fosk5BCvGtDFpkXAUc";

            var prd = _ifcModel.Instances
               .OfType<IIfcProduct>()
               .Where(ro => ro.GlobalId.Equals(id))
               .FirstOrDefault();

            //get all single-value properties of the door
            var properties = prd.IsDefinedBy
                .Where(r => r.RelatingPropertyDefinition is IIfcPropertySet)
                .SelectMany(r => ((IIfcPropertySet)r.RelatingPropertyDefinition).HasProperties)
                .OfType<IIfcPropertySingleValue>();

When I use another viewer like BIMcollab ZOOM or solibri bim360 then the particular "Typical-code" property is found.

Tried with example code to get the particular property from the model.

1

There are 1 answers

1
Meindert On

It turned out that also the IIfcRelDefinesByType should be checked

        var rdbt = _ifcModel.Instances
            .OfType<IIfcRelDefinesByType>()
            .ToList();

        var general_set_properties_type = rdbt
            .Where(bt => bt.RelatingType.HasPropertySets.Any(ps => ps.Name.Value.Equals("General")))
            .SelectMany(bt => bt.RelatedObjects.Select(bt1 => (bt1.GlobalId, bt.RelatingType)))
            .ToDictionary(
                k => k.GlobalId,
                v => v.RelatingType.HasPropertySets
                .Where(ps => ps.Name.Value.Equals("General"))
                .OfType<IIfcPropertySet>()
                .FirstOrDefault().HasProperties.ToList());