public TapesClass(DataGridView gr, NeedleClass ndl, Camera cam, CNC c, FormMain MainF) { Grid = gr; Needle = ndl; DownCamera = cam; MainForm = MainF; Cnc = c; }
public NeedleClass(Camera MyCam, CNC MyCnc, FormMain MainF) { MainForm = MainF; Calibrated = false; Cam = MyCam; Cnc = MyCnc; CalibrationPoints.Clear(); }
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); }
public SerialComm(CNC caller, FormMain MainF) { Cnc = caller; MainForm = MainF; }
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; }
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); }
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(); }
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("!%"); }
public SerialComm(CNC caller, FormMain MainF) { Cnc = caller; Port.DataReceived += new SerialDataReceivedEventHandler(DataReceived); MainForm = MainF; }
public TapesClass(DataGridView gr, DataGridView custom, NeedleClass ndl, Camera cam, CNC c, FormMain MainF) { CustomGrid = custom; Grid = gr; Needle = ndl; DownCamera = cam; MainForm = MainF; Cnc = c; }
// The parameters of tapes, most taken care by this dialog // string ID: Name of the tape (ex: 0805, 10k) // enum Direction: which way the components increase (values: PlusX, PlusY, MinusX, MinusY) // double Rotation: Tells how much a part is rotated on the tape (manufacturers load parts on tapes in any orientation they wish). // a part on a tape with PlusY orientation, 0deg. rotation in CAD data, is rotated this much when placed // values 0, 90, 180 and 270 degrees // int nozzle: uses this nozzle for these parts (if nozzles are used) // double pitch: distance from one part to next // double offsetX, OffsetY: distance from location mark (hole, other) to the part (measured in Plus Y orientation) // used for finding the part when optical recognition of holes are used // standard values through a drop down dialog, custom values by manual edit // enum Type: what values to use in optical hole regognition (values: Paper, Black, Clear (last two are plastic tapes)); // used to determine which optical filter set to use in hole regognition // bool MeasureHole: if part is located by optical regognition of tape hole; if not, coordinates are used directly // bool MeasurePart: if part position is optically measured // int Capacity: how many components can be on a fully loaded tape (0: user is prompted to place the component; <0: infinite (feeders)) // int Next: the next component used in placement // int Tray: Some users are using part holder trays, allowing loading/unloading a bunch of tapes at one time. This allows the same for tapes data. // double X, double Y: coordinates of first hole/part // double NextX, NextY: coordinates for the hole/part next used (most cases, automatically maintained) // double PickupZ, PlacementZ: Z values used for pickup/place operation // bool PickupZvalid, PlacementZvalid: if the values are valid (if not, they are measured when used) public TapeEditForm(CNC _cnc, Camera _cam) { InitializeComponent(); Cnc = _cnc; Cam = _cam; }
// ================================================================================= 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); }