points_set()

Updates the coordinates of an existing point in the program’s point list.

This function sets the point at the given index to a new position provided by either a tuple/list or separate coordinate arguments.

If the new position contains any non-finite values, the point's position is marked as NaN; otherwise, it is updated with the new coordinates.

Syntax

planetcnc.points_set(idx, coord)
planetcnc.points_set(idx, x, y, z)
planetcnc.points_set(idx, x, y, z, a, b, c, u, v, w)

Parameters

Parameter Type Description
idx int The index of the point in the program’s point list.
coord tuple/list Tuple/list of coordinate values.
x, y, z, a, b, c, u, v, w float Coordinate values.

Return Value

Examples

#! /usr/bin/env python 
 
import planetcnc
 
# Example 1: Update a point 3 using a tuple for coordinates.
updated_index = planetcnc.points_set(3, (1.0, 2.0, 3.0))
if updated_index is not None:
    print(f"Point at index {updated_index} updated with new coordinates.")
 
# Example 2: Update a point 5 using separate x, y, z coordinates.
updated_index = planetcnc.points_set(5, 4.0, 5.0, 6.0)
if updated_index is not None:
    print(f"Point at index {updated_index} updated with new coordinates.")
 
# Example 3: Update a point 2 using nine separate coordinate values.
updated_index = planetcnc.points_set(2, 1.0, 2.0, 3.0, 0.1, 0.2, 0.3, 7.0, 8.0, 9.0)
if updated_index is not None:
    print(f"Point at index {updated_index} updated with new coordinates.")

See also

points_clear
points_count
points_add
points_get
points_set
points_delete
points_load
points_save