format and subString functions in NX7.5
format and subString functions in NX7.5
(OP)
hello,
is there any way to use FORMAT function in expressions to extract last two digits in part name (example: part_name_22.prt and i need 22 as result)
or subString function? (i am not sure what this function do anyway)
and when i am in decription of subString function in related functions i have SplitString function, but when i try to find it, there is no such function in my NX, why?
is there any way to use FORMAT function in expressions to extract last two digits in part name (example: part_name_22.prt and i need 22 as result)
or subString function? (i am not sure what this function do anyway)
and when i am in decription of subString function in related functions i have SplitString function, but when i try to find it, there is no such function in my NX, why?





RE: format and subString functions in NX7.5
Refer to this thread Truncate an Attribute in a Title Block (thread561-339188: Truncate an Attribute in a Title Block).Although it was pointed towards attributes but i guess it might help you too.
Best Regards
Kapil Sharma
RE: format and subString functions in NX7.5
i am bad with coding, so how to edit
CODE
RE: format and subString functions in NX7.5
Kindly find attached an image herewith. I am not sure how can i automate that the part name is extracted directly (rather than manually feeding it).I can do it using KF but that may not suit your case.
Will let you know if i find anything on it.
Best Regards
Kapil Sharma
RE: format and subString functions in NX7.5
but... i need it to look for name automatically, and i need it to find last two digits on part names that are changing length...
so first i need to get name in name_string expression, then to check how many letters/digits there is in that part name and to put that in name_length expression and then i can use subString(name_string,name_length-1,name_length), this is one approach to this. it is not a problem to have more than one expression to do this, i already have lot of expressions in these parts so few more is not a problem.
it is just that as result i need two digits (XX) that i can compare in other expressions, like: if XX=YY then A=1 else A=2
RE: format and subString functions in NX7.5
Do you have a KF license with you?
Here is a a dfa code i have written in NX8.0.2 .This will automatically determine your part name..Depending on the value of END (which i take as the number of letters from the last of the part name) it will give you a part attribute with only the last 5 letters of the part name (no matter how big the part name is or chnages to...on save as).
Once a attribute is created you can create an expression taking a reference of the same.
Although i tried creating an automatic expression but this doesn't seem to work in my case (must be something i am missing on expression function)so you will have to craete an expression yourself (if you find some good resource on KF then this will be easy further) and relate it's value to that attribute value.
Best Regards
Kapil Sharma
RE: format and subString functions in NX7.5
i am just not that good with KF, so I have to talk to my coworkers who are better in it than I am :)
Thank you!
RE: format and subString functions in NX7.5
I have made the number of letters you require from the last as an input parameter so you can change it while invoking the code.
Here is the final dfa version...it is very to use just give it a try.
Best Regards
Kapil Sharma