public void CorrectNumberOfTops()
        {
            // 3 top layers and no bottom layers
            {
                // A simple cube that should have enough bottom layers
                string         inset0OutlineString = "x:0, y:0,x:10000, y:0,x:10000, y:10000,x:0, y:10000,|";
                Polygons       inset0Outline       = CLPolygonsExtensions.CreateFromString(inset0OutlineString);
                int            numLayers           = 10;
                ExtruderLayers extruder            = CreateLayerData(inset0Outline, numLayers);
                GenerateLayers(extruder, 400, 0, 3, 0);
                for (int i = 0; i < 7; i++)
                {
                    Assert.IsTrue(extruder.OnlyHasInfill(i));
                }
                Assert.IsTrue(extruder.OnlyHasFirstTop(7));
                Assert.IsTrue(extruder.OnlyHasSolidInfill(8));
                Assert.IsTrue(extruder.OnlyHasTop(9));
            }

            // 3 bottom layers and 1 top layer
            {
                string         inset0OutlineString = "x:0, y:0,x:10000, y:0,x:10000, y:10000,x:0, y:10000,|";
                Polygons       inset0Outline       = CLPolygonsExtensions.CreateFromString(inset0OutlineString);
                int            numLayers           = 10;
                ExtruderLayers extruder            = CreateLayerData(inset0Outline, numLayers);
                GenerateLayers(extruder, 400, 3, 1, 0);
                Assert.IsTrue(extruder.OnlyHasBottom(0));
                for (int i = 1; i < 3; i++)
                {
                    Assert.IsTrue(extruder.OnlyHasSolidInfill(i));
                }
                for (int i = 3; i < 9; i++)
                {
                    Assert.IsTrue(extruder.OnlyHasInfill(i));
                }
                Assert.IsTrue(extruder.OnlyHasTop(9));
            }

            // 3 top layers and 3 bottom layers
            {
                string         inset0OutlineString = "x:0, y:0,x:10000, y:0,x:10000, y:10000,x:0, y:10000,|";
                Polygons       inset0Outline       = CLPolygonsExtensions.CreateFromString(inset0OutlineString);
                int            numLayers           = 10;
                ExtruderLayers extruder            = CreateLayerData(inset0Outline, numLayers);
                GenerateLayers(extruder, 400, 3, 3, 0);
                Assert.IsTrue(extruder.OnlyHasBottom(0));
                for (int i = 1; i < 3; i++)
                {
                    Assert.IsTrue(extruder.OnlyHasSolidInfill(i));
                }
                for (int i = 3; i < 7; i++)
                {
                    Assert.IsTrue(extruder.OnlyHasInfill(i));
                }
                Assert.IsTrue(extruder.OnlyHasFirstTop(7));
                Assert.IsTrue(extruder.OnlyHasSolidInfill(8));
                Assert.IsTrue(extruder.OnlyHasTop(9));
            }
        }
Exemple #2
0
        public void CorrectNumberOfBottoms()
        {
            // 3 bottom layers and no top layers
            {
                // A simple cube that should have enough bottom layers
                string         inset0OutlineString = "x:0, y:0,x:10000, y:0,x:10000, y:10000,x:0, y:10000,|";
                Polygons       partOutline         = CLPolygonsExtensions.CreateFromString(inset0OutlineString);
                int            numLayers           = 10;
                ExtruderLayers extruder            = CreateLayerData(partOutline, numLayers);
                GenerateLayers(extruder, 400, 3, 0, 0);
                Assert.IsTrue(extruder.OnlyHasBottom(0));
                Assert.IsTrue(extruder.OnlyHasSolidInfill(1));
                Assert.IsTrue(extruder.OnlyHasSolidInfill(2));
                Assert.IsTrue(extruder.OnlyHasInfill(3));
            }

            // 3 bottom layers and 1 top layer
            {
                string         inset0OutlineString = "x:0, y:0,x:10000, y:0,x:10000, y:10000,x:0, y:10000,|";
                Polygons       inset0Outline       = CLPolygonsExtensions.CreateFromString(inset0OutlineString);
                int            numLayers           = 10;
                ExtruderLayers extruder            = CreateLayerData(inset0Outline, numLayers);
                GenerateLayers(extruder, 400, 3, 1, 0);
                Assert.IsTrue(extruder.OnlyHasBottom(0));
                Assert.IsTrue(extruder.OnlyHasSolidInfill(1));
                Assert.IsTrue(extruder.OnlyHasSolidInfill(2));
                Assert.IsTrue(extruder.OnlyHasInfill(3));
            }

            // 3 bottom layers and 3 top layers
            {
                string         inset0OutlineString = "x:0, y:0,x:10000, y:0,x:10000, y:10000,x:0, y:10000,|";
                Polygons       inset0Outline       = CLPolygonsExtensions.CreateFromString(inset0OutlineString);
                int            numLayers           = 10;
                ExtruderLayers extruder            = CreateLayerData(inset0Outline, numLayers);
                GenerateLayers(extruder, 400, 3, 3, 0);
                Assert.IsTrue(extruder.OnlyHasBottom(0));
                Assert.IsTrue(extruder.OnlyHasSolidInfill(1));
                Assert.IsTrue(extruder.OnlyHasSolidInfill(2));
                Assert.IsTrue(extruder.OnlyHasInfill(3));
            }
        }
Exemple #3
0
        public void CorrectNumberOfTops()
        {
            // 3 top layers and no bottom layers
            {
                // A simple cube that should have enough bottom layers
                string         inset0OutlineString = "x:0, y:0,x:10000, y:0,x:10000, y:10000,x:0, y:10000,|";
                Polygons       inset0Outline       = PolygonsHelper.CreateFromString(inset0OutlineString);
                int            numLayers           = 10;
                ExtruderLayers extruder            = CreateLayerData(inset0Outline, numLayers);
                GenerateLayers(extruder, 400, 0, 3);
                Assert.IsTrue(extruder.OnlyHasTop(9));
                Assert.IsTrue(extruder.OnlyHasSolidInfill(8));
                Assert.IsTrue(extruder.OnlyHasSolidInfill(7));
                Assert.IsTrue(extruder.OnlyHasInfill(6));
            }

            // 3 top layers and 1 bottom layer
            {
                string         inset0OutlineString = "x:0, y:0,x:10000, y:0,x:10000, y:10000,x:0, y:10000,|";
                Polygons       inset0Outline       = PolygonsHelper.CreateFromString(inset0OutlineString);
                int            numLayers           = 10;
                ExtruderLayers extruder            = CreateLayerData(inset0Outline, numLayers);
                GenerateLayers(extruder, 400, 3, 1);
                Assert.IsTrue(extruder.OnlyHasBottom(0));
                Assert.IsTrue(extruder.OnlyHasSolidInfill(1));
                Assert.IsTrue(extruder.OnlyHasSolidInfill(2));
                Assert.IsTrue(extruder.OnlyHasInfill(3));
            }

            // 3 top layers and 3 bottom layers
            {
                string         inset0OutlineString = "x:0, y:0,x:10000, y:0,x:10000, y:10000,x:0, y:10000,|";
                Polygons       inset0Outline       = PolygonsHelper.CreateFromString(inset0OutlineString);
                int            numLayers           = 10;
                ExtruderLayers extruder            = CreateLayerData(inset0Outline, numLayers);
                GenerateLayers(extruder, 400, 3, 3);
                Assert.IsTrue(extruder.OnlyHasBottom(0));
                Assert.IsTrue(extruder.OnlyHasSolidInfill(1));
                Assert.IsTrue(extruder.OnlyHasSolidInfill(2));
                Assert.IsTrue(extruder.OnlyHasInfill(3));
            }
        }