0

我在 IfcBuildingElementProxy 类型的 IFC 文件中有多个标准形式的积木。虽然我已经设法从 IFC 文件中提取了它们的位置,但现在我很难从文件中获取几何图形(长度、高度、宽度)。我知道有两种方法可以获得几何:

  1. 通过砖块的表示属性解析并尝试编写代码来计算几何形状。这种方法真的很累,因为 IFC 文件往往会处理很多参考。我不会走这条路。

  2. 使用 ifcopenshell 和 opencascade 等引擎获取几何图形。我知道如何将砖块铸造成 TopoDS 对象,但很难找到正确的方法来获取几何图形。

import ifcopenshell

bricklist = ifc_file.by_type('IfcBuildingElementProxy') 

for brick in bricklist:
        shape = ifcopenshell.geom.create_shape(settings, brick).geometry
        shape.methodtogetXYZgemeometrics???
4

1 回答 1

1

Use

settings = geom.settings()
settings.set(settings.USE_WORLD_COORDS, True) #Translates and rotates the points to their world coordinates

...

shape = geom.create_shape(settings , brick )
points=shape.geometry.verts     #The xyz points
triangles=shape.geometry.faces  #Indexes to the points, 3 indexes form one triangle

Note that you can also use the element's 4x3 rotation/translation matrix and do the points translation yourself if you do not use the USE_WORLD_COORDS setting. This matrix is given by

shape.transformation.matrix.data
于 2021-04-03T13:01:39.097 回答