Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Easy way to get file location?

Status
Not open for further replies.

aluminum2

Aerospace
Apr 27, 2010
218
right now at work we are using NX5, but are switching to NX8. Does anyone know of a way to get the file path of the part you have open to display in text. I would also hope that it could be parametric so if you change the location of the file, it updates.
 
Replies continue below

Recommended for you

CAVEAT: This is probably only useful if you're NOT running under Teamcenter or some other 'management' software.

Have you tried selecting the component and then hitting 'Ctrl-i'?

Now I'm not sure what you mean by "parametric", but the above operation will show you the full path to the part file from which the selected component was opened, period!

John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
UG/NX Museum:
To an Engineer, the glass is twice as big as it needs to be.
 
I need to be more descriptive in my original post. 'Ctrl-i' does give you an information window. I kind of wanted to know how I can put that file name into a note on a drafting sheet. I was hoping there would be something like a linked attribute that would display it. Much like <W@$SH_PART_NAME> , but show the full path of the file. And also have it update in case I want to change the file location.
 
I think your only solution would be to create a simple NX Open program which would query the system for that information and then assign the results to something like an Attribute which would be linked to a note. Of course, you would have to run the program everytime the file was opened, since once it's opened, the file has no knowledge that the file has been moved, the name has been changed or for that matter, that someone hasn't deleted file since it was opened.

John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
UG/NX Museum:
To an Engineer, the glass is twice as big as it needs to be.
 
Hi John,

You don't remember, but you did it for me 3 years ago with a sample grip programm

So I attached it to this post (change the extension .zipper to .zip and uncompress it)

I checked that file execute grip read_file.grx works well in NX8

Run the programm each time you save the file under another directory and the FILE_SPEC attribute will update.

I hope this help


Regards
Didier Psaltopoulos
 
Yes, I recalled writing something like that a while back, but wasn't sure for whom I had done it.

John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
UG/NX Museum:
To an Engineer, the glass is twice as big as it needs to be.
 
Run the programm each time you save the file under another directory and the FILE_SPEC attribute will update

Or, create an environment variable named USER_RETRIEVE, and for the value enter the path to the grip executable. Now the program will run everytime you open a file; no remembering to run the program.

 
I was going to suggest a Menuscript file to modify the File -> Open menu which would do the same thing, but your suggestion is more elegant and easier to maintain.

John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
UG/NX Museum:
To an Engineer, the glass is twice as big as it needs to be.
 
I was wondering a few things,

for the environment variables. its that in the file ugii_env.dat and if so do I just do something like this. I put the grx file in that location

USER_RETRIEVE=$C:\Program Files\UGS\NX 6.0\UGII\Read_File_Spec.grx


Also how do you edit a grip file? or make one?
 
if you do put it in the ugii_env.dat file, where about would it go in there.
 
The location in the 'ugii_env.dat' file is not important. The entire file is parsed before NX starts.

As for editing a GRIP program, you'll need to use the GRIP editor which can be launched from the Windows Start menu by expanding the NX folder and then the NX Tools folder where you will find the NX Open Grip tool.

John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
UG/NX Museum:
To an Engineer, the glass is twice as big as it needs to be.
 
You can also add the environment variable through the control panel. From here you can add global environment variables or 'user' environment variables. This would be useful if you wanted to run/not run different programs based on the logged in user. That would probably be a rare case, but not unheard of.

Where you set the variable will depend on how you use/maintain NX and what you want to accomplish.

 
unfortunately its not working for me.

I copied lines

USER_RETRIEVE="C:\Program Files\UGS\NX 6.0\UGII\Read_File_Spec.grx"

When I open ug with the file, it does not update. When I go to file open, I see the note change. Also if I have no part open and go to open, I get a no active part error. Is this suppose to work like this?

 
If you open the .grs file (the source file) there is a section with instructions as to how to use the program.

John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
UG/NX Museum:
To an Engineer, the glass is twice as big as it needs to be.
 
Check the documentation on using User Exits. I think you need an asterick (*) before the C: for it to work.

From the ugii_env.dat file header for User Exits:
# If these are needed they should be setup by the user. If the user
# exit is a grip program procede the name with an asterisk (*). If
# the user exit is an operating system executable, just give the full
# pathname to the program.


"Wildfires are dangerous, hard to control, and economically catastrophic."

Ben Loosli
 
The tip from Ben is correct. An asterisk is needed when the user exit is a grx instead of a dll. (And the double quotes should be omitted.)

The reason that the USER_RETRIEVE will not work and that the menuscript post action will work is based on the timing of the respective actions.

USER_RETRIEVE executes the custom program before NX opens the part. This allows the custom to completely replace the NX user interface for part selection if desired and potentially explicitly load parts directly or it can execute custom code and then (optionally) have NX perform the OOTB behavior. So, even if the environment variable is defined correctly the grip program would get executed too soon - there would not be a part open yet for it to modify. (Unless a new, more complex, Grip program were created that performed the file selection, the part open, and the attribute creation)

The menuscript "post" action executes once the part file has been opened where the GRIP program will successfully find part file to modify.


HTH, Joe
 
I had forgotten that aspect of the USER_RETRIEVE. I had code that replaced the whole native menu selection. To use it in this case, you would need to open the file and then get the &pspec of the open file.
Menuscript in the post open would be best and is still automatic.


"Wildfires are dangerous, hard to control, and economically catastrophic."

Ben Loosli
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor