einfügen von einem eigennamen für die Blöcke
This commit is contained in:
+17
-8
@@ -269,12 +269,15 @@ def handle_ils_2_0_gefaellestrecke(msp, teileid, merkmale, x, y, doc, lib_doc, v
|
||||
blockname = sym["name"]
|
||||
offset = sym["offset"]
|
||||
rotation = sym["rotation"]
|
||||
pos = (start[0] + offset[0], start[1] + offset[1]) if i == 0 else (ende[0] + offset[0], ende[1] + offset[1])
|
||||
pos = (start[0] + offset[0], start[1] + offset[1]
|
||||
) if i == 0 else (ende[0] + offset[0], ende[1] + offset[1])
|
||||
import_block(blockname, lib_doc, doc)
|
||||
bref = msp.add_blockref(blockname, pos, dxfattribs={"rotation": rotation})
|
||||
bref = msp.add_blockref(blockname, pos, dxfattribs={
|
||||
"rotation": rotation})
|
||||
bref.add_auto_attribs({ATTR_TAG: teileid})
|
||||
if verbose:
|
||||
print(f"[INFO] Block '{blockname}' an {'Startpunkt' if i==0 else 'Endpunkt'} {pos} für {teileid}, rot={rotation}")
|
||||
print(
|
||||
f"[INFO] Block '{blockname}' an {'Startpunkt' if i == 0 else 'Endpunkt'} {pos} für {teileid}, rot={rotation}")
|
||||
elif lib_doc is None:
|
||||
print("[WARN] lib_doc nicht verfügbar, Blöcke werden nicht eingefügt.")
|
||||
|
||||
@@ -308,8 +311,7 @@ def handle_omniflo(msp, teileid, merkmale, x, y, doc, lib_doc, verbose, symbols)
|
||||
print(f"[INFO] Omniflo Gerade → {teileid} Linie von ({start[0]:.1f}, {start[1]:.1f}) nach ({ende[0]:.1f}, {ende[1]:.1f})")
|
||||
return
|
||||
# Sonst wie gehabt: Block mit SivasNummer
|
||||
if merkmale.get("Radius") is not None:
|
||||
r= float(merkmale.get("Radius"))
|
||||
|
||||
|
||||
|
||||
if not lib_doc:
|
||||
@@ -329,11 +331,16 @@ def handle_omniflo(msp, teileid, merkmale, x, y, doc, lib_doc, verbose, symbols)
|
||||
imported_block.block.dxf.base_point = lib_block.block.dxf.base_point
|
||||
if merkmale.get("Drehung")== 0:
|
||||
|
||||
bref = msp.add_blockref(blockname, (x, y), dxfattribs={"xscale": 1.0, "yscale":1.0,"rotation": merkmale.get("Drehung")})
|
||||
bref = msp.add_blockref(blockname, (x-16.28, y), dxfattribs={"xscale": 1.0, "yscale":1.0,"rotation": merkmale.get("Drehung") })
|
||||
|
||||
else:
|
||||
bref = msp.add_blockref(blockname, (x, y), dxfattribs={"xscale": 1.0, "yscale":1.0,"rotation": merkmale.get("Drehung")+180})
|
||||
|
||||
bref = msp.add_blockref(blockname, (x-16.28, y), dxfattribs={
|
||||
"xscale": 1.0, "yscale": 1.0, "rotation": merkmale.get("Drehung") - 180})
|
||||
bref.add_attrib(
|
||||
tag= "NAME",
|
||||
text= "Hallo Welt"
|
||||
|
||||
)
|
||||
bref.add_auto_attribs({ATTR_TAG: teileid})
|
||||
if verbose:
|
||||
print(f"[INFO] Block '{blockname}' (Omniflo) → {teileid} ({x:.1f}, {y:.1f})")
|
||||
@@ -391,10 +398,12 @@ def main(csv_path: Path, lib_path: Path, cfg_path: Path,
|
||||
with csv_path.open(newline="", encoding="utf-8") as fh:
|
||||
reader = csv.DictReader(fh, delimiter=';')
|
||||
for row in reader:
|
||||
bezeichner = row["Bezeichnung"].strip()
|
||||
teileart = row["TeileArt"].strip()
|
||||
teileid = row["TeileId"].strip()
|
||||
planquadrat = row["Planquadrat"]
|
||||
merkmale = parse_merkmale(row.get("Merkmale", ""))
|
||||
merkmale["bezeichner"] = bezeichner
|
||||
|
||||
try:
|
||||
x_screen, y_screen = extract_coords(planquadrat)
|
||||
|
||||
Reference in New Issue
Block a user