Message 1 of 6
Change User Parameters only in first occurrence from the Top assembly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a rule that changes user parameters from the TOP assy inside component parts.
The problem is that the assembly has a lot of repetitve parts. and the rule checks for parameters inside each of the parts...
Do you know how can i check only in the first occurence of a part?
Here is the code:
Sub Main() Dim oDoc As AssemblyDocument = ThisApplication.ActiveDocument Dim oCompDef As AssemblyComponentDefinition = oDoc.ComponentDefinition Dim oOcc_s As ComponentOccurrences = oCompDef.Occurrences Dim oUserParams As UserParameters = oCompDef.Parameters.UserParameters 'look at each occurrence in the assembly For Each oOcc As ComponentOccurrence In oOcc_s 'update params for each occurrence UpdateParam(oOcc,oUserParams) Next ' iLogicVb.UpdateWhenDone = True End Sub Sub UpdateParam(occ As ComponentOccurrence, params As Inventor.UserParameters) If Component.IsActive(occ.Name) = True Dim oParams As Parameters = occ.Definition.Parameters For Each param As UserParameter In params Try oParams(param.Name).Value = param.Value Catch End Try Next For Each subOcc As ComponentOccurrence In occ.SubOccurrences UpdateParam(subOcc, params) Next End If iLogicVb.UpdateWhenDone = True End Sub