diff --git a/FlatCAMApp.py b/FlatCAMApp.py index e5cd1830..0534d0a0 100644 --- a/FlatCAMApp.py +++ b/FlatCAMApp.py @@ -95,7 +95,7 @@ class App(QtCore.QObject): # Version version = 8.917 - version_date = "2019/05/16" + version_date = "2019/05/18" beta = True # current date now @@ -2272,30 +2272,18 @@ class App(QtCore.QObject): self.inform.emit(_("[WARNING] Object empty after edit.")) log.debug("App.editor2object() --> Geometry --> %s" % str(e)) elif isinstance(edited_obj, FlatCAMGerber): - new_obj = self.collection.get_active() obj_type = "Gerber" if cleanup is None: self.grb_editor.update_fcgerber(edited_obj) - self.grb_editor.update_options(new_obj) + self.grb_editor.update_options(edited_obj) self.grb_editor.deactivate_grb_editor() # delete the old object (the source object) if it was an empty one - if not edited_obj.solid_geometry: + if len(edited_obj.solid_geometry) == 0: old_name = edited_obj.options['name'] self.collection.set_active(old_name) self.collection.delete_active() - else: - # update the geo object options so it is including the bounding box values - # but don't do this for objects that are made out of empty source objects, it will fail - try: - xmin, ymin, xmax, ymax = new_obj.bounds() - new_obj.options['xmin'] = xmin - new_obj.options['ymin'] = ymin - new_obj.options['xmax'] = xmax - new_obj.options['ymax'] = ymax - except Exception as e: - self.inform.emit(_("[WARNING] Object empty after edit.")) - log.debug("App.editor2object() --> Gerber --> %s" % str(e)) + elif isinstance(edited_obj, FlatCAMExcellon): obj_type = "Excellon" if cleanup is None: @@ -2992,6 +2980,7 @@ class App(QtCore.QObject): grb_obj.multigeo = False grb_obj.follow = False grb_obj.apertures = {} + grb_obj.solid_geometry = [] try: grb_obj.options['xmin'] = 0 diff --git a/README.md b/README.md index 17a63774..d9d55302 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,10 @@ CAD program, and create G-Code for Isolation routing. 17.05.2019 - remade the Tool Cutout to work on panels -- remade the Tool Cutour such that on multiple applications on the same object it will yield the same result +- remade the Tool Cutout such that on multiple applications on the same object it will yield the same result - fixed an issue in the remade Cutout Tool where when applied on a single Gerber object, the Freeform Cutout produced no cutout Geometry object +- remade the Properties Tool such that it works with the new Gerber data structure in the obj.apertures. Also changed the view for the Gerber object in Properties +- fixed issue with false warning that the Gerber object has no geometry after an empty Gerber was edited and added geometry elements 16.05.2019 diff --git a/flatcamEditors/FlatCAMGrbEditor.py b/flatcamEditors/FlatCAMGrbEditor.py index 9d83acf8..9ee7f98d 100644 --- a/flatcamEditors/FlatCAMGrbEditor.py +++ b/flatcamEditors/FlatCAMGrbEditor.py @@ -3522,8 +3522,13 @@ class FlatCAMGrbEditor(QtCore.QObject): new_poly = MultiPolygon(poly_buffer) new_poly = new_poly.buffer(0.00000001) new_poly = new_poly.buffer(-0.00000001) - grb_obj.solid_geometry = deepcopy(new_poly) + try: + _ = iter(new_poly) + except TypeError: + new_poly = [new_poly] + + grb_obj.solid_geometry = deepcopy(new_poly) grb_obj.follow_geometry = deepcopy(follow_buffer) for k, v in self.gerber_obj_options.items(): diff --git a/flatcamTools/ToolProperties.py b/flatcamTools/ToolProperties.py index 63f329ae..8eeb59ed 100644 --- a/flatcamTools/ToolProperties.py +++ b/flatcamTools/ToolProperties.py @@ -175,16 +175,27 @@ class Properties(FlatCAMTool): for ap in obj.apertures: temp_ap.clear() temp_ap = deepcopy(obj.apertures[ap]) - if obj.apertures[ap]['solid_geometry']: - elems = len(obj.apertures[ap]['solid_geometry']) - temp_ap['solid_geometry'] = '%s Polygons' % str(elems) - try: - if obj.apertures[ap]['follow_geometry']: - elems = len(obj.apertures[ap]['follow_geometry']) - temp_ap['follow_geometry'] = '%s Polygons' % str(elems) - except KeyError: - pass - self.addChild(apertures, [str(ap), str(temp_ap)], True) + temp_ap.pop('geometry', None) + if obj.apertures[ap]['geometry']: + solid_nr = 0 + follow_nr = 0 + clear_nr = 0 + + for el in obj.apertures[ap]['geometry']: + if 'solid' in el: + solid_nr += 1 + if 'follow' in el: + follow_nr += 1 + if 'clear' in el: + clear_nr += 1 + temp_ap['Solid_Geo'] = '%s Polygons' % str(solid_nr) + temp_ap['Follow_Geo'] = '%s Polygons' % str(follow_nr) + temp_ap['Clear_Geo'] = '%s Polygons' % str(clear_nr) + + apid = self.addParent(apertures, str(ap), expanded=False, color=QtGui.QColor("#000000"), font=font) + for key in temp_ap: + self.addChild(apid, [str(key), str(temp_ap[key])], True) + elif obj.kind.lower() == 'excellon': for tool, value in obj.tools.items(): self.addChild(tools, [str(tool), str(value['C'])], True)