- fixed a bug in SolderPaste Tool that did not allow to view the GCode
This commit is contained in:
@@ -325,8 +325,7 @@ class ToolCalculator(FlatCAMTool):
|
||||
|
||||
tip_diameter = float(self.tipDia_entry.get_value())
|
||||
|
||||
half_tip_angle = float(self.tipAngle_entry.get_value())
|
||||
half_tip_angle /= 2
|
||||
half_tip_angle = float(self.tipAngle_entry.get_value()) / 2.0
|
||||
|
||||
cut_depth = float(self.cutDepth_entry.get_value())
|
||||
cut_depth = -cut_depth if cut_depth < 0 else cut_depth
|
||||
|
||||
@@ -153,8 +153,10 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
||||
"If it's not successful then the non-copper clearing will fail, too.\n"
|
||||
"- Clear -> the regular non-copper clearing."))
|
||||
|
||||
form = QtWidgets.QFormLayout()
|
||||
self.tools_box.addLayout(form)
|
||||
grid1 = QtWidgets.QGridLayout()
|
||||
self.tools_box.addLayout(grid1)
|
||||
grid1.setColumnStretch(0, 0)
|
||||
grid1.setColumnStretch(1, 1)
|
||||
|
||||
# Milling Type Radio Button
|
||||
self.milling_type_label = QtWidgets.QLabel('%s:' % _('Milling Type'))
|
||||
@@ -172,6 +174,9 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
||||
"- conventional / useful when there is no backlash compensation")
|
||||
)
|
||||
|
||||
grid1.addWidget(self.milling_type_label, 0, 0)
|
||||
grid1.addWidget(self.milling_type_radio, 0, 1)
|
||||
|
||||
# Tool order
|
||||
self.ncc_order_label = QtWidgets.QLabel('<b>%s:</b>' % _('Tool order'))
|
||||
self.ncc_order_label.setToolTip(_("This set the way that the tools in the tools table are used.\n"
|
||||
@@ -191,9 +196,9 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
||||
"WARNING: using rest machining will automatically set the order\n"
|
||||
"in reverse and disable this control."))
|
||||
|
||||
form.addRow(self.milling_type_label, self.milling_type_radio)
|
||||
form.addRow(self.ncc_order_label, self.ncc_order_radio)
|
||||
form.addRow(QtWidgets.QLabel(''))
|
||||
grid1.addWidget(self.ncc_order_label, 1, 0)
|
||||
grid1.addWidget(self.ncc_order_radio, 1, 1)
|
||||
grid1.addWidget(QtWidgets.QLabel(''), 2, 0)
|
||||
|
||||
self.milling_type_label.hide()
|
||||
self.milling_type_radio.hide()
|
||||
@@ -202,7 +207,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
||||
# ############### Tool selection ##############################
|
||||
# #############################################################
|
||||
self.tool_sel_label = QtWidgets.QLabel('<b>%s</b>' % _("Tool Selection"))
|
||||
form.addRow(self.tool_sel_label)
|
||||
grid1.addWidget(self.tool_sel_label, 3, 0, 1, 2)
|
||||
|
||||
# Tool Type Radio Button
|
||||
self.tool_type_label = QtWidgets.QLabel('%s:' % _('Tool Type'))
|
||||
@@ -219,17 +224,8 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
||||
"- 'V-shape'\n"
|
||||
"- Circular")
|
||||
)
|
||||
form.addRow(self.tool_type_label, self.tool_type_radio)
|
||||
|
||||
# ### Add a new Tool ####
|
||||
self.addtool_entry_lbl = QtWidgets.QLabel('<b>%s:</b>' % _('Tool Dia'))
|
||||
self.addtool_entry_lbl.setToolTip(
|
||||
_("Diameter for the new tool to add in the Tool Table")
|
||||
)
|
||||
self.addtool_entry = FCDoubleSpinner()
|
||||
self.addtool_entry.set_precision(self.decimals)
|
||||
|
||||
form.addRow(self.addtool_entry_lbl, self.addtool_entry)
|
||||
grid1.addWidget(self.tool_type_label, 4, 0)
|
||||
grid1.addWidget(self.tool_type_radio, 4, 1)
|
||||
|
||||
# Tip Dia
|
||||
self.tipdialabel = QtWidgets.QLabel('%s:' % _('V-Tip Dia'))
|
||||
@@ -239,7 +235,8 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
||||
self.tipdia_entry.set_precision(self.decimals)
|
||||
self.tipdia_entry.setSingleStep(0.1)
|
||||
|
||||
form.addRow(self.tipdialabel, self.tipdia_entry)
|
||||
grid1.addWidget(self.tipdialabel, 5, 0)
|
||||
grid1.addWidget(self.tipdia_entry, 5, 1)
|
||||
|
||||
# Tip Angle
|
||||
self.tipanglelabel = QtWidgets.QLabel('%s:' % _('V-Tip Angle'))
|
||||
@@ -250,7 +247,38 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
||||
self.tipangle_entry.set_precision(self.decimals)
|
||||
self.tipangle_entry.setSingleStep(5)
|
||||
|
||||
form.addRow(self.tipanglelabel, self.tipangle_entry)
|
||||
grid1.addWidget(self.tipanglelabel, 6, 0)
|
||||
grid1.addWidget(self.tipangle_entry, 6 , 1)
|
||||
|
||||
# Cut Z entry
|
||||
cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
|
||||
cutzlabel.setToolTip(
|
||||
_("Depth of cut into material. Negative value.\n"
|
||||
"In FlatCAM units.")
|
||||
)
|
||||
self.cutz_entry = FCDoubleSpinner()
|
||||
self.cutz_entry.set_precision(self.decimals)
|
||||
self.cutz_entry.set_range(-99999, -0.00000000000001)
|
||||
|
||||
self.cutz_entry.setToolTip(
|
||||
_("Depth of cut into material. Negative value.\n"
|
||||
"In FlatCAM units.")
|
||||
)
|
||||
grid1.addWidget(cutzlabel, 7, 0)
|
||||
grid1.addWidget(self.cutz_entry, 7, 1)
|
||||
|
||||
# ### Tool Diameter ####
|
||||
self.addtool_entry_lbl = QtWidgets.QLabel('<b>%s:</b>' % _('Tool Dia'))
|
||||
self.addtool_entry_lbl.setToolTip(
|
||||
_("Diameter for the new tool to add in the Tool Table.\n"
|
||||
"If the tool is V-shape type then this value is automatically\n"
|
||||
"calculated from the other parameters.")
|
||||
)
|
||||
self.addtool_entry = FCDoubleSpinner()
|
||||
self.addtool_entry.set_precision(self.decimals)
|
||||
|
||||
grid1.addWidget(self.addtool_entry_lbl, 8, 0)
|
||||
grid1.addWidget(self.addtool_entry, 8, 1)
|
||||
|
||||
grid2 = QtWidgets.QGridLayout()
|
||||
self.tools_box.addLayout(grid2)
|
||||
@@ -287,23 +315,6 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
||||
e_lab_1 = QtWidgets.QLabel('<b>%s:</b>' % _("Parameters"))
|
||||
grid3.addWidget(e_lab_1, 0, 0)
|
||||
|
||||
# Cut Z entry
|
||||
cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
|
||||
cutzlabel.setToolTip(
|
||||
_("Depth of cut into material. Negative value.\n"
|
||||
"In FlatCAM units.")
|
||||
)
|
||||
self.cutz_entry = FCDoubleSpinner()
|
||||
self.cutz_entry.set_precision(self.decimals)
|
||||
self.cutz_entry.set_range(-99999, -0.00000000000001)
|
||||
|
||||
self.cutz_entry.setToolTip(
|
||||
_("Depth of cut into material. Negative value.\n"
|
||||
"In FlatCAM units.")
|
||||
)
|
||||
grid3.addWidget(cutzlabel, 1, 0)
|
||||
grid3.addWidget(self.cutz_entry, 1, 1)
|
||||
|
||||
# Overlap Entry
|
||||
nccoverlabel = QtWidgets.QLabel('%s:' % _('Overlap Rate'))
|
||||
nccoverlabel.setToolTip(
|
||||
@@ -535,6 +546,10 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
||||
self.deltool_btn.clicked.connect(self.on_tool_delete)
|
||||
self.generate_ncc_button.clicked.connect(self.on_ncc_click)
|
||||
|
||||
self.tipdia_entry.returnPressed.connect(self.on_calculate_tooldia)
|
||||
self.tipangle_entry.returnPressed.connect(self.on_calculate_tooldia)
|
||||
self.cutz_entry.returnPressed.connect(self.on_calculate_tooldia)
|
||||
|
||||
self.box_combo_type.currentIndexChanged.connect(self.on_combo_box_type)
|
||||
self.reference_radio.group_toggle_fn = self.on_toggle_reference
|
||||
self.ncc_choice_offset_cb.stateChanged.connect(self.on_offset_choice)
|
||||
@@ -551,7 +566,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
||||
def on_add_tool_by_key(self):
|
||||
tool_add_popup = FCInputDialog(title='%s...' % _("New Tool"),
|
||||
text='%s:' % _('Enter a Tool Diameter'),
|
||||
min=0.0000, max=99.9999, decimals=4)
|
||||
min=0.0001, max=9999.9999, decimals=self.decimals)
|
||||
tool_add_popup.setWindowIcon(QtGui.QIcon('share/letter_t_32.png'))
|
||||
|
||||
val, ok = tool_add_popup.get_value()
|
||||
@@ -624,6 +639,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
||||
self.tool_type_radio.set_value(self.app.defaults["tools_ncctool_type"])
|
||||
self.tipdia_entry.set_value(self.app.defaults["tools_ncctipdia"])
|
||||
self.tipangle_entry.set_value(self.app.defaults["tools_ncctipangle"])
|
||||
self.addtool_entry.set_value(self.app.defaults["tools_nccnewdia"])
|
||||
|
||||
self.on_tool_type(val=self.tool_type_radio.get_value())
|
||||
|
||||
@@ -707,11 +723,6 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
||||
# updated units
|
||||
self.units = self.app.ui.general_defaults_form.general_app_group.units_radio.get_value().upper()
|
||||
|
||||
if self.units == "IN":
|
||||
self.addtool_entry.set_value(0.039)
|
||||
else:
|
||||
self.addtool_entry.set_value(1)
|
||||
|
||||
sorted_tools = []
|
||||
for k, v in self.ncc_tools.items():
|
||||
if self.units == "IN":
|
||||
@@ -905,54 +916,50 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
||||
|
||||
def on_tool_type(self, val):
|
||||
if val == 'V':
|
||||
self.addtool_entry_lbl.hide()
|
||||
self.addtool_entry.hide()
|
||||
self.addtool_entry_lbl.setDisabled(True)
|
||||
self.addtool_entry.setDisabled(True)
|
||||
self.tipdialabel.show()
|
||||
self.tipdia_entry.show()
|
||||
self.tipanglelabel.show()
|
||||
self.tipangle_entry.show()
|
||||
else:
|
||||
self.addtool_entry_lbl.show()
|
||||
self.addtool_entry.show()
|
||||
self.addtool_entry_lbl.setDisabled(False)
|
||||
self.addtool_entry.setDisabled(False)
|
||||
self.tipdialabel.hide()
|
||||
self.tipdia_entry.hide()
|
||||
self.tipanglelabel.hide()
|
||||
self.tipangle_entry.hide()
|
||||
|
||||
def on_calculate_tooldia(self):
|
||||
if self.tool_type_radio.get_value() == 'V':
|
||||
tip_dia = float(self.tipdia_entry.get_value())
|
||||
tip_angle = float(self.tipangle_entry.get_value()) / 2.0
|
||||
cut_z = float(self.cutz_entry.get_value())
|
||||
cut_z = -cut_z if cut_z < 0 else cut_z
|
||||
|
||||
# calculated tool diameter so the cut_z parameter is obeyed
|
||||
tool_dia = tip_dia + (2 * cut_z * math.tan(math.radians(tip_angle)))
|
||||
|
||||
# update the default_data so it is used in the ncc_tools dict
|
||||
self.default_data.update({
|
||||
"vtipdia": tip_dia,
|
||||
"vtipangle": (tip_angle * 2),
|
||||
})
|
||||
|
||||
self.addtool_entry.set_value(tool_dia)
|
||||
|
||||
return tool_dia
|
||||
else:
|
||||
return float(self.addtool_entry.get_value())
|
||||
|
||||
def on_tool_add(self, dia=None, muted=None):
|
||||
|
||||
self.ui_disconnect()
|
||||
|
||||
self.units = self.app.ui.general_defaults_form.general_app_group.units_radio.get_value().upper()
|
||||
|
||||
if dia:
|
||||
tool_dia = dia
|
||||
else:
|
||||
if self.tool_type_radio.get_value() == 'V':
|
||||
|
||||
tip_dia = float(self.tipdia_entry.get_value())
|
||||
tip_angle = float(self.tipangle_entry.get_value()) / 2
|
||||
cut_z = float(self.cutz_entry.get_value())
|
||||
|
||||
# calculated tool diameter so the cut_z parameter is obeyed
|
||||
tool_dia = tip_dia + 2 * cut_z * math.tan(math.radians(tip_angle))
|
||||
|
||||
# update the default_data so it is used in the ncc_tools dict
|
||||
self.default_data.update({
|
||||
"vtipdia": tip_dia,
|
||||
"vtipangle": (tip_angle * 2),
|
||||
})
|
||||
else:
|
||||
try:
|
||||
tool_dia = float(self.addtool_entry.get_value())
|
||||
except ValueError:
|
||||
# try to convert comma to decimal point. if it's still not working error message and return
|
||||
try:
|
||||
tool_dia = float(self.addtool_entry.get_value().replace(',', '.'))
|
||||
except ValueError:
|
||||
self.app.inform.emit('[ERROR_NOTCL] %s' % _("Wrong value format entered, use a number."))
|
||||
return
|
||||
|
||||
tool_dia = self.on_calculate_tooldia()
|
||||
if tool_dia is None:
|
||||
self.build_ui()
|
||||
self.app.inform.emit('[WARNING_NOTCL] %s' % _("Please enter a tool diameter to add, in Float format."))
|
||||
|
||||
Reference in New Issue
Block a user