def getDistanceGcode(exportText):
 lines = archive.getTextLines(exportText)
 oldLocation = None
 for line in lines:
  splitLine = gcodec.getSplitLineBeforeBracketSemicolon(line)
  firstWord = None
  if (len(splitLine) > 0):
   firstWord = splitLine[0]
  if (firstWord == 'G1'):
   location = gcodec.getLocationFromSplitLine(oldLocation, splitLine)
   if (oldLocation != None):
    distance = location.distance(oldLocation)
    print distance
   oldLocation = location
 return exportText

def getDistanceGcode ( exportText ) : lines = archive . getTextLines ( exportText ) oldLocation = None for line in lines : splitLine = gcodec . getSplitLineBeforeBracketSemicolon ( line ) firstWord = None if ( len ( splitLine ) > 0 ) : firstWord = splitLine [ 0 ] if ( firstWord == 'G1' ) : location = gcodec . getLocationFromSplitLine ( oldLocation , splitLine ) if ( oldLocation != None ) : distance = location . distance ( oldLocation ) print distance oldLocation = location return exportText
get gcode lines with distance variable added .