Skip to content

Instantly share code, notes, and snippets.

@lewisd32
Created June 25, 2015 17:00
Show Gist options
  • Save lewisd32/2ea605b407cecf68366e to your computer and use it in GitHub Desktop.
Save lewisd32/2ea605b407cecf68366e to your computer and use it in GitHub Desktop.
pcb_width = 21;
pcb_length = 28;
pcb_inset_depth = 1;
base_thickness = 2;
corner_thickness = 1;
corner_x_len = 2;
corner_y_len = 4;
corner_z_height = 3;
waffle_z_height = 3;
waffle_x_interval = 2;
waffle_y_interval = 2;
waffle_thickness = 0.1;
waffle_top_gap = 4.5;
waffle_bottom_gap = 5;
clip_length = 12;
clip_thickness = 0.5;
clip_height = 5; // must be greater than nib_offset
nib_length = 10;
nib_diameter = 0.5;
nib_offset = 1.5;
screw_head_diameter = 10;
screw_shaft_diameter = 6;
screw_head_height = 3;
screw_inset = 2;
body_padding = max(clip_thickness, corner_thickness)*2;
width = pcb_width + body_padding;
length = pcb_length + body_padding;
height = base_thickness + waffle_z_height + max(corner_z_height, clip_height);
module waffle_mold() {
translate([0,0,base_thickness]) {
difference() {
cube([pcb_width, pcb_length, height]);
difference() {
union() {
for (x = [waffle_x_interval : waffle_x_interval : pcb_width]) {
translate([x,-1,-1])
cube([waffle_thickness, pcb_length+2, waffle_z_height+1]);
}
for (y = [waffle_y_interval : waffle_y_interval : pcb_length]) {
translate([-1,y,-1])
cube([pcb_width+2, waffle_thickness, waffle_z_height+1]);
}
}
if (waffle_top_gap > 0) {
translate([-2,-2,-1])
cube([pcb_width+4, waffle_top_gap+2, waffle_z_height+2]);
}
if (waffle_bottom_gap > 0) {
translate([-2,pcb_length-waffle_bottom_gap,-1])
cube([pcb_width+4, waffle_bottom_gap+2, waffle_z_height+2]);
}
}
}
}
}
module body() {
gap = (pcb_length - corner_y_len*2 - clip_length) / 2;
difference() {
// main body cube to be subtracted from
translate([-body_padding/2, -body_padding/2, 0]) {
cube([width, length, height]);
}
translate([-body_padding/2, -body_padding/2, 0]) {
// translate up to avoid the base and waffle
translate([0, 0, base_thickness + waffle_z_height]) {
translate([body_padding/2, 0, 0]) {
// lengthwise cube subtracted down the middle
translate([corner_x_len, -1, 0])
cube([pcb_width - corner_x_len*2, length+2, height]);
}
translate([0, 0, 0]) {
if (gap > 0) {
// two crossways slices between the corners and the clips
translate([-1, body_padding/2 + corner_y_len, 0]) {
cube([width+2, gap, height]);
translate([0, clip_length+gap, 0]) {
cube([width+2, gap, height]);
}
}
}
}
}
}
}
}
module screw() {
translate([0,0,0.2]) {
cylinder(d2=screw_head_diameter, d1=screw_shaft_diameter, h=screw_head_height, $fs=1);
translate([0,0,screw_head_height-0.1]) {
cylinder(d=screw_head_diameter, h=height, $fs=1);
}
translate([0,0,-height+0.1]) {
cylinder(d=screw_shaft_diameter, h=height, $fs=1);
}
}
}
difference() {
body();
difference() {
translate([0,0,-pcb_inset_depth])
waffle_mold();
translate([pcb_width/2,pcb_length/2,-5.9])
cylinder(d=screw_head_diameter+2, h=height);
}
// Trim corners to the right height
if (corner_z_height < clip_height) {
translate([0,0, base_thickness+waffle_z_height+corner_z_height]) {
translate([-body_padding/2-1, -body_padding/2-1, 0]) {
cube([width+2,corner_y_len+corner_thickness+2,height]);
}
translate([-body_padding/2-1, length-body_padding/2-corner_y_len-corner_thickness-1, 0]) {
cube([width+2,corner_y_len+corner_thickness+2,height]);
}
}
}
// Trim clips to the right height
if (corner_z_height > clip_height) {
translate([0,(length - clip_length)/2-2, base_thickness+waffle_z_height+clip_height]) {
cube([width+2, clip_length+2, height]);
}
}
translate([pcb_width/2,pcb_length/2, 0]) {
screw();
}
}
translate([0, (length - nib_length)/2 - body_padding/2, base_thickness+waffle_z_height+nib_offset]) {
rotate([-90,0,0]) {
cylinder(d=nib_diameter, h=nib_length, $fs=0.1);
}
translate([pcb_width,0,0]) {
rotate([-90,0,0]) {
cylinder(d=nib_diameter, h=nib_length, $fs=0.1);
}
}
}
//vim:ts=4 sw=4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment