Read ghdata directly in node

Hi,

Is it possible to read .ghdata directly from ghpython, c# or vb? Since the data source of the Data Input component is set by right clicking on the node, NodeInCode and ghpythonlib.components does not work. Is it possible to deserialize this data directly? If so, what methods do I need to use to be able to do this?

Best regards
Audun Mathias Øvstebø

Grasshopper (de)serialization is in GH_IO.dll. You have to create an archive, read the file, extract the chunk or fragment and get the data, or something similar.

Thanks, that takes me part of the way to the solution.

I tested the following code for a data output item, but the following error occurred:

import sys
sys.path.append(r'C:\Program Files\Rhino 6\Plug-ins\Grasshopper')

import clr #common language runtime
clr.AddReferenceToFile('GH_IO.dll')
import GH_IO.Serialization as SER

Arc=SER.GH_Archive()
Arc.ReadFromFile("C:\\Temp\\TEST.ghdata")

Runtime error (IOException): file_name is not of a recognized type

Traceback:
line 9, in script

Am I supposed to use a different method to read the file?

I know this is a old thread but does anyone have any solution to this issue? It’ll be great if there is a way read ghdata directly as I have multiple files with different path and it’ll be great to be able to manage them using a python script