diff --git a/gcodeextractor/UI/UI.py b/gcodeextractor/UI/UI.py index 1a69f18..ae027b8 100644 --- a/gcodeextractor/UI/UI.py +++ b/gcodeextractor/UI/UI.py @@ -49,8 +49,8 @@ class button: def execution(self): if self.verifyEntry(): - main(PCB.path, Gcode.path, bool(ascii.Box.current()), int(Width.Box.get()), int(Height.Box.get()), - int(radius.Box.get()), unit.Box.get()) + main(PCB.path, Gcode.path, bool(ascii.Box.current()), float(Width.Box.get()), float(Height.Box.get()), + float(radius.Box.get()), unit.Box.get()) os.startfile(Gcode.path.rsplit('/', 1)[0]) else: print('FAIL') @@ -75,8 +75,8 @@ class button: self.State.config(text = 'ERROR: File type is not .gcode', fg = 'red', font = 'Helvetica 10 bold') return 0 try: - main(PCB.path, Gcode.path, bool(ascii.Box.current()), int(Width.Box.get()), int(Height.Box.get()), - int(radius.Box.get()), unit.Box.get()) + main(PCB.path, Gcode.path, bool(ascii.Box.current()), float(Width.Box.get()), float(Height.Box.get()), + float(radius.Box.get()), unit.Box.get()) except: self.State.config(text='ERROR: unexpected error', fg='red', font='Helvetica 10 bold') #raise @@ -138,10 +138,10 @@ root.geometry("550x300") PCB = pathFind(root, 'PCB image path', TRUE) Gcode = pathFind(root, 'Gcode output path', FALSE) 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) -radius = textBox(root, 'Tool\'s radius in mm', 1) -unit = menuBox(root, 'PCB dimension unit', ['mm', 'm', 'in']) +Width = textBox(root, 'Width of the PCB', 100) +radius = textBox(root, 'Tool\'s radius in mm', 0.37) +unit = menuBox(root, 'PCB dimension unit', ['mm', 'cm', 'm', 'in']) button = button(root) diff --git a/gcodeextractor/main.py b/gcodeextractor/main.py index c92a8ef..694aa7b 100644 --- a/gcodeextractor/main.py +++ b/gcodeextractor/main.py @@ -26,9 +26,9 @@ def main(inputPath, outputPath, isAscii, heightReal, widthReal, tool, unit): pxHeight, pxWidth = FileUtils.getPixelSize(height, width, heightReal, widthReal, unit = unit) if pxHeight > pxWidth: - rTool = int(math.ceil(tool * pxHeight)) + rTool = int(math.ceil(tool / pxHeight)) else: - rTool = int(math.ceil(tool * pxWidth)) + rTool = int(math.ceil(tool / pxWidth)) matrixUpdated = path(matrix, rTool) listIndexes = createSequence(matrixUpdated) @@ -40,9 +40,9 @@ if __name__ == "__main__": 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('-o', required = True, help = 'Gcode output path') - parser.add_argument('-wi', required = True, type = int, help = 'Width of the PCB') - parser.add_argument('-he', required = True, type = int, help = 'Height of the PCB') - parser.add_argument('-t', required = True, type = int, help = 'Tool\'s radius in mm') + parser.add_argument('-wi', required = True, type = float, help = 'Width of the PCB') + parser.add_argument('-he', required = True, type = float, help = 'Height of the PCB') + parser.add_argument('-t', required = True, type = float, help = 'Tool\'s radius in mm') parser.add_argument('-u', required = False, help = 'PCB dimension unit') args = parser.parse_args()