Cancel
Showing results for 
Search instead for 
Did you mean: 

Assemplt part attributes into expression

Gears Phenom Gears Phenom
Gears Phenom

We have a series of attributes that are added in Teamcenter, which essentially create a smart part number for our parts, type of car, year, section of car, and then unique number.  I'd like to be able to create an expression in our model seed file, that assemble's these attributes into a single string.  Then we can use this single expression, in notes, in model text for engraving, etc.

 

I did some experimenting, but so far have not had luck as a "string" type expression, or I messed up the format...can this be done?

-Dave
NX 11 | Teamcenter 11 | Windows 8.1
6 REPLIES

Re: Assemplt part attributes into expression

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

If some of the information is numeric, you will need to use the "format" function to convert it to a string; then in your string expression you can use the "+" operator to concatenate the strings.

 

If you can post some example (fictitious) input, I'm sure we can help work out the details.

Re: Assemplt part attributes into expression

Siemens Honored Contributor Siemens Honored Contributor
Siemens Honored Contributor

@DaveK,

 

Use ug_askPartAttrValue to get the value of the attribute into the expression editor and then combine the values using the concatenator sign "+".

 

attr_exp_string.png

 

Regards, Ben

Re: Assemplt part attributes into expression

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

If any of the attribute values are subject to change after creation, I wouldn't use the "ug_askPartAttrValue" function as it will not automatically update.

Re: Assemplt part attributes into expression

Siemens Honored Contributor Siemens Honored Contributor
Siemens Honored Contributor

You can also create a new attribute and use the "Reference Text" command on the dialog to build a new string of existing attribute values.  No need to use the concat sign.  You could then just refer to the new attribute wherever you need to use its value:

 

reference_text.pngreference_text_format.png

 

Regards, Ben

Re: Assemplt part attributes into expression

Gears Phenom Gears Phenom
Gears Phenom

All sounds good, but I haven't had much time to experiment yet... so in the mean time, here is some example data, and more info:

 

Existing attributes that should exist in the part.  Note they don't always have values, if the user doesn't select them in Teamcenter, and I want to set a check for that, but that is another issue.

 

Part Attribute = Value

Car Type = C

Year = 17

cgr4_SectionComplex_toNX = 65

Internal Part Number = 123

 

The final result would need to be displayed as C17-65-123

 

If a "save as" were performed on the part, the user would have to update this info in Teamcenter, and then we would want the attributes to update in NX too.

 

 

 

 

-Dave
NX 11 | Teamcenter 11 | Windows 8.1

Re: Assemplt part attributes into expression

Gears Phenom Gears Phenom
Gears Phenom

@BenBroad  That seems to be working, I've even changed some of the values in Teamcenter, and you can force it to update if the part is already open in NX, or it updates the next time you open in.

Thanks!

-Dave
NX 11 | Teamcenter 11 | Windows 8.1