fix issues with screw size

This commit is contained in:
Kaan Barmore-Genç 2023-12-17 15:43:11 -06:00
parent 05bc10563d
commit 77ef20d32b
Signed by: kaan
GPG key ID: B2E280771CD62FCF
2 changed files with 64 additions and 18 deletions

View file

@ -3,16 +3,20 @@
# Parameters # Parameters
*/ */
$box_inner_width = 10; $box_inner_width = 15;
$box_inner_depth = 20; $box_inner_depth = 6;
$box_inner_height = 15; $box_inner_height = 15;
$box_wall_thickness = 4; $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.8;
// [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.
$bottom_scale = 1.05;
// [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;
/** /**
@ -21,6 +25,8 @@ $overlap_thickness_fraction = 0.5;
*/ */
include <Thread_Library.scad>; include <Thread_Library.scad>;
$fn = $preview ? 12 : 200;
$box_outer_width = $box_inner_width + $box_wall_thickness * 2; $box_outer_width = $box_inner_width + $box_wall_thickness * 2;
$box_outer_depth = $box_inner_depth + $box_wall_thickness * 2; $box_outer_depth = $box_inner_depth + $box_wall_thickness * 2;
$box_outer_height = $box_inner_height + $box_wall_thickness * 2; $box_outer_height = $box_inner_height + $box_wall_thickness * 2;
@ -31,12 +37,28 @@ $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])
translate([0, 0, 5])
rotate([90, 0, 0])
screw();
bottom(); difference() {
top(); scale([$bottom_scale, $bottom_scale, 1])
bottom();
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();
};
module top() { module top() {
translate([-1 * $box_inner_width - $box_wall_thickness * 2 - 10, 0, 0])
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);
translate([-0.002, -0.002, 0]) translate([-0.002, -0.002, 0])
@ -51,7 +73,11 @@ module top() {
module bottom() { module bottom() {
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);
box_half($box_inner_width + $box_wall_thickness, $box_inner_depth + $box_wall_thickness, $overlap_height + $box_wall_thickness, $overlap_thickness); box_half(
$box_inner_width + $box_wall_thickness,
$box_inner_depth + $box_wall_thickness, $overlap_height + $box_wall_thickness,
$overlap_thickness
);
}; };
}; };
@ -67,3 +93,23 @@ module box_half($width, $depth, $height, $wall_thickness) {
}; };
}; };
$thread_z_offset = $bottom_height + $overlap_height / 2 + 7;
$screw_scale = 0.33;
module thread(length=$box_wall_thickness * (1/$screw_scale)) {
color("pink")
translate([$box_outer_width / 2, $box_wall_thickness + 0.1, $thread_z_offset])
rotate([90, 0, 0])
scale([$screw_scale, $screw_scale, $screw_scale])
trapezoidThread(length=length);
}
module screw() {
color("orange")
translate([$box_outer_width / 2, 0, $thread_z_offset])
rotate([90, 0, 0])
cylinder(h=5, d=15, $fn=6);
color("red")
translate([0, 0, 0])
thread(length=$box_wall_thickness * (1/$screw_scale));
}

BIN
gift-box.stl (Stored with Git LFS)

Binary file not shown.