Files
dxfmakros/tests/create_ILStest_dxf.py
T

45 lines
1.4 KiB
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
create_ILStest_dxf.py - Erzeugt die Basis-DXF fuer den ILS-Test.
Erstellt 4 Linien als Grundlage fuer KreiselConnect:
- 2 horizontale Linien, 5000mm Abstand, je 2000mm lang, ab (0,0,2500)
- 2 vertikale Linien, 5000mm Abstand, je 2000mm lang, ab (0,0,2500)
"""
import ezdxf
import sys
import os
def create_ils_test_dxf(output_path):
doc = ezdxf.new("R2018")
msp = doc.modelspace()
z = 2500.0
# Horizontale Linienpaare (Abstand 5000mm in Y-Richtung)
# H1: (0,0,2500) -> (2000,0,2500)
msp.add_line((0, 0, z), (2000, 0, z), dxfattribs={"layer": "S_LP", "color": 1})
# H2: (0,5000,2500) -> (2000,5000,2500)
msp.add_line((0, 5000, z), (2000, 5000, z), dxfattribs={"layer": "S_LP", "color": 1})
# Vertikale Linienpaare (Abstand 5000mm in X-Richtung)
# V1: (0,0,2500) -> (0,2000,2500)
msp.add_line((0, 0, z), (0, 2000, z), dxfattribs={"layer": "S_LP", "color": 1})
# V2: (5000,0,2500) -> (5000,2000,2500)
msp.add_line((5000, 0, z), (5000, 2000, z), dxfattribs={"layer": "S_LP", "color": 1})
doc.saveas(output_path)
print(f"[ILStest] DXF erstellt: {output_path}")
return output_path
if __name__ == "__main__":
if len(sys.argv) > 1:
out = sys.argv[1]
else:
out = os.path.join(os.getenv("DXFM_TESTS", "tests"), "ILStest.dxf")
create_ils_test_dxf(out)