Replacing Referenced Document in Drawing does not update until its re-opened.

Replacing Referenced Document in Drawing does not update until its re-opened.

C_Haines_ENG
Collaborator Collaborator
370 Views
6 Replies
Message 1 of 7

Replacing Referenced Document in Drawing does not update until its re-opened.

C_Haines_ENG
Collaborator
Collaborator

I have found the code to replace the referenced document as shown below:

 

doc = ThisDoc.Document
oView = ActiveSheet.DrawingViews.NativeEntity.Item(1)
Dim oFD As FileDescriptor

'CALL ON INVENTORS "REFERERENCE MODEL" API
oFD = doc.ReferencedFileDescriptors(1).DocumentDescriptor.ReferencedFileDescriptor

'REPLACE REFERENCED MODEL WITH PART THAT HAS SAME NAME AS DRAWING
oFD.ReplaceReference(ThisDoc.Path & "\" & ThisDoc.FileName & ".ipt")
doc.Update

 

However, when run it changed the "Referenced model" but it doesnt actually update it within the drawing? If I close and re-open, it shows up correctly. I tried writing some extra code to close and re-open the drawing but no dice. Im hoping theres a simple solution im missing here. 

0 Likes
371 Views
6 Replies
Replies (6)
Message 2 of 7

Curtis_Waguespack
Consultant
Consultant

Hi @C_Haines_ENG 

 

I did a real quick test of the code you posted and it works as expected for me ( using Inventor 2022).

 

When the code runs I see the Green Brackets around the drawing view flash for a second and then the drawing view updates to show the new model.

 

Maybe you have some drawing update option enabled/disabled?

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

EESignature

0 Likes
Message 3 of 7

C_Haines_ENG
Collaborator
Collaborator

I have tried it again multiple times, the drawing updates but the actual view still says the file is missing its reference. See Image. The missing file reference icon dissapeared from the drawing but the actual view did not update. Do I have to update all the views?

chainesL5H3G_1-1669746609704.png

 

The file is essentially completely unlinked and wont change uless I close and re-open, which likely forces a drawing view update.

 

Ive also just tested updating all views, it doenst seem to work either.

 

 You can see the referenced file has updated in the manual menu aswell. I dont have any settings that would delay updates. 

 

chainesL5H3G_3-1669746678909.png

 

 

0 Likes
Message 4 of 7

Curtis_Waguespack
Consultant
Consultant

Hi @C_Haines_ENG 

 

I see the issue now. 

 

My earlier test did not have a view with a missing file reference, it was just changing a resolved view with a different part.

 

If I have time later today, I'll have another look. 

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

EESignature

0 Likes
Message 5 of 7

C_Haines_ENG
Collaborator
Collaborator

Did you ever get around to this?

0 Likes
Message 6 of 7

Curtis_Waguespack
Consultant
Consultant

Hi @C_Haines_ENG 

 

I did look at it briefly, but unfortunately I did not see a way to resolve it. Maybe someone else will be able to have a look and see a solution.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

 

EESignature

0 Likes
Message 7 of 7

A.Acheson
Mentor
Mentor

I had this happen in Inv2020 but with a manual replace of one of the views. Can you see if expanding the browser nodes for sheet and view manually will update the view? That was the solution in that case which is really odd bug. I can find the post if it is the case. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes