Skip to content

Latest commit

 

History

History
186 lines (175 loc) · 4.62 KB

README.md

File metadata and controls

186 lines (175 loc) · 4.62 KB

GCODE

Using C# as a domain specific language that emits g-code

alt text

static void Main(string[] args) {
	Feed(400);
	Rapid(0, 0, 1);
	SelectTool(1);
	Spindle(2000);

	ToolDrawDepth = 1.2f;
	RectangleF R = PathText("Hello", "fonts\\1CamBam_Stick_1.ttf", 10.0f);

	SelectTool(2);
	R.Inflate(1, -1);

	for (int i = 0; i < 4; i++) {
		R.Inflate(0.9f, -0.8f);
		Rapid(R.X, R.Y, 1);
		Linear(R.X, R.Y, -1f);
		Rectangle(R.Width, R.Height);
		Linear(R.X, R.Y, 1);
	}


	Spindle(0);
	Offset = Vector3.Zero;
	Rapid(new Vector3(0, 0, 1));

	File.WriteAllText("test.gcode", Compile());
}

This program generates the following gcode

N10 G21
N20 F400
N30 G0 X0 Y0 Z1
N40 M6 T1
N50 G97
N60 M3 S2000
N70 G0 X3.375 Y7.5625 Z1
N80 G1 X3.375 Y7.5625 Z-0.2
N90 G1 X11.875 Y7.5625 Z-0.2
N100 G1 X11.875 Y3.75 Z-0.2
N110 G1 X11.875 Y11 Z-0.2
N120 G1 X11.875 Y7.5625 Z-0.2
N130 G1 X3.375 Y7.5625 Z-0.2
N140 G1 X3.375 Y11 Z-0.2
N150 G1 X3.375 Y3.75 Z-0.2
N160 G1 X3.375 Y7.5625 Z-0.2
N170 G1 X3.375 Y7.5625 Z1
N180 G0 X21.4375 Y4.875 Z1
N190 G1 X21.4375 Y4.875 Z-0.2
N200 G1 X20.9375 Y4.0625 Z-0.2
N210 G1 X20 Y3.75 Z-0.2
N220 G1 X16.8125 Y3.75 Z-0.2
N230 G1 X16.25 Y3.875 Z-0.2
N240 G1 X15.75 Y4.1875 Z-0.2
N250 G1 X15.4375 Y4.625 Z-0.2
N260 G1 X15.3125 Y5.1875 Z-0.2
N270 G1 X15.3125 Y7.3125 Z-0.2
N280 G1 X15.4375 Y7.875 Z-0.2
N290 G1 X15.75 Y8.3125 Z-0.2
N300 G1 X16.25 Y8.625 Z-0.2
N310 G1 X16.8125 Y8.75 Z-0.2
N320 G1 X20 Y8.75 Z-0.2
N330 G1 X20.5625 Y8.625 Z-0.2
N340 G1 X21.0625 Y8.3125 Z-0.2
N350 G1 X21.375 Y7.875 Z-0.2
N360 G1 X21.5 Y7.3125 Z-0.2
N370 G1 X21.5 Y6.5 Z-0.2
N380 G1 X15.3125 Y6.5 Z-0.2
N390 G1 X21.5 Y6.5 Z-0.2
N400 G1 X21.5 Y7.3125 Z-0.2
N410 G1 X21.375 Y7.875 Z-0.2
N420 G1 X21.0625 Y8.3125 Z-0.2
N430 G1 X20.5625 Y8.625 Z-0.2
N440 G1 X20 Y8.75 Z-0.2
N450 G1 X16.8125 Y8.75 Z-0.2
N460 G1 X16.25 Y8.625 Z-0.2
N470 G1 X15.75 Y8.3125 Z-0.2
N480 G1 X15.4375 Y7.875 Z-0.2
N490 G1 X15.3125 Y7.3125 Z-0.2
N500 G1 X15.3125 Y5.1875 Z-0.2
N510 G1 X15.4375 Y4.625 Z-0.2
N520 G1 X15.75 Y4.1875 Z-0.2
N530 G1 X16.25 Y3.875 Z-0.2
N540 G1 X16.8125 Y3.75 Z-0.2
N550 G1 X20 Y3.75 Z-0.2
N560 G1 X20.9375 Y4.0625 Z-0.2
N570 G1 X21.4375 Y4.875 Z-0.2
N580 G1 X21.4375 Y4.875 Z-0.2
N590 G1 X21.4375 Y4.875 Z1
N600 G0 X24.625 Y11 Z1
N610 G1 X24.625 Y11 Z-0.2
N620 G1 X24.625 Y3.75 Z-0.2
N630 G1 X24.625 Y11 Z-0.2
N640 G1 X24.625 Y11 Z1
N650 G0 X28.1875 Y11 Z1
N660 G1 X28.1875 Y11 Z-0.2
N670 G1 X28.1875 Y3.75 Z-0.2
N680 G1 X28.1875 Y11 Z-0.2
N690 G1 X28.1875 Y11 Z1
N700 G0 X32.1875 Y3.75 Z1
N710 G1 X32.1875 Y3.75 Z-0.2
N720 G1 X31.6875 Y3.875 Z-0.2
N730 G1 X31.3125 Y4.125 Z-0.2
N740 G1 X31 Y4.5625 Z-0.2
N750 G1 X30.9375 Y5.0625 Z-0.2
N760 G1 X30.9375 Y7.5 Z-0.2
N770 G1 X31 Y8 Z-0.2
N780 G1 X31.3125 Y8.375 Z-0.2
N790 G1 X31.6875 Y8.6875 Z-0.2
N800 G1 X32.1875 Y8.75 Z-0.2
N810 G1 X35.9375 Y8.75 Z-0.2
N820 G1 X36.4375 Y8.6875 Z-0.2
N830 G1 X36.8125 Y8.375 Z-0.2
N840 G1 X37.125 Y8 Z-0.2
N850 G1 X37.1875 Y7.5 Z-0.2
N860 G1 X37.1875 Y5.0625 Z-0.2
N870 G1 X37.125 Y4.5625 Z-0.2
N880 G1 X36.8125 Y4.125 Z-0.2
N890 G1 X36.4375 Y3.875 Z-0.2
N900 G1 X35.9375 Y3.75 Z-0.2
N910 G1 X32.1875 Y3.75 Z-0.2
N920 G1 X32.1875 Y3.75 Z1
N930 G0 X32.1875 Y3.75 Z1
N940 G1 X32.1875 Y3.75 Z-0.2
N950 G1 X31.6875 Y3.875 Z-0.2
N960 G1 X31.3125 Y4.125 Z-0.2
N970 G1 X31 Y4.5625 Z-0.2
N980 G1 X30.9375 Y5.0625 Z-0.2
N990 G1 X30.9375 Y7.5 Z-0.2
N1000 G1 X31 Y8 Z-0.2
N1010 G1 X31.3125 Y8.375 Z-0.2
N1020 G1 X31.6875 Y8.6875 Z-0.2
N1030 G1 X32.1875 Y8.75 Z-0.2
N1040 G1 X35.9375 Y8.75 Z-0.2
N1050 G1 X36.4375 Y8.6875 Z-0.2
N1060 G1 X36.8125 Y8.375 Z-0.2
N1070 G1 X37.125 Y8 Z-0.2
N1080 G1 X37.1875 Y7.5 Z-0.2
N1090 G1 X37.1875 Y5.0625 Z-0.2
N1100 G1 X37.125 Y4.5625 Z-0.2
N1110 G1 X36.8125 Y4.125 Z-0.2
N1120 G1 X36.4375 Y3.875 Z-0.2
N1130 G1 X35.9375 Y3.75 Z-0.2
N1140 G1 X32.1875 Y3.75 Z-0.2
N1150 G1 X32.1875 Y3.75 Z1
N1160 M6 T2
N1170 G0 X1.475 Y12.8 Z1
N1180 G1 X1.475 Y12.8 Z-1
N1190 G1 X39.0875 Y12.8 Z-1
N1200 G1 X39.0875 Y1.95 Z-1
N1210 G1 X1.475 Y1.95 Z-1
N1220 G1 X1.475 Y12.8 Z-1
N1230 G1 X1.475 Y12.8 Z1
N1240 G0 X0.575 Y13.6 Z1
N1250 G1 X0.575 Y13.6 Z-1
N1260 G1 X39.9875 Y13.6 Z-1
N1270 G1 X39.9875 Y1.15 Z-1
N1280 G1 X0.575 Y1.15 Z-1
N1290 G1 X0.575 Y13.6 Z-1
N1300 G1 X0.575 Y13.6 Z1
N1310 G0 X-0.3249999 Y14.4 Z1
N1320 G1 X-0.3249999 Y14.4 Z-1
N1330 G1 X40.8875 Y14.4 Z-1
N1340 G1 X40.8875 Y0.3499994 Z-1
N1350 G1 X-0.3249999 Y0.3499994 Z-1
N1360 G1 X-0.3249999 Y14.4 Z-1
N1370 G1 X-0.3249999 Y14.4 Z1
N1380 G0 X-1.225 Y15.2 Z1
N1390 G1 X-1.225 Y15.2 Z-1
N1400 G1 X41.7875 Y15.2 Z-1
N1410 G1 X41.7875 Y-0.4500008 Z-1
N1420 G1 X-1.225 Y-0.4500008 Z-1
N1430 G1 X-1.225 Y15.2 Z-1
N1440 G1 X-1.225 Y15.2 Z1
N1450 M5
N1460 G0 X0 Y0 Z1