debug beim Varioförderer dazu. dbgreturn routine gibt den Wert zurück. neues Test Konzept für unsere lisp Funktionen implementiert
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
create_testbase.py - Erzeugt Basis-DXF-Dateien fuer die LISP-Tests.
|
||||
|
||||
Erstellt pro Modul eine leere DXF mit Hilfsgeometrie (z.B. Linien
|
||||
als Andockpunkte fuer Kreisel).
|
||||
|
||||
Aufruf:
|
||||
python tests/create_testbase.py [modul]
|
||||
python tests/create_testbase.py # alle Module
|
||||
python tests/create_testbase.py kreisel # nur Kreisel
|
||||
"""
|
||||
|
||||
import ezdxf
|
||||
import json
|
||||
import sys
|
||||
import os
|
||||
|
||||
|
||||
TESTS_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
TESTDATA_DIR = os.path.join(TESTS_DIR, "testdata")
|
||||
OUTPUT_DIR = os.path.join(TESTS_DIR, "output")
|
||||
|
||||
|
||||
def create_kreisel_testbase():
|
||||
"""Erzeugt Basis-DXF fuer Kreisel-Tests mit Hilfslinien."""
|
||||
doc = ezdxf.new("R2018")
|
||||
msp = doc.modelspace()
|
||||
|
||||
z = 2500.0
|
||||
|
||||
# Horizontale Linienpaare (Abstand 5000mm in Y-Richtung)
|
||||
msp.add_line((0, 0, z), (2000, 0, z),
|
||||
dxfattribs={"layer": "S_LP", "color": 1})
|
||||
msp.add_line((0, 5000, z), (2000, 5000, z),
|
||||
dxfattribs={"layer": "S_LP", "color": 1})
|
||||
|
||||
# Vertikale Linienpaare (Abstand 5000mm in X-Richtung)
|
||||
msp.add_line((0, 0, z), (0, 2000, z),
|
||||
dxfattribs={"layer": "S_LP", "color": 1})
|
||||
msp.add_line((5000, 0, z), (5000, 2000, z),
|
||||
dxfattribs={"layer": "S_LP", "color": 1})
|
||||
|
||||
os.makedirs(OUTPUT_DIR, exist_ok=True)
|
||||
out_path = os.path.join(OUTPUT_DIR, "kreisel_testbase.dxf")
|
||||
doc.saveas(out_path)
|
||||
print(f"[testbase] Kreisel-Basis-DXF erstellt: {out_path}")
|
||||
return out_path
|
||||
|
||||
|
||||
MODULES = {
|
||||
"kreisel": create_kreisel_testbase,
|
||||
}
|
||||
|
||||
|
||||
def main():
|
||||
if len(sys.argv) > 1:
|
||||
modul = sys.argv[1].lower()
|
||||
if modul not in MODULES:
|
||||
print(f"Unbekanntes Modul: {modul}")
|
||||
print(f"Verfuegbar: {', '.join(MODULES.keys())}")
|
||||
sys.exit(1)
|
||||
MODULES[modul]()
|
||||
else:
|
||||
for name, func in MODULES.items():
|
||||
func()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user