Hi Infoseeker,
If you are use the iLogic function IsActive to suppress component instances, their BOM structure is set to Reference. Therefore the suppressed occurrence, and only that occurrence will be removed from the BOM.
So IsActive not only suppresses the occurrence it also set's it's BOM structure as if you'd right clicked on it and selected BOM Structure > Reference. Recall that this is different that setting the BOM structure in the BOM editor or via the Document Settings, those 2 methods set it per file, rather than per assembly occurrence.
With this in mind here is an example rule. In this rule you select an item (on screen or in the browser, and it will be toggled on/off, and removed or added to the BOM. This is just a quick example to demonstrate the concept.
But to speak to the original request: I suspect you could use this idea to look at each occurrence in an assembly and check it's visibility setting (per the current Design View Representation) and then toggle the BOM structure for that occurrence to Reference if the occurrence is not visible.
I'm short on time, so I can't have a look at this anytime soon, but I thought I'd throw this out in case someone else wants to give it a shot.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
'set a reference to the assembly component definition.
'this assumes an assembly document is open.
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
'get currently selected component
Dim oOccurrence as ComponentOccurrence
Try
oOccurrence = ThisDoc.Document.SelectSet.Item(1)
Catch
MessageBox.Show("Please select a component before running this rule.", "iLogic")
Return
End Try
'set the selected item
'oOccurrence = ThisApplication.ActiveDocument.SelectSet.Item(1)
'activate the Master LOD so we can read in the names of all the components
oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations("Master").Activate
InventorVb.DocumentUpdate(False)
'define an arraylist to hold the list of LOD rep names
Dim NameList As New ArrayList()
'define LOD rep
Dim oLODRep As LevelOfDetailRepresentation
'Look at the LOD reps in the assembly
For Each oLODRep In oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations
'set the list of names to the array list
NameList.add(oLODRep.Name)
Next
'check for an iLogic LOD rep and create it if not found
If Not NameList.Contains("iLogic LOD") Then
'create iLogic LOD
oLODRep = oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Add("iLogic LOD")
oLODRep.Activate
Else
oLODRep.Activate
End If
'Toggle the selected component's active status
If Component.IsActive(oOccurrence.Name) = True Then
Component.IsActive(oOccurrence.Name) = False
Else
Component.IsActive(oOccurrence.Name) = True
End If
'Save File (set LOD changes)
ThisDoc.Save
