/* Goal of this is to find the bottom XY of the tray and then find the initial position of the part of each populated row. */ public FeederLocatorViewModel(IMachine machine, PnPJob job, string pnpJobFileName) : base(machine) { _job = job; _pnpJobFileName = pnpJobFileName; SaveCommand = new RelayCommand(Save); FeederDefinitions = new FeederDefinitionsViewModel(machine); }
private void ClosePnPJob_Click(object sender, RoutedEventArgs e) { _pnpJob = null; _pnpJobFileName = null; EditPnPJob.IsEnabled = false; FeederAlignementView.IsEnabled = false; ClosePnPJob.IsEnabled = false; }
public async void CreateBOMTests() { var job = new PnPJob(); job.EagleBRDFilePath = "./KegeratorController.brd"; await job.OpenAsync(); }
public MVFeederLocatorView(IMachine machine, PnPJob job, string fileName) { InitializeComponent(); var designTime = System.ComponentModel.DesignerProperties.GetIsInDesignMode(new DependencyObject()); if (!designTime) { ViewModel = new FeederLocatorViewModel(machine, job, fileName); this.Closing += MachineVision_Closing; this.Loaded += MachineVision_Loaded; } }
private async void NewPnPJob_Click(object sender, RoutedEventArgs e) { if (ViewModel.Machine.PCBManager.HasProject) { if (ViewModel.Machine.PCBManager.HasBoard) { var pnpJob = new PnPJob(); pnpJob.Board = ViewModel.Machine.PCBManager.Board; pnpJob.EagleBRDFilePath = ViewModel.Machine.PCBManager.Project.EagleBRDFilePath; var pnpViewModel = new PnPJobViewModel(ViewModel.Machine, pnpJob); await pnpViewModel.InitAsync(); var jobWindow = new Views.PNPJobWindow(); jobWindow.DataContext = pnpViewModel; jobWindow.Owner = this; jobWindow.ShowDialog(); EditPnPJob.IsEnabled = true; FeederAlignementView.IsEnabled = true; if (String.IsNullOrEmpty(pnpViewModel.FileName)) { _pnpJob = pnpJob; _pnpJobFileName = pnpViewModel.FileName; EditPnPJob.IsEnabled = true; ClosePnPJob.IsEnabled = true; FeederAlignementView.IsEnabled = true; } } else { MessageBox.Show("Please make sure your PCB Project includes a PCB."); } } else { MessageBox.Show("Please open or create a PCB Project First."); } }
public PnPJobViewModel(IMachine machine, PnPJob job) : base(machine) { _billOfMaterials = new BOM(job.Board); _job = job; _isDirty = true; SaveCommand = new RelayCommand(() => SaveJob()); CloseCommand = new RelayCommand(Close); CloneCommand = new RelayCommand(CloneConfiguration); PeformMachineAlignmentCommand = new RelayCommand(PerformMachineAlignment); GoToPartOnBoardCommand = new RelayCommand(GoToPartOnBoard); GoToPartPositionInTrayCommand = new RelayCommand(GoToPartPositionInTray); SelectMachineFileCommand = new RelayCommand(SelectMachineFile); HomingCycleCommand = new RelayCommand(() => Machine.HomingCycle()); AlignBottomCameraCommand = new RelayCommand(() => AlignBottomCamera()); ResetCurrentComponentCommand = new RelayCommand(ResetCurrentComponent, () => SelectedPartRow != null); GoToWorkHomeCommand = new RelayCommand(() => GotoWorkspaceHome()); SetWorkHomeCommand = new RelayCommand(() => Machine.SetWorkspaceHome()); MoveToPreviousComponentInTapeCommand = new RelayCommand(MoveToPreviousComponent, () => SelectedPartRow != null && SelectedPartRow.CurrentPartIndex > 0); MoveToNextComponentInTapeCommand = new RelayCommand(MoveToNextComponentInTape, () => SelectedPartRow != null && SelectedPartRow.CurrentPartIndex < SelectedPartRow.PartCount); RefreshConfigurationPartsCommand = new RelayCommand(PopulateConfigurationParts); GoToPartInTrayCommand = new RelayCommand(GoToPartPositionInTray); PlaceCurrentPartCommand = new RelayCommand(PlacePart, CanPlacePart); PlaceAllPartsCommand = new RelayCommand(PlaceAllParts, CanPlacePart); PausePlacmentCommand = new RelayCommand(PausePlacement, CanPausePlacement); SetFiducialCalibrationCommand = new RelayCommand((prm) => SetFiducialCalibration(prm)); CalibrateBottomCameraCommand = new RelayCommand(() => CalibrateBottomCamera()); _feederLibrary = new FeederLibrary(); BuildFlavors = job.BuildFlavors; SelectedBuildFlavor = job.BuildFlavors.FirstOrDefault(); if (SelectedBuildFlavor == null) { SelectedBuildFlavor = new BuildFlavor() { Name = "Default" }; foreach (var entry in _billOfMaterials.SMDEntries) { foreach (var component in entry.Components) { component.Included = true; SelectedBuildFlavor.Components.Add(component); } } job.BuildFlavors.Add(SelectedBuildFlavor); } PartPackManagerVM = new PartPackManagerViewModel(Machine, this); PackageLibraryVM = new PackageLibraryViewModel(); GoToFiducial1Command = new RelayCommand(() => GoToFiducial(1)); GoToFiducial2Command = new RelayCommand(() => GoToFiducial(2)); PopulateParts(); PopulateConfigurationParts(); }