Anwendung der Erzeugung einer Id für jedes Element

This commit is contained in:
2026-06-16 17:14:19 +02:00
parent d1368dbb01
commit 0b501e5ea5
4 changed files with 94 additions and 31 deletions
+9 -3
View File
@@ -47,7 +47,8 @@
("DREHUNG" "0")
("ABSTAND" "2300")
("NUMMER" "0")
("HOEHE" "0"))
("HOEHE" "0")
("ID" ""))
)
;; Eckrad-Einstellungen
@@ -59,7 +60,8 @@
("DREHRICHTUNG" "UZS")
("DREHUNG" "0")
("NUMMER" "0")
("HOEHE" "0"))
("HOEHE" "0")
("ID" ""))
)
;; Letzter gewaehlter Typ (gespeichert zwischen Aufrufen)
@@ -455,7 +457,11 @@
(setq att-entity (entnext att-entity))
)
(entupd block-ent)
(princ (strcat "\n-> Kreisel #" (itoa kreisel-nummer) " eingefügt: " bname
;; Eindeutige ID zuweisen
(if (atoms-family 1 '("ssg-id-generate"))
(ssg-id-generate block-ent)
)
(princ (strcat "\n-> Kreisel #" (itoa kreisel-nummer) " eingefügt: " bname
" (Höhe=" block-hoehe ")"))
(entlast)
)
+34 -6
View File
@@ -596,6 +596,10 @@
;; 0. Attribute aus der Quell-.dwg lesen (vor ssg-start, da eigene INSERT/ERASE)
(setq srcAttribs (ssg-attrib-read-dwg (strcat *block-path* blockname ".dwg")))
;; ID-Attribut hinzufuegen falls noch nicht vorhanden
(if (and srcAttribs (not (assoc "ID" srcAttribs)))
(setq srcAttribs (append srcAttribs (list (cons "ID" ""))))
)
(if (null srcAttribs)
(progn (princ "\n[OMNI] Keine Attribute im Quell-Block gefunden.") nil)
(progn
@@ -711,6 +715,11 @@
(entmod ed)
(entupd textEnt)
;; Eindeutige ID zuweisen
(if (and blockEnt (atoms-family 1 '("ssg-id-generate")))
(ssg-id-generate blockEnt)
)
(princ (strcat "\n[OMNI] " bname " eingefuegt. Laenge=" laengeStr " mm"))
(setq ok T)
)
@@ -947,7 +956,7 @@
;; hoehe = Hoehe in mm als String (wird als HOEHE-Attribut gesetzt)
;; drehung = Drehwinkel in Grad als String (Block-Rotation)
;; Rueckgabe: Einfuegepunkt oder nil bei Abbruch
(defun omni:insert-dxf (sivasnr-str hoehe drehung / dxf-pfad data-pfad pt angleDeg blockEnt)
(defun omni:insert-dxf (sivasnr-str hoehe drehung / dxf-pfad data-pfad pt angleDeg blockEnt attribs layer-name)
(setq data-pfad (getenv "DXFM_DATA"))
(if (null data-pfad)
(progn
@@ -980,16 +989,35 @@
(setq blockEnt (entlast))
;; HOEHE und DREHUNG Attribute setzen
(if (and blockEnt (= (cdr (assoc 0 (entget blockEnt))) "INSERT"))
(ssg-attrib-set-on blockEnt
(list (cons "HOEHE" (if hoehe hoehe (ssg-cfg-or "omniflo" "default_hoehe" "2000")))
(cons "DREHUNG" (if drehung drehung (ssg-cfg-or "omniflo" "default_drehung" "0")))))
(progn
;; HOEHE und DREHUNG Attribute setzen
(ssg-attrib-set-on blockEnt
(list (cons "HOEHE" (if hoehe hoehe (ssg-cfg-or "omniflo" "default_hoehe" "2000")))
(cons "DREHUNG" (if drehung drehung (ssg-cfg-or "omniflo" "default_drehung" "0")))))
;; Layer aus LAYER-Attribut lesen und Block verschieben
(setq attribs (ssg-attrib-read blockEnt))
(setq layer-name (cdr (assoc "LAYER" attribs)))
(if (and layer-name (> (strlen layer-name) 0))
(progn
(ssg-make-layer layer-name 7 nil)
(entmod (subst (cons 8 layer-name) (assoc 8 (entget blockEnt)) (entget blockEnt)))
(entupd blockEnt)
)
)
)
)
;; Eindeutige ID zuweisen
(if (and blockEnt (atoms-family 1 '("ssg-id-generate")))
(ssg-id-generate blockEnt)
)
(princ (strcat "\n[OMNI] " sivasnr-str " eingefuegt."
" Hoehe=" (if hoehe hoehe (ssg-cfg-or "omniflo" "default_hoehe" "2000"))
" Drehung=" (if drehung drehung (ssg-cfg-or "omniflo" "default_drehung" "0"))))
" Drehung=" (if drehung drehung (ssg-cfg-or "omniflo" "default_drehung" "0"))
(if layer-name (strcat " Layer=" layer-name) "")))
(ssg-end)
pt
)
+7
View File
@@ -140,6 +140,13 @@
;; csv-name = Ergebnis-CSV-Name (z.B. "export.csv")
(defun csv:run-export (label py-name csv-name / ss i ename fh out-pfad
py-skript ergebnis-pfad cmd first-block count)
;; Vor dem Export: Doppelte IDs pruefen und korrigieren
(if (atoms-family 1 '("ssg-id-check-all"))
(progn
(princ (strcat "\n[" label "] Pruefe IDs auf Duplikate..."))
(ssg-id-check-all)
)
)
;; Vor dem Export HOEHE/DREHUNG aller Omniflo-Elemente aktualisieren
(princ (strcat "\n[" label "] Aktualisiere Hoehe/Drehung..."))
(omni:update-all-attribs)