Idea for Renaming a NX file from Windows

Renaming a NX file is really difficult. Where as it is very is to rename a solidworks file from Windows. You can right click on a solidworks file then rename the file solidworks conext menu. If you rename through this process every part, assembly and drawing file connected to this renamed file, even if it hundreds or thousands, will be updated automatically and no link will be broken. So, I am thinking to develop such an option for Siemens NX. So, the process will be-

1. To Make a windows right mouse "NX" context menu which will provide a rename option
2. When a NX file will be renamed a (Python) Program/Journal will be run.
3. The program/Journal will collect all the files connected to this renamed file.
4. The program/Journal will Update the links of all the connected files.

But I don't have idea how to do this, specially for point 3 and 4. Can anyone give me some idea or advise how to do that?

A given part file does not know anything about the parts that reference it. An assembly stores information about its components, as it must, but the components do not store anything about the assembly. Interactive NX has a "where used" function (NXOpen equivalent: WhereUsedReport) that can tell you which parts reference a given part. You must specify a search location and it will open each part (in the background) and search for references to the target part. This process can be painfully slow, even with a small number of parts.

NX ships with a number of command line utilities that might also be of help in this quest. ug_inspect.exe can tell you if a part has component data, interpart expressions, and if it has wave link data, but won't give many details. ugpc.exe will give you details on the components a file references. ug_edit_part_names.exe can also give some info on components. Custom code will probably be required to query wave link data.

I think what you are asking is possible, but difficult. Execution time may not be practical unless you can narrow down the search to a handful of files to check.

Thanks for your suggestions.

Hi, How can I run NX command prompt from python with passing command and arguments and then get back the results? For example, How to send "ug_edit_part_names partfile.prt -list" to NX command prompt from python.

Generally speaking, the command line utilities such as ug_edit_part_names can be run from the normal command prompt. You can get the results of the operation by checking the STDOUT and STDERR streams. I don't currently have an example in Python, but you can see the overall process in VB here:
https://nxjournaling.com/content/convert-part-units

Thanks for your comment. I have already figured out the way to do that and I have developed the program. It worked but the process is a bit slow as you said. I have made the program to search in a single folder as the convention I follow is to keep all the design files in a single folder. I have tested the program with almost 70 files and it took almost a second to complete the renaming task which isn't bad in my case. After some fine tuning and testing, I will share the code with you people.

Thank for your hints because of which I was able to develop the program.