private static BundleProperties LoadBundleById(Document doc, List <bundle> listBundles, string sid) { bundle bundleItem = listBundles.Find(delegate(bundle b) { return(b.id == sid); }); if (null == bundleItem) { return(null); } else { double[] bundleDim = bundleItem.flatDimensions.ToArray(); // instantiate bundle BundleProperties bundleProperties = new BundleProperties( doc, bundleItem.name, bundleItem.description , bundleDim[0], bundleDim[1], bundleDim[2] , bundleItem.flatWeight, (int)bundleItem.numberFlats , System.Drawing.Color.FromArgb((int)bundleItem.color[0], (int)bundleItem.color[1], (int)bundleItem.color[2])); // insert in list if (null != doc) { doc.AddType(bundleProperties); } return(bundleProperties); } }
public Box(uint pickId, Packable packable, LayerPosition bPosition) { if (!bPosition.IsValid) { throw new GraphicsException("Invalid BoxPosition: can not create box"); } _pickId = pickId; _dim[0] = packable.Length; _dim[1] = packable.Width; _dim[2] = packable.Height; // set position Position = bPosition.Position; // set direction length LengthAxis = HalfAxis.ToVector3D(bPosition.LengthAxis); // set direction width WidthAxis = HalfAxis.ToVector3D(bPosition.WidthAxis); _colors = Enumerable.Repeat <Color>(Color.Chocolate, 6).ToArray(); BProperties bProperties = packable as BProperties; if (null != bProperties) { _colors = bProperties.Colors; BoxProperties boxProperties = packable as BoxProperties; if (null != boxProperties) { List <Pair <HalfAxis.HAxis, Texture> > textures = boxProperties.TextureList; foreach (Pair <HalfAxis.HAxis, Texture> tex in textures) { int iIndex = (int)tex.first; if (null == _textureLists[iIndex]) { _textureLists[iIndex] = new List <Texture>(); } _textureLists[iIndex].Add(tex.second); } _showTape = boxProperties.ShowTape; _tapeWidth = boxProperties.TapeWidth; _tapeColor = boxProperties.TapeColor; } // IsBundle ? _isBundle = bProperties.IsBundle; if (bProperties.IsBundle) { BundleProperties bundleProp = packable as BundleProperties; if (null != bundleProp) { _noFlats = bundleProp.NoFlats; } } } PackProperties packProperties = packable as PackProperties; if (null != packProperties) { } }
public Box(uint pickId, BundleProperties bundleProperties) : base(pickId, bundleProperties.Length, bundleProperties.Width, bundleProperties.Height, BoxPosition.Zero) { // colors Colors = Enumerable.Repeat(bundleProperties.Color, 6).ToArray(); // specific BundleFlats = bundleProperties.NoFlats; IsBundle = bundleProperties.IsBundle; }
public void Draw(Graphics3DControl ctrl, Graphics3D graphics) { BundleProperties bundleProperties = new BundleProperties( null, BundleName, Description , BundleLength, BundleWidth, UnitThickness, UnitWeight, NoFlats, Color); Box box = new Box(0, bundleProperties); graphics.AddBox(box); graphics.AddDimensions(new DimensionCube(BundleLength, BundleWidth, UnitThickness * NoFlats)); }
public Box(uint pickId, PackableBrick packable, LayerPosition bPosition) { // sanity checks CheckPosition(bPosition); // dimensions PickId = pickId; _dim[0] = packable.Length; _dim[1] = packable.Width; _dim[2] = packable.Height; // weight _weight = packable.Weight; // set position BoxPosition = new BoxPosition(bPosition.Position, bPosition.LengthAxis, bPosition.WidthAxis); // colors Colors = Enumerable.Repeat <Color>(Color.Chocolate, 6).ToArray(); BProperties bProperties = PackableToBProperties(packable); if (null != bProperties) { Colors = bProperties.Colors; if (bProperties is BoxProperties boxProperties) { List <Pair <HalfAxis.HAxis, Texture> > textures = boxProperties.TextureList; foreach (Pair <HalfAxis.HAxis, Texture> tex in textures) { int iIndex = (int)tex.first; if (null == TextureLists[iIndex]) { TextureLists[iIndex] = new List <Texture>(); } TextureLists[iIndex].Add(tex.second); } TapeWidth = boxProperties.TapeWidth; TapeColor = boxProperties.TapeColor; _showTopLabel = boxProperties.ShowTopLabel; } // IsBundle ? IsBundle = bProperties.IsBundle; if (bProperties.IsBundle) { BundleProperties bundleProp = packable as BundleProperties; if (null != bundleProp) { BundleFlats = bundleProp.NoFlats; } } } if (packable is PackProperties packProperties) { } }
public Box(uint pickId, PackableBrick packable, BoxPosition bPosition) { // sanity checks CheckPosition(bPosition); // dimensions _pickId = pickId; _dim[0] = packable.Length; _dim[1] = packable.Width; _dim[2] = packable.Height; // set position _boxPosition = bPosition; // colors _colors = Enumerable.Repeat <Color>(Color.Chocolate, 6).ToArray(); BProperties bProperties = PackableToBProperties(packable); if (null == bProperties) { throw new Exception(string.Format("Type {0} cannot be handled by Box constructor", packable.GetType().ToString())); } _colors = bProperties.Colors; _isBundle = bProperties.IsBundle; // is box ? BoxProperties boxProperties = bProperties as BoxProperties; if (null != boxProperties) { List <Pair <HalfAxis.HAxis, Texture> > textures = boxProperties.TextureList; foreach (Pair <HalfAxis.HAxis, Texture> tex in textures) { int iIndex = (int)tex.first; if (null == _textureLists[iIndex]) { _textureLists[iIndex] = new List <Texture>(); } _textureLists[iIndex].Add(tex.second); } _showTape = boxProperties.ShowTape; _tapeWidth = boxProperties.TapeWidth; _tapeColor = boxProperties.TapeColor; } // is bundle ? else if (bProperties.IsBundle) { BundleProperties bundleProp = bProperties as BundleProperties; if (null != bundleProp) { _noFlats = bundleProp.NoFlats; } } }
public Box(uint pickId, BundleProperties bundleProperties) { // dimensions _pickId = pickId; _dim[0] = bundleProperties.Length; _dim[1] = bundleProperties.Width; _dim[2] = bundleProperties.Height; // colors _colors = Enumerable.Repeat <Color>(bundleProperties.Color, 6).ToArray(); // specific _noFlats = bundleProperties.NoFlats; _isBundle = bundleProperties.IsBundle; }
public Box(uint pickId, BProperties bProperties, BoxPosition bPosition) { if (!bPosition.IsValid) { throw new GraphicsException("Invalid BoxPosition: can not create box"); } _pickId = pickId; _dim[0] = bProperties.Length; _dim[1] = bProperties.Width; _dim[2] = bProperties.Height; _colors = bProperties.Colors; BoxProperties boxProperties = bProperties as BoxProperties; if (null != boxProperties) { List <Pair <HalfAxis.HAxis, Texture> > textures = boxProperties.TextureList; foreach (Pair <HalfAxis.HAxis, Texture> tex in textures) { int iIndex = (int)tex.first; if (null == _textureLists[iIndex]) { _textureLists[iIndex] = new List <Texture>(); } _textureLists[iIndex].Add(tex.second); } _showTape = boxProperties.ShowTape; _tapeWidth = boxProperties.TapeWidth; _tapeColor = boxProperties.TapeColor; } // set position Position = bPosition.Position; // set direction length LengthAxis = HalfAxis.ToVector3D(bPosition.DirectionLength); // set direction width WidthAxis = HalfAxis.ToVector3D(bPosition.DirectionWidth); // IsBundle ? _isBundle = bProperties.IsBundle; if (bProperties.IsBundle) { BundleProperties bundleProp = bProperties as BundleProperties; if (null != bundleProp) { _noFlats = bundleProp.NoFlats; } } }
public Box(uint pickId, BundleProperties bundleProperties) { // dimensions _pickId = pickId; _dim[0] = bundleProperties.Length; _dim[1] = bundleProperties.Width; _dim[2] = bundleProperties.Height; // box position _boxPosition = new BoxPosition(Vector3D.Zero, HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Y_P); // colors _colors = Enumerable.Repeat <Color>(bundleProperties.Color, 6).ToArray(); // specific _noFlats = bundleProperties.NoFlats; _isBundle = bundleProperties.IsBundle; }
public Box(uint pickId, BundleProperties bundleProperties) { _pickId = pickId; _isBundle = true; _dim[0] = bundleProperties.Length; _dim[1] = bundleProperties.Width; _dim[2] = bundleProperties.Height; _colors = new Color[6]; for (int i = 0; i < 6; ++i) { _colors[i] = bundleProperties.Color; } _noFlats = bundleProperties.NoFlats; // IsBundle ? _isBundle = bundleProperties.IsBundle; }
public FormNewBundle(Document document, BundleProperties bundleProperties) : base(document, bundleProperties) { InitializeComponent(); // set unit labels UnitsManager.AdaptUnitLabels(this); // set caption text Text = string.Format(Properties.Resources.ID_EDIT, bundleProperties.Name); // initialize value tbName.Text = bundleProperties.Name; tbDescription.Text = bundleProperties.Description; BundleLength = bundleProperties.Length; BundleWidth = bundleProperties.Width; UnitThickness = bundleProperties.UnitThickness; UnitWeight = bundleProperties.UnitWeight; NoFlats = bundleProperties.NoFlats; // enable/disable Ok buttons UpdateStatus(string.Empty); }
protected void Compute() { try { const double thickness = 4.0; _doc = new Document(_name, "", "", DateTime.Now, null); // colors Color[] colors = new Color[6]; for (int i = 0; i < 6; ++i) { colors[i] = Color.Chocolate; } // bundle BundleProperties bundleProperties = _doc.CreateNewBundle(_name, _name, BundleLength, BundleWidth, FlatThickness, FlatWeight, Color.Beige, NoFlats); // case BoxProperties caseProperties = _doc.CreateNewCase(_name, _name , CaseInsideLength + 2.0 * thickness, CaseInsideWidth + 2.0 * thickness, CaseInsideHeight + 2.0 * thickness , CaseInsideLength, CaseInsideWidth, CaseInsideHeight , CaseWeight, colors); // constraint set BundleCaseConstraintSet constraintSet = new BundleCaseConstraintSet(); // maximum case weight constraintSet.UseMaximumCaseWeight = false; constraintSet.MaximumCaseWeight = 0.0; // maximum number of items constraintSet.UseMaximumNumberOfBoxes = false; constraintSet.MaximumNumberOfBoxes = 0; _analysis = _doc.CreateNewBoxCaseAnalysis( _name, _name , bundleProperties, caseProperties , constraintSet , new BoxCaseSolver()); // fill grid FillGrid(); } catch (Exception ex) { _log.Error(ex.ToString()); } }
private void Compute() { try { _document = new Document(_name, _name, "", DateTime.Now, null); _analysis = null; // bundle BundleProperties bundleProperties = _document.CreateNewBundle(_name, _name, FlatLength, FlatWidth, FlatThickness, FlatWeight, Color.Beige, NoFlats); // pallet PalletProperties palletProp = _document.CreateNewPallet(CurrentPallet); // constraint set BundlePalletConstraintSet constraintSet = new BundlePalletConstraintSet(); constraintSet.OverhangX = 0.0; constraintSet.OverhangY = 0.0; constraintSet.UseMaximumNumberOfCases = false; constraintSet.UseMaximumPalletWeight = false; constraintSet.UseMaximumWeightOnBox = false; constraintSet.UseMaximumHeight = true; constraintSet.MaximumHeight = MaximumPalletHeight; constraintSet.AllowAlignedLayers = true; constraintSet.AllowAlternateLayers = true; constraintSet.AllowedPatternString = "Column,Diagonale,Interlocked,Trilock,Spirale"; _analysis = _document.CreateNewCasePalletAnalysis( _name, _name , bundleProperties, palletProp , null /*interlayer */, null /* interlayerAntiSlip */ , null /* palletCorners */, null /*palletCap */, null /* palletFilm */ , constraintSet , new treeDiM.StackBuilder.Engine.LayerSolver() ); // fill grid FillGrid(); } catch (Exception ex) { _log.Error(ex.ToString()); } }
public DCSBSolution SB_GetBundleCaseBestSolution( DCSBBundle sbBundle, DCSBCase sbCase , DCSBConstraintSet sbConstraintSet , DCCompFormat expectedFormat, bool showCotations) { List <string> lErrors = new List <string>(); try { BundleProperties bundleProperties = new BundleProperties(null , sbBundle.Name, sbBundle.Description , sbBundle.DimensionsUnit.M0, sbBundle.DimensionsUnit.M1, sbBundle.DimensionsUnit.M2 , sbBundle.UnitWeight, sbBundle.Number , Color.FromArgb(sbBundle.Color)); BoxProperties caseProperties = new BoxProperties(null) { 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) }; caseProperties.SetWeight(sbCase.Weight); if (null != sbCase.Colors && sbCase.Colors.Length >= 6) { for (int i = 0; i < 6; ++i) { caseProperties.SetColor((HalfAxis.HAxis)i, Color.FromArgb(sbCase.Colors[i])); } } else { caseProperties.SetAllColors(Enumerable.Repeat <Color>(Color.Chocolate, 6).ToArray()); } OptDouble oMaxWeight = null != sbConstraintSet.MaxWeight ? new OptDouble(sbConstraintSet.MaxWeight.Active, sbConstraintSet.MaxWeight.Value_d) : OptDouble.Zero; OptInt oMaxNumber = null != sbConstraintSet.MaxNumber ? new OptInt(sbConstraintSet.MaxNumber.Active, sbConstraintSet.MaxNumber.Value_i) : OptInt.Zero; ConstraintSetBoxCase constraintSet = new ConstraintSetBoxCase(caseProperties) { OptMaxWeight = oMaxWeight, OptMaxNumber = oMaxNumber }; if (!constraintSet.Valid) { throw new Exception("Invalid constraint set"); } constraintSet.SetAllowedOrientations(new bool[] { false, false, true }); 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 = (double?)null; Vector3D bbLoad = new Vector3D(); Vector3D bbGlob = new Vector3D(); byte[] imageBytes = null; string[] errors = null; if (StackBuilderProcessor.GetBestSolution( bundleProperties, caseProperties, null, constraintSet, false, cameraPosition, showCotations, 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 imageBytes, ref errors)) { foreach (string err in errors) { lErrors.Add(err); } 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 = new DCCompFileOutput() { Bytes = imageBytes, Format = new DCCompFormat() { Format = EOutFormat.IMAGE, Size = new DCCompSize() { CX = expectedFormat.Size.CX, CY = expectedFormat.Size.CY } } }, Errors = lErrors.ToArray() }); } } catch (Exception ex) { lErrors.Add(ex.Message); _log.Error(ex.ToString()); } return(new DCSBSolution() { Errors = lErrors.ToArray() }); }
public DCSBSolution SB_GetBundlePalletBestSolution( DCSBBundle sbBundle, DCSBPallet sbPallet, DCSBInterlayer sbInterlayer , DCSBConstraintSet sbConstraintSet , DCCompFormat expectedFormat, bool showCotations) { List <string> lErrors = new List <string>(); try { BundleProperties bundleProperties = new BundleProperties(null , sbBundle.Name, sbBundle.Description , sbBundle.DimensionsUnit.M0, sbBundle.DimensionsUnit.M1, sbBundle.DimensionsUnit.M2 , sbBundle.UnitWeight, sbBundle.Number , Color.FromArgb(sbBundle.Color)); PalletProperties palletProperties = null; 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() { OptMaxWeight = oMaxWeight, OptMaxNumber = oMaxNumber }; constraintSet.SetMaxHeight(oMaxHeight); constraintSet.SetAllowedOrientations(new bool[] { false, false, true }); if (!constraintSet.Valid) { throw new Exception("Invalid constraint set"); } 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 = (double?)null; Vector3D bbLoad = new Vector3D(); Vector3D bbGlob = new Vector3D(); byte[] imageBytes = null; string[] errors = null; string palletMapPhrase = string.Empty; if (StackBuilderProcessor.GetBestSolution( bundleProperties, palletProperties, interlayerProperties, constraintSet, false, cameraPosition, showCotations, 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)) { foreach (string err in errors) { lErrors.Add(err); } 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 = new DCCompFileOutput() { Bytes = imageBytes, Format = new DCCompFormat() { Format = EOutFormat.IMAGE, Size = new DCCompSize() { CX = expectedFormat.Size.CX, CY = expectedFormat.Size.CY } } }, Errors = lErrors.ToArray() }); } } catch (Exception ex) { lErrors.Add(ex.Message); _log.Error(ex.ToString()); } return(new DCSBSolution() { Errors = lErrors.ToArray() }); }
private CasePalletAnalysis LoadPalletAnalysis(Document doc, string sid) { CasePalletAnalysis analysis = null; palletAnalysis xmlAnalysis = _root.data.analyses.palletAnalysis.Find(delegate(palletAnalysis pa) { return(pa.id == sid); }); if (null == xmlAnalysis) { throw new XmlFileProcessorException(string.Format("Failed to load analysis with Id = {0}", xmlAnalysis.id)); } BoxProperties caseProperties = LoadCaseById(doc, _root.data.items.library_cases, xmlAnalysis.caseId); BundleProperties bundleProperties = LoadBundleById(doc, _root.data.items.library_bundles, xmlAnalysis.bundleId); BProperties bProperties; PalletConstraintSet constraintSet; if (null != caseProperties) { CasePalletConstraintSet caseConstraintSet = new CasePalletConstraintSet(); // interlayer caseConstraintSet.HasInterlayer = xmlAnalysis.interlayerPeriodSpecified; caseConstraintSet.HasInterlayerAntiSlip = false; // allowed ortho axes caseConstraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_X_N, true); caseConstraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_X_P, true); caseConstraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Y_N, true); caseConstraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Y_P, true); caseConstraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Z_N, true); caseConstraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Z_P, true); // interlayer period caseConstraintSet.InterlayerPeriod = xmlAnalysis.interlayerPeriodSpecified ? (int)xmlAnalysis.interlayerPeriod : 1; bProperties = caseProperties; constraintSet = caseConstraintSet; } else if (null != bundleProperties) { BundlePalletConstraintSet bundleConstraintSet = new BundlePalletConstraintSet(); bProperties = bundleProperties; constraintSet = bundleConstraintSet; } else { throw new XmlFileProcessorException(string.Format("Failed to load analysis with Id = {0}", xmlAnalysis.id)); } // generic constraintSet properties // allow aligned / alternate layers constraintSet.AllowAlignedLayers = false; constraintSet.AllowAlternateLayers = false; foreach (layerArrangement layerArr in xmlAnalysis.allowedLayerArrangements) { if (layerArr == layerArrangement.ALIGNED) { constraintSet.AllowAlignedLayers = true; } if (layerArr == layerArrangement.ROTATED180 | layerArr == layerArrangement.ROTATED90) { constraintSet.AllowAlternateLayers = true; } } // allowed patterns foreach (patternName pName in xmlAnalysis.allowedLayerPatterns) { switch (pName) { case patternName.COLUMN: constraintSet.SetAllowedPattern("Column"); break; case patternName.DIAGONAL: constraintSet.SetAllowedPattern("Diagonal"); break; case patternName.INTERLOCK: constraintSet.SetAllowedPattern("Interlock"); break; case patternName.TRILOCK: constraintSet.SetAllowedPattern("Trilock"); break; case patternName.SPIRAL: constraintSet.SetAllowedPattern("Spiral"); break; case patternName.ENLARGED_SPIRAL: constraintSet.SetAllowedPattern("Enlarged spiral"); break; default: break; } } // overhang constraintSet.OverhangX = xmlAnalysis.overhang[0]; constraintSet.OverhangY = xmlAnalysis.overhang[1]; // stop criterions // max height if (xmlAnalysis.stackingStopCriterions.stopMaxHeight.maxHeightSpecified) { constraintSet.UseMaximumHeight = true; constraintSet.MaximumHeight = xmlAnalysis.stackingStopCriterions.stopMaxHeight.maxHeight; } else { constraintSet.UseMaximumHeight = false; } // max weight if (xmlAnalysis.stackingStopCriterions.stopMaxWeight.maxWeightSpecified) { constraintSet.UseMaximumPalletWeight = true; constraintSet.MaximumPalletWeight = xmlAnalysis.stackingStopCriterions.stopMaxWeight.maxWeight; } else { constraintSet.UseMaximumPalletWeight = false; } // max number of box/bundle if (xmlAnalysis.stackingStopCriterions.stopMaxNumber.maxNumberSpecified) { constraintSet.UseMaximumNumberOfCases = true; constraintSet.MaximumNumberOfItems = (int)xmlAnalysis.stackingStopCriterions.stopMaxNumber.maxNumber; } else { constraintSet.UseMaximumNumberOfCases = false; } // max weight on case if (xmlAnalysis.stackingStopCriterions.stopMaxWeightOnCase.maxWeightOnCaseSpecified) { constraintSet.UseMaximumWeightOnBox = true; constraintSet.MaximumWeightOnBox = xmlAnalysis.stackingStopCriterions.stopMaxWeightOnCase.maxWeightOnCase; } else { constraintSet.UseMaximumWeightOnBox = false; } if (null != doc) { analysis = doc.CreateNewCasePalletAnalysis(xmlAnalysis.name, xmlAnalysis.description , bProperties , LoadPalletById(doc, _root.data.items.library_pallets, xmlAnalysis.palletId) , LoadInterlayerById(doc, _root.data.items.library_interlayers, xmlAnalysis.interlayerId) , LoadInterlayerById(doc, _root.data.items.library_interlayers, xmlAnalysis.interlayerAntiSlipId) , null , null , null , constraintSet , new treeDiM.StackBuilder.Engine.CasePalletSolver()); } else { // instantiate pallet analysis analysis = new CasePalletAnalysis( bProperties , LoadPalletById(null, _root.data.items.library_pallets, xmlAnalysis.palletId) , LoadInterlayerById(null, _root.data.items.library_interlayers, xmlAnalysis.interlayerId) , null , null , null , null , constraintSet); // name analysis.Name = xmlAnalysis.name; // description analysis.Description = xmlAnalysis.description; } return(analysis); }
private void ProcessViewItem(viewItem vItem) { Graphics3DImage graphics = InitializeImageFromViewParameters(vItem.viewParameters); // load case BoxProperties bProperties = LoadCaseById(null, _root.data.items.library_cases, vItem.itemId); if (null != bProperties) { graphics.AddBox(new Box(0, bProperties)); if (vItem.viewParameters.showDimensions) { graphics.AddDimensions(new DimensionCube(bProperties.Length, bProperties.Width, bProperties.Height)); } } // load pallet PalletProperties palletProperties = LoadPalletById(null, _root.data.items.library_pallets, vItem.itemId); if (null != palletProperties) { Pallet pallet = new Pallet(palletProperties); pallet.Draw(graphics, Transform3D.Identity); if (vItem.viewParameters.showDimensions) { graphics.AddDimensions(new DimensionCube(palletProperties.Length, palletProperties.Width, palletProperties.Height)); } } // load interlayer InterlayerProperties interlayerProperties = LoadInterlayerById(null, _root.data.items.library_interlayers, vItem.itemId); if (null != interlayerProperties) { graphics.AddBox(new Box(0, interlayerProperties)); if (vItem.viewParameters.showDimensions) { graphics.AddDimensions(new DimensionCube(interlayerProperties.Length, interlayerProperties.Width, interlayerProperties.Thickness)); } } // load bundle BundleProperties bundleProperties = LoadBundleById(null, _root.data.items.library_bundles, vItem.itemId); if (null != bundleProperties) { graphics.AddBox(new Box(0, bundleProperties)); if (vItem.viewParameters.showDimensions) { graphics.AddDimensions(new DimensionCube(bundleProperties.Length, bundleProperties.Width, bundleProperties.Height)); } } // load truck TruckProperties truckProperties = null; if (null != truckProperties) { Truck truck = new Truck(truckProperties); truck.Draw(graphics); if (vItem.viewParameters.showDimensions) { graphics.AddDimensions(new DimensionCube(truckProperties.Length, truckProperties.Width, truckProperties.Height)); } } FinalizeImageFromViewParameters(vItem.viewParameters, graphics); }