Exemple #1
0
	def addSkinnedInfillBoundary(self, infillBoundaries, offsetY, upperZ, z):
		'Add skinned infill boundary.'
		aroundInset = 0.24321 * self.skinInfillInset
		arounds = []
		aroundWidth = 0.24321 * self.skinInfillInset
		endpoints = []
		pixelTable = {}
		rotatedLoops = []
		for infillBoundary in infillBoundaries:
			infillBoundaryRotated = euclidean.getRotatedComplexes(self.reverseRotation, infillBoundary)
			if offsetY != 0.0:
				for infillPointRotatedIndex, infillPointRotated in enumerate(infillBoundaryRotated):
					infillBoundaryRotated[infillPointRotatedIndex] = complex(infillPointRotated.real, infillPointRotated.imag - offsetY)
			rotatedLoops.append(infillBoundaryRotated)
		infillDictionary = triangle_mesh.getInfillDictionary(
			aroundInset, arounds, aroundWidth, self.skinInfillInset, self.skinInfillWidth, pixelTable, rotatedLoops)
		for infillDictionaryKey in infillDictionary.keys():
			xIntersections = infillDictionary[infillDictionaryKey]
			xIntersections.sort()
			for segment in euclidean.getSegmentsFromXIntersections(xIntersections, infillDictionaryKey * self.skinInfillWidth):
				for endpoint in segment:
					endpoint.point = complex(endpoint.point.real, endpoint.point.imag + offsetY)
					endpoints.append(endpoint)
		infillPaths = euclidean.getPathsFromEndpoints(endpoints, 5.0 * self.skinInfillWidth, pixelTable, aroundWidth)
		for infillPath in infillPaths:
			infillRotated = euclidean.getRotatedComplexes(self.rotation, infillPath)
			if upperZ > z and self.repository.hopWhenExtrudingInfill.value:
				self.distanceFeedRate.addGcodeMovementZWithFeedRate(self.maximumZFeedRateMinute, infillRotated[0], upperZ)
			self.distanceFeedRate.addGcodeFromFeedRateThreadZ(self.feedRateMinute, infillRotated, self.travelFeedRateMinute, z)
			lastPointRotated = infillRotated[-1]
			self.oldLocation = Vector3(lastPointRotated.real, lastPointRotated.imag, upperZ)
			if upperZ > z and self.repository.hopWhenExtrudingInfill.value:
				self.distanceFeedRate.addGcodeMovementZWithFeedRate(self.maximumZFeedRateMinute, lastPointRotated, upperZ)
Exemple #2
0
	def addSkinnedInfillBoundary(self, infillBoundaries, offsetY, upperZ, z):
		'Add skinned infill boundary.'
		arounds = []
		aroundWidth = 0.34321 * self.skinInfillInset
		endpoints = []
		pixelTable = {}
		rotatedLoops = []
		for infillBoundary in infillBoundaries:
			infillBoundaryRotated = euclidean.getRotatedComplexes(self.reverseRotation, infillBoundary)
			if offsetY != 0.0:
				for infillPointRotatedIndex, infillPointRotated in enumerate(infillBoundaryRotated):
					infillBoundaryRotated[infillPointRotatedIndex] = complex(infillPointRotated.real, infillPointRotated.imag - offsetY)
			rotatedLoops.append(infillBoundaryRotated)
		infillDictionary = triangle_mesh.getInfillDictionary(
			arounds, aroundWidth, self.skinInfillInset, self.skinInfillWidth, pixelTable, rotatedLoops)
		for infillDictionaryKey in infillDictionary.keys():
			xIntersections = infillDictionary[infillDictionaryKey]
			xIntersections.sort()
			for segment in euclidean.getSegmentsFromXIntersections(xIntersections, infillDictionaryKey * self.skinInfillWidth):
				for endpoint in segment:
					endpoint.point = complex(endpoint.point.real, endpoint.point.imag + offsetY)
					endpoints.append(endpoint)
		infillPaths = euclidean.getPathsFromEndpoints(endpoints, 5.0 * self.skinInfillWidth, pixelTable, aroundWidth)
		for infillPath in infillPaths:
			infillRotated = euclidean.getRotatedComplexes(self.rotation, infillPath)
			if upperZ > z and self.repository.hopWhenExtrudingInfill.value:
				self.distanceFeedRate.addGcodeMovementZWithFeedRate(self.maximumZFeedRateMinute, infillRotated[0], upperZ)
			self.distanceFeedRate.addGcodeFromFeedRateThreadZ(self.feedRateMinute, infillRotated, self.travelFeedRateMinute, z)
			lastPointRotated = infillRotated[-1]
			self.oldLocation = Vector3(lastPointRotated.real, lastPointRotated.imag, upperZ)
			if upperZ > z and self.repository.hopWhenExtrudingInfill.value:
				self.distanceFeedRate.addGcodeMovementZWithFeedRate(self.maximumZFeedRateMinute, lastPointRotated, upperZ)
    def addSupportLayer(self, endpoints, layer):
        'Add support layer before the object layer.'

        # TODO refactor to parent object - avoid duplication
        for line in self.supportStartLines:
            layer.preSupportGcodeCommands.append(line)

        aroundPixelTable = {}
        aroundWidth = 0.25 * self.interfaceStep
        boundaryLoops = self.boundaryLayers[layer.index]
        halfSupportOutset = 0.5 * self.supportOutset
        aroundBoundaryLoops = intercircle.getAroundsFromLoops(
            boundaryLoops, halfSupportOutset)
        for aroundBoundaryLoop in aroundBoundaryLoops:
            euclidean.addLoopToPixelTable(aroundBoundaryLoop, aroundPixelTable,
                                          aroundWidth)
        paths = euclidean.getPathsFromEndpoints(endpoints,
                                                1.5 * self.interfaceStep,
                                                aroundPixelTable, aroundWidth)
        feedRateMinuteMultiplied = self.supportFeedRate * 60
        supportFlowRateMultiplied = self.supportFlowRateRatio * self.supportFeedRate

        for path in paths:
            supportPath = SupportPath(self.slicedModel.runtimeParameters)
            supportPath.addPath(path)
            layer.supportPaths.append(supportPath)

        layer.postSupportGcodeCommands.extend(self.supportEndLines)
Exemple #4
0
 def addSkinnedInfillBoundary(self, infillBoundaries, offsetY, upperZ, z):
     "Add skinned infill boundary."
     arounds = []
     aroundWidth = 0.34321 * self.skinInfillInset
     endpoints = []
     pixelTable = {}
     rotatedLoops = []
     for infillBoundary in infillBoundaries:
         infillBoundaryRotated = euclidean.getRotatedComplexes(self.reverseRotation, infillBoundary)
         if offsetY != 0.0:
             for infillPointRotatedIndex, infillPointRotated in enumerate(infillBoundaryRotated):
                 infillBoundaryRotated[infillPointRotatedIndex] = complex(
                     infillPointRotated.real, infillPointRotated.imag - offsetY
                 )
         rotatedLoops.append(infillBoundaryRotated)
     infillDictionary = triangle_mesh.getInfillDictionary(
         arounds, aroundWidth, self.skinInfillInset, self.skinInfillWidth, pixelTable, rotatedLoops
     )
     for infillDictionaryKey in infillDictionary.keys():
         xIntersections = infillDictionary[infillDictionaryKey]
         xIntersections.sort()
         for segment in euclidean.getSegmentsFromXIntersections(
             xIntersections, infillDictionaryKey * self.skinInfillWidth
         ):
             for endpoint in segment:
                 endpoint.point = complex(endpoint.point.real, endpoint.point.imag + offsetY)
                 endpoints.append(endpoint)
     infillPaths = euclidean.getPathsFromEndpoints(
         endpoints, 5.0 * self.skinInfillWidth, pixelTable, self.sharpestProduct, aroundWidth
     )
     for infillPath in infillPaths:
         addPointBeforeThread = True
         infillRotated = euclidean.getRotatedComplexes(self.rotation, infillPath)
         if upperZ > z and self.repository.hopWhenExtrudingInfill.value:
             feedRateMinute = self.travelFeedRateMinute
             infillRotatedFirst = infillRotated[0]
             location = Vector3(infillRotatedFirst.real, infillRotatedFirst.imag, upperZ)
             distance = abs(location - self.oldLocation)
             if distance > 0.0:
                 deltaZ = abs(upperZ - self.oldLocation.z)
                 zFeedRateComponent = feedRateMinute * deltaZ / distance
                 if zFeedRateComponent > self.maximumZFeedRateMinute:
                     feedRateMinute *= self.maximumZFeedRateMinute / zFeedRateComponent
             self.distanceFeedRate.addGcodeMovementZWithFeedRate(feedRateMinute, infillRotatedFirst, upperZ)
             self.distanceFeedRate.addGcodeMovementZWithFeedRate(self.maximumZFeedRateMinute, infillRotatedFirst, z)
             addPointBeforeThread = False
         if addPointBeforeThread:
             self.distanceFeedRate.addGcodeMovementZ(infillRotated[0], z)
         self.distanceFeedRate.addLine("M101")
         for point in infillRotated[1:]:
             self.distanceFeedRate.addGcodeMovementZ(point, z)
         self.distanceFeedRate.addLine("M103")
         lastPointRotated = infillRotated[-1]
         self.oldLocation = Vector3(lastPointRotated.real, lastPointRotated.imag, upperZ)
         if upperZ > z and self.repository.hopWhenExtrudingInfill.value:
             self.distanceFeedRate.addGcodeMovementZWithFeedRate(
                 self.maximumZFeedRateMinute, lastPointRotated, upperZ
             )
Exemple #5
0
	def addSkinnedInfillBoundary(self, infillBoundaries, offsetY, upperZ, z):
		'Add skinned infill boundary.'
		arounds = []
		aroundWidth = 0.34321 * self.skinInfillInset
		endpoints = []
		pixelTable = {}
		rotatedLoops = []
		for infillBoundary in infillBoundaries:
			infillBoundaryRotated = euclidean.getRotatedComplexes(self.reverseRotation, infillBoundary)
			if offsetY != 0.0:
				for infillPointRotatedIndex, infillPointRotated in enumerate(infillBoundaryRotated):
					infillBoundaryRotated[infillPointRotatedIndex] = complex(infillPointRotated.real, infillPointRotated.imag - offsetY)
			rotatedLoops.append(infillBoundaryRotated)
		infillDictionary = triangle_mesh.getInfillDictionary(
			arounds, aroundWidth, self.skinInfillInset, self.skinInfillWidth, pixelTable, rotatedLoops)
		for infillDictionaryKey in infillDictionary.keys():
			xIntersections = infillDictionary[infillDictionaryKey]
			xIntersections.sort()
			for segment in euclidean.getSegmentsFromXIntersections(xIntersections, infillDictionaryKey * self.skinInfillWidth):
				for endpoint in segment:
					endpoint.point = complex(endpoint.point.real, endpoint.point.imag + offsetY)
					endpoints.append(endpoint)
		infillPaths = euclidean.getPathsFromEndpoints(endpoints, 5.0 * self.skinInfillWidth, pixelTable, self.sharpestProduct, aroundWidth)
		for infillPath in infillPaths:
			addPointBeforeThread = True
			infillRotated = euclidean.getRotatedComplexes(self.rotation, infillPath)
			if upperZ > z and self.repository.hopWhenExtrudingInfill.value:
				feedRateMinute = self.travelFeedRateMinute
				infillRotatedFirst = infillRotated[0]
				location = Vector3(infillRotatedFirst.real, infillRotatedFirst.imag, upperZ)
				distance = abs(location - self.oldLocation)
				if distance > 0.0:
					deltaZ = abs(upperZ - self.oldLocation.z)
					zFeedRateComponent = feedRateMinute * deltaZ / distance
					if zFeedRateComponent > self.maximumZFeedRateMinute:
						feedRateMinute *= self.maximumZFeedRateMinute / zFeedRateComponent
				self.distanceFeedRate.addGcodeMovementZWithFeedRate(feedRateMinute, infillRotatedFirst, upperZ)
				self.distanceFeedRate.addGcodeMovementZWithFeedRate(self.maximumZFeedRateMinute, infillRotatedFirst, z)
				addPointBeforeThread = False
			if addPointBeforeThread:
				self.distanceFeedRate.addGcodeMovementZ(infillRotated[0], z)
			self.distanceFeedRate.addLine('M101')
			for point in infillRotated[1 :]:
				self.distanceFeedRate.addGcodeMovementZ(point, z)
			self.distanceFeedRate.addLine('M103')
			lastPointRotated = infillRotated[-1]
			self.oldLocation = Vector3(lastPointRotated.real, lastPointRotated.imag, upperZ)
			if upperZ > z and self.repository.hopWhenExtrudingInfill.value:
				self.distanceFeedRate.addGcodeMovementZWithFeedRate(self.maximumZFeedRateMinute, lastPointRotated, upperZ)
Exemple #6
0
	def addMillThreads(self):
		'Add the mill threads to the skein.'
		boundaryLayer = self.boundaryLayers[self.layerIndex]
		endpoints = euclidean.getEndpointsFromSegmentTable( boundaryLayer.segmentTable )
		if len(endpoints) < 1:
			return
		paths = euclidean.getPathsFromEndpoints(endpoints, 5.0 * self.millWidth, self.aroundPixelTable, self.aroundWidth)
		averageZ = self.average.getAverage()
		if self.repository.addInnerLoops.value:
			self.addGcodeFromLoops( boundaryLayer.innerLoops, averageZ )
		if self.repository.addOuterLoops.value:
			self.addGcodeFromLoops( boundaryLayer.outerLoops, averageZ )
		for path in paths:
			simplifiedPath = euclidean.getSimplifiedPath( path, self.millWidth )
			self.distanceFeedRate.addGcodeFromThreadZ( simplifiedPath, averageZ )
Exemple #7
0
	def addMillThreads(self):
		'Add the mill threads to the skein.'
		boundaryLayer = self.boundaryLayers[self.layerIndex]
		endpoints = euclidean.getEndpointsFromSegmentTable( boundaryLayer.segmentTable )
		if len(endpoints) < 1:
			return
		paths = euclidean.getPathsFromEndpoints(endpoints, 5.0 * self.millWidth, self.aroundPixelTable, 1.0, self.aroundWidth)
		averageZ = self.average.getAverage()
		if self.repository.addInnerLoops.value:
			self.addGcodeFromLoops( boundaryLayer.innerLoops, averageZ )
		if self.repository.addOuterLoops.value:
			self.addGcodeFromLoops( boundaryLayer.outerLoops, averageZ )
		for path in paths:
			simplifiedPath = euclidean.getSimplifiedPath( path, self.millWidth )
			self.distanceFeedRate.addGcodeFromThreadZ( simplifiedPath, averageZ )
    def addSupportLayer(self, endpoints, layer):
        'Add support layer before the object layer.'

        # TODO refactor to parent object - avoid duplication
        for line in self.supportStartLines:
            layer.preSupportGcodeCommands.append(line)

        aroundPixelTable = {}
        aroundWidth = 0.25 * self.interfaceStep
        boundaryLoops = self.boundaryLayers[layer.index]
        halfSupportOutset = 0.5 * self.supportOutset
        aroundBoundaryLoops = intercircle.getAroundsFromLoops(boundaryLoops, halfSupportOutset)
        for aroundBoundaryLoop in aroundBoundaryLoops:
            euclidean.addLoopToPixelTable(aroundBoundaryLoop, aroundPixelTable, aroundWidth)
        paths = euclidean.getPathsFromEndpoints(endpoints, 1.5 * self.interfaceStep, aroundPixelTable, aroundWidth)
        feedRateMinuteMultiplied = self.supportFeedRate * 60
        supportFlowRateMultiplied = self.supportFlowRateRatio * self.supportFeedRate

        for path in paths:
            supportPath = SupportPath(self.slicedModel.runtimeParameters)
            supportPath.addPath(path)
            layer.supportPaths.append(supportPath)

        layer.postSupportGcodeCommands.extend(self.supportEndLines)
    def fill(self, layer):
        'Add fill to the carve layer.'
        layerIndex = layer.index
        alreadyFilledArounds = []
        pixelTable = {}
        arounds = []
        betweenWidth = self.extrusionWidth / 1.7594801994   # this really sucks I cant find hwe#(self.repository.infillWidthOverThickness.value * self.extrusionWidth *(0.7853))/1.5 #- 0.0866#todo todo TODO *0.5 is the distance between the outer loops..
        self.layerExtrusionWidth = self.infillWidth # spacing between fill lines
        layerFillInset = self.infillWidth  # the distance between perimeter incl loops and the fill pattern
        
        layerRotation = self.getLayerRotation(layerIndex, layer)
        reverseRotation = complex(layerRotation.real, -layerRotation.imag)
        surroundingCarves = []
        layerRemainder = layerIndex % self.diaphragmPeriod
        extraShells = self.extraShellsSparseLayer
        
        if layerRemainder >= self.diaphragmThickness and layer.bridgeRotation == None:
            for surroundingIndex in xrange(1, self.solidSurfaceThickness + 1):
                self.addRotatedCarve(layerIndex, -surroundingIndex, reverseRotation, surroundingCarves)
                self.addRotatedCarve(layerIndex, surroundingIndex, reverseRotation, surroundingCarves)

        if len(surroundingCarves) < self.doubleSolidSurfaceThickness:
            extraShells = self.extraShellsAlternatingSolidLayer
            if self.previousExtraShells != self.extraShellsBase:
                extraShells = self.extraShellsBase
         
        if layer.bridgeRotation != None:
            extraShells = 0
            betweenWidth *= self.bridgeWidthMultiplier#/0.7853  #todo check what is better with or without the normalizer
            self.layerExtrusionWidth *= self.bridgeWidthMultiplier
            layerFillInset *= self.bridgeWidthMultiplier
         
        aroundInset = 0.25 * self.layerExtrusionWidth
        aroundWidth = 0.25 * self.layerExtrusionWidth
        self.previousExtraShells = extraShells
        gridPointInsetX = 0.5 * layerFillInset
        doubleExtrusionWidth = 2.0 * self.layerExtrusionWidth
        endpoints = []
        infillPaths = []
        layerInfillSolidity = self.infillSolidity
        
        self.isDoubleJunction = True
        self.isJunctionWide = True
        rotatedLoops = []

        nestedRings = layer.nestedRings
        
        createFillForSurroundings(nestedRings, betweenWidth, False)
         
        for extraShellIndex in xrange(extraShells):
            createFillForSurroundings(nestedRings, self.layerExtrusionWidth, True)

        fillLoops = euclidean.getFillOfSurroundings(nestedRings, None)
        
        slightlyGreaterThanFill = 1.001 * layerFillInset #todo was 1.01 ACT 0.95  How much the parallel fill is filled
         
        for loop in fillLoops:
            alreadyFilledLoop = []
            alreadyFilledArounds.append(alreadyFilledLoop)
            planeRotatedPerimeter = euclidean.getPointsRoundZAxis(reverseRotation, loop)
            rotatedLoops.append(planeRotatedPerimeter)
            centers = intercircle.getCentersFromLoop(planeRotatedPerimeter, slightlyGreaterThanFill)
            euclidean.addLoopToPixelTable(planeRotatedPerimeter, pixelTable, aroundWidth)
            for center in centers:
                alreadyFilledInset = intercircle.getSimplifiedInsetFromClockwiseLoop(center, layerFillInset)
                if intercircle.isLargeSameDirection(alreadyFilledInset, center, layerFillInset):
                    alreadyFilledLoop.append(alreadyFilledInset)
                    around = intercircle.getSimplifiedInsetFromClockwiseLoop(center, aroundInset)
                    if euclidean.isPathInsideLoop(planeRotatedPerimeter, around) == euclidean.isWiddershins(planeRotatedPerimeter):
                        around.reverse()
                        arounds.append(around)
                        euclidean.addLoopToPixelTable(around, pixelTable, aroundWidth)
         
        if len(arounds) < 1:
            self.addThreadsBridgeLayer(layerIndex, nestedRings, layer)
            return
         
        back = euclidean.getBackOfLoops(arounds)
        front = euclidean.getFrontOfLoops(arounds)
        front = math.ceil(front / self.layerExtrusionWidth) * self.layerExtrusionWidth
        fillWidth = back - front
        numberOfLines = int(math.ceil(fillWidth / self.layerExtrusionWidth))
        self.frontOverWidth = 0.0
        self.horizontalSegmentLists = euclidean.getHorizontalSegmentListsFromLoopLists(alreadyFilledArounds, front, numberOfLines, rotatedLoops, self.layerExtrusionWidth)
        self.surroundingXIntersectionLists = []
        self.yList = []
        removedEndpoints = []
         
        if len(surroundingCarves) >= self.doubleSolidSurfaceThickness:
            xIntersectionIndexLists = []
            self.frontOverWidth = euclidean.getFrontOverWidthAddXListYList(front, surroundingCarves, numberOfLines, xIntersectionIndexLists, self.layerExtrusionWidth, self.yList)
            for fillLine in xrange(len(self.horizontalSegmentLists)):
                xIntersectionIndexList = xIntersectionIndexLists[fillLine]
                surroundingXIntersections = euclidean.getIntersectionOfXIntersectionIndexes(self.doubleSolidSurfaceThickness, xIntersectionIndexList)
                self.surroundingXIntersectionLists.append(surroundingXIntersections)
                addSparseEndpoints(doubleExtrusionWidth, endpoints, fillLine, self.horizontalSegmentLists, layerInfillSolidity, removedEndpoints, self.solidSurfaceThickness, surroundingXIntersections)
        else:
            for fillLine in xrange(len(self.horizontalSegmentLists)):
                addSparseEndpoints(doubleExtrusionWidth, endpoints, fillLine, self.horizontalSegmentLists, layerInfillSolidity, removedEndpoints, self.solidSurfaceThickness, None)
         
        paths = euclidean.getPathsFromEndpoints(endpoints, 5.0 * self.layerExtrusionWidth, pixelTable, aroundWidth)
         
        oldRemovedEndpointLength = len(removedEndpoints) + 1
         
        while oldRemovedEndpointLength - len(removedEndpoints) > 0:
            oldRemovedEndpointLength = len(removedEndpoints)
            removeEndpoints(pixelTable, self.layerExtrusionWidth, paths, removedEndpoints, aroundWidth)
        
        paths = euclidean.getConnectedPaths(paths, pixelTable, aroundWidth)
         
        for path in paths:
            addPathToInfillPaths(self.layerExtrusionWidth, infillPaths, path, layerRotation)

        for nestedRing in nestedRings:
            nestedRing.transferPaths(infillPaths)
         
        self.addThreadsBridgeLayer(layerIndex, nestedRings, layer)
    def fill(self, layer):
        'Add fill to the carve layer.'
        layerIndex = layer.index
        alreadyFilledArounds = []
        pixelTable = {}
        arounds = []
        betweenWidth = self.extrusionWidth / 1.7594801994  # this really sucks I cant find hwe#(self.repository.infillWidthOverThickness.value * self.extrusionWidth *(0.7853))/1.5 #- 0.0866#todo todo TODO *0.5 is the distance between the outer loops..
        self.layerExtrusionWidth = self.infillWidth  # spacing between fill lines
        layerFillInset = self.infillWidth  # the distance between perimeter incl loops and the fill pattern

        layerRotation = self.getLayerRotation(layerIndex, layer)
        reverseRotation = complex(layerRotation.real, -layerRotation.imag)
        surroundingCarves = []
        layerRemainder = layerIndex % self.diaphragmPeriod
        extraShells = self.extraShellsSparseLayer

        if layerRemainder >= self.diaphragmThickness and layer.bridgeRotation == None:
            for surroundingIndex in xrange(1, self.solidSurfaceThickness + 1):
                self.addRotatedCarve(layerIndex, -surroundingIndex,
                                     reverseRotation, surroundingCarves)
                self.addRotatedCarve(layerIndex, surroundingIndex,
                                     reverseRotation, surroundingCarves)

        if len(surroundingCarves) < self.doubleSolidSurfaceThickness:
            extraShells = self.extraShellsAlternatingSolidLayer
            if self.previousExtraShells != self.extraShellsBase:
                extraShells = self.extraShellsBase

        if layer.bridgeRotation != None:
            extraShells = 0
            betweenWidth *= self.bridgeWidthMultiplier  #/0.7853  #todo check what is better with or without the normalizer
            self.layerExtrusionWidth *= self.bridgeWidthMultiplier
            layerFillInset *= self.bridgeWidthMultiplier

        aroundInset = 0.25 * self.layerExtrusionWidth
        aroundWidth = 0.25 * self.layerExtrusionWidth
        self.previousExtraShells = extraShells
        gridPointInsetX = 0.5 * layerFillInset
        doubleExtrusionWidth = 2.0 * self.layerExtrusionWidth
        endpoints = []
        infillPaths = []
        layerInfillSolidity = self.infillSolidity

        self.isDoubleJunction = True
        self.isJunctionWide = True
        rotatedLoops = []

        nestedRings = layer.nestedRings

        createFillForSurroundings(nestedRings, betweenWidth, False)

        for extraShellIndex in xrange(extraShells):
            createFillForSurroundings(nestedRings, self.layerExtrusionWidth,
                                      True)

        fillLoops = euclidean.getFillOfSurroundings(nestedRings, None)

        slightlyGreaterThanFill = 1.001 * layerFillInset  #todo was 1.01 ACT 0.95  How much the parallel fill is filled

        for loop in fillLoops:
            alreadyFilledLoop = []
            alreadyFilledArounds.append(alreadyFilledLoop)
            planeRotatedPerimeter = euclidean.getPointsRoundZAxis(
                reverseRotation, loop)
            rotatedLoops.append(planeRotatedPerimeter)
            centers = intercircle.getCentersFromLoop(planeRotatedPerimeter,
                                                     slightlyGreaterThanFill)
            euclidean.addLoopToPixelTable(planeRotatedPerimeter, pixelTable,
                                          aroundWidth)
            for center in centers:
                alreadyFilledInset = intercircle.getSimplifiedInsetFromClockwiseLoop(
                    center, layerFillInset)
                if intercircle.isLargeSameDirection(alreadyFilledInset, center,
                                                    layerFillInset):
                    alreadyFilledLoop.append(alreadyFilledInset)
                    around = intercircle.getSimplifiedInsetFromClockwiseLoop(
                        center, aroundInset)
                    if euclidean.isPathInsideLoop(
                            planeRotatedPerimeter,
                            around) == euclidean.isWiddershins(
                                planeRotatedPerimeter):
                        around.reverse()
                        arounds.append(around)
                        euclidean.addLoopToPixelTable(around, pixelTable,
                                                      aroundWidth)

        if len(arounds) < 1:
            self.addThreadsBridgeLayer(layerIndex, nestedRings, layer)
            return

        back = euclidean.getBackOfLoops(arounds)
        front = euclidean.getFrontOfLoops(arounds)
        front = math.ceil(
            front / self.layerExtrusionWidth) * self.layerExtrusionWidth
        fillWidth = back - front
        numberOfLines = int(math.ceil(fillWidth / self.layerExtrusionWidth))
        self.frontOverWidth = 0.0
        self.horizontalSegmentLists = euclidean.getHorizontalSegmentListsFromLoopLists(
            alreadyFilledArounds, front, numberOfLines, rotatedLoops,
            self.layerExtrusionWidth)
        self.surroundingXIntersectionLists = []
        self.yList = []
        removedEndpoints = []

        if len(surroundingCarves) >= self.doubleSolidSurfaceThickness:
            xIntersectionIndexLists = []
            self.frontOverWidth = euclidean.getFrontOverWidthAddXListYList(
                front, surroundingCarves, numberOfLines,
                xIntersectionIndexLists, self.layerExtrusionWidth, self.yList)
            for fillLine in xrange(len(self.horizontalSegmentLists)):
                xIntersectionIndexList = xIntersectionIndexLists[fillLine]
                surroundingXIntersections = euclidean.getIntersectionOfXIntersectionIndexes(
                    self.doubleSolidSurfaceThickness, xIntersectionIndexList)
                self.surroundingXIntersectionLists.append(
                    surroundingXIntersections)
                addSparseEndpoints(doubleExtrusionWidth, endpoints, fillLine,
                                   self.horizontalSegmentLists,
                                   layerInfillSolidity, removedEndpoints,
                                   self.solidSurfaceThickness,
                                   surroundingXIntersections)
        else:
            for fillLine in xrange(len(self.horizontalSegmentLists)):
                addSparseEndpoints(doubleExtrusionWidth, endpoints, fillLine,
                                   self.horizontalSegmentLists,
                                   layerInfillSolidity, removedEndpoints,
                                   self.solidSurfaceThickness, None)

        paths = euclidean.getPathsFromEndpoints(endpoints,
                                                5.0 * self.layerExtrusionWidth,
                                                pixelTable, aroundWidth)

        oldRemovedEndpointLength = len(removedEndpoints) + 1

        while oldRemovedEndpointLength - len(removedEndpoints) > 0:
            oldRemovedEndpointLength = len(removedEndpoints)
            removeEndpoints(pixelTable, self.layerExtrusionWidth, paths,
                            removedEndpoints, aroundWidth)

        paths = euclidean.getConnectedPaths(paths, pixelTable, aroundWidth)

        for path in paths:
            addPathToInfillPaths(self.layerExtrusionWidth, infillPaths, path,
                                 layerRotation)

        for nestedRing in nestedRings:
            nestedRing.transferPaths(infillPaths)

        self.addThreadsBridgeLayer(layerIndex, nestedRings, layer)