- added a new method for GCode generation for Geometry objects
- added multiple algorithms for path optimization when generating GCode from an Geometry object beside the original Rtree algorithm: TSA, OR-Tools Basic, OR-Tools metaheuristics - added controls for Geometry object path optimization in Preferences
This commit is contained in:
@@ -246,6 +246,8 @@ class PreferencesUIManager:
|
||||
"geometry_cnctooldia": self.ui.geometry_defaults_form.geometry_gen_group.cnctooldia_entry,
|
||||
"geometry_merge_fuse_tools": self.ui.geometry_defaults_form.geometry_gen_group.fuse_tools_cb,
|
||||
"geometry_plot_line": self.ui.geometry_defaults_form.geometry_gen_group.line_color_entry,
|
||||
"geometry_optimization_type": self.ui.geometry_defaults_form.geometry_gen_group.opt_algorithm_radio,
|
||||
"geometry_search_time": self.ui.geometry_defaults_form.geometry_gen_group.optimization_time_entry,
|
||||
|
||||
# Geometry Options
|
||||
"geometry_cutz": self.ui.geometry_defaults_form.geometry_opt_group.cutz_entry,
|
||||
|
||||
@@ -207,7 +207,7 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI):
|
||||
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"))
|
||||
self.excellon_general_label = QtWidgets.QLabel("<b>%s:</b>" % _("Path Optimization"))
|
||||
grid2.addWidget(self.excellon_general_label, 8, 0, 1, 2)
|
||||
|
||||
self.excellon_optimization_label = QtWidgets.QLabel(_('Algorithm:'))
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from PyQt5 import QtWidgets
|
||||
from PyQt5.QtCore import QSettings
|
||||
|
||||
from appGUI.GUIElements import FCCheckBox, FCSpinner, FCEntry, FCColorEntry
|
||||
from appGUI.GUIElements import FCCheckBox, FCSpinner, FCEntry, FCColorEntry, RadioSet
|
||||
from appGUI.preferences.OptionsGroupUI import OptionsGroupUI
|
||||
|
||||
import gettext
|
||||
@@ -86,25 +86,72 @@ class GeometryGenPrefGroupUI(OptionsGroupUI):
|
||||
separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||
grid0.addWidget(separator_line, 9, 0, 1, 2)
|
||||
|
||||
self.opt_label = QtWidgets.QLabel("<b>%s:</b>" % _("Path Optimization"))
|
||||
grid0.addWidget(self.opt_label, 10, 0, 1, 2)
|
||||
|
||||
self.opt_algorithm_label = QtWidgets.QLabel(_('Algorithm:'))
|
||||
self.opt_algorithm_label.setToolTip(
|
||||
_("This sets the path optimization algorithm.\n"
|
||||
"- Rtre -> Rtree algorithm\n"
|
||||
"- MetaHeuristic -> Google OR-Tools algorithm with\n"
|
||||
"MetaHeuristic Guided Local Path is used. Default search time is 3sec.\n"
|
||||
"- Basic -> Using Google OR-Tools Basic algorithm\n"
|
||||
"- TSA -> Using Travelling Salesman algorithm\n"
|
||||
"\n"
|
||||
"If this control is disabled, then FlatCAM works in 32bit mode and it uses\n"
|
||||
"Travelling Salesman algorithm for path optimization.")
|
||||
)
|
||||
|
||||
self.opt_algorithm_radio = RadioSet(
|
||||
[
|
||||
{'label': _('Rtree'), 'value': 'R'},
|
||||
{'label': _('MetaHeuristic'), 'value': 'M'},
|
||||
{'label': _('Basic'), 'value': 'B'},
|
||||
{'label': _('TSA'), 'value': 'T'}
|
||||
], orientation='vertical', stretch=False)
|
||||
|
||||
grid0.addWidget(self.opt_algorithm_label, 12, 0)
|
||||
grid0.addWidget(self.opt_algorithm_radio, 12, 1)
|
||||
|
||||
self.optimization_time_label = QtWidgets.QLabel('%s:' % _('Duration'))
|
||||
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)
|
||||
|
||||
grid0.addWidget(self.optimization_time_label, 14, 0)
|
||||
grid0.addWidget(self.optimization_time_entry, 14, 1)
|
||||
|
||||
separator_line = QtWidgets.QFrame()
|
||||
separator_line.setFrameShape(QtWidgets.QFrame.HLine)
|
||||
separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||
grid0.addWidget(separator_line, 16, 0, 1, 2)
|
||||
|
||||
# Fuse Tools
|
||||
self.join_geo_label = QtWidgets.QLabel('<b>%s</b>:' % _('Join Option'))
|
||||
grid0.addWidget(self.join_geo_label, 10, 0, 1, 2)
|
||||
grid0.addWidget(self.join_geo_label, 18, 0, 1, 2)
|
||||
|
||||
self.fuse_tools_cb = FCCheckBox(_("Fuse Tools"))
|
||||
self.fuse_tools_cb.setToolTip(
|
||||
_("When checked the joined (merged) object tools\n"
|
||||
"will be merged also but only if they share some of their attributes.")
|
||||
)
|
||||
grid0.addWidget(self.fuse_tools_cb, 11, 0, 1, 2)
|
||||
grid0.addWidget(self.fuse_tools_cb, 20, 0, 1, 2)
|
||||
|
||||
separator_line = QtWidgets.QFrame()
|
||||
separator_line.setFrameShape(QtWidgets.QFrame.HLine)
|
||||
separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||
grid0.addWidget(separator_line, 12, 0, 1, 2)
|
||||
grid0.addWidget(separator_line, 22, 0, 1, 2)
|
||||
|
||||
# Geometry Object Color
|
||||
self.gerber_color_label = QtWidgets.QLabel('<b>%s</b>:' % _('Object Color'))
|
||||
grid0.addWidget(self.gerber_color_label, 13, 0, 1, 2)
|
||||
grid0.addWidget(self.gerber_color_label, 24, 0, 1, 2)
|
||||
|
||||
# Plot Line Color
|
||||
self.line_color_label = QtWidgets.QLabel('%s:' % _('Outline'))
|
||||
@@ -113,8 +160,8 @@ class GeometryGenPrefGroupUI(OptionsGroupUI):
|
||||
)
|
||||
self.line_color_entry = FCColorEntry()
|
||||
|
||||
grid0.addWidget(self.line_color_label, 14, 0)
|
||||
grid0.addWidget(self.line_color_entry, 14, 1)
|
||||
grid0.addWidget(self.line_color_label, 26, 0)
|
||||
grid0.addWidget(self.line_color_entry, 26, 1)
|
||||
|
||||
self.layout.addStretch()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user