Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

setting ToString() decimal places

Status
Not open for further replies.

multicaduser

Industrial
Jan 29, 2013
261
In getting the sizes from the "ufs.Modl.AskBoundingBoxExact" function and creating a string from the distances, I'm having difficulty figuring out how to set the format decimal places to four using the "distances(0).ToString()".

In expressions I would use "format("%.4f",variable), but that doesn't work. Is there a way to set the decimal places directly or does it need to be done post conversion? Then there is the question of the function dropping trailing zeroes.

Can someone give me a hint?

tia

NX 12.0.1.7 Windows 10
 
Replies continue below

Recommended for you

Thanks again cowski, great help. Knuckle dragger that I am I found it a couple of minutes after posting.

distances(0).ToString("0.0000")

NX 12.0.1.7 Windows 10
 
Alternatively: ToString("F4") will give you four digits.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor