rectangle.gcmc
1 //ngcgui: info: Rectangle -- simple gcmc example 2 3 /*COPY this file to a directory in your subroutine search path that 4 * precedes the directory of this library file and edit as 5 * required 6 * 7 * ngcgui uses the editor specified by $VISUAL 8 */ 9 10 //-------------------------------------------------------------------- 11 // Variables 12 // Precede any of the following lines with 13 // //ngcgui: 14 // to make an entry box 15 // Omit the "//ngcgui:" to use the hard-coded value 16 17 //ngcgui: umode = 1; //, units: 1:mm, 0:inch 18 //ngcgui: frate = 100; //, Feed Rate 19 //ngcgui: x1 = 0; //, xoffset 20 //ngcgui: y1 = 0; //, yoffset 21 //ngcgui: width = 1; 22 //ngcgui: height = 1; 23 //ngcgui: zsafe = 0.1; 24 //ngcgui: zcut = -0.1; //, zcut (neg) 25 //ngcgui: verbose = 0; // precede ensure_units 26 include("ensure_units.gcmc"); // avoid preamble conflict 27 //-------------------------------------------------------------------- 28 if (verbose) {comment("debug, rectangle.gcmc:start");} 29 30 if (umode == 1) { 31 zero = 0.0mm; 32 } else { 33 zero = 0.0in; 34 } 35 // ngcgui entries are unitless so these additions are used 36 // to ensure 1) floatingpoint and 2) units per umode setting 37 38 frate = zero + frate; 39 x1 = zero + x1; 40 y1 = zero + y1; 41 width = zero + width; 42 height = zero + height; 43 zsafe = zero + zsafe; 44 zcut = zero + zcut; 45 46 feedrate(frate); 47 goto([x1, y1, zsafe]); 48 49 move([x1, y1, zcut]); 50 move([x1 + width, y1, zcut]); 51 move([x1 + width, y1 + height, zcut]); 52 move([x1, y1 + height, zcut]); 53 move([x1, y1, zcut]); 54 55 goto([-, -, zsafe]); 56 if (verbose) {comment("debug, rectangle.gcmc:end");} 57 58 // uncomment to see how message()s are handled: 59 if (verbose) { 60 message("1test message in gcmc file"); 61 message("2test message in gcmc file"); 62 } 63 64 // uncomment to see how warning()s are handled: 65 //warning("1test warning in gcmc file"); 66 //warning("2test warning in gcmc file"); 67 68 // uncomment to see how error()s are handled: 69 //error("1test error in gcmc file"); 70 //error("2test error in gcmc file");