When FileUIEvents::OnPopulateFileMetadata is exactly invoked ?

By Xiaodong Liang

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.

image


Comments

3 responses to “When FileUIEvents::OnPopulateFileMetadata is exactly invoked ?”

  1. Is there also a way to change where the file will be saved (File Location)? I tried to use oMetaData.FullFileName = .ipt but does not work.

  2. 2015 Frame Generator command “break member” unfortunately, does not fire this event.

  3. Hi,
    I have test this with the mirror function but is not working in Inventor 2015?
    Marco

Leave a Reply to MarcoCancel reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading