Пример #1
0
 public static void moveToMaxPointAndBack(int speed) {
   if (printerComInterface != null) {
     String cmdString = "G91\nGO Z" + (0.01 * (maxLocation)) + " F" + speed;
     printerComInterface.send(cmdString);
     cmdString = "G91\nGO Z" + (0.01 * (-maxLocation)) + " F" + speed;
     printerComInterface.send(cmdString);
   }
 }
Пример #2
0
 public static void initThePosition(int speed) {
   if (printerComInterface != null) {
     String cmdString = "G91\nG0 Z" + (0.01 * (-locaton)) + " F" + speed;
     printerComInterface.send(cmdString);
     locaton = 0;
   }
 }
Пример #3
0
 public static void startScan() {
   if (davidComInterface != null
       & (currentState == STATE_PREPARE
           | currentState == STATE_SCANNING
           | currentState == STATE_SAVINGSCAN)) {
     // 设置到扫描模式
     davidComInterface.send(MODESCAN);
     try {
       Thread.currentThread().sleep(2000);
     } catch (InterruptedException ex) {
       Logger.getLogger(David_3_10_4.class.getName()).log(Level.SEVERE, null, ex);
     }
     // 回零点
     initThePosition(2000);
     // 开始扫描
     davidComInterface.send(STARTSCAN);
   }
 }
Пример #4
0
    public static void saveScan() {
      if (davidComInterface != null & printerComInterface != null & currentState != STATE_STOP) {
        setCurrentState(STATE_SAVINGSCAN);
        // 停止扫描
        davidComInterface.send(STOPLASERSCAN);
        try {
          Thread.currentThread().sleep(SLEEPTIME);
        } catch (InterruptedException ex) {
          Logger.getLogger(David_3_10_4.class.getName()).log(Level.SEVERE, null, ex);
        }
        // 进入纹理捕捉模式
        davidComInterface.send(MODETEXTURE);
        try {
          Thread.currentThread().sleep(SLEEPTIME);
        } catch (InterruptedException ex) {
          Logger.getLogger(David_3_10_4.class.getName()).log(Level.SEVERE, null, ex);
        }
        // 捕捉纹理
        try {
          printerComInterface.send("M107");
          Thread.currentThread().sleep(1000);
          davidComInterface.send(GRABTEXTURE);
          Thread.currentThread().sleep(1000);
          printerComInterface.send("M106 S255");

          Thread.currentThread().sleep(SLEEPTIME);
        } catch (InterruptedException ex) {
          Logger.getLogger(David_3_10_4.class.getName()).log(Level.SEVERE, null, ex);
        }
        // 扫描加入队列
        davidComInterface.send(ADDTOLIST);
        try {
          Thread.currentThread().sleep(SLEEPTIME);
        } catch (InterruptedException ex) {
          Logger.getLogger(David_3_10_4.class.getName()).log(Level.SEVERE, null, ex);
        }
        // 删除当前扫描
        davidComInterface.send(ERASESCAN);
        try {
          Thread.currentThread().sleep(SLEEPTIME);
        } catch (InterruptedException ex) {
          Logger.getLogger(David_3_10_4.class.getName()).log(Level.SEVERE, null, ex);
        }
        // 转动一定角度
        String turn = "G91\nG0 E" + (float) ((3200.0 / subdivide) / (360.0 / scanAngle)) + " F60";
        System.out.println("转动角度" + turn);
        printerComInterface.send(turn);
        try {
          Thread.currentThread().sleep(SLEEPTIME);
        } catch (InterruptedException ex) {
          Logger.getLogger(David_3_10_4.class.getName()).log(Level.SEVERE, null, ex);
        }
        scanTime = scanTime - 1;
        // 重新开始扫描
        if (scanTime >= 0) {
          startScan();
          setCurrentState(STATE_SCANNING);
          System.out.println("重新开始扫描!" + "还剩" + scanTime + "次");
        } else {
          setCurrentState(STATE_STOP);
          System.out.println("停止扫描!");
          return;
        }
      }
    }
Пример #5
0
 public static void sendMoveCmd(String cmdString, int speed) {
   if (printerComInterface != null) {
     printerComInterface.send(mCmd2Gcode(cmdString, speed));
     locaton = locaton + cmdToStep(cmdString);
   }
 }