mirror of https://github.com/rusefi/gerbmerge.git
Modified jobs/writeCutLines to use the boardoutline file (if available
and specified in the layout.cfg file (as CutLineLayers) ) instead of generated cutlines
This commit is contained in:
parent
0b1315952f
commit
a65d1c9011
|
@ -1 +1,2 @@
|
||||||
*.pyc
|
*.pyc
|
||||||
|
/nbproject/private/
|
|
@ -566,6 +566,7 @@ def merge(opts, args, gui = None):
|
||||||
|
|
||||||
if config.Config['cutlinelayers'] and (layername in config.Config['cutlinelayers']):
|
if config.Config['cutlinelayers'] and (layername in config.Config['cutlinelayers']):
|
||||||
fid.write('%s*\n' % drawing_code_cut) # Choose drawing aperture
|
fid.write('%s*\n' % drawing_code_cut) # Choose drawing aperture
|
||||||
|
#print "writing drawcode_cut: %s" % drawing_code_cut
|
||||||
job.writeCutLines(fid, drawing_code_cut, OriginX, OriginY, MaxXExtent, MaxYExtent)
|
job.writeCutLines(fid, drawing_code_cut, OriginX, OriginY, MaxXExtent, MaxYExtent)
|
||||||
|
|
||||||
if config.Config['cropmarklayers']:
|
if config.Config['cropmarklayers']:
|
||||||
|
|
|
@ -1138,68 +1138,90 @@ class JobLayout:
|
||||||
def notEdge(x, X):
|
def notEdge(x, X):
|
||||||
return round(abs(1000*(x-X)))
|
return round(abs(1000*(x-X)))
|
||||||
|
|
||||||
assert self.x and self.y
|
#assert self.x and self.y
|
||||||
|
|
||||||
radius = config.GAT[drawing_code].dimx/2.0
|
#if job has a boardoutline layer, write it, else calculate one
|
||||||
|
outline_layer = 'boardoutline';
|
||||||
|
if self.job.hasLayer(outline_layer):
|
||||||
|
# somewhat of a hack here; making use of code in gerbmerge, around line 516,
|
||||||
|
# we are going to replace the used of the existing draw code in the boardoutline
|
||||||
|
# file with the one passed in (which was created from layout.cfg ('CutLineWidth')
|
||||||
|
# It is a hack in that we are assuming there is only one draw code in the
|
||||||
|
# boardoutline file. We are just going to ignore that definition and change
|
||||||
|
# all usages of that code to our new one. As a side effect, it will make
|
||||||
|
# the merged boardoutline file invalid, but we aren't using it with this method.
|
||||||
|
temp = []
|
||||||
|
for x in self.job.commands[outline_layer]:
|
||||||
|
if x[0] == 'D':
|
||||||
|
temp.append(drawing_code) ## replace old aperture with new one
|
||||||
|
else:
|
||||||
|
temp.append(x) ## keep old command
|
||||||
|
self.job.commands[outline_layer] = temp
|
||||||
|
|
||||||
# Start at lower-left, proceed clockwise
|
#self.job.writeGerber(fid, outline_layer, X1, Y1)
|
||||||
x = self.x - radius
|
self.writeGerber(fid, outline_layer)
|
||||||
y = self.y - radius
|
|
||||||
|
|
||||||
left = notEdge(self.x, X1)
|
else:
|
||||||
right = notEdge(self.x+self.width_in(), X2)
|
radius = config.GAT[drawing_code].dimx/2.0
|
||||||
bot = notEdge(self.y, Y1)
|
|
||||||
top = notEdge(self.y+self.height_in(), Y2)
|
|
||||||
|
|
||||||
BL = ((x), (y))
|
# Start at lower-left, proceed clockwise
|
||||||
TL = ((x), (y+self.height_in()+2*radius))
|
x = self.x - radius
|
||||||
TR = ((x+self.width_in()+2*radius), (y+self.height_in()+2*radius))
|
y = self.y - radius
|
||||||
BR = ((x+self.width_in()+2*radius), (y))
|
|
||||||
|
|
||||||
if not left:
|
left = notEdge(self.x, X1)
|
||||||
BL = (BL[0]+2*radius, BL[1])
|
right = notEdge(self.x+self.width_in(), X2)
|
||||||
TL = (TL[0]+2*radius, TL[1])
|
bot = notEdge(self.y, Y1)
|
||||||
|
top = notEdge(self.y+self.height_in(), Y2)
|
||||||
|
|
||||||
if not top:
|
BL = ((x), (y))
|
||||||
TL = (TL[0], TL[1]-2*radius)
|
TL = ((x), (y+self.height_in()+2*radius))
|
||||||
TR = (TR[0], TR[1]-2*radius)
|
TR = ((x+self.width_in()+2*radius), (y+self.height_in()+2*radius))
|
||||||
|
BR = ((x+self.width_in()+2*radius), (y))
|
||||||
|
|
||||||
if not right:
|
if not left:
|
||||||
TR = (TR[0]-2*radius, TR[1])
|
BL = (BL[0]+2*radius, BL[1])
|
||||||
BR = (BR[0]-2*radius, BR[1])
|
TL = (TL[0]+2*radius, TL[1])
|
||||||
|
|
||||||
if not bot:
|
if not top:
|
||||||
BL = (BL[0], BL[1]+2*radius)
|
TL = (TL[0], TL[1]-2*radius)
|
||||||
BR = (BR[0], BR[1]+2*radius)
|
TR = (TR[0], TR[1]-2*radius)
|
||||||
|
|
||||||
BL = (util.in2gerb(BL[0]), util.in2gerb(BL[1]))
|
if not right:
|
||||||
TL = (util.in2gerb(TL[0]), util.in2gerb(TL[1]))
|
TR = (TR[0]-2*radius, TR[1])
|
||||||
TR = (util.in2gerb(TR[0]), util.in2gerb(TR[1]))
|
BR = (BR[0]-2*radius, BR[1])
|
||||||
BR = (util.in2gerb(BR[0]), util.in2gerb(BR[1]))
|
|
||||||
|
|
||||||
# The "if 1 or ..." construct draws all four sides of the job. By
|
if not bot:
|
||||||
# removing the 1 from the expression, only the sides that do not
|
BL = (BL[0], BL[1]+2*radius)
|
||||||
# correspond to panel edges are drawn. The former is probably better
|
BR = (BR[0], BR[1]+2*radius)
|
||||||
# since panels tend to have a little slop from the cutting operation
|
|
||||||
# and it's easier to just cut it smaller when there's a cut line.
|
|
||||||
# The way it is now with "if 1 or....", much of this function is
|
|
||||||
# unnecessary. Heck, we could even just use the boardoutline layer
|
|
||||||
# directly.
|
|
||||||
if 1 or left:
|
|
||||||
fid.write('X%07dY%07dD02*\n' % BL)
|
|
||||||
fid.write('X%07dY%07dD01*\n' % TL)
|
|
||||||
|
|
||||||
if 1 or top:
|
BL = (util.in2gerb(BL[0]), util.in2gerb(BL[1]))
|
||||||
if not left: fid.write('X%07dY%07dD02*\n' % TL)
|
TL = (util.in2gerb(TL[0]), util.in2gerb(TL[1]))
|
||||||
fid.write('X%07dY%07dD01*\n' % TR)
|
TR = (util.in2gerb(TR[0]), util.in2gerb(TR[1]))
|
||||||
|
BR = (util.in2gerb(BR[0]), util.in2gerb(BR[1]))
|
||||||
|
|
||||||
if 1 or right:
|
# The "if 1 or ..." construct draws all four sides of the job. By
|
||||||
if not top: fid.write('X%07dY%07dD02*\n' % TR)
|
# removing the 1 from the expression, only the sides that do not
|
||||||
fid.write('X%07dY%07dD01*\n' % BR)
|
# correspond to panel edges are drawn. The former is probably better
|
||||||
|
# since panels tend to have a little slop from the cutting operation
|
||||||
|
# and it's easier to just cut it smaller when there's a cut line.
|
||||||
|
# The way it is now with "if 1 or....", much of this function is
|
||||||
|
# unnecessary. Heck, we could even just use the boardoutline layer
|
||||||
|
# directly.
|
||||||
|
if 1 or left:
|
||||||
|
fid.write('X%07dY%07dD02*\n' % BL)
|
||||||
|
fid.write('X%07dY%07dD01*\n' % TL)
|
||||||
|
|
||||||
if 1 or bot:
|
if 1 or top:
|
||||||
if not right: fid.write('X%07dY%07dD02*\n' % BR)
|
if not left: fid.write('X%07dY%07dD02*\n' % TL)
|
||||||
fid.write('X%07dY%07dD01*\n' % BL)
|
fid.write('X%07dY%07dD01*\n' % TR)
|
||||||
|
|
||||||
|
if 1 or right:
|
||||||
|
if not top: fid.write('X%07dY%07dD02*\n' % TR)
|
||||||
|
fid.write('X%07dY%07dD01*\n' % BR)
|
||||||
|
|
||||||
|
if 1 or bot:
|
||||||
|
if not right: fid.write('X%07dY%07dD02*\n' % BR)
|
||||||
|
fid.write('X%07dY%07dD01*\n' % BL)
|
||||||
|
|
||||||
def setPosition(self, x, y):
|
def setPosition(self, x, y):
|
||||||
self.x=x
|
self.x=x
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
gerbmerge.dir=gerbmerge
|
||||||
|
java.lib.path=
|
||||||
|
main.file=gerbmerge.py
|
||||||
|
platform.active=Python_2.7.3
|
||||||
|
python.lib.path=/home/scott/development/gerbmerge|
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||||
|
<type>org.netbeans.modules.python.project</type>
|
||||||
|
<configuration>
|
||||||
|
<data xmlns="http://nbpython.dev.java.net/ns/php-project/1">
|
||||||
|
<name>NewPythonProject</name>
|
||||||
|
<sources>
|
||||||
|
<root id="gerbmerge.dir"/>
|
||||||
|
</sources>
|
||||||
|
<tests/>
|
||||||
|
</data>
|
||||||
|
</configuration>
|
||||||
|
</project>
|
Loading…
Reference in New Issue