Access Vault's Generate File Number Event in custom C# Inventor addin

Access Vault's Generate File Number Event in custom C# Inventor addin

dfreemanPX2KX
Explorer Explorer
171 Views
1 Reply
Message 1 of 2

Access Vault's Generate File Number Event in custom C# Inventor addin

dfreemanPX2KX
Explorer
Explorer

Hi all,

I'm developing an add-in for Autodesk Inventor 2023 to assist with automation tasks in my workplace, and we're using Vault Professional 2023 for file management.

As part of this process, I'm attempting to change the default placeholder filename that appears when selecting the "Insert Cable and Harness" button (Insert New Harness command) in an assembly's Environment tab (or when running this command through API calls). The goal is to enforce our company's naming convention automatically, so users don't have to manually change the name every time. Specifically, our harness files should be named in a format similar to HarnessPartNumber_AssemblyPartNumber.iam, where the AssemblyPartNumber is the filename for the assembly the harness exists inside.

I can access the Cable and Harness button events through UserInputEvents.OnActivateCommand and UserInputEvents.OnTerminateCommand. When the user is not connected to Vault, I use the FileUIEvents.OnPopulateFileMetadata event to change the FileMetadata object's file name to our required naming convention. This works as expected.

However, when the user is connected to Vault and needs to create a new part number for the harness, they use the Vault add-in's "Generate File Number" dialog box. The auto-generated part number is then used as the default filename in the create harness dialog box (e.g., newPartNumber.iam), but the OnPopulateFileMetadata event does not fire in this case. This means I cannot modify the default file name to include the new part number and match our naming convention.

My question is:

Is there a way to access the Vault add-in's "Generate File Number" dialog event or obtain the generated part number before the create harness dialog appears, so I can modify the default placeholder name accordingly?

I've considered integrating with the Vault API but haven't found a method to intercept the generated part number or an event that I can subscribe to for this purpose. I'm also open to alternative solutions that would allow me to enforce our naming convention during harness creation when connected to Vault.

Any guidance or suggestions would be greatly appreciated.

Thank you!



dfreemanPX2KX_0-1731483643497.png

0 Likes
172 Views
1 Reply
Reply (1)
Message 2 of 2

mfoster9TD82
Advocate
Advocate

You'll need to use the Vault API, you can use the Vault connection from inside of Inventor.

using VB = Connectivity.Application.VaultBase;
...
public static Vlt.Currency.Connections.Connection GetInventorVaultConnection(Inventor.Application InvApp)
{
    Vlt.Currency.Connections.Connection connection = VB.ConnectionManager.Instance.Connection;

    if (connection is null ||!connection.IsConnected)
    {
        InvApp.CommandManager.ControlDefinitions["LoginCmdIntName"].Execute2(true);
        //InvApp.UserInterfaceManager.Ribbons["Assembly"].RibbonTabs["id_TabVault"].RibbonPanels["id_PanelZ_VaultAccess"].CommandControls["LoginCmdIntName"].ControlDefinition.Execute2(true);
        connection = VB.ConnectionManager.Instance.Connection;
    }
    return connection; 
}

 

Then you can use the GenerateFileNumber() method in the DocumentService class to generate your numbers.

I hope this helps.

0 Likes