def addWiden(self, rotatedBoundaryLayer): "Add widen to the layer." loops = triangle_mesh.getLoopsInOrderOfArea( triangle_mesh.compareAreaAscending, rotatedBoundaryLayer.loops) widdershinsLoops = [] clockwiseInsetLoops = [] for loopIndex in xrange(len(loops)): loop = loops[loopIndex] if euclidean.isWiddershins(loop): otherLoops = loops[:loopIndex] + loops[loopIndex + 1:] leftPoint = euclidean.getLeftPoint(loop) if euclidean.isPointInsideLoops(otherLoops, leftPoint): self.distanceFeedRate.addGcodeFromLoop( loop, rotatedBoundaryLayer.z) else: widdershinsLoops.append(loop) else: clockwiseInsetLoops += intercircle.getInsetLoopsFromLoop( self.doublePerimeterWidth, loop) self.distanceFeedRate.addGcodeFromLoop(loop, rotatedBoundaryLayer.z) for widdershinsLoop in widdershinsLoops: outsetLoop = intercircle.getLargestInsetLoopFromLoop( widdershinsLoop, -self.doublePerimeterWidth) widenedLoop = getWidenedLoop(widdershinsLoop, clockwiseInsetLoops, outsetLoop, self.perimeterWidth, self.tinyRadius) self.distanceFeedRate.addGcodeFromLoop(widenedLoop, rotatedBoundaryLayer.z)
def getBetweens( self ): "Set betweens for the layer." if self.layerZ in self.betweenTable: return self.betweenTable[ self.layerZ ] if self.layerZ not in self.layerTable: return [] self.betweenTable[ self.layerZ ] = [] for boundaryLoop in self.layerTable[ self.layerZ ]: self.betweenTable[ self.layerZ ] += intercircle.getInsetLoopsFromLoop( self.betweenInset, boundaryLoop ) return self.betweenTable[ self.layerZ ]
def getBetweens(self): "Set betweens for the layer." if self.layerZ in self.betweenTable: return self.betweenTable[self.layerZ] if self.layerZ not in self.layerTable: return [] self.betweenTable[self.layerZ] = [] for boundaryLoop in self.layerTable[self.layerZ]: self.betweenTable[ self.layerZ] += intercircle.getInsetLoopsFromLoop( self.betweenInset, boundaryLoop) return self.betweenTable[self.layerZ]
def addInset( self, rotatedBoundaryLayer ): "Add inset to the carve layer." alreadyFilledArounds = [] halfWidth = self.halfExtrusionPerimeterWidth self.addLine( '(<layer> %s )' % rotatedBoundaryLayer.z ) # Indicate that a new layer is starting. if rotatedBoundaryLayer.rotation != None: halfWidth *= self.infillBridgeWidthOverExtrusionWidth self.addLine( '(<bridgeDirection> ' + str( rotatedBoundaryLayer.rotation ) + ' </bridgeDirection>)' ) # Indicate the bridge direction. for loop in rotatedBoundaryLayer.loops: extrudateLoops = intercircle.getInsetLoopsFromLoop( halfWidth, loop ) for extrudateLoop in extrudateLoops: self.addGcodeFromRemainingLoop( extrudateLoop, alreadyFilledArounds, halfWidth, rotatedBoundaryLayer.z ) addAlreadyFilledArounds( alreadyFilledArounds, extrudateLoop, self.fillInset ) self.addLine( '(</layer>)' )
def addInset(self, rotatedBoundaryLayer): "Add inset to the carve layer." alreadyFilledArounds = [] halfWidth = self.halfExtrusionPerimeterWidth self.addLine( '(<layer> %s )' % rotatedBoundaryLayer.z) # Indicate that a new layer is starting. if rotatedBoundaryLayer.rotation != None: halfWidth *= self.infillBridgeWidthOverExtrusionWidth self.addLine( '(<bridgeDirection> ' + str(rotatedBoundaryLayer.rotation) + ' </bridgeDirection>)') # Indicate the bridge direction. for loop in rotatedBoundaryLayer.loops: extrudateLoops = intercircle.getInsetLoopsFromLoop(halfWidth, loop) for extrudateLoop in extrudateLoops: self.addGcodeFromRemainingLoop(extrudateLoop, alreadyFilledArounds, halfWidth, rotatedBoundaryLayer.z) addAlreadyFilledArounds(alreadyFilledArounds, extrudateLoop, self.fillInset) self.addLine('(</layer>)')
def addWiden( self, rotatedBoundaryLayer ): "Add widen to the layer." loops = triangle_mesh.getLoopsInOrderOfArea( triangle_mesh.compareAreaAscending, rotatedBoundaryLayer.loops ) widdershinsLoops = [] clockwiseInsetLoops = [] for loopIndex in xrange( len( loops ) ): loop = loops[ loopIndex ] if euclidean.isWiddershins( loop ): otherLoops = loops[ : loopIndex ] + loops[ loopIndex + 1 : ] leftPoint = euclidean.getLeftPoint( loop ) if euclidean.isPointInsideLoops( otherLoops, leftPoint ): self.distanceFeedRate.addGcodeFromLoop( loop, rotatedBoundaryLayer.z ) else: widdershinsLoops.append( loop ) else: clockwiseInsetLoops += intercircle.getInsetLoopsFromLoop( self.doublePerimeterWidth, loop ) self.distanceFeedRate.addGcodeFromLoop( loop, rotatedBoundaryLayer.z ) for widdershinsLoop in widdershinsLoops: outsetLoop = intercircle.getLargestInsetLoopFromLoop( widdershinsLoop, - self.doublePerimeterWidth ) widenedLoop = getWidenedLoop( widdershinsLoop, clockwiseInsetLoops, outsetLoop, self.perimeterWidth, self.tinyRadius ) self.distanceFeedRate.addGcodeFromLoop( widenedLoop, rotatedBoundaryLayer.z )