excellon opt

This commit is contained in:
David Robertson
2020-05-10 22:05:47 +01:00
parent 8a62820d08
commit 5d3f4ee038
3 changed files with 178 additions and 313 deletions

View File

@@ -68,29 +68,6 @@ class PreferencesUIManager:
"excellon_plot_fill": self.ui.excellon_defaults_form.excellon_gen_group.fill_color_entry, "excellon_plot_fill": self.ui.excellon_defaults_form.excellon_gen_group.fill_color_entry,
"excellon_plot_line": self.ui.excellon_defaults_form.excellon_gen_group.line_color_entry, "excellon_plot_line": self.ui.excellon_defaults_form.excellon_gen_group.line_color_entry,
# Excellon Options
"excellon_operation": self.ui.excellon_defaults_form.excellon_opt_group.operation_radio,
"excellon_milling_type": self.ui.excellon_defaults_form.excellon_opt_group.milling_type_radio,
"excellon_milling_dia": self.ui.excellon_defaults_form.excellon_opt_group.mill_dia_entry,
"excellon_cutz": self.ui.excellon_defaults_form.excellon_opt_group.cutz_entry,
"excellon_multidepth": self.ui.excellon_defaults_form.excellon_opt_group.mpass_cb,
"excellon_depthperpass": self.ui.excellon_defaults_form.excellon_opt_group.maxdepth_entry,
"excellon_travelz": self.ui.excellon_defaults_form.excellon_opt_group.travelz_entry,
"excellon_endz": self.ui.excellon_defaults_form.excellon_opt_group.endz_entry,
"excellon_endxy": self.ui.excellon_defaults_form.excellon_opt_group.endxy_entry,
"excellon_feedrate_z": self.ui.excellon_defaults_form.excellon_opt_group.feedrate_z_entry,
"excellon_spindlespeed": self.ui.excellon_defaults_form.excellon_opt_group.spindlespeed_entry,
"excellon_dwell": self.ui.excellon_defaults_form.excellon_opt_group.dwell_cb,
"excellon_dwelltime": self.ui.excellon_defaults_form.excellon_opt_group.dwelltime_entry,
"excellon_toolchange": self.ui.excellon_defaults_form.excellon_opt_group.toolchange_cb,
"excellon_toolchangez": self.ui.excellon_defaults_form.excellon_opt_group.toolchangez_entry,
"excellon_ppname_e": self.ui.excellon_defaults_form.excellon_opt_group.pp_excellon_name_cb,
"excellon_tooldia": self.ui.excellon_defaults_form.excellon_opt_group.tooldia_entry,
"excellon_slot_tooldia": self.ui.excellon_defaults_form.excellon_opt_group.slot_tooldia_entry,
"excellon_gcode_type": self.ui.excellon_defaults_form.excellon_opt_group.excellon_gcode_type_radio,
# Excellon Advanced Options # Excellon Advanced Options
"excellon_offset": self.ui.excellon_defaults_form.excellon_adv_opt_group.offset_entry, "excellon_offset": self.ui.excellon_defaults_form.excellon_adv_opt_group.offset_entry,

View File

@@ -1,10 +1,7 @@
from PyQt5 import QtWidgets from flatcamGUI.GUIElements import OptionalInputSection
from PyQt5.QtCore import Qt, QSettings
from flatcamGUI.GUIElements import RadioSet, FCDoubleSpinner, FCCheckBox, FCEntry, FCSpinner, OptionalInputSection, \
FCComboBox
from flatcamGUI.preferences import machinist_setting from flatcamGUI.preferences import machinist_setting
from flatcamGUI.preferences.OptionsGroupUI import OptionsGroupUI from flatcamGUI.preferences.OptionUI import *
from flatcamGUI.preferences.OptionsGroupUI import OptionsGroupUI2
import gettext import gettext
import FlatCAMTranslation as fcTranslate import FlatCAMTranslation as fcTranslate
import builtins import builtins
@@ -20,298 +17,182 @@ else:
machinist_setting = 0 machinist_setting = 0
class ExcellonOptPrefGroupUI(OptionsGroupUI): class ExcellonOptPrefGroupUI(OptionsGroupUI2):
def __init__(self, decimals=4, parent=None): def __init__(self, decimals=4, **kwargs):
# OptionsGroupUI.__init__(self, "Excellon Options", parent=parent)
super(ExcellonOptPrefGroupUI, self).__init__(self, parent=parent)
self.setTitle(str(_("Excellon Options")))
self.decimals = decimals self.decimals = decimals
super().__init__(**kwargs)
self.setTitle(str(_("Excellon Options")))
# ## Create CNC Job self.pp_excellon_name_cb = self.option_dict()["excellon_ppname_e"].get_field()
self.cncjob_label = QtWidgets.QLabel('<b>%s</b>' % _('Create CNC Job'))
self.cncjob_label.setToolTip(
_("Parameters used to create a CNC Job object\n"
"for this drill object.")
)
self.layout.addWidget(self.cncjob_label)
grid2 = QtWidgets.QGridLayout() self.multidepth_cb = self.option_dict()["excellon_multidepth"].get_field()
self.layout.addLayout(grid2) self.depthperpass_entry = self.option_dict()["excellon_depthperpass"].get_field()
grid2.setColumnStretch(0, 0) self.ois_multidepth = OptionalInputSection(self.multidepth_cb, [self.depthperpass_entry])
grid2.setColumnStretch(1, 1)
# Operation Type self.dwell_cb = self.option_dict()["excellon_dwell"].get_field()
self.operation_label = QtWidgets.QLabel('<b>%s:</b>' % _('Operation')) self.dwelltime_entry = self.option_dict()["excellon_dwelltime"].get_field()
self.operation_label.setToolTip( self.ois_dwell = OptionalInputSection(self.dwell_cb, [self.dwelltime_entry])
_("Operation type:\n"
# FIXME until this feature is implemented these are disabled
self.option_dict()["excellon_gcode_type"].label_widget.hide()
self.option_dict()["excellon_gcode_type"].get_field().hide()
def build_options(self) -> [OptionUI]:
return [
HeadingOptionUI(
label_text="Create CNC Job",
label_tooltip="Parameters used to create a CNC Job object\n"
"for this drill object."
),
RadioSetOptionUI(
option="excellon_operation",
label_text="Operation",
label_bold=True,
label_tooltip="Operation type:\n"
"- Drilling -> will drill the drills/slots associated with this tool\n" "- Drilling -> will drill the drills/slots associated with this tool\n"
"- Milling -> will mill the drills/slots") "- Milling -> will mill the drills/slots",
) choices=[
self.operation_radio = RadioSet(
[
{'label': _('Drilling'), 'value': 'drill'}, {'label': _('Drilling'), 'value': 'drill'},
{'label': _("Milling"), 'value': 'mill'} {'label': _("Milling"), 'value': 'mill'}
] ]
) ),
RadioSetOptionUI(
grid2.addWidget(self.operation_label, 0, 0) option="excellon_milling_type",
grid2.addWidget(self.operation_radio, 0, 1) label_text="Milling Type",
label_tooltip="Milling type:\n"
self.mill_type_label = QtWidgets.QLabel('%s:' % _('Milling Type'))
self.mill_type_label.setToolTip(
_("Milling type:\n"
"- Drills -> will mill the drills associated with this tool\n" "- Drills -> will mill the drills associated with this tool\n"
"- Slots -> will mill the slots associated with this tool\n" "- Slots -> will mill the slots associated with this tool\n"
"- Both -> will mill both drills and mills or whatever is available") "- Both -> will mill both drills and mills or whatever is available",
) choices=[
self.milling_type_radio = RadioSet(
[
{'label': _('Drills'), 'value': 'drills'}, {'label': _('Drills'), 'value': 'drills'},
{'label': _("Slots"), 'value': 'slots'}, {'label': _("Slots"), 'value': 'slots'},
{'label': _("Both"), 'value': 'both'}, {'label': _("Both"), 'value': 'both'},
] ]
) ),
DoubleSpinnerOptionUI(
option="excellon_milling_dia",
label_text="Milling Diameter",
label_tooltip="The diameter of the tool who will do the milling",
min_value=0.0, max_value=9999.9999, step=0.1, decimals=self.decimals
),
DoubleSpinnerOptionUI(
option="excellon_cutz",
label_text="Cut Z",
label_tooltip="Drill depth (negative) \nbelow the copper surface.",
min_value=-9999.9999, max_value=(9999.9999 if machinist_setting else 0.0),
step=0.1, decimals=self.decimals
),
grid2.addWidget(self.mill_type_label, 1, 0)
grid2.addWidget(self.milling_type_radio, 1, 1)
self.mill_dia_label = QtWidgets.QLabel('%s:' % _('Milling Diameter')) CheckboxOptionUI(
self.mill_dia_label.setToolTip( option="excellon_multidepth",
_("The diameter of the tool who will do the milling") label_text="Multi-Depth",
) label_tooltip="Use multiple passes to limit\n"
self.mill_dia_entry = FCDoubleSpinner()
self.mill_dia_entry.set_precision(self.decimals)
self.mill_dia_entry.set_range(0.0000, 9999.9999)
grid2.addWidget(self.mill_dia_label, 2, 0)
grid2.addWidget(self.mill_dia_entry, 2, 1)
# Cut Z
cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
cutzlabel.setToolTip(
_("Drill depth (negative)\n"
"below the copper surface.")
)
self.cutz_entry = FCDoubleSpinner()
if machinist_setting == 0:
self.cutz_entry.set_range(-9999.9999, 0.0000)
else:
self.cutz_entry.set_range(-9999.9999, 9999.9999)
self.cutz_entry.setSingleStep(0.1)
self.cutz_entry.set_precision(self.decimals)
grid2.addWidget(cutzlabel, 3, 0)
grid2.addWidget(self.cutz_entry, 3, 1)
# Multi-Depth
self.mpass_cb = FCCheckBox('%s:' % _("Multi-Depth"))
self.mpass_cb.setToolTip(
_(
"Use multiple passes to limit\n"
"the cut depth in each pass. Will\n" "the cut depth in each pass. Will\n"
"cut multiple times until Cut Z is\n" "cut multiple times until Cut Z is\n"
"reached." "reached."
) ),
) DoubleSpinnerOptionUI(
option="excellon_depthperpass",
self.maxdepth_entry = FCDoubleSpinner() label_text="Depth/Pass",
self.maxdepth_entry.set_precision(self.decimals) label_tooltip="Depth of each pass (positive).",
self.maxdepth_entry.set_range(0, 9999.9999) min_value=0, max_value=99999, step=0.1, decimals=self.decimals
self.maxdepth_entry.setSingleStep(0.1) ),
DoubleSpinnerOptionUI(
self.maxdepth_entry.setToolTip(_("Depth of each pass (positive).")) option="excellon_travelz",
label_text="Travel Z",
grid2.addWidget(self.mpass_cb, 4, 0) label_tooltip="Tool height when travelling\nacross the XY plane.",
grid2.addWidget(self.maxdepth_entry, 4, 1) min_value=(-9999.9999 if machinist_setting else 0.0001), max_value=9999.9999,
step=0.1, decimals=self.decimals
# Travel Z ),
travelzlabel = QtWidgets.QLabel('%s:' % _('Travel Z')) CheckboxOptionUI(
travelzlabel.setToolTip( option="excellon_toolchange",
_("Tool height when travelling\n" label_text="Tool change",
"across the XY plane.") label_tooltip="Include tool-change sequence\nin G-Code (Pause for tool change)."
) ),
DoubleSpinnerOptionUI(
self.travelz_entry = FCDoubleSpinner() option="excellon_toolchangez",
self.travelz_entry.set_precision(self.decimals) label_text="Toolchange Z",
label_tooltip="Z-axis position (height) for\ntool change.",
if machinist_setting == 0: min_value=(-9999.9999 if machinist_setting else 0.0), max_value=9999.9999,
self.travelz_entry.set_range(0.0001, 9999.9999) step=0.1, decimals=self.decimals
else: ),
self.travelz_entry.set_range(-9999.9999, 9999.9999) DoubleSpinnerOptionUI(
option="excellon_endz",
grid2.addWidget(travelzlabel, 5, 0) label_text="End move Z",
grid2.addWidget(self.travelz_entry, 5, 1) label_tooltip="Height of the tool after\nthe last move at the end of the job.",
min_value=(-9999.9999 if machinist_setting else 0.0), max_value=9999.9999,
# Tool change: step=0.1, decimals=self.decimals
self.toolchange_cb = FCCheckBox('%s' % _("Tool change")) ),
self.toolchange_cb.setToolTip( LineEntryOptionUI(
_("Include tool-change sequence\n" option="excellon_endxy",
"in G-Code (Pause for tool change).") label_text="End move X,Y",
) label_tooltip="End move X,Y position. In format (x,y).\n"
grid2.addWidget(self.toolchange_cb, 6, 0, 1, 2)
# Tool Change Z
toolchangezlabel = QtWidgets.QLabel('%s:' % _('Toolchange Z'))
toolchangezlabel.setToolTip(
_("Z-axis position (height) for\n"
"tool change.")
)
self.toolchangez_entry = FCDoubleSpinner()
self.toolchangez_entry.set_precision(self.decimals)
if machinist_setting == 0:
self.toolchangez_entry.set_range(0.0001, 9999.9999)
else:
self.toolchangez_entry.set_range(-9999.9999, 9999.9999)
grid2.addWidget(toolchangezlabel, 7, 0)
grid2.addWidget(self.toolchangez_entry, 7, 1)
# End Move Z
endz_label = QtWidgets.QLabel('%s:' % _('End move Z'))
endz_label.setToolTip(
_("Height of the tool after\n"
"the last move at the end of the job.")
)
self.endz_entry = FCDoubleSpinner()
self.endz_entry.set_precision(self.decimals)
if machinist_setting == 0:
self.endz_entry.set_range(0.0000, 9999.9999)
else:
self.endz_entry.set_range(-9999.9999, 9999.9999)
grid2.addWidget(endz_label, 8, 0)
grid2.addWidget(self.endz_entry, 8, 1)
# End Move X,Y
endmove_xy_label = QtWidgets.QLabel('%s:' % _('End move X,Y'))
endmove_xy_label.setToolTip(
_("End move X,Y position. In format (x,y).\n"
"If no value is entered then there is no move\n" "If no value is entered then there is no move\n"
"on X,Y plane at the end of the job.") "on X,Y plane at the end of the job."
) ),
self.endxy_entry = FCEntry() DoubleSpinnerOptionUI(
option="excellon_feedrate_z",
grid2.addWidget(endmove_xy_label, 9, 0) label_text="Feedrate Z",
grid2.addWidget(self.endxy_entry, 9, 1) label_tooltip="Tool speed while drilling\n"
# Feedrate Z
frlabel = QtWidgets.QLabel('%s:' % _('Feedrate Z'))
frlabel.setToolTip(
_("Tool speed while drilling\n"
"(in units per minute).\n" "(in units per minute).\n"
"So called 'Plunge' feedrate.\n" "So called 'Plunge' feedrate.\n"
"This is for linear move G01.") "This is for linear move G01.",
) min_value=0, max_value=99999.9999, step=0.1, decimals=self.decimals
self.feedrate_z_entry = FCDoubleSpinner() ),
self.feedrate_z_entry.set_precision(self.decimals) SpinnerOptionUI(
self.feedrate_z_entry.set_range(0, 99999.9999) option="excellon_spindlespeed",
label_text="Spindle speed",
grid2.addWidget(frlabel, 10, 0) label_tooltip="Speed of the spindle in RPM (optional).",
grid2.addWidget(self.feedrate_z_entry, 10, 1) min_value=0, max_value=1000000, step=100
),
# Spindle speed CheckboxOptionUI(
spdlabel = QtWidgets.QLabel('%s:' % _('Spindle Speed')) option="excellon_dwell",
spdlabel.setToolTip( label_text="Enable Dwell",
_("Speed of the spindle\n" label_tooltip="Pause to allow the spindle to reach its\nspeed before cutting."
"in RPM (optional)") ),
) DoubleSpinnerOptionUI(
option="excellon_dwelltime",
self.spindlespeed_entry = FCSpinner() label_text="Duration",
self.spindlespeed_entry.set_range(0, 1000000) label_tooltip="Number of time units for spindle to dwell.",
self.spindlespeed_entry.set_step(100) min_value=0, max_value=999999, step=0.5, decimals=self.decimals
),
grid2.addWidget(spdlabel, 11, 0) ComboboxOptionUI(
grid2.addWidget(self.spindlespeed_entry, 11, 1) option="excellon_ppname_e",
label_text="Preprocessor",
# Dwell label_tooltip="The preprocessor JSON file that dictates\nGcode output.", # FIXME tooltip incorrect?
self.dwell_cb = FCCheckBox('%s' % _('Enable Dwell')) choices=[] # Populated in App (FIXME)
self.dwell_cb .setToolTip( ),
_("Pause to allow the spindle to reach its\n" RadioSetOptionUI(
"speed before cutting.") option="excellon_gcode_type",
) label_text="Gcode",
label_bold=True,
grid2.addWidget(self.dwell_cb, 12, 0, 1, 2) label_tooltip="Choose what to use for GCode generation:\n"
# Dwell Time
dwelltime = QtWidgets.QLabel('%s:' % _('Duration'))
dwelltime.setToolTip(_("Number of time units for spindle to dwell."))
self.dwelltime_entry = FCDoubleSpinner()
self.dwelltime_entry.set_precision(self.decimals)
self.dwelltime_entry.set_range(0, 99999.9999)
grid2.addWidget(dwelltime, 13, 0)
grid2.addWidget(self.dwelltime_entry, 13, 1)
self.ois_dwell_exc = OptionalInputSection(self.dwell_cb, [self.dwelltime_entry])
# preprocessor selection
pp_excellon_label = QtWidgets.QLabel('%s:' % _("Preprocessor"))
pp_excellon_label.setToolTip(
_("The preprocessor JSON file that dictates\n"
"Gcode output.")
)
self.pp_excellon_name_cb = FCComboBox()
self.pp_excellon_name_cb.setFocusPolicy(Qt.StrongFocus)
grid2.addWidget(pp_excellon_label, 14, 0)
grid2.addWidget(self.pp_excellon_name_cb, 14, 1)
# ### Choose what to use for Gcode creation: Drills, Slots or Both
excellon_gcode_type_label = QtWidgets.QLabel('<b>%s</b>' % _('Gcode'))
excellon_gcode_type_label.setToolTip(
_("Choose what to use for GCode generation:\n"
"'Drills', 'Slots' or 'Both'.\n" "'Drills', 'Slots' or 'Both'.\n"
"When choosing 'Slots' or 'Both', slots will be\n" "When choosing 'Slots' or 'Both', slots will be\n"
"converted to drills.") "converted to drills.",
) choices=[
self.excellon_gcode_type_radio = RadioSet([{'label': 'Drills', 'value': 'drills'}, {'label': 'Drills', 'value': 'drills'},
{'label': 'Slots', 'value': 'slots'}, {'label': 'Slots', 'value': 'slots'},
{'label': 'Both', 'value': 'both'}]) {'label': 'Both', 'value': 'both'}
grid2.addWidget(excellon_gcode_type_label, 15, 0) ]
grid2.addWidget(self.excellon_gcode_type_radio, 15, 1) ),
# until I decide to implement this feature those remain disabled HeadingOptionUI(
excellon_gcode_type_label.hide() label_text="Mill Holes",
self.excellon_gcode_type_radio.setVisible(False) label_tooltip="Create Geometry for milling holes."
),
# ### Milling Holes ## ## DoubleSpinnerOptionUI(
self.mill_hole_label = QtWidgets.QLabel('<b>%s</b>' % _('Mill Holes')) option="excellon_tooldia",
self.mill_hole_label.setToolTip( label_text="Drill Tool dia",
_("Create Geometry for milling holes.") label_tooltip="Diameter of the cutting tool",
min_value=0.0, max_value=999.9999, step=0.1, decimals=self.decimals
),
DoubleSpinnerOptionUI(
option="excellon_slot_tooldia",
label_text="Slot Tool dia",
label_tooltip="Diameter of the cutting tool\nwhen milling slots.",
min_value=0.0, max_value=999.9999, step=0.1, decimals=self.decimals
) )
grid2.addWidget(self.mill_hole_label, 16, 0, 1, 2) ]
tdlabel = QtWidgets.QLabel('%s:' % _('Drill Tool dia'))
tdlabel.setToolTip(
_("Diameter of the cutting tool.")
)
self.tooldia_entry = FCDoubleSpinner()
self.tooldia_entry.set_precision(self.decimals)
self.tooldia_entry.set_range(0, 999.9999)
grid2.addWidget(tdlabel, 18, 0)
grid2.addWidget(self.tooldia_entry, 18, 1)
stdlabel = QtWidgets.QLabel('%s:' % _('Slot Tool dia'))
stdlabel.setToolTip(
_("Diameter of the cutting tool\n"
"when milling slots.")
)
self.slot_tooldia_entry = FCDoubleSpinner()
self.slot_tooldia_entry.set_precision(self.decimals)
self.slot_tooldia_entry.set_range(0, 999.9999)
grid2.addWidget(stdlabel, 21, 0)
grid2.addWidget(self.slot_tooldia_entry, 21, 1)
self.layout.addStretch()

View File

@@ -6,6 +6,13 @@ from flatcamGUI.preferences.excellon.ExcellonAdvOptPrefGroupUI import ExcellonAd
from flatcamGUI.preferences.excellon.ExcellonOptPrefGroupUI import ExcellonOptPrefGroupUI from flatcamGUI.preferences.excellon.ExcellonOptPrefGroupUI import ExcellonOptPrefGroupUI
from flatcamGUI.preferences.excellon.ExcellonGenPrefGroupUI import ExcellonGenPrefGroupUI from flatcamGUI.preferences.excellon.ExcellonGenPrefGroupUI import ExcellonGenPrefGroupUI
import gettext
import FlatCAMTranslation as fcTranslate
import builtins
fcTranslate.apply_language('strings')
if '_' not in builtins.__dict__:
_ = gettext.gettext
class ExcellonPreferencesUI(PreferencesSectionUI): class ExcellonPreferencesUI(PreferencesSectionUI):