Access API Hidden Members From External IDE

Access API Hidden Members From External IDE

SometimesInventorMakesMeAngry
Advocate Advocate
812 Views
6 Replies
Message 1 of 7

Access API Hidden Members From External IDE

SometimesInventorMakesMeAngry
Advocate
Advocate

There are hidden members you can access in the built-in VBA IDE by

 

  • Right click in Object Browser > Show Hidden Members

Is it possible to access these members from an external IDE such as Visual Studio?

 

Specifically, I'd like to start a global transaction

TransactionManager.StartGlobalTransaction

to take advantage of its optimizations (compared to regular transactions)

TransactionManager.StartTransaction
0 Likes
Accepted solutions (1)
813 Views
6 Replies
  • API
Replies (6)
Message 2 of 7

JelteDeJong
Mentor
Mentor
Accepted solution

Yes its possible like this.

Dim oInv As Inventor.Application = System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application")
Dim oDoc As Document = oInv.ActiveDocument
Dim trans As Transaction = oInv.TransactionManager.StartGlobalTransaction(oDoc, "<Your description>")
Try
    ' do your stuff here

Catch ex As Exception
    ' do somethng with the exception
End Try
trans.End()

The function "StartGlobalTransaction" is hidden because it can make Inventor work more unstable if you don't end the transaction. There for i would advise you to use a try/catch function like above.

 

just a quick tip if you are optimizing your program. Check out this and this pages. (The first page also talks about the "StartGlobalTransaction" function.)

 

 

 

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

Message 3 of 7

AlexKorzun
Autodesk
Autodesk

Hi,
There are several VS extensions that provide better support for intellisence. The built-in Object Browser can also help with the discovery. Please note the method you are referring to is discoverable, but it is not documented. Because of that, Autodesk may change or replace it with no warning.

 
 

 

Thank you,




Alex Korzun
Inventor-Revit Interop / Inventor-Fusion Interop / Inventor ETO
Autodesk, Inc.

0 Likes
Message 4 of 7

SometimesInventorMakesMeAngry
Advocate
Advocate

Thank you! I knew about the instability and already had a try catch in place. I wasn't seeing StartGlobalTransaction in Intellisense so I assumed it was not available. But everything worked perfectly just by replacing StartTransaction with StartGlobalTransaction.

0 Likes
Message 5 of 7

SometimesInventorMakesMeAngry
Advocate
Advocate

I appreciate the warning. Can you explain which extensions you're talking about? I'm not using VS Code, if that's what you're thinking.

0 Likes
Message 6 of 7

AlexKorzun
Autodesk
Autodesk

Unfortunately, we cannot recommend any tool or extension for VS, but you can explore the extensions easily via "Manage Extensions" UI:

AlexKorzun_0-1605906837185.png

 

Visual Studio Object Browser is helpful too:

AlexKorzun_1-1605906936724.png

 

 

Thank you,




Alex Korzun
Inventor-Revit Interop / Inventor-Fusion Interop / Inventor ETO
Autodesk, Inc.

0 Likes
Message 7 of 7

SometimesInventorMakesMeAngry
Advocate
Advocate

Thank you! I will check it out.

0 Likes