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

Method gcode

fullcontrol/gcode/point.py:28–47  ·  view source on GitHub ↗

Process this instance in a list of steps supplied by the designer to generate and return a line of gcode. Args: state (State): The state object containing printer and extruder information. Returns: str: The generated line of gcode.

(self, state)

Source from the content-addressed store, hash-verified

26 return s if s != '' else None
27
28 def gcode(self, state):
29 '''
30 Process this instance in a list of steps supplied by the designer to generate and return a line of gcode.
31
32 Args:
33 state (State): The state object containing printer and extruder information.
34
35 Returns:
36 str: The generated line of gcode.
37
38 '''
39 XYZ_str = self.XYZ_gcode(state.point)
40 if XYZ_str != None: # only write a line of gcode if movement occurs
41 G_str = 'G1 ' if state.extruder.on or state.extruder.travel_format == "G1_E0" else 'G0 '
42 F_str = state.printer.f_gcode(state)
43 E_str = state.extruder.e_gcode(self, state)
44 gcode_str = f'{G_str}{F_str}{XYZ_str}{E_str}'
45 state.printer.speed_changed = False
46 state.point.update_from(self)
47 return gcode_str.strip() # strip the final space

Callers 1

gcodeFunction · 0.45

Calls 4

XYZ_gcodeMethod · 0.95
e_gcodeMethod · 0.80
update_fromMethod · 0.80
f_gcodeMethod · 0.45

Tested by

no test coverage detected