Select LevelOfDetailRepresentation by user

Select LevelOfDetailRepresentation by user

GeorgK
Advisor Advisor
578 Views
6 Replies
Message 1 of 7

Select LevelOfDetailRepresentation by user

GeorgK
Advisor
Advisor

Hello together,

I would like to let a user select the LevelOfDetailRepresentation in the browser. How could I do this?

Thanks

Georg

0 Likes
Accepted solutions (1)
579 Views
6 Replies
Replies (6)
Message 2 of 7

rjay75
Collaborator
Collaborator

In what way would you like the user to make the selection? Is the selection part of a dialog and you want to get and present a list of choices?

0 Likes
Message 3 of 7

GeorgK
Advisor
Advisor

Hello Rodney,

 

I have some custom LevelOfDetailRepresentations. In the program I would like to get one of the custom LOFs which the user choose from the browser.

 

Thats the program, which I tried to convert to VB.Net

http://forums.autodesk.com/t5/inventor-general-discussion/suppress-component-in-multiple-level-of-de...

 

Georg

0 Likes
Message 4 of 7

rjay75
Collaborator
Collaborator

So you would like the user to use the browser to select the LevelOfDetail they want to select which may or may not be the current levelofdetail?

0 Likes
Message 5 of 7

GeorgK
Advisor
Advisor

LOD.jpg

It could be the current LOD but it must not be the current LOD.

0 Likes
Message 6 of 7

rjay75
Collaborator
Collaborator
Accepted solution

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
Message 7 of 7

GeorgK
Advisor
Advisor

Hello Rodney,

 

thank you very much for the code. I try it today.

 

Georg

0 Likes