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

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) :thumbs_up:.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)