Neale Pickett
·
2026-03-15
stock.scad
1include <BOSL2/std.scad>
2
3module stock(h, id, od=0) {
4 od2 = (od > 0) ? od : (id + 4.8);
5 od1 = od2 + 4;
6 difference() {
7 union() {
8 // Main tube
9 tube(h=h, id=id, od=od2, rounding2=0.5, anchor=BOTTOM);
10
11 // Base
12 tube(h=14, id=id, od=od1, orounding2=1, anchor=BOTTOM);
13
14 // Flare
15 translate([0, 0, 14+6]) tube(h=h-14-6-14, id=id, od1=od1, od2=od2, orounding1=1, anchor=BOTTOM);
16
17 // Ferrule at the top
18 translate([0, 0, h-14]) torus(d_maj=od2, r_min=1.4);
19
20 }
21
22 // Those damned rings everything has
23 for (d = [6, 8]) {
24 translate([0, 0, h-d]) tube(h=0.5, id=od2-1);
25 }
26
27 // Ruby
28 translate([0, 0, 20]) {
29 intersection() {
30 rotate([90, 0, -90]) {
31 linear_extrude(height=20, convexity=4) {
32 translate([0, 8]) import("../../ruby.svg", center=true);
33 // XXX: when this is in openscad prod, add center to import and remove translate
34 }
35 }
36 tube(h=h-14-6-14, id1=od1-0.4, id2=od2-0.4, wall=8, anchor=BOTTOM);
37 }
38 }
39 }
40}
41
42module stock_daye(h, id, inset_h=0, inset_z=0) {
43 inset_h = inset_h ? inset_h : h/3;
44 inset_z = inset_z ? inset_z : 15;
45 od = id + 4;
46
47 difference() {
48 tube(h=h, id=id, od=od, rounding2=0.6, anchor=BOTTOM);
49 translate([0, 0, inset_z]) tube(h=inset_h, id=od-2, wall=5, chamfer=1);
50 }
51}