Inventor Apprentice: Opening an Assembly Document without loading subcomponents

by Vladimir Ananyev

Issue

Is it possible to open an Assembly Document using Inventor Apprentice without loading all the subcomponents?

Solution

Yes, using the LevelOfDetailRepresentation feature in Inventor, you have control over the components those have been getting loaded when opening the assembly document.

If "All Components Suppressed" representation is used, then the subcomponents will not be loaded.

Sub Main()

 

  Dim oApp As ApprenticeServerComponent _

    = New ApprenticeServerComponent()

 

  Dim FileName As String = "C:\Users\Public\Documents\Autodesk\Inventor 2014\Samples\Models\Assemblies\Stapler\Stapler.iam"

 

  Dim LODsNames() As String

  LODsNames = oApp.FileManager _

    .GetLevelOfDetailRepresentations(FileName)

 

  Debug.Print(vbNewLine & "==========================")

  Debug.Print("Assembly: " & FileName)

  Debug.Print("LOD names:")

  For Each LODName As String In LODsNames

    Debug.Print(LODName)

  Next

  Debug.Print(vbNewLine)

 

  Dim oFileManager As FileManager = oApp.FileManager

 

  ‘0 – Master

  ‘1 – All Components Suppressed

  ‘2 – All Parts Suppressed

  ‘3 – All Content Center Suppressed

  ‘4 – custom LoDs

  Dim LodNo As Integer = 2

  Dim DocName As String = oFileManager _

    .
GetFullDocumentName(FileName, LODsNames(LodNo))

  Debug.Print("Open DocName: " & DocName)

 

  ‘ Open the document

  Dim oDoc As ApprenticeServerDocument = oApp.Open(DocName)

 

  ‘Check the number of files in memory

  Debug.Print("Files in memory:   Files.Count = " _

              & oFileManager.Files.Count)

  For Each oFile As File In oFileManager.Files

    Debug.Print(oFile.FullFileName)

  Next

  Debug.Print(vbNewLine)

 

  oDoc.Close()

  oApp.Close()

<

p style=”line-height: normal;margin: 0cm 0cm 0pt” class=”MsoNoSpacing”>End Sub


Comments

Leave a Reply

Discover more from Autodesk Developer Blog

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

Continue reading