import sand3d as s3d
def corner_guardrail():
a = s3d.at(upright(), x=-145, y=233, z=28)
b = s3d.at(foot_plate(), x=-145, y=233)
c = s3d.at(upper_rail(), x=209, y=350, z=963)
d = s3d.at(lower_rail(), x=209, y=350, z=318)
e = s3d.at(terminal_post(), x=563, y=242, z=28)
return s3d.assembly(&class="tok-comment">#39;corner_guardrail39;, a, b, c, d, e)
def upright(d=80, h=1044):
ob = s3d.cylinder(&class="tok-comment">#39;post39;, d=d, h=h)
s3d.material(ob, &class="tok-comment">#39;steelclass="tok-string">39;, color=39;#888b8c39;)
return s3d.group(&class="tok-comment">#39;upright39;, ob)
def foot_plate(w=225, t=29, r=18, pitch=122, bolt_d=36, bolt_h=25):
ob = s3d.extrude(&class="tok-comment">#39;plate39;, s3d.rect(w=w, d=w, r=r), h=t)
ob = s3d.at(ob, rz=45)
washer = s3d.at(s3d.cylinder(&class="tok-comment">#39;washers39;, d=bolt_d, h=t/6), on=s3d.ring(n=4, r=pitch), z=t-t/12)
head = s3d.at(s3d.extrude(&class="tok-comment">#39;bolt_heads39;, s3d.polygon(n=6, d=bolt_d*0.8), h=bolt_h), on=s3d.ring(n=4, r=pitch), z=t)
s3d.material(ob, &class="tok-comment">#39;steelclass="tok-string">39;, color=39;#888b8c39;)
s3d.material(washer, &class="tok-comment">#39;steelclass="tok-string">39;, color=39;#888b8c39;)
s3d.material(head, &class="tok-comment">#39;steelclass="tok-string">39;, color=39;#888b8c39;)
return s3d.group(&class="tok-comment">#39;foot_plate39;, ob, washer, head)
def upper_rail(d=80, span=708, rise=234, radius=300, end_skew=9):
path = s3d.poly([(-span/2, -rise/2), (-radius/2**0.5, rise/2-radius+radius/2**0.5), s3d.arc(center=(0, rise/2-radius), r=radius, start=135, end=45), (span/2, -rise/2+end_skew)])
ob = s3d.wire(&class="tok-comment">#39;rail39;, path=path, d=d, closed=False)
ob = s3d.at(ob, z=d/2)
s3d.material(ob, &class="tok-comment">#39;steelclass="tok-string">39;, color=39;#888b8c39;)
return s3d.group(&class="tok-comment">#39;upper_rail39;, ob)
def lower_rail(d=80, span=708, rise=234, radius=300, end_skew=9):
path = s3d.poly([(-span/2, -rise/2), (-radius/2**0.5, rise/2-radius+radius/2**0.5), s3d.arc(center=(0, rise/2-radius), r=radius, start=135, end=45), (span/2, -rise/2+end_skew)])
ob = s3d.wire(&class="tok-comment">#39;rail39;, path=path, d=d, closed=False)
ob = s3d.at(ob, z=d/2)
s3d.material(ob, &class="tok-comment">#39;steelclass="tok-string">39;, color=39;#888b8c39;)
return s3d.group(&class="tok-comment">#39;lower_rail39;, ob)
def terminal_post(d=80, h=1044):
ob = s3d.cylinder(&class="tok-comment">#39;post39;, d=d, h=h)
s3d.material(ob, &class="tok-comment">#39;steelclass="tok-string">39;, color=39;#888b8c39;)
child = s3d.at(terminal_plate(), z=-28)
return s3d.group(&class="tok-comment">#39;terminal_post39;, ob, child)
def terminal_plate(w=225, t=29, r=18, pitch=122, bolt_d=36, bolt_h=25):
ob = s3d.extrude(&class="tok-comment">#39;plate39;, s3d.rect(w=w, d=w, r=r), h=t)
ob = s3d.at(ob, rz=45)
washer = s3d.at(s3d.cylinder(&class="tok-comment">#39;washers39;, d=bolt_d, h=t/6), on=s3d.ring(n=4, r=pitch), z=t-t/12)
head = s3d.at(s3d.extrude(&class="tok-comment">#39;bolt_heads39;, s3d.polygon(n=6, d=bolt_d*0.8), h=bolt_h), on=s3d.ring(n=4, r=pitch), z=t)
s3d.material(ob, &class="tok-comment">#39;steelclass="tok-string">39;, color=39;#888b8c39;)
s3d.material(washer, &class="tok-comment">#39;steelclass="tok-string">39;, color=39;#888b8c39;)
s3d.material(head, &class="tok-comment">#39;steelclass="tok-string">39;, color=39;#888b8c39;)
return s3d.group(&class="tok-comment">#39;terminal_plate39;, ob, washer, head)