예제 #1
0
def writeBoundingBox(fid, OriginX, OriginY, MaxXExtent, MaxYExtent):
    x = util.in2gerb(OriginX)
    y = util.in2gerb(OriginY)
    X = util.in2gerb(MaxXExtent)
    Y = util.in2gerb(MaxYExtent)

    makestroke.drawPolyline(fid, [(x, y), (X, y), (X, Y), (x, Y), (x, y)], 0, 0)
예제 #2
0
def writeScoring(fid, Place, OriginX, OriginY, MaxXExtent, MaxYExtent,
                 xspacing, yspacing):
    # For each job, write out 4 score lines, above, to the right, below, and
    # to the left. After we collect all potential scoring lines, we worry
    # about merging, etc.
    dx = xspacing / 2.0
    dy = yspacing / 2.0
    extents = (OriginX, OriginY, MaxXExtent, MaxYExtent)

    Lines = []
    for layout in Place.jobs:
        x = layout.x - dx
        y = layout.y - dy
        X = layout.x + layout.width_in() + dx
        Y = layout.y + layout.height_in() + dy

        # Just so we don't get 3.75000000004 and 3.75000000009, we round to
        # 2.5 limits.
        x, y, X, Y = [round(val, 5) for val in [x, y, X, Y]]

        addHorizontalLine(Lines, OriginX, MaxXExtent, Y, extents)  # above job
        addVerticalLine(Lines, X, OriginY, MaxYExtent,
                        extents)  # to the right of job
        addHorizontalLine(Lines, OriginX, MaxXExtent, y, extents)  # below job
        addVerticalLine(Lines, x, OriginY, MaxYExtent,
                        extents)  # to the left of job

    # Combine disparate lines into single lines
    Lines = mergeLines(Lines)

    # Write 'em out
    for line in Lines:
        makestroke.drawPolyline(
            fid, [(util.in2gerb(line[0]), util.in2gerb(line[1])),
                  (util.in2gerb(line[2]), util.in2gerb(line[3]))], 0, 0)
예제 #3
0
def writeScoring(fid, Place, OriginX, OriginY, MaxXExtent, MaxYExtent, xspacing, yspacing):
    # For each job, write out 4 score lines, above, to the right, below, and
    # to the left. After we collect all potential scoring lines, we worry
    # about merging, etc.
    dx = xspacing / 2.0
    dy = yspacing / 2.0
    extents = (OriginX, OriginY, MaxXExtent, MaxYExtent)

    Lines = []
    for layout in Place.jobs:
        x = layout.x - dx
        y = layout.y - dy
        X = layout.x + layout.width_in() + dx
        Y = layout.y + layout.height_in() + dy

        # Just so we don't get 3.75000000004 and 3.75000000009, we round to
        # 2.5 limits.
        x, y, X, Y = [round(val, 5) for val in [x, y, X, Y]]

        addHorizontalLine(Lines, OriginX, MaxXExtent, Y, extents)   # above job
        addVerticalLine(Lines, X, OriginY, MaxYExtent, extents)     # to the right of job
        addHorizontalLine(Lines, OriginX, MaxXExtent, y, extents)   # below job
        addVerticalLine(Lines, x, OriginY, MaxYExtent, extents)     # to the left of job

    # Combine disparate lines into single lines
    Lines = mergeLines(Lines)

    # Write 'em out
    for line in Lines:
        makestroke.drawPolyline(fid, [(util.in2gerb(line[0]), util.in2gerb(line[1])),
                                      (util.in2gerb(line[2]), util.in2gerb(line[3]))], 0, 0)
예제 #4
0
def writeBoundingBox(fid, OriginX, OriginY, MaxXExtent, MaxYExtent):
  x = util.in2gerb(OriginX)
  y = util.in2gerb(OriginY)
  X = util.in2gerb(MaxXExtent)
  Y = util.in2gerb(MaxYExtent)

  makestroke.drawPolyline(fid, [(x,y), (X,y), (X,Y), (x,Y), (x,y)], 0, 0)
예제 #5
0
def writeScoring(fid, Place, OriginX, OriginY, MaxXExtent, MaxYExtent):
    # For each job, write out 4 score lines, above, to the right, below, and
    # to the left. After we collect all potential scoring lines, we worry
    # about merging, etc.
    dx = config.Config['xspacing'] / 2.0
    dy = config.Config['yspacing'] / 2.0
    extents = (OriginX, OriginY, MaxXExtent, MaxYExtent)

    Lines = []
    for layout in Place.jobs:
        x = layout.x - dx
        y = layout.y - dy
        X = layout.x + layout.width_in() + dx
        Y = layout.y + layout.height_in() + dy

        print "Crossing point xy: (" + str(x) + "," + str(y) + ")"
        print "Crossing point xY: (" + str(x) + "," + str(Y) + ")"
        print "Crossing point Xy: (" + str(X) + "," + str(y) + ")"
        print "Crossing point XY: (" + str(X) + "," + str(Y) + ")"
        print "---"

        #calculate mousebite location
        mousebiteX = layout.x + layout.width_in() / 2
        mousebiteY = layout.y + layout.height_in() / 2
        mousebiteLen = 0.080

        # Just so we don't get 3.75000000004 and 3.75000000009, we round to
        # 2.5 limits.
        x, y, X, Y = [round(val, 5) for val in [x, y, X, Y]]

        if 1:  # Scoring lines go all the way across the panel now
            addHorizontalLine(Lines, x, mousebiteX - mousebiteLen / 2, Y,
                              extents)  # above job
            addHorizontalLine(Lines, mousebiteX + mousebiteLen / 2, X, Y,
                              extents)  # above job

            addVerticalLine(Lines, X, y, mousebiteY - mousebiteLen / 2,
                            extents)  # to the right of job
            addVerticalLine(Lines, X, mousebiteY + mousebiteLen / 2, Y,
                            extents)  # to the right of job

            addHorizontalLine(Lines, x, mousebiteX - mousebiteLen / 2, y,
                              extents)  # below job
            addHorizontalLine(Lines, mousebiteX + mousebiteLen / 2, X, y,
                              extents)  # below job

            addVerticalLine(Lines, x, y, mousebiteY - mousebiteLen / 2,
                            extents)  # to the left of job
            addVerticalLine(Lines, X, mousebiteY + mousebiteLen / 2, Y,
                            extents)  # to the left of job

        else:
            addHorizontalLine(Lines, OriginX, MaxXExtent, Y,
                              extents)  # above job
            addVerticalLine(Lines, X, OriginY, MaxYExtent,
                            extents)  # to the right of job
            addHorizontalLine(Lines, OriginX, MaxXExtent, y,
                              extents)  # below job
            addVerticalLine(Lines, x, OriginY, MaxYExtent,
                            extents)  # to the left of job

    # Combine disparate lines into single lines
    Lines = mergeLines(Lines)

    #for line in Lines:
    #  print [round(x,3) for x in line]

    # Write 'em out
    for line in Lines:
        makestroke.drawPolyline(fid, [(util.in2gerb(line[0]),util.in2gerb(line[1])), \
                                      (util.in2gerb(line[2]),util.in2gerb(line[3]))], 0, 0)
예제 #6
0
def writeScoring(fid, Place, OriginX, OriginY, MaxXExtent, MaxYExtent):
    # For each job, write out 4 score lines, above, to the right, below, and
    # to the left. After we collect all potential scoring lines, we worry
    # about merging, etc.
    dx = config.Config['xspacing'] / 2.0
    dy = config.Config['yspacing'] / 2.0
    extents = (OriginX, OriginY, MaxXExtent, MaxYExtent)

    Lines = []
    for layout in Place.jobs:
        x = layout.x - dx
        y = layout.y - dy
        X = layout.x + layout.width_in() + dx
        Y = layout.y + layout.height_in() + dy

        # Just so we don't get 3.75000000004 and 3.75000000009, we round to
        # 2.5 limits.
        x, y, X, Y = [round(val, 5) for val in [x, y, X, Y]]

        if config.Config['scoringstyle'] and config.Config[
                'scoringstyle'] == 'surround':  # Scoring lines go all the way across the panel now
            addHorizontalLine(Lines, x, X, Y, extents)  # above job
            addVerticalLine(Lines, X, y, Y, extents)  # to the right of job
            addHorizontalLine(Lines, x, X, y, extents)  # below job
            addVerticalLine(Lines, x, y, Y, extents)  # to the left of job
        else:
            addHorizontalLine(Lines, OriginX, MaxXExtent, Y,
                              extents)  # above job
            addVerticalLine(Lines, X, OriginY, MaxYExtent,
                            extents)  # to the right of job
            addHorizontalLine(Lines, OriginX, MaxXExtent, y,
                              extents)  # below job
            addVerticalLine(Lines, x, OriginY, MaxYExtent,
                            extents)  # to the left of job

    # Combine disparate lines into single lines
    Lines = mergeLines(Lines)

    #for line in Lines:
    #  print [round(x,3) for x in line]

    # Write 'em out
    if config.Config['fiducialpoints'] and config.Config[
            'fiducialpoints'] == 'scoring':
        # If fiducialpoints == 'scoring' rewrite it now to mark out the scoring lines
        newFiducuals = []

        for line in Lines:
            # Fiducials at 10% in from each end of the line
            if isHorizontal(line):
                offset = (line[2] - line[0]) * 0.1
                newFiducuals.append(line[0] + offset)
                newFiducuals.append(line[1])
                newFiducuals.append(line[2] - offset)
                newFiducuals.append(line[3])
            else:
                offset = (line[3] - line[1]) * 0.1
                newFiducuals.append(line[0])
                newFiducuals.append(line[1] + offset)
                newFiducuals.append(line[2])
                newFiducuals.append(line[3] - offset)

            # Fiducials at the end of each line, unless it's a board edge
            #  (in other words, line intersections)
            # I think this makes it a bit cluttered
            if 0:
                if not (line[0] == OriginX or line[1] == OriginY
                        or line[0] == MaxXExtent or line[1] == MaxYExtent):
                    newFiducuals.append(line[0])
                    newFiducuals.append(line[1])

                if not (line[2] == OriginX or line[3] == OriginY
                        or line[2] == MaxXExtent or line[3] == MaxYExtent):
                    newFiducuals.append(line[2])
                    newFiducuals.append(line[3])

            # Fiducials at 50% of each line
            if isHorizontal(line):
                offset = (line[2] - line[0]) * 0.5
                newFiducuals.append(line[0] + offset)
                newFiducuals.append(line[1])
            else:
                offset = (line[3] - line[1]) * 0.5
                newFiducuals.append(line[0])
                newFiducuals.append(line[1] + offset)

        config.Config['fiducialpoints'] = ','.join(map(str, newFiducuals))

    if fid != None:
        for line in Lines:
            makestroke.drawPolyline(fid, [(util.in2gerb(line[0]),util.in2gerb(line[1])), \
                                          (util.in2gerb(line[2]),util.in2gerb(line[3]))], 0, 0)