Updating IDW Documents Automatically before Saving

Updating IDW Documents Automatically before Saving

Anonymous
Not applicable
700 Views
2 Replies
Message 1 of 3

Updating IDW Documents Automatically before Saving

Anonymous
Not applicable

Hi,

I created a really simple rule using 'InventorVb.DocumentUpdate()' and linked this rule to 'Before Save Document'. I expected the file to be updated automatically after the Save button was pressed, and then the file would be saved. The file is being saved but the views present in my drawing still have the lightning bolt icon on their left side. What am I doing wrong?

 

Many Thx, Marcio

0 Likes
Accepted solutions (1)
701 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Accepted solution

Hi @Anonymous . It is because the drawing references needs to be updated. Just try, this code will open your drawing references and update. Unfortunately (when testiing in my computer), this doesnt work when set to open the file invisibly. It would be faster.

 

 

If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then
	MsgBox("This rule '" & iLogicVb.RuleName & "' only works for Drawing Documents.",vbOKOnly, "WRONG DOCUMENT TYPE")
	Return
End If


For Each oDoc As Document In ThisApplication.ActiveDocument.ReferencedDocuments
	Dim oFileName As String = oDoc.FullFileName
	'MsgBox(oFileName)
	oRefDoc = ThisApplication.Documents.Open(oFileName, True) 'False = open invisibly
	oRefDoc.Update()
	oRefDoc.Close(True)
Next

MsgBox("DONE")

 

 

 

Message 3 of 3

Anonymous
Not applicable

Hi  JOJO.S

Yes, thank you for sharing this code, it is true that the files do not open invisible but it does the work.

Sorry for the really long delay in giving you feedback, the notification got lost in my e-mail.

 

Regards,

Marcio

0 Likes