import sand3d as s3d
def washstand():
root = s3d.at(body(), x=-81.5, y=26)
return s3d.assembly(&class="tok-comment">#39;washstand39;, root)
def body(w=683,d=334,h=588,bottom=811,tank_y=-66.5,radius=55,lower_w=295,lower_d=386,lower_h=680,shoulder=493,leg_x=265,leg_top=220,leg_front=-198,leg_back=202,leg_back_top=27,rail=22,ledge_w=380,ledge_d=155,ledge_h=27,panel_w=325,recess_back=47,panel_bottom=901,top_depth=20,rib_pitch=78):
half=1/2
turn=90
tank=s3d.at(s3d.extrude(&class="tok-comment">#39;tank39;,s3d.rect(w=w,d=d,r=radius),h=h),y=tank_y,z=bottom)
s3d.fillet(tank,r=rail/3,edges=&class="tok-comment">#39;bottom39;)
corner_x=-w*half
corner_z=bottom+h
corner_d=radius+radius*half
corner=s3d.extrude(&class="tok-comment">#39;cap_seat39;,s3d.poly([(corner_x,corner_z-corner_d),(corner_x,corner_z+rail),(corner_x+corner_d+rail,corner_z+rail)]),h=radius*2)
corner=s3d.at(corner,y=tank_y+d*half,rx=turn)
s3d.cut(tank,corner)
recess=s3d.at(s3d.box(&class="tok-comment">#39;recess39;,w=panel_w,d=d*half,h=h),y=recess_back+d/4,z=panel_bottom)
s3d.cut(tank,recess)
s3d.pocket(tank,s3d.rect(w=w-rail,d=d-rail,r=radius*half),depth=top_depth,on=tank.face(&class="tok-comment">#39;top39;).move(y=tank_y))
ribs=s3d.at(s3d.box(&class="tok-comment">#39;top_rib39;,w=rail/3,d=d-rail,h=top_depth),on=s3d.grid(nx=8,px=rib_pitch),y=tank_y,z=bottom+h-top_depth-1)
s3d.join(tank,ribs)
container=s3d.extrude(&class="tok-comment">#39;container39;,s3d.poly([(-lower_d*half,0),(lower_d*half,0),(lower_d*half,shoulder),(lower_d*half-(lower_h-shoulder),lower_h),(-lower_d*half,lower_h)]),h=lower_w)
container=s3d.at(container,x=-lower_w*half,y=1,rx=turn,rz=turn)
s3d.fillet(container,r=rail*2/3)
handle=s3d.extrude(&class="tok-comment">#39;handle_cut39;,s3d.slot(l=lower_w*half,d=rail),h=rail)
handle=s3d.at(handle,x=lower_w*half-rail-rail*half,y=1+lower_d*half-(lower_h-shoulder)*half-rail/3,z=(lower_h+shoulder)*half-rail/3,ry=turn*half,rz=turn)
s3d.cut(container,handle,s3d.transform(s3d.copy(handle),mirror=&class="tok-comment">#39;x39;))
ledge_y=ledge_d*half+rib_pitch
ledge=s3d.at(s3d.extrude(&class="tok-comment">#39;ledge39;,s3d.rect(w=ledge_w,d=ledge_d,r=ledge_d/3),h=ledge_h),y=ledge_y,z=bottom+rail+rail*half)
s3d.pocket(ledge,s3d.rect(w=ledge_w-rail,d=ledge_d-rail,r=ledge_d/3),depth=rail/3,on=ledge.face(&class="tok-comment">#39;top39;).move(y=ledge_y))
rods=[]
for side in (-1,1):
for foot,top in ((leg_front,leg_front),(leg_back,leg_back_top)):
rods.append(s3d.wire(&class="tok-comment">#39;leg39;,path=[(side*leg_x,foot,0),(side*leg_top,top,bottom+rail*half)],d=rail))
rods.append(s3d.wire(&class="tok-comment">#39;foot_bar39;,path=[(side*leg_x,leg_front,rail*2),(side*leg_x,leg_back,rail*2)],d=rail*2/3))
rods.append(s3d.wire(&class="tok-comment">#39;crossbar39;,path=[(-leg_x,leg_front,shoulder*half-rail*half),(leg_x,leg_front,shoulder*half-rail*half)],d=rail*half))
neck=s3d.at(s3d.cylinder(&class="tok-comment">#39;connector39;,d=rail+rail*half,h=bottom-lower_h+rail*half),y=leg_front*half,z=lower_h)
for solid in (tank,ledge):
s3d.material(solid,kind=&class="tok-comment">#39;plasticclass="tok-string">39;,color=39;#d9ddd939;)
for solid in (container,neck):
s3d.material(solid,kind=&class="tok-comment">#39;plasticclass="tok-string">39;,color=39;#777e7939;)
for rod in rods:
s3d.material(rod,kind=&class="tok-comment">#39;aluminiumclass="tok-string">39;,color=39;#989e9b39;)
wheel_part=s3d.at(wheels(),x=0,y=149,z=0)
lid_part=s3d.at(lid(),x=0,y=70.5,z=panel_bottom)
cap_part=s3d.at(cap(),x=-299.5,y=31,z=1318)
parent=s3d.group(&class="tok-comment">#39;body_group39;,tank,container,ledge,neck,*rods,wheel_part,lid_part,cap_part)
s3d.joint(&class="tok-comment">#39;joint_wheels_01_joint_00class="tok-string">39;,wheel_part,on=s3d.local(parent,x=0,y=149,z=50),kind=39;continuousclass="tok-string">39;,axis=39;-X39;)
s3d.joint(&class="tok-comment">#39;joint_lid_01_joint_00class="tok-string">39;,lid_part,on=s3d.local(parent,x=0,y=70,z=917),kind=39;revoluteclass="tok-string">39;,axis=39;-X39;,range=(-3,90))
s3d.joint(&class="tok-comment">#39;joint_cap_01_joint_00class="tok-string">39;,cap_part,on=s3d.local(parent,x=-299,y=31,z=1359,rx=0,ry=133.4),kind=39;continuousclass="tok-string">39;,axis=39;normal39;)
return parent
def wheels(w=251,d=100,h=101,t=34):
wheel=s3d.at(s3d.cylinder(&class="tok-comment">#39;wheel39;,d=d,h=t),x=-w/2,y=0,z=h/2,ry=90)
other=s3d.at(s3d.copy(wheel),x=w/2-t)
axle=s3d.at(s3d.cylinder(&class="tok-comment">#39;axle39;,d=t/3,h=w-t),x=-w/2+t/2,z=h/2,ry=90)
s3d.material(wheel,kind=&class="tok-comment">#39;rubberclass="tok-string">39;,color=39;#30343139;)
s3d.material(other,kind=&class="tok-comment">#39;rubberclass="tok-string">39;,color=39;#30343139;)
s3d.material(axle,kind=&class="tok-comment">#39;steelclass="tok-string">39;,color=39;#8b918e39;)
return s3d.group(&class="tok-comment">#39;wheels_group39;,wheel,other,axle)
def lid(w=325,d=26,h=498,leg=42,opening=135,corner=40):
outline=s3d.poly([(-w/2,0),(-w/2,h-corner),(-w/2+corner,h),(w/2-corner,h),(w/2,h-corner),(w/2,0),(w/2-leg,0),(w/2-leg,opening), (w/2-leg*1.6,opening), (w/2-leg*2,opening+35),(-w/2+leg*2,opening+35),(-w/2+leg*1.6,opening),(-w/2+leg,opening),(-w/2+leg,0)])
panel=s3d.at(s3d.extrude(&class="tok-comment">#39;lid_panel39;,outline,h=d),y=d/2,rx=90)
s3d.material(panel,kind=&class="tok-comment">#39;plasticclass="tok-string">39;,color=39;#b9c2bb39;)
return s3d.group(&class="tok-comment">#39;lid_group39;,panel)
def cap(d=88,t=22,h=82,tilt=-46.6):
disk=s3d.cylinder(&class="tok-comment">#39;cap_disk39;,d=d,h=t)
boss=s3d.at(s3d.cylinder(&class="tok-comment">#39;cap_boss39;,d=d*2/3,h=t/3),z=t-1)
s3d.join(disk,boss)
s3d.fillet(disk,r=t/8)
disk=s3d.at(disk,x=t/3,z=h/2-t/3,ry=tilt)
s3d.material(disk,kind=&class="tok-comment">#39;plasticclass="tok-string">39;,color=39;#606c6239;)
return s3d.group(&class="tok-comment">#39;cap_group39;,disk)