From 5b2f4787a28607719682228d5a05bbedbc9f112f Mon Sep 17 00:00:00 2001 From: Paul Wolok Date: Tue, 2 Dec 2025 14:52:41 +0100 Subject: [PATCH] =?UTF-8?q?Pin=20bereich=20bei=20kreisel=20abh=C3=A4ngig?= =?UTF-8?q?=20von=20Winkel=20angepasst?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/plant2dxf.py | 48 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/lib/plant2dxf.py b/lib/plant2dxf.py index 2e0d5b0..60f9623 100644 --- a/lib/plant2dxf.py +++ b/lib/plant2dxf.py @@ -278,7 +278,7 @@ def handle_ils_2_0_kreisel(msp, teileid, merkmale, x, y, doc, lib_doc, verbose, def draw_kreisel_lines(msp, pos1, pos2,merkmale): """Zeichnet tangentiale Linien zwischen zwei Kreiselblöcken, unabhängig vom Winkel.""" - + rotation = float(merkmale.get("Drehung")) x1, y1, z1 = pos1 x2, y2, z1 = pos2 # Verbindungsvektor @@ -298,15 +298,43 @@ def draw_kreisel_lines(msp, pos1, pos2,merkmale): p2a = (x2 + nx, y2 + ny,z1) p2b = (x2 - nx, y2 - ny,z1) if merkmale.get("Kreiselart") == "Pin": - - p1a2 = p1a[0] + RADIUS + 50, p1a[1] - 50, z1 - p1b2 = p1b[0] + RADIUS + 50, p1b[1] + 50, z1 - p2a2 = p2a[0] - RADIUS - 50, p2a[1] - 50, z1 - p2b2 = p2b[0] - RADIUS - 50, p2b[1] + 50, z1 - Line1 = Line.new(dxfattribs={"start": p1a2,"end": p2a2,"layer": "Pinbereich"}) - Line2 = Line.new(dxfattribs={"start": p1b2,"end": p2b2,"layer": "Pinbereich"}) - msp.add_entity(Line1) - msp.add_entity(Line2) + if rotation == 0.0: + p1a2 = p1a[0] - RADIUS - 50, p1a[1] + 50, z1 + p1b2 = p1b[0] - RADIUS - 50, p1b[1] - 50, z1 + p2a2 = p2a[0] + RADIUS + 50, p2a[1] + 50, z1 + p2b2 = p2b[0] + RADIUS + 50, p2b[1] - 50, z1 + Line1 = Line.new(dxfattribs={"start": p1a2,"end": p2a2,"layer": "Pinbereich"}) + Line2 = Line.new(dxfattribs={"start": p1b2,"end": p2b2,"layer": "Pinbereich"}) + msp.add_entity(Line1) + msp.add_entity(Line2) + elif rotation == 180.0: + p1a2 = p1a[0] + RADIUS + 50, p1a[1] - 50, z1 + p1b2 = p1b[0] + RADIUS + 50, p1b[1] + 50, z1 + p2a2 = p2a[0] - RADIUS - 50, p2a[1] - 50, z1 + p2b2 = p2b[0] - RADIUS - 50, p2b[1] + 50, z1 + Line1 = Line.new(dxfattribs={"start": p1a2,"end": p2a2,"layer": "Pinbereich"}) + Line2 = Line.new(dxfattribs={"start": p1b2,"end": p2b2,"layer": "Pinbereich"}) + msp.add_entity(Line1) + msp.add_entity(Line2) + elif rotation == 90.0: + p1a2 = p1a[0] + 50, p1a[1] - 50 + RADIUS , z1 + p1b2 = p1b[0] - 50, p1b[1] - 50 + RADIUS, z1 + p2a2 = p2a[0] + 50, p2a[1] + 50 - RADIUS, z1 + p2b2 = p2b[0] - 50, p2b[1] + 50 - RADIUS, z1 + Line1 = Line.new(dxfattribs={"start": p1a2,"end": p2a2,"layer": "Pinbereich"}) + Line2 = Line.new(dxfattribs={"start": p1b2,"end": p2b2,"layer": "Pinbereich"}) + msp.add_entity(Line1) + msp.add_entity(Line2) + elif rotation == 270.0: + p1a2 = p1a[0] - 50, p1a[1] + 50 - RADIUS , z1 + p1b2 = p1b[0] + 50, p1b[1] + 50 - RADIUS, z1 + p2a2 = p2a[0] - 50, p2a[1] - 50 + RADIUS, z1 + p2b2 = p2b[0] + 50, p2b[1] - 50 + RADIUS, z1 + Line1 = Line.new(dxfattribs={"start": p1a2,"end": p2a2,"layer": "Pinbereich"}) + Line2 = Line.new(dxfattribs={"start": p1b2,"end": p2b2,"layer": "Pinbereich"}) + msp.add_entity(Line1) + msp.add_entity(Line2) + # Linien zeichnen msp.add_line(p1a, p2a) msp.add_line(p1b, p2b)