Пример #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))
Пример #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))
Пример #3
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))
Пример #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))