import sand3d as s3d
import math
def stepladder():
frame = s3d.at(main_frame(), y=-93)
return s3d.assembly(class="tok-string">"stepladder", frame)
def main_frame(rail_w=40, rail_d=70, wall=6, rail_h=1690, pitch=450, tilt=20, base_y=-286, base_z=15, tread_w=450, tread_d=68, tread_h=25, first_z=207, rise=235, cap_w=505, cap_h=38, foot_w=55, foot_d=100, foot_h=70, tab_l=100, tab_d=40, tab_t=16, tab_y=238, tab_z=1260, boss_d=28, boss_l=55):
p = s3d.poly([(-rail_w/2,-rail_d/2),(rail_w/2,-rail_d/2),(rail_w/2,-rail_d/2+wall),(-rail_w/2+wall,-rail_d/2+wall),(-rail_w/2+wall,rail_d/2-wall),(rail_w/2,rail_d/2-wall),(rail_w/2,rail_d/2),(-rail_w/2,rail_d/2)])
rail = s3d.at(s3d.extrude(class="tok-string">"climbing_channel", p, h=rail_h), x=-pitch/2, y=base_y, z=base_z, rx=-tilt)
twin = s3d.transform(s3d.copy(rail), mirror=class="tok-string">"x")
solids = [rail, twin]
slope = math.tan(math.radians(tilt))
for i in range(3):
z = first_z+i*rise
tread = s3d.at(s3d.box(class="tok-string">"tread", w=tread_w, d=tread_d, h=tread_h), y=base_y+(z-base_z)*slope, z=z-tread_h/2)
solids.append(tread)
cap = s3d.at(s3d.box(class="tok-string">"top_bar", w=cap_w, d=rail_d, h=cap_h), y=base_y+rail_h*math.sin(math.radians(tilt))-wall/2, z=base_z+rail_h*math.cos(math.radians(tilt))-cap_h/2-wall, rx=-tilt)
foot = s3d.at(s3d.loft(class="tok-string">"angled_foot", s3d.station(z=0, w=foot_w, d=foot_d, n=4), s3d.station(z=foot_h, w=rail_w, d=rail_d, y=foot_h*slope/2, n=4)), x=-pitch/2, y=base_y+wall)
tab = s3d.at(s3d.extrude(class="tok-string">"hinge_bracket", s3d.rect(w=tab_d, d=tab_l, r=tab_d/2-wall), h=tab_t), x=-pitch/2-tab_t/2, y=tab_y, z=tab_z, ry=90)
boss = s3d.at(s3d.cylinder(class="tok-string">"shelf_mount", d=boss_d, h=boss_l), x=-pitch/2-rail_w/2, y=29, z=880, ry=90)
solids.extend([cap, foot, s3d.transform(s3d.copy(foot), mirror=class="tok-string">"x"), tab, s3d.transform(s3d.copy(tab), mirror=class="tok-string">"x"), boss, s3d.transform(s3d.copy(boss), mirror=class="tok-string">"x")])
main = s3d.group(class="tok-string">"main_frame", *solids)
s3d.material(main, kind=class="tok-string">"aluminium", color=class="tok-string">"class="tok-comment">#929799")
rear = s3d.at(rear_support(), y=377.5)
shelf = s3d.at(platform(), y=162, z=859)
s3d.joint(class="tok-string">"joint_sm_sideladder_c03_joint_00", rear, s3d.local(main, x=-225, y=266, z=1260), kind=class="tok-string">"revolute", axis=class="tok-string">"+X", range=(-29,0))
s3d.joint(class="tok-string">"joint_sm_shelf_c03_joint_00", shelf, s3d.local(main, x=-1, y=29, z=880), kind=class="tok-string">"revolute", axis=class="tok-string">"+X", range=(0,75))
return s3d.group(class="tok-string">"main_frame_group", main, rear, shelf)
def rear_support(rail_w=26, rail_d=50, h=1270, pitch=450, tilt=10, base_y=115.5, bar_z=370, bar_d=17, tab_w=42, tab_d=70, tab_h=18):
rail = s3d.at(s3d.box(class="tok-string">"rear_leg", w=rail_w, d=rail_d, h=h), x=-pitch/2, y=base_y, rx=tilt)
twin = s3d.transform(s3d.copy(rail), mirror=class="tok-string">"x")
bar = s3d.at(s3d.cylinder(class="tok-string">"rear_crossbar", d=bar_d, h=pitch), x=-pitch/2, y=base_y-bar_z*math.tan(math.radians(tilt)), z=bar_z, ry=90)
tab = s3d.at(s3d.box(class="tok-string">"hinge_tab", w=tab_w, d=tab_d, h=tab_h), x=-pitch/2, y=base_y-h*math.sin(math.radians(tilt)), z=h*math.cos(math.radians(tilt))-tab_h/2)
part = s3d.group(class="tok-string">"rear_support", rail, twin, bar, tab, s3d.transform(s3d.copy(tab), mirror=class="tok-string">"x"))
s3d.material(part, kind=class="tok-string">"aluminium", color=class="tok-string">"class="tok-comment">#929799")
return part
def platform(w=380, d=380, h=43, t=4, hinge_w=440, hinge_d=28, hinge_y=-133, hinge_z=21):
tray = s3d.box(class="tok-string">"platform_tray", w=w, d=d, h=h)
tray = s3d.shell(tray, t=t, open=class="tok-string">"bottom")
hinge = s3d.at(s3d.cylinder(class="tok-string">"platform_hinge", d=hinge_d, h=hinge_w), x=-hinge_w/2, y=hinge_y, z=hinge_z, ry=90)
part = s3d.group(class="tok-string">"platform", tray, hinge)
s3d.material(part, kind=class="tok-string">"aluminium", color=class="tok-string">"class="tok-comment">#929799")
return part