Esempio n. 1
0
 Layer2D BuildLayer(CasePalletSolution palletSolution, TruckProperties truckProperties, TruckConstraintSet constraintSet
                    , HalfAxis.HAxis axisOrtho, bool swapped)
 {
     return(new Layer2D(new Vector3D(palletSolution.PalletLength, palletSolution.PalletWidth, palletSolution.PalletHeight)
                        , new Vector2D(truckProperties.Length, truckProperties.Width)
                        , axisOrtho, swapped));
 }
Esempio n. 2
0
 /// <summary>
 /// Constructor (edit existing properties)
 /// </summary>
 /// <param name="document">Document to which the edited item belongs</param>
 /// <param name="truckProperties">Edited item</param>
 public FormNewTruck(Document document, TruckProperties truckProperties)
     : base(document, truckProperties)
 {
     InitializeComponent();
     // initialize data
     if (null != truckProperties)
     {
         TruckLength = truckProperties.Length;
         TruckWidth = truckProperties.Width;
         TruckHeight = truckProperties.Height;
         TruckAdmissibleLoadWeight = truckProperties.AdmissibleLoadWeight;
         TruckColor = truckProperties.Color;
     }
     else
     { 
         TruckLength = UnitsManager.ConvertLengthFrom(13600, UnitsManager.UnitSystem.UNIT_METRIC1);
         TruckWidth = UnitsManager.ConvertLengthFrom(2450, UnitsManager.UnitSystem.UNIT_METRIC1);
         TruckHeight = UnitsManager.ConvertLengthFrom(2700, UnitsManager.UnitSystem.UNIT_METRIC1);
         TruckAdmissibleLoadWeight = UnitsManager.ConvertMassFrom(38000, UnitsManager.UnitSystem.UNIT_METRIC1);
         TruckColor = Color.LightBlue;            
     }
     UpdateStatus(string.Empty);
     // units
     UnitsManager.AdaptUnitLabels(this);
 }
Esempio n. 3
0
        public override void Draw(Graphics3D graphics, Transform3D transform)
        {
            if (null == Solution)
            {
                return;
            }
            // draw pallet
            if (Solution.Analysis.Containers.First() is PalletProperties palletProperties)
            {
                Pallet p = new Pallet(palletProperties);
                p.Draw(graphics, transform);
            }
            TruckProperties truckProperties = Solution.Analysis.Containers.First() as TruckProperties;

            if (null != truckProperties)
            {
                Truck t = new Truck(truckProperties);
                t.DrawBegin(graphics);
            }

            // check validity
            if (!(SolItemIndex < Solution.SolItemCount))
            {
                return;
            }
            // get list of boxes
            List <Box> boxes   = new List <Box>();
            HSolItem   solItem = Solution.SolItem(SolItemIndex);
            uint       pickId  = 0;

            foreach (HSolElement solElt in solItem.ContainedElements)
            {
                if (Analysis.ContentTypeByIndex(solElt.ContentType) is BoxProperties bProperties)
                {
                    boxes.Add(new Box(pickId++, bProperties, solElt.Position));
                }
            }
            // draw boxes as triangles using BSPTree
            BSPTree bspTree = new BSPTree();

            foreach (Box b in boxes)
            {
                bspTree.InsertBox(b);
            }
            bspTree.Draw(graphics);
            // draw truck end
            if (null != truckProperties)
            {
                Truck t = new Truck(truckProperties);
                t.DrawEnd(graphics);
            }

            // ### dimensions
            if (graphics.ShowDimensions)
            {
                graphics.AddDimensions(new DimensionCube(BoundingBoxDim(DimCasePalletSol1), Color.Black, false));
                graphics.AddDimensions(new DimensionCube(BoundingBoxDim(DimCasePalletSol2), Color.Red, true));
            }
            // ###
        }
 private void OnInputChanged(object sender, EventArgs e)
 {
     try
     {
         // get loaded pallet / truck
         PackableBrick   packable        = cbPallets.SelectedType as PackableBrick;
         TruckProperties truckProperties = cbTrucks.SelectedType as TruckProperties;
         if (null == packable || null == truckProperties)
         {
             return;
         }
         // compute
         LayerSolver    solver = new LayerSolver();
         List <Layer2D> layers = solver.BuildLayers(
             packable.OuterDimensions
             , new Vector2D(
                 truckProperties.InsideLength - 2.0 * uCtrlMinDistanceLoadWall.ValueX
                 , truckProperties.InsideWidth - 2.0 * uCtrlMinDistanceLoadWall.ValueY)
             , 0.0 /* offsetZ */
             , BuildConstraintSet()
             , checkBoxBestLayersOnly.Checked
             );
         // update control
         uCtrlLayerList.SingleSelection    = true;
         uCtrlLayerList.Packable           = packable;
         uCtrlLayerList.ContainerHeight    = truckProperties.InsideHeight - uCtrlMinDistanceLoadRoof.Value;
         uCtrlLayerList.FirstLayerSelected = true;
         uCtrlLayerList.LayerList          = layers.Cast <ILayer2D>().ToList();
     }
     catch (Exception ex)
     {
         _log.Error(ex.ToString());
     }
 }
Esempio n. 5
0
 public Truck(TruckProperties truckProperties)
 {
     Length    = truckProperties.Length;
     Width     = truckProperties.Width;
     Height    = truckProperties.Height;
     ColorFill = truckProperties.Color;
     ColorPath = Color.Black;
 }
Esempio n. 6
0
 public Truck(TruckProperties truckProperties)
 {
     _length    = truckProperties.Length;
     _width     = truckProperties.Width;
     _height    = truckProperties.Height;
     _colorFill = truckProperties.Color;
     _colorPath = Color.Black;
 }
        public void Draw(Graphics3DControl ctrl, Graphics3D graphics)
        {
            TruckProperties truckProp = _sol.ParentTruckAnalysis.TruckProperties;

            graphics.AddDimensions(new DimensionCube(_sol.LoadBoundingBox, Color.Red, false));
            graphics.AddDimensions(new DimensionCube(Vector3D.Zero, truckProp.Length, truckProp.Width, truckProp.Height, Color.Black, true));
            // draw solution
            TruckSolutionViewer sv = new TruckSolutionViewer(_sol);

            sv.Draw(graphics);
        }
 public Truck(
     string type,
     string name,
     VehicleModel model,
     TruckProperties properties,
     TruckTrailer trailer) : base(type,
                                  name,
                                  model)
 {
     Trailer    = trailer;
     Properties = properties;
 }
Esempio n. 9
0
 public void Draw(Graphics3DControl ctrl, Graphics3D graphics)
 {
     if (TruckLength == 0 || TruckWidth == 0 || TruckHeight == 0)
         return;
     TruckProperties truckProperties = new TruckProperties(null, TruckLength, TruckWidth, TruckHeight)
     {
         Color = TruckColor
     };
     Truck truck = new Truck(truckProperties);
     truck.DrawBegin(graphics);
     truck.DrawEnd(graphics);
     graphics.AddDimensions(new DimensionCube(TruckLength, TruckWidth, TruckHeight));
 }
Esempio n. 10
0
        /// <summary>
        /// Layer truck analysis constructor
        /// </summary>
        public Layer(CasePalletSolution sol, TruckProperties truckProperties, TruckConstraintSet constraintSet, int orientation)
        {
            switch (orientation)
            {
            case 0: _axisOrtho = HalfAxis.HAxis.AXIS_Z_P; break;

            case 1: _axisOrtho = HalfAxis.HAxis.AXIS_Z_N; break;

            default: _axisOrtho = HalfAxis.HAxis.AXIS_Z_P; break;
            }
            _palletLength = truckProperties.Length - 2.0 * constraintSet.MinDistancePalletTruckWall;
            _palletWidth  = truckProperties.Width - 2.0 * constraintSet.MinDistancePalletTruckWall;
            Initialize(sol);
        }
Esempio n. 11
0
 public bool Accept(Control ctrl, ItemBase itemBase)
 {
     if (ctrl == cbCases)
     {
         Packable packable = itemBase as Packable;
         return(null != packable &&
                (
                    (packable is BProperties) ||
                    (packable is PackProperties) ||
                    (packable is LoadedCase)
                ));
     }
     else if (ctrl == cbTrucks)
     {
         TruckProperties truckProperties = itemBase as TruckProperties;
         return(null != truckProperties);
     }
     return(false);
 }
Esempio n. 12
0
 /// <summary>
 /// Constructor (edit existing properties)
 /// </summary>
 /// <param name="document">Document to which the edited item belongs</param>
 /// <param name="truckProperties">Edited item</param>
 public FormNewTruck(Document document, TruckProperties truckProperties)
 {
     InitializeComponent();
     // set unit labels
     UnitsManager.AdaptUnitLabels(this);
     // save document reference
     _document        = document;
     _truckProperties = truckProperties;
     // set caption text
     Text = string.Format(Properties.Resources.ID_EDIT, _truckProperties.Name);
     // initialize data
     tbName.Text               = _truckProperties.Name;
     tbDescription.Text        = _truckProperties.Description;
     TruckLength               = _truckProperties.Length;
     TruckWidth                = _truckProperties.Width;
     TruckHeight               = _truckProperties.Height;
     TruckAdmissibleLoadWeight = _truckProperties.AdmissibleLoadWeight;
     TruckColor                = _truckProperties.Color;
     // disable Ok button
     UpdateButtonOkStatus();
 }
Esempio n. 13
0
        private void OnInputChanged(object sender, EventArgs e)
        {
            try
            {
                // get box / case
                PackableBrick   packable = SelectedPackable;
                TruckProperties truck    = SelectedTruck;
                if (null == packable || null == truck)
                {
                    return;
                }

                // update orientation control
                uCtrlCaseOrientation.BProperties = packable;

                // compute
                LayerSolver            solver = new LayerSolver();
                List <Layer2DBrickImp> layers = solver.BuildLayers(
                    packable.OuterDimensions
                    , packable.Bulge
                    , new Vector2D(
                        truck.InsideLength - 2.0 * uCtrlMinDistanceLoadWall.ValueX
                        , truck.InsideWidth - 2.0 * uCtrlMinDistanceLoadWall.ValueY)
                    , 0.0 /* offsetZ */
                    , BuildConstraintSet()
                    , checkBoxBestLayersOnly.Checked
                    );
                // update control
                uCtrlLayerList.Packable           = packable;
                uCtrlLayerList.ContainerHeight    = truck.InsideHeight - uCtrlMinDistanceLoadRoof.Value;
                uCtrlLayerList.FirstLayerSelected = true;
                uCtrlLayerList.LayerList          = layers.Cast <ILayer2D>().ToList();
            }
            catch (Exception ex)
            {
                _log.Error(ex.ToString());
            }
        }
 public void ResetTruck()
 {
     this.properties = new TruckProperties();
 }
 public TruckItem(TruckProperties truckProperties)
 {
     _truckProperties = truckProperties;
 }
Esempio n. 16
0
        private void ProcessViewItem(viewItem vItem)
        {
            Graphics3DImage graphics = InitializeImageFromViewParameters(vItem.viewParameters);
            // load case
            BoxProperties bProperties = LoadCaseById(null, _root.data.items.library_cases, vItem.itemId);

            if (null != bProperties)
            {
                graphics.AddBox(new Box(0, bProperties));
                if (vItem.viewParameters.showDimensions)
                {
                    graphics.AddDimensions(new DimensionCube(bProperties.Length, bProperties.Width, bProperties.Height));
                }
            }
            // load pallet
            PalletProperties palletProperties = LoadPalletById(null, _root.data.items.library_pallets, vItem.itemId);

            if (null != palletProperties)
            {
                Pallet pallet = new Pallet(palletProperties);
                pallet.Draw(graphics, Transform3D.Identity);
                if (vItem.viewParameters.showDimensions)
                {
                    graphics.AddDimensions(new DimensionCube(palletProperties.Length, palletProperties.Width, palletProperties.Height));
                }
            }
            // load interlayer
            InterlayerProperties interlayerProperties = LoadInterlayerById(null, _root.data.items.library_interlayers, vItem.itemId);

            if (null != interlayerProperties)
            {
                graphics.AddBox(new Box(0, interlayerProperties));
                if (vItem.viewParameters.showDimensions)
                {
                    graphics.AddDimensions(new DimensionCube(interlayerProperties.Length, interlayerProperties.Width, interlayerProperties.Thickness));
                }
            }
            // load bundle
            BundleProperties bundleProperties = LoadBundleById(null, _root.data.items.library_bundles, vItem.itemId);

            if (null != bundleProperties)
            {
                graphics.AddBox(new Box(0, bundleProperties));
                if (vItem.viewParameters.showDimensions)
                {
                    graphics.AddDimensions(new DimensionCube(bundleProperties.Length, bundleProperties.Width, bundleProperties.Height));
                }
            }
            // load truck
            TruckProperties truckProperties = null;

            if (null != truckProperties)
            {
                Truck truck = new Truck(truckProperties);
                truck.Draw(graphics);
                if (vItem.viewParameters.showDimensions)
                {
                    graphics.AddDimensions(new DimensionCube(truckProperties.Length, truckProperties.Width, truckProperties.Height));
                }
            }

            FinalizeImageFromViewParameters(vItem.viewParameters, graphics);
        }
Esempio n. 17
0
 public AnalysisCylinderTruck(Document doc, Packable packable, TruckProperties truckProperties, ConstraintSetCylinderTruck constraintSet)
     : base(doc, packable, truckProperties, constraintSet)
 {
 }