from PyQt5 import QtWidgets from PyQt5.QtCore import QSettings from appGUI.GUIElements import FCDoubleSpinner, RadioSet, FCCheckBox, NumericalEvalTupleEntry, NumericalEvalEntry from appGUI.preferences.OptionsGroupUI import OptionsGroupUI import gettext import appTranslation as fcTranslate import builtins fcTranslate.apply_language('strings') if '_' not in builtins.__dict__: _ = gettext.gettext settings = QSettings("Open Source", "FlatCAM") if settings.contains("machinist"): machinist_setting = settings.value('machinist', type=int) else: machinist_setting = 0 class ExcellonAdvOptPrefGroupUI(OptionsGroupUI): 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 # ####################### # ## ADVANCED OPTIONS ### # ####################### self.exc_label = QtWidgets.QLabel('%s:' % _('Advanced Options')) self.exc_label.setToolTip( _("A list of Excellon advanced parameters.\n" "Those parameters are available only for\n" "Advanced App. Level.") ) self.layout.addWidget(self.exc_label) grid1 = QtWidgets.QGridLayout() self.layout.addLayout(grid1) # 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" "The value here can compensate the Cut Z parameter.")) self.offset_entry = FCDoubleSpinner() self.offset_entry.set_precision(self.decimals) self.offset_entry.set_range(-999.9999, 999.9999) grid1.addWidget(offsetlabel, 0, 0) grid1.addWidget(self.offset_entry, 0, 1) # ToolChange X,Y toolchange_xy_label = QtWidgets.QLabel('%s:' % _('Toolchange X,Y')) toolchange_xy_label.setToolTip( _("Toolchange X,Y position.") ) self.toolchangexy_entry = NumericalEvalTupleEntry(border_color='#0069A9') grid1.addWidget(toolchange_xy_label, 1, 0) grid1.addWidget(self.toolchangexy_entry, 1, 1) # 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 = NumericalEvalEntry(border_color='#0069A9') 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" "This is for the rapid move G00.\n" "It is useful only for Marlin,\n" "ignore for any other cases.") ) self.feedrate_rapid_entry = FCDoubleSpinner() self.feedrate_rapid_entry.set_precision(self.decimals) self.feedrate_rapid_entry.set_range(0, 99999.9999) grid1.addWidget(fr_rapid_label, 3, 0) grid1.addWidget(self.feedrate_rapid_entry, 3, 1) # Probe depth self.pdepth_label = QtWidgets.QLabel('%s:' % _("Probe Z depth")) self.pdepth_label.setToolTip( _("The maximum depth that the probe is allowed\n" "to probe. Negative value, in current units.") ) self.pdepth_entry = FCDoubleSpinner() self.pdepth_entry.set_precision(self.decimals) self.pdepth_entry.set_range(-99999.9999, 0.0000) grid1.addWidget(self.pdepth_label, 4, 0) 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" "- 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) separator_line = QtWidgets.QFrame() separator_line.setFrameShape(QtWidgets.QFrame.HLine) separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) grid1.addWidget(separator_line, 9, 0, 1, 2) # DRILL SLOTS LABEL self.dslots_label = QtWidgets.QLabel('%s:' % _('Drilling Slots')) grid1.addWidget(self.dslots_label, 10, 0, 1, 2) # Drill slots self.drill_slots_cb = FCCheckBox('%s' % _('Drill slots')) self.drill_slots_cb.setToolTip( _("If the selected tool has slots then they will be drilled.") ) grid1.addWidget(self.drill_slots_cb, 11, 0, 1, 2) # Drill Overlap self.drill_overlap_label = QtWidgets.QLabel('%s:' % _('Overlap')) self.drill_overlap_label.setToolTip( _("How much (percentage) of the tool diameter to overlap previous drill hole.") ) self.drill_overlap_entry = FCDoubleSpinner() self.drill_overlap_entry.set_precision(self.decimals) self.drill_overlap_entry.set_range(0.0, 9999.9999) self.drill_overlap_entry.setSingleStep(0.1) grid1.addWidget(self.drill_overlap_label, 12, 0) grid1.addWidget(self.drill_overlap_entry, 12, 1) # Last drill in slot self.last_drill_cb = FCCheckBox('%s' % _('Last drill')) self.last_drill_cb.setToolTip( _("If the slot length is not completely covered by drill holes,\n" "add a drill hole on the slot end point.") ) grid1.addWidget(self.last_drill_cb, 14, 0, 1, 2) self.layout.addStretch()