From Inventor 2014, you are allowed to open assembly in “Express Mode” which is essentially a light weight model. The benefits of this, are that you can open models faster and that you can open, and work with lots of complex geometry that may have previously been a bit too much for your graphics card to process.
- from Clinton Brown's Blog
When you open an assembly, you can see an option [Open Express] which indicates whether opening in express mode or not.
API can override the built-in open dialog with the custom behaviors. But some developers found even though the custom dialog is opened correctly, the [Open Express] option is missed.
Actually, the issue is because the FileDialog.InsertMode property is true (this is the default value). We don't support opening in Express mode for insert (e.g. place component). If it is appropriate, this will happen automatically. The solution is to set the InsertMode to false prior to showing the dialog. Then the Express checkbox will be shown and enabled as appropriate. The API help reference is not well documented at this point.
In addition, when InsertMode = false, the custom file dialog will know the choice of the user of the option [Open Express]. But you need to tell Inventor if opening assembly in express or not. Otherwise, the assembly will still be opened in full mode.
The following is a VBA demo:
‘*****module******
Option Explicit
Private oEventHandler As Class1
Private Sub StartFileOpen()
Set oEventHandler = New Class1
End Sub
Private Sub EndFileOpen()
Set oEventHandler = Nothing
End Sub
‘****even class *******
Option Explicit
Private WithEvents oEvents As FileUIEvents
Private inCustomDlg As Boolean
Private Sub Class_Initialize()
Set oEvents = ThisApplication.FileUIEvents
inCustomDlg = False
End Sub
Private Sub Class_Terminate()
Set oEvents = Nothing
End Sub
Private Sub oEvents_OnFileOpenDialog(FileTypes() As String, ByVal ParentHWND As Long, FileName As String, ByVal Context As NameValueMap, HandlingCode As HandlingCodeEnum)
If inCustomDlg = False Then ' to avoid recursive callback
inCustomDlg = True
Dim oFileLocations As FileLocations
Set oFileLocations = ThisApplication.FileLocations
Dim FileOpenForm As FileDialog
Call ThisApplication.CreateFileDialog(FileOpenForm)
FileOpenForm.InsertMode = False
FileOpenForm.InitialDirectory = oFileLocations.Workspace
With FileOpenForm
' Set the initial Directory
.InitialDirectory = oFileLocations.Workspace
.DialogTitle = "My File Open"
.Filter = "Part File (*.ipt)|*.ipt" _
& "|Assembly File (*.iam)|*.iam" _
& "|Presentation File (*.ipn)|*.ipn" _
& "|Drawing File (*.idw)|*.idw" _
& "|Design element File (*.ide)|*.ide" _
.FilterIndex = 2 ' *.iam files
.OptionsEnabled = True
'.Flags = cdlOFNHideReadOnly
.ShowOpen
End With
FileName = FileOpenForm.FileName
If FileOpenForm.OptionValues.Count >= 6 Then
' assembly has 6 options
Dim index As Integer
Dim oKey As String
For index = 1 To FileOpenForm.OptionValues.Count
oKey = FileOpenForm.OptionValues.Name(index)
If oKey = "OpenExpressMode" Then
' this is a Boolean for OpenExpress/Don't open Express
If FileOpenForm.OptionValues.Item(index) Then
'if OpenExpress was specified, pass it back through the context
Context.Add "ExpressModeBehavior", "OpenExpress"
End If
End If
Next
End If
If FileName = "" Then
HandlingCode = kEventCanceled
Else
HandlingCode = kEventHandled
End If
inCustomDlg = False
End If
End Sub