fragmuffin / pygcode

GCODE Parser for Python
GNU General Public License v3.0
123 stars 38 forks source link

param_letters with no numbers after parameter do not work #32

Open VisComKreiser opened 2 years ago

VisComKreiser commented 2 years ago

Hey,

i've got gcode lines like:

and if there is no number after the "R", i get the exception GCodeWordStrError : word 'R' value invalid

I have added the classes:

class GCodeParkReturn(GCode):
    """M1013: park/return"""
    word_key = Word('M', 1013)
    word_letter = 'M'
    param_letters = set('R')

class GCodeSwitchExtruder(GCode):
    """T1: switch extruder"""
    word_key = Word('T', 1)
    word_letter = 'T'
    param_letters = set('R')

E.g. T1 R123 does work without an issue with the added "123" after the "R" Is there an option to allow zero parameter values? Maybe I have just missed it.

I'm testing it using text2gcodes('T1 R')

Thanks.

VisComKreiser commented 2 years ago

can it be that this is only possible in RepRap GCode?