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():
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 !!!