Package org.openpnp.model

Examples of org.openpnp.model.BoardLocation


          @Override
          public void valueChanged(ListSelectionEvent e) {
            if (e.getValueIsAdjusting()) {
              return;
            }
            BoardLocation boardLocation = getSelectedBoardLocation();
            boardLocationSelectionActionGroup
                .setEnabled(boardLocation != null);
            if (boardLocation == null) {
              placementsTableModel.setBoard(null);
            }
            else {
              placementsTableModel.setBoard(boardLocation
                  .getBoard());
            }
          }
        });
View Full Code Here


        board.addPlacement(createPlacement("R1", "R-0805-10K", 10, 10, 0, 45,
                Side.Top));
        board.addPlacement(createPlacement("R2", "R-0805-10K", 20, 20, 0, 90,
                Side.Top));

        BoardLocation boardLocation = new BoardLocation(board);
        boardLocation.setLocation(new Location(LengthUnit.Millimeters, 0, 0, 0,
                0));
        boardLocation.setSide(Side.Top);

        job.addBoardLocation(boardLocation);

        return job;
    }
View Full Code Here

        jobPlanner.setJob(job);

        Set<PlacementSolution> solutions;
        while ((solutions = jobPlanner.getNextPlacementSolutions(head)) != null) {
            for (PlacementSolution solution : solutions) {
                BoardLocation bl = solution.boardLocation;
                Part part = solution.placement.getPart();
                Feeder feeder = solution.feeder;
                Placement placement = solution.placement;
                Nozzle nozzle = solution.nozzle;
                NozzleTip nozzleTip = solution.nozzleTip;
     
                if (nozzle == null) {
                    fireJobEncounteredError(JobError.HeadError, "No Nozzle available to service Placement " + placement);
                    return;
                }
       
                if (part == null) {
                    fireJobEncounteredError(JobError.PartError, String.format("Part not found for Board %s, Placement %s", bl.getBoard().getName(), placement.getId()));
                    return;
                }

                if (feeder == null) {
                    fireJobEncounteredError(JobError.FeederError, "No viable Feeders found for Part " + part.getId());
View Full Code Here

            // Dry run of solutions to look for errors
      jobPlanner.setJob(job);
      while ((solutions = jobPlanner.getNextPlacementSolutions(head)) != null) {
          for (PlacementSolution solution : solutions) {
         
          BoardLocation bl = solution.boardLocation;
          Part part = solution.placement.getPart();
          Feeder feeder = solution.feeder;
          Placement placement = solution.placement;
          Nozzle nozzle = solution.nozzle;
          NozzleTip nozzletip = solution.nozzleTip;
View Full Code Here

    while ((solutions = jobPlanner.getNextPlacementSolutions(head)) != null) {
        LinkedHashMap<PlacementSolution, Location> placementSolutionLocations = new LinkedHashMap<PlacementSolution, Location>();
        for (PlacementSolution solution : solutions) {
        firePartProcessingStarted(solution.boardLocation, solution.placement);
       
        BoardLocation bl = solution.boardLocation;
        Part part = solution.placement.getPart();
        Feeder feeder = solution.feeder;
        Placement placement = solution.placement;
        Nozzle nozzle = solution.nozzle;
        NozzleTip nozzleTip = solution.nozzleTip;

        // Determine where we will place the part
        Location boardLocation = bl.getLocation();
        Location placementLocation = placement.getLocation();

        // We will work in the units of the placementLocation, so convert
        // anything that isn't in those units to it.
        boardLocation = boardLocation.convertToUnits(placementLocation.getUnits());
       
        // If we are placing the bottom of the board we need to invert
        // the placement location.
        if (bl.getSide() == Side.Bottom) {
          placementLocation = placementLocation.invert(true, false, false, false);
        }

        // Create the point that represents the final placement location
        Point p = new Point(placementLocation.getX(),
            placementLocation.getY());

        // Rotate and translate the point into the same coordinate space
        // as the board
        p = Utils2D.rotateTranslateScalePoint(p, boardLocation
            .getRotation(), boardLocation.getX(), boardLocation
            .getY(), 1.0, 1.0);

        // Update the placementLocation with the transformed point
        placementLocation = placementLocation.derive(p.getX(), p.getY(), null, null);

        // Update the placementLocation with the board's rotation and
        // the placement's rotation
        // This sets the rotation of the part itself when it will be
        // placed
        placementLocation = placementLocation.derive(
                null,
                null,
                null,
                (placementLocation.getRotation() + boardLocation.getRotation()) % 360.0);

        // Update the placementLocation with the proper Z value. This is
        // the distance to the top of the board minus the height of
        // the part.
        double partHeight = part.getHeight().convertToUnits(placementLocation.getUnits()).getValue();
        placementLocation = placementLocation.derive(null, null, boardLocation.getZ() - partHeight, null);


       
                // NozzleTip Changer
                if (nozzle.getNozzleTip() != nozzleTip) {
                    fireDetailedStatusUpdated(String.format("Unload nozzle tip from nozzle %s.", nozzle.getId()));       

                    if (!shouldJobProcessingContinue()) {
                        return;
                    }
                   
                    try {
                        nozzle.unloadNozzleTip();
                    }
                    catch (Exception e) {
                        fireJobEncounteredError(JobError.PickError, e.getMessage());
                        return;
                    }
                   
                    fireDetailedStatusUpdated(String.format("Load nozzle tip %s into nozzle %s.", nozzleTip.getId(), nozzle.getId()));       

                    if (!shouldJobProcessingContinue()) {
                        return;
                    }
                                       
                    try {
                        nozzle.loadNozzleTip(nozzleTip);
                    }
                    catch (Exception e) {
                        fireJobEncounteredError(JobError.PickError, e.getMessage());
                        return;
                    }
                   
                    if (nozzle.getNozzleTip() != nozzleTip) {
                        fireJobEncounteredError(JobError.PickError, "Failed to load correct nozzle tip");
                        return;
                    }
                   
                    try {
                        ((ZippyNozzleTip) nozzleTip).calibrate((ZippyNozzle) nozzle);                   
                    }
                    catch (Exception e) {
                        fireJobEncounteredError(JobError.PickError, e.getMessage());
                        return;
                    }
                }
                // End NozzleTip Changer
               
                if (!nozzle.getNozzleTip().canHandle(part)) {
                    fireJobEncounteredError(JobError.PickError, "Selected nozzle tip is not compatible with part");
                }
               
        pick(nozzle, feeder, bl, placement);
        placementSolutionLocations.put(solution, placementLocation);
      }
       
            // TODO: a lot of the event fires are broken
        for (PlacementSolution solution : solutions) {
                Nozzle nozzle = solution.nozzle;
                BoardLocation bl = solution.boardLocation;
                Placement placement = solution.placement;
                Location placementLocation = placementSolutionLocations.get(solution);
                place(nozzle, bl, placementLocation, placement);
            }
       
View Full Code Here

  }
 
  @Override
  public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
    try {
      BoardLocation boardLocation = job.getBoardLocations().get(rowIndex);
      if (columnIndex == 0) {
        boardLocation.getBoard().setName((String) aValue);
      }
      else if (columnIndex == 1) {
        boardLocation.setSide((Side) aValue);
        fireTableCellUpdated(rowIndex, columnIndex);
      }
      else if (columnIndex == 2) {
        LengthCellValue value = (LengthCellValue) aValue;
        Length length = value.getLength();
        Location location = boardLocation.getLocation();
        location = Length.setLocationField(configuration, location, length, Length.Field.X);
        boardLocation.setLocation(location);
      }
      else if (columnIndex == 3) {
        LengthCellValue value = (LengthCellValue) aValue;
        Length length = value.getLength();
        Location location = boardLocation.getLocation();
        location = Length.setLocationField(configuration, location, length, Length.Field.Y);
        boardLocation.setLocation(location);
      }
      else if (columnIndex == 4) {
        LengthCellValue value = (LengthCellValue) aValue;
        Length length = value.getLength();
        Location location = boardLocation.getLocation();
        location = Length.setLocationField(configuration, location, length, Length.Field.Z);
        boardLocation.setLocation(location);
      }
      else if (columnIndex == 5) {
                boardLocation.setLocation(boardLocation.getLocation().derive(null, null, null, Double.parseDouble(aValue.toString())));
      }
    }
    catch (Exception e) {
      // TODO: dialog, bad input
    }
View Full Code Here

      // TODO: dialog, bad input
    }
  }

  public Object getValueAt(int row, int col) {
    BoardLocation boardLocation = job.getBoardLocations().get(row);
    Location loc = boardLocation.getLocation();
    switch (col) {
    case 0:
      return boardLocation.getBoard().getName();
    case 1:
      return boardLocation.getSide();
    case 2:
      return new LengthCellValue(loc.getLengthX());
    case 3:
      return new LengthCellValue(loc.getLengthY());
    case 4:
View Full Code Here

        Set<PlacementSolution> solutions;
    while ((solutions = jobPlanner.getNextPlacementSolutions(head)) != null) {
        LinkedHashMap<PlacementSolution, Location> placementSolutionLocations = new LinkedHashMap<PlacementSolution, Location>();
        for (PlacementSolution solution : solutions) {
                BoardLocation bl = solution.boardLocation;
                Part part = solution.placement.getPart();
                Feeder feeder = solution.feeder;
                Placement placement = solution.placement;
                Nozzle nozzle = solution.nozzle;
                NozzleTip nozzleTip = solution.nozzleTip;
               
                firePartProcessingStarted(solution.boardLocation, solution.placement);
       
                Location placementLocation =
                        Utils2D.calculateBoardPlacementLocation(bl, placement);

        // Update the placementLocation with the proper Z value. This is
        // the distance to the top of the board plus the height of
        // the part.
                Location boardLocation = bl.getLocation().convertToUnits(placementLocation.getUnits());
        double partHeight = part.getHeight().convertToUnits(placementLocation.getUnits()).getValue();
        placementLocation = placementLocation.derive(null, null, boardLocation.getZ() + partHeight, null);

        // NozzleTip Changer
        if (nozzle.getNozzleTip() != nozzleTip) {
              fireDetailedStatusUpdated(String.format("Unload nozzle tip from nozzle %s.", nozzle.getId()));       

              if (!shouldJobProcessingContinue()) {
                  return;
              }
             
                    try {
                        nozzle.unloadNozzleTip();
                    }
                    catch (Exception e) {
                        fireJobEncounteredError(JobError.PickError, e.getMessage());
                        return;
                    }
                   
                    fireDetailedStatusUpdated(String.format("Load nozzle tip %s into nozzle %s.", nozzleTip.getId(), nozzle.getId()));       

                    if (!shouldJobProcessingContinue()) {
                        return;
                    }
                                       
              try {
                      nozzle.loadNozzleTip(nozzleTip);
              }
              catch (Exception e) {
                  fireJobEncounteredError(JobError.PickError, e.getMessage());
                  return;
              }
             
              if (nozzle.getNozzleTip() != nozzleTip) {
                        fireJobEncounteredError(JobError.PickError, "Failed to load correct nozzle tip");
                        return;
              }
        }
        // End NozzleTip Changer
       
        if (!nozzle.getNozzleTip().canHandle(part)) {
                    fireJobEncounteredError(JobError.PickError, "Selected nozzle tip is not compatible with part");
                    return;
        }
       
        pick(nozzle, feeder, bl, placement);
        placementSolutionLocations.put(solution, placementLocation);
      }
       
            // TODO: a lot of the event fires are broken
        for (PlacementSolution solution : solutions) {
                Nozzle nozzle = solution.nozzle;
                BoardLocation bl = solution.boardLocation;
                Placement placement = solution.placement;
                Location placementLocation = placementSolutionLocations.get(solution);
                place(nozzle, bl, placementLocation, placement);
            }
    }
View Full Code Here

TOP

Related Classes of org.openpnp.model.BoardLocation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.