Grasshopper

algorithmic modeling for Rhino

I am unable to get python to pass a guid object to an output parameter. It always comes up null. If I pass out guid.ToString() it works fine. Bug?

Views: 1290

Replies to This Discussion

Hi Andrew,

the reason is that Guids are pervasive in rhinopythonscript, and so they are always associates with some geometry. GhPython automatically transforms Guids to geometry. If there is no geometry with that Guid, <null> (None in Python) is returned.

I understand that you might want to return a Guid sometimes, though. Right now, probably the best idea is just to return the text representation, as you mention.

In the future, there could be a switch in output parameters. Similar to "do not lookup Guids in the Grasshopper document".

Please let me know how important you think that this feature would be. It is tracked at GH-1836.

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

Hi Giulio - 

Yes, I assumed something like this was the case. The option to turn it off would be pretty valuable to me - I think the python environment should be agnostic as to whether the user is using rhinoscriptsyntax or rhinocommon. The same way the gh python component allows you to uncheck "ghdoc object when geometry" - you should be able to disable automatic guid-to-object conversion. 

Another option would be to just return Guids unchanged if they are not found in the document. Possibly after looking also into the current Rhino document.

However, maybe just a checkbox for that would be easy enough. This would be the easiest choice, but then users will have to be taught about its existence...

I still do not know for sure if Guids should be looked up into the Rhino doc, too. What do you think?

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

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service