Skip to content

Commit 673fd12

Browse files
committed
qtplasmac: fix run from line code restoration
1 parent 62fc84f commit 673fd12

File tree

2 files changed

+57
-52
lines changed

2 files changed

+57
-52
lines changed

lib/python/plasmac/run_from_line.py

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323

2424
def run_from_line_get(file, startLine):
2525
preData,postData,newData,params,material = [],[],[],[],[]
26-
codes = {'g2':'','g4':'','g6':'','g9':'','g9arc':'','d3':'','d2':'','a3':'','x1':'','y1':'','x2':'','y2':''}
26+
codes = {'g2_':'','g4_':'','g6_':'','g9_':'','g9arc':'','d3':'','d2':'','a3':'','x1':'','y1':'','x2':'','y2':''}
2727
codes['last'] = {'feed':'', 'code':''}
28-
codes['move'] = {'isSet':False, 'isG0':False}
28+
codes['move'] = {'isSet':False, 'isG00':False}
2929
codes['spindle'] = {'code':False, 'line':None}
3030
oSub = []
3131
cutComp = False
@@ -46,17 +46,17 @@ def run_from_line_get(file, startLine):
4646
material.append(line.strip())
4747
# find the type of first move
4848
if not codes['move']['isSet'] and not 'g53g0' in line and not 'g20' in line and not 'g21' in line:
49-
if 'g0' in line:
49+
if 'g00' in line:
5050
codes['move']['isSet'] = True
51-
codes['move']['isG0'] = True
51+
codes['move']['isG00'] = True
5252
codes['x2'] = get_rfl_pos(line.strip(), codes['x2'], 'x')
5353
codes['y2'] = get_rfl_pos(line.strip(), codes['y2'], 'y')
54-
if 'g1' in line or 'g2' in line or 'g3' in line:
54+
if 'g01' in line or 'g02' in line or 'g03' in line:
5555
codes['move']['isSet'] = True
56-
codes['move']['isG0'] = False
56+
codes['move']['isG00'] = False
5757
codes['x2'] = get_rfl_pos(line.strip(), codes['x2'], 'x')
5858
codes['y2'] = get_rfl_pos(line.strip(), codes['y2'], 'y')
59-
if 'm3$' in line.replace(' ',''):
59+
if 'm03' in line:# print('SPINDLE FOUND')
6060
if not codes['spindle']['line']:
6161
codes['spindle']['line'] = line.lower().strip()
6262
continue
@@ -81,15 +81,15 @@ def run_from_line_get(file, startLine):
8181
for t1 in ['g20','g21','g40','g41.1','g42.1','g61','g61.1','g64','g90','g90.1','g91','g91.1']:
8282
if t1 in line:
8383
if t1[1] == '2':
84-
codes['g2'] = t1
84+
codes['g2_'] = t1
8585
elif t1[1] == '4':
86-
codes['g4'] = t1
86+
codes['g4_'] = t1
8787
if t1 != 'g40':
8888
cutComp = True
8989
else:
9090
cutComp = False
9191
elif t1[1] == '6':
92-
codes['g6'] = t1
92+
codes['g6_'] = t1
9393
if t1 == 'g64':
9494
tmp = line.split('64')[1]
9595
if tmp[0] == 'p':
@@ -101,34 +101,34 @@ def run_from_line_get(file, startLine):
101101
tmp = tmp[1:]
102102
else:
103103
break
104-
codes['g6'] = 'g64p{}'.format(p)
104+
codes['g6_'] = 'g64p{}'.format(p)
105105
elif t1 == 'g90' and not 'g90.1' in line:
106-
codes['g9'] = 'g90'
106+
codes['g9_'] = 'g90'
107107
elif t1 == 'g91' and not 'g91.1' in line:
108-
codes['g9'] = 'g91'
108+
codes['g9_'] = 'g91'
109109
elif t1 == 'g90.1' in line:
110110
codes['g9arc'] = 'g90.1'
111111
elif t1 == 'g91.1' in line:
112112
codes['g9arc'] = 'g91.1'
113-
if 'g0' in line and not 'g53g0' in line:
113+
if 'g00' in line and not 'g53g00' in line:
114114
codes['last']['code'] = 'g0'
115-
if 'g1' in line:
116-
tmp = line.split('g1')[1]
115+
if 'g01' in line:
116+
tmp = line.split('g01')[1]
117117
if tmp[0] not in '0123456789':
118-
codes['last']['code'] = 'g1'
119-
if 'g2' in line:
120-
tmp = line.split('g2')[1]
118+
codes['last']['code'] = 'g01'
119+
if 'g02' in line:
120+
tmp = line.split('g02')[1]
121121
if tmp[0] not in '0123456789':
122-
codes['last']['code'] = 'g2'
123-
if 'g3' in line:
124-
tmp = line.split('g3')[1]
122+
codes['last']['code'] = 'g02'
123+
if 'g03' in line:
124+
tmp = line.split('g03')[1]
125125
if tmp[0] not in '0123456789':
126-
codes['last']['code'] = 'g3'
126+
codes['last']['code'] = 'g03'
127127
if 'x' in line:
128128
codes['x1'] = get_rfl_pos(line.strip(), codes['x1'], 'x')
129129
if 'y' in line:
130130
codes['y1'] = get_rfl_pos(line.strip(), codes['y1'], 'y')
131-
if 'm3$' in line.replace(' ','') and not codes['spindle']['line']:
131+
if 'm03$' in line.replace(' ','') and not codes['spindle']['line']:
132132
codes['spindle']['line'] = line.strip()
133133
if 'm62p3' in line.replace(' ',''):
134134
codes['d3'] = 'm62p3 (Disable Torch)'
@@ -213,25 +213,25 @@ def run_from_line_set(rflFile, data, leadin, unitsPerMm):
213213
scale = 1
214214
zMax = ''
215215
if unitsPerMm == 1:
216-
if data['codes']['g2'] == 'g20':
216+
if data['codes']['g2_'] == 'g20':
217217
scale = 0.03937
218-
zMax = 'g53 g0z[[#<_ini[axis_z]max_limit> - 5] * 0.03937]'
218+
zMax = 'g53 g00z[[#<_ini[axis_z]max_limit> - 5] * 0.03937]'
219219
else:
220-
zMax = 'g53 g0z[#<_ini[axis_z]max_limit> - 5]'
220+
zMax = 'g53 g00z[#<_ini[axis_z]max_limit> - 5]'
221221
else:
222-
if data['codes']['g2'] == 'g21':
222+
if data['codes']['g2_'] == 'g21':
223223
scale = 25.4
224-
zMax = 'g53 g0z[[#<_ini[axis_z]max_limit> * 25.4] - 5]'
224+
zMax = 'g53 g00z[[#<_ini[axis_z]max_limit> * 25.4] - 5]'
225225
else:
226-
zMax = 'g53 g0z[#<_ini[axis_z]max_limit> - 0.02]'
227-
if data['codes']['g2']:
228-
data['newData'].append(data['codes']['g2'])
229-
if data['codes']['g4']:
230-
data['newData'].append(data['codes']['g4'])
231-
if data['codes']['g6']:
232-
data['newData'].append(data['codes']['g6'])
233-
if data['codes']['g9']:
234-
data['newData'].append(data['codes']['g9'])
226+
zMax = 'g53 g00z[#<_ini[axis_z]max_limit> - 0.02]'
227+
if data['codes']['g2_']:
228+
data['newData'].append(data['codes']['g2_'])
229+
if data['codes']['g4_']:
230+
data['newData'].append(data['codes']['g4_'])
231+
if data['codes']['g6_']:
232+
data['newData'].append(data['codes']['g6_'])
233+
if data['codes']['g9_']:
234+
data['newData'].append(data['codes']['g9_'])
235235
if data['codes']['g9arc']:
236236
data['newData'].append(data['codes']['g9arc'])
237237
data['newData'].append('m52 p1')
@@ -248,8 +248,8 @@ def run_from_line_set(rflFile, data, leadin, unitsPerMm):
248248
data['newData'].append(line)
249249
if data['codes']['last']['feed']:
250250
data['newData'].append(data['codes']['last']['feed'])
251-
# if g0 is not the first motion command after selected line set x and y coordinates
252-
if not data['codes']['move']['isG0']:
251+
# if g00 is not the first motion command after selected line set x and y coordinates
252+
if not data['codes']['move']['isG00']:
253253
if leadin['do']:
254254
error, xL, yL = set_leadin_coordinates(data['codes']['x1'], data['codes']['y1'], scale, leadin['length'], leadin['angle'])
255255
else:
@@ -265,15 +265,15 @@ def run_from_line_set(rflFile, data, leadin, unitsPerMm):
265265
# add all the code from the selected line to the end
266266
for line in data['postData']:
267267
# if we have the first spindle code we don't need it again
268-
if 'm3$' in line.replace(' ','') and data['codes']['spindle']['code']:
268+
if 'm03$' in line.replace(' ','') and data['codes']['spindle']['code']:
269269
data['codes']['spindle']['code'] = False
270270
continue
271-
# if g0 is the first motion command after the selected line
272-
if data['codes']['move']['isG0']:
271+
# if g00 is the first motion command after the selected line
272+
if data['codes']['move']['isG00']:
273273
# if g0 is the current motion command
274-
if 'g0' in line:
274+
if 'g00' in line:
275275
# no need to process a g53g0 command]
276-
if 'g53g0' in line or 'g20' in line or 'g21' in line:
276+
if 'g53g00' in line or 'g20' in line or 'g21' in line:
277277
data['newData'].append(line.strip())
278278
continue
279279
if leadin['do']:
@@ -282,8 +282,8 @@ def run_from_line_set(rflFile, data, leadin, unitsPerMm):
282282
xL = data['codes']['x2']
283283
yL = data['codes']['y2']
284284
data['codes']['spindle']['code'] = set_spindle_start(xL, yL, data['codes']['x2'], data['codes']['y2'], data['codes']['spindle']['line'], data['newData'], True)
285-
# no need to process any more g0 commands
286-
data['codes']['move']['isG0'] = False
285+
# no need to process any more g00 commands
286+
data['codes']['move']['isG00'] = False
287287
continue
288288
data['newData'].append(line.strip())
289289
# create the rfl file
@@ -309,20 +309,20 @@ def set_leadin_coordinates(x, y, scale, length, angle):
309309
def set_spindle_start(xL, yL, x, y, line, newData, reply):
310310
leadIn = {}
311311
if xL != x and yL != y:
312-
newData.append('g0x{}y{}'.format(xL, yL))
312+
newData.append('g00x{}y{}'.format(xL, yL))
313313
leadIn['x'] = x
314314
leadIn['y'] = y
315315
else:
316316
if x and y:
317-
newData.append('g0x{}y{}'.format(x, y))
317+
newData.append('g00x{}y{}'.format(x, y))
318318
elif x:
319-
newData.append('g0x{}'.format(x))
319+
newData.append('g00x{}'.format(x))
320320
elif y:
321-
newData.append('g0y{}'.format(y))
321+
newData.append('g00y{}'.format(y))
322322
if line:
323323
newData.append(line)
324324
if leadIn:
325-
newData.append('g1x{}y{} (leadin)'.format(leadIn['x'], leadIn['y']))
325+
newData.append('g01x{}y{} (leadin)'.format(leadIn['x'], leadIn['y']))
326326
return reply
327327

328328
def get_rfl_pos(line, axisPos, axisLetter):

share/qtvcp/screens/qtplasmac/versions.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ <h2>QtPlasmaC Version History</h2>
3030
</table>
3131
<br>
3232
<!--- ****** ADD NEXT VERSION BELOW THIS LINE ****** --->
33+
<br><b><u>v1.236.293 2023 Oct 17</u></b>
34+
<ul style="margin:0;">
35+
<li>fix removal of temporary materials in run from line</li>
36+
</ul>
37+
3338
<br><b><u>v1.236.292 2023 Oct 09</u></b>
3439
<ul style="margin:0;">
3540
<li>fix 5th axis buttons </li>

0 commit comments

Comments
 (0)