RepRapFlavorParser.py 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. # Copyright (c) 2017 Ultimaker B.V.
  2. # Cura is released under the terms of the LGPLv3 or higher.
  3. from . import FlavorParser
  4. # This parser is intented for interpret the RepRap Firmware flavor
  5. class RepRapFlavorParser(FlavorParser.FlavorParser):
  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. ## Set the absolute positioning
  16. # RepRapFlavor code G90 sets position of X, Y, Z to absolute
  17. # For absolute E, M82 is used
  18. def _gCode90(self, position, params, path):
  19. self._is_absolute_positioning = True
  20. return position
  21. ## Set the relative positioning
  22. # RepRapFlavor code G91 sets position of X, Y, Z to relative
  23. # For relative E, M83 is used
  24. def _gCode91(self, position, params, path):
  25. self._is_absolute_positioning = False
  26. return position