• 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. attach label to a pin as a 'children'

Stats

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

attach label to a pin as a 'children'

ebecheto
ebecheto over 12 years ago

Dear all,

 I have only pins in the layout and I want to attach a label to it. Unfortunatelly the 'children' cannot be set.

Anyone knows how to set it correctly?

Here is the example of my code. 

Regards,

 

cv=geGetWindowCellView()
p=caar(cv~>terminals~>pins)
foreach(p cv~>terminals~>pins
p1=car(p)
p1~>net~>name
f1=car(p1~>figs)
unless(f1~>children f1~>children=
dbCreateLabel(cv list(f1~>layerName  "label" ) centerBox(f1~>bBox)
p1~>net~>name "centerLeft" "R0" "roman" 0.5)))
 
 
*Error* setSGq: (DB-370034): dbSetq: Cannot set attribute - children
 

 

  • Cancel
Parents
  • ohmycat
    ohmycat over 8 years ago

    Sorry for necroposting, but i found this page very useful, so i adding my code to automaticly generate labels on all selected pins

    foreach(X geGetSelectedSet()
    net = X~>net
    disp=dbCreateTextDisplay( net X list("TEXT" "drawing" ) t centerBox(X~>bBox) "centerCenter" "R0" "roman" 2 nil nil t nil t "name" nil)
    )
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • ohmycat
    ohmycat over 8 years ago

    Sorry for necroposting, but i found this page very useful, so i adding my code to automaticly generate labels on all selected pins

    foreach(X geGetSelectedSet()
    net = X~>net
    disp=dbCreateTextDisplay( net X list("TEXT" "drawing" ) t centerBox(X~>bBox) "centerCenter" "R0" "roman" 2 nil nil t nil t "name" nil)
    )
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
  • Carona
    Carona over 7 years ago in reply to ohmycat

    Very simple and useful code, I was wondering if it was possible to use dbCreateTextDisplay to create a label with not just the net name, but say with the area value of a rectangle also?

    so passing a string value instead?  

    for instance

    area=5

    string = sprintf(area "%f" area)

    disp=dbCreateTextDisplay( net X list("text" "drawing" ) t centerBox(X~>bBox) "lowerCenter" "R0" "roman" abs(dy/3) nil nil t nil t string nil)  

    This gives me an error, but perhaps I am missing something.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 7 years ago in reply to Carona

    If you want to create a label, use dbCreateLabel. dbCreateTextDisplay is to display the value of a database attribute or property on an associated object - it's not to display arbitrary text (the benefit of a text display is that if that associated attribute value or property value changes, the text displayed changes without needing to do any updates).

    By the way, the dynamic display feature in Virtuoso Layout Suite also allows you to dynamically show the area of an object as you hover over it...

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Carona
    Carona over 7 years ago in reply to Andrew Beckett

    Yes, I am aware of the dynamic display, but it is more useful to have the area attached to the object and visible at all times when floor-planning.

    I will try and play around with dbCreateLabel for passing a string in for the area.  Thank you for pointing me in the right direction.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Carona
    Carona over 7 years ago in reply to Andrew Beckett

    Andrew, I had something working very well, but I was trying multiple iterations of things, and by the time I restarted cadence after a crash, the code I was using started to give me errors.

    *Error* dbCreateLabel: Invalid cellView - db:0x218a5c9a

    For a more complete picture here is the code I am working with now.... It is a simple bindkey that will grow a rectangle by a fixed amount and maintain the area. That part is fine, 

    It then should create labels for the Net Name, Area, and Length and Height of the shape.

    Right now only the Net Name is passing through.  It seems to be stalled at the dbCreatelabel portion.  but I had everything working for a few days.  Thanks in advance.

    hiSetBindKey("Layout" "<Key>[" "stretchAreax()")

    /***********************************************
    Stretch Rectangle With Constant Area +X
    ************************************************/

    procedure( stretchAreax()
    foreach(X geGetSelectedSet()
    net = X~>net
    sSet = geGetSelSet()
    corners = car(sSet)~>bBox
    delta = 5
    ll = car(corners)
    ur = cadr(corners)
    dx = xCoord(ur) - xCoord(ll)
    x1 = xCoord(ll)
    x2 = xCoord(ur) + delta
    newdx = (xCoord(ur)+delta - xCoord(ll))
    rnewdx = round(newdx)
    dy = yCoord(ur) - yCoord(ll)
    rdy = round(dy)
    y1b = yCoord(ll)
    y1t = yCoord(ur)
    newarea = abs(newdx * dy)
    area = round(abs( dx * dy ))
    y2 = y1t - (dy-(area/newdx))
    printf("Area of rectangle is %L.\n" area) ;; Displays Area in CIW window
    printf("Length of Rectangle is %L.\n" newdx) ;; Displays Length in CIW window
    printf("Height of Rectangle is %L.\n" dy) ;; Displays Height in CIW window

    r=css()
    r~>?
    r~>??
    lowerLeft(r~>bBox)
    upperRight(r~>bBox)
    xCoord(lowerLeft(r~>bBox))
    yCoord(lowerLeft(r~>bBox))
    newBBox=list(list(x1 y1b) list(x2 y2))
    r~>bBox=newBBox
    string = sprintf(area "%L" area)
    stringL = sprintf(rnewdx "%L" rnewdx)
    stringH = sprintf(rdy "%L" rdy)

    foreach(selObj geGetSelSet()
    foreach(child selObj~>children
    when(member(child~>objType '("label" "textDisplay")) && child~>layerName=="text" && child~>purpose=="drawing"
    dbDeleteObject(child)
    )
    )
    )

    disp=dbCreateTextDisplay( net X list("text" "drawing" ) t centerBox(X~>bBox) "lowerRight" "R0" "roman" abs(dx/12) nil nil t nil t "name" nil) ;;Creates text label from net name of figure
    label=dbCreateLabel(cv "text" centerBox(X~>bBox) string "lowerLeft" "R0" "roman" abs(dx/18))
    labelL=dbCreateLabel(cv "text" centerBox(X~>bBox) stringL "upperRight" "MXR90" "roman" (dx/22))
    labelH=dbCreateLabel(cv "text" centerBox(X~>bBox) stringH "upperLeft" "MYR90" "roman" (dx/22))
    leAttachFig(label r)
    leAttachFig(labelL r)
    leAttachFig(labelH r)
    label~>labelType="ILLabel" ;;Creates text label with area of figure
    labelL~>labelType="ILLabel" ;;Creates text label with area of figure
    labelH~>labelType="ILLabel" ;;Creates text label with area of figure
    )
    ) ;procedure

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 7 years ago in reply to Carona

    Your code doesn't the variable cv anywhere, so you're reliant on that having been set (and set correctly) before you hit the bindkey. Simplest solution is to put the line:

    cv=X~>cellView

    before the first dbCreateLabel line.

    By the way, your code breaks if the selected shape has no net information - so you might want to change it as follows. Note that I added some comments with "AB" above some parts that I had concerns about (for example, the setting of the label type to ILLabel makes no sense - that's for interpreted SKILL labels, and these are not SKILL expressions but strings containing numbers. That will have no effect at level 0, but if instantiated, it would mean the label has to be evaluated every time it is displayed, which is pointless.

    Finally, the code rather strangely has nested loops where the outer loop iterates over geGetSelectedSet and the inner loop iterates over geGetSelSet - both will return the same set of objects. I don't know why it's doing this, but if you have two rectangles selected, then it seems to stretch one and add labels on the other - I doubt that's what you want!

    Regards,

    Andrew.

    hiSetBindKey("Layout" "<Key>[" "stretchAreax()")
    
    /***********************************************
    Stretch Rectangle With Constant Area +X
    ************************************************/
    
    procedure( stretchAreax()
      foreach(X geGetSelectedSet()
        net = X~>net
        sSet = geGetSelSet()
        corners = car(sSet)~>bBox
        delta = 5
        ll = car(corners)
        ur = cadr(corners)
        dx = xCoord(ur) - xCoord(ll)
        x1 = xCoord(ll)
        x2 = xCoord(ur) + delta
        newdx = (xCoord(ur)+delta - xCoord(ll))
        rnewdx = round(newdx)
        dy = yCoord(ur) - yCoord(ll)
        rdy = round(dy)
        y1b = yCoord(ll)
        y1t = yCoord(ur)
        newarea = abs(newdx * dy)
        area = round(abs( dx * dy ))
        y2 = y1t - (dy-(area/newdx))
        printf("Area of rectangle is %L.\n" area) ;; Displays Area in CIW window
        printf("Length of Rectangle is %L.\n" newdx) ;; Displays Length in CIW window
        printf("Height of Rectangle is %L.\n" dy) ;; Displays Height in CIW window
    
        ; AB: this is a private function - should use car(geGetSelSet()) - or car(sSet) 
        ;     since you have it in a variable
        r=css()
        r~>?
        r~>??
        lowerLeft(r~>bBox)
        upperRight(r~>bBox)
        xCoord(lowerLeft(r~>bBox))
        yCoord(lowerLeft(r~>bBox))
        newBBox=list(list(x1 y1b) list(x2 y2))
        r~>bBox=newBBox
        string = sprintf(area "%L" area)
        stringL = sprintf(rnewdx "%L" rnewdx)
        stringH = sprintf(rdy "%L" rdy)
    
        foreach(selObj geGetSelSet()
          foreach(child selObj~>children
            when(member(child~>objType '("label" "textDisplay")) && child~>layerName=="text" && child~>purpose=="drawing"
              dbDeleteObject(child)
            )
          )
        )
    
        ; AB: Only create a textDisplay from the net if there is a net!
        when(net
          disp=dbCreateTextDisplay( net X list("text" "drawing" ) t centerBox(X~>bBox) "lowerRight" "R0" "roman" abs(dx/12) nil nil t nil t "name" nil) ;;Creates text label from net name of figure
        )
        cv=X~>cellView
        label=dbCreateLabel(cv "text" centerBox(X~>bBox) string "lowerLeft" "R0" "roman" abs(dx/18))
        labelL=dbCreateLabel(cv "text" centerBox(X~>bBox) stringL "upperRight" "MXR90" "roman" (dx/22))
        labelH=dbCreateLabel(cv "text" centerBox(X~>bBox) stringH "upperLeft" "MYR90" "roman" (dx/22))
        leAttachFig(label r)
        leAttachFig(labelL r)
        leAttachFig(labelH r)
        ; AB: these next three lines are superflous (incorrect, really)
        label~>labelType="ILLabel" ;;Creates text label with area of figure
        labelL~>labelType="ILLabel" ;;Creates text label with area of figure
        labelH~>labelType="ILLabel" ;;Creates text label with area of figure
      )
    ) ;procedure
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Deeksha D
    Deeksha D over 6 years ago in reply to Andrew Beckett

    Hi,

        while doing layout If pin labels are moved away from its respective pins... How to move those pin labels back to its respective pin location? I want to write a skill code where i want to select those labels and to press a bindkey then i want labels move its respective pins..?can you please help me on this..

    • 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