Package org.openpnp.model

Examples of org.openpnp.model.Part


              0,
              placementRotation));
      Configuration cfg = Configuration.get();
            if (cfg != null && createMissingParts) {
                String partId = pkgName + "-" + partValue;
                Part part = cfg.getPart(partId);
                if (part == null) {
                    part = new Part(partId);
                    Package pkg = cfg.getPackage(pkgName);
                    if (pkg == null) {
                        pkg = new Package(pkgName);
                        cfg.addPackage(pkg);
                    }
                    part.setPackage(pkg);

                    cfg.addPart(part);
                }
                placement.setPart(part);
View Full Code Here


      Configuration cfg = Configuration.get();
            if (cfg != null && createMissingParts) {
                String packageId = matcher.group(6);

                String partId = packageId + "-" + matcher.group(5);
                Part part = cfg.getPart(partId);
                if (part == null) {
                    part = new Part(partId);
                    Package pkg = cfg.getPackage(packageId);
                    if (pkg == null) {
                        pkg = new Package(packageId);
                        cfg.addPackage(pkg);
                    }
                    part.setPackage(pkg);

                    cfg.addPart(part);
                }
                placement.setPart(part);
View Full Code Here

      @Override
      public void valueChanged(ListSelectionEvent e) {
        if (e.getValueIsAdjusting()) {
          return;
        }
        Part part = getSelectedPart();
       
        deletePartAction.setEnabled(part != null);
       
            CameraView cameraView = MainFrame.cameraPanel.getSelectedCameraView();
            if (cameraView != null) {
                  if (part != null) {
                      Reticle reticle = new OutlineReticle(part.getPackage().getOutline());
                      MainFrame.cameraPanel.getSelectedCameraView().setReticle(PartsPanel.this.getClass().getName(), reticle);
                  }
                  else {
                      MainFrame.cameraPanel.getSelectedCameraView().removeReticle(PartsPanel.this.getClass().getName());
                  }                                      
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()));       
View Full Code Here

        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());
                    return;
                }
       
                if (nozzleTip == null) {
                    fireJobEncounteredError(JobError.HeadError, "No viable NozzleTips found for Part / Feeder " + part.getId());
                    return;
                }
       
      }
    }
View Full Code Here

  @Override
  public Part convertReverse(String partId) {
    if (partId == null) {
      return null;
    }
    Part part = configuration.getPart(partId);
    if (part == null) {
      throw new RuntimeException("Invalid part id");
    }
    return part;
  }
View Full Code Here

      for (Placement placement : board.getPlacements()) {
        if (placement.getSide() != jobBoard.getSide()) {
          continue;
        }
       
        Part part = placement.getPart();
        if (part == null) {
          fireJobEncounteredError(JobError.PartError, String.format("Part not found for Board %s, Placement %s", board.getName(), placement.getId()));
          return;
        }
      } 
            // 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;

          if (nozzle == null) {
                      fireJobEncounteredError(JobError.HeadError, "No Nozzle available to service Placement " + placement);
                      return;
                  }
 
          if (nozzletip == null) {
                      fireJobEncounteredError(JobError.HeadError, "No NozzleTip available to service Placement " + placement);
                      return;
                  }
 
          if (feeder == null) {
            fireJobEncounteredError(JobError.FeederError, "No viable Feeders found for Part " + part.getId());
            return;
          }
          }
      }
     
View Full Code Here

        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
View Full Code Here

  }

  @Override
  public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
    try {
      Part part = parts.get(rowIndex);
      if (columnIndex == 1) {
        part.setName((String) aValue);
      }
      else if (columnIndex == 2) {
        LengthCellValue value = (LengthCellValue) aValue;
        value.setDisplayNativeUnits(true);
        Length length = value.getLength();
        Length oldLength = part.getHeight();
        if (length.getUnits() == null) {
          if (oldLength != null) {
            length.setUnits(oldLength.getUnits());
          }
          if (length.getUnits() == null) {
            length.setUnits(configuration.getSystemUnits());
          }
        }
        part.setHeight(length);
      }
      else if (columnIndex == 3) {
        part.setPackage((Package) aValue);
      }
      configuration.setDirty(true);
    }
    catch (Exception e) {
      // TODO: dialog, bad input
View Full Code Here

      // TODO: dialog, bad input
    }
  }

  public Object getValueAt(int row, int col) {
    Part part = parts.get(row);
    switch (col) {
    case 0:
      return part.getId();
    case 1:
       return part.getName();
    case 2:
      return new LengthCellValue(part.getHeight(), true);
    case 3:
       return part.getPackage();
    default:
      return null;
    }
  }
View Full Code Here

TOP

Related Classes of org.openpnp.model.Part

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.