Actually, in reference to either the 'Structured' view or 'Parts Only' view of the BOM, I believe that even if there are multiple instances of that same occurrence within the assembly, and you set one or more instances of that component to Reference, but not all of them, it will simply change the total quantity of that component shown within that one line of the BOM, instead of change the state of the whole line in the BOM.
But in reference to the 'Model Data' tab of the BOM, when some, but not all, of the instances of a component are set to Reference, while the rest remain as Default, it will also reduce the total quantity of that component in the one line of the BOM, but it will also create a new line in the BOM to represent just the quantity of that component that have been set to Reference, so they are still being represented/accounted for.
@Cosmin_V
Here is a fairly simple iLogic rule that will loop through all components in your assembly, and if the component's name starts with that component's name (without the part after the colon ":"), it will check it's visibility. If it is not visible, it will attempt to set its BOMStructure to Reference, or if it is visible, it will attempt to set it to Default.
If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kAssemblyDocumentObject Then
MsgBox("An Assembly Document must be active for this rule to work. Exiting.",vbOKOnly+vbCritical, "WRONG DOCUMENT TYPE")
Exit Sub
End If
Dim oADoc As AssemblyDocument = ThisApplication.ActiveDocument
Dim oADef As AssemblyComponentDefinition = oADoc.ComponentDefinition
For Each oComp As ComponentOccurrence In oADef.Occurrences
If oComp.Name.StartsWith("00255026") Then
If Not oComp.Visible Then
Try
oComp.BOMStructure = BOMStructureEnum.kReferenceBOMStructure
Catch
MsgBox("Couldn't set component's BOMStructure to Reference.",,"")
End Try
Else
Try
oComp.BOMStructure = BOMStructureEnum.kDefaultBOMStructure
Catch
MsgBox("Couldn't set component's BOMStructure to Default.",,"")
End Try
End If
End If
Next
Keep in mind though, that if you plan on 'suppressing' these components, you may then have to start dealing with Level of Detail representations (LOD's) to store their suppression state, and it won't let you suppress components if you are currently in either the Master LOD or a locked LOD.
If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.
If you want and have time, I would appreciate your Vote(s) for My IDEAS 💡or you can Explore My CONTRIBUTIONS
Wesley Crihfield

(Not an Autodesk Employee)