Get first ActivePrintItem test passing again

- CompletingPrintTurnsoffHeat now passing
- Create new 'Add to Plate' action for library selections
- Create zip files after print->slice->ActivePrintItem success
- Copy generated gcode into zip
- Copy SliceSettings into zip
  - Make DocumentPath on PrinterSettings public
- Copy printer plate to zip file
- Add ClearPlate helper function to ApplicationController
- Invoke ClearPlate on startup to initialize ActivePrintItem
- Make SliceSettings user mode resets SliceSettings not AdvControls
- Make Library Overflow menu and items automatable
This commit is contained in:
John Lewin 2017-06-02 17:04:02 -07:00
parent 55e217641a
commit fa800c4a3b
10 changed files with 128 additions and 30 deletions

View file

@ -50,6 +50,7 @@ using System.Linq;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using System.IO.Compression;
namespace MatterHackers.MatterControl.PrinterCommunication
{
@ -2590,6 +2591,25 @@ namespace MatterHackers.MatterControl.PrinterCommunication
bool originalIsGCode = Path.GetExtension(partToPrint.FileLocation).ToUpper() == ".GCODE";
if (File.Exists(gcodePathAndFileName))
{
// Create archive point for printing attempt
if (Path.GetExtension(partToPrint.FileLocation).ToUpper() == ".MCX")
{
// TODO: We should zip mcx and settings when starting a print
string platingDirectory = Path.Combine(ApplicationDataStorage.Instance.ApplicationLibraryDataPath, "PrintHistory");
Directory.CreateDirectory(platingDirectory);
string now = DateTime.Now.ToString("yyyyMMdd-HHmmss");
string archivePath = Path.Combine(platingDirectory, now + ".zip");
using (var file = File.OpenWrite(archivePath))
using (var zip = new ZipArchive(file, ZipArchiveMode.Create))
{
zip.CreateEntryFromFile(partToPrint.FileLocation, "PrinterPlate.mcx");
zip.CreateEntryFromFile(ActiveSliceSettings.Instance.DocumentPath, ActiveSliceSettings.Instance.GetValue(SettingsKey.printer_name) + ".printer");
zip.CreateEntryFromFile(gcodePathAndFileName, "sliced.gcode");
}
}
// read the last few k of the file and see if it says "filament used". We use this marker to tell if the file finished writing
if (originalIsGCode)
{