Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Rename & Replace Component with same File Name

2 REPLIES 2
Reply
Message 1 of 3
johnster100
298 Views, 2 Replies

Rename & Replace Component with same File Name

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

2 REPLIES 2
Message 2 of 3
MjDeck
in reply to: johnster100

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.

Message 3 of 3

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"

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report