Esempio n. 1
0
        private PackWrapper BuildWrapper()
        {
            int[]  noWalls = ParamSetPackOpt.NoWalls;
            double length = 0.0, width = 0.0, height = 0.0;
            double weight = ParamSetPackOpt.WallSurfaceMass * (noWalls[0] * width * height + noWalls[1] * length * height + noWalls[2] * length * width);

            switch (ParamSetPackOpt.WrapperType)
            {
            case PackWrapper.WType.WT_POLYETHILENE:
                return(new WrapperPolyethilene(
                           ParamSetPackOpt.WallThickness, weight, _packColor));

            case PackWrapper.WType.WT_PAPER:
                return(new WrapperPaper(
                           ParamSetPackOpt.WallThickness, weight, _packColor));

            case PackWrapper.WType.WT_CARDBOARD:
            {
                var wrapperCardboard = new WrapperCardboard(
                    ParamSetPackOpt.WallThickness, weight, _packColor);
                wrapperCardboard.SetNoWalls(noWalls);
                return(wrapperCardboard);
            }

            default:
                throw new InvalidEnumArgumentException(nameof(ParamSetPackOpt.WrapperType), (int)ParamSetPackOpt.WrapperType, typeof(PackWrapper.WType));
            }
        }
Esempio n. 2
0
        private PackWrapper BuildWrapper(Vector3D dimensions)
        {
            // no wrapper?
            if (!ParamSetPackOpt.HasWrapper)
            {
                return(null);
            }

            int[]  noWalls = ParamSetPackOpt.NoWrapperWalls;
            double length = 0.0, width = 0.0, height = 0.0;
            double weight = ParamSetPackOpt.WrapperSurfMass * (noWalls[0] * width * height + noWalls[1] * length * height + noWalls[2] * length * width);

            switch (ParamSetPackOpt.WrapperType)
            {
            case PackWrapper.WType.WT_POLYETHILENE:
                return(new WrapperPolyethilene(ParamSetPackOpt.WrapperThickness, ParamSetPackOpt.WrapperWeight(dimensions), ParamSetPackOpt.WrapperColor));

            case PackWrapper.WType.WT_PAPER:
                return(new WrapperPaper(ParamSetPackOpt.WrapperThickness, weight, ParamSetPackOpt.WrapperColor));

            case PackWrapper.WType.WT_CARDBOARD:
            {
                var wrapperCardboard = new WrapperCardboard(ParamSetPackOpt.WrapperThickness, weight, ParamSetPackOpt.WrapperColor);
                wrapperCardboard.SetNoWalls(noWalls);
                return(wrapperCardboard);
            }

            default:
                throw new InvalidEnumArgumentException(nameof(ParamSetPackOpt.WrapperType), (int)ParamSetPackOpt.WrapperType, typeof(PackWrapper.WType));
            }
        }
Esempio n. 3
0
        private void btAddPackPalletAnalysis_Click(object sender, EventArgs e)
        {
            try
            {
                // get selected box
                BoxProperties boxProperties = SelectedBox;
                // get selected pallet
                PalletProperties palletProperties = SelectedPallet;
                // get selected caseOptimSolution
                CaseOptimSolution sol         = SelectedSolution;
                PackArrangement   arrangement = sol.CaseDefinition.Arrangement;
                // build new case name
                string name = string.Format("{0}_{1}*{2}*{3}_{4}{5}"
                                            , boxProperties.Name
                                            , arrangement.Length
                                            , arrangement.Width
                                            , arrangement.Height
                                            , sol.CaseDefinition.Dim0
                                            , sol.CaseDefinition.Dim1);
                // build new case description
                string description = string.Format("Case generated by case optimization for box {0} and pallet {1}"
                                                   , boxProperties.Name
                                                   , palletProperties.Name);
                // analysis name/description
                string analysisName = string.Format("OptimAnalysis{0}_{1}*{2}*{3}_{4}{5}"
                                                    , boxProperties.Name
                                                    , boxProperties.Name
                                                    , arrangement.Length
                                                    , arrangement.Width
                                                    , arrangement.Height
                                                    , sol.CaseDefinition.Dim0
                                                    , sol.CaseDefinition.Dim1);
                string analysisDescription = string.Format("Pallet analysis generated by case optimisation for box {0} and pallet {1}"
                                                           , boxProperties.Name
                                                           , palletProperties.Name);
                // create PackProperties
                HalfAxis.HAxis axis          = PackProperties.Orientation(sol.CaseDefinition.Dim0, sol.CaseDefinition.Dim1);
                double         wrapperWeight = WrapperCardboard.EstimateWeight(
                    SelectedBox
                    , arrangement
                    , axis
                    , NoWalls
                    , WallThickness
                    , WallSurfaceMass);
                // cardboard wrapper
                WrapperCardboard wrapper = new WrapperCardboard(WallThickness, wrapperWeight, Color.Chocolate);
                wrapper.SetNoWalls(NoWalls[0], NoWalls[1], NoWalls[2]);
                // pack
                PackProperties pack = _document.CreateNewPack(
                    name, description
                    , boxProperties, arrangement, axis
                    , wrapper);
                // constraint set
                ConstraintSetCasePallet constraintSet = new ConstraintSetCasePallet()
                {
                    Overhang = new Vector2D(OverhangX, OverhangY)
                };
                constraintSet.SetMaxHeight(new OptDouble(true, MaximumPalletHeight));
                constraintSet.OptMaxWeight = new OptDouble(false, 0);
                // interlayer
                List <InterlayerProperties> listInterlayers = new List <InterlayerProperties>();
                // layer desc
                List <LayerDesc> layerDescs = new List <LayerDesc>();
                // create analysis
                Analysis analysis = _document.CreateNewAnalysisCasePallet(
                    analysisName, analysisDescription
                    , pack, palletProperties
                    , listInterlayers
                    , null, null, null
                    , constraintSet, layerDescs
                    );

                /*
                 * // constraint set
                 * PackPalletConstraintSet constraintSet = new PackPalletConstraintSet();
                 * constraintSet.OverhangX = OverhangX;
                 * constraintSet.OverhangY = OverhangY;
                 * constraintSet.MaximumPalletHeight = new OptDouble(true, MaximumPalletHeight);
                 * // create analysis
                 * _document.CreateNewPackPalletAnalysis(
                 *  analysisName
                 *  , analysisDescription
                 *  , pack
                 *  , palletProperties
                 *  , null
                 *  , constraintSet
                 *  , new PackPalletSolver());
                 */
            }
            catch (Exception ex)
            {
                _log.Error(ex.ToString());
            }
        }
Esempio n. 4
0
        private void btAddCasePalletAnalysis_Click(object sender, EventArgs e)
        {
            try
            {
                // get selected box
                BoxProperties boxProperties = SelectedBox;
                // get selected pallet
                PalletProperties palletProperties = SelectedPallet;
                // get selected caseOptimSolution
                CaseOptimSolution sol         = SelectedSolution;
                PackArrangement   arrangement = sol.CaseDefinition.Arrangement;
                // build new case name
                string name = string.Format("{0}_{1}*{2}*{3}_{4}{5}"
                                            , boxProperties.Name
                                            , arrangement.Length
                                            , arrangement.Width
                                            , arrangement.Height
                                            , sol.CaseDefinition.Dim0
                                            , sol.CaseDefinition.Dim1);
                // build new case description
                string description = string.Format("Case generated by case optimization for box {0} and pallet {1}"
                                                   , boxProperties.Name
                                                   , palletProperties.Name);
                // analysis name/description
                string analysisName = string.Format("OptimAnalysis{0}_{1}*{2}*{3}_{4}{5}"
                                                    , boxProperties.Name
                                                    , boxProperties.Name
                                                    , arrangement.Length
                                                    , arrangement.Width
                                                    , arrangement.Height
                                                    , sol.CaseDefinition.Dim0
                                                    , sol.CaseDefinition.Dim1);
                string analysisDescription = string.Format("Pallet analysis generated by case optimisation for box {0} and pallet {1}"
                                                           , boxProperties.Name
                                                           , palletProperties.Name);
                // create PackProperties
                HalfAxis.HAxis axis          = PackProperties.Orientation(sol.CaseDefinition.Dim0, sol.CaseDefinition.Dim1);
                double         wrapperWeight = WrapperCardboard.EstimateWeight(
                    SelectedBox
                    , arrangement
                    , axis
                    , NoWalls
                    , WallThickness
                    , WallSurfaceMass);

/*
 *              // add new case
 *              CaseOfBoxesProperties caseProperties = _document.CreateNewCaseOfBoxes(
 *                  name, description
 *                  , boxProperties
 *                  , sol.CaseDefinition
 *                  , BuildCaseOptimConstraintSet());
 *              // set color
 *              caseProperties.SetColor(Color.Chocolate);
 *              // add new pallet analysis
 *              List<CasePalletSolution> palletSolutionList = new List<CasePalletSolution>();
 *              palletSolutionList.Add(sol.PalletSolution);
 *              Analysis analysis = _document.CreateNewCasePalletAnalysis(
 *                  analysisName
 *                  , analysisDescription
 *                  , caseProperties
 *                  , palletProperties
 *                  , null, null
 *                  , null, null, null
 *                  , BuildCasePalletConstraintSet()
 *                  , palletSolutionList);
 */
            }
            catch (Exception ex)
            {
                _log.Error(ex.ToString());
            }
        }
Esempio n. 5
0
 private void btAddPackPalletAnalysis_Click(object sender, EventArgs e)
 {
     try
     {
         // get selected box
         BoxProperties boxProperties = SelectedBox;
         // get selected pallet
         PalletProperties palletProperties = SelectedPallet;
         // get selected caseOptimSolution
         CaseOptimSolution sol         = SelectedSolution;
         PackArrangement   arrangement = sol.CaseDefinition.Arrangement;
         // build new case name
         string name = string.Format("{0}_{1}*{2}*{3}_{4}{5}"
                                     , boxProperties.Name
                                     , arrangement._iLength
                                     , arrangement._iWidth
                                     , arrangement._iHeight
                                     , sol.CaseDefinition.Dim0
                                     , sol.CaseDefinition.Dim1);
         // build new case description
         string description = string.Format("Case generated by case optimization for box {0} and pallet {1}"
                                            , boxProperties.Name
                                            , palletProperties.Name);
         // analysis name/description
         string analysisName = string.Format("OptimAnalysis{0}_{1}*{2}*{3}_{4}{5}"
                                             , boxProperties.Name
                                             , boxProperties.Name
                                             , arrangement._iLength
                                             , arrangement._iWidth
                                             , arrangement._iHeight
                                             , sol.CaseDefinition.Dim0
                                             , sol.CaseDefinition.Dim1);
         string analysisDescription = string.Format("Pallet analysis generated by case optimisation for box {0} and pallet {1}"
                                                    , boxProperties.Name
                                                    , palletProperties.Name);
         // create PackProperties
         HalfAxis.HAxis axis          = PackProperties.Orientation(sol.CaseDefinition.Dim0, sol.CaseDefinition.Dim1);
         double         wrapperWeight = WrapperCardboard.EstimateWeight(
             SelectedBox
             , arrangement
             , axis
             , NoWalls
             , WallThickness
             , WallSurfaceMass);
         // cardboard wrapper
         WrapperCardboard wrapper = new WrapperCardboard(WallThickness, wrapperWeight, Color.Chocolate);
         wrapper.SetNoWalls(NoWalls[0], NoWalls[1], NoWalls[2]);
         // pack
         PackProperties pack = _document.CreateNewPack(
             name, description
             , boxProperties, arrangement, axis
             , wrapper);
         // constraint set
         PackPalletConstraintSet constraintSet = new PackPalletConstraintSet();
         constraintSet.OverhangX           = OverhangX;
         constraintSet.OverhangY           = OverhangY;
         constraintSet.MaximumPalletHeight = new OptDouble(true, MaximumPalletHeight);
         // create analysis
         _document.CreateNewPackPalletAnalysis(
             analysisName
             , analysisDescription
             , pack
             , palletProperties
             , null
             , constraintSet
             , new PackPalletSolver());
     }
     catch (Exception ex)
     {
         _log.Error(ex.ToString());
     }
 }