Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

weight attribute NX6

Status
Not open for further replies.

jerry1423

Mechanical
Aug 19, 2005
3,428
Below is what is the expression to create a weight part attribute. "mass" is equal to the expression from the body measurement feature that is the mass of the solid, in my case, mass=p38

weight_attribute = ug_setPartAttrValue("WEIGHT",format("%0.2f",mass))

In "%0.2f"
What is the symbol that comes before the zero?
The "2" is the number of decimal places.
What does the "f" refer to?


 
Replies continue below

Recommended for you

I am sorry, the percent sign comes before the zero.
It was not until I posted this that I could see that - In the text editor it looks differnt.
 
The format() function seems to use C printf formating syntax where f stands for decimal floating point number, Google "printf" for more information.


// Petter
 
Here is a good link you should bookmark:


It will show you most all of the so-called 'C-style String Formatting Commands' which is the basis for what we did with the NX Expression system for string formating. Now I can't guarantee that NX supports ALL of the items that you will find on this webpage, but ALL of the ones we DO support are covered there somewhere.

John R. Baker, P.E.
Product 'Evangelist'
Product Design Solutions
Siemens PLM Software Inc.
Industry Sector
Cypress, CA

To an Engineer, the glass is twice as big as it needs to be.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor