Cancel
Showing results for
Did you mean:

# Expressions: Round to the decimal places

Phenom

In  Expressions, how could I  “Round a number to the decimal places I want”?

Like in Excel; A1 contains 823.7825

Type = ROUND(A1,3) which equals 823.783

Michael Fernando

Die Designer
NX 11.0.2.7 + PDW

7 REPLIES

# Re: Expressions: Round to the decimal places

Siemens Phenom

First off, in NX we would never round 823.7825 to 823.783.  Rather it would be rounded to 823.782.

In the Expression dialog, you'll find the various functions by selecting the f(x) icon.  The function you're looking for is named round().  Now this function only returns an integer so you will need to decimalize your input/output.

Attached is a part file with a series of Expressions showing how to do this.  There is an Expression for the original number, 'Number_in', and the Decimal places, 'Number_of_decimal_places'.  The rounded number is returned by the Expression 'Number_out'.

Anyway, I hope this helps.

John R. Baker, P.E. (ret)
EX-Product 'Evangelist'
Irvine, CA

# Re: Expressions: Round to the decimal places

Phenom

Thanks John, I could make it work the way described. Wish the method was easier.

Michael Fernando

Die Designer
NX 11.0.2.7 + PDW

# Re: Expressions: Round to the decimal places

Gears Esteemed Contributor

If you want to reference the value in a note on a drawing, you can specify the number of decimal places to use. In the note dialog, expand the "symbols" section and choose the "relationships" category. Click "insert expression", choose your expression and enter "0.3" for the format (a leading zero with three decimal places).

# Re: Expressions: Round to the decimal places

Phenom

It’s to automate the calculation of model parameters in repetitive work. Tooling is in inch and their products are in metric which creates this messy situation.

Michael Fernando

Die Designer
NX 11.0.2.7 + PDW

# Re: Expressions: Round to the decimal places

Gears Esteemed Contributor

If you are working with the actual values, I'm not sure why you would want/need to round the values?

If you are working in an inch file, you can enter a metric value such as "20 mm" and NX will keep the value in metric, but convert the values for its own use.

# Re: Expressions: Round to the decimal places

Phenom

The product is consist with three parts with thickness in mm values; 0.4mm+0.15mm+0.9mm= 1.45mm (0.0570866….)

It’s a good practice to establish rounded base numbers for clarity, to avoid confusion at a latter stages especially when adding clearances and stackup values in the assembly.

Michael Fernando

Die Designer
NX 11.0.2.7 + PDW

# Re: Expressions: Round to the decimal places

Valued Contributor

Also try

round(Number_in*10^Number_of_decimal_places)/(10^Number_of_decimal_places)

Cord