import sand3d as s3d
def mop_cart():
base = s3d.at(bucket(), x=-214, y=-14, z=83)
stick = s3d.at(mop(), x=298, y=122, z=0)
bail = s3d.at(carry_handle(), x=-214, y=-146.5, z=304)
s3d.joint(&class="tok-comment">#39;joint_sm_handle_a01_joint_00class="tok-string">39;, bail, s3d.local(base, x=0, y=11, z=341), axis=39;+X39;, range=(-140,0))
a = s3d.at(caster_two(), x=-346, y=185.5, z=33)
b = s3d.at(caster_one(), x=-346, y=-215.5, z=33)
c = s3d.at(caster_three(), x=-82, y=185.5, z=33)
d = s3d.at(caster_four(), x=-82, y=-215.5, z=33)
s3d.joint(&class="tok-comment">#39;joint_sm_wheel2_a01_joint_00class="tok-string">39;, a, s3d.local(base,x=-132,y=207,z=7),axis=39;+Z39;,range=(-3.1,3.1))
s3d.joint(&class="tok-comment">#39;joint_sm_wheel1_a01_joint_00class="tok-string">39;, b, s3d.local(base,x=-132,y=-194,z=7),axis=39;+Z39;,range=(-3.1,3.1))
s3d.joint(&class="tok-comment">#39;joint_sm_wheel3_a01_joint_00class="tok-string">39;, c, s3d.local(base,x=132,y=207,z=7),axis=39;+Z39;,range=(-3.1,3.1))
s3d.joint(&class="tok-comment">#39;joint_sm_wheel4_a01_joint_00class="tok-string">39;, d, s3d.local(base,x=132,y=-194,z=7),axis=39;+Z39;,range=(-3.1,3.1))
return s3d.assembly(&class="tok-comment">#39;mop_cart39;,base,stick,bail,a,b,c,d)
def bucket(w=380,d=532,h=377,t=10,band_h=42,wr_w=245,wr_d=280,wr_h=420,lever_h=460,n=3):
lower_w = w-t*2
lower_d = d-t*2
floor_z = h-t*8
tub = s3d.loft(&class="tok-comment">#39;bucket39;,s3d.station(z=0,w=w,d=lower_d,n=n),s3d.station(z=band_h,w=w,d=lower_d,n=n),s3d.station(z=band_h*2,w=lower_w,d=lower_d,n=n),s3d.station(z=h/n,w=lower_w,d=lower_d,n=n),s3d.station(z=h/2,w=w,d=lower_d,n=n),s3d.station(z=h,w=w,d=d,n=n))
tub = s3d.shell(tub,t=t,open=&class="tok-comment">#39;end39;)
lip = s3d.extrude(&class="tok-comment">#39;rolled_lip39;,s3d.superellipse(w=w+t,d=d+t,n=n),h=t)
lip = s3d.pocket(lip,s3d.superellipse(w=w-t,d=d-t,n=n))
lip = s3d.at(lip,z=h-t/2)
panel = s3d.extrude(&class="tok-comment">#39;wringer_side39;,s3d.poly(pts=[(-t*1.5,floor_z),(wr_d+t,floor_z-t),(wr_d+t,h+t*12),(-t*1.5,h+t*19)]),h=t)
panel = s3d.at(panel,rx=90,rz=90,x=-wr_w/2)
twin = s3d.transform(s3d.copy(panel),mirror=&class="tok-comment">#39;x39;)
back = s3d.at(s3d.box(&class="tok-comment">#39;wringer_back39;,w=wr_w,d=t,h=wr_h/2),y=wr_d+t,z=floor_z-t)
front = s3d.at(s3d.box(&class="tok-comment">#39;press_plate39;,w=wr_w-t*2,d=t,h=wr_h/2+t*2),y=t*4,z=floor_z)
slope = s3d.at(s3d.box(&class="tok-comment">#39;inclined_plate39;,w=wr_w-t*2,d=t,h=wr_h/2+t*2),y=wr_d*2/n,z=floor_z,rx=-8)
floor = s3d.at(s3d.box(&class="tok-comment">#39;wringer_floor39;,w=wr_w,d=wr_d/2,h=t),y=wr_d/2,z=floor_z)
funnel = s3d.loft(&class="tok-comment">#39;drain_funnel39;,s3d.station(z=h-t*23,w=wr_w*2/n,d=wr_d/2,y=wr_d/2,n=4),s3d.station(z=floor_z,w=wr_w-t*2,d=wr_d/2,y=wr_d/2,n=4))
funnel = s3d.shell(funnel,t=t/2,open=&class="tok-comment">#39;start end39;)
bar = s3d.at(s3d.box(&class="tok-comment">#39;crossbar39;,w=wr_w+t*2,d=t*2,h=t*2),y=wr_d,z=h+wr_h/6)
lever = s3d.wire(&class="tok-comment">#39;wringer_lever39;,path=[(w/2,wr_d-t,h-t*4),(w/2,wr_d-t,h+lever_h-t*4),(w/2,wr_d-t*5,h+lever_h)],d=t*1.6)
for ob in (tub,lip):
s3d.material(ob,&class="tok-comment">#39;plasticclass="tok-string">39;,color=39;#e9bc2039;)
for ob in (panel,twin,back,front,slope,floor,funnel,bar,lever):
s3d.material(ob,&class="tok-comment">#39;plasticclass="tok-string">39;,color=39;#555b6039;)
return s3d.group(&class="tok-comment">#39;bucket39;,tub,lip,panel,twin,back,front,slope,floor,funnel,bar,lever)
def mop(h=1722,shaft_d=23,grip_d=28,grip_h=144,head_w=300,head_d=360,head_h=45,clamp_w=174,clamp_h=110):
shaft = s3d.at(s3d.cylinder(&class="tok-comment">#39;shaft39;,d=shaft_d,h=h-grip_h),z=clamp_h)
grip = s3d.at(s3d.cylinder(&class="tok-comment">#39;grip39;,d=grip_d,h=grip_h),z=h-grip_h)
s3d.fillet(grip,r=grip_d/3)
head = s3d.loft(&class="tok-comment">#39;mop_cloth39;,s3d.station(z=0,w=head_w,d=head_d,n=2.4,y=-head_d/3),s3d.station(z=head_h/2,w=head_w,d=head_d,n=2.4,y=-head_d/3),s3d.station(z=head_h,w=head_w*0.7,d=head_d*0.5,n=2,y=-head_d/4))
clamp = s3d.at(s3d.box(&class="tok-comment">#39;mop_clamp39;,w=clamp_w,d=35,h=clamp_h),y=0,z=head_h/2,rx=-12)
frame = s3d.wire(&class="tok-comment">#39;clamp_frame39;,path=[(-clamp_w/2,0,clamp_h),(-clamp_w/2,0,clamp_h*2),(clamp_w/2,0,clamp_h*2),(clamp_w/2,0,clamp_h)],d=12)
s3d.material(shaft,&class="tok-comment">#39;chrome39;)
s3d.material(grip,&class="tok-comment">#39;rubberclass="tok-string">39;,color=39;#33383a39;)
s3d.material(head,&class="tok-comment">#39;fabricclass="tok-string">39;,color=39;#ccc8b539;)
s3d.material(clamp,&class="tok-comment">#39;plasticclass="tok-string">39;,color=39;#454b4e39;)
s3d.material(frame,&class="tok-comment">#39;steel39;)
return s3d.group(&class="tok-comment">#39;mop39;,shaft,grip,head,clamp,frame)
def carry_handle(w=456,d=315,h=130,t=18):
plan = [(-w/2+t/2,d/2-t/2),(-w/2+t,-d/6),(-w/2+t*2,-d/3),(-w/3,-d/2+t*1.5),(0,-d/2+t/2),(w/3,-d/2+t*1.5),(w/2-t*2,-d/3),(w/2-t,-d/6),(w/2-t/2,d/2-t/2)]
points = [(x,y,(y+d/2)*(h-t)/d+t/2) for x,y in plan]
bail = s3d.wire(&class="tok-comment">#39;bail39;,path=s3d.spline(pts=points),d=t)
s3d.material(bail,&class="tok-comment">#39;plasticclass="tok-string">39;,color=39;#454b5039;)
return s3d.group(&class="tok-comment">#39;carry_handle39;,bail)
def caster_two(w=36,d=49,h=77):
solid = fork(w=w,d=d,h=h)
tire = s3d.at(tire_two(),y=-17.5,z=-31)
s3d.joint(&class="tok-comment">#39;joint_sm_tire2_a01_joint_00class="tok-string">39;,tire,s3d.local(solid,x=0,y=-17.5,z=8),kind=39;continuousclass="tok-string">39;,axis=39;+X39;)
return s3d.group(&class="tok-comment">#39;caster_two39;,solid,tire)
def fork(w=36,d=49,h=77):
stem = s3d.at(s3d.cylinder(&class="tok-comment">#39;swivel39;,d=w,h=h/2),y=d/6,z=h/2)
arm = s3d.at(s3d.box(&class="tok-comment">#39;fork39;,w=w,d=d,h=h*0.7),z=0)
arm = s3d.pocket(arm,s3d.rect(w=w*0.75,d=d),depth=h*0.6,on=arm.face(&class="tok-comment">#39;bottom39;))
s3d.material(stem,&class="tok-comment">#39;steel39;)
s3d.material(arm,&class="tok-comment">#39;plasticclass="tok-string">39;,color=39;#555b6039;)
return s3d.group(&class="tok-comment">#39;fork39;,stem,arm)
def tire_two(w=26,d=76):
return s3d.group(&class="tok-comment">#39;tire_two39;,wheel(w=w,d=d))
def wheel(w=26,d=76):
ob = s3d.cylinder(&class="tok-comment">#39;tire39;,d=d,h=w)
s3d.fillet(ob,r=w/5)
ob = s3d.at(ob,ry=90,x=-w/2,z=d/2)
s3d.material(ob,&class="tok-comment">#39;rubberclass="tok-string">39;,color=39;#343b3c39;)
return ob
def caster_one(w=36,d=47,h=77):
solid = fork(w=w,d=d,h=h)
tire = s3d.at(tire_one(),y=-17.5,z=-32)
s3d.joint(&class="tok-comment">#39;joint_sm_tire1_a01_joint_00class="tok-string">39;,tire,s3d.local(solid,x=0,y=-17.5,z=8),kind=39;continuousclass="tok-string">39;,axis=39;+X39;)
return s3d.group(&class="tok-comment">#39;caster_one39;,solid,tire)
def tire_one(w=26,d=78):
return s3d.group(&class="tok-comment">#39;tire_one39;,wheel(w=w,d=d))
def caster_three(w=36,d=47,h=77):
solid = fork(w=w,d=d,h=h)
tire = s3d.at(tire_three(),y=-17.5,z=-32)
s3d.joint(&class="tok-comment">#39;joint_sm_tire3_a01_joint_00class="tok-string">39;,tire,s3d.local(solid,x=0,y=-17.5,z=8),kind=39;continuousclass="tok-string">39;,axis=39;+X39;)
return s3d.group(&class="tok-comment">#39;caster_three39;,solid,tire)
def tire_three(w=26,d=78):
return s3d.group(&class="tok-comment">#39;tire_three39;,wheel(w=w,d=d))
def caster_four(w=36,d=49,h=77):
solid = fork(w=w,d=d,h=h)
tire = s3d.at(tire_four(),y=-17.5,z=-31)
s3d.joint(&class="tok-comment">#39;joint_sm_tire4_a01_joint_00class="tok-string">39;,tire,s3d.local(solid,x=0,y=-17.5,z=8),kind=39;continuousclass="tok-string">39;,axis=39;+X39;)
return s3d.group(&class="tok-comment">#39;caster_four39;,solid,tire)
def tire_four(w=26,d=76):
return s3d.group(&class="tok-comment">#39;tire_four39;,wheel(w=w,d=d))