Commit 98bdfdb5 authored by Guillaume Seguin's avatar Guillaume Seguin

Add better demo to gcview

parent a6df2a28
...@@ -506,7 +506,21 @@ if __name__ == "__main__": ...@@ -506,7 +506,21 @@ if __name__ == "__main__":
app = wx.App(redirect = False) app = wx.App(redirect = False)
build_dimensions = [200, 200, 100, 0, 0, 0] build_dimensions = [200, 200, 100, 0, 0, 0]
frame = GcodeViewFrame(None, wx.ID_ANY, 'Gcode view, shift to move view, mousewheel to set layer', size = (400, 400), build_dimensions = build_dimensions) frame = GcodeViewFrame(None, wx.ID_ANY, 'Gcode view, shift to move view, mousewheel to set layer', size = (400, 400), build_dimensions = build_dimensions)
frame.addfile(gcoder.GCode(open(sys.argv[1]))) gcode = gcoder.GCode(open(sys.argv[1]))
frame.addfile(gcode)
nsteps = 20
steptime = 500
lines = [gcode.lines[i*(len(gcode.lines)-1)/nsteps] for i in range(nsteps + 1)]
current_line = 0
def setLine():
global current_line
frame.set_current_gline(lines[current_line])
current_line = (current_line + 1) % len(lines)
timer.Start()
timer = wx.CallLater(steptime, setLine)
timer.Start()
frame.Show(True) frame.Show(True)
app.MainLoop() app.MainLoop()
app.Destroy() app.Destroy()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment