def getTwitterbotChainGcode( fileName, gcodeText, twitterbotPreferences = None ): "Add Twitterbot M-code to a gcode text. Chain twitterbot the gcode if it is not already twitterbotted." gcodeText = gcodec.getGcodeFileText( fileName, gcodeText ) if not gcodec.isProcedureDone( gcodeText, 'unpause' ): gcodeText = unpause.getUnpauseChainGcode( fileName, gcodeText ) print( 'getTwitterbotChainGcode(fileName): ' + fileName ) return getTwitterbotGcode( gcodeText, fileName, twitterbotPreferences )
def writeOutput(fileName=""): "Export a gcode linear move file." fileName = interpret.getFirstTranslatorFileNameUnmodified(fileName) if fileName == "": return exportPreferences = ExportPreferences() preferences.getReadPreferences(exportPreferences) startTime = time.time() print("File " + gcodec.getSummarizedFilename(fileName) + " is being chain exported.") suffixFilename = fileName[: fileName.rfind(".")] + "_export." + exportPreferences.fileExtension.value gcodeText = gcodec.getGcodeFileText(fileName, "") procedures = consecution.getProcedures("export", gcodeText) gcodeText = consecution.getChainTextFromProcedures(fileName, procedures[:-1], gcodeText) if gcodeText == "": return analyze.writeOutput(suffixFilename, gcodeText) exportChainGcode = getCraftedTextFromText(gcodeText, exportPreferences) replacableExportChainGcode = None selectedPluginModule = getSelectedPluginModule(exportPreferences.exportPlugins) if selectedPluginModule == None: replacableExportChainGcode = exportChainGcode else: if selectedPluginModule.isReplacable(): replacableExportChainGcode = selectedPluginModule.getOutput(exportChainGcode) else: selectedPluginModule.writeOutput(suffixFilename, exportChainGcode) if replacableExportChainGcode != None: replacableExportChainGcode = getReplaced(replacableExportChainGcode) gcodec.writeFileText(suffixFilename, replacableExportChainGcode) print("The exported file is saved as " + gcodec.getSummarizedFilename(suffixFilename)) if exportPreferences.alsoSendOutputTo.value != "": if replacableExportChainGcode == None: replacableExportChainGcode = selectedPluginModule.getOutput(exportChainGcode) exec("print >> " + exportPreferences.alsoSendOutputTo.value + ", replacableExportChainGcode") print("It took " + str(int(round(time.time() - startTime))) + " seconds to export the file.")
def writeOutput( fileName = '' ): "Export a gcode linear move file." fileName = interpret.getFirstTranslatorFileNameUnmodified( fileName ) if fileName == '': return exportRepository = ExportRepository() preferences.getReadRepository( exportRepository ) startTime = time.time() print( 'File ' + gcodec.getSummarizedFilename( fileName ) + ' is being chain exported.' ) suffixFilename = fileName[ : fileName.rfind( '.' ) ] + '_export.' + exportRepository.fileExtension.value gcodeText = gcodec.getGcodeFileText( fileName, '' ) procedures = consecution.getProcedures( 'export', gcodeText ) gcodeText = consecution.getChainTextFromProcedures( fileName, procedures[ : - 1 ], gcodeText ) if gcodeText == '': return analyze.writeOutput( suffixFilename, gcodeText ) exportChainGcode = getCraftedTextFromText( gcodeText, exportRepository ) replacableExportChainGcode = None selectedPluginModule = getSelectedPluginModule( exportRepository.exportPlugins ) if selectedPluginModule == None: replacableExportChainGcode = exportChainGcode else: if selectedPluginModule.isReplacable(): replacableExportChainGcode = selectedPluginModule.getOutput( exportChainGcode ) else: selectedPluginModule.writeOutput( suffixFilename, exportChainGcode ) if replacableExportChainGcode != None: replacableExportChainGcode = getReplaced( replacableExportChainGcode ) gcodec.writeFileText( suffixFilename, replacableExportChainGcode ) print( 'The exported file is saved as ' + gcodec.getSummarizedFilename( suffixFilename ) ) if exportRepository.alsoSendOutputTo.value != '': if replacableExportChainGcode == None: replacableExportChainGcode = selectedPluginModule.getOutput( exportChainGcode ) exec( 'print >> ' + exportRepository.alsoSendOutputTo.value + ', replacableExportChainGcode' ) print( 'It took ' + str( int( round( time.time() - startTime ) ) ) + ' seconds to export the file.' )
def writeOutput( fileName, gcodeText = '' ): "Write the exported version of a gcode file." binary16ByteRepository = Binary16ByteRepository() settings.getReadRepository( binary16ByteRepository ) gcodeText = gcodec.getGcodeFileText( fileName, gcodeText ) skeinOutput = getOutput( gcodeText, binary16ByteRepository ) suffixFileName = fileName[ : fileName.rfind( '.' ) ] + '.' + binary16ByteRepository.fileExtension.value gcodec.writeFileText( suffixFileName, skeinOutput ) print( 'The converted file is saved as ' + gcodec.getSummarizedFileName( suffixFileName ) )
def writeOutput( fileName, gcodeText = '' ): "Write the exported version of a gcode file." gcodeText = gcodec.getGcodeFileText( fileName, gcodeText ) repository = GcodeStepRepository() settings.getReadRepository( repository ) output = getOutput( gcodeText, repository ) suffixFileName = fileName[ : fileName.rfind( '.' ) ] + '_gcode_step.gcode' gcodec.writeFileText( suffixFileName, output ) print( 'The converted file is saved as ' + gcodec.getSummarizedFileName( suffixFileName ) )
def writeOutput( fileName, gcodeText = '' ): "Write the exported version of a gcode file. This function, and getOutput are the only necessary functions in a skeinforge export plugin." binary16ByteRepository = Binary16ByteRepository() preferences.getReadRepository( binary16ByteRepository ) gcodeText = gcodec.getGcodeFileText( fileName, gcodeText ) skeinOutput = getOutput( gcodeText, binary16ByteRepository ) suffixFilename = fileName[ : fileName.rfind( '.' ) ] + '.' + binary16ByteRepository.fileExtension.value writeFileText( suffixFilename, skeinOutput ) print( 'The converted file is saved as ' + getSummarizedFilename( suffixFilename ) )
def writeOutput(fileName, gcodeText=''): "Write the exported version of a gcode file." binary16ByteRepository = Binary16ByteRepository() settings.getReadRepository(binary16ByteRepository) gcodeText = gcodec.getGcodeFileText(fileName, gcodeText) skeinOutput = getOutput(gcodeText, binary16ByteRepository) suffixFileName = fileName[:fileName.rfind( '.')] + '.' + binary16ByteRepository.fileExtension.value gcodec.writeFileText(suffixFileName, skeinOutput) print('The converted file is saved as ' + gcodec.getSummarizedFileName(suffixFileName))
def writeOutput(fileName=''): """Export a gcode linear move file. Chain export the gcode if it is not already exported. If no fileName is specified, export the first unmodified gcode file in this folder.""" if fileName == '': unmodified = interpret.getGNUTranslatorFilesUnmodified() if len(unmodified) == 0: print("There are no unmodified gcode files in this folder.") return fileName = unmodified[0] exportPreferences = ExportPreferences() preferences.readPreferences(exportPreferences) startTime = time.time() print('File ' + gcodec.getSummarizedFilename(fileName) + ' is being chain exported.') suffixFilename = fileName[:fileName.rfind( '.')] + '.' + exportPreferences.fileExtension.value gcodeText = gcodec.getGcodeFileText(fileName, '') # if not gcodec.isProcedureDone( gcodeText, 'unpause' ): # gcodeText = unpause.getUnpauseChainGcode( fileName, gcodeText ) if not gcodec.isProcedureDone(gcodeText, 'raftless'): gcodeText = raftless.getRaftlessChainGcode(fileName, gcodeText) if gcodeText == '': return # Now prepend the start file and append the end file gcodeText = getStartText() + gcodeText + getEndText() analyze.writeOutput(suffixFilename, gcodeText) exportChainGcode = getExportGcode(gcodeText, exportPreferences) replacableExportChainGcode = None selectedPluginModule = getSelectedPlugin(exportPreferences) if selectedPluginModule == None: replacableExportChainGcode = exportChainGcode else: if selectedPluginModule.isReplacable(): replacableExportChainGcode = selectedPluginModule.getOutput( exportChainGcode) else: selectedPluginModule.writeOutput(suffixFilename, exportChainGcode) if replacableExportChainGcode != None: replacableExportChainGcode = getReplaced(replacableExportChainGcode) gcodec.writeFileText(suffixFilename, replacableExportChainGcode) print('The exported file is saved as ' + gcodec.getSummarizedFilename(suffixFilename)) if exportPreferences.alsoSendOutputTo.value != '': if replacableExportChainGcode == None: replacableExportChainGcode = selectedPluginModule.getOutput( exportChainGcode) exec('print >> ' + exportPreferences.alsoSendOutputTo.value + ', replacableExportChainGcode') print('It took ' + str(int(round(time.time() - startTime))) + ' seconds to export the file.')
def writeOutput(fileName=''): "Export a gcode linear move file." fileName = interpret.getFirstTranslatorFileNameUnmodified(fileName) if fileName == '': return exportRepository = ExportRepository() settings.getReadRepository(exportRepository) startTime = time.time() print('File ' + gcodec.getSummarizedFileName(fileName) + ' is being chain exported.') suffixFileName = fileName[:fileName.rfind( '.')] + '_export.' + exportRepository.fileExtension.value gcodeText = gcodec.getGcodeFileText(fileName, '') procedures = consecution.getProcedures('export', gcodeText) gcodeText = consecution.getChainTextFromProcedures(fileName, procedures[:-1], gcodeText) if gcodeText == '': return analyze.writeOutput(suffixFileName, gcodeText) if exportRepository.savePenultimateGcode.value: penultimateFileName = fileName[:fileName. rfind('.')] + '_penultimate.gcode' gcodec.writeFileText(penultimateFileName, gcodeText) print('The penultimate file is saved as ' + gcodec.getSummarizedFileName(penultimateFileName)) exportChainGcode = getCraftedTextFromText(gcodeText, exportRepository) replaceableExportChainGcode = None selectedPluginModule = getSelectedPluginModule( exportRepository.exportPlugins) if selectedPluginModule == None: replaceableExportChainGcode = exportChainGcode else: if selectedPluginModule.isReplaceable(): replaceableExportChainGcode = selectedPluginModule.getOutput( exportChainGcode) else: selectedPluginModule.writeOutput(suffixFileName, exportChainGcode) if replaceableExportChainGcode != None: replaceableExportChainGcode = getReplaced(replaceableExportChainGcode) gcodec.writeFileText(suffixFileName, replaceableExportChainGcode) print('The exported file is saved as ' + gcodec.getSummarizedFileName(suffixFileName)) if exportRepository.alsoSendOutputTo.value != '': if replaceableExportChainGcode == None: replaceableExportChainGcode = selectedPluginModule.getOutput( exportChainGcode) exec('print >> ' + exportRepository.alsoSendOutputTo.value + ', replaceableExportChainGcode') print('It took ' + str(int(round(time.time() - startTime))) + ' seconds to export the file.')
def writeOutput( fileName = '', gcodeText = '' ): "Write the exported version of a gcode file. This function, getOutput and isArchivable are the only necessary functions in a skeinforge export plugin." if fileName == '': unmodified = interpret.getGNUTranslatorFilesUnmodified() if len( unmodified ) == 0: print( "There are no unmodified gcode files in this folder." ) return fileName = unmodified[ 0 ] binary16BytePreferences = Binary16BytePreferences() preferences.readPreferences( binary16BytePreferences ) gcodeText = gcodec.getGcodeFileText( fileName, gcodeText ) skeinOutput = getOutput( gcodeText, binary16BytePreferences ) suffixFilename = fileName[ : fileName.rfind( '.' ) ] + '_export.' + binary16BytePreferences.fileExtension.value writeFileText( suffixFilename, skeinOutput ) print( 'The converted file is saved as ' + getSummarizedFilename( suffixFilename ) )
def writeOutput( fileName = '' ): """Export a gcode linear move file. Chain export the gcode if it is not already exported. If no fileName is specified, export the first unmodified gcode file in this folder.""" if fileName == '': unmodified = interpret.getGNUTranslatorFilesUnmodified() if len( unmodified ) == 0: print( "There are no unmodified gcode files in this folder." ) return fileName = unmodified[ 0 ] exportPreferences = ExportPreferences() preferences.readPreferences( exportPreferences ) startTime = time.time() print( 'File ' + gcodec.getSummarizedFilename( fileName ) + ' is being chain exported.' ) suffixFilename = fileName[ : fileName.rfind( '.' ) ] + '.' + exportPreferences.fileExtension.value gcodeText = gcodec.getGcodeFileText( fileName, '' ) # if not gcodec.isProcedureDone( gcodeText, 'unpause' ): # gcodeText = unpause.getUnpauseChainGcode( fileName, gcodeText ) if not gcodec.isProcedureDone( gcodeText, 'raftless' ): gcodeText = raftless.getRaftlessChainGcode( fileName, gcodeText ) if gcodeText == '': return # Now prepend the start file and append the end file gcodeText = getStartText() + gcodeText + getEndText() analyze.writeOutput( suffixFilename, gcodeText ) exportChainGcode = getExportGcode( gcodeText, exportPreferences ) replacableExportChainGcode = None selectedPluginModule = getSelectedPlugin( exportPreferences ) if selectedPluginModule == None: replacableExportChainGcode = exportChainGcode else: if selectedPluginModule.isReplacable(): replacableExportChainGcode = selectedPluginModule.getOutput( exportChainGcode ) else: selectedPluginModule.writeOutput( suffixFilename, exportChainGcode ) if replacableExportChainGcode != None: replacableExportChainGcode = getReplaced( replacableExportChainGcode ) gcodec.writeFileText( suffixFilename, replacableExportChainGcode ) print( 'The exported file is saved as ' + gcodec.getSummarizedFilename( suffixFilename ) ) if exportPreferences.alsoSendOutputTo.value != '': if replacableExportChainGcode == None: replacableExportChainGcode = selectedPluginModule.getOutput( exportChainGcode ) exec( 'print >> ' + exportPreferences.alsoSendOutputTo.value + ', replacableExportChainGcode' ) print( 'It took ' + str( int( round( time.time() - startTime ) ) ) + ' seconds to export the file.' )
def writeOutput(fileName='', gcodeText=''): "Write the exported version of a gcode file. This function, getOutput and isArchivable are the only necessary functions in a skeinforge export plugin." if fileName == '': unmodified = interpret.getGNUTranslatorFilesUnmodified() if len(unmodified) == 0: print("There are no unmodified gcode files in this folder.") return fileName = unmodified[0] binary16BytePreferences = Binary16BytePreferences() preferences.readPreferences(binary16BytePreferences) gcodeText = gcodec.getGcodeFileText(fileName, gcodeText) skeinOutput = getOutput(gcodeText, binary16BytePreferences) suffixFilename = fileName[:fileName.rfind( '.')] + '_export.' + binary16BytePreferences.fileExtension.value writeFileText(suffixFilename, skeinOutput) print('The converted file is saved as ' + getSummarizedFilename(suffixFilename))
def getWipeChainGcode(fileName, gcodeText, wipePreferences=None): "Wipe a gcode linear move text. Chain wipe the gcode if it is not already wiped." gcodeText = gcodec.getGcodeFileText(fileName, gcodeText) if not gcodec.isProcedureDone(gcodeText, 'hop'): gcodeText = hop.getHopChainGcode(fileName, gcodeText) return getWipeGcode(gcodeText, wipePreferences)
def getRaftlessChainGcode( fileName, gcodeText, raftlessPreferences = None ): "Raftless the file or text. Chain raftless the gcode if it is not already raftless'd." gcodeText = gcodec.getGcodeFileText( fileName, gcodeText ) if not gcodec.isProcedureDone( gcodeText, 'unpause' ): gcodeText = unpause.getUnpauseChainGcode( fileName, gcodeText ) return getRaftlessGcode( gcodeText, raftlessPreferences )
def getWipeChainGcode( fileName, gcodeText, wipePreferences = None ): "Wipe a gcode linear move text. Chain wipe the gcode if it is not already wiped." gcodeText = gcodec.getGcodeFileText( fileName, gcodeText ) if not gcodec.isProcedureDone( gcodeText, 'hop' ): gcodeText = hop.getHopChainGcode( fileName, gcodeText ) return getWipeGcode( gcodeText, wipePreferences )
def getUnpauseChainGcode( fileName, gcodeText, unpausePreferences = None ): "Unpause a gcode linear move text. Chain unpause the gcode if it is not already unpaused." gcodeText = gcodec.getGcodeFileText( fileName, gcodeText ) if not gcodec.isProcedureDone( gcodeText, 'fillet' ): gcodeText = fillet.getFilletChainGcode( fileName, gcodeText ) return getUnpauseGcode( gcodeText, unpausePreferences )
def getRaftChainGcode( fileName, gcodeText, raftPreferences = None ): "Raft a gcode linear move text. Chain raft the gcode if it is not already rafted." gcodeText = gcodec.getGcodeFileText( fileName, gcodeText ) if not gcodec.isProcedureDone( gcodeText, 'speed' ): gcodeText = speed.getSpeedChainGcode( fileName, gcodeText ) return getRaftGcode( gcodeText, raftPreferences )
def getCombChainGcode( fileName, gcodeText, combPreferences = None ): "Comb a gcode linear move text. Chain comb the gcode if it is not already combed." gcodeText = gcodec.getGcodeFileText( fileName, gcodeText ) if not gcodec.isProcedureDone( gcodeText, 'tower' ): gcodeText = tower.getTowerChainGcode( fileName, gcodeText ) return getCombGcode( gcodeText, combPreferences )
def getStretchChainGcode(fileName, gcodeText, stretchPreferences=None): "Stretch a gcode linear move text. Chain stretch the gcode if it is not already stretched." gcodeText = gcodec.getGcodeFileText(fileName, gcodeText) if not gcodec.isProcedureDone(gcodeText, 'cool'): gcodeText = cool.getCoolChainGcode(fileName, gcodeText) return getStretchGcode(gcodeText, stretchPreferences)
def getRaftlessChainGcode(fileName, gcodeText, raftlessPreferences=None): "Raftless the file or text. Chain raftless the gcode if it is not already raftless'd." gcodeText = gcodec.getGcodeFileText(fileName, gcodeText) if not gcodec.isProcedureDone(gcodeText, 'unpause'): gcodeText = unpause.getUnpauseChainGcode(fileName, gcodeText) return getRaftlessGcode(gcodeText, raftlessPreferences)
def getStretchChainGcode( fileName, gcodeText, stretchPreferences = None ): "Stretch a gcode linear move text. Chain stretch the gcode if it is not already stretched." gcodeText = gcodec.getGcodeFileText( fileName, gcodeText ) if not gcodec.isProcedureDone( gcodeText, 'cool' ): gcodeText = cool.getCoolChainGcode( fileName, gcodeText ) return getStretchGcode( gcodeText, stretchPreferences )
def getCoolChainGcode( fileName, gcodeText, coolPreferences = None ): "Cool a gcode linear move text. Chain cool the gcode if it is not already cooled." gcodeText = gcodec.getGcodeFileText( fileName, gcodeText ) if not gcodec.isProcedureDone( gcodeText, 'clip' ): gcodeText = clip.getClipChainGcode( fileName, gcodeText ) return getCoolGcode( gcodeText, coolPreferences )
def getMultiplyChainGcode(fileName, gcodeText, multiplyPreferences=None): "Multiply a gcode linear move text. Chain multiply the gcode if it is not already multiplied." gcodeText = gcodec.getGcodeFileText(fileName, gcodeText) if not gcodec.isProcedureDone(gcodeText, 'fill'): gcodeText = fill.getFillChainGcode(fileName, gcodeText) return getMultiplyGcode(gcodeText, multiplyPreferences)
def getHopChainGcode( fileName, gcodeText, hopPreferences = None ): "Hop a gcode linear move text. Chain hop the gcode if it is not already hopped." gcodeText = gcodec.getGcodeFileText( fileName, gcodeText ) if not gcodec.isProcedureDone( gcodeText, 'stretch' ): gcodeText = stretch.getStretchChainGcode( fileName, gcodeText ) return getHopGcode( gcodeText, hopPreferences )
def getCombChainGcode(fileName, gcodeText, combPreferences=None): "Comb a gcode linear move text. Chain comb the gcode if it is not already combed." gcodeText = gcodec.getGcodeFileText(fileName, gcodeText) if not gcodec.isProcedureDone(gcodeText, 'tower'): gcodeText = tower.getTowerChainGcode(fileName, gcodeText) return getCombGcode(gcodeText, combPreferences)
def getSpeedChainGcode(fileName, gcodeText, speedPreferences=None): "Speed a gcode linear move text. Chain speed the gcode if it is not already speeded." gcodeText = gcodec.getGcodeFileText(fileName, gcodeText) if not gcodec.isProcedureDone(gcodeText, 'multiply'): gcodeText = multiply.getMultiplyChainGcode(fileName, gcodeText) return getSpeedGcode(gcodeText, speedPreferences)
def getMultiplyChainGcode( fileName, gcodeText, multiplyPreferences = None ): "Multiply a gcode linear move text. Chain multiply the gcode if it is not already multiplied." gcodeText = gcodec.getGcodeFileText( fileName, gcodeText ) if not gcodec.isProcedureDone( gcodeText, 'fill' ): gcodeText = fill.getFillChainGcode( fileName, gcodeText ) return getMultiplyGcode( gcodeText, multiplyPreferences )
def getFilletChainGcode( fileName, gcodeText, filletPreferences = None ): "Fillet a gcode linear move text. Chain oozebane the gcode if it is not already oozebaned." gcodeText = gcodec.getGcodeFileText( fileName, gcodeText ) if not gcodec.isProcedureDone( gcodeText, 'oozebane' ): gcodeText = oozebane.getOozebaneChainGcode( fileName, gcodeText ) return getFilletGcode( gcodeText, filletPreferences )
def getHopChainGcode(fileName, gcodeText, hopPreferences=None): "Hop a gcode linear move text. Chain hop the gcode if it is not already hopped." gcodeText = gcodec.getGcodeFileText(fileName, gcodeText) if not gcodec.isProcedureDone(gcodeText, 'stretch'): gcodeText = stretch.getStretchChainGcode(fileName, gcodeText) return getHopGcode(gcodeText, hopPreferences)
def getOozebaneChainGcode( fileName, gcodeText, oozebanePreferences = None ): "Oozebane a gcode linear move text. Chain oozebane the gcode if it is not already oozebaned." gcodeText = gcodec.getGcodeFileText( fileName, gcodeText ) if not gcodec.isProcedureDone( gcodeText, 'wipe' ): gcodeText = wipe.getWipeChainGcode( fileName, gcodeText ) return getOozebaneGcode( gcodeText, oozebanePreferences )
def getClipChainGcode( fileName, gcodeText, loopTailorPreferences = None ): "Clip a gcode linear move text. Chain clip the gcode if it is not already clipped." gcodeText = gcodec.getGcodeFileText( fileName, gcodeText ) if not gcodec.isProcedureDone( gcodeText, 'comb' ): gcodeText = comb.getCombChainGcode( fileName, gcodeText ) return getClipGcode( gcodeText, loopTailorPreferences )
def getSpeedChainGcode(fileName, gcodeText, speedPreferences=None): "Speed a gcode linear move text. Chain speed the gcode if it is not already speeded." gcodeText = gcodec.getGcodeFileText(fileName, gcodeText) if not gcodec.isProcedureDone(gcodeText, "multiply"): gcodeText = multiply.getMultiplyChainGcode(fileName, gcodeText) return getSpeedGcode(gcodeText, speedPreferences)
def getUnpauseChainGcode(fileName, gcodeText, unpausePreferences=None): "Unpause a gcode linear move text. Chain unpause the gcode if it is not already unpaused." gcodeText = gcodec.getGcodeFileText(fileName, gcodeText) if not gcodec.isProcedureDone(gcodeText, 'fillet'): gcodeText = fillet.getFilletChainGcode(fileName, gcodeText) return getUnpauseGcode(gcodeText, unpausePreferences)
def getTowerChainGcode( fileName, gcodeText, towerPreferences = None ): "Tower a gcode linear move text. Chain tower the gcode if it is not already towered." gcodeText = gcodec.getGcodeFileText( fileName, gcodeText ) if not gcodec.isProcedureDone( gcodeText, 'raft' ): gcodeText = raft.getRaftChainGcode( fileName, gcodeText ) return getTowerGcode( gcodeText, towerPreferences )