Showing results for 
Search instead for 
Do you mean 
Solved! Go to solution

Deselect objects in .net

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.




Re: Deselect objects in .net

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

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?

Accepted by topic author PalleJuul
‎08-26-2015 04:32 AM

Re: Deselect objects in .net

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

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

thanks in advance

Re: Deselect objects in .net

Re: Deselect objects in .net

I have created this private method: 


private void deselectAll(){
IntPtr hwnd = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle;

Re: Deselect objects in .net

thanks cowski1 and PalleJuul ,it works fine.