import sand3d as s3d
def cabinet():
body = s3d.at(cabinet_body(), x=0, y=0, z=90)
return s3d.assembly(&class="tok-comment">#39;cabinet39;, body)
def cabinet_body(w=620, d=972, h=841, t=5, floor=42, rail=35):
skin = s3d.at(s3d.shell(s3d.box(&class="tok-comment">#39;enclosureclass="tok-string">39;, w, d, h-floor), t=t, open=39;bottom39;), z=floor)
bottom = s3d.at(s3d.box(&class="tok-comment">#39;floor39;, w-t, d-t, t), z=floor)
rails = s3d.at(s3d.box(&class="tok-comment">#39;crossmember39;, w-t, rail, floor-t), on=s3d.grid(nx=1, ny=2, py=380), z=t+10)
lip = s3d.at(s3d.box(&class="tok-comment">#39;skirt39;, t, d, floor), x=(w-t)/2, z=7)
twin = s3d.transform(s3d.copy(lip), mirror=&class="tok-comment">#39;x39;)
s3d.material(skin, &class="tok-comment">#39;painted_metalclass="tok-string">39;, color=39;#777d8039;)
for ob in [bottom, rails, lip, twin]:
s3d.material(ob, &class="tok-comment">#39;painted_metalclass="tok-string">39;, color=39;#777d8039;)
rear = s3d.at(caster_mount_rear(), x=-239, y=417, z=-68)
rear_image = s3d.at(caster_mount_rear(wheel_joint=&class="tok-comment">#39;joint_wheel_02_joint_0039;), x=239, y=417, z=-68)
front = s3d.at(caster_mount_front(), x=-239, y=-407, z=-68)
front_image = s3d.at(caster_mount_front(wheel_joint=&class="tok-comment">#39;joint_wheel_01_joint_0039;), x=239, y=-407, z=-68)
parent = s3d.group(&class="tok-comment">#39;cabinet_body39;, skin, bottom, rails, lip, twin, rear, rear_image, front, front_image)
s3d.joint(&class="tok-comment">#39;joint_wheelAttachment_03_joint_00class="tok-string">39;, rear, on=s3d.local(parent, x=-239, y=410, z=-19), kind=39;continuousclass="tok-string">39;, axis=39;+Z39;)
s3d.joint(&class="tok-comment">#39;joint_wheelAttachment_02_joint_00class="tok-string">39;, rear_image, on=s3d.local(parent, x=239, y=410, z=-19), kind=39;continuousclass="tok-string">39;, axis=39;+Z39;)
s3d.joint(&class="tok-comment">#39;joint_wheelAttachment_04_joint_00class="tok-string">39;, front, on=s3d.local(parent, x=-239, y=-414, z=-19), kind=39;continuousclass="tok-string">39;, axis=39;+Z39;)
s3d.joint(&class="tok-comment">#39;joint_wheelAttachment_01_joint_00class="tok-string">39;, front_image, on=s3d.local(parent, x=239, y=-414, z=-19), kind=39;continuousclass="tok-string">39;, axis=39;+Z39;)
return parent
def caster_mount_rear(w=79, d=78, h=78, plate=6, wheel_joint=&class="tok-comment">#39;joint_wheel_03_joint_0039;):
cap = s3d.at(s3d.cylinder(&class="tok-comment">#39;swivel39;, d=w, h=plate*2), z=h-plate*2)
fork = s3d.at(s3d.box(&class="tok-comment">#39;fork39;, w=plate, d=d/2, h=h-plate), x=(51+plate)/2, y=12)
fork_image = s3d.transform(s3d.copy(fork), mirror=&class="tok-comment">#39;x39;)
s3d.material(cap, &class="tok-comment">#39;steelclass="tok-string">39;, color=39;#989da039;)
s3d.material(fork, &class="tok-comment">#39;steelclass="tok-string">39;, color=39;#989da039;)
s3d.material(fork_image, &class="tok-comment">#39;steelclass="tok-string">39;, color=39;#989da039;)
wheel = s3d.at(caster_wheel_rear(), y=20, z=-22)
parent = s3d.group(&class="tok-comment">#39;caster_mount_rear39;, cap, fork, fork_image, wheel)
s3d.joint(wheel_joint, wheel, on=s3d.local(parent, x=0, y=20, z=16), kind=&class="tok-comment">#39;continuousclass="tok-string">39;, axis=39;+X39;)
return parent
def caster_wheel_rear(w=51, d=76, rounding=8):
tire = s3d.cylinder(&class="tok-comment">#39;wheel39;, d=d, h=w)
tire = s3d.fillet(tire, r=rounding)
tire = s3d.at(tire, x=-w/2, z=d/2, ry=90)
s3d.material(tire, &class="tok-comment">#39;rubberclass="tok-string">39;, color=39;#35383a39;)
return s3d.group(&class="tok-comment">#39;caster_wheel_rear39;, tire)
def caster_mount_front(w=79, d=78, h=78, plate=6, wheel_joint=&class="tok-comment">#39;joint_wheel_04_joint_0039;):
cap = s3d.at(s3d.cylinder(&class="tok-comment">#39;swivel39;, d=w, h=plate*2), z=h-plate*2)
fork = s3d.at(s3d.box(&class="tok-comment">#39;fork39;, w=plate, d=d/2, h=h-plate), x=(51+plate)/2, y=12)
fork_image = s3d.transform(s3d.copy(fork), mirror=&class="tok-comment">#39;x39;)
s3d.material(cap, &class="tok-comment">#39;steelclass="tok-string">39;, color=39;#989da039;)
s3d.material(fork, &class="tok-comment">#39;steelclass="tok-string">39;, color=39;#989da039;)
s3d.material(fork_image, &class="tok-comment">#39;steelclass="tok-string">39;, color=39;#989da039;)
wheel = s3d.at(caster_wheel_front(), y=20, z=-22)
parent = s3d.group(&class="tok-comment">#39;caster_mount_front39;, cap, fork, fork_image, wheel)
s3d.joint(wheel_joint, wheel, on=s3d.local(parent, x=0, y=20, z=16), kind=&class="tok-comment">#39;continuousclass="tok-string">39;, axis=39;+X39;)
return parent
def caster_wheel_front(w=51, d=76, rounding=8):
tire = s3d.cylinder(&class="tok-comment">#39;wheel39;, d=d, h=w)
tire = s3d.fillet(tire, r=rounding)
tire = s3d.at(tire, x=-w/2, z=d/2, ry=90)
s3d.material(tire, &class="tok-comment">#39;rubberclass="tok-string">39;, color=39;#35383a39;)
return s3d.group(&class="tok-comment">#39;caster_wheel_front39;, tire)