import sand3d as s3d
def heater():
root = s3d.at(chassis(), x=-8, y=-45)
a = s3d.at(dial_a(), x=-57, y=-416, z=361)
b = s3d.at(dial_b(), x=-43, y=-416, z=361)
wh = s3d.at(wheel(), x=218.5, y=206)
twin = s3d.transform(s3d.copy(wh), mirror=class="tok-string">"x", x=-16)
knob = s3d.at(control_knob(), x=-171.5, y=-111.5, z=276)
button = s3d.at(switch(), x=-170, y=-337, z=286)
hand = s3d.at(indicator_hand(), x=-52, y=-419.5, z=389)
s3d.joint(class="tok-string">"joint_knob_02_joint_00", a, on=s3d.local(root, x=-49, y=-372, z=364), kind=class="tok-string">"continuous", axis=class="tok-string">"+Y")
s3d.joint(class="tok-string">"joint_knob_03_joint_00", b, on=s3d.local(root, x=-35, y=-372, z=364), kind=class="tok-string">"continuous", axis=class="tok-string">"+Y")
s3d.joint(class="tok-string">"joint_wheel_01_joint_00", wh, on=s3d.local(root, x=246, y=252, z=87), kind=class="tok-string">"continuous", axis=class="tok-string">"-X")
s3d.joint(class="tok-string">"joint_wheel_02_joint_00", twin, on=s3d.local(root, x=-247, y=252, z=87), kind=class="tok-string">"continuous", axis=class="tok-string">"-X")
s3d.joint(class="tok-string">"joint_knob_01_joint_00", knob, on=s3d.local(root, x=-169, y=-67, z=291), kind=class="tok-string">"continuous", axis=class="tok-string">"-X")
s3d.joint(class="tok-string">"joint_button_01_joint_00", button, on=s3d.local(root, x=-161, y=-296, z=294), axis=class="tok-string">"+Y", range=(0,20))
s3d.joint(class="tok-string">"joint_hand_01_joint_00", hand, on=s3d.local(root, x=-42, y=-375, z=390), kind=class="tok-string">"continuous", axis=class="tok-string">"+Y")
return s3d.assembly(class="tok-string">"heater", root, a, b, wh, twin, knob, button, hand)
def chassis(w=383, d=818, bottom=95, deck=265, barrel_w=203, length=907, axis_h=384, barrel_y=54, wall=2, block_w=319, block_d=347, block_h=98, block_y=-151, frame_w=404, frame_bottom=-390, frame_top=-506, frame_h=588, frame_low=158, rail=20):
base = s3d.loft(class="tok-string">"tank", s3d.station(z=bottom,w=w-30,d=d-26,n=10), s3d.station(z=bottom+15,w=w,d=d,n=10), s3d.station(z=frame_low,w=w,d=d,n=10), s3d.station(z=deck-30,w=w,d=d-45,y=-rail,n=10), s3d.station(z=deck,w=w-10,d=650,y=-75,n=10))
lip = s3d.wire(class="tok-string">"bumper",path=[(-frame_w/2,-d/2-rail/2,frame_low),(frame_w/2,-d/2-rail/2,frame_low),(frame_w/2,d/2+rail+rail/2,frame_low),(-frame_w/2,d/2+rail+rail/2,frame_low)],d=rail,closed=True,fillet=rail)
barrel = s3d.tube(class="tok-string">"barrel",d=barrel_w,d_in=barrel_w-wall*2,h=length)
barrel = s3d.at(barrel,y=barrel_y-length/2,z=axis_h,rx=-90)
liner = s3d.tube(class="tok-string">"liner",d=184,d_in=164,h=625)
liner = s3d.at(liner,y=barrel_y+length/2-625,z=axis_h,rx=-90)
rim = s3d.tube(class="tok-string">"mouth rim",d=barrel_w+wall*2,d_in=barrel_w-wall*2,h=wall*2)
rim=s3d.at(rim,y=barrel_y+length/2-wall,z=axis_h,rx=-90)
block=s3d.at(s3d.box(class="tok-string">"housing",w=block_w,d=block_d,h=block_h),y=block_y,z=deck)
handle=s3d.wire(class="tok-string">"push frame",path=[(-frame_w/2,frame_bottom,frame_low),(-frame_w/2,frame_top,frame_h),(frame_w/2,frame_top,frame_h),(frame_w/2,frame_bottom,frame_low)],d=rail,fillet=rail)
foot=s3d.wire(class="tok-string">"stand",path=[(-frame_w/2,-273,rail/2),(frame_w/2,-273,rail/2)],d=rail)
flange=s3d.at(s3d.box(class="tok-string">"barrel flange",w=barrel_w+rail*2,d=length,h=wall),y=barrel_y,z=axis_h-wall*2)
flange=s3d.cut(flange,s3d.at(s3d.cylinder(class="tok-string">"clear",d=barrel_w-wall,h=length+rail),y=barrel_y-length/2-rail/2,z=axis_h,rx=-90))
fan=s3d.extrude(class="tok-string">"fan",s3d.poly([(-barrel_w/2,0),(-rail/2,barrel_w/2-rail),(rail/2,-barrel_w/4)]),h=wall)
fan=s3d.at(fan,y=frame_bottom+rail*2,z=axis_h,rx=90)
for ob in (base,lip,block):
s3d.material(ob,class="tok-string">"painted_metal",color=class="tok-string">"class="tok-comment">#b89a35")
for ob in (barrel,liner,rim,handle,foot,flange,fan):
s3d.material(ob,class="tok-string">"steel",color=class="tok-string">"class="tok-comment">#454a4d")
return s3d.group(class="tok-string">"chassis",base,lip,barrel,liner,rim,block,handle,foot,flange,fan)
def dial_a(w=8,d=2,h=7):
ob=s3d.at(s3d.cylinder(class="tok-string">"dial",d=h,h=d),y=d/2,z=h/2,rx=90)
s3d.material(ob,class="tok-string">"plastic",color=class="tok-string">"class="tok-comment">#202020")
return s3d.group(class="tok-string">"dial_a",ob)
def dial_b(w=8,d=2,h=7):
ob=s3d.at(s3d.cylinder(class="tok-string">"dial",d=h,h=d),y=d/2,z=h/2,rx=90)
s3d.material(ob,class="tok-string">"plastic",color=class="tok-string">"class="tok-comment">#202020")
return s3d.group(class="tok-string">"dial_b",ob)
def wheel(w=39,d=173,h=176,inner=132,hub=38,spokes=6,spoke_w=12):
rim=s3d.tube(class="tok-string">"tire",d=d,d_in=inner,h=w)
s3d.material(rim,class="tok-string">"rubber",color=class="tok-string">"class="tok-comment">#252525")
center=s3d.cylinder(class="tok-string">"hub",d=hub,h=w)
spoke=s3d.at(s3d.box(class="tok-string">"spoke",w=spoke_w,d=(inner-hub)/2+spoke_w,h=w/3),y=(inner+hub)/4,z=w/3)
copies=s3d.at(spoke,on=s3d.ring(n=spokes,r=0))
dish=s3d.cylinder(class="tok-string">"back dish",d=inner+spoke_w,h=w/6)
s3d.material(dish,class="tok-string">"steel",color=class="tok-string">"class="tok-comment">#777c80")
s3d.material(center,class="tok-string">"steel",color=class="tok-string">"class="tok-comment">#777c80")
s3d.material(copies,class="tok-string">"steel",color=class="tok-string">"class="tok-comment">#777c80")
ob=s3d.group(class="tok-string">"wheel",rim,center,copies,dish)
return s3d.group(class="tok-string">"wheel_part",s3d.at(ob,x=-w/2,z=h/2,ry=90))
def control_knob(w=15,d=33,h=31):
ob=s3d.at(s3d.extrude(class="tok-string">"knob",s3d.polygon(n=8,d=h),h=w),x=-w/2,z=h/2,ry=90)
s3d.material(ob,class="tok-string">"plastic",color=class="tok-string">"class="tok-comment">#222222")
return s3d.group(class="tok-string">"control_knob",ob)
def switch(w=8,d=10,h=17):
ob=s3d.box(class="tok-string">"switch",w=w,d=d,h=h)
s3d.material(ob,class="tok-string">"plastic",color=class="tok-string">"class="tok-comment">#c73322")
return s3d.group(class="tok-string">"switch",ob)
def indicator_hand(w=22,d=1,h=2):
ob=s3d.box(class="tok-string">"needle",w=w,d=d,h=h)
s3d.material(ob,class="tok-string">"painted_metal",color=class="tok-string">"class="tok-comment">#dddddd")
return s3d.group(class="tok-string">"indicator_hand",ob)