Die Module für Gefaellestrecke wurde gebaut.
This commit is contained in:
@@ -0,0 +1,196 @@
|
||||
;; ============================================================
|
||||
;; Gefaellestrecke.lsp - Gefaelle-Foerderanlage Generator
|
||||
;;
|
||||
;; Erzeugt eine einfache Foerderanlage mit festem Gefaellewinkel:
|
||||
;; AUS-Element → Staustrecke_SP_1000_mm (skaliert) →
|
||||
;; Staustrecke_Separator_SP_300_mm → EIN-Element
|
||||
;;
|
||||
;; Abhaengigkeiten (aus VarioFoerderer.lsp, muss vorher geladen sein):
|
||||
;; block-pfad, aus-dx, ein-dx, *lib-initialized*, grad-zeichen
|
||||
;; init-bibliothek, ensure-block-loaded
|
||||
;; insert-block-by-ks, insert-inclined-scaled-block
|
||||
;; insert-rotated-block-with-ks, get-line-start-end-points
|
||||
;; punkt-differenz
|
||||
;;
|
||||
;; Befehl: GEFAELLESTRECKE
|
||||
;; ============================================================
|
||||
|
||||
;; ============================================================
|
||||
;; TEIL 1: EINFUEGE-FUNKTION
|
||||
;; ============================================================
|
||||
|
||||
(defun gefaellestrecke-einfuegen (L_stau winkel startpunkt seite /
|
||||
aktueller-punkt as-block es-block tilt-winkel endpunkt)
|
||||
|
||||
(setq aktueller-punkt startpunkt)
|
||||
(setq as-block (strcat "_3D_AS_90_" seite))
|
||||
(setq es-block (strcat "_3D_ES_90_" seite))
|
||||
;; Richtung immer Ab (abwaerts) – positiver Winkel = Gefaelle nach unten
|
||||
(setq tilt-winkel winkel)
|
||||
|
||||
(if (not *lib-initialized*) (init-bibliothek))
|
||||
|
||||
;; 1/4 AUS-Element
|
||||
(princ (strcat "\n\n1/4: " as-block " (0°)"))
|
||||
(setq aktueller-punkt (insert-block-by-ks as-block aktueller-punkt))
|
||||
|
||||
;; 2/4 Staustrecke_SP_1000_mm (skaliert)
|
||||
(princ (strcat "\n\n2/4: Staustrecke_SP_1000_mm ("
|
||||
(itoa winkel) grad-zeichen
|
||||
", Laenge=" (rtos L_stau 2 2) " mm)"))
|
||||
(setq aktueller-punkt
|
||||
(insert-inclined-scaled-block "Staustrecke_SP_1000_mm" aktueller-punkt L_stau tilt-winkel))
|
||||
|
||||
;; 3/4 Staustrecke_Separator_SP_300_mm
|
||||
(princ (strcat "\n\n3/4: Staustrecke_Separator_SP_300_mm ("
|
||||
(itoa winkel) grad-zeichen ")"))
|
||||
(setq aktueller-punkt
|
||||
(insert-rotated-block-with-ks "Staustrecke_Separator_SP_300_mm"
|
||||
aktueller-punkt tilt-winkel 300 0))
|
||||
|
||||
;; 4/4 EIN-Element
|
||||
(princ (strcat "\n\n4/4: " es-block " (0°)"))
|
||||
(setq endpunkt (insert-block-by-ks es-block aktueller-punkt))
|
||||
|
||||
(princ "\n\n=========================================")
|
||||
(princ "\n>>> Gefaellestrecke erfolgreich eingefuegt! <<<")
|
||||
(princ "\n=========================================")
|
||||
|
||||
endpunkt
|
||||
)
|
||||
|
||||
;; ============================================================
|
||||
;; TEIL 2: HAUPTFUNKTION
|
||||
;; ============================================================
|
||||
|
||||
(defun c:GEFAELLESTRECKE ( / deltaL winkel rad L_stau sep-x antwort seite
|
||||
eingabe-modus line-points startpunkt endpunkt
|
||||
differenz deltaX deltaY
|
||||
startpunkt-fuer-einfuegen)
|
||||
|
||||
(princ "\n=========================================")
|
||||
(princ "\n GEFAELLESTRECKE GENERATOR v1.0")
|
||||
(princ "\n Richtung: immer AB (nach unten)")
|
||||
(princ "\n=========================================")
|
||||
|
||||
;; Bibliothek initialisieren (aus VarioFoerderer.lsp)
|
||||
(if (not (init-bibliothek))
|
||||
(progn
|
||||
(alert "Fehler beim Initialisieren der Bibliothek!\nBitte Pfade pruefen.")
|
||||
(exit)
|
||||
)
|
||||
)
|
||||
|
||||
;; --- Eingabemodus ---
|
||||
(princ "\n\nEingabemodus waehlen:")
|
||||
(princ "\n 1 - Werte manuell eingeben")
|
||||
(princ "\n 2 - 3D-Linie auswaehlen (Start- und Endpunkt mit Hoehe)")
|
||||
(setq antwort (getstring "\nIhre Wahl (1/2) [1]: "))
|
||||
(if (= antwort "2")
|
||||
(setq eingabe-modus "Linie")
|
||||
(setq eingabe-modus "Manuell")
|
||||
)
|
||||
|
||||
;; --- Modus 1: Manuelle Eingabe ---
|
||||
(if (= eingabe-modus "Manuell")
|
||||
(progn
|
||||
(princ "\n\n>>> MODUS: Manuelle Werteingabe <<<")
|
||||
(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))
|
||||
)
|
||||
;; --- Modus 2: 3D-Linie ---
|
||||
(progn
|
||||
(princ "\n\n>>> MODUS: 3D-Linie auswaehlen <<<")
|
||||
(command "BKS" "W")
|
||||
(princ "\n ✓ BKS auf Weltkoordinaten gesetzt")
|
||||
|
||||
(setq line-points
|
||||
(get-line-start-end-points
|
||||
"\nBitte 3D-Linie fuer die Gefaellestrecke auswaehlen:"))
|
||||
(if (null line-points)
|
||||
(progn (alert "Keine gueltige Linie ausgewaehlt!") (exit))
|
||||
)
|
||||
|
||||
(setq startpunkt (car line-points))
|
||||
(setq endpunkt (cadr line-points))
|
||||
|
||||
(setq differenz (punkt-differenz startpunkt endpunkt))
|
||||
(setq deltaX (abs (car differenz)))
|
||||
(setq deltaY (abs (cadr differenz)))
|
||||
(setq deltaL (max deltaX deltaY))
|
||||
|
||||
(princ (strcat "\n → ΔX=" (rtos deltaX 2 2) " mm, ΔY=" (rtos deltaY 2 2) " mm"))
|
||||
(princ (strcat "\n → ΔL = " (rtos deltaL 2 2) " mm"))
|
||||
|
||||
(setq startpunkt-fuer-einfuegen startpunkt)
|
||||
)
|
||||
)
|
||||
|
||||
(princ "\n\n=========================================")
|
||||
(princ (strcat "\n ΔL = " (rtos deltaL 2 2) " mm"))
|
||||
(princ "\n=========================================")
|
||||
|
||||
;; --- Winkelabfrage ---
|
||||
(setq winkel (getreal "\n\nGefaellewinkel (°) [3]: "))
|
||||
(if (or (null winkel) (<= winkel 0)) (setq winkel 3.0))
|
||||
(setq winkel (float winkel))
|
||||
(setq rad (* winkel (/ pi 180.0)))
|
||||
(princ (strcat "\n>>> Gewaehlter Winkel: " (rtos winkel 2 1) grad-zeichen))
|
||||
|
||||
;; --- Seite abfragen ---
|
||||
(princ "\n\nEin-/Auselement - Seite waehlen:")
|
||||
(princ "\n 1 - Links (_3D_AS_90_links / _3D_ES_90_links)")
|
||||
(princ "\n 2 - Rechts (_3D_AS_90_rechts / _3D_ES_90_rechts)")
|
||||
(setq antwort (getstring "\nIhre Wahl (1/2) [1]: "))
|
||||
(if (= antwort "2")
|
||||
(setq seite "rechts")
|
||||
(setq seite "links")
|
||||
)
|
||||
(princ (strcat "\n>>> Seite: " seite))
|
||||
|
||||
;; --- 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 L_stau (/ (- deltaL aus-dx ein-dx sep-x) (cos rad)))
|
||||
|
||||
;; --- Validierung ---
|
||||
(if (<= L_stau 0.1)
|
||||
(progn
|
||||
(alert (strcat "Berechnete Staustreckenlaenge ungueltig: "
|
||||
(rtos L_stau 2 2) " mm\n"
|
||||
"Bitte groessere ΔL oder kleineren Winkel waehlen."))
|
||||
(exit)
|
||||
)
|
||||
)
|
||||
|
||||
;; --- Ausgabe Zusammenfassung ---
|
||||
(princ "\n\n=========================================")
|
||||
(princ (strcat "\n>>> Gewaehlter Winkel: " (rtos winkel 2 1) grad-zeichen))
|
||||
(princ (strcat "\n>>> Seite: " seite))
|
||||
(princ (strcat "\n>>> L_stau (Weglaenge): " (rtos L_stau 2 2) " mm"))
|
||||
(princ (strcat "\n>>> Separator Horiz.: " (rtos sep-x 2 2) " mm"))
|
||||
(princ "\n=========================================")
|
||||
|
||||
;; --- Bestaetigungsdialog ---
|
||||
(princ "\n\nGefaellestrecke einfuegen?")
|
||||
(princ "\n 1 - Ja, einfuegen")
|
||||
(princ "\n 2 - Nein, abbrechen")
|
||||
(setq antwort (getstring "\nIhre Wahl (1/2) [1]: "))
|
||||
|
||||
(if (not (= antwort "2"))
|
||||
(gefaellestrecke-einfuegen L_stau (fix winkel) startpunkt-fuer-einfuegen seite)
|
||||
(princ "\nVorgang abgebrochen.")
|
||||
)
|
||||
|
||||
nil
|
||||
)
|
||||
|
||||
;; ============================================================
|
||||
;; START
|
||||
;; ============================================================
|
||||
(princ "\n=========================================")
|
||||
(princ "\n>>> GEFAELLESTRECKE v1.0 geladen <<<")
|
||||
(princ "\n>>> Befehl: GEFAELLESTRECKE <<<")
|
||||
+30
-12
@@ -336,7 +336,11 @@
|
||||
(princ "\n Lade Blockdefinitionen aus Einzeldateien...")
|
||||
(princ (strcat "\n Block-Pfad: " block-pfad))
|
||||
|
||||
;; === AUS_ELEMENT Masse extrahieren ===
|
||||
;; === AUS_ELEMENT / EIN_ELEMENT – beide Seiten vorladen ===
|
||||
(ensure-block-loaded "_3D_AS_90_rechts")
|
||||
(ensure-block-loaded "_3D_ES_90_rechts")
|
||||
|
||||
;; === AUS_ELEMENT Masse extrahieren (links als Referenz) ===
|
||||
(princ "\n Extrahiere AUS_Element Masse...")
|
||||
(ensure-block-loaded "_3D_AS_90_links")
|
||||
(if (tblsearch "BLOCK" "_3D_AS_90_links")
|
||||
@@ -752,16 +756,18 @@
|
||||
;; ============================================================
|
||||
;; TEIL 9: MODULE EINFÜGEN (GESAMTE ANLAGE)
|
||||
;; ============================================================
|
||||
(defun foerderanlage-einfuegen (deltaL deltaH richtung best-winkel L_GF1 L_GF2 L_VF startpunkt
|
||||
(defun foerderanlage-einfuegen (deltaL deltaH richtung best-winkel L_GF1 L_GF2 L_VF startpunkt seite
|
||||
/ aktueller-punkt bogen-name endpunkt bogen-mass bogen-dx bogen-dz
|
||||
)
|
||||
as-block es-block)
|
||||
(setq aktueller-punkt startpunkt)
|
||||
|
||||
(setq as-block (strcat "_3D_AS_90_" seite))
|
||||
(setq es-block (strcat "_3D_ES_90_" seite))
|
||||
|
||||
(if (not *lib-initialized*) (init-bibliothek))
|
||||
|
||||
|
||||
;; 1. AUS_Element
|
||||
(princ "\n\n1/11: _3D_AS_90_links (0°)")
|
||||
(setq aktueller-punkt (insert-block-by-ks "_3D_AS_90_links" aktueller-punkt))
|
||||
(princ (strcat "\n\n1/11: " as-block " (0°)"))
|
||||
(setq aktueller-punkt (insert-block-by-ks as-block aktueller-punkt))
|
||||
|
||||
;; 2. 1. Gefällestrecke
|
||||
(if (> L_GF1 0.1)
|
||||
@@ -845,8 +851,8 @@
|
||||
(setq aktueller-punkt (insert-rotated-block-with-ks "Staustrecke_Separator_SP_300_mm" aktueller-punkt 3 300 0))
|
||||
|
||||
;; 11. EIN_Element
|
||||
(princ "\n\n11/11: _3D_ES_90_links (0°)")
|
||||
(setq endpunkt (insert-block-by-ks "_3D_ES_90_links" aktueller-punkt))
|
||||
(princ (strcat "\n\n11/11: " es-block " (0°)"))
|
||||
(setq endpunkt (insert-block-by-ks es-block aktueller-punkt))
|
||||
|
||||
(princ "\n\n=========================================")
|
||||
(princ "\n>>> Förderanlage erfolgreich eingefügt! <<<")
|
||||
@@ -861,7 +867,8 @@
|
||||
deltaL deltaH deltaX deltaY richtung ergebnis
|
||||
best-winkel L_GF L_GF1 L_GF2 L_VF ergebnis-liste
|
||||
antwort verteilung-modus
|
||||
gueltige-winkel idx eintrag wahl)
|
||||
gueltige-winkel idx eintrag wahl
|
||||
seite)
|
||||
;; (dbgf "c:FOERDERANLAGE")
|
||||
|
||||
(princ "\n=========================================")
|
||||
@@ -1005,7 +1012,18 @@
|
||||
(princ (strcat "\n>>> L_GF (gesamt): " (rtos L_GF 2 2) " mm"))
|
||||
(princ (strcat "\n>>> L_VF: " (rtos L_VF 2 2) " mm"))
|
||||
(princ "\n=========================================")
|
||||
|
||||
|
||||
;; Seite: links oder rechts
|
||||
(princ "\n\nEin-/Auselement - Seite waehlen:")
|
||||
(princ "\n 1 - Links (_3D_AS_90_links / _3D_ES_90_links)")
|
||||
(princ "\n 2 - Rechts (_3D_AS_90_rechts / _3D_ES_90_rechts)")
|
||||
(setq antwort (getstring "\nIhre Wahl (1/2) [1]: "))
|
||||
(if (= antwort "2")
|
||||
(setq seite "rechts")
|
||||
(setq seite "links")
|
||||
)
|
||||
(princ (strcat "\n>>> Seite: " seite))
|
||||
|
||||
;; Verteilung der Gefällestrecken
|
||||
(princ "\n\nVerteilung der Gefaellestrecken (vorne/hinten):")
|
||||
(princ "\n 1 - Gleichmaessig (L_GF1 = L_GF2 = L_GF/2)")
|
||||
@@ -1043,7 +1061,7 @@
|
||||
(setq antwort (getstring "\nIhre Wahl (1/2): "))
|
||||
|
||||
(if (= antwort "1")
|
||||
(foerderanlage-einfuegen deltaL deltaH richtung best-winkel L_GF1 L_GF2 L_VF startpunkt-fuer-einfuegen)
|
||||
(foerderanlage-einfuegen deltaL deltaH richtung best-winkel L_GF1 L_GF2 L_VF startpunkt-fuer-einfuegen seite)
|
||||
(princ "\nVorgang abgebrochen.")
|
||||
)
|
||||
|
||||
|
||||
+4
-3
@@ -28,11 +28,12 @@
|
||||
(load (strcat base-path "ssg_dialog.lsp") "ssg_dialog.lsp nicht gefunden")
|
||||
(load (strcat base-path "ssg_layer.lsp") "ssg_layer.lsp nicht gefunden")
|
||||
;; KreiselInsert.lsp entfernt - ersetzt durch Python/PyRx (lib/elemente/kreisel.py, eckrad.py)
|
||||
(load (strcat base-path "VarioFoerderer.lsp") "VarioFoerderer.lsp nicht gefunden")
|
||||
(load (strcat base-path "tests.lsp") "tests.lsp nicht gefunden")
|
||||
(load (strcat base-path "VarioFoerderer.lsp") "VarioFoerderer.lsp nicht gefunden")
|
||||
(load (strcat base-path "Gefaellestrecke.lsp") "Gefaellestrecke.lsp nicht gefunden")
|
||||
(load (strcat base-path "tests.lsp") "tests.lsp nicht gefunden")
|
||||
;; OmniModulInsert.lsp entfernt - ersetzt durch Python/PyRx (lib/elemente/omniflo*.py)
|
||||
(load (strcat base-path "SSG_LIB_Commands.lsp") "SSG_LIB_Commands.lsp nicht gefunden")
|
||||
(prompt "\nSSG-Bibliotheken geladen: ssg_core, ssg_dbg, ssg_dialog, ssg_layer")
|
||||
(prompt "\nSSG-Bibliotheken geladen: ssg_core, ssg_dbg, ssg_dialog, ssg_layer, VarioFoerderer, Gefaellestrecke")
|
||||
(princ)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user