import sand3d as s3d
def engine_stand():
root=s3d.at(rolling_frame(),x=-174.5,y=-148,z=23)
return s3d.assembly(&class="tok-comment">#39;engine_stand39;,root)
def rolling_frame(foot_w=830,far_w=702,foot_d=48,beam=57,beam_l=802,base_z=69,base_h=57,post_w=45,post_d=70,post_h=911,post_y=335,brace_end=591,brace_start=150,tray_w=266,tray_d=187,tray_z=653,tray_x=156,tray_y=385,rim=4,rim_h=25,hub_d=94,hub_l=179,hub_z=1084,hub_y=249,fork_h=73,axle=393.5):
foot=s3d.at(s3d.box(&class="tok-comment">#39;crossfoot39;,w=foot_w,d=foot_d,h=foot_d),y=post_y+19,z=base_z)
far=s3d.at(s3d.box(&class="tok-comment">#39;far_crossfoot39;,w=far_w,d=foot_d,h=foot_d),y=post_y+19-beam_l,z=base_z)
rail=s3d.at(s3d.box(&class="tok-comment">#39;spine39;,w=beam,d=beam_l,h=base_h),y=post_y+19-beam_l/2,z=base_z)
post=s3d.at(s3d.box(&class="tok-comment">#39;upright39;,w=post_w,d=post_d,h=post_h),y=post_y,z=base_z+base_h)
brace=s3d.extrude(&class="tok-comment">#39;brace39;,s3d.poly(pts=[(brace_start,base_z+base_h),(post_y-post_d/2,brace_end),(post_y-post_d/2,base_z+base_h+214),(brace_start+post_d,base_z+base_h)]),h=post_w)
brace=s3d.at(brace,x=-post_w/2,rx=90,rz=90)
tray=s3d.at(s3d.box(&class="tok-comment">#39;tray39;,w=tray_w,d=tray_d,h=rim_h),x=tray_x,y=tray_y,z=tray_z)
tool=s3d.at(s3d.box(&class="tok-comment">#39;tray_inside39;,w=tray_w-rim*2,d=tray_d-rim*2,h=rim_h),x=tray_x,y=tray_y,z=tray_z+rim)
tray=s3d.cut(tray,tool)
hub=s3d.at(s3d.tube(&class="tok-comment">#39;bearing39;,d=hub_d,d_in=hub_d-rim*2,h=hub_l),y=hub_y,z=hub_z,rx=-90)
cheeks=[]
for x in (-axle,axle):
for side in (-1,1):
cheeks.append(s3d.at(s3d.box(&class="tok-comment">#39;fixed_fork39;,w=rim,d=foot_d,h=fork_h),x=x+side*(38+rim)/2,y=354,z=0))
frame=s3d.group(&class="tok-comment">#39;frame39;,foot,far,rail,post,brace,tray,hub,cheeks)
s3d.material(frame,kind=&class="tok-comment">#39;painted_metalclass="tok-string">39;,color=39;#555b6039;)
fork=s3d.at(swivel_fork(),x=327,y=-448,z=6)
twin=s3d.transform(s3d.at(swivel_fork(wheel_joint=&class="tok-comment">#39;joint_wheel_04_joint_00class="tok-string">39;),x=327,y=-448,z=6),mirror=39;x39;)
s3d.joint(&class="tok-comment">#39;joint_support_01_joint_00class="tok-string">39;,fork,s3d.local(frame,x=329,y=-448,z=74),kind=39;continuousclass="tok-string">39;,axis=39;+Z39;)
s3d.joint(&class="tok-comment">#39;joint_support_02_joint_00class="tok-string">39;,twin,s3d.local(frame,x=-329,y=-448,z=74),kind=39;continuousclass="tok-string">39;,axis=39;+Z39;)
wheel=s3d.at(fixed_wheel(),x=axle,y=354,z=-21)
image=s3d.transform(s3d.copy(wheel),mirror=&class="tok-comment">#39;x39;)
s3d.joint(&class="tok-comment">#39;joint_wheel_02_joint_00class="tok-string">39;,wheel,s3d.local(frame,x=393,y=354,z=21),kind=39;continuousclass="tok-string">39;,axis=39;+X39;)
s3d.joint(&class="tok-comment">#39;joint_wheel_01_joint_00class="tok-string">39;,image,s3d.local(frame,x=-393,y=354,z=21),kind=39;continuousclass="tok-string">39;,axis=39;+X39;)
head=s3d.at(rotating_head(),x=0.5,y=219,z=867)
s3d.joint(&class="tok-comment">#39;joint_stand_01_joint_00class="tok-string">39;,head,s3d.local(frame,x=0,y=453,z=1084),kind=39;continuousclass="tok-string">39;,axis=39;-Y39;)
return s3d.group(&class="tok-comment">#39;rolling_frame39;,frame,fork,twin,wheel,image,head)
def swivel_fork(w=57,d=74,h=67,t=5,wheel_w=38,wheel_joint=&class="tok-comment">#39;joint_wheel_03_joint_0039;):
cap=s3d.at(s3d.cylinder(&class="tok-comment">#39;swivel39;,d=w,h=t*2),z=h-t*2)
plates=[]
for side in (-1,1):
plates.append(s3d.at(s3d.box(&class="tok-comment">#39;fork_cheek39;,w=t,d=d,h=h-t),x=side*(wheel_w+t)/2))
fork=s3d.group(&class="tok-comment">#39;fork39;,cap,plates)
s3d.material(fork,kind=&class="tok-comment">#39;steelclass="tok-string">39;,color=39;#888d9139;)
wheel=s3d.at(swivel_wheel(),x=2.5,y=-22,z=-27)
s3d.joint(wheel_joint,wheel,s3d.local(fork,x=2,y=-22,z=15),kind=&class="tok-comment">#39;continuousclass="tok-string">39;,axis=39;+X39;)
return s3d.group(&class="tok-comment">#39;swivel_fork39;,fork,wheel)
def swivel_wheel(w=38,d=84):
wheel=s3d.at(s3d.cylinder(&class="tok-comment">#39;caster_tire39;,d=d,h=w),x=-w/2,z=d/2,ry=90)
s3d.material(wheel,kind=&class="tok-comment">#39;rubberclass="tok-string">39;,color=39;#33363a39;)
return s3d.group(&class="tok-comment">#39;swivel_wheel39;,wheel)
def fixed_wheel(w=38,d=84):
wheel=s3d.at(s3d.cylinder(&class="tok-comment">#39;wheel39;,d=d,h=w),x=-w/2,z=d/2,ry=90)
s3d.material(wheel,kind=&class="tok-comment">#39;rubberclass="tok-string">39;,color=39;#33363a39;)
return s3d.group(&class="tok-comment">#39;fixed_wheel39;,wheel)
def rotating_head(plate_w=380,plate_h=214,t=13,center_z=217,hub_d=74,hub_l=250,bar_l=576,bar_d=33,bar_y=234,arm_x=166,arm_z=83,spread=118,arm_w=30,gap=18,peg_l=120):
plate=s3d.at(s3d.box(&class="tok-comment">#39;mounting_plate39;,w=plate_w,d=t,h=plate_h),z=center_z-plate_h/2,y=t/2)
spindle=s3d.at(s3d.tube(&class="tok-comment">#39;spindle39;,d=hub_d,d_in=hub_d-t,h=hub_l),z=center_z,rx=-90)
bar=s3d.at(s3d.cylinder(&class="tok-comment">#39;turning_bar39;,d=bar_d,h=bar_l),x=-bar_l/2-37,y=bar_y,z=center_z,ry=90)
arms=[]
for sx in (-1,1):
for sz in (-1,1):
start=(sx*arm_x,center_z+sz*arm_z)
end=(sx*(arm_x+spread),center_z+sz*(arm_z+spread))
arm=s3d.extrude(&class="tok-comment">#39;arm39;,s3d.stroke(s3d.spline(pts=[start,end]),t=arm_w),h=t)
inner=s3d.stroke(s3d.spline(pts=[(start[0]+sx*t,start[1]+sz*t),(end[0]-sx*t,end[1]-sz*t)]),t=gap)
arm=s3d.cut(arm,s3d.extrude(&class="tok-comment">#39;arm_opening39;,inner,h=t*2))
arms.append(s3d.at(arm,rx=90))
arms.append(s3d.at(s3d.cylinder(&class="tok-comment">#39;peg39;,d=arm_w,h=peg_l),x=end[0],z=end[1],rx=90))
head=s3d.group(&class="tok-comment">#39;rotating_head39;,plate,spindle,bar,arms)
s3d.material(head,kind=&class="tok-comment">#39;painted_metalclass="tok-string">39;,color=39;#b86a3239;)
return head