- renamed classes to have shorter names and grouped

This commit is contained in:
Marius Stanciu
2020-05-18 16:02:41 +03:00
committed by Marius
parent 4c83e87feb
commit ba3f10d355
185 changed files with 749 additions and 748 deletions

View File

@@ -0,0 +1,155 @@
from PyQt5 import QtWidgets
from PyQt5.QtCore import QSettings
from AppGUI.GUIElements import FCDoubleSpinner, FCEntry, FloatEntry, RadioSet, FCCheckBox
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('<b>%s:</b>' % _('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 = FCEntry()
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 = 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"
"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)
self.layout.addStretch()

View File

@@ -0,0 +1,306 @@
from PyQt5 import QtWidgets
from PyQt5.QtCore import QSettings
from AppGUI.GUIElements import FCSpinner, FCDoubleSpinner, RadioSet
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 ExcellonEditorPrefGroupUI(OptionsGroupUI):
def __init__(self, decimals=4, parent=None):
super(ExcellonEditorPrefGroupUI, self).__init__(self, parent=parent)
self.setTitle(str(_("Excellon Editor")))
self.decimals = decimals
# Excellon Editor Parameters
self.param_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
self.param_label.setToolTip(
_("A list of Excellon Editor parameters.")
)
self.layout.addWidget(self.param_label)
grid0 = QtWidgets.QGridLayout()
self.layout.addLayout(grid0)
# Selection Limit
self.sel_limit_label = QtWidgets.QLabel('%s:' % _("Selection limit"))
self.sel_limit_label.setToolTip(
_("Set the number of selected Excellon geometry\n"
"items above which the utility geometry\n"
"becomes just a selection rectangle.\n"
"Increases the performance when moving a\n"
"large number of geometric elements.")
)
self.sel_limit_entry = FCSpinner()
self.sel_limit_entry.set_range(0, 99999)
grid0.addWidget(self.sel_limit_label, 0, 0)
grid0.addWidget(self.sel_limit_entry, 0, 1)
# New Diameter
self.addtool_entry_lbl = QtWidgets.QLabel('%s:' % _('New Dia'))
self.addtool_entry_lbl.setToolTip(
_("Diameter for the new tool")
)
self.addtool_entry = FCDoubleSpinner()
self.addtool_entry.set_range(0.000001, 99.9999)
self.addtool_entry.set_precision(self.decimals)
grid0.addWidget(self.addtool_entry_lbl, 1, 0)
grid0.addWidget(self.addtool_entry, 1, 1)
# Number of drill holes in a drill array
self.drill_array_size_label = QtWidgets.QLabel('%s:' % _('Nr of drills'))
self.drill_array_size_label.setToolTip(
_("Specify how many drills to be in the array.")
)
# self.drill_array_size_label.setMinimumWidth(100)
self.drill_array_size_entry = FCSpinner()
self.drill_array_size_entry.set_range(0, 9999)
grid0.addWidget(self.drill_array_size_label, 2, 0)
grid0.addWidget(self.drill_array_size_entry, 2, 1)
self.drill_array_linear_label = QtWidgets.QLabel('<b>%s:</b>' % _('Linear Drill Array'))
grid0.addWidget(self.drill_array_linear_label, 3, 0, 1, 2)
# Linear Drill Array direction
self.drill_axis_label = QtWidgets.QLabel('%s:' % _('Linear Direction'))
self.drill_axis_label.setToolTip(
_("Direction on which the linear array is oriented:\n"
"- 'X' - horizontal axis \n"
"- 'Y' - vertical axis or \n"
"- 'Angle' - a custom angle for the array inclination")
)
# self.drill_axis_label.setMinimumWidth(100)
self.drill_axis_radio = RadioSet([{'label': _('X'), 'value': 'X'},
{'label': _('Y'), 'value': 'Y'},
{'label': _('Angle'), 'value': 'A'}])
grid0.addWidget(self.drill_axis_label, 4, 0)
grid0.addWidget(self.drill_axis_radio, 4, 1)
# Linear Drill Array pitch distance
self.drill_pitch_label = QtWidgets.QLabel('%s:' % _('Pitch'))
self.drill_pitch_label.setToolTip(
_("Pitch = Distance between elements of the array.")
)
# self.drill_pitch_label.setMinimumWidth(100)
self.drill_pitch_entry = FCDoubleSpinner()
self.drill_pitch_entry.set_range(0, 99999.9999)
self.drill_pitch_entry.set_precision(self.decimals)
grid0.addWidget(self.drill_pitch_label, 5, 0)
grid0.addWidget(self.drill_pitch_entry, 5, 1)
# Linear Drill Array custom angle
self.drill_angle_label = QtWidgets.QLabel('%s:' % _('Angle'))
self.drill_angle_label.setToolTip(
_("Angle at which each element in circular array is placed.")
)
self.drill_angle_entry = FCDoubleSpinner()
self.drill_pitch_entry.set_range(-360, 360)
self.drill_pitch_entry.set_precision(self.decimals)
self.drill_angle_entry.setWrapping(True)
self.drill_angle_entry.setSingleStep(5)
grid0.addWidget(self.drill_angle_label, 6, 0)
grid0.addWidget(self.drill_angle_entry, 6, 1)
self.drill_array_circ_label = QtWidgets.QLabel('<b>%s:</b>' % _('Circular Drill Array'))
grid0.addWidget(self.drill_array_circ_label, 7, 0, 1, 2)
# Circular Drill Array direction
self.drill_circular_direction_label = QtWidgets.QLabel('%s:' % _('Circular Direction'))
self.drill_circular_direction_label.setToolTip(
_("Direction for circular array.\n"
"Can be CW = clockwise or CCW = counter clockwise.")
)
self.drill_circular_dir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
{'label': _('CCW'), 'value': 'CCW'}])
grid0.addWidget(self.drill_circular_direction_label, 8, 0)
grid0.addWidget(self.drill_circular_dir_radio, 8, 1)
# Circular Drill Array Angle
self.drill_circular_angle_label = QtWidgets.QLabel('%s:' % _('Circular Angle'))
self.drill_circular_angle_label.setToolTip(
_("Angle at which each element in circular array is placed.")
)
self.drill_circular_angle_entry = FCDoubleSpinner()
self.drill_circular_angle_entry.set_range(-360, 360)
self.drill_circular_angle_entry.set_precision(self.decimals)
self.drill_circular_angle_entry.setWrapping(True)
self.drill_circular_angle_entry.setSingleStep(5)
grid0.addWidget(self.drill_circular_angle_label, 9, 0)
grid0.addWidget(self.drill_circular_angle_entry, 9, 1)
# ##### SLOTS #####
# #################
self.drill_array_circ_label = QtWidgets.QLabel('<b>%s:</b>' % _('Slots'))
grid0.addWidget(self.drill_array_circ_label, 10, 0, 1, 2)
# Slot length
self.slot_length_label = QtWidgets.QLabel('%s:' % _('Length'))
self.slot_length_label.setToolTip(
_("Length = The length of the slot.")
)
self.slot_length_label.setMinimumWidth(100)
self.slot_length_entry = FCDoubleSpinner()
self.slot_length_entry.set_range(0, 99999)
self.slot_length_entry.set_precision(self.decimals)
self.slot_length_entry.setWrapping(True)
self.slot_length_entry.setSingleStep(1)
grid0.addWidget(self.slot_length_label, 11, 0)
grid0.addWidget(self.slot_length_entry, 11, 1)
# Slot direction
self.slot_axis_label = QtWidgets.QLabel('%s:' % _('Direction'))
self.slot_axis_label.setToolTip(
_("Direction on which the slot is oriented:\n"
"- 'X' - horizontal axis \n"
"- 'Y' - vertical axis or \n"
"- 'Angle' - a custom angle for the slot inclination")
)
self.slot_axis_label.setMinimumWidth(100)
self.slot_axis_radio = RadioSet([{'label': _('X'), 'value': 'X'},
{'label': _('Y'), 'value': 'Y'},
{'label': _('Angle'), 'value': 'A'}])
grid0.addWidget(self.slot_axis_label, 12, 0)
grid0.addWidget(self.slot_axis_radio, 12, 1)
# Slot custom angle
self.slot_angle_label = QtWidgets.QLabel('%s:' % _('Angle'))
self.slot_angle_label.setToolTip(
_("Angle at which the slot is placed.\n"
"The precision is of max 2 decimals.\n"
"Min value is: -359.99 degrees.\n"
"Max value is: 360.00 degrees.")
)
self.slot_angle_label.setMinimumWidth(100)
self.slot_angle_spinner = FCDoubleSpinner()
self.slot_angle_spinner.set_precision(self.decimals)
self.slot_angle_spinner.setWrapping(True)
self.slot_angle_spinner.setRange(-359.99, 360.00)
self.slot_angle_spinner.setSingleStep(5)
grid0.addWidget(self.slot_angle_label, 13, 0)
grid0.addWidget(self.slot_angle_spinner, 13, 1)
# #### SLOTS ARRAY #######
# ########################
self.slot_array_linear_label = QtWidgets.QLabel('<b>%s:</b>' % _('Linear Slot Array'))
grid0.addWidget(self.slot_array_linear_label, 14, 0, 1, 2)
# Number of slot holes in a drill array
self.slot_array_size_label = QtWidgets.QLabel('%s:' % _('Nr of slots'))
self.drill_array_size_label.setToolTip(
_("Specify how many slots to be in the array.")
)
# self.slot_array_size_label.setMinimumWidth(100)
self.slot_array_size_entry = FCSpinner()
self.slot_array_size_entry.set_range(0, 999999)
grid0.addWidget(self.slot_array_size_label, 15, 0)
grid0.addWidget(self.slot_array_size_entry, 15, 1)
# Linear Slot Array direction
self.slot_array_axis_label = QtWidgets.QLabel('%s:' % _('Linear Direction'))
self.slot_array_axis_label.setToolTip(
_("Direction on which the linear array is oriented:\n"
"- 'X' - horizontal axis \n"
"- 'Y' - vertical axis or \n"
"- 'Angle' - a custom angle for the array inclination")
)
# self.slot_axis_label.setMinimumWidth(100)
self.slot_array_axis_radio = RadioSet([{'label': _('X'), 'value': 'X'},
{'label': _('Y'), 'value': 'Y'},
{'label': _('Angle'), 'value': 'A'}])
grid0.addWidget(self.slot_array_axis_label, 16, 0)
grid0.addWidget(self.slot_array_axis_radio, 16, 1)
# Linear Slot Array pitch distance
self.slot_array_pitch_label = QtWidgets.QLabel('%s:' % _('Pitch'))
self.slot_array_pitch_label.setToolTip(
_("Pitch = Distance between elements of the array.")
)
# self.drill_pitch_label.setMinimumWidth(100)
self.slot_array_pitch_entry = FCDoubleSpinner()
self.slot_array_pitch_entry.set_precision(self.decimals)
self.slot_array_pitch_entry.setWrapping(True)
self.slot_array_pitch_entry.setRange(0, 999999)
self.slot_array_pitch_entry.setSingleStep(1)
grid0.addWidget(self.slot_array_pitch_label, 17, 0)
grid0.addWidget(self.slot_array_pitch_entry, 17, 1)
# Linear Slot Array custom angle
self.slot_array_angle_label = QtWidgets.QLabel('%s:' % _('Angle'))
self.slot_array_angle_label.setToolTip(
_("Angle at which each element in circular array is placed.")
)
self.slot_array_angle_entry = FCDoubleSpinner()
self.slot_array_angle_entry.set_precision(self.decimals)
self.slot_array_angle_entry.setWrapping(True)
self.slot_array_angle_entry.setRange(-360, 360)
self.slot_array_angle_entry.setSingleStep(5)
grid0.addWidget(self.slot_array_angle_label, 18, 0)
grid0.addWidget(self.slot_array_angle_entry, 18, 1)
self.slot_array_circ_label = QtWidgets.QLabel('<b>%s:</b>' % _('Circular Slot Array'))
grid0.addWidget(self.slot_array_circ_label, 19, 0, 1, 2)
# Circular Slot Array direction
self.slot_array_circular_direction_label = QtWidgets.QLabel('%s:' % _('Circular Direction'))
self.slot_array_circular_direction_label.setToolTip(
_("Direction for circular array.\n"
"Can be CW = clockwise or CCW = counter clockwise.")
)
self.slot_array_circular_dir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
{'label': _('CCW'), 'value': 'CCW'}])
grid0.addWidget(self.slot_array_circular_direction_label, 20, 0)
grid0.addWidget(self.slot_array_circular_dir_radio, 20, 1)
# Circular Slot Array Angle
self.slot_array_circular_angle_label = QtWidgets.QLabel('%s:' % _('Circular Angle'))
self.slot_array_circular_angle_label.setToolTip(
_("Angle at which each element in circular array is placed.")
)
self.slot_array_circular_angle_entry = FCDoubleSpinner()
self.slot_array_circular_angle_entry.set_precision(self.decimals)
self.slot_array_circular_angle_entry.setWrapping(True)
self.slot_array_circular_angle_entry.setRange(-360, 360)
self.slot_array_circular_angle_entry.setSingleStep(5)
grid0.addWidget(self.slot_array_circular_angle_label, 21, 0)
grid0.addWidget(self.slot_array_circular_angle_entry, 21, 1)
self.layout.addStretch()

View File

@@ -0,0 +1,168 @@
from PyQt5 import QtWidgets, QtCore
from PyQt5.QtCore import QSettings
from AppGUI.GUIElements import RadioSet, FCSpinner
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 ExcellonExpPrefGroupUI(OptionsGroupUI):
def __init__(self, decimals=4, parent=None):
super(ExcellonExpPrefGroupUI, self).__init__(self, parent=parent)
self.setTitle(str(_("Excellon Export")))
self.decimals = decimals
# Plot options
self.export_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Export Options"))
self.export_options_label.setToolTip(
_("The parameters set here are used in the file exported\n"
"when using the File -> Export -> Export Excellon menu entry.")
)
self.layout.addWidget(self.export_options_label)
form = QtWidgets.QFormLayout()
self.layout.addLayout(form)
# Excellon Units
self.excellon_units_label = QtWidgets.QLabel('%s:' % _('Units'))
self.excellon_units_label.setToolTip(
_("The units used in the Excellon file.")
)
self.excellon_units_radio = RadioSet([{'label': _('INCH'), 'value': 'INCH'},
{'label': _('MM'), 'value': 'METRIC'}])
self.excellon_units_radio.setToolTip(
_("The units used in the Excellon file.")
)
form.addRow(self.excellon_units_label, self.excellon_units_radio)
# Excellon non-decimal format
self.digits_label = QtWidgets.QLabel("%s:" % _("Int/Decimals"))
self.digits_label.setToolTip(
_("The NC drill files, usually named Excellon files\n"
"are files that can be found in different formats.\n"
"Here we set the format used when the provided\n"
"coordinates are not using period.")
)
hlay1 = QtWidgets.QHBoxLayout()
self.format_whole_entry = FCSpinner()
self.format_whole_entry.set_range(0, 9)
self.format_whole_entry.setMinimumWidth(30)
self.format_whole_entry.setToolTip(
_("This numbers signify the number of digits in\n"
"the whole part of Excellon coordinates.")
)
hlay1.addWidget(self.format_whole_entry, QtCore.Qt.AlignLeft)
excellon_separator_label = QtWidgets.QLabel(':')
excellon_separator_label.setFixedWidth(5)
hlay1.addWidget(excellon_separator_label, QtCore.Qt.AlignLeft)
self.format_dec_entry = FCSpinner()
self.format_dec_entry.set_range(0, 9)
self.format_dec_entry.setMinimumWidth(30)
self.format_dec_entry.setToolTip(
_("This numbers signify the number of digits in\n"
"the decimal part of Excellon coordinates.")
)
hlay1.addWidget(self.format_dec_entry, QtCore.Qt.AlignLeft)
hlay1.addStretch()
form.addRow(self.digits_label, hlay1)
# Select the Excellon Format
self.format_label = QtWidgets.QLabel("%s:" % _("Format"))
self.format_label.setToolTip(
_("Select the kind of coordinates format used.\n"
"Coordinates can be saved with decimal point or without.\n"
"When there is no decimal point, it is required to specify\n"
"the number of digits for integer part and the number of decimals.\n"
"Also it will have to be specified if LZ = leading zeros are kept\n"
"or TZ = trailing zeros are kept.")
)
self.format_radio = RadioSet([{'label': _('Decimal'), 'value': 'dec'},
{'label': _('No-Decimal'), 'value': 'ndec'}])
self.format_radio.setToolTip(
_("Select the kind of coordinates format used.\n"
"Coordinates can be saved with decimal point or without.\n"
"When there is no decimal point, it is required to specify\n"
"the number of digits for integer part and the number of decimals.\n"
"Also it will have to be specified if LZ = leading zeros are kept\n"
"or TZ = trailing zeros are kept.")
)
form.addRow(self.format_label, self.format_radio)
# Excellon Zeros
self.zeros_label = QtWidgets.QLabel('%s:' % _('Zeros'))
self.zeros_label.setAlignment(QtCore.Qt.AlignLeft)
self.zeros_label.setToolTip(
_("This sets the type of Excellon zeros.\n"
"If LZ then Leading Zeros are kept and\n"
"Trailing Zeros are removed.\n"
"If TZ is checked then Trailing Zeros are kept\n"
"and Leading Zeros are removed.")
)
self.zeros_radio = RadioSet([{'label': _('LZ'), 'value': 'LZ'},
{'label': _('TZ'), 'value': 'TZ'}])
self.zeros_radio.setToolTip(
_("This sets the default type of Excellon zeros.\n"
"If LZ then Leading Zeros are kept and\n"
"Trailing Zeros are removed.\n"
"If TZ is checked then Trailing Zeros are kept\n"
"and Leading Zeros are removed.")
)
form.addRow(self.zeros_label, self.zeros_radio)
# Slot type
self.slot_type_label = QtWidgets.QLabel('%s:' % _('Slot type'))
self.slot_type_label.setAlignment(QtCore.Qt.AlignLeft)
self.slot_type_label.setToolTip(
_("This sets how the slots will be exported.\n"
"If ROUTED then the slots will be routed\n"
"using M15/M16 commands.\n"
"If DRILLED(G85) the slots will be exported\n"
"using the Drilled slot command (G85).")
)
self.slot_type_radio = RadioSet([{'label': _('Routed'), 'value': 'routing'},
{'label': _('Drilled(G85)'), 'value': 'drilling'}])
self.slot_type_radio.setToolTip(
_("This sets how the slots will be exported.\n"
"If ROUTED then the slots will be routed\n"
"using M15/M16 commands.\n"
"If DRILLED(G85) the slots will be exported\n"
"using the Drilled slot command (G85).")
)
form.addRow(self.slot_type_label, self.slot_type_radio)
self.layout.addStretch()
self.format_radio.activated_custom.connect(self.optimization_selection)
def optimization_selection(self):
if self.format_radio.get_value() == 'dec':
self.zeros_label.setDisabled(True)
self.zeros_radio.setDisabled(True)
else:
self.zeros_label.setDisabled(False)
self.zeros_radio.setDisabled(False)

View File

@@ -0,0 +1,415 @@
import platform
from PyQt5 import QtWidgets, QtCore, QtGui
from PyQt5.QtCore import QSettings
from AppGUI.GUIElements import FCCheckBox, FCSpinner, RadioSet, FCEntry
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 ExcellonGenPrefGroupUI(OptionsGroupUI):
def __init__(self, decimals=4, parent=None):
# OptionsGroupUI.__init__(self, "Excellon Options", parent=parent)
super(ExcellonGenPrefGroupUI, self).__init__(self, parent=parent)
self.setTitle(str(_("Excellon General")))
self.decimals = decimals
# Plot options
self.plot_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Plot Options"))
self.layout.addWidget(self.plot_options_label)
grid1 = QtWidgets.QGridLayout()
self.layout.addLayout(grid1)
self.plot_cb = FCCheckBox(label=_('Plot'))
self.plot_cb.setToolTip(
"Plot (show) this object."
)
grid1.addWidget(self.plot_cb, 0, 0)
self.solid_cb = FCCheckBox(label=_('Solid'))
self.solid_cb.setToolTip(
"Plot as solid circles."
)
grid1.addWidget(self.solid_cb, 0, 1)
separator_line = QtWidgets.QFrame()
separator_line.setFrameShape(QtWidgets.QFrame.HLine)
separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
grid1.addWidget(separator_line, 1, 0, 1, 2)
grid2 = QtWidgets.QGridLayout()
self.layout.addLayout(grid2)
grid2.setColumnStretch(0, 0)
grid2.setColumnStretch(1, 1)
# Excellon format
self.excellon_format_label = QtWidgets.QLabel("<b>%s:</b>" % _("Excellon Format"))
self.excellon_format_label.setToolTip(
_("The NC drill files, usually named Excellon files\n"
"are files that can be found in different formats.\n"
"Here we set the format used when the provided\n"
"coordinates are not using period.\n"
"\n"
"Possible presets:\n"
"\n"
"PROTEUS 3:3 MM LZ\n"
"DipTrace 5:2 MM TZ\n"
"DipTrace 4:3 MM LZ\n"
"\n"
"EAGLE 3:3 MM TZ\n"
"EAGLE 4:3 MM TZ\n"
"EAGLE 2:5 INCH TZ\n"
"EAGLE 3:5 INCH TZ\n"
"\n"
"ALTIUM 2:4 INCH LZ\n"
"Sprint Layout 2:4 INCH LZ"
"\n"
"KiCAD 3:5 INCH TZ")
)
grid2.addWidget(self.excellon_format_label, 0, 0, 1, 2)
self.excellon_format_in_label = QtWidgets.QLabel('%s:' % _("INCH"))
self.excellon_format_in_label.setToolTip(_("Default values for INCH are 2:4"))
hlay1 = QtWidgets.QHBoxLayout()
self.excellon_format_upper_in_entry = FCSpinner()
self.excellon_format_upper_in_entry.set_range(0, 9)
self.excellon_format_upper_in_entry.setMinimumWidth(30)
self.excellon_format_upper_in_entry.setToolTip(
_("This numbers signify the number of digits in\n"
"the whole part of Excellon coordinates.")
)
hlay1.addWidget(self.excellon_format_upper_in_entry)
excellon_separator_in_label = QtWidgets.QLabel(':')
excellon_separator_in_label.setFixedWidth(5)
hlay1.addWidget(excellon_separator_in_label)
self.excellon_format_lower_in_entry = FCSpinner()
self.excellon_format_lower_in_entry.set_range(0, 9)
self.excellon_format_lower_in_entry.setMinimumWidth(30)
self.excellon_format_lower_in_entry.setToolTip(
_("This numbers signify the number of digits in\n"
"the decimal part of Excellon coordinates.")
)
hlay1.addWidget(self.excellon_format_lower_in_entry)
grid2.addWidget(self.excellon_format_in_label, 1, 0)
grid2.addLayout(hlay1, 1, 1)
self.excellon_format_mm_label = QtWidgets.QLabel('%s:' % _("METRIC"))
self.excellon_format_mm_label.setToolTip(_("Default values for METRIC are 3:3"))
hlay2 = QtWidgets.QHBoxLayout()
self.excellon_format_upper_mm_entry = FCSpinner()
self.excellon_format_upper_mm_entry.set_range(0, 9)
self.excellon_format_upper_mm_entry.setMinimumWidth(30)
self.excellon_format_upper_mm_entry.setToolTip(
_("This numbers signify the number of digits in\n"
"the whole part of Excellon coordinates.")
)
hlay2.addWidget(self.excellon_format_upper_mm_entry)
excellon_separator_mm_label = QtWidgets.QLabel(':')
excellon_separator_mm_label.setFixedWidth(5)
hlay2.addWidget(excellon_separator_mm_label, QtCore.Qt.AlignLeft)
self.excellon_format_lower_mm_entry = FCSpinner()
self.excellon_format_lower_mm_entry.set_range(0, 9)
self.excellon_format_lower_mm_entry.setMinimumWidth(30)
self.excellon_format_lower_mm_entry.setToolTip(
_("This numbers signify the number of digits in\n"
"the decimal part of Excellon coordinates.")
)
hlay2.addWidget(self.excellon_format_lower_mm_entry)
grid2.addWidget(self.excellon_format_mm_label, 2, 0)
grid2.addLayout(hlay2, 2, 1)
self.excellon_zeros_label = QtWidgets.QLabel('%s:' % _('Zeros'))
self.excellon_zeros_label.setAlignment(QtCore.Qt.AlignLeft)
self.excellon_zeros_label.setToolTip(
_("This sets the type of Excellon zeros.\n"
"If LZ then Leading Zeros are kept and\n"
"Trailing Zeros are removed.\n"
"If TZ is checked then Trailing Zeros are kept\n"
"and Leading Zeros are removed.\n\n"
"This is used when there is no information\n"
"stored in the Excellon file.")
)
grid2.addWidget(self.excellon_zeros_label, 3, 0)
self.excellon_zeros_radio = RadioSet([{'label': _('LZ'), 'value': 'L'},
{'label': _('TZ'), 'value': 'T'}])
grid2.addWidget(self.excellon_zeros_radio, 3, 1)
self.excellon_units_label = QtWidgets.QLabel('%s:' % _('Units'))
self.excellon_units_label.setAlignment(QtCore.Qt.AlignLeft)
self.excellon_units_label.setToolTip(
_("This sets the default units of Excellon files.\n"
"If it is not detected in the parsed file the value here\n"
"will be used."
"Some Excellon files don't have an header\n"
"therefore this parameter will be used.")
)
self.excellon_units_radio = RadioSet([{'label': _('INCH'), 'value': 'INCH'},
{'label': _('MM'), 'value': 'METRIC'}])
self.excellon_units_radio.setToolTip(
_("This sets the units of Excellon files.\n"
"Some Excellon files don't have an header\n"
"therefore this parameter will be used.")
)
grid2.addWidget(self.excellon_units_label, 4, 0)
grid2.addWidget(self.excellon_units_radio, 4, 1)
self.update_excellon_cb = FCCheckBox(label=_('Update Export settings'))
self.update_excellon_cb.setToolTip(
"If checked, the Excellon Export settings will be updated with the ones above."
)
grid2.addWidget(self.update_excellon_cb, 5, 0, 1, 2)
# Adding the Excellon Format Defaults Button
self.excellon_defaults_button = QtWidgets.QPushButton()
self.excellon_defaults_button.setText(str(_("Restore Defaults")))
self.excellon_defaults_button.setMinimumWidth(80)
grid2.addWidget(self.excellon_defaults_button, 6, 0, 1, 2)
separator_line = QtWidgets.QFrame()
separator_line.setFrameShape(QtWidgets.QFrame.HLine)
separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
grid2.addWidget(separator_line, 7, 0, 1, 2)
self.excellon_general_label = QtWidgets.QLabel("<b>%s:</b>" % _("Excellon Optimization"))
grid2.addWidget(self.excellon_general_label, 8, 0, 1, 2)
self.excellon_optimization_label = QtWidgets.QLabel(_('Algorithm:'))
self.excellon_optimization_label.setToolTip(
_("This sets the optimization type for the Excellon drill path.\n"
"If <<MetaHeuristic>> is checked then Google OR-Tools algorithm with\n"
"MetaHeuristic Guided Local Path is used. Default search time is 3sec.\n"
"If <<Basic>> is checked then Google OR-Tools Basic algorithm is used.\n"
"If <<TSA>> is checked then Travelling Salesman algorithm is used for\n"
"drill path optimization.\n"
"\n"
"If this control is disabled, then FlatCAM works in 32bit mode and it uses\n"
"Travelling Salesman algorithm for path optimization.")
)
self.excellon_optimization_radio = RadioSet([{'label': _('MetaHeuristic'), 'value': 'M'},
{'label': _('Basic'), 'value': 'B'},
{'label': _('TSA'), 'value': 'T'}],
orientation='vertical', stretch=False)
self.excellon_optimization_radio.setToolTip(
_("This sets the optimization type for the Excellon drill path.\n"
"If <<MetaHeuristic>> is checked then Google OR-Tools algorithm with\n"
"MetaHeuristic Guided Local Path is used. Default search time is 3sec.\n"
"If <<Basic>> is checked then Google OR-Tools Basic algorithm is used.\n"
"If <<TSA>> is checked then Travelling Salesman algorithm is used for\n"
"drill path optimization.\n"
"\n"
"If this control is disabled, then FlatCAM works in 32bit mode and it uses\n"
"Travelling Salesman algorithm for path optimization.")
)
grid2.addWidget(self.excellon_optimization_label, 9, 0)
grid2.addWidget(self.excellon_optimization_radio, 9, 1)
self.optimization_time_label = QtWidgets.QLabel('%s:' % _('Duration'))
self.optimization_time_label.setAlignment(QtCore.Qt.AlignLeft)
self.optimization_time_label.setToolTip(
_("When OR-Tools Metaheuristic (MH) is enabled there is a\n"
"maximum threshold for how much time is spent doing the\n"
"path optimization. This max duration is set here.\n"
"In seconds.")
)
self.optimization_time_entry = FCSpinner()
self.optimization_time_entry.set_range(0, 999)
grid2.addWidget(self.optimization_time_label, 10, 0)
grid2.addWidget(self.optimization_time_entry, 10, 1)
separator_line = QtWidgets.QFrame()
separator_line.setFrameShape(QtWidgets.QFrame.HLine)
separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
grid2.addWidget(separator_line, 11, 0, 1, 2)
# Excellon Object Color
self.gerber_color_label = QtWidgets.QLabel('<b>%s</b>' % _('Excellon Object Color'))
grid2.addWidget(self.gerber_color_label, 12, 0, 1, 2)
# Plot Line Color
self.line_color_label = QtWidgets.QLabel('%s:' % _('Outline'))
self.line_color_label.setToolTip(
_("Set the line color for plotted objects.")
)
self.line_color_entry = FCEntry()
self.line_color_button = QtWidgets.QPushButton()
self.line_color_button.setFixedSize(15, 15)
self.form_box_child_2 = QtWidgets.QHBoxLayout()
self.form_box_child_2.addWidget(self.line_color_entry)
self.form_box_child_2.addWidget(self.line_color_button)
self.form_box_child_2.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
grid2.addWidget(self.line_color_label, 13, 0)
grid2.addLayout(self.form_box_child_2, 13, 1)
# Plot Fill Color
self.fill_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
self.fill_color_label.setToolTip(
_("Set the fill color for plotted objects.\n"
"First 6 digits are the color and the last 2\n"
"digits are for alpha (transparency) level.")
)
self.fill_color_entry = FCEntry()
self.fill_color_button = QtWidgets.QPushButton()
self.fill_color_button.setFixedSize(15, 15)
self.form_box_child_1 = QtWidgets.QHBoxLayout()
self.form_box_child_1.addWidget(self.fill_color_entry)
self.form_box_child_1.addWidget(self.fill_color_button)
self.form_box_child_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
grid2.addWidget(self.fill_color_label, 14, 0)
grid2.addLayout(self.form_box_child_1, 14, 1)
# Plot Fill Transparency Level
self.alpha_label = QtWidgets.QLabel('%s:' % _('Alpha'))
self.alpha_label.setToolTip(
_("Set the fill transparency for plotted objects.")
)
self.color_alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
self.color_alpha_slider.setMinimum(0)
self.color_alpha_slider.setMaximum(255)
self.color_alpha_slider.setSingleStep(1)
self.color_alpha_spinner = FCSpinner()
self.color_alpha_spinner.setMinimumWidth(70)
self.color_alpha_spinner.set_range(0, 255)
self.form_box_child_3 = QtWidgets.QHBoxLayout()
self.form_box_child_3.addWidget(self.color_alpha_slider)
self.form_box_child_3.addWidget(self.color_alpha_spinner)
grid2.addWidget(self.alpha_label, 15, 0)
grid2.addLayout(self.form_box_child_3, 15, 1)
self.layout.addStretch()
current_platform = platform.architecture()[0]
if current_platform == '64bit':
self.excellon_optimization_label.setDisabled(False)
self.excellon_optimization_radio.setDisabled(False)
self.optimization_time_label.setDisabled(False)
self.optimization_time_entry.setDisabled(False)
self.excellon_optimization_radio.activated_custom.connect(self.optimization_selection)
else:
self.excellon_optimization_label.setDisabled(True)
self.excellon_optimization_radio.setDisabled(True)
self.optimization_time_label.setDisabled(True)
self.optimization_time_entry.setDisabled(True)
# Setting plot colors signals
self.line_color_entry.editingFinished.connect(self.on_line_color_entry)
self.line_color_button.clicked.connect(self.on_line_color_button)
self.fill_color_entry.editingFinished.connect(self.on_fill_color_entry)
self.fill_color_button.clicked.connect(self.on_fill_color_button)
self.color_alpha_spinner.valueChanged.connect(self.on_color_spinner)
self.color_alpha_slider.valueChanged.connect(self.on_color_slider)
# Load the defaults values into the Excellon Format and Excellon Zeros fields
self.excellon_defaults_button.clicked.connect(self.on_excellon_defaults_button)
def optimization_selection(self):
if self.excellon_optimization_radio.get_value() == 'M':
self.optimization_time_label.setDisabled(False)
self.optimization_time_entry.setDisabled(False)
else:
self.optimization_time_label.setDisabled(True)
self.optimization_time_entry.setDisabled(True)
# Setting plot colors handlers
def on_fill_color_entry(self):
self.app.defaults['excellon_plot_fill'] = self.fill_color_entry.get_value()[:7] + \
self.app.defaults['excellon_plot_fill'][7:9]
self.fill_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['excellon_plot_fill'])[:7])
def on_fill_color_button(self):
current_color = QtGui.QColor(self.app.defaults['excellon_plot_fill'][:7])
c_dialog = QtWidgets.QColorDialog()
plot_fill_color = c_dialog.getColor(initial=current_color)
if plot_fill_color.isValid() is False:
return
self.fill_color_button.setStyleSheet("background-color:%s" % str(plot_fill_color.name()))
new_val = str(plot_fill_color.name()) + str(self.app.defaults['excellon_plot_fill'][7:9])
self.fill_color_entry.set_value(new_val)
self.app.defaults['excellon_plot_fill'] = new_val
def on_color_spinner(self):
spinner_value = self.color_alpha_spinner.value()
self.color_alpha_slider.setValue(spinner_value)
self.app.defaults['excellon_plot_fill'] = \
self.app.defaults['excellon_plot_fill'][:7] + \
(hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
self.app.defaults['excellon_plot_line'] = \
self.app.defaults['excellon_plot_line'][:7] + \
(hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
def on_color_slider(self):
slider_value = self.color_alpha_slider.value()
self.color_alpha_spinner.setValue(slider_value)
def on_line_color_entry(self):
self.app.defaults['excellon_plot_line'] = self.line_color_entry.get_value()[:7] + \
self.app.defaults['excellon_plot_line'][7:9]
self.line_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['excellon_plot_line'])[:7])
def on_line_color_button(self):
current_color = QtGui.QColor(self.app.defaults['excellon_plot_line'][:7])
# print(current_color)
c_dialog = QtWidgets.QColorDialog()
plot_line_color = c_dialog.getColor(initial=current_color)
if plot_line_color.isValid() is False:
return
self.line_color_button.setStyleSheet("background-color:%s" % str(plot_line_color.name()))
new_val_line = str(plot_line_color.name()) + str(self.app.defaults['excellon_plot_line'][7:9])
self.line_color_entry.set_value(new_val_line)
self.app.defaults['excellon_plot_line'] = new_val_line
def on_excellon_defaults_button(self):
self.app.preferencesUiManager.defaults_form_fields["excellon_format_lower_in"].set_value('4')
self.app.preferencesUiManager.defaults_form_fields["excellon_format_upper_in"].set_value('2')
self.app.preferencesUiManager.defaults_form_fields["excellon_format_lower_mm"].set_value('3')
self.app.preferencesUiManager.defaults_form_fields["excellon_format_upper_mm"].set_value('3')
self.app.preferencesUiManager.defaults_form_fields["excellon_zeros"].set_value('L')
self.app.preferencesUiManager.defaults_form_fields["excellon_units"].set_value('INCH')

View File

@@ -0,0 +1,317 @@
from PyQt5 import QtWidgets
from PyQt5.QtCore import Qt, QSettings
from AppGUI.GUIElements import RadioSet, FCDoubleSpinner, FCCheckBox, FCEntry, FCSpinner, OptionalInputSection, \
FCComboBox
from AppGUI.preferences import machinist_setting
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 ExcellonOptPrefGroupUI(OptionsGroupUI):
def __init__(self, decimals=4, parent=None):
# OptionsGroupUI.__init__(self, "Excellon Options", parent=parent)
super(ExcellonOptPrefGroupUI, self).__init__(self, parent=parent)
self.setTitle(str(_("Excellon Options")))
self.decimals = decimals
# ## Create CNC Job
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.layout.addLayout(grid2)
grid2.setColumnStretch(0, 0)
grid2.setColumnStretch(1, 1)
# Operation Type
self.operation_label = QtWidgets.QLabel('<b>%s:</b>' % _('Operation'))
self.operation_label.setToolTip(
_("Operation type:\n"
"- Drilling -> will drill the drills/slots associated with this tool\n"
"- Milling -> will mill the drills/slots")
)
self.operation_radio = RadioSet(
[
{'label': _('Drilling'), 'value': 'drill'},
{'label': _("Milling"), 'value': 'mill'}
]
)
grid2.addWidget(self.operation_label, 0, 0)
grid2.addWidget(self.operation_radio, 0, 1)
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"
"- Slots -> will mill the slots associated with this tool\n"
"- Both -> will mill both drills and mills or whatever is available")
)
self.milling_type_radio = RadioSet(
[
{'label': _('Drills'), 'value': 'drills'},
{'label': _("Slots"), 'value': 'slots'},
{'label': _("Both"), 'value': 'both'},
]
)
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'))
self.mill_dia_label.setToolTip(
_("The diameter of the tool who will do the milling")
)
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"
"cut multiple times until Cut Z is\n"
"reached."
)
)
self.maxdepth_entry = FCDoubleSpinner()
self.maxdepth_entry.set_precision(self.decimals)
self.maxdepth_entry.set_range(0, 9999.9999)
self.maxdepth_entry.setSingleStep(0.1)
self.maxdepth_entry.setToolTip(_("Depth of each pass (positive)."))
grid2.addWidget(self.mpass_cb, 4, 0)
grid2.addWidget(self.maxdepth_entry, 4, 1)
# Travel Z
travelzlabel = QtWidgets.QLabel('%s:' % _('Travel Z'))
travelzlabel.setToolTip(
_("Tool height when travelling\n"
"across the XY plane.")
)
self.travelz_entry = FCDoubleSpinner()
self.travelz_entry.set_precision(self.decimals)
if machinist_setting == 0:
self.travelz_entry.set_range(0.0001, 9999.9999)
else:
self.travelz_entry.set_range(-9999.9999, 9999.9999)
grid2.addWidget(travelzlabel, 5, 0)
grid2.addWidget(self.travelz_entry, 5, 1)
# Tool change:
self.toolchange_cb = FCCheckBox('%s' % _("Tool change"))
self.toolchange_cb.setToolTip(
_("Include tool-change sequence\n"
"in G-Code (Pause for tool change).")
)
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"
"on X,Y plane at the end of the job.")
)
self.endxy_entry = FCEntry()
grid2.addWidget(endmove_xy_label, 9, 0)
grid2.addWidget(self.endxy_entry, 9, 1)
# Feedrate Z
frlabel = QtWidgets.QLabel('%s:' % _('Feedrate Z'))
frlabel.setToolTip(
_("Tool speed while drilling\n"
"(in units per minute).\n"
"So called 'Plunge' feedrate.\n"
"This is for linear move G01.")
)
self.feedrate_z_entry = FCDoubleSpinner()
self.feedrate_z_entry.set_precision(self.decimals)
self.feedrate_z_entry.set_range(0, 99999.9999)
grid2.addWidget(frlabel, 10, 0)
grid2.addWidget(self.feedrate_z_entry, 10, 1)
# Spindle speed
spdlabel = QtWidgets.QLabel('%s:' % _('Spindle Speed'))
spdlabel.setToolTip(
_("Speed of the spindle\n"
"in RPM (optional)")
)
self.spindlespeed_entry = FCSpinner()
self.spindlespeed_entry.set_range(0, 1000000)
self.spindlespeed_entry.set_step(100)
grid2.addWidget(spdlabel, 11, 0)
grid2.addWidget(self.spindlespeed_entry, 11, 1)
# Dwell
self.dwell_cb = FCCheckBox('%s' % _('Enable Dwell'))
self.dwell_cb .setToolTip(
_("Pause to allow the spindle to reach its\n"
"speed before cutting.")
)
grid2.addWidget(self.dwell_cb, 12, 0, 1, 2)
# 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"
"When choosing 'Slots' or 'Both', slots will be\n"
"converted to drills.")
)
self.excellon_gcode_type_radio = RadioSet([{'label': 'Drills', 'value': 'drills'},
{'label': 'Slots', 'value': 'slots'},
{'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
excellon_gcode_type_label.hide()
self.excellon_gcode_type_radio.setVisible(False)
# ### Milling Holes ## ##
self.mill_hole_label = QtWidgets.QLabel('<b>%s</b>' % _('Mill Holes'))
self.mill_hole_label.setToolTip(
_("Create Geometry for milling holes.")
)
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

@@ -0,0 +1,53 @@
from PyQt5 import QtWidgets
from PyQt5.QtCore import QSettings
from AppGUI.preferences.excellon.ExcellonEditorPrefGroupUI import ExcellonEditorPrefGroupUI
from AppGUI.preferences.excellon.ExcellonExpPrefGroupUI import ExcellonExpPrefGroupUI
from AppGUI.preferences.excellon.ExcellonAdvOptPrefGroupUI import ExcellonAdvOptPrefGroupUI
from AppGUI.preferences.excellon.ExcellonOptPrefGroupUI import ExcellonOptPrefGroupUI
from AppGUI.preferences.excellon.ExcellonGenPrefGroupUI import ExcellonGenPrefGroupUI
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 ExcellonPreferencesUI(QtWidgets.QWidget):
def __init__(self, decimals, parent=None):
QtWidgets.QWidget.__init__(self, parent=parent)
self.layout = QtWidgets.QHBoxLayout()
self.setLayout(self.layout)
self.decimals = decimals
self.excellon_gen_group = ExcellonGenPrefGroupUI(decimals=self.decimals)
self.excellon_gen_group.setMinimumWidth(220)
self.excellon_opt_group = ExcellonOptPrefGroupUI(decimals=self.decimals)
self.excellon_opt_group.setMinimumWidth(290)
self.excellon_exp_group = ExcellonExpPrefGroupUI(decimals=self.decimals)
self.excellon_exp_group.setMinimumWidth(250)
self.excellon_adv_opt_group = ExcellonAdvOptPrefGroupUI(decimals=self.decimals)
self.excellon_adv_opt_group.setMinimumWidth(250)
self.excellon_editor_group = ExcellonEditorPrefGroupUI(decimals=self.decimals)
self.excellon_editor_group.setMinimumWidth(260)
self.vlay = QtWidgets.QVBoxLayout()
self.vlay.addWidget(self.excellon_opt_group)
self.vlay.addWidget(self.excellon_exp_group)
self.layout.addWidget(self.excellon_gen_group)
self.layout.addLayout(self.vlay)
self.layout.addWidget(self.excellon_adv_opt_group)
self.layout.addWidget(self.excellon_editor_group)
self.layout.addStretch()

View File