protected override void OnLoad(EventArgs e) { base.OnLoad(e); // Graphics3DControl graphCtrl.DrawingContainer = this; // list of packs ComboBoxHelpers.FillCombo(Boxes.ToArray(), cbInnerBox, null != _packProperties ? _packProperties.Box : Boxes[0]); // arrangement if (null != _packProperties) { cbDir.SelectedIndex = (int)(_packProperties.BoxOrientation); Arrangement = _packProperties.Arrangement; Wrapper = _packProperties.Wrap; uCtrlOuterDimensions.Checked = _packProperties.HasForcedOuterDimensions; OuterDimensions = _packProperties.OuterDimensions; } else { cbDir.SelectedIndex = 5; // HalfAxis.HAxis.AXIS_Z_P Arrangement = new PackArrangement(3, 2, 1); Wrapper = new WrapperPolyethilene(0.1, 0.010, Color.LightGray, true); uCtrlThickness.Value = UnitsManager.ConvertLengthFrom(0.1, UnitsManager.UnitSystem.UNIT_METRIC1); uCtrlHeight.Value = UnitsManager.ConvertLengthFrom(40, UnitsManager.UnitSystem.UNIT_METRIC1); } // set StrapperSet ctrlStrapperSet.StrapperSet = StrapperSet; // disable Ok button UpdateStatus(string.Empty); }
/// <summary> /// Creates a new case analysis /// </summary> /// <returns>created case analysis</returns> public BoxCasePalletAnalysis CreateNewBoxCasePalletOptimizationUI() { FormNewCaseAnalysis form = new FormNewCaseAnalysis(this) { Boxes = Boxes.ToArray() }; if (DialogResult.OK == form.ShowDialog()) { BoxCasePalletConstraintSet constraintSet = new BoxCasePalletConstraintSet() { // aligned / alternate layers AllowAlignedLayers = form.AllowAlignedLayers, AllowAlternateLayers = form.AllowAlternateLayers }; // patterns foreach (string patternName in form.AllowedPatterns) { constraintSet.SetAllowedPattern(patternName); } // allowed axes constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_X_N, form.AllowVerticalX); constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_X_P, form.AllowVerticalX); constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Y_N, form.AllowVerticalY); constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Y_P, form.AllowVerticalY); constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Z_N, form.AllowVerticalZ); constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Z_P, form.AllowVerticalZ); // use maximum case weight constraintSet.UseMaximumCaseWeight = form.UseMaximumCaseWeight; constraintSet.MaximumCaseWeight = form.MaximumCaseWeight; // use maximum number of boxes constraintSet.UseMaximumNumberOfItems = form.UseMaximumNumberOfItems; constraintSet.MaximumNumberOfItems = form.MaximumNumberOfItems; // minimum number of items constraintSet.MinimumNumberOfItems = form.MinimumNumberOfItems; constraintSet.UseMinimumNumberOfItems = form.UseMinimumNumberOfItems; // number of solutions kept constraintSet.NumberOfSolutionsKept = form.NumberOfSolutionsKept; if (!constraintSet.IsValid) { MessageBox.Show(string.Format(Properties.Resources.ID_CASEANALYSIS_INVALIDCONSTRAINTSET)); return(null); // invalid constraint set -> exit } return(CreateNewBoxCasePalletOptimization( form.CaseAnalysisName , form.CaseAnalysisDescription , form.SelectedBox , constraintSet , form.PalletSolutionList , new BoxCasePalletSolver())); } return(null); }
/// <summary> /// Edit given box/case/pallet analysis /// </summary> /// <param name="caseAnalysis"></param> public void EditCaseAnalysis(BoxCasePalletAnalysis caseAnalysis) { // do we need to recompute analysis bool recomputeRequired = false; FormNewCaseAnalysis form = new FormNewCaseAnalysis(caseAnalysis.ParentDocument, caseAnalysis); form.Boxes = Boxes.ToArray(); if (recomputeRequired = (DialogResult.OK == form.ShowDialog())) { // analysis name / description caseAnalysis.Name = form.CaseAnalysisName; caseAnalysis.Description = form.CaseAnalysisDescription; // selected box caseAnalysis.BoxProperties = form.SelectedBox; // pallet solutions caseAnalysis.PalletSolutionsList = form.PalletSolutionList; // constraint set BoxCasePalletConstraintSet constraintSet = caseAnalysis.ConstraintSet; // aligned / alternate layers constraintSet.AllowAlignedLayers = form.AllowAlignedLayers; constraintSet.AllowAlternateLayers = form.AllowAlternateLayers; // patterns constraintSet.AllowedPatternString = form.AllowedPatternsString; // allowed axes constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_X_N, form.AllowVerticalX); constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_X_P, form.AllowVerticalX); constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Y_N, form.AllowVerticalY); constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Y_P, form.AllowVerticalY); constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Z_N, form.AllowVerticalZ); constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Z_P, form.AllowVerticalZ); // use maximum case weight constraintSet.UseMaximumCaseWeight = form.UseMaximumCaseWeight; constraintSet.MaximumCaseWeight = form.MaximumCaseWeight; // use maximum number of boxes constraintSet.UseMaximumNumberOfItems = form.UseMaximumNumberOfItems; constraintSet.MaximumNumberOfItems = form.MaximumNumberOfItems; // minimum number of items constraintSet.MinimumNumberOfItems = form.MinimumNumberOfItems; constraintSet.UseMinimumNumberOfItems = form.UseMinimumNumberOfItems; // number of solutions kept constraintSet.NumberOfSolutionsKept = form.NumberOfSolutionsKept; } if (recomputeRequired) { caseAnalysis.OnEndUpdate(null); } }