예제 #1
0
        public void Draw(Graphics3DControl ctrl, Graphics3D graphics)
        {
            StrapperSet.SetDimension(OuterDimensions);
            // build pack
            PackProperties packProperties = new PackProperties(
                null, SelectedBox, Arrangement, BoxOrientation, Wrapper)
            {
                StrapperSet = StrapperSet
            };

            if (uCtrlOuterDimensions.Checked)
            {
                packProperties.ForceOuterDimensions(
                    new Vector3D(uCtrlOuterDimensions.X, uCtrlOuterDimensions.Y, uCtrlOuterDimensions.Z));
            }
            Pack pack = new Pack(0, packProperties)
            {
                ForceTransparency = true
            };

            graphics.AddBox(pack);
            graphics.AddDimensions(new DimensionCube(Vector3D.Zero, pack.Length, pack.Width, pack.Height, Color.Black, true));
            if (packProperties.Wrap.Transparent)
            {
                graphics.AddDimensions(
                    new DimensionCube(
                        packProperties.InnerOffset
                        , packProperties.InnerLength, packProperties.InnerWidth, packProperties.InnerHeight
                        , Color.Red, false));
            }
        }
예제 #2
0
        private void OnBoxPropertyChanged(object sender, EventArgs e)
        {
            try
            {
                // maintain inside dimensions
                if (sender is UCtrlTriDouble uCtrlDimOut && uCtrlDimensionsOuter == uCtrlDimOut)
                {
                    InsideLength = BoxLength - _thicknessLength;
                    InsideWidth  = BoxWidth - _thicknessWidth;
                    InsideHeight = BoxHeight - _thicknessHeight;
                }
                if (sender is UCtrlOptTriDouble uCtrlDimIn && uCtrlDimensionsInner == uCtrlDimIn)
                {
                    if (BoxLength < InsideLength)
                    {
                        BoxLength = InsideLength + _thicknessLength;
                    }
                    if (BoxWidth < InsideWidth)
                    {
                        BoxWidth = InsideWidth + _thicknessWidth;
                    }
                    if (BoxHeight <= InsideHeight)
                    {
                        BoxHeight = InsideHeight + _thicknessHeight;
                    }

                    _strapperSet.SetDimension(BoxLength, BoxWidth, BoxHeight);
                }
                uCtrlNetWeight.Enabled = !uCtrlDimensionsInner.Checked;
                uCtrlMaxWeight.Enabled = uCtrlDimensionsInner.Checked;

                // update thicknesses
                UpdateThicknesses();
                // update ok button status
                UpdateStatus(string.Empty);
                // update box drawing
                graphCtrl.Invalidate();
            }
            catch (Exception ex)
            {
                _log.Error(ex.ToString());
            }
        }