If the rules on the parts are internal rules create an internal rule on each part that runs the rules inside the part. For instance I have rules that assemble individual parts. In each part I have a single update rule. This rule then runs the needed internal rules. So on each parts you need to just run a single rule.
What I do in my assembly rule is insert the part. Set any internal parameters to their values in the part. (I do this by having a 'base part' that contains only parameters that each part derives from using only the parameters so if the base is updated all parts that use those parameters get the new values applied to them. Then I have an Update internal rule on those parts so I only have to run the update rule which I can do in a For Each statement on each component occurrence. This way I don't have to know which parameters goes with each part. I just look for an update rule and run that.
Here's code that will cycle through all to components and subcomponents in an assembly and run an update rule named "UpdateRule" if found. It keeps track of documents it's run the rule on so it doesn't run the update rule more than once on the same document.
Sub Main()
Dim docList As ArrayList = New ArrayList()
For Each co As ComponentOccurrence In ThisDoc.Document.ComponentDefinition.Occurrences
RunUpdateRule(co, docList)
Next co
End Sub
Sub RunUpdateRule (co As ComponentOccurrence, docs As ArrayList)
Dim cDocName As String
Dim cDoc As Document
cDoc = co.ReferencedDocumentDescriptor.ReferencedDocument
cDocName = cDoc.FullDocumentName
If Not docs.Contains(cDocName) Then
docs.Add(cDocName)
If cDoc.DocumentType = kAssemblyDocumentObject Then
For Each subCo As ComponentOccurrence In cDoc.ComponentDefinition.Occurrences
RunUpdateRule(subCo, docs)
Next subCo
End If
Try
iLogicVb.RunRule(co.Name, "UpdateRule")
Catch ex As Exception
'Do Nothing, Rule not found.
End Try
End If
End Sub