Skip to content

Instantly share code, notes, and snippets.

@ednisley
Created June 12, 2017 18:03
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/5d6de872d82e2c463d34d325660cd387 to your computer and use it in GitHub Desktop.
Save ednisley/5d6de872d82e2c463d34d325660cd387 to your computer and use it in GitHub Desktop.
OpenSCAD source code: Mailing tube end cap
// Mailing tube end cap
// Ed Nisley KE4ZNU - June 2017
Layout = "Build";
//- 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 = 1.0;
CapWall = 3*ThreadWidth;
NumFlanges = 3;
FlangeHeight = 3*ThreadThick;
FlangeWidth = ThreadWidth/2;
FlangeSpace = CapInsert / (NumFlanges + 1);
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 TubeCap() {
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 (Layout == "Show")
TubeCap();
if (Layout == "Build")
translate([0,0,OAHeight])
rotate([180,0,0])
TubeCap();
@ednisley
Copy link
Author

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

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