Commit 9d1d76dc authored by György Kurucz's avatar György Kurucz
Browse files

Add sd_card_holder model. Add helper script.

parent 38a79b7b
#!/bin/sh
dir=out/${1:-default}
mkdir -p $dir
for file in $(find src -type f -name '*.scad'); do
a=${file##*/}
b=$dir/${a%.scad}.csg
printf 'CSG %s -> %s\n' $file $b
openscad $file --hardwarnings -o $b
done
co_sd_card = [32, 24, 2.1];
co_usd_card = [15, 11, 1];
......@@ -49,6 +49,8 @@ module _screw_thread(N=10, R=10, R_min=12, R_maj=15, P=3, taper=true) {
);
}
function metric_screw_d_min(P, D_maj, tol=0) = 2 * (D_maj/2+tol-5/16*sqrt(3)*P);
/*
P: pitch
D_maj: major diameter
......@@ -58,7 +60,7 @@ module _screw_thread(N=10, R=10, R_min=12, R_maj=15, P=3, taper=true) {
*/
module metric_screw(P=3, D_maj=14, tol=0, h=30, taper=true) {
R_maj=D_maj/2+tol;
R_min=R_maj-5/16*sqrt(3)*P;
R_min=metric_screw_d_min(P, D_maj, tol) / 2;
R=R_min-sqrt(3)/8*P;
N=ceil(h/P);
intersection() {
......
use </home/kgy/repos/3d_models/include/screw.scad>;
use <../include/screw.scad>;
slots=8;
r=40;
......@@ -121,4 +121,4 @@ module segment() {
]);
}
}
}
\ No newline at end of file
}
......@@ -124,12 +124,16 @@ module case_top() {
}
}
rpi(5);
translate([pcb.x/2, pcb.y/2, space_below+pcb.z + space_above + corner_r - corner_r/2]) linear_extrude(h=corner_r) text("rPi", halign="center", valign="center", font="DejaVu Sans Mono", size=17);
translate([pcb.x/2, pcb.y/2, space_below+pcb.z + space_above + corner_r - corner_r/2]) linear_extrude(corner_r) text("rPi", halign="center", valign="center", font="DejaVu Sans Mono", size=17);
}
case_lip(1, 0.3);
pillars_top();
}
//rpi();
//case_bottom();
translate([0, 0, 10]) rotate([180, 0, 0]) case_top();
\ No newline at end of file
module canonical() {
translate([0,10,corner_r]) case_bottom();
translate([0, 0, space_below + pcb.z + space_above + corner_r]) rotate([180, 0, 0]) case_top();
translate([0,pcb.y + 20,0]) rpi();
}
canonical();
use <../include/screw.scad>;
include <../include/common_objects.scad>;
module flower2(r = 10, v = .2, n = 15) {
function rfn(a) = r - abs(sin(a*n))*v;
polygon([ for (i=[0:0.25:359.9999])
[ cos(i)*rfn(i), sin(i)*rfn(i) ] ]);
}
s_sd = co_sd_card + [.7, .5, .5];
s_usd = co_usd_card + [.5, .5, .4];
s_ad = [12, 25.1, 2.7] + [.4, .4, .3];
/*function n_parents(s, i = 0) = i < $parent_modules ?
n_parents(s, i + 1) + (parent_module(i) == s ? 1 : 0) :
0;*/
/*
R: outside radius
r: inside radius
h: total outside height
w: top wall thickness
g: inside gap
*/
module screw_box(R = 10, r = -1, h = 10, w = 1, g = 0,
txt = "", txt_size = 0) {
h2 = h / 2;
_r = r < 0 ? R * 0.9 : r;
P = (h2-w-g)/2;
tol = 0.7;
d_min = metric_screw_d_min(P = P, D_maj = 2*_r,
tol = tol);
module shape() { flower2(r = R, v = R * 0.025); }
module screw(tol = 0) {
intersection() {
translate([0,0,h-w-g])
rotate([180,0,0])
metric_screw(P=P,
D_maj=_r*2,tol=tol,taper=true);
translate([-R,-R,0])
cube([R*2,R*2, h-w]);
}
}
module base() {
intersection() {
union() {
linear_extrude(h2) shape();
screw();
}
corner_r = 6;
minkowski() {
translate([0,0,corner_r])
cylinder(r=R - corner_r, h=h, $fn=70);
sphere(r=corner_r, $fn=50);
}
}
}
module cap() {
difference() {
translate([0,0,h2]) linear_extrude(h2)
shape();
screw(tol = 0.7);
cylinder(d=d_min, h = h-w, $fn=100);
translate([0,0,h-w/2]) linear_extrude(w)
text(txt, halign="center",
valign="center", size=txt_size);
}
}
/* cap = n_parents("mark_cap") > 0;
flat = n_parents("mark_flat") > 0;
aside = n_parents("mark_aside") > 0; */
cap = !is_undef($mark_cap);
flat = !is_undef($mark_flat);
aside = !is_undef($mark_aside);
translate([aside ? 2*R : 0, 0, 0])
if (!cap) { base(); } else {
if (flat) {
translate([0,0,h]) rotate([180,0,0]) cap();
} else { cap(); }
}
}
/*module mark_cap() { children(); }
module mark_flat() { children(); }
module mark_aside() { children(); }*/
module screw_box_params() {
screw_box(R = 22.5, h = s_sd.y + 2.5, g = 3,
txt = "SD cards", txt_size = 7.5);
}
module sd_cards() {
g = 3;
G = 2;
module sd() {
translate([-s_sd.x/2,-G/2,1])
rotate([90,0,0]) cube(s_sd);
}
module usd() {
translate([-g/2 + s_usd.z/2,
s_sd.z + 1,
s_sd.y - s_usd.x + 1])
rotate([0,-90,0]) cube(s_usd);
}
module usds() { for (i = [0:2])
translate([-g*i,0,0]) usd(); }
module usdss() { mirror([1,0,0]) usds(); usds(); }
usdss();
translate([0,-1,0]) {
sd();
mirror([0,1,0]) sd();
translate([s_ad.y/2, -5.5, s_sd.y - s_ad.x + 1])
rotate([0,-90,90]) cube(s_ad);
}
//translate([0,-1,26]) scale([1,1.3,1]) sphere(r=10, $fn=100);
translate([0,0,33]) sphere(r=19, $fn=100);
}
module base() {
difference() { screw_box_params(); sd_cards(); }
}
module cap() {
$mark_cap = true;
screw_box_params();
}
module assembled() {
base();
translate([0,0,.1]) cap();
}
module print() {
translate([1,0,0]) {
$mark_aside = true; $mark_flat = true; cap(); }
base();
}
print();
use <../../include/rounded_square.scad>;
use <../include/rounded_square.scad>;
wall_t = 5; //wall thickness
wall_front = 19-2; //wall height on the front
......
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