-
Notifications
You must be signed in to change notification settings - Fork 2
/
screwdriver.scad
99 lines (90 loc) · 3.38 KB
/
screwdriver.scad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
//
// CADLibrary Copyright Bruno Adelé 2024
// blog.jesuislibre.org
//
// This file is part of CADLibrary.
//
// CADLibrary is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of
// the License, or (at your option) any later version.
//
// CADLibrary is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with CADLibrary.
// If not, see <https://www.gnu.org/licenses/>.
//
//! Screwdriver
//
include <NopSCADlib/utils/core/core.scad>
// screwdriver(270, 150, 37.5, 25, 17, 8);
module screwdriver(total_height, tool_height, max_diam, min_diam, washer_diam, tool_diam) //! Draw a screwdriver
{
vitamin(str("screwdriver(", total_height, ",", tool_height, ",", max_diam, ",", min_diam, ",", washer_diam, ",",
tool_diam, ",", "): Screwdriver ", total_height, "x", tool_height));
// Vars
handle_color = "#395F8A";
handle_color1 = "#FC7D16";
whasher_color = "#222";
whasher_height = 2;
cut_diam = 10;
cut_nb = 6;
cut_rot = 360 / cut_nb;
fn = 64;
// Computes
handle_height = total_height - tool_height;
module handle()
{
difference()
{
difference()
{
// handle
translate([ 0, 0, whasher_height ]) union()
{
// Top handle
color(handle_color) translate([ 0, 0, handle_height - whasher_height - max_diam / 2 ])
sphere(d = max_diam, $fn = fn);
// Main handle
color(handle_color)
cylinder(h = handle_height - whasher_height - max_diam / 2, d = max_diam, $fn = fn);
// Whasher handle
color("#222") translate([ 0, 0, -whasher_height ])
cylinder(h = whasher_height, d = washer_diam, $fn = fn);
}
// Cut bottom handle
color(handle_color1) rotate_extrude(convexity = 10) translate([ max_diam / 1.6, max_diam / 3, 0 ])
circle(max_diam / 5, $fn = fn);
}
// Cut main handle
for (i = [0:cut_nb - 1])
{
{
color(handle_color1) rotate(i * cut_rot, [ 0, 0, 1 ]) translate([ max_diam / 2, 0, -1 ])
cylinder(h = handle_height, d = cut_diam, $fn = fn);
}
}
}
}
module tool()
{
screw_height = 5;
paint_height = 10;
real_tool_height = tool_height - screw_height - paint_height;
color("#aaa") translate([ 0, 0, -real_tool_height ]) cylinder(h = real_tool_height, d = tool_diam, $fn = 32);
color("#222") translate([ 0, 0, -real_tool_height - paint_height ])
cylinder(h = paint_height, d = tool_diam, $fn = 32);
color("#222") translate([ 0, 0, -tool_height ]) cylinder(h = screw_height, d1 = 0.5, d2 = tool_diam, $fn = 32);
}
module object()
{
union()
{
handle();
tool();
}
}
object();
}