From 9c139d3ea2439b352eb5fbf9150d8eaf1fe471cb Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Sun, 18 Jul 2021 12:01:41 +0300 Subject: [PATCH] - modified the Geometry UI tools table. Replaced the comboboxes with labels. - Fixed the SolderPaste Plugin regarding the special designation 'SP' job type and 'DN' tool shape - some fixes in the GCode Editor regarding the new changes in the data structure --- CHANGELOG.md | 6 + appEditors/appGCodeEditor.py | 30 +- appGUI/ObjectUI.py | 755 +--------------------------------- appObjects/FlatCAMCNCJob.py | 29 +- appObjects/FlatCAMGeometry.py | 124 ++---- appPlugins/ToolMilling.py | 4 +- appPlugins/ToolSolderPaste.py | 17 +- preprocessors/Paste_1.py | 14 +- 8 files changed, 110 insertions(+), 869 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fa8137b4..3a3e46dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ CHANGELOG for FlatCAM beta ================================================= +18.07.2021 + +- modified the Geometry UI tools table. Replaced the comboboxes with labels. +- Fixed the SolderPaste Plugin regarding the special designation 'SP' job type and 'DN' tool shape +- some fixes in the GCode Editor regarding the new changes in the data structure + 15.07.2021 - updated the Turkish language with the translated strings by Mehmet Kaya diff --git a/appEditors/appGCodeEditor.py b/appEditors/appGCodeEditor.py index 3fcfc07d..e1bd1d99 100644 --- a/appEditors/appGCodeEditor.py +++ b/appEditors/appGCodeEditor.py @@ -184,22 +184,36 @@ class AppGCodeEditor(QtCore.QObject): dia_item = QtWidgets.QTableWidgetItem('%.*f' % (self.decimals, float(dia_value['tooldia']))) - offset_txt = list(str(dia_value['offset'])) + offset_txt = list(str(dia_value['data']['tools_mill_offset_value'])) offset_txt[0] = offset_txt[0].upper() offset_item = QtWidgets.QTableWidgetItem(''.join(offset_txt)) - type_item = QtWidgets.QTableWidgetItem(str(dia_value['data']['job'])) - tool_type_item = QtWidgets.QTableWidgetItem(str(dia_value['data']['tools_mill_shape'])) + + # -------------------- JOB ------------------------------------- # + job_item_options = [_('Roughing'), _('Finishing'), _('Isolation'), _('Polishing')] + try: + job_item_txt = job_item_options[dia_value['data']['tools_mill_job_type']] + except TypeError: + job_item_txt = dia_value['data']['tools_mill_job_type'] + job_item = QtWidgets.QTableWidgetItem(job_item_txt) + + # -------------------- TOOL SHAPE ------------------------------------- # + tool_type_item_options = ["C1", "C2", "C3", "C4", "B", "V"] + try: + tool_shape_item_txt = tool_type_item_options[dia_value['data']['tools_mill_shape']] + except TypeError: + tool_shape_item_txt = dia_value['data']['tools_mill_shape'] + tool_shape_item = QtWidgets.QTableWidgetItem(tool_shape_item_txt) t_id.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) dia_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) offset_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) - type_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) - tool_type_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + job_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + tool_shape_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) self.ui.cnc_tools_table.setItem(row_no, 1, dia_item) # Diameter self.ui.cnc_tools_table.setItem(row_no, 2, offset_item) # Offset - self.ui.cnc_tools_table.setItem(row_no, 3, type_item) # Toolpath Type - self.ui.cnc_tools_table.setItem(row_no, 4, tool_type_item) # Tool Type + self.ui.cnc_tools_table.setItem(row_no, 3, job_item) # Toolpath Type + self.ui.cnc_tools_table.setItem(row_no, 4, tool_shape_item) # Tool Type tool_uid_item = QtWidgets.QTableWidgetItem(str(dia_key)) # ## REMEMBER: THIS COLUMN IS HIDDEN IN OBJECTUI.PY # ## @@ -787,7 +801,7 @@ class AppGCodeEditorUI: self.cnc_tools_table.setColumnCount(6) self.cnc_tools_table.setColumnWidth(0, 20) - self.cnc_tools_table.setHorizontalHeaderLabels(['#', _('GCode'), _('Offset'), _('Type'), _('TT'), '']) + self.cnc_tools_table.setHorizontalHeaderLabels(['#', _('GCode'), _('Offset'), _('Job'), _('Shape'), '']) self.cnc_tools_table.setColumnHidden(5, True) # CNC Tools Table when made out of Excellon diff --git a/appGUI/ObjectUI.py b/appGUI/ObjectUI.py index 95357fb6..11f6e508 100644 --- a/appGUI/ObjectUI.py +++ b/appGUI/ObjectUI.py @@ -996,14 +996,14 @@ class GeometryObjectUI(ObjectUI): self.geo_tools_table.setColumnCount(7) self.geo_tools_table.setColumnWidth(0, 20) - self.geo_tools_table.setHorizontalHeaderLabels(['#', _('Dia'), _('Offset'), _('Type'), _('Shape'), '', 'P']) + self.geo_tools_table.setHorizontalHeaderLabels(['#', _('Dia'), _('Offset'), _('Job'), _('Shape'), '', 'P']) self.geo_tools_table.setColumnHidden(5, True) # stylesheet = "::section{Background-color:rgb(239,239,245)}" # self.geo_tools_table.horizontalHeader().setStyleSheet(stylesheet) self.geo_tools_table.horizontalHeaderItem(0).setToolTip( _( - "This is the Tool Number.\n" + "Tool Number.\n" "When ToolChange is checked, on toolchange event this value\n" "will be showed as a T1, T2 ... Tn") ) @@ -1012,19 +1012,12 @@ class GeometryObjectUI(ObjectUI): "is the cut width into the material.")) self.geo_tools_table.horizontalHeaderItem(2).setToolTip( _( - "The value for the Offset can be:\n" - "- Path -> There is no offset, the tool cut will be done through the geometry line.\n" - "- In(side) -> The tool cut will follow the geometry inside. It will create a 'pocket'.\n" - "- Out(side) -> The tool cut will follow the geometry line on the outside." + "Offset Type. The kind of cut offset to be used." )) self.geo_tools_table.horizontalHeaderItem(3).setToolTip( _( - "The (Operation) Type has only informative value. Usually the UI form values \n" - "are choose based on the operation type and this will serve as a reminder.\n" - "Can be 'Roughing', 'Finishing' or 'Isolation'.\n" - "For Roughing we may choose a lower Feedrate and multiDepth cut.\n" - "For Finishing we may choose a higher Feedrate, without multiDepth.\n" - "For Isolation we need a lower Feedrate as it use a milling bit with a fine tip." + "Job Type. Usually the UI form values \n" + "are choose based on the operation type and this will serve as a reminder." )) self.geo_tools_table.horizontalHeaderItem(4).setToolTip( _("Tool Shape. \n" @@ -1033,740 +1026,8 @@ class GeometryObjectUI(ObjectUI): "B = ball tip milling tool\n" "V = v-shape milling tool")) self.geo_tools_table.horizontalHeaderItem(6).setToolTip( - _( - "Plot column. It is visible only for MultiGeo geometries, meaning geometries that holds the geometry\n" - "data into the tools. For those geometries, deleting the tool will delete the geometry data also,\n" - "so be WARNED. From the checkboxes on each row it can be enabled/disabled the plot on canvas\n" - "for the corresponding tool." - )) - - # # Tool Offset - # grid1 = QtWidgets.QGridLayout() - # self.geo_table_box.addLayout(grid1) - # grid1.setColumnStretch(0, 0) - # grid1.setColumnStretch(1, 1) - # - # self.tool_offset_lbl = FCLabel('%s:' % _('Tool Offset')) - # self.tool_offset_lbl.setToolTip( - # _( - # "The value to offset the cut when \n" - # "the Offset type selected is 'Offset'.\n" - # "The value can be positive for 'outside'\n" - # "cut and negative for 'inside' cut." - # ) - # ) - # self.tool_offset_entry = FCDoubleSpinner(callback=self.confirmation_message) - # self.tool_offset_entry.set_precision(self.decimals) - # self.tool_offset_entry.set_range(-10000.0000, 10000.0000) - # self.tool_offset_entry.setSingleStep(0.1) - # - # grid1.addWidget(self.tool_offset_lbl, 0, 0) - # grid1.addWidget(self.tool_offset_entry, 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) - # - # self.tool_sel_label = FCLabel('%s' % _("Add from DB")) - # grid1.addWidget(self.tool_sel_label, 2, 0, 1, 2) - # - # self.addtool_entry_lbl = FCLabel('%s:' % _('Tool Dia')) - # self.addtool_entry_lbl.setToolTip( - # _("Diameter for the new tool") - # ) - # self.addtool_entry = FCDoubleSpinner(callback=self.confirmation_message) - # self.addtool_entry.set_precision(self.decimals) - # self.addtool_entry.set_range(0.00001, 10000.0000) - # self.addtool_entry.setSingleStep(0.1) - # - # grid1.addWidget(self.addtool_entry_lbl, 3, 0) - # grid1.addWidget(self.addtool_entry, 3, 1) - # - # bhlay = QtWidgets.QHBoxLayout() - # - # self.search_and_add_btn = FCButton(_('Search and Add')) - # self.search_and_add_btn.setIcon(QtGui.QIcon(self.app.resource_location + '/plus16.png')) - # self.search_and_add_btn.setToolTip( - # _("Add a new tool to the Tool Table\n" - # "with the diameter specified above.") - # ) - # - # self.addtool_from_db_btn = FCButton(_('Pick from DB')) - # self.addtool_from_db_btn.setIcon(QtGui.QIcon(self.app.resource_location + '/search_db32.png')) - # self.addtool_from_db_btn.setToolTip( - # _("Add a new tool to the Tool Table\n" - # "from the Tools Database.\n" - # "Tools database administration in in:\n" - # "Menu: Options -> Tools Database") - # ) - # - # bhlay.addWidget(self.search_and_add_btn) - # bhlay.addWidget(self.addtool_from_db_btn) - # - # grid1.addLayout(bhlay, 5, 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) - # - # grid2 = QtWidgets.QGridLayout() - # self.geo_table_box.addLayout(grid2) - # - # self.deltool_btn = FCButton(_('Delete')) - # self.deltool_btn.setIcon(QtGui.QIcon(self.app.resource_location + '/trash16.png')) - # self.deltool_btn.setToolTip( - # _("Delete a selection of tools in the Tool Table\n" - # "by first selecting a row in the Tool Table.") - # ) - # - # grid2.addWidget(self.deltool_btn, 0, 0, 1, 2) - # - # # ########################################################### - # # ############# Create CNC Job ############################## - # # ########################################################### - # self.geo_param_frame = QtWidgets.QFrame() - # self.geo_param_frame.setContentsMargins(0, 0, 0, 0) - # self.geo_tools_box.addWidget(self.geo_param_frame) - # - # self.geo_param_box = QtWidgets.QVBoxLayout() - # self.geo_param_box.setContentsMargins(0, 0, 0, 0) - # self.geo_param_frame.setLayout(self.geo_param_box) - # - # separator_line = QtWidgets.QFrame() - # separator_line.setFrameShape(QtWidgets.QFrame.HLine) - # separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) - # self.geo_param_box.addWidget(separator_line) - # - # # ################################################################# - # # ################# GRID LAYOUT 3 ############################### - # # ################################################################# - # - # self.grid3 = QtWidgets.QGridLayout() - # self.grid3.setColumnStretch(0, 0) - # self.grid3.setColumnStretch(1, 1) - # self.geo_param_box.addLayout(self.grid3) - # - # # ### Tools Data ## ## - # self.tool_data_label = FCLabel( - # "%s: %s %d" % (_('Parameters for'), _("Tool"), int(1))) - # self.tool_data_label.setToolTip( - # _( - # "The data used for creating GCode.\n" - # "Each tool store it's own set of such data." - # ) - # ) - # self.grid3.addWidget(self.tool_data_label, 0, 0, 1, 2) - # - # # Tip Dia - # self.tipdialabel = FCLabel('%s:' % _('V-Tip Dia')) - # self.tipdialabel.setToolTip( - # _( - # "The tip diameter for V-Shape Tool" - # ) - # ) - # self.tipdia_entry = FCDoubleSpinner(callback=self.confirmation_message) - # self.tipdia_entry.set_precision(self.decimals) - # self.tipdia_entry.set_range(0.00001, 10000.0000) - # self.tipdia_entry.setSingleStep(0.1) - # - # self.grid3.addWidget(self.tipdialabel, 1, 0) - # self.grid3.addWidget(self.tipdia_entry, 1, 1) - # - # # Tip Angle - # self.tipanglelabel = FCLabel('%s:' % _('V-Tip Angle')) - # self.tipanglelabel.setToolTip( - # _( - # "The tip angle for V-Shape Tool.\n" - # "In degree." - # ) - # ) - # self.tipangle_entry = FCDoubleSpinner(callback=self.confirmation_message) - # self.tipangle_entry.set_precision(self.decimals) - # self.tipangle_entry.set_range(1.0, 180.0) - # self.tipangle_entry.setSingleStep(1) - # - # self.grid3.addWidget(self.tipanglelabel, 2, 0) - # self.grid3.addWidget(self.tipangle_entry, 2, 1) - # - # # Cut Z - # self.cutzlabel = FCLabel('%s:' % _('Cut Z')) - # self.cutzlabel.setToolTip( - # _( - # "Cutting depth (negative)\n" - # "below the copper surface." - # ) - # ) - # self.cutz_entry = FCDoubleSpinner(callback=self.confirmation_message) - # self.cutz_entry.set_precision(self.decimals) - # - # self.cutz_entry.set_range(-10000.0000, 10000.0000) - # - # self.cutz_entry.setSingleStep(0.1) - # - # self.grid3.addWidget(self.cutzlabel, 3, 0) - # self.grid3.addWidget(self.cutz_entry, 3, 1) - # - # # Multi-pass - # 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(callback=self.confirmation_message) - # self.maxdepth_entry.set_precision(self.decimals) - # self.maxdepth_entry.set_range(0, 10000.0000) - # self.maxdepth_entry.setSingleStep(0.1) - # - # self.maxdepth_entry.setToolTip( - # _( - # "Depth of each pass (positive)." - # ) - # ) - # self.ois_mpass_geo = OptionalInputSection(self.mpass_cb, [self.maxdepth_entry]) - # - # self.grid3.addWidget(self.mpass_cb, 4, 0) - # self.grid3.addWidget(self.maxdepth_entry, 4, 1) - # - # # Travel Z - # self.travelzlabel = FCLabel('%s:' % _('Travel Z')) - # self.travelzlabel.setToolTip( - # _("Height of the tool when\n" - # "moving without cutting.") - # ) - # self.travelz_entry = FCDoubleSpinner(callback=self.confirmation_message) - # self.travelz_entry.set_precision(self.decimals) - # - # if machinist_setting == 0: - # self.travelz_entry.set_range(0.00001, 10000.0000) - # else: - # self.travelz_entry.set_range(-10000.0000, 10000.0000) - # - # self.travelz_entry.setSingleStep(0.1) - # - # self.grid3.addWidget(self.travelzlabel, 5, 0) - # self.grid3.addWidget(self.travelz_entry, 5, 1) - # - # # Feedrate X-Y - # self.frlabel = FCLabel('%s:' % _('Feedrate X-Y')) - # self.frlabel.setToolTip( - # _("Cutting speed in the XY\n" - # "plane in units per minute") - # ) - # self.cncfeedrate_entry = FCDoubleSpinner(callback=self.confirmation_message) - # self.cncfeedrate_entry.set_precision(self.decimals) - # self.cncfeedrate_entry.set_range(0, 910000.0000) - # self.cncfeedrate_entry.setSingleStep(0.1) - # - # self.grid3.addWidget(self.frlabel, 10, 0) - # self.grid3.addWidget(self.cncfeedrate_entry, 10, 1) - # - # # Feedrate Z (Plunge) - # self.frzlabel = FCLabel('%s:' % _('Feedrate Z')) - # self.frzlabel.setToolTip( - # _("Cutting speed in the XY\n" - # "plane in units per minute.\n" - # "It is called also Plunge.") - # ) - # self.feedrate_z_entry = FCDoubleSpinner(callback=self.confirmation_message) - # self.feedrate_z_entry.set_precision(self.decimals) - # self.feedrate_z_entry.set_range(0, 910000.0000) - # self.feedrate_z_entry.setSingleStep(0.1) - # - # self.grid3.addWidget(self.frzlabel, 11, 0) - # self.grid3.addWidget(self.feedrate_z_entry, 11, 1) - # - # # Feedrate rapids - # self.fr_rapidlabel = FCLabel('%s:' % _('Feedrate Rapids')) - # self.fr_rapidlabel.setToolTip( - # _("Cutting speed in the XY plane\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(callback=self.confirmation_message) - # self.feedrate_rapid_entry.set_precision(self.decimals) - # self.feedrate_rapid_entry.set_range(0, 910000.0000) - # self.feedrate_rapid_entry.setSingleStep(0.1) - # - # self.grid3.addWidget(self.fr_rapidlabel, 12, 0) - # self.grid3.addWidget(self.feedrate_rapid_entry, 12, 1) - # # default values is to hide - # self.fr_rapidlabel.hide() - # self.feedrate_rapid_entry.hide() - # - # # Cut over 1st point in path - # self.extracut_cb = FCCheckBox('%s:' % _('Re-cut')) - # self.extracut_cb.setToolTip( - # _("In order to remove possible\n" - # "copper leftovers where first cut\n" - # "meet with last cut, we generate an\n" - # "extended cut over the first cut section.") - # ) - # - # self.e_cut_entry = FCDoubleSpinner(callback=self.confirmation_message) - # self.e_cut_entry.set_range(0, 99999) - # self.e_cut_entry.set_precision(self.decimals) - # self.e_cut_entry.setSingleStep(0.1) - # self.e_cut_entry.setWrapping(True) - # self.e_cut_entry.setToolTip( - # _("In order to remove possible\n" - # "copper leftovers where first cut\n" - # "meet with last cut, we generate an\n" - # "extended cut over the first cut section.") - # ) - # self.grid3.addWidget(self.extracut_cb, 13, 0) - # self.grid3.addWidget(self.e_cut_entry, 13, 1) - # - # # Spindlespeed - # self.spindle_label = FCLabel('%s:' % _('Spindle speed')) - # self.spindle_label.setToolTip( - # _( - # "Speed of the spindle in RPM (optional).\n" - # "If LASER preprocessor is used,\n" - # "this value is the power of laser." - # ) - # ) - # self.cncspindlespeed_entry = FCSpinner(callback=self.confirmation_message_int) - # self.cncspindlespeed_entry.set_range(0, 1000000) - # self.cncspindlespeed_entry.set_step(100) - # - # self.grid3.addWidget(self.spindle_label, 14, 0) - # self.grid3.addWidget(self.cncspindlespeed_entry, 14, 1) - # - # # Dwell - # self.dwell_cb = FCCheckBox('%s:' % _('Dwell')) - # self.dwell_cb.setToolTip( - # _( - # "Pause to allow the spindle to reach its\n" - # "speed before cutting." - # ) - # ) - # self.dwelltime_entry = FCDoubleSpinner(callback=self.confirmation_message) - # self.dwelltime_entry.set_precision(self.decimals) - # self.dwelltime_entry.set_range(0, 10000.0000) - # self.dwelltime_entry.setSingleStep(0.1) - # - # self.dwelltime_entry.setToolTip( - # _("Number of time units for spindle to dwell.") - # ) - # self.ois_dwell_geo = OptionalInputSection(self.dwell_cb, [self.dwelltime_entry]) - # - # self.grid3.addWidget(self.dwell_cb, 15, 0) - # self.grid3.addWidget(self.dwelltime_entry, 15, 1) - # - # # Probe depth - # self.pdepth_label = FCLabel('%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(callback=self.confirmation_message) - # self.pdepth_entry.set_precision(self.decimals) - # self.pdepth_entry.set_range(-10000.0000, 10000.0000) - # self.pdepth_entry.setSingleStep(0.1) - # - # self.grid3.addWidget(self.pdepth_label, 17, 0) - # self.grid3.addWidget(self.pdepth_entry, 17, 1) - # - # self.pdepth_label.hide() - # self.pdepth_entry.setVisible(False) - # - # # Probe feedrate - # self.feedrate_probe_label = FCLabel('%s:' % _("Feedrate Probe")) - # self.feedrate_probe_label.setToolTip( - # _("The feedrate used while the probe is probing.") - # ) - # self.feedrate_probe_entry = FCDoubleSpinner(callback=self.confirmation_message) - # self.feedrate_probe_entry.set_precision(self.decimals) - # self.feedrate_probe_entry.set_range(0.0, 10000.0000) - # self.feedrate_probe_entry.setSingleStep(0.1) - # - # self.grid3.addWidget(self.feedrate_probe_label, 18, 0) - # self.grid3.addWidget(self.feedrate_probe_entry, 18, 1) - # - # self.feedrate_probe_label.hide() - # self.feedrate_probe_entry.setVisible(False) - # - # # ################################################################# - # # ################# GRID LAYOUT 4 ############################### - # # ################################################################# - # - # self.grid4 = QtWidgets.QGridLayout() - # self.grid4.setColumnStretch(0, 0) - # self.grid4.setColumnStretch(1, 1) - # self.geo_param_box.addLayout(self.grid4) - # - # separator_line2 = QtWidgets.QFrame() - # separator_line2.setFrameShape(QtWidgets.QFrame.HLine) - # separator_line2.setFrameShadow(QtWidgets.QFrame.Sunken) - # self.grid4.addWidget(separator_line2, 0, 0, 1, 2) - # - # self.apply_param_to_all = FCButton(_("Apply parameters to all tools")) - # self.apply_param_to_all.setIcon(QtGui.QIcon(self.app.resource_location + '/param_all32.png')) - # self.apply_param_to_all.setToolTip( - # _("The parameters in the current form will be applied\n" - # "on all the tools from the Tool Table.") - # ) - # self.grid4.addWidget(self.apply_param_to_all, 1, 0, 1, 2) - # - # separator_line2 = QtWidgets.QFrame() - # separator_line2.setFrameShape(QtWidgets.QFrame.HLine) - # separator_line2.setFrameShadow(QtWidgets.QFrame.Sunken) - # self.grid4.addWidget(separator_line2, 2, 0, 1, 2) - # - # # General Parameters - # self.gen_param_label = FCLabel('%s' % _("Common Parameters")) - # self.gen_param_label.setToolTip( - # _("Parameters that are common for all tools.") - # ) - # self.grid4.addWidget(self.gen_param_label, 3, 0, 1, 2) - # - # # Tool change Z - # self.toolchangeg_cb = FCCheckBox('%s:' % _("Tool change Z")) - # self.toolchangeg_cb.setToolTip( - # _( - # "Include tool-change sequence\n" - # "in the Machine Code (Pause for tool change)." - # ) - # ) - # self.toolchangez_entry = FCDoubleSpinner(callback=self.confirmation_message) - # self.toolchangez_entry.set_precision(self.decimals) - # self.toolchangez_entry.setToolTip( - # _( - # "Z-axis position (height) for\n" - # "tool change." - # ) - # ) - # - # if machinist_setting == 0: - # self.toolchangez_entry.set_range(0, 10000.0000) - # else: - # self.toolchangez_entry.set_range(-10000.0000, 10000.0000) - # - # self.toolchangez_entry.setSingleStep(0.1) - # self.ois_tcz_geo = OptionalInputSection(self.toolchangeg_cb, [self.toolchangez_entry]) - # - # self.grid4.addWidget(self.toolchangeg_cb, 6, 0) - # self.grid4.addWidget(self.toolchangez_entry, 6, 1) - # - # # The Z value for the start move - # # startzlabel = FCLabel('Start move Z:') - # # startzlabel.setToolTip( - # # "Tool height just before starting the work.\n" - # # "Delete the value if you don't need this feature." - # # - # # ) - # # grid3.addWidget(startzlabel, 8, 0) - # # self.gstartz_entry = FloatEntry() - # # grid3.addWidget(self.gstartz_entry, 8, 1) - # - # # The Z value for the end move - # self.endz_label = FCLabel('%s:' % _('End move Z')) - # self.endz_label.setToolTip( - # _("Height of the tool after\n" - # "the last move at the end of the job.") - # ) - # self.endz_entry = FCDoubleSpinner(callback=self.confirmation_message) - # self.endz_entry.set_precision(self.decimals) - # - # if machinist_setting == 0: - # self.endz_entry.set_range(0, 10000.0000) - # else: - # self.endz_entry.set_range(-10000.0000, 10000.0000) - # - # self.endz_entry.setSingleStep(0.1) - # - # self.grid4.addWidget(self.endz_label, 9, 0) - # self.grid4.addWidget(self.endz_entry, 9, 1) - # - # # End Move X,Y - # endmove_xy_label = FCLabel('%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 = NumericalEvalTupleEntry(border_color='#0069A9') - # self.endxy_entry.setPlaceholderText(_("X,Y coordinates")) - # - # self.grid4.addWidget(endmove_xy_label, 10, 0) - # self.grid4.addWidget(self.endxy_entry, 10, 1) - # - # # preprocessor selection - # pp_label = FCLabel('%s:' % _("Preprocessor")) - # pp_label.setToolTip( - # _("The Preprocessor file that dictates\n" - # "the Machine Code (like GCode, RML, HPGL) output.") - # ) - # self.pp_geometry_name_cb = FCComboBox() - # self.pp_geometry_name_cb.setFocusPolicy(QtCore.Qt.StrongFocus) - # - # self.grid4.addWidget(pp_label, 11, 0) - # self.grid4.addWidget(self.pp_geometry_name_cb, 11, 1) - # - # # self.grid4.addWidget(FCLabel(''), 12, 0, 1, 2) - # - # # ------------------------------------------------------------------------------------------------------------ - # # ------------------------- EXCLUSION AREAS ------------------------------------------------------------------ - # # ------------------------------------------------------------------------------------------------------------ - # - # # Exclusion Areas - # self.exclusion_cb = FCCheckBox('%s' % _("Add exclusion areas")) - # self.exclusion_cb.setToolTip( - # _( - # "Include exclusion areas.\n" - # "In those areas the travel of the tools\n" - # "is forbidden." - # ) - # ) - # self.grid4.addWidget(self.exclusion_cb, 12, 0, 1, 2) - # - # self.exclusion_frame = QtWidgets.QFrame() - # self.exclusion_frame.setContentsMargins(0, 0, 0, 0) - # self.grid4.addWidget(self.exclusion_frame, 14, 0, 1, 2) - # - # self.exclusion_box = QtWidgets.QVBoxLayout() - # self.exclusion_box.setContentsMargins(0, 0, 0, 0) - # self.exclusion_frame.setLayout(self.exclusion_box) - # - # self.exclusion_table = FCTable() - # self.exclusion_box.addWidget(self.exclusion_table) - # self.exclusion_table.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents) - # - # self.exclusion_table.setColumnCount(4) - # self.exclusion_table.setColumnWidth(0, 20) - # self.exclusion_table.setHorizontalHeaderLabels(['#', _('Object'), _('Strategy'), _('Over Z')]) - # - # self.exclusion_table.horizontalHeaderItem(0).setToolTip(_("This is the Area ID.")) - # self.exclusion_table.horizontalHeaderItem(1).setToolTip( - # _("Type of the object where the exclusion area was added.")) - # self.exclusion_table.horizontalHeaderItem(2).setToolTip( - # _("The strategy used for exclusion area. Go around the exclusion areas or over it.")) - # self.exclusion_table.horizontalHeaderItem(3).setToolTip( - # _("If the strategy is to go over the area then this is the height at which the tool will go to avoid the " - # "exclusion area.")) - # - # self.exclusion_table.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) - # - # grid_a1 = QtWidgets.QGridLayout() - # grid_a1.setColumnStretch(0, 0) - # grid_a1.setColumnStretch(1, 1) - # self.exclusion_box.addLayout(grid_a1) - # - # # Chose Strategy - # self.strategy_label = FCLabel('%s:' % _("Strategy")) - # self.strategy_label.setToolTip(_("The strategy followed when encountering an exclusion area.\n" - # "Can be:\n" - # "- Over -> when encountering the area, the tool will go to a set height\n" - # "- Around -> will avoid the exclusion area by going around the area")) - # self.strategy_radio = RadioSet([{'label': _('Over'), 'value': 'over'}, - # {'label': _('Around'), 'value': 'around'}]) - # - # grid_a1.addWidget(self.strategy_label, 1, 0) - # grid_a1.addWidget(self.strategy_radio, 1, 1) - # - # # Over Z - # self.over_z_label = FCLabel('%s:' % _("Over Z")) - # self.over_z_label.setToolTip(_("The height Z to which the tool will rise in order to avoid\n" - # "an interdiction area.")) - # self.over_z_entry = FCDoubleSpinner() - # self.over_z_entry.set_range(0.000, 10000.0000) - # self.over_z_entry.set_precision(self.decimals) - # - # grid_a1.addWidget(self.over_z_label, 2, 0) - # grid_a1.addWidget(self.over_z_entry, 2, 1) - # - # # Button Add Area - # self.add_area_button = FCButton(_('Add Area:')) - # self.add_area_button.setToolTip(_("Add an Exclusion Area.")) - # - # # Area Selection shape - # self.area_shape_radio = RadioSet([{'label': _("Square"), 'value': 'square'}, - # {'label': _("Polygon"), 'value': 'polygon'}]) - # self.area_shape_radio.setToolTip( - # _("The kind of selection shape used for area selection.") - # ) - # - # grid_a1.addWidget(self.add_area_button, 4, 0) - # grid_a1.addWidget(self.area_shape_radio, 4, 1) - # - # h_lay_1 = QtWidgets.QHBoxLayout() - # self.exclusion_box.addLayout(h_lay_1) - # - # # Button Delete All Areas - # self.delete_area_button = FCButton(_('Delete All')) - # self.delete_area_button.setToolTip(_("Delete all exclusion areas.")) - # - # # Button Delete Selected Areas - # self.delete_sel_area_button = FCButton(_('Delete Selected')) - # self.delete_sel_area_button.setToolTip(_("Delete all exclusion areas that are selected in the table.")) - # - # h_lay_1.addWidget(self.delete_area_button) - # h_lay_1.addWidget(self.delete_sel_area_button) - # - # self.ois_exclusion_geo = OptionalHideInputSection(self.exclusion_cb, [self.exclusion_frame]) - # # -------------------------- EXCLUSION AREAS END ------------------------------------------------------------- - # # ------------------------------------------------------------------------------------------------------------ - # - # # Add Polish - # self.polish_cb = FCCheckBox(label=_('Add Polish')) - # self.polish_cb.setToolTip(_( - # "Will add a Paint section at the end of the GCode.\n" - # "A metallic brush will clean the material after milling.")) - # self.polish_cb.setObjectName("g_polish") - # self.grid4.addWidget(self.polish_cb, 15, 0, 1, 2) - # - # # Polish Tool Diameter - # self.polish_dia_lbl = FCLabel('%s:' % _('Tool Dia')) - # self.polish_dia_lbl.setToolTip( - # _("Diameter for the polishing tool.") - # ) - # self.polish_dia_entry = FCDoubleSpinner(callback=self.confirmation_message) - # self.polish_dia_entry.set_precision(self.decimals) - # self.polish_dia_entry.set_range(0.000, 10000.0000) - # self.polish_dia_entry.setObjectName("g_polish_dia") - # - # self.grid4.addWidget(self.polish_dia_lbl, 16, 0) - # self.grid4.addWidget(self.polish_dia_entry, 16, 1) - # - # # Polish Travel Z - # self.polish_travelz_lbl = FCLabel('%s:' % _('Travel Z')) - # self.polish_travelz_lbl.setToolTip( - # _("Height of the tool when\n" - # "moving without cutting.") - # ) - # self.polish_travelz_entry = FCDoubleSpinner(callback=self.confirmation_message) - # self.polish_travelz_entry.set_precision(self.decimals) - # self.polish_travelz_entry.set_range(0.00000, 10000.00000) - # self.polish_travelz_entry.setSingleStep(0.1) - # self.polish_travelz_entry.setObjectName("g_polish_travelz") - # - # self.grid4.addWidget(self.polish_travelz_lbl, 17, 0) - # self.grid4.addWidget(self.polish_travelz_entry, 17, 1) - # - # # Polish Pressure - # self.polish_pressure_lbl = FCLabel('%s:' % _('Pressure')) - # self.polish_pressure_lbl.setToolTip( - # _("Negative value. The higher the absolute value\n" - # "the stronger the pressure of the brush on the material.") - # ) - # self.polish_pressure_entry = FCDoubleSpinner(callback=self.confirmation_message) - # self.polish_pressure_entry.set_precision(self.decimals) - # self.polish_pressure_entry.set_range(-10000.0000, 10000.0000) - # self.polish_pressure_entry.setObjectName("g_polish_pressure") - # - # self.grid4.addWidget(self.polish_pressure_lbl, 18, 0) - # self.grid4.addWidget(self.polish_pressure_entry, 18, 1) - # - # # Polish Margin - # self.polish_margin_lbl = FCLabel('%s:' % _('Margin')) - # self.polish_margin_lbl.setToolTip( - # _("Bounding box margin.") - # ) - # self.polish_margin_entry = FCDoubleSpinner(callback=self.confirmation_message) - # self.polish_margin_entry.set_precision(self.decimals) - # self.polish_margin_entry.set_range(-10000.0000, 10000.0000) - # self.polish_margin_entry.setObjectName("g_polish_margin") - # - # self.grid4.addWidget(self.polish_margin_lbl, 20, 0) - # self.grid4.addWidget(self.polish_margin_entry, 20, 1) - # - # # Polish Overlap - # self.polish_over_lbl = FCLabel('%s:' % _('Overlap')) - # self.polish_over_lbl.setToolTip( - # _("How much (percentage) of the tool width to overlap each tool pass.") - # ) - # self.polish_over_entry = FCDoubleSpinner(suffix='%', callback=self.confirmation_message) - # self.polish_over_entry.set_precision(self.decimals) - # self.polish_over_entry.setWrapping(True) - # self.polish_over_entry.set_range(0.0000, 99.9999) - # self.polish_over_entry.setSingleStep(0.1) - # self.polish_over_entry.setObjectName("g_polish_overlap") - # - # self.grid4.addWidget(self.polish_over_lbl, 22, 0) - # self.grid4.addWidget(self.polish_over_entry, 22, 1) - # - # # Polish Method - # self.polish_method_lbl = FCLabel('%s:' % _('Method')) - # self.polish_method_lbl.setToolTip( - # _("Algorithm for polishing:\n" - # "- Standard: Fixed step inwards.\n" - # "- Seed-based: Outwards from seed.\n" - # "- Line-based: Parallel lines.") - # ) - # - # self.polish_method_combo = FCComboBox2() - # self.polish_method_combo.addItems( - # [_("Standard"), _("Seed"), _("Lines")] - # ) - # self.polish_method_combo.setObjectName('g_polish_method') - # - # self.grid4.addWidget(self.polish_method_lbl, 24, 0) - # self.grid4.addWidget(self.polish_method_combo, 24, 1) - # - # self.polish_dia_lbl.hide() - # self.polish_dia_entry.hide() - # self.polish_pressure_lbl.hide() - # self.polish_pressure_entry.hide() - # self.polish_travelz_lbl.hide() - # self.polish_travelz_entry.hide() - # self.polish_margin_lbl.hide() - # self.polish_margin_entry.hide() - # self.polish_over_lbl.hide() - # self.polish_over_entry.hide() - # self.polish_method_lbl.hide() - # self.polish_method_combo.hide() - # - # self.ois_polish = OptionalHideInputSection( - # self.polish_cb, - # [ - # self.polish_dia_lbl, - # self.polish_dia_entry, - # self.polish_pressure_lbl, - # self.polish_pressure_entry, - # self.polish_travelz_lbl, - # self.polish_travelz_entry, - # self.polish_margin_lbl, - # self.polish_margin_entry, - # self.polish_over_lbl, - # self.polish_over_entry, - # self.polish_method_lbl, - # self.polish_method_combo - # ] - # ) - # - # separator_line2 = QtWidgets.QFrame() - # separator_line2.setFrameShape(QtWidgets.QFrame.HLine) - # separator_line2.setFrameShadow(QtWidgets.QFrame.Sunken) - # self.grid4.addWidget(separator_line2, 26, 0, 1, 2) - # - # # Button - # self.generate_cnc_button = FCButton(_('Generate CNCJob object')) - # self.generate_cnc_button.setIcon(QtGui.QIcon(self.app.resource_location + '/cnc16.png')) - # self.generate_cnc_button.setToolTip('%s.\n%s' % ( - # _("Generate CNCJob object"), - # _( - # "Add / Select at least one tool in the tool-table.\n" - # "Click the # header to select all, or Ctrl + LMB\n" - # "for custom selection of tools."))) - # - # self.generate_cnc_button.setStyleSheet(""" - # QPushButton - # { - # font-weight: bold; - # } - # """) - # self.grid4.addWidget(self.generate_cnc_button, 28, 0, 1, 2) - # - # self.grid4.addWidget(FCLabel(''), 30, 0, 1, 2) + _("Plot column. It is visible only for MultiGeo Geometry objects.\n" + "Enable plot for the selected tool geometry.")) self.grid4 = QtWidgets.QGridLayout() self.grid4.setColumnStretch(0, 0) @@ -2110,7 +1371,7 @@ class CNCObjectUI(ObjectUI): self.cnc_tools_table.setColumnCount(7) self.cnc_tools_table.setColumnWidth(0, 20) - self.cnc_tools_table.setHorizontalHeaderLabels(['#', _('Dia'), _('Offset'), _('Type'), _('TT'), '', _('P')]) + self.cnc_tools_table.setHorizontalHeaderLabels(['#', _('Dia'), _('Offset'), _('Job'), _('Shape'), '', _('P')]) self.cnc_tools_table.setColumnHidden(5, True) # stylesheet = "::section{Background-color:rgb(239,239,245)}" # self.cnc_tools_table.horizontalHeader().setStyleSheet(stylesheet) diff --git a/appObjects/FlatCAMCNCJob.py b/appObjects/FlatCAMCNCJob.py index 4f743a4b..a85d467f 100644 --- a/appObjects/FlatCAMCNCJob.py +++ b/appObjects/FlatCAMCNCJob.py @@ -226,17 +226,30 @@ class CNCJobObject(FlatCAMObj, CNCjob): dia_item = QtWidgets.QTableWidgetItem('%.*f' % (self.decimals, float(dia_value['tooldia']))) - offset_txt = list(str(dia_value['offset'])) + offset_txt = list(str(dia_value['data']['tools_mill_offset_value'])) offset_txt[0] = offset_txt[0].upper() offset_item = QtWidgets.QTableWidgetItem(''.join(offset_txt)) - type_item = QtWidgets.QTableWidgetItem(str(dia_value['data']['job'])) - tool_type_item = QtWidgets.QTableWidgetItem(str(dia_value['data']['tools_mill_shape'])) + + job_item_options = [_('Roughing'), _('Finishing'), _('Isolation'), _('Polishing')] + tool_shape_options = ["C1", "C2", "C3", "C4", "B", "V"] + + try: + job_item_txt = job_item_options[dia_value['data']['tools_mill_job_type']] + except TypeError: + job_item_txt = dia_value['data']['tools_mill_job_type'] + job_item = QtWidgets.QTableWidgetItem(job_item_txt) + + try: + tool_shape_item_txt = tool_shape_options[dia_value['data']['tools_mill_shape']] + except TypeError: + tool_shape_item_txt = dia_value['data']['tools_mill_shape'] + tool_shape_item = QtWidgets.QTableWidgetItem(tool_shape_item_txt) t_id.setFlags(QtCore.Qt.ItemIsEnabled) dia_item.setFlags(QtCore.Qt.ItemIsEnabled) offset_item.setFlags(QtCore.Qt.ItemIsEnabled) - type_item.setFlags(QtCore.Qt.ItemIsEnabled) - tool_type_item.setFlags(QtCore.Qt.ItemIsEnabled) + job_item.setFlags(QtCore.Qt.ItemIsEnabled) + tool_shape_item.setFlags(QtCore.Qt.ItemIsEnabled) # hack so the checkbox stay centered in the table cell # used this: @@ -256,8 +269,8 @@ class CNCJobObject(FlatCAMObj, CNCjob): self.ui.cnc_tools_table.setItem(row_no, 1, dia_item) # Diameter self.ui.cnc_tools_table.setItem(row_no, 2, offset_item) # Offset - self.ui.cnc_tools_table.setItem(row_no, 3, type_item) # Toolpath Type - self.ui.cnc_tools_table.setItem(row_no, 4, tool_type_item) # Tool Type + self.ui.cnc_tools_table.setItem(row_no, 3, job_item) # Job Type + self.ui.cnc_tools_table.setItem(row_no, 4, tool_shape_item) # Tool Shape # ## REMEMBER: THIS COLUMN IS HIDDEN IN OBJECTUI.PY # ## self.ui.cnc_tools_table.setItem(row_no, 5, tool_uid_item) # Tool unique ID) @@ -1301,7 +1314,7 @@ class CNCJobObject(FlatCAMObj, CNCjob): if self.tools: for tooluid_key in self.tools: dia_plot = self.app.dec_format( - float(self.tools[tooluid_key]['data']['tools_mill_tooldia']), + float(self.tools[tooluid_key]['tooldia']), self.decimals ) gcode_parsed = self.tools[tooluid_key]['gcode_parsed'] diff --git a/appObjects/FlatCAMGeometry.py b/appObjects/FlatCAMGeometry.py index 01862309..dabf39d9 100644 --- a/appObjects/FlatCAMGeometry.py +++ b/appObjects/FlatCAMGeometry.py @@ -194,7 +194,7 @@ class GeometryObject(FlatCAMObj, Geometry): # -------------------- ID ------------------------------------------ # tool_id = QtWidgets.QTableWidgetItem('%d' % int(row_idx + 1)) - tool_id.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + tool_id.setFlags(QtCore.Qt.ItemIsEnabled) self.ui.geo_tools_table.setItem(row_idx, 0, tool_id) # Tool name/id # Make sure that the tool diameter when in MM is with no more than 2 decimals. @@ -207,44 +207,31 @@ class GeometryObject(FlatCAMObj, Geometry): self.ui.geo_tools_table.setItem(row_idx, 1, dia_item) # Diameter # -------------------- OFFSET ------------------------------------- # - offset_item = FCComboBox2(policy=False) - offset_item.addItems(self.offset_item_options) - # val = tooluid_value['data']['tools_mill_offset_type'] - # idx = offset_item.findText(val) - idx = int(tooluid_value['data']['tools_mill_offset_type']) - # protection against having this translated or loading a project with translated values - # if idx == -1: - if idx not in [0, 1, 2, 3]: - offset_item.setCurrentIndex(0) - else: - offset_item.setCurrentIndex(idx) - self.ui.geo_tools_table.setCellWidget(row_idx, 2, offset_item) + try: + offset_item_txt = self.offset_item_options[tooluid_value['data']['tools_mill_offset_type']] + except TypeError: + offset_item_txt = tooluid_value['data']['tools_mill_offset_type'] + offset_item = QtWidgets.QTableWidgetItem(offset_item_txt) + offset_item.setFlags(QtCore.Qt.ItemIsEnabled) + self.ui.geo_tools_table.setItem(row_idx, 2, offset_item) # Offset Type # -------------------- JOB ------------------------------------- # - type_item = FCComboBox2(policy=False) - type_item.addItems(self.job_item_options) - # pos = tooluid_value['data']['tools_mill_job_type'] - # idx = type_item.findText(self.job_item_options[pos]) - idx = int(tooluid_value['data']['tools_mill_job_type']) - # protection against having this translated or loading a project with translated values - # if idx == -1: - if idx not in [0, 1, 2, 3]: - type_item.setCurrentIndex(0) - else: - type_item.setCurrentIndex(idx) - self.ui.geo_tools_table.setCellWidget(row_idx, 3, type_item) + try: + job_item_txt = self.job_item_options[tooluid_value['data']['tools_mill_job_type']] + except TypeError: + job_item_txt = tooluid_value['data']['tools_mill_job_type'] + job_item = QtWidgets.QTableWidgetItem(job_item_txt) + job_item.setFlags(QtCore.Qt.ItemIsEnabled) + self.ui.geo_tools_table.setItem(row_idx, 3, job_item) # Job Type # -------------------- TOOL SHAPE ------------------------------------- # - tool_shape_item = FCComboBox2(policy=False) - tool_shape_item.addItems(self.tool_type_item_options) - idx = int(tooluid_value['data']['tools_mill_shape']) - # protection against having this translated or loading a project with translated values - # if idx == -1: - if idx not in range(6): - tool_shape_item.setCurrentIndex(0) - else: - tool_shape_item.setCurrentIndex(idx) - self.ui.geo_tools_table.setCellWidget(row_idx, 4, tool_shape_item) + try: + tool_shape_item_txt = self.tool_type_item_options[tooluid_value['data']['tools_mill_shape']] + except TypeError: + tool_shape_item_txt = tooluid_value['data']['tools_mill_shape'] + tool_shape_item = QtWidgets.QTableWidgetItem(tool_shape_item_txt) + tool_shape_item.setFlags(QtCore.Qt.ItemIsEnabled) + self.ui.geo_tools_table.setItem(row_idx, 4, tool_shape_item) # Tool Shape # -------------------- TOOL UID ------------------------------------- # tool_uid_item = QtWidgets.QTableWidgetItem(str(tooluid_key)) @@ -261,24 +248,11 @@ class GeometryObject(FlatCAMObj, Geometry): plot_item.setChecked(True) self.ui.geo_tools_table.setCellWidget(row_idx, 6, plot_item) - # set an initial value for the OFFSET ENTRY - # try: - # self.ui.tool_offset_entry.set_value(tooluid_value['offset_value']) - # except Exception as e: - # log.error("build_ui() --> Could not set the 'offset_value' key in self.tools. Error: %s" % str(e)) - row_idx += 1 - # make the diameter column editable - # for row in range(row_idx): - # self.ui.geo_tools_table.item(row, 1).setFlags(QtCore.Qt.ItemIsSelectable | - # QtCore.Qt.ItemIsEditable | - # QtCore.Qt.ItemIsEnabled) - - # sort the tool diameter column - # self.ui.geo_tools_table.sortItems(1) - # all the tools are selected by default - # self.ui.geo_tools_table.selectColumn(0) + for row in range(row_idx): + self.ui.geo_tools_table.item(row, 0).setFlags( + self.ui.geo_tools_table.item(row, 0).flags() ^ QtCore.Qt.ItemIsSelectable) self.ui.geo_tools_table.resizeColumnsToContents() self.ui.geo_tools_table.resizeRowsToContents() @@ -294,13 +268,12 @@ class GeometryObject(FlatCAMObj, Geometry): horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.Fixed) horizontal_header.resizeSection(0, 20) horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.Stretch) - # horizontal_header.setColumnWidth(2, QtWidgets.QHeaderView.ResizeToContents) horizontal_header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeToContents) horizontal_header.setSectionResizeMode(3, QtWidgets.QHeaderView.ResizeToContents) horizontal_header.setSectionResizeMode(4, QtWidgets.QHeaderView.Fixed) horizontal_header.resizeSection(4, 40) horizontal_header.setSectionResizeMode(6, QtWidgets.QHeaderView.Fixed) - horizontal_header.resizeSection(4, 17) + horizontal_header.resizeSection(6, 17) # horizontal_header.setStretchLastSection(True) self.ui.geo_tools_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) @@ -313,12 +286,6 @@ class GeometryObject(FlatCAMObj, Geometry): self.ui.geo_tools_table.setMinimumHeight(self.ui.geo_tools_table.getHeight()) self.ui.geo_tools_table.setMaximumHeight(self.ui.geo_tools_table.getHeight()) - # update UI for all rows - useful after units conversion but only if there is at least one row - # row_cnt = self.ui.geo_tools_table.rowCount() - # if row_cnt > 0: - # for r in range(row_cnt): - # self.update_ui(r) - # select only the first tool / row selected_row = 0 try: @@ -543,9 +510,6 @@ class GeometryObject(FlatCAMObj, Geometry): self.tools.update({ self.tooluid: { 'tooldia': self.app.dec_format(float(toold), self.decimals), - 'offset': 'Path', - 'offset_value': 0.0, - 'tool_type': self.tool_type, 'data': new_data, 'solid_geometry': self.solid_geometry } @@ -591,40 +555,8 @@ class GeometryObject(FlatCAMObj, Geometry): # _("Delete"), lambda: self.on_tool_delete(clicked_signal=None, all_tools=None), # icon=QtGui.QIcon(self.app.resource_location + "/trash16.png")) - # ############################################################################################################# - # ############################## EXCLUSION TABLE context menu ################################################# - # ############################################################################################################# - # self.ui.exclusion_table.setupContextMenu() - # self.ui.exclusion_table.addContextMenu( - # _("Delete"), self.on_delete_sel_areas, icon=QtGui.QIcon(self.app.resource_location + "/trash16.png") - # ) - - # Show/Hide Advanced Options - # if self.app.defaults["global_app_level"] == 'b': - # self.ui.level.setText('%s' % _('Basic')) - # - # self.ui.geo_tools_table.setColumnHidden(2, True) - # self.ui.geo_tools_table.setColumnHidden(3, True) - # # self.ui.geo_tools_table.setColumnHidden(4, True) - # self.ui.addtool_entry_lbl.hide() - # self.ui.addtool_entry.hide() - # self.ui.search_and_add_btn.hide() - # self.ui.deltool_btn.hide() - # # self.ui.endz_label.hide() - # # self.ui.endz_entry.hide() - # self.ui.fr_rapidlabel.hide() - # self.ui.feedrate_rapid_entry.hide() - # self.ui.extracut_cb.hide() - # self.ui.e_cut_entry.hide() - # self.ui.pdepth_label.hide() - # self.ui.pdepth_entry.hide() - # self.ui.feedrate_probe_label.hide() - # self.ui.feedrate_probe_entry.hide() - # else: - # self.ui.level.setText('%s' % _('Advanced')) - - self.ui.geo_tools_table.setColumnHidden(2, True) - self.ui.geo_tools_table.setColumnHidden(3, True) + # self.ui.geo_tools_table.setColumnHidden(2, True) + # self.ui.geo_tools_table.setColumnHidden(3, True) # ############################################################################################################# # ##################################### Setting Values######################################################### diff --git a/appPlugins/ToolMilling.py b/appPlugins/ToolMilling.py index 32d6d81e..dbd07359 100644 --- a/appPlugins/ToolMilling.py +++ b/appPlugins/ToolMilling.py @@ -591,7 +591,7 @@ class ToolMilling(AppTool, Excellon): # "tools_mill_milling_type": "drills", # "tools_mill_milling_dia": 0.04, # - # "tools_mill_job_type": 0, # 'Rough' + # "tools_mill_job_type": 0, # 'Roughing' # "tools_mill_polish_margin": 0.0, # "tools_mill_polish_overlap": 10, # "tools_mill_polish_method": _("Standard"), @@ -747,7 +747,7 @@ class ToolMilling(AppTool, Excellon): tool_data['tools_mill_offset_type'] = 'Path' tool_data['tools_mill_offset_value'] = 0.0 - tool_data['tools_mill_job_type'] = 'Rough' + tool_data['tools_mill_job_type'] = 0 #_('Roughing') tool_data['tools_mill_multidepth'] = False tool_data['tools_mill_extracut'] = False diff --git a/appPlugins/ToolSolderPaste.py b/appPlugins/ToolSolderPaste.py index c07e5cf9..3574a19c 100644 --- a/appPlugins/ToolSolderPaste.py +++ b/appPlugins/ToolSolderPaste.py @@ -182,6 +182,10 @@ class SolderPaste(AppTool): "tools_solderpaste_pp": self.ui.pp_combo }) self.set_form_from_defaults() + + for option in self.app.options: + if option.find('tools_') == 0: + self.options[option] = deepcopy(self.app.options[option] ) self.read_form_to_options() self.clear_context_menu() @@ -228,7 +232,7 @@ class SolderPaste(AppTool): obj = self.app.collection.get_active() if obj and obj.kind == 'gerber': obj_name = obj.options['name'] - self.ui.geo_obj_combo.set_value(obj_name) + self.ui.obj_combo.set_value(obj_name) def build_ui(self): """ @@ -531,7 +535,8 @@ class SolderPaste(AppTool): if tool_v == 'tooldia': tool_dias.append(float('%.*f' % (self.decimals, v[tool_v]))) - if float('%.*f' % (self.decimals, tool_dia)) in tool_dias: + # if float('%.*f' % (self.decimals, tool_dia)) in tool_dias: + if self.app.dec_format(tool_dia, self.decimals) in tool_dias: if muted is None: self.app.inform.emit('[WARNING_NOTCL] %s' % _("Cancelled. Tool already in Tool Table.")) self.ui.tools_table.itemChanged.connect(self.on_tool_edit) @@ -790,10 +795,12 @@ class SolderPaste(AppTool): geo_obj.tools[tooluid]['tooldia'] = tool geo_obj.tools[tooluid]['data'] = deepcopy(self.tooltable_tools[tooluid]['data']) geo_obj.tools[tooluid]['solid_geometry'] = [] - geo_obj.tools[tooluid]['data']['tools_mill_offset_type']= 'Path' - geo_obj.tools[tooluid]['data']['tools_mill_offset_value'] = 0.0 geo_obj.tools[tooluid]['type'] = 'SolderPaste' - geo_obj.tools[tooluid]['data']['tools_mill_shape'] = 'DN' + + geo_obj.tools[tooluid]['data']['tools_mill_offset_type']= 0 # 'Path' + geo_obj.tools[tooluid]['data']['tools_mill_offset_value'] = 0.0 + geo_obj.tools[tooluid]['data']['tools_mill_job_type'] = 'SP' #' + geo_obj.tools[tooluid]['data']['tools_mill_shape'] = 'DN' # 'DN' # self.flat_geometry is a list of LinearRings produced by flatten() from the exteriors of the Polygons # We get possible issues if we try to directly use the Polygons, due of possible the interiors, diff --git a/preprocessors/Paste_1.py b/preprocessors/Paste_1.py index b4f8805e..780f2355 100644 --- a/preprocessors/Paste_1.py +++ b/preprocessors/Paste_1.py @@ -17,8 +17,11 @@ class Paste_1(AppPreProcTools): def start_code(self, p): units = ' ' + str(p['units']).lower() - coords_xy = [float(eval(a)) for a in p['xy_toolchange'].split(",") if a != ''] - + if isinstance(p['xy_toolchange'], str): + temp_val = p['xy_toolchange'].replace('[', '').replace(']', '') + coords_xy = [float(eval(a)) for a in temp_val.split(",") if a != ''] + else: + coords_xy = p['xy_toolchange'] gcode = '(This preprocessor is to be used only with the SolderPaste Plugin.)\n\n' xmin = '%.*f' % (p.coords_decimals, p['options']['xmin']) @@ -70,7 +73,12 @@ class Paste_1(AppPreProcTools): def toolchange_code(self, p): z_toolchange = float(p['z_toolchange']) - toolchangexy = [float(eval(a)) for a in p['xy_toolchange'].split(",") if a != ''] + + if isinstance(p['xy_toolchange'], str): + temp_val = p['xy_toolchange'].replace('[', '').replace(']', '') + toolchangexy = [float(eval(a)) for a in temp_val.split(",") if a != ''] + else: + toolchangexy = p['xy_toolchange'] if toolchangexy is not None: x_toolchange = toolchangexy[0]