A Script to Import a CSV File and Create Meshes (for Blender 2.5x or later)

What is CSV Mesh Importer?
This is a Python script for Blender 2.5x or later and it imports a CSV file into Blender and creates meshes, such as vertices, edges and faces. The image below shows the UI of CSV Mesh Importer and imported meshes of a sine-curved line and a rectangle surface in 3D View window. Please watch the video to get the idea of what the script can do for your artwork.
http://2.bp.blogspot.com/-RduQo-BvJEc/TXyvJ_hI6tI/AAAAAAAAAyk/lsTl9FjXfJI/s300/00109.jpg http://1.bp.blogspot.com/-cOia17uw1YY/TXyvJzpn9UI/AAAAAAAAAys/yZta73wWDVs/s300/00108.jpg

Name:
CSV Mesh Importer v0.7 alpha4

Download:
csv_mesh_importer v0_7_alpha4.zip
(It is being developed in SourceForge.net)

Requirements:
CSV Mesh Importer works as a plugin on Blender 2.5x or later. I confirmed it works well on Blender 2.74.

Features:

  • Be able to import a CSV file and create meshes, such as vertices, edges and faces.
  • Be able to import two types of CSV files. (point list containing X, Y, Z columns and X-Y point 2D table (matrix))
  • Not Yet : Be able to import with more detailed settings of gains, bias, …etc.
  • Not Yet : Be able to import automatically without setting in the UI.

How to Start to Use Most Easily:
If you want to know how to use quickly, it would be the fastest way to see this video tutorial. Also you can read the instruction below.

— Installing Plugin —

    1. Download a file csv_mesh_importer v0_7_alpha4.zip from “Download:” link above. Then unzip it and make sure a file csv_mesh_importer.py is created.
    1. Close Blender if it’s running.
    1. Put the file csv_mesh_importer.py to “%BlenderInstalledAddress%\Blender%Version%\scripts\addons”. (%BlenderInstalledAddress% means the address in which Blender is installed. %Version% means Blender’s version number like 2.74.)
    1. Start Blender.
    1. From the top menu, select “File -> User Preferences…” to see Blender User Preferences window.
    1. In the left list, select “Import-Export” item and you’ll find “Import-Export: CSV Mesh Importer” in the right list.
    1. Click the check box of “Import-Export: CSV Mesh Importer” and make sure a check mark is placed.
    1. Click “Save As Default” button to keep this setting.

— Importing a CSV File Containing the Point List of X, Y, Z Columns —

    1. Find the UI of CSV Mesh Importer in Scene panel.
    1. Specify “Point list containing X, Y, Z columns” in “File Type” menu.
    1. Select a CSV file in “.csv File Path:” file selection box. For example, use “Sample\1_Sample_PointList.csv” in the .zip file.
    1. Click “Add” button and you’ll see a configuration box below.
    1. Specify “Mesh Type” menu, for example “Create vertices and edges (single line)”.
    1. Specify “X Column:” number, for example 0.
    1. Specify “Y Column:” number, for example 1.
    1. Specify “Z Column:” number, for example 2.
    1. Specify “Object Name:” text box, for example “Imported”.
    1. Click “Import” button.
    1. You’ll see an imported mesh of a line in 3D View window.

http://1.bp.blogspot.com/-CvPXrW-NFKs/TzYGSw6QkpI/AAAAAAAAAA0/zaS_I3EV4JM/s600/00176.jpg

https://lh4.googleusercontent.com/-Z6UjtwncC3k/TYCX8uOdqgI/AAAAAAAAAzI/nnwlVQMZ_nw/s1600/00113.jpg http://2.bp.blogspot.com/-RduQo-BvJEc/TXyvJ_hI6tI/AAAAAAAAAyk/lsTl9FjXfJI/s300/00109.jpg

— Parameters Explanations —

  • “File Type” menu means what kind of format the CSV file has. You can import two types of format which are a point list containing X, Y, Z columns and a X-Y point 2D table (matrix).
  • “Mesh Type” menu means whether you connect the imported vertices and create edges.
  • “X Column:” number means what number of the columns in a CSV file you import as X data.
  • “Y Column:” number means what number of the columns in a CSV file you import as Y data.
  • “Z Column:” number means what number of the columns in a CSV file you import as Z data.
  • “Object Name:” text means the name of object in which you create a mesh.

How to Import a CSV File Containing a X-Y Point 2D Table:

— Importing a CSV File —

    1. Find the UI of CSV Mesh Importer in Scene panel.
    1. Specify “Point X-Y 2D table (matrix)” in “File Type” menu.
    1. Select a CSV file in “.csv File Path:” file selection box. For example, use “Sample\2_Sample_PointTable.csv” in the .zip file.
    1. Specify “Mesh Type” menu, for example “Create vertices and faces (rectangle surfaces)”.
    1. Specify “X Length:” number, for example 1.
    1. Specify “Y Length:” number, for example 1.
    1. Specify “Z Scale:” number, for example 1.
    1. Specify “Object Name:” text box, for example “Imported”.
    1. Click “Import” button.
    1. You’ll see an imported mesh of a surface in 3D View window.

http://2.bp.blogspot.com/-d6k-VKauL1A/TzYGTiO0l_I/AAAAAAAAAA8/QtmxMdgSVAw/s600/00177.jpg

http://1.bp.blogspot.com/-S5zeexoTtr0/TXyvKKEa7sI/AAAAAAAAAy8/RDXv3d7DSDs/s400/00107.jpg http://1.bp.blogspot.com/-cOia17uw1YY/TXyvJzpn9UI/AAAAAAAAAys/yZta73wWDVs/s300/00108.jpg

— Parameters Explanations —

  • “Mesh Type” menu means whether you connect the imported vertices and create faces.
  • “X Length:” number means the X length of the grid mesh imported from a CSV file.
  • “Y Length:” number means the Y length of the grid mesh imported from a CSV file.
  • “Z Scale:” number means the Z scale factor of the grid mesh imported from a CSV file…
  • “Object Name:” text means the name of object in which you create a mesh.

Video Tutrials:

Recent Change Logs:


2015/05/10: v0.7 alpha4
  + added the checkboxes to select delimiter letters.
2015/05/01: v0.7 alpha3
  + updated for Blender 2.74.
2013/02/20: v0.7 alpha2
  + modified to read comments in .csv file.
2011/04/19: v0.7 alpha1
  + updated for Blender 2.57
  + special thanks to PKHG, who made this work in Blender 2.57.
2011/02/28: v0.6 alpha4
  + connect UI and the logic part
2011/02/22: v0.6 alpha3
  + add parts of UI for Line and Table configs
2011/02/20: v0.6 alpha2
  + rewrite the logic part of script to read a file and to add vertices
  + create LineMeshAdder to read a file and to add vertices and edges
  + add unit test class for LineMeshAdder
  + create TableMeshAdder to read a file and to add vertices and faces
  + add unit test class for TableMeshAdder
2011/02/13: v0.6 alpha1
  + create a UI for the mesh import configuration


The Differences from v0.5 beta3:
v0.6 series are rewritten for Blender 2.5x based on the previous v0.5 beta3. It is still under development and it only has very limited features yet. The features that v0.5 beta3 has and that v0.6 series haven’t yet would be added one by one in the future updates.

Coming soon…

I added the explanation on how to import a CSV file containing a X-Y point 2D table.

ora provided me with a .csv file (http://koti.mbnet.fi/olliraa/fulldata.csv) and he wants to create a graph from that in Blender like the image below.

I tried to import the .csv file and made a brief graph in Blender. Here are the settings of the script and the screenshot of the result.


I changed the scale to x,y,z = 0.001,1.0,0.0 after importing.

Here is the .blend file.
http://cid-0395cf4bd1d03ae3.photos.live.com/self.aspx/HPG/94%20csv^_imported^_mesh^_ora.blend

Attachments


Thank you so much for the explanation :slight_smile: This is really encouraging considering my project. I’ll try this method on Monday at work :slight_smile:

Ok, ora. I hope it will work.

Thank you Hans once more for the example blend-file :slight_smile: Sorry for not answering or a few days, been sick :frowning: But after seeing the example, now I understand (at least I think so) how I shoud set the axises.

However, as always, I have one last problem:

The rendered movie looks like it has only one frame which lasts as long as the whole movie. This single frame has the whole graph visible (image below). So, when the movie is played, nothing happens on the screen although the movie actually plays (time code changes). Naturally it should be in a way that every frame only shows “part of the graph” and the graph changes as the movie plays. Sorry, this is really hard to exlplain here.

Could you help me once more Hans? :slight_smile: (sorry about the unnecessary thumb below, can’t find a way to delete it)

Attachments


Hi, problems with latest version of Blender SVN 36013 … (compiled today)
e.g. registering does not work.
The testsuite gives no error, that is fine.
bpy.types.IDPropertyGroup is wrong does not exist is
probably bpy.types.PropertyGroup
etc.
I think you have to find out to make it work again … :wink:

Thank you, PKHG.
I know the API of the latest Blender has changed and I guess maybe it causes the error.
I will try to get it work again by changing IDPropertyGroup to PropertyGroup that you provided. I hope it works by only changing the name. I’m downloading the latest Blender now… Thanks again.

Ok, ora. What you really want to do is not to import a curve. This is my guess, so please correct me, but you have a long curve of graph that is imported, and a part of the curve should be shown inside of the graph frame. The curve should move right to left at a constant speed as animation goes. At frame 0, the left edge of the curve is in the left corner of the graph frame and at frame 2000, the right edge of the curve is in the right corner. If that is wrong, please tell me what kind of movie you want.

Yes, That’s what I want :slight_smile: Like I said I found it very hard to describe in text. You summed it up in a good way Hans :slight_smile: How would I get a movie like that?

Ok, ora. It seems to be easy, but you have to do something additionally.
In a nutshell, I’ll use f-curve to move the curve in Blender.
I’ll create another .blend file for that soon.

Hello ora,
I’ve created a .blend file in which the graph is animated. Please download from the link below and see the animation hitting Alt+A in Blender.
http://cid-0395cf4bd1d03ae3.photos.live.com/self.aspx/HPG/95%20csv^_imported^_mesh^_and^_anim^_ora.blend

A f-curve was set in the x-axis to the curve object with the linear interpolation for the animation. Could it meet your goal?

@Hans, download gave a 0 bytes .blend ?
Do you have another possibility to show the file?

EDIT:
got it now …

A f-curve was set in the x-axis to the curve object with the linear interpolation for the animation. Could it meet your goal?

YES! Great!

This is just what I was looking for. I now can render a move file with the graph on it :slight_smile: Thank you soo much! :smiley:

One more thing: If I want to repeat the thing you did with the f-curve in the future, is the exact procedure very complicated? :o

Ok, PKHG.
Is this works?
http://www.esnips.com/doc/58927987-de43-40e1-be63-6b9ccb6ed928/95-csv_imported_mesh_and_anim_ora

I confirmed that I could download it from SkyDrive and open it correctly.
If SkyDrive doen’t work well, it is really inconvenient because I put all files there now.

hmm, the new link will force me to use ‘their’ download manager (and what does that do?) but I think I got your example from cid… :wink:

It implies I can use SkyDrive.

Was busy to try to convert the script … do not know but I got just a minute ago something like this:

Horrible, that there is no ‘general’ info about properties, panels and operators.
I think there should be an abstract overview …

Hi, did not realize, but the scripts seems to make a screen-shot as well as a blend file, is that correct?
(the log?)