def getCraftedGcode( self, gcodeText, repository ):
		"Parse gcode text and store the home gcode."
		self.repository = repository
		self.homingLines = settings.getLinesInAlterationsOrGivenDirectory(repository.nameOfHomingFile.value)
		if len(self.homingLines) < 1:
			return gcodeText
		self.lines = archive.getTextLines(gcodeText)
		self.parseInitialization( repository )
		for self.lineIndex in xrange( self.lineIndex, len(self.lines) ):
			line = self.lines[self.lineIndex]
			self.parseLine(line)
		return self.distanceFeedRate.output.getvalue()
Beispiel #2
0
def getReplaceableExportGcode(nameOfReplaceFile, replaceableExportGcode):
    "Get text with strings replaced according to replace.csv file."
    replaceLines = settings.getLinesInAlterationsOrGivenDirectory(nameOfReplaceFile)
    if len(replaceLines) < 1:
        return replaceableExportGcode
    for replaceLine in replaceLines:
        splitLine = replaceLine.replace("\\n", "\t").split("\t")
        if len(splitLine) > 0:
            replaceableExportGcode = replaceableExportGcode.replace(splitLine[0], "\n".join(splitLine[1:]))
    output = cStringIO.StringIO()
    gcodec.addLinesToCString(output, archive.getTextLines(replaceableExportGcode))
    return output.getvalue()
	def getCraftedGcode(self, gcodeText, repository):
		'Parse gcode text and store the cool gcode.'
		self.repository = repository
		self.coolEndLines = settings.getLinesInAlterationsOrGivenDirectory(repository.nameOfCoolEndFile.value)
		self.coolStartLines = settings.getLinesInAlterationsOrGivenDirectory(repository.nameOfCoolStartFile.value)
		self.halfCorner = complex(repository.minimumOrbitalRadius.value, repository.minimumOrbitalRadius.value)
		self.lines = archive.getTextLines(gcodeText)
		self.minimumArea = 4.0 * repository.minimumOrbitalRadius.value * repository.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 repository.turnFanOffAtEnding.value:
			self.distanceFeedRate.addLine('M107')
		return self.distanceFeedRate.output.getvalue()
Beispiel #4
0
	def getCraftedGcode(self, gcodeText, repository):
		'Parse gcode text and store the cool gcode.'
		self.repository = repository
		self.coolEndLines = settings.getLinesInAlterationsOrGivenDirectory(repository.nameOfCoolEndFile.value)
		self.coolStartLines = settings.getLinesInAlterationsOrGivenDirectory(repository.nameOfCoolStartFile.value)
		self.halfCorner = complex(repository.minimumOrbitalRadius.value, repository.minimumOrbitalRadius.value)
		self.lines = archive.getTextLines(gcodeText)
		self.minimumArea = 4.0 * repository.minimumOrbitalRadius.value * repository.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 repository.turnFanOffAtEnding.value:
			self.distanceFeedRate.addLine('M107')
		return self.distanceFeedRate.output.getvalue()
Beispiel #5
0
	def getCraftedGcode( self, gcodeText, repository ):
		"Parse gcode text and store the home gcode."
		self.repository = repository
		self.homingLines = settings.getLinesInAlterationsOrGivenDirectory(repository.nameOfHomingFile.value)
		if len(self.homingLines) < 1:
			return gcodeText
		self.lines = archive.getTextLines(gcodeText)
		self.parseInitialization( repository )
		for self.lineIndex in xrange(self.lineIndex, len(self.lines)):
			line = self.lines[self.lineIndex]
			self.parseLine(line)
		return self.distanceFeedRate.output.getvalue()
Beispiel #6
0
def getReplaceableExportGcode(nameOfReplaceFile, replaceableExportGcode):
    'Get text with strings replaced according to replace.csv file.'
    replaceLines = settings.getLinesInAlterationsOrGivenDirectory(
        nameOfReplaceFile)
    if len(replaceLines) < 1:
        return replaceableExportGcode
    for replaceLine in replaceLines:
        splitLine = replaceLine.replace('\\n', '\t').split('\t')
        if len(splitLine) > 0:
            replaceableExportGcode = replaceableExportGcode.replace(
                splitLine[0], '\n'.join(splitLine[1:]))
    output = cStringIO.StringIO()
    gcodec.addLinesToCString(output,
                             archive.getTextLines(replaceableExportGcode))
    return output.getvalue()
Beispiel #7
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."
		self.distanceFeedRate.addLinesSetAbsoluteDistanceMode(settings.getLinesInAlterationsOrGivenDirectory(fileName))