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

I solved my own problem. The issue was that I was calling out the inventor partfile. Working code below. This is intended to update all parameters in all files as long as they match. 

Public Sub Main()
	CopyUserParams()
	iLogicVb.UpdateWhenDone = True

End Sub

Private Sub CopyUserParams()
    If ThisDoc.Document.DocumentType <> Inventor.DocumentTypeEnum.kAssemblyDocumentObject Then
        MsgBox("The active document must be an assembly.")
        Return
    End If

    Dim asmDoc As Inventor.AssemblyDocument = ThisDoc.Document	
    For Each refDoc As Inventor.Document In asmDoc.AllReferencedDocuments
                 Dim partDoc As Inventor.Document = refDoc
            Dim refDocUserParams As UserParameters = partDoc.ComponentDefinition.Parameters.UserParameters

            ' Add the assembly parameters to everything.
            For Each asmUserParam As UserParameter In asmDoc.ComponentDefinition.Parameters.UserParameters
                ' Check to see if the parameter already exists.
                Dim checkParam As UserParameter = Nothing
                Try
                    checkParam = refDocUserParams.Item(asmUserParam.Name)
                Catch ex As Exception
                    checkParam = Nothing
                End Try
				If checkParam Is Nothing Then 'do nothing
					Else					
                  ' Update the value of the existing parameter.
                    checkParam.Expression = asmUserParam.Expression
				End If
                Next
    Next
End Sub
'Original Code Copied from https://forums.autodesk.com/t5/inventor-customization/ilogic-push-all-assembly-user-parameters-to-parts/m-p/7961847#M83748
'Modified to not add a missing parameter and to update subassemblies instead of just parts