• 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 Design
  3. How to create personalized menu in virtuoso layout edit...

Stats

  • Locked Locked
  • Replies 29
  • Subscribers 130
  • Views 34590
  • 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

How to create personalized menu in virtuoso layout editor

AmitBiswas
AmitBiswas over 14 years ago
Hi, I have written few scripts in skill language. I want group all the scripts together into a single menu in virtuoso layout editor. Like in the layout editor window there are several menus at the top containing multiple functions, I want to create my personalized menu in the layout editor window. I also want to put that script in the .cdsinit file, so that when cadence will be started the menus will be loaded automatically in the layout editor window like the other menus. Thanks in advance, Amit
  • Cancel
  • skillUser
    skillUser over 14 years ago

    Hi Amit,

    There are a couple of ways to approach this, you can either define menu items via a menus file, i.e. the layEdit.menus in this case, which would reside in your ./menus/ or ~/menus directory, or you can create the menus and add them via SKILL.  Here's a brief example of the bits that you might need for that approach:


    procedure(AmitAddMenu(args)
    let( ((win args->window) item1 item2 menu)
    ;; create a couple of menu items
    item1 = hiCreateMenuItem( ?name 'item1 ?itemText "My First Item"
    ?callback "AmitFunctionOne()"
    )
    item2 = hiCreateMenuItem( ?name 'item2 ?itemText "My Second Item"
    ?callback "AmitFunctionTwo()"
    )
    ;; create a menu that includes the menu items
    menu = hiCreatePulldownMenu('AmitMenu "Amit Menu" list(item1 item2))
    ;; insert this menu as the last menu
    hiInsertBannerMenu(win menu length(hiGetBannerMenus(win))
    );let
    ); procedure
    ;; create a user postinstall trigger that automatically adds the menu

    deRegUserTriggers("maskLayout" nil nil 'AmitAddMenu)

    You might need to add code to check if the menu is already present, but hopefully this framework gives you an idea of how to do it.

    Regards,

    Lawrence.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • AmitBiswas
    AmitBiswas over 14 years ago
    Thanks Lawrence for your quick reply

    Here is the code as you suggested, and its working fine. But I want to add the menus automatically like
    the other menus are already available when we open a layout editor
    like File Edit View Create Verify Connectivity ......etc


    win=hiGetCurrentWindow()
     
    Item1= hiCreateMenuItem(?name 'disco1
                 ?itemText "&item1"
                ?callback "println(\"Amit\")"
                )
    Item2= hiCreateMenuItem(?name 'disco2
                 ?itemText "i&tem2"
                ?callback "println(\"Kumar\")"
                )
     
    Item3= hiCreateMenuItem(?name 'disco3
                 ?itemText "it&em3"
                ?callback "println(\"Biswas\")"
                )
    Item4= hiCreateMenuItem(?name 'disco4
                 ?itemText "item4"
                ?callback "println(\"Halisahar\")"
                )
    Item5= hiCreateMenuItem(?name 'disco5
                 ?itemText "item5"
                ?callback "println(\"Pandit Para\")"
                )
    Item6= hiCreateMenuItem(?name 'disco6
                 ?itemText "item6"
                ?callback "println(\"Rabindrapally\")"
                )
     
    hiCreatePulldownMenu('trSubMenu2 "Address" list(Item4 Item5))
    hiCreatePulldownMenu('trSubMenu3 "Addr" list(Item1 Item6))
    slidmenus2=hiCreateSliderMenuItem(
                ?name 'slidmenus2
                ?itemText "Slide2"
                ?subMenu trSubMenu2
                )
    slidmenus3=hiCreateSliderMenuItem(
                ?name 'slidmenus3
                ?itemText "Slide3"
                ?subMenu trSubMenu3
                )           
    hiCreatePulldownMenu('trSubMenu1 "Name" list(Item1 Item2 Item3 slidmenus3))

    slidmenus1=hiCreateSliderMenuItem(
                ?name 'slidmenus1
                ?itemText "Slide1"
                ?subMenu trSubMenu1
                )
    hiCreatePulldownMenu('trPulldownMenu "Amit Menu" list(slidmenus1 slidmenus2 Item6))
    hiInsertBannerMenu(win  trPulldownMenu length(hiGetBannerMenus(win)))
    ;hiDeleteBannerMenu(win length(hiGetBannerMenus(win))-2)
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • skillUser
    skillUser over 14 years ago

    Hi Amit,

    I can't really read your posted code, but it looks like you missed off the all-important deRegUserTriggers() command?  This is the part that automatically runs your code, triggered by the action of opening a layout - hence, you may only need to do this once if the menu is global across all layout windows.  When you open a layout window the code is triggered and it adds the menu. Job done!

    Am I missing something else?

    regards,
    Lawrence.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Amit Biswas
    Amit Biswas over 14 years ago
    Lawrence
    Now I did exactly what you said. Her is the complete code.It is not working.
    I am getting one error in CIW when I am opening a layout

    ;*************************** Error copied from the CIW *************************************************

    dagDoNamedAction( dagNumToTool(4) dagGetObjectByPath( dagNumToTool(4) '( "ILBRootNode" "ILBRootClass"  "amit_test1" "ILBLibraryClass"  "Everything" "ILBCategoryClass"  "RECT_TEST" "ILBCellClass"  "layout" "ILBCellViewClass" )) "Read" )
    *Error* My_Custom_Menu: too many arguments (0 expected, 1 given) - ((nil wasPushed nil prependList nil configId nil configL nil libName "amit_test1" libId dd:0x1e4959d0 cellName "RECT_TEST" viewName "layout" viewType "maskLayout" fileName nil viewFileId dd:0x1e495b90 accessMode "r" viewNameList nil hierarchy ("{amit_test1 RECT_TEST layout }:r") hierPath "" appName "Layout" help "Layout" rootType "maskLayout" action install eip nil pushed nil window window:12 srcContext nil instanceName "" checkOutLicense t sessionWindow swindow:2 subMaster nil))
    <<< Stack Trace >>>
    (... in _deApplyTrigger ...)
    (... in unknown ...)
    funobj@0x19cdc660()
    (... in _dePullTrigger ...)
    (... in _deCallUserPostInstallTrigger ...)
    (... in _dePostOpenProcess ...)
    (... in _deOpen ...)
    (... in deOpen ...)
    deOpen(myFileSpec myWindowSpec myAccessMode)
    if((fileType == "cds44") then (masterFileName = substring(rindex(masterFile "/") 2)) if(!(fileId = ddGetObj(libraryName cellName viewName masterFileName)) then sprintf(msg "Unable to determine file id") ICLGetResponse(msg "INFO - IBMCadBrowser" hicInformationDialog 'Close) return()) if((fileLength((fileId->readPath)) == 0) then sprintf(msg "File is zero length. Perhaps this cellview has not \nbeen saved yet. Try using 'Edit' instead.") ICLGetResponse(msg "INFO - IBMCadBrowser" hicInformationDialog 'Close) return()) if(generateDplOnly then return(list(nil 'library libraryName 'cell cellName 'view viewName 'level levelName 'sandbox sandboxName 'file (fileId->readPath)))) (myFileSpec = list(nil 'libName libraryName 'cellName cellName 'viewName viewName)) (myWindowSpec = nil) (myAccessMode = "read") deOpen(myFileSpec myWindowSpec myAccessMode) else (fullFileName = strcat(sourceDir "/" masterFile)) if(generateDplOnly then return(list(nil 'library libraryName 'libraryPath libraryPath 'cell cellName 'view viewName 'level levelName 'sandbox sandboxName 'file fullFileName))) ICLInvokeReader(libraryPath libraryName cellName viewName levelName sandboxName fullFileName))
    prog((sourceDir fileId myFileSpec myWindowSpec myAccessMode viewType masterFileName masterFile msg fileType mfpStruct fullFileName) if((sandboxName && (sandboxName != "")) then (sourceDir = ICLSandboxDir(libraryPath libraryName sandboxName)) if(!sourceDir then return()) else if((levelName && (levelName != "")) then (sourceDir = ICLLevelDir(libraryPath libraryName levelName)) if(!sourceDir then return()))) sprintf(msg "Unable to retrieve master filepath for view %s" viewName) (mfpStruct = (ICLGetMasterFilePath ?libraryPath libraryPath ?library libraryName ?cell cellName ?view viewName ?errorMsg msg ?printWhen "error" ?directory sourceDir ?returnStruct t)) (masterFile = car((mfpStruct->values))) if(((mfpStruct->rc) == 2) then (fileType = "cds44")) if(!masterFile then return()) if(!fileType then sprintf(msg "Cannot determine file type of file %s." masterFile) (fileType = (ICLFileTypeMap ?libraryPath libraryPath ?library libraryName ?file masterFile ?errorMsg msg ?printWhen "error"))) if(!fileType then sprintf(msg "Unable to determine file type for view %" viewName) ICLGetResponse(msg "INFO - IBMCadBrowser" hicInformationDialog 'Close) return()) if((fileType == "cds44") then (masterFileName = substring(rindex(masterFile "/") 2)) if(!(fileId = ddGetObj(libraryName cellName viewName masterFileName)) then sprintf(msg "Unable to determine file id") ICLGetResponse(msg "INFO - IBMCadBrowser" hicInformationDialog 'Close) return()) if((fileLength((fileId->readPath)) == 0) then sprintf(msg "File is zero length. Perhaps this cellview has not \nbeen saved yet. Try using 'Edit' instead.") ICLGetResponse(msg "INFO - IBMCadBrowser" hicInformationDialog 'Close) return()) if(generateDplOnly then return(list(nil 'library libraryName 'cell cellName 'view viewName 'level levelName 'sandbox sandboxName 'file (fileId->readPath)))) (myFileSpec = list(nil 'libName libraryName 'cellName cellName 'viewName viewName)) (myWindowSpec = nil) (myAccessMode = "read") deOpen(myFileSpec myWindowSpec myAccessMode) else (fullFileName = strcat(sourceDir "/" masterFile)) if(generateDplOnly then return(list(nil 'library libraryName 'libraryPath libraryPath 'cell cellName 'view viewName 'level levelName 'sandbox sandboxName 'file fullFileName))) ICLInvokeReader(libraryPath libraryName cellName viewName levelName sandboxName fullFileName)))
    ICLBrowse(libraryPath libraryName sandboxName levelName cellName viewName versionNumber generateDplOnly)
    ...
    *WARNING* (DEBASE-102079): A Skill error occurred in function My_Custom_Menu
    t
    hiCloseWindow(window(13))
    t

    ;**************************************** Program starts ********************************

    procedure(My_Custom_Menu()
    win=hiGetCurrentWindow()
     
    Item1= hiCreateMenuItem(?name 'disco1
                 ?itemText "&item1"
                ?callback "println(\"Amit\")"
                )
    Item2= hiCreateMenuItem(?name 'disco2
                 ?itemText "i&tem2"
                ?callback "println(\"Kumar\")"
                )
     
    Item3= hiCreateMenuItem(?name 'disco3
                 ?itemText "it&em3"
                ?callback "println(\"Biswas\")"
                )
    Item4= hiCreateMenuItem(?name 'disco4
                 ?itemText "item4"
                ?callback "println(\"Halisahar\")"
                )
    Item5= hiCreateMenuItem(?name 'disco5
                 ?itemText "item5"
                ?callback "println(\"Pandit Para\")"
                )
    Item6= hiCreateMenuItem(?name 'disco6
                 ?itemText "item6"
                ?callback "println(\"Rabindrapally\")"
                )
     
    hiCreatePulldownMenu('trSubMenu2 "Address" list(Item4 Item5))
    hiCreatePulldownMenu('trSubMenu3 "Addr" list(Item1 Item6))
    slidmenus2=hiCreateSliderMenuItem(
                ?name 'slidmenus2
                ?itemText "Slide2"
                ?subMenu trSubMenu2
                )
    slidmenus3=hiCreateSliderMenuItem(
                ?name 'slidmenus3
                ?itemText "Slide3"
                ?subMenu trSubMenu3
                )           
    hiCreatePulldownMenu('trSubMenu1 "Name" list(Item1 Item2 Item3 slidmenus3))

    slidmenus1=hiCreateSliderMenuItem(
                ?name 'slidmenus1
                ?itemText "Slide1"
                ?subMenu trSubMenu1
                )
    hiCreatePulldownMenu('trPulldownMenu "Amit Menu" list(slidmenus1 slidmenus2 Item6))
    hiInsertBannerMenu(win  trPulldownMenu length(hiGetBannerMenus(win)))
    ;hiDeleteBannerMenu(win length(hiGetBannerMenus(win)))
    );procedure
    deRegUserTriggers("maskLayout" nil nil 'My_Custom_Menu)
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • skillUser
    skillUser over 14 years ago

    Hi Amit,

    the error message appears to be self explanatory: My_Custom_Menu will be supplied with one argument that is a disembodied property list ("dpl" for short) but it was defined to accept no arguments: 

     *Error* My_Custom_Menu: too many arguments (0 expected, 1 given) - ...

    The trigger will automatically supply the dpl to the function, this is why the function needs to accept at least one argument. See my example where I have "args" for this argument, and then this is used to obtain the window id (this is the correct way to do it anyway, since hiGetCurrentWindow() can actually pick up the "What's New" window, for example).

    Also, which version are you using?  I'd guess at 9502/4.3.4 given the "dag" prefixed functions, but it is possible that these are just customizations...

    Try again and let us know how things turn out.

    Regards,

    Lawrence.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Amit Biswas
    Amit Biswas over 14 years ago
    Thanks Lawrence, It is working now, the way I expected. One minor correction in the code you sent is procedure(My_Custom_Menu(args) let((win ) win=args->window not procedure(My_Custom_Menu(args) let((win args->window) I was getting error *Error* let: illegal binding form - (args->window). anyways, finally it is working. Thanks again for your quick support and guidance. I really appreciate your effort.
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 14 years ago

    Amit,

    I should point out that the way that Lawrence suggested doing this is the wrong way to add a banner menu (sorry Lawrence). Adding a pulldown banner menu in a post install trigger is likely to cause trouble (I've seen this happen numerous times), and since there is a userMenuTrigger available (this is the third argument to deRegUserTriggers). In fact it makes it simpler, because all your function has to do is return a list of pulldown menus to add, and does not need to worry itself with inserting them in the banner - that is done by the Design Editor infrastructure. So it would be something like:

    procedure(AmitAddMenu(_args)
    let( (item1 item2)
    ;; create a couple of menu items
    item1 = hiCreateMenuItem( ?name 'item1 ?itemText "My First Item"
    ?callback "AmitFunctionOne()"
    )
    item2 = hiCreateMenuItem( ?name 'item2 ?itemText "My Second Item"
    ?callback "AmitFunctionTwo()"
    )
    ;; create a menu that includes the menu items and return a list of the
    ;; pulldown menus
    list(hiCreatePulldownMenu('AmitMenu "Amit Menu" list(item1 item2)))
    );let
    ); procedure
    ;; create a userMenuTrigger trigger that automatically adds the menu

    deRegUserTriggers("maskLayout" nil 'AmitAddMenu)

    Note this is untested - and in practice you would add code to avoid redefining the pulldown menu each time (e.g. unless(boundp('AmitMenu) ...) but hopefully you get the principle.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Amit  Biswas
    Amit Biswas over 14 years ago
    Thanks Andrew for suggesting the improvement
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • imagesensor123
    imagesensor123 over 14 years ago

     Hi,

        if i want to add menus in virtuoso analog design environment, what is the first argument in the deRegUserTriggers function? can anybody give a name list of ADE and layout ect,

    Regards,

    zfeng

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Amit  Biswas
    Amit Biswas over 14 years ago
    Example: deRegUserTriggers("maskLayout" nil nil 'My_Custom_Menu)
    • 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