ArchivableDictionary write to / read from document

@stevebaer, @piac,

i have a large set of values from a form like integers, floats, boolans etc. which i am trying to write to and read from a Rhino document. Is there a way to accomplish this using an ArchivableDictionary with Python ?

The values could be written with DocumentUserText too but i am trying to avoid it since they would be visible and editable in Rhino 6 new User Text dialog unter Document Properties. They should only be editable through my forms.

_
c.

You can always use RhinoCommon and lock your data behind your own ID:

That way no one can access it unless they have your key.

That isn’t really an option with python.

There isn’t an ArchivableDictionary on the document, but if there were we would probably quickly run into the same problem because I’m sure there would be requests to expose this in the Rhino UI.

@Trav wrote the UI for the Document user text. Travis, are there certain keys that are not shown in the UI (maybe some sort of prefix on a key that marks it as hidden)?

@stevebaer currently there are not, however it wouldn’t be that hard to add.

Hi @stevebaer,

i can create the ArchivableDictionary but have no idea how to write to / read from the document using python.

The advance compared to DocumentText would be that i do not have to do any type conversion and maybe store other things as well.

I’m happy to test whatever prefix you suggest :slight_smile:
_
c.

@clement the only trouble i really see here is that while it would be hidden from the panel UI it wouldn’t be hidden from the command line if that matters?

Hi @Trav, it is still better than visible in the UI. What kind of prefix would you suggest ? Maybe just an underscore ?

_
c.

yeah maybe hidden_ and then your key?

e.g. hidden_mykey

@Trav, i would suggest to use only one or two underscores which means something in python :wink:

_
c.

I was leaning toward a ‘.’, but maybe that’s too unix-ish

I’m happy with whatever makes you guys happy.

.steve | is cool

we can hide that =)

Good thing the string table does not validate input.

@brian or @pascal, do we have any concept of hidden items like this anywhere else in Rhino? I know @JohnM wanted some of this functionality a long time ago while putting the last version of Flamingo together.

I do not, off the top of my head…

-Pascal

There is something in a setting that lets you set a flag which keeps it from displaying in the Advanced settings UI.

@JohnM, where can i find it ? Does it do any harm if i use that then in Rhino 5 too ?

_
c.

John is just referring to another system that we have that has the notion of hidden key/value combinations. This isn’t the appropriate system for saving data in files

Is there a way to save visible archivable dictionary data with V5 / python right now?
Whatever I try is gone when I re-open the file.

I would try ‘Notes’ for saving information.

Hi @ChrisK,

Maybe “visible” was confusing? What I meant is that I don’t care if my document data could be displayed and edited with regular Rhino commands, like GetDocumentUserText and SetDocumentUserText.

This is the case if I’m using scriptcontext.doc.Strings to store custom data from Python. But as it’s name says, its just holding strings and thus everything has to be converted to strings and of course back again to complex objects like for example vectors or point coordinates.

The ArchivableDictionary should handle that for me, but I don’t know how to use it.

@Trav, any news which prefix i can use in Rhino 6 to prevent listing of document user strings in the new UI ?

_
c.