Hello,
Is there any command/option to add a keyboard shortcut for ilogic rule ?
Thanks
Solved! Go to Solution.
Solved by MjDeck. Go to Solution.
CadUser46,
Can you post a rule or test part? If you post a rule, please copy and paste it to a text file, and attach the text fiel to your message.
Mike
Please find attached the ilogic file with a text version also and the ivb file.
I have my ilogic configuration pointing to the folder where the ilogicvb.txt is located. As far as i can tell there are no typos in the naming of the rule and within VB. Im no vb expert and i pretty new to ilogic so feel free to spoon feed me the error of my ways.
Cheers.
Here is a modified version of your ivb code. External rules are not stored in the document, and there is no API to get a list of the available external rules. You have to know the name of the rule you want to run. Then you can use the function RunExternalRule on the iLogic automation interface.
It just steps all the way through with no errors but still does not run the external ilogic. Is their somewhere else i should be configuring a setting?
The ilogic addins directory points to this location.
C:\Program Files\Autodesk\Inventor 2012\Bin\iLogicAdd
Are you sure it's not running the external iLogic rule? To make sure, please try adding a MessageBox.Show statement to the rule.
Ah OK. It is running the rule, just not one part of it. I was expecting to see the view cube return to home if the rule worked.
This line runs if;
1. I select Run Rule from the ilogic browser.
2. I step through the VBA with F8
'Return view to Home view
ThisApplication.CommandManager.ControlDefinitions.Item("AppViewCubeHomeCmd").Execute
It does not execute this line if i use the VBA/ilogic shortcut. It just seems to miss it out. Any explanation for that?
Instead of:
ThisApplication.CommandManager.ControlDefinitions.Item("AppViewCubeHomeCmd").Execute
please try:
ThisApplication.CommandManager.ControlDefinitions.Item("AppViewCubeHomeCmd").Execute2(True)
You could also add this line:
ThisApplication.ActiveView.Update()
If that doesn't work, why not convert the rule to VBA? You're running it from a VBA button, so it seems like it would be easier to have all code in VBA.
Yes: when you run an iLogic rule from VBA, VBA hands over control to the iLogic rule.
However, on a 64-bit system VBA runs out-of-process, and the iLogic rule will also run out-of-process. This causes some differences in behavior.
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>>>>>>
End if
I also tried the same into the Button_KeyDown, but i had the same result
Do you have any idea???
Nik,
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.
Mike
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...
Nik,
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...
That only...
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.
Can't find what you're looking for? Ask the community or share your knowledge.