| 18 | |
| 19 | |
| 20 | class RpmProcessor(LineTransformProcessor): |
| 21 | |
| 22 | def __init__(self): |
| 23 | super(RpmProcessor, self).__init__() |
| 24 | self.is_bundleable = True |
| 25 | self.code_map = { |
| 26 | re.compile('[^(;]*[mM]101'): self._transform_m101, |
| 27 | re.compile('[^(;]*[mM]102'): self._transform_m102, |
| 28 | re.compile('[^(;]*[mM]103'): self._transform_m103, |
| 29 | re.compile('[^(;]*[mM]108'): self._transform_m108, |
| 30 | } |
| 31 | |
| 32 | def _transform_m101(self, match): |
| 33 | """ |
| 34 | Given a line that has an "M101" command, transforms it into |
| 35 | the proper output. |
| 36 | |
| 37 | @param str match: The line to be transformed |
| 38 | @return str: The transformed line |
| 39 | """ |
| 40 | return "" |
| 41 | |
| 42 | def _transform_m102(self, match): |
| 43 | """ |
| 44 | Given a line that has an "M102" command, transforms it into |
| 45 | the proper output. |
| 46 | |
| 47 | @param str match: The line to be transformed |
| 48 | @return str: The transformed line |
| 49 | """ |
| 50 | return "" |
| 51 | |
| 52 | def _transform_m103(self, match): |
| 53 | """ |
| 54 | Given a line that has an "M103" command, transforms it into |
| 55 | the proper output. |
| 56 | |
| 57 | @param str match: The line to be transformed |
| 58 | @return str: The transformed line |
| 59 | """ |
| 60 | return "" |
| 61 | |
| 62 | def _transform_m108(self, match): |
| 63 | """ |
| 64 | Given a line that has an "M108" command, transforms it into |
| 65 | the proper output. |
| 66 | |
| 67 | @param str match: The line to be transformed |
| 68 | @return str: The transformed line |
| 69 | """ |
| 70 | codes, flags, comments = makerbot_driver.Gcode.parse_line(match.string) |
| 71 | #Since were using variable_replace in gcode.utils, we need to make the codes dict |
| 72 | #a dictionary of only strings |
| 73 | string_codes = {} |
| 74 | for key in codes: |
| 75 | string_codes[str(key)] = str(codes[key]) |
| 76 | if 'T' not in codes: |
| 77 | transformed_line = '' |