예제 #1
0
파일: export.py 프로젝트: 1060460048/Cura
def getOutput(fileName):
	'Export a gcode linear move file.'
	if fileName == '':
		return None
	repository = ExportRepository()
	settings.getReadRepository(repository)
	startTime = time.time()
	print('File ' + archive.getSummarizedFileName(fileName.encode('ascii', 'replace')) + ' is being chain exported.')
	gcodeText = gcodec.getGcodeFileText(fileName, '')
	procedures = skeinforge_craft.getProcedures('export', gcodeText)
	gcodeText = skeinforge_craft.getChainTextFromProcedures(fileName, procedures[: -1], gcodeText)
	if gcodeText == '':
		return None
	fileNamePenultimate = fileName[: fileName.rfind('.')] + '_penultimate.gcode'
	if repository.savePenultimateGcode.value:
		archive.writeFileText(fileNamePenultimate, gcodeText)
		print('The penultimate file is saved as ' + archive.getSummarizedFileName(fileNamePenultimate))
	exportGcode = getCraftedTextFromText(gcodeText, repository)
	replaceableExportGcode = None
	selectedPluginModule = getSelectedPluginModule(repository.exportPlugins)
	if selectedPluginModule is None:
		replaceableExportGcode = exportGcode
	else:
		if selectedPluginModule.globalIsReplaceable:
			replaceableExportGcode = selectedPluginModule.getOutput(exportGcode)
		#else:
		#	selectedPluginModule.writeOutput(outputFilename, exportGcode)
	if replaceableExportGcode is not None:
		replaceableExportGcode = getReplaceableExportGcode(repository.nameOfReplaceFile.value, replaceableExportGcode)
	if repository.alsoSendOutputTo.value != '':
		if replaceableExportGcode == None:
			replaceableExportGcode = selectedPluginModule.getOutput(exportGcode)
		sendOutputTo(repository.alsoSendOutputTo.value, replaceableExportGcode)
	print('It took %s to export the file.' % euclidean.getDurationString(time.time() - startTime))
	return replaceableExportGcode
예제 #2
0
def getWindowAnalyzeFile(fileName):
	"Get file interpretion."
	startTime = time.time()
	carving = getCarving(fileName)
	if carving is None:
		return None
	interpretGcode = str( carving )
	if interpretGcode == '':
		return None
	repository = settings.getReadRepository( InterpretRepository() )
	if repository.printInterpretion.value:
		print( interpretGcode )
	suffixFileName = fileName[ : fileName.rfind('.') ] + '_interpret.' + carving.getInterpretationSuffix()
	suffixDirectoryName = os.path.dirname(suffixFileName)
	suffixReplacedBaseName = os.path.basename(suffixFileName).replace(' ', '_')
	suffixFileName = os.path.join( suffixDirectoryName, suffixReplacedBaseName )
	archive.writeFileText( suffixFileName, interpretGcode )
	print('The interpret file is saved as ' + archive.getSummarizedFileName(suffixFileName) )
	print('It took %s to interpret the file.' % euclidean.getDurationString( time.time() - startTime ) )
	textProgram = repository.textProgram.value
	if textProgram == '':
		return None
	if textProgram == 'webbrowser':
		settings.openWebPage(suffixFileName)
		return None
	textFilePath = '"' + os.path.normpath(suffixFileName) + '"' # " to send in file name with spaces
	shellCommand = textProgram + ' ' + textFilePath
	print('Sending the shell command:')
	print(shellCommand)
	commandResult = os.system(shellCommand)
	if commandResult != 0:
		print('It may be that the system could not find the %s program.' % textProgram )
		print('If so, try installing the %s program or look for another one, like Open Office which can be found at:' % textProgram )
		print('http://www.openoffice.org/')
		print('Open office writer can then be started from the command line with the command "soffice -writer".')
예제 #3
0
파일: export.py 프로젝트: garyhodgson/SFACT
def writeOutput(fileName, shouldAnalyze=True):
    "Export a gcode linear move file."
    if fileName == "":
        return None
    repository = ExportRepository()
    settings.getReadRepository(repository)
    startTime = time.time()
    print("File " + archive.getSummarizedFileName(fileName) + " is being chain exported.")
    fileNameSuffix = fileName[: fileName.rfind(".")]
    if repository.addExportSuffix.value:
        fileNameSuffix += "_export"
    gcodeText = gcodec.getGcodeFileText(fileName, "")

    if repository.addProfileExtension.value:
        profileName = skeinforge_profile.getProfileName(skeinforge_profile.getCraftTypeName())
        if profileName:
            fileNameSuffix += "." + string.replace(profileName, " ", "_")
    if repository.addDescriptiveExtension.value:
        fileNameSuffix += getDescriptiveExtension(gcodeText)
    if repository.addTimestampExtension.value:
        fileNameSuffix += "." + getFirstValue(gcodeText, "(<timeStampPreface>")
    fileNameSuffix += "." + repository.fileExtension.value
    procedures = skeinforge_craft.getProcedures("export", gcodeText)
    gcodeText = skeinforge_craft.getChainTextFromProcedures(fileName, procedures[:-1], gcodeText)
    if gcodeText == "":
        return None
    fileNamePenultimate = fileName[: fileName.rfind(".")] + "_penultimate.gcode"
    filePenultimateWritten = False
    if repository.savePenultimateGcode.value:
        archive.writeFileText(fileNamePenultimate, gcodeText)
        filePenultimateWritten = True
        print("The penultimate file is saved as " + archive.getSummarizedFileName(fileNamePenultimate))
    exportGcode = getCraftedTextFromText(gcodeText, repository)
    window = None
    if shouldAnalyze:
        window = skeinforge_analyze.writeOutput(
            fileName, fileNamePenultimate, fileNameSuffix, filePenultimateWritten, gcodeText
        )
    replaceableExportGcode = None
    selectedPluginModule = getSelectedPluginModule(repository.exportPlugins)
    if selectedPluginModule == None:
        replaceableExportGcode = exportGcode
    else:
        if selectedPluginModule.globalIsReplaceable:
            replaceableExportGcode = selectedPluginModule.getOutput(exportGcode)
        else:
            selectedPluginModule.writeOutput(fileNameSuffix, exportGcode)
    if replaceableExportGcode != None:
        replaceableExportGcode = getReplaceableExportGcode(repository.nameOfReplaceFile.value, replaceableExportGcode)
        archive.writeFileText(fileNameSuffix, replaceableExportGcode)
        print("The exported file is saved as " + archive.getSummarizedFileName(fileNameSuffix))
    if repository.alsoSendOutputTo.value != "":
        if replaceableExportGcode == None:
            replaceableExportGcode = selectedPluginModule.getOutput(exportGcode)
        sendOutputTo(repository.alsoSendOutputTo.value, replaceableExportGcode)
    print("It took %s to export the file." % euclidean.getDurationString(time.time() - startTime))
    return window
예제 #4
0
def writeOutput(fileName, shouldAnalyze=True):
	'Export a gcode linear move file.'
	if fileName == '':
		return None
	repository = ExportRepository()
	settings.getReadRepository(repository)
	startTime = time.time()
	print('File ' + archive.getSummarizedFileName(fileName) + ' is being chain exported.')
	fileNameSuffix = fileName[: fileName.rfind('.')]
	if repository.addExportSuffix.value:
		fileNameSuffix += '_export'
	gcodeText = gcodec.getGcodeFileText(fileName, '')
	procedures = skeinforge_craft.getProcedures('export', gcodeText)
	gcodeText = skeinforge_craft.getChainTextFromProcedures(fileName, procedures[: -1], gcodeText)
	if gcodeText == '':
		return None
	if repository.addProfileExtension.value:
		fileNameSuffix += '.' + getFirstValue(gcodeText, '(<profileName>')
	if repository.addDescriptiveExtension.value:
		print(  'getDescriptiveExtension(gcodeText)')
		print(  getDescriptiveExtension(gcodeText))
		fileNameSuffix += getDescriptiveExtension(gcodeText)
	if repository.addTimestampExtension.value:
		fileNameSuffix += '.' + getFirstValue(gcodeText, '(<timeStampPreface>')
	fileNameSuffix += '.' + repository.fileExtension.value
	fileNamePenultimate = fileName[: fileName.rfind('.')] + '_penultimate.gcode'
	filePenultimateWritten = False
	if repository.savePenultimateGcode.value:
		archive.writeFileText(fileNamePenultimate, gcodeText)
		filePenultimateWritten = True
		print('The penultimate file is saved as ' + archive.getSummarizedFileName(fileNamePenultimate))
	exportGcode = getCraftedTextFromText(gcodeText, repository)
	window = None
	if shouldAnalyze and repository.analyzeGcode.value:
		window = skeinforge_analyze.writeOutput(fileName, fileNamePenultimate, fileNameSuffix, filePenultimateWritten, gcodeText)
	replaceableExportGcode = None
	selectedPluginModule = getSelectedPluginModule(repository.exportPlugins)
	if selectedPluginModule == None:
		replaceableExportGcode = exportGcode
	else:
		if selectedPluginModule.globalIsReplaceable:
			replaceableExportGcode = selectedPluginModule.getOutput(exportGcode)
		else:
			selectedPluginModule.writeOutput(fileNameSuffix, exportGcode)
	if replaceableExportGcode != None:
		replaceableExportGcode = getReplaceableExportGcode(repository.nameOfReplaceFile.value, replaceableExportGcode)
		archive.writeFileText( fileNameSuffix, replaceableExportGcode )
		print('The exported file is saved as ' + archive.getSummarizedFileName(fileNameSuffix))
	if repository.alsoSendOutputTo.value != '':
		if replaceableExportGcode == None:
			replaceableExportGcode = selectedPluginModule.getOutput(exportGcode)
		sendOutputTo(repository.alsoSendOutputTo.value, replaceableExportGcode)
	print('It took %s to export the file.' % euclidean.getDurationString(time.time() - startTime))
	return window
예제 #5
0
def getChainTextFromProcedures( fileName, procedures, text ):
	"Get a crafted shape file from a list of procedures."
	lastProcedureTime = time.time()
	for procedure in procedures:
		craftModule = getCraftModule(procedure)
		if craftModule != None:
			text = craftModule.getCraftedText( fileName, text )
			if gcodec.isProcedureDone( text, procedure ):
				print('%s procedure took %s.' % (procedure.capitalize(), euclidean.getDurationString(time.time() - lastProcedureTime)))
				lastProcedureTime = time.time()
	return text
예제 #6
0
def writeOutput( fileName = '' ):
	"Carve a GNU Triangulated Surface file."
	startTime = time.time()
	print( 'File ' + gcodec.getSummarizedFileName( fileName ) + ' is being carved.' )
	carveGcode = getCraftedText( fileName )
	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.openWebPage( suffixFileName )
예제 #7
0
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 )
예제 #8
0
파일: carve.py 프로젝트: darthrake/SFACT
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 getChainTextFromProcedures(fileName, procedures, text):
	'Get a crafted shape file from a list of procedures.'
	lastProcedureTime = time.time()
	for procedure in procedures:
		craftModule = getCraftModule(procedure)
		if craftModule != None:
			text = craftModule.getCraftedText(fileName, text)
			if text == '':
				print('Warning, the text was not recognized in getChainTextFromProcedures in skeinforge_craft for')
				print(fileName)
				return ''
			if gcodec.isProcedureDone( text, procedure ):
				print('%s procedure took %s.' % (procedure.capitalize(), euclidean.getDurationString(time.time() - lastProcedureTime)))
				lastProcedureTime = time.time()
	return text
예제 #10
0
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)
예제 #11
0
파일: synopsis.py 프로젝트: folksjos/RepG
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(SynopsisRepository())
	startTime = time.time()
	suffixFileNameWithoutExtension = fileName[: fileName.rfind('.')] + '_synopsis.'
	suffixDirectoryPath = os.path.dirname(suffixFileNameWithoutExtension)
	suffixReplacedBaseNameWithoutExtension = os.path.basename(suffixFileNameWithoutExtension).replace(' ', '_')
	suffixFileNameWithoutExtension = os.path.join(suffixDirectoryPath, suffixReplacedBaseNameWithoutExtension)
	abridgedSettings = getAbridgedSettings(gcodeText)
	if repository.exportProfileAsCSVFile.value:
		exportProfileAsCSVFile(abridgedSettings, suffixFileNameWithoutExtension)
	if repository.exportProfileAsZipFile.value:
		exportProfileAsZipFile(abridgedSettings, suffixDirectoryPath, suffixFileNameWithoutExtension)
	print('It took %s for synopsis to analyze the file.' % euclidean.getDurationString(time.time() - startTime))
예제 #12
0
	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 )
예제 #13
0
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 )
예제 #14
0
def writeChainTextWithNounMessage( fileName, procedure ):
	"Get and write a crafted shape file."
	print('')
	print('The %s tool is parsing the file:' % procedure )
	print( os.path.basename(fileName) )
	print('')
	startTime = time.time()
	fileNameSuffix = fileName[ : fileName.rfind('.') ] + '_' + procedure + '.gcode'
	craftText = getChainText( fileName, procedure )
	if craftText == '':
		return
	archive.writeFileText( fileNameSuffix, craftText )
	print('')
	print('The %s tool has created the file:' % procedure )
	print( fileNameSuffix )
	print('')
	print('It took %s to craft the file.' % euclidean.getDurationString( time.time() - startTime ) )
	skeinforge_analyze.writeOutput( fileName, fileNameSuffix, craftText )
예제 #15
0
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 )
예제 #16
0
def analyzeFileGivenText(fileName, gcodeText, repository=None):
    "Write scalable vector graphics for a gcode file given the settings."
    if gcodeText == "":
        return ""
    if repository == None:
        repository = settings.getReadRepository(VectorwriteRepository())
    startTime = time.time()
    vectorwriteGcode = VectorwriteSkein().getCarvedSVG(fileName, gcodeText, repository)
    if vectorwriteGcode == "":
        return
    suffixFileName = fileName[: fileName.rfind(".")] + "_vectorwrite.svg"
    suffixDirectoryName = os.path.dirname(suffixFileName)
    suffixReplacedBaseName = os.path.basename(suffixFileName).replace(" ", "_")
    suffixFileName = os.path.join(suffixDirectoryName, suffixReplacedBaseName)
    gcodec.writeFileText(suffixFileName, vectorwriteGcode)
    print("The vectorwrite file is saved as " + gcodec.getSummarizedFileName(suffixFileName))
    print("It took %s to vectorwrite the file." % euclidean.getDurationString(time.time() - startTime))
    settings.openWebPage(suffixFileName)
예제 #17
0
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)
예제 #18
0
파일: export.py 프로젝트: mrkim/ReplicatorG
def writeOutput(fileName=''):
	'Export a gcode linear move file.'
	fileName = fabmetheus_interpret.getFirstTranslatorFileNameUnmodified(fileName)
	if fileName == '':
		return
	repository = ExportRepository()
	settings.getReadRepository(repository)
	startTime = time.time()
	print('File ' + archive.getSummarizedFileName(fileName) + ' is being chain exported.')
	suffixFileName = fileName[: fileName.rfind('.')]
	if repository.addExportSuffix.value:
		suffixFileName += '_export'
	suffixFileName += '.' + repository.fileExtension.value
	gcodeText = gcodec.getGcodeFileText(fileName, '')
	procedures = skeinforge_craft.getProcedures('export', gcodeText)
	gcodeText = skeinforge_craft.getChainTextFromProcedures(fileName, procedures[ : - 1 ], gcodeText)
	if gcodeText == '':
		return
	window = skeinforge_analyze.writeOutput(fileName, suffixFileName, gcodeText)
	if repository.savePenultimateGcode.value:
		penultimateFileName = fileName[: fileName.rfind('.')] + '_penultimate.gcode'
		archive.writeFileText(penultimateFileName, gcodeText)
		print('The penultimate file is saved as ' + archive.getSummarizedFileName(penultimateFileName))
	exportChainGcode = getCraftedTextFromText(gcodeText, repository)
	replaceableExportChainGcode = None
	selectedPluginModule = getSelectedPluginModule(repository.exportPlugins)
	if selectedPluginModule == None:
		replaceableExportChainGcode = exportChainGcode
	else:
		if selectedPluginModule.globalIsReplaceable:
			replaceableExportChainGcode = selectedPluginModule.getOutput(exportChainGcode)
		else:
			selectedPluginModule.writeOutput(suffixFileName, exportChainGcode)
	if replaceableExportChainGcode != None:
		replaceableExportChainGcode = getReplaced(replaceableExportChainGcode)
		archive.writeFileText( suffixFileName, replaceableExportChainGcode )
		print('The exported file is saved as ' + archive.getSummarizedFileName(suffixFileName))
	if repository.alsoSendOutputTo.value != '':
		if replaceableExportChainGcode == None:
			replaceableExportChainGcode = selectedPluginModule.getOutput(exportChainGcode)
		exec('print >> ' + repository.alsoSendOutputTo.value + ', replaceableExportChainGcode')
	print('It took %s to export the file.' % euclidean.getDurationString(time.time() - startTime))
	return window
예제 #19
0
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)
예제 #20
0
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)
예제 #21
0
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)
예제 #22
0
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)
예제 #23
0
def writeChainTextWithNounMessage(fileName, procedure):
	'Get and write a crafted shape file.'
	print('')
	print('The %s tool is parsing the file:' % procedure)
	print(os.path.basename(fileName))
	print('')
	startTime = time.time()
	fileNameSuffix = fileName[: fileName.rfind('.')] + '_' + procedure + '.gcode'
	craftText = getChainText(fileName, procedure)
	if craftText == '':
		print('Warning, there was no text output in writeChainTextWithNounMessage in skeinforge_craft for:')
		print(fileName)
		return
	archive.writeFileText(fileNameSuffix, craftText)
	print('')
	print('The %s tool has created the file:' % procedure)
	print(fileNameSuffix)
	print('')
	print('It took %s to craft the file.' % euclidean.getDurationString(time.time() - startTime))
	return skeinforge_analyze.writeOutput(fileName, fileNameSuffix, craftText)
예제 #24
0
def getChainTextFromProcedures(fileName, procedures, text):
    'Get a crafted shape file from a list of procedures.'
    lastProcedureTime = time.time()
    for procedure in procedures:
        craftModule = getCraftModule(procedure)
        if craftModule != None:
            text = craftModule.getCraftedText(fileName, text)
            if text == '':
                print(
                    'Warning, the text was not recognized in getChainTextFromProcedures in skeinforge_craft for'
                )
                print(fileName)
                return ''
            if gcodec.isProcedureDone(text, procedure):
                print('%s procedure took %s.' %
                      (procedure.capitalize(),
                       euclidean.getDurationString(time.time() -
                                                   lastProcedureTime)))
                lastProcedureTime = time.time()
    return text
예제 #25
0
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)
예제 #26
0
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( fabmetheus_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 %s to chop the file.' % euclidean.getDurationString( time.time() - startTime ) )
	settings.openWebPage( suffixFileName )
예제 #27
0
def writeOutput(fileName, shouldAnalyze=True):
    "Cleave a GNU Triangulated Surface file."
    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))
    if shouldAnalyze:
        settings.openSVGPage(suffixFileName, repository.svgViewer.value)
예제 #28
0
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)
예제 #29
0
def writeOutput(fileName=''):
	'Export a gcode linear move file.'
	fileName = fabmetheus_interpret.getFirstTranslatorFileNameUnmodified(fileName)
	if fileName == '':
		return
	repository = ExportRepository()
	settings.getReadRepository(repository)
	startTime = time.time()
	print('File ' + archive.getSummarizedFileName(fileName) + ' is being chain exported.')
	suffixFileName = fileName[: fileName.rfind('.')] + '_export.' + repository.fileExtension.value
	gcodeText = gcodec.getGcodeFileText(fileName, '')
	procedures = skeinforge_craft.getProcedures('export', gcodeText)
	gcodeText = skeinforge_craft.getChainTextFromProcedures(fileName, procedures[ : - 1 ], gcodeText)
	if gcodeText == '':
		return
	window = skeinforge_analyze.writeOutput(fileName, suffixFileName, gcodeText)
	if repository.savePenultimateGcode.value:
		penultimateFileName = fileName[: fileName.rfind('.')] + '_penultimate.gcode'
		archive.writeFileText(penultimateFileName, gcodeText)
		print('The penultimate file is saved as ' + archive.getSummarizedFileName(penultimateFileName))
	exportChainGcode = getCraftedTextFromText(gcodeText, repository)
	replaceableExportChainGcode = None
	selectedPluginModule = getSelectedPluginModule(repository.exportPlugins)
	if selectedPluginModule == None:
		replaceableExportChainGcode = exportChainGcode
	else:
		if selectedPluginModule.globalIsReplaceable:
			replaceableExportChainGcode = selectedPluginModule.getOutput(exportChainGcode)
		else:
			selectedPluginModule.writeOutput(suffixFileName, exportChainGcode)
	if replaceableExportChainGcode != None:
		replaceableExportChainGcode = getReplaced(replaceableExportChainGcode)
		archive.writeFileText( suffixFileName, replaceableExportChainGcode )
		print('The exported file is saved as ' + archive.getSummarizedFileName(suffixFileName))
	if repository.alsoSendOutputTo.value != '':
		if replaceableExportChainGcode == None:
			replaceableExportChainGcode = selectedPluginModule.getOutput(exportChainGcode)
		exec('print >> ' + repository.alsoSendOutputTo.value + ', replaceableExportChainGcode')
	print('It took %s to export the file.' % euclidean.getDurationString(time.time() - startTime))
	return window
def writeChainTextWithNounMessage(fileName, procedure, shouldAnalyze=True):
    "Get and write a crafted shape file."
    print("")
    print("The %s tool is parsing the file:" % procedure)
    print(os.path.basename(fileName))
    print("")
    startTime = time.time()
    fileNameSuffix = fileName[: fileName.rfind(".")] + "_" + procedure + ".gcode"
    craftText = getChainText(fileName, procedure)
    if craftText == "":
        print("Warning, there was no text output in writeChainTextWithNounMessage in skeinforge_craft for:")
        print(fileName)
        return
    archive.writeFileText(fileNameSuffix, craftText)
    window = None
    if shouldAnalyze:
        window = skeinforge_analyze.writeOutput(fileName, fileNameSuffix, craftText)
    print("")
    print("The %s tool has created the file:" % procedure)
    print(fileNameSuffix)
    print("")
    print("It took %s to craft the file." % euclidean.getDurationString(time.time() - startTime))
    return window
예제 #31
0
def writeChainTextWithNounMessage(fileName, procedure, shouldAnalyze=True):
	'Get and write a crafted shape file.'
	print('')
	print('The %s tool is parsing the file:' % procedure)
	print(os.path.basename(fileName))
	print('')
	startTime = time.time()
	fileNameSuffix = fileName[: fileName.rfind('.')] + '_' + procedure + '.gcode'
	craftText = getChainText(fileName, procedure)
	if craftText == '':
		print('Warning, there was no text output in writeChainTextWithNounMessage in skeinforge_craft for:')
		print(fileName)
		return
	archive.writeFileText(fileNameSuffix, craftText)
	window = None
	if shouldAnalyze:
		window = skeinforge_analyze.writeOutput(fileName, fileNameSuffix, fileNameSuffix, True, craftText)
	print('')
	print('The %s tool has created the file:' % procedure)
	print(fileNameSuffix)
	print('')
	print('It took %s to craft the file.' % euclidean.getDurationString(time.time() - startTime))
	return window
예제 #32
0
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(SynopsisRepository())
    startTime = time.time()
    suffixFileNameWithoutExtension = fileName[:fileName.rfind('.'
                                                              )] + '_synopsis.'
    suffixDirectoryPath = os.path.dirname(suffixFileNameWithoutExtension)
    suffixReplacedBaseNameWithoutExtension = os.path.basename(
        suffixFileNameWithoutExtension).replace(' ', '_')
    suffixFileNameWithoutExtension = os.path.join(
        suffixDirectoryPath, suffixReplacedBaseNameWithoutExtension)
    abridgedSettings = getAbridgedSettings(gcodeText)
    if repository.exportProfileAsCSVFile.value:
        exportProfileAsCSVFile(abridgedSettings,
                               suffixFileNameWithoutExtension)
    if repository.exportProfileAsZipFile.value:
        exportProfileAsZipFile(abridgedSettings, suffixDirectoryPath,
                               suffixFileNameWithoutExtension)
    print('It took %s for synopsis to analyze the file.' %
          euclidean.getDurationString(time.time() - startTime))
예제 #33
0
파일: statistic.py 프로젝트: Sciumo/SFACT
	def getCraftedGcode(self, gcodeText, repository):
		"""Parse gcode text and store the statistics."""
		self.absolutePerimeterWidth = 0.4
		self.characters = 0
		self.cornerMaximum = Vector3(-987654321.0, -987654321.0, -987654321.0)
		self.cornerMinimum = Vector3(987654321.0, 987654321.0, 987654321.0)
		self.extruderActive = False
		self.extruderSpeed = None
		self.extruderToggled = 0
		self.feedRateMinute = 600.0
		self.extrusionHeight = 0.4
		self.numberOfLines = 0
		self.procedures = []
		self.repository = repository
		self.totalBuildTime = 0.0
		self.totalDistanceExtruded = 0.0
		self.totalDistanceTraveled = 0.0
		lines = archive.getTextLines(gcodeText)
		for line in lines:
			self.parseLine(line)
		averageFeedRate = self.totalDistanceTraveled / self.totalBuildTime
		self.characters += self.numberOfLines
		kilobytes = round( self.characters / 1024.0 )
		halfPerimeterWidth = 0.5 * self.absolutePerimeterWidth
		halfExtrusionCorner = Vector3( halfPerimeterWidth, halfPerimeterWidth, halfPerimeterWidth )
		self.cornerMaximum += halfExtrusionCorner
		self.cornerMinimum -= halfExtrusionCorner
		extent = self.cornerMaximum - self.cornerMinimum
		roundedHigh = euclidean.getRoundedPoint( self.cornerMaximum )
		roundedLow = euclidean.getRoundedPoint( self.cornerMinimum )
		roundedExtent = euclidean.getRoundedPoint( extent )
		axisString =  " axis extrusion starts at "
		crossSectionArea = 0.9 * self.absolutePerimeterWidth * self.extrusionHeight # 0.9 if from the typical fill density
		if self.extrusionDiameter is not None:
			crossSectionArea = math.pi / 4.0 * self.extrusionDiameter * self.extrusionDiameter
		volumeExtruded = 0.001 * crossSectionArea * self.totalDistanceExtruded
		mass = volumeExtruded / repository.density.value
		machineTimeCost = repository.machineTime.value * self.totalBuildTime / 3600.0
		materialCost = repository.material.value * mass
		self.addLine(' ')
		self.addLine('Cost')
		self.addLine( "Machine time cost is %s$." % round( machineTimeCost, 2 ) )
		self.addLine( "Material cost is %s$." % round( materialCost, 2 ) )
		self.addLine( "Total cost is %s$." % round( machineTimeCost + materialCost, 2 ) )
		self.addLine(' ')
		self.addLine('Extent')
		self.addLine( "X%s%s mm and ends at %s mm, for a width of %s mm." % ( axisString, int( roundedLow.x ), int( roundedHigh.x ), int( extent.x ) ) )
		self.addLine( "Y%s%s mm and ends at %s mm, for a depth of %s mm." % ( axisString, int( roundedLow.y ), int( roundedHigh.y ), int( extent.y ) ) )
		self.addLine( "Z%s%s mm and ends at %s mm, for a height of %s mm." % ( axisString, int( roundedLow.z ), int( roundedHigh.z ), int( extent.z ) ) )
		self.addLine(' ')
		self.addLine('Extruder')
		self.addLine( "Build time is %s." % euclidean.getDurationString( self.totalBuildTime ) )
		self.addLine( "Distance extruded is %s mm." % euclidean.getThreeSignificantFigures( self.totalDistanceExtruded ) )
		self.addLine( "Distance traveled is %s mm." % euclidean.getThreeSignificantFigures( self.totalDistanceTraveled ) )
		if self.extruderSpeed is not None:
			self.addLine( "Extruder speed is %s" % euclidean.getThreeSignificantFigures( self.extruderSpeed ) )
		self.addLine( "Extruder was extruding %s percent of the time." % euclidean.getThreeSignificantFigures( 100.0 * self.totalDistanceExtruded / self.totalDistanceTraveled ) )
		self.addLine( "Extruder was toggled %s times." % self.extruderToggled )
		if self.operatingFeedRatePerSecond is not None:
			flowRate = crossSectionArea * self.operatingFeedRatePerSecond
			self.addLine( "Operating flow rate is %s mm3/s." % euclidean.getThreeSignificantFigures( flowRate ) )
		self.addLine( "Feed rate average is %s mm/s, (%s mm/min)." % ( euclidean.getThreeSignificantFigures( averageFeedRate ), euclidean.getThreeSignificantFigures( 60.0 * averageFeedRate ) ) )
		self.addLine(' ')
		self.addLine('Filament')
		self.addLine( "Cross section area is %s mm2." % euclidean.getThreeSignificantFigures( crossSectionArea ) )
		if self.extrusionDiameter is not None:
			self.addLine( "Extrusion diameter is %s mm." % euclidean.getThreeSignificantFigures( self.extrusionDiameter ) )
		self.addLine('Extrusion fill density ratio is %s' % euclidean.getThreeSignificantFigures( crossSectionArea / self.absolutePerimeterWidth / self.extrusionHeight ) )
		self.addLine(' ')
		self.addLine('Material')
		self.addLine( "Mass extruded is %s grams." % euclidean.getThreeSignificantFigures( 1000.0 * mass ) )
		self.addLine( "Volume extruded is %s cc." % euclidean.getThreeSignificantFigures( volumeExtruded ) )
		self.addLine(' ')
		self.addLine('Meta')
		self.addLine( "Text has %s lines and a size of %s KB." % ( self.numberOfLines, kilobytes ) )
		if self.version is not None:
			self.addLine( "Version is "  + self.version )
		self.addLine(' ')
		self.addLine( "Procedures" )
		for procedure in self.procedures:
			self.addLine(procedure)
		if self.profileName is not None:
			self.addLine(' ')
			self.addLine( 'Profile' )
			self.addLine(self.profileName)
		self.addLine(' ')
		self.addLine('Slice')
		self.addLine( "Layer thickness is %s mm." % euclidean.getThreeSignificantFigures( self.extrusionHeight ) )
		self.addLine( "Perimeter width is %s mm." % euclidean.getThreeSignificantFigures( self.absolutePerimeterWidth ) )
		self.addLine(' ')
		return self.output.getvalue()
예제 #34
0
	def getCraftedGcode(self, gcodeText, repository):
		"Parse gcode text and store the statistics."
		self.absolutePerimeterWidth = 0.4
		self.characters = 0
		self.cornerMaximum = Vector3(-987654321.0, -987654321.0, -987654321.0)
		self.cornerMinimum = Vector3(987654321.0, 987654321.0, 987654321.0)
		self.extruderActive = False
		self.extruderSpeed = None
		self.extruderToggled = 0
		self.feedRateMinute = 600.0
		self.layerThickness = 0.4
		self.numberOfLines = 0
		self.procedures = []
		self.repository = repository
		self.totalBuildTime = 0.0
		self.totalDistanceExtruded = 0.0
		self.totalDistanceTraveled = 0.0
		self.numberOfLines = 1
		lines = archive.getTextLines(gcodeText)
		for line in lines:
			self.parseLine(line)
		averageFeedRate = self.totalDistanceTraveled / self.totalBuildTime
		self.characters += self.numberOfLines
		kilobytes = round( self.characters / 1024.0 )
		halfPerimeterWidth = 0.5 * self.absolutePerimeterWidth
		halfExtrusionCorner = Vector3( halfPerimeterWidth, halfPerimeterWidth, halfPerimeterWidth )
		self.cornerMaximum += halfExtrusionCorner
		self.cornerMinimum -= halfExtrusionCorner
		extent = self.cornerMaximum - self.cornerMinimum
		roundedHigh = euclidean.getRoundedPoint( self.cornerMaximum )
		roundedLow = euclidean.getRoundedPoint( self.cornerMinimum )
		roundedExtent = euclidean.getRoundedPoint( extent )
		axisString =  " axis extrusion starts at "
		crossSectionArea = 0.9 * self.absolutePerimeterWidth * self.layerThickness # 0.9 if from the typical fill density
		FilamentRadius = repository.FilamentDiameter.value /2
		filamentCrossSectionArea = (FilamentRadius * FilamentRadius)*math.pi
		extrusionXSection =(((self.layerThickness+self.perimeterWidth)/4)**2)*math.pi
		volumeExtruded = extrusionXSection * self.totalDistanceExtruded / 1000
		mass = (volumeExtruded /1000)* repository.density.value
		self.delay = (repository.realPrintTime.value - repository.calculatedPrintTime.value ) / repository.totalCommandsEntered.value
		buildQuadraticVolume = int( extent.x )*int( extent.y )*int( extent.z )
		
		self.estimatedBuildTime =  (self.totalDistanceTraveled / self.totalCommandcount / averageFeedRate +((averageFeedRate*0.75/ repository.accelerationRate.value) /2))*self.totalCommandcount/60  # self.delay * self.totalCommandcount + self.totalBuildTime
		machineTimeCost = repository.machineTime.value * self.estimatedBuildTime / 3600.0
		self.filamentInOutRatio = filamentCrossSectionArea / ((((self.layerThickness+self.perimeterWidth)/4)*((self.layerThickness+self.perimeterWidth)/4)*math.pi))
		self.totalDistanceFilament = self.totalDistanceExtruded
		averageFeedRate = self.totalDistanceTraveled / self.totalBuildTime
		averageFeedRateEst = self.totalDistanceTraveled / self.estimatedBuildTime
		materialCost = repository.material.value * mass /1000
		self.addLine(' ')
		self.addLine( "Procedures used (in sequence.." )
		for procedure in self.procedures:
			self.addLine(procedure)
		self.addLine(' ')
		self.addLine('Extent')
		self.addLine( "X%s%s mm and ends at %s mm, for a width of %s mm." % ( axisString, int( roundedLow.x ), int( roundedHigh.x ), int( extent.x ) ) )
		self.addLine( "Y%s%s mm and ends at %s mm, for a depth of %s mm." % ( axisString, int( roundedLow.y ), int( roundedHigh.y ), int( extent.y ) ) )
		self.addLine( "Z%s%s mm and ends at %s mm, for a height of %s mm." % ( axisString, int( roundedLow.z ), int( roundedHigh.z ), int( extent.z ) ) )
		self.addLine(' ')
		self.addLine('Statistics')
		self.addLine( "Distance traveled is %s m." % euclidean.getThreeSignificantFigures( self.totalDistanceTraveled/1000 ) )
		self.addLine( "Distance extruded is %s m." % euclidean.getThreeSignificantFigures( self.totalDistanceExtruded/1000 ) )
		if self.extruderSpeed != None:
			self.addLine( "Extruder speed is %s" % euclidean.getThreeSignificantFigures( self.extruderSpeed ) )
		self.addLine( "Extruder was extruding %s percent of the time." % euclidean.getThreeSignificantFigures( 100.0 * self.totalDistanceExtruded / self.totalDistanceTraveled ) )
		self.addLine( "Extruder was toggled %s times." % self.extruderToggled )
		self.addLine( "Feed rate average is %s mm/s, (%s mm/min)." % ( euclidean.getThreeSignificantFigures(averageFeedRateEst ), euclidean.getThreeSignificantFigures( 60.0 * averageFeedRateEst ) ) )
		self.addLine( "A Total of %s commands will be executed." %  self.totalCommandcount)
		self.addLine(' ')
		self.addLine('Time')
		self.addLine( "Calculated Build time is %s." % euclidean.getDurationString(self.totalBuildTime))
		self.addLine( "Corrected Build time is %s." % euclidean.getDurationString( self.estimatedBuildTime))
		self.addLine( "Delay  is %s seconds per command ." % self.delay )

		self.addLine(' ')
		self.addLine('Consumption')
		self.addLine( "Extrusion Cross section area is %s mm2." % euclidean.getThreeSignificantFigures( extrusionXSection))
		self.addLine( "Mass extruded is %s grams." % euclidean.getThreeSignificantFigures(  mass ) )
		self.addLine( "Volume extruded is %s cc." % euclidean.getThreeSignificantFigures( volumeExtruded) )
		self.addLine( "Filament used is %s m." % euclidean.getThreeSignificantFigures( self.totalDistanceFilament /100000 ))

		self.addLine(' ')
		self.addLine('Cost')
		self.addLine( "Machine time cost is %s$." % round( machineTimeCost, 2 ) )
		self.addLine( "Material cost is %s$." % round( materialCost, 2 ) )
		self.addLine( "Total cost is %s$." % round( machineTimeCost + materialCost, 2 ) )
		self.addLine(' ')
		if self.profileName != None:
			self.addLine(' ')
			self.addLine( 'Profile' )
			self.addLine(self.profileName)
		self.addLine(' ')
		self.addLine('Info')
		self.addLine( "Layer thickness is %s mm." % euclidean.getThreeSignificantFigures( self.layerThickness ) )
		self.addLine( "Perimeter width is %s mm." % euclidean.getThreeSignificantFigures( self.absolutePerimeterWidth ) )
		self.addLine( "Filament Cross section area is %s mm2." % euclidean.getThreeSignificantFigures( filamentCrossSectionArea ) )
		self.addLine('Filament In / Out ratio is %s' % euclidean.getThreeSignificantFigures (self.filamentInOutRatio))
		self.addLine( "Text has %s lines and a size of %s KB." % ( self.numberOfLines, kilobytes ) )
		self.addLine('')
		if self.profileName is not None:
			self.addLine(' ')
			self.addLine( "Profile used to Skein: " )
			self.addLine(self.profileName)
		self.addLine( ' ' )
		if self.version is not None:
			self.addLine( "You are using SFACT Version "  + self.version )
		self.addLine(' ')
		return self.output.getvalue()
예제 #35
0
def writeOutput(fileName, shouldAnalyze=True):
    'Export a gcode linear move file.'
    if fileName == '':
        return None
    repository = ExportRepository()
    settings.getReadRepository(repository)
    startTime = time.time()
    print('File ' + archive.getSummarizedFileName(fileName) +
          ' is being chain exported.')
    fileNameSuffix = fileName[:fileName.rfind('.')]
    if repository.addExportSuffix.value:
        fileNameSuffix += '_export'
    gcodeText = gcodec.getGcodeFileText(fileName, '')
    procedures = skeinforge_craft.getProcedures('export', gcodeText)
    gcodeText = skeinforge_craft.getChainTextFromProcedures(
        fileName, procedures[:-1], gcodeText)
    if gcodeText == '':
        return None
    if repository.addProfileExtension.value:
        fileNameSuffix += '.' + getFirstValue(gcodeText, '(<profileName>')
    if repository.addDescriptiveExtension.value:
        fileNameSuffix += getDescriptiveExtension(gcodeText)
    if repository.addTimestampExtension.value:
        fileNameSuffix += '.' + getFirstValue(gcodeText, '(<timeStampPreface>')
    fileNameSuffix += '.' + repository.fileExtension.value
    fileNamePenultimate = fileName[:fileName.rfind('.')] + '_penultimate.gcode'
    filePenultimateWritten = False
    if repository.savePenultimateGcode.value:
        archive.writeFileText(fileNamePenultimate, gcodeText)
        filePenultimateWritten = True
        print('The penultimate file is saved as ' +
              archive.getSummarizedFileName(fileNamePenultimate))
    exportGcode = getCraftedTextFromText(gcodeText, repository)
    window = None
    if shouldAnalyze and repository.analyzeGcode.value:
        window = skeinforge_analyze.writeOutput(fileName, fileNamePenultimate,
                                                fileNameSuffix,
                                                filePenultimateWritten,
                                                gcodeText)
    replaceableExportGcode = None
    selectedPluginModule = getSelectedPluginModule(repository.exportPlugins)
    if selectedPluginModule == None:
        replaceableExportGcode = exportGcode
    else:
        if selectedPluginModule.globalIsReplaceable:
            replaceableExportGcode = selectedPluginModule.getOutput(
                exportGcode)
        else:
            selectedPluginModule.writeOutput(fileNameSuffix, exportGcode)
    if replaceableExportGcode != None:
        replaceableExportGcode = getReplaceableExportGcode(
            repository.nameOfReplaceFile.value, replaceableExportGcode)
        archive.writeFileText(fileNameSuffix, replaceableExportGcode)
        print('The exported file is saved as ' +
              archive.getSummarizedFileName(fileNameSuffix))
    if repository.alsoSendOutputTo.value != '':
        if replaceableExportGcode == None:
            replaceableExportGcode = selectedPluginModule.getOutput(
                exportGcode)
        sendOutputTo(repository.alsoSendOutputTo.value, replaceableExportGcode)
    print('It took %s to export the file.' %
          euclidean.getDurationString(time.time() - startTime))
    return window
예제 #36
0
파일: export.py 프로젝트: Sciumo/SFACT
def writeOutput(fileName, shouldAnalyze=True):
    """Export a gcode linear move file."""

    if fileName == '':
        return None
    repository = ExportRepository()
    settings.getReadRepository(repository)
    startTime = time.time()
    print('File ' + archive.getSummarizedFileName(fileName) + ' is being chain exported.')
    fileNameSuffix = fileName[: fileName.rfind('.')]

    if repository.addExportSuffix.value:
        fileNameSuffix += '_export'

    if repository.profileFileExtension.value:
        profileName = skeinforge_profile.getProfileName(skeinforge_profile.getCraftTypeName())
        if profileName:
            fileNameSuffix += '.' + string.replace(profileName, ' ', '_')

    if repository.descriptiveExtension.value:
        fileNameSuffix += descriptiveExtension()

    if repository.timestampExtension.value:
        fileNameSuffix += '.'+strftime("%Y%m%d_%H%M%S")

    if repository.archiveProfile.value:
        profileName = skeinforge_profile.getProfileName(skeinforge_profile.getCraftTypeName())
        if profileName:
            profileZipFileName = fileNameSuffix + '.zip'
            zipper(archive.getProfilesPath(skeinforge_profile.getProfileDirectory()), profileName+'/', profileZipFileName)
            print('Profile archived to ' + profileZipFileName)

    if repository.exportProfileAsCsv.value:
        csvExportFilename = fileNameSuffix + '.csv'
        archive.writeFileText(csvExportFilename, Condenser().readSettings())

    fileNameSuffix += '.' + repository.fileExtension.value
    gcodeText = gcodec.getGcodeFileText(fileName, '')
    procedures = skeinforge_craft.getProcedures('export', gcodeText)
    gcodeText = skeinforge_craft.getChainTextFromProcedures(fileName, procedures[ : - 1 ], gcodeText)
    if gcodeText == '':
        return None
    fileNamePenultimate = fileName[: fileName.rfind('.')] + '_penultimate.gcode'
    filePenultimateWritten = False
    if repository.savePenultimateGcode.value:
        archive.writeFileText(fileNamePenultimate, gcodeText)
        filePenultimateWritten = True
        print('The penultimate file is saved as ' + archive.getSummarizedFileName(fileNamePenultimate))
    exportGcode = getCraftedTextFromText(gcodeText, repository)
    window = None
    if shouldAnalyze:
        window = skeinforge_analyze.writeOutput(fileName, fileNamePenultimate, fileNameSuffix,
            filePenultimateWritten, gcodeText)
    replaceableExportGcode = None
    selectedPluginModule = getSelectedPluginModule(repository.exportPlugins)
    if selectedPluginModule is None:
        replaceableExportGcode = exportGcode
    else:
        if selectedPluginModule.globalIsReplaceable:
            replaceableExportGcode = selectedPluginModule.getOutput(exportGcode)
        else:
            selectedPluginModule.writeOutput(fileNameSuffix, exportGcode)
    if replaceableExportGcode is not None:
        replaceableExportGcode = getReplaceableExportGcode(repository.nameOfReplaceFile.value, replaceableExportGcode)
        archive.writeFileText( fileNameSuffix, replaceableExportGcode )
        print('The exported file is saved as ' + archive.getSummarizedFileName(fileNameSuffix))
    if repository.alsoSendOutputTo.value != '':
        if replaceableExportGcode is None:
            replaceableExportGcode = selectedPluginModule.getOutput(exportGcode)
        sendOutputTo(replaceableExportGcode, repository.alsoSendOutputTo.value)
    print('It took %s to export the file.' % euclidean.getDurationString(time.time() - startTime))

    return window
예제 #37
0
def writeOutput(fileName, shouldAnalyze=True):
    'Export a gcode linear move file.'

    if fileName == '':
        return None
    repository = ExportRepository()
    settings.getReadRepository(repository)
    startTime = time.time()
    print('File ' + archive.getSummarizedFileName(fileName) +
          ' is being chain exported.')
    fileNameSuffix = fileName[:fileName.rfind('.')]

    if repository.addExportSuffix.value:
        fileNameSuffix += '_export'

    if (repository.profileFileExtension.value == True):
        profileName = skeinforge_profile.getProfileName(
            skeinforge_profile.getCraftTypeName())
        if profileName:
            fileNameSuffix += '.' + string.replace(profileName, ' ', '_')

    if (repository.descriptiveExtension.value == True):
        fileNameSuffix += descriptiveExtension()

    if (repository.timestampExtension.value == True):
        fileNameSuffix += '.' + strftime("%Y%m%d_%H%M%S")

    if (repository.archiveProfile.value == True):
        profileName = skeinforge_profile.getProfileName(
            skeinforge_profile.getCraftTypeName())
        if profileName:
            profileZipFileName = fileNameSuffix + '.zip'
            zipper(
                archive.getProfilesPath(
                    skeinforge_profile.getProfileDirectory()),
                profileName + '/', profileZipFileName)
            print('Profile archived to ' + profileZipFileName)

    if (repository.exportProfileAsCsv.value == True):
        csvExportFilename = fileNameSuffix + '.csv'
        archive.writeFileText(csvExportFilename, Condenser().readSettings())

    fileNameSuffix += '.' + repository.fileExtension.value
    gcodeText = gcodec.getGcodeFileText(fileName, '')
    procedures = skeinforge_craft.getProcedures('export', gcodeText)
    gcodeText = skeinforge_craft.getChainTextFromProcedures(
        fileName, procedures[:-1], gcodeText)
    if gcodeText == '':
        return None
    if repository.savePenultimateGcode.value:
        penultimateFileName = fileName[:fileName.
                                       rfind('.')] + '_penultimate.gcode'
        archive.writeFileText(penultimateFileName, gcodeText)
        print('The penultimate file is saved as ' +
              archive.getSummarizedFileName(penultimateFileName))
    exportGcode = getCraftedTextFromText(gcodeText, repository)
    window = None
    if shouldAnalyze:
        window = skeinforge_analyze.writeOutput(fileName, fileNameSuffix,
                                                gcodeText)
    replaceableExportGcode = None
    selectedPluginModule = getSelectedPluginModule(repository.exportPlugins)
    if selectedPluginModule == None:
        replaceableExportGcode = exportGcode
    else:
        if selectedPluginModule.globalIsReplaceable:
            replaceableExportGcode = selectedPluginModule.getOutput(
                exportGcode)
        else:
            selectedPluginModule.writeOutput(fileNameSuffix, exportGcode)
    if replaceableExportGcode != None:
        replaceableExportGcode = getReplaceableExportGcode(
            repository.nameOfReplaceFile.value, replaceableExportGcode)
        archive.writeFileText(fileNameSuffix, replaceableExportGcode)
        print('The exported file is saved as ' +
              archive.getSummarizedFileName(fileNameSuffix))
    if repository.alsoSendOutputTo.value != '':
        if replaceableExportGcode == None:
            replaceableExportGcode = selectedPluginModule.getOutput(
                exportGcode)
        sendOutputTo(replaceableExportGcode, repository.alsoSendOutputTo.value)
    print('It took %s to export the file.' %
          euclidean.getDurationString(time.time() - startTime))

    return window
예제 #38
0
 def getCraftedGcode(self, gcodeText, repository):
     "Parse gcode text and store the statistics."
     self.absoluteEdgeWidth = 0.4
     self.characters = 0
     self.cornerMaximum = Vector3(-987654321.0, -987654321.0, -987654321.0)
     self.cornerMinimum = Vector3(987654321.0, 987654321.0, 987654321.0)
     self.extruderActive = False
     self.extruderSpeed = None
     self.extruderToggled = 0
     self.feedRateMinute = 600.0
     self.layerHeight = 0.4
     self.numberOfLines = 0
     self.procedures = []
     self.repository = repository
     self.totalBuildTime = 0.0
     self.totalDistanceExtruded = 0.0
     self.totalDistanceTraveled = 0.0
     lines = archive.getTextLines(gcodeText)
     for line in lines:
         self.parseLine(line)
     averageFeedRate = self.totalDistanceTraveled / self.totalBuildTime
     self.characters += self.numberOfLines
     kilobytes = round(self.characters / 1024.0)
     halfEdgeWidth = 0.5 * self.absoluteEdgeWidth
     halfExtrusionCorner = Vector3(halfEdgeWidth, halfEdgeWidth,
                                   halfEdgeWidth)
     self.cornerMaximum += halfExtrusionCorner
     self.cornerMinimum -= halfExtrusionCorner
     extent = self.cornerMaximum - self.cornerMinimum
     roundedHigh = euclidean.getRoundedPoint(self.cornerMaximum)
     roundedLow = euclidean.getRoundedPoint(self.cornerMinimum)
     roundedExtent = euclidean.getRoundedPoint(extent)
     axisString = " axis extrusion starts at "
     crossSectionArea = self.absoluteEdgeWidth * self.layerHeight
     if self.volumeFraction != None:
         crossSectionArea *= self.volumeFraction
     self.extrusionDiameter = math.sqrt(4.0 * crossSectionArea / math.pi)
     volumeExtruded = 0.001 * crossSectionArea * self.totalDistanceExtruded
     mass = volumeExtruded / repository.density.value
     machineTimeCost = repository.machineTime.value * self.totalBuildTime / 3600.0
     materialCost = repository.material.value * mass
     self.addLine(' ')
     self.addLine('Cost')
     self.addLine("Machine time cost is %s$." % round(machineTimeCost, 2))
     self.addLine("Material cost is %s$." % round(materialCost, 2))
     self.addLine("Total cost is %s$." %
                  round(machineTimeCost + materialCost, 2))
     self.addLine(' ')
     self.addLine('Extent')
     self.addLine(
         "X%s%s mm and ends at %s mm, for a width of %s mm." %
         (axisString, int(roundedLow.x), int(roundedHigh.x), int(extent.x)))
     self.addLine(
         "Y%s%s mm and ends at %s mm, for a depth of %s mm." %
         (axisString, int(roundedLow.y), int(roundedHigh.y), int(extent.y)))
     self.addLine(
         "Z%s%s mm and ends at %s mm, for a height of %s mm." %
         (axisString, int(roundedLow.z), int(roundedHigh.z), int(extent.z)))
     self.addLine(' ')
     self.addLine('Extruder')
     self.addLine("Build time is %s." %
                  euclidean.getDurationString(self.totalBuildTime))
     self.addLine(
         "Distance extruded is %s mm." %
         euclidean.getThreeSignificantFigures(self.totalDistanceExtruded))
     self.addLine(
         "Distance traveled is %s mm." %
         euclidean.getThreeSignificantFigures(self.totalDistanceTraveled))
     if self.extruderSpeed != None:
         self.addLine(
             "Extruder speed is %s" %
             euclidean.getThreeSignificantFigures(self.extruderSpeed))
     self.addLine("Extruder was extruding %s percent of the time." %
                  euclidean.getThreeSignificantFigures(
                      100.0 * self.totalDistanceExtruded /
                      self.totalDistanceTraveled))
     self.addLine("Extruder was toggled %s times." % self.extruderToggled)
     if self.operatingFeedRatePerSecond != None:
         flowRate = crossSectionArea * self.operatingFeedRatePerSecond
         self.addLine("Operating flow rate is %s mm3/s." %
                      euclidean.getThreeSignificantFigures(flowRate))
     self.addLine(
         "Feed rate average is %s mm/s, (%s mm/min)." %
         (euclidean.getThreeSignificantFigures(averageFeedRate),
          euclidean.getThreeSignificantFigures(60.0 * averageFeedRate)))
     self.addLine(' ')
     self.addLine('Filament')
     self.addLine("Cross section area is %s mm2." %
                  euclidean.getThreeSignificantFigures(crossSectionArea))
     self.addLine(
         'Extrusion diameter is %s mm.' %
         euclidean.getThreeSignificantFigures(self.extrusionDiameter))
     if self.volumeFraction != None:
         self.addLine(
             'Volume fraction is %s.' %
             euclidean.getThreeSignificantFigures(self.volumeFraction))
     self.addLine(' ')
     self.addLine('Material')
     self.addLine("Mass extruded is %s grams." %
                  euclidean.getThreeSignificantFigures(1000.0 * mass))
     self.addLine("Volume extruded is %s cc." %
                  euclidean.getThreeSignificantFigures(volumeExtruded))
     self.addLine(' ')
     self.addLine('Meta')
     self.addLine("Text has %s lines and a size of %s KB." %
                  (self.numberOfLines, kilobytes))
     if self.version != None:
         self.addLine("Version is " + self.version)
     self.addLine(' ')
     self.addLine("Procedures")
     for procedure in self.procedures:
         self.addLine(procedure)
     if self.profileName != None:
         self.addLine(' ')
         self.addLine('Profile')
         self.addLine(self.profileName)
     self.addLine(' ')
     self.addLine('Slice')
     self.addLine(
         "Edge width is %s mm." %
         euclidean.getThreeSignificantFigures(self.absoluteEdgeWidth))
     self.addLine("Layer height is %s mm." %
                  euclidean.getThreeSignificantFigures(self.layerHeight))
     self.addLine(' ')
     return self.output.getvalue()
예제 #39
0
    def getCraftedGcode(self, gcodeText, repository):
        "Parse gcode text and store the statistics."
        self.absolutePerimeterWidth = 0.4
        self.characters = 0
        self.cornerMaximum = Vector3(-987654321.0, -987654321.0, -987654321.0)
        self.cornerMinimum = Vector3(987654321.0, 987654321.0, 987654321.0)
        self.extruderActive = False
        self.extruderSpeed = None
        self.extruderToggled = 0
        self.feedRateMinute = 600.0
        self.layerThickness = 0.4
        self.numberOfLines = 0
        self.procedures = []
        self.repository = repository
        self.totalBuildTime = 0.0
        self.totalDistanceExtruded = 0.0
        self.totalDistanceTraveled = 0.0
        self.numberOfLines = 1
        lines = archive.getTextLines(gcodeText)
        for line in lines:
            self.parseLine(line)
        averageFeedRate = self.totalDistanceTraveled / self.totalBuildTime
        self.characters += self.numberOfLines
        kilobytes = round(self.characters / 1024.0)
        halfPerimeterWidth = 0.5 * self.absolutePerimeterWidth
        halfExtrusionCorner = Vector3(halfPerimeterWidth, halfPerimeterWidth,
                                      halfPerimeterWidth)
        self.cornerMaximum += halfExtrusionCorner
        self.cornerMinimum -= halfExtrusionCorner
        extent = self.cornerMaximum - self.cornerMinimum
        roundedHigh = euclidean.getRoundedPoint(self.cornerMaximum)
        roundedLow = euclidean.getRoundedPoint(self.cornerMinimum)
        roundedExtent = euclidean.getRoundedPoint(extent)
        axisString = " axis extrusion starts at "
        crossSectionArea = 0.9 * self.absolutePerimeterWidth * self.layerThickness  # 0.9 if from the typical fill density
        FilamentRadius = repository.FilamentDiameter.value / 2
        filamentCrossSectionArea = (FilamentRadius * FilamentRadius) * math.pi
        extrusionXSection = ((
            (self.layerThickness + self.perimeterWidth) / 4)**2) * math.pi
        volumeExtruded = extrusionXSection * self.totalDistanceExtruded / 1000
        mass = (volumeExtruded / 1000) * repository.density.value
        self.delay = (repository.realPrintTime.value -
                      repository.calculatedPrintTime.value
                      ) / repository.totalCommandsEntered.value
        buildQuadraticVolume = int(extent.x) * int(extent.y) * int(extent.z)

        self.estimatedBuildTime = (
            self.totalDistanceTraveled / self.totalCommandcount /
            averageFeedRate +
            ((averageFeedRate * 0.75 / repository.accelerationRate.value) / 2)
        ) * self.totalCommandcount / 60  # self.delay * self.totalCommandcount + self.totalBuildTime
        machineTimeCost = repository.machineTime.value * self.estimatedBuildTime / 3600.0
        self.filamentInOutRatio = filamentCrossSectionArea / (
            (((self.layerThickness + self.perimeterWidth) / 4) *
             ((self.layerThickness + self.perimeterWidth) / 4) * math.pi))
        self.totalDistanceFilament = self.totalDistanceExtruded
        averageFeedRate = self.totalDistanceTraveled / self.totalBuildTime
        averageFeedRateEst = self.totalDistanceTraveled / self.estimatedBuildTime
        materialCost = repository.material.value * mass / 1000
        self.addLine(' ')
        self.addLine("Procedures used (in sequence..")
        for procedure in self.procedures:
            self.addLine(procedure)
        self.addLine(' ')
        self.addLine('Extent')
        self.addLine(
            "X%s%s mm and ends at %s mm, for a width of %s mm." %
            (axisString, int(roundedLow.x), int(roundedHigh.x), int(extent.x)))
        self.addLine(
            "Y%s%s mm and ends at %s mm, for a depth of %s mm." %
            (axisString, int(roundedLow.y), int(roundedHigh.y), int(extent.y)))
        self.addLine(
            "Z%s%s mm and ends at %s mm, for a height of %s mm." %
            (axisString, int(roundedLow.z), int(roundedHigh.z), int(extent.z)))
        self.addLine(' ')
        self.addLine('Statistics')
        self.addLine("Distance traveled is %s m." %
                     euclidean.getThreeSignificantFigures(
                         self.totalDistanceTraveled / 1000))
        self.addLine("Distance extruded is %s m." %
                     euclidean.getThreeSignificantFigures(
                         self.totalDistanceExtruded / 1000))
        if self.extruderSpeed != None:
            self.addLine(
                "Extruder speed is %s" %
                euclidean.getThreeSignificantFigures(self.extruderSpeed))
        self.addLine("Extruder was extruding %s percent of the time." %
                     euclidean.getThreeSignificantFigures(
                         100.0 * self.totalDistanceExtruded /
                         self.totalDistanceTraveled))
        self.addLine("Extruder was toggled %s times." % self.extruderToggled)
        self.addLine(
            "Feed rate average is %s mm/s, (%s mm/min)." %
            (euclidean.getThreeSignificantFigures(averageFeedRateEst),
             euclidean.getThreeSignificantFigures(60.0 * averageFeedRateEst)))
        self.addLine("A Total of %s commands will be executed." %
                     self.totalCommandcount)
        self.addLine(' ')
        self.addLine('Time')
        self.addLine("Calculated Build time is %s." %
                     euclidean.getDurationString(self.totalBuildTime))
        self.addLine("Corrected Build time is %s." %
                     euclidean.getDurationString(self.estimatedBuildTime))
        self.addLine("Delay  is %s seconds per command ." % self.delay)

        self.addLine(' ')
        self.addLine('Consumption')
        self.addLine("Extrusion Cross section area is %s mm2." %
                     euclidean.getThreeSignificantFigures(extrusionXSection))
        self.addLine("Mass extruded is %s grams." %
                     euclidean.getThreeSignificantFigures(mass))
        self.addLine("Volume extruded is %s cc." %
                     euclidean.getThreeSignificantFigures(volumeExtruded))
        self.addLine("Filament used is %s m." %
                     euclidean.getThreeSignificantFigures(
                         self.totalDistanceFilament / 100000))

        self.addLine(' ')
        self.addLine('Cost')
        self.addLine("Machine time cost is %s$." % round(machineTimeCost, 2))
        self.addLine("Material cost is %s$." % round(materialCost, 2))
        self.addLine("Total cost is %s$." %
                     round(machineTimeCost + materialCost, 2))
        self.addLine(' ')
        if self.profileName != None:
            self.addLine(' ')
            self.addLine('Profile')
            self.addLine(self.profileName)
        self.addLine(' ')
        self.addLine('Info')
        self.addLine("Layer thickness is %s mm." %
                     euclidean.getThreeSignificantFigures(self.layerThickness))
        self.addLine(
            "Perimeter width is %s mm." %
            euclidean.getThreeSignificantFigures(self.absolutePerimeterWidth))
        self.addLine(
            "Filament Cross section area is %s mm2." %
            euclidean.getThreeSignificantFigures(filamentCrossSectionArea))
        self.addLine(
            'Filament In / Out ratio is %s' %
            euclidean.getThreeSignificantFigures(self.filamentInOutRatio))
        self.addLine("Text has %s lines and a size of %s KB." %
                     (self.numberOfLines, kilobytes))
        self.addLine('')
        if self.profileName is not None:
            self.addLine(' ')
            self.addLine("Profile used to Skein: ")
            self.addLine(self.profileName)
        self.addLine(' ')
        if self.version is not None:
            self.addLine("You are using SFACT Version " + self.version)
        self.addLine(' ')
        return self.output.getvalue()