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 FormNewPalletCap(Document document, PalletCapProperties capProperties) : base(document, capProperties) { InitializeComponent(); // units UnitsManager.AdaptUnitLabels(this); if (null != capProperties) { CapLength = capProperties.Length; CapWidth = capProperties.Width; CapHeight = capProperties.Height; CapInnerLength = capProperties.InsideLength; CapInnerWidth = capProperties.InsideWidth; CapInnerHeight = capProperties.InsideHeight; CapWeight = capProperties.Weight; CapColor = capProperties.Color; } else { CapLength = UnitsManager.ConvertLengthFrom(1200.0, UnitsManager.UnitSystem.UNIT_METRIC1); CapWidth = UnitsManager.ConvertLengthFrom(1000.0, UnitsManager.UnitSystem.UNIT_METRIC1); CapHeight = UnitsManager.ConvertLengthFrom(50.0, UnitsManager.UnitSystem.UNIT_METRIC1); CapWeight = UnitsManager.ConvertSurfaceMassFrom(0.5, UnitsManager.UnitSystem.UNIT_METRIC1); CapColor = Color.Khaki; } UpdateStatus(string.Empty); }
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 PalletCap(uint pickId, PalletCapProperties capProperties, Vector3D position) { _dim[0] = capProperties.Length; _dim[1] = capProperties.Width; _dim[2] = capProperties.Height; _color = capProperties.Color; Position = position; }
/// <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(); }
/// <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 AnalysisCasePallet CreateNewAnalysisCasePallet( string name, string description , BProperties box, PalletProperties pallet , List<InterlayerProperties> interlayers , PalletCornerProperties palletCorners, PalletCapProperties palletCap, PalletFilmProperties palletFilm , ConstraintSetCasePallet constraintSet , List<LayerDesc> layerDescs ) { AnalysisCasePallet analysis = new AnalysisCasePallet(box, pallet, constraintSet); foreach (InterlayerProperties interlayer in interlayers) analysis.AddInterlayer(interlayer); analysis.PalletCornerProperties = palletCorners; analysis.PalletCapProperties = palletCap; analysis.PalletFilmProperties = palletFilm; analysis.AddSolution(layerDescs); // notify listeners NotifyOnNewAnalysisCreated(analysis); Modify(); return analysis; }
/// <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; }
public PalletCapProperties CreateNewPalletCap( string name, string description, double length, double width, double height, double innerLength, double innerWidth, double innerHeight, double weight, Color color) { // instantiate and initialize PalletCapProperties palletCap = new PalletCapProperties( this, name, description, length, width, height, innerLength, innerWidth, innerHeight, weight, color); // insert in list _typeList.Add(palletCap); // notify listeners NotifyOnNewTypeCreated(palletCap); Modify(); return palletCap; }
public PalletCapProperties CreateNewPalletCap(PalletCapProperties palletCap) { // instantiate and initialize PalletCapProperties palletCapClone = new PalletCapProperties( this, palletCap.Name, palletCap.Description, palletCap.Length, palletCap.Width, palletCap.Height, palletCap.InsideLength, palletCap.InsideWidth, palletCap.InsideHeight, palletCap.Weight, palletCap.Color); // insert in list _typeList.Add(palletCapClone); // notify listeners NotifyOnNewTypeCreated(palletCapClone); Modify(); return palletCapClone; }
public void Save(PalletCapProperties capProperties, XmlElement parentElement, XmlDocument xmlDoc) { // create PalletCornerProperties element XmlElement xmlCapProperties = xmlDoc.CreateElement("PalletCapProperties"); parentElement.AppendChild(xmlCapProperties); // Id XmlAttribute guidAttribute = xmlDoc.CreateAttribute("Id"); guidAttribute.Value = capProperties.Guid.ToString(); xmlCapProperties.Attributes.Append(guidAttribute); // name XmlAttribute nameAttribute = xmlDoc.CreateAttribute("Name"); nameAttribute.Value = capProperties.Name; xmlCapProperties.Attributes.Append(nameAttribute); // description XmlAttribute descAttribute = xmlDoc.CreateAttribute("Description"); descAttribute.Value = capProperties.Description; xmlCapProperties.Attributes.Append(descAttribute); // length XmlAttribute lengthAttribute = xmlDoc.CreateAttribute("Length"); lengthAttribute.Value = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}", capProperties.Length); xmlCapProperties.Attributes.Append(lengthAttribute); // width XmlAttribute widthAttribute = xmlDoc.CreateAttribute("Width"); widthAttribute.Value = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}", capProperties.Width); xmlCapProperties.Attributes.Append(widthAttribute); // height XmlAttribute heightAttribute = xmlDoc.CreateAttribute("Height"); heightAttribute.Value = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}", capProperties.Height); xmlCapProperties.Attributes.Append(heightAttribute); // inside length XmlAttribute insideLengthAttribute = xmlDoc.CreateAttribute("InsideLength"); insideLengthAttribute.Value = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}", capProperties.Length); xmlCapProperties.Attributes.Append(insideLengthAttribute); // inside width XmlAttribute insideWidthAttribute = xmlDoc.CreateAttribute("InsideWidth"); insideWidthAttribute.Value = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}", capProperties.Width); xmlCapProperties.Attributes.Append(insideWidthAttribute); // inside height XmlAttribute insideHeightAttribute = xmlDoc.CreateAttribute("InsideHeight"); insideHeightAttribute.Value = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}", capProperties.Height); xmlCapProperties.Attributes.Append(insideHeightAttribute); // weight XmlAttribute weightAttribute = xmlDoc.CreateAttribute("Weight"); weightAttribute.Value = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}", capProperties.Weight); xmlCapProperties.Attributes.Append(weightAttribute); // color XmlAttribute colorAttribute = xmlDoc.CreateAttribute("Color"); colorAttribute.Value = string.Format("{0}", capProperties.Color.ToArgb()); xmlCapProperties.Attributes.Append(colorAttribute); }
public Box(uint pickId, PalletCapProperties capProperties, Vector3D position) { _dim[0] = capProperties.Length; _dim[1] = capProperties.Width; _dim[2] = capProperties.Height; _colors = new Color[6]; this.SetAllFacesColor(capProperties.Color); Position = position; LengthAxis = Vector3D.XAxis; WidthAxis = Vector3D.YAxis; }
public void Draw(Graphics3DControl ctrl, Graphics3D graphics) { if (CapLength > 0 && CapWidth > 0 && CapHeight > 0) { // draw PalletCapProperties palletCapProperties = new PalletCapProperties( null, ItemName, ItemDescription, CapLength, CapWidth, CapHeight, CapInnerLength, CapInnerWidth, CapInnerHeight, CapWeight, CapColor); PalletCap palletCap = new PalletCap(0, palletCapProperties, Vector3D.Zero); palletCap.Draw(graphics); graphics.AddDimensions(new DimensionCube(CapLength, CapWidth, CapHeight)); } }
private void AppendPalletCapElement(PalletCapProperties palletCapProp, XmlElement elemPalletAnalysis, XmlDocument xmlDoc) { // sanity check if (null == palletCapProp) return; // namespace string ns = xmlDoc.DocumentElement.NamespaceURI; // interlayer XmlElement elemPalletCap = xmlDoc.CreateElement("palletCap", ns); elemPalletAnalysis.AppendChild(elemPalletCap); // name XmlElement elemName = xmlDoc.CreateElement("name", ns); elemName.InnerText = palletCapProp.Name; elemPalletCap.AppendChild(elemName); // description XmlElement elemDescription = xmlDoc.CreateElement("description", ns); elemDescription.InnerText = palletCapProp.Description; elemPalletCap.AppendChild(elemDescription); AppendElementValue(xmlDoc, elemPalletCap, "length", UnitsManager.UnitType.UT_LENGTH, palletCapProp.Length); AppendElementValue(xmlDoc, elemPalletCap, "width", UnitsManager.UnitType.UT_LENGTH, palletCapProp.Width); AppendElementValue(xmlDoc, elemPalletCap, "height", UnitsManager.UnitType.UT_LENGTH, palletCapProp.Height); AppendElementValue(xmlDoc, elemPalletCap, "innerLength", UnitsManager.UnitType.UT_LENGTH, palletCapProp.InsideLength); AppendElementValue(xmlDoc, elemPalletCap, "innerWidth", UnitsManager.UnitType.UT_LENGTH, palletCapProp.InsideWidth); AppendElementValue(xmlDoc, elemPalletCap, "innerHeight", UnitsManager.UnitType.UT_LENGTH, palletCapProp.InsideHeight); AppendElementValue(xmlDoc, elemPalletCap, "weight", UnitsManager.UnitType.UT_MASS, palletCapProp.Weight); // --- // view_palletCap_iso // build image Graphics3DImage graphics = new Graphics3DImage(new Size(ImageSizeDetail, ImageSizeDetail)); graphics.CameraPosition = Graphics3D.Corner_0; PalletCap palletCap = new PalletCap(0, palletCapProp, Vector3D.Zero); palletCap.Draw(graphics); graphics.AddDimensions(new DimensionCube(palletCapProp.Length, palletCapProp.Width, palletCapProp.Height)); graphics.Flush(); // save image ? SaveImageAs(graphics.Bitmap, "view_palletCap_iso.png"); // --- // view_palletCap_iso XmlElement elemImage = xmlDoc.CreateElement("view_palletCap_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); elemPalletCap.AppendChild(elemImage); }