Skip to content

Instantly share code, notes, and snippets.

@kazuho
Created January 8, 2024 10:34
Show Gist options
  • Save kazuho/0727ce69542adb3b08309ba65ffe87e8 to your computer and use it in GitHub Desktop.
Save kazuho/0727ce69542adb3b08309ba65ffe87e8 to your computer and use it in GitHub Desktop.
Nespressoカプセルホルダ(OpenSCAD形式)レイヤ0.2mm前提
Rtop = 12;
Htop = 25;
Rin = 15;
Rout = 20;
H = 2 + (Rout - Rin) / 1.5;
thick = 1.2;
rows = 7;
cols = 5;
for (i = [0:cols - 1]) {
difference () {
hull () {
translate([thick + Rout + (Rout * 2 + thick) * i, 0, thick + Rout])
rotate([-90, 0, 0])
cylinder(r = thick + Rout, h = H + thick * 2, $fn = 64);
translate([thick + Rout + (Rout * 2 + thick) * i, 0,
thick + Rout * 2 * (rows - 1) + Rout])
rotate([-90, 0, 0])
cylinder(r = thick + Rout, h = H + thick * 2, $fn = 64);
}
translate([(Rout * 2 + thick) * i, 0, thick + Rout]) {
linear_extrude(Rout * 2 * rows) {
polygon([[thick + Rout - Rin, 0],
[thick + Rout - Rin, thick],
[thick, thick + (Rout - Rin) / 1.5],
[thick, H + thick - 0.4],
[thick + 0.4, H + thick],
[thick + Rout * 2 - 0.4, H + thick],
[thick + Rout * 2, H + thick - 0.4],
[thick + Rout * 2, thick + (Rout - Rin) / 1.5],
[thick + Rout + Rin, thick],
[thick + Rout + Rin, 0]]);
}
}
translate([(Rout * 2 + thick) * i + thick + Rout, 0, thick + Rout]) {
rotate([-90, 0, 0]) {
cylinder(r = Rout, h = H + thick - 0.4, $fn = 64);
translate([0, 0, thick + H - 0.4])
cylinder(r1 = Rout, r2 = Rout - 0.4, h = 0.4, $fn = 64);
}
}
translate([0, 0, thick + Rout * 2 * (rows - 1) + Rout])
cube([thick + (Rout * 2 + thick) * cols, thick + H, Rout + thick]);
for (j = [0:rows - 1]) {
hull () {
translate([thick + (Rout * 2 + thick) * i + Rout, 0,
thick + Rout * 2 * j + Rout])
rotate([-90, 0, 0])
cylinder(r = Rout / 2, h = 100, $fn = 64);
translate([thick + (Rout * 2 + thick) * i + Rout, 0, thick + Rout * 2 * (j + 1) - thick - Rout / 2])
rotate([-90, 0, 0])
cylinder(r = Rout / 2, h = 100, $fn = 64);
}
}
}
// bottom holder
translate([thick + (Rout * 2 + thick) * i + Rout, 0, thick + Rout]) {
rotate([90, 0, 0]) {
difference () {
sphere(r = thick + Rout, $fn = 64);
sphere(r = Rout, $fn = 64);
translate([-50, -50, -50])
cube([100, 100, 50]);
rotate([45, 0, 0])
translate([-50, 0, -50])
cube([100, 100, 100]);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment