import sand3d as s3d
def pallet_load():
base = s3d.at(pallet(), z=0)
load = s3d.at(tiered_body(), y=-3, z=105)
return s3d.assembly(class="tok-string">"pallet_load", base, load)
def pallet(w=900, d=902, h=118, runner=107, foot_h=21, cross=32, deck=18, board=90):
feet = s3d.at(s3d.box(class="tok-string">"runners", w=runner, d=d, h=foot_h), on=s3d.grid(nx=3, px=(w-runner)/2))
supports = s3d.at(s3d.box(class="tok-string">"cross_supports", w=w, d=cross, h=h-deck-foot_h+2), on=s3d.grid(nx=1, ny=3, py=(d-cross)/2), z=foot_h-1)
top = s3d.at(s3d.box(class="tok-string">"deck_boards", w=board, d=d, h=deck), on=s3d.grid(nx=5, px=(w-board)/4), z=h-deck)
solid = s3d.join(feet[0], feet[1:], supports, top)
s3d.material(solid, class="tok-string">"pine", color=class="tok-string">"class="tok-comment">#82745e")
return s3d.group(class="tok-string">"pallet", solid)
def tiered_body(w=900, d=908, h=394, wall=16, brace_d=20, brace_h=65, brace_z=177):
sections = [(0,w,d), (35,890,902), (135,870,890), (164,882,902), (190,860,880), (300,850,860), (h,855,865)]
pieces = []
for lower, upper in zip(sections, sections[1:]):
pieces.append(s3d.loft(class="tok-string">"tier", s3d.station(z=lower[0], w=lower[1], d=lower[2], n=32), s3d.station(z=upper[0], w=upper[1], d=upper[2], n=32)))
solid = s3d.join(pieces[0], pieces[1:])
solid = s3d.shell(solid, t=wall, open=class="tok-string">"end")
brace = s3d.at(s3d.box(class="tok-string">"tier_support", w=w-wall*2, d=brace_d, h=brace_h), z=brace_z)
solid = s3d.join(solid, brace)
s3d.material(solid, class="tok-string">"plastic", color=class="tok-string">"class="tok-comment">#777b78", roughness=0.7)
border = s3d.at(top_border(), z=376)
return s3d.group(class="tok-string">"tiered_body", solid, border)
def top_border(w=850, d=865, h=34, inset=650, floor=22, rim=28, wall=5):
solid = s3d.extrude(class="tok-string">"top", s3d.rect(w=w, d=d, r=25), h=h)
tool = s3d.loft(class="tok-string">"inset", s3d.station(z=floor, w=inset, d=inset, n=10), s3d.station(z=h+1, w=w-rim*2, d=d-rim*2, n=12))
solid = s3d.cut(solid, tool)
solid = s3d.shell(solid, t=wall, open=class="tok-string">"bottom")
s3d.material(solid, class="tok-string">"plastic", color=class="tok-string">"class="tok-comment">#777b78", roughness=0.7)
return s3d.group(class="tok-string">"top_border", solid)