Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Split part name as automated text on a drawing 1

Status
Not open for further replies.

SuperQuark

Mechanical
Aug 8, 2010
10
0
0
CH
Hello everybody,

I have some part names in the following format :
xxx.xxx.xxx - description.prt

In the title block of the drawing I would like to have :
One note with the part number (xxx.xxx.xxx)and another note with the specification (description)

I can add the whole to a note with the automated text <W@$SH_PART_NAME> but I cannot figure out how to split it.

Anybody have an idea how to to this ???

Thanks a lot in advance
SuperQuark
 
Replies continue below

Recommended for you

Hi,
You can create expressions to store these values seperately.Generally using a substring function you can get these string values seperately.
I am detailing out a probable process you can follow.
Use ug_askCurrentWorkPartr() to get the part file name first and store it in a string expression.
Now use the function subString two times to get the values stored (as per your wish) in two different expressions.
Once you get these seperate expressions then you can insert these in your notes using relationship.
I generally do it a KF code i wrote sometime back but you can follow the manual method i furnished above also.
Best Regards
Kapil Sharma
 
Hi, kapmnit123

Thanks a lot for your reply ...

But, just a problem, I don't have the ug_askCurrentWorkPartr() into my Expressions Functions list (Tools, Expressions, Functions f(x), Insert Functions).
I just have this one only ug_askExpressionValueAsString !

What can I do ???

Many Thanks
SuperQuark
 
It's works !
Many thanks for your help cowski !
I did not know this method to create expression.

Please, do you have a list of functions that I can use with the same method ?
Thank you again.

SuperQuark
 
The way NX works is that ANY KF function which has been registered with the system, whether it was hard-coded by development or is something that was created by a user using the KF toolkit, will be available when creating an Expression. The functions that you see listed under the f(x) menu are just a subset of the full list of KF routines known to the system.

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.
 
Thanks John for these precisions.
Now I'm a little bit disappointed because the expression created in this way ( ug_askcurrentworkpart() ) does not be updated automaticaly if the part name is changed !
But with <W@$SH_PART_NAME> it does !

Do you know that ?
Is there a solution ?
 
That's one the weaknesses of KF, unless the original developer explicitly includes an automatic update mechanism, it will need to be manually updated. What you could try the next time that you change the part file name is to go to...

Tools -> Update -> Update for External Change

This is a sort of 'catch all' which will look at everything in your model and if anything is out-of-date it will try and force a refresh. I use it often enough that I've added a user command to one of my toolbars which performs this operation with a single button-push.



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.
 
Hi SuperQuark ,
Sorry for a very late response. And also for typo ug_askCurrentWorkPartr() i meant to say ug_askCurrentWorkPart() :(
But no issues Cowski and John have already helped you out with this. I must admit Tools -> Update -> Update for External Change is the way out if you want to update the expression value when the part name changes.however if you wish you can try using DemandValue () in KF also but still it would be add more steps (adding an attribute in KF also )to your process so i will stay with what Cowski and John stated as i find it more reliable and coherent for updation.
Thanks and Best Regards
Kapil Sharma
 
I'm doing something very similar to what's being discussed here but can't figure out how to remove the suffix from the ug_askcurrentworkpart().

I'm close... I've used length(list) to tell me the number of the last item in the list. Then, I've split the last item using splitstring('last.in.list',"."). I need to bring it back together somehow.

I need to use a range for nth() but I haven't been successful. Below is where I'm at...

Name FormulaValue
A_Description I want to show Range (4:('Number_Of'-1)) from 'List List_OSName' & 'Remove_Suffix'
A_Number =first(List_NumberWRev) 5678
A_Project =first(List_OSName) A12345
A_Rev =second(List_NumberWRev) A
A_System =second(List_OSName) 12.34
Last_Word "=nth(Number_Of,List_OSName)" description.prt
List_LastWord "=splitstring(Last_Word,""."")" "{""description"",""prt""}"
List_NumberWRev "=splitstring(OS_NumberWRev,""-"")" "{""5678"",""A""}"
List_OSName "=splitstring(OS_CallCompleteName,"" "")" "{""A12345"",""12.34"",""5678-A"",""This"",""is"",""a"",""variable"",""length"",""description.prt""}"
Number_Of =length(List_OSName) 9
OS_CallCompleteName =ug_askcurrentworkpart() A12345 12.34 5678-A This is a variable length description.prt
OS_NumberWRev =third(List_OSName) 5678-A
Remove_Suffix =first(List_LastWord) description

Apparently, I also need to know how to best past my expressions into this forum
 
There is currently no way to use a "loop" in the expression system. Attached below is one (admittedly ugly) way to get around this limitation. Perhaps someone can improve upon this solution.

The pic may get auto-sized and be hard to read. If so, right-click on it and download the original.
download.aspx


www.nxjournaling.com
 
Status
Not open for further replies.
Back
Top