Mass file renaming and relinking in Inventor Part I: The results

*Edit: New, translated, version posted on GitHub with install instructions. Check it out at https://github.com/3dfernando/Ferramentas-de-Montagem

 

1. Introduction

If you’re a mechanical designer for a living, chances are that you already had to copy an existing design. Even higher are the chances that you already had to rename all the files in a given assembly to match an ERP needs or a coding system needs.

Well, there are many ways of doing this, but I found that all the built-in ways in Autodesk Inventor have some sort of caveat:

  • Manual renaming in explorer: This is a pain in the ***. Apart from renaming the files one by one, you have to keep track of the old-new name correlations so when you open the assemblies in Inventor, you can redo the links manually.
  • Excel VBA to rename files: This is a little bit less cumbersome. You relieve the pain of renaming the files one by one, but the relinking still needs to be done manually in Inventor. At least you can print the correlation table from Excel.
  • Using the Design Assistant: This tool is nice, but there is a missing functionality that keeps it from being something usable for large assemblies: One cannot paste a table in the treeview. Imagine you as a designer already having the old-new naming correlations in an Excel table, but unable to paste them in Design Assistant. You still have to do the renaming manually. Sometimes it hurts productivity even more as the files are organized according to the tree, so finding them is another issue.
  • Using the CopyDesign add-in sample from Inventor SDK: This is an example piece of software that comes with the Inventor API SDK. It does what it’s supposed to do: Copies a design and renames the files. The problem is, you need to have the new names beforehand. And new files (which are probably going to happen in a copied design) will have to be named correctly during design, which is not always possible under an ERP system.

2. My solution

So, now that I showed the available options and how they did not meet my needs, let me state what I want to do and what I came up with using the Inventor API.

I want to make a file list using Excel VBA (which will list the file names for the current assembly) and, using some made-up rule, assign new names to the existing files. Here I think Excel will always be way more flexible than any piece of software I would ever write, so I decided to leave the rule creation to the freedom of the user. A table like the one shown below will be the output from Excel as a CSV file and read by this program:

existing-new
Input CSV file format for the renaming system

I open the main assembly file and import the correlation table on my API-brew software. It figures out what files need to be renamed if they match the name in the “from” column of the correlation table. It finds out whether there are any equally-named *.idw files in the path. It renames all the files and then redoes the links in all levels of the assembly. Finally, it saves the assembly.

That’s the procedure in a nutshell. The heavy work is done by the software. So how does it look in Inventor? Follow the step-by-step screenshots shown below.

2.1. Main assembly loaded in my API interface

***Edit: I changed the button name to “Batch Renaming“.

FirstScreen.png
Screen of the “Batch Renaming” add-in showing the list of components referenced by the assembly

2.2. Loading the CSV file

SecondScreen.png
CSV file being selected in the file browser

2.3. Correspondences loaded in the file being displayed on-screen

In this case, not all files were selected to be renamed as some parts belong to the library.

FourthScreen.png
Files to be renamed are shown in the table in bold

2.4. Renamed files in Explorer

fifthscreen
Files after the renaming in the explorer view…

 

sixthscreen
… and in the Inventor treeview!

3. Conclusion

So the use of this tool saved us quite a lot of time on the renaming of files. For larger assemblies, of >700 parts, a reliable manual renaming took up to 3-4 hours and could be reduced to something like 10 minutes. If you think this tool might be useful for you too, please let me know in the comments!

I published it on GitHub in this address: https://github.com/3dfernando/Ferramentas-de-Montagem. Please check it out and let me know if it was useful for your job!

If you guys understand Portuguese, you might find this video I made in my language for my comrades useful. I’ll soon produce an English version with the updated code so more audience can understand it. **EDIT: there it is =)

**Edit 2: Watch the installation process if you’re having trouble:

26 thoughts on “Mass file renaming and relinking in Inventor Part I: The results

  1. I really don’t know how to thank you! I looked for something that was renamed en masse for years, finally I found your job and it changed my life! I had tried to do it with iLogic but without success. I am a mechanical designer, if I can do something for you I would be happy! Thank you again

    Like

  2. Frenando,
    Thanx for making an excellent program!
    I tried using it on my Inventor 2010 Suite.
    Obviously the Excel file worked, and so did the VBA.
    Only it would not recognize/see my Inventor files (they didn’t show up on in the Existing Files list).
    Is there something I do do to make it see my older Inventor files?
    Cheers! … Chris

    Like

    1. Hi, cadman777, as far as I understood from your description you didn’t attempt to install the program. The excel file is simply for generating a table of correspondences. Try following these instructions:

      Like

  3. Great job, and i had tried run on Inventor version 2020. But anyway is it possible to export the unfold flat pattern at the same time with multi sheet in IDW file?

    Like

  4. Great Job!! I was wondering if there is a workaround not to rename, but to replace files from an excel list: I have thousands of files that were only renamed and relocated to another folder. Thank you

    Like

    1. Hi, genisuk, I don’t think that can be done under the current implementation. You can try to have a relative path in the file (instead of ‘file.ipt’; use ‘/Folder/file.ipt’). I’m not sure that will work, though, and I can’t really test it right now.

      Like

  5. Hello Fernando!
    I’ve been using this add-in since you gave it to me in 2017. The inventor development team hasn’t offered a renaming solution as it was then. There may be nothing beyond your solution. Thank you for your add-in.

    I recently updated to the latest version 2022 of Inventor.
    However, this add-in does not load. It cannot be confirmed from the add-in manager, and of course the command button is not placed. I already know how to use it, so I checked the registry registration and file placement, but there seems to be no problem. From 2017 to 2021, it worked fine.
    Do you have any advice?

    yoshinori

    Like

  6. Hello Fernando!
    I’ve been using this add-in since you gave it to me in 2017. The inventor development team hasn’t offered a renaming solution as it was then. There may be nothing beyond your solution. Thank you for your add-in.

    I recently updated to the latest version 2022 of Inventor.
    However, this add-in does not load. It cannot be confirmed from the add-in manager, and of course the command button is not placed. I already know how to use it, so I checked the registry registration and file placement, but there seems to be no problem. From 2017 to 2021, it worked fine.
    Do you have any advice?

    yoshinori

    Like

  7. Hello Fernando!
    Thank you for your reply.
    please do not worry.
    I pray for the success of your new challenge.
    As always, it may be a bug in the new version.
    Look for other solutions while watching for bug fixes.
    Thank you.

    yoshinori

    Like

  8. Hi Fernando, and all the users of this great add-in.
    A solution for the loading error in Inventor 2022 has been found.
    After all, in Inventor 2022, it has been changed to the specification for loading only registry-free type.
    The solution is as follows.
    ============================================
    HKEY_CURRENT_USER \ SOFTWARE \ Autodesk \ Inventor \ RegistryVersion26.0 \ System \ Preferences
    > Add DWARD value
    LoadRegisterBasedAddins “= dword: 00000001
    ============================================
    I hope this information will be useful to everyone !

    yoshinori

    Liked by 1 person

    1. Oh, wow, thanks Yoshinori! I can’t reproduce the issue because I don’t have Inventor 2022, but it’s good to know there’s a way. I’ll update the Readme in the Github repo, then. Thanks for your help!

      Like

  9. Fernando, Congratulations on your program! I would like to know if any way renames the parts without to lost the link with the parametric names when using ilogic rules.

    Like

  10. Hi,
    This look like a very useful utility – thank you for taking the time to create and share it!

    Is it possible to use the same technique to create new Inventor files based on filenames taken from an excel spread sheet? I need to create large amounts of data for our inventor vault with a specific naming convention that is different to the part and assembly templates we use daily. Many of these files will be empty reference part files that can be used for bill of material downloads, such as instruction booklets, for later output to an ERP system. The biggest problem I’m facing is typing in the repetitive filenames, such as ABC123.iam and ABC123-IM.ipt, DEF123.iam and DEF123-IM.ipt, etc. Data already exists in spreadsheet form that could be used for part and assembly filenames and even part/assembly descriptions, if that can be incorporated. I would therefore like to know if it’s possible to create empty part and assembly files inside or even outside of the Vault Workgroup (2020) environment using filenames from a spreadsheet? If outside then consider a mass upload into the Vault, adding any additional file properties once the upload is complete.

    Like

    1. Hi, Ian, you wouldn’t be able to use this add-in to create a set of files like that. I knew a fellow colleague that used an old batch renaming spreadsheet we made to do something like what you want to do. If you want to check it out, I’ve uploaded it to my github (it’s just an excel macro that renames files): https://github.com/3dfernando/BatchRenamer

      You really can use any renaming tool, though. What he did was the following: He would create an empty file, copy it as many times as he needed (Windows would rename the copies to default names like “A – copy.ipt” and then “A – copy copy.ipt”). Then he would import them into the spreadsheet and rename all of them according to the rule. It is kinda janky, but it solved his problem. Maybe you can do something like that for your problem!

      Like

  11. Hi Fernando, thank so much for this it is great!!

    Is there a way to batch rename idw files?

    Thank you
    HElouise

    Like

  12. Dear Mr. Zigunov!
    Thank you for your Add-in! It works fine for Inventor 2020 too. However I get an error massage with the following text:

    ==========[L84] Error opening the batch renamer form (frmAssemblyTools)==========
    System.ArgumentException: The path is not of a legal form.
    at System.IO.Path.LegacyNormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
    at System.IO.Path.GetFullPathInternal(String path)
    at System.IO.DirectoryInfo.Init(String path, Boolean checkHost)
    at PDFemMassa.frmAssemblyTools.frmAssemblyTools_Load(Object sender, EventArgs e)

    Can you tell me what is it all about and how can I solve it? Or, do I have to solve it? Because every item is renamed and also relinked properly. Some of my parts are link to each other, and those links are also updated, so it seems that everything works fine.

    Moreover I woulde like to ask some informatioan about the funciton of the Back Up folder? What is it for?

    Thank you for your answers in advance.

    Liked by 1 person

  13. Hello,
    has anyone got this for Inventor 2022 working?
    I tried to follow the steps but I don’t have the icons in Inventor.
    Thanks

    Like

  14. Hello,
    has anyone managed to make this work in inventor 2022?
    I did all the steps but i cannot see the icons in inventor.
    Also changed the registry.
    Thanks

    Like

  15. Hello,
    Very good program, I would like to know if it is possible to update the Iproperties also with this program?
    It should be a very good Add on this.
    Best regards,
    Dylan

    Like

Leave a comment