当前位置:网站首页>工业基础类IFC—提取模型结构树
工业基础类IFC—提取模型结构树
2022-07-26 20:32:00 【硬核小青年】

首先,抱歉,很久没有更新文章了,也来不及解释了,我们直接进入正题吧。这篇还是接上之前挖坑的IFC系列,前面的几篇文章我们聊了IFC的一些概念、数据结构和可视化工具等等,有了这些铺垫之后,我们基本就可以说一些实战性的内容了,比如如何利用开源工具包读写IFC数据,这其中就包括模型结构树数据、几何数据和属性数据。
所以这篇文章的主题就是提取IFC模型结构树的信息,且基于 IFC 4 版本,但对 IFC 2x3 大部分都是通用的。首先结合下方的图片对IFC模型结构树做一个说明:在拆解IFC结构树过程中会涉及两种关联实体,IfcRelAggregates 和 IfcRelContainedInSpatialStructure,其中前者表达空间分解,例如一个建筑可以分为多个楼层,又如桥墩可以分为盖梁、立柱、承台和桩基础;后者则表达空间内的元素,例如一层有结构墙、柱、门、窗等。换而言之,我们可以把元素非为空间元素和非空间元素,如果要获取空间元素中的非空间元素用IfcRelContainedInSpatialStructure,其余都用 IfcRelAggregates 。

这里我们用到的开源工具包是xBIM,它是面向.NET平台的 IFC tookit,主要的开发语言为C#,当然几何库部分还是以C++为主。如果有读者习惯用Python,也推荐大家使用 IfcOpenShell 这个库,基本逻辑都是差不多的。
IfcRelContainedInSpatialStructure
要获取空间元素中的非空间元素,首先我们需要判断当前元素是否为空间元素 IfcSpatialStructureElement,然后用该类对应的属性ContainsElements来获取其中的元素集。

var spaceEle = elem as IIfcSpatialStructureElement;
if (spaceEle != null)
{
//using IfcRelContainedInSpatialElement to get contained elements
var containedElements = spaceEle.ContainsElements.SelectMany(rel => rel.RelatedElements).ToList();
for (int i = 0; i < containedElements.Count(); i++)
{
// do what you want
// 使用递归完成对结构树的遍历
}
}
IfcRelAggregates
空间分解的子集元素可以通过反向属性 IsDecomposedBy 获取。

foreach ( var item in elem.IsDecomposedBy.SelectMany ( r => r.RelatedObjects ) )
{
// do what you want
// 使用递归完成对结构树的遍历
}空间元素分解
IFC拥有一个语义化的空间结构树,单个文件中会定义一个“项目IfcProject”,项目中包含一至多个“场地 IfcSite”,场地中又包含一至多个“建筑 IfcBuilding”,再从建筑到楼层,从楼层再到墙、板、柱。当然这只是一个简单的例子,随着IFC标准的逐渐完善和丰富,分级方式也是越来越多样,例如场地中可以有路线 IfcAlignment,有桥梁IfcBridge等等。

非空间元素的分解
复合元素 IfcElementAssembly也是一种结构层次的表达手段,它可以被进一步分解,例如我们把桥梁主梁的一个标准节段作为一个复合对象,而它可以被分解为顶板、底板、腹板、加劲肋等构件。

小结
在实际的代码编制过程中,我们需要结合上述两种结构划分方式,并利用递归逻辑实现完整结构树的遍历。Ok,就聊到这里,下期预告:《工业基础类—利用xBIM提取IFC几何和属性数据》。以下是我的创建的IFC交流群,有兴趣的可以扫码加入!
边栏推荐
- Custom annotation (I)
- Mobile phone \ landline call forwarding setting method
- 牛客刷题——Mysql系列
- JDBC connection
- Practice of microservice in solving Library Download business problems
- 银河证券场内基金低佣金开户靠谱吗,可靠安全吗
- Ros2 node communication realizes zero copy
- [MySQL series] - how much do you know about the index
- LiveDatade的基本使用
- 我们从Crypto市场中学到的最艰难一课
猜你喜欢
![[MySQL series] - how much do you know about the index](/img/d7/5045a846580be106e2bf16d7b30581.png)
[MySQL series] - how much do you know about the index

Summary of common interview questions of computer composition principle, including answers

The hardest lesson we learned from the crypto Market

After chatting with byte programmers with a monthly salary of 3W, I realized that I had been doing chores

Retrieve the parameters in this method in idea for our use -- 1. Class diagram. 2. Double click shift

微服务化解决文库下载业务问题实践

牛客刷题——Mysql系列

Error in render: “TypeError: data.slice is not a function“
![[Oracle training] - deploy Ogg known as zero downtime migration](/img/bc/4ee0493129d5abab931ca50dbdce6f.png)
[Oracle training] - deploy Ogg known as zero downtime migration

Deepfake pinches his face. It's hard to tell whether it's true or false. Tom Cruise is more like himself than himself!
随机推荐
25张炫酷交互图表,一文入门Plotly
LeetCode 练习——剑指 Offer II 005. 单词长度的最大乘积
[hero planet July training leetcode problem solving daily] 26th and check the collection
功能尝鲜 | 解密 Doris 复杂数据类型 ARRAY
牛客刷题——Mysql系列
Pointpillars: fast encoders for object detection from point clouds reading notes
除了「加机器」,其实你的微服务还能这样优化
In addition to "adding machines", in fact, your micro service can be optimized like this
2022-7-26 the seventh group of abstractions and interfaces
如何借助自动化工具落地DevOps|含低代码与DevOps应用实践
Devops has been practiced for many years. What is the most painful thing?
1-《PyTorch深度学习实践》-线性模型
2022开放原子全球开源峰会议程速递 | 7 月 27 日分论坛议程一览
Set the template of core configuration file in idea
Mobile phone \ landline call forwarding setting method
There are six ways to help you deal with the simpledateformat class, which is not a thread safety problem
Today, the company came across an Alibaba P8, which was really seen as the ceiling of the foundation
Basic use of livedatade
【MySQL系列】-索引知多少
记一次invalid bound statement xxxxxx 问题解决思路