def writeOutput(fileName=''): "Cleave a GNU Triangulated Surface file. If no fileName is specified, cleave the first GNU Triangulated Surface file in this folder." if fileName == '': unmodified = gcodec.getFilesWithFileTypesWithoutWords( interpret.getImportPluginFileNames()) if len(unmodified) == 0: print("There are no carvable files in this folder.") return fileName = unmodified[0] startTime = time.time() print('File ' + gcodec.getSummarizedFileName(fileName) + ' is being cleaved.') cleaveGcode = getCraftedText(fileName) if cleaveGcode == '': return suffixFileName = fileName[:fileName.rfind('.')] + '_cleave.svg' suffixDirectoryName = os.path.dirname(suffixFileName) suffixReplacedBaseName = os.path.basename(suffixFileName).replace(' ', '_') suffixFileName = os.path.join(suffixDirectoryName, suffixReplacedBaseName) gcodec.writeFileText(suffixFileName, cleaveGcode) print('The cleaved file is saved as ' + gcodec.getSummarizedFileName(suffixFileName)) print('It took ' + str(int(round(time.time() - startTime))) + ' seconds to cleave the file.') settings.openWebPage(suffixFileName)
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 ]
def writeOutput(fileName=''): "Carve a GNU Triangulated Surface file. If no fileName is specified, carve the first GNU Triangulated Surface file in this folder." if fileName == '': unmodified = gcodec.getFilesWithFileTypesWithoutWords( interpret.getImportPluginFilenames()) if len(unmodified) == 0: print( "There are no GNU Triangulated Surface files in this folder.") return fileName = unmodified[0] startTime = time.time() carvePreferences = CarvePreferences() preferences.readPreferences(carvePreferences) print('File ' + gcodec.getSummarizedFilename(fileName) + ' is being carved.') carveGcode = getCarveGcode(fileName, carvePreferences) if carveGcode == '': return suffixFilename = fileName[:fileName.rfind('.')] + '_carve.svg' suffixFilename = suffixFilename.replace(' ', '_') gcodec.writeFileText(suffixFilename, carveGcode) print('The carved file is saved as ' + gcodec.getSummarizedFilename(suffixFilename)) # packageFilePath = os.path.abspath( __file__ ) # for level in xrange( numberOfLevelsDeepInPackageHierarchy + 1 ): # packageFilePath = os.path.dirname( packageFilePath ) # documentationPath = os.path.join( os.path.join( packageFilePath, 'documentation' ), self.displayPreferences.fileNameHelp ) # os.system( webbrowser.get().name + ' ' + documentationPath )#used this instead of webbrowser.open() to workaround webbrowser open() bug # analyze.writeOutput( suffixFilename, carveGcode ) os.system( webbrowser.get().name + ' ' + suffixFilename ) #used this instead of webbrowser.open() to workaround webbrowser open() bug print('It took ' + str(int(round(time.time() - startTime))) + ' seconds to carve the file.')
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 ]
def writeOutput(fileName=""): "Carve a GNU Triangulated Surface file. If no fileName is specified, carve the first GNU Triangulated Surface file in this folder." if fileName == "": unmodified = gcodec.getFilesWithFileTypesWithoutWords(interpret.getImportPluginFilenames()) if len(unmodified) == 0: print("There are no GNU Triangulated Surface files in this folder.") return fileName = unmodified[0] startTime = time.time() carvePreferences = CarvePreferences() preferences.readPreferences(carvePreferences) print("File " + gcodec.getSummarizedFilename(fileName) + " is being carved.") carveGcode = getCarveGcode(fileName, carvePreferences) if carveGcode == "": return suffixFilename = fileName[: fileName.rfind(".")] + "_carve.svg" suffixFilename = suffixFilename.replace(" ", "_") gcodec.writeFileText(suffixFilename, carveGcode) print("The carved file is saved as " + gcodec.getSummarizedFilename(suffixFilename)) # packageFilePath = os.path.abspath( __file__ ) # for level in xrange( numberOfLevelsDeepInPackageHierarchy + 1 ): # packageFilePath = os.path.dirname( packageFilePath ) # documentationPath = os.path.join( os.path.join( packageFilePath, 'documentation' ), self.displayPreferences.fileNameHelp ) # os.system( webbrowser.get().name + ' ' + documentationPath )#used this instead of webbrowser.open() to workaround webbrowser open() bug # analyze.writeOutput( suffixFilename, carveGcode ) os.system( webbrowser.get().name + " " + suffixFilename ) # used this instead of webbrowser.open() to workaround webbrowser open() bug print("It took " + str(int(round(time.time() - startTime))) + " seconds to carve the file.")
def getFileOrDirectoryTypes(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) return [fileName]
def getFileOrDirectoryTypes(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) return [fileName]
def writeOutput(fileName=""): "Chop a GNU Triangulated Surface file. If no fileName is specified, chop the first GNU Triangulated Surface file in this folder." if fileName == "": unmodified = gcodec.getFilesWithFileTypesWithoutWords(interpret.getImportPluginFileNames()) if len(unmodified) == 0: print("There are no carvable files in this folder.") return fileName = unmodified[0] startTime = time.time() print("File " + gcodec.getSummarizedFileName(fileName) + " is being chopped.") chopGcode = getCraftedText(fileName) if chopGcode == "": return suffixFileName = fileName[: fileName.rfind(".")] + "_chop.svg" suffixDirectoryName = os.path.dirname(suffixFileName) suffixReplacedBaseName = os.path.basename(suffixFileName).replace(" ", "_") suffixFileName = os.path.join(suffixDirectoryName, suffixReplacedBaseName) gcodec.writeFileText(suffixFileName, chopGcode) print("The chopped file is saved as " + gcodec.getSummarizedFileName(suffixFileName)) print("It took " + str(int(round(time.time() - startTime))) + " seconds to chop the file.") settings.openWebPage(suffixFileName)
def writeOutput( fileName = '' ): "Chop a GNU Triangulated Surface file. If no fileName is specified, chop the first GNU Triangulated Surface file in this folder." if fileName == '': unmodified = gcodec.getFilesWithFileTypesWithoutWords( interpret.getImportPluginFilenames() ) if len( unmodified ) == 0: print( "There are no carvable files in this folder." ) return fileName = unmodified[ 0 ] startTime = time.time() print( 'File ' + gcodec.getSummarizedFilename( fileName ) + ' is being chopped.' ) chopGcode = getCraftedText( fileName ) if chopGcode == '': return suffixFilename = fileName[ : fileName.rfind( '.' ) ] + '_chop.svg' suffixDirectoryName = os.path.dirname( suffixFilename ) suffixReplacedBaseName = os.path.basename( suffixFilename ).replace( ' ', '_' ) suffixFilename = os.path.join( suffixDirectoryName, suffixReplacedBaseName ) gcodec.writeFileText( suffixFilename, chopGcode ) print( 'The chopped file is saved as ' + gcodec.getSummarizedFilename( suffixFilename ) ) print( 'It took ' + str( int( round( time.time() - startTime ) ) ) + ' seconds to chop the file.' ) preferences.openWebPage( suffixFilename )
def getGNUTranslatorFilesUnmodified(): "Get the file types from the translators in the import plugins folder." return gcodec.getFilesWithFileTypesWithoutWords( getImportPluginFileNames() ) + [ gcodec.getUnmodifiedGCodeFiles() ]
def getGNUTranslatorFilesUnmodified(): "Get the file types from the translators in the import plugins folder." return gcodec.getFilesWithFileTypesWithoutWords( getImportPluginFilenames() ) + [ gcodec.getUnmodifiedGCodeFiles() ]