- fixed aperture marking in Extract Plugin

- in Extract Plugin if no Gerber object is selected then the first Gerber object in the project list is selected (if any)
This commit is contained in:
Marius Stanciu
2022-03-31 23:28:08 +03:00
committed by Marius
parent ada48269a9
commit 8e18669249
3 changed files with 31 additions and 7 deletions

View File

@@ -16,6 +16,8 @@ CHANGELOG for FlatCAM Evo beta
- fixed some bugs in the Punch Gerber plugin - fixed some bugs in the Punch Gerber plugin
- fixed some bugs where the 'pool' parameter was not passed when creating shapes collections (in 3D graphic mode); I wonder how it worked until now - fixed some bugs where the 'pool' parameter was not passed when creating shapes collections (in 3D graphic mode); I wonder how it worked until now
- added a new feature in the Isolation Plugin: now for all the isolation Geometry objects this plugin can do a supplementary simplification of the geometry using the tolerance parameter defined in the General Parameters. This should lead to a reduced number of tool lifts when doing corners - added a new feature in the Isolation Plugin: now for all the isolation Geometry objects this plugin can do a supplementary simplification of the geometry using the tolerance parameter defined in the General Parameters. This should lead to a reduced number of tool lifts when doing corners
- fixed aperture marking in Extract Plugin
- in Extract Plugin if no Gerber object is selected then the first Gerber object in the project list is selected (if any)
30.03.2022 30.03.2022

View File

@@ -1038,19 +1038,20 @@ class GerberObject(FlatCAMObj, Gerber):
def job_thread(app_obj): def job_thread(app_obj):
with self.app.proc_container.new('%s ...' % _("Plotting")): with self.app.proc_container.new('%s ...' % _("Plotting")):
try: try:
if aperture_to_plot_mark in self.tools: if aperture_to_plot_mark in app_obj.tools:
for elem in app_obj.tools[aperture_to_plot_mark]['geometry']: for elem in app_obj.tools[aperture_to_plot_mark]['geometry']:
if 'solid' in elem: if 'solid' in elem:
if only_flashes and not isinstance(elem['follow'], Point): if only_flashes and not isinstance(elem['follow'], Point):
continue continue
geo = elem['solid'] geo = elem['solid']
s_geo = geo.geoms if isinstance(geo, (MultiLineString, MultiPolygon)) else geo
try: try:
for el in geo: for el in s_geo:
shape_key = app_obj.add_mark_shape(shape=el, color=color, face_color=color, shape_key = app_obj.add_mark_shape(shape=el, color=color, face_color=color,
visible=visibility) visible=visibility)
app_obj.mark_shapes_storage[aperture_to_plot_mark].append(shape_key) app_obj.mark_shapes_storage[aperture_to_plot_mark].append(shape_key)
except TypeError: except TypeError:
shape_key = app_obj.add_mark_shape(shape=geo, color=color, face_color=color, shape_key = app_obj.add_mark_shape(shape=s_geo, color=color, face_color=color,
visible=visibility) visible=visibility)
app_obj.mark_shapes_storage[aperture_to_plot_mark].append(shape_key) app_obj.mark_shapes_storage[aperture_to_plot_mark].append(shape_key)
app_obj.mark_shapes.redraw() app_obj.mark_shapes.redraw()

View File

@@ -124,7 +124,8 @@ class ToolExtract(AppTool):
self.set_tool_ui() self.set_tool_ui()
self.build_tool_ui() self.build_tool_ui()
self.app.ui.notebook.setTabText(2, _("Extract")) # trigger this once at plugin launch
self.on_object_combo_changed()
def connect_signals_at_init(self): def connect_signals_at_init(self):
# ## Signals # ## Signals
@@ -207,9 +208,18 @@ class ToolExtract(AppTool):
# SELECT THE CURRENT OBJECT # SELECT THE CURRENT OBJECT
obj = self.app.collection.get_active() obj = self.app.collection.get_active()
if obj and obj.kind == 'gerber': if obj:
obj_name = obj.obj_options['name'] if obj.kind == 'gerber':
self.ui.gerber_object_combo.set_value(obj_name) obj_name = obj.obj_options['name']
self.ui.gerber_object_combo.set_value(obj_name)
else:
# take first available Gerber file, if any
available_gerber_list = [o for o in self.app.collection.get_list() if o.kind == 'gerber']
if available_gerber_list:
obj_name = available_gerber_list[0].obj_options['name']
self.ui.gerber_object_combo.set_value(obj_name)
self.app.ui.notebook.setTabText(2, _("Extract"))
def build_tool_ui(self): def build_tool_ui(self):
self.ui_disconnect() self.ui_disconnect()
@@ -330,6 +340,17 @@ class ToolExtract(AppTool):
# self.ui.apertures_table.setMinimumHeight(self.ui.apertures_table.getHeight()) # self.ui.apertures_table.setMinimumHeight(self.ui.apertures_table.getHeight())
# self.ui.apertures_table.setMaximumHeight(self.ui.apertures_table.getHeight()) # self.ui.apertures_table.setMaximumHeight(self.ui.apertures_table.getHeight())
# make sure you clear the Gerber aperture markings when the table is rebuilt
# get the Gerber file who is the source of the punched Gerber
selection_index = self.ui.gerber_object_combo.currentIndex()
model_index = self.app.collection.index(selection_index, 0, self.ui.gerber_object_combo.rootModelIndex())
try:
grb_obj = model_index.internalPointer().obj
except Exception:
self.ui_connect()
return
grb_obj.clear_plot_apertures()
self.ui_connect() self.ui_connect()
def ui_connect(self): def ui_connect(self):