public CasePalletAnalysis( BProperties boxProperties, PalletProperties palletProperties, InterlayerProperties interlayerProperties, InterlayerProperties interlayerPropertiesAntiSlip, PalletCornerProperties palletCorners, PalletCapProperties palletCap, PalletFilmProperties palletFilm, PalletConstraintSet constraintSet) : base(boxProperties.ParentDocument) { // sanity checks if (palletProperties.ParentDocument != ParentDocument || (interlayerProperties != null && interlayerProperties.ParentDocument != ParentDocument)) { throw new Exception("box, pallet, interlayer do not belong to the same document"); } if ((boxProperties is BoxProperties && constraintSet is BundlePalletConstraintSet) || (boxProperties is BundleProperties && constraintSet is CasePalletConstraintSet)) { throw new Exception("Invalid analysis: either BoxProperties with ConstraintSetBundle or BundleProperties with ConstraintSetBox"); } // has interlayer ? constraintSet.HasInterlayer = null != interlayerProperties; // setting members this.BProperties = boxProperties; this.PalletProperties = palletProperties; this.InterlayerProperties = interlayerProperties; this.InterlayerPropertiesAntiSlip = interlayerPropertiesAntiSlip; this.PalletCornerProperties = palletCorners; this.PalletCapProperties = palletCap; this.PalletFilmProperties = palletFilm; this.ConstraintSet = constraintSet; }
public CasePalletAnalysis( BProperties boxProperties, PalletProperties palletProperties, InterlayerProperties interlayerProperties, InterlayerProperties interlayerPropertiesAntiSlip, PalletCornerProperties palletCorners, PalletCapProperties palletCap, PalletFilmProperties palletFilm, PalletConstraintSet constraintSet) : base(boxProperties.ParentDocument) { // sanity checks if (palletProperties.ParentDocument != ParentDocument || (interlayerProperties != null && interlayerProperties.ParentDocument != ParentDocument)) throw new Exception("box, pallet, interlayer do not belong to the same document"); if ((boxProperties is BoxProperties && constraintSet is BundlePalletConstraintSet) || (boxProperties is BundleProperties && constraintSet is CasePalletConstraintSet)) throw new Exception("Invalid analysis: either BoxProperties with ConstraintSetBundle or BundleProperties with ConstraintSetBox"); // has interlayer ? constraintSet.HasInterlayer = null != interlayerProperties; // setting members this.BProperties = boxProperties; this.PalletProperties = palletProperties; this.InterlayerProperties = interlayerProperties; this.InterlayerPropertiesAntiSlip = interlayerPropertiesAntiSlip; this.PalletCornerProperties = palletCorners; this.PalletCapProperties = palletCap; this.PalletFilmProperties = palletFilm; this.ConstraintSet = constraintSet; }
public void ProcessAnalysis(BoxCasePalletAnalysis analysis) { _boxProperties = analysis.BoxProperties; _interlayerProperties = analysis.InterlayerProperties; _palletSolutionList = analysis.PalletSolutionsList; _constraintSet = analysis.ConstraintSet; analysis.Solutions = GenerateSolutions(); }
public void ProcessAnalysis(PackPalletAnalysis analysis) { _packProperties = analysis.PackProperties; _palletProperties = analysis.PalletProperties; _interlayerProperties = analysis.InterlayerProperties; _constraintSet = analysis.ConstraintSet; analysis.Solutions = GenerateSolutions(); }
public void ProcessAnalysis(CylinderPalletAnalysis analysis) { _cylProperties = analysis.CylinderProperties; _palletProperties = analysis.PalletProperties; _interlayerProperties = analysis.InterlayerProperties; _interlayerPropertiesAntiSlip = analysis.InterlayerPropertiesAntiSlip; _constraintSet = analysis.ConstraintSet; if (!_constraintSet.IsValid) throw new EngineException("Constraint set is invalid!"); analysis.Solutions = GenerateSolutions(); }
public PackPalletAnalysis( PackProperties packProperties, PalletProperties palletProperties, InterlayerProperties interlayerProperties, PackPalletConstraintSet constraintSet) : base(packProperties.ParentDocument) { // sanity checks if (palletProperties.ParentDocument != ParentDocument || (interlayerProperties != null && interlayerProperties.ParentDocument != ParentDocument)) throw new Exception("box, pallet, interlayer do not belong to the same document"); // setting members this.PackProperties = packProperties; this.PalletProperties = palletProperties; this.InterlayerProperties = interlayerProperties; this.ConstraintSet = constraintSet; }
public CylinderPalletAnalysis( CylinderProperties cylProperties , PalletProperties palletProperties , InterlayerProperties interlayerProperties , InterlayerProperties interlayerPropertiesAntiSlip , CylinderPalletConstraintSet constraintSet) : base(cylProperties.ParentDocument) { // setting members CylinderProperties = cylProperties; PalletProperties = palletProperties; InterlayerProperties = interlayerProperties; InterlayerPropertiesAntiSlip = interlayerPropertiesAntiSlip; _constraintSet = constraintSet; // has interlayer ? _constraintSet.HasInterlayer = null != interlayerProperties; _constraintSet.HasInterlayerAntiSlip = null != interlayerPropertiesAntiSlip; }
public PackPalletAnalysis( PackProperties packProperties, PalletProperties palletProperties, InterlayerProperties interlayerProperties, PackPalletConstraintSet constraintSet) : base(packProperties.ParentDocument) { // sanity checks if (palletProperties.ParentDocument != ParentDocument || (interlayerProperties != null && interlayerProperties.ParentDocument != ParentDocument)) { throw new Exception("box, pallet, interlayer do not belong to the same document"); } // setting members this.PackProperties = packProperties; this.PalletProperties = palletProperties; this.InterlayerProperties = interlayerProperties; this.ConstraintSet = constraintSet; }
public FormNewInterlayer(Document document, InterlayerProperties interlayerProperties) { InitializeComponent(); // set unit labels UnitsManager.AdaptUnitLabels(this); // save document reference _document = document; _interlayerProperties = interlayerProperties; // set caption text Text = string.Format(Properties.Resources.ID_EDIT, _interlayerProperties.Name); // initialize value tbName.Text = _interlayerProperties.Name; tbDescription.Text = _interlayerProperties.Description; InterlayerLength = _interlayerProperties.Length; InterlayerWidth = _interlayerProperties.Width; Thickness = _interlayerProperties.Thickness; Weight = _interlayerProperties.Weight; this.Color = _interlayerProperties.Color; // disable Ok button UpdateButtonOkStatus(); }
/// <summary> /// Use this method when solution does not refer an analysis (e.g. when displaying CaseOptimizer result) /// </summary> public static void Draw(Graphics3D graphics , CasePalletSolution solution , BoxProperties boxProperties, InterlayerProperties interlayerProperties, PalletProperties palletProperties) { // draw pallet Pallet pallet = new Pallet(palletProperties); pallet.Draw(graphics, Transform3D.Identity); // draw solution uint pickId = 0; foreach (ILayer layer in solution) { BoxLayer blayer = layer as BoxLayer; if (null != blayer) { foreach (BoxPosition bPosition in blayer) graphics.AddBox(new Box(pickId++, boxProperties, bPosition)); } InterlayerPos interlayerPos = layer as InterlayerPos; if (null != interlayerPos && null != interlayerProperties) { Box box = new Box(pickId++, interlayerProperties); // set position box.Position = new Vector3D( 0.5 * (palletProperties.Length - interlayerProperties.Length) , 0.5 * (palletProperties.Width - interlayerProperties.Width) , interlayerPos.ZLow); // draw graphics.AddBox(box); } } // always show dimensions BoxLayer bLayer = solution[solution.Count - 1] as BoxLayer; double palletHeight = solution[solution.Count - 1].ZLow + (null != bLayer ? bLayer.Thickness(boxProperties) : 0.0); // show dimensions graphics.AddDimensions(new DimensionCube(solution.BoundingBox, Color.Black, false)); graphics.AddDimensions(new DimensionCube(solution.LoadBoundingBox, Color.Red, true)); }
public InterlayerProperties CreateNewInterlayer(InterlayerProperties interlayerProp) { // instantiate and intialize InterlayerProperties interlayerClone = new InterlayerProperties( this, interlayerProp.Name, interlayerProp.Description , interlayerProp.Length, interlayerProp.Width, interlayerProp.Thickness , interlayerProp.Weight , interlayerProp.Color); // insert in list _typeList.Add(interlayerClone); // notify listeners NotifyOnNewTypeCreated(interlayerClone); Modify(); return interlayerClone; }
public PackPalletAnalysis CreateNewPackPalletAnalysis( string name, string description , PackProperties pack, PalletProperties pallet , InterlayerProperties interlayer , PackPalletConstraintSet constraintSet , IPackPalletAnalysisSolver solver) { PackPalletAnalysis analysis = new PackPalletAnalysis( pack , pallet , interlayer , constraintSet); analysis.Name = name; analysis.Description = description; // insert in list _packPalletAnalyses.Add(analysis); // compute analysis solver.ProcessAnalysis(analysis); if (analysis.Solutions.Count < 1) { // remove analysis from list if it has no valid solution _packPalletAnalyses.Remove(analysis); Modify(); return null; } // notify listeners NotifyOnNewPackPalletAnalysisCreated(analysis); Modify(); return analysis; }
/// <summary> /// Creates a new analysis without generating solutions /// </summary> /// <param name="name">Name of analysis</param> /// <param name="description">Description</param> /// <param name="box">Case</param> /// <param name="pallet">Pallet</param> /// <param name="interlayer">Interlayer</param> /// <param name="constraintSet">PalletConstraintSet</param> /// <param name="solutions">Solutions</param> /// <returns>CasePalletAnalysis generated using input parameters</returns> public CasePalletAnalysis CreateNewCasePalletAnalysis( string name, string description , BProperties box, PalletProperties pallet , InterlayerProperties interlayer, InterlayerProperties interlayerAntiSlip , PalletCornerProperties palletCorners, PalletCapProperties palletCap, PalletFilmProperties palletFilm , PalletConstraintSet constraintSet , List<CasePalletSolution> solutions) { CasePalletAnalysis analysis = new CasePalletAnalysis( box, pallet, interlayer, interlayerAntiSlip, palletCorners, palletCap, palletFilm, constraintSet); analysis.Name = name; analysis.Description = description; // insert in list _casePalletAnalyses.Add(analysis); // set solutions analysis.Solutions = solutions; // notify listeners NotifyOnNewCasePalletAnalysisCreated(analysis); // set solution selected if it is unique if (solutions.Count == 1) analysis.SelectSolutionByIndex(0); return analysis; }
public InterlayerProperties CreateNewInterlayer( string name, string description , double length, double width, double thickness , double weight , Color color) { // instantiate and intialize InterlayerProperties interlayer = new InterlayerProperties( this, name, description , length, width, thickness , weight, color); // insert in list _typeList.Add(interlayer); // notify listeners NotifyOnNewTypeCreated(interlayer); Modify(); return interlayer; }
public void Save(InterlayerProperties interlayerProperties, XmlElement parentElement, XmlDocument xmlDoc) { // create xmlPalletProperties element XmlElement xmlInterlayerProperties = xmlDoc.CreateElement("InterlayerProperties"); parentElement.AppendChild(xmlInterlayerProperties); // Id XmlAttribute guidAttribute = xmlDoc.CreateAttribute("Id"); guidAttribute.Value = interlayerProperties.Guid.ToString(); xmlInterlayerProperties.Attributes.Append(guidAttribute); // name XmlAttribute nameAttribute = xmlDoc.CreateAttribute("Name"); nameAttribute.Value = interlayerProperties.Name; xmlInterlayerProperties.Attributes.Append(nameAttribute); // description XmlAttribute descAttribute = xmlDoc.CreateAttribute("Description"); descAttribute.Value = interlayerProperties.Description; xmlInterlayerProperties.Attributes.Append(descAttribute); // length XmlAttribute lengthAttribute = xmlDoc.CreateAttribute("Length"); lengthAttribute.Value = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}", interlayerProperties.Length); xmlInterlayerProperties.Attributes.Append(lengthAttribute); // width XmlAttribute widthAttribute = xmlDoc.CreateAttribute("Width"); widthAttribute.Value = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}", interlayerProperties.Width); xmlInterlayerProperties.Attributes.Append(widthAttribute); // height XmlAttribute heightAttribute = xmlDoc.CreateAttribute("Thickness"); heightAttribute.Value = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}", interlayerProperties.Thickness); xmlInterlayerProperties.Attributes.Append(heightAttribute); // weight XmlAttribute weightAttribute = xmlDoc.CreateAttribute("Weight"); weightAttribute.Value = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}", interlayerProperties.Weight); xmlInterlayerProperties.Attributes.Append(weightAttribute); // color XmlAttribute colorAttribute = xmlDoc.CreateAttribute("Color"); colorAttribute.Value = string.Format("{0}", interlayerProperties.Color.ToArgb()); xmlInterlayerProperties.Attributes.Append(colorAttribute); }
/// <summary> /// Creates a new analysis in this document + compute solutions /// </summary> /// <param name="name"></param> /// <param name="description"></param> /// <param name="box"></param> /// <param name="pallet"></param> /// <param name="interlayer"></param> /// <param name="constraintSet"></param> /// <param name="solver">Node : analysis creation requires a solver</param> /// <returns>An analysis</returns> public CasePalletAnalysis CreateNewCasePalletAnalysis( string name, string description , BProperties box, PalletProperties pallet , InterlayerProperties interlayer, InterlayerProperties interlayerAntiSlip , PalletCornerProperties palletCorners, PalletCapProperties palletCap, PalletFilmProperties palletFilm , PalletConstraintSet constraintSet , ICasePalletAnalysisSolver solver) { CasePalletAnalysis analysis = new CasePalletAnalysis( box, pallet, interlayer, interlayerAntiSlip, palletCorners, palletCap, palletFilm, constraintSet); analysis.Name = name; analysis.Description = description; // insert in list _casePalletAnalyses.Add(analysis); // compute analysis solver.ProcessAnalysis(analysis); if (analysis.Solutions.Count < 1) { // remove analysis from list if it has no valid solution _casePalletAnalyses.Remove(analysis); return null; } // notify listeners NotifyOnNewCasePalletAnalysisCreated(analysis); Modify(); return analysis; }
private void AppendInterlayerElement(InterlayerProperties interlayerProp, XmlElement elemPalletAnalysis, XmlDocument xmlDoc) { // sanity check if (null == interlayerProp) return; // namespace string ns = xmlDoc.DocumentElement.NamespaceURI; // interlayer XmlElement elemInterlayer = xmlDoc.CreateElement("interlayer", ns); elemPalletAnalysis.AppendChild(elemInterlayer); // name XmlElement elemName = xmlDoc.CreateElement("name", ns); elemName.InnerText = interlayerProp.Name; elemInterlayer.AppendChild(elemName); // description XmlElement elemDescription = xmlDoc.CreateElement("description", ns); elemDescription.InnerText = interlayerProp.Description; elemInterlayer.AppendChild(elemDescription); AppendElementValue(xmlDoc, elemInterlayer, "length", UnitsManager.UnitType.UT_LENGTH, interlayerProp.Length); AppendElementValue(xmlDoc, elemInterlayer, "width", UnitsManager.UnitType.UT_LENGTH, interlayerProp.Width); AppendElementValue(xmlDoc, elemInterlayer, "thickness", UnitsManager.UnitType.UT_LENGTH, interlayerProp.Thickness); AppendElementValue(xmlDoc, elemInterlayer, "weight", UnitsManager.UnitType.UT_MASS, interlayerProp.Weight); // --- build image Graphics3DImage graphics = new Graphics3DImage(new Size(ImageSizeDetail, ImageSizeDetail)); graphics.CameraPosition = Graphics3D.Corner_0; Box box = new Box(0, interlayerProp); graphics.AddBox(box); graphics.Flush(); // --- // view_interlayer_iso XmlElement elemImage = xmlDoc.CreateElement("view_interlayer_iso", ns); TypeConverter converter = TypeDescriptor.GetConverter(typeof(Bitmap)); elemImage.InnerText = Convert.ToBase64String((byte[])converter.ConvertTo(graphics.Bitmap, typeof(byte[]))); XmlAttribute styleAttribute = xmlDoc.CreateAttribute("style"); styleAttribute.Value = string.Format("width:{0}pt;height:{1}pt", graphics.Bitmap.Width / 4, graphics.Bitmap.Height / 4); elemImage.Attributes.Append(styleAttribute); elemInterlayer.AppendChild(elemImage); // save image ? SaveImageAs(graphics.Bitmap, "view_interlayer_iso.png"); }
public Box(uint pickId, InterlayerProperties interlayerProperties) { _pickId = pickId; _dim[0] = interlayerProperties.Length; _dim[1] = interlayerProperties.Width; _dim[2] = interlayerProperties.Thickness; _colors = new Color[6]; for (int i = 0; i < 6; ++i) _colors[i] = interlayerProperties.Color; }
public void Draw(Graphics3DControl ctrl, Graphics3D graphics) { InterlayerProperties interlayerProperties = new InterlayerProperties( null, tbName.Text, tbDescription.Text , InterlayerLength, InterlayerWidth , Thickness, Weight, Color); Box box = new Box(0, interlayerProperties); graphics.AddBox(box); }
public PackPalletAnalysis CreateNewPackPalletAnalysis( string name, string description , PackProperties pack, PalletProperties pallet , InterlayerProperties interlayer , PackPalletConstraintSet constraintSet , List<PackPalletSolution> solutions) { PackPalletAnalysis analysis = new PackPalletAnalysis( pack , pallet , interlayer , constraintSet); analysis.Name = name; analysis.Description = description; // insert in list _packPalletAnalyses.Add(analysis); // set solutions analysis.Solutions = solutions; // notify listeners NotifyOnNewPackPalletAnalysisCreated(analysis); // set solution selected if it is unique if (solutions.Count == 1) analysis.SelectSolutionByIndex(0); return analysis; }
public Box(uint pickId, InterlayerProperties interlayerProperties, BoxPosition bPosition) { _pickId = pickId; _dim[0] = interlayerProperties.Length; _dim[1] = interlayerProperties.Width; _dim[2] = interlayerProperties.Thickness; _colors = new Color[6]; for (int i = 0; i < 6; ++i) _colors[i] = interlayerProperties.Color; // set position Position = bPosition.Position; // set direction length LengthAxis = HalfAxis.ToVector3D(bPosition.DirectionLength); // set direction width WidthAxis = HalfAxis.ToVector3D(bPosition.DirectionWidth); }
private static InterlayerProperties LoadInterlayerById(Document doc, List<interlayer> listInterlayer, string sid) { interlayer interlayerItem = listInterlayer.Find(delegate(interlayer i) { return i.id == sid; }); if (null == interlayerItem) return null; else { // dimensions double[] dimensions = interlayerItem.dimensions.ToArray(); // instantiate interlayer properties InterlayerProperties interlayerProperties = new InterlayerProperties( doc , interlayerItem.name , interlayerItem.description , dimensions[0], dimensions[1], dimensions[2] , interlayerItem.weight , Color.FromArgb((int)interlayerItem.color[0], (int)interlayerItem.color[1], (int)interlayerItem.color[2], (int)interlayerItem.color[3]) ); // insert in list if (null != doc) doc.AddType(interlayerProperties); return interlayerProperties; } }
public List<CasePalletSolution> Process( BoxProperties boxProperties, PalletProperties palletProperties, InterlayerProperties interlayerProperties, InterlayerProperties interlayerPropertiesAntiSlip, PalletConstraintSet constraintSet) { _bProperties = boxProperties; _palletProperties = palletProperties; _interlayerProperties = interlayerProperties; _interlayerPropertiesAntiSlip = interlayerPropertiesAntiSlip; _constraintSet = constraintSet; // check constraint set validity if (!_constraintSet.IsValid) throw new EngineException("Constraint set is invalid!"); // generate solutions return GenerateSolutions(); }
public InterlayerItem(InterlayerProperties interlayerProperties) { _interlayerProperties = interlayerProperties; }
/// <summary> /// Process case/pallet analysis /// </summary> /// <param name="analysis">Pallet analysis to process</param> public void ProcessAnalysis(CasePalletAnalysis analysis) { _bProperties = analysis.BProperties; _palletProperties = analysis.PalletProperties; _interlayerProperties = analysis.InterlayerProperties; _interlayerPropertiesAntiSlip = analysis.InterlayerPropertiesAntiSlip; _cornerProperties = analysis.PalletCornerProperties; _capProperties = analysis.PalletCapProperties; _constraintSet = analysis.ConstraintSet; // check contraint set validity if (!_constraintSet.IsValid) throw new EngineException("Constraint set is invalid!"); // generate solutions analysis.Solutions = GenerateSolutions(); }