コード例 #1
0
ファイル: fffProcessor.cs プロジェクト: broettge/MatterSlice
		private void QueuePolygonsConsideringSupport(int layerIndex, GCodePlanner gcodeLayer, Polygons polygonsToWrite, GCodePathConfig fillConfig, SupportWriteType supportWriteType)
		{
			if (config.generateSupport 
				&& layerIndex > 0
				&& !config.continuousSpiralOuterPerimeter)
			{
				Polygons supportOutlines = slicingData.support.GetRequiredSupportAreas(layerIndex);

				if (supportWriteType == SupportWriteType.UnsupportedAreas)
				{
					if (supportOutlines.Count > 0)
					{
						Polygons polygonsNotOnSupport;
						// don't write the bottoms that are sitting on supported areas (they will be written at air gap distance later).
						polygonsToWrite = PolygonsHelper.ConvertToLines(polygonsToWrite);

						polygonsNotOnSupport = polygonsToWrite.CreateLineDifference(supportOutlines);
						gcodeLayer.QueuePolygonsByOptimizer(polygonsNotOnSupport, fillConfig);
					}
					else
					{
						gcodeLayer.QueuePolygonsByOptimizer(polygonsToWrite, fillConfig);
					}
				}
				else
				{
					if (supportOutlines.Count > 0)
					{
						if (supportOutlines.Count > 0)
						{
							// write the bottoms that are sitting on supported areas.
							Polygons polygonsOnSupport;
							polygonsToWrite = PolygonsHelper.ConvertToLines(polygonsToWrite);

							polygonsOnSupport = supportOutlines.CreateLineIntersections(polygonsToWrite);
							// ensure that all the segments have only 2 points
							foreach(Polygon poly in polygonsOnSupport)
							{
								while(poly.Count > 2)
								{
									// This is an error and I'm not sure why it happened. It needs to be investigated. // LBB 2016 01 12
									poly.RemoveAt(poly.Count - 1);
								}
							}

							gcodeLayer.QueuePolygonsByOptimizer(polygonsOnSupport, fillConfig);
						}
						else
						{
							gcodeLayer.QueuePolygonsByOptimizer(polygonsToWrite, fillConfig);
						}
					}
				}
			}
			else if (supportWriteType == SupportWriteType.UnsupportedAreas)
			{
				gcodeLayer.QueuePolygonsByOptimizer(polygonsToWrite, fillConfig);
			}
		}