import sand3d as s3d
def rolling_steps():
root=s3d.at(stair_frame(),z=0)
casters=[]
for name,x,y in [(class="tok-string">"1",-335,210),(class="tok-string">"2",335,210),(class="tok-string">"3",-335,-210),(class="tok-string">"4",335,-210)]:
child=s3d.at(platform_caster(wheel_name=name) if y>0 else entry_caster(wheel_name=name),x=x,y=y-5.5,z=17)
s3d.joint(class="tok-string">"joint_sm_caster"+name+class="tok-string">"_a01_joint_00",child,s3d.local(root,x=x,y=y,z=63),kind=class="tok-string">"continuous",axis=class="tok-string">"+Z")
casters.append(child)
return s3d.assembly(class="tok-string">"rolling_steps",root,casters)
def stair_frame(x=359,y=307,tube=25,high=1511,knee=980,shoulder=1450,crown=105,rear_mid=334,tread_w=610,low=231,rise=255,first_y=-235,going=192,tread_d=175,top_d=230,stalk_x=335,stalk_y=210,stalk_z=63,stalk_h=112):
rail=s3d.wire(class="tok-string">"handrail",path=[(x,-y,0),(x,-y,knee),(x,35,shoulder),(x,crown,high),(x,245,high),(x,y,shoulder),(rear_mid,260,740),(x,y,0)],d=tube,fillet=tube*2)
twin=s3d.transform(s3d.copy(rail),mirror=class="tok-string">"x")
feet=s3d.at(s3d.cone(class="tok-string">"foot_caps",d=tube*1.5,d2=tube,h=stalk_z),on=s3d.grid(nx=2,ny=2,px=x*2,py=y*2))
ties=[]
for z in [stalk_h+17,high-40]:
ties.append(s3d.wire(class="tok-string">"cross_tie",path=[(-x,y-12,z),(x,y-12,z)],d=tube/5))
steps=[]
for i in range(3):
steps.append(s3d.at(grille(w=tread_w,d=top_d if i==2 else tread_d),y=first_y+going*i+(top_d-tread_d)/2*(i==2),z=low+rise*i))
support=s3d.wire(class="tok-string">"stringer",path=[(tread_w/2,-y,low),(tread_w/2,going+first_y+going,low+rise*2)],d=tube/3)
support2=s3d.transform(s3d.copy(support),mirror=class="tok-string">"x")
posts=s3d.at(s3d.cylinder(class="tok-string">"caster_stalk",d=tube,h=stalk_h),on=s3d.grid(nx=2,ny=2,px=stalk_x*2,py=stalk_y*2),z=stalk_z)
ob=s3d.group(class="tok-string">"stair_frame",rail,twin,feet,ties,steps,support,support2,posts)
s3d.material(ob,class="tok-string">"aluminium",color=class="tok-string">"class="tok-comment">#a5a8aa")
return ob
def grille(w=610,d=175,h=33,t=4,pitch=28):
rim=s3d.shell(s3d.box(class="tok-string">"tread_rim",w=w,d=d,h=h),t=t,open=class="tok-string">"top bottom")
bars=s3d.at(s3d.box(class="tok-string">"grille_bar",w=t,d=d,h=t),on=s3d.grid(nx=21,px=pitch),z=h-t)
cross=s3d.at(s3d.box(class="tok-string">"grille_cross",w=w,d=t,h=t),on=s3d.grid(nx=1,ny=int(d/pitch),py=pitch),z=h-t)
return s3d.merge(rim,bars,cross)
def platform_caster(w=35,d=45,h=48,t=5,wheel_name=class="tok-string">"1"):
cap=s3d.at(s3d.cylinder(class="tok-string">"swivel",d=w,h=t),y=t,z=h-t)
cheek=s3d.at(s3d.box(class="tok-string">"fork",w=t,d=d,h=h),x=(w-t)/2)
other=s3d.transform(s3d.copy(cheek),mirror=class="tok-string">"x")
solid=s3d.group(class="tok-string">"platform_caster",cap,cheek,other)
s3d.material(solid,class="tok-string">"steel",color=class="tok-string">"class="tok-comment">#909598")
wheel=s3d.at(platform_wheel(),y=-15.5,z=-17)
s3d.joint(class="tok-string">"joint_sm_wheel"+wheel_name+class="tok-string">"_a01_joint_00",wheel,s3d.local(solid,x=0,y=-15.5,z=9),axis=class="tok-string">"+X",range=(-62831.9,62831.9))
return s3d.group(class="tok-string">"platform_caster_group",solid,wheel)
def platform_wheel(w=21,d=52):
wheel=s3d.at(s3d.cylinder(class="tok-string">"wheel",d=d,h=w),ry=90,x=-w/2,z=d/2)
s3d.material(wheel,class="tok-string">"rubber",color=class="tok-string">"class="tok-comment">#55595b")
return s3d.group(class="tok-string">"platform_wheel",wheel)
def entry_caster(w=35,d=45,h=48,t=5,wheel_name=class="tok-string">"3"):
cap=s3d.at(s3d.cylinder(class="tok-string">"swivel",d=w,h=t),y=t,z=h-t)
cheek=s3d.at(s3d.box(class="tok-string">"fork",w=t,d=d,h=h),x=(w-t)/2)
other=s3d.transform(s3d.copy(cheek),mirror=class="tok-string">"x")
solid=s3d.group(class="tok-string">"entry_caster",cap,cheek,other)
s3d.material(solid,class="tok-string">"steel",color=class="tok-string">"class="tok-comment">#909598")
wheel=s3d.at(entry_wheel(),y=-15.5,z=-17)
s3d.joint(class="tok-string">"joint_sm_wheel"+wheel_name+class="tok-string">"_a01_joint_00",wheel,s3d.local(solid,x=0,y=-15.5,z=9),axis=class="tok-string">"+X",range=(-62831.9,62831.9))
return s3d.group(class="tok-string">"entry_caster_group",solid,wheel)
def entry_wheel(w=21,d=52):
wheel=s3d.at(s3d.cylinder(class="tok-string">"wheel",d=d,h=w),ry=90,x=-w/2,z=d/2)
s3d.material(wheel,class="tok-string">"rubber",color=class="tok-string">"class="tok-comment">#55595b")
return s3d.group(class="tok-string">"entry_wheel",wheel)