Compare commits
2 commits
a49c9ade86
...
77ef20d32b
Author | SHA1 | Date | |
---|---|---|---|
Kaan Barmore-Genç | 77ef20d32b | ||
Kaan Barmore-Genç | 05bc10563d |
286
Thread_Library.scad
Normal file
286
Thread_Library.scad
Normal file
|
@ -0,0 +1,286 @@
|
||||||
|
module threadPiece(Xa, Ya, Za, Xb, Yb, Zb, radiusa, radiusb, tipRatioa, tipRatiob, threadAngleTop, threadAngleBottom)
|
||||||
|
{
|
||||||
|
angleZ=atan2(Ya, Xa);
|
||||||
|
twistZ=atan2(Yb, Xb)-atan2(Ya, Xa);
|
||||||
|
|
||||||
|
polyPoints=[
|
||||||
|
[Xa+ radiusa*cos(+angleZ), Ya+ radiusa*sin(+angleZ), Za ],
|
||||||
|
[Xa+ radiusa*cos(+angleZ), Ya+ radiusa*sin(+angleZ), Za + radiusa*tipRatioa ],
|
||||||
|
[Xa , Ya , Za+ radiusa*(tipRatioa+sin(threadAngleTop)) ],
|
||||||
|
[Xa , Ya , Za ],
|
||||||
|
[Xa , Ya , Za+ radiusa*sin(threadAngleBottom) ],
|
||||||
|
|
||||||
|
[Xb+ radiusb*cos(angleZ+twistZ), Yb+ radiusb*sin(angleZ+twistZ), Zb ],
|
||||||
|
[Xb+ radiusb*cos(angleZ+twistZ), Yb+ radiusb*sin(angleZ+twistZ), Zb+ radiusb*tipRatiob ],
|
||||||
|
[Xb , Yb , Zb+ radiusb*(tipRatiob+sin(threadAngleTop)) ],
|
||||||
|
[Xb , Yb , Zb ],
|
||||||
|
[Xb , Yb , Zb+ radiusb*sin(threadAngleBottom)] ];
|
||||||
|
|
||||||
|
polyTriangles=[
|
||||||
|
[ 0, 1, 6 ], [ 0, 6, 5 ], // tip of profile
|
||||||
|
[ 1, 7, 6 ], [ 1, 2, 7 ], // upper side of profile
|
||||||
|
[ 0, 5, 4 ], [ 4, 5, 9 ], // lower side of profile
|
||||||
|
[ 4, 9, 3 ], [ 9, 8, 3 ], [ 3, 8, 2 ], [ 8, 7, 2 ], // back of profile
|
||||||
|
[ 0, 4, 3 ], [ 0, 3, 2 ], [ 0, 2, 1 ], // a side of profile
|
||||||
|
[ 5, 8, 9 ], [ 5, 7, 8 ], [ 5, 6, 7 ] // b side of profile
|
||||||
|
];
|
||||||
|
|
||||||
|
polyhedron( polyPoints, polyTriangles );
|
||||||
|
}
|
||||||
|
|
||||||
|
module shaftPiece(Xa, Ya, Za, Xb, Yb, Zb, radiusa, radiusb, tipRatioa, tipRatiob, threadAngleTop, threadAngleBottom)
|
||||||
|
{
|
||||||
|
angleZ=atan2(Ya, Xa);
|
||||||
|
twistZ=atan2(Yb, Xb)-atan2(Ya, Xa);
|
||||||
|
|
||||||
|
threadAngleTop=15;
|
||||||
|
threadAngleBottom=-15;
|
||||||
|
|
||||||
|
shaftRatio=0.5;
|
||||||
|
|
||||||
|
polyPoints1=[
|
||||||
|
[Xa, Ya, Za + radiusa*sin(threadAngleBottom) ],
|
||||||
|
[Xa, Ya, Za + radiusa*(tipRatioa+sin(threadAngleTop)) ],
|
||||||
|
[Xa*shaftRatio, Ya*shaftRatio , Za + radiusa*(tipRatioa+sin(threadAngleTop)) ],
|
||||||
|
[Xa*shaftRatio , Ya*shaftRatio , Za ],
|
||||||
|
[Xa*shaftRatio , Ya*shaftRatio , Za + radiusa*sin(threadAngleBottom) ],
|
||||||
|
|
||||||
|
[Xb, Yb, Zb + radiusb*sin(threadAngleBottom) ],
|
||||||
|
[Xb, Yb, Zb + radiusb*(tipRatiob+sin(threadAngleTop)) ],
|
||||||
|
[Xb*shaftRatio , Yb*shaftRatio , Zb + radiusb*(tipRatiob+sin(threadAngleTop)) ],
|
||||||
|
[Xb*shaftRatio , Yb*shaftRatio , Zb ],
|
||||||
|
[Xb*shaftRatio , Yb*shaftRatio , Zb + radiusb*sin(threadAngleBottom) ] ];
|
||||||
|
|
||||||
|
polyTriangles1=[
|
||||||
|
[ 0, 1, 6 ], [ 0, 6, 5 ], // tip of profile
|
||||||
|
[ 1, 7, 6 ], [ 1, 2, 7 ], // upper side of profile
|
||||||
|
[ 0, 5, 4 ], [ 4, 5, 9 ], // lower side of profile
|
||||||
|
[ 3, 4, 9 ], [ 9, 8, 3 ], [ 2, 3, 8 ], [ 8, 7, 2 ], // back of profile
|
||||||
|
[ 0, 4, 3 ], [ 0, 3, 2 ], [ 0, 2, 1 ], // a side of profile
|
||||||
|
[ 5, 8, 9 ], [ 5, 7, 8 ], [ 5, 6, 7 ] // b side of profile
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
// this is the back of the raised part of the profile
|
||||||
|
polyhedron( polyPoints1, polyTriangles1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
module trapezoidThread(
|
||||||
|
length=45, // axial length of the threaded rod
|
||||||
|
pitch=10, // axial distance from crest to crest
|
||||||
|
pitchRadius=10, // radial distance from center to mid-profile
|
||||||
|
threadHeightToPitch=0.5, // ratio between the height of the profile and the pitch
|
||||||
|
// std value for Acme or metric lead screw is 0.5
|
||||||
|
profileRatio=0.5, // ratio between the lengths of the raised part of the profile and the pitch
|
||||||
|
// std value for Acme or metric lead screw is 0.5
|
||||||
|
threadAngle=30, // angle between the two faces of the thread
|
||||||
|
// std value for Acme is 29 or for metric lead screw is 30
|
||||||
|
RH=true, // true/false the thread winds clockwise looking along shaft, i.e.follows the Right Hand Rule
|
||||||
|
clearance=0.1, // radial clearance, normalized to thread height
|
||||||
|
backlash=0.1, // axial clearance, normalized to pitch
|
||||||
|
stepsPerTurn=24 // number of slices to create per turn
|
||||||
|
)
|
||||||
|
{
|
||||||
|
|
||||||
|
numberTurns=length/pitch;
|
||||||
|
|
||||||
|
steps=stepsPerTurn*numberTurns;
|
||||||
|
|
||||||
|
trapezoidRatio= 2*profileRatio*(1-backlash);
|
||||||
|
|
||||||
|
function threadAngleTop(i)= threadAngle/2;
|
||||||
|
function threadAngleBottom(i)= -threadAngle/2;
|
||||||
|
|
||||||
|
function threadHeight(i)= pitch*threadHeightToPitch;
|
||||||
|
|
||||||
|
function pitchRadius(i)= pitchRadius;
|
||||||
|
function minorRadius(i)= pitchRadius(i)-0.5*threadHeight(i);
|
||||||
|
|
||||||
|
function X(i)= minorRadius(i)*cos(i*360*numberTurns);
|
||||||
|
function Y(i)= minorRadius(i)*sin(i*360*numberTurns);
|
||||||
|
function Z(i)= pitch*numberTurns*i;
|
||||||
|
|
||||||
|
function tip(i)= trapezoidRatio*(1-0.5*sin(threadAngleTop(i))+0.5*sin(threadAngleBottom(i)));
|
||||||
|
|
||||||
|
// this is the threaded rod
|
||||||
|
|
||||||
|
if (RH==true)
|
||||||
|
translate([0,0,-threadHeight(0)*sin(threadAngleBottom(0))])
|
||||||
|
for (i=[0:steps-1])
|
||||||
|
{
|
||||||
|
threadPiece(
|
||||||
|
Xa= X(i/steps),
|
||||||
|
Ya= Y(i/steps),
|
||||||
|
Za= Z(i/steps),
|
||||||
|
Xb= X((i+1)/steps),
|
||||||
|
Yb= Y((i+1)/steps),
|
||||||
|
Zb= Z((i+1)/steps),
|
||||||
|
radiusa= threadHeight(i/steps),
|
||||||
|
radiusb= threadHeight((i+1)/steps),
|
||||||
|
tipRatioa= tip(i/steps),
|
||||||
|
tipRatiob= tip((i+1)/steps),
|
||||||
|
threadAngleTop= threadAngleTop(i),
|
||||||
|
threadAngleBottom= threadAngleBottom(i)
|
||||||
|
);
|
||||||
|
|
||||||
|
shaftPiece(
|
||||||
|
Xa= X(i/steps),
|
||||||
|
Ya= Y(i/steps),
|
||||||
|
Za= Z(i/steps),
|
||||||
|
Xb= X((i+1)/steps),
|
||||||
|
Yb= Y((i+1)/steps),
|
||||||
|
Zb= Z((i+1)/steps),
|
||||||
|
radiusa= threadHeight(i/steps),
|
||||||
|
radiusb= threadHeight((i+1)/steps),
|
||||||
|
tipRatioa= tip(i/steps),
|
||||||
|
tipRatiob= tip((i+1)/steps),
|
||||||
|
threadAngleTop= threadAngleTop(i),
|
||||||
|
threadAngleBottom= threadAngleBottom(i)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (RH==false)
|
||||||
|
translate([0,0,-threadHeight(0)*sin(threadAngleBottom(0))])
|
||||||
|
mirror([0,1,0])
|
||||||
|
for (i=[0:steps-1])
|
||||||
|
{
|
||||||
|
threadPiece(
|
||||||
|
Xa= X(i/steps),
|
||||||
|
Ya= Y(i/steps),
|
||||||
|
Za= Z(i/steps),
|
||||||
|
Xb= X((i+1)/steps),
|
||||||
|
Yb= Y((i+1)/steps),
|
||||||
|
Zb= Z((i+1)/steps),
|
||||||
|
radiusa= threadHeight(i/steps),
|
||||||
|
radiusb= threadHeight((i+1)/steps),
|
||||||
|
tipRatioa= tip(i/steps),
|
||||||
|
tipRatiob= tip((i+1)/steps),
|
||||||
|
threadAngleTop= threadAngleTop(i),
|
||||||
|
threadAngleBottom= threadAngleBottom(i)
|
||||||
|
);
|
||||||
|
|
||||||
|
shaftPiece(
|
||||||
|
Xa= X(i/steps),
|
||||||
|
Ya= Y(i/steps),
|
||||||
|
Za= Z(i/steps),
|
||||||
|
Xb= X((i+1)/steps),
|
||||||
|
Yb= Y((i+1)/steps),
|
||||||
|
Zb= Z((i+1)/steps),
|
||||||
|
radiusa= threadHeight(i/steps),
|
||||||
|
radiusb= threadHeight((i+1)/steps),
|
||||||
|
tipRatioa= tip(i/steps),
|
||||||
|
tipRatiob= tip((i+1)/steps),
|
||||||
|
threadAngleTop= threadAngleTop(i),
|
||||||
|
threadAngleBottom= threadAngleBottom(i)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
rotate([0,0,180/stepsPerTurn])
|
||||||
|
cylinder(
|
||||||
|
h=length+threadHeight(1)*(tip(1)+sin( threadAngleTop(1) )-1*sin( threadAngleBottom(1) ) ),
|
||||||
|
r1=minorRadius(0)-clearance*threadHeight(0),
|
||||||
|
r2=minorRadius(0)-clearance*threadHeight(0),
|
||||||
|
$fn=stepsPerTurn
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
module trapezoidThreadNegativeSpace(
|
||||||
|
length=45, // axial length of the threaded rod
|
||||||
|
pitch=10, // axial distance from crest to crest
|
||||||
|
pitchRadius=10, // radial distance from center to mid-profile
|
||||||
|
threadHeightToPitch=0.5, // ratio between the height of the profile and the pitch
|
||||||
|
// std value for Acme or metric lead screw is 0.5
|
||||||
|
profileRatio=0.5, // ratio between the lengths of the raised part of the profile and the pitch
|
||||||
|
// std value for Acme or metric lead screw is 0.5
|
||||||
|
threadAngle=30, // angle between the two faces of the thread
|
||||||
|
// std value for Acme is 29 or for metric lead screw is 30
|
||||||
|
RH=true, // true/false the thread winds clockwise looking along shaft, i.e.follows the Right Hand Rule
|
||||||
|
countersunk=0, // depth of 45 degree chamfered entries, normalized to pitch
|
||||||
|
clearance=0.1, // radial clearance, normalized to thread height
|
||||||
|
backlash=0.1, // axial clearance, normalized to pitch
|
||||||
|
stepsPerTurn=24 // number of slices to create per turn
|
||||||
|
)
|
||||||
|
{
|
||||||
|
|
||||||
|
translate([0,0,-countersunk*pitch])
|
||||||
|
cylinder(
|
||||||
|
h=2*countersunk*pitch,
|
||||||
|
r2=pitchRadius+clearance*pitch+0.25*pitch,
|
||||||
|
r1=pitchRadius+clearance*pitch+0.25*pitch+2*countersunk*pitch,
|
||||||
|
$fn=24
|
||||||
|
);
|
||||||
|
|
||||||
|
translate([0,0,countersunk*pitch])
|
||||||
|
translate([0,0,-pitch])
|
||||||
|
trapezoidThread(
|
||||||
|
length=length+0.5*pitch, // axial length of the threaded rod
|
||||||
|
pitch=pitch, // axial distance from crest to crest
|
||||||
|
pitchRadius=pitchRadius+clearance*pitch, // radial distance from center to mid-profile
|
||||||
|
threadHeightToPitch=threadHeightToPitch, // ratio between the height of the profile and the pitch
|
||||||
|
// std value for Acme or metric lead screw is 0.5
|
||||||
|
profileRatio=profileRatio, // ratio between the lengths of the raised part of the profile and the pitch
|
||||||
|
// std value for Acme or metric lead screw is 0.5
|
||||||
|
threadAngle=threadAngle, // angle between the two faces of the thread
|
||||||
|
// std value for Acme is 29 or for metric lead screw is 30
|
||||||
|
RH=true, // true/false the thread winds clockwise looking along shaft
|
||||||
|
// i.e.follows Right Hand Rule
|
||||||
|
clearance=0, // radial clearance, normalized to thread height
|
||||||
|
backlash=-backlash, // axial clearance, normalized to pitch
|
||||||
|
stepsPerTurn=stepsPerTurn // number of slices to create per turn
|
||||||
|
);
|
||||||
|
|
||||||
|
translate([0,0,length-countersunk*pitch])
|
||||||
|
cylinder(
|
||||||
|
h=2*countersunk*pitch,
|
||||||
|
r1=pitchRadius+clearance*pitch+0.25*pitch,
|
||||||
|
r2=pitchRadius+clearance*pitch+0.25*pitch+2*countersunk*pitch,$fn=24,
|
||||||
|
$fn=24
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
module trapezoidNut(
|
||||||
|
length=45, // axial length of the threaded rod
|
||||||
|
radius=25, // outer radius of the nut
|
||||||
|
pitch=10, // axial distance from crest to crest
|
||||||
|
pitchRadius=10, // radial distance from center to mid-profile
|
||||||
|
threadHeightToPitch=0.5, // ratio between the height of the profile and the pitch
|
||||||
|
// std value for Acme or metric lead screw is 0.5
|
||||||
|
profileRatio=0.5, // ratio between the lengths of the raised part of the profile and the pitch
|
||||||
|
// std value for Acme or metric lead screw is 0.5
|
||||||
|
threadAngle=30, // angle between the two faces of the thread
|
||||||
|
// std value for Acme is 29 or for metric lead screw is 30
|
||||||
|
RH=true, // true/false the thread winds clockwise looking along shaft, i.e.follows the Right Hand Rule
|
||||||
|
countersunk=0, // depth of 45 degree chamfered entries, normalized to pitch
|
||||||
|
clearance=0.1, // radial clearance, normalized to thread height
|
||||||
|
backlash=0.1, // axial clearance, normalized to pitch
|
||||||
|
stepsPerTurn=24 // number of slices to create per turn
|
||||||
|
)
|
||||||
|
{
|
||||||
|
difference()
|
||||||
|
{
|
||||||
|
cylinder(
|
||||||
|
h=length,
|
||||||
|
r1=radius,
|
||||||
|
r2=radius,
|
||||||
|
$fn=6
|
||||||
|
);
|
||||||
|
|
||||||
|
trapezoidThreadNegativeSpace(
|
||||||
|
length=length, // axial length of the threaded rod
|
||||||
|
pitch=pitch, // axial distance from crest to crest
|
||||||
|
pitchRadius=pitchRadius, // radial distance from center to mid-profile
|
||||||
|
threadHeightToPitch=threadHeightToPitch, // ratio between the height of the profile and the pitch
|
||||||
|
// std value for Acme or metric lead screw is 0.5
|
||||||
|
profileRatio=profileRatio, // ratio between the lengths of the raised part of the profile and the pitch
|
||||||
|
// std value for Acme or metric lead screw is 0.5
|
||||||
|
threadAngle=threadAngle, // angle between the two faces of the thread
|
||||||
|
// std value for Acme is 29 or for metric lead screw is 30
|
||||||
|
RH=true, // true/false the thread winds clockwise looking along shaft
|
||||||
|
// i.e.follows Right Hand Rule
|
||||||
|
countersunk=countersunk, // depth of 45 degree countersunk entries, normalized to pitch
|
||||||
|
clearance=clearance, // radial clearance, normalized to thread height
|
||||||
|
backlash=backlash, // axial clearance, normalized to pitch
|
||||||
|
stepsPerTurn=stepsPerTurn // number of slices to create per turn
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
BIN
display-camera-pi-mount-experiment.stl
(Stored with Git LFS)
BIN
display-camera-pi-mount-experiment.stl
(Stored with Git LFS)
Binary file not shown.
|
@ -8,9 +8,30 @@ $triangle_y_hole_gap = 20;
|
||||||
$triangle_x_offset = 19;
|
$triangle_x_offset = 19;
|
||||||
$triangle_y_offset = 5;
|
$triangle_y_offset = 5;
|
||||||
|
|
||||||
$fn=200;
|
$fn=10;
|
||||||
|
|
||||||
screen_mount();
|
use <Thread_Library.scad>
|
||||||
|
|
||||||
|
camera_mount();
|
||||||
|
|
||||||
|
$camera_mount_thickness = 1;
|
||||||
|
$camera_screw_gap_y = 25.2;
|
||||||
|
$camera_screw_diameter = 2.75;
|
||||||
|
module camera_mount() {
|
||||||
|
difference() {
|
||||||
|
cylinder(h=$camera_mount_thickness, d=$camera_screw_gap_y);
|
||||||
|
translate([0, 0, -0.1])
|
||||||
|
cylinder(h=3 * $camera_mount_thickness, d=$camera_screw_gap_y - $camera_screw_diameter * 3);
|
||||||
|
rotate([0, 0, 90])
|
||||||
|
translate([$camera_screw_gap_y / 2 - $camera_screw_diameter / 1.33, 0, -0.1])
|
||||||
|
cylinder(h=3 * $camera_mount_thickness, d=$camera_screw_diameter);
|
||||||
|
rotate([0, 0, -90])
|
||||||
|
translate([$camera_screw_gap_y / 2 - $camera_screw_diameter / 1.33, 0, -0.1])
|
||||||
|
cylinder(h=3 * $camera_mount_thickness, d=$camera_screw_diameter);
|
||||||
|
translate([-1 * $camera_screw_gap_y - $camera_screw_diameter / 1.33, -1 * $camera_screw_gap_y / 2, -0.1])
|
||||||
|
cube([$camera_screw_gap_y, $camera_screw_gap_y, 3 * $camera_mount_thickness]);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
module attachment_point() {
|
module attachment_point() {
|
||||||
difference() {
|
difference() {
|
||||||
|
|
115
gift-box.scad
Normal file
115
gift-box.scad
Normal file
|
@ -0,0 +1,115 @@
|
||||||
|
/**
|
||||||
|
|
||||||
|
# Parameters
|
||||||
|
|
||||||
|
*/
|
||||||
|
$box_inner_width = 15;
|
||||||
|
$box_inner_depth = 6;
|
||||||
|
$box_inner_height = 15;
|
||||||
|
$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;
|
||||||
|
// [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;
|
||||||
|
// [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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
# Code
|
||||||
|
|
||||||
|
*/
|
||||||
|
include <Thread_Library.scad>;
|
||||||
|
|
||||||
|
$fn = $preview ? 12 : 200;
|
||||||
|
|
||||||
|
$box_outer_width = $box_inner_width + $box_wall_thickness * 2;
|
||||||
|
$box_outer_depth = $box_inner_depth + $box_wall_thickness * 2;
|
||||||
|
$box_outer_height = $box_inner_height + $box_wall_thickness * 2;
|
||||||
|
|
||||||
|
$bottom_height = $box_inner_height * $box_bottom_top_height_fraction;
|
||||||
|
$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();
|
||||||
|
};
|
||||||
|
|
||||||
|
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);
|
||||||
|
translate([-0.002, -0.002, 0])
|
||||||
|
scale([1.001, 1.001, 1.001])
|
||||||
|
translate([0, 0, $top_height + $bottom_height + $box_wall_thickness * 2])
|
||||||
|
color("red")
|
||||||
|
mirror([0, 0, 1])
|
||||||
|
bottom();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
module bottom() {
|
||||||
|
union() {
|
||||||
|
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
|
||||||
|
);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
module box_half($width, $depth, $height, $wall_thickness) {
|
||||||
|
difference() {
|
||||||
|
cube([
|
||||||
|
$width + $wall_thickness * 2,
|
||||||
|
$depth + $wall_thickness * 2,
|
||||||
|
$height + $wall_thickness
|
||||||
|
]);
|
||||||
|
translate([$wall_thickness, $wall_thickness, $wall_thickness])
|
||||||
|
cube([$width, $depth, $height + 0.1]);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
$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)
Normal file
BIN
gift-box.stl
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in a new issue