Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Size attribute in block... 1

Status
Not open for further replies.

hexfly

Automotive
Dec 27, 2009
71
Hi. I am wondering if there is a way to get a block size attribute to automatically update when I change the block parameters.

Basically, I am making a new component and creating a block on layer 1. I am giving the file an attribute called "description" and I want the value to be the block size, and be able to have the value update if I change the block parameters.

Is this possible?

Thanks in advance.
 
Replies continue below

Recommended for you

Hello John,

I have this working to set a Part Attribute “MATERIAL”, this can be:
S235JRH | S275JOH/J2H | S355JOH/J2H for “Cold Forged Tube”
or S355NH/J2H for “Warm Forged Tubes”

This is set by these Expressions:
INPUT_MAT =235 or 275 or 355
INPUT_C_W=0 or 1 (Where 0 is for Cold Forged Square Tube and 1 is for Warm Forged Square Tube)

A part of the Expression formula to set Part Attribute “MATERIAL” is:
MATERIAL_Attribute=Ug_setPartAttrValue(if((INPUT_MAT ==235)&&(INPUT_C_W==0))(ug_setPartAttrValue(“MATERIAL”,format(“S%0.fJRH”,INPUT_MAT)))else(if((INPUT_MAT ==275)&&( INPUT_C_W ==0))(….)

I would now like have an Expression formula for “DESCRIPTION”:
Where if INPUT_C_W==0 then “COLD FORGED SQUARE TUBE” else “WARM FORGED SQUARE TUBE”



Best regards,

Pascal,

NX5.04+TC2007 (GM Toolkit) / NX7.5 native
 
Hello John,

I found the formula myself, I created the Expression as a "String" type because I thought it needed to be of this type because it was only text, that was my failure...

it must be "Numbers" type Expression, like this:
DESCRIPTION_Attribute=if(INPUT_C_W==0)(ug_setPartAttrValue("DESCRIPTION",format("%-10s","COLDFORGED")))else(ug_setPartAttrValue("DESCRIPTION",format("%-10s","WARMFORGED")))

The tip is here to use: format("%-8S","aaa")





Best regards,

Pascal,

NX5.04+TC2007 (GM Toolkit) / NX7.5 native
 
Just as a references, here are the other formats:

Formatting strings
format("%8s","aaa") " aaa"
format("%-8s","aaa") "aaa "
Formatting integers
format("%8d",123) " 123"
format("%08d",123) "00000123"
format("%d,123) "123"
format("%d",123.456) "123"
Formatting numbers
format("%8.1f",12.345) " 12.3"
format("%08.1f",12.345) "000012.3"
format("%8.0f",12.345) " 12"
format("%#8.0f",12.345) " 12."
format("%8.1e",334.3434) "3.3e+002"
format("%8.1E",334.3434) "3.3E+002"
Adding spaces and text
format(" %4d",12) " 12"
format(" %4d ",12) " 12 "
format("X=%6.2f",12.1111) "X= 12.11"
format("%5.1f mm",12.1111) " 12.1 mm"

Input Arguments:
str - Specify the string
value - Specify a value

Returns:
String - A formatted number string




Best regards,

Pascal,

NX5.04+TC2007 (GM Toolkit) / NX7.5 native
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor