[英]Get system with elements from a model
How do I get the elements in a HVAC system?如何获取 HVAC 系统中的元素? I can access the list of the systems in a model with the following code:我可以使用以下代码访问 model 中的系统列表:
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?这将返回 model 中所有系统的列表。如何访问系统中的元素?
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因此,这是通过查看标准来理解 IFC 数据 model 的问题 - 特别是组分配数据 model: https://standards.buildingsmart.org/IFC/RELEASE/IFC4_1/FINAL/HTML/link/group-assignment .htm
In IFC, an IfcSystem
subclasses IfcGroup
.在 IFC 中, IfcGroup
是IfcSystem
的子类。 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.要获取组的成员,您需要访问通过IsGroupedBy
提供的IfcRelAssignsToGroup
关系,您可以从中获取包含实际元素的RelatedObjects
集合。
So in xbim you'd end up with something like:所以在 xbim 中你最终会得到类似的东西:
var hvacSystem = model.Instances.OfType<IfcSystem>().First(s => s.GlobalId="<Your Hvac Identifier>");
var hvacElements = hvacSystem.IsGroupedBy?.RelatedObjects.OfType<IIfcProduct>();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.