Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Macro to select constraint type

2 REPLIES 2
Reply
Message 1 of 3
ekaspar
276 Views, 2 Replies

Macro to select constraint type

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.

2 REPLIES 2
Message 2 of 3
philippe.leefsma
in reply to: ekaspar

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.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Message 3 of 3
ekaspar
in reply to: philippe.leefsma

Thanks for the informative answer. I'll maybe look in those directions.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report