How to obtain the GUID of previous version of a document . Looking at Document.GetChangedElements(GUID) function

How to obtain the GUID of previous version of a document . Looking at Document.GetChangedElements(GUID) function

jonathan.taVCBM2
Enthusiast Enthusiast
554 Views
5 Replies
Message 1 of 6

How to obtain the GUID of previous version of a document . Looking at Document.GetChangedElements(GUID) function

jonathan.taVCBM2
Enthusiast
Enthusiast

Hi ,

I am trying to obtain a DocumentDifference object - looking at the sample code within the documentation it does not include the part in which I get the document GUID ? I know that I can get the current version GUID  via

Document.GetDocumentVersion(doc).VersionGUID 

, is the general idea is that I will store the GUIDs of different versions somewhere, external to the rvt file and then I'll be able to see the difference between several versions ? 

What happens if the model is saved using SaveAs , i.e. gets a new name ?

What happens if a model gets changes from a non shared to a central or cloud based workshared model  (BIM360/ACC) ?

Thanks in advance , Jonathan 

Jonathan Talisman
BIM Developer
0 Likes
Accepted solutions (1)
555 Views
5 Replies
Replies (5)
Message 2 of 6

jeremy_tammik
Alumni
Alumni

Good questions! I asked the development team for you.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 3 of 6

jonathan.taVCBM2
Enthusiast
Enthusiast

Thanks Jeremy, 
The link sends me to a slack login page with either an Autodesk SSO or "I have a guest account" . Is that right ? Or should I just wait for an update from you ? 

Jonathan

Jonathan Talisman
BIM Developer
0 Likes
Message 4 of 6

jeremy_tammik
Alumni
Alumni

That is right. That link is for my personal use only. With it, I can keep track of this case there and that conversation here without keeping additional notes.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 5 of 6

jeremy_tammik
Alumni
Alumni
Accepted solution

Some important feedback from the development team:

 

> Is the general idea that I have to store the GUIDs of different versions somewhere, external to the RVT file, and then I'll be able to see the difference between several versions?

 

Yes.

 

> What happens if the model is saved using SaveAs, i.e. gets a new name? What happens if a model gets changes from a non shared to a central or cloud based workshared model (BIM360/ACC)?

 

If the document has a new Document.GetDocumentVersion(doc).VersionGUID, the API Document.GetChangedElements(GUID) would report something. So, the question is: Would the document VersionGUID change in the situation described by the customer?

 

> As far as I know this API doesn’t work the way as it was originally expected.

 

Unfortunately, yes, the result it reports is not accurate now for DocumentDifference.GetModifiedElementIds(). The "created" ones and "deleted" ones are accurate. We are working on improving this.

 

Although a user can store GUIDs of model versions, but it is not globally unique, as you said, the model could be copied to another one or uploaded on ACC or initialised on RCM (Revit cloud model). The GUID is just to stand for a time stamp in 1 model; we cannot use it to make sure it is globally unique.

 

A possible solution or workaround may be to append a prefix (e.g., on ACC, it could be `modelurn:GUID`), thus creating a unique key.

 

Jeremy adds: there are many ways to create your own key:

 

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 6 of 6

jonathan.taVCBM2
Enthusiast
Enthusiast

Thanks Jeremy ,

This is helpful as it gives me an indication of what is possible. 

I think I should be able to track elements created or deleted from version A to B of a document as long as I can keep track of the document path/urn and the version GUID. 
I guess it's time to get my feet wet and experiment .

Thanks, Jonathan 

Jonathan Talisman
BIM Developer