Пример #1
0
 def getCraftedGcode(self, gcodeText, coolRepository):
     "Parse gcode text and store the cool gcode."
     self.coolRepository = coolRepository
     self.coolEndText = settings.getFileInAlterationsOrGivenDirectory(
         os.path.dirname(__file__), 'Cool_End.gcode')
     self.coolEndLines = gcodec.getTextLines(self.coolEndText)
     self.coolStartText = settings.getFileInAlterationsOrGivenDirectory(
         os.path.dirname(__file__), 'Cool_Start.gcode')
     self.coolStartLines = gcodec.getTextLines(self.coolStartText)
     self.halfCorner = complex(coolRepository.minimumOrbitalRadius.value,
                               coolRepository.minimumOrbitalRadius.value)
     self.lines = gcodec.getTextLines(gcodeText)
     self.minimumArea = 4.0 * coolRepository.minimumOrbitalRadius.value * coolRepository.minimumOrbitalRadius.value
     self.parseInitialization()
     self.boundingRectangle = gcodec.BoundingRectangle().getFromGcodeLines(
         self.lines[self.lineIndex:], 0.5 * self.perimeterWidth)
     margin = 0.2 * self.perimeterWidth
     halfCornerMargin = self.halfCorner + complex(margin, margin)
     self.boundingRectangle.cornerMaximum -= halfCornerMargin
     self.boundingRectangle.cornerMinimum += halfCornerMargin
     for self.lineIndex in xrange(self.lineIndex, len(self.lines)):
         line = self.lines[self.lineIndex]
         self.parseLine(line)
     if coolRepository.turnFanOffAtEnding.value:
         self.distanceFeedRate.addLine('M107')
     return self.distanceFeedRate.output.getvalue()
Пример #2
0
def getReplaced(exportText):
	'Get text with strings replaced according to replace.csv file.'
	replaceText = settings.getFileInAlterationsOrGivenDirectory(os.path.dirname(__file__), 'Replace.csv')
	lines = archive.getTextLines(replaceText)
	for line in lines:
		exportText = getReplacedByLine(exportText, line)
	return exportText
Пример #3
0
def getReplaced( exportText ):
	"Get text with strings replaced according to replace.csv file."
	replaceText = settings.getFileInAlterationsOrGivenDirectory( os.path.dirname( __file__ ), 'Replace.csv')
	if replaceText == '':
		return exportText
	lines = archive.getTextLines( replaceText )
	for line in lines:
                splitLine = line.replace('\\n', '\t').split('\t')
                if len(splitLine) > 1:
                        exportText = exportText.replace(splitLine[0], '\n'.join(splitLine[1 :]))
	return exportText
Пример #4
0
def getReplaced( exportText ):
	"Get text with strings replaced according to replace.csv file."
	replaceText = settings.getFileInAlterationsOrGivenDirectory( os.path.dirname( __file__ ), 'Replace.csv')
	if replaceText == '':
		return exportText
	lines = archive.getTextLines( replaceText )
	for line in lines:
		splitLine = line.split('\t')
		if len(splitLine) > 1:
			exportText = exportText.replace( splitLine[0], splitLine[1] )
	return exportText
Пример #5
0
	def getCraftedGcode( self, gcodeText, homeRepository ):
		"Parse gcode text and store the home gcode."
		self.homingText = settings.getFileInAlterationsOrGivenDirectory( os.path.dirname(__file__), homeRepository.nameOfHomingFile.value )
		if len( self.homingText ) < 1:
			return gcodeText
		self.lines = archive.getTextLines(gcodeText)
		self.homeRepository = homeRepository
		self.parseInitialization( homeRepository )
		self.homingLines = archive.getTextLines( self.homingText )
		for self.lineIndex in xrange( self.lineIndex, len(self.lines) ):
			line = self.lines[self.lineIndex]
			self.parseLine(line)
		return self.distanceFeedRate.output.getvalue()
Пример #6
0
	def getCraftedGcode( self, gcodeText, coolRepository ):
		"Parse gcode text and store the cool gcode."
		self.coolRepository = coolRepository
		self.coolEndText = settings.getFileInAlterationsOrGivenDirectory( os.path.dirname( __file__ ), 'Cool_End.gcode')
		self.coolEndLines = gcodec.getTextLines( self.coolEndText )
		self.coolStartText = settings.getFileInAlterationsOrGivenDirectory( os.path.dirname( __file__ ), 'Cool_Start.gcode')
		self.coolStartLines = gcodec.getTextLines( self.coolStartText )
		self.halfCorner = complex( coolRepository.minimumOrbitalRadius.value, coolRepository.minimumOrbitalRadius.value )
		self.lines = gcodec.getTextLines(gcodeText)
		self.minimumArea = 4.0 * coolRepository.minimumOrbitalRadius.value * coolRepository.minimumOrbitalRadius.value
		self.parseInitialization()
		self.boundingRectangle = gcodec.BoundingRectangle().getFromGcodeLines( self.lines[self.lineIndex :], 0.5 * self.perimeterWidth )
		margin = 0.2 * self.perimeterWidth
		halfCornerMargin = self.halfCorner + complex( margin, margin )
		self.boundingRectangle.cornerMaximum -= halfCornerMargin
		self.boundingRectangle.cornerMinimum += halfCornerMargin
		for self.lineIndex in xrange( self.lineIndex, len( self.lines ) ):
			line = self.lines[ self.lineIndex ]
			self.parseLine(line)
		if coolRepository.turnFanOffAtEnding.value:
			self.distanceFeedRate.addLine('M107')
		return self.distanceFeedRate.output.getvalue()
Пример #7
0
def getReplaced(exportText):
	'Get text with strings replaced according to replace.csv file.'
	replaceText = settings.getFileInAlterationsOrGivenDirectory(os.path.dirname(__file__), 'Replace.csv')
	replaceLines = archive.getTextLines(replaceText)
	if len(replaceLines) < 1:
		return exportText
	for replaceLine in replaceLines:
		splitLine = replaceLine.replace('\\n', '\t').split('\t')
		if len(splitLine) > 0:
			exportText = exportText.replace(splitLine[0], '\n'.join(splitLine[1 :]))
	output = cStringIO.StringIO()
	gcodec.addLinesToCString(output, archive.getTextLines(exportText))
	return output.getvalue()
Пример #8
0
def getReplaced(exportText):
    'Get text with strings replaced according to replace.csv file.'
    replaceText = settings.getFileInAlterationsOrGivenDirectory(
        os.path.dirname(__file__), 'Replace.csv')
    replaceLines = archive.getTextLines(replaceText)
    if len(replaceLines) < 1:
        return exportText
    for replaceLine in replaceLines:
        splitLine = replaceLine.replace('\\n', '\t').split('\t')
        if len(splitLine) > 0:
            exportText = exportText.replace(splitLine[0],
                                            '\n'.join(splitLine[1:]))
    output = cStringIO.StringIO()
    gcodec.addLinesToCString(output, archive.getTextLines(exportText))
    return output.getvalue()
Пример #9
0
 def addFromUpperLowerFile(self, fileName):
     "Add lines of text from the fileName or the lowercase fileName, if there is no file by the original fileName in the directory."
     fileText = settings.getFileInAlterationsOrGivenDirectory(
         os.path.dirname(__file__), fileName)
     fileLines = gcodec.getTextLines(fileText)
     self.distanceFeedRate.addLinesSetAbsoluteDistanceMode(fileLines)
Пример #10
0
	def addFromUpperLowerFile( self, fileName ):
		"Add lines of text from the fileName or the lowercase fileName, if there is no file by the original fileName in the directory."
		fileText = settings.getFileInAlterationsOrGivenDirectory( os.path.dirname( __file__ ), fileName )
		fileLines = gcodec.getTextLines( fileText )
		self.distanceFeedRate.addLinesSetAbsoluteDistanceMode( fileLines )