Neale Pickett
·
2025-02-20
common.scad
1// Make circles circular in final renders.
2$fn = $preview ? 0 : 60;
3
4// clearance in a permanent tenon/mortise joint
5clearance = 0.03;
6
7module brass() {
8 color("gold") children();
9}
10
11module derlin() {
12 color("dimgray") children();
13}
14
15module ivory() {
16 color("ivory") children();
17}
18
19// tube creates a hollow cylinder
20module tube(h=10, id=5, od=10) {
21 difference() {
22 cylinder(h=h, d=od);
23 cylinder(h=h, d=id);
24 }
25}
26
27// default height of rings
28rings_height = 1.8;
29
30// rings of adornment.
31// This engraves two rings, 1.4mm apart, at a depth of 0.4.
32module rings(h=0.4, d=1, depth=0.4, spacing=1.4) {
33 tube(h=h, id=d-depth, od=d);
34 translate([0, 0, spacing]) tube(h=h, id=d-depth, od=d);
35}
36
37// default brass tube thickness
38brass_thickness = 0.75;
39
40// brass_tube creates a chamfered hollow cylinder with given inside diameter,
41// and wall thickness of 0.75.
42// Decorative rings are etched into the top and bottom.
43module brass_tube(h=10, id=10, t=brass_thickness) {
44 od = id + (t*2);
45 cd = (id + od) / 2; // Chamfer diameter
46
47 brass() {
48 difference() {
49 tube(h=h, id=id, od=od);
50
51 // Chamfered ends
52 translate([0, 0, 0]) cylinder(h=1, d1=cd, d2=id);
53 translate([0, 0, h-1]) cylinder(h=1, d1=id, d2=cd);
54
55 translate([0, 0, 2]) rings(d=od);
56 translate([0, 0, h-2-rings_height]) rings(d=od);
57 }
58 }
59}
60
61// brass_bend provides a 180 degree bend in brass
62module brass_bend(od=12.7, bend_r=16, t=brass_thickness) {
63 color("gold") {
64 rotate([90, 0, 0]) {
65 rotate_extrude(angle=180) {
66 translate([bend_r, 0, 0]) {
67 difference() {
68 circle(d=od);
69 circle(d=od-t*2);
70 }
71 }
72 }
73 }
74 }
75}
76
77
78// derlin_tube is a non-chamfered sky blue tube.
79// I use blue so it's easier to see in preview.
80module derlin_tube(h=10, id=5, od=10) {
81 derlin() {
82 tube(h=h, id=id, od=od);
83 }
84}
85
86// derlin_stop is a derlin tube, chamfered on one end.
87module derlin_stop(h=10, id=5, od=10) {
88 chamferh = h/5;
89 derlin() {
90 difference() {
91 union() {
92 cylinder(h=h-chamferh, d=od);
93 translate([0, 0, h-chamferh]) cylinder(h=chamferh, d1=od, d2=id);
94 }
95 cylinder(h=h, d=id);
96 }
97 }
98}
99
100// default bell height
101bell_height = 17;
102
103// derlin_bell makes a decorative flared bell.
104// od will default to 33% larger than id.
105module derlin_bell(h=bell_height, id=5, od=0) {
106 chamferh = 1;
107 chamferd = 1;
108 ringsmargin = 1;
109 toph = rings_height + ringsmargin*2 + chamferh;
110 flareh = h - toph;
111 od = (od == 0) ? (id * 1.33) : od;
112 derlin() {
113 difference() {
114 union() {
115 cylinder(h=flareh, d1=id, d2=od);
116 translate([0, 0, flareh]) cylinder(h=toph-chamferh, d=od);
117 translate([0, 0, flareh+toph-chamferh]) cylinder(h=chamferh, d1=od, d2=od-chamferd);
118 }
119 cylinder(h=h, d=id);
120 translate([0, 0, flareh + ringsmargin]) rings(d=od);
121 }
122 }
123}