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 = euclidean.getAreaLoopAbsolute(largestLoop) if loopArea < self.minimumArea: center = 0.5 * (euclidean.getMaximumByComplexPath(largestLoop) + euclidean.getMinimumByComplexPath(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.getSquareLoopWiddershins( 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)
def addCoolOrbits(self, remainingOrbitTime): "Add the minimum radius cool orbits." if len(self.boundaryLayer.loops) < 1: return insetBoundaryLoops = self.boundaryLayer.loops if abs(self.repository.orbitalOutset.value) > 0.1 * abs(self.perimeterWidth): insetBoundaryLoops = intercircle.getInsetLoopsFromLoops( -self.repository.orbitalOutset.value, self.boundaryLayer.loops ) if len(insetBoundaryLoops) < 1: insetBoundaryLoops = self.boundaryLayer.loops largestLoop = euclidean.getLargestLoop(insetBoundaryLoops) loopArea = euclidean.getAreaLoopAbsolute(largestLoop) if loopArea < self.minimumArea: center = 0.5 * ( euclidean.getMaximumByComplexPath(largestLoop) + euclidean.getMinimumByComplexPath(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.getSquareLoopWiddershins(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 )
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
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
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.getLoopLength(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]
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.getLoopLength(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]