03-28-2023
07:00 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
03-28-2023
07:00 AM
Hi @duans5FLJC. Here is one way to suppress the top level component pattern of a picked component that belongs to a lower level component pattern. It may not be 100% error free and effective in every scenario, but it works in most simple scenarios, and is fairly easy to look at and understand.
Sub Main
oObj = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyOccurrenceFilter, "Select a Component.")
If IsNothing(oObj) OrElse (TypeOf oObj Is ComponentOccurrence = False) Then Exit Sub
Dim oOcc As ComponentOccurrence = oObj
If oOcc.IsPatternElement Then
SuppressTopOccPattern(oOcc.PatternElement)
End If
End Sub
Sub SuppressTopOccPattern(oInputPE As OccurrencePatternElement)
Dim oOP As OccurrencePattern = oInputPE.Parent
If oOP.IsPatternElement Then
SuppressTopOccPattern(oOP.PatternElement)
Else
oOP.Suppress
End If
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)