KeynoteTable not availabe if BIM 360:// path via Desktop Connector

KeynoteTable not availabe if BIM 360:// path via Desktop Connector

Sean_Page
Collaborator Collaborator
1,493 Views
8 Replies
Message 1 of 9

KeynoteTable not availabe if BIM 360:// path via Desktop Connector

Sean_Page
Collaborator
Collaborator

I have been developing an application for editing Keynotes within Revit and all is well except when the project has a Keynote file that has a BIM 360:// path via Desktop Connector The application tries to read and load the internal Keynote file with the external reference path, but it doesn't work with Cloud keynote files.

 

It doesn't matter if the file is a cloud model or not, but when the path is not local, no KeynoteTable is even available when iterating the TransmissionData GetAllExternalFileReferenceIds().

 

                TransmissionData transData = TransmissionData.ReadTransmissionData(ModelPathUtils.ConvertUserVisiblePathToModelPath(Functions.DocPath(doc)));
                var extRefs = transData.GetAllExternalFileReferenceIds();
                foreach (ElementId refId in extRefs)
                {
                    ExternalFileReference extRef = transData.GetLastSavedReferenceData(refId);
                    MessageBox.Show(extRef.ToString() + " : " + extRef.ExternalFileReferenceType + " : " + extRef.PathType);
                    if (extRef.ExternalFileReferenceType == ExternalFileReferenceType.KeynoteTable)
                    {
                        App.ControlID.keynoteFilePath = ModelPathUtils.ConvertModelPathToUserVisiblePath(extRef.GetPath());
                    }
                }

 

If the Keynote file path is local I get three types of ExternalFileReferenceTypes:

Local Keynote FileLocal Keynote File

 

KeynoteTableKeynoteTableRevitLinksRevitLinks
AssemblyCodeTableAssemblyCodeTable

 

If the Keynote file path is BIM 360 I only get two types of ExternalFileReferenceTypes:

BIM 360 Keynote FileBIM 360 Keynote File

 

AssemblyCodeTableAssemblyCodeTable

 

RevitLinksRevitLinks

 

Is there a way to get the KeynoteTable information when it is a Cloud path or is this information not available?  I think its odd that it doesn't even "see" a KeynoteTable when using a cloud path, rather than providing a cloud path that could be parsed for relevant / location association.

 

Any thoughts here?

 

-- Again, I want to reiterate that this in a LOCAL model, not a Cloud model, just the Keynote file has a cloud path.--

 

Thanks in advance for any support you can lend.

 

Sean Page, AIA, NCARB, LEED AP
Partner, Computational Designer, Architect
0 Likes
Accepted solutions (1)
1,494 Views
8 Replies
Replies (8)
Message 2 of 9

Sean_Page
Collaborator
Collaborator

Bump... Anyone have any thoughts or is this a lost cause to chase?

Sean Page, AIA, NCARB, LEED AP
Partner, Computational Designer, Architect
0 Likes
Message 3 of 9

Sean_Page
Collaborator
Collaborator

I have done some additional testing and it purely seems like Revit will not return the Keynote path if it is a BIM 360:// path, but works perfectly when it has a local path for the Keynote file.

 

1. Test Code:

using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using System;
using System.IO;
using System.Windows.Forms;

namespace RDGRevit.Testing
{
    [Transaction(TransactionMode.Manual)]
    class Test : IExternalCommand
    {
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            UIApplication uiapp = commandData.Application;
            Document doc = uiapp.ActiveUIDocument.Document;

            using (OpenFileDialog ofd = new OpenFileDialog())
            {
                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    if (File.Exists(ofd.FileName))
                    {
                        MessageBox.Show(GetKeynotePath(ofd.FileName));
                        MessageBox.Show(GetKeynotePath(Functions.DocPath(doc)));
                    }
                }
            }
            return Result.Succeeded;
        }

        private string GetKeynotePath(string _path)
        {
            try
            {
                TransmissionData transData = TransmissionData.ReadTransmissionData(ModelPathUtils.ConvertUserVisiblePathToModelPath(_path));
                var extRefs = transData.GetAllExternalFileReferenceIds();
                foreach (ElementId refId in extRefs)
                {
                    ExternalFileReference extRef = transData.GetLastSavedReferenceData(refId);
                    if (extRef.ExternalFileReferenceType == ExternalFileReferenceType.KeynoteTable)
                    {
                        return ModelPathUtils.ConvertModelPathToUserVisiblePath(extRef.GetPath());
                    }
                }
                return "No Keynote Reference Found";
            }
            catch (Exception ex)
            {
                return ex.ToString();
            }
        }
    }
}

2. If I use this to select a file from the CollaborationCache of Cloud Models it will return a value if the Keynote file is pathed to a local drive.

 

Local Path.PNG

 

3. If I use this to select a file from the CollaborationCache of Cloud Models that has a Desktop Connector Shared path it does not return a keynote table, but obviously the file has one.

 

No Path.PNG

 

Does anyone have any idea why it wouldn't be able to pull the BIM 360:// pathed file from the external references and/or where else it may be stored that I could access it?

Sean Page, AIA, NCARB, LEED AP
Partner, Computational Designer, Architect
0 Likes
Message 4 of 9

Sean_Page
Collaborator
Collaborator

Is this something I can log with the Development team to see if there is a method to retrieve the Keynote Table from a BIM 360 model?

Sean Page, AIA, NCARB, LEED AP
Partner, Computational Designer, Architect
0 Likes
Message 5 of 9

Sean_Page
Collaborator
Collaborator
Accepted solution

 

IDictionary<ExternalResourceType, ExternalResourceReference> r = KeynoteTable.GetKeynoteTable(doc).GetExternalResourceReferences();
string sessionPath = r[ExternalResourceTypes.BuiltInExternalResourceTypes.KeynoteTable].InSessionPath;
Sean Page, AIA, NCARB, LEED AP
Partner, Computational Designer, Architect
Message 6 of 9

GallowayUS_com_RonAllen1
Collaborator
Collaborator

@Sean_Page  - Have you run across any way to directly Access/Manage a keynote file in the cloud? <Visispecs> and purportedly <Keynote Manager> do this. ..

Ron Allen
Galloway BIM
Message 7 of 9

Sean_Page
Collaborator
Collaborator

So, I don't think they are technically managing a keynote "file" but, rather they are using an external resource reference / server to deliver the information via the API. 

Sean Page, AIA, NCARB, LEED AP
Partner, Computational Designer, Architect
Message 8 of 9

Sean_Page
Collaborator
Collaborator

Using the solution above we host our keynote files on ACC and work from there through our internally developed Keynote manager. It works pretty well and also allows any team member that may not have our tools to also access and edit the information if needed.

Sean Page, AIA, NCARB, LEED AP
Partner, Computational Designer, Architect
Message 9 of 9

GallowayUS_com_RonAllen1
Collaborator
Collaborator

I can imagine how I would manage the file ; ) 

 

What I am hoping for is the code to point Revit to the cloud file- for reading from that file. Guessing something like a restful protocol built into Revit somewhere to do the initial read/update of the local copy in the loaded revit model file.  Keep in mind I am an API noob but long-term revit user(2006) -What mechanisms are in Revit to load the file. I'll take a closer look at your code to see if there are hints in there later today or tomorrow.

 

 

Ron Allen
Galloway BIM