Stylized tools: hand-painted + PBR remake of all seven hand tools

Nail scissors, garden shears, sickle, scythe, long scythe, two-handed
scythe and hammer remade from scratch in Blender in a grounded
hand-painted style, with a metallic/smoothness mask so metal still
shines. Materials come from ArtSource/materials_style.json; the builder
now supports a mask texture and a faint paint glow. Blender sources,
textures and previews live in ArtSource/Blender/stylized.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Bonchellon
2026-12-01 16:30:02 +03:00
parent f3f96ae6b4
commit a3e4f00282
134 changed files with 5065 additions and 31 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,52 @@
"""Every painted tool in ArtSource/Blender/stylized side by side, for review in Blender.
blender -b --factory-startup --python ArtSource/Blender/scripts/gc_style_review.py
Writes ArtSource/Blender/stylized/Style_Tools_Review.blend (opens in Material Preview).
"""
import os
import bpy
from mathutils import Vector
HERE = os.path.dirname(os.path.abspath(__file__))
DIR = os.path.normpath(os.path.join(HERE, "..", "stylized"))
NAMES = ["SM_Tool_NailScissors", "SM_Tool_GardenShears", "SM_Tool_Sickle", "SM_Tool_Hammer",
"SM_Tool_Scythe", "SM_Tool_LongScythe", "SM_Tool_WideScythe"]
bpy.ops.wm.read_factory_settings(use_empty=True)
scene = bpy.context.scene
x = 0.0
for name in NAMES:
path = os.path.join(DIR, name + ".blend")
if not os.path.exists(path):
continue
with bpy.data.libraries.load(path, link=False) as (src, dst):
dst.objects = list(src.objects)
roots = []
for o in dst.objects:
if o is None or o.type not in {"MESH", "EMPTY"}:
continue
scene.collection.objects.link(o)
if o.parent is None:
roots.append(o)
# lay the tool out flat with a gap after the previous one
xs = [(o.matrix_world @ Vector(c)).x for o in dst.objects if o and o.type == "MESH" for c in o.bound_box]
width = (max(xs) - min(xs)) if xs else 0.3
for r in roots:
r.location.x += x - (min(xs) if xs else 0.0)
label = bpy.data.curves.new(name + "_label", "FONT")
label.body = name.replace("SM_Tool_", "")
label.size = 0.08
t = bpy.data.objects.new(name + "_label", label)
t.location = (x, -0.25, -0.4)
scene.collection.objects.link(t)
x += width + 0.35
for area_screen in bpy.data.screens:
for area in area_screen.areas:
if area.type == "VIEW_3D":
for sp in area.spaces:
if sp.type == "VIEW_3D":
sp.shading.type = "MATERIAL"
out = os.path.join(DIR, "Style_Tools_Review.blend")
bpy.ops.wm.save_as_mainfile(filepath=out, check_existing=False)
print("REVIEW", out)

View File

@ -0,0 +1,114 @@
"""GRASS CUTTER - the basic scythe (SM_Tool_Scythe) in the stylized, hand-painted set. Built from gc_style_kit; the other hand tools of the
set are in gc_style_tools.py, which also uses the snath and blade helpers here.
Game frame (round 4, gc_up4_tools.scythe; ViewModel / CrewAvatar hold data depends on it):
one object "Body", no parent, origin at the world origin, identity transform; Blender -Y = Unity forward, blade out on +X;
the snath runs y +0.15 .. -1.27, the blade heel at (0, -1.3, -0.095) tilted 38 degrees, tip at x ~0.82;
nibs (grips) hang along Z at (0.03, -0.04) and (-0.03, -0.66).
Run (absolute paths):
blender -b --factory-startup --python C:/Github/Grass-Cutters/ArtSource/Blender/scripts/gc_style_scythe.py -- [--res 2048] [--samples 128]
[--no-bake (reuse textures/T_Scythe_Painted.png)] [--no-render] [--shots full,mount,...]
Writes ArtSource/Blender/stylized/{SM_Tool_Scythe.blend, fbx/, textures/T_Scythe_Painted.png, previews/SM_Tool_Scythe_*.png}.
"""
import os, sys, math
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import gc_style_kit as K
from mathutils import Vector, Matrix
DEG = math.radians
TILT = 38.0
def tilt_frame(y0, hz):
return Matrix.Translation((0, y0, hz)) @ Matrix.Rotation(DEG(-TILT), 4, "X") @ Matrix.Translation((0, -y0, -hz))
def scythe_outline(y0, L, w0, bow, curl, n=28):
"""Round 4's outline: spine points S and widths W at n + 1 stations, the tip point."""
S, W = [], []
for i in range(n + 1):
u = i / n
S.append(Vector((L * u, y0 - bow * math.sin(u * 2.35) + curl * u ** 3)))
W.append(w0 * (1 - u) ** 0.62 * (0.8 + 0.2 * math.sin(min(1.0, u * 4) * 1.57)) + 0.007)
tip = Vector((S[-1].x + 0.02, S[-1].y + 0.01))
return S, W, tip
def scythe_blade(y0, hz, L, w0, bow, curl, n=28, thick=1.0, name="blade"):
"""The crescent in the round 4 plane: a fat rounded spine, a thick body, a broad ground bevel to a bright edge. Returns (S, W, F)."""
S, W, tip = scythe_outline(y0, L, w0, bow, curl, n)
F = tilt_frame(y0, hz)
E = []
for i in range(n):
t = (S[min(i + 1, n)] - S[max(i - 1, 0)]).normalized()
nrm = Vector((-t.y, t.x))
if nrm.y < 0:
nrm = -nrm
E.append(S[i] + nrm * W[i])
K.blade(name, [(p.x, p.y) for p in S[:n]], [(p.x, p.y) for p in E], F, z0=hz,
rw=lambda u: 0.042 * thick * (1 - 0.35 * u), rh=lambda u: 0.024 * thick * (1.0 - 0.55 * u ** 1.2),
hb=lambda u: (0.0052 * (1 - 0.4 * u) + 0.001) * thick, bev=lambda w, u: min(0.042, 0.36 * w),
tip=(tip.x, tip.y), cuts=(n // 2,))
return S, W, F
def snath(pts, r0, r1, key="wood", cuts=None, sides=8, sq=1.0, n=30):
"""The snath: a chunky chamfered octagon along pts, r0 at the butt to r1 at the blade."""
pth = K.Path(pts)
K.pole("snath", pth, lambda t: r0 + (r1 - r0) * t, key, n=n, cap0=False, cap1=True, cuts=cuts, sides=sides, sq=sq)
return pth
def butt(pth, r0, key_band="brass", key_cap="iron"):
"""A brass band near the butt and a domed dark iron cap."""
K.band("buttband", pth, 0.05, 0.03, r0, 0.0065, key_band)
c0 = pth.at(0.0)
d0 = (pth.at(0.0) - pth.at(0.03)).normalized()
K.lathe("buttcap", [(r0 * 0.96, -0.02), (r0 + 0.0055, -0.016), (r0 + 0.006, -0.004), (r0 + 0.002, 0.004), (r0 * 0.7, 0.013), (r0 * 0.32, 0.0175),
(0.0, 0.019)], key_cap, segs=16, frame=K.frame_z(c0, d0), phase=math.pi / 16)
def nibs_and_clamps(pth, rfun, nibs, z_top=0.12, r=0.036, side_split=-0.3):
for k, (x, y) in enumerate(nibs):
s = pth.nearest_y(y)
ctr = pth.at(s)
K.nib(k, x, y, z_top, r=r, stem_to=ctr.z - 0.015)
K.clamp(k, pth, s, rfun(s), 1 if y > side_split else -1, saddle_xy=(x, y))
def mount(pth, y0, hz, x0=0.007, top_z=-0.0155):
"""The blade mount: a brass collar on the snath end, a dark iron socket with a brass strap and big bolts."""
Ls = pth.len
r = 0.027
K.band("collar", pth, Ls - 0.036, 0.054, r, 0.0095, "brass", ch=0.006)
K.band("collar_lip", pth, Ls - 0.071, 0.012, r, 0.005, "iron", ch=0.003)
yc, zc = y0 - 0.01, (hz + top_z) / 2 - 0.006
sz = top_z - hz + 0.017
K.rbox("socket", (x0, yc, zc), (0.1, 0.098, sz), "iron", bev=0.013, segs=2)
K.rbox("strap", (x0, yc - 0.002, zc), (0.11, 0.036, sz + 0.01), "brass", bev=0.008, segs=2)
K.hexbolt("bolt_top", (x0, yc - 0.002, zc + sz / 2 + 0.005), (0, 0, 1), r=0.017, h=0.012, washer=0.022)
K.hexbolt("bolt_side", (x0 - 0.055, yc - 0.002, zc), (-1, 0, 0), r=0.016, h=0.011, washer=0.021)
SNATH_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)]
def scythe():
r0, r1 = 0.0355, 0.027
pth = snath(SNATH_PTS, r0, r1, cuts=(10, 20))
rfun = lambda s: r0 + (r1 - r0) * s / pth.len
butt(pth, r0)
nibs_and_clamps(pth, rfun, ((0.03, -0.04), (-0.03, -0.66)))
mount(pth, -1.3, -0.095)
scythe_blade(-1.3, -0.095, 0.8, 0.19, 0.13, 0.17)
return dict(res=2048, ps=1.0, full={"full": (38, 150), "full_front": (34, -38)},
views=[("mount", (0.03, -1.28, -0.05), 0.16, 30, 215), ("clamps", (0.0, -0.06, 0.03), 0.17, 16, -55),
("blade_edge", (0.55, -1.25, -0.13), 0.3, 45, 165)])
BUILDERS = {"SM_Tool_Scythe": scythe}
if __name__ == "__main__":
K.run(BUILDERS)

View File

@ -0,0 +1,398 @@
"""GRASS CUTTER - the hand tools in the stylized, hand-painted set (gc_style_kit; the scythe is gc_style_scythe.py).
Each tool keeps round 4's game frame (gc_up4_tools.py: object names, origins, the scissor pivot at (0, -0.145, 0), axes, length, grips),
so ViewModel / CrewAvatar hold data stays valid; check with gc_up5_check.verify against Assets/Art/Models.
SM_Tool_Sickle Body turned octagonal handle with linen wraps, brass ferrule, a thick crescent
SM_Tool_LongScythe Body long snath with linen bands, a wooden grain cradle with lashed fingers
SM_Tool_WideScythe Body a squared ash beam strapped in iron, D-handles, a broad riveted blade on braces
SM_Tool_GardenShears Body, BladeA, BladeB chunky shear blades, wooden handles with linen grips; also exported as SM_Tool_Shears
SM_Tool_NailScissors Body, BladeA, BladeB curved blades, brass bows, a finger rest
SM_Tool_Hammer Body octagonal handle with a linen grip, dark iron head, a bright face, a split claw
Run (absolute paths):
blender -b --factory-startup --python C:/Github/Grass-Cutters/ArtSource/Blender/scripts/gc_style_tools.py -- [names] [--res N] [--samples N]
[--no-bake] [--no-render] [--shots full,...]
"""
import os, sys, math
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import gc_style_kit as K
import gc_style_scythe as SC
from mathutils import Vector, Matrix
DEG = math.radians
PI = math.pi
TAU = 2 * math.pi
PV_Y = -0.145
XU = Vector((1, 0, 0))
# ======================================================================= helpers
def crect(c, U, V, a0, a1, b0, b1, ch):
"""A chamfered rectangle a0..a1 along U, b0..b1 along V round c (8 points)."""
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 pole2(name, pth, rxz, key, n=24, s0=0.0, s1=None, sides=8, ch=0.1, cap0=False, cap1=True, cuts=()):
"""An octagonal pole whose section is rxz(t) = (half width across, half height) at t 0..1 over s0..s1."""
s1 = pth.len if s1 is None else s1
rings = []
for i in range(n + 1):
t = i / n
s = s0 + (s1 - s0) * t
rx, rz = rxz(t)
c = pth.at(s)
T_, X, U = pth.frame(s)
rings.append([c + X * p.x + U * p.y for p in K.oct_section(rz, ch, sides, rx / rz)])
return K.loft(name, rings, key, cap0=cap0, cap1=cap1, cuts=cuts)
def disc(name, c, r, z0, z1, key, segs=16, ch=0.003):
"""A disc about Z at c with chamfered rims, z0 -> z1 (either way up)."""
lo, hi = min(z0, z1), max(z0, z1)
ch = min(ch, (hi - lo) * 0.45)
return K.lathe(name, [(0.0, lo), (r - ch, lo), (r, lo + ch), (r, hi - ch), (r - ch, hi), (0.0, hi)], key, segs=segs,
frame=Matrix.Translation((c[0], c[1], 0)))
def resample(pts, n):
P = K.Path(pts)
return [P.at(P.len * i / n) for i in range(n + 1)]
# ======================================================================= sickle
def sickle():
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 = K.Path(hp, up=XU)
def rf(t): # a turned profile: a swell under the palm, a waist, a taper into the ferrule (chunkier than round 4)
return 0.043 + 0.01 * math.exp(-((t - 0.2) / 0.13) ** 2) + 0.004 * math.exp(-((t - 0.47) / 0.08) ** 2) - 0.005 * max(0.0, (t - 0.62) / 0.38)
K.pole("handle", pth, rf, "wood", n=28, cap0=True, cap1=False, cuts=(14,))
for t, w in ((0.3, 0.05), (0.45, 0.05)): # two padded linen wraps where the fingers close
K.band(f"wrap{t}", pth, pth.len * t, w, rf(t), 0.006, "wrap", ch=0.008)
# a chunky wooden pommel with a brass ring, a linen cord loop through it
fr = Matrix.Translation((0, 0.031, 0))
K.lathe("pommel", [(0.0, -0.352), (0.03, -0.352), (0.048, -0.343), (0.054, -0.326), (0.05, -0.305), (0.043, -0.29)], "knob", segs=12, frame=fr)
K.lathe("pring", [(0.0445, -0.296), (0.0485, -0.292), (0.0485, -0.279), (0.0445, -0.275)], "brass", segs=12, frame=fr)
K.tube("loop", [(0, 0.03, -0.345), (0.045, 0.08, -0.385), (0.0, 0.14, -0.41), (-0.045, 0.08, -0.385), (0, 0.03, -0.345)], lambda t: 0.011,
"wrap", segs=8, cap0=False, cap1=False)
# brass ferrule and a dark iron collar on the tang, rivets either side
FY = Matrix.Translation((0, 0, z)) @ Matrix.Rotation(DEG(90), 4, "X") # local +Z -> world -Y
K.lathe("ferrule", [(0.0385, 0.288), (0.0435, 0.294), (0.0435, 0.356), (0.0385, 0.364)], "brass", segs=12, frame=FY)
K.lathe("collar", [(0.031, 0.358), (0.0355, 0.364), (0.0355, 0.378), (0.031, 0.386), (0.0, 0.386)], "iron", segs=12, frame=FY)
for sx in (-1, 1):
K.dome(f"rivet{sx}", (sx * 0.043, -0.325, z), (sx, 0, 0), 0.009, 0.006, "iron")
# the crescent: round 4's outline, 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(Vector((c.x + r_o * math.cos(a), c.y + r_o * math.sin(a))))
E.append(Vector((c.x + (r_o - w) * math.cos(a), c.y + (r_o - w) * math.sin(a))))
s0, e0 = Vector((-0.017, -0.37)), Vector((0.017, -0.37))
neck = [(s0.lerp(S[0], k / 4), e0.lerp(E[0], (k / 4) ** 1.4)) for k in range(4)]
S = [a_ for a_, b_ in neck] + S
E = [b_ for a_, b_ in neck] + E
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] + (S[q] - S[q - 1]).length)
for q in range(1, j):
E[q] = e0.lerp(E[j], (L[q] / L[j]) ** 1.15)
tip = S[-1] + (S[-1] - S[-2]).normalized() * 0.012
K.blade("blade", [tuple(p) for p in S[:-1]], [tuple(p) for p in E[:-1]], Matrix.Identity(4), z0=z,
rw=lambda u: 0.03 * (1 - 0.4 * u), rh=lambda u: 0.018 * (1 - 0.5 * u), hb=lambda u: 0.0045 * (1 - 0.35 * u) + 0.0008,
bev=lambda w, u: min(0.03, 0.36 * w), tip=tuple(tip), cuts=(16,), under=0.8)
return dict(res=2048, ps=0.75, full={"full": (60, -12), "full_side": (18, -70)},
views=[("neck", (0.0, -0.36, 0.25), 0.1, 35, -40), ("blade", (0.25, -0.95, 0.26), 0.3, 62, 10)])
# ======================================================================= long scythe
def long_scythe():
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)]
r0, r1 = 0.036, 0.028
pth = SC.snath(pts, r0, r1, cuts=(8, 16), n=24)
rfun = lambda s: r0 + (r1 - r0) * s / pth.len
SC.butt(pth, r0)
for t0 in (0.335, 0.375, 0.725, 0.765): # linen bands on the snath
s = pth.len * t0
K.band(f"stripe{t0}", pth, s, 0.018, rfun(s), 0.0035, "wrap", ch=0.003)
SC.nibs_and_clamps(pth, rfun, ((0.03, -0.04), (-0.03, -0.64)), z_top=0.125)
y0, hz = -1.52, -0.098
SC.mount(pth, y0, hz)
SC.scythe_blade(y0, hz, 1.1, 0.17, 0.15, 0.27, n=26)
# the grain cradle: a post on the snath, three bent wooden fingers over the blade, an iron stay tying them to its back
S, W, tip = SC.scythe_outline(y0, 1.1, 0.17, 0.15, 0.27, n=20)
S[-1] = tip
F = SC.tilt_frame(y0, hz)
sp = pth.nearest_y(-1.22)
base = pth.at(sp)
top = Vector((0.05, -1.26, 0.262))
K.pole("cpost", K.Path([base + Vector((0, 0, 0.02)), top]), lambda t: 0.024 - 0.004 * t, "wood", n=6, cuts=())
K.clamp("c", pth, sp, rfun(sp), -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.x * 0.98, q.y + 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:]
K.pole(f"finger{k}", K.Path([Fp[0]] + Fp[2:]), lambda t: 0.0165 - 0.008 * t, "wood", n=12, cuts=(), sides=6)
fingers.append(Fp)
stay = [fingers[0][3], fingers[1][3], fingers[2][3], F @ Vector((S[10].x, S[10].y + 0.01, hz + 0.02))]
K.tube("cstay", stay, lambda t: 0.0095, "iron", segs=8)
K.tube("cbow", [top, fingers[0][2], fingers[0][3]], lambda t: 0.0095, "iron", segs=8)
for k in range(3):
c = fingers[k][3]
K.lathe(f"lash{k}", [(0.017 - 0.002 * k, -0.018), (0.0205 - 0.002 * k, -0.012), (0.0205 - 0.002 * k, 0.012), (0.017 - 0.002 * k, 0.018)], "wrap",
segs=10, frame=Matrix.Translation(c))
K.dome("ctop", top, (0.1, 0, 1), 0.026, 0.016, "brass", segs=12)
return dict(res=2048, ps=1.0, full={"full": (36, 150), "full_front": (34, -38)},
views=[("cradle", (0.28, -1.33, 0.08), 0.36, 32, -25), ("mount", (0.03, -1.5, -0.05), 0.17, 30, 215),
("blade_edge", (0.7, -1.45, -0.12), 0.36, 45, 165)])
# ======================================================================= wide scythe
def wide_scythe():
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)]
pth = K.Path(pts)
rz = lambda t: 0.055 - 0.012 * t
sq = 0.85
# a squared ash beam, chamfered corners
K.pole("beam", pth, rz, "wood", n=30, cap0=True, cap1=True, cuts=(10, 20), sides=4, ch=0.16, sq=sq)
for k, t0 in enumerate((0.13, 0.48, 0.82)):
s = pth.len * t0
K.band(f"strap{k}", pth, s, 0.034, rz(t0), 0.007, "iron", ch=0.005, sides=4, sq=sq)
c = pth.at(s)
for sx in (-1, 1):
K.hexbolt(f"sb{k}{sx}", c + Vector((sx * (rz(t0) * sq + 0.006), 0, 0)), (sx, 0, 0), r=0.012, h=0.009, washer=0.016)
# a padded linen shoulder sleeve, lashed with brass bands
K.pole("pad", pth, lambda t: 0.07 + 0.006 * math.sin(t * PI), "wrap", n=8, s0=0.0, s1=pth.len * 0.12, sides=8, cap0=True, cap1=True, cuts=())
for k, t0 in enumerate((0.025, 0.095)):
K.band(f"lash{k}", pth, pth.len * t0, 0.012, 0.073, 0.006, "brass", ch=0.003)
# D-handles: an iron stirrup from the beam round a vertical grip
for k, (x, y) in enumerate(((0.03, -0.04), (-0.03, -0.62))):
K.nib(k, x, y, 0.1, r=0.038, stem_to=0.1)
K.tube(f"stirrup{k}", [(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 t: 0.011, "iron", segs=8)
# the blade: broad, a thick spine with brass rivets
y0, hz = -1.78, -0.11
S, W, F = SC.scythe_blade(y0, hz, 1.42, 0.3, 0.17, 0.42, n=32, thick=1.25)
for i in (2, 8, 14, 20):
t = (S[i + 1] - S[i - 1]).normalized()
nrm = Vector((-t.y, t.x))
if nrm.y < 0:
nrm = -nrm
p = S[i] + nrm * 0.018
K.dome(f"rivet{i}", F @ Vector((p.x, p.y, hz + 0.028 * (1 - 0.4 * i / 32))), F.to_3x3() @ Vector((0, 0, 1)), 0.012, 0.008, "brass")
# a broad socket with a brass strap, a wooden wedge, two big bolts
K.rbox("socket", (0.0165, -1.75, -0.069), (0.157, 0.14, 0.114), "iron", bev=0.016, segs=2)
K.rbox("sstrap", (0.0165, -1.75, -0.069), (0.167, 0.04, 0.124), "brass", bev=0.009, segs=2)
K.rbox("wedge", (0.104, -1.712, -0.05), (0.024, 0.05, 0.048), "wood", bev=0.007, segs=2)
for x in (-0.03, 0.05):
K.hexbolt(f"sbolt{x}", (x, -1.75 + (0.035 if x < 0 else -0.035), -0.007), (0, 0, 1), r=0.017, h=0.012, washer=0.022)
# braces from the beam to the blade's back, a brass turnbuckle on the second
on = lambda i, dz=0.03: F @ Vector((S[i].x, S[i].y + 0.012, hz + dz))
b1 = pth.at(pth.nearest_y(-1.36))
K.tube("strutA", [b1, on(7)], lambda t: (0.017, 0.013), "iron", segs=8)
r0_, r1_ = b1 + Vector((0, 0.02, 0.05)), on(14)
K.tube("strutB", [r0_, r1_], lambda t: 0.0125, "iron", segs=8)
K.tube("buckle", [r0_.lerp(r1_, 0.42), r0_.lerp(r1_, 0.58)], lambda t: 0.022, "brass", segs=8)
for i, p in ((7, on(7)), (14, on(14))):
K.dome(f"foot{i}", p + F.to_3x3() @ Vector((0, 0, -0.004)), F.to_3x3() @ Vector((0, 0, 1)), 0.02, 0.01, "iron")
return dict(res=2048, ps=1.0, full={"full": (36, 150), "full_front": (34, -38)},
views=[("mount", (0.03, -1.74, -0.07), 0.2, 30, 215), ("braces", (0.38, -1.6, 0.0), 0.45, 42, -12),
("grip", (-0.01, -0.06, 0.0), 0.2, 12, 120)])
# ======================================================================= garden shears (and SM_Tool_Shears)
def blade_stations(sx, py, ty, hw, he, cfn, notch=None, n=14, heel=0.03):
S, E = [], []
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
h_e = he(u) * k - (notch(u) if notch else 0.0)
S.append((c - sx * hw(u) * k, y))
E.append((c + sx * h_e, y))
tipc = (cfn(1.0) + sx * he(1.0) * 0.4, ty)
return S, E, tipc
def garden_shears():
py, ty = PV_Y, -0.62
z_in = 0.0008
tf = lambda u: 0.016 * (1 - 0.45 * u) + 0.0025
def hw(u):
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)):
K.group(nm)
S, E, tipc = blade_stations(sx, py, ty, hw, he, cfn, notch if sx > 0 else None, n=16)
K.shear_blade("blade", sx, sz, S, E, z_in, tf, tip=tipc, cuts=(8,))
zc = sz * (z_in + t0 * 0.5)
hz = sz * 0.011
disc("boss", (0, py), 0.036, sz * z_in, sz * (z_in + t0), "iron", ch=0.005)
fr0 = Vector((sx * 0.031, -0.05, hz))
K.tube("tang", [Vector((sx * 0.004, py + 0.012, zc)), Vector((sx * 0.012, -0.095, zc)), Vector((sx * 0.024, -0.066, hz)), fr0],
lambda t: (0.0155 - 0.002 * t, 0.0075 + 0.004 * t), "iron", segs=8)
hp = K.Path([fr0, Vector((sx * 0.038, 0.0, hz)), Vector((sx * 0.044, 0.08, hz)), Vector((sx * 0.046, 0.168, hz))])
K.pole("handle", hp, lambda t: 0.0185 + 0.003 * math.sin(t * PI), "wood", n=14, cap0=False, cap1=False, cuts=())
K.lathe("ferrule", [(0.019, -0.016), (0.0225, -0.012), (0.0235, -0.006), (0.0235, 0.016), (0.0215, 0.022), (0.019, 0.024)], "brass", segs=12,
frame=K.frame_z(fr0, (0, 1, 0)))
for yy in (-0.036,):
K.lathe("fring", [(0.022, -0.003), (0.025, -0.002), (0.025, 0.002), (0.022, 0.003)], "iron", segs=12, frame=K.frame_z((sx * 0.0315, yy, hz), (0, 1, 0)))
# a padded linen grip in three pillows, a chunky wooden end knob
gs0, gs1 = hp.nearest_y(0.05), hp.len
gr = lambda t: 0.023 + 0.0035 * max(0.0, 1 - t / 0.08) + 0.0028 * abs(math.sin(t * PI * 3.0)) ** 0.7 * (1 if t < 0.9 else 0)
K.pole("grip", hp, gr, "wrap", n=24, s0=gs0, s1=gs1, cap0=False, cap1=False, cuts=())
end = hp.at(hp.len)
K.lathe("knob", [(0.0, -0.004), (0.022, -0.004), (0.0275, 0.004), (0.026, 0.014), (0.019, 0.021), (0.0, 0.023)], "knob", segs=12,
frame=K.frame_z(end, (0, 1, 0)))
K.lathe("bump", [(0.0, 0.0), (0.0095, 0.0), (0.0095, 0.008), (0.0065, 0.012), (0.0, 0.012)], "knob", segs=8,
frame=K.frame_z((sx * 0.019, -0.062, hz), (-sx, 0, 0)))
if sx < 0: # a linen cord loop through the end of one handle
e = end + Vector((0, 0.014, 0))
K.tube("lanyard", [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))], lambda t: (0.0075, 0.0058), "knob", segs=8, cap0=True, cap1=True)
K.group("Body")
zt = z_in + t0
fr = Matrix.Translation((0, py, 0))
K.lathe("head", [(0.0, zt - 0.001), (0.019, zt - 0.001), (0.019, zt + 0.0035), (0.015, zt + 0.0075), (0.0, zt + 0.009)], "brass", segs=14, frame=fr)
K.lathe("nut", [(0.0, -zt + 0.001), (0.0165, -zt + 0.001), (0.0165, -zt - 0.0065), (0.013, -zt - 0.009), (0.0, -zt - 0.009)], "iron", segs=6, frame=fr,
phase=PI / 6)
disc("shaft", (0, py), 0.008, -zt, zt, "iron", segs=8)
return dict(res=2048, ps=0.6, origins={"BladeA": (0, PV_Y, 0), "BladeB": (0, PV_Y, 0)}, also=["SM_Tool_Shears"],
full={"full": (60, -12), "full_under": (-50, -12)},
views=[("pivot", (0.0, -0.145, 0.0), 0.09, 50, -25), ("grips", (0.0, 0.1, 0.0), 0.16, 45, -20)])
# ======================================================================= nail scissors
def nail_scissors():
py, ty = PV_Y, -0.455
z_in = 0.0006
tf = lambda u: 0.0115 * (1 - 0.6 * u) + 0.002
hw = lambda u: 0.0285 * (1 - u) ** 0.85 + 0.0018
he = lambda u: 0.021 * (1 - u) ** 0.95 + 0.0012
cfn = lambda u: -0.02 * u ** 2.2
t0 = tf(0.0)
for nm, sx, sz in (("BladeA", 1, 1), ("BladeB", -1, -1)):
K.group(nm)
S, E, tipc = blade_stations(sx, py, ty, hw, he, cfn, n=14, heel=0.022)
K.shear_blade("blade", sx, sz, S, E, z_in, tf, tip=tipc, cuts=(7,))
zc = sz * (z_in + t0 * 0.5)
disc("boss", (0, py), 0.024, sz * z_in, sz * (z_in + t0), "iron", ch=0.0035)
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))
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]
K.tube("shank", sh, lambda t: (0.0115 - 0.0022 * t, 0.0075), "iron", segs=8)
K.tube("collar", [entry + (sh[-2] - entry).normalized() * 0.014, entry + (sh[-2] - entry).normalized() * 0.002], lambda t: (0.0128, 0.0094), "brass",
segs=8)
# the bow: a brass oval loop
K.oval_ring("bow", cb, rx, ry, 0.0118, 0.0095, "brass", seg=20, rseg=8, z=zc)
if big:
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))]
K.tube("spur", spur, lambda t: (0.0072 * (1 - 0.45 * t), 0.0058 * (1 - 0.3 * t)), "iron", segs=8)
K.dome("spurtip", spur[-1] + Vector((0, 0, -0.004)), (0, 0, 1), 0.0068, 0.009, "brass", segs=10)
K.group("Body")
zt = z_in + t0
fr = Matrix.Translation((0, py, 0))
K.lathe("head", [(0.0, zt - 0.001), (0.013, zt - 0.001), (0.013, zt + 0.002), (0.0098, zt + 0.0048), (0.0, zt + 0.006)], "brass", segs=14, frame=fr)
K.lathe("nut", [(0.0, -zt + 0.001), (0.0115, -zt + 0.001), (0.0115, -zt - 0.003), (0.0088, -zt - 0.0045), (0.0, -zt - 0.0045)], "iron", segs=6, frame=fr,
phase=PI / 6)
disc("shaft", (0, py), 0.006, -zt, zt, "iron", segs=8)
return dict(res=1024, ps=0.45, origins={"BladeA": (0, PV_Y, 0), "BladeB": (0, PV_Y, 0)},
full={"full": (60, -12), "full_under": (-50, -12)},
views=[("pivot", (0.0, -0.145, 0.0), 0.06, 50, -25), ("bows", (0.0, 0.03, 0.0), 0.12, 50, -15)])
# ======================================================================= hammer
def hammer():
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 = K.Path(hp)
swell = lambda t: math.exp(-((t - 0.18) / 0.22) ** 2)
flare = lambda t: max(0.0, (t - .86) / .14) ** 2
pole2("handle", pth, lambda t: (0.031 + 0.007 * swell(t) + 0.012 * flare(t), 0.022 + 0.005 * swell(t) + 0.0045 * flare(t)), "wood", n=28,
cap0=True, cap1=True, cuts=(14,))
# a padded linen grip: a flared butt, finger pillows, a lip; a brass band where it stops
g1 = 0.34 * pth.len
gr = lambda t: (1.0 + 0.22 * max(0.0, 1 - t / 0.11) ** 2 + 0.06 * max(0.0, math.sin((t - 0.2) / 0.62 * 4 * PI)) * (0.2 < t < 0.82)
+ 0.06 * max(0.0, (t - 0.93) / 0.07))
pole2("grip", pth, lambda t: (0.0415 * gr(t), 0.0305 * gr(t)), "wrap", n=28, s0=0.0, s1=g1, cap0=True, cap1=False)
pole2("gband", pth, lambda t: (0.0435 - 0.003 * t, 0.032 - 0.002 * t), "brass", n=2, s0=g1 + 0.002, s1=g1 + 0.022, cap0=True, cap1=True)
K.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 t: 0.0095, "knob", segs=8, cap0=False, cap1=False)
# the head: a rounded dark iron block round the eye, a neck, a brass band, a bright striking face on +X
HT, HB, HW = 0.058, 0.056, 0.044
K.rbox("cheek", (-0.003, hy - (HT - HB) / 2, 0.0), (0.134, HT + HB, 2 * HW), "iron", bev=0.012, segs=2)
FX = K.frame_z((0, hy, 0), (1, 0, 0))
K.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)],
"iron", segs=16, frame=FX)
K.lathe("face", [(0.0485, 0.213), (0.0465, 0.2245), (0.0415, 0.232), (0.0, 0.232)], "steel", segs=16, frame=FX)
K.lathe("pollband", [(0.0488, 0.19), (0.0515, 0.194), (0.0515, 0.207), (0.0488, 0.211)], "brass", segs=16, frame=FX)
# the claw: an outer curve continuing the top line, thinning as it bends back, 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)))
Zv = Vector((0, 0, 1))
th = lambda t: 0.108 * (1 - t) ** 1.2 + 0.008
W = lambda t: 0.043 - 0.01 * t
gap = lambda t: 0.0 if t < 0.3 else 0.019 * ((t - 0.3) / 0.7) ** 0.75
K.loft("clawroot", [crect(O[i], TN[i], Zv, 0.0, th(i / m_), -W(i / m_), W(i / m_), 0.011) for i in range(0, 5)], "iron", cap0=True, cap1=True)
for sz in (-1, 1):
R = []
for i in range(3, m_ + 1):
t = i / m_
g = gap(t) * 0.5 + 0.0012
wo = W(t) * (0.97 + 0.1 * max(0.0, t - 0.3)) # inside the root where they overlap, a touch proud beyond it
z0, z1 = (g, wo) if sz > 0 else (-wo, -g)
k_ = 0.985 if i <= 4 else 1.0
R.append(crect(O[i], TN[i], Zv, 0.0, th(t) * k_, z0, z1, 0.009 * (1 - 0.5 * t)))
K.loft(f"prong{sz}", R, "iron", cap0=False, cap1=True)
# the handle's end through the eye, a steel wedge across it
K.tube("eyetop", [Vector((0, hy - 0.05, 0)), Vector((0, hy - HT - 0.004, 0))], lambda t: (0.031, 0.02), "wood", segs=10, n=2)
K.rbox("wedge", (0.0, hy - HT - 0.0045, 0.0), (0.054, 0.009, 0.007), "steel", bev=0.002, segs=1)
return dict(res=2048, ps=0.6, full={"full": (64, -14), "full_back": (22, 150)},
views=[("head", (-0.03, -0.56, 0.0), 0.2, 30, -120), ("grip", (0.0, 0.1, 0.0), 0.18, 30, 40)])
BUILDERS = {"SM_Tool_Sickle": sickle, "SM_Tool_LongScythe": long_scythe, "SM_Tool_WideScythe": wide_scythe,
"SM_Tool_GardenShears": garden_shears, "SM_Tool_NailScissors": nail_scissors, "SM_Tool_Hammer": hammer}
if __name__ == "__main__":
K.run(BUILDERS)