Export list to file?

Long story short: I am trying to export the list to a file or something equivalent so that I can have the data for post-processing. This is the mesh normal as a list.

Exporting it as a Python object would also be an option, but could someone please let me know how it can be achieved?

Thanks in advance!

The csv file doesn’t suffice?

Thank you for your response.

The problem is that I do not know how to use and I cold not find comprehensive tutorial on that tool.

What I should put in the header input? If I have 1000+ headers, then how should I type in 1000+ header manually?

I am new to Grasshopper…

Thank you.

I was mistaken, i typically use TT Toolbox excel export.

the data needs matching values to the column list. 2 items in Columns, Two Items into the branched data.
Data Out.gh (10.6 KB)

Do you know if I can export the data as a python object that to be used later?


Python is included in RH6. This is about the extent of my knowledge.

I’d recommend using the standard Python pickle module for writing/reading arbitrary data objects/structures to/from disk. Spreadsheets will typically only support primitive data types (integers, floats, strings, bools etc).

Hi AndersDeleuran,

Thank you very much for your reply! So I tried to use pickle module but failed because Rhino.Geometry object is not supported outside of grasshopper. Do you have any suggestions on the problem?

Thanks a lot

Yes you won’t be able to (meaningfully) deserialise RhinoCommon objects outside of Rhino (or maybe all these latest Rhino Compute/Inside developments enables this). Either way, you’ll probably need to more explicitly describe the data pipeline you’re looking to develop, for us to provide appropriate solutions.

Hello AndersDeleuran,


My primary objective is to export the mesh data out of the Rhinoceros so that I can use it for postprocessing in Python. I tried to export as CSV but the file does not preserve the format that displays on the Panel (i.e. it just merges into a giant list and I cannot distinguish which vector corresponds to which face). So what I really like to do is to, for example, call the face by its number and the program just spit out the corresponding normal vectors.

Thank you and I hope I articulate in a clear way.

In that case, perhaps going with the agnostic JSON format might be a good solution (that way you could also read/write the data in C#, JavaScript etc). Here’s a quick implementation (note there are substantially more efficient ways of going about this in terms of performance, but this is probably more beginner-friendly):

181117_WriteReadMeshComponents_GHPython_00.gh (16.0 KB)

If you need normals, you can access these and add them to the dictionary as well.

Edit: Forgot the indent parameter when dumping the file, which formats the output in the “pretty” JSON style, making it more legible when viewing in a text editor:

181117_WriteReadMeshComponents_GHPython_01.gh (16.0 KB)

how would i output keys and values into this json format? Thanks in advance.

“items”: [
{ “id”: “UNIQUE ID 1”,
“label01”: “Value01”,
“label02”: “Value01”,
“Label03”: “Label03”,
“Label04”: “Label04”,
{ “id”: “UNIQUE ID 2”,
“label01”: “Value01”,
“label02”: “Value01”,
“Label03”: “Label03”,
“Label04”: “Label04”,

keysValues2json.gh (6.2 KB)

My attempt so far.

import json

#data inputs

key = []
x = key

values = []
y = values

#pack into dict

data = {"key": key, "values": values}

#write data to file
if WriteJSON:
    with open(JSONFilePath,"w") as writeFile:

a little closer. Now its a matter of creating one output with the 3 vs a branched output.

you’ll need to give your python script “tree access” rather than list access so that you can iterate over the branches explicitly rather than implicitly - otherwise the script will simply run multiple times, once per branch.

Thanks, I’m running through tutorials (ni-fty guide etc) trying to understand it all.

A general knowledge of Python/C+ Coding for GH being a 2019 objective.

My immediate goal being this structure out of GH key/value trees.

   types: {
       "Person": {
           pluralLabel:  "People"
   properties: {
       "age": {
           valueType:    "number"
       "parentOf": {
           label:        "parent of",
           reverseLabel: "child of",
           valueType:    "item"
   items: [
       {   label:        "John Doe",
           type:         "Person",
           parentOf:     "Jane Smith"
       {   label:        "Jane Smith",
           type:         "Person"