comparison rondel_dagger.scad @ 0:07d3473487fe default tip

Parametric handle for toys, LLM-generated
author ark
date 2026-10-16 19:53 +0200
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:07d3473487fe
1 // ---------------------------------------------------------------------------
2 // Toy rondel dagger handle, ~3/4 scale for a 10-year-old's hands.
3 // The "blade" is a natural twig, thickest end sunk into the guard.
4 //
5 // Two printed parts, both support-free and printed as modelled:
6 // grip guard rondel + grip, guard face on the bed, spigot up
7 // pommel pommel rondel, butt face on the bed, socket up
8 // Plus "fit", a bare sleeve around the bore for trial-fitting the twig.
9 // Solvent-weld the spigot into the socket.
10 // ---------------------------------------------------------------------------
11
12 /* [part selection] */
13 part = "assembly"; // [assembly:"Assembled preview",grip:"Print guard + grip",pommel:"Print pommel",plate:"Print both, side by side",fit:"Print twig fit test"]
14 // preview with open cut
15 preview_cut = true;
16 // show the twig in the assembled preview
17 show_stick = true;
18
19 /* [blade stick] */
20 // diameter of the twig at its thickest in mm
21 stick_d = 5.0; // [3:.1:12]
22 // how deep the twig sits in the handle in mm
23 stick_depth = 40; // [10:1:80]
24 // taper the socket to half diameter at its bottom, to suit a natural twig
25 stick_taper = true;
26 // slack around the twig in mm, on top of the print tolerance
27 stick_fit = .05; // [0:.05:1]
28
29 /* [fit test] */
30 // bore depth the fit test reproduces in mm, 0 = the full depth
31 fit_depth = 0; // [0:1:80]
32
33 /* [proportions] */
34 // guard rondel diameter in mm
35 guard_d = 40; // [20:.5:70]
36 // guard rondel thickness in mm
37 guard_t = 6; // [3:.5:12]
38 // pommel rondel diameter in mm
39 pommel_d = 34; // [20:.5:70]
40 // pommel rondel thickness in mm
41 pommel_t = 7; // [3:.5:12]
42 // grip length between the rondels in mm
43 grip_len = 78; // [40:1:130]
44 // grip radius at the guard end in mm
45 r_guard = 9.0; // [5:.1:16]
46 // grip radius at the swell in mm
47 r_mid = 11.5; // [5:.1:16]
48 // grip radius at the pommel end in mm
49 r_pommel = 9.8; // [5:.1:16]
50 // where the swell sits, 0 = guard, 1 = pommel
51 swell_at = .55; // [.2:.01:.8]
52 // total spiral over the grip in degrees, 0 = straight facets
53 grip_twist = 180; // [0:5:540]
54 // facets around the grip
55 grip_facets = 8; // [3:1:16]
56
57 /* [detail] */
58 // gadroons around the rondel rims
59 notches = 16; // [0:1:48]
60 // cone blending each rondel into the grip in mm
61 flare_h = 6; // [0:.5:15]
62 // depth of the spigot joining the two parts in mm
63 joint_len = 9; // [4:.5:20]
64
65 /* [print settings] */
66 line_width = .4; // [0:.01:1]
67 layer_height = .2; // [0:.01:.5]
68 xy_tolerance = .1; // [0:.01:.5]
69 // grip profile resolution, raise if the twist looks facetted
70 slices = 48; // [8:1:120]
71
72
73 module dummy() {}
74
75 epsilon = .001;
76 $fn = $preview ? 60 : 180;
77
78
79 // derived, small features sized off the nozzle rather than picked by eye
80 chamfer = 3 * line_width; // rondel rim chamfer
81 notch_r = 4 * line_width; // gadroon cutter radius
82 lead_in = 5 * layer_height; // entry taper on spigot and socket mouth
83 relief = 3 * layer_height; // socket sunk deeper than the spigot is long
84 bore_d = stick_d + 2 * xy_tolerance + stick_fit;
85 fit_wall = 4 * line_width; // sleeve wall on the fit test
86 _fit_d = fit_depth > 0 ? min(fit_depth, stick_depth) : stick_depth;
87
88 // the spigot is sized off the grip's own end so 3 extrusions of shoulder are
89 // left all round for the glue joint to bear on
90 grip_ir = r_pommel * cos(180 / grip_facets);
91 joint_r = grip_ir - 3 * line_width;
92 joint_d = 2 * joint_r;
93
94 grip_z = guard_t;
95 joint_z = guard_t + grip_len;
96 pommel_h = pommel_t + flare_h;
97 handle_len = guard_t + grip_len + pommel_h;
98
99
100 // cosine blend, zero slope at the swell so the two halves meet smoothly
101 function blend(a, b, t) = a + (b - a) * (1 - cos(180 * t)) / 2;
102 function grip_r(t) =
103 t < swell_at ? blend(r_guard, r_mid, t / swell_at)
104 : blend(r_mid, r_pommel, (t - swell_at) / (1 - swell_at));
105
106
107 // chamfered disc with gadroons milled into the rim
108 module rondel(d, t) {
109 difference() {
110 union() {
111 cylinder(d1 = d - 2*chamfer, d2 = d, h = chamfer);
112 translate([0, 0, chamfer]) cylinder(d = d, h = t - 2*chamfer);
113 translate([0, 0, t - chamfer]) cylinder(d1 = d, d2 = d - 2*chamfer, h = chamfer);
114 }
115 if (notches > 0)
116 for (a = [0 : 360/notches : 359.9])
117 rotate([0, 0, a]) translate([d/2, 0, -epsilon])
118 cylinder(r = notch_r, h = t + 2*epsilon, $fn = 24);
119 }
120 }
121
122 // faceted section swept up the grip, each slice turned a little further than
123 // the last so the facets run as a shallow helix
124 module grip_stack() {
125 for (i = [0 : slices - 1]) hull()
126 for (j = [i, i + 1])
127 translate([0, 0, grip_len * j / slices])
128 rotate([0, 0, grip_twist * j / slices])
129 cylinder(h = epsilon, r = grip_r(j / slices), $fn = grip_facets);
130 }
131
132 module spigot() {
133 cylinder(d = joint_d, h = joint_len - lead_in);
134 translate([0, 0, joint_len - lead_in])
135 cylinder(d1 = joint_d, d2 = joint_d - 2*lead_in, h = lead_in);
136 }
137
138 // cut solid for the socket: deeper than the spigot, flared at the mouth
139 module socket() {
140 len = joint_len + relief;
141 cylinder(d = joint_d + 2*xy_tolerance, h = len);
142 translate([0, 0, len - lead_in])
143 cylinder(d1 = joint_d + 2*xy_tolerance,
144 d2 = joint_d + 2*xy_tolerance + 2*lead_in, h = lead_in + epsilon);
145 }
146
147 // Cut solid for the twig, optionally tapered to suit a natural stick.
148 // A shorter depth truncates the same cone rather than rescaling it, so a
149 // stubby fit test still matches the real bore over the depth it covers.
150 module bore(depth = stick_depth) {
151 _d2 = stick_taper ? bore_d * (1 - depth / (2 * stick_depth)) : bore_d;
152 _sl = (bore_d - _d2) / depth; // diameter lost per mm, used to overshoot
153 translate([0, 0, -epsilon])
154 cylinder(d1 = bore_d + _sl * epsilon, d2 = _d2 - _sl * epsilon,
155 h = depth + 2 * epsilon);
156 }
157
158
159 module grip() {
160 difference() {
161 union() {
162 rondel(guard_d, guard_t);
163 translate([0, 0, grip_z]) {
164 cylinder(r1 = r_mid + 5*line_width,
165 r2 = grip_r(flare_h / grip_len), h = flare_h);
166 grip_stack();
167 }
168 translate([0, 0, joint_z]) spigot();
169 }
170 bore();
171 }
172 }
173
174 module pommel() {
175 difference() {
176 union() {
177 rondel(pommel_d, pommel_t);
178 translate([0, 0, pommel_t])
179 cylinder(r1 = r_mid + 4*line_width,
180 r2 = r_pommel + line_width, h = flare_h);
181 }
182 translate([0, 0, pommel_h - joint_len - relief]) socket();
183 }
184 }
185
186 // Bare sleeve around the bore, printed mouth-down exactly as the guard is, so
187 // first-layer squish and the taper are reproduced rather than approximated.
188 module fit_test() {
189 difference() {
190 cylinder(d = bore_d + 2 * fit_wall, h = _fit_d);
191 bore(_fit_d);
192 }
193 }
194
195 module assembly() {
196 grip();
197 translate([0, 0, joint_z + pommel_h]) rotate([180, 0, 0]) pommel();
198 if (show_stick)
199 color("burlywood")
200 translate([0, 0, stick_depth]) rotate([180, 0, 0])
201 cylinder(d = stick_d, h = 200, $fn = 24);
202 }
203
204 module plate() {
205 translate([-guard_d/2 - 2, 0, 0]) grip();
206 translate([ pommel_d/2 + 2, 0, 0]) pommel();
207 }
208
209
210 // ***************************************************************************
211 // Cut box dimensions are passed in per part on purpose. OpenCSG in 2021.01
212 // silently drops the subtraction once the cutting solid overshoots the part by
213 // much more than the part's own size: a 34mm sleeve still cuts under a 38mm
214 // box but not a 60mm one. No warning, the part just renders whole.
215 module part_view(w, h) {
216 if ($preview && preview_cut) {
217 difference() {
218 union() { children(); }
219 translate([-w/2, -w, -2]) cube([w, w, h]);
220 }
221 } else {
222 children();
223 }
224 }
225
226 module main() {
227 if(part=="assembly")
228 part_view(guard_d + 4, handle_len + 4) assembly();
229 else if(part=="grip")
230 part_view(guard_d + 4, joint_z + joint_len + 4) grip();
231 else if(part=="pommel")
232 part_view(pommel_d + 4, pommel_h + 4) pommel();
233 else if(part=="plate")
234 part_view(guard_d + pommel_d + 16, handle_len + 4) plate();
235 else if(part=="fit")
236 part_view(bore_d + 2*fit_wall + 4, _fit_d + 4) fit_test();
237 }
238
239
240 main();
241
242 function paramstring (prefix="", suffix="") = str(
243 prefix?prefix:"", part, "_",
244 (part=="fit" ? "" : str(round(handle_len), "x", round(guard_d), "_")),
245 "stk", round(10*stick_d), "x", round(part=="fit" ? _fit_d : stick_depth),
246 (stick_taper?"t":""), "_",
247 (part=="fit" ? str("f", round(100*stick_fit),
248 "tol", round(100*xy_tolerance), "_") : ""),
249 "lw", (100*line_width), "lh", (100*layer_height),
250 suffix?suffix:"",
251 ".stl"
252 );
253
254 _wall = r_pommel + line_width - joint_r - xy_tolerance;
255 echo(str("handle ", handle_len, "mm long, grip ", 2*r_mid, "mm across the swell"));
256 echo(str("spigot dia ", joint_d, "mm, shoulder ", grip_ir - joint_r,
257 "mm, socket wall ", _wall, "mm = ", _wall/line_width, " extrusions"));
258 echo(paramstring("rondel_"));