This event is invoked when internal workflow of Inventor sets the filename and properties. Currently, the support workflow contains frame generator, create substitute, shrink wrap, add assembly / part in assembly, copy component, mirror component etc.
The usage is very straightforward: delegate the event and suggest your custom name in the event, and tell Inventor this event is handled. The following is a small VBA code demo.
Event Class:
Private WithEvents fileUIEvts As FileUIEvents
Private Sub Class_Initialize()
Set fileUIEvts = ThisApplication.FileUIEvents
End Sub
Private Sub Class_Terminate()
Set fileUIEvts = Nothing
End Sub
Private Sub fileUIEvts_OnPopulateFileMetadata(ByVal FileMetadataObjects As ObjectsEnumerator, ByVal Formulae As String, ByVal Context As NameValueMap, HandlingCode As HandlingCodeEnum)
Dim oMetaData As FileMetadata
If FileMetadataObjects.Count > 0 Then
For Each oMetaData In FileMetadataObjects
'suggest custom name
oMetaData.FileName = "asdk_" & oMetaData.FileName
oMetaData.FileNameOverridden = True
Next oMetaData
'tell Inventor the event is handled
HandlingCode = kEventHandled
End If
End Sub
Module:
Private cls As clsFileE
Sub startcmd()
Set cls = New clsFileE
End Sub
Sub Endcmd()
Set cls = Nothing
End Sub
The figure below is a demo when the event suggests a custom name for "mirror component” command.