0

I'm trying to export the XYZ values from Raycast Geometry Nodes to a txt or csv. The output socket Hit Position, I know is a vector, but I can't access the coordinates of every hit position. How do I go about this issue?

Raycast GeoNode

This is the closest I get to achieve the data I need:

print(bpy.data.node_groups["Lidar"].nodes["Raycast"].outputs[1])
Harry McKenzie
  • 10,995
  • 8
  • 23
  • 51
  • Does this answer your question? Accessing Geometry Nodes mesh data from Python In your particular case: set position to the Hit Position, then in Python read the positions of vertices of the evaluated data. – Markus von Broady Aug 28 '23 at 16:23
  • is the issue that you are only getting one value instead of a vector or is it that you are only getting one vector, when you want one for each point? – shmuel Aug 28 '23 at 17:15
  • @MarkusvonBroady helped a lot, but i need every vertice position, with this one all i have is the number of vertices, not the position:

    from bpy import context as C dg = C.evaluated_depsgraph_get() ev = C.object.evaluated_get(dg) print("Evaluated Verts:", len(C.object.evaluated_get(dg).data.vertices))

    that's what i've tried, can i get the positions of every vertice? thanks for the help

    – leocfranz Aug 28 '23 at 19:26
  • @shmuel i want one for each point, is that possible? – leocfranz Aug 28 '23 at 19:28
  • @leocfranz each vertex has co attribute with a position vector. So e.g. print(*(v.co for v in C.object.evaluated_get(dg).data.vertices), sep="\n") – Markus von Broady Aug 28 '23 at 19:35
  • 1
    @MarkusvonBroady Thank you so much, it worked, you saved my day!! – leocfranz Aug 28 '23 at 19:39
  • @leocfranz I was gonna say that you'd probably need a for-loop or something like that to go through all the vertices, but seems like Markus already said it. – shmuel Aug 29 '23 at 06:03

0 Answers0