if you know that you need holes (or any other feature) but dont need them in evry situation, then you could also create them (like you would normaly) and suppress the holes that you dont need. In that case you dont need to write a compicated rule that create holes. In this example i have 4 holes that need to be suppressed or not depending of the value of the parameter "Length".
Dim doc As PartDocument = ThisDoc.Document
Dim holeFeatures As HoleFeatures = doc.ComponentDefinition.Features.HoleFeatures
Dim hole1 As HoleFeature = holeFeatures.Item("Hole1")
Dim hole2 As HoleFeature = holeFeatures.Item("Hole2")
Dim hole3 As HoleFeature = holeFeatures.Item("Hole3")
Dim hole4 As HoleFeature = holeFeatures.Item("Hole4")
If (length > 10) Then
hole1.Suppressed = True
hole2.Suppressed = False
hole3.Suppressed = True
hole4.Suppressed = True
ElseIf (length < 5) Then
hole1.Suppressed = True
hole2.Suppressed = False
hole3.Suppressed = False
hole4.Suppressed = True
Else
hole1.Suppressed = True
hole2.Suppressed = True
hole3.Suppressed = True
hole4.Suppressed = True
End If
There is also an easyer solution if your conditions are very simple. (like suppress hole if "Length" > 10 and in all other cases you need to see it.) Afther you created the hole (or any other feature) right click on it and select "Properties". In the forum select suppress "if" and set your condition. If you do this then you dont need to write any code.

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

Blog: hjalte.nl - github.com