Open assembly using last level of detail. API Sample

Description

This sample demonstrates how to open an assembly document in its last active Level of Detail Representation.

Code Samples

Public Sub OpenDocumentInLastActiveLOD()
    Dim strFullFileName As String
    strFullFileName = "C:\temp\Assembly1.iam"
    
    ' Set a reference to the FileManager object.
    Dim oFileManager As FileManager
    Set oFileManager = ThisApplication.FileManager
    
    ' Get the name of the last active Level of Detail (LOD) Representation.
    Dim strLastActiveLOD As String
    strLastActiveLOD = oFileManager.GetLastActiveLevelOfDetailRepresentation(strFullFileName)
    
    ' Use the full file name and LOD name to get the full document name.
    Dim strFullDocumentName As String
    strFullDocumentName = oFileManager.GetFullDocumentName(strFullFileName, strLastActiveLOD)
    
    ' Open the document in the last active LOD.
    Dim oDoc As AssemblyDocument
    Set oDoc = ThisApplication.Documents.Open(strFullDocumentName)
End Sub