Add uziom generation script and update wet input documents
- 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.
This commit is contained in:
92
cross.py
Normal file
92
cross.py
Normal file
@@ -0,0 +1,92 @@
|
||||
import sys
|
||||
import ezdxf
|
||||
import math
|
||||
|
||||
minx = 10000000000000
|
||||
miny = 10000000000000
|
||||
maxx = 0
|
||||
maxy = 0
|
||||
|
||||
if len(sys.argv) > 0:
|
||||
skala = int(sys.argv[1])
|
||||
path = (sys.argv[2])
|
||||
else:
|
||||
skala = 50
|
||||
|
||||
alt = 0
|
||||
|
||||
fileName = path
|
||||
|
||||
def drawCross(x, y):
|
||||
msp.add_text(
|
||||
"X:"+str(x), dxfattribs={
|
||||
"layer": "wsp", "height": 1, "style": "Arial"
|
||||
}).set_pos((x+0.5, y+0.5))
|
||||
msp.add_text(
|
||||
"Y:"+str(y), dxfattribs={
|
||||
"layer": "wsp", "height": 1, "style": "Arial"
|
||||
}).set_pos((x+0.5, y-1.5))
|
||||
msp.add_line((x-2.5, y), (x+2.5, y), dxfattribs={"layer": "siatka"})
|
||||
msp.add_line((x, y-2.5), (x, y+2.5), dxfattribs={"layer": "siatka"})
|
||||
|
||||
try:
|
||||
doc = ezdxf.readfile(fileName)
|
||||
# iterate over all entities in modelspace
|
||||
msp = doc.modelspace()
|
||||
#doc.layers.add(name="siatka", color=0, linetype="SOLID")
|
||||
for e in msp:
|
||||
if e.dxftype() == "LINE":
|
||||
if e.dxf.start[0] < minx:
|
||||
minx = e.dxf.start[0]
|
||||
if e.dxf.end[0] < minx:
|
||||
minx = e.dxf.end[0]
|
||||
if e.dxf.start[1] < miny:
|
||||
miny = e.dxf.start[1]
|
||||
if e.dxf.end[1] < miny:
|
||||
miny = e.dxf.end[1]
|
||||
|
||||
if e.dxf.start[0] > maxx:
|
||||
maxx = e.dxf.start[0]
|
||||
if e.dxf.end[0] > maxx:
|
||||
maxx = e.dxf.end[0]
|
||||
if e.dxf.start[1] > maxy:
|
||||
maxy = e.dxf.start[1]
|
||||
if e.dxf.end[1] > maxy:
|
||||
maxy = e.dxf.end[1]
|
||||
elif e.dxftype() == "POLYLINE":
|
||||
for point in e.points():
|
||||
if point[0] < minx:
|
||||
minx = point[0]
|
||||
if point[1] < miny:
|
||||
miny = point[1]
|
||||
if point[0] > maxx:
|
||||
maxx = point[0]
|
||||
if point[1] > maxy:
|
||||
maxy = point[1]
|
||||
|
||||
|
||||
ys = (math.floor(miny/100)*100) - (50 * alt)
|
||||
ye = (math.ceil(maxy/100)*100) - (50 * alt)
|
||||
xs = (math.floor((minx)/100)*100) - (50 * alt)
|
||||
xe = (math.ceil((maxx)/100)*100) - (50 * alt)
|
||||
|
||||
lenX = (xe - xs) + 100
|
||||
lenY = (ye - ys) + 100
|
||||
|
||||
for x in range(0, int(lenX/skala)):
|
||||
for y in range(0, int(lenY/skala)):
|
||||
drawCross(xs+(x*skala),ys+(y*skala))
|
||||
|
||||
|
||||
print(fileName)
|
||||
doc.saveas(fileName[:-4]+"_s.dxf")
|
||||
doc.saveas("public/cross.dxf")
|
||||
|
||||
|
||||
except IOError:
|
||||
print(f"Not a DXF file or a generic I/O error.")
|
||||
sys.exit(1)
|
||||
except ezdxf.DXFStructureError:
|
||||
print(f"Invalid or corrupted DXF file.")
|
||||
sys.exit(2)
|
||||
|
||||
Reference in New Issue
Block a user