def getLinesWithoutRedundancy(duplicateWord, lines):
 oldDuplicationIndex = None
 for (lineIndex, line) in enumerate(lines):
  firstWord = gcodec.getFirstWordFromLine(line)
  if (firstWord == duplicateWord):
   if (oldDuplicationIndex == None):
    oldDuplicationIndex = lineIndex
   else:
    lines[oldDuplicationIndex] = line
    lines[lineIndex] = ''
  elif (firstWord.startswith('G') or (firstWord == 'M101') or (firstWord == 'M103')):
   oldDuplicationIndex = None
 return lines

def getLinesWithoutRedundancy ( duplicateWord , lines ) : oldDuplicationIndex = None for ( lineIndex , line ) in enumerate ( lines ) : firstWord = gcodec . getFirstWordFromLine ( line ) if ( firstWord == duplicateWord ) : if ( oldDuplicationIndex == None ) : oldDuplicationIndex = lineIndex else : lines [ oldDuplicationIndex ] = line lines [ lineIndex ] = '' elif ( firstWord . startswith ( 'G' ) or ( firstWord == 'M101' ) or ( firstWord == 'M103' ) ) : oldDuplicationIndex = None return lines
get gcode lines without redundant first words .