excellon advanced

This commit is contained in:
David Robertson
2020-05-11 00:06:08 +01:00
parent d464fa5878
commit 3340590f60
3 changed files with 86 additions and 158 deletions

View File

@@ -49,16 +49,6 @@ class PreferencesUIManager:
# def new_object(self, kind, name, initialize, active=True, fit=True, plot=True) # def new_object(self, kind, name, initialize, active=True, fit=True, plot=True)
self.defaults_form_fields = { self.defaults_form_fields = {
# Excellon Advanced Options
"excellon_offset": self.ui.excellon_defaults_form.excellon_adv_opt_group.offset_entry,
"excellon_toolchangexy": self.ui.excellon_defaults_form.excellon_adv_opt_group.toolchangexy_entry,
"excellon_startz": self.ui.excellon_defaults_form.excellon_adv_opt_group.estartz_entry,
"excellon_feedrate_rapid": self.ui.excellon_defaults_form.excellon_adv_opt_group.feedrate_rapid_entry,
"excellon_z_pdepth": self.ui.excellon_defaults_form.excellon_adv_opt_group.pdepth_entry,
"excellon_feedrate_probe": self.ui.excellon_defaults_form.excellon_adv_opt_group.feedrate_probe_entry,
"excellon_spindledir": self.ui.excellon_defaults_form.excellon_adv_opt_group.spindledir_radio,
"excellon_f_plunge": self.ui.excellon_defaults_form.excellon_adv_opt_group.fplunge_cb,
"excellon_f_retract": self.ui.excellon_defaults_form.excellon_adv_opt_group.fretract_cb,
# Excellon Editor # Excellon Editor
"excellon_editor_sel_limit": self.ui.excellon_defaults_form.excellon_editor_group.sel_limit_entry, "excellon_editor_sel_limit": self.ui.excellon_defaults_form.excellon_editor_group.sel_limit_entry,

View File

@@ -1,155 +1,97 @@
from PyQt5 import QtWidgets from flatcamGUI.preferences.OptionUI import *
from PyQt5.QtCore import QSettings from flatcamGUI.preferences.OptionsGroupUI import OptionsGroupUI2
from flatcamGUI.GUIElements import FCDoubleSpinner, FCEntry, FloatEntry, RadioSet, FCCheckBox
from flatcamGUI.preferences.OptionsGroupUI import OptionsGroupUI
import gettext import gettext
import FlatCAMTranslation as fcTranslate import FlatCAMTranslation as fcTranslate
import builtins import builtins
fcTranslate.apply_language('strings') fcTranslate.apply_language('strings')
if '_' not in builtins.__dict__: if '_' not in builtins.__dict__:
_ = gettext.gettext _ = gettext.gettext
settings = QSettings("Open Source", "FlatCAM")
if settings.contains("machinist"):
machinist_setting = settings.value('machinist', type=int)
else:
machinist_setting = 0
class ExcellonAdvOptPrefGroupUI(OptionsGroupUI2):
class ExcellonAdvOptPrefGroupUI(OptionsGroupUI): def __init__(self, decimals=4, **kwargs):
def __init__(self, decimals=4, parent=None):
# OptionsGroupUI.__init__(self, "Excellon Advanced Options", parent=parent)
super(ExcellonAdvOptPrefGroupUI, self).__init__(self, parent=parent)
self.setTitle(str(_("Excellon Adv. Options")))
self.decimals = decimals self.decimals = decimals
super().__init__(**kwargs)
self.setTitle(str(_("Excellon Adv. Options")))
# ####################### def build_options(self) -> [OptionUI]:
# ## ADVANCED OPTIONS ### return [
# ####################### HeadingOptionUI(
label_text="Advanced Options",
self.exc_label = QtWidgets.QLabel('<b>%s:</b>' % _('Advanced Options')) label_tooltip="A list of Excellon advanced parameters.\n"
self.exc_label.setToolTip( "Those parameters are available only for\n"
_("A list of Excellon advanced parameters.\n" "Advanced App. Level."
"Those parameters are available only for\n" ),
"Advanced App. Level.") DoubleSpinnerOptionUI(
) option="excellon_offset",
self.layout.addWidget(self.exc_label) label_text="Offset Z",
label_tooltip="Some drill bits (the larger ones) need to drill deeper\n"
grid1 = QtWidgets.QGridLayout() "to create the desired exit hole diameter due of the tip shape.\n"
self.layout.addLayout(grid1) "The value here can compensate the Cut Z parameter.",
min_value=-999.9999, max_value=999.9999, step=0.1, decimals=self.decimals
# Offset Z ),
offsetlabel = QtWidgets.QLabel('%s:' % _('Offset Z')) LineEntryOptionUI(
offsetlabel.setToolTip( option="excellon_toolchangexy",
_("Some drill bits (the larger ones) need to drill deeper\n" label_text="Toolchange X,Y",
"to create the desired exit hole diameter due of the tip shape.\n" label_tooltip="Toolchange X,Y position."
"The value here can compensate the Cut Z parameter.")) ),
self.offset_entry = FCDoubleSpinner() FloatEntryOptionUI(
self.offset_entry.set_precision(self.decimals) option="excellon_startz",
self.offset_entry.set_range(-999.9999, 999.9999) label_text="Start Z",
label_tooltip="Height of the tool just after start.\n"
grid1.addWidget(offsetlabel, 0, 0) "Delete the value if you don't need this feature."
grid1.addWidget(self.offset_entry, 0, 1) ),
DoubleSpinnerOptionUI(
# ToolChange X,Y option="excellon_feedrate_rapid",
toolchange_xy_label = QtWidgets.QLabel('%s:' % _('Toolchange X,Y')) label_text="Feedrate Rapids",
toolchange_xy_label.setToolTip( label_tooltip="Tool speed while drilling\n"
_("Toolchange X,Y position.") "(in units per minute).\n"
) "This is for the rapid move G00.\n"
self.toolchangexy_entry = FCEntry() "It is useful only for Marlin,\n"
"ignore for any other cases.",
grid1.addWidget(toolchange_xy_label, 1, 0) min_value=0.0001, max_value=99999.9999, step=50, decimals=self.decimals
grid1.addWidget(self.toolchangexy_entry, 1, 1) ),
DoubleSpinnerOptionUI(
# Start Z option="excellon_z_pdepth",
startzlabel = QtWidgets.QLabel('%s:' % _('Start Z')) label_text="Probe Z depth",
startzlabel.setToolTip( label_tooltip="The maximum depth that the probe is allowed\n"
_("Height of the tool just after start.\n" "to probe. Negative value, in current units.",
"Delete the value if you don't need this feature.") min_value=-99999.9999, max_value=0.0, step=0.1, decimals=self.decimals
) ),
self.estartz_entry = FloatEntry() DoubleSpinnerOptionUI(
option="excellon_feedrate_probe",
grid1.addWidget(startzlabel, 2, 0) label_text="Feedrate Probe",
grid1.addWidget(self.estartz_entry, 2, 1) label_tooltip="The feedrate used while the probe is probing.",
min_value=0.0001, max_value=99999.9999, step=0.1, decimals=self.decimals
# Feedrate Rapids ),
fr_rapid_label = QtWidgets.QLabel('%s:' % _('Feedrate Rapids')) RadioSetOptionUI(
fr_rapid_label.setToolTip( option="excellon_spindledir",
_("Tool speed while drilling\n" label_text="Spindle direction",
"(in units per minute).\n" label_tooltip="This sets the direction that the spindle is rotating.\n"
"This is for the rapid move G00.\n" "It can be either:\n"
"It is useful only for Marlin,\n" "- CW = clockwise or\n"
"ignore for any other cases.") "- CCW = counter clockwise",
) choices=[{'label': _('CW'), 'value': 'CW'},
self.feedrate_rapid_entry = FCDoubleSpinner() {'label': _('CCW'), 'value': 'CCW'}]
self.feedrate_rapid_entry.set_precision(self.decimals) ),
self.feedrate_rapid_entry.set_range(0, 99999.9999) CheckboxOptionUI(
option="excellon_f_plunge",
grid1.addWidget(fr_rapid_label, 3, 0) label_text="Fast Plunge",
grid1.addWidget(self.feedrate_rapid_entry, 3, 1) label_tooltip="By checking this, the vertical move from\n"
"Z_Toolchange to Z_move is done with G0,\n"
# Probe depth "meaning the fastest speed available.\n"
self.pdepth_label = QtWidgets.QLabel('%s:' % _("Probe Z depth")) "WARNING: the move is done at Toolchange X,Y coords."
self.pdepth_label.setToolTip( ),
_("The maximum depth that the probe is allowed\n" CheckboxOptionUI(
"to probe. Negative value, in current units.") option="excellon_f_retract",
) label_text="Fast Retract",
self.pdepth_entry = FCDoubleSpinner() label_tooltip="Exit hole strategy.\n"
self.pdepth_entry.set_precision(self.decimals) " - When uncheked, while exiting the drilled hole the drill bit\n"
self.pdepth_entry.set_range(-99999.9999, 0.0000) "will travel slow, with set feedrate (G1), up to zero depth and then\n"
"travel as fast as possible (G0) to the Z Move (travel height).\n"
grid1.addWidget(self.pdepth_label, 4, 0) " - When checked the travel from Z cut (cut depth) to Z_move\n"
grid1.addWidget(self.pdepth_entry, 4, 1) "(travel height) is done as fast as possible (G0) in one move."
)
# Probe feedrate ]
self.feedrate_probe_label = QtWidgets.QLabel('%s:' % _("Feedrate Probe"))
self.feedrate_probe_label.setToolTip(
_("The feedrate used while the probe is probing.")
)
self.feedrate_probe_entry = FCDoubleSpinner()
self.feedrate_probe_entry.set_precision(self.decimals)
self.feedrate_probe_entry.set_range(0, 99999.9999)
grid1.addWidget(self.feedrate_probe_label, 5, 0)
grid1.addWidget(self.feedrate_probe_entry, 5, 1)
# Spindle direction
spindle_dir_label = QtWidgets.QLabel('%s:' % _('Spindle direction'))
spindle_dir_label.setToolTip(
_("This sets the direction that the spindle is rotating.\n"
"It can be either:\n"
"- CW = clockwise or\n"
"- CCW = counter clockwise")
)
self.spindledir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
{'label': _('CCW'), 'value': 'CCW'}])
grid1.addWidget(spindle_dir_label, 6, 0)
grid1.addWidget(self.spindledir_radio, 6, 1)
self.fplunge_cb = FCCheckBox('%s' % _('Fast Plunge'))
self.fplunge_cb.setToolTip(
_("By checking this, the vertical move from\n"
"Z_Toolchange to Z_move is done with G0,\n"
"meaning the fastest speed available.\n"
"WARNING: the move is done at Toolchange X,Y coords.")
)
grid1.addWidget(self.fplunge_cb, 7, 0, 1, 2)
self.fretract_cb = FCCheckBox('%s' % _('Fast Retract'))
self.fretract_cb.setToolTip(
_("Exit hole strategy.\n"
" - When uncheked, while exiting the drilled hole the drill bit\n"
"will travel slow, with set feedrate (G1), up to zero depth and then\n"
"travel as fast as possible (G0) to the Z Move (travel height).\n"
" - When checked the travel from Z cut (cut depth) to Z_move\n"
"(travel height) is done as fast as possible (G0) in one move.")
)
grid1.addWidget(self.fretract_cb, 8, 0, 1, 2)
self.layout.addStretch()

View File

@@ -18,13 +18,9 @@ class ExcellonPreferencesUI(PreferencesSectionUI):
def __init__(self, decimals, **kwargs): def __init__(self, decimals, **kwargs):
self.decimals = decimals self.decimals = decimals
# FIXME: remove the need for external access to excellon_opt_group # FIXME: remove the need for external access to excellon_opt_group
self.excellon_opt_group = ExcellonOptPrefGroupUI(decimals=self.decimals) self.excellon_opt_group = ExcellonOptPrefGroupUI(decimals=self.decimals)
self.excellon_adv_opt_group = ExcellonAdvOptPrefGroupUI(decimals=self.decimals)
self.excellon_editor_group = ExcellonEditorPrefGroupUI(decimals=self.decimals) self.excellon_editor_group = ExcellonEditorPrefGroupUI(decimals=self.decimals)
super().__init__(**kwargs) super().__init__(**kwargs)
self.init_sync_export() self.init_sync_export()
@@ -33,7 +29,7 @@ class ExcellonPreferencesUI(PreferencesSectionUI):
ExcellonGenPrefGroupUI(decimals=self.decimals), ExcellonGenPrefGroupUI(decimals=self.decimals),
self.excellon_opt_group, self.excellon_opt_group,
ExcellonExpPrefGroupUI(decimals=self.decimals), ExcellonExpPrefGroupUI(decimals=self.decimals),
self.excellon_adv_opt_group, ExcellonAdvOptPrefGroupUI(decimals=self.decimals),
self.excellon_editor_group self.excellon_editor_group
] ]