hpgl.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. from FlatCAMPostProc import *
  2. # for Roland Postprocessors it is mandatory for the postprocessor name (python file and class name, both of them must be
  3. # the same) to contain the following keyword, case-sensitive: 'Roland' without the quotes.
  4. class hpgl(FlatCAMPostProc):
  5. coordinate_format = "%.*f"
  6. feedrate_format = '%.1f'
  7. feedrate_rapid_format = '%.1f'
  8. def start_code(self, p):
  9. gcode = 'IN;'
  10. return gcode
  11. def startz_code(self, p):
  12. return ''
  13. def lift_code(self, p):
  14. gcode = 'PU;' + '\n'
  15. return gcode
  16. def down_code(self, p):
  17. gcode = 'PD;' + '\n'
  18. return gcode
  19. def toolchange_code(self, p):
  20. return 'SP%d;' % int(p.tool)
  21. def up_to_zero_code(self, p):
  22. return ''
  23. def position_code(self, p):
  24. return ('PA' + self.coordinate_format + ',' + self.coordinate_format + ';') % \
  25. (p.coords_decimals, p.x, p.coords_decimals, p.y)
  26. def rapid_code(self, p):
  27. return self.position_code(p).format(**p)
  28. def linear_code(self, p):
  29. return self.position_code(p).format(**p)
  30. def end_code(self, p):
  31. gcode = self.position_code(p).format(**p)
  32. return gcode
  33. def feedrate_code(self, p):
  34. return ''
  35. def feedrate_z_code(self, p):
  36. return ''
  37. def feedrate_rapid_code(self, p):
  38. return ''
  39. def spindle_code(self, p):
  40. return ''
  41. def dwell_code(self, p):
  42. return ''
  43. def spindle_stop_code(self,p):
  44. return ''