acorn: v0
[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
4use <threads.scad>
5use <screw_threads.scad>
6use <Paraboloid.scad>
7
8
9//outer_d = 178;
10thread_pitch = 2.0;
11thread_size = 1.5;
12outer_d = (26 - thread_size - 10)/2;
13base_d = outer_d / 3;
14thread_height = 4;
15wall_thickness = 3;
16base_height = 20;
17
18thread_tolerance = 0.6;
19thread_angle = 60;
20
21
22//cylinder (d = outer_d, h = 10);
23module acorn_thread (outer_d = outer_d, internal = false) {
24 //outer_d = outer_d + (internal ? thread_tolerance : 0);
25 outer_d = outer_d + thread_size;
26 thread_height = thread_height; // + (internal ? thread_tolerance : 0);
27 local_thread_size = thread_size; // + (internal ? thread_tolerance : 0);
28
29
30
31 if (internal) {
32 echo ("outer ring = ", outer_d+wall_thickness/2+local_thread_size);
33 ScrewHole (outer_diam=outer_d, height = thread_height, pitch = thread_pitch, angle = thread_angle) {
34 cylinder (d = outer_d+wall_thickness/2+thread_size, h = thread_height);
35 }
36 }
37
38 //translate ([0, 0, internal ? -0.0 : 0]) metric_thread (diameter=outer_d, pitch = thread_pitch, thread_size=local_thread_size, length = thread_height, internal=internal, angle=thread_angle);
39
40 if (!internal) {
41 difference () {
42 ScrewThread (outer_diam=outer_d, height = thread_height, pitch = thread_pitch, tooth_height = local_thread_size, angle = thread_angle);
43 cylinder (d = outer_d-wall_thickness-local_thread_size-0.01, h = thread_height * 4, center=true);
44 }
45 }
46}
47
48
49module acorn_base_1 () {
50 hull () {
51
52 translate ([0, 0, base_height-base_d/2]) cylinder (d=outer_d, h=0.1);
53 sphere (r = base_d);
54 }
55}
56
57module acorn_base_xxx () {
58 difference () {
59 acorn_base_1 ();
60 resize ([outer_d-wall_thickness, 0, 0], auto=true) acorn_base_1 ();
61 translate ([0, 0, base_height-base_d/2-wall_thickness]) cylinder (d = outer_d - wall_thickness, h = 5);
62 }
63}
64
65rfa = 2;
66real_outer_d = 4 * sqrt(outer_d/2)*sqrt(base_height/sqrt(outer_d/2)) + rfa*2;
67echo (real_outer_d);
68module nut_1 () {
69 paraboloid (y=base_height, f=sqrt(outer_d/2),rfa=rfa,fc=0,detail=120, x = outer_d, hi=base_height);
70}
71
72module nut () {
73 //cylinder(d=real_outer_d, h=base_height+1);
74 difference () {
75 nut_1 ();
76 translate ([0, 0, wall_thickness]) resize ([real_outer_d - wall_thickness, 0, 0], auto=true) nut_1 ();
77 }
78
79 translate ([0, 0, base_height-0.1]) acorn_thread (outer_d = real_outer_d);//, $fa=0.1, $fs=0.1);
80
81}
82
83
84
85//$fs = 0.1;
86//$fa = 1;
87
88module nuts () {
89//translate ([real_outer_d+10, 0, 0,]) nut ();
90translate ([0, 0, thread_height]) rotate ([180, 0, 0]) acorn_thread (outer_d = real_outer_d, internal=true); //, outer_d=real_outer_d);
91
92}
93
94//print_test();
95nuts ();
96
97//fit_test ();
98
99module print_test () {
100 translate ([real_outer_d+5, 0, thread_height]) rotate ([180, 0, 0]) acorn_thread (outer_d = real_outer_d, internal=true); //, outer_d=real_outer_d);
101 translate ([0, 0, thread_height]) rotate ([180, 0, 0]) union () {
102 translate ([0, 0, 0]) cylinder (d=real_outer_d-wall_thickness, h=thread_height);
103 translate ([0, 0, -thread_height*3]) cylinder (d=real_outer_d/2, h=thread_height*3);
104 acorn_thread (outer_d = real_outer_d);
105 }
106
107
108}
109
110module fit_test () {
111 intersection () {
112 union () {
113 color ("YellowGreen", 0.5) acorn_thread (outer_d = real_outer_d, internal=true);
114 /* /\*translate ([0, 0, thread_height]) rotate ([180, 0, 0]) *\/ color ("Peru") union () { */
115 /* translate ([0, 0, 0]) cylinder (d=real_outer_d-wall_thickness, h=thread_height); */
116 /* translate ([0, 0, -thread_height*3]) cylinder (d=real_outer_d/2, h=thread_height*3); */
117 /* acorn_thread (outer_d = real_outer_d); */
118 /* } */
119 }
120 //color ("White", 0.5) cube (real_outer_d);
121 }
122
123
124}