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 TugboatEng 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
Joined
Jan 29, 2013
Messages
261
Location
US
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
 
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

Back
Top