×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Attributes and expressions

Attributes and expressions

Attributes and expressions

(OP)
Hi,

How can I link the attributes with the expressions?

I would like to make an attribute "Length" which has to refer to an expression with the length value. This attribute i will use in my partslist.
So, what function do i need?

Michel

RE: Attributes and expressions

Michel,

1. In your part, let us say you have a parameter, called 'length_value' with value = 20 mm.

length_value = 20 mm


2. If you want to end up with a Part Attribute 'Length' with a value equal to the length_value, do the following:  Create a new expression, call it 'length_attribute', and use the NX function ug_setPartAttrValue() as follows:

length_attribute = ug_setPartAttrValue("Length",format("%f",length_value))

Now you can double check in your Part Attributes; you should now have an Attribute titled 'Length', with a value equal to 20.000000.

The fact that this Attribute has six decimal places bugs me, and I don't know how to avoid it.  Maybe someone else has a simple solution to this?  (How to make the resulting value have an arbitrary number of decimal places, such as 20 or 20.00 etc?)

RE: Attributes and expressions

(OP)
Thank you very much, it works. Only the zeros behind the dot is not nice indeed. Hopefully someone has a solution for that.
Is there somewhere a list of functions in the help by the way?

RE: Attributes and expressions

For a fist of functions, while in the Expression Dialog go to the bottom-left and select the icon which is labeled 'f(x)'.  You will be able to get a list of the various classes of functions and then for each class a list of functions and with each function there is a brief description or you can select the '?' button and get a more complete description alone with examples.

John R. Baker, P.E.
Product 'Evangelist'
NX Design
Siemens PLM Software Inc.
Cypress, CA
http://www.siemens.com/plm
http://www.plmworld.org/museum/

To an Engineer, the glass is twice as big as it needs to be.
 

RE: Attributes and expressions

(OP)
It works to recall an attribute in a partslist but I don't know how to recall it in a tabelar note or just some text.
I thought the same function should do it, but not.

I don't know either where the style of the partslist is stored. every time I have to change the celstyle.

RE: Attributes and expressions

Potrero,

For two decimal places use
ug_setPartAttrValue("Length",format("%0.2f",length_value))

For no decimal places use
ug_setPartAttrValue("Length",format("%0.0f",length_value))


Regards, Joe

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources