Sorry, you're right: all add-ins run in-process. Here's more detail: when API code in Inventor (or in an add-in) is run from out-of-process, it will run in a separate thread (not the main Inventor UI thread).
Hi everyone.I have create a simple rule, and i copy the VBA code that Mike provided into a Button that i created in UseForm...Thats what happen when i run the programm is to press the button with my mouse and i have the implemetation of the rule.
But what I want in reality is to have the same process (I mean the implemetation of the rule), but not with a button trigger rather a KeyPress.
I try to write this code in UserForm_KeyDown, but nothings happened.
If e.KeyCode = Keys.Enter Then
<<<<<< The rule in here>>>>>>
I also tried the same into the Button_KeyDown, but i had the same result
Do you have any idea???
You can choose a key to run a VBA macro. You don't need any code (such as UserForm_KeyDown) to do it.
Are you using VBA only? You're not using iLogic? I'm a bit confused because you talk about a rule. VBA programs are called macros.
Hello Mike.Ok, listen step by step what i have done....
Firstly, i use iLogic to create a rule (Rule0) which modify o part of my construction...
Then, i go to VBA macro, where i use a button in which i copy your code...It's just o copy paste of your code as you have provided, with purpose to activate my rule(Rule0)...
Finally, i run the macro and the only thing I have to do, is to press the button with my mouse and it works...
Substantially it's that you say.I must choose a key to run a VBA macro, but i dont know how...Which is the right code, that connect my keyboard to activate a Rule....
That's what i'am asking about, it to do the same thing, but not by pressing the button with my mouse, but pressing a Key by my Keyboard....Thanks for your time...
Could you post your iLogic rule? If it is more than 3 lines, please put it in a txt file and attach it to the post. Otherwise formatting will be lost.
The reason I want to see the rule is to make sure that it can't be easily converted to VBA code. It will be easier if you can do everything in VBA.
Ok, imagine 2 lines that i have compounds with an angle construction...
I create a Rule, where i write this in there....
Parameter("d350") = 90
Constraint.IsActive("Angle:1") = True
Then i go to VBA and copy your code in a button..
When i run the programm, i press the button with my mouse, and two lines get corner 90 degrees between them...
In my progress, i have a lot of construction and a lot of transformations
That works i want to do, not by pressing the button with my mouse but by pressing a Key
I just want to know, how i can activate a Rule, by pressing a Key...
You say that i can choose a key to activate a VBA macro....How i can do that???
You have given us a code, but i dont know how to use it to activate the rule by my keyboard
The only thing i have done, it's to copy that code in a button that i create in VBA editor, and activate the rule by pressing that with my mouse, when the programm running...
Hmmmmm.Maybe i dont use macro, but VBA editor???Its that a problem????
I realy sorry if i tyried you...
I'm converting your rule to VBA code. However, it should also work the way you have it, as an iLogic rule.
To make it work from the keyboard:
Put the VBA Macro (Sub) into your ApplicationProject. This is a global VBA project. Macros in it are available in all documents, and keyboard keys can be assigned to them.
In Inventor, use Tools -> Customize. Select the Keyboard tab. Sort by Category and look for the Macros category. Your macro should be listed there. Then you can enter a shortcut key (or keys) in the first column.
Here's a VBA version of your iLogic rule.
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register
Start with some of our most frequented solutions to get help installing your software.