-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
E motion letter support for 3D printers #8
Comments
Thanks for the lesson!, The issue is being able to support multiple conflicting variants of the gcode language. Modifying Base G-Code set Registering Language Variants import pygcode
pygcode.set_lang('reprap')
# or
pygcode.set_lang('marlin') That's a bit more work, but I like it. Workaround import pygcode
# Add 'E' parameter to all motion commands
for cls in pygcode.gcodes._subclasses(pygcode.GCodeMotion):
cls.param_letters.add('E')
# Add G29 gcode
class GCodeAutomaticBedLevel(pygcode.GCode):
word_key = pygcode.Word('G', 29)
# Cannot create duplicate codes, so G82 and G83 will be broken Then the code lines = [
'G1 X1 Y2 E3',
'G82',
'G83',
'G29',
]
for line in lines:
print(pygcode.text2gcodes(line)) will give
I doubt passing these into a virtual |
Thanks for raising this issue @revarbat ! |
The variants plan in #9 sounds excellent. One correction, though, is the E axis relative/absolute mode codes are M82 and M83, not G-codes. So, no conflicts with standard GCode, I think. But how does the parser return them? |
oh!, of course, my mistake. # Add M82 / M83 gcodes
class GCodeExtruderAbsoluteMotion(pygcode.GCode):
word_key = pygcode.Word('M', 82)
class GCodeExtruderRelativeMotion(pygcode.GCode):
word_key = pygcode.Word('M', 83) but still, they won't be modal until I've done #9. @revarbat: do you have a pressing need to have this done soon? |
A further problem with 3d printer gcode is that S has other uses and pygcode takes them all as spindle speed changes. Eg |
This is a beautiful library for parsing CNC subtractive process GCode. However, 3D printing, an additive process, uses a slight variant on GCode.
Almost all cheap 3D printers use the E letter to denote extruder motion, such that X, Y, Z and E are motion axes. Yes, it would have been smarter to use the A, B, C, U, V, or W codes instead. Unfortunately E became the standard, and it's too late to do much about that.
In addition:
If there is a way you could at least enable the E motion axis in this library, that'd let me use this library to write a program to visually preview GCode files with PyOpenGL.
The text was updated successfully, but these errors were encountered: