List suppressed components in LOD

<?xml encoding=”UTF-8″>By Adam Nagy

When a given LOD (Level Of Detail) is active inside Inventor that simply means that you are looking at a specific document inside the file: each LOD is a separate document stored inside the same file – see File vs Document 

If you want to list which components are suppressed inside a given LOD – not the one currently active in the UI – then you don’t have to activate it just for that. You can simply open that LOD document in the background, check which components are suppressed, then close the document if it’s not the currently active LOD:

Sub ListWhatsSuppressed()
Dim asm As AssemblyDocument
Set asm = ThisApplication.ActiveDocument
Dim acd As AssemblyComponentDefinition
Set acd = asm.ComponentDefinition
Dim rm As RepresentationsManager
Set rm = acd.RepresentationsManager
Dim nvm As NameValueMap
Set nvm = ThisApplication.TransientObjects.CreateNameValueMap()
Dim doc As AssemblyDocument
Dim occ As ComponentOccurrence
Dim lod As LevelOfDetailRepresentation
For Each lod In rm.LevelOfDetailRepresentations
Debug.Print lod.name
Call nvm.Add("LevelOfDetailRepresentation", lod.name)
Set doc = ThisApplication.Documents.OpenWithOptions( _
asm.FullFileName, nvm, False)
Call nvm.Clear
For Each occ In doc.ComponentDefinition.Occurrences
Debug.Print " >> " + occ.name + _
" Suppressed = " + Str(occ.Suppressed)
Next
' Don't forget to close the document not used anymore
If Not lod Is rm.ActiveLevelOfDetailRepresentation Then
Call doc.Close(True)
End If
Next
End Sub

In this document I added two of my own LOD‘s as well: one has Combo Assembly, the other has Catch Post component suppressed:

Suppressed

The above VBA code gives the following result:

Master
>> Combo Assembly:1 Suppressed = False
>> Catch Post:1 Suppressed = False
>> Lock Shackle:1 Suppressed = False
>> Case Inner:1 Suppressed = False
>> Case Outer:1 Suppressed = False
>> Case Back:1 Suppressed = False
>> Dial:1 Suppressed = False
>> Catch Assembly:1 Suppressed = False
>> Catch:2 Suppressed = False
>> Retainer:1 Suppressed = False
All Components Suppressed
>> Combo Assembly:1 Suppressed = True
>> Catch Post:1 Suppressed = True
>> Lock Shackle:1 Suppressed = True
>> Case Inner:1 Suppressed = True
>> Case Outer:1 Suppressed = True
>> Case Back:1 Suppressed = True
>> Dial:1 Suppressed = True
>> Catch Assembly:1 Suppressed = True
>> Catch:2 Suppressed = True
>> Retainer:1 Suppressed = True
All Parts Suppressed
>> Combo Assembly:1 Suppressed = False
>> Catch Post:1 Suppressed = True
>> Lock Shackle:1 Suppressed = True
>> Case Inner:1 Suppressed = True
>> Case Outer:1 Suppressed = True
>> Case Back:1 Suppressed = True
>> Dial:1 Suppressed = True
>> Catch Assembly:1 Suppressed = False
>> Catch:2 Suppressed = True
>> Retainer:1 Suppressed = True
All Content Center Suppressed
>> Combo Assembly:1 Suppressed = False
>> Catch Post:1 Suppressed = False
>> Lock Shackle:1 Suppressed = False
>> Case Inner:1 Suppressed = False
>> Case Outer:1 Suppressed = False
>> Case Back:1 Suppressed = False
>> Dial:1 Suppressed = False
>> Catch Assembly:1 Suppressed = False
>> Catch:2 Suppressed = False
>> Retainer:1 Suppressed = False
ComboSuppressed
<strong>>> Combo Assembly:1 Suppressed = True</strong>
>> Catch Post:1 Suppressed = False
>> Lock Shackle:1 Suppressed = False
>> Case Inner:1 Suppressed = False
>> Case Outer:1 Suppressed = False
>> Case Back:1 Suppressed = False
>> Dial:1 Suppressed = False
>> Catch Assembly:1 Suppressed = False
>> Catch:2 Suppressed = False
>> Retainer:1 Suppressed = False
CatchSuppressed
>> Combo Assembly:1 Suppressed = False
<strong> >> Catch Post:1 Suppressed = True</strong>
>> Lock Shackle:1 Suppressed = False
>> Case Inner:1 Suppressed = False
>> Case Outer:1 Suppressed = False
>> Case Back:1 Suppressed = False
>> Dial:1 Suppressed = False
>> Catch Assembly:1 Suppressed = False
>> Catch:2 Suppressed = False
>> Retainer:1 Suppressed = False

Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading