Home > Community > Forums > Custom IC SKILL > how to get the bounding box of an instance excluding the labels inside that instance?

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 get the bounding box of an instance excluding the labels inside that instance? 

Last post Tue, Mar 17 2009 7:43 PM by ahamlett. 3 replies.
Started by ashley 16 Mar 2009 08:47 PM. Topic has 3 replies and 2321 views
Page 1 of 1 (4 items)
Sort Posts:
  • Mon, Mar 16 2009 8:47 PM

    • ashley
    • Not Ranked
    • Joined on Tue, Mar 17 2009
    • Posts 2
    • Points 40
    how to get the bounding box of an instance excluding the labels inside that instance? Reply
    Hi,
    I'm new in skill coding and maybe someone can help me with my problem. 
    How can I compute the bounding box of an instance excluding the labels inside that instance (and also the labels on its sub-cells)?  BBox of labels are sometimes out-of-grid and I want to exclude them especially when they are located on the edges.  I can filter out the labels if they are within the current cell view, but I don't know how to do it if they are inside the instances.
    Thank you very much.
    regards,
    ashley
    • Post Points: 20
  • Mon, Mar 16 2009 9:55 PM

    • skillUser
    • Top 10 Contributor
    • Joined on Fri, Sep 19 2008
    • Austin, TX
    • Posts 2,535
    • Points 14,940
    Re: how to get the bounding box of an instance excluding the labels inside that instance? Reply

     Hi Ashley,

    There is a function, dbComputeBBoxNoNLP(), that will calculate a cellviews' bounding box excluding any NLP labels that it contains, or its sub-cells.  Here is an example of how it might be used:

     ;; get the seleted instance object id
     inst = car(geGetSelectedSet())
     ;; calculate the bounding box of the instances' master and
     ;; transform the bounding box (to the current cellview's
     ;; co-ordinate system) using the instance transform
     geTransformUserBBox(dbComputeBBoxNoNLP(inst~>master) geGetInstTransform(inst))

    Now, I don't know if you are working in a layout (I will guess "yes") or a schematic, but there will likely be labels that are not NLP labels if you are working in a layout, so the above may not help too much.  If this is the case, then it may be necessary to write something like the dbComputeBBoxNoNLP() function yourself, excluding labels from the calculated bounding box. Let us know - someone may have already written such code that they wouldn't mind sharing.

    I hope that the above is at least a good starting point, if not the actual answer that you are looking for.

    Regards,

    Lawrence.

    • Post Points: 20
  • Mon, Mar 16 2009 11:14 PM

    • ashley
    • Not Ranked
    • Joined on Tue, Mar 17 2009
    • Posts 2
    • Points 40
    Re: how to get the bounding box of an instance excluding the labels inside that instance? Reply

    Hi Lawrence,

     

    Yes, I'm working in a layout.  The dbComputeBBoxNoNLP() function still includes the labels, maybe because the labels in my layout are not NLP labels.  I think I need to write the code myself. 

     

    Can anyone give me an idea how to do it?  I have something in my mind but I'm not sure if it is the right way to do it.  I'm thinking of opening each of the instances' master and its sub-cells, select all objects excluding the labels and calculate the bbox of the group, and then close the opened cells once the bbox is determined.  I know it is not a good idea specially if an instance has sub-cells.  Is there a better way to do it?

     

    Thanks for your help.

     

    regards,

    ashley

    • Post Points: 20
  • Tue, Mar 17 2009 7:43 PM

    • ahamlett
    • Top 500 Contributor
    • Joined on Wed, Jul 16 2008
    • Dallas, TX
    • Posts 31
    • Points 585
    Re: how to get the bounding box of an instance excluding the labels inside that instance? Reply

    This is untested but I'm sure you can use it:

     

     procedure( getBoundingBox(cell @optional (transform list((0:0) "R0" 1.0)))
        let( (left bottom right top inst via mosaic lpp shape temp)
            
            foreach(lpp cell->lpps
                foreach(shape lpp->shapes
                    if(shape->objType != "label" && shape->objType != "textDisplay" then
                        temp = geTransformUserBBox(shape->bBox transform)
                        left    = caar(temp)
                        bottom    = cadar(temp)
                        right    = caadr(temp)
                        top        = cadadr(temp)
                    )
                )
            )
            
            foreach(inst cell->instances ; loop through instances
                if(inst->objType == "inst" then
                    if(dbobjectp(inst->master) then
                        temp = getBoundingBox(inst->master dbConcatTransform(inst->transform transform))
                        if(!floatp(left) || caar(temp) < left then
                            left = caar(temp)
                        )
                        if(!floatp(bottom) || cadar(temp) < bottom then
                            bottom = cadar(temp)
                        )
                        if(!floatp(right) || caadr(temp) > right then
                            right = caadr(temp)
                        )
                        if(!floatp(top) || cadadr(temp) > top then
                            top = cadadr(temp)
                        )
                    else
                        getWarn() ; the cell couldn't be opened so get the warning before its printed
                    )
                )
            )
            
            foreach(via cell->vias ; loop through vias
                if(dbobjectp(via->viaHeader->master) then
                    temp = getBoundingBox(via->viaHeader->master dbConcatTransform(list(via->origin via->orient 1.0) transform))
                    if(!floatp(left) || caar(temp) < left then
                        left = caar(temp)
                    )
                    if(!floatp(bottom) || cadar(temp) < bottom then
                        bottom = cadar(temp)
                    )
                    if(!floatp(right) || caadr(temp) > right then
                        right = caadr(temp)
                    )
                    if(!floatp(top) || cadadr(temp) > top then
                        top = cadadr(temp)
                    )
                else
                    getWarn() ; the cell couldn't be opened so get the warning before its printed
                )
            )
            
            foreach(mosaic cell->mosaics ; loop through mosaics
                if(mosaic->mosaicType == "simple" then
                    let((orient xy isOA newTransform mosaicTransform)
                        isOA = (isCallable('dbGetDatabaseType) && dbGetDatabaseType() == "OpenAccess")
                        orient = car(mosaic->tileArray)
                        when(isOA
                            mosaicTransform = dbConcatTransform(dbConcatTransform(list(mapcar('minus mosaic->xy) "R0" 1.0) list(list(0 0) orient 1.0)) list(mosaic->xy "R0" 1.0))
                        )
                        for(row 0 sub1(mosaic->rows)
                            for(col 0 sub1(mosaic->columns)
                                xy = list((xCoord(mosaic->xy) + (col * mosaic->uX)) (yCoord(mosaic->xy) + (row * mosaic->uY)))
                                newTransform = if(isOA dbConcatTransform(dbConcatTransform(list(xy "R0" 1.0) mosaicTransform) transform) dbConcatTransform(list(xy orient 1.0) transform))
                                if(dbobjectp(car(mosaic->instanceList)->master) then
                                    temp = getBoundingBox(car(mosaic->instanceList)->master newTransform)
                                    if(!floatp(left) || caar(temp) < left then
                                        left = caar(temp)
                                    )
                                    if(!floatp(bottom) || cadar(temp) < bottom then
                                        bottom = cadar(temp)
                                    )
                                    if(!floatp(right) || caadr(temp) > right then
                                        right = caadr(temp)
                                    )
                                    if(!floatp(top) || cadadr(temp) > top then
                                        top = cadadr(temp)
                                    )
                                else
                                    getWarn()
                                )
                            )
                        )
                    )
                )
            )
            
            list(left:bottom right:top)
        )
    )

    inst = car(geGetSelectedSet())
    println(getBoundingBox(inst))

     

    • Post Points: 5
Page 1 of 1 (4 items)
Sort Posts:
Started by ashley at 16 Mar 2009 08:47 PM. Topic has 3 replies.