From 8db7b2bfbfad95a9369e11e0a2f038707a202c01 Mon Sep 17 00:00:00 2001 From: Michael Stangl Date: Tue, 30 Jun 2026 10:35:31 +0200 Subject: [PATCH] =?UTF-8?q?Veraltetes=20Men=C3=BC=20Etagenf=C3=B6rderer=20?= =?UTF-8?q?entfernt.=20Testdaten=20f=C3=BCr=20den=20F=C3=B6rderertest=20wi?= =?UTF-8?q?rd=20jetzt=20aus=20.json=20Datei=20geladen.=20Testfunktionen=20?= =?UTF-8?q?des=20F=C3=B6rderers=20bauen=20jetzt=20auch=20Block=20um=20jede?= =?UTF-8?q?n=20F=C3=B6rderer,=20damit=20ein=20Export=20m=C3=B6glich=20ist?= =?UTF-8?q?=20.=20Fix=20einiger=20Funktionsaufrufe=20in=20den=20Variof?= =?UTF-8?q?=C3=B6rderer=20Funktionen.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Lisp/SSG_LIB_Commands.lsp | 5 -- Lisp/ssg_core.lsp | 2 +- Lisp/vf_standard.lsp | 2 +- README.md | 1 - menu/SSG_LIB.mnu | 1 - tests/test_foerderer.lsp | 118 +++++++++++++--------------- tests/testdata/foerderer_tests.json | 15 ++++ 7 files changed, 70 insertions(+), 74 deletions(-) create mode 100644 tests/testdata/foerderer_tests.json diff --git a/Lisp/SSG_LIB_Commands.lsp b/Lisp/SSG_LIB_Commands.lsp index 5aee241..ef5afc8 100644 --- a/Lisp/SSG_LIB_Commands.lsp +++ b/Lisp/SSG_LIB_Commands.lsp @@ -16,11 +16,6 @@ ) ;; --- ILS / Foerderer --- -(defun c:ILS_ETF_Etagenfoerderer () - (princ "\n[DUMMY] ILS_ETF_Etagenfoerderer aufgerufen") - (princ) -) - (defun c:ILS_TEF_Strecke () (princ "\n[DUMMY] ILS_TEF_Strecke aufgerufen") (princ) diff --git a/Lisp/ssg_core.lsp b/Lisp/ssg_core.lsp index b3e2132..20eaf1f 100644 --- a/Lisp/ssg_core.lsp +++ b/Lisp/ssg_core.lsp @@ -370,7 +370,7 @@ (progn (setq tag (cdr (assoc 2 ed))) (setq wert (cdr (assoc tag attrib-alist))) - (if (and wert (> (strlen wert) 0)) + (if (and wert (= (type wert) 'STR) (> (strlen wert) 0)) (progn (entmod (subst (cons 1 wert) (assoc 1 ed) ed)) (entupd obj) diff --git a/Lisp/vf_standard.lsp b/Lisp/vf_standard.lsp index 738045f..d49274e 100644 --- a/Lisp/vf_standard.lsp +++ b/Lisp/vf_standard.lsp @@ -70,7 +70,7 @@ ) (setq missing '()) (foreach bname required-blocks - (setq datei (strcat block-pfad bname ".dxf")) + (setq datei (strcat block-pfad bname ".dwg")) (if (not (findfile datei)) (setq missing (cons datei missing)) ) diff --git a/README.md b/README.md index 7f4d524..ddaafcb 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,6 @@ SSG_LIB │ │ ├── BTMT-Beladung → ILS_BTMT_Beladung │ │ └── BTMT-Entladung → ILS_BTMT_Entladung │ ├── Foerderer -│ │ ├── ETF Etagenfoerderer → ILS_ETF_Etagenfoerderer │ │ ├── TEF Strecke → ILS_TEF_Strecke │ │ ├── VarioFoerderer → FOERDERANLAGE │ │ ├── Kurven angetr. Aussen → ILS_K{90,60,30}{LA,RA} diff --git a/menu/SSG_LIB.mnu b/menu/SSG_LIB.mnu index 55f2bab..582ce67 100644 --- a/menu/SSG_LIB.mnu +++ b/menu/SSG_LIB.mnu @@ -12,7 +12,6 @@ [BTMT-Beladung]^C^C(ssg-ensure "SSG_LIB_Commands") ILS_BTMT_Beladung [<-BTMT-Entladung]^C^C(ssg-ensure "SSG_LIB_Commands") ILS_BTMT_Entladung [->Foerderer] -[ETF Etagenfoerderer]^C^CI(ssg-ensure "SSG_LIB_Commands") LS_ETF_Etagenfoerderer [Durch TEF angetriebene Strecke]^C^C(ssg-ensure "SSG_LIB_Commands") ILS_TEF_Strecke [VarioFoerderer]^C^CVarioFoerderer [EtageVarioFoerderer]^C^CETAGEVARIOFOERDERER diff --git a/tests/test_foerderer.lsp b/tests/test_foerderer.lsp index 0b554a9..e112d9f 100644 --- a/tests/test_foerderer.lsp +++ b/tests/test_foerderer.lsp @@ -1,10 +1,9 @@ ;; ============================================================ ;; test_foerderer.lsp - Automatischer Integrationstest fuer VarioFoerderer ;; -;; Erzeugt 12 Variofoerderer (6x Auf, 6x Ab) mit deltaL=7000 -;; und verschiedenen Hoehenstufen. Speichert: +;; Liest Testfaelle aus tests/testdata/foerderer_tests.json. +;; Speichert: ;; - tests/output/foerderer_results.json (Ergebnisse) -;; - tests/output/foerderer_tests.dwg (Zeichnung) ;; ;; Voraussetzungen: ;; - SSG_LIB geladen (VarioFoerderer.lsp, ssg_core.lsp) @@ -70,12 +69,12 @@ ;; ============================================================ ;; C:TEST_FOERDERER - Hauptbefehl ;; ============================================================ -(defun c:TEST_FOERDERER ( / deltaL deltaH richtung ergebnis - best-winkel L_GF L_VF - y-offset hoehen-liste idx - anz-gebaut anz-nicht-gebaut - results-list - test-id) +(defun c:TEST_FOERDERER ( / json-datei testdaten cfg tests + eintrag test-id richtung deltaL deltaH + ergebnis best-winkel L_GF L_VF + y-offset y-abstand idx + anz-gebaut anz-nicht-gebaut results-list + startpunkt vf-nummer hoehe-von hoehe-bis lastEnt) ;; Bibliothek initialisieren (laedt Block-Library und extrahiert Masse) (if (not *lib-initialized*) @@ -87,8 +86,30 @@ (setvar "ATTREQ" 0) (setvar "ATTDIA" 0) - (setq deltaL 7000) - (setq hoehen-liste '(0 1000 2000 3000 4000 5000)) + ;; Testdaten aus JSON laden + (setq json-datei + (strcat (vl-string-translate "\\" "/" (getenv "DXFMAKRO")) + "/tests/testdata/foerderer_tests.json")) + (setq testdaten (ssg-load-json json-datei)) + (if (null testdaten) + (progn + (alert (strcat "Testdaten nicht gefunden:\n" json-datei)) + (ssg-end) + (exit) + ) + ) + + ;; Konfiguration aus erstem Eintrag (ohne test_id) + (setq cfg (car testdaten)) + (setq y-abstand (ssg-val cfg "y_abstand")) + (if (or (null y-abstand) (= y-abstand 0)) (setq y-abstand 400)) + + ;; Nur Eintraege mit test_id sind Testfaelle + (setq tests + (vl-remove-if-not + '(lambda (e) (ssg-val e "test_id")) + testdaten)) + (setq y-offset 0) (setq idx 0) (setq results-list '()) @@ -99,66 +120,26 @@ (princ "\n================================================================") (princ "\n TEST_FOERDERER - Variofoerderer Integrationstest") (princ "\n================================================================") - (princ (strcat "\n Distanz dL = " (rtos deltaL 2 0) " mm")) - (princ "\n Hoehenstufen: 0, 1000, 2000, 3000, 4000, 5000 mm") - (princ "\n Richtungen: Auf + Ab") + (princ (strcat "\n Testdaten: " json-datei)) + (princ (strcat "\n Testfaelle: " (itoa (length tests)))) + (princ (strcat "\n Y-Abstand: " (rtos y-abstand 2 0) " mm")) (princ "\n================================================================") ;; ========================================================== - ;; TEIL 1: Aufwaerts-Tests (6 Foerderer) + ;; Alle Testfaelle aus JSON ausfuehren ;; ========================================================== - (foreach deltaH hoehen-liste + (foreach eintrag tests + (setq test-id (ssg-val eintrag "test_id")) + (setq richtung (ssg-val eintrag "richtung")) + (setq deltaL (float (ssg-val eintrag "deltaL"))) + (setq deltaH (float (ssg-val eintrag "deltaH"))) (setq idx (1+ idx)) - (setq richtung "Auf") - (setq test-id (strcat "VF_Auf_" (rtos deltaH 2 0))) - (setq ergebnis (berechne-alle-winkel deltaL deltaH richtung)) - (setq best-winkel (car ergebnis)) - (setq L_GF (cadr ergebnis)) - (setq L_VF (caddr ergebnis)) - - (if (and best-winkel L_GF L_VF (> L_GF 0) (> L_VF 0)) - (progn - (setq anz-gebaut (1+ anz-gebaut)) - (princ (strcat "\n " (itoa idx) ". " test-id " -> GEBAUT " - (itoa best-winkel) " Grad L_GF=" (rtos L_GF 2 1) - " L_VF=" (rtos L_VF 2 1))) - - (variofoerderer-einfuegen deltaL deltaH richtung best-winkel - (/ L_GF 2.0) (/ L_GF 2.0) L_VF - (list 0 y-offset 0) "links" idx 0) - - (setq results-list (cons - (foerderer:test-result-json test-id richtung deltaL deltaH - "GEBAUT" best-winkel L_GF L_VF) - results-list)) - ) - (progn - (setq anz-nicht-gebaut (1+ anz-nicht-gebaut)) - (princ (strcat "\n " (itoa idx) ". " test-id " -> NICHT_GEBAUT")) - - (setq results-list (cons - (foerderer:test-result-json test-id richtung deltaL deltaH - "NICHT_GEBAUT" nil nil nil) - results-list)) - ) - ) - (setq y-offset (- y-offset 200)) - ) - - ;; ========================================================== - ;; TEIL 2: Abwaerts-Tests (6 Foerderer) - ;; ========================================================== - (foreach deltaH hoehen-liste - (setq idx (1+ idx)) - (setq richtung "Ab") - (setq test-id (strcat "VF_Ab_" (rtos deltaH 2 0))) - - (if (< deltaH 1) + ;; Geometrisch unmoeglich: Ab mit deltaH=0 + (if (and (= richtung "Ab") (< deltaH 1)) (progn (setq anz-nicht-gebaut (1+ anz-nicht-gebaut)) (princ (strcat "\n " (itoa idx) ". " test-id " -> GEOMETRISCH_UNMOEGLICH")) - (setq results-list (cons (foerderer:test-result-json test-id richtung deltaL deltaH "GEOMETRISCH_UNMOEGLICH" nil nil nil) @@ -177,9 +158,17 @@ (itoa best-winkel) " Grad L_GF=" (rtos L_GF 2 1) " L_VF=" (rtos L_VF 2 1))) + (setq startpunkt (list 0 y-offset 0)) + (setq vf-nummer idx) + (setq hoehe-von 0) + (setq hoehe-bis (if (= richtung "Auf") deltaH (- deltaH))) + (setq lastEnt (entlast)) (variofoerderer-einfuegen deltaL deltaH richtung best-winkel (/ L_GF 2.0) (/ L_GF 2.0) L_VF - (list 0 y-offset 0) "links" idx 0) + startpunkt "links") + (vf-block-erstellen "standard" "links" vf-nummer 0 + hoehe-von hoehe-bis deltaH deltaL L_VF L_GF + richtung best-winkel startpunkt lastEnt) (setq results-list (cons (foerderer:test-result-json test-id richtung deltaL deltaH @@ -189,7 +178,6 @@ (progn (setq anz-nicht-gebaut (1+ anz-nicht-gebaut)) (princ (strcat "\n " (itoa idx) ". " test-id " -> NICHT_GEBAUT")) - (setq results-list (cons (foerderer:test-result-json test-id richtung deltaL deltaH "NICHT_GEBAUT" nil nil nil) @@ -198,7 +186,7 @@ ) ) ) - (setq y-offset (- y-offset 200)) + (setq y-offset (- y-offset y-abstand)) ) ;; ========================================================== diff --git a/tests/testdata/foerderer_tests.json b/tests/testdata/foerderer_tests.json new file mode 100644 index 0000000..091157f --- /dev/null +++ b/tests/testdata/foerderer_tests.json @@ -0,0 +1,15 @@ +[ + { "y_abstand": 400 }, + { "test_id": "VF_Auf_0", "richtung": "Auf", "deltaL": 7000, "deltaH": 0 }, + { "test_id": "VF_Auf_1000", "richtung": "Auf", "deltaL": 7000, "deltaH": 1000 }, + { "test_id": "VF_Auf_2000", "richtung": "Auf", "deltaL": 7000, "deltaH": 2000 }, + { "test_id": "VF_Auf_3000", "richtung": "Auf", "deltaL": 7000, "deltaH": 3000 }, + { "test_id": "VF_Auf_4000", "richtung": "Auf", "deltaL": 7000, "deltaH": 4000 }, + { "test_id": "VF_Auf_5000", "richtung": "Auf", "deltaL": 7000, "deltaH": 5000 }, + { "test_id": "VF_Ab_0", "richtung": "Ab", "deltaL": 7000, "deltaH": 0 }, + { "test_id": "VF_Ab_1000", "richtung": "Ab", "deltaL": 7000, "deltaH": 1000 }, + { "test_id": "VF_Ab_2000", "richtung": "Ab", "deltaL": 7000, "deltaH": 2000 }, + { "test_id": "VF_Ab_3000", "richtung": "Ab", "deltaL": 7000, "deltaH": 3000 }, + { "test_id": "VF_Ab_4000", "richtung": "Ab", "deltaL": 7000, "deltaH": 4000 }, + { "test_id": "VF_Ab_5000", "richtung": "Ab", "deltaL": 7000, "deltaH": 5000 } +]