"""GRASS CUTTER - third pass over the machines, the belt junctions, the solar panels, the batteries and the robots.
What a player should see from the shape alone: where grass goes in, where bundles come out, what moves.
Rebuilt from nothing here:
SM_BeltSorter a gantry over a straight belt: barn lamp over the way in, a red kicker on an overhead rail, a side way out.
Belt EndIn EndOut Frame Pusher (origin -0.47, 0, 0.42) Scanner. It was 4 892 tris, now under 2 500.
SM_BeltSplitter a gate at the back with a swinging diverter fork that straddles the bundles instead of cutting through them.
Frame Belt Sign Paddle (hinge 0, 0.44, 0.35, as before).
SM_BeltMerger its mirror: wings gather three belts into a gate at the front. Frame Belt Sign.
SM_SolarPost/Pair/Tracker Stand and Head. Blue cells from the pack's palette. The pair is a butterfly on a T, the tracker a
lattice mast like the pack's windmill with the panel on a pyramid, so it clears the mast when the sun is low.
SM_Binder open bale chamber, hopper, crank and connecting rod to the plunger, knotters and twine. Body Lamp.
SM_BundleCatcher a staved basket with a target in it on a timber tower, a wide roller chute with a bundle on it. Body.
SM_RobotDock a steel dish in the pad the robot parks in (it stands at the origin on the ground, the old deck buried its
wheels), a tying gate over the way out, the lean-to turned round so its tin shows. Body Lamp.
Improved on top of the earlier build (the old builder runs, parts are dropped and added before the Body is finished):
SM_RobotMower, SM_Reaper (gc_up_machines.py), SM_CryoPress, SM_BatteryRack, SM_BatteryBank (gc_up_production.py).
Authored in Blender space: metres, Z up, front = -Y (Unity +Z), Unity +X = Blender -X.
Run: blender -b --factory-startup --python D:/PROJECTS/LOCAL/GrassCutter/ArtSource/Blender/scripts/gc_up3_machines.py -- [names]
GC_VIEWS=
also renders review angles there with back faces culled, as Unity shows them.
"""
import sys, os, zlib
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import common
import gc_up_machines as MA
import gc_up_production as PR
import gc_farm_machines as FM
import v3_belts as V3
from gc_up_production import * # noqa: F401,F403 (farm helpers, materials, boards, status_lamp, gauge_strip, spin_part ...)
from gc_up_machines import pfin, loft, px, py, pz, sb, sec, arc, soft, bolt, rust, decal, star_badge, haz, lamp_y, gear_wheel, R_52, R_80, R_VENT
TAU = 2 * PI
# more of the pack's palette: the blues of its windows and the deep colours
for k, v in {"CELL": (.3487, .41, "#305178"), "CELLD": (.3487, .397, "#223A57"), "CELLL": (.3487, .4514, "#3E6B9E"),
"SKY": (.37, .4514, "#A3C3D3"), "PALE": (.37, .49, "#D1EAF3")}.items():
MA.SW[k] = v
common.MATDEFS["P_" + k] = {"name": "P_" + k, "color": v[2]}
def tris(P):
return sum(len(p.vertices) - 2 for o in P if o is not None for p in o.data.polygons)
def patched(mod, hook, fn, drop=(), add=None, part="Body"):
"""Run an old builder. When it finishes `part`, the parts named in drop go and add(P) puts new ones in."""
orig = getattr(mod, hook)
def wrap(P, name, **kw):
if name == part:
keep = []
for o in P:
if o is not None and o.name.split(".")[0] in drop:
bpy.data.objects.remove(o)
elif o is not None:
keep.append(o)
P[:] = keep
if add:
add(P)
print("HIST|%s|%d tris before joining" % (name, tris(P)))
if hook == "ffin": # the new parts carry atlas paint: pfin turns it into M_Pack, ffin would leave stand-ins in the FBX
return pfin(P, name, ang=kw.get("ang", 30))
return orig(P, name, **kw)
setattr(mod, hook, wrap)
try:
return fn()
finally:
setattr(mod, hook, orig)
def arrow(c, rz, s=.1, m="P_GOLD", t=.008, tilt=0.0):
"""A flat arrow lying on something, pointing along +X before rz. tilt lifts its tip."""
pts = [(-1, -.34), (.1, -.34), (.1, -.85), (1, 0), (.1, .85), (.1, .34), (-1, .34)]
o = pz([(a * s, b * s) for (a, b) in pts], 0, t, m, name="arrow")
return xf(o, ry=-tilt, rz=rz, t=c)
# ======================================================================= solar kit
def cell_bed(P, x, w, d, nx, ny, z=.036, flat_top=True):
"""A bed of separate blue cells with light finger lines. The cells a low sun would catch run a shade lighter, in a diagonal
streak, so the whole panel reads as glass even in flat light."""
x0, y0 = x - w / 2 + .05, -d / 2 + .05
W, D = w - .1, d - .1
P.append(bx(x0, x0 + W, y0, y0 + D, z - .012, z, "P_CELLD", bev=0, name="bed"))
g = .011
cw, cd = W / nx, D / ny
for i in range(nx):
for j in range(ny):
a, b = x0 + i * cw + g, y0 + j * cd + g
t = (i + .5) / nx - (j + .5) / ny
key = "P_CELLL" if abs(t - .16) < .13 else "P_CELL"
q = mesh_obj("cell", verts=[(a, b, z + .002), (a + cw - 2 * g, b, z + .002), (a + cw - 2 * g, b + cd - 2 * g, z + .002), (a, b + cd - 2 * g, z + .002)], faces=[(0, 1, 2, 3)])
set_mats(q, key)
P.append(q)
# silver bus strips down the columns
for i in range(nx):
xk = x0 + (i + .5) * cw
q = mesh_obj("finger", verts=[(xk - .006, y0 + .012, z + .0035), (xk + .006, y0 + .012, z + .0035), (xk + .006, y0 + D - .012, z + .0035), (xk - .006, y0 + D - .012, z + .0035)], faces=[(0, 1, 2, 3)])
set_mats(q, "P_SKY")
P.append(q)
def sun_panel(P, x, w, d, nx, ny):
"""Frame of folded tin with a drip edge, corner gussets, cells."""
P.append(bx(x - w / 2, x + w / 2, -d / 2, d / 2, -.05, .022, TIN, bev=.008, name="frame"))
for s in (-1, 1):
y0, y1 = sorted((s * d / 2, s * (d / 2 - .03)))
P.append(bx(x - w / 2, x + w / 2, y0, y1, .0, .046, "P_G4", bev=0, name="lip"))
x0, x1 = sorted((x + s * w / 2, x + s * (w / 2 - .03)))
P.append(bx(x0, x1, -d / 2, d / 2, .0, .046, "P_G4", bev=0, name="lip"))
cell_bed(P, x, w, d, nx, ny)
for sx in (-1, 1):
for sy in (-1, 1):
cx_, cy_ = x + sx * (w / 2 - .035), sy * (d / 2 - .035)
P.append(prism("gusset", [(cx_ + sx * .03, cy_ + sy * .03), (cx_ - sx * .05, cy_ + sy * .03), (cx_ + sx * .03, cy_ - sy * .05)], "XY", .046, .052, IRON))
rivet(P, (cx_ + sx * .012, cy_ + sy * .012, .052), (0, 0, 1), r=.011, h=.005)
def sandbag(P, x, y, z, rz=0.0, s=1.0):
o = sphere("bag", 1.0, (0, 0, 0), seg=7, rings=4, m=BUR, scale=(.17 * s, .1 * s, .068 * s))
for v in o.data.vertices:
v.co *= 1 + random.uniform(-.06, .06)
P.append(uv_wall(xf(o, rz=rz, t=(x, y, z + .06 * s))))
P.append(xf(cube("bagtie", (.014, .186 * s, .124 * s), (0, 0, 0), ROPE), rz=rz, t=(x + math.cos(rz) * .06 * s, y + math.sin(rz) * .06 * s, z + .06 * s)))
def meter(P, r, z=.86):
"""The green meter on the front of a post: hood, cream dial, red needle, a lightning tag below."""
y = -r
P.append(bx(-.1, .1, y - .08, y, z, z + .26, GRN, bev=.008, name="meter"))
P.append(bx(-.115, .115, y - .11, y + .004, z + .25, z + .285, IRON, bev=.004, name="meterhood"))
P.append(cy("meterring", .068, y - .09, y - .08, 0, z + .135, IRON, v=8))
P.append(cy("meterdial", .056, y - .096, y - .088, 0, z + .135, CRM, v=8))
P.append(box("needle", -.004, .042, y - .1, y - .094, z + .131, z + .139, PRED, bev=0))
for sx in (-1, 1):
bolt(P, (sx * .075, y - .08, z + .03), (0, -1, 0), r=.008, m="P_G2")
def flash_tag(P, r, z=.5):
y = -r
P.append(prism("tagb", [(0, z - .13), (.13, z), (0, z + .13), (-.13, z)], "XZ", y - .012, y, "P_GOLD"))
P.append(prism("tagf", [(a_ * .95, z + b_ * 1.0) for (a_, b_) in BOLT], "XZ", y - .018, y - .012, "P_BLACK"))
def wood_stand(high, r, F, bags=2):
"""A chamfered, tapered post on plank feet, knee braces, sandbags on the feet, a yoke at the top."""
P = []
for rz in (0.0, PI / 2):
o = bx(-F, F, -.08, .08, 0.0, .07, TIM, bev=.012, name="foot")
xf(o, rz=rz)
P.append(grain(o, Matrix.Rotation(rz, 3, "Z") @ Vector((1, 0, 0))))
P.append(bx(-r - .05, r + .05, -r - .05, r + .05, .07, .1, IRON, bev=.006, name="footplate"))
for (sx, sy) in ((1, 1), (-1, 1), (1, -1), (-1, -1)):
bolt(P, (sx * (r + .03), sy * (r + .03), .1), (0, 0, 1), r=.012, m="P_G3")
k = 1.2
def oct_(R, z_, c=.22):
q_ = R * (1 - c)
return [(x_, y_, z_) for (x_, y_) in ((-q_, -R), (q_, -R), (R, -q_), (R, q_), (q_, R), (-q_, R), (-R, q_), (-R, -q_))]
P.append(grain(loft([oct_(r * k, .09), oct_(r, high - .09)], TIM, name="post"), (0, 0, 1)))
for k_ in range(4):
a = k_ * PI / 2
c, s = math.cos(a), math.sin(a)
P.append(beam((c * F * .8, s * F * .8, .07), (c * r, s * r, F * .8 + .12), .06, .06, bev=.008, name="knee"))
for z in (.3, F * .8 + .16, high - .3):
rr = r * (1.2 - .2 * z / high) + .006
P.append(box("band", -rr, rr, -rr, rr, z - .018, z + .018, IRON, bev=0))
# the yoke the head's axle sits in
P.append(bx(-r - .03, r + .03, -r - .03, r + .03, high - .13, high - .08, IRON, bev=.006, name="yokebase"))
for s in (-1, 1):
x0, x1 = sorted((s * (r + .005), s * (r + .035)))
P.append(bx(x0, x1, -.06, .06, high - .1, high + .05, IRON, bev=.004, name="yoke"))
P.append(cx("yokebolt", .022, min(s * (r + .035), s * (r + .05)), max(s * (r + .035), s * (r + .05)), 0, high, "P_G4", v=6))
# the lead down the post into the ground
PR.conduit(P, [(r + .016, -.03, high - .1), (r * 1.12 + .012, -.03, .9), (r * 1.2 + .012, -.03, .1), (r * 1.2 + .03, -.03, .08)], r=.011)
for z in (.62, 1.2):
P.append(box("clip", r * 1.1, r * 1.3 + .03, -.05, -.01, z - .012, z + .012, IRON, bev=0))
ztag = F * .8 + .3
flash_tag(P, r * 1.14, ztag)
meter(P, r * 1.08, ztag + .17)
a0 = random.uniform(0, 1)
for k_ in range(bags):
rz = k_ * PI + .0
c, s = math.cos(rz), math.sin(rz)
sandbag(P, c * F * .72, s * F * .72, .07, rz=rz + PI / 2 + .12, s=1.0 + .25 * (F > .7))
return P
def solar_post():
P = wood_stand(1.6, .085, .5, bags=2)
# the tilt quadrant: a slotted iron fan on the post, and the stay from the back of the panel down to it
H = 1.6
for s in (-1,):
fan = [(0.0, H - .28)] + arc(0.0, H - .02, .3, 248, 330, 5)
fan = [(y_, z_) for (y_, z_) in fan]
P.append(px(fan, .092, .104, IRON, name="quadrant"))
P.append(cx("wingnut", .03, .104, .126, .17, H - .16, "P_GOLD", v=6))
P.append(beam((.11, .17, H - .16), (.11, .25, H + .1), .03, .018, m=IRON, bev=0, name="stay"))
pfin(P, "Stand", ang=30)
P = []
sun_panel(P, 0, 1.0, .8, 4, 3)
PR.under(P, -.46, .46, -.24, .24)
PR.trunnion(P, .13)
o = pfin(P, "Head", ang=30)
xf(o, rx=.42, t=(0, 0, H))
set_origin(o, (0, 0, H))
return dict(elev=20, azim=-35)
def solar_pair():
H = 1.9
P = wood_stand(H, .1, .62, bags=2)
# a T: two long stays from a collar on the post out under the middle of each wing
P.append(box("collar", -.125, .125, -.125, .125, H - .78, H - .72, IRON, bev=0))
for s in (-1, 1):
P.append(beam((s * .1, 0, H - .75), (s * .92, .0, H + .03), .05, .03, m=IRON, bev=0, name="stay"))
P.append(cx("staybolt", .022, min(s * .125, s * .14), max(s * .125, s * .14), 0, H - .75, "P_G4", v=6))
pfin(P, "Stand", ang=30)
P = []
# two wings in a shallow V, like a butterfly settled on the post
V = .13
for s in (-1, 1):
G = []
sun_panel(G, 0, 1.44, 1.16, 5, 4)
for y in (-.36, .36):
G.append(grain(bx(-.68, .68, y - .04, y + .04, -.11, -.05, TIM, bev=.008, name="bearer"), (1, 0, 0)))
# a small junction box and a tail of cable on each wing
G.append(bx(-.5, -.34, -.08, .08, -.15, -.05, GRN, bev=.006, name="jbox"))
for o in G:
P.append(xf(o, ry=-s * V, t=(s * .78, 0, s * s * .05 + .78 * math.sin(V))))
for s in (-1, 1):
P.append(beam((0, 0, -.05), (s * 1.3, 0, -.05 + 1.3 * math.tan(V)), .07, .07, m=IRON, bev=0, name="arm"))
P.append(cx("hubaxle", .045, -.13, .13, 0, 0, STL, v=8))
P.append(bx(-.09, .09, -.05, .05, -.1, .02, IRON, bev=.006, name="hubblock"))
o = pfin(P, "Head", ang=30)
xf(o, rx=.42, t=(0, 0, H))
set_origin(o, (0, 0, H))
return dict(elev=20, azim=-35)
def solar_tracker():
P = []
Z_T = 2.34 # top of the lattice
R0, R1 = .84, .13 # half width at the feet and at the top
def q(z):
return R0 + (R1 - R0) * z / Z_T
A = "P_G2"
C = [(1, 1), (-1, 1), (-1, -1), (1, -1)]
for (sx, sy) in C:
P.append(beam((sx * q(0), sy * q(0), .05), (sx * q(Z_T), sy * q(Z_T), Z_T), .09, .09, m="P_G1", bev=0, name="leg"))
P.append(bx(sx * R0 - .17, sx * R0 + .17, sy * R0 - .17, sy * R0 + .17, 0, .09, "P_G4", bev=0, name="pad"))
P.append(bx(sx * R0 - .08, sx * R0 + .08, sy * R0 - .08, sy * R0 + .08, .09, .11, IRON, bev=0, name="shoe"))
for d_ in (-1, 1):
bolt(P, (sx * R0 + d_ * .058, sy * R0 - d_ * .058, .11), (0, 0, 1), r=.012, m="P_G4")
L = (.1, .78, 1.42, 1.96, Z_T)
for i in range(len(L) - 1):
z0, z1 = L[i], L[i + 1]
for k in range(4):
(ax, ay), (bx_, by) = C[k], C[(k + 1) % 4]
if i > 0 or True:
P.append(beam((ax * q(z1), ay * q(z1), z1), (bx_ * q(z1), by * q(z1), z1), .05, .036, m="P_G2", bev=0, name="girt"))
if i < 3:
P.append(beam((ax * q(z0), ay * q(z0), z0), (bx_ * q(z1), by * q(z1), z1), .03, .02, m="P_G2", bev=0, name="diag"))
P.append(beam((bx_ * q(z0), by * q(z0), z0), (ax * q(z1), ay * q(z1), z1), .03, .02, m="P_G2", bev=0, name="diag"))
# the ladder up the back, a plank landing at the second girt
for s in (-1, 1):
P.append(beam((s * .17, q(0) + .1, .03), (s * .17, q(Z_T - .2) + .1, Z_T - .2), .03, .03, m=IRON, bev=0, name="stile"))
for k in range(9):
z = .24 + k * .23
y_ = q(z) + .1
P.append(beam((-.17, y_, z), (.17, y_, z), .02, .02, m=STL, bev=0, name="rung"))
Y = q(.78)
for k in range(4):
y = -Y + (k + .5) * 2 * Y / 4
P.append(grain(bx(-Y, Y, y - .07, y + .07, .8, .83, DECK, bev=0, name="landing"), (1, 0, 0)))
# the control cabinet in the legs, a cream door, a dial, cable up a leg
P.append(bx(-.26, .26, -.2, .2, .1, .72, GRN, bev=.014, name="cabinet"))
P.append(bx(-.3, .3, -.24, .24, .72, .77, IRON, bev=.008, name="cablid"))
P.append(bx(-.2, .2, -.214, -.2, .16, .66, CRM, bev=0, name="cabdoor"))
P.append(cy("cabdial", .07, -.226, -.214, 0, .5, IRON, v=8))
P.append(cy("cabface", .056, -.232, -.226, 0, .5, CRM, v=8))
P.append(box("needle", -.005, .046, -.236, -.232, .495, .505, PRED, bev=0))
P.append(bx(.12, .17, -.226, -.214, .34, .42, IRON, bev=0, name="handle"))
P.append(prism("tagb", [(0, .1), (.11, .24), (0, .38), (-.11, .24)], "XZ", -.222, -.214, "P_GOLD"))
P.append(prism("tagf", [(a_ * .8, .24 + b_ * .8) for (a_, b_) in BOLT], "XZ", -.228, -.222, "P_BLACK"))
PR.conduit(P, [(.26, .12, .6), (.34, .2, .78), (q(1.3) + .03, q(1.3) - .02, 1.3), (q(2.2) + .03, q(2.2) - .02, 2.2)], r=.014)
# the slewing head: a toothed ring, a worm motor, the cup the ball sits in
P.append(bx(-.19, .19, -.19, .19, Z_T - .02, Z_T + .03, IRON, bev=.008, name="topplate"))
P.append(cz("ring", .17, Z_T + .03, Z_T + .09, m=A, v=14))
for k in range(8):
a = k * TAU / 8
o = bx(.165, .195, -.018, .018, Z_T + .035, Z_T + .085, "P_G4", bev=0, name="tooth")
P.append(xf(o, rz=a))
P.append(revm("cup", [(.13, Z_T + .09), (.13, Z_T + .13), (.09, Z_T + .2), (.07, Z_T + .2)], IRON, segs=10, cap_top=True))
P.append(bx(.2, .4, -.09, .09, Z_T - .08, Z_T + .08, GRN, bev=.012, name="slewmotor"))
P.append(cx("motorcap", .07, .4, .44, 0, Z_T, IRON, v=8))
P.append(cx("worm", .03, .14, .22, 0, Z_T + .06, STL, v=6))
pfin(P, "Stand", ang=30)
# ------ Head: the panel on a pyramid above the ball, so it clears the mast when the sun is low and it stands on edge
P = []
ZP = .5
G = []
sun_panel(G, 0, 2.4, 1.92, 8, 6)
for y in (-.62, .0, .62):
G.append(grain(bx(-1.14, 1.14, y - .04, y + .04, -.13, -.05, TIM, bev=.008, name="bearer"), (1, 0, 0)))
for x in (-.8, .8):
G.append(bx(x - .035, x + .035, -.9, .9, -.17, -.13, IRON, bev=0, name="spine"))
for o in G:
P.append(xf(o, t=(0, 0, ZP)))
# hub ball, four struts to the panel, a ring of ties between them
P.append(sphere("ball", .1, (0, 0, 0), seg=10, rings=5, m="P_G3"))
P.append(cz("neck", .05, .07, .16, m=IRON, v=8))
Pts = [(sx * .8, sy * .62, ZP - .17) for sx in (-1, 1) for sy in (-1, 1)]
for p_ in Pts:
P.append(beam((0, 0, .15), p_, .05, .05, m=IRON, bev=0, name="strut"))
Ring = [Pts[0], Pts[1], Pts[3], Pts[2]]
for k in range(4):
a, b = Vector(Ring[k]), Vector(Ring[(k + 1) % 4])
mid_a = Vector((0, 0, .15)).lerp(a, .55)
mid_b = Vector((0, 0, .15)).lerp(b, .55)
P.append(beam(mid_a, mid_b, .03, .03, m=A, bev=0, name="tie"))
P.append(bx(.3, .5, -.1, .1, ZP - .23, ZP - .17, GRN, bev=.006, name="jbox"))
PR.conduit(P, [(.32, 0, ZP - .22), (.14, .02, .3), (.03, .05, .12)], r=.012)
# a sun-finder: a gold disc on a stalk at the edge of the panel, and a cross of shadow vanes under it
P.append(cz("stalk", .014, ZP + .04, ZP + .4, 0, .9, IRON, v=6))
P.append(cz("sunfoot", .05, ZP + .04, ZP + .08, 0, .9, IRON, v=6))
P.append(cz("sundisc", .1, ZP + .39, ZP + .42, 0, .9, "P_GOLD", v=10))
o = pfin(P, "Head", ang=30)
xf(o, t=(0, 0, 2.6))
set_origin(o, (0, 0, 2.6))
return dict(elev=20, azim=-35)
# ======================================================================= belt junctions
def lip(P, side):
"""A steel roller along an open edge: this way is a way through."""
if side == "front":
P.append(cx("lip", .02, -.44, .44, -.488, .338, "P_G4", v=6))
elif side == "back":
P.append(cx("lip", .02, -.44, .44, .488, .338, "P_G4", v=6))
else:
s = 1 if side == "+X" else -1
P.append(cy("lip", .02, -.44, .44, s * .488, .338, "P_G4", v=6))
def island(P, sx, sy, a1, a2):
"""A plank corner block in the dead corner of a junction with two arrows painted on it."""
o = [(.27, .33), (.33, .27), (.5, .27), (.5, .5), (.27, .5)]
G = pz([(sx * x, sy * y) for (x, y) in o], .3, .385, DECK, name="island")
P.append(grain(G, (1, 0, 0)))
P.append(pz([(sx * x, sy * y) for (x, y) in ((.33, .27), (.5, .27), (.5, .29), (.34, .29), (.29, .34), (.29, .5), (.27, .5), (.27, .33))], .385, .392, IRON, name="islandedge"))
P.append(arrow((sx * .375, sy * .395, .386), a1, s=.062, m=INK))
P.append(arrow((sx * .44, sy * .335, .3862), a2, s=.062, m=INK))
def sign3(P, x, y, z):
"""Sign: a round disc on an iron ring like a railway signal. The body keeps the ring and the arm, the disc is the part the code tints."""
for o in (cy("sback", .135, .012, .026, 0, 0, IRON, v=10), torus("sring", .128, .012, (0, 0, 0), "Y", seg=10, rseg=4, m=IRON)):
P.append(xf(o, rx=-.32, t=(x, y, z)))
P.append(box("sarm", x + .1, .47, y + .02, y + .05, z - .014, z + .014, IRON, bev=0))
o = cy("Sign", .118, -.013, .013, 0, 0, INK, v=10)
xf(o, rx=-.32)
o.location = (x, y, z)
uv_box(o, 1.0)
o.name = "Sign"
flat(o)
return o
def jbase(P):
"""junction_base of gc_up_production with cheap feet and braces: a junction stays under 2 500 tris."""
P.append(bx(-.49, .49, -.49, .49, .3, .345, IRON, bev=0, name="pan"))
for s in (-1, 1):
P.append(grain(bx(-.5, .5, s * .47 - .03, s * .47 + .03, .2, .33, TIM, bev=.012, name="stringer"), (1, 0, 0)))
P.append(bx(s * .47 - .03, s * .47 + .03, -.44, .44, .2, .33, TIM, bev=.012, name="stringer"))
for (sx, sy) in ((1, 1), (-1, 1), (1, -1), (-1, -1)):
P.append(beam((sx * .45, sy * .45, 0.0), (sx * .44, sy * .44, .22), .08, .08, bev=.012, name="leg"))
P.append(bx(sx * .45 - .05, sx * .45 + .05, sy * .45 - .05, sy * .45 + .05, 0.0, .03, IRON, bev=0, name="foot"))
for s in (-1, 1):
P.append(beam((s * .43, 0.0, .03), (-s * .43, 0.0, .2), .04, .03, bev=0, name="xbrace"))
P.append(beam((0.0, s * .43, .03), (0.0, -s * .43, .2), .04, .03, bev=0, name="xbrace"))
for k in range(4):
a = PI / 4 + k * PI / 2
P.append(xf(cube("mitre", (.56, .022, .006), (.34, 0, PR.SURF + .002), STL), rz=a))
P.append(cz("hubplate", .075, PR.SURF - .01, PR.SURF + .006, m=IRON, v=8))
def splitter():
PR.belt_surface({"back": -1, "front": 1, "left": 1, "right": 1})
P = []
jbase(P)
Z_B, HY = .93, .44
# the gate at the back, one post runs up to carry the signal
for s in (-1, 1):
P.append(grain(bx(s * .465 - .03, s * .465 + .03, .435, .495, .2, Z_B + .11, TIM, bev=.01, name="gatepost"), (0, 0, 1)))
P.append(box("gateband", s * .465 - .034, s * .465 + .034, .431, .499, .42, .45, IRON, bev=0))
P.append(beam((s * .46, .44, Z_B - .24), (s * .24, .44, Z_B + .01), .05, .05, bev=.006, name="knee"))
# wings at the back corners: the belt comes in through a throat, then the three ways open up
for za, zb, m_ in ((.37, .49, TIM), (.5, .6, RED)):
P.append(slab((s * .29, .435, za), (s * .47, .28, za), (s * .47, .28, zb), (s * .29, .435, zb), .026, (s, .9, .3), m_, bev=.004, name="wing"))
P.append(bx(s * .47 - .025, s * .47 + .025, .255, .305, .2, .635, TIM, bev=.006, name="stake"))
P.append(bx(s * .47 - .029, s * .47 + .029, .251, .309, .62, .65, IRON, bev=0, name="stakecap"))
P.append(prism("deck", [(s * .27, .5), (s * .5, .5), (s * .5, .27)], "XY", .345, .372, DECK))
rivet(P, (s * .385, .36, .43), (s, .9, 0), r=.014)
island(P, s, -1, -PI / 2, 0 if s > 0 else PI)
PR.corner_stub(P, s * .465, -.465, top=.5)
P.append(grain(bx(-.5, .5, .385, .495, Z_B, Z_B + .09, TIM, bev=.014, name="gatebeam"), (1, 0, 0)))
for x in (-.32, .32):
P.append(box("gatestrap", x - .018, x + .018, .381, .499, Z_B - .004, Z_B + .094, IRON, bev=0))
P.append(bx(-.09, .09, .39, .49, Z_B + .09, Z_B + .1, IRON, bev=0, name="bearingplate"))
for s in (-1, 1):
bolt(P, (s * .07, .44, Z_B + .1), (0, 0, 1), r=.01, m="P_G3")
lip(P, "+X" if s > 0 else "-X")
lip(P, "front")
SX, SZ = .35, 1.16
P.append(grain(bx(.445, .485, .445, .485, Z_B + .09, SZ + .16, TIM, bev=.006, name="signpost"), (0, 0, 1)))
P.append(bx(.44, .49, .44, .49, SZ + .16, SZ + .18, IRON, bev=0, name="signcap"))
sign3(P, SX, .44, SZ)
pfin(P, "Frame", ang=30)
# Paddle: a fork on the hinge. The pin rises through the gate beam, an arm reaches forward over the cargo and two guide boards
# hang from it either side of the bundle: they swing it left or right, and nothing cuts through a bundle going straight on.
AZ = Z_B + .125
Q = [cz("pin", .02, Z_B - .02, AZ + .05, 0, HY, STL, v=6),
cz("pincap", .032, AZ + .03, AZ + .06, 0, HY, IRON, v=6),
cz("collar", .042, Z_B + .1, Z_B + .112, 0, HY, IRON, v=6),
beam((0, HY, AZ), (0, .1, AZ), .06, .03, m=IRON, bev=0, name="arm"),
beam((-.3, .13, AZ), (.3, .13, AZ), .05, .03, m=IRON, bev=0, name="crossarm")]
for s in (-1, 1):
x = s * .285
Q.append(cyl_between("hanger", (x, .13, .59), (x, .13, AZ + .012), .016, STL, v=5))
Q.append(beam((x, .13, .84), (x, .36, .6), .022, .016, m=IRON, bev=0, name="stay"))
for za, zb, m_ in ((.385, .485, TIM), (.492, .592, RED)):
G = bx(-.014, .014, .05, .425, za, zb, m_, bev=.004, name="guide")
Q.append(grain(xf(G, t=(x, 0, 0)), (0, 1, 0)))
Q.append(bx(x - .018, x + .018, .03, .07, .38, .597, IRON, bev=0, name="guidenose"))
Q.append(box("guidestrap", x - .018, x + .018, .29, .32, .38, .597, IRON, bev=0))
Q.append(box("guidestrap", x - .018, x + .018, .12, .15, .38, .597, IRON, bev=0))
Q.append(arrow((0, .23, AZ + .015), -PI / 2, s=.16, m="P_RED", t=.02))
Q.append(arrow((0, .225, AZ + .036), -PI / 2, s=.105, m=INK, t=.006))
pfin(Q, "Paddle", ang=34, origin=(0, HY, .35))
return dict(elev=32, azim=-35)
def merger():
PR.belt_surface({"back": -1, "front": 1, "left": -1, "right": -1})
P = []
jbase(P)
Z0, Z1, Z_B = .36, .66, .93
XA, YA, XB, YB = .475, -.235, .29, -.455
for s in (-1, 1):
o = (s, -.8, .4)
# boards sweep up towards the gate
for za, zb, m_ in ((Z0, Z0 + .13, TIM), (Z0 + .14, Z1, RED)):
P.append(slab((s * XB, YB, za), (s * XA, YA, za), (s * XA, YA, za + (zb - za) * .8), (s * XB, YB, zb + .1 * (zb - Z0) / (Z1 - Z0)), .028, o, m_, bev=.004, name="guide"))
P.append(beam((s * XA, YA, .5 * (Z0 + Z1) + .125), (s * XB, YB, Z1 + .1), .05, .026, m=IRON, bev=0, name="gcap"))
P.append(bx(s * .468 - .03, s * .468 + .03, -.265, -.205, .2, .62, TIM, bev=.008, name="stake"))
P.append(bx(s * .468 - .033, s * .468 + .033, -.268, -.202, .6, .635, IRON, bev=0, name="stakecap"))
P.append(prism("deck", [(s * .44, -.235), (s * .5, -.235), (s * .5, -.5), (s * .27, -.5)], "XY", .345, .372, DECK))
mx, my = s * (XA + XB) / 2 + s * .012, (YA + YB) / 2 - .012
rivet(P, (mx, my, .42), (s, -.8, 0), r=.016)
rivet(P, (mx, my, .56), (s, -.8, 0), r=.016)
# the gate over the way out, its posts at the end of the wings
P.append(grain(bx(s * .325 - .035, s * .325 + .035, -.5, -.43, .2, Z_B + .1, TIM, bev=.01, name="gatepost"), (0, 0, 1)))
P.append(box("gateband", s * .325 - .039, s * .325 + .039, -.502, -.426, .42, .45, IRON, bev=0))
P.append(beam((s * .34, -.465, Z_B - .17), (s * .2, -.465, Z_B + .01), .045, .045, bev=.006, name="knee"))
island(P, s, 1, -PI / 2, PI if s > 0 else 0)
lip(P, "+X" if s > 0 else "-X")
PR.corner_stub(P, -.465, .465)
lip(P, "back")
P.append(grain(bx(-.42, .42, -.498, -.42, Z_B, Z_B + .1, TIM, bev=.014, name="gatebeam"), (1, 0, 0)))
for x in (-.33, .33):
P.append(box("gatestrap", x - .018, x + .018, -.502, -.416, Z_B - .004, Z_B + .104, IRON, bev=0))
# on top of the beam three arrows come together into one
P.append(bx(-.26, .26, -.5, -.43, Z_B + .1, Z_B + .112, RED, bev=0, name="beamplate"))
for x, a in ((-.17, -1.05), (.17, -PI + 1.05), (0, -PI / 2)):
P.append(arrow((x, -.458, Z_B + .112), a, s=.042, m=INK, t=.006))
SX, SZ = .35, .78
P.append(grain(bx(.445, .485, .445, .485, .2, SZ + .16, TIM, bev=.006, name="signpost"), (0, 0, 1)))
P.append(bx(.44, .49, .44, .49, SZ + .16, SZ + .18, IRON, bev=0, name="signcap"))
sign3(P, SX, .44, SZ)
pfin(P, "Frame", ang=30)
return dict(elev=32, azim=-35)
# ======================================================================= sorter
def end_light(name, ang):
"""The end of a straight belt, cheap. BeltLinks hides it where a neighbour joins."""
P = []
for s in (-1, 1):
P.append(bx(min(s * .42, s * .5), max(s * .42, s * .5), .49, .514, .2, .36, PRED, bev=0, name="endboard"))
P.append(bx(min(s * .402, s * .5), max(s * .402, s * .5), .488, .514, .386, .47, IRON, bev=0, name="railshoe"))
P.append(cx("hub", .034, min(s * .49, s * .506), max(s * .49, s * .506), .46, .312, IRON, v=8))
P.append(bx(-.415, .415, .484, .514, .244, .282, TIM, bev=0, name="endbar"))
o = pfin(P, name, ang=30)
if ang:
xf(o, rz=ang)
return o
def sorter():
FM.belt_mesh(V3.belt_object)
P = []
# trestle and side frames
for s in (-1, 1):
x0, x1 = sorted((s * .42, s * .5))
P.append(grain(bx(x0, x1, -.5, .5, .22, .34, TIM, bev=.008, name="stringer"), (0, 1, 0)))
for y in (-.43, .43):
P.append(bx(s * .46 - .04, s * .46 + .04, y - .04, y + .04, .0, .22, TIM, bev=0, name="leg"))
P.append(bx(s * .46 - .055, s * .46 + .055, y - .055, y + .055, .0, .025, IRON, bev=0, name="foot"))
for y in (-.43, .43):
P.append(bx(-.42, .42, y - .03, y + .03, .1, .16, TIM, bev=0, name="tie"))
# the guard rail on the way past, opened up on the +X side where the kicker sends things off
for y0, y1 in ((-.5, -.36), (.36, .5)):
for s in (-1, 1):
P.append(grain(sb(s, .402, .5, y0, y1, .386, .47, TIM, bev=.006, name="rail"), (0, 1, 0)))
for y in (-.36, .36):
P.append(bx(.396, .506, y - .02, y + .02, .38, .476, IRON, bev=0, name="railstop"))
# rollers across the side way out, a hazard-painted sill under them
P.append(bx(.42, .5, -.36, .36, .33, .345, "P_G1", bev=0, name="sill"))
for y in (-.27, -.09, .09, .27):
P.append(cx("roller", .03, .42, .5, y, .365, "P_G4", v=6))
def sill(out, col):
P.append(px(out, .5, .504, col, name="hazsill"))
haz(-.36, .36, .24, .34, 8, sill)
# the kicker's house: a red plank wall on the -X side, two stout posts
Z_T = 1.1
W = .4
for y in (-W, W):
P.append(grain(bx(-.5, -.42, y - .05, y + .05, .2, Z_T + .03, TIM, bev=.008, name="post"), (0, 0, 1)))
P.append(box("postband", -.504, -.416, y - .054, y + .054, .49, .52, IRON, bev=0))
n = 6
for k in range(n):
a = -W + .05 + k * (2 * W - .1) / n
P.append(grain(bx(-.5, -.478, a + .004, a + (2 * W - .1) / n - .004, .47, Z_T, RED, bev=0, name="plank"), (0, 0, 1)))
P.append(bx(-.477, -.47, -.25, .25, .9, .92, "P_G1", bev=0, name="backstrip"))
# arms out over the belt, knees under them, tin on top falling to the side the bundles leave by
for y in (-W, W):
P.append(grain(bx(-.5, .47, y - .04, y + .04, Z_T - .08, Z_T, TIM, bev=.008, name="arm"), (1, 0, 0)))
P.append(beam((-.44, y, .78), (-.16, y, Z_T - .07), .05, .05, bev=.006, name="knee"))
P.append(grain(bx(.42, .48, -W - .05, W + .05, Z_T - .09, Z_T, TIM, bev=.008, name="tiebeam"), (0, 1, 0)))
P.append(grain(bx(-.46, -.4, -W, W, Z_T - .09, Z_T, TIM, bev=.008, name="tiebeam"), (0, 1, 0)))
ZR0, ZR1 = Z_T + .085, Z_T + .005
a_, b_, c_, d_ = (-.51, -.5, ZR0), (.51, -.5, ZR1), (.51, .5, ZR1), (-.51, .5, ZR0)
P.append(uv_wall(board(a_, b_, c_, d_, .018, TIN, bev=0, along="ad", name="roof")))
tilt = math.atan2(ZR0 - ZR1, 1.02)
P.append(arrow((0, 0, (ZR0 + ZR1) / 2 + .001), 0, s=.27, m="P_GOLD", t=.006, tilt=-tilt))
# the rail the kicker's carriage runs on, hung from the two tie beams
P.append(cx("rail", .024, -.46, .44, 0, .955, "P_G4", v=8))
for x in (-.44, .44):
P.append(bx(x - .022, x + .022, -.02, .02, .955, Z_T - .08, IRON, bev=0, name="railhanger"))
# a barn lamp over the way in, on a gooseneck from the wall: this is where a bundle is looked at
P.append(ptube("goose", soft([(-.46, .3, 1.02), (-.32, .3, 1.06), (-.12, .3, 1.05), (.0, .3, .98), (.0, .3, .92)]), .014, "P_G1", segs=5))
P.append(revm("shade", [(.012, .93), (.05, .92), (.1, .875), (.17, .8), (.178, .79), (.17, .79), (.09, .865), (.04, .9)], [GRN, GRN, GRN, "P_WHITE", "P_WHITE", "P_WHITE", "P_WHITE"], segs=10, loc=(0, .3, 0), cap_top=True))
pfin(P, "Frame", ang=32)
S = [sphere("bulb", .05, (0, .3, .85), seg=8, rings=5, m="M_Emissive", scale=(1, 1, 1.15)),
box("strip", -.477, -.471, -.22, .22, .905, .915, "M_Emissive", bev=0)]
sc = join(S, "Scanner")
uv_box(sc, 1)
end_light("EndIn", 0.0)
end_light("EndOut", PI)
# Pusher: a red kicker on a rod from a carriage on the rail. It faces +X. Origin (-0.47, 0, 0.42)
Q = [bx(-.47, -.436, -.3, .3, .375, .57, PRED, bev=.006, name="plate"),
box("pad", -.436, -.42, -.28, .28, .39, .555, LEA, bev=0),
bx(-.48, -.465, -.05, .05, .39, .56, IRON, bev=0, name="rib"),
cyl_between("rod", (-.455, 0, .55), (-.455, 0, .93), .022, STL, v=6),
bx(-.47, -.3, -.03, .03, .915, .94, IRON, bev=0, name="arm"),
bx(-.4, -.27, -.06, .06, .93, 1.0, RED, bev=.01, name="carriage"),
cy("wheel", .03, -.075, -.055, -.355, .985, IRON, v=6),
cy("wheel", .03, .055, .075, -.355, .985, IRON, v=6)]
# gold and black on the face it shoves with
def face(out, col):
Q.append(px(out, -.42, -.416, col, name="hazpad"))
haz(-.28, .28, .39, .555, 7, face)
for s in (-1, 1):
Q.append(beam((-.451, s * .2, .56), (-.451, 0, .74), .026, .018, m=IRON, bev=0, name="strut"))
pfin(Q, "Pusher", ang=32, origin=(-.47, 0, .42))
return dict(elev=28, azim=140)
# ======================================================================= binder
def bundle(P, c, s=(.46, .3, .3), rx=0.0, rz=0.0, ry=0.0, bands=2, m="M_Clippings"):
"""A tied grass bundle, the thing that rides the belts."""
G = [uv_wall(rbox("bundle", s, (0, 0, 0), bevel=.03, segs=1, m=m))]
for k in range(bands):
x = (k - (bands - 1) / 2) * s[0] * .46
G.append(box("bband", x - .014, x + .014, -s[1] / 2 - .006, s[1] / 2 + .006, -s[2] / 2 - .006, s[2] / 2 + .006, TWINE, bev=0))
for o in G:
P.append(xf(o, rx=rx, ry=ry, rz=rz, t=c))
def binder():
P = []
farm_skid(P, -.88, .88, -.84, .92, n=4)
H = .46 # half width of the bale chamber
Y0, Y1, Z0, ZT = -.72, .5, .2, .9
# the bale chamber is a cage: a red trough below, hoops and rails above, the squeezed hay showing through
P.append(bx(-H, H, Y0, Y1, Z0, .5, PRED, bev=.02, name="trough"))
P.append(box("sill", -H - .01, H + .01, Y0 - .01, Y1 + .01, .13, .25, IRON, bev=0))
P.append(box("stripe", -H - .004, H + .004, Y0 - .004, Y1 + .004, .4, .46, CRM, bev=0))
hb = uv_wall(rbox("hayblock", (2 * H - .1, Y1 - Y0 - .02, ZT - .5 + .02), (0, (Y0 + Y1) / 2, (ZT + .5) / 2), bevel=.02, segs=1, m=HAY))
P.append(hb)
for y in (-.66, -.36, -.06, .24, .46):
for s in (-1, 1):
P.append(sb(s, H, H + .03, y - .03, y + .03, .2, ZT + .05, IRON, bev=.004, name="hoop"))
rivet(P, (s * (H + .03), y, .3), (s, 0, 0), r=.013)
rivet(P, (s * (H + .03), y, .8), (s, 0, 0), r=.013)
P.append(bx(-H - .03, H + .03, y - .03, y + .03, ZT, ZT + .05, IRON, bev=.004, name="hooptop"))
for s in (-1, 1):
for z in (.62, .78):
P.append(sb(s, H - .005, H + .018, Y0, Y1, z - .016, z + .016, STL, bev=0, name="cagerail"))
# the mouth: an iron throat the bale is squeezed out of, a bale half out on the roller chute
for s in (-1, 1):
P.append(bx(min(s * .3, s * .46), max(s * .3, s * .46), Y0 - .08, Y0, .24, ZT, IRON, bev=.012, name="throat"))
P.append(bx(-.46, .46, Y0 - .08, Y0, .72, ZT, IRON, bev=.012, name="throat"))
P.append(bx(-.46, .46, Y0 - .08, Y0, .24, .34, IRON, bev=.012, name="throat"))
P.append(box("mouthdark", -.3, .3, Y0 - .02, Y0 + .002, .34, .72, SOOT, bev=0))
farm_chute(P, -.78, -1.0, .62, .4, 0.0, n=3)
bale(P, (0, -.8, .55), sx=.5, sy=.3, sz=.3)
# feed hopper, flaring out, a hopper full of cut grass
plank_funnel(P, 0, .02, ZT + .05, 1.5, .34, .64, 3, [TIM, RED, TIM])
hay_heap(P, (0, .02, 1.38), .5, .5, .2, m="M_Clippings", tufts=5)
for sx, sy in ((1, 1), (-1, 1), (1, -1), (-1, -1)):
P.append(beam((sx * .46, sy * .46 + .02, ZT + .04), (sx * .64, sy * .64 + .02, 1.5), .05, .05, name="hopstay"))
iron_corner(P, sx * .64, sy * .64 + .02, 1.34, 1.5, sx, sy, w=.09)
# at the back: the gear case, red, cream band, under the twine
P.append(bx(-.5, .5, Y1, .9, .14, .94, RED, bev=.02, name="gearcase"))
P.append(box("gearband", -.504, .504, Y1, .904, .62, .68, CRM, bev=0))
P.append(bx(-.53, .53, Y1 - .02, .92, .94, .98, TIN, bev=.008, name="gearlid"))
rivets(P, (-.4, .9, .86), (.4, .9, .86), 4, (0, 1, 0))
star_badge(P, (0, .908, .4), .3, (0, 1, 0))
# twine: two spools on the gear case, twine over a guide bar to the two knotters on the cage
for x in (-.28, .28):
P.append(cz("spindle", .02, .98, 1.34, x, .71, STL, v=6))
P.append(revm("spool", [(.06, 1.0), (.15, 1.0), (.15, 1.02), (.13, 1.04), (.13, 1.26), (.15, 1.28), (.15, 1.3), (.06, 1.3)],
[TIM, TIM, TWINE, TWINE, TWINE, TWINE, TIM], segs=10, loc=(x, .71, 0)))
# knotters at the front of the cage: an iron arch with a curved needle each side of the bale
KY = -.5
for s in (-1, 1):
P.append(sb(s, .22, .29, KY - .1, KY + .1, ZT + .05, ZT + .12, IRON, bev=.006, name="knotbase"))
P.append(ptube("needle", soft([(s * .255, KY, ZT + .1), (s * .255, KY - .06, ZT + .3), (s * .255, KY + .08, ZT + .42), (s * .255, KY + .2, ZT + .3)], 2), .014, "P_G4", segs=5))
P.append(cx("knotwheel", .07, min(s * .2, s * .22), max(s * .2, s * .22), KY, ZT + .15, PRED, v=8))
rope_line(P, ((s * .28, .6, 1.2), (s * .255, KY + .19, ZT + .31)), r=.005, m=TWINE, sag=.03, n=3)
P.append(ptube("twinedown", [(s * .255, KY, ZT + .1), (s * .23, KY - .22, ZT + .02)], .005, TWINE, segs=4))
P.append(cx("knotshaft", .022, -.2, .2, KY, ZT + .15, STL, v=6))
# the drive on the left: flywheel at the back, crank, connecting rod, the crosshead that drives the plunger on its slide
FX, FY, FZ, FR = -.72, .34, .6, .42
spoked(P, (FX, FY, FZ), "X", R=FR, w=.08, n=6, rim=IRON, spoke=PRED, hub=IRON, segs=16)
P.append(cx("wshaft", .034, FX, -.5, FY, FZ, STL, v=6))
P.append(bx(-.56, -.5, FY - .1, FY + .1, FZ - .1, FZ + .1, IRON, bev=.008, name="bearing"))
CA = 2.3
cp = Vector((FX + .07, FY + .27 * math.cos(CA), FZ + .27 * math.sin(CA)))
P.append(cx("crankpin", .03, cp.x - .05, cp.x + .06, cp.y, cp.z, STL, v=6))
XH = Vector((-.565, -.3, .7))
P.append(beam((cp.x + .04, cp.y, cp.z), XH, .05, .05, m=GRN, bev=.008, name="conrod"))
P.append(bx(-.6, -.53, -.38, -.22, .63, .77, RED, bev=.01, name="crosshead"))
for z in (.62, .78):
P.append(cy("slide", .018, -.62, .1, -.55, z, STL, v=6))
for y in (-.62, .06):
P.append(bx(-.57, -.49, y - .025, y + .025, .59, .81, IRON, bev=0, name="slidestand"))
# the side the player stands at: a step and a tool box, the sign
P.append(bx(.54, .86, -.46, -.2, .16, .36, GRN, bev=.014, name="toolbox"))
P.append(box("toollid", .53, .87, -.47, -.19, .36, .4, IRON, bev=0))
P.append(bx(.62, .78, -.34, -.32, .4, .44, STL, bev=0, name="toolhandle"))
sb_ = plate("signboard", .34, .13, .012, CRM, r=.015)
P.append(uv_wall(orient(sb_, "+X", (.53, .7, .78))))
sign_text(P, "BINDER", .066, PRED, (.542, .7, .78), facing="+X")
status_lamp(P, .62, -.62, 1.24, arm=(.5, -.62, ZT + .03))
pfin(P, "Body", ang=30)
return dict(elev=25, azim=-35)
# ======================================================================= bundle catcher
def catcher():
drop = ("net", "rim", "hoop", "throat", "rib", "patch", "heap", "wisp", "chute", "chuteside", "chstrap", "chband", "boxb", "boxpost", "mast", "flag")
def add(P):
RT, ZT, RB, ZB = 1.42, 2.55, .42, 1.25
N = 12
def rz_(z):
return RB + (RT - RB) * (z - ZB) / (ZT - ZB)
# the inside: a shallow painted target down the cone, what a Reaper aims at
B = [(z, m_) for z, m_ in ((1.25, PRED), (1.5, CRM), (1.76, PRED), (2.04, CRM), (2.3, PRED))]
IN = .05
prof = [(RB - IN, ZB)]
mats = []
for k, (z, m_) in enumerate(B):
z1 = B[k + 1][0] if k + 1 < len(B) else ZT
prof.append((rz_(z1) - IN, z1))
mats.append(m_)
prof += [(rz_(ZT) - IN + .015, ZT), (RB - IN + .015, ZB)]
mats += [SOOT, SOOT, SOOT]
P.append(uv_wall(revm("cone", prof, mats, segs=N, closed=True, a0=15, a1=375)))
# staves on the outside, with a gap between them, so from the ground it is a great basket
for k in range(N):
a = TAU * (k + .5) / N + math.radians(15) - PI / 12
c, s = math.cos(a), math.sin(a)
t = Vector((-s, c, 0))
R0, R1 = RB + .05, RT
w0, w1 = TAU * R0 / N * .47, TAU * R1 / N * .47
def p(r_, z_, sgn, wd):
return Vector((c * r_, s * r_, z_)) + t * sgn * wd
m_ = TIM
o = board(p(R0, ZB, -1, w0), p(R0, ZB, 1, w0), p(R1, ZT, 1, w1), p(R1, ZT, -1, w1), .03, m_, bev=0, along="ad", name="stave")
P.append(o)
# hoops, and a heavy tin rim with a timber collar
P.append(uv_wall(torus("rim", RT, .055, (0, 0, ZT + .01), "Z", seg=N * 2, rseg=4, m=TIN)))
for z, r_ in ((ZT - .34, .03), (ZB + .5, .03)):
P.append(xf(torus("hoop", rz_(z) + .085, r_, (0, 0, z), "Z", seg=N, rseg=4, m=IRON), rz=PI / N * 0))
for k in range(N):
a = TAU * k / N + math.radians(15)
c, s = math.cos(a), math.sin(a)
rivet(P, (c * (rz_(ZT - .34) + .12), s * (rz_(ZT - .34) + .12), ZT - .34), (c, s, 0), r=.02)
# the throat, bundles caught in it
P.append(torus("throat", RB, .05, (0, 0, ZB), "Z", seg=12, rseg=4, m=IRON))
bundle(P, (-.1, .04, 1.5), rx=.5, rz=.7)
bundle(P, (.2, -.1, 1.56), rx=-.4, ry=.3, rz=-.5)
bundle(P, (-.02, .22, 1.72), rx=.2, ry=-.6, rz=1.9, bands=2)
for k in range(6):
a = TAU * k / 6 + .3
tuft(P, (RT - .1) * math.cos(a), (RT - .1) * math.sin(a), ZT + .03, L=.14, n=3, az=a + PI)
# a rope backstop on three poles at the back of the rim, bundles that come in flat land in it. The flag rides the middle pole
Pol = [math.radians(a) for a in (38, 90, 142)]
ZN, RN = 3.28, 1.4
for a in Pol:
c, s = math.cos(a), math.sin(a)
P.append(beam((c * RN, s * RN, ZT - .2), (c * RN, s * RN, ZN), .09, .09, name="netpole"))
P.append(cz("polecap", .06, ZN, ZN + .035, c * RN, s * RN, IRON, v=6))
# net: rope along the top and across, sagging, and uprights
Arc = [math.radians(38 + 104 * i / 8) for i in range(9)]
for z, sg in ((ZN - .03, .1), (ZN - .3, .07), (ZN - .54, .04)):
pts = [(math.cos(a) * RN, math.sin(a) * RN, z - sg * math.sin(PI * ((i % 4) / 4))) for i, a in enumerate(Arc)]
P.append(ptube("netrope", pts, .011, ROPE, segs=4))
for i in (1, 2, 3, 5, 6, 7):
a = Arc[i]
sg = .1 * math.sin(PI * ((i % 4) / 4))
P.append(ptube("netdrop", [(math.cos(a) * RN, math.sin(a) * RN, ZN - .03 - sg), (math.cos(a) * RN, math.sin(a) * RN, ZT + .06)], .009, ROPE, segs=4))
P.append(beam((0, RN, ZN), (0, RN, 3.72), .04, .04, m=STL, bev=0, name="flagpole"))
P.append(prism("flag", [(0.0, 3.7), (.46, 3.6), (0.0, 3.44)], "XZ", RN - .008, RN + .008, PRED))
# the bin under the throat: red boards, posts, a brass window so the level can be read
P.append(bx(-.5, .5, -.5, .5, .78, 1.24, SOOT, bev=0, name="bincore"))
boards(P, (0, -.5, 0), "-Y", 1.0, .78, 1.24, 6, m=RED)
boards(P, (0, .5, 0), "+Y", 1.0, .78, 1.24, 6, m=RED)
boards(P, (.5, 0, 0), "+X", 1.0, .78, 1.24, 6, m=RED)
boards(P, (-.5, 0, 0), "-X", 1.0, .78, 1.24, 6, m=RED)
for (sx, sy) in ((1, 1), (-1, 1), (1, -1), (-1, -1)):
P.append(bx(sx * .5 - .05, sx * .5 + .05, sy * .5 - .05, sy * .5 + .05, .74, 1.27, TIM, bev=.01, name="binpost"))
iron_corner(P, sx * .55, sy * .55, .8, 1.0, sx, sy, w=.08)
for z in (.92, 1.14):
P.append(box("binband", -.535, .535, -.535, .535, z - .018, z + .018, IRON, bev=0))
# the way out: a wide roller chute from the bin to belt height at the front edge, a bundle riding down it
A, B_ = Vector((0, -.5, 1.06)), Vector((0, -1.44, .42))
d = (B_ - A)
L = d.length
n = 7
for k in range(n):
q = A.lerp(B_, (k + .5) / n)
P.append(grain(cx("roller", .04, -.36, .36, q.y, q.z - .03, "P_G4", v=6), (1, 0, 0)))
for s in (-1, 1):
P.append(beam(A + Vector((s * .4, 0, -.02)), B_ + Vector((s * .4, 0, -.02)), .07, .2, m=RED, bev=.008, name="chuterail"))
P.append(beam(A + Vector((s * .4, 0, .095)), B_ + Vector((s * .4, 0, .095)), .08, .03, m=IRON, bev=0, name="chutecap"))
for t in (.25, .75):
q = A.lerp(B_, t)
bolt(P, (s * .436, q.y, q.z - .02), (s, 0, 0), r=.02, m="P_G3")
P.append(bx(-.44, .44, -1.503, B_.y + .05, .3, .42, IRON, bev=.006, name="chutelip"))
q = A.lerp(B_, .52)
bundle(P, (q.x, q.y, q.z + .17), rx=math.atan2(-d.z, -d.y) * -1, s=(.48, .3, .3))
# gold arrows on the rails tell which way it runs
for s in (-1, 1):
q = A.lerp(B_, .5)
ang = math.atan2(d.z, d.y)
P.append(px([(q.y + a_ * .14 * math.cos(ang) - b_ * .14 * math.sin(ang), q.z - .02 + a_ * .14 * math.sin(ang) + b_ * .14 * math.cos(ang)) for (a_, b_) in ((-1, -.34), (.1, -.34), (.1, -.7), (1, 0), (.1, .7), (.1, .34), (-1, .34))],
min(s * .436, s * .442), max(s * .436, s * .442), "P_GOLD", name="arrow"))
r = patched(PR, "ffin", PR.catcher, drop=drop, add=add)
return dict(elev=25, azim=-35)
# ======================================================================= dock
def dock():
P = []
TOP = .16
R = 1.16 # the dish the robot parks in: it stands on the ground at the origin, facing whichever way it came home
# the pad: planks stopping at the dish, gaps you could lose a spanner in
chord = lambda y: math.sqrt(max(0.0, R * R - y * y))
for k in range(10):
y = -1.35 + k * .3
y0, y1 = y - .137, y + .137
t = TOP - random.choice((0, 0, .006))
c0, c1 = chord(y0), chord(y1)
if c0 < 1e-6 and c1 < 1e-6:
e0, e1 = random.uniform(-.03, .03), random.uniform(-.03, .03)
P.append(grain(bx(-1.38 + e0, 1.38 + e1, y0, y1, 0.0, t, DECK, bev=.006, name="plank"), (1, 0, 0)))
else:
for s in (-1, 1):
pts = [(-1.38, y0), (-c0 + .04, y0), (-c1 + .04, y1), (-1.38, y1)]
pts = [(s * a, b) for a, b in pts]
P.append(grain(pz(pts, 0.0, t, DECK, name="plank"), (1, 0, 0)))
for x, y in ((-1.2, .75), (1.22, -.75)):
P.append(bx(x - .13, x + .13, y - .065, y + .065, TOP - .004, TOP + .01, TIM, bev=.004, name="patch"))
# the dish: steel sloping down to a floor at the ground, ribs, a painted ring, a brass contact in the middle
P.append(cz("dishfloor", 1.0, 0, .03, m="P_G2", v=20))
P.append(revm("dishramp", [(1.0, .03), (R + .02, TOP + .004), (R + .02, 0), (1.0, 0)], "P_G3", segs=20, closed=True))
P.append(revm("rimring", [(R - .04, TOP + .006), (R + .07, TOP + .006), (R + .07, TOP + .024), (R - .04, TOP + .024)], "P_G1", segs=20, closed=True))
P.append(revm("paint", [(.78, .03), (.86, .03), (.86, .034), (.78, .034)], "P_GOLD", segs=20, closed=True))
for k in range(10):
a = TAU * k / 10 + .157
o = bx(.32, .98, -.02, .02, .025, .05, "P_G1", bev=0, name="rib")
P.append(xf(o, rz=a))
if k % 2 == 0:
bolt(P, ((R + .015) * math.cos(a), (R + .015) * math.sin(a), TOP + .024), (0, 0, 1), r=.012, m="P_G3")
P.append(cz("contactbase", .3, .025, .04, m="P_DGREY", v=12))
P.append(cz("contact", .2, .04, .052, m="M_Brass", v=10))
# kerbs
for sx in (-1, 1):
P.append(bx(sx * 1.43 - .07, sx * 1.43 + .07, -1.5, 1.5, 0, .2, TIM, bev=.016, name="kerb"))
P.append(bx(-1.5, 1.5, 1.36, 1.5, 0, .2, TIM, bev=.016, name="kerb"))
for sx in (-1, 1):
P.append(sb(sx, .44, 1.5, -1.492, -1.36, 0, .2, TIM, bev=.016, name="kerb"))
P.append(uv_wall(sb(sx, .72, 1.26, -1.5, -1.49, .05, .15, "M_Hazard", name="kerbstripe")))
# --------------------------------------------------- the tying gate over the way out: bundles leave here for the belt
GX0, GX1, GY0, GY1 = .34, .44, -1.5, -1.2
for s in (-1, 1):
P.append(grain(sb(s, GX0, GX1, GY0, GY1, 0, 1.0, RED, bev=.01, name="gatecheek"), (0, 0, 1)))
for z in (.26, .84):
P.append(sb(s, GX1 - .004, GX1 + .012, GY0 - .006, GY1 + .006, z - .025, z + .025, IRON, name="gateband"))
rivet(P, (s * (GX1 + .012), -1.35, .84), (s, 0, 0), r=.016)
P.append(bx(-.44, .44, GY0, GY1, .8, 1.0, RED, bev=.012, name="gatehead"))
P.append(box("gatestripe", -.446, .446, GY0 - .006, GY1 + .006, .86, .92, CRM, bev=0))
P.append(bx(-.34, .34, GY0, GY1, .1, .16, "P_G1", bev=0, name="gatefloor"))
for k in range(4):
y = -1.46 + k * .085
P.append(cx("roller", .04, -.34, .34, y, .34, "P_G4", v=6))
P.append(bx(-.34, .34, -1.5, -1.2, .24, .27, IRON, bev=0, name="rollerpan"))
# a tied bundle coming out at belt height, twine on a spool on top, the hopper the hose empties into
bundle(P, (0, -1.32, .55), s=(.46, .3, .3))
plank_funnel(P, 0, -1.25, 1.0, 1.28, .15, .25, 2, [TIM, RED])
hay_heap(P, (0, -1.25, 1.22), .2, .2, .08, m="M_Clippings", tufts=2)
for s in (-1, 1):
P.append(revm("spool", [(.03, 1.02), (.1, 1.02), (.1, 1.2), (.03, 1.2)], [TIM, TWINE, TIM], segs=8, loc=(s * .36, -1.33, 0), cap_top=True) if s > 0 else None)
# the hose that takes the load off the robot: down over the dish on a boom, ribbed, up into the hopper
Hp = soft([(0, -1.25, 1.25), (.02, -1.14, 1.46), (.04, -.86, 1.5), (.04, -.56, 1.4), (.04, -.42, 1.2), (.04, -.4, 1.04)], 2)
P.append(ptube("hose", Hp, .075, "P_BLACK", segs=6))
for i in range(2, len(Hp) - 1, 2):
d = (Vector(Hp[i + 1]) - Vector(Hp[i - 1])).normalized()
P.append(cyl_between("hoseband", Vector(Hp[i]) - d * .014, Vector(Hp[i]) + d * .014, .086, "P_G3", v=6))
P.append(cz("hosemouth", .12, .92, 1.04, .04, -.4, TIN, v=8, r2=.082))
# a boom out from the shed's header carries it
P.append(beam((.04, .46, 1.56), (.04, -.68, 1.62), .08, .1, name="boom"))
P.append(beam((.04, .46, 1.3), (.04, .0, 1.58), .05, .05, m=IRON, bev=0, name="boomstay"))
P.append(box("boomstrap", -.02, .1, -.64, -.6, 1.3, 1.6, IRON, bev=0))
P.append(box("boomstrap", -.02, .1, -.46, -.42, 1.3, 1.6, IRON, bev=0))
# --------------------------------------------------- the lean-to: high against the back wall, tin falling to the front
Yf, Yb, Zf, Zb = .52, 1.42, 1.56, 1.94
def roofz(y):
return Zf + (Zb - Zf) * (y - Yf) / (Yb - Yf)
for x in (-1.32, 1.32):
P.append(beam((x, Yf, .16), (x, Yf, Zf), .14, .14, name="post"))
P.append(beam((x, Yb, .16), (x, Yb, Zb), .14, .14, name="post"))
P.append(bx(x - .1, x + .1, Yf - .1, Yf + .1, .16, .22, "P_G1", bev=0, name="postshoe"))
P.append(beam((x, Yf + .02, 1.22), (x, Yf + .46, roofz(Yf + .46) - .1), .06, .08, name="brace"))
P.append(beam((-1.4, Yf, Zf + .02), (1.4, Yf, Zf + .02), .12, .16, name="header"))
P.append(beam((-1.4, Yb, Zb + .02), (1.4, Yb, Zb + .02), .1, .14, name="plate"))
for x in (-.88, -.3, .3, .88):
P.append(beam((x, Yf - .24, roofz(Yf - .24) + .06), (x, Yb + .03, roofz(Yb + .03) + .06), .07, .1, name="rafter"))
decal(P, (0, Yf - .062, Zf + .02), .34, .13, (0, -1, 0), R_52)
# back wall: red boards with gaps on dark backing, a timber rail
P.append(bx(-1.3, 1.3, Yb - .012, Yb + .002, .18, Zb, "P_BLACK", bev=0, name="backing"))
P.append(bx(1.325, 1.335, Yf + .02, Yb - .02, .24, 1.34, "P_BLACK", bev=0, name="backing"))
x = -1.3
while x < 1.3:
w = random.choice((.2, .24, .26))
x1 = min(1.3, x + w)
P.append(bx(x + .008, x1 - .008, Yb - .03, Yb + .02, .18, Zb, RED, bev=.006, name="wallboard"))
x = x1
P.append(bx(-1.3, 1.3, Yb - .055, Yb - .03, 1.0, 1.08, TIM, bev=0, name="rail"))
# side wall on one side only, half height with the barn's white X
for k in range(5):
z = .24 + k * .22
P.append(bx(1.30, 1.36, Yf + .02, Yb - .02, z, z + .2, RED, bev=.006, name="sideboard"))
P.append(beam((1.385, Yf + .06, .3), (1.385, Yb - .08, 1.26), .05, .09, m="P_WHITE", bev=0, name="xbrace"))
P.append(beam((1.385, Yf + .06, 1.26), (1.385, Yb - .08, .3), .05, .09, m="P_WHITE", bev=0, name="xbrace"))
# tin roof: five overlapping sheets, one rusty, one sat crooked, a gutter along the low edge
Y2 = Yf - .36
for k in range(5):
x0 = -1.5 + k * .59
x1 = x0 + .64
yo = -.02 if k == 3 else 0
zo = .13
a, b, c, d = (x0, Y2 + yo, roofz(Y2) + zo), (x1, Y2 + yo, roofz(Y2) + zo), (x1, Yb + .08 + yo, roofz(Yb + .08) + zo), (x0, Yb + .08 + yo, roofz(Yb + .08) + zo)
P.append(uv_wall(board(a, b, c, d, .02, TIN, bev=0, along="ad", name="roof")))
for t in (.08, .5, .92):
bolt(P, ((x0 + x1) / 2, a[1] + (d[1] - a[1]) * t, a[2] + (d[2] - a[2]) * t), (0, -.42, .91), r=.012, m="P_G1")
for (x, y, w, h) in ((.385, .62, .09, .34), (.975, .78, .07, .26), (-.8, .5, .08, .22), (-.21, .92, .06, .3)):
rust(P, (x, y, roofz(y) + .133), w, h, (0, -.42, .91), heart=False)
P.append(bx(-1.5, 1.5, Y2 - .09, Y2 - .0, roofz(Y2) + .03, roofz(Y2) + .1, "P_G3", bev=0, name="gutter"))
# what a shed collects
P.append(bx(-1.28, -.44, 1.02, 1.36, .56, .62, TIM, bev=.01, name="bench"))
for x in (-1.2, -.52):
P.append(bx(x - .03, x + .03, 1.06, 1.1, .16, .56, TIM, bev=0, name="benchleg"))
P.append(bx(x - .03, x + .03, 1.3, 1.34, .16, .56, TIM, bev=0, name="benchleg"))
P.append(bx(-1.2, -.52, 1.08, 1.32, .3, .33, TIM, bev=0, name="benchshelf"))
MA.jerrycan(P, -.66, 1.2, .62, m="P_RED", rz=.3)
P.append(cz("oilcan", .05, .62, .72, -1.02, 1.2, "P_G3", v=8, r2=.03))
P.append(cyl_between("oilspout", (-1.02, 1.2, .71), (-.9, 1.14, .80), .008, "P_G3", v=4))
P.append(cz("tinbox", .08, .33, .43, -.92, 1.2, "P_ORANGE", v=8))
P.append(bx(-1.2, -.62, Yb - .05, Yb - .03, 1.14, 1.5, TIM, bev=0, name="toolboard"))
P.append(beam((-1.08, Yb - .06, 1.2), (-1.08, Yb - .06, 1.42), .025, .012, m="P_G4", bev=0, name="spanner"))
P.append(bx(-1.11, -1.05, Yb - .062, Yb - .05, 1.42, 1.46, "P_G4", bev=0, name="spannerhead"))
P.append(beam((-.9, Yb - .06, 1.2), (-.9, Yb - .06, 1.42), .02, .014, m=TIM, bev=0, name="hammer"))
P.append(bx(-.95, -.85, Yb - .066, Yb - .05, 1.4, 1.45, "P_G1", bev=0, name="hammerhead"))
bale(P, (.98, 1.14, .32), sx=.56, sy=.42, sz=.32)
bale(P, (.94, 1.12, .64), sx=.56, sy=.42, sz=.32, rz=.1)
rope_coil(P, (.42, 1.27, TOP), r=.13, turns=3, t=.016)
# --------------------------------------------------- the charging post, its boom over the dish and the cable dropping to the contact
cxp, cyp = -1.22, -1.22
P.append(beam((cxp, cyp, .16), (cxp, cyp, 1.34), .12, .12, name="charger"))
P.append(bx(cxp - .1, cxp + .1, cyp - .1, cyp + .1, .16, .24, "P_G1", bev=0, name="chargerfoot"))
P.append(beam((cxp + .26, cyp, .16), (cxp, cyp, .62), .05, .05, name="stay"))
P.append(beam((cxp, cyp + .26, .16), (cxp, cyp, .62), .05, .05, name="stay"))
P.append(bx(cxp - .14, cxp + .14, cyp - .11, cyp + .11, .72, 1.12, "P_RED", bev=.012, name="chargerbox"))
P.append(bx(cxp - .15, cxp + .15, cyp - .12, cyp + .12, 1.10, 1.14, "P_G1", bev=0, name="chargerlid"))
P.append(cy("dial", .055, cyp - .118, cyp - .11, cxp, 1.0, "P_BLACK", v=10))
P.append(cy("dialface", .045, cyp - .124, cyp - .118, cxp, 1.0, "M_GaugeFace", v=10))
P.append(py([(cxp - .01, .92), (cxp + .05, .92), (cxp + .0, .86), (cxp + .05, .86), (cxp - .05, .75), (cxp - .01, .83), (cxp - .06, .83)], cyp - .12, cyp - .11, "P_GOLD", name="flash"))
P.append(bx(cxp + .14, cxp + .2, cyp - .03, cyp + .03, .86, .9, "P_G1", bev=0, name="leverbox"))
P.append(cyl_between("lever", (cxp + .19, cyp, .88), (cxp + .25, cyp, 1.0), .012, "P_G3", v=4))
P.append(cz("leverknob", .022, .98, 1.03, cxp + .25, cyp, "P_RED", v=6))
# the lead, along the boards to a socket on the rim of the dish, under the floor to the contact
P.append(ptube("cable", soft([(cxp + .1, cyp + .1, .78), (cxp + .24, cyp + .24, .5), (cxp + .3, cyp + .34, .2), (-.9, -.92, TOP + .03), (-.86, -.86, TOP + .04)]), .018, "P_BLACK", segs=5))
P.append(bx(-.92, -.78, -.9, -.76, TOP, TOP + .06, "P_G1", bev=0, name="socket"))
P.append(torus("cablecoil", .1, .016, (cxp - .12, cyp, .62), "X", seg=10, rseg=4, m="P_BLACK"))
lo = lantern(P, cxp, cyp, 1.34, m="M_Emissive", r=.06)
MA.one_uv(lo)
pfin(P, "Body", ang=36)
return dict(elev=30, azim=-35)
# ======================================================================= robots, improved on the earlier build
def robot_mower():
def add(P):
# mudguards, so it stops being a body on four separate tyres
for s in (-1, 1):
MA.fender(P, s, -.40, .15, .185, .435, .535, a0=172, a1=6, n=5, t=.03, m="P_GRN", band=None)
MA.fender(P, s, .42, .20, .235, .425, .55, a0=172, a1=4, n=6, t=.03, m="P_GRN", band="P_WHITE")
# the cutter shows: a row of guard fingers along the front at ground level, the way a real sickle bar looks
for k in range(9):
x = -.44 + k * .11
P.append(prism("finger", [(x - .04, -.76), (x + .04, -.76), (x, -.86)], "XY", .045, .08, "P_G4"))
P.append(bx(-.48, .48, -.78, -.7, .05, .09, "P_G1", bev=0, name="cutterbar"))
# the duct: grass goes in low at the front, along the flank in galvanised pipe and out over the bin
D = soft([(-.46, -.56, .13), (-.5, -.3, .3), (-.5, -.02, .56), (-.46, .12, .82), (-.26, .26, .78)], 1)
P.append(ptube("duct", D, .062, "P_G4", segs=6))
for t in (2, 5):
a, b = Vector(D[t - 1]), Vector(D[t + 1])
d = (b - a).normalized()
P.append(cyl_between("ductband", Vector(D[t]) - d * .016, Vector(D[t]) + d * .016, .074, "P_G1", v=6))
e = Vector(D[-1])
n_ = (e - Vector(D[-2])).normalized()
P.append(cyl_between("ductmouth", e - n_ * .01, e + n_ * .05, .07, "P_G3", v=6, r2=.082))
P.append(cyl_between("ductdark", e + n_ * .05, e + n_ * .054, .066, "P_BLACK", v=6))
P.append(bx(-.56, -.36, -.62, -.5, .06, .16, "P_G1", bev=0, name="ductfoot"))
patched(MA, "pfin", MA.robot_mower, add=add)
return dict(elev=20, azim=-35)
def reaper():
def add(P):
for s in (-1, 1):
# a grass bin each side of the gun, clippings heaped in them
X0, X1, Y0, Y1, Z0, Z1 = .46, .9, -.62, .44, 1.34, 1.66
P.append(sb(s, X0, X1, Y0, Y1, Z0 - .04, Z0, "P_G1", name="binfloor"))
P.append(sb(s, X1 - .03, X1, Y0, Y1, Z0, 1.52, "P_REDD", name="binwall"))
P.append(sb(s, X0, X0 + .03, Y0, Y1, Z0, 1.52, "P_REDD", name="binwall"))
for y0, y1 in ((Y0, Y0 + .03), (Y1 - .03, Y1)):
P.append(sb(s, X0, X1, y0, y1, Z0, 1.52, "P_RED", name="binend"))
for z in (1.57, 1.62):
P.append(sb(s, X1 - .025, X1, Y0, Y1, z - .016, z + .016, "P_G2", name="binslat"))
P.append(sb(s, X0, X0 + .025, Y0, Y1, z - .016, z + .016, "P_G2", name="binslat"))
for y in (Y0, -.09, Y1):
P.append(sb(s, X1 - .02, X1 + .03, y - .03, y + .03, Z0 - .1, Z1 + .02, "P_G1", name="binpost"))
P.append(sb(s, X0 - .03, X0 + .02, y - .03, y + .03, Z0, Z1 + .02, "P_G1", name="binpost"))
P.append(sb(s, X1 - .04, X1 + .02, Y0 - .02, Y1 + .02, Z1, Z1 + .04, "P_WHITE", name="binrim"))
P.append(sb(s, X0 - .02, X0 + .04, Y0 - .02, Y1 + .02, Z1, Z1 + .04, "P_WHITE", name="binrim"))
P.append(sb(s, X0, X1, Y1 - .03, Y1 + .02, Z1, Z1 + .04, "P_WHITE", name="binrim"))
P.append(sb(s, X0, X1, Y0 - .02, Y0 + .03, Z1, Z1 + .04, "P_WHITE", name="binrim"))
h = sphere("heap", 1.0, (0, 0, 0), seg=8, rings=4, m="M_Clippings", scale=(.2, .52, .17))
for v in h.data.vertices:
v.co *= 1 + random.uniform(-.1, .1)
P.append(uv_wall(xf(h, t=(s * (X0 + X1) / 2, (Y0 + Y1) / 2, 1.58))))
decal(P, (s * (X1 + .004), .22, 1.42), .3, .117, (s, 0, 0), R_80 if s > 0 else R_52)
# the feed pipe: from the top of the jaws up and over into the bin
T = soft([(s * .72, -1.3, .94), (s * .72, -1.22, 1.16), (s * .71, -1.06, 1.46), (s * .7, -.86, 1.74), (s * .68, -.6, 1.84), (s * .68, -.4, 1.74)], 1)
P.append(ptube("feedpipe", T, .115, "P_G4", segs=8))
for t in (2, 4, 6, 8):
a, b = Vector(T[t - 1]), Vector(T[t + 1])
d = (b - a).normalized()
P.append(cyl_between("pipeband", Vector(T[t]) - d * .02, Vector(T[t]) + d * .02, .13, "P_G1", v=8))
P.append(sb(s, .56, .88, -1.42, -1.18, .93, .97, "P_G1", name="pipefoot"))
rust(P, (s * .845, -1.0, 1.56), .14, .2, (s, -.3, .3), heart=False)
# a work lamp on the front of each bin
lamp_y(P, s * .68, -.64, 1.5, .055)
# rungs up the back of the skirt
for k in range(3):
P.append(bx(.76, .96, 1.86 + 0.0, 1.9, .72 + k * .16, .74 + k * .16, "P_G3", bev=0, name="rung"))
# plates and a hatch on the nose so it isn't a bare slab, more dirt where the mud flies
P.append(loft([[(-.34, -.62, 1.372), (.34, -.62, 1.372), (.34, -.62, 1.386), (-.34, -.62, 1.386)], [(-.34, -.5, 1.378), (.34, -.5, 1.378), (.34, -.5, 1.392), (-.34, -.5, 1.392)]], "P_G1", name="hatch"))
for x in (-.28, .28):
bolt(P, (x, -.56, 1.39), (0, 0, 1), r=.014)
rust(P, (0, -1.46, .955), .9, .14, (0, -.2, .98), heart=False)
patched(MA, "pfin", MA.reaper, drop=("rail",), add=add)
return dict(elev=22, azim=-40)
# ======================================================================= press and batteries, improved on the earlier build
def mini_funnel(P, x, y, z0, z1, h0, h1, m=TIM):
for k in range(4):
G = board((-h0, -h0, z0), (h0, -h0, z0), (h1, -h1, z1), (-h1, -h1, z1), .03, m, bev=0)
g_ = Vector(G["grain"])
rz = k * PI / 2
xf(G, rz=rz, t=(x, y, 0))
P.append(grain(G, Matrix.Rotation(rz, 3, "Z") @ g_))
def press():
def add(P):
# two feed hoppers on the back chutes, one each way in: cut grass on one, hay on the other, each with a painted board
for s, m_, tag in ((-1, "M_Clippings", GRN), (1, HAY, GOLD)):
x, y = s * .5, .72
mini_funnel(P, x, y, .56, .96, .13, .26)
P.append(bx(x - .28, x + .28, y - .28, y + .28, .94, .985, IRON, bev=0, name="hoprim"))
h = sphere("heap", 1.0, (0, 0, 0), seg=8, rings=4, m=m_, scale=(.25, .25, .13))
for v in h.data.vertices:
v.co *= 1 + random.uniform(-.08, .08)
P.append(uv_wall(xf(h, t=(x, y, .96))))
for sx in (-1, 1):
P.append(beam((x + sx * .24, y + .02, .13), (x + sx * .24, y + .02, .94), .05, .05, bev=0, name="hopleg"))
P.append(bx(x - .15, x + .15, .96, 1.0, .68, .9, tag, bev=0, name="hoptag"))
# a tin spout from the hopper into the mould
P.append(beam((x * .8, y - .1, .6), (x * .4, .44, .74), .22, .03, m=TIN, bev=0, name="spout"))
# a brick on the chute on its way out, a tidy stack on a pallet at the front right instead of three strays
o = rbox("brick", (.34, .24, .12), (0, 0, 0), bevel=.012, segs=1, m="M_Brick")
P.append(uv_wall(xf(o, t=(0, -.82, .46))))
P.append(bx(.52, .9, -.92, -.6, .13, .16, TIM, bev=0, name="pallet"))
for (x, y, z, rz) in ((.62, -.68, .16, 0), (.62, -.84, .16, 0), (.82, -.76, .16, PI / 2), (.62, -.76, .27, 0), (.78, -.72, .27, PI / 2 + .1), (.7, -.76, .38, .08)):
o = rbox("brick", (.2, .13, .11), (0, 0, 0), bevel=.01, segs=1, m="M_Brick")
P.append(uv_wall(xf(o, rz=rz, t=(x, y, z + .055))))
# the sign in plain paint
sb_ = plate("signboard", 1.16, .2, .014, PRED, r=.03)
P.append(uv_wall(orient(sb_, "-Y", (0, -.5, 1.99))))
patched(PR, "ffin", PR.press, drop=("crailend", "cfoot", "brick", "signboard"), add=add)
return dict(elev=24, azim=-35)
def danger(P, x, y, z, r=.2):
"""A gold diamond with a black flash on a flank of a shed, x is the wall plane, it looks along the sign of x."""
s = 1 if x > 0 else -1
a, b = sorted((x, x + s * .012))
P.append(px([(y, z - r), (y + r, z), (y, z + r), (y - r, z)], a, b, "P_GOLD", name="diamond"))
a, b = sorted((x + s * .012, x + s * .018))
P.append(px([(y + a_ * r * 9 * s, z + b_ * r * 9) for (a_, b_) in BOLT], a, b, "P_BLACK", name="flash"))
def ins(P, x, y, z):
P.append(revm("ins", [(.016, z), (.06, z + .02), (.04, z + .05), (.06, z + .07), (.03, z + .11)], INK, segs=6, loc=(x, y, 0), cap_top=True))
def rack():
def add(P):
# a short pole at the back with a cross arm and two big insulators: the wires that come in from the panels
X, Y = .36, .63
P.append(beam((X, Y, 1.3), (X, Y, 2.12), .09, .09, name="pole"))
P.append(beam((X - .34, Y, 2.02), (X + .34, Y, 2.02), .06, .08, name="crossarm"))
for s in (-1, 1):
P.append(beam((X, Y, 1.76), (X + s * .24, Y, 2.0), .03, .03, m=IRON, bev=0, name="armstay"))
ins(P, X + s * .3, Y, 2.06)
a = (X + s * .3, Y, 2.17)
b = (-.2 if s < 0 else .22, .1, 1.585)
PR.conduit(P, soft([a, ((a[0] + b[0]) / 2, (a[1] + b[1]) / 2, 1.82), b], 1), r=.008, m=BRASS)
P.append(cz("polecap", .06, 2.12, 2.15, X, Y, IRON, v=6))
# a turning cowl on the roof to let the acid fumes out
P.append(cz("ventpipe", .07, 1.4, 1.66, -.42, .2, TIN, v=8))
P.append(revm("cowl", [(.0, 1.82), (.07, 1.8), (.13, 1.72), (.13, 1.66), (.07, 1.66)], IRON, segs=8, loc=(-.42, .2, 0), cap_bot=True))
for k in range(3):
a = TAU * k / 3
P.append(cyl_between("cowlstrut", (-.42 + .06 * math.cos(a), .2 + .06 * math.sin(a), 1.64), (-.42 + .1 * math.cos(a), .2 + .1 * math.sin(a), 1.7), .01, IRON, v=4))
# a danger board over the X on each flank, a gutter and a down pipe along the low edge
danger(P, .742, 0, .8, r=.24)
danger(P, -.742, 0, .8, r=.24)
P.append(bx(-.75, .75, .7, .756, 1.3, 1.35, "P_G3", bev=0, name="gutter"))
P.append(ptube("downpipe", [(-.72, .732, 1.3), (-.72, .732, .08)], .022, "P_G3", segs=5))
patched(PR, "ffin", PR.rack, add=add)
return dict(elev=22, azim=-35)
def bank():
def add(P):
# a louvred ventilator on the ridge with its own little roof, like the barn's, and a lightning rod on top
CX, CY, Z0, Z1 = .32, .22, 2.1, 2.42
P.append(bx(-CX, CX, -CY, CY, Z0, Z1, SOOT, bev=0, name="ventcore"))
for s in (-1, 1):
louvre(P, (0, s * CY, 0), "+Y" if s > 0 else "-Y", 2 * CX - .1, Z0 + .1, Z1 - .04, 3, m=CRM, fw=.04)
P.append(bx(s * CX - .03, s * CX + .03, -CY - .03, CY + .03, Z0, Z1, TIM, bev=.006, name="ventpost"))
roof_ridge_x(P, -CX - .1, CX + .1, -CY - .12, CY + .12, Z1 - .01, Z1 + .15, t=.03)
P.append(cz("rodfoot", .03, Z1 + .13, Z1 + .18, m=IRON, v=6))
P.append(cz("rod", .012, Z1 + .16, Z1 + .56, m=BRASS, v=5))
P.append(sphere("rodball", .03, (0, 0, Z1 + .57), seg=6, rings=4, m=BRASS))
# danger boards on the gables, on the X
danger(P, HXB + .005, 0, .96, r=.28)
danger(P, -HXB - .005, 0, .96, r=.28)
# a gutter along the front eaves with a pipe down the post
P.append(bx(-1.5, 1.5, -1.0, -.94, 1.66, 1.71, "P_G3", bev=0, name="gutter"))
P.append(ptube("downpipe", [(-1.47, -.978, 1.67), (-1.47, -.978, .1)], .022, "P_G3", segs=5))
patched(PR, "ffin", PR.bank, add=add)
return dict(elev=22, azim=-35)
HXB = 1.485
# ======================================================================= main
BUILDERS = {
"SM_SolarPost": solar_post,
"SM_SolarPair": solar_pair,
"SM_SolarTracker": solar_tracker,
"SM_BeltSplitter": splitter,
"SM_BeltMerger": merger,
"SM_BeltSorter": sorter,
"SM_Binder": binder,
"SM_BundleCatcher": catcher,
"SM_RobotDock": dock,
"SM_RobotMower": robot_mower,
"SM_Reaper": reaper,
"SM_CryoPress": press,
"SM_BatteryRack": rack,
"SM_BatteryBank": bank,
}
VIEWS = (("a", 24, -38, .78, 480), ("b", 22, 142, .78, 480), ("c", 8, -82, .78, 480), ("far", 22, -38, 2.6, 240))
def main():
args = sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else []
vd = os.environ.get("GC_VIEWS")
for n in (args or list(BUILDERS)):
common.reset()
random.seed(zlib.crc32(n.encode()))
res = BUILDERS[n]() or {}
parts = {o.name: tri_count([o]) for o in bpy.context.scene.objects if o.type == "MESH"}
print(f"TRIS|{n}|{sum(parts.values())}|{parts}")
tb = bpy.data.materials.get(PR.RUBBELT)
common.finish(n, **res)
if vd:
if tb:
for nd in tb.node_tree.nodes:
if nd.type == "MAPPING":
nd.inputs["Scale"].default_value = (1, 2, 1) # Conveyor.uvPerMetre, for the previews only
for m in bpy.data.materials:
m.use_backface_culling = True
names = [o.name for o in bpy.context.scene.objects if o.type == "MESH"]
zmin = min((o.matrix_world @ Vector(c)).z for o in bpy.context.scene.objects if o.type == "MESH" for c in o.bound_box)
for tag, el, az, dm, res_ in VIEWS:
g = cube("ground", (60, 60, .02), (0, 0, zmin - .012), "M_Grass")
uv_box(g, .5)
g["preview_only"] = True
common.preview(os.path.join(vd, f"{n}_{tag}"), elev=el, azim=az, dist_mul=dm, res=res_, frame=names)
if __name__ == "__main__":
main()