Here is some example iLogic rule code to help you along. It first makes sure that it is working with a part, not an assembly or drawing. Then gets the rectangular pattern features collection. Then tries to find a specific one by its name (as seen in the model browser tree). If it can not be found, it will let you know, then exit the rule. It then looks for a specific element directly within that patter, at a specific index (using the posted image as an example, so 8 in this case). Again, if it can not be found, it will let you know, then exit the rule. If found, it will 'toggle' its suppressed status. So, if it was suppressed before, it will be unsuppressed, and if unsuppressed, it will suppress it. Then it updates the part, if that worked, and it gets that far.
Sub Main
Dim oPDoc As PartDocument = TryCast(ThisDoc.Document, Inventor.PartDocument)
If oPDoc Is Nothing Then Return
Dim oRPFs As RectangularPatternFeatures = oPDoc.ComponentDefinition.Features.RectangularPatternFeatures
Dim oMyRPF As RectangularPatternFeature = Nothing
For Each oRPF As RectangularPatternFeature In oRPFs
If oRPF.Name = "Rectangular Pattern1" Then
oMyRPF = oRPF
Exit For 'exit iteration once found
End If
Next
If oMyRPF Is Nothing Then
MsgBox("Pattern Not Found!", vbCritical, "iLogic")
Return
End If
Dim oMyFPE As FeaturePatternElement = Nothing
For Each oFPE As FeaturePatternElement In oMyRPF.PatternElements
If oFPE.Index = 8 Then
oMyFPE = oFPE
Exit For 'exit iteration once found
End If
Next
If oMyFPE Is Nothing Then
MsgBox("Pattern Element At That Index Not Found!", vbCritical, "iLogic")
Return
End If
'Toggle its suppressed status
oMyFPE.Suppressed = Not oMyFPE.Suppressed
oPDoc.Update()
End Sub
If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.
Wesley Crihfield

(Not an Autodesk Employee)