首页 > 技术文章 > IFC中洞口的表达方式

OverloadBachPunk 2021-02-26 16:37 原文

IFC中构件上洞口的表达方式

这一篇随笔的例子如下:

可以看到,标高为2的楼板有一个缺口。那么这块楼板在IFC中是如何表示的呢?往下看:

楼板形状的表示方式

在Python中用ifcopenshell打开IFC文件,输入

import ifcopenshell
f = ifcopenshell.open('project1_ifc4.ifc')
slab_list = f.by_type('ifcslab')
slab_list[1].ObjectPlacement.PlacementRelTo.RelativePlacement.Location.Coordinates
(0.0, 0.0, 4000.0)

可以看到这块楼板的相对坐标参照点是(0.0, 0.0, 4000.0),也就是标高2的位置。说明slab_list[1]就是我们想要找到的楼板。随后查看楼板的形状:

In [27]: slab_list[1].Representation.Representations
Out[27]:
(#973=IfcShapeRepresentation(#120,'Body','SweptSolid',(#963)),
 #986=IfcShapeRepresentation(#122,'FootPrint','Curve2D',(#984)))

可以看出楼板的形态是通过两类IfcShapeRepresentation组成的。SweptSolid说明其Body是一个拉伸体;Curve2D说明其FootPrint(草图)是一个2D曲线。接下来分别查看这两个Individual的属性:

In [67]: slab_list[1].Representation.Representations[1].Items[0].Points #查看Curve2D的坐标点
Out[67]:
(#978=IfcCartesianPoint((0.,20200.)),
 #980=IfcCartesianPoint((20200.,20200.)),
 #982=IfcCartesianPoint((20200.,0.)),
 #10=IfcCartesianPoint((0.,0.)),
 #978=IfcCartesianPoint((0.,20200.)))
In [75]: slab_list[1].Representation.Representations[0].Items[0].SweptArea #查看SweptArea的拉伸横截面区域
Out[75]: #959=IfcRectangleProfileDef(.AREA.,$,#958,20200.,20200.0000000001)

可以看出,Curve2D中的点组成了一个闭环,构成楼板的草图;楼板的SweptArea的Xdim与Ydim则与楼板的长宽对应(如果楼板不是矩形会如何呢?之后再做研究)。然而,我们并没有看到洞口的信息在里面出现。

洞口的信息

显然,洞口的信息并不包括在楼板中。那么洞口会在哪里呢?在Protege中打开转换后的IFC文件,在IfcProduct下找,很快就可以找到了:

原来洞口属于IfcOpeningElement类。接下来用ifcopenshell进一步查看这个实例的属性:

In [98]: open_list = f.by_type('IfcOpeningElement')

In [99]: open_list
Out[99]: [#1012=IfcOpeningElement('2dW1x8jJT85xQnO5ksAdUC',#42,'楼板:常规 - 150mm:334036:2',$,'Opening',#1010,#1004,'334036',$)]

In [100]: open_list[0].Representation.Representations
Out[100]: (#1002=IfcShapeRepresentation(#120,'Body','SweptSolid',(#996)),)

发现洞孔只存在一个SweptSolid作为形状的表示,猜测可能是因为洞口的形状是简单的矩形,因此只需要SweptSolid就可以表示了(不确定)。进一步查看洞口的其他属性:

In [114]: open_list[0].Representation.Representations[0].Items[0].Depth
Out[114]: 150.0

In [128]: open_list[0].ObjectPlacement.RelativePlacement.Location.Coordinates
Out[128]: (13000.0, 13000.0, 150.0)

In [136]: open_list[0].Representation.Representations[0].Items[0].SweptArea
Out[136]: #994=IfcRectangleProfileDef(.AREA.,$,#993,4000.,4000.)

洞口深度为150,位置在(13000.0, 13000.0, 150.0),SweptArea面积为(4000.,4000.)。这与我们的洞口是完全一致的。

推荐阅读