Exemplo n.º 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 )
Exemplo n.º 2
0
	def parseGcode( self, fileName, gcodeText, beholdPreferences ):
		"Parse gcode text and store the vector output."
		self.beholdPreferences = beholdPreferences
		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 = beholdPreferences.goAroundExtruderOffTravel.value
		self.lines = gcodec.getTextLines( gcodeText )
		self.isThereALayerStartWord = gcodec.isThereAFirstWord( '(<layer>', self.lines, 1 )
		for line in self.lines:
			self.parseCorner( line )
		if len( self.layerTops ) > 0:
			self.layerTops[ - 1 ] += 912345678.9
		if len( self.layerTops ) > 1:
			self.oneMinusBrightnessOverTopLayerIndex = ( 1.0 - beholdPreferences.bottomLayerBrightness.value ) / float( len( self.layerTops ) - 1 )
		self.firstTopLayer = len( self.layerTops ) - self.beholdPreferences.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 = beholdPreferences.pixelsPerMillimeter.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( len( self.lines ) ):
			line = self.lines[ self.lineIndex ]
			self.parseLine( line )
		self.skeinPanes.sort( compareLayerSequence )
Exemplo n.º 3
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)
Exemplo n.º 4
0
	def parseGcode( self, fileName, gcodeText, skeinviewPreferences ):
		"Parse gcode text and store the vector output."
		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 = skeinviewPreferences.goAroundExtruderOffTravel.value
		self.lines = gcodec.getTextLines( gcodeText )
		self.isThereALayerStartWord = gcodec.isThereAFirstWord( '(<layer>', self.lines, 1 )
		for line in self.lines:
			self.parseCorner( line )
		self.cornerHighComplex = self.cornerHigh.dropAxis( 2 )
		self.cornerLowComplex = self.cornerLow.dropAxis( 2 )
		self.scale = skeinviewPreferences.pixelsPerMillimeter.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( len( self.lines ) ):
			line = self.lines[ self.lineIndex ]
			self.parseLine( line )
Exemplo n.º 5
0
	def parseGcode( self, gcodeText, skeinviewPreferences ):
		"Parse gcode text and store the vector output."
		self.arrowType = None
		if skeinviewPreferences.drawArrows.value:
			self.arrowType = 'last'
		self.initializeActiveLocation()
		self.cornerHigh = Vector3( - 999999999.0, - 999999999.0, - 999999999.0 )
		self.cornerLow = Vector3( 999999999.0, 999999999.0, 999999999.0 )
		self.goAroundExtruderOffTravel = skeinviewPreferences.goAroundExtruderOffTravel.value
		self.lines = gcodec.getTextLines( gcodeText )
		self.isThereALayerStartWord = gcodec.isThereAFirstWord( '(<layer>', self.lines, 1 )
		for line in self.lines:
			self.parseCorner( line )
		self.scale = skeinviewPreferences.pixelsWidthExtrusion.value / abs( self.extrusionWidth )
		self.scaleCornerHigh = self.scale * self.cornerHigh.dropAxis( 2 )
		self.scaleCornerLow = self.scale * self.cornerLow.dropAxis( 2 )
		print( "The lower left corner of the skeinview window is at %s, %s" % ( self.cornerLow.x, self.cornerLow.y ) )
		print( "The upper right corner of the skeinview 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.scaleSize = margin + self.scaleCornerHigh - self.marginCornerLow
		self.initializeActiveLocation()
		self.colorNames = [ 'brown', 'red', 'orange', 'yellow', 'green', 'blue', 'purple' ]
		for self.lineIndex in xrange( len( self.lines ) ):
			line = self.lines[ self.lineIndex ]
			self.parseLine( line )
Exemplo n.º 6
0
	def getCraftedGcode( self, gcodeText, towerRepository ):
		"Parse gcode text and store the tower gcode."
		self.lines = gcodec.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()
Exemplo n.º 7
0
	def parseGcode( self, gcodeText, towerPreferences ):
		"Parse gcode text and store the tower gcode."
		self.lines = gcodec.getTextLines( gcodeText )
		self.towerPreferences = towerPreferences
		self.parseInitialization()
		self.oldLocation = None
		if gcodec.isThereAFirstWord( '(<operatingLayerEnd>', self.lines, self.lineIndex ):
			self.parseUntilOperatingLayer()
		for lineIndex in xrange( self.lineIndex, len( self.lines ) ):
			self.parseLine( lineIndex )
		for threadLayer in self.threadLayers:
			self.addIslandLayer( threadLayer )
		for self.layerIndex in xrange( min( len( self.islandLayers ), towerPreferences.towerStartLayer.value ) ):
			self.addEntireLayer( self.layerIndex )
		self.addTowers()
		self.addShutdownToOutput()
Exemplo n.º 8
0
 def getCraftedGcode(self, gcodeText, towerRepository):
     "Parse gcode text and store the tower gcode."
     self.lines = gcodec.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()
Exemplo n.º 9
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)