Grasshopper

algorithmic modeling for Rhino

I noticed something funny... all my GrasshopperDocument.DocumentIDs were coming up identical. Then I realized it's because I use a GH file template - and its ID becomes the ID for all other docs. I even tried writing a script to mutate the ID if its ID matched my template, but since DocumentID is read-only, no dice. Any thoughts?

Or as a workaround, any other data attached to a document that 

1. persists through save (or at least doesn't change for an active GH session)

2. is unique across documents

?

Views: 326

Replies to This Discussion

This is always the problem. You want documents to have unique identifiers, and if you move a gh file from one folder to another you'd like it to stay the same, but if you copy the file you'd like the new file to have a different ID. And I don't even know what is wanted when a document is saved-as...

As it stands now, only code from within the Grasshopper assembly can assign a new document ID (unless you're willing to hack the internal method via Reflection. If you want that, the method you're looking for is GH_Document.SetDocumentID(Guid newID);)

There's a RuntimeID which never changes and is never shared amongst loaded documents, but it doesn't persist across saves (basically each GH_Document that gets constructed bumps the runtime counter).

There's no (easy) way to store custom data inside documents. I agree there probably should be, but there's nothing at the moment.

yeah I ended up getting at it via a reflection - I test the doc  to see if it matches the loaded template file, and mutate it if it does. Thanks for the help! 

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service