from solid import *
from solid.utils import * # Not required, but the utils module is useful
import viewscad
d = difference()(
cube(10), # Note the comma between each element!
sphere(12)
)
scad_render(d)
r = viewscad.Renderer()
r.render(d)
from math import cos, radians, sin, pi, tau
o = translate([0, 1, 0])(sphere(r=0.2))
for i in range(int(tau*3)):
a = i/3
o += translate([sin(a), cos(a), 0])(sphere(r=0.2))
r.render(o)
import pandas as pd
df = pd.read_csv('data/day_counts.csv', parse_dates=['Date']).fillna(0)
df.head()
chunks = []
for i in range(0, len(df), 28):
chunks.append(df['Count'].values[i:i+28])
chunks[0]
def draw_chunk(c):
o = sphere(r=0.2)
for i, v in enumerate(c):
o += translate([sin(i*tau/28), cos(i*tau/28), 0])(sphere(r=0.15 + 0.05*v))
o -= sphere(r=0.3)
return o
r.render(draw_chunk(chunks[0]))
o = draw_chunk(chunks[0])
for i, c in enumerate(chunks[1:4]):
o += translate([0, 0, i/4])(draw_chunk(c))
r.render(o)
scad_render_to_file(o, 'outputs/test1.scad')