public PalletSolutionDesc(PalletSolutionDatabase db, CasePalletSolution sol, string friendlyName)
        {
            BoxProperties       boxProperties    = sol.Analysis.BProperties as BoxProperties;
            PalletProperties    palletProperties = sol.Analysis.PalletProperties;
            PalletConstraintSet constraintSet    = sol.Analysis.ConstraintSet;

            _guid         = Guid.NewGuid();
            _friendlyName = friendlyName;
            _key          = new PalletSolutionKey(
                palletProperties.Length, palletProperties.Width, constraintSet.MaximumHeight
                , constraintSet.OverhangX, constraintSet.OverhangY);

            _caseDimensions[0] = boxProperties.Length;
            _caseDimensions[1] = boxProperties.Width;
            _caseDimensions[2] = boxProperties.Height;

            _insideCaseDimensions[0] = boxProperties.InsideLength;
            _insideCaseDimensions[1] = boxProperties.InsideWidth;
            _insideCaseDimensions[2] = boxProperties.InsideHeight;

            _caseWeight   = boxProperties.Weight;
            _palletWeight = palletProperties.Weight;

            _caseOrientation = sol.CaseOrientation;
            _caseCount       = sol.CaseCount;

            _parentDB = db;
        }
 public AnalysisCylinderPallet(
     Packable packable,
     PalletProperties palletProperties,
     ConstraintSetPackablePallet constraintSet)
     : base(packable, palletProperties, constraintSet)
 {
 }
Esempio n. 3
0
 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;
 }
Esempio n. 4
0
        private Layer2D GenerateBestLayer(
            BProperties bProperties, PalletProperties palletProperties, PalletCornerProperties cornerProperties,
            PalletConstraintSet constraintSet, HalfAxis.HAxis hAxis)
        {
            Layer2D bestLayer = null;
            // loop through all patterns
            foreach (LayerPattern pattern in LayerPattern.All)
            {
                // is pattern allowed
                if (!_constraintSet.AllowPattern(pattern.Name)) continue;

                // direction 1
                Layer2D layer1 = BuildLayer(bProperties, palletProperties, cornerProperties,
                    constraintSet, hAxis, false, false);
                double actualLength = 0.0, actualWidth = 0.0;
                pattern.GetLayerDimensionsChecked(layer1, out actualLength, out actualWidth);
                pattern.GenerateLayer(layer1, actualLength, actualWidth);
                // save as best pattern
                if (null == bestLayer || bestLayer.Count < layer1.Count)
                    bestLayer = layer1;
                // direction 2 (opposite)
                Layer2D layer2 = BuildLayer(bProperties, palletProperties, cornerProperties,
                    constraintSet, HalfAxis.Opposite(hAxis), false, false);
                actualLength = 0.0; actualWidth = 0.0;
                pattern.GetLayerDimensionsChecked(layer2, out actualLength, out actualWidth);
                pattern.GenerateLayer(layer2, actualLength, actualWidth);
                // save as best pattern
                if (null == bestLayer || bestLayer.Count < layer2.Count)
                    bestLayer = layer2;
            }
            return bestLayer;
        }
Esempio n. 5
0
 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;
 }
Esempio n. 6
0
 public void ProcessAnalysis(PackPalletAnalysis analysis)
 {
     _packProperties = analysis.PackProperties;
     _palletProperties = analysis.PalletProperties;
     _interlayerProperties = analysis.InterlayerProperties;
     _constraintSet = analysis.ConstraintSet;
     analysis.Solutions = GenerateSolutions();
 }
Esempio n. 7
0
 public CaseOptimAnalysis(
     BProperties boxProperties
     , PalletProperties palletProperties
     , PalletConstraintSet palletConstraintSet
     , CaseOptimConstraintSet caseOptimConstraintSet)
     : base(boxProperties.ParentDocument)
 {
 }
Esempio n. 8
0
 public AnalysisCasePallet(
     Packable packable,
     PalletProperties palletProperties,
     ConstraintSetCasePallet constraintSet,
     bool temporary = false)
     : base(packable, palletProperties, constraintSet, temporary)
 {
 }
Esempio n. 9
0
 public CaseOptimAnalysis(
     BProperties boxProperties
     , PalletProperties palletProperties
     , PalletConstraintSet palletConstraintSet
     , CaseOptimConstraintSet caseOptimConstraintSet)
     : base(boxProperties.ParentDocument)
 {
 }
Esempio n. 10
0
 public FastEvaluatorLayer2Pallet(
     ILayer2D layer, Packable packable, PalletProperties palletProperties,
     ConstraintSetAbstract constraintSet)
 {
     Layer         = layer;
     Content       = packable;
     Container     = palletProperties;
     ConstraintSet = constraintSet;
 }
 public HCylinderPalletAnalysis(
     CylinderProperties cylProperties,
     PalletProperties palletProperties,
     HCylinderPalletConstraintSet constraintSet)
     : base(cylProperties.ParentDocument)
 {
     CylinderProperties = cylProperties;
     PalletProperties   = palletProperties;
     _constraintSet     = constraintSet;
 }
Esempio n. 12
0
 public CaseOptimizer(
     BoxProperties boxProperties
     , PalletProperties palletProperties
     , PalletConstraintSet palletContraintSet
     , CaseOptimConstraintSet caseOptimConstraintSet)
 {
     _boxProperties = boxProperties;
     _palletProperties = palletProperties;
     _palletConstraintSet = palletContraintSet;
     _caseOptimConstraintSet = caseOptimConstraintSet;
 }
Esempio n. 13
0
        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();
        }
Esempio n. 14
0
        static void Main(string[] args)
        {
            // define box properties
            BoxProperties boxProperties = new BoxProperties(null, 120.0, 100.0, 70.0);
            // define pallet properties
            PalletProperties palletProperties = new PalletProperties(null, "Block", 1200, 1000, 150);
            // define pallet constraintSet
            CasePalletConstraintSet constraintSet = new CasePalletConstraintSet();
            constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_X_N, true);
            constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_X_P, true);
            constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Y_N, true);
            constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Y_P, true);
            constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Z_N, true);
            constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Z_P, true);

            constraintSet.SetAllowedPattern("Column");
            constraintSet.SetAllowedPattern("Diagonale");
            constraintSet.SetAllowedPattern("Interlocked");
            constraintSet.SetAllowedPattern("Trilock");
            constraintSet.SetAllowedPattern("Spirale");

            constraintSet.AllowAlignedLayers = true;
            constraintSet.AllowAlternateLayers = true;

            constraintSet.MaximumHeight = 2000;
            constraintSet.MaximumNumberOfItems = 2000;
            constraintSet.UseMaximumHeight = true;
            constraintSet.UseMaximumPalletWeight = false;
            constraintSet.UseMaximumWeightOnBox = false;
            Console.WriteLine("=== Constraint set ===");
            Console.WriteLine(constraintSet.ToString());

            // define case optim constraintSet
            CaseOptimConstraintSet caseOptimConstraintSet = new CaseOptimConstraintSet(
                new int[3]{2, 2, 4}
                , 4.0, 0.01
                , new Vector3D(30.0, 30.0, 70.0)
                , new Vector3D(500.0, 500.0, 500.0)
                , false
                );

            CaseOptimizer caseOptimizer = new CaseOptimizer(boxProperties, palletProperties, constraintSet, caseOptimConstraintSet);

            // get all valid case definitions
            foreach (CaseDefinition caseDefinition in caseOptimizer.CaseDefinitions(48))
                Console.WriteLine(caseDefinition.ToString() + caseDefinition.OuterDimensions(boxProperties, caseOptimConstraintSet));
            // build list of solutions
            List<CaseOptimSolution> caseOptimSolutions = caseOptimizer.CaseOptimSolutions(48);
            foreach (CaseOptimSolution caseOptimSolution in caseOptimSolutions)
                Console.WriteLine(caseOptimSolution.ToString());
        }
Esempio n. 15
0
        public AnalysisCasePallet(
            BProperties bProperties, 
            PalletProperties palletProperties,
            ConstraintSetCasePallet constraintSet)
            : base(bProperties.ParentDocument)
        {
            // sanity checks
            if (palletProperties.ParentDocument != ParentDocument)
                throw new Exception("box & pallet do not belong to the same document");

            _bProperties = bProperties;
            _palletProperties = palletProperties;
            _constraintSet = constraintSet;
        }
Esempio n. 16
0
 public AnalysisPackablePallet(
     Packable packable,
     PalletProperties palletProperties,
     ConstraintSetAbstract constraintSet)
     : base(packable.ParentDocument, packable)
 {
     // sanity checks
     if (palletProperties.ParentDocument != ParentDocument)
     {
         throw new Exception("box & pallet do not belong to the same document");
     }
     PalletProperties = palletProperties;
     _constraintSet   = constraintSet;
 }
Esempio n. 17
0
 /// <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();
 }
Esempio n. 18
0
 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();
 }
Esempio n. 19
0
        public AnalysisCasePallet(
            BProperties bProperties,
            PalletProperties palletProperties,
            ConstraintSetCasePallet constraintSet)
            : base(bProperties.ParentDocument)
        {
            // sanity checks
            if (palletProperties.ParentDocument != ParentDocument)
            {
                throw new Exception("box & pallet do not belong to the same document");
            }

            _bProperties      = bProperties;
            _palletProperties = palletProperties;
            _constraintSet    = constraintSet;
        }
Esempio n. 20
0
 protected AnalysisPackablePallet(
     Packable packable,
     PalletProperties palletProperties,
     ConstraintSetAbstract constraintSet,
     bool temporary = false)
     : base(temporary ? null : packable.ParentDocument, packable)
 {
     // sanity checks
     if (null != ParentDocument &&
         (null != packable.ParentDocument) &&
         (palletProperties.ParentDocument != ParentDocument))
     {
         throw new Exception("box & pallet do not belong to the same document");
     }
     PalletProperties = palletProperties;
     ConstraintSet    = constraintSet;
 }
Esempio n. 21
0
 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 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;
 }
Esempio n. 24
0
 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;
 }
Esempio n. 25
0
 public FormNewPallet(Document document, PalletProperties palletProperties)
 {
     InitializeComponent();
     // set unit labels
     UnitsManager.AdaptUnitLabels(this);
     // save document reference
     _document = document;
     _palletProperties = palletProperties;
     // initialize type combo
     cbType.Items.AddRange(PalletData.TypeNames);
     // set selected item
     PalletTypeName = _palletProperties.TypeName;
     // set caption text
     Text = string.Format(Resources.ID_PALLETCAPTIONEDIT, _palletProperties.Name);
     // initialize data
     tbName.Text = _palletProperties.Name;
     tbDescription.Text = _palletProperties.Description;
     PalletLength = _palletProperties.Length;
     PalletWidth = _palletProperties.Width;
     PalletHeight = _palletProperties.Height;
     Weight = _palletProperties.Weight;
     PalletColor = _palletProperties.Color;
 }
 private void cbPallet_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (-1 == cbPallet.SelectedIndex)
         return;
     PalletItem item = cbPallet.Items[cbPallet.SelectedIndex] as PalletItem;
     _palletProperties = item.Item;
     // update pallet image
     graphCtrlPallet.Invalidate();
 }
Esempio n. 27
0
 public void Save(PalletProperties palletProperties, XmlElement parentElement, XmlDocument xmlDoc)
 {
     // create xmlPalletProperties element
     XmlElement xmlPalletProperties = xmlDoc.CreateElement("PalletProperties");
     parentElement.AppendChild(xmlPalletProperties);
     // Id
     XmlAttribute guidAttribute = xmlDoc.CreateAttribute("Id");
     guidAttribute.Value = palletProperties.Guid.ToString();
     xmlPalletProperties.Attributes.Append(guidAttribute);
     // name
     XmlAttribute nameAttribute = xmlDoc.CreateAttribute("Name");
     nameAttribute.Value = palletProperties.Name;
     xmlPalletProperties.Attributes.Append(nameAttribute);
     // description
     XmlAttribute descAttribute = xmlDoc.CreateAttribute("Description");
     descAttribute.Value = palletProperties.Description;
     xmlPalletProperties.Attributes.Append(descAttribute);
     // length
     XmlAttribute lengthAttribute = xmlDoc.CreateAttribute("Length");
     lengthAttribute.Value = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}", palletProperties.Length);
     xmlPalletProperties.Attributes.Append(lengthAttribute);
     // width
     XmlAttribute widthAttribute = xmlDoc.CreateAttribute("Width");
     widthAttribute.Value = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}", palletProperties.Width);
     xmlPalletProperties.Attributes.Append(widthAttribute);
     // height
     XmlAttribute heightAttribute = xmlDoc.CreateAttribute("Height");
     heightAttribute.Value = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}", palletProperties.Height);
     xmlPalletProperties.Attributes.Append(heightAttribute);
     // weight
     XmlAttribute weightAttribute = xmlDoc.CreateAttribute("Weight");
     weightAttribute.Value = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}", palletProperties.Weight);
     xmlPalletProperties.Attributes.Append(weightAttribute);
     // admissible load weight
     XmlAttribute admLoadWeightAttribute = xmlDoc.CreateAttribute("AdmissibleLoadWeight");
     admLoadWeightAttribute.Value = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}", palletProperties.AdmissibleLoadWeight);
     xmlPalletProperties.Attributes.Append(admLoadWeightAttribute);
     // admissible load height
     XmlAttribute admLoadHeightAttribute = xmlDoc.CreateAttribute("AdmissibleLoadHeight");
     admLoadHeightAttribute.Value = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}", palletProperties.AdmissibleLoadHeight);
     xmlPalletProperties.Attributes.Append(admLoadHeightAttribute);
     // type
     XmlAttribute typeAttribute = xmlDoc.CreateAttribute("Type");
     typeAttribute.Value = string.Format("{0}", palletProperties.TypeName);
     xmlPalletProperties.Attributes.Append(typeAttribute);
     // color
     XmlAttribute colorAttribute = xmlDoc.CreateAttribute("Color");
     colorAttribute.Value = string.Format("{0}", palletProperties.Color.ToArgb());
     xmlPalletProperties.Attributes.Append(colorAttribute);
 }
Esempio n. 28
0
        private static PalletProperties LoadPalletById(Document doc, List<pallet> listPallet, string sid)
        {
            pallet palletItem = listPallet.Find(delegate(pallet p) { return p.id == sid; });
            if (null == palletItem)
                return null;
            else
            {
                // dimensions
                double[] dimensions = palletItem.dimensions.ToArray();
                // type
                string typeName = string.Empty;
                switch (palletItem.type)
                {
                    case palletType.BLOCK: typeName = "BLOCK"; break;
                    case palletType.EUR: typeName = "EUR"; break;
                    case palletType.EUR2: typeName = "EUR2"; break;
                    case palletType.EUR3: typeName = "EUR3"; break;
                    case palletType.EUR6: typeName = "EUR6"; break;
                    case palletType.GMA: typeName = "GMA"; break;
                    case palletType.STANDARD_UK: typeName = "STANDARD_UK"; break;
                    default:
                        throw new Exception("Pallet with id = {0} has an unknown pallet type");
                }
                // instantiate pallet properties
                PalletProperties palletProperties = new PalletProperties(doc, typeName, dimensions[0], dimensions[1], dimensions[2]);
                // name
                palletProperties.Name = palletItem.name;
                // description
                palletProperties.Description = palletItem.description;
                // color
                palletProperties.Color = System.Drawing.Color.FromArgb((int)palletItem.color[0], (int)palletItem.color[1], (int)palletItem.color[2], (int)palletItem.color[3]);
                // weight
                palletProperties.Weight = palletItem.weight;
                // insert in list
                if (null != doc)
                    doc.AddType(palletProperties);

                return palletProperties;
            }
        }
Esempio n. 29
0
 public PalletProperties CreateNewPallet(
     string name, string description
     , string typeName
     , double length, double width, double height
     , double weight)
 {
     PalletProperties palletProperties = new PalletProperties(this, typeName, length, width, height);
     palletProperties.Name = name;
     palletProperties.Description = description;
     palletProperties.Weight = weight;
     // insert in list
     _typeList.Add(palletProperties);
     // notify listeners
     NotifyOnNewTypeCreated(palletProperties);
     Modify();
     return palletProperties;
 }
Esempio n. 30
0
        protected mesh CreatePalletMesh(PalletProperties palletProperties)
        {
            // build pallet object
            Pallet pallet = new Pallet(palletProperties);
            // build list of boxes
            List<Box> listBoxes = pallet.BuildListOfBoxes();
            // build list of vertices / normals / UVs
            ulong vertexCount = 0, normalCount = 0, uvCount = 0, triangleCount = 0, boxCount = 0;
            string triangle_string = string.Empty;

            List<double> doubleArrayPosition = new List<double>(), doubleArrayNormal = new List<double>(), doubleArrayUV = new List<double>();

            foreach (Box box in listBoxes)
            {
                foreach (Vector3D p in box.Points)
                {
                    doubleArrayPosition.Add(p.X); doubleArrayPosition.Add(p.Y); doubleArrayPosition.Add(p.Z);
                    ++vertexCount;
                }
                foreach (Vector3D n in box.Normals)
                {
                    doubleArrayNormal.Add(n.X); doubleArrayNormal.Add(n.Y); doubleArrayNormal.Add(n.Z);
                    ++normalCount;
                }
                foreach (Vector2D uv in box.UVs)
                {
                    doubleArrayUV.Add(uv.X); doubleArrayUV.Add(uv.Y);
                    ++uvCount;
                }
                foreach (TriangleIndices tr in box.Triangles)
                {
                    triangle_string += tr.ConvertToString(boxCount);
                    ++triangleCount;
                }
                ++boxCount;
            }
            mesh palletMesh = new mesh();

            // position source
            source palletPositionSource = new source() { id = "pallet_position", name = "pallet_position" };
            float_array farrayPosition = new float_array { id = "pallet_position_float_array", count = (ulong)doubleArrayPosition.Count, Values = doubleArrayPosition.ToArray() };
            palletPositionSource.technique_common = new sourceTechnique_common()
            {
                accessor = new accessor()
                {
                    stride = 3,
                    count = vertexCount,
                    source = "#pallet_position_float_array",
                    param = new param[] { new param() { name = "X", type = "float" }, new param() { name = "Y", type = "float" }, new param() { name = "Z", type = "float" } }
                }
            };
            palletPositionSource.Item = farrayPosition;

            // normal source
            source palletPositionNormal = new source() { id = "pallet_normal", name = "pallet_normal" };
            float_array farrayNormal = new float_array { id = "pallet_normal_float_array", count = (ulong)doubleArrayNormal.Count, Values = doubleArrayNormal.ToArray() };
            palletPositionNormal.technique_common = new sourceTechnique_common()
            {
                accessor = new accessor()
                {
                    stride = 3,
                    count = normalCount,
                    source = "#pallet_normal_float_array",
                    param = new param[] { new param() { name = "X", type = "float" }, new param() { name = "Y", type = "float" }, new param() { name = "Z", type = "float" } }
                }
            };
            palletPositionNormal.Item = farrayNormal;

            // uv source
            source palletPositionUV = new source() { id = "pallet_UV", name = "pallet_UV" };
            float_array farrayUV = new float_array { id = "pallet_UV_float_array", count = (ulong)doubleArrayUV.Count, Values = doubleArrayUV.ToArray() };
            palletPositionUV.technique_common = new sourceTechnique_common()
            {
                accessor = new accessor()
                {
                    stride = 2,
                    count = vertexCount,
                    source = "#pallet_UV_float_array",
                    param = new param[] { new param() { name = "S", type = "float" }, new param() { name = "T", type = "float" } }
                }
            };
            palletPositionUV.Item = farrayUV;
            // insert sources
            palletMesh.source = new source[] { palletPositionSource, palletPositionNormal, palletPositionUV };

            // vertices
            InputLocal verticesInput = new InputLocal() { semantic = "POSITION", source = "#pallet_position" };
            palletMesh.vertices = new vertices() { id = "pallet_vertex", input = new InputLocal[] { verticesInput } };

            triangles trianglesPallet = new triangles() { material = "materialPallet", count = triangleCount };
            trianglesPallet.input = new InputLocalOffset[]
                                    {
                                        new InputLocalOffset() { semantic="VERTEX", source="#pallet_vertex", offset=0}
                                        , new InputLocalOffset() { semantic="NORMAL", source="#pallet_normal", offset=1}
                                        , new InputLocalOffset() { semantic="TEXCOORD", source="#pallet_UV", offset=2, set=0, setSpecified=true }
                                    };

            trianglesPallet.p = triangle_string;
            palletMesh.Items = new object[] { trianglesPallet };

            return palletMesh;
        }
Esempio n. 31
0
 /// <summary>
 /// Creates a new cylinder/pallet analysis without generating solutions
 /// </summary>
 /// <param name="name">Name</param>
 /// <param name="description">Description</param>
 /// <param name="cylinder">Cylinder</param>
 /// <param name="pallet">Pallet</param>
 /// <param name="interlayer">Interlayer or null</param>
 /// <param name="constraintSet">Cylinder/pallet analysis constraint set</param>
 /// <param name="solutions">Solutions</param>
 /// <returns>Cylinder/pallet analysis</returns>
 public HCylinderPalletAnalysis CreateNewHCylinderPalletAnalysis(
     string name, string description
     , CylinderProperties cylinder, PalletProperties pallet
     , HCylinderPalletConstraintSet constraintSet
     , List<HCylinderPalletSolution> solutions)
 {
     HCylinderPalletAnalysis analysis = new HCylinderPalletAnalysis(cylinder, pallet, constraintSet);
     analysis.Name = name;
     analysis.Description = description;
     // insert in list
     _hCylinderPalletAnalyses.Add(analysis);
     // set solutions
     analysis.Solutions = solutions;
     // notify listeners
     NotifyOnNewHCylinderPalletAnalysisCreated(analysis);
     // set solution selected if its unique
     if (solutions.Count == 1)
         analysis.SelectSolutionByIndex(0);
     return analysis;
 }
Esempio n. 32
0
 public PalletProperties CreateNewPallet(PalletProperties palletProp)
 {
     PalletProperties palletPropClone = new PalletProperties(this, palletProp.TypeName, palletProp.Length, palletProp.Width, palletProp.Height);
     palletPropClone.Name = palletProp.Name;
     palletPropClone.Description = palletProp.Description;
     palletPropClone.Weight = palletProp.Weight;
     palletPropClone.Color = palletProp.Color;
     palletPropClone.AdmissibleLoadWeight = palletProp.AdmissibleLoadWeight;
     // insert in list
     _typeList.Add(palletPropClone);
     // notify listeners
     NotifyOnNewTypeCreated(palletPropClone);
     Modify();
     return palletPropClone;           
 }
Esempio n. 33
0
 public AnalysisHCylPallet(Document doc, CylinderProperties cylinder, PalletProperties palletProperties, ConstraintSetPackablePallet constraintSet)
     : base(doc, cylinder)
 {
     _palletProperties = palletProperties;
     ConstraintSet     = constraintSet;
 }
Esempio n. 34
0
 private Layer2D BuildLayer(PackProperties packProperties, PalletProperties palletProperties, PackPalletConstraintSet constraintSet, HalfAxis.HAxis axisOrtho, bool swapped, bool inversed)
 {
     double forcedSpace = constraintSet.MinimumSpace.Value;
     return new Layer2D(
             new Vector3D(packProperties.Length + forcedSpace, packProperties.Width + forcedSpace, packProperties.Height)
             , new Vector2D(
                 palletProperties.Length + constraintSet.OverhangX + forcedSpace
                 , _palletProperties.Width + constraintSet.OverhangY + forcedSpace)
             , axisOrtho, swapped);
 }
Esempio n. 35
0
 public Pallet(PalletProperties palletProperties)
 {
     _length = palletProperties.Length;
     _width = palletProperties.Width;
     _height = palletProperties.Height;
     _color = palletProperties.Color;
     _typeName = palletProperties.TypeName;
 }
Esempio n. 36
0
        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;
        }
Esempio n. 37
0
 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;
 }
Esempio n. 38
0
 public HCylinderPalletAnalysis CreateNewHCylinderPalletAnalysis(
     string name, string description,
     CylinderProperties cylinder, PalletProperties pallet,
     HCylinderPalletConstraintSet constraintSet,
     IHCylinderAnalysisSolver solver)
 {
     HCylinderPalletAnalysis analysis = new HCylinderPalletAnalysis(cylinder, pallet, constraintSet);
     analysis.Name = name;
     analysis.Description = description;
     // insert in list
     _hCylinderPalletAnalyses.Add(analysis);
     // compute analysis
     solver.ProcessAnalysis(analysis);
     if (analysis.Solutions.Count < 1)
     {   // remove analysis from list if it has no valid solution
         _hCylinderPalletAnalyses.Remove(analysis);
         return null;
     }
     // notify listeners
     NotifyOnNewHCylinderPalletAnalysisCreated(analysis);
     Modify();
     return analysis;
 }
Esempio n. 39
0
 public PalletItem(PalletProperties palletProperties)
 {
     _palletProperties = palletProperties;
 }
        /// <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));
        }
Esempio n. 41
0
 /// <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;
 }
Esempio n. 42
0
 /// <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;
 }
Esempio n. 43
0
 internal PalletProperties ToPallet(DataPallet dtPallet)
 {
     PalletProperties palletProperties = new PalletProperties(null, dtPallet.TypeName
         , dtPallet.Dimensions[0], dtPallet.Dimensions[1], dtPallet.Dimensions[2]
         );
     palletProperties.Name = dtPallet.Name;
     palletProperties.Description = dtPallet.Description;
     return palletProperties;
 }