Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Sergio.D.Suárez
in reply to: DewayneH

Hi, excuse me for being late to answer. It is a heavy week for me.
The first defect in what I proposed to you previously is the type of generated pattern. for that reason the code will not work for you.
Your pattern is driven by feature, so you should use the definition "FeatureBasedOccurrencePattern"

Dim oPatName As String = "Double Row Buckets"

Dim doc As AssemblyDocument = ThisDoc.Document
Dim oCD As AssemblyComponentDefinition = doc.ComponentDefinition

Dim oPatt As Inventor.FeatureBasedOccurrencePattern = oCD.OccurrencePatterns.Item(oPatName)

For Each oEl As Inventor.OccurrencePatternElement In oPatt.OccurrencePatternElements
	If BucketTrigger = 14 Then
		For Each oCC As ComponentOccurrence In oEl.Occurrences
			oCC.BOMStructure = 51969 
			oCC.Visible = True
		Next
	End If 
	If BucketTrigger = 6 Then
		For Each oCC As ComponentOccurrence In oEl.Occurrences
			oCC.BOMStructure = 51972
			oCC.Visible = False
		Next
	End If
Next


On the other hand, you are already importing into the assembly a parameter of the part that can serve as control of the assembly. I have entered this parameter inside the For - next instruction
Please check the assembly and make sure it meets your needs. I hope this helps with your work. Cheers


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn