mirror of
https://github.com/correl/openscad.git
synced 2024-11-22 03:00:11 +00:00
Add button housing
This commit is contained in:
parent
529d080576
commit
6a707e10d2
1 changed files with 65 additions and 0 deletions
65
button.scad
Normal file
65
button.scad
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
/* Simple button attachment */
|
||||||
|
|
||||||
|
$fn = 50;
|
||||||
|
|
||||||
|
mode = "base"; // ["cap", "base", "all"]
|
||||||
|
tolerance = 0.4;
|
||||||
|
|
||||||
|
base_width = 6;
|
||||||
|
base_depth = 6;
|
||||||
|
base_height= 3;
|
||||||
|
button_diameter = 3.4;
|
||||||
|
button_height = 2;
|
||||||
|
|
||||||
|
movement = 0.4;
|
||||||
|
|
||||||
|
|
||||||
|
module button() {
|
||||||
|
translate([0,0,-0.001]) {
|
||||||
|
union() {
|
||||||
|
translate([-base_width/2, -base_depth/2, 0])
|
||||||
|
cube([base_width,base_depth,base_height]);
|
||||||
|
translate([0,0,base_height - 0.001])
|
||||||
|
cylinder(h=button_height,r=button_diameter/2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mode == "cap" || mode == "all") {
|
||||||
|
union() {
|
||||||
|
cylinder(h=5, r=3.5);
|
||||||
|
cylinder(h=.5, r=5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mode == "base" || mode == "all") {
|
||||||
|
translate([0,0,-2.5])
|
||||||
|
difference() {
|
||||||
|
union() {
|
||||||
|
translate([-15, -.5, -3.1])
|
||||||
|
cube([30, 1, 6.1]);
|
||||||
|
translate([-3.75, -3.75, -3.1])
|
||||||
|
cube([7.5,7.5,6.1]);
|
||||||
|
translate([12,0,-3.1])
|
||||||
|
cylinder(h=6.1,r=3);
|
||||||
|
translate([-12,0,-3.1])
|
||||||
|
cylinder(h=6.1,r=3);
|
||||||
|
}
|
||||||
|
translate([-3.25, -3.25, -2.101])
|
||||||
|
cube([6.5, 6.5, 5]);
|
||||||
|
translate([0,0,2])
|
||||||
|
cylinder(h=1.01, r=5.5);
|
||||||
|
translate([0.5,0.5,-3.2])
|
||||||
|
cube([2.75,2.75,5]);
|
||||||
|
translate([-3.25,0.5,-3.2])
|
||||||
|
cube([2.75,2.75,5]);
|
||||||
|
translate([0.5,-3.25,-3.2])
|
||||||
|
cube([2.75,2.75,5]);
|
||||||
|
translate([-3.25,-3.25,-3.2])
|
||||||
|
cube([2.75,2.75,5]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode == "all") {
|
||||||
|
translate([0,0,-4.6])
|
||||||
|
color("gray")
|
||||||
|
button();
|
||||||
|
}
|
Loading…
Reference in a new issue