public static void SendCommandPkt(PrinterControl simCtl, GCODE gcodelist, bool zChanged, bool laserOnChanged) { byte commandByte; byte[] commandPkt; if (zChanged) { commandByte = 0; commandPkt = FloatCommandPkt(commandByte, gcodelist.GetZCommand()); CommunicationsProtocol(simCtl, commandPkt); } else if (laserOnChanged) { commandByte = 1; commandPkt = BoolCommandPkt(commandByte, gcodelist.GetLaserOn()); CommunicationsProtocol(simCtl, commandPkt); } else { commandByte = 2; commandPkt = XYCommandPkt(commandByte, gcodelist.GetXCommand(), gcodelist.GetYCommand()); CommunicationsProtocol(simCtl, commandPkt); } }
static void PrintFile(PrinterControl simCtl) { System.IO.StreamReader file = new System.IO.StreamReader("..\\..\\..\\SampleSTLs\\F-35_Corrected.gcode"); //var commandPkt = new byte[4]; Stopwatch swTimer = new Stopwatch(); swTimer.Start(); GCODE gcodelist = new GCODE(file); //int count = 0; bool zChanged; bool laserOnChanged; gcodelist.getNextLine(); Console.WriteLine(gcodelist.GetSize()); while (gcodelist.GetIndex() < gcodelist.GetSize()) // Change this to be count < gcode.list.GetSize() { gcodelist.getNextLine(); //Console.WriteLine(); //Console.WriteLine("Line: {0}", gcodelist.getNextLine()); zChanged = gcodelist.GetZCommandChanged(); laserOnChanged = gcodelist.GetLaserOnChanged(); SendCommandPkt(simCtl, gcodelist, zChanged, laserOnChanged); //count++; } //Console.WriteLine(count); swTimer.Stop(); long elapsedMS = swTimer.ElapsedMilliseconds; Console.WriteLine("Total Print Time: {0}", elapsedMS / 1000.0); Console.WriteLine("Press any key to continue"); Console.ReadKey(); }
//헤더 public GPacketHeader(int size, int num, GCODE type) { PackSize = size; PackNum = num; gcode = type; }