replacing all assembly & file refs

replacing all assembly & file refs

NachoShaw
Advisor Advisor
793件の閲覧回数
5件の返信
メッセージ1/6

replacing all assembly & file refs

NachoShaw
Advisor
Advisor

Hey

 

ive got an issue thats perplexing me and to be honest, i thought it would be easier than it is..

 

i have an assembly that isnt very well designed. Id like to replace it but there is a lot of other legacy automation involved i just cant right now. anyway, updating the code to add a job number to the prefix (as the jobs were being saved in projects with generic file names) has meant a re-write of a lot of code and its this that i cant seem to get right.

 

What i need to do

Loop through the top level assembly documents as reference files, add the prefix to the document filename and save it in a new location. Then, change the reference in the assembly to the new component. Reloop if the referenced document is also an assembly.

 

The problem im getting is linked base models. They dont seem to change and for every document i replace, i also need to update these referenced documents too. So, is there any code out there that can help me-

 

copy the top level assembly to a new folder

copy all of the assembly references to the same folder

if the reference is also an assembly, copy that and all of its child docs

replace all references including any documents that a linked or derived in parts / assembles

 

Thanks

Nacho
Automation & Design Engineer

Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC

EESignature


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


0 件のいいね
解決済み
794件の閲覧回数
5件の返信
返信 (5)
メッセージ2/6

Michael.Navara
Advisor
Advisor

If it is single task, which will not be repeated, use DesignAssistant or Vault. For single copy it is the quickest way.

0 件のいいね
メッセージ3/6

NachoShaw
Advisor
Advisor

Hi

 

It's not a single task I'm afraid.. it's before my time as VBA but it's a dependency tool for about 10 users who use it multiple times per day.

 

Thanks

Nacho
Automation & Design Engineer

Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC

EESignature


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


0 件のいいね
メッセージ4/6

Michael.Navara
Advisor
Advisor

In this case Vault CopyDesign functionality is suitable for this task. If you are looking for some programming solution, I recommend you to use ApprenticeServer. It is the best tool for copying Inventor documents.

Few years ago I made very similar tool for copying complex assemblies and its parts, but it wasn't an easy task and it spends a lot of time.

0 件のいいね
メッセージ5/6

NachoShaw
Advisor
Advisor

Hey

 

I too made an apprentice tool and it's fast however.... this particular code set is VBA and can't use apprentice. We want to transition to vault but we're not there yet.

 

Unfortunately that was all together before my time and it's hard to change minds to get investment for updates..

 

I want to make a new model, this one has 7 base models for an assembly that has 8 unique parts in 150 occurrences

Nacho
Automation & Design Engineer

Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC

EESignature


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


0 件のいいね
メッセージ6/6

NachoShaw
Advisor
Advisor
解決済み

Hey

I resolved this by using some code outside of inventor. The issue was-

 

As i looped through each ReferencedDocument and changed the reference, i needed to loop through that doc sub references but at that time, they may not have existed in the new folder. My solution was to first loop the assembly and use FileCopy(OldPath, NewPath) to get all of the referenced docs into the new folder and THEN loop the assembly to update the references with the FileDescriptor.

 

Much less code than copying the new component on each iteration and more robust as my new documents will always exist

 

Thanks for replying

Nacho
Automation & Design Engineer

Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC

EESignature


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


0 件のいいね