예제 #1
0
        public BoxLayer CreateNewLayer(double zLow, int layerIndex)
        {
            BoxLayer layer = new BoxLayer(zLow, layerIndex);

            Add(layer);
            return(layer);
        }
        private BBox3D ComputeLoadBBox3D()
        {
            BBox3D   bbox          = new BBox3D();
            bool     hasInterlayer = false;
            double   zInterlayer   = 0.0;
            BoxLayer layer0        = GetBoxLayer(0, ref hasInterlayer, ref zInterlayer);

            bbox.Extend(layer0.BoundingBox(Analysis.PackProperties));
            BoxLayer layerN = GetBoxLayer(LayerCount - 1, ref hasInterlayer, ref zInterlayer);

            bbox.Extend(layerN.BoundingBox(Analysis.PackProperties));
            return(bbox);
        }
        public BoxLayer GetBoxLayer(int iLayerIndex, ref bool hasInterlayer, ref double zInterlayer)
        {
            if (null == _parentAnalysis)
            {
                throw new Exception("_parentAnalysis not set.");
            }

            double interlayerThickness = (null != _parentAnalysis.InterlayerProperties) ? _parentAnalysis.InterlayerProperties.Thickness : 0.0;
            double packHeight          = _parentAnalysis.PackProperties.Height;
            double zLow = _parentAnalysis.PalletProperties.Height;
            int    i    = 0;

            while (i <= iLayerIndex - 1)
            {
                LayerDescriptor desc = _listLayers[i];
                zLow += (desc.HasInterlayer ? interlayerThickness : 0.0) + packHeight;
                ++i;
            }
            zInterlayer   = zLow;
            hasInterlayer = _listLayers[iLayerIndex].HasInterlayer;
            zLow         += hasInterlayer ? interlayerThickness : 0.0;

            Transform3D swapTransform = Transform3D.Identity;

            if (_listLayers[iLayerIndex].Swapped)
            {
                Matrix4D matRot = new Matrix4D(
                    -1.0, 0.0, 0.0, _parentAnalysis.PalletProperties.Length
                    , 0.0, -1.0, 0.0, _parentAnalysis.PalletProperties.Width
                    , 0.0, 0.0, 1.0, 0.0
                    , 0.0, 0.0, 0.0, 1.0);
                swapTransform = new Transform3D(matRot);
            }

            // build BoxLayer
            BoxLayer layer = new BoxLayer(zLow + (hasInterlayer ? interlayerThickness : 0.0), 0);

            foreach (BoxPosition b in _layer)
            {
                layer.Add(
                    new BoxPosition(
                        swapTransform.transform(b.Position + zLow * Vector3D.ZAxis)
                        , HalfAxis.Transform(b.DirectionLength, swapTransform)
                        , HalfAxis.Transform(b.DirectionWidth, swapTransform))
                    );
            }
            return(layer);
        }
예제 #4
0
        private BBox3D ComputeLoadBBox3D()
        {
            BBox3D bbox   = new BBox3D();
            int    iLayer = 0;

            while (iLayer < Count)
            {
                ILayer   layer  = this[iLayer];
                BoxLayer blayer = layer as BoxLayer;
                if (null != blayer)
                {
                    bbox.Extend(blayer.BoundingBox(Analysis.BProperties));
                }
                ++iLayer;
            }
            return(bbox);
        }
예제 #5
0
 private void GetCounts(ref int layerCount, ref int interlayerCount, ref int boxCount)
 {
     layerCount      = 0;
     interlayerCount = 0;
     boxCount        = 0;
     foreach (ILayer layer in Layers)
     {
         BoxLayer blayer = layer as BoxLayer;
         if (null != blayer)
         {
             ++layerCount;
             boxCount += blayer.BoxCount;
         }
         InterlayerPos iLayer = layer as InterlayerPos;
         if (null != iLayer)
         {
             ++interlayerCount;
         }
     }
 }
 public PackPalletSolution(PackPalletAnalysis analysis, string title, BoxLayer layer)
 {
     _parentAnalysis = analysis;
     _title          = title;
     _layer          = layer;
 }
예제 #7
0
 public void SetLayer(BoxLayer layer)
 {
     _layer = layer;
 }