public void addMPoint(object obj)
        {
            //MessageBox.Show("Trying to create a material Point");

            string message               = String.Empty;
            string massMessage           = String.Empty;
            string massRejectMessage     = String.Empty;
            string positionMessage       = String.Empty;
            string positionRejectMessage = String.Empty;

            bool creation = true;

            //Mass checking
            if (mass != null && mass > 0)
            {
                massMessage += "mass: " + mass.ToString();
            }
            else
            {
                massRejectMessage += "- Not going anywhere without a positive mass" + Environment.NewLine;
                creation           = false;
            }

            //Position Checking

            //Cx
            if (InputCx == null)
            {
                positionRejectMessage += "- Numerical value required for Cx" + Environment.NewLine;
                creation = false;
            }
            else
            {
                if (Xinput.Equals("x"))
                {
                    Xinput = "0"; message += " Cx = 0 ";
                }
                else
                {
                    message += " Cx = " + InputCx.ToString();
                }
            }

            //Cy
            if (InputCy == null)
            {
                positionRejectMessage += "- Numerical value required for Cy" + Environment.NewLine;
                creation = false;
            }
            else
            {
                if (Yinput.Equals("y"))
                {
                    Yinput = "0"; positionMessage += " Cy = 0 ";
                }
                else
                {
                    positionMessage += " Cy = " + InputCy.ToString();
                }
            }

            //Cz
            if (InputCz == null)
            {
                positionRejectMessage += "- Numerical value required for Cz" + Environment.NewLine;
                creation = false;
            }
            else
            {
                if (Zinput.Equals("z"))
                {
                    Zinput = "0"; positionMessage += " Cz = 0 ";
                }
                else
                {
                    positionMessage += " Cz = " + InputCz.ToString();
                }
            }

            if (creation)
            {
                message =
                    massMessage + Environment.NewLine +
                    "Position of the center of mass: " + Environment.NewLine +
                    positionMessage;
                MessageBox.Show(message, "Confirmation");
            }

            else
            {
                message =
                    "The Material Point will not be created:" + Environment.NewLine +
                    massRejectMessage + positionRejectMessage;
                MessageBox.Show(message, "Rejection");
            }
        }
Beispiel #2
0
        public void addMPoint(object obj)
        {
            //MessageBox.Show("Trying to create a material Point");

            string message               = String.Empty;
            string massMessage           = String.Empty;
            string massRejectMessage     = String.Empty;
            string positionMessage       = String.Empty;
            string positionRejectMessage = String.Empty;

            bool creation = true;

            //Mass checking
            if (mass != null && mass > 0)
            {
                massMessage += "mass: " + mass.ToString();
            }
            else
            {
                massRejectMessage += "- Not going anywhere without a positive mass" + Environment.NewLine;
                creation           = false;
            }

            //Position Checking

            //Cx

            if (Xinput.Equals("X") && creation)
            {
                Xinput           = "0";
                positionMessage += " Cx = 0 ";
            }
            else
            {
                if (InputCx == null)
                {
                    positionRejectMessage += "- Numerical value required for Cx" + Environment.NewLine;
                    creation = false;
                }
                else
                {
                    positionMessage = (creation) ? positionMessage + " Cx = " + InputCx.ToString() : positionMessage;
                }
            }

            //Cy
            if (Yinput.Equals("Y") && creation)
            {
                Yinput = "0"; positionMessage += " Cy = 0 ";
            }
            else
            {
                if (InputCy == null)
                {
                    positionRejectMessage += "- Numerical value required for Cy" + Environment.NewLine;
                    creation = false;
                }
                else
                {
                    positionMessage = (creation) ? positionMessage + " Cy = " + InputCy.ToString() : positionMessage;
                }
            }

            //Cz
            if (Zinput.Equals("Z") && creation)
            {
                Zinput = "0"; positionMessage += " Cz = 0 ";
            }
            else
            {
                if (InputCz == null)
                {
                    positionRejectMessage += "- Numerical value required for Cz" + Environment.NewLine;
                    creation = false;
                }
                else
                {
                    positionMessage = (creation) ? positionMessage + " Cz = " + InputCz.ToString() : positionMessage;
                }
            }

            if (creation)
            {
                message =
                    massMessage + Environment.NewLine +
                    "Position of the center of mass: " + Environment.NewLine +
                    positionMessage;
                MessageBox.Show(message, "Confirmation");
                simMgr.addMaterialPoint((double)InputCx, (double)InputCy, (double)InputCz, 0, 0, 0, (double)mass, 0);
                selected++;
                Notify("SelectedItem");
                outMan.displayElements();
            }
            else
            {
                message =
                    "The Material Point will not be created:" + Environment.NewLine +
                    massRejectMessage + positionRejectMessage;
                MessageBox.Show(message, "Rejection");
            }
        }