Kreisel Script-Funktionen und flaches JSON-Testformat
- kreisel-insert-script und kreisel-connect-script in KreiselInsert.lsp fuer nicht-interaktives Einfuegen (Tests, Automatisierung) - kreisel_tests.json von verschachteltem auf flaches JSON-Array umgestellt (kompatibel mit omni:load-json) - test_kreisel.py an neues JSON-Format angepasst (direkte Felder statt nested expect/attributes) - conftest.py: Leere kreisel_results.json wird jetzt korrekt uebersprungen Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -638,6 +638,59 @@
|
||||
)
|
||||
|
||||
|
||||
;; ============================================================
|
||||
;; Script-Funktionen (ohne User-Interaktion, fuer Tests)
|
||||
;; ============================================================
|
||||
|
||||
;; 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)
|
||||
;; Rueckgabe: Entity-Name des erzeugten Blocks oder nil
|
||||
(defun kreisel-insert-script (pt abstand rotation typ hoehe / z blockEnt)
|
||||
(ssg-start "Kreisel 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 blockEnt
|
||||
(draw-module (list (car pt) (cadr pt) z) abstand rotation
|
||||
(list (cons "KREISELART" typ)
|
||||
(cons "HOEHE" (rtos z 2 0)))))
|
||||
(ssg-end)
|
||||
blockEnt
|
||||
)
|
||||
|
||||
;; Kreisel per Script einfuegen (Connect: Start- zu Endpunkt)
|
||||
;; ptStart : Startpunkt (x y z)
|
||||
;; ptEnd : Endpunkt (x y z)
|
||||
;; typ : Kreiselart ("STANDARD", "PIN", ...)
|
||||
;; hoehe : Hoehe in mm (oder nil fuer Z aus ptStart)
|
||||
;; Rueckgabe: Entity-Name des erzeugten Blocks oder nil
|
||||
(defun kreisel-connect-script (ptStart ptEnd typ hoehe / dx dy dist abstand rotation z blockEnt)
|
||||
(ssg-start "Kreisel Script Connect" '(("OSMODE") ("CECOLOR")))
|
||||
(if (null typ) (setq typ "STANDARD"))
|
||||
(setq dx (- (car ptEnd) (car ptStart))
|
||||
dy (- (cadr ptEnd) (cadr ptStart)))
|
||||
(setq dist (sqrt (+ (* dx dx) (* dy dy))))
|
||||
(setq abstand (- dist *kreisel-durchmesser*))
|
||||
(if (<= abstand 0.0)
|
||||
(progn (princ (strcat "\n[Connect] Distanz zu klein: " (rtos dist 2 0)))
|
||||
(ssg-end) nil)
|
||||
(progn
|
||||
(setq rotation (* (/ 180.0 pi) (atan dy dx)))
|
||||
(setq z (if hoehe hoehe
|
||||
(if (and ptStart (caddr ptStart)) (caddr ptStart) *kreisel-default-hoehe*)))
|
||||
(setq blockEnt
|
||||
(draw-module (list (car ptStart) (cadr ptStart) z) abstand rotation
|
||||
(list (cons "KREISELART" typ)
|
||||
(cons "HOEHE" (rtos z 2 0)))))
|
||||
(ssg-end) blockEnt))
|
||||
)
|
||||
;; Ende kreisel-connect-script
|
||||
|
||||
|
||||
;; Neue Befehle für Beschriftungs-Einstellungen
|
||||
(defun c:KreiselLabelPos ( / dx dy)
|
||||
(setq dx (getreal (strcat "\nX-Abstand von AN8-Mitte <" (rtos *kreisel-beschriftung-abstand-x* 2 0) ">: ")))
|
||||
|
||||
Reference in New Issue
Block a user