本文整理汇总了Python中util.in2gerb函数的典型用法代码示例。如果您正苦于以下问题:Python in2gerb函数的具体用法?Python in2gerb怎么用?Python in2gerb使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了in2gerb函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: writeBoundingBox
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)
开发者ID:5shekel,项目名称:gerbmerge3,代码行数:7,代码来源:fabdrawing.py
示例2: writeScoring
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)
开发者ID:5shekel,项目名称:gerbmerge3,代码行数:31,代码来源:scoring.py
示例3: writeDimensionArrow
def writeDimensionArrow(fid, OriginX, OriginY, MaxXExtent, MaxYExtent):
x = util.in2gerb(OriginX)
y = util.in2gerb(OriginY)
X = util.in2gerb(MaxXExtent)
Y = util.in2gerb(MaxYExtent)
# This constant is how far away from the board the centerline of the dimension
# arrows should be, in inches.
dimspace = 0.2
# Convert it to Gerber (0.00001" or 2.5) units
dimspace = util.in2gerb(dimspace)
# Draw an arrow above the board, on the left side and right side
makestroke.drawDimensionArrow(fid, x, Y + dimspace, makestroke.FACING_LEFT)
makestroke.drawDimensionArrow(fid, X, Y + dimspace, makestroke.FACING_RIGHT)
# Draw arrows to the right of the board, at top and bottom
makestroke.drawDimensionArrow(fid, X + dimspace, Y, makestroke.FACING_UP)
makestroke.drawDimensionArrow(fid, X + dimspace, y, makestroke.FACING_DOWN)
# Now draw the text. First, horizontal text above the board.
s = "{:.3f}\"".format(MaxXExtent - OriginX)
ll, ur = makestroke.boundingBox(s, 0, 0)
s_width = ur[0] - ll[0] # Width in 2.5 units
s_height = ur[1] - ll[1] # Height in 2.5 units
# Compute the position in 2.5 units where we should draw this. It should be
# centered horizontally and also vertically about the dimension arrow centerline.
posX = x + (x + X) / 2
posX -= s_width / 2
posY = Y + dimspace - s_height / 2
makestroke.writeString(fid, s, posX, posY, 0)
# Finally, draw the extending lines from the text to the arrows.
posY = Y + dimspace
posX1 = posX - util.in2gerb(0.1) # 1000
posX2 = posX + s_width + util.in2gerb(0.1) # 1000
makestroke.drawLine(fid, x, posY, posX1, posY)
makestroke.drawLine(fid, posX2, posY, X, posY)
# Now do the vertical text
s = "{:.3f}\"".format(MaxYExtent - OriginY)
ll, ur = makestroke.boundingBox(s, 0, 0)
s_width = ur[0] - ll[0]
s_height = ur[1] - ll[1]
# As above, figure out where to draw this. Rotation will be -90 degrees
# so new origin will be top-left of bounding box after rotation.
posX = X + dimspace - s_height / 2
posY = y + (y + Y) / 2
posY += s_width / 2
makestroke.writeString(fid, s, posX, posY, -90)
# Draw extending lines
posX = X + dimspace
posY1 = posY + util.in2gerb(0.1) # 1000
posY2 = posY - s_width - util.in2gerb(0.1) # 1000
makestroke.drawLine(fid, posX, Y, posX, posY1)
makestroke.drawLine(fid, posX, posY2, posX, y)
开发者ID:5shekel,项目名称:gerbmerge3,代码行数:60,代码来源:fabdrawing.py
示例4: writeOutline
def writeOutline(fid, OriginX, OriginY, MaxXExtent, MaxYExtent):
# Write width-1 aperture to file
AP = aptable.Aperture(aptable.Circle, 'D10', 0.001)
AP.writeDef(fid)
# Choose drawing aperture D10
fid.write('D10*\n')
# Draw the rectangle
fid.write('X%07dY%07dD02*\n' % (util.in2gerb(OriginX), util.in2gerb(OriginY))) # Bottom-left
fid.write('X%07dY%07dD01*\n' % (util.in2gerb(OriginX), util.in2gerb(MaxYExtent))) # Top-left
fid.write('X%07dY%07dD01*\n' % (util.in2gerb(MaxXExtent), util.in2gerb(MaxYExtent))) # Top-right
fid.write('X%07dY%07dD01*\n' % (util.in2gerb(MaxXExtent), util.in2gerb(OriginY))) # Bottom-right
fid.write('X%07dY%07dD01*\n' % (util.in2gerb(OriginX), util.in2gerb(OriginY))) # Bottom-left
开发者ID:hwwong,项目名称:gerbmerge,代码行数:14,代码来源:gerbmerge.py
示例5: writeDrillLegend
def writeDrillLegend(fid, Tools, OriginY, MaxXExtent):
# This is the spacing from the right edge of the board to where the
# drill legend is to be drawn, in inches. Remember we have to allow
# for dimension arrows, too.
dimspace = 0.5 # inches
# This is the spacing from the drill hit glyph to the drill size
# in inches.
glyphspace = 0.1 # inches
# Convert to Gerber 2.5 units
dimspace = util.in2gerb(dimspace)
glyphspace = util.in2gerb(glyphspace)
# Construct a list of tuples (toolSize, toolNumber) where toolNumber
# is the position of the tool in Tools and toolSize is in inches.
L = []
toolNumber = -1
for tool in Tools:
toolNumber += 1
L.append((config.GlobalToolMap[tool], toolNumber))
# Now sort the list from smallest to largest
L.sort()
# And reverse to go from largest to smallest, so we can write the legend
# from the bottom up
L.reverse()
# For each tool, draw a drill hit marker then the size of the tool
# in inches.
posY = util.in2gerb(OriginY)
posX = util.in2gerb(MaxXExtent) + dimspace
maxX = 0
for size, toolNum in L:
# Determine string to write and midpoint of string
s = "{:.3f}\"".format(size)
ll, ur = makestroke.boundingBox(s, posX + glyphspace, posY) # Returns lower-left point, upper-right point
midpoint = (ur[1] + ll[1]) / 2
# Keep track of maximum extent of legend
maxX = max(maxX, ur[0])
makestroke.drawDrillHit(fid, posX, midpoint, toolNum)
makestroke.writeString(fid, s, posX + glyphspace, posY, 0)
posY += int(round((ur[1] - ll[1]) * 1.5))
# Return value is lower-left of user text area, without any padding.
return maxX, util.in2gerb(OriginY)
开发者ID:5shekel,项目名称:gerbmerge3,代码行数:50,代码来源:fabdrawing.py
示例6: writeUserText
def writeUserText(fid, X, Y):
fname = config.Config['fabricationdrawingtext']
if not fname:
return
try:
tfile = open(fname, 'rt')
except Exception as detail:
raise RuntimeError("Could not open fabrication drawing text file '{:s}':\n {:s}".format(fname, detail))
lines = tfile.readlines()
tfile.close()
lines.reverse() # We're going to print from bottom up
# Offset X position to give some clearance from drill legend
X += util.in2gerb(0.2) # 2000
for line in lines:
# Get rid of CR
line = line.replace('\x0D', '')
# Strip off trailing whitespace
line = line.rstrip()
# Blank lines still need height, so must have at least one character
if not line:
line = ' '
ll, ur = makestroke.boundingBox(line, X, Y)
makestroke.writeString(fid, line, X, Y, 0)
Y += int(round((ur[1] - ll[1]) * 1.5))
开发者ID:5shekel,项目名称:gerbmerge3,代码行数:32,代码来源:fabdrawing.py
示例7: rectangleAsRect
def rectangleAsRect(self, X, Y):
"""Return a 4-tuple (minx,miny,maxx,maxy) describing the area covered by
this Rectangle aperture when flashed at center co-ordinates (X,Y)"""
dx = util.in2gerb(self.dimx)
dy = util.in2gerb(self.dimy)
if dx & 1: # Odd-sized: X extents are (dx+1)/2 on the left and (dx-1)/2 on the right
xm = (dx+1)/2
xp = xm-1
else: # Even-sized: X extents are X-dx/2 and X+dx/2
xm = xp = dx/2
if dy & 1: # Odd-sized: Y extents are (dy+1)/2 below and (dy-1)/2 above
ym = (dy+1)/2
yp = ym-1
else: # Even-sized: Y extents are Y-dy/2 and Y+dy/2
ym = yp = dy/2
return (X-xm, Y-ym, X+xp, Y+yp)
开发者ID:himanshuchoudhary,项目名称:cscope,代码行数:19,代码来源:aptable.py
示例8: writeFiducials
def writeFiducials(fid, drawcode, OriginX, OriginY, MaxXExtent, MaxYExtent):
"""Place fiducials at arbitrary points. The FiducialPoints list in the config specifies
sets of X,Y co-ordinates. Positive values of X/Y represent offsets from the lower left
of the panel. Negative values of X/Y represent offsets from the top right. So:
FiducialPoints = 0.125,0.125,-0.125,-0.125
means to put a fiducial 0.125,0.125 from the lower left and 0.125,0.125 from the top right"""
fid.write('%s*\n' % drawcode) # Choose drawing aperture
fList = config.Config['fiducialpoints'].split(',')
for i in range(0, len(fList), 2):
x,y = float(fList[i]), float(fList[i+1])
if x>=0:
x += OriginX
else:
x = MaxXExtent + x
if y>=0:
y += OriginX
else:
y = MaxYExtent + y
fid.write('X%07dY%07dD03*\n' % (util.in2gerb(x), util.in2gerb(y)))
开发者ID:hwwong,项目名称:gerbmerge,代码行数:20,代码来源:gerbmerge.py
示例9: writeOutline
def writeOutline(fid, OriginX, OriginY, MaxXExtent, MaxYExtent):
# Write width-1 aperture to file
AP = aptable.Aperture(aptable.Circle, 'D10', 0.001)
AP.writeDef(fid)
# Choose drawing aperture D10
writeCurrentAperture(fid, 10)
# Draw the rectangle starting at the bottom left and going clockwise.
fid.write("X{:07d}Y{:07d}D02*\n".format(util.in2gerb(OriginX), util.in2gerb(OriginY)))
fid.write("Y{:07d}D01*\n".format(util.in2gerb(MaxYExtent)))
fid.write("X{:07d}D01*\n".format(util.in2gerb(MaxXExtent)))
fid.write("Y{:07d}D01*\n".format(util.in2gerb(OriginY)))
fid.write("X{:07d}D01*\n".format(util.in2gerb(OriginX)))
开发者ID:5shekel,项目名称:gerbmerge3,代码行数:14,代码来源:gerber.py
示例10: merge
#.........这里部分代码省略.........
writeFiducials(fid, drawing_code_fiducial_soldermask, OriginX, OriginY, MaxXExtent, MaxYExtent)
# KHK Patch Begin: added for Seeed Studio to generate an outline for all panelized gerber files
if config.Config['outlinelayers'] and (layername in config.Config['outlinelayers']):
writeOutline(fid, OriginX, OriginY, MaxXExtent, MaxYExtent)
# KHK Patch End: added for Seeed Studio to generate an outline for all panelized gerber files
writeGerberFooter(fid)
fid.close()
# Write board outline layer if selected
fullname = config.Config['outlinelayerfile']
if fullname and fullname.lower() != "none":
OutputFiles.append(fullname)
#print 'Writing %s ...' % fullname
fid = file(fullname, 'wt')
writeGerberHeader(fid)
# Write width-1 aperture to file
# add metric support
if config.Config['measurementunits'] == 'inch':
AP = aptable.Aperture(aptable.Circle, 'D10', 0.001)
else:
AP = aptable.Aperture(aptable.Circle, 'D10', 0.25) # we'll use 0.25 mm - same as Diptrace
AP.writeDef(fid)
# Choose drawing aperture D10
fid.write('D10*\n')
# Draw the rectangle
fid.write('X%07dY%07dD02*\n' % (util.in2gerb(OriginX), util.in2gerb(OriginY))) # Bottom-left
fid.write('X%07dY%07dD01*\n' % (util.in2gerb(OriginX), util.in2gerb(MaxYExtent))) # Top-left
fid.write('X%07dY%07dD01*\n' % (util.in2gerb(MaxXExtent), util.in2gerb(MaxYExtent))) # Top-right
fid.write('X%07dY%07dD01*\n' % (util.in2gerb(MaxXExtent), util.in2gerb(OriginY))) # Bottom-right
fid.write('X%07dY%07dD01*\n' % (util.in2gerb(OriginX), util.in2gerb(OriginY))) # Bottom-left
writeGerberFooter(fid)
fid.close()
# Write scoring layer if selected
fullname = config.Config['scoringfile']
if fullname and fullname.lower() != "none":
OutputFiles.append(fullname)
#print 'Writing %s ...' % fullname
fid = file(fullname, 'wt')
writeGerberHeader(fid)
# Write width-1 aperture to file
AP = aptable.Aperture(aptable.Circle, 'D10', 0.001)
AP.writeDef(fid)
# Choose drawing aperture D10
fid.write('D10*\n')
# Draw the scoring lines
scoring.writeScoring(fid, Place, OriginX, OriginY, MaxXExtent, MaxYExtent)
writeGerberFooter(fid)
fid.close()
# Get a list of all tools used by merging keys from each job's dictionary
# of tools.
if 0:
开发者ID:hwwong,项目名称:gerbmerge,代码行数:67,代码来源:gerbmerge.py
示例11: writeCropMarks
def writeCropMarks(fid, drawing_code, OriginX, OriginY, MaxXExtent, MaxYExtent):
"""Add corner crop marks on the given layer"""
# Draw 125mil lines at each corner, with line edge right up against
# panel border. This means the center of the line is D/2 offset
# from the panel border, where D is the drawing line diameter.
# use 3mm lines for metric
fid.write('%s*\n' % drawing_code) # Choose drawing aperture
offset = config.GAT[drawing_code].dimx/2.0
# should we be using 'cropmarkwidth' from config.py?
if config.Config['measurementunits'] == 'inch':
cropW = 0.125 #inch
else:
cropW = 3 #mm
# Lower-left
x = OriginX + offset
y = OriginY + offset
fid.write('X%07dY%07dD02*\n' % (util.in2gerb(x+cropW), util.in2gerb(y+0.000)))
fid.write('X%07dY%07dD01*\n' % (util.in2gerb(x+0.000), util.in2gerb(y+0.000)))
fid.write('X%07dY%07dD01*\n' % (util.in2gerb(x+0.000), util.in2gerb(y+cropW)))
# Lower-right
x = MaxXExtent - offset
y = OriginY + offset
fid.write('X%07dY%07dD02*\n' % (util.in2gerb(x+0.000), util.in2gerb(y+cropW)))
fid.write('X%07dY%07dD01*\n' % (util.in2gerb(x+0.000), util.in2gerb(y+0.000)))
fid.write('X%07dY%07dD01*\n' % (util.in2gerb(x-cropW), util.in2gerb(y+0.000)))
# Upper-right
x = MaxXExtent - offset
y = MaxYExtent - offset
fid.write('X%07dY%07dD02*\n' % (util.in2gerb(x-cropW), util.in2gerb(y+0.000)))
fid.write('X%07dY%07dD01*\n' % (util.in2gerb(x+0.000), util.in2gerb(y+0.000)))
fid.write('X%07dY%07dD01*\n' % (util.in2gerb(x+0.000), util.in2gerb(y-cropW)))
# Upper-left
x = OriginX + offset
y = MaxYExtent - offset
fid.write('X%07dY%07dD02*\n' % (util.in2gerb(x+0.000), util.in2gerb(y-cropW)))
fid.write('X%07dY%07dD01*\n' % (util.in2gerb(x+0.000), util.in2gerb(y+0.000)))
fid.write('X%07dY%07dD01*\n' % (util.in2gerb(x+cropW), util.in2gerb(y+0.000)))
开发者ID:hwwong,项目名称:gerbmerge,代码行数:47,代码来源:gerbmerge.py
示例12: writeCropMarks
def writeCropMarks(fid, drawing_code, OriginX, OriginY, MaxXExtent, MaxYExtent):
"""Add corner crop marks on the given layer"""
# Draw 125mil lines at each corner, with line edge right up against
# panel border. This means the center of the line is D/2 offset
# from the panel border, where D is the drawing line diameter.
fid.write("{:s}*\n".format(drawing_code)) # Choose drawing aperture
offset = config.GAT[drawing_code].dimx / 2.0
# Lower-left
x = OriginX + offset
y = OriginY + offset
fid.write("X{:07d}Y{:07d}D02*\n".format(util.in2gerb(x + 0.125), util.in2gerb(y + 0.000)))
fid.write("X{:07d}D01*\n".format(util.in2gerb(x + 0.000)))
fid.write("Y{:07d}D01*\n".format(util.in2gerb(y + 0.125)))
# Lower-right
x = MaxXExtent - offset
y = OriginY + offset
fid.write("X{:07d}Y{:07d}D02*\n".format(util.in2gerb(x + 0.000), util.in2gerb(y + 0.125)))
fid.write("Y{:07d}D01*\n".format(util.in2gerb(y + 0.000)))
fid.write("X{:07d}D01*\n".format(util.in2gerb(x - 0.125)))
# Upper-right
x = MaxXExtent - offset
y = MaxYExtent - offset
fid.write("X{:07d}Y{:07d}D02*\n".format(util.in2gerb(x - 0.125), util.in2gerb(y + 0.000)))
fid.write("X{:07d}D01*\n".format(util.in2gerb(x + 0.000)))
fid.write("Y{:07d}D01*\n".format(util.in2gerb(y - 0.125)))
# Upper-left
x = OriginX + offset
y = MaxYExtent - offset
fid.write("X{:07d}Y{:07d}D02*\n".format(util.in2gerb(x + 0.000), util.in2gerb(y - 0.125)))
fid.write("Y{:07d}D01*\n".format(util.in2gerb(y + 0.000)))
fid.write("X{:07d}D01*\n".format(util.in2gerb(x + 0.125)))
开发者ID:5shekel,项目名称:gerbmerge3,代码行数:37,代码来源:gerber.py
示例13: writeUserText
def writeUserText(fid, X, Y):
fname = config.Config['fabricationdrawingtext']
if not fname: return
try:
tfile = file(fname, 'rt')
except Exception, detail:
raise RuntimeError, "Could not open fabrication drawing text file '%s':\n %s" % (fname,str(detail))
lines = tfile.readlines()
tfile.close()
lines.reverse() # We're going to print from bottom up
# Offset X position to give some clearance from drill legend
X += util.in2gerb(0.2) # 2000
for line in lines:
# Get rid of CR
line = string.replace(line, '\x0D', '')
# Chop off \n
#if line[-1] in string.whitespace:
# line = line[:-1]
# Strip off trailing whitespace
line = string.rstrip(line)
# Blank lines still need height, so must have at least one character
if not line:
line = ' '
开发者ID:ryanfobel,项目名称:gerbmerge,代码行数:30,代码来源:fabdrawing.py
示例14: writeDimensionArrow
def writeDimensionArrow(fid, OriginX, OriginY, MaxXExtent, MaxYExtent):
x = util.in2gerb(OriginX)
y = util.in2gerb(OriginY)
X = util.in2gerb(MaxXExtent)
Y = util.in2gerb(MaxYExtent)
# This constant is how far away from the board the centerline of the dimension
# arrows should be, in inches.
# dimspace = 0.2 # KHK was the original line
if config.Config['measurementunits'] == 'inch':
dimspace = 0.2 # inches
else:
dimspace = 10 # mm - Distance of dimension line to board outline line
# Convert it to Gerber (0.00001" or 2.5) units
dimspace = util.in2gerb(dimspace)
# Draw an arrow above the board, on the left side and right side
makestroke.drawDimensionArrow(fid, x, Y+dimspace, makestroke.FacingLeft)
makestroke.drawDimensionArrow(fid, X, Y+dimspace, makestroke.FacingRight)
# Draw arrows to the right of the board, at top and bottom
makestroke.drawDimensionArrow(fid, X+dimspace, Y, makestroke.FacingUp)
makestroke.drawDimensionArrow(fid, X+dimspace, y, makestroke.FacingDown)
# Now draw the text. First, horizontal text above the board.
# s = '%.3f"' % (MaxXExtent - OriginX) # KHK orig line
if config.Config['measurementunits'] == 'inch':
s = '%.3f"' % (MaxXExtent - OriginX) # inche
else:
s = '%.3fmm' % (MaxXExtent - OriginX) # mm
ll, ur = makestroke.boundingBox(s, 0, 0)
s_width = ur[0]-ll[0] # Width in 2.5 units
s_height = ur[1]-ll[1] # Height in 2.5 units
# Compute the position in 2.5 units where we should draw this. It should be
# centered horizontally and also vertically about the dimension arrow centerline.
posX = x + (x+X)/2
posX -= s_width/2
posY = Y + dimspace - s_height/2
makestroke.writeString(fid, s, posX, posY, 0)
# Finally, draw the extending lines from the text to the arrows.
posY = Y + dimspace
#posX1 = posX - util.in2gerb(0.1*24.5) # 1000 # KHK orig. line
if config.Config['measurementunits'] == 'inch':
posX1 = posX - util.in2gerb(0.1 ) # 1000
else:
posX1 = posX - util.in2gerb(0.1*24.5) # 1000
# posX2 = posX + s_width + util.in2gerb(0.1*25.4) # 1000 # KHK orig. line
if config.Config['measurementunits'] == 'inch':
posX2 = posX + s_width + util.in2gerb(0.1) # 1000
else:
posX2 = posX + s_width + util.in2gerb(0.1*25.4) # 1000
makestroke.drawLine(fid, x, posY, posX1, posY)
makestroke.drawLine(fid, posX2, posY, X, posY)
# Now do the vertical text
# s = '%.3f"' % (MaxYExtent - OriginY) # KHK orig line
if config.Config['measurementunits'] == 'inch':
s = '%.3f"' % (MaxYExtent - OriginY)
else:
s = '%.3fmm' % (MaxYExtent - OriginY)
ll, ur = makestroke.boundingBox(s, 0, 0)
s_width = ur[0]-ll[0]
s_height = ur[1]-ll[1]
# As above, figure out where to draw this. Rotation will be -90 degrees
# so new origin will be top-left of bounding box after rotation.
posX = X + dimspace - s_height/2
posY = y + (y+Y)/2
posY += s_width/2
makestroke.writeString(fid, s, posX, posY, -90)
# Draw extending lines
posX = X + dimspace
# posY1 = posY + util.in2gerb(0.1) # 1000 # KHK orig. line
if config.Config['measurementunits'] == 'inch':
posY1 = posY + util.in2gerb(0.1) # 1000 # KHK orig. line
else:
posY1 = posY + util.in2gerb(0.1*25.4) # 1000 # KHK orig. line
# posY2 = posY - s_width - util.in2gerb(0.1) # 1000 # KHK orig. line
if config.Config['measurementunits'] == 'inch':
posY2 = posY - s_width - util.in2gerb(0.1) # 1000 # KHK orig. line
else:
posY2 = posY - s_width - util.in2gerb(0.1*25.4) # 1000
makestroke.drawLine(fid, posX, Y, posX, posY1)
makestroke.drawLine(fid, posX, posY2, posX, y)
开发者ID:Aerius42,项目名称:gerbmerge,代码行数:88,代码来源:fabdrawing.py
示例15: file
fname = config.Config['fabricationdrawingtext']
if not fname: return
try:
tfile = file(fname, 'rt')
except Exception, detail:
raise RuntimeError, "Could not open fabrication drawing text file '%s':\n %s" % (fname,str(detail))
lines = tfile.readlines()
tfile.close()
lines.reverse() # We're going to print from bottom up
# Offset X position to give some clearance from drill legend
# X += util.in2gerb(0.2*25.4) # 2000 # KHK orig. line
if config.Config['measurementunits'] == 'inch':
X += util.in2gerb(0.2) # 2000
else:
X += util.in2gerb(10) # 2000 # additional text is placed right of drill legend
for line in lines:
# Get rid of CR
line = string.replace(line, '\x0D', '')
# Chop off \n
#if line[-1] in string.whitespace:
# line = line[:-1]
# Strip off trailing whitespace
line = string.rstrip(line)
# Blank lines still need height, so must have at least one character
开发者ID:Aerius42,项目名称:gerbmerge,代码行数:31,代码来源:fabdrawing.py
示例16: file
fullname = config.Config['outlinelayerfile']
if fullname and fullname.lower() != "none":
OutputFiles.append(fullname)
#print 'Writing %s ...' % fullname
fid = file(fullname, 'wt')
writeGerberHeader(fid)
# Write width-1 aperture to file
AP = aptable.Aperture(aptable.Circle, 'D10', 0.001)
AP.writeDef(fid)
# Choose drawing aperture D10
fid.write('D10*\n')
# Draw the rectangle
fid.write('X%07dY%07dD02*\n' % (util.in2gerb(OriginX), util.in2gerb(OriginY))) # Bottom-left
fid.write('X%07dY%07dD01*\n' % (util.in2gerb(OriginX), util.in2gerb(MaxYExtent))) # Top-left
fid.write('X%07dY%07dD01*\n' % (util.in2gerb(MaxXExtent), util.in2gerb(MaxYExtent))) # Top-right
fid.write('X%07dY%07dD01*\n' % (util.in2gerb(MaxXExtent), util.in2gerb(OriginY))) # Bottom-right
fid.write('X%07dY%07dD01*\n' % (util.in2gerb(OriginX), util.in2gerb(OriginY))) # Bottom-left
writeGerberFooter(fid)
fid.close()
# Write scoring layer if selected
fullname = config.Config['scoringfile']
if fullname and fullname.lower() != "none":
OutputFiles.append(fullname)
#print 'Writing %s ...' % fullname
fid = file(fullname, 'wt')
writeGerberHeader(fid)
开发者ID:HaKDMoDz,项目名称:Fritzing-1,代码行数:31,代码来源:gerbmerge.py
注:本文中的util.in2gerb函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论