05-26-2023
08:49 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
05-26-2023
08:49 AM
I was looking for a variety of solutions to this same thing and many resulted in faults and other problems. Then I recalled one of my co-workers doing something similar and he had a very simple bit of code.
'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)
Parameter.Quiet = True
Parameter(docFName, "Parameter1") = Parameter1
Parameter(docFName, "Parameter2") = Parameter2
Parameter(docFName, "Parameter3") = Parameter3
Next
iLogicVb.UpdateWhenDone=True
InventorVb.DocumentUpdate()
ThisApplication.ActiveView.FitThis will run just the listed parameters and it will go into each part. There were problems 10 years ago that didn't always push the parameters into some of the subpart and assemblies, but I have not run into that recently. If that is an issue we simply put the code in some of the subassemblies.