1//////////////////////////////////////////////////////////////////////
2// LibFile: phillips_drive.scad
3// Phillips driver bits
4// To use, add these lines to the top of your file:
5// ```
6// include <BOSL/constants.scad>
7// use <BOSL/phillips_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 <shapes.scad>
42include <constants.scad>
43include <compat.scad>
44
45
46// Section: Modules
47
48
49// Module: phillips_drive()
50// Description: Creates a model of a phillips driver bit of a given named size.
51// Arguments:
52// size = The size of the bit. "#1", "#2", or "#3"
53// shaft = The diameter of the drive bit's shaft.
54// l = The length of the drive bit.
55// Example:
56// xdistribute(10) {
57// phillips_drive(size="#1", shaft=4, l=20);
58// phillips_drive(size="#2", shaft=6, l=20);
59// phillips_drive(size="#3", shaft=6, l=20);
60// }
61module phillips_drive(size="#2", shaft=6, l=20, orient=ORIENT_Z, align=V_UP) {
62 // These are my best guess reverse-engineered measurements of
63 // the tip diameters of various phillips screwdriver sizes.
64 ang = 11;
65 rads = [["#1", 1.25], ["#2", 1.77], ["#3", 2.65]];
66 radidx = search([size], rads)[0];
67 r = radidx == []? 0 : rads[radidx][1];
68 h = (r/2)/tan(ang);
69 cr = r/2;
70 orient_and_align([shaft, shaft, l], orient, align) {
71 down(l/2) {
72 difference() {
73 intersection() {
74 union() {
75 clip = (shaft-1.2*r)/2/tan(26.5);
76 zrot(360/8/2) cylinder(h=clip, d1=1.2*r/cos(360/8/2), d2=shaft/cos(360/8/2), center=false, $fn=8);
77 up(clip-0.01) cylinder(h=l-clip, d=shaft, center=false, $fn=24);
78 }
79 cylinder(d=shaft, h=l, center=false, $fn=24);
80 }
81 zrot(45)
82 zring(n=4) {
83 yrot(ang) {
84 zrot(-45) {
85 off = (r/2-cr*(sqrt(2)-1))/sqrt(2);
86 translate([off, off, 0]) {
87 linear_extrude(height=l*2, convexity=4) {
88 difference() {
89 union() {
90 square([shaft, shaft], center=false);
91 back(cr) zrot(1.125) square([shaft, shaft], center=false);
92 right(cr) zrot(-1.125) square([shaft, shaft], center=false);
93 }
94 difference() {
95 square([cr*2, cr*2], center=true);
96 translate([cr,cr,0]) circle(r=cr, $fn=8);
97 }
98 }
99 }
100 }
101 }
102 }
103 }
104 }
105 }
106 }
107}
108
109
110// vim: noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap