Add-in for batch renaming and relinking

Add-in for batch renaming and relinking

Anonymous
Not applicable
1,612 Views
5 Replies
Message 1 of 6

Add-in for batch renaming and relinking

Anonymous
Not applicable

Hi, 

 

Years ago I homebrew for the company I worked for an add-in for batch operations such as file renaming/relinking in assemblies and printing/exporting to PDF. I know, Autodesk has the Design Assistant tool and the Task Scheduler - but they simply are not enough for all the operations we needed to do at that time. Design Assistant (at least up until 2016) doesn't allow one to import a table of correspondences, like a "from this filename to that filename". This was for us a very recurring (and super annoying/boring) task as we copied large designs but couldn't keep the same name on the file for ERP management purposes. 

 

As I believe this might be a pain for other people in the engineering community, I spoke with my former employer and we decided to publish this code (link to this project's GitHub page below). Bear in mind I'm not a professional software developer - I'm just a curious mechanical engineer - so there will be bugs and code problems on it, therefore be very cautious with it. Back then I wrote code in Portuguese for my peers and although I translated the messages and screens to English, the code is still in Portuguese. Sorry about that =/

 

Maybe the idea itself is something Autodesk would consider improving in Design Assistant, as designers from other companies I know also report the same need in their daily activities.

 

Let me know if you guys find it any useful, and feel free to branch the project for your needs! 

https://github.com/3dfernando/Ferramentas-de-Montagem

 

 

Also, a video and a blog post of me speaking a little about it are available here (sorry for my English!!)

https://zigunov.com/2016/11/16/mass-file-renaming-and-relinking-in-inventor-part-i-the-results/

 

 https://https://www.youtube.com/watch?v=6zBCoirtrZQwww.youtube.com/watch?v=6zBCoirtrZQ

 

1,613 Views
5 Replies
Replies (5)
Message 2 of 6

MechMachineMan
Advisor
Advisor

Looks mighty impressive!

 

Definitely has a lot of lines of code there. Kind of wish I knew portugese so I could understand more, but even so, it will be great to learn from.

 

Thanks!


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 3 of 6

Anonymous
Not applicable

Hey, Mechmachineman, I actually forgot to mention that the code for the actual batch renamer is (mostly) in English, so if you want to take a look it's under 

"/Ferramentas-de-Montagem/Fonte/PDFemMassa/frmAssemblyTools.vb"

 

 

 

There are other modules on this particular add-in I developed in Portuguese and left them in because they're also tools that might be useful (say, batch printing and batch PDF/DXF generation). These were programmed almost fully in Portuguese and I apologize I don't have the time right now to rename all the variables (we know what a mess can this create...). Also, I didn't feel the need to mention them as they are not as useful since the task scheduler is okay for the same tasks.

 

But the relinking code itself works based on only 2 main functions:

 

1. LoadTree executes when the form loads and uses Assembly.AllReferencedDocuments to list all files that are in this assembly tree. This object has the property of flattening the assembly tree, which is useful in this context;

2. A loop for filename reference replacing at each sub-assembly and the top-level assembly uses the Assembly.ReferencedDocumentDescriptors object, which returns a list (for-each loopable) to perform the reference replacing with Inventor.DocumentDescriptor.ReferencedFileDescriptor.ReplaceReference

 

The trick, where I spent quite a few hours figuring out how to do it the best way, is to do it in the right order and to avoid all the crashes that possibly can happen (unfortunately there are a lot of them).

 

Message 4 of 6

MechMachineMan
Advisor
Advisor

I've made something much the same, but using excel as my GUI and application through which it runs.

 

Was interested in seeing what a more thoroughly add-in developed looks like, so it's definitely neat seeing it all come together!

 

The way I had done the relink was to create a 2-d array; for each entry it has the new file name and the old file name.

I had then generated a completely new set of files with the new name.

I then opened each NEW file and used the array to replace all instances of a reference to an old name with a reference to a new name.

Maybe not the most efficient way of doing it, but it seemed to work pretty good for me!

 

I know another method I had seen on the forums here was to iterate down the assembly structure from the top level, replacing/renaming any new file using a save-as.

 

Interesting stuff seeing the different ways people do it!


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
Message 5 of 6

ralfmja
Advocate
Advocate

Hello,

 

Your tool is what I've been looking for years but unfortunately I have a strange problem with it. Therefore, I can't use it 100%.

 

I come from Poland and in our country we have „Polish keyboard” with special marks like Ą ć ł etc

 

Polish version of inventor make a part with polish marks like on below screen :

 

obraz.png

obraz.png

obraz.png

And your program can’t change name of the file when we use polish marks

obraz.png

 

Does anyone have any idea how to fix it ??😀

 

Thanks in advance,

ralfmj

0 Likes
Message 6 of 6

Anonymous
Not applicable

Hello, Rafalmj,

 

I'm glad people still find this useful after so many years. I get this question (i.e; support to other language character sets) quite a few times but unfortunately I'm not supporting this software anymore. It has been a while I don't have access to Autodesk Inventor so I can't even debug - so chances are, if I attempt anything, that I'll introduce more bugs than features 😃

 
I'm sorry that you have this issue. If you can find a software developer in your country you might be able to add that feature to the main github page.
 
One of the goals I had by publishing this project was also in the hopes Autodesk would eventually pick this up and make it a feature of Inventor. But apparently there's not enough demand for it? 
 
Thanks,
-FZ
0 Likes