Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

Populating a drop down in PTS from spread sheet column

Status
Not open for further replies.

mmiscool

Electrical
Sep 14, 2012
34
0
0
US
Hello,

I am on NX 9 and would like to make a drop down in a PTS dialog be populated by a column from an excel spread sheet.

It looks like this may be possible but I cant seem to figure out how to do it.

Any help would be appreciated.


nx 9, TC 10
 
Replies continue below

Recommended for you

mmiscool:

Two steps here...

1. Pull the spreadsheet column into a list expression

To do this, you can use one of the new DesignLogic functions we added in NX 9 to do this:

[tt]ug_read_fixed_list()[/tt] is the simple one. It takes a spreadsheet name and a cell range as inputs. It returns the contents of the range in a list.

[tt]ug_read_list()[/tt] is a little bit cooler. It takes a spreadsheet name, a reference to a single starting cell, and a vertical/horizontal Boolean toggle (vertical = true = default) as inputs. It will then start at the starting cell and start collecting values either below or to the right (depending on the toggle) of the starting cell, until it hits an empty cell.

So for a spreadsheet like this:

150323_PTS_list_menus_01.png


You will get these kinds of results:

150323_PTS_list_menus_02.png


See how that works?

And as you might suspect, if you use the [tt]ug_read_list()[/tt] flavor, items can be added to and removed from the list quite dynamically, and NX can respond to that. More on that in a second.

So, once you've got your lists from the spreadsheet into a List Expression, you can:

2. Inside PTS, use the new "List Expression" display style (at the bottom of the list.)

150323_PTS_list_menus_03.png


Populate the "list expression" field by dragging and dropping the desired list expression from the Model Explorer (the table with the eyeball on it) into the field:

150323_PTS_list_menus_04.png


And then figure out which other settings you want. (Including the usual "index vs. indexed value" question.) :)

Setting "Immediate Update" to "For external change" will re-ping the spreadsheet dynamically, looking for new values. Of course, there's a tradeoff here, as this will also ping ALL external sources referenced by parts in session (all referenced spreadsheets, Teamcenter Requirements, etc.) so this may or may not be a "heavy" operation, depending on how you work and where these files are located (native O/S, in TC, etc.)

And of course, you could also use this to pull a list of strings from your spreadsheet, and then drive your model logic based on the "index", just like you could before NX 9.

Does this all make sense?

More cool functionality coming in this area in NX 11, by the way... Come to PLM World in Dallas and I'll show you a sneak peek. :-D

Taylor Anderson
NX Product Manager, Knowledge Reuse and NX Design
Product Engineering Software
Siemens Product Lifecycle Management Software Inc.
(Phoenix, Arizona)
 
Status
Not open for further replies.
Back
Top