MCPcopy Create free account
hub / github.com/FullControlXYZ/fullcontrol / XYZ_gcode

Method XYZ_gcode

fullcontrol/gcode/point.py:8–26  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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 '''

Callers 1

gcodeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected