public ILayer2D BuildLayer(Packable packable, Vector2D dimContainer, LayerDesc layerDesc, Vector2D actualDimensions, double minSpace) { ILayer2D layer = null; LayerPattern pattern = null; if (packable.IsBrick) { LayerDescBox layerDescBox = layerDesc as LayerDescBox; // instantiate layer layer = new Layer2D(packable.OuterDimensions, dimContainer, layerDescBox.PatternName, layerDescBox.AxisOrtho, layerDesc.Swapped) { ForcedSpace = minSpace }; // get layer pattern pattern = LayerPatternBox.GetByName(layerDesc.PatternName); } else if (packable.IsCylinder) { CylinderProperties cylProperties = packable as CylinderProperties; layer = new Layer2DCyl(cylProperties.RadiusOuter, cylProperties.Height, dimContainer, layerDesc.Swapped); // get layer pattern pattern = LayerPatternCyl.GetByName(layerDesc.PatternName); } else { throw new EngineException(string.Format("Unexpected packable {0} (Type = {1})", packable.Name, packable.GetType().ToString())); } pattern.GenerateLayer( layer , layer.Swapped ? actualDimensions.Y : actualDimensions.X , layer.Swapped ? actualDimensions.X : actualDimensions.Y ); return(layer); }
public AnalysisLayered BuildAnalysis(LayerDescBox layerDesc) { SolutionLayered.SetSolver(new LayerSolver()); AnalysisLayered analysis = new AnalysisCasePallet(Packable, PalletProperties, ConstraintSet); analysis.AddSolution(new List <LayerDesc>() { layerDesc }); return(analysis); }
public Layer2D BuildLayer(Vector3D dimBox, Vector2D dimContainer, LayerDescBox layerDesc, Vector2D actualDimensions) { // instantiate layer var layer = new Layer2D(dimBox, dimContainer, layerDesc.AxisOrtho, layerDesc.Swapped); // get layer pattern LayerPatternBox pattern = LayerPatternBox.GetByName(layerDesc.PatternName); // build layer pattern.GenerateLayer( layer , layer.Swapped ? actualDimensions.Y : actualDimensions.X , layer.Swapped ? actualDimensions.X : actualDimensions.Y); return(layer); }
/// <summary> /// Used to compute load dimension /// </summary> public bool GetDimensions(List <LayerDesc> layers, Packable packable, Vector2D dimContainer, double minSpace, out Vector2D actualDimensions) { actualDimensions = new Vector2D(); foreach (LayerDesc layerDesc in layers) { // dimensions double actualLength = 0.0, actualWidth = 0.0; if (packable.IsBrick) { LayerDescBox layerDescBox = layerDesc as LayerDescBox; // instantiate layer var layer = new Layer2D(packable.OuterDimensions, dimContainer, layerDescBox.PatternName, layerDescBox.AxisOrtho, layerDesc.Swapped) { ForcedSpace = minSpace }; // get layer pattern LayerPatternBox pattern = LayerPatternBox.GetByName(layerDesc.PatternName); // dimensions if (!pattern.GetLayerDimensionsChecked(layer, out actualLength, out actualWidth)) { _log.Error(string.Format("Failed to get layer dimension : {0}", pattern.Name)); break; } } else if (packable.IsCylinder) { CylinderProperties cylProp = packable as CylinderProperties; // instantiate layer var layer = new Layer2DCyl(cylProp.RadiusOuter, cylProp.Height, dimContainer, layerDesc.Swapped); // get layer pattern LayerPatternCyl pattern = LayerPatternCyl.GetByName(layerDesc.PatternName); // dimensions if (!pattern.GetLayerDimensions(layer, out actualLength, out actualWidth)) { _log.Error(string.Format("Failed to get layer dimension : {0}", pattern.Name)); break; } } else { throw new EngineException(string.Format("Unexpected packable {0} (Type = {1})", packable.Name, packable.GetType().ToString())); } actualDimensions.X = Math.Max(actualDimensions.X, layerDesc.Swapped ? actualWidth : actualLength); actualDimensions.Y = Math.Max(actualDimensions.Y, layerDesc.Swapped ? actualLength : actualWidth); } return(true); }
public ILayer2D BuildLayer(Packable packable, Vector2D dimContainer, LayerDesc layerDesc, double minSpace) { ILayer2D layer = null; if (packable.IsBrick) { // casts LayerDescBox layerDescBox = layerDesc as LayerDescBox; // layer instantiation layer = new Layer2D(packable.OuterDimensions, dimContainer, layerDesc.PatternName, layerDescBox.AxisOrtho, layerDesc.Swapped) { ForcedSpace = minSpace }; // get layer pattern LayerPatternBox pattern = LayerPatternBox.GetByName(layerDesc.PatternName); // dimensions if (!pattern.GetLayerDimensionsChecked(layer as Layer2D, out double actualLength, out double actualWidth)) { return(null); } pattern.GenerateLayer( layer as Layer2D , actualLength , actualWidth); return(layer); } else if (packable.IsCylinder) { // casts CylinderProperties cylProperties = packable as CylinderProperties; // layer instantiation layer = new Layer2DCyl(cylProperties.RadiusOuter, cylProperties.Height, dimContainer, layerDesc.Swapped); // get layer pattern LayerPatternCyl pattern = LayerPatternCyl.GetByName(layerDesc.PatternName); double actualLength = 0.0, actualWidth = 0.0; if (!pattern.GetLayerDimensions(layer as Layer2DCyl, out actualLength, out actualWidth)) { return(null); } pattern.GenerateLayer(layer as Layer2DCyl, actualLength, actualWidth); } else { throw new EngineException(string.Format("Unexpected packable {0} (Type = {1})", packable.Name, packable.GetType().ToString())); } return(layer); }
public Layer2D BuildLayer(Vector3D dimBox, Vector2D dimContainer, LayerDescBox layerDesc) { LayerDescBox layerDescBox = layerDesc as LayerDescBox; // instantiate layer var layer = new Layer2D(dimBox, dimContainer, layerDescBox.AxisOrtho, layerDesc.Swapped); // get layer pattern LayerPatternBox pattern = LayerPatternBox.GetByName(layerDesc.PatternName); // dimensions double actualLength = 0.0, actualWidth = 0.0; if (!pattern.GetLayerDimensionsChecked(layer, out actualLength, out actualWidth)) { return(null); } pattern.GenerateLayer( layer , actualLength , actualWidth); return(layer); }
public Layer2DBrickImp BuildLayer(Vector3D dimBox, Vector2D dimContainer, LayerDescBox layerDesc, double minSpace) { LayerDescBox layerDescBox = layerDesc as LayerDescBox; // instantiate layer var layer = new Layer2DBrickImp(dimBox, dimContainer, layerDescBox.PatternName, layerDescBox.AxisOrtho, layerDesc.Swapped) { ForcedSpace = minSpace }; // get layer pattern LayerPatternBox pattern = LayerPatternBox.GetByName(layerDesc.PatternName); // dimensions if (!pattern.GetLayerDimensionsChecked(layer, out double actualLength, out double actualWidth)) { return(null); } pattern.GenerateLayer( layer , actualLength , actualWidth); return(layer); }
public DCSBSolution SB_GetSolution(DCSBCase sbCase, DCSBPallet sbPallet, DCSBInterlayer sbInterlayer, DCSBConstraintSet sbConstraintSet, string sLayerDesc, DCCompFormat expectedFormat, bool showCotations ) { List <string> lErrors = new List <string>(); BoxProperties boxProperties = new BoxProperties(null, sbCase.DimensionsOuter.M0, sbCase.DimensionsOuter.M1, sbCase.DimensionsOuter.M2) { InsideLength = null != sbCase.DimensionsInner ? sbCase.DimensionsInner.M0 : 0.0, InsideWidth = null != sbCase.DimensionsInner ? sbCase.DimensionsInner.M1 : 0.0, InsideHeight = null != sbCase.DimensionsInner ? sbCase.DimensionsInner.M2 : 0.0, TapeColor = Color.FromArgb(sbCase.TapeColor), TapeWidth = new OptDouble(sbCase.TapeWidth != 0.0, sbCase.TapeWidth) }; boxProperties.SetWeight(sbCase.Weight); boxProperties.SetNetWeight(new OptDouble(sbCase.NetWeight.HasValue, sbCase.NetWeight.Value)); if (null != sbCase.Colors && sbCase.Colors.Length >= 6) { for (int i = 0; i < 6; ++i) { boxProperties.SetColor((HalfAxis.HAxis)i, Color.FromArgb(sbCase.Colors[i])); } } else { boxProperties.SetAllColors(Enumerable.Repeat(Color.Chocolate, 6).ToArray()); } PalletProperties palletProperties; if (null != sbPallet.Dimensions) { palletProperties = new PalletProperties(null, sbPallet.PalletType, sbPallet.Dimensions.M0, sbPallet.Dimensions.M1, sbPallet.Dimensions.M2) { Weight = sbPallet.Weight, Color = Color.FromArgb(sbPallet.Color) } } ; else { palletProperties = new PalletProperties(null, "EUR2", 1200.0, 1000.0, 150.0); } InterlayerProperties interlayerProperties = null; if (null != sbInterlayer) { interlayerProperties = new InterlayerProperties(null, sbInterlayer.Name, sbInterlayer.Description, sbInterlayer.Dimensions.M0, sbInterlayer.Dimensions.M1, sbInterlayer.Dimensions.M2, sbInterlayer.Weight, Color.FromArgb(sbInterlayer.Color)); } OptDouble oMaxWeight = null != sbConstraintSet.MaxWeight ? new OptDouble(sbConstraintSet.MaxWeight.Active, sbConstraintSet.MaxWeight.Value_d) : OptDouble.Zero; OptDouble oMaxHeight = null != sbConstraintSet.MaxHeight ? new OptDouble(sbConstraintSet.MaxHeight.Active, sbConstraintSet.MaxHeight.Value_d) : OptDouble.Zero; OptInt oMaxNumber = null != sbConstraintSet.MaxNumber ? new OptInt(sbConstraintSet.MaxNumber.Active, sbConstraintSet.MaxNumber.Value_i) : OptInt.Zero; ConstraintSetCasePallet constraintSet = new ConstraintSetCasePallet() { Overhang = new Vector2D(sbConstraintSet.Overhang.M0, sbConstraintSet.Overhang.M1), OptMaxWeight = oMaxWeight, OptMaxNumber = oMaxNumber }; constraintSet.SetMaxHeight(oMaxHeight); constraintSet.SetAllowedOrientations(new bool[] { sbConstraintSet.Orientation.X, sbConstraintSet.Orientation.Y, sbConstraintSet.Orientation.Z }); if (!constraintSet.Valid) { throw new Exception("Invalid constraint set"); } LayerDesc layerDesc = LayerDescBox.Parse(sLayerDesc); Vector3D cameraPosition = Graphics3D.Corner_0; int layerCount = 0, caseCount = 0, interlayerCount = 0; double weightTotal = 0.0, weightLoad = 0.0, volumeEfficiency = 0.0; double? weightEfficiency = 0.0; double? weightNet = null; Vector3D bbLoad = new Vector3D(); Vector3D bbGlob = new Vector3D(); string palletMapPhrase = string.Empty; byte[] imageBytes = null; string[] errors = null; string[] listLayerDesc = new string[] { layerDesc.ToString() }; StackBuilderProcessor.GetSolutionByLayer( boxProperties, palletProperties, interlayerProperties, constraintSet, layerDesc, cameraPosition, true, 0.03f, new Size(expectedFormat.Size.CX, expectedFormat.Size.CY), ref layerCount, ref caseCount, ref interlayerCount, ref weightTotal, ref weightLoad, ref weightNet, ref bbLoad, ref bbGlob, ref volumeEfficiency, ref weightEfficiency, ref palletMapPhrase, ref imageBytes, ref errors ); return(new DCSBSolution() { LayerCount = layerCount, CaseCount = caseCount, InterlayerCount = interlayerCount, WeightLoad = weightLoad, WeightTotal = weightTotal, NetWeight = weightNet, BBoxLoad = new DCSBDim3D(bbLoad.X, bbLoad.Y, bbLoad.Z), BBoxTotal = new DCSBDim3D(bbGlob.X, bbGlob.Y, bbGlob.Z), Efficiency = volumeEfficiency, OutFile = null, LayerDescs = listLayerDesc, PalletMapPhrase = palletMapPhrase, Errors = lErrors.ToArray() }); }
public Layer2DBrickImp BuildLayer(Vector3D dimBox, Vector3D bulge, Vector2D dimContainer, LayerDescBox layerDesc, Vector2D actualDimensions, double minSpace) { // instantiate layer var layer = new Layer2DBrickImp(dimBox, bulge, dimContainer, layerDesc.PatternName, layerDesc.AxisOrtho, layerDesc.Swapped) { ForcedSpace = minSpace }; // get layer pattern LayerPatternBox pattern = LayerPatternBox.GetByName(layerDesc.PatternName); // build layer pattern.GenerateLayer( layer , layer.Swapped ? actualDimensions.Y : actualDimensions.X , layer.Swapped ? actualDimensions.X : actualDimensions.Y); return(layer); }