Beispiel #1
0
	def addPathBeforeEnd( self, aroundBetweenPath, location, loop ):
		"Add the path before the end of the loop."
		halfFillInset = 0.5 * self.fillInset
		if self.arrivalInsetFollowDistance < halfFillInset:
			return
		locationComplex = location.dropAxis( 2 )
		closestInset = None
		closestDistanceIndex = euclidean.DistanceIndex( 999999999999999999.0, - 1 )
		loop = euclidean.getAwayPoints( loop, self.extrusionWidth )
		circleNodes = intercircle.getCircleNodesFromLoop( loop, self.fillInset )
		centers = []
		centers = intercircle.getCentersFromCircleNodes( circleNodes )
		for center in centers:
			inset = intercircle.getInsetFromClockwiseLoop( center, halfFillInset )
			if euclidean.isLargeSameDirection( inset, center, self.fillInset ):
				if euclidean.isPathInsideLoop( loop, inset ) == euclidean.isWiddershins( loop ):
					distanceIndex = euclidean.getNearestDistanceIndex( locationComplex, inset )
					if distanceIndex.distance < closestDistanceIndex.distance:
						closestInset = inset
						closestDistanceIndex = distanceIndex
		if closestInset == None:
			return
		extrusionHalfWidth = 0.5 * self.extrusionWidth
		closestInset = euclidean.getLoopStartingNearest( extrusionHalfWidth, locationComplex, closestInset )
		if euclidean.getPolygonLength( closestInset ) < 0.2 * self.arrivalInsetFollowDistance:
			return
		closestInset.append( closestInset[ 0 ] )
		closestInset = euclidean.getSimplifiedPath( closestInset, self.extrusionWidth )
		closestInset.reverse()
		pathBeforeArrival = euclidean.getClippedAtEndLoopPath( self.arrivalInsetFollowDistance, closestInset )
		pointBeforeArrival = pathBeforeArrival[ - 1 ]
		aroundBetweenPath.append( pointBeforeArrival )
		if self.arrivalInsetFollowDistance <= halfFillInset:
			return
		aroundBetweenPath += euclidean.getClippedAtEndLoopPath( halfFillInset, closestInset )[ len( pathBeforeArrival ) - 1 : ]
Beispiel #2
0
	def addTailoredLoopPath( self ):
		"Add a clipped and jittered loop path."
		if self.clipLength > 0.0:
			self.loopPath.path = euclidean.getClippedLoopPath( self.clipLength, self.loopPath.path )
			self.loopPath.path = euclidean.getSimplifiedPath( self.loopPath.path, self.extrusionWidth )
		self.addGcodeFromThreadZ( self.loopPath.path, self.loopPath.z )
		self.loopPath = None
Beispiel #3
0
	def addMillThreads( self ):
		"Add the mill htreads to the skein."
		boundaryLayer = self.boundaryLayers[ self.layerIndex ]
		endpoints = euclidean.getEndpointsFromSegmentTable( boundaryLayer.segmentTable )
		if len( endpoints ) < 1:
			return
		paths = euclidean.getPathsFromEndpoints( endpoints, self.millWidth, self.aroundPixelTable, self.aroundWidth )
		paths = euclidean.getConnectedPaths( paths, self.aroundPixelTable, self.aroundWidth ) # this is probably unnecesary
		averageZ = self.average.getAverage()
		if self.repository.addInnerLoops.value:
			self.addGcodeFromLoops( boundaryLayer.innerLoops, averageZ )
		if self.repository.addOuterLoops.value:
			self.addGcodeFromLoops( boundaryLayer.outerLoops, averageZ )
		for path in paths:
			simplifiedPath = euclidean.getSimplifiedPath( path, self.millWidth )
			self.distanceFeedRate.addGcodeFromThreadZ( simplifiedPath, averageZ )
Beispiel #4
0
	def addTailoredLoopPath( self, line ):
		"Add a clipped and jittered loop path."
		if self.clipLength > 0.0:
			self.loopPath.path = euclidean.getClippedLoopPath( self.clipLength, self.loopPath.path )
			self.loopPath.path = euclidean.getSimplifiedPath( self.loopPath.path, self.perimeterWidth )
		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()
			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
Beispiel #5
0
 def addPathBeforeEnd(self, aroundBetweenPath, location, loop):
     "Add the path before the end of the loop."
     halfFillInset = 0.5 * self.fillInset
     if self.arrivalInsetFollowDistance < halfFillInset:
         return
     locationComplex = location.dropAxis(2)
     closestInset = None
     closestDistanceIndex = euclidean.DistanceIndex(999999999999999999.0,
                                                    -1)
     loop = euclidean.getAwayPoints(loop, self.extrusionWidth)
     circleNodes = intercircle.getCircleNodesFromLoop(loop, self.fillInset)
     centers = []
     centers = intercircle.getCentersFromCircleNodes(circleNodes)
     for center in centers:
         inset = intercircle.getInsetFromClockwiseLoop(
             center, halfFillInset)
         if euclidean.isLargeSameDirection(inset, center, self.fillInset):
             if euclidean.isPathInsideLoop(
                     loop, inset) == euclidean.isWiddershins(loop):
                 distanceIndex = euclidean.getNearestDistanceIndex(
                     locationComplex, inset)
                 if distanceIndex.distance < closestDistanceIndex.distance:
                     closestInset = inset
                     closestDistanceIndex = distanceIndex
     if closestInset == None:
         return
     extrusionHalfWidth = 0.5 * self.extrusionWidth
     closestInset = euclidean.getLoopStartingNearest(
         extrusionHalfWidth, locationComplex, closestInset)
     if euclidean.getPolygonLength(
             closestInset) < 0.2 * self.arrivalInsetFollowDistance:
         return
     closestInset.append(closestInset[0])
     closestInset = euclidean.getSimplifiedPath(closestInset,
                                                self.extrusionWidth)
     closestInset.reverse()
     pathBeforeArrival = euclidean.getClippedAtEndLoopPath(
         self.arrivalInsetFollowDistance, closestInset)
     pointBeforeArrival = pathBeforeArrival[-1]
     aroundBetweenPath.append(pointBeforeArrival)
     if self.arrivalInsetFollowDistance <= halfFillInset:
         return
     aroundBetweenPath += euclidean.getClippedAtEndLoopPath(
         halfFillInset, closestInset)[len(pathBeforeArrival) - 1:]
Beispiel #6
0
 def addMillThreads(self):
     "Add the mill htreads to the skein."
     boundaryLayer = self.boundaryLayers[self.layerIndex]
     endpoints = euclidean.getEndpointsFromSegmentTable(
         boundaryLayer.segmentTable)
     if len(endpoints) < 1:
         return
     paths = euclidean.getPathsFromEndpoints(endpoints, self.millWidth,
                                             self.aroundPixelTable,
                                             self.aroundWidth)
     paths = euclidean.getConnectedPaths(
         paths, self.aroundPixelTable,
         self.aroundWidth)  # this is probably unnecesary
     averageZ = self.average.getAverage()
     if self.repository.addInnerLoops.value:
         self.addGcodeFromLoops(boundaryLayer.innerLoops, averageZ)
     if self.repository.addOuterLoops.value:
         self.addGcodeFromLoops(boundaryLayer.outerLoops, averageZ)
     for path in paths:
         simplifiedPath = euclidean.getSimplifiedPath(path, self.millWidth)
         self.distanceFeedRate.addGcodeFromThreadZ(simplifiedPath, averageZ)
Beispiel #7
0
 def addTailoredLoopPath(self, line):
     "Add a clipped and jittered loop path."
     if self.clipLength > 0.0:
         self.loopPath.path = euclidean.getClippedLoopPath(
             self.clipLength, self.loopPath.path)
         self.loopPath.path = euclidean.getSimplifiedPath(
             self.loopPath.path, self.perimeterWidth)
     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()
         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