Put the slicing configuration files in their own folder
updated copy write date added bsd to a few files Made the mapping to slice engines more procedural to support more engines.
This commit is contained in:
parent
ca60d24c0d
commit
263e2325f5
47 changed files with 902 additions and 552 deletions
|
|
@ -14,6 +14,7 @@ using MatterHackers.VectorMath;
|
|||
using MatterHackers.MatterControl;
|
||||
using MatterHackers.MatterControl.PrintQueue;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
|
||||
namespace MatterHackers.MatterControl.ActionBar
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,33 @@
|
|||
using System;
|
||||
/*
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
|
@ -16,14 +45,15 @@ using MatterHackers.VectorMath;
|
|||
using MatterHackers.MatterControl.ContactForm;
|
||||
using MatterHackers.MatterControl.DataStorage;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
|
||||
namespace MatterHackers.MatterControl
|
||||
{
|
||||
public class ActivePrinterProfile
|
||||
{
|
||||
public enum SlicingEngine { Slic3r, CuraEngine, MatterSlice };
|
||||
public enum SlicingEngineTypes { Slic3r, CuraEngine, MatterSlice };
|
||||
|
||||
static readonly SlicingEngine defaultEngine = SlicingEngine.Slic3r;
|
||||
static readonly SlicingEngineTypes defaultEngineType = SlicingEngineTypes.Slic3r;
|
||||
static ActivePrinterProfile globalInstance = null;
|
||||
|
||||
public RootedObjectEventHandler ActivePrinterChanged = new RootedObjectEventHandler();
|
||||
|
|
@ -62,13 +92,13 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
}
|
||||
|
||||
public SlicingEngine ActiveSliceEngine
|
||||
public SlicingEngineTypes ActiveSliceEngineType
|
||||
{
|
||||
get
|
||||
{
|
||||
if (ActivePrinter != null)
|
||||
{
|
||||
foreach (SlicingEngine engine in SlicingEngine.GetValues(typeof(SlicingEngine)))
|
||||
foreach (SlicingEngineTypes engine in SlicingEngineTypes.GetValues(typeof(SlicingEngineTypes)))
|
||||
{
|
||||
if (ActivePrinter.CurrentSlicingEngine == engine.ToString())
|
||||
{
|
||||
|
|
@ -77,15 +107,15 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
|
||||
// It is not set in the slice settings, so set it and save it.
|
||||
ActivePrinter.CurrentSlicingEngine = defaultEngine.ToString();
|
||||
ActivePrinter.CurrentSlicingEngine = defaultEngineType.ToString();
|
||||
ActivePrinter.Commit();
|
||||
}
|
||||
return defaultEngine;
|
||||
return defaultEngineType;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (ActiveSliceEngine != value)
|
||||
if (ActiveSliceEngineType != value)
|
||||
{
|
||||
ActivePrinter.CurrentSlicingEngine = value.ToString();
|
||||
ActivePrinter.Commit();
|
||||
|
|
@ -93,6 +123,24 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
}
|
||||
|
||||
public SliceEngineMaping ActiveSliceEngine
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (ActiveSliceEngineType)
|
||||
{
|
||||
case SlicingEngineTypes.Slic3r:
|
||||
return Slic3rEngineMappings.Instance;
|
||||
|
||||
case SlicingEngineTypes.CuraEngine:
|
||||
return CuraEngineMappings.Instance;
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnActivePrinterChanged(EventArgs e)
|
||||
{
|
||||
ActivePrinterChanged.CallEvents(this, e);
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ using MatterHackers.MatterControl.DataStorage;
|
|||
using MatterHackers.MatterControl.PrintQueue;
|
||||
using MatterHackers.GCodeVisualizer;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
|
||||
namespace MatterHackers.MatterControl
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2013, Lars Brubaker
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -1,4 +1,33 @@
|
|||
using System;
|
||||
/*
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ using MatterHackers.VectorMath;
|
|||
using MatterHackers.MatterControl;
|
||||
using MatterHackers.MatterControl.PrintQueue;
|
||||
using MatterHackers.MatterControl.PrintLibrary;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
using MatterHackers.MatterControl.ToolsPage;
|
||||
using MatterHackers.MatterControl.DataStorage;
|
||||
using MatterHackers.Localizations;
|
||||
|
|
|
|||
|
|
@ -93,6 +93,10 @@
|
|||
<Compile Include="PrintLibrary\ExportLibraryItemWindow.cs" />
|
||||
<Compile Include="PrintLibrary\RegisteredCreatort.cs" />
|
||||
<Compile Include="PrintQueue\ExportToSdCardProcess.cs" />
|
||||
<Compile Include="SlicerConfiguration\SlicerMapping\EngineMappingCura.cs" />
|
||||
<Compile Include="SlicerConfiguration\SlicerMapping\EngineMappingSlic3r.cs" />
|
||||
<Compile Include="SlicerConfiguration\SlicerMapping\MappingClasses.cs" />
|
||||
<Compile Include="SlicerConfiguration\SlicerMapping\EngineMapingBase.cs" />
|
||||
<Compile Include="ToolsPage\ToolsListControl.cs" />
|
||||
<Compile Include="ToolsPage\ToolsListItem.cs" />
|
||||
<Compile Include="ToolsPage\ToolsWidget.cs" />
|
||||
|
|
@ -162,13 +166,12 @@
|
|||
<Compile Include="PrintQueue\QueueControlsWidget.cs" />
|
||||
<Compile Include="SettingsManagement\ApplicationSettings.cs" />
|
||||
<Compile Include="SettingsManagement\UserSettings.cs" />
|
||||
<Compile Include="SliceConfiguration\ActiveSliceSettings.cs" />
|
||||
<Compile Include="SliceConfiguration\SettingsControlBar.cs" />
|
||||
<Compile Include="SliceConfiguration\CuraEnginMappings.cs" />
|
||||
<Compile Include="SliceConfiguration\SliceSettingsLayerSelector.cs" />
|
||||
<Compile Include="SliceConfiguration\SliceSettingsWidget.cs" />
|
||||
<Compile Include="SliceConfiguration\SliceSettingsOrganizer.cs" />
|
||||
<Compile Include="SliceConfiguration\SlicingQueue.cs" />
|
||||
<Compile Include="SlicerConfiguration\ActiveSliceSettings.cs" />
|
||||
<Compile Include="SlicerConfiguration\SettingsControlBar.cs" />
|
||||
<Compile Include="SlicerConfiguration\SliceSettingsLayerSelector.cs" />
|
||||
<Compile Include="SlicerConfiguration\SliceSettingsWidget.cs" />
|
||||
<Compile Include="SlicerConfiguration\SliceSettingsOrganizer.cs" />
|
||||
<Compile Include="SlicerConfiguration\SlicingQueue.cs" />
|
||||
<Compile Include="TupleList.cs" />
|
||||
<Compile Include="FrostedSerial\FrostedSerialPort.cs" />
|
||||
<Compile Include="FrostedSerial\FrostedSerialStream.cs" />
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2013, Lars Brubaker
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -54,6 +54,7 @@ using MatterHackers.MatterControl.DataStorage;
|
|||
using MatterHackers.MatterControl.VersionManagement;
|
||||
using MatterHackers.MatterControl.PluginSystem;
|
||||
using MatterHackers.MatterControl.PartPreviewWindow;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2013, Lars Brubaker
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2013, Lars Brubaker
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -39,6 +39,7 @@ using MatterHackers.Agg;
|
|||
using MatterHackers.Agg.Image;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Agg.OpenGlGui;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
using MatterHackers.PolygonMesh;
|
||||
using MatterHackers.RenderOpenGl;
|
||||
using MatterHackers.VectorMath;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2013, Lars Brubaker
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2013, Lars Brubaker
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -36,6 +36,7 @@ using MatterHackers.Agg.Font;
|
|||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.DataStorage;
|
||||
using MatterHackers.MatterControl.PrintQueue;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
using MatterHackers.VectorMath;
|
||||
|
||||
namespace MatterHackers.MatterControl.PartPreviewWindow
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2013, Lars Brubaker
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2013, Lars Brubaker
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2013, Lars Brubaker
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2013, Lars Brubaker
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -38,6 +38,7 @@ using MatterHackers.Agg.UI;
|
|||
using MatterHackers.VectorMath;
|
||||
using MatterHackers.Agg.Font;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
|
||||
namespace MatterHackers.MatterControl
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ using MatterHackers.Agg.UI;
|
|||
using MatterHackers.MatterControl.DataStorage;
|
||||
using MatterHackers.MatterControl.PrintQueue;
|
||||
using MatterHackers.GCodeVisualizer;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
|
||||
namespace MatterHackers.MatterControl.PrintLibrary
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2013, Lars Brubaker
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2013, Lars Brubaker
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ using MatterHackers.MatterControl.DataStorage;
|
|||
using MatterHackers.MatterControl.PrintQueue;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.GCodeVisualizer;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
|
||||
namespace MatterHackers.MatterControl.PrintQueue
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ using System.IO;
|
|||
|
||||
using MatterHackers.MatterControl.DataStorage;
|
||||
using MatterHackers.MatterControl.PrintQueue;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.GCodeVisualizer;
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ using System.Diagnostics;
|
|||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.MatterControl.DataStorage;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
|
||||
namespace MatterHackers.MatterControl.PrintQueue
|
||||
{
|
||||
|
|
@ -168,10 +169,10 @@ namespace MatterHackers.MatterControl.PrintQueue
|
|||
}
|
||||
|
||||
// check if there is a known line at the end of the file (this will let us know if slicer finished building the file).
|
||||
switch (ActivePrinterProfile.Instance.ActiveSliceEngine)
|
||||
switch (ActivePrinterProfile.Instance.ActiveSliceEngineType)
|
||||
{
|
||||
case ActivePrinterProfile.SlicingEngine.CuraEngine:
|
||||
case ActivePrinterProfile.SlicingEngine.Slic3r:
|
||||
case ActivePrinterProfile.SlicingEngineTypes.CuraEngine:
|
||||
case ActivePrinterProfile.SlicingEngineTypes.Slic3r:
|
||||
if (gcodeFileContents.Contains("filament used ="))
|
||||
{
|
||||
gCodeFileIsComplete = true;
|
||||
|
|
@ -193,7 +194,7 @@ namespace MatterHackers.MatterControl.PrintQueue
|
|||
return FileLocation;
|
||||
}
|
||||
|
||||
string engineString = ((int)ActivePrinterProfile.Instance.ActiveSliceEngine).ToString();
|
||||
string engineString = ((int)ActivePrinterProfile.Instance.ActiveSliceEngineType).ToString();
|
||||
|
||||
string gcodeFileName = this.StlFileHashCode.ToString() + "_" + engineString + "_" + ActiveSliceSettings.Instance.GetHashCode().ToString();
|
||||
string gcodePathAndFileName = Path.Combine(DataStorage.ApplicationDataStorage.Instance.GCodeOutputPath, gcodeFileName + ".gcode");
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2013, Lars Brubaker
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2013, Lars Brubaker
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2013, Kevin Pope
|
||||
Copyright (c) 2014, Kevin Pope
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2013, Lars Brubaker
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2013, Lars Brubaker
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2013, Lars Brubaker
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2013, Lars Brubaker
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ using System.Text;
|
|||
using MatterHackers.VectorMath;
|
||||
using MatterHackers.RayTracer;
|
||||
using MatterHackers.GCodeVisualizer;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
|
||||
namespace MatterHackers.MatterControl
|
||||
{
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
|
|||
string defaultSliceEngine;
|
||||
if (settingsDict.TryGetValue("default_slice_engine", out defaultSliceEngine))
|
||||
{
|
||||
if (Enum.IsDefined(typeof(ActivePrinterProfile.SlicingEngine), defaultSliceEngine))
|
||||
if (Enum.IsDefined(typeof(ActivePrinterProfile.SlicingEngineTypes), defaultSliceEngine))
|
||||
{
|
||||
ActivePrinter.CurrentSlicingEngine = defaultSliceEngine;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2013, Lars Brubaker
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2013, Lars Brubaker
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2013, Lars Brubaker
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -1,480 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using MatterHackers.VectorMath;
|
||||
|
||||
namespace MatterHackers.MatterControl
|
||||
{
|
||||
public static class CuraEngineMappings
|
||||
{
|
||||
public static bool MapContains(string defaultKey)
|
||||
{
|
||||
foreach (MapItem mapItem in curaToDefaultMapping)
|
||||
{
|
||||
if (mapItem.DefaultKey == defaultKey)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static MapItem[] curaToDefaultMapping =
|
||||
{
|
||||
new ScaledSingleNumber("layerThickness", "layer_height", 1000),
|
||||
new AsPercentOfReferenceOrDirect("initialLayerThickness", "first_layer_height", "layer_height", 1000),
|
||||
new ScaledSingleNumber("filamentDiameter", "filament_diameter", 1000),
|
||||
new ScaledSingleNumber("extrusionWidth", "nozzle_diameter", 1000),
|
||||
|
||||
new MapItem("printSpeed", "perimeter_speed"),
|
||||
new MapItem("infillSpeed", "infill_speed"),
|
||||
new MapItem("moveSpeed", "travel_speed"),
|
||||
new AsPercentOfReferenceOrDirect("initialLayerSpeed", "first_layer_speed", "infill_speed"),
|
||||
|
||||
new NotPassedItem("", "temperature"),
|
||||
new NotPassedItem("", "bed_temperature"),
|
||||
new NotPassedItem("", "bed_shape"),
|
||||
|
||||
new MapItem("insetCount", "perimeters"),
|
||||
|
||||
new MapItem("skirtLineCount", "skirts"),
|
||||
new SkirtLengthMaping("skirtMinLength", "min_skirt_length"),
|
||||
new ScaledSingleNumber("skirtDistance", "skirt_distance", 1000),
|
||||
|
||||
new MapItem("fanSpeedMin", "max_fan_speed"),
|
||||
new MapItem("fanSpeedMax", "min_fan_speed"),
|
||||
|
||||
new MapItem("downSkinCount", "bottom_solid_layers"),
|
||||
new MapItem("upSkinCount", "top_solid_layers"),
|
||||
|
||||
new FanTranslator("fanFullOnLayerNr", "disable_fan_first_layers"),
|
||||
new MapItem("coolHeadLift", "cool_extruder_lift"),
|
||||
|
||||
new ScaledSingleNumber("retractionAmount", "retract_length", 1000),
|
||||
new MapItem("retractionSpeed", "retract_speed"),
|
||||
new ScaledSingleNumber("retractionMinimalDistance", "retract_before_travel", 1000),
|
||||
|
||||
new MapItem("spiralizeMode", "spiral_vase"),
|
||||
|
||||
new NotPassedItem("", "bed_size"),
|
||||
|
||||
new PrintCenterX("posx", "print_center"),
|
||||
new PrintCenterY("posy", "print_center"),
|
||||
|
||||
new NotPassedItem("", "build_height"),
|
||||
|
||||
// needs testing, not working
|
||||
new ScaledSingleNumber("supportLineDistance", "support_material_spacing", 1000),
|
||||
new SupportMatterial("supportAngle", "support_material"),
|
||||
new NotPassedItem("", "support_material_threshold"),
|
||||
new MapItem("supportEverywhere", "support_material_create_internal_support"),
|
||||
new ScaledSingleNumber("supportXYDistance", "support_material_xy_distance", 1000),
|
||||
new ScaledSingleNumber("supportZDistance", "support_material_z_distance", 1000),
|
||||
|
||||
new MapItem("minimalLayerTime", "slowdown_below_layer_time"),
|
||||
|
||||
new InfillTranslator("sparseInfillLineDistance", "fill_density"),
|
||||
|
||||
new MapStartGCode("startCode", "start_gcode"),
|
||||
new MapEndGCode("endCode", "end_gcode"),
|
||||
|
||||
#if false
|
||||
SETTING(filamentFlow);
|
||||
SETTING(infillOverlap);
|
||||
|
||||
SETTING(initialSpeedupLayers);
|
||||
|
||||
SETTING(supportExtruder);
|
||||
|
||||
SETTING(retractionAmountExtruderSwitch);
|
||||
SETTING(minimalExtrusionBeforeRetraction);
|
||||
SETTING(enableCombing);
|
||||
SETTING(multiVolumeOverlap);
|
||||
SETTING(objectSink);
|
||||
|
||||
SETTING(raftMargin);
|
||||
SETTING(raftLineSpacing);
|
||||
SETTING(raftBaseThickness);
|
||||
SETTING(raftBaseLinewidth);
|
||||
SETTING(raftInterfaceThickness);
|
||||
SETTING(raftInterfaceLinewidth);
|
||||
|
||||
SETTING(minimalFeedrate);
|
||||
|
||||
fanFullOnLayerNr = 2;
|
||||
|
||||
SETTING(fixHorrible);
|
||||
SETTING(gcodeFlavor);
|
||||
|
||||
/*
|
||||
objectPosition.X = 102500;
|
||||
objectPosition.Y = 102500;
|
||||
enableOozeShield = 0;
|
||||
*/
|
||||
#endif
|
||||
};
|
||||
|
||||
public static string GetCuraCommandLineSettings()
|
||||
{
|
||||
StringBuilder settings = new StringBuilder();
|
||||
for (int i = 0; i < curaToDefaultMapping.Length; i++)
|
||||
{
|
||||
string curaValue = curaToDefaultMapping[i].CuraValue;
|
||||
if(curaValue != null && curaValue != "")
|
||||
{
|
||||
settings.Append(string.Format("-s {0}=\"{1}\" ", curaToDefaultMapping[i].CuraKey, curaValue));
|
||||
}
|
||||
}
|
||||
|
||||
return settings.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public class MapItem
|
||||
{
|
||||
string curaKey;
|
||||
string defaultKey;
|
||||
|
||||
internal MapItem(string curaKey, string defaultKey)
|
||||
{
|
||||
this.curaKey = curaKey;
|
||||
this.defaultKey = defaultKey;
|
||||
}
|
||||
|
||||
public string CuraKey { get { return curaKey; } }
|
||||
public string DefaultKey { get { return defaultKey; } }
|
||||
|
||||
public string SlicerValue { get { return ActiveSliceSettings.Instance.GetActiveValue(defaultKey); } }
|
||||
|
||||
public virtual string CuraValue { get { return SlicerValue; } }
|
||||
}
|
||||
|
||||
public class NotPassedItem : MapItem
|
||||
{
|
||||
public override string CuraValue
|
||||
{
|
||||
get
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public NotPassedItem(string cura, string slicer)
|
||||
: base(cura, slicer)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class FanTranslator : MapItem
|
||||
{
|
||||
public override string CuraValue
|
||||
{
|
||||
get
|
||||
{
|
||||
int numLayersFanIsDisabledOn = int.Parse(base.CuraValue);
|
||||
int layerToEnableFanOn = numLayersFanIsDisabledOn+1;
|
||||
return layerToEnableFanOn.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public FanTranslator(string cura, string slicer)
|
||||
: base(cura, slicer)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class SupportMatterial : MapItem
|
||||
{
|
||||
public override string CuraValue
|
||||
{
|
||||
get
|
||||
{
|
||||
string supportMaterial = ActiveSliceSettings.Instance.GetActiveValue("support_material");
|
||||
if (supportMaterial == "0")
|
||||
{
|
||||
return "-1";
|
||||
}
|
||||
|
||||
return (90 - double.Parse(ActiveSliceSettings.Instance.GetActiveValue("support_material_threshold"))).ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public SupportMatterial(string cura, string slicer)
|
||||
: base(cura, slicer)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class InfillTranslator : MapItem
|
||||
{
|
||||
public override string CuraValue
|
||||
{
|
||||
get
|
||||
{
|
||||
double infillRatio0To1 = Double.Parse(base.CuraValue);
|
||||
// 400 = solid (extruder width)
|
||||
double nozzle_diameter = double.Parse(ActiveSliceSettings.Instance.GetActiveValue("nozzle_diameter"));
|
||||
double linespacing = 1000;
|
||||
if (infillRatio0To1 > .01)
|
||||
{
|
||||
linespacing = nozzle_diameter / infillRatio0To1;
|
||||
}
|
||||
|
||||
return ((int)(linespacing * 1000)).ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public InfillTranslator(string cura, string slicer)
|
||||
: base(cura, slicer)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class PrintCenterX : MapItem
|
||||
{
|
||||
public override string CuraValue
|
||||
{
|
||||
get
|
||||
{
|
||||
Vector2 PrinteCenter = ActiveSliceSettings.Instance.PrintCenter;
|
||||
return (PrinteCenter.x * 1000).ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public PrintCenterX(string cura, string slicer)
|
||||
: base(cura, slicer)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class PrintCenterY : MapItem
|
||||
{
|
||||
public override string CuraValue
|
||||
{
|
||||
get
|
||||
{
|
||||
Vector2 PrinteCenter = ActiveSliceSettings.Instance.PrintCenter;
|
||||
return (PrinteCenter.y * 1000).ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public PrintCenterY(string cura, string slicer)
|
||||
: base(cura, slicer)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class ConvertCRs : MapItem
|
||||
{
|
||||
public override string CuraValue
|
||||
{
|
||||
get
|
||||
{
|
||||
string actualCRs = base.CuraValue.Replace("\\n", "\n");
|
||||
return actualCRs;
|
||||
}
|
||||
}
|
||||
|
||||
public ConvertCRs(string cura, string slicer)
|
||||
: base(cura, slicer)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class InjectGCodeCommands : ConvertCRs
|
||||
{
|
||||
public InjectGCodeCommands(string cura, string slicer)
|
||||
: base(cura, slicer)
|
||||
{
|
||||
}
|
||||
|
||||
protected void AddDefaultIfNotPresent(List<string> linesAdded, string commandToAdd, string[] linesToCheckIfAlreadyPresent, string comment)
|
||||
{
|
||||
string command = commandToAdd.Split(' ')[0].Trim();
|
||||
bool foundCommand = false;
|
||||
foreach (string line in linesToCheckIfAlreadyPresent)
|
||||
{
|
||||
if (line.StartsWith(command))
|
||||
{
|
||||
foundCommand = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundCommand)
|
||||
{
|
||||
linesAdded.Add(string.Format("{0} ; {1}", commandToAdd, comment));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class MapStartGCode : InjectGCodeCommands
|
||||
{
|
||||
public override string CuraValue
|
||||
{
|
||||
get
|
||||
{
|
||||
StringBuilder curaStartGCode = new StringBuilder();
|
||||
foreach (string line in PreStartGCode())
|
||||
{
|
||||
curaStartGCode.Append(line + "\n");
|
||||
}
|
||||
|
||||
curaStartGCode.Append(base.CuraValue);
|
||||
|
||||
bool first = true;
|
||||
foreach (string line in PostStartGCode())
|
||||
{
|
||||
if (!first)
|
||||
{
|
||||
curaStartGCode.Append("\n");
|
||||
}
|
||||
curaStartGCode.Append(line);
|
||||
first = false;
|
||||
}
|
||||
|
||||
return curaStartGCode.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public MapStartGCode(string cura, string slicer)
|
||||
: base(cura, slicer)
|
||||
{
|
||||
}
|
||||
|
||||
public List<string> PreStartGCode()
|
||||
{
|
||||
string startGCode = ActiveSliceSettings.Instance.GetActiveValue("start_gcode");
|
||||
string[] preStartGCodeLines = startGCode.Split(new string[] {"\\n"}, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
List<string> preStartGCode = new List<string>();
|
||||
preStartGCode.Add("; automatic settings before start_gcode");
|
||||
AddDefaultIfNotPresent(preStartGCode, "G21", preStartGCodeLines, "set units to millimeters");
|
||||
AddDefaultIfNotPresent(preStartGCode, "M107", preStartGCodeLines, "fan off");
|
||||
double bed_temperature = double.Parse(ActiveSliceSettings.Instance.GetActiveValue("bed_temperature"));
|
||||
if (bed_temperature > 0)
|
||||
{
|
||||
string setBedTempString = string.Format("M190 S{0}", bed_temperature);
|
||||
AddDefaultIfNotPresent(preStartGCode, setBedTempString, preStartGCodeLines, "wait for bed temperature to be reached");
|
||||
}
|
||||
string setTempString = string.Format("M104 S{0}", ActiveSliceSettings.Instance.GetActiveValue("temperature"));
|
||||
AddDefaultIfNotPresent(preStartGCode, setTempString, preStartGCodeLines, "set temperature");
|
||||
preStartGCode.Add("; settings from start_gcode");
|
||||
|
||||
return preStartGCode;
|
||||
}
|
||||
|
||||
public List<string> PostStartGCode()
|
||||
{
|
||||
string startGCode = ActiveSliceSettings.Instance.GetActiveValue("start_gcode");
|
||||
string[] postStartGCodeLines = startGCode.Split(new string[] { "\\n" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
List<string> postStartGCode = new List<string>();
|
||||
postStartGCode.Add("; automatic settings after start_gcode");
|
||||
string setTempString = string.Format("M109 S{0}", ActiveSliceSettings.Instance.GetActiveValue("temperature"));
|
||||
AddDefaultIfNotPresent(postStartGCode, setTempString, postStartGCodeLines, "wait for temperature");
|
||||
AddDefaultIfNotPresent(postStartGCode, "G90", postStartGCodeLines, "use absolute coordinates");
|
||||
postStartGCode.Add(string.Format("{0} ; {1}", "G92 E0", "reset the expected extruder position"));
|
||||
AddDefaultIfNotPresent(postStartGCode, "M82", postStartGCodeLines, "use absolute distance for extrusion");
|
||||
|
||||
return postStartGCode;
|
||||
}
|
||||
}
|
||||
|
||||
public class MapEndGCode : InjectGCodeCommands
|
||||
{
|
||||
public override string CuraValue
|
||||
{
|
||||
get
|
||||
{
|
||||
StringBuilder curaEndGCode = new StringBuilder();
|
||||
|
||||
curaEndGCode.Append(base.CuraValue);
|
||||
|
||||
curaEndGCode.Append("\n; filament used = filament_used_replace_mm (filament_used_replace_cm3)");
|
||||
|
||||
return curaEndGCode.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public MapEndGCode(string cura, string slicer)
|
||||
: base(cura, slicer)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class SkirtLengthMaping : MapItem
|
||||
{
|
||||
public SkirtLengthMaping(string curaKey, string defaultKey)
|
||||
: base(curaKey, defaultKey)
|
||||
{
|
||||
}
|
||||
|
||||
public override string CuraValue
|
||||
{
|
||||
get
|
||||
{
|
||||
double lengthToExtrudeMm = double.Parse(base.CuraValue);
|
||||
// we need to convert mm of filament to mm of extrusion path
|
||||
double amountOfFilamentCubicMms = ActiveSliceSettings.Instance.FillamentDiameter * MathHelper.Tau * lengthToExtrudeMm;
|
||||
double extrusionSquareSize = ActiveSliceSettings.Instance.FirstLayerHeight * ActiveSliceSettings.Instance.NozzleDiameter;
|
||||
double lineLength = amountOfFilamentCubicMms / extrusionSquareSize;
|
||||
|
||||
return (lineLength * 1000).ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class ScaledSingleNumber : MapItem
|
||||
{
|
||||
internal double scale;
|
||||
public override string CuraValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (scale != 1)
|
||||
{
|
||||
return (double.Parse(base.CuraValue) * scale).ToString();
|
||||
}
|
||||
return base.CuraValue;
|
||||
}
|
||||
}
|
||||
|
||||
internal ScaledSingleNumber(string cura, string slicer, double scale = 1)
|
||||
: base(cura, slicer)
|
||||
{
|
||||
this.scale = scale;
|
||||
}
|
||||
}
|
||||
|
||||
public class AsPercentOfReferenceOrDirect : ScaledSingleNumber
|
||||
{
|
||||
internal string slicerReference;
|
||||
public override string CuraValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (SlicerValue.Contains("%"))
|
||||
{
|
||||
string withoutPercent = SlicerValue.Replace("%", "");
|
||||
double ratio = double.Parse(withoutPercent) / 100.0;
|
||||
string slicerReferenceString = ActiveSliceSettings.Instance.GetActiveValue(slicerReference);
|
||||
double valueToModify = double.Parse(slicerReferenceString);
|
||||
double finalValue = valueToModify * ratio * scale;
|
||||
return finalValue.ToString();
|
||||
}
|
||||
|
||||
return base.CuraValue;
|
||||
}
|
||||
}
|
||||
|
||||
internal AsPercentOfReferenceOrDirect(string cura, string slicer, string slicerReference, double scale = 1)
|
||||
: base(cura, slicer, scale)
|
||||
{
|
||||
this.slicerReference = slicerReference;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,33 @@
|
|||
using System;
|
||||
/*
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Diagnostics;
|
||||
|
|
@ -12,7 +41,7 @@ using MatterHackers.MatterControl.ContactForm;
|
|||
using MatterHackers.MatterControl.DataStorage;
|
||||
using MatterHackers.Localizations;
|
||||
|
||||
namespace MatterHackers.MatterControl
|
||||
namespace MatterHackers.MatterControl.SlicerConfiguration
|
||||
{
|
||||
public class SettingsLayer
|
||||
{
|
||||
|
|
@ -13,7 +13,7 @@ using MatterHackers.Agg.UI;
|
|||
using MatterHackers.VectorMath;
|
||||
using MatterHackers.Localizations;
|
||||
|
||||
namespace MatterHackers.MatterControl
|
||||
namespace MatterHackers.MatterControl.SlicerConfiguration
|
||||
{
|
||||
public class SettingsControlBar : FlowLayoutWidget
|
||||
{
|
||||
|
|
@ -135,17 +135,17 @@ namespace MatterHackers.MatterControl
|
|||
StyledDropDownList engineMenuDropList = new StyledDropDownList("Engine ");
|
||||
engineMenuDropList.Margin = new BorderDouble(top: 3, left:0);
|
||||
{
|
||||
MenuItem slic3rMenuItem = engineMenuDropList.AddItem(ActivePrinterProfile.SlicingEngine.Slic3r.ToString());
|
||||
MenuItem slic3rMenuItem = engineMenuDropList.AddItem(ActivePrinterProfile.SlicingEngineTypes.Slic3r.ToString());
|
||||
slic3rMenuItem.Selected += (sender, e) =>
|
||||
{
|
||||
ActivePrinterProfile.Instance.ActiveSliceEngine = ActivePrinterProfile.SlicingEngine.Slic3r;
|
||||
ActivePrinterProfile.Instance.ActiveSliceEngineType = ActivePrinterProfile.SlicingEngineTypes.Slic3r;
|
||||
MainSlidePanel.Instance.ReloadBackPanel();
|
||||
};
|
||||
|
||||
MenuItem curaEnginMenuItem = engineMenuDropList.AddItem(ActivePrinterProfile.SlicingEngine.CuraEngine.ToString());
|
||||
MenuItem curaEnginMenuItem = engineMenuDropList.AddItem(ActivePrinterProfile.SlicingEngineTypes.CuraEngine.ToString());
|
||||
curaEnginMenuItem.Selected += (sender, e) =>
|
||||
{
|
||||
ActivePrinterProfile.Instance.ActiveSliceEngine = ActivePrinterProfile.SlicingEngine.CuraEngine;
|
||||
ActivePrinterProfile.Instance.ActiveSliceEngineType = ActivePrinterProfile.SlicingEngineTypes.CuraEngine;
|
||||
MainSlidePanel.Instance.ReloadBackPanel();
|
||||
};
|
||||
|
||||
|
|
@ -158,7 +158,7 @@ namespace MatterHackers.MatterControl
|
|||
};
|
||||
#endif
|
||||
|
||||
engineMenuDropList.SelectedValue = ActivePrinterProfile.Instance.ActiveSliceEngine.ToString();
|
||||
engineMenuDropList.SelectedValue = ActivePrinterProfile.Instance.ActiveSliceEngineType.ToString();
|
||||
}
|
||||
engineMenuDropList.MinimumSize = new Vector2(engineMenuDropList.LocalBounds.Width, engineMenuDropList.LocalBounds.Height);
|
||||
return engineMenuDropList;
|
||||
|
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MatterHackers.MatterControl
|
||||
namespace MatterHackers.MatterControl.SlicerConfiguration
|
||||
{
|
||||
class SliceSettingsLayerSelector
|
||||
{
|
||||
|
|
@ -15,7 +15,7 @@ using MatterHackers.VectorMath;
|
|||
using MatterHackers.MatterControl.DataStorage;
|
||||
using MatterHackers.Localizations;
|
||||
|
||||
namespace MatterHackers.MatterControl
|
||||
namespace MatterHackers.MatterControl.SlicerConfiguration
|
||||
{
|
||||
public class OrganizerSettingsData
|
||||
{
|
||||
|
|
@ -1,12 +1,42 @@
|
|||
using System;
|
||||
/*
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.Font;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.VectorMath;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
|
||||
namespace MatterHackers.MatterControl
|
||||
namespace MatterHackers.MatterControl.SlicerConfiguration
|
||||
{
|
||||
public class SliceSettingsWidget : GuiWidget
|
||||
{
|
||||
|
|
@ -144,7 +174,7 @@ namespace MatterHackers.MatterControl
|
|||
categoryPage.AddChild(sideTabs);
|
||||
}
|
||||
|
||||
if (showAllDetails.Checked && ActivePrinterProfile.Instance.ActiveSliceEngine == ActivePrinterProfile.SlicingEngine.Slic3r)
|
||||
if (showAllDetails.Checked && ActivePrinterProfile.Instance.ActiveSliceEngineType == ActivePrinterProfile.SlicingEngineTypes.Slic3r)
|
||||
{
|
||||
TabPage extraSettingsPage = new TabPage("Other");
|
||||
SimpleTextTabWidget extraSettingsTextTabWidget = new SimpleTextTabWidget(extraSettingsPage, 16,
|
||||
|
|
@ -295,8 +325,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
foreach (OrganizerSettingsData settingInfo in subGroup.SettingDataList)
|
||||
{
|
||||
if (ActivePrinterProfile.Instance.ActiveSliceEngine == ActivePrinterProfile.SlicingEngine.Slic3r
|
||||
|| CuraEngineMappings.MapContains(settingInfo.SlicerConfigName))
|
||||
if (ActivePrinterProfile.Instance.ActiveSliceEngine.MapContains(settingInfo.SlicerConfigName))
|
||||
{
|
||||
addedSettingToSubGroup = true;
|
||||
GuiWidget controlsForThisSetting = CreateSettingInfoUIControls(settingInfo, minSettingNameWidth);
|
||||
41
SlicerConfiguration/SlicerMapping/EngineMapingBase.cs
Normal file
41
SlicerConfiguration/SlicerMapping/EngineMapingBase.cs
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MatterHackers.MatterControl.SlicerConfiguration
|
||||
{
|
||||
public abstract class SliceEngineMaping
|
||||
{
|
||||
public abstract bool MapContains(string defaultKey);
|
||||
}
|
||||
}
|
||||
509
SlicerConfiguration/SlicerMapping/EngineMappingCura.cs
Normal file
509
SlicerConfiguration/SlicerMapping/EngineMappingCura.cs
Normal file
|
|
@ -0,0 +1,509 @@
|
|||
/*
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using MatterHackers.VectorMath;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
|
||||
namespace MatterHackers.MatterControl.SlicerConfiguration
|
||||
{
|
||||
public class CuraEngineMappings : SliceEngineMaping
|
||||
{
|
||||
// private so that this class is a sigleton
|
||||
CuraEngineMappings()
|
||||
{
|
||||
}
|
||||
|
||||
static CuraEngineMappings instance = null;
|
||||
public static CuraEngineMappings Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
instance = new CuraEngineMappings();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool MapContains(string defaultKey)
|
||||
{
|
||||
foreach (MapItem mapItem in curaToDefaultMapping)
|
||||
{
|
||||
if (mapItem.DefaultKey == defaultKey)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static MapItem[] curaToDefaultMapping =
|
||||
{
|
||||
new ScaledSingleNumber("layerThickness", "layer_height", 1000),
|
||||
new AsPercentOfReferenceOrDirect("initialLayerThickness", "first_layer_height", "layer_height", 1000),
|
||||
new ScaledSingleNumber("filamentDiameter", "filament_diameter", 1000),
|
||||
new ScaledSingleNumber("extrusionWidth", "nozzle_diameter", 1000),
|
||||
|
||||
new MapItem("printSpeed", "perimeter_speed"),
|
||||
new MapItem("infillSpeed", "infill_speed"),
|
||||
new MapItem("moveSpeed", "travel_speed"),
|
||||
new AsPercentOfReferenceOrDirect("initialLayerSpeed", "first_layer_speed", "infill_speed"),
|
||||
|
||||
new NotPassedItem("", "temperature"),
|
||||
new NotPassedItem("", "bed_temperature"),
|
||||
new NotPassedItem("", "bed_shape"),
|
||||
|
||||
new MapItem("insetCount", "perimeters"),
|
||||
|
||||
new MapItem("skirtLineCount", "skirts"),
|
||||
new SkirtLengthMaping("skirtMinLength", "min_skirt_length"),
|
||||
new ScaledSingleNumber("skirtDistance", "skirt_distance", 1000),
|
||||
|
||||
new MapItem("fanSpeedMin", "max_fan_speed"),
|
||||
new MapItem("fanSpeedMax", "min_fan_speed"),
|
||||
|
||||
new MapItem("downSkinCount", "bottom_solid_layers"),
|
||||
new MapItem("upSkinCount", "top_solid_layers"),
|
||||
|
||||
new FanTranslator("fanFullOnLayerNr", "disable_fan_first_layers"),
|
||||
new MapItem("coolHeadLift", "cool_extruder_lift"),
|
||||
|
||||
new ScaledSingleNumber("retractionAmount", "retract_length", 1000),
|
||||
new MapItem("retractionSpeed", "retract_speed"),
|
||||
new ScaledSingleNumber("retractionMinimalDistance", "retract_before_travel", 1000),
|
||||
|
||||
new MapItem("spiralizeMode", "spiral_vase"),
|
||||
|
||||
new NotPassedItem("", "bed_size"),
|
||||
|
||||
new PrintCenterX("posx", "print_center"),
|
||||
new PrintCenterY("posy", "print_center"),
|
||||
|
||||
new NotPassedItem("", "build_height"),
|
||||
|
||||
// needs testing, not working
|
||||
new ScaledSingleNumber("supportLineDistance", "support_material_spacing", 1000),
|
||||
new SupportMatterial("supportAngle", "support_material"),
|
||||
new NotPassedItem("", "support_material_threshold"),
|
||||
new MapItem("supportEverywhere", "support_material_create_internal_support"),
|
||||
new ScaledSingleNumber("supportXYDistance", "support_material_xy_distance", 1000),
|
||||
new ScaledSingleNumber("supportZDistance", "support_material_z_distance", 1000),
|
||||
|
||||
new MapItem("minimalLayerTime", "slowdown_below_layer_time"),
|
||||
|
||||
new InfillTranslator("sparseInfillLineDistance", "fill_density"),
|
||||
|
||||
new MapStartGCode("startCode", "start_gcode"),
|
||||
new MapEndGCode("endCode", "end_gcode"),
|
||||
|
||||
#if false
|
||||
SETTING(filamentFlow);
|
||||
SETTING(infillOverlap);
|
||||
|
||||
SETTING(initialSpeedupLayers);
|
||||
|
||||
SETTING(supportExtruder);
|
||||
|
||||
SETTING(retractionAmountExtruderSwitch);
|
||||
SETTING(minimalExtrusionBeforeRetraction);
|
||||
SETTING(enableCombing);
|
||||
SETTING(multiVolumeOverlap);
|
||||
SETTING(objectSink);
|
||||
|
||||
SETTING(raftMargin);
|
||||
SETTING(raftLineSpacing);
|
||||
SETTING(raftBaseThickness);
|
||||
SETTING(raftBaseLinewidth);
|
||||
SETTING(raftInterfaceThickness);
|
||||
SETTING(raftInterfaceLinewidth);
|
||||
|
||||
SETTING(minimalFeedrate);
|
||||
|
||||
fanFullOnLayerNr = 2;
|
||||
|
||||
SETTING(fixHorrible);
|
||||
SETTING(gcodeFlavor);
|
||||
|
||||
/*
|
||||
objectPosition.X = 102500;
|
||||
objectPosition.Y = 102500;
|
||||
enableOozeShield = 0;
|
||||
*/
|
||||
#endif
|
||||
};
|
||||
|
||||
public static string GetCuraCommandLineSettings()
|
||||
{
|
||||
StringBuilder settings = new StringBuilder();
|
||||
for (int i = 0; i < curaToDefaultMapping.Length; i++)
|
||||
{
|
||||
string curaValue = curaToDefaultMapping[i].CuraValue;
|
||||
if (curaValue != null && curaValue != "")
|
||||
{
|
||||
settings.Append(string.Format("-s {0}=\"{1}\" ", curaToDefaultMapping[i].CuraKey, curaValue));
|
||||
}
|
||||
}
|
||||
|
||||
return settings.ToString();
|
||||
}
|
||||
|
||||
public class NotPassedItem : MapItem
|
||||
{
|
||||
public override string CuraValue
|
||||
{
|
||||
get
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public NotPassedItem(string cura, string slicer)
|
||||
: base(cura, slicer)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class FanTranslator : MapItem
|
||||
{
|
||||
public override string CuraValue
|
||||
{
|
||||
get
|
||||
{
|
||||
int numLayersFanIsDisabledOn = int.Parse(base.CuraValue);
|
||||
int layerToEnableFanOn = numLayersFanIsDisabledOn + 1;
|
||||
return layerToEnableFanOn.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public FanTranslator(string cura, string slicer)
|
||||
: base(cura, slicer)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class SupportMatterial : MapItem
|
||||
{
|
||||
public override string CuraValue
|
||||
{
|
||||
get
|
||||
{
|
||||
string supportMaterial = ActiveSliceSettings.Instance.GetActiveValue("support_material");
|
||||
if (supportMaterial == "0")
|
||||
{
|
||||
return "-1";
|
||||
}
|
||||
|
||||
return (90 - double.Parse(ActiveSliceSettings.Instance.GetActiveValue("support_material_threshold"))).ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public SupportMatterial(string cura, string slicer)
|
||||
: base(cura, slicer)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class InfillTranslator : MapItem
|
||||
{
|
||||
public override string CuraValue
|
||||
{
|
||||
get
|
||||
{
|
||||
double infillRatio0To1 = Double.Parse(base.CuraValue);
|
||||
// 400 = solid (extruder width)
|
||||
double nozzle_diameter = double.Parse(ActiveSliceSettings.Instance.GetActiveValue("nozzle_diameter"));
|
||||
double linespacing = 1000;
|
||||
if (infillRatio0To1 > .01)
|
||||
{
|
||||
linespacing = nozzle_diameter / infillRatio0To1;
|
||||
}
|
||||
|
||||
return ((int)(linespacing * 1000)).ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public InfillTranslator(string cura, string slicer)
|
||||
: base(cura, slicer)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class PrintCenterX : MapItem
|
||||
{
|
||||
public override string CuraValue
|
||||
{
|
||||
get
|
||||
{
|
||||
Vector2 PrinteCenter = ActiveSliceSettings.Instance.PrintCenter;
|
||||
return (PrinteCenter.x * 1000).ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public PrintCenterX(string cura, string slicer)
|
||||
: base(cura, slicer)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class PrintCenterY : MapItem
|
||||
{
|
||||
public override string CuraValue
|
||||
{
|
||||
get
|
||||
{
|
||||
Vector2 PrinteCenter = ActiveSliceSettings.Instance.PrintCenter;
|
||||
return (PrinteCenter.y * 1000).ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public PrintCenterY(string cura, string slicer)
|
||||
: base(cura, slicer)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class ConvertCRs : MapItem
|
||||
{
|
||||
public override string CuraValue
|
||||
{
|
||||
get
|
||||
{
|
||||
string actualCRs = base.CuraValue.Replace("\\n", "\n");
|
||||
return actualCRs;
|
||||
}
|
||||
}
|
||||
|
||||
public ConvertCRs(string cura, string slicer)
|
||||
: base(cura, slicer)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class InjectGCodeCommands : ConvertCRs
|
||||
{
|
||||
public InjectGCodeCommands(string cura, string slicer)
|
||||
: base(cura, slicer)
|
||||
{
|
||||
}
|
||||
|
||||
protected void AddDefaultIfNotPresent(List<string> linesAdded, string commandToAdd, string[] linesToCheckIfAlreadyPresent, string comment)
|
||||
{
|
||||
string command = commandToAdd.Split(' ')[0].Trim();
|
||||
bool foundCommand = false;
|
||||
foreach (string line in linesToCheckIfAlreadyPresent)
|
||||
{
|
||||
if (line.StartsWith(command))
|
||||
{
|
||||
foundCommand = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundCommand)
|
||||
{
|
||||
linesAdded.Add(string.Format("{0} ; {1}", commandToAdd, comment));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class MapStartGCode : InjectGCodeCommands
|
||||
{
|
||||
public override string CuraValue
|
||||
{
|
||||
get
|
||||
{
|
||||
StringBuilder curaStartGCode = new StringBuilder();
|
||||
foreach (string line in PreStartGCode())
|
||||
{
|
||||
curaStartGCode.Append(line + "\n");
|
||||
}
|
||||
|
||||
curaStartGCode.Append(base.CuraValue);
|
||||
|
||||
bool first = true;
|
||||
foreach (string line in PostStartGCode())
|
||||
{
|
||||
if (!first)
|
||||
{
|
||||
curaStartGCode.Append("\n");
|
||||
}
|
||||
curaStartGCode.Append(line);
|
||||
first = false;
|
||||
}
|
||||
|
||||
return curaStartGCode.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public MapStartGCode(string cura, string slicer)
|
||||
: base(cura, slicer)
|
||||
{
|
||||
}
|
||||
|
||||
public List<string> PreStartGCode()
|
||||
{
|
||||
string startGCode = ActiveSliceSettings.Instance.GetActiveValue("start_gcode");
|
||||
string[] preStartGCodeLines = startGCode.Split(new string[] { "\\n" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
List<string> preStartGCode = new List<string>();
|
||||
preStartGCode.Add("; automatic settings before start_gcode");
|
||||
AddDefaultIfNotPresent(preStartGCode, "G21", preStartGCodeLines, "set units to millimeters");
|
||||
AddDefaultIfNotPresent(preStartGCode, "M107", preStartGCodeLines, "fan off");
|
||||
double bed_temperature = double.Parse(ActiveSliceSettings.Instance.GetActiveValue("bed_temperature"));
|
||||
if (bed_temperature > 0)
|
||||
{
|
||||
string setBedTempString = string.Format("M190 S{0}", bed_temperature);
|
||||
AddDefaultIfNotPresent(preStartGCode, setBedTempString, preStartGCodeLines, "wait for bed temperature to be reached");
|
||||
}
|
||||
string setTempString = string.Format("M104 S{0}", ActiveSliceSettings.Instance.GetActiveValue("temperature"));
|
||||
AddDefaultIfNotPresent(preStartGCode, setTempString, preStartGCodeLines, "set temperature");
|
||||
preStartGCode.Add("; settings from start_gcode");
|
||||
|
||||
return preStartGCode;
|
||||
}
|
||||
|
||||
public List<string> PostStartGCode()
|
||||
{
|
||||
string startGCode = ActiveSliceSettings.Instance.GetActiveValue("start_gcode");
|
||||
string[] postStartGCodeLines = startGCode.Split(new string[] { "\\n" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
List<string> postStartGCode = new List<string>();
|
||||
postStartGCode.Add("; automatic settings after start_gcode");
|
||||
string setTempString = string.Format("M109 S{0}", ActiveSliceSettings.Instance.GetActiveValue("temperature"));
|
||||
AddDefaultIfNotPresent(postStartGCode, setTempString, postStartGCodeLines, "wait for temperature");
|
||||
AddDefaultIfNotPresent(postStartGCode, "G90", postStartGCodeLines, "use absolute coordinates");
|
||||
postStartGCode.Add(string.Format("{0} ; {1}", "G92 E0", "reset the expected extruder position"));
|
||||
AddDefaultIfNotPresent(postStartGCode, "M82", postStartGCodeLines, "use absolute distance for extrusion");
|
||||
|
||||
return postStartGCode;
|
||||
}
|
||||
}
|
||||
|
||||
public class MapEndGCode : InjectGCodeCommands
|
||||
{
|
||||
public override string CuraValue
|
||||
{
|
||||
get
|
||||
{
|
||||
StringBuilder curaEndGCode = new StringBuilder();
|
||||
|
||||
curaEndGCode.Append(base.CuraValue);
|
||||
|
||||
curaEndGCode.Append("\n; filament used = filament_used_replace_mm (filament_used_replace_cm3)");
|
||||
|
||||
return curaEndGCode.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public MapEndGCode(string cura, string slicer)
|
||||
: base(cura, slicer)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class SkirtLengthMaping : MapItem
|
||||
{
|
||||
public SkirtLengthMaping(string curaKey, string defaultKey)
|
||||
: base(curaKey, defaultKey)
|
||||
{
|
||||
}
|
||||
|
||||
public override string CuraValue
|
||||
{
|
||||
get
|
||||
{
|
||||
double lengthToExtrudeMm = double.Parse(base.CuraValue);
|
||||
// we need to convert mm of filament to mm of extrusion path
|
||||
double amountOfFilamentCubicMms = ActiveSliceSettings.Instance.FillamentDiameter * MathHelper.Tau * lengthToExtrudeMm;
|
||||
double extrusionSquareSize = ActiveSliceSettings.Instance.FirstLayerHeight * ActiveSliceSettings.Instance.NozzleDiameter;
|
||||
double lineLength = amountOfFilamentCubicMms / extrusionSquareSize;
|
||||
|
||||
return (lineLength * 1000).ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class ScaledSingleNumber : MapItem
|
||||
{
|
||||
internal double scale;
|
||||
public override string CuraValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (scale != 1)
|
||||
{
|
||||
return (double.Parse(base.CuraValue) * scale).ToString();
|
||||
}
|
||||
return base.CuraValue;
|
||||
}
|
||||
}
|
||||
|
||||
internal ScaledSingleNumber(string cura, string slicer, double scale = 1)
|
||||
: base(cura, slicer)
|
||||
{
|
||||
this.scale = scale;
|
||||
}
|
||||
}
|
||||
|
||||
public class AsPercentOfReferenceOrDirect : ScaledSingleNumber
|
||||
{
|
||||
internal string slicerReference;
|
||||
public override string CuraValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (SlicerValue.Contains("%"))
|
||||
{
|
||||
string withoutPercent = SlicerValue.Replace("%", "");
|
||||
double ratio = double.Parse(withoutPercent) / 100.0;
|
||||
string slicerReferenceString = ActiveSliceSettings.Instance.GetActiveValue(slicerReference);
|
||||
double valueToModify = double.Parse(slicerReferenceString);
|
||||
double finalValue = valueToModify * ratio * scale;
|
||||
return finalValue.ToString();
|
||||
}
|
||||
|
||||
return base.CuraValue;
|
||||
}
|
||||
}
|
||||
|
||||
internal AsPercentOfReferenceOrDirect(string cura, string slicer, string slicerReference, double scale = 1)
|
||||
: base(cura, slicer, scale)
|
||||
{
|
||||
this.slicerReference = slicerReference;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
73
SlicerConfiguration/SlicerMapping/EngineMappingSlic3r.cs
Normal file
73
SlicerConfiguration/SlicerMapping/EngineMappingSlic3r.cs
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using MatterHackers.VectorMath;
|
||||
|
||||
namespace MatterHackers.MatterControl.SlicerConfiguration
|
||||
{
|
||||
public class Slic3rEngineMappings : SliceEngineMaping
|
||||
{
|
||||
static List<string> hideItems = null;
|
||||
|
||||
// private so that this class is a sigleton
|
||||
Slic3rEngineMappings()
|
||||
{
|
||||
}
|
||||
|
||||
static Slic3rEngineMappings instance = null;
|
||||
public static Slic3rEngineMappings Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
instance = new Slic3rEngineMappings();
|
||||
hideItems = new List<string>();
|
||||
hideItems.Add("cool_extruder_lift");
|
||||
hideItems.Add("support_material_create_internal_support");
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool MapContains(string defaultKey)
|
||||
{
|
||||
if (hideItems.Contains(defaultKey))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
27
SlicerConfiguration/SlicerMapping/MappingClasses.cs
Normal file
27
SlicerConfiguration/SlicerMapping/MappingClasses.cs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using MatterHackers.MatterControl;
|
||||
|
||||
namespace MatterHackers.MatterControl.SlicerConfiguration
|
||||
{
|
||||
public class MapItem
|
||||
{
|
||||
string curaKey;
|
||||
string defaultKey;
|
||||
|
||||
internal MapItem(string curaKey, string defaultKey)
|
||||
{
|
||||
this.curaKey = curaKey;
|
||||
this.defaultKey = defaultKey;
|
||||
}
|
||||
|
||||
public string CuraKey { get { return curaKey; } }
|
||||
public string DefaultKey { get { return defaultKey; } }
|
||||
|
||||
public string SlicerValue { get { return ActiveSliceSettings.Instance.GetActiveValue(defaultKey); } }
|
||||
|
||||
public virtual string CuraValue { get { return SlicerValue; } }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,33 @@
|
|||
using System;
|
||||
/*
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
|
@ -13,7 +42,7 @@ using MatterHackers.MatterControl.PrintQueue;
|
|||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Localizations;
|
||||
|
||||
namespace MatterHackers.MatterControl
|
||||
namespace MatterHackers.MatterControl.SlicerConfiguration
|
||||
{
|
||||
public class SlicingQueue
|
||||
{
|
||||
|
|
@ -77,9 +106,9 @@ namespace MatterHackers.MatterControl
|
|||
switch (MatterHackers.Agg.UI.WindowsFormsAbstract.GetOSType())
|
||||
{
|
||||
case Agg.UI.WindowsFormsAbstract.OSType.Windows:
|
||||
switch (ActivePrinterProfile.Instance.ActiveSliceEngine)
|
||||
switch (ActivePrinterProfile.Instance.ActiveSliceEngineType)
|
||||
{
|
||||
case ActivePrinterProfile.SlicingEngine.Slic3r:
|
||||
case ActivePrinterProfile.SlicingEngineTypes.Slic3r:
|
||||
{
|
||||
string slic3rRelativePath = Path.Combine("..", "Slic3r", "slic3r.exe");
|
||||
if (!File.Exists(slic3rRelativePath))
|
||||
|
|
@ -89,7 +118,7 @@ namespace MatterHackers.MatterControl
|
|||
return System.IO.Path.GetFullPath(slic3rRelativePath);
|
||||
}
|
||||
|
||||
case ActivePrinterProfile.SlicingEngine.CuraEngine:
|
||||
case ActivePrinterProfile.SlicingEngineTypes.CuraEngine:
|
||||
{
|
||||
string curaEngineRelativePath = Path.Combine("..", "CuraEngine.exe");
|
||||
if (!File.Exists(curaEngineRelativePath))
|
||||
|
|
@ -99,7 +128,7 @@ namespace MatterHackers.MatterControl
|
|||
return System.IO.Path.GetFullPath(curaEngineRelativePath);
|
||||
}
|
||||
|
||||
case ActivePrinterProfile.SlicingEngine.MatterSlice:
|
||||
case ActivePrinterProfile.SlicingEngineTypes.MatterSlice:
|
||||
{
|
||||
string materSliceRelativePath = Path.Combine(".", "MatterSlice.exe");
|
||||
return System.IO.Path.GetFullPath(materSliceRelativePath);
|
||||
|
|
@ -110,15 +139,15 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
|
||||
case Agg.UI.WindowsFormsAbstract.OSType.Mac:
|
||||
switch (ActivePrinterProfile.Instance.ActiveSliceEngine)
|
||||
switch (ActivePrinterProfile.Instance.ActiveSliceEngineType)
|
||||
{
|
||||
case ActivePrinterProfile.SlicingEngine.Slic3r:
|
||||
case ActivePrinterProfile.SlicingEngineTypes.Slic3r:
|
||||
{
|
||||
//string parentLocation = Directory.GetParent (ApplicationDataStorage.Instance.ApplicationPath).ToString ();
|
||||
string applicationPath = System.IO.Path.Combine(ApplicationDataStorage.Instance.ApplicationPath, "Slic3r.app", "Contents", "MacOS", "slic3r");
|
||||
return applicationPath;
|
||||
}
|
||||
case ActivePrinterProfile.SlicingEngine.CuraEngine:
|
||||
case ActivePrinterProfile.SlicingEngineTypes.CuraEngine:
|
||||
{
|
||||
string applicationPath = System.IO.Path.Combine(ApplicationDataStorage.Instance.ApplicationPath, "CuraEngine");
|
||||
return applicationPath;
|
||||
|
|
@ -153,18 +182,18 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
slicerProcess = new Process();
|
||||
|
||||
switch (ActivePrinterProfile.Instance.ActiveSliceEngine)
|
||||
switch (ActivePrinterProfile.Instance.ActiveSliceEngineType)
|
||||
{
|
||||
case ActivePrinterProfile.SlicingEngine.Slic3r:
|
||||
case ActivePrinterProfile.SlicingEngineTypes.Slic3r:
|
||||
slicerProcess.StartInfo.Arguments = "--load \"" + currentConfigurationFileAndPath + "\" --output \"" + gcodePathAndFileName + "\" \"" + itemToSlice.PartToSlicePathAndFileName + "\"";
|
||||
break;
|
||||
|
||||
case ActivePrinterProfile.SlicingEngine.CuraEngine:
|
||||
case ActivePrinterProfile.SlicingEngineTypes.CuraEngine:
|
||||
slicerProcess.StartInfo.Arguments = "-v -o \"" + gcodePathAndFileName + "\" " + CuraEngineMappings.GetCuraCommandLineSettings() + " \"" + itemToSlice.PartToSlicePathAndFileName + "\"";
|
||||
//Debug.Write(slicerProcess.StartInfo.Arguments);
|
||||
break;
|
||||
|
||||
case ActivePrinterProfile.SlicingEngine.MatterSlice:
|
||||
case ActivePrinterProfile.SlicingEngineTypes.MatterSlice:
|
||||
slicerProcess.StartInfo.Arguments = "--load \"" + currentConfigurationFileAndPath + "\" --output \"" + gcodePathAndFileName + "\" \"" + itemToSlice.PartToSlicePathAndFileName + "\"";
|
||||
break;
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2013, Lars Brubaker
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ using MatterHackers.VectorMath;
|
|||
|
||||
using MatterHackers.MatterControl;
|
||||
using MatterHackers.MatterControl.PrintQueue;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
using MatterHackers.MatterControl.PrintLibrary;
|
||||
using MatterHackers.MatterControl.DataStorage;
|
||||
using MatterHackers.Localizations;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue