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
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
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' 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
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
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
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
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
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
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