Connecting Racks werden jetzt auc gezeichnet (gleich wie "originale" Racks aber werden bei beschriftung ignoriert

This commit is contained in:
2025-07-07 12:43:08 +02:00
parent c13b72891f
commit 6b0b3fea04
+28 -25
View File
@@ -132,7 +132,7 @@ def draw_racks(plines, doc):
for rack_name, rack_geom in plines.rack_geometry.items(): for rack_name, rack_geom in plines.rack_geometry.items():
classifier = rack_name[0] classifier = rack_name[0]
if classifier in ("t", "v", "c", "d"): if classifier in ("t", "v", "d"):
continue continue
coords = [(pt.x, pt.y, pt.z) for pt in rack_geom.coordinates] 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) polyline = msp.add_polyline3d(coords, dxfattribs=dxfattribs_rack)
if coords: if classifier == "c":
x, y, z = coords[0] # Get the first coordinate for text placement continue
# Orientierung bestimmen (horizontal oder vertikal) # Textplatzierung
if len(coords) >= 2: x, y, z = coords[0] # Get the first coordinate for text placement
x2, y2, _ = coords[1]
dx = x2 - x
dy = y2 - y
is_vertical = abs(dy) > abs(dx) # Orientierung bestimmen (horizontal oder vertikal)
else: if len(coords) >= 2:
is_vertical = False # Standard: horizontal x2, y2, _ = coords[1]
dx = x2 - x
dy = y2 - y
# Text platzieren is_vertical = abs(dy) > abs(dx)
text_entity = msp.add_text( else:
rack_name, is_vertical = False # Standard: horizontal
dxfattribs={
"layer": rack_layer,
"height": 75,
"color": 3,
"rotation": 90 if is_vertical else 0,
}
)
# Offset definieren # Text platzieren
offset_x = -50 if is_vertical else 50 text_entity = msp.add_text(
offset_y = 100 if is_vertical else 50 rack_name,
dxfattribs={
"layer": rack_layer,
"height": 75,
"color": 3,
"rotation": 90 if is_vertical else 0,
}
)
text_entity.set_placement((x + offset_x, y + offset_y)) # 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))
def find_close_key(pos2sensors, x, y, tolerance=10): # !!! Toleranz nicht in Config !!! def find_close_key(pos2sensors, x, y, tolerance=10): # !!! Toleranz nicht in Config !!!