Generate XYZ gcode string to move from a point p to this point. Args: p (Point): The point to move from. Returns: str: The XYZ gcode string.
(self, p)
| 6 | 'Extend generic class with gcode methods to convert the object to gcode' |
| 7 | |
| 8 | def XYZ_gcode(self, p) -> float: |
| 9 | ''' |
| 10 | Generate XYZ gcode string to move from a point p to this point. |
| 11 | |
| 12 | Args: |
| 13 | p (Point): The point to move from. |
| 14 | |
| 15 | Returns: |
| 16 | str: The XYZ gcode string. |
| 17 | |
| 18 | ''' |
| 19 | s = '' |
| 20 | if self.x != None and self.x != p.x: |
| 21 | s += f'X{self.x:.6f}'.rstrip('0').rstrip('.') + ' ' |
| 22 | if self.y != None and self.y != p.y: |
| 23 | s += f'Y{self.y:.6f}'.rstrip('0').rstrip('.') + ' ' |
| 24 | if self.z != None and self.z != p.z: |
| 25 | s += f'Z{self.z:.6f}'.rstrip('0').rstrip('.') + ' ' |
| 26 | return s if s != '' else None |
| 27 | |
| 28 | def gcode(self, state): |
| 29 | ''' |