Hi everyone,
First of all - an apology:
A few wires became crossed when communicating with our engineering team about the accessibility of Revit GUIDs. While the issue of not being able to read [hidden] properties has been addressed, this doesn't allow you to access Revit GUIDs from the object properties. The reason for this is because those GUIDs are actually stored in a different file, and aren't loaded by the viewer for performance reasons.
I'm sorry that the information we posted here implied you could access those properties, which presumably caused some of you to spend your valuable time tryiong to access them.
We've now asked the engineering team to provide an API to simplify downloading and parsing accessing this separate GUID file, and we hope it will be available in the January production push.
In the meantime, this GUID file is accessible, but it requires a little work that will become obsolete once we create a simple API for you. If you don't want to wait for the API, here is the information you need to access and parse the file:
The GUID file is stored as part of the translated Document bubble. The file is objects_ids.json.gz, and is located at the path given by Document.getPropertyDbPath().
So, for example, the URL to access the GUID file looks something like this:
https://developer.api.autodesk.com/viewingservice/v1/items/urn:adsk.viewing:fs.file:dXJuOmFkc2sub2kqZWN0czpvcy5vYmplY3Q6c2dwXoBlcnNpc3RlbnRidWNrZXQvUmV2aXRUZW1wLnJ2dA==/output/Resource/objects_ids.json.gz?domain=
where the red part is the path returned by getPropertyDbPath(). (To quickly test this, you can construct your own URL using data for your own model and paste it into your browseer address bar to download a local copy of objects_ids.json.gz - this should work as long as you've already authenticated your session).
The file itself is a zipped JSON file that lists an array of GUIDs, where the index of each GUID in the array corresponds to the dbid of the element in the model being viewed.
I'm posting this information now so that those of you who need this urgently can start using it. Someone from my team will post some JavaScript code demonstrating this in the near future (unless someone beats us to it :-).
BTW Some of the confusion over this issue arose because Revit GUIDs are displayed for translations of DWF files exported from Revit. So anotyher way to have access to these GUIDs is to export your RVTs to DWF before translating.
Cheers,
Stephen Preston
Autodesk Developer Network