小编Loe*_*ebl的帖子

在python中使用IfcOpenShell提取元素数量

我正在尝试ifc使用IfcOpenShellPython读取文件中对象的最深层次的数量。到目前为止,我有:

import ifcopenshell

path = r'D:\ifcos_1\slab.ifc'
ifc_file = ifcopenshell.open(path)

geometries = ifc_file.by_type("IfcProduct")

for geometry in geometries:
    if geometry.is_a("IfcSlab"):
        print geometry
        test = geometry.IfcPhysicalQuantity()
        print test
Run Code Online (Sandbox Code Playgroud)

我研究了定义

无论我尝试为 放置哪种类型的函数test = geometry.X(),我都会收到错误消息:

File "C:\Python27\lib\site-packages\ifcopenshell\entity_instance.py", line 48, in __getattr__
   "entity instance of type '%s' has no attribute '%s'" % (self.wrapped_data.is_a(), name))
AttributeError: entity instance of type 'IfcSlab' has no attribute 'IfcPhysicalQuantity'
Run Code Online (Sandbox Code Playgroud)

不知道如何解决这个问题,希望得到帮助。

编辑:

获得平板和进一步参考的进一步工作:

for geometry in geometries:
    if geometry.is_a("IfcSlab"):
        print geometry
        definedBy = geometry.IsDefinedBy

        print …
Run Code Online (Sandbox Code Playgroud)

python ifc

1
推荐指数
1
解决办法
4804
查看次数

标签 统计

ifc ×1

python ×1