コード例 #1
0
ファイル: svg_codec.py プロジェクト: weeberp/MakerDroid
def parseLineReplaceWithTable(firstWordTable, line, output, replaceWithTable):
    "Parse the line and replace it if the first word of the line is in the first word table."
    firstWord = gcodec.getFirstWordFromLine(line)
    if firstWord in firstWordTable:
        line = firstWordTable[firstWord]
    elif line.find('replaceWith') > -1:
        line = getReplaceWithLine(line, replaceWithTable)
    gcodec.addLineAndNewlineIfNecessary(line, output)
コード例 #2
0
ファイル: svg_codec.py プロジェクト: chriskyfung/MakerDroid
def parseLineReplaceWithTable( firstWordTable, line, output, replaceWithTable ):
	"Parse the line and replace it if the first word of the line is in the first word table."
	firstWord = gcodec.getFirstWordFromLine( line )
	if firstWord in firstWordTable:
		line = firstWordTable[ firstWord ]
	elif line.find( 'replaceWith' ) > - 1:
		line = getReplaceWithLine( line, replaceWithTable )
	gcodec.addLineAndNewlineIfNecessary( line, output )
コード例 #3
0
ファイル: alteration.py プロジェクト: folksjos/RepG
def getLinesWithoutRedundancy(duplicateWord, lines):
	'Get gcode lines without redundant first words.'
	oldDuplicationIndex = None
	for lineIndex, line in enumerate(lines):
		firstWord = gcodec.getFirstWordFromLine(line)
		if firstWord == duplicateWord:
			if oldDuplicationIndex == None:
				oldDuplicationIndex = lineIndex
			else:
				lines[oldDuplicationIndex] = line
				lines[lineIndex] = ''
		elif firstWord.startswith('G') or firstWord == 'M101' or firstWord == 'M103':
			oldDuplicationIndex = None
	return lines
コード例 #4
0
def getLinesWithoutRedundancy(duplicateWord, lines):
	'Get gcode lines without redundant first words.'
	oldDuplicationIndex = None
	for lineIndex, line in enumerate(lines):
		firstWord = gcodec.getFirstWordFromLine(line)
		if firstWord == duplicateWord:
			if oldDuplicationIndex == None:
				oldDuplicationIndex = lineIndex
			else:
				lines[oldDuplicationIndex] = line
				lines[lineIndex] = ''
		elif firstWord.startswith('G') or firstWord == 'M101' or firstWord == 'M103':
			oldDuplicationIndex = None
	return lines
コード例 #5
0
def parseLineReplace(firstWordTable, line, output):
    "Parse the line and replace it if the first word of the line is in the first word table."
    firstWord = gcodec.getFirstWordFromLine(line)
    if firstWord in firstWordTable:
        line = firstWordTable[firstWord]
    gcodec.addLineAndNewlineIfNecessary(line, output)
コード例 #6
0
def parseLineReplace( firstWordTable, line, output ):
	"Parse the line and replace it if the first word of the line is in the first word table."
	firstWord = gcodec.getFirstWordFromLine(line)
	if firstWord in firstWordTable:
		line = firstWordTable[ firstWord ]
	gcodec.addLineAndNewlineIfNecessary( line, output )