public void SliceFileWithSpaceInGCodePath() { // GCode file with space in file name string gcodePath = TestUtilities.GetTempGCodePath("gcode file with space"); string stlPath = TestUtilities.GetStlPath("Box Left"); // Create config file var configFilePath = Path.ChangeExtension(gcodePath, "ini"); using (var stream = new StreamWriter(configFilePath)) { stream.WriteLine($"additionalArgsToProcess = -m \"1,0,0,0,0,1,0,0,0,0,1,0,5,0,0,1\" \"{stlPath}\""); } // Slice file MatterSlice.ProcessArgs($"-v -o \"{gcodePath}\" -c \"{configFilePath}\""); // Load and validate generated GCode string[] gcode = TestUtilities.LoadGCodeFile(gcodePath); var movement = new MovementInfo(); // check layer 1 var layer1Info = TestUtilities.GetGCodeForLayer(gcode, 1); var layer1Polygons = TestUtilities.GetExtrusionPolygons(layer1Info, ref movement); Assert.AreEqual(4, layer1Polygons.Count); // check layer 2 var layer2Info = TestUtilities.GetGCodeForLayer(gcode, 2); var layer2Polygons = TestUtilities.GetExtrusionPolygons(layer2Info, ref movement); Assert.AreEqual(4, layer2Polygons.Count); }
public void SliceFileWithLeadingLowercaseN() { // Stl with leading n - tests past regression due to c:\path\name.stl where \n in path breaks during stuff/unstuff behavior string stlPath = TestUtilities.GetStlPath("name-with-leading-n"); string gcodePath = TestUtilities.GetTempGCodePath(nameof(SliceFileWithLeadingLowercaseN)); // Create config file var configFilePath = Path.ChangeExtension(gcodePath, "ini"); using (var stream = new StreamWriter(configFilePath)) { stream.WriteLine($"additionalArgsToProcess = -m \"1,0,0,0,0,1,0,0,0,0,1,0,5,0,0,1\" \"{stlPath}\""); } // Slice file MatterSlice.ProcessArgs($"-v -o \"{gcodePath}\" -c \"{configFilePath}\""); // Load and validate generated GCode string[] gcode = TestUtilities.LoadGCodeFile(gcodePath); var movement = new MovementInfo(); // check layer 1 var layer1Info = TestUtilities.GetGCodeForLayer(gcode, 1); var layer1Polygons = TestUtilities.GetExtrusionPolygons(layer1Info, ref movement); Assert.AreEqual(4, layer1Polygons.Count); // check layer 2 var layer2Info = TestUtilities.GetGCodeForLayer(gcode, 2); var layer2Polygons = TestUtilities.GetExtrusionPolygons(layer2Info, ref movement); Assert.AreEqual(4, layer2Polygons.Count); }
public void SliceFileWithSpaceInName() { // Stl with space in file name - tests past regression due to spaces in file name string stlPath = TestUtilities.GetStlPath("Box Left"); string gcodePath = TestUtilities.GetTempGCodePath(nameof(SliceFileWithSpaceInName)); // Create config file var configFilePath = Path.ChangeExtension(gcodePath, "ini"); using (var stream = new StreamWriter(configFilePath)) { stream.WriteLine($"additionalArgsToProcess = -m \"1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1\" \"{stlPath}\""); } // Slice file MatterSlice.ProcessArgs($"-v -o \"{gcodePath}\" -c \"{configFilePath}\""); // Load and validate generated GCode string[] gcode = TestUtilities.LoadGCodeFile(gcodePath); var movement = default(MovementInfo); // check layer 1 var layer1Info = TestUtilities.GetLayer(gcode, 1); var layer1Polygons = TestUtilities.GetExtrusionPolygonsForLayer(layer1Info, ref movement, false); Assert.AreEqual(2, layer1Polygons.Where(i => i.Count > 2).Count()); // check layer 2 var layer2Info = TestUtilities.GetLayer(gcode, 2); var layer2Polygons = TestUtilities.GetExtrusionPolygonsForLayer(layer2Info, ref movement, false); Assert.AreEqual(2, layer2Polygons.Where(i => i.Count > 2).Count()); }