Hi, i have a little question about how can i read CSV (or excel) files into rhino with python , i know that python comes with a CSV modulo , so my question itīs about how can i use it....
thanks
Hi, i have a little question about how can i read CSV (or excel) files into rhino with python , i know that python comes with a CSV modulo , so my question itīs about how can i use it....
thanks
Hi Diego,
The standard library csv module does not work with Rhino's implementation of python (http://www.ironpython.info/index.php/Reading_CSV_Files)
Fortunately many csv files are pretty easy to read. Here's a basic sample that reads a file and adds points to Rhino
Python Code:
import rhinoscriptsyntax as rsfile = open("C:\\Users\\a-steve\\Desktop\\Worksheet.csv", "r")lines = file.readlines()file.close()for line in lines:tokens = line.split(',')tokens = [float(item) for item in tokens]rs.AddPoint( tokens )
Attached is the csv file that I read in with the above script.
another thing to mention is that you can also directly communicate with excel if you want to go that route
http://www.ironpython.info/index.php...ing_with_Excel