include("canned_drill.inc.gcmc");
homepos = [0mm, 0mm, 0mm];
initpos = [-1mm, -1mm, 10mm]; /* Somewhere to start */
retract = 5.0mm; /* R-plane level */
incr = 2.2mm; /* Peck increment */
feedrate(100.0mm);
goto(homepos);
move(homepos); /* Just to let LinuxCNC show a line in the preview */
/* A set of holes */
holes = {
[10mm, 0mm, -5mm], /* First hole at 10,0 depth -1 */
[15mm], /* Second hole at X=15 same Y and depth */
[20mm],
[25mm],
[-, 5mm], /* Move only in Y */
[20mm],
[15mm, -, -6mm], /* Set new drilling depth */
[10mm]
};
goto(initpos);
canned_drill(holes, retract, -1, 0); /* Drill a set of holes */
/* Set a new set of holes with explicit coordinates */
holes = {
[10mm, 20mm, -5mm],
[15mm, 20mm],
[20mm, 20mm],
[25mm, 20mm],
[25mm, 25mm],
[20mm, 25mm],
[15mm, 25mm, -6mm],
[10mm, 25mm]
};
goto(initpos + [-, 20]);
canned_drill_peck(holes, retract, incr, 1); /* Peck-drilling */
goto(head(homepos, 2));
goto(homepos); include("tracepath.inc.gcmc");
starpath = {
[ 1, 1], [ 0, 3],
[-1, 1], [-3, 0],
[-1, -1], [ 0, -3],
[ 1, -1], [ 3, 0]
};
SAFEZ = [0mm, 0mm, 1mm];
feedrate(100.0mm);
goto(SAFEZ);
starpath *= 10mm; /* Scale the star */
tracepath(starpath, -1mm, -1);
goto(SAFEZ); include("tracepath_comp.inc.gcmc");
starpath = {
[ 0, 3], [-1, 1],
[-3, 0], [-1, -1],
[ 0, -3], [ 1, -1],
[ 3, 0], [ 1, 1]
};
HOME = [0.0mm, 0.0mm, 1.0mm];
feedrate(100.0mm);
goto(HOME);
move(HOME); // To visualize following rapids
starpath *= 10.0mm; // Scale the star
// Show original path as rapids
foreach(starpath; v) {
goto(v);
}
starpath[0][2] = -1.0mm; // Set the cutting depth
tracepath_comp(starpath, 2.0mm, TPC_OLDZ|TPC_RIGHT|TPC_ARCIN|TPC_ARCOUT|TPC_CLOSED);
goto(HOME); veclist[0] = [-, -, 1.0]; /* Pen-up */
veclist[1] = [x0, y0, -]; /* Left-bottom corner of text */
/* Strokes of the glyphs follow */
veclist[2] = [x, y, -]; /* Entry point for first stroke */
veclist[3] = [-, -, 0.0]; /* Pen-down */
... lots of entries up to n-2 ...
veclist[n-1] = [-, -, 1.0]; /* Pen-up */
veclist[n] = [end_x_pos, end_y_pos, -]; /* Final position would be start of next glyph */ include("engrave.inc.gcmc");
feedrate(100.0mm);
text = "Hello World! All your Glyphs are belong to us.";
sf = 2.5mm; /* Scaling factor for 2.5mm height characters */
/*
* Engrave a scaled version of a typeset text.
*
* The height of the returned typeset text is by definition 1.0. The height is
* relative to the upper case letter 'X' of the font-face. The line-offset is
* usually in the order of two times the font-height.
*/
/* Typeset the text */
vl = typeset(text, FONT_HSANS_1);
/* Scale XY to real world coordinates */
/* Do not touch the Z-coordinate, the engrave() function needs the original */
vl = scale(vl, [sf, sf]);
/* Place somewhere in XY space */
/* Again without touching the Z-coordinate */
vl += [10.0mm, 18.0mm];
/* Engrave it (output move/goto) with pen-up at 1.5mm and pen-down at -1.0mm */
engrave(vl, 1.5mm, -1.0mm); const VARCS_DEFAULT_MAXL = 0.1mm;
const VARCS_DEFAULT_MAXA = 1.0deg; include("varcs.inc.gcmc");
radius = 25.0mm;
center = [60.0mm, 100.0mm];
zmove = 20.0mm;
turns = 5;
cp = normalize(center) * radius; // Center point for calculation. The center point
// also sets the entry angle for the circle.
cp.z = zmove; // And put in the z-movement
// Get the basic shape
spiral = vcircle_cw(cp, turns);
// The origin point in 'spiral' is [0, 0, 0] by definition
// but it has not been included in the vectorlist
// Offset the spiral to the correct location in space
spiral += center - head(cp, 2);
feedrate(300.0mm);
// Goto the starting point og the spiral
goto(head(spiral[-1], 2)); // Only in XY
goto([-, -, 0.0mm]); // Reposition in Z
// And cut to each point
foreach(spiral; v) {
move(v);
}
goto([0.0mm, 0.0mm]);
goto([-, -, 0.0mm]); const VBEZIER_DEFAULT_FLATNESS = 1.0e-4;
const VBEZIER_DEFAULT_MINL = 0.1mm; include("vbezier.inc.gcmc");
lp = [10.0mm, 0.0mm]; // Left node point
rp = [20.0mm, 10.0mm]; // Right node point
cpl = lp + [0.0mm, 10.0mm]; // Control point left
cpr = rp + [5.0mm, -5.0mm]; // Control point left
// Calculate the curve
curve = vbezier3(lp, cpl, cpr, rp);
goto(lp); // Start at starting point
move(curve); // Trace to the end