• 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. how to select and deselect a layer using only one bind key...

Stats

  • Locked Locked
  • Replies 13
  • Subscribers 145
  • Views 23602
  • 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 select and deselect a layer using only one bind key?

IC Layout
IC Layout over 16 years ago

 Hello! Everybody, GoodEvening to all,

Please, can anybody help me in giving the solution for this question. 

I am using cadence IC514 version.

I would like to select a layer using one bind key also it should deselect the same layer if I press the same bind key.

Thanks in advance...

                             waiting for Ur replys.........

                                            Prabhakar-The VLE
 

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 16 years ago

    Please clarify what you mean. What do you mean by "select a layer"? Do you mean making a layer the current entry layer in the LSW? Do you mean making that layer selectable in the LSW? Do you mean selecting all the shapes on a particular layer-purpose in your layout?

    You could mean many different things. Please make sure that when you ask questions they are specific and well described, otherwise everyone has to waste time guessing.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • skillUser
    skillUser over 16 years ago

     Hi Prabhakar,

    I will guess that you are talking about selecting shapes on a specific layer-purpose pair since you also mentioned deselection.

    There are probably a few different approaches that you could take (for selection):

    • Iterate over the shapes in the cellview that match and select them
    • Iterate over the shapes in the cellview and select those that match
    • Select everything and deselect things that do not match

    I would think that the first method is probably the most efficient way out of those I mentioned.  To keep it simple, you could use the current LSW layer as the way of specifying which layer you want to select shapes on. An alternative might be to look at which shape the mouse is over and use the layer of that shape.  So the bindkey for selection could be as simple as the following:

    geSelectFigs(setof(shape geGetEditCellView()~>shapes shape~>lpp==leGetEntryLayer()))

    In other words, "select all of the shapes that are in the set of shapes in the cellview such that the shape has the same layer-purpose pair as the current entry layer in the LSW".  Assign it to a bindkey, for example:

    hiSetBindKey("Layout" "F8" "geSelectFigs(setof(shape geGetEditCellView()~>shapes shape~>lpp==leGetEntryLayer()))")

    Now, for deselection, do you want to deselect everything (e.g. the <Ctrl>-D bindkey), or everything on that layer only?  If you want the latter, and you want a single bindkey to do the work, then it probably would be a good idea to put the code in a procedure.  This procedure could test if any of the shapes on the layer are already selected, and if so, deslect the shapes on the layer, otherwise, select the shapes on the layer (as in the above example). So you might do something like the following:

    
    procedure(CCStoggleLayerSel()
      let( (cv shapes)
        cv = geGetEditCellView()
        shapes = setof(shape cv~>shapes shape~>lpp==leGetEntryLayer())
        ;; if at least one shape is even partially selected, then deselect all 
        ;; the shapes on that layer, otherwise select all the shapes on that layer
        if( exists(shape shapes geIsFigSelected(shape))
          mapc('geDeselectFig shapes)
          geSelectFigs(shapes)
        ); if
      ); let
    ); procedure CCStoggleLayerSel
    

    I hope that this is the sort of thing that you were looking for.

    Regards,

    Lawrence.

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • Austin CAD Guy
    Austin CAD Guy over 16 years ago

     A faster way to find the shapes on an lpp is to use the lpp itself which has the attribute shapes:

    layerName = car(leGetEntryLayer())
    layerPurpose = cadr(leGetEntryLayer())
    lppId = car(setof( lpp geGetEditCellView()~>lpps lpp~>layerName == layerName && lpp~>purpose == layerPurpose))
    lppId~>shapes ; This is the list of shapes in the current cellView on that layer purpose pair.

     This gives you much better performance as you are only searching a few objects (lpps) instead of many objects (shapes).

    Do the same thing with instHeaders instead of instances when searching for placements of a particular cell master. Remember that in the case of pcells, you may have multiple instHeaders, one for each variant.

    Ted

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • skillUser
    skillUser over 16 years ago

    Prabhakar,

    Ted is right, of course, I don't know why I didn't write the code in terms of the lpps (or layerPurposePairs) attribute and get the shapes that way - the coding is slightly different but much more efficient.  I'll re-write it and re-post as soon as I can.
     
    Regards,
     
    Lawrence.
     
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • skillUser
    skillUser over 16 years ago

    Here is the newer version of the code, version 1.2:

    procedure(CCStoggleLayerSel()
      let( (cv layer purpose lpp shapes)
        ;; obtain the current cellview
        cv = geGetEditCellView()
        layer = car(leGetEntryLayer())
        purpose = cadr(leGetEntryLayer())
        ;; find the layer-purpose pair object for the current entry layer
        lpp = car(setof(lpp cv~>lpps lpp~>layerName==layer &&
                        lpp~>purpose==purpose))
        ;; get all of the shapes on the current lpp object
        shapes = lpp~>shapes
        ;; if at least one shape is even partially selected, then deselect
        ;; all the shapes on that layer, otherwise select all the shapes on
        ;; that layer
        if( exists(shape shapes geIsFigSelected(shape))
          ;; there is no "geDeselectFigs()" function, so instead,
          ;; iterate over the shapes, deselect each shape in turn
          mapc('geDeselectFig shapes)
          ;; ELSE select all of the shapes in one go
          geSelectFigs(shapes)
        ); if
      ); let
    ); procedure CCStoggleLayerSel
    

    As Ted pointed out, this will be much more efficient - evident when there are many shapes.

    I hope that this helps everyone! (This will be posted as a solution on SourceLink too.)

    Regards,

    Lawrence

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • IC Layout
    IC Layout over 16 years ago

     I am very sorry Sir, due to some urgent work I didn't explained my problem clearly....I agree it's my fault.

    I"ll never repeate this..

    Thanks for Your kind words........

                                             Prabhakar.K
     

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • IC Layout
    IC Layout over 16 years ago

     Hello, Mr.Ted your code has explored some different ideas in my mind...Of course it's not my intention but it is very useful in some particular situations.

    I am very sorry, if I have taken your valuable time.

    Actually, my problem is as follows...

    Initially I had set a bindkey to make invisible all layers in my layout. 

    procedure(lsw_inv()

        leSetEntryLayer(list("Bondpad" "drawing"))

        leSetAllLayerVisible(nil)

        hiRedraw()

    );procedure

    hiSetBindKey("Layout" "Alt<Key>i" "lsw_inv")

    In a similar manner I had set a bind key to make the all layers visible.

    My project manager had asked me to make all layers invisible and if he press Ctrl-2 , Metal2 and via1(M2_M1c) has to be visible.

    Also if he press same key (Ctrl-2) , Metal2 and via1 has to be invisible.

    I made solution for this by  setting two bindkeys but not one.

    Can U help me in this way.

    procedure(visible()

        leSetLayerVisible(list("Via1" "drawing") t )

        leSetLayerVisible(list("Metal2" "drawing") t )

        hiRedraw()

    );procedure

    hiSetBindKey("Layout" "Ctrl<Key>1" "visible()") 

    procedure(invisible()

        leSetLayerVisible(list("Via1" "drawing") nil )

        leSetLayerVisible(list("Metal2" "drawing") nil )

        hiRedraw()

    );procedure

    hiSetBindKey("Layout" "Alt<Key>1" "invisible()")

    Now I would like to use only one bind key for the two purposes...

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • skillUser
    skillUser over 16 years ago
    Hi,

    Using your above information I have tried a partial solution (the via stuff is missing, but it can be easily added), here is the basic format of the code:

    procedure( CCStoggleMetal(num "x")
    let(((metlay list(sprintf(nil "metal%d" num) "drawing")) )
    if( leIsLayerVisible(metlay) then
    leSetLayerVisible(metlay nil)
        else 
          leSetLayerVisible(metlay t) 
    )
    hiRedraw() ) )

    Then you can use the same code for different metal layers, here's how the bindkey would look:

     hiSetBindKey("Layout" "Ctrl<Key>2" "CCStoggleMetal(2)")

     I hope that this is the sort of thing that you are looking for?

     Regards,

    Lawrence

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • skillUser
    skillUser over 16 years ago

     As an extension of this idea, you could have a bindkey modifier to ensure that only that layer were visible, for example, the procedure could have an optional argument that if supplied will modify the visibility of all the other layers, or if not supplied it behaves just like the above code.

    Then when creating the bindkeys, you would create two versions, something like this:

     hiSetBindKey("Layout" "Ctrl<Key>2" "CCStoggleMetal(2)")

     hiSetBindKey("Layout" "ShiftCtrl<Key>2" "CCStoggleMetal(2 t)")

    The procedure definition would change to something like:

     procedure(CCStoggleMetal( num @optional allLayers "xg") ...

    and you use the allLayers flag inside the code to modify the behaviour af briefly mentioned above.

    Hope this helps even further!

    Lawrence.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • IC Layout
    IC Layout over 16 years ago

     Yes, Mr.Lawrence this is the sort of thing that I am looking for.

    Now I am able to use a bindkey for two purposes.

    Thaks a lot......

                           Prabhakar. K
     

    • 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