Browse Source

some renaming for readability

Wurstnase 10 years ago
parent
commit
2e7ba44633
1 changed files with 7 additions and 7 deletions
  1. 7
    7
      Marlin/scripts/g29_auto.py

+ 7
- 7
Marlin/scripts/g29_auto.py View File

38
 gcode = []
38
 gcode = []
39
 
39
 
40
 
40
 
41
-def found_g1(line):
41
+def has_g1(line):
42
     return line[:2].upper() == "G1"
42
     return line[:2].upper() == "G1"
43
 
43
 
44
 
44
 
45
-def find(line, axis):
45
+def find_axis(line, axis):
46
     found = False
46
     found = False
47
     number = ""
47
     number = ""
48
     for char in line:
48
     for char in line:
66
 def set_mima(line):
66
 def set_mima(line):
67
     global min_x, max_x, min_y, max_y, last_z
67
     global min_x, max_x, min_y, max_y, last_z
68
 
68
 
69
-    current_x = find(line, 'x')
70
-    current_y = find(line, 'y')
69
+    current_x = find_axis(line, 'x')
70
+    current_y = find_axis(line, 'y')
71
 
71
 
72
     if current_x is not None:
72
     if current_x is not None:
73
         min_x = min(current_x, min_x)
73
         min_x = min(current_x, min_x)
81
 
81
 
82
 def find_z(gcode, start_at_line=0):
82
 def find_z(gcode, start_at_line=0):
83
     for i in range(start_at_line, len(gcode)):
83
     for i in range(start_at_line, len(gcode)):
84
-        my_z = find(gcode[i], 'Z')
84
+        my_z = find_axis(gcode[i], 'Z')
85
         if my_z is not None:
85
         if my_z is not None:
86
             return my_z, i
86
             return my_z, i
87
 
87
 
122
             return z_at_line[i - 1], z_at_line[i]
122
             return z_at_line[i - 1], z_at_line[i]
123
 
123
 
124
 
124
 
125
-with open(my_file, 'r') as file:
125
+with open(folder+my_file, 'r') as file:
126
     lines = 0
126
     lines = 0
127
     for line in file:
127
     for line in file:
128
         lines += 1
128
         lines += 1
129
         if lines > 1000:
129
         if lines > 1000:
130
             break
130
             break
131
-        if found_g1(line):
131
+        if has_g1(line):
132
             gcode.append(line)
132
             gcode.append(line)
133
 file.close()
133
 file.close()
134
 
134
 

Loading…
Cancel
Save