Retain Guid when passing objects between GHPython script components

Is it possible to retain the guids of objects passed between GHPython script components?

Sorry, no. The reason is that Grasshopper has no intrinsic knowledge of the Guid system, so this information is lost once it leaves the GhPython component.

What were you hoping to achieve with this? Maybe there’s a way for that.

Thanks Giulio, I suspected this was the case.

I am migrating some RhinoPython code to Grasshopper, and it has been using GUIDs for Rhino curves to keep track of things like points attached to certain curves, etc. It’s no problem to rework this to work in GH, but I was hoping for an easy way out.

Interestingly, I somehow got this to work unintendedly the other day, but now I can’t reproduce it. That was why I was hoping that there was something I was overlooking.

You can keep track of things with Guids. There is only a GrasshopperDocument for each Rhino, but it gets emptied when the Grasshopper solution finishes executing.

Only thing to remember, is to embed or transform the Guid into something else, like a string. Otherwise, GhPython by default will look it up and pass it as pure RhinoCommon geometry to simplify Grasshopper usage.

See this definition here:

point-id.gh (7.4 KB)

Giulio


Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com