Hi,
For storing strings within rhino documents and geometry attributes there is a very clear workflow:
- https://developer.rhino3d.com/api/rhinocommon/rhino.docobjects.objectattributes
- https://developer.rhino3d.com/api/rhinocommon/rhino.rhinodoc/strings
But what about custom class instance? Is it possible to save them within a document itself?
The only workflow I know to store data between multiple python files is the “sticky”, but the contents of it disappears when the file is closed. I am wondering what are other ways to store the “persistent” public data?
import scriptcontext as rs
class my_class:
def __init__(self):
self.my_attribute = 5
my_instance = my_class()
rs.sticky["someName"] = my_instance
print(rs.sticky["someName"].my_attribute)