changes to the layer system

This commit is contained in:
2025-12-08 07:28:56 +01:00
parent d0d8880dc0
commit 9efee64c1e
3 changed files with 82 additions and 77 deletions
+11 -11
View File
@@ -183,11 +183,12 @@ def import_block(block_name: str, from_doc, to_doc, winkel = None) -> None:
if att_def != {}:
return att_def
def dreh_block(block_name: str, to_doc, winkel) :
def dreh_block(block_name: str, to_doc,lib_doc, winkel) :
"""Nimmt ein schon importierten Block und erstellt einen neuen der an der y_axis gedreht wird
hauptsächlich für vario Bogen aktuell verwendet
"""
dreh_block_name = block_name +f"_{math.degrees(winkel)}"
layer, color = get_insert_color_layer(lib_doc,block_name)
if (dreh_block_name in to_doc.blocks):
return dreh_block_name
block_zwischen = to_doc.blocks.new(name=block_name + f"zwischenschrit_{winkel}", base_point=(0,0,0))
@@ -197,7 +198,7 @@ def dreh_block(block_name: str, to_doc, winkel) :
else:
rotation_matrix = Matrix44.axis_rotate(Y_AXIS, winkel)
block_zwischen.add_blockref(block_name,(0,0,0))
block_zwischen.add_blockref(block_name,(0,0,0),dxfattribs={"layer":layer,"color": color})
for e in block_zwischen:
copy = e.copy()
copy.transform(rotation_matrix)
@@ -292,6 +293,7 @@ def handle_ils_2_0_gefaellestrecke(msp, teileid, merkmale, x, y, doc, lib_doc, v
start = x +dx, y + dy,upper_hoehe_gefaehlle
if "6-SP" not in doc.layers:
doc.layers.add(name="6-SP", color=7)
gefaelle_layer = "6-SP"
verbunden_am_einen = False
richtung2 ="DEFAULT"
@@ -400,7 +402,7 @@ def handle_ils_2_0_gefaellestrecke(msp, teileid, merkmale, x, y, doc, lib_doc, v
line = Line.new(dxfattribs={"start":start,"end":ende})
line.translate(-x,-y,-hoehe_gefaehlle)
block.add_entity(line)
msp.add_blockref(blockname,(x,y,hoehe_gefaehlle),dxfattribs={"rotation": rotation})
msp.add_blockref(blockname,(x,y,hoehe_gefaehlle),dxfattribs={"rotation": rotation,"layer": gefaelle_layer})
return
if upper_hoehe_gefaehlle == hoehe0:
hight ="higher"
@@ -412,7 +414,7 @@ def handle_ils_2_0_gefaellestrecke(msp, teileid, merkmale, x, y, doc, lib_doc, v
blockname = f"Ils_2.0_Gefaellestrecke_{laenge}_{drehung0}_{hoehe_gefaehlle}_{verbunden_am_einen}_{hight}_{hat_umlenk_0}_{hat_motor_0}_{tefkurve_0}"
if blockname in doc.blocks:
bref =msp.add_blockref(blockname,(x,y,hoehe_gefaehlle),dxfattribs={"rotation": rotation})
bref =msp.add_blockref(blockname,(x,y,hoehe_gefaehlle),dxfattribs={"rotation": rotation,"layer": gefaelle_layer})
a =bref.add_attrib(
tag= "NAME",
text= merkmale.get("bezeichner"),
@@ -448,7 +450,7 @@ def handle_ils_2_0_gefaellestrecke(msp, teileid, merkmale, x, y, doc, lib_doc, v
only_es_or_as = as_es_methoden.erstellung_gefaelle_block_verbunenden_am_einen(msp,x, y, doc, lib_doc, upper_hoehe_gefaehlle, lower_hoehe_gefaehlle, hoehe_gefaehlle, drehung0, laenge, blockname,config,hight,None,None,None,block,start,ende)
if only_es_or_as == False:
bref =msp.add_blockref(blockname,(x,y,hoehe_gefaehlle),dxfattribs={"rotation": rotation})
bref =msp.add_blockref(blockname,(x,y,hoehe_gefaehlle),dxfattribs={"rotation": rotation,"layer": gefaelle_layer})
a =bref.add_attrib(
tag= "NAME",
text= merkmale.get("bezeichner"),
@@ -594,9 +596,7 @@ def handle_ils_2_0_gefaellestrecke(msp, teileid, merkmale, x, y, doc, lib_doc, v
else:
blockname = f"Ils_2.0_Gefaellestrecke_{laenge}_{hoehe_gefaehlle}_{drehung0}_{drehung1}_{hight_position}_{unterschiedlich}_{richtung2}_{verbunden_am_einen}"
as_es_methoden.gefaellegerade_erstellung(x, y, doc, lib_doc, upper_hoehe_gefaehlle, lower_hoehe_gefaehlle, hoehe_gefaehlle,richtung2,drehung0, drehung1, laenge, hight_position,blockname,config)
blockref_layer, color = get_insert_color_layer(lib_doc, blockname)
bref =msp.add_blockref(blockname,(x,y,hoehe_gefaehlle),dxfattribs={"rotation": rotation, "layer": blockref_layer })
bref =msp.add_blockref(blockname,(x,y,hoehe_gefaehlle),dxfattribs={"rotation": rotation, "layer": gefaelle_layer})
a = bref.add_attrib(
tag= "NAME",
text= merkmale.get("bezeichner"),
@@ -640,7 +640,7 @@ def handle_ils_2_0_gefaellestrecke(msp, teileid, merkmale, x, y, doc, lib_doc, v
line = Line.new(dxfattribs={"start":start,"end":ende})
line.translate(-x,-y,-hoehe_gefaehlle)
block.add_entity(line)
msp.add_blockref(blockname,(x,y,hoehe_gefaehlle),dxfattribs={"rotation": rotation})
msp.add_blockref(blockname,(x,y,hoehe_gefaehlle),dxfattribs={"rotation": rotation,"layer": gefaelle_layer})
elif hat_motor_0 == None and hat_umlenk_0 == True and tefkurve_1 == None:
if blockname not in doc.blocks:
block = doc.blocks.new(name=blockname,base_point = (0,0,0))
@@ -652,7 +652,7 @@ def handle_ils_2_0_gefaellestrecke(msp, teileid, merkmale, x, y, doc, lib_doc, v
line = Line.new(dxfattribs={"start":start,"end":ende})
line.translate(-x,-y,-hoehe_gefaehlle)
block.add_entity(line)
msp.add_blockref(blockname,(x,y,hoehe_gefaehlle),dxfattribs={"rotation": rotation})
msp.add_blockref(blockname,(x,y,hoehe_gefaehlle),dxfattribs={"rotation": rotation,"layer": gefaelle_layer})
else:
if blockname not in doc.blocks:
block = doc.blocks.new(name=blockname,base_point = (0,0,0))
@@ -669,7 +669,7 @@ def handle_ils_2_0_gefaellestrecke(msp, teileid, merkmale, x, y, doc, lib_doc, v
line = Line.new(dxfattribs={"start":start,"end":ende})
line.translate(-x,-y,-hoehe_gefaehlle)
block.add_entity(line)
msp.add_blockref(blockname,(x,y,hoehe_gefaehlle),dxfattribs={"rotation": rotation})
msp.add_blockref(blockname,(x,y,hoehe_gefaehlle),dxfattribs={"rotation": rotation,"layer": gefaelle_layer})