Ejemplo n.º 1
0
        public override string ToString()
        {
            var ToolCallsToString = "";
            var SubString         = "";

            if (this.MatchesOfToolCalls.Count <= 40)
            {
                foreach (Match m in MatchesOfToolCalls)
                {
                    ToolCall tc = new ToolCall(m);

                    if (!IsRestrictiveToolValue(tc.OrgToolCallValue - tc.OrgToolRangeValue))
                    {
                        SubString = "";
                    }
                    else
                    {
                        SubString = "   (≙ Standardwerkzeug)";
                    }

                    ToolCallsToString = ToolCallsToString + "   • " + m.Value + SubString + "\n";
                }
            }


            return(ToolCallsToString + "\n-------------- INFORMATION --------------" +
                   "\n   • " + this.MatchesOfToolCalls.Count.ToString() + "x '" + ToolCallString + "' insgesamt" +
                   "\n   • " + (this.MatchesOfToolCalls.Count - this.CountOfRestrictiveToolValues).ToString() + "x veränderbare '" + ToolCallString + "'" +
                   "\n   • " + this.CountOfRestrictiveToolValues.ToString() + "x Standardwerkzeuge");
        }
Ejemplo n.º 2
0
        public string[] EachToolCallValues()
        {
            string[] _str = new string[0];

            foreach (Match m in MatchesOfToolCalls)
            {
                ToolCall tc = new ToolCall(m);

                Array.Resize(ref _str, _str.Length + 1);
                _str[_str.Length - 1] = m.Value;
            }

            return(_str);
        }
Ejemplo n.º 3
0
        private bool DetectIsToolRangeConsistent()
        {
            decimal[] ToolCallValues  = new decimal[0];
            decimal   CalcConsistency = 0;

            OnlyRestrictiveToolValues = true;

            foreach (Match m in MatchesOfToolCalls)
            {
                ToolCall tc = new ToolCall(m);

                //Continue ForEach by Restriction
                if (IsRestrictiveToolValue(tc.OrgToolCallValue - tc.OrgToolRangeValue))
                {
                    this.CountOfRestrictiveToolValues++;
                    continue;
                }
                else if (OnlyRestrictiveToolValues)
                {
                    OnlyRestrictiveToolValues    = false;
                    FirstNotRestrictiveToolValue = tc.OrgToolCallValue - Int32.Parse(tc.OrgToolRangeValue.ToString());
                }

                if (m.Groups.Count > 1)
                {
                    Array.Resize(ref ToolCallValues, ToolCallValues.Length + 1);
                    ToolCallValues[ToolCallValues.Length - 1] = System.Math.Floor(decimal.Parse(m.Groups[1].ToString()) / 1000);
                    CalcConsistency = CalcConsistency + ToolCallValues[ToolCallValues.Length - 1];
                }
            }

            if (ToolCallValues.Length > 0)
            {
                OriginalToolRange = Int32.Parse(ToolCallValues[0].ToString());

                if (CalcConsistency / ToolCallValues.Length != ToolCallValues[0])
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            else
            {
                return(true);
            }
        }
Ejemplo n.º 4
0
        public void ChangeToolRange(int newRange, bool showErrAtInconsistency)
        {
            if (IsToolRangeConsistent == false && showErrAtInconsistency)
            {
                DialogResult result = MessageBox.Show(GetNoteText() + "\n" + "\n" + this.ToString() + "\n\n" + "Neuen ToolRange dennoch in '" + newRange.ToString() + "' ändern?", "HINWEIS... " + App.Title(),
                                                      MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
                if (result == DialogResult.No)
                {
                    return;
                }
            }

            var    newFileContent = FileContent;
            string newToolCallString;
            int    newToolCallValue;

            foreach (Match m in MatchesOfToolCalls)
            {
                var tc = new ToolCall(m);

                //Continue ForEach by Restriction
                if (IsRestrictiveToolValue(tc.OrgToolCallValue - tc.OrgToolRangeValue))
                {
                    continue;
                }

                newToolCallValue = (Int32.Parse(tc.OrgToolCallString.Replace(ToolCallString + " ", "")) -
                                    Int32.Parse(tc.OrgToolRangeValue.ToString())) +
                                   (newRange * 1000);

                newToolCallString = tc.OrgToolCallString.Replace(tc.OrgToolCallValue.ToString(), newToolCallValue.ToString());

                newFileContent = newFileContent.Replace(tc.OrgToolCallString, newToolCallString);
            }
            System.IO.File.WriteAllText(System.IO.Path.Combine(File.DirectoryName, File.Name), newFileContent);
        }
Ejemplo n.º 5
0
        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            //if (comboBox2.Text == "")
            //{
            //    BuildTreeViewCNCProgram(true);
            //}
            //else
            //{
            //    BuildTreeViewCNCProgram(false);
            //}


            ////#############################################################################################################################
            //return;
            ////#############################################################################################################################



            if (myCNCProgram == null)
            {
                return;
            }

            if (checkBox1.CheckState == CheckState.Checked) //für Sync
            {
                comboBox1.Text = comboBox2.Text;
            }

            #region Evtl.später
            //if (myCNCProgram.OriginalToolRange != ExtractInt(comboBox2.Text))
            //{
            //    speichernToolStripMenuItem1.Enabled = true;
            //}
            //else
            //{
            //    speichernToolStripMenuItem1.Enabled = false;
            //}


            //if (ExtractInt(comboBox2.Text) == myCNCProgram.OriginalToolRange)
            //{
            //    comboBox2.Font = new Font(comboBox2.Font, FontStyle.Bold);
            //}
            //else
            //{
            //    comboBox2.Font = new Font(comboBox2.Font, FontStyle.Regular);
            //}
            #endregion

            if (myToolCallNodes == null | ToolStrip_VorschauModus.CheckState == CheckState.Unchecked)
            {
                return;
            }

            //Vorschau...
            TempJob.Text = "Lädt...";
            this.Update();
            treeView2.BeginUpdate();
            ProgressBar.Maximum = myToolCallNodes.Length;
            int _pbValue = 0;

            int      _newRange = ExtractInt(comboBox1.Text);
            int      newToolCallValue;
            string   newToolCallString;
            TreeNode _tn = new TreeNode();
            var      rgx = new Regex(CNCProgram.FilterToolCallRexEx);

            foreach (var item in myToolCallNodes)
            {
                _tn = treeView2.Nodes[treeView2.Nodes.IndexOf(item)];
                ProgressBar.Value = _pbValue += 1;

                try
                {
                    var tc = new ToolCall(rgx.Matches(_tn.Text)[0]);
                    if (myCNCProgram.IsRestrictiveToolValue(tc.OrgToolCallValue - tc.OrgToolRangeValue))
                    {
                        continue;
                    }

                    newToolCallValue = (Int32.Parse(tc.OrgToolCallString.Replace(CNCProgram.ToolCallString + " ", "")) -
                                        Int32.Parse(tc.OrgToolRangeValue.ToString())) + (_newRange * 1000);

                    newToolCallString = (tc.OrgToolCallString.Replace(tc.OrgToolCallValue.ToString(), newToolCallValue.ToString()));

                    _tn.Text = _tn.Text.Replace(tc.OrgToolCallString, newToolCallString);
                }
                catch (Exception)
                {
                    continue;
                }
            }

            TempJobClear();
            treeView2.EndUpdate();
            ProgressBar.Value = 0;
        }