Skip to content

Instantly share code, notes, and snippets.

@ednisley
Created November 16, 2019 12:41
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/1a2bf1fa5bbe88d43ab5f89982578b41 to your computer and use it in GitHub Desktop.
Save ednisley/1a2bf1fa5bbe88d43ab5f89982578b41 to your computer and use it in GitHub Desktop.
OpenSCAD source code: Collet pen holder using LM12UU linear bearings for CNC 3018-Pro
// Collet Pen Holder in LM12UU linear bearings for CNC3018
// Ed Nisley KE4ZNU - 2019-10-30
Layout = "Build"; // [Build, Show, Base, Mount, Plate]
/* [Hidden] */
ThreadThick = 0.25; // [0.20, 0.25]
ThreadWidth = 0.40; // [0.40, 0.40]
/* [Hidden] */
Protrusion = 0.1; // [0.01, 0.1]
HoleWindage = 0.2;
inch = 25.4;
function IntegerMultiple(Size,Unit) = Unit * ceil(Size / Unit);
ID = 0;
OD = 1;
LENGTH = 2;
//- 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);
}
//- Dimensions
PenOD = 3.5; // pen cartridge diameter
Bearing = [12.0,21.0,30.0]; // linear bearing body
SpringSeat = [0.56,10.0,3*ThreadThick]; // wire = ID, coil = OD, seat depth = length
WallThick = 4.0; // minimum thickness / width
Screw = [3.0,6.75,25.0]; // holding it all together, OD = washer
Insert = [3.0,5.5,8.2]; // brass insert
//Insert = [4.0,6.0,10.0];
Clamp = [43.2,44.5,34.0]; // tool clamp ring, OD = clearance around top
LipHeight = IntegerMultiple(2.0,ThreadThick); // above clamp for retaining
BottomExtension = 25.0; // below clamp to reach workpiece
MountOAL = LipHeight + Clamp[LENGTH] + BottomExtension; // total mount length
echo(str("Mount OAL: ",MountOAL));
Plate = [1.5*PenOD,Clamp[ID] - 0*2*WallThick,WallThick]; // spring reaction plate
NumScrews = 3;
ScrewBCD = Bearing[OD] + Insert[OD] + 2*WallThick;
echo(str("Retainer max OD: ",ScrewBCD - Screw[OD]));
NumSides = 9*4; // cylinder facets (multiple of 3 for lathe trimming)
// Basic mount shape
module CNC3018Base() {
translate([0,0,MountOAL - LipHeight])
cylinder(d=Clamp[OD],h=LipHeight,$fn=NumSides);
translate([0,0,MountOAL - LipHeight - Clamp[LENGTH] - Protrusion])
cylinder(d=Clamp[ID],h=(Clamp[LENGTH] + 2*Protrusion),$fn=NumSides);
cylinder(d1=Bearing[OD] + 2*WallThick,d2=Clamp[ID],h=BottomExtension + Protrusion,$fn=NumSides);
}
// Mount with holes & c
module Mount() {
difference() {
CNC3018Base();
translate([0,0,-Protrusion]) // bearing
PolyCyl(Bearing[OD],2*MountOAL,NumSides);
for (i=[0:NumScrews - 1]) // clamp screws
rotate(i*360/NumScrews)
translate([ScrewBCD/2,0,MountOAL - Clamp[LENGTH]])
rotate(180/8)
PolyCyl(Insert[OD],Clamp[LENGTH] + Protrusion,8);
}
}
module SpringPlate() {
difference() {
cylinder(d=Plate[OD],h=Plate[LENGTH],$fn=NumSides);
translate([0,0,-Protrusion])
PolyCyl(Plate[ID],2*MountOAL,NumSides);
translate([0,0,Plate.z - SpringSeat[LENGTH]]) // spring retaining recess
PolyCyl(SpringSeat[OD],SpringSeat[LENGTH] + Protrusion,NumSides);
for (i=[0:NumScrews - 1]) // clamp screws
rotate(i*360/NumScrews)
translate([ScrewBCD/2,0,-Protrusion])
rotate(180/8)
PolyCyl(Screw[ID],2*MountOAL,8);
}
}
//-----
// Build it
if (Layout == "Base")
CNC3018Base();
if (Layout == "Mount")
Mount();
if (Layout == "Plate")
SpringPlate();
if (Layout == "Show") {
Mount();
translate([0,0,1.25*MountOAL])
rotate([180,0,0])
SpringPlate();
}
if (Layout == "Build") {
translate([0,-0.75*Clamp[OD],MountOAL])
rotate([180,0,0])
Mount();
translate([0,0.75*Plate[OD],0])
SpringPlate();
}
@ednisley
Copy link
Author

More details on my blog at https://wp.me/poZKh-8yT

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