# Get Point Coordinates generated with Geometry Nodes?

Say you generate some random points using Geometry Nodes, how can you get all those point coordinates using the python api?

The only hint I have is that the point coords are located under Point Cloud in the Spreadsheet Editor.

Basically, I want to use those coordinates for scripting other stuff I can't do with Geometry Nodes yet.

This is a workaround and I hope there is (or will eventually be) an easier way to access point cloud data in the API.

In your GN tree add an Instance on Points node, plug in a Mesh Line or a Points node set to a Count of 1 to get a single vertex at $$(0, 0, 0)$$.

In theory we should be able to access the vertices' geometry but for now the geometry is not "real". We need to realize the instances with a Realize Instances node.

Then, we need to access the evaluated mesh, after the GN modifier has been evaluated. For that we can use the context dependency graph.

import bpy
import numpy as np

depsgraph = bpy.context.evaluated_depsgraph_get()
obj = bpy.context.active_object.evaluated_get(depsgraph)

coords = np.zeros(len(obj.data.vertices) * 3, dtype=float)
obj.data.vertices.foreach_get("co", coords)

print(coords)  # This is a flattened array

coords = coords.reshape(len(obj.data.vertices), 3)

print(coords)  # This is a 3D array



Result :

• i love workaround if they work!! Great job! Jun 10, 2021 at 7:18
• Yeah, hopefully they simplify this so vertex instancing isn't needed, but for now it works so thank you! Jun 10, 2021 at 14:41
• There is a "points to vertices" node, I don't know if there was back in 2021. Dec 8, 2023 at 14:09
• @MarkusvonBroady I don't think it did ! Have you tried if it works without the realize instances trick ? Dec 8, 2023 at 15:23
• @Gorgious I did: blender.stackexchange.com/a/289622/60486 Dec 8, 2023 at 15:53