From 46afb33b0bee3cad40b2cf7e937ba8168e14f08d Mon Sep 17 00:00:00 2001 From: Michael Stangl Date: Wed, 7 Oct 2026 20:55:58 +0200 Subject: [PATCH] [ADD] Kreisel-Drehrichtung (DREHRICHTUNG) per JSON steuerbar: kreisel-insert-script bekommt optionalen 6. Parameter drehrichtung (GUZ/UZS), hundm05:bau-kreisel liest ihn aus dem Testdaten-JSON aus. Showroom ILS: Kreisel_Showroom_02/03/05 GUZ, Kreisel_Showroom_01/06 UZS eingetragen. Doku (lisp_methods.md, json-input-lisp.md) nachgezogen. Co-Authored-By: Claude Sonnet 5 --- Lisp/KreiselInsert.lsp | 22 +++++++++++++--------- doc/json-input-lisp.md | 5 ++++- doc/lisp_methods.md | 3 ++- tests/test_hundm05.lsp | 9 +++++---- tests/testdata/showroom_ils.json | 5 +++++ 5 files changed, 29 insertions(+), 15 deletions(-) diff --git a/Lisp/KreiselInsert.lsp b/Lisp/KreiselInsert.lsp index a2b2c40..7625716 100644 --- a/Lisp/KreiselInsert.lsp +++ b/Lisp/KreiselInsert.lsp @@ -691,21 +691,25 @@ ;; ============================================================ ;; Kreisel per Script einfuegen (Insert) -;; pt : Einfuegepunkt (x y z) -;; abstand : Abstand in mm -;; rotation : Drehwinkel in Grad -;; typ : Kreiselart ("STANDARD", "PIN", ...) -;; hoehe : Hoehe in mm (oder nil fuer Z aus pt) +;; pt : Einfuegepunkt (x y z) +;; abstand : Abstand in mm +;; rotation : Drehwinkel in Grad +;; typ : Kreiselart ("STANDARD", "PIN", ...) +;; hoehe : Hoehe in mm (oder nil fuer Z aus pt) +;; drehrichtung : "GUZ"/"UZS" (optional, nil -> Default aus *kreisel-attrib-defs*) ;; Rueckgabe: Entity-Name des erzeugten Blocks oder nil -(defun kreisel-insert-script (pt abstand rotation typ hoehe / z blockEnt) +(defun kreisel-insert-script (pt abstand rotation typ hoehe drehrichtung + / z blockEnt attribs) (ssg-start (ssg-text "kreisel-start-script-insert") '(("OSMODE") ("CECOLOR"))) (if (null typ) (setq typ "STANDARD")) (setq z (if hoehe hoehe (if (and pt (caddr pt)) (caddr pt) *kreisel-default-hoehe*))) + (setq attribs (list (cons "KREISELART" typ) + (cons "HOEHE" (rtos z 2 0)))) + (if drehrichtung + (setq attribs (cons (cons "DREHRICHTUNG" drehrichtung) attribs))) (setq blockEnt - (draw-module (list (car pt) (cadr pt) z) abstand rotation - (list (cons "KREISELART" typ) - (cons "HOEHE" (rtos z 2 0))))) + (draw-module (list (car pt) (cadr pt) z) abstand rotation attribs)) (ssg-end) blockEnt ) diff --git a/doc/json-input-lisp.md b/doc/json-input-lisp.md index 1c90257..da5fc03 100644 --- a/doc/json-input-lisp.md +++ b/doc/json-input-lisp.md @@ -82,9 +82,12 @@ Block `KREISEL_n`, gebaut von `KreiselInsert.lsp`. | `abstand` | ja | Mittenabstand Antriebsrad - Spannrad | `kreisel.default_laenge` (2300) | | `rotation` | nein | Drehung der Achse AN -> SP, frei (kein Raster) | 0.0 | | `typ` | nein | `"STANDARD"` oder `"PIN"` -> Attribut `KREISELART` | `"STANDARD"` | +| `drehrichtung` | nein | `"GUZ"` oder `"UZS"` -> Attribut `DREHRICHTUNG` | `"UZS"` | Treiber: `kreisel:run-insert-test` (`test_kreisel.lsp`), `mubea:build-kreisel`, -`hundm05:bau-kreisel` (auch fuer `dematic_arvato.json`). +`hundm05:bau-kreisel` (auch fuer `dematic_arvato.json`/`showroom_ils.json`). +Nur `hundm05:bau-kreisel` liest `drehrichtung` aus und reicht sie an +`kreisel-insert-script` weiter; `mubea:build-kreisel` setzt es (noch) nicht um. ### 1.2 Connect (Start- und Endpunkt) diff --git a/doc/lisp_methods.md b/doc/lisp_methods.md index 11d78d7..5bb2287 100644 --- a/doc/lisp_methods.md +++ b/doc/lisp_methods.md @@ -38,7 +38,7 @@ Einheiten: mm und Grad. `hz` = Fahrtrichtung in der XY-Ebene, 0 = +X, ## 1. Kreisel und Eckrad (`KreiselInsert.lsp`) -### `kreisel-insert-script (pt abstand rotation typ hoehe)` +### `kreisel-insert-script (pt abstand rotation typ hoehe drehrichtung)` Kreisel an einem freien Punkt. Ruft `draw-module` auf. @@ -49,6 +49,7 @@ Kreisel an einem freien Punkt. Ruft `draw-module` auf. | `rotation` | Drehung der Achse AN -> SP in Grad | | `typ` | `"STANDARD"` oder `"PIN"` (nil = `"STANDARD"`) -> Attribut `KREISELART` | | `hoehe` | Einbauhoehe; nil = Z von `pt`, sonst `*kreisel-default-hoehe*` | +| `drehrichtung` | `"GUZ"`/`"UZS"` -> Attribut `DREHRICHTUNG` (optional, nil = Default `"UZS"` aus `*kreisel-attrib-defs*`) | Rueckgabe: Entity des `KREISEL_n`-Blocks oder nil. Setzt `ssg-start`/`ssg-end` selbst. diff --git a/tests/test_hundm05.lsp b/tests/test_hundm05.lsp index 4ca9f40..bf972ca 100644 --- a/tests/test_hundm05.lsp +++ b/tests/test_hundm05.lsp @@ -78,14 +78,15 @@ ;; Rueckgabe: Ergebnis-Record in derselben Form wie die Ketten, damit ;; vsp-results-schreiben beide in EINE Datei schreibt (unterschieden ueber ;; das Feld "kind"). -(defun hundm05:bau-kreisel (obj / id x y z abstand rotation typ pt ent ed rec) +(defun hundm05:bau-kreisel (obj / id x y z abstand rotation typ drehrichtung pt ent ed rec) (setq id (ssg-val obj "id")) (setq x (ssg-val obj "x") y (ssg-val obj "y") z (ssg-val obj "z") abstand (ssg-val obj "abstand") rotation (ssg-val obj "rotation") - typ (ssg-val obj "typ")) + typ (ssg-val obj "typ") + drehrichtung (ssg-val obj "drehrichtung")) (if (numberp x) (setq x (float x))) (if (numberp y) (setq y (float y))) (if (numberp z) (setq z (float z))) @@ -106,9 +107,9 @@ (princ (strcat "\n [KREISEL] " id " -> (" (rtos x 2 0) ", " (rtos y 2 0) ", " (rtos (if z z 0.0) 2 0) ") A=" (rtos abstand 2 0) " R=" (rtos (if rotation rotation 0.0) 2 1) - " " typ)) + " " typ (if drehrichtung (strcat " " drehrichtung) ""))) (setq ent (kreisel-insert-script pt abstand - (if rotation rotation 0.0) typ z)) + (if rotation rotation 0.0) typ z drehrichtung)) (if ent (progn (setq ed (entget ent)) diff --git a/tests/testdata/showroom_ils.json b/tests/testdata/showroom_ils.json index e6b5f04..69e9c24 100644 --- a/tests/testdata/showroom_ils.json +++ b/tests/testdata/showroom_ils.json @@ -9,6 +9,7 @@ "rotation": 90.0, "typ": "STANDARD", "darstellung": "2D", + "drehrichtung": "UZS", "comment": "aus DXF: Radmitte AN8 (Layer 1ANTR-800) (26997.93, 3466.40) -> SP8 (Layer 1SP-800) (26997.93, 12498.90), Mittenabstand 9032.50, rotation 90.00 Grad; x/y = AN8-Mitte minus Radius. ACHTUNG hoehe=11039.9 ist NICHT belegt: AN8/SP8 sind flache 2D-Symbole auf Z=0 und nur 0 3D-Nachbarn in 3000 mm - zu wenige fuer eine belegbare Hoehe. Hoehe 2226.4 vom Anwender.", "hoehe_quelle": "Anwender" }, @@ -22,6 +23,7 @@ "rotation": 90.0, "typ": "STANDARD", "darstellung": "2D", + "drehrichtung": "GUZ", "comment": "aus DXF: Radmitte AN8 (Layer 1ANTR-800) (26997.93, 13298.90) -> SP8 (Layer 1SP-800) (26997.93, 16298.90), Mittenabstand 3000.00, rotation 90.00 Grad; x/y = AN8-Mitte minus Radius. ACHTUNG hoehe=11039.9 ist NICHT belegt: AN8/SP8 sind flache 2D-Symbole auf Z=0 und nur 0 3D-Nachbarn in 3000 mm - zu wenige fuer eine belegbare Hoehe. Hoehe 2226.4 vom Anwender.", "hoehe_quelle": "Anwender" }, @@ -35,6 +37,7 @@ "rotation": 180.0, "typ": "STANDARD", "darstellung": "2D", + "drehrichtung": "GUZ", "comment": "aus DXF: Radmitte AN8 (Layer 1ANTR-800) (36705.93, 9888.90) -> SP8 (Layer 1SP-800) (29505.93, 9888.90), Mittenabstand 7200.00, rotation 180.00 Grad; x/y = AN8-Mitte minus Radius. ACHTUNG hoehe=11039.9 ist NICHT belegt: AN8/SP8 sind flache 2D-Symbole auf Z=0 und nur 0 3D-Nachbarn in 3000 mm - zu wenige fuer eine belegbare Hoehe. Hoehe 1700.0 vom Anwender.", "hoehe_quelle": "Anwender" }, @@ -48,6 +51,7 @@ "rotation": 0.0, "typ": "STANDARD", "darstellung": "2D", + "drehrichtung": "GUZ", "comment": "aus DXF: Radmitte (manuell AN8) (Layer --kreisel-achse) (27797.93, 16298.90) -> (manuell SP8) (Layer --kreisel-achse) (36705.93, 16298.90), Mittenabstand 8908.00, rotation 0.00 Grad; x/y = AN8-Mitte minus Radius. ACHTUNG hoehe=0.0 ist NICHT belegt: AN8/SP8 sind flache 2D-Symbole auf Z=0 und nur 0 3D-Nachbarn in 3000 mm - zu wenige fuer eine belegbare Hoehe. Hoehe 2226.4 vom Anwender.", "hoehe_quelle": "Anwender" }, @@ -61,6 +65,7 @@ "rotation": 0.0, "typ": "STANDARD", "darstellung": "2D", + "drehrichtung": "UZS", "comment": "aus DXF: Radmitte (manuell AN8) (Layer --kreisel-achse) (28772.93, 13093.90) -> (manuell SP8) (Layer --kreisel-achse) (35305.93, 13093.90), Mittenabstand 6533.00, rotation 0.00 Grad; x/y = AN8-Mitte minus Radius. ACHTUNG hoehe=0.0 ist NICHT belegt: AN8/SP8 sind flache 2D-Symbole auf Z=0 und nur 0 3D-Nachbarn in 3000 mm - zu wenige fuer eine belegbare Hoehe. Hoehe 1970 vom Anwender.", "hoehe_quelle": "Anwender" },