gcode_line_add()

Adds one or more G-code lines to the program's G-code list.

The function takes a variable number of arguments (which are converted to a single string) and splits it into individual G-code lines.

It then attempts to add each line to the G-code line list.

Syntax

planetcnc.gcode_line_add(args)

Parameters

Parameter Type Description
args tuple A tuple of one or more arguments that are converted into a string.

Return Value

Examples

#! /usr/bin/env python 
 
import planetcnc
 
# Add G-code lines from a single string.
# Each line should be separated by a newline character.
result = planetcnc.gcode_line_add("G00 X10 Y10\nG01 X20 Y20\n")
if result:
    print("G-code lines added successfully.")
    planetcnc.gcode_open()
else:
    print("Failed to add some G-code lines.")

See also

gcode_is_ready
gcode_is_opening
gcode_is_running
gcode_close
gcode_open
gcode_load
gcode_line_add_allowed
gcode_line_add