Oberfläche für Standard von Varioförder und Gefällestrecke bauen lassen
This commit is contained in:
+401
-99
@@ -1611,6 +1611,12 @@
|
||||
startpunkt last-ent nach-aus-pt (float hz) (float L_stau)
|
||||
es-seite))
|
||||
|
||||
;; Edit-Metadaten (Fahrtrichtung, Gefaellewinkel, Element-Winkel) als XDATA
|
||||
;; auf das GF_N-INSERT schreiben, damit GEFAELLESTRECKE_EDIT die Strecke
|
||||
;; verlustfrei nachbauen kann. Nicht Teil des Sivas-Attributsatzes.
|
||||
(gf-xdata-schreiben gf-insert hz winkel as-winkel es-winkel
|
||||
(caddr startpunkt) deltaL-total)
|
||||
|
||||
(princ "\n\n=========================================")
|
||||
(princ (ssg-text "gf-status-erfolgreich-eingefuegt"))
|
||||
(princ "\n=========================================")
|
||||
@@ -1620,14 +1626,246 @@
|
||||
(list gf-insert gf-deltaH (float deltaL-total))
|
||||
)
|
||||
|
||||
;; ============================================================
|
||||
;; TEIL 5b: DCL-DIALOG (Modus 1 - parametrische Eingabe)
|
||||
;; ============================================================
|
||||
|
||||
;; Parametrische Eingabe fuer Modus 1 / Edit ueber DCL-Dialog
|
||||
;; (dcl/gefaellestrecke.dcl). Analog zum Kreisel-Dialog, ergaenzt
|
||||
;; um die Angabe der Einfuegehoehe (Z).
|
||||
;; prefill: Assoziationsliste zur Vorbelegung (fuer GEFAELLESTRECKE_EDIT) mit
|
||||
;; Schluesseln "deltaL" "winkel" "hz" "as-seite" "es-seite" "einfuegehoehe"
|
||||
;; "as-winkel" "es-winkel" - oder nil fuer Neuanlage (Modus 1) mit Defaults.
|
||||
;; Rueckgabe: (deltaL winkel hz-winkel as-seite es-seite einfuegehoehe
|
||||
;; as-winkel es-winkel)
|
||||
;; oder nil bei Abbruch / fehlendem Dialog.
|
||||
(defun gf-dialog-eingabe ( prefill / dcl-pfad dat ergebnis
|
||||
dlg-deltal dlg-hoehe dlg-winkel
|
||||
dlg-richtung dlg-aus dlg-ein
|
||||
dlg-aus-winkel dlg-ein-winkel
|
||||
hz-winkel as-seite es-seite as-winkel es-winkel)
|
||||
(setq dcl-pfad (strcat (getenv "DXFM_DCL") "/gefaellestrecke.dcl"))
|
||||
(setq dat (load_dialog dcl-pfad))
|
||||
(if (not (new_dialog "gefaellestrecke" dat))
|
||||
(progn
|
||||
(if (>= dat 0) (unload_dialog dat))
|
||||
(alert (ssg-textf "gf-alert-dialog-fehlt" (list dcl-pfad)))
|
||||
nil
|
||||
)
|
||||
(progn
|
||||
;; Vorbelegung: aus prefill (Edit) oder Defaults (Neuanlage)
|
||||
(set_tile "deltal"
|
||||
(if prefill (rtos (cdr (assoc "deltaL" prefill)) 2 0)
|
||||
(rtos (ssg-cfg-or "gefaelle" "default_delta_l" 5000.0) 2 0)))
|
||||
(set_tile "einfuegehoehe"
|
||||
(if prefill (rtos (cdr (assoc "einfuegehoehe" prefill)) 2 1) "0"))
|
||||
(set_tile "winkel"
|
||||
(if prefill (rtos (cdr (assoc "winkel" prefill)) 2 1)
|
||||
(rtos (ssg-cfg-or "gefaelle" "default_winkel" 3.0) 2 1)))
|
||||
|
||||
;; Fahrtrichtung
|
||||
(start_list "fahrtrichtung")
|
||||
(add_list (ssg-textf "gf-dlg-richtung-0" (list grad-zeichen)))
|
||||
(add_list (ssg-textf "gf-dlg-richtung-90" (list grad-zeichen)))
|
||||
(add_list (ssg-textf "gf-dlg-richtung-180" (list grad-zeichen)))
|
||||
(add_list (ssg-textf "gf-dlg-richtung-270" (list grad-zeichen)))
|
||||
(end_list)
|
||||
(set_tile "fahrtrichtung"
|
||||
(if prefill
|
||||
(cond ((equal (cdr (assoc "hz" prefill)) 90.0 0.1) "1")
|
||||
((equal (cdr (assoc "hz" prefill)) 180.0 0.1) "2")
|
||||
((equal (cdr (assoc "hz" prefill)) 270.0 0.1) "3")
|
||||
(t "0"))
|
||||
"0"))
|
||||
|
||||
;; AUS-Element: Winkel (90/30) + Seite
|
||||
(start_list "aus_winkel")
|
||||
(add_list "90")
|
||||
(add_list "30")
|
||||
(end_list)
|
||||
(set_tile "aus_winkel"
|
||||
(if (and prefill (equal (cdr (assoc "as-winkel" prefill)) "30")) "1" "0"))
|
||||
(start_list "aus_seite")
|
||||
(add_list (ssg-text "gf-dlg-links"))
|
||||
(add_list (ssg-text "gf-dlg-rechts"))
|
||||
(end_list)
|
||||
(set_tile "aus_seite"
|
||||
(if (and prefill (equal (cdr (assoc "as-seite" prefill)) "rechts")) "1" "0"))
|
||||
|
||||
;; EIN-Element: Winkel (90/30) + Seite
|
||||
(start_list "ein_winkel")
|
||||
(add_list "90")
|
||||
(add_list "30")
|
||||
(end_list)
|
||||
(set_tile "ein_winkel"
|
||||
(if (and prefill (equal (cdr (assoc "es-winkel" prefill)) "30")) "1" "0"))
|
||||
(start_list "ein_seite")
|
||||
(add_list (ssg-text "gf-dlg-links"))
|
||||
(add_list (ssg-text "gf-dlg-rechts"))
|
||||
(end_list)
|
||||
(set_tile "ein_seite"
|
||||
(if (and prefill (equal (cdr (assoc "es-seite" prefill)) "rechts")) "1" "0"))
|
||||
|
||||
;; Actions
|
||||
(action_tile "accept"
|
||||
(strcat
|
||||
"(setq dlg-deltal (get_tile \"deltal\"))"
|
||||
"(setq dlg-hoehe (get_tile \"einfuegehoehe\"))"
|
||||
"(setq dlg-winkel (get_tile \"winkel\"))"
|
||||
"(setq dlg-richtung (get_tile \"fahrtrichtung\"))"
|
||||
"(setq dlg-aus-winkel (get_tile \"aus_winkel\"))"
|
||||
"(setq dlg-aus (get_tile \"aus_seite\"))"
|
||||
"(setq dlg-ein-winkel (get_tile \"ein_winkel\"))"
|
||||
"(setq dlg-ein (get_tile \"ein_seite\"))"
|
||||
"(done_dialog 1)"
|
||||
)
|
||||
)
|
||||
(action_tile "cancel" "(done_dialog 0)")
|
||||
|
||||
(setq ergebnis (start_dialog))
|
||||
(unload_dialog dat)
|
||||
|
||||
(if (= ergebnis 1)
|
||||
(progn
|
||||
(setq hz-winkel
|
||||
(cond ((= dlg-richtung "1") 90.0)
|
||||
((= dlg-richtung "2") 180.0)
|
||||
((= dlg-richtung "3") 270.0)
|
||||
(t 0.0)))
|
||||
(setq as-seite (if (= dlg-aus "1") "rechts" "links"))
|
||||
(setq es-seite (if (= dlg-ein "1") "rechts" "links"))
|
||||
(setq as-winkel (if (= dlg-aus-winkel "1") "30" "90"))
|
||||
(setq es-winkel (if (= dlg-ein-winkel "1") "30" "90"))
|
||||
(list
|
||||
(atof dlg-deltal)
|
||||
(atof dlg-winkel)
|
||||
hz-winkel
|
||||
as-seite
|
||||
es-seite
|
||||
(atof dlg-hoehe)
|
||||
as-winkel
|
||||
es-winkel)
|
||||
)
|
||||
nil
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;; Gemeinsamer Abschluss fuer Modus 1 + 2: Laengenberechnung,
|
||||
;; Zusammenfassung, Bestaetigung und Einfuegen.
|
||||
;; startpunkt: Einfuegepunkt AUS-Element (inkl. Z aus Einfuegehoehe)
|
||||
;; as-winkel/es-winkel: "30" oder "90" (Element-Variante)
|
||||
(defun gf-modus12-abschluss (deltaL winkel hz-winkel as-seite es-seite startpunkt
|
||||
as-winkel es-winkel /
|
||||
rad sep-x L_stau antwort)
|
||||
(if (null as-winkel) (setq as-winkel "90"))
|
||||
(if (null es-winkel) (setq es-winkel "90"))
|
||||
(setq winkel (float winkel))
|
||||
(setq rad (* winkel (/ pi 180.0)))
|
||||
(princ (ssg-textf "gf-status-winkel" (list (rtos winkel 2 1) grad-zeichen)))
|
||||
|
||||
;; AS-/ES-Masse fuer die gewaehlte Winkel-/Seiten-Variante setzen
|
||||
;; (aktualisiert aus-dx/ein-dx vor der Laengenberechnung)
|
||||
(vf-set-as-masse as-winkel as-seite)
|
||||
(vf-set-es-masse es-winkel es-seite)
|
||||
|
||||
;; Laengenberechnung
|
||||
;; deltaL = aus_dx + L_stau*cos(rad) + sep*cos(rad) + ein_dx
|
||||
(setq sep-x (* (ssg-cfg-or "gefaelle" "separator_breite" 300.0) (cos rad)))
|
||||
(setq L_stau (/ (- deltaL aus-dx ein-dx sep-x) (cos rad)))
|
||||
|
||||
;; Validierung
|
||||
(if (<= L_stau 0.1)
|
||||
(progn
|
||||
(alert (ssg-textf "gf-alert-staustrecke-ungueltig" (list (rtos L_stau 2 2))))
|
||||
(exit)
|
||||
)
|
||||
)
|
||||
|
||||
;; Zusammenfassung
|
||||
(princ "\n\n=========================================")
|
||||
(princ (ssg-textf "gf-status-fahrtrichtung" (list (rtos hz-winkel 2 1) grad-zeichen)))
|
||||
(princ (ssg-textf "gf-status-zus2-winkel" (list (rtos winkel 2 1) grad-zeichen)))
|
||||
(princ (ssg-textf "gf-status-zus2-aus-seite" (list as-seite)))
|
||||
(princ (ssg-textf "gf-status-zus2-ein-seite" (list es-seite)))
|
||||
(princ (ssg-textf "gf-status-zus2-lstau" (list (rtos L_stau 2 2))))
|
||||
(princ "\n=========================================")
|
||||
|
||||
;; Bestaetigung
|
||||
(setq antwort (getstring (ssg-text "gf-prompt-einfuegen")))
|
||||
(if (not (= antwort "2"))
|
||||
(gefaellestrecke-einfuegen L_stau (fix winkel) startpunkt as-seite es-seite hz-winkel deltaL as-winkel es-winkel)
|
||||
(princ (ssg-text "gf-status-abgebrochen"))
|
||||
)
|
||||
)
|
||||
|
||||
;; Nicht-interaktiver Neuaufbau (fuer GEFAELLESTRECKE_EDIT): Element-Masse
|
||||
;; setzen, L_stau berechnen und einfuegen - ohne Zusammenfassung/Rueckfrage.
|
||||
;; Rueckgabe: (ename deltaH deltaL) von gefaellestrecke-einfuegen oder nil.
|
||||
(defun gf-rebuild (deltaL winkel hz-winkel as-seite es-seite startpunkt
|
||||
as-winkel es-winkel /
|
||||
rad sep-x L_stau)
|
||||
(if (null as-winkel) (setq as-winkel "90"))
|
||||
(if (null es-winkel) (setq es-winkel "90"))
|
||||
(setq winkel (float winkel))
|
||||
(setq rad (* winkel (/ pi 180.0)))
|
||||
(vf-set-as-masse as-winkel as-seite)
|
||||
(vf-set-es-masse es-winkel es-seite)
|
||||
(setq sep-x (* (ssg-cfg-or "gefaelle" "separator_breite" 300.0) (cos rad)))
|
||||
(setq L_stau (/ (- deltaL aus-dx ein-dx sep-x) (cos rad)))
|
||||
(if (<= L_stau 0.1)
|
||||
(progn
|
||||
(alert (ssg-textf "gf-alert-staustrecke-ungueltig" (list (rtos L_stau 2 2))))
|
||||
nil
|
||||
)
|
||||
(gefaellestrecke-einfuegen
|
||||
L_stau (fix winkel) startpunkt as-seite es-seite hz-winkel deltaL as-winkel es-winkel)
|
||||
)
|
||||
)
|
||||
|
||||
;; ============================================================
|
||||
;; XDATA-Metadaten fuer den Edit-Nachbau (App "SSG_GF_EDIT").
|
||||
;; Bewusst NICHT im Sivas-Attributsatz, damit der Export unveraendert bleibt.
|
||||
;; ============================================================
|
||||
(if (null *gf-xdata-app*) (setq *gf-xdata-app* "SSG_GF_EDIT"))
|
||||
|
||||
;; Fahrtrichtung/Winkel/Element-Varianten als XDATA auf das GF_N-INSERT schreiben.
|
||||
(defun gf-xdata-schreiben (ent hz winkel as-winkel es-winkel z-start deltaL /)
|
||||
(regapp *gf-xdata-app*)
|
||||
(entmod
|
||||
(append (entget ent)
|
||||
(list
|
||||
(list -3
|
||||
(list *gf-xdata-app*
|
||||
(cons 1000 (rtos (float hz) 2 4))
|
||||
(cons 1000 (rtos (float winkel) 2 4))
|
||||
(cons 1000 (if as-winkel as-winkel "90"))
|
||||
(cons 1000 (if es-winkel es-winkel "90"))
|
||||
(cons 1000 (rtos (float z-start) 2 4))
|
||||
(cons 1000 (rtos (float deltaL) 2 4)))))))
|
||||
ent
|
||||
)
|
||||
|
||||
;; XDATA lesen -> (hz-str winkel-str as-winkel es-winkel z-str deltaL-str) oder nil.
|
||||
(defun gf-xdata-lesen (ent / xd app-data)
|
||||
(setq xd (entget ent (list *gf-xdata-app*)))
|
||||
(setq app-data (cdr (assoc -3 xd)))
|
||||
(if app-data
|
||||
(mapcar 'cdr (cdr (car app-data)))
|
||||
nil
|
||||
)
|
||||
)
|
||||
|
||||
;; ============================================================
|
||||
;; TEIL 6: HAUPTBEFEHL
|
||||
;; ============================================================
|
||||
|
||||
(defun c:GEFAELLESTRECKE ( / antwort eingabe-modus deltaL winkel rad L_stau sep-x
|
||||
(defun c:GEFAELLESTRECKE ( / antwort deltaL winkel
|
||||
as-seite es-seite gf-as-winkel gf-es-winkel
|
||||
line-points startpunkt endpunkt differenz
|
||||
deltaX deltaY startpunkt-fuer-einfuegen hz-winkel)
|
||||
deltaX deltaY startpunkt-fuer-einfuegen hz-winkel
|
||||
dlg-werte)
|
||||
|
||||
(princ "\n=========================================")
|
||||
(princ (ssg-text "gf-banner-titel"))
|
||||
@@ -1655,95 +1893,52 @@
|
||||
(gf-linienzug-modus)
|
||||
)
|
||||
|
||||
;; Modus 1+2: einfache Gefaellestrecke
|
||||
(t
|
||||
(if (= antwort "2")
|
||||
(setq eingabe-modus "Linie")
|
||||
(setq eingabe-modus "Manuell")
|
||||
;; Modus 2: 3D-Linie (Konsoleneingabe)
|
||||
((= antwort "2")
|
||||
(princ (ssg-text "gf-modus2-header"))
|
||||
(command "BKS" "W")
|
||||
(princ (ssg-text "gf-status-bks-welt"))
|
||||
(setq line-points
|
||||
(get-line-start-end-points
|
||||
(ssg-text "gf-prompt-3dlinie-richtung")))
|
||||
(if (null line-points)
|
||||
(progn (alert (ssg-text "gf-alert-keine-linie")) (exit))
|
||||
)
|
||||
|
||||
;; Modus 1: Manuelle Eingabe
|
||||
(if (= eingabe-modus "Manuell")
|
||||
(progn
|
||||
(princ (ssg-text "gf-modus1-header"))
|
||||
(setq startpunkt-fuer-einfuegen
|
||||
(getpoint (ssg-text "gf-prompt-startpunkt-aus")))
|
||||
(if (null startpunkt-fuer-einfuegen)
|
||||
(setq startpunkt-fuer-einfuegen '(0 0 0)))
|
||||
(setq deltaL (getreal (ssg-textf "gf-prompt-deltal-abstand" (list delta-sym))))
|
||||
(if (or (null deltaL) (<= deltaL 0))
|
||||
(setq deltaL (ssg-cfg-or "gefaelle" "default_delta_l" 5000.0)))
|
||||
)
|
||||
;; Modus 2: 3D-Linie
|
||||
(progn
|
||||
(princ (ssg-text "gf-modus2-header"))
|
||||
(command "BKS" "W")
|
||||
(princ (ssg-text "gf-status-bks-welt"))
|
||||
(setq line-points
|
||||
(get-line-start-end-points
|
||||
(ssg-text "gf-prompt-3dlinie-richtung")))
|
||||
(if (null line-points)
|
||||
(progn (alert (ssg-text "gf-alert-keine-linie")) (exit))
|
||||
)
|
||||
(setq startpunkt (car line-points)
|
||||
endpunkt (cadr line-points))
|
||||
(setq differenz (punkt-differenz startpunkt endpunkt))
|
||||
(setq deltaX (car differenz)
|
||||
deltaY (cadr differenz))
|
||||
;; deltaL: horizontale 2D-Projektion entlang Fahrtrichtung
|
||||
(setq deltaL (sqrt (+ (* deltaX deltaX) (* deltaY deltaY))))
|
||||
;; hz-Winkel: Fahrtrichtung aus Linienpunkten (in Grad, 0=Ost)
|
||||
(setq hz-winkel (* (angle '(0.0 0.0) (list deltaX deltaY)) (/ 180.0 pi)))
|
||||
(princ (ssg-textf "gf-status-fahrtrichtung-linie" (list (rtos hz-winkel 2 1) grad-zeichen)))
|
||||
(princ (ssg-textf "gf-status-deltal-mm" (list delta-sym (rtos deltaL 2 2))))
|
||||
;; Startpunkt separat waehlen (unabhaengig von Linie)
|
||||
(setq startpunkt-fuer-einfuegen
|
||||
(getpoint (ssg-text "gf-prompt-startpunkt-aus")))
|
||||
(if (null startpunkt-fuer-einfuegen)
|
||||
(progn (princ (ssg-text "gf-fehler-kein-startpunkt")) (exit))
|
||||
)
|
||||
)
|
||||
(setq startpunkt (car line-points)
|
||||
endpunkt (cadr line-points))
|
||||
(setq differenz (punkt-differenz startpunkt endpunkt))
|
||||
(setq deltaX (car differenz)
|
||||
deltaY (cadr differenz))
|
||||
;; deltaL: horizontale 2D-Projektion entlang Fahrtrichtung
|
||||
(setq deltaL (sqrt (+ (* deltaX deltaX) (* deltaY deltaY))))
|
||||
;; hz-Winkel: Fahrtrichtung aus Linienpunkten (in Grad, 0=Ost)
|
||||
(setq hz-winkel (* (angle '(0.0 0.0) (list deltaX deltaY)) (/ 180.0 pi)))
|
||||
(princ (ssg-textf "gf-status-fahrtrichtung-linie" (list (rtos hz-winkel 2 1) grad-zeichen)))
|
||||
(princ (ssg-textf "gf-status-deltal-mm" (list delta-sym (rtos deltaL 2 2))))
|
||||
;; Startpunkt separat waehlen (unabhaengig von Linie)
|
||||
(setq startpunkt-fuer-einfuegen
|
||||
(getpoint (ssg-text "gf-prompt-startpunkt-aus")))
|
||||
(if (null startpunkt-fuer-einfuegen)
|
||||
(progn (princ (ssg-text "gf-fehler-kein-startpunkt")) (exit))
|
||||
)
|
||||
|
||||
(princ "\n\n=========================================")
|
||||
(princ (ssg-textf "gf-status-deltal-mm" (list delta-sym (rtos deltaL 2 2))))
|
||||
(princ "\n=========================================")
|
||||
|
||||
;; Winkelabfrage (beide Modi: manuell)
|
||||
;; Winkelabfrage
|
||||
(setq winkel (getreal (ssg-text "gf-prompt-gefaellewinkel-def3")))
|
||||
(if (or (null winkel) (<= winkel 0))
|
||||
(setq winkel (ssg-cfg-or "gefaelle" "default_winkel" 3.0)))
|
||||
(setq winkel (float winkel))
|
||||
(setq rad (* winkel (/ pi 180.0)))
|
||||
(princ (ssg-textf "gf-status-winkel" (list (rtos winkel 2 1) grad-zeichen)))
|
||||
|
||||
;; Fahrtrichtung waehlen (nur Modus 1; Modus 2 berechnet hz aus Linie)
|
||||
(if (= eingabe-modus "Manuell")
|
||||
(progn
|
||||
(princ (ssg-text "vfc-fahrtrichtung-header"))
|
||||
(princ (ssg-textf "vfc-fahrtrichtung-0" (list grad-zeichen)))
|
||||
(princ (ssg-textf "vfc-fahrtrichtung-90" (list grad-zeichen)))
|
||||
(princ (ssg-textf "vfc-fahrtrichtung-180" (list grad-zeichen)))
|
||||
(princ (ssg-textf "vfc-fahrtrichtung-270" (list grad-zeichen)))
|
||||
(setq antwort (getstring (ssg-text "prompt-wahl-1-2-3-4")))
|
||||
(cond
|
||||
((= antwort "2") (setq hz-winkel 90.0))
|
||||
((= antwort "3") (setq hz-winkel 180.0))
|
||||
((= antwort "4") (setq hz-winkel 270.0))
|
||||
(t (setq hz-winkel 0.0))
|
||||
)
|
||||
(princ (ssg-textf "gf-status-fahrtrichtung" (list (rtos hz-winkel 2 1) grad-zeichen)))
|
||||
)
|
||||
)
|
||||
|
||||
;; AUS-Element: 30/90 (vor Seite) + Seite, dann Masse fuer Variante setzen
|
||||
;; AUS-Element: 30/90 + Seite
|
||||
(setq gf-as-winkel (vf-frage-element-winkel "vf-winkel-aus-header"))
|
||||
(princ (ssg-text "gf-seite-aus-header"))
|
||||
(princ (ssg-text "gf-seite-links"))
|
||||
(princ (ssg-text "gf-seite-rechts"))
|
||||
(setq antwort (getstring (ssg-text "prompt-wahl-1-2")))
|
||||
(setq as-seite (if (= antwort "2") "rechts" "links"))
|
||||
(vf-set-as-masse gf-as-winkel as-seite)
|
||||
|
||||
;; EIN-Element: 30/90 + Seite
|
||||
(setq gf-es-winkel (vf-frage-element-winkel "vf-winkel-ein-header"))
|
||||
@@ -1752,41 +1947,148 @@
|
||||
(princ (ssg-text "gf-seite-rechts"))
|
||||
(setq antwort (getstring (ssg-text "prompt-wahl-1-2")))
|
||||
(setq es-seite (if (= antwort "2") "rechts" "links"))
|
||||
(vf-set-es-masse gf-es-winkel es-seite)
|
||||
|
||||
;; Laengenberechnung (aus-dx/ein-dx jetzt fuer die gewaehlte Variante)
|
||||
;; deltaL = aus_dx + L_stau*cos(rad) + sep*cos(rad) + ein_dx
|
||||
(setq sep-x (* (ssg-cfg-or "gefaelle" "separator_breite" 300.0) (cos rad)))
|
||||
(setq L_stau (/ (- deltaL aus-dx ein-dx sep-x) (cos rad)))
|
||||
;; Gemeinsamer Abschluss (Masse, Laenge, Zusammenfassung, Einfuegen)
|
||||
(gf-modus12-abschluss deltaL winkel hz-winkel as-seite es-seite
|
||||
startpunkt-fuer-einfuegen gf-as-winkel gf-es-winkel)
|
||||
)
|
||||
|
||||
;; Validierung
|
||||
(if (<= L_stau 0.1)
|
||||
(progn
|
||||
(alert (ssg-textf "gf-alert-staustrecke-ungueltig" (list (rtos L_stau 2 2))))
|
||||
(exit)
|
||||
)
|
||||
)
|
||||
|
||||
;; Zusammenfassung
|
||||
(princ "\n\n=========================================")
|
||||
(princ (ssg-textf "gf-status-fahrtrichtung" (list (rtos hz-winkel 2 1) grad-zeichen)))
|
||||
(princ (ssg-textf "gf-status-zus2-winkel" (list (rtos winkel 2 1) grad-zeichen)))
|
||||
(princ (ssg-textf "gf-status-zus2-aus-seite" (list as-seite)))
|
||||
(princ (ssg-textf "gf-status-zus2-ein-seite" (list es-seite)))
|
||||
(princ (ssg-textf "gf-status-zus2-lstau" (list (rtos L_stau 2 2))))
|
||||
(princ "\n=========================================")
|
||||
|
||||
;; Bestaetigung
|
||||
(setq antwort (getstring (ssg-text "gf-prompt-einfuegen")))
|
||||
(if (not (= antwort "2"))
|
||||
(gefaellestrecke-einfuegen L_stau (fix winkel) startpunkt-fuer-einfuegen as-seite es-seite hz-winkel deltaL gf-as-winkel gf-es-winkel)
|
||||
;; Modus 1: Manuelle Eingabe via DCL-Dialog
|
||||
(t
|
||||
(princ (ssg-text "gf-modus1-header"))
|
||||
;; Startpunkt (X/Y) in der Zeichnung waehlen; Z kommt aus dem Dialog
|
||||
(setq startpunkt-fuer-einfuegen
|
||||
(getpoint (ssg-text "gf-prompt-startpunkt-aus")))
|
||||
(if (null startpunkt-fuer-einfuegen)
|
||||
(setq startpunkt-fuer-einfuegen '(0 0 0)))
|
||||
(setq dlg-werte (gf-dialog-eingabe nil))
|
||||
(if (null dlg-werte)
|
||||
(princ (ssg-text "gf-status-abgebrochen"))
|
||||
(progn
|
||||
(setq deltaL (nth 0 dlg-werte)
|
||||
winkel (nth 1 dlg-werte)
|
||||
hz-winkel (nth 2 dlg-werte)
|
||||
as-seite (nth 3 dlg-werte)
|
||||
es-seite (nth 4 dlg-werte)
|
||||
gf-as-winkel (nth 6 dlg-werte)
|
||||
gf-es-winkel (nth 7 dlg-werte))
|
||||
;; Einfuegehoehe (Z) aus Dialog auf gewaehlten Startpunkt anwenden
|
||||
(setq startpunkt-fuer-einfuegen
|
||||
(list (car startpunkt-fuer-einfuegen)
|
||||
(cadr startpunkt-fuer-einfuegen)
|
||||
(nth 5 dlg-werte)))
|
||||
(if (or (null deltaL) (<= deltaL 0))
|
||||
(setq deltaL (ssg-cfg-or "gefaelle" "default_delta_l" 5000.0)))
|
||||
(if (or (null winkel) (<= winkel 0))
|
||||
(setq winkel (ssg-cfg-or "gefaelle" "default_winkel" 3.0)))
|
||||
(gf-modus12-abschluss deltaL winkel hz-winkel as-seite es-seite
|
||||
startpunkt-fuer-einfuegen gf-as-winkel gf-es-winkel)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
nil
|
||||
)
|
||||
|
||||
;; ============================================================
|
||||
;; TEIL 7: GEFAELLESTRECKE_EDIT - Doppelklick/Kontextmenue-Bearbeitung
|
||||
;; ============================================================
|
||||
|
||||
;; Bearbeitet eine bestehende Gefaellestrecke (GF_n-Block) ueber den
|
||||
;; DCL-Dialog: liest die aktuellen Parameter (XDATA, sonst Attribute),
|
||||
;; zeigt sie vorbelegt im Dialog und baut die Strecke bei OK am selben
|
||||
;; Startpunkt neu auf. Wird vom Doppelklick-Dispatcher SSG_BLOCKEDIT
|
||||
;; fuer Blocknamen "GF_*" aufgerufen.
|
||||
(defun c:GEFAELLESTRECKE_EDIT ( / ss ent ed bname startpunkt attribs xd
|
||||
hz winkel as-winkel es-winkel z-start deltaL
|
||||
prefill dlg-werte)
|
||||
;; Implied Selection VOR ssg-start pruefen (ssg-start hebt Selektion auf)
|
||||
(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 "GEFAELLESTRECKE_EDIT" '(("OSMODE") ("ATTREQ") ("ATTDIA")))
|
||||
(setvar "OSMODE" 0)
|
||||
|
||||
;; Block auswaehlen (falls nicht vorselektiert)
|
||||
(if (null ent)
|
||||
(progn
|
||||
(setq ss (ssget ":S" '((0 . "INSERT"))))
|
||||
(if ss (setq ent (ssname ss 0)))
|
||||
)
|
||||
)
|
||||
(if (null ent) (progn (ssg-end) (exit)))
|
||||
|
||||
(setq ed (entget ent))
|
||||
(setq bname (cdr (assoc 2 ed)))
|
||||
(if (not (wcmatch bname "GF_*"))
|
||||
(progn (alert (ssg-textf "gf-edit-kein-gf" (list bname))) (ssg-end) (exit)))
|
||||
|
||||
(setq startpunkt (cdr (assoc 10 ed)))
|
||||
(setq attribs (ssg-attrib-read ent))
|
||||
|
||||
;; Nur einfache Gefaellestrecken (TYP "Gefaellestrecke") lassen sich ueber den
|
||||
;; Dialog verlustfrei nachbauen. Streckengruppen (mit Bogen / Linienzug / VF)
|
||||
;; wuerden beim Neuaufbau ihre Bogengeometrie verlieren -> abbrechen.
|
||||
(if (/= (cond ((cdr (assoc "TYP" attribs))) ("")) "Gefaellestrecke")
|
||||
(progn
|
||||
(alert (ssg-textf "gf-edit-nur-einfach"
|
||||
(list (cond ((cdr (assoc "TYP" attribs))) ("?")))))
|
||||
(ssg-end)
|
||||
(exit)
|
||||
)
|
||||
)
|
||||
|
||||
;; Parameter bestimmen: bevorzugt aus XDATA (verlustfrei), sonst aus Attributen.
|
||||
;; Aus Attributen sind Fahrtrichtung (hz) und Element-Winkel nicht ableitbar
|
||||
;; -> Default 0 Grad / 90 Grad; der Nutzer kann sie im Dialog korrigieren.
|
||||
(setq xd (gf-xdata-lesen ent))
|
||||
(if xd
|
||||
(setq hz (atof (nth 0 xd))
|
||||
winkel (atof (nth 1 xd))
|
||||
as-winkel (nth 2 xd)
|
||||
es-winkel (nth 3 xd)
|
||||
z-start (atof (nth 4 xd))
|
||||
deltaL (atof (nth 5 xd)))
|
||||
(setq hz 0.0
|
||||
winkel (atof (cond ((cdr (assoc "GF_WINKEL" attribs))) ("3.0")))
|
||||
as-winkel "90"
|
||||
es-winkel "90"
|
||||
z-start (atof (cond ((cdr (assoc "HOEHE_VON_mm" attribs))) ("0")))
|
||||
deltaL (atof (cond ((cdr (assoc "DELTA_L_mm" attribs))) ("0"))))
|
||||
)
|
||||
|
||||
(setq prefill
|
||||
(list (cons "deltaL" deltaL)
|
||||
(cons "winkel" winkel)
|
||||
(cons "hz" hz)
|
||||
(cons "as-seite" (cond ((cdr (assoc "SEITE_AS" attribs))) ("links")))
|
||||
(cons "es-seite" (cond ((cdr (assoc "SEITE_ES" attribs))) ("links")))
|
||||
(cons "einfuegehoehe" z-start)
|
||||
(cons "as-winkel" as-winkel)
|
||||
(cons "es-winkel" es-winkel)))
|
||||
|
||||
(setq dlg-werte (gf-dialog-eingabe prefill))
|
||||
(if (null dlg-werte)
|
||||
(princ (ssg-text "gf-status-abgebrochen"))
|
||||
(progn
|
||||
;; Alten GF-Verbund loeschen und am selben Startpunkt (X/Y) mit der
|
||||
;; im Dialog gewaehlten Einfuegehoehe (Z) neu aufbauen.
|
||||
(entdel ent)
|
||||
(gf-rebuild
|
||||
(nth 0 dlg-werte) (nth 1 dlg-werte) (nth 2 dlg-werte)
|
||||
(nth 3 dlg-werte) (nth 4 dlg-werte)
|
||||
(list (car startpunkt) (cadr startpunkt) (nth 5 dlg-werte))
|
||||
(nth 6 dlg-werte) (nth 7 dlg-werte))
|
||||
(princ (ssg-textf "gf-edit-neu-aufgebaut" (list bname)))
|
||||
)
|
||||
)
|
||||
(ssg-end)
|
||||
(princ)
|
||||
)
|
||||
|
||||
;; ============================================================
|
||||
;; START
|
||||
;; ============================================================
|
||||
|
||||
Reference in New Issue
Block a user