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?
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>();