Files
NiemandKG d1c3761e58 Grass Cutters Together: the project as of moon-sweepers f3666f0
A clean start for the shared repository: the Unity project (Assets, Packages, ProjectSettings), ArtSource, Docs and
Tools as they stood at f3666f0 in the old local repository, with its generated prefabs and scene brought up to date.
Images, audio, models and binaries go through Git LFS (.gitattributes).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 18:44:40 +06:00

1400 lines
71 KiB
Python

"""GRASS CUTTER - rig machines: hopper, filler, vaporizer, cryo press, edge pump, water tank, drone hub, rain drone.
Authored directly in Blender space: metres, Z up, front = -Y (Unity +Z), pivot at bottom centre on the deck (z = 0).
Footprints are 1 m grid cells centred on the origin (2x2 -> x,y in [-1, 1]; pump 1x2 -> x in [-0.5, 0.5], y in [-1, 1]).
Run (from project root):
blender -b --factory-startup --python ArtSource/Blender/scripts/os_machines.py -- [SM_Hopper SM_Filler ...]
Set OS_VIEWS=<dir> to also render extra review angles into that directory.
"""
import sys, os
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import common
from common import *
W, OR, TE, DG, RB, ST, GL, HZ = "M_HullWhite", "M_PaintOrange", "M_Teal", "M_DarkGrey", "M_Rubber", "M_Steel", "M_Glass", "M_Hazard"
BR, NV, WF, GF = "M_Brass", "M_Navy", "M_WaterFill", "M_GaugeFace"
PI = math.pi
FONT = None
# ======================================================================= primitives
def box(name, x0, x1, y0, y1, z0, z1, m, bev=0.02, segs=2):
return rbox(name, (x1 - x0, y1 - y0, z1 - z0), ((x0 + x1) / 2, (y0 + y1) / 2, (z0 + z1) / 2), bevel=bev, segs=segs, m=m)
def cz(name, r, z0, z1, x=0.0, y=0.0, m=ST, v=24, bev=0.0, segs=2, r2=None, cap=True):
return cyl(name, r, z1 - z0, (x, y, (z0 + z1) / 2), "Z", verts=v, bevel=bev, segs=segs, m=m, r2=r2, cap=cap)
def cx(name, r, x0, x1, y, z, m=ST, v=20, bev=0.0, segs=2):
return cyl(name, r, x1 - x0, ((x0 + x1) / 2, y, z), "X", verts=v, bevel=bev, segs=segs, m=m)
def cy(name, r, y0, y1, x, z, m=ST, v=20, bev=0.0, segs=2):
return cyl(name, r, y1 - y0, (x, (y0 + y1) / 2, z), "Y", verts=v, bevel=bev, segs=segs, m=m)
def xf(o, rx=0.0, ry=0.0, rz=0.0, t=(0, 0, 0), s=None):
o.rotation_mode = "XYZ"
o.rotation_euler = (rx, ry, rz)
o.location = t
if s is not None:
o.scale = s
apply_xform(o)
o.scale = (1, 1, 1)
return o
FACING = {"+Z": (0, 0), "-Z": (PI, 0), "-Y": (PI / 2, 0), "+X": (PI / 2, PI / 2), "-X": (PI / 2, -PI / 2), "+Y": (PI / 2, PI)}
def orient(o, facing="-Y", t=(0, 0, 0), spin=0.0):
"""o is built facing +Z (its 'up' on the face is +Y). facing: key of FACING or an angle (deg) of the outward
normal in the XY plane (0 = +X, -90 = -Y). spin rotates about the local normal first."""
if spin:
xf(o, rz=spin)
if isinstance(facing, str):
rx, rz = FACING[facing]
else:
rx, rz = PI / 2, math.radians(facing) + PI / 2
return xf(o, rx=rx, rz=rz, t=t)
def basis(d):
d = Vector(d).normalized()
ref = Vector((0, 0, 1)) if abs(d.z) < 0.9 else Vector((1, 0, 0))
u = (ref - d * ref.dot(d)).normalized()
return d, u, d.cross(u)
def cyl_between(name, p0, p1, r, m, v=16, bev=0.0, r2=None, cap=True, segs=1):
p0, p1 = Vector(p0), Vector(p1)
d = p1 - p0
L = d.length
o = cyl(name, r, L, (0, 0, L / 2), "Z", verts=v, bevel=bev, segs=segs, m=m, r2=r2, cap=cap)
o.rotation_mode = "QUATERNION"
o.rotation_quaternion = d.normalized().to_track_quat("Z", "Y")
o.location = p0
apply_xform(o)
o.rotation_mode = "XYZ"
o.rotation_euler = (0, 0, 0)
return o
def prism(name, pts, plane, d0, d1, m, bev=0.0, bsegs=1):
"""Polygon extruded. 'XZ': pts (x, z) along Y; 'YZ': pts (y, z) along X; 'XY': pts (x, y) along Z."""
def P(a, b, d):
return {"XZ": (a, d, b), "YZ": (d, a, b), "XY": (a, b, d)}[plane]
bm = bmesh.new()
f0 = [bm.verts.new(P(a, b, d0)) for a, b in pts]
f1 = [bm.verts.new(P(a, b, d1)) for a, b in pts]
caps = [bm.faces.new(f0), bm.faces.new(list(reversed(f1)))]
n = len(pts)
for i in range(n):
j = (i + 1) % n
bm.faces.new((f0[i], f0[j], f1[j], f1[i]))
if n > 4:
bmesh.ops.triangulate(bm, faces=caps)
bmesh.ops.recalc_face_normals(bm, faces=bm.faces)
o = mesh_obj(name, bm)
set_mats(o, m)
if bev > 0:
b = o.modifiers.new("bev", "BEVEL")
b.width = bev
b.segments = bsegs
b.limit_method = "ANGLE"
b.angle_limit = math.radians(30)
bake(o)
return o
def rrect(cx_, cy_, w, h, r, n=2):
x0, x1, y0, y1 = cx_ - w / 2, cx_ + w / 2, cy_ - h / 2, cy_ + h / 2
r = min(r, w / 2 - 1e-4, h / 2 - 1e-4)
pts = []
for (ccx, ccy, a0) in ((x1 - r, y0 + r, 270), (x1 - r, y1 - r, 0), (x0 + r, y1 - r, 90), (x0 + r, y0 + r, 180)):
for i in range(n + 1):
a = math.radians(a0 + 90 * i / n)
pts.append((ccx + r * math.cos(a), ccy + r * math.sin(a)))
return pts
def plate(name, w, h, t, m, r=0.03, bev=0.006):
"""Rounded-rect plate in XY (facing +Z, thickness t from z=0). Use orient() to place."""
return prism(name, rrect(0, 0, w, h, r), "XY", 0, t, m, bev=bev)
def revm(name, prof, mats, segs=32, loc=(0, 0, 0), closed=False, cap_top=False, cap_bot=False, a0=0.0, a1=360.0):
"""Revolve with one material per profile edge. prof: (r, z) list; mats: list (len = edges) or a single name."""
if isinstance(mats, str):
mats = [mats] * (len(prof) - (0 if closed else 1))
full = abs(a1 - a0) >= 359.9
nseg = segs if full else segs + 1
bm = bmesh.new()
rings = []
for (r, z) in prof:
if r <= 1e-6:
rings.append([bm.verts.new((0, 0, z))])
else:
rings.append([bm.verts.new((r * math.cos(math.radians(a0 + (a1 - a0) * i / segs)),
r * math.sin(math.radians(a0 + (a1 - a0) * i / segs)), z)) for i in range(nseg)])
uniq = []
for mm in mats:
if mm not in uniq:
uniq.append(mm)
pairs = list(zip(rings, rings[1:]))
if closed:
pairs.append((rings[-1], rings[0]))
nquads = segs if full else segs
for k, (a, b) in enumerate(pairs):
mi = uniq.index(mats[k])
fs = []
if len(a) == 1 and len(b) == 1:
continue
if len(a) == 1:
for i in range(nquads):
fs.append(bm.faces.new((a[0], b[i], b[(i + 1) % nseg])))
elif len(b) == 1:
for i in range(nquads):
fs.append(bm.faces.new((a[i], a[(i + 1) % nseg], b[0])))
else:
for i in range(nquads):
fs.append(bm.faces.new((a[i], a[(i + 1) % nseg], b[(i + 1) % nseg], b[i])))
for f in fs:
f.material_index = mi
if closed and not full and all(len(r_) > 1 for r_ in rings):
for idx in (0, nseg - 1):
f = bm.faces.new([r_[idx] for r_ in rings])
f.material_index = uniq.index(mats[0])
if cap_top and len(rings[-1]) > 1:
f = bm.faces.new(rings[-1])
f.material_index = uniq.index(mats[-1])
if cap_bot and len(rings[0]) > 1:
f = bm.faces.new(list(reversed(rings[0])))
f.material_index = uniq.index(mats[0])
bmesh.ops.recalc_face_normals(bm, faces=bm.faces)
bmesh.ops.translate(bm, vec=Vector(loc), verts=bm.verts)
me = bpy.data.meshes.new(name)
for mm in uniq:
me.materials.append(mat(mm)) # add slots first: materials.clear() would reset the indices
bm.to_mesh(me)
bm.free()
return link(bpy.data.objects.new(name, me))
def arc_band(name, r0, r1, z0, z1, a0, a1, m, segs=16, c=(0.0, 0.0)):
"""Annular sector solid around Z, angles in degrees from +X (CCW)."""
full = abs(a1 - a0) >= 359.9
n = segs if full else segs + 1
bm = bmesh.new()
rows = []
for i in range(n):
a = math.radians(a0 + (a1 - a0) * i / segs)
ca, sa = math.cos(a), math.sin(a)
rows.append([bm.verts.new((c[0] + r * ca, c[1] + r * sa, z)) for (r, z) in ((r0, z0), (r1, z0), (r1, z1), (r0, z1))])
for i in range(n if full else n - 1):
a, b = rows[i], rows[(i + 1) % n]
for k in range(4):
bm.faces.new((a[k], b[k], b[(k + 1) % 4], a[(k + 1) % 4]))
if not full:
bm.faces.new(rows[0])
bm.faces.new(list(reversed(rows[-1])))
bmesh.ops.recalc_face_normals(bm, faces=bm.faces)
o = mesh_obj(name, bm)
set_mats(o, m)
return o
def wrap_cyl(o, R, a0, c=(0.0, 0.0), step=None):
"""o built as a front decal (surface plane y=0, outward = -Y, x right, z up). Wraps it onto a vertical
cylinder of radius R centred at c, the decal centre (x=0) landing at angle a0 (deg)."""
apply_xform(o)
if step:
bm = bmesh.new()
bm.from_mesh(o.data)
xs = [v.co.x for v in bm.verts]
x = min(xs) + step
while x < max(xs):
g = bm.verts[:] + bm.edges[:] + bm.faces[:]
bmesh.ops.bisect_plane(bm, geom=g, plane_co=(x, 0, 0), plane_no=(1, 0, 0))
x += step
bm.to_mesh(o.data)
bm.free()
for v in o.data.vertices:
x, y, z = v.co
a = math.radians(a0) + x / R
rr = R - y
v.co = (c[0] + rr * math.cos(a), c[1] + rr * math.sin(a), z)
o.data.update()
return o
def ptube(name, path, r, m, segs=12, caps=True, rfun=None):
"""Swept circular tube along a polyline (rotation-minimising frames)."""
pts = [Vector(p) for p in path]
n = len(pts)
tans = []
for i in range(n):
if i == 0:
t = pts[1] - pts[0]
elif i == n - 1:
t = pts[-1] - pts[-2]
else:
t = (pts[i + 1] - pts[i]).normalized() + (pts[i] - pts[i - 1]).normalized()
tans.append(t.normalized())
_, nrm, _ = basis(tans[0])
bm = bmesh.new()
rings = []
for i, (p, t) in enumerate(zip(pts, tans)):
nrm = (nrm - t * nrm.dot(t)).normalized()
b = t.cross(nrm)
rr = rfun(i) if rfun else r
rings.append([bm.verts.new(p + (nrm * math.cos(2 * PI * k / segs) + b * math.sin(2 * PI * k / segs)) * rr) for k in range(segs)])
for a, b in zip(rings, rings[1:]):
for k in range(segs):
bm.faces.new((a[k], a[(k + 1) % segs], b[(k + 1) % segs], b[k]))
if caps:
bm.faces.new(list(reversed(rings[0])))
bm.faces.new(rings[-1])
bmesh.ops.recalc_face_normals(bm, faces=bm.faces)
o = mesh_obj(name, bm)
set_mats(o, m)
return o
def rpath(corners, rad=0.1, n=5):
"""Polyline with rounded corners (quadratic bezier fillets)."""
c = [Vector(p) for p in corners]
out = [c[0]]
for i in range(1, len(c) - 1):
a, p, b = c[i - 1], c[i], c[i + 1]
ra = min(rad, (a - p).length * 0.5)
rb = min(rad, (b - p).length * 0.5)
p0 = p + (a - p).normalized() * ra
p2 = p + (b - p).normalized() * rb
for k in range(n + 1):
t = k / n
out.append(p0 * (1 - t) ** 2 + p * 2 * t * (1 - t) + p2 * t * t)
out.append(c[-1])
return out
def resample(path, step):
pts = [Vector(p) for p in path]
out = [pts[0]]
for a, b in zip(pts, pts[1:]):
L = (b - a).length
k = max(1, int(round(L / step)))
for i in range(1, k + 1):
out.append(a + (b - a) * (i / k))
return out
def hose(name, path, r, m=RB, step=0.035, segs=10, rad=0.12):
"""Corrugated flexible hose."""
pts = resample(rpath(path, rad, 6), step)
return ptube(name, pts, r, m, segs=segs, rfun=lambda i: r * (1.0 if i % 2 == 0 else 0.86))
def blob(name, r, loc, m="M_Frost", scale=(1, 1, 0.5), seg=8, rings=5, jitter=0.18):
o = sphere(name, r, (0, 0, 0), seg=seg, rings=rings, m=m, scale=scale)
for v in o.data.vertices:
k = 1.0 + random.uniform(-jitter, jitter)
v.co *= k
xf(o, t=loc)
return o
def text(name, s, size, m, ext=0.0, font=None):
global FONT
cu = bpy.data.curves.new(name, "FONT")
cu.body = s
cu.size = size
cu.align_x = "CENTER"
cu.align_y = "CENTER"
cu.resolution_u = 2
cu.extrude = ext
fp = font or "C:/Windows/Fonts/bahnschrift.ttf"
if os.path.exists(fp):
try:
cu.font = bpy.data.fonts.load(fp, check_existing=True)
except Exception:
pass
o = link(bpy.data.objects.new(name, cu))
o2 = to_mesh(o)
set_mats(o2, m)
return o2
# ======================================================================= greebles
def bolt(P, p, facing="-Y", r=0.016, h=0.012, m=ST):
o = cyl("bolt", r, h, (0, 0, h / 2), "Z", verts=6, m=m)
P.append(orient(o, facing, p))
def bolt_ring(P, n, R, z, r=0.018, h=0.016, m=ST, c=(0, 0), a0=0.0):
for k in range(n):
a = math.radians(a0 + 360.0 * k / n)
P.append(cyl("bolt", r, h, (c[0] + R * math.cos(a), c[1] + R * math.sin(a), z + h / 2), "Z", verts=6, m=m))
def flange(P, p, d, r, t=0.04, nb=5, m=ST, bm_=ST):
p, (d, u, v) = Vector(p), basis(d)
P.append(cyl_between("flange", p - d * t / 2, p + d * t / 2, r, m, v=16, bev=0.006))
for k in range(nb):
a = 2 * PI * (k + 0.5) / nb
q = p + (u * math.cos(a) + v * math.sin(a)) * r * 0.76
P.append(cyl_between("fbolt", q - d * (t / 2 + 0.012), q + d * (t / 2 + 0.012), 0.016, bm_, v=6))
def pipe(P, corners, r, m=ST, rad=0.16, segs=14, fl=None, fl_r=None, n=6):
"""Rigid pipe through corners with rounded bends; optional flanges at the ends ('a', 'b', 'ab')."""
path = rpath(corners, rad, n)
P.append(ptube("pipe", path, r, m, segs=segs))
fr = fl_r or r * 1.55
if fl and "a" in fl:
flange(P, path[0] + (path[1] - path[0]).normalized() * 0.02, path[1] - path[0], fr)
if fl and "b" in fl:
flange(P, path[-1] + (path[-2] - path[-1]).normalized() * 0.02, path[-1] - path[-2], fr)
return path
def gauge(P, c, facing="-Y", r=0.09, bez=ST, stem=0.0, red=True, needle=35.0):
G = []
G.append(revm("gbody", [(r * 0.8, -0.03), (r * 1.08, -0.004), (r * 1.08, 0.022), (r * 0.98, 0.034), (r * 0.9, 0.026)],
bez, segs=16, cap_top=True, cap_bot=True))
G.append(cyl("gface", r * 0.9, 0.004, (0, 0, 0.028), "Z", verts=16, m=GF))
for k in range(7):
a = math.radians(225 - k * 270 / 6)
long_ = k % 2 == 0
rr0, rr1 = r * (0.6 if long_ else 0.68), r * 0.8
mm = "M_PaintRed" if (red and k >= 5) else DG
t = box("tick", -0.0045, 0.0045, rr0, rr1, 0.029, 0.033, mm, bev=0)
xf(t, rz=a - PI / 2)
G.append(t)
nd = box("needle", -0.006, 0.006, -r * 0.12, r * 0.7, 0.032, 0.038, "M_PaintRed", bev=0)
xf(nd, rz=math.radians(-needle))
G.append(nd)
G.append(cyl("gpin", r * 0.12, 0.012, (0, 0, 0.036), "Z", verts=10, m=DG))
G.append(revm("gglass", [(r * 0.92, 0.03), (r * 0.8, 0.044), (r * 0.45, 0.052), (0, 0.054)], GL, segs=16))
if stem > 0:
G.append(cyl("gstem", 0.018, stem, (0, 0, -0.03 - stem / 2), "Z", verts=8, m=BR if bez == BR else ST))
G.append(cyl("gnut", 0.03, 0.025, (0, 0, -0.03 - stem * 0.6), "Z", verts=6, m=BR if bez == BR else ST))
for o in G:
P.append(orient(o, facing, c))
def handwheel(P, c, facing="-Y", R=0.09, m="M_PaintRed", stem=0.05):
G = [torus("wheel", R, R * 0.16, (0, 0, 0), "Z", seg=16, rseg=5, m=m),
cyl("whub", R * 0.28, 0.04, (0, 0, -0.005), "Z", verts=12, m=m),
cyl("wstem", R * 0.14, stem, (0, 0, -stem / 2), "Z", verts=8, m=ST)]
for k in range(3):
sp = box("spoke", -R * 0.07, R * 0.07, 0, R, -R * 0.06, R * 0.06, m, bev=0)
xf(sp, rz=2 * PI * k / 3)
G.append(sp)
for o in G:
P.append(orient(o, facing, c))
def lamp(P, x, y, z, m="M_LightGreen", r=0.065, cage=True):
"""Status beacon: dark base joins the body, the glowing dome is the 'Lamp' child (origin at its base)."""
P.append(cz("lbase", r * 1.3, z, z + 0.035, x, y, DG, v=16, bev=0.01, segs=1))
P.append(cz("lring", r * 1.08, z + 0.035, z + 0.05, x, y, ST, v=16))
if cage:
P.append(torus("lcage", r * 1.12, 0.007, (x, y, z + 0.1), "Z", seg=16, rseg=4, m=DG))
for k in range(4):
a = PI / 4 + k * PI / 2
P.append(ptube("lwire", [(x + r * 1.12 * math.cos(a), y + r * 1.12 * math.sin(a), z + 0.05),
(x + r * 1.12 * math.cos(a), y + r * 1.12 * math.sin(a), z + 0.1),
(x + r * 0.7 * math.cos(a), y + r * 0.7 * math.sin(a), z + 0.155),
(x, y, z + 0.17)], 0.006, DG, segs=4))
lo = revm("Lamp", [(0, 0.05), (r, 0.05), (r, 0.08), (r * 0.94, 0.11), (r * 0.75, 0.14), (r * 0.42, 0.158), (0, 0.162)], m, segs=16)
xf(lo, t=(x, y, z))
set_origin(lo, (x, y, z + 0.05))
lo.name = "Lamp"
uv_box(lo, 4.0)
smooth(lo, 60)
return lo
def drop_pts(R, cx_=0.0, cy_=0.0, h=1.75, n=14):
"""Water drop outline (CCW), circle radius R at (cx, cy), tip at cy + h*R."""
tip = h * R
ac = math.degrees(math.acos(R / tip))
t1, t2 = 90 - ac, 90 + ac
pts = [(cx_, cy_ + tip)]
for i in range(n + 1):
a = math.radians(t2 + (t1 + 360 - t2) * i / n)
pts.append((cx_ + R * math.cos(a), cy_ + R * math.sin(a)))
return pts
def chevron_down(cx_, cy_, w, h, t):
"""Downward pointing chevron outline (x, y)."""
return [(cx_ - w, cy_ + h), (cx_, cy_), (cx_ + w, cy_ + h), (cx_ + w, cy_ + h + t), (cx_, cy_ + t), (cx_ - w, cy_ + h + t)]
def decal(pts, d0, d1, m, name="decal"):
"""Front decal (outward -Y) from (x, z) points, depth from y=-d0 to y=-d1."""
return prism(name, pts, "XZ", -d1, -d0, m)
def barrel_icon(P, c, facing, s=1.0, base=TE, ink="M_PaintWhite"):
"""Stencilled barrel pictogram on a rounded plate (built facing -Y at the origin, then oriented)."""
G = [plate("ibase", 0.36 * s, 0.46 * s, 0.012, base, r=0.05 * s)]
G[-1] = xf(G[-1], rx=PI / 2) # +Z plate -> facing -Y
G.append(decal(rrect(0, 0, 0.2 * s, 0.3 * s, 0.035 * s), 0.012, 0.018, ink))
for zz in (-0.075, 0.075):
G.append(decal(rrect(0, zz * s, 0.23 * s, 0.03 * s, 0.012 * s, n=1), 0.012, 0.02, ink))
G.append(decal(drop_pts(0.035 * s, 0, -0.02 * s, n=8), 0.018, 0.022, base))
G.append(decal(rrect(0.05 * s, 0.155 * s, 0.05 * s, 0.025 * s, 0.006 * s), 0.012, 0.02, ink))
for o in G:
rx, rz = (0, 0) if facing == "-Y" else (0, {"+X": PI / 2, "-X": -PI / 2, "+Y": PI}[facing] if isinstance(facing, str) else math.radians(facing) + PI / 2)
P.append(xf(o, rz=rz, t=c))
def louvres(P, c, facing, w, n, gap=0.05, m=DG):
G = [plate("lframe", w + 0.06, n * gap + 0.05, 0.01, m, r=0.02, bev=0)]
for k in range(n):
z = -n * gap / 2 + (k + 0.5) * gap
sl = box("slat", -w / 2, w / 2, -0.006, 0.006, -0.016, 0.016, ST, bev=0)
xf(sl, rx=math.radians(-35), t=(0, z, 0.02))
G.append(sl)
for o in G:
P.append(orient(o, facing, c))
def roller_chute(P0, y0, y1, w, z_top, legs=(), m_rail=OR, n=None, front_bump=True, xo=0.0):
"""Roller conveyor running along Y from y0 (back) to y1 (front, more negative). z_top = roller top."""
P = []
rr = 0.042
zc = z_top - rr
L = y0 - y1
n = n or max(3, int(L / 0.13))
for k in range(n):
y = y1 + 0.07 + (L - 0.12) * k / (n - 1)
P.append(cx("roller", rr, -w / 2, w / 2, y, zc, ST, v=12))
for s in (-1, 1):
xi, xo = s * (w / 2 + 0.015), s * (w / 2 + 0.07)
P.append(box("rail", min(xi, xo), max(xi, xo), y1, y0, zc - 0.11, z_top + 0.07, m_rail, bev=0.018, segs=2))
P.append(box("railtop", min(xi, xo) - 0.004, max(xi, xo) + 0.004, y1 + 0.02, y0 - 0.02, z_top + 0.055, z_top + 0.085, RB, bev=0.012, segs=1))
if front_bump:
P.append(cy("bump", 0.035, y1 + 0.002, y1 + 0.06, s * (w / 2 + 0.042), zc - 0.02, RB, v=10))
for y in legs:
P.append(box("cleg", min(xi, xo) + 0.005, max(xi, xo) - 0.005, y - 0.03, y + 0.03, 0.0, zc - 0.1, DG, bev=0.012, segs=1))
P.append(box("cfoot", min(xi, xo) - 0.02, max(xi, xo) + 0.02, y - 0.06, y + 0.06, 0.0, 0.025, DG, bev=0.008, segs=1))
P.append(box("pan", -w / 2, w / 2, y1 + 0.03, y0, zc - 0.09, zc - 0.07, DG, bev=0.005, segs=1))
for y in legs:
P.append(box("cross", -w / 2, w / 2, y - 0.02, y + 0.02, zc - 0.16, zc - 0.11, DG, bev=0.008, segs=1))
for o in P:
P0.append(xf(o, t=(xo, 0, 0)))
def deck_flange(P, x, y, r, nb=6, m=DG):
P.append(cz("dflange", r, 0.0, 0.035, x, y, m, v=16, bev=0.01))
bolt_ring(P, nb, r * 0.78, 0.035, r=0.014, h=0.012, c=(x, y), a0=30)
def skid(P, x0, x1, y0, y1, h=0.12, haz_front=True):
P.append(box("skid", x0, x1, y0, y1, 0.0, h, DG, bev=0.035, segs=2))
if haz_front:
P.append(box("skidhaz", x0 + 0.06, x1 - 0.06, y0 - 0.006, y0 + 0.02, 0.025, h - 0.025, HZ, bev=0))
for (x, y) in ((x0 + 0.07, y0 + 0.07), (x1 - 0.07, y0 + 0.07), (x0 + 0.07, y1 - 0.07), (x1 - 0.07, y1 - 0.07)):
bolt(P, (x, y, h), "+Z", r=0.02, h=0.014)
def fin(P, name, uv=1.0, haz=3.0, ang=35, wn=True):
o = join(P, name)
me = o.data
names = [m.name if m else "" for m in me.materials]
bm = bmesh.new()
bm.from_mesh(me)
uvl = bm.loops.layers.uv.verify()
for f in bm.faces:
nm = names[f.material_index] if f.material_index < len(names) else ""
sc = haz if nm == HZ else uv
n = f.normal
ax = max(range(3), key=lambda i: abs(n[i]))
for l in f.loops:
p = l.vert.co
if ax == 0:
u, v = (p.y if n.x > 0 else -p.y), p.z
elif ax == 1:
u, v = (-p.x if n.y > 0 else p.x), p.z
else:
u, v = p.x, (p.y if n.z > 0 else -p.y)
l[uvl].uv = (u * sc, v * sc)
bm.to_mesh(me)
bm.free()
smooth(o, ang)
if wn:
weighted(o)
return o
def part(P, name, origin, **kw):
o = fin(P, name, **kw)
set_origin(o, origin)
return o
# ======================================================================= 1. hopper
def hopper():
P = []
# central deck plinth with a hazard dash ring
P.append(revm("base", [(0, 0.06), (0.4, 0.06), (0.43, 0.045), (0.43, 0.015), (0.41, 0.0)], DG, segs=32))
for k in range(12):
a = k * 30
P.append(arc_band("dash", 0.31, 0.39, 0.059, 0.066, a + 3, a + 18, OR if k % 2 == 0 else "M_PaintWhite", segs=3))
# funnel: one closed revolve (outer white, rolled orange lip, dark inner)
prof = [(0.17, 0.40), (0.19, 0.45), (0.24, 0.5), (0.6, 0.84), (0.625, 0.875), (0.64, 0.9), (0.66, 1.03),
(0.69, 1.04), (0.715, 1.062), (0.718, 1.09), (0.698, 1.113), (0.656, 1.124), (0.616, 1.108),
(0.606, 1.08), (0.59, 0.9), (0.565, 0.865), (0.215, 0.55), (0.15, 0.52), (0.12, 0.48)]
mats = [W] * 6 + [OR] * 7 + [DG] * 6
P.append(revm("funnel", prof, mats, segs=36, closed=True))
# cone stripes + collar rib
P.append(revm("cband", [(0.47, 0.715), (0.52, 0.76), (0.535, 0.765), (0.485, 0.72)], TE, segs=36, closed=True))
P.append(revm("cband", [(0.34, 0.6), (0.375, 0.632), (0.39, 0.637), (0.355, 0.605)], OR, segs=36, closed=True))
P.append(revm("rib", [(0.6, 0.83), (0.632, 0.85), (0.645, 0.875), (0.64, 0.9)], OR, segs=36))
# inner guide ribs + teal level ring
for k in range(6):
aa = math.radians(k * 60)
ca, sa = math.cos(aa), math.sin(aa)
P.append(ptube("irib", [(0.545 * ca, 0.545 * sa, 0.87), (0.215 * ca, 0.215 * sa, 0.575)], 0.014, ST, segs=6))
P.append(revm("iring", [(0.433, 0.76), (0.44, 0.75), (0.462, 0.77), (0.455, 0.78)], TE, segs=36, closed=True))
# throat grate
P.append(torus("grring", 0.135, 0.016, (0, 0, 0.532), "Z", seg=18, rseg=6, m=ST))
for k in range(2):
g = box("grbar", -0.14, 0.14, -0.013, 0.013, 0.515, 0.545, ST, bev=0.006, segs=1)
xf(g, rz=PI / 4 + k * PI / 2)
P.append(g)
P.append(cz("grhub", 0.04, 0.51, 0.555, m=DG, v=12, bev=0.01))
# downpipe into the deck
P.append(cz("downpipe", 0.15, 0.06, 0.44, v=24, m=ST))
P.append(cz("coupler", 0.19, 0.2, 0.27, v=24, m=TE, bev=0.015))
bolt_ring(P, 6, 0.165, 0.27, r=0.015, h=0.012)
P.append(cz("dflange", 0.22, 0.06, 0.1, v=24, m=DG, bev=0.01))
bolt_ring(P, 6, 0.185, 0.1, r=0.014, h=0.012, a0=30)
# drain valve stub
pipe(P, [(0.12, 0, 0.15), (0.32, 0, 0.15)], 0.042, ST, fl="b", fl_r=0.065)
handwheel(P, (0.4, 0, 0.15), "+X", R=0.07, stem=0.06)
# legs: 4 stubby legs with brackets, rubber feet and bolts
for k in range(4):
a = math.radians(45 + 90 * k)
ca, sa = math.cos(a), math.sin(a)
top = (0.585 * ca, 0.585 * sa, 0.8)
knee = (0.74 * ca, 0.74 * sa, 0.5)
foot = (0.76 * ca, 0.76 * sa, 0.08)
P.append(ptube("leg", rpath([top, knee, foot], 0.12, 5), 0.05, W, segs=12))
P.append(cyl_between("legband", (0.755 * ca, 0.755 * sa, 0.26), (0.758 * ca, 0.758 * sa, 0.34), 0.06, OR, v=16))
br = box("bracket", -0.075, 0.075, -0.03, 0.03, -0.06, 0.06, OR, bev=0.02, segs=2)
xf(br, rz=a + PI / 2, t=(0.625 * ca, 0.625 * sa, 0.8))
P.append(br)
P.append(revm("foot", [(0, 0.0), (0.11, 0.0), (0.12, 0.02), (0.11, 0.045), (0.07, 0.06), (0.055, 0.1), (0, 0.1)],
[RB, RB, RB, RB, DG, DG], segs=16, loc=(foot[0], foot[1], 0)))
bolt_ring(P, 3, 0.09, 0.04, r=0.012, h=0.012, c=(foot[0], foot[1]), a0=k * 30 + 15)
# sight gauge on the front-left (glass tube with water inside)
ga = math.radians(235)
gx, gy = 0.8 * math.cos(ga), 0.8 * math.sin(ga)
z0, z1 = 0.3, 0.96
P.append(cz("sgcap", 0.048, z0 - 0.06, z0 + 0.01, gx, gy, ST, v=12, bev=0.01))
P.append(cz("sgcap", 0.048, z1 - 0.01, z1 + 0.06, gx, gy, ST, v=12, bev=0.01))
P.append(cz("sgglass", 0.034, z0, z1, gx, gy, GL, v=14))
P.append(cz("sgwater", 0.025, z0, 0.72, gx, gy, WF, v=10))
P.append(cz("sgball", 0.02, 0.70, 0.74, gx, gy, OR, v=10))
for s in (-1, 1):
o = PI / 2 * s
P.append(cz("sgguard", 0.008, z0, z1, gx + 0.048 * math.cos(ga + o), gy + 0.048 * math.sin(ga + o), ST, v=6))
for k in range(6):
z = z0 + 0.08 + k * 0.1
tk = box("sgtick", -0.004, 0.004, -0.018, 0.018, -0.003, 0.003, OR if k < 5 else "M_PaintRed", bev=0)
xf(tk, rz=ga, t=(gx + 0.044 * math.cos(ga + PI / 2), gy + 0.044 * math.sin(ga + PI / 2), z))
P.append(tk)
pipe(P, [(gx, gy, z0 - 0.06), (gx, gy, 0.16), (0.14 * math.cos(ga), 0.14 * math.sin(ga), 0.16)], 0.022, ST, rad=0.06, segs=10)
pipe(P, [(gx, gy, z1 + 0.06), (gx, gy, 0.99), (0.64 * math.cos(ga), 0.64 * math.sin(ga), 0.99)], 0.022, ST, rad=0.06, segs=10)
# front collar: "DROP WATER" stencil + down chevrons, drops on the flanks
t = text("label", "DROP GRASS", 0.075, DG)
orient(t, "-Y", (0, -0.002, 0.968))
P.append(wrap_cyl(t, 0.65, -90))
for xx in (-0.31, 0.31):
for k in range(2):
d = decal(chevron_down(xx, 0.915 + k * 0.045, 0.04, 0.032, 0.02), 0.0, 0.006, OR)
P.append(wrap_cyl(d, 0.645, -90, step=0.03))
for ang in (30, 150):
d = decal(drop_pts(0.04, 0, 0.94), 0.0, 0.007, TE)
P.append(wrap_cyl(d, 0.65, ang, step=0.03))
# pipe gauge
gauge(P, (0, -0.24, 0.36), "-Y", r=0.065, stem=0.07, bez=ST)
fin(P, "Body", uv=1.0)
empty("Mouth", (0, 0, 1.1))
return dict(elev=30, azim=-35)
# ======================================================================= 2. filler
def filler():
P = []
FX = -0.5 # nozzle + chute sit on one 1 m grid lane, so barrels roll straight onto a belt cell
skid(P, -0.95, 0.95, -0.12, 0.95)
ZT = 1.7 # cabinet top
# cabinet
P.append(box("cab", -0.8, 0.8, 0.05, 0.82, 0.12, ZT, W, bev=0.09, segs=3))
P.append(box("cabbase", -0.82, 0.82, 0.03, 0.84, 0.12, 0.26, DG, bev=0.04, segs=2))
P.append(box("crown", -0.84, 0.84, 0.01, 0.86, ZT - 0.05, ZT + 0.09, OR, bev=0.06, segs=3))
P.append(box("crownseam", -0.83, 0.83, 0.02, 0.85, ZT - 0.08, ZT - 0.04, DG, bev=0.015, segs=1))
# front panel (raised) + teal band
P.append(box("fpanel", -0.7, 0.7, 0.02, 0.06, 0.3, ZT - 0.14, W, bev=0.025, segs=2))
P.append(box("fband", -0.7, 0.7, 0.012, 0.03, ZT - 0.3, ZT - 0.25, TE, bev=0.006, segs=1))
# filling bay recess behind the nozzle (dark)
P.append(box("bay", FX - 0.29, FX + 0.29, 0.0, 0.03, 0.55, 1.36, DG, bev=0.03, segs=2))
for zz in (0.78, 1.02):
P.append(box("baystrip", FX - 0.24, FX + 0.24, -0.006, 0.01, zz, zz + 0.025, ST, bev=0.006, segs=1))
# side panels
for s in (-1, 1):
x = s * 0.8
fc = "+X" if s > 0 else "-X"
P.append(box("spanel", min(x, x + s * 0.03), max(x, x + s * 0.03), 0.14, 0.74, 0.32, ZT - 0.16, W, bev=0.025, segs=2))
barrel_icon(P, (x + s * 0.03, 0.44, 1.05), fc, s=1.15)
louvres(P, (x + s * 0.03, 0.44, 0.5), fc, 0.44, 4)
for (yy, zz) in ((0.18, 0.36), (0.7, 0.36), (0.18, ZT - 0.2), (0.7, ZT - 0.2)):
bolt(P, (x + s * 0.03, yy, zz), fc)
# back: service panel, vent and warning plate
P.append(box("bpanel", -0.68, 0.4, 0.8, 0.85, 0.32, ZT - 0.16, W, bev=0.025, segs=2))
louvres(P, (-0.14, 0.85, 1.25), "+Y", 0.7, 5)
wp = plate("warn", 0.34, 0.2, 0.01, HZ, r=0.03)
P.append(orient(wp, "+Y", (-0.14, 0.85, 0.62)))
wp2 = plate("warn2", 0.26, 0.12, 0.012, "M_PaintWhite", r=0.02)
P.append(orient(wp2, "+Y", (-0.14, 0.855, 0.62)))
t = text("label", "BALE-O-MATIC", 0.04, DG)
P.append(orient(t, "+Y", (-0.14, 0.869, 0.62)))
for (xx, zz) in ((-0.62, 0.38), (0.34, 0.38), (-0.62, ZT - 0.22), (0.34, ZT - 0.22)):
bolt(P, (xx, 0.85, zz), "+Y")
# gauges on the front
gauge(P, (0.2, 0.0, 1.27), "-Y", r=0.1)
gauge(P, (0.53, 0.0, 1.27), "-Y", r=0.1, needle=-20)
# front name plate
t = text("label", "BALE-O-MATIC", 0.065, "M_PaintWhite")
P.append(box("nplate", -0.62, -0.18, -0.002, 0.03, ZT - 0.03, ZT + 0.07, NV, bev=0.015, segs=1))
P.append(orient(t, "-Y", (-0.4, -0.005, ZT + 0.02)))
# control panel (right) + buttons
P.append(box("cpanel", 0.42, 0.66, -0.03, 0.03, 0.44, 0.98, DG, bev=0.02, segs=2))
P.append(box("screen", 0.46, 0.62, -0.04, -0.02, 0.8, 0.93, "M_Screen", bev=0.008, segs=1))
for (bx_, bz, bm_) in ((0.49, 0.66, "M_LightGreen"), (0.59, 0.66, "M_LightRed")):
P.append(cy("btnring", 0.04, -0.05, -0.02, bx_, bz, ST, v=12))
o = revm("btn", [(0, 0.045), (0.026, 0.042), (0.034, 0.03), (0.034, 0.0)], bm_, segs=12)
P.append(orient(o, "-Y", (bx_, -0.045, bz)))
P.append(box("lever", 0.475, 0.605, -0.05, -0.025, 0.5, 0.53, ST, bev=0.008, segs=1))
# left: stencilled barrel icon
barrel_icon(P, (0.13, 0.02, 0.64), "-Y", s=0.9)
# filling arm + nozzle head (built at x = 0, shifted onto the lane below)
i_arm = len(P)
P.append(box("arm", -0.14, 0.14, -0.6, 0.1, 1.44, 1.6, OR, bev=0.06, segs=3))
P.append(box("armstripe", -0.142, 0.142, -0.5, 0.06, 1.51, 1.535, "M_PaintWhite", bev=0.004, segs=1))
P.append(revm("head", [(0, 1.66), (0.12, 1.66), (0.16, 1.63), (0.17, 1.58), (0.17, 1.46), (0.15, 1.41), (0.1, 1.39), (0, 1.39)],
[W, W, W, W, W, W, W], segs=24, loc=(0, -0.53, 0)))
P.append(revm("headband", [(0.172, 1.49), (0.175, 1.5), (0.175, 1.55), (0.172, 1.56)], TE, segs=24, loc=(0, -0.53, 0)))
P.append(revm("nozzle", [(0.085, 1.4), (0.085, 1.37), (0.06, 1.35), (0.05, 1.27), (0.042, 1.25), (0.036, 1.21), (0, 1.21)],
[DG, DG, ST, ST, RB, RB], segs=16, loc=(0, -0.53, 0)))
P.append(torus("nozring", 0.056, 0.012, (0, -0.53, 1.3), "Z", seg=16, rseg=5, m=OR))
for k in range(4):
aa = PI / 4 + k * PI / 2
bolt(P, (0.13 * math.cos(aa), -0.53 + 0.13 * math.sin(aa), 1.66), "+Z", r=0.014)
P.append(hose("hose", [(0.34, 0.0, 1.5), (0.34, -0.2, 1.48), (0.2, -0.5, 1.5), (0.17, -0.53, 1.5)], 0.032, step=0.045, segs=8))
P.append(cy("hosecoll", 0.048, -0.04, 0.03, 0.34, 1.5, DG, v=12))
for o in P[i_arm:]:
o.location.x += FX
# roller chute (front)
roller_chute(P, 0.05, -1.0, 0.6, 0.5, legs=(-0.85, -0.12), n=7, xo=FX)
# intake pipe on the back up to the header tank
TZ = ZT + 0.32
pipe(P, [(0.62, 0.91, 0.04), (0.62, 0.91, TZ), (0.62, 0.5, TZ), (0.56, 0.5, TZ)], 0.068, ST, rad=0.18, n=5, segs=12)
deck_flange(P, 0.62, 0.91, 0.085)
flange(P, (0.62, 0.91, 0.75), (0, 0, 1), 0.088)
handwheel(P, (0.71, 0.91, 1.12), "+X", R=0.08, stem=0.03)
P.append(box("pclamp", 0.55, 0.69, 0.82, 0.86, 1.4, 1.48, DG, bev=0.01, segs=1))
# header tank (glass with water) on saddles
P.append(cx("htank", 0.19, -0.48, 0.48, 0.5, TZ, GL, v=24))
P.append(cx("hwater", 0.17, -0.47, 0.47, 0.5, TZ - 0.04, WF, v=16))
for s in (-1, 1):
cap = revm("hcap", [(0.2, 0), (0.2, 0.03), (0.17, 0.07), (0.1, 0.1), (0, 0.11)], ST, segs=20)
xf(cap, ry=s * PI / 2, t=(s * 0.48, 0.5, TZ))
P.append(cap)
P.append(cx("hband", 0.205, s * 0.3 - 0.03, s * 0.3 + 0.03, 0.5, TZ, OR, v=24))
P.append(box("saddle", s * 0.3 - 0.05, s * 0.3 + 0.05, 0.36, 0.64, ZT + 0.09, TZ - 0.12, DG, bev=0.02, segs=1))
# lamp on the crown
lamp(P, -0.66, 0.2, ZT + 0.09)
fin(P, "Body", uv=1.0, haz=3.0)
empty("Out", (FX, -0.98, 0.5))
return dict(elev=26, azim=-35)
# ======================================================================= 3. vaporizer
def rivets_ring(P, R, z, n, c=(0.0, 0.0), r=0.014, h=0.012, m=ST):
for k in range(n):
a = 2 * PI * (k + 0.5) / n
p0 = Vector((c[0] + R * math.cos(a), c[1] + R * math.sin(a), z))
d = Vector((math.cos(a), math.sin(a), 0))
P.append(cyl_between("rivet", p0 - d * 0.004, p0 + d * h, r, m, v=6, r2=r * 0.6))
def snowflake(P, c, facing, s=1.0, m=TE, t=0.012):
G = []
for k in range(6):
a = k * PI / 3
arm = box("sfarm", -0.016 * s, 0.016 * s, 0, 0.15 * s, 0, t, m, bev=0)
xf(arm, rz=a)
G.append(arm)
for (rr, ln) in ((0.095, 0.05),):
for sg in (-1, 1):
br = box("sfbr", -0.012 * s, 0.012 * s, 0, ln * s, 0, t, m, bev=0)
xf(br, rz=sg * 0.8)
xf(br, rz=a, t=(-math.sin(a) * rr * s, math.cos(a) * rr * s, 0))
G.append(br)
G.append(cyl("sfhub", 0.035 * s, t, (0, 0, t / 2), "Z", verts=6, m=m))
for o in G:
P.append(orient(o, facing, c))
def vaporizer():
P = []
skid(P, -0.95, 0.95, -0.32, 0.95)
C = (0.0, 0.3)
# firebox plinth (octagon, flat face to the front) with glowing slits
P.append(revm("firebox", [(0, 0.12), (0.66, 0.12), (0.7, 0.15), (0.7, 0.52), (0.66, 0.56), (0, 0.56)], DG, segs=8, a0=22.5, loc=(C[0], C[1], 0)))
apo = 0.7 * math.cos(math.radians(22.5))
for k in range(8):
a = math.radians(45 * k)
if k == 6:
continue
for zz in (0.29, 0.39):
sl = box("slit", -0.16, 0.16, -0.012, 0.004, -0.014, 0.014, "M_HeatGlow", bev=0)
xf(sl, rz=a + PI / 2, t=(C[0] + apo * math.cos(a), C[1] + apo * math.sin(a), zz))
P.append(sl)
# front fire door (round, glowing grille)
fy = C[1] - apo
door = [revm("door", [(0, 0.0), (0.15, 0.0), (0.16, 0.02), (0.15, 0.04), (0.12, 0.045), (0.11, 0.03), (0, 0.03)],
[DG, DG, DG, DG, DG, "M_HeatGlow"], segs=16)]
for k in range(3):
door.append(box("dbar", -0.11, 0.11, -0.012 + (k - 1) * 0.06, 0.012 + (k - 1) * 0.06, 0.03, 0.05, ST, bev=0.005, segs=1))
door.append(box("dhandle", 0.1, 0.2, -0.015, 0.015, 0.05, 0.075, BR, bev=0.008, segs=1))
for o in door:
P.append(orient(o, "-Y", (-0.06, fy, 0.33)))
P.append(revm("fbcap", [(0.6, 0.555), (0.68, 0.555), (0.7, 0.575), (0.68, 0.6), (0.6, 0.6)], ST, segs=8, a0=22.5, loc=(C[0], C[1], 0)))
# boiler drum
R = 0.62
P.append(revm("drum", [(0.6, 0.6), (R, 0.63), (R, 1.75), (0.6, 1.85), (0.55, 1.96), (0.45, 2.05), (0.31, 2.11), (0.16, 2.14), (0, 2.15)],
W, segs=32, loc=(C[0], C[1], 0)))
for (z0, z1) in ((0.82, 0.94), (1.46, 1.58)):
P.append(revm("heatband", [(R - 0.005, z0), (R + 0.02, z0 + 0.008), (R + 0.022, z1 - 0.008), (R - 0.005, z1)], OR, segs=28, loc=(C[0], C[1], 0)))
rivets_ring(P, R + 0.02, z0 + 0.03, 10, c=C)
rivets_ring(P, R + 0.02, z1 - 0.03, 10, c=C)
P.append(revm("seam", [(0.6, 1.83), (0.615, 1.84), (0.605, 1.875), (0.585, 1.88)], ST, segs=28, loc=(C[0], C[1], 0)))
P.append(revm("seam", [(R - 0.005, 0.64), (R + 0.015, 0.65), (R + 0.015, 0.68), (R - 0.005, 0.69)], DG, segs=28, loc=(C[0], C[1], 0)))
# "STEAM" stencil + HOT warning on the drum
t = text("label", "DRYER", 0.16, OR)
orient(t, "-Y", (0, -0.002, 1.2))
P.append(wrap_cyl(t, R, 205, c=C))
wp = decal(rrect(0, 1.2, 0.26, 0.14, 0.03), 0.0, 0.006, HZ)
P.append(wrap_cyl(wp, R, 140, c=C, step=0.05))
wp = decal(rrect(0, 1.2, 0.2, 0.08, 0.02), 0.006, 0.01, "M_PaintWhite")
P.append(wrap_cyl(wp, R, 140, c=C, step=0.05))
t = text("label", "HOT!", 0.06, "M_PaintRed")
orient(t, "-Y", (0, -0.011, 1.2))
P.append(wrap_cyl(t, R, 140, c=C))
# pressure gauges (brass) on stems
gauge(P, (-0.2, C[1] - 0.585 - 0.1, 1.24), "-Y", r=0.13, bez=BR, stem=0.07, needle=60)
gauge(P, (0.22, C[1] - 0.58 - 0.08, 1.16), "-Y", r=0.085, bez=BR, stem=0.06, needle=-10)
# water level sight glass on the left
ga = math.radians(195)
gx, gy = C[0] + 0.72 * math.cos(ga), C[1] + 0.72 * math.sin(ga)
for zz in (0.78, 1.66):
P.append(cz("sgcap", 0.045, zz - 0.04, zz + 0.04, gx, gy, BR, v=12))
P.append(cyl_between("sgarm", (gx, gy, zz), (C[0] + 0.55 * math.cos(ga), C[1] + 0.55 * math.sin(ga), zz), 0.02, BR, v=8))
P.append(cz("sgglass", 0.03, 0.82, 1.62, gx, gy, GL, v=12))
P.append(cz("sgwater", 0.021, 0.82, 1.3, gx, gy, WF, v=10))
# chimney with rain cap
hx, hy = -0.2, 0.55
P.append(cz("chbase", 0.2, 2.0, 2.12, hx, hy, DG, v=16, bev=0.02))
bolt_ring(P, 6, 0.17, 2.12, c=(hx, hy))
P.append(revm("chimney", [(0.13, 2.1), (0.13, 2.45), (0.12, 2.47), (0.12, 2.76), (0.155, 2.78), (0.155, 2.84), (0.11, 2.85), (0.11, 2.6)],
[DG, DG, DG, DG, DG, "M_Soot", "M_Soot"], segs=16, loc=(hx, hy, 0)))
P.append(cz("chband", 0.135, 2.32, 2.42, hx, hy, OR, v=20))
P.append(cz("chband2", 0.125, 2.55, 2.6, hx, hy, "M_PaintWhite", v=20))
P.append(revm("chcap", [(0.06, 2.9), (0.26, 2.93), (0.25, 2.96), (0.16, 3.0), (0, 3.03)], DG, segs=20, 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.13 * math.cos(a), hy + 0.13 * math.sin(a), 2.8),
(hx + 0.2 * math.cos(a), hy + 0.2 * math.sin(a), 2.935), 0.02, DG, v=6))
# steam whistle + safety valve (brass) on the dome
P.append(revm("whistle", [(0.05, 2.05), (0.03, 2.12), (0.03, 2.2), (0.045, 2.22), (0.045, 2.32), (0.035, 2.35), (0, 2.36)], BR, segs=10, loc=(0.22, 0.25, 0)))
P.append(box("wlever", 0.22, 0.34, 0.24, 0.26, 2.17, 2.19, BR, bev=0.006, segs=1))
P.append(revm("svalve", [(0.07, 2.03), (0.07, 2.08), (0.04, 2.1), (0.035, 2.2), (0.06, 2.22), (0.06, 2.26), (0, 2.27)], BR, segs=10, loc=(0.25, 0.6, 0)))
P.append(ptube("svarm", [(0.25, 0.6, 2.24), (0.25, 0.85, 2.24)], 0.012, ST, segs=6))
P.append(sphere("svball", 0.045, (0.25, 0.86, 2.24), seg=12, rings=6, m="M_PaintRed"))
# steam line (brass) from the drum to the filling nozzle over the chute
XN, YN = 0.5, -0.62
pipe(P, [(XN, 0.05, 1.5), (XN, YN, 1.5), (XN, YN, 1.24)], 0.05, BR, rad=0.14, segs=10)
flange(P, (XN, -0.08, 1.5), (0, -1, 0), 0.08, m=BR)
handwheel(P, (XN, -0.36, 1.6), "+Z", R=0.08, stem=0.05)
P.append(cyl_between("vbody", (XN, -0.44, 1.5), (XN, -0.28, 1.5), 0.075, BR, v=14, bev=0.015))
P.append(revm("snozzle", [(0.11, 1.26), (0.11, 1.2), (0.08, 1.17), (0.05, 1.15), (0.045, 1.07), (0.035, 1.05), (0, 1.05)],
[W, W, ST, ST, RB, RB], segs=16, loc=(XN, YN, 0)))
P.append(torus("snring", 0.112, 0.016, (XN, YN, 1.22), "Z", seg=16, rseg=5, m=OR))
# nozzle support post
P.append(box("npost", XN + 0.22, XN + 0.3, YN - 0.04, YN + 0.04, 0.5, 1.5, DG, bev=0.02, segs=1))
P.append(box("narm", XN + 0.0, XN + 0.3, YN - 0.035, YN + 0.035, 1.42, 1.5, DG, bev=0.015, segs=1))
# output chute (front right)
roller_chute(P, -0.36, -1.0, 0.44, 0.5, legs=(-0.86,), n=5, xo=XN)
# control box (front left) + lamp
P.append(box("cbox", -0.92, -0.5, -0.5, -0.12, 0.12, 1.02, W, bev=0.06, segs=3))
P.append(box("cboxcap", -0.94, -0.48, -0.52, -0.1, 0.98, 1.08, OR, bev=0.04, segs=2))
P.append(box("cpanel", -0.86, -0.56, -0.51, -0.49, 0.52, 0.9, DG, bev=0.015, segs=1))
P.append(box("screen", -0.82, -0.6, -0.52, -0.5, 0.74, 0.86, "M_Screen", bev=0.008, segs=1))
for (bx_, bm_) in ((-0.78, "M_LightGreen"), (-0.71, "M_HeatGlow"), (-0.64, "M_LightRed")):
o = revm("btn", [(0, 0.03), (0.02, 0.028), (0.024, 0.016), (0.024, 0.0)], bm_, segs=10)
P.append(orient(o, "-Y", (bx_, -0.515, 0.62)))
louvres(P, (-0.71, -0.505, 0.3), "-Y", 0.28, 3)
lamp(P, -0.71, -0.31, 1.08)
P.append(ptube("conduit", rpath([(-0.71, -0.12, 0.85), (-0.71, 0.05, 0.85), (-0.45, 0.05, 0.85)], 0.08), 0.025, DG, segs=8))
# intake pipe from the deck (back left) into the drum
pipe(P, [(-0.66, 0.86, 0.04), (-0.66, 0.86, 1.05), (-0.36, 0.62, 1.05)], 0.065, TE, rad=0.18, segs=12)
deck_flange(P, -0.66, 0.86, 0.1)
flange(P, (-0.66, 0.86, 0.6), (0, 0, 1), 0.095)
fin(P, "Body", uv=1.0, haz=3.0)
empty("Vent", (hx, hy, 2.86))
empty("Out", (XN, -0.98, 0.5))
return dict(elev=24, azim=-35)
# ======================================================================= 4. cryo press
def icicle(P, x, y, z, L, r=0.022):
P.append(cyl("icicle", r, L, (x, y, z - L / 2), "Z", verts=6, m="M_Ice", r2=0.003))
def cryo_press():
P = []
skid(P, -0.95, 0.95, -0.52, 0.95)
# bed with ice mould
P.append(box("bed", -0.64, 0.64, -0.46, 0.46, 0.12, 0.4, NV, bev=0.05, segs=2))
P.append(box("bedband", -0.645, 0.645, -0.465, 0.465, 0.2, 0.24, TE, bev=0.01, segs=1))
P.append(box("platen", -0.56, 0.56, -0.43, 0.43, 0.38, 0.44, ST, bev=0.015, segs=1))
for s in (-1, 1):
P.append(box("lip", s * 0.4 - 0.02, s * 0.4 + 0.02, -0.4, 0.4, 0.43, 0.47, "M_Frost", bev=0.012, segs=1))
P.append(box("lip", -0.38, 0.38, 0.38, 0.42, 0.43, 0.47, "M_Frost", bev=0.012, segs=1))
for (x, y) in ((-0.5, -0.38), (0.5, -0.38)):
P.append(blob("frost", 0.06, (x, y, 0.44), scale=(1.2, 1, 0.45)))
# columns with glowing windows
for s in (-1, 1):
x0, x1 = sorted((s * 0.64, s * 0.92))
fc = "+X" if s > 0 else "-X"
P.append(box("column", x0, x1, -0.42, 0.5, 0.12, 2.05, W, bev=0.08, segs=3))
P.append(box("colfoot", x0 - 0.02, x1 + 0.02, -0.44, 0.52, 0.12, 0.3, NV, bev=0.04, segs=1))
wf = plate("winframe", 0.16, 1.24, 0.02, DG, r=0.06, bev=0)
P.append(orient(wf, "-Y", (s * 0.78, -0.42, 1.18)))
wl = plate("window", 0.1, 1.16, 0.026, "M_LightBlue", r=0.04, bev=0.008)
P.append(orient(wl, "-Y", (s * 0.78, -0.42, 1.18)))
for zz in (0.75, 1.05, 1.35, 1.65):
P.append(box("winbar", s * 0.78 - 0.07, s * 0.78 + 0.07, -0.455, -0.435, zz - 0.012, zz + 0.012, DG, bev=0))
gx0, gx1 = (s * 0.64 - 0.035, s * 0.64) if s > 0 else (-0.64, -0.64 + 0.035)
P.append(box("guide", gx0, gx1, -0.08, 0.08, 0.5, 1.98, ST, bev=0.01, segs=1))
sp = plate("spanel", 0.66, 0.66, 0.012, NV, r=0.08)
P.append(orient(sp, fc, (s * 0.92, 0.04, 1.2)))
snowflake(P, (s * 0.932, 0.04, 1.2), fc, s=1.25)
P.append(box("colhaz", x0 + 0.02, x1 - 0.02, -0.446, -0.43, 0.32, 0.48, HZ, bev=0))
# crown
P.append(box("crown", -0.95, 0.95, -0.48, 0.58, 2.0, 2.5, W, bev=0.1, segs=3))
P.append(box("crownseam", -0.93, 0.93, -0.47, 0.57, 1.97, 2.03, NV, bev=0.02, segs=1))
cf = plate("cfront", 1.56, 0.32, 0.02, NV, r=0.1)
P.append(orient(cf, "-Y", (0, -0.48, 2.25)))
for s in (-1, 1):
g = plate("cwin", 0.46, 0.16, 0.03, "M_LightBlue", r=0.06, bev=0.008)
P.append(orient(g, "-Y", (s * 0.47, -0.48, 2.25)))
P.append(orient(cyl("badge", 0.15, 0.03, (0, 0, 0.015), "Z", verts=20, m=TE, bevel=0.008, segs=1), "-Y", (0, -0.48, 2.25)))
snowflake(P, (0, -0.51, 2.25), "-Y", s=0.85, m="M_PaintWhite", t=0.01)
for s in (-1, 1):
t = text("label", "PRESS", 0.19, TE)
P.append(orient(t, "+X" if s > 0 else "-X", (s * 0.953, 0.05, 2.24)))
# frost on the crown + icicles
for (x, y, z, r) in ((-0.8, -0.42, 2.48, 0.1), (-0.45, -0.46, 2.5, 0.08), (0.2, -0.45, 2.5, 0.09), (0.75, -0.4, 2.49, 0.11),
(0.88, 0.3, 2.48, 0.09), (-0.88, 0.2, 2.47, 0.08)):
P.append(blob("frost", r, (x, y, z), m="M_Ice" if r > 0.085 else "M_Frost", scale=(1.4, 1.0, 0.42)))
for (x, sx) in ((-0.62, 2.6), (0.05, 3.2), (0.66, 2.2)):
P.append(blob("crust", 0.1, (x, -0.43, 2.47), m="M_Ice", scale=(sx, 0.7, 0.45), seg=10, rings=4))
for (x, L) in ((-0.5, 0.12), (-0.36, 0.07), (-0.22, 0.16), (0.05, 0.09), (0.24, 0.14), (0.4, 0.08), (0.52, 0.12)):
icicle(P, x, -0.43, 2.0, L)
for s in (-1, 1):
for (y, L) in ((-0.3, 0.1), (0.1, 0.07), (0.4, 0.12)):
icicle(P, s * 0.92, y, 2.0, L, r=0.018)
# hydraulic cylinder
P.append(cz("hcyl", 0.17, 1.72, 2.0, m=ST, v=20))
P.append(cz("hcollar", 0.2, 1.7, 1.78, m=NV, v=20, bev=0.015, segs=1))
bolt_ring(P, 6, 0.17, 1.78, a0=30)
lamp(P, -0.7, 0.05, 2.5)
# back compressor with fan grille
P.append(box("comp", -0.6, 0.6, 0.5, 0.95, 0.12, 1.3, W, bev=0.07, segs=3))
P.append(box("compcap", -0.62, 0.62, 0.48, 0.96, 1.26, 1.34, NV, bev=0.03, segs=2))
P.append(orient(cyl("fanbg", 0.3, 0.02, (0, 0, 0.0), "Z", verts=24, m=DG), "+Y", (0, 0.95, 0.72)))
for rr in (0.31, 0.22, 0.12):
P.append(orient(torus("grille", rr, 0.012, (0, 0, 0.0), "Z", seg=16, rseg=4, m=ST), "+Y", (0, 0.965, 0.72)))
for k in range(4):
b = box("gbar", -0.31, 0.31, -0.008, 0.008, -0.008, 0.008, ST, bev=0)
xf(b, rz=k * PI / 4)
P.append(orient(b, "+Y", (0, 0.965, 0.72)))
for k in range(5):
bl = box("fanblade", 0.03, 0.27, -0.05, 0.05, -0.005, 0.005, TE, bev=0)
xf(bl, ry=0.35, rz=k * 2 * PI / 5)
P.append(orient(bl, "+Y", (0, 0.94, 0.72)))
# coolant tanks (glowing) at the back corners + pipes with frost rings
for s in (-1, 1):
tx, ty = s * 0.8, 0.76
P.append(cz("ctbase", 0.15, 0.12, 0.22, tx, ty, NV, v=16, bev=0.02, segs=1))
P.append(cz("ctglass", 0.12, 0.22, 1.3, tx, ty, GL, v=16))
P.append(cz("ctliquid", 0.1, 0.22, 1.12, tx, ty, "M_LightBlue", v=14))
P.append(cz("cttop", 0.15, 1.3, 1.4, tx, ty, NV, v=16, bev=0.02, segs=1))
P.append(blob("frost", 0.09, (tx, ty, 1.41), scale=(1.1, 1.1, 0.5)))
pipe(P, [(tx, ty, 1.38), (tx, ty, 1.72), (s * 0.5, ty, 1.72), (s * 0.5, 0.5, 2.1)], 0.042, TE, rad=0.14, segs=8, n=4)
P.append(torus("frostring", 0.055, 0.024, (tx, ty, 1.58), "Z", seg=10, rseg=4, m="M_Ice"))
P.append(blob("frost", 0.05, (s * 0.62, ty, 1.74), scale=(1.4, 1, 0.8)))
for s in (-1, 1):
pipe(P, [(s * 0.3, 0.72, 1.32), (s * 0.3, 0.72, 2.05)], 0.035, ST, segs=8)
P.append(torus("frostring", 0.048, 0.018, (s * 0.3, 0.72, 1.6), "Z", seg=12, rseg=4, m="M_Frost"))
# output chute (front)
roller_chute(P, -0.46, -1.0, 0.6, 0.46, legs=(-0.86,), m_rail=TE, n=5, xo=0.5)
fin(P, "Body", uv=1.0, haz=3.0)
# press head (moves down along -Z); origin at the bottom centre of the frosty die
Q = [box("head", -0.56, 0.56, -0.4, 0.4, 1.3, 1.5, OR, bev=0.05, segs=2),
box("headtop", -0.5, 0.5, -0.34, 0.34, 1.48, 1.56, W, bev=0.03, segs=2),
box("headhaz", -0.5, 0.5, -0.41, -0.39, 1.34, 1.46, HZ, bev=0),
box("die", -0.36, 0.36, -0.36, 0.36, 1.24, 1.31, "M_Frost", bev=0.02, segs=2),
cz("rod", 0.085, 1.56, 2.1, m=ST, v=16),
cz("rodcollar", 0.12, 1.55, 1.62, m=NV, v=16, bev=0.012, segs=1)]
for s in (-1, 1):
Q.append(box("shoe", s * 0.6 - 0.04, s * 0.6 + 0.04, -0.13, 0.13, 1.28, 1.52, DG, bev=0.015, segs=1))
for (x, y) in ((-0.3, -0.3), (0.3, -0.3), (0.3, 0.3), (-0.3, 0.3)):
Q.append(blob("frost", 0.06, (x, y, 1.27), scale=(1.2, 1.0, 0.5)))
for (x, L) in ((-0.2, 0.06), (0.12, 0.08), (0.3, 0.05)):
icicle(Q, x, -0.37, 1.25, L, r=0.016)
for k in range(4):
aa = PI / 4 + k * PI / 2
bolt(Q, (0.24 * math.cos(aa), 0.24 * math.sin(aa), 1.56), "+Z")
part(Q, "Press", (0, 0, 1.24), uv=1.0, haz=3.0)
empty("Out", (0.5, -0.98, 0.46))
return dict(elev=24, azim=-35)
# ======================================================================= 5. edge pump
def pump():
P = []
# skid (1 x 2) + deck-edge clamp hooking over the front edge
P.append(box("skid", -0.47, 0.47, -0.97, 0.95, 0.0, 0.1, DG, bev=0.03, segs=2))
P.append(box("skidhaz", -0.4, 0.4, -0.976, -0.95, 0.02, 0.08, HZ, bev=0))
for s in (-1, 1):
P.append(box("skidhaz", s * 0.47 - 0.006, s * 0.47 + 0.006, -0.9, -0.5, 0.02, 0.08, HZ, bev=0))
P.append(box("clamp", -0.32, 0.32, -1.04, -0.97, -0.34, 0.1, DG, bev=0.02, segs=1))
P.append(box("clamppad", -0.28, 0.28, -1.045, -1.03, -0.3, -0.14, RB, bev=0.006, segs=1))
for x in (-0.22, 0.22):
bolt(P, (x, -1.04, 0.0), "-Y", r=0.022, h=0.014)
for (x, y) in ((-0.4, -0.9), (0.4, -0.9), (-0.4, 0.88), (0.4, 0.88)):
bolt(P, (x, y, 0.1), "+Z", r=0.02)
C = (0.0, 0.42)
# volute casing (orange snail) at the bottom
sp = []
for i in range(25):
a = 2 * PI * i / 24
r = 0.27 + 0.08 * i / 24
sp.append((C[0] + r * math.cos(a), C[1] + r * math.sin(a)))
pts = sp[:-1] + [(C[0] + 0.35, C[1] - 0.2), (C[0] + 0.27, C[1] - 0.2)]
P.append(prism("volute", list(reversed(pts)), "XY", 0.1, 0.44, OR, bev=0.03, bsegs=2))
P.append(cz("volcap", 0.22, 0.44, 0.49, C[0], C[1], W, v=24, bev=0.015, segs=1))
bolt_ring(P, 8, 0.25, 0.44, c=C, a0=22.5)
# outlet: tangential stub (+X side) down into the deck
pipe(P, [(0.31, C[1] - 0.1, 0.27), (0.31, C[1] - 0.32, 0.27), (0.31, C[1] - 0.32, 0.05)], 0.065, ST, rad=0.1, segs=12, n=4)
deck_flange(P, 0.31, C[1] - 0.32, 0.1, nb=5)
# motor stack: white drum with fins, orange shroud, grille on top (the Rotor spins under it)
ZM = 1.18
P.append(revm("motor", [(0.3, 0.49), (0.34, 0.52), (0.35, 0.56), (0.35, ZM - 0.06), (0.34, ZM - 0.03)], W, segs=28, loc=(C[0], C[1], 0)))
for k in range(14):
a = 2 * PI * k / 14
fn = box("fin", 0.34, 0.395, -0.011, 0.011, 0.58, ZM - 0.12, W, bev=0.008, segs=1)
xf(fn, rz=a, t=(C[0], C[1], 0))
P.append(fn)
P.append(revm("fband", [(0.39, 0.7), (0.398, 0.705), (0.398, 0.765), (0.39, 0.77)], TE, segs=28, loc=(C[0], C[1], 0)))
P.append(revm("shroud", [(0.33, ZM - 0.04), (0.38, ZM - 0.03), (0.41, ZM), (0.41, ZM + 0.12), (0.39, ZM + 0.14), (0.34, ZM + 0.14), (0.33, ZM + 0.11), (0.33, ZM)],
OR, segs=28, loc=(C[0], C[1], 0), closed=True))
P.append(revm("shstripe", [(0.412, ZM + 0.035), (0.416, ZM + 0.04), (0.416, ZM + 0.07), (0.412, ZM + 0.075)], "M_PaintWhite", segs=28, loc=(C[0], C[1], 0)))
P.append(cz("fanwell", 0.335, ZM - 0.04, ZM - 0.02, C[0], C[1], DG, v=28))
P.append(cz("bearing", 0.07, ZM - 0.02, ZM + 0.03, C[0], C[1], DG, v=12))
for rr in (0.31, 0.22, 0.13):
P.append(torus("grille", rr, 0.011, (C[0], C[1], ZM + 0.12), "Z", seg=24, rseg=4, m=ST))
for k in range(4):
b = box("gbar", -0.33, 0.33, -0.009, 0.009, ZM + 0.11, ZM + 0.13, ST, bev=0)
xf(b, rz=k * PI / 4, t=(C[0], C[1], 0))
P.append(b)
P.append(cz("gcap", 0.05, ZM + 0.115, ZM + 0.14, C[0], C[1], DG, v=12, bev=0.008, segs=1))
# name plate on the motor (wrapped) + terminal box with a big lever
pl = decal(rrect(0, 0.93, 0.32, 0.12, 0.03), 0.0, 0.008, NV)
P.append(wrap_cyl(pl, 0.397, -90, c=C, step=0.05))
t = text("label", "GREENHAUL", 0.055, "M_PaintWhite")
orient(t, "-Y", (0, -0.011, 0.93))
P.append(wrap_cyl(t, 0.397, -90, c=C))
P.append(box("tbox", -0.42, -0.3, C[1] - 0.13, C[1] + 0.13, 0.62, 0.96, DG, bev=0.025, segs=2))
P.append(box("tlid", -0.43, -0.39, C[1] - 0.11, C[1] + 0.11, 0.64, 0.94, OR, bev=0.015, segs=1))
lever = [cyl("lpivot", 0.025, 0.03, (0, 0, 0.015), "Z", verts=10, m=ST),
box("lbar", -0.012, 0.012, 0.0, 0.14, 0.02, 0.04, "M_PaintRed", bev=0.006, segs=1),
sphere("lknob", 0.03, (0, 0.14, 0.03), seg=10, rings=5, m="M_PaintRed")]
for o in lever:
P.append(orient(o, "-X", (-0.43, C[1], 0.72), spin=-0.6))
P.append(ptube("cable", rpath([(-0.36, C[1] + 0.13, 0.7), (-0.36, C[1] + 0.32, 0.5), (-0.2, C[1] + 0.42, 0.12)], 0.12), 0.022, RB, segs=6))
# thick intake pipe: from the volute forward, glass sight section, gate valve, over the deck edge and down into the sea
ZP, RP = 0.27, 0.12
pipe(P, [(0, C[1] - 0.25, ZP), (0, -0.2, ZP)], RP, ST, segs=16)
flange(P, (0, C[1] - 0.29, ZP), (0, -1, 0), 0.17)
flange(P, (0, -0.2, ZP), (0, -1, 0), 0.175, m=OR)
P.append(cy("sight", 0.14, -0.46, -0.2, 0, ZP, GL, v=18))
P.append(cy("sightwater", 0.12, -0.455, -0.205, 0, ZP - 0.014, WF, v=14))
for k in range(4):
a = PI / 4 + k * PI / 2
P.append(cy("tierod", 0.012, -0.48, -0.18, 0.165 * math.cos(a), ZP + 0.165 * math.sin(a), ST, v=6))
flange(P, (0, -0.46, ZP), (0, -1, 0), 0.175, m=OR)
# gate valve with a big handwheel on top
P.append(box("valve", -0.15, 0.15, -0.66, -0.5, ZP - 0.15, ZP + 0.16, BR, bev=0.04, segs=2))
P.append(cz("vbonnet", 0.06, ZP + 0.16, ZP + 0.3, 0, -0.58, BR, v=12, bev=0.01, segs=1))
handwheel(P, (0, -0.58, ZP + 0.36), "+Z", R=0.13, stem=0.06)
pipe(P, [(0, -0.48, ZP), (0, -1.17, ZP), (0, -1.17, -2.36)], RP, ST, rad=0.26, segs=16, n=8)
P.append(cz("griser", 0.022, ZP, ZP + 0.2, 0, -0.84, ST, v=8))
P.append(cz("grnut", 0.034, ZP + 0.11, ZP + 0.14, 0, -0.84, ST, v=6))
gauge(P, (0.0, -0.84, ZP + 0.27), "-Y", r=0.075)
P.append(box("support", -0.17, 0.17, -0.8, -0.7, 0.1, ZP - 0.1, DG, bev=0.02, segs=1))
P.append(torus("clampband", RP + 0.006, 0.02, (0, -0.75, ZP), "Y", seg=16, rseg=4, m=OR))
for z in (-0.5, -1.75):
flange(P, (0, -1.17, z), (0, 0, 1), 0.17, m=OR)
P.append(cyl_between("hband", (0, -1.17, -0.95), (0, -1.17, -0.8), RP + 0.008, HZ, v=16))
# float collar at the waterline (z = -1.2)
P.append(revm("float", [(0.13, -1.27), (0.24, -1.29), (0.29, -1.25), (0.29, -1.15), (0.24, -1.11), (0.13, -1.13)],
[OR, OR, "M_PaintWhite", OR, OR, OR], segs=24, closed=True, loc=(0, -1.17, 0)))
# strainer basket at the end
zb = -2.36
BR_ = 0.2
P.append(cz("bcollar", BR_ + 0.01, zb - 0.06, zb + 0.03, 0, -1.17, OR, v=20, bev=0.015, segs=1))
for k in range(12):
a = 2 * PI * k / 12
P.append(ptube("bbar", [(BR_ * math.cos(a), -1.17 + BR_ * math.sin(a), zb - 0.06),
(BR_ * 1.05 * math.cos(a), -1.17 + BR_ * 1.05 * math.sin(a), zb - 0.14),
(BR_ * 0.75 * math.cos(a), -1.17 + BR_ * 0.75 * math.sin(a), zb - 0.22)], 0.012, ST, segs=5))
for (rr, zz) in ((BR_ * 1.03, zb - 0.1), (BR_ * 0.95, zb - 0.17)):
P.append(torus("bring", rr, 0.012, (0, -1.17, zz), "Z", seg=20, rseg=4, m=ST))
P.append(revm("bbottom", [(0.16, zb - 0.21), (0.13, zb - 0.235), (0.07, zb - 0.25), (0, zb - 0.252)], OR, segs=16, loc=(0, -1.17, 0)))
P.append(cz("bcore", 0.08, zb - 0.22, zb - 0.06, 0, -1.17, DG, v=12))
fin(P, "Body", uv=1.0, haz=3.0)
# Rotor: cooling fan under the grille (spins about Z), origin at its hub
Q = [cz("hub", 0.06, ZM + 0.025, ZM + 0.07, C[0], C[1], DG, v=14, bev=0.01, segs=1),
revm("spinner", [(0.045, ZM + 0.07), (0.04, ZM + 0.085), (0.025, ZM + 0.098), (0, ZM + 0.102)], OR, segs=12, loc=(C[0], C[1], 0))]
for k in range(6):
bl = prism("blade", [(0.05, -0.035), (0.29, -0.06), (0.31, -0.02), (0.3, 0.03), (0.05, 0.035)], "XY", -0.005, 0.005, TE)
xf(bl, rx=0.4)
xf(bl, rz=k * PI / 3, t=(C[0], C[1], ZM + 0.05))
Q.append(bl)
part(Q, "Rotor", (C[0], C[1], ZM + 0.05))
return dict(elev=18, azim=-55)
# ======================================================================= 6. water tank
def water_tank():
P = []
RT = 0.8
WA0, WA1 = 258.75, 281.25 # window opening (front, -Y)
WZ0, WZ1 = 0.62, 2.42
P.append(revm("plinth", [(0, 0.1), (0.86, 0.1), (0.9, 0.08), (0.9, 0.02), (0.87, 0.0)], DG, segs=36))
P.append(revm("skirt", [(0.84, 0.1), (0.84, 0.16), (0.81, 0.18), (0.81, 0.36), (0.79, 0.38)], [NV, NV, W, W], segs=36))
for k in range(12):
a = k * 30 + 15
P.append(arc_band("dash", 0.811, 0.818, 0.2, 0.34, a - 5, a + 5, OR if k % 2 else "M_PaintWhite", segs=2))
bolt_ring(P, 12, 0.88, 0.1, r=0.016, h=0.012, a0=0)
# shell with a window opening
prof = [(0.78, 0.36), (RT, 0.4), (RT, WZ0), (RT, WZ1), (RT, 2.5), (0.78, 2.62), (0.72, 2.74), (0.62, 2.84), (0.47, 2.92), (0.28, 2.97), (0, 2.99)]
sh = revm("shell", prof, W, segs=32)
bm = bmesh.new()
bm.from_mesh(sh.data)
kill = []
for f in bm.faces:
c = f.calc_center_median()
a = math.degrees(math.atan2(c.y, c.x)) % 360
if WA0 < a < WA1 and WZ0 < c.z < WZ1:
kill.append(f)
bmesh.ops.delete(bm, geom=kill, context="FACES")
bm.to_mesh(sh.data)
bm.free()
P.append(sh)
# dark liner inside (normals inward) so the window shows an interior
ln = revm("liner", [(0.77, 0.45), (0.77, 2.55)], NV, segs=24, cap_top=True, cap_bot=True)
for p in ln.data.polygons:
p.flip()
bm = bmesh.new()
bm.from_mesh(ln.data)
kill = [f for f in bm.faces if len(f.verts) == 4 and 248 < math.degrees(math.atan2(f.calc_center_median().y, f.calc_center_median().x)) % 360 < 292]
bmesh.ops.delete(bm, geom=kill, context="FACES")
bm.to_mesh(ln.data)
bm.free()
P.append(ln)
# glass + orange frame + level ticks
P.append(arc_band("glass", RT - 0.012, RT - 0.004, WZ0, WZ1, WA0, WA1, GL, segs=2))
P.append(arc_band("wframe", RT - 0.01, RT + 0.03, WZ0 - 0.06, WZ0, WA0 - 3, WA1 + 3, OR, segs=4))
P.append(arc_band("wframe", RT - 0.01, RT + 0.03, WZ1, WZ1 + 0.06, WA0 - 3, WA1 + 3, OR, segs=4))
for (a0, a1) in ((WA0 - 3, WA0), (WA1, WA1 + 3)):
P.append(arc_band("wframe", RT - 0.01, RT + 0.03, WZ0, WZ1, a0, a1, OR, segs=1))
for k in range(9):
z = WZ0 + 0.1 + k * 0.2
lg = k % 2 == 0
P.append(arc_band("tick", RT, RT + 0.012, z - 0.008, z + 0.008, WA0 - 3 - (6 if lg else 3.5), WA0 - 3.5, NV, segs=1))
for (z, m) in ((WZ1 - 0.1, "M_LightGreen"), (WZ0 + 0.1, "M_LightRed")):
P.append(orient(cyl("ind", 0.025, 0.02, (0, 0, 0.01), "Z", verts=10, m=m), WA1 + 9 - 360, (RT * math.cos(math.radians(WA1 + 9)), RT * math.sin(math.radians(WA1 + 9)), z)))
# bands (gap at the window)
P.append(arc_band("oband", RT - 0.004, RT + 0.008, 1.42, 1.58, WA1 + 3, WA0 - 3 + 360, OR, segs=30))
P.append(revm("domeband", [(0.79, 2.55), (0.795, 2.56), (0.768, 2.66), (0.762, 2.65)], OR, segs=32, closed=True))
for z in (0.95, 2.3):
P.append(arc_band("band", RT - 0.005, RT + 0.022, z - 0.035, z + 0.035, WA1 + 4, WA0 - 4 + 360, ST, segs=30))
for a in (WA1 + 6, WA0 - 6):
ar = math.radians(a)
P.append(cyl_between("bnut", (0.818 * math.cos(ar), 0.818 * math.sin(ar), z), (0.84 * math.cos(ar), 0.84 * math.sin(ar), z), 0.02, ST, v=6))
# emblem on the left flank: teal drop + "H2O"
d = decal(drop_pts(0.17, 0, 1.78, n=12), 0.0, 0.01, TE)
P.append(wrap_cyl(d, RT, 205, step=0.04))
t = text("label", "GRASS", 0.15, NV)
orient(t, "-Y", (0, -0.004, 1.15))
P.append(wrap_cyl(t, RT, 205))
t = text("label", "GREENHAUL", 0.1, NV)
orient(t, "-Y", (0, -0.004, 0.62))
P.append(wrap_cyl(t, RT, 205))
# ladder on +X with grab handles over the dome
for ys in (-0.17, 0.17):
P.append(ptube("rail", rpath([(0.93, ys, 0.1), (0.93, ys, 2.86), (0.93, ys, 3.1), (0.66, ys, 3.1), (0.58, ys, 2.89)], 0.1, 5), 0.024, DG, segs=8))
P.append(cz("railfoot", 0.04, 0.1, 0.13, 0.93, ys, RB, v=10))
for z in (0.8, 1.9):
P.append(ptube("stand", [(0.93, ys, z), (0.79, ys, z)], 0.016, DG, segs=6))
for k in range(10):
z = 0.38 + k * 0.27
P.append(cy("rung", 0.017, -0.17, 0.17, 0.93, z, ST, v=8))
# top: manhole hatch with handwheel, vent mushroom
P.append(revm("hatch", [(0.3, 2.94), (0.3, 3.0), (0.27, 3.03), (0.0, 3.03)], DG, segs=24))
bolt_ring(P, 8, 0.27, 3.0, r=0.014, h=0.012)
handwheel(P, (0, 0, 3.08), "+Z", R=0.11, stem=0.05, m=OR)
P.append(cz("vent", 0.04, 2.85, 3.08, -0.38, 0.32, ST, v=10))
P.append(revm("ventcap", [(0.03, 3.06), (0.11, 3.08), (0.1, 3.11), (0.05, 3.14), (0, 3.15)], OR, segs=14, cap_bot=True, loc=(-0.38, 0.32, 0)))
# inlet pipe: down the back into the deck
pipe(P, [(0.35, 0.36, 2.88), (0.35, 0.36, 3.08), (0.35, 0.9, 3.08), (0.35, 0.9, 0.04)], 0.06, TE, rad=0.18, segs=12)
deck_flange(P, 0.35, 0.9, 0.09, nb=5)
flange(P, (0.35, 0.9, 1.4), (0, 0, 1), 0.09)
P.append(box("pclamp", 0.29, 0.41, 0.78, 0.86, 2.0, 2.06, DG, bev=0.01, segs=1))
# outlet valve, front left, to the deck
oa = math.radians(232)
ox, oy = math.cos(oa), math.sin(oa)
pipe(P, [(0.7 * ox, 0.7 * oy, 0.5), (0.93 * ox, 0.93 * oy, 0.5), (0.93 * ox, 0.93 * oy, 0.04)], 0.05, ST, rad=0.1, segs=10)
handwheel(P, (0.93 * ox, 0.93 * oy, 0.62), "+Z", R=0.07, stem=0.06)
P.append(cyl_between("valve", (0.86 * ox, 0.86 * oy, 0.5), (0.95 * ox, 0.95 * oy, 0.5), 0.075, BR, v=12))
gauge(P, (0.84 * math.cos(math.radians(300)), 0.84 * math.sin(math.radians(300)), 1.3), 300, r=0.08, stem=0.03)
fin(P, "Body", uv=1.0, haz=3.0)
# Fill: water column inside (origin at its bottom, scale Z 0..1 in game)
f = revm("Fill", [(0, 0.45), (0.76, 0.45), (0.76, 2.5), (0, 2.5)], WF, segs=24)
uv_box(f, 1.0)
smooth(f, 30)
set_origin(f, (0, 0, 0.45))
return dict(elev=20, azim=-30)
# ======================================================================= 7. drone hub
def drone_hub():
P = []
P.append(box("base", -0.95, 0.95, -0.95, 0.95, 0.0, 0.1, DG, bev=0.05, segs=2))
for (sx, sy) in ((1, 1), (-1, 1), (1, -1), (-1, -1)):
tri = [(sx * 0.9, sy * 0.9), (sx * 0.9, sy * 0.5), (sx * 0.5, sy * 0.9)]
if sx * sy < 0:
tri = list(reversed(tri))
P.append(prism("corner", tri, "XY", 0.1, 0.106, HZ))
# pad
P.append(revm("pad", [(0.255, 0.22), (0.76, 0.22), (0.81, 0.21), (0.84, 0.18), (0.85, 0.14), (0.83, 0.1)], W, segs=40))
P.append(revm("bumper", [(0.845, 0.11), (0.88, 0.12), (0.89, 0.15), (0.88, 0.175), (0.845, 0.185)], RB, segs=40))
P.append(arc_band("ring", 0.5, 0.56, 0.219, 0.226, 0, 360, TE, segs=40))
for k in range(16):
a = k * 22.5
P.append(arc_band("dash", 0.64, 0.72, 0.219, 0.225, a + 3, a + 15, OR, segs=3))
for k in range(4):
a = math.radians(45 + 90 * k)
ch = prism("chev", chevron_down(0, 0.0, 0.07, 0.06, 0.035), "XY", 0.219, 0.226, NV)
xf(ch, rz=a - PI / 2, t=(0.36 * math.cos(a), 0.36 * math.sin(a), 0))
P.append(ch)
# rim lights
for k in range(12):
a = math.radians(k * 30 + 15)
P.append(orient(revm("rlight", [(0, 0.0), (0.03, 0.0), (0.03, 0.01), (0.02, 0.022), (0, 0.026)], "M_LightBlue", segs=8),
math.degrees(a), (0.845 * math.cos(a), 0.845 * math.sin(a), 0.148)))
# centre water inlet (drain dish + grate + glow ring)
P.append(revm("drain", [(0.0, 0.16), (0.06, 0.16), (0.17, 0.175), (0.24, 0.21), (0.26, 0.222)], DG, segs=40))
P.append(arc_band("glow", 0.26, 0.29, 0.219, 0.227, 0, 360, "M_LightBlue", segs=28))
for rr in (0.2, 0.12):
P.append(torus("grate", rr, 0.01, (0, 0, 0.2), "Z", seg=20, rseg=4, m=ST))
for k in range(4):
b = box("gbar", -0.23, 0.23, -0.01, 0.01, 0.19, 0.21, ST, bev=0)
xf(b, rz=k * PI / 4)
P.append(b)
d = prism("dropicon", drop_pts(0.035, 0, -0.02, n=8), "XY", 0.2, 0.212, TE)
P.append(d)
# charging arms on +-X
for s in (-1, 1):
x = s * 0.74
P.append(box("armbase", x - 0.1, x + 0.1, -0.13, 0.13, 0.2, 0.34, W, bev=0.04, segs=2))
P.append(box("armbase2", x - 0.08, x + 0.08, -0.1, 0.1, 0.33, 0.38, OR, bev=0.02, segs=1))
P.append(cy("joint", 0.05, -0.08, 0.08, x, 0.42, DG, v=14, bev=0.01))
P.append(ptube("arm", rpath([(x, 0, 0.42), (x, 0, 0.66), (s * 0.48, 0, 0.66)], 0.12, 5), 0.04, W, segs=10))
P.append(cyl_between("armsleeve", (x, 0, 0.47), (x, 0, 0.56), 0.045, OR, v=10))
P.append(box("head", min(s * 0.36, s * 0.5), max(s * 0.36, s * 0.5), -0.1, 0.1, 0.56, 0.72, OR, bev=0.03, segs=2))
P.append(box("contact", min(s * 0.33, s * 0.37), max(s * 0.33, s * 0.37), -0.06, 0.06, 0.59, 0.69, RB, bev=0.012, segs=1))
for z in (0.62, 0.66):
P.append(box("pin", min(s * 0.32, s * 0.34), max(s * 0.32, s * 0.34), -0.04, 0.04, z - 0.008, z + 0.008, BR, bev=0))
P.append(ptube("cable", rpath([(x, 0.13, 0.27), (x, 0.24, 0.3), (x - s * 0.02, 0.2, 0.6), (s * 0.5, 0.08, 0.66)], 0.08, 4), 0.016, RB, segs=6))
# charging pylon (back right corner) + lamp-like beacon
px, py = 0.76, 0.76
pyl = [box("pylon", -0.13, 0.13, -0.11, 0.11, 0.1, 0.92, W, bev=0.05, segs=2),
box("pyband", -0.135, 0.135, -0.115, 0.115, 0.7, 0.76, OR, bev=0.015, segs=1),
box("pyscreen", -0.09, 0.09, -0.125, -0.1, 0.38, 0.62, "M_Screen", bev=0.01, segs=1),
box("pycap", -0.15, 0.15, -0.13, 0.13, 0.9, 0.96, DG, bev=0.02, segs=1)]
for k in range(3):
pyl.append(box("pybar", -0.06, 0.06, -0.13, -0.11, 0.42 + k * 0.06, 0.45 + k * 0.06, "M_LightGreen", bev=0))
for o in pyl:
P.append(xf(o, rz=math.radians(-135) + PI / 2 + PI, t=(px, py, 0)))
P.append(cz("ant", 0.012, 0.96, 1.22, px, py, DG, v=6))
P.append(sphere("antball", 0.03, (px, py, 1.23), seg=10, rings=5, m="M_LightBlue"))
# water outlet pipe (back left) into the deck with a glass flow meter
a = math.radians(135)
pipe(P, [(0.8 * math.cos(a), 0.8 * math.sin(a), 0.16), (-0.72, 0.72, 0.16), (-0.72, 0.72, 0.04)], 0.05, TE, rad=0.08, segs=10)
deck_flange(P, -0.72, 0.72, 0.08, nb=4)
fin(P, "Body", uv=1.0, haz=3.0)
empty("Land", (0, 0, 0.22))
return dict(elev=32, azim=-35)
# ======================================================================= 8. rain drone
DRONE_R = [(-1, -1), (1, -1), (1, 1), (-1, 1)] # Rotor_1 front-left, Rotor_2 front-right, Rotor_3 back-right, Rotor_4 back-left
DM = 0.4
def rain_drone():
P = []
# body pod: orange belly, white top, dark seam
prof = [(0.0, 0.21), (0.15, 0.215), (0.24, 0.25), (0.29, 0.31), (0.305, 0.37), (0.3, 0.43), (0.27, 0.5), (0.2, 0.56), (0.1, 0.595), (0.0, 0.605)]
P.append(revm("pod", prof, [OR, OR, OR, OR, W, W, W, W, W], segs=24))
P.append(torus("seam", 0.306, 0.012, (0, 0, 0.37), "Z", seg=24, rseg=3, m=DG))
P.append(revm("hatch", [(0.15, 0.585), (0.155, 0.6), (0.14, 0.615), (0.0, 0.62)], TE, segs=20))
# teal stripe on the white shell
P.append(arc_band("stripe", 0.296, 0.304, 0.41, 0.435, -50, 230, TE, segs=18))
# big friendly eye (front)
E = [revm("eyebez", [(0.0, -0.02), (0.13, -0.02), (0.15, 0.0), (0.15, 0.03), (0.13, 0.05), (0.115, 0.045), (0.11, 0.03)], W, segs=20),
revm("eyelens", [(0.11, 0.025), (0.1, 0.05), (0.07, 0.07), (0.0, 0.078)], "M_Pupil", segs=20),
torus("iris", 0.075, 0.011, (0, 0, 0.066), "Z", seg=20, rseg=4, m="M_LightBlue"),
sphere("glint", 0.022, (-0.035, 0.04, 0.072), seg=8, rings=4, m="M_EyeWhite"),
sphere("glint", 0.01, (0.035, -0.03, 0.074), seg=6, rings=3, m="M_EyeWhite")]
for o in E:
xf(o, rx=math.radians(8))
P.append(orient(o, "-Y", (0, -0.25, 0.42)))
# brow / visor over the eye
P.append(revm("brow", [(0.2, 0.585), (0.255, 0.555), (0.285, 0.515), (0.27, 0.505), (0.23, 0.545), (0.18, 0.57)], OR, segs=8, a0=235, a1=305, closed=True))
# antenna
P.append(ptube("antenna", [(0.08, 0.1, 0.6), (0.1, 0.14, 0.7), (0.14, 0.2, 0.76)], 0.008, DG, segs=5))
P.append(sphere("antball", 0.025, (0.14, 0.2, 0.77), seg=10, rings=5, m="M_PaintRed"))
# arms, motor pods, prop guards, nav lights
for i, (sx, sy) in enumerate(DRONE_R):
mx, my = sx * DM, sy * DM
d = Vector((sx, sy, 0)).normalized()
a0 = d * 0.24
P.append(ptube("arm", rpath([(a0.x, a0.y, 0.42), (mx * 0.6, my * 0.6, 0.45), (mx, my, 0.47)], 0.08, 4), 0.034, W, segs=8))
P.append(cyl_between("armband", (mx * 0.55, my * 0.55, 0.445), (mx * 0.68, my * 0.68, 0.455), 0.038, OR, v=8))
P.append(revm("motor", [(0, 0.42), (0.05, 0.42), (0.066, 0.44), (0.066, 0.5), (0.055, 0.52), (0.03, 0.525), (0, 0.525)],
[DG, DG, OR, OR, DG, DG], segs=14, loc=(mx, my, 0)))
P.append(torus("guard", 0.2, 0.018, (mx, my, 0.51), "Z", seg=24, rseg=4, m=OR))
for k in range(3):
ga = math.atan2(-sy, -sx) + (k - 1) * 2.1
P.append(ptube("gstrut", [(mx + 0.06 * math.cos(ga), my + 0.06 * math.sin(ga), 0.47),
(mx + 0.19 * math.cos(ga), my + 0.19 * math.sin(ga), 0.505)], 0.009, DG, segs=4))
lm = "M_LightRed" if sx < 0 else "M_LightGreen"
P.append(sphere("nav", 0.018, (mx + sx * 0.045, my + sy * 0.045, 0.445), seg=8, rings=4, m=lm))
# landing skids
for s in (-1, 1):
x = s * 0.22
P.append(ptube("skid", rpath([(x, -0.3, 0.06), (x, -0.27, 0.022), (x, 0.27, 0.022), (x, 0.3, 0.06)], 0.04, 3), 0.02, DG, segs=6))
for y in (-0.15, 0.15):
P.append(ptube("strut", [(x, y, 0.03), (s * 0.15, y * 0.8, 0.24)], 0.016, DG, segs=6))
P.append(box("pad", x - 0.03, x + 0.03, -0.2, 0.2, 0.0, 0.016, RB, bev=0.006, segs=1))
# tank straps + suction hose with nozzle
for y in (-0.1, 0.1):
P.append(torus("strap", 0.117, 0.012, (0, y, 0.17), "Y", seg=16, rseg=4, m=ST))
P.append(hose("hose", [(0, 0.29, 0.17), (0, 0.4, 0.16), (0.06, 0.44, 0.1), (0.12, 0.38, 0.07)], 0.026, step=0.03, segs=8, rad=0.06))
P.append(cyl_between("nozzle", (0.12, 0.38, 0.07), (0.16, 0.32, 0.06), 0.04, OR, v=10, r2=0.05))
fin(P, "Body", uv=2.0, haz=3.0)
# Tank: teal glass capsule with water, origin at its bottom centre
T = [revm("tglass", [(0, -0.29), (0.06, -0.275), (0.095, -0.235), (0.11, -0.18), (0.11, 0.18), (0.095, 0.235), (0.06, 0.275), (0, 0.29)], "M_GlassTeal", segs=16),
revm("twater", [(0, -0.25), (0.05, -0.24), (0.085, -0.2), (0.095, -0.15), (0.095, 0.15), (0.085, 0.2), (0.05, 0.24), (0, 0.25)], WF, segs=12)]
for o in T:
xf(o, rx=PI / 2, t=(0, 0, 0.17))
for s in (-1, 1):
T.append(cy("tcap", 0.045, s * 0.27 - 0.025, s * 0.27 + 0.025, 0, 0.17, DG, v=12))
part(T, "Tank", (0, 0, 0.06), uv=2.0)
# rotors
for i, (sx, sy) in enumerate(DRONE_R):
mx, my = sx * DM, sy * DM
R = [cz("hub", 0.035, 0.525, 0.55, mx, my, DG, v=12),
revm("spinner", [(0.03, 0.55), (0.026, 0.565), (0.014, 0.578), (0, 0.582)], OR, segs=12, loc=(mx, my, 0))]
for k in range(3):
bl = prism("blade", [(0.03, -0.022), (0.15, -0.03), (0.178, -0.014), (0.178, 0.014), (0.15, 0.026), (0.03, 0.022)], "XY", -0.004, 0.004, DG)
xf(bl, rx=0.3 * (1 if (sx * sy) > 0 else -1))
xf(bl, rz=k * 2 * PI / 3 + i * 0.5, t=(mx, my, 0.54))
R.append(bl)
tip = prism("btip", [(0.14, -0.03), (0.178, -0.014), (0.178, 0.014), (0.14, 0.028)], "XY", -0.0045, 0.0045, W)
xf(tip, rx=0.3 * (1 if (sx * sy) > 0 else -1))
xf(tip, rz=k * 2 * PI / 3 + i * 0.5, t=(mx, my, 0.54))
R.append(tip)
part(R, "Rotor_%d" % (i + 1), (mx, my, 0.54), uv=2.0)
return dict(elev=28, azim=-35)
BUILDERS = {
"SM_Hopper": hopper,
"SM_Filler": filler,
"SM_Vaporizer": vaporizer,
"SM_CryoPress": cryo_press,
"SM_Pump": pump,
"SM_WaterTank": water_tank,
"SM_DroneHub": drone_hub,
"SM_RainDrone": rain_drone,
}
def run_all():
args = sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else []
names = args or list(BUILDERS.keys())
views = os.environ.get("OS_VIEWS")
for n in names:
reset()
random.seed(sum(map(ord, n)))
res = BUILDERS[n]() or {}
for o in bpy.context.scene.objects:
if o.type == "MESH":
print(f" [{n}] {o.name:<10} tris={tri_count([o])}")
finish(n, **res)
if views:
old = common.PREVIEWS
common.PREVIEWS = views
for tag, el, az in (("back", 25, 150), ("side", 12, 80), ("top", 60, -20)):
preview(n + "_" + tag, elev=el, azim=az, res=480)
common.PREVIEWS = old
if __name__ == "__main__":
run_all()