Deselect objects after program execution

I use a selectionmanager (NXOpen.UI.GetUI().SelectionManager) in C# to access and modify objects. I have the problem, that I am not able to deselect the objects on the drawing after program execution.

I have tried with Unhighlight() for every selected object, and that removes the visual selection, but the objects are still selected in NX.

I have tried to use RemoveAllFromSelectionList(SelectionHandle, Boolean) at the selectionmanager. But I dont know how to create en usable instance of SelectionHandle. If someone can tell me how to do this, I belive this could be the key to my problem.

All suggestions or comments are appreciated.

Unless you are using the UI styler, there is no real way to use a selection list or deselect an object. There is an enhancement request (ER) logged with GTAC (ER 1785948). Contact GTAC and add your name to the ER; as more people request this functionality, the more priority it will be given.

Hi there,
I am no expert in this programming thing.
but some how I happen to find a work around with deselect thing.

this is what I did,

I have set an Undo mark ID and selected the objects ,and then immediately before processing the selected objects I am turning to my undo mark, making NX believe that nothing has happened.

Dim myface As Face
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Select the Face")
SelectAFace("get face", myface)
Dim marksRecycled1 As Boolean
Dim undoUnavailable1 As Boolean
theSession.UndoLastNVisibleMarks(1, marksRecycled1, undoUnavailable1)

Regards
Pradeep
#If it works, it works.

i found some useful thread in the eng-tips forum and someone has posted about recording a journal for File--> Utilities-->Part Cleanup --> and select the option 'Remove extraneous highlighting' and it worked for me.

below is the code from my recorded journal. You can add to any of your code.

Dim partCleanup As NXOpen.PartCleanup = Nothing
partCleanup = theSession.NewPartCleanup()
partCleanup.TurnOffHighlighting = True
partCleanup.DoCleanup()
partCleanup.Dispose()

Balaji