I am trying to track changes made to Rhino objects by the user. Does Rhino employ transactions or anything similar when the file is edited ? Is there anyway I can track changes or retrieve the history of changes ?
The best I found so far are UndoRecords. I see the methods to begin and end undo records etc. but how can I access these records to see what has been done?
Ok, Thanks!
But, is this set of events exhaustive ? i.e. if I catch and handle all these events, can I keep track of all changes made to the document or are there other events I need to also handle ?
I am trying to build (at least experiment) a version control system for Rhino files. I am exploring different mechanisms: trying to determine the pros and cons of using Rhino3dmIO to compare file contents vs tracking user actions. So far it looks like Rhino3dmIO is the better way to go. But I will also try out the other approach if possible.
Fun. My guess would be that Rhino3dmIo is the better way to go also. Rhino uses Guids for each object in the document.
Given two 3dm files (old.3dm and new.3dm):
if a Guid exists in old.3dm and does not exist in new.3dm it has been deleted
if a Guid exists in new.3dm and does not exist in old.3dm it has been added
if matched Guids exist in both files, you would need to examine the geometry to see if it has been modified. You could also examine the attributes to see if they have been modified
There’s also the case of looking at tables like the layer table to see if they have been modified
All BIM related APIs that I worked with used transactions that can be applied and rolled back fairly easily. I thought if Rhino had something similar I could just persist a tree of transactions in a separate file and save on storage space. In theory the user can just navigate the tree of transactions and explore all versions of the file.
But since there are no transactions, I will pursue the Rhino3dmIO path. Thanks!
A follow up question: I am writing generic code to loop through and compare all the tables in a 3dm file (i.e. all types that inherit from File3dmCommonComponentTable irrespective of what the T is). I see some tables duplicated, for example there is ‘File3dm.Layers’ and there is also ‘File3dm.AllLayers’ and similiar duplicates for other tables (not all though).
Can you tell me what is the purpose of these duplicate tables so that I know what to do with them when comparing ?
Thanks !
I am loading the files using Rhino3dmIO and trying to check if the objects have been edited (between the old file and the new file) by calling File3dmObject.Equals() method. But it is returning false even when the file has not been edited at all. It returns false even if I open the same file twice and compare the same object with itself.
Why is this method returning false even when comparing the same object from the same file ? Is there any other way I can check for changes done to the object ? Thanks !
File3dmObject.Equals only verifies that two File3dmObject items refer to the same object in a document. It doesn’t do any kind of geometry or attribute comparison.