Ejemplo n.º 1
0
        private void ApplyNewConstraintValue()
        {
            double value;

            try
            {
                value = BooEval.GetDouble(valueTextBox.Text);
            }
            catch (FormatException)
            {
                NaroMessage.Show(ExtensionsResources.Invalid_number_format);
                return;
            }
            if (!AcceptZero() && value < 0.001)
            {
                NaroMessage.Show(ExtensionsResources.ConstraintShapeDialog_Value_Bigger_Than_Zero);
                return;
            }
            var constraintDesc = (ConstraintListItem)listConstraints.SelectedItem;

            constraintDesc.GenerateBuilder();
            var builder = constraintDesc.Builder;

            builder[1].Real = value;
            builder.ExecuteFunction();
            RefreshList();
        }
        private void ApplyValue()
        {
            if (OnSetValue == null)
            {
                return;
            }
            var    text = _textBox.Text;
            double value;

            if (string.IsNullOrEmpty(text))
            {
                value = 0;
            }
            else
            {
                try
                {
                    value = BooEval.GetDouble(text);
                }
                catch (Exception)
                {
                    value = 0;
                }
            }
            if (Math.Abs(_value - value) > 1e-12)
            {
                OnSetValue(value);
            }
        }
Ejemplo n.º 3
0
        public static double ParseDoubleArgument(double refValue, string word)
        {
            var relative = refValue;

            word = word.Trim();
            if (string.IsNullOrEmpty(word))
            {
                return(relative);
            }
            if (word[word.Length - 1] == 'r')
            {
                word = word.Remove(word.Length - 1);
                try
                {
                    var result = BooEval.GetDouble(word);
                    relative += result;
                }
                catch
                {
                }
            }
            else
            {
                try
                {
                    var result = BooEval.GetDouble(word);
                    relative = result;
                }
                catch
                {
                }
            }
            return(relative);
        }
Ejemplo n.º 4
0
 private void TextBoxKeyUp(object sender, KeyEventArgs e)
 {
     ExtrudeHeight = BooEval.GetDouble(_textBox.Text);
     if (ValueChanged != null)
     {
         ValueChanged();
     }
 }
Ejemplo n.º 5
0
 private void OnOk()
 {
     CutType = cutTypeComboBox.Text == CutThroughAll ? CutTypes.ThroughAll : CutTypes.ToDepth;
     if (CutType == CutTypes.ToDepth)
     {
         CutDepth = BooEval.GetDouble(cutDepthTextBox.Text);
     }
     DialogResult = DialogResult.OK;
 }
 private void TbxAngularPrecTextChanged(object sender, KeyEventArgs keyEventArgs)
 {
     if (keyEventArgs.Key != Key.Enter)
     {
         return;
     }
     Angle             = BooEval.GetDouble(txtAngle.Text);
     sliderAngle.Value = Angle;
     NotifyChanged();
 }
Ejemplo n.º 7
0
        private void TbxDistanceTextChanged(object sender, KeyEventArgs keyEventArgs)
        {
            if (keyEventArgs.Key != Key.Enter)
            {
                return;
            }
            var value = BooEval.GetDouble(_solverOptionsView.tbxDistance.Text);

            _solverOptionsView.tbxDistance.Text = value.ToString();
            Data.SetValue((int)HinterOptionFields.PointMatch, value);
        }
 private static double TextBoxValue(TextBox textBox)
 {
     try
     {
         return(BooEval.GetDouble(textBox.Text));
     }
     catch (Exception)
     {
         return(0.0);
     }
 }
        private void AngleTextBoxKeyUp(object sender, KeyEventArgs e)
        {
            double newAngle;
            var    newTextBoxValue = textBoxAngle.Text.Replace(',', '.');

            try
            {
                newAngle = BooEval.GetDouble(newTextBoxValue);
            }
            catch
            {
                return;
            }
            Angle = newAngle;
            Preview();
        }
        private void BetweenTextBoxKeyUp(object sender, KeyEventArgs e)
        {
            double newBetween;
            var    newTextBoxValue = textBoxBetween.Text.Replace(',', '.');

            try
            {
                newBetween = BooEval.GetDouble(newTextBoxValue);
            }
            catch
            {
                return;
            }
            Between = newBetween;
            Preview();
        }
        private void HeightTextBoxKeyUp(object sender, KeyEventArgs e)
        {
            double newHeight;
            var    newTextBoxValue = textBoxHeight.Text.Replace(',', '.');

            try
            {
                newHeight = BooEval.GetDouble(newTextBoxValue);
            }
            catch
            {
                return;
            }
            Height = newHeight;
            Preview();
        }
        private void ColomnDistanceTextBoxKeyUp(object sender, KeyEventArgs e)
        {
            double newNumber;
            var    newTextBoxValue = textBoxColomnDistance.Text.Replace(',', '.');

            try
            {
                newNumber = BooEval.GetDouble(newTextBoxValue);
            }
            catch
            {
                return;
            }
            ColomnDistance = newNumber;
            Preview();
        }
Ejemplo n.º 13
0
        private void CutDepthTextBoxTextChanged(object sender, EventArgs e)
        {
            try
            {
                var depth = 0.0;
                if (double.TryParse(cutDepthTextBox.Text, out depth))
                {
                    CutDepth = BooEval.GetDouble(cutDepthTextBox.Text);

                    PreviewCut();
                }
            }
            catch
            {
            }
        }
Ejemplo n.º 14
0
        private void TextBoxKeyUp(object sender, KeyEventArgs e)
        {
            if (e.Key != Key.Enter)
            {
                return;
            }
            var textValue = textBox.Text;

            try
            {
                var doubleValue = BooEval.GetDouble(textValue);
                UpdateValue(doubleValue);
            }
            catch
            {
                Value = _prevValue;
            }
        }
        private void OnKeyUp(object sender, KeyEventArgs e)
        {
            if (e.Key != Key.Enter)
            {
                return;
            }
            var value = BooEval.GetDouble(_textBox.Text);

            if (value > _max)
            {
                value = _max;
            }
            if (value < _min)
            {
                value = _min;
            }
            Value = value;

            _slider.Value = Value;
            NotifyValueChanged();
        }
Ejemplo n.º 16
0
        private void TbxPolarAngleTextChanged(object sender, TextChangedEventArgs e)
        {
            var value = BooEval.GetDouble(_solverOptionsView.tbxPolarAngle.Text);

            Data.SetValue((int)HinterOptionFields.PolarAngleValue, value);
        }
Ejemplo n.º 17
0
        private void TbxSensitivityPrecisionTextChanged(object sender, TextChangedEventArgs e)
        {
            var value = BooEval.GetDouble(_solverOptionsView.tbxSensitivityPrecision.Text);

            Data.SetValue((int)HinterOptionFields.HorizontalVerticalMatch, value);
        }
Ejemplo n.º 18
0
 public void SetDouble(int nodeId, string doubleValue)
 {
     Node[nodeId].Set <RealInterpreter>().Value = BooEval.GetDouble(doubleValue, CultureInfo.InvariantCulture);
 }