04-18-2019
08:26 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
04-18-2019
08:26 AM
Try to define the string as described in its example, as an external rule it worked for me.
Dim IPJ As String Dim IPJ_Name As String Dim IPJ_Path As String Dim FNamePos As Long 'set a reference to the FileLocations object. IPJ = ThisApplication.FileLocations.FileLocationsFile 'get the location of the last backslash seperator FNamePos = InStrRev(IPJ, "\", -1) 'get the project file name with the file extension IPJ_Name = Right(IPJ, Len(IPJ) - FNamePos) 'get the project name (without extension) IPJ_ShortName = Left(IPJ_Name, Len(IPJ_Name) - 4) 'get the path of the folder containing the project file IPJ_Folder_Location = Left(IPJ, Len(IPJ) - Len(IPJ_Name)) oThisDoc = ThisDoc.Document customPropertySet = oThisDoc.PropertySets.Item("Inventor User Defined Properties") oTYPE_PLAN = customPropertySet.Item("TYPE_PLAN").value If oTYPE_PLAN = "Detailtekening" Then Extentie = ".ipt" 'MessageBox.Show(Extentie) Else If oTYPE_PLAN = "Lassamenstelling" Or oTYPE_PLAN = "Ssamenstelling" Then Extentie = ".iam" End If 'Full name of the to search .ipt or .ass' oThisFileName = ThisDoc.FileName(False) & Extentie 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()
Please accept as solution and give likes if applicable.
I am attaching my Upwork profile for specific queries.
Sergio Daniel Suarez
Mechanical Designer
| Upwork Profile | LinkedIn