Löschen der alten Funktionen nach erfolgreichem Vergleich der Outputs
This commit is contained in:
@@ -138,74 +138,10 @@ def extract_input_positions(insert_iterable) -> tuple:
|
||||
allunknowns[id] = ld
|
||||
|
||||
return allSensors, allCables
|
||||
'''
|
||||
def get_input_positions(msp: ezdxf.document.Drawing.modelspace)-> tuple:
|
||||
"""hole alle Positionen der Eingänge !!Sensor Positionen erst nach Offsett-Addition "Mitte-Mitte"!!
|
||||
"""
|
||||
allSensors = dict()
|
||||
allCables = dict()
|
||||
allunknowns = dict()
|
||||
allSchaltschrank = dict()
|
||||
|
||||
# Über alle Blockreferenzen (INSERT) im Modelspace laufen
|
||||
for insert in msp.query('INSERT'):
|
||||
# Überspringe Blöcke ohne Attribute
|
||||
if len(insert.attribs) == 0:
|
||||
continue
|
||||
|
||||
ld, id, typ = get_attributes_of_insert(insert)
|
||||
|
||||
# Verarbeite je nach Typ
|
||||
if typ == "Sensor":
|
||||
if id and "pos" in ld and isinstance(ld["pos"], tuple) and len(ld["pos"]) == 2:
|
||||
if id in allSensors:
|
||||
allSensors[id] = merge_two_dicts(allSensors[id], ld)
|
||||
else:
|
||||
allSensors[id] = ld
|
||||
elif typ == "Kabel":
|
||||
allCables[id] = ld
|
||||
elif typ == "Schaltschrankelement":
|
||||
allSchaltschrank[id] = ld
|
||||
else:
|
||||
allunknowns[id] = ld
|
||||
|
||||
return allSensors, allCables
|
||||
'''
|
||||
def get_input_positions(msp) -> tuple:
|
||||
return extract_input_positions(msp.query('INSERT'))
|
||||
|
||||
'''
|
||||
def get_input_positions_iter(dxf_path) -> tuple:
|
||||
"""
|
||||
Iterative Version für große DXF-Dateien mit iterdxf
|
||||
"""
|
||||
allSensors = dict()
|
||||
allCables = dict()
|
||||
allunknowns = dict()
|
||||
allSchaltschrank = dict()
|
||||
|
||||
for insert in iterdxf.modelspace(dxf_path):
|
||||
if insert.dxftype() != 'INSERT':
|
||||
continue
|
||||
|
||||
ld, id, typ = get_attributes_of_insert(insert)
|
||||
|
||||
# Nur wenn eine ID vorhanden ist, und eine gültige Position existiert
|
||||
if typ == "Sensor":
|
||||
if id and "pos" in ld and isinstance(ld["pos"], tuple) and len(ld["pos"]) == 2:
|
||||
if id in allSensors:
|
||||
allSensors[id] = merge_two_dicts(allSensors[id], ld) #Kombiniert alle infos aus dxf und "pos"
|
||||
else:
|
||||
allSensors[id] = ld
|
||||
elif typ == "Kabel":
|
||||
allCables[id] = ld
|
||||
elif typ == "Schaltschrankelement":
|
||||
allSchaltschrank[id] = ld
|
||||
else:
|
||||
allunknowns[id] = ld
|
||||
|
||||
return allSensors, allCables
|
||||
'''
|
||||
def get_input_positions_iter(dxf_path) -> tuple:
|
||||
return extract_input_positions(iterdxf.modelspace(dxf_path))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user