import sand3d as s3d
def sliding_post():
base = s3d.at(frame(), x=188, y=123.5)
slider = s3d.at(sliding_container(), x=188.5, y=-91, z=946)
s3d.joint(&class="tok-comment">#39;joint_slidingContainer_01_joint_00class="tok-string">39;, slider, on=s3d.local(base, x=-6, y=-277, z=1217), kind=39;prismaticclass="tok-string">39;, axis=39;+Z39;, range=(-944.1,655.9))
return s3d.assembly(&class="tok-comment">#39;sliding_post39;, base, slider)
def frame(w=358, d=447, h=2171, foot_h=45, post_w=254, post_d=262, post_y=30.5, front_r=50, rear_r=15, bump_w=98, bump_d=48, bump_h=190, cap_drop=42, cap_h=140, wall=3):
foot = s3d.extrude(&class="tok-comment">#39;foot39;, s3d.rect(w=w, d=d, r=30), h=foot_h)
a = post_w/2
b = post_d/2
profile = s3d.poly([(-a+front_r,-b),(a-front_r,-b),s3d.tangent_arc((a,-b+front_r)),(a,b-2*rear_r),(a-rear_r,b-2*rear_r),(a-rear_r,b-rear_r),s3d.tangent_arc((a-2*rear_r,b)),(-a+2*rear_r,b),s3d.tangent_arc((-a+rear_r,b-rear_r)),(-a+rear_r,b-2*rear_r),(-a,b-2*rear_r),(-a,-b+front_r),s3d.tangent_arc((-a+front_r,-b))])
post = s3d.at(s3d.extrude(&class="tok-comment">#39;post39;, profile, h=h-foot_h-cap_h+1), y=post_y, z=foot_h-1)
cap = s3d.at(s3d.extrude(&class="tok-comment">#39;cap39;, profile, h=cap_h), y=post_y, z=h-cap_h-1)
top_tool = s3d.at(s3d.box(&class="tok-comment">#39;top_trim39;, w=w, d=d*2, h=cap_drop*4), y=post_y, z=h-cap_drop/2, rx=-9)
cap = s3d.cut(cap, top_tool)
rear = s3d.at(s3d.box(&class="tok-comment">#39;rear_structure39;, w=post_w-2*rear_r, d=wall, h=h-foot_h-cap_h), y=post_y+b-2*rear_r, z=foot_h)
front = s3d.at(s3d.box(&class="tok-comment">#39;front_structure39;, w=post_w-wall, d=wall, h=h-foot_h-cap_h), y=post_y-b+front_r, z=foot_h)
bump = s3d.at(s3d.box(&class="tok-comment">#39;stop39;, w=bump_w, d=bump_d, h=bump_h), y=post_y+post_d/2+bump_d/2-1, z=foot_h-1)
for ob in [foot,post,cap,bump,rear,front]:
s3d.material(ob, &class="tok-comment">#39;painted_metalclass="tok-string">39;, color=39;#777a7c39;)
return s3d.group(&class="tok-comment">#39;frame39;, foot, post, cap, bump, rear, front)
def sliding_container(w=553, d=340, h=564, slab_d=134, wall=3, dip=35, carriage_w=292, carriage_d=80, carriage_h=272, stem_w=130, stem_h=174, wire_d=30, loop_r=85):
outline = s3d.poly([(-w/2,0),(w/2,0),(w/2,h),(w/4,h),s3d.spline([(w/4,h),(w/8,h-dip),(0,h-dip),(-w/8,h-dip),(-w/4,h)]),(-w/2,h)], fillet=wall*4)
slab = s3d.at(s3d.shell(s3d.extrude(&class="tok-comment">#39;slab39;, outline, h=slab_d), t=wall), y=-d/2+slab_d, rx=90)
panel = s3d.at(s3d.box(&class="tok-comment">#39;inner_panel39;, w=w-stem_w, d=wall, h=h-stem_h), y=-d/2+dip, z=stem_h/2)
stem = s3d.at(s3d.box(&class="tok-comment">#39;connection39;, w=stem_w, d=slab_d, h=stem_h), y=wire_d, z=carriage_h-stem_h/2)
carriage = s3d.at(s3d.extrude(&class="tok-comment">#39;carriage39;, s3d.rect(w=carriage_w, d=carriage_d, r=wire_d), h=carriage_h), y=d/2-carriage_d/2, z=(h-carriage_h)/3)
loop = s3d.wire(&class="tok-comment">#39;loop39;, s3d.spline([(-w/2+wire_d,-dip,stem_h),(-w/2+wire_d,loop_r,stem_h),(-w/2+wire_d*2,loop_r+wire_d,stem_h+loop_r),(-w/2+wire_d*3,loop_r,stem_h+loop_r*2),(-w/2+wire_d*3,-dip,stem_h+loop_r*2)]), d=wire_d)
twin = s3d.transform(s3d.copy(loop), mirror=&class="tok-comment">#39;x39;)
upper = s3d.wire(&class="tok-comment">#39;upper_loop39;, [(-w/2+wire_d,-dip,h-dip),(-w/2+wire_d,loop_r/2,h-dip),(-w/2+wire_d,loop_r/2,h-stem_h),(-w/2+wire_d,-dip,h-stem_h)], d=wire_d/2, fillet=wire_d)
upper_twin = s3d.transform(s3d.copy(upper), mirror=&class="tok-comment">#39;x39;)
for ob in [slab, panel, stem, carriage, loop, twin, upper, upper_twin]:
s3d.material(ob, &class="tok-comment">#39;painted_metalclass="tok-string">39;, color=39;#70747739;)
button_three_placed = s3d.at(button_three(), x=-245.5, y=-21.5, z=394)
button_two_placed = s3d.at(button_two(), x=-245.5, y=-21.5, z=421)
button_one_placed = s3d.at(button_one(), x=-245.5, y=-21.5, z=447)
button_four_placed = s3d.at(button_four(), x=-245, y=-21.5, z=368)
parent = s3d.group(&class="tok-comment">#39;sliding_container39;, slab, panel, stem, carriage, loop, twin, upper, upper_twin, button_three_placed, button_two_placed, button_one_placed, button_four_placed)
s3d.joint(&class="tok-comment">#39;joint_button_03_joint_00class="tok-string">39;, button_three_placed, on=s3d.local(parent, x=-245, y=-21, z=403), kind=39;prismaticclass="tok-string">39;, axis=39;+X39;, range=(0,2.6))
s3d.joint(&class="tok-comment">#39;joint_button_02_joint_00class="tok-string">39;, button_two_placed, on=s3d.local(parent, x=-245, y=-21, z=429), kind=39;prismaticclass="tok-string">39;, axis=39;+X39;, range=(0,2.2))
s3d.joint(&class="tok-comment">#39;joint_button_01_joint_00class="tok-string">39;, button_one_placed, on=s3d.local(parent, x=-245, y=-21, z=455), kind=39;prismaticclass="tok-string">39;, axis=39;+X39;, range=(0,2.6))
s3d.joint(&class="tok-comment">#39;joint_button_04_joint_00class="tok-string">39;, button_four_placed, on=s3d.local(parent, x=-246, y=-21, z=376), kind=39;prismaticclass="tok-string">39;, axis=39;+X39;, range=(0,2.5))
return parent
def button_three(w=6, d=17, h=17):
ob = s3d.box(&class="tok-comment">#39;button_three39;, w=w, d=d, h=h)
s3d.material(ob, &class="tok-comment">#39;rubberclass="tok-string">39;, color=39;#34363839;)
return s3d.group(&class="tok-comment">#39;button_three39;, ob)
def button_two(w=6, d=17, h=16):
ob = s3d.box(&class="tok-comment">#39;button_two39;, w=w, d=d, h=h)
s3d.material(ob, &class="tok-comment">#39;rubberclass="tok-string">39;, color=39;#34363839;)
return s3d.group(&class="tok-comment">#39;button_two39;, ob)
def button_one(w=6, d=17, h=16):
ob = s3d.box(&class="tok-comment">#39;button_one39;, w=w, d=d, h=h)
s3d.material(ob, &class="tok-comment">#39;rubberclass="tok-string">39;, color=39;#34363839;)
return s3d.group(&class="tok-comment">#39;button_one39;, ob)
def button_four(w=5, d=17, h=16):
ob = s3d.box(&class="tok-comment">#39;button_four39;, w=w, d=d, h=h)
s3d.material(ob, &class="tok-comment">#39;rubberclass="tok-string">39;, color=39;#34363839;)
return s3d.group(&class="tok-comment">#39;button_four39;, ob)