3d_print/Dom/Wiedzmin_stary_swiat/na_karty.scad

118 lines
No EOL
4.3 KiB
OpenSCAD

include <BOSL2/std.scad>
// EDITABLE VARIABLES
$fn = 36; // dokładność renderu, wyżej niż 360 nie ma sensu
$slop = 1; // luz wokół karty, polecam co najmniej 0.5
t = 1.5; // ogólna grubość ścianek
layer_h = 0.25; // layer height, for text to be 1 layer
wing_h = 0.8; // procent wysokości boków pokrywek do wysokości podstawek
tab_w = 10; // szerokość nachodzących na siebie krawedzi
// rozmiar karty
// karta = [65,100];
karta = [67,102]; // karta + koszulka
koszulka_h = 1.2; // o ile więcej wysokości daje koszulka
dziura = [30,65];
// Tablica o wartościach:
// [wysokość pliku kart, "tekst", rozmiar tekstu],
tab = [
[35*koszulka_h, "Karty Akcji", 10],
[18*koszulka_h, "Karty Akcji postaci", 8],
// [4, "Atrybuty", 10], // za małe
[13*koszulka_h, "Eksploracja Miasta", 8],
[13*koszulka_h, "Eksploracja Dziczy", 8],
[20*koszulka_h, "Zdarzenia", 10],
[11*koszulka_h, "Eliksiry", 10],
[(7.5 + 3 + 5.5)*koszulka_h, "Trofea szkół + Atrybuty + INNE", 5],
[18*koszulka_h, "Potwory i ataki", 10]
// [6, "INNE", 10]
];
// END OF EDITABLE VARIABLES
// (raczej) NIE EDYTOWAĆ
card = [karta[0]+2*$slop, karta[1]+2*$slop];
out = [card[0]+2*t, card[1]+2*t];
module wing_with_tabs(dim, rot) {
zrot(rot) union() {
// side wing
cuboid(dim, anchor=BOTTOM, rounding=t/2);
// tab
left(dim[0]) fwd(dim[1]/2)
cuboid([dim[0], tab_w, dim[2]], anchor=BOTTOM, rounding=t/2);
left(dim[0]) back(dim[1]/2)
cuboid([dim[0], tab_w, dim[2]], anchor=BOTTOM, rounding=t/2);
// connection with main side wing
left(dim[0]/2) back(dim[1]/2 - tab_w/4)
cuboid([dim[0]*2, tab_w/2, dim[2]], anchor=BOTTOM, rounding=t/2);
left(dim[0]/2) fwd(dim[1]/2 - tab_w/4)
cuboid([dim[0]*2, tab_w/2, dim[2]], anchor=BOTTOM, rounding=t/2);
// connection to the bottom
left(dim[0]/2) back(dim[1]/2)
cuboid([dim[0]*2, tab_w, t], anchor=BOTTOM, rounding=t/2);
left(dim[0]/2) fwd(dim[1]/2)
cuboid([dim[0]*2, tab_w, t], anchor=BOTTOM, rounding=t/2);
}
}
module box(h_in,txt, txt_size) {
h = h_in + t;
// bottom box
difference() {
// main body
cuboid([each out, h],anchor=BOTTOM, rounding=t/2);
// hole for cards
up(t) cuboid([each card, h-t], anchor=BOTTOM, rounding=-t/2, edges=TOP);
// text
color("blue") right(card[0]/2 - txt_size) zrot(180)
text3d(txt, h=layer_h, orient=DOWN, anchor=TOP, center=true, spin=90, size=txt_size);
color("red") up(t) right(card[0]/2 - txt_size)
text3d(txt, h=layer_h, orient=UP, anchor=TOP, center=true, spin=90, size=txt_size);
// hole in the bottom
left(txt_size/2) cuboid([each dziura,t], chamfer=-t/4, anchor=BOTTOM);
// sides cutouts
difference() {
union() {
cuboid([card[0]/2, card[1]*2, h], anchor=BOTTOM, rounding=-t, edges=TOP);
cuboid([card[0]*2, card[1]/2, h], anchor=BOTTOM, rounding=-t, edges=TOP);
}
cuboid([card[0]-$slop*2, card[1]-$slop*2, t], anchor=BOTTOM);
}
}
// top cover
fwd(out[1] + 2*t)
// up(h+2*t) xrot(180) // test fit
union() {
// cover
difference() {
cuboid([each out, t], anchor=BOTTOM, rounding=t/2);
// text
color("blue") right(card[0]/2 - txt_size) down(0.01) zrot(180)
text3d(txt, h=layer_h, orient=DOWN, anchor=TOP, center=true, spin=90, size=txt_size);
color("red") right(card[0]/2 - txt_size) up(t+0.01)
text3d(txt, h=layer_h, orient=UP, anchor=TOP, center=true, spin=90, size=txt_size);
// hole in the top
down(0.01) left(txt_size/2) cuboid([each dziura,t + 0.02], chamfer=-t/4, anchor=BOTTOM);
}
// side wings
left(out[0]/2 - t/2) wing_with_tabs([t,card[1]/2-$slop,h*wing_h], 0);
right(out[0]/2 - t/2) wing_with_tabs([t,card[1]/2-$slop,h*wing_h], 180);
fwd(out[1]/2 - t/2) wing_with_tabs([t,card[0]/2-$slop,h*wing_h], 90);
back(out[1]/2 - t/2) wing_with_tabs([t,card[0]/2-$slop,h*wing_h], 270);
}
}
// create all models
for(i=[0:len(tab)-1]) {
left((out[0] + 4*t)*i) box(tab[i][0], tab[i][1], tab[i][2]);
}