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>
This commit is contained in:
633
ArtSource/Blender/scripts/gc_up4_tools.py
Normal file
633
ArtSource/Blender/scripts/gc_up4_tools.py
Normal file
@ -0,0 +1,633 @@
|
||||
"""GRASS CUTTER - fourth round of the seven hand tools: real tool shapes in the POLYGON Farm look.
|
||||
|
||||
Round 2 (gc_up_tools) and round 3 (gc_up3_base) stay as they are. This file rebuilds every tool from scratch on the same frame:
|
||||
pivot, axes, length and grip points are copied from round 3, so ViewModel / CrewAvatar hold data stays valid.
|
||||
|
||||
SM_Tool_NailScissors slim curved blades stacked on a brass screw, oval enamel finger bows, a finger rest Body, BladeA, BladeB
|
||||
SM_Tool_GardenShears long straight shear blades with a branch notch, ash handles, red rubber grips Body, BladeA, BladeB
|
||||
SM_Tool_Sickle slim turned handle on the same pistol path, a clean tapering crescent Body
|
||||
SM_Tool_Hammer claw hammer: round striking face on +X, a curved split claw on -X, rubber grip Body
|
||||
SM_Tool_Scythe / LongScythe / WideScythe same snaths and nibs, rounder turnings, clean ground blades Body
|
||||
|
||||
Scissors: both blades lie on the tool axis, BladeA above z = 0 and BladeB below, so closed they read as one narrow blade (round 3 had them
|
||||
side by side, which gave the kunai silhouette). Each blade has a flat inner face and a ground bevel on its outer face, like the real thing.
|
||||
BladeA's edge faces +X and its bow sits on +X; ViewModel turns BladeA's tip to -X to open, so the edges part.
|
||||
|
||||
Run (absolute paths):
|
||||
blender -b --factory-startup --python D:/PROJECTS/LOCAL/GrassCutter/ArtSource/Blender/scripts/gc_up4_tools.py -- SM_Tool_Hammer [--quick]
|
||||
Extra views go to $GC_SHOTS. First-person views: gc_up_check.py fpv / open / swing.
|
||||
"""
|
||||
import sys, os
|
||||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
||||
from gc_up3_base import * # noqa: F401,F403 (kit, tfin, forged3, blot, UT, UM, FT, pack greys, materials)
|
||||
import gc_up_kit as KIT
|
||||
import gc_up_tools as UT
|
||||
import gc_up_machines as UM
|
||||
import gc_farm_tools as FT
|
||||
from os_crew import lathe, catmull, M_axis
|
||||
|
||||
TAU = 2 * math.pi
|
||||
DEG = math.radians
|
||||
G1, G2, G3, G4, G5, WHT, BLK, DGY = "P_G1", "P_G2", "P_G3", "P_G4", "P_G5", "P_WHITE", "P_BLACK", "P_DGREY"
|
||||
TIM, IRON, BRASS, LEAT, ROPE, TWINE = "M_Timber", "M_Navy", "M_Brass", "M_Leather", "M_Rope", "M_Twine"
|
||||
PRED, GOLD, CRM, TEAL, RUB = "M_PaintRed", "M_PaintYellow", "M_PaintWhite", "M_Teal", "M_Rubber"
|
||||
PV_Y = -0.145 # the scissor screw
|
||||
|
||||
|
||||
class Calm:
|
||||
"""forged3 wants an rng for the wandering ground line: this one keeps it straight."""
|
||||
|
||||
def uniform(self, a, b):
|
||||
return (a + b) / 2
|
||||
|
||||
def random(self):
|
||||
return 0.5
|
||||
|
||||
|
||||
# ======================================================================= geometry
|
||||
|
||||
def rings_mesh(name, rings, mats, colfn=None, cap0=True, cap1=True, ang=30):
|
||||
"""Solid through rings of points (lists of the same length; a list of one point is a pole). colfn(i, j) -> material slot of the face
|
||||
between ring i and i+1, from point j to j+1. Caps take slot capm."""
|
||||
bm = bmesh.new()
|
||||
R = [[bm.verts.new(tuple(p)) for p in r] for r in rings]
|
||||
n = max(len(r) for r in R)
|
||||
for i, (a, b) in enumerate(zip(R, R[1:])):
|
||||
for j in range(n):
|
||||
k = (j + 1) % n
|
||||
m_ = colfn(i, j) if colfn else 0
|
||||
if len(a) == 1:
|
||||
f = bm.faces.new((a[0], b[k], b[j]))
|
||||
elif len(b) == 1:
|
||||
f = bm.faces.new((a[j], a[k], b[0]))
|
||||
else:
|
||||
f = bm.faces.new((a[j], a[k], b[k], b[j]))
|
||||
f.material_index = m_
|
||||
caps = []
|
||||
if cap0 and len(R[0]) > 2:
|
||||
caps.append(bm.faces.new(list(reversed(R[0]))))
|
||||
caps[-1].material_index = colfn(-1, -1) if colfn else 0
|
||||
if cap1 and len(R[-1]) > 2:
|
||||
caps.append(bm.faces.new(R[-1]))
|
||||
caps[-1].material_index = colfn(len(R), -1) if colfn else 0
|
||||
if caps:
|
||||
bmesh.ops.triangulate(bm, faces=[f for f in caps if len(f.verts) > 4], ngon_method="EAR_CLIP")
|
||||
bmesh.ops.recalc_face_normals(bm, faces=bm.faces)
|
||||
idx = [f.material_index for f in bm.faces]
|
||||
o = mesh_obj(name, bm)
|
||||
set_mats(o, *mats)
|
||||
o.data.polygons.foreach_set("material_index", idx)
|
||||
o.data.update()
|
||||
smooth(o, ang)
|
||||
return o
|
||||
|
||||
|
||||
def crect(c, U, V, a0, a1, b0, b1, ch):
|
||||
"""Chamfered rectangle a0..a1 along U, b0..b1 along V, round c. Faces j: 0 b0-side, 2 a1-side, 4 b1-side, 6 a0-side, odd = chamfers."""
|
||||
ch = max(0.0, min(ch, (a1 - a0) * 0.4, (b1 - b0) * 0.4))
|
||||
pts = [(a0 + ch, b0), (a1 - ch, b0), (a1, b0 + ch), (a1, b1 - ch), (a1 - ch, b1), (a0 + ch, b1), (a0, b1 - ch), (a0, b0 + ch)]
|
||||
return [c + U * a + V * b for a, b in pts]
|
||||
|
||||
|
||||
def resample(pts, n, per=6):
|
||||
"""n + 1 points evenly spaced by arc length along a Catmull-Rom curve through pts."""
|
||||
C = catmull(pts, per)
|
||||
L = [0.0]
|
||||
for a, b in zip(C, C[1:]):
|
||||
L.append(L[-1] + (b - a).length)
|
||||
out = []
|
||||
for i in range(n + 1):
|
||||
s = L[-1] * i / n
|
||||
k = next((q for q in range(len(L) - 1) if L[q + 1] >= s), len(L) - 2)
|
||||
f = (s - L[k]) / max(1e-9, L[k + 1] - L[k])
|
||||
out.append(C[k].lerp(C[k + 1], f))
|
||||
return out
|
||||
|
||||
|
||||
def oval_ring(name, c, rx, ry, r_in, r_z, m, seg=16, rseg=6, z=0.0):
|
||||
"""A ring round an oval centre line in the XY plane: r_in across in the plane, r_z up."""
|
||||
bm = bmesh.new()
|
||||
R = []
|
||||
for i in range(seg):
|
||||
a = TAU * i / seg
|
||||
p = Vector((c[0] + rx * math.cos(a), c[1] + ry * math.sin(a), z))
|
||||
nrm = Vector((math.cos(a) / rx, math.sin(a) / ry, 0)).normalized()
|
||||
R.append([bm.verts.new(p + nrm * (r_in * math.cos(TAU * j / rseg + PI / rseg)) + Vector((0, 0, r_z * math.sin(TAU * j / rseg + PI / rseg)))) for j in range(rseg)])
|
||||
for i in range(seg):
|
||||
for j in range(rseg):
|
||||
a, b = R[i], R[(i + 1) % seg]
|
||||
bm.faces.new((a[j], b[j], b[(j + 1) % rseg], a[(j + 1) % rseg]))
|
||||
bmesh.ops.recalc_face_normals(bm, faces=bm.faces)
|
||||
o = mesh_obj(name, bm)
|
||||
set_mats(o, m)
|
||||
smooth(o, 40)
|
||||
return o
|
||||
|
||||
|
||||
def zdisc(name, c, r, z0, z1, m, segs=16, ch=0.0):
|
||||
"""A disc about Z with a chamfered rim on both faces (z0 < z1 or z0 > z1)."""
|
||||
lo, hi = min(z0, z1), max(z0, z1)
|
||||
ch = min(ch, (hi - lo) * 0.45)
|
||||
prof = [(0.0, lo), (r - ch, lo), (r, lo + ch), (r, hi - ch), (r - ch, hi), (0.0, hi)]
|
||||
return lathe(name, prof, segs=segs, m=m, frame=Matrix.Translation(Vector((c[0], c[1], 0))), smooth_ang=30)
|
||||
|
||||
|
||||
def tube(name, pts, rf, m, segs=12, per=4, **kw):
|
||||
return UT.tube(name, pts, rf, m, segs=segs, per=per, **kw)
|
||||
|
||||
|
||||
def ring_on(P, pth, t, r, w, m, segs=12):
|
||||
"""A short band round a bar at path fraction t, w long."""
|
||||
a, b = pth.at(t - w / 2 / pth.L[-1]), pth.at(t + w / 2 / pth.L[-1])
|
||||
P.append(UT.tube("band", [a, b], lambda s: r, m, segs=segs, ang=30, cap=False))
|
||||
|
||||
|
||||
def tfin4(P, name, uv=2.4, ang=30, wn=True):
|
||||
if os.environ.get("GC_PARTS"): # triangle count per part, for trimming
|
||||
cnt = {}
|
||||
for q in P:
|
||||
if q is not None:
|
||||
k = q.name.split(".")[0]
|
||||
cnt[k] = cnt.get(k, 0) + sum(len(f.vertices) - 2 for f in q.data.polygons)
|
||||
print("PARTS", name, sorted(cnt.items(), key=lambda kv: -kv[1]))
|
||||
o = tfin(P, name, uv=uv, ang=ang)
|
||||
if wn:
|
||||
weighted(o)
|
||||
return o
|
||||
|
||||
|
||||
# ======================================================================= scissors and shears
|
||||
|
||||
def layered_blade(sx, sz, py, ty, hw, he, cfn, tf, z_in=0.0008, n=12, heel=0.022, mats=(G2, G5, G4, WHT, G3), notch=None):
|
||||
"""One scissor blade from the screw at (0, py) to the tip at ty. sx = +1: spine on -X, edge on +X (BladeA). sz: the layer, +1 above z = 0.
|
||||
hw(u), he(u): spine and edge offsets from the centre line cfn(u); u = 0 at the screw, 1 at the tip. tf(u): thickness.
|
||||
Section: flat inner face against the other blade, spine, a small chamfer, the outer flat, the bright ground bevel down to the edge."""
|
||||
rings = []
|
||||
for i in range(n + 1):
|
||||
y = (py + heel) + (ty + 0.004 - (py + heel)) * (i / n) ** 0.92
|
||||
u = max(0.0, (py - y) / (py - ty))
|
||||
c = cfn(u)
|
||||
k = 1.0 - 0.5 * (max(0.0, y - py) / heel) ** 2 # the heel rounds off behind the screw
|
||||
h_e = he(u) * k - (notch(u) if notch else 0.0)
|
||||
S, E = c - sx * hw(u) * k, c + sx * h_e
|
||||
t = tf(u)
|
||||
B = E + (S - E) * 0.46
|
||||
ch = min(0.0035, abs(S - E) * 0.18)
|
||||
pts = [(S, z_in), (S, z_in + t * 0.72), (S + sx * ch, z_in + t), (B, z_in + t), (E, z_in + t * 0.12)]
|
||||
rings.append([Vector((x, y, sz * z)) for x, z in pts])
|
||||
tipc = cfn(1.0) + sx * he(1.0) * 0.4
|
||||
rings.append([Vector((tipc, ty, sz * (z_in + tf(1.0) * 0.35)))])
|
||||
return rings_mesh("blade", rings, list(mats), colfn=lambda i, j: (0 if j == 0 else 1 if j == 1 else 2 if j == 2 else 3 if j == 3 else 4) if j >= 0 else 0, ang=32)
|
||||
|
||||
|
||||
def nail_scissors():
|
||||
py, ty = PV_Y, -0.455
|
||||
z_in = 0.0006
|
||||
tf = lambda u: 0.0105 * (1 - 0.62 * u) + 0.0018
|
||||
hw = lambda u: 0.0275 * (1 - u) ** 0.85 + 0.0016
|
||||
he = lambda u: 0.0205 * (1 - u) ** 0.95 + 0.0010
|
||||
cfn = lambda u: -0.02 * u ** 2.2 # curved nail scissors: the tips sweep a little to -X
|
||||
t0 = tf(0.0)
|
||||
for nm, sx, sz in (("BladeA", 1, 1), ("BladeB", -1, -1)):
|
||||
P = [layered_blade(sx, sz, py, ty, hw, he, cfn, tf, z_in=z_in, n=13, mats=(G1, G5, G3, WHT, G2))]
|
||||
zc = sz * (z_in + t0 * 0.5)
|
||||
# the boss round the screw, chamfered
|
||||
P.append(zdisc("boss", (0, py), 0.023, sz * z_in, sz * (z_in + t0), G4, segs=16, ch=0.003))
|
||||
# the shank: from the boss out to the bow, flat oval section, a collar where it meets the bow
|
||||
big = sx < 0
|
||||
cb = Vector((sx * (0.061 if big else 0.056), 0.064 if big else 0.06, zc))
|
||||
rx, ry = (0.036, 0.046) if big else (0.031, 0.04)
|
||||
d = (Vector((0, py, zc)) - cb)
|
||||
a_in = math.atan2(d.y / ry, d.x / rx)
|
||||
entry = cb + Vector((rx * math.cos(a_in), ry * math.sin(a_in), 0)) * 1.0
|
||||
sh = [Vector((0, py + 0.006, zc)), Vector((sx * 0.011, py + 0.05, zc)), Vector((sx * 0.03, -0.045, zc)), entry + Vector((0, -0.012, 0)), entry]
|
||||
P.append(tube("shank", sh, lambda s: (0.0108 - 0.0022 * s, 0.0066), G4, segs=8, per=3, ang=30))
|
||||
P.append(tube("collar", [entry + (sh[-2] - entry).normalized() * 0.013, entry + (sh[-2] - entry).normalized() * 0.002], lambda s: (0.0118, 0.0082), G5, segs=8, per=1, ang=30))
|
||||
# the bow: red enamel over an oval steel loop
|
||||
P.append(oval_ring("bow", cb, rx, ry, 0.0118, 0.0082, PRED, seg=18, rseg=6, z=zc))
|
||||
if big:
|
||||
# the finger rest: a spur off the outside of the big bow, curling back
|
||||
a0 = DEG(150)
|
||||
p0 = cb + Vector((rx * math.cos(a0), ry * math.sin(a0), 0))
|
||||
spur = [p0 + Vector((0.004, -0.004, 0)), p0 + Vector((-0.012, 0.022, 0)), p0 + Vector((-0.014, 0.055, 0)), p0 + Vector((0.004, 0.075, 0))]
|
||||
P.append(tube("spur", spur, lambda s: (0.0072 * (1 - 0.45 * s), 0.0055 * (1 - 0.3 * s)), G4, segs=8, per=3, ang=30))
|
||||
P.append(UT.disc("spurtip", 0.0062, 0.009, tuple(spur[-1]), G5, n=8))
|
||||
o = tfin4(P, nm, uv=5.0, ang=30)
|
||||
set_origin(o, (0, py, 0))
|
||||
# the screw: a domed brass head on top, a flat nut under
|
||||
zt = z_in + t0
|
||||
B = [lathe("head", [(0.0, zt - 0.001), (0.0125, zt - 0.001), (0.0125, zt + 0.0018), (0.0095, zt + 0.0045), (0.0, zt + 0.0056)], segs=14, m=BRASS, frame=Matrix.Translation((0, py, 0)), smooth_ang=40),
|
||||
lathe("nut", [(0.0, -zt + 0.001), (0.011, -zt + 0.001), (0.011, -zt - 0.003), (0.0085, -zt - 0.0042), (0.0, -zt - 0.0042)], segs=8, m=G5, frame=Matrix.Translation((0, py, 0)), smooth_ang=20),
|
||||
UT.disc("shaft", 0.006, 2 * zt, (0, py, 0), G3, n=8),
|
||||
bx(-0.0085, 0.0085, py - 0.0013, py + 0.0013, zt + 0.0035, zt + 0.0059, DGY, bev=0.0, name="slot")]
|
||||
tfin4(B, "Body", uv=5.0, ang=30)
|
||||
return dict(elev=60, azim=-12, dist_mul=.72, views=[("_under", dict(elev=-55, azim=-12, dist_mul=.72))])
|
||||
|
||||
|
||||
def garden_shears():
|
||||
py, ty = PV_Y, -0.62
|
||||
z_in = 0.0008
|
||||
tf = lambda u: 0.0145 * (1 - 0.45 * u) + 0.002
|
||||
|
||||
def hw(u): # the spine: straight, then rounding over into the tip
|
||||
k = 0.78
|
||||
base = 0.041 - 0.009 * min(u, k)
|
||||
return base * math.sqrt(max(0.0, 1 - ((u - k) / (1 - k)) ** 2)) + 0.002 if u > k else base
|
||||
|
||||
he = lambda u: 0.011 * (1 - 0.5 * u)
|
||||
notch = lambda u: 0.013 * math.sin(PI * (u - 0.05) / 0.12) if 0.05 < u < 0.17 else 0.0
|
||||
cfn = lambda u: 0.0
|
||||
t0 = tf(0.0)
|
||||
for nm, sx, sz in (("BladeA", 1, 1), ("BladeB", -1, -1)):
|
||||
P = [layered_blade(sx, sz, py, ty, hw, he, cfn, tf, z_in=z_in, n=14, heel=0.03, mats=(G2, G4, G1, WHT, G3), notch=notch if sx > 0 else None)]
|
||||
zc = sz * (z_in + t0 * 0.5)
|
||||
hz = sz * 0.0105 # the handles sit on the old layer lines
|
||||
P.append(zdisc("boss", (0, py), 0.034, sz * z_in, sz * (z_in + t0), G2, segs=16, ch=0.004))
|
||||
# the forged tang from the boss to the ferrule
|
||||
fr0 = Vector((sx * 0.031, -0.05, hz))
|
||||
tg = [Vector((sx * 0.004, py + 0.012, zc)), Vector((sx * 0.012, -0.095, zc)), Vector((sx * 0.024, -0.066, hz)), fr0]
|
||||
P.append(tube("tang", tg, lambda s: (0.0145 - 0.002 * s, 0.0068 + 0.004 * s), G2, segs=8, per=3, ang=30))
|
||||
# an ash handle in a steel ferrule, a red rubber grip, a dark end knob
|
||||
hp = [fr0, Vector((sx * 0.038, 0.0, hz)), Vector((sx * 0.044, 0.08, hz)), Vector((sx * 0.046, 0.168, hz))]
|
||||
P.append(tube("handle", hp, lambda s: (0.0175 + 0.003 * math.sin(s * PI), 0.0165 + 0.003 * math.sin(s * PI)), TIM, segs=10, per=3, s=1.6, ang=30))
|
||||
P.append(tube("ferrule", [fr0 + Vector((-sx * 0.0015, -0.012, 0)), fr0 + Vector((sx * 0.0012, 0.02, 0))], lambda s: 0.0205 + 0.0015 * s, G4, segs=12, per=1, ang=30))
|
||||
for yy in (-0.034, -0.042):
|
||||
P.append(tube("fring", [Vector((sx * 0.0315, yy - 0.0022, hz)), Vector((sx * 0.0318, yy + 0.0022, hz))], lambda s: 0.0225, G5, segs=12, per=1, ang=30, cap=False))
|
||||
UT.stud(P, Vector((sx * 0.033, -0.026, hz + sz * 0.021)), (0, 0, sz), r=0.0058, m=BRASS, hexa=False, h=0.004)
|
||||
gp = Path4([Vector((sx * 0.0405, 0.05, hz)), Vector((sx * 0.044, 0.1, hz)), Vector((sx * 0.046, 0.165, hz))])
|
||||
gq = resample(gp.pts, 14)
|
||||
# a moulded rubber grip: a lip at the front, finger swells, a flared end
|
||||
grf = lambda s: 0.0222 + 0.0035 * max(0.0, 1 - s / 0.07) + 0.0022 * abs(math.sin(s * PI * 3.0)) ** 2 * (1 if s < 0.84 else 0) + 0.004 * max(0.0, (s - 0.86) / 0.14)
|
||||
P.append(tube("grip", gq, grf, PRED, segs=12, per=1, ang=40))
|
||||
end = gp.pts[-1]
|
||||
P.append(lathe("knob", [(0.0, -0.002), (0.024, -0.002), (0.0255, 0.006), (0.021, 0.014), (0.0, 0.017)], segs=12, m=RUB, frame=Matrix.Translation(end) @ Matrix.Rotation(DEG(-90), 4, "X"), smooth_ang=40))
|
||||
# a rubber bumper on the inside of each tang: the handles stop on these
|
||||
P.append(lathe("bump", [(0.0, 0.0), (0.0085, 0.0), (0.0085, 0.008), (0.006, 0.0115), (0.0, 0.0115)], segs=8, m=RUB, frame=Matrix.Translation(Vector((sx * 0.02, -0.062, hz))) @ Matrix.Rotation(DEG(-90 * sx), 4, "Y"), smooth_ang=40))
|
||||
if sx < 0: # a leather hanging loop through the end of one handle
|
||||
e = end + Vector((0, 0.012, 0))
|
||||
pts = [e, e + Vector((-0.02, 0.022, 0)), e + Vector((-0.012, 0.056, 0)), e + Vector((0.016, 0.064, 0)), e + Vector((0.026, 0.034, 0)), e + Vector((0.006, 0.006, 0))]
|
||||
P.append(tube("lanyard", pts, lambda s: (0.0055, 0.0032), LEAT, segs=6, per=3, ang=40, cap=False))
|
||||
o = tfin4(P, nm, uv=5.0, ang=30)
|
||||
set_origin(o, (0, py, 0))
|
||||
zt = z_in + t0
|
||||
B = [lathe("head", [(0.0, zt - 0.001), (0.018, zt - 0.001), (0.018, zt + 0.003), (0.014, zt + 0.0068), (0.0, zt + 0.0082)], segs=14, m=BRASS, frame=Matrix.Translation((0, py, 0)), smooth_ang=40),
|
||||
lathe("nut", [(0.0, -zt + 0.001), (0.016, -zt + 0.001), (0.016, -zt - 0.0065), (0.0125, -zt - 0.0085), (0.0, -zt - 0.0085)], segs=6, m=G4, frame=Matrix.Translation((0, py, 0)), smooth_ang=20),
|
||||
UT.disc("shaft", 0.008, 2 * zt, (0, py, 0), G3, n=8)]
|
||||
tfin4(B, "Body", uv=5.0, ang=30)
|
||||
return dict(elev=60, azim=-12, dist_mul=.72, views=[("_under", dict(elev=-55, azim=-12, dist_mul=.72))])
|
||||
|
||||
|
||||
class Path4(UT.Path):
|
||||
def __init__(self, pts, per=4):
|
||||
super().__init__(pts, per)
|
||||
self.pts = [Vector(p) for p in pts]
|
||||
|
||||
|
||||
# ======================================================================= sickle
|
||||
|
||||
def sickle():
|
||||
"""Same pistol-handle path, grip and reach as round 3; the handle is a slim turned one, the crescent a clean taper."""
|
||||
P = []
|
||||
z = 0.26
|
||||
hp = [(0, 0.03, -0.3), (0, 0.012, -0.14), (0, 0, 0.02), (0, -0.04, 0.17), (0, -0.16, z - 0.005), (0, -0.335, z)]
|
||||
pth = UT.Path(hp, per=4)
|
||||
|
||||
def rf(s): # a turned profile: a swell under the palm, a waist, a gentle taper into the ferrule
|
||||
r = 0.04 + 0.009 * math.exp(-((s - 0.2) / 0.13) ** 2) + 0.004 * math.exp(-((s - 0.47) / 0.08) ** 2) - 0.004 * max(0.0, (s - 0.62) / 0.38)
|
||||
return r
|
||||
P.append(tube("handle", hp, rf, TIM, segs=12, per=5, s=1.0, ang=34))
|
||||
# a red pommel with a brass ring, a hanging loop of rope through it
|
||||
P.append(lathe("pommel", [(0.0, -0.345), (0.03, -0.345), (0.046, -0.336), (0.05, -0.322), (0.046, -0.304), (0.04, -0.29)], segs=12, m=PRED, frame=Matrix.Translation((0, 0.031, 0)), smooth_ang=40))
|
||||
P.append(lathe("pring", [(0.0425, -0.292), (0.045, -0.29), (0.045, -0.281), (0.0425, -0.279)], segs=12, m=BRASS, frame=Matrix.Translation((0, 0.03, 0)), smooth_ang=40))
|
||||
P.append(tube("loop", [(0, 0.03, -0.34), (0.045, 0.08, -0.385), (0.0, 0.14, -0.41), (-0.045, 0.08, -0.385), (0, 0.03, -0.34)], lambda s: 0.0105, ROPE, segs=6, per=3, ang=40))
|
||||
# two leather bands where the fingers close
|
||||
for t in (0.3, 0.45):
|
||||
ring_on(P, pth, t, rf(t) + 0.004, 0.028, LEAT)
|
||||
# brass ferrule and an iron collar on the tang
|
||||
FY = Matrix.Translation((0, 0, z)) @ Matrix.Rotation(DEG(90), 4, "X") # local +Z -> world -Y
|
||||
P.append(lathe("ferrule", [(0.0375, 0.29), (0.0405, 0.296), (0.0405, 0.36), (0.0375, 0.368)], segs=12, m=BRASS, frame=FY, smooth_ang=40))
|
||||
P.append(lathe("collar", [(0.03, 0.362), (0.033, 0.368), (0.033, 0.379), (0.03, 0.385), (0.0, 0.385)], segs=12, m=G2, frame=FY, smooth_ang=40))
|
||||
for sx in (-1, 1):
|
||||
UT.stud(P, (sx * 0.04, -0.33, z), (sx, 0, 0), r=0.0085, m=G2, hexa=False, h=0.005)
|
||||
# the crescent: same outer circle as round 2/3, spine outside, edge inside, a narrow neck from the collar
|
||||
c = Vector((0.335, -0.79, 0))
|
||||
S, E = [], []
|
||||
n = 26
|
||||
for i in range(n + 1):
|
||||
ad = 150 + (378 - 150) * i / n
|
||||
u = (ad - 142) / 236
|
||||
a = DEG(ad)
|
||||
r_o = 0.455 - 0.05 * u + 0.012 * math.sin(u * math.pi)
|
||||
w = 0.128 * (1 - u) ** 0.62 * (0.86 + 0.14 * math.sin(min(1.0, u * 2.2) * 1.57)) + 0.005
|
||||
S.append((c.x + r_o * math.cos(a), c.y + r_o * math.sin(a)))
|
||||
E.append((c.x + (r_o - w) * math.cos(a), c.y + (r_o - w) * math.sin(a)))
|
||||
E[-1] = (S[-1][0] - 0.002, S[-1][1] - 0.006)
|
||||
# the neck: from the collar straight into the first station of the crescent, narrowing
|
||||
s0, e0 = Vector((-0.015, -0.372)), Vector((0.015, -0.372))
|
||||
s1, e1 = Vector(S[0]), Vector(E[0])
|
||||
neck = [(s0.lerp(s1, k / 4), e0.lerp(e1, (k / 4) ** 1.4)) for k in range(4)]
|
||||
S = [tuple(a_) for a_, b_ in neck] + S
|
||||
E = [tuple(b_) for a_, b_ in neck] + E
|
||||
# up to 178 degrees the edge runs straight from the collar: the inner circle would bulge back towards the handle and leave a hook
|
||||
j = 4 + next(i for i in range(n + 1) if 150 + 228 * i / n >= 178)
|
||||
L = [0.0]
|
||||
for q in range(1, j + 1):
|
||||
L.append(L[-1] + (Vector(S[q]) - Vector(S[q - 1])).length)
|
||||
for q in range(1, j):
|
||||
E[q] = tuple(e0.lerp(Vector(E[j]), (L[q] / L[j]) ** 1.15))
|
||||
P.append(forged3(S, E, z, 0.03, name="blade", ground=.4, rng=Calm(), P=P, rust={(15, 2)}))
|
||||
# the spine rib
|
||||
rib = [Vector((p[0], p[1], z + 0.012)) for p in S[4:22]]
|
||||
P.append(tube("rib", rib, lambda s: (0.011 * (1 - 0.65 * s), 0.0065), DGY, segs=6, per=2, ang=30))
|
||||
UM.star_badge(P, Vector((-0.004, -0.455, z + 0.0158)), .052, (0, 0, 1))
|
||||
tfin4(P, "Body", uv=2.4, ang=30)
|
||||
return dict(elev=62, azim=-10, dist_mul=.72, views=[("_side", dict(elev=10, azim=-78, dist_mul=.72)), ("_heel", dict(elev=30, azim=150, dist_mul=.74))])
|
||||
|
||||
|
||||
# ======================================================================= hammer
|
||||
|
||||
def hammer():
|
||||
"""Same grip, length and head line as round 3: handle along -Y, the head across it, the round face on +X, the split claw on -X."""
|
||||
P = []
|
||||
hy = -0.56
|
||||
hp = [(0.0, 0.2, 0.0), (0.012, 0.06, 0.0), (0.004, -0.14, 0.0), (0.0, -0.36, 0.0), (0.0, hy - 0.05, 0.0)]
|
||||
pth = UT.Path(hp, per=4)
|
||||
swell = lambda s: math.exp(-((s - 0.18) / 0.22) ** 2)
|
||||
flare = lambda s: max(0.0, (s - .86) / .14) ** 2
|
||||
P.append(tube("handle", hp, lambda s: (0.0305 + 0.007 * swell(s) + 0.012 * flare(s), 0.0215 + 0.005 * swell(s) + 0.0045 * flare(s)), TIM, segs=12, per=5, s=0.9, ang=30))
|
||||
# a moulded rubber grip with a flared butt and three rings, a red band where it stops
|
||||
g0, g1 = 0.0, 0.34
|
||||
gpts = [pth.at(g0 + (g1 - g0) * k / 6) for k in range(7)]
|
||||
gpts[0] = gpts[0] + (gpts[0] - gpts[1]).normalized() * 0.012
|
||||
# a flared butt, four finger swells, a lip where it ends
|
||||
gr = lambda s: (1.0 + 0.22 * max(0.0, 1 - s / 0.11) ** 2 + 0.05 * max(0.0, math.sin((s - 0.2) / 0.62 * 4 * PI)) * (0.2 < s < 0.82)
|
||||
+ 0.06 * max(0.0, (s - 0.93) / 0.07))
|
||||
P.append(tube("grip", resample(gpts, 22), lambda s: (0.0405 * gr(s), 0.0295 * gr(s)), RUB, segs=12, per=1, ang=40))
|
||||
a, b = pth.at(g1 + 0.003), pth.at(g1 + 0.02)
|
||||
P.append(tube("gband", [a, b], lambda s: (0.0408 - 0.004 * s, 0.0298 - 0.003 * s), PRED, segs=12, per=1, ang=30))
|
||||
P.append(tube("thong", [(0, 0.206, 0), (0.042, 0.244, 0), (0.04, 0.29, 0), (0.0, 0.306, 0), (-0.034, 0.276, 0), (-0.028, 0.24, 0), (0, 0.206, 0)], lambda s: 0.0072, LEAT, segs=6, per=3, ang=40))
|
||||
|
||||
# ---- the head. Cheeks: a chamfered block round the eye; the top line runs straight into the claw
|
||||
X, Y, Z = Vector((1, 0, 0)), Vector((0, 1, 0)), Vector((0, 0, 1))
|
||||
HT, HB, HW = 0.058, 0.056, 0.044 # half height up (-Y), down (+Y), half width (Z)
|
||||
body = (DGY, G3)
|
||||
stn = [(-0.07, 0.054, 0.05, 0.04), (-0.058, HT, HB, HW), (0.046, HT, HB, HW), (0.064, 0.05, 0.046, 0.04)]
|
||||
rings = [crect(Vector((x, hy, 0)), Y, Z, -t_, b_, -w_, w_, 0.011) for x, t_, b_, w_ in stn]
|
||||
P.append(rings_mesh("cheek", rings, list(body), colfn=lambda i, j: (1 if j % 2 else 0) if j >= 0 else 0, ang=20))
|
||||
# a narrow neck, then the round poll and the flat striking face
|
||||
FX = M_axis("X", (0, hy, 0))
|
||||
P.append(lathe("neck", [(0.04, 0.05), (0.037, 0.075), (0.0335, 0.098), (0.0345, 0.125), (0.04, 0.158), (0.0465, 0.185), (0.0485, 0.2), (0.0485, 0.213)], segs=16, m=DGY, frame=FX, smooth_ang=34))
|
||||
P.append(lathe("face", [(0.0485, 0.213), (0.0465, 0.2245), (0.0415, 0.232), (0.0, 0.232)], segs=16, m=G5, frame=FX, smooth_ang=30))
|
||||
P.append(lathe("pollband", [(0.0488, 0.196), (0.0492, 0.2), (0.0492, 0.207), (0.0488, 0.211)], segs=16, m=G3, frame=FX, smooth_ang=40))
|
||||
|
||||
# ---- the claw: an outer curve continuing the top line, thinning as it bends back towards the handle, split by a V
|
||||
O = resample([(-0.05, hy - HT, 0), (-0.12, hy - 0.053, 0), (-0.185, hy - 0.032, 0), (-0.238, hy + 0.008, 0), (-0.276, hy + 0.066, 0), (-0.296, hy + 0.128, 0)], 11)
|
||||
m_ = len(O) - 1
|
||||
TN = []
|
||||
for i, p in enumerate(O):
|
||||
T = (O[min(i + 1, m_)] - O[max(i - 1, 0)]).normalized()
|
||||
TN.append(Vector((T.y, -T.x, 0))) # in-plane normal to the concave side (towards the handle)
|
||||
th = lambda t: 0.108 * (1 - t) ** 1.2 + 0.006
|
||||
W = lambda t: 0.042 - 0.01 * t
|
||||
gap = lambda t: 0.0 if t < 0.3 else 0.019 * ((t - 0.3) / 0.7) ** 0.75
|
||||
root = []
|
||||
for i in range(0, 5):
|
||||
t = i / m_
|
||||
root.append(crect(O[i], TN[i], Z, 0.0, th(t), -W(t), W(t), 0.009))
|
||||
P.append(rings_mesh("clawroot", root, list(body), colfn=lambda i, j: (1 if j % 2 else 0) if j >= 0 else 0, ang=24))
|
||||
for sz in (-1, 1):
|
||||
R = []
|
||||
for i in range(3, m_ + 1):
|
||||
t = i / m_
|
||||
g = gap(t) * 0.5 + 0.0012
|
||||
z0, z1 = (g, W(t) + 0.004 * t) if sz > 0 else (-W(t) - 0.004 * t, -g)
|
||||
R.append(crect(O[i], TN[i], Z, 0.0, th(t), z0, z1, 0.0075 * (1 - 0.6 * t)))
|
||||
slot = 0 if sz > 0 else 4 # the face of the prong that looks into the V
|
||||
bright = len(R) - 3
|
||||
|
||||
def cf(i, j, slot=slot, bright=bright):
|
||||
if j < 0:
|
||||
return 2
|
||||
if j == slot:
|
||||
return 2
|
||||
if i >= bright:
|
||||
return 2 if j in (2, 6) or j % 2 else 0
|
||||
return 1 if j % 2 else 0
|
||||
P.append(rings_mesh("prong", R, [DGY, G3, G5], colfn=cf, ang=24))
|
||||
# the handle's end through the eye, a steel wedge across it, two round wedges
|
||||
P.append(tube("eyetop", [Vector((0, hy - 0.05, 0)), Vector((0, hy - HT - 0.0035, 0))], lambda s: (0.03, 0.019), TIM, segs=12, per=1, ang=40))
|
||||
P.append(bx(-0.026, 0.026, hy - HT - 0.0055, hy - HT + 0.004, -0.0032, 0.0032, G4, bev=0.0012, name="wedge"))
|
||||
for x in (-0.016, 0.016):
|
||||
P.append(UT.disc("wedgedot", 0.0045, 0.008, (x, hy - HT - 0.002, 0), G5, n=8, axis="Y"))
|
||||
# the firm's badge on both cheeks
|
||||
for sz in (-1, 1):
|
||||
UM.star_badge(P, Vector((-0.004, hy, sz * (HW + 0.0005))), .064, (0, 0, sz))
|
||||
tfin4(P, "Body", uv=4.0, ang=30)
|
||||
return dict(elev=64, azim=-14, dist_mul=.72, views=[("_head", dict(elev=30, azim=-120, target=(0, -0.56, 0), radius=0.3)), ("_back", dict(elev=20, azim=150, dist_mul=.72))])
|
||||
|
||||
|
||||
# ======================================================================= scythes
|
||||
|
||||
TILT = UT.TILT
|
||||
|
||||
|
||||
def nib4(P, x, y, z_top, m_knob=PRED, r=0.036, z_low=-0.105, wrap=LEAT):
|
||||
"""A turned grip hanging along Z where the fist closes: a painted knob, a leather wrap with welts, rounder than round 2."""
|
||||
fr = Matrix.Translation((x, y, 0))
|
||||
g = lathe("nib", [(r * 0.78, z_low + 0.012), (r * 0.9, z_low + 0.03), (r * 0.98, -0.06), (r * 1.02, -0.02), (r * 0.99, 0.03), (r * 0.88, 0.07), (r * 0.8, z_top - 0.02), (r * 0.74, z_top)], segs=10, m=TIM, frame=fr, smooth_ang=34)
|
||||
FT.grain(g, (0, 0, 1), 1.6, off=(0.03, 0.2))
|
||||
P.append(g)
|
||||
P.append(lathe("knob", [(0.0, z_low - 0.022), (r * 0.72, z_low - 0.022), (r * 1.18, z_low - 0.013), (r * 1.3, z_low + 0.0), (r * 1.22, z_low + 0.013), (r * 0.9, z_low + 0.024)], segs=10, m=m_knob, frame=fr, smooth_ang=40))
|
||||
if wrap:
|
||||
P.append(lathe("wrap", [(r * 0.98, -0.062), (r * 1.1, -0.056), (r * 1.12, 0.014), (r * 1.0, 0.022)], segs=10, m=wrap, frame=fr, smooth_ang=40))
|
||||
for zz in (0.017,):
|
||||
P.append(lathe("welt", [(r * 1.1, zz - 0.004), (r * 1.17, zz - 0.0015), (r * 1.17, zz + 0.0015), (r * 1.1, zz + 0.004)], segs=10, m=BRASS if wrap == LEAT else IRON, frame=fr, smooth_ang=40))
|
||||
|
||||
|
||||
def clamp4(P, pth, t, r, w=0.03, m=IRON, boltside=1):
|
||||
"""An iron band round the snath with a bolt on one side."""
|
||||
a, b = pth.at(t - w / pth.L[-1]), pth.at(t + w / pth.L[-1])
|
||||
P.append(UT.tube("clamp", [a, b], lambda s: r, m, segs=12, ang=30))
|
||||
c = pth.at(t)
|
||||
UT.stud(P, c + Vector((boltside * r, 0, 0)), (boltside, 0, 0), r=r * 0.44, m=G2, h=r * 0.45)
|
||||
|
||||
|
||||
def scythe_blade4(P, hz, y0, L, w0, bow, curl, t, n=18, rust=()):
|
||||
"""The round 2 blade outline with more stations, a straight ground line, no chips."""
|
||||
F = Matrix.Translation((0, y0, hz)) @ Matrix.Rotation(DEG(-TILT), 4, "X") @ Matrix.Translation((0, -y0, -hz))
|
||||
S, E = [], []
|
||||
for i in range(n + 1):
|
||||
u = i / n
|
||||
x = L * u
|
||||
y = y0 - bow * math.sin(u * 2.35) + curl * u ** 3
|
||||
w = w0 * (1 - u) ** 0.62 * (0.8 + 0.2 * math.sin(min(1.0, u * 4) * 1.57)) + 0.007
|
||||
S.append((x, y))
|
||||
E.append((x, y + w))
|
||||
S[-1] = (S[-1][0] + 0.02, S[-1][1] + 0.01)
|
||||
E[-1] = (S[-1][0], S[-1][1] + 0.003)
|
||||
P.append(forged3(S, E, hz, t, frame=F, ground=0.42, rng=Calm(), P=P, rust=rust))
|
||||
return S, F
|
||||
|
||||
|
||||
def cbox(name, x0, x1, y0, y1, z0, z1, ch, mats=(DGY, G3)):
|
||||
"""A box with every edge chamfered by ch: flats take mats[0], chamfers mats[1]."""
|
||||
X, Y, Z = Vector((1, 0, 0)), Vector((0, 1, 0)), Vector((0, 0, 1))
|
||||
cy, cz = (y0 + y1) / 2, (z0 + z1) / 2
|
||||
hy, hz = (y1 - y0) / 2, (z1 - z0) / 2
|
||||
R = [crect(Vector((x0, cy, cz)), Y, Z, -hy + ch, hy - ch, -hz + ch, hz - ch, ch * 0.4),
|
||||
crect(Vector((x0 + ch, cy, cz)), Y, Z, -hy, hy, -hz, hz, ch),
|
||||
crect(Vector((x1 - ch, cy, cz)), Y, Z, -hy, hy, -hz, hz, ch),
|
||||
crect(Vector((x1, cy, cz)), Y, Z, -hy + ch, hy - ch, -hz + ch, hz - ch, ch * 0.4)]
|
||||
return rings_mesh(name, R, list(mats), colfn=lambda i, j: 0 if j < 0 else (1 if (i != 1 or j % 2) else 0), ang=20)
|
||||
|
||||
|
||||
def heel4(P, end, hz, x0=-0.036, x1=0.05, back=0.05, front=0.03, top=0.028, wedge=(0.022, 0.05, 0.03)):
|
||||
"""The socket that takes the snath, chamfered and bolted, a timber wedge driven in beside it, the tang under it."""
|
||||
c = Vector(end)
|
||||
P.append(cbox("socket", x0, x1, c.y - back, c.y + front, hz - 0.012, c.z + top, 0.009))
|
||||
P.append(cbox("wedge", x1 - 0.002, x1 + wedge[0], c.y - 0.01 - wedge[1] / 2, c.y - 0.01 + wedge[1] / 2, c.z - 0.006 - wedge[2] / 2, c.z - 0.006 + wedge[2] / 2, 0.004, mats=(TIM, TIM)))
|
||||
UT.stud(P, (x0 * 0.2 + x1 * 0.2, c.y - 0.01, c.z + top), (0, 0, 1), r=0.013, m=G4, h=0.008)
|
||||
UT.stud(P, (x0, c.y - 0.01, c.z - 0.01), (-1, 0, 0), r=0.012, m=G4, h=0.008)
|
||||
# a ring where the snath goes in
|
||||
P.append(UT.tube("collar", [Vector((0, c.y + front - 0.002, c.z + 0.004)), Vector((0, c.y + front + 0.014, c.z + 0.006))], lambda s: 0.036, G2, segs=12, ang=30))
|
||||
|
||||
|
||||
def snath(P, pts, rf, m, segs=12):
|
||||
P.append(UT.tube("snath", pts, rf, m, segs=segs, per=4, s=0.9, ang=34))
|
||||
return UT.Path(pts, per=6)
|
||||
|
||||
|
||||
def scythe():
|
||||
P = []
|
||||
nibs = ((0.03, -0.04), (-0.03, -0.66))
|
||||
pts = [(0.012, 0.15, 0.116), (0.018, 0.07, 0.13), (0.0, -0.08, 0.125), (-0.02, -0.4, 0.13), (-0.012, -0.72, 0.105), (0.01, -1.02, 0.03), (0.0, -1.27, -0.05)]
|
||||
pth = snath(P, pts, lambda s: 0.0295 - 0.0075 * s, TIM)
|
||||
for (x, y) in nibs:
|
||||
nib4(P, x, y, 0.12, m_knob=PRED)
|
||||
clamp4(P, pth, pth.nearest_y(y), 0.0345, boltside=1 if y > -0.3 else -1)
|
||||
# a leather wrap at the butt, a domed iron cap
|
||||
P.append(UT.tube("buttwrap", [pth.at(0.006), pth.at(0.05), pth.at(0.095)], lambda s: 0.0335, LEAT, segs=12, per=2, ang=30, cap=False))
|
||||
for t in (0.006, 0.095):
|
||||
ring_on(P, pth, t, 0.0352, 0.008, BRASS)
|
||||
P.append(lathe("buttcap", [(0.0, 0.0095), (0.022, 0.0078), (0.031, 0.003), (0.0335, -0.005), (0.031, -0.012)], segs=12, m=G2,
|
||||
frame=Matrix.Translation(pth.at(0.0)) @ Vector((0, 0, 1)).rotation_difference(pth.at(0.0) - pth.at(0.02)).to_matrix().to_4x4(), smooth_ang=40))
|
||||
# painted bands by the fore grip, a whetstone in a cow horn hung off the snath
|
||||
for t0, m in ((.47, PRED), (.495, CRM), (.52, PRED)):
|
||||
ring_on(P, pth, t0 + .008, .0318, .016, m)
|
||||
hook = pth.at(pth.nearest_y(-.26))
|
||||
P.append(UT.tube("hstrap", [hook + Vector((0, -.012, 0)), hook + Vector((0, .012, 0))], lambda s: .0335, LEAT, segs=12, ang=30, cap=False))
|
||||
a = hook + Vector((.03, 0, -.02))
|
||||
hn = [a, a + Vector((.012, 0, -.05)), a + Vector((.03, .004, -.11)), a + Vector((.05, .01, -.19))]
|
||||
P.append(UT.tube("horn", hn, lambda s: .03 * (1 - s) ** .7 + .005, "M_PaintCream", segs=8, per=3, ang=30))
|
||||
P.append(rbox("hone", (.03, .03, .05), tuple(a + Vector((-.003, 0, .03))), bevel=.006, segs=1, m=G3))
|
||||
# the blade
|
||||
end = Vector((0, -1.3, -0.055))
|
||||
hz = -0.095
|
||||
S, F = scythe_blade4(P, hz, -1.3, 0.8, 0.19, 0.13, 0.17, 0.026, rust={(9, 2)})
|
||||
heel4(P, end, hz)
|
||||
P.append(UT.tube("rib", [F @ Vector((p[0], p[1] + 0.008, hz + 0.0135)) for p in S[:14]], lambda s: (0.011 * (1 - 0.5 * s), 0.0075), DGY, segs=4, per=1, ang=30))
|
||||
UM.star_badge(P, F @ Vector((0.1, -1.255, hz + 0.0135)), .05, F.to_3x3() @ Vector((0, 0, 1)))
|
||||
# the grass nail: a thin stay from snath to the back of the blade
|
||||
a = pth.at(pth.nearest_y(-1.08))
|
||||
P.append(UT.tube("nail", [a + Vector((0.0, 0, -0.01)), F @ Vector((S[3][0], S[3][1] + 0.008, hz + 0.014))], lambda s: 0.0075, IRON, segs=6, ang=28))
|
||||
tfin4(P, "Body", uv=2.4, ang=30)
|
||||
return dict(elev=38, azim=-30, dist_mul=.7, views=[("_heel", dict(elev=30, azim=-20, target=(0.15, -1.25, -0.05), radius=0.34)), ("_grip", dict(elev=18, azim=120, target=(0, -0.05, 0.05), radius=0.3))])
|
||||
|
||||
|
||||
def long_scythe():
|
||||
P = []
|
||||
nibs = ((0.03, -0.04), (-0.03, -0.64))
|
||||
pts = [(0.02, 0.15, 0.108), (0.02, 0.07, 0.125), (0.0, -0.2, 0.12), (-0.022, -0.6, 0.12), (-0.012, -1.02, 0.09), (0.008, -1.34, 0.01), (0.0, -1.5, -0.055)]
|
||||
pth = snath(P, pts, lambda s: (0.0295 - 0.0065 * s, 0.0325 - 0.0075 * s), PRED, segs=10)
|
||||
# cream bands on the barn-red paint, bare timber where the paint has worn through at the rear
|
||||
for t0 in (0.33, 0.37, 0.72, 0.76):
|
||||
P.append(UT.tube("stripe", [pth.at(t0), pth.at(t0 + 0.011)], lambda s: (0.0318, 0.0348), CRM, segs=12, ang=30, cap=False))
|
||||
P.append(UT.tube("worn", [pth.at(0.004), pth.at(0.05), pth.at(0.1)], lambda s: 0.0335, TIM, segs=12, per=2, s=0.9, ang=30))
|
||||
P.append(lathe("buttcap", [(0.0, 0.0095), (0.022, 0.0078), (0.031, 0.003), (0.0345, -0.005), (0.032, -0.012)], segs=12, m=BRASS,
|
||||
frame=Matrix.Translation(pth.at(0.0)) @ Vector((0, 0, 1)).rotation_difference(pth.at(0.0) - pth.at(0.02)).to_matrix().to_4x4(), smooth_ang=40))
|
||||
for x, y in nibs:
|
||||
nib4(P, x, y, 0.125, m_knob=GOLD)
|
||||
clamp4(P, pth, pth.nearest_y(y), 0.0365, m=BRASS, boltside=1 if y > -0.3 else -1)
|
||||
end = Vector((0, -1.52, -0.06))
|
||||
hz = -0.098
|
||||
S, F = scythe_blade4(P, hz, -1.52, 1.1, 0.17, 0.15, 0.27, 0.024, n=20, rust={(11, 2)})
|
||||
heel4(P, end, hz)
|
||||
P.append(UT.tube("rib", [F @ Vector((p[0], p[1] + 0.008, hz + 0.0125)) for p in S[:16]], lambda s: (0.011 * (1 - 0.5 * s), 0.0075), IRON, segs=4, per=1, ang=30))
|
||||
# the grain cradle: a post on the snath, three bent timber fingers over the blade, an iron stay tying them to its back
|
||||
py = pth.nearest_y(-1.22)
|
||||
base = pth.at(py)
|
||||
top = Vector((0.05, -1.26, 0.27))
|
||||
P.append(UT.tube("cpost", [base + Vector((0.0, 0, 0.02)), top], lambda s: 0.023, TIM, segs=8, ang=28, s=1.6))
|
||||
clamp4(P, pth, py, 0.0345, boltside=-1)
|
||||
fingers = []
|
||||
ns = len(S) - 1
|
||||
for k, (lift, frac) in enumerate(((0.3, 0.84), (0.205, 0.92), (0.105, 0.98))):
|
||||
Fp = []
|
||||
for i in range(6):
|
||||
u = i / 5
|
||||
q = S[int(round(u * (ns - 2) * frac))]
|
||||
Fp.append(F @ Vector((0.03 + q[0] * 0.98, q[1] + 0.03, hz + lift + (0.03 - 0.02 * k) * math.sin(u * 1.6))))
|
||||
Fp = [base.lerp(top, (1.0, 0.68, 0.36)[k])] + Fp[2:]
|
||||
P.append(UT.tube("finger", Fp, lambda s: 0.0155 - 0.008 * s, TIM, segs=6, per=2, ang=30, s=1.4, u0=0.375))
|
||||
fingers.append(Fp)
|
||||
stay = [fingers[0][3], fingers[1][3], fingers[2][3], F @ Vector((S[10][0], S[10][1] + 0.01, hz + 0.012))]
|
||||
P.append(UT.tube("cstay", stay, lambda s: 0.0088, IRON, segs=6, per=2, ang=28))
|
||||
P.append(UT.tube("cbow", [top, fingers[0][2], fingers[0][3]], lambda s: 0.0088, IRON, segs=6, per=3, ang=28))
|
||||
for k in range(3):
|
||||
c = fingers[k][3]
|
||||
P.append(UT.tube("lash", [c + Vector((0, 0, -0.016)), c + Vector((0, 0, 0.016))], lambda s: 0.0168 - 0.002 * k, TWINE, segs=6, ang=30))
|
||||
tfin4(P, "Body", uv=2.4, ang=30)
|
||||
return dict(elev=38, azim=-30, dist_mul=.7, views=[("_heel", dict(elev=30, azim=-20, target=(0.25, -1.4, 0.05), radius=0.46)), ("_grip", dict(elev=18, azim=120, target=(0, -0.05, 0.05), radius=0.3))])
|
||||
|
||||
|
||||
def wide_scythe():
|
||||
P = []
|
||||
nibs = ((0.03, -0.04), (-0.03, -0.62))
|
||||
pts = [(0.0, 0.13, 0.136), (0.0, 0.05, 0.145), (0.0, -0.3, 0.15), (0.0, -0.8, 0.135), (0.0, -1.3, 0.07), (0.0, -1.62, -0.02), (0.0, -1.74, -0.06)]
|
||||
# a squared green beam with chamfered corners
|
||||
pth = UT.Path(pts, per=6)
|
||||
P.append(UT.tube("snath", pts, lambda s: (0.046 - 0.01 * s, 0.054 - 0.012 * s), TEAL, segs=8, per=4, ang=30, phase=math.pi / 8))
|
||||
for t0 in (0.13, 0.48, 0.82):
|
||||
a, b, c = pth.at(t0), pth.at(t0 + 0.011), pth.at(t0 + 0.022)
|
||||
k = 1 - 0.2 * t0
|
||||
P.append(UT.tube("strap", [a, b, c], lambda s: (0.05 * k, 0.058 * k), IRON, segs=8, per=1, ang=30, phase=math.pi / 8, cap=False))
|
||||
for sx in (-1, 1):
|
||||
UT.stud(P, b + Vector((sx * 0.05 * k, 0, 0)), (sx, 0, 0), r=0.011, m=G4, h=0.007)
|
||||
# a stuffed sacking shoulder pad, roped on
|
||||
P.append(UT.tube("pad", [pth.at(0.0), pth.at(0.06), pth.at(0.12)], lambda s: 0.058 + 0.004 * math.sin(s * PI), "M_Burlap", segs=10, per=3, ang=38, s=5.0, u0=0.5, uw=0.5))
|
||||
for t0 in (0.02, 0.1):
|
||||
P.append(UT.tube("lash", [pth.at(t0), pth.at(t0 + 0.006)], lambda s: 0.0645, ROPE, segs=10, ang=30, cap=False))
|
||||
# D-handles: an iron stirrup from the beam round a vertical timber grip
|
||||
for (x, y) in nibs:
|
||||
nib4(P, x, y, 0.1, m_knob=GOLD, r=0.038, wrap=LEAT)
|
||||
P.append(UT.tube("stirrup", [(x - 0.052, y + 0.05, 0.13), (x - 0.074, y + 0.05, 0.03), (x - 0.074, y + 0.05, -0.1), (x - 0.03, y + 0.02, -0.135), (x, y, -0.135)], lambda s: 0.0088, IRON, segs=6, per=2, ang=28))
|
||||
# the blade: a metre and a third of it, broad, with a riveted back
|
||||
hz = -0.11
|
||||
S, F = scythe_blade4(P, hz, -1.78, 1.42, 0.3, 0.17, 0.42, 0.036, n=20, rust={(5, 2), (13, 2)})
|
||||
on = lambda i, dy=0.012, dz=0.019: F @ Vector((S[i][0], S[i][1] + dy, hz + dz))
|
||||
P.append(UT.tube("back", [on(i) for i in range(20)], lambda s: (0.024 * (1 - 0.72 * s), 0.0105), G2, segs=4, per=1, ang=30))
|
||||
nrm = (F.to_3x3() @ Vector((0, 0, 1))).normalized()
|
||||
for i in (1, 6, 11, 15):
|
||||
UT.stud(P, on(i, dz=0.028), nrm, r=0.013, m=BRASS, h=0.006)
|
||||
# a broad socket, and a brace triangulating the blade off the beam
|
||||
P.append(cbox("socket", -0.062, 0.095, -1.82, -1.68, hz - 0.016, -0.012, 0.012))
|
||||
P.append(cbox("wedge", 0.093, 0.115, -1.795, -1.705, -0.074, -0.026, 0.005, mats=(TIM, TIM)))
|
||||
for x in (-0.03, 0.05):
|
||||
UT.stud(P, (x, -1.75, -0.012), (0, 0, 1), r=0.016, m=G4, h=0.01)
|
||||
b1 = pth.at(pth.nearest_y(-1.36))
|
||||
P.append(UT.tube("strutA", [b1, on(6, dz=0.03)], lambda s: (0.0175, 0.012), IRON, segs=8, ang=28))
|
||||
r0, r1 = b1 + Vector((0, 0.02, 0.05)), on(12, dz=0.03)
|
||||
P.append(UT.tube("strutB", [r0, r1], lambda s: 0.012, G3, segs=8, ang=28))
|
||||
P.append(UT.tube("buckle", [r0.lerp(r1, 0.44), r0.lerp(r1, 0.56)], lambda s: 0.0225, BRASS, segs=8, ang=28))
|
||||
tfin4(P, "Body", uv=2.4, ang=30)
|
||||
return dict(elev=38, azim=-30, dist_mul=.7, views=[("_heel", dict(elev=30, azim=-20, target=(0.3, -1.65, 0.0), radius=0.55)), ("_grip", dict(elev=18, azim=120, target=(0, -0.05, 0.05), radius=0.34))])
|
||||
|
||||
|
||||
# ======================================================================= main
|
||||
|
||||
BUILDERS = {"SM_Tool_NailScissors": nail_scissors, "SM_Tool_GardenShears": garden_shears, "SM_Tool_Sickle": sickle, "SM_Tool_Hammer": hammer,
|
||||
"SM_Tool_Scythe": scythe, "SM_Tool_LongScythe": long_scythe, "SM_Tool_WideScythe": wide_scythe}
|
||||
BUDGET = {n: 3000 for n in BUILDERS}
|
||||
|
||||
if __name__ == "__main__":
|
||||
KIT.build_main(BUILDERS, BUDGET)
|
||||
Reference in New Issue
Block a user