diff --git a/README.md b/README.md index 703b4389..00b53367 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ CAD program, and create G-Code for Isolation routing. - added a new tool named Minimum Distance Tool who will calculate the minimum distance between two objects; key shortcut: SHIFT + M - finished the Minimum Distance Tool in case of using it at the object level (not in Editors) - completed the Minimum Distance Tool by adding the usage in Editors +- made the Minimum Distance Tool more precise for the Excellon Editor since in the Excellon Editor the holes shape are represented as a cross line but in reality they should be evaluated as circles 29.09.2019 diff --git a/flatcamTools/ToolDistanceMin.py b/flatcamTools/ToolDistanceMin.py index 1de4b98a..a4153813 100644 --- a/flatcamTools/ToolDistanceMin.py +++ b/flatcamTools/ToolDistanceMin.py @@ -214,7 +214,19 @@ class DistanceMin(FlatCAMTool): str(len(selected_objs)))) return else: - first_pos, last_pos = nearest_points(selected_objs[0].geo, selected_objs[1].geo) + # the objects are really MultiLinesStrings made out of 2 lines in cross shape + xmin, ymin, xmax, ymax = selected_objs[0].geo.bounds + first_geo_radius = (xmax - xmin) / 2 + first_geo_center = Point(xmin + first_geo_radius, ymin + first_geo_radius) + first_geo = first_geo_center.buffer(first_geo_radius) + + # the objects are really MultiLinesStrings made out of 2 lines in cross shape + xmin, ymin, xmax, ymax = selected_objs[1].geo.bounds + last_geo_radius = (xmax - xmin) / 2 + last_geo_center = Point(xmin + last_geo_radius, ymin + last_geo_radius) + last_geo = last_geo_center.buffer(last_geo_radius) + + first_pos, last_pos = nearest_points(first_geo, last_geo) elif self.app.call_source == 'grb_editor': selected_objs = self.app.grb_editor.selected if len(selected_objs) != 2: