|
1 | 1 | ''' |
2 | 2 | run_from_line.py |
3 | 3 |
|
4 | | -Copyright (C) 2019, 2020, 2021, 2022 Phillip A Carter |
5 | | -Copyright (C) 2020, 2021, 2022 Gregory D Carl |
| 4 | +Copyright (C) 2019-2024 Phillip A Carter |
| 5 | +Copyright (C) 2020-2024 Gregory D Carl |
6 | 6 |
|
7 | 7 | This program is free software; you can redistribute it and/or modify it |
8 | 8 | under the terms of the GNU General Public License as published by the |
@@ -42,10 +42,9 @@ def run_from_line_get(file, startLine): |
42 | 42 | newData.append('G21') |
43 | 43 | elif 'G20' in line: |
44 | 44 | newData.append('G20') |
45 | | - if line.strip().startswith('M66P3'): |
46 | | - material.append(line.strip()) |
47 | 45 | # find the type of first move |
48 | | - if not codes['move']['isSet'] and not 'G53G0' in line and not 'G20' in line and not 'g21' in line: |
| 46 | + ''' IT IS POSSIBLE THERE MAY BE SPACES IN THE INCOMING LINE ''' |
| 47 | + if not codes['move']['isSet'] and not 'G53G0' in line.replace(' ','') and not 'G20' in line and not 'G21' in line: |
49 | 48 | if 'G00' in line: |
50 | 49 | codes['move']['isSet'] = True |
51 | 50 | codes['move']['isG00'] = True |
@@ -89,21 +88,7 @@ def run_from_line_get(file, startLine): |
89 | 88 | else: |
90 | 89 | cutComp = False |
91 | 90 | elif t1[1] == '6': |
92 | | - codes['g6_'] = t1 |
93 | | - if t1 == 'G64': |
94 | | - tmp = line.split('64')[1].strip() |
95 | | - if tmp[0] == 'P': |
96 | | - p = '' |
97 | | - tmp = tmp[1:] |
98 | | - while 1: |
99 | | - if not tmp: |
100 | | - break |
101 | | - elif tmp[0] in '.0123456789Q': |
102 | | - p += tmp[0] |
103 | | - tmp = tmp[1:] |
104 | | - else: |
105 | | - break |
106 | | - codes['g6_'] = 'G64P{}'.format(p) |
| 91 | + codes['g6_'] = t1 + line.split(t1)[1] |
107 | 92 | elif t1 == 'G90' and not 'G90.1' in line: |
108 | 93 | codes['g9_'] = 'G90' |
109 | 94 | elif t1 == 'G91' and not 'G91.1' in line: |
@@ -133,44 +118,43 @@ def run_from_line_get(file, startLine): |
133 | 118 | if 'M03$' in line.replace(' ','') and not codes['spindle']['line']: |
134 | 119 | codes['spindle']['line'] = line.strip() |
135 | 120 | if 'M62P3' in line.replace(' ',''): |
136 | | - codes['d3'] = 'M62P3 (Disable Torch)' |
| 121 | + codes['d3'] = 'M62 P3 (Disable Torch)' |
137 | 122 | elif 'M63P3' in line.replace(' ',''): |
138 | | - codes['d3'] = 'M63P3 (Enable Torch)' |
| 123 | + codes['d3'] = 'M63 P3 (Enable Torch)' |
139 | 124 | elif 'M64P3' in line.replace(' ',''): |
140 | | - codes['d3'] = 'M64P3 (Disable Torch)' |
| 125 | + codes['d3'] = 'M64 P3 (Disable Torch)' |
141 | 126 | elif 'M65P3' in line.replace(' ',''): |
142 | | - codes['d3'] = 'M65P3 (Enable Torch)' |
| 127 | + codes['d3'] = 'M65 P3 (Enable Torch)' |
143 | 128 | if 'M62P2' in line.replace(' ',''): |
144 | | - codes['d2'] = 'M62P2 (Disable THC)' |
| 129 | + codes['d2'] = 'M62 P2 (Disable THC)' |
145 | 130 | elif 'M63P2' in line.replace(' ',''): |
146 | | - codes['d2'] = 'M63P2 (Enable THC)' |
| 131 | + codes['d2'] = 'M63 P2 (Enable THC)' |
147 | 132 | elif 'M64P2' in line.replace(' ',''): |
148 | | - codes['d2'] = 'M64P2 (Disable THC)' |
| 133 | + codes['d2'] = 'M64 P2 (Disable THC)' |
149 | 134 | elif 'M65P2' in line.replace(' ',''): |
150 | | - codes['d2'] = 'M65P2 (Enable THC)' |
| 135 | + codes['d2'] = 'M65 P2 (Enable THC)' |
151 | 136 | if 'M67E3Q' in line.replace(' ',''): |
152 | | - codes['a3'] = 'M67E3Q' |
| 137 | + codes['a3'] = 'M67 E3 Q' |
153 | 138 | tmp = line.replace(' ','').split('M67E3Q')[1] |
154 | 139 | while 1: |
155 | 140 | if tmp[0] in '-.0123456789': |
156 | 141 | codes['a3'] += tmp[0] |
157 | 142 | tmp = tmp[1:] |
158 | 143 | else: |
159 | 144 | break |
160 | | - pc = float(codes['a3'].split('M67E3Q')[1]) |
| 145 | + pc = float(codes['a3'].split('M67 E3 Q')[1]) |
161 | 146 | pc = pc if pc > 0 else 100 |
162 | 147 | codes['a3'] += ' (Velocity {}%)'.format(pc) |
163 | 148 | if 'M68E3Q' in line.replace(' ',''): |
164 | | - codes['a3'] = 'M68E3Q' |
| 149 | + codes['a3'] = 'M68 E3 Q' |
165 | 150 | tmp = line.replace(' ','').split('M68E3Q')[1] |
166 | | - bb=1 |
167 | 151 | while 1: |
168 | 152 | if tmp[0] in '-.0123456789': |
169 | 153 | codes['a3'] += tmp[0] |
170 | 154 | tmp = tmp[1:] |
171 | 155 | else: |
172 | 156 | break |
173 | | - pc = float(codes['a3'].split('M68E3Q')[1]) |
| 157 | + pc = float(codes['a3'].split('M68 E3 Q')[1]) |
174 | 158 | pc = pc if pc > 0 else 100 |
175 | 159 | codes['a3'] += ' (Velocity {}%)'.format(pc) |
176 | 160 | # test if inside a subroutine |
|
0 commit comments