×
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

Text format problem

Text format problem

Text format problem

(OP)
I was using NX5
In the expressions I had:
HEATER=ug_setPartAttrValue("DESCRIPTION",format("HEATER %.3f dia. x ",p0) + format("%.2f",p1))
p0=heater diameter=.625
p1=heater length=30.0
It was a cylinder representing a tubular heater in a mold.
The part attribute DESCRIPTION would be "HEATER 0.625 dia. X 31.00"
Now in NX8.5 the DESCRIPTION is "HEATER 15.875 X 787.40
The part is in inches but the description is coming out in millimeters.
Is this a bug or am I missing something?
Did they change how format works?
I work around it by: ug_setPartAttrValue("DESCRIPTION",format("HEATER %.3f dia. x ",p0/25.4) + format("%.2f",p1/25.4))

RE: Text format problem

Are the length expressions defined in inches?
What part units are used in the file you are placing the note?

www.nxjournaling.com

RE: Text format problem

(OP)
Everything, all files are inches.

RE: Text format problem

(OP)
Yes, all units are in inches.

RE: Text format problem

If you are using 8.5, create a string expression:
Description = format("HEATER %.3f dia. x ",p0) + format("%.2f",p1)

Then create a part attribute (of type string) and link it to this expression; no need to use ug_setPartAttrValue. It may even solve your problem...

www.nxjournaling.com

RE: Text format problem

Also note that the format function can convert units for you.

CODE

format("HEATER %.3f dia. x ",p0, "units", "in") + format("%.2f",p1, "units", "mm") 

www.nxjournaling.com

RE: Text format problem

If you're running NX 8.5 I would replace the format functions with the new Attribute Expression functions.

John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
Siemens PLM:
UG/NX Museum:

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

RE: Text format problem

(OP)
Thank you cowski, this worked:
expression DESCRIPTION=format("HEATER Ø%.3f x ",p0,"UNITS","IN") + format("%.2f",p1,"UNITS","IN")
then linked it in the attributes.
John, not sure what you meant about replacing the format function with the new Attribute Expression functions.
Thank you all.

RE: Text format problem

If you go to the...

File -> Properties -> Attributes

...dialog you'll now find an option to create Attributes linked to the value of an Expression, and while in the Expression dialog, you'll find an option to create an Expression linked to the value of either Part or Object expressions. These new routines have replaced the older 'KF' attribute routines (which still work but are no longer found under the f(x) icon). These create actual 'attribute' expressions which will update like any other expression automatically, something which did not always happen immediately when using the older 'KF' attribute functions.

John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
Siemens PLM:
UG/NX Museum:

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

RE: Text format problem

(OP)
Thanks John, appreciate the clarification.

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