zoom to selected set in Schematic editor

Discussion in 'Cadence' started by vlsidesign, Nov 6, 2009.

  1. vlsidesign

    vlsidesign Guest

    In Virtuoso layout tool, you can zoom in to the selection
    (leZoomToSelSet). Is there a comparable schematic editor command
    function?
     
    vlsidesign, Nov 6, 2009
    #1
  2. vlsidesign wrote, on 11/06/09 01:17:
    In IC61, you have this - it's the SKILL function schHiZoomToSelSet().

    For IC5141 you could use this code. Just call abZoomSel().

    Regards,

    Andrew.


    /* abZoomSel.il

    Author A.D.Beckett
    Group Structured Custom, Cadence Design Systems Ltd
    Machine SUN
    Modified A.D.Beckett
    By Feb 04, 1998

    Various procedures for zooming to selected set, and for
    zooming to probed things.

    ***************************************************

    SCCS Info: @(#) abZoomSel.il 11/20/08.15:26:22 1.3

    */

    /*************************************************
    * *
    * (abExtendBBox bbox @rest xy) *
    * *
    * procedure to take a bounding box and extend it *
    * by a list of points. *
    * *
    *************************************************/

    (procedure (abExtendBBox bbox @rest xy)
    (let (minx maxx miny maxy coord)
    (if (and (listp xy)
    (listp (car xy))
    (listp (car (car xy))))
    (setq xy (car xy)))
    (if (null bbox)
    (setq bbox (list (car xy) (car xy))))
    (setq minx (xCoord (lowerLeft bbox)))
    (setq maxx (xCoord (upperRight bbox)))
    (setq miny (yCoord (lowerLeft bbox)))
    (setq maxy (yCoord (upperRight bbox)))
    (foreach coord xy
    (if (lessp (xCoord coord) minx) (setq minx (xCoord coord)))
    (if (lessp (yCoord coord) miny) (setq miny (yCoord coord)))
    (if (greaterp (xCoord coord) maxx) (setq maxx (xCoord coord)))
    (if (greaterp (yCoord coord) maxy) (setq maxy (yCoord coord))))
    /* return the new bbox */
    (list (list minx miny) (list maxx maxy))))

    /******************************************
    * *
    * (abEnlargeBBox bbox percent) *
    * *
    * extend the bounding box by a percentage *
    * *
    ******************************************/

    (procedure (abEnlargeBBox bbox percent)
    (let (extendX extendY)
    /* calculate extensions */
    (setq extendX
    (quotient
    (times
    (difference
    (xCoord (upperRight bbox))
    (xCoord (lowerLeft bbox)))
    percent)
    200.0))
    (setq extendY
    (quotient
    (times
    (difference
    (yCoord (upperRight bbox))
    (yCoord (lowerLeft bbox)))
    percent)
    200.0))
    /* return the enlarged bounding box */
    (list
    (list
    (difference (xCoord (lowerLeft bbox)) extendX)
    (difference (yCoord (lowerLeft bbox)) extendY))
    (list
    (plus (xCoord (upperRight bbox)) extendX)
    (plus (yCoord (upperRight bbox)) extendY)))))

    /******************************************
    * *
    * (abBBoxToPoints bbox) *
    * *
    * Convert a bounding box to a point list. *
    * *
    ******************************************/

    (procedure (abBBoxToPoints bbox)
    (list
    (lowerLeft bbox)
    (list (xCoord (lowerLeft bbox)) (yCoord (upperRight bbox)))
    (upperRight bbox)
    (list (xCoord (upperRight bbox)) (yCoord (lowerLeft bbox)))))


    /**********************************************************
    * *
    * (abFindBBox select) *
    * *
    * Find the bounding box of the list of objects passed in. *
    * Copes with partially selected objects as well. *
    * *
    **********************************************************/

    (procedure (abFindBBox select @optional forceWholeObject)
    (let (bbox)
    (foreach dbp select
    (if (or forceWholeObject (geIsFigAllSelected dbp))
    (setq bbox (abExtendBBox bbox (dbGetq dbp bBox)))
    (let (pointList)
    /* generate a point list for object, either directly or from bbox */
    (unless (setq pointList (dbGetq dbp points))
    (setq pointList (abBBoxToPoints (dbGetq dbp bBox))))
    /* scan two lists, extending bbox if point is selected */
    (mapc '(lambda (point bool)
    (when bool (setq bbox (abExtendBBox bbox point))))
    pointList
    (geGetSelSetFigPoint dbp)))))
    /* return bounding box */
    bbox))


    /*******************************************
    * *
    * (abZoomSel @optional (select nil)) *
    * *
    * Zoom in on the selected set (no overlap) *
    * Copes with partially selected objects *
    * *
    *******************************************/

    (procedure (abZoomSel @optional (select nil))
    (let (bbox wind forceWholeObject)
    /* get current window */
    (setq wind (hiGetCurrentWindow))
    /* get selected set if not passed in */
    (if select
    (setq forceWholeObject t)
    (setq select (geGetSelSet wind)))

    (setq bbox (abFindBBox select forceWholeObject))
    (if bbox
    (hiZoomIn wind (list (geEditToWindowPoint wind (lowerLeft bbox))
    (geEditToWindowPoint wind (upperRight bbox))))
    (hiDisplayAppDBox
    ?name 'abZSnothingSelected
    ?dboxBanner "Nothing Selected"
    ?dboxText "Nothing is selected for Zoom Selected"
    ?dialogType hicMessageDialog
    ?buttonLayout 'Close))))


    /*****************************************
    * *
    * (abZoomSelPlus @optional (select nil)) *
    * *
    * same as abZoomSel, but enlarges by 10% *
    * *
    *****************************************/

    (procedure (abZoomSelPlus @optional (select nil) (percent 10))
    (let (bbox wind forceWholeObject)
    /* get current window */
    (setq wind (hiGetCurrentWindow))
    /* get selected set if not passed in */
    (if select
    (setq forceWholeObject t)
    (setq select (geGetSelSet wind)))

    (setq bbox (abFindBBox select forceWholeObject))
    (if bbox
    (progn
    (setq bbox (abEnlargeBBox bbox percent))
    (hiZoomIn wind (list (geEditToWindowPoint wind (lowerLeft bbox))
    (geEditToWindowPoint wind (upperRight bbox)))))
    (hiDisplayAppDBox
    ?name 'abZSnothingSelected
    ?dboxBanner "Nothing Selected"
    ?dboxText "Nothing is selected for Zoom Selected"
    ?dialogType hicMessageDialog
    ?buttonLayout 'Close))))

    /***************************************************************
    * *
    * (abZoomOrig win) *
    * *
    * simple function for zooming in at the origin *
    * *
    ***************************************************************/

    (procedure (abZoomOrig win)
    (hiZoomIn win '((-0.2 -0.2) (0.2 0.2))))

    /******************************************************************************
    * *
    * (abZoomProbes @optional (window (hiGetCurrentWindow))) *
    * *
    * Zoom into probed objects. Works with nets and instances in extracted views. *
    * Haven't tested with all objects, but seems to work so far! *
    * *
    ******************************************************************************/

    (procedure (abZoomProbes @optional (window (hiGetCurrentWindow)))
    (let (cellView probedObjects probedFigs)
    (setq cellView (geGetEditCellView window))
    ;-----------------------------------------------------------------
    ; find all the probed objects in the current window
    ;-----------------------------------------------------------------
    (setq probedObjects
    (setof obj (foreach mapcar probe
    (geGetAllProbe window) (getq probe objectId))
    (equal (dbGetq obj cellView) cellView)))
    (setq probedFigs
    (foreach mapcan object probedObjects
    (case (dbGetq object objType)
    ("sig"
    ;-------------------------------------------
    ; combine the figures
    ;-------------------------------------------
    (foreach mapcan net
    ;----------------------------------
    ; get from sigs to member nets
    ;----------------------------------
    (foreach mapcar memNet
    (dbGetq object memNets)
    (car memNet))
    (dbGetq net figs))
    )
    ("net"
    (dbGetq object figs)
    )
    (t (list object))
    )))
    ;-----------------------------------------------------------------
    ; zoom into them
    ;-----------------------------------------------------------------
    (abZoomSel probedFigs)
    ))
     
    Andrew Beckett, Nov 8, 2009
    #2
  3. vlsidesign

    vlsidesign Guest

    I am not on the new Cadence right now, so I needed your custom
    function.
    Thanks Andrew, it works beautifully!
     
    vlsidesign, Nov 9, 2009
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.