- made units change from Edit -> Toggle Units not to affect the preferences
- remade the way the aperture marks are plotted in Gerber Object
This commit is contained in:
parent
7c334d7606
commit
d35ae3a39a
|
@ -3714,7 +3714,7 @@ class App(QtCore.QObject):
|
|||
self.ui.general_defaults_form.general_app_group.units_radio.set_value("IN")
|
||||
else:
|
||||
self.ui.general_defaults_form.general_app_group.units_radio.set_value("MM")
|
||||
self.on_toggle_units()
|
||||
self.on_toggle_units(no_pref=True)
|
||||
|
||||
def on_fullscreen(self):
|
||||
self.report_usage("on_fullscreen()")
|
||||
|
@ -4561,6 +4561,13 @@ class App(QtCore.QObject):
|
|||
self.report_usage("on_delete")
|
||||
|
||||
while (self.collection.get_active()):
|
||||
obj_active = self.collection.get_active()
|
||||
# if the deleted object is FlatCAMGerber then make sure to delete the possbile mark shapes
|
||||
if isinstance(obj_active, FlatCAMGerber):
|
||||
for el in obj_active.mark_shapes:
|
||||
obj_active.mark_shapes[el].clear(update=True)
|
||||
obj_active.mark_shapes[el].enabled = False
|
||||
obj_active.mark_shapes[el] = None
|
||||
self.delete_first_selected()
|
||||
|
||||
self.inform.emit(_("Object(s) deleted ..."))
|
||||
|
|
|
@ -73,7 +73,8 @@ class FlatCAMObj(QtCore.QObject):
|
|||
# self.shapes = ShapeCollection(parent=self.app.plotcanvas.vispy_canvas.view.scene)
|
||||
self.shapes = self.app.plotcanvas.new_shape_group()
|
||||
|
||||
self.mark_shapes = self.app.plotcanvas.new_shape_collection(layers=2)
|
||||
# self.mark_shapes = self.app.plotcanvas.new_shape_collection(layers=2)
|
||||
self.mark_shapes = {}
|
||||
|
||||
self.item = None # Link with project view item
|
||||
|
||||
|
@ -321,11 +322,11 @@ class FlatCAMObj(QtCore.QObject):
|
|||
key = self.shapes.add(tolerance=self.drawing_tolerance, **kwargs)
|
||||
return key
|
||||
|
||||
def add_mark_shape(self, **kwargs):
|
||||
def add_mark_shape(self, apid, **kwargs):
|
||||
if self.deleted:
|
||||
raise ObjectDeleted()
|
||||
else:
|
||||
key = self.mark_shapes.add(tolerance=self.drawing_tolerance, **kwargs)
|
||||
key = self.mark_shapes[apid].add(tolerance=self.drawing_tolerance, **kwargs)
|
||||
return key
|
||||
|
||||
@property
|
||||
|
@ -555,6 +556,10 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
|||
))
|
||||
self.ui.padding_area_label.hide()
|
||||
|
||||
# add the shapes storage for marking apertures
|
||||
for ap_code in self.apertures:
|
||||
self.mark_shapes[ap_code] = self.app.plotcanvas.new_shape_collection(layers=2)
|
||||
|
||||
# set initial state of the aperture table and associated widgets
|
||||
self.on_aperture_table_visibility_change()
|
||||
|
||||
|
@ -692,7 +697,10 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
|||
# update the 'mark' checkboxes state according with what is stored in the self.marked_rows list
|
||||
if self.marked_rows:
|
||||
for row in range(self.ui.apertures_table.rowCount()):
|
||||
try:
|
||||
self.ui.apertures_table.cellWidget(row, 5).set_value(self.marked_rows[row])
|
||||
except IndexError:
|
||||
pass
|
||||
|
||||
self.ui_connect()
|
||||
|
||||
|
@ -999,6 +1007,8 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
|||
def on_aperture_table_visibility_change(self):
|
||||
if self.ui.aperture_table_visibility_cb.isChecked():
|
||||
self.ui.apertures_table.setVisible(True)
|
||||
for ap in self.mark_shapes:
|
||||
self.mark_shapes[ap].enabled = True
|
||||
|
||||
self.ui.mark_all_cb.setVisible(True)
|
||||
self.ui.mark_all_cb.setChecked(False)
|
||||
|
@ -1012,6 +1022,9 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
|||
self.ui.apertures_table.cellWidget(row, 5).set_value(False)
|
||||
self.clear_plot_apertures()
|
||||
|
||||
for ap in self.mark_shapes:
|
||||
self.mark_shapes[ap].enabled = False
|
||||
|
||||
def convert_units(self, units):
|
||||
"""
|
||||
Converts the units of the object by scaling dimensions in all geometry
|
||||
|
@ -1098,14 +1111,14 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
|||
self.shapes.clear(update=True)
|
||||
|
||||
# experimental plot() when the solid_geometry is stored in the self.apertures
|
||||
def plot_apertures(self, **kwargs):
|
||||
def plot_aperture(self, **kwargs):
|
||||
"""
|
||||
|
||||
:param kwargs: color and face_color
|
||||
:return:
|
||||
"""
|
||||
|
||||
FlatCAMApp.App.log.debug(str(inspect.stack()[1][3]) + " --> FlatCAMGerber.plot_apertures()")
|
||||
FlatCAMApp.App.log.debug(str(inspect.stack()[1][3]) + " --> FlatCAMGerber.plot_aperture()")
|
||||
|
||||
# Does all the required setup and returns False
|
||||
# if the 'ptint' option is set to False.
|
||||
|
@ -1135,7 +1148,6 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
|||
|
||||
def job_thread(app_obj):
|
||||
self.app.progress.emit(30)
|
||||
|
||||
try:
|
||||
if aperture_to_plot_mark in self.apertures:
|
||||
if type(self.apertures[aperture_to_plot_mark]['solid_geometry']) is not list:
|
||||
|
@ -1143,12 +1155,14 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
|||
[self.apertures[aperture_to_plot_mark]['solid_geometry']]
|
||||
for geo in self.apertures[aperture_to_plot_mark]['solid_geometry']:
|
||||
if type(geo) == Polygon or type(geo) == LineString:
|
||||
self.add_mark_shape(shape=geo, color=color, face_color=color, visible=visibility)
|
||||
self.add_mark_shape(apid=aperture_to_plot_mark, shape=geo, color=color,
|
||||
face_color=color, visible=visibility)
|
||||
else:
|
||||
for el in geo:
|
||||
self.add_mark_shape(shape=el, color=color, face_color=color, visible=visibility)
|
||||
self.add_mark_shape(apid=aperture_to_plot_mark, shape=el, color=color,
|
||||
face_color=color, visible=visibility)
|
||||
|
||||
self.mark_shapes.redraw()
|
||||
self.mark_shapes[aperture_to_plot_mark].redraw()
|
||||
self.app.progress.emit(100)
|
||||
|
||||
except (ObjectDeleted, AttributeError):
|
||||
|
@ -1156,8 +1170,17 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
|||
|
||||
self.app.worker_task.emit({'fcn': job_thread, 'params': [self]})
|
||||
|
||||
def clear_plot_apertures(self):
|
||||
self.mark_shapes.clear(update=True)
|
||||
def clear_plot_apertures(self, aperture='all'):
|
||||
"""
|
||||
|
||||
:param aperture: string; aperture for which to clear the mark shapes
|
||||
:return:
|
||||
"""
|
||||
if aperture == 'all':
|
||||
for apid in self.apertures:
|
||||
self.mark_shapes[apid].clear(update=True)
|
||||
else:
|
||||
self.mark_shapes[aperture].clear(update=True)
|
||||
|
||||
def clear_mark_all(self):
|
||||
self.ui.mark_all_cb.set_value(False)
|
||||
|
@ -1165,25 +1188,22 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
|||
|
||||
def on_mark_cb_click_table(self):
|
||||
self.ui_disconnect()
|
||||
# cw = self.sender()
|
||||
# cw_index = self.ui.apertures_table.indexAt(cw.pos())
|
||||
# cw_row = cw_index.row()
|
||||
cw = self.sender()
|
||||
cw_index = self.ui.apertures_table.indexAt(cw.pos())
|
||||
cw_row = cw_index.row()
|
||||
check_row = 0
|
||||
|
||||
self.clear_plot_apertures()
|
||||
self.marked_rows[:] = []
|
||||
aperture = self.ui.apertures_table.item(cw_row, 1).text()
|
||||
|
||||
for row in range(self.ui.apertures_table.rowCount()):
|
||||
if self.ui.apertures_table.cellWidget(row, 5).isChecked():
|
||||
if self.ui.apertures_table.cellWidget(cw_row, 5).isChecked():
|
||||
self.marked_rows.append(True)
|
||||
|
||||
aperture = self.ui.apertures_table.item(row, 1).text()
|
||||
# self.plot_apertures(color='#2d4606bf', marked_aperture=aperture, visible=True)
|
||||
self.plot_apertures(color=self.app.defaults['global_sel_draw_color'], marked_aperture=aperture, visible=True)
|
||||
# self.plot_aperture(color='#2d4606bf', marked_aperture=aperture, visible=True)
|
||||
self.plot_aperture(color=self.app.defaults['global_sel_draw_color'], marked_aperture=aperture, visible=True)
|
||||
self.mark_shapes[aperture].redraw()
|
||||
else:
|
||||
self.marked_rows.append(False)
|
||||
|
||||
self.mark_shapes.redraw()
|
||||
self.clear_plot_apertures(aperture=aperture)
|
||||
|
||||
# make sure that the Mark All is disabled if one of the row mark's are disabled and
|
||||
# if all the row mark's are enabled also enable the Mark All checkbox
|
||||
|
@ -1215,8 +1235,12 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
|||
|
||||
if mark_all:
|
||||
for aperture in self.apertures:
|
||||
# self.plot_apertures(color='#2d4606bf', marked_aperture=aperture, visible=True)
|
||||
self.plot_apertures(color=self.app.defaults['global_sel_draw_color'], marked_aperture=aperture, visible=True)
|
||||
# self.plot_aperture(color='#2d4606bf', marked_aperture=aperture, visible=True)
|
||||
self.plot_aperture(color=self.app.defaults['global_sel_draw_color'],
|
||||
marked_aperture=aperture, visible=True)
|
||||
# HACK: enable/disable the grid for a better look
|
||||
self.app.ui.grid_snap_btn.trigger()
|
||||
self.app.ui.grid_snap_btn.trigger()
|
||||
else:
|
||||
self.clear_plot_apertures()
|
||||
|
||||
|
|
|
@ -12,6 +12,8 @@ CAD program, and create G-Code for Isolation routing.
|
|||
6.05.2019
|
||||
|
||||
- made units change from shortcut key 'Q' not to affect the preferences
|
||||
- made units change from Edit -> Toggle Units not to affect the preferences
|
||||
- remade the way the aperture marks are plotted in Gerber Object
|
||||
|
||||
5.05.2019
|
||||
|
||||
|
@ -481,7 +483,7 @@ CAD program, and create G-Code for Isolation routing.
|
|||
- fixed mouse selection on canvas, mouse drag, mouse click and mouse double click
|
||||
- fixed Gerber Aperture Table dimensions
|
||||
- added a Mark All button in the Gerber aperture table.
|
||||
- because adding shapes to the shapes collection (when doing Mark or Mark All) is time consuming I made the plot_apertures() threaded.
|
||||
- because adding shapes to the shapes collection (when doing Mark or Mark All) is time consuming I made the plot_aperture() threaded.
|
||||
- made the polygon fusing in modified Gerber creation, a list comprehension in an attempt for optimization
|
||||
- when right clicking the files in Project tab, the Save option for Excellon no longer export it but really save the original.
|
||||
- in ToolChange Custom Code replacement, the Text Box in the CNCJob Selected tab will be active only if there is a 'toolchange_custom' in the name of the postprocessor file. This assume that it is, or was created having as template the Toolchange Custom postprocessor file.
|
||||
|
@ -653,7 +655,7 @@ CAD program, and create G-Code for Isolation routing.
|
|||
- finished Gerber aperture table display
|
||||
- made the Gerber aperture table not visible as default and added a checkbox that can toggle the visibility
|
||||
- fixed issue with plotting in CNCJob; with Plot kind set to something else than 'all' when toggling Plot, it was defaulting to kind = 'all'
|
||||
- added (and commented) an experimental FlatCAMObj.FlatCAMGerber.plot_apertures()
|
||||
- added (and commented) an experimental FlatCAMObj.FlatCAMGerber.plot_aperture()
|
||||
|
||||
12.02.2019
|
||||
|
||||
|
|
Loading…
Reference in New Issue