param_set()

Sets a parameter in the application's default parameter storage.

This allows the parameter to be stored for later retrieval or manipulation.

You can set only writable parameters.

Syntax

planetcnc.param_set(name, value)

Parameters

Parameter Type Description
name str The name of the parameter to set.
value gloat, int or string The value to assign to the parameter.

Return Value

Examples

#! /usr/bin/env python 
 
import planetcnc
 
# Set a parameter: name 'ping' with value 'pong'
print("Setting parameter 'ping' to 'pong'...")
set_result = planetcnc.param_set("ping", "pong")
print("Parameter set:", set_result)
 
# Retrieve the parameter's value
retrieved_value = planetcnc.param_get("ping")
print("Retrieved parameter 'ping':", retrieved_value)
 
# Perform a 'ping/pong' check by confirming the retrieved value
if retrieved_value == "pong":
    print("Ping/pong check passed.")
else:
    print("Ping/pong check failed.")
 
# Remove the parameter at the end of the test.
remove_result = planetcnc.param_remove("ping")
print("Parameter removed:", remove_result)

See also

param_get
param_set
param_remove
param_persistent