ReferencedFileDescriptor.ReplaceReference Failed IV2010

ReferencedFileDescriptor.ReplaceReference Failed IV2010

Anonymous
Not applicable
656 Views
1 Reply
Message 1 of 2

ReferencedFileDescriptor.ReplaceReference Failed IV2010

Anonymous
Not applicable

hi All,

 

The code below give me an error "Invalid procedure call or argument".  I have inventor 2010 installed on the machine. Please help.  Thank you!

 

Sub ChangeReferenceFile()
    Dim oDoc As DrawingDocument
    Set oDoc = ThisApplication.ActiveDocument
    'provided your active document is an .idw
    Dim oFileDialog As FileDialog
    Call ThisApplication.CreateFileDialog(oFileDialog)
    oFileDialog.ShowOpen
    Dim sFileName As String
    sFileName = oFileDialog.FileName
    oDoc.ActiveSheet.DrawingViews(1).ReferencedDocumentDescriptor.ReferencedFileDescriptor.ReplaceReference (sFileName)
End Sub

 

Hank

0 Likes
657 Views
1 Reply
Reply (1)
Message 2 of 2

xiaodong_liang
Autodesk Support
Autodesk Support

Hi,

 

 

Previously with drawings, if you replaced a reference the new file had to be an ancestor of the file it was replacing.  For example, you could make a copy of the file and make edits to the copy and then use the edited file to as a replacement for the reference in the drawing document because it is an ancestor of the original file. 

 

From Inventor 2011 API, there is not any validation done on the replacing file. So you could replace references with no ancestry requirements. However, if the file is not an ancestor you will lose any associated annotations or other drawing information.

0 Likes