private void schließenToolStripMenuItem1_Click(object sender, EventArgs e) { myCNCProgram = null; myToolCallNodes = null; BuildTreeViewCNCProgram(false); EnabledCNCProgrammControls(); label2.Text = "CNC-Programm\n\n*.h"; WriteHistory("CNC-Programm entladen", HistoryMessageType.Information, FontStyle.Bold); }
private void frmProp_Load(object sender, EventArgs e) { Machine _machine = new Machine(); _machine = (Machine)myObject; Text = _machine.Name + " @ " + _machine.IP; propertyGrid1.SelectedObject = myObject; textBox1.Text = "Standardwerkzeuge von " + _machine.Name + ":" + System.Environment.NewLine; foreach (var item in CNCProgram.GetRestrictivToolNumbers(_machine.RestrictivToolNumbers)) { textBox1.Text += item.ToString() + "; "; } }
private void öffnenToolStripMenuItem1_Click(object sender, EventArgs e) { TempJob.Text = "Lädt..."; this.Update(); ToolStripMenuItem _tsmi = (ToolStripMenuItem)sender; if (_tsmi.Text == "Öffnen") { OpenFileDialog _ofd = new OpenFileDialog { Multiselect = false, Filter = "CNC-Programm (*.h)|*.h" }; if (_ofd.ShowDialog() == DialogResult.OK) { myCNCProgram = null; myToolCallNodes = null; myCNCProgram = new CNCProgram(new FileInfo(_ofd.FileName), myMachine.RestrictivToolNumbers); EnabledCNCProgrammControls(); FileInfo _fi = new FileInfo(myCNCProgram.File.FullName); if (_fi.Length >= 2000000) { ToolStrip_NurToolCall.CheckState = CheckState.Checked; ToolStrip_NurToolCall.Enabled = false; nurTOOLCALLsAnzeigenToolStripMenuItem1.CheckState = CheckState.Checked; nurTOOLCALLsAnzeigenToolStripMenuItem1.Enabled = false; MessageBox.Show("Aufgrund der Größe des CNC-Programms '" + Path.GetFileName(_ofd.FileName) + "' werden nur die 'TOOL CALL's im Baum angezeigt.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); BuildTreeViewCNCProgram(true); } else { ToolStrip_NurToolCall.Enabled = true; nurTOOLCALLsAnzeigenToolStripMenuItem1.Enabled = true; BuildTreeViewCNCProgram(false); } if (myCNCProgram.OriginalToolRange >= myMachine.MaxToolRange) { comboBox2.SelectedIndex = 0; } else { comboBox2.SelectedIndex = myCNCProgram.OriginalToolRange; } } else { TempJobClear(); return; } } else //Aktualisieren { //comboBox2.SelectedIndex = comboBox2.SelectedIndex - 1; string _file = myCNCProgram.File.FullName; myCNCProgram = null; try { myCNCProgram = new CNCProgram(new FileInfo(_file), myMachine.RestrictivToolNumbers); } catch (Exception) { WriteHistory("CNC-Programm '" + Path.GetFileName(_file) + "' nicht gefunden -> CNC-Programm wird entladen", HistoryMessageType.Error, FontStyle.Bold); schließenToolStripMenuItem1_Click(null, null); TempJobClear(); return; } if (myCNCProgram.OriginalToolRange >= myMachine.MaxToolRange) { comboBox2.SelectedIndex = 0; } else { comboBox2.SelectedIndex = myCNCProgram.OriginalToolRange; } BuildTreeViewCNCProgram(false); } //write history int _image = 1; if (myCNCProgram.IsToolRangeConsistent != true) { _image = 3; } WriteHistory("CNC-Programm '" + Path.GetFileName(myCNCProgram.File.FullName) + "' geladen/aktualisiert", HistoryMessageType.Information, FontStyle.Bold, true, false, _image); if (myCNCProgram.IsToolRangeConsistent != true) { //WriteHistory("" + myCNCProgram.MatchesOfToolCalls.Count + "x '" + CNCProgram.ToolCallString + // "' in verschiedenen Tool-Ranges enthalten (Standardwerkzeuge von " + myMachine.Name + ": " + myMachine.RestrictivToolNumbers + ")", // HistoryMessageType.Warning, FontStyle.Italic, false, false); WriteHistory(myCNCProgram.GetNoteText(), HistoryMessageType.Warning, FontStyle.Italic, false, false); } else { //WriteHistory("" + myCNCProgram.MatchesOfToolCalls.Count + "x '" + CNCProgram.ToolCallString + // "' in Tool-Range '" + (myCNCProgram.OriginalToolRange * 1000).ToString() + "..." + ((myCNCProgram.OriginalToolRange * 1000) + 999).ToString() + "' enthalten", // HistoryMessageType.Information, FontStyle.Italic, false, false); WriteHistory(myCNCProgram.GetNoteText(), HistoryMessageType.Information, FontStyle.Italic, false, false); } if (myCNCProgram.MatchesOfToolCalls.Count > 0) //TOOL CALL's in History aufführen + Zeilenumbruch { string[] _line = new string[] { "[" }; foreach (string _str in myCNCProgram.EachToolCallValues()) { if (_line[_line.Length - 1].Length >= 108) { Array.Resize(ref _line, _line.Length + 1); } _line[_line.Length - 1] += _str.Replace(CNCProgram.ToolCallString, "").Trim() + ", "; } _line[_line.Length - 1] = _line[_line.Length - 1].Remove(_line[_line.Length - 1].Length - 2, 1).Trim() + "]"; bool withEmptyLine = false; for (int i = 0; i < _line.Length; i++) { if (i == _line.Length - 1) { withEmptyLine = true; } WriteHistory(_line[i], HistoryMessageType.Information, FontStyle.Italic, false, withEmptyLine); } } else { WriteHistory("", HistoryMessageType.Information, FontStyle.Italic, false, false); } //lbl-Text label2.Text = "CNC-Programm: " + myCNCProgram.File.Name + "\n\nTool-Range: " + (myCNCProgram.OriginalToolRange * 1000).ToString() + "..." + ((myCNCProgram.OriginalToolRange * 1000) + 999).ToString(); TempJobClear(); }