Browse Source

calculate bounding box after fixing up spaces

Thomas Buck 1 year ago
parent
commit
4ee95110e5
1 changed files with 4 additions and 4 deletions
  1. 4
    4
      tools/gcode_center_outline.py

+ 4
- 4
tools/gcode_center_outline.py View File

63
             print("File exists: " + f)
63
             print("File exists: " + f)
64
             sys.exit(1)
64
             sys.exit(1)
65
 
65
 
66
+    with open(in_file, 'r') as fi, open(out_tmp_file, 'w') as fo:
67
+        convert_gcode(fi, fo)
68
+
66
     bb = ( None, None, None, None )
69
     bb = ( None, None, None, None )
67
-    with open(in_file, 'r') as f:
70
+    with open(out_tmp_file, 'r') as f:
68
         bb = file_bounding_box(f)
71
         bb = file_bounding_box(f)
69
 
72
 
70
     x_min, x_max, y_min, y_max = bb
73
     x_min, x_max, y_min, y_max = bb
73
     off = ( -x_min + (machine_size[0] - size[0]) / 2.0, -y_min + (machine_size[1] - size[1]) / 2.0 )
76
     off = ( -x_min + (machine_size[0] - size[0]) / 2.0, -y_min + (machine_size[1] - size[1]) / 2.0 )
74
     zero_point = ( -off[0], -off[1] )
77
     zero_point = ( -off[0], -off[1] )
75
 
78
 
76
-    with open(in_file, 'r') as fi, open(out_tmp_file, 'w') as fo:
77
-        convert_gcode(fi, fo)
78
-
79
     with open(out_tmp_file, 'r') as fi, open(out_file, 'w') as fo:
79
     with open(out_tmp_file, 'r') as fi, open(out_file, 'w') as fo:
80
         patch_offset(fi, fo, zero_point)
80
         patch_offset(fi, fo, zero_point)
81
 
81
 

Loading…
Cancel
Save