[FIX] Weichentyp im json für die dynamische Erzeugung der Oberfläche für Deltaweichen korrigiert; [CHANGE] Drehung der Omniflo Objekte wird nun interaktiv durch den Benutzer angegeben wie zuvor in Bihler

This commit is contained in:
2026-07-22 08:07:24 +02:00
parent 67acbd8f38
commit 63e4e9ef32
7 changed files with 241 additions and 205 deletions
+71 -39
View File
@@ -332,12 +332,13 @@
;; z.B. "APB 60" oder "APB 110" (nil = keine Einschraenkung)
;; Rueckgabe: (eintrag hoehe drehung) oder nil bei Abbruch
(defun omni:bogen-dialog (winkel init-hoehe init-drehung profiltyp / dcl-pfad dat boegen-liste
profil-liste ergebnis dlg-hoehe dlg-drehung profil)
profil-liste ergebnis dlg-hoehe profil)
(if (null *OMNI-BOEGEN*) (omni:load-data))
;; Defaults
;; Hinweis: init-drehung wird nicht mehr verwendet - die Drehung wird nach
;; dem Einfuegen interaktiv abgefragt (omni:insert-dxf mit drehung=nil).
(if (null init-hoehe) (setq init-hoehe (ssg-cfg-or "omniflo" "default_hoehe" "2000")))
(if (null init-drehung) (setq init-drehung (ssg-cfg-or "omniflo" "default_drehung" "0")))
;; Boegen nach Winkel filtern
(setq boegen-liste (omni:filter *OMNI-BOEGEN* "KurvenWinkel" winkel))
@@ -388,9 +389,8 @@
(end_list)
(set_tile "bogenart" "0")
;; Hoehe und Drehung initialisieren
;; Hoehe initialisieren (Drehung erfolgt interaktiv nach dem Einfuegen)
(set_tile "val_hoehe" init-hoehe)
(set_tile "val_drehung" init-drehung)
;; Startwerte anzeigen
(omni:bogen-dlg-update "0")
@@ -403,16 +403,15 @@
(strcat
"(setq ergebnis (atoi (get_tile \"bogenart\")))"
"(setq dlg-hoehe (get_tile \"val_hoehe\"))"
"(setq dlg-drehung (get_tile \"val_drehung\"))"
"(done_dialog 1)"))
(action_tile "cancel" "(done_dialog 0)")
(start_dialog)
(unload_dialog dat)
;; Gewaehlten Eintrag mit Hoehe/Drehung zurueckgeben
;; Gewaehlten Eintrag mit Hoehe zurueckgeben (drehung=nil -> interaktiv)
(if ergebnis
(list (nth ergebnis *OMNI-DLG-BOEGEN*) dlg-hoehe dlg-drehung)
(list (nth ergebnis *OMNI-DLG-BOEGEN*) dlg-hoehe nil)
nil
)
)
@@ -766,13 +765,14 @@
;; weichentyp = "Einzelweiche", "Doppelweiche", "Dreiwegeweiche" oder nil fuer alle
;; init-hoehe / init-drehung = Vorbelegung (optional, fuer Edit-Modus)
;; Rueckgabe: (eintrag hoehe drehung) oder nil bei Abbruch
(defun omni:weichen-dialog (winkel weichentyp init-hoehe init-drehung / dcl-pfad dat basis-liste
profil-liste ergebnis dlg-hoehe dlg-drehung)
(defun omni:weichen-dialog (winkel weichentyp init-hoehe init-drehung breite / dcl-pfad dat basis-liste
profil-liste ergebnis dlg-hoehe)
(if (null *OMNI-WEICHEN*) (omni:load-data))
;; Defaults
;; Hinweis: init-drehung wird nicht mehr verwendet - die Drehung wird nach
;; dem Einfuegen interaktiv abgefragt (omni:insert-dxf mit drehung=nil).
(if (null init-hoehe) (setq init-hoehe (ssg-cfg-or "omniflo" "default_hoehe" "2000")))
(if (null init-drehung) (setq init-drehung (ssg-cfg-or "omniflo" "default_drehung" "0")))
;; Weichen nach Winkel filtern (nil = alle Winkel)
(if winkel
@@ -788,6 +788,14 @@
basis-liste))
)
;; Optional nach Breite filtern (z.B. Weichenkombinationen Delta 1400/700 vs. 1600/800)
(if breite
(setq basis-liste
(vl-remove-if-not
'(lambda (e) (= (cdr (assoc "Breite" e)) breite))
basis-liste))
)
(if (null basis-liste)
(progn
(alert (ssg-textf "omni-weiche-keine-gefunden"
@@ -823,9 +831,8 @@
(end_list)
(set_tile "profiltyp" "0")
;; Hoehe und Drehung initialisieren
;; Hoehe initialisieren (Drehung erfolgt interaktiv nach dem Einfuegen)
(set_tile "val_hoehe" init-hoehe)
(set_tile "val_drehung" init-drehung)
;; Startwerte anzeigen
(omni:weichen-dlg-update "0")
@@ -846,16 +853,15 @@
(strcat
"(setq ergebnis (atoi (get_tile \"profiltyp\")))"
"(setq dlg-hoehe (get_tile \"val_hoehe\"))"
"(setq dlg-drehung (get_tile \"val_drehung\"))"
"(done_dialog 1)"))
(action_tile "cancel" "(done_dialog 0)")
(start_dialog)
(unload_dialog dat)
;; Gewaehlten Eintrag mit Hoehe/Drehung zurueckgeben
;; Gewaehlten Eintrag mit Hoehe zurueckgeben (drehung=nil -> interaktiv)
(if ergebnis
(list (nth ergebnis *OMNI-DLG-WEICHEN*) dlg-hoehe dlg-drehung)
(list (nth ergebnis *OMNI-DLG-WEICHEN*) dlg-hoehe nil)
nil
)
)
@@ -876,7 +882,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 omniflo-pfad pt angleDeg winkel-rad drehung-anzeige blockEnt attribs layer-name)
(defun omni:insert-dxf (sivasnr-str hoehe drehung / dxf-pfad omniflo-pfad pt angleDeg drehung-anzeige blockEnt attribs layer-name)
(setq omniflo-pfad (getenv "DXFM_OMNIFLO"))
(if (null omniflo-pfad)
(progn
@@ -899,17 +905,15 @@
(setvar "ATTREQ" 0)
(setvar "ATTDIA" 0)
;; Drehwinkel aus Dialog uebernehmen, sonst interaktiv am Einfuegepunkt abfragen
;; Drehwinkel aus Dialog uebernehmen, sonst zunaechst ungedreht
;; einfuegen und den Winkel erst nach dem Einfuegen abfragen
;; (Nutzer kann die Orientierung am eingefuegten Objekt erkennen)
(if drehung
(progn
(setq angleDeg (atof drehung))
(setq drehung-anzeige drehung)
)
(progn
(setq winkel-rad (getangle pt (ssg-text "omni-prompt-drehwinkel")))
(setq angleDeg (if winkel-rad (* winkel-rad (/ 180.0 pi)) 0.0))
(setq drehung-anzeige (rtos angleDeg 2 1))
)
(setq angleDeg 0.0)
)
;; Hoehe als Z-Koordinate auf den Einfuegepunkt anwenden
@@ -930,6 +934,23 @@
(setq blockEnt (entlast))
;; Drehwinkel interaktiv abfragen: ROTATE-Befehl mit der Entity
;; und Basispunkt starten, dann per 'pause' die Winkeleingabe dem
;; Nutzer ueberlassen (Objekt dreht sich beim Ziehen sichtbar mit).
;; WICHTIG: Ohne 'pause' wuerde die nachfolgende CMDACTIVE-Schleife
;; die Winkelabfrage sofort mit "" (=0 Grad) beenden.
(if (and (null drehung) blockEnt (= (cdr (assoc 0 (entget blockEnt))) "INSERT"))
(progn
(command "_.ROTATE" blockEnt "" pt pause)
(while (> (getvar "CMDACTIVE") 0) (command pause))
(setq angleDeg (* (cdr (assoc 50 (entget blockEnt))) (/ 180.0 pi)))
(setq drehung-anzeige (rtos angleDeg 2 1))
)
)
(if (null drehung-anzeige)
(setq drehung-anzeige (rtos angleDeg 2 1))
)
(if (and blockEnt (= (cdr (assoc 0 (entget blockEnt))) "INSERT"))
(progn
;; HOEHE und DREHUNG Attribute setzen
@@ -996,7 +1017,7 @@
;; --- Omniflo / Weiche 90 Grad ---
(defun c:OMNI_W90_Einfach ( / dlg-result)
(setq dlg-result (omni:weichen-dialog 90 "Einzelweiche" nil nil))
(setq dlg-result (omni:weichen-dialog 90 "Einzelweiche" nil nil nil))
(if dlg-result
(omni:insert-from-entry dlg-result)
(princ (ssg-text "omni-abbruch-weiche"))
@@ -1005,7 +1026,7 @@
)
(defun c:OMNI_W90_Doppel ( / dlg-result)
(setq dlg-result (omni:weichen-dialog 90 "Doppelweiche" nil nil))
(setq dlg-result (omni:weichen-dialog 90 "Doppelweiche" nil nil nil))
(if dlg-result
(omni:insert-from-entry dlg-result)
(princ (ssg-text "omni-abbruch-weiche"))
@@ -1014,7 +1035,7 @@
)
(defun c:OMNI_W90_Dreiwege ( / dlg-result)
(setq dlg-result (omni:weichen-dialog 90 "Dreiwegeweiche" nil nil))
(setq dlg-result (omni:weichen-dialog 90 "Dreiwegeweiche" nil nil nil))
(if dlg-result
(omni:insert-from-entry dlg-result)
(princ (ssg-text "omni-abbruch-weiche"))
@@ -1024,7 +1045,7 @@
;; --- Omniflo / Weiche 45 Grad ---
(defun c:OMNI_W45_Einfach ( / dlg-result)
(setq dlg-result (omni:weichen-dialog 45 "Einzelweiche" nil nil))
(setq dlg-result (omni:weichen-dialog 45 "Einzelweiche" nil nil nil))
(if dlg-result
(omni:insert-from-entry dlg-result)
(princ (ssg-text "omni-abbruch-weiche"))
@@ -1033,7 +1054,7 @@
)
(defun c:OMNI_W45_Doppel ( / dlg-result)
(setq dlg-result (omni:weichen-dialog 45 "Doppelweiche" nil nil))
(setq dlg-result (omni:weichen-dialog 45 "Doppelweiche" nil nil nil))
(if dlg-result
(omni:insert-from-entry dlg-result)
(princ (ssg-text "omni-abbruch-weiche"))
@@ -1042,7 +1063,7 @@
)
(defun c:OMNI_W45_Dreiwege ( / dlg-result)
(setq dlg-result (omni:weichen-dialog 45 "Dreiwegeweiche" nil nil))
(setq dlg-result (omni:weichen-dialog 45 "Dreiwegeweiche" nil nil nil))
(if dlg-result
(omni:insert-from-entry dlg-result)
(princ (ssg-text "omni-abbruch-weiche"))
@@ -1052,7 +1073,7 @@
;; --- Omniflo / Weichen Parallel ---
(defun c:OMNI_WP_Einfach ( / dlg-result)
(setq dlg-result (omni:weichen-dialog 0 "Einzelweiche" nil nil))
(setq dlg-result (omni:weichen-dialog 0 "Einzelweiche" nil nil nil))
(if dlg-result
(omni:insert-from-entry dlg-result)
(princ (ssg-text "omni-abbruch-weiche"))
@@ -1061,7 +1082,7 @@
)
(defun c:OMNI_WP_Doppel ( / dlg-result)
(setq dlg-result (omni:weichen-dialog 0 "Doppelweiche" nil nil))
(setq dlg-result (omni:weichen-dialog 0 "Doppelweiche" nil nil nil))
(if dlg-result
(omni:insert-from-entry dlg-result)
(princ (ssg-text "omni-abbruch-weiche"))
@@ -1070,7 +1091,7 @@
)
(defun c:OMNI_WP_Dreiwege ( / dlg-result)
(setq dlg-result (omni:weichen-dialog 0 "Dreiwegeweiche" nil nil))
(setq dlg-result (omni:weichen-dialog 0 "Dreiwegeweiche" nil nil nil))
(if dlg-result
(omni:insert-from-entry dlg-result)
(princ (ssg-text "omni-abbruch-weiche"))
@@ -1080,7 +1101,7 @@
;; --- Omniflo / Weichenkoerper ---
(defun c:OMNI_WK_Einfach ( / dlg-result)
(setq dlg-result (omni:weichen-dialog 22.5 "Einzelweiche" nil nil))
(setq dlg-result (omni:weichen-dialog 22.5 "Einzelweiche" nil nil nil))
(if dlg-result
(omni:insert-from-entry dlg-result)
(princ (ssg-text "omni-abbruch-weiche"))
@@ -1089,7 +1110,7 @@
)
(defun c:OMNI_WK_Doppel ( / dlg-result)
(setq dlg-result (omni:weichen-dialog 22.5 "Doppelweiche" nil nil))
(setq dlg-result (omni:weichen-dialog 22.5 "Doppelweiche" nil nil nil))
(if dlg-result
(omni:insert-from-entry dlg-result)
(princ (ssg-text "omni-abbruch-weiche"))
@@ -1098,7 +1119,7 @@
)
(defun c:OMNI_WK_Dreiwege ( / dlg-result)
(setq dlg-result (omni:weichen-dialog 22.5 "Dreiwegeweiche" nil nil))
(setq dlg-result (omni:weichen-dialog 22.5 "Dreiwegeweiche" nil nil nil))
(if dlg-result
(omni:insert-from-entry dlg-result)
(princ (ssg-text "omni-abbruch-weiche"))
@@ -1107,8 +1128,17 @@
)
;; --- Omniflo / Weichenkombinationen ---
(defun c:OMNI_WKomb_Delta ( / dlg-result)
(setq dlg-result (omni:weichen-dialog nil "Deltaweiche" nil nil))
(defun c:OMNI_WKomb_Delta_1400 ( / dlg-result)
(setq dlg-result (omni:weichen-dialog nil "Deltaweiche" nil nil 1400))
(if dlg-result
(omni:insert-from-entry dlg-result)
(princ (ssg-text "omni-abbruch-weiche"))
)
(princ)
)
(defun c:OMNI_WKomb_Delta_1600 ( / dlg-result)
(setq dlg-result (omni:weichen-dialog nil "Deltaweiche" nil nil 1600))
(if dlg-result
(omni:insert-from-entry dlg-result)
(princ (ssg-text "omni-abbruch-weiche"))
@@ -1117,7 +1147,7 @@
)
(defun c:OMNI_WKomb_Star ( / dlg-result)
(setq dlg-result (omni:weichen-dialog nil "Sternweiche" nil nil))
(setq dlg-result (omni:weichen-dialog nil "Sternweiche" nil nil nil))
(if dlg-result
(omni:insert-from-entry dlg-result)
(princ (ssg-text "omni-abbruch-weiche"))
@@ -1230,7 +1260,7 @@
(progn
(setq winkel (cdr (assoc "KurvenWinkel" eintrag)))
(setq weichentyp (cdr (assoc "WeichenTyp" eintrag)))
(setq dlg-result (omni:weichen-dialog winkel weichentyp hoehe drehung))
(setq dlg-result (omni:weichen-dialog winkel weichentyp hoehe drehung nil))
)
)
@@ -1239,9 +1269,11 @@
)
;; 5. Neuen Eintrag und Werte extrahieren
;; Drehung: Dialog liefert keine Drehung mehr (interaktiv beim Neu-Einfuegen);
;; beim Edit wird die bestehende Blockdrehung beibehalten (in-place Neuaufbau).
(setq new-eintrag (car dlg-result))
(setq new-hoehe (cadr dlg-result))
(setq new-drehung (caddr dlg-result))
(setq new-drehung (or (caddr dlg-result) drehung))
(setq sivasnr-str (omni:sivasid-to-str (omni:val new-eintrag "Sivasnr")))
;; 6. DXF-Datei pruefen