- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I've have created several configurators that covers a very wide range of variations. A lot of the components used are customised parts or subassemblies and these files are saved starting with _ so we know which parts need to saved and replaced in Inventor or copy designed via Vault. But there are also a lot of standard components that don't need to be copied. (These files don't start with _).
With the help from several posts with similar questions, I have written out rules to be able to select components in the configurator so it will automatically save and replace the selected component(s) but to take it to the next level, I'm trying to find a way to automatically save and replace all the components in the assembly that start with _. I am also hoping I can save it automatically in the same folder as the assembly/open document without using a dialog box.
I have the first part of the rule written out to find each component starting with _, but now stuck on how to save & replace these components when found. If I could have any help that would be great, thanks.
'Define the open document Dim openDoc As Document openDoc = ThisDoc.Document 'Look at all of the files referenced in the open document Dim docFile As Document For Each docFile In openDoc.AllReferencedDocuments 'Format file name Dim FNamePos As Long FNamePos = InStrRev(docFile.FullFileName, "\", -1) Dim docFName As String docFName = Right(docFile.FullFileName, Len(docFile.FullFileName) -FNamePos) 'Create new filename Dim NewFilename As String NewFilename = iProperties.Value("Project", "Part Number") & docFName 'Create path to be saved in NewPath = ThisDoc.Path 'Save & replace if it starts with _ If Left(docFName, 1) = "_" Then i = MessageBox.Show(docFName & " Will Be Saved & Replaced With " & NewFilename & " In " & NewPath , "Save & Replace _ Components", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1)
End If InventorVb.DocumentUpdate() Next
Solved! Go to Solution.