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 TapesClass(DataGridView gr, NeedleClass ndl, Camera cam, CNC c, FormMain MainF)
 {
     Grid = gr;
     Needle = ndl;
     DownCamera = cam;
     MainForm = MainF;
     Cnc = c;
 }
Ejemplo n.º 3
0
 public TapesClass(DataGridView gr, NeedleClass ndl, CNC c, FormMain MainF)
 {
     Grid = gr;
     Needle = ndl;
     MainForm = MainF;
     Cnc = c;
     TapeTypes = AForgeFunctionSet.GetTapeTypes();
     if (File.Exists(Global.BaseDirectory + @"\" + TapesSaveName))
         tapeObjs = Global.DeSerialization<SortableBindingList<TapeObj>>(TapeFilename);
 }
Ejemplo n.º 4
0
 public TapesClass(DataGridView gr, NeedleClass ndl, CNC c, FormMain MainF)
 {
     Grid      = gr;
     Needle    = ndl;
     MainForm  = MainF;
     Cnc       = c;
     TapeTypes = AForgeFunctionSet.GetTapeTypes();
     if (File.Exists(Global.BaseDirectory + @"\" + TapesSaveName))
     {
         tapeObjs = Global.DeSerialization <SortableBindingList <TapeObj> >(TapeFilename);
     }
 }
Ejemplo n.º 5
0
        public void InitializeObject(DataGridView gr, DataGridView gridLoc, NeedleClass ndl, CNC c, FormMain MainF)
        {
            Grid = gr;
            Needle = ndl;
            MainForm = MainF;
            Cnc = c;
            GridLocations = gridLoc;
            //if (File.Exists(Global.BaseDirectory + @"\" + NozzlesSaveName))
            //    nozzles = Global.DeSerialization<SortableBindingList<Nozzle>>(NozzlesFilename);
            ReLoad();

            nozzles.ListChanged += nozzles_ListChanged;
            Grid.CellValueChanged += Grid_CellValueChanged;
            Grid.CurrentCellDirtyStateChanged += Grid_CurrentCellDirtyStateChanged;
        }
Ejemplo n.º 6
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.º 7
0
        public FormMain() {
            InitializeComponent();
            setupQueuedMessages(); //error handling

            Do_Upgrade();

            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");

            // setup objects
            Cnc = new CNC(this);
            CNC.SquareCorrection = Properties.Settings.Default.CNC_SquareCorrection;

            Needle = new NeedleClass(this);
            Tapes = new TapesClass(Tapes_dataGridView, Needle, Cnc, this);
            Cad = new CAD(this);
            Locations = new LocationManager();

            Global.Instance.cnc = Cnc;
            Global.Instance.needle = Needle;
            Global.Instance.mainForm = this;
            Global.Instance.Locations = Locations;

            // open camera form
            // show the camera view stuff right away
            cameraView = new CameraView();
            cameraView.Show();
            cameraView.SetDownCameraDefaults();
            cameraView.SetUpCameraDefaults();
            cameraView.downClickDelegate = DownClickDelegate;
            cameraView.upClickDelegate = UpClickDelegate;

            //setup location jumps
            UpdateGoToPulldownMenu();
            Locations.GetList().ListChanged += delegate { 
                UpdateGoToPulldownMenu();
                Locations.Save();
            }; //update if list changed
            Locations.LocationChangeEvent += (s, e) => {
                if (e.PropertyName.Equals("Name")) UpdateGoToPulldownMenu();
                Locations.Save();
            }; //update if name on list changes

            //setup table entry dragging
            componentDrag = new DataGridDrag(CadData_GridView);
            locationDrag = new DataGridDrag(locations_dataGridView);
            tapeDrag = new DataGridDrag(Tapes_dataGridView);
            jobDrag = new DataGridDrag(JobData_GridView);

            //setup table bindings
            CadData_GridView.DataSource = Cad.ComponentData;
            locations_dataGridView.DataSource = Locations.GetList();            
            Tapes_dataGridView.DataSource = Tapes.tapeObjs;
            OriginalPartOrientation.DataSource = TapeObj.Orientation;
            OriginalTapeOrientation.DataSource = TapeObj.Orientation;
            UpdateTapeTypesBinding();
            PartType.DataSource = Enum.GetNames(typeof(ComponentType));

            //jobs table
            JobData_GridView.DataSource = Cad.JobData;
            methodDataGridViewComboBoxColumn.DataSource = new[] {"?", "Place", "LoosePlace", "Change Needle", "Recalibrate", "Ignore", "Pause", "Fiducial", "Place With UpCam"};
            // apply changes to multiple placement types at once
            JobData_GridView.CellValueChanged += (o, e) => {
                if (e.ColumnIndex != 3) return;
                for (int i = 0; i < JobData_GridView.SelectedCells.Count; i++) {
                    if (JobData_GridView.SelectedCells[i].ColumnIndex == 3) {
                        ((JobData)JobData_GridView.SelectedCells[i].OwningRow.DataBoundItem).Method =
                            ((JobData)JobData_GridView.Rows[e.RowIndex].DataBoundItem).Method;

                    }
                }
            };

            // right click context menu
            CadData_GridView.CellMouseDown += CadData_CellMouseDown;
            JobData_GridView.CellMouseDown += JobData_CellMouseDown;
            Tapes_dataGridView.CellMouseDown += Tapes_CellMouseDown;

            // setup key handling
            KeyPreview = true;
            SetupCursorNavigation(Controls);
            KeyUp += My_KeyUp;

            instructions_label.Text = "";
            instructions_label.Visible = false;

            // setup a bunch of stuff on the forms
            LightPlacerFormsSetup();
        }
Ejemplo n.º 8
0
        public FormMain() {
            InitializeComponent();
            setupQueuedMessages(); //error handling

            Do_Upgrade();

            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");

            // setup objects
            Cnc = new CNC(this);
            CNC.SquareCorrection = Properties.Settings.Default.CNC_SquareCorrection;

            Needle = new NeedleClass(this);
            Tapes = new TapesClass(Tapes_dataGridView, Needle, Cnc, this);
            Cad = new CAD(this);
            Locations = new LocationManager();

            Global.Instance.cnc = Cnc;
            Global.Instance.needle = Needle;
            Global.Instance.mainForm = this;
            Global.Instance.Locations = Locations;

            // open camera form
            // show the camera view stuff right away
            cameraView = new CameraView();
            cameraView.Show();
            cameraView.SetDownCameraDefaults();
            cameraView.SetUpCameraDefaults();
            cameraView.downClickDelegate = DownClickDelegate;
            cameraView.upClickDelegate = UpClickDelegate;

            nozzleChanger = new NozzleChanger();
            nozzleChanger.InitializeObject(dataGridNozzes, datagridLoadSequence, Needle, Cnc, this);
            //listNozzles.DataSource = nozzleChanger.nozzles;
            nozzleChanger.ReLoad();
            dataGridNozzes.DataSource = nozzleChanger.nozzles;
            textBoxNozzleSpeed.Text = nozzleChanger.Speed;

            (dataGridNozzes.Columns[2] as DataGridViewComboBoxColumn).DataSource =
                new BindingSource { DataSource = cameraView.upSet.GetNames() };
            Needle.nozzleChanger = nozzleChanger;
            nozzleChangerEnabled.Checked = nozzleChanger.Enabled;

            //setup location jumps
            UpdateGoToPulldownMenu();
            Locations.GetList().ListChanged += delegate { 
                UpdateGoToPulldownMenu();
                Locations.Save();
            }; //update if list changed
            Locations.LocationChangeEvent += (s, e) => {
                if (e.PropertyName.Equals("Name")) UpdateGoToPulldownMenu();
                Locations.Save();
            }; //update if name on list changes

            //setup table entry dragging
            componentDrag = new DataGridDrag(CadData_GridView);
            locationDrag = new DataGridDrag(locations_dataGridView);
            tapeDrag = new DataGridDrag(Tapes_dataGridView);
            jobDrag = new DataGridDrag(JobData_GridView);

            //setup table bindings
            CadData_GridView.DataSource = Cad.ComponentData;
            locations_dataGridView.DataSource = Locations.GetList();            
            Tapes_dataGridView.DataSource = Tapes.tapeObjs;
            OriginalPartOrientation.DataSource = TapeObj.Orientation;
            OriginalTapeOrientation.DataSource = TapeObj.Orientation;
            UpdateTapeTypesBinding();
            PartType.DataSource = Enum.GetNames(typeof(ComponentType));

            (Tapes_dataGridView.Columns["Nozzle"] as DataGridViewComboBoxColumn).DataSource =
                new BindingSource { DataSource = nozzleChanger.getIDs() };

            //jobs table
            JobData_GridView.DataSource = Cad.JobData;
            methodDataGridViewComboBoxColumn.DataSource = new[] {"?", "Place", "LoosePlace", "Change Needle", "Recalibrate", "Ignore", "Pause", "Fiducial", "Place With UpCam", "Change nozzle", "ERROR" };
            // apply changes to multiple placement types at once
            JobData_GridView.CellValueChanged += (o, e) => {
                if (e.ColumnIndex != 3) return;
                for (int i = 0; i < JobData_GridView.SelectedCells.Count; i++) {
                    if (JobData_GridView.SelectedCells[i].ColumnIndex == 3) {
                        ((JobData)JobData_GridView.SelectedCells[i].OwningRow.DataBoundItem).Method =
                            ((JobData)JobData_GridView.Rows[e.RowIndex].DataBoundItem).Method;

                    }
                }
            };

            // right click context menu
            CadData_GridView.CellMouseDown += CadData_CellMouseDown;
            JobData_GridView.CellMouseDown += JobData_CellMouseDown;
            Tapes_dataGridView.CellMouseDown += Tapes_CellMouseDown;

            // setup key handling
            KeyPreview = true;
            SetupCursorNavigation(Controls);
            KeyUp += My_KeyUp;

            instructions_label.Text = "";
            instructions_label.Visible = false;

            // setup a bunch of stuff on the forms
            LightPlacerFormsSetup();

            VisibilityGraph = new visibilitygraph();
            VisibilityGraph = VisibilityGraph.ReLoad();
            if (VisibilityGraph == null) { VisibilityGraph = new visibilitygraph(); }
            VisibilityGraph.drawingSurface = this.pictureBox1;
            VisibilityGraph.setBounds(0, 0, Locations.GetLocation("Max Machine").X, Locations.GetLocation("Max Machine").Y);
            /*
            VisibilityGraph.insertGuard(50, 0, 50, 50);
            VisibilityGraph.insertGuard(50, 50, Locations.GetLocation("Max Machine").X, 50);

            VisibilityGraph.insertGuard(200, 200, 200, 150);
            VisibilityGraph.insertGuard(200, 150, 500, 150);
            VisibilityGraph.insertGuard(500, 150, 500, 200);
            VisibilityGraph.insertGuard(500, 200, 200, 200);
            */
            dataGridGuards.DataSource = VisibilityGraph.Guards;
            checkBoxUseGuards.Checked = VisibilityGraph.Enabled;
            updateDataGridGuard();

            Cnc.RawWrite("{\"gc\":\"G1 F100 Y0\"}");
            Thread.Sleep(100);
            Cnc.RawWrite("!%");
            
        }
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);
        }