weird AllReferencedDocuments results

weird AllReferencedDocuments results

NachoShaw
Advisor Advisor
299 Views
0 Replies
Message 1 of 1

weird AllReferencedDocuments results

NachoShaw
Advisor
Advisor

Hey

 

Im getting wierd results with using AllreferencedDocuments. When done in VB.Net using Apprentice, the exact same file from the same folder location can have mixed results. Mainly, any iPart used sometimes references the factory part and sometimes doesnt. The same code in VBA does but takes longer...

 

The only different in the code are the following lines:

 

VB.Net (Apprentice)

Dim drawingDoc As Inventor.ApprenticeServerDocument = apprenticeServer.Open(CDFilename)
Dim allReferencedDocs As Inventor.ApprenticeServerDocuments = drawingDoc.AllReferencedDocuments

Dim referencedDoc As Inventor.ApprenticeServerDocument
For Each referencedDoc In allReferencedDocs
   Debug.Print(referencedDoc.DisplayName)
Next

 

VBA

 Dim DrawingDoc As String
DrawingDoc = "K:\Inventor\Templates\REF FILES\MASTERDOC.idw"
Dim oDoc As Document

Set oDoc = ThisApplication.Documents.Open(Path, False)

Dim oRefDocs As DocumentsEnumerator
Set oRefDocs = oDoc.AllReferencedDocuments

Dim oRefDoc As Document
For Each oRefDoc In oRefDocs
   Debug.Print oRefDoc.DisplayName
Next
oDoc.Close (True)

 

VBA uses DocumentEnumerator whereas Apprentice uses ApprenticeServerDocuments

 

Why would apprentice return different results using the exact same code on the exact same file?

 

 

 

Thanks

 

 

Nacho
Automation & Design Engineer

Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC

EESignature


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


0 Likes
300 Views
0 Replies
Replies (0)