Loading...
Loading...
Compare original and translation side by side
grep "M117" file.gcodegrep "M117" file.gcodegrep -E "^G1.*X.*Y" file.gcode | sed 's/.*X\([0-9.-]*\).*Y\([0-9.-]*\).*/\1 \2/'grep -E "^G1.*X.*Y" file.gcode | sed 's/.*X\([0-9.-]*\).*Y\([0-9.-]*\).*/\1 \2/'import re
import matplotlib.pyplot as plt
def extract_coordinates(gcode_file, section_filter=None):
coords = []
in_section = section_filter is None
with open(gcode_file, 'r') as f:
for line in f:
if section_filter and section_filter in line:
in_section = True
if in_section:
match = re.search(r'G1.*X([\d.-]+).*Y([\d.-]+)', line)
if match:
coords.append((float(match.group(1)), float(match.group(2))))
return coords
coords = extract_coordinates('file.gcode')
if coords:
x, y = zip(*coords)
plt.figure(figsize=(15, 5))
plt.plot(x, y, 'b-', linewidth=0.5)
plt.scatter(x, y, s=1, c='red')
plt.axis('equal')
plt.title('GCODE Toolpath')
plt.savefig('toolpath.png', dpi=150)
plt.show()import re
import matplotlib.pyplot as plt
def extract_coordinates(gcode_file, section_filter=None):
coords = []
in_section = section_filter is None
with open(gcode_file, 'r') as f:
for line in f:
if section_filter and section_filter in line:
in_section = True
if in_section:
match = re.search(r'G1.*X([\d.-]+).*Y([\d.-]+)', line)
if match:
coords.append((float(match.group(1)), float(match.group(2))))
return coords
coords = extract_coordinates('file.gcode')
if coords:
x, y = zip(*coords)
plt.figure(figsize=(15, 5))
plt.plot(x, y, 'b-', linewidth=0.5)
plt.scatter(x, y, s=1, c='red')
plt.axis('equal')
plt.title('GCODE Toolpath')
plt.savefig('toolpath.png', dpi=150)
plt.show()flag{...}flag{...}flag{...}CTF{...}flag{...}CTF{...}