Commit 38a79b7b authored by György Kurucz's avatar György Kurucz
Browse files

Add pill box and screwdriver bit holder.

parent beb06ed4
...@@ -49,6 +49,13 @@ module _screw_thread(N=10, R=10, R_min=12, R_maj=15, P=3, taper=true) { ...@@ -49,6 +49,13 @@ module _screw_thread(N=10, R=10, R_min=12, R_maj=15, P=3, taper=true) {
); );
} }
/*
P: pitch
D_maj: major diameter
tol: tolerance
h: height
taper: taper
*/
module metric_screw(P=3, D_maj=14, tol=0, h=30, taper=true) { module metric_screw(P=3, D_maj=14, tol=0, h=30, taper=true) {
R_maj=D_maj/2+tol; R_maj=D_maj/2+tol;
R_min=R_maj-5/16*sqrt(3)*P; R_min=R_maj-5/16*sqrt(3)*P;
......
use </home/kgy/repos/3d_models/include/screw.scad>;
slots=8;
r=40;
corner_r=2.3;
center_gap_r=9;
edge_gap_r=3;
height=20;
center_bulge_r=8;
center_bulge=2;
bottom_thickness=1;
notch_r = 2;
screw_head_thickness=2;
lid_height = center_bulge-0.5;
//preview();
print();
module print() {
translate([0,0,lid_height])
rotate([180,0,0]) lid();
/*intersection() {
linear_extrude(20) union() { polygon([
[0,0], [50, 10], [10, 50]
]); circle(r=13); }
box();
}*/
/*intersection() {
rotate([0,0,-135]) linear_extrude(20) union() { polygon([
[0,0], [50, 10], [10, 50]
]); circle(r=13); }
translate([0,0,lid_height]) rotate([180,0,0]) lid();
}*/
//translate([27,0,height+2]) rotate([180,0,0]) screw();
}
module preview() {
box();
translate([0,0,height+5]) screw();
translate([0,0,height+5]) lid();
}
module flower(r=10, v=1, petals=8) {
function rfn(a) = r + sin(a*petals)*v;
polygon([ for (i=[1:360])
[ cos(i)*rfn(i), sin(i)*rfn(i) ] ]);
}
module screw() {
intersection() {
screw_thread(taper=true);
translate([-50,-50,0]) cube([100,100,height+1]);
}
translate([0,0,height])
linear_extrude(screw_head_thickness)
flower(v=0.8, r=10);
}
module screw_thread(taper=false, tol=0) {
intersection() {
translate([0,0,taper ? bottom_thickness : -1])
metric_screw(P=3, D_maj=14, tol=tol, taper=taper);
translate([-50,-50,bottom_thickness])
cube([100, 100, 100]);
}
}
module lid() {
union() {
linear_extrude(lid_height) difference() {
union() {
lid_tab_r = 15;
circle(r=r,$fn=200);
translate([0,r-lid_tab_r*(2/3),0])
flower(r=lid_tab_r, v=2, petals=5);
}
circle(r=center_bulge_r+0.3, $fn=100);
segment();
}
for (i=[-2:1]) {
rotate([0,0,(360/slots)*(i+.5)])
translate([0, r-edge_gap_r, lid_height/2])
intersection() {
sphere(r=notch_r, $fn=30);
translate([-50,-50,-notch_r+.3])
cube([100,100,notch_r-.3]);
}
}
}
}
module box() {
difference() {
union() {
cylinder(r=r, h=height, $fn=200);
cylinder(r=center_bulge_r,
h=height+center_bulge, $fn=50);
}
for (i=[1:slots]) rotate([0,0,(360/slots)*i ]) {
translate([0,0,bottom_thickness])
linear_extrude(height) segment();
rotate([0,0,360/slots/2])
translate([0, r-edge_gap_r, height])
sphere(r=notch_r, $fn=30);
}
screw_thread(tol=0.7);
}
}
module segment() {
minkowski() {
circle(r=corner_r, $fn=20);
intersection() {
circle(r=r-corner_r-edge_gap_r, $fn=100);
alpha=360/slots;
polygon([
[0,corner_r+center_gap_r],
[tan(alpha/2)*r,r+corner_r+center_gap_r],
[tan(-alpha/2)*r,r+corner_r+center_gap_r]
]);
}
}
}
\ No newline at end of file
use <../include/screw.scad>;
$fn=100;
bit_h = 30;
bit_raise = 1;
base_r = 30;
r = base_r - 3;
corner_r = 2;
base_h = 5;
cap_h = bit_h + bit_raise*2 - base_h
/* tolerance */ + 1;
pitch = 5;
module bit() {
translate([0,0,bit_raise])
cylinder(r=4/sqrt(3)+0.4, $fn=6, h=bit_h);
}
module bits() {
// https://en.wikipedia.org/wiki/Fermat%27s_spiral
b = .33;
angle_step = 137.5;
for (i = [1:30]) {
theta = angle_step*i;
r = b*sqrt(theta);
rotate([0,0,theta])
translate([r,0,0])
//rotate([0,0,-theta])
bit();
}
}
module screw(tol=0) {
/* screw */
R_min=r-5/16*sqrt(3)*pitch;
metric_screw(P=pitch, D_maj=r*2,
tol=tol, h=30, taper=true);
cylinder(r=R_min, h=100);
}
module box() {
intersection() {
union() {
/* base */
minkowski() {
translate([0,0,corner_r])
cylinder(h=base_h - corner_r * 2,
r=base_r - corner_r);
sphere(r=corner_r);
}
translate([0,0,base_h/2])
cylinder(h=base_h/2, r=base_r);
translate([0,0,5])
translate([0,0,11])
rotate([180,0,0])
screw();
}
translate([-50, -50, 0]) cube([100, 100, bit_raise + bit_h / 2]);
}
}
module cap() {
difference() {
union() {
minkowski() {
translate([0,0,corner_r])
cylinder(h=cap_h - corner_r * 2,
r=base_r - corner_r);
sphere(r=corner_r);
}
cylinder(h=cap_h/2, r=base_r);
}
intersection() {
translate([0,0,-4])
screw(tol=1);
cube([100,100,(cap_h - bit_raise)*2], center=true);
}
}
}
module bottom() {
difference() {
box();
bits();
}
}
module cutaway() {
rot = 10;
intersection() {
rotate([0,0,100]) union() {
bottom();
rotate([0,0,rot])
translate([0,0,base_h +
(rot/360)*pitch])
cap();
}
translate([-50,0,0])
cube([100,100,100]);
}
}
//cutaway();
bottom();
//cap();
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment