Exemplo n.º 1
0
  with open(height_map_file, "r") as fp:
    height_pnts.append([])
    for line in fp:
      line = line.strip()
      if len(line)==0: continue
      if line[0] == '#': continue
      v = line.split()

      pnts.append( [ float(v[0]), float(v[1]), float(v[2]) ] )
      height_pnts[0].append( [ float(v[0]), float(v[1]), float(v[2]) ] )

  if not dry_run:

    if do_homing:
      if verbose: print "# homing..."
      x = grbl.send_command("$H")
      if verbose: print "# got:", x

    sx = height_pnts[0][0][0]
    sy = height_pnts[0][0][1]

    start_line = "G0 X{:.8f} Y{:.8f}".format(float(sx), float(sy))
    #start_line = "G0 X{:.8f}".format(sx) + " Y{:.8f}".format(sy)
    r = grbl.send_command(start_line)

else:

  grid_margin = 1.0

  #z_safe = -1.0
  #z_ub = -1.0
Exemplo n.º 2
0

pnts = []

if not dry_run:
  grbl.setup(tty_device)
  grbl.send_initial_command("")

sys.stdout.write("\n#### ")
cprint("READY TO CUT, REMOVE PROBE AND PRESS ENTER TO CONTINUE", "red", attrs=['blink'])
sys.stdout.flush()
sys.stdin.readline()

if not dry_run:

  grbl.send_command("G1Z5F50")

  if grbl_spindle:
    grbl.send_command("S" + str(s_val))
    grbl.send_command("M03")
  else:
    grbl.send_command("M42")

  for line in _gc["lines"]:

    line = line.strip()
    if len(line)==0: continue
    if line[0] == '#': continue
    if line[0] == '(': continue

    print("## sending:", line)
Exemplo n.º 3
0
    #z_ub = -3.0
    z_ub = 0.0
    z_lb = -15.0
    fz = 1

    xminmax = [_gc["min_x"] - grid_margin, _gc["max_x"] + grid_margin]
    yminmax = [_gc["min_y"] - grid_margin, _gc["max_y"] + grid_margin]

    dx = 10.0
    dy = 10.0

    if not dry_run:

        if do_homing:
            if verbose: print "# homing..."
            x = grbl.send_command("$H")
            if verbose: print "# got:", x

        if verbose: print "# moving z to:", z_ub
        x = grbl.send_command("g0 z" + str(z_ub))
        if verbose: print "# got:", x
        var = grbl.wait_for_var_position('z', z_ub)
        if verbose: print "# got:", var

    _pntsxy = []
    _y = yminmax[0]
    while _y <= yminmax[1]:
        _x = xminmax[0]
        while _x <= xminmax[1]:
            _pntsxy.append([_x, _y])
            _x += dx
Exemplo n.º 4
0
    y_i = 0

    while y_i != (y_int_end+y_dir):

      grid.append( [ x, y ] )

      y_i += y_dir
      y = y_0 + float(y_i)*tic

    x_i += x_dir
    x = x_start + float(x_i)*tic


# setup absolute, in mm
if not debug:
  grbl.send_command( "" )
  grbl.send_command( "" )
  grbl.send_command( "g90" )
  grbl.send_command( "g21" )

  # position in 'home' position
  grbl.send_command( "g1z" + str(z_up) )
  grbl.send_command( "g0 x" + str(x_start) + " y" + str(y_start) )

  if verbose:
    print '# ?', str(z_down)

  # set lower z threshold
  grbl.send_command( "$25=" + str(z_down) )

  # enable probe functionality
Exemplo n.º 5
0
pnts = []

if not dry_run:
    grbl.setup(tty_device)
    grbl.send_initial_command("")

sys.stdout.write("\n#### ")
cprint("READY TO CUT, REMOVE PROBE AND PRESS ENTER TO CONTINUE",
       "red",
       attrs=['blink'])
sys.stdout.flush()
sys.stdin.readline()

if not dry_run:

    grbl.send_command("G1Z5")
    grbl.send_command("M42")

    for line in _gc["lines"]:

        line = line.strip()
        if len(line) == 0: continue
        if line[0] == '#': continue
        if line[0] == '(': continue

        print("## sending:", line)
        sys.stdout.flush()
        r = grbl.send_command(line)
        print "### got:", r
        sys.stdout.flush()
Exemplo n.º 6
0
  # if we've reached the end stop
  if ( gBlackCount > gEndStopThresholdInt ):
    if (gVerboseFlag):
      print "# end stop reached"
    homed = True
    continue
  else:
    if (gVerboseFlag):
      print "# end stop not reached"
  
  iteration_count += 1
  if (gVerboseFlag):
    print "# iteration_count:", str(iteration_count)
    print "# gPosCur:", str(gPosCur)

  if (iteration_count > 10):
    homed = True

  gPosCur += 0.1
  grbl.send_command( "g1y" + str(gPosCur) )
  

if (homed):
  if (gVerboseFlag):
    print "now homed"
else:
  print "# NOT HOMED"