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

Hi @robertast 

The type of parameter copy that's done in this thread, but from assembly to all its parts would look something like this:

iLogicVb.UpdateWhenDone = True
Dim oAsm As AssemblyDocument = ThisDoc.Document
For Each oDoc As Document In oAsm.AllReferencedDocuments
	If oDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject AndAlso oAsm.ComponentDefinition.Occurrences.AllReferencedOccurrences(oDoc).Count > 0
		Dim oDef As PartComponentDefinition = oDoc.ComponentDefinition
		For Each oParam As Inventor.Parameter In oAsm.ComponentDefinition.Parameters.UserParameters
			Dim paramInPart As Inventor.Parameter
			Try
				paramInPart = oDef.Parameters.UserParameters.Item(oParam.Name)
				Try
					paramInPart.Expression = oParam.Expression
				Catch
					paramInPart.Value = oParam.Value
				End Try
			Catch
				Try
					oDef.Parameters.UserParameters.AddByExpression(oParam.Name, oParam.Expression, oParam.Units)
				Catch
					oDef.Parameters.UserParameters.AddByValue(oParam.Name, oParam.Expression, oParam.Units)
				End Try
			End Try
		Next
	End If
Next