"""GRASS CUTTER - production, power and belt junctions, upgraded to stand next to the POLYGON Farm pack.
SM_Vaporizer the Dryer: a barn-red drying kiln a belt runs straight through, with a big fan on its flank. 2 x 2 m.
SM_CryoPress the Brick Press: a screw press in a timber frame, two ways in at the back, one out at the front. 2 x 2 m.
SM_Binder a red baler with a hopper, flywheel, knotters and twine spools. 2 x 2 m.
SM_BundleCatcher a burlap funnel on a timber tower with a tin chute to the front. 3 x 3 m.
SM_SolarPost, SM_SolarPair, SM_SolarTracker parts Stand and Head, Head's origin is where the panels pivot.
SM_BatteryRack a wooden battery crate with a control board. 1.5 x 1.5 m, 1.6 m high.
SM_BatteryBank a tin-roofed battery shed. 3 x 2 m, 2.2 m high.
SM_BeltSplitter a 1 x 1 m junction, in at the back, out left, right and straight on. Parts Frame, Belt, Paddle, Sign.
SM_BeltMerger a 1 x 1 m junction, in left, right and back, out at the front. Parts Frame, Belt, Sign.
Named parts:
Lamp 8 cm bulb, M_Emissive, origin in its centre.
Spin built around its axle, which is the object's local Z AND runs front to back through the machine. Both matter:
Machine.cs does not hard-code Z, it asks BaseRot.LocalAxisFor(spin, transform.forward), so an axle lying across the
machine would make it turn the part about a spoke and tumble it.
Gauge M_Emissive strip, 0.5 m tall, origin at its bottom. The code scales it on UNITY'S LOCAL Y. Every other part in this
pipeline arrives in Unity with Lcl Rotation (-90, 0, 0), which makes Unity local Z point up and local Y point into the
part's depth (see Vehicle.fill, which scales Z). So Gauge alone has a +90 degree object rotation about X and its mesh
runs along local +Y: the FBX then holds rotation (0, 0, 0) and Unity local Y is straight up.
Belt M_ConveyorBelt, four mitred triangles meeting in the middle, U 0..1 across, V in metres, +V along the flow of each
sector (Conveyor scrolls +V, BeltShape builds its rubber the same way), so the chevron in T_Belt runs the right way on all
four arms: in at the back and out of the other three on the splitter, in on three and out at the front on the merger.
Paddle hinge at the back centre of the junction, as briefed. Every bundle rides the centre line through that spot, so the flap
is kept short (it ends 0.1 m behind the middle) and the gate beam it hangs from clears the cargo.
Authored in Blender space: metres, Z up, front = -Y (Unity +Z), origin on the ground in the middle of the footprint.
Run: blender -b --factory-startup --python ArtSource/Blender/scripts/gc_up_production.py -- [names]
GC_VIEWS=
also renders back, side, top, close and far views there. GC_CULL=1 renders with backface culling.
GC_HIST=1 prints what each finished part spends its tris on.
Check the exports with gc_up_production_verify.py.
"""
import sys, os
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import common
from gc_farm_machines import * # noqa: F401,F403 (helpers + material names)
EMI, CELL, BRASS, RUST, RUBBELT = "M_Emissive", "M_SolarPanel", "M_Brass", "M_Rust", "M_ConveyorBelt"
SURF = 0.35 # junction belt surface
ROT = {"-Y": 0.0, "+X": PI / 2, "+Y": PI, "-X": -PI / 2}
import gc_farm_machines as FM
def rivet(P, p, nrm, r=0.014, h=0.012, m=STL):
p, nrm = Vector(p), Vector(nrm).normalized()
P.append(cyl_between("rivet", p - nrm * 0.004, p + nrm * h, r, m, v=4, r2=r * 0.55))
FM.rivet = rivet
_ffin = ffin
def ffin(P, name, **kw):
if os.environ.get("GC_HIST"):
h = {}
for o in P:
if o is not None:
k = o.name.split(".")[0]
h[k] = h.get(k, 0) + sum(len(q.vertices) - 2 for q in o.data.polygons)
print("HIST|%s|%s" % (name, " ".join("%s=%d" % kv for kv in sorted(h.items(), key=lambda kv: -kv[1])[:16])))
return _ffin(P, name, **kw)
# ======================================================================= shared kit
def turned(P, G, rz=0.0, t=(0, 0, 0)):
"""Move a group of parts, keeping their grain direction."""
R = Matrix.Rotation(rz, 3, "Z")
for o in G:
g_ = o.get("grain")
xf(o, rz=rz, t=t)
if g_ is not None:
grain(o, R @ Vector(g_))
P.append(o)
def boards(P, c, facing, w, z0, z1, n, m=RED, t=0.03, back=SOOT, bev=0.0):
"""Vertical planks with real gaps and uneven tops, built facing -Y then turned to `facing`. c: middle of the wall face."""
G = [bx(-w / 2, w / 2, 0.012, t + 0.012, z0, z1, back, bev=0, name="wallback")]
b = w / n
for k in range(n):
a = -w / 2 + k * b
o = bx(a + 0.005, a + b - 0.005, random.uniform(-0.004, 0.0), t, z0 + random.uniform(0, 0.008), z1 - random.uniform(0, 0.012), m, bev=bev, name="plank")
G.append(grain(o, (0, 0, 1)))
turned(P, G, ROT[facing], c)
def rails_h(P, c, facing, w, z0, z1, n, m=TIM, t=0.03, bev=0.008):
"""Horizontal crate boards with gaps, no backing."""
G = []
b = (z1 - z0) / n
for k in range(n):
z = z0 + k * b
G.append(grain(bx(-w / 2, w / 2, 0.0, t, z + 0.008, z + b - 0.008, m, bev=bev, name="crate"), (1, 0, 0)))
turned(P, G, ROT[facing], c)
def louvre(P, c, facing, w, z0, z1, n, m=CRM, frame=TIM, fw=0.05):
"""Dark backing, plain slats on the slant, timber frame."""
G = [bx(-w / 2, w / 2, 0.0, 0.016, z0, z1, SOOT, bev=0, name="lback")]
gap = (z1 - z0) / n
for k in range(n):
s = cube("slat", (w, gap * 1.2, 0.016), (0, 0, 0), m)
grain(s, (1, 0, 0))
G.append(xf(s, rx=math.radians(58), t=(0, -0.014, z0 + (k + 0.5) * gap)))
for x in (-w / 2 - fw / 2, w / 2 + fw / 2):
G.append(grain(bx(x - fw / 2, x + fw / 2, -0.04, 0.016, z0 - fw, z1 + fw, frame, bev=0, name="lframe"), (0, 0, 1)))
for z in (z0 - fw / 2, z1 + fw / 2):
G.append(grain(bx(-w / 2, w / 2, -0.04, 0.016, z - fw / 2, z + fw / 2, frame, bev=0, name="lframe"), (1, 0, 0)))
turned(P, G, ROT[facing], c)
def slab(a, b, c, d, t, out, m=TIM, bev=0.006, name="slab"):
"""board(), wound so that its face looks along `out` whichever order the corners come in."""
q = [Vector(p) for p in (a, b, c, d)]
n = (q[1] - q[0]).cross(q[3] - q[0])
if n.dot(Vector(out)) < 0:
return board(a, d, c, b, t, m, bev=bev, along="ad", name=name)
return board(a, b, c, d, t, m, bev=bev, along="ab", name=name)
def status_lamp(P, x, y, z, arm=None):
"""The 8 cm status bulb in a little iron cage; the cage joins the body, the bulb is the Lamp part (origin in its centre)."""
P.append(cz("lcup", 0.054, z - 0.062, z - 0.028, x, y, IRON, v=8))
P.append(revm("lhood", [(0.06, z + 0.046), (0.036, z + 0.07), (0.012, z + 0.08)], IRON, segs=8, cap_top=True, cap_bot=True))
P[-1].location = (x, y, 0)
apply_xform(P[-1])
for k in range(4):
a = PI / 4 + k * PI / 2
P.append(cz("lbar", 0.005, z - 0.03, z + 0.05, x + 0.052 * math.cos(a), y + 0.052 * math.sin(a), IRON, v=4))
if arm:
P.append(beam(arm, (x, y, z - 0.05), 0.026, 0.026, m=IRON, bev=0, name="larm"))
o = sphere("Lamp", 0.04, (0, 0, 0), seg=10, rings=6, m=EMI, scale=(1, 1, 1.08))
o.location = (x, y, z)
uv_box(o, 4.0)
smooth(o, 60)
return o
def gauge_strip(x, y, z0, w=0.1, h=0.5, t=0.016):
"""See the note at the top: local +Y is world up, so scaling Unity local Y raises the strip from its bottom."""
o = cube("Gauge", (w, h, t), (0, h / 2, 0), EMI)
uv_box(o, 1.0)
flat(o)
o.rotation_mode = "XYZ"
o.rotation_euler = (PI / 2, 0, 0)
o.location = (x, y, z0)
return o
def spin_part(P, c, axis="Y", name="Spin"):
"""P is built around the origin with its axle on Z. The object is turned so local Z runs front to back (see the note on top)."""
o = ffin(P, name, ang=34, wn=False)
o.rotation_mode = "XYZ"
o.rotation_euler = {"Y": (PI / 2, 0, 0)}[axis]
o.location = c
return o
def dial(P, x, y, z, r=0.085, facing="-Y"):
"""A brass-ringed pressure dial with a red needle."""
G = [revm("dring", [(r * 0.8, 0.0), (r, 0.0), (r * 1.04, 0.02), (r * 0.9, 0.04), (r * 0.78, 0.024)], BRASS, segs=12, closed=True),
cz("dface", r * 0.82, 0.0, 0.02, m=INK, v=12)]
for k in range(5):
a = math.radians(210 - k * 60)
G.append(box("dtick", -0.004, 0.004, r * 0.56, r * 0.72, 0.018, 0.024, IRON, bev=0))
xf(G[-1], rz=a - PI / 2)
n = box("dneedle", -0.007, 0.007, -0.01, r * 0.62, 0.024, 0.03, PRED, bev=0)
G.append(xf(n, rz=-0.65))
G.append(cz("dpin", 0.012, 0.02, 0.036, m=IRON, v=6))
for o in G:
P.append(orient(o, facing, (x, y, z)))
def conduit(P, pts, r=0.014, m=RUB):
P.append(ptube("cable", pts, r, m, segs=5))
def cell(P, x, y, z, w=0.3, d=0.26, h=0.34, m=GRN, detail=True):
"""A chunky battery cell: a painted case, a tarred lid, a cream band, two lead posts and fill caps."""
P.append(bx(x - w / 2, x + w / 2, y - d / 2, y + d / 2, z, z + h - 0.03, m, bev=0.016, name="cell"))
P.append(bx(x - w / 2 - 0.006, x + w / 2 + 0.006, y - d / 2 - 0.006, y + d / 2 + 0.006, z + h - 0.04, z + h, SOOT, bev=0.008, name="celllid"))
P.append(box("cellband", x - w / 2 - 0.003, x + w / 2 + 0.003, y - d / 2 - 0.003, y + d / 2 + 0.003, z + h * 0.44, z + h * 0.56, CRM, bev=0))
for s, top in ((-1, PRED), (1, IRON)):
px = x + s * w * 0.3
P.append(cz("post", 0.03, z + h, z + h + 0.03, px, y, top, v=6))
P.append(cz("postnut", 0.016, z + h + 0.03, z + h + 0.052, px, y, BRASS, v=6))
if detail:
P.append(cz("fillcap", 0.024, z + h, z + h + 0.014, x, y, BRASS, v=6))
rivet(P, (x - w * 0.36, y - d / 2 - 0.003, z + h * 0.24), (0, -1, 0), r=0.012, h=0.006)
rivet(P, (x + w * 0.36, y - d / 2 - 0.003, z + h * 0.24), (0, -1, 0), r=0.012, h=0.006)
def jumper(P, a, b, lift=0.07, m=RUB, r=0.011):
"""A short heavy cable looping between two terminals."""
a, b = Vector(a), Vector(b)
path = [a + (b - a) * t + Vector((0, 0, lift * math.sin(PI * t))) for t in (0, 0.25, 0.5, 0.75, 1)]
P.append(ptube("jumper", path, r, m, segs=5))
def bricks(P, spots):
for (x, y, z, rz) in spots:
o = rbox("brick", (0.34, 0.22, 0.11), (0, 0, 0), bevel=0.016, segs=1, m="M_Brick")
P.append(uv_wall(xf(o, rz=rz, t=(x, y, z + 0.055))))
# ======================================================================= dryer
def dryer():
P = []
farm_skid(P, -0.95, 0.95, -0.93, 0.93, n=4)
X, Y0, Y1 = 0.74, -0.72, 0.72
ZB, ZP, ZL, ZV, ZE, ZR = 0.14, 0.32, 0.84, 1.16, 1.86, 2.46
TW = 0.34 # half width of the tunnel the belt runs through
# hidden core, tunnel lining and the hot plug in the middle
for s in (-1, 1):
P.append(bx(min(s * TW, s * X), max(s * TW, s * X), Y0 + 0.03, Y1 - 0.03, ZB, ZE, SOOT, bev=0, name="core"))
P.append(bx(-TW, TW, Y0 + 0.03, Y1 - 0.03, ZL, ZE, SOOT, bev=0, name="core"))
P.append(bx(-TW, TW, -0.3, 0.3, ZB, ZL, SOOT, bev=0, name="plug"))
P.append(box("glow", -TW + 0.05, TW - 0.05, -0.306, -0.3, 0.56, 0.62, GLOW, bev=0))
P.append(box("glow", -TW + 0.05, TW - 0.05, 0.3, 0.306, 0.56, 0.62, GLOW, bev=0))
# cast-iron plinth with glowing draught slits
for yy, fc in ((Y0, -1), (Y1, 1)):
for s in (-1, 1):
P.append(bx(min(s * (TW + 0.05), s * (X + 0.02)), max(s * (TW + 0.05), s * (X + 0.02)), min(yy, yy + fc * 0.03), max(yy, yy + fc * 0.03), ZB, ZP, IRON, bev=0.014, name="plinth"))
for x in (s * 0.46,):
P.append(box("slit", x - 0.07, x + 0.07, min(yy + fc * 0.03, yy + fc * 0.036), max(yy + fc * 0.03, yy + fc * 0.036), 0.215, 0.245, GLOW, bev=0))
for s in (-1, 1):
P.append(bx(min(s * X, s * (X + 0.03)), max(s * X, s * (X + 0.03)), Y0, Y1, ZB, ZP, IRON, bev=0.014, name="plinth"))
# board walls
pw = X - TW - 0.05
for s in (-1, 1):
boards(P, (s * (TW + 0.05 + pw / 2), Y0, 0), "-Y", pw, ZP, ZV, 3)
boards(P, (s * (TW + 0.05 + pw / 2), Y1, 0), "+Y", pw, ZP, ZV, 3)
boards(P, (s * X, 0, 0), "+X" if s > 0 else "-X", Y1 - Y0 - 0.1, ZP, ZV, 8)
boards(P, (0, Y0, 0), "-Y", 2 * TW + 0.1, ZL + 0.1, ZV, 4)
boards(P, (0, Y1, 0), "+Y", 2 * TW + 0.1, ZL + 0.1, ZV, 4)
# louvres on all four sides of the loft
W = 2 * X - 0.3
for fc, c in (("+Y", (0, Y1 + 0.01, 0)), ("+X", (X + 0.01, 0, 0)), ("-X", (-X - 0.01, 0, 0))):
louvre(P, c, fc, W, ZV + 0.1, ZE - 0.12, 6)
boards(P, (0, Y0, 0), "-Y", W + 0.1, ZV + 0.04, ZE - 0.06, 7) # the front of the loft carries the fan
# posts and wall rails, over everything
for (sx, sy) in ((1, 1), (-1, 1), (1, -1), (-1, -1)):
P.append(bx(sx * (X - 0.02) - 0.07, sx * (X - 0.02) + 0.07, sy * 0.71 - 0.07, sy * 0.71 + 0.07, ZB, ZE, TIM, bev=0.018, name="post"))
rivet(P, (sx * (X - 0.02), sy * 0.78, 0.9), (0, sy, 0), r=0.018)
rivet(P, (sx * (X - 0.02), sy * 0.78, 1.5), (0, sy, 0), r=0.018)
for z in (ZV + 0.0, ZE - 0.03):
for y, f in ((Y0 - 0.02, -1), (Y1 + 0.02, 1)):
P.append(grain(bx(-X, X, y - 0.04, y + 0.04, z - 0.045, z + 0.045, TIM, bev=0, name="wrail"), (1, 0, 0)))
for s in (-1, 1):
P.append(bx(s * X - 0.04, s * X + 0.04, Y0, Y1, z - 0.045, z + 0.045, TIM, bev=0, name="wrail"))
# tunnel portals at both ends
for yy, f in ((Y0, -1), (Y1, 1)):
y0_, y1_ = sorted((yy - f * 0.02, yy + f * 0.05))
for s in (-1, 1):
P.append(bx(s * (TW + 0.03) - 0.05, s * (TW + 0.03) + 0.05, y0_, y1_, ZB, ZL + 0.14, TIM, bev=0, name="jamb"))
P.append(box("jambstrap", s * (TW + 0.03) - 0.054, s * (TW + 0.03) + 0.054, min(y0_, y1_) - 0.004, max(y0_, y1_) + 0.004, 0.58, 0.63, IRON, bev=0.003, segs=1))
P.append(grain(bx(-TW - 0.1, TW + 0.1, y0_ - 0.01, y1_ + 0.01, ZL, ZL + 0.13, TIM, bev=0.018, segs=1, name="lintel"), (1, 0, 0)))
for x in (-0.3, 0.3):
rivet(P, (x, yy + f * 0.06, ZL + 0.065), (0, f, 0), r=0.02)
# burlap strip curtain
for k in range(6):
x = -TW + 0.08 + k * (2 * TW - 0.16) / 5
P.append(uv_wall(bx(x - 0.048, x + 0.048, yy - f * 0.12 - 0.006, yy - f * 0.12 + 0.006, 0.63 + (k % 3) * 0.03, ZL, BUR, bev=0)))
# tin hoods over the mouths
for f in (-1, 1):
y = (Y1 if f > 0 else Y0) + f * 0.05
a, b, c, d = (-0.42, y, ZL + 0.15), (0.42, y, ZL + 0.15), (0.42, y + f * 0.2, ZL + 0.03), (-0.42, y + f * 0.2, ZL + 0.03)
P.append(uv_keep_slope(slab(a, b, c, d, 0.02, (0, f, 1), TIN), (a, d)))
# sign on the front wall
sb = plate("signboard", 0.62, 0.17, 0.016, PRED, r=0.02)
P.append(uv_wall(orient(sb, "-Y", (0, Y0 - 0.03, ZL + 0.22))))
sign_text(P, "DRYER", 0.115, INK, (0, Y0 - 0.048, ZL + 0.22))
# the stove door in the left pier, with the firebox glow behind its bars
door = [revm("door", [(0, 0.0), (0.13, 0.0), (0.14, 0.02), (0.13, 0.04), (0.1, 0.044), (0.092, 0.03), (0, 0.03)], [IRON, IRON, IRON, IRON, IRON, GLOW], segs=10)]
for k in range(3):
door.append(box("dbar", -0.095, 0.095, -0.01 + (k - 1) * 0.055, 0.01 + (k - 1) * 0.055, 0.03, 0.05, STL, bev=0))
door.append(box("dhandle", 0.07, 0.17, -0.013, 0.013, 0.05, 0.072, BRASS, bev=0.006, segs=1))
for o in door:
P.append(orient(o, "-Y", (-0.54, Y0 - 0.03, 0.56)))
# gable roof, ridge along Y
roof_ridge_y(P, -0.97, 0.97, -0.9, 0.9, ZE - 0.05, ZR)
for y, f in ((Y0 + 0.02, -1), (Y1 - 0.02, 1)):
P.append(uv_wall(prism("gable", [(-X, ZE), (X, ZE), (0, ZR - 0.05)], "XZ", y - 0.04, y + 0.04, RED)))
P.append(beam((-X - 0.08, y + f * 0.05, ZE - 0.04), (0, y + f * 0.05, ZR - 0.03), 0.09, 0.05, TIM, bev=0.012, name="rake"))
P.append(beam((X + 0.08, y + f * 0.05, ZE - 0.04), (0, y + f * 0.05, ZR - 0.03), 0.09, 0.05, TIM, bev=0.012, name="rake"))
fv = orient(cyl("gvent", 0.13, 0.02, (0, 0, 0.01), "Z", verts=10, m=SOOT), "-Y", (0, Y0 - 0.02, ZE + 0.24))
P.append(fv)
P.append(orient(torus("gring", 0.14, 0.022, (0, 0, 0.02), "Z", seg=12, rseg=4, m=TIM), "-Y", (0, Y0 - 0.02, ZE + 0.24)))
for dz in (-0.07, 0.0, 0.07):
P.append(box("gslat", -0.115, 0.115, Y0 - 0.05, Y0 - 0.03, ZE + 0.24 + dz - 0.022, ZE + 0.24 + dz + 0.022, CRM, bev=0))
# slatted ridge cupola
CY0, CY1, CZ = -0.16, 0.2, ZR - 0.14
P.append(bx(-0.17, 0.17, CY0, CY1, CZ, CZ + 0.3, TIM, bev=0.012, name="cupola"))
for x in (-0.175, 0.175):
for k in range(3):
z = CZ + 0.16 + k * 0.05
P.append(box("cslat", min(x, x * 1.08), max(x, x * 1.08), CY0 + 0.04, CY1 - 0.04, z - 0.014, z + 0.014, CRM, bev=0))
roof_ridge_y(P, -0.24, 0.24, CY0 - 0.06, CY1 + 0.06, CZ + 0.3, CZ + 0.44, t=0.03)
# stovepipe with a rain cap (the Vent point sits at its mouth)
hx, hy = -0.2, 0.55
ZF = 2.15
P.append(revm("flashing", [(0.22, ZF + 0.14), (0.19, ZF + 0.24), (0.14, ZF + 0.27), (0.125, ZF + 0.27)], IRON, segs=10, loc=(hx, hy, 0)))
P.append(revm("chimney", [(0.12, ZF + 0.1), (0.12, 2.76), (0.135, 2.78), (0.135, 2.84), (0.1, 2.85), (0.1, 2.6)], SOOT, segs=10, loc=(hx, hy, 0)))
for z in (2.5, 2.68):
P.append(cz("pipeband", 0.128, z - 0.02, z + 0.02, hx, hy, IRON, v=10))
P.append(revm("chcap", [(0.06, 2.92), (0.27, 2.94), (0.26, 2.96), (0.13, 3.01), (0, 3.03)], IRON, segs=10, cap_bot=True, loc=(hx, hy, 0)))
for k in range(3):
a = 2 * PI * k / 3 + 0.3
P.append(cyl_between("chstrut", (hx + 0.12 * math.cos(a), hy + 0.12 * math.sin(a), 2.8), (hx + 0.2 * math.cos(a), hy + 0.2 * math.sin(a), 2.945), 0.016, IRON, v=4))
# roller chutes through the tunnel: in at the back, out at the front, 0.4 m high at the machine's edge
farm_chute(P, -0.5, -1.0, 0.6, 0.4, 0.0, legs=(-0.84,), n=4)
G = []
farm_chute(G, -0.5, -1.0, 0.6, 0.4, 0.0, legs=(-0.84,), n=4)
turned(P, G, PI)
# the fan in its drum on the front of the loft, axle front to back
FZ, FR = 1.56, 0.36
ring = revm("fanring", [(FR - 0.05, 0.0), (FR, 0.0), (FR, 0.2), (FR - 0.05, 0.2)], TIN, segs=14, closed=True)
P.append(uv_wall(xf(ring, rx=PI / 2, t=(0, Y0 - 0.0, FZ))))
P.append(uv_wall(xf(torus("fanlip", FR, 0.022, (0, 0, 0), "Z", seg=14, rseg=4, m=IRON), rx=PI / 2, t=(0, Y0 - 0.2, FZ))))
P.append(cy("fanback", FR - 0.04, Y0 - 0.03, Y0 - 0.01, 0, FZ, SOOT, v=14))
P.append(beam((-FR + 0.04, Y0 - 0.05, FZ), (FR - 0.04, Y0 - 0.05, FZ), 0.05, 0.03, m=IRON, bev=0, name="fanstrut"))
P.append(beam((0, Y0 - 0.05, FZ - FR + 0.04), (0, Y0 - 0.05, FZ + FR - 0.04), 0.05, 0.03, m=IRON, bev=0, name="fanstrut"))
P.append(cy("fanbear", 0.05, Y0 - 0.11, Y0 - 0.04, 0, FZ, IRON, v=8))
# firewood on the right of the chute, hay and a fork on the left
P.append(bx(0.46, 0.93, -0.92, -0.76, 0.13, 0.17, TIM, bev=0.008, name="woodskid"))
for (x, z) in ((0.54, 0.235), (0.68, 0.235), (0.82, 0.235), (0.61, 0.355), (0.75, 0.355)):
log(P, x, -0.91, -0.76, z)
bale(P, (-0.68, -0.82, 0.3), sx=0.44, sy=0.2, sz=0.24)
pitchfork(P, (-0.62, -0.74, 0.14), (-0.56, -0.74, 1.05))
for (x, y, az) in ((-0.28, -0.74, -PI / 2), (0.24, 0.74, PI / 2)):
tuft(P, x, y, 0.53, L=0.12, n=3, az=az)
for (x, y, az) in ((X + 0.05, 0.3, 0.0), (-X - 0.05, -0.25, PI), (0.25, Y1 + 0.05, PI / 2)):
tuft(P, x, y, 1.54, L=0.16, n=3, az=az)
lo = status_lamp(P, 0.54, Y0 - 0.13, 1.03, arm=(0.54, Y0 - 0.02, 0.93))
ffin(P, "Body", ang=30, wn=False)
Q = [cz("hub", 0.07, -0.04, 0.04, m=IRON, v=8), cz("cap", 0.04, 0.04, 0.07, m=PRED, v=8)]
for k in range(5):
for o in prop_blade(FR - 0.08, 0.1, PRED, pitch=0.34, r0=0.05):
o2 = xf(o, rz=2 * PI * k / 5)
Q.append(grain(o2, (math.cos(2 * PI * k / 5), math.sin(2 * PI * k / 5), 0)))
spin_part(Q, (0, Y0 - 0.14, FZ))
empty("Vent", (hx, hy, 2.86))
empty("Out", (0, -0.98, 0.4))
return dict(elev=24, azim=-35)
# ======================================================================= brick press
def press():
P = []
farm_skid(P, -0.95, 0.95, -0.93, 0.93, n=4)
ZC0, ZC1 = 1.85, 2.13 # crown beam
# cast-iron bed, brick mould crate full of hay
P.append(bx(-0.64, 0.64, -0.46, 0.46, 0.13, 0.36, IRON, bev=0.04, name="bed"))
P.append(box("bedpin", -0.645, 0.645, -0.465, 0.465, 0.22, 0.24, GOLD, bev=0))
P.append(bx(-0.56, 0.56, -0.43, 0.43, 0.36, 0.4, STL, bev=0.012, name="platen"))
M = 0.4
for rz in (PI / 2, PI, -PI / 2):
o = bx(-M, M, -M, -M + 0.05, 0.4, 0.86, TIM, bev=0.012, name="mould")
xf(o, rz=rz)
P.append(grain(o, Matrix.Rotation(rz, 3, "Z") @ Vector((1, 0, 0))))
# the front of the mould has a slot the bricks leave through
P.append(grain(bx(-M, M, -M, -M + 0.05, 0.6, 0.86, TIM, bev=0.012, name="mould"), (1, 0, 0)))
for s in (-1, 1):
P.append(bx(min(s * 0.28, s * M), max(s * 0.28, s * M), -M, -M + 0.05, 0.4, 0.6, TIM, bev=0.012, name="mould"))
for (sx, sy) in ((1, 1), (-1, 1), (1, -1), (-1, -1)):
iron_corner(P, sx * M, sy * M, 0.4, 0.86, sx, sy)
for z in (0.66, 0.8):
P.append(box("mband", -M - 0.008, M + 0.008, -M - 0.008, M + 0.008, z - 0.016, z + 0.016, IRON, bev=0))
P.append(bx(-M + 0.04, M - 0.04, -M + 0.04, M - 0.04, 0.4, 0.76, SOOT, bev=0, name="mouldin"))
hay_heap(P, (0, 0, 0.78), 0.34, 0.34, 0.09, tufts=4)
for (x, y, az) in ((0.26, -0.4, -PI / 2), (0.4, 0.1, 0.0)):
tuft(P, x, y, 0.84, L=0.12, n=3, az=az)
o = rbox("brick", (0.34, 0.24, 0.12), (0, 0, 0), bevel=0.016, segs=1, m="M_Brick")
P.append(uv_wall(xf(o, t=(0, -0.4, 0.465))))
# timber portal: paired posts each side, iron bound, X braced flanks
for s in (-1, 1):
x0, x1 = sorted((s * 0.66, s * 0.93))
for y0, y1 in ((-0.46, -0.2), (0.24, 0.46)):
P.append(bx(x0, x1, y0, y1, 0.13, ZC0 + 0.02, TIM, bev=0.016, name="post"))
for z in (0.5, 1.6):
P.append(box("postband", x0 - 0.006, x1 + 0.006, y0 - 0.006, y1 + 0.006, z - 0.03, z + 0.03, IRON, bev=0))
hx0, hx1 = sorted((s * 0.645, s * 0.84))
P.append(bx(hx0, hx1, -0.12, 0.2, 0.3, 2.5, TIM, bev=0.022, name="guidepost"))
P.append(box("hornband", hx0 - 0.006, hx1 + 0.006, -0.126, 0.206, 2.36, 2.42, IRON, bev=0))
gx0, gx1 = sorted((s * 0.63, s * 0.65))
P.append(box("guide", gx0, gx1, -0.05, 0.13, 0.46, 1.84, STL, bev=0))
xb = s * 0.86
for (a, b) in (((-0.2, 0.5), (0.24, 1.6)), ((-0.2, 1.6), (0.24, 0.5))):
P.append(beam((xb, a[0], a[1]), (xb, b[0], b[1]), 0.07, 0.05, bev=0.008, name="fbrace"))
# crown beam with a sign and iron straps, the cast-iron nut block
P.append(grain(bx(-0.97, 0.97, -0.5, 0.56, ZC0, ZC1, TIM, bev=0.03, name="crown"), (1, 0, 0)))
for x in (-0.82, 0.82):
P.append(box("crownstrap", x - 0.05, x + 0.05, -0.506, 0.566, ZC0 - 0.008, ZC1 + 0.008, IRON, bev=0))
for dz in (0.06, 0.2):
rivet(P, (x, -0.506, ZC0 + dz), (0, -1, 0), r=0.018)
sb = plate("signboard", 1.16, 0.2, 0.014, RED, r=0.03)
P.append(uv_wall(orient(sb, "-Y", (0, -0.5, (ZC0 + ZC1) / 2))))
sign_text(P, "PRESS", 0.15, INK, (0, -0.517, (ZC0 + ZC1) / 2))
P.append(revm("nut", [(0.26, ZC1), (0.26, ZC1 + 0.03), (0.2, ZC1 + 0.07), (0.17, ZC1 + 0.08), (0.11, ZC1 + 0.08)], IRON, segs=8))
bolt_ring(P, 6, 0.22, ZC1 + 0.03, r=0.02, h=0.016, a0=22.5)
P.append(revm("nutcollar", [(0.11, ZC0 - 0.1), (0.2, ZC0 - 0.08), (0.22, ZC0 - 0.03), (0.22, ZC0)], IRON, segs=8))
# hoist block on the right horn
P.append(cz("hornplate", 0.08, 2.5, 2.52, 0.74, 0.04, IRON, v=8))
P.append(cz("hornplate", 0.08, 2.5, 2.52, -0.74, 0.04, IRON, v=8))
P.append(cz("hoistpin", 0.022, 2.52, 2.6, 0.74, 0.04, STL, v=6))
P.append(cy("hoistwheel", 0.075, 0.0, 0.08, 0.74, 2.62, IRON, v=8))
rope_line(P, ((0.815, 0.04, 2.62), (0.815, 0.04, 1.62)), r=0.012)
# chutes: two ways in at the back, either takes either, one out at the front. All 0.4 m high at the machine's edge
farm_chute(P, -0.46, -1.0, 0.62, 0.4, 0.0, legs=(-0.84,), n=4)
for xo in (-0.5, 0.5):
G = []
farm_chute(G, -0.47, -1.0, 0.36, 0.4, -xo, legs=(-0.84,), n=3)
turned(P, G, PI)
# the motor at the front left drives the flywheel on the post above it by a flat belt
FX, FY, FZ, FR = -0.7, -0.56, 1.18, 0.29
MX, MZ = -0.62, 0.34
P.append(cy("motor", 0.13, -0.9, -0.6, MX, MZ, GRN, v=10))
for y in (-0.9, -0.6):
P.append(cy("motorcap", 0.135, y - 0.02, y + 0.02, MX, MZ, IRON, v=10))
for y in (-0.82, -0.75, -0.68):
P.append(cy("motorfin", 0.142, y - 0.01, y + 0.01, MX, MZ, GRN, v=10))
P.append(bx(MX - 0.15, MX + 0.15, -0.92, -0.6, 0.13, 0.22, IRON, bev=0.008, name="motorbed"))
P.append(cy("mshaft", 0.03, -0.6, -0.5, MX, MZ, STL, v=6))
P.append(cy("mpulley", 0.075, FY - 0.04, FY + 0.04, MX, MZ, IRON, v=10))
P.append(bx(MX - 0.07, MX + 0.07, -0.82, -0.68, MZ + 0.12, MZ + 0.2, IRON, bev=0.008, name="termbox"))
conduit(P, [(MX, -0.75, MZ + 0.2), (-0.5, -0.66, 0.66), (-0.47, -0.47, 1.0), (-0.5, -0.47, 1.84)])
P.append(xf(flat_belt("drive", 0.0, (-FX, FZ), FR + 0.006, (-MX, MZ), 0.08, w=0.06), rz=PI / 2, t=(0, FY, 0)))
P.append(cy("wbear", 0.06, -0.54, -0.46, FX, FZ, IRON, v=8))
P.append(bx(FX - 0.1, FX + 0.1, -0.48, -0.46, FZ - 0.14, FZ + 0.14, IRON, bev=0.006, name="wbearplate"))
# finished bricks stacked at the front right
bricks(P, ((0.7, -0.76, 0.13, 0.04), (0.68, -0.76, 0.24, -0.1)))
bricks(P, ((0.72, -0.76, 0.35, 0.3),))
lo = status_lamp(P, 0.77, -0.57, 1.48, arm=(0.77, -0.46, 1.38))
ffin(P, "Body", ang=30, wn=False)
# Press head: moves straight down in game, origin at the bottom centre of the die (same as before). The screw and capstan ride with it.
Q = [bx(-0.56, 0.56, -0.4, 0.4, 1.3, 1.5, IRON, bev=0.04, name="head"),
bx(-0.5, 0.5, -0.34, 0.34, 1.48, 1.56, PRED, bev=0.022, name="headtop"),
box("headpin", -0.565, 0.565, -0.405, 0.405, 1.385, 1.405, GOLD, bev=0),
bx(-0.36, 0.36, -0.36, 0.36, 1.24, 1.31, TIM, bev=0.016, name="die"),
box("dieshoe", -0.37, 0.37, -0.37, 0.37, 1.235, 1.26, STL, bev=0),
revm("collar", [(0.17, 1.55), (0.17, 1.6), (0.12, 1.66), (0.09, 1.68)], IRON, segs=8),
uv_wall(threaded(1.66, 2.5, step=0.1)),
cz("capshaft", 0.095, 2.5, 2.57, m=STL, v=8),
cz("caphub", 0.12, 2.56, 2.66, m=IRON, v=10, bev=0.016, segs=1)]
for s in (-1, 1):
Q.append(bx(s * 0.6 - 0.03, s * 0.6 + 0.03, -0.13, 0.13, 1.28, 1.52, IRON, bev=0.012, name="shoe"))
for a in (0.6, 0.6 + PI):
ca, sa = math.cos(a), math.sin(a)
Q.append(cyl_between("capbar", (0, 0, 2.61), (0.56 * ca, 0.56 * sa, 2.61), 0.03, IRON, v=6))
Q.append(sphere("capball", 0.07, (0.56 * ca, 0.56 * sa, 2.61), seg=8, rings=5, m=PRED))
for k in range(4):
aa = PI / 4 + k * PI / 2
Q.append(cyl_between("boltcap", (0.24 * math.cos(aa), 0.24 * math.sin(aa), 1.56), (0.24 * math.cos(aa), 0.24 * math.sin(aa), 1.58), 0.02, STL, v=6))
fpart(Q, "Press", (0, 0, 1.24), wn=False)
# the flywheel, axle along X
S = []
spoked(S, (0, 0, 0), "Z", R=FR, w=0.07, n=6, rim=IRON, spoke=PRED, hub=IRON, segs=20)
S.append(cyl_between("wcrank", (0.2, 0.0, 0.0), (0.2, 0.0, -0.13), 0.016, IRON, v=5))
S.append(cz("wgrip", 0.03, -0.17, -0.11, 0.2, 0, PRED, v=8))
spin_part(S, (FX, FY, FZ))
empty("Out", (0, -0.98, 0.4))
return dict(elev=24, azim=-35)
# ======================================================================= binder
def binder():
P = []
farm_skid(P, -0.88, 0.88, -0.84, 0.92, n=4)
H = 0.52 # half width of the bale chamber
Y0, Y1 = -0.72, 0.56
# the bale chamber, painted steel on a timber sill, ribbed like the real thing
P.append(bx(-H, H, Y0, Y1, 0.2, 1.02, PRED, bev=0.03, name="chamber"))
P.append(box("sill", -H - 0.01, H + 0.01, Y0 - 0.01, Y1 + 0.01, 0.13, 0.26, IRON, bev=0))
P.append(box("stripe", -H - 0.004, H + 0.004, Y0 - 0.004, Y1 + 0.004, 0.72, 0.8, CRM, bev=0))
for y in (-0.5, -0.14, 0.22):
P.append(box("rib", -H - 0.02, H + 0.02, y - 0.03, y + 0.03, 0.2, 1.06, IRON, bev=0.004, segs=1))
for s in (-1, 1):
rivet(P, (s * (H + 0.02), y, 0.34), (s, 0, 0))
rivet(P, (s * (H + 0.02), y, 0.9), (s, 0, 0))
P.append(bx(-H - 0.04, H + 0.04, Y0 - 0.04, Y1 + 0.04, 1.02, 1.08, TIN, bev=0.012, name="lid"))
for y in (-0.56, 0.5):
P.append(box("lidstrap", -H - 0.05, H + 0.05, y - 0.022, y + 0.022, 1.012, 1.088, IRON, bev=0))
for x in (-0.4, 0.4):
rivets(P, (x, -0.7, 1.08), (x, 0.52, 1.08), 3, (0, 0, 1), r=0.016)
# the mouth: an iron throat the bale is squeezed out of
for s in (-1, 1):
P.append(bx(min(s * 0.3, s * 0.42), max(s * 0.3, s * 0.42), Y0 - 0.1, Y0, 0.3, 0.74, IRON, bev=0.012, name="throat"))
P.append(bx(-0.42, 0.42, Y0 - 0.1, Y0, 0.66, 0.78, IRON, bev=0.012, name="throat"))
P.append(bx(-0.42, 0.42, Y0 - 0.1, Y0, 0.28, 0.36, IRON, bev=0.012, name="throat"))
P.append(box("mouthdark", -0.3, 0.3, Y0 - 0.02, Y0 + 0.002, 0.36, 0.66, SOOT, bev=0))
# the bale chute, and a bale halfway out
farm_chute(P, -0.78, -1.0, 0.62, 0.4, 0.0, n=3)
bale(P, (0, -0.8, 0.53), sx=0.46, sy=0.26, sz=0.26)
# feed hopper on the lid
plank_funnel(P, 0, 0.0, 1.08, 1.56, 0.32, 0.6, 3, [TIM, CRM, TIM])
hay_heap(P, (0, 0.0, 1.42), 0.42, 0.42, 0.2, tufts=7)
for (a, b) in (((-0.6, -0.6), (-0.7, -0.7)), ((0.6, -0.6), (0.7, -0.7)), ((-0.6, 0.6), (-0.7, 0.7)), ((0.6, 0.6), (0.7, 0.7))):
P.append(beam((b[0] * 0.8, b[1] * 0.74, 1.08), (a[0], a[1], 1.56), 0.05, 0.05, name="hopstay"))
# flywheel, gearbox and crank on the left, belt guard on the right
P.append(bx(-H - 0.16, -H, 0.08, 0.5, 0.3, 0.74, IRON, bev=0.02, name="gearbox"))
P.append(cx("gearcap", 0.09, -H - 0.2, -H - 0.14, 0.29, 0.52, STL, v=8))
spoked(P, (-0.76, 0.2, 0.6), "X", R=0.42, w=0.07, n=6, rim=IRON, spoke=PRED, hub=IRON, segs=18)
P.append(cx("wshaft", 0.03, -0.83, -H, 0.2, 0.6, STL, v=6))
# twine spools on a rack at the back, a toolbox on the skid
P.append(bx(-0.5, 0.5, Y1 + 0.02, Y1 + 0.3, 0.16, 0.22, TIM, bev=0.012, name="rack"))
for x in (-0.3, 0.3):
P.append(cz("spindle", 0.022, 0.2, 0.62, x, Y1 + 0.17, STL, v=6))
P.append(revm("spool", [(0.06, 0.24), (0.15, 0.24), (0.15, 0.26), (0.13, 0.28), (0.13, 0.52), (0.15, 0.54), (0.15, 0.56), (0.06, 0.56)],
[TIM, TIM, TWINE, TWINE, TWINE, TWINE, TIM], segs=10, loc=(x, Y1 + 0.17, 0)))
rope_line(P, ((x, Y1 + 0.1, 0.52), (x * 0.6, Y1, 0.98)), r=0.006, m=TWINE, n=3)
# the gearbox end of the plunger at the back
P.append(bx(-0.3, 0.3, Y1, Y1 + 0.06, 0.34, 0.92, IRON, bev=0.012, name="backplate"))
rivets(P, (-0.24, Y1 + 0.06, 0.86), (0.24, Y1 + 0.06, 0.86), 4, (0, 1, 0))
P.append(bx(0.54, 0.84, -0.46, -0.2, 0.16, 0.38, GRN, bev=0.016, name="toolbox"))
P.append(box("toollid", 0.53, 0.85, -0.47, -0.19, 0.36, 0.4, IRON, bev=0))
P.append(bx(0.6, 0.78, -0.34, -0.32, 0.4, 0.44, STL, bev=0, name="toolhandle"))
sb = plate("signboard", 0.3, 0.13, 0.012, CRM, r=0.015)
P.append(uv_wall(orient(sb, "+X", (H + 0.008, 0.04, 0.56))))
sign_text(P, "BINDER", 0.062, PRED, (H + 0.022, 0.04, 0.56), facing="+X")
status_lamp(P, 0.62, -0.62, 1.24, arm=(0.5, -0.62, 1.09))
ffin(P, "Body", ang=30, wn=False)
return dict(elev=25, azim=-35)
# ======================================================================= bundle catcher
def catcher():
P = []
RT, ZT, RB, ZB = 1.42, 2.55, 0.42, 1.25
# four raked legs on footing pads, ring beams and X braces
for (sx, sy) in ((1, 1), (-1, 1), (1, -1), (-1, -1)):
P.append(beam((sx * 1.22, sy * 1.22, 0.0), (sx * 0.72, sy * 0.72, 1.9), 0.14, 0.14, bev=0.02, name="leg"))
P.append(bx(sx * 1.22 - 0.16, sx * 1.22 + 0.16, sy * 1.22 - 0.16, sy * 1.22 + 0.16, 0.0, 0.05, IRON, bev=0.012, name="pad"))
P.append(box("legband", sx * 0.98 - 0.09, sx * 0.98 + 0.09, sy * 0.98 - 0.09, sy * 0.98 + 0.09, 0.88, 0.94, IRON, bev=0))
Z1, Q1 = 0.74, 1.03
for s in (-1, 1):
P.append(grain(bx(-Q1 - 0.06, Q1 + 0.06, s * Q1 - 0.05, s * Q1 + 0.05, Z1 - 0.05, Z1 + 0.05, TIM, bev=0.012, name="ring"), (1, 0, 0)))
P.append(bx(s * Q1 - 0.05, s * Q1 + 0.05, -Q1 - 0.06, Q1 + 0.06, Z1 - 0.05, Z1 + 0.05, TIM, bev=0.012, name="ring"))
P.append(beam((-0.84, s * 0.84, 1.3), (0.84, s * 0.84, 1.3), 0.08, 0.08, bev=0.01, name="ring"))
P.append(beam((s * 0.84, -0.84, 1.3), (s * 0.84, 0.84, 1.3), 0.08, 0.08, bev=0.01, name="ring"))
# flank braces, lower storey
for f in (-1, 1):
P.append(beam((s * 1.2, -f * 1.05, 0.08), (s * 1.0, f * 1.0, 0.7), 0.07, 0.04, bev=0.006, name="brace"))
for f in (-1, 1):
P.append(beam((-f * 1.05, 1.2, 0.08), (f * 1.0, 1.0, 0.7), 0.07, 0.04, bev=0.006, name="brace"))
# the funnel: an eight-sided burlap sleeve, tin rim, timber ribs, patches, hay in the throat
net = revm("net", [(RB, ZB), (RB + 0.26, ZB + 0.28), (0.96, ZB + 0.68), (RT - 0.02, ZT), (RT + 0.02, ZT), (RB + 0.05, ZB)], BUR, segs=8, closed=True, a0=22.5, a1=382.5)
P.append(uv_wall(net))
P.append(uv_wall(torus("rim", RT + 0.0, 0.055, (0, 0, ZT), "Z", seg=16, rseg=5, m=TIN)))
P.append(uv_wall(xf(torus("hoop", 1.06, 0.028, (0, 0, ZB + 0.7), "Z", seg=8, rseg=4, m=IRON), rz=PI / 8)))
P.append(torus("throat", RB, 0.05, (0, 0, ZB), "Z", seg=12, rseg=5, m=IRON))
for k in range(8):
a = PI / 8 + k * PI / 4
c, s = math.cos(a), math.sin(a)
P.append(beam((c * (RB + 0.06), s * (RB + 0.06), ZB - 0.02), (c * 1.06, s * 1.06, ZB + 0.72), 0.06, 0.05, bev=0, name="rib"))
P.append(beam((c * 1.06, s * 1.06, ZB + 0.72), (c * (RT + 0.02), s * (RT + 0.02), ZT + 0.0), 0.06, 0.05, bev=0, name="rib"))
for (a, d) in ((0.62, 0.0), (3.9, 0.08)):
c, s = math.cos(a), math.sin(a)
p = Vector((c * 1.2, s * 1.2, 2.2))
q = cube("patch", (0.34, 0.012, 0.3), (0, 0, 0), LEA if d else ROPE)
P.append(uv_wall(xf(q, rx=0.55, rz=a + PI / 2, t=p)))
hay_heap(P, (0, 0, ZB + 0.14), 0.56, 0.56, 0.13, tufts=4)
for k in range(5):
a = 2 * PI * k / 5 + 0.3
tuft(P, (RT - 0.16) * math.cos(a), (RT - 0.16) * math.sin(a), ZT + 0.0, L=0.13, n=3, az=a + PI)
# collecting box under the throat, tin chute to the front with its lip at belt height
P.append(bx(-0.46, 0.46, -0.5, 0.46, 0.92, 1.22, RED, bev=0.016, name="boxb"))
for s in (-1, 1):
for (y0, y1) in ((-0.5, -0.42), (0.38, 0.46)):
P.append(bx(s * 0.46 - 0.05, s * 0.46 + 0.05, y0, y1, 0.9, 1.25, TIM, bev=0.01, name="boxpost"))
A, B = Vector((0, -0.42, 1.0)), Vector((0, -1.47, 0.42))
P.append(beam(A, B, 0.6, 0.04, m=TIN, bev=0.004, name="chute"))
d = (B - A).normalized()
for s in (-1, 1):
P.append(beam(A + Vector((s * 0.32, 0, 0.06)), B + Vector((s * 0.32, 0, 0.06)), 0.05, 0.16, m=TIM, name="chuteside"))
for t in (0.25, 0.75):
q = A.lerp(B, t)
P.append(box("chstrap", s * 0.345 - 0.008, s * 0.345 + 0.008, q.y - 0.03, q.y + 0.03, q.z - 0.06, q.z + 0.13, IRON, bev=0))
for t in (0.2, 0.5, 0.8):
q = A.lerp(B, t)
P.append(xf(cube("chband", (0.61, 0.05, 0.05), (0, 0, 0), IRON), rx=-math.atan2(d.z, -d.y) * 1.0, t=(0, q.y, q.z - 0.012)))
# chute props with a cross tie, a ladder up the back
for s in (-1, 1):
P.append(beam((s * 0.3, -1.1, 0.0), (s * 0.3, -1.1, 0.6), 0.08, 0.08, name="chuteleg"))
P.append(bx(s * 0.3 - 0.07, s * 0.3 + 0.07, -1.17, -1.03, 0.0, 0.03, IRON, bev=0.006, name="foot"))
P.append(beam((-0.34, -1.1, 0.52), (0.34, -1.1, 0.52), 0.06, 0.06, name="chutetie"))
for s in (-1, 1):
P.append(beam((s * 0.2, 1.26, 0.0), (s * 0.2, 0.92, 1.3), 0.05, 0.05, bev=0.006, name="ladder"))
for k in range(6):
t = (k + 0.5) / 6
P.append(beam((-0.2, 1.26 - 0.34 * t, 1.3 * t), (0.2, 1.26 - 0.34 * t, 1.3 * t), 0.03, 0.03, bev=0, name="rung"))
# a mast with a flag so a Reaper's driver can spot it
P.append(beam((1.0, 1.0, 1.32), (1.0, 1.0, 3.1), 0.05, 0.05, m=STL, bev=0, name="mast"))
P.append(prism("flag", [(1.03, 3.06), (1.44, 2.95), (1.03, 2.82)], "XZ", 0.992, 1.008, PRED))
ffin(P, "Body", ang=30, wn=False)
return dict(elev=25, azim=-35)
# ======================================================================= solar
def panel(P, x, w, d, nx=2, ny=2):
"""One framed panel lying flat around the head's origin: tin frame, cells, tin bus strips over them, corner plates."""
P.append(bx(x - w / 2, x + w / 2, -d / 2, d / 2, -0.05, 0.022, TIN, bev=0.008, name="frame"))
P.append(bx(x - w / 2 + 0.04, x + w / 2 - 0.04, -d / 2 + 0.04, d / 2 - 0.04, 0.02, 0.036, CELL, bev=0, name="cells"))
for k in range(1, nx):
xk = x - w / 2 + w * k / nx
P.append(box("bus", xk - 0.007, xk + 0.007, -d / 2 + 0.04, d / 2 - 0.04, 0.03, 0.04, STL, bev=0))
for k in range(1, ny):
yk = -d / 2 + d * k / ny
P.append(box("bus", x - w / 2 + 0.04, x + w / 2 - 0.04, yk - 0.007, yk + 0.007, 0.03, 0.04, STL, bev=0))
for sx in (-1, 1):
for sy in (-1, 1):
cx_, cy_ = x + sx * (w / 2 - 0.04), sy * (d / 2 - 0.04)
P.append(box("corner", cx_ - 0.04, cx_ + 0.04, cy_ - 0.04, cy_ + 0.04, 0.03, 0.042, IRON, bev=0))
rivet(P, (cx_, cy_, 0.042), (0, 0, 1), r=0.012, h=0.006)
def under(P, x0, x1, y0, y1, z=-0.11):
"""Timber bearers under the cells and the iron trunnion they ride on."""
for y in (y0, y1):
P.append(grain(bx(x0, x1, y - 0.04, y + 0.04, z, -0.05, TIM, bev=0.008, name="bearer"), (1, 0, 0)))
def stand(high, r=0.09, feet=1.0):
"""A squared post in an iron shoe on plank feet, with knee braces, a meter box and a cable down it."""
P = []
F = 0.5 * feet
for rz in (0.0, PI / 2):
o = bx(-F, F, -0.07, 0.07, 0.0, 0.08, TIM, bev=0.012, name="foot")
xf(o, rz=rz)
P.append(grain(o, Matrix.Rotation(rz, 3, "Z") @ Vector((1, 0, 0))))
P.append(bx(-r - 0.04, r + 0.04, -r - 0.04, r + 0.04, 0.06, 0.26, IRON, bev=0.01, name="shoe"))
P.append(grain(bx(-r, r, -r, r, 0.08, high - 0.1, TIM, bev=0.012, 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 * 0.86, s * F * 0.86, 0.08), (c * r, s * r, 0.2 + F * 0.86), 0.05, 0.05, bev=0.006, name="knee"))
for z in (0.3, high - 0.28):
P.append(box("band", -r - 0.008, r + 0.008, -r - 0.008, r + 0.008, z - 0.02, z + 0.02, IRON, bev=0))
# the yoke the head's axle sits in
P.append(bx(-r - 0.03, r + 0.03, -r - 0.03, r + 0.03, high - 0.14, high - 0.08, IRON, bev=0.008, name="yokebase"))
for s in (-1, 1):
x0, x1 = sorted((s * (r + 0.005), s * (r + 0.035)))
P.append(bx(x0, x1, -0.06, 0.06, high - 0.1, high + 0.05, IRON, bev=0.004, name="yoke"))
# meter box and cable
P.append(bx(-0.09, 0.09, -r - 0.09, -r, 0.82, 1.08, GRN, bev=0.01, name="meter"))
P.append(box("meterlid", -0.1, 0.1, -r - 0.1, -r, 1.06, 1.1, IRON, bev=0))
P.append(cy("meterglass", 0.05, -r - 0.096, -r - 0.086, 0, 0.98, INK, v=8))
conduit(P, [(r + 0.012, -0.02, high - 0.1), (r + 0.012, -0.02, 1.0), (r + 0.012, -r - 0.05, 0.84), (0.05, -r - 0.05, 0.82)], r=0.011)
P.append(bx(-r + 0.008, r - 0.008, -r - 0.012, -r, 0.4, 0.56, PRED, bev=0, name="tag"))
P.append(prism("bolt", [(a_ * 0.72, 0.48 + b_ * 0.95) for (a_, b_) in BOLT], "XZ", -r - 0.02, -r - 0.012, GOLD))
P.append(box("needle", -0.004, 0.03, -r - 0.102, -r - 0.094, 0.976, 0.984, PRED, bev=0))
P.append(bx(-0.24, -0.14, -0.05, 0.05, 0.075, 0.12, IRON, bev=0, name="tiebar"))
P.append(bx(0.14, 0.24, -0.05, 0.05, 0.075, 0.12, IRON, bev=0, name="tiebar"))
for k in range(4):
a = k * PI / 2 + PI / 4
rivet(P, ((r + 0.04) * 1.2 * math.cos(a) * 0.86, (r + 0.04) * 1.2 * math.sin(a) * 0.86, 0.26), (0, 0, 1), r=0.016)
ffin(P, "Stand", ang=30, wn=False)
def tilted(P, high):
"""The fixed panels lean back and look at the noon sun."""
o = ffin(P, "Head", ang=30, wn=False)
xf(o, rx=0.42, t=(0, 0, high))
set_origin(o, (0, 0, high))
def trunnion(P, half):
P.append(cx("axle", 0.035, -half, half, 0, 0, STL, v=8))
P.append(bx(-half + 0.02, half - 0.02, -0.03, 0.03, -0.11, -0.03, IRON, bev=0.004, name="saddle"))
# the junction box on the underside and the lead down to the axle
x0 = half + 0.05
P.append(bx(x0, x0 + 0.16, -0.08, 0.08, -0.17, -0.11, GRN, bev=0.008, name="jbox"))
P.append(box("jlid", x0 - 0.008, x0 + 0.168, -0.088, 0.088, -0.182, -0.166, IRON, bev=0))
conduit(P, [(x0 + 0.02, 0.0, -0.17), (x0 - 0.06, 0.0, -0.2), (half - 0.04, 0.0, -0.1), (half - 0.04, 0.0, -0.04)], r=0.01)
def solar_post():
stand(1.6)
P = []
panel(P, 0, 1.0, 0.8, nx=3, ny=2)
under(P, -0.46, 0.46, -0.24, 0.24)
trunnion(P, 0.14)
tilted(P, 1.6)
return dict(elev=20, azim=-35)
def solar_pair():
stand(1.9, r=0.11, feet=1.25)
P = []
panel(P, -0.76, 1.5, 1.2, nx=3, ny=2)
panel(P, 0.76, 1.5, 1.2, nx=3, ny=2)
under(P, -1.46, 1.46, -0.36, 0.36)
trunnion(P, 0.16)
for s in (-1, 1):
P.append(beam((s * 0.1, -0.05, -0.1), (s * 0.82, 0.0, -0.06), 0.05, 0.05, m=IRON, bev=0, name="strut"))
tilted(P, 1.9)
return dict(elev=20, azim=-35)
def solar_tracker():
stand(2.6, r=0.15, feet=1.7)
P = []
panel(P, 0, 2.4, 1.92, nx=4, ny=3)
under(P, -1.14, 1.14, -0.62, 0.62, z=-0.13)
P.append(bx(-1.14, 1.14, -0.05, 0.05, -0.17, -0.05, IRON, bev=0.008, name="spine"))
P.append(bx(-0.05, 0.05, -0.9, 0.9, -0.17, -0.05, IRON, bev=0.008, name="spine"))
trunnion(P, 0.21)
for s in (-1, 1):
P.append(beam((s * 0.16, 0, -0.12), (s * 0.95, 0, -0.08), 0.04, 0.04, m=IRON, bev=0, name="strut"))
P.append(beam((0.0, s * 0.1, -0.12), (0.0, s * 0.8, -0.08), 0.04, 0.04, m=IRON, bev=0, name="strut"))
o = ffin(P, "Head", ang=30, wn=False)
xf(o, t=(0, 0, 2.6))
set_origin(o, (0, 0, 2.6))
return dict(elev=20, azim=-35)
# ======================================================================= batteries
BOLT = [(0.03, 0.06), (-0.04, -0.012), (-0.004, -0.012), (-0.03, -0.06), (0.042, 0.016), (0.006, 0.016)]
def rack():
P = []
H = 0.75
Z0, ZS, ZT = 0.14, 0.72, 1.36 # floor, shelf, top of the crate
# skid and plank floor
for x in (-0.62, 0.62):
P.append(bx(x - 0.07, x + 0.07, -H, H, 0.0, 0.1, TIM, bev=0.02, name="runner"))
for k in range(7):
y = -H + 0.02 + (k + 0.5) * (2 * H - 0.04) / 7
P.append(grain(bx(-H + 0.01, H - 0.01, y - 0.09, y + 0.09, 0.1, Z0, DECK, bev=0.006, name="floor"), (1, 0, 0)))
# corner posts, crate rails on the flanks, boards at the back
for (sx, sy) in ((1, 1), (-1, 1), (1, -1), (-1, -1)):
P.append(grain(bx(sx * 0.67 - 0.065, sx * 0.67 + 0.065, sy * 0.67 - 0.065, sy * 0.67 + 0.065, 0.1, ZT + (0.14 if sy < 0 else 0.0), TIM, bev=0.016, name="post"), (0, 0, 1)))
iron_corner(P, sx * 0.735, sy * 0.735, Z0 + 0.02, Z0 + 0.2, sx, sy, w=0.09)
for s in (-1, 1):
rails_h(P, (s * 0.7, 0, 0), "+X" if s > 0 else "-X", 1.22, Z0 + 0.04, ZT, 5)
P.append(uv_wall(bx(min(s * 0.62, s * 0.66), max(s * 0.62, s * 0.66), -0.6, 0.6, Z0, ZT, SOOT, bev=0, name="flankback")))
for (a, b) in (((-0.58, 0.2), (0.58, ZT - 0.04)), ((-0.58, ZT - 0.04), (0.58, 0.2))):
P.append(beam((s * 0.735, a[0], a[1]), (s * 0.735, b[0], b[1]), 0.05, 0.022, m=CRM, bev=0.004, name="xbrace"))
boards(P, (0, 0.68, 0), "+Y", 1.24, Z0, ZT, 6, m=TIM, back=SOOT)
P.append(uv_wall(bx(-0.62, 0.62, 0.55, 0.64, Z0, ZT, SOOT, bev=0, name="inback")))
P.append(grain(bx(-0.62, 0.34, -0.6, 0.56, ZS - 0.05, ZS, DECK, bev=0.008, name="shelf"), (1, 0, 0)))
P.append(grain(bx(-0.62, 0.34, -0.66, -0.6, ZS - 0.09, ZS + 0.02, TIM, bev=0.01, name="shelflip"), (1, 0, 0)))
# six chunky cells, three on the floor, three on the shelf, linked by heavy jumpers
xs = (-0.47, -0.14, 0.19)
for z, y in ((Z0 + 0.0, -0.2), (ZS, -0.22)):
for k, x in enumerate(xs):
cell(P, x, y, z, m=GRN if k != 1 or z > 0.5 else PRED, h=0.36)
for a, b in ((xs[0], xs[1]), (xs[1], xs[2])):
jumper(P, (a + 0.09, y, z + 0.4), (b - 0.09, y, z + 0.4))
# the control board on the right of the front
bx0, bx1, Yf = 0.36, 0.62, -0.64
P.append(grain(bx(bx0, bx1, Yf, Yf + 0.04, Z0, ZT, CRM, bev=0.006, name="board"), (0, 0, 1)))
# the glass for the gauge: a dark slot with a tin frame and tick marks
GX, GZ, GH = 0.49, 0.42, 0.5
P.append(box("gslot", GX - 0.06, GX + 0.06, Yf - 0.012, Yf + 0.002, GZ - 0.02, GZ + GH + 0.02, SOOT, bev=0))
for s in (-1, 1):
P.append(box("gframe", GX + s * 0.072 - 0.012, GX + s * 0.072 + 0.012, Yf - 0.02, Yf, GZ - 0.03, GZ + GH + 0.03, TIN, bev=0))
for z in (GZ - 0.032, GZ + GH + 0.032):
P.append(box("gframe", GX - 0.084, GX + 0.084, Yf - 0.02, Yf, z - 0.012, z + 0.012, TIN, bev=0))
for k in range(5):
z = GZ + GH * k / 4
P.append(box("gtick", GX + 0.086, GX + 0.106, Yf - 0.016, Yf - 0.006, z - 0.005, z + 0.005, IRON, bev=0))
dial(P, 0.49, Yf, 1.06, r=0.085)
# knife switch and cable bundle
P.append(bx(0.42, 0.56, Yf - 0.03, Yf, 0.2, 0.34, IRON, bev=0.006, name="switch"))
P.append(beam((0.49, Yf - 0.03, 0.27), (0.56, -0.71, 0.36), 0.016, 0.016, m=BRASS, bev=0, name="knife"))
P.append(cz("knifegrip", 0.016, 0.34, 0.4, 0.56, -0.71, PRED, v=6))
for a, z in ((0.25, Z0 + 0.4), (0.26, ZS + 0.4)):
conduit(P, [(a, -0.2, z), (0.34, -0.3, z + 0.05), (0.4, -0.52, z + 0.02), (0.4, Yf + 0.03, z)], r=0.012)
P.append(grain(bx(-0.62, 0.62, -0.72, -0.66, ZT, ZT + 0.14, RED, bev=0.01, name="fascia"), (1, 0, 0)))
# tin pent roof falling to the back, on rafters, with two insulators and a line going out
a, b, c, d = (-H, -H, 1.56), (H, -H, 1.56), (H, H, 1.36), (-H, H, 1.36)
P.append(uv_keep_slope(slab(a, b, c, d, 0.03, (0, 0, 1), TIN, bev=0.008), (a, d)))
for x in (-0.5, 0.0, 0.5):
P.append(beam((x, -0.72, 1.5), (x, 0.72, 1.32), 0.06, 0.06, bev=0.008, name="rafter"))
for x in (-0.2, 0.22):
P.append(revm("ins", [(0.012, 1.48), (0.045, 1.5), (0.03, 1.52), (0.045, 1.54), (0.02, 1.58)], INK, segs=6, loc=(x, 0.1, 0), cap_top=True))
conduit(P, [(-0.2, 0.1, 1.585), (0.0, 0.1, 1.57), (0.22, 0.1, 1.585)], r=0.008, m=BRASS)
conduit(P, [(0.22, 0.1, 1.58), (0.5, 0.25, 1.52), (0.7, 0.72, 1.3), (0.72, 0.74, 0.4), (0.74, 0.74, 0.14)], r=0.012)
P.append(prism("bolt", [(-0.15 + a_, 1.43 + b_) for (a_, b_) in BOLT], "XZ", -0.728, -0.718, GOLD))
status_lamp(P, 0.49, -0.69, 1.25, arm=(0.49, Yf, 1.17))
ffin(P, "Body", ang=30, wn=False)
gauge_strip(GX, Yf - 0.012, GZ)
return dict(elev=22, azim=-35)
def bank():
P = []
HX, HY = 1.5, 1.0
Z0, ZS, ZE, ZR = 0.16, 0.86, 1.72, 2.2
# plank floor on two sleepers, a painted hazard kerb along the front
for y in (-0.82, 0.82):
P.append(grain(bx(-HX, HX, y - 0.09, y + 0.09, 0.0, 0.12, TIM, bev=0.02, name="sleeper"), (1, 0, 0)))
for k in range(11):
x = -HX + 0.02 + (k + 0.5) * (2 * HX - 0.04) / 11
P.append(bx(x - 0.128, x + 0.128, -HY + 0.02, HY - 0.02, 0.12, Z0, DECK, bev=0.006, name="floor"))
# red board walls at the back and flanks, cream X braces like the barn's doors
boards(P, (0, HY - 0.06, 0), "+Y", 2 * HX - 0.16, Z0, ZE, 14)
P.append(bx(-HX + 0.1, HX - 0.1, HY - 0.3, HY - 0.08, Z0, ZE, SOOT, bev=0, name="inback"))
for s in (-1, 1):
fc = "+X" if s > 0 else "-X"
boards(P, (s * (HX - 0.06), 0, 0), fc, 2 * HY - 0.2, Z0, ZE, 10)
xw = s * (HX - 0.05)
for (a, b) in (((-0.76, 0.3), (0.76, 1.6)), ((-0.76, 1.6), (0.76, 0.3))):
P.append(beam((xw, a[0], a[1]), (xw, b[0], b[1]), 0.05, 0.03, m=CRM, bev=0.004, name="xbrace"))
# timber frame
for sx in (-1, 0, 1):
for sy in (-1, 1):
x = sx * (HX - 0.07)
if sx == 0:
continue
P.append(grain(bx(x - 0.07, x + 0.07, sy * (HY - 0.07) - 0.07, sy * (HY - 0.07) + 0.07, 0.1, ZE, TIM, bev=0.016, name="post"), (0, 0, 1)))
P.append(grain(bx(-HX, HX, -HY + 0.03, -HY + 0.1, 1.46, ZE, TIM, bev=0.012, name="plate"), (1, 0, 0)))
P.append(grain(bx(-HX, HX, HY - 0.1, HY, ZE - 0.1, ZE, TIM, bev=0.012, name="plate"), (1, 0, 0)))
# the middle bay: the control pier, cream boards, gauge, dial, lamp, main switch
PX = 0.34
YP = -HY + 0.14 # face of the control pier, recessed behind the posts
P.append(bx(-PX, PX, YP + 0.02, YP + 0.2, Z0, ZE - 0.14, SOOT, bev=0, name="pier"))
boards(P, (0, YP, 0), "-Y", 2 * PX - 0.08, Z0, ZE - 0.16, 4, m=CRM)
for s in (-1, 1):
P.append(grain(bx(s * PX - 0.05, s * PX + 0.05, -HY, YP + 0.1, 0.1, ZE - 0.14, TIM, bev=0.014, name="jamb"), (0, 0, 1)))
GX, GZ, GH = 0.0, 0.5, 0.5
Yf = YP - 0.008
P.append(box("gslot", GX - 0.07, GX + 0.07, Yf, Yf + 0.02, GZ - 0.02, GZ + GH + 0.02, SOOT, bev=0))
for s in (-1, 1):
P.append(box("gframe", GX + s * 0.084 - 0.014, GX + s * 0.084 + 0.014, Yf - 0.008, Yf + 0.02, GZ - 0.03, GZ + GH + 0.03, TIN, bev=0))
for z in (GZ - 0.034, GZ + GH + 0.034):
P.append(box("gframe", GX - 0.098, GX + 0.098, Yf - 0.008, Yf + 0.02, z - 0.014, z + 0.014, TIN, bev=0))
for k in range(5):
z = GZ + GH * k / 4
P.append(box("gtick", GX + 0.1, GX + 0.13, Yf - 0.004, Yf + 0.01, z - 0.006, z + 0.006, IRON, bev=0))
dial(P, -0.16, Yf, 1.14, r=0.08)
dial(P, 0.16, Yf, 1.14, r=0.08)
P.append(bx(-0.09, 0.09, Yf - 0.01, Yf + 0.02, 0.2, 0.38, IRON, bev=0.008, name="switch"))
P.append(beam((0, Yf - 0.02, 0.27), (0.08, -HY + 0.03, 0.38), 0.02, 0.02, m=BRASS, bev=0, name="knife"))
P.append(cz("knifegrip", 0.02, 0.36, 0.44, 0.08, -HY + 0.03, PRED, v=6))
# two bays of big cells on a shelf, each row tied to a brass bus bar
for s in (-1, 1):
cx_ = s * 0.9
P.append(grain(bx(cx_ - 0.47, cx_ + 0.47, -0.84, 0.6, ZS - 0.05, ZS, DECK, bev=0.008, name="shelf"), (1, 0, 0)))
P.append(grain(bx(cx_ - 0.47, cx_ + 0.47, -0.9, -0.84, ZS - 0.1, ZS + 0.02, TIM, bev=0.01, name="shelflip"), (1, 0, 0)))
xs = [cx_ - 0.33, cx_, cx_ + 0.33]
for z, y, tall in ((Z0, -0.34, 0.5), (ZS, -0.34, 0.46)):
for k, x in enumerate(xs):
cell(P, x, y, z, w=0.3, d=0.5, h=tall, m=GRN if (k + (z > 0.5)) % 3 else PRED, detail=False)
P.append(grain(bx(xs[0] - 0.12, xs[2] + 0.12, -0.36, -0.32, z + tall + 0.06, z + tall + 0.09, BRASS, bev=0, name="bus"), (1, 0, 0)))
# a low rail across the open bay
P.append(grain(bx(cx_ - 0.52, cx_ + 0.52, -HY + 0.03, -HY + 0.09, 0.62, 0.7, TIM, bev=0.01, name="barrail"), (1, 0, 0)))
# heavy leads from the bus bars into the control pier
for k, s in enumerate((-1, 1)):
conduit(P, [(s * 0.6, -0.34, 1.42), (s * 0.45, -0.7, 1.44), (s * 0.3, -0.8, 1.4)], r=0.016)
conduit(P, [(s * 0.6, -0.34, 0.74), (s * 0.45, -0.6, 0.72), (s * 0.3, -0.84, 0.62)], r=0.016)
# tin gable roof, ridge along X, insulators on the ridge, a line down the right flank
roof_ridge_x(P, -HX, HX, -HY, HY, ZE - 0.04, ZR)
for s in (-1, 1):
o = prism("gableend", [(-HY + 0.04, ZE), (HY - 0.04, ZE), (0, ZR - 0.05)], "YZ", s * (HX - 0.04), s * (HX - 0.04) + 0.04, RED)
P.append(uv_wall(o))
sb = plate("signboard", 1.34, 0.17, 0.016, PRED, r=0.02)
P.append(uv_wall(orient(sb, "-Y", (0, -HY + 0.03, 1.55))))
sign_text(P, "BATTERY", 0.115, INK, (0, -HY + 0.012, 1.55))
for x in (-0.9, 0.9):
P.append(revm("ins", [(0.016, ZR), (0.06, ZR + 0.02), (0.04, ZR - 0.06 + 0.11), (0.06, ZR + 0.07), (0.03, ZR + 0.11)], INK, segs=6, loc=(x, 0, -0.1), cap_top=True))
conduit(P, [(-0.9, 0, ZR + 0.01), (0, 0, ZR - 0.03), (0.9, 0, ZR + 0.01)], r=0.01, m=BRASS)
conduit(P, [(0.9, 0, ZR + 0.0), (1.24, -0.2, ZR - 0.2), (1.46, -0.3, ZE - 0.06), (1.474, -0.3, 0.2)], r=0.016)
for x in (-0.52, 0.52):
P.append(prism("bolt", [(x + a_ * 1.1, 1.55 + b_ * 1.1) for (a_, b_) in BOLT], "XZ", -HY + 0.008, -HY + 0.016, GOLD))
for x in (-0.86, 0.86):
louvre(P, (x, HY - 0.05, 0), "+Y", 0.5, 1.1, 1.46, 4)
status_lamp(P, 0.0, -HY + 0.065, 1.36, arm=(0.0, YP, 1.27))
ffin(P, "Body", ang=30, wn=False)
gauge_strip(GX, Yf - 0.002, GZ, w=0.12)
return dict(elev=22, azim=-35)
# ======================================================================= belt junctions
def belt_surface(flows):
"""Four mitred sectors meeting in the middle. flows[side]: +1 runs out of the middle, -1 into it. +V along the flow."""
h = 0.5
bm = bmesh.new()
uvl = bm.loops.layers.uv.verify()
sides = {"back": ((1, 0), (0, 1)), "front": ((-1, 0), (0, -1)), "left": ((0, -1), (1, 0)), "right": ((0, 1), (-1, 0))}
for side, ((ax, ay), (dx, dy)) in sides.items():
pts = ((-ax * h + dx * h, -ay * h + dy * h), (ax * h + dx * h, ay * h + dy * h), (0.0, 0.0))
vs = [bm.verts.new((px, py, SURF)) for (px, py) in pts]
f = bm.faces.new(vs)
if f.calc_area() > 0:
f.normal_update()
if f.normal.z < 0:
f.normal_flip()
for l in f.loops:
p = l.vert.co
across = p.x * ax + p.y * ay
along = p.x * dx + p.y * dy
l[uvl].uv = (across + 0.5, along * flows[side])
o = mesh_obj("Belt", bm)
set_mats(o, RUBBELT)
flat(o)
return o
def junction_base(P):
"""Everything under the belt surface: legs, stringers, the iron pan, the mitre strips and hub on top of the belt."""
P.append(bx(-0.49, 0.49, -0.49, 0.49, 0.3, 0.345, IRON, bev=0, name="pan"))
for s in (-1, 1):
P.append(grain(bx(-0.5, 0.5, s * 0.47 - 0.03, s * 0.47 + 0.03, 0.2, 0.33, TIM, bev=0.012, name="stringer"), (1, 0, 0)))
P.append(bx(s * 0.47 - 0.03, s * 0.47 + 0.03, -0.44, 0.44, 0.2, 0.33, TIM, bev=0.012, name="stringer"))
for (sx, sy) in ((1, 1), (-1, 1), (1, -1), (-1, -1)):
P.append(beam((sx * 0.45, sy * 0.45, 0.0), (sx * 0.44, sy * 0.44, 0.22), 0.08, 0.08, bev=0.012, name="leg"))
P.append(bx(sx * 0.45 - 0.05, sx * 0.45 + 0.05, sy * 0.45 - 0.05, sy * 0.45 + 0.05, 0.0, 0.03, IRON, bev=0.006, name="foot"))
for s in (-1, 1):
P.append(beam((s * 0.43, 0.0, 0.03), (-s * 0.43, 0.0, 0.2), 0.04, 0.03, bev=0.004, name="xbrace"))
P.append(beam((0.0, s * 0.43, 0.03), (0.0, -s * 0.43, 0.2), 0.04, 0.03, bev=0.004, name="xbrace"))
# mitre strips along the seams and a hub where they meet, a hair proud of the belt
for k in range(4):
a = PI / 4 + k * PI / 2
o = cube("mitre", (0.56, 0.022, 0.006), (0.34, 0, SURF + 0.002), STL)
P.append(xf(o, rz=a))
P.append(cz("hubplate", 0.075, SURF - 0.01, SURF + 0.006, m=IRON, v=8))
def corner_stub(P, x, y, top=0.47):
P.append(grain(bx(x - 0.03, x + 0.03, y - 0.03, y + 0.03, 0.2, top, TIM, bev=0.008, name="stub"), (0, 0, 1)))
P.append(bx(x - 0.034, x + 0.034, y - 0.034, y + 0.034, top - 0.03, top + 0.012, IRON, bev=0.005, name="stubcap"))
def sign_part(x, y, z, rz=0.0):
"""Sign: the board alone. It leans back a little so a player above it can read its colour; its post stays in the Frame."""
o = bx(-0.12, 0.12, -0.012, 0.012, -0.085, 0.085, INK, bev=0.008, name="Sign")
xf(o, rx=-0.32, rz=rz)
o.location = (x, y, z)
uv_box(o, 1.0)
o.name = "Sign"
flat(o)
return o
def sign_frame(P, x, y, z, rz=0.0):
G = [box("sback", -0.13, 0.13, 0.012, 0.024, -0.095, 0.095, IRON, bev=0)]
for o in G:
xf(o, rx=-0.32, rz=rz, t=(x, y, z))
P.append(o)
P.append(box("sarm", x + 0.08, 0.48, y + 0.016, y + 0.04, z - 0.012, z + 0.012, IRON, bev=0))
def splitter():
belt_surface({"back": -1, "front": 1, "left": 1, "right": 1})
P = []
junction_base(P)
Z_B = 0.93 # underside of the gate beam: the tallest cargo, hay, tops out at 0.86 on a junction
HY = 0.44 # hinge line: every bundle rides the centre line, so the flap stays short and clear of the middle
# the gate at the back: two corner posts and a beam carrying the flap's pin, one post rises to carry the sign
for s in (-1, 1):
P.append(grain(bx(s * 0.465 - 0.03, s * 0.465 + 0.03, 0.435, 0.495, 0.2, Z_B + 0.11, TIM, bev=0.01, name="gatepost"), (0, 0, 1)))
P.append(box("gateband", s * 0.465 - 0.034, s * 0.465 + 0.034, 0.431, 0.499, 0.42, 0.45, IRON, bev=0))
P.append(beam((s * 0.46, 0.465, Z_B - 0.2), (s * 0.28, 0.465, Z_B + 0.01), 0.03, 0.04, bev=0.004, name="knee"))
corner_stub(P, s * 0.465, -0.465)
P.append(grain(bx(-0.5, 0.5, 0.385, 0.495, Z_B, Z_B + 0.09, TIM, bev=0.014, name="gatebeam"), (1, 0, 0)))
for x in (-0.3, 0.3):
P.append(box("gatestrap", x - 0.018, x + 0.018, 0.381, 0.499, Z_B - 0.004, Z_B + 0.094, IRON, bev=0))
P.append(cz("bearing", 0.05, Z_B - 0.02, Z_B + 0.004, 0, HY, IRON, v=8))
# short post for the sign, on the +X back corner
SX, SZ = 0.35, 1.16
P.append(grain(bx(0.445, 0.485, 0.445, 0.485, Z_B + 0.09, SZ + 0.1, TIM, bev=0.006, name="signpost"), (0, 0, 1)))
sign_frame(P, SX, 0.44, SZ)
ffin(P, "Frame", wn=False)
sign_part(SX, 0.44, SZ)
# Paddle: origin on the vertical hinge at the back centre, the flap reaches to the front, the pin rises into the gate beam
z0 = 0.35
Q = [cz("barrel", 0.03, 0.372, 0.6, 0, HY, IRON, v=8),
cz("pin", 0.014, 0.6, Z_B + 0.115, 0, HY, STL, v=6)]
for za, zb in ((0.378, 0.482), (0.49, 0.594)):
Q.append(grain(bx(-0.026, 0.026, 0.13, HY - 0.012, za, zb, TIM, bev=0.01, name="flap"), (0, 1, 0)))
Q.append(bx(-0.032, 0.032, 0.1, 0.145, 0.374, 0.598, RED, bev=0.01, name="tip"))
for y, za, zb in ((0.34, 0.372, 0.6), (0.21, 0.372, 0.6)):
Q.append(box("strap", -0.03, 0.03, y - 0.016, y + 0.016, za, zb, IRON, bev=0))
for y in (0.34, 0.21):
for s in (-1, 1):
rivet(Q, (s * 0.03, y, 0.486), (s, 0, 0), r=0.012, h=0.006)
# a red pointer on top of the pin shows from above which way the flap is thrown
Q.append(prism("pointer", [(-0.018, 0.05), (0.018, 0.05), (0.018, -0.1), (0.05, -0.1), (0, -0.17), (-0.05, -0.1), (-0.018, -0.1)], "XY", Z_B + 0.1, Z_B + 0.115, PRED))
for o in Q[-1:]:
xf(o, t=(0, HY, 0))
fpart(Q, "Paddle", (0, HY, z0), wn=False)
return dict(elev=32, azim=-35)
def merger():
belt_surface({"back": -1, "front": 1, "left": -1, "right": -1})
P = []
junction_base(P)
# the funnel: two raked timber walls, leaning outward, narrowing to the way out. The side openings stay clear for a 0.4 m bundle
Z0, Z1 = 0.36, 0.62
XA, YA, XB, YB = 0.475, -0.235, 0.29, -0.485
LEAN = 0.03
for s in (-1, 1):
o = (s, 0, 0.5)
for za, zb, m_ in ((Z0, Z0 + 0.125, TIM), (Z0 + 0.135, Z1, RED)):
ka, kb = (za - Z0) / (Z1 - Z0) * LEAN, (zb - Z0) / (Z1 - Z0) * LEAN
a = (s * (XB + ka), YB, za)
b = (s * (XA + ka - LEAN), YA, za)
c = (s * (XA + kb - LEAN), YA, zb)
d = (s * (XB + kb), YB, zb)
P.append(slab(a, b, c, d, 0.03, o, m_, bev=0.005, name="guide"))
# stakes at both ends, an iron strap and rivets over the middle, the corner behind the boards decked over
for x_, y_ in ((0.468, -0.235), (0.315, -0.47)):
P.append(bx(s * x_ - 0.03, s * x_ + 0.03, y_ - 0.03, y_ + 0.03, 0.2, 0.67, TIM, bev=0.008, name="stake"))
P.append(bx(s * x_ - 0.033, s * x_ + 0.033, y_ - 0.033, y_ + 0.033, 0.64, 0.685, IRON, bev=0.005, name="stakecap"))
P.append(prism("deck", [(s * 0.43, -0.235), (s * 0.5, -0.235), (s * 0.5, -0.5), (s * 0.27, -0.5)], "XY", 0.345, 0.372, DECK))
P.append(beam((s * (XA - 0.012), YA, Z1 + 0.012), (s * (XB + 0.018), YB + 0.02, Z1 + 0.012), 0.044, 0.024, m=IRON, bev=0, name="gcap"))
mx, my = s * (XA + XB) / 2 + s * 0.012, (YA + YB) / 2
rivet(P, (mx, my, 0.42), (s, -0.6, 0), r=0.016)
rivet(P, (mx + s * 0.014, my, 0.55), (s, -0.6, 0), r=0.016)
# the sign on its short post at the +X back corner
SX, SZ = 0.35, 0.78
P.append(grain(bx(0.445, 0.485, 0.445, 0.485, 0.2, SZ + 0.1, TIM, bev=0.006, name="signpost"), (0, 0, 1)))
corner_stub(P, -0.465, 0.465)
sign_frame(P, SX, 0.44, SZ)
ffin(P, "Frame", wn=False)
sign_part(SX, 0.44, SZ)
return dict(elev=32, azim=-35)
BUILDERS = {
"SM_Vaporizer": dryer,
"SM_CryoPress": press,
"SM_Binder": binder,
"SM_BundleCatcher": catcher,
"SM_SolarPost": solar_post,
"SM_SolarPair": solar_pair,
"SM_SolarTracker": solar_tracker,
"SM_BatteryRack": rack,
"SM_BatteryBank": bank,
"SM_BeltSplitter": splitter,
"SM_BeltMerger": merger,
}
def main():
args = sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else []
names = args or list(BUILDERS)
views = os.environ.get("GC_VIEWS")
for n in names:
common.reset()
random.seed(sum(map(ord, n)))
res = BUILDERS[n]() or {}
total = 0
for o in bpy.context.scene.objects:
if o.type == "MESH":
t_ = tri_count([o])
total += t_
print(f" [{n}] {o.name:<10} tris={t_}")
print(f"TRIS|{n}|{total}")
if os.environ.get("GC_CULL"):
for m_ in bpy.data.materials:
m_.use_backface_culling = True
tb = bpy.data.materials.get(RUBBELT)
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
common.finish(n, **res)
if views:
old = common.PREVIEWS
common.PREVIEWS = views
preview(n + "_a", res=560, **res)
for tag, el, az in (("back", 25, 150), ("side", 14, 80), ("top", 62, -20)):
preview(n + "_" + tag, elev=el, azim=az, res=560)
preview(n + "_close", elev=res.get("elev", 24), azim=res.get("azim", -35), dist_mul=0.55, res=560)
preview(n + "_far", elev=res.get("elev", 24), azim=res.get("azim", -35), dist_mul=3.2, res=280)
common.PREVIEWS = old
if __name__ == "__main__":
main()