import sand3d as s3d
def drum_press():
root = s3d.at(frame_tank_tower(), x=-111.5, y=7, z=-1)
return s3d.assembly(&class="tok-comment">#39;drum_press39;, root)
def frame_tank_tower(cx=111.5, cy=-7, base=1, drum_x=-139, drum_d=567, drum_h=1007, band_d=615, band_h=76, band_z=270, band_pitch=319, post_x=190, post_y=354, angle=50, wall=8, rail_z=1050, housing_z=1105, housing_h=355, housing_w=328, housing_y=175, plate_w=350, upper_h=340):
frame_h=rail_z+angle
low_z=angle*2+wall*2
plate_t=wall*2
solids=[]
tank=s3d.cylinder(&class="tok-comment">#39;drum39;, d=drum_d, h=drum_h-band_h*2/3)
solids.append(s3d.at(tank, x=cx+drum_x, y=cy, z=base+band_h/3))
for z in (band_z, band_z+band_pitch, band_z+band_pitch*2):
band=s3d.cylinder(&class="tok-comment">#39;rounded_band39;, d=band_d, h=band_h)
s3d.fillet(band, r=band_h/3)
solids.append(s3d.at(band, x=cx+drum_x, y=cy, z=base+z-band_h/2))
for z in (0,drum_h-band_h/3):
rim=s3d.tube(&class="tok-comment">#39;drum_rim39;, d=drum_d+wall*3, d_in=drum_d-wall*4, h=band_h/3+base)
solids.append(s3d.at(rim,x=cx+drum_x,y=cy,z=base+z))
for sx in (-1,1):
for sy in (-1,1):
profile=s3d.poly([(-angle/2,-angle/2),(angle/2,-angle/2),(angle/2,-angle/2+wall),(-angle/2+wall,-angle/2+wall),(-angle/2+wall,angle/2),(-angle/2,angle/2)])
p=s3d.extrude(&class="tok-comment">#39;angle_post39;,profile,h=frame_h)
solids.append(s3d.at(p,x=cx+sx*post_x,y=cy+sy*post_y,z=base,rz=(90 if sx>0 else 0)+(180 if sy>0 and sx<0 else 0)+(90 if sy>0 else 0)))
for sy in (-1,1):
for z in (0,rail_z,band_z+band_pitch*2-angle*2,band_z+band_pitch*2):
rail=s3d.box(&class="tok-comment">#39;cross_rail39;,w=post_x*2+angle,d=wall,h=angle)
flange=s3d.at(s3d.box(&class="tok-comment">#39;rail_flange39;,w=post_x*2+angle,d=angle,h=wall),y=-sy*(angle-wall)/2)
rail=s3d.join(rail,flange)
solids.append(s3d.at(rail,x=cx,y=cy+sy*(post_y+angle/2-wall/2),z=base+z))
for sx in (-1,1):
web=s3d.box(&class="tok-comment">#39;top_rail_web39;,w=wall,d=post_y*2,h=angle)
flange=s3d.at(s3d.box(&class="tok-comment">#39;top_long_rail39;,w=angle,d=post_y*2,h=wall),x=-sx*(angle-wall)/2,z=angle-wall)
rail=s3d.join(web,flange)
solids.append(s3d.at(rail,x=cx+sx*(post_x+angle/2-wall/2),y=cy,z=base+rail_z))
brace=s3d.extrude(&class="tok-comment">#39;diagonal39;,s3d.poly([(-post_y,low_z),(-post_y,low_z+angle+plate_t),(post_y,rail_z),(post_y,rail_z-angle-plate_t)]),h=wall)
solids.append(s3d.at(brace,x=cx+post_x+angle/2-wall*2,y=cy,z=base,rx=90,rz=90))
flange=s3d.extrude(&class="tok-comment">#39;diagonal_flange39;,s3d.poly([(-post_y,low_z),(-post_y,low_z+wall),(post_y,rail_z-angle-plate_t+wall),(post_y,rail_z-angle-plate_t)]),h=angle-wall)
solids.append(s3d.at(flange,x=cx+post_x-angle/2,y=cy,z=base,rx=90,rz=90))
bottom=s3d.box(&class="tok-comment">#39;bottom_long_rail39;,w=wall,d=post_y*2,h=angle)
solids.append(s3d.at(bottom,x=cx+post_x+angle/2-wall*2,y=cy,z=base+low_z))
housing=s3d.shell(s3d.box(&class="tok-comment">#39;lower_housingclass="tok-string">39;,w=housing_w-angle*2+wall*2,d=housing_w-angle*2+wall*2,h=housing_h),t=wall,open=39;+X top39;)
solids.append(s3d.at(housing,x=cx,y=cy+housing_y,z=base+housing_z+plate_t))
for sy in (-1,1):
mount=s3d.box(&class="tok-comment">#39;tower_mount39;,w=plate_w+wall*2,d=angle+plate_t*2,h=wall*2)
solids.append(s3d.at(mount,x=cx,y=cy+housing_y+sy*(housing_w-angle)/2,z=base+frame_h-wall/2))
for sx in (-1,1):
col=s3d.box(&class="tok-comment">#39;housing_corner39;,w=angle,d=angle,h=housing_h)
solids.append(s3d.at(col,x=cx+sx*(housing_w-angle)/2,y=cy+housing_y+sy*(housing_w-angle)/2,z=base+housing_z))
for z in (housing_z+housing_h,housing_z+housing_h+upper_h):
plate=s3d.box(&class="tok-comment">#39;overhanging_plate39;,w=plate_w,d=plate_w,h=plate_t)
solids.append(s3d.at(plate,x=cx,y=cy+housing_y,z=base+z))
upper=s3d.cylinder(&class="tok-comment">#39;upper_cylinder39;,d=housing_w,h=upper_h)
solids.append(s3d.at(upper,x=cx,y=cy+housing_y,z=base+housing_z+housing_h))
ribs=s3d.at(s3d.cylinder(&class="tok-comment">#39;tie_rod39;,d=wall*3/2,h=upper_h+plate_t),on=s3d.ring(n=8,r=plate_w/2+wall,start=30))
ribs=s3d.transform(ribs,x=cx,y=cy+housing_y,z=base+housing_z+housing_h)
solids.extend(ribs)
fixed=s3d.join(solids[0],*solids[1:])
s3d.material(fixed,&class="tok-comment">#39;painted_metalclass="tok-string">39;,color=39;#60696739;)
parent=s3d.group(&class="tok-comment">#39;fixed_structure39;,fixed)
crank=s3d.at(crank_handle(),x=cx+31.5,y=cy+407,z=base+1248)
arrow=s3d.at(gauge_arrow(),x=cx+180,y=cy+373,z=base+1234)
door=s3d.at(access_door(),x=cx+159.5,y=cy+170.5,z=base+1147)
ram=s3d.at(press_ram(),x=cx-2.5,y=cy+175,z=base+1440)
s3d.joint(&class="tok-comment">#39;joint_handle_01_joint_00class="tok-string">39;,crank,on=s3d.local(parent,x=142.5,y=410,z=1340),kind=39;continuousclass="tok-string">39;,axis=39;+Y39;)
s3d.joint(&class="tok-comment">#39;joint_arrow_01_joint_00class="tok-string">39;,arrow,on=s3d.local(parent,x=290.5,y=366,z=1247),kind=39;continuousclass="tok-string">39;,axis=39;+X39;)
s3d.joint(&class="tok-comment">#39;joint_doorframe_01_joint_00class="tok-string">39;,door,on=s3d.local(parent,x=279.5,y=27,z=1301),kind=39;revoluteclass="tok-string">39;,axis=39;+Z39;,range=(-179,0))
s3d.joint(&class="tok-comment">#39;joint_press_01_joint_00class="tok-string">39;,ram,on=s3d.local(parent,x=109.5,y=168,z=1459),kind=39;prismaticclass="tok-string">39;,axis=39;+Z39;,range=(-274.8,0))
return s3d.group(&class="tok-comment">#39;frame_tank_tower39;,parent,crank,arrow,door,ram)
def crank_handle(w=27,d=32,h=104,rod=8):
arm=s3d.cylinder(&class="tok-comment">#39;crank_arm39;,d=rod,h=h-w/2)
grip=s3d.at(s3d.cylinder(&class="tok-comment">#39;grip39;,d=w,h=d),y=-d/2,z=h-w/2,rx=-90)
s3d.material(arm,&class="tok-comment">#39;steelclass="tok-string">39;,color=39;#777b7c39;)
s3d.material(grip,&class="tok-comment">#39;rubberclass="tok-string">39;,color=39;#292d2b39;)
return s3d.group(&class="tok-comment">#39;crank_handle39;,arm,grip)
def gauge_arrow(w=2,d=4,h=25):
pointer=s3d.box(&class="tok-comment">#39;pointer39;,w=w,d=d,h=h)
s3d.material(pointer,&class="tok-comment">#39;painted_metalclass="tok-string">39;,color=39;#c3292339;)
return s3d.group(&class="tok-comment">#39;gauge_arrow39;,pointer)
def access_door(w=37,d=283,h=277,t=8):
panel=s3d.box(&class="tok-comment">#39;door_panel39;,w=t,d=d,h=h)
s3d.material(panel,&class="tok-comment">#39;painted_metalclass="tok-string">39;,color=39;#59635d39;)
return s3d.group(&class="tok-comment">#39;access_door39;,panel)
def press_ram(w=223,h=304,shaft=64,t=14):
disk=s3d.cylinder(&class="tok-comment">#39;press_disk39;,d=w,h=t)
stem=s3d.at(s3d.cylinder(&class="tok-comment">#39;ram_shaft39;,d=shaft,h=h-t),z=t/2)
s3d.material(disk,&class="tok-comment">#39;steelclass="tok-string">39;,color=39;#80858639;)
s3d.material(stem,&class="tok-comment">#39;chromeclass="tok-string">39;,color=39;#a2a7a839;)
return s3d.group(&class="tok-comment">#39;press_ram39;,disk,stem)