Exemple #1
0
        public HCylinderPalletAnalysis CreateNewHCylinderPalletAnalysisUI()
        {
            FormNewAnalysisHCylinder form = new FormNewAnalysisHCylinder(this);

            form.Cylinders = Cylinders.ToArray();
            form.Pallets   = Pallets.ToArray();

            if (DialogResult.OK == form.ShowDialog())
            {
                // build constraint set
                HCylinderPalletConstraintSet constraintSet = new HCylinderPalletConstraintSet();
                // stop criterion
                constraintSet.MaximumPalletHeight     = form.MaximumPalletHeight;
                constraintSet.UseMaximumPalletHeight  = form.UseMaximumPalletHeight;
                constraintSet.MaximumPalletWeight     = form.MaximumPalletWeight;
                constraintSet.UseMaximumPalletWeight  = form.UseMaximumPalletWeight;
                constraintSet.MaximumNumberOfItems    = form.MaximumNumberOfItems;
                constraintSet.UseMaximumNumberOfItems = form.UseMaximumNumberOfItems;
                constraintSet.SetAllowedPatterns(form.AllowPatternDefault, form.AllowPatternStaggered, form.AllowPatternColumn);
                constraintSet.RowSpacing = form.RowSpacing;

                return(CreateNewHCylinderPalletAnalysis(
                           form.AnalysisName, form.AnalysisDescription,
                           form.SelectedCylinder, form.SelectedPallet,
                           constraintSet,
                           new HCylinderSolver()));
            }
            return(null);
        }
        public void EditHCylinderPalletAnalysis(HCylinderPalletAnalysis analysis)
        {
            bool recomputeRequired        = false;
            FormNewAnalysisHCylinder form = new FormNewAnalysisHCylinder(this, analysis);

            form.Cylinders = Cylinders.ToArray();
            form.Pallets   = Pallets.ToArray();

            if (recomputeRequired = (DialogResult.OK == form.ShowDialog()))
            {
                analysis.CylinderProperties = form.SelectedCylinder;
                analysis.PalletProperties   = form.SelectedPallet;
                // analysis name / description
                analysis.ID.SetNameDesc(form.AnalysisName, form.AnalysisDescription);
                // constraint set
                HCylinderPalletConstraintSet constraintSet = analysis.ConstraintSet;
                // overhang / underhang
                constraintSet.OverhangX = form.OverhangX;
                constraintSet.OverhangY = form.OverhangY;
                // stop criterions
                constraintSet.MaximumPalletHeight     = form.MaximumPalletHeight;
                constraintSet.UseMaximumPalletHeight  = form.UseMaximumPalletHeight;
                constraintSet.MaximumPalletWeight     = form.MaximumPalletWeight;
                constraintSet.UseMaximumPalletWeight  = form.UseMaximumPalletWeight;
                constraintSet.MaximumNumberOfItems    = form.MaximumNumberOfItems;
                constraintSet.UseMaximumNumberOfItems = form.UseMaximumNumberOfItems;
                // allowed patterns
                constraintSet.SetAllowedPatterns(form.AllowPatternDefault, form.AllowPatternStaggered, form.AllowPatternColumn);
                constraintSet.RowSpacing = form.RowSpacing;
            }
            if (recomputeRequired)
            {
                analysis.OnEndUpdate(null);
            }
        }