Made the library actually copy gcode to the library folder
Working on adding support for reporting errors when enabled Made PrintActiveItem check for error conditions.
This commit is contained in:
parent
e00d12959b
commit
6d7b0280bb
3 changed files with 83 additions and 46 deletions
|
|
@ -299,6 +299,13 @@ namespace MatterHackers.MatterControl
|
|||
showWindow = true;
|
||||
}
|
||||
|
||||
public enum ReportSeverity2 { Warning, Error }
|
||||
|
||||
public void ReportException(Exception e, string key, string value, ReportSeverity2 warningLevel = ReportSeverity2.Warning)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
private event EventHandler unregisterEvent;
|
||||
|
||||
public static MatterControlApplication Instance
|
||||
|
|
|
|||
|
|
@ -373,8 +373,25 @@ namespace MatterHackers.MatterControl.PrintLibrary
|
|||
else // it is not a mesh so just add it
|
||||
{
|
||||
PrintItemWrapper printItemWrapper = new PrintItemWrapper(printItem);
|
||||
if (false)
|
||||
{
|
||||
LibraryData.Instance.AddItem(printItemWrapper);
|
||||
}
|
||||
else // save a copy to the library and update this to point at it
|
||||
{
|
||||
string sourceFileName = printItem.FileLocation;
|
||||
string newFileName = Path.ChangeExtension(Path.GetRandomFileName(), Path.GetExtension(printItem.FileLocation));
|
||||
string destFileName = Path.Combine(ApplicationDataStorage.Instance.ApplicationLibraryDataPath, newFileName);
|
||||
|
||||
File.Copy(sourceFileName, destFileName, true);
|
||||
|
||||
printItemWrapper.FileLocation = destFileName;
|
||||
printItemWrapper.PrintItem.Commit();
|
||||
|
||||
// let the queue know that the item has changed so it load the correct part
|
||||
LibraryData.Instance.AddItem(printItemWrapper);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void loadFilesIntoLibraryBackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ using System.Diagnostics;
|
|||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
|
||||
|
|
@ -1235,9 +1236,12 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
}
|
||||
|
||||
public void PrintActivePart()
|
||||
{
|
||||
try
|
||||
{
|
||||
PrintLevelingData levelingData = PrintLevelingData.GetForPrinter(ActivePrinterProfile.Instance.ActivePrinter);
|
||||
if (levelingData.needsPrintLeveling
|
||||
if (levelingData != null
|
||||
&& levelingData.needsPrintLeveling
|
||||
&& levelingData.sampledPosition0.z == 0
|
||||
&& levelingData.sampledPosition1.z == 0
|
||||
&& levelingData.sampledPosition2.z == 0)
|
||||
|
|
@ -1246,6 +1250,8 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
return;
|
||||
}
|
||||
|
||||
if (PrinterConnectionAndCommunication.Instance.ActivePrintItem != null)
|
||||
{
|
||||
string pathAndFile = PrinterConnectionAndCommunication.Instance.ActivePrintItem.FileLocation;
|
||||
if (ActiveSliceSettings.Instance.HasSdCardReader()
|
||||
&& pathAndFile == QueueData.SdCardFileName)
|
||||
|
|
@ -1295,6 +1301,13 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// Let's track this issue if possible.
|
||||
MatterControlApplication.Instance.ReportException(e, this.GetType().Name, MethodBase.GetCurrentMethod().Name);
|
||||
}
|
||||
}
|
||||
|
||||
public void PrintActivePartIfPossible()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue