From 6b0b3fea04b41fd7919a8434b8fa6cea6d78274c Mon Sep 17 00:00:00 2001 From: lertlmaier Date: Mon, 7 Jul 2025 12:43:08 +0200 Subject: [PATCH] Connecting Racks werden jetzt auc gezeichnet (gleich wie "originale" Racks aber werden bei beschriftung ignoriert --- lib/drawdxf.py | 53 ++++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/lib/drawdxf.py b/lib/drawdxf.py index 0016841..a623a8b 100644 --- a/lib/drawdxf.py +++ b/lib/drawdxf.py @@ -132,7 +132,7 @@ def draw_racks(plines, doc): for rack_name, rack_geom in plines.rack_geometry.items(): classifier = rack_name[0] - if classifier in ("t", "v", "c", "d"): + if classifier in ("t", "v", "d"): continue coords = [(pt.x, pt.y, pt.z) for pt in rack_geom.coordinates] @@ -141,35 +141,38 @@ def draw_racks(plines, doc): polyline = msp.add_polyline3d(coords, dxfattribs=dxfattribs_rack) - if coords: - x, y, z = coords[0] # Get the first coordinate for text placement + if classifier == "c": + continue + + # Textplatzierung + x, y, z = coords[0] # Get the first coordinate for text placement - # Orientierung bestimmen (horizontal oder vertikal) - if len(coords) >= 2: - x2, y2, _ = coords[1] - dx = x2 - x - dy = y2 - y + # Orientierung bestimmen (horizontal oder vertikal) + if len(coords) >= 2: + x2, y2, _ = coords[1] + dx = x2 - x + dy = y2 - y - is_vertical = abs(dy) > abs(dx) - else: - is_vertical = False # Standard: horizontal + is_vertical = abs(dy) > abs(dx) + else: + is_vertical = False # Standard: horizontal - # Text platzieren - text_entity = msp.add_text( - rack_name, - dxfattribs={ - "layer": rack_layer, - "height": 75, - "color": 3, - "rotation": 90 if is_vertical else 0, - } - ) + # Text platzieren + text_entity = msp.add_text( + rack_name, + dxfattribs={ + "layer": rack_layer, + "height": 75, + "color": 3, + "rotation": 90 if is_vertical else 0, + } + ) - # Offset definieren - offset_x = -50 if is_vertical else 50 - offset_y = 100 if is_vertical else 50 + # Offset definieren + offset_x = -50 if is_vertical else 50 + offset_y = 100 if is_vertical else 50 - text_entity.set_placement((x + offset_x, y + offset_y)) + text_entity.set_placement((x + offset_x, y + offset_y)) def find_close_key(pos2sensors, x, y, tolerance=10): # !!! Toleranz nicht in Config !!!