view rondel_dagger.scad @ 0:07d3473487fe default tip

Parametric handle for toys, LLM-generated
author ark
date 2026-10-16 19:53 +0200
parents
children
line wrap: on
line source

// ---------------------------------------------------------------------------
// Toy rondel dagger handle, ~3/4 scale for a 10-year-old's hands.
// The "blade" is a natural twig, thickest end sunk into the guard.
//
// Two printed parts, both support-free and printed as modelled:
//   grip    guard rondel + grip, guard face on the bed, spigot up
//   pommel  pommel rondel, butt face on the bed, socket up
// Plus "fit", a bare sleeve around the bore for trial-fitting the twig.
// Solvent-weld the spigot into the socket.
// ---------------------------------------------------------------------------

/* [part selection] */
part = "assembly";          // [assembly:"Assembled preview",grip:"Print guard + grip",pommel:"Print pommel",plate:"Print both, side by side",fit:"Print twig fit test"]
// preview with open cut
preview_cut = true;
// show the twig in the assembled preview
show_stick = true;

/* [blade stick] */
// diameter of the twig at its thickest in mm
stick_d = 5.0;              // [3:.1:12]
// how deep the twig sits in the handle in mm
stick_depth = 40;           // [10:1:80]
// taper the socket to half diameter at its bottom, to suit a natural twig
stick_taper = true;
// slack around the twig in mm, on top of the print tolerance
stick_fit = .05;            // [0:.05:1]

/* [fit test] */
// bore depth the fit test reproduces in mm, 0 = the full depth
fit_depth = 0;              // [0:1:80]

/* [proportions] */
// guard rondel diameter in mm
guard_d = 40;               // [20:.5:70]
// guard rondel thickness in mm
guard_t = 6;                // [3:.5:12]
// pommel rondel diameter in mm
pommel_d = 34;              // [20:.5:70]
// pommel rondel thickness in mm
pommel_t = 7;               // [3:.5:12]
// grip length between the rondels in mm
grip_len = 78;              // [40:1:130]
// grip radius at the guard end in mm
r_guard = 9.0;              // [5:.1:16]
// grip radius at the swell in mm
r_mid = 11.5;               // [5:.1:16]
// grip radius at the pommel end in mm
r_pommel = 9.8;             // [5:.1:16]
// where the swell sits, 0 = guard, 1 = pommel
swell_at = .55;             // [.2:.01:.8]
// total spiral over the grip in degrees, 0 = straight facets
grip_twist = 180;           // [0:5:540]
// facets around the grip
grip_facets = 8;            // [3:1:16]

/* [detail] */
// gadroons around the rondel rims
notches = 16;               // [0:1:48]
// cone blending each rondel into the grip in mm
flare_h = 6;                // [0:.5:15]
// depth of the spigot joining the two parts in mm
joint_len = 9;              // [4:.5:20]

/* [print settings] */
line_width = .4;            // [0:.01:1]
layer_height = .2;          // [0:.01:.5]
xy_tolerance = .1;          // [0:.01:.5]
// grip profile resolution, raise if the twist looks facetted
slices = 48;                // [8:1:120]


module dummy() {}

epsilon = .001;
$fn = $preview ? 60 : 180;


// derived, small features sized off the nozzle rather than picked by eye
chamfer  = 3 * line_width;      // rondel rim chamfer
notch_r  = 4 * line_width;      // gadroon cutter radius
lead_in  = 5 * layer_height;    // entry taper on spigot and socket mouth
relief   = 3 * layer_height;    // socket sunk deeper than the spigot is long
bore_d   = stick_d + 2 * xy_tolerance + stick_fit;
fit_wall = 4 * line_width;      // sleeve wall on the fit test
_fit_d   = fit_depth > 0 ? min(fit_depth, stick_depth) : stick_depth;

// the spigot is sized off the grip's own end so 3 extrusions of shoulder are
// left all round for the glue joint to bear on
grip_ir  = r_pommel * cos(180 / grip_facets);
joint_r  = grip_ir - 3 * line_width;
joint_d  = 2 * joint_r;

grip_z     = guard_t;
joint_z    = guard_t + grip_len;
pommel_h   = pommel_t + flare_h;
handle_len = guard_t + grip_len + pommel_h;


// cosine blend, zero slope at the swell so the two halves meet smoothly
function blend(a, b, t) = a + (b - a) * (1 - cos(180 * t)) / 2;
function grip_r(t) =
    t < swell_at ? blend(r_guard, r_mid,     t / swell_at)
                 : blend(r_mid,   r_pommel, (t - swell_at) / (1 - swell_at));


// chamfered disc with gadroons milled into the rim
module rondel(d, t) {
    difference() {
        union() {
            cylinder(d1 = d - 2*chamfer, d2 = d, h = chamfer);
            translate([0, 0, chamfer])     cylinder(d = d, h = t - 2*chamfer);
            translate([0, 0, t - chamfer]) cylinder(d1 = d, d2 = d - 2*chamfer, h = chamfer);
        }
        if (notches > 0)
            for (a = [0 : 360/notches : 359.9])
                rotate([0, 0, a]) translate([d/2, 0, -epsilon])
                    cylinder(r = notch_r, h = t + 2*epsilon, $fn = 24);
    }
}

// faceted section swept up the grip, each slice turned a little further than
// the last so the facets run as a shallow helix
module grip_stack() {
    for (i = [0 : slices - 1]) hull()
        for (j = [i, i + 1])
            translate([0, 0, grip_len * j / slices])
                rotate([0, 0, grip_twist * j / slices])
                    cylinder(h = epsilon, r = grip_r(j / slices), $fn = grip_facets);
}

module spigot() {
    cylinder(d = joint_d, h = joint_len - lead_in);
    translate([0, 0, joint_len - lead_in])
        cylinder(d1 = joint_d, d2 = joint_d - 2*lead_in, h = lead_in);
}

// cut solid for the socket: deeper than the spigot, flared at the mouth
module socket() {
    len = joint_len + relief;
    cylinder(d = joint_d + 2*xy_tolerance, h = len);
    translate([0, 0, len - lead_in])
        cylinder(d1 = joint_d + 2*xy_tolerance,
                 d2 = joint_d + 2*xy_tolerance + 2*lead_in, h = lead_in + epsilon);
}

// Cut solid for the twig, optionally tapered to suit a natural stick.
// A shorter depth truncates the same cone rather than rescaling it, so a
// stubby fit test still matches the real bore over the depth it covers.
module bore(depth = stick_depth) {
    _d2 = stick_taper ? bore_d * (1 - depth / (2 * stick_depth)) : bore_d;
    _sl = (bore_d - _d2) / depth;   // diameter lost per mm, used to overshoot
    translate([0, 0, -epsilon])
        cylinder(d1 = bore_d + _sl * epsilon, d2 = _d2 - _sl * epsilon,
                 h = depth + 2 * epsilon);
}


module grip() {
    difference() {
        union() {
            rondel(guard_d, guard_t);
            translate([0, 0, grip_z]) {
                cylinder(r1 = r_mid + 5*line_width,
                         r2 = grip_r(flare_h / grip_len), h = flare_h);
                grip_stack();
            }
            translate([0, 0, joint_z]) spigot();
        }
        bore();
    }
}

module pommel() {
    difference() {
        union() {
            rondel(pommel_d, pommel_t);
            translate([0, 0, pommel_t])
                cylinder(r1 = r_mid + 4*line_width,
                         r2 = r_pommel + line_width, h = flare_h);
        }
        translate([0, 0, pommel_h - joint_len - relief]) socket();
    }
}

// Bare sleeve around the bore, printed mouth-down exactly as the guard is, so
// first-layer squish and the taper are reproduced rather than approximated.
module fit_test() {
    difference() {
        cylinder(d = bore_d + 2 * fit_wall, h = _fit_d);
        bore(_fit_d);
    }
}

module assembly() {
    grip();
    translate([0, 0, joint_z + pommel_h]) rotate([180, 0, 0]) pommel();
    if (show_stick)
        color("burlywood")
            translate([0, 0, stick_depth]) rotate([180, 0, 0])
                cylinder(d = stick_d, h = 200, $fn = 24);
}

module plate() {
    translate([-guard_d/2 - 2, 0, 0]) grip();
    translate([ pommel_d/2 + 2, 0, 0]) pommel();
}


// ***************************************************************************
// Cut box dimensions are passed in per part on purpose. OpenCSG in 2021.01
// silently drops the subtraction once the cutting solid overshoots the part by
// much more than the part's own size: a 34mm sleeve still cuts under a 38mm
// box but not a 60mm one. No warning, the part just renders whole.
module part_view(w, h) {
    if ($preview && preview_cut) {
        difference() {
            union() { children(); }
            translate([-w/2, -w, -2]) cube([w, w, h]);
        }
    } else {
        children();
    }
}

module main() {
    if(part=="assembly")
        part_view(guard_d + 4, handle_len + 4) assembly();
    else if(part=="grip")
        part_view(guard_d + 4, joint_z + joint_len + 4) grip();
    else if(part=="pommel")
        part_view(pommel_d + 4, pommel_h + 4) pommel();
    else if(part=="plate")
        part_view(guard_d + pommel_d + 16, handle_len + 4) plate();
    else if(part=="fit")
        part_view(bore_d + 2*fit_wall + 4, _fit_d + 4) fit_test();
}


main();

function paramstring (prefix="", suffix="") = str(
    prefix?prefix:"", part, "_",
    (part=="fit" ? "" : str(round(handle_len), "x", round(guard_d), "_")),
    "stk", round(10*stick_d), "x", round(part=="fit" ? _fit_d : stick_depth),
        (stick_taper?"t":""), "_",
    (part=="fit" ? str("f", round(100*stick_fit),
                       "tol", round(100*xy_tolerance), "_") : ""),
    "lw", (100*line_width), "lh", (100*layer_height),
    suffix?suffix:"",
    ".stl"
);

_wall = r_pommel + line_width - joint_r - xy_tolerance;
echo(str("handle ", handle_len, "mm long, grip ", 2*r_mid, "mm across the swell"));
echo(str("spigot dia ", joint_d, "mm, shoulder ", grip_ir - joint_r,
         "mm, socket wall ", _wall, "mm = ", _wall/line_width, " extrusions"));
echo(paramstring("rondel_"));