2016年3月24日 星期四

sla 3d printer 研究筆記 : printBaseLayer



1. printBaseLayer()

         int layerSteps = printingInfo.getStepsPerLayer();  //  預設值為   1
        int upSteps = printingInfo.getUpLiftSteps();           //  預設值為 4000
        int downSteps = upSteps - layerSteps;                     //   3999
        printingInfo.getBaseLayerNumber()

   public int getStepsPerLayer() {
        return layerHeightInUms;  // Future need to load device info for steps per um
    }
 
    public int getUpLiftSteps() {
        return upLiftSteps;
    }

PrintingInfo(int upLiftSteps, int baseLayerNumber, int baseExpoTimeInMillis,
                        int layerExpoTimeInMillis, int layerHeightInUms){
        setUpLiftSteps(upLiftSteps);
        setBaseLayerNumber(baseLayerNumber);
        setBaseExpoTime(baseExpoTimeInMillis);
        setLayerExpoTime(layerExpoTimeInMillis);
        setLayerHeight(layerHeightInUms);

}

            PrintingInfo info = new PrintingInfo(
                Integer.parseInt(mInputUpLiftSteps.getText()),
                Integer.parseInt(mInputBaseLayerNumber.getText()),
                Integer.parseInt(mInputBaseExpo.getText()),
                Integer.parseInt(mInputLayerExpo.getText()),
                Integer.parseInt(mInputLayerUm.getText())



  mInputLayerUm = new JTextField("1");    ->  預設值
        mInputLayerUm.setFont(Consts.APP_FONT);
        mInputLayerUm.setColumns(10);
        mInputLayerUm.setBounds(151, 23, 80, 30);
        stepMotorPane.add(mInputLayerUm);

   mInputUpLiftSteps = new JTextField(Integer.toString(Consts.PULL_UP_STEPS));
        mInputUpLiftSteps.setFont(Consts.APP_FONT);
        mInputUpLiftSteps.setColumns(10);
        mInputUpLiftSteps.setBounds(126, 105, 80, 30);
        stepMotorPane.add(mInputUpLiftSteps);

   mInputBaseLayerNumber = new JTextField("1");
        mInputBaseLayerNumber.setFont(Consts.APP_FONT);
        mInputBaseLayerNumber.setBounds(178, 59, 80, 30);
        mInputBaseLayerNumber.getDocument().addDocumentListener(new DocumentListener()

     mInputBaseExpo = new JTextField("30000");
        mInputBaseExpo.setFont(Consts.APP_FONT);
        mInputBaseExpo.setBounds(178, 101, 80, 30);
        mInputBaseExpo.getDocument().addDocumentListener(new DocumentListener() {


    public static final int PULL_UP_STEPS = 4000;

     所以 layerSteps   預設值為1
               upSteps      預設值為4000

  layerStep -  >  Layer Height
  upStep     ->    Up lift steps
  printingInfo.getBaseLayerNumber() ->   Base Layer Number






  SVGElement element = children.get(0);
        for (int i = 0; i < printingInfo.getBaseLayerNumber(); i++) {
       
            System.out.println("Printing base layer #" + (i + 1));
            if (i == 0) {
                // Get ready to exposure for base layer
                commandsList = PrinterScriptFactory.generateCommandForExpoBase();
                                    //  從  home down bottom ,  default 120000 step...
                for (int j = 0; j < commandsList.size(); j++) {
                    cmd = commandsList.get(i);
                    processCommand(cmd);
                }
                commandsList.clear();

                // Wait a little bit
                cmd = PrinterScriptFactory.generatePauseCommand(delayAfterAction);
                processCommand(cmd);
            } else {
                // uplift platform
                cmd = PrinterScriptFactory.generatePlatformMovement(PlatformMovement.UP, upSteps);
                processCommand(cmd);

                // Wait a little bit
                cmd = PrinterScriptFactory.generatePauseCommand(delayAfterAction);
                processCommand(cmd);

                // down platform
                cmd = PrinterScriptFactory.generatePlatformMovement(PlatformMovement.DOWN, downSteps);
                processCommand(cmd);

                // Wait a little bit
                cmd = PrinterScriptFactory.generatePauseCommand(delayAfterAction);
                processCommand(cmd);
            }

            // exposure base layer
            publish(element);

            for (int baseLayerExpoTime = printingInfo.getBaseExpoTimeInMillis();
                 baseLayerExpoTime > 0;
                 baseLayerExpoTime -= Consts.MAX_EXPOSURE_MILLIS) {

                int expoTime = baseLayerExpoTime >= Consts.MAX_EXPOSURE_MILLIS ? Consts.MAX_EXPOSURE_MILLIS : baseLayerExpoTime;
                cmd = PrinterScriptFactory.generatePauseCommand(expoTime);
                processCommand(cmd, expoTime);
            }

            publish(layerCircle);
            cmd = PrinterScriptFactory.generatePauseCommand(delayAfterAction);
            processCommand(cmd);
        }

============================================================

 public static List<CommandBase> generateCommandForExpoBase() {
        int stepsLeft = Consts.sFLAG_DEBUG_MODE ? 2400 : PrefUtils.getBaseLayerStepsFromTop();
        List<CommandBase> commandsList = generateCommandsForMovement(null, PlatformMovement.DOWN, stepsLeft);
        return commandsList;
    }

  public static int getBaseLayerStepsFromTop() {
        return getInstance().getInt(PREF_BASELAYER_STEPS_FROM_TOP, PREF_BASELAYER_STEPS_FROM_TOP_DEFAULT);
    }

private static final String PREF_BASELAYER_STEPS_FROM_TOP = "pref_baselayer_steps_from_top";
    private static final int PREF_BASELAYER_STEPS_FROM_TOP_DEFAULT = 120000;




沒有留言:

張貼留言