Пример #1
0
        public static void GenerateExport(Vector3D caseDim, double caseWeight, Bitmap bmpTexture,
                                          int palletIndex, double palletWeight,
                                          int layerNumber,
                                          List <BoxPositionIndexed> boxPositions,
                                          bool mirrorLength, bool mirrorWidth,
                                          List <bool> interlayers,
                                          string filePath,
                                          ref int caseCount, ref int layerCount,
                                          ref double weightLoad, ref double weightTotal,
                                          ref Vector3D bbLoad, ref Vector3D bbGlob
                                          )
        {
            SolutionLayered.SetSolver(new LayerSolver());
            // case
            var boxProperties = new BoxProperties(null, caseDim.X, caseDim.Y, caseDim.Z)
            {
                TapeColor = Color.Tan,
                TapeWidth = new OptDouble(true, 50.0)
            };

            if (null != bmpTexture)
            {
                double ratio = (double)bmpTexture.Height / bmpTexture.Width;

                boxProperties.AddTexture(HalfAxis.HAxis.AXIS_X_N, TexturePosition(caseDim.Y, caseDim.Z, ratio), TextureSize(caseDim.Y, caseDim.Z, ratio), 0.0, bmpTexture);
                boxProperties.AddTexture(HalfAxis.HAxis.AXIS_X_P, TexturePosition(caseDim.Y, caseDim.Z, ratio), TextureSize(caseDim.Y, caseDim.Z, ratio), 0.0, bmpTexture);
                boxProperties.AddTexture(HalfAxis.HAxis.AXIS_Y_N, TexturePosition(caseDim.X, caseDim.Z, ratio), TextureSize(caseDim.X, caseDim.Z, ratio), 0.0, bmpTexture);
                boxProperties.AddTexture(HalfAxis.HAxis.AXIS_Y_P, TexturePosition(caseDim.X, caseDim.Z, ratio), TextureSize(caseDim.X, caseDim.Z, ratio), 0.0, bmpTexture);
            }
            boxProperties.SetWeight(caseWeight);
            boxProperties.SetAllColors(Enumerable.Repeat(Color.Beige, 6).ToArray());
            // pallet
            Vector3D palletDim        = PalletIndexToDim3D(palletIndex);
            var      palletProperties = new PalletProperties(null, PalletIndexToPalletType(palletIndex), palletDim.X, palletDim.Y, palletDim.Z)
            {
                Weight = palletWeight,
                Color  = Color.Yellow
            };
            // constraint set
            var constraintSet = new ConstraintSetCasePallet();

            constraintSet.SetAllowedOrientations(new bool[] { false, false, true });
            constraintSet.OptMaxLayerNumber = layerNumber;
            // layer 2D
            var layer2D = new Layer2DBrickExpIndexed(caseDim, new Vector2D(), "", HalfAxis.HAxis.AXIS_Z_P);

            layer2D.SetPositions(boxPositions);
            // analysis
            var analysis = new AnalysisCasePallet(boxProperties, palletProperties, constraintSet);

            analysis.AddInterlayer(new InterlayerProperties(null, "interlayer", "", palletDim.X, palletDim.Y, 1.0, 0.0, Color.White));
            analysis.AddSolution(layer2D, mirrorLength, mirrorWidth);
            // solution
            SolutionLayered sol           = analysis.SolutionLay;
            var             solutionItems = sol.SolutionItems;
            int             iCount        = solutionItems.Count;

            for (int i = 0; i < iCount; ++i)
            {
                solutionItems[i].InterlayerIndex = ((i < interlayers.Count) && interlayers[i]) ? 0 : -1;
            }
            if (iCount < interlayers.Count && interlayers[iCount])
            {
                analysis.PalletCapProperties = new PalletCapProperties(null, "palletcap", "", palletDim.X, palletDim.Y, 1, palletDim.X, palletDim.Y, 0.0, 0.0, Color.White);
            }
            layerCount  = analysis.SolutionLay.LayerCount;
            caseCount   = analysis.Solution.ItemCount;
            weightLoad  = analysis.Solution.LoadWeight;
            weightTotal = analysis.Solution.Weight;
            bbGlob      = analysis.Solution.BBoxGlobal.DimensionsVec;
            bbLoad      = analysis.Solution.BBoxLoad.DimensionsVec;
            // export file
            var exporter = new ExporterGLB();

            exporter.Export(analysis, filePath);
        }
Пример #2
0
    public static void GenerateExport(Vector3D caseDim, double caseWeight, Bitmap bmpTexture,
                                      Vector3D palletDim, double palletWeight,
                                      double maxPalletHeight,
                                      List <BoxPosition> boxPositions,
                                      bool mirrorLength, bool mirrorWidth,
                                      bool interlayerBottom, bool interlayerIntermediate, bool interlayerTop,
                                      string filePath,
                                      ref int caseCount, ref int layerCount,
                                      ref double weightLoad, ref double weightTotal,
                                      ref Vector3D bbLoad, ref Vector3D bbGlob
                                      )
    {
        SolutionLayered.SetSolver(new LayerSolver());
        // case
        var boxProperties = new BoxProperties(null, caseDim.X, caseDim.Y, caseDim.Z)
        {
            TapeColor = Color.Tan,
            TapeWidth = new OptDouble(true, 50.0)
        };

        if (null != bmpTexture)
        {
            double ratio = (double)bmpTexture.Height / bmpTexture.Width;

            boxProperties.AddTexture(HalfAxis.HAxis.AXIS_X_N, TexturePosition(caseDim.Y, caseDim.Z, ratio), TextureSize(caseDim.Y, caseDim.Z, ratio), 0.0, bmpTexture);
            boxProperties.AddTexture(HalfAxis.HAxis.AXIS_X_P, TexturePosition(caseDim.Y, caseDim.Z, ratio), TextureSize(caseDim.Y, caseDim.Z, ratio), 0.0, bmpTexture);
            boxProperties.AddTexture(HalfAxis.HAxis.AXIS_Y_N, TexturePosition(caseDim.X, caseDim.Z, ratio), TextureSize(caseDim.X, caseDim.Z, ratio), 0.0, bmpTexture);
            boxProperties.AddTexture(HalfAxis.HAxis.AXIS_Y_P, TexturePosition(caseDim.X, caseDim.Z, ratio), TextureSize(caseDim.X, caseDim.Z, ratio), 0.0, bmpTexture);
        }
        boxProperties.SetWeight(caseWeight);
        boxProperties.SetAllColors(Enumerable.Repeat(Color.Beige, 6).ToArray());
        // pallet
        var palletProperties = new PalletProperties(null, "EUR2", palletDim.X, palletDim.Y, palletDim.Z)
        {
            Weight = palletWeight,
            Color  = Color.Yellow
        };
        // constraint set
        var constraintSet = new ConstraintSetCasePallet();

        constraintSet.SetAllowedOrientations(new bool[] { false, false, true });
        constraintSet.SetMaxHeight(new OptDouble(true, maxPalletHeight));
        // layer 2D
        var layer2D = new Layer2DBrickExp(caseDim, new Vector2D(), "", HalfAxis.HAxis.AXIS_Z_P);

        layer2D.SetPositions(boxPositions);
        // analysis
        var analysis = new AnalysisCasePallet(boxProperties, palletProperties, constraintSet);

        analysis.AddInterlayer(new InterlayerProperties(null, "interlayer", "", palletDim.X, palletDim.Y, 1.0, 0.0, Color.LightYellow));
        analysis.AddSolution(layer2D, mirrorLength, mirrorWidth);
        if (interlayerTop)
        {
            analysis.PalletCapProperties = new PalletCapProperties(null, "palletcap", "", palletDim.X, palletDim.Y, 1, palletDim.X, palletDim.Y, 0.0, 0.0, Color.LightYellow);
        }
        // solution
        SolutionLayered sol           = analysis.SolutionLay;
        var             solutionItems = sol.SolutionItems;
        int             iCount        = solutionItems.Count;

        for (int i = 0; i < iCount; ++i)
        {
            bool hasInterlayer = (i == 0 && interlayerBottom) ||
                                 (i != 0 && interlayerIntermediate);
            solutionItems[i].InterlayerIndex = hasInterlayer ? 0 : -1;
        }
        layerCount  = analysis.SolutionLay.LayerCount;
        caseCount   = analysis.Solution.ItemCount;
        weightLoad  = analysis.Solution.LoadWeight;
        weightTotal = analysis.Solution.Weight;
        bbGlob      = analysis.Solution.BBoxGlobal.DimensionsVec;
        bbLoad      = analysis.Solution.BBoxLoad.DimensionsVec;
        // export file
        var exporter = new ExporterGLB();

        exporter.Export(analysis as AnalysisLayered, filePath);
    }