Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
shrey9GP3F
189 Views, 1 Reply

Changing all reference files for DWG file

Hello,

 

I am trying to replace all the reference files for an Inventor DWG file (new files already exist in the target folder). But ReferencedFileDescriptor does not replace the suppressed files. How do I replace all the file references without modifying the model state?

 

 

 

 

public static void ChangeRef(Inventor.Document oDoc)
        {

            foreach (Inventor.FileDescriptor oFileDesc in oDoc.File.ReferencedFileDescriptors)
            {
                string oSubFileName = System.IO.Path.GetFileNameWithoutExtension(oFileDesc.FullFileName);
                string oSubFileExt = System.IO.Path.GetExtension(oFileDesc.FullFileName);
                string oSubNewFileName =  @"C:\Users\Public\Desktop\NewFolder\" + oSubFileName + "_NEW" + oSubFileExt;


                oFileDesc.ReplaceReference(oSubNewFileName);
            }
        }