Example #1
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 #2
0
	def addTailoredLoopPath( self, line ):
		"Add a clipped loop path."
		if self.clipLength > 0.0:
			removeTable = {}
			euclidean.addLoopToPixelTable( self.loopPath.path, removeTable, self.layerPixelWidth )
			euclidean.removePixelTableFromPixelTable( removeTable, self.layerPixelTable )
			self.loopPath.path = euclidean.getClippedLoopPath( self.clipLength, self.loopPath.path )
			self.loopPath.path = euclidean.getSimplifiedPath( self.loopPath.path, self.perimeterWidth )
			euclidean.addLoopToPixelTable( self.loopPath.path, self.layerPixelTable, self.layerPixelWidth )
		if self.oldWiddershins == None:
			self.addGcodeFromThreadZ( self.loopPath.path, self.loopPath.z )
		else:
			if self.oldWiddershins != euclidean.isWiddershins( self.loopPath.path ):
				self.loopPath.path.reverse()
#			self.addGcodeFromThreadZ( self.loopPath.path, self.loopPath.z )
			for point in self.loopPath.path:
				self.distanceFeedRate.addGcodeMovementZWithFeedRate( self.feedRateMinute, point, self.loopPath.z )
		if self.getNextThreadIsACloseLoop( self.loopPath.path ):
			self.oldWiddershins = euclidean.isWiddershins( self.loopPath.path )
		else:
			self.oldWiddershins = None
			self.distanceFeedRate.addLine( line )
		self.loopPath = None
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