예제 #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
 public FormNewPack(Document doc, PackProperties packProperties)
     : base(doc, packProperties)
 {
     InitializeComponent();
     PackProp    = packProperties;
     StrapperSet = null != PackProp?PackProp.StrapperSet.Clone() : new StrapperSet();
 }
예제 #3
0
        /// <summary>
        /// FormNewBox constructor used to edit existing boxes
        /// </summary>
        /// <param name="document">Document that contains the edited box</param>
        /// <param name="boxProperties">Edited box</param>
        public FormNewBox(Document document, BoxProperties boxProperties)
            : base(document, boxProperties)
        {
            InitializeComponent();
            if (!DesignMode)
            {
                // set unit labels
                UnitsManager.AdaptUnitLabels(this);
                // save document reference
                _mode = boxProperties.HasInsideDimensions ? Mode.CASE : Mode.BOX;
                // set colors
                for (int i = 0; i < 6; ++i)
                {
                    _faceColors[i] = boxProperties.Colors[i];
                }
                // set textures
                _textures = boxProperties.TextureListCopy;
                // set caption text
                Text = string.Format(Properties.Resources.ID_EDIT, boxProperties.Name);
                // initialize value
                uCtrlDimensionsOuter.ValueX  = boxProperties.Length;
                uCtrlDimensionsOuter.ValueY  = boxProperties.Width;
                uCtrlDimensionsOuter.ValueZ  = boxProperties.Height;
                uCtrlDimensionsInner.Value   = new Vector3D(boxProperties.InsideLength, boxProperties.InsideWidth, boxProperties.InsideHeight);
                uCtrlDimensionsInner.Checked = boxProperties.HasInsideDimensions;
                // weight
                vcWeight.Value = boxProperties.Weight;
                // net weight
                uCtrlNetWeight.Value = boxProperties.NetWeight;
                // max weight
                uCtrlMaxWeight.Value = boxProperties.MaxWeight;
                // color : all faces set together / face by face
                chkAllFaces.Checked = boxProperties.UniqueColor;
                OnAllFacesColorCheckedChanged(this, null);
                // tape
                uCtrlTapeWidth.Value = boxProperties.TapeWidth;
                cbTapeColor.Color    = boxProperties.TapeColor;
                // set default face
                cbFace.SelectedIndex = 0;
                // set StrapperSet
                StrapperSet = boxProperties.StrapperSet.Clone();
                ctrlStrapperSet.StrapperSet = StrapperSet;

                // disable Ok button
                UpdateStatus(string.Empty);
            }
        }
예제 #4
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());
            }
        }
예제 #5
0
        /// <summary>
        /// FormNewBox constructor used when defining a new BoxProperties item
        /// </summary>
        /// <param name="document">Document in which the BoxProperties item is to be created</param>
        /// <param name="mode">Mode is either Mode.MODE_CASE or Mode.MODE_BOX</param>
        public FormNewBox(Document document, Mode mode)
            : base(document, null)
        {
            InitializeComponent();
            if (!DesignMode)
            {
                // set unit labels
                UnitsManager.AdaptUnitLabels(this);
                // save document reference
                _document = document;
                // mode
                _mode = mode;

                switch (_mode)
                {
                case Mode.CASE:
                    tbName.Text = _document.GetValidNewTypeName(Resources.ID_CASE);
                    uCtrlDimensionsOuter.ValueX = UnitsManager.ConvertLengthFrom(400.0, UnitsManager.UnitSystem.UNIT_METRIC1);
                    uCtrlDimensionsOuter.ValueY = UnitsManager.ConvertLengthFrom(300.0, UnitsManager.UnitSystem.UNIT_METRIC1);
                    uCtrlDimensionsOuter.ValueZ = UnitsManager.ConvertLengthFrom(200.0, UnitsManager.UnitSystem.UNIT_METRIC1);
                    uCtrlDimensionsInner.Value  = new Vector3D(
                        uCtrlDimensionsOuter.ValueX - UnitsManager.ConvertLengthFrom(6.0, UnitsManager.UnitSystem.UNIT_METRIC1),
                        uCtrlDimensionsOuter.ValueY - UnitsManager.ConvertLengthFrom(6.0, UnitsManager.UnitSystem.UNIT_METRIC1),
                        uCtrlDimensionsOuter.ValueZ - UnitsManager.ConvertLengthFrom(6.0, UnitsManager.UnitSystem.UNIT_METRIC1));
                    uCtrlDimensionsInner.Checked = false;
                    uCtrlTapeWidth.Value         = new OptDouble(true, UnitsManager.ConvertLengthFrom(50, UnitsManager.UnitSystem.UNIT_METRIC1));
                    cbTapeColor.Color            = Color.Beige;
                    break;

                case Mode.BOX:
                    tbName.Text = _document.GetValidNewTypeName(Resources.ID_BOX);
                    uCtrlDimensionsOuter.ValueX = UnitsManager.ConvertLengthFrom(120.0, UnitsManager.UnitSystem.UNIT_METRIC1);
                    uCtrlDimensionsOuter.ValueY = UnitsManager.ConvertLengthFrom(60.0, UnitsManager.UnitSystem.UNIT_METRIC1);
                    uCtrlDimensionsOuter.ValueZ = UnitsManager.ConvertLengthFrom(30.0, UnitsManager.UnitSystem.UNIT_METRIC1);
                    uCtrlDimensionsInner.Value  = new Vector3D(
                        uCtrlDimensionsOuter.ValueX - UnitsManager.ConvertLengthFrom(6.0, UnitsManager.UnitSystem.UNIT_METRIC1),
                        uCtrlDimensionsOuter.ValueY - UnitsManager.ConvertLengthFrom(6.0, UnitsManager.UnitSystem.UNIT_METRIC1),
                        uCtrlDimensionsOuter.ValueZ - UnitsManager.ConvertLengthFrom(6.0, UnitsManager.UnitSystem.UNIT_METRIC1));
                    uCtrlDimensionsInner.Checked = false;
                    break;

                default:
                    break;
                }
                // description (same as name)
                tbDescription.Text = tbName.Text;
                // color : all faces set together / face by face
                chkAllFaces.Checked = false;
                OnAllFacesColorCheckedChanged(this, null);
                // set colors
                for (int i = 0; i < 6; ++i)
                {
                    _faceColors[i] = _mode == Mode.BOX ? Color.Turquoise : Color.Chocolate;
                }
                // set textures
                _textures = new List <Pair <HalfAxis.HAxis, Texture> >();
                // set default face
                cbFace.SelectedIndex = 0;
                // weight
                Weight = UnitsManager.ConvertMassFrom(1.0, UnitsManager.UnitSystem.UNIT_METRIC1);
                // net weight
                NetWeight = new OptDouble(false, UnitsManager.ConvertMassFrom(0.0, UnitsManager.UnitSystem.UNIT_METRIC1));

                StrapperSet = new StrapperSet();
                ctrlStrapperSet.StrapperSet = StrapperSet;

                // disable Ok button
                UpdateStatus(string.Empty);
            }
        }
예제 #6
0
 public PackableBrickNamed(Document parentDocument)
     : base(parentDocument)
 {
     _strapperSet = new StrapperSet(this);
 }
예제 #7
0
 public PackableBrickNamed(Document parentDocument, string name, string description)
     : base(parentDocument)
 {
     ID.SetNameDesc(name, description);
     _strapperSet = new StrapperSet(this);
 }