Compare commits
No commits in common. "9970074bd7bfbcaefa6a0ca55a3246b88afe8471" and "1a4ae271a782709064b754c840156cb90ff27f27" have entirely different histories.
9970074bd7
...
1a4ae271a7
|
|
@ -1,286 +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
|
||||
);
|
||||
}
|
||||
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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +1,17 @@
|
|||
/** Parameters */
|
||||
$camera_mount = true;
|
||||
$base = true;
|
||||
$arm_base = true;
|
||||
$screen_mount = true;
|
||||
$arm_pieces = 1;
|
||||
$screws = 1;
|
||||
$nuts = 1;
|
||||
/** Scale nuts up slightly for easier fit and less friction. */
|
||||
$nut_scale = 1.05;
|
||||
$nut_bumps = false;
|
||||
|
||||
/** Code */
|
||||
module __no_more_parameters() {};
|
||||
|
||||
/** Scale nuts up slightly for easier fit and less friction. */
|
||||
$nut_scale = 1.05;
|
||||
|
||||
$triangle_width = 65;
|
||||
$triangle_height = 40;
|
||||
$triangle_thickness = 5.87;
|
||||
|
|
@ -29,60 +28,14 @@ $steps_per_turn = $preview ? 8 : 128;
|
|||
use <Thread_Library.scad>
|
||||
|
||||
if ($camera_mount) {
|
||||
translate([-90, -40, 0])
|
||||
translate([0, -60, 0])
|
||||
camera_mount();
|
||||
}
|
||||
if ($base) {
|
||||
screen_and_attachment();
|
||||
pi_bed();
|
||||
translate([10, 0, 0]) attachment_point();
|
||||
}
|
||||
|
||||
module pi_bed() {
|
||||
$slat_count = 10;
|
||||
$slat_gap = 10.4;
|
||||
$slat_width = 4;
|
||||
$side_width = 6;
|
||||
$bed_depth = 6;
|
||||
$bed_width = 70;
|
||||
// slats
|
||||
for (i = [0:1:$slat_count - 1]) {
|
||||
translate([$slat_gap * i, -70, -$bed_depth])
|
||||
cube([4, $bed_width, 4]);
|
||||
}
|
||||
// sides
|
||||
for (i = [0:1:1]) {
|
||||
color("blue")
|
||||
translate([0, -$bed_width * i - $side_width, -$bed_depth])
|
||||
cube([97.6, $side_width, $bed_depth]);
|
||||
}
|
||||
// railings
|
||||
color("orange")
|
||||
translate([0, -$side_width - $bed_width, -$bed_depth])
|
||||
cube([$slat_width / 2, $bed_width, $bed_depth]);
|
||||
color("orange")
|
||||
translate([97.6, -$side_width - $bed_width, -$bed_depth])
|
||||
cube([$slat_width / 2, $bed_width + $side_width, $bed_depth]);
|
||||
}
|
||||
|
||||
module screen_and_attachment() {
|
||||
color("green")
|
||||
translate([-15, 0, 0])
|
||||
rotate([90, 0, 0])
|
||||
attachment_point();
|
||||
color("blue")
|
||||
translate([-0.5, 0, 4.5])
|
||||
rotate([45, 0, -90])
|
||||
screen_mount();
|
||||
|
||||
$screen_mount_support_width = 6;
|
||||
difference() {
|
||||
color("red")
|
||||
translate([44.5, -$screen_mount_support_width, 27.4])
|
||||
rotate([0, -45, 0])
|
||||
cube([12, $screen_mount_support_width, 18]);
|
||||
translate([50, -$screen_mount_support_width * 1.5, 0])
|
||||
cube([20, $screen_mount_support_width * 2, 60]);
|
||||
};
|
||||
if ($screen_mount) {
|
||||
translate([0, 40, 0]) screen_mount();
|
||||
}
|
||||
|
||||
$camera_mount_thickness = 1;
|
||||
|
|
@ -140,7 +93,7 @@ module attachment_point() {
|
|||
translate([$rounded_nose, 4.234, -0.2])
|
||||
rotate([0, 0, 120])
|
||||
nose_rounding();
|
||||
translate([0, $triangle_height - $triangle_y_offset * 1.2, -0.1])
|
||||
translate([0, $triangle_height - $triangle_y_offset * 1.5, -0.1])
|
||||
cube([100, 100, $triangle_thickness * 3]);
|
||||
translate([45, 12, -0.1])
|
||||
cylinder(h=100, r=10);
|
||||
|
|
@ -225,17 +178,13 @@ module nut_bumps() {
|
|||
}
|
||||
}
|
||||
|
||||
module screw() {
|
||||
union() {
|
||||
translate([0, 0, $screw_head_thickness - 4])
|
||||
thread();
|
||||
nut_head();
|
||||
};
|
||||
}
|
||||
|
||||
for (i = [0:1:$screws - 1]) {
|
||||
translate([-$screw_head_diameter, i * ($screw_head_diameter + 5), 0])
|
||||
screw();
|
||||
union() {
|
||||
translate([0, 0, $screw_head_thickness - 4])
|
||||
thread();
|
||||
nut_head();
|
||||
};
|
||||
}
|
||||
|
||||
for (i = [0:1:$nuts - 1]) {
|
||||
|
|
@ -283,34 +232,3 @@ module thread_hole_punch(height=50) {
|
|||
translate([0, 0, -0.1])
|
||||
cylinder(d=13, h=height);
|
||||
}
|
||||
|
||||
|
||||
module arm_base() {
|
||||
$width = 20;
|
||||
$thickness = 3;
|
||||
$screw_top = 24.46175;
|
||||
$hole_height = $screw_top + $width / 2 + 1;
|
||||
|
||||
difference() {
|
||||
union() {
|
||||
translate([0, $thickness / 2, $hole_height])
|
||||
rotate([90, 0, 0])
|
||||
cylinder(d=$width, h=$thickness);
|
||||
color("gray")
|
||||
translate([-$width / 2, -$thickness / 2, $screw_top])
|
||||
cube([$width, $thickness, $width / 2 + 1]);
|
||||
};
|
||||
translate([0, 2, $hole_height])
|
||||
rotate([90, 0, 0])
|
||||
thread_hole_punch();
|
||||
}
|
||||
color("brown")
|
||||
translate([0, 0, $screw_top])
|
||||
rotate([-180, 0, 0])
|
||||
screw();
|
||||
}
|
||||
|
||||
if ($arm_base) {
|
||||
translate([-30, -40, 0])
|
||||
arm_base();
|
||||
}
|
||||
Loading…
Reference in a new issue