diff --git a/CHANGELOG.md b/CHANGELOG.md
index a7daf1f5..d5828111 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,11 @@ CHANGELOG for FlatCAM beta
=================================================
+15.02.2022
+
+- fixed an issue with the moving shape when creating an exclusion area
+- added ability to copy the coordinates of the exclusion area with the context menu actions in the Exclusion areas table found in the Milling/Drilling plugins
+
13.02.2022
- fixed issue when doing a custom origin set
diff --git a/appCommon/Common.py b/appCommon/Common.py
index 96e66574..f61285b7 100644
--- a/appCommon/Common.py
+++ b/appCommon/Common.py
@@ -601,7 +601,7 @@ class ExclusionAreas(QtCore.QObject):
# "Y: %.4f " % (curr_pos[0], curr_pos[1]))
# self.app.ui.rel_position_label.setText("Dx: %.4f Dy: "
# "%.4f " % (self.app.dx, self.app.dy))
- self.app.ui.update_location_labels(self.dx, self.dy, curr_pos[0], curr_pos[1])
+ self.app.ui.update_location_labels(self.app.dx, self.app.dy, curr_pos[0], curr_pos[1])
units = self.app.app_units.lower()
# self.app.plotcanvas.text_hud.text = \
@@ -740,7 +740,7 @@ class ExclusionAreas(QtCore.QObject):
origin_point = Point(start_point)
buffered_storage = []
- # add a little something to the half diameter, to make sure that we really don't enter in the exclusion zones
+ # add a little something to the half diameter, to make sure that we really don't enter the exclusion zones
buffered_distance = (tooldia / 2.0) + (0.1 if self.app.app_units == 'MM' else 0.00393701)
for area in self.exclusion_areas_storage:
diff --git a/appParsers/ParseGerber.py b/appParsers/ParseGerber.py
index 135551a4..951bb919 100644
--- a/appParsers/ParseGerber.py
+++ b/appParsers/ParseGerber.py
@@ -2246,13 +2246,14 @@ class Gerber(Geometry):
return
# variables to display the percentage of work done
- self.geo_len = 0
- try:
- self.geo_len = len(self.solid_geometry)
- except AttributeError:
+ if isinstance(self.solid_geometry, (MultiPolygon, MultiLineString)):
self.geo_len = len(self.solid_geometry.geoms)
- except TypeError:
+ elif isinstance(self.solid_geometry, list):
+ self.geo_len = len(self.solid_geometry)
+ elif isinstance(self.solid_geometry, Polygon):
self.geo_len = 1
+ else:
+ self.geo_len = 0
self.old_disp_number = 0
self.el_count = 0
diff --git a/appPlugins/ToolDrilling.py b/appPlugins/ToolDrilling.py
index 9b8e91f1..c1b5889e 100644
--- a/appPlugins/ToolDrilling.py
+++ b/appPlugins/ToolDrilling.py
@@ -305,6 +305,10 @@ class ToolDrilling(AppTool, Excellon):
# ############################## EXCLUSION TABLE context menu #################################################
# #############################################################################################################
self.ui.exclusion_table.setupContextMenu()
+ self.ui.exclusion_table.addContextMenu(
+ '%s %s' % (_("Copy"), _("coords")), self.on_copy_exclusion_area_coords,
+ icon=QtGui.QIcon(self.app.resource_location + "/copy16.png")
+ )
self.ui.exclusion_table.addContextMenu(
_("Delete"), self.on_delete_sel_areas, icon=QtGui.QIcon(self.app.resource_location + "/trash16.png")
)
@@ -1694,6 +1698,27 @@ class ToolDrilling(AppTool, Excellon):
self.app.exc_areas.delete_sel_shapes(idxs=list(sel_rows))
self.app.exc_areas.e_shape_modified.emit()
+ def on_copy_exclusion_area_coords(self):
+ sel_model = self.ui.exclusion_table.selectionModel()
+ sel_indexes = sel_model.selectedIndexes()
+
+ # it will iterate over all indexes which means all items in all columns too but I'm interested only on rows
+ # so the duplicate rows will not be added
+ sel_rows = set()
+ for idx in sel_indexes:
+ sel_rows.add(idx.row())
+
+ if len(sel_rows) != 1:
+ self.app.inform.emit("[WARNING_NOTCL] %s" % _("Multiple areas selected. Only one area is allowed."))
+ return
+
+ row_idx = list(sel_rows)[0]
+ poly = self.app.exc_areas.exclusion_areas_storage[row_idx]['shape']
+ poly_coords = list(poly.exterior.coords)
+
+ self.app.clipboard.setText(str(poly_coords))
+ self.app.inform.emit('[success] %s' % _("Coordinates copied to clipboard."))
+
def draw_sel_shape(self):
sel_model = self.ui.exclusion_table.selectionModel()
sel_indexes = sel_model.selectedIndexes()
diff --git a/appPlugins/ToolMilling.py b/appPlugins/ToolMilling.py
index a5f0338c..da207572 100644
--- a/appPlugins/ToolMilling.py
+++ b/appPlugins/ToolMilling.py
@@ -435,6 +435,10 @@ class ToolMilling(AppTool, Excellon):
# ############################## EXCLUSION TABLE context menu #################################################
# #############################################################################################################
self.ui.exclusion_table.setupContextMenu()
+ self.ui.exclusion_table.addContextMenu(
+ '%s %s' % (_("Copy"), _("coords")), self.on_copy_exclusion_area_coords,
+ icon=QtGui.QIcon(self.app.resource_location + "/copy16.png")
+ )
self.ui.exclusion_table.addContextMenu(
_("Delete"), self.on_delete_sel_areas, icon=QtGui.QIcon(self.app.resource_location + "/trash16.png")
)
@@ -3787,6 +3791,27 @@ class ToolMilling(AppTool, Excellon):
self.app.exc_areas.delete_sel_shapes(idxs=list(sel_rows))
self.app.exc_areas.e_shape_modified.emit()
+ def on_copy_exclusion_area_coords(self):
+ sel_model = self.ui.exclusion_table.selectionModel()
+ sel_indexes = sel_model.selectedIndexes()
+
+ # it will iterate over all indexes which means all items in all columns too but I'm interested only on rows
+ # so the duplicate rows will not be added
+ sel_rows = set()
+ for idx in sel_indexes:
+ sel_rows.add(idx.row())
+
+ if len(sel_rows) != 1:
+ self.app.inform.emit("[WARNING_NOTCL] %s" % _("Multiple areas selected. Only one area is allowed."))
+ return
+
+ row_idx = list(sel_rows)[0]
+ poly = self.app.exc_areas.exclusion_areas_storage[row_idx]['shape']
+ poly_coords = list(poly.exterior.coords)
+
+ self.app.clipboard.setText(str(poly_coords))
+ self.app.inform.emit('[success] %s' % _("Coordinates copied to clipboard."))
+
def draw_sel_shape(self):
sel_model = self.ui.exclusion_table.selectionModel()
sel_indexes = sel_model.selectedIndexes()