Ejemplo n.º 1
0
def writeOutput(fileName=''):
    print("raftless  - writeOutput")
    "Raftless a gcode linear move file.  Chain raftless the gcode if it is not already raftless'd. If no fileName is specified, raftless 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]
    raftlessPreferences = RaftlessPreferences()
    preferences.readPreferences(raftlessPreferences)
    print()
    startTime = time.time()
    print("File " + gcodec.getSummarizedFilename(fileName) +
          " is being chain raftless'd.")
    suffixFilename = fileName[:fileName.rfind('.')] + '_raftless.gcode'
    raftlessGcode = getRaftlessChainGcode(fileName, '', raftlessPreferences)
    if raftlessGcode == '':
        return
    gcodec.writeFileText(suffixFilename, raftlessGcode)
    print('The raftless file is saved as ' +
          gcodec.getSummarizedFilename(suffixFilename))
    analyze.writeOutput(suffixFilename, raftlessGcode)
    print('It took ' + str(int(round(time.time() - startTime))) +
          ' seconds to raftless the file.')
Ejemplo n.º 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 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.')
Ejemplo n.º 3
0
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 ) )
Ejemplo n.º 4
0
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))
Ejemplo n.º 5
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 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.' )
Ejemplo n.º 6
0
def writeOutput( fileName = '' ):
	"Clip a gcode linear move file.  Chain clip the gcode if it is not already clipped.  If no fileName is specified, clip 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 ]
	loopTailorPreferences = ClipPreferences()
	preferences.readPreferences( loopTailorPreferences )
	startTime = time.time()
	print( 'File ' + gcodec.getSummarizedFilename( fileName ) + ' is being chain clipped.' )
	suffixFilename = fileName[ : fileName.rfind( '.' ) ] + '_clip.gcode'
	loopTailorGcode = getClipChainGcode( fileName, '', loopTailorPreferences )
	if loopTailorGcode == '':
		return
	gcodec.writeFileText( suffixFilename, loopTailorGcode )
	print( 'The clipped file is saved as ' + gcodec.getSummarizedFilename( suffixFilename ) )
	analyze.writeOutput( suffixFilename, loopTailorGcode )
	print( 'It took ' + str( int( round( time.time() - startTime ) ) ) + ' seconds to clip the file.' )
Ejemplo n.º 7
0
def writeOutput( fileName = '' ):
	"Twitterbot a gcode file.  Chain twitterbot the gcode if it is not already twitterbotted.  If no fileName is specified, twitterbot 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 ]
	twitterbotPreferences = TwitterbotPreferences()
	preferences.readPreferences( twitterbotPreferences )
	startTime = time.time()
	print( 'File ' + gcodec.getSummarizedFilename( fileName ) + ' is being chain twitterbotted.' )
	suffixFilename = fileName[ : fileName.rfind( '.' ) ] + '_twitterbot.gcode'
	twitterbotGcode = getTwitterbotChainGcode( fileName, '', twitterbotPreferences )
	if twitterbotGcode == '':
		return
	gcodec.writeFileText( suffixFilename, twitterbotGcode )
	print( 'The twitterbotted file is saved as ' + gcodec.getSummarizedFilename( suffixFilename ) )
	analyze.writeOutput( suffixFilename, twitterbotGcode )
	print( 'It took ' + str( int( round( time.time() - startTime ) ) ) + ' seconds to add Twitterbot codes to the file.' )
Ejemplo n.º 8
0
def writeOutput( fileName = '' ):
	"Unpause a gcode linear move file.  Chain unpause the gcode if it is not already unpaused.  If no fileName is specified, unpause 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 ]
	unpausePreferences = UnpausePreferences()
	preferences.readPreferences( unpausePreferences )
	startTime = time.time()
	print( 'File ' + gcodec.getSummarizedFilename( fileName ) + ' is being chain unpaused.' )
	suffixFilename = fileName[ : fileName.rfind( '.' ) ] + '_unpause.gcode'
	unpauseGcode = getUnpauseChainGcode( fileName, '', unpausePreferences )
	if unpauseGcode == '':
		return
	gcodec.writeFileText( suffixFilename, unpauseGcode )
	print( 'The unpaused file is saved as ' + gcodec.getSummarizedFilename( suffixFilename ) )
	analyze.writeOutput( suffixFilename, unpauseGcode )
	print( 'It took ' + str( int( round( time.time() - startTime ) ) ) + ' seconds to unpause the file.' )
Ejemplo n.º 9
0
def writeOutput( fileName = '' ):
	"Inset the carves of a gcode file.  Chain carve the file if it is a GNU TriangulatedSurface file.  If no fileName is specified, inset 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 ]
	startTime = time.time()
	insetPreferences = InsetPreferences()
	preferences.readPreferences( insetPreferences )
	print( 'File ' + gcodec.getSummarizedFilename( fileName ) + ' is being chain insetted.' )
	suffixFilename = fileName[ : fileName.rfind( '.' ) ] + '_inset.gcode'
	insetGcode = getInsetChainGcode( fileName, '', insetPreferences )
	if insetGcode == '':
		return
	gcodec.writeFileText( suffixFilename, insetGcode )
	print( 'The insetted file is saved as ' + suffixFilename )
	analyze.writeOutput( suffixFilename, insetGcode )
	print( 'It took ' + str( int( round( time.time() - startTime ) ) ) + ' seconds to inset the file.' )
Ejemplo n.º 10
0
def writeOutput( fileName = '' ):
	"Oozebane a gcode linear move file.  Chain oozebane the gcode if it is not already oozebaned. If no fileName is specified, oozebane 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 ]
	oozebanePreferences = OozebanePreferences()
	preferences.readPreferences( oozebanePreferences )
	startTime = time.time()
	print( 'File ' + gcodec.getSummarizedFilename( fileName ) + ' is being chain oozebaned.' )
	suffixFilename = fileName[ : fileName.rfind( '.' ) ] + '_oozebane.gcode'
	oozebaneGcode = getOozebaneChainGcode( fileName, '', oozebanePreferences )
	if oozebaneGcode == '':
		return
	gcodec.writeFileText( suffixFilename, oozebaneGcode )
	print( 'The oozebaned file is saved as ' + gcodec.getSummarizedFilename( suffixFilename ) )
	analyze.writeOutput( suffixFilename, oozebaneGcode )
	print( 'It took ' + str( int( round( time.time() - startTime ) ) ) + ' seconds to oozebane the file.' )
Ejemplo n.º 11
0
def writeOutput( fileName = '' ):
	"""Multiply a gcode linear move file.  Chain multiply the gcode if it is not already multiplied.
	If no fileName is specified, multiply 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 ]
	multiplyPreferences = MultiplyPreferences()
	preferences.readPreferences( multiplyPreferences )
	startTime = time.time()
	print( 'File ' + gcodec.getSummarizedFilename( fileName ) + ' is being chain multiplied.' )
	suffixFilename = fileName[ : fileName.rfind( '.' ) ] + '_multiply.gcode'
	multiplyGcode = getMultiplyChainGcode( fileName, '', multiplyPreferences )
	if multiplyGcode == '':
		return
	gcodec.writeFileText( suffixFilename, multiplyGcode )
	print( 'The multiplied file is saved as ' + gcodec.getSummarizedFilename( suffixFilename ) )
	analyze.writeOutput( suffixFilename, multiplyGcode )
	print( 'It took ' + str( int( round( time.time() - startTime ) ) ) + ' seconds to multiply the file.' )
Ejemplo n.º 12
0
def writeOutput(fileName=""):
    """Speed a gcode linear move file.  Chain speed the gcode if it is not already speeded.
	If no fileName is specified, speed 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]
    speedPreferences = SpeedPreferences()
    preferences.readPreferences(speedPreferences)
    startTime = time.time()
    print("File " + gcodec.getSummarizedFilename(fileName) + " is being chain speeded.")
    suffixFilename = fileName[: fileName.rfind(".")] + "_speed.gcode"
    speedGcode = getSpeedChainGcode(fileName, "", speedPreferences)
    if speedGcode == "":
        return
    gcodec.writeFileText(suffixFilename, speedGcode)
    print("The speeded file is saved as " + gcodec.getSummarizedFilename(suffixFilename))
    analyze.writeOutput(suffixFilename, speedGcode)
    print("It took " + str(int(round(time.time() - startTime))) + " seconds to speed the file.")
Ejemplo n.º 13
0
def writeOutput( fileName = '' ):
	print( "raftless  - writeOutput" )
	"Raftless a gcode linear move file.  Chain raftless the gcode if it is not already raftless'd. If no fileName is specified, raftless 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 ]
	raftlessPreferences = RaftlessPreferences()
	preferences.readPreferences( raftlessPreferences )
	print( )
	startTime = time.time()
	print( "File " + gcodec.getSummarizedFilename( fileName ) + " is being chain raftless'd." )
	suffixFilename = fileName[ : fileName.rfind( '.' ) ] + '_raftless.gcode'
	raftlessGcode = getRaftlessChainGcode( fileName, '', raftlessPreferences )
	if raftlessGcode == '':
		return
	gcodec.writeFileText( suffixFilename, raftlessGcode )
	print( 'The raftless file is saved as ' + gcodec.getSummarizedFilename( suffixFilename ) )
	analyze.writeOutput( suffixFilename, raftlessGcode )
	print( 'It took ' + str( int( round( time.time() - startTime ) ) ) + ' seconds to raftless the file.' )
Ejemplo n.º 14
0
def writeOutput(fileName=''):
    "Inset the carves of a gcode file.  Chain carve the file if it is a GNU TriangulatedSurface file.  If no fileName is specified, inset 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]
    startTime = time.time()
    insetPreferences = InsetPreferences()
    preferences.readPreferences(insetPreferences)
    print('File ' + gcodec.getSummarizedFilename(fileName) +
          ' is being chain insetted.')
    suffixFilename = fileName[:fileName.rfind('.')] + '_inset.gcode'
    insetGcode = getInsetChainGcode(fileName, '', insetPreferences)
    if insetGcode == '':
        return
    gcodec.writeFileText(suffixFilename, insetGcode)
    print('The insetted file is saved as ' + suffixFilename)
    analyze.writeOutput(suffixFilename, insetGcode)
    print('It took ' + str(int(round(time.time() - startTime))) +
          ' seconds to inset the file.')
Ejemplo n.º 15
0
def writeOutput( fileName = '' ):
	"""Fillet a gcode linear move file.  Chain fill the gcode if it is not already filled.
	Depending on the preferences, either arcPoint, arcRadius, arcSegment, bevel or do nothing.
	If no fileName is specified, fillet 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 ]
	filletPreferences = FilletPreferences()
	preferences.readPreferences( filletPreferences )
	startTime = time.time()
	print( 'File ' + gcodec.getSummarizedFilename( fileName ) + ' is being chain filleted.' )
	suffixFilename = fileName[ : fileName.rfind( '.' ) ] + '_fillet.gcode'
	filletGcode = getFilletChainGcode( fileName, '', filletPreferences )
	if filletGcode == '':
		return
	gcodec.writeFileText( suffixFilename, filletGcode )
	print( 'The filleted file is saved as ' + gcodec.getSummarizedFilename( suffixFilename ) )
	analyze.writeOutput( suffixFilename, filletGcode )
	print( 'It took ' + str( int( round( time.time() - startTime ) ) ) + ' seconds to fillet the file.' )
Ejemplo n.º 16
0
def writeOutput(fileName=''):
    """Multiply a gcode linear move file.  Chain multiply the gcode if it is not already multiplied.
	If no fileName is specified, multiply 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]
    multiplyPreferences = MultiplyPreferences()
    preferences.readPreferences(multiplyPreferences)
    startTime = time.time()
    print('File ' + gcodec.getSummarizedFilename(fileName) +
          ' is being chain multiplied.')
    suffixFilename = fileName[:fileName.rfind('.')] + '_multiply.gcode'
    multiplyGcode = getMultiplyChainGcode(fileName, '', multiplyPreferences)
    if multiplyGcode == '':
        return
    gcodec.writeFileText(suffixFilename, multiplyGcode)
    print('The multiplied file is saved as ' +
          gcodec.getSummarizedFilename(suffixFilename))
    analyze.writeOutput(suffixFilename, multiplyGcode)
    print('It took ' + str(int(round(time.time() - startTime))) +
          ' seconds to multiply the file.')