Ejemplo n.º 1
0
 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)
Ejemplo n.º 2
0
 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)