I want to make a table in python like the COUNT LIST command used in the drawing. I'm pulling the number of blocks used in the drawing, but I can't pull the number of dynamic blocks. What I want to do is to count the dynamic and normal blocks I have determined such as "DOOR, WINDOW, TOILET" and print them in the table. Thank you from now.
import ezdxf
doc = ezdxf.readfile("Python.dxf")
blocks = doc.blocks
msp = doc.modelspace()
block_usage_count = {}
inserts = msp.query('INSERT')
for insert in inserts:
block_name = insert.dxf.name
block_usage_count[block_name] = block_usage_count.get(block_name, 0) + 1
print("Block Name | Usage Count")
print("------------------------")
for block_name, usage_count in block_usage_count.items():
print(f"{block_name:10} | {usage_count:11}")