path information for linked CAD files from BIM360 Docs

path information for linked CAD files from BIM360 Docs

danielgijsbers
Contributor Contributor
670 Views
1 Reply
Message 1 of 2

path information for linked CAD files from BIM360 Docs

danielgijsbers
Contributor
Contributor

Hi All,

 

We are trying to get the path information for linked CAD files. We can get path information except when it is a file linked through the desktop connector to BIM 360. Would you please have a look at the code snippet and help us out?

 

code snippet:
 
...
var element = document.GetElement(c.GetTypeId());
try {
if (element.IsExternalFileReference()) {
// OK: we have access to the path...
var externalFileReference = element.GetExternalFileReference();
path = ModelPathUtils.ConvertModelPathToUserVisiblePath(externalFileReference.GetAbsolutePath());
} else {
// Not an external file reference: how to get access to the (server)path?
var bar = element.GetExternalResourceReferences().First();
var externalResourceReference = element.GetExternalResourceReference(bar.Key);

// This does not work, because element.UniqueId is not an GUID (has extra characters at the end).
// If I remove these extra characters, I get a GUID, but then I get an exception saying "You are unauthorized to access this resource."
var  cloudPath = ModelPathUtils.ConvertCloudGUIDsToCloudPath(externalResourceReference.ServerId, Guid.Parse(element.UniqueId));
path = cloudPath.CentralServerPath;
}
} catch (Exception ex) {
path = "N/A";
}
...
 

managelinks.png

0 Likes
671 Views
1 Reply
Reply (1)
Message 2 of 2

jeremytammik
Autodesk
Autodesk

Dear Daniel,

 

Thank you for moving your question from our private email discussion out here into the public forum.

 

Does this recent discussion address your requirements?

 

https://thebuildingcoder.typepad.com/blog/2019/06/accessing-bim360-cloud-links-thumbnail-and-dynamo....

 

Best regards,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes