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
59
60
61
62
63
64
65
66
67
68
69
70
|
//ngcgui: info: Rectangle -- simple gcmc example
/*COPY this file to a directory in your subroutine search path that
* precedes the directory of this library file and edit as
* required
*
* ngcgui uses the editor specified by $VISUAL
*/
//--------------------------------------------------------------------
// Variables
// Precede any of the following lines with
// //ngcgui:
// to make an entry box
// Omit the "//ngcgui:" to use the hard-coded value
//ngcgui: umode = 1; //, units: 1:mm, 0:inch
//ngcgui: frate = 100; //, Feed Rate
//ngcgui: x1 = 0; //, xoffset
//ngcgui: y1 = 0; //, yoffset
//ngcgui: width = 1;
//ngcgui: height = 1;
//ngcgui: zsafe = 0.1;
//ngcgui: zcut = -0.1; //, zcut (neg)
//ngcgui: verbose = 0; // precede ensure_units
include("ensure_units.gcmc"); // avoid preamble conflict
//--------------------------------------------------------------------
if (verbose) {comment("debug, rectangle.gcmc:start");}
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
frate = zero + frate;
x1 = zero + x1;
y1 = zero + y1;
width = zero + width;
height = zero + height;
zsafe = zero + zsafe;
zcut = zero + zcut;
feedrate(frate);
goto([x1, y1, zsafe]);
move([x1, y1, zcut]);
move([x1 + width, y1, zcut]);
move([x1 + width, y1 + height, zcut]);
move([x1, y1 + height, zcut]);
move([x1, y1, zcut]);
goto([-, -, zsafe]);
if (verbose) {comment("debug, rectangle.gcmc:end");}
// uncomment to see how message()s are handled:
if (verbose) {
message("1test message in gcmc file");
message("2test message in gcmc file");
}
// uncomment to see how warning()s are handled:
//warning("1test warning in gcmc file");
//warning("2test warning in gcmc file");
// uncomment to see how error()s are handled:
//error("1test error in gcmc file");
//error("2test error in gcmc file");
|