Put in a warning for having a G29 or G30 in the start gcode and having print leveling turned on.

This commit is contained in:
Lars Brubaker 2016-02-04 09:50:00 -08:00
parent fe9f131d94
commit 933c90d1a4
2 changed files with 45 additions and 0 deletions

View file

@ -34,6 +34,7 @@ using MatterHackers.Localizations;
using MatterHackers.MatterControl.ConfigurationPage.PrintLeveling;
using MatterHackers.MatterControl.ContactForm;
using MatterHackers.MatterControl.DataStorage;
using MatterHackers.MatterControl.PrinterCommunication;
using MatterHackers.VectorMath;
using System;
using System.Collections.Generic;
@ -870,6 +871,32 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
return false;
}
// If we have print leveling turned on then make sure we don't have any leveling commands in the start gcode.
if (PrinterConnectionAndCommunication.Instance.ActivePrinter.DoPrintLeveling)
{
string[] startGCode = ActiveSliceSettings.Instance.GetActiveValue("start_gcode").Replace("\\n", "\n").Split('\n');
foreach (string startGCodeLine in startGCode)
{
if (startGCodeLine.StartsWith("G29"))
{
string error = "Start G-Code cannot contain G29 if Print Leveling is enabled.".Localize();
string details = "Your Start G-Code should not contain a G29 if you are planning on using print leveling. Change your start G-Code or turn off print leveling".Localize();
string location = "Location: 'Settings & Controls' -> 'Settings' -> 'Filament' -> 'Extrusion' -> 'First Layer'".Localize();
StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize());
return false;
}
if (startGCodeLine.StartsWith("G30"))
{
string error = "Start G-Code cannot contain G30 if Print Leveling is enabled.".Localize();
string details = "Your Start G-Code should not contain a G30 if you are planning on using print leveling. Change your start G-Code or turn off print leveling".Localize();
string location = "Location: 'Settings & Controls' -> 'Settings' -> 'Filament' -> 'Extrusion' -> 'First Layer'".Localize();
StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize());
return false;
}
}
}
if (FirstLayerExtrusionWidth > NozzleDiameter * 4)
{
string error = "First Layer Extrusion Width' must be less than or equal to the 'Nozzle Diameter' * 4.".Localize();