Skip to content

Instantly share code, notes, and snippets.

@kazuho
Last active March 19, 2023 05:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kazuho/b1434b13cee3552c48790ee59e7f8e56 to your computer and use it in GitHub Desktop.
Save kazuho/b1434b13cee3552c48790ee59e7f8e56 to your computer and use it in GitHub Desktop.
inner_width = 90;
rasbpi_width = 65.3;
capture_width = 42.7;
mb_depth = 30.9;
mb_thick = 1.8;
hdmi_width = 18;
rasbpi_above = 3;
capture_below = 3;
uusb_width = 9;
uusb_height = 3;
uusb_x1 = 37;
uusb_x2 = 50;
mhdmi_x = 6;
mhdmi_width = 13;
mhdmi_height = 4;
ctor_wall_thick = 1;
ctor_wall_margin = 1.5;
ctor_clearance = 3;
holder_size = 5;
capture_rear_holder_depth = 1;
center_y = mb_depth / 2;
center_z = (mb_thick * 2 + rasbpi_above + capture_below) / 2;
outer_space = 100;
wall_thick = 1.5;
wall_margin = 2.5;
wall_radius = sqrt(center_y * center_y + center_z * center_z);
module holder(w, d, below, above) {
difference () {
translate([-outer_space, -outer_space, -below])
cube([w + outer_space * 2, d + outer_space * 2, below + mb_thick + above]);
cube([w, d, mb_thick]);
translate([holder_size, 0, -below])
cube([w - holder_size * 2, d, below + mb_thick + above]);
translate([0, holder_size, -below])
cube([inner_width, d - holder_size * 2, below + mb_thick + above]);
}
}
module the_cylinder(width, padding, padding_delta) {
translate([0, center_y, center_z])
rotate([0, 90, 0])
cylinder(r1 = wall_radius + padding,
r2 = wall_radius + padding + padding_delta,
h = width, $fn = 32);
}
module punch_mesh(actual_size, h) {
ratio = actual_size / 11.5;
scale([ratio, ratio, 1]) {
for (x = [0 : 5]) {
for (y = [0 : 5]) {
translate([x * 2, y * 2, 0])
cube([1.5, 1.5, h]);
}
}
}
}
module all () {
difference () {
union () {
intersection () {
union () {
// holders
difference () {
holder(rasbpi_width, mb_depth, outer_space, rasbpi_above);
/* // remove holder that has conflict with the connectors
translate([holder_size, mb_depth, -outer_space])
cube([rasbpi_width - holder_size * 2, outer_space, outer_space]);
*/
}
difference () {
translate([0, 0, mb_thick + rasbpi_above + capture_below])
holder(capture_width, mb_depth, capture_below, outer_space);
translate([capture_width - holder_size, capture_rear_holder_depth, mb_thick + rasbpi_above])
cube([holder_size, mb_depth - capture_rear_holder_depth * 2, capture_below + mb_thick + outer_space]);
}
}
difference () {
the_cylinder(rasbpi_width + 20, wall_margin + wall_thick, 0);
translate([rasbpi_width - 20, 0, 0])
the_cylinder(40, -wall_radius, wall_radius + wall_margin);
}
}
// main cylinder
difference () {
difference () {
translate([-1 * wall_thick, 0, 0])
the_cylinder(inner_width + 2 * wall_thick, wall_margin + wall_thick, 0);
translate([0, 0, 0])
the_cylinder(inner_width, wall_margin, 0);
}
// mesh
mesh_size = mb_depth - holder_size * 2;
translate([inner_width, center_y - mesh_size / 2, center_z + mesh_size / 2])
rotate([0, 90, 0])
punch_mesh(mesh_size, wall_thick);
}
}
// HDMI & microsd
intersection () {
translate([-wall_thick, (mb_depth - hdmi_width) / 2, -outer_space])
cube([wall_thick, hdmi_width, outer_space * 2]);
translate([-wall_thick, 0, 0])
the_cylinder(wall_thick, wall_margin, 0);
}
// uusb and mmdmi
translate([holder_size, mb_depth - ctor_wall_margin * 2, -mhdmi_height])
cube([rasbpi_width - holder_size * 2, ctor_wall_margin * 3, mhdmi_height]);
translate([holder_size - ctor_clearance, mb_depth + ctor_wall_margin + ctor_wall_thick, -mhdmi_height - ctor_clearance])
cube([rasbpi_width - holder_size * 2 + ctor_clearance * 2, outer_space, mhdmi_height + ctor_clearance * 2]);
translate([uusb_x1, mb_depth, -uusb_height])
cube([uusb_width, outer_space, uusb_height]);
translate([uusb_x2, mb_depth, -uusb_height])
cube([uusb_width, outer_space, uusb_height]);
translate([mhdmi_x, mb_depth, -mhdmi_height])
cube([mhdmi_width,outer_space, mhdmi_height]);
}
}
// body
translate([0, -40, 0]) {
intersection () {
all();
translate([holder_size, -outer_space, -outer_space])
cube([inner_width + outer_space, mb_depth + outer_space * 2, mb_depth + outer_space * 2]);
}
intersection () {
difference () {
translate([1, 0, 0])
the_cylinder(holder_size * 3, wall_margin, 0);
translate([1, 0, 0])
the_cylinder(holder_size * 2, wall_margin - wall_thick, 0);
translate([1 + holder_size * 2, 0, 0])
the_cylinder(holder_size, wall_margin - wall_thick, wall_margin);
}
translate([1, holder_size + .5, -outer_space])
cube([inner_width - 1, mb_depth - holder_size * 2 - 1, outer_space * 2]);
}
}
// rid
translate([holder_size * 2, 40, 0]) {
rotate([0, 0, 180]) {
intersection () {
all();
translate([-outer_space, -outer_space, -outer_space])
cube([outer_space + holder_size, mb_depth + outer_space * 2, mb_depth + outer_space * 2]);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment