• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    Autodesk Inventor

    Reply
    Employee
    Posts: 932
    Registered: ‎02-24-2009

    Re: ilogic shortcut key

    02-02-2012 01:20 PM 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
    DLS - Mechanical Design
    Autodesk, Inc.

    Please use plain text.
    Mentor
    CadUser46
    Posts: 158
    Registered: ‎02-21-2011

    Re: ilogic shortcut key

    02-02-2012 01:44 PM in reply to: Ktelang
    Thanks for making the time to answer Mike. That's very helpful.
    Inventor 2010 Certified Professional
    Please use plain text.
    Active Contributor
    nikhunter
    Posts: 28
    Registered: ‎05-05-2011

    Re: ilogic shortcut key

    11-30-2012 12:17 PM 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???

     

    Please use plain text.
    Employee
    Posts: 932
    Registered: ‎02-24-2009

    Re: ilogic shortcut key

    11-30-2012 02:06 PM 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
    DLS - Mechanical Design
    Autodesk, Inc.

    Please use plain text.
    Active Contributor
    nikhunter
    Posts: 28
    Registered: ‎05-05-2011

    Re: ilogic shortcut key

    11-30-2012 02:24 PM 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...

    Please use plain text.
    Employee
    Posts: 932
    Registered: ‎02-24-2009

    Re: ilogic shortcut key

    11-30-2012 02:28 PM 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
    DLS - Mechanical Design
    Autodesk, Inc.

    Please use plain text.
    Active Contributor
    nikhunter
    Posts: 28
    Registered: ‎05-05-2011

    Re: ilogic shortcut key

    11-30-2012 02:49 PM 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

    Please use plain text.
    Active Contributor
    nikhunter
    Posts: 28
    Registered: ‎05-05-2011

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

    11-30-2012 02:56 PM in reply to: Ktelang

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

    That only...:smileytongue:

     

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

    Please use plain text.
    Employee
    Posts: 932
    Registered: ‎02-24-2009

    Re: I just want to know, how i can activate a Rule, by pressi...

    11-30-2012 03:12 PM 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
    DLS - Mechanical Design
    Autodesk, Inc.

    Please use plain text.
    Employee
    Posts: 932
    Registered: ‎02-24-2009

    Re: I just want to know, how i can activate a Rule, by pressi...

    11-30-2012 03:28 PM in reply to: MjDeck

    Here's a VBA version of your iLogic rule.



    Mike Deck
    Software Developer
    DLS - Mechanical Design
    Autodesk, Inc.

    Please use plain text.