Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Custom Lidded Box
- //based on Hybris Labs Instructable http://www.instructables.com/id/Creating-a-custom-sized-box-for-3D-printing-with-O/
- // Global resolution
- $fs = 0.1; // Don't generate smaller facets than 0.1 mm
- $fn = 200; //results in smooth shape
- //Variables
- length = 100; //length of box in mm
- width = 100; //width of box in mm
- height = 30; //height of box in mm
- radius = 10; //radius of corner cylinder in mm
- doubleRadius = 2*radius; //doubleRad
- //cutout
- translate([10,10,0])
- {
- difference()
- {
- roundedBox(length, width, height, radius);
- translate([1,1,1])
- {
- //box wall thickness parameters
- roundedBox(length-2, width-2, height-1, radius);
- }
- }
- }
- //Lid
- translate([length*2, 10, 0]) //if you change the size of the box you will need to move the lid so it does not intersect the box
- {
- mirror([1,0,0])
- {
- roundedBox(length, width, 1, radius);
- difference()
- {
- translate([1,1,0])
- {
- roundedBox(length-2, width-2, 4, radius);
- }
- translate([2,2,0])
- {
- roundedBox(length-4, width-4, 4, radius);
- }
- }
- }
- }
- //Lid Tab
- // translate([120,length-13,0]) //if you change the size of the box you will need to move the lid tab to fit on the lid
- // {
- // difference()
- // {
- // difference()
- // {
- // cylinder(h=2, r=7);//outer ring
- // cylinder(h=2, r=3);//inner ring
- // }
- // translate([0,-10,0])
- // {
- // cube(size=[10,10,2]);//cut out edge of box
- // }
- // }
- // }
- //Modules
- module roundedBox(length, width, height, radius)
- {
- //basic box shape, Minkowski function rounds cube corners
- minkowski()
- {
- cube (size=[length-doubleRadius, width-doubleRadius, height]);
- cylinder(r=radius, h = 0.01);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement