Made the gcode 3d view recreate the bed correctly
Made the printer separate position tracking from bed leveling re-write
This commit is contained in:
parent
9e623a2f4a
commit
4a481fb867
3 changed files with 37 additions and 6 deletions
|
|
@ -93,6 +93,26 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
this.printItem = printItem;
|
||||
|
||||
CreateAndAddChildren(null);
|
||||
|
||||
SliceSettingsWidget.PartPreviewSettingsChanged.RegisterEvent(RecreateBedAndPartPosition, ref unregisterEvents);
|
||||
ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent(RecreateBedAndPartPosition, ref unregisterEvents);
|
||||
}
|
||||
|
||||
void RecreateBedAndPartPosition(object sender, EventArgs e)
|
||||
{
|
||||
viewerVolume = new Vector3(ActiveSliceSettings.Instance.BedSize, ActiveSliceSettings.Instance.BuildHeight);
|
||||
bedShape = ActiveSliceSettings.Instance.BedShape;
|
||||
bedCenter = ActiveSliceSettings.Instance.BedCenter;
|
||||
|
||||
double buildHeight = ActiveSliceSettings.Instance.BuildHeight;
|
||||
|
||||
UiThread.RunOnIdle((state) =>
|
||||
{
|
||||
meshViewerWidget.CreatePrintBed(
|
||||
viewerVolume,
|
||||
bedCenter,
|
||||
bedShape);
|
||||
});
|
||||
}
|
||||
|
||||
void CreateAndAddChildren(object state)
|
||||
|
|
|
|||
|
|
@ -819,6 +819,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
string lineToWrite = LinesToWriteQueue[0];
|
||||
|
||||
lineToWrite = KeepTrackOfPostionAndDestination(lineToWrite);
|
||||
lineToWrite = RunPrintLevelingTranslations(lineToWrite);
|
||||
|
||||
LinesToWriteQueue.RemoveAt(0); // remove the line first (in case we inject another command)
|
||||
WriteToPrinter(lineToWrite + "\r\n", lineToWrite);
|
||||
|
|
@ -1501,13 +1502,19 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
currentDestination = newDestination;
|
||||
DestinationChanged.CallEvents(this, null);
|
||||
}
|
||||
}
|
||||
|
||||
if (ActivePrinter.DoPrintLeveling)
|
||||
return lineBeingSent;
|
||||
}
|
||||
|
||||
string RunPrintLevelingTranslations(string lineBeingSent)
|
||||
{
|
||||
if (ActivePrinter.DoPrintLeveling
|
||||
&& lineBeingSent.StartsWith("G0 ") || lineBeingSent.StartsWith("G1 "))
|
||||
{
|
||||
string inputLine = lineBeingSent;
|
||||
lineBeingSent = PrintLevelingPlane.Instance.ApplyLeveling(currentDestination, movementMode, inputLine);
|
||||
}
|
||||
}
|
||||
|
||||
PrintLevelingData levelingData = PrintLevelingData.GetForPrinter(ActivePrinterProfile.Instance.ActivePrinter);
|
||||
if (levelingData != null)
|
||||
|
|
@ -1677,6 +1684,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
lineToWrite = ApplyExtrusionMultiplier(lineToWrite);
|
||||
lineToWrite = ApplyFeedRateMultiplier(lineToWrite);
|
||||
lineToWrite = KeepTrackOfPostionAndDestination(lineToWrite);
|
||||
lineToWrite = RunPrintLevelingTranslations(lineToWrite);
|
||||
|
||||
string lineWithCount = "N" + (allCheckSumLinesSent.Count + 1).ToString() + " " + lineToWrite;
|
||||
string lineWithChecksum = lineWithCount + "*" + GCodeFile.CalculateChecksum(lineWithCount);
|
||||
|
|
|
|||
|
|
@ -2546,3 +2546,6 @@ Translated:Speeds
|
|||
|
||||
English:Extrusion
|
||||
Translated:Extrusion
|
||||
English:Clear
|
||||
Translated:Clear
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue