Example #1
0
    def getLayer(self, layer, output, parentLookaheadStartVector=None, verbose=False):
        '''Final Gcode representation.'''
        for preLayerGcodeCommand in layer.preLayerGcodeCommands:
            output.write(printCommand(preLayerGcodeCommand, verbose))

        if layer.runtimeParameters.combActive:
            combSkein = CombSkein(layer)
        else:
            combSkein = None

        pathList = layer.getOrderedPathList()
        paths.resetExtrusionStats()

        pathListCount = len(pathList)
        for (index, path) in enumerate(pathList):
            if index + 1 < pathListCount:
                lookaheadStartPoint = pathList[index + 1].getStartPoint()
                lookaheadVector = Vector3(lookaheadStartPoint.real, lookaheadStartPoint.imag, layer.z)
            else:
                lookaheadVector = parentLookaheadStartVector

            previousVector = None
            if index > 0:
                previousPoint = pathList[index - 1].getEndPoint()
                previousVector = Vector3(previousPoint.real, previousPoint.imag, layer.z)

            nextPoint = path.getStartPoint()
            nextVector = Vector3(nextPoint.real, nextPoint.imag, layer.z)

            travelPath = TravelPath(layer.runtimeParameters, previousVector, nextVector, combSkein)

            #TODO: We should have used sum of layer.z and containing nestedRing.z as pathheight here,
            #but this information is lost by getOrderedPathList method and nestedRing.z is allways
            #zero, so using plain layer.z is OK for now.
            self.getPath(travelPath, layer.z, output, None, layer.feedAndFlowRateMultiplier, verbose)

            self.getPath(path, layer.z, output, lookaheadVector, layer.feedAndFlowRateMultiplier, verbose)

        for postLayerGcodeCommand in layer.postLayerGcodeCommands:
            output.write(printCommand(postLayerGcodeCommand, verbose))
 def getLayer(self, layer, output, parentLookaheadStartVector=None, verbose=False):
     '''Final Gcode representation.'''
     for preLayerGcodeCommand in layer.preLayerGcodeCommands:
         output.write(printCommand(preLayerGcodeCommand, verbose))
     
     if layer.runtimeParameters.combActive: 
         combSkein = CombSkein(layer)
     else:
         combSkein = None                        
     
     pathList = layer.getOrderedPathList()
     paths.resetExtrusionStats()
     
     pathListCount = len(pathList)
     for (index, path) in enumerate(pathList):
         if index + 1 < pathListCount:
             lookaheadStartPoint = pathList[index + 1].getStartPoint()
             lookaheadVector = Vector3(lookaheadStartPoint.real, lookaheadStartPoint.imag, layer.z)
         else:
             lookaheadVector = parentLookaheadStartVector
             
         previousVector = None
         if index > 0:
             previousPoint = pathList[index - 1].getEndPoint()
             previousVector = Vector3(previousPoint.real, previousPoint.imag, layer.z)
             
         nextPoint = path.getStartPoint()
         nextVector = Vector3(nextPoint.real, nextPoint.imag, layer.z)
         
         travelPath = TravelPath(layer.z, layer.runtimeParameters, previousVector, nextVector, combSkein)
         
         self.getPath(travelPath, output, lookaheadVector, layer.feedAndFlowRateMultiplier, verbose)
         
         self.getPath(path, output, lookaheadVector, layer.feedAndFlowRateMultiplier, verbose)
     
     for postLayerGcodeCommand in layer.postLayerGcodeCommands:
         output.write(printCommand(postLayerGcodeCommand, verbose))