Ids werden jetzt in Bricscad von einer Lisp Funktion in Form einer aufsteigenden Nummer erzeugt
This commit is contained in:
+24
-24
@@ -140,13 +140,9 @@
|
|||||||
;; csv-name = Ergebnis-CSV-Name (z.B. "export.csv")
|
;; csv-name = Ergebnis-CSV-Name (z.B. "export.csv")
|
||||||
(defun csv:run-export (label py-name csv-name / ss i ename fh out-pfad
|
(defun csv:run-export (label py-name csv-name / ss i ename fh out-pfad
|
||||||
py-skript ergebnis-pfad cmd first-block count)
|
py-skript ergebnis-pfad cmd first-block count)
|
||||||
;; Vor dem Export: Doppelte IDs pruefen und korrigieren
|
;; Vor dem Export: IDs aller Bloecke sicherstellen und Duplikate korrigieren
|
||||||
(if (atoms-family 1 '("ssg-id-check-all"))
|
(princ (strcat "\n[" label "] Pruefe und vergebe IDs..."))
|
||||||
(progn
|
(ssg-id-check-all)
|
||||||
(princ (strcat "\n[" label "] Pruefe IDs auf Duplikate..."))
|
|
||||||
(ssg-id-check-all)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
;; Vor dem Export HOEHE/DREHUNG aller Omniflo-Elemente aktualisieren
|
;; Vor dem Export HOEHE/DREHUNG aller Omniflo-Elemente aktualisieren
|
||||||
(princ (strcat "\n[" label "] Aktualisiere Hoehe/Drehung..."))
|
(princ (strcat "\n[" label "] Aktualisiere Hoehe/Drehung..."))
|
||||||
(omni:update-all-attribs)
|
(omni:update-all-attribs)
|
||||||
@@ -351,17 +347,6 @@
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
;; --- CSV-Zeile fuer ein Omniflo-Element bauen ---
|
|
||||||
(defun csv:omni-csv-line (elem-nr teileart bezeichnung merkmale-json)
|
|
||||||
(strcat (itoa elem-nr)
|
|
||||||
";\"" teileart "\""
|
|
||||||
";\"shape_" (substr (rtos (* (getvar "CDATE") 1000000.0) 2 0) 1 8)
|
|
||||||
(substr (rtos (* (getvar "TDUSRTIMER") 1000000.0) 2 0) 1 8) "\""
|
|
||||||
";\"" bezeichnung "\""
|
|
||||||
";1"
|
|
||||||
";" merkmale-json)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
;; ============================================================
|
;; ============================================================
|
||||||
;; C:OMNI_EXPORT - Omniflo-Elemente zaehlen und als CSV exportieren
|
;; C:OMNI_EXPORT - Omniflo-Elemente zaehlen und als CSV exportieren
|
||||||
@@ -373,6 +358,9 @@
|
|||||||
len-ap110 len-ap60 laenge-str
|
len-ap110 len-ap60 laenge-str
|
||||||
fh out-pfad lines subtyp merkmale)
|
fh out-pfad lines subtyp merkmale)
|
||||||
|
|
||||||
|
;; Vor dem Export: IDs aller Bloecke sicherstellen und Duplikate korrigieren
|
||||||
|
(princ "\n[OMNI_EXPORT] Pruefe und vergebe IDs...")
|
||||||
|
(ssg-id-check-all)
|
||||||
;; Vor dem Export HOEHE/DREHUNG aller Omniflo-Elemente aktualisieren
|
;; Vor dem Export HOEHE/DREHUNG aller Omniflo-Elemente aktualisieren
|
||||||
(princ "\n[OMNI_EXPORT] Aktualisiere Hoehe/Drehung...")
|
(princ "\n[OMNI_EXPORT] Aktualisiere Hoehe/Drehung...")
|
||||||
(omni:update-all-attribs)
|
(omni:update-all-attribs)
|
||||||
@@ -403,8 +391,12 @@
|
|||||||
(setq cnt-boegen (1+ cnt-boegen))
|
(setq cnt-boegen (1+ cnt-boegen))
|
||||||
(setq merkmale (csv:omni-bogen-merkmale ename rotation))
|
(setq merkmale (csv:omni-bogen-merkmale ename rotation))
|
||||||
(setq lines (cons
|
(setq lines (cons
|
||||||
(csv:omni-csv-line elem-nr "Omniflo Kurve"
|
(strcat (itoa elem-nr)
|
||||||
(strcat "OFBogen :" (itoa cnt-boegen)) merkmale)
|
";\"Omniflo Kurve\""
|
||||||
|
";\"" (or (csv:get-attrib ename "ID") "0000") "\""
|
||||||
|
";\"" (strcat "OFBogen :" (itoa cnt-boegen)) "\""
|
||||||
|
";1"
|
||||||
|
";" merkmale)
|
||||||
lines))
|
lines))
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -421,8 +413,12 @@
|
|||||||
)
|
)
|
||||||
(setq merkmale (csv:omni-weiche-merkmale ename rotation))
|
(setq merkmale (csv:omni-weiche-merkmale ename rotation))
|
||||||
(setq lines (cons
|
(setq lines (cons
|
||||||
(csv:omni-csv-line elem-nr "Omniflo Weiche"
|
(strcat (itoa elem-nr)
|
||||||
(strcat "OFWeiche :" (itoa cnt-weichen)) merkmale)
|
";\"Omniflo Weiche\""
|
||||||
|
";\"" (or (csv:get-attrib ename "ID") "0000") "\""
|
||||||
|
";\"" (strcat "OFWeiche :" (itoa cnt-weichen)) "\""
|
||||||
|
";1"
|
||||||
|
";" merkmale)
|
||||||
lines))
|
lines))
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -437,8 +433,12 @@
|
|||||||
)
|
)
|
||||||
(setq merkmale (csv:omni-gerade-merkmale ename rotation))
|
(setq merkmale (csv:omni-gerade-merkmale ename rotation))
|
||||||
(setq lines (cons
|
(setq lines (cons
|
||||||
(csv:omni-csv-line elem-nr "Omniflo Gerade"
|
(strcat (itoa elem-nr)
|
||||||
(strcat "OFGerade :" (itoa cnt-geraden)) merkmale)
|
";\"Omniflo Gerade\""
|
||||||
|
";\"" (or (csv:get-attrib ename "ID") "0000") "\""
|
||||||
|
";\"" (strcat "OFGerade :" (itoa cnt-geraden)) "\""
|
||||||
|
";1"
|
||||||
|
";" merkmale)
|
||||||
lines))
|
lines))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
+3
-8
@@ -13,7 +13,6 @@ CSV-Format:
|
|||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import uuid
|
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
@@ -35,10 +34,6 @@ def build_lookup(boegen, weichen):
|
|||||||
return lookup
|
return lookup
|
||||||
|
|
||||||
|
|
||||||
def generate_shape_id():
|
|
||||||
return "shape_" + str(uuid.uuid4())
|
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# Merkmale-Builder
|
# Merkmale-Builder
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
@@ -151,7 +146,7 @@ def process_blocks(blocks, lookup):
|
|||||||
if bname in lookup:
|
if bname in lookup:
|
||||||
typ, eintrag = lookup[bname]
|
typ, eintrag = lookup[bname]
|
||||||
elem_nr += 1
|
elem_nr += 1
|
||||||
shape_id = generate_shape_id()
|
shape_id = block.get("attribs", {}).get("ID", "0000")
|
||||||
|
|
||||||
if typ == "bogen":
|
if typ == "bogen":
|
||||||
bogen_count += 1
|
bogen_count += 1
|
||||||
@@ -182,7 +177,7 @@ def process_blocks(blocks, lookup):
|
|||||||
items.append({
|
items.append({
|
||||||
"nr": elem_nr,
|
"nr": elem_nr,
|
||||||
"teileart": "Omniflo Gerade",
|
"teileart": "Omniflo Gerade",
|
||||||
"teileid": generate_shape_id(),
|
"teileid": block.get("attribs", {}).get("ID", "0000"),
|
||||||
"bezeichnung": f"OFGerade :{gerade_count}",
|
"bezeichnung": f"OFGerade :{gerade_count}",
|
||||||
"merkmale": build_gerade_merkmale(block),
|
"merkmale": build_gerade_merkmale(block),
|
||||||
})
|
})
|
||||||
@@ -195,7 +190,7 @@ def process_blocks(blocks, lookup):
|
|||||||
items.append({
|
items.append({
|
||||||
"nr": elem_nr,
|
"nr": elem_nr,
|
||||||
"teileart": "ILS 2.0 Kreisel",
|
"teileart": "ILS 2.0 Kreisel",
|
||||||
"teileid": generate_shape_id(),
|
"teileid": block.get("attribs", {}).get("ID", "0000"),
|
||||||
"bezeichnung": f"Kreisel :{kreisel_count}",
|
"bezeichnung": f"Kreisel :{kreisel_count}",
|
||||||
"merkmale": build_kreisel_merkmale(block),
|
"merkmale": build_kreisel_merkmale(block),
|
||||||
})
|
})
|
||||||
|
|||||||
+3
-8
@@ -15,7 +15,6 @@ Argumente:
|
|||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import uuid
|
|
||||||
|
|
||||||
|
|
||||||
def load_json(path):
|
def load_json(path):
|
||||||
@@ -35,10 +34,6 @@ def build_lookup(boegen, weichen):
|
|||||||
return lookup
|
return lookup
|
||||||
|
|
||||||
|
|
||||||
def generate_shape_id():
|
|
||||||
return "shape_" + str(uuid.uuid4())
|
|
||||||
|
|
||||||
|
|
||||||
def classify_weiche(eintrag):
|
def classify_weiche(eintrag):
|
||||||
"""Bestimmt den Weichen-Subtyp fuer die Omniflo Sum Zaehlung."""
|
"""Bestimmt den Weichen-Subtyp fuer die Omniflo Sum Zaehlung."""
|
||||||
wt = eintrag.get("WeichenTyp", "")
|
wt = eintrag.get("WeichenTyp", "")
|
||||||
@@ -213,7 +208,7 @@ def process_blocks(blocks, lookup):
|
|||||||
if bname in lookup:
|
if bname in lookup:
|
||||||
typ, eintrag = lookup[bname]
|
typ, eintrag = lookup[bname]
|
||||||
elem_nr += 1
|
elem_nr += 1
|
||||||
shape_id = generate_shape_id()
|
shape_id = block.get("attribs", {}).get("ID", "0000")
|
||||||
|
|
||||||
if typ == "bogen":
|
if typ == "bogen":
|
||||||
bogen_count += 1
|
bogen_count += 1
|
||||||
@@ -261,7 +256,7 @@ def process_blocks(blocks, lookup):
|
|||||||
items.append({
|
items.append({
|
||||||
"nr": elem_nr,
|
"nr": elem_nr,
|
||||||
"teileart": "Omniflo Gerade",
|
"teileart": "Omniflo Gerade",
|
||||||
"teileid": generate_shape_id(),
|
"teileid": block.get("attribs", {}).get("ID", "0000"),
|
||||||
"bezeichnung": f"OFGerade :{gerade_count}",
|
"bezeichnung": f"OFGerade :{gerade_count}",
|
||||||
"anzahl": 1,
|
"anzahl": 1,
|
||||||
"merkmale": build_gerade_merkmale(block)
|
"merkmale": build_gerade_merkmale(block)
|
||||||
@@ -276,7 +271,7 @@ def process_blocks(blocks, lookup):
|
|||||||
items.append({
|
items.append({
|
||||||
"nr": elem_nr,
|
"nr": elem_nr,
|
||||||
"teileart": "ILS 2.0 Kreisel",
|
"teileart": "ILS 2.0 Kreisel",
|
||||||
"teileid": generate_shape_id(),
|
"teileid": block.get("attribs", {}).get("ID", "0000"),
|
||||||
"bezeichnung": f"Kreisel :{kreisel_count}",
|
"bezeichnung": f"Kreisel :{kreisel_count}",
|
||||||
"anzahl": 1,
|
"anzahl": 1,
|
||||||
"merkmale": build_kreisel_merkmale(block)
|
"merkmale": build_kreisel_merkmale(block)
|
||||||
|
|||||||
Reference in New Issue
Block a user