We now finally have a way to change the part that is referenced in the idw using the "Replace Model Reference" command. This first came out in the 2011 Subscription Adv Package and then it was included in Inventor 2012. Before this tool the only way to change the referenced file was to munge the filename of the referenced file, then open the idw. We then have th opportunity to select a different file.
In order to change the file that is referenced in a derived part, we have to go through the old mantra of munging the filename and opening the parent part. Very time consuming. What would be great if we had the ability to do a similar thing with derived parts. as we can now do with the idw. If we had the ability to right-click on referenced file and chose "Replace Model Reference", that would be a great time saver.
Solved! Go to Solution.
Solved by tmonty. Go to Solution.
Solved by karthur1. Go to Solution.
You can post all the enhancement requests on our product feedback site , so that our development team takes into account your comments.
http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=1109794
And why is that your development team can not take that piece of request from here? After all it is in the company's best interest to listen to the customers requests and collect that information from whenever possible.
Or does this idea applies to small companies only?
Igor.
@Daniela_Koloszko wrote:You can post all the enhancement requests on our product feedback site , so that our development team takes into account your comments.
This is done in in order to have one site where all customers' comments and enhancement requests could be consolidated and followed up. It avoids also missing some of them.
Daniela,
I posted this here thinking that another user might know of a different way to accomplish this. I have also sent in a request to the site that you mentioned above.
Thanks
Here is an iLogic rule that was written by Mike Deck from Autodesk (one of the Original iLogic Gurus) that will do what you are looking to do. It looks for reference parts (derived parts) and then lets you browse for a replacement.
We run it as an external rule that is fired from a Global form. That way you can run it from any file without having to include it in the file. It has worked great for us. Hope this helps.
Note - you will have to take the ".txt" extension off of the filename. I was unable to post the file with the ".iLogicVb" extension.
An additional workaround:
http://inventortrenches.blogspot.com/2012/12/ilogic-replace-derived-reference.html
Also a link to the Idea Station ideas (vote for both of them to show your support for this):
http://forums.autodesk.com/t5/Inventor-IdeaStation/Replace-Component-for-Derived-Parts/idi-p/3721882
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
So it's now been six years since you asked about this function.
Has anything changed? Has this function been added anywhere?
I've been looking, but can't find anything for it.
Replace Model Reference works so well in the .idw I can't understand how it hasn't been added in for derived parts yet.
I'm tired of having to close everything down to fudge the part names to make it work.
If we can use the function to Resolve Links, surely a function can be added to Replace Derived Reference.
It can all be that simple if you want it. In Solid Edge - for as long as I can remember (and that's long ! ) - you had a command on the old school application menu under "edit", reading "edit links". If you clicked on it you saw all the links that the file in question had with other files, be it drawing, part or assembly. You could click on anything and browse to a different file. After that the software did its best to comply. If it was on a drawing you got views of the new part. If it was an entirely new part then all your dimensions got detached, but you could guess that up front. If it was a derived part then every feature that could be recomputed on the new part would get recomputed.
Exactly what is happening with the present workarounds, without needing a workaround.
Alex
There is an IdeaStation post here for the Derived Part Replace Model Reference.
Quiker way:
VBA:
STEP 1: Have the file open you want to change its reference
STEP 2: Open vba editor (ALT+F11)
STEP 3: Paste Code but first change filePath to match your new referenced file
STEP 4: Press F5 or the play button
STEP 5: Enjoy your success!!!:)
Public Sub Doit() Dim odoc As PartDocument Set odoc = ThisApplication.ActiveDocument Dim ofile As File Set ofile = odoc.File Call ofile.ReferencedFileDescriptors.Item(1).ReplaceReference("E:\Personal Workspace\Designs\VARIOUS\VPR-215\215-001-016.ipt") End Sub
SECOND WAY (NO CODE NEEDED):
STEP 1: PUT THE FILE WITH THE REFERENCE IN AN ASSEMBLY SAVE THE ASSEMBLY AND CLOSE ALL FILES
STEP 2: GO TO REFERENCED FILE AND RENAME IT IN FILE EXPLORER
STEP 3: OPEN THE ASSEMBLY THE FILE WILL OPEN WITH QUESTIONMARKS
STEP 4: USE SAVE AND REPLACE COMPONENT COMMAND
STEP 5: REPLACE REFERENCES YOU ARE DONE
Thanks for the suggestion. The way that I do this is as follows:
Very quick and easy and you don't have to load, copy code each time to do it. Give this a try and see if it works for you also.
Thanks,
Kirk
@Curtis_Waguespack wrote:
An additional workaround:
http://inventortrenches.blogspot.com/2012/12/ilogic-replace-derived-reference.html
Hi,
is there any way to modify this rule for the files with more than one derived references. I would like to have a list of them and choose which to change.
I've been using the Replace Derived Reference code from your blog with much success.
Now I'm trying to use part of the code to replace the derived reference file of a sub-component from an assembly rule.
For examples sake, I've already declared the sub-component as a variable called oSubDoc of type PartDocument.
I then took this part of the code & tweaked it to look at the sub-component:
Dim oRefFile As FileDescriptor
For Each oRefFile In oSubDoc.File.ReferencedFileDescriptors oRefFile.ReplaceReference(NewDerivedFilePath) Next
The code runs without any error but the derived file is not getting replaced in the sub-component. Is it only possible to achieve this when the sub-component is the ActiveDocument?
Em C# encontrei uma solução simples, segue a mesma abaixo:
private void Processo()
{
// Obtém a aplicação do INVENTOR
Inventor.Application invpApp = (Inventor.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application");
// Obtém o documento de peça ativo
PartDocument partDocument = (PartDocument)invpApp.ActiveDocument;
// Obtém as definições do documento
PartComponentDefinition compDef = partDocument.ComponentDefinition;
// Obtém as peças referenciadas como derivadas
DerivedPartComponents devPartComp = compDef.ReferenceComponents.DerivedPartComponents;
// Obtém o primeiro item da lista de itens
DerivedPartComponent devComp = devPartComp[1];
// Nome completo do arquivo atual que esta sendo utilizado como referênvcia na peça derivada
string fileName = devComp.ReferencedFile.FullFileName;
// Nome do novo arquivo que está sendo utilizado nao peça derivada
string newFileName = @"C:\Users\User\Desktop\Testes\Copiar com Referencias\950.ipt";
// Altera a peça de referência
devComp.Replace(newFileName, null);
}
Observação:
Em anexo está uma imagem com a arvore do object brower para entendimento do código
English please!
Google Translate:
In C# I found a simple solution, follow the same below:
private void Process()
{
// Get the INVENTOR application
Inventor.Application invpApp = (Inventor.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application");
// Get the active part document
PartDocument partDocument = (PartDocument)invpApp.ActiveDocument;
// Get document definitions
PartComponentDefinition compDef = partDocument.ComponentDefinition;
// Get the parts referenced as derived
DerivedPartComponents devPartComp = compDef.ReferenceComponents.DerivedPartComponents;
// Get the first item from the list of items
DerivedPartComponent devComp = devPartComp[1];
// Full name of the current file being referenced in the derived part
string fileName = devComp.ReferencedFile.FullFileName;
// Name of the new file being used in the derived part
string newFileName = @"C:\Users\User\Desktop\Testes\Copy with References\950.ipt";
// Change the reference part
devComp.Replace(newFileName, null);
}
Observation:
Attached is an image with the tree of the object brower for understanding the code