diff --git a/MatterControl.Printing/MatterControl.Printing.csproj b/MatterControl.Printing/MatterControl.Printing.csproj index b2bffebd3..f6a13891a 100644 --- a/MatterControl.Printing/MatterControl.Printing.csproj +++ b/MatterControl.Printing/MatterControl.Printing.csproj @@ -17,6 +17,7 @@ + diff --git a/MatterControl.Printing/Settings/IObjectSlicer.cs b/MatterControl.Printing/Settings/IObjectSlicer.cs new file mode 100644 index 000000000..b1f9a1b15 --- /dev/null +++ b/MatterControl.Printing/Settings/IObjectSlicer.cs @@ -0,0 +1,39 @@ +/* +Copyright (c) 2019, Lars Brubaker, John Lewin +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.IO; +using MatterHackers.DataConverters3D; + +namespace MatterHackers.MatterControl.SlicerConfiguration +{ + public interface IObjectSlicer + { + bool Slice(IObject3D object3D, PrinterSettings printerSettings, Stream outputStream); + } +} diff --git a/MatterControl.Printing/Settings/PrinterSettings.cs b/MatterControl.Printing/Settings/PrinterSettings.cs index da38fd08c..75995495d 100644 --- a/MatterControl.Printing/Settings/PrinterSettings.cs +++ b/MatterControl.Printing/Settings/PrinterSettings.cs @@ -34,6 +34,7 @@ using System.Linq; using System.Text; using MatterHackers.Agg; using MatterHackers.MatterControl.SlicerConfiguration.MappingClasses; +using MatterHackers.DataConverters3D; using MatterHackers.VectorMath; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -72,6 +73,9 @@ namespace MatterHackers.MatterControl.SlicerConfiguration public class PrinterSettings { + // TODO: Move to more appropriate location after more consideration + public static IObjectSlicer ExternalSlicer { get; set; } + // Latest version should be in the form of: // Year|month|day|versionForDay (to support multiple revisions on a given day) public static int LatestVersion { get; } = 201606271; diff --git a/MatterControlLib/SlicerConfiguration/Slicer.cs b/MatterControlLib/SlicerConfiguration/Slicer.cs index 6336db487..48a24f779 100644 --- a/MatterControlLib/SlicerConfiguration/Slicer.cs +++ b/MatterControlLib/SlicerConfiguration/Slicer.cs @@ -328,6 +328,26 @@ namespace MatterHackers.MatterControl.SlicerConfiguration matrixAndMeshArgs.Append($" \"{fileName}\" "); } + // Map from PrinterSettings to PrintSettings + if (PrinterSettings.ExternalSlicer != null) + { + var children = stlFileLocations.Select(s => new Object3D() + { + MeshPath = s.fileName, + Matrix = s.matrix + }); + + using (var outputStream = File.OpenWrite(gcodeFilePath)) + { + PrinterSettings.ExternalSlicer.Slice( + new Object3D(children), + printer.Settings, + outputStream); + } + + return Task.FromResult(true); + } + printer.EngineMappingsMatterSlice.WriteSliceSettingsFile( configFilePath, new[] diff --git a/PrusaI3-MK3/Defaults.txt b/PrusaI3-MK3/Defaults.txt new file mode 100644 index 000000000..3be61a390 --- /dev/null +++ b/PrusaI3-MK3/Defaults.txt @@ -0,0 +1,79 @@ +{ + "BridgeExtrudeSpeedX": 0.5, + "BridgeFillNozzleDiamStepX": 0.85, + "BridgeVolumeScale": 1.0, + "CarefulExtrudeSpeed": 1200.0, + "ClassTypeName": "gs.info.PrusaSettings", + "ClipSelfOverlaps": false, + "EnableBridging": true, + "EnableRetraction": true, + "EnableSupportReleaseOpt": true, + "EnableSupportShell": true, + "ExtruderTempC": 200, + "FanSpeedX": 1.0, + "FloorLayers": 2, + "GenerateSupport": true, + "HeatedBedTempC": 60, + "Identifier": "Defaults", + "InteriorSolidRegionShells": 0, + "LayerHeightMM": 0.2, + "Machine": { + "ManufacturerName": "Prusa", + "ManufacturerUUID": "4530287d-cd23-416c-b74b-4876c385750a", + "ModelIdentifier": "i3 MK3", + "ModelUUID": "fc09f99c-aee0-45e9-bca3-3e088ccb0b55", + "Class": "PlasticFFFPrinter", + "BedSizeXMM": 250.0, + "BedSizeYMM": 210.0, + "MaxHeightMM": 200.0, + "FilamentDiamMM": 1.75, + "NozzleDiamMM": 0.4, + "MinExtruderTempC": 20, + "MaxExtruderTempC": 300, + "HasHeatedBed": true, + "MinBedTempC": 0, + "MaxBedTempC": 120, + "MinLayerHeightMM": 0.05, + "MaxLayerHeightMM": 0.35, + "EnableAutoBedLeveling": true, + "HasAutoBedLeveling": true, + "MaxExtrudeSpeedMMM": 4800, + "MaxRetractSpeedMMM": 2100, + "MaxTravelSpeedMMM": 7200, + "MaxZTravelSpeedMMM": 15000, + "MinPointSpacingMM": 0.1 + }, + "MaxBridgeWidthMM": 10.0, + "MinExtrudeSpeed": 1200.0, + "MinLayerTime": 5.0, + "MinRetractTravelLength": 2.5, + "ModelEnum": "i3_MK3", + "OuterPerimeterSpeedX": 0.5, + "OuterShellLast": false, + "RapidExtrudeSpeed": 4800.0, + "RapidTravelSpeed": 7200.0, + "RetractDistanceMM": 0.7, + "RetractSpeed": 2100.0, + "RoofLayers": 2, + "SelfOverlapToleranceX": 0.75, + "Shells": 2, + "ShellsFillNozzleDiamStepX": 1.0, + "SolidFillBorderOverlapX": 0.25, + "SolidFillNozzleDiamStepX": 1.0, + "SparseFillBorderOverlapX": 0.25, + "SparseLinearInfillStepX": 5.0, + "StartLayerHeightMM": 0.0, + "StartLayers": 0, + "SupportAreaOffsetX": -0.5, + "SupportMinDimension": 1.5, + "SupportMinZTips": true, + "SupportOverhangAngleDeg": 35.0, + "SupportPointDiam": 2.5, + "SupportPointSides": 4, + "SupportRegionJoinTolX": 2.0, + "SupportReleaseGap": 0.20000000298023224, + "SupportSolidSpace": 0.34999999403953552, + "SupportSpacingStepX": 5.0, + "SupportVolumeScale": 1.0, + "ZTravelSpeed": 15000.0 +} \ No newline at end of file