Esempio n. 1
0
		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);
			}
		}
Esempio n. 2
0
        private void QueuePolygonsConsideringSupport(int layerIndex, GCodePlanner gcodeLayer, Polygons polygonsToWrite, GCodePathConfig fillConfig, SupportWriteType supportWriteType)
        {
            bool oldLoopValue = fillConfig.closedLoop;

            if (config.GenerateSupport
                && layerIndex > 0
                && !config.ContinuousSpiralOuterPerimeter)
            {
                Polygons supportOutlines = slicingData.support.GetRequiredSupportAreas(layerIndex).Offset(fillConfig.lineWidth_um/2);

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

                        Polygons polygonsNotOnSupport = polygonsToWriteAsLines.CreateLineDifference(supportOutlines);
                        fillConfig.closedLoop = false;
                        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 polygonsToWriteAsLines = PolygonsHelper.ConvertToLines(polygonsToWrite);

                            Polygons polygonsOnSupport = supportOutlines.CreateLineIntersections(polygonsToWriteAsLines);
                            fillConfig.closedLoop = false;
                            gcodeLayer.QueuePolygonsByOptimizer(polygonsOnSupport, fillConfig);
                        }
                        else
                        {
                            gcodeLayer.QueuePolygonsByOptimizer(polygonsToWrite, fillConfig);
                        }
                    }
                }
            }
            else if (supportWriteType == SupportWriteType.UnsupportedAreas)
            {
                gcodeLayer.QueuePolygonsByOptimizer(polygonsToWrite, fillConfig);
            }

            fillConfig.closedLoop = oldLoopValue;
        }