1//////////////////////////////////////////////////////////////////////
2// LibFile: torx_drive.scad
3// Torx driver bits
4// To use, add these lines to the top of your file:
5// ```
6// include <BOSL/constants.scad>
7// use <BOSL/torx_drive.scad>
8// ```
9//////////////////////////////////////////////////////////////////////
10
11/*
12BSD 2-Clause License
13
14Copyright (c) 2017, Revar Desmera
15All rights reserved.
16
17Redistribution and use in source and binary forms, with or without
18modification, are permitted provided that the following conditions are met:
19
20* Redistributions of source code must retain the above copyright notice, this
21 list of conditions and the following disclaimer.
22
23* Redistributions in binary form must reproduce the above copyright notice,
24 this list of conditions and the following disclaimer in the documentation
25 and/or other materials provided with the distribution.
26
27THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
28AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
30DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
31FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
33SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
34CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
35OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37*/
38
39
40use <transforms.scad>
41use <math.scad>
42include <constants.scad>
43include <compat.scad>
44
45
46// Section: Functions
47
48
49// Function: torx_outer_diam()
50// Description: Get the typical outer diameter of Torx profile.
51// Arguments:
52// size = Torx size.
53function torx_outer_diam(size) = lookup(size, [
54 [ 6, 1.75],
55 [ 8, 2.40],
56 [ 10, 2.80],
57 [ 15, 3.35],
58 [ 20, 3.95],
59 [ 25, 4.50],
60 [ 30, 5.60],
61 [ 40, 6.75],
62 [ 45, 7.93],
63 [ 50, 8.95],
64 [ 55, 11.35],
65 [ 60, 13.45],
66 [ 70, 15.70],
67 [ 80, 17.75],
68 [ 90, 20.20],
69 [100, 22.40]
70]);
71
72
73// Function: torx_inner_diam()
74// Description: Get typical inner diameter of Torx profile.
75// Arguments:
76// size = Torx size.
77function torx_inner_diam(size) = lookup(size, [
78 [ 6, 1.27],
79 [ 8, 1.75],
80 [ 10, 2.05],
81 [ 15, 2.40],
82 [ 20, 2.85],
83 [ 25, 3.25],
84 [ 30, 4.05],
85 [ 40, 4.85],
86 [ 45, 5.64],
87 [ 50, 6.45],
88 [ 55, 8.05],
89 [ 60, 9.60],
90 [ 70, 11.20],
91 [ 80, 12.80],
92 [ 90, 14.40],
93 [100, 16.00]
94]);
95
96
97// Function: torx_depth()
98// Description: Gets typical drive hole depth.
99// Arguments:
100// size = Torx size.
101function torx_depth(size) = lookup(size, [
102 [ 6, 1.82],
103 [ 8, 3.05],
104 [ 10, 3.56],
105 [ 15, 3.81],
106 [ 20, 4.07],
107 [ 25, 4.45],
108 [ 30, 4.95],
109 [ 40, 5.59],
110 [ 45, 6.22],
111 [ 50, 6.48],
112 [ 55, 6.73],
113 [ 60, 8.17],
114 [ 70, 8.96],
115 [ 80, 9.90],
116 [ 90, 10.56],
117 [100, 11.35]
118]);
119
120
121// Function: torx_tip_radius()
122// Description: Gets minor rounding radius of Torx profile.
123// Arguments:
124// size = Torx size.
125function torx_tip_radius(size) = lookup(size, [
126 [ 6, 0.132],
127 [ 8, 0.190],
128 [ 10, 0.229],
129 [ 15, 0.267],
130 [ 20, 0.305],
131 [ 25, 0.375],
132 [ 30, 0.451],
133 [ 40, 0.546],
134 [ 45, 0.574],
135 [ 50, 0.775],
136 [ 55, 0.867],
137 [ 60, 1.067],
138 [ 70, 1.194],
139 [ 80, 1.526],
140 [ 90, 1.530],
141 [100, 1.720]
142]);
143
144
145// Function: torx_rounding_radius()
146// Description: Gets major rounding radius of Torx profile.
147// Arguments:
148// size = Torx size.
149function torx_rounding_radius(size) = lookup(size, [
150 [ 6, 0.383],
151 [ 8, 0.510],
152 [ 10, 0.598],
153 [ 15, 0.716],
154 [ 20, 0.859],
155 [ 25, 0.920],
156 [ 30, 1.194],
157 [ 40, 1.428],
158 [ 45, 1.796],
159 [ 50, 1.816],
160 [ 55, 2.667],
161 [ 60, 2.883],
162 [ 70, 3.477],
163 [ 80, 3.627],
164 [ 90, 4.468],
165 [100, 4.925]
166]);
167
168
169// Section: Modules
170
171
172// Module: torx_drive2d()
173// Description: Creates a torx bit 2D profile.
174// Arguments:
175// size = Torx size.
176// Example(2D):
177// torx_drive2d(size=30, $fa=1, $fs=1);
178module torx_drive2d(size) {
179 od = torx_outer_diam(size);
180 id = torx_inner_diam(size);
181 tip = torx_tip_radius(size);
182 rounding = torx_rounding_radius(size);
183 base = od - 2*tip;
184 $fn = quantup(segs(od/2),12);
185 difference() {
186 union() {
187 circle(d=base);
188 zring(n=2) {
189 hull() {
190 zring(n=3) {
191 translate([base/2,0,0]) {
192 circle(r=tip, $fn=$fn/2);
193 }
194 }
195 }
196 }
197 }
198 zring(n=6) {
199 zrot(180/6) {
200 translate([id/2+rounding,0,0]) {
201 circle(r=rounding);
202 }
203 }
204 }
205 }
206}
207
208
209
210// Module: torx_drive()
211// Description: Creates a torx bit tip.
212// Arguments:
213// size = Torx size.
214// l = Length of bit.
215// center = If true, centers bit vertically.
216// Examples:
217// torx_drive(size=30, l=10, $fa=1, $fs=1);
218module torx_drive(size, l=5, center=undef, orient=ORIENT_Z, align=V_UP) {
219 od = torx_outer_diam(size);
220 orient_and_align([od, od, l], orient, align, center) {
221 linear_extrude(height=l, convexity=4, center=true) {
222 torx_drive2d(size);
223 }
224 }
225}
226
227
228
229// vim: noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap
230