import sand3d as s3d
def stool():
b = s3d.at(base(), x=1, y=22, z=44)
t = s3d.at(seat(), x=1, y=-3, z=326)
s3d.joint(&class="tok-comment">#39;joint_sm_seat_a01_joint_00class="tok-string">39;, t, s3d.local(b, x=0, y=-25, z=282), kind=39;prismaticclass="tok-string">39;, axis=39;+Z39;, range=(-100, 0))
a = s3d.at(caster_five(), x=155, y=-227.5, z=10)
c = s3d.at(caster_two(), x=-249, y=66.5, z=10)
d = s3d.at(caster_one(), x=-154, y=-227.5, z=10)
e = s3d.at(caster_three(), x=1, y=247.5, z=10)
f = s3d.at(caster_four(), x=251, y=65.5, z=10)
s3d.joint(&class="tok-comment">#39;joint_sm_wheelbase5_a01_joint_00class="tok-string">39;, a, s3d.local(b, x=154, y=-238, z=3), axis=39;+Z39;, range=(-3.1, 3.1))
s3d.joint(&class="tok-comment">#39;joint_sm_wheelbase2_a01_joint_00class="tok-string">39;, c, s3d.local(b, x=-250, y=57, z=3), axis=39;+Z39;, range=(-3.1, 3.1))
s3d.joint(&class="tok-comment">#39;joint_sm_wheelbase1_a01_joint_00class="tok-string">39;, d, s3d.local(b, x=-155, y=-237, z=3), axis=39;+Z39;, range=(-3.1, 3.1))
s3d.joint(&class="tok-comment">#39;joint_sm_wheelbase3_a01_joint_00class="tok-string">39;, e, s3d.local(b, x=0, y=238, z=3), axis=39;+Z39;, range=(-3.1, 3.1))
s3d.joint(&class="tok-comment">#39;joint_sm_wheelbase4_a01_joint_00class="tok-string">39;, f, s3d.local(b, x=250, y=56, z=3), axis=39;+Z39;, range=(-3.1, 3.1))
return s3d.assembly(&class="tok-comment">#39;stool39;, b, t, a, c, d, e, f)
def base(post_d=52, post_h=282, hub_d=80, hub_h=61, reach=260, root_w=47, tip_w=26, root_h=48, tip_h=30):
hub = s3d.cylinder(&class="tok-comment">#39;hub39;, d=hub_d, h=hub_h)
s3d.fillet(hub, r=8, edges=&class="tok-comment">#39;top39;)
post = s3d.at(s3d.cylinder(&class="tok-comment">#39;upright39;, d=post_d, h=post_h-root_h), z=root_h)
solids = [hub, post]
for angle in (0, 72, 144, 216, 288):
spoke = s3d.loft(&class="tok-comment">#39;spoke39;, s3d.station(z=20, w=root_w, d=root_h, y=-root_h/2-6, n=4), s3d.station(z=reach-8, w=tip_w, d=tip_h, y=-tip_h/2-7, n=4), s3d.station(z=reach+12, w=tip_w, d=tip_h, y=-tip_h/2-7, n=4))
solids.append(s3d.at(spoke, rx=-90, rz=angle))
body = s3d.at(s3d.join(hub, solids[1:]), y=-25)
s3d.material(body, &class="tok-comment">#39;painted_metalclass="tok-string">39;, color=39;#55575a39;)
return s3d.group(&class="tok-comment">#39;base39;, body)
def seat(d=417, cushion_h=77, cushion_z=157, stem_d=38, stem_h=143, rim_d=410, rim_h=8):
cushion = s3d.cylinder(&class="tok-comment">#39;cushion39;, d=d, h=cushion_h)
s3d.fillet(cushion, r=20, edges=&class="tok-comment">#39;top39;)
s3d.fillet(cushion, r=4, edges=&class="tok-comment">#39;bottom39;)
cushion = s3d.at(cushion, z=cushion_z)
s3d.material(cushion, &class="tok-comment">#39;leatherclass="tok-string">39;, color=39;#24242639;)
rim = s3d.at(s3d.cylinder(&class="tok-comment">#39;lower_rim39;, d=rim_d, h=rim_h), z=cushion_z-rim_h/2)
stem = s3d.cylinder(&class="tok-comment">#39;sliding_stem39;, d=stem_d, h=stem_h)
collar = s3d.at(s3d.cone(&class="tok-comment">#39;seat_collar39;, d=stem_d, d2=120, h=18), z=stem_h-8)
plate = s3d.at(s3d.cylinder(&class="tok-comment">#39;seat_mount39;, d=150, h=10), z=cushion_z-10)
metal = s3d.join(stem, collar, plate)
s3d.material(metal, &class="tok-comment">#39;chromeclass="tok-string">39;, color=39;#a0a1a239;)
s3d.material(rim, &class="tok-comment">#39;plasticclass="tok-string">39;, color=39;#30303339;)
lever = s3d.at(adjustment_lever(), y=99, z=117)
s3d.joint(&class="tok-comment">#39;joint_sm_mechanism_a01_joint_00class="tok-string">39;, lever, s3d.local(metal, x=0, y=45, z=152), axis=39;-X39;, range=(-0.0001, 0.0001))
return s3d.group(&class="tok-comment">#39;seat39;, cushion, rim, metal, lever)
def adjustment_lever(w=20, length=114, h=38, rod=9):
bar = s3d.wire(&class="tok-comment">#39;lever39;, path=[(0, -length/2, h-rod/2), (0, length/2, rod/2)], d=rod)
s3d.material(bar, &class="tok-comment">#39;plasticclass="tok-string">39;, color=39;#25252739;)
return s3d.group(&class="tok-comment">#39;adjustment_lever39;, bar)
def caster_five(w=34, d=45, h=38):
solid = caster_shell(w=w, d=d, h=h)
wheel = s3d.at(wheel_five(), z=-10)
s3d.joint(&class="tok-comment">#39;joint_sm_wheel5_a01_joint_00class="tok-string">39;, wheel, s3d.local(solid, x=0, y=0, z=11), kind=39;continuousclass="tok-string">39;, axis=39;-X39;)
return s3d.group(&class="tok-comment">#39;caster_five39;, solid, wheel)
def caster_shell(w, d, h):
arch = s3d.at(s3d.tube(&class="tok-comment">#39;caster_arch39;, d=d, d_in=d-4, h=w), x=-w/2, z=11, ry=90)
arch = s3d.cut(arch, s3d.at(s3d.box(&class="tok-comment">#39;trim39;, w=w*2, d=d*2, h=d), z=-d))
web = s3d.at(s3d.cylinder(&class="tok-comment">#39;web39;, d=d-4, h=3), x=-1.5, z=11, ry=90)
web = s3d.cut(web, s3d.at(s3d.box(&class="tok-comment">#39;trim39;, w=w*2, d=d*2, h=d), z=-d))
boss = s3d.at(s3d.cylinder(&class="tok-comment">#39;swivel39;, d=24, h=h-11), y=12, z=11)
body = s3d.join(arch, web, boss)
s3d.material(body, &class="tok-comment">#39;plasticclass="tok-string">39;, color=39;#37373939;)
return body
def wheel_five(w=42, d=41, h=41):
return s3d.group(&class="tok-comment">#39;wheel_five39;, wheel_tires(w=w, d=d))
def wheel_tires(w, d):
tire = s3d.cylinder(&class="tok-comment">#39;tire39;, d=d, h=w/3)
s3d.fillet(tire, r=4, edges=&class="tok-comment">#39;bottom39;)
s3d.fillet(tire, r=1, edges=&class="tok-comment">#39;top39;)
tire = s3d.at(tire, x=-w/2, z=d/2, ry=90)
twin = s3d.transform(s3d.copy(tire), mirror=&class="tok-comment">#39;x39;)
axle = s3d.at(s3d.cylinder(&class="tok-comment">#39;axle39;, d=d/3, h=w), x=-w/2, z=d/2, ry=90)
body = s3d.join(tire, twin, axle)
s3d.material(body, &class="tok-comment">#39;rubberclass="tok-string">39;, color=39;#20202239;)
return body
def caster_two(w=34, d=45, h=38):
solid = caster_shell(w=w, d=d, h=h)
wheel = s3d.at(wheel_two(), y=0.5, z=-10)
s3d.joint(&class="tok-comment">#39;joint_sm_wheel2_a01_joint_00class="tok-string">39;, wheel, s3d.local(solid, x=0, y=0.5, z=11), kind=39;continuousclass="tok-string">39;, axis=39;-X39;)
return s3d.group(&class="tok-comment">#39;caster_two39;, solid, wheel)
def wheel_two(w=42, d=41, h=41):
return s3d.group(&class="tok-comment">#39;wheel_two39;, wheel_tires(w=w, d=d))
def caster_one(w=34, d=45, h=38):
solid = caster_shell(w=w, d=d, h=h)
wheel = s3d.at(wheel_one(), y=0.5, z=-10)
s3d.joint(&class="tok-comment">#39;joint_sm_wheel1_a01_joint_00class="tok-string">39;, wheel, s3d.local(solid, x=0, y=0.5, z=11), kind=39;continuousclass="tok-string">39;, axis=39;-X39;)
return s3d.group(&class="tok-comment">#39;caster_one39;, solid, wheel)
def wheel_one(w=42, d=41, h=41):
return s3d.group(&class="tok-comment">#39;wheel_one39;, wheel_tires(w=w, d=d))
def caster_three(w=34, d=45, h=38):
solid = caster_shell(w=w, d=d, h=h)
wheel = s3d.at(wheel_three(), y=0.5, z=-10)
s3d.joint(&class="tok-comment">#39;joint_sm_wheel3_a01_joint_00class="tok-string">39;, wheel, s3d.local(solid, x=0, y=0.5, z=11), kind=39;continuousclass="tok-string">39;, axis=39;-X39;)
return s3d.group(&class="tok-comment">#39;caster_three39;, solid, wheel)
def wheel_three(w=42, d=41, h=41):
return s3d.group(&class="tok-comment">#39;wheel_three39;, wheel_tires(w=w, d=d))
def caster_four(w=34, d=45, h=38):
solid = caster_shell(w=w, d=d, h=h)
wheel = s3d.at(wheel_four(), y=0.5, z=-10)
s3d.joint(&class="tok-comment">#39;joint_sm_wheel4_a01_joint_00class="tok-string">39;, wheel, s3d.local(solid, x=0, y=0.5, z=11), kind=39;continuousclass="tok-string">39;, axis=39;-X39;)
return s3d.group(&class="tok-comment">#39;caster_four39;, solid, wheel)
def wheel_four(w=42, d=41, h=41):
return s3d.group(&class="tok-comment">#39;wheel_four39;, wheel_tires(w=w, d=d))