Created
April 15, 2016 21:34
-
-
Save cjdell/3cdd9f91683fe3fe5c346424cb8252ec to your computer and use it in GitHub Desktop.
This file contains 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
$fn = 100; | |
LENGTH = 0; | |
WIDTH = 1; | |
HEIGHT = 2; | |
box_outer = [150, 50, 16]; | |
wall_thickness = 2; | |
difference_bug_number = 2; | |
stupid_size = [100, 100, 100]; | |
screw_thread_radius = 1.6; | |
corner_radius = screw_thread_radius + wall_thickness; | |
module rounded_cube(size, radius = 5) { | |
cylinders = [ | |
[size[LENGTH] * 0.5 - radius, size[WIDTH] * 0.5 - radius], | |
[size[LENGTH] * -0.5 + radius, size[WIDTH] * 0.5 - radius], | |
[size[LENGTH] * 0.5 - radius, size[WIDTH] * -0.5 + radius], | |
[size[LENGTH] * -0.5 + radius, size[WIDTH] * -0.5 + radius] | |
]; | |
for (cyl = cylinders) { | |
translate([cyl[LENGTH], cyl[WIDTH], size[HEIGHT] * -0.5]) { | |
cylinder(h = size[HEIGHT], r = radius); | |
} | |
} | |
difference() { | |
cube(size, center=true); | |
translate([size[LENGTH] * 0.5, size[WIDTH] * 0.5 - radius, -stupid_size[0] * 0.5]) { | |
rotate([0, 0, 45]) { | |
cube(stupid_size); | |
} | |
} | |
translate([size[LENGTH] * -0.5, size[WIDTH] * -0.5 + radius, -stupid_size[0] * 0.5]) { | |
rotate([0, 0, -135]) { | |
cube(stupid_size); | |
} | |
} | |
mirror([0, 1, 0]) { | |
translate([size[LENGTH] * 0.5, size[WIDTH] * 0.5 - radius, -stupid_size[0] * 0.5]) { | |
rotate([0, 0, 45]) { | |
cube(stupid_size); | |
} | |
} | |
translate([size[LENGTH] * -0.5, size[WIDTH] * -0.5 + radius, -stupid_size[0] * 0.5]) { | |
rotate([0, 0, -135]) { | |
cube(stupid_size); | |
} | |
} | |
} | |
} | |
} | |
module pole() { | |
difference() { | |
cylinder(r = corner_radius, h = box_outer[HEIGHT], center = true); | |
cylinder(r = screw_thread_radius, h = 1000, center = true); | |
} | |
} | |
module box() { | |
size = box_outer; | |
radius = corner_radius; | |
cylinders = [ | |
[size[LENGTH] * 0.5 - radius, size[WIDTH] * 0.5 - radius], | |
[size[LENGTH] * -0.5 + radius, size[WIDTH] * 0.5 - radius], | |
[size[LENGTH] * 0.5 - radius, size[WIDTH] * -0.5 + radius], | |
[size[LENGTH] * -0.5 + radius, size[WIDTH] * -0.5 + radius] | |
]; | |
for (cyl = cylinders) { | |
translate([cyl[LENGTH], cyl[WIDTH], 0]) { | |
pole(); | |
} | |
} | |
translate([0, box_outer[WIDTH] * 0.5 - corner_radius, 0]) { | |
pole(); | |
} | |
translate([0, box_outer[WIDTH] * -0.5 + corner_radius, 0]) { | |
pole(); | |
} | |
difference() { | |
rounded_cube(box_outer, radius = corner_radius); | |
translate([0, 0, wall_thickness]) { | |
rounded_cube(box_outer - [wall_thickness, wall_thickness, 0] * 2, radius = corner_radius - wall_thickness); | |
} | |
} | |
} | |
difference() { | |
box(); | |
/*translate([0, 0, -100]) { | |
cube(stupid_size); | |
}*/ | |
} |
This file contains 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
$fn = 100; | |
LENGTH = 0; | |
WIDTH = 1; | |
HEIGHT = 2; | |
wall_thickness = 2; | |
box_outer = [150, 50, wall_thickness]; | |
difference_bug_number = 2; | |
stupid_size = [100, 100, 100]; | |
screw_thread_radius = 1.6; | |
corner_radius = screw_thread_radius + wall_thickness; | |
module rounded_cube(size, radius = 5) { | |
cylinders = [ | |
[size[LENGTH] * 0.5 - radius, size[WIDTH] * 0.5 - radius], | |
[size[LENGTH] * -0.5 + radius, size[WIDTH] * 0.5 - radius], | |
[size[LENGTH] * 0.5 - radius, size[WIDTH] * -0.5 + radius], | |
[size[LENGTH] * -0.5 + radius, size[WIDTH] * -0.5 + radius] | |
]; | |
for (cyl = cylinders) { | |
translate([cyl[LENGTH], cyl[WIDTH], size[HEIGHT] * -0.5]) { | |
cylinder(h = size[HEIGHT], r = radius); | |
} | |
} | |
difference() { | |
cube(size, center=true); | |
translate([size[LENGTH] * 0.5, size[WIDTH] * 0.5 - radius, -stupid_size[0] * 0.5]) { | |
rotate([0, 0, 45]) { | |
cube(stupid_size); | |
} | |
} | |
translate([size[LENGTH] * -0.5, size[WIDTH] * -0.5 + radius, -stupid_size[0] * 0.5]) { | |
rotate([0, 0, -135]) { | |
cube(stupid_size); | |
} | |
} | |
mirror([0, 1, 0]) { | |
translate([size[LENGTH] * 0.5, size[WIDTH] * 0.5 - radius, -stupid_size[0] * 0.5]) { | |
rotate([0, 0, 45]) { | |
cube(stupid_size); | |
} | |
} | |
translate([size[LENGTH] * -0.5, size[WIDTH] * -0.5 + radius, -stupid_size[0] * 0.5]) { | |
rotate([0, 0, -135]) { | |
cube(stupid_size); | |
} | |
} | |
} | |
} | |
} | |
module pole() { | |
cylinder(r = screw_thread_radius, h = 1000, center = true); | |
} | |
module box() { | |
size = box_outer; | |
radius = corner_radius; | |
cylinders = [ | |
[size[LENGTH] * 0.5 - radius, size[WIDTH] * 0.5 - radius], | |
[size[LENGTH] * -0.5 + radius, size[WIDTH] * 0.5 - radius], | |
[size[LENGTH] * 0.5 - radius, size[WIDTH] * -0.5 + radius], | |
[size[LENGTH] * -0.5 + radius, size[WIDTH] * -0.5 + radius] | |
]; | |
difference() { | |
rounded_cube(box_outer, radius = corner_radius); | |
for (cyl = cylinders) { | |
translate([cyl[LENGTH], cyl[WIDTH], 0]) { | |
pole(); | |
} | |
} | |
translate([0, box_outer[WIDTH] * 0.5 - corner_radius, 0]) { | |
pole(); | |
} | |
translate([0, box_outer[WIDTH] * -0.5 + corner_radius, 0]) { | |
pole(); | |
} | |
} | |
} | |
difference() { | |
box(); | |
/*translate([0, 0, -50]) { | |
cube(stupid_size); | |
}*/ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment