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

@mikhail_tsarev 

 

Hello,

 

Try the rule below: 

 

oThisDoc = ThisDoc.Document
oThisFileName = ThisDoc.FileName(False) & ".ipt"
IPJ = ThisApplication.FileLocations.FileLocationsFile
IPJ_Folder_Location = Left(IPJ, Len(IPJ) - Len(IPJ_Name))

Dim Folder As New IO.DirectoryInfo(IPJ_Folder_Location)
Dim FileList As New List(Of String)
For Each File As IO.FileInfo In Folder.GetFiles(oThisFileName,IO.SearchOption.AllDirectories)
If File.FullName.Contains(oThisFileName) = True Then
FileList.Add(File.FullName)
NieuwFilePath = File.FullName
doc = ThisDoc.Document
'Change the Referenced File'
oFD = doc.ReferencedFileDescriptors(1).DocumentDescriptor.ReferencedFileDescriptor
oFD.ReplaceReference(NieuwFilePath)

Else
MsgBox("the file " & oThisFileName & " not found in this project!")
End If

Next

iLogicVb.UpdateWhenDone = True
InventorVb.DocumentUpdate()