Extract loaded GCodeFile from widget to model
This commit is contained in:
parent
3dd9f8c4d7
commit
847c088cce
4 changed files with 155 additions and 133 deletions
|
|
@ -53,6 +53,7 @@ namespace MatterHackers.MatterControl
|
|||
using Agg.Image;
|
||||
using CustomWidgets;
|
||||
using MatterHackers.DataConverters3D;
|
||||
using MatterHackers.GCodeVisualizer;
|
||||
using MatterHackers.MatterControl.ConfigurationPage.PrintLeveling;
|
||||
using MatterHackers.MatterControl.Library;
|
||||
using MatterHackers.MatterControl.PartPreviewWindow;
|
||||
|
|
@ -61,6 +62,110 @@ namespace MatterHackers.MatterControl
|
|||
using PrintHistory;
|
||||
using SettingsManagement;
|
||||
|
||||
public class ApplicationConfig
|
||||
{
|
||||
public View3DConfig View3D { get; } = new View3DConfig();
|
||||
}
|
||||
|
||||
public class BedConfig
|
||||
{
|
||||
public GCodeFile LoadedGCode { get; set; }
|
||||
}
|
||||
|
||||
public class PrinterConfig
|
||||
{
|
||||
public BedConfig BedPlate { get; } = new BedConfig();
|
||||
}
|
||||
|
||||
public class View3DConfig
|
||||
{
|
||||
public bool RenderGrid
|
||||
{
|
||||
get
|
||||
{
|
||||
string value = UserSettings.Instance.get("GcodeViewerRenderGrid");
|
||||
if (value == null)
|
||||
{
|
||||
RenderGrid = true;
|
||||
return true;
|
||||
}
|
||||
return (value == "True");
|
||||
}
|
||||
set
|
||||
{
|
||||
UserSettings.Instance.set("GcodeViewerRenderGrid", value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public bool RenderMoves
|
||||
{
|
||||
get { return (UserSettings.Instance.get("GcodeViewerRenderMoves") == "True"); }
|
||||
set
|
||||
{
|
||||
UserSettings.Instance.set("GcodeViewerRenderMoves", value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public bool RenderRetractions
|
||||
{
|
||||
get { return (UserSettings.Instance.get("GcodeViewerRenderRetractions") == "True"); }
|
||||
set
|
||||
{
|
||||
UserSettings.Instance.set("GcodeViewerRenderRetractions", value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public bool RenderSpeeds
|
||||
{
|
||||
get { return (UserSettings.Instance.get("GcodeViewerRenderSpeeds") == "True"); }
|
||||
set
|
||||
{
|
||||
UserSettings.Instance.set("GcodeViewerRenderSpeeds", value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public bool SimulateExtrusion
|
||||
{
|
||||
get { return (UserSettings.Instance.get("GcodeViewerSimulateExtrusion") == "True"); }
|
||||
set
|
||||
{
|
||||
UserSettings.Instance.set("GcodeViewerSimulateExtrusion", value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public bool TransparentExtrusion
|
||||
{
|
||||
get { return (UserSettings.Instance.get("GcodeViewerTransparentExtrusion") == "True"); }
|
||||
set
|
||||
{
|
||||
UserSettings.Instance.set("GcodeViewerTransparentExtrusion", value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public bool HideExtruderOffsets
|
||||
{
|
||||
get
|
||||
{
|
||||
string value = UserSettings.Instance.get("GcodeViewerHideExtruderOffsets");
|
||||
if (value == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return (value == "True");
|
||||
}
|
||||
set
|
||||
{
|
||||
UserSettings.Instance.set("GcodeViewerHideExtruderOffsets", value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public bool SyncToPrint
|
||||
{
|
||||
get => UserSettings.Instance.get("GcodeViewerHideExtruderOffsets") == "True";
|
||||
set => UserSettings.Instance.set("LayerViewSyncToPrint", value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public class ApplicationController
|
||||
{
|
||||
internal void ClearPlate()
|
||||
|
|
@ -79,100 +184,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
public ThemeConfig Theme { get; set; } = new ThemeConfig();
|
||||
|
||||
public class View3DConfig
|
||||
{
|
||||
public bool RenderGrid
|
||||
{
|
||||
get
|
||||
{
|
||||
string value = UserSettings.Instance.get("GcodeViewerRenderGrid");
|
||||
if (value == null)
|
||||
{
|
||||
RenderGrid = true;
|
||||
return true;
|
||||
}
|
||||
return (value == "True");
|
||||
}
|
||||
set
|
||||
{
|
||||
UserSettings.Instance.set("GcodeViewerRenderGrid", value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public bool RenderMoves
|
||||
{
|
||||
get { return (UserSettings.Instance.get("GcodeViewerRenderMoves") == "True"); }
|
||||
set
|
||||
{
|
||||
UserSettings.Instance.set("GcodeViewerRenderMoves", value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public bool RenderRetractions
|
||||
{
|
||||
get { return (UserSettings.Instance.get("GcodeViewerRenderRetractions") == "True"); }
|
||||
set
|
||||
{
|
||||
UserSettings.Instance.set("GcodeViewerRenderRetractions", value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public bool RenderSpeeds
|
||||
{
|
||||
get { return (UserSettings.Instance.get("GcodeViewerRenderSpeeds") == "True"); }
|
||||
set
|
||||
{
|
||||
UserSettings.Instance.set("GcodeViewerRenderSpeeds", value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public bool SimulateExtrusion
|
||||
{
|
||||
get { return (UserSettings.Instance.get("GcodeViewerSimulateExtrusion") == "True"); }
|
||||
set
|
||||
{
|
||||
UserSettings.Instance.set("GcodeViewerSimulateExtrusion", value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public bool TransparentExtrusion
|
||||
{
|
||||
get { return (UserSettings.Instance.get("GcodeViewerTransparentExtrusion") == "True"); }
|
||||
set
|
||||
{
|
||||
UserSettings.Instance.set("GcodeViewerTransparentExtrusion", value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public bool HideExtruderOffsets
|
||||
{
|
||||
get
|
||||
{
|
||||
string value = UserSettings.Instance.get("GcodeViewerHideExtruderOffsets");
|
||||
if (value == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return (value == "True");
|
||||
}
|
||||
set
|
||||
{
|
||||
UserSettings.Instance.set("GcodeViewerHideExtruderOffsets", value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public bool SyncToPrint
|
||||
{
|
||||
get => UserSettings.Instance.get("GcodeViewerHideExtruderOffsets") == "True";
|
||||
set => UserSettings.Instance.set("LayerViewSyncToPrint", value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public class ApplicationConfig
|
||||
{
|
||||
public View3DConfig View3D { get; } = new View3DConfig();
|
||||
}
|
||||
|
||||
public PrinterConfig Printer { get; } = new PrinterConfig();
|
||||
|
||||
public ApplicationConfig Options { get; } = new ApplicationConfig();
|
||||
|
||||
|
|
|
|||
|
|
@ -36,12 +36,16 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
private TextWidget layerCountTextWidget;
|
||||
private ViewGcodeWidget gcodeViewWidget;
|
||||
|
||||
|
||||
private PrinterConfig printer;
|
||||
|
||||
public LayerNavigationWidget(ViewGcodeWidget gcodeViewWidget, TextImageButtonFactory buttonFactory)
|
||||
: base(FlowDirection.LeftToRight)
|
||||
{
|
||||
this.gcodeViewWidget = gcodeViewWidget;
|
||||
|
||||
printer = ApplicationController.Instance.Printer;
|
||||
|
||||
var prevLayerButton = buttonFactory.Generate("<<");
|
||||
prevLayerButton.Click += (s, e) =>
|
||||
{
|
||||
|
|
@ -69,9 +73,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
public override void OnDraw(Graphics2D graphics2D)
|
||||
{
|
||||
if (gcodeViewWidget.LoadedGCode != null)
|
||||
if (printer.BedPlate.LoadedGCode != null)
|
||||
{
|
||||
layerCountTextWidget.Text = string.Format("{0} / {1}", gcodeViewWidget.ActiveLayerIndex + 1, gcodeViewWidget.LoadedGCode.NumChangesInZ.ToString());
|
||||
layerCountTextWidget.Text = string.Format("{0} / {1}", gcodeViewWidget.ActiveLayerIndex + 1, printer.BedPlate.LoadedGCode.NumChangesInZ.ToString());
|
||||
}
|
||||
|
||||
base.OnDraw(graphics2D);
|
||||
|
|
|
|||
|
|
@ -85,13 +85,15 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
private PartViewMode activeViewMode = PartViewMode.Layers3D;
|
||||
|
||||
private View3DConfig options;
|
||||
|
||||
private ApplicationController.View3DConfig options;
|
||||
private PrinterConfig printer;
|
||||
|
||||
public ViewGcodeBasic(Vector3 viewerVolume, Vector2 bedCenter, BedShape bedShape, WindowMode windowMode, ViewControls3D viewControls3D, ThemeConfig theme)
|
||||
: base(viewControls3D)
|
||||
{
|
||||
this.options = ApplicationController.Instance.Options.View3D;
|
||||
options = ApplicationController.Instance.Options.View3D;
|
||||
printer = ApplicationController.Instance.Printer;
|
||||
|
||||
this.viewerVolume = viewerVolume;
|
||||
this.bedShape = bedShape;
|
||||
|
|
@ -113,12 +115,14 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
ApplicationController.Instance.AdvancedControlsPanelReloading.RegisterEvent((s, e) => gcodeViewWidget?.Clear3DGCode(), ref unregisterEvents);
|
||||
}
|
||||
|
||||
private GCodeFile loadedGCode => printer.BedPlate.LoadedGCode;
|
||||
|
||||
private void CheckSettingChanged(object sender, EventArgs e)
|
||||
{
|
||||
StringEventArgs stringEvent = e as StringEventArgs;
|
||||
if (stringEvent != null)
|
||||
{
|
||||
if (gcodeViewWidget?.LoadedGCode != null
|
||||
if (loadedGCode != null
|
||||
&& (
|
||||
stringEvent.Data == SettingsKey.filament_cost
|
||||
|| stringEvent.Data == SettingsKey.filament_diameter
|
||||
|
|
@ -396,7 +400,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
private void TrackballTumbleWidget_DrawGlContent(object sender, EventArgs e)
|
||||
{
|
||||
if (gcodeViewWidget?.LoadedGCode == null)
|
||||
if (loadedGCode == null || gcodeViewWidget.gCodeRenderer == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -404,7 +408,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
GCodeRenderer.ExtrusionColor = ActiveTheme.Instance.PrimaryAccentColor;
|
||||
|
||||
GCodeRenderInfo renderInfo = new GCodeRenderInfo(0,
|
||||
Math.Min(gcodeViewWidget.ActiveLayerIndex + 1, gcodeViewWidget.LoadedGCode.NumChangesInZ),
|
||||
Math.Min(gcodeViewWidget.ActiveLayerIndex + 1, loadedGCode.NumChangesInZ),
|
||||
gcodeViewWidget.TotalTransform,
|
||||
1,
|
||||
GetRenderType(),
|
||||
|
|
@ -450,9 +454,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
string timeRemainingText = "---";
|
||||
|
||||
if (gcodeViewWidget != null && gcodeViewWidget.LoadedGCode != null)
|
||||
if (gcodeViewWidget != null && loadedGCode != null)
|
||||
{
|
||||
int secondsRemaining = (int)gcodeViewWidget.LoadedGCode.Instruction(0).secondsToEndFromHere;
|
||||
int secondsRemaining = (int)loadedGCode.Instruction(0).secondsToEndFromHere;
|
||||
int hoursRemaining = (int)(secondsRemaining / (60 * 60));
|
||||
int minutesRemaining = (int)((secondsRemaining + 30) / 60 - hoursRemaining * 60); // +30 for rounding
|
||||
secondsRemaining = secondsRemaining % 60;
|
||||
|
|
@ -474,7 +478,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
// show the filament used
|
||||
modelInfoContainer.AddChild(new TextWidget("Filament Length".Localize() + ":", textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 9));
|
||||
{
|
||||
double filamentUsed = gcodeViewWidget.LoadedGCode.GetFilamentUsedMm(ActiveSliceSettings.Instance.GetValue<double>(SettingsKey.filament_diameter));
|
||||
double filamentUsed = loadedGCode.GetFilamentUsedMm(ActiveSliceSettings.Instance.GetValue<double>(SettingsKey.filament_diameter));
|
||||
|
||||
GuiWidget estimatedPrintTime = new TextWidget(string.Format("{0:0.0} mm", filamentUsed), pointSize: 14, textColor: ActiveTheme.Instance.PrimaryTextColor);
|
||||
estimatedPrintTime.Margin = new BorderDouble(0, 9, 0, 3);
|
||||
|
|
@ -483,7 +487,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
modelInfoContainer.AddChild(new TextWidget("Filament Volume".Localize() + ":", textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 9));
|
||||
{
|
||||
double filamentMm3 = gcodeViewWidget.LoadedGCode.GetFilamentCubicMm(ActiveSliceSettings.Instance.GetValue<double>(SettingsKey.filament_diameter));
|
||||
double filamentMm3 = loadedGCode.GetFilamentCubicMm(ActiveSliceSettings.Instance.GetValue<double>(SettingsKey.filament_diameter));
|
||||
|
||||
GuiWidget estimatedPrintTime = new TextWidget(string.Format("{0:0.00} cm³", filamentMm3 / 1000), pointSize: 14, textColor: ActiveTheme.Instance.PrimaryTextColor);
|
||||
estimatedPrintTime.Margin = new BorderDouble(0, 9, 0, 3);
|
||||
|
|
@ -506,7 +510,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
double filamentDiameter = ActiveSliceSettings.Instance.GetValue<double>(SettingsKey.filament_diameter);
|
||||
double filamentDensity = ActiveSliceSettings.Instance.GetValue<double>(SettingsKey.filament_density);
|
||||
|
||||
return gcodeViewWidget.LoadedGCode.GetFilamentWeightGrams(filamentDiameter, filamentDensity);
|
||||
return loadedGCode.GetFilamentWeightGrams(filamentDiameter, filamentDensity);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -864,7 +868,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
SetProcessingMessage("");
|
||||
if (gcodeViewWidget != null
|
||||
&& gcodeViewWidget.LoadedGCode == null)
|
||||
&& loadedGCode == null)
|
||||
{
|
||||
// If we have finished loading the gcode and the source file exists but we don't have any loaded gcode it is because the loader decided to not load it.
|
||||
if (File.Exists(printItem.FileLocation))
|
||||
|
|
@ -878,12 +882,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
}
|
||||
|
||||
if (gcodeViewWidget != null
|
||||
&& gcodeViewWidget.LoadedGCode != null
|
||||
&& gcodeViewWidget.LoadedGCode.LineCount > 0)
|
||||
&& loadedGCode?.LineCount > 0)
|
||||
{
|
||||
// TODO: Shouldn't we be clearing children from some known container and rebuilding?
|
||||
gradientWidget?.Close();
|
||||
gradientWidget = new ColorGradientWidget(gcodeViewWidget.LoadedGCode);
|
||||
gradientWidget = new ColorGradientWidget(loadedGCode);
|
||||
AddChild(gradientWidget);
|
||||
gradientWidget.Visible = false;
|
||||
|
||||
|
|
@ -903,7 +906,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
layerSelectionButtonsPanel.AddChild(navigationWidget);
|
||||
|
||||
selectLayerSlider?.Close();
|
||||
selectLayerSlider = new SolidSlider(new Vector2(), sliderWidth, 0, gcodeViewWidget.LoadedGCode.NumChangesInZ - 1, Orientation.Vertical);
|
||||
selectLayerSlider = new SolidSlider(new Vector2(), sliderWidth, 0, loadedGCode.NumChangesInZ - 1, Orientation.Vertical);
|
||||
selectLayerSlider.ValueChanged += new EventHandler(selectLayerSlider_ValueChanged);
|
||||
gcodeViewWidget.ActiveLayerChanged += new EventHandler(gcodeViewWidget_ActiveLayerChanged);
|
||||
AddChild(selectLayerSlider);
|
||||
|
|
|
|||
|
|
@ -88,11 +88,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
private Vector2 unscaledRenderOffset = new Vector2(0, 0);
|
||||
|
||||
public GCodeRenderer gCodeRenderer;
|
||||
public GCodeRenderer gCodeRenderer { get; private set; }
|
||||
|
||||
public event EventHandler ActiveLayerChanged;
|
||||
|
||||
public GCodeFile LoadedGCode { get; set; }
|
||||
private GCodeFile loadedGCode => printer.BedPlate.LoadedGCode;
|
||||
|
||||
public int ActiveLayerIndex
|
||||
{
|
||||
|
|
@ -111,9 +111,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
activeLayerIndex = 0;
|
||||
}
|
||||
else if (activeLayerIndex >= LoadedGCode.NumChangesInZ)
|
||||
else if (activeLayerIndex >= loadedGCode.NumChangesInZ)
|
||||
{
|
||||
activeLayerIndex = LoadedGCode.NumChangesInZ - 1;
|
||||
activeLayerIndex = loadedGCode.NumChangesInZ - 1;
|
||||
}
|
||||
Invalidate();
|
||||
|
||||
|
|
@ -124,10 +124,14 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
private ReportProgressRatio progressReporter;
|
||||
|
||||
private ApplicationController.View3DConfig options;
|
||||
private View3DConfig options;
|
||||
private PrinterConfig printer;
|
||||
|
||||
public ViewGcodeWidget(Vector2 gridSizeMm, Vector2 gridCenterMm, ReportProgressRatio progressReporter)
|
||||
{
|
||||
this.options = ApplicationController.Instance.Options.View3D;
|
||||
options = ApplicationController.Instance.Options.View3D;
|
||||
printer = ApplicationController.Instance.Printer;
|
||||
|
||||
this.progressReporter = progressReporter;
|
||||
this.gridSizeMm = gridSizeMm;
|
||||
this.gridCenterMm = gridCenterMm;
|
||||
|
|
@ -139,15 +143,15 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
private void SetInitalLayer()
|
||||
{
|
||||
activeLayerIndex = 0;
|
||||
if (LoadedGCode.LineCount > 0)
|
||||
if (loadedGCode.LineCount > 0)
|
||||
{
|
||||
int firstExtrusionIndex = 0;
|
||||
Vector3 lastPosition = LoadedGCode.Instruction(0).Position;
|
||||
double ePosition = LoadedGCode.Instruction(0).EPosition;
|
||||
Vector3 lastPosition = loadedGCode.Instruction(0).Position;
|
||||
double ePosition = loadedGCode.Instruction(0).EPosition;
|
||||
// let's find the first layer that has extrusion if possible and go to that
|
||||
for (int i = 1; i < LoadedGCode.LineCount; i++)
|
||||
for (int i = 1; i < loadedGCode.LineCount; i++)
|
||||
{
|
||||
PrinterMachineInstruction currentInstruction = LoadedGCode.Instruction(i);
|
||||
PrinterMachineInstruction currentInstruction = loadedGCode.Instruction(i);
|
||||
if (currentInstruction.EPosition > ePosition && lastPosition != currentInstruction.Position)
|
||||
{
|
||||
firstExtrusionIndex = i;
|
||||
|
|
@ -159,9 +163,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
if (firstExtrusionIndex > 0)
|
||||
{
|
||||
for (int layerIndex = 0; layerIndex < LoadedGCode.NumChangesInZ; layerIndex++)
|
||||
for (int layerIndex = 0; layerIndex < loadedGCode.NumChangesInZ; layerIndex++)
|
||||
{
|
||||
if (firstExtrusionIndex < LoadedGCode.GetInstructionIndexAtLayer(layerIndex))
|
||||
if (firstExtrusionIndex < loadedGCode.GetInstructionIndexAtLayer(layerIndex))
|
||||
{
|
||||
activeLayerIndex = Math.Max(0, layerIndex - 1);
|
||||
break;
|
||||
|
|
@ -185,7 +189,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
public override void OnDraw(Graphics2D graphics2D)
|
||||
{
|
||||
if (LoadedGCode != null)
|
||||
if (loadedGCode != null)
|
||||
{
|
||||
//using (new PerformanceTimer("GCode Timer", "Total"))
|
||||
{
|
||||
|
|
@ -444,10 +448,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
public async void LoadInBackground(string gcodePathAndFileName)
|
||||
{
|
||||
var loadedGCode = await GCodeFileLoaded.LoadInBackground(gcodePathAndFileName, this.progressReporter);
|
||||
this.LoadedGCode = loadedGCode;
|
||||
printer.BedPlate.LoadedGCode = await GCodeFileLoaded.LoadInBackground(gcodePathAndFileName, this.progressReporter);
|
||||
|
||||
if (this.LoadedGCode == null)
|
||||
if (loadedGCode == null)
|
||||
{
|
||||
this.AddChild(new TextWidget("Not a valid GCode file.".Localize())
|
||||
{
|
||||
|
|
@ -462,7 +465,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
CenterPartInView();
|
||||
}
|
||||
|
||||
gCodeRenderer = new GCodeRenderer(this.LoadedGCode);
|
||||
gCodeRenderer = new GCodeRenderer(loadedGCode);
|
||||
|
||||
if (ActiveSliceSettings.Instance.PrinterSelected)
|
||||
{
|
||||
|
|
@ -525,10 +528,10 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
public void CenterPartInView()
|
||||
{
|
||||
if (LoadedGCode != null)
|
||||
if (loadedGCode != null)
|
||||
{
|
||||
RectangleDouble partBounds = LoadedGCode.GetBounds();
|
||||
Vector2 weightedCenter = LoadedGCode.GetWeightedCenter();
|
||||
RectangleDouble partBounds = loadedGCode.GetBounds();
|
||||
Vector2 weightedCenter = loadedGCode.GetWeightedCenter();
|
||||
|
||||
unscaledRenderOffset = -weightedCenter;
|
||||
layerScale = Math.Min(Height / partBounds.Height, Width / partBounds.Width);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue