Created
October 28, 2015 06:57
-
-
Save torkildr/cd18e49c4b51dac01e63 to your computer and use it in GitHub Desktop.
Simple parametric frame. Should work with both CNC and laser cutting.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// All units in mm | |
// | |
// | |
// frame parameters | |
// | |
inner_frame_width = 128.5 * 4; | |
inner_frame_height = 32.1; | |
frame_depth = 35.0; | |
material_thickness = 15.0; | |
joint_edge = 5.0; | |
// | |
// machine/cnc/laser specific parameters | |
// | |
drill = 3.0; // diamater in mm, for laser you'd probably put 0 here | |
wiggle_room = 0.0; | |
// derived values | |
layout_spacing = (drill * 1.2) + 2.0; | |
function corner_size(depth) = depth * 0.18; | |
function peg_size(depth) = depth * 0.22; | |
function joint_depth(thickness) = thickness - joint_edge; | |
function total_frame(width, thickness) = width + thickness*2; | |
/// | |
/// modules | |
/// | |
module cnc_corner(depth) { | |
cylinder(depth, d=drill, center=false, $fn=16); | |
} | |
module joint_inner(depth, thickness) { | |
corner = corner_size(depth); | |
peg = peg_size(depth); | |
joint_depth = joint_depth(thickness); | |
joint_offset = thickness - joint_depth; | |
union() { | |
translate([-1, -1, joint_offset]) | |
cube([thickness+1, corner+1, joint_depth+1]); | |
translate([-1, frame_depth/2 - peg/2, joint_offset]) | |
cube([thickness+1, peg, joint_depth+1]); | |
translate([-1, frame_depth - corner, joint_offset]) | |
cube([thickness+1, corner+1, joint_depth+1]); | |
translate([-1, -1, joint_offset]) | |
cube([thickness - joint_depth + 1, depth+2, joint_depth+1]); | |
} | |
translate([thickness, 0, 0]) | |
union() { | |
translate([0, corner - drill/2, joint_offset]) | |
cnc_corner(joint_depth+1); | |
translate([0, frame_depth - corner + drill/2, joint_offset]) | |
cnc_corner(joint_depth+1); | |
translate([0, frame_depth/2 - peg/2 + drill/2, joint_offset]) | |
cnc_corner(joint_depth+1); | |
translate([0, frame_depth/2 + peg/2 - drill/2, joint_offset]) | |
cnc_corner(joint_depth+1); | |
}; | |
} | |
module joint_outer(depth, thickness) { | |
corner = corner_size(depth); | |
peg = peg_size(depth); | |
inverse_peg = (frame_depth - corner*2 - peg) / 2; | |
joint_depth = joint_depth(thickness); | |
joint_offset = thickness - joint_depth; | |
echo(joint_depth); | |
echo(joint_offset); | |
union() { | |
translate([-1, corner - wiggle_room/2, joint_offset]) | |
cube([joint_depth + 1, inverse_peg + wiggle_room, joint_depth+1]); | |
translate([-1, depth/2 + peg/2 - wiggle_room/2, joint_offset]) | |
cube([joint_depth + 1, inverse_peg + wiggle_room, joint_depth+1]); | |
} | |
translate([joint_depth, 0, 0]) | |
union() { | |
translate([0, corner - wiggle_room/2 + drill/2, joint_offset]) | |
cnc_corner(joint_depth+1); | |
translate([0, corner + inverse_peg - drill/2 + wiggle_room/2, joint_offset]) | |
cnc_corner(joint_depth+1); | |
translate([0, depth/2 + peg/2 - wiggle_room/2 + drill/2, joint_offset]) | |
cnc_corner(joint_depth+1); | |
translate([0, depth - corner + wiggle_room/2 - drill/2, joint_offset]) | |
cnc_corner(joint_depth+1); | |
}; | |
} | |
module frame_inner(inner_width, thickness) { | |
joint_depth = joint_depth(thickness); | |
frame_width = total_frame(inner_width, thickness); | |
difference() { | |
cube([frame_width, frame_depth, thickness]); | |
joint_inner(frame_depth, thickness); | |
translate([frame_width, frame_depth, 0]) | |
rotate([0, 0, 180]) | |
joint_inner(frame_depth, thickness); | |
} | |
} | |
module frame_outer(inner_height, thickness) { | |
joint_depth = joint_depth(thickness); | |
frame_height = total_frame(inner_height, joint_depth); | |
difference() { | |
cube([frame_height, frame_depth, thickness]); | |
joint_outer(frame_depth, thickness); | |
translate([frame_height, frame_depth, 0]) | |
rotate([0, 0, 180]) | |
joint_outer(frame_depth, thickness); | |
} | |
} | |
module cnc_hole() { | |
diam = drill; | |
translate([0, 0, -1]) | |
cylinder(material_thickness + 2, d=diam, center=false, $fn=16); | |
} | |
module complete() { | |
inner_width = total_frame(inner_frame_width, material_thickness); | |
outer_width = total_frame(inner_frame_height, joint_depth(material_thickness)); | |
translate([0, 0, 0]) | |
frame_outer(inner_frame_height, material_thickness); | |
translate([outer_width + layout_spacing, 0, 0]) | |
frame_inner(inner_frame_width, material_thickness); | |
translate([0, frame_depth + layout_spacing, 0]) | |
frame_outer(inner_frame_height, material_thickness); | |
translate([outer_width + layout_spacing, frame_depth + layout_spacing, 0]) | |
frame_inner(inner_frame_width, material_thickness); | |
} | |
complete(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment