Merge pull request #960 from larsbrubaker/master

Converted more settings methods to GetValue<T>
This commit is contained in:
Lars Brubaker 2016-06-16 07:15:17 -07:00 committed by GitHub
commit 64b7eb37a5
19 changed files with 92 additions and 143 deletions

View file

@ -44,11 +44,11 @@ namespace MatterHackers.MatterControl.Plugins.BrailleBuilder
BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
double buildHeight = ActiveSliceSettings.Instance.BuildHeight();
double buildHeight = ActiveSliceSettings.Instance.GetValue<double>("build_height");
part3DView = new View3DBrailleBuilder(
new Vector3(ActiveSliceSettings.Instance.BedSize(), buildHeight),
ActiveSliceSettings.Instance.BedCenter(),
new Vector3(ActiveSliceSettings.Instance.GetValue<Vector2>("bed_size"), buildHeight),
ActiveSliceSettings.Instance.GetValue<Vector2>("print_center"),
ActiveSliceSettings.Instance.BedShape());
#if __ANDROID__

View file

@ -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<Vector2>("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<Vector2>("print_center"))
.GetPrintLevelPositionToSample(index, radius);
}

View file

@ -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<Vector2>("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<Vector2>("bed_size").x, ActiveSliceSettings.Instance.GetValue<Vector2>("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<Vector2>("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<Vector2>("print_center"))
.GetPrintLevelPositionToSample(index, radius);
}

View file

@ -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<Vector2>("bed_size");
Vector2 printCenter = ActiveSliceSettings.Instance.GetValue<Vector2>("print_center");
switch (ActiveSliceSettings.Instance.BedShape())
{

View file

@ -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<double>("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<double>("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<double>("manual_probe_paper_width"));
PrintLevelingData levelingData = ActiveSliceSettings.Instance.GetPrintLevelingData();
levelingData.SampledPosition0 = userBedSample0 - paperWidth;

View file

@ -90,13 +90,13 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
private void RecreateBed()
{
double buildHeight = ActiveSliceSettings.Instance.BuildHeight();
double buildHeight = ActiveSliceSettings.Instance.GetValue<double>("build_height");
UiThread.RunOnIdle((Action)(() =>
{
meshViewerWidget.CreatePrintBed(
new Vector3(ActiveSliceSettings.Instance.BedSize(), buildHeight),
ActiveSliceSettings.Instance.BedCenter(),
new Vector3(ActiveSliceSettings.Instance.GetValue<Vector2>("bed_size"), buildHeight),
ActiveSliceSettings.Instance.GetValue<Vector2>("print_center"),
ActiveSliceSettings.Instance.BedShape());
PutOemImageOnBed();
}));

View file

@ -95,12 +95,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
selectedTabColor = ActiveTheme.Instance.SecondaryAccentColor;
}
double buildHeight = ActiveSliceSettings.Instance.BuildHeight();
double buildHeight = ActiveSliceSettings.Instance.GetValue<double>("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<Vector2>("bed_size"), buildHeight),
ActiveSliceSettings.Instance.GetValue<Vector2>("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<Vector2>("bed_size"), buildHeight),
ActiveSliceSettings.Instance.GetValue<Vector2>("print_center"),
ActiveSliceSettings.Instance.BedShape(), gcodeWindowMode);
if (windowMode == View3DWidget.WindowMode.StandAlone)

View file

@ -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<Vector2>("print_center"), 0));
}
PartHasBeenChanged();

View file

@ -1324,7 +1324,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
if (ActiveSliceSettings.Instance?.GetValue<bool>("center_part_on_bed") == true)
{
doCentering = MeshViewerWidget.CenterPartAfterLoad.DO;
bedCenter = ActiveSliceSettings.Instance.BedCenter();
bedCenter = ActiveSliceSettings.Instance.GetValue<Vector2>("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<Vector2>("bed_size").x, ActiveSliceSettings.Instance.GetValue<Vector2>("bed_size").y);
bedRect.Offset(ActiveSliceSettings.Instance.GetValue<Vector2>("print_center") - ActiveSliceSettings.Instance.GetValue<Vector2>("bed_size") / 2);
bool inBounds = bedRect.Contains(new Vector2(allBounds.minXYZ)) && bedRect.Contains(new Vector2(allBounds.maxXYZ));

View file

@ -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<Vector2>("bed_size"), ActiveSliceSettings.Instance.GetValue<double>("build_height"));
bedShape = ActiveSliceSettings.Instance.BedShape();
bedCenter = ActiveSliceSettings.Instance.BedCenter();
bedCenter = ActiveSliceSettings.Instance.GetValue<Vector2>("print_center");
double buildHeight = ActiveSliceSettings.Instance.BuildHeight();
double buildHeight = ActiveSliceSettings.Instance.GetValue<double>("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<double>("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<double>("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<double>("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;

View file

@ -301,7 +301,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
{
try
{
gCodeRenderer.GCodeFileToDraw?.GetFilamentUsedMm(ActiveSliceSettings.Instance.FilamentDiameter());
gCodeRenderer.GCodeFileToDraw?.GetFilamentUsedMm(ActiveSliceSettings.Instance.GetValue<double>("filament_diameter"));
}
catch (Exception e)
{

View file

@ -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<double>("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<Vector2>("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<Vector2>("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 "";

View file

@ -211,7 +211,7 @@ namespace MatterHackers.MatterControl.PrintQueue
if (ActiveSliceSettings.Instance != null)
{
activeFilamentDiameter = 3;
if (ActiveSliceSettings.Instance.FilamentDiameter() < 2)
if (ActiveSliceSettings.Instance.GetValue<double>("filament_diameter") < 2)
{
activeFilamentDiameter = 1.75;
}

View file

@ -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<bool>("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<Vector2>("print_center"));
}
return printLevelingData;
@ -452,7 +394,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
levelingData.SampledPosition0,
levelingData.SampledPosition1,
levelingData.SampledPosition2,
ActiveSliceSettings.Instance.PrintCenter());
ActiveSliceSettings.Instance.GetValue<Vector2>("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<double>("layer_height") * ratio);
}
else if(settingsKey == "first_layer_extrusion_width")
{
return (T)(object)(GetValue<double>("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<double>("nozzle_diameter"))
if (GetValue<double>("layer_height") > GetValue<double>("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<double>("nozzle_diameter"));
string details = string.Format("Layer Height = {0}\nNozzle Diameter = {1}".Localize(), GetValue<double>("layer_height"), GetValue<double>("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<double>("nozzle_diameter") * 4)
if (GetValue<double>("first_layer_extrusion_width") > GetValue<double>("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<double>("nozzle_diameter"));
@ -716,7 +661,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
return false;
}
if (FirstLayerExtrusionWidth() <= 0)
if (GetValue<double>("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<double>("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<double>("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;

View file

@ -229,7 +229,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
{
get
{
Vector2 PrinteCenter = ActiveSliceSettings.Instance.PrintCenter();
Vector2 PrinteCenter = ActiveSliceSettings.Instance.GetValue<Vector2>("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<Vector2>("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<double>("filament_diameter") * MathHelper.Tau * lengthToExtrudeMm;
double extrusionSquareSize = ActiveSliceSettings.Instance.GetValue<double>("first_layer_height") * ActiveSliceSettings.Instance.GetValue<double>("nozzle_diameter");
double lineLength = amountOfFilamentCubicMms / extrusionSquareSize;

View file

@ -310,7 +310,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
{
get
{
Vector2 PrinteCenter = ActiveSliceSettings.Instance.PrintCenter();
Vector2 PrinteCenter = ActiveSliceSettings.Instance.GetValue<Vector2>("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<double>("filament_diameter") * MathHelper.Tau * lengthToExtrudeMm;
double extrusionSquareSize = ActiveSliceSettings.Instance.GetValue<double>("first_layer_height") * ActiveSliceSettings.Instance.GetValue<double>("nozzle_diameter");
double lineLength = amountOfFilamentCubicMms / extrusionSquareSize;

View file

@ -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<bool>("support_material"))
{
if (ActiveSliceSettings.Instance.SupportExtruder() != 0)
if (ActiveSliceSettings.Instance.GetValue<int>("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<int>("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<bool>("create_raft"))
{
if (ActiveSliceSettings.Instance.RaftExtruder() != 0)
if (ActiveSliceSettings.Instance.GetValue<int>("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<int>("raft_extruder") - 1));
extrudersUsed[raftExtruder] = true;
}
}

@ -1 +1 @@
Subproject commit 7ddec45bb3886ec3f619a3d608eb147e7b1ba613
Subproject commit 02f057d6f7ba993ec5206b1857cf82721bd973a2

View file

@ -44,11 +44,11 @@ namespace MatterHackers.MatterControl.Plugins.TextCreator
BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
double buildHeight = ActiveSliceSettings.Instance.BuildHeight();
double buildHeight = ActiveSliceSettings.Instance.GetValue<double>("build_height");
part3DView = new View3DTextCreator(
new Vector3(ActiveSliceSettings.Instance.BedSize(), buildHeight),
ActiveSliceSettings.Instance.BedCenter(),
new Vector3(ActiveSliceSettings.Instance.GetValue<Vector2>("bed_size"), buildHeight),
ActiveSliceSettings.Instance.GetValue<Vector2>("print_center"),
ActiveSliceSettings.Instance.BedShape());
#if __ANDROID__