Example #1
0
 def parseLine(self, line):
     "Parse a gcode line and add it to the mill skein."
     splitLine = gcodec.getSplitLineBeforeBracketSemicolon(line)
     if len(splitLine) < 1:
         return
     firstWord = splitLine[0]
     if firstWord == 'G1':
         location = gcodec.getLocationFromSplitLine(self.oldLocation,
                                                    splitLine)
         if self.isExtruderActive:
             self.average.addValue(location.z)
             if self.oldLocation != None:
                 euclidean.addValueSegmentToPixelTable(
                     self.oldLocation.dropAxis(2), location.dropAxis(2),
                     self.aroundPixelTable, None, self.aroundWidth)
         self.oldLocation = location
     elif firstWord == 'M101':
         self.isExtruderActive = True
     elif firstWord == 'M103':
         self.isExtruderActive = False
     elif firstWord == '(<layer>':
         self.aroundPixelTable = {}
         self.average.reset()
     elif firstWord == '(</layer>)':
         if len(self.boundaryLayers) > self.layerIndex:
             self.addMillThreads()
         self.layerIndex += 1
     self.distanceFeedRate.addLine(line)
Example #2
0
	def parseLine( self, line ):
		"Parse a gcode line and add it to the mill skein."
		splitLine = gcodec.getSplitLineBeforeBracketSemicolon( line )
		if len( splitLine ) < 1:
			return
		firstWord = splitLine[ 0 ]
		if firstWord == 'G1':
			location = gcodec.getLocationFromSplitLine( self.oldLocation, splitLine )
			if self.isExtruderActive:
				self.average.addValue( location.z )
				if self.oldLocation != None:
					euclidean.addValueSegmentToPixelTable( self.oldLocation.dropAxis( 2 ), location.dropAxis( 2 ), self.aroundPixelTable, None, self.aroundWidth )
			self.oldLocation = location
		elif firstWord == 'M101':
			self.isExtruderActive = True
		elif firstWord == 'M103':
			self.isExtruderActive = False
		elif firstWord == '(<layer>':
			self.aroundPixelTable = {}
			self.average.reset()
		elif firstWord == '(</layer>)':
			if len( self.boundaryLayers ) > self.layerIndex:
				self.addMillThreads()
			self.layerIndex += 1
		self.distanceFeedRate.addLine( line )
Example #3
0
	def getConnectionIsCloseWithoutOverlap( self, location, path ):
		"Determine if the connection is close enough and does not overlap another thread."
		if len( path ) < 1:
			return False
		locationComplex = location.dropAxis( 2 )
		segment = locationComplex - path[ - 1 ]
		segmentLength = abs( segment )
		if segmentLength <= 0.0:
			return True
		segment /= segmentLength
		distance = self.connectingStepLength
		segmentEndLength = segmentLength - self.connectingStepLength
		while distance < segmentEndLength:
			alongPoint = distance * segment + path[ - 1 ]
			if not euclidean.isPointInsideLoops( self.boundaryLoops, alongPoint ):
				return False
			distance += self.connectingStepLength
		removedLayerPixelTable = self.layerPixelTable.copy()
		if self.oldLocation in self.maskPixelTableTable:
			euclidean.removePixelTableFromPixelTable( self.maskPixelTableTable[ self.oldLocation ], removedLayerPixelTable )
		euclidean.addPathToPixelTable( path[ : - 2 ], removedLayerPixelTable, None, self.layerPixelWidth )
		segmentTable = {}
		euclidean.addValueSegmentToPixelTable( path[ - 1 ], locationComplex, segmentTable, None, self.layerPixelWidth )
		maskPixelTable = {}
		if location in self.maskPixelTableTable:
			maskPixelTable = self.maskPixelTableTable[ location ]
		if euclidean.isPixelTableIntersecting( removedLayerPixelTable, segmentTable, maskPixelTable ):
			return False
		euclidean.addPixelTableToPixelTable( segmentTable, self.layerPixelTable )
		return True
Example #4
0
	def getConnectionIsCloseWithoutOverlap( self, location, path ):
		"Determine if the connection is close enough and does not overlap another thread."
		if len( path ) < 1:
			return False
		locationComplex = location.dropAxis( 2 )
		segment = locationComplex - path[ - 1 ]
		segmentLength = abs( segment )
		if segmentLength <= 0.0:
			return True
		segment /= segmentLength
		distance = self.connectingStepLength
		segmentEndLength = segmentLength - self.connectingStepLength
		while distance < segmentEndLength:
			alongPoint = distance * segment + path[ - 1 ]
			if not euclidean.isPointInsideLoops( self.boundaryLoops, alongPoint ):
				return False
			distance += self.connectingStepLength
#		removedLayerPixelTable = self.layerPixelTable.copy()
#		if self.oldLocation in self.maskPixelTableTable:
#			euclidean.removePixelTableFromPixelTable( self.maskPixelTableTable[ self.oldLocation ], removedLayerPixelTable )
#		euclidean.addPathToPixelTable( path[ : - 2 ], removedLayerPixelTable, None, self.layerPixelWidth )
		segmentTable = {}
		euclidean.addSegmentToPixelTable( path[ - 1 ], locationComplex, segmentTable, 2.0, 2.0, self.layerPixelWidth )
#		euclidean.addValueSegmentToPixelTable( path[ - 1 ], locationComplex, segmentTable, None, self.layerPixelWidth )
#		euclidean.addValueSegmentToPixelTable( path[ - 1 ], locationComplex, segmentTable, None, self.layerPixelWidth )
#		maskPixelTable = {}
#		if location in self.maskPixelTableTable:
#			maskPixelTable = self.maskPixelTableTable[ location ]
		if euclidean.isPixelTableIntersecting( self.layerPixelTable, segmentTable, {} ):
#		if euclidean.isPixelTableIntersecting( removedLayerPixelTable, segmentTable, {} ):
			return False
		euclidean.addValueSegmentToPixelTable( path[ - 1 ], locationComplex, self.layerPixelTable, None, self.layerPixelWidth )
#		euclidean.addPixelTableToPixelTable( segmentTable, self.layerPixelTable )
		return True
Example #5
0
	def addSegmentToPixelTables( self, location, maskPixelTable, oldLocation ):
		"Add the segment to the layer and mask table."
		segmentTable = {}
		euclidean.addValueSegmentToPixelTable( oldLocation.dropAxis( 2 ), location.dropAxis( 2 ), segmentTable, None, self.layerPixelWidth )
		euclidean.addPixelTableToPixelTable( segmentTable, self.layerPixelTable )
		euclidean.addPixelTableToPixelTable( segmentTable, maskPixelTable )
		self.maskPixelTableTable[ location ] = maskPixelTable
		self.maskPixelTableTable[ oldLocation ] = maskPixelTable
Example #6
0
 def addSegmentToPixelTables(self, location, maskPixelTable, oldLocation):
     "Add the segment to the layer and mask table."
     segmentTable = {}
     euclidean.addValueSegmentToPixelTable(oldLocation.dropAxis(2),
                                           location.dropAxis(2),
                                           segmentTable, None,
                                           self.layerPixelWidth)
     euclidean.addPixelTableToPixelTable(segmentTable, self.layerPixelTable)
     euclidean.addPixelTableToPixelTable(segmentTable, maskPixelTable)
     self.maskPixelTableTable[location] = maskPixelTable
     self.maskPixelTableTable[oldLocation] = maskPixelTable