diff --git a/lib/inspect_blocks.py b/lib/inspect_blocks.py new file mode 100644 index 0000000..409a494 --- /dev/null +++ b/lib/inspect_blocks.py @@ -0,0 +1,25 @@ +import ezdxf +from pathlib import Path + + +def inspect_blocks(dxf_path): + doc = ezdxf.readfile(dxf_path) + print(f"Datei: {dxf_path}") + print("Gefundene Blöcke und Attribute:\n") + for block in doc.blocks: + if block.name.startswith('*'): # Überspringe anonyme/Standardblöcke + continue + print(f"Block: {block.name}") + attribs = [e for e in block if e.dxftype() == "ATTDEF"] + if attribs: + print(" Attribute:") + for att in attribs: + print(f" Tag: {att.dxf.tag}, Prompt: {att.dxf.prompt}") + else: + print(" (Keine Attribute)") + print("-" * 40) + + +if __name__ == "__main__": + dxf_file = "data/blocks.dxf" + inspect_blocks(dxf_file) \ No newline at end of file