Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

NX "Expressions" Syntax 1

Status
Not open for further replies.
It looks like there is an ELSE missing

NX 9.0.3.4
NX 10 (Testing)
Windows 7 64 (Windows 8.1 Tablet)
 
Can you post the actual text of the formula (rather than a picture) and a detailed description of what you want it to do?
 
So, the main problem I see here is that you've written a perfectly valid formula... for Excel. :-)

The easiest "conditional" syntax in NX expressions is:

[pre]if (a) then (b) else (c)[/pre]

It looks like you're trying to use the Excel IF(a,b,c) syntax for your conditional here, and that's just not going to work. :-)

Similarly, the INT() function is an Excel function but not an NX function. The NX equivalent (to round a number down to the nearest integer) is floor().

The ROUND() function also works a little differently. The NX function just rounds to the nearest integer, and doesn't have the argument for five decimal places like you've used here, so we'll need to nudge it a bit to move your answer out to the fifth decimal where you want it:

[pre]round( target_number * 1e5 ) / 1e5[/pre]

In other words, multiply the target number by 10^(the desired precision), round the big number, and then divide back to the order of magnitude you want. Make sense?

So, if I've interpreted it correctly, your final formula should look more like:

[pre]round( 0.86159^( 8 - if(FRAME>28) then(28) else( if(FRAME<2) then(2) else( floor( FRAME / 2 ) * 2 ) ) / 2 ) * 1e5 ) / 1e5[/pre]

[I've obviously got some spaces in here, just for readability... You can include or not include those... The NX expressions engine will just ignore the whitespace in the end.]

...which generates a really nice scaling factor (of 0.35246 and 2.44453) for FRAME sizes between 2 and 28 and catches bad input outside the 2-28 range for FRAME.

Slick. That's a nice formula. :-)

Does that help?

Taylor Anderson
NX Product Manager, Knowledge Reuse and NX Design
Product Engineering Software
Siemens Product Lifecycle Management Software Inc.
(Phoenix, Arizona)
 
Thanks for the help, I solved the problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top