possibly-working pig
This commit is contained in:
parent
e60c7bce05
commit
2f8eab0b3b
|
@ -1,7 +1,7 @@
|
||||||
// Make circles lovely and round
|
// Make circles lovely and round
|
||||||
$fa = 1; $fs = 0.1;
|
$fa = 1; $fs = 0.1;
|
||||||
|
|
||||||
outer_dimensions = [24.2, 21, 27];
|
outer_dimensions = [24.2, 21, 25];
|
||||||
outer_radius = 3.7;
|
outer_radius = 3.7;
|
||||||
wall_width = [1.3, 1.3, 1.3];
|
wall_width = [1.3, 1.3, 1.3];
|
||||||
inner_dimensions = outer_dimensions - (wall_width * 2);
|
inner_dimensions = outer_dimensions - (wall_width * 2);
|
||||||
|
@ -14,27 +14,20 @@ channel = [16, 1, 1]; // Difensions of cap channel
|
||||||
channel_height = 2; // How far into the case the clips need to go
|
channel_height = 2; // How far into the case the clips need to go
|
||||||
cap_thickness = 1.3;
|
cap_thickness = 1.3;
|
||||||
|
|
||||||
// More information: https://danielupshaw.com/openscad-rounded-corners/
|
module roundedcube(size=[1, 1, 1], center=false, r=0.5) {
|
||||||
module roundedcube_simple(size=[1, 1, 1], center=false, r=0.5) {
|
size = (size[0]==undef) ? [size, size, size] : size;
|
||||||
// If single value, convert to [x, y, z] vector
|
cubeSize = [size[0] - 2*r, size[1] - 2*r, size[2]];
|
||||||
size = (size[0] == undef) ? [size, size, size] : size;
|
|
||||||
|
|
||||||
translate = (center == false) ?
|
translate(center ? [0,0,0] : size/2) {
|
||||||
[r, r, r] :
|
union() {
|
||||||
[
|
cube([size[0], cubeSize[1], size[2]], center=true);
|
||||||
r - (size[0] / 2),
|
cube([cubeSize[0], size[1], size[2]], center=true);
|
||||||
r - (size[1] / 2),
|
for (ymul = [-0.5, 0.5]) {
|
||||||
r - (size[2] / 2)
|
for (xmul = [-0.5, 0.5]) {
|
||||||
];
|
translate([cubeSize[0]*xmul, cubeSize[1]*ymul, 0]) cylinder(h=size[2], r=r, center=true);
|
||||||
|
}
|
||||||
translate(v = translate)
|
}
|
||||||
minkowski() {
|
}
|
||||||
cube(size = [
|
|
||||||
size[0] - (r * 2),
|
|
||||||
size[1] - (r * 2),
|
|
||||||
size[2] - (r * 2)
|
|
||||||
]);
|
|
||||||
sphere(r = r);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,10 +47,12 @@ module usb_c() {
|
||||||
|
|
||||||
module case() {
|
module case() {
|
||||||
difference() {
|
difference() {
|
||||||
translate((outer_dimensions * z_elevate) + ([0, 0, -1] * outer_radius)) difference() {
|
translate((outer_dimensions * z_elevate) + ([0, 0, -1] * cap_thickness)) {
|
||||||
roundedcube_simple(outer_dimensions, center=true, r=outer_radius);
|
difference() {
|
||||||
roundedcube_simple(inner_dimensions, center=true, r=inner_radius);
|
roundedcube(outer_dimensions, center=true, r=outer_radius);
|
||||||
translate(-outer_dimensions/2) cube([100, 100, outer_radius]);
|
roundedcube(inner_dimensions, center=true, r=inner_radius);
|
||||||
|
translate(-outer_dimensions/2) cube([100, 100, cap_thickness]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// USB C port
|
// USB C port
|
||||||
|
@ -86,7 +81,7 @@ module body() {
|
||||||
translate([-6, 0, xiao_elevation]) rotate(45, [0, 0, 1]) cube(15, center=true);
|
translate([-6, 0, xiao_elevation]) rotate(45, [0, 0, 1]) cube(15, center=true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
translate(outer_dimensions * center) roundedcube_simple(outer_dimensions, r=outer_radius);
|
translate(outer_dimensions * center) roundedcube(outer_dimensions, r=outer_radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -109,7 +104,7 @@ module body() {
|
||||||
// Channel in the back to make it easier to squeeze in the XIAO
|
// Channel in the back to make it easier to squeeze in the XIAO
|
||||||
translate([-4.5, 0, xiao_elevation]) intersection() {
|
translate([-4.5, 0, xiao_elevation]) intersection() {
|
||||||
cube([13, 100, pcb_thickness], center=true);
|
cube([13, 100, pcb_thickness], center=true);
|
||||||
roundedcube_simple(inner_dimensions, center=true, r=inner_radius);
|
roundedcube(inner_dimensions, center=true, r=cap_thickness);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Channels for bottom insertion part thingy
|
// Channels for bottom insertion part thingy
|
||||||
|
@ -143,11 +138,11 @@ module cap() {
|
||||||
inner = inner_dimensions * 0.97; // leave 5% slop
|
inner = inner_dimensions * 0.97; // leave 5% slop
|
||||||
union() {
|
union() {
|
||||||
intersection() {
|
intersection() {
|
||||||
roundedcube_simple(outer_dimensions, center=true, r=outer_radius);
|
roundedcube(outer_dimensions, center=true, r=outer_radius);
|
||||||
translate([0, 0, cap_thickness/2]) cube([100, 100, cap_thickness], center=true);
|
translate([0, 0, cap_thickness/2]) cube([100, 100, cap_thickness], center=true);
|
||||||
}
|
}
|
||||||
intersection() {
|
intersection() {
|
||||||
roundedcube_simple(inner, center=true, r=inner_radius);
|
roundedcube(inner, center=true, r=inner_radius);
|
||||||
translate(center * inner) cube([100, 100, cap_thickness+2.2]);
|
translate(center * inner) cube([100, 100, cap_thickness+2.2]);
|
||||||
}
|
}
|
||||||
difference() {
|
difference() {
|
||||||
|
@ -175,7 +170,9 @@ if (TARGET == "body") {
|
||||||
body();
|
body();
|
||||||
} else if (TARGET == "cap") {
|
} else if (TARGET == "cap") {
|
||||||
cap();
|
cap();
|
||||||
} else {
|
} else if (true == true) {
|
||||||
color([0, 0.5, 0.5]) body();
|
color([0, 0.5, 0.5]) body();
|
||||||
color([0.5, 0, 0.5]) translate([0, 0, -cap_thickness]) cap();
|
color([0.5, 0, 0.5]) translate([0, 0, -cap_thickness]) cap();
|
||||||
|
} else {
|
||||||
|
roundedcube(10);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue