RepRapFlavorParser.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. # Copyright (c) 2018 Ultimaker B.V.
  2. # Cura is released under the terms of the LGPLv3 or higher.
  3. from . import FlavorParser
  4. class RepRapFlavorParser(FlavorParser.FlavorParser):
  5. """This parser is intended to interpret the RepRap Firmware g-code flavor."""
  6. def __init__(self):
  7. super().__init__()
  8. def processMCode(self, M, line, position, path):
  9. if M == 82:
  10. # Set absolute extrusion mode
  11. self._is_absolute_extrusion = True
  12. elif M == 83:
  13. # Set relative extrusion mode
  14. self._is_absolute_extrusion = False
  15. def _gCode90(self, position, params, path):
  16. """Set the absolute positioning
  17. RepRapFlavor code G90 sets position of X, Y, Z to absolute
  18. For absolute E, M82 is used
  19. """
  20. self._is_absolute_positioning = True
  21. return position
  22. def _gCode91(self, position, params, path):
  23. """Set the relative positioning
  24. RepRapFlavor code G91 sets position of X, Y, Z to relative
  25. For relative E, M83 is used
  26. """
  27. self._is_absolute_positioning = False
  28. return position