jonathanwin / yagv

A fast 3D Gcode Viewer for Reprap-style 3D printers, in Python and OpenGL
73 stars 48 forks source link

G28 arguments not parsed correctly #14

Open Commod0re opened 6 years ago

Commod0re commented 6 years ago

The profile for my i3 MK2 in Slic3r PE uses G28 W in the out of the box, which raises an exception:

Traceback (most recent call last):
  File "/usr/bin/yagv", line 503, in <module>
    App().main()
  File "/usr/bin/yagv", line 42, in main
    self.load(path)
  File "/usr/bin/yagv", line 70, in load
    self.model = parser.parseFile(path)
  File "/usr/lib/yagv/gcodeParser.py", line 22, in parseFile
    self.parseLine()
  File "/usr/lib/yagv/gcodeParser.py", line 45, in parseLine
    getattr(self, "parse_"+code)(args)
  File "/usr/lib/yagv/gcodeParser.py", line 79, in parse_G28
    self.model.do_G28(self.parseArgs(args))
  File "/usr/lib/yagv/gcodeParser.py", line 55, in parseArgs
    coord = float(bit[1:])
ValueError: could not convert string to float:

parseArgs assumes all arguments are in the form [A-Z][0-9]+ for print head movement, but this is not the case for G28. Changing line 79 to self.model.do_G28(args.split()) at least allows it to continue past that point. Otherwise, parseArgs should not assume all arguments are always in that format.

petterreinholdtsen commented 5 years ago

Do you have a test file demonstrating this problem?