Clear bed should invalidate GCode render data

- Disable 'File Not Found' messages on empty LoadedGCode
- Issue MatterHackers/MCCentral#2088
Clear bed should invalidate GCode render data
This commit is contained in:
John Lewin 2017-10-17 12:55:58 -07:00
parent f47bfcbc63
commit 9edde00fcf
3 changed files with 24 additions and 8 deletions

View file

@ -103,6 +103,10 @@ namespace MatterHackers.MatterControl
string mcxPath = Path.Combine(ApplicationDataStorage.Instance.PlatingDirectory, now + ".mcx");
// Clear existing
this.LoadedGCode = null;
this.GCodeRenderer = null;
this.printItem = new PrintItemWrapper(new PrintItem(now, mcxPath));
File.WriteAllText(mcxPath, new Object3D().ToJson());

View file

@ -261,6 +261,18 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
private void BedPlate_LoadedGCodeChanged(object sender, EventArgs e)
{
bool gcodeLoaded = sceneContext.LoadedGCode != null;
layerCountText.Visible = gcodeLoaded;
layerStartText.Visible = gcodeLoaded;
selectLayerSlider.Visible = gcodeLoaded;
layerRenderRatioSlider.Visible = gcodeLoaded;
if (!gcodeLoaded)
{
return;
}
var layerCount = sceneContext.LoadedGCode.LayerCount;
selectLayerSlider.Maximum = layerCount - 1;

View file

@ -98,10 +98,10 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
VAnchor = VAnchor.Stretch
};
if (!File.Exists(sceneContext.GCodePath))
{
SetProcessingMessage($"{fileNotFoundMessage}\n'{sceneContext.GCodePath}'");
}
//if (!File.Exists(sceneContext.GCodePath))
//{
// SetProcessingMessage($"{fileNotFoundMessage}\n'{sceneContext.GCodePath}'");
//}
mainContainerTopToBottom.AddChild(gcodeDisplayWidget);
@ -109,10 +109,10 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
// *************** AddGCodeFileControls ***************
SetProcessingMessage("");
if (sceneContext.LoadedGCode == null)
{
SetProcessingMessage($"{fileNotFoundMessage}\n'{sceneContext.GCodePath}'");
}
//if (sceneContext.LoadedGCode == null)
//{
// SetProcessingMessage($"{fileNotFoundMessage}\n'{sceneContext.GCodePath}'");
//}
if (sceneContext.LoadedGCode?.LineCount > 0)
{