示例#1
0
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 )
示例#2
0
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 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.' )
示例#3
0
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 )
示例#4
0
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)