Merged in aligndrill-fix (pull request #4)
fix aligndrill and also logicical errors in it
This commit is contained in:
commit
ea25b739e3
|
@ -2315,6 +2315,7 @@ class App(QtCore.QObject):
|
||||||
'axis': str,
|
'axis': str,
|
||||||
'holes': str,
|
'holes': str,
|
||||||
'grid': float,
|
'grid': float,
|
||||||
|
'minoffset': float,
|
||||||
'gridoffset': float,
|
'gridoffset': float,
|
||||||
'axisoffset': float,
|
'axisoffset': float,
|
||||||
'dia': float,
|
'dia': float,
|
||||||
|
@ -2375,25 +2376,22 @@ class App(QtCore.QObject):
|
||||||
else:
|
else:
|
||||||
axisoffset=0
|
axisoffset=0
|
||||||
|
|
||||||
|
#this will align hole to given aligngridoffset and minimal offset from pcb, based on selected axis
|
||||||
if axis == "X":
|
if axis == "X":
|
||||||
firstpoint=-kwa['gridoffset']+xmin
|
firstpoint=kwa['gridoffset']
|
||||||
#-5
|
while (xmin-kwa['minoffset'])<firstpoint:
|
||||||
minlenght=(xmax-xmin+2*kwa['gridoffset'])
|
firstpoint=firstpoint-kwa['grid']
|
||||||
#57+10=67
|
lastpoint=kwa['gridoffset']
|
||||||
gridstripped=(minlenght//kwa['grid'])*kwa['grid']
|
while (xmax+kwa['minoffset'])>lastpoint:
|
||||||
#67//10=60
|
lastpoint=lastpoint+kwa['grid']
|
||||||
if (minlenght-gridstripped) >kwa['gridoffset']:
|
|
||||||
gridstripped=gridstripped+kwa['grid']
|
|
||||||
lastpoint=(firstpoint+gridstripped)
|
|
||||||
localHoles=(firstpoint,axisoffset),(lastpoint,axisoffset)
|
localHoles=(firstpoint,axisoffset),(lastpoint,axisoffset)
|
||||||
else:
|
else:
|
||||||
firstpoint=-kwa['gridoffset']+ymin
|
firstpoint=kwa['gridoffset']
|
||||||
minlenght=(ymax-ymin+2*kwa['gridoffset'])
|
while (ymin-kwa['minoffset'])<firstpoint:
|
||||||
gridstripped=minlenght//kwa['grid']*kwa['grid']
|
firstpoint=firstpoint-kwa['grid']
|
||||||
if (minlenght-gridstripped) >kwa['gridoffset']:
|
lastpoint=kwa['gridoffset']
|
||||||
gridstripped=gridstripped+kwa['grid']
|
while (ymax+kwa['minoffset'])>lastpoint:
|
||||||
lastpoint=(firstpoint+gridstripped)
|
lastpoint=lastpoint+kwa['grid']
|
||||||
localHoles=(axisoffset,firstpoint),(axisoffset,lastpoint)
|
localHoles=(axisoffset,firstpoint),(axisoffset,lastpoint)
|
||||||
|
|
||||||
for hole in localHoles:
|
for hole in localHoles:
|
||||||
|
@ -3151,12 +3149,13 @@ class App(QtCore.QObject):
|
||||||
'aligndrill': {
|
'aligndrill': {
|
||||||
'fcn': aligndrill,
|
'fcn': aligndrill,
|
||||||
'help': "Create excellon with drills for aligment.\n" +
|
'help': "Create excellon with drills for aligment.\n" +
|
||||||
"> aligndrill <name> [-dia <3.0 (float)>] -axis <X|Y> [-box <nameOfBox> [-grid <10 (float)> -gridoffset <5 (float)> [-axisoffset <0 (float)>]] | -dist <number>]\n" +
|
"> aligndrill <name> [-dia <3.0 (float)>] -axis <X|Y> [-box <nameOfBox> -minoffset <float> [-grid <10 (float)> -gridoffset <5 (float)> [-axisoffset <0 (float)>]] | -dist <number>]\n" +
|
||||||
" name: Name of the object (Gerber or Excellon) to mirror.\n" +
|
" name: Name of the object (Gerber or Excellon) to mirror.\n" +
|
||||||
" dia: Tool diameter\n" +
|
" dia: Tool diameter\n" +
|
||||||
" box: Name of object which act as box (cutout for example.)\n" +
|
" box: Name of object which act as box (cutout for example.)\n" +
|
||||||
" grid: aligning to grid, for thouse, who have aligning pins inside table in grid (-5,0),(5,0),(15,0)..." +
|
" grid: aligning to grid, for thouse, who have aligning pins inside table in grid (-5,0),(5,0),(15,0)..." +
|
||||||
" gridoffset: offset from pcb from 0 position and minimal offset to grid on max" +
|
" gridoffset: offset of grid from 0 position" +
|
||||||
|
" minoffset: min and max distance between align hole and pcb" +
|
||||||
" axisoffset: offset on second axis before aligment holes" +
|
" axisoffset: offset on second axis before aligment holes" +
|
||||||
" axis: Mirror axis parallel to the X or Y axis.\n" +
|
" axis: Mirror axis parallel to the X or Y axis.\n" +
|
||||||
" dist: Distance of the mirror axis to the X or Y axis."
|
" dist: Distance of the mirror axis to the X or Y axis."
|
||||||
|
|
Loading…
Reference in New Issue