Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ilogic shortcut key

61 REPLIES 61
SOLVED
Reply
Message 1 of 62
Ktelang
8801 Views, 61 Replies

ilogic shortcut key

Hello,

 

Is there any command/option to add a keyboard shortcut for ilogic rule ?

Thanks

------------------------------------------------------------------------------
Config :: Intel (R) Xeon (R) CPU E31245 @ 3.30 GHz, 16.0 GB, 64bit win7
Inventor 2013 and Vault Basic 2013
-----------------------------------------------------------------------------
61 REPLIES 61
Message 21 of 62
MjDeck
in reply to: CadUser46

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 Deck
Software Developer
Autodesk, Inc.

Message 22 of 62
CadUser46
in reply to: MjDeck

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.


Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

---------------------------------------------------------------------------------------------------------------------------
Inventor 2010 Certified Professional
Currently using 2023 Pro
Message 23 of 62
MjDeck
in reply to: MjDeck

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.


Mike Deck
Software Developer
Autodesk, Inc.

Message 24 of 62
CadUser46
in reply to: MjDeck

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

 

 


Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

---------------------------------------------------------------------------------------------------------------------------
Inventor 2010 Certified Professional
Currently using 2023 Pro
Message 25 of 62
MjDeck
in reply to: MjDeck

Are you sure it's not running the external iLogic rule?  To make sure, please try adding a MessageBox.Show statement to the rule.


Mike Deck
Software Developer
Autodesk, Inc.

Message 26 of 62
CadUser46
in reply to: MjDeck

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?


Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

---------------------------------------------------------------------------------------------------------------------------
Inventor 2010 Certified Professional
Currently using 2023 Pro
Message 27 of 62
MjDeck
in reply to: CadUser46

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.


Mike Deck
Software Developer
Autodesk, Inc.

Message 28 of 62
CadUser46
in reply to: Ktelang

Hey Mike.

I already converted it to vba. I'm just curious as to why it doesn't run when launched from vba as no doubt there will be future examples that will be pure ilogic. When using this method does vba hand over to the ilogic add in completely?


Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

---------------------------------------------------------------------------------------------------------------------------
Inventor 2010 Certified Professional
Currently using 2023 Pro
Message 29 of 62
MjDeck
in reply to: CadUser46

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.


Mike Deck
Software Developer
Autodesk, Inc.

Message 30 of 62
CadUser46
in reply to: Ktelang

Ah that might explain some of it. I was under the impression that since it's an addin and its part of the core program it ran in process even though it's 64bit. Actually I thought all adding were in process. Maybe I need to go back and read the API help file.

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

---------------------------------------------------------------------------------------------------------------------------
Inventor 2010 Certified Professional
Currently using 2023 Pro
Message 31 of 62
MjDeck
in reply to: CadUser46

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).


Mike Deck
Software Developer
Autodesk, Inc.

Message 32 of 62
CadUser46
in reply to: Ktelang

Thanks for making the time to answer Mike. That's very helpful.

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

---------------------------------------------------------------------------------------------------------------------------
Inventor 2010 Certified Professional
Currently using 2023 Pro
Message 33 of 62
nikhunter
in reply to: Ktelang

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???

 

Message 34 of 62
MjDeck
in reply to: nikhunter

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


Mike Deck
Software Developer
Autodesk, Inc.

Message 35 of 62
nikhunter
in reply to: MjDeck

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...

Message 36 of 62
MjDeck
in reply to: nikhunter

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.


Mike Deck
Software Developer
Autodesk, Inc.

Message 37 of 62
nikhunter
in reply to: Ktelang

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

Message 38 of 62
nikhunter
in reply to: Ktelang

I just want to know, how i can activate a Rule, by pressing a Key...

That only...Smiley Tongue

 

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...

Message 39 of 62
MjDeck
in reply to: nikhunter

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.


Mike Deck
Software Developer
Autodesk, Inc.

Message 40 of 62
MjDeck
in reply to: MjDeck

Here's a VBA version of your iLogic rule.


Mike Deck
Software Developer
Autodesk, Inc.

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

Post to forums  

Autodesk Design & Make Report