Omniflo Strecken Test geändert

This commit is contained in:
2026-08-03 16:11:37 +02:00
parent 6095c530f7
commit 2e49d0b522
2 changed files with 96 additions and 144 deletions
+54 -10
View File
@@ -29,15 +29,33 @@
;; Aufruf in BricsCAD:
;; (load "tests/test_omniflo_strecke.lsp")
;; TEST_OMNIFLO_STRECKE
;;
;; Debug: Detail-Ausgaben (pro Element, Diagnosen) laufen ueber die
;; ssg_dbg-Routinen und landen NICHT im BricsCAD-Fenster, sondern in einer
;; .dbg-Datei. Per Default ist das aus (keine Datei). Zum Einschalten vor
;; dem Testlauf:
;; (setq *omniflo-strecke-dbg* T)
;; Die Datei "omniflo_strecke.dbg" entsteht dann im DXFM_LOG-Verzeichnis.
;; Voraussetzung: ssg_dbg.lsp ist geladen (Teil von SSG_LIB).
;; ============================================================
;; Debug-Schalter fuer diesen Test (Default: aus). Ein bereits gesetztes T
;; wird beim erneuten Laden der Datei NICHT ueberschrieben.
(if (null *omniflo-strecke-dbg*) (setq *omniflo-strecke-dbg* nil))
;; --- Bogen-DXF non-interaktiv an gegebenem Punkt einfuegen ---
(defun omnistr:insert-bogen (sivasnr-str insert-pt hoehe-str drehung-str /
dxf-pfad omniflo-pfad blockEnt angleDeg)
(dbgf "omnistr:insert-bogen")
(dbgmsg (strcat "sivasnr=" (if sivasnr-str sivasnr-str "nil")
" drehung=" (if drehung-str drehung-str "nil")))
(setq omniflo-pfad (getenv "DXFM_OMNIFLO"))
(dbgreturn
(if (null omniflo-pfad)
(progn
;; Konfigurationsfehler: bleibt bewusst im Fenster sichtbar
(princ "\n[TEST_OMNIFLO_STRECKE] FEHLER: DXFM_OMNIFLO nicht gesetzt!")
nil
)
@@ -45,7 +63,7 @@
(setq dxf-pfad (strcat omniflo-pfad "/" sivasnr-str ".dxf"))
(if (not (findfile dxf-pfad))
(progn
(princ (strcat "\n[TEST_OMNIFLO_STRECKE] WARNUNG: DXF nicht gefunden: " dxf-pfad))
(dbgmsg (strcat "WARNUNG: DXF nicht gefunden: " dxf-pfad))
nil
)
(progn
@@ -65,6 +83,7 @@
)
)
)
)
)
@@ -76,8 +95,14 @@
;; Rueckgabe: Block-Entity oder nil.
(defun omnistr:build-gerade (profil pt-anf pt-end hoehe-str drehung-str /
srcAttribs textHeight textGap blockEnt)
(dbgf "omnistr:build-gerade")
(dbgmsg (strcat "profil=" (if profil profil "nil")
" hoehe=" (if hoehe-str hoehe-str "nil")
" drehung=" (if drehung-str drehung-str "nil")))
(dbgreturn
(if (null (car (atoms-family 1 '("OMNI:MAKE-GERADE"))))
(progn
;; Precondition-Fehler (Modul nicht geladen): bleibt im Fenster sichtbar
(princ "\n[TEST_OMNIFLO_STRECKE] FEHLER: omni:make-gerade nicht geladen (OmniModulInsert.lsp)!")
nil
)
@@ -87,9 +112,12 @@
;; Quell-Attribute lesen; falls keine .dwg vorhanden, Ersatz erzeugen
(setq srcAttribs (omni:read-src-attribs profil))
(if (null srcAttribs)
(setq srcAttribs (list (cons "PROFILTYP" profil)
(cons "HOEHE" (if hoehe-str hoehe-str "2000"))
(cons "ID" "")))
(progn
(dbgmsg (strcat "keine Quell-.dwg fuer " profil " - Ersatz-Attribute"))
(setq srcAttribs (list (cons "PROFILTYP" profil)
(cons "HOEHE" (if hoehe-str hoehe-str "2000"))
(cons "ID" "")))
)
)
(setvar "ATTREQ" 0)
(setvar "ATTDIA" 0)
@@ -103,6 +131,7 @@
blockEnt
)
)
)
)
@@ -163,6 +192,10 @@
(setvar "ATTREQ" 0)
(setvar "ATTDIA" 0)
;; Debug-Datei nur bei aktivem Schalter anlegen (siehe Kopf der Datei)
(if *omniflo-strecke-dbg* (dbgopen "omniflo_strecke.dbg" "DXFM_LOG"))
(dbgf "TEST_OMNIFLO_STRECKE")
(setq tests-json-pfad
(strcat (getenv "DXFMAKRO") "/tests/testdata/omniflo_strecke_tests.json"))
@@ -170,7 +203,9 @@
(progn
(princ (strcat "\n[TEST_OMNIFLO_STRECKE] FEHLER: Testdaten nicht gefunden: "
tests-json-pfad))
(dbgmsg (strcat "ABBRUCH: Testdaten nicht gefunden: " tests-json-pfad))
(ssg-end)
(if *omniflo-strecke-dbg* (progn (dbgreturn nil) (dbgclose)))
(princ)
)
(progn
@@ -178,7 +213,9 @@
(if (null elemente)
(progn
(princ "\n[TEST_OMNIFLO_STRECKE] FEHLER: Testdaten konnten nicht geladen werden.")
(dbgmsg "ABBRUCH: Testdaten konnten nicht geladen werden.")
(ssg-end)
(if *omniflo-strecke-dbg* (progn (dbgreturn nil) (dbgclose)))
(princ)
)
(progn
@@ -222,10 +259,10 @@
(setq insert-pt (list x-val y-val (atof hoehe-str)))
(setq pt-end (list xe-val ye-val (atof hoehe-str)))
(princ (strcat "\n " (itoa seq) ". " (if typ typ "?") ": "
(if description description "")
" -> (" (rtos x-val 2 0) ", " (rtos y-val 2 0)
") @ " drehung-str))
(dbgmsg (strcat (itoa seq) ". " (if typ typ "?") ": "
(if description description "")
" -> (" (rtos x-val 2 0) ", " (rtos y-val 2 0)
") @ " drehung-str))
;; Element aufbauen je nach Typ
(setq ergebnis
@@ -238,12 +275,15 @@
(if (null profil) (setq profil "AP110"))
(omnistr:build-gerade profil insert-pt pt-end hoehe-str drehung-str))
(T
(princ (strcat "\n WARNUNG: unbekannter Typ '"
(if typ typ "nil") "'"))
(dbgmsg (strcat "WARNUNG: unbekannter Typ '"
(if typ typ "nil") "'"))
nil)
)
)
(dbgmsg (strcat " -> " (if ergebnis "OK ent=" "FEHLER")
(if ergebnis (vl-princ-to-string ergebnis) "")))
(if ergebnis
(progn
(setq anzahl-ok (1+ anzahl-ok))
@@ -266,10 +306,14 @@
(princ (strcat "\n Aufgebaut: " (itoa anzahl-ok)
" OK, " (itoa anzahl-fehler) " Fehler"))
(princ "\n================================================================")
(dbgmsg (strcat "Aufgebaut: " (itoa anzahl-ok)
" OK, " (itoa anzahl-fehler) " Fehler"))
(setq *omniflo-strecke-test-results* (reverse results-list))
(ssg-end)
(dbgreturn (list anzahl-ok anzahl-fehler))
(if *omniflo-strecke-dbg* (dbgclose))
(princ "\n TEST_OMNIFLO_STRECKE abgeschlossen.")
(princ)
+42 -134
View File
@@ -1,194 +1,102 @@
[
{
"seq": 1,
"gruppe": "gerade_start",
"gruppe": "gerade_unten",
"type": "gerade",
"profil": "AP110",
"laenge": 1000.0,
"x": 0.0,
"x": 2000.0,
"y": 0.0,
"drehung": 0.0,
"x_ende": 1000.0,
"x_ende": 3000.0,
"y_ende": 0.0,
"drehung_ende": 0.0,
"hoehe": 2000,
"id": "0003",
"description": "Gerade AP110 L=1000"
},
{
"seq": 2,
"gruppe": "gerade_start",
"gruppe": "gerade_unten",
"type": "gerade",
"profil": "AP110",
"laenge": 1000.0,
"x": 1000.0,
"x": 3000.0,
"y": 0.0,
"drehung": 0.0,
"x_ende": 2000.0,
"x_ende": 4000.0,
"y_ende": 0.0,
"drehung_ende": 0.0,
"hoehe": 2000,
"id": "0004",
"description": "Gerade AP110 L=1000"
},
{
"seq": 3,
"gruppe": "gerade_start",
"gruppe": "gerade_oben",
"type": "gerade",
"profil": "AP110",
"laenge": 1000.0,
"x": 2000.0,
"y": 0.0,
"drehung": 0.0,
"x": 4000.0,
"y": 990.34,
"drehung": 180.0,
"x_ende": 3000.0,
"y_ende": 0.0,
"drehung_ende": 0.0,
"y_ende": 990.34,
"hoehe": 2000,
"id": "0005",
"description": "Gerade AP110 L=1000"
},
{
"seq": 4,
"gruppe": "gerade_start",
"gruppe": "gerade_oben",
"type": "gerade",
"profil": "AP110",
"laenge": 1000.0,
"x": 3000.0,
"y": 0.0,
"drehung": 0.0,
"x_ende": 4000.0,
"y_ende": 0.0,
"drehung_ende": 0.0,
"y": 990.34,
"drehung": 180.0,
"x_ende": 2000.0,
"y_ende": 990.34,
"hoehe": 2000,
"id": "0006",
"description": "Gerade AP110 L=1000"
},
{
"seq": 5,
"gruppe": "kurve_180",
"gruppe": "bogen",
"type": "bogen",
"sivasnr": "821104021",
"sivasnr": "821104022",
"radius": 400.0,
"winkel": 45.0,
"x": 4000.0,
"y": 0.0,
"winkel": 90.0,
"x": 4511.47,
"y": 996.48,
"drehung": 0.0,
"x_ende": 4282.84,
"y_ende": 117.16,
"drehung_ende": 45.0,
"x_mitte": 4000.0,
"y_mitte": 400.0,
"hoehe": 2000,
"description": "APB 110 R 400/45 - 400/670 (1/4)"
"id": "0009",
"description": "APB 110 R 400/90 - 500/500"
},
{
"seq": 6,
"gruppe": "kurve_180",
"gruppe": "bogen",
"type": "bogen",
"sivasnr": "821104021",
"sivasnr": "821104022",
"radius": 400.0,
"winkel": 45.0,
"x": 4282.84,
"y": 117.16,
"drehung": 45.0,
"x_ende": 4400.0,
"y_ende": 400.0,
"drehung_ende": 90.0,
"x_mitte": 4000.0,
"y_mitte": 400.0,
"winkel": 90.0,
"x": 4505.41,
"y": -4.52,
"drehung": 270.0,
"hoehe": 2000,
"description": "APB 110 R 400/45 - 400/670 (2/4)"
"id": "0010",
"description": "APB 110 R 400/90 - 500/500"
},
{
"seq": 7,
"gruppe": "kurve_180",
"gruppe": "weiche",
"type": "bogen",
"sivasnr": "821104021",
"radius": 400.0,
"winkel": 45.0,
"x": 4400.0,
"y": 400.0,
"sivasnr": "834372100",
"x": 1660.0,
"y": 980.0,
"drehung": 90.0,
"x_ende": 4282.84,
"y_ende": 682.84,
"drehung_ende": 135.0,
"x_mitte": 4000.0,
"y_mitte": 400.0,
"hoehe": 2000,
"description": "APB 110 R 400/45 - 400/670 (3/4)"
},
{
"seq": 8,
"gruppe": "kurve_180",
"type": "bogen",
"sivasnr": "821104021",
"radius": 400.0,
"winkel": 45.0,
"x": 4282.84,
"y": 682.84,
"drehung": 135.0,
"x_ende": 4000.0,
"y_ende": 800.0,
"drehung_ende": 180.0,
"x_mitte": 4000.0,
"y_mitte": 400.0,
"hoehe": 2000,
"description": "APB 110 R 400/45 - 400/670 (4/4)"
},
{
"seq": 9,
"gruppe": "gerade_ende",
"type": "gerade",
"profil": "AP110",
"laenge": 1000.0,
"x": 4000.0,
"y": 800.0,
"drehung": 180.0,
"x_ende": 3000.0,
"y_ende": 800.0,
"drehung_ende": 180.0,
"hoehe": 2000,
"description": "Gerade AP110 L=1000"
},
{
"seq": 10,
"gruppe": "gerade_ende",
"type": "gerade",
"profil": "AP110",
"laenge": 1000.0,
"x": 3000.0,
"y": 800.0,
"drehung": 180.0,
"x_ende": 2000.0,
"y_ende": 800.0,
"drehung_ende": 180.0,
"hoehe": 2000,
"description": "Gerade AP110 L=1000"
},
{
"seq": 11,
"gruppe": "gerade_ende",
"type": "gerade",
"profil": "AP110",
"laenge": 1000.0,
"x": 2000.0,
"y": 800.0,
"drehung": 180.0,
"x_ende": 1000.0,
"y_ende": 800.0,
"drehung_ende": 180.0,
"hoehe": 2000,
"description": "Gerade AP110 L=1000"
},
{
"seq": 12,
"gruppe": "gerade_ende",
"type": "gerade",
"profil": "AP110",
"laenge": 1000.0,
"x": 1000.0,
"y": 800.0,
"drehung": 180.0,
"x_ende": 0.0,
"y_ende": 800.0,
"drehung_ende": 180.0,
"hoehe": 2000,
"description": "Gerade AP110 L=1000"
"id": "0011",
"description": "Omniflo Doppelweiche S D 45-350/700"
}
]
]