Cancel
Showing results for 
Search instead for 
Did you mean: 

Get user selection from screen in a "Navigator" - How to?

Phenom
Phenom

To all,

 

This question might be a bit more "advanced"? Is it possible to get a user's screen selection? See attached for example. In the simulation navigator if the user selects a few response simulations I'd like to put all the "names" selected into a collector/array (whatever is easier) to carry-out some post processing. If it is easier do to it in the 'XY Function Navigator' then this will work for me too!

 

Thanks

 

Regards

 

JXB

Production: NX9.0.3.4, NX10.0.2.6
Development: VB.NET (amateur level !)
8 REPLIES

Re: Get user selection from screen in a "Navigator" - How to?

Valued Contributor
Valued Contributor

You have access to the global selection using UI.GetUI().SelectionManager.GetNumSelectedObjects(); and

UI.GetUI().SelectionManager.GetSelectedTaggedObject(n);

The other option you have is to use a Select Object UI Block and query the list of selected objects.  You will need to create a dialog to use that option.

 

No matter what option you choose, you will need some kind of user action to trigger your code.  NX Open application code may only be called from a user action, either by selecting a menu item or by explicitly run the NX Open code from the File->Execute menu.

Re: Get user selection from screen in a "Navigator" - How to?

Phenom
Phenom

Thanks a lot for that. Would the followign work?

1. User select what is need/wanted

2. click on a custom button which called the appropriate .vb file

3. the .vb file gets all the user selection the proceed with each selection?

   For Each UserSelection In myArrayOfSelection

     'do something

   Next

 

Thanks

 

Regards

 

JXB

Production: NX9.0.3.4, NX10.0.2.6
Development: VB.NET (amateur level !)

Re: Get user selection from screen in a "Navigator" - How to?

Valued Contributor
Valued Contributor

Yes, that approach would work, as long as the global selection gets updated when you select your objects from the tree.  I mean by that the Deselect All icon should be active when you select your items from the Navigator.

Re: Get user selection from screen in a "Navigator" - How to?

Phenom
Phenom

Thanks. I have found this in the GTAC archive

 

http://community.plm.automation.siemens.com/t5/NX-Languages/Determine-user-selected-objects-on-custo...

 

I have just tested the code in the link above  and my selection is not regonised ie it is blank.(numsel = 0). I am working in the 'XY Function Navigator'

 

Thanks

 

Regards

 

JXB

 

 

Production: NX9.0.3.4, NX10.0.2.6
Development: VB.NET (amateur level !)

Re: Get user selection from screen in a "Navigator" - How to?

Valued Contributor
Valued Contributor

As already explained, if the global unselect icon stays grayed out, then whatever you selected is not part of the global selection.  I doubt an XY plot selection would work since there is nothing to highlight on the model.

Re: Get user selection from screen in a "Navigator" - How to?

Valued Contributor
Valued Contributor

Did you look at the XYPlotManager, which you can obtain an instance from the session using XYPlotManager()?  It might be what you are looking for.

 

Re: Get user selection from screen in a "Navigator" - How to?

I'm not sure how different CAM is, but we provide some vb samples that take actions on the nodes selected in the Operation Naviator. Take a look in UGOPEN\SampleNXOpenApplications\.NET\CAM\ for programs with "OntSelection" in their name.

 

Mark Rief
Retired Siemens

Re: Get user selection from screen in a "Navigator" - How to?

Phenom
Phenom

Thanks for the advice. I am looking at the .vb example and sure enough it's not straightforward (Don't know why SIEMENS issue such a "poor" manual. Maybe they do not want non-software engineer to leverage the tool capability, anyway..)

 

I do not really understand what the programme is doing but a line which could be of interest is 

theUfSession.UiOnt.AskSelectedNodes(selectedCount, selectedTags)

 so will have a look on Monday if there is somethng similar in the 'XY Function Manager'. When I checked after MAYA_'s suggestin there was nothing obvious

 

Will get back to the forum if I get to the bottom of it

 

Thanks

 

Regards

Production: NX9.0.3.4, NX10.0.2.6
Development: VB.NET (amateur level !)