public CaseDefinitionViewer(CaseDefinition caseDefinition, BoxProperties boxProperties, CaseOptimConstraintSet caseConstraintSet)
 {
     _caseDefinition = caseDefinition;
     _boxProperties = boxProperties;
     _caseOptimConstraintSet = caseConstraintSet;
     _globalOrientation = new Orientation(HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Y_P);
 }
Esempio n. 2
0
        static void Main(string[] args)
        {

            bool bestLayersOnly = true;
            Vector3D dimBox = new Vector3D(400.0, 300.0, 150.0);
            Vector2D dimContainer = new Vector2D(1200.0, 1000.0);
            ConstraintSetCasePallet constraintSet = new ConstraintSetCasePallet();
            constraintSet.SetMaxHeight(1200.0); 

            try
            {
                LayerSolver solver = new LayerSolver();
                List<Layer2D> layers = solver.BuildLayers(dimBox, dimContainer, constraintSet, bestLayersOnly);

                int solIndex = 0;
                foreach (Layer2D layer in layers)
                {
                    string fileName = string.Format("{0}_{1}.bmp", layer.Name, solIndex++);
                    string filePath = Path.Combine(Path.GetTempPath(), fileName);
                    Console.WriteLine(string.Format("Generating {0}...", filePath));

                    Graphics2DImage graphics = new Graphics2DImage( new Size(150, 150) );
                    SolutionViewerLayer solViewer = new SolutionViewerLayer(layer);
                    BoxProperties bProperties = new BoxProperties(null, 400.0, 300.0, 150.0);
                    bProperties.SetColor(Color.Brown);
                    solViewer.Draw(graphics, bProperties, 1500.0);
                    graphics.SaveAs(filePath);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
 public void ProcessAnalysis(BoxCasePalletAnalysis analysis)
 {
     _boxProperties = analysis.BoxProperties;
     _interlayerProperties = analysis.InterlayerProperties;
     _palletSolutionList = analysis.PalletSolutionsList;
     _constraintSet = analysis.ConstraintSet;
     analysis.Solutions = GenerateSolutions();
 }
Esempio n. 4
0
 public BoxCaseAnalysis(BProperties bProperties, BoxProperties caseProperties, BCaseConstraintSet constraintSet)
     : base(bProperties.ParentDocument)
 {
     if (!constraintSet.IsValid)
         throw new Exception("Using invalid box/case constraintset -> Can not instantiate box/case analysis!");
     this.BProperties = bProperties;
     this.CaseProperties = caseProperties;
     _constraintSet = constraintSet;
 }
 public BoxCasePalletAnalysis(BoxProperties boxProperties, List<PalletSolutionDesc> palletSolutionList, BoxCasePalletConstraintSet constraintSet)
     : base(boxProperties.ParentDocument)
 {
     if (!constraintSet.IsValid)
         throw new Exception("Using invalid case constraintset -> Can not instantiate case analysis!");
     _boxProperties = boxProperties;
     boxProperties.AddDependancy(this);
     _palletSolutionsList = palletSolutionList;
     _constraintSet = constraintSet;
 }
Esempio n. 6
0
 public CaseOptimizer(
     BoxProperties boxProperties
     , PalletProperties palletProperties
     , PalletConstraintSet palletContraintSet
     , CaseOptimConstraintSet caseOptimConstraintSet)
 {
     _boxProperties = boxProperties;
     _palletProperties = palletProperties;
     _palletConstraintSet = palletContraintSet;
     _caseOptimConstraintSet = caseOptimConstraintSet;
 }
Esempio n. 7
0
        public void ProcessAnalysis(BoxCaseAnalysis analysis)
        {
            _bProperties = analysis.BProperties;
            _caseProperties = analysis.CaseProperties;
            _constraintSet = analysis.ConstraintSet;

            if (!_constraintSet.IsValid)
                throw new EngineException("Constraint set is invalid!");

            analysis.Solutions = GenerateSolutions();
        }
Esempio n. 8
0
 public Case(BoxProperties boxProperties)
 {
     _length = boxProperties.Length;
     _width = boxProperties.Width;
     _height = boxProperties.Height;
     _insideLength = boxProperties.InsideLength;
     _insideWidth = boxProperties.InsideWidth;
     _insideHeight = boxProperties.InsideHeight;
     _colors = boxProperties.Colors;
     _colorPath = Color.Black;
 }
Esempio n. 9
0
 public Case(BoxProperties boxProperties, Transform3D transf)
 {
     _length = boxProperties.Length;
     _width = boxProperties.Width;
     _height = boxProperties.Height;
     _insideLength = boxProperties.InsideLength;
     _insideWidth = boxProperties.InsideWidth;
     _insideHeight = boxProperties.InsideHeight;
     _colors = boxProperties.Colors;
     _colorPath = Color.Black;
     _transf = transf;
 }
Esempio n. 10
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. 11
0
 /// <summary>
 /// constructor (from existing BoxProperties)
 /// </summary>
 public FormEditBitmaps(BoxProperties boxProperties)
 {
     InitializeComponent();
     // set unit labels
     UnitsManager.AdaptUnitLabels(this);
     // set internal box properties
     _boxProperties = boxProperties;
     // get textures
     _textures = _boxProperties.TextureListCopy;
     // set default face
     cbFace.SelectedIndex = 0;
     // set horizontal angle
     trackBarHorizAngle.Value = 225;
 }
        /// <summary>
        /// Instantiate a new case from a box, a case definition and a case optimization constraintset
        /// </summary>
        /// <param name="document">Parent document</param>
        /// <param name="bProperties">Box properties</param>
        /// <param name="constraintSet">Case optimization constraint set</param>
        public CaseOfBoxesProperties(Document document
            , BoxProperties boxProperties
            , CaseDefinition caseDefinition
            , CaseOptimConstraintSet constraintSet)
            : base(document)
        {
            _boxProperties = boxProperties;
            _boxProperties.AddDependancy(this);
            _caseDefinition = caseDefinition;
            _constraintSet = constraintSet;

            base.Weight = _caseDefinition.CaseEmptyWeight(_boxProperties, _constraintSet);

            OnAttributeModified(boxProperties);
        }
        /// <summary>
        /// Instantiate a new case from a box, a case definition and a case optimization constraintset
        /// </summary>
        /// <param name="document">Parent document</param>
        /// <param name="bProperties">Box properties</param>
        /// <param name="constraintSet">Case optimization constraint set</param>
        public CaseOfBoxesProperties(Document document
                                     , BoxProperties boxProperties
                                     , CaseDefinition caseDefinition
                                     , ParamSetPackOptim constraintSet)
            : base(document)
        {
            _boxProperties = boxProperties;
            _boxProperties.AddDependancy(this);
            _caseDefinition = caseDefinition;
            _constraintSet  = constraintSet;

            SetWeight(_caseDefinition.CaseEmptyWeight(_boxProperties, _constraintSet));

            OnAttributeModified(boxProperties);
        }
Esempio n. 14
0
 /// <summary>
 /// constructor (from length, width, height)
 /// </summary>
 public FormEditBitmaps(double length, double width, double height, Color[] faceColors)
 {
     InitializeComponent();
     // set unit labels
     UnitsManager.AdaptUnitLabels(this);
     // set internal box properties
     _boxProperties = new BoxProperties(null, length, width, height);
     _boxProperties.SetAllColors(faceColors);
     // get textures
     _textures = _boxProperties.TextureListCopy;
     // set default face
     cbFace.SelectedIndex = 0;
     // set horizontal angle
     trackBarHorizAngle.Value = 225;
 }
Esempio n. 15
0
        static void Main(string[] args)
        {
            BoxProperties bProperties = new BoxProperties(null, 1000, 750, 500);
            Box b = new Box(0, bProperties);

            Vector3D vNear = new Vector3D(400.0, 1000.0, 0.0);
            Vector3D vFar = new Vector3D(500.0, -1000.0, 250.0);
            Ray r = new Ray(vNear, vFar);

            Vector3D ptInter;
            if (b.RayIntersect(r, out ptInter))
                Console.WriteLine("Point inter : {0}", ptInter);
            else
                Console.WriteLine("No intersection found");
        }
        /// <summary>
        /// Draw case solution
        /// </summary>
        public void Draw(Graphics3D graphics)
        {
            if (null == _caseSolution)
                throw new Exception("No case solution defined!");

            // load pallet solution
            BoxProperties caseProperties;

            CasePalletSolution palletSolution = _caseSolution.PalletSolutionDesc.LoadPalletSolution();
            if (null == palletSolution)
                caseProperties = new BoxProperties(null, _caseSolution.CaseLength, _caseSolution.CaseWidth, _caseSolution.CaseHeight);
            else
            {
                CasePalletAnalysis palletAnalysis = palletSolution.Analysis;
                // retrieve case properties 
                caseProperties = palletAnalysis.BProperties as BoxProperties;
            }
            if (null == caseProperties) return;
            // draw case (inside)
            Case case_ = new Case(caseProperties);
            case_.DrawInside(graphics);
            // get case analysis
            BoxCasePalletAnalysis caseAnalysis = _caseSolution.ParentCaseAnalysis;
            // draw solution
            uint pickId = 0;
            foreach (ILayer layer in _caseSolution)
            {
                BoxLayer blayer = layer as BoxLayer;
                if (null != blayer)
                {
                    foreach (BoxPosition bPosition in blayer)
                        graphics.AddBox(new Box(pickId++, caseAnalysis.BoxProperties, bPosition));
                }

                InterlayerPos interlayerPos = layer as InterlayerPos;
                if (null != interlayerPos)
                {
                    Box box = new Box(pickId++, caseAnalysis.InterlayerProperties);
                    // set position
                    box.Position = new Vector3D(0.0, 0.0, interlayerPos.ZLow);
                    // draw
                    graphics.AddBox(box);
                }
            }
            // get case analysis
            if (_showDimensions)
                graphics.AddDimensions(new DimensionCube(_caseSolution.CaseLength, _caseSolution.CaseWidth, _caseSolution.CaseHeight));
        }
Esempio n. 17
0
        // static methods
        static public double EstimateWeight(
            BoxProperties boxProperties, PackArrangement arrangement, HalfAxis.HAxis orientation
            , int[] noWalls, double thickness, double surfacicMass)
        {
            double length = 0.0, width = 0.0, height = 0.0;
            PackProperties.GetDimensions(boxProperties, orientation, arrangement, ref length, ref width, ref height);
            Vector3D vDimensions = new Vector3D(
                length + noWalls[0] * thickness
                , width + noWalls[1] * thickness
                , height + noWalls[2] * thickness);

            double area = (noWalls[0] * vDimensions.Y * vDimensions.Z
                + noWalls[1] * vDimensions.X * vDimensions.Z
                + noWalls[2] * vDimensions.X * vDimensions.Y) * UnitsManager.FactorSquareLengthToArea;
            return area * surfacicMass;
        }
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
        // static methods
        static public double EstimateWeight(
            BoxProperties boxProperties, PackArrangement arrangement, HalfAxis.HAxis orientation
            , int[] noWalls, double thickness, double surfacicMass)
        {
            double length = 0.0, width = 0.0, height = 0.0;

            PackProperties.GetDimensions(boxProperties, orientation, arrangement, ref length, ref width, ref height);
            Vector3D vDimensions = new Vector3D(
                length + noWalls[0] * thickness
                , width + noWalls[1] * thickness
                , height + noWalls[2] * thickness);

            double area = (noWalls[0] * vDimensions.Y * vDimensions.Z
                           + noWalls[1] * vDimensions.X * vDimensions.Z
                           + noWalls[2] * vDimensions.X * vDimensions.Y) * UnitsManager.FactorSquareLengthToArea;

            return(area * surfacicMass);
        }
Esempio n. 20
0
        protected AnalysisPackableCase(
            Document document,
            Packable packable,
            BoxProperties caseProperties,
            ConstraintSetPackableCase constraintSet)
            : base(document, packable)
        {
            // sanity checks
            if (null != ParentDocument &&
                (null != caseProperties.ParentDocument) &&
                caseProperties.ParentDocument != ParentDocument)
            {
                throw new Exception("box & case do not belong to the same document");
            }
            // also add dependancy
            CaseProperties = caseProperties;

            ConstraintSet = constraintSet;
        }
Esempio n. 21
0
 public bool FitsIn(BoxProperties caseProperties, bool allowVerticalX, bool allowVerticalY, bool allowVerticalZ)
 {
     double[] dimItem = OuterDimensionsArray;
     double[] dimCase = caseProperties.InsideDimensionsArray;
     if (allowVerticalX)
     {
         if (
             (dimItem[0] <= dimCase[0]) && (
                 ((dimItem[1] <= dimCase[1]) && (dimItem[2] <= dimCase[2])) ||
                 ((dimItem[1] <= dimCase[2]) && (dimItem[2] <= dimCase[1])))
             )
         {
             return(true);
         }
     }
     if (allowVerticalY)
     {
         if (
             (dimItem[1] <= dimCase[1]) && (
                 ((dimItem[0] <= dimCase[0]) && (dimItem[2] <= dimCase[2])) ||
                 ((dimItem[0] <= dimCase[2]) && (dimItem[2] <= dimCase[0])))
             )
         {
             return(true);
         }
     }
     if (allowVerticalZ)
     {
         if (
             (dimItem[2] <= dimCase[2]) && (
                 ((dimItem[0] <= dimCase[0]) && (dimItem[1] <= dimCase[1])) ||
                 ((dimItem[0] <= dimCase[1]) && (dimItem[1] <= dimCase[0])))
             )
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 22
0
        protected mesh CreateComplexCaseMesh(BoxProperties caseProperties)
        {
            // build box
            Box box = new Box(0, caseProperties);
            // build list of vertex
            double ct = 5.0;
            Vector3D[] vertices = new Vector3D[16];
            // 1st layer
            vertices[0] = new Vector3D(ct, ct, 0.0);
            vertices[1] = new Vector3D(box.Length - ct, ct, 0.0);
            vertices[2] = new Vector3D(box.Length - ct, box.Width - ct, 0.0);
            vertices[3] = new Vector3D(ct, box.Width - ct, 0.0);
            // 2nd layer (8)
            vertices[4] = new Vector3D(0.0, 0.0, ct);
            vertices[5] = new Vector3D(box.Length, 0.0, ct);
            vertices[6] = new Vector3D(box.Length, box.Width, ct);
            vertices[7] = new Vector3D(0.0, box.Width, ct);
            // 3rd later (8)
            vertices[8] = new Vector3D(0.0, 0.0, box.Height - ct);
            vertices[9] = new Vector3D(box.Length, 0.0, box.Height - ct);
            vertices[10] = new Vector3D(box.Length, box.Width, box.Height - ct);
            vertices[11] = new Vector3D(0.0, box.Width, box.Height - ct);
            // 4th layer
            vertices[12] = new Vector3D(ct, ct, box.Height);
            vertices[13] = new Vector3D(box.Length - ct, ct, box.Height);
            vertices[14] = new Vector3D(box.Length - ct, box.Width - ct, box.Height);
            vertices[15] = new Vector3D(ct, box.Width - ct, box.Height);

            // build list of loops
            Loop[] loops = new Loop[14];

            mesh caseMesh = new mesh();
            return caseMesh;
        }
        public double InnerVolume(BoxProperties boxProperties)
        {
            Vector3D innerDim = InnerDimensions(boxProperties);

            return(innerDim.X * innerDim.Y * innerDim.Z);
        }
Esempio n. 24
0
 private void InsertPictogram(ref BoxProperties boxProperties)
 {
     string pictoPath = Properties.Settings.Default.pictoTOP;
     if (File.Exists(pictoPath))
     {
         // load image
         Bitmap bmp = new Bitmap(pictoPath);
         // case dimensions
         double length = boxProperties.Length;
         double width = boxProperties.Width;
         double height = boxProperties.Height;
         // dimensions and margins
         double margin = 2;
         double pictoSize = 10;
         double minDim = Math.Min(Math.Min(length, width), Math.Min(width, height));
         if (minDim < pictoSize) { margin = 0.0; pictoSize = minDim; }
         // top position
         double topPos = boxProperties.Height - margin - pictoSize;
         // insert picto as a texture
         boxProperties.AddTexture(HalfAxis.HAxis.AXIS_X_N
             , UnitsManager.ConvertLengthFrom(new Vector2D(width - margin - pictoSize, topPos), UnitsManager.UnitSystem.UNIT_METRIC2)
             , UnitsManager.ConvertLengthFrom(new Vector2D(pictoSize, pictoSize), UnitsManager.UnitSystem.UNIT_METRIC2)
             , 0, bmp);
         boxProperties.AddTexture(HalfAxis.HAxis.AXIS_X_P
             , UnitsManager.ConvertLengthFrom(new Vector2D(width - margin - pictoSize, topPos), UnitsManager.UnitSystem.UNIT_METRIC2)
             , UnitsManager.ConvertLengthFrom(new Vector2D(pictoSize, pictoSize), UnitsManager.UnitSystem.UNIT_METRIC2)
             , 0, bmp);
         boxProperties.AddTexture(HalfAxis.HAxis.AXIS_Y_N
             , UnitsManager.ConvertLengthFrom(new Vector2D(length - margin - pictoSize, topPos), UnitsManager.UnitSystem.UNIT_METRIC2)
             , UnitsManager.ConvertLengthFrom(new Vector2D(pictoSize, pictoSize), UnitsManager.UnitSystem.UNIT_METRIC2)
             , 0, bmp);
         boxProperties.AddTexture(HalfAxis.HAxis.AXIS_Y_P
             , UnitsManager.ConvertLengthFrom(new Vector2D(length - margin - pictoSize, topPos), UnitsManager.UnitSystem.UNIT_METRIC2)
             , UnitsManager.ConvertLengthFrom(new Vector2D(pictoSize, pictoSize), UnitsManager.UnitSystem.UNIT_METRIC2)
             , 0, bmp);
     }
 }
Esempio n. 25
0
        public override BBox3D AdditionalBoudingBox(int index)
        {
            BoxProperties bProperties = _containers[index] as BoxProperties;

            return(new BBox3D(Vector3D.Zero, bProperties.OuterDimensions));
        }
Esempio n. 26
0
        public override Vector3D DimContainer(int index)
        {
            BoxProperties bProperties = _containers[index] as BoxProperties;

            return(bProperties.InsideDimensions);
        }
Esempio n. 27
0
 public bool FitsIn(BoxProperties caseProperties, bool allowVerticalX, bool allowVerticalY, bool allowVerticalZ)
 {
     double[] dimItem = OuterDimensions;
     double[] dimCase = caseProperties.InsideDimensions;
     if (allowVerticalX)
     {
         if (
             (dimItem[0] <= dimCase[0]) && (
                 ( (dimItem[1] <= dimCase[1]) && (dimItem[2] <= dimCase[2]) )
             || ( (dimItem[1] <= dimCase[2]) && (dimItem[2] <= dimCase[1]) ) )
             )
         return true;
     }
     if (allowVerticalY)
     {
         if (
             (dimItem[1] <= dimCase[1]) && (
                 ((dimItem[0] <= dimCase[0]) && (dimItem[2] <= dimCase[2]))
             || ((dimItem[0] <= dimCase[2]) && (dimItem[2] <= dimCase[0])))
             )
             return true;
     }
     if (allowVerticalZ)
     {
         if (
             (dimItem[2] <= dimCase[2]) && (
                 ((dimItem[0] <= dimCase[0]) && (dimItem[1] <= dimCase[1]))
             || ((dimItem[0] <= dimCase[1]) && (dimItem[1] <= dimCase[0])))
             )
             return true;
     }
     return false;
 }
 public double BoxWidth(BoxProperties boxProperties)
 {
     return(boxProperties.Dim(_dim1));
 }
 public double InnerWeight(BoxProperties boxProperties)
 {
     return(_arrangement.Number * boxProperties.Weight);
 }
Esempio n. 30
0
 internal BoxProperties ToBox(DataBox dtBox)
 {
     BoxProperties boxProperties = new BoxProperties(null
         , dtBox.Dimensions[0], dtBox.Dimensions[1], dtBox.Dimensions[2]);
     boxProperties.Name = dtBox.Name;
     boxProperties.Description = dtBox.Description;
     Color[] colors = new Color[6];
     for (int i = 0; i < 6; ++i) colors[i] = Color.Turquoise;
     boxProperties.SetAllColors(colors);
     boxProperties.ShowTape = false;
     boxProperties.Weight = dtBox.Weight;
     boxProperties.NetWeight = new OptDouble(dtBox.NetWeight > 0, dtBox.NetWeight);
     return boxProperties;
 }
Esempio n. 31
0
 internal BoxProperties ToCase(DataCase dtCase)
 {
     BoxProperties boxProperties = new BoxProperties(null
          , dtCase.OuterDimensions[0], dtCase.OuterDimensions[1], dtCase.OuterDimensions[2]
          , dtCase.InnerDimensions[0], dtCase.InnerDimensions[1], dtCase.InnerDimensions[2]);
     Color[] colors = new Color[6];
     for (int i = 0; i < 6; ++i) colors[i] = Color.Chocolate;
     boxProperties.Name = dtCase.Name;
     boxProperties.Description = dtCase.Description;
     boxProperties.SetAllColors(colors);
     boxProperties.ShowTape = true;
     boxProperties.TapeColor = Color.Beige;
     boxProperties.TapeWidth = UnitsManager.ConvertLengthFrom(50, UnitsManager.UnitSystem.UNIT_METRIC1);
     boxProperties.Weight = dtCase.Weight;
     boxProperties.NetWeight = new OptDouble(dtCase.NetWeight > 0.0, dtCase.NetWeight);
     return boxProperties;
 }
Esempio n. 32
0
 public BoxCasePalletAnalysis CreateNewBoxCasePalletOptimization(
     string name, string description
     , BoxProperties bProperties
     , BoxCasePalletConstraintSet constraintSet
     , List<PalletSolutionDesc> palletSolutionList
     , IBoxCasePalletAnalysisSolver solver)
 {
     BoxCasePalletAnalysis analysis = new BoxCasePalletAnalysis(bProperties, palletSolutionList, constraintSet);
     analysis.Name = name;
     analysis.Description = description;
     // insert in list
     _boxCasePalletOptimizations.Add(analysis);
     // compute analysis
     if (null != solver)
     {
         solver.ProcessAnalysis(analysis);
         if (analysis.Solutions.Count < 1)
         {	// remove analysis from list if it has no valid solution
             _boxCasePalletOptimizations.Remove(analysis);
             _log.InfoFormat("Failed to find any solution {0}", analysis.Name);
             return null;
         }
     }
     // notify listeners
     NotifyOnNewCaseAnalysisCreated(analysis);
     Modify();
     return analysis;
 }
Esempio n. 33
0
 public BoxCaseAnalysis CreateNewBoxCaseAnalysis(
     string name, string description
     , BProperties boxProperties, BoxProperties caseProperties
     , BCaseConstraintSet constraintSet
     , IBoxCaseAnalysisSolver solver)
 {
     BoxCaseAnalysis analysis = new BoxCaseAnalysis(boxProperties, caseProperties, constraintSet);
     analysis.Name = name;
     analysis.Description = description;
     // insert in list
     _boxCaseAnalyses.Add(analysis);
     // compute analysis
     if (null != solver)
     {
         solver.ProcessAnalysis(analysis);
         if (analysis.Solutions.Count < 1)
         {	// remove analysis from list if it has no valid solution
             _boxCaseAnalyses.Remove(analysis);
             return null;
         }
     }
     // notify listeners
     NotifyOnNewBoxCaseAnalysis(analysis);
     Modify();
     return analysis;
 }
 public double TotalWeight(BoxProperties boxProperties, CaseOptimConstraintSet constraintSet)
 {
     return(InnerWeight(boxProperties) + EmptyWeight(boxProperties, constraintSet));
 }
Esempio n. 35
0
        protected mesh CreateCaseMesh(BoxProperties caseProperties)
        {
            // build box
            Box box = new Box(0, caseProperties);
            // build list of vertices / normals / UVs
            ulong vertexCount = 0, normalCount = 0, uvCount = 0;
            List<double> doubleArrayPosition = new List<double>(), doubleArrayNormal = new List<double>(), doubleArrayUV = new List<double>();
            foreach (Vector3D p in box.PointsSmallOffset)
            {
                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;
            }

            mesh caseMesh = new mesh();

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

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

            // uv source
            source casePositionUV = new source() { id = "case_UV", name = "pallet_UV" };
            float_array farrayUV = new float_array { id = "case_UV_float_array", count = (ulong)doubleArrayUV.Count, Values = doubleArrayUV.ToArray() };
            casePositionUV.technique_common = new sourceTechnique_common()
            {
                accessor = new accessor()
                {
                    stride = 2,
                    count = vertexCount,
                    source = "#case_UV_float_array",
                    param = new param[] { new param() { name = "S", type = "float" }, new param() { name = "T", type = "float" } }
                }
            };
            casePositionUV.Item = farrayUV;
            // insert sources
            caseMesh.source = new source[] { casePositionSource, casePositionNormal, casePositionUV };

            // vertices
            InputLocal verticesInput = new InputLocal() { semantic = "POSITION", source = "#case_position" };
            caseMesh.vertices = new vertices() { id = "case_vertex", input = new InputLocal[] { verticesInput } };

            List<object> trianglesList = new List<object>();

            // build list of triangles
            foreach (HalfAxis.HAxis axis in HalfAxis.All)
            {
                triangles trianglesCase = new triangles() { material = string.Format("materialCase{0}", (uint)axis), count = 2 };
                trianglesCase.input = new InputLocalOffset[]
                                    {
                                        new InputLocalOffset() { semantic="VERTEX", source="#case_vertex", offset=0}
                                        , new InputLocalOffset() { semantic="NORMAL", source="#case_normal", offset=1}
                                        , new InputLocalOffset() { semantic="TEXCOORD", source="#case_UV", offset=2, set=0, setSpecified=true }
                                    };
                string triangle_string = string.Empty;
                foreach (TriangleIndices tr in box.TrianglesByFace(axis))
                    triangle_string += tr.ConvertToString(0);
                trianglesCase.p = triangle_string;
                trianglesList.Add(trianglesCase);
            }
            // build list of lines
            lines linesCase = new lines()
            {
                material = "materialCaseLines",
                count = 12,
                input = new InputLocalOffset[]
                {
                    new InputLocalOffset() { semantic="VERTEX", source="#case_vertex", offset=0}
                },
                p = "0 1 1 2 2 3 3 0 4 5 5 6 6 7 7 4 0 4 1 5 2 6 3 7"
            };
            trianglesList.Add(linesCase);

            caseMesh.Items = trianglesList.ToArray();
            return caseMesh;
        }
 public double BoxHeight(BoxProperties boxProperties)
 {
     return(boxProperties.Dim(Dim2));
 }
Esempio n. 37
0
        /// <summary>
        /// constructor
        /// </summary>
        /// <param name="doc">Reference of parent <see cref="Document"/></param>
        /// <param name="box">Reference </param>
        public PackProperties(Document doc
            , BoxProperties box
            , PackArrangement arrangement
            , HalfAxis.HAxis orientation
            , PackWrapper wrapper)
            : base(doc)
        {
            _boxProperties = box;
            _boxProperties.AddDependancy(this);

            _arrangement = arrangement;
            _orientation = orientation;
            _wrapper = wrapper;
        }
Esempio n. 38
0
 public bool FitsIn(BoxProperties caseProperties)
 {
     double[] dimItem = OuterDimensions;
     Array.Sort(dimItem);
     double[] dimCase = caseProperties.InsideDimensions;
     Array.Sort(dimCase);
     return dimItem[0] <= dimCase[0]
         && dimItem[1] <= dimCase[1]
         && dimItem[2] <= dimCase[2];
 }
Esempio n. 39
0
 public static void GetDimensions(
     BoxProperties boxProperties
     , HalfAxis.HAxis boxOrientation
     , PackArrangement arrangement
     , ref double length, ref double width, ref double height)
 {
     if (null == boxProperties) return;
     length = arrangement._iLength * boxProperties.Dim(PackProperties.DimIndex0(boxOrientation));
     width = arrangement._iWidth * boxProperties.Dim(PackProperties.DimIndex1(boxOrientation));
     height = arrangement._iHeight * boxProperties.Dim(3 - PackProperties.DimIndex0(boxOrientation) - PackProperties.DimIndex1(boxOrientation));
 }
 public double BoxLength(BoxProperties boxProperties)
 {
     return(boxProperties.Dim(_dim0));
 }
        public double OuterVolume(BoxProperties boxProperties, CaseOptimConstraintSet constraintSet)
        {
            Vector3D outerDim = OuterDimensions(boxProperties, constraintSet);

            return(outerDim.X * outerDim.Y * outerDim.Z);
        }
Esempio n. 42
0
        public override Vector3D Offset(int index)
        {
            BoxProperties bProperties = _containers[index] as BoxProperties;

            return(bProperties.OuterDimensions - bProperties.InsideDimensions);
        }
 public double CaseEmptyWeight(BoxProperties boxProperties, CaseOptimConstraintSet constraintSet)
 {
     return(constraintSet.WallSurfaceMass * Area(boxProperties, constraintSet));
 }
Esempio n. 44
0
 Layer2D BuildLayer(BoxProperties boxP, BoxProperties caseP, HalfAxis.HAxis orthoAxis, bool swapped)
 {
     return new Layer2D(new Vector3D(boxP.Length, boxP.Width, boxP.Height)
                         , new Vector2D(caseP.InsideLength, caseP.InsideWidth)
                         , orthoAxis
                         , swapped);
 }
Esempio n. 45
0
 public BoxCaseAnalysis CreateNewBoxCaseAnalysis(
     string name, string description
     , BProperties boxProperties, BoxProperties caseProperties
     , BCaseConstraintSet constraintSet
     , List<BoxCaseSolution> solutions)
 {
     BoxCaseAnalysis analysis = new BoxCaseAnalysis(boxProperties, caseProperties, constraintSet);
     analysis.Name = name;
     analysis.Description = description;
     // insert in list
     _boxCaseAnalyses.Add(analysis);
     // set solutions
     analysis.Solutions = solutions;
     // notify listeners
     NotifyOnNewBoxCaseAnalysis(analysis);
     // set solution selected if it is unique
     if (solutions.Count == 1)
         analysis.SelectSolutionByIndex(0);
     return analysis;
 }