コード例 #1
0
        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;
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 // 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
ファイル: Main.cs プロジェクト: JackTing/Repetier-Host
 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);
 }
コード例 #8
0
 public PrintingStateSnapshot GetSnapshot()
 {
     if (snapshot == null)
     {
         // Lazy loading
         snapshot = PrintingStateSnapshotSerialization.LoadSnapshotFile(path);
     }
     return snapshot;
 }
コード例 #9
0
 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);
            }
        }
コード例 #16
0
 public static PrintingStateSnapshot TakeSnapshot(PrinterConnection conn)
 {
     return(PrintingStateSnapshot.GeneratePrintingStateSnapshot(conn));
 }