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.edgeWidth): insetBoundaryLoops = intercircle.getInsetLoopsFromLoops(self.boundaryLayer.loops, -self.repository.orbitalOutset.value) 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.getLoopStartingClosest(self.edgeWidth, pointComplex, largestLoop) intercircle.addOrbitsIfLarge( self.distanceFeedRate, largestLoop, self.orbitalFeedRatePerSecond, remainingOrbitTime, self.highestZ)
def cool(self, layer): '''Apply the cooling by moving the nozzle around the print.''' if layer.index == 0: # We don't have to slow down on the first layer return (layerDistance, layerDuration) = layer.getDistanceAndDuration() remainingOrbitTime = max(self.minimumLayerTime - layerDuration, 0.0) boundaryLayerLoops = [] for nestedRing in layer.nestedRings: boundaryLayerLoops.append(nestedRing.getXYBoundaries()) if remainingOrbitTime > 0.0 and boundaryLayerLoops != None: if len(boundaryLayerLoops) < 1: return largestLoop = euclidean.getLargestLoop(boundaryLayerLoops) cornerMinimum = euclidean.getMinimumByComplexPath(largestLoop) - self.oribitalMargin cornerMaximum = euclidean.getMaximumByComplexPath(largestLoop) + self.oribitalMargin largestLoop = euclidean.getSquareLoopWiddershins(cornerMaximum, cornerMinimum) if len(largestLoop) > 1 and remainingOrbitTime > 1.5 : timeInOrbit = 0.0 while timeInOrbit < remainingOrbitTime: for point in largestLoop: gcodeArgs = [('X', round(point.real, self.decimalPlaces)), ('Y', round(point.imag, self.decimalPlaces)), ('Z', round(layer.z, self.decimalPlaces)), ('F', round(self.orbitalFeedRateMinute, self.decimalPlaces))] layer.preLayerGcodeCommands.append(GcodeCommand(gcodes.LINEAR_GCODE_MOVEMENT, gcodeArgs)) timeInOrbit += euclidean.getLoopLength(largestLoop) / self.orbitalFeedRateSecond
def getFromLoop( self, loop ): 'Get the bounding loop from a path.' self.loop = loop self.maximum = euclidean.getMaximumByComplexPath(loop) self.minimum = euclidean.getMinimumByComplexPath(loop) return self