Cancel
Showing results for 
Search instead for 
Did you mean: 

Deselect objects in .net

Creator
Creator

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.

 

 

7 REPLIES

Re: Deselect objects in .net

Honored Contributor
Honored Contributor

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.

Re: Deselect objects in .net

Creator
Creator

Thanks for your reply. 

 

I would like to add my name to the ER, but I am quite new in this forum and am not able to find the ER list. Can you please explaine me how to access the ER?

Re: Deselect objects in .net

Creator
Creator

I have created a workaround for deselecting after execution of the program. 

 

I simply send a ESC-key to the program in order to deselect. It is not the best solution, but i works for now. I am still interested in another solution if anyone comes up with something better.

 

But for now I will close this case.  

Re: Deselect objects in .net

Pioneer
Pioneer
could you please send the code that you used to solve this problem.

thanks in advance

Re: Deselect objects in .net

Honored Contributor
Honored Contributor

Re: Deselect objects in .net

Creator
Creator

I have created this private method: 

 

private void deselectAll(){
IntPtr hwnd = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle;
SetForegroundWindow(hwnd);
SendKeys.SendWait("{ESC}");
}

Re: Deselect objects in .net

Pioneer
Pioneer
thanks cowski1 and PalleJuul ,it works fine.