Changed int input to float in main
Floats give more precision, change a math operation that was wrong
This commit is contained in:
@@ -49,8 +49,8 @@ class button:
|
|||||||
|
|
||||||
def execution(self):
|
def execution(self):
|
||||||
if self.verifyEntry():
|
if self.verifyEntry():
|
||||||
main(PCB.path, Gcode.path, bool(ascii.Box.current()), int(Width.Box.get()), int(Height.Box.get()),
|
main(PCB.path, Gcode.path, bool(ascii.Box.current()), float(Width.Box.get()), float(Height.Box.get()),
|
||||||
int(radius.Box.get()), unit.Box.get())
|
float(radius.Box.get()), unit.Box.get())
|
||||||
os.startfile(Gcode.path.rsplit('/', 1)[0])
|
os.startfile(Gcode.path.rsplit('/', 1)[0])
|
||||||
else:
|
else:
|
||||||
print('FAIL')
|
print('FAIL')
|
||||||
@@ -75,8 +75,8 @@ class button:
|
|||||||
self.State.config(text = 'ERROR: File type is not .gcode', fg = 'red', font = 'Helvetica 10 bold')
|
self.State.config(text = 'ERROR: File type is not .gcode', fg = 'red', font = 'Helvetica 10 bold')
|
||||||
return 0
|
return 0
|
||||||
try:
|
try:
|
||||||
main(PCB.path, Gcode.path, bool(ascii.Box.current()), int(Width.Box.get()), int(Height.Box.get()),
|
main(PCB.path, Gcode.path, bool(ascii.Box.current()), float(Width.Box.get()), float(Height.Box.get()),
|
||||||
int(radius.Box.get()), unit.Box.get())
|
float(radius.Box.get()), unit.Box.get())
|
||||||
except:
|
except:
|
||||||
self.State.config(text='ERROR: unexpected error', fg='red', font='Helvetica 10 bold')
|
self.State.config(text='ERROR: unexpected error', fg='red', font='Helvetica 10 bold')
|
||||||
#raise
|
#raise
|
||||||
@@ -138,10 +138,10 @@ root.geometry("550x300")
|
|||||||
PCB = pathFind(root, 'PCB image path', TRUE)
|
PCB = pathFind(root, 'PCB image path', TRUE)
|
||||||
Gcode = pathFind(root, 'Gcode output path', FALSE)
|
Gcode = pathFind(root, 'Gcode output path', FALSE)
|
||||||
ascii = menuBox(root, 'If the image is in ascii or binary', ['binary','ascii'])
|
ascii = menuBox(root, 'If the image is in ascii or binary', ['binary','ascii'])
|
||||||
Width = textBox(root, 'Width of the PCB', 100)
|
|
||||||
Height = textBox(root, 'Height of the PCB', 100)
|
Height = textBox(root, 'Height of the PCB', 100)
|
||||||
radius = textBox(root, 'Tool\'s radius in mm', 1)
|
Width = textBox(root, 'Width of the PCB', 100)
|
||||||
unit = menuBox(root, 'PCB dimension unit', ['mm', 'm', 'in'])
|
radius = textBox(root, 'Tool\'s radius in mm', 0.37)
|
||||||
|
unit = menuBox(root, 'PCB dimension unit', ['mm', 'cm', 'm', 'in'])
|
||||||
|
|
||||||
button = button(root)
|
button = button(root)
|
||||||
|
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ def main(inputPath, outputPath, isAscii, heightReal, widthReal, tool, unit):
|
|||||||
pxHeight, pxWidth = FileUtils.getPixelSize(height, width, heightReal, widthReal, unit = unit)
|
pxHeight, pxWidth = FileUtils.getPixelSize(height, width, heightReal, widthReal, unit = unit)
|
||||||
|
|
||||||
if pxHeight > pxWidth:
|
if pxHeight > pxWidth:
|
||||||
rTool = int(math.ceil(tool * pxHeight))
|
rTool = int(math.ceil(tool / pxHeight))
|
||||||
else:
|
else:
|
||||||
rTool = int(math.ceil(tool * pxWidth))
|
rTool = int(math.ceil(tool / pxWidth))
|
||||||
|
|
||||||
matrixUpdated = path(matrix, rTool)
|
matrixUpdated = path(matrix, rTool)
|
||||||
listIndexes = createSequence(matrixUpdated)
|
listIndexes = createSequence(matrixUpdated)
|
||||||
@@ -40,9 +40,9 @@ if __name__ == "__main__":
|
|||||||
parser.add_argument('-i', required = True, help = 'PCB image path')
|
parser.add_argument('-i', required = True, help = 'PCB image path')
|
||||||
parser.add_argument('--ascii', required = False, dest='imgTypeisAscii', action = 'store_true', help = 'If the image is in ascii(True) or binary(False)')
|
parser.add_argument('--ascii', required = False, dest='imgTypeisAscii', action = 'store_true', help = 'If the image is in ascii(True) or binary(False)')
|
||||||
parser.add_argument('-o', required = True, help = 'Gcode output path')
|
parser.add_argument('-o', required = True, help = 'Gcode output path')
|
||||||
parser.add_argument('-wi', required = True, type = int, help = 'Width of the PCB')
|
parser.add_argument('-wi', required = True, type = float, help = 'Width of the PCB')
|
||||||
parser.add_argument('-he', required = True, type = int, help = 'Height of the PCB')
|
parser.add_argument('-he', required = True, type = float, help = 'Height of the PCB')
|
||||||
parser.add_argument('-t', required = True, type = int, help = 'Tool\'s radius in mm')
|
parser.add_argument('-t', required = True, type = float, help = 'Tool\'s radius in mm')
|
||||||
parser.add_argument('-u', required = False, help = 'PCB dimension unit')
|
parser.add_argument('-u', required = False, help = 'PCB dimension unit')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user