Find Excluded component patterns in an assembly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have an iassembly with some lengthy and unique ilogic to control what parts are included / excluded based on user inputs in a form. To begin, the program includes all components, and then excludes the ones that aren't needed. This is basically, briefly what the first part of that looks like:
For Each oCompOcc In oCompDef.Occurrences
i=i+1
'Include all currently excluded components
If oCompOcc.Excluded=True Then
oAssObj=oCompDef.Occurrences.Item(i)
oDoc.SelectSet.Select(oAssObj)
ThisApplication.CommandManager.ControlDefinitions.Item("ExcludeCtxCmd").Execute()InventorVb.DocumentUpdate()
Else
End If
Next
InventorVb.DocumentUpdate()
So this works just fine, mostly. I run into an issue with the component occurrences that are within patterns (I have 2 patterns - 1 circular and 1 rectangular). This code will "Include" all occurrences inside an "Excluded" pattern, but the pattern itself remains "Excluded". In other words, in the browser, the pattern name appears greyed out and crossed out, but all the elements and the components within them appear "alive", so to speak. But the BOM indicates a Qty. of ZERO for these components since the pattern that.
I can toggle include / exclude of patterns using the same method:
oDoc.SelectSet.Select(oPattern)
ThisApplication.CommandManager.ControlDefinitions.Item("ExcludeCtxCmd").Execute()
But it seems I can't identify which patterns are excluded to start with, like:
If oPattern.Excluded=True Then...
I get an error when I try this. Is there a way around it? Am I missing something? How can I find and select excluded component patterns in order to toggle them to "Include"?
Ideas?
Thanks.