Skip to content

Commit 5f60630

Browse files
committed
qtplasmac: make feed rate optional for consumable change
1 parent beacb3c commit 5f60630

2 files changed

Lines changed: 13 additions & 14 deletions

File tree

docs/src/plasma/qtplasmac.adoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3387,10 +3387,12 @@ n Code = cut-type
33873387

33883388
Pressing this button moves the torch to the specified coordinates when the machine is paused to allow the user easy access to change the torch consumables.
33893389

3390-
Valid entries are Xnnn Ynnn Fnnn. Feed Rate (F) is mandatory and at least one of the X or Y coordinates are required.
3390+
Valid entries are Xnnn Ynnn Fnnn. At least one of the X or Y coordinates are required, Feed Rate (F) is optional.
33913391

33923392
The X and Y coordinates are in absolute machine coordinates. If X or Y are missing then the current coordinate for that axis will be used.
33933393

3394+
Feed Rate (F) is optional, if it is missing or invalid then the feed rate of the current material will be used.
3395+
33943396
There are three methods to return to the previous coordinates:
33953397

33963398
. Press the *Change Consumables* button again - the torch will return to the original coordinates and the machine will wait in this position for the user to resume the program.

share/qtvcp/screens/qtplasmac/qtplasmac_handler.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3543,7 +3543,7 @@ def user_button_setup(self):
35433543
self.w['button_{}'.format(str(bNum))].setText(bLabel)
35443544
if 'change-consumables' in bCode:
35453545
self.ccParm = bCode.replace('change-consumables','').replace(' ','').lower() or None
3546-
if self.ccParm != None and ('x' in self.ccParm or 'y' in self.ccParm) and 'f' in self.ccParm:
3546+
if self.ccParm != None and ('x' in self.ccParm or 'y' in self.ccParm):
35473547
self.ccButton = 'button_{}'.format(str(bNum))
35483548
self.idleHomedList.append(self.ccButton)
35493549
self.pausedValidList.append(self.ccButton)
@@ -3970,7 +3970,7 @@ def ohmic_probe_enable_changed(self, state):
39703970
self.w[self.otButton].setEnabled(False)
39713971

39723972
def consumable_change_setup(self):
3973-
self.ccXpos = self.ccYpos = self.ccFeed = 'None'
3973+
self.ccXpos = self.ccYpos = self.ccFeed = None
39743974
X = Y = F = ''
39753975
ccAxis = [X, Y, F]
39763976
ccName = ['x', 'y', 'f']
@@ -3996,6 +3996,11 @@ def consumable_change_setup(self):
39963996
self.ccYpos = float(ccAxis[loop])
39973997
elif ccName[loop] == 'f' and ccAxis[loop]:
39983998
self.ccFeed = float(ccAxis[loop])
3999+
if not self.ccFeed or self.ccFeed < 1:
4000+
msg0 = _translate('HandlerClass', 'Invalid feed rate for consumable change')
4001+
msg1 = _translate('HandlerClass', 'Defaulting to materials cut feed rate')
4002+
STATUS.emit('update-machine-log', '{}, {}'.format(msg0, msg1), 'TIME')
4003+
self.ccFeed = float(self.w.cut_feed_rate.text())
39994004

40004005
def ext_change_consumables(self, state):
40014006
if self.ccButton and self.w[self.ccButton].isEnabled():
@@ -4011,31 +4016,23 @@ def change_consumables(self, state):
40114016
self.w[self.ccButton].setEnabled(False)
40124017
else:
40134018
self.consumable_change_setup()
4014-
if self.ccFeed == 'None' or self.ccFeed < 1:
4015-
head = _translate('HandlerClass', 'User Button Error')
4016-
msg0 = _translate('HandlerClass', 'Feed rate for consumable change missing or less than 1')
4017-
msg1 = _translate('HandlerClass', 'Check arguments for "change-consumables" button code in')
4018-
msg2 = _translate('HandlerClass', '.prefs file')
4019-
STATUS.emit('error', linuxcnc.OPERATOR_ERROR, '{}:\n{}\n{}\n{}{}\n'.format(head, msg0, msg1, self.machineName, msg2))
4020-
return
4021-
else:
4022-
hal.set_p('plasmac.xy-feed-rate', str(float(self.ccFeed)))
40234019
self.w.run.setEnabled(False)
40244020
if self.frButton:
40254021
self.w[self.frButton].setEnabled(False)
40264022
self.w.pause.setEnabled(False)
4027-
if self.ccXpos == 'None':
4023+
if not self.ccXpos:
40284024
self.ccXpos = STATUS.get_position()[0][0]
40294025
if self.ccXpos < round(self.xMin, 6) + (10 * self.unitsPerMm):
40304026
self.ccXpos = round(self.xMin, 6) + (10 * self.unitsPerMm)
40314027
elif self.ccXpos > round(self.xMax, 6) - (10 * self.unitsPerMm):
40324028
self.ccXpos = round(self.xMax, 6) - (10 * self.unitsPerMm)
4033-
if self.ccYpos == 'None':
4029+
if not self.ccYpos:
40344030
self.ccYpos = STATUS.get_position()[0][1]
40354031
if self.ccYpos < round(self.yMin, 6) + (10 * self.unitsPerMm):
40364032
self.ccYpos = round(self.yMin, 6) + (10 * self.unitsPerMm)
40374033
elif self.ccYpos > round(self.yMax, 6) - (10 * self.unitsPerMm):
40384034
self.ccYpos = round(self.yMax, 6) - (10 * self.unitsPerMm)
4035+
hal.set_p('plasmac.xy-feed-rate', str(float(self.ccFeed)))
40394036
hal.set_p('plasmac.x-offset', '{:.0f}'.format((self.ccXpos - STATUS.get_position()[0][0]) / hal.get_value('plasmac.offset-scale')))
40404037
hal.set_p('plasmac.y-offset', '{:.0f}'.format((self.ccYpos - STATUS.get_position()[0][1]) / hal.get_value('plasmac.offset-scale')))
40414038
hal.set_p('plasmac.consumable-change', '1')

0 commit comments

Comments
 (0)