当前位置: 首页>>代码示例>>C#>>正文


C# GCode.Parse方法代码示例

本文整理汇总了C#中RepetierHost.model.GCode.Parse方法的典型用法代码示例。如果您正苦于以下问题:C# GCode.Parse方法的具体用法?C# GCode.Parse怎么用?C# GCode.Parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RepetierHost.model.GCode的用法示例。


在下文中一共展示了GCode.Parse方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: writeArray

 private void writeArray(BinaryWriter file, List<GCodeShort> list, bool binary)
 {
     foreach (GCodeShort code in list)
     {
         GCode gc = new GCode();
         gc.Parse(code.text);
         if (gc.hostCommand) continue;
         if (binary)
         {
             if (gc.hasCode)
             {
                 byte[] data = gc.getBinary(1);
                 file.Write(data);
             }
         }
         else
         {
             System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
             string cmd = gc.getAscii(false, false);
             if (cmd.Length > 0)
                 file.Write(enc.GetBytes(cmd + "\n"));
         }
     }
 }
开发者ID:JackTing,项目名称:Repetier-Host,代码行数:24,代码来源:StoreCode.cs

示例2: open

 public void open()
 {
     if (writeThread == null)
     {
         writeThread = new Thread(new ThreadStart(this.WriteLoop));
         writeThread.Start();
     }
     isMarlin = isRepetier = false;
     try
     {
         if (port.ToLower().Equals("virtual printer"))
         {
             isVirtualActive = true;
             virtualPrinter.open();
             GCode gc = new GCode();
             gc.Parse("M105");
             virtualPrinter.receiveLine(gc);
             connected = true;
             if (transferProtocol < 2)
                 binaryVersion = 0;
             else binaryVersion = transferProtocol - 1;
             readyForNextSend = true;
             nackLines.Clear();
             ignoreNextOk = false;
             linesSend = errorsReceived = bytesSend = 0;
             gc.Parse("N0 M110");
             virtualPrinter.receiveLine(gc);
             gc.Parse("M115");
             virtualPrinter.receiveLine(gc);
             gc.Parse("M105");
             virtualPrinter.receiveLine(gc);
             if (eventConnectionChange != null)
                 eventConnectionChange(Trans.T("L_CONNECTED"));
             Main.main.Invoke(Main.main.UpdateJobButtons);
             return;
         }
         isVirtualActive = false;
         if (Main.IsMono)
             serial = new SerialPort();
         else
             serial = new ProtectedSerialPort();
         garbageCleared = false;
         serial.PortName = port;
         serial.BaudRate = baud;
         serial.Parity = parity;
         serial.DataBits = databits;
         serial.StopBits = stopbits;
         if (!Main.IsMono)
             serial.DataReceived += received;
         serial.ErrorReceived += error;
         serial.RtsEnable = false;
         serial.DtrEnable = false;
         serial.Open();
       //  serial.DtrEnable = true;
      //   Thread.Sleep(400);
      //   serial.DtrEnable = false;
         // If we didn't restart the connection we need to eat
         // all unread data on this port.
         serial.DiscardInBuffer();
         /*while(serial.BytesToRead > 0)
         {
             string indata = serial.ReadExisting();
         }*/
         serial.WriteLine("M105");
         connected = true;
         if (transferProtocol < 2)
             binaryVersion = 0;
         else binaryVersion = transferProtocol - 1;
         readyForNextSend = true;
         nackLines.Clear();
         ignoreNextOk = false;
         linesSend = errorsReceived = bytesSend = 0;
         if (readThread == null && Main.IsMono)
         {
             readThread = new Thread(new ThreadStart(this.ReadThread));
             readThread.Start();
         }
         GetInjectLock();
         injectManualCommand("N0 M110"); // Make sure we tal about the same linenumbers
         injectManualCommand("M115"); // Check firmware
         injectManualCommand("M105"); // Read temperature
         ReturnInjectLock();
         if (eventConnectionChange != null)
             eventConnectionChange(Trans.T("L_CONNECTED"));
         Main.main.Invoke(Main.main.UpdateJobButtons);
     }
     catch (IOException ex)
     {
         serial = null;
         log(ex.Message, true, 2);
         if (eventConnectionChange != null)
             eventConnectionChange(Trans.T("L_CONNECTION_ERROR")); // "Conn. error");
         RepetierHost.view.SoundConfig.PlayError(false);
     }
 }
开发者ID:pranjalv123,项目名称:Repetier-Host,代码行数:95,代码来源:PrinterConnection.cs

示例3: injectManualCommandFirst

 public void injectManualCommandFirst(string command)
 {
     GCode gc = new GCode();
     gc.Parse(command);
     if (gc.comment) return;
     lock (history)
         injectCommands.AddFirst(gc);
     if (job.dataComplete == false)
     {
         if (injectCommands.Count == 0)
         {
             firePrinterAction(Trans.T("L_IDLE"));
         }
         else
         {
             firePrinterAction(Trans.T1("L_X_COMMANDS_WAITING", injectCommands.Count.ToString()));
         }
     }
 }
开发者ID:pranjalv123,项目名称:Repetier-Host,代码行数:19,代码来源:PrinterConnection.cs

示例4: writeString

 private void writeString(BinaryWriter file, string code, bool binary)
 {
     GCode gc = new GCode();
     gc.Parse(code);
     if (gc.hostCommand) return;
     if (binary)
     {
         if (gc.hasCode)
         {
             byte[] data = gc.getBinary(1);
             file.Write(data);
         }
     }
     else
     {
         System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
         string cmd = gc.getAscii(false, false);
         if (cmd.Length > 0)
             file.Write(enc.GetBytes(cmd + "\n"));
     }
 }
开发者ID:neo3000,项目名称:Repetier-Host,代码行数:21,代码来源:StoreCode.cs

示例5: injectManualCommand

 /// <summary>
 /// Send a print command, that does not belong to a print job.
 /// </summary>
 /// <param name="command">GCode command</param>
 public void injectManualCommand(string command)
 {
     GCode gc = new GCode();
     gc.Parse(command);
     lock(history)
         injectCommands.AddLast(gc);
     if (job.dataComplete == false)
     {
         if (injectCommands.Count == 0)
         {
             firePrinterAction("Idle");
         }
         else
         {
             firePrinterAction(injectCommands.Count.ToString() + " commands waiting");
         }
     }
 }
开发者ID:InlineTwin,项目名称:Repetier-Host,代码行数:22,代码来源:PrinterConnection.cs

示例6: PushGCodeShortArray

 public void PushGCodeShortArray(List<GCodeShort> codes)
 {
     foreach (GCodeShort line in codes)
     {
         if (line.Length == 0) continue;
         ana.analyzeShort(line);
         GCode gcode = new GCode();
         gcode.Parse(line.text);
         if (!gcode.comment)
         {
             jobList.AddLast(new GCodeCompressed(gcode));
             totalLines++;
         }
         if (line.hasLayer)
             maxLayer = line.layer;
     }
     computedPrintingTime = ana.printingTime;
 }
开发者ID:neo3000,项目名称:Repetier-Host,代码行数:18,代码来源:Printjob.cs

示例7: PushData

 public void PushData(string code)
 {
     code = code.Replace('\r', '\n');
     string[] lines = code.Split('\n');
     foreach (string line in lines)
     {
         if (line.Length == 0) continue;
         GCode gcode = new GCode();
         gcode.Parse(line);
         if (!gcode.comment)
         {
             jobList.AddLast(new GCodeCompressed(gcode));
             totalLines++;
         }
     }
 }
开发者ID:neo3000,项目名称:Repetier-Host,代码行数:16,代码来源:Printjob.cs

示例8: ParseText

 public void ParseText(string text, bool clear)
 {
     GCode gc = new GCode();
     if (clear)
         Clear();
     foreach (string s in text.Split('\n'))
     {
         gc.Parse(s);
         AddGCode(gc);
     }
 }
开发者ID:neo3000,项目名称:Repetier-Host,代码行数:11,代码来源:GCodeVisual.cs

示例9: Connect

 public override bool Connect()
 {
     con.isMarlin = con.isRepetier = con.isSprinter = false;
     connected = true;
     virtualPrinter.open(int.Parse(baudRate));
     GCode gc = new GCode();
     gc.Parse("M105");
     virtualPrinter.receiveLine(gc);
     connected = true;
     if (transferProtocol < 2)
         binaryVersion = 0;
     else binaryVersion = transferProtocol - 1;
     con.binaryVersion = binaryVersion;
     readyForNextSend = true;
     lock (nackLines)
     {
         nackLines.Clear();
     }
     linesSend = errorsReceived = bytesSend = 0;
     gc.Parse("N0 M110");
     virtualPrinter.receiveLine(gc);
     gc.Parse("M115");
     virtualPrinter.receiveLine(gc);
     gc.Parse("M105");
     virtualPrinter.receiveLine(gc);
     con.FireConnectionChange(Trans.T("L_CONNECTED") + ":" + con.printerName);
     Main.main.Invoke(Main.main.UpdateJobButtons);
     return true;
 }
开发者ID:rajeshputtur,项目名称:Repetier-Host,代码行数:29,代码来源:VirtualPrinterConnector.cs

示例10: PushGCodeShortArray

 public void PushGCodeShortArray(List<GCodeShort> codes)
 {
     foreach (GCodeShort line in codes)
     {
         if (line.Length == 0) continue;
         GCode gcode = new GCode();
         gcode.Parse(line.text);
         if (!gcode.comment)
         {
             jobList.AddLast(gcode);
             totalLines++;
         }
         if (line.hasLayer)
             maxLayer = line.layer;
     }
 }
开发者ID:rkoeppl,项目名称:Repetier-Host,代码行数:16,代码来源:Printjob.cs


注:本文中的RepetierHost.model.GCode.Parse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。