Mustergenerator/HexagonGen.py

55 lines
963 B
Python
Raw Permalink Normal View History

2023-10-29 13:30:13 +00:00
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 28 16:26:49 2023
@author: Lukas
"""
import drawsvg as draw
import math
# Mittelpunkt X-Koordinate
x1=0
# Mittelpunkt Y-Koordinate
y1=0
# Schlüsselbreite
sb = 50.0000
#Breite Feld
length=10000
#Höhe Feld
height = 10000
#Abstand X
ax= 86.6
#Abstand Y
ay=40
#Versatz der Spalten
versatz= ax/2
#Def
v=0
g=-1
r=1
x=0
y=0
size = sb/math.sqrt(3)
d = draw.Drawing(length, height, origin=(0, 0))
x =x1
y =y1
while y <= height:
x=x1+((versatz)*v)
while x <= length:
d.append(draw.Lines(x-size*0.5, y-size*0.866, x+size-size*0.5, y-size*0.866, x+size * 1.5-size*0.5, y, x+size-size*0.5, y+size * 0.866, x-size*0.5, y+size * 0.866, x-size, y,
fill='red', stroke='black', close='true'))
x =x+ax
y =y+ay
v= -((1-g)/2)
g=-g
d.append(draw.Circle(0, 0, 40))
#plt.show()
d.save_svg('polygon.svg')