Cannot get the full path of a cloud revit link model

Cannot get the full path of a cloud revit link model

ptranU2KHX
Advocate Advocate
1,238 Views
2 Replies
Message 1 of 3

Cannot get the full path of a cloud revit link model

ptranU2KHX
Advocate
Advocate

Hi Everyone,

 

I am trying to get the path name of a document, which is a Revit link in a project A. This Revit link is a cloud model named "SourceCloudLinked" and stored in the folder "Cloud Model - Non Workshared" in ACC. The project A also has one more Revit link whose name is also "SourceCloudLinked" but it is stored in the folder "Cloud Model - Workshared" in ACC.

ptranU2KHX_0-1684984527905.png

When I loop through all documents to find the Revit link, the line 1 (in the figure below) show its document's path name, which is not clearly stated where it is stored. The line 2 is the revit link type's file path which is retrieve by this code:

                Dim err = _rlt.GetExternalResourceReference(ExternalResourceTypes.BuiltInExternalResourceTypes.RevitLink)
                FilePath = err.InSessionPath

ptranU2KHX_1-1684984651571.png

My need is to compare the two file paths and get the document of the Revit link to retrieve data inside the link. However, with the issue above, now I can rely on the name of the Revit link, but this is a potential error when the project has two Revit link with the same name.

 

Accepted solutions (1)
1,239 Views
2 Replies
Replies (2)
Message 2 of 3

moturi.magati.george
Autodesk
Autodesk
Accepted solution

Hi @ptranU2KHX,

The Building Coder tries to discuss on ways to determining a BIM 360 model's local "absolute" path.
You can have a look at the same to understand and tweak it to your requirements.

https://thebuildingcoder.typepad.com/blog/2021/05/refreshment-cloud-model-path-angle-and-direction.h...

  Moturi George,     Developer Advocacy and Support,  ADN Open
Message 3 of 3

Chuong.Ho
Advocate
Advocate

Try with 

var rvtLinks = new FilteredElementCollector(doc)
            .OfClass(typeof(RevitLinkType))
            .Cast<RevitLinkType>();
 foreach (RevitLinkType rvtLink in rvtLinks)
        {
            var rvtLinkBenchmark = new RvtLinkBenchmark();
            rvtLinkBenchmark.ModelName = doc.Title + ".rvt";
            rvtLinkBenchmark.Name = rvtLink.Name;
            ExternalFileReference externalFileReference = rvtLink.GetExternalFileReference();
            string visiblePath = ModelPathUtils.ConvertModelPathToUserVisiblePath(externalFileReference.GetAbsolutePath());
            rvtLinkBenchmark.Path = visiblePath;
            rvtLinkBenchmark.Type = rvtLink.AttachmentType.ToString();
            rvtLinkBenchmark.Status = rvtLink.GetLinkedFileStatus().ToString();
            rvtLinkBenchmarks.Add(rvtLinkBenchmark);
        }

Or See more details in this post : 

https://chuongmep.com/posts/2022-04-14-Get-Path-Linked-BIM360-Dynamo-Revit.html#su-dung-getexternalr...

Chuong Ho

EESignature