Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
rjay75
in reply to: GeorgK

Attached is code that will get the return the current user selected Level of Detail. The  GetSelectedLevelOfDetail function is the only portion needed. The main sub is just to test the function.

 

Snippet

    'Sample of how to call function
Sub Main()         Dim lod As LevelOfDetailRepresentation = Nothing         lod = GetSelectedLevelOfDetail(True)         If Not lod Is Nothing Then MessageBox.Show(lod.Name)     End Sub     'Get Current Selected LevelofDetail, set customOnly to True to only return custom LODs     Function GetSelectedLevelOfDetail(customOnly As Boolean) As LevelOfDetailRepresentation         'Get the Document Selection Set         Dim ss As SelectSet = ThisDoc.Document.SelectSet         Dim selectedLOD As LevelOfDetailRepresentation = Nothing         'Check that only one item is selected         If ss.Count = 1 Then             'Check to see if it's a level of detail item             If ss(1).Type = ObjectTypeEnum.kLevelOfDetailRepresentationObject Then                 Dim lod As LevelOfDetailRepresentation = ss(1)                 If customOnly Then                     'Set only if its a custom level detail                     If (lod.LevelOfDetail = LevelOfDetailEnum.kCustomLevelOfDetail) Then selectedLOD = lod                 Else                     'Set if any kind will do                     selectedLOD = lod                 End If             End If         End If         Return selectedLOD     End Function