Пример #1
0
		private void sliceModels(SliceDataStorage storage)
		{
			timeKeeper.Restart();
#if false
            optomizedModel.saveDebugSTL("debug_output.stl");
#endif

			LogOutput.Log("Slicing model...\n");
			List<Slicer> slicerList = new List<Slicer>();
			for (int volumeIndex = 0; volumeIndex < optomizedModel.volumes.Count; volumeIndex++)
			{
				Slicer slicer = new Slicer(optomizedModel.volumes[volumeIndex], config);
				slicerList.Add(slicer);
			}

#if false
            slicerList[0].DumpSegmentsToGcode("Volume 0 Segments.gcode");
            slicerList[0].DumpPolygonsToGcode("Volume 0 Polygons.gcode");
            //slicerList[0].DumpPolygonsToHTML("Volume 0 Polygons.html");
#endif

			LogOutput.Log("Sliced model in {0:0.0}s\n".FormatWith(timeKeeper.Elapsed.Seconds));
			timeKeeper.Restart();

			LogOutput.Log("Generating support map...\n");
			storage.support.GenerateSupportGrid(optomizedModel, config);

			storage.modelSize = optomizedModel.size_um;
			storage.modelMin = optomizedModel.minXYZ_um;
			storage.modelMax = optomizedModel.maxXYZ_um;

			LogOutput.Log("Generating layer parts...\n");
			for (int volumeIndex = 0; volumeIndex < slicerList.Count; volumeIndex++)
			{
				storage.volumes.Add(new SliceVolumeStorage());
				LayerPart.CreateLayerParts(storage.volumes[volumeIndex], slicerList[volumeIndex], config.repairOverlaps);

				if (config.enableRaft)
				{
					//Add the raft offset to each layer.
					for (int layerNr = 0; layerNr < storage.volumes[volumeIndex].layers.Count; layerNr++)
					{
						storage.volumes[volumeIndex].layers[layerNr].printZ += config.raftBaseThickness_um + config.raftInterfaceThicknes_um;
					}
				}
			}
			LogOutput.Log("Generated layer parts in {0:0.0}s\n".FormatWith(timeKeeper.Elapsed.Seconds));
			timeKeeper.Restart();
		}