Пример #1
0
        public void CreateLayers()
        {
            var pallet = new Point3D()
            {
                X = 104, Y = 96, Z = 84
            };
            var boxList = new List <Box>();

            boxList.Add(new Box()
            {
                Dimensions = new Point3D()
                {
                    X = 70, Y = 104, Z = 24
                }
            });
            boxList.Add(new Box()
            {
                Dimensions = new Point3D()
                {
                    X = 70, Y = 104, Z = 24
                }
            });
            boxList.Add(new Box()
            {
                Dimensions = new Point3D()
                {
                    X = 70, Y = 104, Z = 24
                }
            });
            boxList.Add(new Box()
            {
                Dimensions = new Point3D()
                {
                    X = 70, Y = 104, Z = 24
                }
            });

            boxList.Add(new Box()
            {
                Dimensions = new Point3D()
                {
                    X = 14, Y = 104, Z = 48
                }
            });
            boxList.Add(new Box()
            {
                Dimensions = new Point3D()
                {
                    X = 14, Y = 104, Z = 48
                }
            });

            boxList.Add(new Box()
            {
                Dimensions = new Point3D()
                {
                    X = 40, Y = 52, Z = 36
                }
            });
            boxList.Add(new Box()
            {
                Dimensions = new Point3D()
                {
                    X = 40, Y = 52, Z = 36
                }
            });
            boxList.Add(new Box()
            {
                Dimensions = new Point3D()
                {
                    X = 40, Y = 52, Z = 36
                }
            });

            var layers = Packer.CreateLayers(boxList, pallet);

            Assert.True(layers.Count == 7);
            Assert.True(layers[0].LayerThickness == 24 && layers[0].MinDifferenceTotal == 56);
            Assert.True(layers[1].LayerThickness == 36 && layers[1].MinDifferenceTotal == 72);
            Assert.True(layers[2].LayerThickness == 40 && layers[2].MinDifferenceTotal == 80);
            Assert.True(layers[3].LayerThickness == 52 && layers[3].MinDifferenceTotal == 80);
            Assert.True(layers[4].LayerThickness == 70 && layers[4].MinDifferenceTotal == 98);
            Assert.True(layers[5].LayerThickness == 48 && layers[5].MinDifferenceTotal == 100);
            Assert.True(layers[6].LayerThickness == 14 && layers[6].MinDifferenceTotal == 106);
        }