summaryrefslogtreecommitdiff
path: root/nc_files/gcmc_lib/drill.gcmc
blob: 9ac70a7ba8d0c30cec32b00ebc92c74bd21b96ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*******************************************************
The following //comment lines identify ngcgui inputs:

example option:
//ngcgui: --precision 6

info message (appears on ngcgui tab page):
//ngcgui: info: gcmc drill example

variables with defaults:
//ngcgui: umode = 1;      //, units: 1:mm, 0:inch
//ngcgui: nx=4;           //
//ngcgui: ny=3;           //
//ngcgui: xstart=1;       //
//ngcgui: ystart=1;       //
//ngcgui: xspacing=0.5;   //
//ngcgui: yspacing=1.0;   //
//ngcgui: retract=0.1;    //
//ngcgui: increment=0.5;  //
//ngcgui: repeatct=1;     //
//ngcgui: fr=10,feedrate; //

variable with comment text:
//ngcgui: zdepth=0 , z(neg typ)
//ngcgui: verbose = 0; //preced ensure_units
*******************************************************/
include("ensure_units.gcmc"); //avoid preamble conflict

if (umode == 1) {
  zero = 0.0mm;
} else {
  zero = 0.0in;
}
// ngcgui entries are unitless so these additions are used
// to ensure 1) floatingpoint and 2) units per umode setting
   xstart = zero + xstart;
   ystart = zero + ystart;
 xspacing = zero + xspacing;
 yspacing = zero + yspacing;
  retract = zero + retract;
increment = zero + increment;
       fr = zero + fr;

feedrate(fr);

x=xstart;
y=ystart;
sign = 1;

for (i = 0; i < nx ; i++) {
  for (j = 0; j < ny; j++) {
    drill([x, y, zdepth], retract, increment, repeatct);
    y = y + sign * yspacing;
  }
  y = y - sign * yspacing;
  sign = -1 *sign;
  x = x + xspacing;
}