File name
Commit message
Commit date
2023-09-26
2023-09-26
File name
Commit message
Commit date
File name
Commit message
Commit date
import numpy as np
import pandas as pd
import plotly.graph_objects as go
def parse_gcode(file_path):
movements = []
with open(file_path, 'r') as file:
for line in file:
# (parse the line to extract commands and parameters)
cmd, x, y, z = ... # Simplified for brevity
movements.append((cmd, x, y, z))
return movements
def plot_gcode(movements):
fig, ax = plt.subplots()
x_data, y_data = [], []
for cmd, x, y, z in movements:
if cmd in ['G0', 'G1']:
x_data.append(x)
y_data.append(y)
ax.plot(x_data, y_data)
plt.show()
movements = parse_gcode('path_to_gcode_file.gcode')
plot_gcode(movements)