示例#1
0
        public GCodeCompressed(GCode c)
        {
            int    p   = c.orig.IndexOf(';');
            string tmp = (p >= 0 ? c.orig.Substring(0, p) : c.orig).Trim();

            data = enc.GetBytes(tmp);
        }
示例#2
0
 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++;
         }
     }
 }
示例#3
0
 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;
 }
示例#4
0
        public GCode PopData()
        {
            GCode gc       = null;
            bool  finished = false;

            lock (jobList)
            {
                if (jobList.Count == 0)
                {
                    return(null);
                }
                try
                {
                    gc = new GCode(jobList.First.Value);
                    jobList.RemoveFirst();
                    linesSend++;

                    /*PrintTime pt = new PrintTime();
                     * pt.line = linesSend;
                     * pt.time = DateTime.Now.Ticks;
                     * lock (times)
                     * {
                     *  times.AddLast(pt);
                     *  if (times.Count > 1500)
                     *      times.RemoveFirst();
                     * }*/
                }
                catch { };
                finished = jobList.Count == 0 && mode != 3;
            }
            if (finished)
            {
                dataComplete = false;
                mode         = 2;
                jobFinished  = DateTime.Now;
                long ticks = (jobFinished.Ticks - jobStarted.Ticks) / 10000;
                long hours = ticks / 3600000;
                ticks -= 3600000 * hours;
                long min = ticks / 60000;
                ticks -= 60000 * min;
                long sec = ticks / 1000;
                //Main.conn.log("Printjob finished at " + jobFinished.ToShortDateString()+" "+jobFinished.ToShortTimeString(),false,3);
                Main.conn.log(Trans.T1("L_PRINTJOB_FINISHED_AT", jobFinished.ToShortDateString() + " " + jobFinished.ToShortTimeString()), false, 3);
                StringBuilder s = new StringBuilder();
                if (hours > 0)
                {
                    s.Append(Trans.T1("L_TIME_H:", hours.ToString())); //"h:");
                }
                if (min > 0 || hours > 0)
                {
                    s.Append(Trans.T1("L_TIME_M:", min.ToString()));
                }
                s.Append(Trans.T1("L_TIME_S", sec.ToString()));
                //Main.conn.log("Printing time:"+s.ToString(),false,3);
                //Main.conn.log("Lines send:" + linesSend.ToString(), false, 3);
                //Main.conn.firePrinterAction("Finished in "+s.ToString());
                Main.conn.log(Trans.T1("L_PRINTING_TIME:", s.ToString()), false, 3);
                Main.conn.log(Trans.T1("L_LINES_SEND:X", linesSend.ToString()), false, 3);
                Main.conn.firePrinterAction(Trans.T1("L_FINISHED_IN", s.ToString()));
                DoEndKillActions();

                /* PTTISYN
                 * Main.main.Invoke(Main.main.UpdateJobButtons);
                 * Main.main.printPanel.Invoke(Main.main.printPanel.SetStatusJobFinished);
                 * RepetierHost.view.SoundConfig.PlayPrintFinished(false);
                 */
            }
            return(gc);
        }