Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
circles.append(Part.LineSegment(p1,p2).toShape())
circlepos.append((ad,p3))
# build the sun curves at solstices and equinoxe
year = datetime.datetime.now().year
hpts = [ [] for i in range(24) ]
m = [(6,21),(7,21),(8,21),(9,21),(10,21),(11,21),(12,21)]
if complete:
m.extend([(1,21),(2,21),(3,21),(4,21),(5,21)])
for i,d in enumerate(m):
pts = []
for h in range(24):
if oldversion:
dt = datetime.datetime(year, d[0], d[1], h)
alt = math.radians(pysolar.solar.GetAltitudeFast(latitude, longitude, dt))
az = pysolar.solar.GetAzimuth(latitude, longitude, dt)
az = -90 + az # pysolar's zero is south, ours is X direction
else:
dt = datetime.datetime(year, d[0], d[1], h, tzinfo=tz)
alt = math.radians(pysolar.solar.get_altitude_fast(latitude, longitude, dt))
az = pysolar.solar.get_azimuth(latitude, longitude, dt)
az = 90 + az # pysolar's zero is north, ours is X direction
if az < 0:
az = 360 + az
az = math.radians(az)
zc = math.sin(alt)*scale
ic = math.cos(alt)*scale
xc = math.cos(az)*ic
yc = math.sin(az)*ic
p = FreeCAD.Vector(xc,yc,zc)
pts.append(p)
hpts[h].append(p)
if tz:
tz = datetime.timezone(datetime.timedelta(hours=-3))
else:
tz = datetime.timezone.utc
year = datetime.datetime.now().year
hpts = [ [] for i in range(24) ]
m = [(6,21),(9,21),(12,21)]
pts = []
for i,d in enumerate(m):
for h in [9,12,15]:
if oldversion:
dt = datetime.datetime(year, d[0], d[1], h)
alt = math.radians(pysolar.solar.GetAltitudeFast(latitude, longitude, dt))
az = pysolar.solar.GetAzimuth(latitude, longitude, dt)
az = -90 + az # pysolar's zero is south, ours is X direction
else:
dt = datetime.datetime(year, d[0], d[1], h, tzinfo=tz)
alt = math.radians(pysolar.solar.get_altitude_fast(latitude, longitude, dt))
az = pysolar.solar.get_azimuth(latitude, longitude, dt)
az = 90 + az # pysolar's zero is north, ours is X direction
if az < 0:
az = 360 + az
az = math.radians(az)
zc = math.sin(alt)
ic = math.cos(alt)
xc = math.cos(az)*ic
yc = math.sin(az)*ic
p = FreeCAD.Vector(xc,yc,zc).negative()
p.normalize()
if not oldversion: