- 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
This commit is contained in:
Marius Stanciu
2019-05-18 00:17:37 +03:00
parent 7f0a1695ef
commit 630d9c733d
4 changed files with 35 additions and 28 deletions

View File

@@ -95,7 +95,7 @@ class App(QtCore.QObject):
# Version # Version
version = 8.917 version = 8.917
version_date = "2019/05/16" version_date = "2019/05/18"
beta = True beta = True
# current date now # current date now
@@ -2272,30 +2272,18 @@ class App(QtCore.QObject):
self.inform.emit(_("[WARNING] Object empty after edit.")) self.inform.emit(_("[WARNING] Object empty after edit."))
log.debug("App.editor2object() --> Geometry --> %s" % str(e)) log.debug("App.editor2object() --> Geometry --> %s" % str(e))
elif isinstance(edited_obj, FlatCAMGerber): elif isinstance(edited_obj, FlatCAMGerber):
new_obj = self.collection.get_active()
obj_type = "Gerber" obj_type = "Gerber"
if cleanup is None: if cleanup is None:
self.grb_editor.update_fcgerber(edited_obj) 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() self.grb_editor.deactivate_grb_editor()
# delete the old object (the source object) if it was an empty one # 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'] old_name = edited_obj.options['name']
self.collection.set_active(old_name) self.collection.set_active(old_name)
self.collection.delete_active() 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): elif isinstance(edited_obj, FlatCAMExcellon):
obj_type = "Excellon" obj_type = "Excellon"
if cleanup is None: if cleanup is None:
@@ -2992,6 +2980,7 @@ class App(QtCore.QObject):
grb_obj.multigeo = False grb_obj.multigeo = False
grb_obj.follow = False grb_obj.follow = False
grb_obj.apertures = {} grb_obj.apertures = {}
grb_obj.solid_geometry = []
try: try:
grb_obj.options['xmin'] = 0 grb_obj.options['xmin'] = 0

View File

@@ -12,8 +12,10 @@ CAD program, and create G-Code for Isolation routing.
17.05.2019 17.05.2019
- remade the Tool Cutout to work on panels - 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 - 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 16.05.2019

View File

@@ -3522,8 +3522,13 @@ class FlatCAMGrbEditor(QtCore.QObject):
new_poly = MultiPolygon(poly_buffer) new_poly = MultiPolygon(poly_buffer)
new_poly = new_poly.buffer(0.00000001) new_poly = new_poly.buffer(0.00000001)
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) grb_obj.follow_geometry = deepcopy(follow_buffer)
for k, v in self.gerber_obj_options.items(): for k, v in self.gerber_obj_options.items():

View File

@@ -175,16 +175,27 @@ class Properties(FlatCAMTool):
for ap in obj.apertures: for ap in obj.apertures:
temp_ap.clear() temp_ap.clear()
temp_ap = deepcopy(obj.apertures[ap]) temp_ap = deepcopy(obj.apertures[ap])
if obj.apertures[ap]['solid_geometry']: temp_ap.pop('geometry', None)
elems = len(obj.apertures[ap]['solid_geometry']) if obj.apertures[ap]['geometry']:
temp_ap['solid_geometry'] = '%s Polygons' % str(elems) solid_nr = 0
try: follow_nr = 0
if obj.apertures[ap]['follow_geometry']: clear_nr = 0
elems = len(obj.apertures[ap]['follow_geometry'])
temp_ap['follow_geometry'] = '%s Polygons' % str(elems) for el in obj.apertures[ap]['geometry']:
except KeyError: if 'solid' in el:
pass solid_nr += 1
self.addChild(apertures, [str(ap), str(temp_ap)], True) 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': elif obj.kind.lower() == 'excellon':
for tool, value in obj.tools.items(): for tool, value in obj.tools.items():
self.addChild(tools, [str(tool), str(value['C'])], True) self.addChild(tools, [str(tool), str(value['C'])], True)