public Form1() { InitializeComponent(); spf.Show(); // test OS type OperatingSystem osversion = System.Environment.OSVersion; if (osversion.VersionString.Contains("indow")) { info.ostype = 0; } else { info.ostype = 1; } info.cwd = Directory.GetCurrentDirectory(); egl = new eagle(); stk = new stack(); tvm802 = new tvm(); info.Load(); stk.LoadStack(info.myFilePath(info.stackfile)); tdataGridView_devices.DataSource = egl.tdevlist; bdataGridView_devices.DataSource = egl.bdevlist; dataGridView_stack.DataSource = info.stacklist; dataGridView_fiducials.DataSource = info.tfiducialslist; dataGridView_bfiducials.DataSource = info.bfiducialslist; tdataGridView_devices.Columns[3].DefaultCellStyle.Format = "N2"; tdataGridView_devices.Columns[3].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; tdataGridView_devices.Columns[4].DefaultCellStyle.Format = "N2"; tdataGridView_devices.Columns[4].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; tdataGridView_devices.Columns[5].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; bdataGridView_devices.Columns[3].DefaultCellStyle.Format = "N2"; bdataGridView_devices.Columns[3].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; bdataGridView_devices.Columns[4].DefaultCellStyle.Format = "N2"; bdataGridView_devices.Columns[4].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; bdataGridView_devices.Columns[5].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; // die Combobox wird nicht gebunden, weil sonst keine freie Definition der Auswahlmöglichkeiten besteht setStackComboboxes(); setTopComboboxes(); setBottomComboboxes(); // mit 0 vorbelegen fiducialitem fi = new fiducialitem(); info.tfiducialslist.Add(fi); info.bfiducialslist.Add(fi); setGUI(); // default Sprache }
public int Load() { String filename = info.LastDir + "//" + info.LastFile; String tfilename = filename.Substring(0, filename.Length - 1) + "t"; String bfilename = filename.Substring(0, filename.Length - 1) + "b"; // Lade TOP layer StreamReader sr = null; bool fidfound = false; try { using (sr = new StreamReader(tfilename)) { tdevlist.Clear(); info.tfiducialslist.Clear(); fiducialitem tfi = new fiducialitem(); while (true) { String s = sr.ReadLine(); if (s == null) { break; } String[] sa = s.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); device dev; if (sa.Length < 6) { dev = new device(sa[0], sa[1], sa[2], sa[3], sa[4], "???"); } else { dev = new device(sa[0], sa[1], sa[2], sa[3], sa[4], sa[5]); } if (dev.location == "FID1") { tfi.mark1x = dev.x; tfi.mark1y = dev.y; fidfound = true; } else if (dev.location == "FID2") { tfi.mark2x = dev.x; tfi.mark2y = dev.y; fidfound = true; } else { tdevlist.Add(dev); } } if (fidfound) { // bei Nutzen müssen alle Real Koordinaten die gleichen sein // trage daher für alle 5 Einzelplatinen das gleiche ein // die Maschinenkoords müssen natürlich auf die jeweiligen FIDs eingemessen werden info.tfiducialslist.Add(tfi); info.tfiducialslist.Add(tfi); info.tfiducialslist.Add(tfi); info.tfiducialslist.Add(tfi); info.tfiducialslist.Add(tfi); } } } catch (Exception e) { Console.WriteLine(e.ToString()); } // Lade Bottom Layer sr = null; fidfound = false; try { using (sr = new StreamReader(bfilename)) { bdevlist.Clear(); info.bfiducialslist.Clear(); fiducialitem bfi = new fiducialitem(); while (true) { String s = sr.ReadLine(); if (s == null) { break; } String[] sa = s.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); device dev; if (sa.Length < 6) { dev = new device(sa[0], sa[1], sa[2], sa[3], sa[4], "???"); } else { dev = new device(sa[0], sa[1], sa[2], sa[3], sa[4], sa[5]); } if (dev.location == "FID3") { bfi.mark1x = dev.x; bfi.mark1y = dev.y; fidfound = true; } else if (dev.location == "FID4") { bfi.mark2x = dev.x; bfi.mark2y = dev.y; fidfound = true; } else { bdevlist.Add(dev); } } if (fidfound) { // bei Nutzen müssen alle Real Koordinaten die gleichen sein // trage daher für alle 5 Einzelplatinen das gleiche ein // die Maschinenkoords müssen natürlich auf die jeweiligen FIDs eingemessen werden info.bfiducialslist.Add(bfi); info.bfiducialslist.Add(bfi); info.bfiducialslist.Add(bfi); info.bfiducialslist.Add(bfi); info.bfiducialslist.Add(bfi); } } } catch (Exception e) { Console.WriteLine(e.ToString()); } // Spiegle den Bottom Layer am Pad der rechts am weitesten außen liegt double right = -1000000; // suche den rechtesten Punkt foreach (device dev in bdevlist) { if (dev.x > right) { right = dev.x; info.rightmostdevice = "Mitte von " + dev.location + " ist X=0"; } } // schau ob evt einer der FIDs noch weiter rechts außen liegt, wenn ja dann nehme diesen foreach (fiducialitem fi in info.bfiducialslist) { if (fi.mark1x > right) { right = fi.mark1x; } } foreach (fiducialitem fi in info.bfiducialslist) { if (fi.mark2x > right) { right = fi.mark2x; } } // Spiegle SMD Pads foreach (device dev in bdevlist) { dev.x = Math.Round(right - dev.x, 2); // und spiegle auch die Rotation //dev.rot = (360-dev.rot) % 360; nicht erforderlich, da diese von Eagle bereits gespiegelt ist } // Spiegle Fiducials foreach (fiducialitem fi in info.bfiducialslist) { fi.mark1x = Math.Round(right - fi.mark1x, 2); fi.mark2x = Math.Round(right - fi.mark2x, 2); } return(0); }
void readTail(StreamReader sr, String side) { String s = sr.ReadToEnd(); if (side == "top") { ttailtext = s; } else { btailtext = s; } // zerteile den Tail in die einzelnen Zeilen String[] sa = s.Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries); int idx = 0; foreach (String sx in sa) { if (sx.Contains("Puzzle")) { // Start gefunden // Lese die Werte ein try { double[,] tailinfo = new double[8, 50]; idx++; for (int x = 0; x < 8; x++) { for (int i = 0; i < 50; i++) { tailinfo[x, i] = info.MyToDouble(sa[idx++]); } } if (side == "top") { info.tfiducialslist.Clear(); } else { info.bfiducialslist.Clear(); } for (int f = 0; f < 50; f++) { fiducialitem fi = new fiducialitem(); fi.real1x = tailinfo[0, f]; fi.real1y = tailinfo[1, f]; fi.mark1x = tailinfo[2, f]; fi.mark1y = tailinfo[3, f]; fi.real2x = tailinfo[4, f]; fi.real2y = tailinfo[5, f]; fi.mark2x = tailinfo[6, f]; fi.mark2y = tailinfo[7, f]; if (side == "top") { info.tfiducialslist.Add(fi); } else { info.bfiducialslist.Add(fi); } } break; } catch { return; } } idx++; } idx = 0; foreach (String sx in sa) { if (sx.Contains("Other")) { info.platinendicke = info.MyToDouble(sa[idx + 1]); if (side == "top") { info.exposure_top = info.MyToInt32(sa[idx + 106]); } else { info.exposure_bottom = info.MyToInt32(sa[idx + 106]); } break; } idx++; } }