Message 1 of 2
Exclude/remove component occurrence from existing rectangular/circular pattern

Not applicable
05-05-2011
06:59 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everybody,
I am trying to create VBA macro in IV2011 which will delete all occurrences of content center parts from an assembly. I found the way how to delete occurrences from an assembly, but I can't find the way how to delete occurrences when they are members of rectangular or circular pattern. I was trying to exclude them from pattern but code which I wrote doesn't work (see below). It doesn't give me any error message. Any suggestion what I did wrong?
Public Sub RemoveOcc() Dim oDoc As Document Set oDoc = ThisApplication.ActiveDocument Dim oAsmDoc As AssemblyDocument Set oAsmDoc = oDoc Dim oAsmCompDef As AssemblyComponentDefinition Set oAsmCompDef = oAsmDoc.ComponentDefinition Dim oAsmOccPattern As OccurrencePattern Set oAsmOccPattern = oAsmCompDef.OccurrencePatterns.Item(1) Dim oAsmCompOcc As ComponentOccurrence Set oAsmCompOcc = oAsmOccPattern.ParentComponents.Item(1) Call oAsmOccPattern.ParentComponents.RemoveByObject(oAsmCompOcc) End Sub
Thank you,