Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Anonymous
687 Views, 4 Replies

Inventor AIP Samples in the API Help Fail.

Good morning all, I'm trying to learn the AIP. Going through some of the example in the API help section, there are several samples (about every other one) that fail when I run them. I have tried running them in a ZeroDocument/part/assembly environment and with no changes to the code or outcome.

 

For example, when I try to run the "Add commands to the application menu API Sample" (shown at the end), here is what I see:INV_Demo2.PNG

 

Placing a watch on oFileBrowserControls agrees with the error that the .AddButton command isn't found. 

 

However, when I check with Intelisense, it does show up as an available method:

INV_Demo1.PNG

 

The API samples inside the API help documentation are meant to be stand-alone subs, right?

What am I missing?

 

Sub AddCommandsToFileBrowser()
    ' Get the application menu controls collection
    Dim oFileBrowserControls As CommandControls
    Set oFileBrowserControls = ThisApplication.UserInterfaceManager.FileBrowserControls

    ' Get the "Zoom All" and "Home View" commands
    Dim oDef1 As ButtonDefinition
    Set oDef1 = ThisApplication.CommandManager.ControlDefinitions.Item("AppZoomAllCmd")

    Dim oDef2 As ButtonDefinition
    Set oDef2 = ThisApplication.CommandManager.ControlDefinitions.Item("AppIsometricViewCmd")

    ' Create button controls, positioned before the "Manage" control
    Call oFileBrowserControls.AddButton(oDef1, True, True, "Manage", True)
    Call oFileBrowserControls.AddButton(oDef2, True, True, "Manage", True)
    Call oFileBrowserControls.AddSeparator("Manage", True)
End Sub