From 41e63c43904347cd5b6c3651f99362513029215d Mon Sep 17 00:00:00 2001 From: jpcaram Date: Sat, 7 Feb 2015 18:41:29 -0500 Subject: [PATCH] Added paint_connect to standard paint algorithm. Resolves issue #103. --- FlatCAMObj.py | 8 ++++++++ ObjectUI.py | 1 - camlib.py | 14 +++++++++++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/FlatCAMObj.py b/FlatCAMObj.py index e455dbca..253ff3c4 100644 --- a/FlatCAMObj.py +++ b/FlatCAMObj.py @@ -602,6 +602,14 @@ class FlatCAMExcellon(FlatCAMObj, Excellon): self.ui.tools_table.setSortingEnabled(True) def set_ui(self, ui): + """ + Configures the user interface for this object. + Connects options to form fields. + + :param ui: User interface object. + :type ui: ExcellonObjectUI + :return: None + """ FlatCAMObj.set_ui(self, ui) FlatCAMApp.App.log.debug("FlatCAMExcellon.set_ui()") diff --git a/ObjectUI.py b/ObjectUI.py index 18918bf0..b52348cf 100644 --- a/ObjectUI.py +++ b/ObjectUI.py @@ -435,7 +435,6 @@ class ExcellonObjectUI(ObjectUI): grid1.addWidget(self.toolchangez_entry, 4, 1) self.ois_tcz = OptionalInputSection(self.toolchange_cb, [self.toolchangez_entry]) - choose_tools_label = QtGui.QLabel( "Select from the tools section above\n" "the tools you want to include." diff --git a/camlib.py b/camlib.py index 4dbbf1b9..e370bde1 100644 --- a/camlib.py +++ b/camlib.py @@ -376,6 +376,11 @@ class Geometry(object): geoms.insert(i) else: break + + # Optimization: Reduce lifts + log.debug("Reducing tool lifts...") + geoms = Geometry.paint_connect(geoms, polygon, tooldia) + return geoms @staticmethod @@ -481,7 +486,14 @@ class Geometry(object): Connects paths that results in a connection segment that is within the paint area. This avoids unnecessary tool lifting. - :return: + :param storage: Geometry to be optimized. + :type storage: FlatCAMRTreeStorage + :param boundary: Polygon defining the limits of the paintable area. + :type boundary: Polygon + :param max_walk: Maximum allowable distance without lifting tool. + :type max_walk: float or None + :return: Optimized geometry. + :rtype: FlatCAMRTreeStorage """ # If max_walk is not specified, the maximum allowed is