Add gift box
This commit is contained in:
parent
0e13f6c544
commit
bd77df8183
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
||||||
*.gcode
|
*.gcode
|
||||||
|
*.json
|
||||||
|
|
BIN
Gift Box/gift-box-bottom.stl
(Stored with Git LFS)
Normal file
BIN
Gift Box/gift-box-bottom.stl
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Gift Box/gift-box-lid.stl
(Stored with Git LFS)
Normal file
BIN
Gift Box/gift-box-lid.stl
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Gift Box/gift-box-screw-basic.stl
(Stored with Git LFS)
Normal file
BIN
Gift Box/gift-box-screw-basic.stl
(Stored with Git LFS)
Normal file
Binary file not shown.
|
@ -3,21 +3,25 @@
|
||||||
# Parameters
|
# Parameters
|
||||||
|
|
||||||
*/
|
*/
|
||||||
$box_inner_width = 15;
|
$box_inner_width = 88;
|
||||||
$box_inner_depth = 6;
|
$box_inner_depth = 56;
|
||||||
$box_inner_height = 15;
|
$box_inner_height = 56;
|
||||||
$box_wall_thickness = 6;
|
$box_wall_thickness = 6;
|
||||||
// [0, 1] Higher the ratio, the bigger the bottom will be.
|
// [0, 1] Higher the ratio, the bigger the bottom will be.
|
||||||
$box_bottom_top_height_fraction = 0.2;
|
$box_bottom_top_height_fraction = 0.2;
|
||||||
// [0, 1] The amount the bottom and top will overlap.
|
// [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.
|
// [0, 1] The thickness of the overlap as a fraction of the wall thickness.
|
||||||
$overlap_thickness_fraction = 0.5;
|
$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.
|
// 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.
|
||||||
$bottom_scale = 1.05;
|
$overlap_gap = 0.25;
|
||||||
// [0, 1] Screw scale. Lower this number if the screw is too tight and won't go through the hole.
|
// [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_screw_scale = 0.94;
|
||||||
|
|
||||||
|
$lid = true;
|
||||||
|
$bottom = true;
|
||||||
|
$screw = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
# Code
|
# Code
|
||||||
|
@ -37,27 +41,33 @@ $top_height = $box_inner_height * (1 - $box_bottom_top_height_fraction);
|
||||||
$overlap_height = $box_inner_height * $overlap_fraction;
|
$overlap_height = $box_inner_height * $overlap_fraction;
|
||||||
$overlap_thickness = $box_wall_thickness * $overlap_thickness_fraction;
|
$overlap_thickness = $box_wall_thickness * $overlap_thickness_fraction;
|
||||||
|
|
||||||
scale([$lid_screw_scale, $lid_screw_scale, $lid_screw_scale])
|
/* ==== Screw ==== */
|
||||||
translate([0, 0, 5])
|
if ($screw) {
|
||||||
rotate([90, 0, 0])
|
scale([$lid_screw_scale, $lid_screw_scale, $lid_screw_scale])
|
||||||
screw();
|
translate([0, 0, 5])
|
||||||
|
rotate([90, 0, 0])
|
||||||
difference() {
|
screw();
|
||||||
scale([$bottom_scale, $bottom_scale, 1])
|
};
|
||||||
bottom();
|
/* ==== Lid ==== */
|
||||||
thread();
|
if ($lid) {
|
||||||
|
difference() {
|
||||||
|
bottom(overlap_gap=$overlap_gap * -1);
|
||||||
|
thread();
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
translate([-10, 0, $bottom_height + $top_height + 2 * $box_wall_thickness])
|
/* ==== Box ==== */
|
||||||
rotate([0, 180, 0])
|
if ($bottom) {
|
||||||
difference() {
|
translate([-10, 0, $bottom_height + $top_height + 2 * $box_wall_thickness])
|
||||||
color("blue")
|
rotate([0, 180, 0])
|
||||||
translate([$box_outer_width, 0, $bottom_height + $top_height + 2 * $box_wall_thickness])
|
difference() {
|
||||||
rotate([0, 180, 0])
|
color("blue")
|
||||||
top();
|
translate([$box_outer_width, 0, $bottom_height + $top_height + 2 * $box_wall_thickness])
|
||||||
thread();
|
rotate([0, 180, 0])
|
||||||
};
|
top();
|
||||||
|
thread();
|
||||||
|
};
|
||||||
|
};
|
||||||
module top() {
|
module top() {
|
||||||
difference() {
|
difference() {
|
||||||
box_half($box_inner_width, $box_inner_depth, $top_height, $box_wall_thickness);
|
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() {
|
union() {
|
||||||
box_half($box_inner_width, $box_inner_depth, $bottom_height, $box_wall_thickness);
|
box_half($box_inner_width, $box_inner_depth, $bottom_height, $box_wall_thickness);
|
||||||
|
color("#FF0")
|
||||||
box_half(
|
box_half(
|
||||||
$box_inner_width + $box_wall_thickness,
|
$box_inner_width + $box_wall_thickness - overlap_gap * 2,
|
||||||
$box_inner_depth + $box_wall_thickness, $overlap_height + $box_wall_thickness,
|
$box_inner_depth + $box_wall_thickness - overlap_gap * 2,
|
||||||
$overlap_thickness
|
$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)) {
|
module thread(length=$box_wall_thickness * (1/$screw_scale)) {
|
||||||
color("pink")
|
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])
|
rotate([90, 0, 0])
|
||||||
scale([$screw_scale, $screw_scale, $screw_scale])
|
scale([$screw_scale, $screw_scale, $screw_scale])
|
||||||
trapezoidThread(length=length);
|
trapezoidThread(length=length);
|
||||||
|
@ -108,7 +120,7 @@ module screw() {
|
||||||
color("orange")
|
color("orange")
|
||||||
translate([$box_outer_width / 2, 0, $thread_z_offset])
|
translate([$box_outer_width / 2, 0, $thread_z_offset])
|
||||||
rotate([90, 0, 0])
|
rotate([90, 0, 0])
|
||||||
cylinder(h=5, d=15, $fn=6);
|
cylinder(h=5, d=18, $fn=6);
|
||||||
color("red")
|
color("red")
|
||||||
translate([0, 0, 0])
|
translate([0, 0, 0])
|
||||||
thread(length=$box_wall_thickness * (1/$screw_scale));
|
thread(length=$box_wall_thickness * (1/$screw_scale));
|
BIN
gift-box.stl
(Stored with Git LFS)
BIN
gift-box.stl
(Stored with Git LFS)
Binary file not shown.
Loading…
Reference in a new issue