import sand3d as s3d
def reservoir():
root = s3d.at(tank_body(), x=0, y=0, z=0)
return s3d.assembly(class="tok-string">"reservoir", root)
def tank_body(diameter=175, axis_h=107.5, start=-152, length=366, shoulder=15, rim=30, band_d=179, band_w=36, band_a=-110, band_b=133, valve_y=-180):
r = diameter / 2
shell = s3d.revolve(class="tok-string">"shell", s3d.poly(pts=[(0,0),(rim,0),(r-7,shoulder-5),(r,shoulder),(r,length-shoulder),(r-7,length-5),(rim,length),(0,length)]))
shell = s3d.at(shell, y=start, z=axis_h, rx=-90)
recess = s3d.at(s3d.tube(class="tok-string">"end_rim", d=82, d_in=62, h=4), y=start+length-1, z=axis_h, rx=90)
bands=[]
for y in (band_a, band_b):
band=s3d.at(s3d.tube(class="tok-string">"band", d=band_d, d_in=diameter-2, h=band_w), y=y, z=axis_h, rx=-90)
bands.append(band)
boss=s3d.at(s3d.cylinder(class="tok-string">"neck", d=60, h=shoulder), y=start+1, z=axis_h, rx=90)
valve=s3d.at(s3d.cylinder(class="tok-string">"valve", d=24, h=70), x=-8, y=valve_y, z=76)
cap=s3d.at(s3d.cylinder(class="tok-string">"valve_cap", d=32, h=15), x=-8, y=valve_y, z=146)
cross=s3d.at(s3d.cylinder(class="tok-string">"cross_tube", d=18, h=78), x=-18, y=valve_y-3, z=axis_h, ry=90)
inlet=s3d.at(s3d.cylinder(class="tok-string">"inlet", d=24, h=40), y=valve_y+12, z=axis_h, rx=90)
solids=[shell,recess,boss,valve,cap,cross,inlet]+bands
for ob in solids:
s3d.material(ob, kind=class="tok-string">"painted_metal", color=class="tok-string">"class="tok-comment">#656b61")
support=s3d.at(support_plate(), x=76, y=29, z=0)
image=s3d.transform(s3d.copy(support), mirror=class="tok-string">"x")
handle=s3d.at(operating_handle(), x=-41, y=-216.5, z=91)
pin=s3d.at(locking_pin(), x=0, y=-222, z=102)
arrow=s3d.at(indicator_arrow(), x=-4.5, y=-177.5, z=159)
root=s3d.group(class="tok-string">"tank_body", *solids, support, image, handle, pin, arrow)
s3d.joint(class="tok-string">"joint_handle_01_joint_00", handle, s3d.local(root, x=19, y=-198, z=107), kind=class="tok-string">"revolute", axis=class="tok-string">"+Z", range=(-14,0))
s3d.joint(class="tok-string">"joint_pin_01_joint_00", pin, s3d.local(root, x=0, y=-226, z=108), kind=class="tok-string">"prismatic", axis=class="tok-string">"+Y", range=(0,9.1))
s3d.joint(class="tok-string">"joint_arrow_01_joint_00", arrow, s3d.local(root, x=-8, y=-175, z=159), kind=class="tok-string">"revolute", axis=class="tok-string">"+Z", range=(-104,0))
return root
def support_plate(w=32, depth=57, t=2, height=36, span=234, offset=7, upright_w=12):
solids=[]
for y in (-span/2,span/2):
foot=s3d.extrude(class="tok-string">"foot", s3d.rect(w=w,d=depth,r=t), h=t)
foot=s3d.pocket(foot, s3d.slot(l=depth-12,d=7), on=foot.face(class="tok-string">"top").turn(rz=90))
foot=s3d.at(foot,x=offset,y=y)
solids.append(foot)
for end in (-1,1):
web=s3d.extrude(class="tok-string">"bent_web", s3d.poly(pts=[(-w/2+offset,0),(-w/2+offset+t,0),(-w/2+offset-10+t,height),(-w/2+offset-10,height)]), h=upright_w)
web=s3d.at(web,y=y+end*(depth-upright_w)/2+upright_w/2,rx=90)
solids.append(web)
for ob in solids:
s3d.material(ob, kind=class="tok-string">"painted_metal", color=class="tok-string">"class="tok-comment">#656b61")
return s3d.group(class="tok-string">"support_plate",*solids)
def operating_handle(h=34, t=2, x0=-69, y0=-31.5, bend=-51, elbow=-37, tip=67, edge=-6.5, top=24.5, ear=7, flange_x=30):
curve=s3d.spline(pts=[(x0,y0),(bend,y0-t*2),(elbow,y0-t),(tip,edge)])
skirt=s3d.extrude(class="tok-string">"curved_skirt",s3d.stroke(curve,t=t),h=h)
skirt=s3d.hole(skirt,d=ear,on=s3d.grid(nx=3,px=ear*2,on=s3d.local(skirt,x=bend+ear*2,y=y0-ear,z=h/2,rx=90)))
outline=s3d.poly(pts=[s3d.spline(pts=[(x0,y0),(bend,y0-t*2),(elbow,y0-t),(tip,edge)]),(tip,top-ear),s3d.arc(center=(tip-ear,top-ear),r=ear,start=0,end=180),(tip-ear*2,edge+20),(flange_x,edge+20),s3d.spline(pts=[(flange_x,edge+20),(flange_x-ear*2,edge+ear),(flange_x-ear*2,edge-t),(elbow,y0+t*3),(x0,y0)])])
flange=s3d.extrude(class="tok-string">"top_flange",outline,h=t)
flange=s3d.hole(flange,d=ear,on=[(tip-ear,top-ear),(flange_x,edge+ear*2)])
bottom=s3d.at(s3d.copy(flange),z=t/2)
flange=s3d.at(flange,z=h-t*2)
brace=s3d.wire(class="tok-string">"spring_brace",s3d.spline(pts=[(flange_x-ear*3,edge,h/2),(flange_x-ear*4,top+ear,h/2),(flange_x-ear*5,top+ear,h/2),(flange_x-ear*3,edge,h/2)]),d=t)
s3d.join(skirt,flange,bottom)
for ob in (skirt,brace):
s3d.material(ob,kind=class="tok-string">"painted_metal",color=class="tok-string">"class="tok-comment">#454b43")
return s3d.group(class="tok-string">"operating_handle",skirt,brace)
def locking_pin(diameter=10.5, length=12):
pin=s3d.at(s3d.cylinder(class="tok-string">"locking_pin",d=diameter,h=length),y=length/2,z=diameter/2,rx=90)
s3d.material(pin,kind=class="tok-string">"steel",color=class="tok-string">"class="tok-comment">#858984")
return s3d.group(class="tok-string">"locking_pin",pin)
def indicator_arrow(w=17, d=13, t=1, tail=2):
arrow=s3d.extrude(class="tok-string">"indicator",s3d.poly(pts=[(-w/2,d/2-tail),(-w/2+tail,d/2),(w/2,-d/2+tail/4),(w/2-tail/4,-d/2)]),h=t)
s3d.material(arrow,kind=class="tok-string">"steel",color=class="tok-string">"class="tok-comment">#a1a59c")
return s3d.group(class="tok-string">"indicator_arrow",arrow)