I see, so you want to delete the Patterns of a particular PatternElement Occurrence? There is a lot to consider at each step, will there be multiple occurrences per PatternElement or does each occurrence that gets patterned have it's own set of Patterns?
The Code below will collect all parent patterns of a selected occurrence and deletes them [It does not check to see if multiple occurrences were patterned in the same ComponentPattern]:
Sub Main
Dim ocList As New List(Of String)
For Each oc As ComponentOccurrence In ThisApplication.ActiveDocument.ComponentDefinition.Occurrences
If oc.DefinitionDocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then ocList.Add(oc.Name)
Next
Dim Selection As String = InputListBox("", ocList, ocList.Item(0), Title := "Item to Remove", ListName := "Sub Assemblies")
If IsNothing(Selection) Then Exit Sub 'No selection made
'Use from here down with your desired Occurrence:
Dim selOcc As ComponentOccurrence = ThisApplication.ActiveDocument.ComponentDefinition.Occurrences.ItemByName(Selection)
Dim pFeature As Object = selOcc.PatternElement.Parent
If selOcc.IsPatternElement
Dim Col As ObjectCollection = FindTopMostParent(selOcc)
Dim i As Integer = Col.Count
While i > 0
Col.Item(i).Delete
i = i-1
End While
End If
selOcc.Delete
End Sub
Function FindTopMostParent(Oc As ComponentOccurrence) As ObjectCollection
Dim Result As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection
Dim level1 As OccurrencePattern = Oc.PatternElement.Parent
LoopHere :
Result.Add(level1)
If level1.IsPatternElement
level1 = level1.PatternElement.Parent
GoTo LoopHere
End If
Return Result
End Function
Let me know if you have any questions, or if it is not working as intended