def addWiden(self, rotatedLoopLayer): "Add widen to the layer." trianglemesh.sortLoopsInOrderOfArea(False, rotatedLoopLayer.loops) widdershinsLoops = [] clockwiseInsetLoops = [] for loopIndex in xrange(len(rotatedLoopLayer.loops)): loop = rotatedLoopLayer.loops[loopIndex] if euclidean.isWiddershins(loop): otherLoops = rotatedLoopLayer.loops[: loopIndex] + rotatedLoopLayer.loops[ loopIndex + 1:] leftPoint = euclidean.getLeftPoint(loop) if getIsPointInsideALoop(otherLoops, leftPoint): self.distanceFeedRate.addGcodeFromLoop( loop, rotatedLoopLayer.z) else: widdershinsLoops.append(loop) else: # clockwiseInsetLoop = intercircle.getLargestInsetLoopFromLoop(loop, self.doublePerimeterWidth) # clockwiseInsetLoop.reverse() # clockwiseInsetLoops.append(clockwiseInsetLoop) clockwiseInsetLoops += intercircle.getInsetLoopsFromLoop( loop, self.doublePerimeterWidth) self.distanceFeedRate.addGcodeFromLoop(loop, rotatedLoopLayer.z) for widdershinsLoop in widdershinsLoops: outsetLoop = intercircle.getLargestInsetLoopFromLoop( widdershinsLoop, -self.doublePerimeterWidth) widenedLoop = getWidenedLoop(widdershinsLoop, clockwiseInsetLoops, outsetLoop, self.perimeterWidth) self.distanceFeedRate.addGcodeFromLoop(widenedLoop, rotatedLoopLayer.z)
def flipDirectLayer(self, rotatedLoopLayer): "Flip the y coordinate of the layer and direct the loops." for loop in rotatedLoopLayer.loops: for pointIndex, point in enumerate(loop): loop[pointIndex] = complex(point.real, -point.imag) trianglemesh.sortLoopsInOrderOfArea(True, rotatedLoopLayer.loops) for loopIndex, loop in enumerate(rotatedLoopLayer.loops): isInsideLoops = euclidean.getIsInFilledRegion(rotatedLoopLayer.loops[: loopIndex], euclidean.getLeftPoint(loop)) intercircle.directLoop((not isInsideLoops), loop)
def flipDirectLayer(self, rotatedLoopLayer): "Flip the y coordinate of the layer and direct the loops." for loop in rotatedLoopLayer.loops: for pointIndex, point in enumerate(loop): loop[pointIndex] = complex(point.real, -point.imag) trianglemesh.sortLoopsInOrderOfArea(True, rotatedLoopLayer.loops) for loopIndex, loop in enumerate(rotatedLoopLayer.loops): isInsideLoops = euclidean.getIsInFilledRegion( rotatedLoopLayer.loops[:loopIndex], euclidean.getLeftPoint(loop)) intercircle.directLoop((not isInsideLoops), loop)
def addInset( self, rotatedLoopLayer ): "Add inset to the layer." alreadyFilledArounds = [] halfWidth = self.halfPerimeterWidth if rotatedLoopLayer.rotation != None: halfWidth *= self.repository.bridgeWidthMultiplier.value self.distanceFeedRate.addTagBracketedLine('bridgeRotation', rotatedLoopLayer.rotation ) extrudateLoops = intercircle.getInsetLoopsFromLoops( halfWidth, rotatedLoopLayer.loops ) trianglemesh.sortLoopsInOrderOfArea(not self.repository.loopOrderAscendingArea.value, extrudateLoops) for extrudateLoop in extrudateLoops: self.addGcodeFromRemainingLoop( extrudateLoop, alreadyFilledArounds, halfWidth, rotatedLoopLayer.z )
def addInset(self, rotatedLoopLayer): "Add inset to the layer." alreadyFilledArounds = [] halfWidth = self.halfPerimeterWidth if rotatedLoopLayer.rotation != None: halfWidth *= self.repository.bridgeWidthMultiplier.value self.distanceFeedRate.addTagBracketedLine( 'bridgeRotation', rotatedLoopLayer.rotation) extrudateLoops = intercircle.getInsetLoopsFromLoops( halfWidth, rotatedLoopLayer.loops) trianglemesh.sortLoopsInOrderOfArea( not self.repository.loopOrderAscendingArea.value, extrudateLoops) for extrudateLoop in extrudateLoops: self.addGcodeFromRemainingLoop(extrudateLoop, alreadyFilledArounds, halfWidth, rotatedLoopLayer.z)
def addOutset(self, rotatedLoopLayer): "Add outset to the layer." extrudateLoops = intercircle.getInsetLoopsFromLoops( -self.absoluteHalfPerimeterWidth, rotatedLoopLayer.loops) sortedLoops = trianglemesh.sortLoopsInOrderOfArea( False, extrudateLoops) for sortedLoop in sortedLoops: self.addGcodeFromRemainingLoop(sortedLoop, self.absoluteHalfPerimeterWidth, rotatedLoopLayer.z)
def addWiden(self, rotatedLoopLayer): "Add widen to the layer." trianglemesh.sortLoopsInOrderOfArea(False, rotatedLoopLayer.loops) widdershinsLoops = [] clockwiseInsetLoops = [] for loopIndex in xrange(len(rotatedLoopLayer.loops)): loop = rotatedLoopLayer.loops[loopIndex] if euclidean.isWiddershins(loop): otherLoops = rotatedLoopLayer.loops[: loopIndex] + rotatedLoopLayer.loops[loopIndex + 1 :] leftPoint = euclidean.getLeftPoint(loop) if getIsPointInsideALoop(otherLoops, leftPoint): self.distanceFeedRate.addGcodeFromLoop(loop, rotatedLoopLayer.z) else: widdershinsLoops.append(loop) else: # clockwiseInsetLoop = intercircle.getLargestInsetLoopFromLoop(loop, self.doublePerimeterWidth) # clockwiseInsetLoop.reverse() # clockwiseInsetLoops.append(clockwiseInsetLoop) clockwiseInsetLoops += intercircle.getInsetLoopsFromLoop(loop, self.doublePerimeterWidth) self.distanceFeedRate.addGcodeFromLoop(loop, rotatedLoopLayer.z) for widdershinsLoop in widdershinsLoops: outsetLoop = intercircle.getLargestInsetLoopFromLoop(widdershinsLoop, -self.doublePerimeterWidth) widenedLoop = getWidenedLoop(widdershinsLoop, clockwiseInsetLoops, outsetLoop, self.perimeterWidth) self.distanceFeedRate.addGcodeFromLoop(widenedLoop, rotatedLoopLayer.z)
def addOutset(self, rotatedLoopLayer): "Add outset to the layer." extrudateLoops = intercircle.getInsetLoopsFromLoops(-self.absoluteHalfPerimeterWidth, rotatedLoopLayer.loops) sortedLoops = trianglemesh.sortLoopsInOrderOfArea(False, extrudateLoops) for sortedLoop in sortedLoops: self.addGcodeFromRemainingLoop(sortedLoop, self.absoluteHalfPerimeterWidth, rotatedLoopLayer.z)