• 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. Skill code to change Metal width

Stats

  • Locked Locked
  • Replies 7
  • Subscribers 143
  • Views 6873
  • 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

Skill code to change Metal width

ManjunathYalameli
ManjunathYalameli over 1 year ago

Hi All, 

I am trying to write a skill code to change the metal width bindkey. without opening its query form. 

Here is my skill code

hiSetBindKey("Layout" "Ctrl<key>q" "change_metal_width()")
procedure(change_metal_width()
selected=geGetSelSet()
hiFocusToCIW( )
float_num=enterNumber()
selected~>width=float_num
)

This code works perfectly but I need to focus into CIW then I enter number the it changes width, If I comment hiFocusCIW() then run the script, view get stuck. Then I press ESC it comes back to normal without changing metal width. Please let me know what other commands I can use it.

Thank you in advance. 

  • Cancel
Parents
  • p94todorov
    p94todorov over 1 year ago

    Hi,

    I just tried your code and it works just fine after pressing Enter instead of ESC in the CIW.
    It brings back the window it was invoked from on focus and the instance is updated.

    Regards,

    Petar

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • ManjunathYalameli
    ManjunathYalameli over 1 year ago in reply to p94todorov

    Hi Petar, 

    Thanks for the reply,  Here I don't want to bring CIW in between the code running.

    regards

    Manju

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • AurelBuche
    AurelBuche over 1 year ago in reply to ManjunathYalameli

    Hi Manju,

    There might be different approaches to achieve what you want

    I remembered this thread about bindkeys triggered using a succession of characters : How to create two or three key strokes bindkeys

    You might use something similar to type the numbers without having to focus to the CIW

    Another solution would be to make a little form pop-up with just a number string and press 'enter' or 'esc' to apply or cancel the form (I can provide you with a little example if you need it)

    Cheers

    Aurélien

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • RicardoGV1
    RicardoGV1 over 1 year ago in reply to AurelBuche

    Hi Aurel,

    I'm trying to reply another version of Andrew's code, do you know if there is any character limit or something?

    I'm getting this text, but I don't have external links that can be causing that.


    Regards, 
    R.Gómez

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • RicardoGV1
    RicardoGV1 over 1 year ago in reply to AurelBuche

    Hi Aurel,

    I'm trying to reply another version of Andrew's code, do you know if there is any character limit or something?

    I'm getting this text, but I don't have external links that can be causing that.


    Regards, 
    R.Gómez

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
  • Andrew Beckett
    Andrew Beckett over 1 year ago in reply to RicardoGV1
    RicardoGV1 said:
    I'm trying to reply another version of Andrew's code, do you know if there is any character limit or something?

    I'm not sure which of "Andrew's code" you're referring to (ah, I assume it's the code in this old thread How to create two or three key strokes bindkeys). The reason you can't post it is because it uses the function "substring". For some bizarre reason, code containing this function gives the error you shared; I've had this before and it's been followed up by our IT team and I think reported to the forum software vendor. The code was probably posted in the previous forum system or an older version.

    If you get this error, it hasn't gone into moderation or because it thinks it's spam - it's just a strange bug in the forums...

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • RicardoGV1
    RicardoGV1 over 1 year ago in reply to Andrew Beckett

    Hi Andrew, 

    Yes, that code.  This can save previous bindkeys and when pressing esq it retrieves them after using the code.

    Thanks for that information, so please Manju, if you use it, substitute al st by substring.

    R.Gómez

      ;called on initial setup to setup everything
            procedure(InitCustomStrokes()
                /********************* STROKES GODConsole **************************************/
                    ;println("entr")
                    ;loadi("CustomStrokes.ils")  ; para abrir GodConsole
                    loadi("/eda/homes/us11/rgomez/Documents/Skills/Prueba/skill/to_be_approved/Skills/CustomStrokes.ils")
                    ;CustomStrokes->initBindKeys("Layout")
                    CustomStrokes->set("Layout" "fit" "hiZoomAbsoluteScale(hiGetCurrentWindow() 0.9)")
                    CustomStrokes->set("Layout"
                    '(
                        ("COPY" "leHiCopy()")
                        ("CHOP" "leHiChop()")
                        ("DEL"  "leHiDelete()")
                        ("UNDO" "hiUndo()")
                        ("REDO" "hiRedo()")
                        ("NCube" "CubeUnload()")
                        ("deselectWireM1" "deselect(\"METAL1\")")
                        ("deselectWireM2" "deselect(\"METAL2\")")
                        ("deselectWireM3" "deselect(\"METAL3\")")
                    )
                    )
                /********************* END STROKES GODConsole **********************************/
            )
            ;called when want to use the strokes (bind key this fn to start using script)
            CustomStrokes->initBindKeys("Layout")
       
       
        /* CustomStrokes.ils
        toDo:
        -set a timer to clear inputs afer a while of not entering
        -keys to set input or finish (as enter or start of function)
        -delete seqBindKey by app - DONE
        -delete caracters - DONE
        -make this list available for unloadBindKeys CSlistBk, in order to have again the latest bindkeys
        -make that when caracters as ctrl, shift, escape, alt or some of those, wait until finish those words to enter
        -make that when
       
        Design:
        -when loading this script a predefined script will be loaded.
        -using esq take the user to the first layer which have no skill
        -then the user should select a skill to load writing it
        -also can press esq to unload this script and load custom bindkeys
        todo:
        -make this script works with shift/ctrl/alt  (this can be done by having an special caracter to start listen for  shift/ctrl/alt  buttons)
        bugs:
        extraInfo:
        Character(s)            SKILL Symbol Name(s)
        a, b, …, z              a, b, …, z
        A, B, …, Z              A, B, …, Z
        ?, _                    ?, _
        0, 1, …, 9              \0, \1, …, \9
        ^A, ^B, …, ^Z, …        \001, \002, …, \032, …
        (octal codes 001-037)   (in octal)
        <space>                 \<space> (backslash followed by a space)
        ! . ; : ,               \! \. \; \: \,
        ( ) [ ] { }             \( \) \[ \] \{ …
         # % & + - *            \“ \# \% …
        < = > @ / \ ^ ~         \< \= \> …
        DEL                     \177
        *hiGetBindKeyPrefixList() ->show the existent applications
        CustomStrokes->initBindKeys("Layout")   use this to initialize
        Author     A.D.Beckett
        Group      Custom IC (UK), Cadence Design Systems Ltd.
        Language   SKILL++ (keep the .ils suffix on this file)
        Date       Oct 22, 2009
        Modified   July 10, 2022
        By          Ricardo Gómez  
        A package to support sequence bindkeys. This means you can define multi-key
        bindkeys. So for example, you can define a bindkey "chop" - you type the four
        characters c, h, o, and then p - and this then triggers the bindkey.
        The sequence is displayed as a banner label so you can see the current
        sequence. Escape is normally used to reset the sequence.
        Note this is really a proof-of-concept - it is not fully formed, and may
        need some enhancement.
        ; Initialize the a-z, A-Z, and 0-9 bindkeys to be entry keys
        ; and escape to be a reset key for Layout application
        CustomStrokes->initBindKeys("Layout")
        ;CustomStrokes->initBindKeys("Schematics")
        *hiGetBindKeyPrefixList() --->> to get every application existent
        ; give warning if any key sequence defined which obscures another
        ; for example, "ed" obscures "edit"
        CustomStrokes->option(?checkObscured t)
        ; Define some key sequences ;;;;;;;;;REMEMBER THAT EACH STROKE SET IS ADDED TO THE LIST, DOES NOT REPLACE PREV LIST
        CustomStrokes->set("Layout" "fit" "hiZoomAbsoluteScale(hiGetCurrentWindow() 0.9)")  
        CustomStrokes->set("Layout"
          '(
            ("COPY" "leHiCopy()")
            ("CHOP" "leHiChop()")
            ("DEL"  "leHiDelete()")
            ("UNDO" "hiUndo()")
            ("REDO" "hiRedo()")
           )
        )
        ; Retrieve bindkeys:
        CustomStrokes->get("Layout") => returns all the keys
        CustomStrokes->get("Layout" "chop") => "leHiChop()"
        ; If you want to define your own bindkeys (rather than using initBindKeys)
        ; then you'll need to use these:
        CustomStrokes->enter("X") ; enters an X in the sequence
        CustomStrokes->reset()    ; resets the sequence
        Limitations:
        Doesn't have the concept of "Enter Function" bindkeys which are
        different during enter functions. Could do, but needs some thought
        as to a sensible use model.
        ***************************************************
        SCCS Info: @(#) CustomStrokes.ils 10/22/09.13:44:45 1.1
        */
        CSlistBk=list()
        importSkillVar(CustomStrokes CSlistBk);make the  CCSeqBindKey workspace to be global
        CustomStrokes=let(
            ((bindkeys makeTable('bindkeys nil)) obscuredCheck)
            /*****************************************************************
            *                                                                *
            *                     initBindKeys(appType)                      *
            *                                                                *
            * EXPORTED function to initialize the bindkeys a-z, A-Z and 0-9, *
            *  as well as Escape, to work with the sequence bindkey system.  *
            *                                                                *
            *****************************************************************/
            defun(initBindKeys (appType)
                let((appRoot)
                    appRoot=hiGetBindKeyInheritRoot(appType)
                    ;println(CSlistBk)
                    ;to make sure the bk's aren't already set
                   
                    if(hiGetBindKey("Layout" "<Key>a")=="CustomStrokes->enter(\"a\")" then
                        FormError("Custom Strokes already loaded")
                    else
                        CSlistBk=hiGetBindKeys("Layout");saving last bindkeys to restore it later
                   
                        when(appRoot
                            ;--------------------------------------------------------
                            ; Define bindkeys for a-z, A-Z and 0-9
                            ;--------------------------------------------------------
                   
                            for(ascii charToInt('a) charToInt('z)
                                /*Saving bindkeys for screen key show*/
                                ;lastBK=(hiGetBindKey "Layout" "Shift<Key>T");save last bindkey
                                ;lastBK=hiGetBindKeys("Layout"); de aquí tengo que ir iterando para agregarlas
                                ;hiRegTimer("yhwDeleteLabel(yhwText)" 10); timer to do fn
                                /*Overwriting bindkeys*/
                                hiSetBindKey(appRoot
                                    strcat("<Key>" intToChar(ascii))
                                    sprintf(nil "CustomStrokes->enter(\"%s\")" ;//  \"%s\" es para concatenar el caracter en el argumento
                                        intToChar(ascii))
                                )
                                hiSetBindKey(appRoot
                                    strcat("Shift<Key>" intToChar(ascii))
                                    sprintf(nil "CustomStrokes->enter(\"%s\")"
                                        upperCase(intToChar(ascii)))
                                )
                            );for
                            for(ascii charToInt('\0) charToInt('\9)
                                hiSetBindKey(appRoot
                                    strcat("<Key>" intToChar(ascii))
                                    sprintf(nil "CustomStrokes->enter(\"%s\")" intToChar(ascii))
                                )
                            );for
                            hiSetBindKey(appRoot "<Key>Delete" "CustomStrokes->reset()")
                            hiSetBindKey(appRoot "<Key>BackSpace" "CustomStrokes->del()")
                            ;hiSetBindKey(appRoot "<Key>|" "CustomStrokes->del()")
                            Command=sprintf(nil "CustomStrokes->unloadBindKeys(\"%s\")" appRoot)
                            hiSetBindKey(appRoot "<Key>Escape"  Command)
                        );when appRoot
                    )
                );let
            );defun initBindKeys
            /************************************************************************
            *                                                                       *
            *                              enter(char)                              *
            *                                                                       *
            *   EXPORTED Function to enter a character in the sequence. If there    *
            *     is a sequence bindkey registered for that sequence, reset and     *
            *       then execute the bindkey definition - otherwise continue        *
            * collecting the characters in the sequence (and display in the banner) *
            *                                                                       *
            ************************************************************************/
            defun(enter (char)
                let((win appType appRoot bindkeyTab defn sequence)
                    win=hiGetCurrentWindow()
                    when(win
                        sequence=strcat(win~>abSequence || "" char)
                        win~>abSequence=sequence
                    )
                    appType=win && hiGetAppType(win)
                    when(appType
                        appRoot=hiGetBindKeyInheritRoot(appType)
                    )
                    when(appRoot
                        ;--------------------------------------------------------
                        ; Look up the bindkey definition. If found, then
                        ; reset the sequence and evaluate it, otherwise just
                        ; append the current sequence.
                        ;--------------------------------------------------------
                        bindkeyTab=bindkeys[appRoot]
                        defn=bindkeyTab && bindkeyTab[sequence]
                        if(stringp(defn) then ;stringp checa que haya algún string dentro de la cadena, igual hay listp y numberp
                            reset()
                            errsetstring(defn t)
                        else
                            if(st(sequence, 1,5)=="Seq: " then ;check if the seq: is in the string to erase it
                                sequence=st(sequence, 6,strlen(sequence))
                            )
                            hiChangeBannerLabel(
                                win
                                strcat("Seq: " sequence)
                                0
                            )
                        ) ; if bindkey found
                    ) ; when appRoot
                ) ; let
            ) ; defun enter
            /***************************************************************
            *                                                              *
            *                           reset()                            *
            *                                                              *
            *       EXPORTED function to reset the current sequence        *
            *                                                              *
            ***************************************************************/
            defun(reset ()
                hiGetCurrentWindow()~>abSequence=""
                hiChangeBannerLabel(
                    hiGetCurrentWindow()
                    "Seq: "
                    0
                )
            ) ; defun reset
       
            /***************************************************************
            *                                                              *
            *                           del()                              *
            *                                                              *
            *       EXPORTED function to delete last caracter              *
            *                                                              *
            ***************************************************************/
            defun(del ()
                let((win appType appRoot bindkeyTab defn sequence sequenceTemp)
                    win=hiGetCurrentWindow()
                    when(win
                        ;sequence=strcat(win~>abSequence);|| "" char) ;;aquí concatena
                        sequence=win~>abSequence
                        win~>abSequence=sequence
                    )
                    appType=win && hiGetAppType(win)
                    when(appType
                        appRoot=hiGetBindKeyInheritRoot(appType)
                    )
                    when(appRoot
                        ;--------------------------------------------------------
                        ; Look up the bindkey definition. If found, then
                        ; reset the sequence and evaluate it, otherwise just
                        ; append the current sequence.
                        ;--------------------------------------------------------
                        bindkeyTab=bindkeys[appRoot]
                        defn=bindkeyTab && bindkeyTab[sequence]
                        if(stringp(defn) then ;stringp checa que haya algún string dentro de la cadena, igual hay listp y numberp
                            reset()
                            errsetstring(defn t)
                        else
                            if(sequence!=nil && strlen(sequence)>0   then ;;check if the string is empty, if empty does not delete
                                ;println("z")
                                println(sequence)
                                if(st(sequence, 1,5)=="Seq: " then ;check if the seq: is in the string to erase it
                                    sequence=st(sequence, 6,strlen(sequence))
                                )
                                println(sequence)
                                if(sequence!=nil && strlen(sequence)>0   then
                                    ;sequence=strcat("Seq: " st(sequence, 1,strlen(sequence)-1))
                                    sequence=st(sequence, 1,strlen(sequence)-1)
                                    ;sequenceTemp
                                    hiChangeBannerLabel(
                                        win
                                        sequence;Banner Label, pero aquí se borra uno en el banner
                                        0;x_labelPosition
                                       
                                    )
                                    win~>abSequence=sequence ; para restablecer la secuencia
                                )
                                println(sequence)
                            )
                        ) ; if bindkey found
                    ) ; when appRoot
                ) ; let
            ) ; defun del
            (defun MyUnique (lst)
                (let ((seen (makeTable 'seen nil)))
                    (setof elem lst
                    (unless (arrayref seen elem)
                        (setarray seen elem t)
                    )
                    )
                )
            )
       
            /***************************************************************
            *                                                              *
            *                    check(bindkeyTab key)                     *
            *                                                              *
            *  INTERNAL function to check that a new key sequence is not   *
            *    obscured by another, or does not obscure another. Only    *
            *      checked if option(?checkObscured t) has been used.      *
            *                                                              *
            ***************************************************************/
            defun(check (bindkeyTab key)
                let((len subKeyName)
                    when(obscuredCheck && stringp(bindkeyTab[key])
                        len=strlen(key)
                        ;--------------------------------------------------------
                        ; Look for any existing key sequences which the new key is
                        ; the beginning part of
                        ;--------------------------------------------------------
                        foreach(keyName bindkeyTab
                            when(key!=keyName && zerop(strncmp(key keyName len)) &&
                                stringp(bindkeyTab[keyName])
                                warn("Definition for sequence %s will obscure sequence %s\n"
                                    key keyName)
                            ) ; when
                        ) ; foreach
                        ;--------------------------------------------------------
                        ; Look for any key sequences which are shorter than the new key
                        ;--------------------------------------------------------
                        for(sub 1 sub1(len)
                            subKeyName=st(key 1 sub)
                            when(stringp(bindkeyTab[subKeyName])
                                warn("Definition for sequence %s will obscure sequence %s\n"
                                    subKeyName key)
                            ) ; when
                        ) ; for
                    )
                ) ;let
            ) ; defun
            /***************************************************************
            *                                                              *
            *                   set(appType key [defn])                    *
            *                                                              *
            *  EXPORTED function to set one or more sequence bindkeys for  *
            *                        an application                        *
            *                                                              *
            ***************************************************************/
            defun(set (appType key @optional defn "tg") ;@optional makes that some argument have a default value, and can be not be setted on the argument, if not default value, nil is given
                let((appRoot bindkeyTab)
                    appRoot=hiGetBindKeyInheritRoot(appType)
                    when(appRoot
                        bindkeyTab=bindkeys[appRoot]
                        unless(bindkeyTab
                            bindkeyTab=makeTable('appBindkeys nil)
                            bindkeys[appRoot]=bindkeyTab
                        )
                        ;--------------------------------------------------------
                        ; Handle list of definitions, and individual definitions
                        ;--------------------------------------------------------
                        if(listp(key) then
                            foreach(keyDefn key
                                if(listp(keyDefn) && length(keyDefn==2) then
                                    bindkeyTab[car(keyDefn)]=cadr(keyDefn)
                                    check(bindkeyTab car(keyDefn))
                                else
                                    warn("Key definition %L is invalid\n" keyDefn)
                                )
                            )
                        else
                            bindkeyTab[key]=defn
                            check(bindkeyTab key)
                        )
                        t
                    ) ; when appRoot
                ) ; let
            ) ; defun set
       
            /*******************************************************************
            *                                                                  *
            *                        get(appType [key])                        *
            *                                                                  *
            * EXPORTED function to get one or all sequence bindkey definitions *
            *                                                                  *
            *******************************************************************/
            defun(get (appType @optional key "tg")
                let((appRoot bindkeyTab)
                    appRoot=hiGetBindKeyInheritRoot(appType)
                    when(appType
                        bindkeyTab=bindkeys[appRoot]
                        ;--------------------------------------------------------
                        ; If the key argument provided, just return the definition
                        ; otherwise return an assoc list of the whole lot
                        ;--------------------------------------------------------
                        if(key then
                            bindkeyTab && bindkeyTab[key]
                        else if(!bindkeyTab then ;si no tiene data
                                    printf(nil "No data")
                    else
                        tableToList(bindkeyTab)
                    )
               
                        )
                ;printf(nil "No data")
                ;sprintf(nil "data is: %s" bindkeyTab)
                    ) ; when appType
                ) ; let
            ) ; defun get
            /*******************************************************************
            *                                                                  *
            *                        deleteFrom(appType [key])                 *
            *                                                                  *
            * EXPORTED function to delete one or all sequence                  *
            * bindkey definitions                                              *
            *                                                                  *
            *******************************************************************/
            ;algo me falta aquí para que funcione bien al inicializarlo
            defun(deleteFrom (appType @optional key "tg")
                let((appRoot bindkeyTab)
                    appRoot=hiGetBindKeyInheritRoot(appType)
                    when(appType
                ;sprintf(nil "entro");no imprimir porque hace returns
                        ;bindkeys[appRoot]=nil ;creo que no puedo hacer nil todo
                        bindkeys[appRoot]=makeTable('bindkeys nil)
                    ) ; when appType
                ) ; let
            ) ; defun deleteFrom
            /*******************************************************************
            *                                                                  *
            *                        unloadBindKeys(appType [key])             *
            *                                                                  *geRestoreWinView()
            * EXPORTED function to get one or all sequence bindkey definitions *
            *                                                                  *
            *******************************************************************/
            defun(unloadBindKeys (appType @optional key "tg")
                let((appRoot bindkeyTab)
                    appRoot=hiGetBindKeyInheritRoot(appType)
                    when(appType
                        ;hiSetBindKeys( "Layout" tableToList(CSlistBk)) ;restore bindkeys
                        ;hiSetBindKeys( "Layout" listBK)
                        ;hiSetBindKeys( "Layout" 'hiGetBindKeys("Layout"))
                        ;sprintf(nil "entro");
                       
                        ;[this is not going to be the final solution, just temporal as is not overriding every bindkey or deleting it]
                        ;load("/eda/common/tools/cadence/ic/6.1.8.220/tools.lnx86/dfII/samples/local/leBindKeys.il")
                        ;también cambiar este load al nuevo
                        /*********************************PROBAR PROBAR PROBAR******************/
                        ;borrar load de arriba
                        ;;creo que lo que faltaba al usar lastBK era iterarlo
                        ;foreach(bindKeyElement lastBK
                        ;   hiSetBindKey(bindKeyElement); si bindkeyElement no funciona, va a hacer falta separarlo por strings
                        ;)
                        /********************************* END PROBAR PROBAR PROBAR*************/
                        hiSetBindKeys(appRoot CSlistBk)
                    ) ; when appType
                ) ; let
            ) ; defun unloadBindKeys
       
            /***************************************************************
            *                                                              *
            *                  option(@key checkObscured)                  *
            *                                                              *
            *       EXPORTED function to set any options. Currently        *
            *                     just ?checkObscured.                     *
            *                                                              *
            ***************************************************************/
            defun(option (@key checkObscured)
                obscuredCheck=checkObscured
            )
            ;--------------------------------------------------------------------
            ; DPL containing all the package functions available from outside
            ;--------------------------------------------------------------------
            `(nil
                initBindKeys ,initBindKeys
                enter ,enter
                reset ,reset
                set ,set
                get ,get
                option ,option
                deleteFrom ,deleteFrom
                unloadBindKeys ,unloadBindKeys
                del ,del
            )
    ) ; let
    • 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