• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC SKILL
  3. Two fucntions with same bindkey(cycling fucntions by same...

Stats

  • Locked Locked
  • Replies 6
  • Subscribers 143
  • Views 2215
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Two fucntions with same bindkey(cycling fucntions by same bindkey)

Leonardo Vinci
Leonardo Vinci over 7 years ago

I have 2 functions(say A and B) only differing in putting different widths of metals. The functions works well, but i want to assign only one bind key to execute them. For eg: 

I selected an instance by mouse click and press "Shift+1" so function A should execute. But if i press again "Shift+1" (instance being selected), then it should undo function A and instead function B should execute. Is there any way to do this?

so overall that means, if i select an instance and press "Shift+1" only 1 time, function A only should execute and if i press "Shift+1" totally 2 times, then only function B should execute.

I hope i made myself clear for you to understand.

Thanks! 

Leonardo Da Vinci

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 7 years ago

    Leonardo,

    The way you would normally do this is to store some "state" as a property on the object, and then use that to determine which function to apply. Maybe if all the function is doing is setting the width of the path (if that's what it's doing?) then you could use the current width as the state rather than storing another user-defined property on the object.

    The reason for storing it on the object itself is that presumably if you select one thing, hit the bindkey once (runs A) then twice (runs B) but then select another object and press the bindkey it should run A for that object.

    Andrew.

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • Leonardo Vinci
    Leonardo Vinci over 7 years ago in reply to Andrew Beckett

    Sorry, I see now that functions A and B do differ in calculations too.  

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 7 years ago in reply to Leonardo Vinci
    Leonardo Vinci said:
    Sorry, I see now that functions A and B do differ in calculations too.

    That doesn't help a great deal - I have no idea what you're doing, so I had to reply in rather vague generalities...

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Leonardo Vinci
    Leonardo Vinci over 7 years ago in reply to Andrew Beckett

    By "state" what do you mean Andrew?

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 7 years ago in reply to Leonardo Vinci

    It's like a finite state machine - you do something like:

    procedure(MyDoAorB()
      foreach(obj geGetSelSet()
        if(obj~>MyA_done then
          B(obj)
        else
          A(obj)
          obj~>MyA_done=t
        )
      )
    )

    then have MyDoAorB() on your bindkey (note, this is assuming that the functions B and A accept a single object to work on - I don't know what your functions do). I'm explicitly recording a property on the object to say that A has been done already. If the functions were to set the width to 1.0 or 2.0 then you could do:

    procedure(MyDoAorB()
       foreach(obj geGetSelSet()
         if(obj~>width==1.0 then
           B(obj) ; presumably set width to 2.0
         else
           A(obj) ; presumably set width to 1.0
         )
      )
    )

    i.e. you're using the width attribute on the object as the "state" to know what has previously been done. 

    I'm still guessing what you're doing, but trying to give some kind of idea as to how you'd approach this.

    Regards,

    Andrew.

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • Leonardo Vinci
    Leonardo Vinci over 7 years ago in reply to Andrew Beckett

    Thanks Andrew i will try. 

    Thanks once again!

    LeO

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information