Esempio n. 1
0
    def build(self, gcode):
        '''New gCode that uses the indexedDict'''
        puts(colored.blue('Building Toolpath:'))
        for i, line in enumerate(progress.bar(gcode)):
            # for i,line in enumerate(gcode):
            if 'G' in line:  # only handle the gcodes
                # Get the G code number assign it to cmd
                # for human readablitiy cmd should be changes to g_command_number
                # or somehting like that
                # however notice that it is hardcoded as a  dict key as well
                '''copy over the relevant data x y z i j index and g_command_number'''
                '''To an indexdict named move with the name attribute set to the string "move" '''
                cmd = line['G']
                move = IndexDict(name='move')
                for j, x in enumerate(AXIS):
                    if x in line: move[x] = line[x]
                move['cmd'] = cmd
                move['index'] = line['index']

                try:
                    fcn = GCMD[cmd]
                    move.name = 'cmd[% 2i]' % cmd
                    # Try using the indexdict instance as info for the next coordinates to be attached to the toolpath
                    # by way of the function fcn selcted from the dict of functions GCMD above
                    fcn(self, move, cmd)
                except KeyError:
                    # raise
                    error('Missing command in GCMD: %d(%s)' % (cmd, line))
Esempio n. 2
0
  def build(self, gcode):
    '''New gCode that uses the indexedDict'''
    puts(colored.blue('Building Toolpath:'))
    for i,line in enumerate(progress.bar(gcode)):
    # for i,line in enumerate(gcode):
      if 'G' in line: # only handle the gcodes
        # Get the G code number assign it to cmd
        # for human readablitiy cmd should be changes to g_command_number
        # or somehting like that
        # however notice that it is hardcoded as a  dict key as well
        '''copy over the relevant data x y z i j index and g_command_number'''
        '''To an indexdict named move with the name attribute set to the string "move" '''
        cmd = line['G']
        move = IndexDict(name='move')
        for j,x in enumerate(AXIS):
          if x in line: move[x] = line[x]
        move['cmd'] = cmd
        move['index'] = line['index']

        try:
          fcn = GCMD[cmd]
          move.name = 'cmd[% 2i]'%cmd
          # Try using the indexdict instance as info for the next coordinates to be attached to the toolpath
          # by way of the function fcn selcted from the dict of functions GCMD above
          fcn(self, move, cmd)
        except KeyError:
          # raise
          error('Missing command in GCMD: %d(%s)'%(cmd, line))
Esempio n. 3
0
def millMove(self, next, height):
    '''Move the toolbit to the next mill location'''
    last = self[-1]
    move(
        self, IndexDict(last), 1, z=height
    )  # lift off of board; move at feed rate in case we're drilling.  Ideally we'd only move at feed rate for the liftoff if we were drilling and not if we're milling, but the current structure of the code makes it rather tricky to find that out in a robust way, so for now just defaulting to always liftoff ad feed rate, which should be safe and have negligible effects on total job time
    move(
        self, IndexDict(last), 0, z=height
    )  # hack for old drawing code: lift off to same position at move speed so drawing code will put in move operations
    move(self, IndexDict(next), 0, z=height)  # Move to next pos
Esempio n. 4
0
 def build(self, gcode):
   '''New gCode that uses the indexedDict'''
   puts(colored.blue('Building Toolpath:'))
   for i,line in enumerate(progress.bar(gcode)):
   # for i,line in enumerate(gcode):
     if 'G' in line: # only handle the gcodes
       cmd = line['G']
       move = IndexDict(name='move')
       for j,x in enumerate(AXIS):
         if x in line: move[x] = line[x]
       move['cmd'] = cmd
       move['index'] = line['index']
       try:
         fcn = GCMD[cmd]
         move.name = 'cmd[% 2i]'%cmd
         fcn(self, move, cmd)
       except KeyError:
         # raise
         error('Missing command in GCMD: %d(%s)'%(cmd, line))
Esempio n. 5
0
 def build(self, gcode):
     '''New gCode that uses the indexedDict'''
     puts(colored.blue('Building Toolpath:'))
     for i, line in enumerate(progress.bar(gcode)):
         # for i,line in enumerate(gcode):
         if 'G' in line:  # only handle the gcodes
             cmd = line['G']
             move = IndexDict(name='move')
             for j, x in enumerate(AXIS):
                 if x in line: move[x] = line[x]
             move['cmd'] = cmd
             move['index'] = line['index']
             try:
                 fcn = GCMD[cmd]
                 move.name = 'cmd[% 2i]' % cmd
                 fcn(self, move, cmd)
             except KeyError:
                 # raise
                 error('Missing command in GCMD: %d(%s)' % (cmd, line))
Esempio n. 6
0
def origin():
    return IndexDict.setorigin()
Esempio n. 7
0
def origin():
  return IndexDict.setorigin()
Esempio n. 8
0
def millMove(self, next, height):
    '''Move the toolbit to the next mill location'''
    last = self[-1]
    move(self, IndexDict(last), 0, z=height)  # lift off of board
    move(self, IndexDict(next), 0, z=height)  # Move to next pos