Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Electrik
269 Views, 2 Replies

Can't find path of referenced file

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
JelteDeJong
in reply to: Electrik

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

Electrik
in reply to: JelteDeJong

Yes! Thank you!

Inventor Professional 2021
Vault Professional 2021