Ejemplo n.º 1
0
        public void Draw(Graphics3D graphics)
        {
            if (null == _caseDefinition || null == _boxProperties)
                return;

            // get global transformation
            Transform3D transf = _globalOrientation.Transformation;

            // draw case (back faces)
            Case case_ = _caseProperties != null ? new Case(_caseProperties, transf) : null;
            if (null != case_)
            {
                // draw case (inside)
                case_.DrawInside(graphics);
            }
            // add boxes
            uint pickId = 0;
            for (int i=0; i<_caseDefinition.Arrangement._iLength; ++i)
                for (int j=0; j<_caseDefinition.Arrangement._iWidth; ++j)
                    for (int k = 0; k < _caseDefinition.Arrangement._iHeight; ++k)
                        graphics.AddBox( new Box(pickId++, _boxProperties, GetPosition(i, j, k, _caseDefinition.Dim0, _caseDefinition.Dim1) ) );
            if (_showDimentions)
            {
                // add external dimensions
                Vector3D outerDimensions = _caseDefinition.OuterDimensions(_boxProperties, _caseOptimConstraintSet);
                graphics.AddDimensions(DimensionCube.Transform(new DimensionCube(Vector3D.Zero, outerDimensions.X, outerDimensions.Y, outerDimensions.Z, Color.Black, true), transf));
                // add inner dimensions
                Vector3D innerOffset = _caseDefinition.InnerOffset(_caseOptimConstraintSet);
                Vector3D innerDimensions = _caseDefinition.InnerDimensions(_boxProperties);
                graphics.AddDimensions(DimensionCube.Transform(new DimensionCube(innerOffset, innerDimensions.X, innerDimensions.Y, innerDimensions.Z, Color.Red, false), transf));
            }
        }
        /// <summary>
        /// Use this method when drawing a solution that belongs an analysis
        /// </summary>
        public void Draw(Graphics3D graphics)
        {
            if (null == _solution)
                return;
            // initialize Graphics3D object
            if (!graphics.ShowBoxIds)
            {
                // draw pallet
                Pallet pallet = new Pallet(_analysis.PalletProperties);
                pallet.Draw(graphics, Transform3D.Identity);
            }
            // draw solution
            uint pickId = 0;
            foreach (ILayer layer in _solution)
            {
                CylinderLayer cylLayer = layer as CylinderLayer;
                if (null != cylLayer)
                {
                    foreach (Vector3D pos in cylLayer)
                        graphics.AddCylinder(
                            new Cylinder(pickId++, _analysis.CylinderProperties, new CylPosition(pos, HalfAxis.HAxis.AXIS_Z_P))
                            );
                }

                InterlayerPos interlayerPos = layer as InterlayerPos;
                if (null != interlayerPos)
                {
                    Box box = new Box(pickId++, _analysis.InterlayerProperties);
                    // set position
                    box.Position = new Vector3D(
                        0.5 * (_analysis.PalletProperties.Length - _analysis.InterlayerProperties.Length)
                        , 0.5 * (_analysis.PalletProperties.Width - _analysis.InterlayerProperties.Width)
                        , interlayerPos.ZLow);
                    // draw
                    graphics.AddBox(box);
                }
            }
            if (_showDimensions)
            {
                if (_showDimensions)
                {
                    graphics.AddDimensions(
                        new DimensionCube(BoundingBoxDim(Properties.Settings.Default.DimCasePalletSol1)
                        , Color.Black, false));
                    graphics.AddDimensions(
                        new DimensionCube(BoundingBoxDim(Properties.Settings.Default.DimCasePalletSol2)
                        , Color.Red, true));
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        ///  Use this method when solution does not refer an analysis (e.g. when displaying CaseOptimizer result)
        /// </summary>
        public void Draw(Graphics3D graphics)
        {
            if (null == _boxCaseSolution)
            {
                throw new Exception("No box/case solution defined!");
            }

            BoxCaseAnalysis boxCaseAnalysis = _boxCaseSolution.Analysis;
            // retrieve case properties
            BProperties boxProperties = boxCaseAnalysis.BProperties;

            if (null == boxProperties)
            {
                return;
            }
            BoxProperties caseProperties = boxCaseAnalysis.CaseProperties;
            // draw case (inside)
            Case case_ = new Case(caseProperties);

            case_.DrawInside(graphics, Transform3D.Identity);
            // draw solution
            uint pickId = 0;

            foreach (ILayer layer in _boxCaseSolution)
            {
                if (layer is Layer3DBox blayer)
                {
                    foreach (BoxPosition bPosition in blayer)
                    {
                        graphics.AddBox(new Box(pickId++, boxProperties, bPosition));
                    }
                }
            }
            // get case analysis
            if (_showDimensions)
            {
                graphics.AddDimensions(new DimensionCube(
                                           Vector3D.Zero
                                           , caseProperties.Length, caseProperties.Width, caseProperties.Height
                                           , Color.Black
                                           , true));
                graphics.AddDimensions(new DimensionCube(
                                           _boxCaseSolution.LoadBoundingBox
                                           , Color.Red
                                           , false));
            }
        }
        /// <summary>
        ///  Use this method when solution does not refer an analysis (e.g. when displaying CaseOptimizer result)
        /// </summary>
        public static void Draw(Graphics3D graphics
                                , CasePalletSolution solution
                                , BoxProperties boxProperties, InterlayerProperties interlayerProperties, PalletProperties palletProperties)
        {
            // draw pallet
            Pallet pallet = new Pallet(palletProperties);

            pallet.Draw(graphics, Transform3D.Identity);
            // draw solution
            uint pickId = 0;

            foreach (ILayer layer in solution)
            {
                Layer3DBox blayer = layer as Layer3DBox;
                if (null != blayer)
                {
                    foreach (BoxPosition bPosition in blayer)
                    {
                        graphics.AddBox(new Box(pickId++, boxProperties, bPosition));
                    }
                }

                InterlayerPos interlayerPos = layer as InterlayerPos;
                if (null != interlayerPos && null != interlayerProperties)
                {
                    Box box = new Box(pickId++, interlayerProperties);
                    // set position
                    box.Position = new Vector3D(
                        0.5 * (palletProperties.Length - interlayerProperties.Length)
                        , 0.5 * (palletProperties.Width - interlayerProperties.Width)
                        , interlayerPos.ZLow);
                    // draw
                    graphics.AddBox(box);
                }
            }

            // always show dimensions
            Layer3DBox bLayer       = solution[solution.Count - 1] as Layer3DBox;
            double     palletHeight = solution[solution.Count - 1].ZLow + (null != bLayer ? bLayer.Thickness(boxProperties) : 0.0);

            // show dimensions
            graphics.AddDimensions(new DimensionCube(solution.BoundingBox, Color.Black, false));
            graphics.AddDimensions(new DimensionCube(solution.LoadBoundingBox, Color.Red, true));
        }
Ejemplo n.º 5
0
        public override void Draw(Graphics3D graphics, Transform3D transform)
        {
            Pallet pallet = new Pallet(_palletProperties);

            pallet.Draw(graphics, transform);
            if (graphics.ShowDimensions)
            {
                graphics.AddDimensions(new DimensionCube(_palletProperties.Dimensions));
            }
        }
        public void Draw(Graphics3D graphics)
        {
            if (null == _caseDefinition || null == _boxProperties)
            {
                return;
            }

            // get global transformation
            Transform3D transf = _globalOrientation.Transformation;

            // draw case (back faces)
            Case case_ = _caseProperties != null ? new Case(_caseProperties, transf) : null;

            if (null != case_)
            {
                // draw case (inside)
                case_.DrawInside(graphics, Transform3D.Identity);
            }
            // add boxes
            uint pickId = 0;

            for (int i = 0; i < _caseDefinition.Arrangement._iLength; ++i)
            {
                for (int j = 0; j < _caseDefinition.Arrangement._iWidth; ++j)
                {
                    for (int k = 0; k < _caseDefinition.Arrangement._iHeight; ++k)
                    {
                        graphics.AddBox(new Box(pickId++, _boxProperties, GetPosition(i, j, k, _caseDefinition.Dim0, _caseDefinition.Dim1)));
                    }
                }
            }
            if (_showDimentions)
            {
                // add external dimensions
                Vector3D outerDimensions = _caseDefinition.OuterDimensions(_boxProperties, _caseOptimConstraintSet);
                graphics.AddDimensions(DimensionCube.Transform(new DimensionCube(Vector3D.Zero, outerDimensions.X, outerDimensions.Y, outerDimensions.Z, Color.Black, true), transf));
                // add inner dimensions
                Vector3D innerOffset     = _caseDefinition.InnerOffset(_caseOptimConstraintSet);
                Vector3D innerDimensions = _caseDefinition.InnerDimensions(_boxProperties);
                graphics.AddDimensions(DimensionCube.Transform(new DimensionCube(innerOffset, innerDimensions.X, innerDimensions.Y, innerDimensions.Z, Color.Red, false), transf));
            }
        }
Ejemplo n.º 7
0
        public override void Draw(Graphics3D graphics, Transform3D transform)
        {
            // clear list of picking box
            ClearPickingBoxes();

            if (null == Solution)
            {
                return;
            }
            AnalysisHCyl analysis = Solution.AnalysisHCyl;

            if (analysis is AnalysisHCylPallet analysisHCylPallet)
            {
                Pallet pallet = new Pallet(analysisHCylPallet.PalletProperties);
                pallet.Draw(graphics, transform);
            }
            else if (analysis is AnalysisHCylTruck analysisHCylTruck)
            {
                Truck truck = new Truck(analysisHCylTruck.TruckProperties);
                truck.DrawBegin(graphics);
            }
            uint pickId = 0;

            // ### draw solution
            foreach (var cp in Solution.Layout.Positions)
            {
                //var cylPos = cp.Transform(Transform3D.Translation(analysis.Offset));
                Cylinder c = new Cylinder(
                    pickId++
                    , analysis.Content as CylinderProperties
                    , cp.Transform(transform));
                graphics.AddCylinder(c);
            }
            // ### dimensions
            if (graphics.ShowDimensions)
            {
                graphics.AddDimensions(new DimensionCube(BoundingBoxDim(DimCasePalletSol1), Color.Black, false));
                graphics.AddDimensions(new DimensionCube(BoundingBoxDim(DimCasePalletSol2), Color.Red, true));
            }
            // ###
        }
Ejemplo n.º 8
0
        public static void DrawILayer(Graphics3D graphics, ILayer layer, Packable packable, bool showDimensions)
        {
            bool show3D = Properties.Settings.Default.LayerView3D;

            graphics.CameraPosition = show3D ? Graphics3D.Corner_0 : Graphics3D.Top;

            uint   pickId = 0;
            BBox3D bbox   = new BBox3D();

            // ### layer of boxes ###
            if (layer is Layer3DBox layerBox)
            {
                foreach (BoxPosition bPosition in layerBox)
                {
                    Box b = null;
                    if (packable is PackProperties)
                    {
                        b = new Pack(pickId++, packable as PackProperties, bPosition);
                    }
                    else
                    {
                        b = new Box(pickId++, packable as PackableBrick, bPosition);
                    }
                    graphics.AddBox(b);
                    bbox.Extend(b.BBox);
                }
            }
            // ###
            // ### layer of cylinders ###
            if (layer is Layer3DCyl layerCyl)
            {
                foreach (Vector3D vPos in layerCyl)
                {
                    Cyl cyl = null;
                    if (packable is CylinderProperties cylinderProp)
                    {
                        cyl = new Cylinder(pickId++, cylinderProp, new CylPosition(vPos, HalfAxis.HAxis.AXIS_Z_P));
                    }
                    else if (packable is BottleProperties bottleProp)
                    {
                        cyl = new Bottle(pickId++, bottleProp, new CylPosition(vPos, HalfAxis.HAxis.AXIS_Z_P));
                    }
                    graphics.AddCylinder(cyl);
                    bbox.Extend(cyl.BBox);
                }
            }
            // ###
            if (showDimensions)
            {
                graphics.AddDimensions(new DimensionCube(bbox, Color.Black, false));
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        ///  Use this method when solution does not refer an analysis (e.g. when displaying CaseOptimizer result)
        /// </summary>
        public void Draw(Graphics3D graphics)
        {
            if (null == _boxCaseSolution)
                throw new Exception("No box/case solution defined!");

            BoxCaseAnalysis boxCaseAnalysis = _boxCaseSolution.Analysis;
            // retrieve case properties 
            BProperties boxProperties = boxCaseAnalysis.BProperties;
            if (null == boxProperties) return;
            BoxProperties caseProperties = boxCaseAnalysis.CaseProperties;
            // draw case (inside)
            Case case_ = new Case(caseProperties);
            case_.DrawInside(graphics);
            // draw solution
            uint pickId = 0;
            foreach (ILayer layer in _boxCaseSolution)
            {
                BoxLayer blayer = layer as BoxLayer;
                if (null != blayer)
                {
                    foreach (BoxPosition bPosition in blayer)
                        graphics.AddBox(new Box(pickId++, boxProperties, bPosition));
                }
            }
            // get case analysis
            if (_showDimensions)
            {
                graphics.AddDimensions(new DimensionCube(
                    Vector3D.Zero
                    , caseProperties.Length, caseProperties.Width, caseProperties.Height
                    , System.Drawing.Color.Black
                    , true));
                graphics.AddDimensions(new DimensionCube(
                    _boxCaseSolution.LoadBoundingBox
                    , System.Drawing.Color.Red
                    , false));
            }
        }
        /// <summary>
        /// Draw case solution
        /// </summary>
        public void Draw(Graphics3D graphics)
        {
            if (null == _caseSolution)
                throw new Exception("No case solution defined!");

            // load pallet solution
            BoxProperties caseProperties;

            CasePalletSolution palletSolution = _caseSolution.PalletSolutionDesc.LoadPalletSolution();
            if (null == palletSolution)
                caseProperties = new BoxProperties(null, _caseSolution.CaseLength, _caseSolution.CaseWidth, _caseSolution.CaseHeight);
            else
            {
                CasePalletAnalysis palletAnalysis = palletSolution.Analysis;
                // retrieve case properties 
                caseProperties = palletAnalysis.BProperties as BoxProperties;
            }
            if (null == caseProperties) return;
            // draw case (inside)
            Case case_ = new Case(caseProperties);
            case_.DrawInside(graphics);
            // get case analysis
            BoxCasePalletAnalysis caseAnalysis = _caseSolution.ParentCaseAnalysis;
            // draw solution
            uint pickId = 0;
            foreach (ILayer layer in _caseSolution)
            {
                BoxLayer blayer = layer as BoxLayer;
                if (null != blayer)
                {
                    foreach (BoxPosition bPosition in blayer)
                        graphics.AddBox(new Box(pickId++, caseAnalysis.BoxProperties, bPosition));
                }

                InterlayerPos interlayerPos = layer as InterlayerPos;
                if (null != interlayerPos)
                {
                    Box box = new Box(pickId++, caseAnalysis.InterlayerProperties);
                    // set position
                    box.Position = new Vector3D(0.0, 0.0, interlayerPos.ZLow);
                    // draw
                    graphics.AddBox(box);
                }
            }
            // get case analysis
            if (_showDimensions)
                graphics.AddDimensions(new DimensionCube(_caseSolution.CaseLength, _caseSolution.CaseWidth, _caseSolution.CaseHeight));
        }
 public void Draw(Graphics3DControl ctrl, Graphics3D graphics)
 {
     if (ctrl == graphCtrlPallet)
     {
         PalletProperties pp = CurrentPallet;
         Pallet pallet = new Pallet(pp);
         pallet.Draw(graphics, Transform3D.Identity);
         DimensionCube dc = new DimensionCube(pp.Length, pp.Width, pp.Height) { FontSize = 6.0f };
         graphics.AddDimensions(dc); 
     }
     else if (ctrl == graphCtrlSolution)
     {
         if (null == CurrentSolution) return;
         CasePalletSolutionViewer sv = new CasePalletSolutionViewer(CurrentSolution);
         sv.Draw(graphics);
     }
 }
        public void Draw(Graphics3D graphics)
        {
            // sanity check
            if (null == _solution) return;
            InterlayerProperties interlayerProperties = _analysis.InterlayerProperties;
            // draw pallet
            Pallet pallet = new Pallet(_analysis.PalletProperties);
            pallet.Draw(graphics, Transform3D.Identity);
            // draw solution
            uint pickid = 0;
            for (int iLayerIndex = 0; iLayerIndex < _solution.LayerCount; ++iLayerIndex)
            {
                bool hasInterlayer = false;
                double zInterlayer = 0.0;
                BoxLayer blayer = _solution.GetBoxLayer(iLayerIndex, ref hasInterlayer, ref zInterlayer);

                if (hasInterlayer && (null != interlayerProperties))
                {
                    // instantiate box
                    Box box = new Box(pickid++, interlayerProperties);
                    // set position
                    box.Position = new Vector3D(
                        0.5 * (_analysis.PalletProperties.Length - interlayerProperties.Length)
                        , 0.5 * (_analysis.PalletProperties.Width - interlayerProperties.Width)
                        , zInterlayer);
                    // draw
                    graphics.AddBox(box);
                }
                foreach (BoxPosition bPosition in blayer)
                    graphics.AddBox(new Pack(pickid++, _analysis.PackProperties, bPosition));

                if (_showDimensions)
                {
                    graphics.AddDimensions(
                        new DimensionCube(BoundingBoxDim(Properties.Settings.Default.DimCasePalletSol1)
                        , Color.Black, false));
                    graphics.AddDimensions(
                        new DimensionCube(BoundingBoxDim(Properties.Settings.Default.DimCasePalletSol2)
                        , Color.Red, true));
                }
            }
        }
Ejemplo n.º 13
0
        public void DrawLayer(Graphics3D graphics, int layerIndex)
        {
            // sanity check
            if (null == _solution)
            {
                return;
            }

            if (_showDimensions)
            {
                BoxLayer layer  = layerIndex % 2 == 0 ? _solution.Layer : _solution.LayerSwapped;
                uint     pickId = 0;
                foreach (BoxPosition bPosition in layer)
                {
                    graphics.AddBox(new Pack(pickId++, _solution.Analysis.PackProperties, bPosition));
                }
                graphics.AddDimensions(
                    new DimensionCube(layer.BoundingBox(_solution.Analysis.PackProperties)
                                      , Color.Black, false));
            }
        }
Ejemplo n.º 14
0
        public void Draw(Graphics3D graphics, IEnumerable <Box> boxes, bool selected, bool showOuterDimensions)
        {
            graphics.BackgroundColor = selected ? Color.LightBlue : Color.White;
            graphics.CameraPosition  = Graphics3D.Corner_0;
            // draw case (inside)
            Case crate = new Case(0, Dimensions, Dimensions, CrateColor);

            crate.DrawInside(graphics, Transform3D.Identity);

            var bbox = BBox3D.Initial;

            foreach (var b in boxes)
            {
                graphics.AddBox(b);
                bbox.Extend(b.BBox);
            }
            crate.DrawEnd(graphics);
            if (showOuterDimensions)
            {
                graphics.AddDimensions(new DimensionCube(Dimensions));
            }

            graphics.Flush();
        }
        /// <summary>
        /// Use this method when drawing a solution that belongs an analysis
        /// </summary>
        public void Draw(Graphics3D graphics)
        {
            if (null == _solution)
            {
                return;
            }
            // initialize Graphics3D object
            if (!graphics.ShowBoxIds)
            {
                // draw pallet
                Pallet pallet = new Pallet(_analysis.PalletProperties);
                pallet.Draw(graphics, Transform3D.Identity);
            }
            // load bounding box
            BBox3D loadBBox      = _solution.LoadBoundingBox;
            BBox3D loadBBoxWDeco = _solution.LoadBoundingBoxWDeco;

            #region Pallet film : begin
            // draw film
            Film film = null;
            if (_solution.Analysis.HasPalletFilm)
            {
                PalletFilmProperties palletFilmProperties = _solution.Analysis.PalletFilmProperties;
                film = new Film(
                    palletFilmProperties.Color,
                    palletFilmProperties.UseTransparency,
                    palletFilmProperties.UseHatching,
                    palletFilmProperties.HatchSpacing,
                    palletFilmProperties.HatchAngle);
                film.AddRectangle(new FilmRectangle(loadBBoxWDeco.PtMin,
                                                    HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Z_P, new Vector2D(loadBBoxWDeco.Length, loadBBoxWDeco.Height), 0.0));
                film.AddRectangle(new FilmRectangle(loadBBoxWDeco.PtMin + loadBBoxWDeco.Length * Vector3D.XAxis,
                                                    HalfAxis.HAxis.AXIS_Y_P, HalfAxis.HAxis.AXIS_Z_P, new Vector2D(loadBBoxWDeco.Width, loadBBoxWDeco.Height), 0.0));
                film.AddRectangle(new FilmRectangle(loadBBoxWDeco.PtMin + loadBBoxWDeco.Length * Vector3D.XAxis + loadBBoxWDeco.Width * Vector3D.YAxis,
                                                    HalfAxis.HAxis.AXIS_X_N, HalfAxis.HAxis.AXIS_Z_P, new Vector2D(loadBBoxWDeco.Length, loadBBoxWDeco.Height), 0.0));
                film.AddRectangle(new FilmRectangle(loadBBoxWDeco.PtMin + loadBBoxWDeco.Width * Vector3D.YAxis,
                                                    HalfAxis.HAxis.AXIS_Y_N, HalfAxis.HAxis.AXIS_Z_P, new Vector2D(loadBBoxWDeco.Width, loadBBoxWDeco.Height), 0.0));
                film.AddRectangle(new FilmRectangle(loadBBoxWDeco.PtMin + loadBBoxWDeco.Height * Vector3D.ZAxis,
                                                    HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Y_P, new Vector2D(loadBBoxWDeco.Length, loadBBoxWDeco.Width),
                                                    UnitsManager.ConvertLengthFrom(200.0, UnitsManager.UnitSystem.UNIT_METRIC1)));
                film.DrawBegin(graphics);
            }
            #endregion

            #region Pallet corners
            // *** pallet corners
            // positions
            Vector3D[] cornerPositions =
            {
                loadBBox.PtMin
                , new Vector3D(loadBBox.PtMax.X, loadBBox.PtMin.Y, loadBBox.PtMin.Z)
                , new Vector3D(loadBBox.PtMax.X, loadBBox.PtMax.Y, loadBBox.PtMin.Z)
                , new Vector3D(loadBBox.PtMin.X, loadBBox.PtMax.Y, loadBBox.PtMin.Z)
            };
            // length axes
            HalfAxis.HAxis[] lAxes =
            {
                HalfAxis.HAxis.AXIS_X_P,
                HalfAxis.HAxis.AXIS_Y_P,
                HalfAxis.HAxis.AXIS_X_N,
                HalfAxis.HAxis.AXIS_Y_N
            };
            // width axes
            HalfAxis.HAxis[] wAxes =
            {
                HalfAxis.HAxis.AXIS_Y_P,
                HalfAxis.HAxis.AXIS_X_N,
                HalfAxis.HAxis.AXIS_Y_N,
                HalfAxis.HAxis.AXIS_X_P
            };
            // corners
            Corner[] corners = new Corner[4];
            if (_solution.Analysis.HasPalletCorners)
            {
                for (int i = 0; i < 4; ++i)
                {
                    corners[i]        = new Corner(0, _solution.Analysis.PalletCornerProperties);
                    corners[i].Height = Math.Min(_solution.Analysis.PalletCornerProperties.Length, loadBBox.Height);
                    corners[i].SetPosition(cornerPositions[i], lAxes[i], wAxes[i]);
                    corners[i].DrawBegin(graphics);
                }
            }
            // *** pallet corners : end
            #endregion

            // draw solution
            uint pickId = 0;
            foreach (ILayer layer in _solution)
            {
                Layer3DBox blayer = layer as Layer3DBox;
                if (null != blayer)
                {
                    foreach (BoxPosition bPosition in blayer)
                    {
                        graphics.AddBox(new Box(pickId++, _analysis.BProperties, bPosition));
                    }
                }

                InterlayerPos interlayerPos = layer as InterlayerPos;
                if (null != interlayerPos)
                {
                    InterlayerProperties currInterlayerProperties = (0 == interlayerPos.TypeId)
                        ? _analysis.InterlayerProperties : _analysis.InterlayerPropertiesAntiSlip;
                    Box box = new Box(pickId++, currInterlayerProperties);
                    // set position
                    box.Position = new Vector3D(
                        0.5 * (_analysis.PalletProperties.Length - currInterlayerProperties.Length)
                        , 0.5 * (_analysis.PalletProperties.Width - currInterlayerProperties.Width)
                        , interlayerPos.ZLow);
                    // draw
                    graphics.AddBox(box);
                }
            }

            if (_showDimensions)
            {
                graphics.AddDimensions(
                    new DimensionCube(BoundingBoxDim(Properties.Settings.Default.DimCasePalletSol1)
                                      , Color.Black, false));
                graphics.AddDimensions(
                    new DimensionCube(BoundingBoxDim(Properties.Settings.Default.DimCasePalletSol2)
                                      , Color.Red, true));
            }

            // pallet corners
            if (_solution.Analysis.HasPalletCorners)
            {
                for (int i = 0; i < 4; ++i)
                {
                    corners[i].DrawEnd(graphics);
                }
            }
            // pallet cap
            if (_solution.HasPalletCap)
            {
                PalletCapProperties capProperties = _solution.Analysis.PalletCapProperties;
                BoxPosition         bPosition     = new BoxPosition(
                    new Vector3D(
                        0.5 * (_analysis.PalletProperties.Length - capProperties.Length),
                        0.5 * (_analysis.PalletProperties.Width - capProperties.Width),
                        loadBBox.PtMax.Z - capProperties.InsideHeight), HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Y_P);
                PalletCap cap = new PalletCap(0, capProperties, bPosition);
                cap.DrawEnd(graphics);
            }
            // pallet film
            if (_solution.Analysis.HasPalletFilm)
            {
                film.DrawEnd(graphics);
            }
            graphics.EnableFaceSorting = false;
        }
Ejemplo n.º 16
0
 public void Draw(Graphics3DControl ctrl, Graphics3D graphics)
 {
     if (graphCtrlPallet == ctrl)
     {
         Pallet pallet = new Pallet(_palletProperties);
         pallet.Draw(graphics, Transform3D.Identity);
         DimensionCube dc = new DimensionCube(_palletProperties.Length, _palletProperties.Width, _palletProperties.Height) { FontSize = 6.0f };
         graphics.AddDimensions(dc);                
     }
 }
        public void Draw(Graphics3D graphics)
        {
            if (null == _solution)
                return;
            // initialize Graphics3D object
            if (!graphics.ShowBoxIds)
            {
                // draw pallet
                Pallet pallet = new Pallet(_analysis.PalletProperties);
                pallet.Draw(graphics, Transform3D.Identity);
            }
            // draw solution
            uint pickId = 0;
            foreach (CylPosition pos in _solution)
                graphics.AddCylinder(new Cylinder(pickId++, _analysis.CylinderProperties, pos));

            if (_showDimensions)
            {
                graphics.AddDimensions(
                    new DimensionCube(BoundingBoxDim(Properties.Settings.Default.DimCasePalletSol1)
                    , Color.Black, false));
                graphics.AddDimensions(
                    new DimensionCube(BoundingBoxDim(Properties.Settings.Default.DimCasePalletSol2)
                    , Color.Red, true));
            }
        }
Ejemplo n.º 18
0
 public void Draw(Graphics3DControl ctrl, Graphics3D graphics)
 {
     BoxProperties boxProperties = new BoxProperties(null, (double)nudLength.Value, (double)nudWidth.Value, (double)nudHeight.Value);
     boxProperties.SetAllColors(_faceColors);
     boxProperties.TextureList = _textures;
     boxProperties.ShowTape = ShowTape;
     boxProperties.TapeColor = TapeColor;
     boxProperties.TapeWidth = TapeWidth;
     Box box = new Box(0, boxProperties);
     graphics.AddBox(box);
     graphics.AddDimensions(new DimensionCube((double)nudLength.Value, (double)nudWidth.Value, (double)nudHeight.Value));
 }
Ejemplo n.º 19
0
        public override void Draw(Graphics3D graphics, Transform3D transform)
        {
            if (null == Solution)
            {
                return;
            }
            // draw pallet
            if (Solution.Analysis.Containers.First() is PalletProperties palletProperties)
            {
                Pallet p = new Pallet(palletProperties);
                p.Draw(graphics, transform);
            }
            TruckProperties truckProperties = Solution.Analysis.Containers.First() as TruckProperties;

            if (null != truckProperties)
            {
                Truck t = new Truck(truckProperties);
                t.DrawBegin(graphics);
            }

            // check validity
            if (!(SolItemIndex < Solution.SolItemCount))
            {
                return;
            }
            // get list of boxes
            List <Box> boxes   = new List <Box>();
            HSolItem   solItem = Solution.SolItem(SolItemIndex);
            uint       pickId  = 0;

            foreach (HSolElement solElt in solItem.ContainedElements)
            {
                if (Analysis.ContentTypeByIndex(solElt.ContentType) is BoxProperties bProperties)
                {
                    Box b = new Box(pickId++, bProperties)
                    {
                        Position    = solElt.Position.Position,
                        HLengthAxis = solElt.Position.DirectionLength,
                        HWidthAxis  = solElt.Position.DirectionWidth
                    };
                    boxes.Add(b);
                }
            }
            // draw boxes as triangles using BSPTree
            BSPTree bspTree = new BSPTree();

            foreach (Box b in boxes)
            {
                bspTree.InsertBox(b);
            }
            bspTree.Draw(graphics);
            // draw truck end
            if (null != truckProperties)
            {
                Truck t = new Truck(truckProperties);
                t.DrawEnd(graphics);
            }

            // ### dimensions
            if (graphics.ShowDimensions)
            {
                graphics.AddDimensions(new DimensionCube(BoundingBoxDim(DimCasePalletSol1), Color.Black, false));
                graphics.AddDimensions(new DimensionCube(BoundingBoxDim(DimCasePalletSol2), Color.Red, true));
            }
            // ###
        }
Ejemplo n.º 20
0
 public void Draw(Graphics3DControl ctrl, Graphics3D graphics)
 {
     // build pack
     PackProperties packProperties = new PackProperties(null, SelectedBox, Arrangement, BoxOrientation, Wrapper);
     if (uCtrlOuterDimensions.Checked)
         packProperties.ForceOuterDimensions(
             new Vector3D(uCtrlOuterDimensions.X, uCtrlOuterDimensions.Y, uCtrlOuterDimensions.Z) );
     Pack pack = new Pack(0, packProperties);
     pack.ForceTransparency = true;
     graphics.AddBox(pack);
     graphics.AddDimensions(new DimensionCube(Vector3D.Zero, pack.Length, pack.Width, pack.Height, Color.Black, true));
     if (packProperties.Wrap.Transparent)
         graphics.AddDimensions(
             new DimensionCube(
                 packProperties.InnerOffset
                 , packProperties.InnerLength, packProperties.InnerWidth, packProperties.InnerHeight
                 , Color.Red, false));
 }
Ejemplo n.º 21
0
 public void Draw(Graphics3DControl ctrl, Graphics3D graphics)
 {
     if (0 == cbType.Items.Count)
         return;
     PalletProperties palletProperties = new PalletProperties(null, PalletTypeName, PalletLength, PalletWidth, PalletHeight);
     palletProperties.Color = PalletColor;
     Pallet pallet = new Pallet(palletProperties);
     pallet.Draw(graphics, Transform3D.Identity);
     graphics.AddDimensions(new DimensionCube(PalletLength, PalletWidth, PalletHeight));
 }
 public void Draw(Graphics3DControl ctrl, Graphics3D graphics)
 {
     // ### draw pallet
     if (graphCtrlPallet == ctrl)
     {
         PalletProperties pp = SelectedPallet;
         Pallet pallet = new Pallet(pp);
         pallet.Draw(graphics, Transform3D.Identity);
         DimensionCube dc = new DimensionCube(pp.Length, pp.Width, pp.Height) { FontSize = 6.0f };
         graphics.AddDimensions(dc);
     }
     // ### draw case definition
     else if (ctrl == graphCtrlBoxesLayout)
     {
         // ### draw case definition
         try
         {
             // get selected solution
             CaseOptimSolution solution = SelectedSolution;
             if (null == solution) return;
             // instantiate case definition viewer
             CaseDefinitionViewer cdv = new CaseDefinitionViewer(SelectedSolution.CaseDefinition, SelectedBox, BuildCaseOptimConstraintSet());
             cdv.Orientation = SelectedSolution.PalletSolution.FirstCaseOrientation;
             cdv.Draw(graphics);
         }
         catch (Exception ex)
         {
             _log.Error(ex.ToString());
         }
     }
     // ### draw associated pallet solution
     else if (ctrl == graphCtrlPalletLayout)
     {
         try
         {
             // get selected solution
             CaseOptimSolution solution = SelectedSolution;
             // get selected box
             BoxProperties boxProperties = SelectedBox;
             // get selected pallet
             PalletProperties palletProperties = SelectedPallet;
             if (null != solution && null != boxProperties && null != palletProperties)
             {
                 Vector3D outerDim = solution.CaseDefinition.OuterDimensions(boxProperties, BuildCaseOptimConstraintSet());
                 BoxProperties caseProperties = new BoxProperties(null, outerDim.X, outerDim.Y, outerDim.Z);
                 caseProperties.SetColor(Color.Chocolate);
                 CasePalletSolutionViewer.Draw(graphics, solution.PalletSolution, caseProperties, null, palletProperties);
             }
         }
         catch (Exception ex)
         {
             _log.Error(ex.ToString());
         }
     }
 }
        /// <summary>
        /// Use this method when drawing a solution that belongs an analysis
        /// </summary>
        public void Draw(Graphics3D graphics)
        {
            if (null == _solution)
                return;
            // initialize Graphics3D object
            if (!graphics.ShowBoxIds)
            {
                // draw pallet
                Pallet pallet = new Pallet(_analysis.PalletProperties);
                pallet.Draw(graphics, Transform3D.Identity);
            }
            // load bounding box
            BBox3D loadBBox = _solution.LoadBoundingBox; 
            BBox3D loadBBoxWDeco = _solution.LoadBoundingBoxWDeco;

            #region Pallet film : begin
            // draw film
            Film film = null;
            if (_solution.Analysis.HasPalletFilm)
            {
                PalletFilmProperties palletFilmProperties = _solution.Analysis.PalletFilmProperties;
                film = new Film(
                    palletFilmProperties.Color,
                    palletFilmProperties.UseTransparency,
                    palletFilmProperties.UseHatching,
                    palletFilmProperties.HatchSpacing,
                    palletFilmProperties.HatchAngle);
                film.AddRectangle(new FilmRectangle(loadBBoxWDeco.PtMin,
                    HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Z_P, new Vector2D(loadBBoxWDeco.Length, loadBBoxWDeco.Height), 0.0));
                film.AddRectangle(new FilmRectangle(loadBBoxWDeco.PtMin + loadBBoxWDeco.Length * Vector3D.XAxis,
                    HalfAxis.HAxis.AXIS_Y_P, HalfAxis.HAxis.AXIS_Z_P, new Vector2D(loadBBoxWDeco.Width, loadBBoxWDeco.Height), 0.0));
                film.AddRectangle(new FilmRectangle(loadBBoxWDeco.PtMin + loadBBoxWDeco.Length * Vector3D.XAxis + loadBBoxWDeco.Width * Vector3D.YAxis,
                    HalfAxis.HAxis.AXIS_X_N, HalfAxis.HAxis.AXIS_Z_P, new Vector2D(loadBBoxWDeco.Length, loadBBoxWDeco.Height), 0.0));
                film.AddRectangle(new FilmRectangle(loadBBoxWDeco.PtMin + loadBBoxWDeco.Width * Vector3D.YAxis,
                    HalfAxis.HAxis.AXIS_Y_N, HalfAxis.HAxis.AXIS_Z_P, new Vector2D(loadBBoxWDeco.Width, loadBBoxWDeco.Height), 0.0));
                film.AddRectangle(new FilmRectangle(loadBBoxWDeco.PtMin + loadBBoxWDeco.Height * Vector3D.ZAxis,
                    HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Y_P, new Vector2D(loadBBoxWDeco.Length, loadBBoxWDeco.Width),
                    UnitsManager.ConvertLengthFrom(200.0, UnitsManager.UnitSystem.UNIT_METRIC1)));
                film.DrawBegin(graphics);
            }
            #endregion

            #region Pallet corners
            // *** pallet corners 
            // positions
            Vector3D[] cornerPositions =
            {
                loadBBox.PtMin
                , new Vector3D(loadBBox.PtMax.X, loadBBox.PtMin.Y, loadBBox.PtMin.Z)
                , new Vector3D(loadBBox.PtMax.X, loadBBox.PtMax.Y, loadBBox.PtMin.Z)
                , new Vector3D(loadBBox.PtMin.X, loadBBox.PtMax.Y, loadBBox.PtMin.Z)
            };
            // length axes
            HalfAxis.HAxis[] lAxes =
            {
                HalfAxis.HAxis.AXIS_X_P,
                HalfAxis.HAxis.AXIS_Y_P,
                HalfAxis.HAxis.AXIS_X_N,
                HalfAxis.HAxis.AXIS_Y_N
            };
            // width axes
            HalfAxis.HAxis[] wAxes =
            {
                HalfAxis.HAxis.AXIS_Y_P,
                HalfAxis.HAxis.AXIS_X_N,
                HalfAxis.HAxis.AXIS_Y_N,
                HalfAxis.HAxis.AXIS_X_P
            };
            // corners
            Corner[] corners = new Corner[4];
            if (_solution.Analysis.HasPalletCorners)
            {
                for (int i = 0; i < 4; ++i)
                {
                    corners[i] = new Corner(0, _solution.Analysis.PalletCornerProperties);
                    corners[i].Height = Math.Min(_solution.Analysis.PalletCornerProperties.Length, loadBBox.Height);
                    corners[i].SetPosition(cornerPositions[i], lAxes[i], wAxes[i]);
                    corners[i].DrawBegin(graphics);
                }
            }
            // *** pallet corners : end
            #endregion

            // draw solution
            uint pickId = 0;
            foreach (ILayer layer in _solution)
            {
                BoxLayer blayer = layer as BoxLayer;
                if (null != blayer)
                {
                    foreach (BoxPosition bPosition in blayer)
                        graphics.AddBox(new Box(pickId++, _analysis.BProperties, bPosition));
                }

                InterlayerPos interlayerPos = layer as InterlayerPos;
                if (null != interlayerPos)
                {
                    InterlayerProperties currInterlayerProperties = (0 == interlayerPos.TypeId)
                        ? _analysis.InterlayerProperties : _analysis.InterlayerPropertiesAntiSlip;
                    Box box = new Box(pickId++, currInterlayerProperties);
                    // set position
                    box.Position = new Vector3D(
                        0.5 * (_analysis.PalletProperties.Length - currInterlayerProperties.Length)
                        , 0.5 * (_analysis.PalletProperties.Width - currInterlayerProperties.Width)
                        , interlayerPos.ZLow);
                    // draw
                    graphics.AddBox(box);
                }
            }

            if (_showDimensions)
            {
                graphics.AddDimensions(
                    new DimensionCube(BoundingBoxDim(Properties.Settings.Default.DimCasePalletSol1)
                    , Color.Black, false));
                graphics.AddDimensions(
                    new DimensionCube(BoundingBoxDim(Properties.Settings.Default.DimCasePalletSol2)
                    , Color.Red, true));
            }

            // pallet corners
            if (_solution.Analysis.HasPalletCorners)
            {
                for (int i = 0; i < 4; ++i)
                    corners[i].DrawEnd(graphics);
            }
            // pallet cap
            if (_solution.HasPalletCap)
            {
                PalletCapProperties capProperties = _solution.Analysis.PalletCapProperties;
                Vector3D pos = new Vector3D(
                    0.5 * (_analysis.PalletProperties.Length - capProperties.Length),
                    0.5 * (_analysis.PalletProperties.Width - capProperties.Width),
                    loadBBox.PtMax.Z - capProperties.InsideHeight);
                PalletCap cap = new PalletCap(0, capProperties, pos);
                cap.DrawEnd(graphics);
            }
            // pallet film
            if (_solution.Analysis.HasPalletFilm)
            {
                film.DrawEnd(graphics);
            }
            graphics.EnableFaceSorting = false;
        }
        /// <summary>
        ///  Use this method when solution does not refer an analysis (e.g. when displaying CaseOptimizer result)
        /// </summary>
        public static void Draw(Graphics3D graphics
            , CasePalletSolution solution
            , BoxProperties boxProperties, InterlayerProperties interlayerProperties, PalletProperties palletProperties)
        {
            // draw pallet
            Pallet pallet = new Pallet(palletProperties);
            pallet.Draw(graphics, Transform3D.Identity);
            // draw solution
            uint pickId = 0;
            foreach (ILayer layer in solution)
            {
                BoxLayer blayer = layer as BoxLayer;
                if (null != blayer)
                {
                    foreach (BoxPosition bPosition in blayer)
                        graphics.AddBox(new Box(pickId++, boxProperties, bPosition));
                }

                InterlayerPos interlayerPos = layer as InterlayerPos;
                if (null != interlayerPos && null != interlayerProperties)
                {
                    Box box = new Box(pickId++, interlayerProperties);
                    // set position
                    box.Position = new Vector3D(
                        0.5 * (palletProperties.Length - interlayerProperties.Length)
                        , 0.5 * (palletProperties.Width - interlayerProperties.Width)
                        , interlayerPos.ZLow);
                    // draw
                    graphics.AddBox(box);
                }
            }
 
            // always show dimensions
            BoxLayer bLayer = solution[solution.Count - 1] as BoxLayer;
            double palletHeight = solution[solution.Count - 1].ZLow + (null != bLayer ? bLayer.Thickness(boxProperties) : 0.0);

            // show dimensions
            graphics.AddDimensions(new DimensionCube(solution.BoundingBox, Color.Black, false));
            graphics.AddDimensions(new DimensionCube(solution.LoadBoundingBox, Color.Red, true));
        }
Ejemplo n.º 25
0
        public override void Draw(Graphics3D graphics, bool showDimensions)
        {
            // clear list of picking box
            ClearPickingBoxes();

            if (null == _solution)
            {
                return;
            }
            Analysis           analysis           = _solution.Analysis;
            AnalysisCasePallet analysisCasePallet = analysis as AnalysisCasePallet;
            AnalysisBoxCase    analysisBoxCase    = analysis as AnalysisBoxCase;

            if (null != analysisCasePallet)
            {
                // ### draw pallet
                Pallet pallet = new Pallet(analysisCasePallet.PalletProperties);
                pallet.Draw(graphics, Transform3D.Identity);
            }
            else if (null != analysisBoxCase)
            {
                // draw case (inside)
                Case case_ = new Case(analysisBoxCase._caseProperties);
                case_.DrawInside(graphics);
            }

            // ### draw solution
            uint          layerId = 0, pickId = 0;
            List <ILayer> layers = _solution.Layers;

            foreach (ILayer layer in layers)
            {
                // ### layer of boxes
                BoxLayer blayer = layer as BoxLayer;
                if (null != blayer)
                {
                    BBox3D bbox = new BBox3D();
                    foreach (BoxPosition bPosition in blayer)
                    {
                        Box b = null;
                        if (analysis.Content is PackProperties)
                        {
                            b = new Pack(pickId++, analysis.Content as PackProperties, bPosition);
                        }
                        else
                        {
                            b = new Box(pickId++, analysis.Content, bPosition);
                        }
                        graphics.AddBox(b);
                        bbox.Extend(b.BBox);
                    }
                    // add layer BBox
                    AddPickingBox(bbox, layerId);
                    // draw bounding box around selected layer
                    if (layerId == _solution.SelectedLayerIndex)
                    {
                        DrawLayerBoundingBox(graphics, bbox);
                    }
                    ++layerId;
                }
                // ### interlayer
                InterlayerPos interlayerPos = layer as InterlayerPos;
                if (null != interlayerPos)
                {
                    InterlayerProperties interlayerProp = _solution.Interlayers[interlayerPos.TypeId];
                    if (null != interlayerProp)
                    {
                        Box box = new Box(pickId++, interlayerProp);
                        box.Position = new Vector3D(
                            0.5 * (analysis.ContainerDimensions.X - interlayerProp.Length)
                            , 0.5 * (analysis.ContainerDimensions.Y - interlayerProp.Width)
                            , interlayerPos.ZLow
                            );
                        graphics.AddBox(box);
                    }
                }
            }
            BBox3D loadBBox      = _solution.BBoxLoad;
            BBox3D loadBBoxWDeco = _solution.BBoxLoadWDeco;

            if (null != analysisCasePallet)
            {
                #region Pallet corners
                // ### pallet corners : Begin
                Corner[] corners = new Corner[4];
                if (analysisCasePallet.HasPalletCorners)
                {
                    // positions
                    Vector3D[] cornerPositions =
                    {
                        loadBBox.PtMin
                        , new Vector3D(loadBBox.PtMax.X, loadBBox.PtMin.Y, loadBBox.PtMin.Z)
                        , new Vector3D(loadBBox.PtMax.X, loadBBox.PtMax.Y, loadBBox.PtMin.Z)
                        , new Vector3D(loadBBox.PtMin.X, loadBBox.PtMax.Y, loadBBox.PtMin.Z)
                    };
                    // length axes
                    HalfAxis.HAxis[] lAxes =
                    {
                        HalfAxis.HAxis.AXIS_X_P,
                        HalfAxis.HAxis.AXIS_Y_P,
                        HalfAxis.HAxis.AXIS_X_N,
                        HalfAxis.HAxis.AXIS_Y_N
                    };
                    // width axes
                    HalfAxis.HAxis[] wAxes =
                    {
                        HalfAxis.HAxis.AXIS_Y_P,
                        HalfAxis.HAxis.AXIS_X_N,
                        HalfAxis.HAxis.AXIS_Y_N,
                        HalfAxis.HAxis.AXIS_X_P
                    };
                    // corners
                    if (analysisCasePallet.HasPalletCorners)
                    {
                        for (int i = 0; i < 4; ++i)
                        {
                            corners[i]        = new Corner(0, analysisCasePallet.PalletCornerProperties);
                            corners[i].Height = Math.Min(analysisCasePallet.PalletCornerProperties.Length, loadBBox.Height);
                            corners[i].SetPosition(cornerPositions[i], lAxes[i], wAxes[i]);
                            corners[i].DrawBegin(graphics);
                        }
                    }
                }
                #endregion

                #region Pallet film
                // ### pallet film
                Film film = null;
                if (analysisCasePallet.HasPalletFilm)
                {
                    PalletFilmProperties palletFilmProperties = analysisCasePallet.PalletFilmProperties;
                    film = new Film(
                        palletFilmProperties.Color,
                        palletFilmProperties.UseTransparency,
                        palletFilmProperties.UseHatching,
                        palletFilmProperties.HatchSpacing,
                        palletFilmProperties.HatchAngle);
                    film.AddRectangle(new FilmRectangle(loadBBoxWDeco.PtMin,
                                                        HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Z_P, new Vector2D(loadBBoxWDeco.Length, loadBBoxWDeco.Height), 0.0));
                    film.AddRectangle(new FilmRectangle(loadBBoxWDeco.PtMin + loadBBoxWDeco.Length * Vector3D.XAxis,
                                                        HalfAxis.HAxis.AXIS_Y_P, HalfAxis.HAxis.AXIS_Z_P, new Vector2D(loadBBoxWDeco.Width, loadBBoxWDeco.Height), 0.0));
                    film.AddRectangle(new FilmRectangle(loadBBoxWDeco.PtMin + loadBBoxWDeco.Length * Vector3D.XAxis + loadBBoxWDeco.Width * Vector3D.YAxis,
                                                        HalfAxis.HAxis.AXIS_X_N, HalfAxis.HAxis.AXIS_Z_P, new Vector2D(loadBBoxWDeco.Length, loadBBoxWDeco.Height), 0.0));
                    film.AddRectangle(new FilmRectangle(loadBBoxWDeco.PtMin + loadBBoxWDeco.Width * Vector3D.YAxis,
                                                        HalfAxis.HAxis.AXIS_Y_N, HalfAxis.HAxis.AXIS_Z_P, new Vector2D(loadBBoxWDeco.Width, loadBBoxWDeco.Height), 0.0));
                    film.AddRectangle(new FilmRectangle(loadBBoxWDeco.PtMin + loadBBoxWDeco.Height * Vector3D.ZAxis,
                                                        HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Y_P, new Vector2D(loadBBoxWDeco.Length, loadBBoxWDeco.Width),
                                                        UnitsManager.ConvertLengthFrom(200.0, UnitsManager.UnitSystem.UNIT_METRIC1)));
                    film.DrawBegin(graphics);
                }
                #endregion

                #region Pallet corners
                // pallet corners : End
                if (analysisCasePallet.HasPalletCorners)
                {
                    for (int i = 0; i < 4; ++i)
                    {
                        corners[i].DrawEnd(graphics);
                    }
                }
                #endregion

                #region Pallet Cap
                // ### pallet cap
                if (analysisCasePallet.HasPalletCap)
                {
                    PalletCapProperties capProperties = analysisCasePallet.PalletCapProperties;
                    Vector3D            pos           = new Vector3D(
                        0.5 * (analysisCasePallet.PalletProperties.Length - capProperties.Length),
                        0.5 * (analysisCasePallet.PalletProperties.Width - capProperties.Width),
                        loadBBox.PtMax.Z - capProperties.InsideHeight);
                    PalletCap cap = new PalletCap(0, capProperties, pos);
                    cap.DrawEnd(graphics);
                }
                #endregion

                #region Pallet film
                // pallet film : End
                if (analysisCasePallet.HasPalletFilm)
                {
                    film.DrawEnd(graphics);
                }
                #endregion
            }

            // ### dimensions
            if (showDimensions)
            {
                graphics.AddDimensions(
                    new DimensionCube(BoundingBoxDim(Properties.Settings.Default.DimCasePalletSol1)
                                      , Color.Black, false));
                graphics.AddDimensions(
                    new DimensionCube(BoundingBoxDim(Properties.Settings.Default.DimCasePalletSol2)
                                      , Color.Red, true));
            }
        }
Ejemplo n.º 26
0
 public void Draw(Graphics3DControl ctrl, Graphics3D graphics)
 {
     BundleProperties bundleProperties = new BundleProperties(
         null, BundleName, Description
         , BundleLength, BundleWidth, UnitThickness, UnitWeight, NoFlats, Color);
     Box box = new Box(0, bundleProperties);
     graphics.AddBox(box);
     graphics.AddDimensions(new DimensionCube(BundleLength, BundleWidth, UnitThickness * NoFlats));
 }
Ejemplo n.º 27
0
 public void Draw(Graphics3DControl ctrl, Graphics3D graphics)
 {
     if (TruckLength == 0 || TruckWidth == 0 || TruckHeight == 0)
         return;
     TruckProperties truckProperties = new TruckProperties(null, TruckLength, TruckWidth, TruckHeight);
     truckProperties.Color = TruckColor;
     Truck truck = new Truck(truckProperties);
     truck.DrawBegin(graphics);
     truck.DrawEnd(graphics);
     graphics.AddDimensions(new DimensionCube(TruckLength, TruckWidth, TruckHeight));
 }
Ejemplo n.º 28
0
        /// <summary>
        /// Draw case solution
        /// </summary>
        public void Draw(Graphics3D graphics)
        {
            if (null == _caseSolution)
            {
                throw new Exception("No case solution defined!");
            }

            // load pallet solution
            BoxProperties caseProperties;

            CasePalletSolution palletSolution = _caseSolution.PalletSolutionDesc.LoadPalletSolution();

            if (null == palletSolution)
            {
                caseProperties = new BoxProperties(null, _caseSolution.CaseLength, _caseSolution.CaseWidth, _caseSolution.CaseHeight);
            }
            else
            {
                CasePalletAnalysis palletAnalysis = palletSolution.Analysis;
                // retrieve case properties
                caseProperties = palletAnalysis.BProperties as BoxProperties;
            }
            if (null == caseProperties)
            {
                return;
            }
            // draw case (inside)
            Case case_ = new Case(caseProperties);

            case_.DrawInside(graphics);
            // get case analysis
            BoxCasePalletAnalysis caseAnalysis = _caseSolution.ParentCaseAnalysis;
            // draw solution
            uint pickId = 0;

            foreach (ILayer layer in _caseSolution)
            {
                BoxLayer blayer = layer as BoxLayer;
                if (null != blayer)
                {
                    foreach (BoxPosition bPosition in blayer)
                    {
                        graphics.AddBox(new Box(pickId++, caseAnalysis.BoxProperties, bPosition));
                    }
                }

                InterlayerPos interlayerPos = layer as InterlayerPos;
                if (null != interlayerPos)
                {
                    Box box = new Box(pickId++, caseAnalysis.InterlayerProperties);
                    // set position
                    box.Position = new Vector3D(0.0, 0.0, interlayerPos.ZLow);
                    // draw
                    graphics.AddBox(box);
                }
            }
            // get case analysis
            if (_showDimensions)
            {
                graphics.AddDimensions(new DimensionCube(_caseSolution.CaseLength, _caseSolution.CaseWidth, _caseSolution.CaseHeight));
            }
        }
        public void DrawLayer(Graphics3D graphics, int layerIndex)
        {
            // sanity check
            if (null == _solution) return;

            if (_showDimensions)
            {
                BoxLayer layer = layerIndex %2 == 0 ? _solution.Layer : _solution.LayerSwapped;
                uint pickId = 0;
                foreach (BoxPosition bPosition in layer)
                    graphics.AddBox(new Pack(pickId++, _solution.Analysis.PackProperties, bPosition));
                graphics.AddDimensions(
                    new DimensionCube(layer.BoundingBox(_solution.Analysis.PackProperties)
                        , Color.Black, false));
            }
        }
Ejemplo n.º 30
0
 public void Draw(Graphics3DControl ctrl, Graphics3D graphics)
 {
     if (graphCtrlBoxCase == ctrl)
     {
         BoxProperties boxProperties = new BoxProperties(null
             , _caseOfBoxesProperties.Length, _caseOfBoxesProperties.Width, _caseOfBoxesProperties.Height);
         boxProperties.SetAllColors(_faceColors);
         boxProperties.TextureList = _textures;
         Box box = new Box(0, boxProperties);
         graphics.AddBox(box);
         graphics.AddDimensions(new DimensionCube(_caseOfBoxesProperties.Length, _caseOfBoxesProperties.Width, _caseOfBoxesProperties.Height));
     }
     else if (graphCtrlCaseDefinition == ctrl)
     {
         CaseDefinitionViewer viewer = new CaseDefinitionViewer(_caseOfBoxesProperties.CaseDefinition, _caseOfBoxesProperties.InsideBoxProperties, _caseOfBoxesProperties.CaseOptimConstraintSet);
         viewer.CaseProperties = _caseOfBoxesProperties;
         viewer.Orientation = new Basics.Orientation(HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Y_P);
         viewer.Draw(graphics);  
     }
 }
Ejemplo n.º 31
0
        public void Draw(Graphics3DControl ctrl, Graphics3D graphics)
        {
            if (null == _dt)
                return;
            DataCase dtCase = _dt as DataCase;
            if (null != dtCase)
            {
                Box b = new Box(0, ToCase(dtCase));
                graphics.AddBox(b);
                graphics.AddDimensions(new DimensionCube(dtCase.OuterDimensions));
            }
            DataBox dtBox = _dt as DataBox;
            if (null != dtBox)
            {
                Box b = new Box(0, ToBox(dtBox));
                graphics.AddBox(b);
                graphics.AddDimensions(new DimensionCube(dtBox.Dimensions));
            }
            DataPallet dtPallet = _dt as DataPallet;
            if (null != dtPallet)
            {
                Pallet pallet = new Pallet(ToPallet(dtPallet));
                pallet.Draw(graphics, Sharp3D.Math.Core.Transform3D.Identity);
                graphics.AddDimensions(new DimensionCube(dtPallet.Dimensions));
            }
            DataInterlayer dtInterlayer = _dt as DataInterlayer;
            if (null != dtInterlayer)
            {
                graphics.AddBox(new Box(0, ToInterlayer(dtInterlayer)));
                graphics.AddDimensions(new DimensionCube(dtInterlayer.Dimensions));
            }

            DataPalletCap dtPalletCap = _dt as DataPalletCap;
            if (null != dtPalletCap)
            {
                PalletCap palletCap = new PalletCap(0, ToPalletCap(dtPalletCap), Sharp3D.Math.Core.Vector3D.Zero);
                palletCap.Draw(graphics);
                graphics.AddDimensions(new DimensionCube(dtPalletCap.Dimensions));
            }

            DataCylinder dtCylinder = _dt as DataCylinder;
            if (null != dtCylinder)
            {
                Cylinder cyl = new Cylinder(0, ToCylinder(dtCylinder));
                graphics.AddCylinder(cyl);
            }
        }
Ejemplo n.º 32
0
        public override void Draw(Graphics3D graphics, Transform3D transform)
        {
            // clear list of picking box
            ClearPickingBoxes();

            if (null == _solution)
            {
                return;
            }
            AnalysisHomo analysis = _solution.Analysis;

            if (analysis is AnalysisPackablePallet analysisPackablePallet)
            {
                // ### draw pallet
                Pallet pallet = new Pallet(analysisPackablePallet.PalletProperties);
                pallet.Draw(graphics, transform);
            }
            else if (analysis is AnalysisPackableCase analysisPackableCase)
            {
                // ### draw case (inside)
                Case case_ = new Case(analysisPackableCase.CaseProperties);
                case_.DrawInside(graphics, transform);
            }
            else if (analysis is AnalysisPackableTruck analysisPackableTruck)
            {
                // ### draw truck
                Truck truck = new Truck(analysisPackableTruck.TruckProperties);
                truck.DrawBegin(graphics);
            }
            else if (analysis is AnalysisPalletTruck analysisPalletTruck)
            {
                // ### draw truck
                Truck truck = new Truck(analysisPalletTruck.TruckProperties);
                truck.DrawBegin(graphics);
            }
            // ### draw solution
            uint          layerId = 0, pickId = 0;
            List <ILayer> layers = _solution.Layers;

            foreach (ILayer layer in layers)
            {
                BBox3D bbox = new BBox3D();
                // ### layer of boxes
                Layer3DBox layerBox = layer as Layer3DBox;
                if (null != layerBox)
                {
                    if (analysis.Content is LoadedPallet)
                    {
                        LoadedPallet loadedPallet = analysis.Content as LoadedPallet;
                        BBox3D       solBBox      = loadedPallet.ParentAnalysis.Solution.BBoxGlobal;
                        foreach (BoxPosition bPosition in layerBox)
                        {
                            bool simplified = false;
                            if (simplified)
                            {
                                BoxProperties bProperties = new BoxProperties(null, solBBox.Dimensions);
                                bProperties.SetColor(Color.Chocolate);
                                Box b = new Box(pickId++, bProperties, bPosition.Transform(transform));
                                graphics.AddBox(b);
                                bbox.Extend(b.BBox);
                            }
                            else
                            {
                                graphics.AddImage(loadedPallet.ParentAnalysis, solBBox.DimensionsVec, bPosition.Transform(transform));
                            }
                        }
                    }
                    else
                    {
                        bool        aboveSelectedLayer = (_solution.SelectedLayerIndex != -1) && (layerId > _solution.SelectedLayerIndex);
                        Transform3D upTranslation      = Transform3D.Translation(new Vector3D(0.0, 0.0, aboveSelectedLayer ? DistanceAboveSelectedLayer : 0.0));

                        foreach (BoxPosition bPosition in layerBox)
                        {
                            BoxPosition boxPositionModified = bPosition.Transform(transform * upTranslation);
                            Box         b = null;
                            if (analysis.Content is PackProperties)
                            {
                                b = new Pack(pickId++, analysis.Content as PackProperties, boxPositionModified);
                            }
                            else
                            {
                                b = new Box(pickId++, analysis.Content as PackableBrick, boxPositionModified);
                            }
                            graphics.AddBox(b);
                            bbox.Extend(b.BBox);
                        }
                    }
                }
                Layer3DCyl layerCyl = layer as Layer3DCyl;
                if (null != layerCyl)
                {
                    foreach (Vector3D vPos in layerCyl)
                    {
                        Cylinder c = new Cylinder(pickId++, analysis.Content as CylinderProperties, new CylPosition(transform.transform(vPos), HalfAxis.HAxis.AXIS_Z_P));
                        graphics.AddCylinder(c);
                        bbox.Extend(c.BBox);
                    }
                }
                if (null != layerBox || null != layerCyl)
                {
                    // add layer BBox
                    AddPickingBox(bbox, layerId);
                    // draw bounding box around selected layer
                    if (layerId == _solution.SelectedLayerIndex)
                    {
                        DrawLayerBoundingBox(graphics, bbox);
                    }
                    ++layerId;
                }

                // ### interlayer
                if (layer is InterlayerPos interlayerPos)
                {
                    InterlayerProperties interlayerProp = _solution.Interlayers[interlayerPos.TypeId];
                    if (null != interlayerProp)
                    {
                        bool        aboveSelectedLayer = (_solution.SelectedLayerIndex != -1) && (layerId > _solution.SelectedLayerIndex);
                        Transform3D upTranslation      = Transform3D.Translation(new Vector3D(0.0, 0.0, aboveSelectedLayer ? DistanceAboveSelectedLayer : 0.0));

                        BoxPosition bPosition = new BoxPosition(
                            new Vector3D(
                                analysis.Offset.X + 0.5 * (analysis.ContainerDimensions.X - interlayerProp.Length)
                                , analysis.Offset.Y + 0.5 * (analysis.ContainerDimensions.Y - interlayerProp.Width)
                                , interlayerPos.ZLow
                                ), HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Y_P);
                        Box box = new Box(pickId++, interlayerProp, bPosition.Transform(transform * upTranslation));
                        graphics.AddBox(box);
                        bbox.Extend(box.BBox);
                    }
                }
            }
            BBox3D loadBBox      = _solution.BBoxLoad;
            BBox3D loadBBoxWDeco = _solution.BBoxLoadWDeco;

            if (analysis is AnalysisCasePallet analysisCasePallet)
            {
                #region Pallet corners
                // ### pallet corners : Begin
                Corner[] corners = new Corner[4];
                if (analysisCasePallet.HasPalletCorners)
                {
                    // positions
                    Vector3D[] cornerPositions =
                    {
                        loadBBox.PtMin
                        , new Vector3D(loadBBox.PtMax.X, loadBBox.PtMin.Y, loadBBox.PtMin.Z)
                        , new Vector3D(loadBBox.PtMax.X, loadBBox.PtMax.Y, loadBBox.PtMin.Z)
                        , new Vector3D(loadBBox.PtMin.X, loadBBox.PtMax.Y, loadBBox.PtMin.Z)
                    };
                    // length axes
                    HalfAxis.HAxis[] lAxes =
                    {
                        HalfAxis.HAxis.AXIS_X_P,
                        HalfAxis.HAxis.AXIS_Y_P,
                        HalfAxis.HAxis.AXIS_X_N,
                        HalfAxis.HAxis.AXIS_Y_N
                    };
                    // width axes
                    HalfAxis.HAxis[] wAxes =
                    {
                        HalfAxis.HAxis.AXIS_Y_P,
                        HalfAxis.HAxis.AXIS_X_N,
                        HalfAxis.HAxis.AXIS_Y_N,
                        HalfAxis.HAxis.AXIS_X_P
                    };
                    // corners
                    if (analysisCasePallet.HasPalletCorners)
                    {
                        for (int i = 0; i < 4; ++i)
                        {
                            corners[i] = new Corner(0, analysisCasePallet.PalletCornerProperties)
                            {
                                Height = Math.Min(analysisCasePallet.PalletCornerProperties.Length, loadBBox.Height)
                            };
                            corners[i].SetPosition(
                                transform.transform(cornerPositions[i])
                                , HalfAxis.Transform(lAxes[i], transform), HalfAxis.Transform(wAxes[i], transform)
                                );
                            corners[i].DrawBegin(graphics);
                        }
                    }
                }
                #endregion

                #region Pallet film
                // ### pallet film
                Film film = null;
                if (analysisCasePallet.HasPalletFilm && -1 == _solution.SelectedLayerIndex)
                {
                    // instantiate film
                    PalletFilmProperties palletFilmProperties = analysisCasePallet.PalletFilmProperties;
                    film = new Film(
                        palletFilmProperties.Color,
                        palletFilmProperties.UseTransparency,
                        palletFilmProperties.UseHatching,
                        palletFilmProperties.HatchSpacing,
                        palletFilmProperties.HatchAngle);
                    film.AddRectangle(new FilmRectangle(transform.transform(loadBBoxWDeco.PtMin)
                                                        , HalfAxis.Transform(HalfAxis.HAxis.AXIS_X_P, transform), HalfAxis.Transform(HalfAxis.HAxis.AXIS_Z_P, transform)
                                                        , new Vector2D(loadBBoxWDeco.Length, loadBBoxWDeco.Height), 0.0));
                    film.AddRectangle(new FilmRectangle(transform.transform(loadBBoxWDeco.PtMin + loadBBoxWDeco.Length * Vector3D.XAxis)
                                                        , HalfAxis.Transform(HalfAxis.HAxis.AXIS_Y_P, transform), HalfAxis.Transform(HalfAxis.HAxis.AXIS_Z_P, transform)
                                                        , new Vector2D(loadBBoxWDeco.Width, loadBBoxWDeco.Height), 0.0));
                    film.AddRectangle(new FilmRectangle(transform.transform(loadBBoxWDeco.PtMin + loadBBoxWDeco.Length * Vector3D.XAxis + loadBBoxWDeco.Width * Vector3D.YAxis)
                                                        , HalfAxis.Transform(HalfAxis.HAxis.AXIS_X_N, transform), HalfAxis.Transform(HalfAxis.HAxis.AXIS_Z_P, transform)
                                                        , new Vector2D(loadBBoxWDeco.Length, loadBBoxWDeco.Height), 0.0));
                    film.AddRectangle(new FilmRectangle(transform.transform(loadBBoxWDeco.PtMin + loadBBoxWDeco.Width * Vector3D.YAxis)
                                                        , HalfAxis.Transform(HalfAxis.HAxis.AXIS_Y_N, transform), HalfAxis.Transform(HalfAxis.HAxis.AXIS_Z_P, transform)
                                                        , new Vector2D(loadBBoxWDeco.Width, loadBBoxWDeco.Height), 0.0));
                    film.AddRectangle(new FilmRectangle(transform.transform(loadBBoxWDeco.PtMin + loadBBoxWDeco.Height * Vector3D.ZAxis)
                                                        , HalfAxis.Transform(HalfAxis.HAxis.AXIS_X_P, transform), HalfAxis.Transform(HalfAxis.HAxis.AXIS_Y_P, transform)
                                                        , new Vector2D(loadBBoxWDeco.Length, loadBBoxWDeco.Width)
                                                        , UnitsManager.ConvertLengthFrom(200.0, UnitsManager.UnitSystem.UNIT_METRIC1)));
                    film.DrawBegin(graphics);
                }
                #endregion

                #region Pallet corners
                // pallet corners : End
                if (analysisCasePallet.HasPalletCorners)
                {
                    for (int i = 0; i < 4; ++i)
                    {
                        corners[i].DrawEnd(graphics);
                    }
                }
                #endregion

                #region Pallet Cap
                // ### pallet cap
                if (analysisCasePallet.HasPalletCap)
                {
                    PalletCapProperties capProperties = analysisCasePallet.PalletCapProperties;
                    BoxPosition         bPosition     = new BoxPosition(new Vector3D(
                                                                            0.5 * (analysisCasePallet.PalletProperties.Length - capProperties.Length),
                                                                            0.5 * (analysisCasePallet.PalletProperties.Width - capProperties.Width),
                                                                            loadBBox.PtMax.Z - capProperties.InsideHeight)
                                                                        , HalfAxis.Transform(HalfAxis.HAxis.AXIS_X_P, transform)
                                                                        , HalfAxis.Transform(HalfAxis.HAxis.AXIS_Y_P, transform)
                                                                        );

                    Transform3D upTranslation = Transform3D.Translation(new Vector3D(0.0, 0.0, -1 != _solution.SelectedLayerIndex ? DistanceAboveSelectedLayer : 0.0));
                    PalletCap   cap           = new PalletCap(0, capProperties, bPosition.Transform(upTranslation));
                    cap.DrawEnd(graphics);
                }
                #endregion

                #region Pallet film
                // pallet film : End
                if (analysisCasePallet.HasPalletFilm && null != film)
                {
                    film.DrawEnd(graphics);
                }
                #endregion
            }
            else if (analysis is AnalysisPackableTruck analysisPackableTruck2)
            {
                Truck truck = new Truck(analysisPackableTruck2.TruckProperties);
                truck.DrawEnd(graphics);
            }
            else if (analysis is AnalysisPalletTruck analysisPalletTruck)
            {
                Truck truck = new Truck(analysisPalletTruck.TruckProperties);
                truck.DrawEnd(graphics);
            }
            // ### dimensions
            // dimensions should only be shown when no layer is selected
            if (graphics.ShowDimensions && (-1 == _solution.SelectedLayerIndex))
            {
                graphics.AddDimensions(new DimensionCube(BoundingBoxDim(DimCasePalletSol1), Color.Black, false));
                graphics.AddDimensions(new DimensionCube(BoundingBoxDim(DimCasePalletSol2), Color.Red, true));
            }
            // ###
        }
Ejemplo n.º 33
0
        public override void Draw(Graphics3D graphics, Transform3D transform)
        {
            // clear list of picking box
            ClearPickingBoxes();

            if (null == Solution)
            {
                return;
            }
            AnalysisHomo analysis = Solution.Analysis;

            if (analysis is AnalysisPackablePallet analysisPackablePallet)
            {
                // ### draw pallet
                Pallet pallet = new Pallet(analysisPackablePallet.PalletProperties);
                pallet.Draw(graphics, transform);

                if (analysis is AnalysisCasePallet && -1 == Solution.SelectedLayerIndex)
                {
                    // ### strappers
                    SolutionLayered sol = Solution;
                    foreach (var sd in sol.Strappers)
                    {
                        if (null != sd.Points && sd.Points.Count > 0)
                        {
                            Strapper s = new Strapper(
                                transform.transform(IntToAxis(sd.Strapper.Axis)),
                                sd.Strapper.Width,
                                sd.Strapper.Color,
                                sd.Points.ConvertAll(p => transform.transform(p)).ToList());
                            s.DrawBegin(graphics);
                        }
                    }
                }
            }
            else if (analysis is AnalysisPackableCase analysisPackableCase)
            {
                // ### draw case (inside)
                Case case_ = new Case(analysisPackableCase.CaseProperties);
                case_.DrawInside(graphics, transform);
            }
            else if (analysis is AnalysisPackableTruck analysisPackableTruck)
            {
                // ### draw truck
                Truck truck = new Truck(analysisPackableTruck.TruckProperties);
                truck.DrawBegin(graphics);
            }
            else if (analysis is AnalysisPalletTruck analysisPalletTruck)
            {
                // ### draw truck
                Truck truck = new Truck(analysisPalletTruck.TruckProperties);
                truck.DrawBegin(graphics);
            }
            // ### draw solution
            uint          layerId = 0, pickId = 0;
            List <ILayer> layers = Solution.Layers;

            foreach (ILayer layer in layers)
            {
                bool        aboveSelectedLayer = (Solution.SelectedLayerIndex != -1) && (layerId > Solution.SelectedLayerIndex);
                Transform3D upTranslation      = Transform3D.Translation(new Vector3D(0.0, 0.0, aboveSelectedLayer ? DistanceAboveSelectedLayer : 0.0));
                BBox3D      bbox = new BBox3D();
                // ### layer of boxes
                if (layer is Layer3DBox layerBox)
                {
                    if (analysis.Content is LoadedPallet)
                    {
                        LoadedPallet loadedPallet = analysis.Content as LoadedPallet;
                        BBox3D       solBBox      = loadedPallet.ParentAnalysis.Solution.BBoxGlobal;
                        foreach (BoxPosition bPosition in layerBox)
                        {
                            var dim = solBBox.DimensionsVec;
                            graphics.AddImage(++pickId, new SubContent(loadedPallet.ParentAnalysis as AnalysisHomo), solBBox.DimensionsVec, bPosition.Transform(transform));
                            // bbox used for picking
                            bbox.Extend(new BBox3D(bPosition.Transform(transform), solBBox.DimensionsVec));
                        }
                    }
                    else if (analysis.Content is PackProperties packProperties)
                    {
                        foreach (BoxPosition bPosition in layerBox)
                        {
                            BoxPosition boxPositionModified = bPosition.Transform(transform * upTranslation);
                            graphics.AddImage(++pickId, new SubContent(packProperties), packProperties.OuterDimensions, boxPositionModified);
                            // bbox used for picking
                            bbox.Extend(new BBox3D(boxPositionModified, packProperties.OuterDimensions));
                        }
                    }
                    else if (analysis.Content is BagProperties bagProperties)
                    {
                        foreach (BoxPosition bPosition in layerBox)
                        {
                            BoxPosition boxPositionModified = bPosition.Transform(transform * upTranslation);
                            graphics.AddImage(++pickId, new SubContent(bagProperties), bagProperties.OuterDimensions, boxPositionModified);
                            // bbox used for picking
                            bbox.Extend(new BBox3D(boxPositionModified, bagProperties.OuterDimensions));
                        }
                    }
                    else
                    {
                        foreach (BoxPosition bPosition in layerBox)
                        {
                            BoxPosition boxPositionModified = bPosition.Transform(transform * upTranslation);
                            BoxGeneric  b;
                            if (analysis.Content is BagProperties bagProp)
                            {
                                b = new BoxRounded(pickId++, bagProp.Length, bagProp.Width, bagProp.Height, bagProp.Radius, boxPositionModified)
                                {
                                    ColorFill = bagProp.ColorFill
                                }
                            }
                            ;
                            else
                            {
                                b = new Box(pickId++, analysis.Content as PackableBrick, boxPositionModified);
                            }
                            graphics.AddBox(b);
                            bbox.Extend(b.BBox);
                        }
                    }
                }
                else if (layer is Layer3DBoxIndexed layerBoxIndexed)
                {
                    foreach (var bpi in layerBoxIndexed)
                    {
                        BoxPosition boxPositionModified = bpi.BPos.Transform(transform * upTranslation);
                        var         bProperties         = analysis.Content as PackableBrick;
                        BoxGeneric  b = new Box(pickId++, analysis.Content as PackableBrick, boxPositionModified);
                        graphics.AddBox(b);
                        // bbox used for picking
                        bbox.Extend(new BBox3D(boxPositionModified, bProperties.OuterDimensions));
                    }
                }
                else if (layer is Layer3DCyl layerCyl)
                {
                    foreach (Vector3D vPos in layerCyl)
                    {
                        CylPosition cylPosition         = new CylPosition(transform.transform(vPos), HalfAxis.HAxis.AXIS_Z_P);
                        CylPosition cylPositionModified = cylPosition.Transform(transform * upTranslation);
                        Cyl         cyl = null;
                        if (analysis.Content is CylinderProperties cylProp)
                        {
                            cyl = new Cylinder(pickId++, cylProp, cylPositionModified);
                        }
                        else if (analysis.Content is BottleProperties bottleProperties)
                        {
                            cyl = new Bottle(pickId++, bottleProperties, cylPositionModified);
                        }
                        graphics.AddCylinder(cyl);
                        bbox.Extend(cyl.BBox);
                    }
                }
                // ### interlayer
                else if (layer is InterlayerPos interlayerPos)
                {
                    InterlayerProperties interlayerProp = Solution.Interlayers[interlayerPos.TypeId];
                    if (null != interlayerProp)
                    {
                        BoxPosition bPosition = new BoxPosition(
                            new Vector3D(
                                analysis.Offset.X + 0.5 * (analysis.ContainerDimensions.X - interlayerProp.Length)
                                , analysis.Offset.Y + 0.5 * (analysis.ContainerDimensions.Y - interlayerProp.Width)
                                , interlayerPos.ZLow
                                ), HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Y_P);
                        BoxPosition boxPositionModified = bPosition.Transform(transform * upTranslation);

                        Box box = new Box(pickId++, interlayerProp, boxPositionModified);
                        if (analysis.Content is PackProperties)
                        {
                            graphics.AddImage(pickId, new SubContent(interlayerProp), interlayerProp.Dimensions, boxPositionModified);
                        }
                        else
                        {
                            graphics.AddBox(box);
                        }
                        bbox.Extend(box.BBox);
                    }
                }

                if (layer is Layer3DBox || layer is Layer3DCyl)
                {
                    // add layer BBox
                    AddPickingBox(bbox, layerId);
                    // draw bounding box around selected layer
                    if (layerId == Solution.SelectedLayerIndex)
                    {
                        DrawLayerBoundingBox(graphics, bbox);
                    }
                    ++layerId;
                }
            }
            BBox3D loadBBox      = Solution.BBoxLoad;
            BBox3D loadBBoxWDeco = Solution.BBoxLoadWDeco;

            if (analysis is AnalysisCasePallet analysisCasePallet)
            {
                #region Pallet corners
                // ### pallet corners : Begin
                Corner[] corners = new Corner[4];
                if (analysisCasePallet.HasPalletCorners)
                {
                    // positions
                    Vector3D[] cornerPositions =
                    {
                        loadBBox.PtMin
                        , new Vector3D(loadBBox.PtMax.X, loadBBox.PtMin.Y, loadBBox.PtMin.Z)
                        , new Vector3D(loadBBox.PtMax.X, loadBBox.PtMax.Y, loadBBox.PtMin.Z)
                        , new Vector3D(loadBBox.PtMin.X, loadBBox.PtMax.Y, loadBBox.PtMin.Z)
                    };
                    // length axes
                    HalfAxis.HAxis[] lAxes =
                    {
                        HalfAxis.HAxis.AXIS_X_P,
                        HalfAxis.HAxis.AXIS_Y_P,
                        HalfAxis.HAxis.AXIS_X_N,
                        HalfAxis.HAxis.AXIS_Y_N
                    };
                    // width axes
                    HalfAxis.HAxis[] wAxes =
                    {
                        HalfAxis.HAxis.AXIS_Y_P,
                        HalfAxis.HAxis.AXIS_X_N,
                        HalfAxis.HAxis.AXIS_Y_N,
                        HalfAxis.HAxis.AXIS_X_P
                    };
                    for (int i = 0; i < 4; ++i)
                    {
                        corners[i] = new Corner(0, analysisCasePallet.PalletCornerProperties)
                        {
                            Height = Math.Min(analysisCasePallet.PalletCornerProperties.Length, loadBBox.Height)
                        };
                        corners[i].SetPosition(
                            transform.transform(cornerPositions[i])
                            , HalfAxis.Transform(lAxes[i], transform), HalfAxis.Transform(wAxes[i], transform)
                            );
                        corners[i].DrawBegin(graphics);
                    }
                }
                #endregion

                #region Top corners
                Corner[] cornersTop = new Corner[4];
                if (analysisCasePallet.HasPalletCornersTopX || analysisCasePallet.HasPalletCornersTopY)
                {
                    double cornerWidth  = analysisCasePallet.PalletCornerTopProperties.Width;
                    double lengthInLDir = Math.Min(analysisCasePallet.PalletCornerTopProperties.Length, loadBBox.Length - 2.0 * cornerWidth);
                    double widthInWDir  = Math.Min(analysisCasePallet.PalletCornerTopProperties.Length, loadBBox.Width - 2.0 * cornerWidth);
                    double offsetInLDir = 0.5 * (loadBBox.Length - lengthInLDir);
                    double offsetInWdir = 0.5 * (loadBBox.Width - widthInWDir);

                    Transform3D upTranslation = Transform3D.Translation(new Vector3D(0.0, 0.0, -1 != Solution.SelectedLayerIndex ? DistanceAboveSelectedLayer : 0.0));


                    // positions
                    Vector3D[] cornerPositions =
                    {
                        new Vector3D(loadBBox.PtMin.X + offsetInLDir, loadBBox.PtMin.Y,                             loadBBox.PtMax.Z)
                        ,                                             new Vector3D(loadBBox.PtMax.X - offsetInLDir, loadBBox.PtMax.Y, loadBBox.PtMax.Z)
                        ,                                             new Vector3D(loadBBox.PtMax.X,                loadBBox.PtMin.Y + offsetInWdir, loadBBox.PtMax.Z)
                        ,                                             new Vector3D(loadBBox.PtMin.X,                loadBBox.PtMax.Y - offsetInWdir, loadBBox.PtMax.Z)
                    };
                    // length axes
                    HalfAxis.HAxis[] lAxes =
                    {
                        HalfAxis.HAxis.AXIS_Z_N,
                        HalfAxis.HAxis.AXIS_Z_N,
                        HalfAxis.HAxis.AXIS_Z_N,
                        HalfAxis.HAxis.AXIS_Z_N,
                    };
                    // width axes
                    HalfAxis.HAxis[] wAxes =
                    {
                        HalfAxis.HAxis.AXIS_Y_P,
                        HalfAxis.HAxis.AXIS_Y_N,
                        HalfAxis.HAxis.AXIS_X_N,
                        HalfAxis.HAxis.AXIS_X_P
                    };
                    for (int i = 0; i < 4; ++i)
                    {
                        cornersTop[i] = new Corner(0, analysisCasePallet.PalletCornerTopProperties)
                        {
                            Height = Math.Min(analysisCasePallet.PalletCornerTopProperties.Length, (i < 2 ? loadBBox.Length : loadBBox.Width) - 2.0 * cornerWidth)
                        };
                        cornersTop[i].SetPosition(
                            transform.transform(upTranslation.transform(cornerPositions[i]))
                            , HalfAxis.Transform(lAxes[i], transform), HalfAxis.Transform(wAxes[i], transform)
                            );
                    }
                    // drawing
                    if (analysisCasePallet.HasPalletCornersTopX)
                    {
                        for (int i = 0; i < 2; ++i)
                        {
                            cornersTop[i].DrawBegin(graphics);
                        }
                    }
                    if (analysisCasePallet.HasPalletCornersTopY)
                    {
                        for (int i = 2; i < 4; ++i)
                        {
                            cornersTop[i].DrawBegin(graphics);
                        }
                    }
                }
                #endregion
                #region Pallet film
                // ### pallet film
                Film film = null;
                if (analysisCasePallet.HasPalletFilm && -1 == Solution.SelectedLayerIndex)
                {
                    // instantiate film
                    PalletFilmProperties palletFilmProperties = analysisCasePallet.PalletFilmProperties;
                    film = new Film(
                        palletFilmProperties.Color,
                        palletFilmProperties.UseTransparency,
                        palletFilmProperties.UseHatching,
                        palletFilmProperties.HatchSpacing,
                        palletFilmProperties.HatchAngle);
                    film.AddRectangle(new FilmRectangle(transform.transform(loadBBoxWDeco.PtMin)
                                                        , HalfAxis.Transform(HalfAxis.HAxis.AXIS_X_P, transform), HalfAxis.Transform(HalfAxis.HAxis.AXIS_Z_P, transform)
                                                        , new Vector2D(loadBBoxWDeco.Length, loadBBoxWDeco.Height), -1.0));
                    film.AddRectangle(new FilmRectangle(transform.transform(loadBBoxWDeco.PtMin + loadBBoxWDeco.Length * Vector3D.XAxis)
                                                        , HalfAxis.Transform(HalfAxis.HAxis.AXIS_Y_P, transform), HalfAxis.Transform(HalfAxis.HAxis.AXIS_Z_P, transform)
                                                        , new Vector2D(loadBBoxWDeco.Width, loadBBoxWDeco.Height), -1.0));
                    film.AddRectangle(new FilmRectangle(transform.transform(loadBBoxWDeco.PtMin + loadBBoxWDeco.Length * Vector3D.XAxis + loadBBoxWDeco.Width * Vector3D.YAxis)
                                                        , HalfAxis.Transform(HalfAxis.HAxis.AXIS_X_N, transform), HalfAxis.Transform(HalfAxis.HAxis.AXIS_Z_P, transform)
                                                        , new Vector2D(loadBBoxWDeco.Length, loadBBoxWDeco.Height), -1.0));
                    film.AddRectangle(new FilmRectangle(transform.transform(loadBBoxWDeco.PtMin + loadBBoxWDeco.Width * Vector3D.YAxis)
                                                        , HalfAxis.Transform(HalfAxis.HAxis.AXIS_Y_N, transform), HalfAxis.Transform(HalfAxis.HAxis.AXIS_Z_P, transform)
                                                        , new Vector2D(loadBBoxWDeco.Width, loadBBoxWDeco.Height), -1.0));
                    film.AddRectangle(new FilmRectangle(transform.transform(loadBBoxWDeco.PtMin + loadBBoxWDeco.Height * Vector3D.ZAxis)
                                                        , HalfAxis.Transform(HalfAxis.HAxis.AXIS_X_P, transform), HalfAxis.Transform(HalfAxis.HAxis.AXIS_Y_P, transform)
                                                        , new Vector2D(loadBBoxWDeco.Length, loadBBoxWDeco.Width)
                                                        , analysisCasePallet.PalletFilmTopCovering));
                    film.DrawBegin(graphics);
                }
                #endregion

                #region Pallet corners
                // pallet corners : End
                if (analysisCasePallet.HasPalletCorners)
                {
                    for (int i = 0; i < 4; ++i)
                    {
                        corners[i].DrawEnd(graphics);
                    }
                }
                if (analysisCasePallet.HasPalletCornersTopX)
                {
                    for (int i = 0; i < 2; ++i)
                    {
                        cornersTop[i].DrawEnd(graphics);
                    }
                }
                if (analysisCasePallet.HasPalletCornersTopY)
                {
                    for (int i = 2; i < 4; ++i)
                    {
                        cornersTop[i].DrawEnd(graphics);
                    }
                }
                #endregion

                #region Pallet sleeves
                // ### pallet sleeve
                if (analysisCasePallet.HasPalletSleeve)
                {
                    var ps = new PalletSleeve(0, loadBBox, analysisCasePallet.PalletSleeveColor);
                    ps.DrawEnd(graphics);
                }
                #endregion

                #region Pallet Cap
                // ### pallet cap
                if (analysisCasePallet.HasPalletCap)
                {
                    PalletCapProperties capProperties = analysisCasePallet.PalletCapProperties;
                    BoxPosition         bPosition     = new BoxPosition(new Vector3D(
                                                                            0.5 * (analysisCasePallet.PalletProperties.Length - capProperties.Length),
                                                                            0.5 * (analysisCasePallet.PalletProperties.Width - capProperties.Width),
                                                                            loadBBox.PtMax.Z - capProperties.InsideHeight)
                                                                        , HalfAxis.Transform(HalfAxis.HAxis.AXIS_X_P, transform)
                                                                        , HalfAxis.Transform(HalfAxis.HAxis.AXIS_Y_P, transform)
                                                                        );

                    Transform3D upTranslation = Transform3D.Translation(new Vector3D(0.0, 0.0, -1 != Solution.SelectedLayerIndex ? DistanceAboveSelectedLayer : 0.0));
                    PalletCap   cap           = new PalletCap(0, capProperties, bPosition.Transform(upTranslation));
                    cap.DrawEnd(graphics);
                }
                #endregion

                #region Pallet labels
                // ### pallet labels
                if (null != analysisCasePallet)
                {
                    foreach (var pli in analysisCasePallet.PalletLabels)
                    {
                        var pl = new PalletLabel(++pickId, pli.PalletLabelProperties, pli.ToBoxPosition(loadBBox));
                        pl.DrawEnd(graphics);
                    }
                }
                #endregion

                #region Strappers
                // ### strappers
                if (-1 == Solution.SelectedLayerIndex)
                {
                    foreach (var sd in Solution.Strappers)
                    {
                        if (null == sd.Points && sd.Points.Count > 0)
                        {
                            var strapper = new Strapper(
                                transform.transform(IntToAxis(sd.Strapper.Axis)),
                                sd.Strapper.Width,
                                sd.Strapper.Color,
                                sd.Points.Select(p => transform.transform(p)).ToList());
                            strapper.DrawEnd(graphics);
                        }
                    }
                }
                #endregion

                #region Pallet film
                // pallet film : End
                if (analysisCasePallet.HasPalletFilm && null != film)
                {
                    film.DrawEnd(graphics);
                }
                #endregion
            }
            else if (analysis is AnalysisPackableTruck analysisPackableTruck2)
            {
                Truck truck = new Truck(analysisPackableTruck2.TruckProperties);
                truck.DrawEnd(graphics);
            }
            else if (analysis is AnalysisPalletTruck analysisPalletTruck)
            {
                Truck truck = new Truck(analysisPalletTruck.TruckProperties);
                truck.DrawEnd(graphics);
            }
            // ### dimensions
            // dimensions should only be shown when no layer is selected
            if (graphics.ShowDimensions && (-1 == Solution.SelectedLayerIndex))
            {
                graphics.AddDimensions(new DimensionCube(BoundingBoxDim(DimCasePalletSol1), Color.Black, false));
                graphics.AddDimensions(new DimensionCube(BoundingBoxDim(DimCasePalletSol2), Color.Red, true));
            }
            // ###
        }
Ejemplo n.º 34
0
        public void Draw(Graphics3DControl ctrl, Graphics3D graphics)
        {
            if (CornerLength > 0 && CornerWidth > 0 && CornerThickness > 0
                && CornerThickness < CornerWidth)
            {
                // draw
                PalletCornerProperties palletCornerProperties = new PalletCornerProperties(
                    null, ItemName, ItemDescription, CornerLength, CornerWidth, CornerThickness,
                    CornerWeight, CornerColor);

                Corner palletCap = new Corner(0, palletCornerProperties);
                palletCap.Draw(graphics);
                graphics.AddDimensions(new DimensionCube(CornerWidth, CornerWidth, CornerLength));
            }
        }
Ejemplo n.º 35
0
 public void Draw(Graphics3DControl ctrl, Graphics3D graphics)
 {
     if (CapLength > 0 && CapWidth > 0 && CapHeight > 0)
     {
         // draw
         PalletCapProperties palletCapProperties = new PalletCapProperties(
             null, ItemName, ItemDescription, CapLength, CapWidth, CapHeight,
             CapInnerLength, CapInnerWidth, CapInnerHeight,
             CapWeight, CapColor);
         PalletCap palletCap = new PalletCap(0, palletCapProperties, Vector3D.Zero);
         palletCap.Draw(graphics);
         graphics.AddDimensions(new DimensionCube(CapLength, CapWidth, CapHeight));
     }
 }
 public void Draw(Graphics3DControl ctrl, Graphics3D graphics)
 {
     TruckProperties truckProp = _sol.ParentTruckAnalysis.TruckProperties;
     graphics.AddDimensions(new DimensionCube(_sol.LoadBoundingBox, Color.Red, false));
     graphics.AddDimensions(new DimensionCube(Vector3D.Zero, truckProp.Length, truckProp.Width, truckProp.Height, Color.Black, true));
     // draw solution
     TruckSolutionViewer sv = new TruckSolutionViewer(_sol);
     sv.Draw(graphics);
 }
Ejemplo n.º 37
0
        public override void Draw(Graphics3D graphics, bool showDimensions)
        {
            if (null == _solution) return;
            AnalysisCasePallet analysisCasePallet = _solution.Analysis as AnalysisCasePallet;

            // ### draw pallet
            Pallet pallet = new Pallet(analysisCasePallet.PalletProperties);
            pallet.Draw(graphics, Transform3D.Identity);

            // ### draw solution
            uint layerId = 0, pickId = 0;
            List<ILayer> layers = _solution.Layers;
            foreach (ILayer layer in layers)
            {
                // ### layer of boxes
                BoxLayer blayer = layer as BoxLayer;
                if (null != blayer)
                {
                    BBox3D bbox = new BBox3D();
                    foreach (BoxPosition bPosition in blayer)
                    {
                        Box b = new Box(pickId++, analysisCasePallet.BProperties, bPosition);
                        graphics.AddBox(b);
                        bbox.Extend(b.BBox);
                    }
                    // add layer BBox
                    AddPickingBox(bbox, layerId);
                    // draw bounding box around selected layer
                    if (layerId == _solution.SelectedLayerIndex)
                        DrawLayerBoundingBox(graphics, bbox);
                    ++layerId;
                }
                // ### intetrlayer
                InterlayerPos interlayerPos = layer as InterlayerPos;
                if (null != interlayerPos)
                {
                    InterlayerProperties interlayerProp = _solution.Interlayers[interlayerPos.TypeId];//analysisCasePallet.Interlayer(interlayerPos.TypeId);
                    if (null != interlayerProp)
                    {
                        Box box = new Box(pickId++, interlayerProp);
                        box.Position = new Vector3D(
                            0.5 * (analysisCasePallet.PalletProperties.Length - interlayerProp.Length)
                            , 0.5 * (analysisCasePallet.PalletProperties.Width - interlayerProp.Width)
                            , interlayerPos.ZLow
                            );
                        graphics.AddBox(box);
                    }
                }
            }
            BBox3D loadBBox = _solution.BBoxLoad;
            BBox3D loadBBoxWDeco = _solution.BBoxLoadWDeco;
            #region Pallet corners
            // ### pallet corners : Begin
            Corner[] corners = new Corner[4];
            if (analysisCasePallet.HasPalletCorners)
            {
                // positions
                Vector3D[] cornerPositions =
                {
                    loadBBox.PtMin
                    , new Vector3D(loadBBox.PtMax.X, loadBBox.PtMin.Y, loadBBox.PtMin.Z)
                    , new Vector3D(loadBBox.PtMax.X, loadBBox.PtMax.Y, loadBBox.PtMin.Z)
                    , new Vector3D(loadBBox.PtMin.X, loadBBox.PtMax.Y, loadBBox.PtMin.Z)
                };
                // length axes
                HalfAxis.HAxis[] lAxes =
                {
                    HalfAxis.HAxis.AXIS_X_P,
                    HalfAxis.HAxis.AXIS_Y_P,
                    HalfAxis.HAxis.AXIS_X_N,
                    HalfAxis.HAxis.AXIS_Y_N
                };
                // width axes
                HalfAxis.HAxis[] wAxes =
                {
                    HalfAxis.HAxis.AXIS_Y_P,
                    HalfAxis.HAxis.AXIS_X_N,
                    HalfAxis.HAxis.AXIS_Y_N,
                    HalfAxis.HAxis.AXIS_X_P
                };
                // corners
                if (analysisCasePallet.HasPalletCorners)
                {
                    for (int i = 0; i < 4; ++i)
                    {
                        corners[i] = new Corner(0, analysisCasePallet.PalletCornerProperties);
                        corners[i].Height = Math.Min(analysisCasePallet.PalletCornerProperties.Length, loadBBox.Height);
                        corners[i].SetPosition(cornerPositions[i], lAxes[i], wAxes[i]);
                        corners[i].DrawBegin(graphics);
                    }
                }
            }
            #endregion

            #region Pallet cap
            #endregion

            #region Pallet film
            // ### pallet film
            Film film = null;
            if (analysisCasePallet.HasPalletFilm)
            {
                PalletFilmProperties palletFilmProperties = analysisCasePallet.PalletFilmProperties;
                film = new Film(
                    palletFilmProperties.Color,
                    palletFilmProperties.UseTransparency,
                    palletFilmProperties.UseHatching,
                    palletFilmProperties.HatchSpacing,
                    palletFilmProperties.HatchAngle);
                film.AddRectangle(new FilmRectangle(loadBBoxWDeco.PtMin,
                    HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Z_P, new Vector2D(loadBBoxWDeco.Length, loadBBoxWDeco.Height), 0.0));
                film.AddRectangle(new FilmRectangle(loadBBoxWDeco.PtMin + loadBBoxWDeco.Length * Vector3D.XAxis,
                    HalfAxis.HAxis.AXIS_Y_P, HalfAxis.HAxis.AXIS_Z_P, new Vector2D(loadBBoxWDeco.Width, loadBBoxWDeco.Height), 0.0));
                film.AddRectangle(new FilmRectangle(loadBBoxWDeco.PtMin + loadBBoxWDeco.Length * Vector3D.XAxis + loadBBoxWDeco.Width * Vector3D.YAxis,
                    HalfAxis.HAxis.AXIS_X_N, HalfAxis.HAxis.AXIS_Z_P, new Vector2D(loadBBoxWDeco.Length, loadBBoxWDeco.Height), 0.0));
                film.AddRectangle(new FilmRectangle(loadBBoxWDeco.PtMin + loadBBoxWDeco.Width * Vector3D.YAxis,
                    HalfAxis.HAxis.AXIS_Y_N, HalfAxis.HAxis.AXIS_Z_P, new Vector2D(loadBBoxWDeco.Width, loadBBoxWDeco.Height), 0.0));
                film.AddRectangle(new FilmRectangle(loadBBoxWDeco.PtMin + loadBBoxWDeco.Height * Vector3D.ZAxis,
                    HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Y_P, new Vector2D(loadBBoxWDeco.Length, loadBBoxWDeco.Width),
                    UnitsManager.ConvertLengthFrom(200.0, UnitsManager.UnitSystem.UNIT_METRIC1)));
                film.DrawBegin(graphics);
            }
            #endregion

            // ### dimensions
            if (showDimensions)
            {
                graphics.AddDimensions(
                    new DimensionCube(BoundingBoxDim(Properties.Settings.Default.DimCasePalletSol1)
                    , Color.Black, false));
                graphics.AddDimensions(
                    new DimensionCube(BoundingBoxDim(Properties.Settings.Default.DimCasePalletSol2)
                    , Color.Red, true));
            }

            #region Pallet corners
            // pallet corners : End
            if (analysisCasePallet.HasPalletCorners)
            {
                for (int i = 0; i < 4; ++i)
                    corners[i].DrawEnd(graphics);
            }
            #endregion

            #region Pallet Cap
            // ### pallet cap
            if (analysisCasePallet.HasPalletCap)
            {
                PalletCapProperties capProperties = analysisCasePallet.PalletCapProperties;
                Vector3D pos = new Vector3D(
                    0.5 * (analysisCasePallet.PalletProperties.Length - capProperties.Length),
                    0.5 * (analysisCasePallet.PalletProperties.Width - capProperties.Width),
                    loadBBox.PtMax.Z - capProperties.InsideHeight);
                PalletCap cap = new PalletCap(0, capProperties, pos);
                cap.DrawEnd(graphics);
            }
            #endregion

            #region Pallet film
            // pallet film : End
            if (analysisCasePallet.HasPalletFilm)
                film.DrawEnd(graphics);
            #endregion
        }