def writeOutput( fileName = ''): "Carve a GNU Triangulated Surface file." startTime = time.time() print('File ' + gcodec.getSummarizedFileName(fileName) + ' is being carved.') repository = CarveRepository() settings.getReadRepository(repository) carveGcode = getCraftedText( fileName, '', repository ) if carveGcode == '': return suffixFileName = gcodec.getFilePathWithUnderscoredBasename( fileName, '_carve.svg') gcodec.writeFileText( suffixFileName, carveGcode ) print('The carved file is saved as ' + gcodec.getSummarizedFileName(suffixFileName) ) print('It took %s to carve the file.' % euclidean.getDurationString( time.time() - startTime ) ) settings.openSVGPage( suffixFileName, repository.svgViewer.value )
def writeOutput(fileName=''): "Carve a GNU Triangulated Surface file." startTime = time.time() print('File ' + archive.getSummarizedFileName(fileName) + ' is being carved.') repository = CarveRepository() settings.getReadRepository(repository) carveGcode = getCraftedText( fileName, '', repository ) if carveGcode == '': return suffixFileName = archive.getFilePathWithUnderscoredBasename( fileName, '_carve.svg') archive.writeFileText( suffixFileName, carveGcode ) print('The carved file is saved as ' + archive.getSummarizedFileName(suffixFileName) ) print('It took %s to carve the file.' % euclidean.getDurationString( time.time() - startTime ) ) settings.openSVGPage( suffixFileName, repository.svgViewer.value )
def writeOutput(fileName, shouldAnalyze=True): "Carve a GNU Triangulated Surface file." startTime = time.time() print("File " + archive.getSummarizedFileName(fileName) + " is being carved.") repository = CarveRepository() settings.getReadRepository(repository) carveGcode = getCraftedText(fileName, "", repository) if carveGcode == "": return suffixFileName = archive.getFilePathWithUnderscoredBasename(fileName, "_carve.svg") archive.writeFileText(suffixFileName, carveGcode) print("The carved file is saved as " + archive.getSummarizedFileName(suffixFileName)) print("It took %s to carve the file." % euclidean.getDurationString(time.time() - startTime)) if shouldAnalyze: settings.openSVGPage(suffixFileName, repository.svgViewer.value)
def writeOutput( self, fileName = ''): "Cleave a GNU Triangulated Surface file. If no fileName is specified, cleave the first GNU Triangulated Surface file in this folder." startTime = time.time() print('File ' + gcodec.getSummarizedFileName(fileName) + ' is being cleaved.') repository = CleaveRepository() settings.getReadRepository(repository) cleaveGcode = self.getCraftedText( fileName, '', repository ) 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 %s to cleave the file.' % euclidean.getDurationString( time.time() - startTime ) ) settings.openSVGPage( suffixFileName, repository.svgViewer.value )
def writeOutput(fileName=''): "Cleave a GNU Triangulated Surface file. If no fileName is specified, cleave the first GNU Triangulated Surface file in this folder." startTime = time.time() print('File ' + archive.getSummarizedFileName(fileName) + ' is being cleaved.') repository = CleaveRepository() settings.getReadRepository(repository) cleaveGcode = getCraftedText( fileName, '', repository ) 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 ) archive.writeFileText( suffixFileName, cleaveGcode ) print('The cleaved file is saved as ' + archive.getSummarizedFileName(suffixFileName) ) print('It took %s to cleave the file.' % euclidean.getDurationString( time.time() - startTime ) ) settings.openSVGPage( suffixFileName, repository.svgViewer.value )
def writeOutput(fileName=""): "Chop a GNU Triangulated Surface file. If no fileName is specified, chop the first GNU Triangulated Surface file in this folder." startTime = time.time() print("File " + archive.getSummarizedFileName(fileName) + " is being chopped.") repository = ChopRepository() settings.getReadRepository(repository) chopGcode = getCraftedText(fileName, "", repository) 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) archive.writeFileText(suffixFileName, chopGcode) print("The chopped file is saved as " + archive.getSummarizedFileName(suffixFileName)) print("It took %s to chop the file." % euclidean.getDurationString(time.time() - startTime)) settings.openSVGPage(suffixFileName, repository.svgViewer.value)
def writeOutput(fileName, shouldAnalyze=True): "Chop a GNU Triangulated Surface file. If no fileName is specified, chop the first GNU Triangulated Surface file in this folder." startTime = time.time() print('File ' + archive.getSummarizedFileName(fileName) + ' is being chopped.') repository = ChopRepository() settings.getReadRepository(repository) chopGcode = getCraftedText( fileName, '', repository ) 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 ) archive.writeFileText( suffixFileName, chopGcode ) print('The chopped file is saved as ' + archive.getSummarizedFileName(suffixFileName) ) print('It took %s to chop the file.' % euclidean.getDurationString( time.time() - startTime ) ) if shouldAnalyze: settings.openSVGPage( suffixFileName, repository.svgViewer.value )
def getWindowAnalyzeFileGivenText( fileName, gcodeText, repository=None): 'Write scalable vector graphics for a gcode file given the settings.' if gcodeText == '': return None if repository == None: repository = settings.getReadRepository( VectorwriteRepository() ) startTime = time.time() vectorwriteGcode = VectorwriteSkein().getCarvedSVG( fileName, gcodeText, repository ) if vectorwriteGcode == '': return None suffixFileName = fileName[ : fileName.rfind('.') ] + '_vectorwrite.svg' suffixDirectoryName = os.path.dirname(suffixFileName) suffixReplacedBaseName = os.path.basename(suffixFileName).replace(' ', '_') suffixFileName = os.path.join( suffixDirectoryName, suffixReplacedBaseName ) archive.writeFileText( suffixFileName, vectorwriteGcode ) print('The vectorwrite file is saved as ' + archive.getSummarizedFileName(suffixFileName) ) print('It took %s to vectorwrite the file.' % euclidean.getDurationString( time.time() - startTime ) ) settings.openSVGPage( suffixFileName, repository.svgViewer.value )
def writeSVGTextWithNounMessage(fileName, repository): 'Get and write an svg text and print messages.' print('') print('The %s tool is parsing the file:' % repository.lowerName) print(os.path.basename(fileName)) print('') startTime = time.time() fileNameSuffix = fileName[: fileName.rfind('.')] + '_' + repository.lowerName + '.svg' craftText = getChainText(fileName, repository.lowerName) if craftText == '': return archive.writeFileText(fileNameSuffix, craftText) print('') print('The %s tool has created the file:' % repository.lowerName) print(fileNameSuffix) print('') print('It took %s to craft the file.' % euclidean.getDurationString(time.time() - startTime)) settings.getReadRepository(repository) settings.openSVGPage(fileNameSuffix, repository.svgViewer.value)
def writeSVGTextWithNounMessage(fileName, repository, shouldAnalyze=True): "Get and write an svg text and print messages." print("") print("The %s tool is parsing the file:" % repository.lowerName) print(os.path.basename(fileName)) print("") startTime = time.time() fileNameSuffix = fileName[: fileName.rfind(".")] + "_" + repository.lowerName + ".svg" craftText = getChainText(fileName, repository.lowerName) if craftText == "": return archive.writeFileText(fileNameSuffix, craftText) print("") print("The %s tool has created the file:" % repository.lowerName) print(fileNameSuffix) print("") print("It took %s to craft the file." % euclidean.getDurationString(time.time() - startTime)) if shouldAnalyze: settings.getReadRepository(repository) settings.openSVGPage(fileNameSuffix, repository.svgViewer.value)
def writeOutput(fileName=''): "Bottom the carving of a gcode file." print('') print('The bottom tool is parsing the file:') print(os.path.basename(fileName)) print('') startTime = time.time() fileNameSuffix = fileName[: fileName.rfind('.')] + '_bottom.svg' craftText = skeinforge_craft.getChainText(fileName, 'bottom') if craftText == '': return archive.writeFileText(fileNameSuffix, craftText) print('') print('The bottom tool has created the file:') print(fileNameSuffix) print('') print('It took %s to craft the file.' % euclidean.getDurationString(time.time() - startTime)) repository = BottomRepository() settings.getReadRepository(repository) settings.openSVGPage(fileNameSuffix, repository.svgViewer.value)