import sand3d as s3d
def kettle():
body = s3d.at(kettle_body(), y=2.5)
return s3d.assembly(&class="tok-comment">#39;kettle39;, body)
def kettle_body(w=157.7, h=240, cy=-24.5, wall=2, handle_w=29, handle_d=27):
vessel = s3d.revolve(&class="tok-comment">#39;vessel39;, s3d.poly([(0,0),(68.5,0),(74,7),(w/2,26),(77.5,61),(65.5,215),(62, h),(0,h)]))
vessel = s3d.shell(vessel, t=wall, open=&class="tok-comment">#39;top39;)
vessel = s3d.at(vessel, y=cy)
handle = s3d.sweep(&class="tok-comment">#39;handle39;, s3d.ellipse(w=handle_w,d=handle_d), s3d.spline([(0,40,228),(0,73,226),(0,94,202),(0,98,137),(0,87,99),(0,51,86)]))
spout = s3d.loft(&class="tok-comment">#39;pouring_lip39;, s3d.station(z=177,w=40,d=10,y=-94), s3d.station(z=234,w=44,d=28,y=-94))
spout = s3d.shell(spout,t=wall,open=&class="tok-comment">#39;end start39;)
s3d.material(vessel,&class="tok-comment">#39;brushed_steelclass="tok-string">39;,color=39;#989b9d39;)
s3d.material(handle,&class="tok-comment">#39;plasticclass="tok-string">39;,color=39;#24262839;)
s3d.material(spout,&class="tok-comment">#39;brushed_steelclass="tok-string">39;,color=39;#989b9d39;)
switch = s3d.at(power_switch(), y=73,z=40)
button = s3d.at(release_button(),x=-0.5,y=70,z=236)
cover = s3d.at(lid(),y=-24.5,z=234)
root = s3d.group(&class="tok-comment">#39;kettle_body39;,vessel,handle,spout,switch,button,cover)
s3d.joint(&class="tok-comment">#39;joint_sm_kitchenware_kettle_a01_switch_joint_00class="tok-string">39;,switch,on=s3d.local(root,0,52.5,44),kind=39;revoluteclass="tok-string">39;,axis=39;+X39;,range=(-8,8))
s3d.joint(&class="tok-comment">#39;joint_sm_kitchenware_kettle_a01_button_joint_00class="tok-string">39;,button,on=s3d.local(root,0,57.5,246),kind=39;revoluteclass="tok-string">39;,axis=39;+X39;,range=(0,6))
s3d.joint(&class="tok-comment">#39;joint_sm_kitchenware_kettle_a01_lid_joint_00class="tok-string">39;,cover,on=s3d.local(root,0,46.5,246),kind=39;revoluteclass="tok-string">39;,axis=39;+X39;,range=(-45,0))
return root
def power_switch(w=30,d=30,h=9,r=6, neck_w=8,neck_d=14,t=2):
tab = s3d.extrude(&class="tok-comment">#39;switch39;,s3d.rect(w=w,d=d,r=r),h=h)
s3d.fillet(tab,r=t,edges=&class="tok-comment">#39;top bottom39;)
tab = s3d.pocket(tab,s3d.rect(w=w-2*t,d=d-2*t,r=r-t),depth=h/2,on=tab.face(&class="tok-comment">#39;bottom39;))
tab = s3d.at(tab,y=5.5)
neck = s3d.at(s3d.box(&class="tok-comment">#39;stem39;,w=neck_w,d=neck_d,h=t),y=-d/2,z=h/2)
tab = s3d.join(tab,neck)
s3d.material(tab,&class="tok-comment">#39;plasticclass="tok-string">39;,color=39;#24262839;)
return s3d.group(&class="tok-comment">#39;power_switch39;,tab)
def release_button(w=17,d=25,h=10,r=3):
pad = s3d.extrude(&class="tok-comment">#39;button39;,s3d.rect(w=w,d=d,r=r),h=h)
s3d.fillet(pad,r=2,edges=&class="tok-comment">#39;top39;)
s3d.material(pad,&class="tok-comment">#39;plasticclass="tok-string">39;,color=39;#34363839;)
return s3d.group(&class="tok-comment">#39;release_button39;,pad)
def lid(d=124,h=17,inner=96,t=2, tongue_w=38, tongue_end=73):
cap = s3d.revolve(&class="tok-comment">#39;lid39;,s3d.poly([(0,6),(inner/2,6),(56,0),(d/2,2),(60,6),(54,10),(inner/2,12),(inner/2,10),(43,14),(30,16),(0,h)]))
tongue = s3d.loft(&class="tok-comment">#39;hinge_tongue39;,s3d.station(z=1,w=58,d=18,y=58,n=4),s3d.station(z=10,w=tongue_w,d=20,y=tongue_end-10,n=4))
cap = s3d.join(cap,tongue)
s3d.material(cap,&class="tok-comment">#39;plasticclass="tok-string">39;,color=39;#34363839;)
return s3d.group(&class="tok-comment">#39;lid39;,cap)