×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

format and subString functions in NX7.5

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?

RE: format and subString functions in NX7.5

(OP)
Thank you kapmnit,

i am bad with coding, so how to edit

CODE

subString( ug_askPartAttrValue( "[your finish attribute title]" ), 2, 3 ) 
to refer to part name, and to extract last two digits?

RE: format and subString functions in NX7.5

Hi,
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

(OP)
Great!!!

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

Ivan,
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

(OP)
Thank you kapmnit, i will try this!

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

By the way...i just managed to get one working...this one will automatically create an attribute and an EXPRESSION as well (the expression name will be fin_tst but you can change it in the code.)
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources