I push parameter values down through an assembly like this...
Public Sub Main()
'Assume that we won't be overriding the material right at the top level
'so recurse down through the subassembly/part hierarchy
'when drawer assembly Or_PanelMat True stop looking; when parameter does not exists children rule fails, cannot find parameter in children
'when Or_PanelMat exists in all components rule runs as expected
Call HandleSubAssemblies(ThisDoc.Document.ComponentDefinition.Occurrences)
End Sub
Public Sub HandleSubAssemblies(ByVal oOccurrences As ComponentOccurrences)
'Called recursively for each assembly level
Dim compo As ComponentOccurrence
Dim MatThick As String
For Each compo In oOccurrences
If compo.DefinitionDocumentType = kAssemblyDocumentObject Then
'This is an assembly document so we want to go down to the next level
'unless it is marked as override material in which case we want to stop going
'down at this point
If Parameter(compo.Name,"Or_PanelMat") = False Then
'call this method recursively to go to a lower level
Call HandleSubAssemblies(compo.SubOccurrences)
End If
ElseIf compo.DefinitionDocumentType = kPartDocumentObject Then
'This is a part so if we aren't overriding the panel material
'for this part then we'll figure out the required material
'***********************************************************************
'*** NOTE : if override material for the immediate parent assembly is true
'*** then we'll never get here
'***********************************************************************
If Parameter(compo.Name,"Or_PanelMat") = False Then
If Len(iProperties.Value(compo.Name, "Custom", "MThick")) > 6 Then
MatThick = Left(iProperties.Value(compo.Name, "Custom", "MThick"),
iProperties.Value(compo.Name, "Custom", "PanelMat") = "PartVis"
End If
End If
End If
Next
End Sub