Code Anpassung. Rack Namen werden nicht mehr überschrieben. Zeichenen des Graphen mit easy korrekt.
This commit is contained in:
+10
-7
@@ -57,7 +57,7 @@ def new_dxf(plines, out_path):
|
||||
def modify_original_dxf(plines, originaldxf):
|
||||
""" adds new layer to original .dxf-file that contains cables
|
||||
"""
|
||||
print("adding cables to original .dxf")
|
||||
print("adding cables to original .dxf ..")
|
||||
|
||||
doc = ezdxf.readfile(originaldxf)
|
||||
create_cables(plines, doc)
|
||||
@@ -66,13 +66,13 @@ def modify_original_dxf(plines, originaldxf):
|
||||
print("done")
|
||||
|
||||
|
||||
def copy_layers_into_new(originaldxf, outpath):
|
||||
def copy_layers_into_new(originaldxf, outpath, plines):
|
||||
""" creates a new dxf file with a racks, sensors, subdists from original file including cable paths
|
||||
"""
|
||||
print("copying layers from original .dxf into new .dxf")
|
||||
print("copying layers from original .dxf into new .dxf ..")
|
||||
|
||||
quelle = ezdxf.readfile(originaldxf)
|
||||
ziel = ezdxf.readfile(outpath)
|
||||
ziel = ezdxf.new('R2018', setup=True)
|
||||
|
||||
copy_layers_into_dxf_by_filter(quelle, ziel)
|
||||
create_cables(plines, quelle)
|
||||
@@ -272,6 +272,7 @@ def copy_layers_into_dxf_by_filter(dxf_source: ezdxf.document.Drawing, dxf_targe
|
||||
if style.dxf.name not in dxf_target.styles:
|
||||
dxf_target.styles.new(name=style.dxf.name)
|
||||
|
||||
'''
|
||||
# 2. alle Blockdefinitionen kopieren die benötigt werden
|
||||
used_blocks = {ins.dxf.name for ins in msp_source.query("INSERT")}
|
||||
for name in used_blocks:
|
||||
@@ -284,12 +285,14 @@ def copy_layers_into_dxf_by_filter(dxf_source: ezdxf.document.Drawing, dxf_targe
|
||||
# **ALLE** Entities im Block kopieren
|
||||
for ent in src_block:
|
||||
new_block.add_entity(ent.copy())
|
||||
|
||||
|
||||
|
||||
# 3. Jetzt die INSERTs in den Modelspace kopieren
|
||||
for ins in msp_source.query("INSERT"):
|
||||
new_ins = ins.copy()
|
||||
msp_target.add_entity(new_ins)
|
||||
|
||||
|
||||
'''
|
||||
|
||||
# 4. Filter-Layernamen bestimmen
|
||||
for layername in layernames:
|
||||
@@ -372,7 +375,7 @@ if __name__ == '__main__':
|
||||
out_path = os.path.join(work_dir, args.copy_layer)
|
||||
res_pos = new_dxf(plines, out_path)
|
||||
|
||||
copy_layers_into_new(origin_path, out_path)
|
||||
copy_layers_into_new(origin_path, out_path, plines)
|
||||
|
||||
if args.new:
|
||||
# erzeuge dxf Datei nur mit Kabeln
|
||||
|
||||
Reference in New Issue
Block a user