Rename & Replace Component with same File Name

Rename & Replace Component with same File Name

johnster100
Collaborator Collaborator
418 Views
2 Replies
Message 1 of 3

Rename & Replace Component with same File Name

johnster100
Collaborator
Collaborator

Hi there,

I have quite a large assembly. The assembly is controlled by ilogic forms. If parts are not needed they are deleted. I would like to have the option to 'Readd' subassemblies if parts have been deleted that you later realise you need.

 

I would like to be able to use the Component.Replace function as this would mean I do not have to readd the constraints. To do this I:

 

1. Delete the file which is to be changed. eg. Assy.iam

 

2. Copy over the master file containing all the parts to my workspace - Assy.iam before parts were deleted

 

3. I would like to replace the component here, however it does not work. I think it's because it has the same file name as the file in the assembly and Inventor seems to store that part in memory.

 

If I shut down the assebly and reopen it my assembly will be correct as Inventor will read the copied assembly. IS there a way I could skip this step? 

 

It works fine if i give the new component a new file name, say Assy1.iam, but I don't want to do this as I have drawings which are linked to this file.

 

thanks,

John

0 Likes
419 Views
2 Replies
Replies (2)
Message 2 of 3

MjDeck
Autodesk
Autodesk

Hi John,

 If you're still working on this problem, here's a function call that might help:
ThisApplication.FileManager.RefreshAllDocuments()

That doesn't give you any control over which documents to refresh. It will look at all open documents. So it might be a good idea to run it when you only have the one assembly open.


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 3 of 3

frederic.vandenplas
Collaborator
Collaborator

Hi, 

 

the easiest way to do this is supress the part you want to replace, overwrite the file, unsuppress the part.

This will reload the file completely.

Try this manually before programming this to see if it works as expected.

If you think this answer fullfilled your needs, improved your knowledge or leads to a solution,
please feel free to "kudos"
0 Likes