예제 #1
0
	def parseGcode( self, fileName, gcodeText, repository ):
		"Parse gcode text and store the vector output."
		self.fileName = fileName
		self.gcodeText = gcodeText
		self.repository = repository
		self.initializeActiveLocation()
		self.cornerMaximum = Vector3(-987654321.0, -987654321.0, -987654321.0)
		self.cornerMinimum = Vector3(987654321.0, 987654321.0, 987654321.0)
		self.lines = archive.getTextLines(gcodeText)
		self.isThereALayerStartWord = (gcodec.getFirstWordIndexReverse('(<layer>', self.lines, 1) > -1)
		self.parseInitialization()
		for line in self.lines[self.lineIndex :]:
			self.parseCorner(line)
		self.cornerMaximumComplex = self.cornerMaximum.dropAxis()
		self.cornerMinimumComplex = self.cornerMinimum.dropAxis()
		self.scale = repository.scale.value
		self.scaleCornerHigh = self.scale * self.cornerMaximumComplex
		self.scaleCornerLow = self.scale * self.cornerMinimumComplex
		self.cornerImaginaryTotal = self.cornerMaximum.y + self.cornerMinimum.y
		self.margin = complex( 10.0, 10.0 )
		self.marginCornerHigh = self.scaleCornerHigh + self.margin
		self.marginCornerLow = self.scaleCornerLow - self.margin
		self.screenSize = self.marginCornerHigh - self.marginCornerLow
		self.initializeActiveLocation()
		self.colorNames = ['brown', 'red', 'orange', 'yellow', 'green', 'blue', 'purple']
		for self.lineIndex in xrange(self.lineIndex, len(self.lines)):
			line = self.lines[self.lineIndex]
			self.parseLine(line)
예제 #2
0
 def parseGcode(self, fileName, gcodeText, repository):
     "Parse gcode text and store the vector output."
     self.repository = repository
     self.fileName = fileName
     self.gcodeText = gcodeText
     self.initializeActiveLocation()
     self.cornerMaximum = Vector3(-987654321.0, -987654321.0, -987654321.0)
     self.cornerMinimum = Vector3(987654321.0, 987654321.0, 987654321.0)
     self.goAroundExtruderOffTravel = repository.goAroundExtruderOffTravel.value
     self.lines = archive.getTextLines(gcodeText)
     self.isThereALayerStartWord = gcodec.getFirstWordIndexReverse("(<layer>", self.lines, 1) > -1
     if self.isThereALayerStartWord:
         self.parseInitialization()
     else:
         print("")
         print("")
         print("")
         print(
             "Warning, there are no skeinforge comments in this text, probably because they have been removed by export."
         )
         print("So there is no loop information, and therefore the lines will not be colored.")
         print("")
         print("To see the full information in an exported file, either deselect Delete Comments in export, or")
         print(
             "select Save Penultimate Gcode in export, and open the generated file with the suffix _penultimate.gcode."
         )
         print("")
         print("")
         print("")
     for line in self.lines[self.lineIndex :]:
         self.parseCorner(line)
     self.oldZ = -999987654321.0
     if len(self.layerTops) > 0:
         self.layerTops[-1] += 912345678.9
     if len(self.layerTops) > 1:
         self.oneMinusBrightnessOverTopLayerIndex = (1.0 - repository.bottomLayerBrightness.value) / float(
             len(self.layerTops) - 1
         )
     self.firstTopLayer = len(self.layerTops) - self.repository.numberOfFillTopLayers.value
     self.centerComplex = 0.5 * (self.cornerMaximum.dropAxis() + self.cornerMinimum.dropAxis())
     self.centerBottom = Vector3(self.centerComplex.real, self.centerComplex.imag, self.cornerMinimum.z)
     self.scale = repository.scale.value
     self.scaleCenterBottom = self.scale * self.centerBottom
     self.scaleCornerHigh = self.scale * self.cornerMaximum.dropAxis()
     self.scaleCornerLow = self.scale * self.cornerMinimum.dropAxis()
     print(
         "The lower left corner of the skeiniso window is at %s, %s" % (self.cornerMinimum.x, self.cornerMinimum.y)
     )
     print(
         "The upper right corner of the skeiniso window is at %s, %s" % (self.cornerMaximum.x, self.cornerMaximum.y)
     )
     self.cornerImaginaryTotal = self.cornerMaximum.y + self.cornerMinimum.y
     margin = complex(5.0, 5.0)
     self.marginCornerLow = self.scaleCornerLow - margin
     self.screenSize = margin + 2.0 * (self.scaleCornerHigh - self.marginCornerLow)
     self.initializeActiveLocation()
     for self.lineIndex in xrange(self.lineIndex, len(self.lines)):
         line = self.lines[self.lineIndex]
         self.parseLine(line)
예제 #3
0
파일: tower.py 프로젝트: folksjos/RepG
	def parseIfWordUntilWord(self, word):
		"Parse gcode if there is a word until the word is reached."
		for self.lineIndex in xrange(self.lineIndex, gcodec.getFirstWordIndexReverse(word, self.lines, self.lineIndex)):
			line = self.lines[self.lineIndex]
			splitLine = gcodec.getSplitLineBeforeBracketSemicolon(line)
			firstWord = gcodec.getFirstWord(splitLine)
			self.distanceFeedRate.addLine(line)
			if firstWord == 'G1':
				self.oldLocation = gcodec.getLocationFromSplitLine(self.oldLocation, splitLine)
				if self.oldLocation.z > self.highestZ:
					self.highestZ = self.oldLocation.z
예제 #4
0
파일: skeiniso.py 프로젝트: folksjos/RepG
	def parseGcode( self, fileName, gcodeText, repository ):
		"Parse gcode text and store the vector output."
		self.repository = repository
		self.fileName = fileName
		self.gcodeText = gcodeText
		self.initializeActiveLocation()
		self.cornerMaximum = Vector3(-987654321.0, -987654321.0, -987654321.0)
		self.cornerMinimum = Vector3(987654321.0, 987654321.0, 987654321.0)
		self.goAroundExtruderOffTravel = repository.goAroundExtruderOffTravel.value
		self.lines = archive.getTextLines(gcodeText)
		self.isThereALayerStartWord = (gcodec.getFirstWordIndexReverse('(<layer>', self.lines, 1) > -1)
		if self.isThereALayerStartWord:
			self.parseInitialization()
		else:
			print('')
			print('')
			print('')
			print('Warning, there are no skeinforge comments in this text, probably because they have been removed by export.')
			print('So there is no loop information, and therefore the lines will not be colored.')
			print('')
			print('To see the full information in an exported file, either deselect Delete Comments in export, or')
			print('select Save Penultimate Gcode in export, and open the generated file with the suffix _penultimate.gcode.')
			print('')
			print('')
			print('')
		for line in self.lines[self.lineIndex :]:
			self.parseCorner(line)
		self.oldZ = - 999987654321.0
		if len( self.layerTops ) > 0:
			self.layerTops[-1] += 912345678.9
		if len( self.layerTops ) > 1:
			self.oneMinusBrightnessOverTopLayerIndex = ( 1.0 - repository.bottomLayerBrightness.value ) / float( len( self.layerTops ) - 1 )
		self.firstTopLayer = len( self.layerTops ) - self.repository.numberOfFillTopLayers.value
		self.centerComplex = 0.5 * ( self.cornerMaximum.dropAxis() + self.cornerMinimum.dropAxis() )
		self.centerBottom = Vector3( self.centerComplex.real, self.centerComplex.imag, self.cornerMinimum.z )
		self.scale = repository.scale.value
		self.scaleCenterBottom = self.scale * self.centerBottom
		self.scaleCornerHigh = self.scale * self.cornerMaximum.dropAxis()
		self.scaleCornerLow = self.scale * self.cornerMinimum.dropAxis()
		print("The lower left corner of the skeiniso window is at %s, %s" % (self.cornerMinimum.x, self.cornerMinimum.y))
		print("The upper right corner of the skeiniso window is at %s, %s" % (self.cornerMaximum.x, self.cornerMaximum.y))
		self.cornerImaginaryTotal = self.cornerMaximum.y + self.cornerMinimum.y
		margin = complex( 5.0, 5.0 )
		self.marginCornerLow = self.scaleCornerLow - margin
		self.screenSize = margin + 2.0 * ( self.scaleCornerHigh - self.marginCornerLow )
		self.initializeActiveLocation()
		for self.lineIndex in xrange(self.lineIndex, len(self.lines)):
			line = self.lines[self.lineIndex]
			self.parseLine(line)