Hi,
I'm very new to VB programming and Inventor's API. One thing that my co workers and I would really like is a macro that would allow us to pre-select what assembly constraint type we want to use, rather than the default mate. We use Insert quite a lot, for instance, and would like to be able to program a keystroke to bring up the constraint dialog with Insert pre-selected. Could anyone give me a little guidance as to whether or not this is possible, and how I would go about accessing that part of the API?
Thank you.
Hi Ekaspar,
In most cases the Inventor API allows you to automate workflows but very rarely to control the native dialogs and tools that are used by Inventor.
You can programmatically fire the constraint dialog as follow (VBA) but don't have any control over the content of this dialog:
Public Sub ExecuteCommand() ThisApplication.CommandManager.ControlDefinitions.item("AssemblyInsertConstraintCmd").Execute End Sub
It's theoritically possible to "simulate" user actions on a form by using low level Windows APIs, but achieving this will definitely require a good knowledge of Win32 APIs. If you are interested in the topic, you should take a look over the web for "CBT Hook" for example, then how you can send messages to a specific Windows control.
This is clearly a hack, so you will need to research this kind of workaround on your own, we don't directly support such questions.
Hope that helps,
Philippe.
Can't find what you're looking for? Ask the community or share your knowledge.