Custom Object User Data lost when saving doc

rhino6
custom-object-user-d

(Matthieu Arnold) #1

Hi,
My .net plugin used to read/write a lot of Custom Object User Data when it was compiled for Rhino5, and it worked really fine.
I’m currently migrating to Rhino6, and I’ve got an issue with these custom user data. During a session they are written and read just fine, but if I Save/close the doc and reopen, every data is lost.
Do you have any pointers on what has change between V5 and V6 for custom Object User Data?

Best regards


(Nathan 'jesterKing' Letwory) #2

When you save your file, do you have checked Save plugin data?


(Matthieu Arnold) #3

Yes I do, but it does not work.


(Nathan 'jesterKing' Letwory) #4

@dale, are you familiar with the custom object saving code?


(Matthieu Arnold) #5

Thanks for helping @nathanletwory , I don’t really know how but I got it to work.
I rewrote my custom class, I think there was an issue with the read() override command. (Still, it was working in V5)


(Nathan 'jesterKing' Letwory) #6

Great to hear you got it to work on your own, @Matthieu_from_NAVINN.

If you have an idea of the differences in your code for v5 and v6 perhaps you could write about it so other devs can refer to it as well?

/Nathan


(Matthieu Arnold) #7

Hi, unfortunately I’m not certain of the reason behind these bugs.
I had a try/catch to return Nothing when reading custom data when a particular element was missing, and since migration to v6 it was always returning nothing. My best guess is loss of data when my test file was converted to V6 format.

I’ve removed this unsafe system and now I make use of ContainsKey() instead, with a fallback value for each variable:

 If dict.ContainsKey("test") Then
                _test = TryCast(dict("test"), String)
 Else
                _test = ""
 End If