public void CorrectIslandCount2() { void Test(bool mergeOverlaps, bool expandWalls) { string engineStlFile = TestUtilities.GetStlPath("all_layers"); string engineGCodeFile = TestUtilities.GetTempGCodePath($"all_layers - merge overlap {mergeOverlaps} - expand walls {expandWalls}.gcode"); var config = new ConfigSettings(); config.FirstLayerThickness = .2; config.LayerThickness = .2; config.NumberOfSkirtLoops = 0; config.InfillPercent = 0; config.NumberOfTopLayers = 0; config.NumberOfBottomLayers = 0; config.NumberOfPerimeters = 1; config.MergeOverlappingLines = mergeOverlaps; config.ExpandThinWalls = expandWalls; config.FillThinGaps = false; config.AvoidCrossingPerimeters = false; var processor = new FffProcessor(config); processor.SetTargetFile(engineGCodeFile); processor.LoadStlFile(engineStlFile); // slice and save it processor.DoProcessing(); processor.Dispose(); var loadedGCode = TestUtilities.LoadGCodeFile(engineGCodeFile); var layers = TestUtilities.LayerCount(loadedGCode); Assert.AreEqual(45, layers); var expectedIslands = new int[] { 7, 7, 7, 5, 5, // 0 - 4 5, 5, 5, 5, 5, // 5 - 9 5, 5, 5, 5, 5, // 10 - 14 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, }; var layerPolygons = TestUtilities.GetAllLayersExtrusionPolygons(loadedGCode); Assert.AreEqual(45, layerPolygons.Where(i => i.Count > 2).Count()); for (int i = 1; i < layers; i++) { Assert.AreEqual(expectedIslands[i], layerPolygons[i].Where(p => p.Count > 2).Count()); } } Test(false, false); Test(false, true); Test(true, false); Test(true, true); }
public void AnglesInPrintedParts() { // without expand thin walls { var loadedGCode = TestUtilities.SliceAndGetGCode("Bridge Test - CoveredU 30 Degrees", (config) => { config.FirstLayerThickness = .2; config.LayerThickness = .2; config.NumberOfSkirtLoops = 0; config.InfillPercent = 0; config.NumberOfPerimeters = 1; config.ExpandThinWalls = false; config.MergeOverlappingLines = false; }); Assert.AreEqual(55, loadedGCode.LayerCount()); var layerPolygons = TestUtilities.GetAllLayersExtrusionPolygons(loadedGCode); var mostCommon = TestUtilities.GetLineAngles(layerPolygons[45]).OrderBy(i => i.Value).Last(); var angle = mostCommon.Key; Assert.AreEqual(30, angle, 3, "Should have generated a bridge at 30 degrees"); } }
public void CorrectIslandCount() { string engineStlFile = TestUtilities.GetStlPath("Engine-Benchmark"); string engineGCodeFile = TestUtilities.GetTempGCodePath("Engine-Benchmark.gcode"); var config = new ConfigSettings(); config.FirstLayerThickness = .2; config.LayerThickness = .2; config.NumberOfSkirtLoops = 0; config.InfillPercent = 0; config.NumberOfTopLayers = 0; config.NumberOfBottomLayers = 0; config.NumberOfPerimeters = 1; config.MergeOverlappingLines = false; var processor = new FffProcessor(config); processor.SetTargetFile(engineGCodeFile); processor.LoadStlFile(engineStlFile); // slice and save it processor.DoProcessing(); processor.Dispose(); var loadedGCode = TestUtilities.LoadGCodeFile(engineGCodeFile); var layers = TestUtilities.LayerCount(loadedGCode); Assert.AreEqual(195, layers); var layerPolygons = TestUtilities.GetAllLayersExtrusionPolygons(loadedGCode); Assert.AreEqual(17, layerPolygons[32].Count); for (int i = 33; i < 44; i++) { Assert.AreEqual(13, layerPolygons[i].Where(p => p.Count > 2).Count()); } }