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(
_("A list of Excellon advanced parameters.\n"
"Those parameters are available only for\n" "Those parameters are available only for\n"
"Advanced App. Level.") "Advanced App. Level."
) ),
self.layout.addWidget(self.exc_label) DoubleSpinnerOptionUI(
option="excellon_offset",
grid1 = QtWidgets.QGridLayout() label_text="Offset Z",
self.layout.addLayout(grid1) label_tooltip="Some drill bits (the larger ones) need to drill deeper\n"
# Offset Z
offsetlabel = QtWidgets.QLabel('%s:' % _('Offset Z'))
offsetlabel.setToolTip(
_("Some drill bits (the larger ones) need to drill deeper\n"
"to create the desired exit hole diameter due of the tip shape.\n" "to create the desired exit hole diameter due of the tip shape.\n"
"The value here can compensate the Cut Z parameter.")) "The value here can compensate the Cut Z parameter.",
self.offset_entry = FCDoubleSpinner() min_value=-999.9999, max_value=999.9999, step=0.1, decimals=self.decimals
self.offset_entry.set_precision(self.decimals) ),
self.offset_entry.set_range(-999.9999, 999.9999) LineEntryOptionUI(
option="excellon_toolchangexy",
grid1.addWidget(offsetlabel, 0, 0) label_text="Toolchange X,Y",
grid1.addWidget(self.offset_entry, 0, 1) label_tooltip="Toolchange X,Y position."
),
# ToolChange X,Y FloatEntryOptionUI(
toolchange_xy_label = QtWidgets.QLabel('%s:' % _('Toolchange X,Y')) option="excellon_startz",
toolchange_xy_label.setToolTip( label_text="Start Z",
_("Toolchange X,Y position.") label_tooltip="Height of the tool just after start.\n"
) "Delete the value if you don't need this feature."
self.toolchangexy_entry = FCEntry() ),
DoubleSpinnerOptionUI(
grid1.addWidget(toolchange_xy_label, 1, 0) option="excellon_feedrate_rapid",
grid1.addWidget(self.toolchangexy_entry, 1, 1) label_text="Feedrate Rapids",
label_tooltip="Tool speed while drilling\n"
# Start Z
startzlabel = QtWidgets.QLabel('%s:' % _('Start Z'))
startzlabel.setToolTip(
_("Height of the tool just after start.\n"
"Delete the value if you don't need this feature.")
)
self.estartz_entry = FloatEntry()
grid1.addWidget(startzlabel, 2, 0)
grid1.addWidget(self.estartz_entry, 2, 1)
# Feedrate Rapids
fr_rapid_label = QtWidgets.QLabel('%s:' % _('Feedrate Rapids'))
fr_rapid_label.setToolTip(
_("Tool speed while drilling\n"
"(in units per minute).\n" "(in units per minute).\n"
"This is for the rapid move G00.\n" "This is for the rapid move G00.\n"
"It is useful only for Marlin,\n" "It is useful only for Marlin,\n"
"ignore for any other cases.") "ignore for any other cases.",
) min_value=0.0001, max_value=99999.9999, step=50, decimals=self.decimals
self.feedrate_rapid_entry = FCDoubleSpinner() ),
self.feedrate_rapid_entry.set_precision(self.decimals) DoubleSpinnerOptionUI(
self.feedrate_rapid_entry.set_range(0, 99999.9999) option="excellon_z_pdepth",
label_text="Probe Z depth",
grid1.addWidget(fr_rapid_label, 3, 0) label_tooltip="The maximum depth that the probe is allowed\n"
grid1.addWidget(self.feedrate_rapid_entry, 3, 1) "to probe. Negative value, in current units.",
min_value=-99999.9999, max_value=0.0, step=0.1, decimals=self.decimals
# Probe depth ),
self.pdepth_label = QtWidgets.QLabel('%s:' % _("Probe Z depth")) DoubleSpinnerOptionUI(
self.pdepth_label.setToolTip( option="excellon_feedrate_probe",
_("The maximum depth that the probe is allowed\n" label_text="Feedrate Probe",
"to probe. Negative value, in current units.") label_tooltip="The feedrate used while the probe is probing.",
) min_value=0.0001, max_value=99999.9999, step=0.1, decimals=self.decimals
self.pdepth_entry = FCDoubleSpinner() ),
self.pdepth_entry.set_precision(self.decimals) RadioSetOptionUI(
self.pdepth_entry.set_range(-99999.9999, 0.0000) option="excellon_spindledir",
label_text="Spindle direction",
grid1.addWidget(self.pdepth_label, 4, 0) label_tooltip="This sets the direction that the spindle is rotating.\n"
grid1.addWidget(self.pdepth_entry, 4, 1)
# 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" "It can be either:\n"
"- CW = clockwise or\n" "- CW = clockwise or\n"
"- CCW = counter clockwise") "- CCW = counter clockwise",
) choices=[{'label': _('CW'), 'value': 'CW'},
{'label': _('CCW'), 'value': 'CCW'}]
self.spindledir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'}, ),
{'label': _('CCW'), 'value': 'CCW'}]) CheckboxOptionUI(
grid1.addWidget(spindle_dir_label, 6, 0) option="excellon_f_plunge",
grid1.addWidget(self.spindledir_radio, 6, 1) label_text="Fast Plunge",
label_tooltip="By checking this, the vertical move from\n"
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" "Z_Toolchange to Z_move is done with G0,\n"
"meaning the fastest speed available.\n" "meaning the fastest speed available.\n"
"WARNING: the move is done at Toolchange X,Y coords.") "WARNING: the move is done at Toolchange X,Y coords."
) ),
grid1.addWidget(self.fplunge_cb, 7, 0, 1, 2) CheckboxOptionUI(
option="excellon_f_retract",
self.fretract_cb = FCCheckBox('%s' % _('Fast Retract')) label_text="Fast Retract",
self.fretract_cb.setToolTip( label_tooltip="Exit hole strategy.\n"
_("Exit hole strategy.\n"
" - When uncheked, while exiting the drilled hole the drill bit\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" "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" "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" " - 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.") "(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
] ]