Test für alle Elemente ist jetzt interativ. Man kann jeden Test in einem Reiter offen lassen und ansehen (csv Export aller Files ist dann manuell zu machen), oder auch automatisch schliessen, dafür ist aber der csv Export anschliessend auch mit automatisch.
This commit is contained in:
+31
-25
@@ -24,10 +24,24 @@ import json
|
||||
import sys
|
||||
import os
|
||||
|
||||
from export_blockpatterns import load_patterns, matches_any
|
||||
|
||||
BLOCKPATTERNS = load_patterns()
|
||||
|
||||
|
||||
def load_json(path):
|
||||
with open(path, "r", encoding="utf-8") as f:
|
||||
return json.load(f)
|
||||
"""Laedt JSON, tolerant gegenueber BricsCAD-Ausgaben.
|
||||
|
||||
AutoLISP schreibt export_raw.json (write-line) im ANSI-Codepage des
|
||||
Systems, nicht in UTF-8 - Sonderzeichen (z.B. Gradzeichen) koennen
|
||||
daher nicht als UTF-8 dekodierbar sein. Fallback auf cp1252.
|
||||
"""
|
||||
try:
|
||||
with open(path, "r", encoding="utf-8") as f:
|
||||
return json.load(f)
|
||||
except UnicodeDecodeError:
|
||||
with open(path, "r", encoding="cp1252") as f:
|
||||
return json.load(f)
|
||||
|
||||
|
||||
def build_lookup(boegen, weichen):
|
||||
@@ -106,7 +120,7 @@ def build_kreisel_details(block):
|
||||
|
||||
|
||||
# --- Bekannte Bloecke ignorieren ---
|
||||
SKIP_BLOCKS = {"K1", "K2", "K3", "K4", "KS_EIN", "KS_AUS"}
|
||||
SKIP_BLOCKS = set(BLOCKPATTERNS.get("pattern_ks_subblocks", ["K1", "K2", "K3", "K4", "KS_EIN", "KS_AUS"]))
|
||||
|
||||
# Sivas-Nummern und Bezeichnungen je ILS-Elementtyp
|
||||
ILS_SIVASNR = {
|
||||
@@ -118,13 +132,6 @@ ILS_SIVASNR = {
|
||||
"automation": ("6269", "ILS 2.0 Automation und Pneumatik - Gesamtanlage"),
|
||||
}
|
||||
|
||||
# Strecken-Module: Blocknamen-Fragmente fuer Vario/Staustrecke-Elemente
|
||||
STRECKE_BLOCKS = {
|
||||
"AUS_Element_links", "EIN_Element_links",
|
||||
"Staustrecke_SP_1000_mm", "Staustrecke_Separator_SP_300_mm",
|
||||
"Vario_Spannstation_SP_500mm", "Vario_Motorstation_SP_500mm",
|
||||
}
|
||||
|
||||
|
||||
def process_blocks(blocks, lookup):
|
||||
"""
|
||||
@@ -212,7 +219,7 @@ def process_blocks(blocks, lookup):
|
||||
continue
|
||||
|
||||
# --- Omniflo Gerade (AP110) ---
|
||||
if "AP110" in bname.upper() or "AP_110" in bname.upper():
|
||||
if matches_any(bname, BLOCKPATTERNS.get("pattern_gerade", [])):
|
||||
attribs = block.get("attribs", {})
|
||||
artinr = attribs.get("ARTINR", "")
|
||||
key = artinr if artinr else "AP110"
|
||||
@@ -235,8 +242,15 @@ def process_blocks(blocks, lookup):
|
||||
counters["gesamtlaenge_ap110"] += laenge
|
||||
continue
|
||||
|
||||
# --- ILS Eckrad (vor Kreisel pruefen: pattern_kreisel schliesst
|
||||
# ECKRAD_* mit ein, pattern_eckrad ist die praezisere Teilmenge) ---
|
||||
if matches_any(bname, BLOCKPATTERNS.get("pattern_eckrad", [])):
|
||||
counters["anzahl_eckraeder"] += 1
|
||||
eckrad_ids.append(get_id(block))
|
||||
continue
|
||||
|
||||
# --- ILS Kreisel ---
|
||||
if bname.startswith("KR_") or bname.startswith("KREISEL_"):
|
||||
if matches_any(bname, BLOCKPATTERNS.get("pattern_kreisel", [])):
|
||||
kreisel_list.append(block)
|
||||
attribs = block.get("attribs", {})
|
||||
counters["anzahl_kreisel"] += 1
|
||||
@@ -255,14 +269,8 @@ def process_blocks(blocks, lookup):
|
||||
counters["anzahl_streckengruppen"] = 1
|
||||
continue
|
||||
|
||||
# --- ILS Eckrad ---
|
||||
if bname.startswith("ECKRAD_"):
|
||||
counters["anzahl_eckraeder"] += 1
|
||||
eckrad_ids.append(get_id(block))
|
||||
continue
|
||||
|
||||
# --- VarioFoerderer Compound-Block (VF_N) ---
|
||||
if bname.startswith("VF_"):
|
||||
if matches_any(bname, BLOCKPATTERNS.get("pattern_variofoerderer", [])):
|
||||
attribs = block.get("attribs", {})
|
||||
counters["anzahl_variofoerderer"] += 1
|
||||
strecke_ids.append(get_id(block))
|
||||
@@ -283,7 +291,7 @@ def process_blocks(blocks, lookup):
|
||||
continue
|
||||
|
||||
# --- Gefaellestrecke Compound-Block (GF_N) ---
|
||||
if bname.startswith("GF_"):
|
||||
if matches_any(bname, BLOCKPATTERNS.get("pattern_gefaellestrecke", [])):
|
||||
attribs = block.get("attribs", {})
|
||||
counters["anzahl_variofoerderer"] += 1
|
||||
counters["anzahl_gefaellestrecken"] += 1
|
||||
@@ -305,11 +313,9 @@ def process_blocks(blocks, lookup):
|
||||
continue
|
||||
|
||||
# --- ILS Strecke-Module (Vario/Staustrecke, einzelne Komponenten in Modelspace) ---
|
||||
for sb in STRECKE_BLOCKS:
|
||||
if sb in bname:
|
||||
counters["anzahl_variofoerderer"] += 1
|
||||
strecke_ids.append(get_id(block))
|
||||
break
|
||||
if matches_any(bname, BLOCKPATTERNS.get("pattern_strecke_module", [])):
|
||||
counters["anzahl_variofoerderer"] += 1
|
||||
strecke_ids.append(get_id(block))
|
||||
|
||||
# --- Zeilen aufbauen ---
|
||||
items = []
|
||||
|
||||
Reference in New Issue
Block a user