diff --git a/BrailleBuilder/BrailleBuilderMainWindow.cs b/BrailleBuilder/BrailleBuilderMainWindow.cs index b03ccfa59..566f4a485 100644 --- a/BrailleBuilder/BrailleBuilderMainWindow.cs +++ b/BrailleBuilder/BrailleBuilderMainWindow.cs @@ -44,11 +44,11 @@ namespace MatterHackers.MatterControl.Plugins.BrailleBuilder BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; - double buildHeight = ActiveSliceSettings.Instance.BuildHeight(); + double buildHeight = ActiveSliceSettings.Instance.GetValue("build_height"); part3DView = new View3DBrailleBuilder( - new Vector3(ActiveSliceSettings.Instance.BedSize(), buildHeight), - ActiveSliceSettings.Instance.BedCenter(), + new Vector3(ActiveSliceSettings.Instance.GetValue("bed_size"), buildHeight), + ActiveSliceSettings.Instance.GetValue("print_center"), ActiveSliceSettings.Instance.BedShape()); #if __ANDROID__ diff --git a/ConfigurationPage/PrintLeveling/LevelWizard13PointRadial.cs b/ConfigurationPage/PrintLeveling/LevelWizard13PointRadial.cs index b7f323096..45e43abfa 100644 --- a/ConfigurationPage/PrintLeveling/LevelWizard13PointRadial.cs +++ b/ConfigurationPage/PrintLeveling/LevelWizard13PointRadial.cs @@ -57,7 +57,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling && lineBeingSent.Length > 2 && lineBeingSent[2] == ' ') { - return GetLevelingFunctions(numberOfRadialSamples, settings.GetPrintLevelingData(), ActiveSliceSettings.Instance.BedCenter()) + return GetLevelingFunctions(numberOfRadialSamples, settings.GetPrintLevelingData(), ActiveSliceSettings.Instance.GetValue("print_center")) .DoApplyLeveling(lineBeingSent, currentDestination, movementMode); } @@ -67,7 +67,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling public override Vector2 GetPrintLevelPositionToSample(int index, double radius) { PrintLevelingData levelingData = ActiveSliceSettings.Instance.GetPrintLevelingData(); - return GetLevelingFunctions(numberOfRadialSamples, levelingData, ActiveSliceSettings.Instance.BedCenter()) + return GetLevelingFunctions(numberOfRadialSamples, levelingData, ActiveSliceSettings.Instance.GetValue("print_center")) .GetPrintLevelPositionToSample(index, radius); } diff --git a/ConfigurationPage/PrintLeveling/LevelWizard7PointRadial.cs b/ConfigurationPage/PrintLeveling/LevelWizard7PointRadial.cs index e73a3bedf..ce3e60a91 100644 --- a/ConfigurationPage/PrintLeveling/LevelWizard7PointRadial.cs +++ b/ConfigurationPage/PrintLeveling/LevelWizard7PointRadial.cs @@ -77,7 +77,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling public Vector2 GetPrintLevelPositionToSample(int index, double radius) { - Vector2 bedCenter = ActiveSliceSettings.Instance.BedCenter(); + Vector2 bedCenter = ActiveSliceSettings.Instance.GetValue("print_center"); if (index < NumberOfRadialSamples) { Vector2 position = new Vector2(radius, 0); @@ -212,7 +212,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling string medPrecisionLabel = "Medium Precision".Localize(); string highPrecisionLabel = "High Precision".Localize(); - double bedRadius = Math.Min(ActiveSliceSettings.Instance.BedSize().x, ActiveSliceSettings.Instance.BedSize().y) / 2; + double bedRadius = Math.Min(ActiveSliceSettings.Instance.GetValue("bed_size").x, ActiveSliceSettings.Instance.GetValue("bed_size").y) / 2; double startProbeHeight = 5; for (int i = 0; i < numberOfRadialSamples + 1; i++) @@ -267,7 +267,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling && lineBeingSent[2] == ' ') { PrintLevelingData levelingData = ActiveSliceSettings.Instance.GetPrintLevelingData(); - return GetLevelingFunctions(numberOfRadialSamples, levelingData, ActiveSliceSettings.Instance.BedCenter()) + return GetLevelingFunctions(numberOfRadialSamples, levelingData, ActiveSliceSettings.Instance.GetValue("print_center")) .DoApplyLeveling(lineBeingSent, currentDestination, movementMode); } @@ -277,7 +277,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling public override Vector2 GetPrintLevelPositionToSample(int index, double radius) { PrintLevelingData levelingData = ActiveSliceSettings.Instance.GetPrintLevelingData(); - return GetLevelingFunctions(numberOfRadialSamples, levelingData, ActiveSliceSettings.Instance.BedCenter()) + return GetLevelingFunctions(numberOfRadialSamples, levelingData, ActiveSliceSettings.Instance.GetValue("print_center")) .GetPrintLevelPositionToSample(index, radius); } diff --git a/ConfigurationPage/PrintLeveling/LevelWizardBase.cs b/ConfigurationPage/PrintLeveling/LevelWizardBase.cs index 44d6d8cd9..03c8dc254 100644 --- a/ConfigurationPage/PrintLeveling/LevelWizardBase.cs +++ b/ConfigurationPage/PrintLeveling/LevelWizardBase.cs @@ -79,8 +79,8 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling public static Vector2 GetPrintLevelPositionToSample(int index) { - Vector2 bedSize = ActiveSliceSettings.Instance.BedSize(); - Vector2 printCenter = ActiveSliceSettings.Instance.PrintCenter(); + Vector2 bedSize = ActiveSliceSettings.Instance.GetValue("bed_size"); + Vector2 printCenter = ActiveSliceSettings.Instance.GetValue("print_center"); switch (ActiveSliceSettings.Instance.BedShape()) { diff --git a/ConfigurationPage/PrintLeveling/PrintLevelPages.cs b/ConfigurationPage/PrintLeveling/PrintLevelPages.cs index d816f37d6..edbab5e8c 100644 --- a/ConfigurationPage/PrintLeveling/PrintLevelPages.cs +++ b/ConfigurationPage/PrintLeveling/PrintLevelPages.cs @@ -63,7 +63,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling public override void PageIsBecomingActive() { - Vector3 paperWidth = new Vector3(0, 0, ActiveSliceSettings.Instance.ProbePaperWidth()); + Vector3 paperWidth = new Vector3(0, 0, ActiveSliceSettings.Instance.GetValue("manual_probe_paper_width")); PrintLevelingData levelingData = ActiveSliceSettings.Instance.GetPrintLevelingData(); levelingData.SampledPosition0 = probePositions[0].position - paperWidth; @@ -93,7 +93,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling { PrintLevelingData levelingData = ActiveSliceSettings.Instance.GetPrintLevelingData(); levelingData.SampledPositions.Clear(); - Vector3 paperWidth = new Vector3(0, 0, ActiveSliceSettings.Instance.ProbePaperWidth()); + Vector3 paperWidth = new Vector3(0, 0, ActiveSliceSettings.Instance.GetValue("manual_probe_paper_width")); for (int i = 0; i < probePositions.Length; i++) { levelingData.SampledPositions.Add(probePositions[i].position - paperWidth); @@ -193,7 +193,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling // auto back probe Vector3 probeOffset2 = probePositions[4].position; - Vector3 paperWidth = new Vector3(0, 0, ActiveSliceSettings.Instance.ProbePaperWidth()); + Vector3 paperWidth = new Vector3(0, 0, ActiveSliceSettings.Instance.GetValue("manual_probe_paper_width")); PrintLevelingData levelingData = ActiveSliceSettings.Instance.GetPrintLevelingData(); levelingData.SampledPosition0 = userBedSample0 - paperWidth; diff --git a/PartPreviewWindow/BaseClasses/PartPreview3DWidget.cs b/PartPreviewWindow/BaseClasses/PartPreview3DWidget.cs index 2c9a5f98f..2fb9750bb 100644 --- a/PartPreviewWindow/BaseClasses/PartPreview3DWidget.cs +++ b/PartPreviewWindow/BaseClasses/PartPreview3DWidget.cs @@ -90,13 +90,13 @@ namespace MatterHackers.MatterControl.PartPreviewWindow private void RecreateBed() { - double buildHeight = ActiveSliceSettings.Instance.BuildHeight(); + double buildHeight = ActiveSliceSettings.Instance.GetValue("build_height"); UiThread.RunOnIdle((Action)(() => { meshViewerWidget.CreatePrintBed( - new Vector3(ActiveSliceSettings.Instance.BedSize(), buildHeight), - ActiveSliceSettings.Instance.BedCenter(), + new Vector3(ActiveSliceSettings.Instance.GetValue("bed_size"), buildHeight), + ActiveSliceSettings.Instance.GetValue("print_center"), ActiveSliceSettings.Instance.BedShape()); PutOemImageOnBed(); })); diff --git a/PartPreviewWindow/PartPreviewContent.cs b/PartPreviewWindow/PartPreviewContent.cs index e90c6d114..f8c049091 100644 --- a/PartPreviewWindow/PartPreviewContent.cs +++ b/PartPreviewWindow/PartPreviewContent.cs @@ -95,12 +95,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow selectedTabColor = ActiveTheme.Instance.SecondaryAccentColor; } - double buildHeight = ActiveSliceSettings.Instance.BuildHeight(); + double buildHeight = ActiveSliceSettings.Instance.GetValue("build_height"); // put in the 3D view partPreviewView = new View3DWidget(printItem, - new Vector3(ActiveSliceSettings.Instance.BedSize(), buildHeight), - ActiveSliceSettings.Instance.BedCenter(), + new Vector3(ActiveSliceSettings.Instance.GetValue("bed_size"), buildHeight), + ActiveSliceSettings.Instance.GetValue("print_center"), ActiveSliceSettings.Instance.BedShape(), windowMode, autoRotate3DView, @@ -116,8 +116,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow } viewGcodeBasic = new ViewGcodeBasic(printItem, - new Vector3(ActiveSliceSettings.Instance.BedSize(), buildHeight), - ActiveSliceSettings.Instance.BedCenter(), + new Vector3(ActiveSliceSettings.Instance.GetValue("bed_size"), buildHeight), + ActiveSliceSettings.Instance.GetValue("print_center"), ActiveSliceSettings.Instance.BedShape(), gcodeWindowMode); if (windowMode == View3DWidget.WindowMode.StandAlone) diff --git a/PartPreviewWindow/View3D/View3DAutoArange.cs b/PartPreviewWindow/View3D/View3DAutoArange.cs index 61a3f75c5..289ffa0a1 100644 --- a/PartPreviewWindow/View3D/View3DAutoArange.cs +++ b/PartPreviewWindow/View3D/View3DAutoArange.cs @@ -101,7 +101,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow // offset them to the center of the bed for (int i = 0; i < asyncMeshGroups.Count; i++) { - asyncMeshGroupTransforms[i] *= Matrix4X4.CreateTranslation(new Vector3(ActiveSliceSettings.Instance.BedCenter(), 0)); + asyncMeshGroupTransforms[i] *= Matrix4X4.CreateTranslation(new Vector3(ActiveSliceSettings.Instance.GetValue("print_center"), 0)); } PartHasBeenChanged(); diff --git a/PartPreviewWindow/View3D/View3DWidget.cs b/PartPreviewWindow/View3D/View3DWidget.cs index ccb407f16..92c5346dc 100644 --- a/PartPreviewWindow/View3D/View3DWidget.cs +++ b/PartPreviewWindow/View3D/View3DWidget.cs @@ -1324,7 +1324,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow if (ActiveSliceSettings.Instance?.GetValue("center_part_on_bed") == true) { doCentering = MeshViewerWidget.CenterPartAfterLoad.DO; - bedCenter = ActiveSliceSettings.Instance.BedCenter(); + bedCenter = ActiveSliceSettings.Instance.GetValue("print_center"); } meshViewerWidget.LoadMesh(printItemWrapper.FileLocation, doCentering, bedCenter); @@ -2110,8 +2110,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow { AxisAlignedBoundingBox allBounds = MeshViewerWidget.GetAxisAlignedBoundingBox(MeshGroups); bool onBed = allBounds.minXYZ.z > -.001 && allBounds.minXYZ.z < .001; // really close to the bed - RectangleDouble bedRect = new RectangleDouble(0, 0, ActiveSliceSettings.Instance.BedSize().x, ActiveSliceSettings.Instance.BedSize().y); - bedRect.Offset(ActiveSliceSettings.Instance.BedCenter() - ActiveSliceSettings.Instance.BedSize() / 2); + RectangleDouble bedRect = new RectangleDouble(0, 0, ActiveSliceSettings.Instance.GetValue("bed_size").x, ActiveSliceSettings.Instance.GetValue("bed_size").y); + bedRect.Offset(ActiveSliceSettings.Instance.GetValue("print_center") - ActiveSliceSettings.Instance.GetValue("bed_size") / 2); bool inBounds = bedRect.Contains(new Vector2(allBounds.minXYZ)) && bedRect.Contains(new Vector2(allBounds.maxXYZ)); diff --git a/PartPreviewWindow/ViewGcodeBasic.cs b/PartPreviewWindow/ViewGcodeBasic.cs index 192980f27..6e505c971 100644 --- a/PartPreviewWindow/ViewGcodeBasic.cs +++ b/PartPreviewWindow/ViewGcodeBasic.cs @@ -126,11 +126,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow || stringEvent.Data == "bed_shape" || stringEvent.Data == "center_part_on_bed") { - viewerVolume = new Vector3(ActiveSliceSettings.Instance.BedSize(), ActiveSliceSettings.Instance.BuildHeight()); + viewerVolume = new Vector3(ActiveSliceSettings.Instance.GetValue("bed_size"), ActiveSliceSettings.Instance.GetValue("build_height")); bedShape = ActiveSliceSettings.Instance.BedShape(); - bedCenter = ActiveSliceSettings.Instance.BedCenter(); + bedCenter = ActiveSliceSettings.Instance.GetValue("print_center"); - double buildHeight = ActiveSliceSettings.Instance.BuildHeight(); + double buildHeight = ActiveSliceSettings.Instance.GetValue("build_height"); UiThread.RunOnIdle(() => { @@ -474,7 +474,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow // show the filament used modelInfoContainer.AddChild(new TextWidget(filamentLengthLabelFull, textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 9)); { - double filamentUsed = gcodeViewWidget.LoadedGCode.GetFilamentUsedMm(ActiveSliceSettings.Instance.FilamentDiameter()); + double filamentUsed = gcodeViewWidget.LoadedGCode.GetFilamentUsedMm(ActiveSliceSettings.Instance.GetValue("filament_diameter")); GuiWidget estimatedPrintTime = new TextWidget(string.Format("{0:0.0} mm", filamentUsed), pointSize: 14, textColor: ActiveTheme.Instance.PrimaryTextColor); //estimatedPrintTime.HAnchor = Agg.UI.HAnchor.ParentLeft; @@ -486,7 +486,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow string filamentVolumeLabelFull = string.Format("{0}:", filamentVolumeLabel); modelInfoContainer.AddChild(new TextWidget(filamentVolumeLabelFull, textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 9)); { - double filamentMm3 = gcodeViewWidget.LoadedGCode.GetFilamentCubicMm(ActiveSliceSettings.Instance.FilamentDiameter()); + double filamentMm3 = gcodeViewWidget.LoadedGCode.GetFilamentCubicMm(ActiveSliceSettings.Instance.GetValue("filament_diameter")); GuiWidget estimatedPrintTime = new TextWidget(string.Format("{0:0.00} cm3", filamentMm3 / 1000), pointSize: 14, textColor: ActiveTheme.Instance.PrimaryTextColor); //estimatedPrintTime.HAnchor = Agg.UI.HAnchor.ParentLeft; @@ -509,7 +509,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow density = 1.24; } - double filamentWeightGrams = gcodeViewWidget.LoadedGCode.GetFilamentWeightGrams(ActiveSliceSettings.Instance.FilamentDiameter(), density); + double filamentWeightGrams = gcodeViewWidget.LoadedGCode.GetFilamentWeightGrams(ActiveSliceSettings.Instance.GetValue("filament_diameter"), density); GuiWidget estimatedPrintTime = new TextWidget(string.Format("{0:0.00} g", filamentWeightGrams), pointSize: 14, textColor: ActiveTheme.Instance.PrimaryTextColor); //estimatedPrintTime.HAnchor = Agg.UI.HAnchor.ParentLeft; diff --git a/PartPreviewWindow/ViewGcodeWidget.cs b/PartPreviewWindow/ViewGcodeWidget.cs index cf64aa4ce..3a5410327 100644 --- a/PartPreviewWindow/ViewGcodeWidget.cs +++ b/PartPreviewWindow/ViewGcodeWidget.cs @@ -301,7 +301,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow { try { - gCodeRenderer.GCodeFileToDraw?.GetFilamentUsedMm(ActiveSliceSettings.Instance.FilamentDiameter()); + gCodeRenderer.GCodeFileToDraw?.GetFilamentUsedMm(ActiveSliceSettings.Instance.GetValue("filament_diameter")); } catch (Exception e) { diff --git a/PrinterCommunication/Io/ResumePrintingStream.cs b/PrinterCommunication/Io/ResumePrintingStream.cs index 2e5a594a8..d35f0ffdb 100644 --- a/PrinterCommunication/Io/ResumePrintingStream.cs +++ b/PrinterCommunication/Io/ResumePrintingStream.cs @@ -41,6 +41,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io enum ResumeState { RemoveHeating, Raising, Homing, FindingResumeLayer, SkippingGCode, PrimingAndMovingToStart, PrintingSlow, PrintingToEnd } private GCodeFileStream internalStream; private double percentDone; + double resumeFeedRate; PrinterMove lastDestination; QueuedCommandsStream queuedCommands; @@ -51,6 +52,13 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io this.internalStream = internalStream; this.percentDone = percentDone; + resumeFeedRate = ActiveSliceSettings.Instance.GetValue("resume_first_layer_speed"); + if (resumeFeedRate == 0) + { + resumeFeedRate = 10; + } + resumeFeedRate *= 60; + queuedCommands = new QueuedCommandsStream(null); } @@ -110,7 +118,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io // home y queuedCommands.Add("G28 Y0"); // move to the place we can home z from - Vector2 resumePositionXy = ActiveSliceSettings.Instance.ActiveVector2("resume_position_before_z_home"); + Vector2 resumePositionXy = ActiveSliceSettings.Instance.GetValue("resume_position_before_z_home"); queuedCommands.Add("G1 X{0:0.000}Y{1:0.000}F{2}".FormatWith(resumePositionXy.x, resumePositionXy.y, MovementControls.XSpeed)); // home z queuedCommands.Add("G28 Z0"); @@ -165,7 +173,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io if (ActiveSliceSettings.Instance.GetValue("z_homes_to_max") == "0") // we are homed to the bed { // move to the height we can resume printing from - Vector2 resumePositionXy = ActiveSliceSettings.Instance.ActiveVector2("resume_position_before_z_home"); + Vector2 resumePositionXy = ActiveSliceSettings.Instance.GetValue("resume_position_before_z_home"); queuedCommands.Add(CreateMovementLine(new PrinterMove(new VectorMath.Vector3(resumePositionXy.x, resumePositionXy.y, lastDestination.position.z + 5), 0, MovementControls.ZSpeed))); // move just above the actual print position queuedCommands.Add(CreateMovementLine(new PrinterMove(lastDestination.position + new VectorMath.Vector3(0, 0, 5), 0, MovementControls.XSpeed))); @@ -188,25 +196,20 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io case ResumeState.PrintingSlow: { string lineToSend = internalStream.ReadLine(); - if (lineToSend != null - && lineToSend.StartsWith("; LAYER:")) + if (lineToSend == null) { - if (lineToSend != null - && LineIsMovement(lineToSend)) + return null; + } + + if (!lineToSend.StartsWith("; LAYER:")) + { + // have not seen the end of this layer so keep printing slow + if (LineIsMovement(lineToSend)) { PrinterMove currentMove = GetPosition(lineToSend, lastDestination); PrinterMove moveToSend = currentMove; - double feedRate; - - string firstLayerSpeed = ActiveSliceSettings.Instance.GetValue("resume_first_layer_speed"); - if (!double.TryParse(firstLayerSpeed, out feedRate)) - { - feedRate = 10; - } - feedRate *= 60; - - moveToSend.feedRate = feedRate; + moveToSend.feedRate = resumeFeedRate; lineToSend = CreateMovementLine(moveToSend, lastDestination); lastDestination = currentMove; @@ -217,6 +220,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io } } + // we only fall through to here after seeing the next "; Layer:" resumeState = ResumeState.PrintingToEnd; return ""; diff --git a/Queue/QueueDataWidget.cs b/Queue/QueueDataWidget.cs index ec722056d..faaec00df 100644 --- a/Queue/QueueDataWidget.cs +++ b/Queue/QueueDataWidget.cs @@ -211,7 +211,7 @@ namespace MatterHackers.MatterControl.PrintQueue if (ActiveSliceSettings.Instance != null) { activeFilamentDiameter = 3; - if (ActiveSliceSettings.Instance.FilamentDiameter() < 2) + if (ActiveSliceSettings.Instance.GetValue("filament_diameter") < 2) { activeFilamentDiameter = 1.75; } diff --git a/SlicerConfiguration/Settings/SettingsProfile.cs b/SlicerConfiguration/Settings/SettingsProfile.cs index 3236cf9d9..8570ac0b7 100644 --- a/SlicerConfiguration/Settings/SettingsProfile.cs +++ b/SlicerConfiguration/Settings/SettingsProfile.cs @@ -244,11 +244,6 @@ namespace MatterHackers.MatterControl.SlicerConfiguration return targetTemp; } - public int SupportExtruder() - { - return int.Parse(GetValue("support_material_extruder")); - } - public int[] LayerToPauseOn() { string[] userValues = GetValue("layer_to_pause").Split(';'); @@ -264,21 +259,6 @@ namespace MatterHackers.MatterControl.SlicerConfiguration }).ToArray(); } - public double ProbePaperWidth() - { - return double.Parse(GetValue("manual_probe_paper_width")); - } - - public int RaftExtruder() - { - return int.Parse(GetValue("raft_extruder")); - } - - public double MaxFanSpeed() - { - return ParseDouble(GetValue("max_fan_speed")); - } - public double FillDensity() { string fillDensityValueString = GetValue("fill_density"); @@ -304,14 +284,6 @@ namespace MatterHackers.MatterControl.SlicerConfiguration return layeredProfile.GetMaterialPresetKey(extruderIndex); } - public double FirstLayerExtrusionWidth() - { - AsPercentOfReferenceOrDirect mapper = new AsPercentOfReferenceOrDirect("first_layer_extrusion_width", "notused", "nozzle_diameter"); - - double firstLayerValue = ParseDouble(mapper.Value); - return firstLayerValue; - } - private static double ParseDouble(string firstLayerValueString) { double firstLayerValue; @@ -322,16 +294,6 @@ namespace MatterHackers.MatterControl.SlicerConfiguration return firstLayerValue; } - public double LayerHeight() - { - return ParseDouble(GetValue("layer_height")); - } - - public Vector2 BedSize() - { - return ActiveVector2("bed_size"); - } - public MeshVisualizer.MeshViewerWidget.BedShape BedShape() { switch (GetValue("bed_shape")) @@ -351,21 +313,6 @@ namespace MatterHackers.MatterControl.SlicerConfiguration } } - public Vector2 BedCenter() - { - return ActiveVector2("print_center"); - } - - public double BuildHeight() - { - return ParseDouble(GetValue("build_height")); - } - - public Vector2 PrintCenter() - { - return ActiveVector2("print_center"); - } - public int ExtruderCount() { if (this.GetValue("extruders_share_temperature")) @@ -401,11 +348,6 @@ namespace MatterHackers.MatterControl.SlicerConfiguration return Vector2.Zero; } - public double FilamentDiameter() - { - return ParseDouble(GetValue("filament_diameter")); - } - private PrintLevelingData printLevelingData = null; public PrintLevelingData GetPrintLevelingData() { @@ -420,7 +362,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration printLevelingData.SampledPosition0, printLevelingData.SampledPosition1, printLevelingData.SampledPosition2, - ActiveSliceSettings.Instance.PrintCenter()); + ActiveSliceSettings.Instance.GetValue("print_center")); } return printLevelingData; @@ -452,7 +394,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration levelingData.SampledPosition0, levelingData.SampledPosition1, levelingData.SampledPosition2, - ActiveSliceSettings.Instance.PrintCenter()); + ActiveSliceSettings.Instance.GetValue("print_center")); } } @@ -508,6 +450,18 @@ namespace MatterHackers.MatterControl.SlicerConfiguration int.TryParse(this.GetValue(settingsKey), out result); return (T)(object)(result); } + else if(typeof(T) == typeof(Vector2)) + { + string[] twoValues = GetValue(settingsKey).Split(','); + if (twoValues.Length != 2) + { + throw new Exception(string.Format("Not parsing {0} as a Vector2", settingsKey)); + } + Vector2 valueAsVector2 = new Vector2(); + valueAsVector2.x = ParseDouble(twoValues[0]); + valueAsVector2.y = ParseDouble(twoValues[1]); + return (T)(object)(valueAsVector2); + } else if (typeof(T) == typeof(double)) { string settingsStringh = GetValue(settingsKey); @@ -518,7 +472,11 @@ namespace MatterHackers.MatterControl.SlicerConfiguration if (settingsKey == "first_layer_height") { - return (T)(object)(LayerHeight() * ratio); + return (T)(object)(GetValue("layer_height") * ratio); + } + else if(settingsKey == "first_layer_extrusion_width") + { + return (T)(object)(GetValue("layer_height") * ratio); } return (T)(object)(ratio); @@ -583,19 +541,6 @@ namespace MatterHackers.MatterControl.SlicerConfiguration } } - public Vector2 ActiveVector2(string sliceSetting) - { - string[] twoValues = GetValue(sliceSetting).Split(','); - if (twoValues.Length != 2) - { - throw new Exception(string.Format("Not parsing {0} as a Vector2", sliceSetting)); - } - Vector2 valueAsVector2 = new Vector2(); - valueAsVector2.x = ParseDouble(twoValues[0]); - valueAsVector2.y = ParseDouble(twoValues[1]); - return valueAsVector2; - } - public void ExportAsMatterControlConfig() { FileDialog.SaveFileDialog( @@ -664,10 +609,10 @@ namespace MatterHackers.MatterControl.SlicerConfiguration { try { - if (LayerHeight() > GetValue("nozzle_diameter")) + if (GetValue("layer_height") > GetValue("nozzle_diameter")) { string error = "'Layer Height' must be less than or equal to the 'Nozzle Diameter'.".Localize(); - string details = string.Format("Layer Height = {0}\nNozzle Diameter = {1}".Localize(), LayerHeight(), GetValue("nozzle_diameter")); + string details = string.Format("Layer Height = {0}\nNozzle Diameter = {1}".Localize(), GetValue("layer_height"), GetValue("nozzle_diameter")); string location = "Location: 'Settings & Controls' -> 'Settings' -> 'General' -> 'Layers/Surface'".Localize(); StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize()); return false; @@ -707,7 +652,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration } } - if (FirstLayerExtrusionWidth() > GetValue("nozzle_diameter") * 4) + if (GetValue("first_layer_extrusion_width") > GetValue("nozzle_diameter") * 4) { string error = "'First Layer Extrusion Width' must be less than or equal to the 'Nozzle Diameter' * 4.".Localize(); string details = string.Format("First Layer Extrusion Width = {0}\nNozzle Diameter = {1}".Localize(), GetValue("first_layer_extrusion_width"), GetValue("nozzle_diameter")); @@ -716,7 +661,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration return false; } - if (FirstLayerExtrusionWidth() <= 0) + if (GetValue("first_layer_extrusion_width") <= 0) { string error = "'First Layer Extrusion Width' must be greater than 0.".Localize(); string details = string.Format("First Layer Extrusion Width = {0}".Localize(), GetValue("first_layer_extrusion_width")); @@ -734,10 +679,10 @@ namespace MatterHackers.MatterControl.SlicerConfiguration return false; } - if (MaxFanSpeed() > 100) + if (GetValue("max_fan_speed") > 100) { string error = "The Maximum Fan Speed can only go as high as 100%.".Localize(); - string details = string.Format("It is currently set to {0}.".Localize(), MaxFanSpeed()); + string details = string.Format("It is currently set to {0}.".Localize(), GetValue("max_fan_speed")); string location = "Location: 'Settings & Controls' -> 'Settings' -> 'Filament' -> 'Cooling'".Localize(); StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize()); return false; diff --git a/SlicerConfiguration/SlicerMapping/EngineMappingCura.cs b/SlicerConfiguration/SlicerMapping/EngineMappingCura.cs index 134fe1be7..bdd46482e 100644 --- a/SlicerConfiguration/SlicerMapping/EngineMappingCura.cs +++ b/SlicerConfiguration/SlicerMapping/EngineMappingCura.cs @@ -229,7 +229,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration { get { - Vector2 PrinteCenter = ActiveSliceSettings.Instance.PrintCenter(); + Vector2 PrinteCenter = ActiveSliceSettings.Instance.GetValue("print_center"); return (PrinteCenter.x * 1000).ToString(); } } @@ -246,7 +246,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration { get { - Vector2 PrinteCenter = ActiveSliceSettings.Instance.PrintCenter(); + Vector2 PrinteCenter = ActiveSliceSettings.Instance.GetValue("print_center"); return (PrinteCenter.y * 1000).ToString(); } } @@ -288,7 +288,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration { double lengthToExtrudeMm = ParseDouble(base.Value); // we need to convert mm of filament to mm of extrusion path - double amountOfFilamentCubicMms = ActiveSliceSettings.Instance.FilamentDiameter() * MathHelper.Tau * lengthToExtrudeMm; + double amountOfFilamentCubicMms = ActiveSliceSettings.Instance.GetValue("filament_diameter") * MathHelper.Tau * lengthToExtrudeMm; double extrusionSquareSize = ActiveSliceSettings.Instance.GetValue("first_layer_height") * ActiveSliceSettings.Instance.GetValue("nozzle_diameter"); double lineLength = amountOfFilamentCubicMms / extrusionSquareSize; diff --git a/SlicerConfiguration/SlicerMapping/EngineMappingMatterSlice.cs b/SlicerConfiguration/SlicerMapping/EngineMappingMatterSlice.cs index c23885467..187507aa2 100644 --- a/SlicerConfiguration/SlicerMapping/EngineMappingMatterSlice.cs +++ b/SlicerConfiguration/SlicerMapping/EngineMappingMatterSlice.cs @@ -310,7 +310,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration { get { - Vector2 PrinteCenter = ActiveSliceSettings.Instance.PrintCenter(); + Vector2 PrinteCenter = ActiveSliceSettings.Instance.GetValue("print_center"); return "[{0},{1}]".FormatWith(PrinteCenter.x, PrinteCenter.y); } @@ -330,7 +330,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration { double lengthToExtrudeMm = ParseDouble(base.Value); // we need to convert mm of filament to mm of extrusion path - double amountOfFilamentCubicMms = ActiveSliceSettings.Instance.FilamentDiameter() * MathHelper.Tau * lengthToExtrudeMm; + double amountOfFilamentCubicMms = ActiveSliceSettings.Instance.GetValue("filament_diameter") * MathHelper.Tau * lengthToExtrudeMm; double extrusionSquareSize = ActiveSliceSettings.Instance.GetValue("first_layer_height") * ActiveSliceSettings.Instance.GetValue("nozzle_diameter"); double lineLength = amountOfFilamentCubicMms / extrusionSquareSize; diff --git a/SlicerConfiguration/SlicingQueue.cs b/SlicerConfiguration/SlicingQueue.cs index 208c1ba5b..160bb61d5 100644 --- a/SlicerConfiguration/SlicingQueue.cs +++ b/SlicerConfiguration/SlicingQueue.cs @@ -177,9 +177,9 @@ namespace MatterHackers.MatterControl.SlicerConfiguration // If we have support enabled and are using an extruder other than 0 for it if (ActiveSliceSettings.Instance.GetValue("support_material")) { - if (ActiveSliceSettings.Instance.SupportExtruder() != 0) + if (ActiveSliceSettings.Instance.GetValue("support_material_extruder") != 0) { - int supportExtruder = Math.Max(0, Math.Min(ActiveSliceSettings.Instance.ExtruderCount() - 1, ActiveSliceSettings.Instance.SupportExtruder() - 1)); + int supportExtruder = Math.Max(0, Math.Min(ActiveSliceSettings.Instance.ExtruderCount() - 1, ActiveSliceSettings.Instance.GetValue("support_material_extruder") - 1)); extrudersUsed[supportExtruder] = true; } } @@ -187,9 +187,9 @@ namespace MatterHackers.MatterControl.SlicerConfiguration // If we have raft enabled and are using an extruder other than 0 for it if (ActiveSliceSettings.Instance.GetValue("create_raft")) { - if (ActiveSliceSettings.Instance.RaftExtruder() != 0) + if (ActiveSliceSettings.Instance.GetValue("raft_extruder") != 0) { - int raftExtruder = Math.Max(0, Math.Min(ActiveSliceSettings.Instance.ExtruderCount() - 1, ActiveSliceSettings.Instance.RaftExtruder() - 1)); + int raftExtruder = Math.Max(0, Math.Min(ActiveSliceSettings.Instance.ExtruderCount() - 1, ActiveSliceSettings.Instance.GetValue("raft_extruder") - 1)); extrudersUsed[raftExtruder] = true; } } diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index 7ddec45bb..02f057d6f 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit 7ddec45bb3886ec3f619a3d608eb147e7b1ba613 +Subproject commit 02f057d6f7ba993ec5206b1857cf82721bd973a2 diff --git a/TextCreator/TextCreatorMainWindow.cs b/TextCreator/TextCreatorMainWindow.cs index 653940299..48c96f034 100644 --- a/TextCreator/TextCreatorMainWindow.cs +++ b/TextCreator/TextCreatorMainWindow.cs @@ -44,11 +44,11 @@ namespace MatterHackers.MatterControl.Plugins.TextCreator BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; - double buildHeight = ActiveSliceSettings.Instance.BuildHeight(); + double buildHeight = ActiveSliceSettings.Instance.GetValue("build_height"); part3DView = new View3DTextCreator( - new Vector3(ActiveSliceSettings.Instance.BedSize(), buildHeight), - ActiveSliceSettings.Instance.BedCenter(), + new Vector3(ActiveSliceSettings.Instance.GetValue("bed_size"), buildHeight), + ActiveSliceSettings.Instance.GetValue("print_center"), ActiveSliceSettings.Instance.BedShape()); #if __ANDROID__