我想提取所有的块属性并将它们放在一个df上。有些属性是默认的,有些是自定义属性:
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() 没有返回每个属性。我得到“句柄、图层、标志、文本、样式、名称...”,但不是我正在寻找的属性。