acorn: v1
[clinton/3d-models.git] / acorn / acorn-threads.scad
CommitLineData
28ef71df
CE
1// Threads for acorn model
2// Copyright (c) 2017 Clinton Ebadi <clinton@unknownlamer.org>
3
0cbf5490 4use <screw_threads.scad> // http://www.thingiverse.com/thing:1686322
28ef71df 5
0cbf5490
CE
6thread_pitch = 3.0;
7thread_size = 2.5; //2.2; // 3.0
8thread_tooth_height = thread_pitch - 0.4;
9thread_height = 3.5; //4.0;
10wall_thickness = thread_size;
11base_height = 25;
12inner_d = 24.5;
13outer_d = inner_d + wall_thickness*2; //33;
28ef71df 14
0cbf5490
CE
15internal_thread_tolerance = 0.3;
16external_thread_tolerance = 0.2;
17thread_angle = 50;
28ef71df
CE
18
19
0cbf5490
CE
20module acorn_thread (outer_d = outer_d, internal = false, ring = true) {
21 outer_d = outer_d;
28ef71df
CE
22
23 if (internal) {
0cbf5490
CE
24 outer_ring_d = outer_d+max(thread_size, wall_thickness)+1;
25 echo ("outer ring = ", outer_ring_d);
26 ScrewHole (outer_diam=outer_d, height = thread_height, pitch = thread_pitch, tooth_height = thread_tooth_height, tooth_angle = thread_angle, tolerance=internal_thread_tolerance) {
27 if (ring) cylinder (d = outer_ring_d, h = thread_height);
28ef71df
CE
28 }
29 }
30
28ef71df
CE
31 if (!internal) {
32 difference () {
0cbf5490
CE
33 ScrewThread (outer_diam=outer_d, height = thread_height, pitch = thread_pitch, tooth_height = thread_tooth_height, tooth_angle = thread_angle, tolerance=external_thread_tolerance);
34 cylinder (d = outer_d-wall_thickness-thread_size-0.01, h = thread_height * 4, center=true);
28ef71df
CE
35 }
36 }
37}
38
39
0cbf5490
CE
40module nut_body (h = base_height, d = outer_d, nub = true) {
41 translate ([0 ,0, h]) {
42 intersection () {
43 union () {
44 resize ([d, d, h*2]) sphere (d=h*2);
45 if (nub) {
46 translate ([0, d/2-wall_thickness/2, -thread_height]) sphere (d=wall_thickness*2, $fs = 0.1);
47 }
48 }
49 translate ([0 ,0, -h/2]) cube ([d*2, d*2, h], center=true);
50 }
28ef71df
CE
51 }
52}
53
0cbf5490 54module nut () {
28ef71df 55 difference () {
0cbf5490
CE
56 nut_body ();
57 translate ([0, 0, wall_thickness + 0.01]) nut_body (d=outer_d-wall_thickness*2, nub=false);
28ef71df 58 }
28ef71df 59
0cbf5490 60 translate ([0, 0, base_height-0.1]) acorn_thread (outer_d = outer_d);
28ef71df
CE
61}
62
28ef71df 63
28ef71df 64
0cbf5490
CE
65$fs = 1;
66$fa = 1;
28ef71df 67
0cbf5490
CE
68module cap_keychain (hole_d=3, spacing=15 /*12*/) {
69 h=100;
70 translate ([-spacing/2, 0, 0]) cylinder (d=hole_d, h=h, $fs=0.1);
71 translate ([spacing/2, 0, 0]) cylinder (d=hole_d, h=h, $fs=0.1);
72}
28ef71df 73
0cbf5490
CE
74module cap () {
75 scale_f = outer_d / 171;
76 difference () {
77 scale ([scale_f, scale_f, scale_f]) {
78 difference () {
79 union () {
80 translate ([0, 0, -1]) import ("Acorn_Unthreaded/cap_reduced.stl");
81 echo ("h = ", thread_height/scale_f);
82 cylinder (d = 180, h=thread_height/scale_f);
83 }
84 translate ([0, 0, -0.51]) cube ([200, 200, 1], center=true);
85 }
86 }
87 cap_keychain ();
88 acorn_thread (internal = true, ring = false);
89 }
90}
28ef71df 91
0cbf5490
CE
92module gasket (gasket_height=0.9) {
93 cylinder (d = outer_d, h = gasket_height, center=true);
94}
28ef71df
CE
95
96module nuts () {
0cbf5490
CE
97//translate ([outer_d+10, 0, 0,]) nut ();
98//cap ();
99translate ([-(outer_d+10), 0, 0,]) gasket ();
28ef71df
CE
100}
101
28ef71df
CE
102nuts ();
103
28ef71df 104module print_test () {
0cbf5490 105 translate ([outer_d+thread_size+5, 0, thread_height]) rotate ([180, 0, 0]) acorn_thread (outer_d = outer_d, internal=true);
28ef71df 106 translate ([0, 0, thread_height]) rotate ([180, 0, 0]) union () {
0cbf5490
CE
107 translate ([0, 0, 0]) cylinder (d=outer_d-wall_thickness, h=thread_height);
108 translate ([0, 0, -thread_height*3]) cylinder (d=outer_d/3, h=thread_height*3);
109 acorn_thread (outer_d = outer_d);
28ef71df
CE
110 }
111
112
113}