1

How do I get the elements in a HVAC system? I can access the list of the systems in a model with the following code:

var systems = model.Instances.OfType<IfcSystem>();

This returns a list of all the systems in the model. How to access the elements in a system?

Joni Turunen
  • 137
  • 1
  • 13
  • You don't really give us a lot to go on. You already know the type `IfcSystem` or maybe its interface and I expect that `systems` is an array or IEnumerable type. – ChrisBD Sep 01 '21 at 08:58
  • I mean how to access the elements that are grouped to be a part of a system, elements like IfcFlowSegment or IfcFlowTerminal. – Joni Turunen Sep 01 '21 at 09:05

1 Answers1

1

So this is a matter of understanding the IFC data model by looking at the standards - in particular the Group Assignment data model: https://standards.buildingsmart.org/IFC/RELEASE/IFC4_1/FINAL/HTML/link/group-assignment.htm

In IFC, an IfcSystem subclasses IfcGroup. To get the members of a Group you need to access the IfcRelAssignsToGroup relationship provided via IsGroupedBy, from where you can get the RelatedObjects collection containing the actual elements.

So in xbim you'd end up with something like:

var hvacSystem = model.Instances.OfType<IfcSystem>().First(s => s.GlobalId="<Your Hvac Identifier>");

var hvacElements = hvacSystem.IsGroupedBy?.RelatedObjects.OfType<IIfcProduct>();
Andy Ward
  • 324
  • 2
  • 7