Disconnected Referenced Files

Disconnected Referenced Files

Anonymous
Not applicable
358 Views
1 Reply
Message 1 of 2

Disconnected Referenced Files

Anonymous
Not applicable

I'm using the attached code to obtain a referenced document from Inventor's document cache. Sometimes it returns a document that seems to be disconnected from Inventor. Is there anyway to flush Inventor of all disconnected components without performing a close all? Or is there a clause I can add to my code that will ignore any disconnected parts? This is causing a problem because, when I try to use the returned disconnected document, my program throws an exception. So far, the only way I've found to overcome this issue is to close all documents.

 

Thanks,

 

Exception Message: The object invoked has disconnected from its clients. (Exception from HRESULT: 0x80010108 (RPC_E_DISCONNECTED))

 

 

// Cycle through the Inventor application documents.
            foreach (Document _doc1 in from Document _doc1 in Application.Documents
                                       where _doc1.FileSaveCounter != 0
                                       where !string.IsNullOrEmpty(_doc1.FullFileName)
                                       where _doc1.FullFileName.Contains(_fullFileName)
                                       select _doc1)
            {
                _docList.Add(_doc1);
                return _doc1;
            }
0 Likes
359 Views
1 Reply
Reply (1)
Message 2 of 2

adam.nagy
Autodesk Support
Autodesk Support

Hi Eric,

 

CloseAll has an option exactly for that - see help file or e.g. VBA Object Browser:

Documents.CloseAll( [UnreferencedOnly] As Boolean )

 

Cheers,



Adam Nagy
Autodesk Platform Services
0 Likes