' set a reference to the assembly component definintion. ' This assumes an assembly document is open. Dim oAsmCompDef As AssemblyComponentDefinition oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition 'Iterate through all of the occurrences Dim oOccurrence As ComponentOccurrence For Each oOccurrence In oAsmCompDef.Occurrences 'check for and skip virtual components If Not TypeOf oOccurrence.Definition Is VirtualComponentDefinition Then 'set BOM as default if the component is visible If Component.Visible(oOccurrence.Name) = True Then Component.InventorComponent(oOccurrence.Name).BOMS​tructure = _ BOMStructureEnum.kDefaultBOMStructure 'set BOM as reference if the component is not visible ElseIf Component.Visible(oOccurrence.Name) = False Then Component.InventorComponent(oOccurrence.Name).BOMS​tructure = _ BOMStructureEnum.kReferenceBOMStructure End If Else End If Next