- wip in Gerber editor
This commit is contained in:
parent
b202de338f
commit
40c8ef1cf8
@ -2100,8 +2100,8 @@ class App(QtCore.QObject):
|
|||||||
|
|
||||||
elif isinstance(edited_object, FlatCAMGerber):
|
elif isinstance(edited_object, FlatCAMGerber):
|
||||||
# store the Gerber Editor Toolbar visibility before entering in the Editor
|
# store the Gerber Editor Toolbar visibility before entering in the Editor
|
||||||
self.grbeditor.toolbar_old_state = True if self.ui.grb_edit_toolbar.isVisible() else False
|
self.grb_editor.toolbar_old_state = True if self.ui.grb_edit_toolbar.isVisible() else False
|
||||||
self.grbeditor.edit_fcgerber(edited_object)
|
self.grb_editor.edit_fcgerber(edited_object)
|
||||||
|
|
||||||
# set call source to the Editor we go into
|
# set call source to the Editor we go into
|
||||||
self.call_source = 'grb_editor'
|
self.call_source = 'grb_editor'
|
||||||
|
@ -16,6 +16,7 @@ CAD program, and create G-Code for Isolation routing.
|
|||||||
- changed Measuring Tool to use the mouse click release instead of mouse click press; also fixed a bug when using the ESC key.
|
- changed Measuring Tool to use the mouse click release instead of mouse click press; also fixed a bug when using the ESC key.
|
||||||
- fixed errors when the File -> New Project is initiated while an Editor is still active.
|
- fixed errors when the File -> New Project is initiated while an Editor is still active.
|
||||||
- the File->Exit action handler is now self.final_save()
|
- the File->Exit action handler is now self.final_save()
|
||||||
|
- wip in Gerber editor
|
||||||
|
|
||||||
29.03.2019
|
29.03.2019
|
||||||
|
|
||||||
|
@ -722,7 +722,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
|||||||
self.drill_angle_entry.set_value(12)
|
self.drill_angle_entry.set_value(12)
|
||||||
self.drill_direction_radio.set_value('CW')
|
self.drill_direction_radio.set_value('CW')
|
||||||
self.drill_axis_radio.set_value('X')
|
self.drill_axis_radio.set_value('X')
|
||||||
self.exc_obj = None
|
self.gerber_obj = None
|
||||||
|
|
||||||
# VisPy Visuals
|
# VisPy Visuals
|
||||||
self.shapes = self.app.plotcanvas.new_shape_collection(layers=1)
|
self.shapes = self.app.plotcanvas.new_shape_collection(layers=1)
|
||||||
@ -817,12 +817,12 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
|||||||
self.tool2tooldia.clear()
|
self.tool2tooldia.clear()
|
||||||
|
|
||||||
# build the self.points_edit dict {dimaters: [point_list]}
|
# build the self.points_edit dict {dimaters: [point_list]}
|
||||||
for drill in self.exc_obj.drills:
|
for drill in self.gerber_obj.drills:
|
||||||
if drill['tool'] in self.exc_obj.tools:
|
if drill['tool'] in self.gerber_obj.tools:
|
||||||
if self.units == 'IN':
|
if self.units == 'IN':
|
||||||
tool_dia = float('%.3f' % self.exc_obj.tools[drill['tool']]['C'])
|
tool_dia = float('%.3f' % self.gerber_obj.tools[drill['tool']]['C'])
|
||||||
else:
|
else:
|
||||||
tool_dia = float('%.2f' % self.exc_obj.tools[drill['tool']]['C'])
|
tool_dia = float('%.2f' % self.gerber_obj.tools[drill['tool']]['C'])
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.points_edit[tool_dia].append(drill['point'])
|
self.points_edit[tool_dia].append(drill['point'])
|
||||||
@ -854,7 +854,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
|||||||
self.units = self.app.ui.general_defaults_form.general_app_group.units_radio.get_value().upper()
|
self.units = self.app.ui.general_defaults_form.general_app_group.units_radio.get_value().upper()
|
||||||
|
|
||||||
# make a new name for the new Excellon object (the one with edited content)
|
# make a new name for the new Excellon object (the one with edited content)
|
||||||
self.edited_obj_name = self.exc_obj.options['name']
|
self.edited_obj_name = self.gerber_obj.options['name']
|
||||||
self.name_entry.set_value(self.edited_obj_name)
|
self.name_entry.set_value(self.edited_obj_name)
|
||||||
|
|
||||||
if self.units == "IN":
|
if self.units == "IN":
|
||||||
@ -1115,7 +1115,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
|||||||
for deleted_tool_dia in deleted_tool_dia_list:
|
for deleted_tool_dia in deleted_tool_dia_list:
|
||||||
|
|
||||||
# delete de tool offset
|
# delete de tool offset
|
||||||
self.exc_obj.tool_offset.pop(float(deleted_tool_dia), None)
|
self.gerber_obj.tool_offset.pop(float(deleted_tool_dia), None)
|
||||||
|
|
||||||
# delete the storage used for that tool
|
# delete the storage used for that tool
|
||||||
storage_elem = FlatCAMGeoEditor.make_storage()
|
storage_elem = FlatCAMGeoEditor.make_storage()
|
||||||
@ -1182,8 +1182,8 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
|||||||
self.tool2tooldia[key_in_tool2tooldia] = current_table_dia_edited
|
self.tool2tooldia[key_in_tool2tooldia] = current_table_dia_edited
|
||||||
|
|
||||||
# update the tool offset
|
# update the tool offset
|
||||||
modified_offset = self.exc_obj.tool_offset.pop(dia_changed)
|
modified_offset = self.gerber_obj.tool_offset.pop(dia_changed)
|
||||||
self.exc_obj.tool_offset[current_table_dia_edited] = modified_offset
|
self.gerber_obj.tool_offset[current_table_dia_edited] = modified_offset
|
||||||
|
|
||||||
self.replot()
|
self.replot()
|
||||||
else:
|
else:
|
||||||
@ -1199,7 +1199,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
|||||||
self.on_tool_delete(dia=dia_changed)
|
self.on_tool_delete(dia=dia_changed)
|
||||||
|
|
||||||
# delete the tool offset
|
# delete the tool offset
|
||||||
self.exc_obj.tool_offset.pop(dia_changed, None)
|
self.gerber_obj.tool_offset.pop(dia_changed, None)
|
||||||
|
|
||||||
# we reactivate the signals after the after the tool editing
|
# we reactivate the signals after the after the tool editing
|
||||||
self.tools_table_exc.itemChanged.connect(self.on_tool_edit)
|
self.tools_table_exc.itemChanged.connect(self.on_tool_edit)
|
||||||
@ -1290,8 +1290,8 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
|||||||
self.app.ui.e_editor_cmenu.setEnabled(False)
|
self.app.ui.e_editor_cmenu.setEnabled(False)
|
||||||
|
|
||||||
# Show original geometry
|
# Show original geometry
|
||||||
if self.exc_obj:
|
if self.gerber_obj:
|
||||||
self.exc_obj.visible = True
|
self.gerber_obj.visible = True
|
||||||
|
|
||||||
def connect_canvas_event_handlers(self):
|
def connect_canvas_event_handlers(self):
|
||||||
## Canvas events
|
## Canvas events
|
||||||
@ -1338,9 +1338,9 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
|||||||
# self.storage = FlatCAMExcEditor.make_storage()
|
# self.storage = FlatCAMExcEditor.make_storage()
|
||||||
self.replot()
|
self.replot()
|
||||||
|
|
||||||
def edit_fcexcellon(self, exc_obj):
|
def edit_fcgerber(self, exc_obj):
|
||||||
"""
|
"""
|
||||||
Imports the geometry from the given FlatCAM Excellon object
|
Imports the geometry found in self.apertures from the given FlatCAM Gerber object
|
||||||
into the editor.
|
into the editor.
|
||||||
|
|
||||||
:param fcgeometry: FlatCAMExcellon
|
:param fcgeometry: FlatCAMExcellon
|
||||||
@ -1354,7 +1354,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
|||||||
self.activate()
|
self.activate()
|
||||||
|
|
||||||
# Hide original geometry
|
# Hide original geometry
|
||||||
self.exc_obj = exc_obj
|
self.gerber_obj = exc_obj
|
||||||
exc_obj.visible = False
|
exc_obj.visible = False
|
||||||
|
|
||||||
# Set selection tolerance
|
# Set selection tolerance
|
||||||
@ -1368,7 +1368,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
|||||||
self.build_ui()
|
self.build_ui()
|
||||||
|
|
||||||
# we activate this after the initial build as we don't need to see the tool been populated
|
# we activate this after the initial build as we don't need to see the tool been populated
|
||||||
self.tools_table_exc.itemChanged.connect(self.on_tool_edit)
|
self.apertures_table.itemChanged.connect(self.on_tool_edit)
|
||||||
|
|
||||||
# build the geometry for each tool-diameter, each drill will be represented by a '+' symbol
|
# build the geometry for each tool-diameter, each drill will be represented by a '+' symbol
|
||||||
# and then add it to the storage elements (each storage elements is a member of a list
|
# and then add it to the storage elements (each storage elements is a member of a list
|
||||||
@ -1391,7 +1391,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
|||||||
if not self.tool2tooldia:
|
if not self.tool2tooldia:
|
||||||
self.on_tool_add(tooldia=1.00)
|
self.on_tool_add(tooldia=1.00)
|
||||||
|
|
||||||
def update_fcexcellon(self, exc_obj):
|
def update_fcgerber(self, exc_obj):
|
||||||
"""
|
"""
|
||||||
Create a new Excellon object that contain the edited content of the source Excellon object
|
Create a new Excellon object that contain the edited content of the source Excellon object
|
||||||
|
|
||||||
@ -1484,10 +1484,10 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
|||||||
self.app.worker_task.emit({'fcn': self.new_edited_excellon,
|
self.app.worker_task.emit({'fcn': self.new_edited_excellon,
|
||||||
'params': [self.edited_obj_name]})
|
'params': [self.edited_obj_name]})
|
||||||
|
|
||||||
if self.exc_obj.slots:
|
if self.gerber_obj.slots:
|
||||||
self.new_slots = self.exc_obj.slots
|
self.new_slots = self.gerber_obj.slots
|
||||||
|
|
||||||
self.new_tool_offset = self.exc_obj.tool_offset
|
self.new_tool_offset = self.gerber_obj.tool_offset
|
||||||
|
|
||||||
# reset the tool table
|
# reset the tool table
|
||||||
self.tools_table_exc.clear()
|
self.tools_table_exc.clear()
|
||||||
@ -1495,7 +1495,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
|||||||
self.last_tool_selected = None
|
self.last_tool_selected = None
|
||||||
|
|
||||||
# delete the edited Excellon object which will be replaced by a new one having the edited content of the first
|
# delete the edited Excellon object which will be replaced by a new one having the edited content of the first
|
||||||
self.app.collection.set_active(self.exc_obj.options['name'])
|
self.app.collection.set_active(self.gerber_obj.options['name'])
|
||||||
self.app.collection.delete_active()
|
self.app.collection.delete_active()
|
||||||
|
|
||||||
# restore GUI to the Selected TAB
|
# restore GUI to the Selected TAB
|
||||||
@ -1530,7 +1530,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
self.app.log.debug("Update the Excellon object with edited content. Source is %s" %
|
self.app.log.debug("Update the Excellon object with edited content. Source is %s" %
|
||||||
self.exc_obj.options['name'])
|
self.gerber_obj.options['name'])
|
||||||
|
|
||||||
# How the object should be initialized
|
# How the object should be initialized
|
||||||
def obj_init(excellon_obj, app_obj):
|
def obj_init(excellon_obj, app_obj):
|
||||||
|
Loading…
Reference in New Issue
Block a user