open_code()

Opens a G-code program from string that contains G-code.

Syntax

planetcnc.open_code(gcode)

Parameters

Parameter Type Description
gcode str A string containing the G-code to be loaded as a program.

Return Value

Examples

#! /usr/bin/env python 
 
# G-code program string
gcode_program = "G00 X0 Y0\nG01 X100 Y100\nM03"
# Attempt to open the G-code program.
if planetcnc.open_code(gcode_program):
    print("G-code program loaded successfully.")
else:
    print("Failed to load G-code program.")

See also

open_file
open_code
start_file
start_code
test_file
test_code