Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
GCMC source code: MPCNC Drag Knife Calibration for speed and depth (= downforce)
// Calibrate Drag Knife - speed & feed
// Ed Nisley - KE4ZNU
// 2020-03 values for MPCNC
//-----
// Dimensions
CutIncr = -0.5mm;
BottomCutZ = -2.5mm;
SpeedRatio = 2.0;
MaxSpeed = 2000mm;
MinSpeed = MaxSpeed / 8;
StripWidth = 10mm;
CornerRadius = StripWidth/2;
PatternSize = StripWidth * [3,3];
PatternSpace = 1.25;
SafeZ = 10.0mm; // above all obstructions
TravelZ = 2.0mm; // within engraving / milling area
FALSE = 0;
TRUE = !FALSE;
if (!isdefined("TestSelect")) {
TestSelect = "Depth";
}
comment("Test Selection: ",TestSelect);
//-----
// One complete pattern
// Centered at ctr, ctr.z=cut depth
function Pattern(ctr) {
local d1 = CornerRadius; // useful relative distances
local d2 = 2*d1;
local d3 = 3*d1;
local d4 = 4*d1;
goto([-,-,TravelZ]); // set up for entry move
goto(head(ctr,2) + [-d2,d3]);
move([ctr.x + d2,-,ctr.z]); // enter to cut depth
arc_cw_r([d1,-d1],d1);
move_r([0,-d4]);
arc_cw_r([-d1,-d1],d1);
move_r([-d4,0]);
arc_cw_r([0,d2],d1);
move_r([d2,0]);
arc_ccw_r([0,d2],d1);
move_r([-d2,0]);
arc_cw_r([0,d2],d1);
move_r([d4,0]); // re-cut entire entry path
goto([-,-,TravelZ]); // exit to surface
// goto(head(ctr,2));
}
//-----
// Start cutting!
goto([-,-,SafeZ]);
goto([0,0,-]);
goto([-,-,TravelZ]);
if (TestSelect == "Depth") {
comment("Depth variations");
s = MaxSpeed / 2;
feedrate(s);
c = [0,0,-]; // initial center at origin
for (c.z = CutIncr; c.z >= BottomCutZ; c.z += CutIncr) {
comment("At: ",c," speed:",s);
Pattern(c);
c.x += PatternSpace * PatternSize.x;
}
}
if (TestSelect == "Speed") {
comment("Speed variations");
c = [0,0,-2mm]; // initial center at origin
for (s = MinSpeed; s <= MaxSpeed; s *= SpeedRatio) {
comment("At: ",c," speed: ",s);
feedrate(s);
Pattern(c);
c.x += PatternSpace * PatternSize.x;
}
}
goto([-,-,SafeZ]);
goto([0,0,-]);
@ednisley

This comment has been minimized.

Copy link
Owner Author

@ednisley ednisley commented Mar 20, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.