Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Thanks this helped me a lot also works for RectangularPatternFeature to swap around ParentFeature

 

Public Sub ChangeElem(oPartDef As PartComponentDefinition, oDoc As Document)

    Dim oPartFeature As PartFeature
    Set oPartFeature = oPartDef.features.HoleFeatures.Item("TRP3_HOLE")

    Dim oRPF As RectangularPatternFeature
    Set oRPF = oPartDef.features.RectangularPatternFeatures.Item("TopPattern")
    
    Dim objCol As ObjectCollection
    Set objCol = oRPF.Definition.ParentFeatures


'I added the clear so I can swap the old ParentFeature with a new one
    Call objCol.Clear
    Call objCol.Add(oPartFeature)
    
    oRPF.Definition.ParentFeatures = objCol
    oRPF.Definition.NaturalXDirection = False
    oDoc.Update

End Sub