More settings moved to GetValue
bed_size bed_shape build_height bed_temperature min_fan_speed also Moved BedShape out of class and into namespace
This commit is contained in:
parent
9d401e1d9f
commit
2ee52deea6
12 changed files with 64 additions and 63 deletions
|
|
@ -29,6 +29,7 @@ either expressed or implied, of the FreeBSD Project.
|
|||
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
using MatterHackers.MeshVisualizer;
|
||||
using MatterHackers.VectorMath;
|
||||
|
||||
namespace MatterHackers.MatterControl.Plugins.BrailleBuilder
|
||||
|
|
@ -47,9 +48,9 @@ namespace MatterHackers.MatterControl.Plugins.BrailleBuilder
|
|||
double buildHeight = ActiveSliceSettings.Instance.GetValue<double>("build_height");
|
||||
|
||||
part3DView = new View3DBrailleBuilder(
|
||||
new Vector3(ActiveSliceSettings.Instance.GetValue<Vector2>("bed_size"), buildHeight),
|
||||
new Vector3(ActiveSliceSettings.Instance.GetValue<Vector2>(SettingsKey.bed_size), buildHeight),
|
||||
ActiveSliceSettings.Instance.GetValue<Vector2>("print_center"),
|
||||
ActiveSliceSettings.Instance.BedShape());
|
||||
ActiveSliceSettings.Instance.GetValue<BedShape>(SettingsKey.bed_shape));
|
||||
|
||||
#if __ANDROID__
|
||||
this.AddChild(new SoftKeyboardContentOffset(part3DView));
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ namespace MatterHackers.MatterControl.Plugins.BrailleBuilder
|
|||
private TypeFace brailTypeFace;
|
||||
private TypeFace boldTypeFace;
|
||||
|
||||
public View3DBrailleBuilder(Vector3 viewerVolume, Vector2 bedCenter, MeshViewerWidget.BedShape bedShape)
|
||||
public View3DBrailleBuilder(Vector3 viewerVolume, Vector2 bedCenter, BedShape bedShape)
|
||||
{
|
||||
boldTypeFace = TypeFace.LoadFrom(StaticData.Instance.ReadAllText(Path.Combine("Fonts", "LiberationMono.svg")));
|
||||
brailTypeFace = TypeFace.LoadFrom(StaticData.Instance.ReadAllText(Path.Combine("Fonts", "Braille.svg")));
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ either expressed or implied, of the FreeBSD Project.
|
|||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
using MatterHackers.MeshVisualizer;
|
||||
using MatterHackers.VectorMath;
|
||||
using System;
|
||||
|
||||
|
|
@ -79,12 +80,12 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
|
||||
public static Vector2 GetPrintLevelPositionToSample(int index)
|
||||
{
|
||||
Vector2 bedSize = ActiveSliceSettings.Instance.GetValue<Vector2>("bed_size");
|
||||
Vector2 bedSize = ActiveSliceSettings.Instance.GetValue<Vector2>(SettingsKey.bed_size);
|
||||
Vector2 printCenter = ActiveSliceSettings.Instance.GetValue<Vector2>("print_center");
|
||||
|
||||
switch (ActiveSliceSettings.Instance.BedShape())
|
||||
switch (ActiveSliceSettings.Instance.GetValue<BedShape>(SettingsKey.bed_shape))
|
||||
{
|
||||
case MeshVisualizer.MeshViewerWidget.BedShape.Circular:
|
||||
case BedShape.Circular:
|
||||
Vector2 firstPosition = new Vector2(printCenter.x, printCenter.y + (bedSize.y / 2) * .5);
|
||||
switch (index)
|
||||
{
|
||||
|
|
@ -101,7 +102,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
throw new IndexOutOfRangeException();
|
||||
}
|
||||
|
||||
case MeshVisualizer.MeshViewerWidget.BedShape.Rectangular:
|
||||
case BedShape.Rectangular:
|
||||
default:
|
||||
switch (index)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
meshViewerWidget.CreatePrintBed(
|
||||
new Vector3(ActiveSliceSettings.Instance.GetValue<Vector2>("bed_size"), buildHeight),
|
||||
ActiveSliceSettings.Instance.GetValue<Vector2>("print_center"),
|
||||
ActiveSliceSettings.Instance.BedShape());
|
||||
ActiveSliceSettings.Instance.GetValue<BedShape>(SettingsKey.bed_shape));
|
||||
PutOemImageOnBed();
|
||||
}));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ using MatterHackers.Agg.UI;
|
|||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.PrintQueue;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
using MatterHackers.MeshVisualizer;
|
||||
using MatterHackers.VectorMath;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
|
@ -99,9 +100,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
// put in the 3D view
|
||||
partPreviewView = new View3DWidget(printItem,
|
||||
new Vector3(ActiveSliceSettings.Instance.GetValue<Vector2>("bed_size"), buildHeight),
|
||||
new Vector3(ActiveSliceSettings.Instance.GetValue<Vector2>(SettingsKey.bed_size), buildHeight),
|
||||
ActiveSliceSettings.Instance.GetValue<Vector2>("print_center"),
|
||||
ActiveSliceSettings.Instance.BedShape(),
|
||||
ActiveSliceSettings.Instance.GetValue<BedShape>(SettingsKey.bed_shape),
|
||||
windowMode,
|
||||
autoRotate3DView,
|
||||
openMode);
|
||||
|
|
@ -116,9 +117,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
}
|
||||
|
||||
viewGcodeBasic = new ViewGcodeBasic(printItem,
|
||||
new Vector3(ActiveSliceSettings.Instance.GetValue<Vector2>("bed_size"), buildHeight),
|
||||
new Vector3(ActiveSliceSettings.Instance.GetValue<Vector2>(SettingsKey.bed_size), buildHeight),
|
||||
ActiveSliceSettings.Instance.GetValue<Vector2>("print_center"),
|
||||
ActiveSliceSettings.Instance.BedShape(), gcodeWindowMode);
|
||||
ActiveSliceSettings.Instance.GetValue<BedShape>(SettingsKey.bed_shape), gcodeWindowMode);
|
||||
|
||||
if (windowMode == View3DWidget.WindowMode.StandAlone)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
public event EventHandler SelectedTransformChanged;
|
||||
|
||||
public View3DWidget(PrintItemWrapper printItemWrapper, Vector3 viewerVolume, Vector2 bedCenter, MeshViewerWidget.BedShape bedShape, WindowMode windowType, AutoRotate autoRotate, OpenMode openMode = OpenMode.Viewing)
|
||||
public View3DWidget(PrintItemWrapper printItemWrapper, Vector3 viewerVolume, Vector2 bedCenter, BedShape bedShape, WindowMode windowType, AutoRotate autoRotate, OpenMode openMode = OpenMode.Viewing)
|
||||
{
|
||||
this.openMode = openMode;
|
||||
this.windowType = windowType;
|
||||
|
|
@ -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.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);
|
||||
RectangleDouble bedRect = new RectangleDouble(0, 0, ActiveSliceSettings.Instance.GetValue<Vector2>(SettingsKey.bed_size).x, ActiveSliceSettings.Instance.GetValue<Vector2>(SettingsKey.bed_size).y);
|
||||
bedRect.Offset(ActiveSliceSettings.Instance.GetValue<Vector2>("print_center") - ActiveSliceSettings.Instance.GetValue<Vector2>(SettingsKey.bed_size) / 2);
|
||||
|
||||
bool inBounds = bedRect.Contains(new Vector2(allBounds.minXYZ)) && bedRect.Contains(new Vector2(allBounds.maxXYZ));
|
||||
|
||||
|
|
|
|||
|
|
@ -87,10 +87,10 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
private Vector2 bedCenter;
|
||||
private Vector3 viewerVolume;
|
||||
private MeshViewerWidget.BedShape bedShape;
|
||||
private BedShape bedShape;
|
||||
private int sliderWidth;
|
||||
|
||||
public ViewGcodeBasic(PrintItemWrapper printItem, Vector3 viewerVolume, Vector2 bedCenter, MeshViewerWidget.BedShape bedShape, WindowMode windowMode)
|
||||
public ViewGcodeBasic(PrintItemWrapper printItem, Vector3 viewerVolume, Vector2 bedCenter, BedShape bedShape, WindowMode windowMode)
|
||||
{
|
||||
this.viewerVolume = viewerVolume;
|
||||
this.bedShape = bedShape;
|
||||
|
|
@ -126,8 +126,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|| stringEvent.Data == "bed_shape"
|
||||
|| stringEvent.Data == "center_part_on_bed")
|
||||
{
|
||||
viewerVolume = new Vector3(ActiveSliceSettings.Instance.GetValue<Vector2>("bed_size"), ActiveSliceSettings.Instance.GetValue<double>("build_height"));
|
||||
bedShape = ActiveSliceSettings.Instance.BedShape();
|
||||
viewerVolume = new Vector3(ActiveSliceSettings.Instance.GetValue<Vector2>(SettingsKey.bed_size), ActiveSliceSettings.Instance.GetValue<double>("build_height"));
|
||||
bedShape = ActiveSliceSettings.Instance.GetValue<BedShape>(SettingsKey.bed_shape);
|
||||
bedCenter = ActiveSliceSettings.Instance.GetValue<Vector2>("print_center");
|
||||
|
||||
double buildHeight = ActiveSliceSettings.Instance.GetValue<double>("build_height");
|
||||
|
|
|
|||
|
|
@ -48,14 +48,17 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
using DataStorage;
|
||||
using Agg.PlatformAbstract;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
using MeshVisualizer;
|
||||
public enum SettingsKey
|
||||
{
|
||||
bed_shape,
|
||||
bed_size,
|
||||
bed_temperature,
|
||||
has_heated_bed,
|
||||
resume_position_before_z_home,
|
||||
z_homes_to_max,
|
||||
nozzle_diameter,
|
||||
min_fan_speed,
|
||||
};
|
||||
|
||||
public class SettingsProfile
|
||||
|
|
@ -243,16 +246,6 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
layeredProfile.SetMaterialPreset(extruderIndex, text);
|
||||
}
|
||||
|
||||
public double BedTemperature()
|
||||
{
|
||||
double targetTemp = 0;
|
||||
if (this.GetValue<bool>("has_heated_bed"))
|
||||
{
|
||||
double.TryParse(GetValue("bed_temperature"), out targetTemp);
|
||||
}
|
||||
return targetTemp;
|
||||
}
|
||||
|
||||
public int[] LayerToPauseOn()
|
||||
{
|
||||
string[] userValues = GetValue("layer_to_pause").Split(';');
|
||||
|
|
@ -283,11 +276,6 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
}
|
||||
}
|
||||
|
||||
public double MinFanSpeed()
|
||||
{
|
||||
return ParseDouble(GetValue("min_fan_speed"));
|
||||
}
|
||||
|
||||
internal string MaterialPresetKey(int extruderIndex)
|
||||
{
|
||||
return layeredProfile.GetMaterialPresetKey(extruderIndex);
|
||||
|
|
@ -303,25 +291,6 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
return firstLayerValue;
|
||||
}
|
||||
|
||||
public MeshVisualizer.MeshViewerWidget.BedShape BedShape()
|
||||
{
|
||||
switch (GetValue("bed_shape"))
|
||||
{
|
||||
case "rectangular":
|
||||
return MeshVisualizer.MeshViewerWidget.BedShape.Rectangular;
|
||||
|
||||
case "circular":
|
||||
return MeshVisualizer.MeshViewerWidget.BedShape.Circular;
|
||||
|
||||
default:
|
||||
#if DEBUG
|
||||
throw new NotImplementedException(string.Format("'{0}' is not a known bed_shape.", GetValue("bed_shape")));
|
||||
#else
|
||||
return MeshVisualizer.MeshViewerWidget.BedShape.Rectangular;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
public int ExtruderCount()
|
||||
{
|
||||
if (this.GetValue<bool>("extruders_share_temperature"))
|
||||
|
|
@ -456,7 +425,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
{
|
||||
if (typeof(T) == typeof(bool))
|
||||
{
|
||||
return (T)(object) (this.GetValue(settingsKey) == "1");
|
||||
return (T)(object)(this.GetValue(settingsKey) == "1");
|
||||
}
|
||||
else if (typeof(T) == typeof(int))
|
||||
{
|
||||
|
|
@ -464,7 +433,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
int.TryParse(this.GetValue(settingsKey), out result);
|
||||
return (T)(object)(result);
|
||||
}
|
||||
else if(typeof(T) == typeof(Vector2))
|
||||
else if (typeof(T) == typeof(Vector2))
|
||||
{
|
||||
string[] twoValues = GetValue(settingsKey).Split(',');
|
||||
if (twoValues.Length != 2)
|
||||
|
|
@ -488,7 +457,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
{
|
||||
return (T)(object)(GetValue<double>("layer_height") * ratio);
|
||||
}
|
||||
else if(settingsKey == "first_layer_extrusion_width")
|
||||
else if (settingsKey == "first_layer_extrusion_width")
|
||||
{
|
||||
return (T)(object)(GetValue<double>("layer_height") * ratio);
|
||||
}
|
||||
|
|
@ -496,10 +465,35 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
return (T)(object)(ratio);
|
||||
}
|
||||
|
||||
if (settingsKey == SettingsKey.bed_temperature.ToString()
|
||||
&& !this.GetValue<bool>("has_heated_bed"))
|
||||
{
|
||||
return (T)(object)(0);
|
||||
}
|
||||
|
||||
double result;
|
||||
double.TryParse(this.GetValue(settingsKey), out result);
|
||||
return (T)(object)(result);
|
||||
}
|
||||
else if (typeof(T) == typeof(BedShape))
|
||||
{
|
||||
switch (GetValue(settingsKey.ToString()))
|
||||
{
|
||||
case "rectangular":
|
||||
return (T)(object)(BedShape.Rectangular);
|
||||
|
||||
case "circular":
|
||||
return (T)(object)(BedShape.Circular);
|
||||
|
||||
default:
|
||||
#if DEBUG
|
||||
throw new NotImplementedException(string.Format("'{0}' is not a known bed_shape.", GetValue("bed_shape")));
|
||||
#else
|
||||
return MeshVisualizer.MeshViewerWidget.BedShape.Rectangular;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return (T)default(T);
|
||||
}
|
||||
|
|
@ -684,10 +678,10 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
return false;
|
||||
}
|
||||
|
||||
if (MinFanSpeed() > 100)
|
||||
if (GetValue<double>(SettingsKey.min_fan_speed) > 100)
|
||||
{
|
||||
string error = "The Minimum Fan Speed can only go as high as 100%.".Localize();
|
||||
string details = string.Format("It is currently set to {0}.".Localize(), MinFanSpeed());
|
||||
string details = string.Format("It is currently set to {0}.".Localize(), GetValue<double>(SettingsKey.min_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;
|
||||
|
|
|
|||
|
|
@ -5032,3 +5032,6 @@ Translated:You have successfully imported a new printer profile. You can find '{
|
|||
English:Import Successful
|
||||
Translated:Import Successful
|
||||
|
||||
English:The distance between the first layer (the bottom) and the top of the support material. A good value depends on the type of material. For PLA and ABS a value between 0.1 and 0.3 generaly works well.
|
||||
Translated:The distance between the first layer (the bottom) and the top of the support material. A good value depends on the type of material. For PLA and ABS a value between 0.1 and 0.3 generaly works well.
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 02f057d6f7ba993ec5206b1857cf82721bd973a2
|
||||
Subproject commit a13efdb37e1768456083351888fa1b1493b3d21d
|
||||
|
|
@ -29,6 +29,7 @@ either expressed or implied, of the FreeBSD Project.
|
|||
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
using MatterHackers.MeshVisualizer;
|
||||
using MatterHackers.VectorMath;
|
||||
|
||||
namespace MatterHackers.MatterControl.Plugins.TextCreator
|
||||
|
|
@ -47,9 +48,9 @@ namespace MatterHackers.MatterControl.Plugins.TextCreator
|
|||
double buildHeight = ActiveSliceSettings.Instance.GetValue<double>("build_height");
|
||||
|
||||
part3DView = new View3DTextCreator(
|
||||
new Vector3(ActiveSliceSettings.Instance.GetValue<Vector2>("bed_size"), buildHeight),
|
||||
new Vector3(ActiveSliceSettings.Instance.GetValue<Vector2>(SettingsKey.bed_size), buildHeight),
|
||||
ActiveSliceSettings.Instance.GetValue<Vector2>("print_center"),
|
||||
ActiveSliceSettings.Instance.BedShape());
|
||||
ActiveSliceSettings.Instance.GetValue<BedShape>(SettingsKey.bed_shape));
|
||||
|
||||
#if __ANDROID__
|
||||
this.AddChild(new SoftKeyboardContentOffset(part3DView));
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ namespace MatterHackers.MatterControl.Plugins.TextCreator
|
|||
|
||||
private TypeFace boldTypeFace;
|
||||
|
||||
public View3DTextCreator(Vector3 viewerVolume, Vector2 bedCenter, MeshViewerWidget.BedShape bedShape)
|
||||
public View3DTextCreator(Vector3 viewerVolume, Vector2 bedCenter, BedShape bedShape)
|
||||
{
|
||||
boldTypeFace = TypeFace.LoadFrom(StaticData.Instance.ReadAllText(Path.Combine("Fonts", "LiberationSans-Bold.svg")));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue