- Created a new Python script `uziom.py` for generating DXF drawings of grounding systems based on user input parameters. - Added detailed documentation in `wet_input_15.docx` and `wet_input_3.docx` for the design of grounding systems, including calculations for resistance and resistivity measurements. - Included placeholders for dynamic data insertion in the documents to facilitate project-specific customization.
198 lines
11 KiB
Python
198 lines
11 KiB
Python
import ezdxf
|
|
import sys
|
|
|
|
args = sys.argv[1:]
|
|
print(args)
|
|
object1 = args[0] #ZK2a-1P
|
|
object2 = args[1] #Budowa
|
|
object3 = args[2] #Przylacze
|
|
adres = args[3]
|
|
date = args[4]
|
|
len_h = int(args[5])
|
|
len_v = float(args[6])
|
|
|
|
|
|
a4_x = 31.5
|
|
a4_y = 44.55
|
|
# len_h = 25
|
|
# len_v = 3
|
|
rod_num = int(((len_h - 1)/(len_v*2)) + 1)
|
|
|
|
zk_width = 0.665
|
|
zk_depth = 0.32
|
|
zk_height = 1.64
|
|
|
|
start_x = ((a4_x - len_h) / 2) + zk_width
|
|
start_y = 28
|
|
|
|
overedge = 0.5
|
|
# date = "06.2023"
|
|
|
|
start_y2 = start_y - 7.5 #drugi uziom
|
|
|
|
doc = ezdxf.new(dxfversion="R2013", setup=False)
|
|
msp = doc.modelspace()
|
|
#doc.layers.add(name="tabele", color=0, linetype="SOLID")
|
|
#doc.layers.add(name="bednarka", color=1, linetype="SOLID")
|
|
#doc.layers.add(name="uziom", color=3, linetype="SOLID")
|
|
#doc.layers.add(name="zk", color=0, linetype="SOLID")
|
|
#doc.layers.add(name="opisy", color=0, linetype="SOLID")
|
|
#doc.layers.add(name="grunt", color=0, linetype="SOLID")
|
|
|
|
hatch = msp.add_hatch(color=3)
|
|
hatch_ground = msp.add_hatch(color=0)
|
|
hatch_gravel = msp.add_hatch(color=254)
|
|
|
|
doc.styles.new("Arial", dxfattribs={"font" : "Arial.ttf"})
|
|
|
|
#WYDURK
|
|
msp.add_line((0, 0), (0, a4_y), dxfattribs={"layer": "tabele", "color":0})
|
|
msp.add_line((0, a4_y), (a4_x, a4_y), dxfattribs={"layer": "tabele", "color":0})
|
|
msp.add_line((a4_x, a4_y), (a4_x, 0), dxfattribs={"layer": "tabele", "color":0})
|
|
msp.add_line((a4_x, 0), (0, 0), dxfattribs={"layer": "tabele", "color":0})
|
|
|
|
|
|
#UZIOM WIDOK Z Gory
|
|
msp.add_line((start_x, start_y), (start_x + len_h, start_y), dxfattribs={"layer": "bednarka", "color":1})
|
|
for rod in range(0,rod_num):
|
|
#kola i kreskowanie
|
|
msp.add_circle((start_x+1+(len_v*2*rod), start_y), 0.15, dxfattribs={"layer": "uziom", "color":3})
|
|
edge_path = hatch.paths.add_edge_path()
|
|
edge_path.add_arc((start_x+1+(len_v*2*rod), start_y), radius=0.15, start_angle=0, end_angle=360)
|
|
#wymiary
|
|
msp.add_line((start_x+1+(len_v*2*rod), start_y), (start_x+1+(len_v*2*rod), start_y+1), dxfattribs={"layer": "opisy"})
|
|
if rod == rod_num-1: continue
|
|
dim = msp.add_linear_dim(
|
|
base=(start_x+1+(len_v*2*rod), start_y+1), # location of the dimension line
|
|
p1=(start_x+1+(len_v*2*rod), start_y), # 1st measurement point
|
|
p2=(start_x+1+(len_v*2*(rod+1)), start_y), # 2nd measurement point
|
|
dimstyle="EZ_CURVED", # default dimension style
|
|
override={
|
|
# "dimtxsty": "Standard",
|
|
"dimtxt": 0.5,
|
|
"dimasz": 0.5,
|
|
},
|
|
text=str(len_v*2)+" m"
|
|
).render()
|
|
#wymiar 1. metra
|
|
dim = msp.add_linear_dim(
|
|
base=(start_x, start_y+1), # location of the dimension line
|
|
p1=(start_x, start_y), # 1st measurement point
|
|
p2=(start_x+1, start_y), # 2nd measurement point
|
|
dimstyle="EZ_CURVED", # default dimension style
|
|
override={
|
|
# "dimtxsty": "Standard",
|
|
"dimtxt": 0.5,
|
|
"dimasz": 0.5,
|
|
},
|
|
text="1 m"
|
|
).render()
|
|
|
|
#ZK WIDOK Z Gory
|
|
msp.add_line((start_x-zk_width, start_y+zk_depth/2), (start_x, start_y+zk_depth/2), dxfattribs={"layer": "zk"})
|
|
msp.add_line((start_x, start_y+zk_depth/2), (start_x, start_y-zk_depth/2), dxfattribs={"layer": "zk"})
|
|
msp.add_line((start_x, start_y-zk_depth/2), (start_x-zk_width, start_y-zk_depth/2), dxfattribs={"layer": "zk"})
|
|
msp.add_line((start_x-zk_width, start_y-zk_depth/2), (start_x-zk_width, start_y+zk_depth/2), dxfattribs={"layer": "zk"})
|
|
|
|
|
|
|
|
#UZIOM WIDOK Z BOKU
|
|
msp.add_line((start_x - zk_width / 2, start_y2), (start_x + len_h, start_y2), dxfattribs={"layer": "bednarka", "color":1})
|
|
msp.add_line((start_x - zk_width / 2, start_y2), (start_x - zk_width / 2, start_y2+0.2), dxfattribs={"layer": "bednarka", "color":1})
|
|
|
|
for rod in range(0,rod_num):
|
|
msp.add_line((start_x+1+(rod*len_v*2), start_y2+0.02), (start_x+1+(rod*len_v*2), start_y2-len_v), dxfattribs={"layer": "uziom", "color":3})
|
|
msp.add_line((start_x+1+(rod*len_v*2), start_y2+0.02), (start_x+1+(rod*len_v*2)+0.016, start_y2+0.02), dxfattribs={"layer": "uziom", "color":3})
|
|
msp.add_line((start_x+1+(rod*len_v*2)+0.016, start_y2+0.02), (start_x+1+(rod*len_v*2)+0.016, start_y2-len_v), dxfattribs={"layer": "uziom", "color":3})
|
|
msp.add_line((start_x+1+(rod*len_v*2), start_y2-len_v), (start_x+1+(rod*len_v*2)+0.016, start_y2-len_v), dxfattribs={"layer": "uziom", "color":3})
|
|
|
|
dim = msp.add_linear_dim(
|
|
base=(start_x+0.5, start_y2+1), # location of the dimension line
|
|
p1=(start_x+0.5, start_y2+1), # 1st measurement point
|
|
p2=(start_x+0.5, start_y2), # 2nd measurement point
|
|
dimstyle="EZ_CURVED", # default dimension style
|
|
override={
|
|
# "dimtxsty": "Standard",
|
|
"dimtxt": 0.5,
|
|
"dimasz": 0.5,
|
|
"dimjust": 3,
|
|
},
|
|
text="h=1 m",
|
|
angle=-90
|
|
).render()
|
|
|
|
|
|
#PODZIEMIE WIDOK Z BOKU
|
|
msp.add_line((start_x, start_y2 + 1), (start_x + len_h + overedge, start_y2 + 1), dxfattribs={"layer": "grunt"})
|
|
|
|
hatch_ground.set_pattern_fill("EARTH2", scale=0.1)
|
|
hatch_ground.paths.add_polyline_path(
|
|
[(start_x, start_y2 + 1), (start_x + len_h + overedge, start_y2 + 1), (start_x + len_h + overedge, start_y2 + 0.5), (start_x, start_y2 + 0.5)], is_closed=True
|
|
)
|
|
|
|
hatch_gravel.set_pattern_fill("CONCRETE2", scale=0.1)
|
|
hatch_gravel.paths.add_polyline_path(
|
|
[(start_x, start_y2 + 1), (start_x + len_h + overedge, start_y2 + 1), (start_x + len_h + overedge, start_y2 -(len_v+1)), (start_x, start_y2 -(len_v+1))], is_closed=True
|
|
)
|
|
|
|
#ZK WIDOK Z BOKU
|
|
msp.add_line((start_x - zk_width, start_y2+(zk_height/2)+1), (start_x, start_y2+(zk_height/2)+1), dxfattribs={"layer": "zk"})
|
|
msp.add_line((start_x, start_y2+(zk_height/2)+1), (start_x, start_y2-(zk_height/2)+1), dxfattribs={"layer": "zk"})
|
|
msp.add_line((start_x, start_y2-(zk_height/2)+1), (start_x-zk_width, start_y2-(zk_height/2)+1), dxfattribs={"layer": "zk"})
|
|
msp.add_line((start_x-zk_width, start_y2-(zk_height/2)+1), (start_x - zk_width, start_y2+(zk_height/2)+1), dxfattribs={"layer": "zk"})
|
|
|
|
msp.add_text(object1, dxfattribs={"layer": "opisy", "height": 0.55, "rotation": 0, "style": "OpenSans"}).set_pos((start_x - (zk_width/2) , start_y2+2.3), align="CENTER")
|
|
|
|
|
|
#OPISY
|
|
msp.add_text("SCHEMAT ROZMIESZCZENIA UZIOMÓW", dxfattribs={"layer": "opisy", "height": 0.55, "rotation": 0, "style": "OpenSans"}).set_pos((a4_x/2, a4_y-5.5), align="CENTER")
|
|
|
|
#TABELKA
|
|
start_xt = a4_x - 1.5 - 24
|
|
start_yt = 2
|
|
|
|
points = [(start_xt, start_yt), (start_xt + 24, start_yt), (start_xt + 24, start_yt+4), (start_xt, start_yt+4), (start_xt, start_yt)]
|
|
msp.add_lwpolyline(points, dxfattribs={"layer": "opisy"})
|
|
msp.add_line((start_xt, start_yt+1), (start_xt + 16, start_yt+1), dxfattribs={"layer": "opisy"})
|
|
msp.add_text("RYSUNEK", dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+1.5, start_yt+1+0.17), align="CENTER")
|
|
msp.add_text("Konfiguracja układu uziomowego", dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+3+0.18, start_yt+1+0.17), align="LEFT")
|
|
msp.add_line((start_xt, start_yt+1.6), (start_xt + 16, start_yt+1.6), dxfattribs={"layer": "opisy"})
|
|
msp.add_text("TEMAT", dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+1.5, start_yt+1.6+0.17), align="CENTER")
|
|
msp.add_text(object2, dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+3+0.18, start_yt+1.6+0.17), align="LEFT")
|
|
msp.add_line((start_xt, start_yt+2.2), (start_xt + 16, start_yt+2.2), dxfattribs={"layer": "opisy"})
|
|
msp.add_text("ADRES", dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+1.5, start_yt+2.2+0.17), align="CENTER")
|
|
msp.add_text(adres, dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+3+0.18, start_yt+2.2+0.17), align="LEFT")
|
|
msp.add_line((start_xt, start_yt+2.8), (start_xt + 16, start_yt+2.8), dxfattribs={"layer": "opisy"})
|
|
msp.add_text("OBIEKT", dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+1.5, start_yt+2.8+0.17), align="CENTER")
|
|
msp.add_text(object3, dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+3+0.18, start_yt+2.8+0.17), align="LEFT")
|
|
msp.add_line((start_xt, start_yt+3.4), (start_xt + 16, start_yt+3.4), dxfattribs={"layer": "opisy"})
|
|
msp.add_text("INWESTOR", dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+1.5, start_yt+3.4+0.17), align="CENTER")
|
|
msp.add_text("TAURON Dystrybucja S.A.", dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+3+0.18, start_yt+3.4+0.17), align="LEFT")
|
|
|
|
msp.add_line((start_xt+3, start_yt), (start_xt + 3, start_yt+4), dxfattribs={"layer": "opisy"})
|
|
msp.add_line((start_xt+16, start_yt), (start_xt + 16, start_yt+4), dxfattribs={"layer": "opisy"})
|
|
|
|
msp.add_line((start_xt+3, start_yt+0.5), (start_xt + 16, start_yt+0.5), dxfattribs={"layer": "opisy"})
|
|
msp.add_text("STADIUM", dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+3+1.625, start_yt+0.5+0.15), align="CENTER")
|
|
msp.add_text("PB", dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+3+1.625, start_yt+0.15), align="CENTER")
|
|
msp.add_line((start_xt+3+3.25, start_yt), (start_xt + 3 + 3.25, start_yt+1), dxfattribs={"layer": "opisy"})
|
|
msp.add_text("DATA", dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+3+3.25+1.625, start_yt+0.5+0.15), align="CENTER")
|
|
msp.add_text(date, dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+3+3.25+1.625, start_yt+0.15), align="CENTER")
|
|
msp.add_line((start_xt+3+6.5, start_yt), (start_xt + 3 + 6.5, start_yt+1), dxfattribs={"layer": "opisy"})
|
|
msp.add_text("SKALA", dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+3+6.5+1.625, start_yt+0.5+0.15), align="CENTER")
|
|
msp.add_text("1:150", dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+3+6.5+1.625, start_yt+0.15), align="CENTER")
|
|
msp.add_line((start_xt+3+9.75, start_yt), (start_xt + 3 + 9.75, start_yt+1), dxfattribs={"layer": "opisy"})
|
|
msp.add_text("NR RYS", dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+3+9.75+1.625, start_yt+0.5+0.15), align="CENTER")
|
|
msp.add_text("5", dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+3+9.75+1.625, start_yt+0.15), align="CENTER")
|
|
|
|
|
|
msp.add_text("pręt uziemiający Ø16 - dł. "+ str(len_v) +" mb - "+ str(rod_num) +" szt.", dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+2.5, start_yt+4+0.7), align="LEFT")
|
|
msp.add_circle((start_xt+1.5, start_yt + 4.8), 0.15, dxfattribs={"layer": "uziom", "color":3})
|
|
edge_path = hatch.paths.add_edge_path()
|
|
edge_path.add_arc((start_xt+1.5, start_yt + 4.8), radius=0.15, start_angle=0, end_angle=360)
|
|
|
|
msp.add_text("płaskownik St/Zn 30x4 mm - dł. "+ str(len_h) +" mb", dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+2.5, start_yt+4+1.4), align="LEFT")
|
|
msp.add_line((start_xt +0.8, start_yt+4+1.5), (start_xt + 2.1, start_yt+4+1.5), dxfattribs={"layer": "bednarka", "color":1})
|
|
|
|
|
|
doc.saveas("public/uziom.dxf") |