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; }
public PrintingStateSnapshot GetSnapshot() { if (snapshot == null) { // Lazy loading snapshot = PrintingStateSnapshotSerialization.LoadSnapshotFile(path); } return(snapshot); }
public static void SaveSnapshotFile(PrintingStateSnapshot state, string path) { Stream stream = File.OpenWrite(path); try { SaveSnapshotFile(state, stream); } finally { stream.Close(); } }
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); } }
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; }
public static void SaveSnapshotFile(PrintingStateSnapshot state, Stream fileStream) { SnapshotContainer container = new SnapshotContainer(); container.type = SnapshotTypeStateAndRemainingGCode; container.version = ContainerVersion; container.snapshot = state; Serialize(container, fileStream); }
public static void Add(PrintingStateSnapshot snapshot, string name) { PendingPrintJob job = new PendingPrintJob(snapshot, PendingJobsDir + Path.DirectorySeparatorChar + name + "." + RepetierExtension); job.Save(); }
public static PrintingStateSnapshot TakeSnapshot(PrinterConnection conn) { return(PrintingStateSnapshot.GeneratePrintingStateSnapshot(conn)); }