How to change point cloud data using python?


I have several questions:
1/ How can we define an exact number of point using point cloud ?

2/ How can we access data from point cloud using python, to change each point location ?

3/ How to drive material using point data ?

Thank you !

Maybe my question is not that clear and I should simplify it to the most important for me now,

How can I assign to each individual point from the “distribute points on faces” a position according to a file I read in python (a csv with x and y position)

import bpy
import random

mesh =["Cube"]
# your data should be under the form (x1, y1, z1, x2, y2, z2, ... , xn, yn, zn)
# Here I'll initialize a random array of 3 * verts (3 floats per vert for its coordinates)
verts = len(mesh.vertices)
locations = [random.random() for i in range(3 * verts)]
mesh.vertices.foreach_set("co", locations)

For the attribute :

attr ="material", type="FLOAT", domain="POINT")
attrs = [random.random() for i in range(verts)]"value", attrs)

Result :
GN tree :

Shader tree :

Viewport (Cycles only) :


1 Like