Omniflo csv Export erste Fassung. Höhe und Winkel in die Attribute ergänzt. Dcl Dialoge ermöglichen Eingabe von Höhe und Drehung. Neuer Menü-eintrag bearbeiten in Omniflo dazu.
This commit is contained in:
+300
-97
@@ -443,11 +443,16 @@
|
||||
|
||||
;; --- Bogen-Auswahl-Dialog oeffnen ---
|
||||
;; winkel = KurvenWinkel (90, 67.5, 45, 22.5, 180)
|
||||
;; Rueckgabe: gewaehlter Bogen-Eintrag (alist) oder nil bei Abbruch
|
||||
(defun omni:bogen-dialog (winkel / dcl-pfad dat boegen-liste
|
||||
profil-liste ergebnis)
|
||||
;; init-hoehe / init-drehung = Vorbelegung (optional, fuer Edit-Modus)
|
||||
;; Rueckgabe: (eintrag hoehe drehung) oder nil bei Abbruch
|
||||
(defun omni:bogen-dialog (winkel init-hoehe init-drehung / dcl-pfad dat boegen-liste
|
||||
profil-liste ergebnis dlg-hoehe dlg-drehung)
|
||||
(if (null *OMNI-BOEGEN*) (omni:load-data))
|
||||
|
||||
;; Defaults
|
||||
(if (null init-hoehe) (setq init-hoehe "2000"))
|
||||
(if (null init-drehung) (setq init-drehung "0"))
|
||||
|
||||
;; Boegen nach Winkel filtern
|
||||
(setq boegen-liste (omni:filter *OMNI-BOEGEN* "KurvenWinkel" winkel))
|
||||
(if (null boegen-liste)
|
||||
@@ -477,6 +482,10 @@
|
||||
(end_list)
|
||||
(set_tile "bogenart" "0")
|
||||
|
||||
;; Hoehe und Drehung initialisieren
|
||||
(set_tile "val_hoehe" init-hoehe)
|
||||
(set_tile "val_drehung" init-drehung)
|
||||
|
||||
;; Startwerte anzeigen
|
||||
(omni:bogen-dlg-update "0")
|
||||
|
||||
@@ -485,15 +494,19 @@
|
||||
|
||||
;; OK/Abbrechen
|
||||
(action_tile "accept"
|
||||
"(setq ergebnis (atoi (get_tile \"bogenart\"))) (done_dialog 1)")
|
||||
(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 zurueckgeben
|
||||
;; Gewaehlten Eintrag mit Hoehe/Drehung zurueckgeben
|
||||
(if ergebnis
|
||||
(nth ergebnis *OMNI-DLG-BOEGEN*)
|
||||
(list (nth ergebnis *OMNI-DLG-BOEGEN*) dlg-hoehe dlg-drehung)
|
||||
nil
|
||||
)
|
||||
)
|
||||
@@ -508,46 +521,46 @@
|
||||
;; ============================================================
|
||||
|
||||
;; --- Omniflo / Boegen ---
|
||||
(defun c:OMNI_APB_630_90 ( / eintrag)
|
||||
(setq eintrag (omni:bogen-dialog 90))
|
||||
(if eintrag
|
||||
(omni:insert-from-entry eintrag)
|
||||
(defun c:OMNI_APB_630_90 ( / dlg-result)
|
||||
(setq dlg-result (omni:bogen-dialog 90 nil nil))
|
||||
(if dlg-result
|
||||
(omni:insert-from-entry dlg-result)
|
||||
(princ "\n[BOGEN] Abgebrochen.")
|
||||
)
|
||||
(princ)
|
||||
)
|
||||
|
||||
(defun c:OMNI_APB_550_675 ( / eintrag)
|
||||
(setq eintrag (omni:bogen-dialog 67.5))
|
||||
(if eintrag
|
||||
(omni:insert-from-entry eintrag)
|
||||
(defun c:OMNI_APB_550_675 ( / dlg-result)
|
||||
(setq dlg-result (omni:bogen-dialog 67.5 nil nil))
|
||||
(if dlg-result
|
||||
(omni:insert-from-entry dlg-result)
|
||||
(princ "\n[BOGEN] Abgebrochen.")
|
||||
)
|
||||
(princ)
|
||||
)
|
||||
|
||||
(defun c:OMNI_APB_630_45 ( / eintrag)
|
||||
(setq eintrag (omni:bogen-dialog 45))
|
||||
(if eintrag
|
||||
(omni:insert-from-entry eintrag)
|
||||
(defun c:OMNI_APB_630_45 ( / dlg-result)
|
||||
(setq dlg-result (omni:bogen-dialog 45 nil nil))
|
||||
(if dlg-result
|
||||
(omni:insert-from-entry dlg-result)
|
||||
(princ "\n[BOGEN] Abgebrochen.")
|
||||
)
|
||||
(princ)
|
||||
)
|
||||
|
||||
(defun c:OMNI_APB_550_225 ( / eintrag)
|
||||
(setq eintrag (omni:bogen-dialog 22.5))
|
||||
(if eintrag
|
||||
(omni:insert-from-entry eintrag)
|
||||
(defun c:OMNI_APB_550_225 ( / dlg-result)
|
||||
(setq dlg-result (omni:bogen-dialog 22.5 nil nil))
|
||||
(if dlg-result
|
||||
(omni:insert-from-entry dlg-result)
|
||||
(princ "\n[BOGEN] Abgebrochen.")
|
||||
)
|
||||
(princ)
|
||||
)
|
||||
|
||||
(defun c:OMNI_APB_650_180 ( / eintrag)
|
||||
(setq eintrag (omni:bogen-dialog 180))
|
||||
(if eintrag
|
||||
(omni:insert-from-entry eintrag)
|
||||
(defun c:OMNI_APB_650_180 ( / dlg-result)
|
||||
(setq dlg-result (omni:bogen-dialog 180 nil nil))
|
||||
(if dlg-result
|
||||
(omni:insert-from-entry dlg-result)
|
||||
(princ "\n[BOGEN] Abgebrochen.")
|
||||
)
|
||||
(princ)
|
||||
@@ -824,11 +837,16 @@
|
||||
;; --- Weichen-Auswahl-Dialog oeffnen ---
|
||||
;; winkel = KurvenWinkel (90, 45, 0, 22.5)
|
||||
;; weichentyp = "Einzelweiche", "Doppelweiche", "Dreiwegeweiche" oder nil fuer alle
|
||||
;; Rueckgabe: gewaehlter Weichen-Eintrag (alist) oder nil bei Abbruch
|
||||
(defun omni:weichen-dialog (winkel weichentyp / dcl-pfad dat basis-liste
|
||||
profil-liste ergebnis)
|
||||
;; 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)
|
||||
(if (null *OMNI-WEICHEN*) (omni:load-data))
|
||||
|
||||
;; Defaults
|
||||
(if (null init-hoehe) (setq init-hoehe "2000"))
|
||||
(if (null init-drehung) (setq init-drehung "0"))
|
||||
|
||||
;; Weichen nach Winkel filtern (nil = alle Winkel)
|
||||
(if winkel
|
||||
(setq basis-liste (omni:filter *OMNI-WEICHEN* "KurvenWinkel" winkel))
|
||||
@@ -876,6 +894,10 @@
|
||||
(end_list)
|
||||
(set_tile "profiltyp" "0")
|
||||
|
||||
;; Hoehe und Drehung initialisieren
|
||||
(set_tile "val_hoehe" init-hoehe)
|
||||
(set_tile "val_drehung" init-drehung)
|
||||
|
||||
;; Startwerte anzeigen
|
||||
(omni:weichen-dlg-update "0")
|
||||
|
||||
@@ -892,15 +914,19 @@
|
||||
|
||||
;; OK/Abbrechen
|
||||
(action_tile "accept"
|
||||
"(setq ergebnis (atoi (get_tile \"profiltyp\"))) (done_dialog 1)")
|
||||
(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 zurueckgeben
|
||||
;; Gewaehlten Eintrag mit Hoehe/Drehung zurueckgeben
|
||||
(if ergebnis
|
||||
(nth ergebnis *OMNI-DLG-WEICHEN*)
|
||||
(list (nth ergebnis *OMNI-DLG-WEICHEN*) dlg-hoehe dlg-drehung)
|
||||
nil
|
||||
)
|
||||
)
|
||||
@@ -918,8 +944,10 @@
|
||||
|
||||
;; --- DXF-Datei als Block einfuegen ---
|
||||
;; sivasnr-str = SivasNr als String (Dateiname ohne .dxf)
|
||||
;; 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 / dxf-pfad data-pfad pt)
|
||||
(defun omni:insert-dxf (sivasnr-str hoehe drehung / dxf-pfad data-pfad pt angleDeg blockEnt)
|
||||
(setq data-pfad (getenv "DXFM_DATA"))
|
||||
(if (null data-pfad)
|
||||
(progn
|
||||
@@ -938,12 +966,28 @@
|
||||
(if (null pt)
|
||||
(progn (princ "\n[OMNI] Abgebrochen.") nil)
|
||||
(progn
|
||||
(ssg-start "OMNI DXF Insert" '(("OSMODE")))
|
||||
(ssg-start "OMNI DXF Insert" '(("OSMODE") ("ATTREQ") ("ATTDIA")))
|
||||
(setvar "ATTREQ" 0)
|
||||
(setvar "ATTDIA" 0)
|
||||
|
||||
;; Block einfuegen mit Winkelabfrage (pause)
|
||||
(command "_.INSERT" dxf-pfad pt "" "" pause)
|
||||
;; Drehwinkel aus Dialog verwenden
|
||||
(setq angleDeg (if drehung (atof drehung) 0.0))
|
||||
|
||||
(princ (strcat "\n[OMNI] " sivasnr-str " eingefuegt."))
|
||||
;; Block einfuegen mit Drehwinkel aus Dialog
|
||||
(command "_.INSERT" dxf-pfad pt "" "" angleDeg)
|
||||
|
||||
(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 "2000"))
|
||||
(cons "DREHUNG" (if drehung drehung "0"))))
|
||||
)
|
||||
|
||||
(princ (strcat "\n[OMNI] " sivasnr-str " eingefuegt."
|
||||
" Hoehe=" (if hoehe hoehe "2000")
|
||||
" Drehung=" (if drehung drehung "0")))
|
||||
(ssg-end)
|
||||
pt
|
||||
)
|
||||
@@ -956,14 +1000,17 @@
|
||||
|
||||
|
||||
;; --- Eintrag aus Dialog-Ergebnis einfuegen ---
|
||||
;; Nimmt einen Eintrag (alist) und fuegt die zugehoerige DXF ein.
|
||||
(defun omni:insert-from-entry (eintrag / sivasnr-str)
|
||||
(if eintrag
|
||||
;; dlg-result = (eintrag hoehe drehung) aus omni:bogen-dialog / omni:weichen-dialog
|
||||
(defun omni:insert-from-entry (dlg-result / eintrag hoehe drehung sivasnr-str)
|
||||
(if dlg-result
|
||||
(progn
|
||||
(setq eintrag (car dlg-result))
|
||||
(setq hoehe (cadr dlg-result))
|
||||
(setq drehung (caddr dlg-result))
|
||||
(setq sivasnr-str (omni:sivasid-to-str (omni:val eintrag "Sivasnr")))
|
||||
(princ (strcat "\n[OMNI] Einfuegen: "
|
||||
(omni:val eintrag "ProfilTyp") " (" sivasnr-str ")"))
|
||||
(omni:insert-dxf sivasnr-str)
|
||||
(omni:insert-dxf sivasnr-str hoehe drehung)
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -974,136 +1021,292 @@
|
||||
;; ============================================================
|
||||
|
||||
;; --- Omniflo / Weiche 90 Grad ---
|
||||
(defun c:OMNI_W90_Einfach ( / eintrag)
|
||||
(setq eintrag (omni:weichen-dialog 90 "Einzelweiche"))
|
||||
(if eintrag
|
||||
(omni:insert-from-entry eintrag)
|
||||
(defun c:OMNI_W90_Einfach ( / dlg-result)
|
||||
(setq dlg-result (omni:weichen-dialog 90 "Einzelweiche" nil nil))
|
||||
(if dlg-result
|
||||
(omni:insert-from-entry dlg-result)
|
||||
(princ "\n[WEICHE] Abgebrochen.")
|
||||
)
|
||||
(princ)
|
||||
)
|
||||
|
||||
(defun c:OMNI_W90_Doppel ( / eintrag)
|
||||
(setq eintrag (omni:weichen-dialog 90 "Doppelweiche"))
|
||||
(if eintrag
|
||||
(omni:insert-from-entry eintrag)
|
||||
(defun c:OMNI_W90_Doppel ( / dlg-result)
|
||||
(setq dlg-result (omni:weichen-dialog 90 "Doppelweiche" nil nil))
|
||||
(if dlg-result
|
||||
(omni:insert-from-entry dlg-result)
|
||||
(princ "\n[WEICHE] Abgebrochen.")
|
||||
)
|
||||
(princ)
|
||||
)
|
||||
|
||||
(defun c:OMNI_W90_Dreiwege ( / eintrag)
|
||||
(setq eintrag (omni:weichen-dialog 90 "Dreiwegeweiche"))
|
||||
(if eintrag
|
||||
(omni:insert-from-entry eintrag)
|
||||
(defun c:OMNI_W90_Dreiwege ( / dlg-result)
|
||||
(setq dlg-result (omni:weichen-dialog 90 "Dreiwegeweiche" nil nil))
|
||||
(if dlg-result
|
||||
(omni:insert-from-entry dlg-result)
|
||||
(princ "\n[WEICHE] Abgebrochen.")
|
||||
)
|
||||
(princ)
|
||||
)
|
||||
|
||||
;; --- Omniflo / Weiche 45 Grad ---
|
||||
(defun c:OMNI_W45_Einfach ( / eintrag)
|
||||
(setq eintrag (omni:weichen-dialog 45 "Einzelweiche"))
|
||||
(if eintrag
|
||||
(omni:insert-from-entry eintrag)
|
||||
(defun c:OMNI_W45_Einfach ( / dlg-result)
|
||||
(setq dlg-result (omni:weichen-dialog 45 "Einzelweiche" nil nil))
|
||||
(if dlg-result
|
||||
(omni:insert-from-entry dlg-result)
|
||||
(princ "\n[WEICHE] Abgebrochen.")
|
||||
)
|
||||
(princ)
|
||||
)
|
||||
|
||||
(defun c:OMNI_W45_Doppel ( / eintrag)
|
||||
(setq eintrag (omni:weichen-dialog 45 "Doppelweiche"))
|
||||
(if eintrag
|
||||
(omni:insert-from-entry eintrag)
|
||||
(defun c:OMNI_W45_Doppel ( / dlg-result)
|
||||
(setq dlg-result (omni:weichen-dialog 45 "Doppelweiche" nil nil))
|
||||
(if dlg-result
|
||||
(omni:insert-from-entry dlg-result)
|
||||
(princ "\n[WEICHE] Abgebrochen.")
|
||||
)
|
||||
(princ)
|
||||
)
|
||||
|
||||
(defun c:OMNI_W45_Dreiwege ( / eintrag)
|
||||
(setq eintrag (omni:weichen-dialog 45 "Dreiwegeweiche"))
|
||||
(if eintrag
|
||||
(omni:insert-from-entry eintrag)
|
||||
(defun c:OMNI_W45_Dreiwege ( / dlg-result)
|
||||
(setq dlg-result (omni:weichen-dialog 45 "Dreiwegeweiche" nil nil))
|
||||
(if dlg-result
|
||||
(omni:insert-from-entry dlg-result)
|
||||
(princ "\n[WEICHE] Abgebrochen.")
|
||||
)
|
||||
(princ)
|
||||
)
|
||||
|
||||
;; --- Omniflo / Weichen Parallel ---
|
||||
(defun c:OMNI_WP_Einfach ( / eintrag)
|
||||
(setq eintrag (omni:weichen-dialog 0 "Einzelweiche"))
|
||||
(if eintrag
|
||||
(omni:insert-from-entry eintrag)
|
||||
(defun c:OMNI_WP_Einfach ( / dlg-result)
|
||||
(setq dlg-result (omni:weichen-dialog 0 "Einzelweiche" nil nil))
|
||||
(if dlg-result
|
||||
(omni:insert-from-entry dlg-result)
|
||||
(princ "\n[WEICHE] Abgebrochen.")
|
||||
)
|
||||
(princ)
|
||||
)
|
||||
|
||||
(defun c:OMNI_WP_Doppel ( / eintrag)
|
||||
(setq eintrag (omni:weichen-dialog 0 "Doppelweiche"))
|
||||
(if eintrag
|
||||
(omni:insert-from-entry eintrag)
|
||||
(defun c:OMNI_WP_Doppel ( / dlg-result)
|
||||
(setq dlg-result (omni:weichen-dialog 0 "Doppelweiche" nil nil))
|
||||
(if dlg-result
|
||||
(omni:insert-from-entry dlg-result)
|
||||
(princ "\n[WEICHE] Abgebrochen.")
|
||||
)
|
||||
(princ)
|
||||
)
|
||||
|
||||
(defun c:OMNI_WP_Dreiwege ( / eintrag)
|
||||
(setq eintrag (omni:weichen-dialog 0 "Dreiwegeweiche"))
|
||||
(if eintrag
|
||||
(omni:insert-from-entry eintrag)
|
||||
(defun c:OMNI_WP_Dreiwege ( / dlg-result)
|
||||
(setq dlg-result (omni:weichen-dialog 0 "Dreiwegeweiche" nil nil))
|
||||
(if dlg-result
|
||||
(omni:insert-from-entry dlg-result)
|
||||
(princ "\n[WEICHE] Abgebrochen.")
|
||||
)
|
||||
(princ)
|
||||
)
|
||||
|
||||
;; --- Omniflo / Weichenkoerper ---
|
||||
(defun c:OMNI_WK_Einfach ( / eintrag)
|
||||
(setq eintrag (omni:weichen-dialog 22.5 "Einzelweiche"))
|
||||
(if eintrag
|
||||
(omni:insert-from-entry eintrag)
|
||||
(defun c:OMNI_WK_Einfach ( / dlg-result)
|
||||
(setq dlg-result (omni:weichen-dialog 22.5 "Einzelweiche" nil nil))
|
||||
(if dlg-result
|
||||
(omni:insert-from-entry dlg-result)
|
||||
(princ "\n[WEICHE] Abgebrochen.")
|
||||
)
|
||||
(princ)
|
||||
)
|
||||
|
||||
(defun c:OMNI_WK_Doppel ( / eintrag)
|
||||
(setq eintrag (omni:weichen-dialog 22.5 "Doppelweiche"))
|
||||
(if eintrag
|
||||
(omni:insert-from-entry eintrag)
|
||||
(defun c:OMNI_WK_Doppel ( / dlg-result)
|
||||
(setq dlg-result (omni:weichen-dialog 22.5 "Doppelweiche" nil nil))
|
||||
(if dlg-result
|
||||
(omni:insert-from-entry dlg-result)
|
||||
(princ "\n[WEICHE] Abgebrochen.")
|
||||
)
|
||||
(princ)
|
||||
)
|
||||
|
||||
(defun c:OMNI_WK_Dreiwege ( / eintrag)
|
||||
(setq eintrag (omni:weichen-dialog 22.5 "Dreiwegeweiche"))
|
||||
(if eintrag
|
||||
(omni:insert-from-entry eintrag)
|
||||
(defun c:OMNI_WK_Dreiwege ( / dlg-result)
|
||||
(setq dlg-result (omni:weichen-dialog 22.5 "Dreiwegeweiche" nil nil))
|
||||
(if dlg-result
|
||||
(omni:insert-from-entry dlg-result)
|
||||
(princ "\n[WEICHE] Abgebrochen.")
|
||||
)
|
||||
(princ)
|
||||
)
|
||||
|
||||
;; --- Omniflo / Weichenkombinationen ---
|
||||
(defun c:OMNI_WKomb_Delta ( / eintrag)
|
||||
(setq eintrag (omni:weichen-dialog nil "Deltaweiche"))
|
||||
(if eintrag
|
||||
(omni:insert-from-entry eintrag)
|
||||
(defun c:OMNI_WKomb_Delta ( / dlg-result)
|
||||
(setq dlg-result (omni:weichen-dialog nil "Deltaweiche" nil nil))
|
||||
(if dlg-result
|
||||
(omni:insert-from-entry dlg-result)
|
||||
(princ "\n[WEICHE] Abgebrochen.")
|
||||
)
|
||||
(princ)
|
||||
)
|
||||
|
||||
(defun c:OMNI_WKomb_Star ( / eintrag)
|
||||
(setq eintrag (omni:weichen-dialog nil "Sternweiche"))
|
||||
(if eintrag
|
||||
(omni:insert-from-entry eintrag)
|
||||
(defun c:OMNI_WKomb_Star ( / dlg-result)
|
||||
(setq dlg-result (omni:weichen-dialog nil "Sternweiche" nil nil))
|
||||
(if dlg-result
|
||||
(omni:insert-from-entry dlg-result)
|
||||
(princ "\n[WEICHE] Abgebrochen.")
|
||||
)
|
||||
(princ)
|
||||
)
|
||||
|
||||
;; ============================================================
|
||||
;; OMNIFLO ELEMENT BEARBEITEN
|
||||
;; Selektiertes Omniflo-Element erneut im Dialog oeffnen,
|
||||
;; Typ/Hoehe/Drehung aendern und Block ersetzen.
|
||||
;; ============================================================
|
||||
|
||||
(defun c:OMNI_EDIT ( / ss sel ent ed attribs bname
|
||||
artinr hoehe drehung rotation
|
||||
typ eintrag winkel weichentyp
|
||||
dlg-result new-eintrag new-hoehe new-drehung
|
||||
basePoint sivasnr-str dxf-pfad data-pfad angleDeg blockEnt)
|
||||
|
||||
;; Implied Selection pruefen
|
||||
(setq ss (ssget "I"))
|
||||
(if (and ss (= (sslength ss) 1)
|
||||
(= (cdr (assoc 0 (entget (ssname ss 0)))) "INSERT"))
|
||||
(setq ent (ssname ss 0))
|
||||
)
|
||||
|
||||
(ssg-start "Omniflo bearbeiten" '(("OSMODE") ("ATTREQ") ("ATTDIA")))
|
||||
(setvar "OSMODE" 0)
|
||||
|
||||
;; 1. Block auswaehlen (falls nicht vorselektiert)
|
||||
(if (null ent)
|
||||
(progn
|
||||
(setq sel (entsel "\nOmniflo-Element auswaehlen: "))
|
||||
(if sel (setq ent (car sel)))
|
||||
)
|
||||
)
|
||||
(if (null ent) (progn (ssg-end) (exit)))
|
||||
|
||||
(setq ed (entget ent))
|
||||
(if (/= (cdr (assoc 0 ed)) "INSERT")
|
||||
(progn (ssg-emsg "Kein Block ausgewaehlt!") (ssg-end) (exit))
|
||||
)
|
||||
|
||||
;; 2. Bestehende Attribute lesen
|
||||
(setq attribs (ssg-attrib-read ent))
|
||||
(setq bname (cdr (assoc 2 ed)))
|
||||
(setq basePoint (cdr (assoc 10 ed)))
|
||||
(setq rotation (* (/ 180.0 pi) (cdr (assoc 50 ed))))
|
||||
|
||||
;; ARTINR = SivasNr, TEILEART = Typ-Erkennung
|
||||
(setq artinr (cdr (assoc "ARTINR" attribs)))
|
||||
(setq hoehe (cdr (assoc "HOEHE" attribs)))
|
||||
(setq drehung (cdr (assoc "DREHUNG" attribs)))
|
||||
|
||||
;; Fallbacks
|
||||
(if (null hoehe) (setq hoehe "2000"))
|
||||
(if (null drehung) (setq drehung (rtos rotation 2 1)))
|
||||
|
||||
;; 3. Typ bestimmen: Bogen oder Weiche
|
||||
(if (null *OMNI-BOEGEN*) (omni:load-data))
|
||||
|
||||
(setq typ nil)
|
||||
(setq eintrag nil)
|
||||
|
||||
;; Zuerst in Boegen suchen
|
||||
(if artinr
|
||||
(progn
|
||||
(setq eintrag (omni:get-bogen (if (/= (atoi artinr) 0) (atoi artinr) artinr)))
|
||||
(if eintrag (setq typ "bogen"))
|
||||
)
|
||||
)
|
||||
|
||||
;; Falls nicht gefunden, in Weichen suchen
|
||||
(if (and (null eintrag) artinr)
|
||||
(progn
|
||||
(setq eintrag (omni:get-weiche (if (/= (atoi artinr) 0) (atoi artinr) artinr)))
|
||||
(if eintrag (setq typ "weiche"))
|
||||
)
|
||||
)
|
||||
|
||||
;; Auch ueber Blockname versuchen (= SivasNr)
|
||||
(if (null eintrag)
|
||||
(progn
|
||||
(setq eintrag (omni:get-bogen (if (/= (atoi bname) 0) (atoi bname) bname)))
|
||||
(if eintrag (setq typ "bogen"))
|
||||
)
|
||||
)
|
||||
(if (null eintrag)
|
||||
(progn
|
||||
(setq eintrag (omni:get-weiche (if (/= (atoi bname) 0) (atoi bname) bname)))
|
||||
(if eintrag (setq typ "weiche"))
|
||||
)
|
||||
)
|
||||
|
||||
(if (null eintrag)
|
||||
(progn
|
||||
(ssg-emsg "Kein Omniflo-Element erkannt! (ARTINR/Blockname nicht im Katalog)")
|
||||
(ssg-end)
|
||||
(exit)
|
||||
)
|
||||
)
|
||||
|
||||
;; 4. Dialog oeffnen mit vorhandenen Werten
|
||||
(setq dlg-result nil)
|
||||
(if (= typ "bogen")
|
||||
(progn
|
||||
(setq winkel (cdr (assoc "KurvenWinkel" eintrag)))
|
||||
(setq dlg-result (omni:bogen-dialog winkel hoehe drehung))
|
||||
)
|
||||
(progn
|
||||
(setq winkel (cdr (assoc "KurvenWinkel" eintrag)))
|
||||
(setq weichentyp (cdr (assoc "WeichenTyp" eintrag)))
|
||||
(setq dlg-result (omni:weichen-dialog winkel weichentyp hoehe drehung))
|
||||
)
|
||||
)
|
||||
|
||||
(if (null dlg-result)
|
||||
(progn (princ "\nAbgebrochen.") (ssg-end) (exit))
|
||||
)
|
||||
|
||||
;; 5. Neuen Eintrag und Werte extrahieren
|
||||
(setq new-eintrag (car dlg-result))
|
||||
(setq new-hoehe (cadr dlg-result))
|
||||
(setq new-drehung (caddr dlg-result))
|
||||
(setq sivasnr-str (omni:sivasid-to-str (omni:val new-eintrag "Sivasnr")))
|
||||
|
||||
;; 6. DXF-Datei pruefen
|
||||
(setq data-pfad (getenv "DXFM_DATA"))
|
||||
(setq dxf-pfad (strcat data-pfad "/omniflo/" sivasnr-str ".dxf"))
|
||||
(if (not (findfile dxf-pfad))
|
||||
(progn
|
||||
(ssg-emsg (strcat "DXF nicht gefunden: " dxf-pfad))
|
||||
(ssg-end)
|
||||
(exit)
|
||||
)
|
||||
)
|
||||
|
||||
;; 7. Alten Block loeschen und neuen einfuegen
|
||||
(setvar "ATTREQ" 0)
|
||||
(setvar "ATTDIA" 0)
|
||||
(command "_.ERASE" ent "")
|
||||
|
||||
(setq angleDeg (if new-drehung (atof new-drehung) 0.0))
|
||||
(command "_.INSERT" dxf-pfad basePoint "" "" angleDeg)
|
||||
|
||||
(setq blockEnt (entlast))
|
||||
|
||||
;; Attribute setzen
|
||||
(if (and blockEnt (= (cdr (assoc 0 (entget blockEnt))) "INSERT"))
|
||||
(ssg-attrib-set-on blockEnt
|
||||
(list (cons "HOEHE" (if new-hoehe new-hoehe "2000"))
|
||||
(cons "DREHUNG" (if new-drehung new-drehung "0"))))
|
||||
)
|
||||
|
||||
(princ (strcat "\n[OMNI] Element aktualisiert: " sivasnr-str
|
||||
" Hoehe=" (if new-hoehe new-hoehe "2000")
|
||||
" Drehung=" (if new-drehung new-drehung "0")))
|
||||
|
||||
(ssg-end)
|
||||
(princ)
|
||||
)
|
||||
|
||||
|
||||
;; --- Omniflo / TEF Elemente ---
|
||||
(defun c:OMNI_TEF_UmlenkR ()
|
||||
(princ "\n[DUMMY] Umlenkspannst. rechts fuer TEF links")
|
||||
|
||||
Reference in New Issue
Block a user