-
Notifications
You must be signed in to change notification settings - Fork 1
/
microswitch.scad
executable file
·70 lines (62 loc) · 2.48 KB
/
microswitch.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
//
// Mendel90
//
// GNU GPL v2
// hydraraptor.blogspot.com
//
// Microswitch used for endstops
//
function microswitch_thickness() = 6.4;
function microswitch_length() = 19.8;
function microswitch_first_hole_x_offset() = -2;
function microswitch_button_x_offset() = -(5.1 - microswitch_first_hole_x_offset()) + microswitch_length() / 2;
function microswitch_hole_y_offset() = -8.4;
module microswitch_hole_positions()
{
for(x = [microswitch_first_hole_x_offset(), 7.5])
translate([x, microswitch_hole_y_offset(), microswitch_thickness() / 2])
child();
}
module microswitch_holes(r = No2_pilot_radius, h = 7.5)
{
translate([0, 0, -microswitch_thickness() - h / 2])
microswitch_hole_positions()
teardrop_plus(r = r, h = h + 1, center = true);
}
module microswitch_contact_space() {
depth = 15;
translate([-microswitch_first_hole_x_offset() + 0.75, -depth / 2 - 3, 0])
cube([microswitch_length() - 2, depth, microswitch_thickness() - 2], center = true);
}
module microswitch() {
vitamin("SMMICRO: Microswitch");
translate([-(5.1 + 9.5 - 7.5), -(8.4 + 2.5), -3.2 + (exploded ? 5 : 0)]) { // put operating point of button at the origin
color(microswitch_color) render() difference() { // main body
cube([19.8, 10.2, 6.4]);
translate([10, 9.5, -1])
cube([19.8, 10.2, 8]); // lower half of top
translate([5.1, 2.5, -1])
cylinder(r = 2.35 / 2, h = 8); // mounting holes
translate([5.1 + 9.5, 2.5, -1])
cylinder(r = 2.35 / 2, h = 8);
}
color(microswitch_button_color) render() // orange button
translate([5.1 + 9.5 - 7.5,8.4 + 2.5 - 0.5,1.6])
linear_extrude(height = 3.2)
hull() {
circle(r = 1);
translate([0,-4])
circle(r = 1);
}
color(microswitch_contact_color) render() // yellow contacts
for(x = [1.6, 1.6 + 8.8, 1.6 + 8.8 + 7.3])
translate([x, 2.5 - 6.4, 1.6])
difference() {
cube([0.5, 7, 3.2]);
translate([0, 1.6, 1.6])
rotate([0,90,0])
cylinder(r = 0.8, h = 5, center = true);
}
}
}