Skip to content

Instantly share code, notes, and snippets.

@ednisley
Created March 15, 2020 21:00
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/050b7e5fdca931d1a195551fe01437b3 to your computer and use it in GitHub Desktop.
Save ednisley/050b7e5fdca931d1a195551fe01437b3 to your computer and use it in GitHub Desktop.
GCMC source code: Kitchen sink strainer
// Drill & mill sink drain strainer
// Ed Nisley KE4ZNU -- Digital Machinist 15.2 Spring 2020
// polycarbonate or acrylic sheet
// External clamps at corners
// Origin at center of sheet
//-----
// Dimensions
DiskOD = 80.0mm; // usual kitchen drain = 3-1/4 inch
DiskRad = DiskOD/2;
PlateThick = 6.0mm; // stock thickness
MillOD = 3.170mm; // measured end mill OD
HoleDia = 4.75mm; // 3/16 inch drain holes
ScrewOD = 0.18in; // knob screw clearance
NumRings = 3; // rings of drain holes
RingSpace = 1.5 * HoleDia; // .. between rings
MaxZCut = 0.25 * MillOD; // max cut depth
MillSpeed = 1000mm; // horizontal feedrate
NumTabs = 4;
TabTilt = 45deg;
TabLength = 5.0mm;
TabThick = 0.5mm;
SafeZ = 10.0mm; // above all obstructions
TravelZ = 1.0mm; // within engraving / milling area
MillZ = -(PlateThick + 0.5mm); // through disk into spoil board
TwoPi = 2*pi();
//-----
// Mill one hole
function MillHole(ctr,radius,turns) {
goto([-,-,TravelZ]);
goto(head(ctr,2) + [radius,-,-]);
goto([-,-,0]); // kiss surface
circle_cw(ctr,turns); // helix downward
circle_cw(head(ctr,2)); // remove last ramp
goto(ctr); // get elbow room
goto([-,-,TravelZ]);
}
//-----
// Start cutting!
goto([-,-,SafeZ]);
goto([0,0,-]);
goto([-,-,TravelZ]);
feedrate(MillSpeed);
// Mill center screw hole
comment("-- Center hole");
ctr = [0,0,MillZ];
MillHole(ctr,(ScrewOD - MillOD) / 2,ceil(abs(ctr.z) / MaxZCut));
// Mill hole rings
comment("-- Drain hole rings");
repeat (NumRings; ri) {
comment("Ring: ",ri);
rr = DiskRad - ri*RingSpace; // ring radius
comment(" radius: ",rr);
nh = to_int(floor(TwoPi*rr / (2*HoleDia))); // number of holes
comment(" holes: ",nh);
repeat(nh; h) {
a = (h - 1) * TwoPi / nh; // angle of hole
ctr = [rr*cos(a),rr*sin(a),MillZ]; // center point at ending Z
MillHole(ctr,(HoleDia - MillOD)/2,ceil(abs(ctr.z) / MaxZCut));
}
}
// Mill perimeter
comment("-- Perimeter");
r = DiskRad + MillOD/2;
goto([r,0,-]);
goto([-,-,0]);
ctr = [0,0,-(PlateThick - TabThick)];
circle_ccw(ctr,ceil(abs(ctr.z) / MaxZCut)); // ramp downward
circle_ccw(ctr,1); // remove last ramp
goto([-,-,TravelZ]);
comment("-- Tabs");
ta = 360deg / NumTabs; // between tabs
tsa = to_rad(TwoPi*((TabLength + MillOD) / (TwoPi * r))); // subtended tab angle
repeat (NumTabs; i) {
comment(" # ",i);
a = TabTilt + (i - 1)*ta; // tab center angle
p0 = [r*cos(a + tsa/2),r*sin(a + tsa/2),MillZ]; // entry on ccw side
p1 = [r*cos(a + ta - tsa/2),r*sin(a + ta - tsa/2),MillZ]; // exit at next tab
if (0) {
comment(" angle: ",a);
comment(" entry: ",p0);
comment(" exit: ",p1);
}
goto(head(p0,2)); // to entry point
move(p0); // plunge through
arc_ccw(p1,r);
goto([-,-,TravelZ]);
}
goto([-,-,SafeZ]);
goto([0,0,-]);
@ednisley
Copy link
Author

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

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