private static InterlayerProperties LoadInterlayerById(Document doc, List <interlayer> listInterlayer, string sid)
        {
            interlayer interlayerItem = listInterlayer.Find(delegate(interlayer i) { return(i.id == sid); });

            if (null == interlayerItem)
            {
                return(null);
            }
            else
            {
                // dimensions
                double[] dimensions = interlayerItem.dimensions.ToArray();
                // instantiate interlayer properties
                InterlayerProperties interlayerProperties = new InterlayerProperties(
                    doc
                    , interlayerItem.name
                    , interlayerItem.description
                    , dimensions[0], dimensions[1], dimensions[2]
                    , interlayerItem.weight
                    , Color.FromArgb((int)interlayerItem.color[0], (int)interlayerItem.color[1], (int)interlayerItem.color[2], (int)interlayerItem.color[3])
                    );
                // insert in list
                if (null != doc)
                {
                    doc.AddType(interlayerProperties);
                }

                return(interlayerProperties);
            }
        }
Esempio n. 2
0
        public FormNewInterlayer(Document document, InterlayerProperties interlayerProperties)
            : base(document, interlayerProperties)
        {
            InitializeComponent();
            // initialize value
            if (null != interlayerProperties)
            {
                InterlayerLength = interlayerProperties.Length;
                InterlayerWidth  = interlayerProperties.Width;
                Thickness        = interlayerProperties.Thickness;
                Weight           = interlayerProperties.Weight;
                Color            = interlayerProperties.Color;
            }
            else
            {
                // initialize value
                InterlayerLength = UnitsManager.ConvertLengthFrom(1200.0, UnitsManager.UnitSystem.UNIT_METRIC1);
                InterlayerWidth  = UnitsManager.ConvertLengthFrom(1000.0, UnitsManager.UnitSystem.UNIT_METRIC1);
                Thickness        = UnitsManager.ConvertLengthFrom(1.0, UnitsManager.UnitSystem.UNIT_METRIC1);
                Weight           = UnitsManager.ConvertMassFrom(1.0, UnitsManager.UnitSystem.UNIT_METRIC1);
                Color            = Color.Beige;
            }
            // disable Ok button
            UpdateStatus(string.Empty);

            // units
            UnitsManager.AdaptUnitLabels(this);
        }
Esempio n. 3
0
 public Box(uint pickId, InterlayerProperties interlayerProperties, BoxPosition bPosition)
     : base(pickId, interlayerProperties.Length, interlayerProperties.Width, interlayerProperties.Thickness, BoxPosition.Zero)
 {
     // colors
     Colors = Enumerable.Repeat(interlayerProperties.Color, 6).ToArray();
     // set position
     BoxPosition = bPosition;
 }
 public void ProcessAnalysis(BoxCasePalletAnalysis analysis)
 {
     _boxProperties        = analysis.BoxProperties;
     _interlayerProperties = analysis.InterlayerProperties;
     _palletSolutionList   = analysis.PalletSolutionsList;
     _constraintSet        = analysis.ConstraintSet;
     analysis.Solutions    = GenerateSolutions();
 }
Esempio n. 5
0
 public void ProcessAnalysis(PackPalletAnalysis analysis)
 {
     _packProperties       = analysis.PackProperties;
     _palletProperties     = analysis.PalletProperties;
     _interlayerProperties = analysis.InterlayerProperties;
     _constraintSet        = analysis.ConstraintSet;
     analysis.Solutions    = GenerateSolutions();
 }
Esempio n. 6
0
        public void Draw(Graphics3DControl ctrl, Graphics3D graphics)
        {
            InterlayerProperties interlayerProperties = new InterlayerProperties(
                null, tbName.Text, tbDescription.Text
                , InterlayerLength, InterlayerWidth, Thickness, Weight, Color);

            graphics.AddBox(new Box(0, interlayerProperties));
            graphics.AddDimensions(new DimensionCube(InterlayerLength, InterlayerWidth, Thickness));
        }
Esempio n. 7
0
 public Box(uint pickId, InterlayerProperties interlayerProperties)
 {
     // dimensions
     _pickId = pickId;
     _dim[0] = interlayerProperties.Length;
     _dim[1] = interlayerProperties.Width;
     _dim[2] = interlayerProperties.Thickness;
     // colors
     _colors = Enumerable.Repeat <Color>(interlayerProperties.Color, 6).ToArray();
 }
Esempio n. 8
0
        public static bool GetSolutionList(
            PackableBrick packableProperties, PalletProperties palletProperties, InterlayerProperties interlayerProperties
            , ConstraintSetCasePallet constraintSet
            , ref List <AnalysisLayered> analyses)
        {
            SolverCasePallet solver = new SolverCasePallet(packableProperties, palletProperties, constraintSet);

            analyses = solver.BuildAnalyses(false);
            return(analyses.Count > 0);
        }
Esempio n. 9
0
        public bool Accept(Control ctrl, ItemBase itemBase)
        {
            InterlayerProperties interlayer = itemBase as InterlayerProperties;

            if (ctrl == cbInterlayer && null != interlayer)
            {
                return(_analysis.AllowInterlayer(interlayer));
            }
            return(false);
        }
Esempio n. 10
0
        protected void UpdateControls()
        {
            try
            {
                int index = _solution.SelectedLayerIndex;
                bnSymmetryX.Enabled    = (index != -1);
                bnSymetryY.Enabled     = (index != -1);
                cbLayerType.Enabled    = (index != -1);
                chkbInterlayer.Enabled = (index != -1) && (cbInterlayer.Items.Count > 0);

                gbLayer.Text = index != -1 ? string.Format("Selected layer : {0}", index) : "Double-click a layer";

                if (index != -1)
                {
                    tbClickLayer.Hide();
                    gbLayer.Show();

                    // get selected solution item
                    SolutionItem selItem = _solution.SelectedSolutionItem;
                    if (null != selItem)
                    {
                        // set current layer
                        cbLayerType.SelectedIndex = selItem.IndexLayer;
                        // set interlayer
                        chkbInterlayer.Checked = selItem.HasInterlayer;
                        OnChkbInterlayerClicked(null, null);
                    }
                    // select combo box
                    int selIndex = 0;
                    foreach (object o in cbInterlayer.Items)
                    {
                        InterlayerProperties interlayerProp = o as InterlayerProperties;
                        if (interlayerProp == _solution.SelectedInterlayer)
                        {
                            break;
                        }
                        ++selIndex;
                    }
                    if (selIndex < cbInterlayer.Items.Count)
                    {
                        cbInterlayer.SelectedIndex = selIndex;
                    }
                }
                else
                {
                    gbLayer.Hide();
                    tbClickLayer.Show();
                }
            }
            catch (Exception ex)
            {
                _log.Error(ex.ToString());
            }
        }
Esempio n. 11
0
 public Box(uint pickId, InterlayerProperties interlayerProperties)
 {
     _pickId = pickId;
     _dim[0] = interlayerProperties.Length;
     _dim[1] = interlayerProperties.Width;
     _dim[2] = interlayerProperties.Thickness;
     _colors = new Color[6];
     for (int i = 0; i < 6; ++i)
     {
         _colors[i] = interlayerProperties.Color;
     }
 }
Esempio n. 12
0
 public Box(uint pickId, InterlayerProperties interlayerProperties)
 {
     // dimensions
     _pickId = pickId;
     _dim[0] = interlayerProperties.Length;
     _dim[1] = interlayerProperties.Width;
     _dim[2] = interlayerProperties.Thickness;
     // box position
     _boxPosition = new BoxPosition(Vector3D.Zero, HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Y_P);
     // colors
     _colors = Enumerable.Repeat <Color>(interlayerProperties.Color, 6).ToArray();
 }
Esempio n. 13
0
 public Box(uint pickId, InterlayerProperties interlayerProperties, BoxPosition bPosition)
 {
     // dimensions
     PickId  = pickId;
     _dim[0] = interlayerProperties.Length;
     _dim[1] = interlayerProperties.Width;
     _dim[2] = interlayerProperties.Thickness;
     // colors
     Colors = Enumerable.Repeat <Color>(interlayerProperties.Color, 6).ToArray();
     // set position
     BoxPosition = bPosition;
 }
        public void ProcessAnalysis(CylinderPalletAnalysis analysis)
        {
            _cylProperties                = analysis.CylinderProperties;
            _palletProperties             = analysis.PalletProperties;
            _interlayerProperties         = analysis.InterlayerProperties;
            _interlayerPropertiesAntiSlip = analysis.InterlayerPropertiesAntiSlip;
            _constraintSet                = analysis.ConstraintSet;
            if (!_constraintSet.IsValid)
            {
                throw new EngineException("Constraint set is invalid!");
            }

            analysis.Solutions = GenerateSolutions();
        }
Esempio n. 15
0
        public static void StartPalletization(string name, double length, double width, double height)
        {
            // show analysis details dialog
            FormDefineAnalysis formDefinition = new FormDefineAnalysis();

            formDefinition.CaseName   = name;
            formDefinition.CaseLength = length;
            formDefinition.CaseWidth  = width;
            formDefinition.CaseHeight = height;
            formDefinition.Pallets    = Pallets;

            if (DialogResult.OK != formDefinition.ShowDialog())
            {
                return;
            }

            // create document
            Document doc = new Document(name, name + "_on_" + formDefinition.Pallet.Name, "from extension component", DateTime.Now, null);
            // create case in document
            BoxProperties caseInDoc = doc.CreateNewCase(formDefinition.Case);
            // create pallet in document
            PalletProperties palletInDoc = doc.CreateNewPallet(formDefinition.Pallet);
            // create interlayer in document
            InterlayerProperties interlayerInDoc = formDefinition.Interlayer == null ? null : doc.CreateNewInterlayer(formDefinition.Interlayer);

            // solver
            CasePalletSolver solver = new CasePalletSolver();
            // build list of solutions
            CasePalletAnalysis analysis = doc.CreateNewCasePalletAnalysis(
                string.Format(Resources.ID_ANALYSISNAME, name, formDefinition.Pallet.Name)
                , string.Format(Resources.ID_ANALYSISDESCRIPTION, name, formDefinition.Pallet.Name)
                , caseInDoc
                , palletInDoc
                , interlayerInDoc
                , null
                , null
                , null
                , null
                , formDefinition.Constraints
                , solver);

            // select solution / generate report / generate StackBuilder file
            FormSelectSolution formSolutions = new FormSelectSolution(doc, analysis);

            if (DialogResult.OK == formSolutions.ShowDialog())
            {
                return;
            }
        }
Esempio n. 16
0
        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));
                }
            }
        }
Esempio n. 17
0
        private void onInterlayerChanged(object sender, EventArgs e)
        {
            // get index of interlayer
            InterlayerProperties interlayer = null;

            if (chkbInterlayer.Checked)
            {
                ItemBaseCB itemInterlayer = cbInterlater.SelectedItem as ItemBaseCB;
                if (null != itemInterlayer)
                {
                    interlayer = itemInterlayer.Item as InterlayerProperties;
                }
            }
            _solution.SetInterlayerOnSelected(interlayer);
            graphCtrlSolution.Invalidate();
        }
Esempio n. 18
0
 private void OnInterlayerChanged(object sender, EventArgs e)
 {
     try
     {
         // get index of interlayer
         InterlayerProperties interlayer = null;
         if (chkbInterlayer.Checked)
         {
             interlayer = cbInterlayer.SelectedType as InterlayerProperties;
         }
         _solution.SetInterlayerOnSelected(interlayer);
         graphCtrlSolution.Invalidate();
         UpdateGrid();
     }
     catch (Exception ex)
     { _log.Error(ex.ToString()); }
 }
Esempio n. 19
0
 /// <summary>
 /// Process case/pallet analysis
 /// </summary>
 /// <param name="analysis">Pallet analysis to process</param>
 public void ProcessAnalysis(CasePalletAnalysis analysis)
 {
     _bProperties                  = analysis.BProperties;
     _palletProperties             = analysis.PalletProperties;
     _interlayerProperties         = analysis.InterlayerProperties;
     _interlayerPropertiesAntiSlip = analysis.InterlayerPropertiesAntiSlip;
     _cornerProperties             = analysis.PalletCornerProperties;
     _capProperties                = analysis.PalletCapProperties;
     _constraintSet                = analysis.ConstraintSet;
     // check contraint set validity
     if (!_constraintSet.IsValid)
     {
         throw new EngineException("Constraint set is invalid!");
     }
     // generate solutions
     analysis.Solutions = GenerateSolutions();
 }
Esempio n. 20
0
 public List <CasePalletSolution> Process(
     BoxProperties boxProperties, PalletProperties palletProperties,
     InterlayerProperties interlayerProperties, InterlayerProperties interlayerPropertiesAntiSlip,
     PalletConstraintSet constraintSet)
 {
     _bProperties                  = boxProperties;
     _palletProperties             = palletProperties;
     _interlayerProperties         = interlayerProperties;
     _interlayerPropertiesAntiSlip = interlayerPropertiesAntiSlip;
     _constraintSet                = constraintSet;
     // check constraint set validity
     if (!_constraintSet.IsValid)
     {
         throw new EngineException("Constraint set is invalid!");
     }
     // generate solutions
     return(GenerateSolutions());
 }
        /// <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));
        }
Esempio n. 22
0
        public Box(uint pickId, InterlayerProperties interlayerProperties, BoxPosition bPosition)
        {
            _pickId = pickId;
            _dim[0] = interlayerProperties.Length;
            _dim[1] = interlayerProperties.Width;
            _dim[2] = interlayerProperties.Thickness;
            _colors = new Color[6];
            for (int i = 0; i < 6; ++i)
            {
                _colors[i] = interlayerProperties.Color;
            }

            // set position
            Position = bPosition.Position;
            // set direction length
            LengthAxis = HalfAxis.ToVector3D(bPosition.DirectionLength);
            // set direction width
            WidthAxis = HalfAxis.ToVector3D(bPosition.DirectionWidth);
        }
 public FormNewInterlayer(Document document, InterlayerProperties interlayerProperties)
 {
     InitializeComponent();
     // set unit labels
     UnitsManager.AdaptUnitLabels(this);
     // save document reference
     _document             = document;
     _interlayerProperties = interlayerProperties;
     // set caption text
     Text = string.Format(Properties.Resources.ID_EDIT, _interlayerProperties.Name);
     // initialize value
     tbName.Text        = _interlayerProperties.Name;
     tbDescription.Text = _interlayerProperties.Description;
     InterlayerLength   = _interlayerProperties.Length;
     InterlayerWidth    = _interlayerProperties.Width;
     Thickness          = _interlayerProperties.Thickness;
     Weight             = _interlayerProperties.Weight;
     this.Color         = _interlayerProperties.Color;
     // disable Ok button
     UpdateButtonOkStatus();
 }
Esempio n. 24
0
        private void ProcessViewItem(viewItem vItem)
        {
            Graphics3DImage graphics = InitializeImageFromViewParameters(vItem.viewParameters);
            // load case
            BoxProperties bProperties = LoadCaseById(null, _root.data.items.library_cases, vItem.itemId);

            if (null != bProperties)
            {
                graphics.AddBox(new Box(0, bProperties));
                if (vItem.viewParameters.showDimensions)
                {
                    graphics.AddDimensions(new DimensionCube(bProperties.Length, bProperties.Width, bProperties.Height));
                }
            }
            // load pallet
            PalletProperties palletProperties = LoadPalletById(null, _root.data.items.library_pallets, vItem.itemId);

            if (null != palletProperties)
            {
                Pallet pallet = new Pallet(palletProperties);
                pallet.Draw(graphics, Transform3D.Identity);
                if (vItem.viewParameters.showDimensions)
                {
                    graphics.AddDimensions(new DimensionCube(palletProperties.Length, palletProperties.Width, palletProperties.Height));
                }
            }
            // load interlayer
            InterlayerProperties interlayerProperties = LoadInterlayerById(null, _root.data.items.library_interlayers, vItem.itemId);

            if (null != interlayerProperties)
            {
                graphics.AddBox(new Box(0, interlayerProperties));
                if (vItem.viewParameters.showDimensions)
                {
                    graphics.AddDimensions(new DimensionCube(interlayerProperties.Length, interlayerProperties.Width, interlayerProperties.Thickness));
                }
            }
            // load bundle
            BundleProperties bundleProperties = LoadBundleById(null, _root.data.items.library_bundles, vItem.itemId);

            if (null != bundleProperties)
            {
                graphics.AddBox(new Box(0, bundleProperties));
                if (vItem.viewParameters.showDimensions)
                {
                    graphics.AddDimensions(new DimensionCube(bundleProperties.Length, bundleProperties.Width, bundleProperties.Height));
                }
            }
            // load truck
            TruckProperties truckProperties = null;

            if (null != truckProperties)
            {
                Truck truck = new Truck(truckProperties);
                truck.Draw(graphics);
                if (vItem.viewParameters.showDimensions)
                {
                    graphics.AddDimensions(new DimensionCube(truckProperties.Length, truckProperties.Width, truckProperties.Height));
                }
            }

            FinalizeImageFromViewParameters(vItem.viewParameters, graphics);
        }
Esempio n. 25
0
        public static bool GetBestSolution(PackableBrick packableProperties, BoxProperties caseProperties, InterlayerProperties interlayer
                                           , ConstraintSetBoxCase constraintSet, bool allowMultipleLayerOrientations
                                           , Vector3D cameraPosition, bool showCotations, float fontSizeRatio, Size sz
                                           , ref int layerCount, ref int caseCount, ref int interlayerCount
                                           , ref double weightTotal, ref double weightLoad, ref double?weightNet
                                           , ref Vector3D bbLoad, ref Vector3D bbGlob
                                           , ref double volumeEfficency, ref double?weightEfficiency
                                           , ref byte[] imageBytes
                                           , ref string[] errors
                                           )
        {
            List <string> lErrors = new List <string>();

            if (!packableProperties.FitsIn(caseProperties, constraintSet))
            {
                lErrors.Add($"{packableProperties.Name} does not fit in {caseProperties.Name} with given constraint set!");
                return(false);
            }
            try
            {
                SolverBoxCase   solver   = new SolverBoxCase(packableProperties, caseProperties);
                List <Analysis> analyses = solver.BuildAnalyses(constraintSet, allowMultipleLayerOrientations);
                if (analyses.Count > 0)
                {
                    Analysis analysis = analyses[0];
                    layerCount      = analysis.Solution.LayerCount;
                    caseCount       = analysis.Solution.ItemCount;
                    interlayerCount = analysis.Solution.LayerCount;

                    weightLoad  = analysis.Solution.LoadWeight;
                    weightTotal = analysis.Solution.Weight;

                    OptDouble optNetWeight = analysis.Solution.NetWeight;
                    weightNet        = optNetWeight.Activated ? optNetWeight.Value : (double?)null;
                    bbGlob           = analysis.Solution.BBoxGlobal.DimensionsVec;
                    bbLoad           = analysis.Solution.BBoxLoad.DimensionsVec;
                    volumeEfficency  = analysis.Solution.VolumeEfficiency;
                    weightEfficiency = null;
                    if (analysis.Solution.WeightEfficiency.Activated)
                    {
                        weightEfficiency = analysis.Solution.WeightEfficiency.Value;
                    }

                    // generate image path
                    Graphics3DImage graphics = new Graphics3DImage(sz)
                    {
                        FontSizeRatio  = fontSizeRatio,
                        CameraPosition = cameraPosition,
                        ShowDimensions = showCotations
                    };
                    ViewerSolution sv = new ViewerSolution(analysis.Solution);
                    sv.Draw(graphics, Transform3D.Identity);
                    graphics.Flush();
                    Bitmap         bmp       = graphics.Bitmap;
                    ImageConverter converter = new ImageConverter();
                    imageBytes = (byte[])converter.ConvertTo(bmp, typeof(byte[]));
                }
                else
                {
                    lErrors.Add("No solution found!");
                }
            }
            catch (Exception ex)
            {
                lErrors.Add(ex.Message);
            }
            errors = lErrors.ToArray();
            return(0 == lErrors.Count);
        }
Esempio n. 26
0
        public DCSBSolution SB_GetCasePalletBestSolution(
            DCSBCase sbCase, DCSBPallet sbPallet, DCSBInterlayer sbInterlayer,
            DCSBConstraintSet sbConstraintSet,
            DCCompFormat expectedFormat, bool showCotations)
        {
            List <string> lErrors = new List <string>();

            try
            {
                BoxProperties boxProperties = new BoxProperties(null, sbCase.DimensionsOuter.M0, sbCase.DimensionsOuter.M1, sbCase.DimensionsOuter.M2)
                {
                    InsideLength = null != sbCase.DimensionsInner ? sbCase.DimensionsInner.M0 : 0.0,
                    InsideWidth  = null != sbCase.DimensionsInner ? sbCase.DimensionsInner.M1 : 0.0,
                    InsideHeight = null != sbCase.DimensionsInner ? sbCase.DimensionsInner.M2 : 0.0,
                    TapeColor    = Color.FromArgb(sbCase.TapeColor),
                    TapeWidth    = new OptDouble(sbCase.TapeWidth != 0.0, sbCase.TapeWidth)
                };
                boxProperties.SetWeight(sbCase.Weight);
                boxProperties.SetNetWeight(new OptDouble(sbCase.NetWeight.HasValue, sbCase.NetWeight.Value));
                if (null != sbCase.Colors && sbCase.Colors.Length >= 6)
                {
                    for (int i = 0; i < 6; ++i)
                    {
                        boxProperties.SetColor((HalfAxis.HAxis)i, Color.FromArgb(sbCase.Colors[i]));
                    }
                }
                else
                {
                    boxProperties.SetAllColors(Enumerable.Repeat <Color>(Color.Chocolate, 6).ToArray());
                }

                PalletProperties palletProperties = null;
                if (null != sbPallet.Dimensions)
                {
                    palletProperties = new PalletProperties(null, sbPallet.PalletType,
                                                            sbPallet.Dimensions.M0, sbPallet.Dimensions.M1, sbPallet.Dimensions.M2)
                    {
                        Weight = sbPallet.Weight,
                        Color  = Color.FromArgb(sbPallet.Color)
                    }
                }
                ;
                else
                {
                    palletProperties = new PalletProperties(null, "EUR2", 1200.0, 1000.0, 150.0);
                }

                InterlayerProperties interlayerProperties = null;
                if (null != sbInterlayer)
                {
                    interlayerProperties = new InterlayerProperties(null,
                                                                    sbInterlayer.Name, sbInterlayer.Description,
                                                                    sbInterlayer.Dimensions.M0, sbInterlayer.Dimensions.M1, sbInterlayer.Dimensions.M2,
                                                                    sbInterlayer.Weight, Color.FromArgb(sbInterlayer.Color));
                }

                OptDouble oMaxWeight = null != sbConstraintSet.MaxWeight ? new OptDouble(sbConstraintSet.MaxWeight.Active, sbConstraintSet.MaxWeight.Value_d) : OptDouble.Zero;
                OptDouble oMaxHeight = null != sbConstraintSet.MaxHeight ? new OptDouble(sbConstraintSet.MaxHeight.Active, sbConstraintSet.MaxHeight.Value_d) : OptDouble.Zero;
                OptInt    oMaxNumber = null != sbConstraintSet.MaxNumber ? new OptInt(sbConstraintSet.MaxNumber.Active, sbConstraintSet.MaxNumber.Value_i) : OptInt.Zero;
                ConstraintSetCasePallet constraintSet = new ConstraintSetCasePallet()
                {
                    OptMaxWeight = oMaxWeight,
                    OptMaxNumber = oMaxNumber
                };
                constraintSet.SetMaxHeight(oMaxHeight);
                constraintSet.SetAllowedOrientations(new bool[] { sbConstraintSet.Orientation.X, sbConstraintSet.Orientation.Y, sbConstraintSet.Orientation.Z });
                if (!constraintSet.Valid)
                {
                    throw new Exception("Invalid constraint set");
                }

                Vector3D cameraPosition = Graphics3D.Corner_0;
                int      layerCount = 0, caseCount = 0, interlayerCount = 0;
                double   weightTotal = 0.0, weightLoad = 0.0, volumeEfficiency = 0.0;
                double?  weightEfficiency = 0.0;
                double?  weightNet        = (double?)null;
                Vector3D bbLoad           = new Vector3D();
                Vector3D bbGlob           = new Vector3D();
                string   palletMapPhrase  = string.Empty;
                byte[]   imageBytes       = null;
                string[] errors           = null;

                if (StackBuilderProcessor.GetBestSolution(
                        boxProperties, palletProperties, interlayerProperties,
                        constraintSet, sbConstraintSet.AllowMultipleLayerOrientations,
                        cameraPosition, showCotations, 0.03f,
                        new Size(expectedFormat.Size.CX, expectedFormat.Size.CY),
                        ref layerCount, ref caseCount, ref interlayerCount,
                        ref weightTotal, ref weightLoad, ref weightNet,
                        ref bbLoad, ref bbGlob,
                        ref volumeEfficiency, ref weightEfficiency,
                        ref palletMapPhrase,
                        ref imageBytes, ref errors))
                {
                    foreach (string err in errors)
                    {
                        lErrors.Add(err);
                    }
                    return(new DCSBSolution()
                    {
                        LayerCount = layerCount,
                        CaseCount = caseCount,
                        InterlayerCount = interlayerCount,
                        WeightLoad = weightLoad,
                        WeightTotal = weightTotal,
                        NetWeight = weightNet,
                        BBoxLoad = new DCSBDim3D(bbLoad.X, bbLoad.Y, bbLoad.Z),
                        BBoxTotal = new DCSBDim3D(bbGlob.X, bbGlob.Y, bbGlob.Z),
                        Efficiency = volumeEfficiency,
                        OutFile = new DCCompFileOutput()
                        {
                            Bytes = imageBytes,
                            Format = new DCCompFormat()
                            {
                                Format = EOutFormat.IMAGE,
                                Size = new DCCompSize()
                                {
                                    CX = expectedFormat.Size.CX,
                                    CY = expectedFormat.Size.CY
                                }
                            }
                        },
                        PalletMapPhrase = palletMapPhrase,
                        Errors = lErrors.ToArray()
                    });
                }
            }
            catch (Exception ex)
            {
                lErrors.Add(ex.Message);
                _log.Error(ex.ToString());
            }
            return(new DCSBSolution()
            {
                Errors = lErrors.ToArray()
            });
        }
Esempio n. 27
0
        public DCSBSolution SB_GetBundlePalletBestSolution(
            DCSBBundle sbBundle, DCSBPallet sbPallet, DCSBInterlayer sbInterlayer
            , DCSBConstraintSet sbConstraintSet
            , DCCompFormat expectedFormat, bool showCotations)
        {
            List <string> lErrors = new List <string>();

            try
            {
                BundleProperties bundleProperties = new BundleProperties(null
                                                                         , sbBundle.Name, sbBundle.Description
                                                                         , sbBundle.DimensionsUnit.M0, sbBundle.DimensionsUnit.M1, sbBundle.DimensionsUnit.M2
                                                                         , sbBundle.UnitWeight, sbBundle.Number
                                                                         , Color.FromArgb(sbBundle.Color));
                PalletProperties palletProperties = null;
                if (null != sbPallet.Dimensions)
                {
                    palletProperties = new PalletProperties(null, sbPallet.PalletType,
                                                            sbPallet.Dimensions.M0, sbPallet.Dimensions.M1, sbPallet.Dimensions.M2)
                    {
                        Weight = sbPallet.Weight,
                        Color  = Color.FromArgb(sbPallet.Color)
                    }
                }
                ;
                else
                {
                    palletProperties = new PalletProperties(null, "EUR2", 1200.0, 1000.0, 150.0);
                }

                InterlayerProperties interlayerProperties = null;
                if (null != sbInterlayer)
                {
                    interlayerProperties = new InterlayerProperties(null,
                                                                    sbInterlayer.Name, sbInterlayer.Description,
                                                                    sbInterlayer.Dimensions.M0, sbInterlayer.Dimensions.M1, sbInterlayer.Dimensions.M2,
                                                                    sbInterlayer.Weight, Color.FromArgb(sbInterlayer.Color));
                }

                OptDouble oMaxWeight = null != sbConstraintSet.MaxWeight ? new OptDouble(sbConstraintSet.MaxWeight.Active, sbConstraintSet.MaxWeight.Value_d) : OptDouble.Zero;
                OptDouble oMaxHeight = null != sbConstraintSet.MaxHeight ? new OptDouble(sbConstraintSet.MaxHeight.Active, sbConstraintSet.MaxHeight.Value_d) : OptDouble.Zero;
                OptInt    oMaxNumber = null != sbConstraintSet.MaxNumber ? new OptInt(sbConstraintSet.MaxNumber.Active, sbConstraintSet.MaxNumber.Value_i) : OptInt.Zero;
                ConstraintSetCasePallet constraintSet = new ConstraintSetCasePallet()
                {
                    OptMaxWeight = oMaxWeight,
                    OptMaxNumber = oMaxNumber
                };
                constraintSet.SetMaxHeight(oMaxHeight);
                constraintSet.SetAllowedOrientations(new bool[] { false, false, true });
                if (!constraintSet.Valid)
                {
                    throw new Exception("Invalid constraint set");
                }

                Vector3D cameraPosition = Graphics3D.Corner_0;
                int      layerCount = 0, caseCount = 0, interlayerCount = 0;
                double   weightTotal = 0.0, weightLoad = 0.0, volumeEfficiency = 0.0;
                double?  weightEfficiency = 0.0;
                double?  weightNet        = (double?)null;
                Vector3D bbLoad           = new Vector3D();
                Vector3D bbGlob           = new Vector3D();
                byte[]   imageBytes       = null;
                string[] errors           = null;
                string   palletMapPhrase  = string.Empty;

                if (StackBuilderProcessor.GetBestSolution(
                        bundleProperties, palletProperties, interlayerProperties,
                        constraintSet, false,
                        cameraPosition, showCotations, 0.03f,
                        new Size(expectedFormat.Size.CX, expectedFormat.Size.CY),
                        ref layerCount, ref caseCount, ref interlayerCount,
                        ref weightTotal, ref weightLoad, ref weightNet,
                        ref bbLoad, ref bbGlob,
                        ref volumeEfficiency, ref weightEfficiency,
                        ref palletMapPhrase,
                        ref imageBytes, ref errors))
                {
                    foreach (string err in errors)
                    {
                        lErrors.Add(err);
                    }
                    return(new DCSBSolution()
                    {
                        LayerCount = layerCount,
                        CaseCount = caseCount,
                        InterlayerCount = interlayerCount,
                        WeightLoad = weightLoad,
                        WeightTotal = weightTotal,
                        NetWeight = weightNet,
                        BBoxLoad = new DCSBDim3D(bbLoad.X, bbLoad.Y, bbLoad.Z),
                        BBoxTotal = new DCSBDim3D(bbGlob.X, bbGlob.Y, bbGlob.Z),
                        Efficiency = volumeEfficiency,
                        OutFile = new DCCompFileOutput()
                        {
                            Bytes = imageBytes,
                            Format = new DCCompFormat()
                            {
                                Format = EOutFormat.IMAGE,
                                Size = new DCCompSize()
                                {
                                    CX = expectedFormat.Size.CX,
                                    CY = expectedFormat.Size.CY
                                }
                            }
                        },
                        Errors = lErrors.ToArray()
                    });
                }
            }
            catch (Exception ex)
            {
                lErrors.Add(ex.Message);
                _log.Error(ex.ToString());
            }
            return(new DCSBSolution()
            {
                Errors = lErrors.ToArray()
            });
        }
Esempio n. 28
0
 public InterlayerItem(InterlayerProperties interlayerProperties)
 {
     _interlayerProperties = interlayerProperties;
 }
        /// <summary>
        /// Use this method when drawing a solution that belongs an analysis
        /// </summary>
        /// <param name="graphics"></param>
        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;
        }
Esempio n. 30
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));
            }
            // ###
        }