Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Can I use a substring directly in a Attribute

Status
Not open for further replies.

Trkp

Industrial
Jan 6, 2021
4



Hi All

I am trying to populate a titleblock with partnumber and version number.
The filenumber has 17 digits, like this xxxxxxxx-yyyyy-00, and the last two is the version number.
I want to seperate the version number and use it in a seperate version cell, and the rest in a partnumber cell.
In each of the two cell i want a call a seperate attribute.
I have succeded by using using the command subString( replaceString(Ug_askCurrentWorkPart(), ".prt", ""), 16, 17 )
in expressions and then used them in the attribute, but then I have to update my expression when i have made a save as, which isnt very practical.

Is there any way I can use that command directly in a attribute

Best Regard

TK
 
Replies continue below

Recommended for you

TLDR: No.

Attributes and expressions are closely related (hidden system expressions are created for many attributes). The UG_askCurrentWorkPart function is a KF function that is usable in the expression system, but it is not fully supported in that it won't update automatically (you will need to force an update if/when the part is renamed). If you are using Teamcenter, there are attributes connected to the dataset name and revision. If you are using native NX (no TC), what you have is probably the best you can do.

www.nxjournaling.com
 
That is excatly my expirence.
Is there a way to make the same happen, but in an attribute, I have tried to use the "subString( replaceString(Ug_askCurrentWorkPart(), ".prt", ""), 16, 17 )" in an attribute, but the result is that i see the string in my sell, instead of the number.
Best Regard
TK
 
There is a old mechanism in NX called "User exits", This means that when the user selects an option such as save as, NX will start "a program".
when you create the new version and if you do that using save as, your program could be started and ask "update the version string Yes/no ?".

You can find these user exits ( system variables ) in the NXxx\UGII\ugii_env_ug.dat
Search for "User exit".

In case you want the one for save as : USER_SAVEAS

Regards,
Tomas

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor