Ratchet Wrench
A printed ratchet handle for 1/4 inch (6.35 mm) hex bits. A saw-tooth wheel with a hex socket right through it runs in the head, and a pawl whose spring is a thin printed leaf locks it in one direction and clicks over the teeth in the other; flip the wrench over to drive the other way. The pawl is a strut from its pivot barrel to the radial tooth flank and the line of force passes beside the pivot so that load pulls the nose deeper into the tooth; locking, free running with the pawl swung out and all part clearances are asserted in the code. The default is about 148 x 35 x 13 mm assembled, with 12 teeth for a 30 degree click, and the print plate is 148 x 76 x 13 mm. Four parts printed flat without supports (handle, wheel, pawl, cover), closed by four M3 x 10 screws driven into printed pilot holes. Parameters: bit size and fit, number and height of teeth, wheel thickness, spring leaf thickness and length, handle length and width, clearance. A printed tool for light work, not a replacement for a steel one.
# Ratchet Wrench - printed ratchet handle for 1/4 inch hex bits with a flexure pawl
#
# Four printed parts: the handle with an open pocket in its head, a ratchet wheel with a
# hex socket right through it, a pawl whose spring is a thin printed leaf, and a cover
# held by four M3 x 10 screws driven into printed pilot holes.
# The wheel has saw teeth: one flank of every tooth is radial, the other is a ramp. The
# pawl is a strut from its pivot barrel to the radial flank, so turning the handle one
# way locks wheel and handle together, and the line of force passes beside the pivot on
# the side that pulls the nose deeper into the tooth. Turning back, the ramps lift the
# nose and the leaf (it lies in a slot along the handle, its foot on the slot wall)
# pushes it back with a click. The socket is open on both faces: flip the wrench over to
# drive the other way.
# Print everything flat as laid out, no supports: handle with the pocket up, wheel with
# its journal up, pawl and cover as drawn. Assemble: wheel journal into the floor hole,
# pawl barrel into its socket with the leaf in the slot, cover, screws.
# A printed tool for light work (bits, small screws), not a replacement for a steel one.
@param choices:["print", "assembled", "open"] desc:"Print plate, assembled, or assembled without the cover"
$view = "print"
@param 6..8.2 step:0.05 group:"Bit" desc:"Hex size of the bit across flats (6.35 = 1/4 inch)"
$bit_af = 6.35
@param 0.05..0.4 step:0.05 group:"Bit" desc:"Clearance of the hex socket per side (mm)"
$hex_fit = 0.15
@param 8..18 group:"Ratchet" desc:"Number of teeth (click angle = 360 / teeth)"
$teeth = 12
@param 1.5..3.5 step:0.1 group:"Ratchet" desc:"Tooth height (mm)"
$tooth_h = 2.5
@param 6..12 step:0.5 group:"Ratchet" desc:"Thickness of wheel and pawl (mm)"
$wheel_t = 8
@param 0.6..1.2 step:0.1 group:"Ratchet" desc:"Thickness of the spring leaf (mm)"
$leaf_t = 0.8
@param 24..40 group:"Ratchet" desc:"Length of the spring leaf (mm)"
$leaf_len = 30
@param 100..200 step:5 group:"Handle" desc:"Length from the socket axis to the end of the handle (mm)"
$handle_len = 130
@param 16..26 group:"Handle" desc:"Width of the handle (mm)"
$handle_w = 18
@param 0.2..0.4 step:0.05 group:"Print" desc:"Clearance between moving parts (mm)"
$gap = 0.3
# --- derived dimensions ---------------------------------------------------------------
$floor_t = 2.4 # floor under the pocket
$cover_t = 2.4
$r_hex = ($bit_af / 2 + $hex_fit) / cos(30) # corner radius of the socket
$r_j = $r_hex + 3 # journal that runs in the floor hole
$r_root = $r_j + 2 # root circle of the teeth (2 mm shoulder on the floor)
$r_tip = $r_root + $tooth_h
$r_pk = $r_tip + $gap # bore of the pocket: the tooth tips run in it
$r_head = $r_pk + 6
$pitch = 360 / $teeth
$z0 = $floor_t + 0.2 # underside of wheel and pawl when assembled
$body_h = $floor_t + $wheel_t + 0.4 # 0.2 mm above and below the wheel
$hw = $handle_w / 2
# pawl: nose on the radial flank at angle th_c, strut of length arm_len to the pivot P
$th_c = 35 # angle of the flank the pawl rests on
$lead = 25 # the strut leans outward from the tangent by this
$arm_len = 11
$r_b = 3.5 # pivot barrel radius
$flank_gap = 1 # deg between nose and flank as drawn
$nose_lift = 0.3 # nose above the root circle
$r_c = ($r_root + $r_tip) / 2
$a_d = $th_c - 90 + $lead # direction of the strut, nose to pivot
$px = $r_c * cos($th_c) + $arm_len * cos($a_d)
$py = $r_c * sin($th_c) + $arm_len * sin($a_d)
$th_n = $th_c - $flank_gap
$n1x = ($r_root + $nose_lift) * cos($th_n)
$n1y = ($r_root + $nose_lift) * sin($th_n)
$n2x = ($r_tip + 0.8) * cos($th_n)
$n2y = ($r_tip + 0.8) * sin($th_n)
$b1x = $px + $r_b * cos($a_d + 90) # outer side of the barrel
$b1y = $py + $r_b * sin($a_d + 90)
$b2x = $px - 1.0 * cos($a_d + 90) # inner side: kept narrow so the next tooth tip passes
$b2y = $py - 1.0 * sin($a_d + 90)
# angle the pawl must swing out for a tooth tip to pass under the nose
$swing = degrees(($tooth_h - $nose_lift + 0.5) / $arm_len)
# the tooth pushes the nose along the tangent; its lever arm about the pivot is
# arm_len * sin(lead) on the side that turns the nose inward: the pawl is self-engaging
$lock_arm = $arm_len * sin($lead)
assert $lock_arm >= 2
assert $tooth_h - $nose_lift >= 1.2 # depth of engagement
assert sqrt($px * $px + $py * $py) - $r_b >= $r_tip + 1 # barrel outside the tip circle
# spring leaf: root turns by swing, tip is held: surface strain = 1.5 t theta / L
$strain = 1.5 * $leaf_t * radians($swing) / $leaf_len
assert $strain <= 0.015
# the leaf rests on a foot so it can bow under itself: sag = 0.19 theta L, plus 0.5 mm
$foot_h = 0.19 * radians($swing) * $leaf_len + 0.5
$leaf_y1 = $py + $r_b # top of the leaf
$leaf_y0 = $leaf_y1 - $leaf_t
$slot_y0 = $leaf_y0 - $foot_h - 0.1
$slot_y1 = $leaf_y1 + 0.5
$x_cov = $px + $leaf_len + 5 # end of the cover = end of the taper
assert $handle_len - $hw >= $x_cov + 20
# --- ratchet wheel (as assembled: journal down, flush with the underside) ---------------
def tr($i) = if $i % 2 == 0 then $r_root else $r_tip
def ta($i) = $th_c + ($i // 2) * $pitch
$tooth_pts = [(tr($i) * cos(ta($i)), tr($i) * sin(ta($i))) for $i in range(2 * $teeth)]
$teeth3 = polyline $tooth_pts | extrude $wheel_t | translate 0 0 $z0
$journal = cylinder $r_j ($z0 + 0.1) center:(true, true, false)
$hexcut = polygon 6 $r_hex | extrude ($body_h + 2) | translate 0 0 (-1)
$wheel0 = union [$teeth3, $journal]
$wheel = $wheel0 - $hexcut
assert $wheel.solids == 1
# --- pawl: barrel, strut with the nose, spring leaf with a foot --------------------------
def rx($x, $y, $a) = $px + ($x - $px) * cos($a) - ($y - $py) * sin($a)
def ry($x, $y, $a) = $py + ($x - $px) * sin($a) + ($y - $py) * cos($a)
def strut2d($a) = polyline [(rx($n1x, $n1y, $a), ry($n1x, $n1y, $a)), (rx($n2x, $n2y, $a), ry($n2x, $n2y, $a)), (rx($b1x, $b1y, $a), ry($b1x, $b1y, $a)), (rx($b2x, $b2y, $a), ry($b2x, $b2y, $a))]
$strut = strut2d(0) | extrude $wheel_t
$barrel = cylinder $r_b $wheel_t center:(true, true, false) | translate $px $py 0
$leaf = box $leaf_len $leaf_t $wheel_t center:(false, false, false) | translate $px $leaf_y0 0
$foot = box 2.5 ($foot_h + 0.2) $wheel_t center:(false, false, false) | translate ($px + $leaf_len - 2.5) ($leaf_y0 - $foot_h) 0
$rigid0 = union [$strut, $barrel]
$pawl0 = union [$strut, $barrel, $leaf, $foot]
$rigid = $rigid0 | translate 0 0 $z0 # the pawl without its spring, for the swing checks
$pawl = $pawl0 | translate 0 0 $z0
assert $pawl.solids == 1
def swung($a) = $rigid | rotate 0 0 (-$a) origin:($px, $py, 0)
# --- handle: head, taper, grip; pocket for wheel and pawl --------------------------------
$taper = polyline [(0, $r_head), ($x_cov, $hw), ($x_cov, -$hw), (0, -$r_head)]
$head2d = circle $r_head
$low0 = union [$head2d | extrude $body_h, $taper | extrude $body_h]
$grip_len = $handle_len - $hw - $x_cov
$grip = box $grip_len $handle_w ($body_h + $cover_t) center:(false, true, false) | translate $x_cov 0 0
$grip_end = cylinder $hw ($body_h + $cover_t) center:(true, true, false) | translate ($handle_len - $hw) 0 0
$blank = union [$low0, $grip, $grip_end]
$pocket_h = $wheel_t + 0.4 + 1
$bore = cylinder $r_pk $pocket_h center:(true, true, false) | translate 0 0 $floor_t
$jhole = cylinder ($r_j + $gap) ($floor_t + 2) center:(true, true, false) | translate 0 0 (-1)
$socket = cylinder ($r_b + 0.25) $pocket_h center:(true, true, false) | translate $px $py $floor_t
def sweepcut($k) = strut2d(-$k * $swing / 4) | offset $gap | extrude $pocket_h | translate 0 0 $floor_t
$fan = union [sweepcut($k) for $k in range(6)] # one step past the full swing
$slot = box ($leaf_len + 0.6) ($slot_y1 - $slot_y0) $pocket_h center:(false, false, false) | translate $px $slot_y0 $floor_t
# screws: two beside the wheel, two beside the leaf slot
$r_scr = ($r_pk + $r_head) / 2
$sx = $px + 14
$sya = $slot_y1 + 3.5
$syb = $slot_y0 - 3.5
def at4($s) = union [$s | translate ($r_scr * cos(125)) ($r_scr * sin(125)) 0, $s | translate ($r_scr * cos(235)) ($r_scr * sin(235)) 0, $s | translate $sx $sya 0, $s | translate $sx $syb 0]
def halfw($x) = $r_head - ($r_head - $hw) * $x / $x_cov
assert halfw($sx) - $sya - 1.25 >= 1.5 # wall outside the pilot holes
assert halfw($sx) + $syb - 1.25 >= 1.5
$pilot = cylinder 1.25 9 center:(true, true, false) | translate 0 0 ($body_h - 8)
$pilots = at4($pilot)
$hang = cylinder 3 ($body_h + $cover_t + 2) center:(true, true, false) | translate ($handle_len - $hw) 0 (-1)
$cuts = union [$bore, $jhole, $socket, $fan, $slot, $pilots, $hang]
$body = $blank - $cuts
assert $body.solids == 1
# --- cover: head and taper, hole for the bit, four screw holes ---------------------------
$cov0 = union [$head2d | extrude $cover_t, $taper | extrude $cover_t]
$trim = box 10 (4 * $r_head) ($cover_t + 2) center:(false, true, false) | translate ($x_cov - 0.4) 0 (-1)
$bithole = cylinder ($r_hex + 0.8) ($cover_t + 2) center:(true, true, false) | translate 0 0 (-1)
$clr = cylinder 1.7 ($cover_t + 2) center:(true, true, false) | translate 0 0 (-1)
$cov_cuts = union [$trim, $bithole, at4($clr)]
$cover = $cov0 - $cov_cuts
assert $cover.solids == 1
$cover_on = $cover | translate 0 0 ($body_h + 0.2) # drawn 0.2 mm above its seat
# --- checks on the assembled mechanism ---------------------------------------------------
def wheel_at($a) = $wheel | rotate 0 0 $a
assert clear($body, $wheel)
assert clear($body, $pawl)
assert clear($wheel, $pawl) # at rest the nose sits in a tooth gap
assert clear($cover_on, $wheel)
assert clear($cover_on, $pawl)
assert clear($cover_on, $body)
# one direction: the radial flank runs into the nose within two degrees
assert clear(wheel_at(-2), $pawl) == false
# and the wheel cannot lift the pawl out: the swung-out position is what it takes to pass
assert clear(wheel_at(-$pitch / 2), $pawl) == false
# other direction: the ramp reaches the nose, the pawl swings out and every phase passes
assert clear(wheel_at($pitch / 2), $pawl) == false
assert clear(wheel_at($pitch / 4), swung($swing))
assert clear(wheel_at($pitch / 2), swung($swing))
assert clear(wheel_at(3 * $pitch / 4), swung($swing))
assert clear(wheel_at($pitch - 1), swung($swing))
# the swung-out pawl still clears its pocket, and the wheel turns freely in the bore
assert clear($body, swung($swing))
assert clear($body, swung($swing / 2))
assert clear($body, wheel_at($pitch / 3))
# the wheel is trapped between floor and cover
assert clear($body, $wheel | translate 0 0 (-0.5)) == false
assert clear($cover_on, $wheel | translate 0 0 0.6) == false
assert $wheel.bbox.min[2] ~ 0 tol:0.001 # journal flush with the underside
# --- layouts -----------------------------------------------------------------------------
$yo = 2 * $r_head + 5
$wheel_flip = $wheel | rotate 180 0 0
$wheel_p = $wheel_flip | translate ($x_cov + $r_tip + 6) $yo ($z0 + $wheel_t)
$pawl_p = $pawl0 | translate ($x_cov + 2 * $r_tip + 12 - $pawl0.bbox.min[0]) ($yo - $py) 0
$cover_p = $cover | translate 0 $yo 0
$plate = union [$body, $cover_p, $wheel_p, $pawl_p]
assert $plate.solids == 4
assert clear($body, $cover_p)
assert clear($body, $wheel_p)
assert clear($body, $pawl_p)
assert clear($cover_p, $wheel_p)
assert clear($wheel_p, $pawl_p)
assert $wheel_p.bbox.min[2] ~ 0 tol:0.001
assert $plate.bbox.min[2] ~ 0 tol:0.001
$open = union [$body, $wheel, $pawl]
assert $open.solids == 3
$assembled = union [$body, $wheel, $pawl, $cover_on]
assert $assembled.solids == 4
print "click angle (deg)" $pitch "pawl swing (deg)" $swing
print "leaf strain" $strain "self-engaging lever (mm)" $lock_arm
print "head diameter (mm)" (2 * $r_head) "thickness (mm)" ($body_h + $cover_t)
$out = if $view == "assembled" then $assembled else if $view == "open" then $open else $plate
$out