Ejemplo n.º 1
0
 def addCoolOrbits(self, remainingOrbitTime):
     "Add the minimum radius cool orbits."
     if len(self.boundaryLayer.loops) < 1:
         return
     insetBoundaryLoops = intercircle.getInsetLoopsFromLoops(self.perimeterWidth, self.boundaryLayer.loops)
     if len(insetBoundaryLoops) < 1:
         insetBoundaryLoops = self.boundaryLayer.loops
     largestLoop = euclidean.getLargestLoop(insetBoundaryLoops)
     loopArea = abs(euclidean.getPolygonArea(largestLoop))
     if loopArea < self.minimumArea:
         center = 0.5 * (euclidean.getMaximumFromPoints(largestLoop) + euclidean.getMinimumFromPoints(largestLoop))
         centerXBounded = max(center.real, self.cornerMinimum.real)
         centerXBounded = min(centerXBounded, self.cornerMaximum.real)
         centerYBounded = max(center.imag, self.cornerMinimum.imag)
         centerYBounded = min(centerYBounded, self.cornerMaximum.imag)
         center = complex(centerXBounded, centerYBounded)
         maximumCorner = center + self.halfCorner
         minimumCorner = center - self.halfCorner
         largestLoop = euclidean.getSquareLoop(minimumCorner, maximumCorner)
     pointComplex = euclidean.getXYComplexFromVector3(self.oldLocation)
     if pointComplex != None:
         largestLoop = euclidean.getLoopStartingNearest(self.perimeterWidth, pointComplex, largestLoop)
     intercircle.addOrbitsIfLarge(
         self.distanceFeedRate, largestLoop, self.orbitalFeedRatePerSecond, remainingOrbitTime, self.highestZ
     )
Ejemplo n.º 2
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 : ]
Ejemplo n.º 3
0
	def addOperatingOrbits( self, boundaryLoops, pointComplex, temperatureChangeTime, z ):
		"Add the orbits before the operating layers."
		if len( boundaryLoops ) < 1:
			return
		insetBoundaryLoops = intercircle.getInsetLoopsFromLoops( self.perimeterWidth, boundaryLoops )
		if len( insetBoundaryLoops ) < 1:
			insetBoundaryLoops = boundaryLoops
		largestLoop = euclidean.getLargestLoop( insetBoundaryLoops )
		if pointComplex != None:
			largestLoop = euclidean.getLoopStartingNearest( self.perimeterWidth, pointComplex, largestLoop )
		intercircle.addOrbitsIfLarge( self.distanceFeedRate, largestLoop, self.orbitalFeedRatePerSecond, temperatureChangeTime, z )
Ejemplo n.º 4
0
	def addTailoredLoopPath( self ):
		"Add a clipped and jittered loop path."
		loop = self.loopPath.path[ : - 1 ]
		if self.beforeLoopLocation != None:
			perimeterHalfWidth = 0.5 * self.perimeterWidth
			loop = euclidean.getLoopStartingNearest( perimeterHalfWidth, self.beforeLoopLocation, loop )
		if self.layerJitter != 0.0:
			loop = self.getJitteredLoop( self.layerJitter, loop )
			loop = euclidean.getAwayPoints( loop, 0.2 * self.perimeterWidth )
		self.loopPath.path = loop + [ loop[ 0 ] ]
		self.addGcodeFromThreadZ( self.loopPath.path, self.loopPath.z )
		self.loopPath = None
Ejemplo n.º 5
0
	def addTailoredLoopPath( self ):
		"Add a clipped and jittered loop path."
		loop = self.loopPath.path[ : - 1 ]
		jitterDistance = self.layerJitter + self.arrivalInsetFollowDistance
		if self.beforeLoopLocation != None:
			extrusionHalfWidth = 0.5 * self.extrusionWidth
			loop = euclidean.getLoopStartingNearest( extrusionHalfWidth, self.beforeLoopLocation, loop )
		if jitterDistance != 0.0:
			loop = self.getJitteredLoop( jitterDistance, loop )
			loop = euclidean.getAwayPoints( loop, 0.2 * self.fillInset )
		self.loopPath.path = loop + [ loop[ 0 ] ]
		self.addGcodeFromThreadZ( self.loopPath.path, self.loopPath.z )
		self.loopPath = None
Ejemplo n.º 6
0
 def addTailoredLoopPath(self):
     "Add a clipped and jittered loop path."
     loop = self.loopPath.path[:-1]
     jitterDistance = self.layerJitter + self.arrivalInsetFollowDistance
     if self.beforeLoopLocation != None:
         extrusionHalfWidth = 0.5 * self.extrusionWidth
         loop = euclidean.getLoopStartingNearest(extrusionHalfWidth,
                                                 self.beforeLoopLocation,
                                                 loop)
     if jitterDistance != 0.0:
         loop = self.getJitteredLoop(jitterDistance, loop)
         loop = euclidean.getAwayPoints(loop, 0.2 * self.fillInset)
     self.loopPath.path = loop + [loop[0]]
     self.addGcodeFromThreadZ(self.loopPath.path, self.loopPath.z)
     self.loopPath = None
Ejemplo n.º 7
0
	def addTailoredLoopPath( self ):
		"Add a clipped and jittered loop path."
		loop = self.loopPath.path[ : - 1 ]
		if self.beforeLoopLocation != None:
			if self.oldLoopLocationComplex != None:
				self.beforeLoopLocation = self.oldLoopLocationComplex
			perimeterHalfWidth = 0.5 * self.perimeterWidth
			loop = euclidean.getLoopStartingNearest( perimeterHalfWidth, self.beforeLoopLocation, loop )
		if self.layerJitter != 0.0 and self.oldLoopLocationComplex == None:
			loop = getJitteredLoop( self.layerJitter, loop )
			loop = euclidean.getAwayPoints( loop, 0.2 * self.perimeterWidth )
		self.loopPath.path = loop + [ loop[ 0 ] ]
		self.addGcodeFromThreadZ( self.loopPath.path, self.loopPath.z )
		self.oldLoopLocationComplex = loop[ 0 ]
		self.loopPath = None
Ejemplo n.º 8
0
	def addCoilToThread( self, beginLocation, endZ, loop, thread ):
		"Add a coil to the thread."
		if len( loop ) < 1:
			return
		loop = euclidean.getLoopStartingNearest( self.halfPerimeterWidth, self.oldLocationComplex, loop )
		length = euclidean.getPolygonLength( loop )
		if length <= 0.0:
			return
		oldPoint = loop[ 0 ]
		pathLength = 0.0
		for point in loop[ 1 : ]:
			pathLength += abs( point - oldPoint )
			along = pathLength / length
			z = ( 1.0 - along ) * beginLocation.z + along * endZ
			location = Vector3( point.real, point.imag, z )
			thread.append( location )
			oldPoint = point
		self.oldLocationComplex = loop[ - 1 ]
Ejemplo n.º 9
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:]
Ejemplo n.º 10
0
 def addCoilToThread(self, beginLocation, endZ, loop, thread):
     "Add a coil to the thread."
     if len(loop) < 1:
         return
     loop = euclidean.getLoopStartingNearest(self.halfPerimeterWidth,
                                             self.oldLocationComplex, loop)
     length = euclidean.getPolygonLength(loop)
     if length <= 0.0:
         return
     oldPoint = loop[0]
     pathLength = 0.0
     for point in loop[1:]:
         pathLength += abs(point - oldPoint)
         along = pathLength / length
         z = (1.0 - along) * beginLocation.z + along * endZ
         location = Vector3(point.real, point.imag, z)
         thread.append(location)
         oldPoint = point
     self.oldLocationComplex = loop[-1]
Ejemplo n.º 11
0
def addOperatingOrbits( boundaryLoops, pointComplex, skein, temperatureChangeTime, z ):
	"Add the orbits before the operating layers."
	if len( boundaryLoops ) < 1:
		return
	largestLength = - 999999999.0
	largestLoop = None
	perimeterOutset = 0.4 * skein.extrusionPerimeterWidth
	greaterThanPerimeterOutset = 1.1 * perimeterOutset
	for boundaryLoop in boundaryLoops:
		centers = getCentersFromLoopDirection( True, boundaryLoop, greaterThanPerimeterOutset )
		for center in centers:
			outset = getSimplifiedInsetFromClockwiseLoop( center, perimeterOutset )
			if euclidean.isLargeSameDirection( outset, center, perimeterOutset ):
				loopLength = euclidean.getPolygonLength( outset )
				if loopLength > largestLength:
					largestLength = loopLength
					largestLoop = outset
	if largestLoop == None:
		return
	if pointComplex != None:
		largestLoop = euclidean.getLoopStartingNearest( skein.extrusionPerimeterWidth, pointComplex, largestLoop )
	addOrbits( largestLoop, skein, temperatureChangeTime, z )
Ejemplo n.º 12
0
	def addCoolOrbits( self, remainingOrbitTime ):
		"Add the minimum radius cool orbits."
		if len( self.boundaryLayer.loops ) < 1:
			return
		insetBoundaryLoops = intercircle.getInsetLoopsFromLoops( self.perimeterWidth, self.boundaryLayer.loops )
		if len( insetBoundaryLoops ) < 1:
			insetBoundaryLoops = self.boundaryLayer.loops
		largestLoop = euclidean.getLargestLoop( insetBoundaryLoops )
		loopArea = abs( euclidean.getPolygonArea( largestLoop ) )
		if loopArea < self.minimumArea:
			center = 0.5 * ( euclidean.getMaximumFromPoints( largestLoop ) + euclidean.getMinimumFromPoints( largestLoop ) )
			centerXBounded = max( center.real, self.boundingRectangle.cornerMinimum.real )
			centerXBounded = min( centerXBounded, self.boundingRectangle.cornerMaximum.real )
			centerYBounded = max( center.imag, self.boundingRectangle.cornerMinimum.imag )
			centerYBounded = min( centerYBounded, self.boundingRectangle.cornerMaximum.imag )
			center = complex( centerXBounded, centerYBounded )
			maximumCorner = center + self.halfCorner
			minimumCorner = center - self.halfCorner
			largestLoop = euclidean.getSquareLoop( minimumCorner, maximumCorner )
		pointComplex = euclidean.getXYComplexFromVector3( self.oldLocation )
		if pointComplex != None:
			largestLoop = euclidean.getLoopStartingNearest( self.perimeterWidth, pointComplex, largestLoop )
		intercircle.addOrbitsIfLarge( self.distanceFeedRate, largestLoop, self.orbitalFeedRatePerSecond, remainingOrbitTime, self.highestZ )