• 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 Toggle Metal Layer Visibility Sequentially with Bindkeys...

Stats

  • Locked Locked
  • Replies 3
  • Subscribers 125
  • Views 2092
  • 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 Toggle Metal Layer Visibility Sequentially with Bindkeys?

SS202502085313
SS202502085313 6 months ago

I require a script that allows toggling the visibility of multiple metal layers (from M1 to M10) without disabling the visibility of previously activated layers. For example, pressing the '1' bindkey should toggle the visibility of the M1 metal layer, while maintaining the visibility of any other active layers. Similarly, pressing the '2' bindkey should toggle the M2 metal layer, again without affecting the visibility of M1 or any other layers. When the same bindkey is pressed again, only the corresponding layer (e.g., M2 for '2') should be hidden, while all other layers remain unaffected.

  • Cancel
  • Andrew Beckett
    Andrew Beckett 6 months ago

    You can use this code and call CCFsetToggleVisBindkeys(10) to set the bind keys:

    procedure(CCFtoggleVis(layerName @optional (purpose "drawing"))
      let(((lpp strcat(layerName " " purpose)))
        pteSetVisible(lpp !pteIsVisible(lpp))
      )
    )
    
    procedure(CCFsetToggleVisBindkeys(maxIndex @optional (prefix "M"))
      for(ind 1 maxIndex
        hiSetBindKey("Layout" 
          ; modulus allows 0 key to toggle M10; beyond that
          ; doesn't make sense as would overwrite the earlier layers
          lsprintf("<Key>%d" mod(ind 10))
          lsprintf("CCFtoggleVis(\"%s%d\")" prefix ind)
        )
      )
    )
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • SS202502085313
    SS202502085313 6 months ago

    Hi Andrew,

    Thank you so much for your help – the script is working exactly as I need it! I have a couple of additional requests, if possible:

    1. Would it be possible to extend the script to include the ability to toggle the visibility of the M0 metal layer? For instance, pressing the **  '  ` ' **key should toggle the visibility of the M0 metal layer while preserving the visibility of all other active layers.

    2. Similarly, toggling the visibility of multiple via layers (from V0 to V10) pressing ** Ctrl + ' ` ' ** should toggle the visibility of the Via 0 via layer, pressing ** Ctrl + ' 1 ' ** should toggle the visibility of the Via 1 via layer again maintaining the visibility of all other active layers.

    3. Additionally, is there a way to control the visibility of metal layers, via layers, and blockage layers using the middle mouse button click? This would provide a more intuitive and efficient means of toggling these layers.

    Thank you once again for your response and time 

    Best regards

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett 6 months ago in reply to SS202502085313

    I'd have hoped that you'd have been able to adapt the code to suit your additional needs (it is fairly straightforward). Anyway, I made a small modification to the code here:

    procedure(CCFtoggleVis(layerName @optional (purpose "drawing"))
      let(((lpp strcat(layerName " " purpose)))
        pteSetVisible(lpp !pteIsVisible(lpp))
      )
    )
    
    procedure(CCFsetToggleVisBindkeys(maxIndex @optional (prefix "M") (modifier ""))
      for(ind 1 maxIndex
        hiSetBindKey("Layout" 
          ; modulus allows 0 key to toggle M10; beyond that
          ; doesn't make sense as would overwrite the earlier layers
          lsprintf("%s<Key>%d" modifier mod(ind 10))
          lsprintf("CCFtoggleVis(\"%s%d\")" prefix ind)
        )
      )
    )

    Now you could do:

    CCFsetToggleVisBindkeys(10)
    CCFsetToggleVisBindkeys(10 "V" "Ctrl") ; add the via bindkeys
    ; since the key used for M0/V0 is not going to be 0-9, just define a specific bindkey for these
    hiSetBindKey("Layout" "<Key>`" "CCFtoggleVis(\"M0\")")
    hiSetBindKey("Layout" "Ctrl<Key>`" "CCFtoggleVis(\"V0\")")

    The last item (to toggle all metal, via and blockage layers) would need bit more work (it's not hard - just needs a loop to set the visibility of multiple layers and other objects in one go), but look at pteSetVisible documentation to do this - I'll leave this as an exercise for you (I don't have the time this week...)

    Regards,

    Andrew

    • 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