public double Area(BoxProperties boxProperties, CaseOptimConstraintSet constraintSet)
 {
     Vector3D outerDim = OuterDimensions(boxProperties, constraintSet);
     return (constraintSet.NoWalls[0] * outerDim.Y * outerDim.Z
         + constraintSet.NoWalls[1] * outerDim.X * outerDim.Z
         + constraintSet.NoWalls[2] * outerDim.X * outerDim.Y) * UnitsManager.FactorSquareLengthToArea;
 }
 public CaseDefinitionViewer(CaseDefinition caseDefinition, BoxProperties boxProperties, CaseOptimConstraintSet caseConstraintSet)
 {
     _caseDefinition = caseDefinition;
     _boxProperties = boxProperties;
     _caseOptimConstraintSet = caseConstraintSet;
     _globalOrientation = new Orientation(HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Y_P);
 }
 public void ProcessAnalysis(BoxCasePalletAnalysis analysis)
 {
     _boxProperties = analysis.BoxProperties;
     _interlayerProperties = analysis.InterlayerProperties;
     _palletSolutionList = analysis.PalletSolutionsList;
     _constraintSet = analysis.ConstraintSet;
     analysis.Solutions = GenerateSolutions();
 }
 public BoxCaseAnalysis(BProperties bProperties, BoxProperties caseProperties, BCaseConstraintSet constraintSet)
     : base(bProperties.ParentDocument)
 {
     if (!constraintSet.IsValid)
         throw new Exception("Using invalid box/case constraintset -> Can not instantiate box/case analysis!");
     this.BProperties = bProperties;
     this.CaseProperties = caseProperties;
     _constraintSet = constraintSet;
 }
Example #5
0
 public CaseAnalysis(BoxProperties boxProperties, List<PalletSolutionDesc> palletSolutionList, CaseConstraintSet constraintSet)
     : base(boxProperties.ParentDocument)
 {
     if (!constraintSet.IsValid)
         throw new Exception("Using invalid case constraintset -> Can not instantiate case analysis!");
     _boxProperties = boxProperties;
     boxProperties.AddDependancie(this);
     _palletSolutionsList = palletSolutionList;
     _constraintSet = constraintSet;
 }
 public CaseOptimizer(
     BoxProperties boxProperties
     , PalletProperties palletProperties
     , PalletConstraintSet palletContraintSet
     , CaseOptimConstraintSet caseOptimConstraintSet)
 {
     _boxProperties = boxProperties;
     _palletProperties = palletProperties;
     _palletConstraintSet = palletContraintSet;
     _caseOptimConstraintSet = caseOptimConstraintSet;
 }
Example #7
0
 public Case(BoxProperties boxProperties)
 {
     _length = boxProperties.Length;
     _width = boxProperties.Width;
     _height = boxProperties.Height;
     _insideLength = boxProperties.InsideLength;
     _insideWidth = boxProperties.InsideWidth;
     _insideHeight = boxProperties.InsideHeight;
     _colors = boxProperties.Colors;
     _colorPath = Color.Black;
 }
        public void ProcessAnalysis(BoxCaseAnalysis analysis)
        {
            _bProperties = analysis.BProperties;
            _caseProperties = analysis.CaseProperties;
            _constraintSet = analysis.ConstraintSet;

            if (!_constraintSet.IsValid)
                throw new EngineException("Constraint set is invalid!");

            analysis.Solutions = GenerateSolutions();
        }
 /// <summary>
 /// Instantiate a new case from a box, a case definition and a case optimization constraintset
 /// </summary>
 /// <param name="document">Parent document</param>
 /// <param name="bProperties">Box properties</param>
 /// <param name="constraintSet">Case optimization constraint set</param>
 public CaseOfBoxesProperties(Document document
     , BoxProperties boxProperties
     , CaseDefinition caseDefinition
     , CaseOptimConstraintSet constraintSet)
     : base(document)
 {
     _boxProperties = boxProperties;
     _boxProperties.AddDependancie(this);
     _caseDefinition = caseDefinition;
     _constraintSet = constraintSet;
     OnAttributeModified(boxProperties);
 }
Example #10
0
 public Case(BoxProperties boxProperties, Transform3D transf)
 {
     _length = boxProperties.Length;
     _width = boxProperties.Width;
     _height = boxProperties.Height;
     _insideLength = boxProperties.InsideLength;
     _insideWidth = boxProperties.InsideWidth;
     _insideHeight = boxProperties.InsideHeight;
     _colors = boxProperties.Colors;
     _colorPath = Color.Black;
     _transf = transf;
 }
Example #11
0
        static void Main(string[] args)
        {
            // define box properties
            BoxProperties boxProperties = new BoxProperties(null, 120.0, 100.0, 70.0);
            // define pallet properties
            PalletProperties palletProperties = new PalletProperties(null, "Block", 1200, 1000, 150);
            // define pallet constraintSet
            CasePalletConstraintSet constraintSet = new CasePalletConstraintSet();
            constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_X_N, true);
            constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_X_P, true);
            constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Y_N, true);
            constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Y_P, true);
            constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Z_N, true);
            constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Z_P, true);

            constraintSet.SetAllowedPattern("Column");
            constraintSet.SetAllowedPattern("Diagonale");
            constraintSet.SetAllowedPattern("Interlocked");
            constraintSet.SetAllowedPattern("Trilock");
            constraintSet.SetAllowedPattern("Spirale");

            constraintSet.AllowAlignedLayers = true;
            constraintSet.AllowAlternateLayers = true;

            constraintSet.MaximumHeight = 2000;
            constraintSet.MaximumNumberOfItems = 2000;
            constraintSet.UseMaximumHeight = true;
            constraintSet.UseMaximumPalletWeight = false;
            constraintSet.UseMaximumWeightOnBox = false;
            Console.WriteLine("=== Constraint set ===");
            Console.WriteLine(constraintSet.ToString());

            // define case optim constraintSet
            CaseOptimConstraintSet caseOptimConstraintSet = new CaseOptimConstraintSet(
                new int[3]{2, 2, 4}
                , 4.0, 0.01
                , new Vector3D(30.0, 30.0, 70.0)
                , new Vector3D(500.0, 500.0, 500.0)
                , false
                );

            CaseOptimizer caseOptimizer = new CaseOptimizer(boxProperties, palletProperties, constraintSet, caseOptimConstraintSet);

            // get all valid case definitions
            foreach (CaseDefinition caseDefinition in caseOptimizer.CaseDefinitions(48))
                Console.WriteLine(caseDefinition.ToString() + caseDefinition.OuterDimensions(boxProperties, caseOptimConstraintSet));
            // build list of solutions
            List<CaseOptimSolution> caseOptimSolutions = caseOptimizer.CaseOptimSolutions(48);
            foreach (CaseOptimSolution caseOptimSolution in caseOptimSolutions)
                Console.WriteLine(caseOptimSolution.ToString());
        }
        /// <summary>
        /// constructor
        /// </summary>
        /// <param name="doc">Reference of parent <see cref="Document"/></param>
        /// <param name="box">Reference </param>
        public PackProperties(Document doc
            , BoxProperties box
            , PackArrangement arrangement
            , HalfAxis.HAxis orientation
            , PackWrapper wrapper)
            : base(doc)
        {
            _boxProperties = box;
            _boxProperties.AddDependancy(this);

            _arrangement = arrangement;
            _orientation = orientation;
            _wrapper = wrapper;
        }
 /// <summary>
 /// constructor (from existing BoxProperties)
 /// </summary>
 public FormEditBitmaps(BoxProperties boxProperties)
 {
     InitializeComponent();
     // set unit labels
     UnitsManager.AdaptUnitLabels(this);
     // set internal box properties
     _boxProperties = boxProperties;
     // get textures
     _textures = _boxProperties.TextureListCopy;
     // set default face
     cbFace.SelectedIndex = 0;
     // set horizontal angle
     trackBarHorizAngle.Value = 225;
 }
Example #14
0
        /// <summary>
        /// Instantiate a new case from a box, a case definition and a case optimization constraintset
        /// </summary>
        /// <param name="document">Parent document</param>
        /// <param name="bProperties">Box properties</param>
        /// <param name="constraintSet">Case optimization constraint set</param>
        public CaseOfBoxesProperties(Document document
                                     , BoxProperties boxProperties
                                     , CaseDefinition caseDefinition
                                     , CaseOptimConstraintSet constraintSet)
            : base(document)
        {
            _boxProperties = boxProperties;
            _boxProperties.AddDependancy(this);
            _caseDefinition = caseDefinition;
            _constraintSet  = constraintSet;

            base.Weight = _caseDefinition.CaseEmptyWeight(_boxProperties, _constraintSet);

            OnAttributeModified(boxProperties);
        }
 /// <summary>
 /// constructor (from length, width, height)
 /// </summary>
 public FormEditBitmaps(double length, double width, double height, Color[] faceColors)
 {
     InitializeComponent();
     // set unit labels
     UnitsManager.AdaptUnitLabels(this);
     // set internal box properties
     _boxProperties = new BoxProperties(null, length, width, height);
     _boxProperties.SetAllColors(faceColors);
     // get textures
     _textures = _boxProperties.TextureListCopy;
     // set default face
     cbFace.SelectedIndex = 0;
     // set horizontal angle
     trackBarHorizAngle.Value = 225;
 }
        /// <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));
        }
Example #17
0
        // static methods
        static public double EstimateWeight(
            BoxProperties boxProperties, PackArrangement arrangement, HalfAxis.HAxis orientation
            , int[] noWalls, double thickness, double surfacicMass)
        {
            double length = 0.0, width = 0.0, height = 0.0;

            PackProperties.GetDimensions(boxProperties, orientation, arrangement, ref length, ref width, ref height);
            Vector3D vDimensions = new Vector3D(
                length + noWalls[0] * thickness
                , width + noWalls[1] * thickness
                , height + noWalls[2] * thickness);

            double area = (noWalls[0] * vDimensions.Y * vDimensions.Z
                           + noWalls[1] * vDimensions.X * vDimensions.Z
                           + noWalls[2] * vDimensions.X * vDimensions.Y) * UnitsManager.FactorSquareLengthToArea;

            return(area * surfacicMass);
        }
        /// <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));
        }
 public bool FitsIn(BoxProperties caseProperties, bool allowVerticalX, bool allowVerticalY, bool allowVerticalZ)
 {
     double[] dimItem = OuterDimensions;
     double[] dimCase = caseProperties.InsideDimensions;
     if (allowVerticalX)
     {
         if (
             (dimItem[0] <= dimCase[0]) && (
                 ((dimItem[1] <= dimCase[1]) && (dimItem[2] <= dimCase[2])) ||
                 ((dimItem[1] <= dimCase[2]) && (dimItem[2] <= dimCase[1])))
             )
         {
             return(true);
         }
     }
     if (allowVerticalY)
     {
         if (
             (dimItem[1] <= dimCase[1]) && (
                 ((dimItem[0] <= dimCase[0]) && (dimItem[2] <= dimCase[2])) ||
                 ((dimItem[0] <= dimCase[2]) && (dimItem[2] <= dimCase[0])))
             )
         {
             return(true);
         }
     }
     if (allowVerticalZ)
     {
         if (
             (dimItem[2] <= dimCase[2]) && (
                 ((dimItem[0] <= dimCase[0]) && (dimItem[1] <= dimCase[1])) ||
                 ((dimItem[0] <= dimCase[1]) && (dimItem[1] <= dimCase[0])))
             )
         {
             return(true);
         }
     }
     return(false);
 }
Example #20
0
 /// <summary>
 /// FormNewBox constructor used to edit existing boxes
 /// </summary>
 /// <param name="document">Document that contains the edited box</param>
 /// <param name="boxProperties">Edited box</param>
 public FormNewBox(Document document, BoxProperties boxProperties)
 {
     InitializeComponent();
     // set unit labels
     UnitsManager.AdaptUnitLabels(this);
     // save document reference
     _document = document;
     _boxProperties = boxProperties;
     _mode = boxProperties.HasInsideDimensions ? Mode.MODE_CASE : Mode.MODE_BOX;
     // set colors
     for (int i=0; i<6; ++i)
         _faceColors[i] = _boxProperties.Colors[i];
     // set textures
     _textures = _boxProperties.TextureListCopy;
     // set caption text
     Text = string.Format(Properties.Resources.ID_EDIT, _boxProperties.Name);
     // initialize value
     tbName.Text = _boxProperties.Name;
     tbDescription.Text = _boxProperties.Description;
     nudLength.Value = (decimal)_boxProperties.Length;
     nudInsideLength.Value = (decimal)_boxProperties.InsideLength;
     nudWidth.Value = (decimal)_boxProperties.Width;
     nudInsideWidth.Value = (decimal)_boxProperties.InsideWidth;
     nudHeight.Value = (decimal)_boxProperties.Height;
     nudInsideHeight.Value = (decimal)_boxProperties.InsideHeight;
     // weight
     vcWeight.Value = _boxProperties.Weight;
     // net weight
     ovcNetWeight.Value = _boxProperties.NetWeight;
     // color : all faces set together / face by face
     chkAllFaces.Checked = _boxProperties.UniqueColor;
     chkAllFaces_CheckedChanged(this, null);
     // tape
     checkBoxTape.Checked = _boxProperties.ShowTape;
     nudTapeWidth.Value = (decimal)_boxProperties.TapeWidth;
     cbTapeColor.Color = _boxProperties.TapeColor;
     // set default face
     cbFace.SelectedIndex = 0;
     // disable Ok button
     UpdateButtonOkStatus();
 }
Example #21
0
 public double BoxHeight(BoxProperties boxProperties)
 {
     return(boxProperties.Dim(Dim2));
 }
 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());
         }
     }
 }
Example #23
0
 public double InnerWeight(BoxProperties boxProperties)
 {
     return(_arrangement.Number * boxProperties.Weight);
 }
        public List<CaseOptimSolution> CaseOptimSolutions(int iNumber)
        {
            List<CaseOptimSolution> caseOptimSolutions = new List<CaseOptimSolution>();

            foreach (CaseDefinition caseDefinition in CaseDefinitions(iNumber))
            {
                Vector3D outerDimensions = caseDefinition.OuterDimensions(_boxProperties, _caseOptimConstraintSet);
                BoxProperties bProperties = new BoxProperties(_palletProperties.ParentDocument, outerDimensions.X, outerDimensions.Y, outerDimensions.Z);
                // build analysis
                CasePalletAnalysis casePalletAnalysis = new CasePalletAnalysis(
                    bProperties, _palletProperties,
                    null, null,
                    null, null, null,
                    _palletConstraintSet);
                // instantiate solver
                CasePalletSolver solver = new CasePalletSolver();
                // solve
                solver.ProcessAnalysis(casePalletAnalysis);
                // get list of pallet solutions
                List<CasePalletSolution> palletSolutions = casePalletAnalysis.Solutions;
                if (palletSolutions.Count > 0)
                {
                    int maxCaseCount = palletSolutions[0].CaseCount;
                    int i = 0;
                    while (maxCaseCount == palletSolutions[i].CaseCount)
                    {
                        caseOptimSolutions.Add(new CaseOptimSolution(caseDefinition, palletSolutions[i]));
                        ++i;
                    }
                }
            }
            // sort caseOptimSolution
            caseOptimSolutions.Sort();
            return caseOptimSolutions;
        }
 internal BoxProperties ToCase(DataCase dtCase)
 {
     BoxProperties boxProperties = new BoxProperties(null
          , dtCase.OuterDimensions[0], dtCase.OuterDimensions[1], dtCase.OuterDimensions[2]
          , dtCase.InnerDimensions[0], dtCase.InnerDimensions[1], dtCase.InnerDimensions[2]);
     Color[] colors = new Color[6];
     for (int i = 0; i < 6; ++i) colors[i] = Color.Chocolate;
     boxProperties.Name = dtCase.Name;
     boxProperties.Description = dtCase.Description;
     boxProperties.SetAllColors(colors);
     boxProperties.ShowTape = true;
     boxProperties.TapeColor = Color.Beige;
     boxProperties.TapeWidth = UnitsManager.ConvertLengthFrom(50, UnitsManager.UnitSystem.UNIT_METRIC1);
     boxProperties.Weight = dtCase.Weight;
     boxProperties.NetWeight = new OptDouble(dtCase.NetWeight > 0.0, dtCase.NetWeight);
     return boxProperties;
 }
Example #26
0
 public double BoxLength(BoxProperties boxProperties)
 {
     return(boxProperties.Dim(_dim0));
 }
Example #27
0
 public BoxProperties CreateNewCase(BoxProperties boxProp)
 {
     // instantiate and initialize
     BoxProperties boxPropClone = new BoxProperties(this
         , boxProp.Length
         , boxProp.Width
         , boxProp.Height
         , boxProp.InsideLength
         , boxProp.InsideWidth
         , boxProp.InsideHeight);
     boxPropClone.Weight = boxProp.Weight;
     boxPropClone.NetWeight = boxProp.NetWeight;
     boxPropClone.Name = boxProp.Name;
     boxPropClone.Description = boxProp.Description;
     boxPropClone.SetAllColors(boxProp.Colors);
     boxPropClone.ShowTape = boxProp.ShowTape;
     boxPropClone.TapeWidth = boxProp.TapeWidth;
     boxPropClone.TapeColor = boxProp.TapeColor;
     // insert in list
     _typeList.Add(boxPropClone);
     // notify listeners
     NotifyOnNewTypeCreated(boxPropClone);
     Modify();
     return boxPropClone;
 }
Example #28
0
 public CaseOfBoxesProperties CreateNewCaseOfBoxes(
     string name, string description
     , BoxProperties boxProperties
     , CaseDefinition caseDefinition
     , CaseOptimConstraintSet constraintSet)
 {
     CaseOfBoxesProperties caseProperties = new CaseOfBoxesProperties(this, boxProperties, caseDefinition, constraintSet);
     caseProperties.Name = name;
     caseProperties.Description = description;
     // insert in list
     _typeList.Add(caseProperties);
     // notify listeners
     NotifyOnNewTypeCreated(caseProperties);
     Modify();
     return caseProperties;
 }
Example #29
0
 public BoxCasePalletAnalysis CreateNewBoxCasePalletOptimization(
     string name, string description
     , BoxProperties bProperties
     , BoxCasePalletConstraintSet constraintSet
     , List<PalletSolutionDesc> palletSolutionList
     , IBoxCasePalletAnalysisSolver solver)
 {
     BoxCasePalletAnalysis analysis = new BoxCasePalletAnalysis(bProperties, palletSolutionList, constraintSet);
     analysis.Name = name;
     analysis.Description = description;
     // insert in list
     _boxCasePalletOptimizations.Add(analysis);
     // compute analysis
     if (null != solver)
     {
         solver.ProcessAnalysis(analysis);
         if (analysis.Solutions.Count < 1)
         {	// remove analysis from list if it has no valid solution
             _boxCasePalletOptimizations.Remove(analysis);
             _log.InfoFormat("Failed to find any solution {0}", analysis.Name);
             return null;
         }
     }
     // notify listeners
     NotifyOnNewCaseAnalysisCreated(analysis);
     Modify();
     return analysis;
 }
Example #30
0
 /// <summary>
 /// Create a new case
 /// </summary>
 /// <param name="name"></param>
 /// <param name="description"></param>
 /// <param name="length"></param>
 /// <param name="width"></param>
 /// <param name="height"></param>
 /// <param name="insideLength"></param>
 /// <param name="insideWidth"></param>
 /// <param name="insideHeight"></param>
 /// <param name="weight"></param>
 /// <param name="colors"></param>
 /// <returns></returns>
 public BoxProperties CreateNewCase(
     string name, string description
     , double length, double width, double height
     , double insideLength, double insideWidth, double insideHeight
     , double weight
     , Color[] colors)
 {
     // instantiate and initialize
     BoxProperties boxProperties = new BoxProperties(this, length, width, height, insideLength, insideWidth, insideHeight);
     boxProperties.Weight = weight;
     boxProperties.Name = name;
     boxProperties.Description = description;
     boxProperties.SetAllColors(colors);
     // insert in list
     _typeList.Add(boxProperties);
     // notify listeners
     NotifyOnNewTypeCreated(boxProperties);
     Modify();
     return boxProperties;
 }
Example #31
0
 public BoxCaseAnalysis CreateNewBoxCaseAnalysis(
     string name, string description
     , BProperties boxProperties, BoxProperties caseProperties
     , BCaseConstraintSet constraintSet
     , IBoxCaseAnalysisSolver solver)
 {
     BoxCaseAnalysis analysis = new BoxCaseAnalysis(boxProperties, caseProperties, constraintSet);
     analysis.Name = name;
     analysis.Description = description;
     // insert in list
     _boxCaseAnalyses.Add(analysis);
     // compute analysis
     if (null != solver)
     {
         solver.ProcessAnalysis(analysis);
         if (analysis.Solutions.Count < 1)
         {	// remove analysis from list if it has no valid solution
             _boxCaseAnalyses.Remove(analysis);
             return null;
         }
     }
     // notify listeners
     NotifyOnNewBoxCaseAnalysis(analysis);
     Modify();
     return analysis;
 }
Example #32
0
 public BoxCaseAnalysis CreateNewBoxCaseAnalysis(
     string name, string description
     , BProperties boxProperties, BoxProperties caseProperties
     , BCaseConstraintSet constraintSet
     , List<BoxCaseSolution> solutions)
 {
     BoxCaseAnalysis analysis = new BoxCaseAnalysis(boxProperties, caseProperties, constraintSet);
     analysis.Name = name;
     analysis.Description = description;
     // insert in list
     _boxCaseAnalyses.Add(analysis);
     // set solutions
     analysis.Solutions = solutions;
     // notify listeners
     NotifyOnNewBoxCaseAnalysis(analysis);
     // set solution selected if it is unique
     if (solutions.Count == 1)
         analysis.SelectSolutionByIndex(0);
     return analysis;
 }
Example #33
0
        public double OuterVolume(BoxProperties boxProperties, CaseOptimConstraintSet constraintSet)
        {
            Vector3D outerDim = OuterDimensions(boxProperties, constraintSet);

            return(outerDim.X * outerDim.Y * outerDim.Z);
        }
Example #34
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));
 }
Example #35
0
 /// <summary>
 /// Create a new pack
 /// </summary>
 /// <param name="name">Name</param>
 /// <param name="description">Description</param>
 /// <param name="box">Inner box</param>
 /// <param name="arrangement">Arrangement</param>
 /// <param name="axis">Axis</param>
 /// <param name="wrapper">Wrapper</param>
 /// <returns></returns>
 public PackProperties CreateNewPack(
     string name, string description
     , BoxProperties box
     , PackArrangement arrangement
     , HalfAxis.HAxis axis
     , PackWrapper wrapper)
 {
     // instantiate and initialize
     PackProperties packProperties = new PackProperties(this
         , box
         , arrangement
         , axis
         , wrapper);
     packProperties.Name = name;
     packProperties.Description = description;
     // insert in list
     _typeList.Add(packProperties);
     // notify listeners
     NotifyOnNewTypeCreated(packProperties);
     Modify();
     return packProperties;
 }
 internal BoxProperties ToBox(DataBox dtBox)
 {
     BoxProperties boxProperties = new BoxProperties(null
         , dtBox.Dimensions[0], dtBox.Dimensions[1], dtBox.Dimensions[2]);
     boxProperties.Name = dtBox.Name;
     boxProperties.Description = dtBox.Description;
     Color[] colors = new Color[6];
     for (int i = 0; i < 6; ++i) colors[i] = Color.Turquoise;
     boxProperties.SetAllColors(colors);
     boxProperties.ShowTape = false;
     boxProperties.Weight = dtBox.Weight;
     boxProperties.NetWeight = new OptDouble(dtBox.NetWeight > 0, dtBox.NetWeight);
     return boxProperties;
 }
Example #37
0
        public double InnerVolume(BoxProperties boxProperties)
        {
            Vector3D innerDim = InnerDimensions(boxProperties);

            return(innerDim.X * innerDim.Y * innerDim.Z);
        }
Example #38
0
 public double BoxWidth(BoxProperties boxProperties)
 {
     return(boxProperties.Dim(_dim1));
 }
 private void InsertPictogram(ref BoxProperties boxProperties)
 {
     string pictoPath = Properties.Settings.Default.pictoTOP;
     if (File.Exists(pictoPath))
     {
         // load image
         Bitmap bmp = new Bitmap(pictoPath);
         // case dimensions
         double length = boxProperties.Length;
         double width = boxProperties.Width;
         double height = boxProperties.Height;
         // dimensions and margins
         double margin = 2;
         double pictoSize = 10;
         double minDim = Math.Min(Math.Min(length, width), Math.Min(width, height));
         if (minDim < pictoSize) { margin = 0.0; pictoSize = minDim; }
         // top position
         double topPos = boxProperties.Height - margin - pictoSize;
         // insert picto as a texture
         boxProperties.AddTexture(HalfAxis.HAxis.AXIS_X_N
             , UnitsManager.ConvertLengthFrom(new Vector2D(width - margin - pictoSize, topPos), UnitsManager.UnitSystem.UNIT_METRIC2)
             , UnitsManager.ConvertLengthFrom(new Vector2D(pictoSize, pictoSize), UnitsManager.UnitSystem.UNIT_METRIC2)
             , 0, bmp);
         boxProperties.AddTexture(HalfAxis.HAxis.AXIS_X_P
             , UnitsManager.ConvertLengthFrom(new Vector2D(width - margin - pictoSize, topPos), UnitsManager.UnitSystem.UNIT_METRIC2)
             , UnitsManager.ConvertLengthFrom(new Vector2D(pictoSize, pictoSize), UnitsManager.UnitSystem.UNIT_METRIC2)
             , 0, bmp);
         boxProperties.AddTexture(HalfAxis.HAxis.AXIS_Y_N
             , UnitsManager.ConvertLengthFrom(new Vector2D(length - margin - pictoSize, topPos), UnitsManager.UnitSystem.UNIT_METRIC2)
             , UnitsManager.ConvertLengthFrom(new Vector2D(pictoSize, pictoSize), UnitsManager.UnitSystem.UNIT_METRIC2)
             , 0, bmp);
         boxProperties.AddTexture(HalfAxis.HAxis.AXIS_Y_P
             , UnitsManager.ConvertLengthFrom(new Vector2D(length - margin - pictoSize, topPos), UnitsManager.UnitSystem.UNIT_METRIC2)
             , UnitsManager.ConvertLengthFrom(new Vector2D(pictoSize, pictoSize), UnitsManager.UnitSystem.UNIT_METRIC2)
             , 0, bmp);
     }
 }
Example #40
0
 public double CaseEmptyWeight(BoxProperties boxProperties, CaseOptimConstraintSet constraintSet)
 {
     return(constraintSet.WallSurfaceMass * Area(boxProperties, constraintSet));
 }
Example #41
0
 public double TotalWeight(BoxProperties boxProperties, CaseOptimConstraintSet constraintSet)
 {
     return(InnerWeight(boxProperties) + EmptyWeight(boxProperties, constraintSet));
 }