internal static PrintingStateSnapshot GeneratePrintingStateSnapshot(PrinterConnection conn)
        {
            // Analyze status and save state.
            GCodeAnalyzer analyzer = conn.analyzer;
            PrintingStateSnapshot s = new PrintingStateSnapshot();

            s.x = analyzer.RealX;
            s.y = analyzer.RealY;
            s.z = analyzer.RealZ;
            s.fanVoltage = analyzer.fanVoltage;
            s.fanOn = analyzer.fanOn;
            s.speed = analyzer.f;
            s.layer = analyzer.layer;
            s.extrudersTemp = new float[conn.extruderTemp.Count];
            for (int extr = 0; extr < conn.extruderTemp.Count; extr++ )
            {
                // Use the configured temperature, not the measured
                // temperature.
                s.extrudersTemp[extr] = conn.analyzer.getTemperature(extr);
                //s.extrudersTemp[extr] = conn.extruderTemp[extr];
            }
            // Use the configured temperature, not the measured temperature.
            s.bedTemp = conn.analyzer.bedTemp;
            //s.bedTemp = conn.bedTemp;
            s.activeExtruderId = analyzer.activeExtruderId;
            s.relative = analyzer.relative;
            s.activeExtruderValue = analyzer.activeExtruder.e - analyzer.activeExtruder.eOffset;
            s.remainingCode = GetRemainingGcode(conn); 
            
            return s;
        }
        internal static PrintingStateSnapshot GeneratePrintingStateSnapshot(PrinterConnection conn)
        {
            // Analyze status and save state.
            GCodeAnalyzer         analyzer = conn.analyzer;
            PrintingStateSnapshot s        = new PrintingStateSnapshot();

            s.x             = analyzer.RealX;
            s.y             = analyzer.RealY;
            s.z             = analyzer.RealZ;
            s.fanVoltage    = analyzer.fanVoltage;
            s.fanOn         = analyzer.fanOn;
            s.speed         = analyzer.f;
            s.layer         = analyzer.layer;
            s.extrudersTemp = new float[conn.extruderTemp.Count];
            for (int extr = 0; extr < conn.extruderTemp.Count; extr++)
            {
                // Use the configured temperature, not the measured
                // temperature.
                s.extrudersTemp[extr] = conn.analyzer.getTemperature(extr);
                //s.extrudersTemp[extr] = conn.extruderTemp[extr];
            }
            // Use the configured temperature, not the measured temperature.
            s.bedTemp = conn.analyzer.bedTemp;
            //s.bedTemp = conn.bedTemp;
            s.activeExtruderId    = analyzer.activeExtruderId;
            s.relative            = analyzer.relative;
            s.activeExtruderValue = analyzer.activeExtruder.e - analyzer.activeExtruder.eOffset;
            s.remainingCode       = GetRemainingGcode(conn);

            return(s);
        }
 // other snapshot attributes are inherited from PrintingState
 internal static PrintingStateSnapshot GeneratePrintingStateSnapshot(PrinterConnection conn)
 {
     // Analyze status and save state.
     PrintingStateSnapshot s = new PrintingStateSnapshot();
     s.CaptureState(conn);
     s.remainingCode = GetRemainingGcode(conn);
     return s;
 }
示例#4
0
 public PrintingStateSnapshot GetSnapshot()
 {
     if (snapshot == null)
     {
         // Lazy loading
         snapshot = PrintingStateSnapshotSerialization.LoadSnapshotFile(path);
     }
     return(snapshot);
 }
示例#5
0
        public static void SaveSnapshotFile(PrintingStateSnapshot state, string path)
        {
            Stream stream = File.OpenWrite(path);

            try
            {
                SaveSnapshotFile(state, stream);
            }
            finally
            {
                stream.Close();
            }
        }
示例#6
0
        public static void SaveSnapshotFile(PrintingStateSnapshot state, Stream fileStream)
        {
            SnapshotContainer container = new SnapshotContainer();

            container.type     = SnapshotTypeStateAndRemainingGCode;
            container.version  = ContainerVersion;
            container.snapshot = state;

            System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(container.GetType());
            try
            {
                x.Serialize(fileStream, container);
            }
            catch (InvalidOperationException ex)
            {
                throw new IOException("Failed to write state file.", ex);
            }
        }
示例#7
0
 private void SaveStateFile(PrintingStateSnapshot state, string snapshotName)
 {
     // Check if there's already a file with that name. The file would be overwritten.
     //bool fileExists = (PendingPrintJobs.GetPendingJobWithName(snapshotName) != null);
     PendingPrintJobs.Add(state, snapshotName);
 }
 public PrintingStateSnapshot GetSnapshot()
 {
     if (snapshot == null)
     {
         // Lazy loading
         snapshot = PrintingStateSnapshotSerialization.LoadSnapshotFile(path);
     }
     return snapshot;
 }
 public PendingPrintJob(PrintingStateSnapshot snapshot, string path)
 {
     this.path = path;
     this.snapshot = snapshot;
 }
示例#10
0
        public static void SaveSnapshotFile(PrintingStateSnapshot state, Stream fileStream)
        {
            SnapshotContainer container = new SnapshotContainer();

            container.type = SnapshotTypeStateAndRemainingGCode;
            container.version = ContainerVersion;
            container.snapshot = state;

            Serialize(container, fileStream);
        }
示例#11
0
 public static void SaveSnapshotFile(PrintingStateSnapshot state, string path)
 {
     Stream stream = File.OpenWrite(path);
     try
     {
         SaveSnapshotFile(state, stream);
     }
     finally
     {
         stream.Close();
     }
 }
示例#12
0
 public static void Add(PrintingStateSnapshot snapshot, string name)
 {
     PendingPrintJob job = new PendingPrintJob(snapshot, PendingJobsDir + Path.DirectorySeparatorChar + name + "." + RepetierExtension);
     job.Save();
 }
示例#13
0
        public static void Add(PrintingStateSnapshot snapshot, string name)
        {
            PendingPrintJob job = new PendingPrintJob(snapshot, PendingJobsDir + Path.DirectorySeparatorChar + name + "." + RepetierExtension);

            job.Save();
        }
示例#14
0
 public PendingPrintJob(PrintingStateSnapshot snapshot, string path)
 {
     this.path     = path;
     this.snapshot = snapshot;
 }
示例#15
0
        public static void SaveSnapshotFile(PrintingStateSnapshot state, Stream fileStream)
        {
            SnapshotContainer container = new SnapshotContainer();

            container.type = SnapshotTypeStateAndRemainingGCode;
            container.version = ContainerVersion;
            container.snapshot = state;

            System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(container.GetType());
            try
            {
                x.Serialize(fileStream, container);
            }
            catch (InvalidOperationException ex)
            {
                throw new IOException("Failed to write state file.", ex);
            }
        }
 public static PrintingStateSnapshot TakeSnapshot(PrinterConnection conn)
 {
     return(PrintingStateSnapshot.GeneratePrintingStateSnapshot(conn));
 }