commit f6300b2ad2712ce71902bc5924965aa76fe7eccf Author: Michael Stangl Date: Tue May 5 16:06:06 2026 +0200 erste Fassung von Yuelin rein diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c4ec678 --- /dev/null +++ b/.gitignore @@ -0,0 +1,70 @@ +# ---> Python +__pycache__/ +*.py[cod] +*$py.class +*.so +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST +*.manifest +*.spec +pip-log.txt +pip-delete-this-directory.txt +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ +*.mo +*.pot +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ +.spyderproject +.spyproject +.ropeproject +.mypy_cache/ +.dmypy.json +dmypy.json +.pyre/ +.pytype/ +cython_debug/ +.pdm.toml +__pypackages__/ +/site-packages +/site +.ipynb_checkpoints +profile_default/ +ipython_config.py + +# Benutzerdefiniert +/data +/work +/log +/results diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..cee4243 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "iis.configDir": "" +} \ No newline at end of file diff --git a/Blocks/AUS_Element_links.dwg b/Blocks/AUS_Element_links.dwg new file mode 100644 index 0000000..42d0e18 Binary files /dev/null and b/Blocks/AUS_Element_links.dwg differ diff --git a/Blocks/EIN_Element_links.dwg b/Blocks/EIN_Element_links.dwg new file mode 100644 index 0000000..ee36199 Binary files /dev/null and b/Blocks/EIN_Element_links.dwg differ diff --git a/Blocks/Staustrecke_SP_1000_mm.dwg b/Blocks/Staustrecke_SP_1000_mm.dwg new file mode 100644 index 0000000..a84b279 Binary files /dev/null and b/Blocks/Staustrecke_SP_1000_mm.dwg differ diff --git a/Blocks/Staustrecke_Separator_SP_300_mm.dwg b/Blocks/Staustrecke_Separator_SP_300_mm.dwg new file mode 100644 index 0000000..5eec297 Binary files /dev/null and b/Blocks/Staustrecke_Separator_SP_300_mm.dwg differ diff --git a/Blocks/Vario_Motorstation_SP_500mm.dwg b/Blocks/Vario_Motorstation_SP_500mm.dwg new file mode 100644 index 0000000..5d1d375 Binary files /dev/null and b/Blocks/Vario_Motorstation_SP_500mm.dwg differ diff --git a/Blocks/Vario_Spannstation_SP_500mm.dwg b/Blocks/Vario_Spannstation_SP_500mm.dwg new file mode 100644 index 0000000..265263b Binary files /dev/null and b/Blocks/Vario_Spannstation_SP_500mm.dwg differ diff --git a/Blocks/Vertikalbogen_Ab_12_Oben.dwg b/Blocks/Vertikalbogen_Ab_12_Oben.dwg new file mode 100644 index 0000000..11b2d32 Binary files /dev/null and b/Blocks/Vertikalbogen_Ab_12_Oben.dwg differ diff --git a/Blocks/Vertikalbogen_Ab_12_Unten.dwg b/Blocks/Vertikalbogen_Ab_12_Unten.dwg new file mode 100644 index 0000000..0bcc4dd Binary files /dev/null and b/Blocks/Vertikalbogen_Ab_12_Unten.dwg differ diff --git a/Blocks/Vertikalbogen_Ab_15_Oben.dwg b/Blocks/Vertikalbogen_Ab_15_Oben.dwg new file mode 100644 index 0000000..b9cceec Binary files /dev/null and b/Blocks/Vertikalbogen_Ab_15_Oben.dwg differ diff --git a/Blocks/Vertikalbogen_Ab_15_Unten.dwg b/Blocks/Vertikalbogen_Ab_15_Unten.dwg new file mode 100644 index 0000000..7b9bb43 Binary files /dev/null and b/Blocks/Vertikalbogen_Ab_15_Unten.dwg differ diff --git a/Blocks/Vertikalbogen_Ab_24_Oben.dwg b/Blocks/Vertikalbogen_Ab_24_Oben.dwg new file mode 100644 index 0000000..b615bbb Binary files /dev/null and b/Blocks/Vertikalbogen_Ab_24_Oben.dwg differ diff --git a/Blocks/Vertikalbogen_Ab_24_Unten.dwg b/Blocks/Vertikalbogen_Ab_24_Unten.dwg new file mode 100644 index 0000000..cbb8dae Binary files /dev/null and b/Blocks/Vertikalbogen_Ab_24_Unten.dwg differ diff --git a/Blocks/Vertikalbogen_Ab_36_Oben.dwg b/Blocks/Vertikalbogen_Ab_36_Oben.dwg new file mode 100644 index 0000000..060e00f Binary files /dev/null and b/Blocks/Vertikalbogen_Ab_36_Oben.dwg differ diff --git a/Blocks/Vertikalbogen_Ab_36_Unten.dwg b/Blocks/Vertikalbogen_Ab_36_Unten.dwg new file mode 100644 index 0000000..e99193c Binary files /dev/null and b/Blocks/Vertikalbogen_Ab_36_Unten.dwg differ diff --git a/Blocks/Vertikalbogen_Ab_48_Oben.dwg b/Blocks/Vertikalbogen_Ab_48_Oben.dwg new file mode 100644 index 0000000..d8779b7 Binary files /dev/null and b/Blocks/Vertikalbogen_Ab_48_Oben.dwg differ diff --git a/Blocks/Vertikalbogen_Ab_48_Unten.dwg b/Blocks/Vertikalbogen_Ab_48_Unten.dwg new file mode 100644 index 0000000..5460495 Binary files /dev/null and b/Blocks/Vertikalbogen_Ab_48_Unten.dwg differ diff --git a/Blocks/Vertikalbogen_Ab_9_Oben.dwg b/Blocks/Vertikalbogen_Ab_9_Oben.dwg new file mode 100644 index 0000000..13f79dd Binary files /dev/null and b/Blocks/Vertikalbogen_Ab_9_Oben.dwg differ diff --git a/Blocks/Vertikalbogen_Ab_9_Unten.dwg b/Blocks/Vertikalbogen_Ab_9_Unten.dwg new file mode 100644 index 0000000..78043c3 Binary files /dev/null and b/Blocks/Vertikalbogen_Ab_9_Unten.dwg differ diff --git a/Blocks/Vertikalbogen_Auf_12_Oben.dwg b/Blocks/Vertikalbogen_Auf_12_Oben.dwg new file mode 100644 index 0000000..a3c0342 Binary files /dev/null and b/Blocks/Vertikalbogen_Auf_12_Oben.dwg differ diff --git a/Blocks/Vertikalbogen_Auf_12_Unten.dwg b/Blocks/Vertikalbogen_Auf_12_Unten.dwg new file mode 100644 index 0000000..02a2d8d Binary files /dev/null and b/Blocks/Vertikalbogen_Auf_12_Unten.dwg differ diff --git a/Blocks/Vertikalbogen_Auf_15_Oben.dwg b/Blocks/Vertikalbogen_Auf_15_Oben.dwg new file mode 100644 index 0000000..653d340 Binary files /dev/null and b/Blocks/Vertikalbogen_Auf_15_Oben.dwg differ diff --git a/Blocks/Vertikalbogen_Auf_15_Unten.dwg b/Blocks/Vertikalbogen_Auf_15_Unten.dwg new file mode 100644 index 0000000..f87d1cb Binary files /dev/null and b/Blocks/Vertikalbogen_Auf_15_Unten.dwg differ diff --git a/Blocks/Vertikalbogen_Auf_24_Oben.dwg b/Blocks/Vertikalbogen_Auf_24_Oben.dwg new file mode 100644 index 0000000..efbde8e Binary files /dev/null and b/Blocks/Vertikalbogen_Auf_24_Oben.dwg differ diff --git a/Blocks/Vertikalbogen_Auf_24_Unten.dwg b/Blocks/Vertikalbogen_Auf_24_Unten.dwg new file mode 100644 index 0000000..776a9de Binary files /dev/null and b/Blocks/Vertikalbogen_Auf_24_Unten.dwg differ diff --git a/Blocks/Vertikalbogen_Auf_36_Oben.dwg b/Blocks/Vertikalbogen_Auf_36_Oben.dwg new file mode 100644 index 0000000..eac1d81 Binary files /dev/null and b/Blocks/Vertikalbogen_Auf_36_Oben.dwg differ diff --git a/Blocks/Vertikalbogen_Auf_36_Unten.dwg b/Blocks/Vertikalbogen_Auf_36_Unten.dwg new file mode 100644 index 0000000..9066c3c Binary files /dev/null and b/Blocks/Vertikalbogen_Auf_36_Unten.dwg differ diff --git a/Blocks/Vertikalbogen_Auf_3_Oben.dwg b/Blocks/Vertikalbogen_Auf_3_Oben.dwg new file mode 100644 index 0000000..933a71d Binary files /dev/null and b/Blocks/Vertikalbogen_Auf_3_Oben.dwg differ diff --git a/Blocks/Vertikalbogen_Auf_3_Unten.dwg b/Blocks/Vertikalbogen_Auf_3_Unten.dwg new file mode 100644 index 0000000..a4eeea8 Binary files /dev/null and b/Blocks/Vertikalbogen_Auf_3_Unten.dwg differ diff --git a/Blocks/Vertikalbogen_Auf_48_Oben.dwg b/Blocks/Vertikalbogen_Auf_48_Oben.dwg new file mode 100644 index 0000000..e94bfee Binary files /dev/null and b/Blocks/Vertikalbogen_Auf_48_Oben.dwg differ diff --git a/Blocks/Vertikalbogen_Auf_48_Unten.dwg b/Blocks/Vertikalbogen_Auf_48_Unten.dwg new file mode 100644 index 0000000..3897412 Binary files /dev/null and b/Blocks/Vertikalbogen_Auf_48_Unten.dwg differ diff --git a/Blocks/Vertikalbogen_Auf_9_Oben.dwg b/Blocks/Vertikalbogen_Auf_9_Oben.dwg new file mode 100644 index 0000000..bd2181f Binary files /dev/null and b/Blocks/Vertikalbogen_Auf_9_Oben.dwg differ diff --git a/Blocks/Vertikalbogen_Auf_9_Unten.dwg b/Blocks/Vertikalbogen_Auf_9_Unten.dwg new file mode 100644 index 0000000..72fde06 Binary files /dev/null and b/Blocks/Vertikalbogen_Auf_9_Unten.dwg differ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0a7fba9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Michael Stangl, on GitHub mistamichael + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Lisp/ILSModulInsert.lsp b/Lisp/ILSModulInsert.lsp new file mode 100644 index 0000000..21b027b --- /dev/null +++ b/Lisp/ILSModulInsert.lsp @@ -0,0 +1,307 @@ +;; ============================================ +;; ModulInsert.lsp +;; Kreisel Modul-Einfügesystem + Smart Connect +;; Version: 4.0 +;; +;; Basispunkt: Linker Kreis, linkester Tangentenpunkt (links Mitte) +;; ============================================ + +;; Standardwerte initialisieren +(setq #Kreisel_Abstand 2300.0) +(setq #Kreisel_Typ "PIN") + +;; ============================================ +;; Haupt-Einfügebefehl (Position manuell angeben) +;; ============================================ +(defun c:KreiselInsert ( / pt x y abstand typ oldLayer oldColor oldOsnap oldCmdEcho abstandStr typNum) + + (princ "\n=== Kreisel Modul einfügen ===\n") + (princ "Basispunkt = linke Kreistangente (links Mitte)\n") + + ;; 1. Einfügepunkt abfragen + (setq pt (getpoint "\nBasispunkt (linke Kreistangente): ")) + (if (null pt) (setq pt '(0 0 0))) + (setq x (car pt) y (cadr pt)) + + ;; 2. Abstand abfragen + (princ (strcat "\nAbstand <" (rtos #Kreisel_Abstand 2 0) ">: ")) + (setq abstandStr (getstring "")) + (if (= abstandStr "") + (setq abstand #Kreisel_Abstand) + (setq abstand (atof abstandStr)) + ) + (setq #Kreisel_Abstand abstand) + + ;; 3. Typ abfragen + (princ "\n[1] Kreisel mit PIN") + (princ "\n[2] Kreisel ohne PIN") + (princ (strcat "\nBitte wählen <" (if (= #Kreisel_Typ "PIN") "1" "2") ">: ")) + (setq typNum (getstring "")) + + (cond + ((= typNum "2") (setq typ "OhnePIN")) + (t (setq typ "PIN")) + ) + (setq #Kreisel_Typ typ) + + (princ (strcat "\n→ Modus: " typ)) + + ;; Modul zeichnen + (draw-module x y abstand typ) + + (princ "\n✅ Kreisel Modul erfolgreich eingefügt") + (princ) +) + + +;; ============================================ +;; Smart-Connect-Einfügebefehl +;; ============================================ +(defun c:KreiselConnect ( / existingObj pickPoint connectionType newX newY abstand typ) + + (princ "\n=== Kreisel Smart Connect ===\n") + + ;; 1. Bestehendes Modul auswählen + (setq existingObj (car (entsel "\nBestehendes Modul wählen: "))) + (if (null existingObj) (exit)) + + ;; 2. Verbindungspunkt abfragen (Benutzer-Klickposition) + (setq pickPoint (getpoint "\nVerbindungspunkt wählen (auf Tangente klicken): ")) + (if (null pickPoint) (exit)) + + ;; 3. Verbindungspunkt-Typ erkennen + (setq connectionType (identify-connection-point existingObj pickPoint)) + (princ (strcat "\n→ Verbindungspunkt: " connectionType)) + + ;; 4. Parameter des neuen Moduls abfragen + (princ (strcat "\nAbstand <" (rtos #Kreisel_Abstand 2 0) ">: ")) + (setq abstandStr (getstring "")) + (if (= abstandStr "") + (setq abstand #Kreisel_Abstand) + (setq abstand (atof abstandStr)) + ) + + (princ "\n[1] Kreisel mit PIN") + (princ "\n[2] Kreisel ohne PIN") + (princ (strcat "\nBitte wählen <" (if (= #Kreisel_Typ "PIN") "1" "2") ">: ")) + (setq typNum (getstring "")) + (cond + ((= typNum "2") (setq typ "OhnePIN")) + (t (setq typ "PIN")) + ) + + ;; 5. Basispunkt des neuen Moduls anhand der Verbindungsregeln berechnen + (setq newBasePoint (calculate-new-basepoint existingObj pickPoint connectionType abstand)) + + (if newBasePoint + (progn + (princ (strcat "\n→ Neue Basis: (" (rtos (car newBasePoint) 2 0) "," (rtos (cadr newBasePoint) 2 0) ")")) + (draw-module (car newBasePoint) (cadr newBasePoint) abstand typ) + (princ "\n✅ Smart Connect erfolgreich!") + ) + (princ "\n❌ Verbindung nicht möglich!") + ) + (princ) +) + + +;; ============================================ +;; Verbindungspunkt-Typ erkennen +;; ============================================ +(defun identify-connection-point (obj pickPoint / x y abstand) + ;; Basispunkt des Moduls ermitteln (aus Einfügepunkt berechnen) + (setq insertPoint (cdr (assoc 10 (entget obj)))) + (setq x (car insertPoint) y (cadr insertPoint)) + + ;; Abstand ermitteln (sollte aus Modulattributen gelesen werden, vorerst globale Variable) + (setq abstand #Kreisel_Abstand) + + (setq pickX (car pickPoint) pickY (cadr pickPoint)) + (setq tolerance 50.0) ;; Toleranz 50mm + + ;; Verbindungspunkte prüfen + (cond + ;; T_O (Mittelpunkt obere Tangente) + ((and (abs (- pickX (+ x 400.0 (/ abstand 2.0)))) tolerance) + (abs (- pickY (+ y 400.0))) tolerance) + (setq type "T_O")) + + ;; T_U (Mittelpunkt untere Tangente) + ((and (abs (- pickX (+ x 400.0 (/ abstand 2.0)))) tolerance) + (abs (- pickY (- y 400.0))) tolerance) + (setq type "T_U")) + + ;; M_O (Linker Kreis, oberer Rand) + ((and (abs (- pickX (+ x 400.0))) tolerance) + (abs (- pickY (+ y 400.0)))) tolerance) + (setq type "M_O")) + + ;; M_U (Linker Kreis, unterer Rand) + ((and (abs (- pickX (+ x 400.0))) tolerance) + (abs (- pickY (- y 400.0))) tolerance) + (setq type "M_U")) + + ;; M_L (Linker Kreis, linker Rand) + ((and (abs (- pickX x)) tolerance) + (abs (- pickY y)) tolerance) + (setq type "M_L")) + + ;; S_O (Rechter Kreis, oberer Rand) + ((and (abs (- pickX (+ x 400.0 abstand))) tolerance) + (abs (- pickY (+ y 400.0))) tolerance) + (setq type "S_O")) + + ;; S_U (Rechter Kreis, unterer Rand) + ((and (abs (- pickX (+ x 400.0 abstand))) tolerance) + (abs (- pickY (- y 400.0))) tolerance) + (setq type "S_U")) + + ;; S_R (Rechter Kreis, rechter Rand) + ((and (abs (- pickX (+ x 800.0 abstand))) tolerance) + (abs (- pickY y)) tolerance) + (setq type "S_R")) + + (t (setq type "UNKNOWN")) + ) + type +) + + +;; ============================================ +;; Basispunkt des neuen Moduls berechnen +;; ============================================ +(defun calculate-new-basepoint (obj pickPoint connectionType abstand / x y newX newY) + + (setq insertPoint (cdr (assoc 10 (entget obj)))) + (setq x (car insertPoint) y (cadr insertPoint)) + + (cond + ;; T_O / T_U / M_O / S_O / M_U / S_U → Verbindung nach oben oder unten, neues Modul mit S_R + ((member connectionType '("T_O" "T_U" "M_O" "S_O" "M_U" "S_U")) + (princ "\n→ Richtung: nach oben/unten") + ;; Bestimmen ob nach oben oder unten + (if (> (cadr pickPoint) y) + (setq newX x newY (+ y 800.0 abstand)) ;; nach oben + (setq newX x newY (- y 800.0 abstand)) ;; nach unten + ) + ) + + ;; M_L → Verbindung nach links, neues Modul mit S_R + ((= connectionType "M_L") + (princ "\n→ Richtung: nach links") + (setq newX (- x 800.0 abstand) newY y) + ) + + ;; S_R → Verbindung nach rechts, neues Modul mit M_L + ((= connectionType "S_R") + (princ "\n→ Richtung: nach rechts") + (setq newX (+ x 800.0 abstand) newY y) + ) + + (t (setq newX nil newY nil)) + ) + + (if (and newX newY) (list newX newY) nil) +) + + +;; ============================================ +;; Komplettes Modul zeichnen +;; ============================================ +(defun draw-module (x y abstand typ / oldLayer oldColor oldOsnap oldCmdEcho) + + ;; Fang speichern und deaktivieren + (setq oldOsnap (getvar "OSMODE")) + (setq oldCmdEcho (getvar "CMDECHO")) + (setvar "OSMODE" 0) + (setvar "CMDECHO" 0) + + (setq oldLayer (getvar "CLAYER")) + (setq oldColor (getvar "CECOLOR")) + + ;; Linken Kreisblock einfügen + (command "_.INSERT" "AN8" (list (+ x 400.0) y) 1 1 0) + + ;; Rechten Kreisblock einfügen + (command "_.INSERT" "SP8" (list (+ x 400.0 abstand) y) 1 1 0) + + ;; Tangenten zeichnen + (if (not (tblsearch "LAYER" "S_LP")) + (command "_.LAYER" "_NEW" "S_LP" "_C" "7" "" "") + ) + (setvar "CLAYER" "S_LP") + + (if (= typ "PIN") + (setvar "CECOLOR" "5") + (setvar "CECOLOR" "1") + ) + + ;; Obere Tangente + (command "_.LINE" + (list (+ x 400.0) (+ y 400.0)) + (list (+ x 400.0 abstand) (+ y 400.0)) + "") + + ;; Untere Tangente + (command "_.LINE" + (list (+ x 400.0) (- y 400.0)) + (list (+ x 400.0 abstand) (- y 400.0)) + "") + + ;; PIN-Linien zeichnen + (if (= typ "PIN") + (progn + (if (not (tblsearch "LAYER" "pinbereich")) + (command "_.LAYER" "_NEW" "pinbereich" "_C" "3" "_LT" "2punkt" "") + ) + (setvar "CLAYER" "pinbereich") + (setvar "CECOLOR" "3") + + ;; Obere PIN-Linie + (command "_.LINE" + (list (+ x 800.0) (+ y 300.0)) + (list (+ x abstand) (+ y 300.0)) + "") + + ;; Untere PIN-Linie + (command "_.LINE" + (list (+ x 800.0) (- y 300.0)) + (list (+ x abstand) (- y 300.0)) + "") + ) + ) + + ;; Einstellungen wiederherstellen + (setvar "CLAYER" oldLayer) + (setvar "CECOLOR" oldColor) + (setvar "OSMODE" oldOsnap) + (setvar "CMDECHO" oldCmdEcho) +) + + +;; ============================================ +;; Hilfsbefehle +;; ============================================ + +(defun c:KreiselQuick () + (setq pt (getpoint "\nBasispunkt (linke Kreistangente): ")) + (if pt + (draw-module (car pt) (cadr pt) #Kreisel_Abstand #Kreisel_Typ) + ) + (princ "\n✅ Schnell Einfügen fertig") +) + + +(defun c:KreiselParams () + (princ "\n=== Aktuelle Kreisel Parameter ===") + (princ (strcat "\nAbstand: " (rtos #Kreisel_Abstand 2 0) " mm")) + (princ (strcat "\nTyp: " #Kreisel_Typ)) + (princ "\nBasispunkt: linke Kreistangente (links Mitte)") + (princ "\n===================================\n") + (princ) +) + + +(princ "\nModulInsert.lsp geladen (Version 4.0 - Smart Connect)!") +(princ "\nBefehle: KreiselInsert, KreiselConnect, KreiselQuick, KreiselParams") +(princ) \ No newline at end of file diff --git a/Lisp/VarioFoerderer.lsp b/Lisp/VarioFoerderer.lsp new file mode 100644 index 0000000..ea99ba0 --- /dev/null +++ b/Lisp/VarioFoerderer.lsp @@ -0,0 +1,546 @@ +;; ============================================================ +;; FÖRDERANLAGE GENERATOR für BricsCAD Pro +;; Version: 24.3 (Korrigierte Methodenzuordnung) +;; Befehl: FOERDERANLAGE +;; ============================================================ + +(vl-load-com) + +;; ============================================================ +;; TEIL 1: GLOBALE EINSTELLUNGEN +;; ============================================================ +(setq modul-pfad "C:/Users/y.wang/Documents/BricsCAD/Library/Blocks/") +(setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) +(setq modelspace (vla-get-ModelSpace doc)) + +;; ============================================================ +;; TEIL 2: FESTE MODUL-MASSE +;; ============================================================ +(setq aus-dx 531.85) +(setq aus-dy -496.11) +(setq aus-dz -12.92) + +(setq ein-dx 468.94) +(setq ein-dy -446.42) +(setq ein-dz -167.89) + +(setq separator-laenge 300) +(setq spannstation-laenge 500) +(setq motorstation-laenge 500) +(setq staustrecke-basis 1000) +(setq FESTE_HORIZONTAL 1600) + +;; ============================================================ +;; TEIL 3: BOGEN-MASSE (für X-Werte aus Tabelle) +;; ============================================================ +(setq bogen-auf-unten + '((3 399.73 0 0)(9 297.95 0 15.61)(12 296.52 0 23.34) + (15 593.04 0 62.33)(24 583.13 0 100.09)(36 847.53 0 234.76) + (48 1063.24 0 448.91)) +) +(setq bogen-auf-oben + '((3 391.46 0 0)(9 281.45 0 14.75)(12 275.96 0 21.72) + (15 568.46 0 59.75)(24 546.87 0 93.37)(36 796.96 0 219.78) + (48 1000.4 0 422.88)) +) +(setq bogen-ab-oben + '((9 389.31 0 -40.92)(12 284.23 0 -37.42)(15 389.31 0 -40.92) + (24 552.27 0 -124.51)(36 796.35 0 -265.43)(48 732.51 0 -349.39)) +) +(setq bogen-ab-unten + '((9 397.54 0 -41.78)(12 296.52 0 -39.04)(15 493.38 0 -70.19) + (24 580.27 0 -131.23)(36 838.65 0 -280.41)(48 787.08 0 -375.42)) +) + +;; ============================================================ +;; TEIL 4: HILFSFUNKTIONEN +;; ============================================================ +(defun punkt-differenz (p1 p2) + (list (- (car p2) (car p1)) (- (cadr p2) (cadr p1)) (- (caddr p2) (caddr p1))) +) + +(defun get-bogen-mass (tabelle winkel) + (setq result nil) + (foreach item tabelle (if (= (car item) winkel) (setq result (cdr item)))) + (if (null result) (setq result '(800 0 0))) result +) + +(defun get-bogen-mass-mit-abs (tabelle winkel) + (setq result nil) + (foreach item tabelle (if (= (car item) winkel) (setq result (list (cadr item) (caddr item) (abs (cadddr item)))))) + (if (null result) (setq result '(800 0 0))) result +) + +(defun fmt (x) + (if (and (numberp x) (not (equal x nil))) (rtos x 2 2) "---") +) + +;; ============================================================ +;; ActiveX Block einfügen (返回对象) +;; ============================================================ +(defun InsertBlock (name punkt skala-x) + (setq insertionPoint (vlax-3D-point punkt)) + (vla-InsertBlock modelspace insertionPoint name skala-x 1.0 1.0 0) +) + +;; ============================================================ +;; 🔥 METHODE 1: Für rotierte Blöcke (Staustrecken, Separator, Spannstation, Motorstation) +;; X = berechnet aus Länge * cos(Winkel) +;; Z = aus BoundingBox +;; ============================================================ +(defun get-block-endpoint-rotated (obj startpunkt winkel laenge) + (setq rad (* winkel (/ pi 180.0))) + (setq berechnete_dx (* laenge (cos rad))) + + (vla-GetBoundingBox obj 'minpt 'maxpt) + (setq minpt (vlax-safearray->list minpt)) + (setq maxpt (vlax-safearray->list maxpt)) + (setq reale_dz (- (caddr maxpt) (caddr minpt))) + + (list (+ (car startpunkt) berechnete_dx) + (cadr startpunkt) + (+ (caddr startpunkt) reale_dz)) +) + +;; ============================================================ +;; 🔥 METHODE 2: Für nicht-rotierte Blöcke (AUS_Element, EIN_Element) +;; X und Z aus BoundingBox (komplett aus Block-Geometrie) +;; ============================================================ +(defun get-block-endpoint-nonrotated (obj startpunkt) + (vla-GetBoundingBox obj 'minpt 'maxpt) + (setq minpt (vlax-safearray->list minpt)) + (setq maxpt (vlax-safearray->list maxpt)) + + (list (car maxpt) ;; X aus BBox + (cadr startpunkt) ;; Y gleich + (caddr maxpt)) ;; Z aus BBox +) + +;; ============================================================ +;; 🔥 METHODE 3: Für Vertikalbögen +;; X aus Tabelle (vordefinierte Werte) +;; Z aus BoundingBox +;; ============================================================ +(defun get-block-endpoint-bogen (obj startpunkt bogen-x) + (vla-GetBoundingBox obj 'minpt 'maxpt) + (setq minpt (vlax-safearray->list minpt)) + (setq maxpt (vlax-safearray->list maxpt)) + (setq reale_dz (- (caddr maxpt) (caddr minpt))) + + (list (+ (car startpunkt) bogen-x) ;; X aus Tabelle + (cadr startpunkt) + (+ (caddr startpunkt) reale_dz)) ;; Z aus BBox +) + +;; ============================================================ +;; Rotation eines Objekts um die Y-Achse (korrigiert) +;; ============================================================ +(defun Rotate3D-Y (obj punkt winkel) + (setq rad (* winkel (/ pi 180.0))) + (setq tx (car punkt) ty (cadr punkt) tz (caddr punkt)) + + (setq matrix (list + (list (cos rad) 0 (sin rad) (- tx (* tx (cos rad)) (* tz (sin rad)))) + (list 0 1 0 (- ty ty)) + (list (- (sin rad)) 0 (cos rad) (- tz (* tx (sin rad)) (* tz (cos rad)))) + (list 0 0 0 1) + )) + (vla-TransformBy obj (vlax-tmatrix matrix)) +) + +;; ============================================================ +;; TEIL 5: WINKELBERECHNUNG (unverändert) +;; ============================================================ +(defun berechne-alle-winkel (deltaL deltaH richtung / + winkel-list ergebnis-liste A B cos3 sin3 + bogen-x1 bogen-z1 bogen-x2 bogen-z2 + abs-dz-AUS abs-dz-EIN L_GF L_VF cosα sinα nenner + winkel mass1 mass2 gueltig) + (setq abs-dz-AUS (abs aus-dz) abs-dz-EIN (abs ein-dz)) + (setq winkel-list '(3 9 12 15 24 36 48) ergebnis-liste '()) + (setq cos3 (cos (* 3 (/ pi 180.0))) sin3 (sin (* 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)) + (foreach winkel winkel-list + (if (= richtung "Auf") + (setq mass1 (get-bogen-mass bogen-auf-unten winkel) mass2 (get-bogen-mass bogen-auf-oben winkel) + bogen-z1 (caddr mass1) bogen-z2 (caddr mass2)) + (setq mass1 (get-bogen-mass-mit-abs bogen-ab-oben winkel) mass2 (get-bogen-mass-mit-abs bogen-ab-unten winkel) + bogen-z1 (caddr mass1) bogen-z2 (caddr mass2)) + ) + (setq bogen-x1 (car mass1) bogen-x2 (car mass2)) + (setq cosα (cos (* winkel (/ pi 180.0))) sinα (sin (* winkel (/ pi 180.0)))) + (setq A (- deltaL aus-dx ein-dx bogen-x1 bogen-x2 (* FESTE_HORIZONTAL cos3))) + (setq B (- deltaH abs-dz-AUS abs-dz-EIN bogen-z1 bogen-z2 (* FESTE_HORIZONTAL sin3))) + (setq nenner (- (* cos3 sinα) (* sin3 cosα))) + (if (> (abs nenner) 0.0001) + (progn + (setq L_GF (/ (- (* A sinα) (* B cosα)) nenner)) + (setq L_VF (/ (- (* B cos3) (* A sin3)) nenner)) + (if (and (numberp L_GF) (numberp L_VF)) + (progn + (setq gueltig (and (>= L_GF 0) (>= L_VF 0))) + (setq ergebnis-liste (cons (list winkel L_GF L_VF gueltig) ergebnis-liste)) + ) + (setq ergebnis-liste (cons (list winkel nil nil nil) ergebnis-liste)) + ) + ) + (setq ergebnis-liste (cons (list winkel nil nil nil) ergebnis-liste)) + ) + ) + (setq ergebnis-liste (reverse ergebnis-liste)) + (princ "\n\n=================================================================================\n ERGEBNISTABELLE\n=================================================================================") + (princ "\n Winkel L_GF (mm) L_VF (mm) Status\n=================================================================================") + (setq best-winkel nil best-L_GF nil best-L_VF nil) + (foreach item ergebnis-liste + (setq winkel (car item) L_GF (cadr item) L_VF (caddr item) gueltig (cadddr item)) + (if (and (numberp L_GF) (numberp L_VF)) + (progn + (princ (strcat "\n " (itoa winkel) "° " (fmt L_GF) " mm " (fmt L_VF) " mm ")) + (if gueltig + (progn + (princ "✓ GÜLTIG") + (if (and (null best-winkel) (>= L_GF 0) (>= L_VF 0)) + (setq best-winkel winkel best-L_GF L_GF best-L_VF L_VF) + ) + ) + (princ "✗ UNGÜLTIG") + ) + ) + (princ (strcat "\n " (itoa winkel) "° --- --- ✗ FEHLER")) + ) + ) + (princ "\n=================================================================================") + (list best-winkel best-L_GF best-L_VF ergebnis-liste) +) + +;; ============================================================ +;; TEIL 6: MODULE EINFÜGEN (mit korrigierter Methodenzuordnung) +;; ============================================================ +(defun foerderanlage-einfuegen (deltaL deltaH richtung + best-winkel L_GF L_VF startpunkt) + + (setq aktueller-punkt startpunkt) + (setq L_GF1 (/ L_GF 2)) + (setq L_GF2 (/ L_GF 2)) + + (princ "\n\n=========================================") + (princ "\nBeginne mit dem Einfügen der Module...") + (princ "\n=========================================") + (princ (strcat "\nStartpunkt (AUS_Element Eingang): X=" (rtos (car aktueller-punkt) 2 2) + ", Y=" (rtos (cadr aktueller-punkt) 2 2) + ", Z=" (rtos (caddr aktueller-punkt) 2 2))) + + ;; ========================================================== + ;; 1. AUS_Element_links - Verwenden Sie die manuellen Werte + ;; ========================================================== + (princ "\n\n1/11: AUS_Element_links") + (setq blockname (strcat modul-pfad "AUS_Element_links.dwg")) + (if (findfile blockname) + (progn + (setq block (InsertBlock blockname aktueller-punkt 1.0)) + ;; Verwenden Sie die manuellen Werte statt BoundingBox + (setq aktueller-punkt (list + (+ (car aktueller-punkt) aus-dx) + (+ (cadr aktueller-punkt) aus-dy) + (+ (caddr aktueller-punkt) aus-dz))) + (princ (strcat "\n → AUS_Element Ausgang (manuell): X=" (rtos (car aktueller-punkt) 2 2) + ", Y=" (rtos (cadr aktueller-punkt) 2 2) + ", Z=" (rtos (caddr aktueller-punkt) 2 2))) + ) + (princ "\n FEHLER: AUS_Element_links.dwg nicht gefunden.") + ) + + ;; ========================================================== + ;; 2. 1. GEFÄLLESTRECKE (L_GF1) (METHODE 1: rotiert, X per cos, Z per BBox) + ;; ========================================================== + (if (> L_GF1 0.1) + (progn + (princ (strcat "\n2/11: Staustrecke (3° nach unten, Länge=" (rtos L_GF1 2 2) " mm)")) + (setq blockname (strcat modul-pfad "Staustrecke_SP_1000_mm.dwg")) + (if (findfile blockname) + (progn + (setq block (InsertBlock blockname aktueller-punkt (/ L_GF1 1000.0))) + (Rotate3D-Y block aktueller-punkt 3) + (setq aktueller-punkt (get-block-endpoint-rotated block aktueller-punkt 3 L_GF1)) + (princ (strcat "\n → Endpunkt: X=" (rtos (car aktueller-punkt) 2 2) + ", Z=" (rtos (caddr aktueller-punkt) 2 2))) + ) + (princ (strcat "\n FEHLER: Blockdatei nicht gefunden: " blockname)) + ) + ) + (princ "\n2/11: (übersprungen, L_GF1 = 0)") + ) + + ;; ========================================================== + ;; 3. SEPARATOR 1 (METHODE 1: rotiert, X per cos, Z per BBox) + ;; ========================================================== + (princ "\n3/11: Separator 300mm (3° nach unten)") + (setq blockname (strcat modul-pfad "Staustrecke_Separator_SP_300_mm.dwg")) + (if (findfile blockname) + (progn + (setq block (InsertBlock blockname aktueller-punkt 1.0)) + (Rotate3D-Y block aktueller-punkt 3) + (setq aktueller-punkt (get-block-endpoint-rotated block aktueller-punkt 3 separator-laenge)) + (princ (strcat "\n → Endpunkt: X=" (rtos (car aktueller-punkt) 2 2) + ", Z=" (rtos (caddr aktueller-punkt) 2 2))) + ) + (princ "\n FEHLER: Separator 1 Datei nicht gefunden.") + ) + + ;; ========================================================== + ;; 4. SPANNSTATION (METHODE 1: rotiert, X per cos, Z per BBox) + ;; ========================================================== + (princ "\n4/11: Spannstation 500mm (3° nach unten)") + (setq blockname (strcat modul-pfad "Vario_Spannstation_SP_500mm.dwg")) + (if (findfile blockname) + (progn + (setq block (InsertBlock blockname aktueller-punkt 1.0)) + (Rotate3D-Y block aktueller-punkt 3) + (setq aktueller-punkt (get-block-endpoint-rotated block aktueller-punkt 3 spannstation-laenge)) + (princ (strcat "\n → Endpunkt: X=" (rtos (car aktueller-punkt) 2 2) + ", Z=" (rtos (caddr aktueller-punkt) 2 2))) + ) + (princ "\n FEHLER: Spannstation Datei nicht gefunden.") + ) + + ;; ========================================================== + ;; 5. 1. VERTIKALBOGEN (METHODE 3: X aus Tabelle, Z aus BoundingBox) + ;; ========================================================== + (if (= richtung "Auf") + (progn + (princ (strcat "\n5/11: Vertikalbogen_Auf_" (itoa best-winkel) "_Unten")) + (setq blockname (strcat modul-pfad "Vertikalbogen_Auf_" (itoa best-winkel) "_Unten.dwg")) + (setq bogen-mass (get-bogen-mass bogen-auf-unten best-winkel)) + ) + (progn + (princ (strcat "\n5/11: Vertikalbogen_Ab_" (itoa best-winkel) "_Oben")) + (setq blockname (strcat modul-pfad "Vertikalbogen_Ab_" (itoa best-winkel) "_Oben.dwg")) + (setq bogen-mass (get-bogen-mass-mit-abs bogen-ab-oben best-winkel)) + ) + ) + (if (findfile blockname) + (progn + (setq block (InsertBlock blockname aktueller-punkt 1.0)) + ;; KEINE Rotation! Der Bogen ist bereits richtig ausgerichtet + (setq bogen-x (car bogen-mass)) + (setq aktueller-punkt (get-block-endpoint-bogen block aktueller-punkt bogen-x)) + (princ (strcat "\n → Endpunkt: X=" (rtos (car aktueller-punkt) 2 2) + ", Z=" (rtos (caddr aktueller-punkt) 2 2))) + ) + (princ (strcat "\n FEHLER: Bogen-Datei nicht gefunden: " blockname)) + ) + + ;; ========================================================== + ;; 6. VARIABLE STRECKE L_VF (METHODE 1: rotiert, X per cos, Z per BBox) + ;; ========================================================== + (if (> L_VF 0.1) + (progn + (if (= richtung "Auf") + (progn + (princ (strcat "\n6/11: Steigungsstrecke (" (itoa best-winkel) "° nach oben, Länge=" (rtos L_VF 2 2) " mm)")) + (setq rot-winkel (- best-winkel)) + ) + (progn + (princ (strcat "\n6/11: Gefällestrecke (" (itoa best-winkel) "° nach unten, Länge=" (rtos L_VF 2 2) " mm)")) + (setq rot-winkel best-winkel) + ) + ) + (setq blockname (strcat modul-pfad "Staustrecke_SP_1000_mm.dwg")) + (if (findfile blockname) + (progn + (setq block (InsertBlock blockname aktueller-punkt (/ L_VF 1000.0))) + (Rotate3D-Y block aktueller-punkt rot-winkel) + (setq aktueller-punkt (get-block-endpoint-rotated block aktueller-punkt rot-winkel L_VF)) + (princ (strcat "\n → Endpunkt: X=" (rtos (car aktueller-punkt) 2 2) + ", Z=" (rtos (caddr aktueller-punkt) 2 2))) + ) + (princ (strcat "\n FEHLER: Blockdatei nicht gefunden: " blockname)) + ) + ) + (princ "\n6/11: (L_VF = 0, übersprungen)") + ) + + ;; ========================================================== + ;; 7. 2. VERTIKALBOGEN (METHODE 3: X aus Tabelle, Z aus BoundingBox) + ;; ========================================================== + (if (= richtung "Auf") + (progn + (princ (strcat "\n7/11: Vertikalbogen_Auf_" (itoa best-winkel) "_Oben")) + (setq blockname (strcat modul-pfad "Vertikalbogen_Auf_" (itoa best-winkel) "_Oben.dwg")) + (setq bogen-mass (get-bogen-mass bogen-auf-oben best-winkel)) + ) + (progn + (princ (strcat "\n7/11: Vertikalbogen_Ab_" (itoa best-winkel) "_Unten")) + (setq blockname (strcat modul-pfad "Vertikalbogen_Ab_" (itoa best-winkel) "_Unten.dwg")) + (setq bogen-mass (get-bogen-mass-mit-abs bogen-ab-unten best-winkel)) + ) + ) + (if (findfile blockname) + (progn + (setq block (InsertBlock blockname aktueller-punkt 1.0)) + ;; KEINE Rotation! + (setq bogen-x (car bogen-mass)) + (setq aktueller-punkt (get-block-endpoint-bogen block aktueller-punkt bogen-x)) + (princ (strcat "\n → Endpunkt: X=" (rtos (car aktueller-punkt) 2 2) + ", Z=" (rtos (caddr aktueller-punkt) 2 2))) + ) + (princ (strcat "\n FEHLER: Bogen-Datei nicht gefunden: " blockname)) + ) + + ;; ========================================================== + ;; 8. MOTORSTATION (METHODE 1: rotiert, X per cos, Z per BBox) + ;; ========================================================== + (princ "\n8/11: Motorstation 500mm (3° nach unten)") + (setq blockname (strcat modul-pfad "Vario_Motorstation_SP_500mm.dwg")) + (if (findfile blockname) + (progn + (setq block (InsertBlock blockname aktueller-punkt 1.0)) + (Rotate3D-Y block aktueller-punkt 3) + (setq aktueller-punkt (get-block-endpoint-rotated block aktueller-punkt 3 motorstation-laenge)) + (princ (strcat "\n → Endpunkt: X=" (rtos (car aktueller-punkt) 2 2) + ", Z=" (rtos (caddr aktueller-punkt) 2 2))) + ) + (princ "\n FEHLER: Motorstation Datei nicht gefunden.") + ) + + ;; ========================================================== + ;; 9. 2. GEFÄLLESTRECKE (L_GF2) (METHODE 1: rotiert, X per cos, Z per BBox) + ;; ========================================================== + (if (> L_GF2 0.1) + (progn + (princ (strcat "\n9/11: Staustrecke (3° nach unten, Länge=" (rtos L_GF2 2 2) " mm)")) + (setq blockname (strcat modul-pfad "Staustrecke_SP_1000_mm.dwg")) + (if (findfile blockname) + (progn + (setq block (InsertBlock blockname aktueller-punkt (/ L_GF2 1000.0))) + (Rotate3D-Y block aktueller-punkt 3) + (setq aktueller-punkt (get-block-endpoint-rotated block aktueller-punkt 3 L_GF2)) + (princ (strcat "\n → Endpunkt: X=" (rtos (car aktueller-punkt) 2 2) + ", Z=" (rtos (caddr aktueller-punkt) 2 2))) + ) + (princ (strcat "\n FEHLER: Blockdatei nicht gefunden: " blockname)) + ) + ) + (princ "\n9/11: (übersprungen, L_GF2 = 0)") + ) + + ;; ========================================================== + ;; 10. SEPARATOR 2 (METHODE 1: rotiert, X per cos, Z per BBox) + ;; ========================================================== + (princ "\n10/11: Separator 300mm (3° nach unten)") + (setq blockname (strcat modul-pfad "Staustrecke_Separator_SP_300_mm.dwg")) + (if (findfile blockname) + (progn + (setq block (InsertBlock blockname aktueller-punkt 1.0)) + (Rotate3D-Y block aktueller-punkt 3) + (setq aktueller-punkt (get-block-endpoint-rotated block aktueller-punkt 3 separator-laenge)) + (princ (strcat "\n → Endpunkt: X=" (rtos (car aktueller-punkt) 2 2) + ", Z=" (rtos (caddr aktueller-punkt) 2 2))) + ) + (princ "\n FEHLER: Separator 2 Datei nicht gefunden.") + ) + + ;; ========================================================== + ;; 11. EIN_Element_links (METHODE 2: nicht rotiert, X und Z aus BoundingBox) + ;; ========================================================== + (princ "\n11/11: EIN_Element_links") + (setq blockname (strcat modul-pfad "EIN_Element_links.dwg")) + (if (findfile blockname) + (progn + (setq block (InsertBlock blockname aktueller-punkt 1.0)) + (setq aktueller-punkt (get-block-endpoint-nonrotated block aktueller-punkt)) + (princ (strcat "\n → EIN_Element Ausgang: X=" (rtos (car aktueller-punkt) 2 2) + ", Y=" (rtos (cadr aktueller-punkt) 2 2) + ", Z=" (rtos (caddr aktueller-punkt) 2 2))) + ) + (princ "\n FEHLER: EIN_Element_links Datei nicht gefunden.") + ) + + (princ "\n\n=========================================") + (princ "\n>>> FERTIG! Förderanlage erfolgreich erstellt! <<<") + (princ "\n=========================================") +) + +;; ============================================================ +;; TEIL 7: HAUPTFUNKTION +;; ============================================================ +(defun c:FOERDERANLAGE ( / eingabe-modus startpunkt endpunkt differenz + deltaL deltaH deltaY richtung ergebnis + best-winkel L_GF L_VF ergebnis-liste antwort) + (princ "\n=========================================") + (princ "\n FÖRDERANLAGE GENERATOR v24.3") + (princ "\n=========================================") + (princ "\n\nEingabemodus wählen:") + (princ "\n 1 - Punkte auswählen (in der Zeichnung)") + (princ "\n 2 - Werte manuell eingeben") + (setq antwort (getstring "\nIhre Wahl (1/2): ")) + (cond + ((= antwort "1") (setq eingabe-modus "Punkt")) + ((= antwort "2") (setq eingabe-modus "Wert")) + (t (setq eingabe-modus "Punkt") (princ "\nUngültige Eingabe, Modus 'Punkte auswählen'")) + ) + (if (= eingabe-modus "Punkt") + (progn + (princ "\n\n>>> MODUS: Punkte auswählen <<<") + (princ "\nWählen Sie die Einfügepunkte der Elemente.\n") + (setq startpunkt (getpoint "\n1. START-PUNKT (Eingang des AUS_Elements): ")) + (if (null startpunkt) (progn (alert "Kein Startpunkt!") (exit))) + (setq endpunkt (getpoint "\n2. END-PUNKT (Ausgang des EIN_Elements): ")) + (if (null endpunkt) (progn (alert "Kein Endpunkt!") (exit))) + (setq differenz (punkt-differenz startpunkt endpunkt)) + (setq deltaL (abs (car differenz)) deltaY (cadr differenz) deltaH (caddr differenz)) + (princ "\n\n=========================================") + (princ (strcat "\nGemessene Werte (Distanz zwischen den Punkten):\n ΔL = " (rtos deltaL 2 2) " mm\n ΔH = " (rtos deltaH 2 2) " mm")) + (if (> (abs deltaY) 50) (princ (strcat "\n ⚠ WARNUNG: Seitlicher Versatz ΔY = " (rtos deltaY 2 2) " mm!"))) + (if (>= deltaH 0) + (progn (setq richtung "Auf") (princ "\n\nFörderrichtung: AUF (nach oben)")) + (progn (setq richtung "Ab") (setq deltaH (abs deltaH)) (princ "\n\nFörderrichtung: AB (nach unten)")) + ) + (setq startpunkt-fuer-einfuegen startpunkt) + ) + (progn + (princ "\n\n>>> MODUS: Manuelle Werteingabe <<<") + (setq deltaL (getreal "\nHorizontale Distanz ΔL (mm): ")) + (if (null deltaL) (setq deltaL 15000)) + (setq deltaH (getreal "\nHöhendifferenz |ΔH| (mm): ")) + (if (null deltaH) (setq deltaH 3000)) + (princ "\nFörderrichtung wählen:\n 1 - AUF (nach oben)\n 2 - AB (nach unten)") + (setq antwort (getstring "\nIhre Wahl (1/2): ")) + (if (= antwort "2") (setq richtung "Ab") (setq richtung "Auf")) + (setq startpunkt-fuer-einfuegen (getpoint "\nStartpunkt für AUS_Element wählen: ")) + (if (null startpunkt-fuer-einfuegen) (setq startpunkt-fuer-einfuegen '(0 0 0))) + ) + ) + (setq ergebnis (berechne-alle-winkel deltaL deltaH richtung)) + (setq best-winkel (car ergebnis) L_GF (cadr ergebnis) L_VF (caddr ergebnis)) + (if (or (null best-winkel) (null L_GF) (null L_VF) (<= L_GF 0) (<= L_VF 0)) + (progn (alert "Kein passender Winkel gefunden!\n\nBitte andere Werte versuchen.") (exit)) + ) + (princ "\n\n=========================================") + (princ (strcat "\n>>> Empfohlener Winkel: " (itoa best-winkel) "°")) + (princ (strcat "\n>>> L_GF (gesamt): " (rtos L_GF 2 2) " mm")) + (princ (strcat "\n>>> L_GF1 = L_GF2 = " (rtos (/ L_GF 2) 2 2) " mm")) + (princ (strcat "\n>>> L_VF: " (rtos L_VF 2 2) " mm")) + (princ "\n=========================================") + (princ "\n\nMöchten Sie die Förderanlage einfügen?\n 1 - Ja, Module einfügen\n 2 - Nein, abbrechen") + (setq antwort (getstring "\nIhre Wahl (1/2): ")) + (if (= antwort "1") + (foerderanlage-einfuegen deltaL deltaH richtung best-winkel L_GF L_VF startpunkt-fuer-einfuegen) + (princ "\nVorgang abgebrochen.") + ) + (princ) +) + +;; ============================================================ +;; START +;; ============================================================ +(princ "\n=========================================") +(princ "\n>>> FÖRDERANLAGE GENERATOR v24.3 geladen <<<") +(princ "\n>>> Befehl: FOERDERANLAGE <<<") +(princ "\n>>> Methodenzuordnung: <<<") +(princ "\n>>> - Rotierte Blöcke: X per Berechnung, Z per BoundingBox <<<") +(princ "\n>>> - Nicht-rotierte Blöcke: X und Z per BoundingBox <<<") +(princ "\n>>> - Vertikalbögen: X aus Tabelle, Z per BoundingBox <<<") +(princ "\n=========================================") +(princ) \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..25d9b57 --- /dev/null +++ b/README.md @@ -0,0 +1,95 @@ +# test + +> Kurze Projektbeschreibung hier eintragen. + +## Projektstruktur + +``` +test/ +├── bin/ # Skripte zur Umgebungsverwaltung +│ ├── setenv.bat/.sh # Umgebungsvariablen setzen +│ ├── install_py.bat/.sh # venv erstellen + pip install +│ ├── activate_venv.bat/.sh # venv aktivieren +│ └── get_cmd.bat/.sh # Shell mit Umgebung oeffnen +├── cfg/ # Konfigurationsdateien (INI/JSON) +├── data/ # Eingabedaten (nicht im Git) +├── doc/ # Dokumentation +├── examples/ # Beispieldateien +├── lib/ # Python-Quellcode / Bibliothek +├── log/ # Log-Dateien (nicht im Git) +├── results/ # Ergebnisse / Ausgaben (nicht im Git) +├── tests/ # Unit Tests +├── .gitignore +├── LICENSE +├── README.md +└── requirements.txt +``` + +## Umgebungsvariablen + +| Variable | Beschreibung | +|----------------|---------------------------| +| `PROJECT` | Wurzelverzeichnis | +| `PV_BIN` | Skriptverzeichnis | +| `PV_LIB` | Python-Quellcode | +| `PV_CFG` | Konfigurationsdateien | +| `PV_DATA` | Eingabedaten | +| `PV_LOG` | Log-Dateien | +| `PV_RESULTS` | Ergebnisse | +| `PV_EXAMPLES` | Beispieldateien | +| `PYTHONPATH` | Erweitert um `PV_LIB` | + +## Installation + +### Voraussetzungen + +- Python 3.10 oder hoeher + +### Setup (Windows) + +```bat +bin\install_py.bat +``` + +### Setup (Linux / macOS) + +```bash +bash bin/install_py.sh +``` + +## Nutzung + +### Umgebung setzen + +```bat +bin\setenv.bat # Windows +``` +```bash +source bin/setenv.sh # Linux / macOS +``` + +### Shell mit gesetzten Variablen oeffnen + +```bat +bin\get_cmd.bat # Windows +``` +```bash +source bin/get_cmd.sh # Linux / macOS +``` + +### venv aktivieren + +```bat +bin\activate_venv.bat # Windows +``` +```bash +source bin/activate_venv.sh # Linux / macOS +``` + +## Lizenz + +MIT License — siehe [LICENSE](LICENSE) + +## Autor + +Michael Stangl (GitHub: mistamichael) diff --git a/bin/activate_venv.bat b/bin/activate_venv.bat new file mode 100644 index 0000000..3f3ba13 --- /dev/null +++ b/bin/activate_venv.bat @@ -0,0 +1,20 @@ +@echo off +REM ================================================================ +REM TEST - Python Virtual Environment aktivieren +REM ================================================================ + +call "%~dp0setenv.bat" + +if not exist "%PROJECT%\.venv" ( + echo FEHLER: Virtual environment nicht gefunden. + echo Bitte zuerst bin\install_py.bat ausfuehren. + exit /b 1 +) + +call "%PROJECT%\.venv\Scripts\activate.bat" +echo Virtuelle Umgebung aktiviert. +echo Python-Version: +python --version +echo. +echo Installierte Pakete: +pip list diff --git a/bin/activate_venv.sh b/bin/activate_venv.sh new file mode 100644 index 0000000..f02afdd --- /dev/null +++ b/bin/activate_venv.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# ================================================================ +# TEST - Python Virtual Environment aktivieren +# ================================================================ +# Dieses Skript muss gesourct werden: source bin/activate_venv.sh +# ================================================================ + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source "$SCRIPT_DIR/setenv.sh" + +if [ ! -d "$PROJECT/.venv" ]; then + echo "FEHLER: Virtual environment nicht gefunden." + echo "Bitte zuerst bin/install_py.sh ausfuehren." + return 1 +fi + +source "$PROJECT/.venv/bin/activate" +echo "Virtuelle Umgebung aktiviert." +echo "Python-Version:" +python --version +echo "" +echo "Installierte Pakete:" +pip list diff --git a/bin/get_cmd.bat b/bin/get_cmd.bat new file mode 100644 index 0000000..4f49895 --- /dev/null +++ b/bin/get_cmd.bat @@ -0,0 +1,7 @@ +@echo off +REM ================================================================ +REM TEST - Shell mit gesetzten Umgebungsvariablen oeffnen +REM ================================================================ + +call "%~dp0setenv.bat" +start cmd /k "echo TEST Umgebung aktiv. && echo PROJECT=%PROJECT%" diff --git a/bin/get_cmd.sh b/bin/get_cmd.sh new file mode 100644 index 0000000..2449503 --- /dev/null +++ b/bin/get_cmd.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +# ================================================================ +# TEST - Shell mit gesetzten Umgebungsvariablen oeffnen +# ================================================================ +# Verwendung: source bin/get_cmd.sh +# ================================================================ + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source "$SCRIPT_DIR/setenv.sh" + +exec "$SHELL" diff --git a/bin/install_py.bat b/bin/install_py.bat new file mode 100644 index 0000000..522db7b --- /dev/null +++ b/bin/install_py.bat @@ -0,0 +1,20 @@ +@echo off +REM ================================================================ +REM TEST - Python Virtual Environment einrichten +REM ================================================================ + +call "%~dp0setenv.bat" + +if not exist "%PROJECT%\.venv" ( + echo Initialisiere Python virtual environment... + py -m venv "%PROJECT%\.venv" --upgrade-deps + echo Erfolgreich. + + call "%PROJECT%\.venv\Scripts\activate.bat" + echo Installiere erforderliche Python Packages... + pip install -r "%PROJECT%\requirements.txt" -q + echo Erfolgreich. + deactivate +) else ( + echo Erforderliche Python Packages bereits installiert! +) diff --git a/bin/install_py.sh b/bin/install_py.sh new file mode 100644 index 0000000..c8f1903 --- /dev/null +++ b/bin/install_py.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +# ================================================================ +# TEST - Python Virtual Environment einrichten +# ================================================================ + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source "$SCRIPT_DIR/setenv.sh" + +if [ ! -d "$PROJECT/.venv" ]; then + echo "Initialisiere Python virtual environment..." + python3 -m venv "$PROJECT/.venv" --upgrade-deps + echo "Erfolgreich." + + source "$PROJECT/.venv/bin/activate" + echo "Installiere erforderliche Python Packages..." + pip install -r "$PROJECT/requirements.txt" -q + echo "Erfolgreich." + deactivate +else + echo "Erforderliche Python Packages bereits installiert!" +fi diff --git a/bin/setenv.bat b/bin/setenv.bat new file mode 100644 index 0000000..4887209 --- /dev/null +++ b/bin/setenv.bat @@ -0,0 +1,53 @@ +@echo off + +REM ================================================================ +REM TEST - Umgebungsvariablen Setup +REM ================================================================ + +echo Setting up environment variables for TEST ... + +REM Basis-Projektpfad (aktueller Ordner) +set "PROJECT=%~dp0.." +if "%PROJECT:~-6%"=="bin\.." set "PROJECT=%PROJECT:~0,-6%" +if "%PROJECT:~-1%"=="\" set "PROJECT=%PROJECT:~0,-1%" + +REM Pfade fuer verschiedene Komponenten +set "PV_BIN=%PROJECT%\bin" +set "PV_LIB=%PROJECT%\lib" +set "PV_DATA=%PROJECT%\data" +set "PV_CFG=%PROJECT%\cfg" +set "PV_BLOCKS=%PROJECT%\Blocks" +set "PV_LISP=%PROJECT%\Lisp" + +REM Python-Pfad erweitern (nur wenn noch nicht vorhanden) +echo %PYTHONPATH% | find /i "%PV_LIB%" >nul +if errorlevel 1 ( + set "PYTHONPATH=%PV_LIB%;%PYTHONPATH%" +) + +REM Ordner erstellen falls sie nicht existieren +if not exist "%PV_BIN%" mkdir "%PV_BIN%" +if not exist "%PV_CFG%" mkdir "%PV_CFG%" +if not exist "%PV_LIB%" mkdir "%PV_LIB%" +if not exist "%PV_DATA%" mkdir "%PV_DATA%" +if not exist "%PV_BLOCKS%" mkdir "%PV_BLOCKS%" +if not exist "%PV_LISP%" mkdir "%PV_LISP%" + +REM Umgebungsvariablen anzeigen +echo. +echo ================================================================ +echo TEST ENVIRONMENT SETUP COMPLETE +echo ================================================================ +echo PROJECT = %PROJECT% +echo PV_BIN = %PV_BIN% +echo PV_CFG = %PV_CFG% +echo PV_LIB = %PV_LIB% +echo PV_DATA = %PV_DATA% +echo PV_BLOCKS = %PV_BLOCKS% +echo PV_LISP = %PV_LISP% +echo PYTHONPATH = %PYTHONPATH% +echo ================================================================ +echo. + +REM Optionally keep window open +if "%1"=="--keep-open" pause diff --git a/bin/setenv.sh b/bin/setenv.sh new file mode 100644 index 0000000..e92adaf --- /dev/null +++ b/bin/setenv.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash +# ================================================================ +# TEST - Umgebungsvariablen Setup +# ================================================================ +# Dieses Skript muss gesourct werden: source bin/setenv.sh +# ================================================================ + +echo "Setting up environment variables for TEST ..." + +# Basis-Projektpfad (uebergeordnetes Verzeichnis von bin/) +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +export PROJECT="$(cd "$SCRIPT_DIR/.." && pwd)" + +# Pfade fuer verschiedene Komponenten +export PV_BIN="$PROJECT/bin" +export PV_LIB="$PROJECT/lib" +export PV_DATA="$PROJECT/data" +export PV_CFG="$PROJECT/cfg" +export PV_LOG="$PROJECT/log" +export PV_TESTS="$PROJECT/tests" +export PV_RESULTS="$PROJECT/results" +export PV_EXAMPLES="$PROJECT/examples" + +# Python-Pfad erweitern (nur wenn noch nicht vorhanden) +if [[ ":$PYTHONPATH:" != *":$PV_LIB:"* ]]; then + export PYTHONPATH="$PV_LIB:$PYTHONPATH" +fi + +# Ordner erstellen falls sie nicht existieren +mkdir -p "$PV_BIN" "$PV_CFG" "$PV_LIB" "$PV_DATA" "$PV_LOG" "$PV_RESULTS" "$PV_EXAMPLES" + +echo "" +echo "================================================================" +echo "TEST ENVIRONMENT SETUP COMPLETE" +echo "================================================================" +echo "PROJECT = $PROJECT" +echo "PV_BIN = $PV_BIN" +echo "PV_CFG = $PV_CFG" +echo "PV_LIB = $PV_LIB" +echo "PV_DATA = $PV_DATA" +echo "PV_RESULTS = $PV_RESULTS" +echo "PV_LOG = $PV_LOG" +echo "PV_EXAMPLES = $PV_EXAMPLES" +echo "PYTHONPATH = $PYTHONPATH" +echo "================================================================" +echo "" diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..bc55c26 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,6 @@ +# Python-Abhaengigkeiten +# Installieren mit: pip install -r requirements.txt + +# Beispiel-Abhaengigkeiten – anpassen nach Bedarf: +# pydantic >= 2.0.0 +# pytest >= 9.0.0