Exemple #1
0
        public void GenerateSkirt(int distance, int extrusionWidth_um, int numberOfLoops, int brimCount, int minLength, ConfigSettings config)
        {
            Polygons islandsToSkirtAround = GetSkirtBounds(config, this, (distance > 0), distance, extrusionWidth_um, brimCount);

            if (islandsToSkirtAround.Count > 0)
            {
                // Find convex hull for the skirt outline
                Polygons convexHull = new Polygons(new[] { islandsToSkirtAround.CreateConvexHull() });

                // Create skirt loops from the ConvexHull
                for (int skirtLoop = 0; skirtLoop < numberOfLoops; skirtLoop++)
                {
                    int offsetDistance = distance + extrusionWidth_um * skirtLoop + extrusionWidth_um / 2;

                    this.Skirt.AddAll(convexHull.Offset(offsetDistance));

                    int length = (int)this.Skirt.PolygonLength();
                    if (skirtLoop + 1 >= numberOfLoops && length > 0 && length < minLength)
                    {
                        // add more loops for as long as we have not extruded enough length
                        numberOfLoops++;
                    }
                }
            }
        }
        public void GenerateSkirt(int distance, int extrusionWidth_um, int numberOfLoops, int brimCount, int minLength, ConfigSettings config)
        {
            LayerDataStorage storage      = this;
            bool             externalOnly = (distance > 0);

            List <Polygons> skirtLoops = new List <Polygons>();

            Polygons skirtPolygons = GetSkirtBounds(config, storage, externalOnly, distance, extrusionWidth_um, brimCount);

            if (skirtPolygons.Count > 0)
            {
                // Find convex hull for the skirt outline
                Polygons convexHull = new Polygons(new[] { skirtPolygons.CreateConvexHull() });

                // Create skirt loops from the ConvexHull
                for (int skirtLoop = 0; skirtLoop < numberOfLoops; skirtLoop++)
                {
                    int offsetDistance = distance + extrusionWidth_um * skirtLoop + extrusionWidth_um / 2;

                    storage.skirt.AddAll(convexHull.Offset(offsetDistance));

                    int length = (int)storage.skirt.PolygonLength();
                    if (skirtLoop + 1 >= numberOfLoops && length > 0 && length < minLength)
                    {
                        // add more loops for as long as we have not extruded enough length
                        numberOfLoops++;
                    }
                }
            }
        }