After taking a look at the box maker in the last post I decided I wanted to add some features to it just for fun and one thing that crossed my mind was a way to snap the lid on the box so I wouldn't need screw holes.
A few posts back I made a way to make an outline of an existing stl file and also a way to use minkowski and a sphere to make a flat line round:
Since I already had the code written I just made a few modifications so I can put a round ring around the top of a box:
//
/*[Box lid snap ring]*/
Path_to_STL_File="";
Snap_ring_width=1;//[0:.01:2]
Snap_ring_diameter=1;//[0:.01:2]
Move_snap_ring=1;//[0:.01:20]
module Offset(){
difference(){
offset(delta=Snap_ring_width/2)
projection(cut=true)
import(Path_to_STL_File);
projection(cut=true)
import(Path_to_STL_File);
}}
translate([0,0,Move_snap_ring])
minkowski(){
linear_extrude(.01)
Offset();
sphere(Snap_ring_diameter,$fn=40);
}
import(Path_to_STL_File);
Now I can save the lid from the box maker code to stl, import it into the new code and put a ring around it to use as a snap ring to hold the cover in place.
What's cool about this is I can make a box any shape with Inkscape and make the cover a snap on cover and even add extra rings for extra hold:
Once the cover has the ring around it I can export it as an stl, then import it and the box and use difference() to make the groove in the box:
And after A quick test print I can confirm that the cover snaps in and stays on really well: