使用 ezdxf 提取所有块属性

问题描述 投票:0回答:0

我想提取所有的块属性并将它们放在一个df上。有些属性是默认的,有些是自定义属性: Block attributes to extract

import ezdxf as ez
import pandas as pd
doc = ez.readfile("data.dxf")

# Get the modelspace
msp = doc.modelspace()

# Initialize df with all block attributes
entities_df = pd.DataFrame()

# Iterate over all entities in the modelspace and append to df
for entity in msp:
    to_dict = pd.DataFrame([entity.attribs()])
    entities = pd.concat([entities, to_dict])
    print(blocks_df)

.attribs() 没有返回每个属性。我得到“句柄、图层、标志、文本、样式、名称...”,但不是我正在寻找的属性。

python pandas autocad dxf ezdxf
© www.soinside.com 2019 - 2024. All rights reserved.