Skip to content

Instantly share code, notes, and snippets.

@ednisley
Created June 20, 2017 21:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ednisley/806c6308910c2400d910470772309f7f to your computer and use it in GitHub Desktop.
Save ednisley/806c6308910c2400d910470772309f7f to your computer and use it in GitHub Desktop.
Mailing Tube End Cap: Added screw-in version
// Mailing tube end cap
// Ed Nisley KE4ZNU - June 2017
Layout = "Build";
Model = "Screw";
//- Extrusion parameters - must match reality!
ThreadThick = 0.25;
ThreadWidth = 0.40;
function IntegerMultiple(Size,Unit) = Unit * ceil(Size / Unit);
Protrusion = 0.1;
HoleWindage = 0.2;
//- Screw sizes
inch = 25.4;
TubeID = 2 * inch;
TubeWall = 0.1 * inch;
CapInsert = 15.0;
CapRim = 6*ThreadThick;
CapWall = 3*ThreadWidth;
NumFlanges = 3;
FlangeHeight = 3*ThreadThick;
FlangeWidth = ThreadWidth/2;
FlangeSpace = CapInsert / (NumFlanges + 1);
ThumbHoleOD = 20.0;
ThumbHoleAngle = 100;
ThumbHoleSteps = 10;
SpannerPinOD = 5.0;
HelixOD = 4*ThreadThick;
HelixHeight = 0.75*CapInsert;
HelixAngle = atan(HelixHeight/(PI*TubeID));
HelixStarts = 3;
OAHeight = CapInsert + CapRim;
NumRibs = 3*4;
NumSides = 3*NumRibs;
//- Adjust hole diameter to make the size come out right
module PolyCyl(Dia,Height,ForceSides=0) { // based on nophead's polyholes
Sides = (ForceSides != 0) ? ForceSides : (ceil(Dia) + 2);
FixDia = Dia / cos(180/Sides);
cylinder(r=(FixDia + HoleWindage)/2,h=Height,$fn=Sides);
}
module ScrewCap() {
union() {
difference() {
cylinder(d=TubeID,h=OAHeight,$fn=NumSides);
for (a=[0,180])
for (i=[0:ThumbHoleSteps-1])
rotate(a + i*ThumbHoleAngle/ThumbHoleSteps)
translate([TubeID/4,0,-i*ThumbHoleOD/(2*ThumbHoleSteps)])
sphere(d=ThumbHoleOD);
for (a=[0,180])
rotate(a - 60)
translate([0.75*TubeID/2,0,-Protrusion])
rotate(0*180/6)
PolyCyl(SpannerPinOD,0.75*CapInsert,6);
}
for (s=[0:HelixStarts-1])
for (i=[0:NumSides-1])
rotate(i*360/NumSides + 180/NumSides + s*360/HelixStarts)
translate([TubeID/2 - 0.25*HelixOD,0,i*HelixHeight/NumSides + HelixOD])
rotate([90 + HelixAngle,0,0])
cylinder(d=HelixOD,h=1.05*PI*TubeID/NumSides,center=true,$fn=4);
}
}
module PushCap() {
difference() {
cylinder(d=TubeID,h=OAHeight,$fn=NumSides);
translate([0,0,CapWall])
cylinder(d=TubeID - 2*CapWall,h=OAHeight,$fn=NumSides);
}
for (i=[1:NumFlanges])
translate([0,0,i*FlangeSpace])
difference() {
cylinder(d=TubeID + 2*FlangeWidth,h=FlangeHeight,$fn=NumSides);
translate([0,0,-Protrusion])
cylinder(d=TubeID - 2*CapWall,h=FlangeHeight + 2*Protrusion,$fn=NumSides);
}
for (i=[0:NumRibs-1])
rotate(i*360/NumRibs)
translate([0,-ThreadWidth,CapWall + ThreadThick])
cube([TubeID/2 - CapWall/2,2*ThreadWidth,CapInsert + CapRim - CapWall - ThreadThick],center=false);
translate([0,0,CapInsert]) {
difference() {
cylinder(d=TubeID + 2*TubeWall,h=CapRim,$fn=NumSides);
translate([0,0,-Protrusion])
cylinder(d=TubeID - 3*2*CapWall,h=2*CapRim,$fn=NumSides);
}
}
}
//- Build things
if (Model == "Push")
if (Layout == "Show")
PushCap();
else if (Layout == "Build")
translate([0,0,OAHeight])
rotate([180,0,0])
PushCap();
if (Model == "Screw")
if (Layout == "Show")
ScrewCap();
else if (Layout == "Build")
translate([0,0,OAHeight])
rotate([180,0,0])
ScrewCap();
@ednisley
Copy link
Author

More details on my blog at http://wp.me/poZKh-6RC

@Neon22
Copy link

Neon22 commented Jul 16, 2017

This very nice Ed - any chance you woudl post on Thingiverse for wider uptake ?
I see someone has already posted one of your objects. - https://www.thingiverse.com/thing:1356104

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment