Beispiel #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.cornerHigh = Vector3(-999999999.0, -999999999.0, -999999999.0)
     self.cornerLow = Vector3(999999999.0, 999999999.0, 999999999.0)
     self.lines = gcodec.getTextLines(gcodeText)
     self.isThereALayerStartWord = gcodec.isThereAFirstWord(
         '(<layer>', self.lines, 1)
     self.parseInitialization()
     for line in self.lines[self.lineIndex:]:
         self.parseCorner(line)
     self.cornerHighComplex = self.cornerHigh.dropAxis(2)
     self.cornerLowComplex = self.cornerLow.dropAxis(2)
     self.scale = repository.scale.value
     self.scaleCornerHigh = self.scale * self.cornerHighComplex
     self.scaleCornerLow = self.scale * self.cornerLowComplex
     self.cornerImaginaryTotal = self.cornerHigh.y + self.cornerLow.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)
Beispiel #2
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.cornerHigh = Vector3(-999999999.0, -999999999.0, -999999999.0)
		self.cornerLow = Vector3(999999999.0, 999999999.0, 999999999.0)
		self.lines = gcodec.getTextLines(gcodeText)
		self.isThereALayerStartWord = gcodec.isThereAFirstWord('(<layer>', self.lines, 1 )
		self.parseInitialization()
		for line in self.lines[self.lineIndex :]:
			self.parseCorner(line)
		self.cornerHighComplex = self.cornerHigh.dropAxis(2)
		self.cornerLowComplex = self.cornerLow.dropAxis(2)
		self.scale = repository.scale.value
		self.scaleCornerHigh = self.scale * self.cornerHighComplex
		self.scaleCornerLow = self.scale * self.cornerLowComplex
		self.cornerImaginaryTotal = self.cornerHigh.y + self.cornerLow.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)
Beispiel #3
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.cornerHigh = Vector3(-999999999.0, -999999999.0, -999999999.0)
		self.cornerLow = Vector3(999999999.0, 999999999.0, 999999999.0)
		self.goAroundExtruderOffTravel = repository.goAroundExtruderOffTravel.value
		self.lines = gcodec.getTextLines(gcodeText)
		self.isThereALayerStartWord = gcodec.isThereAFirstWord('(<layer>', self.lines, 1 )
		self.parseInitialization()
		for line in self.lines[self.lineIndex :]:
			self.parseCorner(line)
		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.cornerHigh.dropAxis(2) + self.cornerLow.dropAxis(2) )
		self.centerBottom = Vector3( self.centerComplex.real, self.centerComplex.imag, self.cornerLow.z )
		self.scale = repository.scale.value
		self.scaleCenterBottom = self.scale * self.centerBottom
		self.scaleCornerHigh = self.scale * self.cornerHigh.dropAxis(2)
		self.scaleCornerLow = self.scale * self.cornerLow.dropAxis(2)
		print( "The lower left corner of the behold window is at %s, %s" % ( self.cornerLow.x, self.cornerLow.y ) )
		print( "The upper right corner of the behold window is at %s, %s" % ( self.cornerHigh.x, self.cornerHigh.y ) )
		self.cornerImaginaryTotal = self.cornerHigh.y + self.cornerLow.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)
Beispiel #4
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.cornerHigh = Vector3(-999999999.0, -999999999.0, -999999999.0)
		self.cornerLow = Vector3(999999999.0, 999999999.0, 999999999.0)
		self.goAroundExtruderOffTravel = repository.goAroundExtruderOffTravel.value
		self.lines = gcodec.getTextLines(gcodeText)
		self.isThereALayerStartWord = gcodec.isThereAFirstWord('(<layer>', self.lines, 1 )
		self.parseInitialization()
		for line in self.lines[self.lineIndex :]:
			self.parseCorner(line)
		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.cornerHigh.dropAxis(2) + self.cornerLow.dropAxis(2) )
		self.centerBottom = Vector3( self.centerComplex.real, self.centerComplex.imag, self.cornerLow.z )
		self.scale = repository.scale.value
		self.scaleCenterBottom = self.scale * self.centerBottom
		self.scaleCornerHigh = self.scale * self.cornerHigh.dropAxis(2)
		self.scaleCornerLow = self.scale * self.cornerLow.dropAxis(2)
		print( "The lower left corner of the behold window is at %s, %s" % ( self.cornerLow.x, self.cornerLow.y ) )
		print( "The upper right corner of the behold window is at %s, %s" % ( self.cornerHigh.x, self.cornerHigh.y ) )
		self.cornerImaginaryTotal = self.cornerHigh.y + self.cornerLow.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)
Beispiel #5
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(-999999999.0, -999999999.0, -999999999.0)
     self.cornerMinimum = Vector3(999999999.0, 999999999.0, 999999999.0)
     self.lines = archive.getTextLines(gcodeText)
     self.isThereALayerStartWord = gcodec.isThereAFirstWord("(<layer>", self.lines, 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)
Beispiel #6
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(-999999999.0, -999999999.0, -999999999.0)
		self.cornerMinimum = Vector3(999999999.0, 999999999.0, 999999999.0)
		self.goAroundExtruderOffTravel = repository.goAroundExtruderOffTravel.value
		self.lines = archive.getTextLines(gcodeText)
		self.isThereALayerStartWord = gcodec.isThereAFirstWord('(<layer>', self.lines, 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 = - 999999999999.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)
Beispiel #7
0
	def getCraftedGcode( self, gcodeText, towerRepository ):
		"Parse gcode text and store the tower gcode."
		self.lines = archive.getTextLines(gcodeText)
		self.towerRepository = towerRepository
		self.parseInitialization()
		if gcodec.isThereAFirstWord('(<operatingLayerEnd>', self.lines, self.lineIndex ):
			self.parseUntilOperatingLayer()
		for lineIndex in xrange( self.lineIndex, len(self.lines) ):
			self.parseLine( lineIndex )
		concatenateEndIndex = min( len( self.threadLayers ), towerRepository.towerStartLayer.value )
		for threadLayer in self.threadLayers[ : concatenateEndIndex ]:
			self.addEntireLayer( threadLayer )
		self.threadLayers = self.threadLayers[ concatenateEndIndex : ]
		self.addTowers()
		self.distanceFeedRate.addLines( self.lines[ self.shutdownLineIndex : ] )
		return self.distanceFeedRate.output.getvalue()
Beispiel #8
0
	def getCraftedGcode( self, gcodeText, towerRepository ):
		"Parse gcode text and store the tower gcode."
		self.lines = archive.getTextLines(gcodeText)
		self.towerRepository = towerRepository
		self.parseInitialization()
		if gcodec.isThereAFirstWord('(<operatingLayerEnd>', self.lines, self.lineIndex ):
			self.parseUntilOperatingLayer()
		for lineIndex in xrange( self.lineIndex, len(self.lines) ):
			self.parseLine( lineIndex )
		concatenateEndIndex = min( len( self.threadLayers ), towerRepository.towerStartLayer.value )
		for threadLayer in self.threadLayers[ : concatenateEndIndex ]:
			self.addEntireLayer( threadLayer )
		self.threadLayers = self.threadLayers[ concatenateEndIndex : ]
		self.addTowers()
		self.distanceFeedRate.addLines( self.lines[ self.shutdownLineIndex : ] )
		return self.distanceFeedRate.output.getvalue()