-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPrintTurbo.py
More file actions
38 lines (30 loc) · 813 Bytes
/
PrintTurbo.py
File metadata and controls
38 lines (30 loc) · 813 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# 3d print turbocharger
# changes all of the extrusion feed gcode speeds
fin = "1x_Portable_Cable_Winder_-_Large_CFS_3_Latch_Spring.gcode"
fout = 'testoutput.gcode'
newspeed = 'F6000'
f = open(fin,'r')
data = f.readlines()
f.close()
print(len(data))
print(data[:10])
newdata = []
for line in data:
skip = False
if line[0] == ';': skip = True
if line[:2] == 'G0': skip = True
if 'Z' in line: skip = True
if 'F' not in line: skip = True
if skip:
newdata.append(line)
continue
secs = line.split(' ')
for i, sec in enumerate(secs):
if "F" != sec[0]: continue
secs[i] = newspeed
newline = ' '.join(secs)
newdata.append(newline)
f = open(fout,'w')
for line in newdata:
f.write(line)
f.close()