diff --git a/.gitignore b/.gitignore index 26a3dc1..af78070 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ *.gcode +*.json diff --git a/Gift Box/gift-box-bottom.stl b/Gift Box/gift-box-bottom.stl new file mode 100644 index 0000000..41a5ec9 --- /dev/null +++ b/Gift Box/gift-box-bottom.stl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cf86dfb9e9c49b801ac3e4113b8308d75f17b003645be89e7027d7695115c6d4 +size 19784 diff --git a/Gift Box/gift-box-lid.stl b/Gift Box/gift-box-lid.stl new file mode 100644 index 0000000..d060f20 --- /dev/null +++ b/Gift Box/gift-box-lid.stl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7c0d2c2ed1ad8b0ab872fe186bdb5068653439caad038c9b9a9ca157c18d529a +size 20384 diff --git a/Gift Box/gift-box-screw-basic.stl b/Gift Box/gift-box-screw-basic.stl new file mode 100644 index 0000000..9edc455 --- /dev/null +++ b/Gift Box/gift-box-screw-basic.stl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a0675f5180ed3c56baedc98a47e81095dab17ea7692ea55bca82a54d7eda6d69 +size 31484 diff --git a/gift-box.scad b/Gift Box/gift-box.scad similarity index 62% rename from gift-box.scad rename to Gift Box/gift-box.scad index b7eae33..64978d0 100644 --- a/gift-box.scad +++ b/Gift Box/gift-box.scad @@ -3,21 +3,25 @@ # Parameters */ -$box_inner_width = 15; -$box_inner_depth = 6; -$box_inner_height = 15; +$box_inner_width = 88; +$box_inner_depth = 56; +$box_inner_height = 56; $box_wall_thickness = 6; // [0, 1] Higher the ratio, the bigger the bottom will be. $box_bottom_top_height_fraction = 0.2; // [0, 1] The amount the bottom and top will overlap. -$overlap_fraction = 0.8; +$overlap_fraction = 0.45; // [0, 1] The thickness of the overlap as a fraction of the wall thickness. $overlap_thickness_fraction = 0.5; -// [1, *] Bottom scale. Scale the bottom up by settings this to a small amount like 1.05 to increase the gap between lid and bottom. Raise this number if the lid is too tight and won't go in, lower it if the lid is too loose. -$bottom_scale = 1.05; +// In mm, the gap between the lid and bottom in the overlap area. Increase this number if the lid is too tight, lower it if the lid is too loose. +$overlap_gap = 0.25; // [0, 1] Screw scale. Lower this number if the screw is too tight and won't go through the hole. $lid_screw_scale = 0.94; +$lid = true; +$bottom = true; +$screw = true; + /** # Code @@ -37,27 +41,33 @@ $top_height = $box_inner_height * (1 - $box_bottom_top_height_fraction); $overlap_height = $box_inner_height * $overlap_fraction; $overlap_thickness = $box_wall_thickness * $overlap_thickness_fraction; -scale([$lid_screw_scale, $lid_screw_scale, $lid_screw_scale]) -translate([0, 0, 5]) -rotate([90, 0, 0]) - screw(); - -difference() { - scale([$bottom_scale, $bottom_scale, 1]) - bottom(); - thread(); +/* ==== Screw ==== */ +if ($screw) { + scale([$lid_screw_scale, $lid_screw_scale, $lid_screw_scale]) + translate([0, 0, 5]) + rotate([90, 0, 0]) + screw(); +}; +/* ==== Lid ==== */ +if ($lid) { + difference() { + bottom(overlap_gap=$overlap_gap * -1); + thread(); + }; }; -translate([-10, 0, $bottom_height + $top_height + 2 * $box_wall_thickness]) - rotate([0, 180, 0]) - difference() { - color("blue") - translate([$box_outer_width, 0, $bottom_height + $top_height + 2 * $box_wall_thickness]) - rotate([0, 180, 0]) - top(); - thread(); - }; - +/* ==== Box ==== */ +if ($bottom) { + translate([-10, 0, $bottom_height + $top_height + 2 * $box_wall_thickness]) + rotate([0, 180, 0]) + difference() { + color("blue") + translate([$box_outer_width, 0, $bottom_height + $top_height + 2 * $box_wall_thickness]) + rotate([0, 180, 0]) + top(); + thread(); + }; +}; module top() { difference() { box_half($box_inner_width, $box_inner_depth, $top_height, $box_wall_thickness); @@ -70,13 +80,15 @@ module top() { }; } -module bottom() { +module bottom(overlap_gap=0) { union() { box_half($box_inner_width, $box_inner_depth, $bottom_height, $box_wall_thickness); + color("#FF0") box_half( - $box_inner_width + $box_wall_thickness, - $box_inner_depth + $box_wall_thickness, $overlap_height + $box_wall_thickness, - $overlap_thickness + $box_inner_width + $box_wall_thickness - overlap_gap * 2, + $box_inner_depth + $box_wall_thickness - overlap_gap * 2, + $overlap_height + $box_wall_thickness, + $overlap_thickness + overlap_gap ); }; }; @@ -93,12 +105,12 @@ module box_half($width, $depth, $height, $wall_thickness) { }; }; -$thread_z_offset = $bottom_height + $overlap_height / 2 + 7; +$thread_z_offset = $bottom_height + $overlap_height / 2 + 2; -$screw_scale = 0.33; +$screw_scale = 0.5; module thread(length=$box_wall_thickness * (1/$screw_scale)) { color("pink") - translate([$box_outer_width / 2, $box_wall_thickness + 0.1, $thread_z_offset]) + translate([$box_outer_width / 2, $box_wall_thickness + 1.1, $thread_z_offset]) rotate([90, 0, 0]) scale([$screw_scale, $screw_scale, $screw_scale]) trapezoidThread(length=length); @@ -108,7 +120,7 @@ module screw() { color("orange") translate([$box_outer_width / 2, 0, $thread_z_offset]) rotate([90, 0, 0]) - cylinder(h=5, d=15, $fn=6); + cylinder(h=5, d=18, $fn=6); color("red") translate([0, 0, 0]) thread(length=$box_wall_thickness * (1/$screw_scale)); diff --git a/gift-box.stl b/gift-box.stl deleted file mode 100644 index aa7741b..0000000 --- a/gift-box.stl +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b2bd9224085216132224f239e1a407b8dca045978d7c948fc356c8b4e849f96f -size 44384