Tap Guide
A block that holds taps and tap drills square to the work. The front row of vertical holes fits the thread of each tap from M3 to M10 with a small clearance and keeps it square while the thread is started; the back row fits the matching ISO coarse tap drills (2.5, 3.3, 4.2, 5.0, 6.8 and 8.5 mm) so the pilot hole is drilled square as well. Every hole is labelled, and a 90 degree V groove along the underside lets the block sit on round bar and pipe as well as on flat plate. The default block measures 90 x 34 x 25 mm. Prints flat on its base with no supports; the holes are vertical and the V is a 45 degree overhang. Parameters: block height (the guide length), hole pitch, clearance over the tap and over the drill, and the V groove.
# Tap Guide - block that holds taps and tap drills square to the work, M3 to M10
#
# A block with two rows of vertical holes: the front row fits the thread of each tap
# (M3, M4, M5, M6, M8, M10) with a small clearance and keeps it square while starting the
# thread; the back row fits the matching tap drill (2.5, 3.3, 4.2, 5.0, 6.8, 8.5) so the
# pilot hole is drilled square as well. Each hole is labelled. A 90 deg V groove along the
# underside lets the block sit on round bar and pipe as well as flat plate.
# Prints flat on its base, no supports: the holes are vertical and the V is a 45 deg overhang.
@param 20..40 desc:"Block height = guide length (mm)"
$height = 25
@param 10..16 desc:"Hole pitch (mm)"
$pitch = 14
@param 0.2..0.5 step:0.1 desc:"Clearance over the tap thread (mm)"
$tap_fit = 0.3
@param 0.1..0.4 step:0.1 desc:"Clearance over the drill (mm)"
$drill_fit = 0.2
@param desc:"V groove on the underside for round stock"
$vee = true
# --- Size table: ISO coarse, tap drill = nominal minus pitch -----------------------------
$n = 6
def nom($i) = if $i == 0 then 3 else if $i == 1 then 4 else if $i == 2 then 5 else if $i == 3 then 6 else if $i == 4 then 8 else 10
def drill($i) = if $i == 0 then 2.5 else if $i == 1 then 3.3 else if $i == 2 then 4.2 else if $i == 3 then 5.0 else if $i == 4 then 6.8 else 8.5
def hx($i) = ($i - ($n - 1) / 2) * $pitch
$len = $n * $pitch + 6
$wid = 34
$row = 8 # rows at y = +-row
$block = box $len $wid $height center:(true, true, false)
$tap_holes = union [cylinder ((nom(i) + $tap_fit) / 2) ($height + 2) center:(true, true, false) | translate hx(i) (-$row) -1 for i in range($n)]
$drill_holes = union [cylinder ((drill(i) + $drill_fit) / 2) ($height + 2) center:(true, true, false) | translate hx(i) $row -1 for i in range($n)]
# labels: "M3" in front of each tap hole, the drill size behind each drill hole
$lab_tap = union [text ("M" + nom(i)) 2.8 | extrude 1 | translate hx(i) (-$wid / 2 + 1.5) ($height - 0.5) for i in range($n)]
$lab_drill = union [text ("" + drill(i)) 2.8 | extrude 1 | translate hx(i) ($wid / 2 - 4.3) ($height - 0.5) for i in range($n)]
# V groove: a square on its corner, 8 mm deep, along X under the block
$vd = 8
$groove = polygon 4 ($vd * sqrt(2)) | extrude ($len + 2) | rotate 0 90 0 | translate 0 0 (-$vd)
# rotate 0 90 0 turns the extrusion axis from Z to X; the diamond is then in the YZ plane
$g1 = $block - $tap_holes
$g2 = $g1 - $drill_holes
$g3 = $g2 - $lab_tap
$g4 = $g3 - $lab_drill
$guide = if $vee then $g4 - $groove else $g4
# --- Checks ------------------------------------------------------------------------------
assert $guide.solids == 1
assert $guide.bbox.x ~ $len
assert $guide.bbox.y ~ $wid
assert $guide.bbox.z ~ $height
assert $guide.volume < $block.volume
assert $pitch > 10 + $tap_fit + 2 # walls between the M10 hole and its neighbours
assert $vd < $height - $row - 10 / 2 - 2 # the groove stays under the holes
print "block (mm)" $len
$guide