void loadTek() { dataGridView1.Rows.Clear(); if (listBox1.Text != "") { if (шаблоны[listBox1.SelectedIndex] != null) { prisadka temp = (prisadka)шаблоны[listBox1.SelectedIndex]; textBox1.Text = temp.name; if (temp.сверление.Count > 0) { for (int i = 0; i < temp.сверление.Count; i++) { if (temp.сверление[i] != null) { dataGridView1.Rows.Add(); sverlenie temp2 = (sverlenie)temp.сверление[i]; dataGridView1.Rows[i].Cells[0].Value = temp2.y; dataGridView1.Rows[i].Cells[1].Value = temp2.глубина; dataGridView1.Rows[i].Cells[2].Value = temp2.диаметр; dataGridView1.Rows[i].Cells[3].Value = temp2.количество_отверстий; dataGridView1.Rows[i].Cells[4].Value = temp2.шагX; dataGridView1.Rows[i].Cells[5].Value = temp2.шагY; dataGridView1.Rows[i].Cells[6].Value = temp2.тип_сверла.ToString(); dataGridView1.Rows[i].Cells[7].Value = temp2.зона_сверления; } } } } } }
void createProgramm() { try { DirectoryInfo info = new DirectoryInfo(Application.StartupPath + "\\txt_programm"); DirectoryInfo[] dirs = info.GetDirectories(); FileInfo[] files = info.GetFiles(); for (int i = 0; i < files.Length; i++) { files[i].Delete(); } } catch { } Directory.CreateDirectory(Application.StartupPath + "\\txt_programm"); for (int i = 0; i < список_сверления.Length; i++) { if (список_сверления[i].сверление.name != "") { if (список_сверления[i].сверление.сверление != null) { for (int j = 0; j < список_сверления[i].сверление.сверление.Count; j++) { sverlenie temp = (sverlenie)список_сверления[i].сверление.сверление[j]; if (temp.тип_сверла == _тип_сверла.глухое) { txt_programm += "XBO X=" + список_сверления[i].x + " Y=" + temp.y.ToUpper() + " Z=" + temp.глубина.ToUpper() + " D=" + temp.диаметр.ToUpper() + " R=" + temp.количество_отверстий.ToUpper() + " x=" + temp.шагX.ToUpper() + " y=" + temp.шагY.ToUpper() + " N=\"P\" F=" + temp.зона_сверления + " K=0 P=0\n"; } else { txt_programm += "XBO X=" + список_сверления[i].x + " Y=" + temp.y.ToUpper() + " Z=" + temp.глубина.ToUpper() + " D=" + temp.диаметр.ToUpper() + " R=" + temp.количество_отверстий.ToUpper() + " x=" + temp.шагX.ToUpper() + " y=" + temp.шагY.ToUpper() + " N=\"L\" F=" + temp.зона_сверления + " K=0 P=0\n"; } } } } } //XBO X=9 Y=100 Z=34 D=5 R=5 x=0 y=32 N="P" F=3 K=0 P=0 txt_programm = txt_programm.Replace(",", "."); string data = DateTime.Now.ToString().Replace(":", "").Replace(".", "").Replace(" ", ""); System.IO.File.WriteAllText(Application.StartupPath + "\\txt_programm\\fk_proga" + data + ".xxl", txt_programm); try { Process.Start(Application.StartupPath + "\\txt_programm\\fk_proga" + data + ".xxl"); } catch (Exception e) { MessageBox.Show(e.Message); } }
public void add(sverlenie присадка) { сверление.Add(присадка); }