Example #1
0
def getFileOrDirectoryTypesUnmodifiedGcode( fileName, fileTypes, wasCancelled ):
	"Get the gcode files in the directory the file is in if directory setting is true.  Otherwise, return the file in a list."
	if isEmptyOrCancelled( fileName, wasCancelled ):
		return []
	if isDirectorySetting():
		return gcodec.getFilesWithFileTypesWithoutWords( fileTypes, [], fileName ) + gcodec.getUnmodifiedGCodeFiles( fileName )
	return [ fileName ]
Example #2
0
def getFileOrDirectoryTypesUnmodifiedGcode( fileName, fileTypes, wasCancelled ):
	"Get the gcode files in the directory the file is in if directory preference is true.  Otherwise, return the file in a list."
	if isEmptyOrCancelled( fileName, wasCancelled ):
		return []
	if isDirectoryPreference():
		return gcodec.getFilesWithFileTypesWithoutWords( fileTypes, [], fileName ) + gcodec.getUnmodifiedGCodeFiles( fileName )
	return [ fileName ]
Example #3
0
def commentFile(fileName=''):
    "Comment a gcode file.  If no fileName is specified, comment the first gcode file in this folder that is not modified."
    if fileName == '':
        unmodified = gcodec.getUnmodifiedGCodeFiles()
        if len(unmodified) == 0:
            print("There are no unmodified gcode files in this folder.")
            return
        fileName = unmodified[0]
    writeCommentFileGivenText(fileName, gcodec.getFileText(fileName))
Example #4
0
def commentFile( fileName = '' ):
	"Comment a gcode file.  If no fileName is specified, comment the first gcode file in this folder that is not modified."
	if fileName == '':
		unmodified = gcodec.getUnmodifiedGCodeFiles()
		if len( unmodified ) == 0:
			print( "There are no unmodified gcode files in this folder." )
			return
		fileName = unmodified[ 0 ]
	writeCommentFileGivenText( fileName, gcodec.getFileText( fileName ) )
Example #5
0
def beholdFile( fileName = '' ):
	"Behold a gcode file.  If no fileName is specified, behold the first gcode file in this folder that is not modified."
	if fileName == '':
		unmodified = gcodec.getUnmodifiedGCodeFiles()
		if len( unmodified ) == 0:
			print( "There are no unmodified gcode files in this folder." )
			return
		fileName = unmodified[ 0 ]
	gcodeText = gcodec.getFileText( fileName )
	displayBeholdFileGivenText( gcodeText )
Example #6
0
def statisticFile( fileName = '' ):
	"Write statistics for a gcode file.  If no fileName is specified, write statistics for the first gcode file in this folder that is not modified."
	if fileName == '':
		unmodified = gcodec.getUnmodifiedGCodeFiles()
		if len( unmodified ) == 0:
			print( "There are no unmodified gcode files in this folder." )
			return
		fileName = unmodified[ 0 ]
	statisticPreferences = StatisticPreferences()
	preferences.getReadPreferences( statisticPreferences )
	writeStatisticFileGivenText( fileName, gcodec.getFileText( fileName ), statisticPreferences )
Example #7
0
def statisticFile( fileName = '' ):
	"Write statistics for a gcode file.  If no fileName is specified, write statistics for the first gcode file in this folder that is not modified."
	if fileName == '':
		unmodified = gcodec.getUnmodifiedGCodeFiles()
		if len( unmodified ) == 0:
			print( "There are no unmodified gcode files in this folder." )
			return
		fileName = unmodified[ 0 ]
	statisticPreferences = StatisticPreferences()
	preferences.readPreferences( statisticPreferences )
	writeStatisticFileGivenText( fileName, gcodec.getFileText( fileName ), statisticPreferences )
def writeVectorFile( fileName = '' ):
	"Write scalable vector graphics for a gcode file.  If no fileName is specified, write scalable vector graphics for the first gcode file in this folder."
	if fileName == '':
		unmodified = gcodec.getUnmodifiedGCodeFiles()
		if len( unmodified ) == 0:
			print( "There is no gcode file in this folder." )
			return
		fileName = unmodified[ 0 ]
	vectorwritePreferences = VectorwritePreferences()
	preferences.readPreferences( vectorwritePreferences )
	gcodeText = gcodec.getFileText( fileName )
	writeVectorFileGivenText( fileName, gcodeText, vectorwritePreferences )
Example #9
0
def bevelFile( fileName = '' ):
	"Bevel a gcode linear move file.  If no fileName is specified, bevel the first unmodified gcode file in this folder."
	if fileName == '':
		unmodified = gcodec.getUnmodifiedGCodeFiles()
		if len( unmodified ) == 0:
			print( "There are no unmodified gcode files in this folder." )
			return
		fileName = unmodified[ 0 ]
	filletPreferences = FilletPreferences()
	preferences.readPreferences( filletPreferences )
	print( 'File ' + gcodec.getSummarizedFilename( fileName ) + ' is being beveled.' )
	gcodeText = gcodec.getFileText( fileName )
	if gcodeText == '':
		return
	gcodec.writeFileMessageSuffix( fileName, getBevelGcode( filletPreferences, gcodeText ), 'The beveled file is saved as ', '_fillet' )
Example #10
0
def arcRadiusFile( fileName = '' ):
	"Fillet a gcode linear move file into a helical radius move file.  If no fileName is specified, arc radius the first unmodified gcode file in this folder."
	if fileName == '':
		unmodified = gcodec.getUnmodifiedGCodeFiles()
		if len( unmodified ) == 0:
			print( "There are no unmodified gcode files in this folder." )
			return
		fileName = unmodified[ 0 ]
	filletPreferences = FilletPreferences()
	preferences.readPreferences( filletPreferences )
	print( 'File ' + gcodec.getSummarizedFilename( fileName ) + ' is being filleted into arc radiuses.' )
	gcodeText = gcodec.getFileText( fileName )
	if gcodeText == '':
		return
	gcodec.writeFileMessageSuffix( fileName, getArcRadiusGcode( filletPreferences, gcodeText ), 'The arc radius file is saved as ', '_fillet' )
Example #11
0
def getGNUTranslatorFilesUnmodified():
	"Get the file types from the translators in the import plugins folder."
	return gcodec.getFilesWithFileTypesWithoutWords( getImportPluginFileNames() ) + [ gcodec.getUnmodifiedGCodeFiles() ]
Example #12
0
def getGNUTranslatorFilesUnmodified():
	"Get the file types from the translators in the import plugins folder."
	return gcodec.getFilesWithFileTypesWithoutWords( getImportPluginFilenames() ) + [ gcodec.getUnmodifiedGCodeFiles() ]