Can't find path of referenced file

Can't find path of referenced file

Electrik
Advocate Advocate
331 Views
2 Replies
Message 1 of 3

Can't find path of referenced file

Electrik
Advocate
Advocate

I can't find the right text to get the File path of a referenced document within an IAM.

I have the code below. This gets me the full path (including filename) for each child of the parent IAM (from which the rule was run). I'm just using a message box as a simple diagnostic tool, to show what I'm getting.

Instead of "FullFileName", how do I get the Path WITHOUT the filename and extension?

Yes, ThisDoc.Path works when I'm within the "root level", but refDoc.Path is not working in this case.

I feel I'm missing something obvious.

 

Dim oAsmDoc As AssemblyDocument = ThisApplication.ActiveDocument
Dim oDoc As Document = ThisDoc.Document
For Each refDoc As Document In oDoc.AllReferencedDocuments
    MessageBox.Show(refDoc.FullFileName, "file path")

 

Inventor Professional 2021
Vault Professional 2021
0 Likes
Accepted solutions (1)
332 Views
2 Replies
Replies (2)
Message 2 of 3

JelteDeJong
Mentor
Mentor
Accepted solution

you can try it like this:

Dim oAsmDoc As AssemblyDocument = ThisApplication.ActiveDocument
Dim oDoc As Document = ThisDoc.Document

For Each refDoc As Document In oDoc.AllReferencedDocuments
	Dim path = System.IO.Path.GetDirectoryName(refDoc.FullFileName)
	MessageBox.Show(path, "file path")
Next

Jelte de Jong
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.

EESignature


Blog: hjalte.nl - github.com

0 Likes
Message 3 of 3

Electrik
Advocate
Advocate

Yes! Thank you!

Inventor Professional 2021
Vault Professional 2021
0 Likes