From 16af642409c8aa4ca104fc7f4e1237354f98e660 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Sun, 30 Jan 2022 16:54:20 +0200 Subject: [PATCH] - in `drillcncjob` Tcl command added the usage of `RTree` path optimization and made it the default choice --- CHANGELOG.md | 1 + camlib.py | 7 ++++--- tclCommands/TclCommandDrillcncjob.py | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 69479713..2d4b4951 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ CHANGELOG for FlatCAM beta - fixed not adding the feedrate code in `drillcncjob` Tcl command - fixed crash when trying to do a `select all` and there are app Scripts present - updated the `drillcncjob` Tcl command to make a script exit in case of an error +- in `drillcncjob` Tcl command added the usage of `RTree` path optimization and made it the default choice 29.01.2022 diff --git a/camlib.py b/camlib.py index 260fa0a8..9996d309 100644 --- a/camlib.py +++ b/camlib.py @@ -4353,9 +4353,7 @@ class CNCjob(Geometry): altPoints.append((point.coords.xy[0][0], point.coords.xy[1][0])) optimized_path = self.optimized_travelling_salesman(altPoints) elif used_excellon_optimization_type == 'R': - for point in points[tool]: - altPoints.append((point.coords.xy[0][0], point.coords.xy[1][0])) - optimized_path = self.exc_optimized_rtree(altPoints) + optimized_path = self.exc_optimized_rtree(points[tool]) if optimized_path == 'fail': return 'fail' else: @@ -4426,6 +4424,9 @@ class CNCjob(Geometry): if used_excellon_optimization_type == 'T': locx = point[0] locy = point[1] + elif used_excellon_optimization_type == 'R': + locx = point[0][0] + locy = point[0][1] else: locx = locations[point][0] locy = locations[point][1] diff --git a/tclCommands/TclCommandDrillcncjob.py b/tclCommands/TclCommandDrillcncjob.py index 64f11e96..a3019c10 100644 --- a/tclCommands/TclCommandDrillcncjob.py +++ b/tclCommands/TclCommandDrillcncjob.py @@ -270,7 +270,8 @@ class TclCommandDrillcncjob(TclCommandSignaled): "in format (x, y) - no spaces allowed. But always two comma separated values.") return "fail" - opt_type = args["opt_type"] if "opt_type" in args and args["opt_type"] else 'B' + # Path optimization + opt_type = args["opt_type"] if "opt_type" in args and args["opt_type"] else 'R' # ########################################################################################## # ################# Set parameters #########################################################