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

Adding Object to the Global Selection List



I want to clear the Global Selection List of the NX and Add a object to the selection List So that my tool gets the Preselected Object from the Code   "theUFSession.Ui.AskGlobalSelObjectList(out numOfPreSelected, out preSelectedObjs);"


I found two methods to do this 

theUFSession.Ui.AddToSelList    or 


But I am unable to give the right agruments to either of the Methods.

Please Guide to add the Proper Arguments to these methods, if these are correct method to solve my issue.






Re: Adding Object to the Global Selection List

If you are in a version before NX11, you will need to either use a pre-NX6 UIStyler dialog or the UF_UI_select_with_class_dialog() in order to use those functions.


In NX11, there is a new class called SelectionSubscriber that should allow you to add objects to the global selection list.


Re: Adding Object to the Global Selection List

Hi Steve


I am using NX11 and i have context menu and selection subscriber active in my Tool. And i am able to popup my context menu for the selected object. The Context Menu has button for my Tool in the graphical area. But i want to clear the selection list and add only the udo associated with that selected object in the selection list so that if a user open my tool from the context menu then the tool would be able to work as per preselected object.


It is woking fine when User is selecting UDOFeature from the part navigator context menu because NX automatically add that UDOfeature in the selection List as User makes a right click on them.


So in Nutshell, I want to add the object to selection list when control is in the context menu callback.

Can you help me how to add the object in the Global selection List using Selection Subscriber.


Thanks for the Reply.


Accepted by topic author Gunjeet
‎04-04-2017 11:23 AM

Re: Adding Object to the Global Selection List



 I found a code that works very well for me.




Thanks Everyone for help.