Home > Community > Forums > Custom IC Design > 2 Stroke bindkey or state machine bindkey application

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 2 Stroke bindkey or state machine bindkey application 

Last post Mon, May 12 2014 2:40 AM by Andrew Beckett. 9 replies.
Started by bharath2k4 28 Nov 2013 10:21 PM. Topic has 9 replies and 1116 views
Page 1 of 1 (10 items)
Sort Posts:
  • Thu, Nov 28 2013 10:21 PM

    • bharath2k4
    • Not Ranked
    • Joined on Fri, Nov 29 2013
    • Posts 3
    • Points 45
    2 Stroke bindkey or state machine bindkey application Reply

    Hi ,

     

     I remember using 2 stroke bindkey previously in IC5.14. Now I have moved, and currently using IC6.1.5 version Will the state machine  or 2 stroke bindkey work?

    example of a 2 storke bindkey:

    1. Press key<a>,

    2. It expects one more key/stroke to complete a bindkey operation

     

    Press key <a> and

    if we press  <q> - say move

    if we press <w> - say  copy

    <e> - say rotate and so on..

     

    like wise , This is not pressing 2 keys at a time, but one after the other 

    <q><a> - rotate;

    <q><s> - operation2;

    <q><d> -operation3;

    <q><f> -operation4 

     

    I am not sure if I am understandable, Pardon me if I am not. I can explain again.

     

    Thanks,

    Bharath 

    Filed under:
    • Post Points: 20
  • Fri, Nov 29 2013 1:57 AM

    Re: 2 Stroke bindkey or state machine bindkey application Reply

    Hi Bharath,

    Given that this is not a standard feature of the tools, it can only have been available by implementing it in SKILL. There's no reason why you couldn't use the same SKILL in IC61X.

    I posted an example of how to implement this a while back - see this post.

    Kind Regards,

    Andrew.

    • Post Points: 20
  • Fri, Nov 29 2013 2:16 AM

    • bharath2k4
    • Not Ranked
    • Joined on Fri, Nov 29 2013
    • Posts 3
    • Points 45
    Re: 2 Stroke bindkey or state machine bindkey application Reply

    Hi Andrew,

     

    I expected your reply.Few things,

    1. I don't have the code used previously.

    2. I saw your post, before posting this and had few questions.

    Your script:

    1. I have loaded your script. Initially I saved it in the form of name.il and it did not work due to defun conflicts. Later I read your post carefully and found that I have to save the file with *.ils extention. what is the difference?

    2. I have tried an example of F.I.T and nothing happened. I typed f,i,t and there is no reaction from layout viewer. Below is the bindkey I tried.

     abSeqBindKey->set("Layout" "fit" "hiZoomAbsoluteScale(hiGetCurrentWindow() 0.9)")

    3. I did not get any error while loading or using, just that there is no response to the commands. Can you provide me some examples to verify?

    4. You were talking about complex state machines in that post. Did you by any chance try that?  

     

    Thanks for your reply, 

     

     

    • Post Points: 20
  • Fri, Nov 29 2013 3:39 AM

    Re: 2 Stroke bindkey or state machine bindkey application Reply

    My guess is that you didn't also call:

     abSeqBindKey->initBindKeys("Layout")

    You must do this to initialize the system. Without this, any registered key sequences will have no effect - this redefines all the letter and number keys to call this system. That's why you didn't get any errors, because the registered key sequence was never triggered. I did both the initBindKeys and the "fit" definition shown above, and it then worked fine in IC613. 

    The .ils suffix is required because the code is SKILL++ code; it takes advantage of lexical scoping to allow local functions and data, and this will not work with a .il suffix.

    I did not try a "state machine" type approach. I think this would be more complex to implement (at least more complex to maintain and register particular key sequences, potentially).

    Regards,

    Andrew.

    • Post Points: 20
  • Wed, May 7 2014 9:09 AM

    • Mwcaboose
    • Not Ranked
    • Joined on Tue, Oct 8 2013
    • Posts 5
    • Points 100
    Re: 2 Stroke bindkey or state machine bindkey application Reply

    Andrew,

     So would the code listed in your link above also include modifier key functionality?

    The reason I ask, is that I'm trying a different keyboard, and I'd like to remap some keys to perform default Cadence bindkey functionality.  For example, Cadence default "Shift<m>" gives you Mirror X/Y adjustability inside the move command.

    I want the exact same functionality/options based on a Numpad 0(Shift functionality) + Numpad 6 for move.

    Could your code be tweaked to yield the desired effect? Is what I want a different issue?

    Thanks,
    Michael

     

    Filed under:
    • Post Points: 20
  • Fri, May 9 2014 11:15 AM

    Re: 2 Stroke bindkey or state machine bindkey application Reply

    I updated the other post that you appended to, but I see you've given more details in this one.

    You could use this selectively, by only defining key bindings on <Key>KP_0 etc. You could define your own function:

     defun(CCFnumpadBindKeys (appType)
        let((appRoot)
            appRoot=hiGetBindKeyInheritRoot(appType)
            when(appRoot
                for(ascii charToInt('\0) charToInt('\9)
                    hiSetBindKey(appRoot
                        strcat("<Key>KP_" intToChar(ascii))
                        sprintf(nil "abSeqBindKey->enter(\"%s\")"
                            intToChar(ascii))
                    )
                ) ; for
                hiSetBindKey(appRoot "Shift<Key>KP_0" "abSeqBindKey->enter(\"S\")")
                hiSetBindKey(appRoot "<Key>Escape" "abSeqBindKey->reset()")
            ) ; when appRoot
        ) ; let
    ) ; defun CCFnumpadBindKeys

    This defines shift-0 (on they numeric keypad as "S" for shift), and all the others as numbers. So then I can do:

    CCFnumpadBindKeys("Layout")
    abSeqBindKey->set("Layout"
      '(
        ("S6" "leHiMove()")
      )
    )

    Then shift-0 and then 6 will do a move.

    Regards,

    Andrew.

     

    • Post Points: 20
  • Fri, May 9 2014 11:55 AM

    • Mwcaboose
    • Not Ranked
    • Joined on Tue, Oct 8 2013
    • Posts 5
    • Points 100
    Re: 2 Stroke bindkey or state machine bindkey application Reply

     Andrew,

     

    I guess what I meant to say is that I want the Keypad 0 key to function as a Shift key.  So inside the Move command, a "KP_0+ middle mouse" button functions the same as a "Shift+middle mouse" button.

     

    Example:

    KP_6/m starts the move command.  I have my data selected, and want to mirror it.  Instead of the default "Shift+middle mouse", I want a "KP_0"+middle mouse.

     

    Does that make sense?  Any solution?  Thank you for your reply.

    • Post Points: 20
  • Fri, May 9 2014 12:55 PM

    Re: 2 Stroke bindkey or state machine bindkey application Reply

    That's rather different from what you said earlier, and is not possible (either with my code or with bindkeys in general). Ordinary keys cannot be used as modifiers. Seems a pretty strange request!

    Regards,

    Andrew 

    • Post Points: 20
  • Fri, May 9 2014 1:06 PM

    • Mwcaboose
    • Not Ranked
    • Joined on Tue, Oct 8 2013
    • Posts 5
    • Points 100
    Re: 2 Stroke bindkey or state machine bindkey application Reply

     Yeah, I'm sorry for any lack of clarity.  It was unintentional. I was afraid it wouldn't work.  And yes, a strange request, I agree.  I have an unusual keyboard that I'm trying out.  It places the numpad to the left of the alphabetical portion.  The thought was I could minimize having to take my hand off the mouse, and reduce left hand movement over the keyboard by customizing the keypad to handle the most common bindkeys.  The idea works great with the exception of my "strange request".

     Guess I'll have to devise another plan.

     Out of curiousity, is it a limitation of Cadence, or is something hard coded in the keyboard hardware that prevents the change?  We have a Cadence AE here onsite, and he said it couldn't be done, at least that he was aware of.  I wasn't prepared to give up so easily.

     

    Thanks for looking anyway.

    Cheers,

    Michael

     

    EDIT:   PS, Now I wonder, could the functionality of a Shift+MiddleMouse in a Move or Copy command be bound to 1 key?  Say I use M for move, and THEN press KP_0 to mirror the selected data, and each key press toggles/cycles through each orientation.  Would that work?

     

    • Post Points: 20
  • Mon, May 12 2014 2:40 AM

    Re: 2 Stroke bindkey or state machine bindkey application Reply

    I'm not sure if it's a hardware limitation or an X limitation. I couldn't even get  xmodmap -e "add shift = KP_0" to have an effect (it shows up in xmodmap -pm but it doesn't work as a shift key still).

    For your "EDIT" (by the way, there are no notifiers sent for edits, so I could have easily missed that), there's nothing to stop you adding a bindkey for lxCmdShiftOptions() (shift middle mouse) and lxCmdOptions() (middle mouse).

    e.g.

    hiSetBindKey("Layout" "<Key>KP_0" "lxCmdShiftOptions()")
    hiSetBindKey("Layout" "<Key>KP_1" "lxCmdOptions()")

    You could limit them to only work in enter functions (such as move or copy) by using:

    hiSetBindKey("Layout" "<Key>KP_0EF" "lxCmdShiftOptions()")
    hiSetBindKey("Layout" "<Key>KP_1EF" "lxCmdOptions()")

    Regards,

    Andrew.

     

    • Post Points: 5
Page 1 of 1 (10 items)
Sort Posts:
Started by bharath2k4 at 28 Nov 2013 10:21 PM. Topic has 9 replies.