From fd104eee557892eb9d30d7804ca6169949b1183c Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Mon, 12 Aug 2019 00:28:46 +0300 Subject: [PATCH] - done regression to solve the bug with multiple passes cutting from the copper features (I should remember not to make mods here) - if 'combine' is checked in Gerber isolation but there is only one pass, the resulting geometry will still be single geo - the 'passes' entry was changed to a IntSpinner so it will allow passes to be entered only in range (1, 999) - it will not allow entry of 0 which may create some issues --- FlatCAMObj.py | 7 ++++++- README.md | 6 ++++++ camlib.py | 26 +++++++++++--------------- flatcamGUI/FlatCAMGUI.py | 3 ++- flatcamGUI/ObjectUI.py | 3 ++- 5 files changed, 27 insertions(+), 18 deletions(-) diff --git a/FlatCAMObj.py b/FlatCAMObj.py index 03f478f7..80f77709 100644 --- a/FlatCAMObj.py +++ b/FlatCAMObj.py @@ -983,7 +983,12 @@ class FlatCAMGerber(FlatCAMObj, Gerber): if empty_cnt == len(geo_obj.solid_geometry): raise ValidationError("Empty Geometry", None) - geo_obj.multigeo = True + + # even if combine is checked, one pass is still singlegeo + if passes > 1: + geo_obj.multigeo = True + else: + geo_obj.multigeo = False # TODO: Do something if this is None. Offer changing name? self.app.new_object("geometry", iso_name, iso_init) diff --git a/README.md b/README.md index be282fc5..e9ec3e33 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,12 @@ CAD program, and create G-Code for Isolation routing. ================================================= +12.08.2019 + +- done regression to solve the bug with multiple passes cutting from the copper features (I should remember not to make mods here) +- if 'combine' is checked in Gerber isolation but there is only one pass, the resulting geometry will still be single geo +- the 'passes' entry was changed to a IntSpinner so it will allow passes to be entered only in range (1, 999) - it will not allow entry of 0 which may create some issues + 11.08.2019 - small changes regarding the Project Title diff --git a/camlib.py b/camlib.py index 6a898185..fb8a8f59 100644 --- a/camlib.py +++ b/camlib.py @@ -554,22 +554,18 @@ class Geometry(object): if follow: geo_iso = self.follow_geometry else: - if corner is None: - try: - __ = iter(self.solid_geometry) - for el in self.solid_geometry: - geo_iso.append(el.buffer(offset, int(int(self.geo_steps_per_circle) / 4))) - except TypeError: - geo_iso = [self.solid_geometry.buffer(offset, int(int(self.geo_steps_per_circle) / 4))] + if isinstance(self.solid_geometry, list): + temp_geo = cascaded_union(self.solid_geometry) else: - try: - __ = iter(self.solid_geometry) - for el in self.solid_geometry: - geo_iso.append(el.buffer(offset, int(int(self.geo_steps_per_circle) / 4), - join_style=corner)) - except TypeError: - geo_iso = [self.solid_geometry.buffer(offset, int(int(self.geo_steps_per_circle) / 4), - join_style=corner)] + temp_geo = self.solid_geometry + + # Remember: do not make a buffer for each element in the solid_geometry because it will cut into + # other copper features + if corner is None: + geo_iso = temp_geo.buffer(offset, int(int(self.geo_steps_per_circle) / 4)) + else: + geo_iso = temp_geo.buffer(offset, int(int(self.geo_steps_per_circle) / 4), + join_style=corner) # end of replaced block if follow: diff --git a/flatcamGUI/FlatCAMGUI.py b/flatcamGUI/FlatCAMGUI.py index 7f973b6a..d9714897 100644 --- a/flatcamGUI/FlatCAMGUI.py +++ b/flatcamGUI/FlatCAMGUI.py @@ -4092,7 +4092,8 @@ class GerberOptPrefGroupUI(OptionsGroupUI): "number (integer) of tool widths.") ) grid0.addWidget(passlabel, 1, 0) - self.iso_width_entry = IntEntry() + self.iso_width_entry = FCSpinner() + self.iso_width_entry.setRange(1, 999) grid0.addWidget(self.iso_width_entry, 1, 1) # Pass overlap diff --git a/flatcamGUI/ObjectUI.py b/flatcamGUI/ObjectUI.py index ff5906eb..7cbf92ea 100644 --- a/flatcamGUI/ObjectUI.py +++ b/flatcamGUI/ObjectUI.py @@ -276,7 +276,8 @@ class GerberObjectUI(ObjectUI): ) passlabel.setMinimumWidth(90) grid1.addWidget(passlabel, 1, 0) - self.iso_width_entry = IntEntry() + self.iso_width_entry = FCSpinner() + self.iso_width_entry.setRange(1, 999) grid1.addWidget(self.iso_width_entry, 1, 1) overlabel = QtWidgets.QLabel(_('Pass overlap:'))