Shim Set
A set of slotted shims for levelling machines, packing hinges and setting gaps, from 0.5 to 5 mm in 0.5 mm steps by default. Each shim is a plate with a U slot so it slides under a bolt without removing it, and a corner hole for the printed C ring that keeps the set together. The thickness is cut right through each shim as a stencil, with bridges so the inside of a 0 or 4 stays attached, so it reads on a 0.5 mm shim as well as on a 5 mm one and the faces stay flat. The series is set by the thinnest and thickest shim and the step. The default ten shims of 40 x 25 mm lay out with the ring as 207 x 87 mm. Print flat with a layer height that divides the step, no supports. Parameters: thinnest and thickest shim, step, shim length and width, and bolt slot width.
# Shim Set - slotted shims from 0.5 to 5 mm, thickness cut through as a stencil, on a C ring
#
# A set of slotted shims for levelling machines, packing hinges and setting gaps: each is a
# plate with a U slot so it slides under a bolt without removing it, and a corner hole for
# the ring that keeps the set together. The thickness is cut right through each shim as a
# stencil (with bridges, so the inside of a 0 or 4 stays attached), so it reads on a 0.5 mm
# shim as well as on a 5 mm one and the faces stay flat.
# Thicknesses run from the thinnest to the thickest in a chosen step. Print flat with a
# layer height that divides the step, no supports; the ring prints flat too.
@param 0.3..2 step:0.1 desc:"Thinnest shim (mm)"
$t_min = 0.5
@param 1..10 step:0.5 desc:"Thickest shim (mm)"
$t_max = 5
@param 0.25..1 step:0.25 desc:"Step (mm)"
$t_step = 0.5
@param 25..60 desc:"Shim length (mm)"
$len = 40
@param 16..40 desc:"Shim width (mm)"
$wid = 25
@param 4..12 desc:"Bolt slot width (mm)"
$slot_w = 8
$n = floor(($t_max - $t_min) / $t_step + 1.001)
assert $n >= 2
def th($i) = $t_min + $i * $t_step
# --- One shim: plate, U slot from one end, ring hole in a corner, thickness stencil ---------
$slot_d = $len * 0.4
$hole_r = 3.2
def plate($i) = box $len $wid th($i) center:(false, true, false)
$slot = union [rect ($slot_d - $slot_w / 2) $slot_w at:(($slot_d - $slot_w / 2) / 2 - 1, 0), circle ($slot_w / 2) at:($slot_d - $slot_w / 2 - 1, 0)]
| extrude ($t_max + 2) | translate 0 0 -1
$ring_hole = cylinder $hole_r ($t_max + 2) center:(true, true, false) | translate ($len - 6) ($wid / 2 - 6) -1
$tx = $len - 14
$ty = -($wid / 2) + 5.5
def stencil($i) = text ("" + th($i)) 8 | extrude ($t_max + 2) | translate $tx $ty -1 # text is centred on the point
def shim0($i) = plate($i) - $slot
def shim1($i) = shim0($i) - $ring_hole
# stencil bridges: two thin bars across the figures keep the islands of 0 and 4 attached
def bridges($i) = union [box 10 0.6 th($i) center:(true, true, false) | translate $tx ($ty + 1.0) 0,
box 10 0.6 th($i) center:(true, true, false) | translate $tx ($ty - 1.0) 0]
def shim2($i) = shim1($i) - stencil($i)
def shim($i) = shim2($i) + bridges($i)
# --- Layout: a grid of shims, and a C ring beside it ---------------------------------------
$cols = 4
$px = $len + 6
$py = $wid + 6
$rows = ceil($n / $cols)
$shims = union [shim(i) | translate ((i % $cols) * $px) (-(i // $cols) * $py) 0 for i in range($n)]
$ring_r = 11
$ring_w = 2.2
$ring0 = union [circle ($ring_r + $ring_w / 2), circle ($ring_r - $ring_w / 2)]
$ring_face = (circle ($ring_r + $ring_w / 2)) - (circle ($ring_r - $ring_w / 2))
$gap = box ($ring_w + 2) 1.6 10 center:(false, true, true) | translate ($ring_r - $ring_w / 2 - 1) 0 0
$ring1 = $ring_face | extrude $ring_w
$ring = $ring1 - $gap
$ring_p = $ring | translate ($cols * $px + $ring_r) 0 0
$out = $shims + $ring_p
# --- Checks --------------------------------------------------------------------------------
assert $out.solids == $n + 1
assert $ring.solids == 1
assert clear($shims, $ring_p)
assert 2 * $hole_r > $ring_w + 1 # the ring passes through the corner hole
assert $slot_w + 8 < $wid # material each side of the slot
# every shim is its nominal thickness: the thickest sets the height, and the set's volume
# matches the arithmetic series of thicknesses (within the stencil cut-outs)
assert $out.bbox.z ~ $t_max
$plate_area = $len * $wid - (($slot_d - 1 - $slot_w / 2) * $slot_w + 3.14159 * $slot_w * $slot_w / 8) - 3.14159 * $hole_r * $hole_r
assert $shims.volume < $plate_area * $n * ($t_min + $t_max) / 2
assert $shims.volume > $plate_area * $n * ($t_min + $t_max) / 2 * 0.9
print "shims" $n
$out