Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
mikhail_tsarev
368 Views, 4 Replies

Change model reference in a drawing rule. Why it doesn't work in Inv 2019?

Hello!

I have a rule that perfectly works in 2017. But in Inventor 2019 it doesn't work and I can't understand why...

 

The rule changes model reference in a drawing to new model with the same name and located same folder as drawing document . This is very useful when you have to create drawings by copying existing documents.

 

Code:

odoc = ThisDoc.Document
Dim NF as String = ThisDoc.Path & "\" & ThisDoc.FileName(False)& ".ipt"
Dim oldFD As FileDescriptor
oldFD = odoc.ReferencedFileDescriptors(1).DocumentDescriptor.ReferencedFileDescriptor
oldFD.ReplaceReference(NF)

odoc.Update()
odoc.Save

Need help...