import sand3d as s3d
def mast_trolley():
root=s3d.at(body_01(), x=-169, y=-268, z=64)
caster=s3d.at(wheel_03(), x=12, y=-199, z=33)
other=s3d.at(wheel_03(tire_joint=&class="tok-comment">#39;joint_tire_02_joint_0039;), x=12, y=-199, z=33)
other=s3d.transform(other, mirror=&class="tok-comment">#39;x39;, x=-338)
rear=s3d.at(wheel_01(), x=-169, y=290, z=33)
s3d.joint(&class="tok-comment">#39;joint_wheel_03_joint_00class="tok-string">39;, caster, s3d.local(root,x=181,y=69,z=33),kind=39;continuousclass="tok-string">39;,axis=39;+Z39;)
s3d.joint(&class="tok-comment">#39;joint_wheel_02_joint_00class="tok-string">39;, other, s3d.local(root,x=-181,y=69,z=33),kind=39;continuousclass="tok-string">39;,axis=39;+Z39;)
s3d.joint(&class="tok-comment">#39;joint_wheel_01_joint_00class="tok-string">39;, rear, s3d.local(root,x=0,y=557,z=33),kind=39;continuousclass="tok-string">39;,axis=39;+Z39;)
return s3d.assembly(&class="tok-comment">#39;mast_trolley39;,root,caster,other,rear)
def body_01(beam_far=115,beam_near=245,length=1096,front=-489,back=578,beam_z=43,beam_h=70,platform_d=308,plate=18,mast_h=1280,mast_w=76,mast_d=139,web=4,bead=20,cap_w=122,cap_d=157,rail_x=225,rail_d=24,rail_top=657,rail_y=136,foot_w=143,foot_d=293,foot_h=58,support_w=428,support_d=114,support_y=69):
beam=s3d.at(s3d.extrude(&class="tok-comment">#39;beam39;,s3d.poly([(-beam_far/2,front),(beam_far/2,front),(beam_near/2,front+length),(-beam_near/2,front+length)]),h=beam_h),z=beam_z)
discs=[s3d.at(s3d.cylinder(&class="tok-comment">#39;platform39;,d=platform_d,h=plate),y=y,z=beam_z+beam_h) for y in (front,back)]
foot=s3d.at(s3d.box(&class="tok-comment">#39;extension39;,w=foot_w,d=foot_d,h=foot_h),y=front-foot_d/2+plate)
block=s3d.box(&class="tok-comment">#39;end_block39;,w=foot_w,d=foot_d/2,h=foot_h)
s3d.pocket(block,s3d.rect(w=foot_w/2,d=plate*2),on=block.face(&class="tok-comment">#39;top39;))
block=s3d.at(block,y=front-foot_d/4,z=beam_z+beam_h)
mast=[]
for x in (-mast_w/2,mast_w/2):
slab=s3d.box(&class="tok-comment">#39;mast_web39;,w=web,d=mast_d-bead,h=mast_h)
s3d.hole(slab,d=bead/2,on=s3d.grid(nx=1,ny=16,py=mast_h/20,on=s3d.bbox(slab,&class="tok-comment">#39;+X39;).move(y=mast_h/2)))
mast.append(s3d.at(slab,x=x,y=back,z=beam_z+beam_h+plate))
for y in (-mast_d/2+bead/2,mast_d/2-bead/2):
mast.append(s3d.at(s3d.cylinder(&class="tok-comment">#39;mast_edge39;,d=bead,h=mast_h),x=x,y=back+y,z=beam_z+beam_h+plate))
cap=s3d.at(s3d.box(&class="tok-comment">#39;cap39;,w=cap_w,d=cap_d,h=web+2),y=back,z=beam_z+beam_h+plate+mast_h)
rail=s3d.wire(&class="tok-comment">#39;handrail39;,path=[(-rail_x,back,beam_z+beam_h+plate),(-rail_x,back,rail_top/2),(-rail_x,back+rail_y,rail_top),(rail_x,back+rail_y,rail_top),(rail_x,back,rail_top/2),(rail_x,back,beam_z+beam_h+plate)],d=rail_d,fillet=rail_d)
support=s3d.at(s3d.box(&class="tok-comment">#39;cross_support39;,w=support_w,d=support_d,h=web*2),y=support_y,z=beam_z+plate)
webs=[]
for x in (-support_w/2,support_w/2):
for y in (-support_d/2,support_d/2):
ob=s3d.at(s3d.extrude(&class="tok-comment">#39;gusset39;,s3d.poly([(0,0),(support_w/4,0),(support_w/4,beam_h)]),h=web),x=-support_w/2,y=support_y+y,z=beam_z+plate,rx=90)
if x>0: ob=s3d.transform(ob,mirror=&class="tok-comment">#39;x39;)
webs.append(ob)
result=s3d.group(&class="tok-comment">#39;body_0139;,beam,discs,foot,block,mast,cap,rail,support,webs)
s3d.material(result,kind=&class="tok-comment">#39;painted_metalclass="tok-string">39;,color=39;#666b6c39;)
return result
def wheel_03(w=50,d=76,h=64,t=6,offset=28,tire_joint=&class="tok-comment">#39;joint_tire_03_joint_0039;):
top=s3d.at(s3d.cylinder(&class="tok-comment">#39;swivel39;,d=w,h=t),z=h-t)
cheeks=[s3d.at(s3d.box(&class="tok-comment">#39;fork39;,w=t,d=d,h=h-t),x=x) for x in (-(w-t)/2,(w-t)/2)]
fork=s3d.group(&class="tok-comment">#39;caster_fork39;,top,cheeks)
s3d.material(fork,kind=&class="tok-comment">#39;steelclass="tok-string">39;,color=39;#72777739;)
tire=s3d.at(tire_03(),x=-1,y=offset,z=-33)
s3d.joint(tire_joint,tire,s3d.local(fork,x=-1,y=28,z=11),kind=&class="tok-comment">#39;continuousclass="tok-string">39;,axis=39;+X39;)
return s3d.group(&class="tok-comment">#39;wheel_0339;,fork,tire)
def tire_03(w=25,d=88):
tire=s3d.at(s3d.cylinder(&class="tok-comment">#39;tire39;,d=d,h=w),x=-w/2,z=d/2,ry=90)
s3d.fillet(tire,r=w/5)
s3d.material(tire,kind=&class="tok-comment">#39;rubberclass="tok-string">39;,color=39;#30333539;)
return s3d.group(&class="tok-comment">#39;tire_0339;,tire)
def wheel_01(w=50,d=77,h=64,t=6):
top=s3d.at(s3d.cylinder(&class="tok-comment">#39;swivel39;,d=w,h=t),z=h-t)
cheeks=[s3d.at(s3d.box(&class="tok-comment">#39;fork39;,w=t,d=d,h=h-t),x=x) for x in (-(w-t)/2,(w-t)/2)]
fork=s3d.group(&class="tok-comment">#39;caster_fork39;,top,cheeks)
s3d.material(fork,kind=&class="tok-comment">#39;steelclass="tok-string">39;,color=39;#72777739;)
tire=s3d.at(tire_01(),x=-1,y=27,z=-33)
s3d.joint(&class="tok-comment">#39;joint_tire_01_joint_00class="tok-string">39;,tire,s3d.local(fork,x=-1,y=28,z=11),kind=39;continuousclass="tok-string">39;,axis=39;+X39;)
return s3d.group(&class="tok-comment">#39;wheel_0139;,fork,tire)
def tire_01(w=24,d=88):
tire=s3d.at(s3d.cylinder(&class="tok-comment">#39;tire39;,d=d,h=w),x=-w/2,z=d/2,ry=90)
s3d.fillet(tire,r=w/5)
s3d.material(tire,kind=&class="tok-comment">#39;rubberclass="tok-string">39;,color=39;#30333539;)
return s3d.group(&class="tok-comment">#39;tire_0139;,tire)