def extendXIntersections(self, loops, radius, xIntersectionsTable): 'Extend the support segments.' xIntersectionsTableKeys = xIntersectionsTable.keys() for xIntersectionsTableKey in xIntersectionsTableKeys: lineSegments = euclidean.getSegmentsFromXIntersections( xIntersectionsTable[xIntersectionsTableKey], xIntersectionsTableKey) xIntersectionIndexList = [] loopXIntersections = [] euclidean.addXIntersectionsFromLoops(loops, loopXIntersections, xIntersectionsTableKey) for lineSegmentIndex in xrange(len(lineSegments)): lineSegment = lineSegments[lineSegmentIndex] extendedLineSegment = getExtendedLineSegment( radius, lineSegment, loopXIntersections) if extendedLineSegment != None: euclidean.addXIntersectionIndexesFromSegment( lineSegmentIndex, extendedLineSegment, xIntersectionIndexList) xIntersections = euclidean.getJoinOfXIntersectionIndexes( xIntersectionIndexList) if len(xIntersections) > 0: xIntersectionsTable[xIntersectionsTableKey] = xIntersections else: del xIntersectionsTable[xIntersectionsTableKey]
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 extendXIntersections(self, loops, radius, xIntersectionsTable): 'Extend the support segments.' xIntersectionsTableKeys = xIntersectionsTable.keys() for xIntersectionsTableKey in xIntersectionsTableKeys: lineSegments = euclidean.getSegmentsFromXIntersections(xIntersectionsTable[ xIntersectionsTableKey ], xIntersectionsTableKey) xIntersectionIndexList = [] loopXIntersections = [] euclidean.addXIntersectionsFromLoops(loops, loopXIntersections, xIntersectionsTableKey) for lineSegmentIndex in xrange(len(lineSegments)): lineSegment = lineSegments[ lineSegmentIndex ] extendedLineSegment = getExtendedLineSegment(radius, lineSegment, loopXIntersections) if extendedLineSegment != None: euclidean.addXIntersectionIndexesFromSegment(lineSegmentIndex, extendedLineSegment, xIntersectionIndexList) xIntersections = euclidean.getJoinOfXIntersectionIndexes(xIntersectionIndexList) if len(xIntersections) > 0: xIntersectionsTable[ xIntersectionsTableKey ] = xIntersections else: del xIntersectionsTable[ xIntersectionsTableKey ]
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)