예제 #1
0
        public void InitializeLayerData(ExtruderData slicer, ConfigSettings config, int extruderIndex, int extruderCount, Polygons extraPathingConsideration)
        {
            for (int layerIndex = 0; layerIndex < slicer.layers.Count; layerIndex++)
            {
                int start = slicer.layers.Count * extruderIndex;
                LogOutput.Log("Generating Layer Outlines {0}/{1}\n".FormatWith(start + layerIndex + 1, extruderCount * slicer.layers.Count));
                if (config.outputOnlyFirstLayer && layerIndex > 0)
                {
                    break;
                }

                Layers.Add(new SliceLayer());
                Layers[layerIndex].LayerZ = slicer.layers[layerIndex].Z;

                Layers[layerIndex].AllOutlines = slicer.layers[layerIndex].PolygonList;

                Layers[layerIndex].AllOutlines = Layers[layerIndex].AllOutlines.GetCorrectedWinding();

                long avoidInset    = config.ExtrusionWidth_um * 3 / 2;
                var  boundary      = Layers[layerIndex].AllOutlines.GetBounds();
                var  extraBoundary = extraPathingConsideration.GetBounds();
                boundary.ExpandToInclude(extraBoundary);
                boundary.Inflate(config.ExtrusionWidth_um * 10);
                Layers[layerIndex].PathFinder = new Pathfinding.PathFinder(Layers[layerIndex].AllOutlines, avoidInset, boundary);
            }
        }
예제 #2
0
        public void InitializeLayerData(ExtruderData extruderData, ConfigSettings config, int extruderIndex)
        {
            for (int layerIndex = 0; layerIndex < extruderData.layers.Count; layerIndex++)
            {
                if (config.outputOnlyFirstLayer && layerIndex > 0)
                {
                    break;
                }

                Layers.Add(new SliceLayer());
                Layers[layerIndex].LayerZ = extruderData.layers[layerIndex].Z;

                Layers[layerIndex].AllOutlines = extruderData.layers[layerIndex].PolygonList;

                Layers[layerIndex].AllOutlines = Layers[layerIndex].AllOutlines.GetCorrectedWinding();
            }
        }
예제 #3
0
        /// <summary>
        /// Construct a new instance based on layers from an existing ExtruderData.
        /// </summary>
        /// <param name="extruderData">The ExtruderData containing layers to process.</param>
        /// <param name="outputOnlyFirstLayer">An indicator if only the first layer should be processed.</param>
        public ExtruderLayers(ExtruderData extruderData, bool outputOnlyFirstLayer)
        {
            // Initialize LayerData
            for (int layerIndex = 0; layerIndex < extruderData.layers.Count; layerIndex++)
            {
                if (outputOnlyFirstLayer && layerIndex > 0)
                {
                    break;
                }

                var meshProcessingLayer = extruderData.layers[layerIndex];

                this.Layers.Add(new SliceLayer()
                {
                    LayerZ      = meshProcessingLayer.Z,
                    AllOutlines = meshProcessingLayer.PolygonList.GetCorrectedWinding()
                });
            }
        }
예제 #4
0
        /// <summary>
        /// Construct a new instance based on layers from an existing ExtruderData.
        /// </summary>
        /// <param name="extruderData">The ExtruderData containing layers to process.</param>
        /// <param name="outputOnlyFirstLayer">An indicator if only the first layer should be processed.</param>
        public ExtruderLayers(ExtruderData extruderData, bool outputOnlyFirstLayer)
        {
            // Initialize LayerData
            for (int layerIndex = 0; layerIndex < extruderData.layers.Count; layerIndex++)
            {
                if (outputOnlyFirstLayer && layerIndex > 0)
                {
                    break;
                }

                var meshProcessingLayer = extruderData.layers[layerIndex];

                // merge all the polygons together
                var allOutlines = UnionClosedPaths(meshProcessingLayer.PolygonList);
                allOutlines = allOutlines.GetCorrectedWinding();

                this.Layers.Add(new SliceLayer()
                {
                    LayerZ      = meshProcessingLayer.Z,
                    AllOutlines = allOutlines
                });
            }
        }