Explicitly Assigning Reference Document to Variable Via Drawing Display Name

Explicitly Assigning Reference Document to Variable Via Drawing Display Name

dustinbagley
Advocate Advocate
394 Views
3 Replies
Message 1 of 4

Explicitly Assigning Reference Document to Variable Via Drawing Display Name

dustinbagley
Advocate
Advocate
I would like to assign a specific instance of referenced document in a drawing to a variable via
the display name. I can get the same results with a loop like the one below.

Dim
oDrawDoc As DrawingDocument = ThisDoc.Document Dim oDoc As Document
For Each oDoc In oDrawDoc.ReferencedDocuments
If oDoc.DisplayName = "Assembly1"

But I can't seem to assign it explicitly as implied here. oDoc = oDrawDoc.ReferencedDocuments.DisplayName("Assembly1")

Is there a way to do this? Is this a syntax issue or something more? Thanks

 

0 Likes
Accepted solutions (1)
395 Views
3 Replies
Replies (3)
Message 2 of 4

A.Acheson
Mentor
Mentor

Can you explain it n a little more detail your design intent? What is the end result to be? 

You can access referenced objects of the view via this method. Maybe this will help you.

Dim assyDocName As String =  oView.ReferencedDocumentDescriptor.FullDocumentName

'open assembly doc invisibly  
Dim oModelDoc As AssemblyDocument = ThisApplication.Documents.Open(assyDocName, False

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 3 of 4

dustinbagley
Advocate
Advocate

Sorry, what I want to know is how to assign an assembly document to a variable in a drawing through the browser using the browser display name. I know that I can do this by looping through all of the browser display names until I find the one I want. (for each Document in DrawingDocument.ReferencedDocuments, If Document.DisplayName = String Then do something with the current Document)  But if I can directly call it without the loop, that's what I would like to do.

(Document = DrawingDocument.ReferencedDocuments.DisplayName(String)

Also, I would like to avoid using filenames because these files will be copied with new filenames

Thanks

0 Likes
Message 4 of 4

A.Acheson
Mentor
Mentor
Accepted solution

I'm struggling to figure out your design intent. Maybe some images would help and what the end goal would be. Are your referring to the browser node label? BrowserNodeDefinition.Label() As String 

 

AAcheson_0-1671746557308.png

 

If so this can only be accessed by looping through the browser nodes. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes