Issue
I would like to open my drawing document in a way that it does not get updated, it opens the way it was last saved. How could I do it?
Solution
Drawing documents have a property called 'Defer Updates' which can be used to tell Inventor not to update the document when we open it.
If this property is set then Inventor will bring up a dialog warning us that the document will not get updated.
Therefore in both versions we need to use SilentOperation.
Following code works Inventor 10
You can either set the 'Defer Update' property of the drawing using the following code:
Dim oASC As New ApprenticeServerComponentDim oASD As ApprenticeServerDocument
Set oASD = oASC.Open("C:\Inventor\part.idw")
it's in the "Design Tracking Properties"
oASD.PropertySets("{32853F0F-3444-11d1-9E93-0060B03C1CA6}").ItemByPropId(kDrawingDeferUpdateDesignTrackingProperties).Value = True
oASD.PropertySets.FlushToFile
oASC.Close
and then you open it
ThisApplication.SilentOperation = True
ThisApplication.Documents.Open ("C:\Inventor\part.idw")
ThisApplication.SilentOperation = False
Following code works with Inventor 11 and higher versions.
Through API, "Defer update" property can be Set/Get with "DrawingDocument.DrawingSettings.DeferUpdates"
Through the UI, "Defer update" property is in 'Tools->Document Settings...->Drawing' tab.
There is another way that we can get what we need through calling to 'OpenWithOptions' function, which can be called with a NamedValueMap argument.
Dim oNVM As NameValueMap
Set oNVM = ThisApplication.TransientObjects.CreateNameValueMap
Call oNVM.Add("DeferUpdates", True)
Dim oD As Document
ThisApplication.SilentOperation = True
Set oD = ThisApplication.Documents.OpenWithOptions("C:\Inventor\part.idw", oNVM)
ThisApplication.SilentOperation = False
Note: Above way is same workable with VB.NET. Define a global variable "ThisApplication" to
delegate the Application object of Inventor, then copy below code to run:
Dim oNVM As NameValueMap = ThisApplication.TransientObjects.CreateNameValueMap
oNVM.Add("DeferUpdates", True)
ThisApplication.SilentOperation = True
Dim oD As Document = ThisApplication.Documents.OpenWithOptions("C:\Inventor\part.idw", oNVM)
ThisApplication.SilentOperation = False