From 89c85308513bfa64a0591f0b0cf2ad12b7e16603 Mon Sep 17 00:00:00 2001 From: Paul Wolok Date: Tue, 16 Dec 2025 12:06:33 +0100 Subject: [PATCH] =?UTF-8?q?Vorbereitung=20f=C3=BCr=20F=C3=B6rderer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/dxf2lib.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/lib/dxf2lib.py b/lib/dxf2lib.py index 7b41c75..5d3c0b8 100644 --- a/lib/dxf2lib.py +++ b/lib/dxf2lib.py @@ -76,7 +76,12 @@ def create_block_library(input_dir, output_file, config, logger=None): "SWEPTSURFACE", } filtered_entities = [] - + att_def= {} + for insert in src_msp.query("INSERT"): + for attrib in insert.attribs: + att_def[attrib.dxf.tag] = attrib.dxf.text + + for e in entities: if e.dxftype() in allowed_types: filtered_entities.append(e) @@ -191,11 +196,20 @@ def create_block_library(input_dir, output_file, config, logger=None): x_offset += max_blockspacing_x # Blockreferenz mit optionalem Layer einfügen (Entity-Layer bleiben erhalten) if blockref_layer: - msp.add_blockref(name, insert=(x_offset, y_offset), dxfattribs={"layer": blockref_layer}) + test =msp.add_blockref(name, insert=(x_offset, y_offset), dxfattribs={"layer": blockref_layer}) else: - msp.add_blockref(name, insert=(x_offset, y_offset)) + test =msp.add_blockref(name, insert=(x_offset, y_offset)) # Text mit Blocknamen über dem Block + if name == "a" or name == "b": + for tag, value in att_def.items(): + tag = tag + value = value + a =test.add_attrib( + tag=tag, + text=value, + ) + a.is_invisible = True # Werte aus Config holen (Block: [dxf2lib]) msp.add_text(name, dxfattribs={'height': text_height, 'insert': (x_offset -ausdehnung_x/2 , y_offset + ausdehung_y/2 + extra_text_space_y)})