I'm using this script to bring point at specific coordinates to Blender. Then I would like to replace the vertices with objects via Geometry Nodes (Instance on Points node), but in the end I cannot apply the modifier due to error
Evaluated geometry from modifier does not contain a mesh.
How should I fix this?
import bpy
import pathlib
import csv
# file neighbourhood
file_loc = pathlib.Path(__file__).parent.resolve() # this blender file
folder = pathlib.Path(file_loc).parent.resolve() # folder file is in
parent_folder = pathlib.Path(__file__).parents[3] # parent folder, number at end indicates how far up to go
# construct path for data paths
data = pathlib.Path(folder).joinpath('Book1.csv')
# Blender collection for data
data_coll = bpy.data.collections['BIEN 3']
for ob in data_coll.objects:
bpy.data.objects.remove(ob)
vertices = []
edges = []
faces = []
#read csv
with open(data, 'r') as csvfile:
datareader = csv.reader(csvfile)
next(datareader) # skip the first line
i = 0
for row in datareader:
vertices.append((float(row[1]),float(row[0]),float(row[2])))
i+=1
new_mesh = bpy.data.meshes.new('data')
new_mesh.from_pydata(vertices, edges, faces)
new_mesh.update()
new_object = bpy.data.objects.new('data_graph', new_mesh)
data_coll.objects.link(new_object)
Here is my blend file and csv file