einfügen von einem eigennamen für die Blöcke
This commit is contained in:
+8
-1
@@ -179,9 +179,16 @@ def create_block_library(input_dir, output_file, config, logger=None):
|
||||
error_files.append((filename, error_msg))
|
||||
|
||||
# Platzierung in Reihen und Spalten
|
||||
# Attribut-Definition (ATTDEF) hinzufügen
|
||||
blk.add_attdef(
|
||||
tag="NAME",
|
||||
insert=(0.2, 0.2), # Position relativ zum Blockursprung
|
||||
height=0.25,
|
||||
text="Default Text"
|
||||
)
|
||||
msp.add_blockref(name, insert=(x_offset, y_offset))
|
||||
# Text mit Blocknamen über dem Block
|
||||
|
||||
|
||||
# Werte aus Config holen (Block: [dxf2lib])
|
||||
section = "dxf2lib"
|
||||
text_height = get_cfg_value(section, "text_height", DEFAULTS["text_height"])
|
||||
|
||||
+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