diff --git a/Lisp/Gefaellestrecke.lsp b/Lisp/Gefaellestrecke.lsp index 3700801..c19ceb3 100644 --- a/Lisp/Gefaellestrecke.lsp +++ b/Lisp/Gefaellestrecke.lsp @@ -98,7 +98,7 @@ (setq startpunkt-fuer-einfuegen (getpoint "\nStartpunkt fuer AUS_Element waehlen: ")) (if (null startpunkt-fuer-einfuegen) (setq startpunkt-fuer-einfuegen '(0 0 0))) (setq deltaL (getreal "\nAbstand ΔL (mm): ")) - (if (or (null deltaL) (<= deltaL 0)) (setq deltaL 5000.0)) + (if (or (null deltaL) (<= deltaL 0)) (setq deltaL (ssg-cfg-or "gefaelle" "default_delta_l" 5000.0))) ) ;; --- Modus 2: 3D-Linie --- (progn @@ -134,7 +134,7 @@ ;; --- Winkelabfrage --- (setq winkel (getreal "\n\nGefaellewinkel (°) [3]: ")) - (if (or (null winkel) (<= winkel 0)) (setq winkel 3.0)) + (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 (strcat "\n>>> Gewaehlter Winkel: " (rtos winkel 2 1) grad-zeichen)) @@ -153,7 +153,7 @@ ;; --- Laengenberechnung --- ;; Horizontalbilanz: deltaL = aus_dx + L_stau*cos(rad) + 300*cos(rad) + ein_dx ;; L_stau (Weglaenge) = (deltaL - aus_dx - ein_dx - 300*cos(rad)) / cos(rad) - (setq sep-x (* 300.0 (cos rad))) + (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 --- diff --git a/Lisp/KreiselInsert.lsp b/Lisp/KreiselInsert.lsp index ab57c29..f8fc29b 100644 --- a/Lisp/KreiselInsert.lsp +++ b/Lisp/KreiselInsert.lsp @@ -30,11 +30,11 @@ (setq *block-path* block-pfad) (princ (strcat "\nBlock-Pfad aktiv: " block-pfad)) -;; Kreisel-Geometrie-Konstanten -(setq *kreisel-durchmesser* 800.0) ;; Kreisdurchmesser AN8/SP8 -(setq *kreisel-pin-abstand* 100.0) ;; Einrueckung PIN-Linie vom Kreisrand -(setq *kreisel-default-laenge* 2300.0) ;; Standard-Tangentenlaenge -(setq *kreisel-default-hoehe* 2000.0) ;; Standard-Höhe (Z-Koordinate) +;; Kreisel-Geometrie-Konstanten (aus Config oder Fallback) +(setq *kreisel-durchmesser* (ssg-cfg-or "kreisel" "durchmesser" 800.0)) +(setq *kreisel-pin-abstand* (ssg-cfg-or "kreisel" "pin_abstand" 100.0)) +(setq *kreisel-default-laenge* (ssg-cfg-or "kreisel" "default_laenge" 2300.0)) +(setq *kreisel-default-hoehe* (ssg-cfg-or "kreisel" "default_hoehe" 2000.0)) ;; Attribut-Definitionen: ((TAG DEFAULT) ...) (setq *kreisel-attrib-defs* @@ -51,7 +51,7 @@ ) ;; Eckrad-Einstellungen -(setq *eckrad-default-hoehe* 2000.0) ;; Standard-Höhe (Z-Koordinate) +(setq *eckrad-default-hoehe* (ssg-cfg-or "eckrad" "default_hoehe" 2000.0)) ;; Eckrad Attribut-Definitionen: ((TAG DEFAULT) ...) (setq *eckrad-attrib-defs* @@ -67,9 +67,9 @@ ;; Beschriftungs-Einstellungen (NUR EINMAL definieren!) (setq *kreisel-beschriftung-layer* "S_KRS_BESCHR") -(setq *kreisel-beschriftung-hoehe* 100.0) ;; Texthöhe in mm -(setq *kreisel-beschriftung-farbe* 7) ;; 7 = weiß -(setq *kreisel-beschriftung-abstand-oben* 0.0) ;; Abstand über Kreisel-Mitte +(setq *kreisel-beschriftung-hoehe* (ssg-cfg-or "kreisel" "label_hoehe" 100.0)) +(setq *kreisel-beschriftung-farbe* (ssg-cfg-or "kreisel" "label_farbe" 7)) +(setq *kreisel-beschriftung-abstand-oben* (ssg-cfg-or "kreisel" "label_abstand_oben" 0.0)) (setq *kreisel-beschriftung-schriftart* "Arial") ;; Schriftart @@ -230,7 +230,7 @@ (setq cross (abs (- (* (car d1) (cadr d2)) (* (cadr d1) (car d2)))) len1 (sqrt (+ (* (car d1) (car d1)) (* (cadr d1) (cadr d1)))) len2 (sqrt (+ (* (car d2) (car d2)) (* (cadr d2) (cadr d2))))) - (< (/ cross (* len1 len2)) 0.01) + (< (/ cross (* len1 len2)) (ssg-cfg-or "kreisel" "toleranz_kollinear" 0.01)) ) @@ -373,8 +373,8 @@ ;; Tangenten auf Layer S_LP (ssg-make-layer "S_LP" "7" T) (if is-pin - (setvar "CECOLOR" "5") - (setvar "CECOLOR" "1") + (setvar "CECOLOR" (itoa (ssg-cfg-or "kreisel" "color_linie_1" 5))) + (setvar "CECOLOR" (itoa (ssg-cfg-or "kreisel" "color_linie_2" 1))) ) ;; Obere Tangente @@ -385,8 +385,8 @@ ;; PIN-Linien (if is-pin (progn - (ssg-make-layer "pinbereich" "3" T) - (setvar "CECOLOR" "3") + (ssg-make-layer "pinbereich" (itoa (ssg-cfg-or "kreisel" "color_pin" 3)) T) + (setvar "CECOLOR" (itoa (ssg-cfg-or "kreisel" "color_pin" 3))) ;; Obere PIN-Linie (command "_.LINE" (list *kreisel-durchmesser* pin-y 0) (list (float abstand) pin-y 0) "") @@ -745,7 +745,7 @@ (foreach entry *kreisel-ausrichtungen* (setq diff (abs (- (rem (+ rot 360.0) 360.0) (rem (+ (cadr entry) 360.0) 360.0)))) - (if (< diff 1.0) (setq idx i)) + (if (< diff (ssg-cfg-or "kreisel" "toleranz_winkel" 1.0)) (setq idx i)) (setq i (1+ i)) ) idx @@ -966,7 +966,7 @@ dy (- (cadr ptDir) (cadr ptTangent))) (setq dist (sqrt (+ (* dx dx) (* dy dy)))) - (if (<= dist 0.001) + (if (<= dist (ssg-cfg-or "kreisel" "toleranz_min_distanz" 0.001)) (progn (princ "\nFehler: Beruehr- und Richtungspunkt sind identisch!") (dbgreturn nil) diff --git a/Lisp/OmniModulInsert.lsp b/Lisp/OmniModulInsert.lsp index 0873960..32cc5ba 100644 --- a/Lisp/OmniModulInsert.lsp +++ b/Lisp/OmniModulInsert.lsp @@ -450,8 +450,8 @@ (if (null *OMNI-BOEGEN*) (omni:load-data)) ;; Defaults - (if (null init-hoehe) (setq init-hoehe "2000")) - (if (null init-drehung) (setq init-drehung "0")) + (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)) @@ -591,8 +591,8 @@ srcAttribs attribDefs attribs ok) - (setq textHeight 100.0) - (setq textGap 20.0) + (setq textHeight (ssg-cfg-or "omniflo" "text_height" 100.0)) + (setq textGap (ssg-cfg-or "omniflo" "text_gap" 20.0)) ;; 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"))) @@ -728,15 +728,15 @@ ) (defun c:OMNI_AP60 () - (omni:insert-block "AP60" 7000.0) + (omni:insert-block "AP60" (ssg-cfg-or "omniflo" "laengemax_ap60" 7000.0)) (princ) ) (defun c:OMNI_AP110 () - (omni:insert-block "AP110" 6000.0) + (omni:insert-block "AP110" (ssg-cfg-or "omniflo" "laengemax_ap110" 6000.0)) (princ) ) (defun c:OMNI_APG110 () - (omni:insert-block "APG110" 6000.0) + (omni:insert-block "APG110" (ssg-cfg-or "omniflo" "laengemax_apg110" 6000.0)) (princ) ) @@ -844,8 +844,8 @@ (if (null *OMNI-WEICHEN*) (omni:load-data)) ;; Defaults - (if (null init-hoehe) (setq init-hoehe "2000")) - (if (null init-drehung) (setq init-drehung "0")) + (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 @@ -981,13 +981,13 @@ ;; 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")))) + (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"))))) ) (princ (strcat "\n[OMNI] " sivasnr-str " eingefuegt." - " Hoehe=" (if hoehe hoehe "2000") - " Drehung=" (if drehung drehung "0"))) + " Hoehe=" (if hoehe hoehe (ssg-cfg-or "omniflo" "default_hoehe" "2000")) + " Drehung=" (if drehung drehung (ssg-cfg-or "omniflo" "default_drehung" "0")))) (ssg-end) pt ) @@ -1199,7 +1199,7 @@ (setq drehung (cdr (assoc "DREHUNG" attribs))) ;; Fallbacks - (if (null hoehe) (setq hoehe "2000")) + (if (null hoehe) (setq hoehe (ssg-cfg-or "omniflo" "default_hoehe" "2000"))) (if (null drehung) (setq drehung (rtos rotation 2 1))) ;; 3. Typ bestimmen: Bogen oder Weiche @@ -1294,13 +1294,13 @@ ;; 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")))) + (list (cons "HOEHE" (if new-hoehe new-hoehe (ssg-cfg-or "omniflo" "default_hoehe" "2000"))) + (cons "DREHUNG" (if new-drehung new-drehung (ssg-cfg-or "omniflo" "default_drehung" "0"))))) ) (princ (strcat "\n[OMNI] Element aktualisiert: " sivasnr-str - " Hoehe=" (if new-hoehe new-hoehe "2000") - " Drehung=" (if new-drehung new-drehung "0"))) + " Hoehe=" (if new-hoehe new-hoehe (ssg-cfg-or "omniflo" "default_hoehe" "2000")) + " Drehung=" (if new-drehung new-drehung (ssg-cfg-or "omniflo" "default_drehung" "0")))) (ssg-end) (princ) diff --git a/Lisp/VarioFoerderer.lsp b/Lisp/VarioFoerderer.lsp index 1ce8b1d..0432bb6 100644 --- a/Lisp/VarioFoerderer.lsp +++ b/Lisp/VarioFoerderer.lsp @@ -35,8 +35,8 @@ (setq aus-dx nil aus-dy nil aus-dz nil) (setq ein-dx nil ein-dy nil ein-dz nil) (setq separator-laenge nil umlenk-laenge nil motorstation-laenge nil) -(setq staustrecke-basis 1000) -(setq FESTE_HORIZONTAL 1600) +(setq staustrecke-basis (ssg-cfg-or "vario" "staustrecke_basis" 1000)) +(setq FESTE_HORIZONTAL (ssg-cfg-or "vario" "feste_horizontal" 1600)) ;; Bogen-Tabellen (werden aus Bibliothek befüllt) (setq bogen-auf '()) ;; Format: ((winkel dx dy dz) ...) @@ -400,7 +400,7 @@ (princ "\n Extrahiere Bogen-Masse...") (setq bogen-auf '()) (setq bogen-ab '()) - (setq bogen-winkel '(3 6 9 12 15 18 21 27 33 39 45 51)) + (setq bogen-winkel (ssg-cfg-or "vario" "bogen_winkel" '(3 6 9 12 15 18 21 27 33 39 45 51))) (foreach w bogen-winkel ;; Aufwaertsbogen @@ -547,7 +547,7 @@ (ensure-block-loaded blockname) (princ (strcat "\n Fuege '" blockname "' ein (Laenge=" (rtos laenge 2 2) " mm, Winkel=" (itoa winkel) "°)")) - (setq scale (/ laenge 1000.0)) + (setq scale (/ laenge (ssg-cfg-or "vario" "skalierung_basis" 1000.0))) (setq rad (* winkel (/ pi 180.0))) ;; Block am Ursprung einfuegen, damit TransformBy um (0,0,0) rotiert (= Block-Einfuegepunkt) @@ -647,10 +647,11 @@ (setq abs-dz-AUS (abs aus-dz) abs-dz-EIN (abs ein-dz)) ;; ALLE in der Bibliothek verfügbaren Winkel - (setq winkel-list '(3 6 9 12 15 18 21 27 33 39 45 51)) + (setq winkel-list (ssg-cfg-or "vario" "bogen_winkel" '(3 6 9 12 15 18 21 27 33 39 45 51))) (setq ergebnis-liste '()) - (setq cos3 (cos (* 3 (/ pi 180.0))) sin3 (sin (* 3 (/ pi 180.0)))) + (setq cos3 (cos (* (ssg-cfg-or "vario" "gefaelle_winkel" 3) (/ pi 180.0))) + sin3 (sin (* (ssg-cfg-or "vario" "gefaelle_winkel" 3) (/ pi 180.0)))) (princ "\n\n=========================================\n BERECHNUNG FÜR ALLE WINKEL\n=========================================") (princ (strcat "\nΔL = " (rtos deltaL 2 2) " mm\nΔH = " (rtos deltaH 2 2) " mm\nRichtung: " richtung)) @@ -773,18 +774,23 @@ (if (> L_GF1 0.1) (progn (princ (strcat "\n\n2/11: Gefaellestrecke (3°, Laenge=" (rtos L_GF1 2 2) " mm)")) - (setq aktueller-punkt (insert-inclined-scaled-block "Staustrecke_SP_1000_mm" aktueller-punkt L_GF1 3)) + (setq aktueller-punkt (insert-inclined-scaled-block "Staustrecke_SP_1000_mm" aktueller-punkt L_GF1 (ssg-cfg-or "vario" "gefaelle_winkel" 3))) ) (princ "\n\n2/11: (uebersprungen)") ) ;; 3. Separator (princ "\n\n3/11: Separator (300mm, 3° geneigt)") - (setq aktueller-punkt (insert-rotated-block-with-ks "Staustrecke_Separator_SP_300_mm" aktueller-punkt 3 300 0)) + (setq aktueller-punkt (insert-rotated-block-with-ks "Staustrecke_Separator_SP_300_mm" aktueller-punkt + (ssg-cfg-or "vario" "gefaelle_winkel" 3) + (ssg-cfg-or "vario" "separator_block_dx" 300) + (ssg-cfg-or "vario" "separator_block_dz" 0))) ;; 4. Umlenkstation – Block bereits 3° vorgeneigt, keine zusaetzliche Rotation (princ "\n\n4/11: Umlenkstation (500mm, 3° geneigt)") - (setq aktueller-punkt (insert-rotated-block-with-ks "Vario_Umlenkstation_500mm" aktueller-punkt 0 499 -26)) + (setq aktueller-punkt (insert-rotated-block-with-ks "Vario_Umlenkstation_500mm" aktueller-punkt 0 + (ssg-cfg-or "vario" "station_block_dx" 499) + (ssg-cfg-or "vario" "station_block_dz" -26))) ;; 5. 1. Vertikalbogen (if (= richtung "Auf") @@ -799,7 +805,7 @@ ) (setq bogen-dx (car bogen-mass) bogen-dz (caddr bogen-mass)) (princ (strcat "\n\n5/11: " bogen-name " (3° geneigt)")) - (setq aktueller-punkt (insert-rotated-block-with-ks bogen-name aktueller-punkt 3 bogen-dx bogen-dz)) + (setq aktueller-punkt (insert-rotated-block-with-ks bogen-name aktueller-punkt (ssg-cfg-or "vario" "gefaelle_winkel" 3) bogen-dx bogen-dz)) ;; 6. Variable Strecke L_VF (if (> L_VF 0.1) @@ -835,20 +841,25 @@ ;; 8. Motorstation – gleiche Behandlung wie Umlenkstation (princ "\n\n8/11: Motorstation (500mm, 3° geneigt)") - (setq aktueller-punkt (insert-rotated-block-with-ks "Vario_Motorstation_500mm" aktueller-punkt 0 499 -26)) + (setq aktueller-punkt (insert-rotated-block-with-ks "Vario_Motorstation_500mm" aktueller-punkt 0 + (ssg-cfg-or "vario" "station_block_dx" 499) + (ssg-cfg-or "vario" "station_block_dz" -26))) ;; 9. 2. Gefällestrecke (if (> L_GF2 0.1) (progn (princ (strcat "\n\n9/11: Gefaellestrecke (3°, Laenge=" (rtos L_GF2 2 2) " mm)")) - (setq aktueller-punkt (insert-inclined-scaled-block "Staustrecke_SP_1000_mm" aktueller-punkt L_GF2 3)) + (setq aktueller-punkt (insert-inclined-scaled-block "Staustrecke_SP_1000_mm" aktueller-punkt L_GF2 (ssg-cfg-or "vario" "gefaelle_winkel" 3))) ) (princ "\n\n9/11: (uebersprungen)") ) ;; 10. Separator 2 (princ "\n\n10/11: Separator (300mm, 3° geneigt)") - (setq aktueller-punkt (insert-rotated-block-with-ks "Staustrecke_Separator_SP_300_mm" aktueller-punkt 3 300 0)) + (setq aktueller-punkt (insert-rotated-block-with-ks "Staustrecke_Separator_SP_300_mm" aktueller-punkt + (ssg-cfg-or "vario" "gefaelle_winkel" 3) + (ssg-cfg-or "vario" "separator_block_dx" 300) + (ssg-cfg-or "vario" "separator_block_dz" 0))) ;; 11. EIN_Element (princ (strcat "\n\n11/11: " es-block " (0°)")) diff --git a/Lisp/export.lsp b/Lisp/export.lsp index d7df26d..c5bc849 100644 --- a/Lisp/export.lsp +++ b/Lisp/export.lsp @@ -282,7 +282,7 @@ (setq winkel (or (csv:get-attrib ename "WINKEL") "0")) (setq radius (or (csv:get-attrib ename "RADIUS") "0")) (setq sivasnr (or (csv:get-attrib ename "ARTINR") "")) - (setq hoehe (or (csv:get-attrib ename "HOEHE") "2000")) + (setq hoehe (or (csv:get-attrib ename "HOEHE") (ssg-cfg-or "omniflo" "default_hoehe" "2000"))) (setq drehung (or (csv:get-attrib ename "DREHUNG") (rtos rotation 2 1))) (strcat "{\"Kurvenwinkel\":" winkel ",\"Radius\":" radius @@ -298,7 +298,7 @@ (setq winkel (or (csv:get-attrib ename "WINKEL") "0")) (setq sivasnr (or (csv:get-attrib ename "ARTINR") "")) (setq tef-str (csv:get-attrib ename "SIVASNR_TEF")) - (setq hoehe (or (csv:get-attrib ename "HOEHE") "2000")) + (setq hoehe (or (csv:get-attrib ename "HOEHE") (ssg-cfg-or "omniflo" "default_hoehe" "2000"))) (setq drehung (or (csv:get-attrib ename "DREHUNG") (rtos rotation 2 1))) (strcat "{\"Weichentyp\":\"" (csv:json-escape wtyp) "\"" ",\"Richtung\":\"False\"" @@ -314,11 +314,11 @@ (defun csv:omni-gerade-merkmale (ename rotation / laenge hoehe drehung) (setq laenge (csv:get-attrib ename "LAENGE")) (if (null laenge) (setq laenge (csv:get-attrib ename "A"))) - (if (null laenge) (setq laenge "2000")) - (setq hoehe (or (csv:get-attrib ename "HOEHE") "2000")) + (if (null laenge) (setq laenge (ssg-cfg-or "omniflo" "default_gerade_laenge" "2000"))) + (setq hoehe (or (csv:get-attrib ename "HOEHE") (ssg-cfg-or "omniflo" "default_hoehe" "2000"))) (setq drehung (or (csv:get-attrib ename "DREHUNG") (rtos rotation 2 1))) (strcat "{\"Anzahl der Separatoren\":\"0\"" - ",\"L\\u00e4nge in Meter\":\"" (csv:json-escape (rtos (/ (atof laenge) 1000.0) 2 2)) "\"" + ",\"L\\u00e4nge in Meter\":\"" (csv:json-escape (rtos (/ (atof laenge) (ssg-cfg-or "infrastruktur" "mm_pro_meter" 1000.0)) 2 2)) "\"" ",\"Winkel\":\"0\"" ",\"Anzahl der Scanner\":0" ",\"H\\u00f6he oben\":\"" (csv:json-escape hoehe) "\"" @@ -426,7 +426,7 @@ (if (null laenge-str) (setq laenge-str (csv:get-attrib ename "A"))) (if (and laenge-str (> (strlen laenge-str) 0)) (setq len-ap110 (+ len-ap110 (atof laenge-str))) - (setq len-ap110 (+ len-ap110 2000.0)) + (setq len-ap110 (+ len-ap110 (float (atoi (ssg-cfg-or "omniflo" "default_gerade_laenge" "2000"))))) ) (setq merkmale (csv:omni-gerade-merkmale ename rotation)) (setq lines (cons diff --git a/Lisp/ssg_dialog.lsp b/Lisp/ssg_dialog.lsp index f85426c..c5d172c 100644 --- a/Lisp/ssg_dialog.lsp +++ b/Lisp/ssg_dialog.lsp @@ -23,7 +23,7 @@ hoehe (dimy_tile tile-name) ) (start_image tile-name) - (fill_image 0 0 breite hoehe -18) + (fill_image 0 0 breite hoehe (ssg-cfg-or "infrastruktur" "dialog_preview_bg_color" -18)) (slide_image 0 0 breite hoehe (strcat slide-lib "(" slide-name ")")) (end_image) )