Message 1 of 3
Replace component if not exist
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
i make an assembly this some ilogic options and want to use it by some other computers. Some names of components going lost by making a copy, becouse some file have been renamed. Inventor asks to find find them. Can I use some ilogic rules to replace them without a dialog this some other components, if i know new file names of component?
I use this code:
oDoc = ThisDoc.Document Dim refDocs As DocumentsEnumerator = oDoc.AllReferencedDocuments Dim refDoc As Document Dim oPath As String = ThisDoc.Path Dim FileName As String = PROTOTYPE Dim ExPath As String = "I:\" ExFileNPath = ExPath & "\" & FileName Dim NewPath As String = Left(oPath, InStrRev(oPath, "\")) & "Artikel" For Each refDoc in refDocs Component.Replace("Prototype", ExFileNPath, True) Try If refDoc.DisplayName = FileName Then If System.IO.File.Exists(NewFileNPath) Then My.Computer.FileSystem.DeleteFile(NewFileNPath, _ Microsoft.VisualBasic.FileIO.UIOption.OnlyErrorDialogs, _ Microsoft.VisualBasic.FileIO.RecycleOption.DeletePermanently) End If refDoc.SaveAs(NewPath & "\" & FileName, False) End If Catch MessageBox.Show("Try again") End Try Next
But i want to use only if component not exists before Inventor opens a browser windows for searching