I have created at model that I want to export into CSV file and a txt file (for a quick review).
Using this post (below) I am able to do export the vertex information to and CSV and txt file (by just naming it .csv or .txt). This will output just to location of each point in the format x y z.
How to export Blender spreadsheet data into .csv file without applying GN?
How could this code be modified to include other column found in the table. I have a custom column called G0 and want to export this (and potentially more in the future).
Table below:
Image may be NSFW.
Clik here to view.
Code from link for quick reference:
import bpyimport csvimport osm = bpy.context.object.evaluated_get(bpy.context.evaluated_depsgraph_get()).to_mesh()# Get the path to the current Blender fileblend_file_path = bpy.data.filepath# Get the directory of the Blender fileblend_dir = os.path.dirname(blend_file_path)# Construct the absolute path to the "data.csv" filedata_file_path = os.path.join(blend_dir, "data.csv")def append_to_csv(filepath, x, y, z): # Check if the file exists file_exists = os.path.isfile(filepath) # Open the file in append mode with open(filepath, 'a', newline='') as file: writer = csv.writer(file) # If the file doesn't exist, write the header if not file_exists: writer.writerow(['x', 'y', 'z']) # Write the values to the file writer.writerow([x, y, z])for i in range(0, len(m.vertices)): v = m.vertices[i].co append_to_csv(data_file_path,v[0],v[1],v[2])
I am not very familiar with coding so any help would be greatly appreciated.