diff --git a/color.scad b/color.scad index 3bb19f41..1d9b1dcc 100644 --- a/color.scad +++ b/color.scad @@ -73,7 +73,7 @@ module color_this(c="default") // Description: // Iterates the list, displaying children in different colors for each list item. The color // is set using the color() module, so this module is not compatible with {{recolor()}} or -// {{color_this}}. This is useful for debugging regions or lists of paths. +// {{color_this()}}. This is useful for debugging regions or lists of paths. // Arguments: // list = The list of items to iterate through. // stride = Consecutive colors stride around the color wheel divided into this many parts. diff --git a/screw_drive.scad b/screw_drive.scad index 179d46ca..5598bc27 100644 --- a/screw_drive.scad +++ b/screw_drive.scad @@ -126,6 +126,74 @@ function phillips_diam(size, depth) = // Section: Torx Drive + + +// Module: torx_mask() +// Usage: +// torx_mask(size, l, [center]); +// Description: Creates a torx bit tip. +// Arguments: +// size = Torx size. +// l = Length of bit. +// center = If true, centers bit vertically. +// --- +// anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#subsection-anchor). Default: `CENTER` +// spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#subsection-spin). Default: `0` +// orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#subsection-orient). Default: `UP` +// Examples: +// torx_mask(size=30, l=10, $fa=1, $fs=1); +module torx_mask(size, l=5, center, anchor, spin=0, orient=UP) { + anchor = get_anchor(anchor, center, BOT, BOT); + od = torx_outer_diam(size); + attachable(anchor,spin,orient, d=od, l=l) { + linear_extrude(height=l, convexity=4, center=true) { + torx_mask2d(size); + } + children(); + } +} + + + +// Module: torx_mask2d() +// Usage: +// torx_mask2d(size); +// Description: Creates a torx bit 2D profile. +// Arguments: +// size = Torx size. +// Example(2D): +// torx_mask2d(size=30, $fa=1, $fs=1); +module torx_mask2d(size) { + od = torx_outer_diam(size); + id = torx_inner_diam(size); + tip = torx_tip_radius(size); + rounding = torx_rounding_radius(size); + base = od - 2*tip; + $fn = quantup(segs(od/2),12); + difference() { + union() { + circle(d=base); + zrot_copies(n=2) { + hull() { + zrot_copies(n=3) { + translate([base/2,0,0]) { + circle(r=tip, $fn=$fn/2); + } + } + } + } + } + zrot_copies(n=6) { + zrot(180/6) { + translate([id/2+rounding,0,0]) { + circle(r=rounding); + } + } + } + } +} + + // Function: torx_outer_diam() // Usage: // diam = torx_outer_diam(size); @@ -257,71 +325,6 @@ function torx_rounding_radius(size) = lookup(size, [ -// Module: torx_mask2d() -// Usage: -// torx_mask2d(size); -// Description: Creates a torx bit 2D profile. -// Arguments: -// size = Torx size. -// Example(2D): -// torx_mask2d(size=30, $fa=1, $fs=1); -module torx_mask2d(size) { - od = torx_outer_diam(size); - id = torx_inner_diam(size); - tip = torx_tip_radius(size); - rounding = torx_rounding_radius(size); - base = od - 2*tip; - $fn = quantup(segs(od/2),12); - difference() { - union() { - circle(d=base); - zrot_copies(n=2) { - hull() { - zrot_copies(n=3) { - translate([base/2,0,0]) { - circle(r=tip, $fn=$fn/2); - } - } - } - } - } - zrot_copies(n=6) { - zrot(180/6) { - translate([id/2+rounding,0,0]) { - circle(r=rounding); - } - } - } - } -} - - - -// Module: torx_mask() -// Usage: -// torx_mask(size, l, [center]); -// Description: Creates a torx bit tip. -// Arguments: -// size = Torx size. -// l = Length of bit. -// center = If true, centers bit vertically. -// --- -// anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#subsection-anchor). Default: `CENTER` -// spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#subsection-spin). Default: `0` -// orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#subsection-orient). Default: `UP` -// Examples: -// torx_mask(size=30, l=10, $fa=1, $fs=1); -module torx_mask(size, l=5, center, anchor, spin=0, orient=UP) { - anchor = get_anchor(anchor, center, BOT, BOT); - od = torx_outer_diam(size); - attachable(anchor,spin,orient, d=od, l=l) { - linear_extrude(height=l, convexity=4, center=true) { - torx_mask2d(size); - } - children(); - } -} - // Section: Robertson/Square Drives