import sand3d as s3d
def mobile_worktable():
body = s3d.at(body_01(), x=21, y=236, z=88)
a = s3d.at(wheel_02(), x=212.5, y=-256, z=16)
b = s3d.at(wheel_03(), x=-169.5, y=-256, z=16)
c = s3d.at(wheel_04(), x=-124.5, y=298, z=16)
d = s3d.at(drawer_01(), x=-138.5, y=-136.5, z=799)
e = s3d.at(wheel_01(), x=165, y=298, z=16)
f = s3d.at(drawer_02(), x=178.5, y=-137, z=799)
s3d.joint(&class="tok-comment">#39;joint_wheel_02_joint_00class="tok-string">39;, a, s3d.local(body, x=191,y=-465,z=21), kind=39;continuousclass="tok-string">39;, axis=39;+Z39;)
s3d.joint(&class="tok-comment">#39;joint_wheel_03_joint_00class="tok-string">39;, b, s3d.local(body, x=-191,y=-465,z=21), kind=39;continuousclass="tok-string">39;, axis=39;+Z39;)
s3d.joint(&class="tok-comment">#39;joint_wheel_04_joint_00class="tok-string">39;, c, s3d.local(body, x=-146,y=89,z=-2), kind=39;continuousclass="tok-string">39;, axis=39;+Z39;)
s3d.joint(&class="tok-comment">#39;joint_drawer_01_joint_00class="tok-string">39;, d, s3d.local(body, x=-159,y=-372,z=774), kind=39;prismaticclass="tok-string">39;, axis=39;+X39;, range=(-122.8,0))
s3d.joint(&class="tok-comment">#39;joint_wheel_01_joint_00class="tok-string">39;, e, s3d.local(body, x=143,y=89,z=-2), kind=39;continuousclass="tok-string">39;, axis=39;+Z39;)
s3d.joint(&class="tok-comment">#39;joint_drawer_02_joint_00class="tok-string">39;, f, s3d.local(body, x=157,y=-372,z=774), kind=39;prismaticclass="tok-string">39;, axis=39;+X39;, range=(0,118.4))
return s3d.assembly(&class="tok-comment">#39;mobile_worktable39;,body,a,b,c,d,e,f)
def body_01(w=434,d=222,h=828,cabinet_y=-372,base_z=38,top_w=440,top_d=1014,top_h=7,top_z=859,wall=18,core=140,lower=388,upper=211,shelf=21,rail_h=39,foot_w=436,foot_d=73,foot_h=15):
cabinet=s3d.at(s3d.extrude(&class="tok-comment">#39;cabinet39;,s3d.rect(w=w,d=d,r=5),h=h),y=cabinet_y,z=base_z)
recess=s3d.at(s3d.box(&class="tok-comment">#39;lower_recess39;,w=(w-core)/2+wall,d=d-2*wall,h=lower),x=-(w+core)/4,y=cabinet_y,z=base_z+31)
s3d.cut(cabinet,recess,s3d.transform(s3d.copy(recess),mirror=&class="tok-comment">#39;x39;))
recess=s3d.at(s3d.box(&class="tok-comment">#39;upper_recess39;,w=(w-core)/2+wall,d=d-2*wall,h=upper),x=-(w+core)/4,y=cabinet_y,z=base_z+31+lower+shelf)
s3d.cut(cabinet,recess,s3d.transform(s3d.copy(recess),mirror=&class="tok-comment">#39;x39;))
recess=s3d.at(s3d.box(&class="tok-comment">#39;drawer_space39;,w=w+wall,d=d-2*wall,h=148),y=cabinet_y,z=base_z+652)
s3d.cut(cabinet,recess)
top=s3d.at(s3d.extrude(&class="tok-comment">#39;top39;,s3d.rect(w=top_w,d=top_d,r=40),h=top_h),y=16,z=top_z)
pad=s3d.at(s3d.extrude(&class="tok-comment">#39;underside39;,s3d.rect(w=258,d=top_d-wall*2,r=wall),h=20),y=16,z=top_z-20)
s3d.join(top,pad)
rail=s3d.at(s3d.extrude(&class="tok-comment">#39;end_rail39;,s3d.rect(w=378,d=shelf,r=wall/2),h=rail_h),y=cabinet_y-94,z=top_z+top_h-1)
beam=s3d.at(s3d.box(&class="tok-comment">#39;extension39;,w=80,d=400,h=10),y=-86,z=25,rx=-6.5)
foot=s3d.at(s3d.extrude(&class="tok-comment">#39;extended_foot39;,s3d.rect(w=334,d=foot_d,r=12),h=foot_h),y=88)
back=s3d.at(s3d.box(&class="tok-comment">#39;cabinet_foot39;,w=foot_w,d=60,h=25),y=cabinet_y-87,z=foot_h)
bands=s3d.at(s3d.box(&class="tok-comment">#39;opening_band39;,w=top_h,d=d-wall*2,h=34),x=-w/2-wall,y=cabinet_y,z=126)
band2=s3d.transform(s3d.copy(bands),z=60)
bands_other=s3d.transform(s3d.copy(bands),mirror=&class="tok-comment">#39;x39;)
band2_other=s3d.transform(s3d.copy(band2),mirror=&class="tok-comment">#39;x39;)
for ob in (cabinet,top,rail,beam,foot,back,bands,band2,bands_other,band2_other):
s3d.material(ob,&class="tok-comment">#39;painted_metalclass="tok-string">39;,color=39;#c7cbd039;)
return s3d.group(&class="tok-comment">#39;body39;,cabinet,top,rail,beam,foot,back,bands,band2,bands_other,band2_other)
def wheel_02(w=33,d=90,h=93):
solid=caster(w=w,d=d,h=h)
tire=s3d.at(tire_02(),x=-1,y=7.5,z=-16)
s3d.joint(&class="tok-comment">#39;joint_tire_02_joint_00class="tok-string">39;,tire,s3d.local(solid,x=-0.5,y=-20,z=45-h),kind=39;continuousclass="tok-string">39;,axis=39;+X39;)
return s3d.group(&class="tok-comment">#39;wheel_0239;,solid,tire)
def caster(w=33,d=90,h=93,t=4):
profile=s3d.poly([(-d/2,0),(-d/2+8,h/2),(-8,h-20),(d/2-8,h-20),(d/2,0),(d/2-6,0),(d/2-16,h/2),(-7,h-30),(-d/2+16,h/2),(-d/2+6,0)])
side=s3d.at(s3d.extrude(&class="tok-comment">#39;fork39;,profile,h=t),x=-w/2,rx=90,rz=90)
twin=s3d.transform(s3d.copy(side),x=w-t)
cap=s3d.at(s3d.cylinder(&class="tok-comment">#39;swivel39;,d=w,h=24),y=27,z=h-24)
s3d.join(cap,side,twin)
s3d.material(cap,&class="tok-comment">#39;steelclass="tok-string">39;,color=39;#9da2a639;)
return cap
def tire_02(w=49,d=73):
ob=wheel_tire(w=w,d=d)
return s3d.group(&class="tok-comment">#39;tire_0239;,ob)
def wheel_tire(w=49,d=73):
ob=s3d.at(s3d.cylinder(&class="tok-comment">#39;tire39;,d=d,h=w),x=-w/2,z=d/2,ry=90)
s3d.fillet(ob,r=5,edges=&class="tok-comment">#39;all39;)
s3d.material(ob,&class="tok-comment">#39;rubberclass="tok-string">39;,color=39;#55585b39;)
return ob
def wheel_03(w=33,d=90,h=93):
solid=caster(w=w,d=d,h=h)
tire=s3d.at(tire_03(),y=7.5,z=-16)
s3d.joint(&class="tok-comment">#39;joint_tire_03_joint_00class="tok-string">39;,tire,s3d.local(solid,x=-0.5,y=-20,z=45-h),kind=39;continuousclass="tok-string">39;,axis=39;+X39;)
return s3d.group(&class="tok-comment">#39;wheel_0339;,solid,tire)
def tire_03(w=49,d=73):
return s3d.group(&class="tok-comment">#39;tire_0339;,wheel_tire(w=w,d=d))
def wheel_04(w=33,d=90,h=73):
solid=caster(w=w,d=d,h=h)
tire=s3d.at(tire_04(),x=-1,y=7.5,z=-16)
s3d.joint(&class="tok-comment">#39;joint_tire_04_joint_00class="tok-string">39;,tire,s3d.local(solid,x=24.5,y=-20,z=45-h),kind=39;continuousclass="tok-string">39;,axis=39;+X39;)
return s3d.group(&class="tok-comment">#39;wheel_0439;,solid,tire)
def tire_04(w=49,d=73):
return s3d.group(&class="tok-comment">#39;tire_0439;,wheel_tire(w=w,d=d))
def drawer_01(w=165,d=187,h=126,t=3):
ob=tray(w=w,d=d,h=h,t=t,sign=-1)
return s3d.group(&class="tok-comment">#39;drawer_0139;,ob)
def tray(w=165,d=187,h=126,t=3,sign=1):
ob=s3d.extrude(&class="tok-comment">#39;drawer39;,s3d.rect(w=w-20,d=d,r=t),h=h)
s3d.shell(ob,t=t,open=&class="tok-comment">#39;top39;)
handle=s3d.at(s3d.box(&class="tok-comment">#39;handle39;,w=20,d=d,h=32),x=sign*(w/2-10),z=h/2-16)
s3d.join(ob,handle)
s3d.material(ob,&class="tok-comment">#39;painted_metalclass="tok-string">39;,color=39;#c7cbd039;)
return ob
def wheel_01(w=34,d=90,h=73):
solid=caster(w=w,d=d,h=h)
tire=s3d.at(tire_01(),x=-0.5,y=7.5,z=-16)
s3d.joint(&class="tok-comment">#39;joint_tire_01_joint_00class="tok-string">39;,tire,s3d.local(solid,x=-1,y=-20,z=45-h),kind=39;continuousclass="tok-string">39;,axis=39;+X39;)
return s3d.group(&class="tok-comment">#39;wheel_0139;,solid,tire)
def tire_01(w=49,d=73):
return s3d.group(&class="tok-comment">#39;tire_0139;,wheel_tire(w=w,d=d))
def drawer_02(w=167,d=188,h=126,t=3):
return s3d.group(&class="tok-comment">#39;drawer_0239;,tray(w=w,d=d,h=h,t=t))