×
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

partial file name parameter?
3

partial file name parameter?

partial file name parameter?

(OP)
Is there a way to create a parameter in my start parts that will will reference a portion of the parts file name?

ie:

filename - joepartname_axxxxxx.prt/asm

parameter- det# = &file_name*_a*<

so that parameter det# will equal the xxxxxx portion of the file name no matter if it's 1 character long or 8.

Thx in advance
Jason

RE: partial file name parameter?

(OP)
I'm sure that example is way off base but I'm hoping it gives someone the gist of what I'd like to do.

RE: partial file name parameter?

3
Jason,

In your part, go to relations and add these sentences:

a = rel_model_name
a1=search (a, "_")
a2 = extract (a, 1, (a1+1))

examine the values:
a will give you joepartname_axxxxxx
a1 will give you 12
a2 will give you joepartname_a

To avoid these intermediar parameters, you can write the desired relation in a single sentence:

filename = extract(rel_model_name, 1, (search(rel_model_name, "_")+1))

-Hora

RE: partial file name parameter?

(OP)
Thanks Hora,

I'm trying to build on the info you gave me and am having some trouble.

Is there any reason why this line doesn't work:

a2 = extract (a, (a1+1), (a1+5))

I have tried it and will not work that way. If I replace (a1+1) with 1 like you said it works fine but I need the info after the "_".

RE: partial file name parameter?

Jason,

You were right. The extract function doesn dot accept a variable like this in the second position... But I found a way to solve your problem.

As I see you need to extract the last characters, after the "_"

Please see my example below:

a = rel_model_name
a1 = search (a, "_")-1

name1 = extract (a, 1, a1)

s1 = string_length(a)
s2 = string_length(name1)+2

name2 = extract(a, s2, (s1-s2))



Now the name1 = JOEPARTNAME
        name2 = AXXXXX

I think this is what you want to do.

-Hora

RE: partial file name parameter?

Hora,

You are amazing. Clearly worthy.

Is there a more complete listing of relation operations that I can add to my FAQ Mathematical Operators used in Pro/E Relations (FAQ554-970)?

Best regards,

Matthew Ian Loew
"I don't grow up. In me is the small child of my early days" -- M.C. Escher

Please see FAQ731-376 for tips on how to make the best use of Eng-Tips Fora.

RE: partial file name parameter?

(OP)
Thanks a million Hora. That helps me a ton.

RE: partial file name parameter?

Matthew and Jason,

Thank you guys.

-Hora

RE: partial file name parameter?

Hi All,

What does this relation do for you?

Tofflemire

RE: partial file name parameter?

Hi Tofflemire,

Split a string in two sub-strings, given a specific character (in Jason's case "_")

String = JOEPARTNAME_AXXXXXX

After applying these functions, you will have:

String1 = JOEPARTNAME
String2 = AXXXXX

The tricky part was the EXTRACT function which does not accept a float variable as second argument.

I think that evaluating the length of the string with the function STRING_LENGTH the result is an integer, which is accepted by the EXTRACT function. And this solved the problem.

-Hora

RE: partial file name parameter?

Hi Hora,

Thanks for the info.  Why would you want to do this?  Are you using one of these strings as a parameter on a drawing such as part number.  Why not just name the file(s) the way you want them to be.

I'm confused as to why the naming convention is set up to name JOEPARTNAME_AXXXXX.PRT.  Why do you name the files with a user name in it?  You can create a parameter to enter the users name in the field.

Thanks

Tofflemire

RE: partial file name parameter?

Toff,

Jason asked how to split this string. I don't know if the real part name is JOEPARTNAME_AXXXXX or it was just an example.

But many of us may want to extract a portion of the string for different reasons (BOM, revisions, materials etc, etc). Personaly I made this several times, but always I took in consideration only the first part. Jason's question was quite challenging.

If you have INTRALINK and you want to add an automatic revision on the drawing cartrige, then you will use this relation in your revision box:

&pdmrev:d  (d is for drawing)

The &pdmrev variable will hold something like this :

pdmrevrev:d = A-10 (an example)

You don't need to see the "-10" in your revision box if you want to display only the major revision. Then you can extract only the first part odf the string.

But if you need to see only the minor revision "-10" you can extract the second part.

Try it! It's nice to have the revision block filled in automaticaly.

-Hora

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