0
$\begingroup$

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

$\endgroup$
6
  • 2
    $\begingroup$ The way your project is constructed, we can't easily test it because it relies on an external file. You should always minimize the problem to reduce such dependencies when asking for help or reporting a bug. That being said, it seems you need to "Realize Instances" (it's a node). $\endgroup$ Commented Jun 23 at 23:22
  • $\begingroup$ Hello and welcome. As Markus has mentioned, the way your project is constructed makes it difficult to test because it relies on an external file. Could you please revise your question to make it a minimal reproducible example? Also reducing the reliance on external files would greatly help us in understanding/troubleshooting the issue. Once revised, we can re-open the question. $\endgroup$
    – Harry McKenzie
    Commented Jun 24 at 1:51
  • $\begingroup$ Yes, a Realize Instances node right before the Group Output node in the node tree should do the trick. The Instance on Points node creates a set of instances (something like "clones") and this is not a real mesh with vertices, edges, and faces. The Realize Instances node converts it. $\endgroup$
    – Blunder
    Commented Jun 24 at 9:24
  • $\begingroup$ Adding a realize instances node make it applicable but the Instandces some how being distor and look so weird compared to the origion instance geometry $\endgroup$ Commented Jun 24 at 10:02
  • $\begingroup$ @CPHooligan Thank you for providing a CSV file. Again I highly recommend you add a simple minimal reproducible example setup blend file so we can better help you. Have you read the link? Minimal meaning remove everything in the project that is not relevant to your issue and make it as simple as possible like making sure everything is at the World Origin for example. I don't understand why your object is so far away from the Origin. $\endgroup$
    – Harry McKenzie
    Commented Jun 24 at 10:42

0

Browse other questions tagged .