0

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
  • The Revit developer talks about instance/type parameters. In the case the parameter could not found is a type parameter.
    – Meindert
    Commented Sep 27, 2023 at 10:46

1 Answer 1

1

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());
1
  • Yes the properties are inherited from any IfcTypeObject (which you can get by the IsTypedBy property on any object.) One other (less common) consideration is that not all properties are IfcPropertySingleValue types - albeit they usually are.
    – Andy Ward
    Commented Sep 28, 2023 at 10:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.