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); } // disable Ok button UpdateStatus(string.Empty); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); // Graphics3DControl graphCtrl.DrawingContainer = this; // list of packs cbInnerPackable.Initialize(_document, this, PackProp?.Content); // arrangement if (null != PackProp) { cbDir.SelectedIndex = (int)(PackProp.BoxOrientation); RevSolidLayout = PackProp.RevSolidLayout; Arrangement = PackProp.Arrangement; Wrapper = PackProp.Wrap; Tray = PackProp.Tray; uCtrlOuterDimensions.Checked = PackProp.HasForcedOuterDimensions; OuterDimensions = PackProp.OuterDimensions; Bulge = PackProp.Bulge; } else { cbDir.SelectedIndex = 5; // HalfAxis.HAxis.AXIS_Z_P RevSolidLayout = PackProperties.EnuRevSolidLayout.ALIGNED; Arrangement = new PackArrangement(3, 2, 1); Wrapper = new WrapperPolyethilene(0.1, 0.010, Color.LightGray) { }; Tray = new PackTray(UnitsManager.ConvertLengthFrom(40, UnitsManager.UnitSystem.UNIT_METRIC1), 0.050, Color.Chocolate) { UnitThickness = UnitsManager.ConvertLengthFrom(1.0, UnitsManager.UnitSystem.UNIT_METRIC1) }; } // set StrapperSet ctrlStrapperSet.StrapperSet = StrapperSet; // disable Ok button UpdateStatus(string.Empty); }
private bool GenerateProject(out Document doc, out CasePalletAnalysis analysis, out CasePalletSolution casePalletSolution) { doc = null; analysis = null; casePalletSolution = null; try { // build solution doc = new Document( _boxName, string.Format(Properties.Resources.ID_OPTDOCUMENTDESCRIPTION, _boxName), string.Empty, DateTime.Now, null); // box BoxProperties boxProperties = doc.CreateNewBox(SelectedBox); // pallet PalletProperties palletProperties = doc.CreateNewPallet(SelectedPallet); // get selected caseOptimSolution CaseOptimSolution sol = SelectedSolution; PackArrangement arrangement = sol.CaseDefinition.Arrangement; // build new case name string arrangName = string.Format("{0}_{1}x{2}x{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( Properties.Resources.ID_OPTCASEDESCRIPTION , boxProperties.Name , palletProperties.Name); // add new case CaseOfBoxesProperties caseProperties = doc.CreateNewCaseOfBoxes( arrangName, description , boxProperties , sol.CaseDefinition , BuildCaseOptimConstraintSet()); // set color caseProperties.SetColor(Color.Chocolate); // add new pallet analysis string analysisName = string.Format( Properties.Resources.ID_OPTANALYSISNAME , boxProperties.Name , boxProperties.Name , arrangement._iLength , arrangement._iWidth , arrangement._iHeight , sol.CaseDefinition.Dim0 , sol.CaseDefinition.Dim1); string analysisDescription = string.Format( Properties.Resources.ID_OPTANALYSISDESCRIPTION , boxProperties.Name , palletProperties.Name); List <CasePalletSolution> palletSolutionList = new List <CasePalletSolution>(); palletSolutionList.Add(sol.PalletSolution); analysis = doc.CreateNewCasePalletAnalysis( analysisName , analysisDescription , caseProperties , palletProperties , null , null , null , null , null , BuildPalletConstraintSet() , palletSolutionList); } catch (Exception ex) { _log.Error(ex.ToString()); return(false); } return(true); }
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()); } }
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()); } }
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()); } }