Home > Community > Forums > Custom IC SKILL > how to select and deselect a layer using only one bind key?

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 how to select and deselect a layer using only one bind key? 

Last post Fri, Aug 3 2012 2:48 AM by Andrew Beckett. 13 replies.
Started by IC Layout 16 Mar 2009 03:59 AM. Topic has 13 replies and 9057 views
Page 1 of 1 (14 items)
Sort Posts:
  • Mon, Mar 16 2009 3:59 AM

    • IC Layout
    • Top 150 Contributor
    • Joined on Sat, Mar 7 2009
    • Hyderabad, Andhra Pradesh
    • Posts 53
    • Points 1,155
    how to select and deselect a layer using only one bind key? Reply

     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
     

    Filed under:
    • Post Points: 65
  • Mon, Mar 16 2009 4:15 AM

    Re: how to select and deselect a layer using only one bind key? Reply

    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.

    • Post Points: 20
  • Mon, Mar 16 2009 10:00 AM

    • skillUser
    • Top 10 Contributor
    • Joined on Fri, Sep 19 2008
    • Austin, TX
    • Posts 2,535
    • Points 14,940
    Re: how to select and deselect a layer using only one bind key? Reply

     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.

    • Post Points: 20
  • Tue, Mar 17 2009 7:17 AM

    Re: how to select and deselect a layer using only one bind key? Reply

     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

    • Post Points: 5
  • Tue, Mar 17 2009 10:18 PM

    • skillUser
    • Top 10 Contributor
    • Joined on Fri, Sep 19 2008
    • Austin, TX
    • Posts 2,535
    • Points 14,940
    Re: how to select and deselect a layer using only one bind key? Reply

    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.
     
    • Post Points: 5
  • Thu, Mar 19 2009 9:09 AM

    • skillUser
    • Top 10 Contributor
    • Joined on Fri, Sep 19 2008
    • Austin, TX
    • Posts 2,535
    • Points 14,940
    Re: how to select and deselect a layer using only one bind key? Reply

    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

    • Post Points: 20
  • Thu, Mar 19 2009 8:14 PM

    • IC Layout
    • Top 150 Contributor
    • Joined on Sat, Mar 7 2009
    • Hyderabad, Andhra Pradesh
    • Posts 53
    • Points 1,155
    Re: how to select and deselect a layer using only one bind key? Reply

     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
     

     

    • Post Points: 5
  • Thu, Mar 19 2009 8:33 PM

    • IC Layout
    • Top 150 Contributor
    • Joined on Sat, Mar 7 2009
    • Hyderabad, Andhra Pradesh
    • Posts 53
    • Points 1,155
    Re: how to select and deselect a layer using only one bind key? Reply

     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...

     

    • Post Points: 20
  • Thu, Mar 19 2009 9:39 PM

    • skillUser
    • Top 10 Contributor
    • Joined on Fri, Sep 19 2008
    • Austin, TX
    • Posts 2,535
    • Points 14,940
    Re: how to select and deselect a layer using only one bind key? Reply
    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

    • Post Points: 5
  • Thu, Mar 19 2009 9:47 PM

    • skillUser
    • Top 10 Contributor
    • Joined on Fri, Sep 19 2008
    • Austin, TX
    • Posts 2,535
    • Points 14,940
    Re: how to select and deselect a layer using only one bind key? Reply

     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.

    • Post Points: 35
  • Fri, Mar 20 2009 2:52 AM

    • IC Layout
    • Top 150 Contributor
    • Joined on Sat, Mar 7 2009
    • Hyderabad, Andhra Pradesh
    • Posts 53
    • Points 1,155
    Re: how to select and deselect a layer using only one bind key? Reply

     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
     

    • Post Points: 5
  • Wed, Aug 1 2012 4:36 AM

    • 151515
    • Not Ranked
    • Joined on Wed, Aug 1 2012
    • Posts 4
    • Points 80
    Reference material Reply

    Austin,

    Can you please give me reference material/links to learn all these skill Layout commands.

    • Post Points: 20
  • Fri, Aug 3 2012 2:47 AM

    Re: Reference material Reply

    In IC61, run cdnshelp and then search for the function name in question. In IC5141 run "cdsdoc". Alternatively use the Help menus inside virtuoso to bring up the help system and search there.

    Andrew.

    • Post Points: 5
  • Fri, Aug 3 2012 2:48 AM

    Re: Reference material Reply

     Oh, and the Forum Guidelines suggest that you don't add onto an old thread.

    Andrew.

    • Post Points: 5
Page 1 of 1 (14 items)
Sort Posts:
Started by IC Layout at 16 Mar 2009 03:59 AM. Topic has 13 replies.