Ejemplo n.º 1
0
 public TapesClass(DataGridView gr, NeedleClass ndl, Camera cam, CNC c, FormMain MainF)
 {
     Grid = gr;
     Needle = ndl;
     DownCamera = cam;
     MainForm = MainF;
     Cnc = c;
 }
Ejemplo n.º 2
0
 public NeedleClass(Camera MyCam, CNC MyCnc, FormMain MainF)
 {
     MainForm = MainF;
     Calibrated = false;
     Cam = MyCam;
     Cnc = MyCnc;
     CalibrationPoints.Clear();
 }
Ejemplo n.º 3
0
        public bool StartingUp = false; // we want to react to some changes, but not during startup data load (which is counts as a change)

        private void Form1_Load(object sender, EventArgs e)
        {
            StartingUp = true;
            this.Size = new Size(1280, 900);
            DisplayText("Application Start");

            Do_Upgrade();
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-us");
            System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
            Cnc = new CNC(this);
            Cnc_ReadyEvent = Cnc.ReadyEvent;
            CNC.SquareCorrection = Properties.Settings.Default.CNC_SquareCorrection;
            DownCamera = new Camera(this);
            UpCamera = new Camera(this);
            Needle = new NeedleClass(UpCamera, Cnc, this);
            Tapes = new TapesClass(Tapes_dataGridView, CustomTapes_dataGridView, Needle, DownCamera, Cnc, this);

            // Setup error handling for Tapes_dataGridView
            // This is necessary, because programmatically changing a combobox cell value raises this error. (@MS: booooo!)
            Tapes_dataGridView.DataError += new DataGridViewDataErrorEventHandler(Tapes_dataGridView_DataError);

            this.KeyPreview = true;
            RemoveCursorNavigation(this.Controls);
            // this.KeyDown += new KeyEventHandler(My_KeyDown);
            this.KeyUp += new KeyEventHandler(My_KeyUp);

            string path = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None).FilePath;
            int i = path.LastIndexOf('\\');
            path = path.Remove(i + 1);
            // LoadDataGrid(path + "LitePlacer.ComponentData", ComponentData_dataGridView);
            LoadDataGrid(path + "LitePlacer.TapesData", Tapes_dataGridView);
            LoadDataGrid(path + "LitePlacer.CustomTapes", CustomTapes_dataGridView);
            Tapes.AddCustomTapesToTapes();
            Tapes.AddWidthValues();

            // 
            LoadDataGrid(path + "LitePlacer.HomingFunctions", Temp_dataGridView);
            DataGridViewCopy(Temp_dataGridView, ref Homing_dataGridView, false);

            LoadDataGrid(path + "LitePlacer.FiducialsFunctions", Temp_dataGridView);
            DataGridViewCopy(Temp_dataGridView, ref Fiducials_dataGridView, false);

            LoadDataGrid(path + "LitePlacer.ComponentsFunctions", Temp_dataGridView);
            DataGridViewCopy(Temp_dataGridView, ref Components_dataGridView, false);

            LoadDataGrid(path + "LitePlacer.PaperTapeFunctions", Temp_dataGridView);
            DataGridViewCopy(Temp_dataGridView, ref PaperTape_dataGridView, false);

            LoadDataGrid(path + "LitePlacer.BlackTapeFunctions", Temp_dataGridView);
            DataGridViewCopy(Temp_dataGridView, ref BlackTape_dataGridView, false);

            LoadDataGrid(path + "LitePlacer.ClearTapeFunctions", Temp_dataGridView);
            DataGridViewCopy(Temp_dataGridView, ref ClearTape_dataGridView, false);

            LoadDataGrid(path + "LitePlacer.SnapshotFunctions", Temp_dataGridView);
            DataGridViewCopy(Temp_dataGridView, ref DowncamSnapshot_dataGridView, false);

            LoadDataGrid(path + "LitePlacer.NeedleFunctions", Temp_dataGridView);
            DataGridViewCopy(Temp_dataGridView, ref Needle_dataGridView, false);

            LoadDataGrid(path + "LitePlacer.UpCamComponentsFunctions", Temp_dataGridView);
            DataGridViewCopy(Temp_dataGridView, ref UpCamComponents_dataGridView, false);

            LoadDataGrid(path + "LitePlacer.UpCamSnapshotFunctions", Temp_dataGridView);
            DataGridViewCopy(Temp_dataGridView, ref UpcamSnapshot_dataGridView, false);

            SetProcessingFunctions(Display_dataGridView);
            SetProcessingFunctions(Homing_dataGridView);
            SetProcessingFunctions(Fiducials_dataGridView);
            SetProcessingFunctions(Components_dataGridView);
            SetProcessingFunctions(PaperTape_dataGridView);
            SetProcessingFunctions(BlackTape_dataGridView);
            SetProcessingFunctions(ClearTape_dataGridView);
            SetProcessingFunctions(DowncamSnapshot_dataGridView);
            SetProcessingFunctions(Needle_dataGridView);
            SetProcessingFunctions(UpCamComponents_dataGridView);
            SetProcessingFunctions(UpcamSnapshot_dataGridView);

            Bookmark1_button.Text = Properties.Settings.Default.General_Mark1Name;
            Bookmark2_button.Text = Properties.Settings.Default.General_Mark2Name;
            Bookmark3_button.Text = Properties.Settings.Default.General_Mark3Name;
            Bookmark4_button.Text = Properties.Settings.Default.General_Mark4Name;
            Bookmark5_button.Text = Properties.Settings.Default.General_Mark5Name;
            Bookmark6_button.Text = Properties.Settings.Default.General_Mark6Name;
            Mark1_textBox.Text = Properties.Settings.Default.General_Mark1Name;
            Mark2_textBox.Text = Properties.Settings.Default.General_Mark2Name;
            Mark3_textBox.Text = Properties.Settings.Default.General_Mark3Name;
            Mark4_textBox.Text = Properties.Settings.Default.General_Mark4Name;
            Mark5_textBox.Text = Properties.Settings.Default.General_Mark5Name;
            Mark6_textBox.Text = Properties.Settings.Default.General_Mark6Name;

            // The components tab is more a distraction than useful.
            // To add data, comment out the next line.
            tabControlPages.TabPages.Remove(Components_tabPage);

            Zlb_label.Text = "";
            Zlb_label.Visible = false;

            Display_dataGridView.DataError += new
                DataGridViewDataErrorEventHandler(Display_dataGridView_DataError);
        }
Ejemplo n.º 4
0
 private int MeasureClosestComponentInPx(out double X, out double Y, out double A, Camera Cam, double Tolerance, int averages)
 {
     X = 0;
     double Xsum = 0;
     Y = 0;
     double Ysum = 0;
     A = 0.0;
     double Asum = 0.0;
     int count = 0;
     for (int i = 0; i < averages; i++)
     {
         if (Cam.GetClosestComponent(out X, out Y, out A, Tolerance) > 0)
         {
             //DisplayText("GetClosestComponent, X: " + X.ToString() + ", Y: " + Y.ToString() + ", A: " + A.ToString()+
             //    ", red: "+ReduceRotation(A).ToString());
             count++;
             Xsum += X;
             Ysum += Y;
             Asum += ReduceRotation(A);
         }
     }
     if (count == 0)
     {
         return 0;
     }
     X = Xsum / (float)count;
     Y = Ysum / (float)count;
     A = -Asum / (float)count;
     return count;
 }
Ejemplo n.º 5
0
        private void SelectCamera(Camera cam)
        {
            if (KeepActive_checkBox.Checked)
            {
                DownCamera.Active = false;
                UpCamera.Active = false;
                cam.Active = true;
                if (cam == DownCamera)
                {
                    DisplayText("DownCamera activated");
                }
                else
                {
                    DisplayText("UpCamera activated");
                }
                return;
            };

            if (Properties.Settings.Default.Cameras_RobustSwitch)
            {
                if (UpCamera.IsRunning())
                {
                    UpCamera.Close();
                };
                if (DownCamera.IsRunning())
                {
                    DownCamera.Close();
                };
            }
            if (cam == DownCamera)
            {
                if (UpCamera.IsRunning())
                {
                    UpCamera.Close();
                };
                StartDownCamera_m();
            }
            else
            {
                if (DownCamera.IsRunning())
                {
                    DownCamera.Close();
                };
                StartUpCamera_m();
            }
        }
Ejemplo n.º 6
0
        // ==========================================================================================================
        // Components:

        private void DebugComponents_Camera(double Tolerance, Camera Cam, double mmPerPixel)
        {
            double X = 0;
            double Y = 0;
            double A = 0.0;
            int count = MeasureClosestComponentInPx(out X, out Y, out A, Cam, Tolerance, 5);
            if (count == 0)
            {
                DisplayText("No results");
                return;
            }
            X = X * mmPerPixel;
            Y = -Y * mmPerPixel;
            DisplayText("Component measurement:");
            DisplayText("X: " + X.ToString("0.000", CultureInfo.InvariantCulture) + " (" + count.ToString() + " results out of 5)");
            DisplayText("Y: " + Y.ToString("0.000", CultureInfo.InvariantCulture));
            DisplayText("A: " + A.ToString("0.000", CultureInfo.InvariantCulture));
        }
Ejemplo n.º 7
0
 private void SelectCamera(Camera cam)
 {
     if (Properties.Settings.Default.Cameras_RobustSwitch)
     {
         if (UpCamera.IsRunning())
         {
             UpCamera.Close();
         };
         if (DownCamera.IsRunning())
         {
             DownCamera.Close();
         };
     }
     if (cam == DownCamera)
     {
         if (UpCamera.IsRunning())
         {
             UpCamera.Close();
         };
         StartDownCamera_m();
     }
     else
     {
         if (DownCamera.IsRunning())
         {
             DownCamera.Close();
         };
         StartUpCamera_m();
     }
 }
Ejemplo n.º 8
0
        // =================================================================================
        // Up/Down camera setup page functions
        // =================================================================================
        #region Camera setup pages functions

        // =================================================================================
        // Common
        // =================================================================================
        private void SelectCamera(Camera cam)
        {
            if (UpCamera.IsRunning())
            {
                UpCamera.Close();
            };
            if (DownCamera.IsRunning())
            {
                DownCamera.Close();
            };
            if (cam == DownCamera)
            {
                StartDownCamera_m();
            }
            else
            {
                StartUpCamera_m();
            }
        }
Ejemplo n.º 9
0
        // =================================================================================

        private void Form1_Load(object sender, EventArgs e)
        {
            this.Size = new Size(1280, 960);
            DisplayText("Application Start");

            Do_Upgrade();

            System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
            Cnc = new CNC(this);
            Cnc_ReadyEvent = Cnc.ReadyEvent;
            CNC.SquareCorrection = Properties.Settings.Default.CNC_SquareCorrection;
            DownCamera = new Camera(this);
            UpCamera = new Camera(this);
            Needle = new NeedleClass(UpCamera, Cnc, this);
            Tapes = new TapesClass(Tapes_dataGridView, Needle, DownCamera, Cnc, this);


            this.KeyPreview = true;
            RemoveCursorNavigation(this.Controls);
            // this.KeyDown += new KeyEventHandler(My_KeyDown);
            this.KeyUp += new KeyEventHandler(My_KeyUp);

            string path = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None).FilePath;
            int i = path.LastIndexOf('\\');
            path = path.Remove(i + 1);
            LoadDataGrid(path + "LitePlacer.ComponentData", ComponentData_dataGridView);
            LoadDataGrid(path + "LitePlacer.TapesData", Tapes_dataGridView);

            LoadDataGrid(path + "LitePlacer.HomingFunctions", Homing_dataGridView);
            LoadDataGrid(path + "LitePlacer.FiducialsFunctions", Fiducials_dataGridView);
            LoadDataGrid(path + "LitePlacer.ComponentsFunctions", Components_dataGridView);
            LoadDataGrid(path + "LitePlacer.PaperTapeFunctions", PaperTape_dataGridView);
            LoadDataGrid(path + "LitePlacer.BlackTapeFunctions", BlackTape_dataGridView);
            LoadDataGrid(path + "LitePlacer.ClearTapeFunctions", ClearTape_dataGridView);
            LoadDataGrid(path + "LitePlacer.NeedleFunctions", Needle_dataGridView);
            LoadDataGrid(path + "LitePlacer.UpCamComponentsFunctions", UpCamComponents_dataGridView);
            SetProcessingFunctions(Display_dataGridView);
            SetProcessingFunctions(Homing_dataGridView);
            SetProcessingFunctions(Fiducials_dataGridView);
            SetProcessingFunctions(Components_dataGridView);
            SetProcessingFunctions(PaperTape_dataGridView);
            SetProcessingFunctions(BlackTape_dataGridView);
            SetProcessingFunctions(ClearTape_dataGridView);
            SetProcessingFunctions(Needle_dataGridView);
            SetProcessingFunctions(UpCamComponents_dataGridView);

            Bookmark1_button.Text = Properties.Settings.Default.General_Mark1Name;
            Bookmark2_button.Text = Properties.Settings.Default.General_Mark2Name;
            Bookmark3_button.Text = Properties.Settings.Default.General_Mark3Name;
            Bookmark4_button.Text = Properties.Settings.Default.General_Mark4Name;
            Bookmark5_button.Text = Properties.Settings.Default.General_Mark5Name;
            Bookmark6_button.Text = Properties.Settings.Default.General_Mark6Name;
            Mark1_textBox.Text = Properties.Settings.Default.General_Mark1Name;
            Mark2_textBox.Text = Properties.Settings.Default.General_Mark2Name;
            Mark3_textBox.Text = Properties.Settings.Default.General_Mark3Name;
            Mark4_textBox.Text = Properties.Settings.Default.General_Mark4Name;
            Mark5_textBox.Text = Properties.Settings.Default.General_Mark5Name;
            Mark6_textBox.Text = Properties.Settings.Default.General_Mark6Name;

            // The components tab is more a distraction than useful.
            // To add data, comment out the next line.
            tabControlPages.TabPages.Remove(Components_tabPage);

            SetDownCameraDefaults();
            SetUpCameraDefaults();
            SelectCamera(DownCamera);

            Zlb_label.Text = "";
            Zlb_label.Visible = false;

            Display_dataGridView.DataError += new
                DataGridViewDataErrorEventHandler(Display_dataGridView_DataError);
        }