Ejemplo n.º 1
0
	def addInitializationToOutput(self):
		"Add initialization gcode to the output."
		self.addFromUpperLowerFile(self.repository.nameOfStartFile.value) # Add a start file if it exists.
		self.distanceFeedRate.addTagBracketedLine('creation', 'skeinforge') # GCode formatted comment
		absoluteFilePathUntilDot = os.path.abspath(__file__)[: os.path.abspath(__file__).rfind('.')]
		if absoluteFilePathUntilDot == '/home/enrique/Desktop/backup/babbleold/script/reprap/fabmetheus/skeinforge_application/skeinforge_plugins/craft_plugins/preface': #is this script on Enrique's computer?
			archive.writeFileText(archive.getVersionFileName(), date.today().isoformat().replace('-', '.')[2 :])
		versionText = archive.getFileText(archive.getVersionFileName())
		self.distanceFeedRate.addTagBracketedLine('version', versionText) # GCode formatted comment
		self.distanceFeedRate.addLine('(<extruderInitialization>)') # GCode formatted comment
		if self.repository.setPositioningToAbsolute.value:
			self.distanceFeedRate.addLine('G90 ;set positioning to absolute') # Set positioning to absolute.
		if self.repository.setUnitsToMillimeters.value:
			self.distanceFeedRate.addLine('G21 ;set units to millimeters') # Set units to millimeters.
		if self.repository.startAtHome.value:
			self.distanceFeedRate.addLine('G28 ;start at home') # Start at home.
		if self.repository.turnExtruderOffAtStartUp.value:
			self.distanceFeedRate.addLine('M103') # Turn extruder off.
		craftTypeName = skeinforge_profile.getCraftTypeName()
		self.distanceFeedRate.addTagBracketedLine('craftTypeName', craftTypeName)
		self.distanceFeedRate.addTagBracketedLine('decimalPlacesCarried', self.distanceFeedRate.decimalPlacesCarried)
		layerThickness = float(self.svgReader.sliceDictionary['layerThickness'])
		self.distanceFeedRate.addTagRoundedLine('layerThickness', layerThickness)
		if self.repository.meta.value:
			self.distanceFeedRate.addTagBracketedLine('meta', self.repository.meta.value)
		perimeterWidth = float(self.svgReader.sliceDictionary['perimeterWidth'])
		self.distanceFeedRate.addTagRoundedLine('perimeterWidth', perimeterWidth)
		self.distanceFeedRate.addTagBracketedLine('profileName', skeinforge_profile.getProfileName(craftTypeName))
		procedureNames = self.svgReader.sliceDictionary['procedureName'].replace(',', ' ').split()
		for procedureName in procedureNames:
			self.distanceFeedRate.addTagBracketedLine('procedureName', procedureName)
		self.distanceFeedRate.addTagBracketedLine('procedureName', 'preface')
		self.distanceFeedRate.addLine('(</extruderInitialization>)') # Initialization is finished, extrusion is starting.
		self.distanceFeedRate.addLine('(<crafting>)') # Initialization is finished, crafting is starting.
Ejemplo n.º 2
0
	def addInitializationToOutput( self ):
		"Add initialization gcode to the output."
		self.addFromUpperLowerFile( self.prefaceRepository.nameOfStartFile.value ) # Add a start file if it exists.
		self.distanceFeedRate.addTagBracketedLine( 'creation', 'skeinforge' ) # GCode formatted comment
		absoluteFilePathUntilDot = os.path.abspath( __file__ )[ : os.path.abspath( __file__ ).rfind( '.' ) ]
		if absoluteFilePathUntilDot == '/home/enrique/Desktop/backup/babbleold/script/reprap/fabmetheus/skeinforge_application/skeinforge_plugins/craft_plugins/preface': #is this script on Enrique's computer?
			gcodec.writeFileText( gcodec.getVersionFileName(), date.today().isoformat() )
		versionText = gcodec.getFileText( gcodec.getVersionFileName() )
		self.distanceFeedRate.addTagBracketedLine( 'version', versionText ) # GCode formatted comment
		self.distanceFeedRate.addLine( '(<extruderInitialization>)' ) # GCode formatted comment
		if self.prefaceRepository.setPositioningToAbsolute.value:
			self.distanceFeedRate.addLine( 'G90' ) # Set positioning to absolute.
		if self.prefaceRepository.setUnitsToMillimeters.value:
			self.distanceFeedRate.addLine( 'G21' ) # Set units to millimeters.
		if self.prefaceRepository.startAtHome.value:
			self.distanceFeedRate.addLine( 'G28' ) # Start at home.
		if self.prefaceRepository.turnExtruderOffAtStartUp.value:
			self.distanceFeedRate.addLine( 'M103' ) # Turn extruder off.
		craftTypeName = skeinforge_profile.getCraftTypeName()
		self.distanceFeedRate.addTagBracketedLine( 'craftTypeName', craftTypeName )
		self.distanceFeedRate.addTagBracketedLine( 'decimalPlacesCarried', self.distanceFeedRate.decimalPlacesCarried )
		self.distanceFeedRate.addTagBracketedLine( 'layerThickness', self.distanceFeedRate.getRounded( self.layerThickness ) )
		if self.prefaceRepository.meta.value:
			self.distanceFeedRate.addTagBracketedLine( 'meta', self.prefaceRepository.meta.value )
		self.distanceFeedRate.addTagBracketedLine( 'perimeterWidth', self.distanceFeedRate.getRounded( self.perimeterWidth ) )
		self.distanceFeedRate.addTagBracketedLine( 'profileName', skeinforge_profile.getProfileName( craftTypeName ) )
		self.distanceFeedRate.addTagBracketedLine( 'procedureDone', 'carve' )
		self.distanceFeedRate.addTagBracketedLine( 'procedureDone', 'preface' )
		self.distanceFeedRate.addLine( '(</extruderInitialization>)' ) # Initialization is finished, extrusion is starting.
		self.distanceFeedRate.addLine( '(<extrusion>)' ) # Initialization is finished, extrusion is starting.
Ejemplo n.º 3
0
	def addInitializationToOutput(self):
		"""Add initialization gcode to the output."""
		self.addFromUpperLowerFile(self.repository.nameOfStartFile.value) # Add a start file if it exists.
		self.distanceFeedRate.addTagBracketedLine('creation', 'skeinforge') # GCode formatted comment
		absoluteFilePathUntilDot = os.path.abspath(__file__)[: os.path.abspath(__file__).rfind('.')]
		if absoluteFilePathUntilDot == '/home/enrique/Desktop/backup/babbleold/script/reprap/fabmetheus/skeinforge_application/skeinforge_plugins/craft_plugins/preface': #is this script on Enrique's computer?
			archive.writeFileText(archive.getVersionFileName(), date.today().isoformat().replace('-', '.')[2 :])
		versionText = archive.getFileText(archive.getVersionFileName())
		self.distanceFeedRate.addTagBracketedLine('version', versionText) # GCode formatted comment
		self.distanceFeedRate.addLine('(<extruderInitialization>)') # GCode formatted comment
		if self.repository.setPositioningToAbsolute.value:
			self.distanceFeedRate.addLine('G90 ;set positioning to absolute') # Set positioning to absolute.
		if self.repository.setUnitsToMillimeters.value:
			self.distanceFeedRate.addLine('G21 ;set units to millimeters') # Set units to millimeters.
		if self.repository.startAtHome.value:
			self.distanceFeedRate.addLine('G28 ;start at home') # Start at home.
		if self.repository.resetExtruder.value:
			self.distanceFeedRate.addLine('G92 E0 ;reset extruder distance') # Start at home.
		craftTypeName = skeinforge_profile.getCraftTypeName()
		self.distanceFeedRate.addTagBracketedLine('craftTypeName', craftTypeName)
		self.distanceFeedRate.addTagBracketedLine('decimalPlacesCarried', self.distanceFeedRate.decimalPlacesCarried)
		extrusionHeight = float(self.svgReader.sliceDictionary['extrusionHeight'])
		self.distanceFeedRate.addTagRoundedLine('extrusionHeight', extrusionHeight)
		if self.repository.meta.value:
			self.distanceFeedRate.addTagBracketedLine('meta', self.repository.meta.value)
		extrusionWidth = float(self.svgReader.sliceDictionary['extrusionWidth'])
		self.distanceFeedRate.addTagRoundedLine('extrusionWidth', extrusionWidth)
		self.distanceFeedRate.addTagBracketedLine('profileName', skeinforge_profile.getProfileName(craftTypeName))
		procedureNames = self.svgReader.sliceDictionary['procedureName'].replace(',', ' ').split()
		for procedureName in procedureNames:
			self.distanceFeedRate.addTagBracketedLine('procedureName', procedureName)
		self.distanceFeedRate.addTagBracketedLine('procedureName', 'preface')
		self.distanceFeedRate.addLine('(</extruderInitialization>)') # Initialization is finished, extrusion is starting.
		self.distanceFeedRate.addLine('(<crafting>)') # Initialization is finished, crafting is starting.
Ejemplo n.º 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, "")

    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
Ejemplo n.º 5
0
	def addInitializationToOutput(self):
		"Add initialization gcode to the output."
		self.addFromUpperLowerFile(self.repository.nameOfStartFile.value) # Add a start file if it exists.
		self.distanceFeedRate.addTagBracketedLine('creation', 'skeinforge') # GCode formatted comment
#		absoluteFilePathUntilDot = os.path.abspath(__file__)[: os.path.abspath(__file__).rfind('.')]
#		if absoluteFilePathUntilDot == '/home/enrique/Desktop/backup/babbleold/script/reprap/fabmetheus/skeinforge_application/skeinforge_plugins/craft_plugins/preface': #is this script on Enrique's computer?
#			archive.writeFileText(archive.getVersionFileName(), date.today().isoformat().replace('-', '.')[2 :])
		versionText = archive.getFileText(archive.getVersionFileName())
		self.distanceFeedRate.addTagBracketedLine('version', versionText) # GCode formatted comment
		self.distanceFeedRate.addLine('(<extruderInitialization>)') # GCode formatted comment
		if self.repository.setPositioningToAbsolute.value:
			self.distanceFeedRate.addLine('G90 ;set positioning to absolute') # Set positioning to absolute.
		if self.repository.setUnitsToMillimeters.value:
			self.distanceFeedRate.addLine('G21 ;set units to millimeters') # Set units to millimeters.
		if self.repository.startAtHome.value:
			self.distanceFeedRate.addLine('G28 ;start at home') # Start at home.
		if self.repository.resetExtruder.value:
			self.distanceFeedRate.addLine('G92 E0 ;reset extruder distance') # Start at home.
#		if self.repository.turnExtruderOffAtStartUp.value:
#			self.distanceFeedRate.addLine('M103') # Turn extruder off.
		craftTypeName = skeinforge_profile.getCraftTypeName()
		self.distanceFeedRate.addTagBracketedLine('craftTypeName', craftTypeName)
		self.distanceFeedRate.addTagBracketedLine('decimalPlacesCarried', self.distanceFeedRate.decimalPlacesCarried)
		layerThickness = float(self.svgReader.sliceDictionary['layerThickness'])
		self.distanceFeedRate.addTagRoundedLine('layerThickness', layerThickness)
		if self.repository.meta.value:
			self.distanceFeedRate.addTagBracketedLine('meta', self.repository.meta.value)
		if self.repository.extraLineOne.value:
			self.distanceFeedRate.addLine( self.repository.extraLineOne.value)
		if self.repository.extraLineTwo.value:
			self.distanceFeedRate.addLine( self.repository.extraLineTwo.value)
		if self.repository.extraLineThree.value:
			self.distanceFeedRate.addLine( self.repository.extraLineThree.value)
		if self.repository.extraLineFour.value:
			self.distanceFeedRate.addLine( self.repository.extraLineFour.value)
		if self.repository.extraLineFive.value:
			self.distanceFeedRate.addLine( self.repository.extraLineFive.value)
		perimeterWidth = float(self.svgReader.sliceDictionary['perimeterWidth'])
		self.distanceFeedRate.addTagRoundedLine('perimeterWidth', perimeterWidth)
		self.distanceFeedRate.addTagBracketedLine('profileName', skeinforge_profile.getProfileName(craftTypeName))
		self.distanceFeedRate.addLine('(<settings>)')
		pluginFileNames = skeinforge_craft.getPluginFileNames()
		for pluginFileName in pluginFileNames:
			self.addToolSettingLines(pluginFileName)
		self.distanceFeedRate.addLine('(</settings>)')
		self.distanceFeedRate.addTagBracketedLine('timeStampPreface', strftime('%Y%m%d_%H%M%S'))
		procedureNames = self.svgReader.sliceDictionary['procedureName'].replace(',', ' ').split()
		for procedureName in procedureNames:
			self.distanceFeedRate.addTagBracketedLine('procedureName', procedureName)
		self.distanceFeedRate.addTagBracketedLine('procedureName', 'preface')
		self.distanceFeedRate.addLine('(</extruderInitialization>)') # Initialization is finished, extrusion is starting.
		self.distanceFeedRate.addLine('(<crafting>)') # Initialization is finished, crafting is starting.
Ejemplo n.º 6
0
 def addInitializationToOutput(self):
     "Add initialization gcode to the output."
     self.distanceFeedRate.addTagBracketedLine("format", "skeinforge gcode")
     absoluteFilePathUntilDot = archive.getUntilDot(archive.getCraftPluginsDirectoryPath("preface.py"))
     dateTodayString = date.today().isoformat().replace("-", ".")[2:]
     if (
         absoluteFilePathUntilDot
         == "/home/enrique/Desktop/backup/babbleold/script/reprap/fabmetheus/skeinforge_application/skeinforge_plugins/craft_plugins/preface"
     ):  # is this script on Enrique's computer?
         archive.writeFileText(archive.getVersionFileName(), dateTodayString)
     versionText = archive.getFileText(archive.getVersionFileName())
     self.distanceFeedRate.addTagBracketedLine("version", versionText)
     dateTimeTuple = datetime.now().timetuple()
     created = dateTodayString + "|%s:%s" % (dateTimeTuple[3], dateTimeTuple[4])
     self.distanceFeedRate.addTagBracketedLine("created", created)
     self.distanceFeedRate.addLine("(<extruderInitialization>)")
     if self.repository.setPositioningToAbsolute.value:
         self.distanceFeedRate.addLine("G90 ;set positioning to absolute")  # Set positioning to absolute.
     if self.repository.setUnitsToMillimeters.value:
         self.distanceFeedRate.addLine("G21 ;set units to millimeters")  # Set units to millimeters.
     if self.repository.startAtHome.value:
         self.distanceFeedRate.addLine("G28 ;start at home")  # Start at home.
     if self.repository.turnExtruderOffAtStartUp.value:
         self.distanceFeedRate.addLine("M103")  # Turn extruder off.
     craftTypeName = skeinforge_profile.getCraftTypeName()
     self.distanceFeedRate.addTagBracketedLine("craftTypeName", craftTypeName)
     self.distanceFeedRate.addTagBracketedLine("decimalPlacesCarried", self.distanceFeedRate.decimalPlacesCarried)
     layerHeight = float(self.svgReader.sliceDictionary["layerHeight"])
     self.distanceFeedRate.addTagRoundedLine("layerThickness", layerHeight)
     self.distanceFeedRate.addTagRoundedLine("layerHeight", layerHeight)
     if self.repository.meta.value:
         self.distanceFeedRate.addTagBracketedLine("meta", self.repository.meta.value)
     edgeWidth = float(self.svgReader.sliceDictionary["edgeWidth"])
     self.distanceFeedRate.addTagRoundedLine("edgeWidth", edgeWidth)
     self.distanceFeedRate.addTagRoundedLine("perimeterWidth", edgeWidth)
     self.distanceFeedRate.addTagBracketedLine("profileName", skeinforge_profile.getProfileName(craftTypeName))
     self.distanceFeedRate.addLine("(<settings>)")
     pluginFileNames = skeinforge_craft.getPluginFileNames()
     for pluginFileName in pluginFileNames:
         self.addToolSettingLines(pluginFileName)
     self.distanceFeedRate.addLine("(</settings>)")
     self.distanceFeedRate.addTagBracketedLine("timeStampPreface", strftime("%Y%m%d_%H%M%S"))
     procedureNames = self.svgReader.sliceDictionary["procedureName"].replace(",", " ").split()
     for procedureName in procedureNames:
         self.distanceFeedRate.addTagBracketedProcedure(procedureName)
     self.distanceFeedRate.addTagBracketedProcedure("preface")
     self.distanceFeedRate.addLine(
         "(</extruderInitialization>)"
     )  # Initialization is finished, extrusion is starting.
     self.distanceFeedRate.addLine("(<crafting>)")  # Initialization is finished, crafting is starting.
Ejemplo n.º 7
0
	def addInitializationToOutput(self):
		"Add initialization gcode to the output."
		self.distanceFeedRate.addTagBracketedLine('format', 'skeinforge gcode')
		absoluteFilePathUntilDot = archive.getUntilDot(archive.getCraftPluginsDirectoryPath('preface.py'))
		dateTodayString = date.today().isoformat().replace('-', '.')[2 :]
		if absoluteFilePathUntilDot == '/home/enrique/Desktop/backup/babbleold/script/reprap/fabmetheus/skeinforge_application/skeinforge_plugins/craft_plugins/preface': #is this script on Enrique's computer?
			archive.writeFileText(archive.getVersionFileName(), dateTodayString)
		versionText = archive.getFileText(archive.getVersionFileName())
		self.distanceFeedRate.addTagBracketedLine('version', versionText)
		dateTimeTuple = datetime.now().timetuple()
		created = dateTodayString + '|%s:%s' % (dateTimeTuple[3], dateTimeTuple[4])
		self.distanceFeedRate.addTagBracketedLine('created', created)
		self.distanceFeedRate.addLine('(<extruderInitialization>)')
		if self.repository.setPositioningToAbsolute.value:
			self.distanceFeedRate.addLine('G90 ;set positioning to absolute') # Set positioning to absolute.
		if self.repository.setUnitsToMillimeters.value:
			self.distanceFeedRate.addLine('G21 ;set units to millimeters') # Set units to millimeters.
		if self.repository.startAtHome.value:
			self.distanceFeedRate.addLine('G28 ;start at home') # Start at home.
		if self.repository.resetExtruder.value:
			self.distanceFeedRate.addLine('G92 E0 ;reset extruder distance') # Start at home.
		if self.repository.turnExtruderOffAtStartUp.value:
			self.distanceFeedRate.addLine('M103') # Turn extruder off.
		craftTypeName = skeinforge_profile.getCraftTypeName()
		self.distanceFeedRate.addTagBracketedLine('craftTypeName', craftTypeName)
		self.distanceFeedRate.addTagBracketedLine('decimalPlacesCarried', self.distanceFeedRate.decimalPlacesCarried)
		layerHeight = float(self.svgReader.sliceDictionary['layerHeight'])
		self.distanceFeedRate.addTagRoundedLine('layerThickness', layerHeight)
		self.distanceFeedRate.addTagRoundedLine('layerHeight', layerHeight)
		if self.repository.meta.value:
			self.distanceFeedRate.addTagBracketedLine('meta', self.repository.meta.value)
		edgeWidth = float(self.svgReader.sliceDictionary['edgeWidth'])
		self.distanceFeedRate.addTagRoundedLine('edgeWidth', edgeWidth)
		self.distanceFeedRate.addTagRoundedLine('perimeterWidth', edgeWidth)
		self.distanceFeedRate.addTagBracketedLine('profileName', skeinforge_profile.getProfileName(craftTypeName))
		self.distanceFeedRate.addLine('(<settings>)')
		pluginFileNames = skeinforge_craft.getPluginFileNames()
		for pluginFileName in pluginFileNames:
			self.addToolSettingLines(pluginFileName)
		self.distanceFeedRate.addLine('(</settings>)')
		self.distanceFeedRate.addTagBracketedLine('timeStampPreface', strftime('%Y%m%d_%H%M%S'))
		procedureNames = self.svgReader.sliceDictionary['procedureName'].replace(',', ' ').split()
		for procedureName in procedureNames:
			self.distanceFeedRate.addTagBracketedProcedure(procedureName)
		self.distanceFeedRate.addTagBracketedProcedure('preface')
		self.distanceFeedRate.addLine('(</extruderInitialization>)') # Initialization is finished, extrusion is starting.
		self.distanceFeedRate.addLine('(<crafting>)') # Initialization is finished, crafting is starting.
Ejemplo n.º 8
0
	def addInitializationToOutput(self):
		"Add initialization gcode to the output."
		self.distanceFeedRate.addTagBracketedLine('format', 'skeinforge gcode')
		absoluteFilePathUntilDot = archive.getUntilDot(archive.getCraftPluginsDirectoryPath('preface.py'))
		dateTodayString = date.today().isoformat().replace('-', '.')[2 :]
		if absoluteFilePathUntilDot == '/home/enrique/Desktop/backup/babbleold/script/reprap/fabmetheus/skeinforge_application/skeinforge_plugins/craft_plugins/preface': #is this script on Enrique's computer?
			archive.writeFileText(archive.getVersionFileName(), dateTodayString)
		versionText = archive.getFileText(archive.getVersionFileName())
		self.distanceFeedRate.addTagBracketedLine('version', versionText)
		dateTimeTuple = datetime.now().timetuple()
		created = dateTodayString + '|%s:%s' % (dateTimeTuple[3], dateTimeTuple[4])
		self.distanceFeedRate.addTagBracketedLine('created', created)
		self.distanceFeedRate.addLine('(<extruderInitialization>)')
		if self.repository.setPositioningToAbsolute.value:
			self.distanceFeedRate.addLine('G90 ;set positioning to absolute') # Set positioning to absolute.
		if self.repository.setUnitsToMillimeters.value:
			self.distanceFeedRate.addLine('G21 ;set units to millimeters') # Set units to millimeters.
		if self.repository.startAtHome.value:
			self.distanceFeedRate.addLine('G28 ;start at home') # Start at home.
		if self.repository.turnExtruderOffAtStartUp.value:
			self.distanceFeedRate.addLine('M103') # Turn extruder off.
		craftTypeName = skeinforge_profile.getCraftTypeName()
		self.distanceFeedRate.addTagBracketedLine('craftTypeName', craftTypeName)
		self.distanceFeedRate.addTagBracketedLine('decimalPlacesCarried', self.distanceFeedRate.decimalPlacesCarried)
		layerHeight = float(self.svgReader.sliceDictionary['layerHeight'])
		self.distanceFeedRate.addTagRoundedLine('layerThickness', layerHeight)
		self.distanceFeedRate.addTagRoundedLine('layerHeight', layerHeight)
		if self.repository.meta.value:
			self.distanceFeedRate.addTagBracketedLine('meta', self.repository.meta.value)
		edgeWidth = float(self.svgReader.sliceDictionary['edgeWidth'])
		self.distanceFeedRate.addTagRoundedLine('edgeWidth', edgeWidth)
		self.distanceFeedRate.addTagRoundedLine('perimeterWidth', edgeWidth)
		self.distanceFeedRate.addTagBracketedLine('profileName', skeinforge_profile.getProfileName(craftTypeName))
		self.distanceFeedRate.addLine('(<settings>)')
		pluginFileNames = skeinforge_craft.getPluginFileNames()
		for pluginFileName in pluginFileNames:
			self.addToolSettingLines(pluginFileName)
		self.distanceFeedRate.addLine('(</settings>)')
		self.distanceFeedRate.addTagBracketedLine('timeStampPreface', strftime('%Y%m%d_%H%M%S'))
		procedureNames = self.svgReader.sliceDictionary['procedureName'].replace(',', ' ').split()
		for procedureName in procedureNames:
			self.distanceFeedRate.addTagBracketedProcedure(procedureName)
		self.distanceFeedRate.addTagBracketedProcedure('preface')
		self.distanceFeedRate.addLine('(</extruderInitialization>)') # Initialization is finished, extrusion is starting.
		self.distanceFeedRate.addLine('(<crafting>)') # Initialization is finished, crafting is starting.
Ejemplo n.º 9
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
Ejemplo n.º 10
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:
        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