Geometries inside GhPython class not passing through different components

Hello,

I’m creating a class inside a GhPython component that stores geometries and text data in a dictionary.
If I output the geometries inside the same GhPython component everything works as expected but when I output the object I get a NullReferenceException: No problem for text data instead.


Any ideas why? Is it not finding the GUID in the document?
Is there any other method I can use to store geometries and get them in other components?

Thanks!

Welcome Michele,

It’s kind of hard to say without a file to take a look at, but have you tried not using the output variable a to store your class instance? I’d try to store it inside a separate variable and pass it to the output at the end of the script.

Also, what have you set the type hint for the x-input of the second GHPython component to?

Data transfers between components can also be done via sticky, but your current workflow should be fine too. The devil is in the details! If you’re interested in sticky, simply search the discussion forum. It has been explained over and over.

@diff-arch very sorry for not attaching the file before. test_class_ghpython.gh (3.4 MB)

Type hint is ghdoc but seems to not effect the script.
I’ll try passing the class to the output at the end of the GhPython and see what happens.

I’m kind of familiar with sticky but I would prefer to stay with plugging cables for this time.

Thanks for your help

I’ve checked your file and fortunately there is a very easy remedy for your problem! Just set the type hint for your geometries input of the first GHPython component to Mesh, instead of ghdoc Object when ....
The problem seems to be that when using GUIDs, they expire or get dissociated somewhere along the way. I don’t understand exactly what happens here either… but explicitly working with meshes is a quick fix!

That worked!
I also think it is related to GUID but had no idea of what was going on.

Thank you very much!

1 Like