def createSkirtLoops(self): 'Create the skirt loops.' points = euclidean.getPointsByHorizontalDictionary(self.edgeWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary(self.edgeWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops(points, points, 2.5 * self.edgeWidth) outerLoops = getOuterLoops(loops) outsetLoops = intercircle.getInsetSeparateLoopsFromLoops(outerLoops, -self.skirtOutset-self.edgeWidth*(self.repository.brimWidth.value+1)) self.outsetLoops = getOuterLoops(outsetLoops) if self.repository.convex.value: self.outsetLoops = [euclidean.getLoopConvex(euclidean.getConcatenatedList(self.outsetLoops))] self.outsetBrimLoops = [] for self.brimLine in xrange( self.repository.brimWidth.value-1, self.brimLine, -1 ): points = euclidean.getPointsByHorizontalDictionary(self.edgeWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary(self.edgeWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops(points, points, 2.5 * self.edgeWidth) outerLoops = getOuterLoops(loops) outsetLoops = intercircle.getInsetSeparateLoopsFromLoops(outerLoops, -self.edgeWidth*(self.brimLine+0.5)) outsetLoops = getOuterLoops(outsetLoops) if self.repository.convex.value: outsetLoops = [euclidean.getLoopConvex(euclidean.getConcatenatedList(outsetLoops))] self.outsetBrimLoops += outsetLoops if self.repository.brimWidth.value > 0: points = euclidean.getPointsByHorizontalDictionary(self.edgeWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary(self.edgeWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops(points, points, 2.5 * self.edgeWidth) outerLoops = getOuterLoops(loops) outsetLoops = intercircle.getInsetSeparateLoopsFromLoops(outerLoops, -self.edgeWidth*0.5) outsetLoops = getOuterLoops(outsetLoops) if self.repository.convex.value: outsetLoops = [euclidean.getLoopConvex(euclidean.getConcatenatedList(outsetLoops))] self.outsetBrimLoops += outsetLoops
def createSkirtLoops(self): 'Create the skirt loops.' points = euclidean.getPointsByHorizontalDictionary(self.edgeWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary(self.edgeWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops(points, points, 2.5 * self.edgeWidth) outerLoops = getOuterLoops(loops) outsetLoops = intercircle.getInsetSeparateLoopsFromLoops(outerLoops, -self.skirtOutset-self.edgeWidth*(self.repository.brimWidth.value+1)) self.outsetLoops = getOuterLoops(outsetLoops) if self.repository.convex.value: self.outsetLoops = [euclidean.getLoopConvex(euclidean.getConcatenatedList(self.outsetLoops))] if self.repository.brimWidth.value > 0: points = euclidean.getPointsByHorizontalDictionary(self.edgeWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary(self.edgeWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops(points, points, 2.5 * self.edgeWidth) outerLoops = getOuterLoops(loops) outsetLoops = intercircle.getInsetSeparateLoopsFromLoops(outerLoops, -self.edgeWidth*0.5) outsetLoops = getOuterLoops(outsetLoops) if self.repository.convex.value: outsetLoops = [euclidean.getLoopConvex(euclidean.getConcatenatedList(outsetLoops))] self.outsetBrimLoops = outsetLoops for self.brimLine in xrange(self.brimLine+1,self.repository.brimWidth.value): points = euclidean.getPointsByHorizontalDictionary(self.edgeWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary(self.edgeWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops(points, points, 2.5 * self.edgeWidth) outerLoops = getOuterLoops(loops) outsetLoops = intercircle.getInsetSeparateLoopsFromLoops(outerLoops, -self.edgeWidth*(self.brimLine+0.5)) outsetLoops = getOuterLoops(outsetLoops) if self.repository.convex.value: outsetLoops = [euclidean.getLoopConvex(euclidean.getConcatenatedList(outsetLoops))] self.outsetBrimLoops += outsetLoops
def parseBoundaries(self): 'Parse the boundaries and add them to the boundary layers.' boundaryLoop = None boundaryLayer = None for line in self.lines[self.lineIndex:]: splitLine = gcodec.getSplitLineBeforeBracketSemicolon(line) firstWord = gcodec.getFirstWord(splitLine) if firstWord == '(</boundaryPerimeter>)': boundaryLoop = None elif firstWord == '(<boundaryPoint>': location = gcodec.getLocationFromSplitLine(None, splitLine) if boundaryLoop == None: boundaryLoop = [] boundaryLayer.loops.append(boundaryLoop) boundaryLoop.append(location.dropAxis()) elif firstWord == '(<layer>': boundaryLayer = euclidean.LoopLayer(float(splitLine[1])) self.boundaryLayers.append(boundaryLayer) if len(self.boundaryLayers) < 2: return for boundaryLayer in self.boundaryLayers: boundaryLayer.innerOutsetLoops = intercircle.getInsetSeparateLoopsFromLoops( boundaryLayer.loops, -self.loopInnerOutset) boundaryLayer.outerOutsetLoops = intercircle.getInsetSeparateLoopsFromLoops( boundaryLayer.loops, -self.loopOuterOutset) boundaryLayer.innerHorizontalTable = self.getHorizontalXIntersectionsTable( boundaryLayer.innerOutsetLoops) boundaryLayer.outerHorizontalTable = self.getHorizontalXIntersectionsTable( boundaryLayer.outerOutsetLoops) boundaryLayer.innerVerticalTable = self.getHorizontalXIntersectionsTable( euclidean.getDiagonalFlippedLoops( boundaryLayer.innerOutsetLoops)) boundaryLayer.outerVerticalTable = self.getHorizontalXIntersectionsTable( euclidean.getDiagonalFlippedLoops( boundaryLayer.outerOutsetLoops)) for boundaryLayerIndex in xrange(len(self.boundaryLayers) - 2, -1, -1): boundaryLayer = self.boundaryLayers[boundaryLayerIndex] boundaryLayerBelow = self.boundaryLayers[boundaryLayerIndex + 1] euclidean.joinXIntersectionsTables( boundaryLayerBelow.outerHorizontalTable, boundaryLayer.outerHorizontalTable) euclidean.joinXIntersectionsTables( boundaryLayerBelow.outerVerticalTable, boundaryLayer.outerVerticalTable) for boundaryLayerIndex in xrange(1, len(self.boundaryLayers)): boundaryLayer = self.boundaryLayers[boundaryLayerIndex] boundaryLayerAbove = self.boundaryLayers[boundaryLayerIndex - 1] euclidean.joinXIntersectionsTables( boundaryLayerAbove.innerHorizontalTable, boundaryLayer.innerHorizontalTable) euclidean.joinXIntersectionsTables( boundaryLayerAbove.innerVerticalTable, boundaryLayer.innerVerticalTable) for boundaryLayerIndex in xrange(len(self.boundaryLayers)): self.addSegmentTableLoops(boundaryLayerIndex)
def parseBoundaries(self): "Parse the boundaries and add them to the boundary layers." boundaryLoop = None boundaryLayer = None for line in self.lines[self.lineIndex :]: splitLine = gcodec.getSplitLineBeforeBracketSemicolon(line) firstWord = gcodec.getFirstWord(splitLine) if firstWord == "(</boundaryPerimeter>)": boundaryLoop = None elif firstWord == "(<boundaryPoint>": location = gcodec.getLocationFromSplitLine(None, splitLine) if boundaryLoop == None: boundaryLoop = [] boundaryLayer.loops.append(boundaryLoop) boundaryLoop.append(location.dropAxis(2)) elif firstWord == "(<layer>": boundaryLayer = euclidean.LoopLayer(float(splitLine[1])) self.boundaryLayers.append(boundaryLayer) if len(self.boundaryLayers) < 2: return for boundaryLayer in self.boundaryLayers: boundaryLayer.innerOutsetLoops = intercircle.getInsetSeparateLoopsFromLoops( -self.loopInnerOutset, boundaryLayer.loops ) boundaryLayer.outerOutsetLoops = intercircle.getInsetSeparateLoopsFromLoops( -self.loopOuterOutset, boundaryLayer.loops ) boundaryLayer.innerHorizontalTable = self.getHorizontalXIntersectionsTable(boundaryLayer.innerOutsetLoops) boundaryLayer.outerHorizontalTable = self.getHorizontalXIntersectionsTable(boundaryLayer.outerOutsetLoops) boundaryLayer.innerVerticalTable = self.getHorizontalXIntersectionsTable( euclidean.getDiagonalFlippedLoops(boundaryLayer.innerOutsetLoops) ) boundaryLayer.outerVerticalTable = self.getHorizontalXIntersectionsTable( euclidean.getDiagonalFlippedLoops(boundaryLayer.outerOutsetLoops) ) for boundaryLayerIndex in xrange(len(self.boundaryLayers) - 2, -1, -1): boundaryLayer = self.boundaryLayers[boundaryLayerIndex] boundaryLayerBelow = self.boundaryLayers[boundaryLayerIndex + 1] euclidean.joinXIntersectionsTables( boundaryLayerBelow.outerHorizontalTable, boundaryLayer.outerHorizontalTable ) euclidean.joinXIntersectionsTables(boundaryLayerBelow.outerVerticalTable, boundaryLayer.outerVerticalTable) for boundaryLayerIndex in xrange(1, len(self.boundaryLayers)): boundaryLayer = self.boundaryLayers[boundaryLayerIndex] boundaryLayerAbove = self.boundaryLayers[boundaryLayerIndex - 1] euclidean.joinXIntersectionsTables( boundaryLayerAbove.innerHorizontalTable, boundaryLayer.innerHorizontalTable ) euclidean.joinXIntersectionsTables(boundaryLayerAbove.innerVerticalTable, boundaryLayer.innerVerticalTable) for boundaryLayerIndex in xrange(len(self.boundaryLayers)): self.addSegmentTableLoops(boundaryLayerIndex)
def addSupportSegmentTable(self, layerIndex): 'Add support segments from the boundary layers.' aboveLoops = self.boundaryLayers[ layerIndex + 1 ] supportLayer = self.supportLayers[layerIndex] if len(aboveLoops) < 1: return boundaryLayer = self.boundaryLayers[layerIndex] rise = self.slicedModel.layers[layerIndex + 1 ].z - self.slicedModel.layers[layerIndex].z outsetSupportLoops = intercircle.getInsetSeparateLoopsFromLoops(-self.minimumSupportRatio * rise, boundaryLayer) numberOfSubSteps = 4 subStepSize = self.interfaceStep / float(numberOfSubSteps) aboveIntersectionsTable = {} euclidean.addXIntersectionsFromLoopsForTable(aboveLoops, aboveIntersectionsTable, subStepSize) outsetIntersectionsTable = {} euclidean.addXIntersectionsFromLoopsForTable(outsetSupportLoops, outsetIntersectionsTable, subStepSize) euclidean.subtractXIntersectionsTable(aboveIntersectionsTable, outsetIntersectionsTable) for aboveIntersectionsTableKey in aboveIntersectionsTable.keys(): supportIntersectionsTableKey = int(round(float(aboveIntersectionsTableKey) / numberOfSubSteps)) xIntersectionIndexList = [] if supportIntersectionsTableKey in supportLayer.xIntersectionsTable: euclidean.addXIntersectionIndexesFromXIntersections(0, xIntersectionIndexList, supportLayer.xIntersectionsTable[ supportIntersectionsTableKey ]) euclidean.addXIntersectionIndexesFromXIntersections(1, xIntersectionIndexList, aboveIntersectionsTable[ aboveIntersectionsTableKey ]) supportLayer.xIntersectionsTable[ supportIntersectionsTableKey ] = euclidean.getJoinOfXIntersectionIndexes(xIntersectionIndexList)
def createSkirtLoops(self): 'Create the skirt loops.' points = euclidean.getPointsByHorizontalDictionary(self.perimeterWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary(self.perimeterWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops(points, points, self.perimeterWidth) outerLoops = getOuterLoops(loops) self.outsetLoops = intercircle.getInsetSeparateLoopsFromLoops(-self.skirtOutset, outerLoops) self.outsetLoops = getOuterLoops(self.outsetLoops)
def createSkirtLoops(self): 'Create the skirt loops.' points = euclidean.getPointsByHorizontalDictionary(self.perimeterWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary(self.perimeterWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops(points, points, self.perimeterWidth) outerLoops = getOuterLoops(loops) self.outsetLoops = intercircle.getInsetSeparateLoopsFromLoops(-self.skirtOutset, outerLoops) self.outsetLoops = getOuterLoops(self.outsetLoops)
def createSkirtLoops(self): "Create the skirt loops." points = euclidean.getPointsByHorizontalDictionary(self.perimeterWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary(self.perimeterWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops(points, points, 2.5 * self.perimeterWidth) outerLoops = getOuterLoops(loops) outsetLoops = intercircle.getInsetSeparateLoopsFromLoops(outerLoops, -self.skirtOutset) self.outsetLoops = getOuterLoops(outsetLoops) if self.repository.convex.value: self.outsetLoops = [euclidean.getLoopConvex(euclidean.getConcatenatedList(self.outsetLoops))]
def createSkirtLoops(self): 'Create the skirt loops.' points = euclidean.getPointsByHorizontalDictionary(self.perimeterWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary(self.perimeterWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops(points, points, 2.5 * self.perimeterWidth) outerLoops = getOuterLoops(loops) outsetLoops = intercircle.getInsetSeparateLoopsFromLoops(-self.skirtOutset, outerLoops) self.outsetLoops = getOuterLoops(outsetLoops) if self.repository.convex.value: self.outsetLoops = [euclidean.getLoopConvex(euclidean.getConcatenatedList(self.outsetLoops))]
def getOutsetLoops(self, outerLoops, distance, convex): outsetLoops = intercircle.getInsetSeparateLoopsFromLoops( outerLoops, distance) outsetLoops = getOuterLoops(outsetLoops) if convex: outsetLoops = [ euclidean.getLoopConvex( euclidean.getConcatenatedList(outsetLoops)) ] return outsetLoops
def setBoundaryLayers(self): 'Set the boundary layers.' if len(self.boundaryLayers) < 2: return if self.supportLocation == 'EmptyLayersOnly': supportLayer = SupportLayer([]) self.supportLayers.append(supportLayer) for boundaryLayerIndex in xrange(1, len(self.boundaryLayers) - 1): self.addEmptyLayerSupport(boundaryLayerIndex) self.truncateSupportSegmentTables() self.addSegmentTablesToSupportLayers() return for boundaryLayer in self.boundaryLayers: # thresholdRadius of 0.8 is needed to avoid the ripple inset bug http://hydraraptor.blogspot.com/2010/12/crackers.html supportLoops = intercircle.getInsetSeparateLoopsFromLoops(-self.supportOutset, boundaryLayer, 0.8) supportLayer = SupportLayer(supportLoops) self.supportLayers.append(supportLayer) for supportLayerIndex in xrange(len(self.supportLayers) -1 ): self.addSupportSegmentTable(supportLayerIndex) self.truncateSupportSegmentTables() for supportLayerIndex in xrange(len(self.supportLayers) - 1): boundaryLoops = self.boundaryLayers[supportLayerIndex] self.extendXIntersections(boundaryLoops, self.supportOutset, self.supportLayers[supportLayerIndex].xIntersectionsTable) for supportLayer in self.supportLayers: self.addToFillXIntersectionIndexTables(supportLayer) if self.supportLocation == 'ExteriorOnly': for supportLayerIndex in xrange(1, len(self.supportLayers)): self.subtractJoinedFill(supportLayerIndex) for supportLayer in self.supportLayers: euclidean.subtractXIntersectionsTable(supportLayer.xIntersectionsTable, supportLayer.fillXIntersectionsTable) for supportLayerIndex in xrange(len(self.supportLayers) - 2, -1, -1): xIntersectionsTable = self.supportLayers[supportLayerIndex].xIntersectionsTable aboveXIntersectionsTable = self.supportLayers[supportLayerIndex + 1].xIntersectionsTable euclidean.joinXIntersectionsTables(aboveXIntersectionsTable, xIntersectionsTable) for supportLayerIndex in xrange(len(self.supportLayers)): supportLayer = self.supportLayers[supportLayerIndex] self.extendXIntersections(supportLayer.supportLoops, self.raftOutsetRadius, supportLayer.xIntersectionsTable) for supportLayer in self.supportLayers: euclidean.subtractXIntersectionsTable(supportLayer.xIntersectionsTable, supportLayer.fillXIntersectionsTable) self.addSegmentTablesToSupportLayers()
def createSkirtLoops(self): 'Create the skirt loops.' points = euclidean.getPointsByHorizontalDictionary(self.edgeWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary(self.edgeWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops(points, points, 2.5 * self.edgeWidth) outerLoops = getOuterLoops(loops) self.outsetLoops = [] for i in xrange(self.repository.skirtLineCount.value, 0, -1): outsetLoops = intercircle.getInsetSeparateLoopsFromLoops(outerLoops, -self.skirtOutset - i * self.edgeWidth) outsetLoops = getOuterLoops(outsetLoops) if self.repository.convex.value: outsetLoops = [euclidean.getLoopConvex(euclidean.getConcatenatedList(outsetLoops))] self.outsetLoops.extend(outsetLoops)
def addRotatedCarve(self, currentLayer, layerDelta, reverseRotation, surroundingCarves): 'Add a rotated carve to the surrounding carves.' layerIndex = currentLayer + layerDelta if layerIndex < 0 or layerIndex >= len(self.slicedModel.layers): return layer = self.slicedModel.layers[layerIndex] nestedRings = layer.nestedRings rotatedCarve = [] for nestedRing in nestedRings: planeRotatedLoop = euclidean.getPointsRoundZAxis(reverseRotation, nestedRing.getXYBoundaries()) rotatedCarve.append(planeRotatedLoop) outsetRadius = float(abs(layerDelta)) * self.extrusionWidth #todo investigate was float(abs(layerDelta)) * self.layerThickness rotatedCarve = intercircle.getInsetSeparateLoopsFromLoops(-outsetRadius, rotatedCarve) surroundingCarves.append(rotatedCarve)
def createSkirtLoops(self): 'Create the skirt loops.' points = euclidean.getPointsByHorizontalDictionary( self.edgeWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary( self.edgeWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops( points, points, 2.5 * self.edgeWidth) outerLoops = getOuterLoops(loops) self.outsetLoops = [] for i in xrange(self.repository.skirtLineCount.value, 0, -1): outsetLoops = intercircle.getInsetSeparateLoopsFromLoops( outerLoops, -self.skirtOutset - (i - 1) * self.edgeWidth) outsetLoops = getOuterLoops(outsetLoops) if self.repository.convex.value: outsetLoops = [ euclidean.getLoopConvex( euclidean.getConcatenatedList(outsetLoops)) ] self.outsetLoops.extend(outsetLoops)
def createSkirtLoops(self, gap, shellCount): "Create the skirt loops." outset = gap + self.edgeWidth points = euclidean.getPointsByHorizontalDictionary(self.edgeWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary(self.edgeWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops(points, points, 2.5 * self.edgeWidth) outerLoops = self.getOuterLoops(loops) skirtLoops = [] for shellNo in xrange(shellCount): outsetLoops = intercircle.getInsetSeparateLoopsFromLoops(-(outset + self.edgeWidth * shellNo), outerLoops) outsetLoops = self.getOuterLoops(outsetLoops) if self.convex: outsetLoops = [euclidean.getLoopConvex(euclidean.getConcatenatedList(outsetLoops))] for outsetLoop in outsetLoops: skirtLoops.append(outsetLoop + [outsetLoop[0]]) return skirtLoops
def createSkirtLoops(self, gap, shellCount): 'Create the skirt loops.' outset = gap + self.edgeWidth points = euclidean.getPointsByHorizontalDictionary(self.edgeWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary(self.edgeWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops(points, points, 2.5 * self.edgeWidth) outerLoops = self.getOuterLoops(loops) skirtLoops = [] for shellNo in xrange(shellCount): outsetLoops = intercircle.getInsetSeparateLoopsFromLoops(-(outset + self.edgeWidth * shellNo), outerLoops) outsetLoops = self.getOuterLoops(outsetLoops) if self.convex: outsetLoops = [euclidean.getLoopConvex(euclidean.getConcatenatedList(outsetLoops))] for outsetLoop in outsetLoops: skirtLoops.append(outsetLoop + [outsetLoop[0]]) return skirtLoops
def addRotatedCarve(self, currentLayer, layerDelta, reverseRotation, surroundingCarves): 'Add a rotated carve to the surrounding carves.' layerIndex = currentLayer + layerDelta if layerIndex < 0 or layerIndex >= len(self.slicedModel.layers): return layer = self.slicedModel.layers[layerIndex] nestedRings = layer.nestedRings rotatedCarve = [] for nestedRing in nestedRings: planeRotatedLoop = euclidean.getPointsRoundZAxis( reverseRotation, nestedRing.getXYBoundaries()) rotatedCarve.append(planeRotatedLoop) outsetRadius = float( abs(layerDelta) ) * self.extrusionWidth #todo investigate was float(abs(layerDelta)) * self.layerThickness rotatedCarve = intercircle.getInsetSeparateLoopsFromLoops( -outsetRadius, rotatedCarve) surroundingCarves.append(rotatedCarve)
def addSupportSegmentTable(self, layerIndex): 'Add support segments from the boundary layers.' aboveLoops = self.boundaryLayers[layerIndex + 1] supportLayer = self.supportLayers[layerIndex] if len(aboveLoops) < 1: return boundaryLayer = self.boundaryLayers[layerIndex] rise = self.slicedModel.layers[ layerIndex + 1].z - self.slicedModel.layers[layerIndex].z outsetSupportLoops = intercircle.getInsetSeparateLoopsFromLoops( -self.minimumSupportRatio * rise, boundaryLayer) numberOfSubSteps = 4 subStepSize = self.interfaceStep / float(numberOfSubSteps) aboveIntersectionsTable = {} euclidean.addXIntersectionsFromLoopsForTable(aboveLoops, aboveIntersectionsTable, subStepSize) outsetIntersectionsTable = {} euclidean.addXIntersectionsFromLoopsForTable(outsetSupportLoops, outsetIntersectionsTable, subStepSize) euclidean.subtractXIntersectionsTable(aboveIntersectionsTable, outsetIntersectionsTable) for aboveIntersectionsTableKey in aboveIntersectionsTable.keys(): supportIntersectionsTableKey = int( round(float(aboveIntersectionsTableKey) / numberOfSubSteps)) xIntersectionIndexList = [] if supportIntersectionsTableKey in supportLayer.xIntersectionsTable: euclidean.addXIntersectionIndexesFromXIntersections( 0, xIntersectionIndexList, supportLayer. xIntersectionsTable[supportIntersectionsTableKey]) euclidean.addXIntersectionIndexesFromXIntersections( 1, xIntersectionIndexList, aboveIntersectionsTable[aboveIntersectionsTableKey]) supportLayer.xIntersectionsTable[ supportIntersectionsTableKey] = euclidean.getJoinOfXIntersectionIndexes( xIntersectionIndexList)
def setBoundaryLayers(self): 'Set the boundary layers.' if len(self.boundaryLayers) < 2: return if self.supportLocation == 'EmptyLayersOnly': supportLayer = SupportLayer([]) self.supportLayers.append(supportLayer) for boundaryLayerIndex in xrange(1, len(self.boundaryLayers) - 1): self.addEmptyLayerSupport(boundaryLayerIndex) self.truncateSupportSegmentTables() self.addSegmentTablesToSupportLayers() return for boundaryLayer in self.boundaryLayers: # thresholdRadius of 0.8 is needed to avoid the ripple inset bug http://hydraraptor.blogspot.com/2010/12/crackers.html supportLoops = intercircle.getInsetSeparateLoopsFromLoops( -self.supportOutset, boundaryLayer, 0.8) supportLayer = SupportLayer(supportLoops) self.supportLayers.append(supportLayer) for supportLayerIndex in xrange(len(self.supportLayers) - 1): self.addSupportSegmentTable(supportLayerIndex) self.truncateSupportSegmentTables() for supportLayerIndex in xrange(len(self.supportLayers) - 1): boundaryLoops = self.boundaryLayers[supportLayerIndex] self.extendXIntersections( boundaryLoops, self.supportOutset, self.supportLayers[supportLayerIndex].xIntersectionsTable) for supportLayer in self.supportLayers: self.addToFillXIntersectionIndexTables(supportLayer) if self.supportLocation == 'ExteriorOnly': for supportLayerIndex in xrange(1, len(self.supportLayers)): self.subtractJoinedFill(supportLayerIndex) for supportLayer in self.supportLayers: euclidean.subtractXIntersectionsTable( supportLayer.xIntersectionsTable, supportLayer.fillXIntersectionsTable) for supportLayerIndex in xrange(len(self.supportLayers) - 2, -1, -1): xIntersectionsTable = self.supportLayers[ supportLayerIndex].xIntersectionsTable aboveXIntersectionsTable = self.supportLayers[ supportLayerIndex + 1].xIntersectionsTable euclidean.joinXIntersectionsTables(aboveXIntersectionsTable, xIntersectionsTable) for supportLayerIndex in xrange(len(self.supportLayers)): supportLayer = self.supportLayers[supportLayerIndex] self.extendXIntersections(supportLayer.supportLoops, self.raftOutsetRadius, supportLayer.xIntersectionsTable) for supportLayer in self.supportLayers: euclidean.subtractXIntersectionsTable( supportLayer.xIntersectionsTable, supportLayer.fillXIntersectionsTable) self.addSegmentTablesToSupportLayers()