コード例 #1
0
        public void ReadFromFile(string Tray)
        {
            const int indexPlace = 0;
            const int row        = 2;
            const int col        = 3;
            const int xPlace     = 4;
            const int yPlace     = 5;
            const int startLine  = 5;

            try
            {
                string path = "";
                if (Tray == "LoadTray")
                {
                    path = filePathTXT + AppGen.Inst.OrderParams.ServiceLoadTrayName;
                }
                else
                {
                    path = filePathTXT + AppGen.Inst.OrderParams.ServiceUnloadTrayName;
                }

                if (!System.IO.File.Exists(path))
                {
                    System.Windows.Forms.MessageBox.Show("TRAY File not found");
                    return;
                }

                string[] lines = System.IO.File.ReadAllLines(path);
                InsertCountAtServiceRow = 0;
                for (int ii = startLine; ii < lines.Length; ii++)
                {
                    string   line  = lines[ii];
                    string[] parts = line.Split(("").ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                    if (parts.Length == 0)
                    {
                        continue;
                    }

                    TrayIndexData trayIndexData = new TrayIndexData();
                    trayIndexData.Index      = int.Parse(parts[indexPlace]);
                    trayIndexData.RowNum     = int.Parse(parts[row]);
                    trayIndexData.CollumnNum = int.Parse(parts[col]);
                    trayIndexData.X_file     = double.Parse(parts[xPlace]);
                    trayIndexData.Y_file     = double.Parse(parts[yPlace]);
                    IndexList.Add(trayIndexData);
                    if (trayIndexData.CollumnNum > InsertCountAtServiceRow)
                    {
                        InsertCountAtServiceRow = trayIndexData.CollumnNum;
                    }
                }
            }
            catch { }
        }
コード例 #2
0
        public void Subject_Ran(object sender, EventArgs e)     //Run tool
        {
            cogAcqTool = cogToolBlockEditV21.Subject.Tools["CogAcqFifoTool1"] as CogAcqFifoTool;
            calbCheckerBoard.InputImage = cogToolBlockEditV21.Subject.Inputs["Image"].Value as CogImage8Grey;
            calbCheckerBoard            = cogToolBlockEditV21.Subject.Tools["CogCalibCheckerboardTool1"] as CogCalibCheckerboardTool;
            calbCheckerBoard.Run();
            CalibNPointTool            = cogToolBlockEditV21.Subject.Tools["CogCalibNPointToNPointTool1"] as CogCalibNPointToNPointTool;
            CalibNPointTool.InputImage = calbCheckerBoard.OutputImage;
            cogPMAlignTool             = cogToolBlockEditV21.Subject.Tools["CogPMAlignTool1"] as CogPMAlignTool;
            cogPMAlignTool.InputImage  = CalibNPointTool.OutputImage as CogImage8Grey;
            cogRecordDisplay1.Image    = cogPMAlignTool.InputImage;
            cogPMAlignTool.Run();
            cogRecordDisplay1.Record = cogPMAlignTool.CreateLastRunRecord();
            cogRecordDisplay1.Fit(true);
            if (dataGridView1.Visible == false)
            {
                dataGridView1.Visible = true;
            }
            dataGridView1.Rows.Clear();


            TrayIndexData TIS;

            AppGen.Inst.UnLoadCarrier.CurrIndex = 0;
            AppGen.Inst.UnLoadCarrier.IndexList.Clear();

            try
            {
                for (int i = 0; i < cogPMAlignTool.Results.Count; i++)
                {
                    TIS = new TrayIndexData();
                    dataGridView1.Rows.Add();
                    dataGridView1[0, i].Value = cogPMAlignTool.Results[i].ID.ToString();
                    dataGridView1[1, i].Value = cogPMAlignTool.Results[i].Score.ToString();
                    dataGridView1[2, i].Value = cogPMAlignTool.Results[i].GetPose().Rotation *(180 / Math.PI);
                    dataGridView1[3, i].Value = cogPMAlignTool.Results[i].GetPose().TranslationX;
                    dataGridView1[4, i].Value = cogPMAlignTool.Results[i].GetPose().TranslationY;

                    TIS.X_VisRes     = cogPMAlignTool.Results[i].GetPose().TranslationX;
                    TIS.Y_VisRes     = cogPMAlignTool.Results[i].GetPose().TranslationY;
                    TIS.Angle_VisRes = cogPMAlignTool.Results[i].GetPose().Rotation *(180 / Math.PI);

                    AppGen.Inst.UnLoadCarrier.IndexList.Add(TIS);
                }
                txtPatMaxScoreValue.Text = cogPMAlignTool.Results.Count.ToString();
            }
            catch (Exception)
            {
                MessageBox.Show("No Input Image available for setup.", "PatMax Setup Error");
            }
        }