Merge branch '1.7'

# Conflicts:
#	StaticData/SliceSettings/Properties.json
This commit is contained in:
Lars Brubaker 2017-03-14 14:18:57 -07:00
commit 0b6c4e94f1
83 changed files with 2568 additions and 673 deletions

View file

@ -98,7 +98,9 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
static ActiveSliceSettings()
{
string propertiesFileContents = StaticData.Instance.ReadAllText(Path.Combine("SliceSettings", "Properties.json"));
SettingsData = JsonConvert.DeserializeObject<List<SliceSettingData>>(propertiesFileContents) as List<SliceSettingData>;
SettingsData = JsonConvert.DeserializeObject<List<SliceSettingData>>(propertiesFileContents);
activeInstance = PrinterSettings.Empty;
settingsByName = new Dictionary<string, SliceSettingData>();
foreach (var settingsData in ActiveSliceSettings.SettingsData)

View file

@ -531,6 +531,44 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
return "";
}
public Tuple<string, string> GetValueAndLayerName(string sliceSetting, IEnumerable<PrinterSettingsLayer> layerCascade = null)
{
if (layerCascade == null)
{
layerCascade = defaultLayerCascade;
}
foreach (PrinterSettingsLayer layer in layerCascade)
{
string value;
if (layer.TryGetValue(sliceSetting, out value))
{
string layerName = "User";
if (layer == this.BaseLayer)
{
layerName = "Base";
}
else if (layer == this.OemLayer)
{
layerName = "Oem";
}
else if (layer == this.MaterialLayer)
{
layerName = "Material";
}
else if (layer == this.QualityLayer)
{
layerName = "Quality";
}
return new Tuple<string, string>(value, layerName);
}
}
return new Tuple<string, string>("", "");
}
public bool Contains(string sliceSetting, IEnumerable<PrinterSettingsLayer> layerCascade = null)
{
if (layerCascade == null)
@ -550,7 +588,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
[JsonIgnore]
public PrinterSettingsLayer BaseLayer { get; set; } = SliceSettingsOrganizer.Instance.GetDefaultSettings();
private IEnumerable<PrinterSettingsLayer> defaultLayerCascade
internal IEnumerable<PrinterSettingsLayer> defaultLayerCascade
{
get
{
@ -700,14 +738,16 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
{
return (T)(object)(GetValue<double>(SettingsKey.layer_height) * ratio);
}
else if (settingsKey == SettingsKey.first_layer_extrusion_width)
else if (settingsKey == SettingsKey.first_layer_extrusion_width
|| settingsKey == SettingsKey.external_perimeter_extrusion_width)
{
return (T)(object)(GetValue<double>(SettingsKey.nozzle_diameter) * ratio);
}
return (T)(object)(ratio);
}
else if (settingsKey == SettingsKey.first_layer_extrusion_width)
else if (settingsKey == SettingsKey.first_layer_extrusion_width
|| settingsKey == SettingsKey.external_perimeter_extrusion_width)
{
double extrusionResult;
double.TryParse(this.GetValue(settingsKey), out extrusionResult);

View file

@ -511,7 +511,8 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
// The collector specifically returns null to ensure LoadCacheable skips writing the
// result to the cache. After this result is returned, it will attempt to load from
// the local cache if the collector yielded no result
if(File.Exists(cachePath))
if(File.Exists(cachePath)
|| ApplicationController.DownloadPublicProfileAsync == null)
{
return null;
}